special-forms 4.1.2 → 16.2.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/{esm2020 → esm2022}/lib/components/special-autocomplete/special-autocomplete.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-checkbox/special-checkbox.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-datepicker/special-datepicker.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-dropdown/special-dropdown.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-form/special-form.component.mjs +10 -10
- package/{esm2020 → esm2022}/lib/components/special-form/special-form.module.mjs +32 -32
- package/{esm2020 → esm2022}/lib/components/special-input/special-input.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-label/special-label.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.component.mjs +4 -4
- package/esm2022/lib/components/special-richtext/special-richtext.component.mjs +45 -0
- package/{esm2020 → esm2022}/lib/components/special-text-area/special-text-area.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/special-upload/special-upload.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/pipes/controls-list-pipe/controls-list.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/pipes/error-message-pipe/error.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/pipes/text-by-function/text-by-function.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/services/error-state-matcher/error-matcher.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/services/special-form-builder/special-form-builder.service.mjs +4 -4
- package/{fesm2020 → fesm2022}/special-forms.mjs +85 -85
- package/fesm2022/special-forms.mjs.map +1 -0
- package/lib/components/special-autocomplete/special-autocomplete.component.d.ts +1 -1
- package/lib/components/special-checkbox/special-checkbox.component.d.ts +1 -1
- package/lib/components/special-datepicker/special-datepicker.component.d.ts +1 -1
- package/lib/components/special-dropdown/special-dropdown.component.d.ts +1 -1
- package/lib/components/special-form/special-form.component.d.ts +3 -3
- package/lib/components/special-input/special-input.component.d.ts +1 -1
- package/lib/components/special-label/special-label.component.d.ts +1 -1
- package/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.component.d.ts +1 -1
- package/lib/components/special-richtext/special-richtext.component.d.ts +2 -3
- package/lib/components/special-text-area/special-text-area.component.d.ts +1 -1
- package/lib/components/special-upload/special-upload.component.d.ts +1 -1
- package/{src/lib/assets → lib/styles}/tailwind-final.scss +6 -0
- package/package.json +11 -16
- package/esm2020/lib/components/special-richtext/special-richtext.component.mjs +0 -46
- package/fesm2015/special-forms.mjs +0 -1083
- package/fesm2015/special-forms.mjs.map +0 -1
- package/fesm2020/special-forms.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/components/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-autocomplete/special-autocomplete.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-checkbox/special-checkbox.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-datepicker/special-datepicker.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-dropdown/special-dropdown.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-input/special-input.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-label/special-label.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-multiple-autocomplete/special-multiple-autocomplete.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-richtext/special-richtext.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-text-area/special-text-area.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/special-upload/special-upload.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/aux-data/control-types.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/aux-data/input-types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/forms/special-forms.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/interfaces/field-basics.interfaces.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/interfaces/form.interfaces.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/interfaces/special-control.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/masks/currency.mask.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/masks/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/masks/number.mask.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/pipes/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/services/index.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/special-forms.mjs +0 -0
- /package/{src/lib/assets → lib/styles}/final.scss +0 -0
- /package/{src/lib/assets → lib/styles}/styles-config.scss +0 -0
|
@@ -1,1083 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, Component, ChangeDetectionStrategy, Input, EventEmitter, Output, Directive, NgModule, Injectable } from '@angular/core';
|
|
3
|
-
import { debounceTime } from 'rxjs/operators';
|
|
4
|
-
import * as i4 from '@angular/material/autocomplete';
|
|
5
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
7
|
-
import * as i1 from '@angular/material/input';
|
|
8
|
-
import { MatInputModule } from '@angular/material/input';
|
|
9
|
-
import * as i1$1 from '@angular/common';
|
|
10
|
-
import { CommonModule } from '@angular/common';
|
|
11
|
-
import * as i6 from '@angular/material/icon';
|
|
12
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
-
import * as i7 from '@angular/forms';
|
|
14
|
-
import { ReactiveFormsModule, FormControl, FormsModule, FormGroup, FormArray, Validators } from '@angular/forms';
|
|
15
|
-
import * as i7$1 from '@angular/material/button';
|
|
16
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
17
|
-
import * as i2 from '@angular/material/form-field';
|
|
18
|
-
import * as i5 from '@angular/material/core';
|
|
19
|
-
import { MatNativeDateModule } from '@angular/material/core';
|
|
20
|
-
import * as i1$2 from '@ngneat/input-mask';
|
|
21
|
-
import { InputMaskModule, createMask } from '@ngneat/input-mask';
|
|
22
|
-
import * as i3 from '@angular/material/select';
|
|
23
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
24
|
-
import * as i3$1 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 i4$1 from '@angular/cdk/text-field';
|
|
31
|
-
import * as i2$2 from 'ngx-dropzone';
|
|
32
|
-
import { NgxDropzoneModule } from 'ngx-dropzone';
|
|
33
|
-
import * as i1$3 from '@angular/platform-browser';
|
|
34
|
-
import * as i3$2 from 'ngx-editor';
|
|
35
|
-
import { Editor, NgxEditorModule } from 'ngx-editor';
|
|
36
|
-
|
|
37
|
-
class ErrorMessagePipe {
|
|
38
|
-
transform(errorsObj, errorMessages, control) {
|
|
39
|
-
const errors = errorsObj ? Object.keys(errorsObj) : [];
|
|
40
|
-
const error = errors[0];
|
|
41
|
-
const message = errorMessages[error] || error;
|
|
42
|
-
if (control) {
|
|
43
|
-
control.setErrors(errorsObj);
|
|
44
|
-
}
|
|
45
|
-
return message;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
ErrorMessagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ErrorMessagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
49
|
-
ErrorMessagePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ErrorMessagePipe, isStandalone: true, name: "errorMessage" });
|
|
50
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ErrorMessagePipe, decorators: [{
|
|
51
|
-
type: Pipe,
|
|
52
|
-
args: [{
|
|
53
|
-
name: "errorMessage",
|
|
54
|
-
standalone: true
|
|
55
|
-
}]
|
|
56
|
-
}] });
|
|
57
|
-
|
|
58
|
-
class TextByFunctionPipe {
|
|
59
|
-
transform(value, field) {
|
|
60
|
-
if (field instanceof Function) {
|
|
61
|
-
return field(value);
|
|
62
|
-
}
|
|
63
|
-
else if (value instanceof Object) {
|
|
64
|
-
return value[field];
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
TextByFunctionPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TextByFunctionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
72
|
-
TextByFunctionPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: TextByFunctionPipe, isStandalone: true, name: "textByFunction" });
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TextByFunctionPipe, decorators: [{
|
|
74
|
-
type: Pipe,
|
|
75
|
-
args: [{ name: 'textByFunction', standalone: true }]
|
|
76
|
-
}] });
|
|
77
|
-
|
|
78
|
-
class FormControlsListPipe {
|
|
79
|
-
transform(controls) {
|
|
80
|
-
if (!controls)
|
|
81
|
-
return [];
|
|
82
|
-
return Object.values(controls)
|
|
83
|
-
.filter((control) => !control.hidden)
|
|
84
|
-
.map((control) => control);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
FormControlsListPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormControlsListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
88
|
-
FormControlsListPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: FormControlsListPipe, isStandalone: true, name: "controlsList" });
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormControlsListPipe, decorators: [{
|
|
90
|
-
type: Pipe,
|
|
91
|
-
args: [{ name: 'controlsList', standalone: true }]
|
|
92
|
-
}] });
|
|
93
|
-
|
|
94
|
-
class SpecialAutocompleteComponent {
|
|
95
|
-
constructor() {
|
|
96
|
-
this.subs = new Subscription();
|
|
97
|
-
this.configValue = (item) => {
|
|
98
|
-
if (!item)
|
|
99
|
-
return '';
|
|
100
|
-
const fieldName = this.settings.fieldName;
|
|
101
|
-
return fieldName instanceof Function ? fieldName(item) : item[fieldName];
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
ngOnInit() {
|
|
105
|
-
this.init();
|
|
106
|
-
}
|
|
107
|
-
get settings() {
|
|
108
|
-
return this.control.settings;
|
|
109
|
-
}
|
|
110
|
-
init() {
|
|
111
|
-
this.subs.add(this.control.valueChanges.pipe(debounceTime(500)).subscribe((value) => {
|
|
112
|
-
if (typeof value === 'string') {
|
|
113
|
-
this.settings.getData(value, this.control);
|
|
114
|
-
}
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
optionSelected(data) {
|
|
118
|
-
this.control.setValue(data.option.value);
|
|
119
|
-
if (this.settings.onSelect)
|
|
120
|
-
this.settings.onSelect(data.option.value);
|
|
121
|
-
}
|
|
122
|
-
iconClick(event) {
|
|
123
|
-
if (this.settings.iconAction) {
|
|
124
|
-
this.settings.iconAction(this.control.value);
|
|
125
|
-
event.stopPropagation();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
ngOnDestroy() {
|
|
129
|
-
this.subs.unsubscribe();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
SpecialAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
133
|
-
SpecialAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialAutocompleteComponent, isStandalone: true, selector: "sp-autocomplete", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\r\n class=\"special-autocomplete w-full mb-3 {{ control.styleClasses }}\"\r\n [id]=\"control.elementId\"\r\n *ngIf=\"control && !control.hidden\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-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 #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", styles: [":host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7$1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialAutocompleteComponent, decorators: [{
|
|
135
|
-
type: Component,
|
|
136
|
-
args: [{ standalone: true, selector: 'sp-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
137
|
-
MatInputModule,
|
|
138
|
-
CommonModule,
|
|
139
|
-
MatAutocompleteModule,
|
|
140
|
-
MatIconModule,
|
|
141
|
-
ReactiveFormsModule,
|
|
142
|
-
MatButtonModule,
|
|
143
|
-
ErrorMessagePipe,
|
|
144
|
-
TextByFunctionPipe,
|
|
145
|
-
], template: "<mat-form-field\r\n class=\"special-autocomplete w-full mb-3 {{ control.styleClasses }}\"\r\n [id]=\"control.elementId\"\r\n *ngIf=\"control && !control.hidden\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-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 #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", styles: [":host{display:contents}\n"] }]
|
|
146
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
147
|
-
type: Input
|
|
148
|
-
}] } });
|
|
149
|
-
|
|
150
|
-
class SpecialInputComponent {
|
|
151
|
-
constructor() { }
|
|
152
|
-
ngOnInit() { }
|
|
153
|
-
onEnterClick() {
|
|
154
|
-
if (this.settings.onEnter) {
|
|
155
|
-
this.settings.onEnter(this.control.value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
onBlurAction() {
|
|
159
|
-
if (this.settings.onBlur) {
|
|
160
|
-
this.settings.onBlur(this.control.value);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
get settings() {
|
|
164
|
-
return this.control.settings;
|
|
165
|
-
}
|
|
166
|
-
iconClick(event) {
|
|
167
|
-
if (this.settings.iconAction) {
|
|
168
|
-
this.settings.iconAction(this.control.value);
|
|
169
|
-
event.stopPropagation();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
SpecialInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
-
SpecialInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialInputComponent, isStandalone: true, selector: "sp-input", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-input w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <input\r\n matInput\r\n (blur)=\"onBlurAction()\"\r\n (keydown.enter)=\"onEnterClick()\"\r\n [inputMask]=\"settings?.mask\"\r\n autocomplete=\"off\"\r\n [type]=\"settings?.type || 'text'\"\r\n [readonly]=\"control.readOnly\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n />\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </mat-hint>\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-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: "ngmodule", type: InputMaskModule }, { kind: "directive", type: i1$2.InputMaskDirective, selector: "[inputMask]", inputs: ["inputMask"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7$1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialInputComponent, decorators: [{
|
|
176
|
-
type: Component,
|
|
177
|
-
args: [{ standalone: true, selector: 'sp-input', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
178
|
-
InputMaskModule,
|
|
179
|
-
CommonModule,
|
|
180
|
-
MatInputModule,
|
|
181
|
-
MatIconModule,
|
|
182
|
-
ReactiveFormsModule,
|
|
183
|
-
MatButtonModule,
|
|
184
|
-
ErrorMessagePipe,
|
|
185
|
-
], template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-input w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <input\r\n matInput\r\n (blur)=\"onBlurAction()\"\r\n (keydown.enter)=\"onEnterClick()\"\r\n [inputMask]=\"settings?.mask\"\r\n autocomplete=\"off\"\r\n [type]=\"settings?.type || 'text'\"\r\n [readonly]=\"control.readOnly\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n />\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </mat-hint>\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-error>\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </mat-error>\r\n</mat-form-field>\r\n", styles: [":host{display:contents}\n"] }]
|
|
186
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
187
|
-
type: Input
|
|
188
|
-
}] } });
|
|
189
|
-
|
|
190
|
-
class SpecialDropdownComponent {
|
|
191
|
-
get settings() {
|
|
192
|
-
return this.control.settings;
|
|
193
|
-
}
|
|
194
|
-
iconClick(event) {
|
|
195
|
-
if (this.settings.iconAction) {
|
|
196
|
-
this.settings.iconAction(this.control.value);
|
|
197
|
-
event.stopPropagation();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
optionSelected(value) {
|
|
201
|
-
if (this.settings.onSelect)
|
|
202
|
-
this.settings.onSelect(value);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
SpecialDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
206
|
-
SpecialDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialDropdownComponent, isStandalone: true, selector: "sp-dropdown", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-dropdown w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\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: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i3.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7$1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialDropdownComponent, decorators: [{
|
|
208
|
-
type: Component,
|
|
209
|
-
args: [{ standalone: true, selector: 'sp-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
210
|
-
CommonModule,
|
|
211
|
-
MatSelectModule,
|
|
212
|
-
ReactiveFormsModule,
|
|
213
|
-
ErrorMessagePipe,
|
|
214
|
-
MatIconModule,
|
|
215
|
-
MatButtonModule,
|
|
216
|
-
TextByFunctionPipe,
|
|
217
|
-
], template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-dropdown w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\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"] }]
|
|
218
|
-
}], propDecorators: { control: [{
|
|
219
|
-
type: Input
|
|
220
|
-
}] } });
|
|
221
|
-
|
|
222
|
-
class SpecialDatepickerComponent {
|
|
223
|
-
constructor() { }
|
|
224
|
-
get startAt() {
|
|
225
|
-
var _a;
|
|
226
|
-
return ((_a = this.control.settings) === null || _a === void 0 ? void 0 : _a.startAt) || new Date();
|
|
227
|
-
}
|
|
228
|
-
ngOnInit() { }
|
|
229
|
-
}
|
|
230
|
-
SpecialDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialDatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
231
|
-
SpecialDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialDatepickerComponent, isStandalone: true, selector: "sp-datepicker", inputs: { control: "control" }, ngImport: i0, template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-datepicker w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <input\r\n matInput\r\n autocomplete=\"off\"\r\n [readonly]=\"control.readOnly\"\r\n [matDatepicker]=\"picker\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker startView=\"year\" [startAt]=\"startAt\">\r\n </mat-datepicker>\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </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: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i3$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i3$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "ngmodule", type: MatNativeDateModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
232
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialDatepickerComponent, decorators: [{
|
|
233
|
-
type: Component,
|
|
234
|
-
args: [{ standalone: true, selector: 'sp-datepicker', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
235
|
-
MatInputModule,
|
|
236
|
-
MatDatepickerModule,
|
|
237
|
-
CommonModule,
|
|
238
|
-
MatIconModule,
|
|
239
|
-
ReactiveFormsModule,
|
|
240
|
-
MatButtonModule,
|
|
241
|
-
ErrorMessagePipe,
|
|
242
|
-
MatNativeDateModule,
|
|
243
|
-
], template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-datepicker w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <input\r\n matInput\r\n autocomplete=\"off\"\r\n [readonly]=\"control.readOnly\"\r\n [matDatepicker]=\"picker\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker startView=\"year\" [startAt]=\"startAt\">\r\n </mat-datepicker>\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </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"] }]
|
|
244
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
245
|
-
type: Input
|
|
246
|
-
}] } });
|
|
247
|
-
|
|
248
|
-
class SpecialMultipleAutocompleteComponent {
|
|
249
|
-
constructor() {
|
|
250
|
-
this.subs = new Subscription();
|
|
251
|
-
this.internalControl = new FormControl();
|
|
252
|
-
this.configValue = (item) => {
|
|
253
|
-
if (!item)
|
|
254
|
-
return '';
|
|
255
|
-
const fieldName = this.control.settings.fieldName;
|
|
256
|
-
return fieldName instanceof Function ? fieldName(item) : item[fieldName];
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
ngOnInit() {
|
|
260
|
-
this.init();
|
|
261
|
-
}
|
|
262
|
-
get settings() {
|
|
263
|
-
return this.control.settings;
|
|
264
|
-
}
|
|
265
|
-
init() {
|
|
266
|
-
this.subs.add(this.internalControl.valueChanges
|
|
267
|
-
.pipe(debounceTime(500))
|
|
268
|
-
.subscribe((value) => {
|
|
269
|
-
if (typeof value === 'string') {
|
|
270
|
-
this.control.settings.getData(value, this.control);
|
|
271
|
-
}
|
|
272
|
-
}));
|
|
273
|
-
}
|
|
274
|
-
optionSelected(data) {
|
|
275
|
-
const newItem = data.option.value;
|
|
276
|
-
this.internalControl.reset();
|
|
277
|
-
this.control.setValue([
|
|
278
|
-
...(this.control.value || []).filter((item) => item[this.control.settings.fieldId] !==
|
|
279
|
-
newItem[this.control.settings.fieldId]),
|
|
280
|
-
newItem,
|
|
281
|
-
]);
|
|
282
|
-
if (this.settings.onSelect)
|
|
283
|
-
this.settings.onSelect(newItem);
|
|
284
|
-
}
|
|
285
|
-
iconClick(event) {
|
|
286
|
-
if (this.settings.iconAction) {
|
|
287
|
-
this.settings.iconAction(this.control.value);
|
|
288
|
-
event.stopPropagation();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
remove(value) {
|
|
292
|
-
let currentValues = Array.from(this.control.value);
|
|
293
|
-
const index = currentValues.indexOf(value);
|
|
294
|
-
if (index > -1) {
|
|
295
|
-
currentValues.splice(index, 1);
|
|
296
|
-
const value = currentValues;
|
|
297
|
-
this.control.markAsDirty();
|
|
298
|
-
this.control.setValue(value);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
ngOnDestroy() {
|
|
302
|
-
this.subs.unsubscribe();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
SpecialMultipleAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialMultipleAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
306
|
-
SpecialMultipleAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialMultipleAutocompleteComponent, isStandalone: true, selector: "sp-multiple-autocomplete", inputs: { control: "control" }, ngImport: i0, template: "<div\r\n class=\"special-multiple-autocomplete w-full mb-3 {{ control.styleClasses }}\"\r\n [id]=\"control.elementId\"\r\n *ngIf=\"control && !control.hidden\"\r\n>\r\n <mat-form-field\r\n class=\"w-full\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\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 #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\r\n <mat-chip-listbox>\r\n <mat-chip\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\"\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-listbox>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i5.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "component", type: i7$1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i9.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disabled", "disableRipple", "tabIndex", "role", "id", "aria-label", "aria-description", "value", "removable", "highlighted"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i9.MatChipListbox, selector: "mat-chip-listbox", inputs: ["tabIndex", "multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "directive", type: i9.MatChipRemove, selector: "[matChipRemove]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialMultipleAutocompleteComponent, decorators: [{
|
|
308
|
-
type: Component,
|
|
309
|
-
args: [{ standalone: true, selector: 'sp-multiple-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
310
|
-
MatInputModule,
|
|
311
|
-
CommonModule,
|
|
312
|
-
MatAutocompleteModule,
|
|
313
|
-
MatIconModule,
|
|
314
|
-
ReactiveFormsModule,
|
|
315
|
-
MatButtonModule,
|
|
316
|
-
ErrorMessagePipe,
|
|
317
|
-
TextByFunctionPipe,
|
|
318
|
-
MatChipsModule,
|
|
319
|
-
], template: "<div\r\n class=\"special-multiple-autocomplete w-full mb-3 {{ control.styleClasses }}\"\r\n [id]=\"control.elementId\"\r\n *ngIf=\"control && !control.hidden\"\r\n>\r\n <mat-form-field\r\n class=\"w-full\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\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 #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\r\n <mat-chip-listbox>\r\n <mat-chip\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\"\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-listbox>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
320
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
321
|
-
type: Input
|
|
322
|
-
}] } });
|
|
323
|
-
|
|
324
|
-
class SpecialCheckboxComponent {
|
|
325
|
-
constructor() { }
|
|
326
|
-
ngOnInit() { }
|
|
327
|
-
}
|
|
328
|
-
SpecialCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
329
|
-
SpecialCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialCheckboxComponent, isStandalone: true, selector: "sp-checkbox", inputs: { control: "control" }, ngImport: i0, template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-checkbox w-full mb-3 flex flex-col {{ control.styleClasses }}\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <mat-checkbox\r\n [required]=\"control.required\"\r\n [ngModel]=\"control.value\"\r\n (ngModelChange)=\"control.setValue($event); control.markAsDirty()\"\r\n [indeterminate]=\"control.settings.indeterminate\"\r\n [labelPosition]=\"control.settings.labelPosition\"\r\n [color]=\"control.settings.color\"\r\n [disabled]=\"control.disabled\"\r\n >\r\n <mat-icon *ngIf=\"control.icon\" matSuffix>{{ control.icon }} </mat-icon>\r\n {{ control.placeholder }}\r\n </mat-checkbox>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i2$1.MatCheckboxRequiredValidator, selector: "mat-checkbox[required][formControlName], mat-checkbox[required][formControl], mat-checkbox[required][ngModel]" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatButtonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialCheckboxComponent, decorators: [{
|
|
331
|
-
type: Component,
|
|
332
|
-
args: [{ standalone: true, selector: 'sp-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
333
|
-
FormsModule,
|
|
334
|
-
MatCheckboxModule,
|
|
335
|
-
CommonModule,
|
|
336
|
-
MatInputModule,
|
|
337
|
-
MatIconModule,
|
|
338
|
-
ReactiveFormsModule,
|
|
339
|
-
MatButtonModule,
|
|
340
|
-
ErrorMessagePipe,
|
|
341
|
-
], template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-checkbox w-full mb-3 flex flex-col {{ control.styleClasses }}\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <mat-checkbox\r\n [required]=\"control.required\"\r\n [ngModel]=\"control.value\"\r\n (ngModelChange)=\"control.setValue($event); control.markAsDirty()\"\r\n [indeterminate]=\"control.settings.indeterminate\"\r\n [labelPosition]=\"control.settings.labelPosition\"\r\n [color]=\"control.settings.color\"\r\n [disabled]=\"control.disabled\"\r\n >\r\n <mat-icon *ngIf=\"control.icon\" matSuffix>{{ control.icon }} </mat-icon>\r\n {{ control.placeholder }}\r\n </mat-checkbox>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
342
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
343
|
-
type: Input
|
|
344
|
-
}] } });
|
|
345
|
-
|
|
346
|
-
class SpecialTextAreaComponent {
|
|
347
|
-
constructor() {
|
|
348
|
-
this.onBlur = new EventEmitter();
|
|
349
|
-
this.onEnter = new EventEmitter();
|
|
350
|
-
}
|
|
351
|
-
ngOnInit() { }
|
|
352
|
-
}
|
|
353
|
-
SpecialTextAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialTextAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
354
|
-
SpecialTextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialTextAreaComponent, isStandalone: true, selector: "sp-text-area", inputs: { control: "control" }, outputs: { onBlur: "onBlur", onEnter: "onEnter" }, ngImport: i0, template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-textarea w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <textarea\r\n cdkTextareaAutosize\r\n #autosize=\"cdkTextareaAutosize\"\r\n cdkAutosizeMinRows=\"1\"\r\n cdkAutosizeMaxRows=\"5\"\r\n matInput\r\n (blur)=\"onBlur.emit(control.value)\"\r\n (keydown.enter)=\"onEnter.emit(control.value)\"\r\n [type]=\"control.settings?.type || 'text'\"\r\n [readonly]=\"control.readOnly\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n ></textarea>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </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: "ngmodule", type: InputMaskModule }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.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: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4$1.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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: "ngmodule", type: MatButtonModule }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialTextAreaComponent, decorators: [{
|
|
356
|
-
type: Component,
|
|
357
|
-
args: [{ standalone: true, selector: 'sp-text-area', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
358
|
-
InputMaskModule,
|
|
359
|
-
CommonModule,
|
|
360
|
-
MatInputModule,
|
|
361
|
-
MatIconModule,
|
|
362
|
-
ReactiveFormsModule,
|
|
363
|
-
MatButtonModule,
|
|
364
|
-
ErrorMessagePipe,
|
|
365
|
-
], template: "<mat-form-field\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-textarea w-full mb-3 {{ control.styleClasses }}\"\r\n [appearance]=\"control.label ? 'outline' : 'fill'\"\r\n>\r\n <mat-label *ngIf=\"control.label\">{{ control.label }}</mat-label>\r\n <textarea\r\n cdkTextareaAutosize\r\n #autosize=\"cdkTextareaAutosize\"\r\n cdkAutosizeMinRows=\"1\"\r\n cdkAutosizeMaxRows=\"5\"\r\n matInput\r\n (blur)=\"onBlur.emit(control.value)\"\r\n (keydown.enter)=\"onEnter.emit(control.value)\"\r\n [type]=\"control.settings?.type || 'text'\"\r\n [readonly]=\"control.readOnly\"\r\n [required]=\"control.required\"\r\n [placeholder]=\"control.placeholder\"\r\n [formControl]=\"control\"\r\n ></textarea>\r\n <mat-icon *ngIf=\"control.icon\" matPrefix>{{ control.icon }} </mat-icon>\r\n <mat-hint>\r\n {{ control.tooltip }}\r\n </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"] }]
|
|
366
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
367
|
-
type: Input
|
|
368
|
-
}], onBlur: [{
|
|
369
|
-
type: Output
|
|
370
|
-
}], onEnter: [{
|
|
371
|
-
type: Output
|
|
372
|
-
}] } });
|
|
373
|
-
|
|
374
|
-
class SpecialUploadComponent {
|
|
375
|
-
set controlSetter(control) {
|
|
376
|
-
this.control = control;
|
|
377
|
-
this.previewImages = control.value;
|
|
378
|
-
}
|
|
379
|
-
constructor(sanitizer) {
|
|
380
|
-
this.sanitizer = sanitizer;
|
|
381
|
-
this.previewImages = [];
|
|
382
|
-
}
|
|
383
|
-
ngOnInit() { }
|
|
384
|
-
onSelectMultiple(event) {
|
|
385
|
-
this.previewImages = [
|
|
386
|
-
...this.previewImages,
|
|
387
|
-
...event.addedFiles.map((file) => ({
|
|
388
|
-
lastModified: file.lastModified,
|
|
389
|
-
url: this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file)),
|
|
390
|
-
})),
|
|
391
|
-
];
|
|
392
|
-
this.control.setValue([
|
|
393
|
-
...(this.control.value || []),
|
|
394
|
-
...event.addedFiles.map(this.fixFileName),
|
|
395
|
-
]);
|
|
396
|
-
this.onselectFile(this.control.value);
|
|
397
|
-
this.control.markAsDirty();
|
|
398
|
-
}
|
|
399
|
-
onSelectOne(event) {
|
|
400
|
-
this.previewImages = event.addedFiles.map((file) => ({
|
|
401
|
-
lastModified: file.lastModified,
|
|
402
|
-
url: this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file)),
|
|
403
|
-
}));
|
|
404
|
-
this.control.setValue(event.addedFiles.map(this.fixFileName));
|
|
405
|
-
this.onselectFile(this.control.value);
|
|
406
|
-
this.control.markAsDirty();
|
|
407
|
-
}
|
|
408
|
-
onselectFile(value) {
|
|
409
|
-
var _a;
|
|
410
|
-
if ((_a = this.control.settings) === null || _a === void 0 ? void 0 : _a.onSelectFile) {
|
|
411
|
-
this.control.settings.onSelectFile(value);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
fixFileName(file) {
|
|
415
|
-
return Object.defineProperty(file, 'name', {
|
|
416
|
-
writable: true,
|
|
417
|
-
value: file.name.normalize('NFD').replace(/[\u0300-\u036f]/g, ''),
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
clean() {
|
|
421
|
-
this.previewImages = [];
|
|
422
|
-
}
|
|
423
|
-
onRemove(file) {
|
|
424
|
-
this.control.setValue(this.control.value.filter((fl) => fl.lastModified !== file.lastModified));
|
|
425
|
-
this.previewImages = this.previewImages.filter((fl) => fl.lastModified !== file.lastModified);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
SpecialUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialUploadComponent, deps: [{ token: i1$3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
429
|
-
SpecialUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialUploadComponent, isStandalone: true, selector: "sp-upload", inputs: { controlSetter: ["control", "controlSetter"] }, ngImport: i0, template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-upload w-full mb-3 {{ control.styleClasses }}\"\r\n>\r\n <ngx-dropzone\r\n class=\"special-upload__dropzone\"\r\n [ngClass]=\"{\r\n 'special-upload--error-dashed':\r\n !!control.errors && (control.dirty || control.touched)\r\n }\"\r\n [multiple]=\"control.settings?.multiple\"\r\n [accept]=\"\r\n control.settings?.accept\r\n ? control.settings?.accept\r\n : 'image/png, .jpeg, .jpg, image/gif'\r\n \"\r\n (change)=\"\r\n control.settings?.multiple\r\n ? onSelectMultiple($event)\r\n : onSelectOne($event)\r\n \"\r\n >\r\n <ngx-dropzone-label\r\n [ngClass]=\"{\r\n 'special-upload--error':\r\n !!control.errors && (control.dirty || control.touched)\r\n }\"\r\n >\r\n <mat-icon class=\"special-upload__icon\" *ngIf=\"control.icon\"\r\n >{{ control.icon }}\r\n </mat-icon>\r\n <h2 class=\"text-base font-bold\">\r\n {{ control.label }}\r\n </h2>\r\n <h3 class=\"text-base\">\r\n {{ control.placeholder }}\r\n </h3>\r\n </ngx-dropzone-label>\r\n <ngx-dropzone-preview\r\n *ngFor=\"let file of previewImages\"\r\n [removable]=\"true\"\r\n (removed)=\"onRemove(file)\"\r\n >\r\n <ngx-dropzone-label class=\"special-upload__card\">\r\n <img class=\"special-upload__card--image\" [src]=\"file?.url\" alt=\"\" />\r\n </ngx-dropzone-label>\r\n </ngx-dropzone-preview>\r\n </ngx-dropzone>\r\n <div\r\n class=\"special-upload--error mt-2\"\r\n *ngIf=\"!!control.errors && (control.dirty || control.touched)\"\r\n >\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}:host .special-upload{margin-bottom:1rem}:host .special-upload__dropzone{min-height:180px;height:unset!important}: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: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: NgxDropzoneModule }, { kind: "component", type: i2$2.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$2.NgxDropzoneLabelDirective, selector: "ngx-dropzone-label" }, { kind: "component", type: i2$2.NgxDropzonePreviewComponent, selector: "ngx-dropzone-preview", inputs: ["file", "removable"], outputs: ["removed"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "pipe", type: ErrorMessagePipe, name: "errorMessage" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialUploadComponent, decorators: [{
|
|
431
|
-
type: Component,
|
|
432
|
-
args: [{ standalone: true, selector: 'sp-upload', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
433
|
-
FormsModule,
|
|
434
|
-
NgxDropzoneModule,
|
|
435
|
-
CommonModule,
|
|
436
|
-
MatIconModule,
|
|
437
|
-
ReactiveFormsModule,
|
|
438
|
-
MatButtonModule,
|
|
439
|
-
ErrorMessagePipe,
|
|
440
|
-
], template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n [id]=\"control.elementId\"\r\n class=\"special-upload w-full mb-3 {{ control.styleClasses }}\"\r\n>\r\n <ngx-dropzone\r\n class=\"special-upload__dropzone\"\r\n [ngClass]=\"{\r\n 'special-upload--error-dashed':\r\n !!control.errors && (control.dirty || control.touched)\r\n }\"\r\n [multiple]=\"control.settings?.multiple\"\r\n [accept]=\"\r\n control.settings?.accept\r\n ? control.settings?.accept\r\n : 'image/png, .jpeg, .jpg, image/gif'\r\n \"\r\n (change)=\"\r\n control.settings?.multiple\r\n ? onSelectMultiple($event)\r\n : onSelectOne($event)\r\n \"\r\n >\r\n <ngx-dropzone-label\r\n [ngClass]=\"{\r\n 'special-upload--error':\r\n !!control.errors && (control.dirty || control.touched)\r\n }\"\r\n >\r\n <mat-icon class=\"special-upload__icon\" *ngIf=\"control.icon\"\r\n >{{ control.icon }}\r\n </mat-icon>\r\n <h2 class=\"text-base font-bold\">\r\n {{ control.label }}\r\n </h2>\r\n <h3 class=\"text-base\">\r\n {{ control.placeholder }}\r\n </h3>\r\n </ngx-dropzone-label>\r\n <ngx-dropzone-preview\r\n *ngFor=\"let file of previewImages\"\r\n [removable]=\"true\"\r\n (removed)=\"onRemove(file)\"\r\n >\r\n <ngx-dropzone-label class=\"special-upload__card\">\r\n <img class=\"special-upload__card--image\" [src]=\"file?.url\" alt=\"\" />\r\n </ngx-dropzone-label>\r\n </ngx-dropzone-preview>\r\n </ngx-dropzone>\r\n <div\r\n class=\"special-upload--error mt-2\"\r\n *ngIf=\"!!control.errors && (control.dirty || control.touched)\"\r\n >\r\n {{ control.errors | errorMessage: control.errorMessages }}\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}:host .special-upload{margin-bottom:1rem}:host .special-upload__dropzone{min-height:180px;height:unset!important}: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"] }]
|
|
441
|
-
}], ctorParameters: function () { return [{ type: i1$3.DomSanitizer }]; }, propDecorators: { controlSetter: [{
|
|
442
|
-
type: Input,
|
|
443
|
-
args: ['control']
|
|
444
|
-
}] } });
|
|
445
|
-
|
|
446
|
-
class SpecialLabelComponent {
|
|
447
|
-
constructor() { }
|
|
448
|
-
ngOnInit() { }
|
|
449
|
-
get settings() {
|
|
450
|
-
return this.control.settings || { isLink: false };
|
|
451
|
-
}
|
|
452
|
-
onLink() {
|
|
453
|
-
if (this.settings.isLink && this.settings.onClickLink) {
|
|
454
|
-
this.settings.onClickLink(this.control.value);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
SpecialLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
459
|
-
SpecialLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialLabelComponent, isStandalone: true, selector: "sp-label", inputs: { control: "control" }, ngImport: i0, template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n class=\"special-label px-2 mb-3 {{ control.styleClasses }} {{\r\n control.value | textByFunction: settings.stylesPipe\r\n }}\"\r\n [id]=\"control.elementId\"\r\n>\r\n <div *ngIf=\"!!control.label\" class=\"special-label__title font-bold\">\r\n {{ control.label }}\r\n </div>\r\n <div\r\n class=\"special-label__text\"\r\n [ngClass]=\"{\r\n 'cursor-pointer text-blue-600 hover:text-blue-700': settings.isLink\r\n }\"\r\n (click)=\"onLink()\"\r\n >\r\n {{ control.value | textByFunction: control.settings.pipe }}\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "pipe", type: TextByFunctionPipe, name: "textByFunction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
460
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialLabelComponent, decorators: [{
|
|
461
|
-
type: Component,
|
|
462
|
-
args: [{ standalone: true, selector: 'sp-label', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, MatIconModule, TextByFunctionPipe], template: "<div\r\n *ngIf=\"control && !control.hidden\"\r\n class=\"special-label px-2 mb-3 {{ control.styleClasses }} {{\r\n control.value | textByFunction: settings.stylesPipe\r\n }}\"\r\n [id]=\"control.elementId\"\r\n>\r\n <div *ngIf=\"!!control.label\" class=\"special-label__title font-bold\">\r\n {{ control.label }}\r\n </div>\r\n <div\r\n class=\"special-label__text\"\r\n [ngClass]=\"{\r\n 'cursor-pointer text-blue-600 hover:text-blue-700': settings.isLink\r\n }\"\r\n (click)=\"onLink()\"\r\n >\r\n {{ control.value | textByFunction: control.settings.pipe }}\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
463
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
464
|
-
type: Input
|
|
465
|
-
}] } });
|
|
466
|
-
|
|
467
|
-
var EControlTypes;
|
|
468
|
-
(function (EControlTypes) {
|
|
469
|
-
EControlTypes["pkey"] = "PRIMARY-KEY";
|
|
470
|
-
EControlTypes["input"] = "INPUT";
|
|
471
|
-
EControlTypes["richText"] = "RICH-TEXT";
|
|
472
|
-
EControlTypes["textArea"] = "TEXT-AREA";
|
|
473
|
-
EControlTypes["dropdown"] = "DROPDOWN";
|
|
474
|
-
EControlTypes["date"] = "DATE";
|
|
475
|
-
EControlTypes["checkbox"] = "CHECKBOX";
|
|
476
|
-
EControlTypes["upload"] = "UPLOAD";
|
|
477
|
-
EControlTypes["autocomplete"] = "AUTOCOMPLETE";
|
|
478
|
-
EControlTypes["multiple"] = "MULTIPLE-AUTOCOMPLETE";
|
|
479
|
-
EControlTypes["array"] = "ARRAY";
|
|
480
|
-
EControlTypes["form"] = "FORM";
|
|
481
|
-
EControlTypes["label"] = "LABEL";
|
|
482
|
-
EControlTypes["default"] = "DEFAULT";
|
|
483
|
-
})(EControlTypes || (EControlTypes = {}));
|
|
484
|
-
|
|
485
|
-
class SpecialRichtextComponent {
|
|
486
|
-
set control(control) {
|
|
487
|
-
this.formControl = control;
|
|
488
|
-
if (control.settings.colorPresets)
|
|
489
|
-
this.colorPresets = control.settings.colorPresets;
|
|
490
|
-
this.editor = new Editor();
|
|
491
|
-
}
|
|
492
|
-
constructor() {
|
|
493
|
-
this.colorPresets = ['red', 'yellow', 'green', 'blue', 'black'];
|
|
494
|
-
this.toolbar = [
|
|
495
|
-
// default value
|
|
496
|
-
['bold', 'italic'],
|
|
497
|
-
['underline', 'strike'],
|
|
498
|
-
['code', 'blockquote'],
|
|
499
|
-
['ordered_list', 'bullet_list'],
|
|
500
|
-
[{ heading: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] }],
|
|
501
|
-
['link', 'image'],
|
|
502
|
-
['text_color', 'background_color'],
|
|
503
|
-
['align_left', 'align_center', 'align_right', 'align_justify'],
|
|
504
|
-
['horizontal_rule', 'format_clear'],
|
|
505
|
-
];
|
|
506
|
-
}
|
|
507
|
-
ngOnInit() { }
|
|
508
|
-
ngOnDestroy() {
|
|
509
|
-
this.editor.destroy();
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
SpecialRichtextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialRichtextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
513
|
-
SpecialRichtextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialRichtextComponent, isStandalone: true, selector: "sp-input", inputs: { control: "control" }, ngImport: i0, template: "<div\r\n class=\"special-richtext w-full mb-3 {{ formControl.styleClasses }}\"\r\n [id]=\"formControl.elementId\"\r\n *ngIf=\"formControl && !formControl.hidden\"\r\n>\r\n <ngx-editor-menu\r\n [colorPresets]=\"colorPresets\"\r\n [toolbar]=\"toolbar\"\r\n [editor]=\"editor\"\r\n >\r\n </ngx-editor-menu>\r\n <ngx-editor\r\n [editor]=\"editor\"\r\n [formControl]=\"formControl\"\r\n [disabled]=\"false\"\r\n [placeholder]=\"formControl.placeholder\"\r\n ></ngx-editor>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: NgxEditorModule }, { kind: "component", type: i3$2.NgxEditorComponent, selector: "ngx-editor", inputs: ["editor", "outputFormat", "placeholder"], outputs: ["focusOut", "focusIn"] }, { kind: "component", type: i3$2.MenuComponent, selector: "ngx-editor-menu", inputs: ["toolbar", "colorPresets", "disabled", "editor", "customMenuRef", "dropdownPlacement"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
514
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialRichtextComponent, decorators: [{
|
|
515
|
-
type: Component,
|
|
516
|
-
args: [{ standalone: true, selector: 'sp-input', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, MatIconModule, ReactiveFormsModule, NgxEditorModule], template: "<div\r\n class=\"special-richtext w-full mb-3 {{ formControl.styleClasses }}\"\r\n [id]=\"formControl.elementId\"\r\n *ngIf=\"formControl && !formControl.hidden\"\r\n>\r\n <ngx-editor-menu\r\n [colorPresets]=\"colorPresets\"\r\n [toolbar]=\"toolbar\"\r\n [editor]=\"editor\"\r\n >\r\n </ngx-editor-menu>\r\n <ngx-editor\r\n [editor]=\"editor\"\r\n [formControl]=\"formControl\"\r\n [disabled]=\"false\"\r\n [placeholder]=\"formControl.placeholder\"\r\n ></ngx-editor>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
517
|
-
}], ctorParameters: function () { return []; }, propDecorators: { control: [{
|
|
518
|
-
type: Input
|
|
519
|
-
}] } });
|
|
520
|
-
|
|
521
|
-
class SpecialFormComponent {
|
|
522
|
-
set control(form) {
|
|
523
|
-
this.form = form;
|
|
524
|
-
}
|
|
525
|
-
ngOnInit() { }
|
|
526
|
-
}
|
|
527
|
-
SpecialFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
528
|
-
SpecialFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialFormComponent, selector: "sp-form", inputs: { form: ["control", "form"] }, ngImport: i0, template: "<div\r\n *ngIf=\"form && !form.hidden\"\r\n [id]=\"form.elementId\"\r\n class=\"special-form w-full box-border p-2 {{ form.styleClasses }}\"\r\n>\r\n <div\r\n *ngIf=\"form\"\r\n [class]=\"\r\n form.label\r\n ? 'w-full mt-2 p-3 border-slate-200 border border-solid box-border'\r\n : 'container'\r\n \"\r\n >\r\n <h1 *ngIf=\"!!form.label\" class=\"font-bold py-3\">{{ form.label }}</h1>\r\n <div class=\"w-full flex flex-wrap\">\r\n <ng-template\r\n *ngFor=\"let control of form.controls | controlsList\"\r\n controlRender\r\n [control]=\"control\"\r\n ></ng-template>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1$1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1$1.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 });
|
|
529
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormComponent, decorators: [{
|
|
530
|
-
type: Component,
|
|
531
|
-
args: [{ selector: 'sp-form', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n *ngIf=\"form && !form.hidden\"\r\n [id]=\"form.elementId\"\r\n class=\"special-form w-full box-border p-2 {{ form.styleClasses }}\"\r\n>\r\n <div\r\n *ngIf=\"form\"\r\n [class]=\"\r\n form.label\r\n ? 'w-full mt-2 p-3 border-slate-200 border border-solid box-border'\r\n : 'container'\r\n \"\r\n >\r\n <h1 *ngIf=\"!!form.label\" class=\"font-bold py-3\">{{ form.label }}</h1>\r\n <div class=\"w-full flex flex-wrap\">\r\n <ng-template\r\n *ngFor=\"let control of form.controls | controlsList\"\r\n controlRender\r\n [control]=\"control\"\r\n ></ng-template>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
532
|
-
}], propDecorators: { form: [{
|
|
533
|
-
type: Input,
|
|
534
|
-
args: ['control']
|
|
535
|
-
}] } });
|
|
536
|
-
class SpecialArrayComponent {
|
|
537
|
-
set control(formArray) {
|
|
538
|
-
this.formArray = formArray;
|
|
539
|
-
}
|
|
540
|
-
get withFormHeader() {
|
|
541
|
-
return this.formArray.settings.withFormHeader;
|
|
542
|
-
}
|
|
543
|
-
get settings() {
|
|
544
|
-
return this.formArray.settings;
|
|
545
|
-
}
|
|
546
|
-
constructor() { }
|
|
547
|
-
ngOnInit() { }
|
|
548
|
-
removeItem(index) {
|
|
549
|
-
this.formArray.removeAt(index);
|
|
550
|
-
}
|
|
551
|
-
addItem() {
|
|
552
|
-
this.formArray.addItem();
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
SpecialArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialArrayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
556
|
-
SpecialArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: SpecialArrayComponent, selector: "sp-array", inputs: { formArray: ["control", "formArray"] }, ngImport: i0, template: "<div\r\n *ngIf=\"formArray && !formArray.hidden\"\r\n [id]=\"formArray.elementId\"\r\n class=\"special-form-array w-full box-border p-2 {{ formArray.styleClasses }}\"\r\n>\r\n <div class=\"w-full mt-2 p-3 border-slate-200 border border-solid box-border\">\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-x-0 divide-solid divide-slate-200\">\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 {{settings.addActionLabel || '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 {{ settings.removeActionLabel || \"Remove\" }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1$1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1$1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1$1.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-flat-button], button[mat-stroked-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 });
|
|
557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialArrayComponent, decorators: [{
|
|
558
|
-
type: Component,
|
|
559
|
-
args: [{ selector: 'sp-array', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n *ngIf=\"formArray && !formArray.hidden\"\r\n [id]=\"formArray.elementId\"\r\n class=\"special-form-array w-full box-border p-2 {{ formArray.styleClasses }}\"\r\n>\r\n <div class=\"w-full mt-2 p-3 border-slate-200 border border-solid box-border\">\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-x-0 divide-solid divide-slate-200\">\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 {{settings.addActionLabel || '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 {{ settings.removeActionLabel || \"Remove\" }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [":host{display:contents}\n"] }]
|
|
560
|
-
}], ctorParameters: function () { return []; }, propDecorators: { formArray: [{
|
|
561
|
-
type: Input,
|
|
562
|
-
args: ['control']
|
|
563
|
-
}] } });
|
|
564
|
-
class FormControlsRenderDirective {
|
|
565
|
-
set controlSetter(control) {
|
|
566
|
-
this.viewContainer.clear();
|
|
567
|
-
const component = this.componentsBuffer[control.type];
|
|
568
|
-
if (component) {
|
|
569
|
-
const componentRef = this.viewContainer.createComponent(component);
|
|
570
|
-
componentRef.instance.control = control;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
constructor(viewContainer) {
|
|
574
|
-
this.viewContainer = viewContainer;
|
|
575
|
-
this.componentsBuffer = {
|
|
576
|
-
[EControlTypes.autocomplete]: SpecialAutocompleteComponent,
|
|
577
|
-
[EControlTypes.checkbox]: SpecialCheckboxComponent,
|
|
578
|
-
[EControlTypes.date]: SpecialDatepickerComponent,
|
|
579
|
-
[EControlTypes.dropdown]: SpecialDropdownComponent,
|
|
580
|
-
[EControlTypes.array]: SpecialArrayComponent,
|
|
581
|
-
[EControlTypes.input]: SpecialInputComponent,
|
|
582
|
-
[EControlTypes.multiple]: SpecialMultipleAutocompleteComponent,
|
|
583
|
-
[EControlTypes.textArea]: SpecialTextAreaComponent,
|
|
584
|
-
[EControlTypes.label]: SpecialLabelComponent,
|
|
585
|
-
[EControlTypes.upload]: SpecialUploadComponent,
|
|
586
|
-
[EControlTypes.form]: SpecialFormComponent,
|
|
587
|
-
[EControlTypes.richText]: SpecialRichtextComponent,
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
FormControlsRenderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormControlsRenderDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
592
|
-
FormControlsRenderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: FormControlsRenderDirective, selector: "[controlRender]", inputs: { controlSetter: ["control", "controlSetter"] }, ngImport: i0 });
|
|
593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormControlsRenderDirective, decorators: [{
|
|
594
|
-
type: Directive,
|
|
595
|
-
args: [{
|
|
596
|
-
selector: `[controlRender]`,
|
|
597
|
-
}]
|
|
598
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { controlSetter: [{
|
|
599
|
-
type: Input,
|
|
600
|
-
args: ['control']
|
|
601
|
-
}] } });
|
|
602
|
-
|
|
603
|
-
class SpecialFormModule {
|
|
604
|
-
}
|
|
605
|
-
SpecialFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
606
|
-
SpecialFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormModule, declarations: [SpecialArrayComponent,
|
|
607
|
-
FormControlsRenderDirective,
|
|
608
|
-
SpecialFormComponent], imports: [CommonModule,
|
|
609
|
-
FormControlsListPipe,
|
|
610
|
-
MatButtonModule,
|
|
611
|
-
SpecialRichtextComponent,
|
|
612
|
-
SpecialDropdownComponent,
|
|
613
|
-
SpecialInputComponent,
|
|
614
|
-
SpecialAutocompleteComponent,
|
|
615
|
-
SpecialDatepickerComponent,
|
|
616
|
-
SpecialLabelComponent,
|
|
617
|
-
SpecialMultipleAutocompleteComponent,
|
|
618
|
-
SpecialCheckboxComponent,
|
|
619
|
-
SpecialTextAreaComponent,
|
|
620
|
-
SpecialUploadComponent], exports: [SpecialArrayComponent,
|
|
621
|
-
FormControlsRenderDirective,
|
|
622
|
-
SpecialFormComponent] });
|
|
623
|
-
SpecialFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormModule, imports: [CommonModule,
|
|
624
|
-
MatButtonModule,
|
|
625
|
-
SpecialRichtextComponent,
|
|
626
|
-
SpecialDropdownComponent,
|
|
627
|
-
SpecialInputComponent,
|
|
628
|
-
SpecialAutocompleteComponent,
|
|
629
|
-
SpecialDatepickerComponent,
|
|
630
|
-
SpecialLabelComponent,
|
|
631
|
-
SpecialMultipleAutocompleteComponent,
|
|
632
|
-
SpecialCheckboxComponent,
|
|
633
|
-
SpecialTextAreaComponent,
|
|
634
|
-
SpecialUploadComponent] });
|
|
635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormModule, decorators: [{
|
|
636
|
-
type: NgModule,
|
|
637
|
-
args: [{
|
|
638
|
-
declarations: [
|
|
639
|
-
SpecialArrayComponent,
|
|
640
|
-
FormControlsRenderDirective,
|
|
641
|
-
SpecialFormComponent,
|
|
642
|
-
],
|
|
643
|
-
imports: [
|
|
644
|
-
CommonModule,
|
|
645
|
-
FormControlsListPipe,
|
|
646
|
-
MatButtonModule,
|
|
647
|
-
SpecialRichtextComponent,
|
|
648
|
-
SpecialDropdownComponent,
|
|
649
|
-
SpecialInputComponent,
|
|
650
|
-
SpecialAutocompleteComponent,
|
|
651
|
-
SpecialDatepickerComponent,
|
|
652
|
-
SpecialLabelComponent,
|
|
653
|
-
SpecialMultipleAutocompleteComponent,
|
|
654
|
-
SpecialCheckboxComponent,
|
|
655
|
-
SpecialTextAreaComponent,
|
|
656
|
-
SpecialUploadComponent,
|
|
657
|
-
],
|
|
658
|
-
exports: [
|
|
659
|
-
SpecialArrayComponent,
|
|
660
|
-
FormControlsRenderDirective,
|
|
661
|
-
SpecialFormComponent,
|
|
662
|
-
],
|
|
663
|
-
}]
|
|
664
|
-
}] });
|
|
665
|
-
|
|
666
|
-
class SpecialFormControl extends FormControl {
|
|
667
|
-
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, length, placeholder, readOnly, required, tooltip, errorMessages, disabled, }) {
|
|
668
|
-
super(defaultValue, validators, asyncValidators);
|
|
669
|
-
this.name = name;
|
|
670
|
-
this.placeholder = placeholder;
|
|
671
|
-
this.label = label;
|
|
672
|
-
this.tooltip = tooltip;
|
|
673
|
-
this.icon = icon;
|
|
674
|
-
this.elementId = elementId;
|
|
675
|
-
this.settings = settings;
|
|
676
|
-
this.type = type;
|
|
677
|
-
this.styleClasses = styleClasses;
|
|
678
|
-
this.hidden = hidden;
|
|
679
|
-
this.length = length;
|
|
680
|
-
this.readOnly = readOnly;
|
|
681
|
-
this.required = required;
|
|
682
|
-
this.errorMessages = errorMessages;
|
|
683
|
-
disabled ? this.disable() : this.enable();
|
|
684
|
-
}
|
|
685
|
-
markAsDirty(opts) {
|
|
686
|
-
super.markAsDirty(opts);
|
|
687
|
-
this.updateValueAndValidity();
|
|
688
|
-
}
|
|
689
|
-
markAsPristine(opts) {
|
|
690
|
-
super.markAsPristine(opts);
|
|
691
|
-
this.updateValueAndValidity();
|
|
692
|
-
}
|
|
693
|
-
markAsTouched(opts) {
|
|
694
|
-
super.markAsTouched(opts);
|
|
695
|
-
this.updateValueAndValidity();
|
|
696
|
-
}
|
|
697
|
-
markAsUntouched(opts) {
|
|
698
|
-
super.markAsUntouched(opts);
|
|
699
|
-
this.updateValueAndValidity();
|
|
700
|
-
}
|
|
701
|
-
markAllAsTouched() {
|
|
702
|
-
super.markAllAsTouched();
|
|
703
|
-
this.updateValueAndValidity();
|
|
704
|
-
}
|
|
705
|
-
setReadOnly(status = true) {
|
|
706
|
-
this.readOnly = status;
|
|
707
|
-
}
|
|
708
|
-
setDisabled(status = true) {
|
|
709
|
-
status ? this.disable() : this.enable();
|
|
710
|
-
}
|
|
711
|
-
setHidden(status = true) {
|
|
712
|
-
this.hidden = status;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
class SpecialFormGroup extends FormGroup {
|
|
716
|
-
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, length, placeholder, readOnly, required, tooltip, disabled, }, controls) {
|
|
717
|
-
super(controls, validators, asyncValidators);
|
|
718
|
-
this.name = name;
|
|
719
|
-
this.placeholder = placeholder;
|
|
720
|
-
this.label = label;
|
|
721
|
-
this.tooltip = tooltip;
|
|
722
|
-
this.icon = icon;
|
|
723
|
-
this.elementId = elementId;
|
|
724
|
-
this.settings = settings;
|
|
725
|
-
this.type = type;
|
|
726
|
-
this.styleClasses = styleClasses;
|
|
727
|
-
this.hidden = hidden;
|
|
728
|
-
this.length = length;
|
|
729
|
-
this.readOnly = readOnly;
|
|
730
|
-
this.required = required;
|
|
731
|
-
this.defaultValue = defaultValue;
|
|
732
|
-
disabled ? this.disable() : this.enable();
|
|
733
|
-
}
|
|
734
|
-
getDirty() {
|
|
735
|
-
this.markAsDirty();
|
|
736
|
-
Object.values(this.controls).forEach((control) => {
|
|
737
|
-
if (control instanceof SpecialFormControl) {
|
|
738
|
-
control.markAsDirty();
|
|
739
|
-
}
|
|
740
|
-
else if (control instanceof SpecialFormGroup) {
|
|
741
|
-
control.getDirty();
|
|
742
|
-
}
|
|
743
|
-
else if (control instanceof SpecialFormArray) {
|
|
744
|
-
control.getDirty();
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
specialReset(value = {}) {
|
|
749
|
-
const aux = {};
|
|
750
|
-
Object.entries(this.controls).map(([key, control]) => {
|
|
751
|
-
if (control instanceof SpecialFormControl) {
|
|
752
|
-
aux[key] = control.defaultValue;
|
|
753
|
-
}
|
|
754
|
-
else if (control instanceof SpecialFormArray) {
|
|
755
|
-
control.clear();
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
this.reset(Object.assign(Object.assign({}, aux), value));
|
|
759
|
-
}
|
|
760
|
-
setReadOnly(status = true) {
|
|
761
|
-
Object.values(this.controls).map((value) => {
|
|
762
|
-
if (value instanceof SpecialFormControl ||
|
|
763
|
-
value instanceof SpecialFormArray ||
|
|
764
|
-
value instanceof SpecialFormGroup) {
|
|
765
|
-
value.setReadOnly(status);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
setReadOnlyByFields(fieldsObject) {
|
|
770
|
-
Object.entries(fieldsObject).map(([key, value]) => {
|
|
771
|
-
const control = this.controls[key];
|
|
772
|
-
if (control instanceof SpecialFormControl) {
|
|
773
|
-
control.readOnly = value;
|
|
774
|
-
}
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
setHiddenByFields(fields) {
|
|
778
|
-
Object.entries(fields).map(([key, value]) => {
|
|
779
|
-
const control = this.controls[key];
|
|
780
|
-
if (control instanceof SpecialFormControl) {
|
|
781
|
-
control.hidden = value;
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
setDisabled(status) {
|
|
786
|
-
Object.values(this.controls).map((value) => {
|
|
787
|
-
if (value instanceof SpecialFormControl ||
|
|
788
|
-
value instanceof SpecialFormArray ||
|
|
789
|
-
value instanceof SpecialFormGroup) {
|
|
790
|
-
value.setDisabled(status);
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
setDisabledByFields(fieldsObject) {
|
|
795
|
-
Object.entries(fieldsObject).map((entries) => {
|
|
796
|
-
if (this.controls[entries[0]] instanceof SpecialFormControl) {
|
|
797
|
-
entries[1]
|
|
798
|
-
? this.controls[entries[0]].enable()
|
|
799
|
-
: this.controls[entries[0]].disable();
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* donde value es el objeto semilla y detailForm es un arreglo de form key para dar un marco al formarray
|
|
805
|
-
*/
|
|
806
|
-
setFormValue(value) {
|
|
807
|
-
this.specialReset(value);
|
|
808
|
-
Object.entries(this.controls)
|
|
809
|
-
.filter(([_key, control]) => control instanceof SpecialFormArray)
|
|
810
|
-
.map(([key, control]) => {
|
|
811
|
-
control.fillFormArray(value[key]);
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
/**
|
|
815
|
-
* Método que retorna
|
|
816
|
-
*/
|
|
817
|
-
getIdPkey() {
|
|
818
|
-
return Object.values(this.controls).find((control) => control instanceof SpecialFormControl && control.type === 'PRIMARY-KEY');
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
class SpecialFormArray extends FormArray {
|
|
822
|
-
constructor({ name, settings, type, validators, asyncValidators, elementId, styleClasses, defaultValue, hidden, icon, label, placeholder, readOnly, required, tooltip, errorMessages, disabled, }, formCreation, controls) {
|
|
823
|
-
super(controls, validators, asyncValidators);
|
|
824
|
-
this.formCreation = formCreation;
|
|
825
|
-
this.form = this.formCreation();
|
|
826
|
-
this.name = name;
|
|
827
|
-
this.placeholder = placeholder;
|
|
828
|
-
this.label = label;
|
|
829
|
-
this.tooltip = tooltip;
|
|
830
|
-
this.icon = icon;
|
|
831
|
-
this.elementId = elementId;
|
|
832
|
-
this.settings = settings;
|
|
833
|
-
this.type = type;
|
|
834
|
-
this.styleClasses = styleClasses;
|
|
835
|
-
this.hidden = hidden;
|
|
836
|
-
this.readOnly = readOnly;
|
|
837
|
-
this.required = required;
|
|
838
|
-
this.defaultValue = defaultValue;
|
|
839
|
-
this.errorMessages = errorMessages;
|
|
840
|
-
disabled ? this.disable() : this.enable();
|
|
841
|
-
}
|
|
842
|
-
fillFormArray(data) {
|
|
843
|
-
this.form.reset();
|
|
844
|
-
this.clear();
|
|
845
|
-
data.forEach((item) => {
|
|
846
|
-
const form = this.formCreation(item);
|
|
847
|
-
this.push(form);
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
addItem() {
|
|
851
|
-
const form = this.formCreation(this.form.value);
|
|
852
|
-
this.form.specialReset();
|
|
853
|
-
this.push(form);
|
|
854
|
-
this.markAsDirty();
|
|
855
|
-
}
|
|
856
|
-
specialPush(index) {
|
|
857
|
-
const form = this.formCreation(this.form.value);
|
|
858
|
-
if (!index)
|
|
859
|
-
this.push(form);
|
|
860
|
-
else
|
|
861
|
-
this.controls[index].reset(this.form.value);
|
|
862
|
-
}
|
|
863
|
-
specialInsert(index = 0) {
|
|
864
|
-
const form = this.formCreation(this.form.value);
|
|
865
|
-
this.insert(index, form);
|
|
866
|
-
}
|
|
867
|
-
specialEdit(index, newValue) {
|
|
868
|
-
this.controls[index].reset(Object.assign(Object.assign({}, this.controls[index].value), newValue));
|
|
869
|
-
this.markAsDirty();
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Vuelve todos los controles del formArray de lectura o de sololectura
|
|
873
|
-
* @param status
|
|
874
|
-
*/
|
|
875
|
-
setReadOnly(status) {
|
|
876
|
-
this.readOnly = status;
|
|
877
|
-
this.controls.forEach((control) => {
|
|
878
|
-
if (control instanceof SpecialFormGroup) {
|
|
879
|
-
control.setReadOnly(status);
|
|
880
|
-
}
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Vuelve todos los controles del formArray habilitados o deshabilitados
|
|
885
|
-
* @param status
|
|
886
|
-
*/
|
|
887
|
-
setDisabled(status) {
|
|
888
|
-
status ? this.disable() : this.enable();
|
|
889
|
-
this.controls.forEach((control) => {
|
|
890
|
-
if (control instanceof SpecialFormGroup) {
|
|
891
|
-
control.setDisabled(status);
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Permite editar un control especifico.
|
|
897
|
-
* @param index
|
|
898
|
-
*/
|
|
899
|
-
editControl(index) {
|
|
900
|
-
this.form.reset(this.controls[index].value);
|
|
901
|
-
}
|
|
902
|
-
getDirty() {
|
|
903
|
-
this.markAsDirty();
|
|
904
|
-
this.form.getDirty();
|
|
905
|
-
this.controls.forEach((item) => {
|
|
906
|
-
item.getDirty();
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
recursiveFillForm(form, data) {
|
|
910
|
-
Object.entries(form.controls).map(([key, control]) => {
|
|
911
|
-
if (control instanceof FormControl) {
|
|
912
|
-
control.setValue(data[key]);
|
|
913
|
-
}
|
|
914
|
-
else if (control instanceof FormArray) {
|
|
915
|
-
data[key].forEach(() => { });
|
|
916
|
-
}
|
|
917
|
-
else if (control instanceof FormGroup) {
|
|
918
|
-
control.reset(data[key]);
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
return form;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
class SpecialFormBuilderService {
|
|
926
|
-
constructor() {
|
|
927
|
-
this.defectField = {
|
|
928
|
-
asyncValidators: null,
|
|
929
|
-
validators: null,
|
|
930
|
-
defaultValue: null,
|
|
931
|
-
elementId: '',
|
|
932
|
-
hidden: false,
|
|
933
|
-
icon: '',
|
|
934
|
-
label: '',
|
|
935
|
-
disabled: false,
|
|
936
|
-
length: 0,
|
|
937
|
-
placeholder: '',
|
|
938
|
-
readOnly: false,
|
|
939
|
-
required: false,
|
|
940
|
-
styleClasses: '',
|
|
941
|
-
errorMessages: {},
|
|
942
|
-
tooltip: '',
|
|
943
|
-
};
|
|
944
|
-
this.inputDefectField = Object.assign(Object.assign({}, this.defectField), { settings: {}, type: EControlTypes.input, name: '' });
|
|
945
|
-
this.formDefectField = Object.assign(Object.assign({}, this.defectField), { settings: {
|
|
946
|
-
formFields: {},
|
|
947
|
-
}, type: EControlTypes.form, name: '' });
|
|
948
|
-
this.arrayDefectField = Object.assign(Object.assign({}, this.defectField), { settings: {
|
|
949
|
-
formFields: {},
|
|
950
|
-
}, type: EControlTypes.array, name: '' });
|
|
951
|
-
}
|
|
952
|
-
control(field) {
|
|
953
|
-
const formField = Object.assign(Object.assign({}, this.inputDefectField), field);
|
|
954
|
-
const { control } = this.setFormControl(formField);
|
|
955
|
-
return control;
|
|
956
|
-
}
|
|
957
|
-
group(fields, parentField = {}) {
|
|
958
|
-
return this.formGenerator(this.fieldDataToArray(fields), parentField);
|
|
959
|
-
}
|
|
960
|
-
array() { }
|
|
961
|
-
fieldDataToArray(fields) {
|
|
962
|
-
return Object.entries(fields).map(([name, field]) => this.setDefectFieldOptions(name, field));
|
|
963
|
-
}
|
|
964
|
-
setDefectFieldOptions(name, field) {
|
|
965
|
-
return Object.assign(Object.assign(Object.assign({}, this.inputDefectField), field), { name });
|
|
966
|
-
}
|
|
967
|
-
formGenerator(fields, parentField = {}) {
|
|
968
|
-
const formField = Object.assign(Object.assign({}, this.formDefectField), parentField);
|
|
969
|
-
const structure = fields
|
|
970
|
-
.map((field) => this.getControlAndNameByType(field))
|
|
971
|
-
.reduce((prev, { name, control }) => (Object.assign(Object.assign({}, prev), { [name]: control })), {});
|
|
972
|
-
return new SpecialFormGroup(formField, structure);
|
|
973
|
-
}
|
|
974
|
-
getControlAndNameByType(field) {
|
|
975
|
-
switch (field.type) {
|
|
976
|
-
case EControlTypes.array:
|
|
977
|
-
return this.setFormArray(field);
|
|
978
|
-
case EControlTypes.form:
|
|
979
|
-
return this.setFormGroup(field);
|
|
980
|
-
default:
|
|
981
|
-
return this.setFormControl(field);
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
setFormGroup(field) {
|
|
985
|
-
const control = this.formGenerator(this.fieldDataToArray(field.settings.formFields), field);
|
|
986
|
-
return { control, name: field.name };
|
|
987
|
-
}
|
|
988
|
-
setFormArray(field) {
|
|
989
|
-
const auxForm = (value = {}) => {
|
|
990
|
-
const auxForm = this.formGenerator(this.fieldDataToArray(field.settings.formFields), {});
|
|
991
|
-
auxForm.reset(value);
|
|
992
|
-
return auxForm;
|
|
993
|
-
};
|
|
994
|
-
if (field.required) {
|
|
995
|
-
field.validators = this.setValidatorsArray(field.validators, [
|
|
996
|
-
this.arrayLengthRequired,
|
|
997
|
-
]);
|
|
998
|
-
}
|
|
999
|
-
return {
|
|
1000
|
-
name: field.name,
|
|
1001
|
-
control: new SpecialFormArray(field, auxForm, []),
|
|
1002
|
-
};
|
|
1003
|
-
}
|
|
1004
|
-
setFormControl(field) {
|
|
1005
|
-
const validators = [];
|
|
1006
|
-
if (field.required)
|
|
1007
|
-
validators.push(this.setRequiredValidator(field));
|
|
1008
|
-
if (field.length)
|
|
1009
|
-
validators.push(Validators.maxLength(field.length));
|
|
1010
|
-
field.validators = this.setValidatorsArray(field.validators, validators);
|
|
1011
|
-
return {
|
|
1012
|
-
name: field.name,
|
|
1013
|
-
control: new SpecialFormControl(field),
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
setRequiredValidator(field) {
|
|
1017
|
-
if (field.type !== EControlTypes.autocomplete) {
|
|
1018
|
-
return Validators.required;
|
|
1019
|
-
}
|
|
1020
|
-
return (control) => !!control.value && control.value instanceof Object
|
|
1021
|
-
? null
|
|
1022
|
-
: { required: true };
|
|
1023
|
-
}
|
|
1024
|
-
setValidatorsArray(validators, newValidators) {
|
|
1025
|
-
if (!validators) {
|
|
1026
|
-
return newValidators;
|
|
1027
|
-
}
|
|
1028
|
-
return validators instanceof Array
|
|
1029
|
-
? [...validators, ...newValidators]
|
|
1030
|
-
: [validators, ...newValidators];
|
|
1031
|
-
}
|
|
1032
|
-
arrayLengthRequired(control) {
|
|
1033
|
-
if (control.value.length) {
|
|
1034
|
-
return {};
|
|
1035
|
-
}
|
|
1036
|
-
return { noItems: 'NO_SELECTED_ITEM' };
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
SpecialFormBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormBuilderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1040
|
-
SpecialFormBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormBuilderService, providedIn: 'root' });
|
|
1041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: SpecialFormBuilderService, decorators: [{
|
|
1042
|
-
type: Injectable,
|
|
1043
|
-
args: [{
|
|
1044
|
-
providedIn: 'root',
|
|
1045
|
-
}]
|
|
1046
|
-
}], ctorParameters: function () { return []; } });
|
|
1047
|
-
|
|
1048
|
-
class ErrorStateMatcherService {
|
|
1049
|
-
isErrorState(control) {
|
|
1050
|
-
return control && control.invalid && control.dirty;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
ErrorStateMatcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ErrorStateMatcherService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1054
|
-
ErrorStateMatcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ErrorStateMatcherService });
|
|
1055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ErrorStateMatcherService, decorators: [{
|
|
1056
|
-
type: Injectable
|
|
1057
|
-
}] });
|
|
1058
|
-
|
|
1059
|
-
class ISpecialControl {
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
const currencyInputMask = createMask({
|
|
1063
|
-
alias: 'numeric',
|
|
1064
|
-
groupSeparator: ',',
|
|
1065
|
-
autoUnmask: true,
|
|
1066
|
-
digits: 2,
|
|
1067
|
-
digitsOptional: false,
|
|
1068
|
-
prefix: '$ ',
|
|
1069
|
-
placeholder: '0',
|
|
1070
|
-
});
|
|
1071
|
-
|
|
1072
|
-
const numberMask = (max = 1000) => createMask({ alias: 'numeric', min: 0, max });
|
|
1073
|
-
|
|
1074
|
-
/*
|
|
1075
|
-
* Public API Surface of special-forms
|
|
1076
|
-
*/
|
|
1077
|
-
|
|
1078
|
-
/**
|
|
1079
|
-
* Generated bundle index. Do not edit.
|
|
1080
|
-
*/
|
|
1081
|
-
|
|
1082
|
-
export { EControlTypes, ErrorMessagePipe, ErrorStateMatcherService, FormControlsListPipe, FormControlsRenderDirective, ISpecialControl, SpecialArrayComponent, SpecialAutocompleteComponent, SpecialCheckboxComponent, SpecialDatepickerComponent, SpecialDropdownComponent, SpecialFormArray, SpecialFormBuilderService, SpecialFormComponent, SpecialFormControl, SpecialFormGroup, SpecialFormModule, SpecialInputComponent, SpecialLabelComponent, SpecialMultipleAutocompleteComponent, SpecialRichtextComponent, SpecialTextAreaComponent, SpecialUploadComponent, TextByFunctionPipe, currencyInputMask, numberMask };
|
|
1083
|
-
//# sourceMappingURL=special-forms.mjs.map
|