kwikid-forms 0.0.5 → 0.0.7
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 +570 -188
- 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.enum.definitions.js +2 -1
- package/esm2015/lib/renderer/form-view/definitions/sources/form-view.sources.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/form-view.component.js +31 -12
- package/esm2015/lib/renderer/form-view/form-view.module.js +9 -2
- package/esm2015/lib/renderer/form-view/form-view.service.js +3 -2
- package/esm2015/lib/renderer/form-view/helpers/form-view.fields.helper.js +38 -49
- package/esm2015/lib/renderer/helpers/renderer.actions.helper.js +20 -0
- package/esm2015/lib/renderer/helpers/renderer.condition.helper.js +41 -0
- package/esm2015/lib/renderer/helpers/renderer.rules.helper.js +63 -0
- package/esm2015/lib/renderer/helpers/renderer.sources.helper.js +91 -0
- package/esm2015/lib/renderer/helpers/renderer.validations.helper.js +33 -0
- package/esm2015/lib/renderer/renderer.component.js +50 -4
- package/esm2015/lib/renderer/renderer.config-converter.helper.js +16 -18
- package/esm2015/lib/renderer/renderer.module.js +15 -4
- package/fesm2015/kwikid-forms.js +422 -127
- 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 -1
- package/lib/renderer/form-view/definitions/sources/form-view.sources.enum.definitions.d.ts +1 -0
- package/lib/renderer/form-view/definitions/sources/form-view.sources.type.definitions.d.ts +1 -1
- package/lib/renderer/form-view/form-view.component.d.ts +7 -2
- package/lib/renderer/form-view/form-view.module.d.ts +3 -2
- package/lib/renderer/form-view/helpers/form-view.fields.helper.d.ts +4 -3
- package/lib/renderer/helpers/renderer.actions.helper.d.ts +8 -0
- package/lib/renderer/helpers/renderer.condition.helper.d.ts +8 -0
- package/lib/renderer/helpers/renderer.rules.helper.d.ts +8 -0
- package/lib/renderer/helpers/renderer.sources.helper.d.ts +13 -0
- package/lib/renderer/helpers/renderer.validations.helper.d.ts +8 -0
- package/lib/renderer/renderer.component.d.ts +4 -0
- package/lib/renderer/renderer.module.d.ts +3 -1
- package/package.json +1 -1
package/fesm2015/kwikid-forms.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { copyArrayItem, moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { VERSION, Component, EventEmitter, Input, Output, Injectable, HostListener, NgModule } from '@angular/core';
|
|
4
|
-
import * as
|
|
3
|
+
import { VERSION, Component, EventEmitter, Inject, Input, Output, Injectable, HostListener, NgModule } from '@angular/core';
|
|
4
|
+
import * as i6 from '@angular/forms';
|
|
5
5
|
import { FormGroup, FormControl, Validators, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
6
|
import * as i2 from 'kwikui';
|
|
7
7
|
import { KwikUIButtonComponent, KwikUIProgressSegmentedComponent, KwikUIInputComponent, KwikUIModule } from 'kwikui';
|
|
8
8
|
import _, { cloneDeep } from 'lodash';
|
|
9
9
|
import { __decorate, __awaiter } from 'tslib';
|
|
10
|
+
import * as i3 from '@taiga-ui/core';
|
|
11
|
+
import { TuiAlertService, TuiLabelModule, TuiSvgModule, TuiLoaderModule } from '@taiga-ui/core';
|
|
12
|
+
import * as i4 from '@taiga-ui/kit';
|
|
13
|
+
import { TuiPushService, TuiPushModule } from '@taiga-ui/kit';
|
|
10
14
|
import { pairwise } from 'rxjs/operators';
|
|
11
15
|
import jp from 'jsonpath';
|
|
12
16
|
import { TuiDay } from '@taiga-ui/cdk';
|
|
13
|
-
import * as
|
|
14
|
-
import { TuiLabelModule, TuiSvgModule } from '@taiga-ui/core';
|
|
15
|
-
import * as i4 from '@angular/common';
|
|
17
|
+
import * as i5 from '@angular/common';
|
|
16
18
|
import { CommonModule } from '@angular/common';
|
|
17
19
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
18
20
|
import { HttpClientModule } from '@angular/common/http';
|
|
@@ -563,7 +565,7 @@ const setEmptyValue = (field) => {
|
|
|
563
565
|
return value;
|
|
564
566
|
};
|
|
565
567
|
|
|
566
|
-
class Condition {
|
|
568
|
+
class Condition$1 {
|
|
567
569
|
constructor(condition, rulesMapping) {
|
|
568
570
|
this._condition = condition;
|
|
569
571
|
this._rulesMapping = rulesMapping;
|
|
@@ -604,9 +606,9 @@ class Condition {
|
|
|
604
606
|
}
|
|
605
607
|
__decorate([
|
|
606
608
|
log
|
|
607
|
-
], Condition.prototype, "evaluate", null);
|
|
609
|
+
], Condition$1.prototype, "evaluate", null);
|
|
608
610
|
|
|
609
|
-
class Actions {
|
|
611
|
+
class Actions$1 {
|
|
610
612
|
constructor(action, field, ruleMapping, allFormsData, formData, previousFormData, takeAction) {
|
|
611
613
|
this._action = action;
|
|
612
614
|
this._field = field;
|
|
@@ -618,7 +620,7 @@ class Actions {
|
|
|
618
620
|
}
|
|
619
621
|
execute() {
|
|
620
622
|
return __awaiter(this, void 0, void 0, function* () {
|
|
621
|
-
const condition = new Condition(this._action.condition, this._ruleMapping);
|
|
623
|
+
const condition = new Condition$1(this._action.condition, this._ruleMapping);
|
|
622
624
|
const actionSuccess = condition.evaluate();
|
|
623
625
|
if (actionSuccess) {
|
|
624
626
|
return this._takeAction(this._action, this._field, this._allFormsData, this._formData, this._previousFormData);
|
|
@@ -628,7 +630,7 @@ class Actions {
|
|
|
628
630
|
}
|
|
629
631
|
__decorate([
|
|
630
632
|
log
|
|
631
|
-
], Actions.prototype, "execute", null);
|
|
633
|
+
], Actions$1.prototype, "execute", null);
|
|
632
634
|
|
|
633
635
|
var ERuleKey;
|
|
634
636
|
(function (ERuleKey) {
|
|
@@ -645,6 +647,7 @@ var ESourceKey;
|
|
|
645
647
|
ESourceKey["ALL_FORMS_DATA"] = "ALL_FORMS_DATA";
|
|
646
648
|
ESourceKey["BROWSER_STORAGE"] = "BROWSER_STORAGE";
|
|
647
649
|
ESourceKey["PREDEFINED"] = "PREDEFINED";
|
|
650
|
+
ESourceKey["USER_CONFIG"] = "USER_CONFIG";
|
|
648
651
|
ESourceKey["CUSTOM"] = "CUSTOM";
|
|
649
652
|
})(ESourceKey || (ESourceKey = {}));
|
|
650
653
|
var EBrowserStorageType;
|
|
@@ -653,7 +656,7 @@ var EBrowserStorageType;
|
|
|
653
656
|
EBrowserStorageType["SESSION_STORAGE"] = "SESSION_STORAGE";
|
|
654
657
|
})(EBrowserStorageType || (EBrowserStorageType = {}));
|
|
655
658
|
|
|
656
|
-
class Sources {
|
|
659
|
+
class Sources$1 {
|
|
657
660
|
constructor(field, formData, previousFormData, allFormsData) {
|
|
658
661
|
this._field = field;
|
|
659
662
|
this._formData = formData;
|
|
@@ -805,12 +808,12 @@ class Sources {
|
|
|
805
808
|
}
|
|
806
809
|
__decorate([
|
|
807
810
|
log
|
|
808
|
-
], Sources.prototype, "getValueFromSource", null);
|
|
811
|
+
], Sources$1.prototype, "getValueFromSource", null);
|
|
809
812
|
__decorate([
|
|
810
813
|
log
|
|
811
|
-
], Sources.prototype, "setValueToSource", null);
|
|
814
|
+
], Sources$1.prototype, "setValueToSource", null);
|
|
812
815
|
|
|
813
|
-
class Rules {
|
|
816
|
+
class Rules$1 {
|
|
814
817
|
constructor(rules, field, formData, previousFormData, allFormsData) {
|
|
815
818
|
this._field = field;
|
|
816
819
|
this._formData = formData;
|
|
@@ -824,7 +827,7 @@ class Rules {
|
|
|
824
827
|
if (this._field.type === "radio") {
|
|
825
828
|
this._formData[this._field.key] = this._formData[this._field.key].label;
|
|
826
829
|
}
|
|
827
|
-
const source = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
830
|
+
const source = new Sources$1(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
828
831
|
switch (ruleType) {
|
|
829
832
|
case ERuleKey.OBJECT_PATH_EXISTS:
|
|
830
833
|
const ruleObjectPathExists = rule;
|
|
@@ -884,10 +887,10 @@ class Rules {
|
|
|
884
887
|
}
|
|
885
888
|
__decorate([
|
|
886
889
|
log
|
|
887
|
-
], Rules.prototype, "evaluate", null);
|
|
890
|
+
], Rules$1.prototype, "evaluate", null);
|
|
888
891
|
__decorate([
|
|
889
892
|
log
|
|
890
|
-
], Rules.prototype, "mapping", null);
|
|
893
|
+
], Rules$1.prototype, "mapping", null);
|
|
891
894
|
|
|
892
895
|
class Defaults {
|
|
893
896
|
constructor(field, allFormsData, formData, previousFormData, takeAction) {
|
|
@@ -903,7 +906,7 @@ class Defaults {
|
|
|
903
906
|
const sources = this._field.default.value.sources;
|
|
904
907
|
let sourceIndex = 0;
|
|
905
908
|
for (let source of sources) {
|
|
906
|
-
const sources = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
909
|
+
const sources = new Sources$1(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
907
910
|
const value = sources.getValueFromSource(source);
|
|
908
911
|
// Set the Value of current source.
|
|
909
912
|
this._field = setValueToObject(this._field, `default.value.sources.[${sourceIndex}].value`, value);
|
|
@@ -911,11 +914,11 @@ class Defaults {
|
|
|
911
914
|
const triggers = validation.triggers;
|
|
912
915
|
const rules = validation.rules;
|
|
913
916
|
const actions = validation.actions;
|
|
914
|
-
const rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
917
|
+
const rulesMapping = new Rules$1(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
915
918
|
for (let action of actions) {
|
|
916
|
-
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
919
|
+
const conditionEvaluation = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
917
920
|
if (conditionEvaluation) {
|
|
918
|
-
const actions = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
921
|
+
const actions = new Actions$1(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
919
922
|
yield actions.execute();
|
|
920
923
|
}
|
|
921
924
|
}
|
|
@@ -979,14 +982,6 @@ const getSearchTextOptionsFromFieldConfig = (field, childField, formGroup) => {
|
|
|
979
982
|
const formatSearchTextOptions = (options) => {
|
|
980
983
|
return options.map(({ title }) => title);
|
|
981
984
|
};
|
|
982
|
-
const formatDateToStandardFormat = (date) => {
|
|
983
|
-
let formattedDate;
|
|
984
|
-
let year = date.year;
|
|
985
|
-
let month = date.month;
|
|
986
|
-
let day = date.day;
|
|
987
|
-
formattedDate = `${day}-${month + 1}-${year}`;
|
|
988
|
-
return formattedDate;
|
|
989
|
-
};
|
|
990
985
|
function highlightFieldError(field, error) {
|
|
991
986
|
field.invalid = error;
|
|
992
987
|
field.focus = error;
|
|
@@ -1082,19 +1077,29 @@ function setFieldError(fields, errors, key, error) {
|
|
|
1082
1077
|
fields[fieldIndex] = highlightFieldError(fields[fieldIndex], error);
|
|
1083
1078
|
return fields;
|
|
1084
1079
|
}
|
|
1085
|
-
const
|
|
1080
|
+
const convertDateStringToTuiDayFormat = (date) => {
|
|
1081
|
+
const splitDate = date.split("-");
|
|
1082
|
+
const tuiDay = new TuiDay(Number(splitDate[2]), // Year
|
|
1083
|
+
Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
|
|
1084
|
+
Number(splitDate[0]) // Day
|
|
1085
|
+
);
|
|
1086
|
+
return tuiDay;
|
|
1087
|
+
};
|
|
1088
|
+
const convertTuiDayFormatToDateString = (date) => {
|
|
1089
|
+
let formattedDate;
|
|
1090
|
+
let year = date.year;
|
|
1091
|
+
let month = date.month;
|
|
1092
|
+
let day = date.day;
|
|
1093
|
+
formattedDate = `${day.toString().padStart(2, "0")}-${(month + 1)
|
|
1094
|
+
.toString()
|
|
1095
|
+
.padStart(2, "0")}-${year}`;
|
|
1096
|
+
return formattedDate;
|
|
1097
|
+
};
|
|
1098
|
+
const convertValueFromKwikUIFormatToBasicFormat = (field, value) => {
|
|
1086
1099
|
let convertedValue = value;
|
|
1087
|
-
switch (type) {
|
|
1100
|
+
switch (field.type) {
|
|
1088
1101
|
case EFieldType.DATE:
|
|
1089
|
-
|
|
1090
|
-
const splitDate = date.split("-");
|
|
1091
|
-
const tuiDay = new TuiDay(Number(splitDate[2]), // Year
|
|
1092
|
-
Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
|
|
1093
|
-
Number(splitDate[0]) // Day
|
|
1094
|
-
);
|
|
1095
|
-
return tuiDay;
|
|
1096
|
-
};
|
|
1097
|
-
convertedValue = convertDateStringToTuiDayFormat(value);
|
|
1102
|
+
convertedValue = convertTuiDayFormatToDateString(value);
|
|
1098
1103
|
break;
|
|
1099
1104
|
default:
|
|
1100
1105
|
break;
|
|
@@ -1103,39 +1108,26 @@ const convertValueFromKwikUIFormatToBasicFormat = (type, value) => {
|
|
|
1103
1108
|
};
|
|
1104
1109
|
const convertValueFromBasicFormatToKwikUIFormat = (field, value) => {
|
|
1105
1110
|
let convertedValue = value;
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1122
|
-
break;
|
|
1123
|
-
case EFieldType.PHONE:
|
|
1124
|
-
let fieldPhone = field;
|
|
1125
|
-
convertedValue = value.replace(String(fieldPhone.properties.countryCode), "");
|
|
1126
|
-
break;
|
|
1127
|
-
case EFieldType.TITLE:
|
|
1128
|
-
break;
|
|
1129
|
-
default:
|
|
1130
|
-
if (isEmpty(value)) {
|
|
1131
|
-
convertedValue = "";
|
|
1132
|
-
}
|
|
1133
|
-
break;
|
|
1111
|
+
if (isNotEmpty(value)) {
|
|
1112
|
+
switch (field.type) {
|
|
1113
|
+
case EFieldType.RADIO:
|
|
1114
|
+
if (hasKey$1(value, "label")) {
|
|
1115
|
+
convertedValue = value.label;
|
|
1116
|
+
}
|
|
1117
|
+
break;
|
|
1118
|
+
case EFieldType.DATE:
|
|
1119
|
+
convertedValue = convertDateStringToTuiDayFormat(value);
|
|
1120
|
+
break;
|
|
1121
|
+
case EFieldType.TITLE:
|
|
1122
|
+
break;
|
|
1123
|
+
default:
|
|
1124
|
+
break;
|
|
1125
|
+
}
|
|
1134
1126
|
}
|
|
1135
1127
|
return convertedValue;
|
|
1136
1128
|
};
|
|
1137
1129
|
|
|
1138
|
-
class Validations {
|
|
1130
|
+
class Validations$1 {
|
|
1139
1131
|
constructor(field, formData, previousFormData, allFormsData, takeAction) {
|
|
1140
1132
|
this._field = field;
|
|
1141
1133
|
this._formData = formData;
|
|
@@ -1256,11 +1248,11 @@ class Validations {
|
|
|
1256
1248
|
const triggers = validations.triggers;
|
|
1257
1249
|
const rules = validations.rules;
|
|
1258
1250
|
const actions = validations.actions;
|
|
1259
|
-
const rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1251
|
+
const rulesMapping = new Rules$1(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1260
1252
|
for (let action of actions) {
|
|
1261
|
-
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
1253
|
+
const conditionEvaluation = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
1262
1254
|
if (conditionEvaluation) {
|
|
1263
|
-
const actions = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1255
|
+
const actions = new Actions$1(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1264
1256
|
yield actions.execute();
|
|
1265
1257
|
}
|
|
1266
1258
|
}
|
|
@@ -1269,16 +1261,16 @@ class Validations {
|
|
|
1269
1261
|
}
|
|
1270
1262
|
__decorate([
|
|
1271
1263
|
log
|
|
1272
|
-
], Validations.prototype, "getFieldValidators", null);
|
|
1264
|
+
], Validations$1.prototype, "getFieldValidators", null);
|
|
1273
1265
|
__decorate([
|
|
1274
1266
|
log
|
|
1275
|
-
], Validations.prototype, "getFormValidationErrors", null);
|
|
1267
|
+
], Validations$1.prototype, "getFormValidationErrors", null);
|
|
1276
1268
|
__decorate([
|
|
1277
1269
|
log
|
|
1278
|
-
], Validations.prototype, "findInvalidControlsRecursive", null);
|
|
1270
|
+
], Validations$1.prototype, "findInvalidControlsRecursive", null);
|
|
1279
1271
|
__decorate([
|
|
1280
1272
|
log
|
|
1281
|
-
], Validations.prototype, "validateField", null);
|
|
1273
|
+
], Validations$1.prototype, "validateField", null);
|
|
1282
1274
|
|
|
1283
1275
|
class KwikIDFormViewService {
|
|
1284
1276
|
constructor() { }
|
|
@@ -1289,8 +1281,9 @@ class KwikIDFormViewService {
|
|
|
1289
1281
|
for (let field of fields) {
|
|
1290
1282
|
if (field.type !== "title") {
|
|
1291
1283
|
const defaults = new Defaults(field, allFormsData, formData, previousFormData, takeAction);
|
|
1292
|
-
|
|
1293
|
-
|
|
1284
|
+
let value = yield defaults.getDefaultValue();
|
|
1285
|
+
value = convertValueFromBasicFormatToKwikUIFormat(field, value);
|
|
1286
|
+
const validators = new Validations$1(field, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
|
|
1294
1287
|
formGroup.addControl(field.key, new FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
|
|
1295
1288
|
}
|
|
1296
1289
|
}
|
|
@@ -1323,7 +1316,7 @@ class Apis {
|
|
|
1323
1316
|
let sources = param.sources;
|
|
1324
1317
|
let sourceIndex = 0;
|
|
1325
1318
|
for (let source of sources) {
|
|
1326
|
-
const sources = new Sources(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
1319
|
+
const sources = new Sources$1(this._field, this._formData, this._previousFormData, this._allFormsData);
|
|
1327
1320
|
const value = sources.getValueFromSource(source);
|
|
1328
1321
|
// Set the Value of current source.
|
|
1329
1322
|
this._field = setValueToObject(this._field, `api.request.body.params[${paramIndex}].sources[${sourceIndex}].value`, value);
|
|
@@ -1331,11 +1324,11 @@ class Apis {
|
|
|
1331
1324
|
const triggers = (_a = validation === null || validation === void 0 ? void 0 : validation.triggers) !== null && _a !== void 0 ? _a : [];
|
|
1332
1325
|
const rules = (_b = validation === null || validation === void 0 ? void 0 : validation.rules) !== null && _b !== void 0 ? _b : [];
|
|
1333
1326
|
const actions = (_c = validation === null || validation === void 0 ? void 0 : validation.actions) !== null && _c !== void 0 ? _c : [];
|
|
1334
|
-
const rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1327
|
+
const rulesMapping = new Rules$1(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1335
1328
|
for (let action of actions) {
|
|
1336
|
-
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
1329
|
+
const conditionEvaluation = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
1337
1330
|
if (conditionEvaluation) {
|
|
1338
|
-
const actions = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1331
|
+
const actions = new Actions$1(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1339
1332
|
yield actions.execute();
|
|
1340
1333
|
}
|
|
1341
1334
|
}
|
|
@@ -1353,11 +1346,11 @@ class Apis {
|
|
|
1353
1346
|
const triggers = validation.triggers;
|
|
1354
1347
|
const rules = validation.rules;
|
|
1355
1348
|
const actions = validation.actions;
|
|
1356
|
-
const rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1349
|
+
const rulesMapping = new Rules$1(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1357
1350
|
for (let action of actions) {
|
|
1358
|
-
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1351
|
+
const conditionSuccess = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
1359
1352
|
if (conditionSuccess) {
|
|
1360
|
-
const actions = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1353
|
+
const actions = new Actions$1(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1361
1354
|
yield actions.execute();
|
|
1362
1355
|
}
|
|
1363
1356
|
}
|
|
@@ -1370,11 +1363,11 @@ class Apis {
|
|
|
1370
1363
|
const triggers = validation.triggers;
|
|
1371
1364
|
const rules = validation.rules;
|
|
1372
1365
|
const actions = validation.actions;
|
|
1373
|
-
const rulesMapping = new Rules(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1366
|
+
const rulesMapping = new Rules$1(rules, this._field, this._formData, this._previousFormData, this._allFormsData).mapping();
|
|
1374
1367
|
for (let action of actions) {
|
|
1375
|
-
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1368
|
+
const conditionSuccess = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
1376
1369
|
if (conditionSuccess) {
|
|
1377
|
-
const actions = new Actions(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1370
|
+
const actions = new Actions$1(action, this._field, rulesMapping, this._allFormsData, this._formData, this._previousFormData, this._takeAction);
|
|
1378
1371
|
yield actions.execute();
|
|
1379
1372
|
}
|
|
1380
1373
|
}
|
|
@@ -1401,9 +1394,10 @@ __decorate([
|
|
|
1401
1394
|
], Apis.prototype, "validateApiCallResponse", null);
|
|
1402
1395
|
|
|
1403
1396
|
class KwikIDFormViewComponent {
|
|
1404
|
-
constructor(formViewService) {
|
|
1397
|
+
constructor(push, alert, formViewService) {
|
|
1398
|
+
this.push = push;
|
|
1399
|
+
this.alert = alert;
|
|
1405
1400
|
this.formViewService = formViewService;
|
|
1406
|
-
this.componentThis = this;
|
|
1407
1401
|
this.apiCallResponse = {};
|
|
1408
1402
|
this.isMobileView = false;
|
|
1409
1403
|
this.onClickViewForms = new EventEmitter();
|
|
@@ -1422,6 +1416,7 @@ class KwikIDFormViewComponent {
|
|
|
1422
1416
|
showLoader: false
|
|
1423
1417
|
};
|
|
1424
1418
|
this.formGroup = new FormGroup({});
|
|
1419
|
+
this.showErrorNotification = false;
|
|
1425
1420
|
}
|
|
1426
1421
|
ngOnInit() {
|
|
1427
1422
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1513,11 +1508,11 @@ class KwikIDFormViewComponent {
|
|
|
1513
1508
|
handleConnectedElementFieldActions(connectedFieldConfig, connectedField) {
|
|
1514
1509
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1515
1510
|
if (hasKey$1(connectedFieldConfig, "rules")) {
|
|
1516
|
-
const rulesMapping = new Rules(connectedFieldConfig.rules, connectedField, this.formData, this.previousFormData, this.allFormsData).mapping();
|
|
1511
|
+
const rulesMapping = new Rules$1(connectedFieldConfig.rules, connectedField, this.formData, this.previousFormData, this.allFormsData).mapping();
|
|
1517
1512
|
for (let action of connectedFieldConfig.actions) {
|
|
1518
|
-
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1513
|
+
const conditionSuccess = new Condition$1(action.condition, rulesMapping).evaluate();
|
|
1519
1514
|
if (conditionSuccess) {
|
|
1520
|
-
const actions = new Actions(action, connectedField, rulesMapping, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
|
|
1515
|
+
const actions = new Actions$1(action, connectedField, rulesMapping, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
|
|
1521
1516
|
yield actions.execute();
|
|
1522
1517
|
}
|
|
1523
1518
|
}
|
|
@@ -1597,7 +1592,7 @@ class KwikIDFormViewComponent {
|
|
|
1597
1592
|
let field = findFieldFromKey(this.formFields, e.key);
|
|
1598
1593
|
if (field.type !== "title" &&
|
|
1599
1594
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
1600
|
-
const validations = new Validations(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1595
|
+
const validations = new Validations$1(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1601
1596
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1602
1597
|
yield validations.validateField();
|
|
1603
1598
|
}))();
|
|
@@ -1612,7 +1607,7 @@ class KwikIDFormViewComponent {
|
|
|
1612
1607
|
for (let f of field.reset.fields) {
|
|
1613
1608
|
for (let a of f.actions) {
|
|
1614
1609
|
const resetField = findFieldFromKey(this.formFields, a.props.fieldKey);
|
|
1615
|
-
const actions = new Actions(a, resetField, {}, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
|
|
1610
|
+
const actions = new Actions$1(a, resetField, {}, this.allFormsData, this.formData, this.previousFormData, this.takeAction.bind(this));
|
|
1616
1611
|
yield actions.execute();
|
|
1617
1612
|
}
|
|
1618
1613
|
}
|
|
@@ -1639,7 +1634,8 @@ class KwikIDFormViewComponent {
|
|
|
1639
1634
|
request: {
|
|
1640
1635
|
mode: "POST",
|
|
1641
1636
|
body: field.api.request.body.value,
|
|
1642
|
-
headers: {}
|
|
1637
|
+
headers: {},
|
|
1638
|
+
url: field.api.request.url
|
|
1643
1639
|
}
|
|
1644
1640
|
});
|
|
1645
1641
|
}
|
|
@@ -1679,14 +1675,14 @@ class KwikIDFormViewComponent {
|
|
|
1679
1675
|
for (let field of this.formFields) {
|
|
1680
1676
|
if (field.type !== EFieldType.TITLE &&
|
|
1681
1677
|
field.validation.triggers.includes("ON_SAVE")) {
|
|
1682
|
-
const validations = new Validations(field, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1678
|
+
const validations = new Validations$1(field, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1683
1679
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1684
1680
|
yield validations.validateField();
|
|
1685
1681
|
}))();
|
|
1686
1682
|
}
|
|
1687
1683
|
}
|
|
1688
1684
|
if (this.formGroup.invalid) {
|
|
1689
|
-
const controls = new Validations(undefined, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
|
|
1685
|
+
const controls = new Validations$1(undefined, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
|
|
1690
1686
|
let firstFieldWithError = "";
|
|
1691
1687
|
for (let control of controls) {
|
|
1692
1688
|
if (control.invalid && isEmpty(firstFieldWithError)) {
|
|
@@ -1694,6 +1690,7 @@ class KwikIDFormViewComponent {
|
|
|
1694
1690
|
}
|
|
1695
1691
|
this.formFields = setFieldError(this.formFields, this.formGroup.controls[control.key].errors, control.key, control.invalid);
|
|
1696
1692
|
}
|
|
1693
|
+
this.toggleErrorNotification(true);
|
|
1697
1694
|
return;
|
|
1698
1695
|
}
|
|
1699
1696
|
Object.keys(formData).map((key) => {
|
|
@@ -1701,7 +1698,10 @@ class KwikIDFormViewComponent {
|
|
|
1701
1698
|
formData[key] = "";
|
|
1702
1699
|
}
|
|
1703
1700
|
});
|
|
1704
|
-
this.onClickSaveForm.emit({ data: formData });
|
|
1701
|
+
this.onClickSaveForm.emit({ formConfig: this.formConfig, data: formData });
|
|
1702
|
+
}
|
|
1703
|
+
toggleErrorNotification(show) {
|
|
1704
|
+
this.showErrorNotification = show;
|
|
1705
1705
|
}
|
|
1706
1706
|
// Component Helpers
|
|
1707
1707
|
fieldHide(fieldKey) {
|
|
@@ -1871,7 +1871,7 @@ class KwikIDFormViewComponent {
|
|
|
1871
1871
|
this.fieldMessageHide(action.props.fieldKey, action.props.message);
|
|
1872
1872
|
break;
|
|
1873
1873
|
case EActionKey.SET_VALUE:
|
|
1874
|
-
const sources = new Sources(field, this.formData, this.previousFormData, this.allFormsData);
|
|
1874
|
+
const sources = new Sources$1(field, this.formData, this.previousFormData, this.allFormsData);
|
|
1875
1875
|
const sourceValue = yield sources.getValueFromSource(action.props.value.source);
|
|
1876
1876
|
sources.setValueToSource(action.props.value.destination, sourceValue);
|
|
1877
1877
|
field = sources.field;
|
|
@@ -1890,8 +1890,8 @@ class KwikIDFormViewComponent {
|
|
|
1890
1890
|
});
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
1893
|
-
/** @nocollapse */ KwikIDFormViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormViewComponent, deps: [{ token: KwikIDFormViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1894
|
-
/** @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 class=\"title\">\r\n <div>\r\n {{ field.label }}\r\n </div>\r\n <kwikui-button\r\n *ngIf=\"field?.reset\"\r\n appearance=\"whiteblock\"\r\n size=\"s\"\r\n label=\"Reset\"\r\n (onClick)=\"this.handleOnClickResetFormFields($event, field)\"\r\n ></kwikui-button>\r\n </div>\r\n </ng-container>\r\n <!-- Input Text -->\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input\r\n [case]=\"field?.properties?.case\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [type]=\"'text'\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Checkbox -->\r\n <ng-container *ngSwitchCase=\"'checkbox'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-checkbox-block\r\n [contentAlign]=\"field?.properties?.contentAlign ?? 'left'\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.properties?.placeholder\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [size]=\"field?.properties?.size ?? 'l'\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-checkbox-block\r\n ><kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Number -->\r\n <ng-container *ngSwitchCase=\"'number'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-number\r\n [decimal]=\"field?.properties?.decimal\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [max]=\"field?.properties?.max\"\r\n [min]=\"field?.properties?.min\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [postfix]=\"field?.properties?.postfix ?? ''\"\r\n [precision]=\"field?.properties?.precision\"\r\n [prefix]=\"field?.properties?.prefix ?? ''\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-number\r\n ><kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Date -->\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-date\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [max]=\"field?.properties?.max\"\r\n [min]=\"field?.properties?.min\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-date>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Phone -->\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-phone\r\n [countryCode]=\"field?.properties?.countryCode\"\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [phoneMaskAfterCountryCode]=\"\r\n field?.properties?.phoneMaskAfterCountryCode\r\n \"\r\n [placeholder]=\"field?.placeholder\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-phone>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Input Radio -->\r\n <ng-container *ngSwitchCase=\"'radio'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <label\r\n [tuiLabel]=\"labelTemplate\"\r\n style=\"min-height: auto\"\r\n >\r\n <kwikui-radio-list\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [items]=\"field?.options\"\r\n [label]=\"field?.label\"\r\n [orientation]=\"field?.properties?.orientation\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [size]=\"field?.properties?.size\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-radio-list>\r\n </label>\r\n <ng-template #labelTemplate>\r\n <p\r\n class=\"tui-space_bottom-2\"\r\n [hidden]=\"field?.hidden\"\r\n >\r\n <b>\r\n {{ field.label }}\r\n <span *ngIf=\"field.validators?.required\"></span>\r\n </b>\r\n </p>\r\n </ng-template>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Dropdown -->\r\n <ng-container *ngSwitchCase=\"'dropdown-with-search'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-select-combobox\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field.label\"\r\n [options]=\"field.options\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-select-combobox>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- API Call -->\r\n <ng-container *ngSwitchCase=\"'api-call'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-button-api-call\r\n [apiStatus]=\"field?.api?.status?.value\"\r\n [class]=\"field?.class\"\r\n [disabled]=\"field?.disabled\"\r\n [id]=\"field.key\"\r\n [label]=\"field?.api?.status?.labels[field?.api?.status?.value]\"\r\n [showLoader]=\"field?.disabled === 'loading'\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: fit-content\"\r\n (onClick)=\"this.handleOnClickApiCall($event)\"\r\n ></kwikui-button-api-call>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Mobile OTP -->\r\n <ng-container *ngSwitchCase=\"'otp'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-otp\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [mask]=\"field?.properties?.mask\"\r\n [placeholder]=\"field?.properties?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-otp>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n <!-- Aadhaar Number -->\r\n <ng-container *ngSwitchCase=\"'aadhaar-number'\">\r\n <div [hidden]=\"field?.hidden\">\r\n <kwikui-input-aadhaar\r\n [disabled]=\"field?.disabled\"\r\n [focus]=\"field?.focus\"\r\n [formControl]=\"formGroup.controls[field.key]\"\r\n [formControlName]=\"field.key\"\r\n [id]=\"field.key\"\r\n [invalid]=\"field?.invalid\"\r\n [label]=\"field?.label\"\r\n [placeholder]=\"field?.placeholder\"\r\n [properties]=\"field?.properties\"\r\n [validators]=\"field?.validators\"\r\n (getKeyValue)=\"handleGetKeyValue($event)\"\r\n ></kwikui-input-aadhaar>\r\n <kwikui-messages\r\n [messages]=\"field.messages\"\r\n [id]=\"field.key\"\r\n ></kwikui-messages>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </form>\r\n <div class=\"kwikid-form-buttons\">\r\n <kwikui-button\r\n *ngIf=\"this.isMobileView\"\r\n [disabled]=\"viewFormsButton.disabled\"\r\n id=\"\"\r\n label=\"View Forms\"\r\n [showLoader]=\"viewFormsButton.showLoader\"\r\n styles=\"\"\r\n class=\"\"\r\n type=\"button\"\r\n appearance=\"secondary\"\r\n icon=\"\"\r\n iconRight=\"\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: 100%\"\r\n (onClick)=\"this.handleOnClickViewForms($event)\"\r\n ></kwikui-button>\r\n <kwikui-button\r\n [disabled]=\"saveFormButton.disabled\"\r\n id=\"\"\r\n label=\"Save\"\r\n [showLoader]=\"saveFormButton.showLoader\"\r\n styles=\"\"\r\n class=\"\"\r\n type=\"button\"\r\n appearance=\"primary\"\r\n icon=\"\"\r\n iconRight=\"\"\r\n shape=\"null\"\r\n size=\"m\"\r\n styles=\"width: 100%\"\r\n (onClick)=\"this.handleOnClickSaveForm($event)\"\r\n ></kwikui-button>\r\n </div>\r\n</div>\r\n<div\r\n class=\"kwikid-form-container-loading\"\r\n *ngIf=\"this.loading\"\r\n>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n <div\r\n class=\"large-wrapper\"\r\n [class.tui-skeleton]=\"this.loading\"\r\n [class.tui-skeleton_rounded]=\"this.loading\"\r\n ></div>\r\n</div>\r\n", styles: ["::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{background:lightgray;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:gray}.kwikid-form-container{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center}.kwikid-form.show{width:100%;height:100%;padding:1rem;overflow-y:auto;display:flex;flex-direction:column;align-content:center;justify-content:flex-start;align-items:stretch;grid-row-gap:1rem;row-gap:1rem}.kwikid-form-buttons{width:100%;bottom:0px;padding:1rem;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;grid-column-gap:10px;column-gap:10px}.kwikid-form-buttons *{flex-grow:1}#uf-form-fields-header-container{display:flex;flex-direction:column;align-content:center;justify-content:center;align-items:flex-start;grid-row-gap:.5rem;row-gap:.5rem;padding:1rem}#uf-form-fields-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}.large-wrapper{width:100%;height:60px}.large-wrapper:first-child{margin-bottom:auto}.large-wrapper:last-child{margin-top:auto}.kwikid-form-container-loading{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;grid-row-gap:1rem;row-gap:1rem;padding:1rem}\n"], components: [{ type: i2.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", "focus", "invalid", "disabled", "placeholder", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "countryCode", "phoneMaskAfterCountryCode", "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", "items", "orientation", "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"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i4.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }] });
|
|
1893
|
+
/** @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 });
|
|
1894
|
+
/** @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 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?.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}.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", "focus", "invalid", "disabled", "placeholder", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "countryCode", "phoneMaskAfterCountryCode", "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", "items", "orientation", "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" }] });
|
|
1895
1895
|
__decorate([
|
|
1896
1896
|
log
|
|
1897
1897
|
], KwikIDFormViewComponent.prototype, "ngOnInit", null);
|
|
@@ -1934,6 +1934,9 @@ __decorate([
|
|
|
1934
1934
|
__decorate([
|
|
1935
1935
|
log
|
|
1936
1936
|
], KwikIDFormViewComponent.prototype, "handleOnClickSaveForm", null);
|
|
1937
|
+
__decorate([
|
|
1938
|
+
log
|
|
1939
|
+
], KwikIDFormViewComponent.prototype, "toggleErrorNotification", null);
|
|
1937
1940
|
__decorate([
|
|
1938
1941
|
log
|
|
1939
1942
|
], KwikIDFormViewComponent.prototype, "fieldHide", null);
|
|
@@ -1990,7 +1993,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1990
1993
|
styleUrls: ["./form-view.component.scss"],
|
|
1991
1994
|
providers: [KwikIDFormViewService]
|
|
1992
1995
|
}]
|
|
1993
|
-
}], ctorParameters: function () { return [{ type:
|
|
1996
|
+
}], ctorParameters: function () { return [{ type: i4.TuiPushService, decorators: [{
|
|
1997
|
+
type: Inject,
|
|
1998
|
+
args: [TuiPushService]
|
|
1999
|
+
}] }, { type: i3.TuiAlertService, decorators: [{
|
|
2000
|
+
type: Inject,
|
|
2001
|
+
args: [TuiAlertService]
|
|
2002
|
+
}] }, { type: KwikIDFormViewService }]; }, propDecorators: { formConfig: [{
|
|
1994
2003
|
type: Input
|
|
1995
2004
|
}], formData: [{
|
|
1996
2005
|
type: Input
|
|
@@ -2010,7 +2019,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2010
2019
|
type: Output
|
|
2011
2020
|
}], getActiveFormData: [{
|
|
2012
2021
|
type: Output
|
|
2013
|
-
}], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], fieldHide: [], fieldShow: [], fieldDisable: [], fieldEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], handleFieldTypeSearchText: [], takeAction: [] } });
|
|
2022
|
+
}], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], toggleErrorNotification: [], fieldHide: [], fieldShow: [], fieldDisable: [], fieldEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], handleFieldTypeSearchText: [], takeAction: [] } });
|
|
2014
2023
|
|
|
2015
2024
|
const hasKey = (object, key) => {
|
|
2016
2025
|
return object.hasOwnProperty(key);
|
|
@@ -2069,7 +2078,7 @@ class KwikIDFormsListComponent {
|
|
|
2069
2078
|
}
|
|
2070
2079
|
}
|
|
2071
2080
|
/** @nocollapse */ KwikIDFormsListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2072
|
-
/** @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:
|
|
2081
|
+
/** @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"] }] });
|
|
2073
2082
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsListComponent, decorators: [{
|
|
2074
2083
|
type: Component,
|
|
2075
2084
|
args: [{
|
|
@@ -2095,6 +2104,239 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2095
2104
|
type: Output
|
|
2096
2105
|
}] } });
|
|
2097
2106
|
|
|
2107
|
+
class Sources {
|
|
2108
|
+
constructor(userConfig) {
|
|
2109
|
+
this._userConfig = userConfig;
|
|
2110
|
+
}
|
|
2111
|
+
get userConfig() {
|
|
2112
|
+
return this._userConfig;
|
|
2113
|
+
}
|
|
2114
|
+
set userConfig(value) {
|
|
2115
|
+
this._userConfig = value;
|
|
2116
|
+
}
|
|
2117
|
+
getValueFromUserConfig(path) {
|
|
2118
|
+
let value = "";
|
|
2119
|
+
if (isNotEmpty(path)) {
|
|
2120
|
+
value = jpQueryWrapper(this._userConfig, path);
|
|
2121
|
+
}
|
|
2122
|
+
else {
|
|
2123
|
+
value = setEmptyValue(this._userConfig);
|
|
2124
|
+
}
|
|
2125
|
+
return value;
|
|
2126
|
+
}
|
|
2127
|
+
getValueFromBrowserStorage(type, key) {
|
|
2128
|
+
let value = "";
|
|
2129
|
+
switch (type) {
|
|
2130
|
+
case EBrowserStorageType.LOCAL_STORAGE:
|
|
2131
|
+
value = isNotEmptyBrowserStorageValue(localStorage.getItem(key))
|
|
2132
|
+
? localStorage.getItem(key)
|
|
2133
|
+
: "";
|
|
2134
|
+
break;
|
|
2135
|
+
case EBrowserStorageType.SESSION_STORAGE:
|
|
2136
|
+
value = isNotEmptyBrowserStorageValue(sessionStorage.getItem(key))
|
|
2137
|
+
? sessionStorage.getItem(key)
|
|
2138
|
+
: "";
|
|
2139
|
+
break;
|
|
2140
|
+
default:
|
|
2141
|
+
value = "";
|
|
2142
|
+
break;
|
|
2143
|
+
}
|
|
2144
|
+
return value;
|
|
2145
|
+
}
|
|
2146
|
+
getValueFromSource(source) {
|
|
2147
|
+
let value = "";
|
|
2148
|
+
switch (source.key) {
|
|
2149
|
+
case ESourceKey.USER_CONFIG:
|
|
2150
|
+
value = this.getValueFromUserConfig(source.props.path);
|
|
2151
|
+
break;
|
|
2152
|
+
case ESourceKey.BROWSER_STORAGE:
|
|
2153
|
+
value = this.getValueFromBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key);
|
|
2154
|
+
break;
|
|
2155
|
+
case ESourceKey.PREDEFINED:
|
|
2156
|
+
value = source.value;
|
|
2157
|
+
break;
|
|
2158
|
+
default:
|
|
2159
|
+
value = "";
|
|
2160
|
+
break;
|
|
2161
|
+
}
|
|
2162
|
+
return value;
|
|
2163
|
+
}
|
|
2164
|
+
setValueToUserConfig(path, value) {
|
|
2165
|
+
this._userConfig = setValueToObject(this._userConfig, path, value);
|
|
2166
|
+
}
|
|
2167
|
+
setValueToBrowserStorage(type, key, value) {
|
|
2168
|
+
switch (type) {
|
|
2169
|
+
case EBrowserStorageType.LOCAL_STORAGE:
|
|
2170
|
+
localStorage.setItem(key, value);
|
|
2171
|
+
break;
|
|
2172
|
+
case EBrowserStorageType.SESSION_STORAGE:
|
|
2173
|
+
sessionStorage.setItem(key, value);
|
|
2174
|
+
break;
|
|
2175
|
+
default:
|
|
2176
|
+
break;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
setValueToSource(source, value) {
|
|
2180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2181
|
+
switch (source.key) {
|
|
2182
|
+
case ESourceKey.USER_CONFIG:
|
|
2183
|
+
this.setValueToUserConfig(source.props.path, value);
|
|
2184
|
+
break;
|
|
2185
|
+
case ESourceKey.BROWSER_STORAGE:
|
|
2186
|
+
yield this.setValueToBrowserStorage(source.props.browserStorage.type, source.props.browserStorage.key, value);
|
|
2187
|
+
break;
|
|
2188
|
+
default:
|
|
2189
|
+
break;
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
class Condition {
|
|
2196
|
+
constructor(condition, rulesMapping) {
|
|
2197
|
+
this._condition = condition;
|
|
2198
|
+
this._rulesMapping = rulesMapping;
|
|
2199
|
+
}
|
|
2200
|
+
parseKeys(condition, rulesEvaluationMapping) {
|
|
2201
|
+
Object.keys(rulesEvaluationMapping).forEach((key) => {
|
|
2202
|
+
condition = replaceString(condition, key, rulesEvaluationMapping[key]);
|
|
2203
|
+
});
|
|
2204
|
+
return condition;
|
|
2205
|
+
}
|
|
2206
|
+
parseOperators(condition) {
|
|
2207
|
+
return condition.replace(/AND|OR|NOT|XOR|NAND|NOR|XNOR/g, (match) => {
|
|
2208
|
+
switch (match) {
|
|
2209
|
+
case "AND":
|
|
2210
|
+
return "&&";
|
|
2211
|
+
case "OR":
|
|
2212
|
+
return "||";
|
|
2213
|
+
case "NOT":
|
|
2214
|
+
return "!";
|
|
2215
|
+
case "XOR":
|
|
2216
|
+
return "^";
|
|
2217
|
+
case "NAND":
|
|
2218
|
+
return "!&";
|
|
2219
|
+
case "NOR":
|
|
2220
|
+
return "!|";
|
|
2221
|
+
case "XNOR":
|
|
2222
|
+
return "!^";
|
|
2223
|
+
default:
|
|
2224
|
+
return match;
|
|
2225
|
+
}
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
evaluate() {
|
|
2229
|
+
this._condition = this.parseKeys(this._condition, this._rulesMapping);
|
|
2230
|
+
this._condition = this.parseOperators(this._condition);
|
|
2231
|
+
return eval(this._condition);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
class Actions {
|
|
2236
|
+
constructor(action, ruleMapping, userConfig, takeAction) {
|
|
2237
|
+
this._action = action;
|
|
2238
|
+
this._userConfig = userConfig;
|
|
2239
|
+
this._ruleMapping = ruleMapping;
|
|
2240
|
+
this._takeAction = takeAction;
|
|
2241
|
+
}
|
|
2242
|
+
execute() {
|
|
2243
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2244
|
+
const condition = new Condition(this._action.condition, this._ruleMapping);
|
|
2245
|
+
const actionSuccess = condition.evaluate();
|
|
2246
|
+
if (actionSuccess) {
|
|
2247
|
+
return this._takeAction(this._action, this._userConfig);
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
class Rules {
|
|
2254
|
+
constructor(rules, userConfig) {
|
|
2255
|
+
this._userConfig = userConfig;
|
|
2256
|
+
this._rules = rules;
|
|
2257
|
+
}
|
|
2258
|
+
evaluate(rule) {
|
|
2259
|
+
let ruleType = rule.key;
|
|
2260
|
+
let ruleEvaluationStatus = false;
|
|
2261
|
+
const source = new Sources(this._userConfig);
|
|
2262
|
+
switch (ruleType) {
|
|
2263
|
+
case ERuleKey.OBJECT_PATH_EXISTS:
|
|
2264
|
+
const ruleObjectPathExists = rule;
|
|
2265
|
+
const ruleObjectPathExistsObject = ruleObjectPathExists.props.object;
|
|
2266
|
+
const ruleObjectPathExistsPath = ruleObjectPathExists.props.path;
|
|
2267
|
+
switch (ruleObjectPathExistsObject) {
|
|
2268
|
+
case ESourceKey.USER_CONFIG:
|
|
2269
|
+
ruleEvaluationStatus = hasPath(this._userConfig, ruleObjectPathExistsPath);
|
|
2270
|
+
break;
|
|
2271
|
+
default:
|
|
2272
|
+
ruleEvaluationStatus = false;
|
|
2273
|
+
break;
|
|
2274
|
+
}
|
|
2275
|
+
break;
|
|
2276
|
+
case ERuleKey.VALUE_CHECK:
|
|
2277
|
+
const ruleValueCheck = rule;
|
|
2278
|
+
const ruleValueCheckSource = ruleValueCheck.props.value.source;
|
|
2279
|
+
const ruleValueCheckValue = source.getValueFromSource(ruleValueCheckSource);
|
|
2280
|
+
if (ruleValueCheck.props.pattern.key === EPatternKey.CUSTOM) {
|
|
2281
|
+
var re = new RegExp(ruleValueCheck.props.pattern.pattern);
|
|
2282
|
+
}
|
|
2283
|
+
else {
|
|
2284
|
+
var re = new RegExp(EPattern[ruleValueCheck.props.pattern.key]);
|
|
2285
|
+
}
|
|
2286
|
+
ruleEvaluationStatus = re.test(ruleValueCheckValue);
|
|
2287
|
+
break;
|
|
2288
|
+
case ERuleKey.VALUE_CHANGE:
|
|
2289
|
+
const ruleValueChange = rule;
|
|
2290
|
+
const ruleValueChangeCurrentSource = ruleValueChange.props.value.current.source;
|
|
2291
|
+
const ruleValueChangePreviousSource = ruleValueChange.props.value.previous.source;
|
|
2292
|
+
const previousValue = source.getValueFromSource(ruleValueChangePreviousSource);
|
|
2293
|
+
const currentValue = source.getValueFromSource(ruleValueChangeCurrentSource);
|
|
2294
|
+
ruleEvaluationStatus = previousValue === currentValue;
|
|
2295
|
+
break;
|
|
2296
|
+
default:
|
|
2297
|
+
break;
|
|
2298
|
+
}
|
|
2299
|
+
return ruleEvaluationStatus;
|
|
2300
|
+
}
|
|
2301
|
+
mapping() {
|
|
2302
|
+
let rulesEvaluationMapping = {};
|
|
2303
|
+
for (const rule of this._rules) {
|
|
2304
|
+
const ruleEvaluationStatus = this.evaluate(rule);
|
|
2305
|
+
rulesEvaluationMapping = Object.assign(Object.assign({}, rulesEvaluationMapping), { [rule.id]: ruleEvaluationStatus });
|
|
2306
|
+
}
|
|
2307
|
+
return rulesEvaluationMapping;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
class Validations {
|
|
2312
|
+
constructor(userConfig, takeAction) {
|
|
2313
|
+
this._userConfig = userConfig;
|
|
2314
|
+
this._takeAction = takeAction;
|
|
2315
|
+
}
|
|
2316
|
+
get userConfig() {
|
|
2317
|
+
return this._userConfig;
|
|
2318
|
+
}
|
|
2319
|
+
set userConfig(value) {
|
|
2320
|
+
this._userConfig = value;
|
|
2321
|
+
}
|
|
2322
|
+
validateField() {
|
|
2323
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2324
|
+
const validations = this._userConfig.userFormFieldsConfig.validation;
|
|
2325
|
+
const triggers = validations === null || validations === void 0 ? void 0 : validations.triggers;
|
|
2326
|
+
const rules = validations.rules;
|
|
2327
|
+
const actions = validations.actions;
|
|
2328
|
+
const rulesMapping = new Rules(rules, this._userConfig).mapping();
|
|
2329
|
+
for (let action of actions) {
|
|
2330
|
+
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
2331
|
+
if (conditionEvaluation) {
|
|
2332
|
+
const actions = new Actions(action, rulesMapping, this._userConfig, this._takeAction);
|
|
2333
|
+
yield actions.execute();
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2098
2340
|
class Converter {
|
|
2099
2341
|
constructor() {
|
|
2100
2342
|
this.getFormFields = (formConfig) => {
|
|
@@ -2150,14 +2392,6 @@ class Converter {
|
|
|
2150
2392
|
return field;
|
|
2151
2393
|
};
|
|
2152
2394
|
const formatFieldTypeDate = (field) => {
|
|
2153
|
-
const convertDateStringToTuiDayFormat = (date) => {
|
|
2154
|
-
const splitDate = date.split("-");
|
|
2155
|
-
const tuiDay = new TuiDay(Number(splitDate[2]), // Year
|
|
2156
|
-
Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
|
|
2157
|
-
Number(splitDate[0]) // Day
|
|
2158
|
-
);
|
|
2159
|
-
return tuiDay;
|
|
2160
|
-
};
|
|
2161
2395
|
if (hasKey$2(field, "min")) {
|
|
2162
2396
|
const tuiDay = convertDateStringToTuiDayFormat(field["min"]);
|
|
2163
2397
|
field.properties = this.setFieldKeyValue(field.properties, "min", tuiDay);
|
|
@@ -2187,10 +2421,15 @@ class Converter {
|
|
|
2187
2421
|
field = this.setFieldKeyValue(field, "type", "phone");
|
|
2188
2422
|
field.properties = this.setMissingFieldKeyValue(field.properties, "countryCode", "+91");
|
|
2189
2423
|
field.properties = this.setMissingFieldKeyValue(field.properties, "phoneMaskAfterCountryCode", "####-######");
|
|
2190
|
-
field.properties = this.
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
field.properties = this.
|
|
2424
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "removeCountryCodeFromValue", true);
|
|
2425
|
+
}
|
|
2426
|
+
if (field.type === "phone" || field.type === "number") {
|
|
2427
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "decimal", "never");
|
|
2428
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "prefix", "");
|
|
2429
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "postfix", "");
|
|
2430
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "min", -Infinity);
|
|
2431
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "max", Infinity);
|
|
2432
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "precision", 2);
|
|
2194
2433
|
}
|
|
2195
2434
|
}
|
|
2196
2435
|
field = this.setFieldKeyValue(field, "hidden", false);
|
|
@@ -2619,11 +2858,6 @@ class Converter {
|
|
|
2619
2858
|
}
|
|
2620
2859
|
return field;
|
|
2621
2860
|
};
|
|
2622
|
-
let fields = this.getFormFields(formConfig);
|
|
2623
|
-
let connectedFieldMapping = {
|
|
2624
|
-
parent: {},
|
|
2625
|
-
child: {}
|
|
2626
|
-
};
|
|
2627
2861
|
const setFormFields = (formConfig, fields) => {
|
|
2628
2862
|
if (hasKey$2(formConfig, "multiForm")) {
|
|
2629
2863
|
formConfig.multiForm["fields"] = fields;
|
|
@@ -2633,6 +2867,11 @@ class Converter {
|
|
|
2633
2867
|
}
|
|
2634
2868
|
return formConfig;
|
|
2635
2869
|
};
|
|
2870
|
+
let connectedFieldMapping = {
|
|
2871
|
+
parent: {},
|
|
2872
|
+
child: {}
|
|
2873
|
+
};
|
|
2874
|
+
let fields = this.getFormFields(formConfig);
|
|
2636
2875
|
for (let field of fields) {
|
|
2637
2876
|
field = updateOnFieldType(field);
|
|
2638
2877
|
field = formatFieldKeys(field);
|
|
@@ -2774,10 +3013,12 @@ class KwikIDFormsRendererComponent {
|
|
|
2774
3013
|
this.getFormData = new EventEmitter();
|
|
2775
3014
|
this.onClickApiCall = new EventEmitter();
|
|
2776
3015
|
this.loading = false;
|
|
3016
|
+
this.loader = false;
|
|
2777
3017
|
// display forms and list conditionally
|
|
2778
3018
|
this.showForm = false;
|
|
2779
3019
|
this.showFormFields = true;
|
|
2780
3020
|
this.showFormSections = true;
|
|
3021
|
+
this.showErrorNotification = false;
|
|
2781
3022
|
}
|
|
2782
3023
|
// The final value should be provided to service, so that it can be used in all components
|
|
2783
3024
|
windowResizeWatcher() {
|
|
@@ -2805,9 +3046,11 @@ class KwikIDFormsRendererComponent {
|
|
|
2805
3046
|
}
|
|
2806
3047
|
}
|
|
2807
3048
|
ngOnInit() {
|
|
3049
|
+
this.loader = true;
|
|
2808
3050
|
this.loading = true;
|
|
2809
3051
|
this.rendererService.setFormsList(this.userConfig.userFormFields);
|
|
2810
3052
|
this.initializeForms();
|
|
3053
|
+
this.loader = false;
|
|
2811
3054
|
}
|
|
2812
3055
|
ngOnChanges(changes) {
|
|
2813
3056
|
const verifyChange = (prop) => {
|
|
@@ -2815,6 +3058,7 @@ class KwikIDFormsRendererComponent {
|
|
|
2815
3058
|
};
|
|
2816
3059
|
if (verifyChange("userConfig")) {
|
|
2817
3060
|
this.userConfig = changes.userConfig.currentValue;
|
|
3061
|
+
this.loader = false;
|
|
2818
3062
|
}
|
|
2819
3063
|
if (verifyChange("formsData")) {
|
|
2820
3064
|
this.formsData = changes.formsData.currentValue;
|
|
@@ -2822,10 +3066,12 @@ class KwikIDFormsRendererComponent {
|
|
|
2822
3066
|
}
|
|
2823
3067
|
if (verifyChange("apiCallResponse")) {
|
|
2824
3068
|
this.apiCallResponse = changes.apiCallResponse.currentValue;
|
|
3069
|
+
this.loader = false;
|
|
2825
3070
|
}
|
|
2826
3071
|
}
|
|
2827
3072
|
initializeForms() {
|
|
2828
3073
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3074
|
+
this.loader = true;
|
|
2829
3075
|
this.rendererService.setAllFormsData(this.formsData);
|
|
2830
3076
|
this.rendererService.updateFormsList();
|
|
2831
3077
|
this.handleResize(this.rendererService.formsList);
|
|
@@ -2837,6 +3083,7 @@ class KwikIDFormsRendererComponent {
|
|
|
2837
3083
|
this.showForm = false;
|
|
2838
3084
|
this.showFormFields = false;
|
|
2839
3085
|
}
|
|
3086
|
+
this.loader = false;
|
|
2840
3087
|
this.loading = false;
|
|
2841
3088
|
});
|
|
2842
3089
|
}
|
|
@@ -2863,6 +3110,7 @@ class KwikIDFormsRendererComponent {
|
|
|
2863
3110
|
var _a;
|
|
2864
3111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2865
3112
|
this.showForm = false;
|
|
3113
|
+
this.loader = true;
|
|
2866
3114
|
const activeFormConfig = this.rendererService.formsList.find((form) => {
|
|
2867
3115
|
if (form.key === selectedForm) {
|
|
2868
3116
|
return form;
|
|
@@ -2882,25 +3130,40 @@ class KwikIDFormsRendererComponent {
|
|
|
2882
3130
|
this.showFormFields = true;
|
|
2883
3131
|
}
|
|
2884
3132
|
this.showForm = true;
|
|
3133
|
+
this.loader = false;
|
|
2885
3134
|
});
|
|
2886
3135
|
}
|
|
2887
3136
|
// forms-list listener
|
|
2888
3137
|
handleOnClickSubmitForms(e) {
|
|
2889
3138
|
console.log(e);
|
|
2890
|
-
this.
|
|
3139
|
+
if (this.userConfig.userFormFieldsConfig.validation) {
|
|
3140
|
+
const validations = new Validations(this.userConfig, this.takeAction.bind(this));
|
|
3141
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3142
|
+
yield validations.validateField();
|
|
3143
|
+
if (this.userConfig.userFormFieldsConfig.status === "completed") {
|
|
3144
|
+
this.onClickSubmit.emit(e);
|
|
3145
|
+
}
|
|
3146
|
+
else {
|
|
3147
|
+
this.toggleErrorNotification(true);
|
|
3148
|
+
}
|
|
3149
|
+
}))();
|
|
3150
|
+
}
|
|
2891
3151
|
}
|
|
2892
3152
|
// form-view listener
|
|
2893
3153
|
handleOnClickApiCall(e) {
|
|
3154
|
+
this.loader = true;
|
|
2894
3155
|
this.onClickApiCall.emit(e);
|
|
2895
3156
|
}
|
|
2896
3157
|
// form-view listener
|
|
2897
3158
|
handleGetActiveFormData(e) {
|
|
3159
|
+
this.loader = true;
|
|
2898
3160
|
this.getFormData.emit({
|
|
2899
3161
|
[this.rendererService.activeFormConfig.key]: e["data"]
|
|
2900
3162
|
});
|
|
2901
3163
|
}
|
|
2902
3164
|
// form-view listener
|
|
2903
3165
|
handleOnClickSaveForm(e) {
|
|
3166
|
+
this.loader = true;
|
|
2904
3167
|
this.rendererService.setActiveFormData({});
|
|
2905
3168
|
this.getFormData.emit({
|
|
2906
3169
|
[this.rendererService.activeFormConfig.key]: e["data"]
|
|
@@ -2912,9 +3175,26 @@ class KwikIDFormsRendererComponent {
|
|
|
2912
3175
|
this.showForm = false;
|
|
2913
3176
|
this.showFormFields = false;
|
|
2914
3177
|
}
|
|
3178
|
+
toggleErrorNotification(show) {
|
|
3179
|
+
this.showErrorNotification = show;
|
|
3180
|
+
}
|
|
3181
|
+
takeAction(action, userConfig) {
|
|
3182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3183
|
+
switch (action.key) {
|
|
3184
|
+
case EActionKey.SET_VALUE:
|
|
3185
|
+
const sources = new Sources(userConfig);
|
|
3186
|
+
const sourceValue = yield sources.getValueFromSource(action.props.value.source);
|
|
3187
|
+
sources.setValueToSource(action.props.value.destination, sourceValue);
|
|
3188
|
+
this.userConfig = sources.userConfig;
|
|
3189
|
+
break;
|
|
3190
|
+
default:
|
|
3191
|
+
break;
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
2915
3195
|
}
|
|
2916
3196
|
/** @nocollapse */ KwikIDFormsRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormsRendererComponent, deps: [{ token: KwikIDRendererService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2917
|
-
/** @nocollapse */ KwikIDFormsRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsRendererComponent, selector: "kwikid-forms-renderer", inputs: { userConfig: "userConfig", formsData: "formsData", apiCallResponse: "apiCallResponse" }, outputs: { onClickSubmit: "onClickSubmit", getFormData: "getFormData", onClickApiCall: "onClickApiCall" }, host: { listeners: { "window:resize": "windowResizeWatcher($event)" } }, providers: [KwikIDRendererService], usesOnChanges: true, ngImport: i0, template: "<div ngClass=\"kwikid-renderer\">\r\n <div\r\n ngClass=\"kwikid-layout-container\"\r\n *ngIf=\"!loading\"\r\n >\r\n <div\r\n ngClass=\"kwikid-sections-container\"\r\n *ngIf=\"showFormSections\"\r\n class=\"active\"\r\n [class.active]=\"showFormSections\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n >\r\n <kwikid-forms-list\r\n [showFormFields]=\"this.showFormFields\"\r\n [userConfig]=\"this.userConfig\"\r\n [formsList]=\"this.rendererService.formsList\"\r\n [formsListCompleted]=\"this.rendererService.formsListCompleted\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickSetActiveForm)=\"this.handleOnClickSetActiveForm($event)\"\r\n (onClickSubmitForms)=\"this.handleOnClickSubmitForms($event)\"\r\n ></kwikid-forms-list>\r\n </div>\r\n <div\r\n ngClass=\"kwikid-forms-container\"\r\n *ngIf=\"this.showForm && this.showFormFields\"\r\n [class.active]=\"showFormFields\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n [@panelInOut]\r\n >\r\n <kwikid-form-view\r\n [formConfig]=\"this.rendererService.activeFormConfig\"\r\n [formData]=\"this.rendererService.activeFormData\"\r\n [apiCallResponse]=\"this.apiCallResponse\"\r\n [formsList]=\"this.rendererService.formsList\"\r\n [allFormsData]=\"this.rendererService.allFormsData\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickApiCall)=\"this.handleOnClickApiCall($event)\"\r\n (onClickViewForms)=\"this.handleOnClickViewForms($event)\"\r\n (onClickSaveForm)=\"this.handleOnClickSaveForm($event)\"\r\n (getActiveFormData)=\"this.handleGetActiveFormData($event)\"\r\n ></kwikid-form-view>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".kwikid-root{width:100%;height:100%}.kwikid-renderer{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;width:100%;height:100%}.kwikid-layout-container{display:flex;flex-direction:row;padding:0 1rem;height:100%;justify-content:center;align-items:stretch;background:var(--tui-secondary);position:relative}.kwikid-sections-container{display:block;width:100%;max-width:400px;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);margin:auto 1rem auto 0;box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-sections-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s;height:100%;border-radius:0;max-width:unset}.kwikid-forms-container{display:block;width:100%;max-width:50%;margin:auto 0;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-forms-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s;height:100%;border-radius:0;max-width:unset}@media screen and (max-width: 600px){.kwikid-layout-container{padding:0;background:transparent}.kwikid-sections-container{position:absolute;max-width:100%;bottom:-10000px;left:-10000px;opacity:0;padding:0;visibility:hidden}.kwikid-sections-container.active{visibility:visible}.kwikid-sections-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container{display:none;max-width:100%;height:100%;padding:0;border-radius:0;box-shadow:none}.kwikid-forms-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container.active{display:block}}\n"], components: [{ type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: ["showFormFields", "userConfig", "formsList", "formsListCompleted", "isMobileView"], outputs: ["onClickSetActiveForm", "onClickHideFormsList", "onClickSubmitForms"] }, { type: KwikIDFormViewComponent, selector: "kwikid-form-view", inputs: ["formConfig", "formData", "apiCallResponse", "isMobileView", "allFormsData", "formsList"], outputs: ["onClickViewForms", "onClickSaveForm", "onClickApiCall", "getActiveFormData"] }], directives: [{ type:
|
|
3197
|
+
/** @nocollapse */ KwikIDFormsRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: KwikIDFormsRendererComponent, selector: "kwikid-forms-renderer", inputs: { userConfig: "userConfig", formsData: "formsData", apiCallResponse: "apiCallResponse" }, outputs: { onClickSubmit: "onClickSubmit", getFormData: "getFormData", onClickApiCall: "onClickApiCall" }, host: { listeners: { "window:resize": "windowResizeWatcher($event)" } }, providers: [KwikIDRendererService], usesOnChanges: true, ngImport: i0, template: "<div ngClass=\"kwikid-renderer\">\r\n <div\r\n ngClass=\"kwikid-layout-container\"\r\n *ngIf=\"!loading\"\r\n >\r\n <div\r\n ngClass=\"kwikid-sections-container\"\r\n *ngIf=\"showFormSections\"\r\n class=\"active\"\r\n [class.active]=\"showFormSections\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n >\r\n <kwikid-forms-list\r\n [showFormFields]=\"this.showFormFields\"\r\n [userConfig]=\"this.userConfig\"\r\n [formsList]=\"this.rendererService.formsList\"\r\n [formsListCompleted]=\"this.rendererService.formsListCompleted\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickSetActiveForm)=\"this.handleOnClickSetActiveForm($event)\"\r\n (onClickSubmitForms)=\"this.handleOnClickSubmitForms($event)\"\r\n ></kwikid-forms-list>\r\n </div>\r\n <div\r\n ngClass=\"kwikid-forms-container\"\r\n *ngIf=\"this.showForm && this.showFormFields\"\r\n [class.active]=\"showFormFields\"\r\n [class.mobile]=\"rendererService.isMobileView\"\r\n [@panelInOut]\r\n >\r\n <kwikid-form-view\r\n [formConfig]=\"this.rendererService.activeFormConfig\"\r\n [formData]=\"this.rendererService.activeFormData\"\r\n [apiCallResponse]=\"this.apiCallResponse\"\r\n [formsList]=\"this.rendererService.formsList\"\r\n [allFormsData]=\"this.rendererService.allFormsData\"\r\n [isMobileView]=\"this.rendererService.isMobileView\"\r\n (onClickApiCall)=\"this.handleOnClickApiCall($event)\"\r\n (onClickViewForms)=\"this.handleOnClickViewForms($event)\"\r\n (onClickSaveForm)=\"this.handleOnClickSaveForm($event)\"\r\n (getActiveFormData)=\"this.handleGetActiveFormData($event)\"\r\n ></kwikid-form-view>\r\n </div>\r\n </div>\r\n</div>\r\n<div\r\n ngClass=\"kwikid-forms-renderer-loader\"\r\n *ngIf=\"loader\"\r\n>\r\n <span class=\"loader\"></span>\r\n</div>\r\n<tui-push\r\n id=\"error-notification\"\r\n *tuiPush=\"showErrorNotification\"\r\n heading=\"Please complete the required Forms!\"\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: [":host{position:relative}.kwikid-root{width:100%;height:100%}.kwikid-renderer{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;width:100%;height:100%}.kwikid-layout-container{display:flex;flex-direction:row;padding:0 1rem;height:100%;justify-content:center;align-items:stretch;background:var(--tui-secondary);position:relative}.kwikid-sections-container{display:block;width:100%;max-width:400px;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);margin:auto 1rem auto 0;box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-sections-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s;height:100%;border-radius:0;max-width:unset}.kwikid-forms-container{display:block;width:100%;max-width:50%;margin:auto 0;height:calc(100% - 2rem);padding:.25rem .5rem 0;border-radius:1rem;background-color:var(--tui-base-01);box-shadow:0 0 12px -8px var(--tui-primary)}.kwikid-forms-container.mobile{position:absolute;top:0;left:0;z-index:5;opacity:1;visibility:visible;transition:all 1s;height:100%;border-radius:0;max-width:unset}@media screen and (max-width: 600px){.kwikid-layout-container{padding:0;background:transparent}.kwikid-sections-container{position:absolute;max-width:100%;bottom:-10000px;left:-10000px;opacity:0;padding:0;visibility:hidden}.kwikid-sections-container.active{visibility:visible}.kwikid-sections-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container{display:none;max-width:100%;height:100%;padding:0;border-radius:0;box-shadow:none}.kwikid-forms-container.mobile{height:100%;opacity:1;visibility:visible;transition:all 2s;border-radius:0;box-shadow:none;top:0px;margin:0;position:absolute}.kwikid-forms-container.active{display:block}}.kwikid-forms-renderer-loader{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.75);display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;z-index:100}.kwikid-forms-renderer-loader .loader{width:48px;height:48px;border-radius:50%;display:inline-block;position:relative;border:3px solid;border-color:#fff #fff transparent;box-sizing:border-box;animation:rotation 1s linear infinite}.kwikid-forms-renderer-loader .loader:after{content:\"\";box-sizing:border-box;position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;border:3px solid;border-color:transparent var(--tui-primary) var(--tui-primary);width:24px;height:24px;border-radius:50%;animation:rotationBack .5s linear infinite;transform-origin:center center}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotationBack{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}.kwikid-forms-renderer-loader .t-loader{display:none!important}#error-notification{background-color:var(--tui-error-fill);color:#fff!important}#error-notification .t-top{color:#fff!important}#error-notification .t-close{color:#fff!important}\n"], components: [{ type: KwikIDFormsListComponent, selector: "kwikid-forms-list", inputs: ["showFormFields", "userConfig", "formsList", "formsListCompleted", "isMobileView"], outputs: ["onClickSetActiveForm", "onClickHideFormsList", "onClickSubmitForms"] }, { type: KwikIDFormViewComponent, selector: "kwikid-form-view", inputs: ["formConfig", "formData", "apiCallResponse", "isMobileView", "allFormsData", "formsList"], outputs: ["onClickViewForms", "onClickSaveForm", "onClickApiCall", "getActiveFormData"] }, { type: i4.TuiPushComponent, selector: "tui-push", inputs: ["heading", "type", "timestamp"], outputs: ["close"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.TuiPushAlertDirective, selector: "[tuiPush]", inputs: ["tuiPush"] }, { type: i4.TuiPushDirective, selector: "tui-push" }], animations: [
|
|
2918
3198
|
trigger("panelInOut", [
|
|
2919
3199
|
transition(":enter", [
|
|
2920
3200
|
style({ transform: "translateY(100%)" }),
|
|
@@ -2983,12 +3263,16 @@ class KwikIDFormViewModule {
|
|
|
2983
3263
|
FormsModule,
|
|
2984
3264
|
ReactiveFormsModule,
|
|
2985
3265
|
TuiLabelModule,
|
|
3266
|
+
TuiPushModule,
|
|
3267
|
+
TuiSvgModule,
|
|
2986
3268
|
KwikUIModule], exports: [KwikIDFormViewComponent] });
|
|
2987
3269
|
/** @nocollapse */ KwikIDFormViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormViewModule, imports: [[
|
|
2988
3270
|
CommonModule,
|
|
2989
3271
|
FormsModule,
|
|
2990
3272
|
ReactiveFormsModule,
|
|
2991
3273
|
TuiLabelModule,
|
|
3274
|
+
TuiPushModule,
|
|
3275
|
+
TuiSvgModule,
|
|
2992
3276
|
KwikUIModule
|
|
2993
3277
|
]] });
|
|
2994
3278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormViewModule, decorators: [{
|
|
@@ -3000,6 +3284,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3000
3284
|
FormsModule,
|
|
3001
3285
|
ReactiveFormsModule,
|
|
3002
3286
|
TuiLabelModule,
|
|
3287
|
+
TuiPushModule,
|
|
3288
|
+
TuiSvgModule,
|
|
3003
3289
|
KwikUIModule
|
|
3004
3290
|
],
|
|
3005
3291
|
exports: [KwikIDFormViewComponent]
|
|
@@ -3043,13 +3329,19 @@ class KwikIDFormRendererModule {
|
|
|
3043
3329
|
HttpClientModule,
|
|
3044
3330
|
KwikIDFormViewModule,
|
|
3045
3331
|
KwikIDFormsListModule,
|
|
3046
|
-
KwikUIModule
|
|
3332
|
+
KwikUIModule,
|
|
3333
|
+
TuiLoaderModule,
|
|
3334
|
+
TuiPushModule,
|
|
3335
|
+
TuiSvgModule], exports: [KwikIDFormsRendererComponent] });
|
|
3047
3336
|
/** @nocollapse */ KwikIDFormRendererModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormRendererModule, providers: [], imports: [[
|
|
3048
3337
|
CommonModule,
|
|
3049
3338
|
HttpClientModule,
|
|
3050
3339
|
KwikIDFormViewModule,
|
|
3051
3340
|
KwikIDFormsListModule,
|
|
3052
|
-
KwikUIModule
|
|
3341
|
+
KwikUIModule,
|
|
3342
|
+
TuiLoaderModule,
|
|
3343
|
+
TuiPushModule,
|
|
3344
|
+
TuiSvgModule
|
|
3053
3345
|
]] });
|
|
3054
3346
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: KwikIDFormRendererModule, decorators: [{
|
|
3055
3347
|
type: NgModule,
|
|
@@ -3060,7 +3352,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
3060
3352
|
HttpClientModule,
|
|
3061
3353
|
KwikIDFormViewModule,
|
|
3062
3354
|
KwikIDFormsListModule,
|
|
3063
|
-
KwikUIModule
|
|
3355
|
+
KwikUIModule,
|
|
3356
|
+
TuiLoaderModule,
|
|
3357
|
+
TuiPushModule,
|
|
3358
|
+
TuiSvgModule
|
|
3064
3359
|
],
|
|
3065
3360
|
providers: [],
|
|
3066
3361
|
exports: [KwikIDFormsRendererComponent]
|