special-forms 0.0.1
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/README.md +24 -0
- package/esm2020/lib/components/index.mjs +22 -0
- package/esm2020/lib/components/special-autocomplete/special-autocomplete.component.mjs +61 -0
- package/esm2020/lib/components/special-autocomplete/special-autocomplete.interface.mjs +2 -0
- package/esm2020/lib/components/special-autocomplete/special-autocomplete.module.mjs +47 -0
- package/esm2020/lib/components/special-checkbox/special-checkbox.component.mjs +20 -0
- package/esm2020/lib/components/special-checkbox/special-checkbox.interface.mjs +2 -0
- package/esm2020/lib/components/special-checkbox/special-checkbox.module.mjs +47 -0
- package/esm2020/lib/components/special-datepicker/special-datepicker.component.mjs +24 -0
- package/esm2020/lib/components/special-datepicker/special-datepicker.interface.mjs +2 -0
- package/esm2020/lib/components/special-datepicker/special-datepicker.module.mjs +48 -0
- package/esm2020/lib/components/special-dropdown/special-dropdown.component.mjs +35 -0
- package/esm2020/lib/components/special-dropdown/special-dropdown.interface.mjs +2 -0
- package/esm2020/lib/components/special-dropdown/special-dropdown.module.mjs +43 -0
- package/esm2020/lib/components/special-form/special-form.component.mjs +97 -0
- package/esm2020/lib/components/special-form/special-form.module.mjs +68 -0
- package/esm2020/lib/components/special-input/special-input.component.mjs +42 -0
- package/esm2020/lib/components/special-input/special-input.interface.mjs +2 -0
- package/esm2020/lib/components/special-input/special-input.module.mjs +44 -0
- package/esm2020/lib/components/special-label/special-label.component.mjs +25 -0
- package/esm2020/lib/components/special-label/special-label.interface.mjs +2 -0
- package/esm2020/lib/components/special-label/special-label.module.mjs +47 -0
- package/esm2020/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.component.mjs +82 -0
- package/esm2020/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.interface.mjs +2 -0
- package/esm2020/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.module.mjs +51 -0
- package/esm2020/lib/components/special-text-area/special-text-area.component.mjs +30 -0
- package/esm2020/lib/components/special-text-area/special-text-area.interface.mjs +2 -0
- package/esm2020/lib/components/special-text-area/special-text-area.module.mjs +44 -0
- package/esm2020/lib/components/special-upload/special-upload.component.mjs +69 -0
- package/esm2020/lib/components/special-upload/special-upload.interface.mjs +2 -0
- package/esm2020/lib/components/special-upload/special-upload.module.mjs +43 -0
- package/esm2020/lib/core/aux-data/control-types.enum.mjs +18 -0
- package/esm2020/lib/core/forms/special-forms.mjs +238 -0
- package/esm2020/lib/core/interfaces/field-basics.interfaces.mjs +2 -0
- package/esm2020/lib/core/interfaces/form.interfaces.mjs +2 -0
- package/esm2020/lib/core/services/index.mjs +3 -0
- package/esm2020/lib/core/services/special-form-builder/special-form-builder.service.mjs +156 -0
- package/esm2020/lib/pipes/controls-list-pipe/controls-list.pipe.mjs +18 -0
- package/esm2020/lib/pipes/controls-list-pipe/controls-list.pipe.module.mjs +18 -0
- package/esm2020/lib/pipes/error-message-pipe/error.pipe.mjs +22 -0
- package/esm2020/lib/pipes/error-message-pipe/error.pipe.module.mjs +20 -0
- package/esm2020/lib/pipes/index.mjs +3 -0
- package/esm2020/lib/pipes/text-by-function/text-by-function.pipe.mjs +22 -0
- package/esm2020/lib/pipes/text-by-function/text-by-function.pipe.module.mjs +20 -0
- package/esm2020/public-api.mjs +6 -0
- package/esm2020/special-forms.mjs +5 -0
- package/fesm2015/special-forms.mjs +1292 -0
- package/fesm2015/special-forms.mjs.map +1 -0
- package/fesm2020/special-forms.mjs +1319 -0
- package/fesm2020/special-forms.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/index.d.ts +21 -0
- package/lib/components/special-autocomplete/special-autocomplete.component.d.ts +19 -0
- package/lib/components/special-autocomplete/special-autocomplete.interface.d.ts +18 -0
- package/lib/components/special-autocomplete/special-autocomplete.module.d.ts +15 -0
- package/lib/components/special-checkbox/special-checkbox.component.d.ts +11 -0
- package/lib/components/special-checkbox/special-checkbox.interface.d.ts +10 -0
- package/lib/components/special-checkbox/special-checkbox.module.d.ts +14 -0
- package/lib/components/special-datepicker/special-datepicker.component.d.ts +12 -0
- package/lib/components/special-datepicker/special-datepicker.interface.d.ts +11 -0
- package/lib/components/special-datepicker/special-datepicker.module.d.ts +15 -0
- package/lib/components/special-dropdown/special-dropdown.component.d.ts +11 -0
- package/lib/components/special-dropdown/special-dropdown.interface.d.ts +16 -0
- package/lib/components/special-dropdown/special-dropdown.module.d.ts +14 -0
- package/lib/components/special-form/special-form.component.d.ts +31 -0
- package/lib/components/special-form/special-form.module.d.ts +19 -0
- package/lib/components/special-input/special-input.component.d.ts +15 -0
- package/lib/components/special-input/special-input.interface.d.ts +15 -0
- package/lib/components/special-input/special-input.module.d.ts +14 -0
- package/lib/components/special-label/special-label.component.d.ts +13 -0
- package/lib/components/special-label/special-label.interface.d.ts +12 -0
- package/lib/components/special-label/special-label.module.d.ts +15 -0
- package/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.component.d.ts +22 -0
- package/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.interface.d.ts +18 -0
- package/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.module.d.ts +16 -0
- package/lib/components/special-text-area/special-text-area.component.d.ts +13 -0
- package/lib/components/special-text-area/special-text-area.interface.d.ts +7 -0
- package/lib/components/special-text-area/special-text-area.module.d.ts +14 -0
- package/lib/components/special-upload/special-upload.component.d.ts +21 -0
- package/lib/components/special-upload/special-upload.interface.d.ts +10 -0
- package/lib/components/special-upload/special-upload.module.d.ts +13 -0
- package/lib/core/aux-data/control-types.enum.d.ts +16 -0
- package/lib/core/forms/special-forms.d.ts +110 -0
- package/lib/core/interfaces/field-basics.interfaces.d.ts +22 -0
- package/lib/core/interfaces/form.interfaces.d.ts +51 -0
- package/lib/core/services/index.d.ts +2 -0
- package/lib/core/services/special-form-builder/special-form-builder.service.d.ts +25 -0
- package/lib/pipes/controls-list-pipe/controls-list.pipe.d.ts +11 -0
- package/lib/pipes/controls-list-pipe/controls-list.pipe.module.d.ts +8 -0
- package/lib/pipes/error-message-pipe/error.pipe.d.ts +12 -0
- package/lib/pipes/error-message-pipe/error.pipe.module.d.ts +8 -0
- package/lib/pipes/index.d.ts +2 -0
- package/lib/pipes/text-by-function/text-by-function.pipe.d.ts +7 -0
- package/lib/pipes/text-by-function/text-by-function.pipe.module.d.ts +8 -0
- package/package.json +31 -0
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,1319 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, Component, ChangeDetectionStrategy, Input, NgModule, EventEmitter, Output, Directive, Injectable } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i1 from '@ngneat/input-mask';
|
|
6
|
+
import { InputMaskModule } from '@ngneat/input-mask';
|
|
7
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
8
|
+
import * as i2 from '@angular/material/input';
|
|
9
|
+
import { MatInputModule } from '@angular/material/input';
|
|
10
|
+
import * as i6 from '@angular/material/icon';
|
|
11
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
12
|
+
import * as i7 from '@angular/forms';
|
|
13
|
+
import { ReactiveFormsModule, FormControl, FormsModule, FormGroup, FormArray, Validators } from '@angular/forms';
|
|
14
|
+
import * as i7$1 from '@angular/material/button';
|
|
15
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
16
|
+
import * as i3$1 from '@angular/material/select';
|
|
17
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
18
|
+
import * as i5 from '@angular/material/core';
|
|
19
|
+
import { MatNativeDateModule } from '@angular/material/core';
|
|
20
|
+
import * as i4 from '@angular/material/autocomplete';
|
|
21
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
22
|
+
import { debounceTime } from 'rxjs/operators';
|
|
23
|
+
import { Subscription } from 'rxjs';
|
|
24
|
+
import * as i3$2 from '@angular/material/datepicker';
|
|
25
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
26
|
+
import * as i9 from '@angular/material/chips';
|
|
27
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
28
|
+
import * as i2$1 from '@angular/material/checkbox';
|
|
29
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
30
|
+
import * as i2$2 from '@angular/cdk/text-field';
|
|
31
|
+
import * as i1$2 from '@angular/platform-browser';
|
|
32
|
+
import * as i2$3 from 'ngx-dropzone';
|
|
33
|
+
import { NgxDropzoneModule } from 'ngx-dropzone';
|
|
34
|
+
import { EControlTypes as EControlTypes$1 } from '@lib/core/aux-data/control-types.enum';
|
|
35
|
+
|
|
36
|
+
class ErrorMessagePipe {
|
|
37
|
+
transform(errorsObj, errorMessages, control) {
|
|
38
|
+
const errors = errorsObj ? Object.keys(errorsObj) : [];
|
|
39
|
+
const error = errors[0];
|
|
40
|
+
const message = errorMessages[error] || error;
|
|
41
|
+
if (control) {
|
|
42
|
+
control.setErrors(errorsObj);
|
|
43
|
+
}
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
ErrorMessagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
48
|
+
ErrorMessagePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipe, name: "errorMessage" });
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipe, decorators: [{
|
|
50
|
+
type: Pipe,
|
|
51
|
+
args: [{
|
|
52
|
+
name: "errorMessage",
|
|
53
|
+
}]
|
|
54
|
+
}] });
|
|
55
|
+
|
|
56
|
+
class SpecialInputComponent {
|
|
57
|
+
constructor() { }
|
|
58
|
+
ngOnInit() { }
|
|
59
|
+
onEnterClick() {
|
|
60
|
+
if (this.settings.onEnter) {
|
|
61
|
+
this.settings.onEnter(this.control.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
onBlurAction() {
|
|
65
|
+
if (this.settings.onBlur) {
|
|
66
|
+
this.settings.onBlur(this.control.value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
get settings() {
|
|
70
|
+
return this.control.settings;
|
|
71
|
+
}
|
|
72
|
+
iconClick(event) {
|
|
73
|
+
if (this.settings.iconAction) {
|
|
74
|
+
this.settings.iconAction(this.control.value);
|
|
75
|
+
event.stopPropagation();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
SpecialInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
80
|
+
SpecialInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialInputComponent, selector: "sp-input", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <input\n matInput\n (blur)=\"onBlurAction()\"\n (keydown.enter)=\"onEnterClick()\"\n [inputMask]=\"settings?.mask\"\n autocomplete=\"off\"\n [type]=\"settings?.type || 'text'\"\n [readonly]=\"control.readOnly\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n />\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <button\n *ngIf=\"settings?.icon\"\n mat-icon-button\n matSuffix\n (click)=\"iconClick($event)\"\n >\n <mat-icon>\n {{ settings.icon }}\n </mat-icon>\n </button>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i1.InputMaskDirective, selector: "[inputMask]", inputs: ["inputMask"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputComponent, decorators: [{
|
|
82
|
+
type: Component,
|
|
83
|
+
args: [{ selector: 'sp-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <input\n matInput\n (blur)=\"onBlurAction()\"\n (keydown.enter)=\"onEnterClick()\"\n [inputMask]=\"settings?.mask\"\n autocomplete=\"off\"\n [type]=\"settings?.type || 'text'\"\n [readonly]=\"control.readOnly\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n />\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <button\n *ngIf=\"settings?.icon\"\n mat-icon-button\n matSuffix\n (click)=\"iconClick($event)\"\n >\n <mat-icon>\n {{ settings.icon }}\n </mat-icon>\n </button>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"] }]
|
|
84
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
85
|
+
type: Input
|
|
86
|
+
}] } });
|
|
87
|
+
|
|
88
|
+
class ErrorMessagePipeModule {
|
|
89
|
+
}
|
|
90
|
+
ErrorMessagePipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
91
|
+
ErrorMessagePipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipeModule, declarations: [ErrorMessagePipe], imports: [CommonModule], exports: [ErrorMessagePipe] });
|
|
92
|
+
ErrorMessagePipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipeModule, imports: [CommonModule] });
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ErrorMessagePipeModule, decorators: [{
|
|
94
|
+
type: NgModule,
|
|
95
|
+
args: [{
|
|
96
|
+
declarations: [ErrorMessagePipe],
|
|
97
|
+
imports: [
|
|
98
|
+
CommonModule,
|
|
99
|
+
],
|
|
100
|
+
exports: [ErrorMessagePipe],
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
class TextByFunctionPipe {
|
|
105
|
+
transform(value, field) {
|
|
106
|
+
if (field instanceof Function) {
|
|
107
|
+
return field(value);
|
|
108
|
+
}
|
|
109
|
+
else if (value instanceof Object) {
|
|
110
|
+
return value[field];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
TextByFunctionPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
118
|
+
TextByFunctionPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipe, name: "textByFunction" });
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipe, decorators: [{
|
|
120
|
+
type: Pipe,
|
|
121
|
+
args: [{ name: 'textByFunction' }]
|
|
122
|
+
}] });
|
|
123
|
+
|
|
124
|
+
class TextByFunctionPipeModule {
|
|
125
|
+
}
|
|
126
|
+
TextByFunctionPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
127
|
+
TextByFunctionPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipeModule, declarations: [TextByFunctionPipe], imports: [CommonModule], exports: [TextByFunctionPipe] });
|
|
128
|
+
TextByFunctionPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipeModule, imports: [CommonModule] });
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: TextByFunctionPipeModule, decorators: [{
|
|
130
|
+
type: NgModule,
|
|
131
|
+
args: [{
|
|
132
|
+
declarations: [TextByFunctionPipe],
|
|
133
|
+
imports: [
|
|
134
|
+
CommonModule,
|
|
135
|
+
],
|
|
136
|
+
exports: [TextByFunctionPipe],
|
|
137
|
+
}]
|
|
138
|
+
}] });
|
|
139
|
+
|
|
140
|
+
class SpecialInputModule {
|
|
141
|
+
}
|
|
142
|
+
SpecialInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
143
|
+
SpecialInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputModule, declarations: [SpecialInputComponent], imports: [InputMaskModule,
|
|
144
|
+
CommonModule,
|
|
145
|
+
MatInputModule,
|
|
146
|
+
MatIconModule,
|
|
147
|
+
ReactiveFormsModule,
|
|
148
|
+
MatButtonModule,
|
|
149
|
+
ErrorMessagePipeModule], exports: [SpecialInputComponent] });
|
|
150
|
+
SpecialInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputModule, imports: [InputMaskModule,
|
|
151
|
+
CommonModule,
|
|
152
|
+
MatInputModule,
|
|
153
|
+
MatIconModule,
|
|
154
|
+
ReactiveFormsModule,
|
|
155
|
+
MatButtonModule,
|
|
156
|
+
ErrorMessagePipeModule] });
|
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialInputModule, decorators: [{
|
|
158
|
+
type: NgModule,
|
|
159
|
+
args: [{
|
|
160
|
+
declarations: [SpecialInputComponent],
|
|
161
|
+
imports: [
|
|
162
|
+
InputMaskModule,
|
|
163
|
+
CommonModule,
|
|
164
|
+
MatInputModule,
|
|
165
|
+
MatIconModule,
|
|
166
|
+
ReactiveFormsModule,
|
|
167
|
+
MatButtonModule,
|
|
168
|
+
ErrorMessagePipeModule
|
|
169
|
+
],
|
|
170
|
+
exports: [SpecialInputComponent],
|
|
171
|
+
}]
|
|
172
|
+
}] });
|
|
173
|
+
|
|
174
|
+
class SpecialDropdownComponent {
|
|
175
|
+
get settings() {
|
|
176
|
+
return this.control.settings;
|
|
177
|
+
}
|
|
178
|
+
iconClick(event) {
|
|
179
|
+
if (this.settings.iconAction) {
|
|
180
|
+
this.settings.iconAction(this.control.value);
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
optionSelected(value) {
|
|
185
|
+
if (this.settings.onSelect)
|
|
186
|
+
this.settings.onSelect(value);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
SpecialDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
190
|
+
SpecialDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialDropdownComponent, selector: "sp-dropdown", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\r\n *ngIf=\"control\"\r\n [id]=\"control.elementId\"\r\n class=\"w-full {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">\r\n {{ control.label }}\r\n </mat-label>\r\n <mat-select\r\n [formControl]=\"control\"\r\n [required]=\"control.required\"\r\n (selectionChange)=\"optionSelected($event.value)\"\r\n [placeholder]=\"control.placeholder\"\r\n >\r\n <mat-option *ngIf=\"!control.required\" [value]=\"null\">\r\n {{ control.placeholder || control.settings.notSelectedText }}\r\n </mat-option>\r\n <mat-option\r\n *ngFor=\"let item of control.settings.source | async\"\r\n [value]=\"item[control.settings.fieldId]\"\r\n >\r\n {{ item | textByFunction: control.settings.fieldName }}\r\n </mat-option>\r\n </mat-select>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <mat-hint *ngIf=\"control.tooltip\">{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i3$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownComponent, decorators: [{
|
|
192
|
+
type: Component,
|
|
193
|
+
args: [{ selector: 'sp-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field\r\n *ngIf=\"control\"\r\n [id]=\"control.elementId\"\r\n class=\"w-full {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">\r\n {{ control.label }}\r\n </mat-label>\r\n <mat-select\r\n [formControl]=\"control\"\r\n [required]=\"control.required\"\r\n (selectionChange)=\"optionSelected($event.value)\"\r\n [placeholder]=\"control.placeholder\"\r\n >\r\n <mat-option *ngIf=\"!control.required\" [value]=\"null\">\r\n {{ control.placeholder || control.settings.notSelectedText }}\r\n </mat-option>\r\n <mat-option\r\n *ngFor=\"let item of control.settings.source | async\"\r\n [value]=\"item[control.settings.fieldId]\"\r\n >\r\n {{ item | textByFunction: control.settings.fieldName }}\r\n </mat-option>\r\n </mat-select>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <mat-hint *ngIf=\"control.tooltip\">{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [":host{display:contents}\n"] }]
|
|
194
|
+
}], propDecorators: { control: [{
|
|
195
|
+
type: Input
|
|
196
|
+
}] } });
|
|
197
|
+
|
|
198
|
+
class SpecialDropdownModule {
|
|
199
|
+
}
|
|
200
|
+
SpecialDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
201
|
+
SpecialDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownModule, declarations: [SpecialDropdownComponent], imports: [CommonModule,
|
|
202
|
+
MatSelectModule,
|
|
203
|
+
ReactiveFormsModule,
|
|
204
|
+
ErrorMessagePipeModule,
|
|
205
|
+
MatIconModule,
|
|
206
|
+
MatButtonModule,
|
|
207
|
+
TextByFunctionPipeModule], exports: [SpecialDropdownComponent] });
|
|
208
|
+
SpecialDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownModule, imports: [CommonModule,
|
|
209
|
+
MatSelectModule,
|
|
210
|
+
ReactiveFormsModule,
|
|
211
|
+
ErrorMessagePipeModule,
|
|
212
|
+
MatIconModule,
|
|
213
|
+
MatButtonModule,
|
|
214
|
+
TextByFunctionPipeModule] });
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDropdownModule, decorators: [{
|
|
216
|
+
type: NgModule,
|
|
217
|
+
args: [{
|
|
218
|
+
declarations: [SpecialDropdownComponent],
|
|
219
|
+
imports: [
|
|
220
|
+
CommonModule,
|
|
221
|
+
MatSelectModule,
|
|
222
|
+
ReactiveFormsModule,
|
|
223
|
+
ErrorMessagePipeModule,
|
|
224
|
+
MatIconModule,
|
|
225
|
+
MatButtonModule,
|
|
226
|
+
TextByFunctionPipeModule
|
|
227
|
+
],
|
|
228
|
+
exports: [SpecialDropdownComponent],
|
|
229
|
+
}]
|
|
230
|
+
}] });
|
|
231
|
+
|
|
232
|
+
class SpecialAutocompleteComponent {
|
|
233
|
+
constructor() {
|
|
234
|
+
this.subs = new Subscription();
|
|
235
|
+
this.configValue = (item) => {
|
|
236
|
+
if (!item)
|
|
237
|
+
return '';
|
|
238
|
+
const fieldName = this.settings.fieldName;
|
|
239
|
+
return fieldName instanceof Function ? fieldName(item) : item[fieldName];
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
ngOnInit() {
|
|
243
|
+
this.init();
|
|
244
|
+
}
|
|
245
|
+
get settings() {
|
|
246
|
+
return this.control.settings;
|
|
247
|
+
}
|
|
248
|
+
init() {
|
|
249
|
+
this.subs.add(this.control.valueChanges.pipe(debounceTime(500)).subscribe((value) => {
|
|
250
|
+
if (typeof value === 'string') {
|
|
251
|
+
this.settings.getData(value, this.control);
|
|
252
|
+
}
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
optionSelected(data) {
|
|
256
|
+
this.control.setValue(data.option.value);
|
|
257
|
+
if (this.settings.onSelect)
|
|
258
|
+
this.settings.onSelect(data.option.value);
|
|
259
|
+
}
|
|
260
|
+
iconClick(event) {
|
|
261
|
+
if (this.settings.iconAction) {
|
|
262
|
+
this.settings.iconAction(this.control.value);
|
|
263
|
+
event.stopPropagation();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
ngOnDestroy() {
|
|
267
|
+
this.subs.unsubscribe();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
SpecialAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
271
|
+
SpecialAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialAutocompleteComponent, selector: "sp-autocomplete", inputs: { control: "control" }, ngImport: i0, template: "<ng-container *ngIf=\"control && !control.hidden\">\r\n <mat-form-field\r\n class=\"w-full {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n >\r\n <mat-label\r\n [ngClass]=\"{ 'is-link': control.label }\"\r\n class=\"control-label\"\r\n *ngIf=\"control.label\"\r\n >\r\n {{ control.label }}\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n [required]=\"control.required\"\r\n [readonly]=\"control.readOnly\"\r\n [placeholder]=\"control.placeholder\"\r\n matInput\r\n [formControl]=\"control\"\r\n [matAutocomplete]=\"auto\"\r\n />\r\n <mat-autocomplete\r\n class=\"autocomplete-options\"\r\n #auto=\"matAutocomplete\"\r\n [displayWith]=\"configValue\"\r\n (optionSelected)=\"optionSelected($event)\"\r\n >\r\n <mat-option\r\n *ngFor=\"let option of settings?.source | async\"\r\n [value]=\"option\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2\"\r\n alt=\"\"\r\n [src]=\"option | textByFunction: settings.fieldImage\"\r\n />\r\n <span>\r\n {{ option | textByFunction: settings.fieldName }}\r\n </span>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-hint>{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n </mat-form-field>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteComponent, decorators: [{
|
|
273
|
+
type: Component,
|
|
274
|
+
args: [{ selector: 'sp-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"control && !control.hidden\">\r\n <mat-form-field\r\n class=\"w-full {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n >\r\n <mat-label\r\n [ngClass]=\"{ 'is-link': control.label }\"\r\n class=\"control-label\"\r\n *ngIf=\"control.label\"\r\n >\r\n {{ control.label }}\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n [required]=\"control.required\"\r\n [readonly]=\"control.readOnly\"\r\n [placeholder]=\"control.placeholder\"\r\n matInput\r\n [formControl]=\"control\"\r\n [matAutocomplete]=\"auto\"\r\n />\r\n <mat-autocomplete\r\n class=\"autocomplete-options\"\r\n #auto=\"matAutocomplete\"\r\n [displayWith]=\"configValue\"\r\n (optionSelected)=\"optionSelected($event)\"\r\n >\r\n <mat-option\r\n *ngFor=\"let option of settings?.source | async\"\r\n [value]=\"option\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2\"\r\n alt=\"\"\r\n [src]=\"option | textByFunction: settings.fieldImage\"\r\n />\r\n <span>\r\n {{ option | textByFunction: settings.fieldName }}\r\n </span>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-hint>{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n </mat-form-field>\r\n</ng-container>\r\n", styles: [":host{display:contents}\n"] }]
|
|
275
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
276
|
+
type: Input
|
|
277
|
+
}] } });
|
|
278
|
+
|
|
279
|
+
class SpecialAutocompleteModule {
|
|
280
|
+
}
|
|
281
|
+
SpecialAutocompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
282
|
+
SpecialAutocompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteModule, declarations: [SpecialAutocompleteComponent], imports: [MatInputModule,
|
|
283
|
+
CommonModule,
|
|
284
|
+
MatAutocompleteModule,
|
|
285
|
+
MatIconModule,
|
|
286
|
+
ReactiveFormsModule,
|
|
287
|
+
MatButtonModule,
|
|
288
|
+
ErrorMessagePipeModule,
|
|
289
|
+
TextByFunctionPipeModule], exports: [SpecialAutocompleteComponent] });
|
|
290
|
+
SpecialAutocompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteModule, imports: [MatInputModule,
|
|
291
|
+
CommonModule,
|
|
292
|
+
MatAutocompleteModule,
|
|
293
|
+
MatIconModule,
|
|
294
|
+
ReactiveFormsModule,
|
|
295
|
+
MatButtonModule,
|
|
296
|
+
ErrorMessagePipeModule,
|
|
297
|
+
TextByFunctionPipeModule] });
|
|
298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialAutocompleteModule, decorators: [{
|
|
299
|
+
type: NgModule,
|
|
300
|
+
args: [{
|
|
301
|
+
declarations: [SpecialAutocompleteComponent],
|
|
302
|
+
imports: [
|
|
303
|
+
MatInputModule,
|
|
304
|
+
CommonModule,
|
|
305
|
+
MatAutocompleteModule,
|
|
306
|
+
MatIconModule,
|
|
307
|
+
ReactiveFormsModule,
|
|
308
|
+
MatButtonModule,
|
|
309
|
+
ErrorMessagePipeModule,
|
|
310
|
+
TextByFunctionPipeModule,
|
|
311
|
+
],
|
|
312
|
+
exports: [SpecialAutocompleteComponent],
|
|
313
|
+
}]
|
|
314
|
+
}] });
|
|
315
|
+
|
|
316
|
+
class SpecialDatepickerComponent {
|
|
317
|
+
constructor() { }
|
|
318
|
+
get startAt() {
|
|
319
|
+
return this.control.settings?.startAt || new Date();
|
|
320
|
+
}
|
|
321
|
+
ngOnInit() { }
|
|
322
|
+
}
|
|
323
|
+
SpecialDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
324
|
+
SpecialDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialDatepickerComponent, selector: "sp-datepicker", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n [readonly]=\"control.readOnly\"\n [matDatepicker]=\"picker\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker startView=\"year\" [startAt]=\"startAt\">\n </mat-datepicker>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3$2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerComponent, decorators: [{
|
|
326
|
+
type: Component,
|
|
327
|
+
args: [{ selector: 'sp-datepicker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n [readonly]=\"control.readOnly\"\n [matDatepicker]=\"picker\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker startView=\"year\" [startAt]=\"startAt\">\n </mat-datepicker>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"] }]
|
|
328
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
329
|
+
type: Input
|
|
330
|
+
}] } });
|
|
331
|
+
|
|
332
|
+
class SpecialDatepickerModule {
|
|
333
|
+
}
|
|
334
|
+
SpecialDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
335
|
+
SpecialDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerModule, declarations: [SpecialDatepickerComponent], imports: [MatInputModule,
|
|
336
|
+
MatDatepickerModule,
|
|
337
|
+
CommonModule,
|
|
338
|
+
MatIconModule,
|
|
339
|
+
ReactiveFormsModule,
|
|
340
|
+
MatButtonModule,
|
|
341
|
+
ErrorMessagePipeModule,
|
|
342
|
+
MatNativeDateModule], exports: [SpecialDatepickerComponent] });
|
|
343
|
+
SpecialDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerModule, imports: [MatInputModule,
|
|
344
|
+
MatDatepickerModule,
|
|
345
|
+
CommonModule,
|
|
346
|
+
MatIconModule,
|
|
347
|
+
ReactiveFormsModule,
|
|
348
|
+
MatButtonModule,
|
|
349
|
+
ErrorMessagePipeModule,
|
|
350
|
+
MatNativeDateModule] });
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialDatepickerModule, decorators: [{
|
|
352
|
+
type: NgModule,
|
|
353
|
+
args: [{
|
|
354
|
+
declarations: [SpecialDatepickerComponent],
|
|
355
|
+
imports: [
|
|
356
|
+
MatInputModule,
|
|
357
|
+
MatDatepickerModule,
|
|
358
|
+
CommonModule,
|
|
359
|
+
MatIconModule,
|
|
360
|
+
ReactiveFormsModule,
|
|
361
|
+
MatButtonModule,
|
|
362
|
+
ErrorMessagePipeModule,
|
|
363
|
+
MatNativeDateModule
|
|
364
|
+
],
|
|
365
|
+
exports: [SpecialDatepickerComponent],
|
|
366
|
+
}]
|
|
367
|
+
}] });
|
|
368
|
+
|
|
369
|
+
class SpecialMultipleAutocompleteComponent {
|
|
370
|
+
constructor() {
|
|
371
|
+
this.subs = new Subscription();
|
|
372
|
+
this.internalControl = new FormControl();
|
|
373
|
+
this.configValue = (item) => {
|
|
374
|
+
if (!item)
|
|
375
|
+
return '';
|
|
376
|
+
const fieldName = this.control.settings.fieldName;
|
|
377
|
+
return fieldName instanceof Function ? fieldName(item) : item[fieldName];
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
ngOnInit() {
|
|
381
|
+
this.init();
|
|
382
|
+
}
|
|
383
|
+
get settings() {
|
|
384
|
+
return this.control.settings;
|
|
385
|
+
}
|
|
386
|
+
init() {
|
|
387
|
+
this.subs.add(this.internalControl.valueChanges
|
|
388
|
+
.pipe(debounceTime(500))
|
|
389
|
+
.subscribe((value) => {
|
|
390
|
+
if (typeof value === 'string') {
|
|
391
|
+
this.control.settings.getData(value, this.control);
|
|
392
|
+
}
|
|
393
|
+
}));
|
|
394
|
+
}
|
|
395
|
+
optionSelected(data) {
|
|
396
|
+
const newItem = data.option.value;
|
|
397
|
+
this.internalControl.reset();
|
|
398
|
+
this.control.setValue([
|
|
399
|
+
...(this.control.value || []).filter((item) => item[this.control.settings.fieldId] !==
|
|
400
|
+
newItem[this.control.settings.fieldId]),
|
|
401
|
+
newItem,
|
|
402
|
+
]);
|
|
403
|
+
if (this.settings.onSelect)
|
|
404
|
+
this.settings.onSelect(newItem);
|
|
405
|
+
}
|
|
406
|
+
iconClick(event) {
|
|
407
|
+
if (this.settings.iconAction) {
|
|
408
|
+
this.settings.iconAction(this.control.value);
|
|
409
|
+
event.stopPropagation();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
remove(value) {
|
|
413
|
+
let currentValues = Array.from(this.control.value);
|
|
414
|
+
const index = currentValues.indexOf(value);
|
|
415
|
+
if (index > -1) {
|
|
416
|
+
currentValues.splice(index, 1);
|
|
417
|
+
const value = currentValues;
|
|
418
|
+
this.control.markAsDirty();
|
|
419
|
+
this.control.setValue(value);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
ngOnDestroy() {
|
|
423
|
+
this.subs.unsubscribe();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
SpecialMultipleAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
427
|
+
SpecialMultipleAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialMultipleAutocompleteComponent, selector: "sp-multiple-autocomplete", inputs: { control: "control" }, ngImport: i0, template: "<div\r\n class=\"w-full {{ control.styleClasses }}\"\r\n *ngIf=\"control && !control.hidden\"\r\n>\r\n <mat-form-field\r\n class=\"w-full\"\r\n [id]=\"control.elementId\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n >\r\n <mat-label *ngIf=\"control.label\">\r\n {{ control.label }}\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n [required]=\"control.required && !control.value?.length\"\r\n [readonly]=\"control.readOnly\"\r\n [placeholder]=\"control.placeholder\"\r\n matInput\r\n [formControl]=\"internalControl\"\r\n [matAutocomplete]=\"auto\"\r\n />\r\n <mat-autocomplete\r\n class=\"autocomplete-options\"\r\n #auto=\"matAutocomplete\"\r\n [displayWith]=\"configValue\"\r\n (optionSelected)=\"optionSelected($event)\"\r\n >\r\n <mat-option\r\n *ngFor=\"let option of settings?.source | async\"\r\n [value]=\"option\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2 object-contain\"\r\n alt=\"\"\r\n [src]=\"option | textByFunction: settings.fieldImage\"\r\n />\r\n <span>\r\n {{ option | textByFunction: settings.fieldName }}\r\n </span>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-hint>{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n <mat-chip-list>\r\n <mat-chip\r\n class=\"chip-style\"\r\n *ngFor=\"let chip of control.value\"\r\n [removable]=\"true\"\r\n (removed)=\"remove(chip)\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2 object-contain\"\r\n alt=\"\"\r\n [src]=\"chip | textByFunction: settings.fieldImage\"\r\n />\r\n {{ chip | textByFunction: settings.fieldName }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </div>\r\n </mat-chip>\r\n </mat-chip-list>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9.MatChipList, selector: "mat-chip-list", inputs: ["role", "aria-describedby", "errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { kind: "directive", type: i9.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "role", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { kind: "directive", type: i9.MatChipRemove, selector: "[matChipRemove]" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteComponent, decorators: [{
|
|
429
|
+
type: Component,
|
|
430
|
+
args: [{ selector: 'sp-multiple-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n class=\"w-full {{ control.styleClasses }}\"\r\n *ngIf=\"control && !control.hidden\"\r\n>\r\n <mat-form-field\r\n class=\"w-full\"\r\n [id]=\"control.elementId\"\r\n [appearance]=\"control.label ? 'outline' : 'standard'\"\r\n >\r\n <mat-label *ngIf=\"control.label\">\r\n {{ control.label }}\r\n </mat-label>\r\n <input\r\n type=\"text\"\r\n autocomplete=\"off\"\r\n [required]=\"control.required && !control.value?.length\"\r\n [readonly]=\"control.readOnly\"\r\n [placeholder]=\"control.placeholder\"\r\n matInput\r\n [formControl]=\"internalControl\"\r\n [matAutocomplete]=\"auto\"\r\n />\r\n <mat-autocomplete\r\n class=\"autocomplete-options\"\r\n #auto=\"matAutocomplete\"\r\n [displayWith]=\"configValue\"\r\n (optionSelected)=\"optionSelected($event)\"\r\n >\r\n <mat-option\r\n *ngFor=\"let option of settings?.source | async\"\r\n [value]=\"option\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2 object-contain\"\r\n alt=\"\"\r\n [src]=\"option | textByFunction: settings.fieldImage\"\r\n />\r\n <span>\r\n {{ option | textByFunction: settings.fieldName }}\r\n </span>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }}</mat-icon>\r\n <button\r\n *ngIf=\"settings.icon\"\r\n mat-icon-button\r\n matSuffix\r\n (click)=\"iconClick($event)\"\r\n >\r\n <mat-icon>\r\n {{ settings.icon }}\r\n </mat-icon>\r\n </button>\r\n <mat-hint>{{ control.tooltip }}</mat-hint>\r\n <mat-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n <mat-chip-list>\r\n <mat-chip\r\n class=\"chip-style\"\r\n *ngFor=\"let chip of control.value\"\r\n [removable]=\"true\"\r\n (removed)=\"remove(chip)\"\r\n >\r\n <div class=\"flex items-center\">\r\n <img\r\n *ngIf=\"settings.fieldImage\"\r\n class=\"w-8 pr-2 object-contain\"\r\n alt=\"\"\r\n [src]=\"chip | textByFunction: settings.fieldImage\"\r\n />\r\n {{ chip | textByFunction: settings.fieldName }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </div>\r\n </mat-chip>\r\n </mat-chip-list>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
431
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
432
|
+
type: Input
|
|
433
|
+
}] } });
|
|
434
|
+
|
|
435
|
+
class SpecialMultipleAutocompleteModule {
|
|
436
|
+
}
|
|
437
|
+
SpecialMultipleAutocompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
438
|
+
SpecialMultipleAutocompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteModule, declarations: [SpecialMultipleAutocompleteComponent], imports: [MatInputModule,
|
|
439
|
+
CommonModule,
|
|
440
|
+
MatAutocompleteModule,
|
|
441
|
+
MatIconModule,
|
|
442
|
+
ReactiveFormsModule,
|
|
443
|
+
MatButtonModule,
|
|
444
|
+
ErrorMessagePipeModule,
|
|
445
|
+
TextByFunctionPipeModule,
|
|
446
|
+
MatChipsModule], exports: [SpecialMultipleAutocompleteComponent] });
|
|
447
|
+
SpecialMultipleAutocompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteModule, imports: [MatInputModule,
|
|
448
|
+
CommonModule,
|
|
449
|
+
MatAutocompleteModule,
|
|
450
|
+
MatIconModule,
|
|
451
|
+
ReactiveFormsModule,
|
|
452
|
+
MatButtonModule,
|
|
453
|
+
ErrorMessagePipeModule,
|
|
454
|
+
TextByFunctionPipeModule,
|
|
455
|
+
MatChipsModule] });
|
|
456
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialMultipleAutocompleteModule, decorators: [{
|
|
457
|
+
type: NgModule,
|
|
458
|
+
args: [{
|
|
459
|
+
declarations: [SpecialMultipleAutocompleteComponent],
|
|
460
|
+
imports: [
|
|
461
|
+
MatInputModule,
|
|
462
|
+
CommonModule,
|
|
463
|
+
MatAutocompleteModule,
|
|
464
|
+
MatIconModule,
|
|
465
|
+
ReactiveFormsModule,
|
|
466
|
+
MatButtonModule,
|
|
467
|
+
ErrorMessagePipeModule,
|
|
468
|
+
TextByFunctionPipeModule,
|
|
469
|
+
MatChipsModule,
|
|
470
|
+
],
|
|
471
|
+
exports: [SpecialMultipleAutocompleteComponent],
|
|
472
|
+
}]
|
|
473
|
+
}] });
|
|
474
|
+
|
|
475
|
+
class SpecialCheckboxComponent {
|
|
476
|
+
constructor() { }
|
|
477
|
+
ngOnInit() { }
|
|
478
|
+
}
|
|
479
|
+
SpecialCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
480
|
+
SpecialCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialCheckboxComponent, selector: "sp-checkbox", inputs: { control: "control" }, ngImport: i0, template: "<div\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full flex flex-col {{ control.styleClasses }}\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <mat-checkbox\n [ngModel]=\"control.value\"\n (ngModelChange)=\"control.setValue($event); control.markAsDirty()\"\n [indeterminate]=\"control.settings.indeterminate\"\n [labelPosition]=\"control.settings.labelPosition\"\n [disabled]=\"control.disabled\"\n >\n <mat-icon *ngIf=\"control.icon\" matSuffix>{{ control.icon }} </mat-icon>\n {{ control.placeholder }}\n </mat-checkbox>\n</div>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i2$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatSuffix, selector: "[matSuffix]" }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
481
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxComponent, decorators: [{
|
|
482
|
+
type: Component,
|
|
483
|
+
args: [{ selector: 'sp-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full flex flex-col {{ control.styleClasses }}\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <mat-checkbox\n [ngModel]=\"control.value\"\n (ngModelChange)=\"control.setValue($event); control.markAsDirty()\"\n [indeterminate]=\"control.settings.indeterminate\"\n [labelPosition]=\"control.settings.labelPosition\"\n [disabled]=\"control.disabled\"\n >\n <mat-icon *ngIf=\"control.icon\" matSuffix>{{ control.icon }} </mat-icon>\n {{ control.placeholder }}\n </mat-checkbox>\n</div>\n", styles: [":host{display:contents}\n"] }]
|
|
484
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
485
|
+
type: Input
|
|
486
|
+
}] } });
|
|
487
|
+
|
|
488
|
+
class SpecialCheckboxModule {
|
|
489
|
+
}
|
|
490
|
+
SpecialCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
491
|
+
SpecialCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxModule, declarations: [SpecialCheckboxComponent], imports: [FormsModule,
|
|
492
|
+
MatCheckboxModule,
|
|
493
|
+
CommonModule,
|
|
494
|
+
MatInputModule,
|
|
495
|
+
MatIconModule,
|
|
496
|
+
ReactiveFormsModule,
|
|
497
|
+
MatButtonModule,
|
|
498
|
+
ErrorMessagePipeModule], exports: [SpecialCheckboxComponent] });
|
|
499
|
+
SpecialCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxModule, imports: [FormsModule,
|
|
500
|
+
MatCheckboxModule,
|
|
501
|
+
CommonModule,
|
|
502
|
+
MatInputModule,
|
|
503
|
+
MatIconModule,
|
|
504
|
+
ReactiveFormsModule,
|
|
505
|
+
MatButtonModule,
|
|
506
|
+
ErrorMessagePipeModule] });
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialCheckboxModule, decorators: [{
|
|
508
|
+
type: NgModule,
|
|
509
|
+
args: [{
|
|
510
|
+
declarations: [SpecialCheckboxComponent],
|
|
511
|
+
imports: [
|
|
512
|
+
FormsModule,
|
|
513
|
+
MatCheckboxModule,
|
|
514
|
+
CommonModule,
|
|
515
|
+
MatInputModule,
|
|
516
|
+
MatIconModule,
|
|
517
|
+
ReactiveFormsModule,
|
|
518
|
+
MatButtonModule,
|
|
519
|
+
ErrorMessagePipeModule
|
|
520
|
+
],
|
|
521
|
+
exports: [SpecialCheckboxComponent],
|
|
522
|
+
}]
|
|
523
|
+
}] });
|
|
524
|
+
|
|
525
|
+
class SpecialTextAreaComponent {
|
|
526
|
+
constructor() {
|
|
527
|
+
this.onBlur = new EventEmitter();
|
|
528
|
+
this.onEnter = new EventEmitter();
|
|
529
|
+
}
|
|
530
|
+
ngOnInit() { }
|
|
531
|
+
}
|
|
532
|
+
SpecialTextAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
533
|
+
SpecialTextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialTextAreaComponent, selector: "sp-text-area", inputs: { control: "control" }, outputs: { onBlur: "onBlur", onEnter: "onEnter" }, ngImport: i0, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <textarea\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n cdkAutosizeMaxRows=\"5\"\n matInput\n (blur)=\"onBlur.emit(control.value)\"\n (keydown.enter)=\"onEnter.emit(control.value)\"\n [type]=\"control.settings?.type || 'text'\"\n [readonly]=\"control.readOnly\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n ></textarea>\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i1$1.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i1$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$1.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.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: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaComponent, decorators: [{
|
|
535
|
+
type: Component,
|
|
536
|
+
args: [{ selector: 'sp-text-area', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-form-field\n *ngIf=\"control\"\n [id]=\"control.elementId\"\n class=\"w-full {{ control.styleClasses }}\"\n [appearance]=\"control.label ? 'outline' : 'standard'\"\n>\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\n <textarea\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"1\"\n cdkAutosizeMaxRows=\"5\"\n matInput\n (blur)=\"onBlur.emit(control.value)\"\n (keydown.enter)=\"onEnter.emit(control.value)\"\n [type]=\"control.settings?.type || 'text'\"\n [readonly]=\"control.readOnly\"\n [required]=\"control.required\"\n [placeholder]=\"control.placeholder\"\n [formControl]=\"control\"\n ></textarea>\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\n <mat-hint>\n {{ control.tooltip }}\n </mat-hint>\n <mat-error>\n {{ control.errors | errorMessage: control.errorMessages }}\n </mat-error>\n</mat-form-field>\n", styles: [":host{display:contents}\n"] }]
|
|
537
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
538
|
+
type: Input
|
|
539
|
+
}], onBlur: [{
|
|
540
|
+
type: Output
|
|
541
|
+
}], onEnter: [{
|
|
542
|
+
type: Output
|
|
543
|
+
}] } });
|
|
544
|
+
|
|
545
|
+
class SpecialTextAreaModule {
|
|
546
|
+
}
|
|
547
|
+
SpecialTextAreaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
548
|
+
SpecialTextAreaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaModule, declarations: [SpecialTextAreaComponent], imports: [InputMaskModule,
|
|
549
|
+
CommonModule,
|
|
550
|
+
MatInputModule,
|
|
551
|
+
MatIconModule,
|
|
552
|
+
ReactiveFormsModule,
|
|
553
|
+
MatButtonModule,
|
|
554
|
+
ErrorMessagePipeModule], exports: [SpecialTextAreaComponent] });
|
|
555
|
+
SpecialTextAreaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaModule, imports: [InputMaskModule,
|
|
556
|
+
CommonModule,
|
|
557
|
+
MatInputModule,
|
|
558
|
+
MatIconModule,
|
|
559
|
+
ReactiveFormsModule,
|
|
560
|
+
MatButtonModule,
|
|
561
|
+
ErrorMessagePipeModule] });
|
|
562
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialTextAreaModule, decorators: [{
|
|
563
|
+
type: NgModule,
|
|
564
|
+
args: [{
|
|
565
|
+
declarations: [SpecialTextAreaComponent],
|
|
566
|
+
imports: [
|
|
567
|
+
InputMaskModule,
|
|
568
|
+
CommonModule,
|
|
569
|
+
MatInputModule,
|
|
570
|
+
MatIconModule,
|
|
571
|
+
ReactiveFormsModule,
|
|
572
|
+
MatButtonModule,
|
|
573
|
+
ErrorMessagePipeModule,
|
|
574
|
+
],
|
|
575
|
+
exports: [SpecialTextAreaComponent],
|
|
576
|
+
}]
|
|
577
|
+
}] });
|
|
578
|
+
|
|
579
|
+
class SpecialUploadComponent {
|
|
580
|
+
constructor(sanitizer) {
|
|
581
|
+
this.sanitizer = sanitizer;
|
|
582
|
+
this.onSelect = new EventEmitter();
|
|
583
|
+
this.previewImages = [];
|
|
584
|
+
}
|
|
585
|
+
set controlSetter(control) {
|
|
586
|
+
this.control = control;
|
|
587
|
+
this.previewImages = control.value;
|
|
588
|
+
}
|
|
589
|
+
ngOnInit() { }
|
|
590
|
+
onSelectMultiple(event) {
|
|
591
|
+
this.previewImages = [
|
|
592
|
+
...this.previewImages,
|
|
593
|
+
...event.addedFiles.map(file => ({
|
|
594
|
+
lastModified: file.lastModified,
|
|
595
|
+
url: this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file))
|
|
596
|
+
}))
|
|
597
|
+
];
|
|
598
|
+
this.control.setValue([
|
|
599
|
+
...this.control.value,
|
|
600
|
+
...event.addedFiles.map(this.fixFileName)
|
|
601
|
+
]);
|
|
602
|
+
this.onSelect.emit(this.control.value);
|
|
603
|
+
this.control.markAsDirty();
|
|
604
|
+
}
|
|
605
|
+
onSelectOne(event) {
|
|
606
|
+
this.previewImages = event.addedFiles.map(file => ({
|
|
607
|
+
lastModified: file.lastModified,
|
|
608
|
+
url: this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file))
|
|
609
|
+
}));
|
|
610
|
+
this.control.setValue(event.addedFiles.map(this.fixFileName));
|
|
611
|
+
this.onSelect.emit(this.control.value);
|
|
612
|
+
this.control.markAsDirty();
|
|
613
|
+
}
|
|
614
|
+
fixFileName(file) {
|
|
615
|
+
return Object.defineProperty(file, 'name', {
|
|
616
|
+
writable: true,
|
|
617
|
+
value: file.name.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
clean() {
|
|
621
|
+
this.previewImages = [];
|
|
622
|
+
}
|
|
623
|
+
onRemove(file) {
|
|
624
|
+
this.control.setValue(this.control.value.filter(fl => fl.lastModified !== file.lastModified));
|
|
625
|
+
this.previewImages = this.previewImages.filter(fl => fl.lastModified !== file.lastModified);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
SpecialUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadComponent, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
629
|
+
SpecialUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialUploadComponent, selector: "sp-upload", inputs: { controlSetter: ["control", "controlSetter"] }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<div class=\"special_upload mb-2\">\n <ngx-dropzone\n class=\"special_upload__dropzone\"\n [ngClass]=\"{\n 'special_upload--error-dashed':\n !!control.errors && (control.dirty || control.touched)\n }\"\n [multiple]=\"control.settings?.multiple\"\n [accept]=\"\n control.settings?.accept\n ? control.settings?.accept\n : 'image/png, .jpeg, .jpg, image/gif'\n \"\n (change)=\"\n control.settings?.multiple\n ? onSelectMultiple($event)\n : onSelectOne($event)\n \"\n >\n <ngx-dropzone-label\n [ngClass]=\"{\n 'special_upload--error':\n !!control.errors && (control.dirty || control.touched)\n }\"\n >\n <mat-icon class=\"special_upload__icon\"*ngIf=\"control.icon\">{{ control.icon }} </mat-icon>\n <h2 class=\"text-base font-bold\">\n {{ control.label }}\n </h2>\n <h3 class=\"text-base\">\n {{ control.placeholder }}\n </h3>\n </ngx-dropzone-label>\n <ngx-dropzone-preview\n *ngFor=\"let file of previewImages\"\n [removable]=\"true\"\n (removed)=\"onRemove(file)\"\n >\n <ngx-dropzone-label class=\"special_upload__card\">\n <img class=\"special_upload__card--image\" [src]=\"file?.url\" alt=\"\" />\n </ngx-dropzone-label>\n </ngx-dropzone-preview>\n </ngx-dropzone>\n <div\n class=\"special_upload--error mt-2\"\n *ngIf=\"!!control.errors && (control.dirty || control.touched)\"\n >\n {{ control.errors | errorMessage: control.errorMessages }}\n </div>\n</div>\n", styles: [":host{display:contents}:host .special-upload{margin-bottom:2rem}:host .special-upload__icon{height:64px;width:64px;font-size:64px}:host .special-upload__card{width:100%;height:100%;margin:0;box-sizing:border-box;display:flex;align-items:center;flex-direction:column}:host .special-upload__card--image{width:100%;height:100%;object-fit:cover}\n"], dependencies: [{ kind: "component", type: i2$3.NgxDropzoneComponent, selector: "ngx-dropzone, [ngx-dropzone]", inputs: ["accept", "disabled", "multiple", "maxFileSize", "expandable", "disableClick", "processDirectoryDrop", "id", "aria-label", "aria-labelledby", "aria-describedby"], outputs: ["change"] }, { kind: "directive", type: i2$3.NgxDropzoneLabelDirective, selector: "ngx-dropzone-label" }, { kind: "component", type: i2$3.NgxDropzonePreviewComponent, selector: "ngx-dropzone-preview", inputs: ["file", "removable"], outputs: ["removed"] }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
630
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadComponent, decorators: [{
|
|
631
|
+
type: Component,
|
|
632
|
+
args: [{ selector: 'sp-upload', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"special_upload mb-2\">\n <ngx-dropzone\n class=\"special_upload__dropzone\"\n [ngClass]=\"{\n 'special_upload--error-dashed':\n !!control.errors && (control.dirty || control.touched)\n }\"\n [multiple]=\"control.settings?.multiple\"\n [accept]=\"\n control.settings?.accept\n ? control.settings?.accept\n : 'image/png, .jpeg, .jpg, image/gif'\n \"\n (change)=\"\n control.settings?.multiple\n ? onSelectMultiple($event)\n : onSelectOne($event)\n \"\n >\n <ngx-dropzone-label\n [ngClass]=\"{\n 'special_upload--error':\n !!control.errors && (control.dirty || control.touched)\n }\"\n >\n <mat-icon class=\"special_upload__icon\"*ngIf=\"control.icon\">{{ control.icon }} </mat-icon>\n <h2 class=\"text-base font-bold\">\n {{ control.label }}\n </h2>\n <h3 class=\"text-base\">\n {{ control.placeholder }}\n </h3>\n </ngx-dropzone-label>\n <ngx-dropzone-preview\n *ngFor=\"let file of previewImages\"\n [removable]=\"true\"\n (removed)=\"onRemove(file)\"\n >\n <ngx-dropzone-label class=\"special_upload__card\">\n <img class=\"special_upload__card--image\" [src]=\"file?.url\" alt=\"\" />\n </ngx-dropzone-label>\n </ngx-dropzone-preview>\n </ngx-dropzone>\n <div\n class=\"special_upload--error mt-2\"\n *ngIf=\"!!control.errors && (control.dirty || control.touched)\"\n >\n {{ control.errors | errorMessage: control.errorMessages }}\n </div>\n</div>\n", styles: [":host{display:contents}:host .special-upload{margin-bottom:2rem}:host .special-upload__icon{height:64px;width:64px;font-size:64px}:host .special-upload__card{width:100%;height:100%;margin:0;box-sizing:border-box;display:flex;align-items:center;flex-direction:column}:host .special-upload__card--image{width:100%;height:100%;object-fit:cover}\n"] }]
|
|
633
|
+
}], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }]; }, propDecorators: { controlSetter: [{
|
|
634
|
+
type: Input,
|
|
635
|
+
args: ['control']
|
|
636
|
+
}], onSelect: [{
|
|
637
|
+
type: Output
|
|
638
|
+
}] } });
|
|
639
|
+
|
|
640
|
+
class SpecialUploadModule {
|
|
641
|
+
}
|
|
642
|
+
SpecialUploadModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
643
|
+
SpecialUploadModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadModule, declarations: [SpecialUploadComponent], imports: [FormsModule,
|
|
644
|
+
NgxDropzoneModule,
|
|
645
|
+
CommonModule,
|
|
646
|
+
MatIconModule,
|
|
647
|
+
ReactiveFormsModule,
|
|
648
|
+
MatButtonModule,
|
|
649
|
+
ErrorMessagePipeModule], exports: [SpecialUploadComponent] });
|
|
650
|
+
SpecialUploadModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadModule, imports: [FormsModule,
|
|
651
|
+
NgxDropzoneModule,
|
|
652
|
+
CommonModule,
|
|
653
|
+
MatIconModule,
|
|
654
|
+
ReactiveFormsModule,
|
|
655
|
+
MatButtonModule,
|
|
656
|
+
ErrorMessagePipeModule] });
|
|
657
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialUploadModule, decorators: [{
|
|
658
|
+
type: NgModule,
|
|
659
|
+
args: [{
|
|
660
|
+
declarations: [SpecialUploadComponent],
|
|
661
|
+
imports: [
|
|
662
|
+
FormsModule,
|
|
663
|
+
NgxDropzoneModule,
|
|
664
|
+
CommonModule,
|
|
665
|
+
MatIconModule,
|
|
666
|
+
ReactiveFormsModule,
|
|
667
|
+
MatButtonModule,
|
|
668
|
+
ErrorMessagePipeModule
|
|
669
|
+
],
|
|
670
|
+
exports: [SpecialUploadComponent],
|
|
671
|
+
}]
|
|
672
|
+
}] });
|
|
673
|
+
|
|
674
|
+
class SpecialLabelComponent {
|
|
675
|
+
constructor() { }
|
|
676
|
+
ngOnInit() { }
|
|
677
|
+
get settings() {
|
|
678
|
+
return this.control.settings || { isLink: false };
|
|
679
|
+
}
|
|
680
|
+
onLink() {
|
|
681
|
+
if (this.settings.isLink && this.settings.onClickLink) {
|
|
682
|
+
this.settings.onClickLink(this.control.value);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
SpecialLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
687
|
+
SpecialLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialLabelComponent, selector: "sp-label", inputs: { control: "control" }, ngImport: i0, template: "<div class=\"px-2 {{control.styleClasses}} {{ control.value | textByFunction: settings.stylesPipe}}\">\n <div *ngIf=\"!!control.label\" class=\"font-bold\">{{control.label}}</div>\n <div [ngClass]=\"{'cursor-pointer text-blue-600 hover:text-blue-700':settings.isLink }\" (click)=\"onLink()\">\n {{ control.value | textByFunction: control.settings.pipe}}\n </div>\n</div>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
688
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelComponent, decorators: [{
|
|
689
|
+
type: Component,
|
|
690
|
+
args: [{ selector: 'sp-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"px-2 {{control.styleClasses}} {{ control.value | textByFunction: settings.stylesPipe}}\">\n <div *ngIf=\"!!control.label\" class=\"font-bold\">{{control.label}}</div>\n <div [ngClass]=\"{'cursor-pointer text-blue-600 hover:text-blue-700':settings.isLink }\" (click)=\"onLink()\">\n {{ control.value | textByFunction: control.settings.pipe}}\n </div>\n</div>\n", styles: [":host{display:contents}\n"] }]
|
|
691
|
+
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
692
|
+
type: Input
|
|
693
|
+
}] } });
|
|
694
|
+
|
|
695
|
+
class SpecialLabelModule {
|
|
696
|
+
}
|
|
697
|
+
SpecialLabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
698
|
+
SpecialLabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelModule, declarations: [SpecialLabelComponent], imports: [InputMaskModule,
|
|
699
|
+
CommonModule,
|
|
700
|
+
MatInputModule,
|
|
701
|
+
MatIconModule,
|
|
702
|
+
ReactiveFormsModule,
|
|
703
|
+
MatButtonModule,
|
|
704
|
+
TextByFunctionPipeModule,
|
|
705
|
+
ErrorMessagePipeModule], exports: [SpecialLabelComponent] });
|
|
706
|
+
SpecialLabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelModule, imports: [InputMaskModule,
|
|
707
|
+
CommonModule,
|
|
708
|
+
MatInputModule,
|
|
709
|
+
MatIconModule,
|
|
710
|
+
ReactiveFormsModule,
|
|
711
|
+
MatButtonModule,
|
|
712
|
+
TextByFunctionPipeModule,
|
|
713
|
+
ErrorMessagePipeModule] });
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialLabelModule, decorators: [{
|
|
715
|
+
type: NgModule,
|
|
716
|
+
args: [{
|
|
717
|
+
declarations: [SpecialLabelComponent],
|
|
718
|
+
imports: [
|
|
719
|
+
InputMaskModule,
|
|
720
|
+
CommonModule,
|
|
721
|
+
MatInputModule,
|
|
722
|
+
MatIconModule,
|
|
723
|
+
ReactiveFormsModule,
|
|
724
|
+
MatButtonModule,
|
|
725
|
+
TextByFunctionPipeModule,
|
|
726
|
+
ErrorMessagePipeModule
|
|
727
|
+
],
|
|
728
|
+
exports: [SpecialLabelComponent],
|
|
729
|
+
}]
|
|
730
|
+
}] });
|
|
731
|
+
|
|
732
|
+
class FormControlsListPipe {
|
|
733
|
+
transform(controls) {
|
|
734
|
+
if (!controls)
|
|
735
|
+
return [];
|
|
736
|
+
return Object.values(controls)
|
|
737
|
+
.filter((control) => !control.hidden)
|
|
738
|
+
.map((control) => control);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
FormControlsListPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
742
|
+
FormControlsListPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipe, name: "controlsList" });
|
|
743
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipe, decorators: [{
|
|
744
|
+
type: Pipe,
|
|
745
|
+
args: [{ name: 'controlsList' }]
|
|
746
|
+
}] });
|
|
747
|
+
|
|
748
|
+
class SpecialFormComponent {
|
|
749
|
+
set control(form) {
|
|
750
|
+
this.form = form;
|
|
751
|
+
}
|
|
752
|
+
ngOnInit() { }
|
|
753
|
+
}
|
|
754
|
+
SpecialFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
755
|
+
SpecialFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialFormComponent, selector: "sp-form", inputs: { form: ["control", "form"] }, ngImport: i0, template: "<div class=\"w-full box-border p-2\">\n <div\n *ngIf=\"form\"\n [class]=\"\n form.label\n ? 'w-full mt-2 p-3 border-slate-200 border border-solid box-border'\n : 'container'\n \"\n >\n <h1 *ngIf=\"!!form.label\" class=\"font-bold py-3\">{{ form.label }}</h1>\n <div class=\"w-full flex flex-wrap\">\n <ng-template\n *ngFor=\"let control of form.controls | controlsList\"\n controlRender\n [control]=\"control\"\n ></ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i3.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return FormControlsRenderDirective; }), selector: "[controlRender]", inputs: ["control"] }, { kind: "pipe", type: i0.forwardRef(function () { return FormControlsListPipe; }), name: "controlsList" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormComponent, decorators: [{
|
|
757
|
+
type: Component,
|
|
758
|
+
args: [{ selector: 'sp-form', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"w-full box-border p-2\">\n <div\n *ngIf=\"form\"\n [class]=\"\n form.label\n ? 'w-full mt-2 p-3 border-slate-200 border border-solid box-border'\n : 'container'\n \"\n >\n <h1 *ngIf=\"!!form.label\" class=\"font-bold py-3\">{{ form.label }}</h1>\n <div class=\"w-full flex flex-wrap\">\n <ng-template\n *ngFor=\"let control of form.controls | controlsList\"\n controlRender\n [control]=\"control\"\n ></ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:contents}\n"] }]
|
|
759
|
+
}], propDecorators: { form: [{
|
|
760
|
+
type: Input,
|
|
761
|
+
args: ['control']
|
|
762
|
+
}] } });
|
|
763
|
+
class SpecialArrayComponent {
|
|
764
|
+
constructor() { }
|
|
765
|
+
set control(formArray) {
|
|
766
|
+
this.formArray = formArray;
|
|
767
|
+
}
|
|
768
|
+
get withFormHeader() {
|
|
769
|
+
return this.formArray.settings.withFormHeader;
|
|
770
|
+
}
|
|
771
|
+
get settings() {
|
|
772
|
+
return this.formArray.settings;
|
|
773
|
+
}
|
|
774
|
+
ngOnInit() { }
|
|
775
|
+
removeItem(index) {
|
|
776
|
+
this.formArray.removeAt(index);
|
|
777
|
+
}
|
|
778
|
+
addItem() {
|
|
779
|
+
this.formArray.addItem();
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
SpecialArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialArrayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
783
|
+
SpecialArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: SpecialArrayComponent, selector: "sp-array", inputs: { formArray: ["control", "formArray"] }, ngImport: i0, template: "<div class=\"w-full box-border p-2\">\r\n <div\r\n *ngIf=\"formArray\"\r\n class=\"w-full mt-2 p-3 border-slate-200 border border-solid box-border\"\r\n >\r\n <h1 *ngIf=\"!!formArray.label\" class=\"font-bold py-3\">\r\n {{ formArray.label }}\r\n </h1>\r\n <div class=\"divide-y divide-solid\">\r\n <div\r\n *ngIf=\"formArray.form\"\r\n [ngClass]=\"{ 'md:grid-cols-15': settings.withActionButtons }\"\r\n class=\"grid gap-4 grid-cols-12\"\r\n >\r\n <ng-container *ngIf=\"!withFormHeader; else FORMHEADERREF\">\r\n <h2\r\n [class]=\"item.styleClasses\"\r\n *ngFor=\"let item of formArray.form.controls | controlsList\"\r\n >\r\n {{ item.label }}\r\n </h2>\r\n <div\r\n *ngIf=\"settings.withActionButtons\"\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n ></div>\r\n </ng-container>\r\n <ng-template #FORMHEADERREF>\r\n <ng-template\r\n *ngFor=\"let item of formArray.form.controls | controlsList\"\r\n controlRender\r\n [control]=\"item\"\r\n ></ng-template>\r\n <div\r\n *ngIf=\"settings.withActionButtons\"\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n >\r\n <button\r\n mat-flat-button\r\n color=\"primary\"\r\n [disabled]=\"formArray.form.invalid\"\r\n (click)=\"addItem()\"\r\n >\r\n Add\r\n </button>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div\r\n class=\"w-full pt-5 grid gap-4 grid-cols-12 md:grid-cols-15\"\r\n *ngFor=\"let formGroup of formArray.controls; let i = index\"\r\n >\r\n <ng-template\r\n *ngFor=\"let item of formGroup.controls | controlsList\"\r\n controlRender\r\n [control]=\"item\"\r\n ></ng-template>\r\n <div\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n >\r\n <button mat-flat-button color=\"warn\" (click)=\"removeItem(i)\">\r\n Remove\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- <table class=\"form-array-container__table\">\r\n <thead *ngIf=\"formArray.form\">\r\n <tr\r\n *ngIf=\"headerForm; else HEADERFORMREF\"\r\n class=\"form-array-container__table-header\"\r\n >\r\n <th\r\n class=\"header-cell\"\r\n *ngFor=\"let control of formArray.form | controlsList\"\r\n >\r\n {{ control.label | translate }}\r\n </th>\r\n <th *ngIf=\"!formArray.readOnly\"></th>\r\n </tr>\r\n <ng-template #HEADERFORMREF>\r\n <tr class=\"table-form-header\">\r\n <th\r\n class=\"header-cell\"\r\n [ngSwitch]=\"control.type\"\r\n *ngFor=\"let control of formArray.form | controlsList\"\r\n >\r\n <sp-form-control-selector\r\n [control]=\"control\"\r\n ></sp-form-control-selector>\r\n </th>\r\n <th class=\"header-cell\" *ngIf=\"!formArray.readOnly\">\r\n <ng-container *ngTemplateOutlet=\"ADDBUTTON\"></ng-container>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n </thead> -->\r\n\r\n<!-- [ngStyle]=\"{'max-height':'calc(100vh - '+maxHeight+'px)' }\"> -->\r\n<!-- <tbody>\r\n <tr *ngFor=\"let formGroup of formArray.controls; let i = index\">\r\n <td [ngSwitch]=\"control.type\" *ngFor=\"let control of formGroup.controls | controlsList\">\r\n <sp-form-control-selector\r\n [control]=\"control\"\r\n ></sp-form-control-selector>\r\n </td>\r\n <td *ngIf=\"!formArray.readOnly\">\r\n <bmb-button\r\n [icon]=\"'delete_outline'\"\r\n [type]=\"'Raised'\"\r\n [size]=\"'XLarge'\"\r\n [bdrColor]=\"'error-500'\"\r\n [tColor]=\"'error-500'\"\r\n (onClick)=\"deleteItem(i)\"\r\n >\r\n </bmb-button>\r\n </td>\r\n </tr>\r\n </tbody> -->\r\n<!-- </table> -->\r\n\r\n<!-- <ng-template #TABLET>\r\n <div class=\"mt-1\">\r\n <ng-container *ngIf=\"headerFormEnable\">\r\n <div class=\"card-form-container\">\r\n <automatic-forms [form]=\"formArray.form\" [enableButtons]=\"false\">\r\n </automatic-forms>\r\n <ng-container *ngTemplateOutlet=\"ADDBUTTON\"></ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-content select=\"[header]\"></ng-content>\r\n </div>\r\n <div class=\"accordion-container\">\r\n <mat-accordion>\r\n <mat-expansion-panel\r\n class=\"mat-elevation-z1\"\r\n *ngFor=\"let item of formArray.controls; let i = index\"\r\n >\r\n <mat-expansion-panel-header\r\n class=\"expanded-header\"\r\n collapsedHeight=\"3rem\"\r\n expandedHeight=\"3rem\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"cardHeaderTemplate; context: { $implicit: item }\"\r\n >\r\n </ng-container>\r\n <mat-icon\r\n *ngIf=\"!formArray.readOnly\"\r\n class=\"mobile-delete\"\r\n (click)=\"deleteItem(i)\"\r\n color=\"warn\"\r\n >\r\n delete_outline\r\n </mat-icon>\r\n </mat-expansion-panel-header>\r\n <ng-container\r\n *ngTemplateOutlet=\"cardBodyTemplate; context: { $implicit: item }\"\r\n >\r\n </ng-container>\r\n </mat-expansion-panel>\r\n </mat-accordion>\r\n </div>\r\n</ng-template>\r\n\r\n<div class=\"text-error\" *ngIf=\"formArray.dirty && formArray.invalid\">\r\n {{ formArray.errors | errorMessage | translate }}\r\n</div>\r\n\r\n<ng-template #ADDBUTTON>\r\n <div class=\"add-item-btn\">\r\n <bmb-button\r\n [icon]=\"'add'\"\r\n [type]=\"'Raised'\"\r\n [bdrColor]=\"'aux-success'\"\r\n [size]=\"'XLarge'\"\r\n [tColor]=\"'aux-success'\"\r\n [disabled]=\"!formArray.form.valid || !formArray.form.dirty\"\r\n (onClick)=\"addItemAction()\"\r\n >\r\n </bmb-button>\r\n </div>\r\n</ng-template> -->\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i3.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(function () { return i7$1.MatButton; }), selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i0.forwardRef(function () { return FormControlsRenderDirective; }), selector: "[controlRender]", inputs: ["control"] }, { kind: "pipe", type: i0.forwardRef(function () { return FormControlsListPipe; }), name: "controlsList" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialArrayComponent, decorators: [{
|
|
785
|
+
type: Component,
|
|
786
|
+
args: [{ selector: 'sp-array', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"w-full box-border p-2\">\r\n <div\r\n *ngIf=\"formArray\"\r\n class=\"w-full mt-2 p-3 border-slate-200 border border-solid box-border\"\r\n >\r\n <h1 *ngIf=\"!!formArray.label\" class=\"font-bold py-3\">\r\n {{ formArray.label }}\r\n </h1>\r\n <div class=\"divide-y divide-solid\">\r\n <div\r\n *ngIf=\"formArray.form\"\r\n [ngClass]=\"{ 'md:grid-cols-15': settings.withActionButtons }\"\r\n class=\"grid gap-4 grid-cols-12\"\r\n >\r\n <ng-container *ngIf=\"!withFormHeader; else FORMHEADERREF\">\r\n <h2\r\n [class]=\"item.styleClasses\"\r\n *ngFor=\"let item of formArray.form.controls | controlsList\"\r\n >\r\n {{ item.label }}\r\n </h2>\r\n <div\r\n *ngIf=\"settings.withActionButtons\"\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n ></div>\r\n </ng-container>\r\n <ng-template #FORMHEADERREF>\r\n <ng-template\r\n *ngFor=\"let item of formArray.form.controls | controlsList\"\r\n controlRender\r\n [control]=\"item\"\r\n ></ng-template>\r\n <div\r\n *ngIf=\"settings.withActionButtons\"\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n >\r\n <button\r\n mat-flat-button\r\n color=\"primary\"\r\n [disabled]=\"formArray.form.invalid\"\r\n (click)=\"addItem()\"\r\n >\r\n Add\r\n </button>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div\r\n class=\"w-full pt-5 grid gap-4 grid-cols-12 md:grid-cols-15\"\r\n *ngFor=\"let formGroup of formArray.controls; let i = index\"\r\n >\r\n <ng-template\r\n *ngFor=\"let item of formGroup.controls | controlsList\"\r\n controlRender\r\n [control]=\"item\"\r\n ></ng-template>\r\n <div\r\n class=\"\r\n col-start-7 col-end-13\r\n md:col-start-13 md:col-end-16\r\n pb-5\r\n my-auto\r\n ml-auto\r\n md:m-auto\r\n \"\r\n >\r\n <button mat-flat-button color=\"warn\" (click)=\"removeItem(i)\">\r\n Remove\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- <table class=\"form-array-container__table\">\r\n <thead *ngIf=\"formArray.form\">\r\n <tr\r\n *ngIf=\"headerForm; else HEADERFORMREF\"\r\n class=\"form-array-container__table-header\"\r\n >\r\n <th\r\n class=\"header-cell\"\r\n *ngFor=\"let control of formArray.form | controlsList\"\r\n >\r\n {{ control.label | translate }}\r\n </th>\r\n <th *ngIf=\"!formArray.readOnly\"></th>\r\n </tr>\r\n <ng-template #HEADERFORMREF>\r\n <tr class=\"table-form-header\">\r\n <th\r\n class=\"header-cell\"\r\n [ngSwitch]=\"control.type\"\r\n *ngFor=\"let control of formArray.form | controlsList\"\r\n >\r\n <sp-form-control-selector\r\n [control]=\"control\"\r\n ></sp-form-control-selector>\r\n </th>\r\n <th class=\"header-cell\" *ngIf=\"!formArray.readOnly\">\r\n <ng-container *ngTemplateOutlet=\"ADDBUTTON\"></ng-container>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n </thead> -->\r\n\r\n<!-- [ngStyle]=\"{'max-height':'calc(100vh - '+maxHeight+'px)' }\"> -->\r\n<!-- <tbody>\r\n <tr *ngFor=\"let formGroup of formArray.controls; let i = index\">\r\n <td [ngSwitch]=\"control.type\" *ngFor=\"let control of formGroup.controls | controlsList\">\r\n <sp-form-control-selector\r\n [control]=\"control\"\r\n ></sp-form-control-selector>\r\n </td>\r\n <td *ngIf=\"!formArray.readOnly\">\r\n <bmb-button\r\n [icon]=\"'delete_outline'\"\r\n [type]=\"'Raised'\"\r\n [size]=\"'XLarge'\"\r\n [bdrColor]=\"'error-500'\"\r\n [tColor]=\"'error-500'\"\r\n (onClick)=\"deleteItem(i)\"\r\n >\r\n </bmb-button>\r\n </td>\r\n </tr>\r\n </tbody> -->\r\n<!-- </table> -->\r\n\r\n<!-- <ng-template #TABLET>\r\n <div class=\"mt-1\">\r\n <ng-container *ngIf=\"headerFormEnable\">\r\n <div class=\"card-form-container\">\r\n <automatic-forms [form]=\"formArray.form\" [enableButtons]=\"false\">\r\n </automatic-forms>\r\n <ng-container *ngTemplateOutlet=\"ADDBUTTON\"></ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-content select=\"[header]\"></ng-content>\r\n </div>\r\n <div class=\"accordion-container\">\r\n <mat-accordion>\r\n <mat-expansion-panel\r\n class=\"mat-elevation-z1\"\r\n *ngFor=\"let item of formArray.controls; let i = index\"\r\n >\r\n <mat-expansion-panel-header\r\n class=\"expanded-header\"\r\n collapsedHeight=\"3rem\"\r\n expandedHeight=\"3rem\"\r\n >\r\n <ng-container\r\n *ngTemplateOutlet=\"cardHeaderTemplate; context: { $implicit: item }\"\r\n >\r\n </ng-container>\r\n <mat-icon\r\n *ngIf=\"!formArray.readOnly\"\r\n class=\"mobile-delete\"\r\n (click)=\"deleteItem(i)\"\r\n color=\"warn\"\r\n >\r\n delete_outline\r\n </mat-icon>\r\n </mat-expansion-panel-header>\r\n <ng-container\r\n *ngTemplateOutlet=\"cardBodyTemplate; context: { $implicit: item }\"\r\n >\r\n </ng-container>\r\n </mat-expansion-panel>\r\n </mat-accordion>\r\n </div>\r\n</ng-template>\r\n\r\n<div class=\"text-error\" *ngIf=\"formArray.dirty && formArray.invalid\">\r\n {{ formArray.errors | errorMessage | translate }}\r\n</div>\r\n\r\n<ng-template #ADDBUTTON>\r\n <div class=\"add-item-btn\">\r\n <bmb-button\r\n [icon]=\"'add'\"\r\n [type]=\"'Raised'\"\r\n [bdrColor]=\"'aux-success'\"\r\n [size]=\"'XLarge'\"\r\n [tColor]=\"'aux-success'\"\r\n [disabled]=\"!formArray.form.valid || !formArray.form.dirty\"\r\n (onClick)=\"addItemAction()\"\r\n >\r\n </bmb-button>\r\n </div>\r\n</ng-template> -->\r\n", styles: [":host{display:contents}\n"] }]
|
|
787
|
+
}], ctorParameters: function () { return []; }, propDecorators: { formArray: [{
|
|
788
|
+
type: Input,
|
|
789
|
+
args: ['control']
|
|
790
|
+
}] } });
|
|
791
|
+
class FormControlsRenderDirective {
|
|
792
|
+
constructor(viewContainer) {
|
|
793
|
+
this.viewContainer = viewContainer;
|
|
794
|
+
this.componentsBuffer = {
|
|
795
|
+
[EControlTypes$1.autocomplete]: SpecialAutocompleteComponent,
|
|
796
|
+
[EControlTypes$1.checkbox]: SpecialCheckboxComponent,
|
|
797
|
+
[EControlTypes$1.date]: SpecialDatepickerComponent,
|
|
798
|
+
[EControlTypes$1.dropdown]: SpecialDropdownComponent,
|
|
799
|
+
[EControlTypes$1.array]: SpecialArrayComponent,
|
|
800
|
+
[EControlTypes$1.input]: SpecialInputComponent,
|
|
801
|
+
[EControlTypes$1.multiple]: SpecialMultipleAutocompleteComponent,
|
|
802
|
+
[EControlTypes$1.textArea]: SpecialTextAreaComponent,
|
|
803
|
+
[EControlTypes$1.label]: SpecialLabelComponent,
|
|
804
|
+
[EControlTypes$1.upload]: SpecialUploadComponent,
|
|
805
|
+
[EControlTypes$1.form]: SpecialFormComponent,
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
set controlSetter(control) {
|
|
809
|
+
this.viewContainer.clear();
|
|
810
|
+
const component = this.componentsBuffer[control.type];
|
|
811
|
+
if (component) {
|
|
812
|
+
const componentRef = this.viewContainer.createComponent(component);
|
|
813
|
+
componentRef.instance.control = control;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
FormControlsRenderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsRenderDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
818
|
+
FormControlsRenderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.3", type: FormControlsRenderDirective, selector: "[controlRender]", inputs: { controlSetter: ["control", "controlSetter"] }, ngImport: i0 });
|
|
819
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsRenderDirective, decorators: [{
|
|
820
|
+
type: Directive,
|
|
821
|
+
args: [{
|
|
822
|
+
selector: `[controlRender]`,
|
|
823
|
+
}]
|
|
824
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { controlSetter: [{
|
|
825
|
+
type: Input,
|
|
826
|
+
args: ['control']
|
|
827
|
+
}] } });
|
|
828
|
+
|
|
829
|
+
class FormControlsListPipeModule {
|
|
830
|
+
}
|
|
831
|
+
FormControlsListPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
832
|
+
FormControlsListPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipeModule, declarations: [FormControlsListPipe], imports: [CommonModule], exports: [FormControlsListPipe] });
|
|
833
|
+
FormControlsListPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipeModule, imports: [CommonModule] });
|
|
834
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormControlsListPipeModule, decorators: [{
|
|
835
|
+
type: NgModule,
|
|
836
|
+
args: [{
|
|
837
|
+
declarations: [FormControlsListPipe],
|
|
838
|
+
imports: [CommonModule],
|
|
839
|
+
exports: [FormControlsListPipe],
|
|
840
|
+
}]
|
|
841
|
+
}] });
|
|
842
|
+
|
|
843
|
+
class SpecialFormModule {
|
|
844
|
+
}
|
|
845
|
+
SpecialFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
846
|
+
SpecialFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormModule, declarations: [SpecialArrayComponent,
|
|
847
|
+
FormControlsRenderDirective,
|
|
848
|
+
SpecialFormComponent], imports: [CommonModule,
|
|
849
|
+
FormControlsListPipeModule,
|
|
850
|
+
MatButtonModule,
|
|
851
|
+
SpecialDropdownModule,
|
|
852
|
+
SpecialInputModule,
|
|
853
|
+
SpecialAutocompleteModule,
|
|
854
|
+
SpecialDatepickerModule,
|
|
855
|
+
SpecialLabelModule,
|
|
856
|
+
SpecialMultipleAutocompleteModule,
|
|
857
|
+
SpecialCheckboxModule,
|
|
858
|
+
SpecialTextAreaModule,
|
|
859
|
+
SpecialUploadModule], exports: [SpecialArrayComponent,
|
|
860
|
+
FormControlsRenderDirective,
|
|
861
|
+
SpecialFormComponent] });
|
|
862
|
+
SpecialFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormModule, imports: [CommonModule,
|
|
863
|
+
FormControlsListPipeModule,
|
|
864
|
+
MatButtonModule,
|
|
865
|
+
SpecialDropdownModule,
|
|
866
|
+
SpecialInputModule,
|
|
867
|
+
SpecialAutocompleteModule,
|
|
868
|
+
SpecialDatepickerModule,
|
|
869
|
+
SpecialLabelModule,
|
|
870
|
+
SpecialMultipleAutocompleteModule,
|
|
871
|
+
SpecialCheckboxModule,
|
|
872
|
+
SpecialTextAreaModule,
|
|
873
|
+
SpecialUploadModule] });
|
|
874
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormModule, decorators: [{
|
|
875
|
+
type: NgModule,
|
|
876
|
+
args: [{
|
|
877
|
+
declarations: [
|
|
878
|
+
SpecialArrayComponent,
|
|
879
|
+
FormControlsRenderDirective,
|
|
880
|
+
SpecialFormComponent,
|
|
881
|
+
],
|
|
882
|
+
imports: [
|
|
883
|
+
CommonModule,
|
|
884
|
+
FormControlsListPipeModule,
|
|
885
|
+
MatButtonModule,
|
|
886
|
+
SpecialDropdownModule,
|
|
887
|
+
SpecialInputModule,
|
|
888
|
+
SpecialAutocompleteModule,
|
|
889
|
+
SpecialDatepickerModule,
|
|
890
|
+
SpecialLabelModule,
|
|
891
|
+
SpecialMultipleAutocompleteModule,
|
|
892
|
+
SpecialCheckboxModule,
|
|
893
|
+
SpecialTextAreaModule,
|
|
894
|
+
SpecialUploadModule,
|
|
895
|
+
],
|
|
896
|
+
exports: [
|
|
897
|
+
SpecialArrayComponent,
|
|
898
|
+
FormControlsRenderDirective,
|
|
899
|
+
SpecialFormComponent,
|
|
900
|
+
],
|
|
901
|
+
}]
|
|
902
|
+
}] });
|
|
903
|
+
|
|
904
|
+
var EControlTypes;
|
|
905
|
+
(function (EControlTypes) {
|
|
906
|
+
EControlTypes["pkey"] = "PRIMARY-KEY";
|
|
907
|
+
EControlTypes["input"] = "INPUT";
|
|
908
|
+
EControlTypes["textArea"] = "TEXT-AREA";
|
|
909
|
+
EControlTypes["dropdown"] = "DROPDOWN";
|
|
910
|
+
EControlTypes["date"] = "DATE";
|
|
911
|
+
EControlTypes["time"] = "TIME";
|
|
912
|
+
EControlTypes["checkbox"] = "CHECKBOX";
|
|
913
|
+
EControlTypes["upload"] = "UPLOAD";
|
|
914
|
+
EControlTypes["autocomplete"] = "AUTOCOMPLETE";
|
|
915
|
+
EControlTypes["multiple"] = "MULTIPLE-AUTOCOMPLETE";
|
|
916
|
+
EControlTypes["array"] = "ARRAY";
|
|
917
|
+
EControlTypes["form"] = "FORM";
|
|
918
|
+
EControlTypes["label"] = "LABEL";
|
|
919
|
+
EControlTypes["default"] = "DEFAULT";
|
|
920
|
+
})(EControlTypes || (EControlTypes = {}));
|
|
921
|
+
|
|
922
|
+
class SpecialFormControl extends FormControl {
|
|
923
|
+
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, length, placeholder, readOnly, required, tooltip, errorMessages, disabled, }) {
|
|
924
|
+
super(defaultValue, validators, asyncValidators);
|
|
925
|
+
this.name = name;
|
|
926
|
+
this.placeholder = placeholder;
|
|
927
|
+
this.label = label;
|
|
928
|
+
this.tooltip = tooltip;
|
|
929
|
+
this.icon = icon;
|
|
930
|
+
this.elementId = elementId;
|
|
931
|
+
this.settings = settings;
|
|
932
|
+
this.type = type;
|
|
933
|
+
this.styleClasses = styleClasses;
|
|
934
|
+
this.hidden = hidden;
|
|
935
|
+
this.length = length;
|
|
936
|
+
this.readOnly = readOnly;
|
|
937
|
+
this.required = required;
|
|
938
|
+
this.errorMessages = errorMessages;
|
|
939
|
+
disabled ? this.disable() : this.enable();
|
|
940
|
+
}
|
|
941
|
+
setReadOnly(status = true) {
|
|
942
|
+
this.readOnly = status;
|
|
943
|
+
}
|
|
944
|
+
setDisabled(status = true) {
|
|
945
|
+
status ? this.disable() : this.enable();
|
|
946
|
+
}
|
|
947
|
+
setHidden(status = true) {
|
|
948
|
+
this.hidden = status;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
class SpecialFormGroup extends FormGroup {
|
|
952
|
+
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, length, placeholder, readOnly, required, tooltip, disabled, }, controls) {
|
|
953
|
+
super(controls, validators, asyncValidators);
|
|
954
|
+
this.name = name;
|
|
955
|
+
this.placeholder = placeholder;
|
|
956
|
+
this.label = label;
|
|
957
|
+
this.tooltip = tooltip;
|
|
958
|
+
this.icon = icon;
|
|
959
|
+
this.elementId = elementId;
|
|
960
|
+
this.settings = settings;
|
|
961
|
+
this.type = type;
|
|
962
|
+
this.styleClasses = styleClasses;
|
|
963
|
+
this.hidden = hidden;
|
|
964
|
+
this.length = length;
|
|
965
|
+
this.readOnly = readOnly;
|
|
966
|
+
this.required = required;
|
|
967
|
+
this.defaultValue = defaultValue;
|
|
968
|
+
disabled ? this.disable() : this.enable();
|
|
969
|
+
}
|
|
970
|
+
unpristineRequired() {
|
|
971
|
+
Object.values(this.controls).forEach((control) => {
|
|
972
|
+
if (control instanceof SpecialFormControl) {
|
|
973
|
+
control.markAsDirty();
|
|
974
|
+
}
|
|
975
|
+
else if (control instanceof SpecialFormGroup) {
|
|
976
|
+
control.unpristineRequired();
|
|
977
|
+
}
|
|
978
|
+
else if (control instanceof SpecialFormArray) {
|
|
979
|
+
control.unpristineRequired();
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
specialReset(value = {}) {
|
|
984
|
+
const aux = {};
|
|
985
|
+
Object.entries(this.controls).map(([key, control]) => {
|
|
986
|
+
if (control instanceof SpecialFormControl) {
|
|
987
|
+
aux[key] = control.defaultValue;
|
|
988
|
+
}
|
|
989
|
+
else if (control instanceof SpecialFormArray) {
|
|
990
|
+
control.clear();
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
this.reset({ ...aux, ...value });
|
|
994
|
+
}
|
|
995
|
+
setReadOnly(status = true) {
|
|
996
|
+
Object.values(this.controls).map((value) => {
|
|
997
|
+
if (value instanceof SpecialFormControl ||
|
|
998
|
+
value instanceof SpecialFormArray ||
|
|
999
|
+
value instanceof SpecialFormGroup) {
|
|
1000
|
+
value.setReadOnly(status);
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
setReadOnlyByFields(fieldsObject) {
|
|
1005
|
+
Object.entries(fieldsObject).map(([key, value]) => {
|
|
1006
|
+
const control = this.controls[key];
|
|
1007
|
+
if (control instanceof SpecialFormControl) {
|
|
1008
|
+
control.readOnly = value;
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
setHiddenByFields(fields) {
|
|
1013
|
+
Object.entries(fields).map(([key, value]) => {
|
|
1014
|
+
const control = this.controls[key];
|
|
1015
|
+
if (control instanceof SpecialFormControl) {
|
|
1016
|
+
control.hidden = value;
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
setDisabled(status) {
|
|
1021
|
+
Object.values(this.controls).map((value) => {
|
|
1022
|
+
if (value instanceof SpecialFormControl ||
|
|
1023
|
+
value instanceof SpecialFormArray ||
|
|
1024
|
+
value instanceof SpecialFormGroup) {
|
|
1025
|
+
value.setDisabled(status);
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
setDisabledByFields(fieldsObject) {
|
|
1030
|
+
Object.entries(fieldsObject).map((entries) => {
|
|
1031
|
+
if (this.controls[entries[0]] instanceof SpecialFormControl) {
|
|
1032
|
+
entries[1]
|
|
1033
|
+
? this.controls[entries[0]].enable()
|
|
1034
|
+
: this.controls[entries[0]].disable();
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* donde value es el objeto semilla y detailForm es un arreglo de form key para dar un marco al formarray
|
|
1040
|
+
*/
|
|
1041
|
+
setFormValue(value) {
|
|
1042
|
+
this.specialReset(value);
|
|
1043
|
+
Object.entries(this.controls)
|
|
1044
|
+
.filter(([_key, control]) => control instanceof SpecialFormArray)
|
|
1045
|
+
.map(([key, control]) => {
|
|
1046
|
+
control.fillFormArray(value[key]);
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Método que retorna
|
|
1051
|
+
*/
|
|
1052
|
+
getIdPkey() {
|
|
1053
|
+
return Object.values(this.controls).find((control) => control instanceof SpecialFormControl && control.type === 'PRIMARY-KEY');
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
class SpecialFormArray extends FormArray {
|
|
1057
|
+
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, placeholder, readOnly, required, tooltip, errorMessages, disabled, }, formCreation, controls) {
|
|
1058
|
+
super(controls, validators, asyncValidators);
|
|
1059
|
+
this.formCreation = formCreation;
|
|
1060
|
+
this.form = this.formCreation();
|
|
1061
|
+
this.name = name;
|
|
1062
|
+
this.placeholder = placeholder;
|
|
1063
|
+
this.label = label;
|
|
1064
|
+
this.tooltip = tooltip;
|
|
1065
|
+
this.icon = icon;
|
|
1066
|
+
this.elementId = elementId;
|
|
1067
|
+
this.settings = settings;
|
|
1068
|
+
this.type = type;
|
|
1069
|
+
this.styleClasses = styleClasses;
|
|
1070
|
+
this.hidden = hidden;
|
|
1071
|
+
this.readOnly = readOnly;
|
|
1072
|
+
this.required = required;
|
|
1073
|
+
this.defaultValue = defaultValue;
|
|
1074
|
+
this.errorMessages = errorMessages;
|
|
1075
|
+
disabled ? this.disable() : this.enable();
|
|
1076
|
+
}
|
|
1077
|
+
fillFormArray(data) {
|
|
1078
|
+
this.form.reset();
|
|
1079
|
+
this.clear();
|
|
1080
|
+
data.forEach((item) => {
|
|
1081
|
+
const form = this.formCreation(item);
|
|
1082
|
+
this.push(form);
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
addItem() {
|
|
1086
|
+
const form = this.formCreation(this.form.value);
|
|
1087
|
+
this.form.specialReset();
|
|
1088
|
+
this.push(form);
|
|
1089
|
+
this.markAsDirty();
|
|
1090
|
+
}
|
|
1091
|
+
specialPush(index) {
|
|
1092
|
+
const form = this.formCreation(this.form.value);
|
|
1093
|
+
if (!index)
|
|
1094
|
+
this.push(form);
|
|
1095
|
+
else
|
|
1096
|
+
this.controls[index].reset(this.form.value);
|
|
1097
|
+
}
|
|
1098
|
+
specialInsert(index = 0) {
|
|
1099
|
+
const form = this.formCreation(this.form.value);
|
|
1100
|
+
this.insert(index, form);
|
|
1101
|
+
}
|
|
1102
|
+
specialEdit(index, newValue) {
|
|
1103
|
+
this.controls[index].reset({ ...this.controls[index].value, ...newValue });
|
|
1104
|
+
this.markAsDirty();
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Vuelve todos los controles del formArray de lectura o de sololectura
|
|
1108
|
+
* @param status
|
|
1109
|
+
*/
|
|
1110
|
+
setReadOnly(status) {
|
|
1111
|
+
this.readOnly = status;
|
|
1112
|
+
this.controls.forEach((control) => {
|
|
1113
|
+
if (control instanceof SpecialFormGroup) {
|
|
1114
|
+
control.setReadOnly(status);
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Vuelve todos los controles del formArray habilitados o deshabilitados
|
|
1120
|
+
* @param status
|
|
1121
|
+
*/
|
|
1122
|
+
setDisabled(status) {
|
|
1123
|
+
status ? this.disable() : this.enable();
|
|
1124
|
+
this.controls.forEach((control) => {
|
|
1125
|
+
if (control instanceof SpecialFormGroup) {
|
|
1126
|
+
control.setDisabled(status);
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Permite editar un control especifico.
|
|
1132
|
+
* @param index
|
|
1133
|
+
*/
|
|
1134
|
+
editControl(index) {
|
|
1135
|
+
this.form.reset(this.controls[index].value);
|
|
1136
|
+
}
|
|
1137
|
+
unpristineRequired() {
|
|
1138
|
+
this.markAsDirty();
|
|
1139
|
+
this.controls.forEach((item) => {
|
|
1140
|
+
item.unpristineRequired();
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
recursiveFillForm(form, data) {
|
|
1144
|
+
Object.entries(form.controls).map(([key, control]) => {
|
|
1145
|
+
if (control instanceof FormControl) {
|
|
1146
|
+
control.setValue(data[key]);
|
|
1147
|
+
}
|
|
1148
|
+
else if (control instanceof FormArray) {
|
|
1149
|
+
data[key].forEach(() => { });
|
|
1150
|
+
}
|
|
1151
|
+
else if (control instanceof FormGroup) {
|
|
1152
|
+
control.reset(data[key]);
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
return form;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
class SpecialFormBuilderService {
|
|
1160
|
+
constructor() {
|
|
1161
|
+
this.defectField = {
|
|
1162
|
+
asyncValidators: null,
|
|
1163
|
+
validators: null,
|
|
1164
|
+
defaultValue: null,
|
|
1165
|
+
elementId: '',
|
|
1166
|
+
hidden: false,
|
|
1167
|
+
icon: '',
|
|
1168
|
+
label: '',
|
|
1169
|
+
disabled: false,
|
|
1170
|
+
length: 0,
|
|
1171
|
+
placeholder: '',
|
|
1172
|
+
readOnly: false,
|
|
1173
|
+
required: false,
|
|
1174
|
+
styleClasses: '',
|
|
1175
|
+
errorMessages: {},
|
|
1176
|
+
tooltip: '',
|
|
1177
|
+
};
|
|
1178
|
+
this.inputDefectField = {
|
|
1179
|
+
...this.defectField,
|
|
1180
|
+
settings: {},
|
|
1181
|
+
type: EControlTypes.input,
|
|
1182
|
+
name: '',
|
|
1183
|
+
};
|
|
1184
|
+
this.formDefectField = {
|
|
1185
|
+
...this.defectField,
|
|
1186
|
+
settings: {
|
|
1187
|
+
formFields: {},
|
|
1188
|
+
},
|
|
1189
|
+
type: EControlTypes.form,
|
|
1190
|
+
name: '',
|
|
1191
|
+
};
|
|
1192
|
+
this.arrayDefectField = {
|
|
1193
|
+
...this.defectField,
|
|
1194
|
+
settings: {
|
|
1195
|
+
formFields: {},
|
|
1196
|
+
},
|
|
1197
|
+
type: EControlTypes.array,
|
|
1198
|
+
name: '',
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
control(field) {
|
|
1202
|
+
const formField = {
|
|
1203
|
+
...this.inputDefectField,
|
|
1204
|
+
...field,
|
|
1205
|
+
};
|
|
1206
|
+
const { control } = this.setFormControl(formField);
|
|
1207
|
+
return control;
|
|
1208
|
+
}
|
|
1209
|
+
group(fields, parentField = {}) {
|
|
1210
|
+
return this.formGenerator(this.fieldDataToArray(fields), parentField);
|
|
1211
|
+
}
|
|
1212
|
+
array() { }
|
|
1213
|
+
fieldDataToArray(fields) {
|
|
1214
|
+
return Object.entries(fields).map(([name, field]) => this.setDefectFieldOptions(name, field));
|
|
1215
|
+
}
|
|
1216
|
+
setDefectFieldOptions(name, field) {
|
|
1217
|
+
return {
|
|
1218
|
+
...this.inputDefectField,
|
|
1219
|
+
...field,
|
|
1220
|
+
name,
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
formGenerator(fields, parentField = {}) {
|
|
1224
|
+
const formField = {
|
|
1225
|
+
...this.formDefectField,
|
|
1226
|
+
...parentField,
|
|
1227
|
+
};
|
|
1228
|
+
const structure = fields
|
|
1229
|
+
.map((field) => this.getControlAndNameByType(field))
|
|
1230
|
+
.reduce((prev, { name, control }) => ({
|
|
1231
|
+
...prev,
|
|
1232
|
+
[name]: control,
|
|
1233
|
+
}), {});
|
|
1234
|
+
return new SpecialFormGroup(formField, structure);
|
|
1235
|
+
}
|
|
1236
|
+
getControlAndNameByType(field) {
|
|
1237
|
+
switch (field.type) {
|
|
1238
|
+
case EControlTypes.array:
|
|
1239
|
+
return this.setFormArray(field);
|
|
1240
|
+
case EControlTypes.form:
|
|
1241
|
+
return this.setFormGroup(field);
|
|
1242
|
+
default:
|
|
1243
|
+
return this.setFormControl(field);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
setFormGroup(field) {
|
|
1247
|
+
const control = this.formGenerator(this.fieldDataToArray(field.settings.formFields), field);
|
|
1248
|
+
return { control, name: field.name };
|
|
1249
|
+
}
|
|
1250
|
+
setFormArray(field) {
|
|
1251
|
+
const auxForm = (value = {}) => {
|
|
1252
|
+
const auxForm = this.formGenerator(this.fieldDataToArray(field.settings.formFields), {});
|
|
1253
|
+
auxForm.reset(value);
|
|
1254
|
+
return auxForm;
|
|
1255
|
+
};
|
|
1256
|
+
if (field.required) {
|
|
1257
|
+
field.validators = this.setValidatorsArray(field.validators, [
|
|
1258
|
+
this.arrayLengthRequired,
|
|
1259
|
+
]);
|
|
1260
|
+
}
|
|
1261
|
+
return {
|
|
1262
|
+
name: field.name,
|
|
1263
|
+
control: new SpecialFormArray(field, auxForm, []),
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
setFormControl(field) {
|
|
1267
|
+
const validators = [];
|
|
1268
|
+
if (field.required)
|
|
1269
|
+
validators.push(this.setRequiredValidator(field));
|
|
1270
|
+
if (field.length)
|
|
1271
|
+
validators.push(Validators.maxLength(field.length));
|
|
1272
|
+
field.validators = this.setValidatorsArray(field.validators, validators);
|
|
1273
|
+
return {
|
|
1274
|
+
name: field.name,
|
|
1275
|
+
control: new SpecialFormControl(field),
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
setRequiredValidator(field) {
|
|
1279
|
+
if (field.type !== EControlTypes.autocomplete) {
|
|
1280
|
+
return Validators.required;
|
|
1281
|
+
}
|
|
1282
|
+
return (control) => !!control.value && control.value instanceof Object
|
|
1283
|
+
? null
|
|
1284
|
+
: { required: true };
|
|
1285
|
+
}
|
|
1286
|
+
setValidatorsArray(validators, newValidators) {
|
|
1287
|
+
if (!validators) {
|
|
1288
|
+
return newValidators;
|
|
1289
|
+
}
|
|
1290
|
+
return validators instanceof Array
|
|
1291
|
+
? [...validators, ...newValidators]
|
|
1292
|
+
: [validators, ...newValidators];
|
|
1293
|
+
}
|
|
1294
|
+
arrayLengthRequired(control) {
|
|
1295
|
+
if (control.value.length) {
|
|
1296
|
+
return {};
|
|
1297
|
+
}
|
|
1298
|
+
return { noItems: 'NO_SELECTED_ITEM' };
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
SpecialFormBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormBuilderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1302
|
+
SpecialFormBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormBuilderService, providedIn: 'root' });
|
|
1303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: SpecialFormBuilderService, decorators: [{
|
|
1304
|
+
type: Injectable,
|
|
1305
|
+
args: [{
|
|
1306
|
+
providedIn: 'root',
|
|
1307
|
+
}]
|
|
1308
|
+
}], ctorParameters: function () { return []; } });
|
|
1309
|
+
|
|
1310
|
+
/*
|
|
1311
|
+
* Public API Surface of special-forms
|
|
1312
|
+
*/
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Generated bundle index. Do not edit.
|
|
1316
|
+
*/
|
|
1317
|
+
|
|
1318
|
+
export { FormControlsRenderDirective, SpecialArrayComponent, SpecialAutocompleteComponent, SpecialAutocompleteModule, SpecialCheckboxComponent, SpecialCheckboxModule, SpecialDatepickerComponent, SpecialDatepickerModule, SpecialDropdownComponent, SpecialDropdownModule, SpecialFormBuilderService, SpecialFormComponent, SpecialFormModule, SpecialInputComponent, SpecialInputModule, SpecialLabelComponent, SpecialLabelModule, SpecialMultipleAutocompleteComponent, SpecialMultipleAutocompleteModule, SpecialTextAreaComponent, SpecialTextAreaModule, SpecialUploadComponent, SpecialUploadModule };
|
|
1319
|
+
//# sourceMappingURL=special-forms.mjs.map
|