@rxap/material-form-system 12.0.11 → 13.0.0-next.1

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