@rxap/material-form-system 12.1.0 → 13.0.0-next.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 (49) hide show
  1. package/esm2020/index.mjs +12 -0
  2. package/esm2020/lib/chip-input-adapter.directive.mjs +50 -0
  3. package/esm2020/lib/chip-list-iterator.directive.mjs +107 -0
  4. package/esm2020/lib/compare-with.directive.mjs +65 -0
  5. package/esm2020/lib/control-error.directive.mjs +89 -0
  6. package/esm2020/lib/control-errors.directive.mjs +79 -0
  7. package/esm2020/lib/form-controls/form-controls.component.mjs +123 -0
  8. package/esm2020/lib/form-controls/form-controls.component.module.mjs +42 -0
  9. package/esm2020/lib/form-field-hide-show.directive.mjs +151 -0
  10. package/esm2020/lib/input-clear-button.directive.mjs +61 -0
  11. package/esm2020/lib/material-form-system.module.mjs +33 -0
  12. package/esm2020/lib/required.directive.mjs +45 -0
  13. package/esm2020/rxap-material-form-system.mjs +5 -0
  14. package/fesm2015/rxap-material-form-system.mjs +831 -0
  15. package/fesm2015/rxap-material-form-system.mjs.map +1 -0
  16. package/{fesm2015/rxap-material-form-system.js → fesm2020/rxap-material-form-system.mjs} +93 -117
  17. package/fesm2020/rxap-material-form-system.mjs.map +1 -0
  18. package/package.json +41 -27
  19. package/src/schematics/ng-add/index.js +1 -1
  20. package/src/schematics/ng-add/index.js.map +1 -1
  21. package/bundles/rxap-material-form-system.umd.js +0 -1253
  22. package/bundles/rxap-material-form-system.umd.js.map +0 -1
  23. package/esm2015/index.js +0 -12
  24. package/esm2015/index.js.map +0 -1
  25. package/esm2015/lib/chip-input-adapter.directive.js +0 -52
  26. package/esm2015/lib/chip-input-adapter.directive.js.map +0 -1
  27. package/esm2015/lib/chip-list-iterator.directive.js +0 -108
  28. package/esm2015/lib/chip-list-iterator.directive.js.map +0 -1
  29. package/esm2015/lib/compare-with.directive.js +0 -65
  30. package/esm2015/lib/compare-with.directive.js.map +0 -1
  31. package/esm2015/lib/control-error.directive.js +0 -91
  32. package/esm2015/lib/control-error.directive.js.map +0 -1
  33. package/esm2015/lib/control-errors.directive.js +0 -81
  34. package/esm2015/lib/control-errors.directive.js.map +0 -1
  35. package/esm2015/lib/form-controls/form-controls.component.js +0 -129
  36. package/esm2015/lib/form-controls/form-controls.component.js.map +0 -1
  37. package/esm2015/lib/form-controls/form-controls.component.module.js +0 -42
  38. package/esm2015/lib/form-controls/form-controls.component.module.js.map +0 -1
  39. package/esm2015/lib/form-field-hide-show.directive.js +0 -161
  40. package/esm2015/lib/form-field-hide-show.directive.js.map +0 -1
  41. package/esm2015/lib/input-clear-button.directive.js +0 -61
  42. package/esm2015/lib/input-clear-button.directive.js.map +0 -1
  43. package/esm2015/lib/material-form-system.module.js +0 -33
  44. package/esm2015/lib/material-form-system.module.js.map +0 -1
  45. package/esm2015/lib/required.directive.js +0 -46
  46. package/esm2015/lib/required.directive.js.map +0 -1
  47. package/esm2015/rxap-material-form-system.js +0 -5
  48. package/esm2015/rxap-material-form-system.js.map +0 -1
  49. package/fesm2015/rxap-material-form-system.js.map +0 -1
@@ -1,1253 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/form-field'), require('@rxap/forms'), require('rxjs/operators'), require('@rxap/utilities'), require('rxjs'), require('@rxap/form-system'), require('@rxap/mixin'), require('@rxap/utilities/reflect-metadata'), require('@angular/material/select'), require('@angular/router'), require('@angular/material/snack-bar'), require('@angular/localize/init'), require('@angular/material/button'), require('@angular/material/progress-spinner'), require('@angular/flex-layout/flex'), require('@angular/flex-layout/extended'), require('@angular/common'), require('@angular/flex-layout'), require('@angular/cdk/keycodes'), require('@angular/material/chips'), require('@angular/forms'), require('@rxap/utilities/rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@rxap/material-form-system', ['exports', '@angular/core', '@angular/material/form-field', '@rxap/forms', 'rxjs/operators', '@rxap/utilities', 'rxjs', '@rxap/form-system', '@rxap/mixin', '@rxap/utilities/reflect-metadata', '@angular/material/select', '@angular/router', '@angular/material/snack-bar', '@angular/localize/init', '@angular/material/button', '@angular/material/progress-spinner', '@angular/flex-layout/flex', '@angular/flex-layout/extended', '@angular/common', '@angular/flex-layout', '@angular/cdk/keycodes', '@angular/material/chips', '@angular/forms', '@rxap/utilities/rxjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap['material-form-system'] = {}), global.ng.core, global.ng.material.formField, global.i6, global.rxjs.operators, global.utilities, global.rxjs, global.formSystem, global.mixin, global.reflectMetadata, global.ng.material.select, global.ng.router, global.ng.material.snackBar, global.ng.localize.init, global.ng.material.button, global.ng.material.progressSpinner, global.ng.flexLayout.flex, global.ng.flexLayout.extended, global.ng.common, global.ng.flexLayout, global.ng.cdk.keycodes, global.ng.material.chips, global.ng.forms, global.rxjs$1));
5
- }(this, (function (exports, i0, i1, i6, operators, utilities, rxjs, formSystem, mixin, reflectMetadata, i1$1, i8, i7, init, i1$2, i2, i3, i4, i5, flexLayout, keycodes, i1$3, i2$1, rxjs$1) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
30
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
31
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
32
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
33
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
34
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
35
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
36
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
37
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
38
- var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
39
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
40
-
41
- /*! *****************************************************************************
42
- Copyright (c) Microsoft Corporation.
43
-
44
- Permission to use, copy, modify, and/or distribute this software for any
45
- purpose with or without fee is hereby granted.
46
-
47
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
48
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
49
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
50
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
51
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
52
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
53
- PERFORMANCE OF THIS SOFTWARE.
54
- ***************************************************************************** */
55
- /* global Reflect, Promise */
56
- var extendStatics = function (d, b) {
57
- extendStatics = Object.setPrototypeOf ||
58
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
59
- function (d, b) { for (var p in b)
60
- if (Object.prototype.hasOwnProperty.call(b, p))
61
- d[p] = b[p]; };
62
- return extendStatics(d, b);
63
- };
64
- function __extends(d, b) {
65
- if (typeof b !== "function" && b !== null)
66
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
67
- extendStatics(d, b);
68
- function __() { this.constructor = d; }
69
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
70
- }
71
- var __assign = function () {
72
- __assign = Object.assign || function __assign(t) {
73
- for (var s, i = 1, n = arguments.length; i < n; i++) {
74
- s = arguments[i];
75
- for (var p in s)
76
- if (Object.prototype.hasOwnProperty.call(s, p))
77
- t[p] = s[p];
78
- }
79
- return t;
80
- };
81
- return __assign.apply(this, arguments);
82
- };
83
- function __rest(s, e) {
84
- var t = {};
85
- for (var p in s)
86
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
87
- t[p] = s[p];
88
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
89
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
90
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
91
- t[p[i]] = s[p[i]];
92
- }
93
- return t;
94
- }
95
- function __decorate(decorators, target, key, desc) {
96
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
97
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
98
- r = Reflect.decorate(decorators, target, key, desc);
99
- else
100
- for (var i = decorators.length - 1; i >= 0; i--)
101
- if (d = decorators[i])
102
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
103
- return c > 3 && r && Object.defineProperty(target, key, r), r;
104
- }
105
- function __param(paramIndex, decorator) {
106
- return function (target, key) { decorator(target, key, paramIndex); };
107
- }
108
- function __metadata(metadataKey, metadataValue) {
109
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
110
- return Reflect.metadata(metadataKey, metadataValue);
111
- }
112
- function __awaiter(thisArg, _arguments, P, generator) {
113
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
114
- return new (P || (P = Promise))(function (resolve, reject) {
115
- function fulfilled(value) { try {
116
- step(generator.next(value));
117
- }
118
- catch (e) {
119
- reject(e);
120
- } }
121
- function rejected(value) { try {
122
- step(generator["throw"](value));
123
- }
124
- catch (e) {
125
- reject(e);
126
- } }
127
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
128
- step((generator = generator.apply(thisArg, _arguments || [])).next());
129
- });
130
- }
131
- function __generator(thisArg, body) {
132
- var _ = { label: 0, sent: function () { if (t[0] & 1)
133
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
134
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
135
- function verb(n) { return function (v) { return step([n, v]); }; }
136
- function step(op) {
137
- if (f)
138
- throw new TypeError("Generator is already executing.");
139
- while (_)
140
- try {
141
- 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)
142
- return t;
143
- if (y = 0, t)
144
- op = [op[0] & 2, t.value];
145
- switch (op[0]) {
146
- case 0:
147
- case 1:
148
- t = op;
149
- break;
150
- case 4:
151
- _.label++;
152
- return { value: op[1], done: false };
153
- case 5:
154
- _.label++;
155
- y = op[1];
156
- op = [0];
157
- continue;
158
- case 7:
159
- op = _.ops.pop();
160
- _.trys.pop();
161
- continue;
162
- default:
163
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
164
- _ = 0;
165
- continue;
166
- }
167
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
168
- _.label = op[1];
169
- break;
170
- }
171
- if (op[0] === 6 && _.label < t[1]) {
172
- _.label = t[1];
173
- t = op;
174
- break;
175
- }
176
- if (t && _.label < t[2]) {
177
- _.label = t[2];
178
- _.ops.push(op);
179
- break;
180
- }
181
- if (t[2])
182
- _.ops.pop();
183
- _.trys.pop();
184
- continue;
185
- }
186
- op = body.call(thisArg, _);
187
- }
188
- catch (e) {
189
- op = [6, e];
190
- y = 0;
191
- }
192
- finally {
193
- f = t = 0;
194
- }
195
- if (op[0] & 5)
196
- throw op[1];
197
- return { value: op[0] ? op[1] : void 0, done: true };
198
- }
199
- }
200
- var __createBinding = Object.create ? (function (o, m, k, k2) {
201
- if (k2 === undefined)
202
- k2 = k;
203
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
204
- }) : (function (o, m, k, k2) {
205
- if (k2 === undefined)
206
- k2 = k;
207
- o[k2] = m[k];
208
- });
209
- function __exportStar(m, o) {
210
- for (var p in m)
211
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
212
- __createBinding(o, m, p);
213
- }
214
- function __values(o) {
215
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
216
- if (m)
217
- return m.call(o);
218
- if (o && typeof o.length === "number")
219
- return {
220
- next: function () {
221
- if (o && i >= o.length)
222
- o = void 0;
223
- return { value: o && o[i++], done: !o };
224
- }
225
- };
226
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
227
- }
228
- function __read(o, n) {
229
- var m = typeof Symbol === "function" && o[Symbol.iterator];
230
- if (!m)
231
- return o;
232
- var i = m.call(o), r, ar = [], e;
233
- try {
234
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
235
- ar.push(r.value);
236
- }
237
- catch (error) {
238
- e = { error: error };
239
- }
240
- finally {
241
- try {
242
- if (r && !r.done && (m = i["return"]))
243
- m.call(i);
244
- }
245
- finally {
246
- if (e)
247
- throw e.error;
248
- }
249
- }
250
- return ar;
251
- }
252
- /** @deprecated */
253
- function __spread() {
254
- for (var ar = [], i = 0; i < arguments.length; i++)
255
- ar = ar.concat(__read(arguments[i]));
256
- return ar;
257
- }
258
- /** @deprecated */
259
- function __spreadArrays() {
260
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
261
- s += arguments[i].length;
262
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
263
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
264
- r[k] = a[j];
265
- return r;
266
- }
267
- function __spreadArray(to, from) {
268
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
269
- to[j] = from[i];
270
- return to;
271
- }
272
- function __await(v) {
273
- return this instanceof __await ? (this.v = v, this) : new __await(v);
274
- }
275
- function __asyncGenerator(thisArg, _arguments, generator) {
276
- if (!Symbol.asyncIterator)
277
- throw new TypeError("Symbol.asyncIterator is not defined.");
278
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
279
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
280
- function verb(n) { if (g[n])
281
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
282
- function resume(n, v) { try {
283
- step(g[n](v));
284
- }
285
- catch (e) {
286
- settle(q[0][3], e);
287
- } }
288
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
289
- function fulfill(value) { resume("next", value); }
290
- function reject(value) { resume("throw", value); }
291
- function settle(f, v) { if (f(v), q.shift(), q.length)
292
- resume(q[0][0], q[0][1]); }
293
- }
294
- function __asyncDelegator(o) {
295
- var i, p;
296
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
297
- 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; }
298
- }
299
- function __asyncValues(o) {
300
- if (!Symbol.asyncIterator)
301
- throw new TypeError("Symbol.asyncIterator is not defined.");
302
- var m = o[Symbol.asyncIterator], i;
303
- 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);
304
- 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); }); }; }
305
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
306
- }
307
- function __makeTemplateObject(cooked, raw) {
308
- if (Object.defineProperty) {
309
- Object.defineProperty(cooked, "raw", { value: raw });
310
- }
311
- else {
312
- cooked.raw = raw;
313
- }
314
- return cooked;
315
- }
316
- ;
317
- var __setModuleDefault = Object.create ? (function (o, v) {
318
- Object.defineProperty(o, "default", { enumerable: true, value: v });
319
- }) : function (o, v) {
320
- o["default"] = v;
321
- };
322
- function __importStar(mod) {
323
- if (mod && mod.__esModule)
324
- return mod;
325
- var result = {};
326
- if (mod != null)
327
- for (var k in mod)
328
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
329
- __createBinding(result, mod, k);
330
- __setModuleDefault(result, mod);
331
- return result;
332
- }
333
- function __importDefault(mod) {
334
- return (mod && mod.__esModule) ? mod : { default: mod };
335
- }
336
- function __classPrivateFieldGet(receiver, state, kind, f) {
337
- if (kind === "a" && !f)
338
- throw new TypeError("Private accessor was defined without a getter");
339
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
340
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
341
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
342
- }
343
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
344
- if (kind === "m")
345
- throw new TypeError("Private method is not writable");
346
- if (kind === "a" && !f)
347
- throw new TypeError("Private accessor was defined without a setter");
348
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
349
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
350
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
351
- }
352
-
353
- var ControlErrorDirective = /** @class */ (function () {
354
- function ControlErrorDirective(formField, template, viewContainerRef, cdr) {
355
- this.formField = formField;
356
- this.template = template;
357
- this.viewContainerRef = viewContainerRef;
358
- this.cdr = cdr;
359
- }
360
- ControlErrorDirective.ngTemplateContextGuard = function (dir, ctx) {
361
- return true;
362
- };
363
- ControlErrorDirective.prototype.ngAfterContentInit = function () {
364
- var _this = this;
365
- var _a;
366
- var control = (_a = this.formField._control.ngControl) === null || _a === void 0 ? void 0 : _a.control;
367
- if (control) {
368
- this._control = control;
369
- this._subscription = i6.controlErrorChanges$(control)
370
- .pipe(operators.tap(function (errors) { return _this.render(errors); }))
371
- .subscribe();
372
- }
373
- else {
374
- throw new Error('The form field has not a control associated!');
375
- }
376
- };
377
- ControlErrorDirective.prototype.render = function (errors) {
378
- this.viewContainerRef.clear();
379
- if (errors && errors.hasOwnProperty(this.key)) {
380
- var error = errors[this.key];
381
- if (!this._control) {
382
- throw new Error('The control is not defined!');
383
- }
384
- this.viewContainerRef.createEmbeddedView(this.template, {
385
- $implicit: error,
386
- control: this._control,
387
- });
388
- }
389
- this.cdr.detectChanges();
390
- };
391
- ControlErrorDirective.prototype.ngOnDestroy = function () {
392
- var _a;
393
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
394
- };
395
- return ControlErrorDirective;
396
- }());
397
- ControlErrorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirective, deps: [{ token: i1.MAT_FORM_FIELD }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
398
- ControlErrorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ControlErrorDirective, selector: "[rxapControlError]", inputs: { key: ["rxapControlErrorKey", "key"] }, ngImport: i0__namespace });
399
- __decorate([
400
- utilities.Required,
401
- __metadata("design:type", String)
402
- ], ControlErrorDirective.prototype, "key", void 0);
403
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirective, decorators: [{
404
- type: i0.Directive,
405
- args: [{
406
- // tslint:disable-next-line:directive-selector
407
- selector: '[rxapControlError]',
408
- }]
409
- }], ctorParameters: function () {
410
- return [{ type: i1__namespace.MatFormField, decorators: [{
411
- type: i0.Inject,
412
- args: [i1.MAT_FORM_FIELD]
413
- }] }, { type: i0__namespace.TemplateRef, decorators: [{
414
- type: i0.Inject,
415
- args: [i0.TemplateRef]
416
- }] }, { type: i0__namespace.ViewContainerRef, decorators: [{
417
- type: i0.Inject,
418
- args: [i0.ViewContainerRef]
419
- }] }, { type: i0__namespace.ChangeDetectorRef, decorators: [{
420
- type: i0.Inject,
421
- args: [i0.ChangeDetectorRef]
422
- }] }];
423
- }, propDecorators: { key: [{
424
- type: i0.Input,
425
- args: ['rxapControlErrorKey']
426
- }] } });
427
- var ControlErrorDirectiveModule = /** @class */ (function () {
428
- function ControlErrorDirectiveModule() {
429
- }
430
- return ControlErrorDirectiveModule;
431
- }());
432
- ControlErrorDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
433
- ControlErrorDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirectiveModule, declarations: [ControlErrorDirective], exports: [ControlErrorDirective] });
434
- ControlErrorDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirectiveModule });
435
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorDirectiveModule, decorators: [{
436
- type: i0.NgModule,
437
- args: [{
438
- declarations: [ControlErrorDirective],
439
- exports: [ControlErrorDirective],
440
- }]
441
- }] });
442
-
443
- var ControlErrorsDirective = /** @class */ (function () {
444
- function ControlErrorsDirective(formField, template, viewContainerRef, cdr) {
445
- this.formField = formField;
446
- this.template = template;
447
- this.viewContainerRef = viewContainerRef;
448
- this.cdr = cdr;
449
- }
450
- ControlErrorsDirective.ngTemplateContextGuard = function (dir, ctx) {
451
- return true;
452
- };
453
- ControlErrorsDirective.prototype.ngAfterContentInit = function () {
454
- var _this = this;
455
- var _a;
456
- var control = (_a = this.formField._control.ngControl) === null || _a === void 0 ? void 0 : _a.control;
457
- if (control) {
458
- this._control = control;
459
- this._subscription = i6.controlErrorChanges$(control)
460
- .pipe(operators.tap(function (errors) { return _this.render(errors); }))
461
- .subscribe();
462
- }
463
- else {
464
- throw new Error('The form field has not a control associated!');
465
- }
466
- };
467
- ControlErrorsDirective.prototype.render = function (errors) {
468
- this.viewContainerRef.clear();
469
- if (errors) {
470
- if (!this._control) {
471
- throw new Error('The control is not defined!');
472
- }
473
- this.viewContainerRef.createEmbeddedView(this.template, {
474
- $implicit: errors,
475
- control: this._control,
476
- });
477
- }
478
- this.cdr.detectChanges();
479
- };
480
- ControlErrorsDirective.prototype.ngOnDestroy = function () {
481
- var _a;
482
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
483
- };
484
- return ControlErrorsDirective;
485
- }());
486
- ControlErrorsDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirective, deps: [{ token: i1.MAT_FORM_FIELD }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
487
- ControlErrorsDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ControlErrorsDirective, selector: "[rxapControlErrors]", ngImport: i0__namespace });
488
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirective, decorators: [{
489
- type: i0.Directive,
490
- args: [{
491
- // tslint:disable-next-line:directive-selector
492
- selector: '[rxapControlErrors]',
493
- }]
494
- }], ctorParameters: function () {
495
- return [{ type: i1__namespace.MatFormField, decorators: [{
496
- type: i0.Inject,
497
- args: [i1.MAT_FORM_FIELD]
498
- }] }, { type: i0__namespace.TemplateRef, decorators: [{
499
- type: i0.Inject,
500
- args: [i0.TemplateRef]
501
- }] }, { type: i0__namespace.ViewContainerRef, decorators: [{
502
- type: i0.Inject,
503
- args: [i0.ViewContainerRef]
504
- }] }, { type: i0__namespace.ChangeDetectorRef, decorators: [{
505
- type: i0.Inject,
506
- args: [i0.ChangeDetectorRef]
507
- }] }];
508
- } });
509
- var ControlErrorsDirectiveModule = /** @class */ (function () {
510
- function ControlErrorsDirectiveModule() {
511
- }
512
- return ControlErrorsDirectiveModule;
513
- }());
514
- ControlErrorsDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
515
- ControlErrorsDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirectiveModule, declarations: [ControlErrorsDirective], exports: [ControlErrorsDirective] });
516
- ControlErrorsDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirectiveModule });
517
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ControlErrorsDirectiveModule, decorators: [{
518
- type: i0.NgModule,
519
- args: [{
520
- declarations: [ControlErrorsDirective],
521
- exports: [ControlErrorsDirective],
522
- }]
523
- }] });
524
-
525
- var InputClearButtonDirective = /** @class */ (function () {
526
- function InputClearButtonDirective(formField) {
527
- this.formField = formField;
528
- this.type = 'button';
529
- this.tabIndex = '-1';
530
- }
531
- Object.defineProperty(InputClearButtonDirective.prototype, "control", {
532
- get: function () {
533
- return this.formField._control;
534
- },
535
- enumerable: false,
536
- configurable: true
537
- });
538
- Object.defineProperty(InputClearButtonDirective.prototype, "isDisabled", {
539
- get: function () {
540
- return this.control.disabled;
541
- },
542
- enumerable: false,
543
- configurable: true
544
- });
545
- InputClearButtonDirective.prototype.onClick = function () {
546
- if (this.control.ngControl) {
547
- this.control.ngControl.reset();
548
- }
549
- else {
550
- this.control.value = null;
551
- }
552
- };
553
- return InputClearButtonDirective;
554
- }());
555
- InputClearButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirective, deps: [{ token: i1.MAT_FORM_FIELD }], target: i0__namespace.ɵɵFactoryTarget.Directive });
556
- InputClearButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: InputClearButtonDirective, selector: "[rxapInputClearButton]", host: { listeners: { "click": "onClick()" }, properties: { "attr.type": "this.type", "attr.tabindex": "this.tabIndex", "disabled": "this.isDisabled" } }, ngImport: i0__namespace });
557
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirective, decorators: [{
558
- type: i0.Directive,
559
- args: [{
560
- selector: '[rxapInputClearButton]'
561
- }]
562
- }], ctorParameters: function () {
563
- return [{ type: i1__namespace.MatFormField, decorators: [{
564
- type: i0.Inject,
565
- args: [i1.MAT_FORM_FIELD]
566
- }] }];
567
- }, propDecorators: { type: [{
568
- type: i0.HostBinding,
569
- args: ['attr.type']
570
- }], tabIndex: [{
571
- type: i0.HostBinding,
572
- args: ['attr.tabindex']
573
- }], isDisabled: [{
574
- type: i0.HostBinding,
575
- args: ['disabled']
576
- }], onClick: [{
577
- type: i0.HostListener,
578
- args: ['click']
579
- }] } });
580
- var InputClearButtonDirectiveModule = /** @class */ (function () {
581
- function InputClearButtonDirectiveModule() {
582
- }
583
- return InputClearButtonDirectiveModule;
584
- }());
585
- InputClearButtonDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
586
- InputClearButtonDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirectiveModule, declarations: [InputClearButtonDirective], exports: [InputClearButtonDirective] });
587
- InputClearButtonDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirectiveModule });
588
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: InputClearButtonDirectiveModule, decorators: [{
589
- type: i0.NgModule,
590
- args: [{
591
- declarations: [InputClearButtonDirective],
592
- exports: [InputClearButtonDirective]
593
- }]
594
- }] });
595
-
596
- var RequiredDirective = /** @class */ (function () {
597
- function RequiredDirective(formField) {
598
- this.formField = formField;
599
- }
600
- RequiredDirective.prototype.ngAfterContentInit = function () {
601
- var _a;
602
- var control = (_a = this.formField._control.ngControl) === null || _a === void 0 ? void 0 : _a.control;
603
- if (control) {
604
- var hasRequiredValidator = Reflect.get(control, 'hasRequiredValidator');
605
- if (hasRequiredValidator) {
606
- this.formField._control.required = true;
607
- }
608
- }
609
- else {
610
- throw new Error('The form field has not a control associated!');
611
- }
612
- };
613
- return RequiredDirective;
614
- }());
615
- RequiredDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirective, deps: [{ token: i1.MAT_FORM_FIELD }], target: i0__namespace.ɵɵFactoryTarget.Directive });
616
- RequiredDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: RequiredDirective, selector: "[formControlName][rxapRequired]", ngImport: i0__namespace });
617
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirective, decorators: [{
618
- type: i0.Directive,
619
- args: [{
620
- selector: '[formControlName][rxapRequired]'
621
- }]
622
- }], ctorParameters: function () {
623
- return [{ type: i1__namespace.MatFormField, decorators: [{
624
- type: i0.Inject,
625
- args: [i1.MAT_FORM_FIELD]
626
- }] }];
627
- } });
628
- var RequiredDirectiveModule = /** @class */ (function () {
629
- function RequiredDirectiveModule() {
630
- }
631
- return RequiredDirectiveModule;
632
- }());
633
- RequiredDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
634
- RequiredDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirectiveModule, declarations: [RequiredDirective], exports: [RequiredDirective] });
635
- RequiredDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirectiveModule });
636
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RequiredDirectiveModule, decorators: [{
637
- type: i0.NgModule,
638
- args: [{
639
- exports: [RequiredDirective],
640
- declarations: [RequiredDirective]
641
- }]
642
- }] });
643
-
644
- var ExtractHideShowMixin = /** @class */ (function () {
645
- function ExtractHideShowMixin() {
646
- }
647
- ExtractHideShowMixin.prototype.extractOptions = function (formDefinition, controlId) {
648
- var _a, _b, _c;
649
- if (formDefinition === void 0) {
650
- formDefinition = this.formDefinition;
651
- }
652
- if (controlId === void 0) {
653
- controlId = (_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.controlId) !== null && _b !== void 0 ? _b : this.controlId;
654
- }
655
- var map = (_c = reflectMetadata.getMetadata(formSystem.RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, Object.getPrototypeOf(formDefinition))) !== null && _c !== void 0 ? _c : null;
656
- if (!map || !map.has(controlId)) {
657
- return {};
658
- }
659
- return map.get(controlId);
660
- };
661
- ExtractHideShowMixin.prototype.extractHideFunction = function (formDefinition, controlId) {
662
- var _a, _b, _c;
663
- if (formDefinition === void 0) {
664
- formDefinition = this.formDefinition;
665
- }
666
- if (controlId === void 0) {
667
- controlId = (_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.controlId) !== null && _b !== void 0 ? _b : this.controlId;
668
- }
669
- var map = (_c = reflectMetadata.getMetadata(formSystem.RXAP_FORM_SYSTEM_HIDE_METADATA, Object.getPrototypeOf(formDefinition))) !== null && _c !== void 0 ? _c : null;
670
- if (!map || !map.has(controlId)) {
671
- return null;
672
- }
673
- return map.get(controlId);
674
- };
675
- ExtractHideShowMixin.prototype.extractShowFunction = function (formDefinition, controlId) {
676
- var _a, _b, _c;
677
- if (formDefinition === void 0) {
678
- formDefinition = this.formDefinition;
679
- }
680
- if (controlId === void 0) {
681
- controlId = (_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.controlId) !== null && _b !== void 0 ? _b : this.controlId;
682
- }
683
- var map = (_c = reflectMetadata.getMetadata(formSystem.RXAP_FORM_SYSTEM_SHOW_METADATA, Object.getPrototypeOf(formDefinition))) !== null && _c !== void 0 ? _c : null;
684
- if (!map || !map.has(controlId)) {
685
- return null;
686
- }
687
- return map.get(controlId);
688
- };
689
- return ExtractHideShowMixin;
690
- }());
691
- // TODO : create mixin for hide and show logic (this class and ControlHideShowDirective in @rxap/form-system)
692
- exports.FormFieldHideShowDirective = /** @class */ (function () {
693
- function FormFieldHideShowDirective(formField, renderer, elementRef) {
694
- this.formField = formField;
695
- this.renderer = renderer;
696
- this.elementRef = elementRef;
697
- this.subscription = new rxjs.Subscription();
698
- }
699
- FormFieldHideShowDirective.prototype.ngAfterContentInit = function () {
700
- var _this = this;
701
- var _a;
702
- var control = (_a = this.formField._control.ngControl) === null || _a === void 0 ? void 0 : _a.control;
703
- if (!control) {
704
- throw new Error('The form field has not a control associated!');
705
- }
706
- if (!(control instanceof i6.RxapFormControl)) {
707
- throw new Error('The associated control is not a RxapFormControl');
708
- }
709
- this.control = control;
710
- this.formDefinition = this.extractFormDefinition(control);
711
- var hideFunction = this.extractHideFunction(this.formDefinition);
712
- var showFunction = this.extractShowFunction(this.formDefinition);
713
- var options = this.extractOptions(this.formDefinition);
714
- var changeTrigger = this.formDefinition.rxapFormGroup.valueChanges;
715
- if (options.rootChange) {
716
- changeTrigger = this.formDefinition.rxapFormGroup.root.valueChanges;
717
- }
718
- changeTrigger = changeTrigger.pipe(operators.startWith(null));
719
- if (showFunction) {
720
- this.subscription.add(changeTrigger.pipe(operators.tap(function () {
721
- // TODO : resubscribe if the showFunction throws an error
722
- var show = showFunction.call(_this.formDefinition, control);
723
- switch (show) {
724
- case true:
725
- _this.show();
726
- break;
727
- case false:
728
- _this.hide();
729
- break;
730
- case null:
731
- _this.reset();
732
- break;
733
- }
734
- }), operators.catchError(function (err) {
735
- console.error(err);
736
- return rxjs.of(null);
737
- })).subscribe());
738
- }
739
- if (hideFunction) {
740
- this.subscription.add(changeTrigger.pipe(operators.tap(function () {
741
- // TODO : resubscribe if the hideFunction throws an error
742
- var hide = hideFunction.call(_this.formDefinition, control);
743
- switch (hide) {
744
- case true:
745
- _this.hide();
746
- break;
747
- case false:
748
- _this.show();
749
- break;
750
- case null:
751
- _this.reset();
752
- break;
753
- }
754
- }), operators.catchError(function (err) {
755
- console.error(err);
756
- return rxjs.of(null);
757
- })).subscribe());
758
- }
759
- };
760
- FormFieldHideShowDirective.prototype.ngOnDestroy = function () {
761
- this.subscription.unsubscribe();
762
- };
763
- FormFieldHideShowDirective.prototype.hide = function () {
764
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
765
- };
766
- FormFieldHideShowDirective.prototype.show = function () {
767
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'block');
768
- };
769
- FormFieldHideShowDirective.prototype.reset = function () {
770
- this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
771
- };
772
- return FormFieldHideShowDirective;
773
- }());
774
- exports.FormFieldHideShowDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: exports.FormFieldHideShowDirective, deps: [{ token: i1.MAT_FORM_FIELD }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
775
- exports.FormFieldHideShowDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: exports.FormFieldHideShowDirective, selector: "mat-form-field[rxapHideShow]", ngImport: i0__namespace });
776
- exports.FormFieldHideShowDirective = __decorate([
777
- mixin.Mixin(ExtractHideShowMixin, formSystem.ExtractFormDefinitionMixin),
778
- __metadata("design:paramtypes", [i1.MatFormField,
779
- i0.Renderer2,
780
- i0.ElementRef])
781
- ], exports.FormFieldHideShowDirective);
782
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: exports.FormFieldHideShowDirective, decorators: [{
783
- type: i0.Directive,
784
- args: [{
785
- selector: 'mat-form-field[rxapHideShow]'
786
- }]
787
- }], ctorParameters: function () {
788
- return [{ type: i1__namespace.MatFormField, decorators: [{
789
- type: i0.Inject,
790
- args: [i1.MAT_FORM_FIELD]
791
- }] }, { type: i0__namespace.Renderer2, decorators: [{
792
- type: i0.Inject,
793
- args: [i0.Renderer2]
794
- }] }, { type: i0__namespace.ElementRef, decorators: [{
795
- type: i0.Inject,
796
- args: [i0.ElementRef]
797
- }] }];
798
- } });
799
- var FormFieldHideShowDirectiveModule = /** @class */ (function () {
800
- function FormFieldHideShowDirectiveModule() {
801
- }
802
- return FormFieldHideShowDirectiveModule;
803
- }());
804
- FormFieldHideShowDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormFieldHideShowDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
805
- FormFieldHideShowDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormFieldHideShowDirectiveModule, declarations: [exports.FormFieldHideShowDirective], exports: [exports.FormFieldHideShowDirective] });
806
- FormFieldHideShowDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormFieldHideShowDirectiveModule });
807
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormFieldHideShowDirectiveModule, decorators: [{
808
- type: i0.NgModule,
809
- args: [{
810
- declarations: [exports.FormFieldHideShowDirective],
811
- exports: [exports.FormFieldHideShowDirective]
812
- }]
813
- }] });
814
-
815
- var MaterialFormSystemModule = /** @class */ (function () {
816
- function MaterialFormSystemModule() {
817
- }
818
- return MaterialFormSystemModule;
819
- }());
820
- MaterialFormSystemModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: MaterialFormSystemModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
821
- MaterialFormSystemModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: MaterialFormSystemModule, exports: [ControlErrorDirectiveModule,
822
- ControlErrorsDirectiveModule,
823
- InputClearButtonDirectiveModule,
824
- RequiredDirectiveModule,
825
- FormFieldHideShowDirectiveModule] });
826
- MaterialFormSystemModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: MaterialFormSystemModule, imports: [ControlErrorDirectiveModule,
827
- ControlErrorsDirectiveModule,
828
- InputClearButtonDirectiveModule,
829
- RequiredDirectiveModule,
830
- FormFieldHideShowDirectiveModule] });
831
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: MaterialFormSystemModule, decorators: [{
832
- type: i0.NgModule,
833
- args: [{
834
- exports: [
835
- ControlErrorDirectiveModule,
836
- ControlErrorsDirectiveModule,
837
- InputClearButtonDirectiveModule,
838
- RequiredDirectiveModule,
839
- FormFieldHideShowDirectiveModule
840
- ]
841
- }]
842
- }] });
843
-
844
- var CompareWithDirective = /** @class */ (function () {
845
- function CompareWithDirective(matSelect) {
846
- this.matSelect = matSelect;
847
- }
848
- CompareWithDirective.prototype.ngOnInit = function () {
849
- this.matSelect.compareWith = this.compareWith.bind(this);
850
- };
851
- CompareWithDirective.prototype.compareWith = function (o1, o2) {
852
- if (this.objectPath) {
853
- if (typeof o1 !== 'object' || typeof o2 !== 'object') {
854
- if (i0.isDevMode()) {
855
- console.warn('At least one of the select options value is not an object');
856
- }
857
- return false;
858
- }
859
- if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
860
- if (i0.isDevMode()) {
861
- console.warn('At least one of the select options value is undefined or null');
862
- }
863
- return false;
864
- }
865
- var o1Value = utilities.getFromObject(o1, this.objectPath);
866
- var o2Value = utilities.getFromObject(o2, this.objectPath);
867
- if (o1Value === undefined || o2Value === undefined) {
868
- return false;
869
- }
870
- return o1Value === o2Value;
871
- }
872
- else {
873
- return utilities.equals(o1, o2);
874
- }
875
- };
876
- return CompareWithDirective;
877
- }());
878
- CompareWithDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirective, deps: [{ token: i1$1.MatSelect }], target: i0__namespace.ɵɵFactoryTarget.Directive });
879
- CompareWithDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: CompareWithDirective, selector: "mat-select[rxapCompareWith]", inputs: { objectPath: ["rxapCompareWith", "objectPath"] }, ngImport: i0__namespace });
880
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirective, decorators: [{
881
- type: i0.Directive,
882
- args: [{
883
- selector: 'mat-select[rxapCompareWith]',
884
- }]
885
- }], ctorParameters: function () {
886
- return [{ type: i1__namespace$1.MatSelect, decorators: [{
887
- type: i0.Inject,
888
- args: [i1$1.MatSelect]
889
- }] }];
890
- }, propDecorators: { objectPath: [{
891
- type: i0.Input,
892
- args: ['rxapCompareWith']
893
- }] } });
894
- var CompareWithDirectiveModule = /** @class */ (function () {
895
- function CompareWithDirectiveModule() {
896
- }
897
- return CompareWithDirectiveModule;
898
- }());
899
- CompareWithDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
900
- CompareWithDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirectiveModule, declarations: [CompareWithDirective], exports: [CompareWithDirective] });
901
- CompareWithDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirectiveModule });
902
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: CompareWithDirectiveModule, decorators: [{
903
- type: i0.NgModule,
904
- args: [{
905
- declarations: [CompareWithDirective],
906
- exports: [CompareWithDirective],
907
- }]
908
- }] });
909
-
910
- var FormControlsComponent = /** @class */ (function () {
911
- function FormControlsComponent(formDirective, cdr, snackBar, router) {
912
- this.formDirective = formDirective;
913
- this.cdr = cdr;
914
- this.snackBar = snackBar;
915
- this.router = router;
916
- this._allowResubmit = false;
917
- this.invalid = false;
918
- this.close = new i0.EventEmitter();
919
- this.submitted = new i0.EventEmitter();
920
- this.isDevMode = i0.isDevMode();
921
- /**
922
- * Collection of successful submitted values
923
- * @private
924
- */
925
- this._submitted = [];
926
- }
927
- Object.defineProperty(FormControlsComponent.prototype, "allowResubmit", {
928
- get: function () {
929
- return this._allowResubmit;
930
- },
931
- set: function (value) {
932
- this._allowResubmit = utilities.coerceBoolean(value);
933
- },
934
- enumerable: false,
935
- configurable: true
936
- });
937
- FormControlsComponent.prototype.ngOnInit = function () {
938
- var _this = this;
939
- this.submitting$ = this.formDirective.submitting$;
940
- this.close
941
- .pipe(operators.take(1), operators.tap(function () {
942
- if (_this.navigateAfterSubmit) {
943
- if (_this.router) {
944
- return _this.router.navigate(_this.navigateAfterSubmit);
945
- }
946
- else {
947
- console.warn('The Router is not available. Ensure that tha RouterModule is imported');
948
- }
949
- }
950
- return Promise.resolve();
951
- }))
952
- .subscribe();
953
- };
954
- FormControlsComponent.prototype.reset = function () {
955
- this.invalid = false;
956
- this.formDirective.reset();
957
- };
958
- FormControlsComponent.prototype.cancel = function () {
959
- this.close.emit();
960
- };
961
- FormControlsComponent.prototype.submit = function (closeAfterSubmit) {
962
- var _this = this;
963
- this.formDirective.form.markAllAsDirty();
964
- this.formDirective.form.markAllAsTouched();
965
- this.formDirective.cdr.markForCheck();
966
- var submitSubscription;
967
- var invalidSubmitSubscription = this.formDirective.invalidSubmit
968
- .pipe(operators.take(1), operators.tap(function () { return submitSubscription === null || submitSubscription === void 0 ? void 0 : submitSubscription.unsubscribe(); }), operators.tap(function () { return (_this.invalid = true); }), operators.tap(function () { return _this.cdr.detectChanges(); }), operators.tap(function () { return _this.snackBar.open($localize(templateObject_1 || (templateObject_1 = __makeTemplateObject([":@@rxap-material.form-system.form-controls.form-is-invalid:Form is not valid"], [":@@rxap-material.form-system.form-controls.form-is-invalid:Form is not valid"]))), 'ok', { duration: 5000 }); }))
969
- .subscribe();
970
- submitSubscription = this.formDirective.rxapSubmit
971
- .pipe(operators.take(1), operators.tap(function (value) {
972
- var clonedValue = utilities.clone(value);
973
- _this._submitted.push(clonedValue);
974
- _this.submitted.emit(clonedValue);
975
- if (closeAfterSubmit) {
976
- _this.close.emit(_this._submitted.length > 1 ? _this._submitted : _this._submitted[0]);
977
- }
978
- else {
979
- if (typeof _this.formDirective.formDefinition.rxapReuse === 'function') {
980
- _this.formDirective.formDefinition.rxapReuse();
981
- }
982
- }
983
- invalidSubmitSubscription.unsubscribe();
984
- _this.invalid = false;
985
- _this.cdr.detectChanges();
986
- }))
987
- .subscribe();
988
- this.formDirective.onSubmit(new Event('submit'));
989
- };
990
- FormControlsComponent.prototype.logCurrentFormState = function () {
991
- console.log(utilities.clone(this.formDirective.form.value));
992
- };
993
- return FormControlsComponent;
994
- }());
995
- FormControlsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponent, deps: [{ token: i6.FormDirective }, { token: i0.ChangeDetectorRef }, { token: i7.MatSnackBar }, { token: i8.Router, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
996
- FormControlsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.1", type: FormControlsComponent, selector: "rxap-form-controls", inputs: { allowResubmit: "allowResubmit", navigateAfterSubmit: "navigateAfterSubmit" }, outputs: { close: "close", submitted: "submitted" }, host: { classAttribute: "mfd-form-controls" }, ngImport: i0__namespace, template: "<div fxLayout=\"row\" fxLayoutAlign=\"space-between center\" fxLayoutGap=\"32px\">\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"end center\" fxLayoutGap=\"32px\" style=\"width: 100%\">\n <button (click)=\"reset()\"\n [disabled]=\"submitting$ | async\"\n type=\"button\"\n fxFlex=\"nogrow\"\n i18n=\"@@rxap-material.form-system.components.form-controls.reset\"\n mat-stroked-button>\n Reset\n </button>\n <button (click)=\"cancel()\"\n [disabled]=\"submitting$ | async\"\n type=\"button\"\n color=\"warn\" fxFlex=\"nogrow\"\n i18n=\"@@rxap-material.form-system.components.form-controls.cancel\"\n mat-stroked-button>\n Cancel\n </button>\n <button (click)=\"submit(!allowResubmit)\"\n [disabled]=\"submitting$ | async\"\n type=\"button\"\n color=\"primary\"\n fxFlex=\"nogrow\"\n [ngClass]=\"{ invalid: invalid }\"\n mat-raised-button>\n <span fxLayout=\"row\" fxLayoutGap=\"4px\" fxLayoutAlign=\"start center\">\n <span fxFlex=\"nogrow\"\n i18n=\"@@rxap-material.form-system.components.form-controls.submit\">Submit</span>\n <mat-spinner [fxShow]=\"submitting$ | async\" fxFlex=\"nogrow\" mode=\"indeterminate\" [diameter]=\"15\" color=\"accent\"></mat-spinner>\n </span>\n </button>\n <button *ngIf=\"allowResubmit\" (click)=\"submit(true)\"\n type=\"button\"\n color=\"primary\"\n fxFlex=\"nogrow\"\n [ngClass]=\"{ invalid: invalid }\"\n [disabled]=\"submitting$ | async\"\n mat-raised-button>\n <span fxLayout=\"row\" fxLayoutGap=\"4px\" fxLayoutAlign=\"start center\">\n <span fxFlex=\"nogrow\"\n i18n=\"@@rxap-material.form-system.components.form-controls.submit-and-close\">\n Submit and Close\n </span>\n <mat-spinner [fxShow]=\"submitting$ | async\" fxFlex=\"nogrow\" mode=\"indeterminate\" [diameter]=\"15\" color=\"accent\"></mat-spinner>\n </span>\n </button>\n <button *ngIf=\"isDevMode\" type=\"button\" mat-button fxFlex=\"nogrow\" (click)=\"logCurrentFormState()\">Current Form State</button>\n </div>\n</div>\n", styles: ["button{overflow:hidden}button.invalid{border:6px solid #8b0000}"], components: [{ type: i1__namespace$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2__namespace.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: i3__namespace.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { type: i3__namespace.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { type: i3__namespace.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { type: i3__namespace.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { type: i4__namespace.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { type: i5__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.DefaultShowHideDirective, selector: " [fxShow], [fxShow.print], [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl], [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl], [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg], [fxHide], [fxHide.print], [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl], [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl], [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", inputs: ["fxShow", "fxShow.print", "fxShow.xs", "fxShow.sm", "fxShow.md", "fxShow.lg", "fxShow.xl", "fxShow.lt-sm", "fxShow.lt-md", "fxShow.lt-lg", "fxShow.lt-xl", "fxShow.gt-xs", "fxShow.gt-sm", "fxShow.gt-md", "fxShow.gt-lg", "fxHide", "fxHide.print", "fxHide.xs", "fxHide.sm", "fxHide.md", "fxHide.lg", "fxHide.xl", "fxHide.lt-sm", "fxHide.lt-md", "fxHide.lt-lg", "fxHide.lt-xl", "fxHide.gt-xs", "fxHide.gt-sm", "fxHide.gt-md", "fxHide.gt-lg"] }, { type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i5__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
997
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponent, decorators: [{
998
- type: i0.Component,
999
- args: [{
1000
- selector: 'rxap-form-controls',
1001
- templateUrl: './form-controls.component.html',
1002
- styleUrls: ['./form-controls.component.scss'],
1003
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1004
- host: { class: 'mfd-form-controls' },
1005
- }]
1006
- }], ctorParameters: function () {
1007
- return [{ type: i6__namespace.FormDirective, decorators: [{
1008
- type: i0.Inject,
1009
- args: [i6.FormDirective]
1010
- }] }, { type: i0__namespace.ChangeDetectorRef, decorators: [{
1011
- type: i0.Inject,
1012
- args: [i0.ChangeDetectorRef]
1013
- }] }, { type: i7__namespace.MatSnackBar, decorators: [{
1014
- type: i0.Inject,
1015
- args: [i7.MatSnackBar]
1016
- }] }, { type: i8__namespace.Router, decorators: [{
1017
- type: i0.Optional
1018
- }, {
1019
- type: i0.Inject,
1020
- args: [i8.Router]
1021
- }] }];
1022
- }, propDecorators: { allowResubmit: [{
1023
- type: i0.Input
1024
- }], navigateAfterSubmit: [{
1025
- type: i0.Input
1026
- }], close: [{
1027
- type: i0.Output
1028
- }], submitted: [{
1029
- type: i0.Output
1030
- }] } });
1031
- var templateObject_1;
1032
-
1033
- var FormControlsComponentModule = /** @class */ (function () {
1034
- function FormControlsComponentModule() {
1035
- }
1036
- return FormControlsComponentModule;
1037
- }());
1038
- FormControlsComponentModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponentModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1039
- FormControlsComponentModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponentModule, declarations: [FormControlsComponent], imports: [i2.MatProgressSpinnerModule,
1040
- flexLayout.FlexLayoutModule,
1041
- i1$2.MatButtonModule,
1042
- i5.CommonModule,
1043
- i6.RxapFormsModule,
1044
- i7.MatSnackBarModule], exports: [FormControlsComponent] });
1045
- FormControlsComponentModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponentModule, imports: [[
1046
- i2.MatProgressSpinnerModule,
1047
- flexLayout.FlexLayoutModule,
1048
- i1$2.MatButtonModule,
1049
- i5.CommonModule,
1050
- i6.RxapFormsModule,
1051
- i7.MatSnackBarModule,
1052
- ]] });
1053
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlsComponentModule, decorators: [{
1054
- type: i0.NgModule,
1055
- args: [{
1056
- declarations: [FormControlsComponent],
1057
- imports: [
1058
- i2.MatProgressSpinnerModule,
1059
- flexLayout.FlexLayoutModule,
1060
- i1$2.MatButtonModule,
1061
- i5.CommonModule,
1062
- i6.RxapFormsModule,
1063
- i7.MatSnackBarModule,
1064
- ],
1065
- exports: [FormControlsComponent]
1066
- }]
1067
- }] });
1068
-
1069
- var ChipInputAdapterDirective = /** @class */ (function () {
1070
- function ChipInputAdapterDirective(matChipInput, ngControl) {
1071
- this.matChipInput = matChipInput;
1072
- this.ngControl = ngControl;
1073
- this.matChipInput.separatorKeyCodes = [keycodes.ENTER, keycodes.COMMA];
1074
- this.matChipInput.addOnBlur = true;
1075
- }
1076
- ChipInputAdapterDirective.prototype.ngOnDestroy = function () {
1077
- var _a;
1078
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1079
- };
1080
- ChipInputAdapterDirective.prototype.ngOnInit = function () {
1081
- var _this = this;
1082
- this._subscription = this.matChipInput.chipEnd
1083
- .pipe(operators.filter(function (add) { var _a; return !!((_a = add.value) === null || _a === void 0 ? void 0 : _a.trim()); }), operators.tap(function (add) {
1084
- var _a, _b;
1085
- var value = (_a = _this.ngControl.value) !== null && _a !== void 0 ? _a : [];
1086
- (_b = _this.ngControl.control) === null || _b === void 0 ? void 0 : _b.setValue(__spreadArray(__spreadArray([], __read(value)), [add.value]).filter(utilities.unique()));
1087
- _this.matChipInput.clear();
1088
- }))
1089
- .subscribe();
1090
- };
1091
- return ChipInputAdapterDirective;
1092
- }());
1093
- ChipInputAdapterDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirective, deps: [{ token: i1__namespace$3.MatChipInput }, { token: i2__namespace$1.NgControl }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1094
- ChipInputAdapterDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipInputAdapterDirective, selector: "[matChipInputFor][rxapChipInputAdapter]", ngImport: i0__namespace });
1095
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirective, decorators: [{
1096
- type: i0.Directive,
1097
- args: [{
1098
- selector: '[matChipInputFor][rxapChipInputAdapter]'
1099
- }]
1100
- }], ctorParameters: function () { return [{ type: i1__namespace$3.MatChipInput }, { type: i2__namespace$1.NgControl }]; } });
1101
- var ChipInputAdapterDirectiveModule = /** @class */ (function () {
1102
- function ChipInputAdapterDirectiveModule() {
1103
- }
1104
- return ChipInputAdapterDirectiveModule;
1105
- }());
1106
- ChipInputAdapterDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1107
- ChipInputAdapterDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirectiveModule, declarations: [ChipInputAdapterDirective], exports: [ChipInputAdapterDirective] });
1108
- ChipInputAdapterDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirectiveModule });
1109
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipInputAdapterDirectiveModule, decorators: [{
1110
- type: i0.NgModule,
1111
- args: [{
1112
- exports: [ChipInputAdapterDirective],
1113
- declarations: [ChipInputAdapterDirective]
1114
- }]
1115
- }] });
1116
-
1117
- function getTypeName(type) {
1118
- return type['name'] || typeof type;
1119
- }
1120
- var RecordViewTuple = /** @class */ (function () {
1121
- function RecordViewTuple(record, view) {
1122
- this.record = record;
1123
- this.view = view;
1124
- }
1125
- return RecordViewTuple;
1126
- }());
1127
- var ChipListIteratorDirective = /** @class */ (function () {
1128
- function ChipListIteratorDirective(template, viewContainerRef, ngControl, differs) {
1129
- this.template = template;
1130
- this.viewContainerRef = viewContainerRef;
1131
- this.ngControl = ngControl;
1132
- this.differs = differs;
1133
- this._dirty = true;
1134
- this._differ = null;
1135
- }
1136
- ChipListIteratorDirective.prototype.ngOnInit = function () {
1137
- var _this = this;
1138
- var _a;
1139
- this._subscription = (_a = this.ngControl.valueChanges) === null || _a === void 0 ? void 0 : _a.pipe(operators.startWith(this.ngControl.value), rxjs$1.log('test'), operators.filter(function (value) { return Array.isArray(value); }), operators.tap(function (items) {
1140
- _this._dirty = false;
1141
- // React on ngForOf changes only once all inputs have been initialized
1142
- var value = items;
1143
- if (!_this._differ && value) {
1144
- try {
1145
- _this._differ = _this.differs.find(value).create(function (_, item) { return item; });
1146
- }
1147
- catch (_a) {
1148
- throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeName(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
1149
- }
1150
- }
1151
- if (_this._differ) {
1152
- var changes = _this._differ.diff(items);
1153
- if (changes) {
1154
- _this.applyChanges(changes);
1155
- }
1156
- }
1157
- })).subscribe();
1158
- };
1159
- ChipListIteratorDirective.prototype.ngOnDestroy = function () {
1160
- var _a;
1161
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1162
- };
1163
- ChipListIteratorDirective.prototype.applyChanges = function (changes) {
1164
- var _this = this;
1165
- var insertTuples = [];
1166
- changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
1167
- if (item.previousIndex == null) {
1168
- // NgForOf is never "null" or "undefined" here because the differ detected
1169
- // that a new item needs to be inserted from the iterable. This implies that
1170
- // there is an iterable value for "_ngForOf".
1171
- var view = _this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: item.item, onRemoved: _this.onRemoved.bind(_this) }, currentIndex === null ? undefined : currentIndex);
1172
- var tuple = new RecordViewTuple(item, view);
1173
- insertTuples.push(tuple);
1174
- }
1175
- else if (currentIndex == null) {
1176
- _this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
1177
- }
1178
- else if (adjustedPreviousIndex !== null) {
1179
- var view = _this.viewContainerRef.get(adjustedPreviousIndex);
1180
- _this.viewContainerRef.move(view, currentIndex);
1181
- var tuple = new RecordViewTuple(item, view);
1182
- insertTuples.push(tuple);
1183
- }
1184
- });
1185
- for (var i = 0; i < insertTuples.length; i++) {
1186
- this.perViewChange(insertTuples[i].view, insertTuples[i].record);
1187
- }
1188
- changes.forEachIdentityChange(function (record) {
1189
- var viewRef = (_this.viewContainerRef.get(record.currentIndex));
1190
- viewRef.context.$implicit = record.item;
1191
- });
1192
- };
1193
- ChipListIteratorDirective.prototype.onRemoved = function ($event) {
1194
- var _a, _b;
1195
- (_a = this.ngControl.control) === null || _a === void 0 ? void 0 : _a.setValue(((_b = this.ngControl.value) !== null && _b !== void 0 ? _b : []).filter(function (item) { return item !== $event.chip.value; }));
1196
- };
1197
- ChipListIteratorDirective.prototype.perViewChange = function (view, record) {
1198
- view.context.$implicit = record.item;
1199
- };
1200
- return ChipListIteratorDirective;
1201
- }());
1202
- ChipListIteratorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }, { token: i2__namespace$1.NgControl }, { token: i0__namespace.IterableDiffers }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1203
- ChipListIteratorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ChipListIteratorDirective, selector: "[rxapChipListIterator]", ngImport: i0__namespace });
1204
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirective, decorators: [{
1205
- type: i0.Directive,
1206
- args: [{
1207
- selector: '[rxapChipListIterator]'
1208
- }]
1209
- }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }, { type: i2__namespace$1.NgControl }, { type: i0__namespace.IterableDiffers }]; } });
1210
- var ChipListIteratorDirectiveModule = /** @class */ (function () {
1211
- function ChipListIteratorDirectiveModule() {
1212
- }
1213
- return ChipListIteratorDirectiveModule;
1214
- }());
1215
- ChipListIteratorDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1216
- ChipListIteratorDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirectiveModule, declarations: [ChipListIteratorDirective], exports: [ChipListIteratorDirective] });
1217
- ChipListIteratorDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirectiveModule });
1218
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ChipListIteratorDirectiveModule, decorators: [{
1219
- type: i0.NgModule,
1220
- args: [{
1221
- exports: [ChipListIteratorDirective],
1222
- declarations: [ChipListIteratorDirective]
1223
- }]
1224
- }] });
1225
-
1226
- /**
1227
- * Generated bundle index. Do not edit.
1228
- */
1229
-
1230
- exports.ChipInputAdapterDirective = ChipInputAdapterDirective;
1231
- exports.ChipInputAdapterDirectiveModule = ChipInputAdapterDirectiveModule;
1232
- exports.ChipListIteratorDirective = ChipListIteratorDirective;
1233
- exports.ChipListIteratorDirectiveModule = ChipListIteratorDirectiveModule;
1234
- exports.CompareWithDirective = CompareWithDirective;
1235
- exports.CompareWithDirectiveModule = CompareWithDirectiveModule;
1236
- exports.ControlErrorDirective = ControlErrorDirective;
1237
- exports.ControlErrorDirectiveModule = ControlErrorDirectiveModule;
1238
- exports.ControlErrorsDirective = ControlErrorsDirective;
1239
- exports.ControlErrorsDirectiveModule = ControlErrorsDirectiveModule;
1240
- exports.ExtractHideShowMixin = ExtractHideShowMixin;
1241
- exports.FormControlsComponent = FormControlsComponent;
1242
- exports.FormControlsComponentModule = FormControlsComponentModule;
1243
- exports.FormFieldHideShowDirectiveModule = FormFieldHideShowDirectiveModule;
1244
- exports.InputClearButtonDirective = InputClearButtonDirective;
1245
- exports.InputClearButtonDirectiveModule = InputClearButtonDirectiveModule;
1246
- exports.MaterialFormSystemModule = MaterialFormSystemModule;
1247
- exports.RequiredDirective = RequiredDirective;
1248
- exports.RequiredDirectiveModule = RequiredDirectiveModule;
1249
-
1250
- Object.defineProperty(exports, '__esModule', { value: true });
1251
-
1252
- })));
1253
- //# sourceMappingURL=rxap-material-form-system.umd.js.map