kwikid-forms 0.1.7 → 0.1.8
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 +425 -281
- package/bundles/kwikid-forms.umd.js.map +1 -1
- package/esm2015/lib/renderer/form-view/definitions/actions/form-view.actions.enum.definitions.js +2 -1
- package/esm2015/lib/renderer/form-view/definitions/fields/form-view.fields.enum.definitions.js +2 -1
- package/esm2015/lib/renderer/form-view/definitions/fields/form-view.fields.type.definitions.js +1 -1
- package/esm2015/lib/renderer/form-view/form-view.component.js +109 -114
- package/esm2015/lib/renderer/form-view/form-view.module.js +4 -3
- package/esm2015/lib/renderer/form-view/form-view.service.js +4 -4
- package/esm2015/lib/renderer/form-view/helpers/form-view.apis.helper.js +11 -2
- package/esm2015/lib/renderer/form-view/helpers/form-view.defaults.helper.js +33 -2
- package/esm2015/lib/renderer/form-view/helpers/form-view.fields.helper.js +5 -5
- package/esm2015/lib/renderer/form-view/helpers/form-view.validations.helper.js +11 -2
- package/esm2015/lib/renderer/form-view/pipes/safe-html.pipe.js +25 -0
- package/esm2015/lib/renderer/renderer.config-converter.helper.js +109 -54
- package/fesm2015/kwikid-forms.js +300 -178
- package/fesm2015/kwikid-forms.js.map +1 -1
- package/lib/renderer/form-view/definitions/actions/form-view.actions.enum.definitions.d.ts +2 -1
- package/lib/renderer/form-view/definitions/fields/form-view.fields.enum.definitions.d.ts +1 -0
- package/lib/renderer/form-view/definitions/fields/form-view.fields.type.definitions.d.ts +10 -2
- package/lib/renderer/form-view/form-view.component.d.ts +2 -2
- package/lib/renderer/form-view/form-view.module.d.ts +7 -6
- package/lib/renderer/form-view/helpers/form-view.apis.helper.d.ts +2 -1
- package/lib/renderer/form-view/helpers/form-view.defaults.helper.d.ts +3 -1
- package/lib/renderer/form-view/helpers/form-view.validations.helper.d.ts +4 -1
- package/lib/renderer/form-view/pipes/safe-html.pipe.d.ts +15 -0
- package/package.json +3 -3
package/fesm2015/kwikid-forms.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { copyArrayItem, moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { VERSION, Component, EventEmitter, Inject, Input, Output, Injectable, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import { VERSION, Component, Pipe, EventEmitter, Inject, Input, Output, Injectable, HostListener, NgModule } from '@angular/core';
|
|
4
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';
|
|
@@ -11,12 +11,13 @@ import * as i3 from '@taiga-ui/core';
|
|
|
11
11
|
import { TuiAlertService, TuiLabelModule, TuiSvgModule, TuiLoaderModule } from '@taiga-ui/core';
|
|
12
12
|
import * as i4 from '@taiga-ui/kit';
|
|
13
13
|
import { TuiPushService, TuiPushModule } from '@taiga-ui/kit';
|
|
14
|
-
import { Sources, Rules, Condition, Actions, logMethod, isNotEmptyValue, checkObjectKeyExists, isEmptyValue, Validations as Validations$1 } from 'kwikid-toolkit';
|
|
14
|
+
import { Sources, Rules, Condition, Actions, logMethod, isNotEmptyValue, checkObjectKeyExists, isEmptyValue, isUndefined as isUndefined$1, replaceString as replaceString$1, getObjectValueFromPath, Validations as Validations$1 } from 'kwikid-toolkit';
|
|
15
15
|
import { pairwise } from 'rxjs/operators';
|
|
16
16
|
import jp from 'jsonpath';
|
|
17
17
|
import { TuiDay } from '@taiga-ui/cdk';
|
|
18
18
|
import * as i5 from '@angular/common';
|
|
19
19
|
import { CommonModule } from '@angular/common';
|
|
20
|
+
import * as i1 from '@angular/platform-browser';
|
|
20
21
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
21
22
|
import { HttpClientModule } from '@angular/common/http';
|
|
22
23
|
|
|
@@ -170,6 +171,7 @@ var EActionKey;
|
|
|
170
171
|
EActionKey["FIELD_GROUP_HIDE"] = "FIELD_GROUP_HIDE";
|
|
171
172
|
EActionKey["FIELD_GROUP_ENABLE"] = "FIELD_GROUP_ENABLE";
|
|
172
173
|
EActionKey["FIELD_GROUP_DISABLE"] = "FIELD_GROUP_DISABLE";
|
|
174
|
+
EActionKey["SET_DROPDOWN_OPTIONS"] = "SET_DROPDOWN_OPTIONS";
|
|
173
175
|
})(EActionKey || (EActionKey = {}));
|
|
174
176
|
|
|
175
177
|
var EApiStatusType;
|
|
@@ -283,6 +285,7 @@ var EMessageType;
|
|
|
283
285
|
|
|
284
286
|
var EFieldType;
|
|
285
287
|
(function (EFieldType) {
|
|
288
|
+
EFieldType["HTML"] = "html";
|
|
286
289
|
EFieldType["TITLE"] = "title";
|
|
287
290
|
EFieldType["TEXT"] = "text";
|
|
288
291
|
EFieldType["CHECKBOX"] = "checkbox";
|
|
@@ -478,8 +481,9 @@ const setEmptyValue = (field) => {
|
|
|
478
481
|
};
|
|
479
482
|
|
|
480
483
|
class Defaults {
|
|
481
|
-
constructor(field, allFormsData, formData, previousFormData, takeAction) {
|
|
484
|
+
constructor(field, formFields, allFormsData, formData, previousFormData, takeAction) {
|
|
482
485
|
this._field = field;
|
|
486
|
+
this._formFields = formFields;
|
|
483
487
|
this._allFormsData = allFormsData;
|
|
484
488
|
this._formData = formData;
|
|
485
489
|
this._previousFormData = previousFormData;
|
|
@@ -493,6 +497,7 @@ class Defaults {
|
|
|
493
497
|
for (let source of sources) {
|
|
494
498
|
const sources = new Sources({
|
|
495
499
|
FIELD_CONFIG: this._field,
|
|
500
|
+
FORM_FIELDS: this._formFields,
|
|
496
501
|
FORM_DATA: this._formData,
|
|
497
502
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
498
503
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -506,6 +511,7 @@ class Defaults {
|
|
|
506
511
|
const actions = validation.actions;
|
|
507
512
|
const rulesMapping = new Rules(rules, {
|
|
508
513
|
FIELD_CONFIG: this._field,
|
|
514
|
+
FORM_FIELDS: this._formFields,
|
|
509
515
|
FORM_DATA: this._formData,
|
|
510
516
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
511
517
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -515,6 +521,7 @@ class Defaults {
|
|
|
515
521
|
if (conditionEvaluation) {
|
|
516
522
|
const actions = new Actions(action, rulesMapping, {
|
|
517
523
|
FIELD_CONFIG: this._field,
|
|
524
|
+
FORM_FIELDS: this._formFields,
|
|
518
525
|
FORM_DATA: this._formData,
|
|
519
526
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
520
527
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -531,6 +538,33 @@ class Defaults {
|
|
|
531
538
|
return defaultValue;
|
|
532
539
|
});
|
|
533
540
|
}
|
|
541
|
+
getDefaultDropdownOptions() {
|
|
542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
543
|
+
const optionsConfig = this._field.default.options;
|
|
544
|
+
const rules = optionsConfig.rules;
|
|
545
|
+
const actions = optionsConfig.actions;
|
|
546
|
+
const rulesMapping = new Rules(rules, {
|
|
547
|
+
FIELD_CONFIG: this._field,
|
|
548
|
+
FORM_FIELDS: this._formFields,
|
|
549
|
+
FORM_DATA: this._formData,
|
|
550
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
551
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
552
|
+
}).mapping();
|
|
553
|
+
for (let action of actions) {
|
|
554
|
+
const conditionEvaluation = new Condition(action.condition, rulesMapping).evaluate();
|
|
555
|
+
if (conditionEvaluation) {
|
|
556
|
+
const actions = new Actions(action, rulesMapping, {
|
|
557
|
+
FIELD_CONFIG: this._field,
|
|
558
|
+
FORM_FIELDS: this._formFields,
|
|
559
|
+
FORM_DATA: this._formData,
|
|
560
|
+
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
561
|
+
ALL_FORMS_DATA: this._allFormsData
|
|
562
|
+
}, this._takeAction);
|
|
563
|
+
yield actions.execute();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
534
568
|
}
|
|
535
569
|
__decorate([
|
|
536
570
|
logMethod
|
|
@@ -716,10 +750,10 @@ const convertValueFromBasicFormatToKwikUIFormat = (field, value) => {
|
|
|
716
750
|
switch (field.type) {
|
|
717
751
|
case EFieldType.RADIO:
|
|
718
752
|
if (!checkObjectKeyExists(value, "label")) {
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
};
|
|
753
|
+
const radioField = field;
|
|
754
|
+
const convertedLabelValue = radioField.options.find((item) => {
|
|
755
|
+
return item.label === value;
|
|
756
|
+
});
|
|
723
757
|
convertedValue = convertedLabelValue;
|
|
724
758
|
}
|
|
725
759
|
break;
|
|
@@ -736,8 +770,9 @@ const convertValueFromBasicFormatToKwikUIFormat = (field, value) => {
|
|
|
736
770
|
};
|
|
737
771
|
|
|
738
772
|
class Validations {
|
|
739
|
-
constructor(field, formData, previousFormData, allFormsData, takeAction) {
|
|
773
|
+
constructor(field, formFields, formData, previousFormData, allFormsData, takeAction) {
|
|
740
774
|
this._field = field;
|
|
775
|
+
this._formFields = formFields;
|
|
741
776
|
this._formData = formData;
|
|
742
777
|
this._previousFormData = previousFormData;
|
|
743
778
|
this._allFormsData = allFormsData;
|
|
@@ -767,6 +802,12 @@ class Validations {
|
|
|
767
802
|
set field(value) {
|
|
768
803
|
this._field = value;
|
|
769
804
|
}
|
|
805
|
+
get formFields() {
|
|
806
|
+
return this._formFields;
|
|
807
|
+
}
|
|
808
|
+
set formFields(value) {
|
|
809
|
+
this._formFields = value;
|
|
810
|
+
}
|
|
770
811
|
getFieldValidators(field) {
|
|
771
812
|
let validators = [];
|
|
772
813
|
if (checkObjectKeyExists(field, "validators") &&
|
|
@@ -860,6 +901,7 @@ class Validations {
|
|
|
860
901
|
const actions = validations.actions;
|
|
861
902
|
const rulesMapping = new Rules(rules, {
|
|
862
903
|
FIELD_CONFIG: this._field,
|
|
904
|
+
FORM_FIELDS: this._formFields,
|
|
863
905
|
FORM_DATA: this._formData,
|
|
864
906
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
865
907
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -869,6 +911,7 @@ class Validations {
|
|
|
869
911
|
if (conditionEvaluation) {
|
|
870
912
|
const actions = new Actions(action, rulesMapping, {
|
|
871
913
|
FIELD_CONFIG: this._field,
|
|
914
|
+
FORM_FIELDS: this._formFields,
|
|
872
915
|
FORM_DATA: this._formData,
|
|
873
916
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
874
917
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -899,11 +942,11 @@ class KwikIDFormViewService {
|
|
|
899
942
|
return __awaiter(this, void 0, void 0, function* () {
|
|
900
943
|
let formGroup = new FormGroup({});
|
|
901
944
|
for (let field of fields) {
|
|
902
|
-
if (field.
|
|
903
|
-
const defaults = new Defaults(field, allFormsData, formData, previousFormData, takeAction);
|
|
945
|
+
if (field.isFormElement) {
|
|
946
|
+
const defaults = new Defaults(field, fields, allFormsData, formData, previousFormData, takeAction);
|
|
904
947
|
let value = yield defaults.getDefaultValue();
|
|
905
948
|
value = convertValueFromBasicFormatToKwikUIFormat(field, value);
|
|
906
|
-
const validators = new Validations(field, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
|
|
949
|
+
const validators = new Validations(field, fields, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
|
|
907
950
|
formGroup.addControl(field.key, new FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
|
|
908
951
|
}
|
|
909
952
|
}
|
|
@@ -916,8 +959,9 @@ __decorate([
|
|
|
916
959
|
], KwikIDFormViewService.prototype, "createFormGroup", null);
|
|
917
960
|
|
|
918
961
|
class Apis {
|
|
919
|
-
constructor(field, formData, previousFormData, allFormsData, takeAction) {
|
|
962
|
+
constructor(field, formFields, formData, previousFormData, allFormsData, takeAction) {
|
|
920
963
|
this._field = field;
|
|
964
|
+
this._formFields = formFields;
|
|
921
965
|
this._formData = formData;
|
|
922
966
|
this._previousFormData = previousFormData;
|
|
923
967
|
this._allFormsData = allFormsData;
|
|
@@ -938,6 +982,7 @@ class Apis {
|
|
|
938
982
|
for (let source of sources) {
|
|
939
983
|
const sources = new Sources({
|
|
940
984
|
FIELD_CONFIG: this._field,
|
|
985
|
+
FORM_FIELDS: this._formFields,
|
|
941
986
|
FORM_DATA: this._formData,
|
|
942
987
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
943
988
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -951,6 +996,7 @@ class Apis {
|
|
|
951
996
|
const actions = (_d = (_c = validation) === null || _c === void 0 ? void 0 : _c.actions) !== null && _d !== void 0 ? _d : [];
|
|
952
997
|
const rulesMapping = new Rules(rules, {
|
|
953
998
|
FIELD_CONFIG: this._field,
|
|
999
|
+
FORM_FIELDS: this._formFields,
|
|
954
1000
|
FORM_DATA: this._formData,
|
|
955
1001
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
956
1002
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -960,6 +1006,7 @@ class Apis {
|
|
|
960
1006
|
if (conditionEvaluation) {
|
|
961
1007
|
const actions = new Actions(action, rulesMapping, {
|
|
962
1008
|
FIELD_CONFIG: this._field,
|
|
1009
|
+
FORM_FIELDS: this._formFields,
|
|
963
1010
|
FORM_DATA: this._formData,
|
|
964
1011
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
965
1012
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -984,6 +1031,7 @@ class Apis {
|
|
|
984
1031
|
const actions = (_a = validation) === null || _a === void 0 ? void 0 : _a.actions;
|
|
985
1032
|
const rulesMapping = new Rules(rules, {
|
|
986
1033
|
FIELD_CONFIG: this._field,
|
|
1034
|
+
FORM_FIELDS: this._formFields,
|
|
987
1035
|
FORM_DATA: this._formData,
|
|
988
1036
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
989
1037
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -993,6 +1041,7 @@ class Apis {
|
|
|
993
1041
|
if (conditionSuccess) {
|
|
994
1042
|
const actions = new Actions(action, rulesMapping, {
|
|
995
1043
|
FIELD_CONFIG: this._field,
|
|
1044
|
+
FORM_FIELDS: this._formFields,
|
|
996
1045
|
FORM_DATA: this._formData,
|
|
997
1046
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
998
1047
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -1011,6 +1060,7 @@ class Apis {
|
|
|
1011
1060
|
const actions = validation.actions;
|
|
1012
1061
|
const rulesMapping = new Rules(rules, {
|
|
1013
1062
|
FIELD_CONFIG: this._field,
|
|
1063
|
+
FORM_FIELDS: this._formFields,
|
|
1014
1064
|
FORM_DATA: this._formData,
|
|
1015
1065
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
1016
1066
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -1020,6 +1070,7 @@ class Apis {
|
|
|
1020
1070
|
if (conditionSuccess) {
|
|
1021
1071
|
const actions = new Actions(action, rulesMapping, {
|
|
1022
1072
|
FIELD_CONFIG: this._field,
|
|
1073
|
+
FORM_FIELDS: this._formFields,
|
|
1023
1074
|
FORM_DATA: this._formData,
|
|
1024
1075
|
PREVIOUS_FORM_DATA: this._previousFormData,
|
|
1025
1076
|
ALL_FORMS_DATA: this._allFormsData
|
|
@@ -1033,6 +1084,7 @@ class Apis {
|
|
|
1033
1084
|
getPropsValues() {
|
|
1034
1085
|
return {
|
|
1035
1086
|
field: this._field,
|
|
1087
|
+
formFields: this._formFields,
|
|
1036
1088
|
formData: this._formData,
|
|
1037
1089
|
previousFormData: this._previousFormData,
|
|
1038
1090
|
allFormsData: this._allFormsData
|
|
@@ -1049,6 +1101,28 @@ __decorate([
|
|
|
1049
1101
|
logMethod
|
|
1050
1102
|
], Apis.prototype, "validateApiCallResponse", null);
|
|
1051
1103
|
|
|
1104
|
+
/**
|
|
1105
|
+
* Generated class for the SafeHtmlPipe pipe.
|
|
1106
|
+
*
|
|
1107
|
+
* See https://angular.io/api/core/Pipe for more info on Angular Pipes.
|
|
1108
|
+
*/
|
|
1109
|
+
class SafeHtmlPipe {
|
|
1110
|
+
constructor(sanitizer) {
|
|
1111
|
+
this.sanitizer = sanitizer;
|
|
1112
|
+
}
|
|
1113
|
+
transform(html) {
|
|
1114
|
+
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
/** @nocollapse */ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1118
|
+
/** @nocollapse */ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
|
|
1119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SafeHtmlPipe, decorators: [{
|
|
1120
|
+
type: Pipe,
|
|
1121
|
+
args: [{
|
|
1122
|
+
name: "safeHtml"
|
|
1123
|
+
}]
|
|
1124
|
+
}], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
|
|
1125
|
+
|
|
1052
1126
|
class KwikIDFormViewComponent {
|
|
1053
1127
|
constructor(push, alert, formViewService) {
|
|
1054
1128
|
this.push = push;
|
|
@@ -1096,7 +1170,7 @@ class KwikIDFormViewComponent {
|
|
|
1096
1170
|
[this.apiCallResponse.key]: this.apiCallResponse.response
|
|
1097
1171
|
}, { emitEvent: false });
|
|
1098
1172
|
let field = findFieldFromKey(this.formFields, this.apiCallResponse.key);
|
|
1099
|
-
const apis = new Apis(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1173
|
+
const apis = new Apis(field, this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1100
1174
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1101
1175
|
field = yield apis.validateApiCallResponse();
|
|
1102
1176
|
}))();
|
|
@@ -1124,7 +1198,7 @@ class KwikIDFormViewComponent {
|
|
|
1124
1198
|
this.setFormDataFromAllFormsData();
|
|
1125
1199
|
this.formGroup = yield this.formViewService.createFormGroup(this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1126
1200
|
for (let field of this.formFields) {
|
|
1127
|
-
if (field.
|
|
1201
|
+
if (field.isFormElement) {
|
|
1128
1202
|
this.previousFormData = Object.assign(Object.assign({}, this.previousFormData), { [field.key]: this.formGroup.controls[field.key].value });
|
|
1129
1203
|
this.formGroup.controls[field.key].valueChanges
|
|
1130
1204
|
.pipe(pairwise())
|
|
@@ -1135,13 +1209,29 @@ class KwikIDFormViewComponent {
|
|
|
1135
1209
|
}
|
|
1136
1210
|
}
|
|
1137
1211
|
for (let field of this.formFields) {
|
|
1138
|
-
if (field.
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1212
|
+
if (field.isFormElement) {
|
|
1213
|
+
if (field.validation.triggers.includes("ON_INIT")) {
|
|
1214
|
+
const validations = new Validations(field, this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1215
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1216
|
+
yield validations.validateField();
|
|
1217
|
+
}))();
|
|
1218
|
+
}
|
|
1219
|
+
if (checkObjectKeyExists(field, "connectedElements")) {
|
|
1220
|
+
if (checkObjectKeyExists(field.connectedElements, "connectedFields")) {
|
|
1221
|
+
this.handleConnectedElements({
|
|
1222
|
+
key: field.key,
|
|
1223
|
+
value: this.formGroup.controls[field.key].value
|
|
1224
|
+
}, "ON_INIT");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
if (checkObjectKeyExists(field, "default")) {
|
|
1228
|
+
if (checkObjectKeyExists(field.default, "options")) {
|
|
1229
|
+
if (field.default.options.triggers.includes("ON_INIT")) {
|
|
1230
|
+
const defaults = new Defaults(field, this.formFields, this.allFormsData, this.formData, this.previousFormData, this.takeAction);
|
|
1231
|
+
yield defaults.getDefaultDropdownOptions();
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1145
1235
|
}
|
|
1146
1236
|
}
|
|
1147
1237
|
});
|
|
@@ -1180,6 +1270,7 @@ class KwikIDFormViewComponent {
|
|
|
1180
1270
|
if (conditionSuccess) {
|
|
1181
1271
|
const actions = new Actions(action, rulesMapping, {
|
|
1182
1272
|
FIELD_CONFIG: parentField,
|
|
1273
|
+
FORM_FIELDS: this.formFields,
|
|
1183
1274
|
FORM_DATA: this.formData,
|
|
1184
1275
|
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1185
1276
|
ALL_FORMS_DATA: this.allFormsData
|
|
@@ -1192,29 +1283,10 @@ class KwikIDFormViewComponent {
|
|
|
1192
1283
|
}
|
|
1193
1284
|
handleConnectedElementFieldGroup(currentField, connectedFieldGroupConfig, eventType) {
|
|
1194
1285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1200
|
-
}
|
|
1201
|
-
break;
|
|
1202
|
-
case "VALUE_CHANGE":
|
|
1203
|
-
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers") &&
|
|
1204
|
-
connectedFieldGroupConfig.triggers.includes("VALUE_CHANGE")) {
|
|
1205
|
-
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1206
|
-
}
|
|
1207
|
-
break;
|
|
1208
|
-
case "NESTED_LINK":
|
|
1209
|
-
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers") &&
|
|
1210
|
-
connectedFieldGroupConfig.triggers.includes("NESTED_LINK")) {
|
|
1211
|
-
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1212
|
-
}
|
|
1213
|
-
default:
|
|
1214
|
-
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers")) {
|
|
1215
|
-
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1216
|
-
}
|
|
1217
|
-
break;
|
|
1286
|
+
if (checkObjectKeyExists(connectedFieldGroupConfig, "triggers")) {
|
|
1287
|
+
if (connectedFieldGroupConfig.triggers.includes(eventType)) {
|
|
1288
|
+
yield this.handleConnectedElementFieldGroupActions(connectedFieldGroupConfig, currentField);
|
|
1289
|
+
}
|
|
1218
1290
|
}
|
|
1219
1291
|
});
|
|
1220
1292
|
}
|
|
@@ -1231,6 +1303,7 @@ class KwikIDFormViewComponent {
|
|
|
1231
1303
|
const conditionSuccess = new Condition(action.condition, rulesMapping).evaluate();
|
|
1232
1304
|
if (conditionSuccess) {
|
|
1233
1305
|
const actions = new Actions(action, rulesMapping, {
|
|
1306
|
+
FORM_FIELDS: this.formFields,
|
|
1234
1307
|
FIELD_CONFIG: connectedField,
|
|
1235
1308
|
FORM_DATA: this.formData,
|
|
1236
1309
|
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
@@ -1243,56 +1316,23 @@ class KwikIDFormViewComponent {
|
|
|
1243
1316
|
return connectedField;
|
|
1244
1317
|
});
|
|
1245
1318
|
}
|
|
1246
|
-
handleConnectedElementFields(currentField, connectedFieldConfig, eventType) {
|
|
1319
|
+
handleConnectedElementFields(currentField, connectedFieldConfig, eventType, nested) {
|
|
1247
1320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1248
1321
|
let connectedField = findFieldFromKey(this.formFields, connectedFieldConfig["key"]);
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
}
|
|
1322
|
+
if (checkObjectKeyExists(connectedFieldConfig, "triggers")) {
|
|
1323
|
+
if (connectedFieldConfig.triggers.includes(eventType)) {
|
|
1324
|
+
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
if (checkObjectKeyExists(connectedFieldConfig, "handleNestedFields")) {
|
|
1328
|
+
if (connectedFieldConfig.handleNestedFields) {
|
|
1329
|
+
if (checkObjectKeyExists(connectedField, "connectedElements")) {
|
|
1330
|
+
if (checkObjectKeyExists(connectedField.connectedElements, "connectedFields")) {
|
|
1331
|
+
for (const connectedFieldConfig of connectedField.connectedElements
|
|
1332
|
+
.connectedFields) {
|
|
1333
|
+
connectedField = this.handleConnectedElementFields(connectedField, connectedFieldConfig, eventType, "NESTED");
|
|
1262
1334
|
}
|
|
1263
1335
|
}
|
|
1264
|
-
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1265
|
-
}
|
|
1266
|
-
break;
|
|
1267
|
-
case "VALUE_CHANGE":
|
|
1268
|
-
if (checkObjectKeyExists(connectedFieldConfig, "triggers") &&
|
|
1269
|
-
connectedFieldConfig.triggers.includes("VALUE_CHANGE")) {
|
|
1270
|
-
switch (connectedField.type) {
|
|
1271
|
-
case "dropdown-with-search":
|
|
1272
|
-
connectedField = yield this.handleFieldTypeSearchText(currentField, connectedField);
|
|
1273
|
-
break;
|
|
1274
|
-
default:
|
|
1275
|
-
break;
|
|
1276
|
-
}
|
|
1277
|
-
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1278
|
-
}
|
|
1279
|
-
break;
|
|
1280
|
-
case "NESTED_LINK":
|
|
1281
|
-
if (checkObjectKeyExists(connectedFieldConfig, "triggers") &&
|
|
1282
|
-
connectedFieldConfig.triggers.includes("NESTED_LINK")) {
|
|
1283
|
-
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1284
|
-
}
|
|
1285
|
-
default:
|
|
1286
|
-
if (checkObjectKeyExists(connectedFieldConfig, "triggers")) {
|
|
1287
|
-
connectedField = yield this.handleConnectedElementFieldActions(connectedFieldConfig, connectedField);
|
|
1288
|
-
}
|
|
1289
|
-
break;
|
|
1290
|
-
}
|
|
1291
|
-
if (checkObjectKeyExists(connectedField, "connectedElements")) {
|
|
1292
|
-
if (checkObjectKeyExists(connectedField.connectedElements, "connectedFields")) {
|
|
1293
|
-
for (const connectedFieldConfig of connectedField.connectedElements
|
|
1294
|
-
.connectedFields) {
|
|
1295
|
-
connectedField = this.handleConnectedElementFields(connectedField, connectedFieldConfig, "NESTED_LINK");
|
|
1296
1336
|
}
|
|
1297
1337
|
}
|
|
1298
1338
|
}
|
|
@@ -1313,7 +1353,7 @@ class KwikIDFormViewComponent {
|
|
|
1313
1353
|
if (checkObjectKeyExists(currentField.connectedElements, "connectedFields")) {
|
|
1314
1354
|
let connectedFields = currentField.connectedElements.connectedFields;
|
|
1315
1355
|
for (let connectedFieldConfig of connectedFields) {
|
|
1316
|
-
currentField = yield this.handleConnectedElementFields(currentField, connectedFieldConfig, eventType);
|
|
1356
|
+
currentField = yield this.handleConnectedElementFields(currentField, connectedFieldConfig, eventType, eventType);
|
|
1317
1357
|
}
|
|
1318
1358
|
}
|
|
1319
1359
|
}
|
|
@@ -1330,16 +1370,21 @@ class KwikIDFormViewComponent {
|
|
|
1330
1370
|
}, { emitEvent: false });
|
|
1331
1371
|
// Currently set only for dropdown-with-search connected fields
|
|
1332
1372
|
let field = findFieldFromKey(this.formFields, e.key);
|
|
1333
|
-
if (field.
|
|
1373
|
+
if (field.isFormElement &&
|
|
1334
1374
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
1335
|
-
const validations = new Validations(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1375
|
+
const validations = new Validations(field, this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1336
1376
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1337
1377
|
yield validations.validateField();
|
|
1338
1378
|
}))();
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1379
|
+
}
|
|
1380
|
+
if (field.isFormElement &&
|
|
1381
|
+
checkObjectKeyExists(field, "connectedElements")) {
|
|
1382
|
+
if (checkObjectKeyExists(field.connectedElements, "connectedFields")) {
|
|
1383
|
+
this.handleConnectedElements({
|
|
1384
|
+
key: field.key,
|
|
1385
|
+
value: this.formGroup.controls[field.key].value
|
|
1386
|
+
}, "ON_CHANGE");
|
|
1387
|
+
}
|
|
1343
1388
|
}
|
|
1344
1389
|
}
|
|
1345
1390
|
handleOnClickResetFormFields(e, field) {
|
|
@@ -1349,6 +1394,7 @@ class KwikIDFormViewComponent {
|
|
|
1349
1394
|
const resetField = findFieldFromKey(this.formFields, action.props.fieldKey);
|
|
1350
1395
|
const actions = new Actions(action, {}, {
|
|
1351
1396
|
FIELD_CONFIG: resetField,
|
|
1397
|
+
FORM_FIELDS: this.formFields,
|
|
1352
1398
|
FORM_DATA: this.formData,
|
|
1353
1399
|
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
1354
1400
|
ALL_FORMS_DATA: this.allFormsData
|
|
@@ -1369,7 +1415,7 @@ class KwikIDFormViewComponent {
|
|
|
1369
1415
|
this.viewFormsButton["showLoader"] = true;
|
|
1370
1416
|
this.saveFormButton["disabled"] = true;
|
|
1371
1417
|
this.saveFormButton["showLoader"] = true;
|
|
1372
|
-
const apis = new Apis(field, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1418
|
+
const apis = new Apis(field, this.formFields, this.formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1373
1419
|
field = yield apis.setRequestBodyParams();
|
|
1374
1420
|
field = yield apis.validateRequestBody();
|
|
1375
1421
|
if (field.api.request.body.validation.is_valid) {
|
|
@@ -1420,14 +1466,14 @@ class KwikIDFormViewComponent {
|
|
|
1420
1466
|
for (let field of this.formFields) {
|
|
1421
1467
|
if (field.type !== EFieldType.TITLE &&
|
|
1422
1468
|
field.validation.triggers.includes("ON_SAVE")) {
|
|
1423
|
-
const validations = new Validations(field, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1469
|
+
const validations = new Validations(field, this.formFields, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this));
|
|
1424
1470
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1425
1471
|
yield validations.validateField();
|
|
1426
1472
|
}))();
|
|
1427
1473
|
}
|
|
1428
1474
|
}
|
|
1429
1475
|
if (this.formGroup.invalid) {
|
|
1430
|
-
const controls = new Validations(undefined, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
|
|
1476
|
+
const controls = new Validations(undefined, this.formFields, formData, this.previousFormData, this.allFormsData, this.takeAction.bind(this)).findInvalidControlsRecursive(this.formGroup);
|
|
1431
1477
|
let firstFieldWithError = "";
|
|
1432
1478
|
for (let control of controls) {
|
|
1433
1479
|
if (control.invalid && isEmptyValue(firstFieldWithError)) {
|
|
@@ -1595,6 +1641,14 @@ class KwikIDFormViewComponent {
|
|
|
1595
1641
|
[key]: value
|
|
1596
1642
|
}, { emitEvent: false });
|
|
1597
1643
|
}
|
|
1644
|
+
patchFormGroup(formData) {
|
|
1645
|
+
if (isUndefined$1(this.formGroup) || isUndefined$1(formData)) {
|
|
1646
|
+
throw new Error(`formGroup or formData is 'undefined'.`);
|
|
1647
|
+
}
|
|
1648
|
+
else {
|
|
1649
|
+
this.formGroup.patchValue(formData, { emitEvent: false });
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1598
1652
|
isFieldValid(fieldKey) {
|
|
1599
1653
|
return this.formGroup.controls[fieldKey].valid;
|
|
1600
1654
|
}
|
|
@@ -1604,17 +1658,6 @@ class KwikIDFormViewComponent {
|
|
|
1604
1658
|
getFormGroupRawValues() {
|
|
1605
1659
|
return this.formGroup.getRawValue();
|
|
1606
1660
|
}
|
|
1607
|
-
handleFieldTypeSearchText(field, childField) {
|
|
1608
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1609
|
-
if (checkObjectKeyExists(childField, "json")) {
|
|
1610
|
-
childField.options = getSearchTextOptionsFromFieldConfig(field, childField, this.formGroup);
|
|
1611
|
-
}
|
|
1612
|
-
if (checkObjectKeyExists(childField, "fetchJsonFromRemote")) {
|
|
1613
|
-
childField.options = yield getSearchTextOptionsFromRemoteFile(field, childField, this.formGroup);
|
|
1614
|
-
}
|
|
1615
|
-
return childField;
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
1661
|
takeActionOnFieldGroup(action, field, allFormsData, formData, previousFormData) {
|
|
1619
1662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1620
1663
|
switch (action.key) {
|
|
@@ -1666,13 +1709,37 @@ class KwikIDFormViewComponent {
|
|
|
1666
1709
|
this.fieldMessageHide(action.props.fieldKey, action.props.message);
|
|
1667
1710
|
break;
|
|
1668
1711
|
case EActionKey.SET_VALUE:
|
|
1669
|
-
const
|
|
1670
|
-
const sourceValue = yield
|
|
1671
|
-
|
|
1672
|
-
object.FIELD_CONFIG =
|
|
1673
|
-
this.formData =
|
|
1674
|
-
this.
|
|
1675
|
-
this.
|
|
1712
|
+
const setValue_Sources = new Sources(object);
|
|
1713
|
+
const sourceValue = yield setValue_Sources.getValueFromSource(action.props.value.source);
|
|
1714
|
+
setValue_Sources.setValueToSource(action.props.value.destination, sourceValue);
|
|
1715
|
+
object.FIELD_CONFIG = setValue_Sources.object.FIELD_CONFIG;
|
|
1716
|
+
this.formData = setValue_Sources.object.FORM_DATA;
|
|
1717
|
+
this.patchFormGroup(this.formData);
|
|
1718
|
+
this.allFormsData = setValue_Sources.object.ALL_FORMS_DATA;
|
|
1719
|
+
this.previousFormData = setValue_Sources.object.PREVIOUS_FORM_DATA;
|
|
1720
|
+
break;
|
|
1721
|
+
case EActionKey.SET_DROPDOWN_OPTIONS:
|
|
1722
|
+
const setDropdownValue_Sources = new Sources(object);
|
|
1723
|
+
let dropdownValue = yield setDropdownValue_Sources.getValueFromSource(action.props.value.source);
|
|
1724
|
+
if (checkObjectKeyExists(action.props, "options")) {
|
|
1725
|
+
if (checkObjectKeyExists(action.props.options, "appendToPath")) {
|
|
1726
|
+
let appendToPath = yield setDropdownValue_Sources.getValueFromSource(action.props.options.appendToPath.source);
|
|
1727
|
+
if (isNotEmptyValue(appendToPath)) {
|
|
1728
|
+
const appendToPathStr = replaceString$1(appendToPath.match(`${action.props.options.appendToPath.filterSourceValue}`)[0], "[^a-zA-Z0-9_]", "_");
|
|
1729
|
+
const optionsPath = `${action.props.options.path}${appendToPathStr}`;
|
|
1730
|
+
dropdownValue = getObjectValueFromPath(dropdownValue, optionsPath);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
else {
|
|
1734
|
+
dropdownValue = getObjectValueFromPath(dropdownValue, action.props.options.path);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
setDropdownValue_Sources.setValueToSource(action.props.value.destination, dropdownValue);
|
|
1738
|
+
object.FIELD_CONFIG = setDropdownValue_Sources.object.FIELD_CONFIG;
|
|
1739
|
+
this.formData = setDropdownValue_Sources.object.FORM_DATA;
|
|
1740
|
+
this.allFormsData = setDropdownValue_Sources.object.ALL_FORMS_DATA;
|
|
1741
|
+
this.previousFormData =
|
|
1742
|
+
setDropdownValue_Sources.object.PREVIOUS_FORM_DATA;
|
|
1676
1743
|
break;
|
|
1677
1744
|
case EActionKey.HANDLE_CONNECTED_ELEMENTS:
|
|
1678
1745
|
this.handleConnectedElements({ key: action.props.fieldKey }, "ACTION");
|
|
@@ -1686,7 +1753,7 @@ class KwikIDFormViewComponent {
|
|
|
1686
1753
|
}
|
|
1687
1754
|
}
|
|
1688
1755
|
/** @nocollapse */ KwikIDFormViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: KwikIDFormViewComponent, deps: [{ token: TuiPushService }, { token: TuiAlertService }, { token: KwikIDFormViewService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1689
|
-
/** @nocollapse */ KwikIDFormViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", 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\n class=\"kwikid-form-container\"\n *ngIf=\"!this.loading\"\n>\n <div id=\"uf-form-fields-header-container\">\n <div id=\"uf-form-fields-title\">\n {{ this.formConfig.title }}\n </div>\n <div id=\"uf-form-fields-steps\">\n Step {{ this.formConfig.sequenceNo }} of {{ this.formsList.length }}\n </div>\n <hr />\n </div>\n <form\n class=\"kwikid-form show\"\n [formGroup]=\"this.formGroup\"\n >\n <ng-container *ngFor=\"let field of this.formFields; let i = index\">\n <ng-container [ngSwitch]=\"field.type\">\n <!-- Form Title -->\n <ng-container *ngSwitchCase=\"'title'\">\n <div\n class=\"title\"\n [class.hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <div>\n {{ field.label }}\n </div>\n <kwikui-button\n *ngIf=\"field?.reset\"\n appearance=\"whiteblock\"\n size=\"s\"\n label=\"Reset\"\n (onClick)=\"this.handleOnClickResetFormFields($event, field)\"\n ></kwikui-button>\n </div>\n </ng-container>\n <!-- Input Text -->\n <ng-container *ngSwitchCase=\"'text'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input\n [case]=\"field?.properties?.case\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [placeholder]=\"field?.properties?.placeholder\"\n [type]=\"'text'\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Checkbox -->\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-checkbox-block\n [contentAlign]=\"field?.properties?.contentAlign ?? 'left'\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.properties?.placeholder\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [size]=\"field?.properties?.size ?? 'l'\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-checkbox-block\n ><kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Number -->\n <ng-container *ngSwitchCase=\"'number'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-number\n [decimal]=\"field?.properties?.decimal\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [max]=\"field?.properties?.max\"\n [min]=\"field?.properties?.min\"\n [placeholder]=\"field?.properties?.placeholder\"\n [postfix]=\"field?.properties?.postfix ?? ''\"\n [precision]=\"field?.properties?.precision\"\n [prefix]=\"field?.properties?.prefix ?? ''\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-number\n ><kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Date -->\n <ng-container *ngSwitchCase=\"'date'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-date\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [max]=\"field?.properties?.max\"\n [min]=\"field?.properties?.min\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-date>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Phone -->\n <ng-container *ngSwitchCase=\"'phone'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-phone\n [countryCode]=\"field?.properties?.countryCode\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [phoneMaskAfterCountryCode]=\"\n field?.properties?.phoneMaskAfterCountryCode\n \"\n [placeholder]=\"field?.properties?.placeholder\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-phone>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Radio -->\n <ng-container *ngSwitchCase=\"'radio'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <label\n [tuiLabel]=\"labelTemplate\"\n style=\"min-height: auto\"\n >\n <kwikui-radio-list\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [items]=\"field?.options\"\n [label]=\"field?.label\"\n [orientation]=\"field?.properties?.orientation\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [size]=\"field?.properties?.size\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-radio-list>\n </label>\n <ng-template #labelTemplate>\n <p\n class=\"tui-space_bottom-2\"\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <b>\n {{ field.label }}\n <span *ngIf=\"field.validators?.required\"></span>\n </b>\n </p>\n </ng-template>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Dropdown -->\n <ng-container *ngSwitchCase=\"'dropdown-with-search'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-select-combobox\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [options]=\"field.options\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-select-combobox>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- API Call -->\n <ng-container *ngSwitchCase=\"'api-call'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-button-api-call\n [apiStatus]=\"field?.api?.status?.value\"\n [class]=\"field?.class\"\n [disabled]=\"field?.disabled\"\n [id]=\"field.key\"\n [label]=\"field?.api?.status?.labels[field?.api?.status?.value]\"\n [showLoader]=\"field?.disabled === 'loading'\"\n shape=\"null\"\n size=\"m\"\n styles=\"width: fit-content\"\n (onClick)=\"this.handleOnClickApiCall($event)\"\n ></kwikui-button-api-call>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Mobile OTP -->\n <ng-container *ngSwitchCase=\"'otp'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-otp\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [mask]=\"field?.properties?.mask\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-otp>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Aadhaar Number -->\n <ng-container *ngSwitchCase=\"'aadhaar-number'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-aadhaar\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [placeholder]=\"field?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-aadhaar>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n </ng-container>\n </ng-container>\n </form>\n <div class=\"kwikid-form-buttons\">\n <kwikui-button\n *ngIf=\"this.isMobileView\"\n [disabled]=\"viewFormsButton.disabled\"\n id=\"\"\n label=\"View Forms\"\n [showLoader]=\"viewFormsButton.showLoader\"\n styles=\"\"\n class=\"\"\n type=\"button\"\n appearance=\"secondary\"\n icon=\"\"\n iconRight=\"\"\n [shape]=\"null\"\n size=\"m\"\n styles=\"width: 100%\"\n (onClick)=\"this.handleOnClickViewForms($event)\"\n ></kwikui-button>\n <kwikui-button\n [disabled]=\"saveFormButton.disabled\"\n id=\"\"\n label=\"Save\"\n [showLoader]=\"saveFormButton.showLoader\"\n styles=\"\"\n class=\"\"\n type=\"button\"\n appearance=\"primary\"\n icon=\"\"\n iconRight=\"\"\n [shape]=\"null\"\n size=\"m\"\n styles=\"width: 100%\"\n (onClick)=\"this.handleOnClickSaveForm($event)\"\n ></kwikui-button>\n </div>\n</div>\n<div\n class=\"kwikid-form-container-loading\"\n *ngIf=\"this.loading\"\n>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n</div>\n<tui-push\n id=\"field-error-notification\"\n *tuiPush=\"showErrorNotification\"\n heading=\"Missing/Incorrect Fields!\"\n type=\"Error\"\n (close)=\"toggleErrorNotification(false)\"\n>\n <tui-svg\n src=\"tuiIconCancel\"\n style=\"color: #fff !important\"\n >\n </tui-svg>\n</tui-push>\n", styles: ["::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{background:lightgray;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:gray}.kwikid-form-container{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center}.kwikid-form.show{width:100%;height:100%;padding:1rem;overflow-y:auto;display:flex;flex-direction:column;align-content:center;justify-content:flex-start;align-items:stretch;grid-row-gap:1rem;row-gap:1rem}.kwikid-form-buttons{width:100%;bottom:0px;padding:1rem;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;grid-column-gap:10px;column-gap:10px}.kwikid-form-buttons *{flex-grow:1}#uf-form-fields-header-container{display:flex;flex-direction:column;align-content:center;justify-content:center;align-items:flex-start;grid-row-gap:.5rem;row-gap:.5rem;padding:1rem}#uf-form-fields-header-container hr{width:100%}#uf-form-fields-title{color:#000;font-size:1.75em;font-weight:bold}#uf-form-fields-steps{color:var(--color-on-secondary-container);font-size:1em}.title{border-left:.25rem solid var(--tui-primary);padding:.75rem;font-size:1.4em;font-weight:bold;background-color:var(--tui-secondary);display:flex;flex-direction:row;align-content:center;justify-content:space-between;align-items:center;grid-gap:.5rem;gap:.5rem}.title:not(:first-child){margin-top:.5rem}.title.hidden{display:none}.large-wrapper{width:100%;height:60px}.large-wrapper:first-child{margin-bottom:auto}.large-wrapper:last-child{margin-top:auto}.kwikid-form-container-loading{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;grid-row-gap:1rem;row-gap:1rem;padding:1rem}#field-error-notification{background-color:var(--tui-error-fill);color:#fff!important}#field-error-notification .t-top{color:#fff!important}#field-error-notification .t-close{color:#fff!important}\n"], components: [{ type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }, { type: i2.KwikUIInputComponent, selector: "kwikui-input", inputs: ["label", "id", "type", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "validators", "case", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIMessagesComponent, selector: "kwikui-messages", inputs: ["messages", "id"] }, { type: i2.KwikUICheckboxBlockComponent, selector: "kwikui-checkbox-block", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "contentAlign", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputNumberComponent, selector: "kwikui-input-number", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "countryCode", "phoneMaskAfterCountryCode", "removeCountryCodeFromValue", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i3.TuiLabelComponent, selector: "label[tuiLabel]", inputs: ["tuiLabel", "context"] }, { type: i2.KwikUIRadioListComponent, selector: "kwikui-radio-list", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "orientation", "items", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUISelectComboboxComponent, selector: "kwikui-select-combobox", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "options", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIButtonApiCallComponent, selector: "kwikui-button-api-call", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "shape", "size", "apiStatus"], outputs: ["onClick"] }, { type: i2.KwikUIInputOtpComponent, selector: "kwikui-input-otp", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputAadhaarComponent, selector: "kwikui-input-aadhaar", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i4.TuiPushComponent, selector: "tui-push", inputs: ["heading", "type", "timestamp"], outputs: ["close"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i4.TuiPushAlertDirective, selector: "[tuiPush]", inputs: ["tuiPush"] }, { type: i4.TuiPushDirective, selector: "tui-push" }] });
|
|
1756
|
+
/** @nocollapse */ KwikIDFormViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", 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\n class=\"kwikid-form-container\"\n *ngIf=\"!this.loading\"\n>\n <div id=\"uf-form-fields-header-container\">\n <div id=\"uf-form-fields-title\">\n {{ this.formConfig.title }}\n </div>\n <div id=\"uf-form-fields-steps\">\n Step {{ this.formConfig.sequenceNo }} of {{ this.formsList.length }}\n </div>\n <hr />\n </div>\n <form\n class=\"kwikid-form show\"\n [formGroup]=\"this.formGroup\"\n >\n <ng-container *ngFor=\"let field of this.formFields; let i = index\">\n <ng-container [ngSwitch]=\"field.type\">\n <!-- HTML Content -->\n <ng-container *ngSwitchCase=\"'html'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <div [innerHtml]=\"field.html | safeHtml\"></div>\n </div>\n </ng-container>\n <!-- Form Title -->\n <ng-container *ngSwitchCase=\"'title'\">\n <div\n class=\"title\"\n [class.hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <div>\n {{ field.label }}\n </div>\n <kwikui-button\n *ngIf=\"field?.reset\"\n appearance=\"whiteblock\"\n size=\"s\"\n label=\"Reset\"\n (onClick)=\"this.handleOnClickResetFormFields($event, field)\"\n ></kwikui-button>\n </div>\n </ng-container>\n <!-- Input Text -->\n <ng-container *ngSwitchCase=\"'text'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input\n [case]=\"field?.properties?.case\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [placeholder]=\"field?.properties?.placeholder\"\n [type]=\"'text'\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Checkbox -->\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-checkbox-block\n [contentAlign]=\"field?.properties?.contentAlign ?? 'left'\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.properties?.placeholder\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [size]=\"field?.properties?.size ?? 'l'\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-checkbox-block\n ><kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Number -->\n <ng-container *ngSwitchCase=\"'number'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-number\n [decimal]=\"field?.properties?.decimal\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [max]=\"field?.properties?.max\"\n [min]=\"field?.properties?.min\"\n [placeholder]=\"field?.properties?.placeholder\"\n [postfix]=\"field?.properties?.postfix ?? ''\"\n [precision]=\"field?.properties?.precision\"\n [prefix]=\"field?.properties?.prefix ?? ''\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-number\n ><kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Date -->\n <ng-container *ngSwitchCase=\"'date'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-date\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [max]=\"field?.properties?.max\"\n [min]=\"field?.properties?.min\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-date>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Phone -->\n <ng-container *ngSwitchCase=\"'phone'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-phone\n [countryCode]=\"field?.properties?.countryCode\"\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [phoneMaskAfterCountryCode]=\"\n field?.properties?.phoneMaskAfterCountryCode\n \"\n [placeholder]=\"field?.properties?.placeholder\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-phone>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Input Radio -->\n <ng-container *ngSwitchCase=\"'radio'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <label\n [tuiLabel]=\"labelTemplate\"\n style=\"min-height: auto\"\n >\n <kwikui-radio-list\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [items]=\"field?.options\"\n [label]=\"field?.label\"\n [orientation]=\"field?.properties?.orientation\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [size]=\"field?.properties?.size\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-radio-list>\n </label>\n <ng-template #labelTemplate>\n <p\n class=\"tui-space_bottom-2\"\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <b>\n {{ field.label }}\n <span *ngIf=\"field.validators?.required\"></span>\n </b>\n </p>\n </ng-template>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Dropdown -->\n <ng-container *ngSwitchCase=\"'dropdown-with-search'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-select-combobox\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field.label\"\n [options]=\"field.options\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-select-combobox>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- API Call -->\n <ng-container *ngSwitchCase=\"'api-call'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-button-api-call\n [apiStatus]=\"field?.api?.status?.value\"\n [class]=\"field?.class\"\n [disabled]=\"field?.disabled\"\n [id]=\"field.key\"\n [label]=\"field?.api?.status?.labels[field?.api?.status?.value]\"\n [showLoader]=\"field?.disabled === 'loading'\"\n shape=\"null\"\n size=\"m\"\n styles=\"width: fit-content\"\n (onClick)=\"this.handleOnClickApiCall($event)\"\n ></kwikui-button-api-call>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Mobile OTP -->\n <ng-container *ngSwitchCase=\"'otp'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-otp\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [mask]=\"field?.properties?.mask\"\n [placeholder]=\"field?.properties?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-otp>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n <!-- Aadhaar Number -->\n <ng-container *ngSwitchCase=\"'aadhaar-number'\">\n <div\n [hidden]=\"field?.hidden\"\n id=\"field_{{ field.key }}\"\n >\n <kwikui-input-aadhaar\n [disabled]=\"field?.disabled\"\n [focus]=\"field?.focus\"\n [formControl]=\"formGroup.controls[field.key]\"\n [formControlName]=\"field.key\"\n [id]=\"field.key\"\n [invalid]=\"field?.invalid\"\n [label]=\"field?.label\"\n [placeholder]=\"field?.placeholder\"\n [properties]=\"field?.properties\"\n [validators]=\"field?.validators\"\n (getKeyValue)=\"handleGetKeyValue($event)\"\n ></kwikui-input-aadhaar>\n <kwikui-messages\n [messages]=\"field.messages\"\n [id]=\"field.key\"\n ></kwikui-messages>\n </div>\n </ng-container>\n </ng-container>\n </ng-container>\n </form>\n <div class=\"kwikid-form-buttons\">\n <kwikui-button\n *ngIf=\"this.isMobileView\"\n [disabled]=\"viewFormsButton.disabled\"\n id=\"\"\n label=\"View Forms\"\n [showLoader]=\"viewFormsButton.showLoader\"\n styles=\"\"\n class=\"\"\n type=\"button\"\n appearance=\"secondary\"\n icon=\"\"\n iconRight=\"\"\n [shape]=\"null\"\n size=\"m\"\n styles=\"width: 100%\"\n (onClick)=\"this.handleOnClickViewForms($event)\"\n ></kwikui-button>\n <kwikui-button\n [disabled]=\"saveFormButton.disabled\"\n id=\"\"\n label=\"Save\"\n [showLoader]=\"saveFormButton.showLoader\"\n styles=\"\"\n class=\"\"\n type=\"button\"\n appearance=\"primary\"\n icon=\"\"\n iconRight=\"\"\n [shape]=\"null\"\n size=\"m\"\n styles=\"width: 100%\"\n (onClick)=\"this.handleOnClickSaveForm($event)\"\n ></kwikui-button>\n </div>\n</div>\n<div\n class=\"kwikid-form-container-loading\"\n *ngIf=\"this.loading\"\n>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n <div\n class=\"large-wrapper\"\n [class.tui-skeleton]=\"this.loading\"\n [class.tui-skeleton_rounded]=\"this.loading\"\n ></div>\n</div>\n<tui-push\n id=\"field-error-notification\"\n *tuiPush=\"showErrorNotification\"\n heading=\"Missing/Incorrect Fields!\"\n type=\"Error\"\n (close)=\"toggleErrorNotification(false)\"\n>\n <tui-svg\n src=\"tuiIconCancel\"\n style=\"color: #fff !important\"\n >\n </tui-svg>\n</tui-push>\n", styles: ["::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:10px}::-webkit-scrollbar-thumb{background:lightgray;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:gray}.kwikid-form-container{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center}.kwikid-form.show{width:100%;height:100%;padding:1rem;overflow-y:auto;display:flex;flex-direction:column;align-content:center;justify-content:flex-start;align-items:stretch;grid-row-gap:1rem;row-gap:1rem}.kwikid-form-buttons{width:100%;bottom:0px;padding:1rem;display:flex;flex-direction:row;align-content:center;justify-content:center;align-items:center;grid-column-gap:10px;column-gap:10px}.kwikid-form-buttons *{flex-grow:1}#uf-form-fields-header-container{display:flex;flex-direction:column;align-content:center;justify-content:center;align-items:flex-start;grid-row-gap:.5rem;row-gap:.5rem;padding:1rem}#uf-form-fields-header-container hr{width:100%}#uf-form-fields-title{color:#000;font-size:1.75em;font-weight:bold}#uf-form-fields-steps{color:var(--color-on-secondary-container);font-size:1em}.title{border-left:.25rem solid var(--tui-primary);padding:.75rem;font-size:1.4em;font-weight:bold;background-color:var(--tui-secondary);display:flex;flex-direction:row;align-content:center;justify-content:space-between;align-items:center;grid-gap:.5rem;gap:.5rem}.title:not(:first-child){margin-top:.5rem}.title.hidden{display:none}.large-wrapper{width:100%;height:60px}.large-wrapper:first-child{margin-bottom:auto}.large-wrapper:last-child{margin-top:auto}.kwikid-form-container-loading{width:100%;height:100%;margin:0 auto;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;align-content:center;grid-row-gap:1rem;row-gap:1rem;padding:1rem}#field-error-notification{background-color:var(--tui-error-fill);color:#fff!important}#field-error-notification .t-top{color:#fff!important}#field-error-notification .t-close{color:#fff!important}\n"], components: [{ type: i2.KwikUIButtonComponent, selector: "kwikui-button", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "type", "appearance", "icon", "iconRight", "shape", "size"], outputs: ["onClick"] }, { type: i2.KwikUIInputComponent, selector: "kwikui-input", inputs: ["label", "id", "type", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "validators", "case", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIMessagesComponent, selector: "kwikui-messages", inputs: ["messages", "id"] }, { type: i2.KwikUICheckboxBlockComponent, selector: "kwikui-checkbox-block", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "contentAlign", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputNumberComponent, selector: "kwikui-input-number", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "prefix", "postfix", "precision", "decimal", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputDateComponent, selector: "kwikui-input-date", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "min", "max", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputPhoneComponent, selector: "kwikui-input-phone", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "countryCode", "phoneMaskAfterCountryCode", "removeCountryCodeFromValue", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i3.TuiLabelComponent, selector: "label[tuiLabel]", inputs: ["tuiLabel", "context"] }, { type: i2.KwikUIRadioListComponent, selector: "kwikui-radio-list", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "size", "orientation", "items", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUISelectComboboxComponent, selector: "kwikui-select-combobox", inputs: ["label", "id", "formControlName", "formControl", "placeholder", "focus", "invalid", "disabled", "options", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIButtonApiCallComponent, selector: "kwikui-button-api-call", inputs: ["disabled", "id", "label", "showLoader", "styles", "class", "shape", "size", "apiStatus"], outputs: ["onClick"] }, { type: i2.KwikUIInputOtpComponent, selector: "kwikui-input-otp", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i2.KwikUIInputAadhaarComponent, selector: "kwikui-input-aadhaar", inputs: ["label", "id", "formControlName", "formControl", "focus", "invalid", "disabled", "placeholder", "mask", "validators", "properties"], outputs: ["getKeyValue"] }, { type: i4.TuiPushComponent, selector: "tui-push", inputs: ["heading", "type", "timestamp"], outputs: ["close"] }, { type: i3.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i4.TuiPushAlertDirective, selector: "[tuiPush]", inputs: ["tuiPush"] }, { type: i4.TuiPushDirective, selector: "tui-push" }], pipes: { "safeHtml": SafeHtmlPipe } });
|
|
1690
1757
|
__decorate([
|
|
1691
1758
|
logMethod
|
|
1692
1759
|
], KwikIDFormViewComponent.prototype, "ngOnInit", null);
|
|
@@ -1786,6 +1853,9 @@ __decorate([
|
|
|
1786
1853
|
__decorate([
|
|
1787
1854
|
logMethod
|
|
1788
1855
|
], KwikIDFormViewComponent.prototype, "patchFieldControlValue", null);
|
|
1856
|
+
__decorate([
|
|
1857
|
+
logMethod
|
|
1858
|
+
], KwikIDFormViewComponent.prototype, "patchFormGroup", null);
|
|
1789
1859
|
__decorate([
|
|
1790
1860
|
logMethod
|
|
1791
1861
|
], KwikIDFormViewComponent.prototype, "isFieldValid", null);
|
|
@@ -1795,9 +1865,6 @@ __decorate([
|
|
|
1795
1865
|
__decorate([
|
|
1796
1866
|
logMethod
|
|
1797
1867
|
], KwikIDFormViewComponent.prototype, "getFormGroupRawValues", null);
|
|
1798
|
-
__decorate([
|
|
1799
|
-
logMethod
|
|
1800
|
-
], KwikIDFormViewComponent.prototype, "handleFieldTypeSearchText", null);
|
|
1801
1868
|
__decorate([
|
|
1802
1869
|
logMethod
|
|
1803
1870
|
], KwikIDFormViewComponent.prototype, "takeActionOnFieldGroup", null);
|
|
@@ -1838,7 +1905,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1838
1905
|
type: Output
|
|
1839
1906
|
}], getActiveFormData: [{
|
|
1840
1907
|
type: Output
|
|
1841
|
-
}], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormFieldGroupsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldGroupActions: [], handleConnectedElementFieldGroup: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], toggleErrorNotification: [], fieldHide: [], fieldGroupHide: [], fieldShow: [], fieldGroupShow: [], fieldDisable: [], fieldGroupDisable: [], fieldEnable: [], fieldGroupEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [],
|
|
1908
|
+
}], ngOnInit: [], ngAfterViewInit: [], ngOnChanges: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormFieldGroupsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldGroupActions: [], handleConnectedElementFieldGroup: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleOnClickApiCall: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], toggleErrorNotification: [], fieldHide: [], fieldGroupHide: [], fieldShow: [], fieldGroupShow: [], fieldDisable: [], fieldGroupDisable: [], fieldEnable: [], fieldGroupEnable: [], fieldReset: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setObjectValue: [], patchFieldControlValue: [], patchFormGroup: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], takeActionOnFieldGroup: [], takeAction: [] } });
|
|
1842
1909
|
|
|
1843
1910
|
class KwikIDFormsListComponent {
|
|
1844
1911
|
constructor() {
|
|
@@ -1953,33 +2020,50 @@ class Converter {
|
|
|
1953
2020
|
}
|
|
1954
2021
|
convertFormConfig(formConfig) {
|
|
1955
2022
|
const updateOnFieldType = (field) => {
|
|
2023
|
+
const formatFieldTypeHtml = (field) => {
|
|
2024
|
+
field = this.setFieldKeyValue(field, "isFormElement", false);
|
|
2025
|
+
return field;
|
|
2026
|
+
};
|
|
1956
2027
|
const formatFieldTypeTitle = (field) => {
|
|
1957
2028
|
field = this.setFieldKeyValue(field, "hidden", false);
|
|
2029
|
+
field = this.setFieldKeyValue(field, "isFormElement", false);
|
|
1958
2030
|
return field;
|
|
1959
2031
|
};
|
|
1960
|
-
const
|
|
1961
|
-
field
|
|
1962
|
-
field.properties = this.setMissingFieldKeyValue(field.properties, "
|
|
1963
|
-
field = this.setFieldKeyValue(field, "hidden", false);
|
|
1964
|
-
field.options = field.options.map((x) => {
|
|
1965
|
-
if (typeof x === "string" || typeof x === "number") {
|
|
1966
|
-
return { label: x, disabled: false };
|
|
1967
|
-
}
|
|
1968
|
-
else {
|
|
1969
|
-
if (checkObjectKeyExists(x, "label") &&
|
|
1970
|
-
checkObjectKeyExists(x, "disabled")) {
|
|
1971
|
-
return x;
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
});
|
|
2032
|
+
const formatFieldTypeText = (field) => {
|
|
2033
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2034
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "case", "default");
|
|
1975
2035
|
return field;
|
|
1976
2036
|
};
|
|
1977
|
-
const
|
|
1978
|
-
field
|
|
2037
|
+
const formatFieldTypeCheckbox = (field) => {
|
|
2038
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2039
|
+
return field;
|
|
2040
|
+
};
|
|
2041
|
+
const formatFieldTypeNumber = (field) => {
|
|
2042
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2043
|
+
if (checkObjectKeyExists(field, "key")) {
|
|
2044
|
+
if (field.key === "aadhaar_number") {
|
|
2045
|
+
field = this.setFieldKeyValue(field, "type", "aadhaar_number");
|
|
2046
|
+
}
|
|
2047
|
+
if (field.key === "contact_number") {
|
|
2048
|
+
field = this.setFieldKeyValue(field, "type", "phone");
|
|
2049
|
+
}
|
|
2050
|
+
if (field.type === "phone" || field.type === "number") {
|
|
2051
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "countryCode", "+91");
|
|
2052
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "phoneMaskAfterCountryCode", "####-######");
|
|
2053
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "removeCountryCodeFromValue", true);
|
|
2054
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "decimal", "never");
|
|
2055
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "prefix", "");
|
|
2056
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "postfix", "");
|
|
2057
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "min", -Infinity);
|
|
2058
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "max", Infinity);
|
|
2059
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "precision", 2);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
1979
2062
|
field = this.setFieldKeyValue(field, "hidden", false);
|
|
1980
2063
|
return field;
|
|
1981
2064
|
};
|
|
1982
2065
|
const formatFieldTypeDate = (field) => {
|
|
2066
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
1983
2067
|
if (checkObjectKeyExists(field, "min")) {
|
|
1984
2068
|
const tuiDay = convertDateStringToTuiDayFormat(field["min"]);
|
|
1985
2069
|
field.properties = this.setFieldKeyValue(field.properties, "min", tuiDay);
|
|
@@ -2001,30 +2085,51 @@ class Converter {
|
|
|
2001
2085
|
field = this.setFieldKeyValue(field, "hidden", false);
|
|
2002
2086
|
return field;
|
|
2003
2087
|
};
|
|
2004
|
-
const
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2088
|
+
const formatFieldTypePhone = (field) => {
|
|
2089
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2090
|
+
return field;
|
|
2091
|
+
};
|
|
2092
|
+
const formatFieldTypeRadio = (field) => {
|
|
2093
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2094
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "size", "m");
|
|
2095
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "orientation", "vertical");
|
|
2096
|
+
field = this.setFieldKeyValue(field, "hidden", false);
|
|
2097
|
+
field.options = field.options.map((x) => {
|
|
2098
|
+
if (typeof x === "string" || typeof x === "number") {
|
|
2099
|
+
return { label: x, disabled: false, description: "" };
|
|
2008
2100
|
}
|
|
2009
|
-
|
|
2010
|
-
|
|
2101
|
+
else {
|
|
2102
|
+
if (checkObjectKeyExists(x, "label") &&
|
|
2103
|
+
checkObjectKeyExists(x, "disabled") &&
|
|
2104
|
+
checkObjectKeyExists(x, "description")) {
|
|
2105
|
+
return x;
|
|
2106
|
+
}
|
|
2107
|
+
if (!checkObjectKeyExists(x, "disabled")) {
|
|
2108
|
+
x = Object.assign(Object.assign({}, x), { disabled: false });
|
|
2109
|
+
}
|
|
2110
|
+
if (!checkObjectKeyExists(x, "description")) {
|
|
2111
|
+
x = Object.assign(Object.assign({}, x), { description: false });
|
|
2112
|
+
}
|
|
2113
|
+
return x;
|
|
2011
2114
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
field
|
|
2020
|
-
field.properties = this.setMissingFieldKeyValue(field.properties, "max", Infinity);
|
|
2021
|
-
field.properties = this.setMissingFieldKeyValue(field.properties, "precision", 2);
|
|
2115
|
+
});
|
|
2116
|
+
return field;
|
|
2117
|
+
};
|
|
2118
|
+
const formatFieldTypeSearchText = (field) => {
|
|
2119
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2120
|
+
if (checkObjectKeyExists(field, "type")) {
|
|
2121
|
+
if (field.type === "search-text") {
|
|
2122
|
+
field = this.setFieldKeyValue(field, "type", "dropdown-with-search");
|
|
2022
2123
|
}
|
|
2023
2124
|
}
|
|
2024
|
-
|
|
2125
|
+
return field;
|
|
2126
|
+
};
|
|
2127
|
+
const formatFieldTypeDropdownWithSearch = (field) => {
|
|
2128
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2025
2129
|
return field;
|
|
2026
2130
|
};
|
|
2027
2131
|
const formatFieldTypeApiCall = (field) => {
|
|
2132
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2028
2133
|
if (!checkObjectKeyExists(field.properties, "shape")) {
|
|
2029
2134
|
field.properties = this.setFieldKeyValue(field.properties, "shape", null);
|
|
2030
2135
|
}
|
|
@@ -2050,39 +2155,56 @@ class Converter {
|
|
|
2050
2155
|
}
|
|
2051
2156
|
return field;
|
|
2052
2157
|
};
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2158
|
+
const formatFieldTypeOtp = (field) => {
|
|
2159
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2160
|
+
field.properties = this.setMissingFieldKeyValue(field.properties, "mask", new Array(field.properties.otpLength).fill("#").join(" "));
|
|
2161
|
+
field = this.setFieldKeyValue(field, "hidden", false);
|
|
2059
2162
|
return field;
|
|
2060
2163
|
};
|
|
2061
|
-
const
|
|
2164
|
+
const formatFieldTypeAadhaarNumber = (field) => {
|
|
2165
|
+
field = this.setFieldKeyValue(field, "isFormElement", true);
|
|
2062
2166
|
return field;
|
|
2063
2167
|
};
|
|
2064
2168
|
switch (field.type) {
|
|
2169
|
+
case "html":
|
|
2170
|
+
field = formatFieldTypeHtml(field);
|
|
2171
|
+
break;
|
|
2065
2172
|
case "title":
|
|
2066
2173
|
field = formatFieldTypeTitle(field);
|
|
2067
2174
|
break;
|
|
2068
|
-
case "
|
|
2069
|
-
field =
|
|
2175
|
+
case "text":
|
|
2176
|
+
field = formatFieldTypeText(field);
|
|
2070
2177
|
break;
|
|
2071
|
-
case "
|
|
2072
|
-
field =
|
|
2178
|
+
case "checkbox":
|
|
2179
|
+
field = formatFieldTypeCheckbox(field);
|
|
2180
|
+
break;
|
|
2181
|
+
case "number":
|
|
2182
|
+
field = formatFieldTypeNumber(field);
|
|
2073
2183
|
break;
|
|
2074
2184
|
case "date":
|
|
2075
2185
|
field = formatFieldTypeDate(field);
|
|
2076
2186
|
break;
|
|
2077
|
-
case "
|
|
2078
|
-
field =
|
|
2187
|
+
case "phone":
|
|
2188
|
+
field = formatFieldTypePhone(field);
|
|
2079
2189
|
break;
|
|
2080
|
-
case "
|
|
2081
|
-
field =
|
|
2190
|
+
case "radio":
|
|
2191
|
+
field = formatFieldTypeRadio(field);
|
|
2082
2192
|
break;
|
|
2083
2193
|
case "search-text":
|
|
2084
2194
|
field = formatFieldTypeSearchText(field);
|
|
2085
2195
|
break;
|
|
2196
|
+
case "dropdown-with-search":
|
|
2197
|
+
field = formatFieldTypeDropdownWithSearch(field);
|
|
2198
|
+
break;
|
|
2199
|
+
case "api-call":
|
|
2200
|
+
field = formatFieldTypeApiCall(field);
|
|
2201
|
+
break;
|
|
2202
|
+
case "otp":
|
|
2203
|
+
field = formatFieldTypeOtp(field);
|
|
2204
|
+
break;
|
|
2205
|
+
case "aadhaar-number":
|
|
2206
|
+
field = formatFieldTypeAadhaarNumber(field);
|
|
2207
|
+
break;
|
|
2086
2208
|
default:
|
|
2087
2209
|
break;
|
|
2088
2210
|
}
|
|
@@ -2173,7 +2295,7 @@ class Converter {
|
|
|
2173
2295
|
};
|
|
2174
2296
|
const updateFieldValidatorConfig = (field) => {
|
|
2175
2297
|
var _a, _b, _c, _d, _e;
|
|
2176
|
-
if (field.
|
|
2298
|
+
if (field.isFormElement) {
|
|
2177
2299
|
const validators = checkObjectKeyExists(field, "validators")
|
|
2178
2300
|
? field.validators
|
|
2179
2301
|
: {};
|
|
@@ -2254,7 +2376,7 @@ class Converter {
|
|
|
2254
2376
|
return field;
|
|
2255
2377
|
};
|
|
2256
2378
|
const updateFieldDefaultValueConfig = (field) => {
|
|
2257
|
-
if (field.
|
|
2379
|
+
if (field.isFormElement) {
|
|
2258
2380
|
if (checkObjectKeyExists(field, "defaultValue")) {
|
|
2259
2381
|
return field;
|
|
2260
2382
|
}
|
|
@@ -2434,13 +2556,13 @@ class Converter {
|
|
|
2434
2556
|
return field;
|
|
2435
2557
|
};
|
|
2436
2558
|
const updateFieldMessages = (field) => {
|
|
2437
|
-
if (field.
|
|
2559
|
+
if (field.isFormElement) {
|
|
2438
2560
|
field = this.setMissingFieldKeyValue(field, "messages", []);
|
|
2439
2561
|
}
|
|
2440
2562
|
return field;
|
|
2441
2563
|
};
|
|
2442
2564
|
const updateFieldResetButton = (field) => {
|
|
2443
|
-
if (field.
|
|
2565
|
+
if (field.isFormElement) {
|
|
2444
2566
|
if (checkObjectKeyExists(field, "action") &&
|
|
2445
2567
|
field.action === "reset" &&
|
|
2446
2568
|
checkObjectKeyExists(field, "fields")) {
|
|
@@ -2956,7 +3078,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
2956
3078
|
class KwikIDFormViewModule {
|
|
2957
3079
|
}
|
|
2958
3080
|
/** @nocollapse */ KwikIDFormViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: KwikIDFormViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2959
|
-
/** @nocollapse */ KwikIDFormViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: KwikIDFormViewModule, declarations: [KwikIDFormViewComponent], imports: [CommonModule,
|
|
3081
|
+
/** @nocollapse */ KwikIDFormViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: KwikIDFormViewModule, declarations: [KwikIDFormViewComponent, SafeHtmlPipe], imports: [CommonModule,
|
|
2960
3082
|
FormsModule,
|
|
2961
3083
|
ReactiveFormsModule,
|
|
2962
3084
|
TuiLabelModule,
|
|
@@ -2975,7 +3097,7 @@ class KwikIDFormViewModule {
|
|
|
2975
3097
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: KwikIDFormViewModule, decorators: [{
|
|
2976
3098
|
type: NgModule,
|
|
2977
3099
|
args: [{
|
|
2978
|
-
declarations: [KwikIDFormViewComponent],
|
|
3100
|
+
declarations: [KwikIDFormViewComponent, SafeHtmlPipe],
|
|
2979
3101
|
imports: [
|
|
2980
3102
|
CommonModule,
|
|
2981
3103
|
FormsModule,
|