@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.
Files changed (69) hide show
  1. package/README.md +26 -18
  2. package/covalent-dynamic-forms.d.ts +2 -1
  3. package/esm2020/covalent-dynamic-forms.mjs +5 -0
  4. package/esm2020/lib/dynamic-element.component.mjs +178 -0
  5. package/esm2020/lib/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.mjs +19 -0
  6. package/esm2020/lib/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.mjs +23 -0
  7. package/esm2020/lib/dynamic-elements/dynamic-file-input/dynamic-file-input.component.mjs +28 -0
  8. package/esm2020/lib/dynamic-elements/dynamic-input/dynamic-input.component.mjs +22 -0
  9. package/esm2020/lib/dynamic-elements/dynamic-select/dynamic-select.component.mjs +23 -0
  10. package/esm2020/lib/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.mjs +19 -0
  11. package/esm2020/lib/dynamic-elements/dynamic-slider/dynamic-slider.component.mjs +26 -0
  12. package/esm2020/lib/dynamic-elements/dynamic-textarea/dynamic-textarea.component.mjs +22 -0
  13. package/esm2020/lib/dynamic-forms.component.mjs +185 -0
  14. package/esm2020/lib/dynamic-forms.module.mjs +127 -0
  15. package/esm2020/lib/services/dynamic-forms.service.mjs +140 -0
  16. package/esm2020/public_api.mjs +13 -0
  17. package/fesm2015/covalent-dynamic-forms.mjs +748 -0
  18. package/fesm2015/covalent-dynamic-forms.mjs.map +1 -0
  19. package/fesm2020/covalent-dynamic-forms.mjs +746 -0
  20. package/fesm2020/covalent-dynamic-forms.mjs.map +1 -0
  21. package/{dynamic-element.component.d.ts → lib/dynamic-element.component.d.ts} +24 -17
  22. package/lib/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.d.ts +11 -0
  23. package/{dynamic-elements → lib/dynamic-elements}/dynamic-datepicker/dynamic-datepicker.component.d.ts +6 -3
  24. package/{dynamic-elements → lib/dynamic-elements}/dynamic-file-input/dynamic-file-input.component.d.ts +4 -1
  25. package/{dynamic-elements → lib/dynamic-elements}/dynamic-input/dynamic-input.component.d.ts +7 -4
  26. package/{dynamic-elements → lib/dynamic-elements}/dynamic-select/dynamic-select.component.d.ts +5 -2
  27. package/lib/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.d.ts +11 -0
  28. package/{dynamic-elements → lib/dynamic-elements}/dynamic-slider/dynamic-slider.component.d.ts +5 -2
  29. package/{dynamic-elements → lib/dynamic-elements}/dynamic-textarea/dynamic-textarea.component.d.ts +3 -0
  30. package/{dynamic-forms.component.d.ts → lib/dynamic-forms.component.d.ts} +4 -1
  31. package/lib/dynamic-forms.module.d.ts +28 -0
  32. package/{services → lib/services}/dynamic-forms.service.d.ts +5 -2
  33. package/package.json +32 -17
  34. package/public_api.d.ts +12 -12
  35. package/bundles/covalent-dynamic-forms.umd.js +0 -1654
  36. package/bundles/covalent-dynamic-forms.umd.js.map +0 -1
  37. package/bundles/covalent-dynamic-forms.umd.min.js +0 -16
  38. package/bundles/covalent-dynamic-forms.umd.min.js.map +0 -1
  39. package/covalent-dynamic-forms.metadata.json +0 -1
  40. package/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.d.ts +0 -8
  41. package/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.scss +0 -0
  42. package/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.scss +0 -12
  43. package/dynamic-elements/dynamic-file-input/dynamic-file-input.component.scss +0 -15
  44. package/dynamic-elements/dynamic-input/dynamic-input.component.scss +0 -12
  45. package/dynamic-elements/dynamic-select/dynamic-select.component.scss +0 -12
  46. package/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.d.ts +0 -8
  47. package/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.scss +0 -0
  48. package/dynamic-elements/dynamic-slider/dynamic-slider.component.scss +0 -17
  49. package/dynamic-elements/dynamic-textarea/dynamic-textarea.component.scss +0 -12
  50. package/dynamic-forms.component.scss +0 -29
  51. package/dynamic-forms.module.d.ts +0 -2
  52. package/esm2015/covalent-dynamic-forms.js +0 -10
  53. package/esm2015/dynamic-element.component.js +0 -340
  54. package/esm2015/dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.js +0 -34
  55. package/esm2015/dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.js +0 -49
  56. package/esm2015/dynamic-elements/dynamic-file-input/dynamic-file-input.component.js +0 -47
  57. package/esm2015/dynamic-elements/dynamic-input/dynamic-input.component.js +0 -55
  58. package/esm2015/dynamic-elements/dynamic-select/dynamic-select.component.js +0 -46
  59. package/esm2015/dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.js +0 -34
  60. package/esm2015/dynamic-elements/dynamic-slider/dynamic-slider.component.js +0 -64
  61. package/esm2015/dynamic-elements/dynamic-textarea/dynamic-textarea.component.js +0 -40
  62. package/esm2015/dynamic-forms.component.js +0 -306
  63. package/esm2015/dynamic-forms.module.js +0 -73
  64. package/esm2015/index.js +0 -7
  65. package/esm2015/public_api.js +0 -18
  66. package/esm2015/services/dynamic-forms.service.js +0 -201
  67. package/fesm2015/covalent-dynamic-forms.js +0 -1269
  68. package/fesm2015/covalent-dynamic-forms.js.map +0 -1
  69. package/index.d.ts +0 -1
@@ -1,1654 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/checkbox'), require('@angular/material/slider'), require('@angular/material/slide-toggle'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/datepicker'), require('@covalent/core/common'), require('@covalent/core/file'), require('@angular/cdk/portal'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@covalent/dynamic-forms', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/checkbox', '@angular/material/slider', '@angular/material/slide-toggle', '@angular/material/icon', '@angular/material/button', '@angular/material/datepicker', '@covalent/core/common', '@covalent/core/file', '@angular/cdk/portal', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.covalent = global.covalent || {}, global.covalent['dynamic-forms'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.checkbox, global.ng.material.slider, global.ng.material.slideToggle, global.ng.material.icon, global.ng.material.button, global.ng.material.datepicker, global.covalent.core.common, global.covalent.core.file, global.ng.cdk.portal, global.rxjs, global.rxjs.operators));
5
- }(this, (function (exports, core, common$1, forms, formField, input, select, checkbox, slider, slideToggle, icon, button, datepicker, common, file, portal, rxjs, operators) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
- var extendStatics = function (d, b) {
23
- extendStatics = Object.setPrototypeOf ||
24
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
- function (d, b) { for (var p in b)
26
- if (Object.prototype.hasOwnProperty.call(b, p))
27
- d[p] = b[p]; };
28
- return extendStatics(d, b);
29
- };
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
- var __assign = function () {
36
- __assign = Object.assign || function __assign(t) {
37
- for (var s, i = 1, n = arguments.length; i < n; i++) {
38
- s = arguments[i];
39
- for (var p in s)
40
- if (Object.prototype.hasOwnProperty.call(s, p))
41
- t[p] = s[p];
42
- }
43
- return t;
44
- };
45
- return __assign.apply(this, arguments);
46
- };
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s)
50
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
- t[p] = s[p];
52
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
- t[p[i]] = s[p[i]];
56
- }
57
- return t;
58
- }
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
62
- r = Reflect.decorate(decorators, target, key, desc);
63
- else
64
- for (var i = decorators.length - 1; i >= 0; i--)
65
- if (d = decorators[i])
66
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67
- return c > 3 && r && Object.defineProperty(target, key, r), r;
68
- }
69
- function __param(paramIndex, decorator) {
70
- return function (target, key) { decorator(target, key, paramIndex); };
71
- }
72
- function __metadata(metadataKey, metadataValue) {
73
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
74
- return Reflect.metadata(metadataKey, metadataValue);
75
- }
76
- function __awaiter(thisArg, _arguments, P, generator) {
77
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
78
- return new (P || (P = Promise))(function (resolve, reject) {
79
- function fulfilled(value) { try {
80
- step(generator.next(value));
81
- }
82
- catch (e) {
83
- reject(e);
84
- } }
85
- function rejected(value) { try {
86
- step(generator["throw"](value));
87
- }
88
- catch (e) {
89
- reject(e);
90
- } }
91
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
92
- step((generator = generator.apply(thisArg, _arguments || [])).next());
93
- });
94
- }
95
- function __generator(thisArg, body) {
96
- var _ = { label: 0, sent: function () { if (t[0] & 1)
97
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
98
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
99
- function verb(n) { return function (v) { return step([n, v]); }; }
100
- function step(op) {
101
- if (f)
102
- throw new TypeError("Generator is already executing.");
103
- while (_)
104
- try {
105
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
106
- return t;
107
- if (y = 0, t)
108
- op = [op[0] & 2, t.value];
109
- switch (op[0]) {
110
- case 0:
111
- case 1:
112
- t = op;
113
- break;
114
- case 4:
115
- _.label++;
116
- return { value: op[1], done: false };
117
- case 5:
118
- _.label++;
119
- y = op[1];
120
- op = [0];
121
- continue;
122
- case 7:
123
- op = _.ops.pop();
124
- _.trys.pop();
125
- continue;
126
- default:
127
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
128
- _ = 0;
129
- continue;
130
- }
131
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
132
- _.label = op[1];
133
- break;
134
- }
135
- if (op[0] === 6 && _.label < t[1]) {
136
- _.label = t[1];
137
- t = op;
138
- break;
139
- }
140
- if (t && _.label < t[2]) {
141
- _.label = t[2];
142
- _.ops.push(op);
143
- break;
144
- }
145
- if (t[2])
146
- _.ops.pop();
147
- _.trys.pop();
148
- continue;
149
- }
150
- op = body.call(thisArg, _);
151
- }
152
- catch (e) {
153
- op = [6, e];
154
- y = 0;
155
- }
156
- finally {
157
- f = t = 0;
158
- }
159
- if (op[0] & 5)
160
- throw op[1];
161
- return { value: op[0] ? op[1] : void 0, done: true };
162
- }
163
- }
164
- var __createBinding = Object.create ? (function (o, m, k, k2) {
165
- if (k2 === undefined)
166
- k2 = k;
167
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
168
- }) : (function (o, m, k, k2) {
169
- if (k2 === undefined)
170
- k2 = k;
171
- o[k2] = m[k];
172
- });
173
- function __exportStar(m, o) {
174
- for (var p in m)
175
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
176
- __createBinding(o, m, p);
177
- }
178
- function __values(o) {
179
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
180
- if (m)
181
- return m.call(o);
182
- if (o && typeof o.length === "number")
183
- return {
184
- next: function () {
185
- if (o && i >= o.length)
186
- o = void 0;
187
- return { value: o && o[i++], done: !o };
188
- }
189
- };
190
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
191
- }
192
- function __read(o, n) {
193
- var m = typeof Symbol === "function" && o[Symbol.iterator];
194
- if (!m)
195
- return o;
196
- var i = m.call(o), r, ar = [], e;
197
- try {
198
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
199
- ar.push(r.value);
200
- }
201
- catch (error) {
202
- e = { error: error };
203
- }
204
- finally {
205
- try {
206
- if (r && !r.done && (m = i["return"]))
207
- m.call(i);
208
- }
209
- finally {
210
- if (e)
211
- throw e.error;
212
- }
213
- }
214
- return ar;
215
- }
216
- function __spread() {
217
- for (var ar = [], i = 0; i < arguments.length; i++)
218
- ar = ar.concat(__read(arguments[i]));
219
- return ar;
220
- }
221
- function __spreadArrays() {
222
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
223
- s += arguments[i].length;
224
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
225
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
226
- r[k] = a[j];
227
- return r;
228
- }
229
- ;
230
- function __await(v) {
231
- return this instanceof __await ? (this.v = v, this) : new __await(v);
232
- }
233
- function __asyncGenerator(thisArg, _arguments, generator) {
234
- if (!Symbol.asyncIterator)
235
- throw new TypeError("Symbol.asyncIterator is not defined.");
236
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
237
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
238
- function verb(n) { if (g[n])
239
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
240
- function resume(n, v) { try {
241
- step(g[n](v));
242
- }
243
- catch (e) {
244
- settle(q[0][3], e);
245
- } }
246
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
247
- function fulfill(value) { resume("next", value); }
248
- function reject(value) { resume("throw", value); }
249
- function settle(f, v) { if (f(v), q.shift(), q.length)
250
- resume(q[0][0], q[0][1]); }
251
- }
252
- function __asyncDelegator(o) {
253
- var i, p;
254
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
255
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
256
- }
257
- function __asyncValues(o) {
258
- if (!Symbol.asyncIterator)
259
- throw new TypeError("Symbol.asyncIterator is not defined.");
260
- var m = o[Symbol.asyncIterator], i;
261
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
262
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
263
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
264
- }
265
- function __makeTemplateObject(cooked, raw) {
266
- if (Object.defineProperty) {
267
- Object.defineProperty(cooked, "raw", { value: raw });
268
- }
269
- else {
270
- cooked.raw = raw;
271
- }
272
- return cooked;
273
- }
274
- ;
275
- var __setModuleDefault = Object.create ? (function (o, v) {
276
- Object.defineProperty(o, "default", { enumerable: true, value: v });
277
- }) : function (o, v) {
278
- o["default"] = v;
279
- };
280
- function __importStar(mod) {
281
- if (mod && mod.__esModule)
282
- return mod;
283
- var result = {};
284
- if (mod != null)
285
- for (var k in mod)
286
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
287
- __createBinding(result, mod, k);
288
- __setModuleDefault(result, mod);
289
- return result;
290
- }
291
- function __importDefault(mod) {
292
- return (mod && mod.__esModule) ? mod : { default: mod };
293
- }
294
- function __classPrivateFieldGet(receiver, privateMap) {
295
- if (!privateMap.has(receiver)) {
296
- throw new TypeError("attempted to get private field on non-instance");
297
- }
298
- return privateMap.get(receiver);
299
- }
300
- function __classPrivateFieldSet(receiver, privateMap, value) {
301
- if (!privateMap.has(receiver)) {
302
- throw new TypeError("attempted to set private field on non-instance");
303
- }
304
- privateMap.set(receiver, value);
305
- return value;
306
- }
307
-
308
- /**
309
- * @fileoverview added by tsickle
310
- * Generated from: dynamic-elements/dynamic-input/dynamic-input.component.ts
311
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
312
- */
313
- var TdDynamicInputComponent = /** @class */ (function () {
314
- function TdDynamicInputComponent() {
315
- this.label = '';
316
- this.hint = '';
317
- this.type = undefined;
318
- this.required = undefined;
319
- this.name = '';
320
- this.min = undefined;
321
- this.max = undefined;
322
- this.minLength = undefined;
323
- this.maxLength = undefined;
324
- this.errorMessageTemplate = undefined;
325
- this.placeholder = '';
326
- }
327
- return TdDynamicInputComponent;
328
- }());
329
- TdDynamicInputComponent.decorators = [
330
- { type: core.Component, args: [{
331
- selector: 'td-dynamic-input',
332
- 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",
333
- 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}"]
334
- }] }
335
- ];
336
- if (false) {
337
- /** @type {?} */
338
- TdDynamicInputComponent.prototype.control;
339
- /** @type {?} */
340
- TdDynamicInputComponent.prototype.label;
341
- /** @type {?} */
342
- TdDynamicInputComponent.prototype.hint;
343
- /** @type {?} */
344
- TdDynamicInputComponent.prototype.type;
345
- /** @type {?} */
346
- TdDynamicInputComponent.prototype.required;
347
- /** @type {?} */
348
- TdDynamicInputComponent.prototype.name;
349
- /** @type {?} */
350
- TdDynamicInputComponent.prototype.min;
351
- /** @type {?} */
352
- TdDynamicInputComponent.prototype.max;
353
- /** @type {?} */
354
- TdDynamicInputComponent.prototype.minLength;
355
- /** @type {?} */
356
- TdDynamicInputComponent.prototype.maxLength;
357
- /** @type {?} */
358
- TdDynamicInputComponent.prototype.errorMessageTemplate;
359
- /** @type {?} */
360
- TdDynamicInputComponent.prototype.placeholder;
361
- }
362
-
363
- /**
364
- * @fileoverview added by tsickle
365
- * Generated from: dynamic-elements/dynamic-file-input/dynamic-file-input.component.ts
366
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
367
- */
368
- var TdDynamicFileInputComponent = /** @class */ (function () {
369
- function TdDynamicFileInputComponent() {
370
- this.required = undefined;
371
- this.label = '';
372
- this.name = '';
373
- this.hint = '';
374
- this.errorMessageTemplate = undefined;
375
- this.placeholder = '';
376
- }
377
- /**
378
- * @param {?} value
379
- * @return {?}
380
- */
381
- TdDynamicFileInputComponent.prototype._handlefileDrop = function (value) {
382
- this.control.setValue(value);
383
- };
384
- return TdDynamicFileInputComponent;
385
- }());
386
- TdDynamicFileInputComponent.decorators = [
387
- { type: core.Component, args: [{
388
- selector: 'td-dynamic-file-input',
389
- 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",
390
- 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}"]
391
- }] }
392
- ];
393
- if (false) {
394
- /** @type {?} */
395
- TdDynamicFileInputComponent.prototype.control;
396
- /** @type {?} */
397
- TdDynamicFileInputComponent.prototype.required;
398
- /** @type {?} */
399
- TdDynamicFileInputComponent.prototype.label;
400
- /** @type {?} */
401
- TdDynamicFileInputComponent.prototype.name;
402
- /** @type {?} */
403
- TdDynamicFileInputComponent.prototype.hint;
404
- /** @type {?} */
405
- TdDynamicFileInputComponent.prototype.errorMessageTemplate;
406
- /** @type {?} */
407
- TdDynamicFileInputComponent.prototype.placeholder;
408
- }
409
-
410
- /**
411
- * @fileoverview added by tsickle
412
- * Generated from: dynamic-elements/dynamic-textarea/dynamic-textarea.component.ts
413
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
414
- */
415
- var TdDynamicTextareaComponent = /** @class */ (function () {
416
- function TdDynamicTextareaComponent() {
417
- this.label = '';
418
- this.hint = '';
419
- this.name = '';
420
- this.required = undefined;
421
- this.errorMessageTemplate = undefined;
422
- this.placeholder = '';
423
- }
424
- return TdDynamicTextareaComponent;
425
- }());
426
- TdDynamicTextareaComponent.decorators = [
427
- { type: core.Component, args: [{
428
- selector: 'td-dynamic-textarea',
429
- 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",
430
- 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}"]
431
- }] }
432
- ];
433
- if (false) {
434
- /** @type {?} */
435
- TdDynamicTextareaComponent.prototype.control;
436
- /** @type {?} */
437
- TdDynamicTextareaComponent.prototype.label;
438
- /** @type {?} */
439
- TdDynamicTextareaComponent.prototype.hint;
440
- /** @type {?} */
441
- TdDynamicTextareaComponent.prototype.name;
442
- /** @type {?} */
443
- TdDynamicTextareaComponent.prototype.required;
444
- /** @type {?} */
445
- TdDynamicTextareaComponent.prototype.errorMessageTemplate;
446
- /** @type {?} */
447
- TdDynamicTextareaComponent.prototype.placeholder;
448
- }
449
-
450
- /**
451
- * @fileoverview added by tsickle
452
- * Generated from: dynamic-elements/dynamic-slide-toggle/dynamic-slide-toggle.component.ts
453
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
454
- */
455
- var TdDynamicSlideToggleComponent = /** @class */ (function () {
456
- function TdDynamicSlideToggleComponent() {
457
- this.label = '';
458
- this.name = '';
459
- this.hint = '';
460
- this.required = false;
461
- }
462
- return TdDynamicSlideToggleComponent;
463
- }());
464
- TdDynamicSlideToggleComponent.decorators = [
465
- { type: core.Component, args: [{
466
- selector: 'td-dynamic-slide-toggle',
467
- 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",
468
- styles: [""]
469
- }] }
470
- ];
471
- if (false) {
472
- /** @type {?} */
473
- TdDynamicSlideToggleComponent.prototype.control;
474
- /** @type {?} */
475
- TdDynamicSlideToggleComponent.prototype.label;
476
- /** @type {?} */
477
- TdDynamicSlideToggleComponent.prototype.name;
478
- /** @type {?} */
479
- TdDynamicSlideToggleComponent.prototype.hint;
480
- /** @type {?} */
481
- TdDynamicSlideToggleComponent.prototype.required;
482
- }
483
-
484
- /**
485
- * @fileoverview added by tsickle
486
- * Generated from: dynamic-elements/dynamic-checkbox/dynamic-checkbox.component.ts
487
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
488
- */
489
- var TdDynamicCheckboxComponent = /** @class */ (function () {
490
- function TdDynamicCheckboxComponent() {
491
- this.label = '';
492
- this.name = '';
493
- this.hint = '';
494
- this.required = false;
495
- }
496
- return TdDynamicCheckboxComponent;
497
- }());
498
- TdDynamicCheckboxComponent.decorators = [
499
- { type: core.Component, args: [{
500
- selector: 'td-dynamic-checkbox',
501
- 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",
502
- styles: [""]
503
- }] }
504
- ];
505
- if (false) {
506
- /** @type {?} */
507
- TdDynamicCheckboxComponent.prototype.control;
508
- /** @type {?} */
509
- TdDynamicCheckboxComponent.prototype.label;
510
- /** @type {?} */
511
- TdDynamicCheckboxComponent.prototype.name;
512
- /** @type {?} */
513
- TdDynamicCheckboxComponent.prototype.hint;
514
- /** @type {?} */
515
- TdDynamicCheckboxComponent.prototype.required;
516
- }
517
-
518
- /**
519
- * @fileoverview added by tsickle
520
- * Generated from: dynamic-elements/dynamic-slider/dynamic-slider.component.ts
521
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
522
- */
523
- var TdDynamicSliderComponent = /** @class */ (function () {
524
- /**
525
- * @param {?} _changeDetectorRef
526
- */
527
- function TdDynamicSliderComponent(_changeDetectorRef) {
528
- this._changeDetectorRef = _changeDetectorRef;
529
- this.label = '';
530
- this.required = undefined;
531
- this.name = '';
532
- this.hint = '';
533
- this.min = undefined;
534
- this.max = undefined;
535
- }
536
- /**
537
- * @return {?}
538
- */
539
- TdDynamicSliderComponent.prototype._handleBlur = function () {
540
- var _this = this;
541
- setTimeout(( /**
542
- * @return {?}
543
- */function () {
544
- _this._changeDetectorRef.markForCheck();
545
- }));
546
- };
547
- return TdDynamicSliderComponent;
548
- }());
549
- TdDynamicSliderComponent.decorators = [
550
- { type: core.Component, args: [{
551
- selector: 'td-dynamic-slider',
552
- 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",
553
- 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}"]
554
- }] }
555
- ];
556
- /** @nocollapse */
557
- TdDynamicSliderComponent.ctorParameters = function () { return [
558
- { type: core.ChangeDetectorRef }
559
- ]; };
560
- if (false) {
561
- /** @type {?} */
562
- TdDynamicSliderComponent.prototype.control;
563
- /** @type {?} */
564
- TdDynamicSliderComponent.prototype.label;
565
- /** @type {?} */
566
- TdDynamicSliderComponent.prototype.required;
567
- /** @type {?} */
568
- TdDynamicSliderComponent.prototype.name;
569
- /** @type {?} */
570
- TdDynamicSliderComponent.prototype.hint;
571
- /** @type {?} */
572
- TdDynamicSliderComponent.prototype.min;
573
- /** @type {?} */
574
- TdDynamicSliderComponent.prototype.max;
575
- /**
576
- * @type {?}
577
- * @private
578
- */
579
- TdDynamicSliderComponent.prototype._changeDetectorRef;
580
- }
581
-
582
- /**
583
- * @fileoverview added by tsickle
584
- * Generated from: dynamic-elements/dynamic-select/dynamic-select.component.ts
585
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
586
- */
587
- var TdDynamicSelectComponent = /** @class */ (function () {
588
- function TdDynamicSelectComponent() {
589
- this.label = '';
590
- this.hint = '';
591
- this.name = '';
592
- this.required = undefined;
593
- this.selections = undefined;
594
- this.multiple = undefined;
595
- this.errorMessageTemplate = undefined;
596
- this.placeholder = '';
597
- }
598
- return TdDynamicSelectComponent;
599
- }());
600
- TdDynamicSelectComponent.decorators = [
601
- { type: core.Component, args: [{
602
- selector: 'td-dynamic-select',
603
- 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",
604
- 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}"]
605
- }] }
606
- ];
607
- if (false) {
608
- /** @type {?} */
609
- TdDynamicSelectComponent.prototype.control;
610
- /** @type {?} */
611
- TdDynamicSelectComponent.prototype.label;
612
- /** @type {?} */
613
- TdDynamicSelectComponent.prototype.hint;
614
- /** @type {?} */
615
- TdDynamicSelectComponent.prototype.name;
616
- /** @type {?} */
617
- TdDynamicSelectComponent.prototype.required;
618
- /** @type {?} */
619
- TdDynamicSelectComponent.prototype.selections;
620
- /** @type {?} */
621
- TdDynamicSelectComponent.prototype.multiple;
622
- /** @type {?} */
623
- TdDynamicSelectComponent.prototype.errorMessageTemplate;
624
- /** @type {?} */
625
- TdDynamicSelectComponent.prototype.placeholder;
626
- }
627
-
628
- /**
629
- * @fileoverview added by tsickle
630
- * Generated from: dynamic-elements/dynamic-datepicker/dynamic-datepicker.component.ts
631
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
632
- */
633
- var TdDynamicDatepickerComponent = /** @class */ (function () {
634
- function TdDynamicDatepickerComponent() {
635
- this.label = '';
636
- this.hint = '';
637
- this.name = '';
638
- this.type = undefined;
639
- this.required = undefined;
640
- this.min = undefined;
641
- this.max = undefined;
642
- this.errorMessageTemplate = undefined;
643
- this.placeholder = '';
644
- }
645
- return TdDynamicDatepickerComponent;
646
- }());
647
- TdDynamicDatepickerComponent.decorators = [
648
- { type: core.Component, args: [{
649
- selector: 'td-dynamic-datepicker',
650
- 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",
651
- 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}"]
652
- }] }
653
- ];
654
- if (false) {
655
- /** @type {?} */
656
- TdDynamicDatepickerComponent.prototype.control;
657
- /** @type {?} */
658
- TdDynamicDatepickerComponent.prototype.label;
659
- /** @type {?} */
660
- TdDynamicDatepickerComponent.prototype.hint;
661
- /** @type {?} */
662
- TdDynamicDatepickerComponent.prototype.name;
663
- /** @type {?} */
664
- TdDynamicDatepickerComponent.prototype.type;
665
- /** @type {?} */
666
- TdDynamicDatepickerComponent.prototype.required;
667
- /** @type {?} */
668
- TdDynamicDatepickerComponent.prototype.min;
669
- /** @type {?} */
670
- TdDynamicDatepickerComponent.prototype.max;
671
- /** @type {?} */
672
- TdDynamicDatepickerComponent.prototype.errorMessageTemplate;
673
- /** @type {?} */
674
- TdDynamicDatepickerComponent.prototype.placeholder;
675
- }
676
-
677
- /**
678
- * @fileoverview added by tsickle
679
- * Generated from: services/dynamic-forms.service.ts
680
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
681
- */
682
- /** @enum {string} */
683
- var TdDynamicType = {
684
- Text: "text",
685
- Boolean: "boolean",
686
- Number: "number",
687
- Array: "array",
688
- Date: "date",
689
- };
690
- /** @enum {string} */
691
- var TdDynamicElement = {
692
- Input: "input",
693
- Datepicker: "datepicker",
694
- Password: "password",
695
- Textarea: "textarea",
696
- Slider: "slider",
697
- SlideToggle: "slide-toggle",
698
- Checkbox: "checkbox",
699
- Select: "select",
700
- FileInput: "file-input",
701
- };
702
- /**
703
- * @record
704
- */
705
- function ITdDynamicElementValidator() { }
706
- if (false) {
707
- /** @type {?} */
708
- ITdDynamicElementValidator.prototype.validator;
709
- }
710
- /**
711
- * @record
712
- */
713
- function ITdDynamicElementCustomConfig() { }
714
- /**
715
- * @record
716
- */
717
- function ITdDynamicElementConfig() { }
718
- if (false) {
719
- /** @type {?|undefined} */
720
- ITdDynamicElementConfig.prototype.label;
721
- /** @type {?} */
722
- ITdDynamicElementConfig.prototype.name;
723
- /** @type {?|undefined} */
724
- ITdDynamicElementConfig.prototype.hint;
725
- /** @type {?} */
726
- ITdDynamicElementConfig.prototype.type;
727
- /** @type {?|undefined} */
728
- ITdDynamicElementConfig.prototype.required;
729
- /** @type {?|undefined} */
730
- ITdDynamicElementConfig.prototype.disabled;
731
- /** @type {?|undefined} */
732
- ITdDynamicElementConfig.prototype.min;
733
- /** @type {?|undefined} */
734
- ITdDynamicElementConfig.prototype.max;
735
- /** @type {?|undefined} */
736
- ITdDynamicElementConfig.prototype.minLength;
737
- /** @type {?|undefined} */
738
- ITdDynamicElementConfig.prototype.maxLength;
739
- /** @type {?|undefined} */
740
- ITdDynamicElementConfig.prototype.selections;
741
- /** @type {?|undefined} */
742
- ITdDynamicElementConfig.prototype.multiple;
743
- /** @type {?|undefined} */
744
- ITdDynamicElementConfig.prototype.default;
745
- /** @type {?|undefined} */
746
- ITdDynamicElementConfig.prototype.flex;
747
- /** @type {?|undefined} */
748
- ITdDynamicElementConfig.prototype.validators;
749
- /** @type {?|undefined} */
750
- ITdDynamicElementConfig.prototype.customConfig;
751
- /** @type {?|undefined} */
752
- ITdDynamicElementConfig.prototype.placeholder;
753
- }
754
- /** @type {?} */
755
- var DYNAMIC_ELEMENT_NAME_REGEX = /^[^0-9][^\@]*$/;
756
- var TdDynamicFormsService = /** @class */ (function () {
757
- function TdDynamicFormsService() {
758
- }
759
- /**
760
- * Method to validate if the [name] is a proper element name.
761
- * Throws error if name is not valid.
762
- * @param {?} name
763
- * @return {?}
764
- */
765
- TdDynamicFormsService.prototype.validateDynamicElementName = function (name) {
766
- if (!DYNAMIC_ELEMENT_NAME_REGEX.test(name)) {
767
- throw new Error('Dynamic element name: "${name}" is not valid.');
768
- }
769
- };
770
- /**
771
- * Gets component to be rendered depending on [TdDynamicElement | TdDynamicType]
772
- * Throws error if it does not exists or not supported.
773
- * @param {?} element
774
- * @return {?}
775
- */
776
- TdDynamicFormsService.prototype.getDynamicElement = function (element) {
777
- switch (element) {
778
- case TdDynamicType.Text:
779
- case TdDynamicType.Number:
780
- case TdDynamicElement.Input:
781
- case TdDynamicElement.Password:
782
- return TdDynamicInputComponent;
783
- case TdDynamicElement.Textarea:
784
- return TdDynamicTextareaComponent;
785
- case TdDynamicType.Boolean:
786
- case TdDynamicElement.SlideToggle:
787
- return TdDynamicSlideToggleComponent;
788
- case TdDynamicElement.Checkbox:
789
- return TdDynamicCheckboxComponent;
790
- case TdDynamicElement.Slider:
791
- return TdDynamicSliderComponent;
792
- case TdDynamicType.Array:
793
- case TdDynamicElement.Select:
794
- return TdDynamicSelectComponent;
795
- case TdDynamicElement.FileInput:
796
- return TdDynamicFileInputComponent;
797
- case TdDynamicElement.Datepicker:
798
- case TdDynamicType.Date:
799
- return TdDynamicDatepickerComponent;
800
- default:
801
- throw new Error("Error: type " + element + " does not exist or not supported.");
802
- }
803
- };
804
- /**
805
- * Creates form control for element depending [ITdDynamicElementConfig] properties.
806
- * @param {?} config
807
- * @return {?}
808
- */
809
- TdDynamicFormsService.prototype.createFormControl = function (config) {
810
- /** @type {?} */
811
- var validator = this.createValidators(config);
812
- return new forms.FormControl({ value: config.default, disabled: config.disabled }, validator);
813
- };
814
- /**
815
- * Creates form validationdepending [ITdDynamicElementConfig] properties.
816
- * @param {?} config
817
- * @return {?}
818
- */
819
- TdDynamicFormsService.prototype.createValidators = function (config) {
820
- /** @type {?} */
821
- var validator;
822
- if (config.required) {
823
- validator = forms.Validators.required;
824
- }
825
- if (config.max || config.max === 0) {
826
- validator = forms.Validators.compose([validator, forms.Validators.max(parseFloat(config.max))]);
827
- }
828
- if (config.min || config.min === 0) {
829
- validator = forms.Validators.compose([validator, forms.Validators.min(parseFloat(config.min))]);
830
- }
831
- if (config.maxLength || config.maxLength === 0) {
832
- validator = forms.Validators.compose([validator, forms.Validators.maxLength(parseFloat(config.maxLength))]);
833
- }
834
- if (config.minLength || config.minLength === 0) {
835
- validator = forms.Validators.compose([validator, forms.Validators.minLength(parseFloat(config.minLength))]);
836
- }
837
- // Add provided custom validators to the validator function
838
- if (config.validators) {
839
- config.validators.forEach(( /**
840
- * @param {?} validatorConfig
841
- * @return {?}
842
- */function (validatorConfig) {
843
- validator = forms.Validators.compose([validator, validatorConfig.validator]);
844
- }));
845
- }
846
- return validator;
847
- };
848
- return TdDynamicFormsService;
849
- }());
850
- TdDynamicFormsService.decorators = [
851
- { type: core.Injectable }
852
- ];
853
- /**
854
- * @param {?} parent
855
- * @return {?}
856
- */
857
- function DYNAMIC_FORMS_PROVIDER_FACTORY(parent) {
858
- return parent || new TdDynamicFormsService();
859
- }
860
- /** @type {?} */
861
- var DYNAMIC_FORMS_PROVIDER = {
862
- // If there is already a service available, use that. Otherwise, provide a new one.
863
- provide: TdDynamicFormsService,
864
- deps: [[new core.Optional(), new core.SkipSelf(), TdDynamicFormsService]],
865
- useFactory: DYNAMIC_FORMS_PROVIDER_FACTORY,
866
- };
867
-
868
- var TdDynamicElementBase = /** @class */ (function () {
869
- /**
870
- * @param {?} _changeDetectorRef
871
- */
872
- function TdDynamicElementBase(_changeDetectorRef) {
873
- this._changeDetectorRef = _changeDetectorRef;
874
- }
875
- return TdDynamicElementBase;
876
- }());
877
- if (false) {
878
- /** @type {?} */
879
- TdDynamicElementBase.prototype._changeDetectorRef;
880
- }
881
- /* tslint:disable-next-line */
882
- /** @type {?} */
883
- var _TdDynamicElementMixinBase = common.mixinControlValueAccessor(TdDynamicElementBase);
884
- var TdDynamicFormsErrorTemplateDirective = /** @class */ (function (_super) {
885
- __extends(TdDynamicFormsErrorTemplateDirective, _super);
886
- /**
887
- * @param {?} templateRef
888
- * @param {?} viewContainerRef
889
- */
890
- function TdDynamicFormsErrorTemplateDirective(templateRef, viewContainerRef) {
891
- var _this = _super.call(this, templateRef, viewContainerRef) || this;
892
- _this.templateRef = templateRef;
893
- return _this;
894
- }
895
- return TdDynamicFormsErrorTemplateDirective;
896
- }(portal.TemplatePortalDirective));
897
- TdDynamicFormsErrorTemplateDirective.decorators = [
898
- { type: core.Directive, args: [{ selector: '[tdDynamicFormsError]ng-template' },] }
899
- ];
900
- /** @nocollapse */
901
- TdDynamicFormsErrorTemplateDirective.ctorParameters = function () { return [
902
- { type: core.TemplateRef },
903
- { type: core.ViewContainerRef }
904
- ]; };
905
- TdDynamicFormsErrorTemplateDirective.propDecorators = {
906
- tdDynamicFormsError: [{ type: core.Input }]
907
- };
908
- if (false) {
909
- /** @type {?} */
910
- TdDynamicFormsErrorTemplateDirective.prototype.tdDynamicFormsError;
911
- /** @type {?} */
912
- TdDynamicFormsErrorTemplateDirective.prototype.templateRef;
913
- }
914
- var TdDynamicElementDirective = /** @class */ (function () {
915
- /**
916
- * @param {?} viewContainer
917
- */
918
- function TdDynamicElementDirective(viewContainer) {
919
- this.viewContainer = viewContainer;
920
- }
921
- return TdDynamicElementDirective;
922
- }());
923
- TdDynamicElementDirective.decorators = [
924
- { type: core.Directive, args: [{
925
- selector: '[tdDynamicContainer]',
926
- },] }
927
- ];
928
- /** @nocollapse */
929
- TdDynamicElementDirective.ctorParameters = function () { return [
930
- { type: core.ViewContainerRef }
931
- ]; };
932
- if (false) {
933
- /** @type {?} */
934
- TdDynamicElementDirective.prototype.viewContainer;
935
- }
936
- var TdDynamicElementComponent = /** @class */ (function (_super) {
937
- __extends(TdDynamicElementComponent, _super);
938
- /**
939
- * @param {?} _componentFactoryResolver
940
- * @param {?} _dynamicFormsService
941
- * @param {?} _changeDetectorRef
942
- */
943
- function TdDynamicElementComponent(_componentFactoryResolver, _dynamicFormsService, _changeDetectorRef) {
944
- var _this = _super.call(this, _changeDetectorRef) || this;
945
- _this._componentFactoryResolver = _componentFactoryResolver;
946
- _this._dynamicFormsService = _dynamicFormsService;
947
- /**
948
- * Sets label to be displayed.
949
- */
950
- _this.label = '';
951
- /**
952
- * Sets hint to be displayed.
953
- */
954
- _this.hint = '';
955
- /**
956
- * Sets name to be displayed as attribute.
957
- */
958
- _this.name = '';
959
- /**
960
- * Sets type or element of element to be rendered.
961
- * Throws error if does not exist or no supported.
962
- */
963
- _this.type = undefined;
964
- /**
965
- * Sets required validation checkup (if supported by element).
966
- */
967
- _this.required = undefined;
968
- /**
969
- * Sets min validation checkup (if supported by element).
970
- */
971
- _this.min = undefined;
972
- /**
973
- * Sets max validation checkup (if supported by element).
974
- */
975
- _this.max = undefined;
976
- /**
977
- * Sets minLength validation checkup (if supported by element).
978
- */
979
- _this.minLength = undefined;
980
- /**
981
- * Sets maxLength validation checkup (if supported by element).
982
- */
983
- _this.maxLength = undefined;
984
- /**
985
- * Sets selections for array elements (if supported by element).
986
- */
987
- _this.selections = undefined;
988
- /**
989
- * Sets multiple property for array elements (if supported by element).
990
- */
991
- _this.multiple = undefined;
992
- /**
993
- * Sets error message template so it can be injected into dynamic components.
994
- */
995
- _this.errorMessageTemplate = undefined;
996
- /**
997
- * Sets the placeholder message
998
- */
999
- _this.placeholder = '';
1000
- return _this;
1001
- }
1002
- Object.defineProperty(TdDynamicElementComponent.prototype, "maxAttr", {
1003
- /**
1004
- * @return {?}
1005
- */
1006
- get: function () {
1007
- return this.max;
1008
- },
1009
- enumerable: false,
1010
- configurable: true
1011
- });
1012
- Object.defineProperty(TdDynamicElementComponent.prototype, "minAttr", {
1013
- /**
1014
- * @return {?}
1015
- */
1016
- get: function () {
1017
- return this.min;
1018
- },
1019
- enumerable: false,
1020
- configurable: true
1021
- });
1022
- /**
1023
- * @return {?}
1024
- */
1025
- TdDynamicElementComponent.prototype.ngOnInit = function () {
1026
- var _this = this;
1027
- /** @type {?} */
1028
- var component = ( /** @type {?} */(this.type)) instanceof core.Type ? this.type : this._dynamicFormsService.getDynamicElement(this.type);
1029
- /** @type {?} */
1030
- var ref = this._componentFactoryResolver
1031
- .resolveComponentFactory(component)
1032
- .create(this.childElement.viewContainer.injector);
1033
- this.childElement.viewContainer.insert(ref.hostView);
1034
- this._instance = ref.instance;
1035
- this._instance.control = this.dynamicControl;
1036
- this._instance.label = this.label;
1037
- this._instance.hint = this.hint;
1038
- this._instance.name = this.name;
1039
- this._instance.type = this.type;
1040
- this._instance.value = this.value;
1041
- this._instance.required = this.required;
1042
- this._instance.min = this.min;
1043
- this._instance.max = this.max;
1044
- this._instance.minLength = this.minLength;
1045
- this._instance.maxLength = this.maxLength;
1046
- this._instance.selections = this.selections;
1047
- this._instance.multiple = this.multiple;
1048
- this._instance.errorMessageTemplate = this.errorMessageTemplate;
1049
- this._instance.placeholder = this.placeholder;
1050
- if (this.customConfig) {
1051
- Object.getOwnPropertyNames(this.customConfig).forEach(( /**
1052
- * @param {?} name
1053
- * @return {?}
1054
- */function (name) {
1055
- _this._instance[name] = _this.customConfig[name];
1056
- }));
1057
- }
1058
- };
1059
- /**
1060
- * Reassign any inputs that have changed
1061
- * @param {?} changes
1062
- * @return {?}
1063
- */
1064
- TdDynamicElementComponent.prototype.ngOnChanges = function (changes) {
1065
- var e_1, _a;
1066
- if (this._instance) {
1067
- try {
1068
- for (var _b = __values(Object.keys(changes)), _c = _b.next(); !_c.done; _c = _b.next()) {
1069
- var prop = _c.value;
1070
- this._instance[prop] = changes[prop].currentValue;
1071
- }
1072
- }
1073
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1074
- finally {
1075
- try {
1076
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1077
- }
1078
- finally { if (e_1) throw e_1.error; }
1079
- }
1080
- }
1081
- };
1082
- return TdDynamicElementComponent;
1083
- }(_TdDynamicElementMixinBase));
1084
- TdDynamicElementComponent.decorators = [
1085
- { type: core.Component, args: [{
1086
- providers: [
1087
- TdDynamicFormsService,
1088
- {
1089
- provide: forms.NG_VALUE_ACCESSOR,
1090
- useExisting: core.forwardRef(( /**
1091
- * @return {?}
1092
- */function () { return TdDynamicElementComponent; })),
1093
- multi: true,
1094
- },
1095
- ],
1096
- selector: 'td-dynamic-element',
1097
- template: '<div tdDynamicContainer></div>'
1098
- }] }
1099
- ];
1100
- /** @nocollapse */
1101
- TdDynamicElementComponent.ctorParameters = function () { return [
1102
- { type: core.ComponentFactoryResolver },
1103
- { type: TdDynamicFormsService },
1104
- { type: core.ChangeDetectorRef }
1105
- ]; };
1106
- TdDynamicElementComponent.propDecorators = {
1107
- dynamicControl: [{ type: core.Input }],
1108
- label: [{ type: core.Input }],
1109
- hint: [{ type: core.Input }],
1110
- name: [{ type: core.Input }],
1111
- type: [{ type: core.Input }],
1112
- required: [{ type: core.Input }],
1113
- min: [{ type: core.Input }],
1114
- max: [{ type: core.Input }],
1115
- minLength: [{ type: core.Input }],
1116
- maxLength: [{ type: core.Input }],
1117
- selections: [{ type: core.Input }],
1118
- multiple: [{ type: core.Input }],
1119
- customConfig: [{ type: core.Input }],
1120
- errorMessageTemplate: [{ type: core.Input }],
1121
- placeholder: [{ type: core.Input }],
1122
- childElement: [{ type: core.ViewChild, args: [TdDynamicElementDirective, { static: true },] }],
1123
- maxAttr: [{ type: core.HostBinding, args: ['attr.max',] }],
1124
- minAttr: [{ type: core.HostBinding, args: ['attr.min',] }]
1125
- };
1126
- if (false) {
1127
- /**
1128
- * @type {?}
1129
- * @private
1130
- */
1131
- TdDynamicElementComponent.prototype._instance;
1132
- /**
1133
- * Sets form control of the element.
1134
- * @type {?}
1135
- */
1136
- TdDynamicElementComponent.prototype.dynamicControl;
1137
- /**
1138
- * Sets label to be displayed.
1139
- * @type {?}
1140
- */
1141
- TdDynamicElementComponent.prototype.label;
1142
- /**
1143
- * Sets hint to be displayed.
1144
- * @type {?}
1145
- */
1146
- TdDynamicElementComponent.prototype.hint;
1147
- /**
1148
- * Sets name to be displayed as attribute.
1149
- * @type {?}
1150
- */
1151
- TdDynamicElementComponent.prototype.name;
1152
- /**
1153
- * Sets type or element of element to be rendered.
1154
- * Throws error if does not exist or no supported.
1155
- * @type {?}
1156
- */
1157
- TdDynamicElementComponent.prototype.type;
1158
- /**
1159
- * Sets required validation checkup (if supported by element).
1160
- * @type {?}
1161
- */
1162
- TdDynamicElementComponent.prototype.required;
1163
- /**
1164
- * Sets min validation checkup (if supported by element).
1165
- * @type {?}
1166
- */
1167
- TdDynamicElementComponent.prototype.min;
1168
- /**
1169
- * Sets max validation checkup (if supported by element).
1170
- * @type {?}
1171
- */
1172
- TdDynamicElementComponent.prototype.max;
1173
- /**
1174
- * Sets minLength validation checkup (if supported by element).
1175
- * @type {?}
1176
- */
1177
- TdDynamicElementComponent.prototype.minLength;
1178
- /**
1179
- * Sets maxLength validation checkup (if supported by element).
1180
- * @type {?}
1181
- */
1182
- TdDynamicElementComponent.prototype.maxLength;
1183
- /**
1184
- * Sets selections for array elements (if supported by element).
1185
- * @type {?}
1186
- */
1187
- TdDynamicElementComponent.prototype.selections;
1188
- /**
1189
- * Sets multiple property for array elements (if supported by element).
1190
- * @type {?}
1191
- */
1192
- TdDynamicElementComponent.prototype.multiple;
1193
- /**
1194
- * Sets any additional properties on custom component.
1195
- * @type {?}
1196
- */
1197
- TdDynamicElementComponent.prototype.customConfig;
1198
- /**
1199
- * Sets error message template so it can be injected into dynamic components.
1200
- * @type {?}
1201
- */
1202
- TdDynamicElementComponent.prototype.errorMessageTemplate;
1203
- /**
1204
- * Sets the placeholder message
1205
- * @type {?}
1206
- */
1207
- TdDynamicElementComponent.prototype.placeholder;
1208
- /** @type {?} */
1209
- TdDynamicElementComponent.prototype.childElement;
1210
- /**
1211
- * @type {?}
1212
- * @private
1213
- */
1214
- TdDynamicElementComponent.prototype._componentFactoryResolver;
1215
- /**
1216
- * @type {?}
1217
- * @private
1218
- */
1219
- TdDynamicElementComponent.prototype._dynamicFormsService;
1220
- }
1221
-
1222
- var TdDynamicFormsComponent = /** @class */ (function () {
1223
- /**
1224
- * @param {?} _formBuilder
1225
- * @param {?} _dynamicFormsService
1226
- * @param {?} _changeDetectorRef
1227
- */
1228
- function TdDynamicFormsComponent(_formBuilder, _dynamicFormsService, _changeDetectorRef) {
1229
- this._formBuilder = _formBuilder;
1230
- this._dynamicFormsService = _dynamicFormsService;
1231
- this._changeDetectorRef = _changeDetectorRef;
1232
- this._renderedElements = [];
1233
- this._templateMap = new Map();
1234
- this._destroy$ = new rxjs.Subject();
1235
- this._destroyControl$ = new rxjs.Subject();
1236
- this.dynamicForm = this._formBuilder.group({});
1237
- }
1238
- Object.defineProperty(TdDynamicFormsComponent.prototype, "elements", {
1239
- /**
1240
- * @return {?}
1241
- */
1242
- get: function () {
1243
- return this._renderedElements;
1244
- },
1245
- /**
1246
- * elements: ITdDynamicElementConfig[]
1247
- * JS Object that will render the elements depending on its config.
1248
- * [name] property is required.
1249
- * @param {?} elements
1250
- * @return {?}
1251
- */
1252
- set: function (elements) {
1253
- if (elements) {
1254
- this._elements = elements;
1255
- }
1256
- else {
1257
- this._elements = [];
1258
- }
1259
- this._rerenderElements();
1260
- },
1261
- enumerable: false,
1262
- configurable: true
1263
- });
1264
- Object.defineProperty(TdDynamicFormsComponent.prototype, "form", {
1265
- /**
1266
- * Getter property for dynamic [FormGroup].
1267
- * @return {?}
1268
- */
1269
- get: function () {
1270
- return this.dynamicForm;
1271
- },
1272
- enumerable: false,
1273
- configurable: true
1274
- });
1275
- Object.defineProperty(TdDynamicFormsComponent.prototype, "valid", {
1276
- /**
1277
- * Getter property for [valid] of dynamic [FormGroup].
1278
- * @return {?}
1279
- */
1280
- get: function () {
1281
- if (this.dynamicForm) {
1282
- return this.dynamicForm.valid;
1283
- }
1284
- return false;
1285
- },
1286
- enumerable: false,
1287
- configurable: true
1288
- });
1289
- Object.defineProperty(TdDynamicFormsComponent.prototype, "value", {
1290
- /**
1291
- * Getter property for [value] of dynamic [FormGroup].
1292
- * @return {?}
1293
- */
1294
- get: function () {
1295
- if (this.dynamicForm) {
1296
- return this.dynamicForm.value;
1297
- }
1298
- return {};
1299
- },
1300
- enumerable: false,
1301
- configurable: true
1302
- });
1303
- Object.defineProperty(TdDynamicFormsComponent.prototype, "errors", {
1304
- /**
1305
- * Getter property for [errors] of dynamic [FormGroup].
1306
- * @return {?}
1307
- */
1308
- get: function () {
1309
- var e_1, _a;
1310
- if (this.dynamicForm) {
1311
- /** @type {?} */
1312
- var errors = {};
1313
- try {
1314
- for (var _b = __values(Object.keys(this.dynamicForm.controls)), _c = _b.next(); !_c.done; _c = _b.next()) {
1315
- var name = _c.value;
1316
- errors[name] = this.dynamicForm.controls[name].errors;
1317
- }
1318
- }
1319
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1320
- finally {
1321
- try {
1322
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1323
- }
1324
- finally { if (e_1) throw e_1.error; }
1325
- }
1326
- return errors;
1327
- }
1328
- return {};
1329
- },
1330
- enumerable: false,
1331
- configurable: true
1332
- });
1333
- Object.defineProperty(TdDynamicFormsComponent.prototype, "controls", {
1334
- /**
1335
- * Getter property for [controls] of dynamic [FormGroup].
1336
- * @return {?}
1337
- */
1338
- get: function () {
1339
- if (this.dynamicForm) {
1340
- return this.dynamicForm.controls;
1341
- }
1342
- return {};
1343
- },
1344
- enumerable: false,
1345
- configurable: true
1346
- });
1347
- /**
1348
- * @return {?}
1349
- */
1350
- TdDynamicFormsComponent.prototype.ngAfterContentInit = function () {
1351
- this._updateErrorTemplates();
1352
- };
1353
- /**
1354
- * @return {?}
1355
- */
1356
- TdDynamicFormsComponent.prototype.ngOnDestroy = function () {
1357
- this._destroy$.next();
1358
- this._destroy$.complete();
1359
- this._destroyControl$.complete();
1360
- };
1361
- /**
1362
- * Refreshes the form and rerenders all validator/element modifications.
1363
- * @return {?}
1364
- */
1365
- TdDynamicFormsComponent.prototype.refresh = function () {
1366
- this._rerenderElements();
1367
- this._updateErrorTemplates();
1368
- };
1369
- /**
1370
- * Getter method for error template references
1371
- * @param {?} name
1372
- * @return {?}
1373
- */
1374
- TdDynamicFormsComponent.prototype.getErrorTemplateRef = function (name) {
1375
- return this._templateMap.get(name);
1376
- };
1377
- /**
1378
- * Loads error templates and sets them in a map for faster access.
1379
- * @private
1380
- * @return {?}
1381
- */
1382
- TdDynamicFormsComponent.prototype._updateErrorTemplates = function () {
1383
- var e_2, _a;
1384
- this._templateMap = new Map();
1385
- try {
1386
- for (var _b = __values(this._errorTemplates.toArray()), _c = _b.next(); !_c.done; _c = _b.next()) {
1387
- var errorTemplate = _c.value;
1388
- this._templateMap.set(errorTemplate.tdDynamicFormsError, errorTemplate.templateRef);
1389
- }
1390
- }
1391
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1392
- finally {
1393
- try {
1394
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1395
- }
1396
- finally { if (e_2) throw e_2.error; }
1397
- }
1398
- };
1399
- /**
1400
- * @private
1401
- * @return {?}
1402
- */
1403
- TdDynamicFormsComponent.prototype._rerenderElements = function () {
1404
- var _this = this;
1405
- this._clearRemovedElements();
1406
- this._renderedElements = [];
1407
- /** @type {?} */
1408
- var duplicates = [];
1409
- this._elements.forEach(( /**
1410
- * @param {?} elem
1411
- * @return {?}
1412
- */function (elem) {
1413
- _this._dynamicFormsService.validateDynamicElementName(elem.name);
1414
- if (duplicates.indexOf(elem.name) > -1) {
1415
- throw new Error("Dynamic element name: \"" + elem.name + "\" is duplicated");
1416
- }
1417
- duplicates.push(elem.name);
1418
- /** @type {?} */
1419
- var dynamicElement = _this.dynamicForm.get(elem.name);
1420
- if (!dynamicElement) {
1421
- _this.dynamicForm.addControl(elem.name, _this._dynamicFormsService.createFormControl(elem));
1422
- _this._subscribeToControlStatusChanges(elem.name);
1423
- }
1424
- else {
1425
- dynamicElement.setValue(elem.default);
1426
- dynamicElement.markAsPristine();
1427
- dynamicElement.markAsUntouched();
1428
- if (elem.disabled) {
1429
- dynamicElement.disable();
1430
- }
1431
- else {
1432
- dynamicElement.enable();
1433
- }
1434
- dynamicElement.setValidators(_this._dynamicFormsService.createValidators(elem));
1435
- }
1436
- // copy objects so they are only changes when calling this method
1437
- _this._renderedElements.push(Object.assign({}, elem));
1438
- }));
1439
- // call a change detection since the whole form might change
1440
- this._changeDetectorRef.detectChanges();
1441
- rxjs.timer()
1442
- .toPromise()
1443
- .then(( /**
1444
- * @return {?}
1445
- */function () {
1446
- // call a markForCheck so elements are rendered correctly in OnPush
1447
- _this._changeDetectorRef.markForCheck();
1448
- }));
1449
- };
1450
- /**
1451
- * @private
1452
- * @return {?}
1453
- */
1454
- TdDynamicFormsComponent.prototype._clearRemovedElements = function () {
1455
- var _this = this;
1456
- this._renderedElements = this._renderedElements.filter(( /**
1457
- * @param {?} renderedElement
1458
- * @return {?}
1459
- */function (renderedElement) { return !_this._elements.some(( /**
1460
- * @param {?} element
1461
- * @return {?}
1462
- */function (element) { return element.name === renderedElement.name; })); }));
1463
- // remove elements that were removed from the array
1464
- this._renderedElements.forEach(( /**
1465
- * @param {?} elem
1466
- * @return {?}
1467
- */function (elem) {
1468
- _this._destroyControl$.next(elem.name);
1469
- _this.dynamicForm.removeControl(elem.name);
1470
- }));
1471
- };
1472
- // Updates component when manually adding errors to controls
1473
- /**
1474
- * @private
1475
- * @param {?} elementName
1476
- * @return {?}
1477
- */
1478
- TdDynamicFormsComponent.prototype._subscribeToControlStatusChanges = function (elementName) {
1479
- var _this = this;
1480
- /** @type {?} */
1481
- var control = this.controls[elementName];
1482
- /** @type {?} */
1483
- var controlDestroyed$ = this._destroyControl$.pipe(operators.filter(( /**
1484
- * @param {?} destroyedElementName
1485
- * @return {?}
1486
- */function (destroyedElementName) { return destroyedElementName === elementName; })));
1487
- control.statusChanges.pipe(operators.takeUntil(this._destroy$), operators.takeUntil(controlDestroyed$)).subscribe(( /**
1488
- * @return {?}
1489
- */function () {
1490
- _this._changeDetectorRef.markForCheck();
1491
- }));
1492
- };
1493
- return TdDynamicFormsComponent;
1494
- }());
1495
- TdDynamicFormsComponent.decorators = [
1496
- { type: core.Component, args: [{
1497
- selector: 'td-dynamic-forms',
1498
- 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",
1499
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1500
- 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}"]
1501
- }] }
1502
- ];
1503
- /** @nocollapse */
1504
- TdDynamicFormsComponent.ctorParameters = function () { return [
1505
- { type: forms.FormBuilder },
1506
- { type: TdDynamicFormsService },
1507
- { type: core.ChangeDetectorRef }
1508
- ]; };
1509
- TdDynamicFormsComponent.propDecorators = {
1510
- _errorTemplates: [{ type: core.ContentChildren, args: [TdDynamicFormsErrorTemplateDirective, { descendants: true },] }],
1511
- elements: [{ type: core.Input, args: ['elements',] }]
1512
- };
1513
- if (false) {
1514
- /**
1515
- * @type {?}
1516
- * @private
1517
- */
1518
- TdDynamicFormsComponent.prototype._renderedElements;
1519
- /**
1520
- * @type {?}
1521
- * @private
1522
- */
1523
- TdDynamicFormsComponent.prototype._elements;
1524
- /**
1525
- * @type {?}
1526
- * @private
1527
- */
1528
- TdDynamicFormsComponent.prototype._templateMap;
1529
- /**
1530
- * @type {?}
1531
- * @private
1532
- */
1533
- TdDynamicFormsComponent.prototype._destroy$;
1534
- /**
1535
- * @type {?}
1536
- * @private
1537
- */
1538
- TdDynamicFormsComponent.prototype._destroyControl$;
1539
- /** @type {?} */
1540
- TdDynamicFormsComponent.prototype._errorTemplates;
1541
- /** @type {?} */
1542
- TdDynamicFormsComponent.prototype.dynamicForm;
1543
- /**
1544
- * @type {?}
1545
- * @private
1546
- */
1547
- TdDynamicFormsComponent.prototype._formBuilder;
1548
- /**
1549
- * @type {?}
1550
- * @private
1551
- */
1552
- TdDynamicFormsComponent.prototype._dynamicFormsService;
1553
- /**
1554
- * @type {?}
1555
- * @private
1556
- */
1557
- TdDynamicFormsComponent.prototype._changeDetectorRef;
1558
- }
1559
-
1560
- /**
1561
- * @fileoverview added by tsickle
1562
- * Generated from: dynamic-forms.module.ts
1563
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1564
- */
1565
- /** @type {?} */
1566
- var TD_DYNAMIC_FORMS = [
1567
- TdDynamicFormsComponent,
1568
- TdDynamicElementComponent,
1569
- TdDynamicElementDirective,
1570
- TdDynamicFormsErrorTemplateDirective,
1571
- ];
1572
- /** @type {?} */
1573
- var TD_DYNAMIC_FORMS_ENTRY_COMPONENTS = [
1574
- TdDynamicInputComponent,
1575
- TdDynamicFileInputComponent,
1576
- TdDynamicTextareaComponent,
1577
- TdDynamicSlideToggleComponent,
1578
- TdDynamicCheckboxComponent,
1579
- TdDynamicSliderComponent,
1580
- TdDynamicSelectComponent,
1581
- TdDynamicDatepickerComponent,
1582
- ];
1583
- var CovalentDynamicFormsModule = /** @class */ (function () {
1584
- function CovalentDynamicFormsModule() {
1585
- }
1586
- return CovalentDynamicFormsModule;
1587
- }());
1588
- CovalentDynamicFormsModule.decorators = [
1589
- { type: core.NgModule, args: [{
1590
- declarations: [TD_DYNAMIC_FORMS, TD_DYNAMIC_FORMS_ENTRY_COMPONENTS],
1591
- imports: [
1592
- common$1.CommonModule,
1593
- forms.ReactiveFormsModule,
1594
- formField.MatFormFieldModule,
1595
- input.MatInputModule,
1596
- select.MatSelectModule,
1597
- checkbox.MatCheckboxModule,
1598
- slider.MatSliderModule,
1599
- slideToggle.MatSlideToggleModule,
1600
- icon.MatIconModule,
1601
- button.MatButtonModule,
1602
- datepicker.MatDatepickerModule,
1603
- common.CovalentCommonModule,
1604
- file.CovalentFileModule,
1605
- ],
1606
- exports: [TD_DYNAMIC_FORMS, TD_DYNAMIC_FORMS_ENTRY_COMPONENTS],
1607
- providers: [DYNAMIC_FORMS_PROVIDER],
1608
- },] }
1609
- ];
1610
-
1611
- /**
1612
- * @fileoverview added by tsickle
1613
- * Generated from: public_api.ts
1614
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1615
- */
1616
-
1617
- /**
1618
- * @fileoverview added by tsickle
1619
- * Generated from: index.ts
1620
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1621
- */
1622
-
1623
- /**
1624
- * @fileoverview added by tsickle
1625
- * Generated from: covalent-dynamic-forms.ts
1626
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1627
- */
1628
-
1629
- exports.CovalentDynamicFormsModule = CovalentDynamicFormsModule;
1630
- exports.DYNAMIC_ELEMENT_NAME_REGEX = DYNAMIC_ELEMENT_NAME_REGEX;
1631
- exports.DYNAMIC_FORMS_PROVIDER = DYNAMIC_FORMS_PROVIDER;
1632
- exports.DYNAMIC_FORMS_PROVIDER_FACTORY = DYNAMIC_FORMS_PROVIDER_FACTORY;
1633
- exports.TdDynamicCheckboxComponent = TdDynamicCheckboxComponent;
1634
- exports.TdDynamicDatepickerComponent = TdDynamicDatepickerComponent;
1635
- exports.TdDynamicElement = TdDynamicElement;
1636
- exports.TdDynamicElementBase = TdDynamicElementBase;
1637
- exports.TdDynamicElementComponent = TdDynamicElementComponent;
1638
- exports.TdDynamicElementDirective = TdDynamicElementDirective;
1639
- exports.TdDynamicFileInputComponent = TdDynamicFileInputComponent;
1640
- exports.TdDynamicFormsComponent = TdDynamicFormsComponent;
1641
- exports.TdDynamicFormsErrorTemplateDirective = TdDynamicFormsErrorTemplateDirective;
1642
- exports.TdDynamicFormsService = TdDynamicFormsService;
1643
- exports.TdDynamicInputComponent = TdDynamicInputComponent;
1644
- exports.TdDynamicSelectComponent = TdDynamicSelectComponent;
1645
- exports.TdDynamicSlideToggleComponent = TdDynamicSlideToggleComponent;
1646
- exports.TdDynamicSliderComponent = TdDynamicSliderComponent;
1647
- exports.TdDynamicTextareaComponent = TdDynamicTextareaComponent;
1648
- exports.TdDynamicType = TdDynamicType;
1649
- exports._TdDynamicElementMixinBase = _TdDynamicElementMixinBase;
1650
-
1651
- Object.defineProperty(exports, '__esModule', { value: true });
1652
-
1653
- })));
1654
- //# sourceMappingURL=covalent-dynamic-forms.umd.js.map