dino-forms 1.0.3 → 1.0.4

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 (55) hide show
  1. package/bundles/dino-forms.umd.js +2174 -2174
  2. package/bundles/dino-forms.umd.js.map +1 -1
  3. package/dino-forms.d.ts +5 -5
  4. package/esm2015/dino-forms.js +4 -4
  5. package/esm2015/lib/common/constants/comparison.operators.js +10 -10
  6. package/esm2015/lib/common/constants/constants.js +19 -19
  7. package/esm2015/lib/common/constants/generic-input-type.js +14 -14
  8. package/esm2015/lib/common/constants/logical.operators.js +5 -5
  9. package/esm2015/lib/common/constants/validation.js +10 -10
  10. package/esm2015/lib/common/custom-validators/custom.validator.js +15 -15
  11. package/esm2015/lib/common/error/app-error-handler.js +7 -7
  12. package/esm2015/lib/common/error/app-error.js +6 -6
  13. package/esm2015/lib/common/error/bad-request-error.js +4 -4
  14. package/esm2015/lib/common/error/invalid-user-error.js +4 -4
  15. package/esm2015/lib/common/error/not-found-error.js +4 -4
  16. package/esm2015/lib/common/utilities/expressions.utility.js +255 -255
  17. package/esm2015/lib/common/utilities/form.utility.js +143 -143
  18. package/esm2015/lib/common/utilities/object.utility.js +23 -23
  19. package/esm2015/lib/common/validators.js +51 -51
  20. package/esm2015/lib/components/accordion-form/accordion-form.component.js +150 -150
  21. package/esm2015/lib/components/alert/alert.component.js +27 -27
  22. package/esm2015/lib/components/expressions-form/expressions-form.component.js +246 -246
  23. package/esm2015/lib/components/form/form.component.js +175 -175
  24. package/esm2015/lib/components/modal-form/modal-form.component.js +121 -121
  25. package/esm2015/lib/components/tab-form/tab-form.component.js +200 -200
  26. package/esm2015/lib/dino-forms.module.js +70 -70
  27. package/esm2015/lib/services/data.service.js +72 -72
  28. package/esm2015/public-api.js +14 -14
  29. package/fesm2015/dino-forms.js +1502 -1502
  30. package/fesm2015/dino-forms.js.map +1 -1
  31. package/lib/common/constants/comparison.operators.d.ts +9 -9
  32. package/lib/common/constants/constants.d.ts +18 -18
  33. package/lib/common/constants/generic-input-type.d.ts +13 -13
  34. package/lib/common/constants/logical.operators.d.ts +4 -4
  35. package/lib/common/constants/validation.d.ts +9 -9
  36. package/lib/common/custom-validators/custom.validator.d.ts +6 -6
  37. package/lib/common/error/app-error-handler.d.ts +4 -4
  38. package/lib/common/error/app-error.d.ts +4 -4
  39. package/lib/common/error/bad-request-error.d.ts +3 -3
  40. package/lib/common/error/invalid-user-error.d.ts +3 -3
  41. package/lib/common/error/not-found-error.d.ts +3 -3
  42. package/lib/common/utilities/expressions.utility.d.ts +19 -19
  43. package/lib/common/utilities/form.utility.d.ts +14 -14
  44. package/lib/common/utilities/object.utility.d.ts +5 -5
  45. package/lib/common/validators.d.ts +4 -4
  46. package/lib/components/accordion-form/accordion-form.component.d.ts +39 -39
  47. package/lib/components/alert/alert.component.d.ts +12 -12
  48. package/lib/components/expressions-form/expressions-form.component.d.ts +58 -58
  49. package/lib/components/form/form.component.d.ts +51 -51
  50. package/lib/components/modal-form/modal-form.component.d.ts +38 -38
  51. package/lib/components/tab-form/tab-form.component.d.ts +45 -45
  52. package/lib/dino-forms.module.d.ts +15 -15
  53. package/lib/services/data.service.d.ts +17 -17
  54. package/package.json +1 -1
  55. package/public-api.d.ts +8 -8
@@ -27,2230 +27,2230 @@
27
27
  var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
29
 
30
- /*! *****************************************************************************
31
- Copyright (c) Microsoft Corporation.
32
-
33
- Permission to use, copy, modify, and/or distribute this software for any
34
- purpose with or without fee is hereby granted.
35
-
36
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
- PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */
44
- /* global Reflect, Promise */
45
- var extendStatics = function (d, b) {
46
- extendStatics = Object.setPrototypeOf ||
47
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48
- function (d, b) { for (var p in b)
49
- if (Object.prototype.hasOwnProperty.call(b, p))
50
- d[p] = b[p]; };
51
- return extendStatics(d, b);
52
- };
53
- function __extends(d, b) {
54
- if (typeof b !== "function" && b !== null)
55
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
56
- extendStatics(d, b);
57
- function __() { this.constructor = d; }
58
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59
- }
60
- var __assign = function () {
61
- __assign = Object.assign || function __assign(t) {
62
- for (var s, i = 1, n = arguments.length; i < n; i++) {
63
- s = arguments[i];
64
- for (var p in s)
65
- if (Object.prototype.hasOwnProperty.call(s, p))
66
- t[p] = s[p];
67
- }
68
- return t;
69
- };
70
- return __assign.apply(this, arguments);
71
- };
72
- function __rest(s, e) {
73
- var t = {};
74
- for (var p in s)
75
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
76
- t[p] = s[p];
77
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
78
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
79
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
80
- t[p[i]] = s[p[i]];
81
- }
82
- return t;
83
- }
84
- function __decorate(decorators, target, key, desc) {
85
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
86
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
87
- r = Reflect.decorate(decorators, target, key, desc);
88
- else
89
- for (var i = decorators.length - 1; i >= 0; i--)
90
- if (d = decorators[i])
91
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
92
- return c > 3 && r && Object.defineProperty(target, key, r), r;
93
- }
94
- function __param(paramIndex, decorator) {
95
- return function (target, key) { decorator(target, key, paramIndex); };
96
- }
97
- function __metadata(metadataKey, metadataValue) {
98
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
99
- return Reflect.metadata(metadataKey, metadataValue);
100
- }
101
- function __awaiter(thisArg, _arguments, P, generator) {
102
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
103
- return new (P || (P = Promise))(function (resolve, reject) {
104
- function fulfilled(value) { try {
105
- step(generator.next(value));
106
- }
107
- catch (e) {
108
- reject(e);
109
- } }
110
- function rejected(value) { try {
111
- step(generator["throw"](value));
112
- }
113
- catch (e) {
114
- reject(e);
115
- } }
116
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
117
- step((generator = generator.apply(thisArg, _arguments || [])).next());
118
- });
119
- }
120
- function __generator(thisArg, body) {
121
- var _ = { label: 0, sent: function () { if (t[0] & 1)
122
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
123
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
124
- function verb(n) { return function (v) { return step([n, v]); }; }
125
- function step(op) {
126
- if (f)
127
- throw new TypeError("Generator is already executing.");
128
- while (_)
129
- try {
130
- 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)
131
- return t;
132
- if (y = 0, t)
133
- op = [op[0] & 2, t.value];
134
- switch (op[0]) {
135
- case 0:
136
- case 1:
137
- t = op;
138
- break;
139
- case 4:
140
- _.label++;
141
- return { value: op[1], done: false };
142
- case 5:
143
- _.label++;
144
- y = op[1];
145
- op = [0];
146
- continue;
147
- case 7:
148
- op = _.ops.pop();
149
- _.trys.pop();
150
- continue;
151
- default:
152
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
153
- _ = 0;
154
- continue;
155
- }
156
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
157
- _.label = op[1];
158
- break;
159
- }
160
- if (op[0] === 6 && _.label < t[1]) {
161
- _.label = t[1];
162
- t = op;
163
- break;
164
- }
165
- if (t && _.label < t[2]) {
166
- _.label = t[2];
167
- _.ops.push(op);
168
- break;
169
- }
170
- if (t[2])
171
- _.ops.pop();
172
- _.trys.pop();
173
- continue;
174
- }
175
- op = body.call(thisArg, _);
176
- }
177
- catch (e) {
178
- op = [6, e];
179
- y = 0;
180
- }
181
- finally {
182
- f = t = 0;
183
- }
184
- if (op[0] & 5)
185
- throw op[1];
186
- return { value: op[0] ? op[1] : void 0, done: true };
187
- }
188
- }
189
- var __createBinding = Object.create ? (function (o, m, k, k2) {
190
- if (k2 === undefined)
191
- k2 = k;
192
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
193
- }) : (function (o, m, k, k2) {
194
- if (k2 === undefined)
195
- k2 = k;
196
- o[k2] = m[k];
197
- });
198
- function __exportStar(m, o) {
199
- for (var p in m)
200
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
201
- __createBinding(o, m, p);
202
- }
203
- function __values(o) {
204
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
205
- if (m)
206
- return m.call(o);
207
- if (o && typeof o.length === "number")
208
- return {
209
- next: function () {
210
- if (o && i >= o.length)
211
- o = void 0;
212
- return { value: o && o[i++], done: !o };
213
- }
214
- };
215
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
216
- }
217
- function __read(o, n) {
218
- var m = typeof Symbol === "function" && o[Symbol.iterator];
219
- if (!m)
220
- return o;
221
- var i = m.call(o), r, ar = [], e;
222
- try {
223
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
224
- ar.push(r.value);
225
- }
226
- catch (error) {
227
- e = { error: error };
228
- }
229
- finally {
230
- try {
231
- if (r && !r.done && (m = i["return"]))
232
- m.call(i);
233
- }
234
- finally {
235
- if (e)
236
- throw e.error;
237
- }
238
- }
239
- return ar;
240
- }
241
- /** @deprecated */
242
- function __spread() {
243
- for (var ar = [], i = 0; i < arguments.length; i++)
244
- ar = ar.concat(__read(arguments[i]));
245
- return ar;
246
- }
247
- /** @deprecated */
248
- function __spreadArrays() {
249
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
250
- s += arguments[i].length;
251
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
252
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
253
- r[k] = a[j];
254
- return r;
255
- }
256
- function __spreadArray(to, from, pack) {
257
- if (pack || arguments.length === 2)
258
- for (var i = 0, l = from.length, ar; i < l; i++) {
259
- if (ar || !(i in from)) {
260
- if (!ar)
261
- ar = Array.prototype.slice.call(from, 0, i);
262
- ar[i] = from[i];
263
- }
264
- }
265
- return to.concat(ar || Array.prototype.slice.call(from));
266
- }
267
- function __await(v) {
268
- return this instanceof __await ? (this.v = v, this) : new __await(v);
269
- }
270
- function __asyncGenerator(thisArg, _arguments, generator) {
271
- if (!Symbol.asyncIterator)
272
- throw new TypeError("Symbol.asyncIterator is not defined.");
273
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
274
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
275
- function verb(n) { if (g[n])
276
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
277
- function resume(n, v) { try {
278
- step(g[n](v));
279
- }
280
- catch (e) {
281
- settle(q[0][3], e);
282
- } }
283
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
284
- function fulfill(value) { resume("next", value); }
285
- function reject(value) { resume("throw", value); }
286
- function settle(f, v) { if (f(v), q.shift(), q.length)
287
- resume(q[0][0], q[0][1]); }
288
- }
289
- function __asyncDelegator(o) {
290
- var i, p;
291
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
292
- 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; }
293
- }
294
- function __asyncValues(o) {
295
- if (!Symbol.asyncIterator)
296
- throw new TypeError("Symbol.asyncIterator is not defined.");
297
- var m = o[Symbol.asyncIterator], i;
298
- 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);
299
- 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); }); }; }
300
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
301
- }
302
- function __makeTemplateObject(cooked, raw) {
303
- if (Object.defineProperty) {
304
- Object.defineProperty(cooked, "raw", { value: raw });
305
- }
306
- else {
307
- cooked.raw = raw;
308
- }
309
- return cooked;
310
- }
311
- ;
312
- var __setModuleDefault = Object.create ? (function (o, v) {
313
- Object.defineProperty(o, "default", { enumerable: true, value: v });
314
- }) : function (o, v) {
315
- o["default"] = v;
316
- };
317
- function __importStar(mod) {
318
- if (mod && mod.__esModule)
319
- return mod;
320
- var result = {};
321
- if (mod != null)
322
- for (var k in mod)
323
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
324
- __createBinding(result, mod, k);
325
- __setModuleDefault(result, mod);
326
- return result;
327
- }
328
- function __importDefault(mod) {
329
- return (mod && mod.__esModule) ? mod : { default: mod };
330
- }
331
- function __classPrivateFieldGet(receiver, state, kind, f) {
332
- if (kind === "a" && !f)
333
- throw new TypeError("Private accessor was defined without a getter");
334
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
335
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
336
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
337
- }
338
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
339
- if (kind === "m")
340
- throw new TypeError("Private method is not writable");
341
- if (kind === "a" && !f)
342
- throw new TypeError("Private accessor was defined without a setter");
343
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
344
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
345
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
30
+ /*! *****************************************************************************
31
+ Copyright (c) Microsoft Corporation.
32
+
33
+ Permission to use, copy, modify, and/or distribute this software for any
34
+ purpose with or without fee is hereby granted.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
+ PERFORMANCE OF THIS SOFTWARE.
43
+ ***************************************************************************** */
44
+ /* global Reflect, Promise */
45
+ var extendStatics = function (d, b) {
46
+ extendStatics = Object.setPrototypeOf ||
47
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
48
+ function (d, b) { for (var p in b)
49
+ if (Object.prototype.hasOwnProperty.call(b, p))
50
+ d[p] = b[p]; };
51
+ return extendStatics(d, b);
52
+ };
53
+ function __extends(d, b) {
54
+ if (typeof b !== "function" && b !== null)
55
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
56
+ extendStatics(d, b);
57
+ function __() { this.constructor = d; }
58
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59
+ }
60
+ var __assign = function () {
61
+ __assign = Object.assign || function __assign(t) {
62
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
63
+ s = arguments[i];
64
+ for (var p in s)
65
+ if (Object.prototype.hasOwnProperty.call(s, p))
66
+ t[p] = s[p];
67
+ }
68
+ return t;
69
+ };
70
+ return __assign.apply(this, arguments);
71
+ };
72
+ function __rest(s, e) {
73
+ var t = {};
74
+ for (var p in s)
75
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
76
+ t[p] = s[p];
77
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
78
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
79
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
80
+ t[p[i]] = s[p[i]];
81
+ }
82
+ return t;
83
+ }
84
+ function __decorate(decorators, target, key, desc) {
85
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
86
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
87
+ r = Reflect.decorate(decorators, target, key, desc);
88
+ else
89
+ for (var i = decorators.length - 1; i >= 0; i--)
90
+ if (d = decorators[i])
91
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
92
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
93
+ }
94
+ function __param(paramIndex, decorator) {
95
+ return function (target, key) { decorator(target, key, paramIndex); };
96
+ }
97
+ function __metadata(metadataKey, metadataValue) {
98
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
99
+ return Reflect.metadata(metadataKey, metadataValue);
100
+ }
101
+ function __awaiter(thisArg, _arguments, P, generator) {
102
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
103
+ return new (P || (P = Promise))(function (resolve, reject) {
104
+ function fulfilled(value) { try {
105
+ step(generator.next(value));
106
+ }
107
+ catch (e) {
108
+ reject(e);
109
+ } }
110
+ function rejected(value) { try {
111
+ step(generator["throw"](value));
112
+ }
113
+ catch (e) {
114
+ reject(e);
115
+ } }
116
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
117
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
118
+ });
119
+ }
120
+ function __generator(thisArg, body) {
121
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
122
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
123
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
124
+ function verb(n) { return function (v) { return step([n, v]); }; }
125
+ function step(op) {
126
+ if (f)
127
+ throw new TypeError("Generator is already executing.");
128
+ while (_)
129
+ try {
130
+ 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)
131
+ return t;
132
+ if (y = 0, t)
133
+ op = [op[0] & 2, t.value];
134
+ switch (op[0]) {
135
+ case 0:
136
+ case 1:
137
+ t = op;
138
+ break;
139
+ case 4:
140
+ _.label++;
141
+ return { value: op[1], done: false };
142
+ case 5:
143
+ _.label++;
144
+ y = op[1];
145
+ op = [0];
146
+ continue;
147
+ case 7:
148
+ op = _.ops.pop();
149
+ _.trys.pop();
150
+ continue;
151
+ default:
152
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
153
+ _ = 0;
154
+ continue;
155
+ }
156
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
157
+ _.label = op[1];
158
+ break;
159
+ }
160
+ if (op[0] === 6 && _.label < t[1]) {
161
+ _.label = t[1];
162
+ t = op;
163
+ break;
164
+ }
165
+ if (t && _.label < t[2]) {
166
+ _.label = t[2];
167
+ _.ops.push(op);
168
+ break;
169
+ }
170
+ if (t[2])
171
+ _.ops.pop();
172
+ _.trys.pop();
173
+ continue;
174
+ }
175
+ op = body.call(thisArg, _);
176
+ }
177
+ catch (e) {
178
+ op = [6, e];
179
+ y = 0;
180
+ }
181
+ finally {
182
+ f = t = 0;
183
+ }
184
+ if (op[0] & 5)
185
+ throw op[1];
186
+ return { value: op[0] ? op[1] : void 0, done: true };
187
+ }
188
+ }
189
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
190
+ if (k2 === undefined)
191
+ k2 = k;
192
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
193
+ }) : (function (o, m, k, k2) {
194
+ if (k2 === undefined)
195
+ k2 = k;
196
+ o[k2] = m[k];
197
+ });
198
+ function __exportStar(m, o) {
199
+ for (var p in m)
200
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
201
+ __createBinding(o, m, p);
202
+ }
203
+ function __values(o) {
204
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
205
+ if (m)
206
+ return m.call(o);
207
+ if (o && typeof o.length === "number")
208
+ return {
209
+ next: function () {
210
+ if (o && i >= o.length)
211
+ o = void 0;
212
+ return { value: o && o[i++], done: !o };
213
+ }
214
+ };
215
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
216
+ }
217
+ function __read(o, n) {
218
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
219
+ if (!m)
220
+ return o;
221
+ var i = m.call(o), r, ar = [], e;
222
+ try {
223
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
224
+ ar.push(r.value);
225
+ }
226
+ catch (error) {
227
+ e = { error: error };
228
+ }
229
+ finally {
230
+ try {
231
+ if (r && !r.done && (m = i["return"]))
232
+ m.call(i);
233
+ }
234
+ finally {
235
+ if (e)
236
+ throw e.error;
237
+ }
238
+ }
239
+ return ar;
240
+ }
241
+ /** @deprecated */
242
+ function __spread() {
243
+ for (var ar = [], i = 0; i < arguments.length; i++)
244
+ ar = ar.concat(__read(arguments[i]));
245
+ return ar;
246
+ }
247
+ /** @deprecated */
248
+ function __spreadArrays() {
249
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
250
+ s += arguments[i].length;
251
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
252
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
253
+ r[k] = a[j];
254
+ return r;
255
+ }
256
+ function __spreadArray(to, from, pack) {
257
+ if (pack || arguments.length === 2)
258
+ for (var i = 0, l = from.length, ar; i < l; i++) {
259
+ if (ar || !(i in from)) {
260
+ if (!ar)
261
+ ar = Array.prototype.slice.call(from, 0, i);
262
+ ar[i] = from[i];
263
+ }
264
+ }
265
+ return to.concat(ar || Array.prototype.slice.call(from));
266
+ }
267
+ function __await(v) {
268
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
269
+ }
270
+ function __asyncGenerator(thisArg, _arguments, generator) {
271
+ if (!Symbol.asyncIterator)
272
+ throw new TypeError("Symbol.asyncIterator is not defined.");
273
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
274
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
275
+ function verb(n) { if (g[n])
276
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
277
+ function resume(n, v) { try {
278
+ step(g[n](v));
279
+ }
280
+ catch (e) {
281
+ settle(q[0][3], e);
282
+ } }
283
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
284
+ function fulfill(value) { resume("next", value); }
285
+ function reject(value) { resume("throw", value); }
286
+ function settle(f, v) { if (f(v), q.shift(), q.length)
287
+ resume(q[0][0], q[0][1]); }
288
+ }
289
+ function __asyncDelegator(o) {
290
+ var i, p;
291
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
292
+ 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; }
293
+ }
294
+ function __asyncValues(o) {
295
+ if (!Symbol.asyncIterator)
296
+ throw new TypeError("Symbol.asyncIterator is not defined.");
297
+ var m = o[Symbol.asyncIterator], i;
298
+ 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);
299
+ 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); }); }; }
300
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
301
+ }
302
+ function __makeTemplateObject(cooked, raw) {
303
+ if (Object.defineProperty) {
304
+ Object.defineProperty(cooked, "raw", { value: raw });
305
+ }
306
+ else {
307
+ cooked.raw = raw;
308
+ }
309
+ return cooked;
310
+ }
311
+ ;
312
+ var __setModuleDefault = Object.create ? (function (o, v) {
313
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
314
+ }) : function (o, v) {
315
+ o["default"] = v;
316
+ };
317
+ function __importStar(mod) {
318
+ if (mod && mod.__esModule)
319
+ return mod;
320
+ var result = {};
321
+ if (mod != null)
322
+ for (var k in mod)
323
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
324
+ __createBinding(result, mod, k);
325
+ __setModuleDefault(result, mod);
326
+ return result;
327
+ }
328
+ function __importDefault(mod) {
329
+ return (mod && mod.__esModule) ? mod : { default: mod };
330
+ }
331
+ function __classPrivateFieldGet(receiver, state, kind, f) {
332
+ if (kind === "a" && !f)
333
+ throw new TypeError("Private accessor was defined without a getter");
334
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
335
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
336
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
337
+ }
338
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
339
+ if (kind === "m")
340
+ throw new TypeError("Private method is not writable");
341
+ if (kind === "a" && !f)
342
+ throw new TypeError("Private accessor was defined without a setter");
343
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
344
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
345
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
346
346
  }
347
347
 
348
- var ObjectUtility = /** @class */ (function () {
349
- function ObjectUtility() {
350
- }
351
- ObjectUtility.isEmpty = function (value) {
352
- var e_1, _a;
353
- if (value == {} || value == undefined || value == null || value == "" || value == [])
354
- return true;
355
- if (this.isArray(value)) {
356
- try {
357
- for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
358
- var element = value_1_1.value;
359
- if (!this.isEmpty(element))
360
- return false;
361
- }
362
- }
363
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
364
- finally {
365
- try {
366
- if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
367
- }
368
- finally { if (e_1) throw e_1.error; }
369
- }
370
- return true;
371
- }
372
- return false;
373
- };
374
- ObjectUtility.isArray = function (value) {
375
- return Array.isArray(value);
376
- };
377
- ObjectUtility.includes = function (array, value) {
378
- if (this.isEmpty(array))
379
- return false;
380
- return array.includes(value);
381
- };
382
- return ObjectUtility;
348
+ var ObjectUtility = /** @class */ (function () {
349
+ function ObjectUtility() {
350
+ }
351
+ ObjectUtility.isEmpty = function (value) {
352
+ var e_1, _a;
353
+ if (value == {} || value == undefined || value == null || value == "" || value == [])
354
+ return true;
355
+ if (this.isArray(value)) {
356
+ try {
357
+ for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
358
+ var element = value_1_1.value;
359
+ if (!this.isEmpty(element))
360
+ return false;
361
+ }
362
+ }
363
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
364
+ finally {
365
+ try {
366
+ if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
367
+ }
368
+ finally { if (e_1) throw e_1.error; }
369
+ }
370
+ return true;
371
+ }
372
+ return false;
373
+ };
374
+ ObjectUtility.isArray = function (value) {
375
+ return Array.isArray(value);
376
+ };
377
+ ObjectUtility.includes = function (array, value) {
378
+ if (this.isEmpty(array))
379
+ return false;
380
+ return array.includes(value);
381
+ };
382
+ return ObjectUtility;
383
383
  }());
384
384
 
385
- var AlertComponent = /** @class */ (function () {
386
- function AlertComponent() {
387
- }
388
- AlertComponent.prototype.ngOnInit = function () {
389
- };
390
- AlertComponent.prototype.isEmpty = function (value) {
391
- return ObjectUtility.isEmpty(value);
392
- };
393
- return AlertComponent;
394
- }());
395
- /** @nocollapse */ AlertComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AlertComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
396
- /** @nocollapse */ AlertComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AlertComponent, selector: "df-alert", inputs: { form: "form", input: "input" }, ngImport: i0__namespace, template: "<div *ngIf=\"!isEmpty(form.get(input.id)) && form.get(input.id).touched && form.get(input.id).invalid\" class=\"alert alert-danger mt-2\">\r\n <div *ngIf=\"form.get(input.id).errors.required\">{{input.label}} is required.</div>\r\n <div *ngIf=\"form.get(input.id).errors.multipleCheckboxRequireOne\">At least one option is required for {{input.label}}.</div>\r\n <div *ngIf=\"form.get(input.id).errors.minlength\">{{input.label}} minimum length is {{form.get(input.id).errors.minlength.requiredLength}}.</div>\r\n <div *ngIf=\"form.get(input.id).errors.maxlength\">{{input.label}} maximum length is {{form.get(input.id).errors.maxlength.requiredLength}}.</div>\r\n <div *ngIf=\"form.get(input.id).errors.min\">{{input.label}} min value is {{form.get(input.id).errors.min.min}}.</div>\r\n <div *ngIf=\"form.get(input.id).errors.max\">{{input.label}} max value is {{form.get(input.id).errors.max.max}}.</div>\r\n <div *ngIf=\"form.get(input.id).errors.email\">{{input.label}} is invalid.</div>\r\n <div *ngIf=\"form.get(input.id).errors.pattern\">{{input.label}} is invalid.</div>\r\n</div>\r\n<div *ngIf=\"!isEmpty(input) && \r\n input.prerequired!==undefined &&\r\n input.prerequired.id!==undefined &&\r\n input.prerequired.label!==undefined &&\r\n (form.get(input.prerequired.id).value==='' ||\r\n form.get(input.prerequired.id).value===null) &&\r\n (!isEmpty(form.get(input.id)) && \r\n form.get(input.id).touched &&\r\n form.get(input.id).value!=='')\" class=\"alert alert-danger mt-2\">\r\n Please provide {{input.prerequired.label}}.\r\n {{form.setErrors({'incorrect':true})}}\r\n</div>", styles: [""], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
397
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AlertComponent, decorators: [{
398
- type: i0.Component,
399
- args: [{
400
- selector: 'df-alert',
401
- templateUrl: './alert.component.html',
402
- styleUrls: ['./alert.component.scss']
403
- }]
404
- }], ctorParameters: function () { return []; }, propDecorators: { form: [{
405
- type: i0.Input
406
- }], input: [{
407
- type: i0.Input
385
+ var AlertComponent = /** @class */ (function () {
386
+ function AlertComponent() {
387
+ }
388
+ AlertComponent.prototype.ngOnInit = function () {
389
+ };
390
+ AlertComponent.prototype.isEmpty = function (value) {
391
+ return ObjectUtility.isEmpty(value);
392
+ };
393
+ return AlertComponent;
394
+ }());
395
+ /** @nocollapse */ AlertComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AlertComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
396
+ /** @nocollapse */ AlertComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AlertComponent, selector: "df-alert", inputs: { form: "form", input: "input" }, ngImport: i0__namespace, template: "<div *ngIf=\"!isEmpty(form.get(input.id)) && form.get(input.id).touched && form.get(input.id).invalid\" class=\"alert alert-danger mt-2\">\n <div *ngIf=\"form.get(input.id).errors.required\">{{input.label}} is required.</div>\n <div *ngIf=\"form.get(input.id).errors.multipleCheckboxRequireOne\">At least one option is required for {{input.label}}.</div>\n <div *ngIf=\"form.get(input.id).errors.minlength\">{{input.label}} minimum length is {{form.get(input.id).errors.minlength.requiredLength}}.</div>\n <div *ngIf=\"form.get(input.id).errors.maxlength\">{{input.label}} maximum length is {{form.get(input.id).errors.maxlength.requiredLength}}.</div>\n <div *ngIf=\"form.get(input.id).errors.min\">{{input.label}} min value is {{form.get(input.id).errors.min.min}}.</div>\n <div *ngIf=\"form.get(input.id).errors.max\">{{input.label}} max value is {{form.get(input.id).errors.max.max}}.</div>\n <div *ngIf=\"form.get(input.id).errors.email\">{{input.label}} is invalid.</div>\n <div *ngIf=\"form.get(input.id).errors.pattern\">{{input.label}} is invalid.</div>\n</div>\n<div *ngIf=\"!isEmpty(input) && \n input.prerequired!==undefined &&\n input.prerequired.id!==undefined &&\n input.prerequired.label!==undefined &&\n (form.get(input.prerequired.id).value==='' ||\n form.get(input.prerequired.id).value===null) &&\n (!isEmpty(form.get(input.id)) && \n form.get(input.id).touched &&\n form.get(input.id).value!=='')\" class=\"alert alert-danger mt-2\">\n Please provide {{input.prerequired.label}}.\n {{form.setErrors({'incorrect':true})}}\n</div>", styles: [""], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
397
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AlertComponent, decorators: [{
398
+ type: i0.Component,
399
+ args: [{
400
+ selector: 'df-alert',
401
+ templateUrl: './alert.component.html',
402
+ styleUrls: ['./alert.component.scss']
403
+ }]
404
+ }], ctorParameters: function () { return []; }, propDecorators: { form: [{
405
+ type: i0.Input
406
+ }], input: [{
407
+ type: i0.Input
408
408
  }] } });
409
409
 
410
- var Constants = /** @class */ (function () {
411
- function Constants() {
412
- }
413
- return Constants;
414
- }());
415
- Constants.EMPTY_SPACE = "";
416
- Constants.VERTICAL_BAR = "|";
417
- Constants.BACK_SLASH = "/";
418
- Constants.LEFT_PARENTHESIS = "(";
419
- Constants.RIGHT_PARENTHESIS = ")";
420
- Constants.LEFT_CURLY_BRACE = "{";
421
- Constants.RIGHT_CURLY_BRACE = "}";
422
- Constants.CONTROL_PREFIX = "control::";
423
- Constants.MAX_LEVELS = 30;
424
- Constants.ALERT_TIMEOUT = 3000;
425
- Constants.START_LEVEL = "Level[";
426
- Constants.END_LEVEL = "]: ";
427
- Constants.VALIDATOR_SPLITTER = "::";
428
- Constants.AMPERSAND = "&";
429
- Constants.EQUAL = "=";
410
+ var Constants = /** @class */ (function () {
411
+ function Constants() {
412
+ }
413
+ return Constants;
414
+ }());
415
+ Constants.EMPTY_SPACE = "";
416
+ Constants.VERTICAL_BAR = "|";
417
+ Constants.BACK_SLASH = "/";
418
+ Constants.LEFT_PARENTHESIS = "(";
419
+ Constants.RIGHT_PARENTHESIS = ")";
420
+ Constants.LEFT_CURLY_BRACE = "{";
421
+ Constants.RIGHT_CURLY_BRACE = "}";
422
+ Constants.CONTROL_PREFIX = "control::";
423
+ Constants.MAX_LEVELS = 30;
424
+ Constants.ALERT_TIMEOUT = 3000;
425
+ Constants.START_LEVEL = "Level[";
426
+ Constants.END_LEVEL = "]: ";
427
+ Constants.VALIDATOR_SPLITTER = "::";
428
+ Constants.AMPERSAND = "&";
429
+ Constants.EQUAL = "=";
430
430
  Constants.QUESTION_MARK = "?";
431
431
 
432
- var GenericInputType = /** @class */ (function () {
433
- function GenericInputType() {
434
- }
435
- return GenericInputType;
436
- }());
437
- GenericInputType.TEXT = "text";
438
- GenericInputType.NUMBER = "number";
439
- GenericInputType.DATE = "date";
440
- GenericInputType.PASSWORD = "password";
441
- GenericInputType.TEXTAREA = "textarea";
442
- GenericInputType.RADIO = "radio";
443
- GenericInputType.CHECKBOX = "checkbox";
444
- GenericInputType.COMBOBOX = "combobox";
445
- GenericInputType.BUTTON = "button";
446
- GenericInputType.SUBMIT = "submit";
432
+ var GenericInputType = /** @class */ (function () {
433
+ function GenericInputType() {
434
+ }
435
+ return GenericInputType;
436
+ }());
437
+ GenericInputType.TEXT = "text";
438
+ GenericInputType.NUMBER = "number";
439
+ GenericInputType.DATE = "date";
440
+ GenericInputType.PASSWORD = "password";
441
+ GenericInputType.TEXTAREA = "textarea";
442
+ GenericInputType.RADIO = "radio";
443
+ GenericInputType.CHECKBOX = "checkbox";
444
+ GenericInputType.COMBOBOX = "combobox";
445
+ GenericInputType.BUTTON = "button";
446
+ GenericInputType.SUBMIT = "submit";
447
447
  GenericInputType.RESET = "reset";
448
448
 
449
- var Validation = /** @class */ (function () {
450
- function Validation() {
451
- }
452
- return Validation;
453
- }());
454
- Validation.REQUIRED = "required";
455
- Validation.MINLENGTH = "minlength";
456
- Validation.MAXLENGTH = "maxlength";
457
- Validation.MIN = "min";
458
- Validation.MAX = "max";
459
- Validation.EMAIL = "email";
449
+ var Validation = /** @class */ (function () {
450
+ function Validation() {
451
+ }
452
+ return Validation;
453
+ }());
454
+ Validation.REQUIRED = "required";
455
+ Validation.MINLENGTH = "minlength";
456
+ Validation.MAXLENGTH = "maxlength";
457
+ Validation.MIN = "min";
458
+ Validation.MAX = "max";
459
+ Validation.EMAIL = "email";
460
460
  Validation.PATTERN = "pattern";
461
461
 
462
- var FormValidators = /** @class */ (function () {
463
- function FormValidators() {
464
- }
465
- FormValidators.getValidators = function (validators) {
466
- var e_1, _a;
467
- var validatorObjects = null;
468
- if (!ObjectUtility.isEmpty(validators)) {
469
- validatorObjects = [];
470
- try {
471
- for (var validators_1 = __values(validators), validators_1_1 = validators_1.next(); !validators_1_1.done; validators_1_1 = validators_1.next()) {
472
- var validator = validators_1_1.value;
473
- var validatorObject = void 0;
474
- if (validator.indexOf(Constants.VALIDATOR_SPLITTER) > -1)
475
- validatorObject = this.getValidator(validator.split(Constants.VALIDATOR_SPLITTER)[0]);
476
- else
477
- validatorObject = this.getValidator(validator);
478
- if (!ObjectUtility.isEmpty(validatorObject))
479
- validatorObjects.push(validatorObject);
480
- }
481
- }
482
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
483
- finally {
484
- try {
485
- if (validators_1_1 && !validators_1_1.done && (_a = validators_1.return)) _a.call(validators_1);
486
- }
487
- finally { if (e_1) throw e_1.error; }
488
- }
489
- }
490
- return validatorObjects;
491
- };
492
- FormValidators.getValidator = function (validator) {
493
- if (validator === Validation.REQUIRED) {
494
- return i2$1.Validators.required;
495
- }
496
- else if (validator.indexOf(Validation.MINLENGTH) !== -1) {
497
- var values = validator.split(Constants.VERTICAL_BAR);
498
- return i2$1.Validators.minLength(Number(values[1]));
499
- }
500
- else if (validator.indexOf(Validation.MAXLENGTH) !== -1) {
501
- var values = validator.split(Constants.VERTICAL_BAR);
502
- return i2$1.Validators.maxLength(Number(values[1]));
503
- }
504
- else if (validator.indexOf(Validation.MIN) !== -1) {
505
- var values = validator.split(Constants.VERTICAL_BAR);
506
- return i2$1.Validators.min(Number(values[1]));
507
- }
508
- else if (validator.indexOf(Validation.MAX) !== -1) {
509
- var values = validator.split(Constants.VERTICAL_BAR);
510
- return i2$1.Validators.max(Number(values[1]));
511
- }
512
- else if (validator.indexOf(Validation.EMAIL) !== -1) {
513
- return i2$1.Validators.email;
514
- }
515
- else if (validator.indexOf(Validation.PATTERN) !== -1) {
516
- var values = validator.split(Constants.VERTICAL_BAR);
517
- return i2$1.Validators.pattern(values[1]);
518
- }
519
- };
520
- return FormValidators;
462
+ var FormValidators = /** @class */ (function () {
463
+ function FormValidators() {
464
+ }
465
+ FormValidators.getValidators = function (validators) {
466
+ var e_1, _a;
467
+ var validatorObjects = null;
468
+ if (!ObjectUtility.isEmpty(validators)) {
469
+ validatorObjects = [];
470
+ try {
471
+ for (var validators_1 = __values(validators), validators_1_1 = validators_1.next(); !validators_1_1.done; validators_1_1 = validators_1.next()) {
472
+ var validator = validators_1_1.value;
473
+ var validatorObject = void 0;
474
+ if (validator.indexOf(Constants.VALIDATOR_SPLITTER) > -1)
475
+ validatorObject = this.getValidator(validator.split(Constants.VALIDATOR_SPLITTER)[0]);
476
+ else
477
+ validatorObject = this.getValidator(validator);
478
+ if (!ObjectUtility.isEmpty(validatorObject))
479
+ validatorObjects.push(validatorObject);
480
+ }
481
+ }
482
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
483
+ finally {
484
+ try {
485
+ if (validators_1_1 && !validators_1_1.done && (_a = validators_1.return)) _a.call(validators_1);
486
+ }
487
+ finally { if (e_1) throw e_1.error; }
488
+ }
489
+ }
490
+ return validatorObjects;
491
+ };
492
+ FormValidators.getValidator = function (validator) {
493
+ if (validator === Validation.REQUIRED) {
494
+ return i2$1.Validators.required;
495
+ }
496
+ else if (validator.indexOf(Validation.MINLENGTH) !== -1) {
497
+ var values = validator.split(Constants.VERTICAL_BAR);
498
+ return i2$1.Validators.minLength(Number(values[1]));
499
+ }
500
+ else if (validator.indexOf(Validation.MAXLENGTH) !== -1) {
501
+ var values = validator.split(Constants.VERTICAL_BAR);
502
+ return i2$1.Validators.maxLength(Number(values[1]));
503
+ }
504
+ else if (validator.indexOf(Validation.MIN) !== -1) {
505
+ var values = validator.split(Constants.VERTICAL_BAR);
506
+ return i2$1.Validators.min(Number(values[1]));
507
+ }
508
+ else if (validator.indexOf(Validation.MAX) !== -1) {
509
+ var values = validator.split(Constants.VERTICAL_BAR);
510
+ return i2$1.Validators.max(Number(values[1]));
511
+ }
512
+ else if (validator.indexOf(Validation.EMAIL) !== -1) {
513
+ return i2$1.Validators.email;
514
+ }
515
+ else if (validator.indexOf(Validation.PATTERN) !== -1) {
516
+ var values = validator.split(Constants.VERTICAL_BAR);
517
+ return i2$1.Validators.pattern(values[1]);
518
+ }
519
+ };
520
+ return FormValidators;
521
521
  }());
522
522
 
523
- var CustomValidator = /** @class */ (function () {
524
- function CustomValidator() {
525
- }
526
- CustomValidator.multipleCheckboxRequireOne = function (fa) {
527
- var valid = false;
528
- for (var x = 0; x < fa.length; ++x) {
529
- if (fa.at(x).value) {
530
- valid = true;
531
- break;
532
- }
533
- }
534
- return valid ? null : {
535
- multipleCheckboxRequireOne: true
536
- };
537
- };
538
- return CustomValidator;
523
+ var CustomValidator = /** @class */ (function () {
524
+ function CustomValidator() {
525
+ }
526
+ CustomValidator.multipleCheckboxRequireOne = function (fa) {
527
+ var valid = false;
528
+ for (var x = 0; x < fa.length; ++x) {
529
+ if (fa.at(x).value) {
530
+ valid = true;
531
+ break;
532
+ }
533
+ }
534
+ return valid ? null : {
535
+ multipleCheckboxRequireOne: true
536
+ };
537
+ };
538
+ return CustomValidator;
539
539
  }());
540
540
 
541
- var FormsUtility = /** @class */ (function () {
542
- function FormsUtility() {
543
- }
544
- FormsUtility.updateCheckboxValue = function (form, formArrayName, controlName, checked, value) {
545
- var formArr = form.controls[formArrayName];
546
- if (!checked) {
547
- formArr.controls[controlName].setValue(null);
548
- }
549
- else {
550
- formArr.controls[controlName].setValue(value);
551
- }
552
- };
553
- FormsUtility.updateRadioValue = function (form, controlName, checked, optionId) {
554
- var control = form.controls[controlName];
555
- if (!checked) {
556
- control.setValue(Constants.EMPTY_SPACE);
557
- }
558
- else {
559
- control.setValue(optionId);
560
- }
561
- };
562
- FormsUtility.isCheckBoxChecked = function (form, controlName, optionId) {
563
- var checked = null;
564
- var formArr = form.controls[controlName];
565
- var formControl = formArr.controls[optionId];
566
- if (!ObjectUtility.isEmpty(formControl))
567
- checked = formControl.value;
568
- if (!ObjectUtility.isEmpty(checked))
569
- return checked;
570
- else
571
- return null;
572
- };
573
- FormsUtility.isRadioChecked = function (form, controlName, optionId) {
574
- var checked = null;
575
- var formControl = form.controls[controlName];
576
- if (!ObjectUtility.isEmpty(formControl))
577
- checked = formControl.value;
578
- if (!ObjectUtility.isEmpty(checked) && checked == optionId)
579
- return true;
580
- else
581
- return false;
582
- };
583
- FormsUtility.buildFromGroup = function (fields, disabled) {
584
- var e_1, _a, e_2, _b;
585
- var form = new i2$1.FormGroup({});
586
- if (!ObjectUtility.isEmpty(fields))
587
- try {
588
- for (var _c = __values(Array.from(fields)), _d = _c.next(); !_d.done; _d = _c.next()) {
589
- var group = _d.value;
590
- console.log("group>", group);
591
- try {
592
- for (var _e = (e_2 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _f = _e.next(); !_f.done; _f = _e.next()) {
593
- var input = _f.value;
594
- if (input.id !== undefined) {
595
- if (input.type !== undefined && input.type === GenericInputType.CHECKBOX) {
596
- form.addControl(input.id, this.getCheckBoxFormArray(input));
597
- if (!ObjectUtility.isEmpty(input.value)) {
598
- form.controls[input.id].reset(input.value);
599
- form.controls[input.id].updateValueAndValidity();
600
- }
601
- if (input.disabled || disabled) {
602
- form.controls[input.id].disable();
603
- }
604
- }
605
- if (input.type !== undefined && (input.type === GenericInputType.RADIO ||
606
- input.type === GenericInputType.DATE ||
607
- input.type === GenericInputType.COMBOBOX)) {
608
- form.addControl(input.id, new i2$1.FormControl((!ObjectUtility.isEmpty(input.value)) ? input.value : Constants.EMPTY_SPACE, (!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) ? FormValidators.getValidators([Validation.REQUIRED]) : null));
609
- if (input.disabled || disabled) {
610
- form.controls[input.id].disable();
611
- }
612
- }
613
- else {
614
- form.addControl(input.id, new i2$1.FormControl((!ObjectUtility.isEmpty(input.value)) ? input.value : Constants.EMPTY_SPACE, (!input.hidden) ? FormValidators.getValidators(input.validators) : null));
615
- if (input.disabled || disabled) {
616
- form.controls[input.id].disable();
617
- }
618
- }
619
- }
620
- }
621
- }
622
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
623
- finally {
624
- try {
625
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
626
- }
627
- finally { if (e_2) throw e_2.error; }
628
- }
629
- }
630
- }
631
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
632
- finally {
633
- try {
634
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
635
- }
636
- finally { if (e_1) throw e_1.error; }
637
- }
638
- return form;
639
- };
640
- FormsUtility.getCheckBoxFormArray = function (input) {
641
- var fb = new i2$1.FormBuilder();
642
- return fb.array(input.options.map(function () { return fb.control(null, null); }), (!input.hidden) ? this.getCheckBoxValidator(input) : null);
643
- };
644
- FormsUtility.getCheckBoxValidator = function (input) {
645
- if (!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) {
646
- return CustomValidator.multipleCheckboxRequireOne;
647
- }
648
- return null;
649
- };
650
- FormsUtility.includeRequired = function (validators) {
651
- var e_3, _a;
652
- if (!ObjectUtility.isEmpty(validators)) {
653
- try {
654
- for (var _b = __values(Array.from(validators)), _c = _b.next(); !_c.done; _c = _b.next()) {
655
- var validator = _c.value;
656
- if (validator === Validation.REQUIRED) {
657
- return true;
658
- }
659
- }
660
- }
661
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
662
- finally {
663
- try {
664
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
665
- }
666
- finally { if (e_3) throw e_3.error; }
667
- }
668
- }
669
- return false;
670
- };
671
- FormsUtility.resetForm = function (fields, form) {
672
- var e_4, _a, e_5, _b;
673
- if (!ObjectUtility.isEmpty(fields))
674
- try {
675
- for (var _c = __values(Array.from(fields)), _d = _c.next(); !_d.done; _d = _c.next()) {
676
- var group = _d.value;
677
- try {
678
- for (var _e = (e_5 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _f = _e.next(); !_f.done; _f = _e.next()) {
679
- var input = _f.value;
680
- if (!ObjectUtility.isEmpty(input.id)
681
- && !input.readonly
682
- && !input.disabled
683
- && !ObjectUtility.isEmpty(form.controls)
684
- && !ObjectUtility.isEmpty(form.controls[input.id])) {
685
- var control = form.controls[input.id];
686
- control.reset();
687
- }
688
- }
689
- }
690
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
691
- finally {
692
- try {
693
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
694
- }
695
- finally { if (e_5) throw e_5.error; }
696
- }
697
- }
698
- }
699
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
700
- finally {
701
- try {
702
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
703
- }
704
- finally { if (e_4) throw e_4.error; }
705
- }
706
- return form;
707
- };
708
- FormsUtility.setValidators = function (input, form, result) {
709
- if (!ObjectUtility.isEmpty(form.controls[input.id])) {
710
- if (result) {
711
- if (input.type === GenericInputType.CHECKBOX) {
712
- form.controls[input.id].setValidators(this.getCheckBoxValidator(input));
713
- }
714
- else if (input.type !== undefined && (input.type === GenericInputType.RADIO ||
715
- input.type === GenericInputType.DATE ||
716
- input.type === GenericInputType.COMBOBOX)) {
717
- form.controls[input.id].setValidators((!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) ?
718
- FormValidators.getValidators([Validation.REQUIRED]) : null);
719
- }
720
- else {
721
- form.controls[input.id].setValidators((!input.hidden) ? FormValidators.getValidators(input.validators) : null);
722
- }
723
- }
724
- else {
725
- form.controls[input.id].setValidators(null);
726
- }
727
- form.controls[input.id].updateValueAndValidity();
728
- }
729
- };
730
- return FormsUtility;
541
+ var FormsUtility = /** @class */ (function () {
542
+ function FormsUtility() {
543
+ }
544
+ FormsUtility.updateCheckboxValue = function (form, formArrayName, controlName, checked, value) {
545
+ var formArr = form.controls[formArrayName];
546
+ if (!checked) {
547
+ formArr.controls[controlName].setValue(null);
548
+ }
549
+ else {
550
+ formArr.controls[controlName].setValue(value);
551
+ }
552
+ };
553
+ FormsUtility.updateRadioValue = function (form, controlName, checked, optionId) {
554
+ var control = form.controls[controlName];
555
+ if (!checked) {
556
+ control.setValue(Constants.EMPTY_SPACE);
557
+ }
558
+ else {
559
+ control.setValue(optionId);
560
+ }
561
+ };
562
+ FormsUtility.isCheckBoxChecked = function (form, controlName, optionId) {
563
+ var checked = null;
564
+ var formArr = form.controls[controlName];
565
+ var formControl = formArr.controls[optionId];
566
+ if (!ObjectUtility.isEmpty(formControl))
567
+ checked = formControl.value;
568
+ if (!ObjectUtility.isEmpty(checked))
569
+ return checked;
570
+ else
571
+ return null;
572
+ };
573
+ FormsUtility.isRadioChecked = function (form, controlName, optionId) {
574
+ var checked = null;
575
+ var formControl = form.controls[controlName];
576
+ if (!ObjectUtility.isEmpty(formControl))
577
+ checked = formControl.value;
578
+ if (!ObjectUtility.isEmpty(checked) && checked == optionId)
579
+ return true;
580
+ else
581
+ return false;
582
+ };
583
+ FormsUtility.buildFromGroup = function (fields, disabled) {
584
+ var e_1, _a, e_2, _b;
585
+ var form = new i2$1.FormGroup({});
586
+ if (!ObjectUtility.isEmpty(fields))
587
+ try {
588
+ for (var _c = __values(Array.from(fields)), _d = _c.next(); !_d.done; _d = _c.next()) {
589
+ var group = _d.value;
590
+ try {
591
+ //console.log("group>",group);
592
+ for (var _e = (e_2 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _f = _e.next(); !_f.done; _f = _e.next()) {
593
+ var input = _f.value;
594
+ if (input.id !== undefined) {
595
+ if (input.type !== undefined && input.type === GenericInputType.CHECKBOX) {
596
+ form.addControl(input.id, this.getCheckBoxFormArray(input));
597
+ if (!ObjectUtility.isEmpty(input.value)) {
598
+ form.controls[input.id].reset(input.value);
599
+ form.controls[input.id].updateValueAndValidity();
600
+ }
601
+ if (input.disabled || disabled) {
602
+ form.controls[input.id].disable();
603
+ }
604
+ }
605
+ if (input.type !== undefined && (input.type === GenericInputType.RADIO ||
606
+ input.type === GenericInputType.DATE ||
607
+ input.type === GenericInputType.COMBOBOX)) {
608
+ form.addControl(input.id, new i2$1.FormControl((!ObjectUtility.isEmpty(input.value)) ? input.value : Constants.EMPTY_SPACE, (!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) ? FormValidators.getValidators([Validation.REQUIRED]) : null));
609
+ if (input.disabled || disabled) {
610
+ form.controls[input.id].disable();
611
+ }
612
+ }
613
+ else {
614
+ form.addControl(input.id, new i2$1.FormControl((!ObjectUtility.isEmpty(input.value)) ? input.value : Constants.EMPTY_SPACE, (!input.hidden) ? FormValidators.getValidators(input.validators) : null));
615
+ if (input.disabled || disabled) {
616
+ form.controls[input.id].disable();
617
+ }
618
+ }
619
+ }
620
+ }
621
+ }
622
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
623
+ finally {
624
+ try {
625
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
626
+ }
627
+ finally { if (e_2) throw e_2.error; }
628
+ }
629
+ }
630
+ }
631
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
632
+ finally {
633
+ try {
634
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
635
+ }
636
+ finally { if (e_1) throw e_1.error; }
637
+ }
638
+ return form;
639
+ };
640
+ FormsUtility.getCheckBoxFormArray = function (input) {
641
+ var fb = new i2$1.FormBuilder();
642
+ return fb.array(input.options.map(function () { return fb.control(null, null); }), (!input.hidden) ? this.getCheckBoxValidator(input) : null);
643
+ };
644
+ FormsUtility.getCheckBoxValidator = function (input) {
645
+ if (!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) {
646
+ return CustomValidator.multipleCheckboxRequireOne;
647
+ }
648
+ return null;
649
+ };
650
+ FormsUtility.includeRequired = function (validators) {
651
+ var e_3, _a;
652
+ if (!ObjectUtility.isEmpty(validators)) {
653
+ try {
654
+ for (var _b = __values(Array.from(validators)), _c = _b.next(); !_c.done; _c = _b.next()) {
655
+ var validator = _c.value;
656
+ if (validator === Validation.REQUIRED) {
657
+ return true;
658
+ }
659
+ }
660
+ }
661
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
662
+ finally {
663
+ try {
664
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
665
+ }
666
+ finally { if (e_3) throw e_3.error; }
667
+ }
668
+ }
669
+ return false;
670
+ };
671
+ FormsUtility.resetForm = function (fields, form) {
672
+ var e_4, _a, e_5, _b;
673
+ if (!ObjectUtility.isEmpty(fields))
674
+ try {
675
+ for (var _c = __values(Array.from(fields)), _d = _c.next(); !_d.done; _d = _c.next()) {
676
+ var group = _d.value;
677
+ try {
678
+ for (var _e = (e_5 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _f = _e.next(); !_f.done; _f = _e.next()) {
679
+ var input = _f.value;
680
+ if (!ObjectUtility.isEmpty(input.id)
681
+ && !input.readonly
682
+ && !input.disabled
683
+ && !ObjectUtility.isEmpty(form.controls)
684
+ && !ObjectUtility.isEmpty(form.controls[input.id])) {
685
+ var control = form.controls[input.id];
686
+ control.reset();
687
+ }
688
+ }
689
+ }
690
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
691
+ finally {
692
+ try {
693
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
694
+ }
695
+ finally { if (e_5) throw e_5.error; }
696
+ }
697
+ }
698
+ }
699
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
700
+ finally {
701
+ try {
702
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
703
+ }
704
+ finally { if (e_4) throw e_4.error; }
705
+ }
706
+ return form;
707
+ };
708
+ FormsUtility.setValidators = function (input, form, result) {
709
+ if (!ObjectUtility.isEmpty(form.controls[input.id])) {
710
+ if (result) {
711
+ if (input.type === GenericInputType.CHECKBOX) {
712
+ form.controls[input.id].setValidators(this.getCheckBoxValidator(input));
713
+ }
714
+ else if (input.type !== undefined && (input.type === GenericInputType.RADIO ||
715
+ input.type === GenericInputType.DATE ||
716
+ input.type === GenericInputType.COMBOBOX)) {
717
+ form.controls[input.id].setValidators((!input.hidden && (input.required || ObjectUtility.includes(input.validators, Validation.REQUIRED))) ?
718
+ FormValidators.getValidators([Validation.REQUIRED]) : null);
719
+ }
720
+ else {
721
+ form.controls[input.id].setValidators((!input.hidden) ? FormValidators.getValidators(input.validators) : null);
722
+ }
723
+ }
724
+ else {
725
+ form.controls[input.id].setValidators(null);
726
+ }
727
+ form.controls[input.id].updateValueAndValidity();
728
+ }
729
+ };
730
+ return FormsUtility;
731
731
  }());
732
732
 
733
- var FormComponent = /** @class */ (function () {
734
- function FormComponent() {
735
- this.form = new i2$1.FormGroup({});
736
- this.fileList = null;
737
- this.fileName = "";
738
- this.onSubmit = new i0.EventEmitter();
739
- this.alert_timeout = Constants.ALERT_TIMEOUT;
740
- this.danger = { active: false, label: '' };
741
- this.warning = { active: false, label: '' };
742
- this.success = { active: false, label: '' };
743
- this.info = { active: false, label: '' };
744
- this.primary = { active: false, label: '' };
745
- this.secondary = { active: false, label: '' };
746
- }
747
- FormComponent.prototype.onClick = function (action) {
748
- var data = {
749
- action: action,
750
- formValues: this.form.value
751
- };
752
- this.onSubmit.emit(data);
753
- };
754
- FormComponent.prototype.onEnter = function () {
755
- this.onSubmit.emit(this.form.value);
756
- };
757
- FormComponent.prototype.ngOnInit = function () {
758
- this.buildFormGroup(this.formFields);
759
- //console.log("form>",this.form);
760
- };
761
- FormComponent.prototype.buildFormGroup = function (fields) {
762
- this.form = FormsUtility.buildFromGroup(fields, this.disabled);
763
- };
764
- FormComponent.prototype.getForm = function () {
765
- return this.form;
766
- };
767
- FormComponent.prototype.getFormControls = function () {
768
- if (!ObjectUtility.isEmpty(this.form)) {
769
- return this.form.controls;
770
- }
771
- };
772
- FormComponent.prototype.getFormControl = function (controlName) {
773
- if (!ObjectUtility.isEmpty(this.form)
774
- && !ObjectUtility.isEmpty(this.form.controls)) {
775
- return this.form.controls[controlName];
776
- }
777
- };
778
- FormComponent.prototype.setFormControlValue = function (controlName, value) {
779
- if (!ObjectUtility.isEmpty(this.form)
780
- && !ObjectUtility.isEmpty(this.form.controls)
781
- && !ObjectUtility.isEmpty(this.form.controls)
782
- && !ObjectUtility.isEmpty(this.form.controls[controlName])) {
783
- this.form.controls[controlName].reset(value);
784
- this.form.controls[controlName].updateValueAndValidity();
785
- }
786
- };
787
- FormComponent.prototype.includeRequired = function (validators) {
788
- return FormsUtility.includeRequired(validators);
789
- };
790
- FormComponent.prototype.fileChange = function (event) {
791
- this.fileList = event.target.files;
792
- //console.log("fileList>",this.fileList);
793
- if (!ObjectUtility.isEmpty(this.fileList) && event.target.files.length > 0)
794
- this.fileName = this.fileList[0].name;
795
- else
796
- this.fileName = "";
797
- };
798
- FormComponent.prototype.onUploadClick = function (id) {
799
- var data = {
800
- action: 'uploadFile',
801
- fileList: this.fileList,
802
- fieldId: id
803
- };
804
- this.onSubmit.emit(data);
805
- };
806
- FormComponent.prototype.updateCheckboxValue = function (formArray, controlName, checked, value) {
807
- FormsUtility.updateCheckboxValue(this.form, formArray, controlName, checked, value);
808
- };
809
- FormComponent.prototype.updateRadioValue = function (inputId, checked, optionId) {
810
- FormsUtility.updateRadioValue(this.form, inputId, checked, optionId);
811
- };
812
- FormComponent.prototype.isCheckBoxChecked = function (controlName, optionId) {
813
- return FormsUtility.isCheckBoxChecked(this.form, controlName, optionId);
814
- };
815
- FormComponent.prototype.isRadioChecked = function (controlName, optionId) {
816
- return FormsUtility.isRadioChecked(this.form, controlName, optionId);
817
- };
818
- FormComponent.prototype.resetForm = function () {
819
- this.form = FormsUtility.resetForm(this.formFields, this.form);
820
- };
821
- FormComponent.prototype.isEmpty = function (value) {
822
- return ObjectUtility.isEmpty(value);
823
- };
824
- FormComponent.prototype.getDisabled = function () {
825
- return this.disabled;
826
- };
827
- FormComponent.prototype.setDisabled = function (disabled) {
828
- this.disabled = disabled;
829
- this.form = FormsUtility.buildFromGroup(this.formFields, this.disabled);
830
- };
831
- FormComponent.prototype.setDanger = function (label) {
832
- var _this = this;
833
- this.danger.active = true;
834
- this.danger.label = label;
835
- setTimeout(function () {
836
- _this.danger.active = false;
837
- }, this.alert_timeout);
838
- };
839
- FormComponent.prototype.setWarning = function (label) {
840
- var _this = this;
841
- this.warning.active = true;
842
- this.warning.label = label;
843
- setTimeout(function () {
844
- _this.warning.active = false;
845
- }, this.alert_timeout);
846
- };
847
- FormComponent.prototype.setSuccess = function (label) {
848
- var _this = this;
849
- this.success.active = true;
850
- this.success.label = label;
851
- setTimeout(function () {
852
- _this.success.active = false;
853
- }, this.alert_timeout);
854
- };
855
- FormComponent.prototype.setInfo = function (label) {
856
- var _this = this;
857
- this.info.active = true;
858
- this.info.label = label;
859
- setTimeout(function () {
860
- _this.info.active = false;
861
- }, this.alert_timeout);
862
- };
863
- FormComponent.prototype.setPrimary = function (label) {
864
- var _this = this;
865
- this.primary.active = true;
866
- this.primary.label = label;
867
- setTimeout(function () {
868
- _this.primary.active = false;
869
- }, this.alert_timeout);
870
- };
871
- FormComponent.prototype.setSecondary = function (label) {
872
- var _this = this;
873
- this.secondary.active = true;
874
- this.secondary.label = label;
875
- setTimeout(function () {
876
- _this.secondary.active = false;
877
- }, this.alert_timeout);
878
- };
879
- FormComponent.prototype.setAlertTimeout = function (timeout) {
880
- this.alert_timeout = timeout;
881
- };
882
- FormComponent.prototype.getIconClass = function (input) {
883
- return input.icon;
884
- };
885
- return FormComponent;
886
- }());
887
- /** @nocollapse */ FormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: FormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
888
- /** @nocollapse */ FormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: FormComponent, selector: "df-form", inputs: { formFields: "formFields", disabled: "disabled", buttons: "buttons" }, outputs: { onSubmit: "onSubmit" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" class=\"form\">\r\n <div class=\"row\" [style]=\"group?.style\" *ngFor=\"let group of formFields\">\r\n <span *ngIf=\"!isEmpty(group?.groupTitle)\" class=\"mt-1\">{{group?.groupTitle}}</span>\r\n <div *ngFor=\"let input of group?.groupFields\" class=\"mt-1 mb-2 form-group col-auto\">\r\n <span [hidden]=\"input.hidden\">\r\n <label *ngIf=\"input.type!=='button' && input.type!=='reset' && input.type!=='submit'\" for=\"{{input.id}}\" class=\"mr-sm-2\">\r\n <div *ngIf=\"includeRequired(input.validators) || input.required===true\"\r\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> *{{input.label}}</div>\r\n <div *ngIf=\"!includeRequired(input.validators) && (input.required===false || input.required===undefined)\"\r\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</div>\r\n </label>\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'text'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'number'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'date'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'password'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'textarea'\">\r\n <textarea\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm\"\r\n [readonly]=\"input.readonly\"\r\n ></textarea>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'file'\">\r\n <div class=\"form-group\">\r\n <div class=\"input-group\">\r\n <div class=\"custom-file\">\r\n <input type=\"file\"\r\n class=\"form-control\"\r\n id=\"{{input.id}}\"\r\n accept=\"{{input.accept}}\"\r\n (change)=\"fileChange($event)\" multiple>\r\n <label class=\"custom-file-label\" for=\"{{input.id}}\">{{fileName}}</label>\r\n </div>\r\n <div class=\"input-group-append\">\r\n <span class=\"input-group-text\" (click)=\"onUploadClick(input.id)\">\r\n <i [className]=\"input.uploadIcon\" aria-hidden=\"true\"></i> {{input.uploadLabel}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'combobox'\">\r\n <select name=\"{{input.id}}\"\r\n id=\"{{input.id}}\"\r\n formControlName={{input.id}}\r\n class=\"form-control form-control-sm\">\r\n <option [value]=\"\"></option>\r\n <option [value]=\"option.id\" *ngFor=\"let option of input.options\"> {{option.label}}</option>\r\n </select>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div class=\"row\" *ngSwitchCase=\"'radio'\">\r\n <div class=\"col-auto\"\r\n [style.color]=\"input.color\"\r\n *ngFor=\"let option of input.options\">\r\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\r\n <input type=\"{{input.type}}\"\r\n name=\"{{input.id}}\"\r\n id=\"{{input.id}}\"\r\n formControlName={{input.id}}\r\n class=\"form-check-input\"\r\n [value]=\"option.id\"\r\n [checked]=\"isRadioChecked(input.id,option.id)\"\r\n (change)=\"updateRadioValue(input.id,$event.target.checked,option.id)\"\r\n />\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div class=\"row\" *ngSwitchCase=\"'checkbox'\">\r\n <div class=\"col-auto\" [style.color]=\"input.color\" formArrayName=\"{{input.id}}\" *ngFor=\"let option of input.options; let i=index;\">\r\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\r\n <input type=\"{{input.type}}\"\r\n name=\"{{option.id}}\"\r\n id=\"{{option.id}}\"\r\n [formControlName]=\"i\"\r\n [value]=\"input.options[i].id\"\r\n class=\"form-check-input\"\r\n [checked]=\"isCheckBoxChecked(input.id,i)\"\r\n (change)=\"updateCheckboxValue(input.id,i,$event.target.checked,input.options[i].id)\"\r\n />\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n </div>\r\n </span>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\r\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\r\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\r\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\r\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\r\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\r\n </div>\r\n <div class=\"d-flex justify-content-around\">\r\n <div *ngFor=\"let input of buttons\">\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'button'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ml-2\" (click)=\"onClick(input.action)\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'submit'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-primary ml-2\" (click)=\"onClick(input.action)\" [disabled]=\"!form.valid\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'reset'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary ml-2\" (click)=\"resetForm()\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n", styles: [".alert{display:inline-block}.grow{flex-grow:1}textarea:focus,select:focus,input[type=text]:focus,input[type=password]:focus,input[type=datetime]:focus,input[type=datetime-local]:focus,input[type=date]:focus,input[type=month]:focus,input[type=time]:focus,input[type=week]:focus,input[type=number]:focus,input[type=email]:focus,input[type=url]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=color]:focus,input[type=checkbox]:focus,input[type=radio]:focus,button:focus,.uneditable-input:focus{border-color:green;box-shadow:0 1px 1px #00000013 inset,0 0 8px green;outline:0 none}.col-auto{flex-grow:1}.radio,.checkbox{width:15px;height:15px}.btn-primary{background-color:green;border-color:green}.form-check-input:checked{background-color:green;border-color:green}\n"], components: [{ type: AlertComponent, selector: "df-alert", inputs: ["form", "input"] }], directives: [{ type: i2__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] });
889
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: FormComponent, decorators: [{
890
- type: i0.Component,
891
- args: [{
892
- selector: 'df-form',
893
- templateUrl: './form.component.html',
894
- styleUrls: ['./form.component.scss']
895
- }]
896
- }], ctorParameters: function () { return []; }, propDecorators: { formFields: [{
897
- type: i0.Input
898
- }], disabled: [{
899
- type: i0.Input
900
- }], buttons: [{
901
- type: i0.Input
902
- }], onSubmit: [{
903
- type: i0.Output
733
+ var FormComponent = /** @class */ (function () {
734
+ function FormComponent() {
735
+ this.form = new i2$1.FormGroup({});
736
+ this.fileList = null;
737
+ this.fileName = "";
738
+ this.onSubmit = new i0.EventEmitter();
739
+ this.alert_timeout = Constants.ALERT_TIMEOUT;
740
+ this.danger = { active: false, label: '' };
741
+ this.warning = { active: false, label: '' };
742
+ this.success = { active: false, label: '' };
743
+ this.info = { active: false, label: '' };
744
+ this.primary = { active: false, label: '' };
745
+ this.secondary = { active: false, label: '' };
746
+ }
747
+ FormComponent.prototype.onClick = function (action) {
748
+ var data = {
749
+ action: action,
750
+ formValues: this.form.value
751
+ };
752
+ this.onSubmit.emit(data);
753
+ };
754
+ FormComponent.prototype.onEnter = function () {
755
+ this.onSubmit.emit(this.form.value);
756
+ };
757
+ FormComponent.prototype.ngOnInit = function () {
758
+ this.buildFormGroup(this.formFields);
759
+ //console.log("form>",this.form);
760
+ };
761
+ FormComponent.prototype.buildFormGroup = function (fields) {
762
+ this.form = FormsUtility.buildFromGroup(fields, this.disabled);
763
+ };
764
+ FormComponent.prototype.getForm = function () {
765
+ return this.form;
766
+ };
767
+ FormComponent.prototype.getFormControls = function () {
768
+ if (!ObjectUtility.isEmpty(this.form)) {
769
+ return this.form.controls;
770
+ }
771
+ };
772
+ FormComponent.prototype.getFormControl = function (controlName) {
773
+ if (!ObjectUtility.isEmpty(this.form)
774
+ && !ObjectUtility.isEmpty(this.form.controls)) {
775
+ return this.form.controls[controlName];
776
+ }
777
+ };
778
+ FormComponent.prototype.setFormControlValue = function (controlName, value) {
779
+ if (!ObjectUtility.isEmpty(this.form)
780
+ && !ObjectUtility.isEmpty(this.form.controls)
781
+ && !ObjectUtility.isEmpty(this.form.controls)
782
+ && !ObjectUtility.isEmpty(this.form.controls[controlName])) {
783
+ this.form.controls[controlName].reset(value);
784
+ this.form.controls[controlName].updateValueAndValidity();
785
+ }
786
+ };
787
+ FormComponent.prototype.includeRequired = function (validators) {
788
+ return FormsUtility.includeRequired(validators);
789
+ };
790
+ FormComponent.prototype.fileChange = function (event) {
791
+ this.fileList = event.target.files;
792
+ //console.log("fileList>",this.fileList);
793
+ if (!ObjectUtility.isEmpty(this.fileList) && event.target.files.length > 0)
794
+ this.fileName = this.fileList[0].name;
795
+ else
796
+ this.fileName = "";
797
+ };
798
+ FormComponent.prototype.onUploadClick = function (id) {
799
+ var data = {
800
+ action: 'uploadFile',
801
+ fileList: this.fileList,
802
+ fieldId: id
803
+ };
804
+ this.onSubmit.emit(data);
805
+ };
806
+ FormComponent.prototype.updateCheckboxValue = function (formArray, controlName, checked, value) {
807
+ FormsUtility.updateCheckboxValue(this.form, formArray, controlName, checked, value);
808
+ };
809
+ FormComponent.prototype.updateRadioValue = function (inputId, checked, optionId) {
810
+ FormsUtility.updateRadioValue(this.form, inputId, checked, optionId);
811
+ };
812
+ FormComponent.prototype.isCheckBoxChecked = function (controlName, optionId) {
813
+ return FormsUtility.isCheckBoxChecked(this.form, controlName, optionId);
814
+ };
815
+ FormComponent.prototype.isRadioChecked = function (controlName, optionId) {
816
+ return FormsUtility.isRadioChecked(this.form, controlName, optionId);
817
+ };
818
+ FormComponent.prototype.resetForm = function () {
819
+ this.form = FormsUtility.resetForm(this.formFields, this.form);
820
+ };
821
+ FormComponent.prototype.isEmpty = function (value) {
822
+ return ObjectUtility.isEmpty(value);
823
+ };
824
+ FormComponent.prototype.getDisabled = function () {
825
+ return this.disabled;
826
+ };
827
+ FormComponent.prototype.setDisabled = function (disabled) {
828
+ this.disabled = disabled;
829
+ this.form = FormsUtility.buildFromGroup(this.formFields, this.disabled);
830
+ };
831
+ FormComponent.prototype.setDanger = function (label) {
832
+ var _this = this;
833
+ this.danger.active = true;
834
+ this.danger.label = label;
835
+ setTimeout(function () {
836
+ _this.danger.active = false;
837
+ }, this.alert_timeout);
838
+ };
839
+ FormComponent.prototype.setWarning = function (label) {
840
+ var _this = this;
841
+ this.warning.active = true;
842
+ this.warning.label = label;
843
+ setTimeout(function () {
844
+ _this.warning.active = false;
845
+ }, this.alert_timeout);
846
+ };
847
+ FormComponent.prototype.setSuccess = function (label) {
848
+ var _this = this;
849
+ this.success.active = true;
850
+ this.success.label = label;
851
+ setTimeout(function () {
852
+ _this.success.active = false;
853
+ }, this.alert_timeout);
854
+ };
855
+ FormComponent.prototype.setInfo = function (label) {
856
+ var _this = this;
857
+ this.info.active = true;
858
+ this.info.label = label;
859
+ setTimeout(function () {
860
+ _this.info.active = false;
861
+ }, this.alert_timeout);
862
+ };
863
+ FormComponent.prototype.setPrimary = function (label) {
864
+ var _this = this;
865
+ this.primary.active = true;
866
+ this.primary.label = label;
867
+ setTimeout(function () {
868
+ _this.primary.active = false;
869
+ }, this.alert_timeout);
870
+ };
871
+ FormComponent.prototype.setSecondary = function (label) {
872
+ var _this = this;
873
+ this.secondary.active = true;
874
+ this.secondary.label = label;
875
+ setTimeout(function () {
876
+ _this.secondary.active = false;
877
+ }, this.alert_timeout);
878
+ };
879
+ FormComponent.prototype.setAlertTimeout = function (timeout) {
880
+ this.alert_timeout = timeout;
881
+ };
882
+ FormComponent.prototype.getIconClass = function (input) {
883
+ return input.icon;
884
+ };
885
+ return FormComponent;
886
+ }());
887
+ /** @nocollapse */ FormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: FormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
888
+ /** @nocollapse */ FormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: FormComponent, selector: "df-form", inputs: { formFields: "formFields", disabled: "disabled", buttons: "buttons" }, outputs: { onSubmit: "onSubmit" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" class=\"form\">\n <div class=\"row\" [style]=\"group?.style\" *ngFor=\"let group of formFields\">\n <span *ngIf=\"!isEmpty(group?.groupTitle)\" class=\"mt-1\">{{group?.groupTitle}}</span>\n <div *ngFor=\"let input of group?.groupFields\" class=\"mt-1 mb-2 form-group col-auto\">\n <span [hidden]=\"input.hidden\">\n <label *ngIf=\"input.type!=='button' && input.type!=='reset' && input.type!=='submit'\" for=\"{{input.id}}\" class=\"mr-sm-2\">\n <div *ngIf=\"includeRequired(input.validators) || input.required===true\"\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> *{{input.label}}</div>\n <div *ngIf=\"!includeRequired(input.validators) && (input.required===false || input.required===undefined)\"\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</div>\n </label>\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'text'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'number'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'date'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'password'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'textarea'\">\n <textarea\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm\"\n [readonly]=\"input.readonly\"\n ></textarea>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'file'\">\n <div class=\"form-group\">\n <div class=\"input-group\">\n <div class=\"custom-file\">\n <input type=\"file\"\n class=\"form-control\"\n id=\"{{input.id}}\"\n accept=\"{{input.accept}}\"\n (change)=\"fileChange($event)\" multiple>\n <label class=\"custom-file-label\" for=\"{{input.id}}\">{{fileName}}</label>\n </div>\n <div class=\"input-group-append\">\n <span class=\"input-group-text\" (click)=\"onUploadClick(input.id)\">\n <i [className]=\"input.uploadIcon\" aria-hidden=\"true\"></i> {{input.uploadLabel}}</span>\n </div>\n </div>\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'combobox'\">\n <select name=\"{{input.id}}\"\n id=\"{{input.id}}\"\n formControlName={{input.id}}\n class=\"form-control form-control-sm\">\n <option [value]=\"\"></option>\n <option [value]=\"option.id\" *ngFor=\"let option of input.options\"> {{option.label}}</option>\n </select>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div class=\"row\" *ngSwitchCase=\"'radio'\">\n <div class=\"col-auto\"\n [style.color]=\"input.color\"\n *ngFor=\"let option of input.options\">\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\n <input type=\"{{input.type}}\"\n name=\"{{input.id}}\"\n id=\"{{input.id}}\"\n formControlName={{input.id}}\n class=\"form-check-input\"\n [value]=\"option.id\"\n [checked]=\"isRadioChecked(input.id,option.id)\"\n (change)=\"updateRadioValue(input.id,$event.target.checked,option.id)\"\n />\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div class=\"row\" *ngSwitchCase=\"'checkbox'\">\n <div class=\"col-auto\" [style.color]=\"input.color\" formArrayName=\"{{input.id}}\" *ngFor=\"let option of input.options; let i=index;\">\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\n <input type=\"{{input.type}}\"\n name=\"{{option.id}}\"\n id=\"{{option.id}}\"\n [formControlName]=\"i\"\n [value]=\"input.options[i].id\"\n class=\"form-check-input\"\n [checked]=\"isCheckBoxChecked(input.id,i)\"\n (change)=\"updateCheckboxValue(input.id,i,$event.target.checked,input.options[i].id)\"\n />\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n </div>\n </span>\n </div>\n </div>\n <div class=\"row\">\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-4 ml-3 mr-3\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-4 ml-3 mr-3\">\n <i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-4 ml-3 mr-3\">\n <i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\n </div>\n <div class=\"d-flex justify-content-around\">\n <div *ngFor=\"let input of buttons\">\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'button'\">\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ml-2\" (click)=\"onClick(input.action)\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'submit'\">\n <button type=\"{{input.type}}\" class=\"btn btn-primary ml-2\" (click)=\"onClick(input.action)\" [disabled]=\"!form.valid\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'reset'\">\n <button type=\"'button'\" class=\"btn btn-secondary ml-2\" (click)=\"resetForm()\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n </div>\n </div>\n </div>\n</form>\n", styles: [".alert{display:inline-block}.grow{flex-grow:1}.col-auto{flex-grow:1}\n"], components: [{ type: AlertComponent, selector: "df-alert", inputs: ["form", "input"] }], directives: [{ type: i2__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] });
889
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: FormComponent, decorators: [{
890
+ type: i0.Component,
891
+ args: [{
892
+ selector: 'df-form',
893
+ templateUrl: './form.component.html',
894
+ styleUrls: ['./form.component.scss']
895
+ }]
896
+ }], ctorParameters: function () { return []; }, propDecorators: { formFields: [{
897
+ type: i0.Input
898
+ }], disabled: [{
899
+ type: i0.Input
900
+ }], buttons: [{
901
+ type: i0.Input
902
+ }], onSubmit: [{
903
+ type: i0.Output
904
904
  }] } });
905
905
 
906
- var ComparisonOperators = /** @class */ (function () {
907
- function ComparisonOperators() {
908
- }
909
- return ComparisonOperators;
910
- }());
911
- ComparisonOperators.EQUAL = '==';
912
- ComparisonOperators.NOT_EQUAL = '!=';
913
- ComparisonOperators.GREATER_THAN = '>';
914
- ComparisonOperators.GREATER_THAN_OR_EQUAL = '>=';
915
- ComparisonOperators.LESS_THAN = '<';
916
- ComparisonOperators.LESS_THAN_OR_EQUAL = '<=';
906
+ var ComparisonOperators = /** @class */ (function () {
907
+ function ComparisonOperators() {
908
+ }
909
+ return ComparisonOperators;
910
+ }());
911
+ ComparisonOperators.EQUAL = '==';
912
+ ComparisonOperators.NOT_EQUAL = '!=';
913
+ ComparisonOperators.GREATER_THAN = '>';
914
+ ComparisonOperators.GREATER_THAN_OR_EQUAL = '>=';
915
+ ComparisonOperators.LESS_THAN = '<';
916
+ ComparisonOperators.LESS_THAN_OR_EQUAL = '<=';
917
917
  ComparisonOperators.CONTAINS = ':contains:';
918
918
 
919
- var LogicalOperators = /** @class */ (function () {
920
- function LogicalOperators() {
921
- }
922
- return LogicalOperators;
923
- }());
924
- LogicalOperators.AND = '&&';
919
+ var LogicalOperators = /** @class */ (function () {
920
+ function LogicalOperators() {
921
+ }
922
+ return LogicalOperators;
923
+ }());
924
+ LogicalOperators.AND = '&&';
925
925
  LogicalOperators.OR = '||';
926
926
 
927
- var ExpressionsUtility = /** @class */ (function () {
928
- function ExpressionsUtility() {
929
- }
930
- ExpressionsUtility.getExpressionLogs = function () {
931
- return ExpressionsUtility.logs;
932
- };
933
- ExpressionsUtility.setLoggingFlag = function (flag) {
934
- ExpressionsUtility.expressionLoggingFlag = flag;
935
- };
936
- ExpressionsUtility.evaluateExpression = function (expression, form, level) {
937
- if (level <= 1)
938
- ExpressionsUtility.logs = Constants.EMPTY_SPACE;
939
- if (level > Constants.MAX_LEVELS)
940
- return false;
941
- if (this.expressionLoggingFlag)
942
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Evaluating Expression> " + expression + " \n";
943
- if (!ObjectUtility.isEmpty(expression)) {
944
- if (expression.startsWith(Constants.LEFT_PARENTHESIS)
945
- && expression.endsWith(Constants.RIGHT_PARENTHESIS)) {
946
- expression = expression.substring(1, expression.length - 1);
947
- if (this.expressionLoggingFlag)
948
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "remove outer ( ) \n";
949
- return this.evaluateExpression(expression, form, level + 1);
950
- }
951
- else if (expression.startsWith(Constants.LEFT_CURLY_BRACE) && expression.endsWith(Constants.RIGHT_CURLY_BRACE)) {
952
- if (this.expressionLoggingFlag)
953
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with { ends with } \n";
954
- if (expression.indexOf(Constants.LEFT_PARENTHESIS) > -1 && expression.indexOf(Constants.RIGHT_PARENTHESIS) > -1) {
955
- if (this.expressionLoggingFlag)
956
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "contains subexpressions \n";
957
- return this.traverseSubExpressions(expression, form, level);
958
- }
959
- else {
960
- if (this.expressionLoggingFlag)
961
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "does not contains subexpressions \n";
962
- if (expression.indexOf(LogicalOperators.AND) > -1 || expression.indexOf(LogicalOperators.OR) > -1) {
963
- if (this.expressionLoggingFlag)
964
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "contains && or || \n";
965
- var spliter = this.getSpliter(expression);
966
- var expressions = expression.split(spliter);
967
- if (this.expressionLoggingFlag)
968
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Split expressions into> " + expressions + "\n";
969
- return this.validateArrayOfExpressions(expressions, spliter, form, level);
970
- }
971
- else {
972
- if (this.expressionLoggingFlag)
973
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "this is a clean expression. \n";
974
- return this.evaluateCleanExpression(expression, form, level);
975
- }
976
- }
977
- }
978
- else if ((expression.startsWith(Constants.LEFT_PARENTHESIS) && !expression.endsWith(Constants.RIGHT_PARENTHESIS)) ||
979
- (!expression.startsWith(Constants.LEFT_PARENTHESIS) && expression.endsWith(Constants.RIGHT_PARENTHESIS))) {
980
- if (expression.startsWith(Constants.LEFT_PARENTHESIS) && !expression.endsWith(Constants.RIGHT_PARENTHESIS))
981
- if (this.expressionLoggingFlag)
982
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with ( ends with } \n";
983
- if (!expression.startsWith(Constants.LEFT_PARENTHESIS) && expression.endsWith(Constants.RIGHT_PARENTHESIS))
984
- if (this.expressionLoggingFlag)
985
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with { ends with ) \n";
986
- return this.traverseSubExpressions(expression, form, level);
987
- }
988
- else
989
- return false;
990
- }
991
- else
992
- return true;
993
- };
994
- ExpressionsUtility.traverseSubExpressions = function (expression, form, level) {
995
- if (this.expressionLoggingFlag)
996
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Traverse expression> " + expression + "\n";
997
- var operator = Constants.EMPTY_SPACE;
998
- var lastOperator = Constants.EMPTY_SPACE;
999
- var index = 0;
1000
- do {
1001
- operator = Constants.EMPTY_SPACE;
1002
- var subexpression = this.extractSubexpression(expression, level);
1003
- var result = this.evaluateExpression(subexpression, form, level + 1);
1004
- operator = expression.substring(subexpression.length, subexpression.length + 2);
1005
- if (this.expressionLoggingFlag)
1006
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "subExpression> " + subexpression + " >result> " + result + " >for operator> " + operator + "\n";
1007
- if (!result && (operator == LogicalOperators.AND || lastOperator == LogicalOperators.AND))
1008
- return false;
1009
- if (result && (operator == LogicalOperators.OR || lastOperator == LogicalOperators.OR))
1010
- return true;
1011
- expression = expression.substring(subexpression.length + 2, expression.length);
1012
- if (operator !== Constants.EMPTY_SPACE)
1013
- lastOperator = operator;
1014
- if (!ObjectUtility.isEmpty(expression)) {
1015
- if (this.expressionLoggingFlag)
1016
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Rest of the expression> " + expression + " > lastOperator> " + lastOperator + "\n";
1017
- }
1018
- else {
1019
- if (this.expressionLoggingFlag)
1020
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Rest of the expression is empty.\n";
1021
- }
1022
- } while (operator == LogicalOperators.AND || operator == LogicalOperators.OR);
1023
- if (lastOperator == LogicalOperators.AND)
1024
- return true;
1025
- if (lastOperator == LogicalOperators.OR)
1026
- return false;
1027
- };
1028
- ExpressionsUtility.extractSubexpression = function (expression, level) {
1029
- var ending;
1030
- var opening = 0;
1031
- if (expression.startsWith(Constants.LEFT_CURLY_BRACE))
1032
- ending = expression.indexOf(Constants.RIGHT_CURLY_BRACE);
1033
- else {
1034
- var index = 1;
1035
- var opening_1 = 1;
1036
- while (opening_1 > 0) {
1037
- var myChar = expression.charAt(index);
1038
- if (myChar == Constants.LEFT_PARENTHESIS) {
1039
- opening_1++;
1040
- }
1041
- if (myChar == Constants.RIGHT_PARENTHESIS) {
1042
- opening_1--;
1043
- }
1044
- if (index > (expression.length - 1)) {
1045
- break;
1046
- }
1047
- index++;
1048
- }
1049
- ending = index - 1;
1050
- }
1051
- return expression.substring(0, ending + 1);
1052
- };
1053
- ExpressionsUtility.getSpliter = function (expression) {
1054
- if (expression.indexOf(LogicalOperators.AND) > -1)
1055
- return LogicalOperators.AND;
1056
- else
1057
- return LogicalOperators.OR;
1058
- };
1059
- ExpressionsUtility.validateArrayOfExpressions = function (expressions, spliter, form, level) {
1060
- var e_1, _a;
1061
- try {
1062
- for (var expressions_1 = __values(expressions), expressions_1_1 = expressions_1.next(); !expressions_1_1.done; expressions_1_1 = expressions_1.next()) {
1063
- var expression = expressions_1_1.value;
1064
- var result = this.evaluateCleanExpression(expression, form, level);
1065
- if (spliter == LogicalOperators.AND && !result)
1066
- return false;
1067
- else if (spliter == LogicalOperators.OR && result)
1068
- return true;
1069
- }
1070
- }
1071
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1072
- finally {
1073
- try {
1074
- if (expressions_1_1 && !expressions_1_1.done && (_a = expressions_1.return)) _a.call(expressions_1);
1075
- }
1076
- finally { if (e_1) throw e_1.error; }
1077
- }
1078
- return (spliter == LogicalOperators.AND) ? true : false;
1079
- };
1080
- ExpressionsUtility.evaluateCleanExpression = function (expression, form, level) {
1081
- expression = expression.substring(1, expression.length - 1);
1082
- var operator = this.containsComparisonOperator(expression);
1083
- if (!ObjectUtility.isEmpty(operator)) {
1084
- var expressionResult = this.prepareExpressionWithOperator(expression, operator, form, level);
1085
- return expressionResult;
1086
- }
1087
- return false;
1088
- };
1089
- ExpressionsUtility.containsComparisonOperator = function (expressions) {
1090
- var i = 0;
1091
- while (i < this.listComparisonOperators.length) {
1092
- if (expressions.indexOf(this.listComparisonOperators[i]) > -1) {
1093
- return this.listComparisonOperators[i];
1094
- }
1095
- i++;
1096
- }
1097
- return null;
1098
- };
1099
- ExpressionsUtility.prepareExpressionWithOperator = function (expression, operator, form, level) {
1100
- if (!ObjectUtility.isEmpty(this.containsComparisonOperator(expression))
1101
- && expression.indexOf(operator) > -1) {
1102
- var values = expression.split(operator);
1103
- if (values.length > 1) {
1104
- for (var i = 0; i < values.length; i++) {
1105
- values[i] = this.getControlValue(values[i], form);
1106
- }
1107
- var evaluatedExpression = this.evaluateExpressionWithOperator(values, operator);
1108
- if (this.expressionLoggingFlag)
1109
- ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "evaluate clean Expression {}> " + expression + " >result> " + evaluatedExpression + "\n";
1110
- return evaluatedExpression;
1111
- }
1112
- else
1113
- return false;
1114
- }
1115
- else
1116
- return false;
1117
- };
1118
- ExpressionsUtility.getControlValue = function (value, form) {
1119
- if (value.indexOf(Constants.CONTROL_PREFIX) > -1) {
1120
- return this.getControlFromForm(value, form);
1121
- }
1122
- else
1123
- return value;
1124
- };
1125
- ExpressionsUtility.getControlFromForm = function (value, form) {
1126
- value = value.replace(Constants.CONTROL_PREFIX, Constants.EMPTY_SPACE);
1127
- if (!ObjectUtility.isEmpty(form)
1128
- && !ObjectUtility.isEmpty(form.controls)
1129
- && !ObjectUtility.isEmpty(form.controls[value]))
1130
- value = form.controls[value].value;
1131
- return value;
1132
- };
1133
- ExpressionsUtility.evaluateExpressionWithOperator = function (values, operator) {
1134
- if (!ObjectUtility.isEmpty(values)
1135
- && values.length > 1
1136
- && !ObjectUtility.isEmpty(operator)) {
1137
- switch (operator) {
1138
- case ComparisonOperators.EQUAL: {
1139
- if (values[0] == values[1])
1140
- return true;
1141
- break;
1142
- }
1143
- case ComparisonOperators.NOT_EQUAL: {
1144
- if (!(values[0] == values[1]))
1145
- return true;
1146
- break;
1147
- }
1148
- case ComparisonOperators.GREATER_THAN: {
1149
- if ((new Number(values[0])) > (new Number(values[1])))
1150
- return true;
1151
- break;
1152
- }
1153
- case ComparisonOperators.LESS_THAN: {
1154
- if ((new Number(values[0])) < (new Number(values[1])))
1155
- return true;
1156
- break;
1157
- }
1158
- case ComparisonOperators.GREATER_THAN_OR_EQUAL: {
1159
- if ((new Number(values[0])) >= (new Number(values[1])))
1160
- return true;
1161
- break;
1162
- }
1163
- case ComparisonOperators.LESS_THAN_OR_EQUAL: {
1164
- if ((new Number(values[0])) <= (new Number(values[1])))
1165
- return true;
1166
- break;
1167
- }
1168
- case ComparisonOperators.CONTAINS: {
1169
- if (Array.from(values[0]).includes(values[1]))
1170
- return true;
1171
- break;
1172
- }
1173
- default: return false;
1174
- }
1175
- }
1176
- return false;
1177
- };
1178
- return ExpressionsUtility;
1179
- }());
1180
- ExpressionsUtility.expressionLoggingFlag = false;
1181
- ExpressionsUtility.logs = Constants.EMPTY_SPACE;
1182
- ExpressionsUtility.listComparisonOperators = [
1183
- ComparisonOperators.NOT_EQUAL,
1184
- ComparisonOperators.GREATER_THAN_OR_EQUAL,
1185
- ComparisonOperators.LESS_THAN_OR_EQUAL,
1186
- ComparisonOperators.EQUAL,
1187
- ComparisonOperators.GREATER_THAN,
1188
- ComparisonOperators.LESS_THAN,
1189
- ComparisonOperators.CONTAINS
927
+ var ExpressionsUtility = /** @class */ (function () {
928
+ function ExpressionsUtility() {
929
+ }
930
+ ExpressionsUtility.getExpressionLogs = function () {
931
+ return ExpressionsUtility.logs;
932
+ };
933
+ ExpressionsUtility.setLoggingFlag = function (flag) {
934
+ ExpressionsUtility.expressionLoggingFlag = flag;
935
+ };
936
+ ExpressionsUtility.evaluateExpression = function (expression, form, level) {
937
+ if (level <= 1)
938
+ ExpressionsUtility.logs = Constants.EMPTY_SPACE;
939
+ if (level > Constants.MAX_LEVELS)
940
+ return false;
941
+ if (this.expressionLoggingFlag)
942
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Evaluating Expression> " + expression + " \n";
943
+ if (!ObjectUtility.isEmpty(expression)) {
944
+ if (expression.startsWith(Constants.LEFT_PARENTHESIS)
945
+ && expression.endsWith(Constants.RIGHT_PARENTHESIS)) {
946
+ expression = expression.substring(1, expression.length - 1);
947
+ if (this.expressionLoggingFlag)
948
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "remove outer ( ) \n";
949
+ return this.evaluateExpression(expression, form, level + 1);
950
+ }
951
+ else if (expression.startsWith(Constants.LEFT_CURLY_BRACE) && expression.endsWith(Constants.RIGHT_CURLY_BRACE)) {
952
+ if (this.expressionLoggingFlag)
953
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with { ends with } \n";
954
+ if (expression.indexOf(Constants.LEFT_PARENTHESIS) > -1 && expression.indexOf(Constants.RIGHT_PARENTHESIS) > -1) {
955
+ if (this.expressionLoggingFlag)
956
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "contains subexpressions \n";
957
+ return this.traverseSubExpressions(expression, form, level);
958
+ }
959
+ else {
960
+ if (this.expressionLoggingFlag)
961
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "does not contains subexpressions \n";
962
+ if (expression.indexOf(LogicalOperators.AND) > -1 || expression.indexOf(LogicalOperators.OR) > -1) {
963
+ if (this.expressionLoggingFlag)
964
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "contains && or || \n";
965
+ var spliter = this.getSpliter(expression);
966
+ var expressions = expression.split(spliter);
967
+ if (this.expressionLoggingFlag)
968
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Split expressions into> " + expressions + "\n";
969
+ return this.validateArrayOfExpressions(expressions, spliter, form, level);
970
+ }
971
+ else {
972
+ if (this.expressionLoggingFlag)
973
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "this is a clean expression. \n";
974
+ return this.evaluateCleanExpression(expression, form, level);
975
+ }
976
+ }
977
+ }
978
+ else if ((expression.startsWith(Constants.LEFT_PARENTHESIS) && !expression.endsWith(Constants.RIGHT_PARENTHESIS)) ||
979
+ (!expression.startsWith(Constants.LEFT_PARENTHESIS) && expression.endsWith(Constants.RIGHT_PARENTHESIS))) {
980
+ if (expression.startsWith(Constants.LEFT_PARENTHESIS) && !expression.endsWith(Constants.RIGHT_PARENTHESIS))
981
+ if (this.expressionLoggingFlag)
982
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with ( ends with } \n";
983
+ if (!expression.startsWith(Constants.LEFT_PARENTHESIS) && expression.endsWith(Constants.RIGHT_PARENTHESIS))
984
+ if (this.expressionLoggingFlag)
985
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "expression starts with { ends with ) \n";
986
+ return this.traverseSubExpressions(expression, form, level);
987
+ }
988
+ else
989
+ return false;
990
+ }
991
+ else
992
+ return true;
993
+ };
994
+ ExpressionsUtility.traverseSubExpressions = function (expression, form, level) {
995
+ if (this.expressionLoggingFlag)
996
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Traverse expression> " + expression + "\n";
997
+ var operator = Constants.EMPTY_SPACE;
998
+ var lastOperator = Constants.EMPTY_SPACE;
999
+ var index = 0;
1000
+ do {
1001
+ operator = Constants.EMPTY_SPACE;
1002
+ var subexpression = this.extractSubexpression(expression, level);
1003
+ var result = this.evaluateExpression(subexpression, form, level + 1);
1004
+ operator = expression.substring(subexpression.length, subexpression.length + 2);
1005
+ if (this.expressionLoggingFlag)
1006
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "subExpression> " + subexpression + " >result> " + result + " >for operator> " + operator + "\n";
1007
+ if (!result && (operator == LogicalOperators.AND || lastOperator == LogicalOperators.AND))
1008
+ return false;
1009
+ if (result && (operator == LogicalOperators.OR || lastOperator == LogicalOperators.OR))
1010
+ return true;
1011
+ expression = expression.substring(subexpression.length + 2, expression.length);
1012
+ if (operator !== Constants.EMPTY_SPACE)
1013
+ lastOperator = operator;
1014
+ if (!ObjectUtility.isEmpty(expression)) {
1015
+ if (this.expressionLoggingFlag)
1016
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Rest of the expression> " + expression + " > lastOperator> " + lastOperator + "\n";
1017
+ }
1018
+ else {
1019
+ if (this.expressionLoggingFlag)
1020
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "Rest of the expression is empty.\n";
1021
+ }
1022
+ } while (operator == LogicalOperators.AND || operator == LogicalOperators.OR);
1023
+ if (lastOperator == LogicalOperators.AND)
1024
+ return true;
1025
+ if (lastOperator == LogicalOperators.OR)
1026
+ return false;
1027
+ };
1028
+ ExpressionsUtility.extractSubexpression = function (expression, level) {
1029
+ var ending;
1030
+ var opening = 0;
1031
+ if (expression.startsWith(Constants.LEFT_CURLY_BRACE))
1032
+ ending = expression.indexOf(Constants.RIGHT_CURLY_BRACE);
1033
+ else {
1034
+ var index = 1;
1035
+ var opening_1 = 1;
1036
+ while (opening_1 > 0) {
1037
+ var myChar = expression.charAt(index);
1038
+ if (myChar == Constants.LEFT_PARENTHESIS) {
1039
+ opening_1++;
1040
+ }
1041
+ if (myChar == Constants.RIGHT_PARENTHESIS) {
1042
+ opening_1--;
1043
+ }
1044
+ if (index > (expression.length - 1)) {
1045
+ break;
1046
+ }
1047
+ index++;
1048
+ }
1049
+ ending = index - 1;
1050
+ }
1051
+ return expression.substring(0, ending + 1);
1052
+ };
1053
+ ExpressionsUtility.getSpliter = function (expression) {
1054
+ if (expression.indexOf(LogicalOperators.AND) > -1)
1055
+ return LogicalOperators.AND;
1056
+ else
1057
+ return LogicalOperators.OR;
1058
+ };
1059
+ ExpressionsUtility.validateArrayOfExpressions = function (expressions, spliter, form, level) {
1060
+ var e_1, _a;
1061
+ try {
1062
+ for (var expressions_1 = __values(expressions), expressions_1_1 = expressions_1.next(); !expressions_1_1.done; expressions_1_1 = expressions_1.next()) {
1063
+ var expression = expressions_1_1.value;
1064
+ var result = this.evaluateCleanExpression(expression, form, level);
1065
+ if (spliter == LogicalOperators.AND && !result)
1066
+ return false;
1067
+ else if (spliter == LogicalOperators.OR && result)
1068
+ return true;
1069
+ }
1070
+ }
1071
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1072
+ finally {
1073
+ try {
1074
+ if (expressions_1_1 && !expressions_1_1.done && (_a = expressions_1.return)) _a.call(expressions_1);
1075
+ }
1076
+ finally { if (e_1) throw e_1.error; }
1077
+ }
1078
+ return (spliter == LogicalOperators.AND) ? true : false;
1079
+ };
1080
+ ExpressionsUtility.evaluateCleanExpression = function (expression, form, level) {
1081
+ expression = expression.substring(1, expression.length - 1);
1082
+ var operator = this.containsComparisonOperator(expression);
1083
+ if (!ObjectUtility.isEmpty(operator)) {
1084
+ var expressionResult = this.prepareExpressionWithOperator(expression, operator, form, level);
1085
+ return expressionResult;
1086
+ }
1087
+ return false;
1088
+ };
1089
+ ExpressionsUtility.containsComparisonOperator = function (expressions) {
1090
+ var i = 0;
1091
+ while (i < this.listComparisonOperators.length) {
1092
+ if (expressions.indexOf(this.listComparisonOperators[i]) > -1) {
1093
+ return this.listComparisonOperators[i];
1094
+ }
1095
+ i++;
1096
+ }
1097
+ return null;
1098
+ };
1099
+ ExpressionsUtility.prepareExpressionWithOperator = function (expression, operator, form, level) {
1100
+ if (!ObjectUtility.isEmpty(this.containsComparisonOperator(expression))
1101
+ && expression.indexOf(operator) > -1) {
1102
+ var values = expression.split(operator);
1103
+ if (values.length > 1) {
1104
+ for (var i = 0; i < values.length; i++) {
1105
+ values[i] = this.getControlValue(values[i], form);
1106
+ }
1107
+ var evaluatedExpression = this.evaluateExpressionWithOperator(values, operator);
1108
+ if (this.expressionLoggingFlag)
1109
+ ExpressionsUtility.logs = ExpressionsUtility.logs + Constants.START_LEVEL + level + Constants.END_LEVEL + "evaluate clean Expression {}> " + expression + " >result> " + evaluatedExpression + "\n";
1110
+ return evaluatedExpression;
1111
+ }
1112
+ else
1113
+ return false;
1114
+ }
1115
+ else
1116
+ return false;
1117
+ };
1118
+ ExpressionsUtility.getControlValue = function (value, form) {
1119
+ if (value.indexOf(Constants.CONTROL_PREFIX) > -1) {
1120
+ return this.getControlFromForm(value, form);
1121
+ }
1122
+ else
1123
+ return value;
1124
+ };
1125
+ ExpressionsUtility.getControlFromForm = function (value, form) {
1126
+ value = value.replace(Constants.CONTROL_PREFIX, Constants.EMPTY_SPACE);
1127
+ if (!ObjectUtility.isEmpty(form)
1128
+ && !ObjectUtility.isEmpty(form.controls)
1129
+ && !ObjectUtility.isEmpty(form.controls[value]))
1130
+ value = form.controls[value].value;
1131
+ return value;
1132
+ };
1133
+ ExpressionsUtility.evaluateExpressionWithOperator = function (values, operator) {
1134
+ if (!ObjectUtility.isEmpty(values)
1135
+ && values.length > 1
1136
+ && !ObjectUtility.isEmpty(operator)) {
1137
+ switch (operator) {
1138
+ case ComparisonOperators.EQUAL: {
1139
+ if (values[0] == values[1])
1140
+ return true;
1141
+ break;
1142
+ }
1143
+ case ComparisonOperators.NOT_EQUAL: {
1144
+ if (!(values[0] == values[1]))
1145
+ return true;
1146
+ break;
1147
+ }
1148
+ case ComparisonOperators.GREATER_THAN: {
1149
+ if ((new Number(values[0])) > (new Number(values[1])))
1150
+ return true;
1151
+ break;
1152
+ }
1153
+ case ComparisonOperators.LESS_THAN: {
1154
+ if ((new Number(values[0])) < (new Number(values[1])))
1155
+ return true;
1156
+ break;
1157
+ }
1158
+ case ComparisonOperators.GREATER_THAN_OR_EQUAL: {
1159
+ if ((new Number(values[0])) >= (new Number(values[1])))
1160
+ return true;
1161
+ break;
1162
+ }
1163
+ case ComparisonOperators.LESS_THAN_OR_EQUAL: {
1164
+ if ((new Number(values[0])) <= (new Number(values[1])))
1165
+ return true;
1166
+ break;
1167
+ }
1168
+ case ComparisonOperators.CONTAINS: {
1169
+ if (Array.from(values[0]).includes(values[1]))
1170
+ return true;
1171
+ break;
1172
+ }
1173
+ default: return false;
1174
+ }
1175
+ }
1176
+ return false;
1177
+ };
1178
+ return ExpressionsUtility;
1179
+ }());
1180
+ ExpressionsUtility.expressionLoggingFlag = false;
1181
+ ExpressionsUtility.logs = Constants.EMPTY_SPACE;
1182
+ ExpressionsUtility.listComparisonOperators = [
1183
+ ComparisonOperators.NOT_EQUAL,
1184
+ ComparisonOperators.GREATER_THAN_OR_EQUAL,
1185
+ ComparisonOperators.LESS_THAN_OR_EQUAL,
1186
+ ComparisonOperators.EQUAL,
1187
+ ComparisonOperators.GREATER_THAN,
1188
+ ComparisonOperators.LESS_THAN,
1189
+ ComparisonOperators.CONTAINS
1190
1190
  ];
1191
1191
 
1192
- var ExpressionsFormComponent = /** @class */ (function () {
1193
- function ExpressionsFormComponent() {
1194
- this.form = new i2$1.FormGroup({});
1195
- this.activeMap = new Map();
1196
- this.fileList = null;
1197
- this.fileName = "";
1198
- this.onSubmit = new i0.EventEmitter();
1199
- this.onInit = new i0.EventEmitter();
1200
- this.alert_timeout = Constants.ALERT_TIMEOUT;
1201
- this.danger = { active: false, label: '' };
1202
- this.warning = { active: false, label: '' };
1203
- this.success = { active: false, label: '' };
1204
- this.info = { active: false, label: '' };
1205
- this.primary = { active: false, label: '' };
1206
- this.secondary = { active: false, label: '' };
1207
- }
1208
- ExpressionsFormComponent.prototype.onClick = function (action) {
1209
- var data = {
1210
- action: action,
1211
- formValues: this.form.value
1212
- };
1213
- this.onSubmit.emit(data);
1214
- };
1215
- ExpressionsFormComponent.prototype.onInitialiazation = function () {
1216
- this.onInit.emit(this.form);
1217
- };
1218
- ExpressionsFormComponent.prototype.onEnter = function () {
1219
- this.onSubmit.emit(this.form.value);
1220
- };
1221
- ExpressionsFormComponent.prototype.onChange = function (changeFieldId) {
1222
- var e_1, _a, e_2, _b, e_3, _c;
1223
- try {
1224
- for (var _d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
1225
- var group = _e.value;
1226
- try {
1227
- for (var _f = (e_2 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _g = _f.next(); !_g.done; _g = _f.next()) {
1228
- var input = _g.value;
1229
- if (!ObjectUtility.isEmpty(input.expression)
1230
- && !ObjectUtility.isEmpty(input.id)
1231
- && input.expression.indexOf(changeFieldId) > -1
1232
- && input.id.indexOf(changeFieldId) < 0) {
1233
- var validationResult = this.validateExpression(input);
1234
- this.activeMap.set(input.id, validationResult);
1235
- if (!validationResult) {
1236
- this.onChange(input.id);
1237
- }
1238
- }
1239
- }
1240
- }
1241
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1242
- finally {
1243
- try {
1244
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1245
- }
1246
- finally { if (e_2) throw e_2.error; }
1247
- }
1248
- }
1249
- }
1250
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1251
- finally {
1252
- try {
1253
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1254
- }
1255
- finally { if (e_1) throw e_1.error; }
1256
- }
1257
- if (!ObjectUtility.isEmpty(this.buttons))
1258
- try {
1259
- for (var _h = __values(this.buttons), _j = _h.next(); !_j.done; _j = _h.next()) {
1260
- var input = _j.value;
1261
- if (!ObjectUtility.isEmpty(input.expression)
1262
- && !ObjectUtility.isEmpty(input.id)
1263
- && input.expression.indexOf(changeFieldId) > -1
1264
- && input.id.indexOf(changeFieldId) < 0)
1265
- this.activeMap.set(input.id, this.validateExpression(input));
1266
- }
1267
- }
1268
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1269
- finally {
1270
- try {
1271
- if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
1272
- }
1273
- finally { if (e_3) throw e_3.error; }
1274
- }
1275
- };
1276
- ExpressionsFormComponent.prototype.ngOnInit = function () {
1277
- this.buildFormGroup(this.formFields);
1278
- this.onInitialiazation();
1279
- };
1280
- ExpressionsFormComponent.prototype.runExpressionValidations = function () {
1281
- var e_4, _a, e_5, _b, e_6, _c;
1282
- try {
1283
- for (var _d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
1284
- var group = _e.value;
1285
- try {
1286
- for (var _f = (e_5 = void 0, __values(group.groupFields)), _g = _f.next(); !_g.done; _g = _f.next()) {
1287
- var input = _g.value;
1288
- this.activeMap.set(input.id, this.validateExpression(input));
1289
- }
1290
- }
1291
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1292
- finally {
1293
- try {
1294
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1295
- }
1296
- finally { if (e_5) throw e_5.error; }
1297
- }
1298
- }
1299
- }
1300
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1301
- finally {
1302
- try {
1303
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1304
- }
1305
- finally { if (e_4) throw e_4.error; }
1306
- }
1307
- if (!ObjectUtility.isEmpty(this.buttons))
1308
- try {
1309
- for (var _h = __values(this.buttons), _j = _h.next(); !_j.done; _j = _h.next()) {
1310
- var input = _j.value;
1311
- this.activeMap.set(input.id, this.validateExpression(input));
1312
- }
1313
- }
1314
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1315
- finally {
1316
- try {
1317
- if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
1318
- }
1319
- finally { if (e_6) throw e_6.error; }
1320
- }
1321
- };
1322
- ExpressionsFormComponent.prototype.buildFormGroup = function (fields) {
1323
- this.form = FormsUtility.buildFromGroup(fields, this.disabled);
1324
- this.runExpressionValidations();
1325
- };
1326
- ExpressionsFormComponent.prototype.getForm = function () {
1327
- return this.form;
1328
- };
1329
- ExpressionsFormComponent.prototype.setFormValue = function (value) {
1330
- if (!ObjectUtility.isEmpty(this.form)) {
1331
- this.form.reset(value);
1332
- this.form.updateValueAndValidity();
1333
- this.runExpressionValidations();
1334
- }
1335
- };
1336
- ExpressionsFormComponent.prototype.getFormControls = function () {
1337
- if (!ObjectUtility.isEmpty(this.form)) {
1338
- return this.form.controls;
1339
- }
1340
- };
1341
- ExpressionsFormComponent.prototype.getFormControl = function (controlName) {
1342
- if (!ObjectUtility.isEmpty(this.form)
1343
- && !ObjectUtility.isEmpty(this.form.controls)) {
1344
- return this.form.controls[controlName];
1345
- }
1346
- };
1347
- ExpressionsFormComponent.prototype.setFormControlValue = function (controlName, value) {
1348
- if (!ObjectUtility.isEmpty(this.form)
1349
- && !ObjectUtility.isEmpty(this.form.controls)
1350
- && !ObjectUtility.isEmpty(this.form.controls)
1351
- && !ObjectUtility.isEmpty(this.form.controls[controlName])) {
1352
- this.form.controls[controlName].reset(value);
1353
- this.form.controls[controlName].updateValueAndValidity();
1354
- this.onChange(controlName);
1355
- }
1356
- };
1357
- ExpressionsFormComponent.prototype.includeRequired = function (validators) {
1358
- return FormsUtility.includeRequired(validators);
1359
- };
1360
- ExpressionsFormComponent.prototype.updateCheckboxValue = function (formArray, controlName, event, value) {
1361
- FormsUtility.updateCheckboxValue(this.form, formArray, controlName, event.target.checked, value);
1362
- this.onChange(event.target.name);
1363
- };
1364
- ExpressionsFormComponent.prototype.updateRadioValue = function (controlName, event, optionId) {
1365
- FormsUtility.updateRadioValue(this.form, controlName, event.target.checked, optionId);
1366
- this.onChange(event.target.name);
1367
- };
1368
- ExpressionsFormComponent.prototype.isCheckBoxChecked = function (controlName, optionId) {
1369
- return FormsUtility.isCheckBoxChecked(this.form, controlName, optionId);
1370
- };
1371
- ExpressionsFormComponent.prototype.isRadioChecked = function (controlName, optionId) {
1372
- return FormsUtility.isRadioChecked(this.form, controlName, optionId);
1373
- };
1374
- ExpressionsFormComponent.prototype.validateExpression = function (input) {
1375
- var result = ExpressionsUtility.evaluateExpression(input.expression, this.form, 1);
1376
- if (!result
1377
- && !ObjectUtility.isEmpty(this.form)
1378
- && !ObjectUtility.isEmpty(this.form.controls)
1379
- && !ObjectUtility.isEmpty(this.form.controls[input.id])) {
1380
- this.form.controls[input.id].reset();
1381
- this.form.controls[input.id].updateValueAndValidity();
1382
- }
1383
- FormsUtility.setValidators(input, this.form, result);
1384
- return result;
1385
- };
1386
- ExpressionsFormComponent.prototype.validateExpressionsInRow = function (row) {
1387
- var e_7, _a;
1388
- try {
1389
- for (var row_1 = __values(row), row_1_1 = row_1.next(); !row_1_1.done; row_1_1 = row_1.next()) {
1390
- var input = row_1_1.value;
1391
- if (this.activeMap.get(input.id))
1392
- return true;
1393
- }
1394
- }
1395
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1396
- finally {
1397
- try {
1398
- if (row_1_1 && !row_1_1.done && (_a = row_1.return)) _a.call(row_1);
1399
- }
1400
- finally { if (e_7) throw e_7.error; }
1401
- }
1402
- return false;
1403
- };
1404
- ExpressionsFormComponent.prototype.resetForm = function () {
1405
- this.form = FormsUtility.resetForm(this.formFields, this.form);
1406
- this.runExpressionValidations();
1407
- };
1408
- ExpressionsFormComponent.prototype.getDisabled = function () {
1409
- return this.disabled;
1410
- };
1411
- ExpressionsFormComponent.prototype.setDisabled = function (disabled) {
1412
- this.disabled = disabled;
1413
- this.form = FormsUtility.buildFromGroup(this.formFields, this.disabled);
1414
- };
1415
- ExpressionsFormComponent.prototype.fileChange = function (event) {
1416
- this.fileList = event.target.files;
1417
- //console.log("fileList>",this.fileList);
1418
- if (!ObjectUtility.isEmpty(this.fileList) && event.target.files.length > 0)
1419
- this.fileName = this.fileList[0].name;
1420
- else
1421
- this.fileName = "";
1422
- };
1423
- ExpressionsFormComponent.prototype.onUploadClick = function (id) {
1424
- var data = {
1425
- action: 'uploadFile',
1426
- fileList: this.fileList,
1427
- fieldId: id
1428
- };
1429
- this.onSubmit.emit(data);
1430
- };
1431
- ExpressionsFormComponent.prototype.isEmpty = function (value) {
1432
- return ObjectUtility.isEmpty(value);
1433
- };
1434
- ExpressionsFormComponent.prototype.setDanger = function (label) {
1435
- var _this = this;
1436
- this.danger.active = true;
1437
- this.danger.label = label;
1438
- setTimeout(function () {
1439
- _this.danger.active = false;
1440
- }, this.alert_timeout);
1441
- };
1442
- ExpressionsFormComponent.prototype.setWarning = function (label) {
1443
- var _this = this;
1444
- this.warning.active = true;
1445
- this.warning.label = label;
1446
- setTimeout(function () {
1447
- _this.warning.active = false;
1448
- }, this.alert_timeout);
1449
- };
1450
- ExpressionsFormComponent.prototype.setSuccess = function (label) {
1451
- var _this = this;
1452
- this.success.active = true;
1453
- this.success.label = label;
1454
- setTimeout(function () {
1455
- _this.success.active = false;
1456
- }, this.alert_timeout);
1457
- };
1458
- ExpressionsFormComponent.prototype.setInfo = function (label) {
1459
- var _this = this;
1460
- this.info.active = true;
1461
- this.info.label = label;
1462
- setTimeout(function () {
1463
- _this.info.active = false;
1464
- }, this.alert_timeout);
1465
- };
1466
- ExpressionsFormComponent.prototype.setPrimary = function (label) {
1467
- var _this = this;
1468
- this.primary.active = true;
1469
- this.primary.label = label;
1470
- setTimeout(function () {
1471
- _this.primary.active = false;
1472
- }, this.alert_timeout);
1473
- };
1474
- ExpressionsFormComponent.prototype.setSecondary = function (label) {
1475
- var _this = this;
1476
- this.secondary.active = true;
1477
- this.secondary.label = label;
1478
- setTimeout(function () {
1479
- _this.secondary.active = false;
1480
- }, this.alert_timeout);
1481
- };
1482
- ExpressionsFormComponent.prototype.setAlertTimeout = function (timeout) {
1483
- this.alert_timeout = timeout;
1484
- };
1485
- return ExpressionsFormComponent;
1486
- }());
1487
- /** @nocollapse */ ExpressionsFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ExpressionsFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1488
- /** @nocollapse */ ExpressionsFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: { formFields: "formFields", disabled: "disabled", buttons: "buttons" }, outputs: { onSubmit: "onSubmit", onInit: "onInit" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" class=\"form\">\r\n <span *ngFor=\"let group of formFields\">\r\n <div class=\"row group-box\" [style]=\"group?.style\" *ngIf=\"validateExpressionsInRow(group?.groupFields)\">\r\n <span *ngIf=\"!isEmpty(group?.groupTitle)\" class=\"mt-1\">{{group?.groupTitle}}</span>\r\n <span *ngFor=\"let input of group?.groupFields\" class=\"form-group col-auto\" [hidden]=\"!activeMap.get(input.id)\">\r\n <!-- {{validateExpression(input.expression)}} -->\r\n <span *ngIf=\"activeMap.get(input.id)\">\r\n <label *ngIf=\"input.type!=='button' && input.type!=='reset' && input.type!=='submit'\" for=\"{{input.id}}\" class=\"mr-sm-2\">\r\n <div *ngIf=\"includeRequired(input.validators) || input.required===true\"\r\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> *{{input.label}}</div>\r\n <div *ngIf=\"!includeRequired(input.validators) && (input.required===false || input.required===undefined)\"\r\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</div>\r\n </label>\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'text'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm mb-2\"\r\n (change)=\"onChange($event.target.name)\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'number'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm mb-2\"\r\n (change)=\"onChange($event.target.name)\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'date'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control form-control-sm mb-2\"\r\n (change)=\"onChange($event.target.name)\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'password'\">\r\n <input type=\"{{input.type}}\"\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control mb-2\"\r\n (change)=\"onChange($event.target.name)\"\r\n [readonly]=\"input.readonly\"\r\n />\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'file'\">\r\n <div class=\"form-group\">\r\n <div class=\"input-group\">\r\n <div class=\"custom-file\">\r\n <input type=\"file\"\r\n class=\"form-control mb-2\"\r\n id=\"{{input.id}}\"\r\n accept=\"{{input.accept}}\"\r\n (change)=\"fileChange($event)\">\r\n <label class=\"custom-file-label\" for=\"{{input.id}}\">{{fileName}}</label>\r\n </div>\r\n <div class=\"input-group-append\">\r\n <span class=\"input-group-text\" (click)=\"onUploadClick(input.id)\"><i [className]=\"input.uploadIcon\" aria-hidden=\"true\"></i> {{input.uploadLabel}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'textarea'\">\r\n <textarea\r\n id=\"{{input.id}}\"\r\n name=\"{{input.id}}\"\r\n placeholder=\"{{input.label}}\"\r\n formControlName=\"{{input.id}}\"\r\n class=\"form-control mb-2 mr-sm-2\"\r\n (change)=\"onChange($event.target.name)\"\r\n [readonly]=\"input.readonly\"\r\n ></textarea>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div *ngSwitchCase=\"'combobox'\">\r\n <select name=\"{{input.id}}\"\r\n id=\"{{input.id}}\"\r\n formControlName={{input.id}}\r\n (change)=\"onChange($event.target.name)\"\r\n class=\"form-control form-control-sm mb-2\">\r\n <option [value]=\"\"></option>\r\n <option [value]=\"option.id\" *ngFor=\"let option of input.options\">\r\n <i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</option>\r\n </select>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div class=\"row\" *ngSwitchCase=\"'radio'\">\r\n <div class=\"col-auto\" [style.color]=\"input.color\" *ngFor=\"let option of input.options\">\r\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\r\n <input type=\"{{input.type}}\"\r\n name=\"{{input.id}}\"\r\n id=\"{{input.id}}\"\r\n formControlName={{input.id}}\r\n class=\"mb-2 form-check-input\"\r\n [value]=\"option.id\"\r\n [checked]=\"isRadioChecked(input.id,option.id)\"\r\n (change)=\"updateRadioValue(input.id,$event,option.id)\"\r\n />\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n <div class=\"row\" *ngSwitchCase=\"'checkbox'\">\r\n <div class=\"col-auto\" [style.color]=\"input.color\" formArrayName=\"{{input.id}}\" *ngFor=\"let option of input.options; let i=index;\">\r\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\r\n <input type=\"{{input.type}}\"\r\n name=\"{{option.id}}\"\r\n id=\"{{option.id}}\"\r\n [formControlName]=\"i\"\r\n [value]=\"input.options[i].id\"\r\n class=\"mb-2 form-check-input\"\r\n [checked]=\"isCheckBoxChecked(input.id,i)\"\r\n (change)=\"updateCheckboxValue(input.id,i,$event,input.options[i].id)\"\r\n />\r\n </div>\r\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\r\n </div>\r\n </div>\r\n </span>\r\n </span>\r\n </div>\r\n </span>\r\n <div class=\"row\">\r\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\r\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\r\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\r\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\r\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\r\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-4 ml-3 mr-3\">\r\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\r\n </div>\r\n <div class=\"d-flex justify-content-around\">\r\n <div *ngFor=\"let input of buttons\" [hidden]=\"!activeMap.get(input.id)\">\r\n <div [ngSwitch]=\"input.type\" *ngIf=\"activeMap.get(input.id)\">\r\n <div *ngSwitchCase=\"'button'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-secondary m-2\" (click)=\"onClick(input.action)\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'submit'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-primary m-2\" (click)=\"onClick(input.action)\" [disabled]=\"!form.valid\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'reset'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"resetForm()\">\r\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n", styles: [".alert{display:inline-block}.grow{flex-grow:1}textarea:focus,select:focus,input[type=text]:focus,input[type=password]:focus,input[type=datetime]:focus,input[type=datetime-local]:focus,input[type=date]:focus,input[type=month]:focus,input[type=time]:focus,input[type=week]:focus,input[type=number]:focus,input[type=email]:focus,input[type=url]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=color]:focus,input[type=checkbox]:focus,input[type=radio]:focus,button:focus,.uneditable-input:focus{border-color:green;box-shadow:0 1px 1px #00000013 inset,0 0 8px green;outline:0 none}.col-auto{flex-grow:1}.radio,.checkbox{width:15px;height:15px}.group-box{padding:4px}.btn-primary{background-color:green;border-color:green}.form-check-input:checked{background-color:green;border-color:green}\n"], components: [{ type: AlertComponent, selector: "df-alert", inputs: ["form", "input"] }], directives: [{ type: i2__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] });
1489
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ExpressionsFormComponent, decorators: [{
1490
- type: i0.Component,
1491
- args: [{
1492
- selector: 'df-expressions-form',
1493
- templateUrl: './expressions-form.component.html',
1494
- styleUrls: ['./expressions-form.component.scss']
1495
- }]
1496
- }], ctorParameters: function () { return []; }, propDecorators: { formFields: [{
1497
- type: i0.Input
1498
- }], disabled: [{
1499
- type: i0.Input
1500
- }], buttons: [{
1501
- type: i0.Input
1502
- }], onSubmit: [{
1503
- type: i0.Output
1504
- }], onInit: [{
1505
- type: i0.Output
1192
+ var ExpressionsFormComponent = /** @class */ (function () {
1193
+ function ExpressionsFormComponent() {
1194
+ this.form = new i2$1.FormGroup({});
1195
+ this.activeMap = new Map();
1196
+ this.fileList = null;
1197
+ this.fileName = "";
1198
+ this.onSubmit = new i0.EventEmitter();
1199
+ this.onInit = new i0.EventEmitter();
1200
+ this.alert_timeout = Constants.ALERT_TIMEOUT;
1201
+ this.danger = { active: false, label: '' };
1202
+ this.warning = { active: false, label: '' };
1203
+ this.success = { active: false, label: '' };
1204
+ this.info = { active: false, label: '' };
1205
+ this.primary = { active: false, label: '' };
1206
+ this.secondary = { active: false, label: '' };
1207
+ }
1208
+ ExpressionsFormComponent.prototype.onClick = function (action) {
1209
+ var data = {
1210
+ action: action,
1211
+ formValues: this.form.value
1212
+ };
1213
+ this.onSubmit.emit(data);
1214
+ };
1215
+ ExpressionsFormComponent.prototype.onInitialiazation = function () {
1216
+ this.onInit.emit(this.form);
1217
+ };
1218
+ ExpressionsFormComponent.prototype.onEnter = function () {
1219
+ this.onSubmit.emit(this.form.value);
1220
+ };
1221
+ ExpressionsFormComponent.prototype.onChange = function (changeFieldId) {
1222
+ var e_1, _a, e_2, _b, e_3, _c;
1223
+ try {
1224
+ for (var _d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
1225
+ var group = _e.value;
1226
+ try {
1227
+ for (var _f = (e_2 = void 0, __values(group === null || group === void 0 ? void 0 : group.groupFields)), _g = _f.next(); !_g.done; _g = _f.next()) {
1228
+ var input = _g.value;
1229
+ if (!ObjectUtility.isEmpty(input.expression)
1230
+ && !ObjectUtility.isEmpty(input.id)
1231
+ && input.expression.indexOf(changeFieldId) > -1
1232
+ && input.id.indexOf(changeFieldId) < 0) {
1233
+ var validationResult = this.validateExpression(input);
1234
+ this.activeMap.set(input.id, validationResult);
1235
+ if (!validationResult) {
1236
+ this.onChange(input.id);
1237
+ }
1238
+ }
1239
+ }
1240
+ }
1241
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1242
+ finally {
1243
+ try {
1244
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1245
+ }
1246
+ finally { if (e_2) throw e_2.error; }
1247
+ }
1248
+ }
1249
+ }
1250
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1251
+ finally {
1252
+ try {
1253
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1254
+ }
1255
+ finally { if (e_1) throw e_1.error; }
1256
+ }
1257
+ if (!ObjectUtility.isEmpty(this.buttons))
1258
+ try {
1259
+ for (var _h = __values(this.buttons), _j = _h.next(); !_j.done; _j = _h.next()) {
1260
+ var input = _j.value;
1261
+ if (!ObjectUtility.isEmpty(input.expression)
1262
+ && !ObjectUtility.isEmpty(input.id)
1263
+ && input.expression.indexOf(changeFieldId) > -1
1264
+ && input.id.indexOf(changeFieldId) < 0)
1265
+ this.activeMap.set(input.id, this.validateExpression(input));
1266
+ }
1267
+ }
1268
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1269
+ finally {
1270
+ try {
1271
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
1272
+ }
1273
+ finally { if (e_3) throw e_3.error; }
1274
+ }
1275
+ };
1276
+ ExpressionsFormComponent.prototype.ngOnInit = function () {
1277
+ this.buildFormGroup(this.formFields);
1278
+ this.onInitialiazation();
1279
+ };
1280
+ ExpressionsFormComponent.prototype.runExpressionValidations = function () {
1281
+ var e_4, _a, e_5, _b, e_6, _c;
1282
+ try {
1283
+ for (var _d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
1284
+ var group = _e.value;
1285
+ try {
1286
+ for (var _f = (e_5 = void 0, __values(group.groupFields)), _g = _f.next(); !_g.done; _g = _f.next()) {
1287
+ var input = _g.value;
1288
+ this.activeMap.set(input.id, this.validateExpression(input));
1289
+ }
1290
+ }
1291
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1292
+ finally {
1293
+ try {
1294
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1295
+ }
1296
+ finally { if (e_5) throw e_5.error; }
1297
+ }
1298
+ }
1299
+ }
1300
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1301
+ finally {
1302
+ try {
1303
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1304
+ }
1305
+ finally { if (e_4) throw e_4.error; }
1306
+ }
1307
+ if (!ObjectUtility.isEmpty(this.buttons))
1308
+ try {
1309
+ for (var _h = __values(this.buttons), _j = _h.next(); !_j.done; _j = _h.next()) {
1310
+ var input = _j.value;
1311
+ this.activeMap.set(input.id, this.validateExpression(input));
1312
+ }
1313
+ }
1314
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1315
+ finally {
1316
+ try {
1317
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
1318
+ }
1319
+ finally { if (e_6) throw e_6.error; }
1320
+ }
1321
+ };
1322
+ ExpressionsFormComponent.prototype.buildFormGroup = function (fields) {
1323
+ this.form = FormsUtility.buildFromGroup(fields, this.disabled);
1324
+ this.runExpressionValidations();
1325
+ };
1326
+ ExpressionsFormComponent.prototype.getForm = function () {
1327
+ return this.form;
1328
+ };
1329
+ ExpressionsFormComponent.prototype.setFormValue = function (value) {
1330
+ if (!ObjectUtility.isEmpty(this.form)) {
1331
+ this.form.reset(value);
1332
+ this.form.updateValueAndValidity();
1333
+ this.runExpressionValidations();
1334
+ }
1335
+ };
1336
+ ExpressionsFormComponent.prototype.getFormControls = function () {
1337
+ if (!ObjectUtility.isEmpty(this.form)) {
1338
+ return this.form.controls;
1339
+ }
1340
+ };
1341
+ ExpressionsFormComponent.prototype.getFormControl = function (controlName) {
1342
+ if (!ObjectUtility.isEmpty(this.form)
1343
+ && !ObjectUtility.isEmpty(this.form.controls)) {
1344
+ return this.form.controls[controlName];
1345
+ }
1346
+ };
1347
+ ExpressionsFormComponent.prototype.setFormControlValue = function (controlName, value) {
1348
+ if (!ObjectUtility.isEmpty(this.form)
1349
+ && !ObjectUtility.isEmpty(this.form.controls)
1350
+ && !ObjectUtility.isEmpty(this.form.controls)
1351
+ && !ObjectUtility.isEmpty(this.form.controls[controlName])) {
1352
+ this.form.controls[controlName].reset(value);
1353
+ this.form.controls[controlName].updateValueAndValidity();
1354
+ this.onChange(controlName);
1355
+ }
1356
+ };
1357
+ ExpressionsFormComponent.prototype.includeRequired = function (validators) {
1358
+ return FormsUtility.includeRequired(validators);
1359
+ };
1360
+ ExpressionsFormComponent.prototype.updateCheckboxValue = function (formArray, controlName, event, value) {
1361
+ FormsUtility.updateCheckboxValue(this.form, formArray, controlName, event.target.checked, value);
1362
+ this.onChange(event.target.name);
1363
+ };
1364
+ ExpressionsFormComponent.prototype.updateRadioValue = function (controlName, event, optionId) {
1365
+ FormsUtility.updateRadioValue(this.form, controlName, event.target.checked, optionId);
1366
+ this.onChange(event.target.name);
1367
+ };
1368
+ ExpressionsFormComponent.prototype.isCheckBoxChecked = function (controlName, optionId) {
1369
+ return FormsUtility.isCheckBoxChecked(this.form, controlName, optionId);
1370
+ };
1371
+ ExpressionsFormComponent.prototype.isRadioChecked = function (controlName, optionId) {
1372
+ return FormsUtility.isRadioChecked(this.form, controlName, optionId);
1373
+ };
1374
+ ExpressionsFormComponent.prototype.validateExpression = function (input) {
1375
+ var result = ExpressionsUtility.evaluateExpression(input.expression, this.form, 1);
1376
+ if (!result
1377
+ && !ObjectUtility.isEmpty(this.form)
1378
+ && !ObjectUtility.isEmpty(this.form.controls)
1379
+ && !ObjectUtility.isEmpty(this.form.controls[input.id])) {
1380
+ this.form.controls[input.id].reset();
1381
+ this.form.controls[input.id].updateValueAndValidity();
1382
+ }
1383
+ FormsUtility.setValidators(input, this.form, result);
1384
+ return result;
1385
+ };
1386
+ ExpressionsFormComponent.prototype.validateExpressionsInRow = function (row) {
1387
+ var e_7, _a;
1388
+ try {
1389
+ for (var row_1 = __values(row), row_1_1 = row_1.next(); !row_1_1.done; row_1_1 = row_1.next()) {
1390
+ var input = row_1_1.value;
1391
+ if (this.activeMap.get(input.id))
1392
+ return true;
1393
+ }
1394
+ }
1395
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1396
+ finally {
1397
+ try {
1398
+ if (row_1_1 && !row_1_1.done && (_a = row_1.return)) _a.call(row_1);
1399
+ }
1400
+ finally { if (e_7) throw e_7.error; }
1401
+ }
1402
+ return false;
1403
+ };
1404
+ ExpressionsFormComponent.prototype.resetForm = function () {
1405
+ this.form = FormsUtility.resetForm(this.formFields, this.form);
1406
+ this.runExpressionValidations();
1407
+ };
1408
+ ExpressionsFormComponent.prototype.getDisabled = function () {
1409
+ return this.disabled;
1410
+ };
1411
+ ExpressionsFormComponent.prototype.setDisabled = function (disabled) {
1412
+ this.disabled = disabled;
1413
+ this.form = FormsUtility.buildFromGroup(this.formFields, this.disabled);
1414
+ };
1415
+ ExpressionsFormComponent.prototype.fileChange = function (event) {
1416
+ this.fileList = event.target.files;
1417
+ //console.log("fileList>",this.fileList);
1418
+ if (!ObjectUtility.isEmpty(this.fileList) && event.target.files.length > 0)
1419
+ this.fileName = this.fileList[0].name;
1420
+ else
1421
+ this.fileName = "";
1422
+ };
1423
+ ExpressionsFormComponent.prototype.onUploadClick = function (id) {
1424
+ var data = {
1425
+ action: 'uploadFile',
1426
+ fileList: this.fileList,
1427
+ fieldId: id
1428
+ };
1429
+ this.onSubmit.emit(data);
1430
+ };
1431
+ ExpressionsFormComponent.prototype.isEmpty = function (value) {
1432
+ return ObjectUtility.isEmpty(value);
1433
+ };
1434
+ ExpressionsFormComponent.prototype.setDanger = function (label) {
1435
+ var _this = this;
1436
+ this.danger.active = true;
1437
+ this.danger.label = label;
1438
+ setTimeout(function () {
1439
+ _this.danger.active = false;
1440
+ }, this.alert_timeout);
1441
+ };
1442
+ ExpressionsFormComponent.prototype.setWarning = function (label) {
1443
+ var _this = this;
1444
+ this.warning.active = true;
1445
+ this.warning.label = label;
1446
+ setTimeout(function () {
1447
+ _this.warning.active = false;
1448
+ }, this.alert_timeout);
1449
+ };
1450
+ ExpressionsFormComponent.prototype.setSuccess = function (label) {
1451
+ var _this = this;
1452
+ this.success.active = true;
1453
+ this.success.label = label;
1454
+ setTimeout(function () {
1455
+ _this.success.active = false;
1456
+ }, this.alert_timeout);
1457
+ };
1458
+ ExpressionsFormComponent.prototype.setInfo = function (label) {
1459
+ var _this = this;
1460
+ this.info.active = true;
1461
+ this.info.label = label;
1462
+ setTimeout(function () {
1463
+ _this.info.active = false;
1464
+ }, this.alert_timeout);
1465
+ };
1466
+ ExpressionsFormComponent.prototype.setPrimary = function (label) {
1467
+ var _this = this;
1468
+ this.primary.active = true;
1469
+ this.primary.label = label;
1470
+ setTimeout(function () {
1471
+ _this.primary.active = false;
1472
+ }, this.alert_timeout);
1473
+ };
1474
+ ExpressionsFormComponent.prototype.setSecondary = function (label) {
1475
+ var _this = this;
1476
+ this.secondary.active = true;
1477
+ this.secondary.label = label;
1478
+ setTimeout(function () {
1479
+ _this.secondary.active = false;
1480
+ }, this.alert_timeout);
1481
+ };
1482
+ ExpressionsFormComponent.prototype.setAlertTimeout = function (timeout) {
1483
+ this.alert_timeout = timeout;
1484
+ };
1485
+ return ExpressionsFormComponent;
1486
+ }());
1487
+ /** @nocollapse */ ExpressionsFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ExpressionsFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1488
+ /** @nocollapse */ ExpressionsFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: { formFields: "formFields", disabled: "disabled", buttons: "buttons" }, outputs: { onSubmit: "onSubmit", onInit: "onInit" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" class=\"form\">\n <span *ngFor=\"let group of formFields\">\n <div class=\"row group-box\" [style]=\"group?.style\" *ngIf=\"validateExpressionsInRow(group?.groupFields)\">\n <span *ngIf=\"!isEmpty(group?.groupTitle)\" class=\"mt-1\">{{group?.groupTitle}}</span>\n <span *ngFor=\"let input of group?.groupFields\" class=\"form-group col-auto\" [hidden]=\"!activeMap.get(input.id)\">\n <!-- {{validateExpression(input.expression)}} -->\n <span *ngIf=\"activeMap.get(input.id)\">\n <label *ngIf=\"input.type!=='button' && input.type!=='reset' && input.type!=='submit'\" for=\"{{input.id}}\" class=\"mr-sm-2\">\n <div *ngIf=\"includeRequired(input.validators) || input.required===true\"\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> *{{input.label}}</div>\n <div *ngIf=\"!includeRequired(input.validators) && (input.required===false || input.required===undefined)\"\n [style.color]=\"input.color\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</div>\n </label>\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'text'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm mb-2\"\n (change)=\"onChange($event.target.name)\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'number'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm mb-2\"\n (change)=\"onChange($event.target.name)\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'date'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control form-control-sm mb-2\"\n (change)=\"onChange($event.target.name)\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'password'\">\n <input type=\"{{input.type}}\"\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control mb-2\"\n (change)=\"onChange($event.target.name)\"\n [readonly]=\"input.readonly\"\n />\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'file'\">\n <div class=\"form-group\">\n <div class=\"input-group\">\n <div class=\"custom-file\">\n <input type=\"file\"\n class=\"form-control mb-2\"\n id=\"{{input.id}}\"\n accept=\"{{input.accept}}\"\n (change)=\"fileChange($event)\">\n <label class=\"custom-file-label\" for=\"{{input.id}}\">{{fileName}}</label>\n </div>\n <div class=\"input-group-append\">\n <span class=\"input-group-text\" (click)=\"onUploadClick(input.id)\"><i [className]=\"input.uploadIcon\" aria-hidden=\"true\"></i> {{input.uploadLabel}}</span>\n </div>\n </div>\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'textarea'\">\n <textarea\n id=\"{{input.id}}\"\n name=\"{{input.id}}\"\n placeholder=\"{{input.label}}\"\n formControlName=\"{{input.id}}\"\n class=\"form-control mb-2 mr-sm-2\"\n (change)=\"onChange($event.target.name)\"\n [readonly]=\"input.readonly\"\n ></textarea>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div *ngSwitchCase=\"'combobox'\">\n <select name=\"{{input.id}}\"\n id=\"{{input.id}}\"\n formControlName={{input.id}}\n (change)=\"onChange($event.target.name)\"\n class=\"form-control form-control-sm mb-2\">\n <option [value]=\"\"></option>\n <option [value]=\"option.id\" *ngFor=\"let option of input.options\">\n <i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</option>\n </select>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div class=\"row\" *ngSwitchCase=\"'radio'\">\n <div class=\"col-auto\" [style.color]=\"input.color\" *ngFor=\"let option of input.options\">\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\n <input type=\"{{input.type}}\"\n name=\"{{input.id}}\"\n id=\"{{input.id}}\"\n formControlName={{input.id}}\n class=\"mb-2 form-check-input\"\n [value]=\"option.id\"\n [checked]=\"isRadioChecked(input.id,option.id)\"\n (change)=\"updateRadioValue(input.id,$event,option.id)\"\n />\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n <div class=\"row\" *ngSwitchCase=\"'checkbox'\">\n <div class=\"col-auto\" [style.color]=\"input.color\" formArrayName=\"{{input.id}}\" *ngFor=\"let option of input.options; let i=index;\">\n <div><i [className]=\"option.icon\" aria-hidden=\"true\"></i> {{option.label}}</div>\n <input type=\"{{input.type}}\"\n name=\"{{option.id}}\"\n id=\"{{option.id}}\"\n [formControlName]=\"i\"\n [value]=\"input.options[i].id\"\n class=\"mb-2 form-check-input\"\n [checked]=\"isCheckBoxChecked(input.id,i)\"\n (change)=\"updateCheckboxValue(input.id,i,$event,input.options[i].id)\"\n />\n </div>\n <df-alert [input]=\"input\" [form]=\"form\"></df-alert>\n </div>\n </div>\n </span>\n </span>\n </div>\n </span>\n <div class=\"row\">\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-4 ml-3 mr-3\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-4 ml-3 mr-3\">\n <i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-4 ml-3 mr-3\">\n <i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-4 ml-3 mr-3\">\n <i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\n </div>\n <div class=\"d-flex justify-content-around\">\n <div *ngFor=\"let input of buttons\" [hidden]=\"!activeMap.get(input.id)\">\n <div [ngSwitch]=\"input.type\" *ngIf=\"activeMap.get(input.id)\">\n <div *ngSwitchCase=\"'button'\">\n <button type=\"{{input.type}}\" class=\"btn btn-secondary m-2\" (click)=\"onClick(input.action)\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'submit'\">\n <button type=\"{{input.type}}\" class=\"btn btn-primary m-2\" (click)=\"onClick(input.action)\" [disabled]=\"!form.valid\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'reset'\">\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"resetForm()\">\n <i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n </div>\n </div>\n </div>\n </form>\n", styles: [".alert{display:inline-block}.grow{flex-grow:1}.col-auto{flex-grow:1}.group-box{padding:4px}\n"], components: [{ type: AlertComponent, selector: "df-alert", inputs: ["form", "input"] }], directives: [{ type: i2__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i2__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] });
1489
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ExpressionsFormComponent, decorators: [{
1490
+ type: i0.Component,
1491
+ args: [{
1492
+ selector: 'df-expressions-form',
1493
+ templateUrl: './expressions-form.component.html',
1494
+ styleUrls: ['./expressions-form.component.scss']
1495
+ }]
1496
+ }], ctorParameters: function () { return []; }, propDecorators: { formFields: [{
1497
+ type: i0.Input
1498
+ }], disabled: [{
1499
+ type: i0.Input
1500
+ }], buttons: [{
1501
+ type: i0.Input
1502
+ }], onSubmit: [{
1503
+ type: i0.Output
1504
+ }], onInit: [{
1505
+ type: i0.Output
1506
1506
  }] } });
1507
1507
 
1508
- var AccordionFormComponent = /** @class */ (function () {
1509
- function AccordionFormComponent() {
1510
- this.currentSection = 0;
1511
- this.initIndex = 0;
1512
- this.forms = [];
1513
- this.onSubmit = new i0.EventEmitter();
1514
- this.alert_timeout = Constants.ALERT_TIMEOUT;
1515
- this.danger = { active: false, label: '' };
1516
- this.warning = { active: false, label: '' };
1517
- this.success = { active: false, label: '' };
1518
- this.info = { active: false, label: '' };
1519
- this.primary = { active: false, label: '' };
1520
- this.secondary = { active: false, label: '' };
1521
- }
1522
- AccordionFormComponent.prototype.ngOnInit = function () {
1523
- };
1524
- AccordionFormComponent.prototype.onClick = function (action) {
1525
- var e_1, _a;
1526
- var formValues = [];
1527
- try {
1528
- for (var _b = __values(this.forms), _c = _b.next(); !_c.done; _c = _b.next()) {
1529
- var myform = _c.value;
1530
- formValues.push(myform.value);
1531
- }
1532
- }
1533
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1534
- finally {
1535
- try {
1536
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1537
- }
1538
- finally { if (e_1) throw e_1.error; }
1539
- }
1540
- var result = { action: action, formValues: formValues };
1541
- this.onSubmit.emit(result);
1542
- };
1543
- AccordionFormComponent.prototype.onSectionButtonClicked = function (event, index, sectionLabel) {
1544
- event['index'] = index;
1545
- event['sectionLabel'] = sectionLabel;
1546
- this.onSubmit.emit(event);
1547
- };
1548
- AccordionFormComponent.prototype.resetForms = function () {
1549
- var e_2, _a, e_3, _b, e_4, _c;
1550
- try {
1551
- for (var _d = __values(this.sections.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
1552
- var _f = __read(_e.value, 2), index = _f[0], section = _f[1];
1553
- try {
1554
- for (var _g = (e_3 = void 0, __values(section.sectionFields)), _h = _g.next(); !_h.done; _h = _g.next()) {
1555
- var rows = _h.value;
1556
- try {
1557
- for (var rows_1 = (e_4 = void 0, __values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
1558
- var input = rows_1_1.value;
1559
- if (!ObjectUtility.isEmpty(input.id)
1560
- && !input.readonly
1561
- && !input.disabled) {
1562
- var form = this.forms[index].form;
1563
- var control = form.controls[input.id];
1564
- control.reset();
1565
- }
1566
- }
1567
- }
1568
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1569
- finally {
1570
- try {
1571
- if (rows_1_1 && !rows_1_1.done && (_c = rows_1.return)) _c.call(rows_1);
1572
- }
1573
- finally { if (e_4) throw e_4.error; }
1574
- }
1575
- }
1576
- }
1577
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1578
- finally {
1579
- try {
1580
- if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
1581
- }
1582
- finally { if (e_3) throw e_3.error; }
1583
- }
1584
- }
1585
- }
1586
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1587
- finally {
1588
- try {
1589
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1590
- }
1591
- finally { if (e_2) throw e_2.error; }
1592
- }
1593
- };
1594
- AccordionFormComponent.prototype.onStart = function (event) {
1595
- if (this.sections.length == this.forms.length) {
1596
- this.forms[this.initIndex] = event;
1597
- if (this.initIndex == (this.forms.length - 1))
1598
- this.initIndex = 0;
1599
- else
1600
- this.initIndex++;
1601
- }
1602
- else
1603
- this.forms.push(event);
1604
- };
1605
- AccordionFormComponent.prototype.getCurrentSection = function () {
1606
- return this.currentSection;
1607
- };
1608
- AccordionFormComponent.prototype.setCurrentSection = function (sectionNumber) {
1609
- this.currentSection = sectionNumber;
1610
- };
1611
- AccordionFormComponent.prototype.allFormsAreValid = function () {
1612
- if (!this.forms[this.currentSection].valid)
1613
- return false;
1614
- for (var i = 0; i < this.forms.length; i++) {
1615
- if (i != this.currentSection && !this.forms[i].valid)
1616
- return false;
1617
- }
1618
- return true;
1619
- };
1620
- AccordionFormComponent.prototype.getHeadingId = function (i) {
1621
- return this.accordionId + '-heading-' + i;
1622
- };
1623
- AccordionFormComponent.prototype.getCollapseId = function (i) {
1624
- return this.accordionId + '-collapse-' + i;
1625
- };
1626
- AccordionFormComponent.prototype.isEmpty = function (value) {
1627
- return ObjectUtility.isEmpty(value);
1628
- };
1629
- AccordionFormComponent.prototype.setDanger = function (label) {
1630
- var _this = this;
1631
- this.danger.active = true;
1632
- this.danger.label = label;
1633
- setTimeout(function () {
1634
- _this.danger.active = false;
1635
- }, this.alert_timeout);
1636
- };
1637
- AccordionFormComponent.prototype.setWarning = function (label) {
1638
- var _this = this;
1639
- this.warning.active = true;
1640
- this.warning.label = label;
1641
- setTimeout(function () {
1642
- _this.warning.active = false;
1643
- }, this.alert_timeout);
1644
- };
1645
- AccordionFormComponent.prototype.setSuccess = function (label) {
1646
- var _this = this;
1647
- this.success.active = true;
1648
- this.success.label = label;
1649
- setTimeout(function () {
1650
- _this.success.active = false;
1651
- }, this.alert_timeout);
1652
- };
1653
- AccordionFormComponent.prototype.setInfo = function (label) {
1654
- var _this = this;
1655
- this.info.active = true;
1656
- this.info.label = label;
1657
- setTimeout(function () {
1658
- _this.info.active = false;
1659
- }, this.alert_timeout);
1660
- };
1661
- AccordionFormComponent.prototype.setPrimary = function (label) {
1662
- var _this = this;
1663
- this.primary.active = true;
1664
- this.primary.label = label;
1665
- setTimeout(function () {
1666
- _this.primary.active = false;
1667
- }, this.alert_timeout);
1668
- };
1669
- AccordionFormComponent.prototype.setSecondary = function (label) {
1670
- var _this = this;
1671
- this.secondary.active = true;
1672
- this.secondary.label = label;
1673
- setTimeout(function () {
1674
- _this.secondary.active = false;
1675
- }, this.alert_timeout);
1676
- };
1677
- AccordionFormComponent.prototype.setAlertTimeout = function (timeout) {
1678
- this.alert_timeout = timeout;
1679
- };
1680
- return AccordionFormComponent;
1681
- }());
1682
- /** @nocollapse */ AccordionFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AccordionFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1683
- /** @nocollapse */ AccordionFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AccordionFormComponent, selector: "df-accordion-form", inputs: { sections: "sections", accordionId: "accordionId", buttons: "buttons" }, outputs: { onSubmit: "onSubmit" }, ngImport: i0__namespace, template: "<div id=\"{{accordionId}}\" *ngIf=\"!isEmpty(accordionId)\">\r\n <div *ngFor=\"let section of sections; let i=index\">\r\n <div class=\"accordion-item\">\r\n <h2 class=\"accordion-header\" id=\"{{getHeadingId(i)}}\">\r\n <button class=\"accordion-button\"\r\n [class.collapsed]=\"i!=0\"\r\n type=\"button\"\r\n data-bs-toggle=\"collapse\"\r\n (click)=\"setCurrentSection(i)\"\r\n [attr.data-bs-target]=\"'#'+accordionId+'-collapse-'+i\"\r\n aria-expanded=\"(i==0)?true:false\"\r\n aria-controls=\"accordionId+'-collapse-'+i\">\r\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}\r\n </button>\r\n </h2>\r\n <div id=\"{{getCollapseId(i)}}\"\r\n class=\"accordion-collapse collapse\"\r\n [class.show]=\"i==0\"\r\n aria-labelledby=\"accordionId+'-heading-'+i\"\r\n [attr.data-bs-parent]=\"'#'+accordionId\">\r\n <div class=\"card-body\">\r\n <df-expressions-form\r\n (onInit)=\"onStart($event)\"\r\n (onSubmit)=\"onSectionButtonClicked($event,i,section.label)\"\r\n [formFields]=\"section.sectionFields\"\r\n [buttons]=\"section.sectionButtons\"></df-expressions-form>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"card\">\r\n <div class=\"card-header\" id=\"buttons\">\r\n <div class=\"row\">\r\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-2\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\r\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\r\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-2\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\r\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-2\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\r\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\r\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\r\n </div>\r\n <h5 class=\"mb-0 d-flex justify-content-around\" [hidden]=\"isEmpty(buttons)\">\r\n <div *ngFor=\"let input of buttons\">\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'button'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ml-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'submit'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-primary ml-2\" (click)=\"onClick(input.action)\" [disabled]=\"!allFormsAreValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'reset'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary ml-2\" (click)=\"resetForms()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </h5>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"isEmpty(accordionId)\">\r\n <div class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> Error:accordionId is required, please provide a value.</div>\r\n </div>\r\n", styles: [".grow{flex-grow:1}.btn-primary{background-color:green;border-color:green}.accordion-button:not(.collapsed){color:green;background-color:#e8f7e7;box-shadow:inset 0 -1px #00000021}.accordion-button:focus{box-shadow:0 1px 1px #00000013 inset,0 0 8px green}.accordion-button:not(.collapsed):after{color:green;background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23YOUR_HEX_CODE'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\")}button:focus{border-color:green;box-shadow:0 1px 1px #00000013 inset,0 0 8px green;outline:0 none}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
1684
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AccordionFormComponent, decorators: [{
1685
- type: i0.Component,
1686
- args: [{
1687
- selector: 'df-accordion-form',
1688
- templateUrl: './accordion-form.component.html',
1689
- styleUrls: ['./accordion-form.component.scss']
1690
- }]
1691
- }], ctorParameters: function () { return []; }, propDecorators: { sections: [{
1692
- type: i0.Input
1693
- }], accordionId: [{
1694
- type: i0.Input
1695
- }], buttons: [{
1696
- type: i0.Input
1697
- }], onSubmit: [{
1698
- type: i0.Output
1508
+ var AccordionFormComponent = /** @class */ (function () {
1509
+ function AccordionFormComponent() {
1510
+ this.currentSection = 0;
1511
+ this.initIndex = 0;
1512
+ this.forms = [];
1513
+ this.onSubmit = new i0.EventEmitter();
1514
+ this.alert_timeout = Constants.ALERT_TIMEOUT;
1515
+ this.danger = { active: false, label: '' };
1516
+ this.warning = { active: false, label: '' };
1517
+ this.success = { active: false, label: '' };
1518
+ this.info = { active: false, label: '' };
1519
+ this.primary = { active: false, label: '' };
1520
+ this.secondary = { active: false, label: '' };
1521
+ }
1522
+ AccordionFormComponent.prototype.ngOnInit = function () {
1523
+ };
1524
+ AccordionFormComponent.prototype.onClick = function (action) {
1525
+ var e_1, _a;
1526
+ var formValues = [];
1527
+ try {
1528
+ for (var _b = __values(this.forms), _c = _b.next(); !_c.done; _c = _b.next()) {
1529
+ var myform = _c.value;
1530
+ formValues.push(myform.value);
1531
+ }
1532
+ }
1533
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1534
+ finally {
1535
+ try {
1536
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1537
+ }
1538
+ finally { if (e_1) throw e_1.error; }
1539
+ }
1540
+ var result = { action: action, formValues: formValues };
1541
+ this.onSubmit.emit(result);
1542
+ };
1543
+ AccordionFormComponent.prototype.onSectionButtonClicked = function (event, index, sectionLabel) {
1544
+ event['index'] = index;
1545
+ event['sectionLabel'] = sectionLabel;
1546
+ this.onSubmit.emit(event);
1547
+ };
1548
+ AccordionFormComponent.prototype.resetForms = function () {
1549
+ var e_2, _a, e_3, _b, e_4, _c;
1550
+ try {
1551
+ for (var _d = __values(this.sections.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
1552
+ var _f = __read(_e.value, 2), index = _f[0], section = _f[1];
1553
+ try {
1554
+ for (var _g = (e_3 = void 0, __values(section.sectionFields)), _h = _g.next(); !_h.done; _h = _g.next()) {
1555
+ var rows = _h.value;
1556
+ try {
1557
+ for (var rows_1 = (e_4 = void 0, __values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
1558
+ var input = rows_1_1.value;
1559
+ if (!ObjectUtility.isEmpty(input.id)
1560
+ && !input.readonly
1561
+ && !input.disabled) {
1562
+ var form = this.forms[index].form;
1563
+ var control = form.controls[input.id];
1564
+ control.reset();
1565
+ }
1566
+ }
1567
+ }
1568
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1569
+ finally {
1570
+ try {
1571
+ if (rows_1_1 && !rows_1_1.done && (_c = rows_1.return)) _c.call(rows_1);
1572
+ }
1573
+ finally { if (e_4) throw e_4.error; }
1574
+ }
1575
+ }
1576
+ }
1577
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1578
+ finally {
1579
+ try {
1580
+ if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
1581
+ }
1582
+ finally { if (e_3) throw e_3.error; }
1583
+ }
1584
+ }
1585
+ }
1586
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1587
+ finally {
1588
+ try {
1589
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1590
+ }
1591
+ finally { if (e_2) throw e_2.error; }
1592
+ }
1593
+ };
1594
+ AccordionFormComponent.prototype.onStart = function (event) {
1595
+ if (this.sections.length == this.forms.length) {
1596
+ this.forms[this.initIndex] = event;
1597
+ if (this.initIndex == (this.forms.length - 1))
1598
+ this.initIndex = 0;
1599
+ else
1600
+ this.initIndex++;
1601
+ }
1602
+ else
1603
+ this.forms.push(event);
1604
+ };
1605
+ AccordionFormComponent.prototype.getCurrentSection = function () {
1606
+ return this.currentSection;
1607
+ };
1608
+ AccordionFormComponent.prototype.setCurrentSection = function (sectionNumber) {
1609
+ this.currentSection = sectionNumber;
1610
+ };
1611
+ AccordionFormComponent.prototype.allFormsAreValid = function () {
1612
+ if (!this.forms[this.currentSection].valid)
1613
+ return false;
1614
+ for (var i = 0; i < this.forms.length; i++) {
1615
+ if (i != this.currentSection && !this.forms[i].valid)
1616
+ return false;
1617
+ }
1618
+ return true;
1619
+ };
1620
+ AccordionFormComponent.prototype.getHeadingId = function (i) {
1621
+ return this.accordionId + '-heading-' + i;
1622
+ };
1623
+ AccordionFormComponent.prototype.getCollapseId = function (i) {
1624
+ return this.accordionId + '-collapse-' + i;
1625
+ };
1626
+ AccordionFormComponent.prototype.isEmpty = function (value) {
1627
+ return ObjectUtility.isEmpty(value);
1628
+ };
1629
+ AccordionFormComponent.prototype.setDanger = function (label) {
1630
+ var _this = this;
1631
+ this.danger.active = true;
1632
+ this.danger.label = label;
1633
+ setTimeout(function () {
1634
+ _this.danger.active = false;
1635
+ }, this.alert_timeout);
1636
+ };
1637
+ AccordionFormComponent.prototype.setWarning = function (label) {
1638
+ var _this = this;
1639
+ this.warning.active = true;
1640
+ this.warning.label = label;
1641
+ setTimeout(function () {
1642
+ _this.warning.active = false;
1643
+ }, this.alert_timeout);
1644
+ };
1645
+ AccordionFormComponent.prototype.setSuccess = function (label) {
1646
+ var _this = this;
1647
+ this.success.active = true;
1648
+ this.success.label = label;
1649
+ setTimeout(function () {
1650
+ _this.success.active = false;
1651
+ }, this.alert_timeout);
1652
+ };
1653
+ AccordionFormComponent.prototype.setInfo = function (label) {
1654
+ var _this = this;
1655
+ this.info.active = true;
1656
+ this.info.label = label;
1657
+ setTimeout(function () {
1658
+ _this.info.active = false;
1659
+ }, this.alert_timeout);
1660
+ };
1661
+ AccordionFormComponent.prototype.setPrimary = function (label) {
1662
+ var _this = this;
1663
+ this.primary.active = true;
1664
+ this.primary.label = label;
1665
+ setTimeout(function () {
1666
+ _this.primary.active = false;
1667
+ }, this.alert_timeout);
1668
+ };
1669
+ AccordionFormComponent.prototype.setSecondary = function (label) {
1670
+ var _this = this;
1671
+ this.secondary.active = true;
1672
+ this.secondary.label = label;
1673
+ setTimeout(function () {
1674
+ _this.secondary.active = false;
1675
+ }, this.alert_timeout);
1676
+ };
1677
+ AccordionFormComponent.prototype.setAlertTimeout = function (timeout) {
1678
+ this.alert_timeout = timeout;
1679
+ };
1680
+ return AccordionFormComponent;
1681
+ }());
1682
+ /** @nocollapse */ AccordionFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AccordionFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1683
+ /** @nocollapse */ AccordionFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AccordionFormComponent, selector: "df-accordion-form", inputs: { sections: "sections", accordionId: "accordionId", buttons: "buttons" }, outputs: { onSubmit: "onSubmit" }, ngImport: i0__namespace, template: "<div id=\"{{accordionId}}\" *ngIf=\"!isEmpty(accordionId)\">\n <div *ngFor=\"let section of sections; let i=index\">\n <div class=\"accordion-item\">\n <h2 class=\"accordion-header\" id=\"{{getHeadingId(i)}}\">\n <button class=\"accordion-button\"\n [class.collapsed]=\"i!=0\"\n type=\"button\"\n data-bs-toggle=\"collapse\"\n (click)=\"setCurrentSection(i)\"\n [attr.data-bs-target]=\"'#'+accordionId+'-collapse-'+i\"\n aria-expanded=\"(i==0)?true:false\"\n aria-controls=\"accordionId+'-collapse-'+i\">\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}\n </button>\n </h2>\n <div id=\"{{getCollapseId(i)}}\"\n class=\"accordion-collapse collapse\"\n [class.show]=\"i==0\"\n aria-labelledby=\"accordionId+'-heading-'+i\"\n [attr.data-bs-parent]=\"'#'+accordionId\">\n <div class=\"card-body\">\n <df-expressions-form\n (onInit)=\"onStart($event)\"\n (onSubmit)=\"onSectionButtonClicked($event,i,section.label)\"\n [formFields]=\"section.sectionFields\"\n [buttons]=\"section.sectionButtons\"></df-expressions-form>\n </div>\n </div>\n </div>\n </div>\n <div class=\"card\">\n <div class=\"card-header\" id=\"buttons\">\n <div class=\"row\">\n <div *ngIf=\"success.active\" class=\"grow alert alert-success mb-2\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning mb-2\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\n <div *ngIf=\"info.active\" class=\"grow alert alert-info mb-2\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary mb-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary mb-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\n </div>\n <h5 class=\"mb-0 d-flex justify-content-around\" [hidden]=\"isEmpty(buttons)\">\n <div *ngFor=\"let input of buttons\">\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'button'\">\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ml-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'submit'\">\n <button type=\"{{input.type}}\" class=\"btn btn-primary ml-2\" (click)=\"onClick(input.action)\" [disabled]=\"!allFormsAreValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'reset'\">\n <button type=\"'button'\" class=\"btn btn-secondary ml-2\" (click)=\"resetForms()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n </div>\n </div>\n </h5>\n </div>\n </div>\n </div>\n <div *ngIf=\"isEmpty(accordionId)\">\n <div class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> Error:accordionId is required, please provide a value.</div>\n </div>\n", styles: [".grow{flex-grow:1}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
1684
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AccordionFormComponent, decorators: [{
1685
+ type: i0.Component,
1686
+ args: [{
1687
+ selector: 'df-accordion-form',
1688
+ templateUrl: './accordion-form.component.html',
1689
+ styleUrls: ['./accordion-form.component.scss']
1690
+ }]
1691
+ }], ctorParameters: function () { return []; }, propDecorators: { sections: [{
1692
+ type: i0.Input
1693
+ }], accordionId: [{
1694
+ type: i0.Input
1695
+ }], buttons: [{
1696
+ type: i0.Input
1697
+ }], onSubmit: [{
1698
+ type: i0.Output
1699
1699
  }] } });
1700
1700
 
1701
- var ModalFormComponent = /** @class */ (function () {
1702
- function ModalFormComponent() {
1703
- this.onSubmit = new i0.EventEmitter();
1704
- this.alert_timeout = Constants.ALERT_TIMEOUT;
1705
- this.danger = { active: false, label: '' };
1706
- this.warning = { active: false, label: '' };
1707
- this.success = { active: false, label: '' };
1708
- this.info = { active: false, label: '' };
1709
- this.primary = { active: false, label: '' };
1710
- this.secondary = { active: false, label: '' };
1711
- }
1712
- ModalFormComponent.prototype.ngOnInit = function () {
1713
- };
1714
- ModalFormComponent.prototype.onStart = function (event) {
1715
- this.form = event;
1716
- };
1717
- ModalFormComponent.prototype.getForm = function () {
1718
- if (!ObjectUtility.isEmpty(this.form))
1719
- return this.form;
1720
- };
1721
- ModalFormComponent.prototype.getFormControls = function () {
1722
- if (!ObjectUtility.isEmpty(this.form))
1723
- return this.form.controls;
1724
- };
1725
- ModalFormComponent.prototype.onClick = function (action) {
1726
- var data = {
1727
- action: action,
1728
- formValues: this.form.value
1729
- };
1730
- this.onSubmit.emit(data);
1731
- };
1732
- ModalFormComponent.prototype.isFormValid = function () {
1733
- return this.form.valid;
1734
- };
1735
- ModalFormComponent.prototype.resetForm = function () {
1736
- var e_1, _a, e_2, _b;
1737
- try {
1738
- for (var _c = __values(this.modal.fields), _d = _c.next(); !_d.done; _d = _c.next()) {
1739
- var row = _d.value;
1740
- try {
1741
- for (var row_1 = (e_2 = void 0, __values(row)), row_1_1 = row_1.next(); !row_1_1.done; row_1_1 = row_1.next()) {
1742
- var input = row_1_1.value;
1743
- if (!input.disabled
1744
- && !input.readonly) {
1745
- this.form.controls[input.id].reset();
1746
- }
1747
- }
1748
- }
1749
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1750
- finally {
1751
- try {
1752
- if (row_1_1 && !row_1_1.done && (_b = row_1.return)) _b.call(row_1);
1753
- }
1754
- finally { if (e_2) throw e_2.error; }
1755
- }
1756
- }
1757
- }
1758
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1759
- finally {
1760
- try {
1761
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1762
- }
1763
- finally { if (e_1) throw e_1.error; }
1764
- }
1765
- };
1766
- ModalFormComponent.prototype.closeModal = function () {
1767
- this.closeModalElement.nativeElement.click();
1768
- };
1769
- ModalFormComponent.prototype.setDanger = function (label) {
1770
- var _this = this;
1771
- this.danger.active = true;
1772
- this.danger.label = label;
1773
- setTimeout(function () {
1774
- _this.danger.active = false;
1775
- }, this.alert_timeout);
1776
- };
1777
- ModalFormComponent.prototype.setWarning = function (label) {
1778
- var _this = this;
1779
- this.warning.active = true;
1780
- this.warning.label = label;
1781
- setTimeout(function () {
1782
- _this.warning.active = false;
1783
- }, this.alert_timeout);
1784
- };
1785
- ModalFormComponent.prototype.setSuccess = function (label) {
1786
- var _this = this;
1787
- this.success.active = true;
1788
- this.success.label = label;
1789
- setTimeout(function () {
1790
- _this.success.active = false;
1791
- }, this.alert_timeout);
1792
- };
1793
- ModalFormComponent.prototype.setInfo = function (label) {
1794
- var _this = this;
1795
- this.info.active = true;
1796
- this.info.label = label;
1797
- setTimeout(function () {
1798
- _this.info.active = false;
1799
- }, this.alert_timeout);
1800
- };
1801
- ModalFormComponent.prototype.setPrimary = function (label) {
1802
- var _this = this;
1803
- this.primary.active = true;
1804
- this.primary.label = label;
1805
- setTimeout(function () {
1806
- _this.primary.active = false;
1807
- }, this.alert_timeout);
1808
- };
1809
- ModalFormComponent.prototype.setSecondary = function (label) {
1810
- var _this = this;
1811
- this.secondary.active = true;
1812
- this.secondary.label = label;
1813
- setTimeout(function () {
1814
- _this.secondary.active = false;
1815
- }, this.alert_timeout);
1816
- };
1817
- ModalFormComponent.prototype.setAlertTimeout = function (timeout) {
1818
- this.alert_timeout = timeout;
1819
- };
1820
- return ModalFormComponent;
1821
- }());
1822
- /** @nocollapse */ ModalFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ModalFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1823
- /** @nocollapse */ ModalFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ModalFormComponent, selector: "df-modal-form", inputs: { modal: "modal", buttons: "buttons", disabled: "disabled" }, outputs: { onSubmit: "onSubmit" }, viewQueries: [{ propertyName: "closeModalElement", first: true, predicate: ["closeModalElement"], descendants: true }], ngImport: i0__namespace, template: "<!-- Modal -->\r\n<div class=\"modal fade\" id=\"{{modal.id}}\" tabindex=\"-1\" role=\"dialog\"\r\n aria-labelledby=\"exampleModalCenterTitle\" aria-hidden=\"true\">\r\n <div class=\"modal-dialog modal-dialog-centered modal-lg\" role=\"document\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h5 class=\"modal-title\" id=\"exampleModalLongTitle\"><i [className]=\"modal.icon\" aria-hidden=\"true\"></i> {{modal.tittle}}</h5>\r\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" #closeModalElement>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <df-expressions-form\r\n (onInit)=\"onStart($event)\"\r\n [formFields]=\"modal.fields\"\r\n [disabled]=\"disabled\"></df-expressions-form>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <div class=\"row grow\">\r\n <div *ngIf=\"success.active\" class=\"grow alert alert-success m-2\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\r\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger m-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\r\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning m-2\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\r\n <div *ngIf=\"info.active\" class=\"grow alert alert-info m-2\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\r\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary m-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\r\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary m-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\r\n </div>\r\n <div *ngFor=\"let input of buttons\" class=\"d-flex justify-content-around\">\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'button'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-secondary m-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'submit'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-primary m-2\" (click)=\"onClick(input.action)\" [disabled]=\"!isFormValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'reset'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"resetForm()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'close'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"closeModal()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n", styles: [".grow{flex-grow:1}button:focus{border-color:green;box-shadow:0 1px 1px #00000013 inset,0 0 8px green;outline:0 none}.btn-primary{background-color:green;border-color:green}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
1824
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ModalFormComponent, decorators: [{
1825
- type: i0.Component,
1826
- args: [{
1827
- selector: 'df-modal-form',
1828
- templateUrl: './modal-form.component.html',
1829
- styleUrls: ['./modal-form.component.scss']
1830
- }]
1831
- }], ctorParameters: function () { return []; }, propDecorators: { modal: [{
1832
- type: i0.Input
1833
- }], buttons: [{
1834
- type: i0.Input
1835
- }], disabled: [{
1836
- type: i0.Input
1837
- }], onSubmit: [{
1838
- type: i0.Output
1839
- }], closeModalElement: [{
1840
- type: i0.ViewChild,
1841
- args: ['closeModalElement', {}]
1701
+ var ModalFormComponent = /** @class */ (function () {
1702
+ function ModalFormComponent() {
1703
+ this.onSubmit = new i0.EventEmitter();
1704
+ this.alert_timeout = Constants.ALERT_TIMEOUT;
1705
+ this.danger = { active: false, label: '' };
1706
+ this.warning = { active: false, label: '' };
1707
+ this.success = { active: false, label: '' };
1708
+ this.info = { active: false, label: '' };
1709
+ this.primary = { active: false, label: '' };
1710
+ this.secondary = { active: false, label: '' };
1711
+ }
1712
+ ModalFormComponent.prototype.ngOnInit = function () {
1713
+ };
1714
+ ModalFormComponent.prototype.onStart = function (event) {
1715
+ this.form = event;
1716
+ };
1717
+ ModalFormComponent.prototype.getForm = function () {
1718
+ if (!ObjectUtility.isEmpty(this.form))
1719
+ return this.form;
1720
+ };
1721
+ ModalFormComponent.prototype.getFormControls = function () {
1722
+ if (!ObjectUtility.isEmpty(this.form))
1723
+ return this.form.controls;
1724
+ };
1725
+ ModalFormComponent.prototype.onClick = function (action) {
1726
+ var data = {
1727
+ action: action,
1728
+ formValues: this.form.value
1729
+ };
1730
+ this.onSubmit.emit(data);
1731
+ };
1732
+ ModalFormComponent.prototype.isFormValid = function () {
1733
+ return this.form.valid;
1734
+ };
1735
+ ModalFormComponent.prototype.resetForm = function () {
1736
+ var e_1, _a, e_2, _b;
1737
+ try {
1738
+ for (var _c = __values(this.modal.fields), _d = _c.next(); !_d.done; _d = _c.next()) {
1739
+ var row = _d.value;
1740
+ try {
1741
+ for (var row_1 = (e_2 = void 0, __values(row)), row_1_1 = row_1.next(); !row_1_1.done; row_1_1 = row_1.next()) {
1742
+ var input = row_1_1.value;
1743
+ if (!input.disabled
1744
+ && !input.readonly) {
1745
+ this.form.controls[input.id].reset();
1746
+ }
1747
+ }
1748
+ }
1749
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1750
+ finally {
1751
+ try {
1752
+ if (row_1_1 && !row_1_1.done && (_b = row_1.return)) _b.call(row_1);
1753
+ }
1754
+ finally { if (e_2) throw e_2.error; }
1755
+ }
1756
+ }
1757
+ }
1758
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1759
+ finally {
1760
+ try {
1761
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1762
+ }
1763
+ finally { if (e_1) throw e_1.error; }
1764
+ }
1765
+ };
1766
+ ModalFormComponent.prototype.closeModal = function () {
1767
+ this.closeModalElement.nativeElement.click();
1768
+ };
1769
+ ModalFormComponent.prototype.setDanger = function (label) {
1770
+ var _this = this;
1771
+ this.danger.active = true;
1772
+ this.danger.label = label;
1773
+ setTimeout(function () {
1774
+ _this.danger.active = false;
1775
+ }, this.alert_timeout);
1776
+ };
1777
+ ModalFormComponent.prototype.setWarning = function (label) {
1778
+ var _this = this;
1779
+ this.warning.active = true;
1780
+ this.warning.label = label;
1781
+ setTimeout(function () {
1782
+ _this.warning.active = false;
1783
+ }, this.alert_timeout);
1784
+ };
1785
+ ModalFormComponent.prototype.setSuccess = function (label) {
1786
+ var _this = this;
1787
+ this.success.active = true;
1788
+ this.success.label = label;
1789
+ setTimeout(function () {
1790
+ _this.success.active = false;
1791
+ }, this.alert_timeout);
1792
+ };
1793
+ ModalFormComponent.prototype.setInfo = function (label) {
1794
+ var _this = this;
1795
+ this.info.active = true;
1796
+ this.info.label = label;
1797
+ setTimeout(function () {
1798
+ _this.info.active = false;
1799
+ }, this.alert_timeout);
1800
+ };
1801
+ ModalFormComponent.prototype.setPrimary = function (label) {
1802
+ var _this = this;
1803
+ this.primary.active = true;
1804
+ this.primary.label = label;
1805
+ setTimeout(function () {
1806
+ _this.primary.active = false;
1807
+ }, this.alert_timeout);
1808
+ };
1809
+ ModalFormComponent.prototype.setSecondary = function (label) {
1810
+ var _this = this;
1811
+ this.secondary.active = true;
1812
+ this.secondary.label = label;
1813
+ setTimeout(function () {
1814
+ _this.secondary.active = false;
1815
+ }, this.alert_timeout);
1816
+ };
1817
+ ModalFormComponent.prototype.setAlertTimeout = function (timeout) {
1818
+ this.alert_timeout = timeout;
1819
+ };
1820
+ return ModalFormComponent;
1821
+ }());
1822
+ /** @nocollapse */ ModalFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ModalFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1823
+ /** @nocollapse */ ModalFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ModalFormComponent, selector: "df-modal-form", inputs: { modal: "modal", buttons: "buttons", disabled: "disabled" }, outputs: { onSubmit: "onSubmit" }, viewQueries: [{ propertyName: "closeModalElement", first: true, predicate: ["closeModalElement"], descendants: true }], ngImport: i0__namespace, template: "<!-- Modal -->\n<div class=\"modal fade\" id=\"{{modal.id}}\" tabindex=\"-1\" role=\"dialog\"\n aria-labelledby=\"exampleModalCenterTitle\" aria-hidden=\"true\">\n <div class=\"modal-dialog modal-dialog-centered modal-lg\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"exampleModalLongTitle\"><i [className]=\"modal.icon\" aria-hidden=\"true\"></i> {{modal.tittle}}</h5>\n <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" #closeModalElement>\n </button>\n </div>\n <div class=\"modal-body\">\n <df-expressions-form\n (onInit)=\"onStart($event)\"\n [formFields]=\"modal.fields\"\n [disabled]=\"disabled\"></df-expressions-form>\n </div>\n <div class=\"modal-footer\">\n <div class=\"row grow\">\n <div *ngIf=\"success.active\" class=\"grow alert alert-success m-2\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\n <div *ngIf=\"danger.active\" class=\"grow alert alert-danger m-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\n <div *ngIf=\"warning.active\" class=\"grow alert alert-warning m-2\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\n <div *ngIf=\"info.active\" class=\"grow alert alert-info m-2\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\n <div *ngIf=\"primary.active\" class=\"grow alert alert-primary m-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\n <div *ngIf=\"secondary.active\" class=\"grow alert alert-secondary m-2\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\n </div>\n <div *ngFor=\"let input of buttons\" class=\"d-flex justify-content-around\">\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'button'\">\n <button type=\"{{input.type}}\" class=\"btn btn-secondary m-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'submit'\">\n <button type=\"{{input.type}}\" class=\"btn btn-primary m-2\" (click)=\"onClick(input.action)\" [disabled]=\"!isFormValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'reset'\">\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"resetForm()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'close'\">\n <button type=\"'button'\" class=\"btn btn-secondary m-2\" (click)=\"closeModal()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n", styles: [".grow{flex-grow:1}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
1824
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ModalFormComponent, decorators: [{
1825
+ type: i0.Component,
1826
+ args: [{
1827
+ selector: 'df-modal-form',
1828
+ templateUrl: './modal-form.component.html',
1829
+ styleUrls: ['./modal-form.component.scss']
1830
+ }]
1831
+ }], ctorParameters: function () { return []; }, propDecorators: { modal: [{
1832
+ type: i0.Input
1833
+ }], buttons: [{
1834
+ type: i0.Input
1835
+ }], disabled: [{
1836
+ type: i0.Input
1837
+ }], onSubmit: [{
1838
+ type: i0.Output
1839
+ }], closeModalElement: [{
1840
+ type: i0.ViewChild,
1841
+ args: ['closeModalElement', {}]
1842
1842
  }] } });
1843
1843
 
1844
- var TabFormComponent = /** @class */ (function () {
1845
- function TabFormComponent() {
1846
- this.currentSection = 0;
1847
- this.initIndex = 0;
1848
- this.forms = [];
1849
- this.position = 'top';
1850
- this.onSubmit = new i0.EventEmitter();
1851
- this.alert_timeout = Constants.ALERT_TIMEOUT;
1852
- this.danger = { active: false, label: '' };
1853
- this.warning = { active: false, label: '' };
1854
- this.success = { active: false, label: '' };
1855
- this.info = { active: false, label: '' };
1856
- this.primary = { active: false, label: '' };
1857
- this.secondary = { active: false, label: '' };
1858
- }
1859
- TabFormComponent.prototype.ngOnInit = function () {
1860
- };
1861
- TabFormComponent.prototype.getNavType = function () {
1862
- if (!ObjectUtility.isEmpty(this.type)) {
1863
- if (this.type === 'pills') {
1864
- if (this.position === 'left' || this.position === 'right')
1865
- return 'nav nav-pills flex-column';
1866
- else
1867
- return 'nav nav-pills';
1868
- }
1869
- else
1870
- return 'nav nav-tabs';
1871
- }
1872
- else
1873
- return 'nav nav-tabs';
1874
- };
1875
- TabFormComponent.prototype.getMargin = function () {
1876
- if (!ObjectUtility.isEmpty(this.type) && this.type === 'pills') {
1877
- return 'margin-item';
1878
- }
1879
- };
1880
- TabFormComponent.prototype.onClick = function (action) {
1881
- var e_1, _a;
1882
- var formValues = [];
1883
- try {
1884
- for (var _b = __values(this.forms), _c = _b.next(); !_c.done; _c = _b.next()) {
1885
- var myform = _c.value;
1886
- formValues.push(myform.value);
1887
- }
1888
- }
1889
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1890
- finally {
1891
- try {
1892
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1893
- }
1894
- finally { if (e_1) throw e_1.error; }
1895
- }
1896
- var result = { action: action, formValues: formValues };
1897
- this.onSubmit.emit(result);
1898
- };
1899
- TabFormComponent.prototype.onSectionButtonClicked = function (event, index, sectionLabel) {
1900
- event['index'] = index;
1901
- event['sectionLabel'] = sectionLabel;
1902
- this.onSubmit.emit(event);
1903
- };
1904
- TabFormComponent.prototype.getForms = function () {
1905
- return this.forms;
1906
- };
1907
- TabFormComponent.prototype.resetForms = function () {
1908
- var e_2, _a, e_3, _b, e_4, _c;
1909
- try {
1910
- for (var _d = __values(this.sections.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
1911
- var _f = __read(_e.value, 2), index = _f[0], section = _f[1];
1912
- try {
1913
- for (var _g = (e_3 = void 0, __values(section.sectionFields)), _h = _g.next(); !_h.done; _h = _g.next()) {
1914
- var rows = _h.value;
1915
- try {
1916
- for (var rows_1 = (e_4 = void 0, __values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
1917
- var input = rows_1_1.value;
1918
- if (!ObjectUtility.isEmpty(input.id)
1919
- && !input.readonly
1920
- && !input.disabled) {
1921
- var form = this.forms[index].form;
1922
- var control = form.controls[input.id];
1923
- control.reset();
1924
- }
1925
- }
1926
- }
1927
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1928
- finally {
1929
- try {
1930
- if (rows_1_1 && !rows_1_1.done && (_c = rows_1.return)) _c.call(rows_1);
1931
- }
1932
- finally { if (e_4) throw e_4.error; }
1933
- }
1934
- }
1935
- }
1936
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1937
- finally {
1938
- try {
1939
- if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
1940
- }
1941
- finally { if (e_3) throw e_3.error; }
1942
- }
1943
- }
1944
- }
1945
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1946
- finally {
1947
- try {
1948
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1949
- }
1950
- finally { if (e_2) throw e_2.error; }
1951
- }
1952
- };
1953
- TabFormComponent.prototype.getCurrentSection = function () {
1954
- return this.currentSection;
1955
- };
1956
- TabFormComponent.prototype.onStart = function (event) {
1957
- if (this.sections.length == this.forms.length) {
1958
- this.forms[this.initIndex] = event;
1959
- if (this.initIndex == (this.forms.length - 1))
1960
- this.initIndex = 0;
1961
- else
1962
- this.initIndex++;
1963
- }
1964
- else
1965
- this.forms.push(event);
1966
- };
1967
- TabFormComponent.prototype.setCurrentSection = function (sectionNumber) {
1968
- this.currentSection = sectionNumber;
1969
- };
1970
- TabFormComponent.prototype.allFormsAreValid = function () {
1971
- if (!this.forms[this.currentSection].valid)
1972
- return false;
1973
- for (var i = 0; i < this.forms.length; i++) {
1974
- if (i != this.currentSection && !this.forms[i].valid)
1975
- return false;
1976
- }
1977
- return true;
1978
- };
1979
- TabFormComponent.prototype.getCols = function (type, position, column) {
1980
- if (type == 'pills') {
1981
- if (position == 'left') {
1982
- if (column == 1) {
1983
- return 'col-3 mycol';
1984
- }
1985
- else if (column == 2)
1986
- return 'col-9 mycol';
1987
- }
1988
- else if (position == 'right') {
1989
- if (column == 2) {
1990
- return 'col-9 mycol';
1991
- }
1992
- else if (column == 3)
1993
- return 'col-3 mycol';
1994
- }
1995
- else {
1996
- if (column == 2)
1997
- return 'col-12 mycol';
1998
- }
1999
- }
2000
- else {
2001
- if (column == 2)
2002
- return 'col-12 mycol';
2003
- }
2004
- };
2005
- TabFormComponent.prototype.isEmpty = function (value) {
2006
- return ObjectUtility.isEmpty(value);
2007
- };
2008
- TabFormComponent.prototype.setDanger = function (label) {
2009
- var _this = this;
2010
- this.danger.active = true;
2011
- this.danger.label = label;
2012
- setTimeout(function () {
2013
- _this.danger.active = false;
2014
- }, this.alert_timeout);
2015
- };
2016
- TabFormComponent.prototype.setWarning = function (label) {
2017
- var _this = this;
2018
- this.warning.active = true;
2019
- this.warning.label = label;
2020
- setTimeout(function () {
2021
- _this.warning.active = false;
2022
- }, this.alert_timeout);
2023
- };
2024
- TabFormComponent.prototype.setSuccess = function (label) {
2025
- var _this = this;
2026
- this.success.active = true;
2027
- this.success.label = label;
2028
- setTimeout(function () {
2029
- _this.success.active = false;
2030
- }, this.alert_timeout);
2031
- };
2032
- TabFormComponent.prototype.setInfo = function (label) {
2033
- var _this = this;
2034
- this.info.active = true;
2035
- this.info.label = label;
2036
- setTimeout(function () {
2037
- _this.info.active = false;
2038
- }, this.alert_timeout);
2039
- };
2040
- TabFormComponent.prototype.setPrimary = function (label) {
2041
- var _this = this;
2042
- this.primary.active = true;
2043
- this.primary.label = label;
2044
- setTimeout(function () {
2045
- _this.primary.active = false;
2046
- }, this.alert_timeout);
2047
- };
2048
- TabFormComponent.prototype.setSecondary = function (label) {
2049
- var _this = this;
2050
- this.secondary.active = true;
2051
- this.secondary.label = label;
2052
- setTimeout(function () {
2053
- _this.secondary.active = false;
2054
- }, this.alert_timeout);
2055
- };
2056
- TabFormComponent.prototype.setAlertTimeout = function (timeout) {
2057
- this.alert_timeout = timeout;
2058
- };
2059
- return TabFormComponent;
2060
- }());
2061
- /** @nocollapse */ TabFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: TabFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2062
- /** @nocollapse */ TabFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: TabFormComponent, selector: "df-tab-form", inputs: { sections: "sections", buttons: "buttons", type: "type", tabsId: "tabsId", position: "position" }, outputs: { onSubmit: "onSubmit" }, viewQueries: [{ propertyName: "myForm", first: true, predicate: ["myForm"], descendants: true }], ngImport: i0__namespace, template: "<div *ngIf=\"!isEmpty(tabsId)\">\r\n <div class=\"d-flex\">\r\n <div class=\"col-12 mycol\">\r\n <ul [className]=\"getNavType()\" *ngIf=\"type=='tabs' || (position!=='left' && position!=='right')\">\r\n <span *ngFor=\"let section of sections; let i=index\">\r\n <li class=\"nav-item\" [className]=\"getMargin()\">\r\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\r\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\r\n (click)=\"setCurrentSection(i)\">\r\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\r\n </li>\r\n </span>\r\n </ul>\r\n </div>\r\n </div>\r\n <div class=\"d-flex\">\r\n <div [className]=\"getCols(type,position,1)\" *ngIf=\"type=='pills' && position=='left'\">\r\n <ul [className]=\"getNavType()\" class=\"flex-column\">\r\n <span *ngFor=\"let section of sections; let i=index\">\r\n <li class=\"nav-item row myrow\" [className]=\"getMargin()\">\r\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\r\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\r\n (click)=\"setCurrentSection(i)\">\r\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\r\n </li>\r\n </span>\r\n </ul>\r\n </div>\r\n <div [className]=\"getCols(type,position,2)\">\r\n <div id=\"myTabContent\" class=\"tab-content tab-box\">\r\n <span *ngFor=\"let section of sections; let j=index\">\r\n <div class=\"tab-pane fade\"\r\n [class.active]=\"(j==getCurrentSection())?true:false\"\r\n [class.show]=\"(j==getCurrentSection())?true:false\"\r\n [hidden]=\"(j!==getCurrentSection())?true:false\"\r\n id=\"{{tabsId+section.id}}\">\r\n <df-expressions-form #myForm\r\n (onInit)=\"onStart($event)\"\r\n (onSubmit)=\"onSectionButtonClicked($event,j,section.label)\"\r\n [formFields]=\"section.sectionFields\"\r\n [buttons]=\"section.sectionButtons\"></df-expressions-form>\r\n </div>\r\n </span>\r\n </div>\r\n <div class=\"tab-box mt-1\">\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"success.active\">\r\n <div class=\"grow alert alert-success\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\r\n </div>\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"danger.active\">\r\n <div class=\"grow alert alert-danger\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\r\n </div>\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"warning.active\">\r\n <div class=\"grow alert alert-warning\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\r\n </div>\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"info.active\">\r\n <div class=\"grow alert alert-info\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\r\n </div>\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"primary.active\">\r\n <div class=\"grow alert alert-primary\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\r\n </div>\r\n <div class=\"me-3 ms-3 row\" *ngIf=\"secondary.active\">\r\n <div class=\"grow alert alert-secondary\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\r\n </div>\r\n <div class=\"m-2 d-flex justify-content-around\" *ngIf=\"!isEmpty(buttons)\">\r\n <div *ngFor=\"let input of buttons\">\r\n <div [ngSwitch]=\"input.type\">\r\n <div *ngSwitchCase=\"'button'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ms-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'submit'\">\r\n <button type=\"{{input.type}}\" class=\"btn btn-primary ms-2\" (click)=\"onClick(input.action)\" [disabled]=\"!allFormsAreValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n <div *ngSwitchCase=\"'reset'\">\r\n <button type=\"'button'\" class=\"btn btn-secondary ms-2\" (click)=\"resetForms()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div [className]=\"getCols(type,position,3)\" *ngIf=\"type=='pills' && position=='right'\">\r\n <ul [className]=\"getNavType()\" class=\"flex-column\">\r\n <span *ngFor=\"let section of sections; let i=index\">\r\n <li class=\"nav-item row myrow\" [className]=\"getMargin()\">\r\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\r\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\r\n (click)=\"setCurrentSection(i)\">\r\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\r\n </li>\r\n </span>\r\n </ul>\r\n </div>\r\n </div>\r\n</div>\r\n<div *ngIf=\"isEmpty(tabsId)\">\r\n <div class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> Error:tabsId is required, please provide a value.</div>\r\n</div>\r\n", styles: [".tab-box{padding:10px;background-color:#fff;border:#cccccc 1px solid;border-radius:4px}.tab-pane{padding:10px}.grow{flex-grow:1}.margin-item{margin:4px}.myrow{flex-grow:1;padding:0}.mycol{flex-grow:1;padding:0}.nav-tabs .nav-link{color:green}.nav-tabs .active{color:gray}.nav-tabs .nav-link:hover{color:green;opacity:.8}.nav-pills .nav-link{color:green}.nav-pills .nav-link a:hover{background-color:green;color:#fff;opacity:.8}.nav-pills .active{background-color:green;color:#fff}.btn-primary{background-color:green;border-color:green}button:focus{border-color:green;box-shadow:0 1px 1px #00000013 inset,0 0 8px green;outline:0 none}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
2063
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: TabFormComponent, decorators: [{
2064
- type: i0.Component,
2065
- args: [{
2066
- selector: 'df-tab-form',
2067
- templateUrl: './tab-form.component.html',
2068
- styleUrls: ['./tab-form.component.scss']
2069
- }]
2070
- }], ctorParameters: function () { return []; }, propDecorators: { sections: [{
2071
- type: i0.Input
2072
- }], buttons: [{
2073
- type: i0.Input
2074
- }], type: [{
2075
- type: i0.Input
2076
- }], tabsId: [{
2077
- type: i0.Input
2078
- }], position: [{
2079
- type: i0.Input
2080
- }], onSubmit: [{
2081
- type: i0.Output
2082
- }], myForm: [{
2083
- type: i0.ViewChild,
2084
- args: ['myForm', {}]
1844
+ var TabFormComponent = /** @class */ (function () {
1845
+ function TabFormComponent() {
1846
+ this.currentSection = 0;
1847
+ this.initIndex = 0;
1848
+ this.forms = [];
1849
+ this.position = 'top';
1850
+ this.onSubmit = new i0.EventEmitter();
1851
+ this.alert_timeout = Constants.ALERT_TIMEOUT;
1852
+ this.danger = { active: false, label: '' };
1853
+ this.warning = { active: false, label: '' };
1854
+ this.success = { active: false, label: '' };
1855
+ this.info = { active: false, label: '' };
1856
+ this.primary = { active: false, label: '' };
1857
+ this.secondary = { active: false, label: '' };
1858
+ }
1859
+ TabFormComponent.prototype.ngOnInit = function () {
1860
+ };
1861
+ TabFormComponent.prototype.getNavType = function () {
1862
+ if (!ObjectUtility.isEmpty(this.type)) {
1863
+ if (this.type === 'pills') {
1864
+ if (this.position === 'left' || this.position === 'right')
1865
+ return 'nav nav-pills flex-column';
1866
+ else
1867
+ return 'nav nav-pills';
1868
+ }
1869
+ else
1870
+ return 'nav nav-tabs';
1871
+ }
1872
+ else
1873
+ return 'nav nav-tabs';
1874
+ };
1875
+ TabFormComponent.prototype.getMargin = function () {
1876
+ if (!ObjectUtility.isEmpty(this.type) && this.type === 'pills') {
1877
+ return 'margin-item';
1878
+ }
1879
+ };
1880
+ TabFormComponent.prototype.onClick = function (action) {
1881
+ var e_1, _a;
1882
+ var formValues = [];
1883
+ try {
1884
+ for (var _b = __values(this.forms), _c = _b.next(); !_c.done; _c = _b.next()) {
1885
+ var myform = _c.value;
1886
+ formValues.push(myform.value);
1887
+ }
1888
+ }
1889
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1890
+ finally {
1891
+ try {
1892
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1893
+ }
1894
+ finally { if (e_1) throw e_1.error; }
1895
+ }
1896
+ var result = { action: action, formValues: formValues };
1897
+ this.onSubmit.emit(result);
1898
+ };
1899
+ TabFormComponent.prototype.onSectionButtonClicked = function (event, index, sectionLabel) {
1900
+ event['index'] = index;
1901
+ event['sectionLabel'] = sectionLabel;
1902
+ this.onSubmit.emit(event);
1903
+ };
1904
+ TabFormComponent.prototype.getForms = function () {
1905
+ return this.forms;
1906
+ };
1907
+ TabFormComponent.prototype.resetForms = function () {
1908
+ var e_2, _a, e_3, _b, e_4, _c;
1909
+ try {
1910
+ for (var _d = __values(this.sections.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
1911
+ var _f = __read(_e.value, 2), index = _f[0], section = _f[1];
1912
+ try {
1913
+ for (var _g = (e_3 = void 0, __values(section.sectionFields)), _h = _g.next(); !_h.done; _h = _g.next()) {
1914
+ var rows = _h.value;
1915
+ try {
1916
+ for (var rows_1 = (e_4 = void 0, __values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
1917
+ var input = rows_1_1.value;
1918
+ if (!ObjectUtility.isEmpty(input.id)
1919
+ && !input.readonly
1920
+ && !input.disabled) {
1921
+ var form = this.forms[index].form;
1922
+ var control = form.controls[input.id];
1923
+ control.reset();
1924
+ }
1925
+ }
1926
+ }
1927
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1928
+ finally {
1929
+ try {
1930
+ if (rows_1_1 && !rows_1_1.done && (_c = rows_1.return)) _c.call(rows_1);
1931
+ }
1932
+ finally { if (e_4) throw e_4.error; }
1933
+ }
1934
+ }
1935
+ }
1936
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1937
+ finally {
1938
+ try {
1939
+ if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
1940
+ }
1941
+ finally { if (e_3) throw e_3.error; }
1942
+ }
1943
+ }
1944
+ }
1945
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1946
+ finally {
1947
+ try {
1948
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1949
+ }
1950
+ finally { if (e_2) throw e_2.error; }
1951
+ }
1952
+ };
1953
+ TabFormComponent.prototype.getCurrentSection = function () {
1954
+ return this.currentSection;
1955
+ };
1956
+ TabFormComponent.prototype.onStart = function (event) {
1957
+ if (this.sections.length == this.forms.length) {
1958
+ this.forms[this.initIndex] = event;
1959
+ if (this.initIndex == (this.forms.length - 1))
1960
+ this.initIndex = 0;
1961
+ else
1962
+ this.initIndex++;
1963
+ }
1964
+ else
1965
+ this.forms.push(event);
1966
+ };
1967
+ TabFormComponent.prototype.setCurrentSection = function (sectionNumber) {
1968
+ this.currentSection = sectionNumber;
1969
+ };
1970
+ TabFormComponent.prototype.allFormsAreValid = function () {
1971
+ if (!this.forms[this.currentSection].valid)
1972
+ return false;
1973
+ for (var i = 0; i < this.forms.length; i++) {
1974
+ if (i != this.currentSection && !this.forms[i].valid)
1975
+ return false;
1976
+ }
1977
+ return true;
1978
+ };
1979
+ TabFormComponent.prototype.getCols = function (type, position, column) {
1980
+ if (type == 'pills') {
1981
+ if (position == 'left') {
1982
+ if (column == 1) {
1983
+ return 'col-3 mycol';
1984
+ }
1985
+ else if (column == 2)
1986
+ return 'col-9 mycol';
1987
+ }
1988
+ else if (position == 'right') {
1989
+ if (column == 2) {
1990
+ return 'col-9 mycol';
1991
+ }
1992
+ else if (column == 3)
1993
+ return 'col-3 mycol';
1994
+ }
1995
+ else {
1996
+ if (column == 2)
1997
+ return 'col-12 mycol';
1998
+ }
1999
+ }
2000
+ else {
2001
+ if (column == 2)
2002
+ return 'col-12 mycol';
2003
+ }
2004
+ };
2005
+ TabFormComponent.prototype.isEmpty = function (value) {
2006
+ return ObjectUtility.isEmpty(value);
2007
+ };
2008
+ TabFormComponent.prototype.setDanger = function (label) {
2009
+ var _this = this;
2010
+ this.danger.active = true;
2011
+ this.danger.label = label;
2012
+ setTimeout(function () {
2013
+ _this.danger.active = false;
2014
+ }, this.alert_timeout);
2015
+ };
2016
+ TabFormComponent.prototype.setWarning = function (label) {
2017
+ var _this = this;
2018
+ this.warning.active = true;
2019
+ this.warning.label = label;
2020
+ setTimeout(function () {
2021
+ _this.warning.active = false;
2022
+ }, this.alert_timeout);
2023
+ };
2024
+ TabFormComponent.prototype.setSuccess = function (label) {
2025
+ var _this = this;
2026
+ this.success.active = true;
2027
+ this.success.label = label;
2028
+ setTimeout(function () {
2029
+ _this.success.active = false;
2030
+ }, this.alert_timeout);
2031
+ };
2032
+ TabFormComponent.prototype.setInfo = function (label) {
2033
+ var _this = this;
2034
+ this.info.active = true;
2035
+ this.info.label = label;
2036
+ setTimeout(function () {
2037
+ _this.info.active = false;
2038
+ }, this.alert_timeout);
2039
+ };
2040
+ TabFormComponent.prototype.setPrimary = function (label) {
2041
+ var _this = this;
2042
+ this.primary.active = true;
2043
+ this.primary.label = label;
2044
+ setTimeout(function () {
2045
+ _this.primary.active = false;
2046
+ }, this.alert_timeout);
2047
+ };
2048
+ TabFormComponent.prototype.setSecondary = function (label) {
2049
+ var _this = this;
2050
+ this.secondary.active = true;
2051
+ this.secondary.label = label;
2052
+ setTimeout(function () {
2053
+ _this.secondary.active = false;
2054
+ }, this.alert_timeout);
2055
+ };
2056
+ TabFormComponent.prototype.setAlertTimeout = function (timeout) {
2057
+ this.alert_timeout = timeout;
2058
+ };
2059
+ return TabFormComponent;
2060
+ }());
2061
+ /** @nocollapse */ TabFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: TabFormComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2062
+ /** @nocollapse */ TabFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: TabFormComponent, selector: "df-tab-form", inputs: { sections: "sections", buttons: "buttons", type: "type", tabsId: "tabsId", position: "position" }, outputs: { onSubmit: "onSubmit" }, viewQueries: [{ propertyName: "myForm", first: true, predicate: ["myForm"], descendants: true }], ngImport: i0__namespace, template: "<div *ngIf=\"!isEmpty(tabsId)\">\n <div class=\"d-flex\">\n <div class=\"col-12 mycol\">\n <ul [className]=\"getNavType()\" *ngIf=\"type=='tabs' || (position!=='left' && position!=='right')\">\n <span *ngFor=\"let section of sections; let i=index\">\n <li class=\"nav-item\" [className]=\"getMargin()\">\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\n (click)=\"setCurrentSection(i)\">\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\n </li>\n </span>\n </ul>\n </div>\n </div>\n <div class=\"d-flex\">\n <div [className]=\"getCols(type,position,1)\" *ngIf=\"type=='pills' && position=='left'\">\n <ul [className]=\"getNavType()\" class=\"flex-column\">\n <span *ngFor=\"let section of sections; let i=index\">\n <li class=\"nav-item row myrow\" [className]=\"getMargin()\">\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\n (click)=\"setCurrentSection(i)\">\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\n </li>\n </span>\n </ul>\n </div>\n <div [className]=\"getCols(type,position,2)\">\n <div id=\"myTabContent\" class=\"tab-content tab-box\">\n <span *ngFor=\"let section of sections; let j=index\">\n <div class=\"tab-pane fade\"\n [class.active]=\"(j==getCurrentSection())?true:false\"\n [class.show]=\"(j==getCurrentSection())?true:false\"\n [hidden]=\"(j!==getCurrentSection())?true:false\"\n id=\"{{tabsId+section.id}}\">\n <df-expressions-form #myForm\n (onInit)=\"onStart($event)\"\n (onSubmit)=\"onSectionButtonClicked($event,j,section.label)\"\n [formFields]=\"section.sectionFields\"\n [buttons]=\"section.sectionButtons\"></df-expressions-form>\n </div>\n </span>\n </div>\n <div class=\"tab-box mt-1\">\n <div class=\"me-3 ms-3 row\" *ngIf=\"success.active\">\n <div class=\"grow alert alert-success\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> {{success.label}}</div>\n </div>\n <div class=\"me-3 ms-3 row\" *ngIf=\"danger.active\">\n <div class=\"grow alert alert-danger\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> {{danger.label}}</div>\n </div>\n <div class=\"me-3 ms-3 row\" *ngIf=\"warning.active\">\n <div class=\"grow alert alert-warning\"><i class=\"fa fa-exclamation-triangle\" aria-hidden=\"true\"></i> {{warning.label}}</div>\n </div>\n <div class=\"me-3 ms-3 row\" *ngIf=\"info.active\">\n <div class=\"grow alert alert-info\"><i class=\"fa fa-info\" aria-hidden=\"true\"></i> {{info.label}}</div>\n </div>\n <div class=\"me-3 ms-3 row\" *ngIf=\"primary.active\">\n <div class=\"grow alert alert-primary\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{primary.label}}</div>\n </div>\n <div class=\"me-3 ms-3 row\" *ngIf=\"secondary.active\">\n <div class=\"grow alert alert-secondary\"><i class=\"fa fa-exclamation\" aria-hidden=\"true\"></i> {{secondary.label}}</div>\n </div>\n <div class=\"m-2 d-flex justify-content-around\" *ngIf=\"!isEmpty(buttons)\">\n <div *ngFor=\"let input of buttons\">\n <div [ngSwitch]=\"input.type\">\n <div *ngSwitchCase=\"'button'\">\n <button type=\"{{input.type}}\" class=\"btn btn-secondary ms-2\" (click)=\"onClick(input.action)\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'submit'\">\n <button type=\"{{input.type}}\" class=\"btn btn-primary ms-2\" (click)=\"onClick(input.action)\" [disabled]=\"!allFormsAreValid()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n <div *ngSwitchCase=\"'reset'\">\n <button type=\"'button'\" class=\"btn btn-secondary ms-2\" (click)=\"resetForms()\"><i [className]=\"input.icon\" aria-hidden=\"true\"></i> {{input.label}}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div [className]=\"getCols(type,position,3)\" *ngIf=\"type=='pills' && position=='right'\">\n <ul [className]=\"getNavType()\" class=\"flex-column\">\n <span *ngFor=\"let section of sections; let i=index\">\n <li class=\"nav-item row myrow\" [className]=\"getMargin()\">\n <a class=\"nav-link\" [class.active]=\"(i==getCurrentSection())?true:false\"\n data-bs-toggle=\"tab\" href=\"#{{tabsId+section.id}}\"\n (click)=\"setCurrentSection(i)\">\n <i [className]=\"section.icon\" aria-hidden=\"true\"></i> {{section.label}}</a>\n </li>\n </span>\n </ul>\n </div>\n </div>\n</div>\n<div *ngIf=\"isEmpty(tabsId)\">\n <div class=\"grow alert alert-danger mb-2\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i> Error:tabsId is required, please provide a value.</div>\n</div>\n", styles: [".tab-box{padding:10px;background-color:#fff;border:#cccccc 1px solid;border-radius:4px}.tab-pane{padding:10px}.grow{flex-grow:1}.margin-item{margin:4px}.myrow{flex-grow:1;padding:0}.mycol{flex-grow:1;padding:0}\n"], components: [{ type: ExpressionsFormComponent, selector: "df-expressions-form", inputs: ["formFields", "disabled", "buttons"], outputs: ["onSubmit", "onInit"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }] });
2063
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: TabFormComponent, decorators: [{
2064
+ type: i0.Component,
2065
+ args: [{
2066
+ selector: 'df-tab-form',
2067
+ templateUrl: './tab-form.component.html',
2068
+ styleUrls: ['./tab-form.component.scss']
2069
+ }]
2070
+ }], ctorParameters: function () { return []; }, propDecorators: { sections: [{
2071
+ type: i0.Input
2072
+ }], buttons: [{
2073
+ type: i0.Input
2074
+ }], type: [{
2075
+ type: i0.Input
2076
+ }], tabsId: [{
2077
+ type: i0.Input
2078
+ }], position: [{
2079
+ type: i0.Input
2080
+ }], onSubmit: [{
2081
+ type: i0.Output
2082
+ }], myForm: [{
2083
+ type: i0.ViewChild,
2084
+ args: ['myForm', {}]
2085
2085
  }] } });
2086
2086
 
2087
- var AppError = /** @class */ (function () {
2088
- function AppError(originalError) {
2089
- this.originalError = originalError;
2090
- }
2091
- return AppError;
2087
+ var AppError = /** @class */ (function () {
2088
+ function AppError(originalError) {
2089
+ this.originalError = originalError;
2090
+ }
2091
+ return AppError;
2092
2092
  }());
2093
2093
 
2094
- var InvalidUserError = /** @class */ (function (_super) {
2095
- __extends(InvalidUserError, _super);
2096
- function InvalidUserError() {
2097
- return _super !== null && _super.apply(this, arguments) || this;
2098
- }
2099
- return InvalidUserError;
2094
+ var InvalidUserError = /** @class */ (function (_super) {
2095
+ __extends(InvalidUserError, _super);
2096
+ function InvalidUserError() {
2097
+ return _super !== null && _super.apply(this, arguments) || this;
2098
+ }
2099
+ return InvalidUserError;
2100
2100
  }(AppError));
2101
2101
 
2102
- var BadRequestError = /** @class */ (function (_super) {
2103
- __extends(BadRequestError, _super);
2104
- function BadRequestError() {
2105
- return _super !== null && _super.apply(this, arguments) || this;
2106
- }
2107
- return BadRequestError;
2102
+ var BadRequestError = /** @class */ (function (_super) {
2103
+ __extends(BadRequestError, _super);
2104
+ function BadRequestError() {
2105
+ return _super !== null && _super.apply(this, arguments) || this;
2106
+ }
2107
+ return BadRequestError;
2108
2108
  }(AppError));
2109
2109
 
2110
- var NotFoundError = /** @class */ (function (_super) {
2111
- __extends(NotFoundError, _super);
2112
- function NotFoundError() {
2113
- return _super !== null && _super.apply(this, arguments) || this;
2114
- }
2115
- return NotFoundError;
2110
+ var NotFoundError = /** @class */ (function (_super) {
2111
+ __extends(NotFoundError, _super);
2112
+ function NotFoundError() {
2113
+ return _super !== null && _super.apply(this, arguments) || this;
2114
+ }
2115
+ return NotFoundError;
2116
2116
  }(AppError));
2117
2117
 
2118
- //Angular Core
2119
- var DataService = /** @class */ (function () {
2120
- function DataService(_url, http) {
2121
- this._url = _url;
2122
- this.http = http;
2123
- }
2124
- DataService.prototype.getAll = function () {
2125
- return this.http.get(this._url)
2126
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2127
- };
2128
- DataService.prototype.getByParam = function (params) {
2129
- var param = Constants.QUESTION_MARK;
2130
- params.forEach(function (element) {
2131
- param = param + element.key + Constants.EQUAL + element.value + Constants.AMPERSAND;
2132
- });
2133
- return this.http.get(this._url + param)
2134
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2135
- };
2136
- DataService.prototype.create = function (resource) {
2137
- return this.http.post(this._url, JSON.stringify(resource))
2138
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2139
- };
2140
- DataService.prototype.update = function (resource) {
2141
- return this.http.patch(this._url + Constants.BACK_SLASH + resource.id, JSON.stringify({ isRead: true }))
2142
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2143
- };
2144
- DataService.prototype.delete = function (id) {
2145
- return this.http.delete(this._url + Constants.BACK_SLASH + id)
2146
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2147
- };
2148
- DataService.prototype.getId = function (id) {
2149
- return this.http.get(this._url + Constants.BACK_SLASH + id)
2150
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2151
- };
2152
- DataService.prototype.getObject = function (resource) {
2153
- return this.http.post(this._url, resource)
2154
- .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2155
- };
2156
- DataService.prototype.handleError = function (error) {
2157
- console.log('DataService.handleError.error', error);
2158
- if (error.status === 404)
2159
- return rxjs.throwError(new NotFoundError());
2160
- if (error.status === 400)
2161
- return rxjs.throwError(new BadRequestError());
2162
- if (error.status === 401)
2163
- return rxjs.throwError(new InvalidUserError());
2164
- return rxjs.throwError(new AppError(error));
2165
- };
2166
- return DataService;
2167
- }());
2168
- /** @nocollapse */ DataService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService, deps: [{ token: String }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2169
- /** @nocollapse */ DataService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService });
2170
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService, decorators: [{
2171
- type: i0.Injectable
2172
- }], ctorParameters: function () {
2173
- return [{ type: undefined, decorators: [{
2174
- type: i0.Inject,
2175
- args: [String]
2176
- }] }, { type: i1__namespace.HttpClient }];
2118
+ //Angular Core
2119
+ var DataService = /** @class */ (function () {
2120
+ function DataService(_url, http) {
2121
+ this._url = _url;
2122
+ this.http = http;
2123
+ }
2124
+ DataService.prototype.getAll = function () {
2125
+ return this.http.get(this._url)
2126
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2127
+ };
2128
+ DataService.prototype.getByParam = function (params) {
2129
+ var param = Constants.QUESTION_MARK;
2130
+ params.forEach(function (element) {
2131
+ param = param + element.key + Constants.EQUAL + element.value + Constants.AMPERSAND;
2132
+ });
2133
+ return this.http.get(this._url + param)
2134
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2135
+ };
2136
+ DataService.prototype.create = function (resource) {
2137
+ return this.http.post(this._url, JSON.stringify(resource))
2138
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2139
+ };
2140
+ DataService.prototype.update = function (resource) {
2141
+ return this.http.patch(this._url + Constants.BACK_SLASH + resource.id, JSON.stringify({ isRead: true }))
2142
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2143
+ };
2144
+ DataService.prototype.delete = function (id) {
2145
+ return this.http.delete(this._url + Constants.BACK_SLASH + id)
2146
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2147
+ };
2148
+ DataService.prototype.getId = function (id) {
2149
+ return this.http.get(this._url + Constants.BACK_SLASH + id)
2150
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2151
+ };
2152
+ DataService.prototype.getObject = function (resource) {
2153
+ return this.http.post(this._url, resource)
2154
+ .pipe(operators.map(function (response) { return response; })).pipe(operators.catchError(this.handleError));
2155
+ };
2156
+ DataService.prototype.handleError = function (error) {
2157
+ console.log('DataService.handleError.error', error);
2158
+ if (error.status === 404)
2159
+ return rxjs.throwError(new NotFoundError());
2160
+ if (error.status === 400)
2161
+ return rxjs.throwError(new BadRequestError());
2162
+ if (error.status === 401)
2163
+ return rxjs.throwError(new InvalidUserError());
2164
+ return rxjs.throwError(new AppError(error));
2165
+ };
2166
+ return DataService;
2167
+ }());
2168
+ /** @nocollapse */ DataService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService, deps: [{ token: String }, { token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2169
+ /** @nocollapse */ DataService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService });
2170
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DataService, decorators: [{
2171
+ type: i0.Injectable
2172
+ }], ctorParameters: function () {
2173
+ return [{ type: undefined, decorators: [{
2174
+ type: i0.Inject,
2175
+ args: [String]
2176
+ }] }, { type: i1__namespace.HttpClient }];
2177
2177
  } });
2178
2178
 
2179
- var AppErrorHandler = /** @class */ (function () {
2180
- function AppErrorHandler() {
2181
- }
2182
- AppErrorHandler.prototype.handleError = function (error) {
2183
- alert('An unexpected error occured.');
2184
- console.log(error);
2185
- };
2186
- return AppErrorHandler;
2179
+ var AppErrorHandler = /** @class */ (function () {
2180
+ function AppErrorHandler() {
2181
+ }
2182
+ AppErrorHandler.prototype.handleError = function (error) {
2183
+ alert('An unexpected error occured.');
2184
+ console.log(error);
2185
+ };
2186
+ return AppErrorHandler;
2187
2187
  }());
2188
2188
 
2189
- var DinoFormsModule = /** @class */ (function () {
2190
- function DinoFormsModule() {
2191
- }
2192
- return DinoFormsModule;
2193
- }());
2194
- /** @nocollapse */ DinoFormsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2195
- /** @nocollapse */ DinoFormsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, declarations: [FormComponent,
2196
- AlertComponent,
2197
- ExpressionsFormComponent,
2198
- AccordionFormComponent,
2199
- ModalFormComponent,
2200
- TabFormComponent], imports: [i2.CommonModule,
2201
- i2$1.FormsModule,
2202
- i2$1.ReactiveFormsModule,
2203
- platformBrowser.BrowserModule], exports: [FormComponent,
2204
- AlertComponent,
2205
- ExpressionsFormComponent,
2206
- AccordionFormComponent,
2207
- ModalFormComponent,
2208
- TabFormComponent] });
2209
- /** @nocollapse */ DinoFormsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, providers: [
2210
- { provide: i0.ErrorHandler, useClass: AppErrorHandler }
2211
- ], imports: [[
2212
- i2.CommonModule,
2213
- i2$1.FormsModule,
2214
- i2$1.ReactiveFormsModule,
2215
- platformBrowser.BrowserModule,
2216
- ]] });
2217
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, decorators: [{
2218
- type: i0.NgModule,
2219
- args: [{
2220
- declarations: [
2221
- FormComponent,
2222
- AlertComponent,
2223
- ExpressionsFormComponent,
2224
- AccordionFormComponent,
2225
- ModalFormComponent,
2226
- TabFormComponent
2227
- ],
2228
- imports: [
2229
- i2.CommonModule,
2230
- i2$1.FormsModule,
2231
- i2$1.ReactiveFormsModule,
2232
- platformBrowser.BrowserModule,
2233
- ],
2234
- exports: [
2235
- FormComponent,
2236
- AlertComponent,
2237
- ExpressionsFormComponent,
2238
- AccordionFormComponent,
2239
- ModalFormComponent,
2240
- TabFormComponent
2241
- ],
2242
- providers: [
2243
- { provide: i0.ErrorHandler, useClass: AppErrorHandler }
2244
- ]
2245
- }]
2189
+ var DinoFormsModule = /** @class */ (function () {
2190
+ function DinoFormsModule() {
2191
+ }
2192
+ return DinoFormsModule;
2193
+ }());
2194
+ /** @nocollapse */ DinoFormsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2195
+ /** @nocollapse */ DinoFormsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, declarations: [FormComponent,
2196
+ AlertComponent,
2197
+ ExpressionsFormComponent,
2198
+ AccordionFormComponent,
2199
+ ModalFormComponent,
2200
+ TabFormComponent], imports: [i2.CommonModule,
2201
+ i2$1.FormsModule,
2202
+ i2$1.ReactiveFormsModule,
2203
+ platformBrowser.BrowserModule], exports: [FormComponent,
2204
+ AlertComponent,
2205
+ ExpressionsFormComponent,
2206
+ AccordionFormComponent,
2207
+ ModalFormComponent,
2208
+ TabFormComponent] });
2209
+ /** @nocollapse */ DinoFormsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, providers: [
2210
+ { provide: i0.ErrorHandler, useClass: AppErrorHandler }
2211
+ ], imports: [[
2212
+ i2.CommonModule,
2213
+ i2$1.FormsModule,
2214
+ i2$1.ReactiveFormsModule,
2215
+ platformBrowser.BrowserModule,
2216
+ ]] });
2217
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DinoFormsModule, decorators: [{
2218
+ type: i0.NgModule,
2219
+ args: [{
2220
+ declarations: [
2221
+ FormComponent,
2222
+ AlertComponent,
2223
+ ExpressionsFormComponent,
2224
+ AccordionFormComponent,
2225
+ ModalFormComponent,
2226
+ TabFormComponent
2227
+ ],
2228
+ imports: [
2229
+ i2.CommonModule,
2230
+ i2$1.FormsModule,
2231
+ i2$1.ReactiveFormsModule,
2232
+ platformBrowser.BrowserModule,
2233
+ ],
2234
+ exports: [
2235
+ FormComponent,
2236
+ AlertComponent,
2237
+ ExpressionsFormComponent,
2238
+ AccordionFormComponent,
2239
+ ModalFormComponent,
2240
+ TabFormComponent
2241
+ ],
2242
+ providers: [
2243
+ { provide: i0.ErrorHandler, useClass: AppErrorHandler }
2244
+ ]
2245
+ }]
2246
2246
  }] });
2247
2247
 
2248
- /*
2249
- * Public API Surface of dino-forms
2248
+ /*
2249
+ * Public API Surface of dino-forms
2250
2250
  */
2251
2251
 
2252
- /**
2253
- * Generated bundle index. Do not edit.
2252
+ /**
2253
+ * Generated bundle index. Do not edit.
2254
2254
  */
2255
2255
 
2256
2256
  exports.AccordionFormComponent = AccordionFormComponent;