import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, AfterContentInit, AfterContentChecked, OnChanges, OnInit, OnDestroy, ElementRef, SimpleChanges, Provider, DoCheck, ModuleWithProviders } from '@angular/core'; import * as _angular_forms from '@angular/forms'; import { AbstractControl, FormGroup, NgControl, RequiredValidator } from '@angular/forms'; import { Breakpoints } from '@siemens/element-ng/resize-observer'; import { TranslatableString } from '@siemens/element-translate-ng/translate'; import * as _siemens_element_ng_form from '@siemens/element-ng/form'; import * as _angular_forms_signals from '@angular/forms/signals'; import { SignalFormsConfig } from '@angular/forms/signals'; /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** * Interface for form error mapper. * It resolves a key to either a translatable string or function * which is called with the validation error for its key and should return a translatable string. */ interface SiFormValidationErrorMapper { required?: TranslatableString | ((error: { required: boolean; }) => TranslatableString); requiredTrue?: TranslatableString | ((error: { required: boolean; }) => TranslatableString); email?: TranslatableString | ((error: { email: boolean; }) => TranslatableString); min?: TranslatableString | ((error: { min: number; actual: number; }) => TranslatableString); max?: TranslatableString | ((error: { max: number; actual: number; }) => TranslatableString); minLength?: TranslatableString | ((error: { requiredLength: number; actualLength: number; }) => TranslatableString); maxLength?: TranslatableString | ((error: { requiredLength: number; actualLength: number; }) => TranslatableString); pattern?: TranslatableString | ((error: { pattern: string | RegExp; }) => TranslatableString); numberFormat?: TranslatableString | ((error: { numberFormat: boolean; }) => TranslatableString); dateFormat?: TranslatableString | ((error: { format: string; }) => TranslatableString); maxDate?: TranslatableString | ((error: { max: Date; actual: Date; }) => TranslatableString); minDate?: TranslatableString | ((error: { min: Date; actual: Date; }) => TranslatableString); [key: string]: undefined | string | ((error: any) => string); } interface SiFormValidationError { controlName?: string; controlNameTranslationKey?: string; errorCode: TranslatableString; errorCodeTranslationKey?: string; errorParams?: any; } /** * @deprecated This component should no longer be used. * * When providing a form wide error mapper, use the {@link provideFormValidationErrorMapper}. * ```ts * import { provideFormValidationErrorMapper } form '@siemens/element-ng/forms' * * @Component({ * template: `
...
` * providers: [provideFormValidationErrorMapper({ * 'name.required': 'CUSTOM_REQUIRED_ERROR' * })] * }) * class MyFormComponent {} * ``` * * When using the column layout, use the `form-col-layout` classes. * * ```html * *
...
* *
...
* ``` * * For a custom breakpoint use the SCSS mixin: * * ```scss * @use '@siemens/element-theme/src/styles/bootstrap/mixins/form-layout'; * * // Custom responsive breakpoint * .custom-form-col-layout { * // Above 400px the column layout is used * @include form-layout.responsive-form-col-layout(400px); * } * ``` */ declare class SiFormContainerComponent { /** * Set the form entity to the container to enable the overall form validation on in * the form container edit panel. */ readonly form: _angular_core.InputSignal | undefined>; /** * A form container in readonly mode is only displaying the form content without ability * to change it. The edit panel with typically save and cancel buttons is hidden. Set * to true to display the edit panel. * * @defaultValue false */ readonly readonly: _angular_core.InputSignalWithTransform; /** * The container hosts the form within a siResizeContainer to configure the breakpoint for * different screen sizes. Optionally, change the container breakpoints with the contentContainerBreakpoints * input. */ readonly contentContainerBreakpoints: _angular_core.InputSignal; /** * In some scenarios, one may not want the form container to be responsible for the layout relevant * `si-container-[xs|...]` classes, but let this be done by a different, nested component, e.g. by a * group box. In these cases, the property should be set to true. * * @defaultValue false */ readonly disableContainerBreakpoints: _angular_core.InputSignalWithTransform; /** * Every validation error has an errorCode. This map holds translate keys for error codes. The keys can * be used to display a translated message for each validation error. The defaults old english readable * key defaults for the Angular standard validators of the `Validators` class like `min`, `max` or `required`. * * Use the input to set your own translate keys for the form validators you need. */ readonly errorCodeTranslateKeyMap: _angular_core.InputSignal | undefined>; /** * A map the maps from control names of the form to their translate keys. * The initial map is empty and the user is responsible to add the required * translate keys. * * @defaultValue * ``` * new Map() * ``` */ readonly controlNameTranslateKeyMap: _angular_core.InputSignal>; /** * Disables the automatic error printing in all nested {@link SiFormItemComponent}. Error printing will be enabled by default in v46. * * @defaultValue false */ readonly disableErrorPrinting: _angular_core.InputSignalWithTransform; /** * A custom width value to be applied to all labels. * * @example labelWidth="100px". */ readonly labelWidth: _angular_core.InputSignal; protected hasParentContainer: boolean; /** @internal */ readonly formErrorMapper: _angular_core.Signal<{ [key: string]: string | ((error: any) => string) | undefined; required?: TranslatableString | ((error: { required: boolean; }) => TranslatableString); requiredTrue?: TranslatableString | ((error: { required: boolean; }) => TranslatableString); email?: TranslatableString | ((error: { email: boolean; }) => TranslatableString); min?: TranslatableString | ((error: { min: number; actual: number; }) => TranslatableString); max?: TranslatableString | ((error: { max: number; actual: number; }) => TranslatableString); minLength?: TranslatableString | ((error: { requiredLength: number; actualLength: number; }) => TranslatableString); maxLength?: TranslatableString | ((error: { requiredLength: number; actualLength: number; }) => TranslatableString); pattern?: TranslatableString | ((error: { pattern: string | RegExp; }) => TranslatableString); numberFormat?: TranslatableString | ((error: { numberFormat: boolean; }) => TranslatableString); dateFormat?: TranslatableString | ((error: { format: string; }) => TranslatableString); maxDate?: TranslatableString | ((error: { max: Date; actual: Date; }) => TranslatableString); minDate?: TranslatableString | ((error: { min: Date; actual: Date; }) => TranslatableString); }>; /** * Indicates whether the user interacted with the form. * @returns `true`, if the user selected at least one form element and * [blurred]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/blur_event} by losing focus again * (e.g. by setting focus on another element), or by editing the content of a form element. * Otherwise `false`. */ get userInteractedWithForm(): boolean; /** * Indicates whether content editor message shall be styled as success. * @returns `true`, if {@link SiFormContainerComponent.userInteractedWithForm} is true and * the form is valid. */ get validFormContainerMessage(): boolean; /** * Indicates whether the content editor message shall be styled as warning. * @returns `true`, if {@link SiFormContainerComponent.userInteractedWithForm} is true and * the form is invalid. */ get invalidFormContainerMessage(): boolean; protected getControlNameTranslateKey(controlName: string): string | undefined; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵcmp: _angular_core.ɵɵComponentDeclaration, "si-form-container", never, { "form": { "alias": "form"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "contentContainerBreakpoints": { "alias": "contentContainerBreakpoints"; "required": false; "isSignal": true; }; "disableContainerBreakpoints": { "alias": "disableContainerBreakpoints"; "required": false; "isSignal": true; }; "errorCodeTranslateKeyMap": { "alias": "errorCodeTranslateKeyMap"; "required": false; "isSignal": true; }; "controlNameTranslateKeyMap": { "alias": "controlNameTranslateKeyMap"; "required": false; "isSignal": true; }; "disableErrorPrinting": { "alias": "disableErrorPrinting"; "required": false; "isSignal": true; }; "labelWidth": { "alias": "labelWidth"; "required": false; "isSignal": true; }; }, {}, never, ["[si-form-container-message]", "[si-form-container-buttons]", "[si-form-container-content]"], true, never>; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ declare const SI_FORM_ITEM_CONTROL: InjectionToken; /** * Common interface for form item controls. * Controls that should be connected to {@link SiFormItemComponent} must implement this interface * and must be provided using the {@link SI_FORM_ITEM_CONTROL} token. */ interface SiFormItemControl { /** The actual id of the control that should be used in the `for` attribute of a label. */ readonly id?: string | Signal; /** * ID that should be assigned to the label element inside the {@link SiFormItemComponent}. * * If the target control is not of type input, select or button, it cannot be referenced by a label. * Instead, aria-labelledby must be used to create a reference to a label. * In such a case, an implementation of {@link SiFormItemControl} must provide the id of the label in {@link labelledby}. * {@link SiFormItemComponent} will apply the id to the label * so that it can be used inside the control to reference it in the aria-labelledby attribute. */ readonly labelledby?: string | Signal | null; /** * Generated ID that the {@link SiFormItemComponent} will assign to the element containing the error messages. * Implementations of {@link SiFormItemControl} must generate this ID * and assign it to the `aria-describedby` attribute of their focusable elements. */ readonly errormessageId: string | Signal; /** If the control is meant to be used a checkbox. This affects the label positioning. */ readonly isFormCheck?: boolean; } /** @internal */ interface SiFormError { key: string; message?: TranslatableString; params: any; } declare class SiFormItemComponent implements AfterContentInit, AfterContentChecked, OnChanges, OnInit, OnDestroy, SiFormFieldsetControl { /** * The label to be displayed in the form item. * It will be translated if a translation key is available. */ readonly label: _angular_core.InputSignal; /** * A custom width value to be applied to the label. * A value of 0 is allowed as well to visually hide away the label area. * * Numbers will be converted to pixels. * Using numbers is discouraged and might be dropped. * * @example labelWidth="100px" */ readonly labelWidth: _angular_core.InputSignal; /** * Disables the automatic error printing. Error printing will be enabled by default in v46. * * @defaultValue false */ readonly disableErrorPrinting: _angular_core.InputSignalWithTransform; /** Maps validation errors of the contained control to custom messages. */ readonly formErrorMapper: _angular_core.InputSignal; /** * Defines that this form item is required for the overall form to be valid. * * @defaultValue false */ readonly requiredInput: _angular_core.InputSignalWithTransform; protected readonly fieldControlQuery: _angular_core.Signal; /** @internal */ readonly ngControl: _angular_core.Signal; protected readonly controlElementRef: _angular_core.Signal | undefined>; protected readonly requiredValidator: _angular_core.Signal; /** @internal */ readonly errors: _angular_core.WritableSignal; /** @internal */ readonly touched: _angular_core.WritableSignal; protected fieldset: SiFormFieldsetComponent | null; protected container: SiFormContainerComponent<{ [x: string]: _angular_forms.AbstractControl; }> | null; protected get formItemId(): string | null; protected get formItemLabelledBy(): string | null; protected get formItemErrormessageId(): string | null; protected readonly fieldControl: _angular_core.Signal; private validationErrorService; private requiredTestControl; private validator?; private previousErrors?; private readonly hasRequiredValidator; private readonly fieldControlNative; protected readonly labelWidthCssVar: _angular_core.Signal; protected readonly printErrors: _angular_core.Signal; /** @internal */ readonly required: _angular_core.Signal; /** @internal */ readonly control: _angular_core.Signal<_angular_forms.AbstractControl | null | undefined>; /** @internal */ readonly radioGroupName: _angular_core.Signal; ngOnChanges(changes: SimpleChanges): void; ngOnInit(): void; ngAfterContentInit(): void; ngAfterContentChecked(): void; ngOnDestroy(): void; private updateRequiredState; private updateValidationMessages; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ interface SiFormFieldsetControl { readonly control: Signal; readonly radioGroupName?: Signal; readonly required: Signal; readonly touched: Signal; readonly errors: Signal; } declare class SiFormFieldsetComponent { private static labelIdCounter; /** The label for the entire fieldset. */ readonly label: _angular_core.InputSignal; /** Overrides the parent label width. */ readonly labelWidth: _angular_core.InputSignal; /** * Adds a required marker to the label * * @defaultValue false */ readonly required: _angular_core.InputSignalWithTransform; /** * Switches all child inputs to inline mode * * @defaultValue false */ readonly inline: _angular_core.InputSignalWithTransform; private readonly formItems; /** @internal */ readonly hasOnlyRadios: _angular_core.Signal; protected readonly errors: _angular_core.Signal; protected readonly showErrors: _angular_core.Signal; protected readonly isRequired: _angular_core.Signal; protected readonly labelId: string; /** @internal */ registerControl(item: SiFormFieldsetControl): void; /** @internal */ unregisterControl(item: SiFormFieldsetControl): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Constructs a full form field including error messages, labels and aria-* attributes. * It must be used with Angular's signal forms. * * @example * ```html * * * * * * * ``` */ declare class SiFormFieldComponent implements SiFormFieldsetControl { private static idCounter; /** * The label to be displayed in the form field. * It will be translated if a translation key is available. */ readonly label: _angular_core.InputSignal; private readonly formField; private readonly fieldControl; protected readonly fieldset: SiFormFieldsetComponent | null; private readonly validationErrorService; private readonly generatedId; /** The id of the connected control, used for the label's `for` attribute. */ protected readonly controlId: _angular_core.Signal; protected readonly errormessageId: _angular_core.Signal; protected readonly labelledby: _angular_core.Signal; /** Whether the connected control is a form-check (checkbox, radio or switch). */ protected readonly isFormCheck: _angular_core.Signal; private readonly fieldState; /** @internal */ readonly control: _angular_core.Signal<_angular_forms_signals.FieldTree>; /** @internal */ readonly required: _angular_core.Signal; /** @internal */ readonly showRequired: _angular_core.Signal; private readonly invalid; /** @internal */ readonly touched: _angular_core.Signal; protected readonly isPartOfRadioGroup: _angular_core.Signal; /** @internal */ readonly errors: _angular_core.Signal<_siemens_element_ng_form.SiFormError[]>; constructor(); private syncControlId; /** Associates the error messages with the projected control for assistive technologies. */ private syncErrorDescription; /** * Reflects the validation state onto the projected control via `aria-invalid`. This is needed * because signal forms does not set `aria-invalid`, and the native `:user-invalid` pseudo-class * ignores `markAsTouched()`. The matching `.ng-invalid`/`.ng-touched` classes that drive the * styling are added by signal forms itself, see `provideSiFormFieldConfig()`. */ private syncInvalidState; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** * Provides the signal forms configuration required by {@link SiFormFieldComponent}. * * It restores the `ng-*` classes applied by the directives of {@link @angular/forms#FormsModule | FormsModule} / {@link @angular/forms#ReactiveFormsModule | ReactiveFormsModule}. * * @example * ```ts * bootstrapApplication(AppComponent, { * providers: [provideSiFormFieldConfig()] * }); * ``` */ declare const provideSiFormFieldConfig: (config?: SignalFormsConfig) => Provider[]; /** * Directive to show a tooltip with validation errors of a form control. * * In general, `si-form-item` should be used. * This directive is intended only for cases where the tooltip cannot be shown inline. * This is typically the case for tables and lists where the validation message would break the layout. * * @example * ```html * * ``` */ declare class SiFormValidationTooltipDirective implements DoCheck { private static idCounter; private tooltipService; private formValidationService; private formContainer; /** Maps validation errors of the associated form control to custom tooltip messages. */ readonly formErrorMapper: _angular_core.InputSignal; private ngControl; private elementRef; protected readonly describedBy: string; private readonly errors; private readonly touched; private readonly canShowTooltip; private currentErrors; constructor(); ngDoCheck(): void; private updateErrors; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ declare class SiFormModule { /** * Overrides the default configuration of the form module. * * @param errorMapper - The error mappers is used to resolve angular validation errors. * It will be merged with already existing error mappers. */ static withConfiguration({ validationErrorMapper }: { validationErrorMapper: SiFormValidationErrorMapper; }): ModuleWithProviders; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** * The error mapper is used to resolve an angular validation error to a {@link TranslatableString}. * It will be merged with already existing error mappers. */ declare const provideFormValidationErrorMapper: (mapper: SiFormValidationErrorMapper) => Provider; export { SI_FORM_ITEM_CONTROL, SiFormContainerComponent, SiFormFieldComponent, SiFormFieldsetComponent, SiFormItemComponent, SiFormModule, SiFormValidationTooltipDirective, provideFormValidationErrorMapper, provideSiFormFieldConfig }; export type { SiFormError, SiFormItemControl, SiFormValidationError, SiFormValidationErrorMapper };