UNPKG

smart-webcomponents-angular

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

928 lines (921 loc) 51 kB
if(typeof window !== 'undefined') { if (!window['Smart']) { window['Smart'] = { RenderMode: 'manual' }; } else { window['Smart'].RenderMode = 'manual'; } } import './../source/modules/smart.form'; import { __awaiter } from 'tslib'; import * as i0 from '@angular/core'; import { EventEmitter, Directive, Output, Input, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; class BaseElement { constructor(ref) { this.onCreate = new EventEmitter(); this.onReady = new EventEmitter(); this.onAttach = new EventEmitter(); this.onDetach = new EventEmitter(); const that = this; this.nativeElement = ref.nativeElement; that.nativeElement.onAttached = () => { that.onAttach.emit(that.nativeElement); }; that.nativeElement.onDetached = () => { that.onDetach.emit(that.nativeElement); }; } addEventListener(type, listener, options = false) { this.nativeElement.addEventListener(type, listener, options); } removeEventListener(type, listener, options = false) { this.nativeElement.removeEventListener(type, listener, options); } dispatchEvent(event) { return this.nativeElement.dispatchEvent(event); } blur() { this.nativeElement.blur(); } click() { this.nativeElement.click(); } focus(options) { this.nativeElement.focus(options); } /** @description Sets or gets the license. */ get license() { return this.nativeElement ? this.nativeElement.license : undefined; } set license(value) { this.nativeElement ? this.nativeElement.license = value : undefined; } /** @description Sets or gets the language. Used in conjunction with the property messages. */ get locale() { return this.nativeElement ? this.nativeElement.locale : undefined; } set locale(value) { this.nativeElement ? this.nativeElement.locale = value : undefined; } /** @description Callback used to customize the format of the messages that are returned from the Localization Module. */ get localizeFormatFunction() { return this.nativeElement ? this.nativeElement.localizeFormatFunction : undefined; } set localizeFormatFunction(value) { this.nativeElement ? this.nativeElement.localizeFormatFunction = value : undefined; } /** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. */ get messages() { return this.nativeElement ? this.nativeElement.messages : undefined; } set messages(value) { this.nativeElement ? this.nativeElement.messages = value : undefined; } /** @description Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. */ get rightToLeft() { return this.nativeElement ? this.nativeElement.rightToLeft : undefined; } set rightToLeft(value) { this.nativeElement ? this.nativeElement.rightToLeft = value : undefined; } /** @description Determines the theme. Theme defines the look of the element */ get theme() { return this.nativeElement ? this.nativeElement.theme : undefined; } set theme(value) { this.nativeElement ? this.nativeElement.theme = value : undefined; } } BaseElement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: BaseElement, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); BaseElement.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: BaseElement, inputs: { license: "license", locale: "locale", localizeFormatFunction: "localizeFormatFunction", messages: "messages", rightToLeft: "rightToLeft", theme: "theme" }, outputs: { onCreate: "onCreate", onReady: "onReady", onAttach: "onAttach", onDetach: "onDetach" }, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: BaseElement, decorators: [{ type: Directive }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onCreate: [{ type: Output }], onReady: [{ type: Output }], onAttach: [{ type: Output }], onDetach: [{ type: Output }], license: [{ type: Input }], locale: [{ type: Input }], localizeFormatFunction: [{ type: Input }], messages: [{ type: Input }], rightToLeft: [{ type: Input }], theme: [{ type: Input }] } }); let Smart; if (typeof window !== "undefined") { Smart = window.Smart; } class FormComponent extends BaseElement { constructor(ref) { super(ref); this.eventHandlers = []; this.nativeElement = ref.nativeElement; } /** @description Creates the component on demand. * @param properties An optional object of properties, which will be added to the template binded ones. */ createComponent(properties = {}) { this.nativeElement = document.createElement('smart-form'); for (let propertyName in properties) { this.nativeElement[propertyName] = properties[propertyName]; } return this.nativeElement; } /** @description Defines or retrieves the number of columns used to arrange form fields, determining how fields are organized and displayed within the form layout. */ get columns() { return this.nativeElement ? this.nativeElement.columns : undefined; } set columns(value) { this.nativeElement ? this.nativeElement.columns = value : undefined; } /** @description Gets or sets the collection of form controls associated with the form. This allows you to retrieve the current controls or update them with a new set of controls. */ get controls() { return this.nativeElement ? this.nativeElement.controls : undefined; } set controls(value) { this.nativeElement ? this.nativeElement.controls = value : undefined; } /** @description Defines or retrieves the position of the labels relative to their associated elements. Specify this property to control where labels are displayed (e.g., above, below, left, or right of the element). */ get onStatusChanges() { return this.nativeElement ? this.nativeElement.onStatusChanges : undefined; } set onStatusChanges(value) { this.nativeElement ? this.nativeElement.onStatusChanges = value : undefined; } /** @description Sets all form fields to read-only mode, preventing users from modifying their input while still allowing them to view the existing data. */ get onValueChanges() { return this.nativeElement ? this.nativeElement.onValueChanges : undefined; } set onValueChanges(value) { this.nativeElement ? this.nativeElement.onValueChanges = value : undefined; } /** @description Controls the visibility of the colon character that appears after label text. When enabled, a colon is displayed after each label; when disabled, the colon is omitted. */ get labelPosition() { return this.nativeElement ? this.nativeElement.labelPosition : undefined; } set labelPosition(value) { this.nativeElement ? this.nativeElement.labelPosition = value : undefined; } /** @description Toggles the visibility of the validation summary, allowing users to display or hide a list of validation errors based on form input. */ get readonly() { return this.nativeElement ? this.nativeElement.readonly : undefined; } set readonly(value) { this.nativeElement ? this.nativeElement.readonly = value : undefined; } /** @description Retrieves the current status of the Form. Each entry within the status object contains the following boolean properties: dirty (indicates if the form field has been modified), untouched (indicates if the field has not been focused by the user), and disabled (indicates if the field is currently disabled). */ get showColonAfterLabel() { return this.nativeElement ? this.nativeElement.showColonAfterLabel : undefined; } set showColonAfterLabel(value) { this.nativeElement ? this.nativeElement.showColonAfterLabel = value : undefined; } /** @description Retrieves or assigns the current value of the form. Use this property to access the form's data for processing or to update the form with new values programmatically. */ get showSummary() { return this.nativeElement ? this.nativeElement.showSummary : undefined; } set showSummary(value) { this.nativeElement ? this.nativeElement.showSummary = value : undefined; } /** @description Automatically triggers form validation immediately upon form initialization, ensuring that all form fields are checked for correctness as soon as the form is rendered or instantiated. */ get status() { return this.nativeElement ? this.nativeElement.status : undefined; } set status(value) { this.nativeElement ? this.nativeElement.status = value : undefined; } /** @description undefined */ get value() { return this.nativeElement ? this.nativeElement.value : undefined; } set value(value) { this.nativeElement ? this.nativeElement.value = value : undefined; } /** @description undefined */ get validateOnLoad() { return this.nativeElement ? this.nativeElement.validateOnLoad : undefined; } set validateOnLoad(value) { this.nativeElement ? this.nativeElement.validateOnLoad = value : undefined; } /** @description Inserts a new control element, such as an input field, button, or checkbox, into the Form, allowing users to interact with and submit data. * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ addControl(controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.addControl(controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.addControl(controlOptions); }); } } /** @description Retrieves a specific control element from the form using its name attribute, as defined by the dataField parameter. This method enables direct access to the control's properties and methods for further manipulation or data retrieval. * @param {string} dataField. dataField of a FormControl or FormGroup * @returns {Control} */ getControl(dataField) { return __awaiter(this, void 0, void 0, function* () { const getResultOnRender = () => { return new Promise(resolve => { this.nativeElement.whenRendered(() => { const result = this.nativeElement.getControl(dataField); resolve(result); }); }); }; const result = yield getResultOnRender(); return result; }); } getControlSync(dataField) { if (this.nativeElement.isRendered) { return this.nativeElement.getControl(dataField); } return null; } /** @description Adds a new control element to the Form, allowing users to dynamically extend the form’s functionality. This method enables the inclusion of input fields, buttons, dropdowns, or other interactive components within the Form, ensuring seamless integration and consistent behavior with existing controls. * @param {number} index. Control insert index * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ insertControl(index, controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.insertControl(index, controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.insertControl(index, controlOptions); }); } } /** @description Removes a specified control element from the Form, ensuring it is no longer rendered or managed as part of the Form's structure and behavior. * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ removeControl(controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.removeControl(controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.removeControl(controlOptions); }); } } /** @description Triggers the submission of the form, sending the user-entered data to the specified server endpoint for processing. This action may also initiate form validation and execute any associated event handlers before transmitting the data. * @param {any} submitOptions?. Sets the submit options object. The object may have the following properties: <em>async</em>, <em>action</em>, <em>target</em>, <em>method</em>. <em>async</em> determines whether the form will be submitted asynchronously. <em>action</em> determines the submit url, <em>method</em> sets whether the submit is through 'GET' or 'POST'. <em>target</em> determines the submit target. */ submit(submitOptions) { if (this.nativeElement.isRendered) { this.nativeElement.submit(submitOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.submit(submitOptions); }); } } /** @description Resets all fields in the form to their initial, default values, effectively clearing any user input or changes made. */ reset() { if (this.nativeElement.isRendered) { this.nativeElement.reset(); } else { this.nativeElement.whenRendered(() => { this.nativeElement.reset(); }); } } /** @description Performs comprehensive validation of the form fields, ensuring that all required inputs are provided, data types and formats are correct, and any specified constraints or validation rules are met before allowing form submission. */ validate() { if (this.nativeElement.isRendered) { this.nativeElement.validate(); } else { this.nativeElement.whenRendered(() => { this.nativeElement.validate(); }); } } get isRendered() { return this.nativeElement ? this.nativeElement.isRendered : false; } ngOnInit() { } ngAfterViewInit() { const that = this; that.onCreate.emit(that.nativeElement); if (Smart) Smart.Render(); this.nativeElement.classList.add('smart-angular'); if (this.nativeElement.whenRendered) this.nativeElement.whenRendered(() => { that.onReady.emit(that.nativeElement); }); this.listen(); } ngOnDestroy() { this.unlisten(); } ngOnChanges(changes) { if (this.nativeElement && this.nativeElement.isRendered) { for (const propName in changes) { if (changes.hasOwnProperty(propName)) { this.nativeElement[propName] = changes[propName].currentValue; } } } } /** @description Add event listeners. */ listen() { const that = this; } /** @description Remove event listeners. */ unlisten() { const that = this; } } FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); FormComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: FormComponent, selector: "smart-form, [smart-form]", inputs: { columns: "columns", controls: "controls", onStatusChanges: "onStatusChanges", onValueChanges: "onValueChanges", labelPosition: "labelPosition", readonly: "readonly", showColonAfterLabel: "showColonAfterLabel", showSummary: "showSummary", status: "status", value: "value", validateOnLoad: "validateOnLoad" }, exportAs: ["smart-form"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormComponent, decorators: [{ type: Directive, args: [{ exportAs: 'smart-form', selector: 'smart-form, [smart-form]' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { columns: [{ type: Input }], controls: [{ type: Input }], onStatusChanges: [{ type: Input }], onValueChanges: [{ type: Input }], labelPosition: [{ type: Input }], readonly: [{ type: Input }], showColonAfterLabel: [{ type: Input }], showSummary: [{ type: Input }], status: [{ type: Input }], value: [{ type: Input }], validateOnLoad: [{ type: Input }] } }); class FormControlComponent extends BaseElement { constructor(ref) { super(ref); this.eventHandlers = []; this.nativeElement = ref.nativeElement; } /** @description Creates the component on demand. * @param properties An optional object of properties, which will be added to the template binded ones. */ createComponent(properties = {}) { this.nativeElement = document.createElement('smart-form-control'); for (let propertyName in properties) { this.nativeElement[propertyName] = properties[propertyName]; } return this.nativeElement; } /** @description Retrieves or assigns the action associated with the FormControl component. This property specifically applies when the 'controlType' is set to either 'button' or 'submit', determining the function or operation that will be executed when the control is activated (e.g., when the button is clicked or the form is submitted). */ get action() { return this.nativeElement ? this.nativeElement.action : undefined; } set action(value) { this.nativeElement ? this.nativeElement.action = value : undefined; } /** @description Specifies or retrieves the alignment setting of the FormControl element, determining how the control is positioned within its parent container (e.g., left, right, center, or justified). */ get align() { return this.nativeElement ? this.nativeElement.align : undefined; } set align(value) { this.nativeElement ? this.nativeElement.align = value : undefined; } /** @description "Specifies the HTML content that will appear immediately after the form control element. This allows you to display supplementary information, messages, or custom markup directly following the input field." */ get appendHTML() { return this.nativeElement ? this.nativeElement.appendHTML : undefined; } set appendHTML(value) { this.nativeElement ? this.nativeElement.appendHTML = value : undefined; } /** @description A JSON object containing configuration options for initializing the UI component. For example, providing { dataSource: ['item 1', 'item 2', 'item 3'] } assigns the specified array to the dataSource property of the Form control, defining the data items that will be displayed or used within the component. Use this object to specify properties such as data sources, default values, appearance settings, or behavior options for the UI element during its creation. */ get controlOptions() { return this.nativeElement ? this.nativeElement.controlOptions : undefined; } set controlOptions(value) { this.nativeElement ? this.nativeElement.controlOptions = value : undefined; } /** @description Specifies the type of user interface control (such as button, textbox, dropdown, etc.) represented by this component. This property determines the control's behavior and visual appearance. */ get controlType() { return this.nativeElement ? this.nativeElement.controlType : undefined; } set controlType(value) { this.nativeElement ? this.nativeElement.controlType = value : undefined; } /** @description Specifies the number of columns used to arrange the fields within the Form Group, determining how the form elements are organized and displayed in a grid layout. */ get columns() { return this.nativeElement ? this.nativeElement.columns : undefined; } set columns(value) { this.nativeElement ? this.nativeElement.columns = value : undefined; } /** @description Specifies the number of columns that the form control should span within a grid layout, allowing you to control the width of the form element across multiple columns. */ get columnSpan() { return this.nativeElement ? this.nativeElement.columnSpan : undefined; } set columnSpan(value) { this.nativeElement ? this.nativeElement.columnSpan = value : undefined; } /** @description Specifies the data field associated with the form control. The value of dataField is assigned as the name attribute of the control's internal input element. Additionally, within the parent FormGroup, this form control can be accessed by referencing the same dataField value. This ensures seamless integration between the form control and the FormGroup’s data model. */ get dataField() { return this.nativeElement ? this.nativeElement.dataField : undefined; } set dataField(value) { this.nativeElement ? this.nativeElement.dataField = value : undefined; } /** @description Enables or disables the form control, determining whether users can interact with it. When set to disabled, the control will be grayed out and unresponsive to user input. */ get disabled() { return this.nativeElement ? this.nativeElement.disabled : undefined; } set disabled(value) { this.nativeElement ? this.nativeElement.disabled = value : undefined; } /** @description Returns a boolean indicating whether the Form control is 'dirty'—that is, whether the user has modified the control's value from its original (initial) value. This property helps determine if the input has been changed since the form was loaded or last reset. */ get dirty() { return this.nativeElement ? this.nativeElement.dirty : undefined; } set dirty(value) { this.nativeElement ? this.nativeElement.dirty = value : undefined; } /** @description Retrieves or defines the tooltip text that appears when a user hovers over the info icon associated with the Form control. This tooltip provides additional information or guidance about the form field for improved user experience. */ get info() { return this.nativeElement ? this.nativeElement.info : undefined; } set info(value) { this.nativeElement ? this.nativeElement.info = value : undefined; } /** @description Determines if the Form control currently has validation errors, indicating that its input data does not meet the specified validation rules. Returns 'true' if the control is invalid; otherwise, returns 'false'. */ get invalid() { return this.nativeElement ? this.nativeElement.invalid : undefined; } set invalid(value) { this.nativeElement ? this.nativeElement.invalid = value : undefined; } /** @description Retrieves or assigns the label text displayed for the Form control, allowing you to specify or update the descriptive text shown to users. */ get label() { return this.nativeElement ? this.nativeElement.label : undefined; } set label(value) { this.nativeElement ? this.nativeElement.label = value : undefined; } /** @description Retrieves or specifies the position of the label associated with the form control. This property determines where the label will be displayed relative to the form element (e.g., above, below, to the left, or to the right). */ get labelPosition() { return this.nativeElement ? this.nativeElement.labelPosition : undefined; } set labelPosition(value) { this.nativeElement ? this.nativeElement.labelPosition = value : undefined; } /** @description Gets or sets the distance (in pixels) between the label and its associated control, allowing you to adjust the spacing for layout and visual alignment purposes. */ get labelOffset() { return this.nativeElement ? this.nativeElement.labelOffset : undefined; } set labelOffset(value) { this.nativeElement ? this.nativeElement.labelOffset = value : undefined; } /** @description '' *This property is applicable only when the controlType is set to 'group'. It determines whether the navigation buttons are shown within the FormGroup. The property takes effect only when the viewMode property is also configured. Use this setting to control the visibility of navigation controls for multi-step or grouped form layouts.* */ get labelAlign() { return this.nativeElement ? this.nativeElement.labelAlign : undefined; } set labelAlign(value) { this.nativeElement ? this.nativeElement.labelAlign = value : undefined; } /** @description Applies only when the controlType property is set to 'group'. Specifies the label text displayed on the "Next" button within a FormGroup, allowing you to get or set a custom label for navigation purposes. */ get nextButtonLabel() { return this.nativeElement ? this.nativeElement.nextButtonLabel : undefined; } set nextButtonLabel(value) { this.nativeElement ? this.nativeElement.nextButtonLabel = value : undefined; } /** @description '' Available only when the controlType property is set to 'group' (i.e., for FormGroup controls). This property allows you to get or set the label displayed on the back button within the form group. */ get backButtonLabel() { return this.nativeElement ? this.nativeElement.backButtonLabel : undefined; } set backButtonLabel(value) { this.nativeElement ? this.nativeElement.backButtonLabel = value : undefined; } /** @description Allows you to retrieve or specify the placeholder text displayed in the FormControl when the input field is empty. This placeholder provides a hint to users about the expected input. */ get placeholder() { return this.nativeElement ? this.nativeElement.placeholder : undefined; } set placeholder(value) { this.nativeElement ? this.nativeElement.placeholder = value : undefined; } /** @description HTML content that appears visually above or before the form control element, typically used for introductory text, instructions, or contextual information. This content is rendered prior to the input field or interactive control in the layout. */ get prependHTML() { return this.nativeElement ? this.nativeElement.prependHTML : undefined; } set prependHTML(value) { this.nativeElement ? this.nativeElement.prependHTML = value : undefined; } /** @description Enables you to retrieve or assign the readonly state of the form control. When set to true, the form control becomes non-editable, preventing users from modifying its value while still allowing its content to be viewed. */ get readonly() { return this.nativeElement ? this.nativeElement.readonly : undefined; } set readonly(value) { this.nativeElement ? this.nativeElement.readonly = value : undefined; } /** @description Determines whether this field must be filled in by the user. When set to true, the field is required and validation will fail if it is left empty. When set to false, the field is optional. This property can be both retrieved (get) and updated (set). */ get required() { return this.nativeElement ? this.nativeElement.required : undefined; } set required(value) { this.nativeElement ? this.nativeElement.required = value : undefined; } /** @description Returns whether the Form control is in a "pristine" state, meaning it has not been interacted with or "touched" by the user. This property remains true until the user focuses on and then blurs (moves away from) the Form control, at which point it is set to false. It is commonly used to determine if the user has interacted with a form field since the component was initialized. */ get untouched() { return this.nativeElement ? this.nativeElement.untouched : undefined; } set untouched(value) { this.nativeElement ? this.nativeElement.untouched = value : undefined; } /** @description Gets or sets whether a colon character (:) is automatically displayed after the label text. When enabled, a colon will appear immediately following the label, typically to visually separate the label from the corresponding input field. */ get showColonAfterLabel() { return this.nativeElement ? this.nativeElement.showColonAfterLabel : undefined; } set showColonAfterLabel(value) { this.nativeElement ? this.nativeElement.showColonAfterLabel = value : undefined; } /** @description Applies only when controlType is set to 'group'. This property determines whether navigation buttons are shown within the FormGroup. It is effective only if the viewMode property is enabled. Use this property to control the visibility of navigation controls for grouped form elements in the specified view mode. */ get showButtons() { return this.nativeElement ? this.nativeElement.showButtons : undefined; } set showButtons(value) { this.nativeElement ? this.nativeElement.showButtons = value : undefined; } /** @description Provides the ability to retrieve (get) or update (set) the current value of a FormControl or FormGroup. This allows you to read the form’s data or programmatically change its values as needed. */ get value() { return this.nativeElement ? this.nativeElement.value : undefined; } set value(value) { this.nativeElement ? this.nativeElement.value = value : undefined; } /** @description Determines whether the Form control currently satisfies all validation rules and is considered valid. Returns true if the control’s value passes all validation checks; otherwise, returns false. */ get valid() { return this.nativeElement ? this.nativeElement.valid : undefined; } set valid(value) { this.nativeElement ? this.nativeElement.valid = value : undefined; } /** @description Sets or retrieves the column's validation rules. The value should be an array of objects, where each object defines a specific validation rule for the column. Each validation rule object must include:- A 'type' property, which specifies the type of validation. Valid values for 'type' include: ''required'', ''min'', ''max'', ''minLength'', ''maxLength'', ''email'', ''null'', ''requiredTrue'', ''minDate'', ''maxDate'', and ''pattern''.- A 'value' property, which provides the value used for the validation. For example, for 'minLength', 'value' might be '3', or for 'pattern', it could be a regular expression. Note: For validation types ''required'', ''requiredTrue'', and ''null'', the 'value' property can be omitted.Optionally, you can include a 'message' property to specify a custom error message that is shown when the validation fails.'Example:''''json[ { "type": "required", "message": "This field is mandatory." }, { "type": "minLength", "value": 3, "message": "Minimum 3 characters required." }, { "type": "pattern", "value": "^[A-Za-z]+$", "message": "Only letters are allowed." }]'''This structure allows you to define multiple validation rules for a column, each with its own type, constraints, and error message. */ get validationRules() { return this.nativeElement ? this.nativeElement.validationRules : undefined; } set validationRules(value) { this.nativeElement ? this.nativeElement.validationRules = value : undefined; } /** @description 'Applies only when controlType is set to 'group'. This property gets or sets the view mode of the form group, determining how the group of form controls is displayed and interacted with in the UI.' */ get viewMode() { return this.nativeElement ? this.nativeElement.viewMode : undefined; } set viewMode(value) { this.nativeElement ? this.nativeElement.viewMode = value : undefined; } get isRendered() { return this.nativeElement ? this.nativeElement.isRendered : false; } ngOnInit() { } ngAfterViewInit() { const that = this; that.onCreate.emit(that.nativeElement); this.nativeElement.classList.add('smart-angular'); if (this.nativeElement.whenRendered) this.nativeElement.whenRendered(() => { that.onReady.emit(that.nativeElement); }); this.listen(); } ngOnDestroy() { this.unlisten(); } ngOnChanges(changes) { if (this.nativeElement && this.nativeElement.isRendered) { for (const propName in changes) { if (changes.hasOwnProperty(propName)) { this.nativeElement[propName] = changes[propName].currentValue; } } } } /** @description Add event listeners. */ listen() { const that = this; } /** @description Remove event listeners. */ unlisten() { const that = this; } } FormControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormControlComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); FormControlComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: FormControlComponent, selector: "smart-form-control, [smart-form-control]", inputs: { action: "action", align: "align", appendHTML: "appendHTML", controlOptions: "controlOptions", controlType: "controlType", columns: "columns", columnSpan: "columnSpan", dataField: "dataField", disabled: "disabled", dirty: "dirty", info: "info", invalid: "invalid", label: "label", labelPosition: "labelPosition", labelOffset: "labelOffset", labelAlign: "labelAlign", nextButtonLabel: "nextButtonLabel", backButtonLabel: "backButtonLabel", placeholder: "placeholder", prependHTML: "prependHTML", readonly: "readonly", required: "required", untouched: "untouched", showColonAfterLabel: "showColonAfterLabel", showButtons: "showButtons", value: "value", valid: "valid", validationRules: "validationRules", viewMode: "viewMode" }, exportAs: ["smart-form-control"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormControlComponent, decorators: [{ type: Directive, args: [{ exportAs: 'smart-form-control', selector: 'smart-form-control, [smart-form-control]' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { action: [{ type: Input }], align: [{ type: Input }], appendHTML: [{ type: Input }], controlOptions: [{ type: Input }], controlType: [{ type: Input }], columns: [{ type: Input }], columnSpan: [{ type: Input }], dataField: [{ type: Input }], disabled: [{ type: Input }], dirty: [{ type: Input }], info: [{ type: Input }], invalid: [{ type: Input }], label: [{ type: Input }], labelPosition: [{ type: Input }], labelOffset: [{ type: Input }], labelAlign: [{ type: Input }], nextButtonLabel: [{ type: Input }], backButtonLabel: [{ type: Input }], placeholder: [{ type: Input }], prependHTML: [{ type: Input }], readonly: [{ type: Input }], required: [{ type: Input }], untouched: [{ type: Input }], showColonAfterLabel: [{ type: Input }], showButtons: [{ type: Input }], value: [{ type: Input }], valid: [{ type: Input }], validationRules: [{ type: Input }], viewMode: [{ type: Input }] } }); class FormGroupComponent extends BaseElement { constructor(ref) { super(ref); this.eventHandlers = []; this.nativeElement = ref.nativeElement; } /** @description Creates the component on demand. * @param properties An optional object of properties, which will be added to the template binded ones. */ createComponent(properties = {}) { this.nativeElement = document.createElement('smart-form-group'); for (let propertyName in properties) { this.nativeElement[propertyName] = properties[propertyName]; } return this.nativeElement; } /** @description Gets or sets the number of columns used to layout the form fields, allowing for multi-column form arrangements. */ get columns() { return this.nativeElement ? this.nativeElement.columns : undefined; } set columns(value) { this.nativeElement ? this.nativeElement.columns = value : undefined; } /** @description Defines the data field associated with the form control. The inner input element’s name attribute will be set to the specified dataField value, ensuring correct binding and form data serialization. Additionally, this value determines how the control is referenced within the FormGroup, making the form control’s value accessible via the dataField key in the form’s data model. */ get dataField() { return this.nativeElement ? this.nativeElement.dataField : undefined; } set dataField(value) { this.nativeElement ? this.nativeElement.dataField = value : undefined; } /** @description Retrieves or updates the text displayed as the label for the form control, allowing you to specify or modify the descriptive text shown to users alongside the input element. */ get label() { return this.nativeElement ? this.nativeElement.label : undefined; } set label(value) { this.nativeElement ? this.nativeElement.label = value : undefined; } /** @description */ get controls() { return this.nativeElement ? this.nativeElement.controls : undefined; } set controls(value) { this.nativeElement ? this.nativeElement.controls = value : undefined; } /** @description Specifies or retrieves the position of the labels relative to their associated element. This property can be used to define where labels are displayed, such as above, below, to the left, or to the right of the element. */ get onStatusChanges() { return this.nativeElement ? this.nativeElement.onStatusChanges : undefined; } set onStatusChanges(value) { this.nativeElement ? this.nativeElement.onStatusChanges = value : undefined; } /** @description Sets the form to read-only mode, preventing users from editing or modifying any of the input fields while still allowing them to view the current values. */ get onValueChanges() { return this.nativeElement ? this.nativeElement.onValueChanges : undefined; } set onValueChanges(value) { this.nativeElement ? this.nativeElement.onValueChanges = value : undefined; } /** @description Toggles the visibility of the colon character that appears immediately after label text, allowing you to choose whether or not a colon is displayed following each label. */ get labelPosition() { return this.nativeElement ? this.nativeElement.labelPosition : undefined; } set labelPosition(value) { this.nativeElement ? this.nativeElement.labelPosition = value : undefined; } /** @description Controls the visibility of the validation summary, allowing you to display or hide a summary of form validation errors to users. */ get readonly() { return this.nativeElement ? this.nativeElement.readonly : undefined; } set readonly(value) { this.nativeElement ? this.nativeElement.readonly = value : undefined; } /** @description Retrieves the current value of the form or updates it with a new value. This property can be used to access the form's data or set it programmatically. */ get showColonAfterLabel() { return this.nativeElement ? this.nativeElement.showColonAfterLabel : undefined; } set showColonAfterLabel(value) { this.nativeElement ? this.nativeElement.showColonAfterLabel = value : undefined; } /** @description undefined */ get showSummary() { return this.nativeElement ? this.nativeElement.showSummary : undefined; } set showSummary(value) { this.nativeElement ? this.nativeElement.showSummary = value : undefined; } /** @description undefined */ get value() { return this.nativeElement ? this.nativeElement.value : undefined; } set value(value) { this.nativeElement ? this.nativeElement.value = value : undefined; } /** @description Inserts a new input control (such as a text box, dropdown, or checkbox) into the Form, allowing users to provide or select additional information as part of their submission. * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ addControl(controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.addControl(controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.addControl(controlOptions); }); } } /** @description Retrieves a specific control from the collection using its name, as specified by the dataField parameter. This function searches for a control whose name matches the provided dataField value and returns the corresponding control object, allowing you to access or manipulate its properties and methods. * @param {string} dataField. dataField of a FormControl or FormGroup * @returns {Control} */ getControl(dataField) { return __awaiter(this, void 0, void 0, function* () { const getResultOnRender = () => { return new Promise(resolve => { this.nativeElement.whenRendered(() => { const result = this.nativeElement.getControl(dataField); resolve(result); }); }); }; const result = yield getResultOnRender(); return result; }); } getControlSync(dataField) { if (this.nativeElement.isRendered) { return this.nativeElement.getControl(dataField); } return null; } /** @description Adds a user interface control (such as a text box, dropdown, or button) to the specified Form, enabling users to input or interact with form data. This operation dynamically updates the Form’s layout and may include assigning default properties, event handlers, and positioning options for the new control. * @param {number} index. Control insert index * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ insertControl(index, controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.insertControl(index, controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.insertControl(index, controlOptions); }); } } /** @description Removes a specified control element from the Form, effectively deleting it from the Form’s structure and user interface. This operation detaches the control, ensuring it is no longer available for user interaction or data capture. Use this action to dynamically update the Form’s contents based on user actions or application logic. * @param {any} controlOptions. Control options. The control options description is available in the <em>controls</em> property. */ removeControl(controlOptions) { if (this.nativeElement.isRendered) { this.nativeElement.removeControl(controlOptions); } else { this.nativeElement.whenRendered(() => { this.nativeElement.removeControl(controlOptions); }); } } get isRendered() { return this.nativeElement ? this.nativeElement.isRendered : false; } ngOnInit() { } ngAfterViewInit() { const that = this; that.onCreate.emit(that.nativeElement); this.nativeElement.classList.add('smart-angular'); if (this.nativeElement.whenRendered) this.nativeElement.whenRendered(() => { that.onReady.emit(that.nativeElement); }); this.listen(); } ngOnDestroy() { this.unlisten(); } ngOnChanges(changes) { if (this.nativeElement && this.nativeElement.isRendered) { for (const propName in changes) { if (changes.hasOwnProperty(propName)) { this.nativeElement[propName] = changes[propName].currentValue; } } } } /** @description Add event listeners. */ listen() { const that = this; } /** @description Remove event listeners. */ unlisten() { const that = this; } } FormGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormGroupComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); FormGroupComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.6", type: FormGroupComponent, selector: "smart-form-group, [smart-form-group]", inputs: { columns: "columns", dataField: "dataField", label: "label", controls: "controls", onStatusChanges: "onStatusChanges", onValueChanges: "onValueChanges", labelPosition: "labelPosition", readonly: "readonly", showColonAfterLabel: "showColonAfterLabel", showSummary: "showSummary", value: "value" }, exportAs: ["smart-form-group"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormGroupComponent, decorators: [{ type: Directive, args: [{ exportAs: 'smart-form-group', selector: 'smart-form-group, [smart-form-group]' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { columns: [{ type: Input }], dataField: [{ type: Input }], label: [{ type: Input }], controls: [{ type: Input }], onStatusChanges: [{ type: Input }], onValueChanges: [{ type: Input }], labelPosition: [{ type: Input }], readonly: [{ type: Input }], showColonAfterLabel: [{ type: Input }], showSummary: [{ type: Input }], value: [{ type: Input }] } }); class FormModule { } FormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.6", ngImport: i0, type: FormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); FormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.6", n