@covalent/dynamic-forms 4.0.0 → 4.1.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -18
- package/covalent-dynamic-forms.d.ts +2 -1
- package/esm2020/covalent-dynamic-forms.mjs +5 -0
- package/esm2020/lib/dynamic-element.component.mjs +178 -0
- package/esm2020/lib/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.mjs +19 -0
- package/esm2020/lib/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.mjs +23 -0
- package/esm2020/lib/dynamic-elements/dynamic-file-input/dynamic-file-input.component.mjs +28 -0
- package/esm2020/lib/dynamic-elements/dynamic-input/dynamic-input.component.mjs +22 -0
- package/esm2020/lib/dynamic-elements/dynamic-select/dynamic-select.component.mjs +23 -0
- package/esm2020/lib/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.mjs +19 -0
- package/esm2020/lib/dynamic-elements/dynamic-slider/dynamic-slider.component.mjs +26 -0
- package/esm2020/lib/dynamic-elements/dynamic-textarea/dynamic-textarea.component.mjs +22 -0
- package/esm2020/lib/dynamic-forms.component.mjs +185 -0
- package/esm2020/lib/dynamic-forms.module.mjs +127 -0
- package/esm2020/lib/services/dynamic-forms.service.mjs +140 -0
- package/esm2020/public_api.mjs +13 -0
- package/fesm2015/covalent-dynamic-forms.mjs +748 -0
- package/fesm2015/covalent-dynamic-forms.mjs.map +1 -0
- package/fesm2020/covalent-dynamic-forms.mjs +746 -0
- package/fesm2020/covalent-dynamic-forms.mjs.map +1 -0
- package/{dynamic-element.component.d.ts → lib/dynamic-element.component.d.ts} +24 -17
- package/lib/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.d.ts +11 -0
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-datepicker/dynamic-datepicker.component.d.ts +6 -3
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-file-input/dynamic-file-input.component.d.ts +4 -1
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-input/dynamic-input.component.d.ts +7 -4
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-select/dynamic-select.component.d.ts +5 -2
- package/lib/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.d.ts +11 -0
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-slider/dynamic-slider.component.d.ts +5 -2
- package/{dynamic-elements → lib/dynamic-elements}/dynamic-textarea/dynamic-textarea.component.d.ts +3 -0
- package/{dynamic-forms.component.d.ts → lib/dynamic-forms.component.d.ts} +4 -1
- package/lib/dynamic-forms.module.d.ts +28 -0
- package/{services → lib/services}/dynamic-forms.service.d.ts +5 -2
- package/package.json +32 -17
- package/public_api.d.ts +12 -12
- package/bundles/covalent-dynamic-forms.umd.js +0 -1654
- package/bundles/covalent-dynamic-forms.umd.js.map +0 -1
- package/bundles/covalent-dynamic-forms.umd.min.js +0 -16
- package/bundles/covalent-dynamic-forms.umd.min.js.map +0 -1
- package/covalent-dynamic-forms.metadata.json +0 -1
- package/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.d.ts +0 -8
- package/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.scss +0 -0
- package/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.scss +0 -12
- package/dynamic-elements/dynamic-file-input/dynamic-file-input.component.scss +0 -15
- package/dynamic-elements/dynamic-input/dynamic-input.component.scss +0 -12
- package/dynamic-elements/dynamic-select/dynamic-select.component.scss +0 -12
- package/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.d.ts +0 -8
- package/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.scss +0 -0
- package/dynamic-elements/dynamic-slider/dynamic-slider.component.scss +0 -17
- package/dynamic-elements/dynamic-textarea/dynamic-textarea.component.scss +0 -12
- package/dynamic-forms.component.scss +0 -29
- package/dynamic-forms.module.d.ts +0 -2
- package/esm2015/covalent-dynamic-forms.js +0 -10
- package/esm2015/dynamic-element.component.js +0 -340
- package/esm2015/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.js +0 -34
- package/esm2015/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.js +0 -49
- package/esm2015/dynamic-elements/dynamic-file-input/dynamic-file-input.component.js +0 -47
- package/esm2015/dynamic-elements/dynamic-input/dynamic-input.component.js +0 -55
- package/esm2015/dynamic-elements/dynamic-select/dynamic-select.component.js +0 -46
- package/esm2015/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.js +0 -34
- package/esm2015/dynamic-elements/dynamic-slider/dynamic-slider.component.js +0 -64
- package/esm2015/dynamic-elements/dynamic-textarea/dynamic-textarea.component.js +0 -40
- package/esm2015/dynamic-forms.component.js +0 -306
- package/esm2015/dynamic-forms.module.js +0 -73
- package/esm2015/index.js +0 -7
- package/esm2015/public_api.js +0 -18
- package/esm2015/services/dynamic-forms.service.js +0 -201
- package/fesm2015/covalent-dynamic-forms.js +0 -1269
- package/fesm2015/covalent-dynamic-forms.js.map +0 -1
- package/index.d.ts +0 -1
|
@@ -1,1269 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectorRef, Injectable, Optional, SkipSelf, Directive, TemplateRef, ViewContainerRef, Input, Type, forwardRef, ComponentFactoryResolver, ViewChild, HostBinding, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormControl, Validators, NG_VALUE_ACCESSOR, FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
-
import { MatInputModule } from '@angular/material/input';
|
|
6
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
7
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
8
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
9
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
10
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
12
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
13
|
-
import { mixinControlValueAccessor, CovalentCommonModule } from '@covalent/core/common';
|
|
14
|
-
import { CovalentFileModule } from '@covalent/core/file';
|
|
15
|
-
import { TemplatePortalDirective } from '@angular/cdk/portal';
|
|
16
|
-
import { Subject, timer } from 'rxjs';
|
|
17
|
-
import { filter, takeUntil } from 'rxjs/operators';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @fileoverview added by tsickle
|
|
21
|
-
* Generated from: dynamic-elements/dynamic-input/dynamic-input.component.ts
|
|
22
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
23
|
-
*/
|
|
24
|
-
class TdDynamicInputComponent {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.label = '';
|
|
27
|
-
this.hint = '';
|
|
28
|
-
this.type = undefined;
|
|
29
|
-
this.required = undefined;
|
|
30
|
-
this.name = '';
|
|
31
|
-
this.min = undefined;
|
|
32
|
-
this.max = undefined;
|
|
33
|
-
this.minLength = undefined;
|
|
34
|
-
this.maxLength = undefined;
|
|
35
|
-
this.errorMessageTemplate = undefined;
|
|
36
|
-
this.placeholder = '';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
TdDynamicInputComponent.decorators = [
|
|
40
|
-
{ type: Component, args: [{
|
|
41
|
-
selector: 'td-dynamic-input',
|
|
42
|
-
template: "<div class=\"td-dynamic-input-wrapper\">\n <mat-form-field class=\"td-dynamic-input-field\">\n <mat-label>{{ label }}</mat-label>\n <input\n #elementInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [attr.name]=\"name\"\n [attr.min]=\"min\"\n [attr.max]=\"max\"\n [attr.minLength]=\"minLength\"\n [attr.maxLength]=\"maxLength\"\n />\n <mat-hint>{{ hint }}</mat-hint>\n <mat-error>\n <ng-template\n [ngTemplateOutlet]=\"errorMessageTemplate\"\n [ngTemplateOutletContext]=\"{ control: control, errors: control?.errors }\"\n ></ng-template>\n </mat-error>\n </mat-form-field>\n</div>\n",
|
|
43
|
-
styles: [".td-dynamic-input-wrapper{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row}.td-dynamic-input-wrapper .td-dynamic-input-field{-ms-flex:1;box-sizing:border-box;flex:1}"]
|
|
44
|
-
}] }
|
|
45
|
-
];
|
|
46
|
-
if (false) {
|
|
47
|
-
/** @type {?} */
|
|
48
|
-
TdDynamicInputComponent.prototype.control;
|
|
49
|
-
/** @type {?} */
|
|
50
|
-
TdDynamicInputComponent.prototype.label;
|
|
51
|
-
/** @type {?} */
|
|
52
|
-
TdDynamicInputComponent.prototype.hint;
|
|
53
|
-
/** @type {?} */
|
|
54
|
-
TdDynamicInputComponent.prototype.type;
|
|
55
|
-
/** @type {?} */
|
|
56
|
-
TdDynamicInputComponent.prototype.required;
|
|
57
|
-
/** @type {?} */
|
|
58
|
-
TdDynamicInputComponent.prototype.name;
|
|
59
|
-
/** @type {?} */
|
|
60
|
-
TdDynamicInputComponent.prototype.min;
|
|
61
|
-
/** @type {?} */
|
|
62
|
-
TdDynamicInputComponent.prototype.max;
|
|
63
|
-
/** @type {?} */
|
|
64
|
-
TdDynamicInputComponent.prototype.minLength;
|
|
65
|
-
/** @type {?} */
|
|
66
|
-
TdDynamicInputComponent.prototype.maxLength;
|
|
67
|
-
/** @type {?} */
|
|
68
|
-
TdDynamicInputComponent.prototype.errorMessageTemplate;
|
|
69
|
-
/** @type {?} */
|
|
70
|
-
TdDynamicInputComponent.prototype.placeholder;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @fileoverview added by tsickle
|
|
75
|
-
* Generated from: dynamic-elements/dynamic-file-input/dynamic-file-input.component.ts
|
|
76
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
77
|
-
*/
|
|
78
|
-
class TdDynamicFileInputComponent {
|
|
79
|
-
constructor() {
|
|
80
|
-
this.required = undefined;
|
|
81
|
-
this.label = '';
|
|
82
|
-
this.name = '';
|
|
83
|
-
this.hint = '';
|
|
84
|
-
this.errorMessageTemplate = undefined;
|
|
85
|
-
this.placeholder = '';
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @param {?} value
|
|
89
|
-
* @return {?}
|
|
90
|
-
*/
|
|
91
|
-
_handlefileDrop(value) {
|
|
92
|
-
this.control.setValue(value);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
TdDynamicFileInputComponent.decorators = [
|
|
96
|
-
{ type: Component, args: [{
|
|
97
|
-
selector: 'td-dynamic-file-input',
|
|
98
|
-
template: "<div class=\"td-dynamic-file-input-wrapper\">\n <mat-form-field\n tdFileDrop\n class=\"td-dynamic-file-input-field\"\n floatLabel=\"never\"\n [disabled]=\"control?.disabled\"\n (fileDrop)=\"_handlefileDrop($event)\"\n (click)=\"!control?.disabled && fileInput.inputElement.click()\"\n (keyup.enter)=\"!control?.disabled && fileInput.inputElement.click()\"\n (keyup.delete)=\"fileInput.clear()\"\n (keyup.backspace)=\"fileInput.clear()\"\n >\n <mat-label>{{ label }}</mat-label>\n <input\n matInput\n [value]=\"control?.value?.name\"\n [placeholder]=\"placeholder\"\n [attr.name]=\"name\"\n [disabled]=\"control?.disabled\"\n readonly\n />\n <mat-hint>{{ hint }}</mat-hint>\n <mat-error>\n <ng-template\n [ngTemplateOutlet]=\"errorMessageTemplate\"\n [ngTemplateOutletContext]=\"{ control: control, errors: control?.errors }\"\n ></ng-template>\n </mat-error>\n </mat-form-field>\n <button mat-icon-button *ngIf=\"control.value\" (click)=\"fileInput.clear()\" (keyup.enter)=\"fileInput.clear()\">\n <mat-icon>cancel</mat-icon>\n </button>\n <td-file-input class=\"td-file-input\" #fileInput [formControl]=\"control\">\n <mat-icon>folder</mat-icon>\n <span>{{ label }}</span>\n </td-file-input>\n</div>\n",
|
|
99
|
-
styles: [".td-dynamic-file-input-wrapper{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row}.td-dynamic-file-input-wrapper .td-dynamic-file-input-field{-ms-flex:1;box-sizing:border-box;flex:1}.td-file-input{margin-left:10px}"]
|
|
100
|
-
}] }
|
|
101
|
-
];
|
|
102
|
-
if (false) {
|
|
103
|
-
/** @type {?} */
|
|
104
|
-
TdDynamicFileInputComponent.prototype.control;
|
|
105
|
-
/** @type {?} */
|
|
106
|
-
TdDynamicFileInputComponent.prototype.required;
|
|
107
|
-
/** @type {?} */
|
|
108
|
-
TdDynamicFileInputComponent.prototype.label;
|
|
109
|
-
/** @type {?} */
|
|
110
|
-
TdDynamicFileInputComponent.prototype.name;
|
|
111
|
-
/** @type {?} */
|
|
112
|
-
TdDynamicFileInputComponent.prototype.hint;
|
|
113
|
-
/** @type {?} */
|
|
114
|
-
TdDynamicFileInputComponent.prototype.errorMessageTemplate;
|
|
115
|
-
/** @type {?} */
|
|
116
|
-
TdDynamicFileInputComponent.prototype.placeholder;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @fileoverview added by tsickle
|
|
121
|
-
* Generated from: dynamic-elements/dynamic-textarea/dynamic-textarea.component.ts
|
|
122
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
123
|
-
*/
|
|
124
|
-
class TdDynamicTextareaComponent {
|
|
125
|
-
constructor() {
|
|
126
|
-
this.label = '';
|
|
127
|
-
this.hint = '';
|
|
128
|
-
this.name = '';
|
|
129
|
-
this.required = undefined;
|
|
130
|
-
this.errorMessageTemplate = undefined;
|
|
131
|
-
this.placeholder = '';
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
TdDynamicTextareaComponent.decorators = [
|
|
135
|
-
{ type: Component, args: [{
|
|
136
|
-
selector: 'td-dynamic-textarea',
|
|
137
|
-
template: "<div class=\"td-dynamic-textarea-wrapper\">\n <mat-form-field class=\"td-dynamic-textarea-field\">\n <mat-label>{{ label }}</mat-label>\n <textarea\n #elementInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [attr.name]=\"name\"\n rows=\"4\"\n ></textarea>\n <mat-hint>{{ hint }}</mat-hint>\n <mat-error>\n <ng-template\n [ngTemplateOutlet]=\"errorMessageTemplate\"\n [ngTemplateOutletContext]=\"{ control: control, errors: control?.errors }\"\n ></ng-template>\n </mat-error>\n </mat-form-field>\n</div>\n",
|
|
138
|
-
styles: [".td-dynamic-textarea-wrapper{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row}.td-dynamic-textarea-wrapper .td-dynamic-textarea-field{-ms-flex:1;box-sizing:border-box;flex:1}"]
|
|
139
|
-
}] }
|
|
140
|
-
];
|
|
141
|
-
if (false) {
|
|
142
|
-
/** @type {?} */
|
|
143
|
-
TdDynamicTextareaComponent.prototype.control;
|
|
144
|
-
/** @type {?} */
|
|
145
|
-
TdDynamicTextareaComponent.prototype.label;
|
|
146
|
-
/** @type {?} */
|
|
147
|
-
TdDynamicTextareaComponent.prototype.hint;
|
|
148
|
-
/** @type {?} */
|
|
149
|
-
TdDynamicTextareaComponent.prototype.name;
|
|
150
|
-
/** @type {?} */
|
|
151
|
-
TdDynamicTextareaComponent.prototype.required;
|
|
152
|
-
/** @type {?} */
|
|
153
|
-
TdDynamicTextareaComponent.prototype.errorMessageTemplate;
|
|
154
|
-
/** @type {?} */
|
|
155
|
-
TdDynamicTextareaComponent.prototype.placeholder;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @fileoverview added by tsickle
|
|
160
|
-
* Generated from: dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.ts
|
|
161
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
162
|
-
*/
|
|
163
|
-
class TdDynamicSlideToggleComponent {
|
|
164
|
-
constructor() {
|
|
165
|
-
this.label = '';
|
|
166
|
-
this.name = '';
|
|
167
|
-
this.hint = '';
|
|
168
|
-
this.required = false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
TdDynamicSlideToggleComponent.decorators = [
|
|
172
|
-
{ type: Component, args: [{
|
|
173
|
-
selector: 'td-dynamic-slide-toggle',
|
|
174
|
-
template: "<div class=\"td-dynamic-slide-toggle-wrapper\">\n <mat-slide-toggle [formControl]=\"control\" [attr.name]=\"name\" [required]=\"required\">\n {{ label }}\n </mat-slide-toggle>\n <span class=\"mat-hint td-dynamic-element-hint\">{{ hint }}</span>\n</div>\n",
|
|
175
|
-
styles: [""]
|
|
176
|
-
}] }
|
|
177
|
-
];
|
|
178
|
-
if (false) {
|
|
179
|
-
/** @type {?} */
|
|
180
|
-
TdDynamicSlideToggleComponent.prototype.control;
|
|
181
|
-
/** @type {?} */
|
|
182
|
-
TdDynamicSlideToggleComponent.prototype.label;
|
|
183
|
-
/** @type {?} */
|
|
184
|
-
TdDynamicSlideToggleComponent.prototype.name;
|
|
185
|
-
/** @type {?} */
|
|
186
|
-
TdDynamicSlideToggleComponent.prototype.hint;
|
|
187
|
-
/** @type {?} */
|
|
188
|
-
TdDynamicSlideToggleComponent.prototype.required;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @fileoverview added by tsickle
|
|
193
|
-
* Generated from: dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.ts
|
|
194
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
195
|
-
*/
|
|
196
|
-
class TdDynamicCheckboxComponent {
|
|
197
|
-
constructor() {
|
|
198
|
-
this.label = '';
|
|
199
|
-
this.name = '';
|
|
200
|
-
this.hint = '';
|
|
201
|
-
this.required = false;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
TdDynamicCheckboxComponent.decorators = [
|
|
205
|
-
{ type: Component, args: [{
|
|
206
|
-
selector: 'td-dynamic-checkbox',
|
|
207
|
-
template: "<div class=\"td-dynamic-checkbox-wrapper\">\n <mat-checkbox [formControl]=\"control\" [name]=\"name\" [required]=\"required\">\n {{ label }}\n </mat-checkbox>\n <span class=\"mat-hint td-dynamic-element-hint\">{{ hint }}</span>\n</div>\n",
|
|
208
|
-
styles: [""]
|
|
209
|
-
}] }
|
|
210
|
-
];
|
|
211
|
-
if (false) {
|
|
212
|
-
/** @type {?} */
|
|
213
|
-
TdDynamicCheckboxComponent.prototype.control;
|
|
214
|
-
/** @type {?} */
|
|
215
|
-
TdDynamicCheckboxComponent.prototype.label;
|
|
216
|
-
/** @type {?} */
|
|
217
|
-
TdDynamicCheckboxComponent.prototype.name;
|
|
218
|
-
/** @type {?} */
|
|
219
|
-
TdDynamicCheckboxComponent.prototype.hint;
|
|
220
|
-
/** @type {?} */
|
|
221
|
-
TdDynamicCheckboxComponent.prototype.required;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @fileoverview added by tsickle
|
|
226
|
-
* Generated from: dynamic-elements/dynamic-slider/dynamic-slider.component.ts
|
|
227
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
228
|
-
*/
|
|
229
|
-
class TdDynamicSliderComponent {
|
|
230
|
-
/**
|
|
231
|
-
* @param {?} _changeDetectorRef
|
|
232
|
-
*/
|
|
233
|
-
constructor(_changeDetectorRef) {
|
|
234
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
235
|
-
this.label = '';
|
|
236
|
-
this.required = undefined;
|
|
237
|
-
this.name = '';
|
|
238
|
-
this.hint = '';
|
|
239
|
-
this.min = undefined;
|
|
240
|
-
this.max = undefined;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* @return {?}
|
|
244
|
-
*/
|
|
245
|
-
_handleBlur() {
|
|
246
|
-
setTimeout((/**
|
|
247
|
-
* @return {?}
|
|
248
|
-
*/
|
|
249
|
-
() => {
|
|
250
|
-
this._changeDetectorRef.markForCheck();
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
TdDynamicSliderComponent.decorators = [
|
|
255
|
-
{ type: Component, args: [{
|
|
256
|
-
selector: 'td-dynamic-slider',
|
|
257
|
-
template: "<div\n class=\"td-dynamic-slider-wrapper mat-form-field mat-form-field-can-float mat-form-field-should-float\"\n [class.mat-focused]=\"slider._isActive\"\n>\n <span class=\"mat-form-field-label-wrapper\">\n <label class=\"mat-form-field-label mat-primary td-slider-label\">\n {{ label }}\n <span *ngIf=\"required && !control?.disabled\" class=\"mat-form-field-required-marker\">*</span>\n </label>\n </span>\n <div class=\"td-dynamic-slider-field\">\n <mat-slider\n #slider\n class=\"td-dynamic-slider\"\n [formControl]=\"control\"\n [attr.name]=\"name\"\n [min]=\"min\"\n [max]=\"max\"\n thumbLabel\n tickInterval=\"auto\"\n [required]=\"required\"\n (blur)=\"_handleBlur()\"\n ></mat-slider>\n </div>\n <span class=\"mat-hint td-dynamic-element-hint\">{{ hint }}</span>\n</div>\n",
|
|
258
|
-
styles: [":host .td-dynamic-slider-wrapper{display:block}.td-dynamic-slider-field{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row;position:relative}.td-dynamic-slider-field .td-dynamic-slider{-ms-flex:1;flex:1}"]
|
|
259
|
-
}] }
|
|
260
|
-
];
|
|
261
|
-
/** @nocollapse */
|
|
262
|
-
TdDynamicSliderComponent.ctorParameters = () => [
|
|
263
|
-
{ type: ChangeDetectorRef }
|
|
264
|
-
];
|
|
265
|
-
if (false) {
|
|
266
|
-
/** @type {?} */
|
|
267
|
-
TdDynamicSliderComponent.prototype.control;
|
|
268
|
-
/** @type {?} */
|
|
269
|
-
TdDynamicSliderComponent.prototype.label;
|
|
270
|
-
/** @type {?} */
|
|
271
|
-
TdDynamicSliderComponent.prototype.required;
|
|
272
|
-
/** @type {?} */
|
|
273
|
-
TdDynamicSliderComponent.prototype.name;
|
|
274
|
-
/** @type {?} */
|
|
275
|
-
TdDynamicSliderComponent.prototype.hint;
|
|
276
|
-
/** @type {?} */
|
|
277
|
-
TdDynamicSliderComponent.prototype.min;
|
|
278
|
-
/** @type {?} */
|
|
279
|
-
TdDynamicSliderComponent.prototype.max;
|
|
280
|
-
/**
|
|
281
|
-
* @type {?}
|
|
282
|
-
* @private
|
|
283
|
-
*/
|
|
284
|
-
TdDynamicSliderComponent.prototype._changeDetectorRef;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @fileoverview added by tsickle
|
|
289
|
-
* Generated from: dynamic-elements/dynamic-select/dynamic-select.component.ts
|
|
290
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
291
|
-
*/
|
|
292
|
-
class TdDynamicSelectComponent {
|
|
293
|
-
constructor() {
|
|
294
|
-
this.label = '';
|
|
295
|
-
this.hint = '';
|
|
296
|
-
this.name = '';
|
|
297
|
-
this.required = undefined;
|
|
298
|
-
this.selections = undefined;
|
|
299
|
-
this.multiple = undefined;
|
|
300
|
-
this.errorMessageTemplate = undefined;
|
|
301
|
-
this.placeholder = '';
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
TdDynamicSelectComponent.decorators = [
|
|
305
|
-
{ type: Component, args: [{
|
|
306
|
-
selector: 'td-dynamic-select',
|
|
307
|
-
template: "<div class=\"td-dynamic-select-wrapper\">\n <mat-form-field class=\"td-dynamic-select-field\">\n <mat-label>{{ label }}</mat-label>\n <mat-select\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [attr.name]=\"name\"\n [multiple]=\"multiple\"\n >\n <mat-option *ngFor=\"let selection of selections\" [value]=\"selection.value || selection\">\n {{ selection.label || selection }}\n </mat-option>\n </mat-select>\n <mat-hint>{{ hint }}</mat-hint>\n <mat-error>\n <ng-template\n [ngTemplateOutlet]=\"errorMessageTemplate\"\n [ngTemplateOutletContext]=\"{ control: control, errors: control?.errors }\"\n ></ng-template>\n </mat-error>\n </mat-form-field>\n</div>\n",
|
|
308
|
-
styles: [".td-dynamic-select-wrapper{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row}.td-dynamic-select-wrapper .td-dynamic-select-field{-ms-flex:1;box-sizing:border-box;flex:1}"]
|
|
309
|
-
}] }
|
|
310
|
-
];
|
|
311
|
-
if (false) {
|
|
312
|
-
/** @type {?} */
|
|
313
|
-
TdDynamicSelectComponent.prototype.control;
|
|
314
|
-
/** @type {?} */
|
|
315
|
-
TdDynamicSelectComponent.prototype.label;
|
|
316
|
-
/** @type {?} */
|
|
317
|
-
TdDynamicSelectComponent.prototype.hint;
|
|
318
|
-
/** @type {?} */
|
|
319
|
-
TdDynamicSelectComponent.prototype.name;
|
|
320
|
-
/** @type {?} */
|
|
321
|
-
TdDynamicSelectComponent.prototype.required;
|
|
322
|
-
/** @type {?} */
|
|
323
|
-
TdDynamicSelectComponent.prototype.selections;
|
|
324
|
-
/** @type {?} */
|
|
325
|
-
TdDynamicSelectComponent.prototype.multiple;
|
|
326
|
-
/** @type {?} */
|
|
327
|
-
TdDynamicSelectComponent.prototype.errorMessageTemplate;
|
|
328
|
-
/** @type {?} */
|
|
329
|
-
TdDynamicSelectComponent.prototype.placeholder;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* @fileoverview added by tsickle
|
|
334
|
-
* Generated from: dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.ts
|
|
335
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
336
|
-
*/
|
|
337
|
-
class TdDynamicDatepickerComponent {
|
|
338
|
-
constructor() {
|
|
339
|
-
this.label = '';
|
|
340
|
-
this.hint = '';
|
|
341
|
-
this.name = '';
|
|
342
|
-
this.type = undefined;
|
|
343
|
-
this.required = undefined;
|
|
344
|
-
this.min = undefined;
|
|
345
|
-
this.max = undefined;
|
|
346
|
-
this.errorMessageTemplate = undefined;
|
|
347
|
-
this.placeholder = '';
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
TdDynamicDatepickerComponent.decorators = [
|
|
351
|
-
{ type: Component, args: [{
|
|
352
|
-
selector: 'td-dynamic-datepicker',
|
|
353
|
-
template: "<div class=\"td-dynamic-datepicker-wrapper\">\n <mat-form-field class=\"td-dynamic-datepicker-field\">\n <mat-label>{{ label }}</mat-label>\n <input\n #elementInput\n matInput\n [matDatepicker]=\"dynamicDatePicker\"\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [required]=\"required\"\n [name]=\"name\"\n [min]=\"min\"\n [max]=\"max\"\n />\n <mat-hint>{{ hint }}</mat-hint>\n <mat-error>\n <ng-template\n [ngTemplateOutlet]=\"errorMessageTemplate\"\n [ngTemplateOutletContext]=\"{ control: control, errors: control?.errors }\"\n ></ng-template>\n </mat-error>\n <mat-datepicker-toggle matSuffix [for]=\"dynamicDatePicker\"></mat-datepicker-toggle>\n <mat-datepicker #dynamicDatePicker></mat-datepicker>\n </mat-form-field>\n</div>\n",
|
|
354
|
-
styles: [".td-dynamic-datepicker-wrapper{-ms-flex-direction:row;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row}.td-dynamic-datepicker-wrapper .td-dynamic-datepicker-field{-ms-flex:1;box-sizing:border-box;flex:1}"]
|
|
355
|
-
}] }
|
|
356
|
-
];
|
|
357
|
-
if (false) {
|
|
358
|
-
/** @type {?} */
|
|
359
|
-
TdDynamicDatepickerComponent.prototype.control;
|
|
360
|
-
/** @type {?} */
|
|
361
|
-
TdDynamicDatepickerComponent.prototype.label;
|
|
362
|
-
/** @type {?} */
|
|
363
|
-
TdDynamicDatepickerComponent.prototype.hint;
|
|
364
|
-
/** @type {?} */
|
|
365
|
-
TdDynamicDatepickerComponent.prototype.name;
|
|
366
|
-
/** @type {?} */
|
|
367
|
-
TdDynamicDatepickerComponent.prototype.type;
|
|
368
|
-
/** @type {?} */
|
|
369
|
-
TdDynamicDatepickerComponent.prototype.required;
|
|
370
|
-
/** @type {?} */
|
|
371
|
-
TdDynamicDatepickerComponent.prototype.min;
|
|
372
|
-
/** @type {?} */
|
|
373
|
-
TdDynamicDatepickerComponent.prototype.max;
|
|
374
|
-
/** @type {?} */
|
|
375
|
-
TdDynamicDatepickerComponent.prototype.errorMessageTemplate;
|
|
376
|
-
/** @type {?} */
|
|
377
|
-
TdDynamicDatepickerComponent.prototype.placeholder;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* @fileoverview added by tsickle
|
|
382
|
-
* Generated from: services/dynamic-forms.service.ts
|
|
383
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
384
|
-
*/
|
|
385
|
-
/** @enum {string} */
|
|
386
|
-
const TdDynamicType = {
|
|
387
|
-
Text: "text",
|
|
388
|
-
Boolean: "boolean",
|
|
389
|
-
Number: "number",
|
|
390
|
-
Array: "array",
|
|
391
|
-
Date: "date",
|
|
392
|
-
};
|
|
393
|
-
/** @enum {string} */
|
|
394
|
-
const TdDynamicElement = {
|
|
395
|
-
Input: "input",
|
|
396
|
-
Datepicker: "datepicker",
|
|
397
|
-
Password: "password",
|
|
398
|
-
Textarea: "textarea",
|
|
399
|
-
Slider: "slider",
|
|
400
|
-
SlideToggle: "slide-toggle",
|
|
401
|
-
Checkbox: "checkbox",
|
|
402
|
-
Select: "select",
|
|
403
|
-
FileInput: "file-input",
|
|
404
|
-
};
|
|
405
|
-
/**
|
|
406
|
-
* @record
|
|
407
|
-
*/
|
|
408
|
-
function ITdDynamicElementValidator() { }
|
|
409
|
-
if (false) {
|
|
410
|
-
/** @type {?} */
|
|
411
|
-
ITdDynamicElementValidator.prototype.validator;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* @record
|
|
415
|
-
*/
|
|
416
|
-
function ITdDynamicElementCustomConfig() { }
|
|
417
|
-
/**
|
|
418
|
-
* @record
|
|
419
|
-
*/
|
|
420
|
-
function ITdDynamicElementConfig() { }
|
|
421
|
-
if (false) {
|
|
422
|
-
/** @type {?|undefined} */
|
|
423
|
-
ITdDynamicElementConfig.prototype.label;
|
|
424
|
-
/** @type {?} */
|
|
425
|
-
ITdDynamicElementConfig.prototype.name;
|
|
426
|
-
/** @type {?|undefined} */
|
|
427
|
-
ITdDynamicElementConfig.prototype.hint;
|
|
428
|
-
/** @type {?} */
|
|
429
|
-
ITdDynamicElementConfig.prototype.type;
|
|
430
|
-
/** @type {?|undefined} */
|
|
431
|
-
ITdDynamicElementConfig.prototype.required;
|
|
432
|
-
/** @type {?|undefined} */
|
|
433
|
-
ITdDynamicElementConfig.prototype.disabled;
|
|
434
|
-
/** @type {?|undefined} */
|
|
435
|
-
ITdDynamicElementConfig.prototype.min;
|
|
436
|
-
/** @type {?|undefined} */
|
|
437
|
-
ITdDynamicElementConfig.prototype.max;
|
|
438
|
-
/** @type {?|undefined} */
|
|
439
|
-
ITdDynamicElementConfig.prototype.minLength;
|
|
440
|
-
/** @type {?|undefined} */
|
|
441
|
-
ITdDynamicElementConfig.prototype.maxLength;
|
|
442
|
-
/** @type {?|undefined} */
|
|
443
|
-
ITdDynamicElementConfig.prototype.selections;
|
|
444
|
-
/** @type {?|undefined} */
|
|
445
|
-
ITdDynamicElementConfig.prototype.multiple;
|
|
446
|
-
/** @type {?|undefined} */
|
|
447
|
-
ITdDynamicElementConfig.prototype.default;
|
|
448
|
-
/** @type {?|undefined} */
|
|
449
|
-
ITdDynamicElementConfig.prototype.flex;
|
|
450
|
-
/** @type {?|undefined} */
|
|
451
|
-
ITdDynamicElementConfig.prototype.validators;
|
|
452
|
-
/** @type {?|undefined} */
|
|
453
|
-
ITdDynamicElementConfig.prototype.customConfig;
|
|
454
|
-
/** @type {?|undefined} */
|
|
455
|
-
ITdDynamicElementConfig.prototype.placeholder;
|
|
456
|
-
}
|
|
457
|
-
/** @type {?} */
|
|
458
|
-
const DYNAMIC_ELEMENT_NAME_REGEX = /^[^0-9][^\@]*$/;
|
|
459
|
-
class TdDynamicFormsService {
|
|
460
|
-
/**
|
|
461
|
-
* Method to validate if the [name] is a proper element name.
|
|
462
|
-
* Throws error if name is not valid.
|
|
463
|
-
* @param {?} name
|
|
464
|
-
* @return {?}
|
|
465
|
-
*/
|
|
466
|
-
validateDynamicElementName(name) {
|
|
467
|
-
if (!DYNAMIC_ELEMENT_NAME_REGEX.test(name)) {
|
|
468
|
-
throw new Error('Dynamic element name: "${name}" is not valid.');
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Gets component to be rendered depending on [TdDynamicElement | TdDynamicType]
|
|
473
|
-
* Throws error if it does not exists or not supported.
|
|
474
|
-
* @param {?} element
|
|
475
|
-
* @return {?}
|
|
476
|
-
*/
|
|
477
|
-
getDynamicElement(element) {
|
|
478
|
-
switch (element) {
|
|
479
|
-
case TdDynamicType.Text:
|
|
480
|
-
case TdDynamicType.Number:
|
|
481
|
-
case TdDynamicElement.Input:
|
|
482
|
-
case TdDynamicElement.Password:
|
|
483
|
-
return TdDynamicInputComponent;
|
|
484
|
-
case TdDynamicElement.Textarea:
|
|
485
|
-
return TdDynamicTextareaComponent;
|
|
486
|
-
case TdDynamicType.Boolean:
|
|
487
|
-
case TdDynamicElement.SlideToggle:
|
|
488
|
-
return TdDynamicSlideToggleComponent;
|
|
489
|
-
case TdDynamicElement.Checkbox:
|
|
490
|
-
return TdDynamicCheckboxComponent;
|
|
491
|
-
case TdDynamicElement.Slider:
|
|
492
|
-
return TdDynamicSliderComponent;
|
|
493
|
-
case TdDynamicType.Array:
|
|
494
|
-
case TdDynamicElement.Select:
|
|
495
|
-
return TdDynamicSelectComponent;
|
|
496
|
-
case TdDynamicElement.FileInput:
|
|
497
|
-
return TdDynamicFileInputComponent;
|
|
498
|
-
case TdDynamicElement.Datepicker:
|
|
499
|
-
case TdDynamicType.Date:
|
|
500
|
-
return TdDynamicDatepickerComponent;
|
|
501
|
-
default:
|
|
502
|
-
throw new Error(`Error: type ${element} does not exist or not supported.`);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Creates form control for element depending [ITdDynamicElementConfig] properties.
|
|
507
|
-
* @param {?} config
|
|
508
|
-
* @return {?}
|
|
509
|
-
*/
|
|
510
|
-
createFormControl(config) {
|
|
511
|
-
/** @type {?} */
|
|
512
|
-
const validator = this.createValidators(config);
|
|
513
|
-
return new FormControl({ value: config.default, disabled: config.disabled }, validator);
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Creates form validationdepending [ITdDynamicElementConfig] properties.
|
|
517
|
-
* @param {?} config
|
|
518
|
-
* @return {?}
|
|
519
|
-
*/
|
|
520
|
-
createValidators(config) {
|
|
521
|
-
/** @type {?} */
|
|
522
|
-
let validator;
|
|
523
|
-
if (config.required) {
|
|
524
|
-
validator = Validators.required;
|
|
525
|
-
}
|
|
526
|
-
if (config.max || config.max === 0) {
|
|
527
|
-
validator = Validators.compose([validator, Validators.max(parseFloat(config.max))]);
|
|
528
|
-
}
|
|
529
|
-
if (config.min || config.min === 0) {
|
|
530
|
-
validator = Validators.compose([validator, Validators.min(parseFloat(config.min))]);
|
|
531
|
-
}
|
|
532
|
-
if (config.maxLength || config.maxLength === 0) {
|
|
533
|
-
validator = Validators.compose([validator, Validators.maxLength(parseFloat(config.maxLength))]);
|
|
534
|
-
}
|
|
535
|
-
if (config.minLength || config.minLength === 0) {
|
|
536
|
-
validator = Validators.compose([validator, Validators.minLength(parseFloat(config.minLength))]);
|
|
537
|
-
}
|
|
538
|
-
// Add provided custom validators to the validator function
|
|
539
|
-
if (config.validators) {
|
|
540
|
-
config.validators.forEach((/**
|
|
541
|
-
* @param {?} validatorConfig
|
|
542
|
-
* @return {?}
|
|
543
|
-
*/
|
|
544
|
-
(validatorConfig) => {
|
|
545
|
-
validator = Validators.compose([validator, validatorConfig.validator]);
|
|
546
|
-
}));
|
|
547
|
-
}
|
|
548
|
-
return validator;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
TdDynamicFormsService.decorators = [
|
|
552
|
-
{ type: Injectable }
|
|
553
|
-
];
|
|
554
|
-
/**
|
|
555
|
-
* @param {?} parent
|
|
556
|
-
* @return {?}
|
|
557
|
-
*/
|
|
558
|
-
function DYNAMIC_FORMS_PROVIDER_FACTORY(parent) {
|
|
559
|
-
return parent || new TdDynamicFormsService();
|
|
560
|
-
}
|
|
561
|
-
/** @type {?} */
|
|
562
|
-
const DYNAMIC_FORMS_PROVIDER = {
|
|
563
|
-
// If there is already a service available, use that. Otherwise, provide a new one.
|
|
564
|
-
provide: TdDynamicFormsService,
|
|
565
|
-
deps: [[new Optional(), new SkipSelf(), TdDynamicFormsService]],
|
|
566
|
-
useFactory: DYNAMIC_FORMS_PROVIDER_FACTORY,
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* @fileoverview added by tsickle
|
|
571
|
-
* Generated from: dynamic-element.component.ts
|
|
572
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
573
|
-
*/
|
|
574
|
-
class TdDynamicElementBase {
|
|
575
|
-
/**
|
|
576
|
-
* @param {?} _changeDetectorRef
|
|
577
|
-
*/
|
|
578
|
-
constructor(_changeDetectorRef) {
|
|
579
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
if (false) {
|
|
583
|
-
/** @type {?} */
|
|
584
|
-
TdDynamicElementBase.prototype._changeDetectorRef;
|
|
585
|
-
}
|
|
586
|
-
/* tslint:disable-next-line */
|
|
587
|
-
/** @type {?} */
|
|
588
|
-
const _TdDynamicElementMixinBase = mixinControlValueAccessor(TdDynamicElementBase);
|
|
589
|
-
class TdDynamicFormsErrorTemplateDirective extends TemplatePortalDirective {
|
|
590
|
-
/**
|
|
591
|
-
* @param {?} templateRef
|
|
592
|
-
* @param {?} viewContainerRef
|
|
593
|
-
*/
|
|
594
|
-
constructor(templateRef, viewContainerRef) {
|
|
595
|
-
super(templateRef, viewContainerRef);
|
|
596
|
-
this.templateRef = templateRef;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
TdDynamicFormsErrorTemplateDirective.decorators = [
|
|
600
|
-
{ type: Directive, args: [{ selector: '[tdDynamicFormsError]ng-template' },] }
|
|
601
|
-
];
|
|
602
|
-
/** @nocollapse */
|
|
603
|
-
TdDynamicFormsErrorTemplateDirective.ctorParameters = () => [
|
|
604
|
-
{ type: TemplateRef },
|
|
605
|
-
{ type: ViewContainerRef }
|
|
606
|
-
];
|
|
607
|
-
TdDynamicFormsErrorTemplateDirective.propDecorators = {
|
|
608
|
-
tdDynamicFormsError: [{ type: Input }]
|
|
609
|
-
};
|
|
610
|
-
if (false) {
|
|
611
|
-
/** @type {?} */
|
|
612
|
-
TdDynamicFormsErrorTemplateDirective.prototype.tdDynamicFormsError;
|
|
613
|
-
/** @type {?} */
|
|
614
|
-
TdDynamicFormsErrorTemplateDirective.prototype.templateRef;
|
|
615
|
-
}
|
|
616
|
-
class TdDynamicElementDirective {
|
|
617
|
-
/**
|
|
618
|
-
* @param {?} viewContainer
|
|
619
|
-
*/
|
|
620
|
-
constructor(viewContainer) {
|
|
621
|
-
this.viewContainer = viewContainer;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
TdDynamicElementDirective.decorators = [
|
|
625
|
-
{ type: Directive, args: [{
|
|
626
|
-
selector: '[tdDynamicContainer]',
|
|
627
|
-
},] }
|
|
628
|
-
];
|
|
629
|
-
/** @nocollapse */
|
|
630
|
-
TdDynamicElementDirective.ctorParameters = () => [
|
|
631
|
-
{ type: ViewContainerRef }
|
|
632
|
-
];
|
|
633
|
-
if (false) {
|
|
634
|
-
/** @type {?} */
|
|
635
|
-
TdDynamicElementDirective.prototype.viewContainer;
|
|
636
|
-
}
|
|
637
|
-
class TdDynamicElementComponent extends _TdDynamicElementMixinBase {
|
|
638
|
-
/**
|
|
639
|
-
* @param {?} _componentFactoryResolver
|
|
640
|
-
* @param {?} _dynamicFormsService
|
|
641
|
-
* @param {?} _changeDetectorRef
|
|
642
|
-
*/
|
|
643
|
-
constructor(_componentFactoryResolver, _dynamicFormsService, _changeDetectorRef) {
|
|
644
|
-
super(_changeDetectorRef);
|
|
645
|
-
this._componentFactoryResolver = _componentFactoryResolver;
|
|
646
|
-
this._dynamicFormsService = _dynamicFormsService;
|
|
647
|
-
/**
|
|
648
|
-
* Sets label to be displayed.
|
|
649
|
-
*/
|
|
650
|
-
this.label = '';
|
|
651
|
-
/**
|
|
652
|
-
* Sets hint to be displayed.
|
|
653
|
-
*/
|
|
654
|
-
this.hint = '';
|
|
655
|
-
/**
|
|
656
|
-
* Sets name to be displayed as attribute.
|
|
657
|
-
*/
|
|
658
|
-
this.name = '';
|
|
659
|
-
/**
|
|
660
|
-
* Sets type or element of element to be rendered.
|
|
661
|
-
* Throws error if does not exist or no supported.
|
|
662
|
-
*/
|
|
663
|
-
this.type = undefined;
|
|
664
|
-
/**
|
|
665
|
-
* Sets required validation checkup (if supported by element).
|
|
666
|
-
*/
|
|
667
|
-
this.required = undefined;
|
|
668
|
-
/**
|
|
669
|
-
* Sets min validation checkup (if supported by element).
|
|
670
|
-
*/
|
|
671
|
-
this.min = undefined;
|
|
672
|
-
/**
|
|
673
|
-
* Sets max validation checkup (if supported by element).
|
|
674
|
-
*/
|
|
675
|
-
this.max = undefined;
|
|
676
|
-
/**
|
|
677
|
-
* Sets minLength validation checkup (if supported by element).
|
|
678
|
-
*/
|
|
679
|
-
this.minLength = undefined;
|
|
680
|
-
/**
|
|
681
|
-
* Sets maxLength validation checkup (if supported by element).
|
|
682
|
-
*/
|
|
683
|
-
this.maxLength = undefined;
|
|
684
|
-
/**
|
|
685
|
-
* Sets selections for array elements (if supported by element).
|
|
686
|
-
*/
|
|
687
|
-
this.selections = undefined;
|
|
688
|
-
/**
|
|
689
|
-
* Sets multiple property for array elements (if supported by element).
|
|
690
|
-
*/
|
|
691
|
-
this.multiple = undefined;
|
|
692
|
-
/**
|
|
693
|
-
* Sets error message template so it can be injected into dynamic components.
|
|
694
|
-
*/
|
|
695
|
-
this.errorMessageTemplate = undefined;
|
|
696
|
-
/**
|
|
697
|
-
* Sets the placeholder message
|
|
698
|
-
*/
|
|
699
|
-
this.placeholder = '';
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* @return {?}
|
|
703
|
-
*/
|
|
704
|
-
get maxAttr() {
|
|
705
|
-
return this.max;
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* @return {?}
|
|
709
|
-
*/
|
|
710
|
-
get minAttr() {
|
|
711
|
-
return this.min;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* @return {?}
|
|
715
|
-
*/
|
|
716
|
-
ngOnInit() {
|
|
717
|
-
/** @type {?} */
|
|
718
|
-
const component = (/** @type {?} */ (this.type)) instanceof Type ? this.type : this._dynamicFormsService.getDynamicElement(this.type);
|
|
719
|
-
/** @type {?} */
|
|
720
|
-
const ref = this._componentFactoryResolver
|
|
721
|
-
.resolveComponentFactory(component)
|
|
722
|
-
.create(this.childElement.viewContainer.injector);
|
|
723
|
-
this.childElement.viewContainer.insert(ref.hostView);
|
|
724
|
-
this._instance = ref.instance;
|
|
725
|
-
this._instance.control = this.dynamicControl;
|
|
726
|
-
this._instance.label = this.label;
|
|
727
|
-
this._instance.hint = this.hint;
|
|
728
|
-
this._instance.name = this.name;
|
|
729
|
-
this._instance.type = this.type;
|
|
730
|
-
this._instance.value = this.value;
|
|
731
|
-
this._instance.required = this.required;
|
|
732
|
-
this._instance.min = this.min;
|
|
733
|
-
this._instance.max = this.max;
|
|
734
|
-
this._instance.minLength = this.minLength;
|
|
735
|
-
this._instance.maxLength = this.maxLength;
|
|
736
|
-
this._instance.selections = this.selections;
|
|
737
|
-
this._instance.multiple = this.multiple;
|
|
738
|
-
this._instance.errorMessageTemplate = this.errorMessageTemplate;
|
|
739
|
-
this._instance.placeholder = this.placeholder;
|
|
740
|
-
if (this.customConfig) {
|
|
741
|
-
Object.getOwnPropertyNames(this.customConfig).forEach((/**
|
|
742
|
-
* @param {?} name
|
|
743
|
-
* @return {?}
|
|
744
|
-
*/
|
|
745
|
-
(name) => {
|
|
746
|
-
this._instance[name] = this.customConfig[name];
|
|
747
|
-
}));
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Reassign any inputs that have changed
|
|
752
|
-
* @param {?} changes
|
|
753
|
-
* @return {?}
|
|
754
|
-
*/
|
|
755
|
-
ngOnChanges(changes) {
|
|
756
|
-
if (this._instance) {
|
|
757
|
-
for (const prop of Object.keys(changes)) {
|
|
758
|
-
this._instance[prop] = changes[prop].currentValue;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
TdDynamicElementComponent.decorators = [
|
|
764
|
-
{ type: Component, args: [{
|
|
765
|
-
providers: [
|
|
766
|
-
TdDynamicFormsService,
|
|
767
|
-
{
|
|
768
|
-
provide: NG_VALUE_ACCESSOR,
|
|
769
|
-
useExisting: forwardRef((/**
|
|
770
|
-
* @return {?}
|
|
771
|
-
*/
|
|
772
|
-
() => TdDynamicElementComponent)),
|
|
773
|
-
multi: true,
|
|
774
|
-
},
|
|
775
|
-
],
|
|
776
|
-
selector: 'td-dynamic-element',
|
|
777
|
-
template: '<div tdDynamicContainer></div>'
|
|
778
|
-
}] }
|
|
779
|
-
];
|
|
780
|
-
/** @nocollapse */
|
|
781
|
-
TdDynamicElementComponent.ctorParameters = () => [
|
|
782
|
-
{ type: ComponentFactoryResolver },
|
|
783
|
-
{ type: TdDynamicFormsService },
|
|
784
|
-
{ type: ChangeDetectorRef }
|
|
785
|
-
];
|
|
786
|
-
TdDynamicElementComponent.propDecorators = {
|
|
787
|
-
dynamicControl: [{ type: Input }],
|
|
788
|
-
label: [{ type: Input }],
|
|
789
|
-
hint: [{ type: Input }],
|
|
790
|
-
name: [{ type: Input }],
|
|
791
|
-
type: [{ type: Input }],
|
|
792
|
-
required: [{ type: Input }],
|
|
793
|
-
min: [{ type: Input }],
|
|
794
|
-
max: [{ type: Input }],
|
|
795
|
-
minLength: [{ type: Input }],
|
|
796
|
-
maxLength: [{ type: Input }],
|
|
797
|
-
selections: [{ type: Input }],
|
|
798
|
-
multiple: [{ type: Input }],
|
|
799
|
-
customConfig: [{ type: Input }],
|
|
800
|
-
errorMessageTemplate: [{ type: Input }],
|
|
801
|
-
placeholder: [{ type: Input }],
|
|
802
|
-
childElement: [{ type: ViewChild, args: [TdDynamicElementDirective, { static: true },] }],
|
|
803
|
-
maxAttr: [{ type: HostBinding, args: ['attr.max',] }],
|
|
804
|
-
minAttr: [{ type: HostBinding, args: ['attr.min',] }]
|
|
805
|
-
};
|
|
806
|
-
if (false) {
|
|
807
|
-
/**
|
|
808
|
-
* @type {?}
|
|
809
|
-
* @private
|
|
810
|
-
*/
|
|
811
|
-
TdDynamicElementComponent.prototype._instance;
|
|
812
|
-
/**
|
|
813
|
-
* Sets form control of the element.
|
|
814
|
-
* @type {?}
|
|
815
|
-
*/
|
|
816
|
-
TdDynamicElementComponent.prototype.dynamicControl;
|
|
817
|
-
/**
|
|
818
|
-
* Sets label to be displayed.
|
|
819
|
-
* @type {?}
|
|
820
|
-
*/
|
|
821
|
-
TdDynamicElementComponent.prototype.label;
|
|
822
|
-
/**
|
|
823
|
-
* Sets hint to be displayed.
|
|
824
|
-
* @type {?}
|
|
825
|
-
*/
|
|
826
|
-
TdDynamicElementComponent.prototype.hint;
|
|
827
|
-
/**
|
|
828
|
-
* Sets name to be displayed as attribute.
|
|
829
|
-
* @type {?}
|
|
830
|
-
*/
|
|
831
|
-
TdDynamicElementComponent.prototype.name;
|
|
832
|
-
/**
|
|
833
|
-
* Sets type or element of element to be rendered.
|
|
834
|
-
* Throws error if does not exist or no supported.
|
|
835
|
-
* @type {?}
|
|
836
|
-
*/
|
|
837
|
-
TdDynamicElementComponent.prototype.type;
|
|
838
|
-
/**
|
|
839
|
-
* Sets required validation checkup (if supported by element).
|
|
840
|
-
* @type {?}
|
|
841
|
-
*/
|
|
842
|
-
TdDynamicElementComponent.prototype.required;
|
|
843
|
-
/**
|
|
844
|
-
* Sets min validation checkup (if supported by element).
|
|
845
|
-
* @type {?}
|
|
846
|
-
*/
|
|
847
|
-
TdDynamicElementComponent.prototype.min;
|
|
848
|
-
/**
|
|
849
|
-
* Sets max validation checkup (if supported by element).
|
|
850
|
-
* @type {?}
|
|
851
|
-
*/
|
|
852
|
-
TdDynamicElementComponent.prototype.max;
|
|
853
|
-
/**
|
|
854
|
-
* Sets minLength validation checkup (if supported by element).
|
|
855
|
-
* @type {?}
|
|
856
|
-
*/
|
|
857
|
-
TdDynamicElementComponent.prototype.minLength;
|
|
858
|
-
/**
|
|
859
|
-
* Sets maxLength validation checkup (if supported by element).
|
|
860
|
-
* @type {?}
|
|
861
|
-
*/
|
|
862
|
-
TdDynamicElementComponent.prototype.maxLength;
|
|
863
|
-
/**
|
|
864
|
-
* Sets selections for array elements (if supported by element).
|
|
865
|
-
* @type {?}
|
|
866
|
-
*/
|
|
867
|
-
TdDynamicElementComponent.prototype.selections;
|
|
868
|
-
/**
|
|
869
|
-
* Sets multiple property for array elements (if supported by element).
|
|
870
|
-
* @type {?}
|
|
871
|
-
*/
|
|
872
|
-
TdDynamicElementComponent.prototype.multiple;
|
|
873
|
-
/**
|
|
874
|
-
* Sets any additional properties on custom component.
|
|
875
|
-
* @type {?}
|
|
876
|
-
*/
|
|
877
|
-
TdDynamicElementComponent.prototype.customConfig;
|
|
878
|
-
/**
|
|
879
|
-
* Sets error message template so it can be injected into dynamic components.
|
|
880
|
-
* @type {?}
|
|
881
|
-
*/
|
|
882
|
-
TdDynamicElementComponent.prototype.errorMessageTemplate;
|
|
883
|
-
/**
|
|
884
|
-
* Sets the placeholder message
|
|
885
|
-
* @type {?}
|
|
886
|
-
*/
|
|
887
|
-
TdDynamicElementComponent.prototype.placeholder;
|
|
888
|
-
/** @type {?} */
|
|
889
|
-
TdDynamicElementComponent.prototype.childElement;
|
|
890
|
-
/**
|
|
891
|
-
* @type {?}
|
|
892
|
-
* @private
|
|
893
|
-
*/
|
|
894
|
-
TdDynamicElementComponent.prototype._componentFactoryResolver;
|
|
895
|
-
/**
|
|
896
|
-
* @type {?}
|
|
897
|
-
* @private
|
|
898
|
-
*/
|
|
899
|
-
TdDynamicElementComponent.prototype._dynamicFormsService;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* @fileoverview added by tsickle
|
|
904
|
-
* Generated from: dynamic-forms.component.ts
|
|
905
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
906
|
-
*/
|
|
907
|
-
class TdDynamicFormsComponent {
|
|
908
|
-
/**
|
|
909
|
-
* @param {?} _formBuilder
|
|
910
|
-
* @param {?} _dynamicFormsService
|
|
911
|
-
* @param {?} _changeDetectorRef
|
|
912
|
-
*/
|
|
913
|
-
constructor(_formBuilder, _dynamicFormsService, _changeDetectorRef) {
|
|
914
|
-
this._formBuilder = _formBuilder;
|
|
915
|
-
this._dynamicFormsService = _dynamicFormsService;
|
|
916
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
917
|
-
this._renderedElements = [];
|
|
918
|
-
this._templateMap = new Map();
|
|
919
|
-
this._destroy$ = new Subject();
|
|
920
|
-
this._destroyControl$ = new Subject();
|
|
921
|
-
this.dynamicForm = this._formBuilder.group({});
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* elements: ITdDynamicElementConfig[]
|
|
925
|
-
* JS Object that will render the elements depending on its config.
|
|
926
|
-
* [name] property is required.
|
|
927
|
-
* @param {?} elements
|
|
928
|
-
* @return {?}
|
|
929
|
-
*/
|
|
930
|
-
set elements(elements) {
|
|
931
|
-
if (elements) {
|
|
932
|
-
this._elements = elements;
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
this._elements = [];
|
|
936
|
-
}
|
|
937
|
-
this._rerenderElements();
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* @return {?}
|
|
941
|
-
*/
|
|
942
|
-
get elements() {
|
|
943
|
-
return this._renderedElements;
|
|
944
|
-
}
|
|
945
|
-
/**
|
|
946
|
-
* Getter property for dynamic [FormGroup].
|
|
947
|
-
* @return {?}
|
|
948
|
-
*/
|
|
949
|
-
get form() {
|
|
950
|
-
return this.dynamicForm;
|
|
951
|
-
}
|
|
952
|
-
/**
|
|
953
|
-
* Getter property for [valid] of dynamic [FormGroup].
|
|
954
|
-
* @return {?}
|
|
955
|
-
*/
|
|
956
|
-
get valid() {
|
|
957
|
-
if (this.dynamicForm) {
|
|
958
|
-
return this.dynamicForm.valid;
|
|
959
|
-
}
|
|
960
|
-
return false;
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* Getter property for [value] of dynamic [FormGroup].
|
|
964
|
-
* @return {?}
|
|
965
|
-
*/
|
|
966
|
-
get value() {
|
|
967
|
-
if (this.dynamicForm) {
|
|
968
|
-
return this.dynamicForm.value;
|
|
969
|
-
}
|
|
970
|
-
return {};
|
|
971
|
-
}
|
|
972
|
-
/**
|
|
973
|
-
* Getter property for [errors] of dynamic [FormGroup].
|
|
974
|
-
* @return {?}
|
|
975
|
-
*/
|
|
976
|
-
get errors() {
|
|
977
|
-
if (this.dynamicForm) {
|
|
978
|
-
/** @type {?} */
|
|
979
|
-
const errors = {};
|
|
980
|
-
for (const name of Object.keys(this.dynamicForm.controls)) {
|
|
981
|
-
errors[name] = this.dynamicForm.controls[name].errors;
|
|
982
|
-
}
|
|
983
|
-
return errors;
|
|
984
|
-
}
|
|
985
|
-
return {};
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Getter property for [controls] of dynamic [FormGroup].
|
|
989
|
-
* @return {?}
|
|
990
|
-
*/
|
|
991
|
-
get controls() {
|
|
992
|
-
if (this.dynamicForm) {
|
|
993
|
-
return this.dynamicForm.controls;
|
|
994
|
-
}
|
|
995
|
-
return {};
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* @return {?}
|
|
999
|
-
*/
|
|
1000
|
-
ngAfterContentInit() {
|
|
1001
|
-
this._updateErrorTemplates();
|
|
1002
|
-
}
|
|
1003
|
-
/**
|
|
1004
|
-
* @return {?}
|
|
1005
|
-
*/
|
|
1006
|
-
ngOnDestroy() {
|
|
1007
|
-
this._destroy$.next();
|
|
1008
|
-
this._destroy$.complete();
|
|
1009
|
-
this._destroyControl$.complete();
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Refreshes the form and rerenders all validator/element modifications.
|
|
1013
|
-
* @return {?}
|
|
1014
|
-
*/
|
|
1015
|
-
refresh() {
|
|
1016
|
-
this._rerenderElements();
|
|
1017
|
-
this._updateErrorTemplates();
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Getter method for error template references
|
|
1021
|
-
* @param {?} name
|
|
1022
|
-
* @return {?}
|
|
1023
|
-
*/
|
|
1024
|
-
getErrorTemplateRef(name) {
|
|
1025
|
-
return this._templateMap.get(name);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Loads error templates and sets them in a map for faster access.
|
|
1029
|
-
* @private
|
|
1030
|
-
* @return {?}
|
|
1031
|
-
*/
|
|
1032
|
-
_updateErrorTemplates() {
|
|
1033
|
-
this._templateMap = new Map();
|
|
1034
|
-
for (const errorTemplate of this._errorTemplates.toArray()) {
|
|
1035
|
-
this._templateMap.set(errorTemplate.tdDynamicFormsError, errorTemplate.templateRef);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* @private
|
|
1040
|
-
* @return {?}
|
|
1041
|
-
*/
|
|
1042
|
-
_rerenderElements() {
|
|
1043
|
-
this._clearRemovedElements();
|
|
1044
|
-
this._renderedElements = [];
|
|
1045
|
-
/** @type {?} */
|
|
1046
|
-
const duplicates = [];
|
|
1047
|
-
this._elements.forEach((/**
|
|
1048
|
-
* @param {?} elem
|
|
1049
|
-
* @return {?}
|
|
1050
|
-
*/
|
|
1051
|
-
(elem) => {
|
|
1052
|
-
this._dynamicFormsService.validateDynamicElementName(elem.name);
|
|
1053
|
-
if (duplicates.indexOf(elem.name) > -1) {
|
|
1054
|
-
throw new Error(`Dynamic element name: "${elem.name}" is duplicated`);
|
|
1055
|
-
}
|
|
1056
|
-
duplicates.push(elem.name);
|
|
1057
|
-
/** @type {?} */
|
|
1058
|
-
const dynamicElement = this.dynamicForm.get(elem.name);
|
|
1059
|
-
if (!dynamicElement) {
|
|
1060
|
-
this.dynamicForm.addControl(elem.name, this._dynamicFormsService.createFormControl(elem));
|
|
1061
|
-
this._subscribeToControlStatusChanges(elem.name);
|
|
1062
|
-
}
|
|
1063
|
-
else {
|
|
1064
|
-
dynamicElement.setValue(elem.default);
|
|
1065
|
-
dynamicElement.markAsPristine();
|
|
1066
|
-
dynamicElement.markAsUntouched();
|
|
1067
|
-
if (elem.disabled) {
|
|
1068
|
-
dynamicElement.disable();
|
|
1069
|
-
}
|
|
1070
|
-
else {
|
|
1071
|
-
dynamicElement.enable();
|
|
1072
|
-
}
|
|
1073
|
-
dynamicElement.setValidators(this._dynamicFormsService.createValidators(elem));
|
|
1074
|
-
}
|
|
1075
|
-
// copy objects so they are only changes when calling this method
|
|
1076
|
-
this._renderedElements.push(Object.assign({}, elem));
|
|
1077
|
-
}));
|
|
1078
|
-
// call a change detection since the whole form might change
|
|
1079
|
-
this._changeDetectorRef.detectChanges();
|
|
1080
|
-
timer()
|
|
1081
|
-
.toPromise()
|
|
1082
|
-
.then((/**
|
|
1083
|
-
* @return {?}
|
|
1084
|
-
*/
|
|
1085
|
-
() => {
|
|
1086
|
-
// call a markForCheck so elements are rendered correctly in OnPush
|
|
1087
|
-
this._changeDetectorRef.markForCheck();
|
|
1088
|
-
}));
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* @private
|
|
1092
|
-
* @return {?}
|
|
1093
|
-
*/
|
|
1094
|
-
_clearRemovedElements() {
|
|
1095
|
-
this._renderedElements = this._renderedElements.filter((/**
|
|
1096
|
-
* @param {?} renderedElement
|
|
1097
|
-
* @return {?}
|
|
1098
|
-
*/
|
|
1099
|
-
(renderedElement) => !this._elements.some((/**
|
|
1100
|
-
* @param {?} element
|
|
1101
|
-
* @return {?}
|
|
1102
|
-
*/
|
|
1103
|
-
(element) => element.name === renderedElement.name))));
|
|
1104
|
-
// remove elements that were removed from the array
|
|
1105
|
-
this._renderedElements.forEach((/**
|
|
1106
|
-
* @param {?} elem
|
|
1107
|
-
* @return {?}
|
|
1108
|
-
*/
|
|
1109
|
-
(elem) => {
|
|
1110
|
-
this._destroyControl$.next(elem.name);
|
|
1111
|
-
this.dynamicForm.removeControl(elem.name);
|
|
1112
|
-
}));
|
|
1113
|
-
}
|
|
1114
|
-
// Updates component when manually adding errors to controls
|
|
1115
|
-
/**
|
|
1116
|
-
* @private
|
|
1117
|
-
* @param {?} elementName
|
|
1118
|
-
* @return {?}
|
|
1119
|
-
*/
|
|
1120
|
-
_subscribeToControlStatusChanges(elementName) {
|
|
1121
|
-
/** @type {?} */
|
|
1122
|
-
const control = this.controls[elementName];
|
|
1123
|
-
/** @type {?} */
|
|
1124
|
-
const controlDestroyed$ = this._destroyControl$.pipe(filter((/**
|
|
1125
|
-
* @param {?} destroyedElementName
|
|
1126
|
-
* @return {?}
|
|
1127
|
-
*/
|
|
1128
|
-
(destroyedElementName) => destroyedElementName === elementName)));
|
|
1129
|
-
control.statusChanges.pipe(takeUntil(this._destroy$), takeUntil(controlDestroyed$)).subscribe((/**
|
|
1130
|
-
* @return {?}
|
|
1131
|
-
*/
|
|
1132
|
-
() => {
|
|
1133
|
-
this._changeDetectorRef.markForCheck();
|
|
1134
|
-
}));
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
TdDynamicFormsComponent.decorators = [
|
|
1138
|
-
{ type: Component, args: [{
|
|
1139
|
-
selector: 'td-dynamic-forms',
|
|
1140
|
-
template: "<form [formGroup]=\"dynamicForm\" novalidate>\n <div class=\"td-dynamic-form-wrapper\">\n <ng-template let-element ngFor [ngForOf]=\"elements\">\n <div\n class=\"td-dynamic-element-wrapper\"\n [style.max-width.%]=\"element.flex ? element.flex : 100\"\n [style.flex]=\"'1 1 ' + (element.flex ? element.flex : 100) + '%'\"\n [style.-ms-flex]=\"'1 1 ' + (element.flex ? element.flex : 100) + '%'\"\n [style.-webkit-box-flex]=\"1\"\n >\n <td-dynamic-element\n #dynamicElement\n *ngIf=\"dynamicForm.controls[element.name]\"\n [formControlName]=\"element.name\"\n [dynamicControl]=\"dynamicForm.controls[element.name]\"\n [id]=\"element.name\"\n [name]=\"element.name\"\n [label]=\"element.label || element.name\"\n [hint]=\"element.hint\"\n [type]=\"element.type\"\n [required]=\"element.required\"\n [min]=\"element.min\"\n [max]=\"element.max\"\n [minLength]=\"element.minLength\"\n [maxLength]=\"element.maxLength\"\n [selections]=\"element.selections\"\n [multiple]=\"element.multiple\"\n [customConfig]=\"element.customConfig\"\n [errorMessageTemplate]=\"getErrorTemplateRef(element.name)\"\n [placeholder]=\"element.placeholder\"\n ></td-dynamic-element>\n </div>\n </ng-template>\n </div>\n <ng-content></ng-content>\n</form>\n",
|
|
1141
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1142
|
-
styles: [".td-dynamic-form-wrapper{-ms-flex-align:center;-ms-flex-direction:row;-ms-flex-line-pack:center;-ms-flex-pack:start;-ms-flex-wrap:wrap;align-content:center;align-items:center;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;max-width:100%}.td-dynamic-form-wrapper ::ng-deep .mat-form-field-infix{width:auto}.td-dynamic-form-wrapper ::ng-deep .td-dynamic-element-hint{display:block;font-size:75%}.td-dynamic-form-wrapper .td-dynamic-element-wrapper{box-sizing:border-box;max-height:100%;padding:4px 4px 8px;position:relative}"]
|
|
1143
|
-
}] }
|
|
1144
|
-
];
|
|
1145
|
-
/** @nocollapse */
|
|
1146
|
-
TdDynamicFormsComponent.ctorParameters = () => [
|
|
1147
|
-
{ type: FormBuilder },
|
|
1148
|
-
{ type: TdDynamicFormsService },
|
|
1149
|
-
{ type: ChangeDetectorRef }
|
|
1150
|
-
];
|
|
1151
|
-
TdDynamicFormsComponent.propDecorators = {
|
|
1152
|
-
_errorTemplates: [{ type: ContentChildren, args: [TdDynamicFormsErrorTemplateDirective, { descendants: true },] }],
|
|
1153
|
-
elements: [{ type: Input, args: ['elements',] }]
|
|
1154
|
-
};
|
|
1155
|
-
if (false) {
|
|
1156
|
-
/**
|
|
1157
|
-
* @type {?}
|
|
1158
|
-
* @private
|
|
1159
|
-
*/
|
|
1160
|
-
TdDynamicFormsComponent.prototype._renderedElements;
|
|
1161
|
-
/**
|
|
1162
|
-
* @type {?}
|
|
1163
|
-
* @private
|
|
1164
|
-
*/
|
|
1165
|
-
TdDynamicFormsComponent.prototype._elements;
|
|
1166
|
-
/**
|
|
1167
|
-
* @type {?}
|
|
1168
|
-
* @private
|
|
1169
|
-
*/
|
|
1170
|
-
TdDynamicFormsComponent.prototype._templateMap;
|
|
1171
|
-
/**
|
|
1172
|
-
* @type {?}
|
|
1173
|
-
* @private
|
|
1174
|
-
*/
|
|
1175
|
-
TdDynamicFormsComponent.prototype._destroy$;
|
|
1176
|
-
/**
|
|
1177
|
-
* @type {?}
|
|
1178
|
-
* @private
|
|
1179
|
-
*/
|
|
1180
|
-
TdDynamicFormsComponent.prototype._destroyControl$;
|
|
1181
|
-
/** @type {?} */
|
|
1182
|
-
TdDynamicFormsComponent.prototype._errorTemplates;
|
|
1183
|
-
/** @type {?} */
|
|
1184
|
-
TdDynamicFormsComponent.prototype.dynamicForm;
|
|
1185
|
-
/**
|
|
1186
|
-
* @type {?}
|
|
1187
|
-
* @private
|
|
1188
|
-
*/
|
|
1189
|
-
TdDynamicFormsComponent.prototype._formBuilder;
|
|
1190
|
-
/**
|
|
1191
|
-
* @type {?}
|
|
1192
|
-
* @private
|
|
1193
|
-
*/
|
|
1194
|
-
TdDynamicFormsComponent.prototype._dynamicFormsService;
|
|
1195
|
-
/**
|
|
1196
|
-
* @type {?}
|
|
1197
|
-
* @private
|
|
1198
|
-
*/
|
|
1199
|
-
TdDynamicFormsComponent.prototype._changeDetectorRef;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* @fileoverview added by tsickle
|
|
1204
|
-
* Generated from: dynamic-forms.module.ts
|
|
1205
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1206
|
-
*/
|
|
1207
|
-
/** @type {?} */
|
|
1208
|
-
const TD_DYNAMIC_FORMS = [
|
|
1209
|
-
TdDynamicFormsComponent,
|
|
1210
|
-
TdDynamicElementComponent,
|
|
1211
|
-
TdDynamicElementDirective,
|
|
1212
|
-
TdDynamicFormsErrorTemplateDirective,
|
|
1213
|
-
];
|
|
1214
|
-
/** @type {?} */
|
|
1215
|
-
const TD_DYNAMIC_FORMS_ENTRY_COMPONENTS = [
|
|
1216
|
-
TdDynamicInputComponent,
|
|
1217
|
-
TdDynamicFileInputComponent,
|
|
1218
|
-
TdDynamicTextareaComponent,
|
|
1219
|
-
TdDynamicSlideToggleComponent,
|
|
1220
|
-
TdDynamicCheckboxComponent,
|
|
1221
|
-
TdDynamicSliderComponent,
|
|
1222
|
-
TdDynamicSelectComponent,
|
|
1223
|
-
TdDynamicDatepickerComponent,
|
|
1224
|
-
];
|
|
1225
|
-
class CovalentDynamicFormsModule {
|
|
1226
|
-
}
|
|
1227
|
-
CovalentDynamicFormsModule.decorators = [
|
|
1228
|
-
{ type: NgModule, args: [{
|
|
1229
|
-
declarations: [TD_DYNAMIC_FORMS, TD_DYNAMIC_FORMS_ENTRY_COMPONENTS],
|
|
1230
|
-
imports: [
|
|
1231
|
-
CommonModule,
|
|
1232
|
-
ReactiveFormsModule,
|
|
1233
|
-
MatFormFieldModule,
|
|
1234
|
-
MatInputModule,
|
|
1235
|
-
MatSelectModule,
|
|
1236
|
-
MatCheckboxModule,
|
|
1237
|
-
MatSliderModule,
|
|
1238
|
-
MatSlideToggleModule,
|
|
1239
|
-
MatIconModule,
|
|
1240
|
-
MatButtonModule,
|
|
1241
|
-
MatDatepickerModule,
|
|
1242
|
-
CovalentCommonModule,
|
|
1243
|
-
CovalentFileModule,
|
|
1244
|
-
],
|
|
1245
|
-
exports: [TD_DYNAMIC_FORMS, TD_DYNAMIC_FORMS_ENTRY_COMPONENTS],
|
|
1246
|
-
providers: [DYNAMIC_FORMS_PROVIDER],
|
|
1247
|
-
},] }
|
|
1248
|
-
];
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* @fileoverview added by tsickle
|
|
1252
|
-
* Generated from: public_api.ts
|
|
1253
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1254
|
-
*/
|
|
1255
|
-
|
|
1256
|
-
/**
|
|
1257
|
-
* @fileoverview added by tsickle
|
|
1258
|
-
* Generated from: index.ts
|
|
1259
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1260
|
-
*/
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* @fileoverview added by tsickle
|
|
1264
|
-
* Generated from: covalent-dynamic-forms.ts
|
|
1265
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1266
|
-
*/
|
|
1267
|
-
|
|
1268
|
-
export { CovalentDynamicFormsModule, DYNAMIC_ELEMENT_NAME_REGEX, DYNAMIC_FORMS_PROVIDER, DYNAMIC_FORMS_PROVIDER_FACTORY, TdDynamicCheckboxComponent, TdDynamicDatepickerComponent, TdDynamicElement, TdDynamicElementBase, TdDynamicElementComponent, TdDynamicElementDirective, TdDynamicFileInputComponent, TdDynamicFormsComponent, TdDynamicFormsErrorTemplateDirective, TdDynamicFormsService, TdDynamicInputComponent, TdDynamicSelectComponent, TdDynamicSlideToggleComponent, TdDynamicSliderComponent, TdDynamicTextareaComponent, TdDynamicType, _TdDynamicElementMixinBase };
|
|
1269
|
-
//# sourceMappingURL=covalent-dynamic-forms.js.map
|