import { Type } from '@angular/core'; import { FormGroup, FormArray, AbstractControl, FormControl } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { Params } from '../core/utils/helpers'; import { ContainerControl } from './container/container.control'; /** * Defines a form section that represents the `FormGroup` or `FormArray` class. */ export declare type FormSection = FormGroup | FormArray; /** * A collection of key/value elements, where the key is the validator name and the value is the value * that the validator needs to check. */ export declare type ValidatorArguments = Params; /** * An enum that describes how inline contents of a block are horizontally aligned if the contents * do not completely fill the line box. */ export declare enum TextAlign { /** * The inline contents are aligned to the left edge of the line box. In vertical text, * `left` aligns to the edge of the line box that would be the start edge for left-to-right text. */ left = "left", /** * The inline contents are centered within the line box. */ center = "center", /** * The inline contents are aligned to the right edge of the line box. In vertical text, * `right` aligns to the edge of the line box that would be the end edge for left-to-right text. */ right = "right", /** * The text is justified. */ justify = "justify" } /** * An enum that represents the content position of an element inside of a `FormFieldControl`. */ export declare enum ContentPosition { /** * Adding the `prefix` option to an element will designate it as the prefix. */ prefix = "matPrefix", /** * Adding the `suffix` option to an element will designate it as the suffix. */ suffix = "matSuffix", /** * Adding the `none` option to an element will not show it. */ none = "none" } /** * An enum that represents the icon source type. */ export declare enum IconSource { /** * The icon is obtained from an internal source. In this case, it uses an icon that was copied to * the 'assets' folder of the project, and it was registered using the `IconService.registerIcons` method. */ internal = "internal", /** * The icon is obtained from an external source. In this case, * it uses a 'Material Icon' from 'https://fonts.googleapis.com/icon?family=Material+Icons'. */ external = "external" } /** * Data structure for holding an icon. */ export declare class IconValue { /** * Returns the icon source type. * By default, its value is `IconSource.internal`. */ source: IconSource; /** * Returns the icon position type. * By default, its value is `ContentPosition.prefix`. */ position: ContentPosition; /** * Returns the icon name. * By default, its value is `IconService.defaultIconName`. */ name: string; /** * Creates a new instance of the `IconValue` class. * @param s The icon source type. By default, its value is `IconSource.internal`. * @param p The icon position type. By default, its value is `ContentPosition.prefix`. * @param n The icon name. By default, its value is `IconService.defaultIconName`. */ constructor(s?: IconSource, p?: ContentPosition, n?: string); /** * Sets the default value for each undefined value. */ setDefaultValueIfUndefined(): void; /** * Sets the default value for each undefined value, but the icon position is always set to the specified value. * @param iconPosition The icon position to set. */ setDefaultValueIfUndefined_setPosition(iconPosition: ContentPosition): void; } /** * An enum that represents the hint position of a `HintValue`. */ export declare enum HintPosition { /** * Adding the `start` option to a `HintValue` will designate it as start-aligned. */ start = "start", /** * Adding the `end` option to a `HintValue` will designate it as end-aligned. */ end = "end", /** * Adding the `none` option to a `HintValue` will not show it. */ none = "none" } /** * Data structure for holding a hint. * A hint label is additional descriptive text that appears below the control's underline. */ export declare class HintValue { /** * Returns the hint position type. * By default, its value is `HintPosition.none`. */ position: HintPosition; /** * Returns the hint label. * By default, its value is `''`. */ label: string; /** * Creates a new instance of the `HintValue` class. * @param p The hint position type. By default, its value is `HintPosition.none`. * @param l The hint label. By default, its value is `''`. */ constructor(p?: HintPosition, l?: string); /** * Sets the default value for each undefined value. */ setDefaultValueIfUndefined(): void; /** * Sets the default value for each undefined value, but the hint position is always set to the specified value. * @param hintPosition The hint position to set. */ setDefaultValueIfUndefined_setPosition(hintPosition: HintPosition): void; } /** * This enum is deprecated. * Represents a form field type. */ export declare enum FormFieldType { /** A button control. */ action_button = "action_button", /** A container control that is showed as a panel. */ container_panel = "container_panel", /** A container control that is showed very simple. */ container_simple = "container_simple", /** A container control that allows the writing of a name of something in different language. */ container_label_diff_lang = "container_label_diff_lang", /** A text control. */ text = "text", /** A textarea control. */ textarea = "textarea", /** A datapicker control. */ datepicker = "datepicker", /** A checkbox control. */ checkbox = "checkbox", /** A url control. */ url = "url", /** An email control. */ email = "email", /** An identifier control. */ identifier = "identifier", /** An issn control. */ issn = "issn", /** A rnps control. */ rnps = "rnps", /** A vocabulary control. */ vocabulary = "vocabulary", vocabulary_tree = "toco-vocabulary-tree", /** A term parent control. */ term_parent = "term_parent", /** A select control. */ select = "select", /** A select control. */ select_expr = "select_expr", /** A select with a filter control. */ select_filter = "select_filter", /** A select with a filter control. */ select_tree = "select_tree" } /** * A base interface that represents the content of a `FormFieldControl`. */ export interface FormFieldContent { /** * Returns the parent `ContainerControl` of this control. * It is always set internally. * By default, its value is `undefined`. */ parentContainerControl?: ContainerControl; /** * Returns the parent `FormSection` that represents the parent `FormGroup` or `FormArray` of this control. * It is always set internally. * By default, its value is `undefined`. */ parentFormSection?: FormSection; /** * Returns the control's minimum width. * The minimum width of the content area, padding area or border area (depending on `box-sizing`) * of certain boxes. Allows authors to constrain content width to a centain range. * By default, its value is `'15em'`. */ minWidth?: string; /** * Returns the control's width. * The width of the content area, padding area or border area (depending on `box-sizing`) of certain boxes. * By default, its value is `minWidth`. */ width?: string; /** * Returns the control's label. * See the `ContainerContent` for the particular interpretation of this field. * See the `ActionContent` for the particular interpretation of this field. * By default, its value is `''`. Each control sets its own label. */ label?: string; /** * Returns the control's placeholder. * By default, its value is `''`. Each control sets its own placeholder. */ placeholder?: string; /** * Returns true if the control is required; otherwise, false. * See the `ContainerContent` for the particular interpretation of this field. * By default, its value is `false`. */ required?: boolean; /** * Returns the control's text align. * By default, its value is `TextAlign.left`. */ textAlign?: TextAlign; /** * Returns the control's aria-label. * Defines a string value that labels the current element. * By default, its value is `'Text Input'`. Each control sets its own aria-label. */ ariaLabel?: string; /** * The control's value. * By default, its value is `undefined`. */ value?: any; /** * This `type` field is deprecated, you must use the `controlType` field. * Returns the control's type that is used to create the control. * Implementation notes: * - It must be specified; otherwise, an exception is thrown. */ type?: FormFieldType; /** * Returns the control's type that is used to create the control. * Implementation notes: * - It must be specified; otherwise, an exception is thrown. */ controlType?: Type; /** * Returns the control's name that is used to save the control's value as a name/value pair. * Implementation notes: * - It can be used with a JSON string. * - It must be specified; otherwise, an exception is thrown. */ name?: string; /** * The control's extra content. For any other content needed by an specific `FormFieldControl`. * By default, its value is `undefined`. */ extraContent?: any; } /** * Returns a new object that represents the clone of the specified `FormControl` target. * @param target The `FormControl` object to clone. */ export declare function cloneFormControl(target: FormControl): FormControl; /** * Returns a new object that represents the clone of the specified `FormSection` target. * @param target The `FormSection` object to clone. */ export declare function cloneFormSection(target: FormSection): FormSection; /** * Represents the base abstract class for a control that is treated as a form field. */ export declare abstract class FormFieldControl { /** * Represents the `ContentPosition` enum for internal use. */ readonly contentPosition: typeof ContentPosition; /** * Represents the `IconSource` enum for internal use. */ readonly iconSource: typeof IconSource; /** * Input field that contains the content of this class. */ content: FormFieldContent; /** * Returns the language currently used. * This is a static field. */ protected static currentLang: string; /** * Returns true if the translation is built by the control; otherwise, false. * It is used to select the way the translation is built for the control. * By default, its value is `false`. * As an example of usage for this field, the `InputNumberComponent` class implements the logic when this value is `true`. */ isTranslationBuiltByControl: boolean; /** * Constructs a new instance of this class. */ constructor(); /** * Sets the new language. * @param transServ The `TranslateService` instance injected. */ protected setNewLanguage(transServ: TranslateService): void; /** * Initializes the `content` input property. * @param label The default label to use. It is used if the `content.label` is not specified. * @param placeholder The default placeholder to use. It is used if the `content.placeholder` is not specified. */ protected init(label: string, placeholder?: string): void; /** * Initializes the control's value. It uses the `content.value` and it is already different of `undefined`. * It also checks if the specified `content.value` is correct. For internal use only. */ protected abstract initValue(): void; /** * Returns this instance. */ abstract readonly getInstance: FormFieldControl; /** * Returns the parent `ContainerControl` of this control. * It is always set internally. */ readonly parentContainerControl: ContainerControl; /** * Adds the specified `control`/`internalControl` as a child * to the `content.containerControlChildren`/`content.parentFormSection` respectively. * @param control Form control to be added (descendant from `FormFieldControl`). * @param internalControl Internal form control to be added (`FormControl`, `FormGroup`, or `FormArray`). */ protected addAsChildControl(control: any, internalControl: AbstractControl): void; /** * Returns true if the specified `IconValue` has the specified `ContentPosition` value; otherwise, false. * @param icon The `IconValue` to check. * @param contentPosition The `ContentPosition` value to check. */ iconPositionState(icon: IconValue, contentPosition: ContentPosition): boolean; /** * Returns true if the specified `IconValue` has the specified `IconSource` value; otherwise, false. * @param icon The `IconValue` to check. * @param iconSource The `IconSource` value to check. */ iconSourceState(icon: IconValue, iconSource: IconSource): boolean; }