@webilix/ngx-form-m3 0.0.34 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { HostBinding, Directive, Input, HostListener, Optional, Pipe, InjectionToken, inject, Component, Injector, makeEnvironmentProviders, EventEmitter, Output, ViewChild, Inject } from '@angular/core';
2
+ import { HostBinding, Directive, Input, HostListener, Optional, Pipe, InjectionToken, inject, Component, Injector, EventEmitter, Output, makeEnvironmentProviders, ViewChild, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { ReactiveFormsModule, FormControl, Validators, FormsModule, FormGroup } from '@angular/forms';
5
5
  import { MatIconButton, MatButton } from '@angular/material/button';
@@ -8,7 +8,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
8
8
  import { MatFormField } from '@angular/material/form-field';
9
9
  import { MatIcon } from '@angular/material/icon';
10
10
  import * as i2$1 from '@angular/material/input';
11
- import { MatInputModule } from '@angular/material/input';
11
+ import { MatInputModule, MatInput } from '@angular/material/input';
12
12
  import { Helper } from '@webilix/helper-library';
13
13
  import * as i1$1 from '@angular/platform-browser';
14
14
  import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
@@ -18,11 +18,13 @@ import * as i1$2 from '@webilix/ngx-helper-m3';
18
18
  import { NgxHelperDatePipe, NgxHelperFileSizePipe, NgxHelperNumberPipe } from '@webilix/ngx-helper-m3';
19
19
  import * as i1$3 from '@webilix/ngx-calendar-m3';
20
20
  import * as i3 from '@angular/cdk/bidi';
21
+ import * as i1$4 from '@angular/cdk/drag-drop';
22
+ import { CdkDragHandle, moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
21
23
  import * as i3$1 from '@angular/material/menu';
22
24
  import { MatMenuModule } from '@angular/material/menu';
23
25
  import * as i4 from '@angular/material/select';
24
26
  import { MatSelectModule } from '@angular/material/select';
25
- import * as i1$4 from '@angular/router';
27
+ import * as i1$5 from '@angular/router';
26
28
 
27
29
  class AutoCompleteDirective {
28
30
  autocomplete = 'one-time-code';
@@ -196,6 +198,8 @@ class InputErrorPipe {
196
198
  return `انتخاب حداقل ${Helper.NUMBER.format(value)} گزینه الزامی است.`;
197
199
  case 'maxcount':
198
200
  return `امکان انتخاب بیشتر از ${Helper.NUMBER.format(value)} گزینه وجود ندارد.`;
201
+ case 'duplicate':
202
+ return 'امکان انتخاب مقادیر تکراری وجود ندارد.';
199
203
  case 'bank-card':
200
204
  return `شماره کارت بانکی صحیح مشخص نشده است.`;
201
205
  case 'bank-sheba':
@@ -468,6 +472,15 @@ const MultiplyOfNumberValidator = (multiplyOf) => {
468
472
  };
469
473
  };
470
474
 
475
+ const DuplicateValidator = (callback) => {
476
+ return (formControl) => {
477
+ const values = Array.isArray(formControl.value) ? formControl.value : [];
478
+ const check = values.map((value) => callback(value));
479
+ const unique = check.filter((v, i, a) => a.indexOf(v) === i);
480
+ return check.length !== unique.length ? { duplicate: true } : null;
481
+ };
482
+ };
483
+
471
484
  const LengthValidator = (length) => {
472
485
  return (formControl) => {
473
486
  const value = formControl.value;
@@ -938,6 +951,162 @@ class InputIpMethods extends InputMethods {
938
951
  }
939
952
  }
940
953
 
954
+ class ListInputComponent {
955
+ english;
956
+ disabled;
957
+ autoFocus;
958
+ placeholder;
959
+ onFocus = new EventEmitter();
960
+ onInput = new EventEmitter();
961
+ checkValue(input) {
962
+ const value = input.value.trim();
963
+ if (this.disabled || value === '')
964
+ return;
965
+ this.onInput.next(value);
966
+ input.value = '';
967
+ }
968
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ListInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
969
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: ListInputComponent, isStandalone: true, selector: "list-input", inputs: { english: "english", disabled: "disabled", autoFocus: "autoFocus", placeholder: "placeholder" }, outputs: { onFocus: "onFocus", onInput: "onInput" }, ngImport: i0, template: "<input\n matInput\n type=\"text\"\n [placeholder]=\"placeholder || (english ? 'New Item' : '\u06AF\u0632\u06CC\u0646\u0647 \u062C\u062F\u06CC\u062F')\"\n [class.ngx-form-m3-en]=\"english\"\n [AutoFocusDirective]=\"autoFocus\"\n [disabled]=\"disabled\"\n (blur)=\"checkValue(input); onFocus.next(false)\"\n (focus)=\"onFocus.next(true)\"\n (keydown.enter)=\"$event.preventDefault(); checkValue(input)\"\n #input\n/>\n", styles: [":host{display:flex;align-items:center}input::placeholder{font-size:85%}\n"], dependencies: [{ kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: AutoFocusDirective, selector: "[AutoFocusDirective]", inputs: ["AutoFocusDirective"] }] });
970
+ }
971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ListInputComponent, decorators: [{
972
+ type: Component,
973
+ args: [{ selector: 'list-input', imports: [MatInput, AutoFocusDirective], template: "<input\n matInput\n type=\"text\"\n [placeholder]=\"placeholder || (english ? 'New Item' : '\u06AF\u0632\u06CC\u0646\u0647 \u062C\u062F\u06CC\u062F')\"\n [class.ngx-form-m3-en]=\"english\"\n [AutoFocusDirective]=\"autoFocus\"\n [disabled]=\"disabled\"\n (blur)=\"checkValue(input); onFocus.next(false)\"\n (focus)=\"onFocus.next(true)\"\n (keydown.enter)=\"$event.preventDefault(); checkValue(input)\"\n #input\n/>\n", styles: [":host{display:flex;align-items:center}input::placeholder{font-size:85%}\n"] }]
974
+ }], propDecorators: { english: [{
975
+ type: Input,
976
+ args: [{ required: true }]
977
+ }], disabled: [{
978
+ type: Input,
979
+ args: [{ required: true }]
980
+ }], autoFocus: [{
981
+ type: Input,
982
+ args: [{ required: true }]
983
+ }], placeholder: [{
984
+ type: Input,
985
+ args: [{ required: true }]
986
+ }], onFocus: [{
987
+ type: Output
988
+ }], onInput: [{
989
+ type: Output
990
+ }] } });
991
+
992
+ class ListItemComponent {
993
+ value;
994
+ english;
995
+ disabled;
996
+ disableSort;
997
+ onUpdate = new EventEmitter();
998
+ onDelete = new EventEmitter();
999
+ view = 'VALUE';
1000
+ checkValue(input) {
1001
+ if (this.disabled)
1002
+ return;
1003
+ const value = input.value.trim();
1004
+ if (value !== '' && value !== this.value)
1005
+ this.onUpdate.next(value);
1006
+ this.view = 'VALUE';
1007
+ }
1008
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1009
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: ListItemComponent, isStandalone: true, selector: "list-item", inputs: { value: "value", english: "english", disabled: "disabled", disableSort: "disableSort" }, outputs: { onUpdate: "onUpdate", onDelete: "onDelete" }, ngImport: i0, template: "<!-- SORT -->\n@if (view === 'VALUE' && !disableSort) {\n<mat-icon class=\"drag\" [class.ngx-form-m3-disabled-input]=\"disabled\" cdkDragHandle>drag_indicator</mat-icon>\n}\n\n<!-- VALUE -->\n@if (view === 'VALUE') {\n<div [class.ngx-form-m3-en]=\"english\" [class.ngx-form-m3-disabled-input]=\"disabled\">\n {{ value }}\n</div>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'UPDATE'\" [tabIndex]=\"-1\">\n <mat-icon>edit</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'DELETE'\" [tabIndex]=\"-1\">\n <mat-icon [style.color]=\"'var(--error)'\" [class.ngx-form-m3-disabled-input]=\"disabled\">delete</mat-icon>\n</button>\n}\n\n<!-- UPDATE -->\n@if (view === 'UPDATE') {\n<input\n matInput\n type=\"text\"\n [ngModel]=\"value\"\n [class.ngx-form-m3-en]=\"english\"\n [AutoFocusDirective]=\"true\"\n [disabled]=\"disabled\"\n (blur)=\"checkValue(input)\"\n (keydown.enter)=\"$event.preventDefault(); checkValue(input)\"\n #input\n/>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"checkValue(input)\" [tabIndex]=\"-1\">\n <mat-icon>done_all</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon>close</mat-icon>\n</button>\n}\n\n<!-- DELETE -->\n@if (view === 'DELETE') {\n<div [class.ngx-form-m3-disabled-input]=\"disabled\">\u0645\u06CC\u200C\u062E\u0648\u0627\u0647\u06CC\u062F \u0627\u06CC\u0646 \u06AF\u0632\u06CC\u0646\u0647 \u0631\u0627 \u062D\u0630\u0641 \u06A9\u0646\u06CC\u062F\u061F</div>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"onDelete.next(); view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon [style.color]=\"'var(--error)'\" [class.ngx-form-m3-disabled-input]=\"disabled\">done_all</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon>close</mat-icon>\n</button>\n}\n", styles: [":host{display:flex;align-items:center;direction:rtl;overflow:hidden}:host .drag{cursor:pointer;padding-left:.25rem}:host div{flex:1;width:0;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host button{display:flex;align-items:center;justify-content:center}:host button mat-icon{font-size:70%}\n"], dependencies: [{ kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: AutoFocusDirective, selector: "[AutoFocusDirective]", inputs: ["AutoFocusDirective"] }] });
1010
+ }
1011
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: ListItemComponent, decorators: [{
1012
+ type: Component,
1013
+ args: [{ selector: 'list-item', imports: [CdkDragHandle, FormsModule, MatIcon, MatIconButton, MatInput, AutoFocusDirective], template: "<!-- SORT -->\n@if (view === 'VALUE' && !disableSort) {\n<mat-icon class=\"drag\" [class.ngx-form-m3-disabled-input]=\"disabled\" cdkDragHandle>drag_indicator</mat-icon>\n}\n\n<!-- VALUE -->\n@if (view === 'VALUE') {\n<div [class.ngx-form-m3-en]=\"english\" [class.ngx-form-m3-disabled-input]=\"disabled\">\n {{ value }}\n</div>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'UPDATE'\" [tabIndex]=\"-1\">\n <mat-icon>edit</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'DELETE'\" [tabIndex]=\"-1\">\n <mat-icon [style.color]=\"'var(--error)'\" [class.ngx-form-m3-disabled-input]=\"disabled\">delete</mat-icon>\n</button>\n}\n\n<!-- UPDATE -->\n@if (view === 'UPDATE') {\n<input\n matInput\n type=\"text\"\n [ngModel]=\"value\"\n [class.ngx-form-m3-en]=\"english\"\n [AutoFocusDirective]=\"true\"\n [disabled]=\"disabled\"\n (blur)=\"checkValue(input)\"\n (keydown.enter)=\"$event.preventDefault(); checkValue(input)\"\n #input\n/>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"checkValue(input)\" [tabIndex]=\"-1\">\n <mat-icon>done_all</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon>close</mat-icon>\n</button>\n}\n\n<!-- DELETE -->\n@if (view === 'DELETE') {\n<div [class.ngx-form-m3-disabled-input]=\"disabled\">\u0645\u06CC\u200C\u062E\u0648\u0627\u0647\u06CC\u062F \u0627\u06CC\u0646 \u06AF\u0632\u06CC\u0646\u0647 \u0631\u0627 \u062D\u0630\u0641 \u06A9\u0646\u06CC\u062F\u061F</div>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"onDelete.next(); view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon [style.color]=\"'var(--error)'\" [class.ngx-form-m3-disabled-input]=\"disabled\">done_all</mat-icon>\n</button>\n\n<button mat-icon-button [type]=\"'button'\" [disabled]=\"disabled\" (click)=\"view = 'VALUE'\" [tabIndex]=\"-1\">\n <mat-icon>close</mat-icon>\n</button>\n}\n", styles: [":host{display:flex;align-items:center;direction:rtl;overflow:hidden}:host .drag{cursor:pointer;padding-left:.25rem}:host div{flex:1;width:0;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host button{display:flex;align-items:center;justify-content:center}:host button mat-icon{font-size:70%}\n"] }]
1014
+ }], propDecorators: { value: [{
1015
+ type: Input,
1016
+ args: [{ required: true }]
1017
+ }], english: [{
1018
+ type: Input,
1019
+ args: [{ required: true }]
1020
+ }], disabled: [{
1021
+ type: Input,
1022
+ args: [{ required: true }]
1023
+ }], disableSort: [{
1024
+ type: Input,
1025
+ args: [{ required: true }]
1026
+ }], onUpdate: [{
1027
+ type: Output
1028
+ }], onDelete: [{
1029
+ type: Output
1030
+ }] } });
1031
+
1032
+ class InputItemListComponent {
1033
+ formControl = inject(INPUT_CONTROL);
1034
+ input = inject(INPUT_TYPE);
1035
+ config = inject(INPUT_CONFIG);
1036
+ values;
1037
+ isButtonDisabled;
1038
+ focused = false;
1039
+ options = [];
1040
+ ngOnInit() {
1041
+ this.options = Array.isArray(this.formControl.value) ? this.formControl.value : [];
1042
+ }
1043
+ setValue() {
1044
+ this.formControl.setValue([...this.options]);
1045
+ this.formControl.markAsTouched();
1046
+ }
1047
+ dropOption(event) {
1048
+ if (event.previousIndex === event.currentIndex)
1049
+ return;
1050
+ moveItemInArray(this.options, event.previousIndex, event.currentIndex);
1051
+ this.setValue();
1052
+ }
1053
+ addOption(option) {
1054
+ this.options.push(option);
1055
+ this.setValue();
1056
+ }
1057
+ updateOption(index, option) {
1058
+ if (!this.options[index])
1059
+ return;
1060
+ this.options.splice(index, 1, option);
1061
+ this.setValue();
1062
+ }
1063
+ deleteOption(index) {
1064
+ if (!this.options[index])
1065
+ return;
1066
+ this.options.splice(index, 1);
1067
+ this.setValue();
1068
+ }
1069
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputItemListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1070
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: InputItemListComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-item-list" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"focused ? 'always' : 'auto'\">\n <mat-label>{{ input.title }}</mat-label>\n @if (formControl.invalid) { <mat-error>{{ formControl.errors | InputErrorPipe : input.type }}</mat-error> }\n\n <!-- HINT -->\n @if (input.hint) { <mat-hint>{{ input.hint }}</mat-hint> }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <!-- OPTIONS -->\n @if (options.length > 0) {\n <div\n class=\"options\"\n cdkDropList\n (cdkDropListDropped)=\"dropOption($event)\"\n [style.border-color]=\"formControl.disabled ? 'var(--outline-variant)' : 'var(--outline)'\"\n >\n @for (item of options; track $index) {\n <list-item\n cdkDrag\n cdkDragLockAxis=\"y\"\n cdkDragBoundary=\".options\"\n [cdkDragDisabled]=\"input.disableSort\"\n class=\"option\"\n [value]=\"item\"\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [disableSort]=\"!!input.disableSort\"\n (onUpdate)=\"updateOption($index, $event)\"\n (onDelete)=\"deleteOption($index)\"\n ></list-item>\n }\n </div>\n }\n <!-- INPUT -->\n <list-input\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [autoFocus]=\"config.autoFocus === input.name\"\n [placeholder]=\"input.placeholder\"\n (onFocus)=\"focused = $event\"\n (onInput)=\"addOption($event)\"\n ></list-input>\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [".options{margin-bottom:5px;border-bottom:1px solid var(--outline)}.options.cdk-drop-list-dragging .option:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{box-sizing:border-box;background-color:var(--surface-container);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$4.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "pipe", type: InputErrorPipe, name: "InputErrorPipe" }, { kind: "pipe", type: MultiLinePipe, name: "MultiLinePipe" }, { kind: "component", type: ListInputComponent, selector: "list-input", inputs: ["english", "disabled", "autoFocus", "placeholder"], outputs: ["onFocus", "onInput"] }, { kind: "component", type: ListItemComponent, selector: "list-item", inputs: ["value", "english", "disabled", "disableSort"], outputs: ["onUpdate", "onDelete"] }] });
1071
+ }
1072
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputItemListComponent, decorators: [{
1073
+ type: Component,
1074
+ args: [{ host: { selector: 'input-item-list' }, imports: [
1075
+ DragDropModule,
1076
+ ReactiveFormsModule,
1077
+ MatFormField,
1078
+ MatIcon,
1079
+ MatIconButton,
1080
+ MatInputModule,
1081
+ InputErrorPipe,
1082
+ MultiLinePipe,
1083
+ ListInputComponent,
1084
+ ListItemComponent,
1085
+ ], template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"focused ? 'always' : 'auto'\">\n <mat-label>{{ input.title }}</mat-label>\n @if (formControl.invalid) { <mat-error>{{ formControl.errors | InputErrorPipe : input.type }}</mat-error> }\n\n <!-- HINT -->\n @if (input.hint) { <mat-hint>{{ input.hint }}</mat-hint> }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <!-- OPTIONS -->\n @if (options.length > 0) {\n <div\n class=\"options\"\n cdkDropList\n (cdkDropListDropped)=\"dropOption($event)\"\n [style.border-color]=\"formControl.disabled ? 'var(--outline-variant)' : 'var(--outline)'\"\n >\n @for (item of options; track $index) {\n <list-item\n cdkDrag\n cdkDragLockAxis=\"y\"\n cdkDragBoundary=\".options\"\n [cdkDragDisabled]=\"input.disableSort\"\n class=\"option\"\n [value]=\"item\"\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [disableSort]=\"!!input.disableSort\"\n (onUpdate)=\"updateOption($index, $event)\"\n (onDelete)=\"deleteOption($index)\"\n ></list-item>\n }\n </div>\n }\n <!-- INPUT -->\n <list-input\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [autoFocus]=\"config.autoFocus === input.name\"\n [placeholder]=\"input.placeholder\"\n (onFocus)=\"focused = $event\"\n (onInput)=\"addOption($event)\"\n ></list-input>\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [".options{margin-bottom:5px;border-bottom:1px solid var(--outline)}.options.cdk-drop-list-dragging .option:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{box-sizing:border-box;background-color:var(--surface-container);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
1086
+ }], propDecorators: { values: [{
1087
+ type: Input,
1088
+ args: [{ required: true }]
1089
+ }], isButtonDisabled: [{
1090
+ type: Input,
1091
+ args: [{ required: true }]
1092
+ }] } });
1093
+
1094
+ class InputItemListMethods extends InputMethods {
1095
+ control(input, validators) {
1096
+ if (!input.allowDuplicates)
1097
+ validators.push(DuplicateValidator((value) => value));
1098
+ if (input.minCount)
1099
+ validators.push(MinCountValidator(input.minCount));
1100
+ if (input.maxCount)
1101
+ validators.push(MaxCountValidator(input.maxCount));
1102
+ const value = (Array.isArray(input.value) ? input.value : []).filter((value) => Helper.IS.string(value) && value !== '');
1103
+ return new FormControl(value, validators);
1104
+ }
1105
+ value(value, input) {
1106
+ return Array.isArray(value) && value.length > 0 ? value : null;
1107
+ }
1108
+ }
1109
+
941
1110
  class InputMobileComponent {
942
1111
  formControl = inject(INPUT_CONTROL);
943
1112
  input = inject(INPUT_TYPE);
@@ -1262,6 +1431,93 @@ class InputNumberMethods extends InputMethods {
1262
1431
  }
1263
1432
  }
1264
1433
 
1434
+ class InputOptionListComponent {
1435
+ formControl = inject(INPUT_CONTROL);
1436
+ input = inject(INPUT_TYPE);
1437
+ config = inject(INPUT_CONFIG);
1438
+ values;
1439
+ isButtonDisabled;
1440
+ focused = false;
1441
+ options = [];
1442
+ ngOnInit() {
1443
+ this.options = Array.isArray(this.formControl.value) ? this.formControl.value : [];
1444
+ }
1445
+ setValue() {
1446
+ this.formControl.setValue([...this.options]);
1447
+ this.formControl.markAsTouched();
1448
+ }
1449
+ dropOption(event) {
1450
+ if (event.previousIndex === event.currentIndex)
1451
+ return;
1452
+ moveItemInArray(this.options, event.previousIndex, event.currentIndex);
1453
+ this.setValue();
1454
+ }
1455
+ addOption(title) {
1456
+ this.options.push({ id: null, title });
1457
+ this.setValue();
1458
+ }
1459
+ updateOption(index, title) {
1460
+ if (!this.options[index])
1461
+ return;
1462
+ const option = { id: this.options[index].id, title };
1463
+ this.options.splice(index, 1, option);
1464
+ this.setValue();
1465
+ }
1466
+ deleteOption(index) {
1467
+ if (!this.options[index])
1468
+ return;
1469
+ this.options.splice(index, 1);
1470
+ this.setValue();
1471
+ }
1472
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputOptionListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1473
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: InputOptionListComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-option-list" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"focused ? 'always' : 'auto'\">\n <mat-label>{{ input.title }}</mat-label>\n @if (formControl.invalid) { <mat-error>{{ formControl.errors | InputErrorPipe : input.type }}</mat-error> }\n\n <!-- HINT -->\n @if (input.hint) { <mat-hint>{{ input.hint }}</mat-hint> }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <!-- OPTIONS -->\n @if (options.length > 0) {\n <div\n class=\"options\"\n cdkDropList\n (cdkDropListDropped)=\"dropOption($event)\"\n [style.border-color]=\"formControl.disabled ? 'var(--outline-variant)' : 'var(--outline)'\"\n >\n @for (item of options; track $index) {\n <list-item\n cdkDrag\n cdkDragLockAxis=\"y\"\n cdkDragBoundary=\".options\"\n [cdkDragDisabled]=\"input.disableSort\"\n class=\"option\"\n [value]=\"item.title\"\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [disableSort]=\"!!input.disableSort\"\n (onUpdate)=\"updateOption($index, $event)\"\n (onDelete)=\"deleteOption($index)\"\n ></list-item>\n }\n </div>\n }\n <!-- INPUT -->\n <list-input\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [autoFocus]=\"config.autoFocus === input.name\"\n [placeholder]=\"input.placeholder\"\n (onFocus)=\"focused = $event\"\n (onInput)=\"addOption($event)\"\n ></list-input>\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [".options{margin-bottom:5px;border-bottom:1px solid var(--outline)}.options.cdk-drop-list-dragging .option:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{box-sizing:border-box;background-color:var(--surface-container);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$4.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "pipe", type: InputErrorPipe, name: "InputErrorPipe" }, { kind: "pipe", type: MultiLinePipe, name: "MultiLinePipe" }, { kind: "component", type: ListInputComponent, selector: "list-input", inputs: ["english", "disabled", "autoFocus", "placeholder"], outputs: ["onFocus", "onInput"] }, { kind: "component", type: ListItemComponent, selector: "list-item", inputs: ["value", "english", "disabled", "disableSort"], outputs: ["onUpdate", "onDelete"] }] });
1474
+ }
1475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputOptionListComponent, decorators: [{
1476
+ type: Component,
1477
+ args: [{ host: { selector: 'input-option-list' }, imports: [
1478
+ DragDropModule,
1479
+ ReactiveFormsModule,
1480
+ MatFormField,
1481
+ MatIcon,
1482
+ MatIconButton,
1483
+ MatInputModule,
1484
+ InputErrorPipe,
1485
+ MultiLinePipe,
1486
+ ListInputComponent,
1487
+ ListItemComponent,
1488
+ ], template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"focused ? 'always' : 'auto'\">\n <mat-label>{{ input.title }}</mat-label>\n @if (formControl.invalid) { <mat-error>{{ formControl.errors | InputErrorPipe : input.type }}</mat-error> }\n\n <!-- HINT -->\n @if (input.hint) { <mat-hint>{{ input.hint }}</mat-hint> }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <!-- OPTIONS -->\n @if (options.length > 0) {\n <div\n class=\"options\"\n cdkDropList\n (cdkDropListDropped)=\"dropOption($event)\"\n [style.border-color]=\"formControl.disabled ? 'var(--outline-variant)' : 'var(--outline)'\"\n >\n @for (item of options; track $index) {\n <list-item\n cdkDrag\n cdkDragLockAxis=\"y\"\n cdkDragBoundary=\".options\"\n [cdkDragDisabled]=\"input.disableSort\"\n class=\"option\"\n [value]=\"item.title\"\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [disableSort]=\"!!input.disableSort\"\n (onUpdate)=\"updateOption($index, $event)\"\n (onDelete)=\"deleteOption($index)\"\n ></list-item>\n }\n </div>\n }\n <!-- INPUT -->\n <list-input\n [english]=\"!!input.english\"\n [disabled]=\"!!formControl.disabled\"\n [autoFocus]=\"config.autoFocus === input.name\"\n [placeholder]=\"input.placeholder\"\n (onFocus)=\"focused = $event\"\n (onInput)=\"addOption($event)\"\n ></list-input>\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [".options{margin-bottom:5px;border-bottom:1px solid var(--outline)}.options.cdk-drop-list-dragging .option:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.cdk-drag-preview{box-sizing:border-box;background-color:var(--surface-container);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
1489
+ }], propDecorators: { values: [{
1490
+ type: Input,
1491
+ args: [{ required: true }]
1492
+ }], isButtonDisabled: [{
1493
+ type: Input,
1494
+ args: [{ required: true }]
1495
+ }] } });
1496
+
1497
+ class InputOptionListMethods extends InputMethods {
1498
+ control(input, validators) {
1499
+ if (!input.allowDuplicates)
1500
+ validators.push(DuplicateValidator((value) => value.title));
1501
+ if (input.minCount)
1502
+ validators.push(MinCountValidator(input.minCount));
1503
+ if (input.maxCount)
1504
+ validators.push(MaxCountValidator(input.maxCount));
1505
+ const value = (Array.isArray(input.value) ? input.value : []).filter((value) => {
1506
+ if (!Helper.IS.object(value))
1507
+ return false;
1508
+ if (value.id !== null && (!Helper.IS.string(value.id) || value.id.length === 0))
1509
+ return false;
1510
+ if (!Helper.IS.string(value.title) || value.title.length === 0)
1511
+ return false;
1512
+ return true;
1513
+ });
1514
+ return new FormControl(value, validators);
1515
+ }
1516
+ value(value, input) {
1517
+ return Array.isArray(value) && value.length > 0 ? value : null;
1518
+ }
1519
+ }
1520
+
1265
1521
  class InputPasswordComponent {
1266
1522
  formControl = inject(INPUT_CONTROL);
1267
1523
  input = inject(INPUT_TYPE);
@@ -1694,11 +1950,13 @@ const InputInfo = {
1694
1950
  FILE: { title: 'فایل', methods: new InputFileMethods(), component: InputFileComponent },
1695
1951
  ICON: { title: 'آیکون', methods: new InputIconMethods(), component: InputIconComponent },
1696
1952
  IP: { title: 'آدرس آی‌پی', methods: new InputIpMethods(), component: InputIpComponent },
1953
+ 'ITEM-LIST': { title: 'لیست مقادیر', methods: new InputItemListMethods(), component: InputItemListComponent },
1697
1954
  MOBILE: { title: 'موبایل', methods: new InputMobileMethods(), component: InputMobileComponent },
1698
1955
  MOMENT: { title: 'زمان', methods: new InputMomentMethods(), component: InputMomentComponent },
1699
1956
  'MULTI-SELECT': { title: 'چند انتخابی', methods: new InputMultiSelectMethods(), component: InputMultiSelectComponent },
1700
1957
  NAME: { title: 'نام و نام خانوادگی', methods: new InputNameMethods(), component: InputNameComponent },
1701
1958
  NUMBER: { title: 'مقدار عددی', methods: new InputNumberMethods(), component: InputNumberComponent },
1959
+ 'OPTION-LIST': { title: 'لیست گزینه‌ها', methods: new InputOptionListMethods(), component: InputOptionListComponent },
1702
1960
  PASSWORD: { title: 'کلمه عبور', methods: new InputPasswordMethods(), component: InputPasswordComponent },
1703
1961
  PRICE: { title: 'قیمت', methods: new InputPriceMethods(), component: InputPriceComponent },
1704
1962
  ROUTE: { title: 'مسیر', methods: new InputRouteMethods(), component: InputRouteComponent },
@@ -1908,7 +2166,12 @@ class NgxFormComponent {
1908
2166
  setInput(input) {
1909
2167
  const name = input.name;
1910
2168
  const readonly = 'readonly' in input && !!input.readonly;
1911
- const validators = input.type === 'CHECKBOX' || input.type === 'MULTI-SELECT' || input.optional || readonly
2169
+ const validators = input.type === 'CHECKBOX' ||
2170
+ input.type === 'ITEM-LIST' ||
2171
+ input.type === 'MULTI-SELECT' ||
2172
+ input.type === 'OPTION-LIST' ||
2173
+ input.optional ||
2174
+ readonly
1912
2175
  ? []
1913
2176
  : [Validators.required];
1914
2177
  this.formGroup.setControl(name, InputInfo[input.type].methods.control(input, validators));
@@ -1988,13 +2251,13 @@ class NgxFormComponent {
1988
2251
  else
1989
2252
  this.router.navigate(action);
1990
2253
  }
1991
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgxFormComponent, deps: [{ token: i1$4.Router }, { token: NGX_FORM_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2254
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgxFormComponent, deps: [{ token: i1$5.Router }, { token: NGX_FORM_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1992
2255
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: NgxFormComponent, isStandalone: true, selector: "ngx-form", inputs: { ngxForm: "ngxForm" }, outputs: { onInit: "onInit", onSubmit: "onSubmit", onChange: "onChange" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "ngForm", first: true, predicate: ["formObject"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"checkSubmit()\" dir=\"rtl\" class=\"ngx-form\" #formObject=\"ngForm\">\n <section class=\"sections\">\n @for (section of sections; track $index) {\n <!-- CHECK SECTION VIEW -->\n @if (showSection(section)) {\n <!-- SECTION HEADER -->\n @if (section.header) {\n <div class=\"ngx-form-m3-header section-header\">{{ section.header }}</div>\n }\n\n <div class=\"section\" [class.section-mobile]=\"isMobile\">\n <!-- SECTIONS -->\n @for (column of section.columns; track $index) {\n <!-- CHECK COLUMN VIEW -->\n @if (showColumn(column)) {\n <div class=\"column\" [style.flex]=\"section.flex[$index]\">\n <!-- COLUMN HEADER -->\n @if (column.header) {\n <div class=\"ngx-form-m3-header column-header\">{{ column.header }}</div>\n }\n\n <!-- ROWS -->\n @for (row of column.rows; track $index) {\n <!-- CHECK Row VIEW -->\n @if (showRow(row)) {\n <!-- ROW HEADER -->\n @if (row.header) {\n <div class=\"ngx-form-m3-header row-header\">{{ row.header }}</div>\n }\n\n <div class=\"inputs\">\n <!-- INPUTS -->\n @for (input of row.inputs; track $index) {\n <!-- CHECK Row VIEW -->\n @if (showInput(input)) {\n <div class=\"input\" [style.flex]=\"row.flex[$index]\">\n <form-input\n [formGroup]=\"formGroup\"\n [input]=\"input\"\n [config]=\"inputConfig\"\n [values]=\"values\"\n ></form-input>\n </div>\n } }\n </div>\n } }\n </div>\n } }\n </div>\n } }\n </section>\n\n <section class=\"ngx-form-m3-form-buttons\" [class.mobile-view]=\"isMobile\">\n <!-- EXTRA BUTTONS -->\n @for (item of (ngxForm.buttons || []); track $index) {\n <button type=\"button\" mat-stroked-button (click)=\"onClick(item.action)\">{{ item.title }}</button>\n }\n <!-- SUBMIT BUTTON -->\n <button type=\"submit\" mat-flat-button>{{ ngxForm.submit }}</button>\n </section>\n</form>\n", styles: [".sections{display:flex;flex-direction:column}.sections .column-header,.sections .section-header{margin-bottom:1rem}.sections .row-header{margin:1rem 0}.sections .section,.sections .section .column .inputs{display:flex;align-items:flex-start;column-gap:1rem}.sections .section-mobile{display:block}:host ::ng-deep mat-form-field{width:100%;margin-bottom:.5rem}:host ::ng-deep .mat-mdc-form-field-infix{width:100%!important}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: InputComponent, selector: "form-input", inputs: ["formGroup", "input", "config", "values"] }, { kind: "directive", type: FormErrorDirective, selector: "form.ngx-form" }] });
1993
2256
  }
1994
2257
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: NgxFormComponent, decorators: [{
1995
2258
  type: Component,
1996
2259
  args: [{ selector: 'ngx-form', imports: [ReactiveFormsModule, MatButton, InputComponent, FormErrorDirective], template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"checkSubmit()\" dir=\"rtl\" class=\"ngx-form\" #formObject=\"ngForm\">\n <section class=\"sections\">\n @for (section of sections; track $index) {\n <!-- CHECK SECTION VIEW -->\n @if (showSection(section)) {\n <!-- SECTION HEADER -->\n @if (section.header) {\n <div class=\"ngx-form-m3-header section-header\">{{ section.header }}</div>\n }\n\n <div class=\"section\" [class.section-mobile]=\"isMobile\">\n <!-- SECTIONS -->\n @for (column of section.columns; track $index) {\n <!-- CHECK COLUMN VIEW -->\n @if (showColumn(column)) {\n <div class=\"column\" [style.flex]=\"section.flex[$index]\">\n <!-- COLUMN HEADER -->\n @if (column.header) {\n <div class=\"ngx-form-m3-header column-header\">{{ column.header }}</div>\n }\n\n <!-- ROWS -->\n @for (row of column.rows; track $index) {\n <!-- CHECK Row VIEW -->\n @if (showRow(row)) {\n <!-- ROW HEADER -->\n @if (row.header) {\n <div class=\"ngx-form-m3-header row-header\">{{ row.header }}</div>\n }\n\n <div class=\"inputs\">\n <!-- INPUTS -->\n @for (input of row.inputs; track $index) {\n <!-- CHECK Row VIEW -->\n @if (showInput(input)) {\n <div class=\"input\" [style.flex]=\"row.flex[$index]\">\n <form-input\n [formGroup]=\"formGroup\"\n [input]=\"input\"\n [config]=\"inputConfig\"\n [values]=\"values\"\n ></form-input>\n </div>\n } }\n </div>\n } }\n </div>\n } }\n </div>\n } }\n </section>\n\n <section class=\"ngx-form-m3-form-buttons\" [class.mobile-view]=\"isMobile\">\n <!-- EXTRA BUTTONS -->\n @for (item of (ngxForm.buttons || []); track $index) {\n <button type=\"button\" mat-stroked-button (click)=\"onClick(item.action)\">{{ item.title }}</button>\n }\n <!-- SUBMIT BUTTON -->\n <button type=\"submit\" mat-flat-button>{{ ngxForm.submit }}</button>\n </section>\n</form>\n", styles: [".sections{display:flex;flex-direction:column}.sections .column-header,.sections .section-header{margin-bottom:1rem}.sections .row-header{margin:1rem 0}.sections .section,.sections .section .column .inputs{display:flex;align-items:flex-start;column-gap:1rem}.sections .section-mobile{display:block}:host ::ng-deep mat-form-field{width:100%;margin-bottom:.5rem}:host ::ng-deep .mat-mdc-form-field-infix{width:100%!important}\n"] }]
1997
- }], ctorParameters: () => [{ type: i1$4.Router }, { type: undefined, decorators: [{
2260
+ }], ctorParameters: () => [{ type: i1$5.Router }, { type: undefined, decorators: [{
1998
2261
  type: Optional
1999
2262
  }, {
2000
2263
  type: Inject,