kwikid-forms 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kwikid-forms.umd.js +411 -1039
- package/bundles/kwikid-forms.umd.js.map +1 -1
- package/esm2015/lib/renderer/form-view/definitions/apis/form-view.apis.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/definitions/fields/form-view.fields.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/definitions/sources/form-view.sources.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/definitions/validations/form-view.validations.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/form-view.component.js +121 -95
- package/esm2015/lib/renderer/form-view/form-view.service.js +3 -3
- package/esm2015/lib/renderer/form-view/helpers/form-view.apis.helper.js +51 -19
- package/esm2015/lib/renderer/form-view/helpers/form-view.defaults.helper.js +21 -10
- package/esm2015/lib/renderer/form-view/helpers/form-view.fields.helper.js +7 -7
- package/esm2015/lib/renderer/form-view/helpers/form-view.validations.helper.js +37 -31
- package/esm2015/lib/renderer/forms-list/forms-list.component.js +9 -5
- package/esm2015/lib/renderer/renderer.component.js +20 -10
- package/esm2015/lib/renderer/renderer.config-converter.helper.js +62 -59
- package/esm2015/lib/renderer/renderer.service.js +47 -6
- package/fesm2015/kwikid-forms.js +374 -877
- package/fesm2015/kwikid-forms.js.map +1 -1
- package/lib/renderer/form-view/definitions/apis/form-view.apis.type.definitions.d.ts +1 -1
- package/lib/renderer/form-view/definitions/fields/form-view.fields.type.definitions.d.ts +1 -2
- package/lib/renderer/form-view/definitions/sources/form-view.sources.type.definitions.d.ts +2 -2
- package/lib/renderer/form-view/definitions/validations/form-view.validations.type.definitions.d.ts +1 -2
- package/lib/renderer/form-view/form-view.component.d.ts +2 -2
- package/lib/renderer/renderer.component.d.ts +1 -1
- package/package.json +3 -2
- package/esm2015/lib/renderer/form-view/definitions/rules/form-view.rules.enum.definitions.js +0 -7
- package/esm2015/lib/renderer/form-view/definitions/rules/form-view.rules.type.definitions.js +0 -2
- package/esm2015/lib/renderer/form-view/definitions/sources/form-view.sources.enum.definitions.js +0 -17
- package/esm2015/lib/renderer/form-view/form-view.decorators.js +0 -93
- package/esm2015/lib/renderer/form-view/helpers/form-view.actions.helper.js +0 -27
- package/esm2015/lib/renderer/form-view/helpers/form-view.condition.helper.js +0 -46
- package/esm2015/lib/renderer/form-view/helpers/form-view.rules.helper.js +0 -83
- package/esm2015/lib/renderer/form-view/helpers/form-view.sources.helper.js +0 -161
- package/esm2015/lib/renderer/forms-list/forms-list.helper.js +0 -4
- package/esm2015/lib/renderer/helpers/renderer.actions.helper.js +0 -20
- package/esm2015/lib/renderer/helpers/renderer.condition.helper.js +0 -41
- package/esm2015/lib/renderer/helpers/renderer.rules.helper.js +0 -63
- package/esm2015/lib/renderer/helpers/renderer.sources.helper.js +0 -91
- package/esm2015/lib/renderer/helpers/renderer.validations.helper.js +0 -33
- package/lib/renderer/form-view/definitions/rules/form-view.rules.enum.definitions.d.ts +0 -5
- package/lib/renderer/form-view/definitions/rules/form-view.rules.type.definitions.d.ts +0 -41
- package/lib/renderer/form-view/definitions/sources/form-view.sources.enum.definitions.d.ts +0 -14
- package/lib/renderer/form-view/form-view.decorators.d.ts +0 -7
- package/lib/renderer/form-view/helpers/form-view.actions.helper.d.ts +0 -13
- package/lib/renderer/form-view/helpers/form-view.condition.helper.d.ts +0 -8
- package/lib/renderer/form-view/helpers/form-view.rules.helper.d.ts +0 -12
- package/lib/renderer/form-view/helpers/form-view.sources.helper.d.ts +0 -29
- package/lib/renderer/forms-list/forms-list.helper.d.ts +0 -1
- package/lib/renderer/helpers/renderer.actions.helper.d.ts +0 -8
- package/lib/renderer/helpers/renderer.condition.helper.d.ts +0 -8
- package/lib/renderer/helpers/renderer.rules.helper.d.ts +0 -8
- package/lib/renderer/helpers/renderer.sources.helper.d.ts +0 -13
- package/lib/renderer/helpers/renderer.validations.helper.d.ts +0 -8
package/fesm2015/kwikid-forms.js
CHANGED
|
@@ -6,11 +6,12 @@ import { FormGroup, FormControl, Validators, FormArray, FormsModule, ReactiveFor
|
|
|
6
6
|
import * as i2 from 'kwikui';
|
|
7
7
|
import { KwikUIButtonComponent, KwikUIProgressSegmentedComponent, KwikUIInputComponent, KwikUIModule } from 'kwikui';
|
|
8
8
|
import _, { cloneDeep } from 'lodash';
|
|
9
|
-
import {
|
|
9
|
+
import { __awaiter, __decorate } from 'tslib';
|
|
10
10
|
import * as i3 from '@taiga-ui/core';
|
|
11
11
|
import { TuiAlertService, TuiLabelModule, TuiSvgModule, TuiLoaderModule } from '@taiga-ui/core';
|
|
12
12
|
import * as i4 from '@taiga-ui/kit';
|
|
13
13
|
import { TuiPushService, TuiPushModule } from '@taiga-ui/kit';
|
|
14
|
+
import { Sources, Rules, Condition, Actions, logMethod, isNotEmptyValue, checkObjectKeyExists, isEmptyValue, Validations as Validations$1 } from 'kwikid-toolkit';
|
|
14
15
|
import { pairwise } from 'rxjs/operators';
|
|
15
16
|
import jp from 'jsonpath';
|
|
16
17
|
import { TuiDay } from '@taiga-ui/cdk';
|
|
@@ -295,100 +296,7 @@ var EFieldType;
|
|
|
295
296
|
EFieldType["AADHAAR_NUMBER"] = "aadhaar-number";
|
|
296
297
|
})(EFieldType || (EFieldType = {}));
|
|
297
298
|
|
|
298
|
-
|
|
299
|
-
* A function that logs the execution of a method.
|
|
300
|
-
* @param {any} target - The object the method belongs to.
|
|
301
|
-
* @param {string} propertyKey - The name of the method.
|
|
302
|
-
* @param {PropertyDescriptor} descriptor - The property descriptor for the method.
|
|
303
|
-
*/
|
|
304
|
-
function log(target, propertyKey, descriptor) {
|
|
305
|
-
// save a reference to the original method
|
|
306
|
-
const originalMethod = descriptor.value;
|
|
307
|
-
// update the descriptor value with a new function that will log and execute the original method
|
|
308
|
-
descriptor.value = function (...args) {
|
|
309
|
-
console.group("Logging Method"); // start a new logging group
|
|
310
|
-
console.time("Execution Time:"); // start a timer
|
|
311
|
-
let result; // declare result variable
|
|
312
|
-
try {
|
|
313
|
-
// execute the original method and save the result
|
|
314
|
-
result = originalMethod.apply(this, args);
|
|
315
|
-
}
|
|
316
|
-
catch (error) {
|
|
317
|
-
// if an error is thrown, log the error and throw it again
|
|
318
|
-
logSyncMethodError(target.constructor.name, propertyKey, args, error);
|
|
319
|
-
console.timeEnd(`Execution Time:`); // stop the timer
|
|
320
|
-
console.groupEnd(); // end the logging group
|
|
321
|
-
throw error;
|
|
322
|
-
}
|
|
323
|
-
// if the result is a Promise, handle it as an async method
|
|
324
|
-
if (result instanceof Promise) {
|
|
325
|
-
result = result
|
|
326
|
-
.then((resolvedValue) => {
|
|
327
|
-
// on success, log the resolved value and return it
|
|
328
|
-
logAsyncMethod(target.constructor.name, propertyKey, args, resolvedValue);
|
|
329
|
-
console.timeEnd(`Execution Time:`); // stop the timer
|
|
330
|
-
console.groupEnd(); // end the logging group
|
|
331
|
-
return resolvedValue;
|
|
332
|
-
})
|
|
333
|
-
.catch((error) => {
|
|
334
|
-
// on error, log the error and throw it again
|
|
335
|
-
logAsyncMethodError(target.constructor.name, propertyKey, args, error);
|
|
336
|
-
console.timeEnd(`Execution Time:`); // stop the timer
|
|
337
|
-
console.groupEnd(); // end the logging group
|
|
338
|
-
throw error;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
// if the result is not a Promise, handle it as a sync method
|
|
343
|
-
logSyncMethod(target.constructor.name, propertyKey, args, result);
|
|
344
|
-
console.timeEnd("Execution Time:");
|
|
345
|
-
console.groupEnd();
|
|
346
|
-
}
|
|
347
|
-
return result;
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* This function logs a sync method's information to the console.
|
|
352
|
-
* @param {string} className - The name of the class where the method belongs.
|
|
353
|
-
* @param {string} methodName - The name of the method being called.
|
|
354
|
-
* @param {any[]} args - An array of arguments passed to the method.
|
|
355
|
-
* @param {any} result - The result of the method.
|
|
356
|
-
*/
|
|
357
|
-
function logSyncMethod(className, methodName, args, result) {
|
|
358
|
-
console.log("%cType: Sync Method -", "color: #0d47a1; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nReturn:", result);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Logs an error that occurred during the execution of a synchronous method.
|
|
362
|
-
* @param {string} className - The name of the class the method belongs to.
|
|
363
|
-
* @param {string} methodName - The name of the method.
|
|
364
|
-
* @param {any[]} args - The arguments passed to the method.
|
|
365
|
-
* @param {Error} error - The error that occurred.
|
|
366
|
-
*/
|
|
367
|
-
function logSyncMethodError(className, methodName, args, error) {
|
|
368
|
-
console.log("%cType: Sync Method -", "color: #0d47a1; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nError:", error);
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Logs the result of the execution of an asynchronous method.
|
|
372
|
-
* @param {string} className - The name of the class the method belongs to.
|
|
373
|
-
* @param {string} methodName - The name of the method.
|
|
374
|
-
* @param {any[]} args - The arguments passed to the method.
|
|
375
|
-
* @param {any} result - The result of the method execution.
|
|
376
|
-
*/
|
|
377
|
-
function logAsyncMethod(className, methodName, args, result) {
|
|
378
|
-
console.log("%cType: Async Method -", "color: #1565c0; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nReturn:", result);
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Logs an error that occurred during the execution of an asynchronous method.
|
|
382
|
-
* @param {string} className - The name of the class the method belongs to.
|
|
383
|
-
* @param {string} methodName - The name of the method.
|
|
384
|
-
* @param {any[]} args - The arguments passed to the method.
|
|
385
|
-
* @param {Error} error - The error that occurred.
|
|
386
|
-
*/
|
|
387
|
-
function logAsyncMethodError(className, methodName, args, error) {
|
|
388
|
-
console.log("%cType: Async Method -", "color: #1565c0; font-weight: bold;", "\nClass:", className, "\nMethod:", methodName, "\nArgs:", args, "\nError:", error);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const hasKey$2 = (object, key) => {
|
|
299
|
+
const hasKey$1 = (object, key) => {
|
|
392
300
|
return object.hasOwnProperty(key);
|
|
393
301
|
};
|
|
394
302
|
const isEmpty$1 = (value) => {
|
|
@@ -437,7 +345,7 @@ const isSingleForm = (formsList) => {
|
|
|
437
345
|
return formsList.length === 1;
|
|
438
346
|
};
|
|
439
347
|
|
|
440
|
-
const hasKey
|
|
348
|
+
const hasKey = (object, key) => {
|
|
441
349
|
return object.hasOwnProperty(key);
|
|
442
350
|
};
|
|
443
351
|
const hasPath = (object, path) => {
|
|
@@ -569,330 +477,6 @@ const setEmptyValue = (field) => {
|
|
|
569
477
|
return value;
|
|
570
478
|
};
|
|
571
479
|
|
|
572
|
-
class Condition$1 {
|
|
573
|
-
constructor(condition, rulesMapping) {
|
|
574
|
-
this._condition = condition;
|
|
575
|
-
this._rulesMapping = rulesMapping;
|
|
576
|
-
}
|
|
577
|
-
parseKeys(condition, rulesEvaluationMapping) {
|
|
578
|
-
Object.keys(rulesEvaluationMapping).forEach((key) => {
|
|
579
|
-
condition = replaceString(condition, key, rulesEvaluationMapping[key]);
|
|
580
|
-
});
|
|
581
|
-
return condition;
|
|
582
|
-
}
|
|
583
|
-
parseOperators(condition) {
|
|
584
|
-
return condition.replace(/AND|OR|NOT|XOR|NAND|NOR|XNOR/g, (match) => {
|
|
585
|
-
switch (match) {
|
|
586
|
-
case "AND":
|
|
587
|
-
return "&&";
|
|
588
|
-
case "OR":
|
|
589
|
-
return "||";
|
|
590
|
-
case "NOT":
|
|
591
|
-
return "!";
|
|
592
|
-
case "XOR":
|
|
593
|
-
return "^";
|
|
594
|
-
case "NAND":
|
|
595
|
-
return "!&";
|
|
596
|
-
case "NOR":
|
|
597
|
-
return "!|";
|
|
598
|
-
case "XNOR":
|
|
599
|
-
return "!^";
|
|
600
|
-
default:
|
|
601
|
-
return match;
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
evaluate() {
|
|
606
|
-
this._condition = this.parseKeys(this._condition, this._rulesMapping);
|
|
607
|
-
this._condition = this.parseOperators(this._condition);
|
|
608
|
-
return eval(this._condition);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
__decorate([
|
|
612
|
-
log
|
|
613
|
-
], Condition$1.prototype, "evaluate", null);
|
|
614
|
-
|
|
615
|
-
class Actions$1 {
|
|
616
|
-
constructor(action, field, ruleMapping, allFormsData, formData, previousFormData, takeAction) {
|
|
617
|
-
this._action = action;
|
|
618
|
-
this._field = field;
|
|
619
|
-
this._ruleMapping = ruleMapping;
|
|
620
|
-
this._allFormsData = allFormsData;
|
|
621
|
-
this._formData = formData;
|
|
622
|
-
this._previousFormData = previousFormData;
|
|
623
|
-
this._takeAction = takeAction;
|
|
624
|
-
}
|
|
625
|
-
execute() {
|
|
626
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
627
|
-
const condition = new Condition$1(this._action.condition, this._ruleMapping);
|
|
628
|
-
const actionSuccess = condition.evaluate();
|
|
629
|
-
if (actionSuccess) {
|
|
630
|
-
return this._takeAction(this._action, this._field, this._allFormsData, this._formData, this._previousFormData);
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
__decorate([
|
|
636
|
-
log
|
|
637
|
-
], Actions$1.prototype, "execute", null);
|
|
638
|
-
|
|
639
|
-
var ERuleKey;
|
|
640
|
-
(function (ERuleKey) {
|
|
641
|
-
ERuleKey["OBJECT_PATH_EXISTS"] = "OBJECT_PATH_EXISTS";
|
|
642
|
-
ERuleKey["VALUE_CHECK"] = "VALUE_CHECK";
|
|
643
|
-
ERuleKey["VALUE_CHANGE"] = "VALUE_CHANGE";
|
|
644
|
-
})(ERuleKey || (ERuleKey = {}));
|
|
645
|
-
|
|
646
|
-
var ESourceKey;
|
|
647
|
-
(function (ESourceKey) {
|
|
648
|
-
ESourceKey["FIELD_CONFIG"] = "FIELD_CONFIG";
|
|
649
|
-
ESourceKey["FORM_DATA"] = "FORM_DATA";
|
|
650
|
-
ESourceKey["PREVIOUS_FORM_DATA"] = "PREVIOUS_FORM_DATA";
|
|
651
|
-
ESourceKey["ALL_FORMS_DATA"] = "ALL_FORMS_DATA";
|
|
652
|
-
ESourceKey["BROWSER_STORAGE"] = "BROWSER_STORAGE";
|
|
653
|
-
ESourceKey["PREDEFINED"] = "PREDEFINED";
|
|
654
|
-
ESourceKey["USER_CONFIG"] = "USER_CONFIG";
|
|
655
|
-
ESourceKey["CUSTOM"] = "CUSTOM";
|
|
656
|
-
})(ESourceKey || (ESourceKey = {}));
|
|
657
|
-
var EBrowserStorageType;
|
|
658
|
-
(function (EBrowserStorageType) {
|
|
659
|
-
EBrowserStorageType["LOCAL_STORAGE"] = "LOCAL_STORAGE";
|
|
660
|
-
EBrowserStorageType["SESSION_STORAGE"] = "SESSION_STORAGE";
|
|
661
|
-
})(EBrowserStorageType || (EBrowserStorageType = {}));
|
|
662
|
-
|
|
663
|
-
class Sources$1 {
|
|
664
|
-
constructor(field, formData, previousFormData, allFormsData) {
|
|
665
|
-
this._field = field;
|
|
666
|
-
this._formData = formData;
|
|
667
|
-
this._previousFormData = previousFormData;
|
|
668
|
-
this._allFormsData = allFormsData;
|
|
669
|
-
}
|
|
670
|
-
get formData() {
|
|
671
|
-
return this._formData;
|
|
672
|
-
}
|
|
673
|
-
set formData(value) {
|
|
674
|
-
this._formData = value;
|
|
675
|
-
}
|
|
676
|
-
get previousFormData() {
|
|
677
|
-
return this._previousFormData;
|
|
678
|
-
}
|
|
679
|
-
set previousFormData(value) {
|
|
680
|
-
this._previousFormData = value;
|
|
681
|
-
}
|
|
682
|
-
get allFormsData() {
|
|
683
|
-
return this._allFormsData;
|
|
684
|
-
}
|
|
685
|
-
set allFormsData(value) {
|
|
686
|
-
this._allFormsData = value;
|
|
687
|
-
}
|
|
688
|
-
get field() {
|
|
689
|
-
return this._field;
|
|
690
|
-
}
|
|
691
|
-
set field(value) {
|
|
692
|
-
this._field = value;
|
|
693
|
-
}
|
|
694
|
-
getValueFromFieldConfig(path) {
|
|
695
|
-
let value = "";
|
|
696
|
-
if (isNotEmpty(path)) {
|
|
697
|
-
value = jpQueryWrapper(this._field, path);
|
|
698
|
-
}
|
|
699
|
-
else {
|
|
700
|
-
value = setEmptyValue(this._field);
|
|
701
|
-
}
|
|
702
|
-
return value;
|
|
703
|
-
}
|
|
704
|
-
getValueFromFormData(path) {
|
|
705
|
-
let value;
|
|
706
|
-
value = jpQueryWrapper(this._formData, path);
|
|
707
|
-
return value;
|
|
708
|
-
}
|
|
709
|
-
getValueFromPreviousFormData(path) {
|
|
710
|
-
let value;
|
|
711
|
-
value = jpQueryWrapper(this._previousFormData, path);
|
|
712
|
-
return value;
|
|
713
|
-
}
|
|
714
|
-
getValueFromAllFormsData(path) {
|
|
715
|
-
let value;
|
|
716
|
-
value = jpQueryWrapper(this._allFormsData, path);
|
|
717
|
-
return value;
|
|
718
|
-
}
|
|
719
|
-
getValueFromBrowserStorage(type, key) {
|
|
720
|
-
let value = "";
|
|
721
|
-
switch (type) {
|
|
722
|
-
case EBrowserStorageType.LOCAL_STORAGE:
|
|
723
|
-
value = isNotEmptyBrowserStorageValue(localStorage.getItem(key))
|
|
724
|
-
? localStorage.getItem(key)
|
|
725
|
-
: "";
|
|
726
|
-
break;
|
|
727
|
-
case EBrowserStorageType.SESSION_STORAGE:
|
|
728
|
-
value = isNotEmptyBrowserStorageValue(sessionStorage.getItem(key))
|
|
729
|
-
? sessionStorage.getItem(key)
|
|
730
|
-
: "";
|
|
731
|
-
break;
|
|
732
|
-
default:
|
|
733
|
-
value = "";
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
return value;
|
|
737
|
-
}
|
|
738
|
-
getValueFromSource(source) {
|
|
739
|
-
let value = "";
|
|
740
|
-
switch (source.key) {
|
|
741
|
-
case ESourceKey.FIELD_CONFIG:
|
|
742
|
-
value = this.getValueFromFieldConfig(source.props.path);
|
|
743
|
-
break;
|
|
744
|
-
case ESourceKey.FORM_DATA:
|
|
745
|
-
value = this.getValueFromFormData(source.props.path);
|
|
746
|
-
break;
|
|
747
|
-
case ESourceKey.ALL_FORMS_DATA:
|
|
748
|
-
value = this.getValueFromAllFormsData(source.props.path);
|
|
749
|
-
break;
|
|
750
|
-
case ESourceKey.PREVIOUS_FORM_DATA:
|
|
751
|
-
value = this.getValueFromPreviousFormData(source.props.path);
|
|
752
|
-
break;
|
|
753
|
-
case ESourceKey.BROWSER_STORAGE:
|
|
754
|
-
value = this.getValueFromBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key);
|
|
755
|
-
break;
|
|
756
|
-
case ESourceKey.PREDEFINED:
|
|
757
|
-
value = source.value;
|
|
758
|
-
break;
|
|
759
|
-
default:
|
|
760
|
-
value = "";
|
|
761
|
-
break;
|
|
762
|
-
}
|
|
763
|
-
return value;
|
|
764
|
-
}
|
|
765
|
-
setValueToFieldConfig(path, value) {
|
|
766
|
-
this._field = setValueToObject(this._field, path, value);
|
|
767
|
-
}
|
|
768
|
-
setValueToFormData(path, value) {
|
|
769
|
-
this._formData = setValueToObject(this._formData, path, value);
|
|
770
|
-
}
|
|
771
|
-
setValueToAllFormsData(path, value) {
|
|
772
|
-
this._allFormsData = setValueToObject(this._allFormsData, path, value);
|
|
773
|
-
}
|
|
774
|
-
setValueToPreviousFromData(path, value) {
|
|
775
|
-
this._previousFormData = setValueToObject(this._previousFormData, path, value);
|
|
776
|
-
}
|
|
777
|
-
setValueToBrowserStorage(type, key, value) {
|
|
778
|
-
switch (type) {
|
|
779
|
-
case EBrowserStorageType.LOCAL_STORAGE:
|
|
780
|
-
localStorage.setItem(key, value);
|
|
781
|
-
break;
|
|
782
|
-
case EBrowserStorageType.SESSION_STORAGE:
|
|
783
|
-
sessionStorage.setItem(key, value);
|
|
784
|
-
break;
|
|
785
|
-
default:
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
setValueToSource(source, value) {
|
|
790
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
791
|
-
switch (source.key) {
|
|
792
|
-
case ESourceKey.FIELD_CONFIG:
|
|
793
|
-
this._field = this.setValueToFieldConfig(source.props.path, value);
|
|
794
|
-
break;
|
|
795
|
-
case ESourceKey.FORM_DATA:
|
|
796
|
-
this._formData = this.setValueToFormData(source.props.path, value);
|
|
797
|
-
break;
|
|
798
|
-
case ESourceKey.ALL_FORMS_DATA:
|
|
799
|
-
this._allFormsData = this.setValueToAllFormsData(source.props.path, value);
|
|
800
|
-
break;
|
|
801
|
-
case ESourceKey.PREVIOUS_FORM_DATA:
|
|
802
|
-
this._previousFormData = this.setValueToPreviousFromData(source.props.path, value);
|
|
803
|
-
break;
|
|
804
|
-
case ESourceKey.BROWSER_STORAGE:
|
|
805
|
-
yield this.setValueToBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key, value);
|
|
806
|
-
break;
|
|
807
|
-
default:
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
__decorate([
|
|
814
|
-
log
|
|
815
|
-
], Sources$1.prototype, "getValueFromSource", null);
|
|
816
|
-
__decorate([
|
|
817
|
-
log
|
|
818
|
-
], Sources$1.prototype, "setValueToSource", null);
|
|
819
|
-
|
|
820
|
-
class Rules$1 {
|
|
821
|
-
constructor(rules, field, formData, previousFormData, allFormsData) {
|
|
822
|
-
this._field = field;
|
|
823
|
-
this._formData = formData;
|
|
824
|
-
this._previousFormData = previousFormData;
|
|
825
|
-
this._allFormsData = allFormsData;
|
|
826
|
-
this._rules = rules;
|
|
827
|
-
}
|
|
828
|
-
evaluate(rule) {
|
|
829
|
-
let ruleType = rule.key;
|
|
830
|
-
let ruleEvaluationStatus = false;
|
|
831
|
-
const source = new Sources$1(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
832
|
-
switch (ruleType) {
|
|
833
|
-
case ERuleKey.OBJECT_PATH_EXISTS:
|
|
834
|
-
const ruleObjectPathExists = rule;
|
|
835
|
-
const ruleObjectPathExistsObject = ruleObjectPathExists.props.object;
|
|
836
|
-
const ruleObjectPathExistsPath = ruleObjectPathExists.props.path;
|
|
837
|
-
switch (ruleObjectPathExistsObject) {
|
|
838
|
-
case ESourceKey.ALL_FORMS_DATA:
|
|
839
|
-
ruleEvaluationStatus = hasPath(this._allFormsData, ruleObjectPathExistsPath);
|
|
840
|
-
break;
|
|
841
|
-
case ESourceKey.FORM_DATA:
|
|
842
|
-
ruleEvaluationStatus = hasPath(this._formData, ruleObjectPathExistsPath);
|
|
843
|
-
break;
|
|
844
|
-
case ESourceKey.PREVIOUS_FORM_DATA:
|
|
845
|
-
ruleEvaluationStatus = hasPath(this._previousFormData, ruleObjectPathExistsPath);
|
|
846
|
-
break;
|
|
847
|
-
case ESourceKey.FIELD_CONFIG:
|
|
848
|
-
ruleEvaluationStatus = hasPath(this._field, ruleObjectPathExistsPath);
|
|
849
|
-
break;
|
|
850
|
-
default:
|
|
851
|
-
ruleEvaluationStatus = false;
|
|
852
|
-
break;
|
|
853
|
-
}
|
|
854
|
-
break;
|
|
855
|
-
case ERuleKey.VALUE_CHECK:
|
|
856
|
-
const ruleValueCheck = rule;
|
|
857
|
-
const ruleValueCheckSource = ruleValueCheck.props.value.source;
|
|
858
|
-
const ruleValueCheckValue = source.getValueFromSource(ruleValueCheckSource);
|
|
859
|
-
if (ruleValueCheck.props.pattern.key === EPatternKey.CUSTOM) {
|
|
860
|
-
var re = new RegExp(ruleValueCheck.props.pattern.pattern);
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
var re = new RegExp(EPattern[ruleValueCheck.props.pattern.key]);
|
|
864
|
-
}
|
|
865
|
-
ruleEvaluationStatus = re.test(ruleValueCheckValue);
|
|
866
|
-
break;
|
|
867
|
-
case ERuleKey.VALUE_CHANGE:
|
|
868
|
-
const ruleValueChange = rule;
|
|
869
|
-
const ruleValueChangeCurrentSource = ruleValueChange.props.value.current.source;
|
|
870
|
-
const ruleValueChangePreviousSource = ruleValueChange.props.value.previous.source;
|
|
871
|
-
const previousValue = source.getValueFromSource(ruleValueChangePreviousSource);
|
|
872
|
-
const currentValue = source.getValueFromSource(ruleValueChangeCurrentSource);
|
|
873
|
-
ruleEvaluationStatus = previousValue === currentValue;
|
|
874
|
-
break;
|
|
875
|
-
default:
|
|
876
|
-
break;
|
|
877
|
-
}
|
|
878
|
-
return ruleEvaluationStatus;
|
|
879
|
-
}
|
|
880
|
-
mapping() {
|
|
881
|
-
let rulesEvaluationMapping = {};
|
|
882
|
-
for (const rule of this._rules) {
|
|
883
|
-
const ruleEvaluationStatus = this.evaluate(rule);
|
|
884
|
-
rulesEvaluationMapping = Object.assign(Object.assign({}, rulesEvaluationMapping), { [rule.id]: ruleEvaluationStatus });
|
|
885
|
-
}
|
|
886
|
-
return rulesEvaluationMapping;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
__decorate([
|
|
890
|
-
log
|
|
891
|
-
], Rules$1.prototype, "evaluate", null);
|
|
892
|
-
__decorate([
|
|
893
|
-
log
|
|
894
|
-
], Rules$1.prototype, "mapping", null);
|
|
895
|
-
|
|
896
480
|
class Defaults {
|
|
897
481
|
constructor(field, allFormsData, formData, previousFormData, takeAction) {
|
|
898
482
|
this._field = field;
|
|
@@ -907,7 +491,12 @@ class Defaults {
|
|
|
907
491
|
const sources = this._field.default.value.sources;
|
|
908
492
|
let sourceIndex = 0;
|
|
909
493
|
for (let source of sources) {
|
|
910
|
-
const sources = new Sources
|
|
494
|
+
const sources = new Sources({
|
|
495
|
+
FIELD_CONFIG: this._field,
|
|
496
|
+
FORM_DATA: this._formData,
|
|
497
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
498
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
499
|
+
});
|
|
911
500
|
const value = sources.getValueFromSource(source);
|
|
912
501
|
// Set the Value of current source.
|
|
913
502
|
this._field = setValueToObject(this._field, `default.value.sources.[${sourceIndex}].value`, value);
|
|
@@ -915,11 +504,21 @@ class Defaults {
|
|
|
915
504
|
const triggers = validation.triggers;
|
|
916
505
|
const rules = validation.rules;
|
|
917
506
|
const actions = validation.actions;
|
|
918
|
-
const rulesMapping = new Rules
|
|
507
|
+
const rulesMapping = new Rules(rules, {
|
|
508
|
+
FIELD_CONFIG: this._field,
|
|
509
|
+
FORM_DATA: this._formData,
|
|
510
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
511
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
512
|
+
}).mapping();
|
|
919
513
|
for (let action of actions) {
|
|
920
|
-
const conditionEvaluation = new Condition
|
|
514
|
+
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
921
515
|
if (conditionEvaluation) {
|
|
922
|
-
const actions = new Actions
|
|
516
|
+
const actions = new Actions(action, rulesMapping, {
|
|
517
|
+
FIELD_CONFIG: this._field,
|
|
518
|
+
FORM_DATA: this._formData,
|
|
519
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
520
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
521
|
+
}, this._takeAction);
|
|
923
522
|
yield actions.execute();
|
|
924
523
|
}
|
|
925
524
|
}
|
|
@@ -934,7 +533,7 @@ class Defaults {
|
|
|
934
533
|
}
|
|
935
534
|
}
|
|
936
535
|
__decorate([
|
|
937
|
-
|
|
536
|
+
logMethod
|
|
938
537
|
], Defaults.prototype, "getDefaultValue", null);
|
|
939
538
|
|
|
940
539
|
const findFieldFromKey = (fields, key) => {
|
|
@@ -975,7 +574,7 @@ const getSearchTextOptionsFromRemoteFile = (field, childField, formGroup) => __a
|
|
|
975
574
|
const getSearchTextOptionsFromFieldConfig = (field, childField, formGroup) => {
|
|
976
575
|
let options;
|
|
977
576
|
const fieldValue = formGroup.controls[field.key].value;
|
|
978
|
-
if (
|
|
577
|
+
if (isNotEmptyValue(childField["json"])) {
|
|
979
578
|
options = childField["json"][fieldValue];
|
|
980
579
|
}
|
|
981
580
|
return options;
|
|
@@ -1004,7 +603,7 @@ const addMessage = (field, message) => {
|
|
|
1004
603
|
});
|
|
1005
604
|
};
|
|
1006
605
|
field["messages"] = [];
|
|
1007
|
-
if (
|
|
606
|
+
if (checkObjectKeyExists(field, "messages")) {
|
|
1008
607
|
if (!isDuplicateMessage(field["messages"], message)) {
|
|
1009
608
|
field["messages"].push({
|
|
1010
609
|
type: message.type,
|
|
@@ -1098,7 +697,7 @@ const convertTuiDayFormatToDateString = (date) => {
|
|
|
1098
697
|
};
|
|
1099
698
|
const convertValueFromKwikUIFormatToBasicFormat = (field, value) => {
|
|
1100
699
|
let convertedValue = value;
|
|
1101
|
-
if (
|
|
700
|
+
if (isNotEmptyValue(value)) {
|
|
1102
701
|
switch (field.type) {
|
|
1103
702
|
case EFieldType.DATE:
|
|
1104
703
|
convertedValue = convertTuiDayFormatToDateString(value);
|
|
@@ -1113,10 +712,10 @@ const convertValueFromKwikUIFormatToBasicFormat = (field, value) => {
|
|
|
1113
712
|
};
|
|
1114
713
|
const convertValueFromBasicFormatToKwikUIFormat = (field, value) => {
|
|
1115
714
|
let convertedValue = value;
|
|
1116
|
-
if (
|
|
715
|
+
if (isNotEmptyValue(value)) {
|
|
1117
716
|
switch (field.type) {
|
|
1118
717
|
case EFieldType.RADIO:
|
|
1119
|
-
if (!
|
|
718
|
+
if (!checkObjectKeyExists(value, "label")) {
|
|
1120
719
|
const convertedLabelValue = {
|
|
1121
720
|
label: value,
|
|
1122
721
|
disabled: false
|
|
@@ -1136,7 +735,7 @@ const convertValueFromBasicFormatToKwikUIFormat = (field, value) => {
|
|
|
1136
735
|
return convertedValue;
|
|
1137
736
|
};
|
|
1138
737
|
|
|
1139
|
-
class Validations
|
|
738
|
+
class Validations {
|
|
1140
739
|
constructor(field, formData, previousFormData, allFormsData, takeAction) {
|
|
1141
740
|
this._field = field;
|
|
1142
741
|
this._formData = formData;
|
|
@@ -1170,36 +769,36 @@ class Validations$1 {
|
|
|
1170
769
|
}
|
|
1171
770
|
getFieldValidators(field) {
|
|
1172
771
|
let validators = [];
|
|
1173
|
-
if (
|
|
1174
|
-
|
|
1175
|
-
|
|
772
|
+
if (checkObjectKeyExists(field, "validators") &&
|
|
773
|
+
checkObjectKeyExists(field.validators, "min") &&
|
|
774
|
+
isNotEmptyValue(field.validators.min)) {
|
|
1176
775
|
validators.push(Validators.min(field.validators.min));
|
|
1177
776
|
}
|
|
1178
|
-
if (
|
|
1179
|
-
|
|
1180
|
-
|
|
777
|
+
if (checkObjectKeyExists(field, "validators") &&
|
|
778
|
+
checkObjectKeyExists(field.validators, "max") &&
|
|
779
|
+
isNotEmptyValue(field.validators.max)) {
|
|
1181
780
|
validators.push(Validators.max(field.validators.max));
|
|
1182
781
|
}
|
|
1183
|
-
if ((
|
|
1184
|
-
(
|
|
1185
|
-
|
|
782
|
+
if ((checkObjectKeyExists(field, "required") && field.required) ||
|
|
783
|
+
(checkObjectKeyExists(field, "validators") &&
|
|
784
|
+
checkObjectKeyExists(field.validators, "required") &&
|
|
1186
785
|
field.validators.required)) {
|
|
1187
786
|
validators.push(Validators.required);
|
|
1188
787
|
}
|
|
1189
|
-
if (
|
|
1190
|
-
|
|
1191
|
-
|
|
788
|
+
if (checkObjectKeyExists(field, "validators") &&
|
|
789
|
+
checkObjectKeyExists(field.validators, "minLength") &&
|
|
790
|
+
isNotEmptyValue(field.validators.minLength)) {
|
|
1192
791
|
validators.push(Validators.minLength(field.validators.minLength));
|
|
1193
792
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
|
|
1196
|
-
|
|
793
|
+
if (checkObjectKeyExists(field, "validators") &&
|
|
794
|
+
checkObjectKeyExists(field.validators, "maxLength") &&
|
|
795
|
+
isNotEmptyValue(field.validators.maxLength)) {
|
|
1197
796
|
validators.push(Validators.maxLength(field.validators.maxLength));
|
|
1198
797
|
}
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
if (
|
|
798
|
+
if (checkObjectKeyExists(field, "validators") &&
|
|
799
|
+
checkObjectKeyExists(field.validators, "pattern") &&
|
|
800
|
+
isNotEmptyValue(field.validators.pattern)) {
|
|
801
|
+
if (checkObjectKeyExists(field.validators.pattern, "key")) {
|
|
1203
802
|
if (field.validators.pattern.key === EPatternKey.CUSTOM) {
|
|
1204
803
|
validators.push(Validators.pattern(field.validators.pattern.pattern));
|
|
1205
804
|
}
|
|
@@ -1259,11 +858,21 @@ class Validations$1 {
|
|
|
1259
858
|
const triggers = validations.triggers;
|
|
1260
859
|
const rules = validations.rules;
|
|
1261
860
|
const actions = validations.actions;
|
|
1262
|
-
const rulesMapping = new Rules
|
|
861
|
+
const rulesMapping = new Rules(rules, {
|
|
862
|
+
FIELD_CONFIG: this._field,
|
|
863
|
+
FORM_DATA: this._formData,
|
|
864
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
865
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
866
|
+
}).mapping();
|
|
1263
867
|
for (let action of actions) {
|
|
1264
|
-
const conditionEvaluation = new Condition
|
|
868
|
+
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
1265
869
|
if (conditionEvaluation) {
|
|
1266
|
-
const actions = new Actions
|
|
870
|
+
const actions = new Actions(action, rulesMapping, {
|
|
871
|
+
FIELD_CONFIG: this._field,
|
|
872
|
+
FORM_DATA: this._formData,
|
|
873
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
874
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
875
|
+
}, this._takeAction);
|
|
1267
876
|
yield actions.execute();
|
|
1268
877
|
}
|
|
1269
878
|
}
|
|
@@ -1271,17 +880,17 @@ class Validations$1 {
|
|
|
1271
880
|
}
|
|
1272
881
|
}
|
|
1273
882
|
__decorate([
|
|
1274
|
-
|
|
1275
|
-
], Validations
|
|
883
|
+
logMethod
|
|
884
|
+
], Validations.prototype, "getFieldValidators", null);
|
|
1276
885
|
__decorate([
|
|
1277
|
-
|
|
1278
|
-
], Validations
|
|
886
|
+
logMethod
|
|
887
|
+
], Validations.prototype, "getFormValidationErrors", null);
|
|
1279
888
|
__decorate([
|
|
1280
|
-
|
|
1281
|
-
], Validations
|
|
889
|
+
logMethod
|
|
890
|
+
], Validations.prototype, "findInvalidControlsRecursive", null);
|
|
1282
891
|
__decorate([
|
|
1283
|
-
|
|
1284
|
-
], Validations
|
|
892
|
+
logMethod
|
|
893
|
+
], Validations.prototype, "validateField", null);
|
|
1285
894
|
|
|
1286
895
|
class KwikIDFormViewService {
|
|
1287
896
|
constructor() { }
|
|
@@ -1294,7 +903,7 @@ class KwikIDFormViewService {
|
|
|
1294
903
|
const defaults = new Defaults(field, allFormsData, formData, previousFormData, takeAction);
|
|
1295
904
|
let value = yield defaults.getDefaultValue();
|
|
1296
905
|
value = convertValueFromBasicFormatToKwikUIFormat(field, value);
|
|
1297
|
-
const validators = new Validations
|
|
906
|
+
const validators = new Validations(field, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
|
|
1298
907
|
formGroup.addControl(field.key, new FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
|
|
1299
908
|
}
|
|
1300
909
|
}
|
|
@@ -1303,7 +912,7 @@ class KwikIDFormViewService {
|
|
|
1303
912
|
}
|
|
1304
913
|
}
|
|
1305
914
|
__decorate([
|
|
1306
|
-
|
|
915
|
+
logMethod
|
|
1307
916
|
], KwikIDFormViewService.prototype, "createFormGroup", null);
|
|
1308
917
|
|
|
1309
918
|
class Apis {
|
|
@@ -1319,7 +928,7 @@ class Apis {
|
|
|
1319
928
|
this._status = field.api.status;
|
|
1320
929
|
}
|
|
1321
930
|
setRequestBodyParams() {
|
|
1322
|
-
var _a, _b, _c;
|
|
931
|
+
var _a, _b, _c, _d;
|
|
1323
932
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1324
933
|
let params = this._request.body.params;
|
|
1325
934
|
let paramIndex = 0;
|
|
@@ -1327,19 +936,34 @@ class Apis {
|
|
|
1327
936
|
let sources = param.sources;
|
|
1328
937
|
let sourceIndex = 0;
|
|
1329
938
|
for (let source of sources) {
|
|
1330
|
-
const sources = new Sources
|
|
939
|
+
const sources = new Sources({
|
|
940
|
+
FIELD_CONFIG: this._field,
|
|
941
|
+
FORM_DATA: this._formData,
|
|
942
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
943
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
944
|
+
});
|
|
1331
945
|
const value = sources.getValueFromSource(source);
|
|
1332
946
|
// Set the Value of current source.
|
|
1333
947
|
this._field = setValueToObject(this._field, `api.request.body.params[${paramIndex}].sources[${sourceIndex}].value`, value);
|
|
1334
948
|
const validation = source.validation;
|
|
1335
949
|
const triggers = (_a = validation === null || validation === void 0 ? void 0 : validation.triggers) !== null && _a !== void 0 ? _a : [];
|
|
1336
950
|
const rules = (_b = validation === null || validation === void 0 ? void 0 : validation.rules) !== null && _b !== void 0 ? _b : [];
|
|
1337
|
-
const actions = (_c = validation === null ||
|
|
1338
|
-
const rulesMapping = new Rules
|
|
951
|
+
const actions = (_d = (_c = validation) === null || _c === void 0 ? void 0 : _c.actions) !== null && _d !== void 0 ? _d : [];
|
|
952
|
+
const rulesMapping = new Rules(rules, {
|
|
953
|
+
FIELD_CONFIG: this._field,
|
|
954
|
+
FORM_DATA: this._formData,
|
|
955
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
956
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
957
|
+
}).mapping();
|
|
1339
958
|
for (let action of actions) {
|
|
1340
|
-
const conditionEvaluation = new Condition
|
|
959
|
+
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
1341
960
|
if (conditionEvaluation) {
|
|
1342
|
-
const actions = new Actions
|
|
961
|
+
const actions = new Actions(action, rulesMapping, {
|
|
962
|
+
FIELD_CONFIG: this._field,
|
|
963
|
+
FORM_DATA: this._formData,
|
|
964
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
965
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
966
|
+
}, this._takeAction);
|
|
1343
967
|
yield actions.execute();
|
|
1344
968
|
}
|
|
1345
969
|
}
|
|
@@ -1351,17 +975,28 @@ class Apis {
|
|
|
1351
975
|
});
|
|
1352
976
|
}
|
|
1353
977
|
validateRequestBody() {
|
|
978
|
+
var _a;
|
|
1354
979
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1355
980
|
const body = this._request.body;
|
|
1356
981
|
const validation = body.validation;
|
|
1357
982
|
const triggers = validation.triggers;
|
|
1358
983
|
const rules = validation.rules;
|
|
1359
|
-
const actions = validation.actions;
|
|
1360
|
-
const rulesMapping = new Rules
|
|
984
|
+
const actions = (_a = validation) === null || _a === void 0 ? void 0 : _a.actions;
|
|
985
|
+
const rulesMapping = new Rules(rules, {
|
|
986
|
+
FIELD_CONFIG: this._field,
|
|
987
|
+
FORM_DATA: this._formData,
|
|
988
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
989
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
990
|
+
}).mapping();
|
|
1361
991
|
for (let action of actions) {
|
|
1362
|
-
const conditionSuccess = new Condition
|
|
992
|
+
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1363
993
|
if (conditionSuccess) {
|
|
1364
|
-
const actions = new Actions
|
|
994
|
+
const actions = new Actions(action, rulesMapping, {
|
|
995
|
+
FIELD_CONFIG: this._field,
|
|
996
|
+
FORM_DATA: this._formData,
|
|
997
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
998
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
999
|
+
}, this._takeAction);
|
|
1365
1000
|
yield actions.execute();
|
|
1366
1001
|
}
|
|
1367
1002
|
}
|
|
@@ -1374,11 +1009,21 @@ class Apis {
|
|
|
1374
1009
|
const triggers = validation.triggers;
|
|
1375
1010
|
const rules = validation.rules;
|
|
1376
1011
|
const actions = validation.actions;
|
|
1377
|
-
const rulesMapping = new Rules
|
|
1012
|
+
const rulesMapping = new Rules(rules, {
|
|
1013
|
+
FIELD_CONFIG: this._field,
|
|
1014
|
+
FORM_DATA: this._formData,
|
|
1015
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
1016
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
1017
|
+
}).mapping();
|
|
1378
1018
|
for (let action of actions) {
|
|
1379
|
-
const conditionSuccess = new Condition
|
|
1019
|
+
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1380
1020
|
if (conditionSuccess) {
|
|
1381
|
-
const actions = new Actions
|
|
1021
|
+
const actions = new Actions(action, rulesMapping, {
|
|
1022
|
+
FIELD_CONFIG: this._field,
|
|
1023
|
+
FORM_DATA: this._formData,
|
|
1024
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
1025
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
1026
|
+
}, this._takeAction);
|
|
1382
1027
|
yield actions.execute();
|
|
1383
1028
|
}
|
|
1384
1029
|
}
|
|
@@ -1395,13 +1040,13 @@ class Apis {
|
|
|
1395
1040
|
}
|
|
1396
1041
|
}
|
|
1397
1042
|
__decorate([
|
|
1398
|
-
|
|
1043
|
+
logMethod
|
|
1399
1044
|
], Apis.prototype, "setRequestBodyParams", null);
|
|
1400
1045
|
__decorate([
|
|
1401
|
-
|
|
1046
|
+
logMethod
|
|
1402
1047
|
], Apis.prototype, "validateRequestBody", null);
|
|
1403
1048
|
__decorate([
|
|
1404
|
-
|
|
1049
|
+
logMethod
|
|
1405
1050
|
], Apis.prototype, "validateApiCallResponse", null);
|
|
1406
1051
|
|
|
1407
1052
|
class KwikIDFormViewComponent {
|
|
@@ -1439,7 +1084,7 @@ class KwikIDFormViewComponent {
|
|
|
1439
1084
|
ngAfterViewInit() { }
|
|
1440
1085
|
ngOnChanges(changes) {
|
|
1441
1086
|
const verifyChange = (key) => {
|
|
1442
|
-
return
|
|
1087
|
+
return checkObjectKeyExists(changes, key) && !changes[key].firstChange;
|
|
1443
1088
|
};
|
|
1444
1089
|
if (verifyChange("formData")) {
|
|
1445
1090
|
this.formData = Object.assign(Object.assign({}, this.formData), changes.formData.currentValue);
|
|
@@ -1502,11 +1147,11 @@ class KwikIDFormViewComponent {
|
|
|
1502
1147
|
});
|
|
1503
1148
|
}
|
|
1504
1149
|
setFormFieldsFromFormConfig(formConfig) {
|
|
1505
|
-
if (
|
|
1150
|
+
if (checkObjectKeyExists(formConfig, "fields")) {
|
|
1506
1151
|
this.formFields = formConfig.fields;
|
|
1507
1152
|
}
|
|
1508
|
-
else if (
|
|
1509
|
-
|
|
1153
|
+
else if (checkObjectKeyExists(formConfig, "multiForm") &&
|
|
1154
|
+
checkObjectKeyExists(formConfig.multiForm, "fields")) {
|
|
1510
1155
|
this.formFields = formConfig.multiForm.fields;
|
|
1511
1156
|
}
|
|
1512
1157
|
}
|
|
@@ -1514,7 +1159,7 @@ class KwikIDFormViewComponent {
|
|
|
1514
1159
|
this.fieldGroups = formConfig.fieldGroups;
|
|
1515
1160
|
}
|
|
1516
1161
|
setFormDataFromAllFormsData() {
|
|
1517
|
-
if (
|
|
1162
|
+
if (checkObjectKeyExists(this.allFormsData, this.formConfig.key)) {
|
|
1518
1163
|
this.formData = this.allFormsData[this.formConfig.key];
|
|
1519
1164
|
}
|
|
1520
1165
|
else {
|
|
@@ -1523,12 +1168,22 @@ class KwikIDFormViewComponent {
|
|
|
1523
1168
|
}
|
|
1524
1169
|
handleConnectedElementFieldGroupActions(childFieldGroupConfig, parentField) {
|
|
1525
1170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1526
|
-
if (
|
|
1527
|
-
const rulesMapping = new Rules
|
|
1171
|
+
if (checkObjectKeyExists(childFieldGroupConfig, "rules")) {
|
|
1172
|
+
const rulesMapping = new Rules(childFieldGroupConfig.rules, {
|
|
1173
|
+
FIELD_CONFIG: parentField,
|
|
1174
|
+
FORM_DATA: this.formData,
|
|
1175
|
+
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1176
|
+
ALL_FORMS_DATA: this.allFormsData
|
|
1177
|
+
}).mapping();
|
|
1528
1178
|
for (let action of childFieldGroupConfig.actions) {
|
|
1529
|
-
const conditionSuccess = new Condition
|
|
1179
|
+
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1530
1180
|
if (conditionSuccess) {
|
|
1531
|
-
const actions = new Actions
|
|
1181
|
+
const actions = new Actions(action, rulesMapping, {
|
|
1182
|
+
FIELD_CONFIG: parentField,
|
|
1183
|
+
FORM_DATA: this.formData,
|
|
1184
|
+
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1185
|
+
ALL_FORMS_DATA: this.allFormsData
|
|
1186
|
+
}, this.takeActionOnFieldGroup.bind(this));
|
|
1532
1187
|
yield actions.execute();
|
|
1533
1188
|
}
|
|
1534
1189
|
}
|
|
@@ -1539,24 +1194,24 @@ class KwikIDFormViewComponent {
|
|
|
1539
1194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1540
1195
|
switch (eventType) {
|
|
1541
1196
|
case "INIT":
|
|
1542
|
-
if (
|
|
1197
|
+
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers") &&
|
|
1543
1198
|
connectedFieldGroupConfig.triggers.includes("INIT")) {
|
|
1544
1199
|
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1545
1200
|
}
|
|
1546
1201
|
break;
|
|
1547
1202
|
case "VALUE_CHANGE":
|
|
1548
|
-
if (
|
|
1203
|
+
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers") &&
|
|
1549
1204
|
connectedFieldGroupConfig.triggers.includes("VALUE_CHANGE")) {
|
|
1550
1205
|
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1551
1206
|
}
|
|
1552
1207
|
break;
|
|
1553
1208
|
case "NESTED_LINK":
|
|
1554
|
-
if (
|
|
1209
|
+
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers") &&
|
|
1555
1210
|
connectedFieldGroupConfig.triggers.includes("NESTED_LINK")) {
|
|
1556
1211
|
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1557
1212
|
}
|
|
1558
1213
|
default:
|
|
1559
|
-
if (
|
|
1214
|
+
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers")) {
|
|
1560
1215
|
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1561
1216
|
}
|
|
1562
1217
|
break;
|
|
@@ -1565,12 +1220,22 @@ class KwikIDFormViewComponent {
|
|
|
1565
1220
|
}
|
|
1566
1221
|
handleConnectedElementFieldActions(connectedFieldConfig, connectedField) {
|
|
1567
1222
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1568
|
-
if (
|
|
1569
|
-
const rulesMapping = new Rules
|
|
1223
|
+
if (checkObjectKeyExists(connectedFieldConfig, "rules")) {
|
|
1224
|
+
const rulesMapping = new Rules(connectedFieldConfig.rules, {
|
|
1225
|
+
FIELD_CONFIG: connectedField,
|
|
1226
|
+
FORM_DATA: this.formData,
|
|
1227
|
+
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1228
|
+
ALL_FORMS_DATA: this.allFormsData
|
|
1229
|
+
}).mapping();
|
|
1570
1230
|
for (let action of connectedFieldConfig.actions) {
|
|
1571
|
-
const conditionSuccess = new Condition
|
|
1231
|
+
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1572
1232
|
if (conditionSuccess) {
|
|
1573
|
-
const actions = new Actions
|
|
1233
|
+
const actions = new Actions(action, rulesMapping, {
|
|
1234
|
+
FIELD_CONFIG: connectedField,
|
|
1235
|
+
FORM_DATA: this.formData,
|
|
1236
|
+
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1237
|
+
ALL_FORMS_DATA: this.allFormsData
|
|
1238
|
+
}, this.takeAction.bind(this));
|
|
1574
1239
|
yield actions.execute();
|
|
1575
1240
|
}
|
|
1576
1241
|
}
|
|
@@ -1583,10 +1248,10 @@ class KwikIDFormViewComponent {
|
|
|
1583
1248
|
let connectedField = findFieldFromKey(this.formFields, connectedFieldConfig["key"]);
|
|
1584
1249
|
switch (eventType) {
|
|
1585
1250
|
case "INIT":
|
|
1586
|
-
if (
|
|
1251
|
+
if (checkObjectKeyExists(connectedField, "triggers") &&
|
|
1587
1252
|
connectedField.triggers.includes("INIT")) {
|
|
1588
1253
|
if (this.isFieldEnabled(connectedField.key)) {
|
|
1589
|
-
if (
|
|
1254
|
+
if (checkObjectKeyExists(connectedFieldConfig, "connectedParentFields")) {
|
|
1590
1255
|
switch (connectedFieldConfig.type) {
|
|
1591
1256
|
case "dropdown-with-search":
|
|
1592
1257
|
connectedField = yield this.handleFieldTypeSearchText(currentField, connectedField);
|
|
@@ -1600,7 +1265,7 @@ class KwikIDFormViewComponent {
|
|
|
1600
1265
|
}
|
|
1601
1266
|
break;
|
|
1602
1267
|
case "VALUE_CHANGE":
|
|
1603
|
-
if (
|
|
1268
|
+
if (checkObjectKeyExists(connectedFieldConfig, "triggers") &&
|
|
1604
1269
|
connectedFieldConfig.triggers.includes("VALUE_CHANGE")) {
|
|
1605
1270
|
switch (connectedField.type) {
|
|
1606
1271
|
case "dropdown-with-search":
|
|
@@ -1613,18 +1278,18 @@ class KwikIDFormViewComponent {
|
|
|
1613
1278
|
}
|
|
1614
1279
|
break;
|
|
1615
1280
|
case "NESTED_LINK":
|
|
1616
|
-
if (
|
|
1281
|
+
if (checkObjectKeyExists(connectedFieldConfig, "triggers") &&
|
|
1617
1282
|
connectedFieldConfig.triggers.includes("NESTED_LINK")) {
|
|
1618
1283
|
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1619
1284
|
}
|
|
1620
1285
|
default:
|
|
1621
|
-
if (
|
|
1286
|
+
if (checkObjectKeyExists(connectedFieldConfig, "triggers")) {
|
|
1622
1287
|
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1623
1288
|
}
|
|
1624
1289
|
break;
|
|
1625
1290
|
}
|
|
1626
|
-
if (
|
|
1627
|
-
if (
|
|
1291
|
+
if (checkObjectKeyExists(connectedField, "connectedElements")) {
|
|
1292
|
+
if (checkObjectKeyExists(connectedField.connectedElements, "connectedFields")) {
|
|
1628
1293
|
for (const connectedFieldConfig of connectedField.connectedElements
|
|
1629
1294
|
.connectedFields) {
|
|
1630
1295
|
connectedField = this.handleConnectedElementFields(connectedField, connectedFieldConfig, "NESTED_LINK");
|
|
@@ -1637,20 +1302,25 @@ class KwikIDFormViewComponent {
|
|
|
1637
1302
|
handleConnectedElements(e, eventType) {
|
|
1638
1303
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1639
1304
|
let currentField = findFieldFromKey(this.formFields, e.key);
|
|
1640
|
-
if (
|
|
1641
|
-
if (
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1305
|
+
if (currentField !== undefined) {
|
|
1306
|
+
if (checkObjectKeyExists(currentField, "connectedElements")) {
|
|
1307
|
+
if (checkObjectKeyExists(currentField.connectedElements, "connectedFieldGroups")) {
|
|
1308
|
+
let connectedFieldGroups = currentField.connectedElements.connectedFieldGroups;
|
|
1309
|
+
for (let connectedFieldGroupConfig of connectedFieldGroups) {
|
|
1310
|
+
yield this.handleConnectedElementFieldGroup(currentField, connectedFieldGroupConfig, eventType);
|
|
1311
|
+
}
|
|
1645
1312
|
}
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1313
|
+
if (checkObjectKeyExists(currentField.connectedElements, "connectedFields")) {
|
|
1314
|
+
let connectedFields = currentField.connectedElements.connectedFields;
|
|
1315
|
+
for (let connectedFieldConfig of connectedFields) {
|
|
1316
|
+
currentField = yield this.handleConnectedElementFields(currentField, connectedFieldConfig, eventType);
|
|
1317
|
+
}
|
|
1651
1318
|
}
|
|
1652
1319
|
}
|
|
1653
1320
|
}
|
|
1321
|
+
else {
|
|
1322
|
+
throw new Error(`Field for the given key ['${e.key}'] is not found with eventType: '${eventType}'.`);
|
|
1323
|
+
}
|
|
1654
1324
|
});
|
|
1655
1325
|
}
|
|
1656
1326
|
// DOM Event Handlers
|
|
@@ -1662,7 +1332,7 @@ class KwikIDFormViewComponent {
|
|
|
1662
1332
|
let field = findFieldFromKey(this.formFields, e.key);
|
|
1663
1333
|
if (field.type !== "title" &&
|
|
1664
1334
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
1665
|
-
const validations = new Validations
|
|
1335
|
+
const validations = new Validations(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1666
1336
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1667
1337
|
yield validations.validateField();
|
|
1668
1338
|
}))();
|
|
@@ -1675,9 +1345,14 @@ class KwikIDFormViewComponent {
|
|
|
1675
1345
|
handleOnClickResetFormFields(e, field) {
|
|
1676
1346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1677
1347
|
for (let f of field.reset.fields) {
|
|
1678
|
-
for (let
|
|
1679
|
-
const resetField = findFieldFromKey(this.formFields,
|
|
1680
|
-
const actions = new Actions
|
|
1348
|
+
for (let action of f.actions) {
|
|
1349
|
+
const resetField = findFieldFromKey(this.formFields, action.props.fieldKey);
|
|
1350
|
+
const actions = new Actions(action, {}, {
|
|
1351
|
+
FIELD_CONFIG: resetField,
|
|
1352
|
+
FORM_DATA: this.formData,
|
|
1353
|
+
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1354
|
+
ALL_FORMS_DATA: this.allFormsData
|
|
1355
|
+
}, this.takeAction.bind(this));
|
|
1681
1356
|
yield actions.execute();
|
|
1682
1357
|
}
|
|
1683
1358
|
}
|
|
@@ -1745,17 +1420,17 @@ class KwikIDFormViewComponent {
|
|
|
1745
1420
|
for (let field of this.formFields) {
|
|
1746
1421
|
if (field.type !== EFieldType.TITLE &&
|
|
1747
1422
|
field.validation.triggers.includes("ON_SAVE")) {
|
|
1748
|
-
const validations = new Validations
|
|
1423
|
+
const validations = new Validations(field, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1749
1424
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1750
1425
|
yield validations.validateField();
|
|
1751
1426
|
}))();
|
|
1752
1427
|
}
|
|
1753
1428
|
}
|
|
1754
1429
|
if (this.formGroup.invalid) {
|
|
1755
|
-
const controls = new Validations
|
|
1430
|
+
const controls = new Validations(undefined, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
|
|
1756
1431
|
let firstFieldWithError = "";
|
|
1757
1432
|
for (let control of controls) {
|
|
1758
|
-
if (control.invalid &&
|
|
1433
|
+
if (control.invalid && isEmptyValue(firstFieldWithError)) {
|
|
1759
1434
|
firstFieldWithError = control.key;
|
|
1760
1435
|
}
|
|
1761
1436
|
this.formFields = setFieldError(this.formFields, this.formGroup.controls[control.key].errors, control.key, control.invalid);
|
|
@@ -1767,7 +1442,7 @@ class KwikIDFormViewComponent {
|
|
|
1767
1442
|
return;
|
|
1768
1443
|
}
|
|
1769
1444
|
Object.keys(formData).map((key) => {
|
|
1770
|
-
if (
|
|
1445
|
+
if (isEmptyValue(formData[key])) {
|
|
1771
1446
|
formData[key] = "";
|
|
1772
1447
|
}
|
|
1773
1448
|
});
|
|
@@ -1810,7 +1485,7 @@ class KwikIDFormViewComponent {
|
|
|
1810
1485
|
});
|
|
1811
1486
|
if (field.type !== EFieldType.TITLE) {
|
|
1812
1487
|
this.formFields[fieldIndex]["disabled"] = true;
|
|
1813
|
-
if (
|
|
1488
|
+
if (isNotEmptyValue(this.formGroup.controls)) {
|
|
1814
1489
|
this.formGroup.controls[field.key].disable({
|
|
1815
1490
|
emitEvent: false
|
|
1816
1491
|
});
|
|
@@ -1830,7 +1505,7 @@ class KwikIDFormViewComponent {
|
|
|
1830
1505
|
});
|
|
1831
1506
|
if (field.type !== EFieldType.TITLE) {
|
|
1832
1507
|
this.formFields[fieldIndex]["disabled"] = false;
|
|
1833
|
-
if (
|
|
1508
|
+
if (isNotEmptyValue(this.formGroup.controls)) {
|
|
1834
1509
|
this.formGroup.controls[field.key].enable({
|
|
1835
1510
|
emitEvent: false
|
|
1836
1511
|
});
|
|
@@ -1931,10 +1606,10 @@ class KwikIDFormViewComponent {
|
|
|
1931
1606
|
}
|
|
1932
1607
|
handleFieldTypeSearchText(field, childField) {
|
|
1933
1608
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1934
|
-
if (
|
|
1609
|
+
if (checkObjectKeyExists(childField, "json")) {
|
|
1935
1610
|
childField.options = getSearchTextOptionsFromFieldConfig(field, childField, this.formGroup);
|
|
1936
1611
|
}
|
|
1937
|
-
if (
|
|
1612
|
+
if (checkObjectKeyExists(childField, "fetchJsonFromRemote")) {
|
|
1938
1613
|
childField.options = yield getSearchTextOptionsFromRemoteFile(field, childField, this.formGroup);
|
|
1939
1614
|
}
|
|
1940
1615
|
return childField;
|
|
@@ -1960,7 +1635,7 @@ class KwikIDFormViewComponent {
|
|
|
1960
1635
|
}
|
|
1961
1636
|
});
|
|
1962
1637
|
}
|
|
1963
|
-
takeAction(action,
|
|
1638
|
+
takeAction(action, object) {
|
|
1964
1639
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1965
1640
|
switch (action.key) {
|
|
1966
1641
|
case EActionKey.FIELD_HIDE:
|
|
@@ -1991,16 +1666,16 @@ class KwikIDFormViewComponent {
|
|
|
1991
1666
|
this.fieldMessageHide(action.props.fieldKey, action.props.message);
|
|
1992
1667
|
break;
|
|
1993
1668
|
case EActionKey.SET_VALUE:
|
|
1994
|
-
const sources = new Sources
|
|
1669
|
+
const sources = new Sources(object);
|
|
1995
1670
|
const sourceValue = yield sources.getValueFromSource(action.props.value.source);
|
|
1996
1671
|
sources.setValueToSource(action.props.value.destination, sourceValue);
|
|
1997
|
-
|
|
1998
|
-
this.formData = sources.
|
|
1999
|
-
this.allFormsData = sources.
|
|
2000
|
-
this.previousFormData = sources.
|
|
1672
|
+
object.FIELD_CONFIG = sources.object.FIELD_CONFIG;
|
|
1673
|
+
this.formData = sources.object.FORM_DATA;
|
|
1674
|
+
this.allFormsData = sources.object.ALL_FORMS_DATA;
|
|
1675
|
+
this.previousFormData = sources.object.PREVIOUS_FORM_DATA;
|
|
2001
1676
|
break;
|
|
2002
1677
|
case EActionKey.HANDLE_CONNECTED_ELEMENTS:
|
|
2003
|
-
this.handleConnectedElements({ key:
|
|
1678
|
+
this.handleConnectedElements({ key: action.props.fieldKey }, "ACTION");
|
|
2004
1679
|
break;
|
|
2005
1680
|
case EActionKey.CUSTOM:
|
|
2006
1681
|
break;
|
|
@@ -2011,123 +1686,123 @@ class KwikIDFormViewComponent {
|
|
|
2011
1686
|
}
|
|
2012
1687
|
}
|
|
2013
1688
|
/** @nocollapse */ KwikIDFormViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormViewComponent, deps: [{ token: TuiPushService }, { token: TuiAlertService }, { token: KwikIDFormViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2014
|
-
/** @nocollapse */ KwikIDFormViewComponent.ɵcmp = i0.ɵɵ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, 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 <hr />\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\r\n class=\"title\"\r\n [class.hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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?.properties?.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 id=\"field_{{ field.key }}\"\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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<tui-push\r\n id=\"field-error-notification\"\r\n *tuiPush=\"showErrorNotification\"\r\n heading=\"Missing/Incorrect Fields!\"\r\n type=\"Error\"\r\n (close)=\"toggleErrorNotification(false)\"\r\n>\r\n <tui-svg\r\n src=\"tuiIconCancel\"\r\n style=\"color: #fff !important\"\r\n >\r\n </tui-svg>\r\n</tui-push>\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-header-container hr{width:100%}#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}.title.hidden{display:none}.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}#field-error-notification{background-color:var(--tui-error-fill);color:#fff!important}#field-error-notification .t-top{color:#fff!important}#field-error-notification .t-close{color:#fff!important}\n"], components: [{ type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }, { type: i2.KwikUIInputComponent, selector: "kwikui-input", inputs: ["label", "id", "type", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "validators", "case", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIMessagesComponent, selector: "kwikui-messages", inputs: ["messages", "id"] }, { type: i2.KwikUICheckboxBlockComponent, selector: "kwikui-checkbox-block", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "contentAlign", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputNumberComponent, selector: "kwikui-input-number", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "countryCode", "phoneMaskAfterCountryCode", "removeCountryCodeFromValue", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i3.TuiLabelComponent, selector: "label[tuiLabel]", inputs: ["tuiLabel", "context"] }, { type: i2.KwikUIRadioListComponent, selector: "kwikui-radio-list", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "orientation", "items", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUISelectComboboxComponent, selector: "kwikui-select-combobox", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "options", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIButtonApiCallComponent, selector: "kwikui-button-api-call", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "shape", "size", "apiStatus"], outputs: ["onClick"] }, { type: i2.KwikUIInputOtpComponent, selector: "kwikui-input-otp", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputAadhaarComponent, selector: "kwikui-input-aadhaar", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i4.TuiPushComponent, selector: "tui-push", inputs: ["heading", "type", "timestamp"], outputs: ["close"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i4.TuiPushAlertDirective, selector: "[tuiPush]", inputs: ["tuiPush"] }, { type: i4.TuiPushDirective, selector: "tui-push" }] });
|
|
1689
|
+
/** @nocollapse */ KwikIDFormViewComponent.ɵcmp = i0.ɵɵ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, 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 <hr />\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\r\n class=\"title\"\r\n [class.hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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?.properties?.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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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?.properties?.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 id=\"field_{{ field.key }}\"\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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\r\n [hidden]=\"field?.hidden\"\r\n id=\"field_{{ field.key }}\"\r\n >\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<tui-push\r\n id=\"field-error-notification\"\r\n *tuiPush=\"showErrorNotification\"\r\n heading=\"Missing/Incorrect Fields!\"\r\n type=\"Error\"\r\n (close)=\"toggleErrorNotification(false)\"\r\n>\r\n <tui-svg\r\n src=\"tuiIconCancel\"\r\n style=\"color: #fff !important\"\r\n >\r\n </tui-svg>\r\n</tui-push>\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-header-container hr{width:100%}#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}.title.hidden{display:none}.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}#field-error-notification{background-color:var(--tui-error-fill);color:#fff!important}#field-error-notification .t-top{color:#fff!important}#field-error-notification .t-close{color:#fff!important}\n"], components: [{ type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }, { type: i2.KwikUIInputComponent, selector: "kwikui-input", inputs: ["label", "id", "type", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "validators", "case", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIMessagesComponent, selector: "kwikui-messages", inputs: ["messages", "id"] }, { type: i2.KwikUICheckboxBlockComponent, selector: "kwikui-checkbox-block", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "contentAlign", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputNumberComponent, selector: "kwikui-input-number", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "countryCode", "phoneMaskAfterCountryCode", "removeCountryCodeFromValue", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i3.TuiLabelComponent, selector: "label[tuiLabel]", inputs: ["tuiLabel", "context"] }, { type: i2.KwikUIRadioListComponent, selector: "kwikui-radio-list", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "orientation", "items", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUISelectComboboxComponent, selector: "kwikui-select-combobox", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "options", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIButtonApiCallComponent, selector: "kwikui-button-api-call", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "shape", "size", "apiStatus"], outputs: ["onClick"] }, { type: i2.KwikUIInputOtpComponent, selector: "kwikui-input-otp", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputAadhaarComponent, selector: "kwikui-input-aadhaar", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i4.TuiPushComponent, selector: "tui-push", inputs: ["heading", "type", "timestamp"], outputs: ["close"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i4.TuiPushAlertDirective, selector: "[tuiPush]", inputs: ["tuiPush"] }, { type: i4.TuiPushDirective, selector: "tui-push" }] });
|
|
2015
1690
|
__decorate([
|
|
2016
|
-
|
|
1691
|
+
logMethod
|
|
2017
1692
|
], KwikIDFormViewComponent.prototype, "ngOnInit", null);
|
|
2018
1693
|
__decorate([
|
|
2019
|
-
|
|
1694
|
+
logMethod
|
|
2020
1695
|
], KwikIDFormViewComponent.prototype, "ngAfterViewInit", null);
|
|
2021
1696
|
__decorate([
|
|
2022
|
-
|
|
1697
|
+
logMethod
|
|
2023
1698
|
], KwikIDFormViewComponent.prototype, "ngOnChanges", null);
|
|
2024
1699
|
__decorate([
|
|
2025
|
-
|
|
1700
|
+
logMethod
|
|
2026
1701
|
], KwikIDFormViewComponent.prototype, "initFormConfig", null);
|
|
2027
1702
|
__decorate([
|
|
2028
|
-
|
|
1703
|
+
logMethod
|
|
2029
1704
|
], KwikIDFormViewComponent.prototype, "setFormFieldsFromFormConfig", null);
|
|
2030
1705
|
__decorate([
|
|
2031
|
-
|
|
1706
|
+
logMethod
|
|
2032
1707
|
], KwikIDFormViewComponent.prototype, "setFormFieldGroupsFromFormConfig", null);
|
|
2033
1708
|
__decorate([
|
|
2034
|
-
|
|
1709
|
+
logMethod
|
|
2035
1710
|
], KwikIDFormViewComponent.prototype, "setFormDataFromAllFormsData", null);
|
|
2036
1711
|
__decorate([
|
|
2037
|
-
|
|
1712
|
+
logMethod
|
|
2038
1713
|
], KwikIDFormViewComponent.prototype, "handleConnectedElementFieldGroupActions", null);
|
|
2039
1714
|
__decorate([
|
|
2040
|
-
|
|
1715
|
+
logMethod
|
|
2041
1716
|
], KwikIDFormViewComponent.prototype, "handleConnectedElementFieldGroup", null);
|
|
2042
1717
|
__decorate([
|
|
2043
|
-
|
|
1718
|
+
logMethod
|
|
2044
1719
|
], KwikIDFormViewComponent.prototype, "handleConnectedElementFieldActions", null);
|
|
2045
1720
|
__decorate([
|
|
2046
|
-
|
|
1721
|
+
logMethod
|
|
2047
1722
|
], KwikIDFormViewComponent.prototype, "handleConnectedElementFields", null);
|
|
2048
1723
|
__decorate([
|
|
2049
|
-
|
|
1724
|
+
logMethod
|
|
2050
1725
|
], KwikIDFormViewComponent.prototype, "handleConnectedElements", null);
|
|
2051
1726
|
__decorate([
|
|
2052
|
-
|
|
1727
|
+
logMethod
|
|
2053
1728
|
], KwikIDFormViewComponent.prototype, "handleGetKeyValue", null);
|
|
2054
1729
|
__decorate([
|
|
2055
|
-
|
|
1730
|
+
logMethod
|
|
2056
1731
|
], KwikIDFormViewComponent.prototype, "handleOnClickResetFormFields", null);
|
|
2057
1732
|
__decorate([
|
|
2058
|
-
|
|
1733
|
+
logMethod
|
|
2059
1734
|
], KwikIDFormViewComponent.prototype, "handleOnClickApiCall", null);
|
|
2060
1735
|
__decorate([
|
|
2061
|
-
|
|
1736
|
+
logMethod
|
|
2062
1737
|
], KwikIDFormViewComponent.prototype, "handleOnClickViewForms", null);
|
|
2063
1738
|
__decorate([
|
|
2064
|
-
|
|
1739
|
+
logMethod
|
|
2065
1740
|
], KwikIDFormViewComponent.prototype, "handleOnClickSaveForm", null);
|
|
2066
1741
|
__decorate([
|
|
2067
|
-
|
|
1742
|
+
logMethod
|
|
2068
1743
|
], KwikIDFormViewComponent.prototype, "toggleErrorNotification", null);
|
|
2069
1744
|
__decorate([
|
|
2070
|
-
|
|
1745
|
+
logMethod
|
|
2071
1746
|
], KwikIDFormViewComponent.prototype, "fieldHide", null);
|
|
2072
1747
|
__decorate([
|
|
2073
|
-
|
|
1748
|
+
logMethod
|
|
2074
1749
|
], KwikIDFormViewComponent.prototype, "fieldGroupHide", null);
|
|
2075
1750
|
__decorate([
|
|
2076
|
-
|
|
1751
|
+
logMethod
|
|
2077
1752
|
], KwikIDFormViewComponent.prototype, "fieldShow", null);
|
|
2078
1753
|
__decorate([
|
|
2079
|
-
|
|
1754
|
+
logMethod
|
|
2080
1755
|
], KwikIDFormViewComponent.prototype, "fieldGroupShow", null);
|
|
2081
1756
|
__decorate([
|
|
2082
|
-
|
|
1757
|
+
logMethod
|
|
2083
1758
|
], KwikIDFormViewComponent.prototype, "fieldDisable", null);
|
|
2084
1759
|
__decorate([
|
|
2085
|
-
|
|
1760
|
+
logMethod
|
|
2086
1761
|
], KwikIDFormViewComponent.prototype, "fieldGroupDisable", null);
|
|
2087
1762
|
__decorate([
|
|
2088
|
-
|
|
1763
|
+
logMethod
|
|
2089
1764
|
], KwikIDFormViewComponent.prototype, "fieldEnable", null);
|
|
2090
1765
|
__decorate([
|
|
2091
|
-
|
|
1766
|
+
logMethod
|
|
2092
1767
|
], KwikIDFormViewComponent.prototype, "fieldGroupEnable", null);
|
|
2093
1768
|
__decorate([
|
|
2094
|
-
|
|
1769
|
+
logMethod
|
|
2095
1770
|
], KwikIDFormViewComponent.prototype, "fieldReset", null);
|
|
2096
1771
|
__decorate([
|
|
2097
|
-
|
|
1772
|
+
logMethod
|
|
2098
1773
|
], KwikIDFormViewComponent.prototype, "fieldErrorShow", null);
|
|
2099
1774
|
__decorate([
|
|
2100
|
-
|
|
1775
|
+
logMethod
|
|
2101
1776
|
], KwikIDFormViewComponent.prototype, "fieldErrorHide", null);
|
|
2102
1777
|
__decorate([
|
|
2103
|
-
|
|
1778
|
+
logMethod
|
|
2104
1779
|
], KwikIDFormViewComponent.prototype, "fieldMessageShow", null);
|
|
2105
1780
|
__decorate([
|
|
2106
|
-
|
|
1781
|
+
logMethod
|
|
2107
1782
|
], KwikIDFormViewComponent.prototype, "fieldMessageHide", null);
|
|
2108
1783
|
__decorate([
|
|
2109
|
-
|
|
1784
|
+
logMethod
|
|
2110
1785
|
], KwikIDFormViewComponent.prototype, "setObjectValue", null);
|
|
2111
1786
|
__decorate([
|
|
2112
|
-
|
|
1787
|
+
logMethod
|
|
2113
1788
|
], KwikIDFormViewComponent.prototype, "patchFieldControlValue", null);
|
|
2114
1789
|
__decorate([
|
|
2115
|
-
|
|
1790
|
+
logMethod
|
|
2116
1791
|
], KwikIDFormViewComponent.prototype, "isFieldValid", null);
|
|
2117
1792
|
__decorate([
|
|
2118
|
-
|
|
1793
|
+
logMethod
|
|
2119
1794
|
], KwikIDFormViewComponent.prototype, "isFieldEnabled", null);
|
|
2120
1795
|
__decorate([
|
|
2121
|
-
|
|
1796
|
+
logMethod
|
|
2122
1797
|
], KwikIDFormViewComponent.prototype, "getFormGroupRawValues", null);
|
|
2123
1798
|
__decorate([
|
|
2124
|
-
|
|
1799
|
+
logMethod
|
|
2125
1800
|
], KwikIDFormViewComponent.prototype, "handleFieldTypeSearchText", null);
|
|
2126
1801
|
__decorate([
|
|
2127
|
-
|
|
1802
|
+
logMethod
|
|
2128
1803
|
], KwikIDFormViewComponent.prototype, "takeActionOnFieldGroup", null);
|
|
2129
1804
|
__decorate([
|
|
2130
|
-
|
|
1805
|
+
logMethod
|
|
2131
1806
|
], KwikIDFormViewComponent.prototype, "takeAction", null);
|
|
2132
1807
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormViewComponent, decorators: [{
|
|
2133
1808
|
type: Component,
|
|
@@ -2165,10 +1840,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2165
1840
|
type: Output
|
|
2166
1841
|
}], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormFieldGroupsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldGroupActions: [], handleConnectedElementFieldGroup: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], toggleErrorNotification: [], fieldHide: [], fieldGroupHide: [], fieldShow: [], fieldGroupShow: [], fieldDisable: [], fieldGroupDisable: [], fieldEnable: [], fieldGroupEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], handleFieldTypeSearchText: [], takeActionOnFieldGroup: [], takeAction: [] } });
|
|
2167
1842
|
|
|
2168
|
-
const hasKey = (object, key) => {
|
|
2169
|
-
return object.hasOwnProperty(key);
|
|
2170
|
-
};
|
|
2171
|
-
|
|
2172
1843
|
class KwikIDFormsListComponent {
|
|
2173
1844
|
constructor() {
|
|
2174
1845
|
this.showFormFields = {};
|
|
@@ -2187,7 +1858,7 @@ class KwikIDFormsListComponent {
|
|
|
2187
1858
|
}
|
|
2188
1859
|
ngOnChanges(changes) {
|
|
2189
1860
|
const verifyChange = (key) => {
|
|
2190
|
-
return
|
|
1861
|
+
return checkObjectKeyExists(changes, key) && !changes[key].firstChange;
|
|
2191
1862
|
};
|
|
2192
1863
|
if (verifyChange("showFormFields")) {
|
|
2193
1864
|
this.showFormFields = changes.showFormFields.currentValue;
|
|
@@ -2222,7 +1893,10 @@ class KwikIDFormsListComponent {
|
|
|
2222
1893
|
}
|
|
2223
1894
|
}
|
|
2224
1895
|
/** @nocollapse */ KwikIDFormsListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2225
|
-
/** @nocollapse */ KwikIDFormsListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: { showFormFields: "showFormFields", userConfig: "userConfig", formsList: "formsList", formsListCompleted: "formsListCompleted", isMobileView: "isMobileView" }, outputs: { onClickSetActiveForm: "onClickSetActiveForm", onClickHideFormsList: "onClickHideFormsList", onClickSubmitForms: "onClickSubmitForms" }, usesOnChanges: true, ngImport: i0, template: "<div id=\"sidebar-container\">\r\n <div id=\"sidebar\">\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=\"{{ this.userConfig.theme.clientLogo }}\"\r\n [ngClass]=\"'large-icon'\"\r\n />\r\n </div>\r\n </div>\r\n <hr />\r\n </div>\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 === 'editable' && !form.disabled\"\r\n [class.locked]=\"form.status === 'locked' && form.disabled\"\r\n (click)=\"\r\n form.status === 'locked' && 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 </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 </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 </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}}.kwikid-form-header{height:70px;z-index:6}.kwikid-form-header hr{width:calc(100% - 1rem);margin-left:auto;margin-right:auto}#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:100%;height:50px}#uf-header #uf-header-logo-container #uf-header-logo.large-icon{width:100%;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}\n"], components: [{ type: i2.KwikUIProgressSegmentedComponent, selector: "kwikui-progress-segmented", inputs: ["value", "max", "size", "colors"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1896
|
+
/** @nocollapse */ KwikIDFormsListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: { showFormFields: "showFormFields", userConfig: "userConfig", formsList: "formsList", formsListCompleted: "formsListCompleted", isMobileView: "isMobileView" }, outputs: { onClickSetActiveForm: "onClickSetActiveForm", onClickHideFormsList: "onClickHideFormsList", onClickSubmitForms: "onClickSubmitForms" }, usesOnChanges: true, ngImport: i0, template: "<div id=\"sidebar-container\">\r\n <div id=\"sidebar\">\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=\"{{ this.userConfig.theme.clientLogo }}\"\r\n [ngClass]=\"'large-icon'\"\r\n />\r\n </div>\r\n </div>\r\n <hr />\r\n </div>\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 === 'editable' && !form.disabled\"\r\n [class.locked]=\"form.status === 'locked' && form.disabled\"\r\n (click)=\"\r\n form.status === 'locked' && 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 </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 </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 </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}}.kwikid-form-header{height:70px;z-index:6}.kwikid-form-header hr{width:calc(100% - 1rem);margin-left:auto;margin-right:auto}#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:100%;height:50px}#uf-header #uf-header-logo-container #uf-header-logo.large-icon{width:100%;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}\n"], components: [{ type: i2.KwikUIProgressSegmentedComponent, selector: "kwikui-progress-segmented", inputs: ["id", "value", "max", "size", "colors"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1897
|
+
__decorate([
|
|
1898
|
+
logMethod
|
|
1899
|
+
], KwikIDFormsListComponent.prototype, "ngOnChanges", null);
|
|
2226
1900
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsListComponent, decorators: [{
|
|
2227
1901
|
type: Component,
|
|
2228
1902
|
args: [{
|
|
@@ -2246,246 +1920,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2246
1920
|
type: Output
|
|
2247
1921
|
}], onClickSubmitForms: [{
|
|
2248
1922
|
type: Output
|
|
2249
|
-
}] } });
|
|
2250
|
-
|
|
2251
|
-
class Sources {
|
|
2252
|
-
constructor(userConfig) {
|
|
2253
|
-
this._userConfig = userConfig;
|
|
2254
|
-
}
|
|
2255
|
-
get userConfig() {
|
|
2256
|
-
return this._userConfig;
|
|
2257
|
-
}
|
|
2258
|
-
set userConfig(value) {
|
|
2259
|
-
this._userConfig = value;
|
|
2260
|
-
}
|
|
2261
|
-
getValueFromUserConfig(path) {
|
|
2262
|
-
let value = "";
|
|
2263
|
-
if (isNotEmpty(path)) {
|
|
2264
|
-
value = jpQueryWrapper(this._userConfig, path);
|
|
2265
|
-
}
|
|
2266
|
-
else {
|
|
2267
|
-
value = setEmptyValue(this._userConfig);
|
|
2268
|
-
}
|
|
2269
|
-
return value;
|
|
2270
|
-
}
|
|
2271
|
-
getValueFromBrowserStorage(type, key) {
|
|
2272
|
-
let value = "";
|
|
2273
|
-
switch (type) {
|
|
2274
|
-
case EBrowserStorageType.LOCAL_STORAGE:
|
|
2275
|
-
value = isNotEmptyBrowserStorageValue(localStorage.getItem(key))
|
|
2276
|
-
? localStorage.getItem(key)
|
|
2277
|
-
: "";
|
|
2278
|
-
break;
|
|
2279
|
-
case EBrowserStorageType.SESSION_STORAGE:
|
|
2280
|
-
value = isNotEmptyBrowserStorageValue(sessionStorage.getItem(key))
|
|
2281
|
-
? sessionStorage.getItem(key)
|
|
2282
|
-
: "";
|
|
2283
|
-
break;
|
|
2284
|
-
default:
|
|
2285
|
-
value = "";
|
|
2286
|
-
break;
|
|
2287
|
-
}
|
|
2288
|
-
return value;
|
|
2289
|
-
}
|
|
2290
|
-
getValueFromSource(source) {
|
|
2291
|
-
let value = "";
|
|
2292
|
-
switch (source.key) {
|
|
2293
|
-
case ESourceKey.USER_CONFIG:
|
|
2294
|
-
value = this.getValueFromUserConfig(source.props.path);
|
|
2295
|
-
break;
|
|
2296
|
-
case ESourceKey.BROWSER_STORAGE:
|
|
2297
|
-
value = this.getValueFromBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key);
|
|
2298
|
-
break;
|
|
2299
|
-
case ESourceKey.PREDEFINED:
|
|
2300
|
-
value = source.value;
|
|
2301
|
-
break;
|
|
2302
|
-
default:
|
|
2303
|
-
value = "";
|
|
2304
|
-
break;
|
|
2305
|
-
}
|
|
2306
|
-
return value;
|
|
2307
|
-
}
|
|
2308
|
-
setValueToUserConfig(path, value) {
|
|
2309
|
-
this._userConfig = setValueToObject(this._userConfig, path, value);
|
|
2310
|
-
}
|
|
2311
|
-
setValueToBrowserStorage(type, key, value) {
|
|
2312
|
-
switch (type) {
|
|
2313
|
-
case EBrowserStorageType.LOCAL_STORAGE:
|
|
2314
|
-
localStorage.setItem(key, value);
|
|
2315
|
-
break;
|
|
2316
|
-
case EBrowserStorageType.SESSION_STORAGE:
|
|
2317
|
-
sessionStorage.setItem(key, value);
|
|
2318
|
-
break;
|
|
2319
|
-
default:
|
|
2320
|
-
break;
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
setValueToSource(source, value) {
|
|
2324
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2325
|
-
switch (source.key) {
|
|
2326
|
-
case ESourceKey.USER_CONFIG:
|
|
2327
|
-
this.setValueToUserConfig(source.props.path, value);
|
|
2328
|
-
break;
|
|
2329
|
-
case ESourceKey.BROWSER_STORAGE:
|
|
2330
|
-
yield this.setValueToBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key, value);
|
|
2331
|
-
break;
|
|
2332
|
-
default:
|
|
2333
|
-
break;
|
|
2334
|
-
}
|
|
2335
|
-
});
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
class Condition {
|
|
2340
|
-
constructor(condition, rulesMapping) {
|
|
2341
|
-
this._condition = condition;
|
|
2342
|
-
this._rulesMapping = rulesMapping;
|
|
2343
|
-
}
|
|
2344
|
-
parseKeys(condition, rulesEvaluationMapping) {
|
|
2345
|
-
Object.keys(rulesEvaluationMapping).forEach((key) => {
|
|
2346
|
-
condition = replaceString(condition, key, rulesEvaluationMapping[key]);
|
|
2347
|
-
});
|
|
2348
|
-
return condition;
|
|
2349
|
-
}
|
|
2350
|
-
parseOperators(condition) {
|
|
2351
|
-
return condition.replace(/AND|OR|NOT|XOR|NAND|NOR|XNOR/g, (match) => {
|
|
2352
|
-
switch (match) {
|
|
2353
|
-
case "AND":
|
|
2354
|
-
return "&&";
|
|
2355
|
-
case "OR":
|
|
2356
|
-
return "||";
|
|
2357
|
-
case "NOT":
|
|
2358
|
-
return "!";
|
|
2359
|
-
case "XOR":
|
|
2360
|
-
return "^";
|
|
2361
|
-
case "NAND":
|
|
2362
|
-
return "!&";
|
|
2363
|
-
case "NOR":
|
|
2364
|
-
return "!|";
|
|
2365
|
-
case "XNOR":
|
|
2366
|
-
return "!^";
|
|
2367
|
-
default:
|
|
2368
|
-
return match;
|
|
2369
|
-
}
|
|
2370
|
-
});
|
|
2371
|
-
}
|
|
2372
|
-
evaluate() {
|
|
2373
|
-
this._condition = this.parseKeys(this._condition, this._rulesMapping);
|
|
2374
|
-
this._condition = this.parseOperators(this._condition);
|
|
2375
|
-
return eval(this._condition);
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
class Actions {
|
|
2380
|
-
constructor(action, ruleMapping, userConfig, takeAction) {
|
|
2381
|
-
this._action = action;
|
|
2382
|
-
this._userConfig = userConfig;
|
|
2383
|
-
this._ruleMapping = ruleMapping;
|
|
2384
|
-
this._takeAction = takeAction;
|
|
2385
|
-
}
|
|
2386
|
-
execute() {
|
|
2387
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2388
|
-
const condition = new Condition(this._action.condition, this._ruleMapping);
|
|
2389
|
-
const actionSuccess = condition.evaluate();
|
|
2390
|
-
if (actionSuccess) {
|
|
2391
|
-
return this._takeAction(this._action, this._userConfig);
|
|
2392
|
-
}
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
class Rules {
|
|
2398
|
-
constructor(rules, userConfig) {
|
|
2399
|
-
this._userConfig = userConfig;
|
|
2400
|
-
this._rules = rules;
|
|
2401
|
-
}
|
|
2402
|
-
evaluate(rule) {
|
|
2403
|
-
let ruleType = rule.key;
|
|
2404
|
-
let ruleEvaluationStatus = false;
|
|
2405
|
-
const source = new Sources(this._userConfig);
|
|
2406
|
-
switch (ruleType) {
|
|
2407
|
-
case ERuleKey.OBJECT_PATH_EXISTS:
|
|
2408
|
-
const ruleObjectPathExists = rule;
|
|
2409
|
-
const ruleObjectPathExistsObject = ruleObjectPathExists.props.object;
|
|
2410
|
-
const ruleObjectPathExistsPath = ruleObjectPathExists.props.path;
|
|
2411
|
-
switch (ruleObjectPathExistsObject) {
|
|
2412
|
-
case ESourceKey.USER_CONFIG:
|
|
2413
|
-
ruleEvaluationStatus = hasPath(this._userConfig, ruleObjectPathExistsPath);
|
|
2414
|
-
break;
|
|
2415
|
-
default:
|
|
2416
|
-
ruleEvaluationStatus = false;
|
|
2417
|
-
break;
|
|
2418
|
-
}
|
|
2419
|
-
break;
|
|
2420
|
-
case ERuleKey.VALUE_CHECK:
|
|
2421
|
-
const ruleValueCheck = rule;
|
|
2422
|
-
const ruleValueCheckSource = ruleValueCheck.props.value.source;
|
|
2423
|
-
const ruleValueCheckValue = source.getValueFromSource(ruleValueCheckSource);
|
|
2424
|
-
if (ruleValueCheck.props.pattern.key === EPatternKey.CUSTOM) {
|
|
2425
|
-
var re = new RegExp(ruleValueCheck.props.pattern.pattern);
|
|
2426
|
-
}
|
|
2427
|
-
else {
|
|
2428
|
-
var re = new RegExp(EPattern[ruleValueCheck.props.pattern.key]);
|
|
2429
|
-
}
|
|
2430
|
-
ruleEvaluationStatus = re.test(ruleValueCheckValue);
|
|
2431
|
-
break;
|
|
2432
|
-
case ERuleKey.VALUE_CHANGE:
|
|
2433
|
-
const ruleValueChange = rule;
|
|
2434
|
-
const ruleValueChangeCurrentSource = ruleValueChange.props.value.current.source;
|
|
2435
|
-
const ruleValueChangePreviousSource = ruleValueChange.props.value.previous.source;
|
|
2436
|
-
const previousValue = source.getValueFromSource(ruleValueChangePreviousSource);
|
|
2437
|
-
const currentValue = source.getValueFromSource(ruleValueChangeCurrentSource);
|
|
2438
|
-
ruleEvaluationStatus = previousValue === currentValue;
|
|
2439
|
-
break;
|
|
2440
|
-
default:
|
|
2441
|
-
break;
|
|
2442
|
-
}
|
|
2443
|
-
return ruleEvaluationStatus;
|
|
2444
|
-
}
|
|
2445
|
-
mapping() {
|
|
2446
|
-
let rulesEvaluationMapping = {};
|
|
2447
|
-
for (const rule of this._rules) {
|
|
2448
|
-
const ruleEvaluationStatus = this.evaluate(rule);
|
|
2449
|
-
rulesEvaluationMapping = Object.assign(Object.assign({}, rulesEvaluationMapping), { [rule.id]: ruleEvaluationStatus });
|
|
2450
|
-
}
|
|
2451
|
-
return rulesEvaluationMapping;
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
|
|
2455
|
-
class Validations {
|
|
2456
|
-
constructor(userConfig, takeAction) {
|
|
2457
|
-
this._userConfig = userConfig;
|
|
2458
|
-
this._takeAction = takeAction;
|
|
2459
|
-
}
|
|
2460
|
-
get userConfig() {
|
|
2461
|
-
return this._userConfig;
|
|
2462
|
-
}
|
|
2463
|
-
set userConfig(value) {
|
|
2464
|
-
this._userConfig = value;
|
|
2465
|
-
}
|
|
2466
|
-
validateField() {
|
|
2467
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2468
|
-
const validations = this._userConfig.userFormFieldsConfig.validation;
|
|
2469
|
-
const triggers = validations === null || validations === void 0 ? void 0 : validations.triggers;
|
|
2470
|
-
const rules = validations.rules;
|
|
2471
|
-
const actions = validations.actions;
|
|
2472
|
-
const rulesMapping = new Rules(rules, this._userConfig).mapping();
|
|
2473
|
-
for (let action of actions) {
|
|
2474
|
-
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
2475
|
-
if (conditionEvaluation) {
|
|
2476
|
-
const actions = new Actions(action, rulesMapping, this._userConfig, this._takeAction);
|
|
2477
|
-
yield actions.execute();
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
1923
|
+
}], ngOnChanges: [] } });
|
|
2483
1924
|
|
|
2484
1925
|
class Converter {
|
|
2485
1926
|
constructor() {
|
|
2486
1927
|
this.getFormFields = (formConfig) => {
|
|
2487
1928
|
let fields;
|
|
2488
|
-
if (
|
|
1929
|
+
if (checkObjectKeyExists(formConfig, "multiForm")) {
|
|
2489
1930
|
fields = formConfig.multiForm.fields;
|
|
2490
1931
|
}
|
|
2491
1932
|
else {
|
|
@@ -2494,7 +1935,7 @@ class Converter {
|
|
|
2494
1935
|
return fields;
|
|
2495
1936
|
};
|
|
2496
1937
|
this.setMissingFieldKeyValue = (field, key, value) => {
|
|
2497
|
-
if (!
|
|
1938
|
+
if (!checkObjectKeyExists(field, key)) {
|
|
2498
1939
|
field[key] = value;
|
|
2499
1940
|
}
|
|
2500
1941
|
return field;
|
|
@@ -2504,7 +1945,7 @@ class Converter {
|
|
|
2504
1945
|
return field;
|
|
2505
1946
|
};
|
|
2506
1947
|
this.removeFieldKey = (field, key) => {
|
|
2507
|
-
if (
|
|
1948
|
+
if (checkObjectKeyExists(field, key)) {
|
|
2508
1949
|
delete field[key];
|
|
2509
1950
|
}
|
|
2510
1951
|
return field;
|
|
@@ -2525,7 +1966,8 @@ class Converter {
|
|
|
2525
1966
|
return { label: x, disabled: false };
|
|
2526
1967
|
}
|
|
2527
1968
|
else {
|
|
2528
|
-
if (
|
|
1969
|
+
if (checkObjectKeyExists(x, "label") &&
|
|
1970
|
+
checkObjectKeyExists(x, "disabled")) {
|
|
2529
1971
|
return x;
|
|
2530
1972
|
}
|
|
2531
1973
|
}
|
|
@@ -2538,14 +1980,14 @@ class Converter {
|
|
|
2538
1980
|
return field;
|
|
2539
1981
|
};
|
|
2540
1982
|
const formatFieldTypeDate = (field) => {
|
|
2541
|
-
if (
|
|
1983
|
+
if (checkObjectKeyExists(field, "min")) {
|
|
2542
1984
|
const tuiDay = convertDateStringToTuiDayFormat(field["min"]);
|
|
2543
1985
|
field.properties = this.setFieldKeyValue(field.properties, "min", tuiDay);
|
|
2544
1986
|
}
|
|
2545
1987
|
else {
|
|
2546
1988
|
field.properties = this.setMissingFieldKeyValue(field.properties, "min", new TuiDay(0, 0, 1)); // Year - 0000, Month - 0 (0 Indexing), Day - 1
|
|
2547
1989
|
}
|
|
2548
|
-
if (
|
|
1990
|
+
if (checkObjectKeyExists(field, "max")) {
|
|
2549
1991
|
const tuiDay = convertDateStringToTuiDayFormat(field["max"]);
|
|
2550
1992
|
field.properties = this.setFieldKeyValue(field.properties, "max", tuiDay);
|
|
2551
1993
|
}
|
|
@@ -2555,11 +1997,12 @@ class Converter {
|
|
|
2555
1997
|
new Date().getDate() // Day - 31
|
|
2556
1998
|
));
|
|
2557
1999
|
}
|
|
2000
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "placeholder", "");
|
|
2558
2001
|
field = this.setFieldKeyValue(field, "hidden", false);
|
|
2559
2002
|
return field;
|
|
2560
2003
|
};
|
|
2561
2004
|
const formatFieldTypeNumber = (field) => {
|
|
2562
|
-
if (
|
|
2005
|
+
if (checkObjectKeyExists(field, "key")) {
|
|
2563
2006
|
if (field.key === "aadhaar_number") {
|
|
2564
2007
|
field = this.setFieldKeyValue(field, "type", "aadhaar_number");
|
|
2565
2008
|
}
|
|
@@ -2582,16 +2025,16 @@ class Converter {
|
|
|
2582
2025
|
return field;
|
|
2583
2026
|
};
|
|
2584
2027
|
const formatFieldTypeApiCall = (field) => {
|
|
2585
|
-
if (!
|
|
2028
|
+
if (!checkObjectKeyExists(field.properties, "shape")) {
|
|
2586
2029
|
field.properties = this.setFieldKeyValue(field.properties, "shape", null);
|
|
2587
2030
|
}
|
|
2588
|
-
if (!
|
|
2031
|
+
if (!checkObjectKeyExists(field, "showLoader")) {
|
|
2589
2032
|
field = this.setFieldKeyValue(field, "showLoader", false);
|
|
2590
2033
|
}
|
|
2591
|
-
if (!
|
|
2034
|
+
if (!checkObjectKeyExists(field.properties, "size")) {
|
|
2592
2035
|
field.properties = this.setFieldKeyValue(field.properties, "size", "m");
|
|
2593
2036
|
}
|
|
2594
|
-
if (!
|
|
2037
|
+
if (!checkObjectKeyExists(field, "api")) {
|
|
2595
2038
|
field = this.setFieldKeyValue(field, "api", {});
|
|
2596
2039
|
field.api = this.setMissingFieldKeyValue(field.api, "url", "");
|
|
2597
2040
|
field.api = this.setMissingFieldKeyValue(field.api, "request", "");
|
|
@@ -2608,7 +2051,7 @@ class Converter {
|
|
|
2608
2051
|
return field;
|
|
2609
2052
|
};
|
|
2610
2053
|
const formatFieldTypeSearchText = (field) => {
|
|
2611
|
-
if (
|
|
2054
|
+
if (checkObjectKeyExists(field, "type")) {
|
|
2612
2055
|
if (field.type === "search-text") {
|
|
2613
2056
|
field = this.setFieldKeyValue(field, "type", "dropdown-with-search");
|
|
2614
2057
|
}
|
|
@@ -2654,7 +2097,7 @@ class Converter {
|
|
|
2654
2097
|
return object;
|
|
2655
2098
|
};
|
|
2656
2099
|
const formatFieldKeys = (field) => {
|
|
2657
|
-
if (
|
|
2100
|
+
if (checkObjectKeyExists(field, "connectedTo")) {
|
|
2658
2101
|
if (typeof field["connectedTo"] === "string") {
|
|
2659
2102
|
field["connectedElements"] = [
|
|
2660
2103
|
getConnectedElementKeyValueObject(field["connectedTo"])
|
|
@@ -2668,7 +2111,7 @@ class Converter {
|
|
|
2668
2111
|
}
|
|
2669
2112
|
}
|
|
2670
2113
|
this.removeFieldKey(field, "connectedTo");
|
|
2671
|
-
if (
|
|
2114
|
+
if (checkObjectKeyExists(field, "connectedToParent")) {
|
|
2672
2115
|
if (typeof field["connectedToParent"] === "string") {
|
|
2673
2116
|
field["connectedParentFields"] = [
|
|
2674
2117
|
getConnectedElementKeyValueObject(field["connectedToParent"])
|
|
@@ -2684,19 +2127,19 @@ class Converter {
|
|
|
2684
2127
|
};
|
|
2685
2128
|
const getConnectedElementFieldMapping = (field, connectedFieldMapping) => {
|
|
2686
2129
|
const getConnectedElementChildFieldMapping = (field, connectedFieldMapping) => {
|
|
2687
|
-
if (
|
|
2130
|
+
if (checkObjectKeyExists(field, "connectedElements")) {
|
|
2688
2131
|
connectedFieldMapping["child"][field.key] = field.connectedElements;
|
|
2689
2132
|
}
|
|
2690
|
-
else if (
|
|
2133
|
+
else if (checkObjectKeyExists(connectedFieldMapping["child"], field.key)) {
|
|
2691
2134
|
field["connectedElements"] =
|
|
2692
2135
|
connectedFieldMapping["child"][field.key];
|
|
2693
2136
|
}
|
|
2694
2137
|
return { field: field, connectedFieldMapping: connectedFieldMapping };
|
|
2695
2138
|
};
|
|
2696
2139
|
const getConnectedElementParentFieldMapping = (field, connectedFieldMapping) => {
|
|
2697
|
-
if (
|
|
2140
|
+
if (checkObjectKeyExists(connectedFieldMapping["child"], field.key)) {
|
|
2698
2141
|
for (let connectedParentKey of connectedFieldMapping["child"][field.key]) {
|
|
2699
|
-
if (
|
|
2142
|
+
if (checkObjectKeyExists(connectedFieldMapping["parent"], connectedParentKey["key"])) {
|
|
2700
2143
|
connectedFieldMapping["parent"][connectedParentKey["key"]].push(field.key);
|
|
2701
2144
|
}
|
|
2702
2145
|
else {
|
|
@@ -2719,10 +2162,10 @@ class Converter {
|
|
|
2719
2162
|
return connectedFieldMapping;
|
|
2720
2163
|
};
|
|
2721
2164
|
const updateConnectedElementsKeyValue = (field, connectedFieldMapping) => {
|
|
2722
|
-
if (
|
|
2165
|
+
if (checkObjectKeyExists(connectedFieldMapping["child"], field.key)) {
|
|
2723
2166
|
field["connectedElements"] = connectedFieldMapping["child"][field.key];
|
|
2724
2167
|
}
|
|
2725
|
-
if (
|
|
2168
|
+
if (checkObjectKeyExists(connectedFieldMapping["parent"], field.key)) {
|
|
2726
2169
|
field["connectedParentFields"] =
|
|
2727
2170
|
connectedFieldMapping["parent"][field.key];
|
|
2728
2171
|
}
|
|
@@ -2731,45 +2174,47 @@ class Converter {
|
|
|
2731
2174
|
const updateFieldValidatorConfig = (field) => {
|
|
2732
2175
|
var _a, _b, _c, _d, _e;
|
|
2733
2176
|
if (field.type !== "title") {
|
|
2734
|
-
const validators =
|
|
2177
|
+
const validators = checkObjectKeyExists(field, "validators")
|
|
2178
|
+
? field.validators
|
|
2179
|
+
: {};
|
|
2735
2180
|
field = this.setMissingFieldKeyValue(field, "validators", {});
|
|
2736
|
-
field = this.setFieldKeyValue(field, "validators", Object.assign(Object.assign({}, field["validators"]), { min:
|
|
2737
|
-
?
|
|
2181
|
+
field = this.setFieldKeyValue(field, "validators", Object.assign(Object.assign({}, field["validators"]), { min: checkObjectKeyExists(validators, "min")
|
|
2182
|
+
? isNotEmptyValue(validators.min)
|
|
2738
2183
|
? Number(validators.min)
|
|
2739
2184
|
: null
|
|
2740
|
-
:
|
|
2185
|
+
: checkObjectKeyExists(field, "min")
|
|
2741
2186
|
? Number(field.min)
|
|
2742
|
-
: null, max:
|
|
2743
|
-
?
|
|
2187
|
+
: null, max: checkObjectKeyExists(validators, "max")
|
|
2188
|
+
? isNotEmptyValue(validators.max)
|
|
2744
2189
|
? Number(validators.max)
|
|
2745
2190
|
: null
|
|
2746
|
-
:
|
|
2191
|
+
: checkObjectKeyExists(field, "max")
|
|
2747
2192
|
? Number(field.max)
|
|
2748
|
-
: null, required:
|
|
2193
|
+
: null, required: checkObjectKeyExists(validators, "required")
|
|
2749
2194
|
? Boolean(validators.required)
|
|
2750
|
-
:
|
|
2195
|
+
: checkObjectKeyExists(field, "required")
|
|
2751
2196
|
? Boolean(field.required)
|
|
2752
|
-
: false, minLength:
|
|
2753
|
-
?
|
|
2197
|
+
: false, minLength: checkObjectKeyExists(validators, "minLength")
|
|
2198
|
+
? isNotEmptyValue(validators.minLength)
|
|
2754
2199
|
? Number(validators.minLength)
|
|
2755
2200
|
: null
|
|
2756
|
-
:
|
|
2201
|
+
: checkObjectKeyExists(field, "minLength")
|
|
2757
2202
|
? Number(field.minLength)
|
|
2758
|
-
: null, maxLength:
|
|
2759
|
-
?
|
|
2203
|
+
: null, maxLength: checkObjectKeyExists(validators, "maxLength")
|
|
2204
|
+
? isNotEmptyValue(validators.maxLength)
|
|
2760
2205
|
? Number(validators.maxLength)
|
|
2761
2206
|
: null
|
|
2762
|
-
:
|
|
2207
|
+
: checkObjectKeyExists(field, "length")
|
|
2763
2208
|
? Number(field.length)
|
|
2764
|
-
:
|
|
2209
|
+
: checkObjectKeyExists(field, "maxLength")
|
|
2765
2210
|
? Number(field.maxLength)
|
|
2766
|
-
: null, pattern:
|
|
2767
|
-
?
|
|
2211
|
+
: null, pattern: checkObjectKeyExists(validators, "pattern")
|
|
2212
|
+
? isNotEmptyValue(validators.pattern)
|
|
2768
2213
|
? validators.pattern
|
|
2769
2214
|
: undefined
|
|
2770
|
-
:
|
|
2215
|
+
: checkObjectKeyExists(field, "pattern")
|
|
2771
2216
|
? { key: "CUSTOM", pattern: String(field.pattern) }
|
|
2772
|
-
:
|
|
2217
|
+
: checkObjectKeyExists(field, "regex")
|
|
2773
2218
|
? { key: "CUSTOM", pattern: String(field.regex) }
|
|
2774
2219
|
: undefined }));
|
|
2775
2220
|
delete field.min;
|
|
@@ -2788,19 +2233,19 @@ class Converter {
|
|
|
2788
2233
|
default:
|
|
2789
2234
|
break;
|
|
2790
2235
|
}
|
|
2791
|
-
if (
|
|
2236
|
+
if (isEmptyValue((_a = field.validators) === null || _a === void 0 ? void 0 : _a.min)) {
|
|
2792
2237
|
delete field.validators.min;
|
|
2793
2238
|
}
|
|
2794
|
-
if (
|
|
2239
|
+
if (isEmptyValue((_b = field.validators) === null || _b === void 0 ? void 0 : _b.max)) {
|
|
2795
2240
|
delete field.validators.min;
|
|
2796
2241
|
}
|
|
2797
|
-
if (
|
|
2242
|
+
if (isEmptyValue((_c = field.validators) === null || _c === void 0 ? void 0 : _c.minLength)) {
|
|
2798
2243
|
delete field.validators.minLength;
|
|
2799
2244
|
}
|
|
2800
|
-
if (
|
|
2245
|
+
if (isEmptyValue((_d = field.validators) === null || _d === void 0 ? void 0 : _d.maxLength)) {
|
|
2801
2246
|
delete field.validators.maxLength;
|
|
2802
2247
|
}
|
|
2803
|
-
if (
|
|
2248
|
+
if (isEmptyValue((_e = field.validators) === null || _e === void 0 ? void 0 : _e.pattern)) {
|
|
2804
2249
|
delete field.validators.pattern;
|
|
2805
2250
|
}
|
|
2806
2251
|
field.focus = false;
|
|
@@ -2810,14 +2255,14 @@ class Converter {
|
|
|
2810
2255
|
};
|
|
2811
2256
|
const updateFieldDefaultValueConfig = (field) => {
|
|
2812
2257
|
if (field.type !== "title") {
|
|
2813
|
-
if (
|
|
2258
|
+
if (checkObjectKeyExists(field, "defaultValue")) {
|
|
2814
2259
|
return field;
|
|
2815
2260
|
}
|
|
2816
|
-
else if (
|
|
2261
|
+
else if (checkObjectKeyExists(field, "default")) {
|
|
2817
2262
|
return field;
|
|
2818
2263
|
}
|
|
2819
2264
|
else {
|
|
2820
|
-
if (
|
|
2265
|
+
if (checkObjectKeyExists(field, "defaultVal")) {
|
|
2821
2266
|
// Currently below line is commented because it caused issues in setting Default Value.
|
|
2822
2267
|
// field["defaultValue"] = field["defaultVal"];
|
|
2823
2268
|
// delete field["defaultVal"];
|
|
@@ -2862,8 +2307,8 @@ class Converter {
|
|
|
2862
2307
|
]
|
|
2863
2308
|
};
|
|
2864
2309
|
}
|
|
2865
|
-
else if (
|
|
2866
|
-
if (
|
|
2310
|
+
else if (checkObjectKeyExists(field, "autofill")) {
|
|
2311
|
+
if (checkObjectKeyExists(field.autofill, "type")) {
|
|
2867
2312
|
if (field.autofill.type === "storage") {
|
|
2868
2313
|
field["defaultValue"] = {
|
|
2869
2314
|
is_found: false,
|
|
@@ -2996,9 +2441,9 @@ class Converter {
|
|
|
2996
2441
|
};
|
|
2997
2442
|
const updateFieldResetButton = (field) => {
|
|
2998
2443
|
if (field.type === "title") {
|
|
2999
|
-
if (
|
|
2444
|
+
if (checkObjectKeyExists(field, "action") &&
|
|
3000
2445
|
field.action === "reset" &&
|
|
3001
|
-
|
|
2446
|
+
checkObjectKeyExists(field, "fields")) {
|
|
3002
2447
|
field = this.setFieldKeyValue(field, "reset", {
|
|
3003
2448
|
fields: field.fields
|
|
3004
2449
|
});
|
|
@@ -3007,7 +2452,7 @@ class Converter {
|
|
|
3007
2452
|
return field;
|
|
3008
2453
|
};
|
|
3009
2454
|
const setFormFields = (formConfig, fields) => {
|
|
3010
|
-
if (
|
|
2455
|
+
if (checkObjectKeyExists(formConfig, "multiForm")) {
|
|
3011
2456
|
formConfig.multiForm["fields"] = fields;
|
|
3012
2457
|
}
|
|
3013
2458
|
else {
|
|
@@ -3020,8 +2465,8 @@ class Converter {
|
|
|
3020
2465
|
return formConfig;
|
|
3021
2466
|
};
|
|
3022
2467
|
const updateFormFieldGroups = (fieldGroups, field) => {
|
|
3023
|
-
if (
|
|
3024
|
-
if (
|
|
2468
|
+
if (checkObjectKeyExists(field, "groupKey")) {
|
|
2469
|
+
if (checkObjectKeyExists(fieldGroups, field.groupKey)) {
|
|
3025
2470
|
fieldGroups[field.groupKey].push(field.key);
|
|
3026
2471
|
}
|
|
3027
2472
|
else {
|
|
@@ -3056,7 +2501,7 @@ class Converter {
|
|
|
3056
2501
|
}
|
|
3057
2502
|
}
|
|
3058
2503
|
__decorate([
|
|
3059
|
-
|
|
2504
|
+
logMethod
|
|
3060
2505
|
], Converter.prototype, "convertFormConfig", null);
|
|
3061
2506
|
|
|
3062
2507
|
class KwikIDRendererService {
|
|
@@ -3108,6 +2553,7 @@ class KwikIDRendererService {
|
|
|
3108
2553
|
markFormInFormsListAsCompleted(formsList, formsListCompleted) {
|
|
3109
2554
|
for (let form of formsList) {
|
|
3110
2555
|
if (formsListCompleted.includes(form.key)) {
|
|
2556
|
+
console.log(formsListCompleted.includes(form.key));
|
|
3111
2557
|
form = setValueToObject(form, "status", "completed");
|
|
3112
2558
|
form = setValueToObject(form, "disabled", false);
|
|
3113
2559
|
}
|
|
@@ -3117,7 +2563,7 @@ class KwikIDRendererService {
|
|
|
3117
2563
|
markFormInFormsListAsDisabled(formsList, formsListCompleted) {
|
|
3118
2564
|
for (let form of formsList) {
|
|
3119
2565
|
if (form.status !== "completed") {
|
|
3120
|
-
if (
|
|
2566
|
+
if (checkObjectKeyExists(form, "dependentOn")) {
|
|
3121
2567
|
const isDependent = form.dependentOn.every((r) => formsListCompleted.includes(r));
|
|
3122
2568
|
if (isDependent) {
|
|
3123
2569
|
form = setValueToObject(form, "status", "editable");
|
|
@@ -3147,7 +2593,7 @@ class KwikIDRendererService {
|
|
|
3147
2593
|
filterAllFormsData(allFormsData, formsList) {
|
|
3148
2594
|
let currentUserFormAllFormsData = {};
|
|
3149
2595
|
for (let form of formsList) {
|
|
3150
|
-
if (
|
|
2596
|
+
if (checkObjectKeyExists(allFormsData, form.key)) {
|
|
3151
2597
|
currentUserFormAllFormsData = Object.assign(Object.assign({}, currentUserFormAllFormsData), { [form.key]: allFormsData[form.key] });
|
|
3152
2598
|
}
|
|
3153
2599
|
}
|
|
@@ -3165,6 +2611,7 @@ class KwikIDRendererService {
|
|
|
3165
2611
|
* this particular User Form only has to LOCAL METHOD Variable.
|
|
3166
2612
|
*/
|
|
3167
2613
|
const currentUserFormAllFormsData = this.filterAllFormsData(this.allFormsData, formsList);
|
|
2614
|
+
console.log(JSON.parse(JSON.stringify(formsList)));
|
|
3168
2615
|
formsListCompleted = this.findCompletedFormsList(currentUserFormAllFormsData);
|
|
3169
2616
|
formsList = this.markFormInFormsListAsCompleted(formsList, formsListCompleted);
|
|
3170
2617
|
formsList = this.markFormInFormsListAsDisabled(formsList, formsListCompleted);
|
|
@@ -3178,12 +2625,51 @@ class KwikIDRendererService {
|
|
|
3178
2625
|
}
|
|
3179
2626
|
/** @nocollapse */ KwikIDRendererService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDRendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3180
2627
|
/** @nocollapse */ KwikIDRendererService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDRendererService, providedIn: "root" });
|
|
2628
|
+
__decorate([
|
|
2629
|
+
logMethod
|
|
2630
|
+
], KwikIDRendererService.prototype, "setFormsList", null);
|
|
2631
|
+
__decorate([
|
|
2632
|
+
logMethod
|
|
2633
|
+
], KwikIDRendererService.prototype, "setFormsListCompleted", null);
|
|
2634
|
+
__decorate([
|
|
2635
|
+
logMethod
|
|
2636
|
+
], KwikIDRendererService.prototype, "setAllFormsData", null);
|
|
2637
|
+
__decorate([
|
|
2638
|
+
logMethod
|
|
2639
|
+
], KwikIDRendererService.prototype, "setActiveFormConfig", null);
|
|
2640
|
+
__decorate([
|
|
2641
|
+
logMethod
|
|
2642
|
+
], KwikIDRendererService.prototype, "setActiveFormFields", null);
|
|
2643
|
+
__decorate([
|
|
2644
|
+
logMethod
|
|
2645
|
+
], KwikIDRendererService.prototype, "setActiveFormData", null);
|
|
2646
|
+
__decorate([
|
|
2647
|
+
logMethod
|
|
2648
|
+
], KwikIDRendererService.prototype, "findActiveFormConfig", null);
|
|
2649
|
+
__decorate([
|
|
2650
|
+
logMethod
|
|
2651
|
+
], KwikIDRendererService.prototype, "findCompletedFormsList", null);
|
|
2652
|
+
__decorate([
|
|
2653
|
+
logMethod
|
|
2654
|
+
], KwikIDRendererService.prototype, "markFormInFormsListAsCompleted", null);
|
|
2655
|
+
__decorate([
|
|
2656
|
+
logMethod
|
|
2657
|
+
], KwikIDRendererService.prototype, "markFormInFormsListAsDisabled", null);
|
|
2658
|
+
__decorate([
|
|
2659
|
+
logMethod
|
|
2660
|
+
], KwikIDRendererService.prototype, "assignSequenceNoToForm", null);
|
|
2661
|
+
__decorate([
|
|
2662
|
+
logMethod
|
|
2663
|
+
], KwikIDRendererService.prototype, "filterAllFormsData", null);
|
|
2664
|
+
__decorate([
|
|
2665
|
+
logMethod
|
|
2666
|
+
], KwikIDRendererService.prototype, "updateFormsList", null);
|
|
3181
2667
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDRendererService, decorators: [{
|
|
3182
2668
|
type: Injectable,
|
|
3183
2669
|
args: [{
|
|
3184
2670
|
providedIn: "root"
|
|
3185
2671
|
}]
|
|
3186
|
-
}], ctorParameters: function () { return []; } });
|
|
2672
|
+
}], ctorParameters: function () { return []; }, propDecorators: { setFormsList: [], setFormsListCompleted: [], setAllFormsData: [], setActiveFormConfig: [], setActiveFormFields: [], setActiveFormData: [], findActiveFormConfig: [], findCompletedFormsList: [], markFormInFormsListAsCompleted: [], markFormInFormsListAsDisabled: [], assignSequenceNoToForm: [], filterAllFormsData: [], updateFormsList: [] } });
|
|
3187
2673
|
|
|
3188
2674
|
class KwikIDFormsRendererComponent {
|
|
3189
2675
|
constructor(rendererService, hostElement) {
|
|
@@ -3255,6 +2741,7 @@ class KwikIDFormsRendererComponent {
|
|
|
3255
2741
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3256
2742
|
this.loader = true;
|
|
3257
2743
|
this.rendererService.setAllFormsData(this.formsData);
|
|
2744
|
+
console.log(JSON.parse(JSON.stringify(this.rendererService.formsList)));
|
|
3258
2745
|
this.rendererService.updateFormsList();
|
|
3259
2746
|
this.handleResize(this.rendererService.formsList);
|
|
3260
2747
|
if (this.rendererService.formsList.length !==
|
|
@@ -3319,9 +2806,12 @@ class KwikIDFormsRendererComponent {
|
|
|
3319
2806
|
handleOnClickSubmitForms(e) {
|
|
3320
2807
|
console.log(e);
|
|
3321
2808
|
if (this.userConfig.userFormFieldsConfig.validation) {
|
|
3322
|
-
const validations = new Validations(
|
|
2809
|
+
const validations = new Validations$1({
|
|
2810
|
+
USER_CONFIG: this.userConfig,
|
|
2811
|
+
ALL_FORMS_DATA: this.formsData
|
|
2812
|
+
}, this.takeAction.bind(this));
|
|
3323
2813
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3324
|
-
yield validations.
|
|
2814
|
+
yield validations.validate(this.userConfig.userFormFieldsConfig.validation);
|
|
3325
2815
|
if (this.userConfig.userFormFieldsConfig.status === "completed") {
|
|
3326
2816
|
this.onClickSubmit.emit(e);
|
|
3327
2817
|
}
|
|
@@ -3363,14 +2853,18 @@ class KwikIDFormsRendererComponent {
|
|
|
3363
2853
|
toggleErrorNotification(show) {
|
|
3364
2854
|
this.showErrorNotification = show;
|
|
3365
2855
|
}
|
|
3366
|
-
takeAction(action, userConfig) {
|
|
2856
|
+
takeAction(action, userConfig, formsData) {
|
|
3367
2857
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3368
2858
|
switch (action.key) {
|
|
3369
2859
|
case EActionKey.SET_VALUE:
|
|
3370
|
-
const sources = new Sources(
|
|
2860
|
+
const sources = new Sources({
|
|
2861
|
+
USER_CONFIG: this.userConfig,
|
|
2862
|
+
ALL_FORMS_DATA: this.formsData
|
|
2863
|
+
});
|
|
3371
2864
|
const sourceValue = yield sources.getValueFromSource(action.props.value.source);
|
|
3372
2865
|
sources.setValueToSource(action.props.value.destination, sourceValue);
|
|
3373
|
-
this.userConfig = sources.
|
|
2866
|
+
this.userConfig = sources.object.USER_CONFIG;
|
|
2867
|
+
this.formsData = sources.object.ALL_FORMS_DATA;
|
|
3374
2868
|
break;
|
|
3375
2869
|
default:
|
|
3376
2870
|
break;
|
|
@@ -3390,6 +2884,9 @@ class KwikIDFormsRendererComponent {
|
|
|
3390
2884
|
])
|
|
3391
2885
|
])
|
|
3392
2886
|
] });
|
|
2887
|
+
__decorate([
|
|
2888
|
+
logMethod
|
|
2889
|
+
], KwikIDFormsRendererComponent.prototype, "handleOnClickSetActiveForm", null);
|
|
3393
2890
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsRendererComponent, decorators: [{
|
|
3394
2891
|
type: Component,
|
|
3395
2892
|
args: [{
|
|
@@ -3424,7 +2921,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3424
2921
|
type: Output
|
|
3425
2922
|
}], onClickApiCall: [{
|
|
3426
2923
|
type: Output
|
|
3427
|
-
}] } });
|
|
2924
|
+
}], handleOnClickSetActiveForm: [] } });
|
|
3428
2925
|
|
|
3429
2926
|
class KwikIDFormBuilderModule {
|
|
3430
2927
|
}
|