@webilix/ngx-form-m3 0.0.31 → 0.0.34
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.
- package/fesm2022/webilix-ngx-form-m3.mjs +95 -17
- package/fesm2022/webilix-ngx-form-m3.mjs.map +1 -1
- package/index.d.ts +14 -1
- package/ngx-form-m3.css +17 -0
- package/package.json +3 -3
|
@@ -15,7 +15,7 @@ import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
|
|
|
15
15
|
import { JalaliDateTime } from '@webilix/jalali-date-time';
|
|
16
16
|
import { NgComponentOutlet, NgClass, DecimalPipe } from '@angular/common';
|
|
17
17
|
import * as i1$2 from '@webilix/ngx-helper-m3';
|
|
18
|
-
import { NgxHelperDatePipe, NgxHelperFileSizePipe } from '@webilix/ngx-helper-m3';
|
|
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
21
|
import * as i3$1 from '@angular/material/menu';
|
|
@@ -681,11 +681,11 @@ class InputCoordinatesComponent {
|
|
|
681
681
|
this.formControl.markAsTouched();
|
|
682
682
|
}
|
|
683
683
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputCoordinatesComponent, deps: [{ token: i1$2.NgxHelperCoordinatesService }], target: i0.ɵɵFactoryTarget.Component });
|
|
684
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: InputCoordinatesComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-coordinates" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"formControl.value ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0648\u0642\u0639\u06CC\u062A \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"formControl.value ? resetCoordinates() : setCoordinates(); formControl.markAsTouched()\">\n {{ formControl.value ? 'close' : '
|
|
684
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: InputCoordinatesComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-coordinates" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"formControl.value ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0648\u0642\u0639\u06CC\u062A \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"formControl.value ? resetCoordinates() : setCoordinates(); formControl.markAsTouched()\">\n {{ formControl.value ? 'close' : 'location_on' }}\n </mat-icon>\n </span>\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 -->\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <input\n type=\"text\"\n matInput\n [readonly]=\"true\"\n class=\"ngx-helper-form-m3-coordinates-input ngx-form-m3-en\"\n [disabled]=\"formControl.disabled\"\n (click)=\"setCoordinates()\"\n [value]=\"formControl.value ? coordinates?.latitude + ', ' + coordinates?.longitude : ''\"\n />\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: [""], dependencies: [{ 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" }] });
|
|
685
685
|
}
|
|
686
686
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputCoordinatesComponent, decorators: [{
|
|
687
687
|
type: Component,
|
|
688
|
-
args: [{ host: { selector: 'input-coordinates' }, imports: [ReactiveFormsModule, MatFormField, MatIcon, MatIconButton, MatInputModule, InputErrorPipe, MultiLinePipe], template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"formControl.value ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0648\u0642\u0639\u06CC\u062A \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"formControl.value ? resetCoordinates() : setCoordinates(); formControl.markAsTouched()\">\n {{ formControl.value ? 'close' : '
|
|
688
|
+
args: [{ host: { selector: 'input-coordinates' }, imports: [ReactiveFormsModule, MatFormField, MatIcon, MatIconButton, MatInputModule, InputErrorPipe, MultiLinePipe], template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"formControl.value ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0648\u0642\u0639\u06CC\u062A \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"formControl.value ? resetCoordinates() : setCoordinates(); formControl.markAsTouched()\">\n {{ formControl.value ? 'close' : 'location_on' }}\n </mat-icon>\n </span>\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 -->\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <input\n type=\"text\"\n matInput\n [readonly]=\"true\"\n class=\"ngx-helper-form-m3-coordinates-input ngx-form-m3-en\"\n [disabled]=\"formControl.disabled\"\n (click)=\"setCoordinates()\"\n [value]=\"formControl.value ? coordinates?.latitude + ', ' + coordinates?.longitude : ''\"\n />\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" }]
|
|
689
689
|
}], ctorParameters: () => [{ type: i1$2.NgxHelperCoordinatesService }], propDecorators: { values: [{
|
|
690
690
|
type: Input,
|
|
691
691
|
args: [{ required: true }]
|
|
@@ -1379,6 +1379,75 @@ class InputPriceMethods extends InputMethods {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
1381
|
|
|
1382
|
+
class InputRouteComponent {
|
|
1383
|
+
ngxHelperRouteService;
|
|
1384
|
+
formControl = inject(INPUT_CONTROL);
|
|
1385
|
+
input = inject(INPUT_TYPE);
|
|
1386
|
+
config = inject(INPUT_CONFIG);
|
|
1387
|
+
values;
|
|
1388
|
+
isButtonDisabled;
|
|
1389
|
+
route = this.formControl.value || [];
|
|
1390
|
+
distance = Helper.GEO.routeLength(this.route);
|
|
1391
|
+
constructor(ngxHelperRouteService) {
|
|
1392
|
+
this.ngxHelperRouteService = ngxHelperRouteService;
|
|
1393
|
+
}
|
|
1394
|
+
setRoute() {
|
|
1395
|
+
if (this.formControl.disabled)
|
|
1396
|
+
return;
|
|
1397
|
+
const get = this.route.length > 0
|
|
1398
|
+
? this.ngxHelperRouteService.get(this.route, { view: this.input.center, zoom: this.input.zoom })
|
|
1399
|
+
: this.ngxHelperRouteService.get({ view: this.input.center, zoom: this.input.zoom });
|
|
1400
|
+
get.then((route) => {
|
|
1401
|
+
this.route = route;
|
|
1402
|
+
this.formControl.setValue(route);
|
|
1403
|
+
this.formControl.markAsTouched();
|
|
1404
|
+
this.distance = Helper.GEO.routeLength(this.route);
|
|
1405
|
+
}, () => this.formControl.markAsTouched());
|
|
1406
|
+
}
|
|
1407
|
+
resetRoute() {
|
|
1408
|
+
if (this.formControl.disabled)
|
|
1409
|
+
return;
|
|
1410
|
+
this.route = [];
|
|
1411
|
+
this.formControl.setValue(null);
|
|
1412
|
+
this.formControl.markAsTouched();
|
|
1413
|
+
}
|
|
1414
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputRouteComponent, deps: [{ token: i1$2.NgxHelperRouteService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1415
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: InputRouteComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-route" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"route.length > 0 ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0633\u06CC\u0631' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"route.length > 0 ? resetRoute() : setRoute(); formControl.markAsTouched()\">\n {{ route.length > 0 ? 'close' : 'call_split' }}\n </mat-icon>\n </span>\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 -->\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <div\n class=\"ngx-helper-form-m3-route-input\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n (click)=\"setRoute()\"\n >\n <div class=\"distance\">{{ route.length > 0 ? (distance.length | ngxHelperNumber) + ' \u0645\u062A\u0631' : ' ' }}</div>\n <div class=\"point\">{{ route.length > 0 ? (route.length | ngxHelperNumber) + ' \u0646\u0642\u0637\u0647' : ' ' }}</div>\n </div>\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: [""], dependencies: [{ 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: NgxHelperNumberPipe, name: "ngxHelperNumber" }, { kind: "pipe", type: InputErrorPipe, name: "InputErrorPipe" }, { kind: "pipe", type: MultiLinePipe, name: "MultiLinePipe" }] });
|
|
1416
|
+
}
|
|
1417
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: InputRouteComponent, decorators: [{
|
|
1418
|
+
type: Component,
|
|
1419
|
+
args: [{ host: { selector: 'input-route' }, imports: [
|
|
1420
|
+
ReactiveFormsModule,
|
|
1421
|
+
MatFormField,
|
|
1422
|
+
MatIcon,
|
|
1423
|
+
MatIconButton,
|
|
1424
|
+
MatInputModule,
|
|
1425
|
+
NgxHelperNumberPipe,
|
|
1426
|
+
InputErrorPipe,
|
|
1427
|
+
MultiLinePipe,
|
|
1428
|
+
], template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\" [floatLabel]=\"route.length > 0 ? 'always' : 'auto'\">\n <mat-label>{{ input.title || '\u0645\u0633\u06CC\u0631' }}</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 <!-- SUFFIX -->\n <span matTextSuffix class=\"ngx-form-m3-input-suffix click\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon (click)=\"route.length > 0 ? resetRoute() : setRoute(); formControl.markAsTouched()\">\n {{ route.length > 0 ? 'close' : 'call_split' }}\n </mat-icon>\n </span>\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 -->\n <input matInput type=\"text\" [name]=\"input.name\" [formControl]=\"formControl\" [style.display]=\"'none !important'\" />\n <div\n class=\"ngx-helper-form-m3-route-input\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n (click)=\"setRoute()\"\n >\n <div class=\"distance\">{{ route.length > 0 ? (distance.length | ngxHelperNumber) + ' \u0645\u062A\u0631' : ' ' }}</div>\n <div class=\"point\">{{ route.length > 0 ? (route.length | ngxHelperNumber) + ' \u0646\u0642\u0637\u0647' : ' ' }}</div>\n </div>\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" }]
|
|
1429
|
+
}], ctorParameters: () => [{ type: i1$2.NgxHelperRouteService }], propDecorators: { values: [{
|
|
1430
|
+
type: Input,
|
|
1431
|
+
args: [{ required: true }]
|
|
1432
|
+
}], isButtonDisabled: [{
|
|
1433
|
+
type: Input,
|
|
1434
|
+
args: [{ required: true }]
|
|
1435
|
+
}] } });
|
|
1436
|
+
|
|
1437
|
+
class InputRouteMethods extends InputMethods {
|
|
1438
|
+
control(input, validators) {
|
|
1439
|
+
const value = input.value && Helper.IS.array(input.value)
|
|
1440
|
+
? input.value.filter((coordinates) => Helper.IS.object(coordinates) &&
|
|
1441
|
+
Helper.IS.number(coordinates.latitude) &&
|
|
1442
|
+
Helper.IS.number(coordinates.longitude))
|
|
1443
|
+
: [];
|
|
1444
|
+
return new FormControl(value.length > 1 ? value : [], validators);
|
|
1445
|
+
}
|
|
1446
|
+
value(value, input) {
|
|
1447
|
+
return Helper.IS.array(value) && value.length > 0 ? value : null;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1382
1451
|
class InputSelectComponent {
|
|
1383
1452
|
formControl = inject(INPUT_CONTROL);
|
|
1384
1453
|
input = inject(INPUT_TYPE);
|
|
@@ -1632,6 +1701,7 @@ const InputInfo = {
|
|
|
1632
1701
|
NUMBER: { title: 'مقدار عددی', methods: new InputNumberMethods(), component: InputNumberComponent },
|
|
1633
1702
|
PASSWORD: { title: 'کلمه عبور', methods: new InputPasswordMethods(), component: InputPasswordComponent },
|
|
1634
1703
|
PRICE: { title: 'قیمت', methods: new InputPriceMethods(), component: InputPriceComponent },
|
|
1704
|
+
ROUTE: { title: 'مسیر', methods: new InputRouteMethods(), component: InputRouteComponent },
|
|
1635
1705
|
SELECT: { title: 'لیست کشویی', methods: new InputSelectMethods(), component: InputSelectComponent },
|
|
1636
1706
|
TEXT: { title: 'متن یک خطی', methods: new InputTextMethods(), component: InputTextComponent },
|
|
1637
1707
|
TEXTAREA: { title: 'متن چند خطی', methods: new InputTextareaMethods(), component: InputTextareaComponent },
|
|
@@ -1683,6 +1753,9 @@ class NgxFormComponent {
|
|
|
1683
1753
|
appearance: this.ngxForm.appearance || this.config?.appearance || 'fill',
|
|
1684
1754
|
autoFocus,
|
|
1685
1755
|
};
|
|
1756
|
+
// UPDATE VALUES
|
|
1757
|
+
if (this.ngxForm.updateValues)
|
|
1758
|
+
this.updateValues([]);
|
|
1686
1759
|
// REGISTER VALUE CHANGE
|
|
1687
1760
|
this.formGroup.valueChanges.subscribe({
|
|
1688
1761
|
next: () => {
|
|
@@ -1698,20 +1771,7 @@ class NgxFormComponent {
|
|
|
1698
1771
|
this.lastValues = { ...this.formGroup.value };
|
|
1699
1772
|
this.checkInputs();
|
|
1700
1773
|
if (this.ngxForm.updateValues) {
|
|
1701
|
-
|
|
1702
|
-
const changes = this.ngxForm.updateValues(values);
|
|
1703
|
-
Object.keys(changes)
|
|
1704
|
-
.filter((key) => !changedInputs.includes(key))
|
|
1705
|
-
.forEach((key) => {
|
|
1706
|
-
const input = this.getInputs().find((i) => i.name === key);
|
|
1707
|
-
if (!input)
|
|
1708
|
-
return;
|
|
1709
|
-
const formInput = this.formGroup.get(key);
|
|
1710
|
-
if (!formInput)
|
|
1711
|
-
return;
|
|
1712
|
-
const value = InputInfo[input.type].methods.value(changes[key], input);
|
|
1713
|
-
formInput.setValue(value);
|
|
1714
|
-
});
|
|
1774
|
+
this.updateValues(changedInputs);
|
|
1715
1775
|
this.lastValues = { ...this.formGroup.value };
|
|
1716
1776
|
}
|
|
1717
1777
|
this.values = this.getValues();
|
|
@@ -1827,6 +1887,24 @@ class NgxFormComponent {
|
|
|
1827
1887
|
});
|
|
1828
1888
|
return values;
|
|
1829
1889
|
}
|
|
1890
|
+
updateValues(changedInputs) {
|
|
1891
|
+
if (!this.ngxForm.updateValues)
|
|
1892
|
+
return;
|
|
1893
|
+
const values = this.getValues();
|
|
1894
|
+
const changes = this.ngxForm.updateValues(values);
|
|
1895
|
+
Object.keys(changes)
|
|
1896
|
+
.filter((key) => !changedInputs.includes(key))
|
|
1897
|
+
.forEach((key) => {
|
|
1898
|
+
const input = this.getInputs().find((i) => i.name === key);
|
|
1899
|
+
if (!input)
|
|
1900
|
+
return;
|
|
1901
|
+
const formInput = this.formGroup.get(key);
|
|
1902
|
+
if (!formInput)
|
|
1903
|
+
return;
|
|
1904
|
+
const value = InputInfo[input.type].methods.value(changes[key], input);
|
|
1905
|
+
formInput.setValue(value);
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1830
1908
|
setInput(input) {
|
|
1831
1909
|
const name = input.name;
|
|
1832
1910
|
const readonly = 'readonly' in input && !!input.readonly;
|