kwikid-forms 0.0.0-watch → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4056 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/drag-drop'), require('@angular/core'), require('@angular/forms'), require('kwikui'), require('lodash'), require('rxjs/operators'), require('jsonpath'), require('@taiga-ui/cdk'), require('@taiga-ui/core'), require('@angular/common'), require('@angular/animations'), require('@angular/common/http')) :
3
+ typeof define === 'function' && define.amd ? define('kwikid-forms', ['exports', '@angular/cdk/drag-drop', '@angular/core', '@angular/forms', 'kwikui', 'lodash', 'rxjs/operators', 'jsonpath', '@taiga-ui/cdk', '@taiga-ui/core', '@angular/common', '@angular/animations', '@angular/common/http'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["kwikid-forms"] = {}, global.ng.cdk.dragDrop, global.ng.core, global.ng.forms, global.i2, global._, global.rxjs.operators, global.jp, global["@taiga-ui/cdk"], global["@taiga-ui/core"], global.ng.common, global.ng.animations, global.ng.common.http));
5
+ })(this, (function (exports, dragDrop, i0, i5, i2, _, operators, jp, cdk, i3, i4, animations, http) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
29
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
+ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
31
+ var jp__default = /*#__PURE__*/_interopDefaultLegacy(jp);
32
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
33
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
34
+
35
+ /******************************************************************************
36
+ Copyright (c) Microsoft Corporation.
37
+
38
+ Permission to use, copy, modify, and/or distribute this software for any
39
+ purpose with or without fee is hereby granted.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
42
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
43
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
44
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
45
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
46
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
47
+ PERFORMANCE OF THIS SOFTWARE.
48
+ ***************************************************************************** */
49
+ /* global Reflect, Promise */
50
+ var extendStatics = function (d, b) {
51
+ extendStatics = Object.setPrototypeOf ||
52
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
53
+ function (d, b) { for (var p in b)
54
+ if (Object.prototype.hasOwnProperty.call(b, p))
55
+ d[p] = b[p]; };
56
+ return extendStatics(d, b);
57
+ };
58
+ function __extends(d, b) {
59
+ if (typeof b !== "function" && b !== null)
60
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
61
+ extendStatics(d, b);
62
+ function __() { this.constructor = d; }
63
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
64
+ }
65
+ var __assign = function () {
66
+ __assign = Object.assign || function __assign(t) {
67
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
68
+ s = arguments[i];
69
+ for (var p in s)
70
+ if (Object.prototype.hasOwnProperty.call(s, p))
71
+ t[p] = s[p];
72
+ }
73
+ return t;
74
+ };
75
+ return __assign.apply(this, arguments);
76
+ };
77
+ function __rest(s, e) {
78
+ var t = {};
79
+ for (var p in s)
80
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
81
+ t[p] = s[p];
82
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
83
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
84
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
85
+ t[p[i]] = s[p[i]];
86
+ }
87
+ return t;
88
+ }
89
+ function __decorate(decorators, target, key, desc) {
90
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
91
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
92
+ r = Reflect.decorate(decorators, target, key, desc);
93
+ else
94
+ for (var i = decorators.length - 1; i >= 0; i--)
95
+ if (d = decorators[i])
96
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
97
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
98
+ }
99
+ function __param(paramIndex, decorator) {
100
+ return function (target, key) { decorator(target, key, paramIndex); };
101
+ }
102
+ function __metadata(metadataKey, metadataValue) {
103
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
104
+ return Reflect.metadata(metadataKey, metadataValue);
105
+ }
106
+ function __awaiter(thisArg, _arguments, P, generator) {
107
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
108
+ return new (P || (P = Promise))(function (resolve, reject) {
109
+ function fulfilled(value) { try {
110
+ step(generator.next(value));
111
+ }
112
+ catch (e) {
113
+ reject(e);
114
+ } }
115
+ function rejected(value) { try {
116
+ step(generator["throw"](value));
117
+ }
118
+ catch (e) {
119
+ reject(e);
120
+ } }
121
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
122
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
123
+ });
124
+ }
125
+ function __generator(thisArg, body) {
126
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
127
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
128
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
129
+ function verb(n) { return function (v) { return step([n, v]); }; }
130
+ function step(op) {
131
+ if (f)
132
+ throw new TypeError("Generator is already executing.");
133
+ while (g && (g = 0, op[0] && (_ = 0)), _)
134
+ try {
135
+ 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)
136
+ return t;
137
+ if (y = 0, t)
138
+ op = [op[0] & 2, t.value];
139
+ switch (op[0]) {
140
+ case 0:
141
+ case 1:
142
+ t = op;
143
+ break;
144
+ case 4:
145
+ _.label++;
146
+ return { value: op[1], done: false };
147
+ case 5:
148
+ _.label++;
149
+ y = op[1];
150
+ op = [0];
151
+ continue;
152
+ case 7:
153
+ op = _.ops.pop();
154
+ _.trys.pop();
155
+ continue;
156
+ default:
157
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
158
+ _ = 0;
159
+ continue;
160
+ }
161
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
162
+ _.label = op[1];
163
+ break;
164
+ }
165
+ if (op[0] === 6 && _.label < t[1]) {
166
+ _.label = t[1];
167
+ t = op;
168
+ break;
169
+ }
170
+ if (t && _.label < t[2]) {
171
+ _.label = t[2];
172
+ _.ops.push(op);
173
+ break;
174
+ }
175
+ if (t[2])
176
+ _.ops.pop();
177
+ _.trys.pop();
178
+ continue;
179
+ }
180
+ op = body.call(thisArg, _);
181
+ }
182
+ catch (e) {
183
+ op = [6, e];
184
+ y = 0;
185
+ }
186
+ finally {
187
+ f = t = 0;
188
+ }
189
+ if (op[0] & 5)
190
+ throw op[1];
191
+ return { value: op[0] ? op[1] : void 0, done: true };
192
+ }
193
+ }
194
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
195
+ if (k2 === undefined)
196
+ k2 = k;
197
+ var desc = Object.getOwnPropertyDescriptor(m, k);
198
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
199
+ desc = { enumerable: true, get: function () { return m[k]; } };
200
+ }
201
+ Object.defineProperty(o, k2, desc);
202
+ }) : (function (o, m, k, k2) {
203
+ if (k2 === undefined)
204
+ k2 = k;
205
+ o[k2] = m[k];
206
+ });
207
+ function __exportStar(m, o) {
208
+ for (var p in m)
209
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
210
+ __createBinding(o, m, p);
211
+ }
212
+ function __values(o) {
213
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
214
+ if (m)
215
+ return m.call(o);
216
+ if (o && typeof o.length === "number")
217
+ return {
218
+ next: function () {
219
+ if (o && i >= o.length)
220
+ o = void 0;
221
+ return { value: o && o[i++], done: !o };
222
+ }
223
+ };
224
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
225
+ }
226
+ function __read(o, n) {
227
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
228
+ if (!m)
229
+ return o;
230
+ var i = m.call(o), r, ar = [], e;
231
+ try {
232
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
233
+ ar.push(r.value);
234
+ }
235
+ catch (error) {
236
+ e = { error: error };
237
+ }
238
+ finally {
239
+ try {
240
+ if (r && !r.done && (m = i["return"]))
241
+ m.call(i);
242
+ }
243
+ finally {
244
+ if (e)
245
+ throw e.error;
246
+ }
247
+ }
248
+ return ar;
249
+ }
250
+ /** @deprecated */
251
+ function __spread() {
252
+ for (var ar = [], i = 0; i < arguments.length; i++)
253
+ ar = ar.concat(__read(arguments[i]));
254
+ return ar;
255
+ }
256
+ /** @deprecated */
257
+ function __spreadArrays() {
258
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
259
+ s += arguments[i].length;
260
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
261
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
262
+ r[k] = a[j];
263
+ return r;
264
+ }
265
+ function __spreadArray(to, from, pack) {
266
+ if (pack || arguments.length === 2)
267
+ for (var i = 0, l = from.length, ar; i < l; i++) {
268
+ if (ar || !(i in from)) {
269
+ if (!ar)
270
+ ar = Array.prototype.slice.call(from, 0, i);
271
+ ar[i] = from[i];
272
+ }
273
+ }
274
+ return to.concat(ar || Array.prototype.slice.call(from));
275
+ }
276
+ function __await(v) {
277
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
278
+ }
279
+ function __asyncGenerator(thisArg, _arguments, generator) {
280
+ if (!Symbol.asyncIterator)
281
+ throw new TypeError("Symbol.asyncIterator is not defined.");
282
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
283
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
284
+ function verb(n) { if (g[n])
285
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
286
+ function resume(n, v) { try {
287
+ step(g[n](v));
288
+ }
289
+ catch (e) {
290
+ settle(q[0][3], e);
291
+ } }
292
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
293
+ function fulfill(value) { resume("next", value); }
294
+ function reject(value) { resume("throw", value); }
295
+ function settle(f, v) { if (f(v), q.shift(), q.length)
296
+ resume(q[0][0], q[0][1]); }
297
+ }
298
+ function __asyncDelegator(o) {
299
+ var i, p;
300
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
301
+ 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; }
302
+ }
303
+ function __asyncValues(o) {
304
+ if (!Symbol.asyncIterator)
305
+ throw new TypeError("Symbol.asyncIterator is not defined.");
306
+ var m = o[Symbol.asyncIterator], i;
307
+ 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);
308
+ 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); }); }; }
309
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
310
+ }
311
+ function __makeTemplateObject(cooked, raw) {
312
+ if (Object.defineProperty) {
313
+ Object.defineProperty(cooked, "raw", { value: raw });
314
+ }
315
+ else {
316
+ cooked.raw = raw;
317
+ }
318
+ return cooked;
319
+ }
320
+ ;
321
+ var __setModuleDefault = Object.create ? (function (o, v) {
322
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
323
+ }) : function (o, v) {
324
+ o["default"] = v;
325
+ };
326
+ function __importStar(mod) {
327
+ if (mod && mod.__esModule)
328
+ return mod;
329
+ var result = {};
330
+ if (mod != null)
331
+ for (var k in mod)
332
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
333
+ __createBinding(result, mod, k);
334
+ __setModuleDefault(result, mod);
335
+ return result;
336
+ }
337
+ function __importDefault(mod) {
338
+ return (mod && mod.__esModule) ? mod : { default: mod };
339
+ }
340
+ function __classPrivateFieldGet(receiver, state, kind, f) {
341
+ if (kind === "a" && !f)
342
+ throw new TypeError("Private accessor was defined without a getter");
343
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
344
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
345
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
346
+ }
347
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
348
+ if (kind === "m")
349
+ throw new TypeError("Private method is not writable");
350
+ if (kind === "a" && !f)
351
+ throw new TypeError("Private accessor was defined without a setter");
352
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
353
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
354
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
+ }
356
+ function __classPrivateFieldIn(state, receiver) {
357
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
358
+ throw new TypeError("Cannot use 'in' operator on non-object");
359
+ return typeof state === "function" ? receiver === state : state.has(receiver);
360
+ }
361
+
362
+ var KwikIDFormsBuilderComponent = /** @class */ (function () {
363
+ function KwikIDFormsBuilderComponent() {
364
+ this.buttonComponent = {
365
+ disabled: false,
366
+ id: "",
367
+ label: "Button",
368
+ showLoader: false,
369
+ styles: "",
370
+ class: "tui-space_right-3 tui-space_bottom-3",
371
+ type: "button",
372
+ appearance: "primary",
373
+ icon: "",
374
+ iconRight: "",
375
+ shape: null,
376
+ size: "m"
377
+ };
378
+ this.progressSegmentedComponent = {
379
+ colors: "tui(--tui-primary)",
380
+ max: "5",
381
+ size: "m",
382
+ value: "2"
383
+ };
384
+ this.inputComponent = {
385
+ case: "default",
386
+ disabled: false,
387
+ focus: false,
388
+ id: "id",
389
+ invalid: false,
390
+ label: "label",
391
+ placeholder: "placeholder",
392
+ type: "text",
393
+ validators: {
394
+ required: true
395
+ }
396
+ };
397
+ this.formGroup = new i5.FormGroup({});
398
+ this.name = "Angular " + i0.VERSION.major;
399
+ this.menu = [
400
+ {
401
+ title: "button",
402
+ key: "button",
403
+ component: i2.KwikUIButtonComponent,
404
+ props: this.buttonComponent
405
+ },
406
+ {
407
+ title: "progress-segmented",
408
+ key: "progress_segmented",
409
+ component: i2.KwikUIProgressSegmentedComponent,
410
+ props: this.progressSegmentedComponent
411
+ },
412
+ {
413
+ title: "input",
414
+ key: "input",
415
+ component: i2.KwikUIInputComponent,
416
+ props: this.inputComponent
417
+ }
418
+ ];
419
+ this.table = [];
420
+ }
421
+ KwikIDFormsBuilderComponent.prototype.ngOnInit = function () {
422
+ var e_1, _a;
423
+ try {
424
+ for (var _b = __values(this.menu), _c = _b.next(); !_c.done; _c = _b.next()) {
425
+ var m = _c.value;
426
+ m.id = this.revisedRandId();
427
+ }
428
+ }
429
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
430
+ finally {
431
+ try {
432
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
433
+ }
434
+ finally { if (e_1) throw e_1.error; }
435
+ }
436
+ };
437
+ KwikIDFormsBuilderComponent.prototype.revisedRandId = function () {
438
+ return Math.random()
439
+ .toString(36)
440
+ .replace(/[^a-z]+/g, "");
441
+ };
442
+ KwikIDFormsBuilderComponent.prototype.handleOnChange = function (event, id, key, idx) {
443
+ var _value = event.target.value;
444
+ this.formGroup.controls[id]["controls"][key].patchValue(_value);
445
+ };
446
+ KwikIDFormsBuilderComponent.prototype.toggleShow = function (id) {
447
+ console.log(id);
448
+ };
449
+ KwikIDFormsBuilderComponent.prototype.drop = function (event) {
450
+ // let item = JSON.parse(JSON.stringify(event));
451
+ if (event.previousContainer !== event.container) {
452
+ console.log("copying");
453
+ // Clone the item that was dropped.
454
+ var clone = _.cloneDeep(event.previousContainer.data[event.previousIndex]);
455
+ clone.id = clone.key + "__" + this.revisedRandId();
456
+ event.previousContainer.data[event.previousIndex] = clone;
457
+ var newFormGroup_1 = new i5.FormGroup({});
458
+ var props_1 = clone.props;
459
+ Object.keys(props_1).forEach(function (key) {
460
+ newFormGroup_1.addControl(key, new i5.FormControl({ value: props_1[key], disabled: false }));
461
+ });
462
+ this.formGroup.addControl(clone.id, newFormGroup_1);
463
+ dragDrop.copyArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
464
+ }
465
+ else {
466
+ console.log("moving");
467
+ dragDrop.moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
468
+ }
469
+ if (event.previousContainer.data) {
470
+ this.menu = this.menu.filter(function (f) { return !f.temp; });
471
+ }
472
+ };
473
+ KwikIDFormsBuilderComponent.prototype.exited = function (event) {
474
+ var currentIdx = event.container.data.findIndex(function (f) { return f.id === event.item.data.id; });
475
+ this.menu.splice(currentIdx + 1, 0, Object.assign(Object.assign({}, event.item.data), { temp: true }));
476
+ };
477
+ KwikIDFormsBuilderComponent.prototype.entered = function () {
478
+ this.menu = this.menu.filter(function (f) { return !f.temp; });
479
+ };
480
+ KwikIDFormsBuilderComponent.prototype.isNumber = function (val) {
481
+ return typeof val;
482
+ };
483
+ KwikIDFormsBuilderComponent.prototype.removeElement = function (idx, id) {
484
+ this.formGroup.removeControl(id);
485
+ this.table.splice(idx, 1);
486
+ };
487
+ KwikIDFormsBuilderComponent.prototype.getJSON = function () {
488
+ var e_2, _a;
489
+ try {
490
+ for (var _b = __values(this.table), _c = _b.next(); !_c.done; _c = _b.next()) {
491
+ var t = _c.value;
492
+ t.props = this.formGroup.getRawValue()[t.id];
493
+ }
494
+ }
495
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
496
+ finally {
497
+ try {
498
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
499
+ }
500
+ finally { if (e_2) throw e_2.error; }
501
+ }
502
+ console.log(this.table);
503
+ };
504
+ return KwikIDFormsBuilderComponent;
505
+ }());
506
+ /** @nocollapse */ KwikIDFormsBuilderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsBuilderComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
507
+ /** @nocollapse */ KwikIDFormsBuilderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsBuilderComponent, selector: "kwikid-forms-builder", ngImport: i0__namespace, template: "<!-- <div>{{ name }}</div>\r\n<p>Start editing to see some magic happen :)</p>\r\n\r\n<button (click)=\"getJSON()\">Get JSON</button>\r\n\r\n<div class=\"drap-copy\">\r\n <div>\r\n <ul\r\n class=\"menu\"\r\n cdkDropList\r\n #menuList=\"cdkDropList\"\r\n [cdkDropListData]=\"menu\"\r\n cdkDropListSortingDisabled\r\n [cdkDropListConnectedTo]=\"[tableList]\"\r\n (cdkDropListDropped)=\"drop($event)\"\r\n (cdkDropListExited)=\"exited($event)\"\r\n (cdkDropListEntered)=\"entered()\"\r\n >\r\n <li class=\"item\" *ngFor=\"let item of menu\" cdkDrag [cdkDragData]=\"item\">\r\n <div class=\"item\" *cdkDragPlaceholder>\r\n <a>{{ item.title }}</a>\r\n </div>\r\n <ng-container *ngComponentOutlet=\"item.component\"> </ng-container>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <div\r\n class=\"table\"\r\n cdkDropList\r\n #tableList=\"cdkDropList\"\r\n [cdkDropListData]=\"table\"\r\n (cdkDropListDropped)=\"drop($event)\"\r\n >\r\n <div class=\"content\">\r\n <div>\r\n <div class=\"item\" *ngFor=\"let item of table; let idx = index\" cdkDrag>\r\n <ng-container *ngComponentOutlet=\"item.component\"> </ng-container>\r\n <div class=\"item-header\">\r\n <p>{{ idx }}--{{ item.title }}</p>\r\n <button (click)=\"removeElement(idx, item.id)\">Remove</button>\r\n </div>\r\n <div class=\"desc\">\r\n <div>id - {{ item.id }}</div>\r\n <div>key - {{ item.key }}</div>\r\n </div>\r\n <ng-container\r\n *ngTemplateOutlet=\"formModal; context: item\"\r\n ></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #formModal let-component=\"component\" let-props=\"props\" let-id=\"id\">\r\n <div class=\"field_editor\">\r\n <div *ngFor=\"let i of props | keyvalue; let idx = index\">\r\n <div class=\"formModalInputGroup\">\r\n <label>{{ i.key }}</label>\r\n <input\r\n value=\"{{ i.value }}\"\r\n (keyup)=\"handleOnChange($event, id, i.key, idx)\"\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template> -->\r\n", styles: [":host{--padding: 1rem;--border: 1px solid #e8e8e8}ul,li{list-style:none}*{margin:0;padding:0}p{font-family:Lato}.item{margin-bottom:12px;padding:var(--padding);border:var(--border);background:#fff;cursor:move;display:flex;flex-direction:column;grid-row-gap:.5rem;row-gap:.5rem}.item-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;align-content:center;grid-column-gap:.5rem;column-gap:.5rem}.table,.menu{padding:var(--padding)}.drap-copy{display:flex;border:var(--border)}.drap-copy>div{flex:1}.drap-copy>div:first-child{border-right:var(--border)}.desc{display:flex;justify-content:space-between;font-size:1em;color:#00000073}.field_editor{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;align-content:center;grid-row-gap:.5rem;row-gap:.5rem}.formModalInputGroup{display:flex;flex-direction:row;align-items:center;justify-content:space-between;align-content:center;grid-column-gap:.5rem;column-gap:.5rem}\n"] });
508
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsBuilderComponent, decorators: [{
509
+ type: i0.Component,
510
+ args: [{
511
+ selector: "kwikid-forms-builder",
512
+ templateUrl: "./builder.component.html",
513
+ styleUrls: ["./builder.component.scss"]
514
+ }]
515
+ }], ctorParameters: function () { return []; } });
516
+
517
+ var EActionKey;
518
+ (function (EActionKey) {
519
+ EActionKey["SET_VALUE"] = "SET_VALUE";
520
+ EActionKey["FIELD_MESSAGE_SHOW"] = "FIELD_MESSAGE_SHOW";
521
+ EActionKey["FIELD_MESSAGES_HIDE"] = "FIELD_MESSAGES_HIDE";
522
+ EActionKey["FIELD_ERROR_SHOW"] = "FIELD_ERROR_SHOW";
523
+ EActionKey["FIELD_ERROR_HIDE"] = "FIELD_ERROR_HIDE";
524
+ EActionKey["FIELD_SHOW"] = "FIELD_SHOW";
525
+ EActionKey["FIELD_HIDE"] = "FIELD_HIDE";
526
+ EActionKey["FIELD_ENABLE"] = "FIELD_ENABLE";
527
+ EActionKey["FIELD_DISABLE"] = "FIELD_DISABLE";
528
+ EActionKey["FIELD_RESET"] = "FIELD_RESET";
529
+ EActionKey["HANDLE_CONNECTED_ELEMENTS"] = "HANDLE_CONNECTED_ELEMENTS";
530
+ EActionKey["CUSTOM"] = "CUSTOM";
531
+ })(EActionKey || (EActionKey = {}));
532
+
533
+ var EApiStatusType;
534
+ (function (EApiStatusType) {
535
+ EApiStatusType["DEFAULT"] = "default";
536
+ EApiStatusType["LOADING"] = "loading";
537
+ EApiStatusType["SUCCESS"] = "success";
538
+ EApiStatusType["FAILED"] = "failed";
539
+ })(EApiStatusType || (EApiStatusType = {}));
540
+
541
+ var EPatternKey;
542
+ (function (EPatternKey) {
543
+ EPatternKey["CUSTOM"] = "CUSTOM";
544
+ EPatternKey["IS_PAN_NUMBER"] = "IS_PAN_NUMBER";
545
+ EPatternKey["IS_AADHAAR_NUMBER"] = "IS_AADHAAR_NUMBER";
546
+ EPatternKey["IS_EMPTY"] = "IS_EMPTY";
547
+ EPatternKey["IS_NOT_EMPTY"] = "IS_NOT_EMPTY";
548
+ EPatternKey["IS_EMAIL"] = "IS_EMAIL";
549
+ EPatternKey["IS_NUMBER"] = "IS_NUMBER";
550
+ EPatternKey["IS_INTEGER"] = "IS_INTEGER";
551
+ EPatternKey["IS_URL"] = "IS_URL";
552
+ EPatternKey["IS_ALPHA"] = "IS_ALPHA";
553
+ EPatternKey["IS_ALPHANUMERIC"] = "IS_ALPHANUMERIC";
554
+ EPatternKey["IS_UPPERCASE"] = "IS_UPPERCASE";
555
+ EPatternKey["IS_LOWERCASE"] = "IS_LOWERCASE";
556
+ EPatternKey["IS_IP_ADDRESS"] = "IS_IP_ADDRESS";
557
+ EPatternKey["IS_JSON"] = "IS_JSON";
558
+ EPatternKey["IS_HTML"] = "IS_HTML";
559
+ EPatternKey["IS_TRUE"] = "IS_TRUE";
560
+ })(EPatternKey || (EPatternKey = {}));
561
+ var EPattern;
562
+ (function (EPattern) {
563
+ EPattern["IS_EMPTY"] = "^$";
564
+ EPattern["IS_PAN_NUMBER"] = "^[A-Z]{5}[[0-9]{4}[A-Z]{1}$";
565
+ EPattern["IS_AADHAAR_NUMBER"] = "^[0-9]{12}$";
566
+ EPattern["IS_NOT_EMPTY"] = "^.+$";
567
+ EPattern["IS_EMAIL"] = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$";
568
+ EPattern["IS_NUMBER"] = "^[+-]?d+(.d+)?$";
569
+ EPattern["IS_INTEGER"] = "^[+-]?d+$";
570
+ EPattern["IS_URL"] = "^(?:http(s)?://)?[w.-]+(?:.[w.-]+)+[w-._~:/?#[]@!$&'()*+,;=.]+$";
571
+ EPattern["IS_ALPHA"] = "^[a-zA-Z]+$";
572
+ EPattern["IS_ALPHANUMERIC"] = "^[a-zA-Z0-9]+$";
573
+ EPattern["IS_UPPERCASE"] = "^[A-Z]+$";
574
+ EPattern["IS_LOWERCASE"] = "^[a-z]+$";
575
+ EPattern["IS_IP_ADDRESS"] = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
576
+ EPattern["IS_JSON"] = "^\\s*({(.|\\s)}|[(.|\\s)])\\s*$";
577
+ EPattern["IS_HTML"] = "^<([a-z]+)([^<]+)(?:>(.)</\\1>|\\s+/>)$";
578
+ EPattern["IS_TRUE"] = "true";
579
+ })(EPattern || (EPattern = {}));
580
+ var EMessageType;
581
+ (function (EMessageType) {
582
+ EMessageType["DEFAULT"] = "default";
583
+ EMessageType["ERROR"] = "error";
584
+ EMessageType["SUCCESS"] = "success";
585
+ EMessageType["WARNING"] = "warning";
586
+ })(EMessageType || (EMessageType = {}));
587
+
588
+ /**
589
+ * A function that logs the execution of a method.
590
+ * @param {any} target - The object the method belongs to.
591
+ * @param {string} propertyKey - The name of the method.
592
+ * @param {PropertyDescriptor} descriptor - The property descriptor for the method.
593
+ */
594
+ function log(target, propertyKey, descriptor) {
595
+ // save a reference to the original method
596
+ var originalMethod = descriptor.value;
597
+ // update the descriptor value with a new function that will log and execute the original method
598
+ descriptor.value = function () {
599
+ var args = [];
600
+ for (var _i = 0; _i < arguments.length; _i++) {
601
+ args[_i] = arguments[_i];
602
+ }
603
+ console.group("Logging Method"); // start a new logging group
604
+ console.time("Execution Time:"); // start a timer
605
+ var result; // declare result variable
606
+ try {
607
+ // execute the original method and save the result
608
+ result = originalMethod.apply(this, args);
609
+ }
610
+ catch (error) {
611
+ // if an error is thrown, log the error and throw it again
612
+ logSyncMethodError(target.constructor.name, propertyKey, args, error);
613
+ console.timeEnd("Execution Time:"); // stop the timer
614
+ console.groupEnd(); // end the logging group
615
+ throw error;
616
+ }
617
+ // if the result is a Promise, handle it as an async method
618
+ if (result instanceof Promise) {
619
+ result = result
620
+ .then(function (resolvedValue) {
621
+ // on success, log the resolved value and return it
622
+ logAsyncMethod(target.constructor.name, propertyKey, args, resolvedValue);
623
+ console.timeEnd("Execution Time:"); // stop the timer
624
+ console.groupEnd(); // end the logging group
625
+ return resolvedValue;
626
+ })
627
+ .catch(function (error) {
628
+ // on error, log the error and throw it again
629
+ logAsyncMethodError(target.constructor.name, propertyKey, args, error);
630
+ console.timeEnd("Execution Time:"); // stop the timer
631
+ console.groupEnd(); // end the logging group
632
+ throw error;
633
+ });
634
+ }
635
+ else {
636
+ // if the result is not a Promise, handle it as a sync method
637
+ logSyncMethod(target.constructor.name, propertyKey, args, result);
638
+ console.timeEnd("Execution Time:");
639
+ console.groupEnd();
640
+ }
641
+ return result;
642
+ };
643
+ }
644
+ /**
645
+ * This function logs a sync method's information to the console.
646
+ * @param {string} className - The name of the class where the method belongs.
647
+ * @param {string} methodName - The name of the method being called.
648
+ * @param {any[]} args - An array of arguments passed to the method.
649
+ * @param {any} result - The result of the method.
650
+ */
651
+ function logSyncMethod(className, methodName, args, result) {
652
+ console.log("%cType: Sync Method -", "color: #0d47a1; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nReturn:", result);
653
+ }
654
+ /**
655
+ * Logs an error that occurred during the execution of a synchronous method.
656
+ * @param {string} className - The name of the class the method belongs to.
657
+ * @param {string} methodName - The name of the method.
658
+ * @param {any[]} args - The arguments passed to the method.
659
+ * @param {Error} error - The error that occurred.
660
+ */
661
+ function logSyncMethodError(className, methodName, args, error) {
662
+ console.log("%cType: Sync Method -", "color: #0d47a1; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nError:", error);
663
+ }
664
+ /**
665
+ * Logs the result of the execution of an asynchronous method.
666
+ * @param {string} className - The name of the class the method belongs to.
667
+ * @param {string} methodName - The name of the method.
668
+ * @param {any[]} args - The arguments passed to the method.
669
+ * @param {any} result - The result of the method execution.
670
+ */
671
+ function logAsyncMethod(className, methodName, args, result) {
672
+ console.log("%cType: Async Method -", "color: #1565c0; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nReturn:", result);
673
+ }
674
+ /**
675
+ * Logs an error that occurred during the execution of an asynchronous method.
676
+ * @param {string} className - The name of the class the method belongs to.
677
+ * @param {string} methodName - The name of the method.
678
+ * @param {any[]} args - The arguments passed to the method.
679
+ * @param {Error} error - The error that occurred.
680
+ */
681
+ function logAsyncMethodError(className, methodName, args, error) {
682
+ console.log("%cType: Async Method -", "color: #1565c0; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nError:", error);
683
+ }
684
+
685
+ var hasKey$2 = function (object, key) {
686
+ return object.hasOwnProperty(key);
687
+ };
688
+ var isEmpty$1 = function (value) {
689
+ if (value === "" || value === undefined || value === null) {
690
+ return true;
691
+ }
692
+ else if (value &&
693
+ Object.keys(value).length === 0 &&
694
+ Object.getPrototypeOf(value) === Object.prototype) {
695
+ return true;
696
+ }
697
+ else if (Array.isArray(value)) {
698
+ if (value.length === 0) {
699
+ return true;
700
+ }
701
+ else {
702
+ return false;
703
+ }
704
+ }
705
+ else {
706
+ return false;
707
+ }
708
+ };
709
+ var isNotEmpty$1 = function (value) {
710
+ return !isEmpty$1(value);
711
+ };
712
+ var handleJPQueryResponse$1 = function (value) {
713
+ /**
714
+ * jp.query doesn't always return an array with one element
715
+ * so directly can't access with [0], need to check conditionally
716
+ */
717
+ if (Array.isArray(value)) {
718
+ if (value.length > 0) {
719
+ value = value[0];
720
+ }
721
+ else if (value.length === 0) {
722
+ value = "";
723
+ }
724
+ }
725
+ return value;
726
+ };
727
+ var jpQueryWrapper$1 = function (obj, key) {
728
+ return handleJPQueryResponse$1(jp__default["default"].query(obj, key));
729
+ };
730
+ var isSingleForm = function (formsList) {
731
+ return formsList.length === 1;
732
+ };
733
+
734
+ var EFieldType;
735
+ (function (EFieldType) {
736
+ EFieldType["TITLE"] = "title";
737
+ EFieldType["TEXT"] = "text";
738
+ EFieldType["CHECKBOX"] = "checkbox";
739
+ EFieldType["NUMBER"] = "number";
740
+ EFieldType["DATE"] = "date";
741
+ EFieldType["PHONE"] = "phone";
742
+ EFieldType["RADIO"] = "radio";
743
+ EFieldType["DROPDOWN_WITH_SEARCH"] = "dropdown-with-search";
744
+ EFieldType["API_CALL"] = "api-call";
745
+ EFieldType["OTP"] = "otp";
746
+ EFieldType["AADHAAR_NUMBER"] = "aadhaar-number";
747
+ })(EFieldType || (EFieldType = {}));
748
+
749
+ var hasKey$1 = function (object, key) {
750
+ return object.hasOwnProperty(key);
751
+ };
752
+ var hasPath = function (object, path) {
753
+ return ___default["default"].has(object, path);
754
+ };
755
+ var isEmptyString = function (value) {
756
+ return value === "";
757
+ };
758
+ var isUndefined = function (value) {
759
+ return value === undefined;
760
+ };
761
+ var isNull = function (value) {
762
+ return value === null;
763
+ };
764
+ var isEmptyObject = function (object) {
765
+ return (object &&
766
+ Object.keys(object).length === 0 &&
767
+ Object.getPrototypeOf(object) === Object.prototype);
768
+ };
769
+ var isEmptyArray = function (arr) {
770
+ return arr.length === 0;
771
+ };
772
+ var isEmpty = function (value) {
773
+ if (isEmptyString(value) || isUndefined(value) || isNull(value)) {
774
+ return true;
775
+ }
776
+ else if (isEmptyObject(value)) {
777
+ return true;
778
+ }
779
+ else if (Array.isArray(value)) {
780
+ if (isEmptyArray(value)) {
781
+ return true;
782
+ }
783
+ else {
784
+ return false;
785
+ }
786
+ }
787
+ else {
788
+ return false;
789
+ }
790
+ };
791
+ var isNotEmpty = function (value) {
792
+ return !isEmpty(value);
793
+ };
794
+ var isEmptyBrowserStorageValue = function (value) {
795
+ return isNull(value) && isUndefined(value);
796
+ };
797
+ var isNotEmptyBrowserStorageValue = function (value) {
798
+ return !isEmptyBrowserStorageValue(value);
799
+ };
800
+ var handleJPQueryResponse = function (value) {
801
+ /**
802
+ * jp.query doesn't always return an array with one element
803
+ * so directly can't access with [0], need to check conditionally
804
+ */
805
+ if (Array.isArray(value)) {
806
+ if (value.length > 0) {
807
+ value = value[0];
808
+ }
809
+ else if (value.length === 0) {
810
+ value = "";
811
+ }
812
+ }
813
+ else {
814
+ value = "";
815
+ }
816
+ return value;
817
+ };
818
+ var jpQueryWrapper = function (obj, key) {
819
+ return handleJPQueryResponse(jp__default["default"].query(obj, key));
820
+ };
821
+ var replaceString = function (str, find, replace) {
822
+ return str.replace(new RegExp(find, "g"), replace);
823
+ };
824
+ var setFieldKeyValue = function (field, path, value) {
825
+ return ___default["default"].set(field, path, value);
826
+ };
827
+ var setValueToObject = function (object, path, value) {
828
+ return ___default["default"].set(object, path, value);
829
+ };
830
+ var formatValue = function (field, fieldValue) {
831
+ var fieldType = field.type;
832
+ var value;
833
+ if (isNotEmpty(fieldValue)) {
834
+ switch (fieldType) {
835
+ case EFieldType.DATE:
836
+ var splitDate = fieldValue.split("-");
837
+ value = new cdk.TuiDay(Number(splitDate[2]), // Year
838
+ Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
839
+ Number(splitDate[0]) // Day
840
+ );
841
+ break;
842
+ case EFieldType.RADIO:
843
+ var fieldRadio = field;
844
+ value = fieldRadio.options.find(function (item) {
845
+ return item.label === fieldValue;
846
+ });
847
+ break;
848
+ case EFieldType.CHECKBOX:
849
+ value = Boolean(fieldValue);
850
+ break;
851
+ default:
852
+ value = fieldValue;
853
+ break;
854
+ }
855
+ }
856
+ else {
857
+ value = fieldValue;
858
+ }
859
+ return value;
860
+ };
861
+ var setEmptyValue = function (field) {
862
+ var fieldType = field.type;
863
+ var value;
864
+ switch (fieldType) {
865
+ case EFieldType.CHECKBOX:
866
+ value = false;
867
+ break;
868
+ case EFieldType.NUMBER:
869
+ value = null;
870
+ break;
871
+ case EFieldType.DATE:
872
+ value = null;
873
+ break;
874
+ default:
875
+ value = "";
876
+ break;
877
+ }
878
+ return value;
879
+ };
880
+
881
+ var Condition = /** @class */ (function () {
882
+ function Condition(condition, rulesMapping) {
883
+ this._condition = condition;
884
+ this._rulesMapping = rulesMapping;
885
+ }
886
+ Condition.prototype.parseKeys = function (condition, rulesEvaluationMapping) {
887
+ Object.keys(rulesEvaluationMapping).forEach(function (key) {
888
+ condition = replaceString(condition, key, rulesEvaluationMapping[key]);
889
+ });
890
+ return condition;
891
+ };
892
+ Condition.prototype.parseOperators = function (condition) {
893
+ return condition.replace(/AND|OR|NOT|XOR|NAND|NOR|XNOR/g, function (match) {
894
+ switch (match) {
895
+ case "AND":
896
+ return "&&";
897
+ case "OR":
898
+ return "||";
899
+ case "NOT":
900
+ return "!";
901
+ case "XOR":
902
+ return "^";
903
+ case "NAND":
904
+ return "!&";
905
+ case "NOR":
906
+ return "!|";
907
+ case "XNOR":
908
+ return "!^";
909
+ default:
910
+ return match;
911
+ }
912
+ });
913
+ };
914
+ Condition.prototype.evaluate = function () {
915
+ this._condition = this.parseKeys(this._condition, this._rulesMapping);
916
+ this._condition = this.parseOperators(this._condition);
917
+ return eval(this._condition);
918
+ };
919
+ return Condition;
920
+ }());
921
+ __decorate([
922
+ log
923
+ ], Condition.prototype, "evaluate", null);
924
+
925
+ var Actions = /** @class */ (function () {
926
+ function Actions(action, field, ruleMapping, allFormsData, formData, previousFormData, takeAction) {
927
+ this._action = action;
928
+ this._field = field;
929
+ this._ruleMapping = ruleMapping;
930
+ this._allFormsData = allFormsData;
931
+ this._formData = formData;
932
+ this._previousFormData = previousFormData;
933
+ this._takeAction = takeAction;
934
+ }
935
+ Actions.prototype.execute = function () {
936
+ return __awaiter(this, void 0, void 0, function () {
937
+ var condition, actionSuccess;
938
+ return __generator(this, function (_a) {
939
+ condition = new Condition(this._action.condition, this._ruleMapping);
940
+ actionSuccess = condition.evaluate();
941
+ if (actionSuccess) {
942
+ return [2 /*return*/, this._takeAction(this._action, this._field, this._allFormsData, this._formData, this._previousFormData)];
943
+ }
944
+ return [2 /*return*/];
945
+ });
946
+ });
947
+ };
948
+ return Actions;
949
+ }());
950
+ __decorate([
951
+ log
952
+ ], Actions.prototype, "execute", null);
953
+
954
+ var ERuleKey;
955
+ (function (ERuleKey) {
956
+ ERuleKey["OBJECT_PATH_EXISTS"] = "OBJECT_PATH_EXISTS";
957
+ ERuleKey["VALUE_CHECK"] = "VALUE_CHECK";
958
+ ERuleKey["VALUE_CHANGE"] = "VALUE_CHANGE";
959
+ })(ERuleKey || (ERuleKey = {}));
960
+
961
+ var ESourceKey;
962
+ (function (ESourceKey) {
963
+ ESourceKey["FIELD_CONFIG"] = "FIELD_CONFIG";
964
+ ESourceKey["FORM_DATA"] = "FORM_DATA";
965
+ ESourceKey["PREVIOUS_FORM_DATA"] = "PREVIOUS_FORM_DATA";
966
+ ESourceKey["ALL_FORMS_DATA"] = "ALL_FORMS_DATA";
967
+ ESourceKey["BROWSER_STORAGE"] = "BROWSER_STORAGE";
968
+ ESourceKey["PREDEFINED"] = "PREDEFINED";
969
+ ESourceKey["CUSTOM"] = "CUSTOM";
970
+ })(ESourceKey || (ESourceKey = {}));
971
+ var EBrowserStorageType;
972
+ (function (EBrowserStorageType) {
973
+ EBrowserStorageType["LOCAL_STORAGE"] = "LOCAL_STORAGE";
974
+ EBrowserStorageType["SESSION_STORAGE"] = "SESSION_STORAGE";
975
+ })(EBrowserStorageType || (EBrowserStorageType = {}));
976
+
977
+ var Sources = /** @class */ (function () {
978
+ function Sources(field, formData, previousFormData, allFormsData) {
979
+ this._field = field;
980
+ this._formData = formData;
981
+ this._previousFormData = previousFormData;
982
+ this._allFormsData = allFormsData;
983
+ }
984
+ Object.defineProperty(Sources.prototype, "formData", {
985
+ get: function () {
986
+ return this._formData;
987
+ },
988
+ set: function (value) {
989
+ this._formData = value;
990
+ },
991
+ enumerable: false,
992
+ configurable: true
993
+ });
994
+ Object.defineProperty(Sources.prototype, "previousFormData", {
995
+ get: function () {
996
+ return this._previousFormData;
997
+ },
998
+ set: function (value) {
999
+ this._previousFormData = value;
1000
+ },
1001
+ enumerable: false,
1002
+ configurable: true
1003
+ });
1004
+ Object.defineProperty(Sources.prototype, "allFormsData", {
1005
+ get: function () {
1006
+ return this._allFormsData;
1007
+ },
1008
+ set: function (value) {
1009
+ this._allFormsData = value;
1010
+ },
1011
+ enumerable: false,
1012
+ configurable: true
1013
+ });
1014
+ Object.defineProperty(Sources.prototype, "field", {
1015
+ get: function () {
1016
+ return this._field;
1017
+ },
1018
+ set: function (value) {
1019
+ this._field = value;
1020
+ },
1021
+ enumerable: false,
1022
+ configurable: true
1023
+ });
1024
+ Sources.prototype.getValueFromFieldConfig = function (path) {
1025
+ var value = "";
1026
+ if (isNotEmpty(path)) {
1027
+ value = jpQueryWrapper(this._field, path);
1028
+ }
1029
+ else {
1030
+ value = setEmptyValue(this._field);
1031
+ }
1032
+ return value;
1033
+ };
1034
+ Sources.prototype.getValueFromFormData = function (path) {
1035
+ var value;
1036
+ value = jpQueryWrapper(this._formData, path);
1037
+ return value;
1038
+ };
1039
+ Sources.prototype.getValueFromPreviousFormData = function (path) {
1040
+ var value;
1041
+ value = jpQueryWrapper(this._previousFormData, path);
1042
+ return value;
1043
+ };
1044
+ Sources.prototype.getValueFromAllFormsData = function (path) {
1045
+ var value;
1046
+ value = jpQueryWrapper(this._allFormsData, path);
1047
+ return value;
1048
+ };
1049
+ Sources.prototype.getValueFromBrowserStorage = function (type, key) {
1050
+ var value = "";
1051
+ switch (type) {
1052
+ case EBrowserStorageType.LOCAL_STORAGE:
1053
+ value = isNotEmptyBrowserStorageValue(localStorage.getItem(key))
1054
+ ? localStorage.getItem(key)
1055
+ : "";
1056
+ break;
1057
+ case EBrowserStorageType.SESSION_STORAGE:
1058
+ value = isNotEmptyBrowserStorageValue(sessionStorage.getItem(key))
1059
+ ? sessionStorage.getItem(key)
1060
+ : "";
1061
+ break;
1062
+ default:
1063
+ value = "";
1064
+ break;
1065
+ }
1066
+ return value;
1067
+ };
1068
+ Sources.prototype.getValueFromSource = function (source) {
1069
+ var value = "";
1070
+ switch (source.key) {
1071
+ case ESourceKey.FIELD_CONFIG:
1072
+ value = this.getValueFromFieldConfig(source.props.path);
1073
+ break;
1074
+ case ESourceKey.FORM_DATA:
1075
+ value = this.getValueFromFormData(source.props.path);
1076
+ break;
1077
+ case ESourceKey.ALL_FORMS_DATA:
1078
+ value = this.getValueFromAllFormsData(source.props.path);
1079
+ break;
1080
+ case ESourceKey.PREVIOUS_FORM_DATA:
1081
+ value = this.getValueFromPreviousFormData(source.props.path);
1082
+ break;
1083
+ case ESourceKey.BROWSER_STORAGE:
1084
+ value = this.getValueFromBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key);
1085
+ break;
1086
+ case ESourceKey.PREDEFINED:
1087
+ value = source.value;
1088
+ break;
1089
+ default:
1090
+ value = "";
1091
+ break;
1092
+ }
1093
+ return value;
1094
+ };
1095
+ Sources.prototype.setValueToFieldConfig = function (path, value) {
1096
+ this._field = setValueToObject(this._field, path, value);
1097
+ };
1098
+ Sources.prototype.setValueToFormData = function (path, value) {
1099
+ this._formData = setValueToObject(this._formData, path, value);
1100
+ };
1101
+ Sources.prototype.setValueToAllFormsData = function (path, value) {
1102
+ this._allFormsData = setValueToObject(this._allFormsData, path, value);
1103
+ };
1104
+ Sources.prototype.setValueToPreviousFromData = function (path, value) {
1105
+ this._previousFormData = setValueToObject(this._previousFormData, path, value);
1106
+ };
1107
+ Sources.prototype.setValueToBrowserStorage = function (type, key, value) {
1108
+ switch (type) {
1109
+ case EBrowserStorageType.LOCAL_STORAGE:
1110
+ localStorage.setItem(key, value);
1111
+ break;
1112
+ case EBrowserStorageType.SESSION_STORAGE:
1113
+ sessionStorage.setItem(key, value);
1114
+ break;
1115
+ default:
1116
+ break;
1117
+ }
1118
+ };
1119
+ Sources.prototype.setValueToSource = function (source, value) {
1120
+ return __awaiter(this, void 0, void 0, function () {
1121
+ var _a;
1122
+ return __generator(this, function (_b) {
1123
+ switch (_b.label) {
1124
+ case 0:
1125
+ _a = source.key;
1126
+ switch (_a) {
1127
+ case ESourceKey.FIELD_CONFIG: return [3 /*break*/, 1];
1128
+ case ESourceKey.FORM_DATA: return [3 /*break*/, 2];
1129
+ case ESourceKey.ALL_FORMS_DATA: return [3 /*break*/, 3];
1130
+ case ESourceKey.PREVIOUS_FORM_DATA: return [3 /*break*/, 4];
1131
+ case ESourceKey.BROWSER_STORAGE: return [3 /*break*/, 5];
1132
+ }
1133
+ return [3 /*break*/, 7];
1134
+ case 1:
1135
+ this._field = this.setValueToFieldConfig(source.props.path, value);
1136
+ return [3 /*break*/, 8];
1137
+ case 2:
1138
+ this._formData = this.setValueToFormData(source.props.path, value);
1139
+ return [3 /*break*/, 8];
1140
+ case 3:
1141
+ this._allFormsData = this.setValueToAllFormsData(source.props.path, value);
1142
+ return [3 /*break*/, 8];
1143
+ case 4:
1144
+ this._previousFormData = this.setValueToPreviousFromData(source.props.path, value);
1145
+ return [3 /*break*/, 8];
1146
+ case 5: return [4 /*yield*/, this.setValueToBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key, value)];
1147
+ case 6:
1148
+ _b.sent();
1149
+ return [3 /*break*/, 8];
1150
+ case 7: return [3 /*break*/, 8];
1151
+ case 8: return [2 /*return*/];
1152
+ }
1153
+ });
1154
+ });
1155
+ };
1156
+ return Sources;
1157
+ }());
1158
+ __decorate([
1159
+ log
1160
+ ], Sources.prototype, "getValueFromSource", null);
1161
+ __decorate([
1162
+ log
1163
+ ], Sources.prototype, "setValueToSource", null);
1164
+
1165
+ var Rules = /** @class */ (function () {
1166
+ function Rules(rules, field, formData, previousFormData, allFormsData) {
1167
+ this._field = field;
1168
+ this._formData = formData;
1169
+ this._previousFormData = previousFormData;
1170
+ this._allFormsData = allFormsData;
1171
+ this._rules = rules;
1172
+ }
1173
+ Rules.prototype.evaluate = function (rule) {
1174
+ var ruleType = rule.key;
1175
+ var ruleEvaluationStatus = false;
1176
+ if (this._field.type === "radio") {
1177
+ this._formData[this._field.key] = this._formData[this._field.key].label;
1178
+ }
1179
+ var source = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
1180
+ switch (ruleType) {
1181
+ case ERuleKey.OBJECT_PATH_EXISTS:
1182
+ var ruleObjectPathExists = rule;
1183
+ var ruleObjectPathExistsObject = ruleObjectPathExists.props.object;
1184
+ var ruleObjectPathExistsPath = ruleObjectPathExists.props.path;
1185
+ switch (ruleObjectPathExistsObject) {
1186
+ case ESourceKey.ALL_FORMS_DATA:
1187
+ ruleEvaluationStatus = hasPath(this._allFormsData, ruleObjectPathExistsPath);
1188
+ break;
1189
+ case ESourceKey.FORM_DATA:
1190
+ ruleEvaluationStatus = hasPath(this._formData, ruleObjectPathExistsPath);
1191
+ break;
1192
+ case ESourceKey.PREVIOUS_FORM_DATA:
1193
+ ruleEvaluationStatus = hasPath(this._previousFormData, ruleObjectPathExistsPath);
1194
+ break;
1195
+ case ESourceKey.FIELD_CONFIG:
1196
+ ruleEvaluationStatus = hasPath(this._field, ruleObjectPathExistsPath);
1197
+ break;
1198
+ default:
1199
+ ruleEvaluationStatus = false;
1200
+ break;
1201
+ }
1202
+ break;
1203
+ case ERuleKey.VALUE_CHECK:
1204
+ var ruleValueCheck = rule;
1205
+ var ruleValueCheckSource = ruleValueCheck.props.value.source;
1206
+ var ruleValueCheckValue = source.getValueFromSource(ruleValueCheckSource);
1207
+ if (ruleValueCheck.props.pattern.key === EPatternKey.CUSTOM) {
1208
+ var re = new RegExp(ruleValueCheck.props.pattern.pattern);
1209
+ }
1210
+ else {
1211
+ var re = new RegExp(EPattern[ruleValueCheck.props.pattern.key]);
1212
+ }
1213
+ ruleEvaluationStatus = re.test(ruleValueCheckValue);
1214
+ break;
1215
+ case ERuleKey.VALUE_CHANGE:
1216
+ var ruleValueChange = rule;
1217
+ var ruleValueChangeCurrentSource = ruleValueChange.props.value.current.source;
1218
+ var ruleValueChangePreviousSource = ruleValueChange.props.value.previous.source;
1219
+ var previousValue = source.getValueFromSource(ruleValueChangePreviousSource);
1220
+ var currentValue = source.getValueFromSource(ruleValueChangeCurrentSource);
1221
+ ruleEvaluationStatus = previousValue === currentValue;
1222
+ break;
1223
+ default:
1224
+ break;
1225
+ }
1226
+ return ruleEvaluationStatus;
1227
+ };
1228
+ Rules.prototype.mapping = function () {
1229
+ var e_1, _a, _b;
1230
+ var rulesEvaluationMapping = {};
1231
+ try {
1232
+ for (var _c = __values(this._rules), _d = _c.next(); !_d.done; _d = _c.next()) {
1233
+ var rule = _d.value;
1234
+ var ruleEvaluationStatus = this.evaluate(rule);
1235
+ rulesEvaluationMapping = Object.assign(Object.assign({}, rulesEvaluationMapping), (_b = {}, _b[rule.id] = ruleEvaluationStatus, _b));
1236
+ }
1237
+ }
1238
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1239
+ finally {
1240
+ try {
1241
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1242
+ }
1243
+ finally { if (e_1) throw e_1.error; }
1244
+ }
1245
+ return rulesEvaluationMapping;
1246
+ };
1247
+ return Rules;
1248
+ }());
1249
+ __decorate([
1250
+ log
1251
+ ], Rules.prototype, "evaluate", null);
1252
+ __decorate([
1253
+ log
1254
+ ], Rules.prototype, "mapping", null);
1255
+
1256
+ var Defaults = /** @class */ (function () {
1257
+ function Defaults(field, allFormsData, formData, previousFormData, takeAction) {
1258
+ this._field = field;
1259
+ this._allFormsData = allFormsData;
1260
+ this._formData = formData;
1261
+ this._previousFormData = previousFormData;
1262
+ this._takeAction = takeAction;
1263
+ }
1264
+ Defaults.prototype.getDefaultValue = function () {
1265
+ return __awaiter(this, void 0, void 0, function () {
1266
+ var defaultValue, sources, sourceIndex, sources_1, sources_1_1, source, sources_2, value, validation, triggers, rules, actions, rulesMapping, actions_1, actions_1_1, action, conditionEvaluation, actions_2, e_1_1, e_2_1;
1267
+ var e_2, _a, e_1, _b;
1268
+ return __generator(this, function (_c) {
1269
+ switch (_c.label) {
1270
+ case 0:
1271
+ sources = this._field.default.value.sources;
1272
+ sourceIndex = 0;
1273
+ _c.label = 1;
1274
+ case 1:
1275
+ _c.trys.push([1, 13, 14, 15]);
1276
+ sources_1 = __values(sources), sources_1_1 = sources_1.next();
1277
+ _c.label = 2;
1278
+ case 2:
1279
+ if (!!sources_1_1.done) return [3 /*break*/, 12];
1280
+ source = sources_1_1.value;
1281
+ sources_2 = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
1282
+ value = sources_2.getValueFromSource(source);
1283
+ // Set the Value of current source.
1284
+ this._field = setValueToObject(this._field, "default.value.sources.[" + sourceIndex + "].value", value);
1285
+ validation = source.validation;
1286
+ triggers = validation.triggers;
1287
+ rules = validation.rules;
1288
+ actions = validation.actions;
1289
+ rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
1290
+ _c.label = 3;
1291
+ case 3:
1292
+ _c.trys.push([3, 8, 9, 10]);
1293
+ actions_1 = (e_1 = void 0, __values(actions)), actions_1_1 = actions_1.next();
1294
+ _c.label = 4;
1295
+ case 4:
1296
+ if (!!actions_1_1.done) return [3 /*break*/, 7];
1297
+ action = actions_1_1.value;
1298
+ conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
1299
+ if (!conditionEvaluation) return [3 /*break*/, 6];
1300
+ actions_2 = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
1301
+ return [4 /*yield*/, actions_2.execute()];
1302
+ case 5:
1303
+ _c.sent();
1304
+ _c.label = 6;
1305
+ case 6:
1306
+ actions_1_1 = actions_1.next();
1307
+ return [3 /*break*/, 4];
1308
+ case 7: return [3 /*break*/, 10];
1309
+ case 8:
1310
+ e_1_1 = _c.sent();
1311
+ e_1 = { error: e_1_1 };
1312
+ return [3 /*break*/, 10];
1313
+ case 9:
1314
+ try {
1315
+ if (actions_1_1 && !actions_1_1.done && (_b = actions_1.return)) _b.call(actions_1);
1316
+ }
1317
+ finally { if (e_1) throw e_1.error; }
1318
+ return [7 /*endfinally*/];
1319
+ case 10:
1320
+ sourceIndex++;
1321
+ _c.label = 11;
1322
+ case 11:
1323
+ sources_1_1 = sources_1.next();
1324
+ return [3 /*break*/, 2];
1325
+ case 12: return [3 /*break*/, 15];
1326
+ case 13:
1327
+ e_2_1 = _c.sent();
1328
+ e_2 = { error: e_2_1 };
1329
+ return [3 /*break*/, 15];
1330
+ case 14:
1331
+ try {
1332
+ if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
1333
+ }
1334
+ finally { if (e_2) throw e_2.error; }
1335
+ return [7 /*endfinally*/];
1336
+ case 15:
1337
+ defaultValue = this._field.default.value.value;
1338
+ if (isEmpty$1(defaultValue)) {
1339
+ defaultValue = setEmptyValue(this._field);
1340
+ }
1341
+ return [2 /*return*/, defaultValue];
1342
+ }
1343
+ });
1344
+ });
1345
+ };
1346
+ return Defaults;
1347
+ }());
1348
+ __decorate([
1349
+ log
1350
+ ], Defaults.prototype, "getDefaultValue", null);
1351
+
1352
+ var Validations = /** @class */ (function () {
1353
+ function Validations(field, formData, previousFormData, allFormsData, takeAction) {
1354
+ this._field = field;
1355
+ this._formData = formData;
1356
+ this._previousFormData = previousFormData;
1357
+ this._allFormsData = allFormsData;
1358
+ this._takeAction = takeAction;
1359
+ }
1360
+ Object.defineProperty(Validations.prototype, "formData", {
1361
+ get: function () {
1362
+ return this._formData;
1363
+ },
1364
+ set: function (value) {
1365
+ this._formData = value;
1366
+ },
1367
+ enumerable: false,
1368
+ configurable: true
1369
+ });
1370
+ Object.defineProperty(Validations.prototype, "previousFormData", {
1371
+ get: function () {
1372
+ return this._previousFormData;
1373
+ },
1374
+ set: function (value) {
1375
+ this._previousFormData = value;
1376
+ },
1377
+ enumerable: false,
1378
+ configurable: true
1379
+ });
1380
+ Object.defineProperty(Validations.prototype, "allFormsData", {
1381
+ get: function () {
1382
+ return this._allFormsData;
1383
+ },
1384
+ set: function (value) {
1385
+ this._allFormsData = value;
1386
+ },
1387
+ enumerable: false,
1388
+ configurable: true
1389
+ });
1390
+ Object.defineProperty(Validations.prototype, "field", {
1391
+ get: function () {
1392
+ return this._field;
1393
+ },
1394
+ set: function (value) {
1395
+ this._field = value;
1396
+ },
1397
+ enumerable: false,
1398
+ configurable: true
1399
+ });
1400
+ Validations.prototype.getFieldValidators = function (field) {
1401
+ var validators = [];
1402
+ if (hasKey$1(field, "validators") &&
1403
+ hasKey$1(field.validators, "min") &&
1404
+ isNotEmpty(field.validators.min)) {
1405
+ validators.push(i5.Validators.min(field.validators.min));
1406
+ }
1407
+ if (hasKey$1(field, "validators") &&
1408
+ hasKey$1(field.validators, "max") &&
1409
+ isNotEmpty(field.validators.max)) {
1410
+ validators.push(i5.Validators.max(field.validators.max));
1411
+ }
1412
+ if (hasKey$1(field, "required") ||
1413
+ (hasKey$1(field, "validators") && hasKey$1(field.validators, "required"))) {
1414
+ validators.push(i5.Validators.required);
1415
+ }
1416
+ if (hasKey$1(field, "validators") &&
1417
+ hasKey$1(field.validators, "minLength") &&
1418
+ isNotEmpty(field.validators.minLength)) {
1419
+ validators.push(i5.Validators.minLength(field.validators.minLength));
1420
+ }
1421
+ if (hasKey$1(field, "validators") &&
1422
+ hasKey$1(field.validators, "maxLength") &&
1423
+ isNotEmpty(field.validators.maxLength)) {
1424
+ validators.push(i5.Validators.maxLength(field.validators.maxLength));
1425
+ }
1426
+ if (hasKey$1(field, "validators") &&
1427
+ hasKey$1(field.validators, "pattern") &&
1428
+ isNotEmpty(field.validators.pattern)) {
1429
+ if (field.validators.pattern.key === EPatternKey.CUSTOM) {
1430
+ validators.push(i5.Validators.pattern(field.validators.pattern.pattern));
1431
+ }
1432
+ else {
1433
+ validators.push(i5.Validators.pattern(EPattern[field.validators.pattern.key]));
1434
+ }
1435
+ }
1436
+ if (hasKey$1(field, "validators") &&
1437
+ hasKey$1(field.validators, "nullValidator") &&
1438
+ isNotEmpty(field.validators.nullValidator)) {
1439
+ validators.push(i5.Validators.nullValidator(field.validators.nullValidator));
1440
+ }
1441
+ return validators;
1442
+ };
1443
+ Validations.prototype.getFormValidationErrors = function (control) {
1444
+ var errors = [];
1445
+ var _loop_1 = function (key) {
1446
+ var controlErrors = control.controls[key].errors;
1447
+ if (controlErrors !== null && controlErrors !== undefined) {
1448
+ Object.keys(controlErrors).forEach(function (keyError) {
1449
+ errors.push({
1450
+ name: keyError,
1451
+ value: controlErrors[keyError]
1452
+ });
1453
+ });
1454
+ }
1455
+ };
1456
+ for (var key in control.controls) {
1457
+ _loop_1(key);
1458
+ }
1459
+ return errors;
1460
+ };
1461
+ Validations.prototype.findInvalidControlsRecursive = function (formToInvestigate) {
1462
+ var controls = [];
1463
+ var recursiveFunc = function (form) {
1464
+ Object.keys(form.controls).forEach(function (field) {
1465
+ var control = form.get(field);
1466
+ if (control.invalid) {
1467
+ controls.push({
1468
+ key: field,
1469
+ invalid: true
1470
+ });
1471
+ }
1472
+ else {
1473
+ controls.push({
1474
+ key: field,
1475
+ invalid: false
1476
+ });
1477
+ }
1478
+ if (control instanceof i5.FormGroup) {
1479
+ recursiveFunc(control);
1480
+ }
1481
+ else if (control instanceof i5.FormArray) {
1482
+ recursiveFunc(control);
1483
+ }
1484
+ });
1485
+ };
1486
+ recursiveFunc(formToInvestigate);
1487
+ return controls;
1488
+ };
1489
+ Validations.prototype.validateField = function () {
1490
+ return __awaiter(this, void 0, void 0, function () {
1491
+ var validations, triggers, rules, actions, rulesMapping, actions_1, actions_1_1, action, conditionEvaluation, actions_2, e_1_1;
1492
+ var e_1, _a;
1493
+ return __generator(this, function (_b) {
1494
+ switch (_b.label) {
1495
+ case 0:
1496
+ validations = this._field.validation;
1497
+ triggers = validations.triggers;
1498
+ rules = validations.rules;
1499
+ actions = validations.actions;
1500
+ rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
1501
+ _b.label = 1;
1502
+ case 1:
1503
+ _b.trys.push([1, 6, 7, 8]);
1504
+ actions_1 = __values(actions), actions_1_1 = actions_1.next();
1505
+ _b.label = 2;
1506
+ case 2:
1507
+ if (!!actions_1_1.done) return [3 /*break*/, 5];
1508
+ action = actions_1_1.value;
1509
+ conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
1510
+ if (!conditionEvaluation) return [3 /*break*/, 4];
1511
+ actions_2 = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
1512
+ return [4 /*yield*/, actions_2.execute()];
1513
+ case 3:
1514
+ _b.sent();
1515
+ _b.label = 4;
1516
+ case 4:
1517
+ actions_1_1 = actions_1.next();
1518
+ return [3 /*break*/, 2];
1519
+ case 5: return [3 /*break*/, 8];
1520
+ case 6:
1521
+ e_1_1 = _b.sent();
1522
+ e_1 = { error: e_1_1 };
1523
+ return [3 /*break*/, 8];
1524
+ case 7:
1525
+ try {
1526
+ if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
1527
+ }
1528
+ finally { if (e_1) throw e_1.error; }
1529
+ return [7 /*endfinally*/];
1530
+ case 8: return [2 /*return*/];
1531
+ }
1532
+ });
1533
+ });
1534
+ };
1535
+ return Validations;
1536
+ }());
1537
+ __decorate([
1538
+ log
1539
+ ], Validations.prototype, "getFieldValidators", null);
1540
+ __decorate([
1541
+ log
1542
+ ], Validations.prototype, "getFormValidationErrors", null);
1543
+ __decorate([
1544
+ log
1545
+ ], Validations.prototype, "findInvalidControlsRecursive", null);
1546
+ __decorate([
1547
+ log
1548
+ ], Validations.prototype, "validateField", null);
1549
+
1550
+ var KwikIDFormViewService = /** @class */ (function () {
1551
+ function KwikIDFormViewService() {
1552
+ }
1553
+ // 'init' stage of the form
1554
+ KwikIDFormViewService.prototype.createFormGroup = function (fields, formData, previousFormData, allFormsData, takeAction) {
1555
+ return __awaiter(this, void 0, void 0, function () {
1556
+ var formGroup, fields_1, fields_1_1, field, defaults, value, validators, e_1_1;
1557
+ var e_1, _a;
1558
+ return __generator(this, function (_b) {
1559
+ switch (_b.label) {
1560
+ case 0:
1561
+ formGroup = new i5.FormGroup({});
1562
+ _b.label = 1;
1563
+ case 1:
1564
+ _b.trys.push([1, 6, 7, 8]);
1565
+ fields_1 = __values(fields), fields_1_1 = fields_1.next();
1566
+ _b.label = 2;
1567
+ case 2:
1568
+ if (!!fields_1_1.done) return [3 /*break*/, 5];
1569
+ field = fields_1_1.value;
1570
+ if (!(field.type !== "title")) return [3 /*break*/, 4];
1571
+ defaults = new Defaults(field, allFormsData, formData, previousFormData, takeAction);
1572
+ return [4 /*yield*/, defaults.getDefaultValue()];
1573
+ case 3:
1574
+ value = _b.sent();
1575
+ validators = new Validations(field, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
1576
+ formGroup.addControl(field.key, new i5.FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
1577
+ _b.label = 4;
1578
+ case 4:
1579
+ fields_1_1 = fields_1.next();
1580
+ return [3 /*break*/, 2];
1581
+ case 5: return [3 /*break*/, 8];
1582
+ case 6:
1583
+ e_1_1 = _b.sent();
1584
+ e_1 = { error: e_1_1 };
1585
+ return [3 /*break*/, 8];
1586
+ case 7:
1587
+ try {
1588
+ if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
1589
+ }
1590
+ finally { if (e_1) throw e_1.error; }
1591
+ return [7 /*endfinally*/];
1592
+ case 8: return [2 /*return*/, formGroup];
1593
+ }
1594
+ });
1595
+ });
1596
+ };
1597
+ return KwikIDFormViewService;
1598
+ }());
1599
+ __decorate([
1600
+ log
1601
+ ], KwikIDFormViewService.prototype, "createFormGroup", null);
1602
+
1603
+ var Apis = /** @class */ (function () {
1604
+ function Apis(field, formData, previousFormData, allFormsData, takeAction) {
1605
+ this._field = field;
1606
+ this._formData = formData;
1607
+ this._previousFormData = previousFormData;
1608
+ this._allFormsData = allFormsData;
1609
+ this._takeAction = takeAction;
1610
+ this._api = field.api;
1611
+ this._request = field.api.request;
1612
+ this._response = field.api.response;
1613
+ this._status = field.api.status;
1614
+ }
1615
+ Apis.prototype.setRequestBodyParams = function () {
1616
+ var _a, _b, _c;
1617
+ return __awaiter(this, void 0, void 0, function () {
1618
+ var params, paramIndex, params_1, params_1_1, param, sources, sourceIndex, sources_1, sources_1_1, source, sources_2, value, validation, triggers, rules, actions, rulesMapping, actions_1, actions_1_1, action, conditionEvaluation, actions_2, e_1_1, e_2_1, e_3_1;
1619
+ var e_3, _d, e_2, _e, e_1, _f;
1620
+ return __generator(this, function (_g) {
1621
+ switch (_g.label) {
1622
+ case 0:
1623
+ params = this._request.body.params;
1624
+ paramIndex = 0;
1625
+ _g.label = 1;
1626
+ case 1:
1627
+ _g.trys.push([1, 20, 21, 22]);
1628
+ params_1 = __values(params), params_1_1 = params_1.next();
1629
+ _g.label = 2;
1630
+ case 2:
1631
+ if (!!params_1_1.done) return [3 /*break*/, 19];
1632
+ param = params_1_1.value;
1633
+ sources = param.sources;
1634
+ sourceIndex = 0;
1635
+ _g.label = 3;
1636
+ case 3:
1637
+ _g.trys.push([3, 15, 16, 17]);
1638
+ sources_1 = (e_2 = void 0, __values(sources)), sources_1_1 = sources_1.next();
1639
+ _g.label = 4;
1640
+ case 4:
1641
+ if (!!sources_1_1.done) return [3 /*break*/, 14];
1642
+ source = sources_1_1.value;
1643
+ sources_2 = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
1644
+ value = sources_2.getValueFromSource(source);
1645
+ // Set the Value of current source.
1646
+ this._field = setValueToObject(this._field, "api.request.body.params[" + paramIndex + "].sources[" + sourceIndex + "].value", value);
1647
+ validation = source.validation;
1648
+ triggers = (_a = validation === null || validation === void 0 ? void 0 : validation.triggers) !== null && _a !== void 0 ? _a : [];
1649
+ rules = (_b = validation === null || validation === void 0 ? void 0 : validation.rules) !== null && _b !== void 0 ? _b : [];
1650
+ actions = (_c = validation === null || validation === void 0 ? void 0 : validation.actions) !== null && _c !== void 0 ? _c : [];
1651
+ rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
1652
+ _g.label = 5;
1653
+ case 5:
1654
+ _g.trys.push([5, 10, 11, 12]);
1655
+ actions_1 = (e_1 = void 0, __values(actions)), actions_1_1 = actions_1.next();
1656
+ _g.label = 6;
1657
+ case 6:
1658
+ if (!!actions_1_1.done) return [3 /*break*/, 9];
1659
+ action = actions_1_1.value;
1660
+ conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
1661
+ if (!conditionEvaluation) return [3 /*break*/, 8];
1662
+ actions_2 = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
1663
+ return [4 /*yield*/, actions_2.execute()];
1664
+ case 7:
1665
+ _g.sent();
1666
+ _g.label = 8;
1667
+ case 8:
1668
+ actions_1_1 = actions_1.next();
1669
+ return [3 /*break*/, 6];
1670
+ case 9: return [3 /*break*/, 12];
1671
+ case 10:
1672
+ e_1_1 = _g.sent();
1673
+ e_1 = { error: e_1_1 };
1674
+ return [3 /*break*/, 12];
1675
+ case 11:
1676
+ try {
1677
+ if (actions_1_1 && !actions_1_1.done && (_f = actions_1.return)) _f.call(actions_1);
1678
+ }
1679
+ finally { if (e_1) throw e_1.error; }
1680
+ return [7 /*endfinally*/];
1681
+ case 12:
1682
+ sourceIndex++;
1683
+ _g.label = 13;
1684
+ case 13:
1685
+ sources_1_1 = sources_1.next();
1686
+ return [3 /*break*/, 4];
1687
+ case 14: return [3 /*break*/, 17];
1688
+ case 15:
1689
+ e_2_1 = _g.sent();
1690
+ e_2 = { error: e_2_1 };
1691
+ return [3 /*break*/, 17];
1692
+ case 16:
1693
+ try {
1694
+ if (sources_1_1 && !sources_1_1.done && (_e = sources_1.return)) _e.call(sources_1);
1695
+ }
1696
+ finally { if (e_2) throw e_2.error; }
1697
+ return [7 /*endfinally*/];
1698
+ case 17:
1699
+ paramIndex++;
1700
+ _g.label = 18;
1701
+ case 18:
1702
+ params_1_1 = params_1.next();
1703
+ return [3 /*break*/, 2];
1704
+ case 19: return [3 /*break*/, 22];
1705
+ case 20:
1706
+ e_3_1 = _g.sent();
1707
+ e_3 = { error: e_3_1 };
1708
+ return [3 /*break*/, 22];
1709
+ case 21:
1710
+ try {
1711
+ if (params_1_1 && !params_1_1.done && (_d = params_1.return)) _d.call(params_1);
1712
+ }
1713
+ finally { if (e_3) throw e_3.error; }
1714
+ return [7 /*endfinally*/];
1715
+ case 22: return [2 /*return*/, this._field];
1716
+ }
1717
+ });
1718
+ });
1719
+ };
1720
+ Apis.prototype.validateRequestBody = function () {
1721
+ return __awaiter(this, void 0, void 0, function () {
1722
+ var body, validation, triggers, rules, actions, rulesMapping, actions_3, actions_3_1, action, conditionSuccess, actions_4, e_4_1;
1723
+ var e_4, _d;
1724
+ return __generator(this, function (_e) {
1725
+ switch (_e.label) {
1726
+ case 0:
1727
+ body = this._request.body;
1728
+ validation = body.validation;
1729
+ triggers = validation.triggers;
1730
+ rules = validation.rules;
1731
+ actions = validation.actions;
1732
+ rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
1733
+ _e.label = 1;
1734
+ case 1:
1735
+ _e.trys.push([1, 6, 7, 8]);
1736
+ actions_3 = __values(actions), actions_3_1 = actions_3.next();
1737
+ _e.label = 2;
1738
+ case 2:
1739
+ if (!!actions_3_1.done) return [3 /*break*/, 5];
1740
+ action = actions_3_1.value;
1741
+ conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
1742
+ if (!conditionSuccess) return [3 /*break*/, 4];
1743
+ actions_4 = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
1744
+ return [4 /*yield*/, actions_4.execute()];
1745
+ case 3:
1746
+ _e.sent();
1747
+ _e.label = 4;
1748
+ case 4:
1749
+ actions_3_1 = actions_3.next();
1750
+ return [3 /*break*/, 2];
1751
+ case 5: return [3 /*break*/, 8];
1752
+ case 6:
1753
+ e_4_1 = _e.sent();
1754
+ e_4 = { error: e_4_1 };
1755
+ return [3 /*break*/, 8];
1756
+ case 7:
1757
+ try {
1758
+ if (actions_3_1 && !actions_3_1.done && (_d = actions_3.return)) _d.call(actions_3);
1759
+ }
1760
+ finally { if (e_4) throw e_4.error; }
1761
+ return [7 /*endfinally*/];
1762
+ case 8: return [2 /*return*/, this._field];
1763
+ }
1764
+ });
1765
+ });
1766
+ };
1767
+ Apis.prototype.validateApiCallResponse = function () {
1768
+ return __awaiter(this, void 0, void 0, function () {
1769
+ var validation, triggers, rules, actions, rulesMapping, actions_5, actions_5_1, action, conditionSuccess, actions_6, e_5_1;
1770
+ var e_5, _d;
1771
+ return __generator(this, function (_e) {
1772
+ switch (_e.label) {
1773
+ case 0:
1774
+ validation = this._response.validation;
1775
+ triggers = validation.triggers;
1776
+ rules = validation.rules;
1777
+ actions = validation.actions;
1778
+ rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
1779
+ _e.label = 1;
1780
+ case 1:
1781
+ _e.trys.push([1, 6, 7, 8]);
1782
+ actions_5 = __values(actions), actions_5_1 = actions_5.next();
1783
+ _e.label = 2;
1784
+ case 2:
1785
+ if (!!actions_5_1.done) return [3 /*break*/, 5];
1786
+ action = actions_5_1.value;
1787
+ conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
1788
+ if (!conditionSuccess) return [3 /*break*/, 4];
1789
+ actions_6 = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
1790
+ return [4 /*yield*/, actions_6.execute()];
1791
+ case 3:
1792
+ _e.sent();
1793
+ _e.label = 4;
1794
+ case 4:
1795
+ actions_5_1 = actions_5.next();
1796
+ return [3 /*break*/, 2];
1797
+ case 5: return [3 /*break*/, 8];
1798
+ case 6:
1799
+ e_5_1 = _e.sent();
1800
+ e_5 = { error: e_5_1 };
1801
+ return [3 /*break*/, 8];
1802
+ case 7:
1803
+ try {
1804
+ if (actions_5_1 && !actions_5_1.done && (_d = actions_5.return)) _d.call(actions_5);
1805
+ }
1806
+ finally { if (e_5) throw e_5.error; }
1807
+ return [7 /*endfinally*/];
1808
+ case 8: return [2 /*return*/, this._field];
1809
+ }
1810
+ });
1811
+ });
1812
+ };
1813
+ Apis.prototype.getPropsValues = function () {
1814
+ return {
1815
+ field: this._field,
1816
+ formData: this._formData,
1817
+ previousFormData: this._previousFormData,
1818
+ allFormsData: this._allFormsData
1819
+ };
1820
+ };
1821
+ return Apis;
1822
+ }());
1823
+ __decorate([
1824
+ log
1825
+ ], Apis.prototype, "setRequestBodyParams", null);
1826
+ __decorate([
1827
+ log
1828
+ ], Apis.prototype, "validateRequestBody", null);
1829
+ __decorate([
1830
+ log
1831
+ ], Apis.prototype, "validateApiCallResponse", null);
1832
+
1833
+ var findFieldFromKey = function (fields, key) {
1834
+ var field = fields.find(function (field) {
1835
+ if (field.key === key) {
1836
+ return field;
1837
+ }
1838
+ });
1839
+ return field;
1840
+ };
1841
+ var findFieldIndexFromKey = function (fields, key) {
1842
+ var fieldIndex;
1843
+ fieldIndex = fields.findIndex(function (_) {
1844
+ return key === _.key;
1845
+ });
1846
+ return fieldIndex;
1847
+ };
1848
+ var getSearchTextOptionsFromRemoteFile = function (field, childField, formGroup) { return __awaiter(void 0, void 0, void 0, function () {
1849
+ var parentFieldValue, fileUrl, fileKey, response, data;
1850
+ return __generator(this, function (_a) {
1851
+ switch (_a.label) {
1852
+ case 0:
1853
+ parentFieldValue = formGroup.controls[field.key].value;
1854
+ if (childField.regexToGetJsonRemoteUrlKey) {
1855
+ fileKey = parentFieldValue.match(childField.regexToGetJsonRemoteUrlKey)[0];
1856
+ fileUrl = childField.jsonRemoteUrlMapping[fileKey];
1857
+ }
1858
+ else {
1859
+ fileUrl = childField.fileUrl;
1860
+ }
1861
+ // Return early if there is no file URL
1862
+ if (!fileUrl)
1863
+ return [2 /*return*/];
1864
+ return [4 /*yield*/, fetch(fileUrl)];
1865
+ case 1:
1866
+ response = _a.sent();
1867
+ return [4 /*yield*/, response.json()];
1868
+ case 2:
1869
+ data = _a.sent();
1870
+ // Return the data for the given parent field value
1871
+ return [2 /*return*/, data[parentFieldValue]];
1872
+ }
1873
+ });
1874
+ }); };
1875
+ var getSearchTextOptionsFromFieldConfig = function (field, childField, formGroup) {
1876
+ var options;
1877
+ var fieldValue = formGroup.controls[field.key].value;
1878
+ if (isNotEmpty(childField["json"])) {
1879
+ options = childField["json"][fieldValue];
1880
+ }
1881
+ return options;
1882
+ };
1883
+ var formatSearchTextOptions = function (options) {
1884
+ return options.map(function (_a) {
1885
+ var title = _a.title;
1886
+ return title;
1887
+ });
1888
+ };
1889
+ var formatDateToStandardFormat = function (date) {
1890
+ var formattedDate;
1891
+ var year = date.year;
1892
+ var month = date.month;
1893
+ var day = date.day;
1894
+ formattedDate = day + "-" + (month + 1) + "-" + year;
1895
+ return formattedDate;
1896
+ };
1897
+ function highlightFieldError(field, error) {
1898
+ field.invalid = error;
1899
+ field.focus = error;
1900
+ // if (!error) {
1901
+ // field["messages"] = field["messages"].filter(function (fieldMessage: {
1902
+ // type: string;
1903
+ // message: string;
1904
+ // }) {
1905
+ // return fieldMessage.type === "error";
1906
+ // });
1907
+ // }
1908
+ return field;
1909
+ }
1910
+ var addMessage = function (field, message) {
1911
+ var isDuplicateMessage = function (messages, message) {
1912
+ return messages.some(function (fieldMessage) {
1913
+ return (fieldMessage.type === message.type &&
1914
+ fieldMessage.message === message.message);
1915
+ });
1916
+ };
1917
+ field["messages"] = [];
1918
+ if (hasKey$1(field, "messages")) {
1919
+ if (!isDuplicateMessage(field["messages"], message)) {
1920
+ field["messages"].push({
1921
+ type: message.type,
1922
+ message: message.message
1923
+ });
1924
+ }
1925
+ }
1926
+ else {
1927
+ field["messages"] = [{ type: message.type, message: message.message }];
1928
+ }
1929
+ return field;
1930
+ };
1931
+ var removeMessage = function (field, message) {
1932
+ field["messages"] = field["messages"].filter(function (fieldMessage) {
1933
+ return fieldMessage.type !== message.type;
1934
+ });
1935
+ return field;
1936
+ };
1937
+ function setFieldError(fields, errors, key, error) {
1938
+ var fieldIndex = fields.findIndex(function (field) {
1939
+ return field.key === key;
1940
+ });
1941
+ var setErrorMessages = function (field, errors) {
1942
+ var getErrorMessage = function (fieldLabel, errorType) {
1943
+ var errorMessage = "";
1944
+ switch (errorType) {
1945
+ case "required":
1946
+ errorMessage = fieldLabel + " is required!";
1947
+ break;
1948
+ case "pattern":
1949
+ errorMessage = fieldLabel + " has wrong pattern!";
1950
+ break;
1951
+ case "email":
1952
+ errorMessage = fieldLabel + " has wrong email format!";
1953
+ break;
1954
+ case "minlength":
1955
+ errorMessage = fieldLabel + " has wrong length! Required minimum length: " + field.validators.minLength;
1956
+ break;
1957
+ case "maxlength":
1958
+ errorMessage = fieldLabel + " has wrong length! Required maximum length: " + field.validators.maxLength;
1959
+ break;
1960
+ case "areEqual":
1961
+ errorMessage = fieldLabel + " must be equal!";
1962
+ break;
1963
+ default:
1964
+ errorMessage = fieldLabel + ": " + "error.error_name" + ": " + "error.error_value";
1965
+ break;
1966
+ }
1967
+ return errorMessage;
1968
+ };
1969
+ Object.keys(errors).forEach(function (error) {
1970
+ field = addMessage(field, {
1971
+ type: "error",
1972
+ message: getErrorMessage(field.label, error)
1973
+ });
1974
+ });
1975
+ return field;
1976
+ };
1977
+ if (error) {
1978
+ fields[fieldIndex] = setErrorMessages(fields[fieldIndex], errors);
1979
+ }
1980
+ else {
1981
+ fields[fieldIndex]["messages"] = [];
1982
+ }
1983
+ fields[fieldIndex] = highlightFieldError(fields[fieldIndex], error);
1984
+ return fields;
1985
+ }
1986
+
1987
+ var KwikIDFormViewComponent = /** @class */ (function () {
1988
+ function KwikIDFormViewComponent(formViewService) {
1989
+ this.formViewService = formViewService;
1990
+ this.componentThis = this;
1991
+ this.apiCallResponse = {};
1992
+ this.isMobileView = false;
1993
+ this.onClickViewForms = new i0.EventEmitter();
1994
+ this.onClickSaveForm = new i0.EventEmitter();
1995
+ this.onClickApiCall = new i0.EventEmitter();
1996
+ this.getActiveFormData = new i0.EventEmitter();
1997
+ this.formFields = [];
1998
+ this.previousFormData = {};
1999
+ this.loading = true;
2000
+ this.viewFormsButton = {
2001
+ disabled: false,
2002
+ showLoader: false
2003
+ };
2004
+ this.saveFormButton = {
2005
+ disabled: false,
2006
+ showLoader: false
2007
+ };
2008
+ this.formGroup = new i5.FormGroup({});
2009
+ }
2010
+ KwikIDFormViewComponent.prototype.ngOnInit = function () {
2011
+ var _this = this;
2012
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2013
+ return __generator(this, function (_a) {
2014
+ switch (_a.label) {
2015
+ case 0: return [4 /*yield*/, this.initFormConfig(this.formConfig)];
2016
+ case 1:
2017
+ _a.sent();
2018
+ this.loading = false;
2019
+ return [2 /*return*/];
2020
+ }
2021
+ });
2022
+ }); })();
2023
+ };
2024
+ KwikIDFormViewComponent.prototype.ngAfterViewInit = function () { };
2025
+ KwikIDFormViewComponent.prototype.ngOnChanges = function (changes) {
2026
+ var _a, _b;
2027
+ var _this = this;
2028
+ var verifyChange = function (key) {
2029
+ return hasKey$1(changes, key) && !changes[key].firstChange;
2030
+ };
2031
+ if (verifyChange("formData")) {
2032
+ this.formData = Object.assign(Object.assign({}, this.formData), changes.formData.currentValue);
2033
+ }
2034
+ if (verifyChange("apiCallResponse")) {
2035
+ this.apiCallResponse = changes.apiCallResponse.currentValue;
2036
+ this.formData = Object.assign(Object.assign({}, this.formData), (_a = {}, _a[this.apiCallResponse.key] = this.apiCallResponse.response, _a));
2037
+ this.formGroup.patchValue((_b = {},
2038
+ _b[this.apiCallResponse.key] = this.apiCallResponse.response,
2039
+ _b), { emitEvent: false });
2040
+ var field_1 = findFieldFromKey(this.formFields, this.apiCallResponse.key);
2041
+ var apis_1 = new Apis(field_1, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
2042
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2043
+ return __generator(this, function (_a) {
2044
+ switch (_a.label) {
2045
+ case 0: return [4 /*yield*/, apis_1.validateApiCallResponse()];
2046
+ case 1:
2047
+ field_1 = _a.sent();
2048
+ return [2 /*return*/];
2049
+ }
2050
+ });
2051
+ }); })();
2052
+ }
2053
+ if (verifyChange("isMobileView")) {
2054
+ this.isMobileView = changes.isMobileView.currentValue;
2055
+ }
2056
+ if (verifyChange("allFormsData")) {
2057
+ this.allFormsData = changes.allFormsData.currentValue;
2058
+ }
2059
+ if (verifyChange("formsList")) {
2060
+ this.formsList = changes.formsList.currentValue;
2061
+ }
2062
+ if (verifyChange("formConfig")) {
2063
+ this.formConfig = changes.formConfig.currentValue;
2064
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2065
+ return __generator(this, function (_a) {
2066
+ switch (_a.label) {
2067
+ case 0: return [4 /*yield*/, this.initFormConfig(this.formConfig)];
2068
+ case 1:
2069
+ _a.sent();
2070
+ return [2 /*return*/];
2071
+ }
2072
+ });
2073
+ }); })();
2074
+ }
2075
+ };
2076
+ KwikIDFormViewComponent.prototype.initFormConfig = function (formConfig) {
2077
+ return __awaiter(this, void 0, void 0, function () {
2078
+ var _a, _loop_1, this_1, _b, _c, field, _loop_2, _d, _e, field;
2079
+ var e_1, _f, e_2, _g;
2080
+ var _this = this;
2081
+ return __generator(this, function (_h) {
2082
+ switch (_h.label) {
2083
+ case 0:
2084
+ this.setFormFieldsFromFormConfig(formConfig);
2085
+ this.setFormDataFromAllFormsData();
2086
+ _a = this;
2087
+ return [4 /*yield*/, this.formViewService.createFormGroup(this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this))];
2088
+ case 1:
2089
+ _a.formGroup = _h.sent();
2090
+ _loop_1 = function (field) {
2091
+ var _j;
2092
+ if (field.type !== "title") {
2093
+ this_1.previousFormData = Object.assign(Object.assign({}, this_1.previousFormData), (_j = {}, _j[field.key] = this_1.formGroup.controls[field.key].value, _j));
2094
+ this_1.formGroup.controls[field.key].valueChanges
2095
+ .pipe(operators.pairwise())
2096
+ .subscribe(function (_a) {
2097
+ var _b, _c;
2098
+ var _d = __read(_a, 2), previousValue = _d[0], currentValue = _d[1];
2099
+ _this.previousFormData = Object.assign(Object.assign({}, _this.previousFormData), (_b = {}, _b[field.key] = previousValue, _b));
2100
+ _this.formData = Object.assign(Object.assign({}, _this.formData), (_c = {}, _c[field.key] = currentValue, _c));
2101
+ });
2102
+ }
2103
+ };
2104
+ this_1 = this;
2105
+ try {
2106
+ for (_b = __values(this.formFields), _c = _b.next(); !_c.done; _c = _b.next()) {
2107
+ field = _c.value;
2108
+ _loop_1(field);
2109
+ }
2110
+ }
2111
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2112
+ finally {
2113
+ try {
2114
+ if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
2115
+ }
2116
+ finally { if (e_1) throw e_1.error; }
2117
+ }
2118
+ _loop_2 = function (field) {
2119
+ if (field.type !== "title") {
2120
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2121
+ return __generator(this, function (_a) {
2122
+ switch (_a.label) {
2123
+ case 0: return [4 /*yield*/, this.handleConnectedElements({
2124
+ key: field.key,
2125
+ value: this.formGroup.controls[field.key].value
2126
+ }, "ON_INIT")];
2127
+ case 1:
2128
+ field = _a.sent();
2129
+ return [2 /*return*/];
2130
+ }
2131
+ });
2132
+ }); })();
2133
+ }
2134
+ };
2135
+ try {
2136
+ for (_d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
2137
+ field = _e.value;
2138
+ _loop_2(field);
2139
+ }
2140
+ }
2141
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2142
+ finally {
2143
+ try {
2144
+ if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
2145
+ }
2146
+ finally { if (e_2) throw e_2.error; }
2147
+ }
2148
+ return [2 /*return*/];
2149
+ }
2150
+ });
2151
+ });
2152
+ };
2153
+ KwikIDFormViewComponent.prototype.setFormFieldsFromFormConfig = function (formConfig) {
2154
+ if (hasKey$1(formConfig, "fields")) {
2155
+ this.formFields = formConfig.fields;
2156
+ }
2157
+ else if (hasKey$1(formConfig, "multiForm") &&
2158
+ hasKey$1(formConfig.multiForm, "fields")) {
2159
+ this.formFields = formConfig.multiForm.fields;
2160
+ }
2161
+ };
2162
+ KwikIDFormViewComponent.prototype.setFormDataFromAllFormsData = function () {
2163
+ if (hasKey$1(this.allFormsData, this.formConfig.key)) {
2164
+ this.formData = this.allFormsData[this.formConfig.key];
2165
+ }
2166
+ else {
2167
+ this.formData = {};
2168
+ }
2169
+ };
2170
+ KwikIDFormViewComponent.prototype.handleConnectedElementFieldActions = function (connectedFieldConfig, connectedField) {
2171
+ return __awaiter(this, void 0, void 0, function () {
2172
+ var rulesMapping, _a, _b, action, conditionSuccess, actions, e_3_1;
2173
+ var e_3, _c;
2174
+ return __generator(this, function (_d) {
2175
+ switch (_d.label) {
2176
+ case 0:
2177
+ if (!hasKey$1(connectedFieldConfig, "rules")) return [3 /*break*/, 8];
2178
+ rulesMapping = new Rules(connectedFieldConfig.rules, connectedField, this.formData, this.previousFormData, this.allFormsData).mapping();
2179
+ _d.label = 1;
2180
+ case 1:
2181
+ _d.trys.push([1, 6, 7, 8]);
2182
+ _a = __values(connectedFieldConfig.actions), _b = _a.next();
2183
+ _d.label = 2;
2184
+ case 2:
2185
+ if (!!_b.done) return [3 /*break*/, 5];
2186
+ action = _b.value;
2187
+ conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
2188
+ if (!conditionSuccess) return [3 /*break*/, 4];
2189
+ actions = new Actions(action, connectedField, rulesMapping, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
2190
+ return [4 /*yield*/, actions.execute()];
2191
+ case 3:
2192
+ _d.sent();
2193
+ _d.label = 4;
2194
+ case 4:
2195
+ _b = _a.next();
2196
+ return [3 /*break*/, 2];
2197
+ case 5: return [3 /*break*/, 8];
2198
+ case 6:
2199
+ e_3_1 = _d.sent();
2200
+ e_3 = { error: e_3_1 };
2201
+ return [3 /*break*/, 8];
2202
+ case 7:
2203
+ try {
2204
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
2205
+ }
2206
+ finally { if (e_3) throw e_3.error; }
2207
+ return [7 /*endfinally*/];
2208
+ case 8: return [2 /*return*/, connectedField];
2209
+ }
2210
+ });
2211
+ });
2212
+ };
2213
+ KwikIDFormViewComponent.prototype.handleConnectedElementFields = function (currentField, connectedFieldConfig, eventType) {
2214
+ return __awaiter(this, void 0, void 0, function () {
2215
+ var connectedField, _a, _b, _c, _d, _e, connectedFieldConfig_1;
2216
+ var e_4, _f;
2217
+ return __generator(this, function (_g) {
2218
+ switch (_g.label) {
2219
+ case 0:
2220
+ connectedField = findFieldFromKey(this.formFields, connectedFieldConfig["key"]);
2221
+ _a = eventType;
2222
+ switch (_a) {
2223
+ case "INIT": return [3 /*break*/, 1];
2224
+ case "VALUE_CHANGE": return [3 /*break*/, 8];
2225
+ case "NESTED_LINK": return [3 /*break*/, 15];
2226
+ }
2227
+ return [3 /*break*/, 17];
2228
+ case 1:
2229
+ if (!(hasKey$1(connectedField, "triggers") &&
2230
+ connectedField.triggers.includes("INIT"))) return [3 /*break*/, 7];
2231
+ if (!this.isFieldEnabled(connectedField.key)) return [3 /*break*/, 5];
2232
+ if (!hasKey$1(connectedFieldConfig, "connectedParentFields")) return [3 /*break*/, 5];
2233
+ _b = connectedFieldConfig.type;
2234
+ switch (_b) {
2235
+ case "dropdown-with-search": return [3 /*break*/, 2];
2236
+ }
2237
+ return [3 /*break*/, 4];
2238
+ case 2: return [4 /*yield*/, this.handleFieldTypeSearchText(currentField, connectedField)];
2239
+ case 3:
2240
+ connectedField = _g.sent();
2241
+ return [3 /*break*/, 5];
2242
+ case 4: return [3 /*break*/, 5];
2243
+ case 5: return [4 /*yield*/, this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField)];
2244
+ case 6:
2245
+ connectedField = _g.sent();
2246
+ _g.label = 7;
2247
+ case 7: return [3 /*break*/, 20];
2248
+ case 8:
2249
+ if (!(hasKey$1(connectedFieldConfig, "triggers") &&
2250
+ connectedFieldConfig.triggers.includes("VALUE_CHANGE"))) return [3 /*break*/, 14];
2251
+ _c = connectedField.type;
2252
+ switch (_c) {
2253
+ case "dropdown-with-search": return [3 /*break*/, 9];
2254
+ }
2255
+ return [3 /*break*/, 11];
2256
+ case 9: return [4 /*yield*/, this.handleFieldTypeSearchText(currentField, connectedField)];
2257
+ case 10:
2258
+ connectedField = _g.sent();
2259
+ return [3 /*break*/, 12];
2260
+ case 11: return [3 /*break*/, 12];
2261
+ case 12: return [4 /*yield*/, this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField)];
2262
+ case 13:
2263
+ connectedField = _g.sent();
2264
+ _g.label = 14;
2265
+ case 14: return [3 /*break*/, 20];
2266
+ case 15:
2267
+ if (!(hasKey$1(connectedFieldConfig, "triggers") &&
2268
+ connectedFieldConfig.triggers.includes("NESTED_LINK"))) return [3 /*break*/, 17];
2269
+ return [4 /*yield*/, this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField)];
2270
+ case 16:
2271
+ connectedField = _g.sent();
2272
+ _g.label = 17;
2273
+ case 17:
2274
+ if (!hasKey$1(connectedFieldConfig, "triggers")) return [3 /*break*/, 19];
2275
+ return [4 /*yield*/, this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField)];
2276
+ case 18:
2277
+ connectedField = _g.sent();
2278
+ _g.label = 19;
2279
+ case 19: return [3 /*break*/, 20];
2280
+ case 20:
2281
+ if (hasKey$1(connectedField, "connectedElements")) {
2282
+ try {
2283
+ for (_d = __values(connectedField.connectedElements
2284
+ .fields), _e = _d.next(); !_e.done; _e = _d.next()) {
2285
+ connectedFieldConfig_1 = _e.value;
2286
+ connectedField = this.handleConnectedElementFields(connectedField, connectedFieldConfig_1, "NESTED_LINK");
2287
+ }
2288
+ }
2289
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2290
+ finally {
2291
+ try {
2292
+ if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
2293
+ }
2294
+ finally { if (e_4) throw e_4.error; }
2295
+ }
2296
+ }
2297
+ return [2 /*return*/, currentField];
2298
+ }
2299
+ });
2300
+ });
2301
+ };
2302
+ KwikIDFormViewComponent.prototype.handleConnectedElements = function (e, eventType) {
2303
+ var e_5, _a;
2304
+ var currentField = findFieldFromKey(this.formFields, e.key);
2305
+ if (hasKey$1(currentField, "connectedElements")) {
2306
+ var connectedFields = currentField.connectedElements.connectedFields;
2307
+ try {
2308
+ for (var connectedFields_1 = __values(connectedFields), connectedFields_1_1 = connectedFields_1.next(); !connectedFields_1_1.done; connectedFields_1_1 = connectedFields_1.next()) {
2309
+ var connectedFieldConfig = connectedFields_1_1.value;
2310
+ currentField = this.handleConnectedElementFields(currentField, connectedFieldConfig, eventType);
2311
+ }
2312
+ }
2313
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2314
+ finally {
2315
+ try {
2316
+ if (connectedFields_1_1 && !connectedFields_1_1.done && (_a = connectedFields_1.return)) _a.call(connectedFields_1);
2317
+ }
2318
+ finally { if (e_5) throw e_5.error; }
2319
+ }
2320
+ }
2321
+ };
2322
+ // DOM Event Handlers
2323
+ KwikIDFormViewComponent.prototype.handleGetKeyValue = function (e) {
2324
+ var _a;
2325
+ var _this = this;
2326
+ this.formGroup.patchValue((_a = {},
2327
+ _a[e.key] = e.value,
2328
+ _a), { emitEvent: false });
2329
+ // Currently set only for dropdown-with-search connected fields
2330
+ var field = findFieldFromKey(this.formFields, e.key);
2331
+ if (field.type !== "title" &&
2332
+ field.validation.triggers.includes("ON_CHANGE")) {
2333
+ var validations_1 = new Validations(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
2334
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2335
+ return __generator(this, function (_a) {
2336
+ switch (_a.label) {
2337
+ case 0: return [4 /*yield*/, validations_1.validateField()];
2338
+ case 1:
2339
+ _a.sent();
2340
+ return [2 /*return*/];
2341
+ }
2342
+ });
2343
+ }); })();
2344
+ this.handleConnectedElements({
2345
+ key: field.key,
2346
+ value: this.formGroup.controls[field.key].value
2347
+ }, "ON_CHANGE");
2348
+ }
2349
+ };
2350
+ KwikIDFormViewComponent.prototype.handleOnClickResetFormFields = function (e, field) {
2351
+ return __awaiter(this, void 0, void 0, function () {
2352
+ var _a, _b, f, _c, _d, a, resetField, actions, e_6_1, e_7_1;
2353
+ var e_7, _e, e_6, _f;
2354
+ return __generator(this, function (_g) {
2355
+ switch (_g.label) {
2356
+ case 0:
2357
+ _g.trys.push([0, 11, 12, 13]);
2358
+ _a = __values(field.reset.fields), _b = _a.next();
2359
+ _g.label = 1;
2360
+ case 1:
2361
+ if (!!_b.done) return [3 /*break*/, 10];
2362
+ f = _b.value;
2363
+ _g.label = 2;
2364
+ case 2:
2365
+ _g.trys.push([2, 7, 8, 9]);
2366
+ _c = (e_6 = void 0, __values(f.actions)), _d = _c.next();
2367
+ _g.label = 3;
2368
+ case 3:
2369
+ if (!!_d.done) return [3 /*break*/, 6];
2370
+ a = _d.value;
2371
+ resetField = findFieldFromKey(this.formFields, a.props.fieldKey);
2372
+ actions = new Actions(a, resetField, {}, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
2373
+ return [4 /*yield*/, actions.execute()];
2374
+ case 4:
2375
+ _g.sent();
2376
+ _g.label = 5;
2377
+ case 5:
2378
+ _d = _c.next();
2379
+ return [3 /*break*/, 3];
2380
+ case 6: return [3 /*break*/, 9];
2381
+ case 7:
2382
+ e_6_1 = _g.sent();
2383
+ e_6 = { error: e_6_1 };
2384
+ return [3 /*break*/, 9];
2385
+ case 8:
2386
+ try {
2387
+ if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
2388
+ }
2389
+ finally { if (e_6) throw e_6.error; }
2390
+ return [7 /*endfinally*/];
2391
+ case 9:
2392
+ _b = _a.next();
2393
+ return [3 /*break*/, 1];
2394
+ case 10: return [3 /*break*/, 13];
2395
+ case 11:
2396
+ e_7_1 = _g.sent();
2397
+ e_7 = { error: e_7_1 };
2398
+ return [3 /*break*/, 13];
2399
+ case 12:
2400
+ try {
2401
+ if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
2402
+ }
2403
+ finally { if (e_7) throw e_7.error; }
2404
+ return [7 /*endfinally*/];
2405
+ case 13: return [2 /*return*/];
2406
+ }
2407
+ });
2408
+ });
2409
+ };
2410
+ KwikIDFormViewComponent.prototype.handleOnClickApiCall = function (e) {
2411
+ return __awaiter(this, void 0, void 0, function () {
2412
+ var field, apis;
2413
+ return __generator(this, function (_a) {
2414
+ switch (_a.label) {
2415
+ case 0:
2416
+ field = findFieldFromKey(this.formFields, e.key);
2417
+ if (!(field.type === "api-call")) return [3 /*break*/, 3];
2418
+ // set button status to loading
2419
+ field["api"]["status"]["value"] = EApiStatusType.LOADING;
2420
+ field["showLoader"] = true;
2421
+ this.viewFormsButton["disabled"] = true;
2422
+ this.viewFormsButton["showLoader"] = true;
2423
+ this.saveFormButton["disabled"] = true;
2424
+ this.saveFormButton["showLoader"] = true;
2425
+ apis = new Apis(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
2426
+ return [4 /*yield*/, apis.setRequestBodyParams()];
2427
+ case 1:
2428
+ field = _a.sent();
2429
+ return [4 /*yield*/, apis.validateRequestBody()];
2430
+ case 2:
2431
+ field = _a.sent();
2432
+ if (field.api.request.body.validation.is_valid) {
2433
+ // Call API Here
2434
+ this.onClickApiCall.emit({
2435
+ key: e.key,
2436
+ request: {
2437
+ mode: "POST",
2438
+ body: field.api.request.body.value,
2439
+ headers: {}
2440
+ }
2441
+ });
2442
+ }
2443
+ else {
2444
+ // Request Body Validation Failed
2445
+ // Highlight Error in UI to User to Retry After Sometime.
2446
+ // Take Actions based on Validation
2447
+ setTimeout(function () {
2448
+ field["api"]["status"]["value"] = EApiStatusType.FAILED;
2449
+ field["showLoader"] = false;
2450
+ }, 500);
2451
+ }
2452
+ this.viewFormsButton["disabled"] = false;
2453
+ this.viewFormsButton["showLoader"] = false;
2454
+ this.saveFormButton["disabled"] = false;
2455
+ this.saveFormButton["showLoader"] = false;
2456
+ _a.label = 3;
2457
+ case 3: return [2 /*return*/];
2458
+ }
2459
+ });
2460
+ });
2461
+ };
2462
+ KwikIDFormViewComponent.prototype.handleOnClickViewForms = function (e) {
2463
+ this.onClickViewForms.emit({
2464
+ clicked: true
2465
+ });
2466
+ };
2467
+ KwikIDFormViewComponent.prototype.handleOnClickSaveForm = function (e) {
2468
+ var e_8, _a, e_9, _b, e_10, _c;
2469
+ var _this = this;
2470
+ var formData = this.formGroup.getRawValue();
2471
+ var _loop_3 = function (field) {
2472
+ if (field.type !== "title" &&
2473
+ field.validation.triggers.includes("ON_SAVE")) {
2474
+ var validations_2 = new Validations(field, this_2.formData, this_2.previousFormData, this_2.allFormsData, this_2.takeAction.bind(this_2));
2475
+ (function () { return __awaiter(_this, void 0, void 0, function () {
2476
+ return __generator(this, function (_a) {
2477
+ switch (_a.label) {
2478
+ case 0: return [4 /*yield*/, validations_2.validateField()];
2479
+ case 1:
2480
+ _a.sent();
2481
+ return [2 /*return*/];
2482
+ }
2483
+ });
2484
+ }); })();
2485
+ }
2486
+ };
2487
+ var this_2 = this;
2488
+ try {
2489
+ for (var _d = __values(this.formFields), _e = _d.next(); !_e.done; _e = _d.next()) {
2490
+ var field = _e.value;
2491
+ _loop_3(field);
2492
+ }
2493
+ }
2494
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2495
+ finally {
2496
+ try {
2497
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
2498
+ }
2499
+ finally { if (e_8) throw e_8.error; }
2500
+ }
2501
+ if (this.formGroup.invalid) {
2502
+ var controls = new Validations(undefined, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
2503
+ var firstFieldWithError = "";
2504
+ try {
2505
+ for (var controls_1 = __values(controls), controls_1_1 = controls_1.next(); !controls_1_1.done; controls_1_1 = controls_1.next()) {
2506
+ var control = controls_1_1.value;
2507
+ if (control.invalid && isEmpty(firstFieldWithError)) {
2508
+ firstFieldWithError = control.key;
2509
+ }
2510
+ this.formFields = setFieldError(this.formFields, this.formGroup.controls[control.key].errors, control.key, control.invalid);
2511
+ }
2512
+ }
2513
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2514
+ finally {
2515
+ try {
2516
+ if (controls_1_1 && !controls_1_1.done && (_b = controls_1.return)) _b.call(controls_1);
2517
+ }
2518
+ finally { if (e_9) throw e_9.error; }
2519
+ }
2520
+ return;
2521
+ }
2522
+ try {
2523
+ // Need to have an API Validator as well here.
2524
+ // if(apiCallSuccess()) { then only proceed further, else highlight the button to click to call api}
2525
+ for (var _f = __values(this.formFields), _g = _f.next(); !_g.done; _g = _f.next()) {
2526
+ var field = _g.value;
2527
+ switch (field.type) {
2528
+ case "radio":
2529
+ if (hasKey$1(formData[field.key], "label")) {
2530
+ formData[field.key] = formData[field.key].label;
2531
+ }
2532
+ else {
2533
+ formData[field.key] = "";
2534
+ }
2535
+ break;
2536
+ case "date":
2537
+ if (isNull(formData[field.key])) {
2538
+ formData[field.key] = "";
2539
+ }
2540
+ else {
2541
+ formData[field.key] = formatDateToStandardFormat(formData[field.key]);
2542
+ }
2543
+ break;
2544
+ case "title":
2545
+ break;
2546
+ default:
2547
+ if (isEmpty(formData[field.key])) {
2548
+ formData[field.key] = "";
2549
+ }
2550
+ break;
2551
+ }
2552
+ }
2553
+ }
2554
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2555
+ finally {
2556
+ try {
2557
+ if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
2558
+ }
2559
+ finally { if (e_10) throw e_10.error; }
2560
+ }
2561
+ Object.keys(formData).map(function (key) {
2562
+ if (isEmpty(formData[key])) {
2563
+ formData[key] = "";
2564
+ }
2565
+ });
2566
+ this.onClickSaveForm.emit({ data: formData });
2567
+ };
2568
+ // Component Helpers
2569
+ KwikIDFormViewComponent.prototype.fieldHide = function (fieldKey) {
2570
+ var field = findFieldFromKey(this.formFields, fieldKey);
2571
+ var fieldIndex = this.formFields.findIndex(function (_) {
2572
+ return field.key === _.key;
2573
+ });
2574
+ this.formFields[fieldIndex]["hidden"] = true;
2575
+ };
2576
+ KwikIDFormViewComponent.prototype.fieldShow = function (fieldKey) {
2577
+ var field = findFieldFromKey(this.formFields, fieldKey);
2578
+ var fieldIndex = this.formFields.findIndex(function (_) {
2579
+ return field.key === _.key;
2580
+ });
2581
+ this.formFields[fieldIndex]["hidden"] = false;
2582
+ this.formGroup.updateValueAndValidity();
2583
+ };
2584
+ KwikIDFormViewComponent.prototype.fieldDisable = function (fieldKey) {
2585
+ var field = findFieldFromKey(this.formFields, fieldKey);
2586
+ var fieldIndex = this.formFields.findIndex(function (_) {
2587
+ return field.key === _.key;
2588
+ });
2589
+ this.formFields[fieldIndex]["disabled"] = true;
2590
+ if (isNotEmpty(this.formGroup.controls)) {
2591
+ this.formGroup.controls[field.key].disable({
2592
+ emitEvent: false
2593
+ });
2594
+ }
2595
+ };
2596
+ KwikIDFormViewComponent.prototype.fieldEnable = function (fieldKey) {
2597
+ var field = findFieldFromKey(this.formFields, fieldKey);
2598
+ var fieldIndex = this.formFields.findIndex(function (_) {
2599
+ return field.key === _.key;
2600
+ });
2601
+ this.formFields[fieldIndex]["disabled"] = false;
2602
+ if (isNotEmpty(this.formGroup.controls)) {
2603
+ this.formGroup.controls[field.key].enable({
2604
+ emitEvent: false
2605
+ });
2606
+ }
2607
+ };
2608
+ KwikIDFormViewComponent.prototype.fieldReset = function (fieldKey) {
2609
+ // Find the field and its index in the formFields array
2610
+ var field = findFieldFromKey(this.formFields, fieldKey);
2611
+ var fieldIndex = findFieldIndexFromKey(this.formFields, fieldKey);
2612
+ // Delete the field from the formData object
2613
+ delete this.formData[fieldKey];
2614
+ // Reset the value of the field in the formGroup
2615
+ this.formGroup.controls[field.key].reset(setEmptyValue(field), {
2616
+ emitEvent: false
2617
+ });
2618
+ // Reset the messages and errors for the field
2619
+ field = removeMessage(field, {
2620
+ type: EMessageType.WARNING,
2621
+ message: ""
2622
+ });
2623
+ field = removeMessage(field, {
2624
+ type: EMessageType.SUCCESS,
2625
+ message: ""
2626
+ });
2627
+ this.fieldErrorHide(fieldKey, {
2628
+ type: EMessageType.ERROR,
2629
+ message: ""
2630
+ });
2631
+ // Reset the value of the field in the formFields array
2632
+ switch (field.type) {
2633
+ case "api-call":
2634
+ var fieldApiCall = field;
2635
+ fieldApiCall.api.status.value = EApiStatusType.DEFAULT;
2636
+ this.formFields[fieldIndex] = fieldApiCall;
2637
+ break;
2638
+ default:
2639
+ field.focus = false;
2640
+ field.invalid = false;
2641
+ this.formFields[fieldIndex] = field;
2642
+ break;
2643
+ }
2644
+ };
2645
+ KwikIDFormViewComponent.prototype.fieldErrorShow = function (fieldKey, message) {
2646
+ var field = findFieldFromKey(this.formFields, fieldKey);
2647
+ var fieldIndex = this.formFields.findIndex(function (_) {
2648
+ return field.key === _.key;
2649
+ });
2650
+ field = highlightFieldError(field, true);
2651
+ field = addMessage(field, message);
2652
+ this.formFields[fieldIndex] = field;
2653
+ };
2654
+ KwikIDFormViewComponent.prototype.fieldErrorHide = function (fieldKey, message) {
2655
+ var field = findFieldFromKey(this.formFields, fieldKey);
2656
+ var fieldIndex = this.formFields.findIndex(function (_) {
2657
+ return field.key === _.key;
2658
+ });
2659
+ field = highlightFieldError(field, false);
2660
+ field = removeMessage(field, message);
2661
+ this.formFields[fieldIndex] = field;
2662
+ };
2663
+ KwikIDFormViewComponent.prototype.fieldMessageShow = function (fieldKey, message) {
2664
+ var field = findFieldFromKey(this.formFields, fieldKey);
2665
+ var fieldIndex = this.formFields.findIndex(function (_) {
2666
+ return field.key === _.key;
2667
+ });
2668
+ field = addMessage(field, message);
2669
+ this.formFields[fieldIndex] = field;
2670
+ };
2671
+ KwikIDFormViewComponent.prototype.fieldMessageHide = function (fieldKey, message) {
2672
+ var field = findFieldFromKey(this.formFields, fieldKey);
2673
+ var fieldIndex = this.formFields.findIndex(function (_) {
2674
+ return field.key === _.key;
2675
+ });
2676
+ field = removeMessage(field, message);
2677
+ this.formFields[fieldIndex] = field;
2678
+ };
2679
+ KwikIDFormViewComponent.prototype.setObjectValue = function (field, path, value) { };
2680
+ KwikIDFormViewComponent.prototype.patchFieldControlValue = function (key, value) {
2681
+ var _a;
2682
+ this.formGroup.patchValue((_a = {},
2683
+ _a[key] = value,
2684
+ _a), { emitEvent: false });
2685
+ };
2686
+ KwikIDFormViewComponent.prototype.isFieldValid = function (fieldKey) {
2687
+ return this.formGroup.controls[fieldKey].valid;
2688
+ };
2689
+ KwikIDFormViewComponent.prototype.isFieldEnabled = function (fieldKey) {
2690
+ return this.formGroup.controls[fieldKey].enabled;
2691
+ };
2692
+ KwikIDFormViewComponent.prototype.getFormGroupRawValues = function () {
2693
+ return this.formGroup.getRawValue();
2694
+ };
2695
+ KwikIDFormViewComponent.prototype.handleFieldTypeSearchText = function (field, childField) {
2696
+ return __awaiter(this, void 0, void 0, function () {
2697
+ var _a;
2698
+ return __generator(this, function (_b) {
2699
+ switch (_b.label) {
2700
+ case 0:
2701
+ if (hasKey$1(childField, "json")) {
2702
+ childField.options = getSearchTextOptionsFromFieldConfig(field, childField, this.formGroup);
2703
+ }
2704
+ if (!hasKey$1(childField, "fetchJsonFromRemote")) return [3 /*break*/, 2];
2705
+ _a = childField;
2706
+ return [4 /*yield*/, getSearchTextOptionsFromRemoteFile(field, childField, this.formGroup)];
2707
+ case 1:
2708
+ _a.options = _b.sent();
2709
+ _b.label = 2;
2710
+ case 2: return [2 /*return*/, childField];
2711
+ }
2712
+ });
2713
+ });
2714
+ };
2715
+ KwikIDFormViewComponent.prototype.takeAction = function (action, field, allFormsData, formData, previousFormData) {
2716
+ return __awaiter(this, void 0, void 0, function () {
2717
+ var _a, sources, sourceValue;
2718
+ return __generator(this, function (_b) {
2719
+ switch (_b.label) {
2720
+ case 0:
2721
+ _a = action.key;
2722
+ switch (_a) {
2723
+ case EActionKey.FIELD_HIDE: return [3 /*break*/, 1];
2724
+ case EActionKey.FIELD_SHOW: return [3 /*break*/, 2];
2725
+ case EActionKey.FIELD_DISABLE: return [3 /*break*/, 3];
2726
+ case EActionKey.FIELD_ENABLE: return [3 /*break*/, 4];
2727
+ case EActionKey.FIELD_RESET: return [3 /*break*/, 5];
2728
+ case EActionKey.FIELD_ERROR_SHOW: return [3 /*break*/, 6];
2729
+ case EActionKey.FIELD_ERROR_HIDE: return [3 /*break*/, 7];
2730
+ case EActionKey.FIELD_MESSAGE_SHOW: return [3 /*break*/, 8];
2731
+ case EActionKey.FIELD_MESSAGES_HIDE: return [3 /*break*/, 9];
2732
+ case EActionKey.SET_VALUE: return [3 /*break*/, 10];
2733
+ case EActionKey.HANDLE_CONNECTED_ELEMENTS: return [3 /*break*/, 12];
2734
+ case EActionKey.CUSTOM: return [3 /*break*/, 13];
2735
+ }
2736
+ return [3 /*break*/, 14];
2737
+ case 1:
2738
+ this.fieldHide(action.props.fieldKey);
2739
+ return [3 /*break*/, 15];
2740
+ case 2:
2741
+ this.fieldShow(action.props.fieldKey);
2742
+ return [3 /*break*/, 15];
2743
+ case 3:
2744
+ this.fieldDisable(action.props.fieldKey);
2745
+ return [3 /*break*/, 15];
2746
+ case 4:
2747
+ this.fieldEnable(action.props.fieldKey);
2748
+ return [3 /*break*/, 15];
2749
+ case 5:
2750
+ this.fieldReset(action.props.fieldKey);
2751
+ return [3 /*break*/, 15];
2752
+ case 6:
2753
+ this.fieldErrorShow(action.props.fieldKey, action.props.message);
2754
+ return [3 /*break*/, 15];
2755
+ case 7:
2756
+ this.fieldErrorHide(action.props.fieldKey, action.props.message);
2757
+ return [3 /*break*/, 15];
2758
+ case 8:
2759
+ this.fieldMessageShow(action.props.fieldKey, action.props.message);
2760
+ return [3 /*break*/, 15];
2761
+ case 9:
2762
+ this.fieldMessageHide(action.props.fieldKey, action.props.message);
2763
+ return [3 /*break*/, 15];
2764
+ case 10:
2765
+ sources = new Sources(field, this.formData, this.previousFormData, this.allFormsData);
2766
+ return [4 /*yield*/, sources.getValueFromSource(action.props.value.source)];
2767
+ case 11:
2768
+ sourceValue = _b.sent();
2769
+ sources.setValueToSource(action.props.value.destination, sourceValue);
2770
+ field = sources.field;
2771
+ this.formData = sources.formData;
2772
+ this.allFormsData = sources.allFormsData;
2773
+ this.previousFormData = sources.previousFormData;
2774
+ return [3 /*break*/, 15];
2775
+ case 12:
2776
+ this.handleConnectedElements({ key: field.key }, "ACTION");
2777
+ return [3 /*break*/, 15];
2778
+ case 13: return [3 /*break*/, 15];
2779
+ case 14: return [3 /*break*/, 15];
2780
+ case 15: return [2 /*return*/];
2781
+ }
2782
+ });
2783
+ });
2784
+ };
2785
+ return KwikIDFormViewComponent;
2786
+ }());
2787
+ /** @nocollapse */ KwikIDFormViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewComponent, deps: [{ token: KwikIDFormViewService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2788
+ /** @nocollapse */ KwikIDFormViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormViewComponent, selector: "kwikid-form-view", inputs: { formConfig: "formConfig", formData: "formData", apiCallResponse: "apiCallResponse", isMobileView: "isMobileView", allFormsData: "allFormsData", formsList: "formsList" }, outputs: { onClickViewForms: "onClickViewForms", onClickSaveForm: "onClickSaveForm", onClickApiCall: "onClickApiCall", getActiveFormData: "getActiveFormData" }, providers: [KwikIDFormViewService], usesOnChanges: true, ngImport: i0__namespace, template: "<div\r\n class=\"kwikid-form-container\"\r\n *ngIf=\"!this.loading\"\r\n>\r\n <div id=\"uf-form-fields-header-container\">\r\n <div id=\"uf-form-fields-title\">\r\n {{ this.formConfig.title }}\r\n </div>\r\n <div id=\"uf-form-fields-steps\">\r\n Step {{ this.formConfig.sequenceNo }} of {{ this.formsList.length }}\r\n </div>\r\n </div>\r\n <form\r\n class=\"kwikid-form show\"\r\n [formGroup]=\"this.formGroup\"\r\n >\r\n <ng-container *ngFor=\"let field of this.formFields; let i = index\">\r\n <ng-container [ngSwitch]=\"field.type\">\r\n <!-- Form Title -->\r\n <ng-container *ngSwitchCase=\"'title'\">\r\n <div class=\"title\">\r\n <div>\r\n {{ field.label }}\r\n </div>\r\n <kwikui-button\r\n *ngIf=\"field?.reset\"\r\n appearance=\"whiteblock\"\r\n size=\"s\"\r\n label=\"Reset\"\r\n (onClick)=\"this.handleOnClickResetFormFields($event, field)\"\r\n ></kwikui-button>\r\n </div>\r\n </ng-container>\r\n <!-- Input Text -->\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input\r\n [case]=\"field?.properties?.case\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [type]=\"'text'\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Checkbox -->\r\n <ng-container *ngSwitchCase=\"'checkbox'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-checkbox-block\r\n [contentAlign]=\"field?.properties?.contentAlign ?? 'left'\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.properties?.placeholder\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [size]=\"field?.properties?.size ?? 'l'\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-checkbox-block\r\n ><kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Number -->\r\n <ng-container *ngSwitchCase=\"'number'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-number\r\n [decimal]=\"field?.properties?.decimal\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [max]=\"field?.properties?.max\"\r\n [min]=\"field?.properties?.min\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [postfix]=\"field?.properties?.postfix ?? ''\"\r\n [precision]=\"field?.properties?.precision\"\r\n [prefix]=\"field?.properties?.prefix ?? ''\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-number\r\n ><kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Date -->\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-date\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [max]=\"field?.properties?.max\"\r\n [min]=\"field?.properties?.min\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-date>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Phone -->\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-phone\r\n [countryCode]=\"field?.properties?.countryCode\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [phoneMaskAfterCountryCode]=\"\r\n field?.properties?.phoneMaskAfterCountryCode\r\n \"\r\n [placeholder]=\"field?.placeholder\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-phone>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Radio -->\r\n <ng-container *ngSwitchCase=\"'radio'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <label\r\n [tuiLabel]=\"labelTemplate\"\r\n style=\"min-height: auto\"\r\n >\r\n <kwikui-radio-list\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [items]=\"field?.options\"\r\n [label]=\"field?.label\"\r\n [orientation]=\"field?.properties?.orientation\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [size]=\"field?.properties?.size\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-radio-list>\r\n </label>\r\n <ng-template #labelTemplate>\r\n <p\r\n class=\"tui-space_bottom-2\"\r\n [hidden]=\"field?.hidden\"\r\n >\r\n <b>\r\n {{ field.label }}\r\n <span *ngIf=\"field.validators?.required\"></span>\r\n </b>\r\n </p>\r\n </ng-template>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Dropdown -->\r\n <ng-container *ngSwitchCase=\"'dropdown-with-search'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-select-combobox\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [options]=\"field.options\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-select-combobox>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- API Call -->\r\n <ng-container *ngSwitchCase=\"'api-call'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-button-api-call\r\n [apiStatus]=\"field?.api?.status?.value\"\r\n [class]=\"field?.class\"\r\n [disabled]=\"field?.disabled\"\r\n [id]=\"field.key\"\r\n [label]=\"field?.api?.status?.labels[field?.api?.status?.value]\"\r\n [showLoader]=\"field?.disabled === 'loading'\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: fit-content\"\r\n (onClick)=\"this.handleOnClickApiCall($event)\"\r\n ></kwikui-button-api-call>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Mobile OTP -->\r\n <ng-container *ngSwitchCase=\"'otp'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-otp\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [mask]=\"field?.properties?.mask\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-otp>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Aadhaar Number -->\r\n <ng-container *ngSwitchCase=\"'aadhaar-number'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-aadhaar\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-aadhaar>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </form>\r\n <div class=\"kwikid-form-buttons\">\r\n <kwikui-button\r\n *ngIf=\"this.isMobileView\"\r\n [disabled]=\"viewFormsButton.disabled\"\r\n id=\"\"\r\n label=\"View Forms\"\r\n [showLoader]=\"viewFormsButton.showLoader\"\r\n styles=\"\"\r\n class=\"\"\r\n type=\"button\"\r\n appearance=\"secondary\"\r\n icon=\"\"\r\n iconRight=\"\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: 100%\"\r\n (onClick)=\"this.handleOnClickViewForms($event)\"\r\n ></kwikui-button>\r\n <kwikui-button\r\n [disabled]=\"saveFormButton.disabled\"\r\n id=\"\"\r\n label=\"Save\"\r\n [showLoader]=\"saveFormButton.showLoader\"\r\n styles=\"\"\r\n class=\"\"\r\n type=\"button\"\r\n appearance=\"primary\"\r\n icon=\"\"\r\n iconRight=\"\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: 100%\"\r\n (onClick)=\"this.handleOnClickSaveForm($event)\"\r\n ></kwikui-button>\r\n </div>\r\n</div>\r\n<div\r\n class=\"kwikid-form-container-loading\"\r\n *ngIf=\"this.loading\"\r\n>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n</div>\r\n", styles: ["::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{background:lightgray;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:gray}.kwikid-form-container{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center}.kwikid-form.show{width:100%;height:100%;padding:1rem;overflow-y:auto;display:flex;flex-direction:column;align-content:center;justify-content:flex-start;align-items:stretch;grid-row-gap:1rem;row-gap:1rem}.kwikid-form-buttons{width:100%;bottom:0px;padding:1rem;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;grid-column-gap:10px;column-gap:10px}.kwikid-form-buttons *{flex-grow:1}#uf-form-fields-header-container{display:flex;flex-direction:column;align-content:center;justify-content:center;align-items:flex-start;grid-row-gap:.5rem;row-gap:.5rem;padding:1rem}#uf-form-fields-title{color:#000;font-size:1.75em;font-weight:bold}#uf-form-fields-steps{color:var(--color-on-secondary-container);font-size:1em}.title{border-left:.25rem solid var(--tui-primary);padding:.75rem;font-size:1.4em;font-weight:bold;background-color:var(--tui-secondary);display:flex;flex-direction:row;align-content:center;justify-content:space-between;align-items:center;grid-gap:.5rem;gap:.5rem}.title:not(:first-child){margin-top:.5rem}.large-wrapper{width:100%;height:60px}.large-wrapper:first-child{margin-bottom:auto}.large-wrapper:last-child{margin-top:auto}.kwikid-form-container-loading{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;grid-row-gap:1rem;row-gap:1rem;padding:1rem}\n"], components: [{ type: i2__namespace.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }, { type: i2__namespace.KwikUIInputComponent, selector: "kwikui-input", inputs: ["label", "id", "type", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "validators", "case", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIMessagesComponent, selector: "kwikui-messages", inputs: ["messages", "id"] }, { type: i2__namespace.KwikUICheckboxBlockComponent, selector: "kwikui-checkbox-block", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "contentAlign", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIInputNumberComponent, selector: "kwikui-input-number", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "countryCode", "phoneMaskAfterCountryCode", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i3__namespace.TuiLabelComponent, selector: "label[tuiLabel]", inputs: ["tuiLabel", "context"] }, { type: i2__namespace.KwikUIRadioListComponent, selector: "kwikui-radio-list", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "items", "orientation", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUISelectComboboxComponent, selector: "kwikui-select-combobox", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "options", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIButtonApiCallComponent, selector: "kwikui-button-api-call", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "shape", "size", "apiStatus"], outputs: ["onClick"] }, { type: i2__namespace.KwikUIInputOtpComponent, selector: "kwikui-input-otp", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2__namespace.KwikUIInputAadhaarComponent, selector: "kwikui-input-aadhaar", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i5__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }] });
2789
+ __decorate([
2790
+ log
2791
+ ], KwikIDFormViewComponent.prototype, "ngOnInit", null);
2792
+ __decorate([
2793
+ log
2794
+ ], KwikIDFormViewComponent.prototype, "ngAfterViewInit", null);
2795
+ __decorate([
2796
+ log
2797
+ ], KwikIDFormViewComponent.prototype, "ngOnChanges", null);
2798
+ __decorate([
2799
+ log
2800
+ ], KwikIDFormViewComponent.prototype, "initFormConfig", null);
2801
+ __decorate([
2802
+ log
2803
+ ], KwikIDFormViewComponent.prototype, "setFormFieldsFromFormConfig", null);
2804
+ __decorate([
2805
+ log
2806
+ ], KwikIDFormViewComponent.prototype, "setFormDataFromAllFormsData", null);
2807
+ __decorate([
2808
+ log
2809
+ ], KwikIDFormViewComponent.prototype, "handleConnectedElementFieldActions", null);
2810
+ __decorate([
2811
+ log
2812
+ ], KwikIDFormViewComponent.prototype, "handleConnectedElementFields", null);
2813
+ __decorate([
2814
+ log
2815
+ ], KwikIDFormViewComponent.prototype, "handleConnectedElements", null);
2816
+ __decorate([
2817
+ log
2818
+ ], KwikIDFormViewComponent.prototype, "handleGetKeyValue", null);
2819
+ __decorate([
2820
+ log
2821
+ ], KwikIDFormViewComponent.prototype, "handleOnClickResetFormFields", null);
2822
+ __decorate([
2823
+ log
2824
+ ], KwikIDFormViewComponent.prototype, "handleOnClickApiCall", null);
2825
+ __decorate([
2826
+ log
2827
+ ], KwikIDFormViewComponent.prototype, "handleOnClickViewForms", null);
2828
+ __decorate([
2829
+ log
2830
+ ], KwikIDFormViewComponent.prototype, "handleOnClickSaveForm", null);
2831
+ __decorate([
2832
+ log
2833
+ ], KwikIDFormViewComponent.prototype, "fieldHide", null);
2834
+ __decorate([
2835
+ log
2836
+ ], KwikIDFormViewComponent.prototype, "fieldShow", null);
2837
+ __decorate([
2838
+ log
2839
+ ], KwikIDFormViewComponent.prototype, "fieldDisable", null);
2840
+ __decorate([
2841
+ log
2842
+ ], KwikIDFormViewComponent.prototype, "fieldEnable", null);
2843
+ __decorate([
2844
+ log
2845
+ ], KwikIDFormViewComponent.prototype, "fieldReset", null);
2846
+ __decorate([
2847
+ log
2848
+ ], KwikIDFormViewComponent.prototype, "fieldErrorShow", null);
2849
+ __decorate([
2850
+ log
2851
+ ], KwikIDFormViewComponent.prototype, "fieldErrorHide", null);
2852
+ __decorate([
2853
+ log
2854
+ ], KwikIDFormViewComponent.prototype, "fieldMessageShow", null);
2855
+ __decorate([
2856
+ log
2857
+ ], KwikIDFormViewComponent.prototype, "fieldMessageHide", null);
2858
+ __decorate([
2859
+ log
2860
+ ], KwikIDFormViewComponent.prototype, "setObjectValue", null);
2861
+ __decorate([
2862
+ log
2863
+ ], KwikIDFormViewComponent.prototype, "patchFieldControlValue", null);
2864
+ __decorate([
2865
+ log
2866
+ ], KwikIDFormViewComponent.prototype, "isFieldValid", null);
2867
+ __decorate([
2868
+ log
2869
+ ], KwikIDFormViewComponent.prototype, "isFieldEnabled", null);
2870
+ __decorate([
2871
+ log
2872
+ ], KwikIDFormViewComponent.prototype, "getFormGroupRawValues", null);
2873
+ __decorate([
2874
+ log
2875
+ ], KwikIDFormViewComponent.prototype, "handleFieldTypeSearchText", null);
2876
+ __decorate([
2877
+ log
2878
+ ], KwikIDFormViewComponent.prototype, "takeAction", null);
2879
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewComponent, decorators: [{
2880
+ type: i0.Component,
2881
+ args: [{
2882
+ selector: "kwikid-form-view",
2883
+ templateUrl: "./form-view.component.html",
2884
+ styleUrls: ["./form-view.component.scss"],
2885
+ providers: [KwikIDFormViewService]
2886
+ }]
2887
+ }], ctorParameters: function () { return [{ type: KwikIDFormViewService }]; }, propDecorators: { formConfig: [{
2888
+ type: i0.Input
2889
+ }], formData: [{
2890
+ type: i0.Input
2891
+ }], apiCallResponse: [{
2892
+ type: i0.Input
2893
+ }], isMobileView: [{
2894
+ type: i0.Input
2895
+ }], allFormsData: [{
2896
+ type: i0.Input
2897
+ }], formsList: [{
2898
+ type: i0.Input
2899
+ }], onClickViewForms: [{
2900
+ type: i0.Output
2901
+ }], onClickSaveForm: [{
2902
+ type: i0.Output
2903
+ }], onClickApiCall: [{
2904
+ type: i0.Output
2905
+ }], getActiveFormData: [{
2906
+ type: i0.Output
2907
+ }], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], fieldHide: [], fieldShow: [], fieldDisable: [], fieldEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], handleFieldTypeSearchText: [], takeAction: [] } });
2908
+
2909
+ var hasKey = function (object, key) {
2910
+ return object.hasOwnProperty(key);
2911
+ };
2912
+
2913
+ var KwikIDFormsListComponent = /** @class */ (function () {
2914
+ function KwikIDFormsListComponent() {
2915
+ this.formsList = [];
2916
+ this.formsListCompleted = [];
2917
+ this.isMobileView = false;
2918
+ this.onClickSetActiveForm = new i0.EventEmitter();
2919
+ this.onClickHideFormsList = new i0.EventEmitter();
2920
+ this.onClickSubmitForms = new i0.EventEmitter();
2921
+ this.selectedForm = "";
2922
+ }
2923
+ KwikIDFormsListComponent.prototype.ngOnInit = function () { };
2924
+ KwikIDFormsListComponent.prototype.ngOnChanges = function (changes) {
2925
+ var verifyChange = function (key) {
2926
+ return hasKey(changes, key) && !changes[key].firstChange;
2927
+ };
2928
+ if (verifyChange("formsList")) {
2929
+ this.formsList = changes.formsList.currentValue;
2930
+ }
2931
+ if (verifyChange("isMobileView")) {
2932
+ this.isMobileView = changes.isMobileView.currentValue;
2933
+ }
2934
+ };
2935
+ KwikIDFormsListComponent.prototype.handleOnClickSetActiveForm = function (selectedForm) {
2936
+ if (this.selectedForm !== selectedForm) {
2937
+ this.selectedForm = selectedForm;
2938
+ this.onClickSetActiveForm.emit(selectedForm);
2939
+ }
2940
+ };
2941
+ KwikIDFormsListComponent.prototype.handleOnSubmitForms = function (e) {
2942
+ this.onClickSubmitForms.emit(e);
2943
+ };
2944
+ return KwikIDFormsListComponent;
2945
+ }());
2946
+ /** @nocollapse */ KwikIDFormsListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2947
+ /** @nocollapse */ KwikIDFormsListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: { formsList: "formsList", formsListCompleted: "formsListCompleted", isMobileView: "isMobileView" }, outputs: { onClickSetActiveForm: "onClickSetActiveForm", onClickHideFormsList: "onClickHideFormsList", onClickSubmitForms: "onClickSubmitForms" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div id=\"sidebar-container\">\r\n <div id=\"sidebar\">\r\n <div id=\"uf-progress\">\r\n <div id=\"uf-progress-steps\">\r\n {{ this.formsListCompleted.length }} / {{ this.formsList.length }} Steps\r\n Completed\r\n </div>\r\n <kwikui-progress-segmented\r\n [max]=\"this.formsList.length\"\r\n size=\"m\"\r\n [value]=\"this.formsListCompleted.length\"\r\n ></kwikui-progress-segmented>\r\n </div>\r\n <div id=\"uf-sections-container\">\r\n <div\r\n *ngFor=\"let form of formsList; let i = index\"\r\n [class]=\"'uf-section-item'\"\r\n [class.completed]=\"form.status === 'completed' && !form.disabled\"\r\n [class.edit]=\"form.status !== 'completed' && !form.disabled\"\r\n [class.locked]=\"form.status !== 'completed' && form.disabled\"\r\n (click)=\"\r\n form.status !== 'completed' && form.disabled\r\n ? undefined\r\n : handleOnClickSetActiveForm(form.key)\r\n \"\r\n >\r\n <div class=\"uf-form-section-card-title\">\r\n {{ form.title }}\r\n </div>\r\n <div class=\"uf-form-section-card-action\">\r\n <div\r\n *ngIf=\"form.status === 'completed' && !form.disabled\"\r\n class=\"uf-form-section-card-action-img completed\"\r\n >\r\n <tui-svg src=\"tuiIconCheckLarge\"></tui-svg>\r\n <!-- <img class=\"completed\" src=\"assets/done1.png\" /> -->\r\n </div>\r\n <div\r\n *ngIf=\"form.status !== 'completed' && !form.disabled\"\r\n class=\"uf-form-section-card-action-img edit\"\r\n >\r\n <tui-svg src=\"tuiIconEdit\"></tui-svg>\r\n <!-- <img class=\"active\" src=\"assets/edit.png\" /> -->\r\n </div>\r\n <div\r\n *ngIf=\"form.status !== 'completed' && form.disabled\"\r\n class=\"uf-form-section-card-action-img locked\"\r\n >\r\n <tui-svg src=\"tuiIconLock\"></tui-svg>\r\n <!-- <img class=\"disabled\" src=\"assets/lock.png\" /> -->\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div id=\"submit-sidebar-btn-container\">\r\n <kwikui-button\r\n [disabled]=\"false\"\r\n id=\"\"\r\n label=\"Submit\"\r\n [showLoader]=\"false\"\r\n styles=\"\"\r\n class=\"\"\r\n type=\"button\"\r\n appearance=\"primary\"\r\n icon=\"\"\r\n iconRight=\"\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: 100%\"\r\n (onClick)=\"handleOnSubmitForms($event)\"\r\n ></kwikui-button>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{background:lightgray;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:gray}#sidebar-container{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center}#sidebar{width:100%;height:100%;display:flex;flex-direction:column;align-content:center;justify-content:flex-start;align-items:stretch}.uf-section-item{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:space-between;align-content:center;padding:1rem;grid-gap:1rem;gap:1rem;cursor:pointer;box-shadow:0 .1rem .5rem -.25rem gray;border-radius:.5rem;background-color:var(--tui-base-02)}.uf-section-item:hover{box-shadow:0 .2rem .75rem -.5rem #656565}#submit-sidebar-btn-container{width:100%;bottom:0px;z-index:1;padding:1rem;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;grid-gap:1rem;gap:1rem}#submit-sidebar-btn-container *{flex-grow:1}#uf-sections-container{display:flex;flex-direction:column;height:100%;grid-row-gap:20px;row-gap:20px;padding:1rem;overflow-y:auto}.uf-form-section-card{display:flex;flex-direction:row;align-content:center;justify-content:space-between;align-items:center;grid-column-gap:10px;column-gap:10px;border:none;border-radius:8px;background-color:#e9e9e9;height:-moz-fit-content;height:fit-content;min-height:60px;padding:10px 15px;width:100%;max-width:350px;margin:0 auto}.uf-section-item.locked{-webkit-user-select:none;user-select:none;cursor:not-allowed}.uf-form-section-card .uf-form-section-card-title{font-size:1.2em;text-align:left;line-height:1.25em}.uf-form-section-card .uf-form-section-card-action{width:30px;height:30px;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center}.uf-form-section-card .uf-form-section-card-action .uf-form-section-card-action-img{width:30px;height:30px;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;border-radius:100%;color:#fff;font-weight:bold}.uf-form-section-card-action-img.completed{background-color:#228b22;padding:.25rem;border-radius:50%;color:#fff}.uf-form-section-card-action-img.edit{background-color:#dc143c;padding:.25rem;border-radius:50%;color:#fff}.uf-form-section-card-action-img.locked{background-color:gray;padding:.25rem;border-radius:50%;color:#fff}#uf-progress{display:flex;padding:1rem;flex-direction:column;align-content:center;justify-content:center;align-items:stretch;grid-gap:.5rem;gap:.5rem}#uf-progress-steps{font-size:1em;text-align:right;color:#3d3d3d}.uf-form-section-card-title{font-size:1em;font-weight:bold;color:#121212}@media screen and (max-width: 600px){#sidebar-container{max-width:unset}}\n"], components: [{ type: i2__namespace.KwikUIProgressSegmentedComponent, selector: "kwikui-progress-segmented", inputs: ["value", "max", "size", "colors"] }, { type: i3__namespace.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { type: i2__namespace.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }], directives: [{ type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2948
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListComponent, decorators: [{
2949
+ type: i0.Component,
2950
+ args: [{
2951
+ selector: "kwikid-forms-list",
2952
+ templateUrl: "./forms-list.component.html",
2953
+ styleUrls: ["./forms-list.component.scss"]
2954
+ }]
2955
+ }], ctorParameters: function () { return []; }, propDecorators: { formsList: [{
2956
+ type: i0.Input
2957
+ }], formsListCompleted: [{
2958
+ type: i0.Input
2959
+ }], isMobileView: [{
2960
+ type: i0.Input
2961
+ }], onClickSetActiveForm: [{
2962
+ type: i0.Output
2963
+ }], onClickHideFormsList: [{
2964
+ type: i0.Output
2965
+ }], onClickSubmitForms: [{
2966
+ type: i0.Output
2967
+ }] } });
2968
+
2969
+ var Converter = /** @class */ (function () {
2970
+ function Converter() {
2971
+ this.getFormFields = function (formConfig) {
2972
+ var fields;
2973
+ if (hasKey$2(formConfig, "multiForm")) {
2974
+ fields = formConfig.multiForm.fields;
2975
+ }
2976
+ else {
2977
+ fields = formConfig.fields;
2978
+ }
2979
+ return fields;
2980
+ };
2981
+ this.setMissingFieldKeyValue = function (field, key, value) {
2982
+ if (!hasKey$2(field, key)) {
2983
+ field[key] = value;
2984
+ }
2985
+ return field;
2986
+ };
2987
+ this.setFieldKeyValue = function (field, key, value) {
2988
+ field[key] = value;
2989
+ return field;
2990
+ };
2991
+ this.removeFieldKey = function (field, key) {
2992
+ if (hasKey$2(field, key)) {
2993
+ delete field[key];
2994
+ }
2995
+ return field;
2996
+ };
2997
+ }
2998
+ Converter.prototype.convertFormConfig = function (formConfig) {
2999
+ var e_1, _a;
3000
+ var _this = this;
3001
+ var updateOnFieldType = function (field) {
3002
+ var formatFieldTypeTitle = function (field) {
3003
+ var fieldKey = field.type + "_" + field.label
3004
+ .split(" ")
3005
+ .join("_")
3006
+ .toLocaleLowerCase();
3007
+ field = _this.setFieldKeyValue(field, "key", fieldKey);
3008
+ field = _this.setFieldKeyValue(field, "hidden", false);
3009
+ return field;
3010
+ };
3011
+ var formatFieldTypeRadio = function (field) {
3012
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "size", "m");
3013
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "orientation", "vertical");
3014
+ field = _this.setFieldKeyValue(field, "hidden", false);
3015
+ field.options = field.options.map(function (x) {
3016
+ return { label: x, disabled: false };
3017
+ });
3018
+ return field;
3019
+ };
3020
+ var formatFieldTypeOtp = function (field) {
3021
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "mask", new Array(field.properties.otpLength).fill("#").join(" "));
3022
+ field = _this.setFieldKeyValue(field, "hidden", false);
3023
+ return field;
3024
+ };
3025
+ var formatFieldTypeDate = function (field) {
3026
+ var convertDateStringToTuiDayFormat = function (date) {
3027
+ var splitDate = date.split("-");
3028
+ var tuiDay = new cdk.TuiDay(Number(splitDate[2]), // Year
3029
+ Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
3030
+ Number(splitDate[0]) // Day
3031
+ );
3032
+ return tuiDay;
3033
+ };
3034
+ if (hasKey$2(field, "min")) {
3035
+ var tuiDay = convertDateStringToTuiDayFormat(field["min"]);
3036
+ field.properties = _this.setFieldKeyValue(field.properties, "min", tuiDay);
3037
+ }
3038
+ else {
3039
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "min", new cdk.TuiDay(0, 0, 1)); // Year - 0000, Month - 0 (0 Indexing), Day - 1
3040
+ }
3041
+ if (hasKey$2(field, "max")) {
3042
+ var tuiDay = convertDateStringToTuiDayFormat(field["max"]);
3043
+ field.properties = _this.setFieldKeyValue(field.properties, "max", tuiDay);
3044
+ }
3045
+ else {
3046
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "max", new cdk.TuiDay(new Date().getFullYear(), // Year - 9999
3047
+ new Date().getMonth(), // Month - 11 (0 Indexing)
3048
+ new Date().getDate() // Day - 31
3049
+ ));
3050
+ }
3051
+ field = _this.setFieldKeyValue(field, "hidden", false);
3052
+ return field;
3053
+ };
3054
+ var formatFieldTypeNumber = function (field) {
3055
+ if (hasKey$2(field, "key")) {
3056
+ if (field.key === "aadhaar_number") {
3057
+ field = _this.setFieldKeyValue(field, "type", "aadhaar_number");
3058
+ }
3059
+ if (field.key === "contact_number") {
3060
+ field = _this.setFieldKeyValue(field, "type", "phone");
3061
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "countryCode", "+91");
3062
+ field.properties = _this.setMissingFieldKeyValue(field.properties, "phoneMaskAfterCountryCode", "####-######");
3063
+ field.properties = _this.setFieldKeyValue(field.properties, "decimal", "not-zero");
3064
+ field.properties = _this.setFieldKeyValue(field.properties, "min", -Infinity);
3065
+ field.properties = _this.setFieldKeyValue(field.properties, "max", Infinity);
3066
+ field.properties = _this.setFieldKeyValue(field.properties, "precision", 0);
3067
+ }
3068
+ }
3069
+ field = _this.setFieldKeyValue(field, "hidden", false);
3070
+ return field;
3071
+ };
3072
+ var formatFieldTypeApiCall = function (field) {
3073
+ if (!hasKey$2(field.properties, "shape")) {
3074
+ field.properties = _this.setFieldKeyValue(field.properties, "shape", null);
3075
+ }
3076
+ if (!hasKey$2(field, "showLoader")) {
3077
+ field = _this.setFieldKeyValue(field, "showLoader", false);
3078
+ }
3079
+ if (!hasKey$2(field.properties, "size")) {
3080
+ field.properties = _this.setFieldKeyValue(field.properties, "size", "m");
3081
+ }
3082
+ if (!hasKey$2(field, "api")) {
3083
+ field = _this.setFieldKeyValue(field, "api", {});
3084
+ field.api = _this.setMissingFieldKeyValue(field.api, "url", "");
3085
+ field.api = _this.setMissingFieldKeyValue(field.api, "request", "");
3086
+ field.api = _this.setMissingFieldKeyValue(field.api, "response", "");
3087
+ field.api = _this.setMissingFieldKeyValue(field.api, "status", "");
3088
+ field.api.status = _this.setMissingFieldKeyValue(field.api.status, "value", "default");
3089
+ field.api.status = _this.setMissingFieldKeyValue(field.api.status, "labels", {
3090
+ default: "Call API",
3091
+ loading: "Call API",
3092
+ success: "API Success",
3093
+ failed: "API Failed"
3094
+ });
3095
+ }
3096
+ return field;
3097
+ };
3098
+ var formatFieldTypeSearchText = function (field) {
3099
+ if (hasKey$2(field, "type")) {
3100
+ if (field.type === "search-text") {
3101
+ field = _this.setFieldKeyValue(field, "type", "dropdown-with-search");
3102
+ }
3103
+ }
3104
+ return field;
3105
+ };
3106
+ var formatFieldTypeText = function (field) {
3107
+ return field;
3108
+ };
3109
+ switch (field.type) {
3110
+ case "title":
3111
+ field = formatFieldTypeTitle(field);
3112
+ break;
3113
+ case "radio":
3114
+ field = formatFieldTypeRadio(field);
3115
+ break;
3116
+ case "otp":
3117
+ field = formatFieldTypeOtp(field);
3118
+ break;
3119
+ case "date":
3120
+ field = formatFieldTypeDate(field);
3121
+ break;
3122
+ case "number":
3123
+ field = formatFieldTypeNumber(field);
3124
+ break;
3125
+ case "api-call":
3126
+ field = formatFieldTypeApiCall(field);
3127
+ break;
3128
+ case "search-text":
3129
+ field = formatFieldTypeSearchText(field);
3130
+ break;
3131
+ default:
3132
+ break;
3133
+ }
3134
+ return field;
3135
+ };
3136
+ var getConnectedElementKeyValueObject = function (key) {
3137
+ var object = {
3138
+ key: key,
3139
+ conditions: { formula: "", rules: [] },
3140
+ actions: { success: [], failure: [] }
3141
+ };
3142
+ return object;
3143
+ };
3144
+ var formatFieldKeys = function (field) {
3145
+ if (hasKey$2(field, "connectedTo")) {
3146
+ if (typeof field["connectedTo"] === "string") {
3147
+ field["connectedElements"] = [
3148
+ getConnectedElementKeyValueObject(field["connectedTo"])
3149
+ ];
3150
+ }
3151
+ else {
3152
+ field["connectedTo"] = field["connectedTo"].map(function (key) {
3153
+ return getConnectedElementKeyValueObject(key);
3154
+ });
3155
+ field["connectedElements"] = field["connectedTo"];
3156
+ }
3157
+ }
3158
+ _this.removeFieldKey(field, "connectedTo");
3159
+ if (hasKey$2(field, "connectedToParent")) {
3160
+ if (typeof field["connectedToParent"] === "string") {
3161
+ field["connectedParentFields"] = [
3162
+ getConnectedElementKeyValueObject(field["connectedToParent"])
3163
+ ];
3164
+ }
3165
+ else {
3166
+ field["connectedParentFields"] = getConnectedElementKeyValueObject(field["connectedToParent"]);
3167
+ }
3168
+ }
3169
+ _this.removeFieldKey(field, "connectedToParent");
3170
+ _this.removeFieldKey(field, "sideEffect");
3171
+ return field;
3172
+ };
3173
+ var getConnectedElementFieldMapping = function (field, connectedFieldMapping) {
3174
+ var getConnectedElementChildFieldMapping = function (field, connectedFieldMapping) {
3175
+ if (hasKey$2(field, "connectedElements")) {
3176
+ connectedFieldMapping["child"][field.key] = field.connectedElements;
3177
+ }
3178
+ else if (hasKey$2(connectedFieldMapping["child"], field.key)) {
3179
+ field["connectedElements"] =
3180
+ connectedFieldMapping["child"][field.key];
3181
+ }
3182
+ return { field: field, connectedFieldMapping: connectedFieldMapping };
3183
+ };
3184
+ var getConnectedElementParentFieldMapping = function (field, connectedFieldMapping) {
3185
+ var e_2, _a;
3186
+ console.log(field, connectedFieldMapping);
3187
+ if (hasKey$2(connectedFieldMapping["child"], field.key)) {
3188
+ try {
3189
+ for (var _b = __values(connectedFieldMapping["child"][field.key]), _c = _b.next(); !_c.done; _c = _b.next()) {
3190
+ var connectedParentKey = _c.value;
3191
+ if (hasKey$2(connectedFieldMapping["parent"], connectedParentKey["key"])) {
3192
+ connectedFieldMapping["parent"][connectedParentKey["key"]].push(field.key);
3193
+ }
3194
+ else {
3195
+ connectedFieldMapping["parent"][connectedParentKey["key"]] = [
3196
+ field.key
3197
+ ];
3198
+ }
3199
+ }
3200
+ }
3201
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3202
+ finally {
3203
+ try {
3204
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3205
+ }
3206
+ finally { if (e_2) throw e_2.error; }
3207
+ }
3208
+ }
3209
+ return { field: field, connectedFieldMapping: connectedFieldMapping };
3210
+ };
3211
+ var connectedChildFieldMapping = getConnectedElementChildFieldMapping(field, connectedFieldMapping);
3212
+ field = connectedChildFieldMapping["field"];
3213
+ connectedFieldMapping =
3214
+ connectedChildFieldMapping["connectedFieldMapping"];
3215
+ var connectedParentFieldMapping = getConnectedElementParentFieldMapping(field, connectedFieldMapping);
3216
+ field = connectedParentFieldMapping["field"];
3217
+ connectedFieldMapping =
3218
+ connectedParentFieldMapping["connectedFieldMapping"];
3219
+ return connectedFieldMapping;
3220
+ };
3221
+ var updateConnectedElementsKeyValue = function (field, connectedFieldMapping) {
3222
+ if (hasKey$2(connectedFieldMapping["child"], field.key)) {
3223
+ field["connectedElements"] = connectedFieldMapping["child"][field.key];
3224
+ }
3225
+ if (hasKey$2(connectedFieldMapping["parent"], field.key)) {
3226
+ field["connectedParentFields"] =
3227
+ connectedFieldMapping["parent"][field.key];
3228
+ }
3229
+ return field;
3230
+ };
3231
+ var updateFieldValidatorConfig = function (field) {
3232
+ if (field.type !== "title") {
3233
+ var validators = hasKey$2(field, "validators") ? field.validators : {};
3234
+ field = _this.setMissingFieldKeyValue(field, "validators", {});
3235
+ field = _this.setFieldKeyValue(field, "validators", Object.assign(Object.assign({}, field["validators"]), { min: hasKey$2(validators, "min")
3236
+ ? validators.min
3237
+ : hasKey$2(field, "min")
3238
+ ? field.min
3239
+ : undefined, max: hasKey$2(validators, "max")
3240
+ ? validators.max
3241
+ : hasKey$2(field, "max")
3242
+ ? field.max
3243
+ : undefined, required: hasKey$2(validators, "required")
3244
+ ? validators.required
3245
+ : hasKey$2(field, "required")
3246
+ ? field.required
3247
+ : undefined, minLength: hasKey$2(validators, "minLength")
3248
+ ? validators.minLength
3249
+ : hasKey$2(field, "minLength")
3250
+ ? field.minLength
3251
+ : undefined, maxLength: hasKey$2(validators, "maxLength")
3252
+ ? validators.maxLength
3253
+ : hasKey$2(field, "length")
3254
+ ? field.length
3255
+ : hasKey$2(field, "maxLength")
3256
+ ? field.maxLength
3257
+ : undefined, pattern: hasKey$2(field.validators, "pattern")
3258
+ ? field.validators.pattern
3259
+ : hasKey$2(field, "pattern")
3260
+ ? field.pattern
3261
+ : hasKey$2(field, "regex")
3262
+ ? field.regex
3263
+ : undefined }));
3264
+ delete field.min;
3265
+ delete field.max;
3266
+ delete field.required;
3267
+ delete field.minLength;
3268
+ delete field.length;
3269
+ delete field.maxLength;
3270
+ delete field.pattern;
3271
+ delete field.regex;
3272
+ }
3273
+ return field;
3274
+ };
3275
+ var updateFieldDefaultValueConfig = function (field) {
3276
+ if (field.type !== "title") {
3277
+ if (hasKey$2(field, "defaultValue")) {
3278
+ return field;
3279
+ }
3280
+ else if (hasKey$2(field, "default")) {
3281
+ return field;
3282
+ }
3283
+ else {
3284
+ if (hasKey$2(field, "defaultVal")) {
3285
+ // Currently below line is commented because it caused issues in setting Default Value.
3286
+ // field["defaultValue"] = field["defaultVal"];
3287
+ // delete field["defaultVal"];
3288
+ }
3289
+ // TODO: Condition for all_forms_data is not considered yet.
3290
+ if (field.autoPopulateFromSummaryData) {
3291
+ field["defaultValue"] = {
3292
+ is_found: false,
3293
+ value: "",
3294
+ sources: [
3295
+ {
3296
+ source: "summary_data",
3297
+ summary_data: {
3298
+ path: "$." + field.key,
3299
+ validation: {
3300
+ rules: [
3301
+ {
3302
+ key: "1",
3303
+ type: "is_not_empty",
3304
+ is_not_empty: {
3305
+ value: true
3306
+ }
3307
+ }
3308
+ ],
3309
+ actions: [
3310
+ {
3311
+ type: "set_default_value_found",
3312
+ condition: "1",
3313
+ set_default_value_found: {
3314
+ value: true
3315
+ }
3316
+ },
3317
+ {
3318
+ type: "enable_field",
3319
+ condition: "1 OR NOT(1)",
3320
+ enable_field: { value: true }
3321
+ }
3322
+ ]
3323
+ }
3324
+ }
3325
+ }
3326
+ ]
3327
+ };
3328
+ }
3329
+ else if (hasKey$2(field, "autofill")) {
3330
+ if (hasKey$2(field.autofill, "type")) {
3331
+ if (field.autofill.type === "storage") {
3332
+ field["defaultValue"] = {
3333
+ is_found: false,
3334
+ value: "",
3335
+ sources: [
3336
+ {
3337
+ source: "browser_storage",
3338
+ browser_storage: {
3339
+ path: "$." + field.key,
3340
+ validation: {
3341
+ rules: [
3342
+ {
3343
+ key: "1",
3344
+ type: "is_not_empty",
3345
+ is_not_empty: {
3346
+ value: true
3347
+ }
3348
+ }
3349
+ ],
3350
+ actions: [
3351
+ {
3352
+ type: "set_default_value_found",
3353
+ condition: "1",
3354
+ set_default_value_found: {
3355
+ value: true
3356
+ }
3357
+ },
3358
+ {
3359
+ type: "enable_field",
3360
+ condition: "1 OR NOT(1)",
3361
+ enable_field: { value: true }
3362
+ }
3363
+ ]
3364
+ }
3365
+ }
3366
+ }
3367
+ ]
3368
+ };
3369
+ }
3370
+ else if (field.autofill.type === "config") {
3371
+ field["defaultValue"] = {
3372
+ is_found: false,
3373
+ value: "",
3374
+ sources: [
3375
+ {
3376
+ source: "field_config",
3377
+ field_config: {
3378
+ path: "$." + field.key,
3379
+ validation: {
3380
+ rules: [
3381
+ {
3382
+ key: "1",
3383
+ type: "is_not_empty",
3384
+ is_not_empty: {
3385
+ value: true
3386
+ }
3387
+ }
3388
+ ],
3389
+ actions: [
3390
+ {
3391
+ type: "set_default_value_found",
3392
+ condition: "1",
3393
+ set_default_value_found: {
3394
+ value: true
3395
+ }
3396
+ },
3397
+ {
3398
+ type: "enable_field",
3399
+ condition: "1 OR NOT(1)",
3400
+ enable_field: { value: true }
3401
+ }
3402
+ ]
3403
+ }
3404
+ }
3405
+ }
3406
+ ]
3407
+ };
3408
+ }
3409
+ }
3410
+ }
3411
+ else {
3412
+ field["defaultValue"] = {
3413
+ is_found: false,
3414
+ value: "",
3415
+ sources: [
3416
+ {
3417
+ source: "form_data",
3418
+ form_data: {
3419
+ path: "$." + field.key,
3420
+ validation: {
3421
+ rules: [
3422
+ {
3423
+ key: "1",
3424
+ type: "is_not_empty",
3425
+ is_not_empty: {
3426
+ value: true
3427
+ }
3428
+ }
3429
+ ],
3430
+ actions: [
3431
+ {
3432
+ type: "set_default_value_found",
3433
+ condition: "1",
3434
+ set_default_value_found: {
3435
+ value: true
3436
+ }
3437
+ },
3438
+ {
3439
+ type: "enable_field",
3440
+ condition: "1 OR NOT(1)",
3441
+ enable_field: { value: true }
3442
+ }
3443
+ ]
3444
+ }
3445
+ }
3446
+ }
3447
+ ]
3448
+ };
3449
+ }
3450
+ }
3451
+ delete field["defaultVal"];
3452
+ }
3453
+ return field;
3454
+ };
3455
+ var updateFieldMessages = function (field) {
3456
+ if (field.type !== "title") {
3457
+ field = _this.setMissingFieldKeyValue(field, "messages", []);
3458
+ }
3459
+ return field;
3460
+ };
3461
+ var updateFieldResetButton = function (field) {
3462
+ if (field.type === "title") {
3463
+ if (hasKey$2(field, "action") &&
3464
+ field.action === "reset" &&
3465
+ hasKey$2(field, "fields")) {
3466
+ field = _this.setFieldKeyValue(field, "reset", {
3467
+ fields: field.fields
3468
+ });
3469
+ }
3470
+ }
3471
+ return field;
3472
+ };
3473
+ var fields = this.getFormFields(formConfig);
3474
+ var connectedFieldMapping = {
3475
+ parent: {},
3476
+ child: {}
3477
+ };
3478
+ var setFormFields = function (formConfig, fields) {
3479
+ if (hasKey$2(formConfig, "multiForm")) {
3480
+ formConfig.multiForm["fields"] = fields;
3481
+ }
3482
+ else {
3483
+ formConfig["fields"] = fields;
3484
+ }
3485
+ return formConfig;
3486
+ };
3487
+ try {
3488
+ for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
3489
+ var field = fields_1_1.value;
3490
+ field = updateOnFieldType(field);
3491
+ field = formatFieldKeys(field);
3492
+ // connectedFieldMapping = getConnectedElementFieldMapping(
3493
+ // field,
3494
+ // connectedFieldMapping
3495
+ // );
3496
+ // field = updateConnectedElementsKeyValue(field, connectedFieldMapping);
3497
+ field = updateFieldDefaultValueConfig(field);
3498
+ field = updateFieldValidatorConfig(field);
3499
+ field = updateFieldResetButton(field);
3500
+ field = updateFieldMessages(field);
3501
+ }
3502
+ }
3503
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3504
+ finally {
3505
+ try {
3506
+ if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
3507
+ }
3508
+ finally { if (e_1) throw e_1.error; }
3509
+ }
3510
+ formConfig = setFormFields(formConfig, fields);
3511
+ return formConfig;
3512
+ };
3513
+ return Converter;
3514
+ }());
3515
+ __decorate([
3516
+ log
3517
+ ], Converter.prototype, "convertFormConfig", null);
3518
+
3519
+ var KwikIDRendererService = /** @class */ (function () {
3520
+ function KwikIDRendererService() {
3521
+ this.isMobileView = false;
3522
+ this.allFormsData = {};
3523
+ }
3524
+ KwikIDRendererService.prototype.setIsMobileView = function (isMobileView) {
3525
+ this.isMobileView = isMobileView;
3526
+ };
3527
+ KwikIDRendererService.prototype.setFormsList = function (formsList) {
3528
+ this.formsList = formsList;
3529
+ };
3530
+ KwikIDRendererService.prototype.setFormsListCompleted = function (formsListCompleted) {
3531
+ this.formsListCompleted = formsListCompleted;
3532
+ };
3533
+ KwikIDRendererService.prototype.setAllFormsData = function (allFormsData) {
3534
+ this.allFormsData = allFormsData;
3535
+ };
3536
+ KwikIDRendererService.prototype.setActiveFormConfig = function (activeFormConfig) {
3537
+ this.activeFormConfig = activeFormConfig;
3538
+ };
3539
+ KwikIDRendererService.prototype.setActiveFormFields = function (activeFormFields) {
3540
+ this.activeFormFields = activeFormFields;
3541
+ };
3542
+ KwikIDRendererService.prototype.setActiveFormData = function (activeFormData) {
3543
+ this.activeFormData = activeFormData;
3544
+ };
3545
+ KwikIDRendererService.prototype.fetchFormConfig = function (url) {
3546
+ return __awaiter(this, void 0, void 0, function () {
3547
+ var response, data;
3548
+ return __generator(this, function (_a) {
3549
+ switch (_a.label) {
3550
+ case 0: return [4 /*yield*/, fetch(url, { method: "GET" })];
3551
+ case 1:
3552
+ response = _a.sent();
3553
+ return [4 /*yield*/, response.json()];
3554
+ case 2:
3555
+ data = _a.sent();
3556
+ return [2 /*return*/, data];
3557
+ }
3558
+ });
3559
+ });
3560
+ };
3561
+ KwikIDRendererService.prototype.findActiveFormConfig = function (formsList) {
3562
+ var activeFormConfig = formsList.find(function (form) {
3563
+ return form.status === "editable" && !form.disabled;
3564
+ });
3565
+ return activeFormConfig;
3566
+ };
3567
+ KwikIDRendererService.prototype.findCompletedFormsList = function (allFormsData) {
3568
+ var formsListCompleted = [];
3569
+ Object.keys(allFormsData).map(function (formKey) {
3570
+ formsListCompleted.push(formKey);
3571
+ });
3572
+ return formsListCompleted;
3573
+ };
3574
+ KwikIDRendererService.prototype.markFormInFormsListAsCompleted = function (formsList, formsListCompleted) {
3575
+ var e_1, _a;
3576
+ try {
3577
+ for (var formsList_1 = __values(formsList), formsList_1_1 = formsList_1.next(); !formsList_1_1.done; formsList_1_1 = formsList_1.next()) {
3578
+ var form = formsList_1_1.value;
3579
+ if (formsListCompleted.includes(form.key)) {
3580
+ form = setValueToObject(form, "status", "completed");
3581
+ form = setValueToObject(form, "disabled", false);
3582
+ }
3583
+ }
3584
+ }
3585
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3586
+ finally {
3587
+ try {
3588
+ if (formsList_1_1 && !formsList_1_1.done && (_a = formsList_1.return)) _a.call(formsList_1);
3589
+ }
3590
+ finally { if (e_1) throw e_1.error; }
3591
+ }
3592
+ return formsList;
3593
+ };
3594
+ KwikIDRendererService.prototype.markFormInFormsListAsDisabled = function (formsList, formsListCompleted) {
3595
+ var e_2, _a;
3596
+ try {
3597
+ for (var formsList_2 = __values(formsList), formsList_2_1 = formsList_2.next(); !formsList_2_1.done; formsList_2_1 = formsList_2.next()) {
3598
+ var form = formsList_2_1.value;
3599
+ if (form.status !== "completed") {
3600
+ if (hasKey$2(form, "dependentOn")) {
3601
+ var isDependent = form.dependentOn.every(function (r) { return formsListCompleted.includes(r); });
3602
+ if (isDependent) {
3603
+ form = setValueToObject(form, "status", "editable");
3604
+ form = setValueToObject(form, "disabled", false);
3605
+ }
3606
+ else {
3607
+ form = setValueToObject(form, "status", "locked");
3608
+ form = setValueToObject(form, "disabled", true);
3609
+ }
3610
+ }
3611
+ else {
3612
+ form = setValueToObject(form, "dependentOn", []);
3613
+ form = setValueToObject(form, "status", "editable");
3614
+ form = setValueToObject(form, "disabled", false);
3615
+ }
3616
+ }
3617
+ }
3618
+ }
3619
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3620
+ finally {
3621
+ try {
3622
+ if (formsList_2_1 && !formsList_2_1.done && (_a = formsList_2.return)) _a.call(formsList_2);
3623
+ }
3624
+ finally { if (e_2) throw e_2.error; }
3625
+ }
3626
+ return formsList;
3627
+ };
3628
+ KwikIDRendererService.prototype.assignSequenceNoToForm = function (formsList) {
3629
+ var e_3, _a;
3630
+ var sequenceNo = 1;
3631
+ try {
3632
+ for (var formsList_3 = __values(formsList), formsList_3_1 = formsList_3.next(); !formsList_3_1.done; formsList_3_1 = formsList_3.next()) {
3633
+ var form = formsList_3_1.value;
3634
+ form.sequenceNo = sequenceNo++;
3635
+ }
3636
+ }
3637
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3638
+ finally {
3639
+ try {
3640
+ if (formsList_3_1 && !formsList_3_1.done && (_a = formsList_3.return)) _a.call(formsList_3);
3641
+ }
3642
+ finally { if (e_3) throw e_3.error; }
3643
+ }
3644
+ return formsList;
3645
+ };
3646
+ KwikIDRendererService.prototype.updateFormsList = function () {
3647
+ var formsList = this.formsList;
3648
+ var formsListCompleted;
3649
+ var activeFormConfig;
3650
+ formsList = this.assignSequenceNoToForm(formsList);
3651
+ formsListCompleted = this.findCompletedFormsList(this.allFormsData);
3652
+ formsList = this.markFormInFormsListAsCompleted(formsList, formsListCompleted);
3653
+ formsList = this.markFormInFormsListAsDisabled(formsList, formsListCompleted);
3654
+ if (formsList.length !== formsListCompleted.length) {
3655
+ activeFormConfig = this.findActiveFormConfig(formsList);
3656
+ this.setActiveFormConfig(activeFormConfig);
3657
+ }
3658
+ this.setFormsList(formsList);
3659
+ this.setFormsListCompleted(formsListCompleted);
3660
+ };
3661
+ return KwikIDRendererService;
3662
+ }());
3663
+ /** @nocollapse */ KwikIDRendererService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDRendererService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
3664
+ /** @nocollapse */ KwikIDRendererService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDRendererService, providedIn: "root" });
3665
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDRendererService, decorators: [{
3666
+ type: i0.Injectable,
3667
+ args: [{
3668
+ providedIn: "root"
3669
+ }]
3670
+ }], ctorParameters: function () { return []; } });
3671
+
3672
+ var KwikIDFormsRendererComponent = /** @class */ (function () {
3673
+ function KwikIDFormsRendererComponent(rendererService, hostElement) {
3674
+ this.rendererService = rendererService;
3675
+ this.hostElement = hostElement;
3676
+ this.formsData = {};
3677
+ this.apiCallResponse = {};
3678
+ this.getFormData = new i0.EventEmitter();
3679
+ this.onClickApiCall = new i0.EventEmitter();
3680
+ this.loading = false;
3681
+ // display forms and list conditionally
3682
+ this.showForm = false;
3683
+ this.showFormFields = true;
3684
+ this.showFormSections = true;
3685
+ }
3686
+ // The final value should be provided to service, so that it can be used in all components
3687
+ KwikIDFormsRendererComponent.prototype.windowResizeWatcher = function () {
3688
+ if (this.hostElement.nativeElement.offsetWidth < 600) {
3689
+ if (this.showForm) {
3690
+ this.showFormSections = false;
3691
+ this.showFormFields = true;
3692
+ }
3693
+ else {
3694
+ this.showFormSections = true;
3695
+ this.showFormFields = false;
3696
+ }
3697
+ this.rendererService.isMobileView = true;
3698
+ }
3699
+ else {
3700
+ if (this.showForm) {
3701
+ this.showFormSections = true;
3702
+ this.showFormFields = true;
3703
+ }
3704
+ else {
3705
+ this.showFormSections = true;
3706
+ this.showFormFields = false;
3707
+ }
3708
+ this.rendererService.isMobileView = false;
3709
+ }
3710
+ };
3711
+ KwikIDFormsRendererComponent.prototype.ngOnInit = function () {
3712
+ this.loading = true;
3713
+ this.rendererService.setFormsList(this.userConfig.userFormFields);
3714
+ this.initializeForms();
3715
+ };
3716
+ KwikIDFormsRendererComponent.prototype.ngOnChanges = function (changes) {
3717
+ var verifyChange = function (prop) {
3718
+ return changes.hasOwnProperty(prop) && !changes[prop].firstChange;
3719
+ };
3720
+ if (verifyChange("userConfig")) {
3721
+ this.userConfig = changes.userConfig.currentValue;
3722
+ }
3723
+ if (verifyChange("formsData")) {
3724
+ this.formsData = changes.formsData.currentValue;
3725
+ this.initializeForms();
3726
+ }
3727
+ if (verifyChange("apiCallResponse")) {
3728
+ this.apiCallResponse = changes.apiCallResponse.currentValue;
3729
+ }
3730
+ };
3731
+ KwikIDFormsRendererComponent.prototype.initializeForms = function () {
3732
+ return __awaiter(this, void 0, void 0, function () {
3733
+ return __generator(this, function (_a) {
3734
+ switch (_a.label) {
3735
+ case 0:
3736
+ this.rendererService.setAllFormsData(this.formsData);
3737
+ this.rendererService.updateFormsList();
3738
+ this.handleResize(this.rendererService.formsList);
3739
+ if (!(this.rendererService.formsList.length !==
3740
+ this.rendererService.formsListCompleted.length)) return [3 /*break*/, 2];
3741
+ return [4 /*yield*/, this.handleOnClickSetActiveForm(this.rendererService.activeFormConfig.key)];
3742
+ case 1:
3743
+ _a.sent();
3744
+ return [3 /*break*/, 3];
3745
+ case 2:
3746
+ this.showForm = false;
3747
+ this.showFormFields = false;
3748
+ _a.label = 3;
3749
+ case 3:
3750
+ this.loading = false;
3751
+ return [2 /*return*/];
3752
+ }
3753
+ });
3754
+ });
3755
+ };
3756
+ KwikIDFormsRendererComponent.prototype.handleResize = function (formsList) {
3757
+ if (this.hostElement.nativeElement.offsetWidth < 600) {
3758
+ if (!isSingleForm(formsList)) {
3759
+ this.showFormSections = true;
3760
+ this.showFormFields = false;
3761
+ this.showForm = false;
3762
+ }
3763
+ else {
3764
+ this.showFormSections = true;
3765
+ this.showFormFields = false;
3766
+ this.showForm = false;
3767
+ }
3768
+ this.rendererService.isMobileView = true;
3769
+ }
3770
+ else {
3771
+ this.rendererService.isMobileView = false;
3772
+ }
3773
+ };
3774
+ // forms-list listener
3775
+ KwikIDFormsRendererComponent.prototype.handleOnClickSetActiveForm = function (selectedForm) {
3776
+ return __awaiter(this, void 0, void 0, function () {
3777
+ var activeFormConfig, formConfig;
3778
+ return __generator(this, function (_a) {
3779
+ switch (_a.label) {
3780
+ case 0:
3781
+ activeFormConfig = this.rendererService.formsList.find(function (form) {
3782
+ if (form.key === selectedForm) {
3783
+ return form;
3784
+ }
3785
+ });
3786
+ return [4 /*yield*/, this.rendererService.fetchFormConfig(activeFormConfig.formContent.url)];
3787
+ case 1:
3788
+ formConfig = _a.sent();
3789
+ formConfig = new Converter().convertFormConfig(formConfig);
3790
+ this.rendererService.setActiveFormData(this.rendererService.allFormsData[formConfig.key]);
3791
+ this.rendererService.setActiveFormConfig(Object.assign(Object.assign({}, activeFormConfig), formConfig));
3792
+ if (this.hostElement.nativeElement.offsetWidth < 600) {
3793
+ this.showFormSections = false;
3794
+ this.showFormFields = true;
3795
+ }
3796
+ else if (this.hostElement.nativeElement.offsetWidth >= 600) {
3797
+ this.showFormSections = true;
3798
+ this.showFormFields = true;
3799
+ }
3800
+ this.showForm = true;
3801
+ return [2 /*return*/];
3802
+ }
3803
+ });
3804
+ });
3805
+ };
3806
+ // forms-list listener
3807
+ KwikIDFormsRendererComponent.prototype.handleOnClickSubmitForms = function (e) {
3808
+ console.log(e);
3809
+ };
3810
+ // form-view listener
3811
+ KwikIDFormsRendererComponent.prototype.handleOnClickApiCall = function (e) {
3812
+ this.onClickApiCall.emit(e);
3813
+ };
3814
+ // form-view listener
3815
+ KwikIDFormsRendererComponent.prototype.handleGetActiveFormData = function (e) {
3816
+ var _a;
3817
+ this.getFormData.emit((_a = {},
3818
+ _a[this.rendererService.activeFormConfig.key] = e["data"],
3819
+ _a));
3820
+ };
3821
+ // form-view listener
3822
+ KwikIDFormsRendererComponent.prototype.handleOnClickSaveForm = function (e) {
3823
+ var _a;
3824
+ this.getFormData.emit((_a = {},
3825
+ _a[this.rendererService.activeFormConfig.key] = e["data"],
3826
+ _a));
3827
+ };
3828
+ // form-view listener
3829
+ KwikIDFormsRendererComponent.prototype.handleOnClickViewForms = function (e) {
3830
+ console.log(e);
3831
+ this.showFormSections = true;
3832
+ this.showForm = false;
3833
+ this.showFormFields = false;
3834
+ };
3835
+ return KwikIDFormsRendererComponent;
3836
+ }());
3837
+ /** @nocollapse */ KwikIDFormsRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsRendererComponent, deps: [{ token: KwikIDRendererService }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
3838
+ /** @nocollapse */ KwikIDFormsRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsRendererComponent, selector: "kwikid-forms-renderer", inputs: { userConfig: "userConfig", formsData: "formsData", apiCallResponse: "apiCallResponse" }, outputs: { getFormData: "getFormData", onClickApiCall: "onClickApiCall" }, host: { listeners: { "window:resize": "windowResizeWatcher($event)" } }, providers: [KwikIDRendererService], usesOnChanges: true, ngImport: i0__namespace, template: "<div ngClass=\"kwikid-renderer\">\r\n <div ngClass=\"kwikid-form-header\">\r\n <div id=\"uf-header\">\r\n <div id=\"uf-header-logo-container\">\r\n <img\r\n id=\"uf-header-logo\"\r\n src=\"https://kwikid.s3.ap-south-1.amazonaws.com/CONFIG/USER/assets/logo/kwikid/kwikid-logo-favicon-32x32.png\"\r\n [ngClass]=\"showForm ? 'small-icon' : 'large-icon'\"\r\n />\r\n </div>\r\n <div id=\"uf-header-title-container\">\r\n <div id=\"uf-header-title\">Customer Registration</div>\r\n <div id=\"uf-header-subtitle\">\r\n {{ \"Central Bank of India\" }}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div\r\n ngClass=\"kwikid-layout-container\"\r\n *ngIf=\"!loading\"\r\n >\r\n <div\r\n ngClass=\"kwikid-sections-container\"\r\n *ngIf=\"showFormSections\"\r\n class=\"active\"\r\n [class.active]=\"showFormSections\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n >\r\n <kwikid-forms-list\r\n [formsList]=\"this.rendererService.formsList\"\r\n [formsListCompleted]=\"this.rendererService.formsListCompleted\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickSetActiveForm)=\"this.handleOnClickSetActiveForm($event)\"\r\n (onClickSubmitForms)=\"this.handleOnClickSubmitForms($event)\"\r\n ></kwikid-forms-list>\r\n </div>\r\n <div\r\n ngClass=\"kwikid-forms-container\"\r\n *ngIf=\"this.showForm && this.showFormFields\"\r\n [class.active]=\"showFormFields\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n [@panelInOut]\r\n >\r\n <kwikid-form-view\r\n [formConfig]=\"this.rendererService.activeFormConfig\"\r\n [formData]=\"this.rendererService.activeFormData\"\r\n [apiCallResponse]=\"this.apiCallResponse\"\r\n [formsList]=\"this.rendererService.formsList\"\r\n [allFormsData]=\"this.rendererService.allFormsData\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickApiCall)=\"this.handleOnClickApiCall($event)\"\r\n (onClickViewForms)=\"this.handleOnClickViewForms($event)\"\r\n (onClickSaveForm)=\"this.handleOnClickSaveForm($event)\"\r\n (getActiveFormData)=\"this.handleGetActiveFormData($event)\"\r\n ></kwikid-form-view>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".kwikid-root{width:100%;height:100%}.kwikid-renderer{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;width:100%;height:100%}.kwikid-form-header{height:70px;box-shadow:0 0 12px -8px var(--tui-primary);z-index:6}#uf-header{display:flex;flex-direction:row;align-content:center;align-items:center;justify-content:flex-start;grid-column-gap:10px;column-gap:10px;padding:10px 20px;width:100%;max-width:calc(400px + 50vw + 2rem);margin:0 auto;height:70px;z-index:1}#uf-header #uf-header-goback-container{display:none}#uf-header #uf-header-goback-container:hover{border-radius:50%;background-color:#d3d3d3}#uf-header #uf-header-goback-container #uf-header-goback{width:100%;height:auto}#uf-header #uf-header-logo-container{display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center}#uf-header #uf-header-logo-container #uf-header-logo.small-icon{width:50px;height:50px}#uf-header #uf-header-logo-container #uf-header-logo.large-icon{width:50px;height:50px}#uf-header #uf-header-title-container{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;grid-row-gap:4px;row-gap:4px}#uf-header #uf-header-title-container #uf-header-title{font-size:1.4em;color:#121212}#uf-header #uf-header-title-container #uf-header-subtitle{font-size:1.2em;color:#121212}.kwikid-layout-container{display:flex;flex-direction:row;padding:0 1rem;height:calc(100% - 70px);justify-content:center;align-items:stretch;background:var(--tui-secondary);position:relative}.kwikid-sections-container{display:block;width:100%;max-width:400px;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);margin:auto 1rem auto 0;box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-sections-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s}.kwikid-forms-container{display:block;width:100%;max-width:50vw;margin:auto 0;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-forms-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s}@media screen and (max-width: 600px){.kwikid-layout-container{padding:0;background:transparent}.kwikid-sections-container{position:absolute;max-width:100%;bottom:-10000px;left:-10000px;opacity:0;padding:0;visibility:hidden}.kwikid-sections-container.active{visibility:visible}.kwikid-sections-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container{display:none;max-width:100%;height:100%;padding:0;border-radius:0;box-shadow:none}.kwikid-forms-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container.active{display:block}}\n"], components: [{ type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: ["formsList", "formsListCompleted", "isMobileView"], outputs: ["onClickSetActiveForm", "onClickHideFormsList", "onClickSubmitForms"] }, { type: KwikIDFormViewComponent, selector: "kwikid-form-view", inputs: ["formConfig", "formData", "apiCallResponse", "isMobileView", "allFormsData", "formsList"], outputs: ["onClickViewForms", "onClickSaveForm", "onClickApiCall", "getActiveFormData"] }], directives: [{ type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
3839
+ animations.trigger("panelInOut", [
3840
+ animations.transition(":enter", [
3841
+ animations.style({ transform: "translateY(100%)" }),
3842
+ animations.animate(150)
3843
+ ]),
3844
+ animations.transition(":leave", [
3845
+ animations.animate(100, animations.style({ transform: "translateY(100%)" }))
3846
+ ])
3847
+ ])
3848
+ ] });
3849
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsRendererComponent, decorators: [{
3850
+ type: i0.Component,
3851
+ args: [{
3852
+ selector: "kwikid-forms-renderer",
3853
+ templateUrl: "./renderer.component.html",
3854
+ styleUrls: ["./renderer.component.scss"],
3855
+ animations: [
3856
+ animations.trigger("panelInOut", [
3857
+ animations.transition(":enter", [
3858
+ animations.style({ transform: "translateY(100%)" }),
3859
+ animations.animate(150)
3860
+ ]),
3861
+ animations.transition(":leave", [
3862
+ animations.animate(100, animations.style({ transform: "translateY(100%)" }))
3863
+ ])
3864
+ ])
3865
+ ],
3866
+ providers: [KwikIDRendererService]
3867
+ }]
3868
+ }], ctorParameters: function () { return [{ type: KwikIDRendererService }, { type: i0__namespace.ElementRef }]; }, propDecorators: { windowResizeWatcher: [{
3869
+ type: i0.HostListener,
3870
+ args: ["window:resize", ["$event"]]
3871
+ }], userConfig: [{
3872
+ type: i0.Input
3873
+ }], formsData: [{
3874
+ type: i0.Input
3875
+ }], apiCallResponse: [{
3876
+ type: i0.Input
3877
+ }], getFormData: [{
3878
+ type: i0.Output
3879
+ }], onClickApiCall: [{
3880
+ type: i0.Output
3881
+ }] } });
3882
+
3883
+ var KwikIDFormBuilderModule = /** @class */ (function () {
3884
+ function KwikIDFormBuilderModule() {
3885
+ }
3886
+ return KwikIDFormBuilderModule;
3887
+ }());
3888
+ /** @nocollapse */ KwikIDFormBuilderModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormBuilderModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3889
+ /** @nocollapse */ KwikIDFormBuilderModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormBuilderModule, declarations: [KwikIDFormsBuilderComponent], imports: [i4.CommonModule, i5.FormsModule, i5.ReactiveFormsModule, dragDrop.DragDropModule], exports: [KwikIDFormsBuilderComponent] });
3890
+ /** @nocollapse */ KwikIDFormBuilderModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormBuilderModule, providers: [], imports: [[i4.CommonModule, i5.FormsModule, i5.ReactiveFormsModule, dragDrop.DragDropModule]] });
3891
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormBuilderModule, decorators: [{
3892
+ type: i0.NgModule,
3893
+ args: [{
3894
+ declarations: [KwikIDFormsBuilderComponent],
3895
+ imports: [i4.CommonModule, i5.FormsModule, i5.ReactiveFormsModule, dragDrop.DragDropModule],
3896
+ providers: [],
3897
+ exports: [KwikIDFormsBuilderComponent]
3898
+ }]
3899
+ }] });
3900
+
3901
+ var KwikIDFormViewModule = /** @class */ (function () {
3902
+ function KwikIDFormViewModule() {
3903
+ }
3904
+ return KwikIDFormViewModule;
3905
+ }());
3906
+ /** @nocollapse */ KwikIDFormViewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3907
+ /** @nocollapse */ KwikIDFormViewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewModule, declarations: [KwikIDFormViewComponent], imports: [i4.CommonModule,
3908
+ i5.FormsModule,
3909
+ i5.ReactiveFormsModule,
3910
+ i3.TuiLabelModule,
3911
+ i2.KwikUIModule], exports: [KwikIDFormViewComponent] });
3912
+ /** @nocollapse */ KwikIDFormViewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewModule, imports: [[
3913
+ i4.CommonModule,
3914
+ i5.FormsModule,
3915
+ i5.ReactiveFormsModule,
3916
+ i3.TuiLabelModule,
3917
+ i2.KwikUIModule
3918
+ ]] });
3919
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormViewModule, decorators: [{
3920
+ type: i0.NgModule,
3921
+ args: [{
3922
+ declarations: [KwikIDFormViewComponent],
3923
+ imports: [
3924
+ i4.CommonModule,
3925
+ i5.FormsModule,
3926
+ i5.ReactiveFormsModule,
3927
+ i3.TuiLabelModule,
3928
+ i2.KwikUIModule
3929
+ ],
3930
+ exports: [KwikIDFormViewComponent]
3931
+ }]
3932
+ }] });
3933
+
3934
+ var KwikIDFormsListModule = /** @class */ (function () {
3935
+ function KwikIDFormsListModule() {
3936
+ }
3937
+ return KwikIDFormsListModule;
3938
+ }());
3939
+ /** @nocollapse */ KwikIDFormsListModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3940
+ /** @nocollapse */ KwikIDFormsListModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListModule, declarations: [KwikIDFormsListComponent], imports: [i4.CommonModule,
3941
+ i5.FormsModule,
3942
+ i5.ReactiveFormsModule,
3943
+ i2.KwikUIModule,
3944
+ i3.TuiSvgModule], exports: [KwikIDFormsListComponent] });
3945
+ /** @nocollapse */ KwikIDFormsListModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListModule, imports: [[
3946
+ i4.CommonModule,
3947
+ i5.FormsModule,
3948
+ i5.ReactiveFormsModule,
3949
+ i2.KwikUIModule,
3950
+ i3.TuiSvgModule
3951
+ ]] });
3952
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsListModule, decorators: [{
3953
+ type: i0.NgModule,
3954
+ args: [{
3955
+ declarations: [KwikIDFormsListComponent],
3956
+ imports: [
3957
+ i4.CommonModule,
3958
+ i5.FormsModule,
3959
+ i5.ReactiveFormsModule,
3960
+ i2.KwikUIModule,
3961
+ i3.TuiSvgModule
3962
+ ],
3963
+ exports: [KwikIDFormsListComponent]
3964
+ }]
3965
+ }] });
3966
+
3967
+ var KwikIDFormRendererModule = /** @class */ (function () {
3968
+ function KwikIDFormRendererModule() {
3969
+ }
3970
+ return KwikIDFormRendererModule;
3971
+ }());
3972
+ /** @nocollapse */ KwikIDFormRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3973
+ /** @nocollapse */ KwikIDFormRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormRendererModule, declarations: [KwikIDFormsRendererComponent], imports: [i4.CommonModule,
3974
+ http.HttpClientModule,
3975
+ KwikIDFormViewModule,
3976
+ KwikIDFormsListModule,
3977
+ i2.KwikUIModule], exports: [KwikIDFormsRendererComponent] });
3978
+ /** @nocollapse */ KwikIDFormRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormRendererModule, providers: [], imports: [[
3979
+ i4.CommonModule,
3980
+ http.HttpClientModule,
3981
+ KwikIDFormViewModule,
3982
+ KwikIDFormsListModule,
3983
+ i2.KwikUIModule
3984
+ ]] });
3985
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormRendererModule, decorators: [{
3986
+ type: i0.NgModule,
3987
+ args: [{
3988
+ declarations: [KwikIDFormsRendererComponent],
3989
+ imports: [
3990
+ i4.CommonModule,
3991
+ http.HttpClientModule,
3992
+ KwikIDFormViewModule,
3993
+ KwikIDFormsListModule,
3994
+ i2.KwikUIModule
3995
+ ],
3996
+ providers: [],
3997
+ exports: [KwikIDFormsRendererComponent]
3998
+ }]
3999
+ }] });
4000
+
4001
+ var KwikIDFormsModule = /** @class */ (function () {
4002
+ function KwikIDFormsModule() {
4003
+ }
4004
+ return KwikIDFormsModule;
4005
+ }());
4006
+ /** @nocollapse */ KwikIDFormsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
4007
+ /** @nocollapse */ KwikIDFormsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsModule, imports: [i4.CommonModule,
4008
+ i5.FormsModule,
4009
+ i5.ReactiveFormsModule,
4010
+ KwikIDFormBuilderModule,
4011
+ KwikIDFormRendererModule], exports: [KwikIDFormBuilderModule, KwikIDFormRendererModule] });
4012
+ /** @nocollapse */ KwikIDFormsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsModule, providers: [KwikIDRendererService], imports: [[
4013
+ i4.CommonModule,
4014
+ i5.FormsModule,
4015
+ i5.ReactiveFormsModule,
4016
+ KwikIDFormBuilderModule,
4017
+ KwikIDFormRendererModule
4018
+ ], KwikIDFormBuilderModule, KwikIDFormRendererModule] });
4019
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: KwikIDFormsModule, decorators: [{
4020
+ type: i0.NgModule,
4021
+ args: [{
4022
+ declarations: [],
4023
+ imports: [
4024
+ i4.CommonModule,
4025
+ i5.FormsModule,
4026
+ i5.ReactiveFormsModule,
4027
+ KwikIDFormBuilderModule,
4028
+ KwikIDFormRendererModule
4029
+ ],
4030
+ exports: [KwikIDFormBuilderModule, KwikIDFormRendererModule],
4031
+ providers: [KwikIDRendererService]
4032
+ }]
4033
+ }] });
4034
+
4035
+ /*
4036
+ * Public API Surface of kwikid-forms
4037
+ */
4038
+
4039
+ /**
4040
+ * Generated bundle index. Do not edit.
4041
+ */
4042
+
4043
+ exports.KwikIDFormBuilderModule = KwikIDFormBuilderModule;
4044
+ exports.KwikIDFormRendererModule = KwikIDFormRendererModule;
4045
+ exports.KwikIDFormViewComponent = KwikIDFormViewComponent;
4046
+ exports.KwikIDFormViewModule = KwikIDFormViewModule;
4047
+ exports.KwikIDFormsBuilderComponent = KwikIDFormsBuilderComponent;
4048
+ exports.KwikIDFormsListComponent = KwikIDFormsListComponent;
4049
+ exports.KwikIDFormsListModule = KwikIDFormsListModule;
4050
+ exports.KwikIDFormsModule = KwikIDFormsModule;
4051
+ exports.KwikIDFormsRendererComponent = KwikIDFormsRendererComponent;
4052
+
4053
+ Object.defineProperty(exports, '__esModule', { value: true });
4054
+
4055
+ }));
4056
+ //# sourceMappingURL=kwikid-forms.umd.js.map