kwikid-forms 0.6.47 → 0.6.48
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 +702 -623
- package/bundles/kwikid-forms.umd.js.map +1 -1
- package/esm2015/lib/builder/builder-form-editor/pipes/json-formatter.pipe.js +3 -2
- package/esm2015/lib/renderer/form-view/definitions/form-view.actions.definition.js +2 -1
- package/esm2015/lib/renderer/form-view/form-view.api.service.js +5 -3
- package/esm2015/lib/renderer/form-view/form-view.component.js +41 -11
- package/esm2015/lib/renderer/renderer.component.js +17 -1
- package/fesm2015/kwikid-forms.js +63 -13
- package/fesm2015/kwikid-forms.js.map +1 -1
- package/lib/renderer/form-view/definitions/form-view.actions.definition.d.ts +1 -0
- package/lib/renderer/form-view/form-view.component.d.ts +1 -0
- package/package.json +2 -2
package/fesm2015/kwikid-forms.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __awaiter } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { EventEmitter, Component, Input, Output, ChangeDetectionStrategy, Pipe, Inject, ViewChild, ViewChildren, HostListener, NgModule } from '@angular/core';
|
|
4
|
-
import { checkObjectKeyExists, setValueToObjectPath, isEmptyValue, getObjectDeepCopy, logMethod, isNotEmptyValue, setMissingKeyValue, isObject, mergeObjects, checkObjectPathExists, getObjectValueFromPath, getObjectFromLocalStorage, encryptWithAES, decryptWithAES, Rule, Condition, Action, Source, hasWhitespacesOnly, PATTERNS, RuleEngine, mergeObjectsDeep, ESourceKey, replaceString, isUndefined, isNull, isEmptyString } from 'kwikid-toolkit';
|
|
4
|
+
import { checkObjectKeyExists, setValueToObjectPath, isEmptyValue, getObjectDeepCopy, logMethod, isNotEmptyValue, setMissingKeyValue, isObject, mergeObjects, checkObjectPathExists, getObjectValueFromPath, getObjectFromLocalStorage, encryptWithAES, decryptWithAES, Rule, Condition, Action, Source, hasWhitespacesOnly, PATTERNS, RuleEngine, mergeObjectsDeep, ESourceKey, isNotEmptyString, removeKeyFromObjectPath, replaceString, isUndefined, isNull, isEmptyString } from 'kwikid-toolkit';
|
|
5
5
|
import * as i3 from 'kwikui';
|
|
6
6
|
import { KwikUIModule, KwikUIPipeModule, KwikUIInputEmailModule } from 'kwikui';
|
|
7
7
|
import * as i3$1 from '@angular/forms';
|
|
@@ -2614,6 +2614,7 @@ var ELogEventType$2;
|
|
|
2614
2614
|
|
|
2615
2615
|
var EActionKey;
|
|
2616
2616
|
(function (EActionKey) {
|
|
2617
|
+
EActionKey["REMOVE_KEY_FROM_OBJECT_PATH"] = "REMOVE_KEY_FROM_OBJECT_PATH";
|
|
2617
2618
|
EActionKey["SET_VALUE"] = "SET_VALUE";
|
|
2618
2619
|
EActionKey["SET_FIELD_DEFAULT_VALUE"] = "SET_FIELD_DEFAULT_VALUE";
|
|
2619
2620
|
EActionKey["SET_API_STATUS"] = "SET_API_STATUS";
|
|
@@ -2780,10 +2781,12 @@ class KwikIDFormViewApiService {
|
|
|
2780
2781
|
}
|
|
2781
2782
|
// Function to preprocess header data
|
|
2782
2783
|
preProcessHeader(headerData, isVerifySignature) {
|
|
2783
|
-
if (!headerData)
|
|
2784
|
+
if (!headerData) {
|
|
2784
2785
|
headerData = {};
|
|
2785
|
-
|
|
2786
|
+
}
|
|
2787
|
+
if (!headerData.headers) {
|
|
2786
2788
|
headerData.headers = {};
|
|
2789
|
+
}
|
|
2787
2790
|
// Generate a unique identifier if signature verification is required
|
|
2788
2791
|
if (isVerifySignature) {
|
|
2789
2792
|
headerData.headers.xrid = v4();
|
|
@@ -5346,7 +5349,7 @@ class KwikIDFormViewComponent {
|
|
|
5346
5349
|
});
|
|
5347
5350
|
}
|
|
5348
5351
|
executeApiCall(api, object) {
|
|
5349
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10
|
|
5352
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
5350
5353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5351
5354
|
const apis = new Apis(object, this.takeAction.bind(this));
|
|
5352
5355
|
api = yield apis.setUrl();
|
|
@@ -5389,7 +5392,7 @@ class KwikIDFormViewComponent {
|
|
|
5389
5392
|
apiCallResponse = executedApiCall.data;
|
|
5390
5393
|
apiCallResponseStatusCode = executedApiCall.status;
|
|
5391
5394
|
}
|
|
5392
|
-
catch (
|
|
5395
|
+
catch (_11) {
|
|
5393
5396
|
// Handle any errors
|
|
5394
5397
|
apiCallResponse = {};
|
|
5395
5398
|
apiCallResponseStatusCode =
|
|
@@ -5415,7 +5418,7 @@ class KwikIDFormViewComponent {
|
|
|
5415
5418
|
apiCallResponse = executedApiCall.data;
|
|
5416
5419
|
apiCallResponseStatusCode = executedApiCall.status;
|
|
5417
5420
|
}
|
|
5418
|
-
catch (
|
|
5421
|
+
catch (_12) {
|
|
5419
5422
|
// Handle any errors
|
|
5420
5423
|
apiCallResponse = {};
|
|
5421
5424
|
apiCallResponseStatusCode =
|
|
@@ -5425,13 +5428,13 @@ class KwikIDFormViewComponent {
|
|
|
5425
5428
|
}
|
|
5426
5429
|
api.response = setValueToObjectPath(api.response, "value", apiCallResponse);
|
|
5427
5430
|
api.response = setValueToObjectPath(api.response, "status", apiCallResponseStatusCode);
|
|
5428
|
-
this.triggerLogs(ELogEventType$1.FORM__API_RESPONSE, Object.assign(Object.assign({ form_api_key: (_y = api === null || api === void 0 ? void 0 : api.apiKey) !== null && _y !== void 0 ? _y : "", form_api_response_encrypted: (_0 = (_z = api === null || api === void 0 ? void 0 : api.response) === null || _z === void 0 ? void 0 : _z.isSecure) !== null && _0 !== void 0 ? _0 : false }, (
|
|
5431
|
+
this.triggerLogs(ELogEventType$1.FORM__API_RESPONSE, Object.assign(Object.assign({ form_api_key: (_y = api === null || api === void 0 ? void 0 : api.apiKey) !== null && _y !== void 0 ? _y : "", form_api_response_encrypted: (_0 = (_z = api === null || api === void 0 ? void 0 : api.response) === null || _z === void 0 ? void 0 : _z.isSecure) !== null && _0 !== void 0 ? _0 : false }, (!((_1 = api === null || api === void 0 ? void 0 : api.response) === null || _1 === void 0 ? void 0 : _1.isSecure) && {
|
|
5429
5432
|
form_api_response_body: apiCallResponse !== null && apiCallResponse !== void 0 ? apiCallResponse : {}
|
|
5430
5433
|
})), { form_api_status_code: apiCallResponseStatusCode }));
|
|
5431
5434
|
}
|
|
5432
5435
|
else {
|
|
5433
|
-
this.triggerLogs(ELogEventType$1.FORM__API_REQUEST_INVALID, Object.assign({ form_api_key: (
|
|
5434
|
-
form_api_request_body: (
|
|
5436
|
+
this.triggerLogs(ELogEventType$1.FORM__API_REQUEST_INVALID, Object.assign({ form_api_key: (_2 = api === null || api === void 0 ? void 0 : api.apiKey) !== null && _2 !== void 0 ? _2 : "", form_api_request_encrypted: (_5 = (_4 = (_3 = api === null || api === void 0 ? void 0 : api.request) === null || _3 === void 0 ? void 0 : _3.body) === null || _4 === void 0 ? void 0 : _4.isSecure) !== null && _5 !== void 0 ? _5 : false }, (!((_7 = (_6 = api === null || api === void 0 ? void 0 : api.request) === null || _6 === void 0 ? void 0 : _6.body) === null || _7 === void 0 ? void 0 : _7.isSecure) && {
|
|
5437
|
+
form_api_request_body: (_10 = (_9 = (_8 = api === null || api === void 0 ? void 0 : api.request) === null || _8 === void 0 ? void 0 : _8.body) === null || _9 === void 0 ? void 0 : _9.value) !== null && _10 !== void 0 ? _10 : {}
|
|
5435
5438
|
})));
|
|
5436
5439
|
}
|
|
5437
5440
|
return api;
|
|
@@ -6024,6 +6027,28 @@ class KwikIDFormViewComponent {
|
|
|
6024
6027
|
});
|
|
6025
6028
|
});
|
|
6026
6029
|
}
|
|
6030
|
+
removeKeyFromObjectPath(action, object) {
|
|
6031
|
+
var _a, _b, _c, _d;
|
|
6032
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6033
|
+
const source = new Source(object);
|
|
6034
|
+
const sourceValue = action.props.source;
|
|
6035
|
+
const objectKey = (_b = (_a = sourceValue === null || sourceValue === void 0 ? void 0 : sourceValue.props) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.key;
|
|
6036
|
+
const objectPath = (_d = (_c = sourceValue === null || sourceValue === void 0 ? void 0 : sourceValue.props) === null || _c === void 0 ? void 0 : _c.object) === null || _d === void 0 ? void 0 : _d.path;
|
|
6037
|
+
if (sourceValue.key === ESourceKey.OBJECT &&
|
|
6038
|
+
isNotEmptyString(objectKey) &&
|
|
6039
|
+
isNotEmptyString(objectPath)) {
|
|
6040
|
+
if (checkObjectKeyExists(source._object, objectKey)) {
|
|
6041
|
+
source._object[objectKey] = removeKeyFromObjectPath(source._object[objectKey], objectPath);
|
|
6042
|
+
}
|
|
6043
|
+
}
|
|
6044
|
+
object.FIELD_CONFIG = source._object.FIELD_CONFIG;
|
|
6045
|
+
this.formData = source._object.FORM_DATA;
|
|
6046
|
+
this.patchFormGroup(this.formData);
|
|
6047
|
+
this.allFormsData = source._object.ALL_FORMS_DATA;
|
|
6048
|
+
this.previousFormData = source._object.PREVIOUS_FORM_DATA;
|
|
6049
|
+
this.extraData = source._object.EXTRA_DATA;
|
|
6050
|
+
});
|
|
6051
|
+
}
|
|
6027
6052
|
setValue(action, object) {
|
|
6028
6053
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6029
6054
|
const source = new Source(object);
|
|
@@ -6226,8 +6251,9 @@ class KwikIDFormViewComponent {
|
|
|
6226
6251
|
const field = getFormFieldByKey(this.formFields, action.props.fieldKey);
|
|
6227
6252
|
let multipleApiCallResponses = {};
|
|
6228
6253
|
field.api.endpoints.forEach((api) => {
|
|
6229
|
-
if (checkObjectKeyExists(api.response, "value"))
|
|
6254
|
+
if (checkObjectKeyExists(api.response, "value")) {
|
|
6230
6255
|
multipleApiCallResponses = setValueToObjectPath(multipleApiCallResponses, `${api.apiKey}`, api.response.value);
|
|
6256
|
+
}
|
|
6231
6257
|
});
|
|
6232
6258
|
this.formData = Object.assign(Object.assign({}, this.formData), { [field.key]: multipleApiCallResponses });
|
|
6233
6259
|
this.patchFormGroup(this.formData);
|
|
@@ -6279,8 +6305,9 @@ class KwikIDFormViewComponent {
|
|
|
6279
6305
|
const multipleApiConfig = this.formConfig.apis[action.props.formApiKey];
|
|
6280
6306
|
let multipleApiCallResponses = {};
|
|
6281
6307
|
multipleApiConfig.endpoints.forEach((api) => {
|
|
6282
|
-
if (checkObjectKeyExists(api.response, "value"))
|
|
6308
|
+
if (checkObjectKeyExists(api.response, "value")) {
|
|
6283
6309
|
multipleApiCallResponses = setValueToObjectPath(multipleApiCallResponses, `${api.apiKey}`, api.response.value);
|
|
6310
|
+
}
|
|
6284
6311
|
});
|
|
6285
6312
|
this.taskData = Object.assign(Object.assign({}, this.taskData), { [action.props.formApiKey]: multipleApiCallResponses });
|
|
6286
6313
|
this.waitingForChanges = false;
|
|
@@ -6607,6 +6634,9 @@ class KwikIDFormViewComponent {
|
|
|
6607
6634
|
case EActionKey.FIELD_API_TIMER_MESSAGE_HIDE:
|
|
6608
6635
|
yield this.fieldApiTimerMessageHide(action.props.fieldKey);
|
|
6609
6636
|
break;
|
|
6637
|
+
case EActionKey.REMOVE_KEY_FROM_OBJECT_PATH:
|
|
6638
|
+
yield this.removeKeyFromObjectPath(action, object);
|
|
6639
|
+
break;
|
|
6610
6640
|
case EActionKey.SET_VALUE:
|
|
6611
6641
|
yield this.setValue(action, object);
|
|
6612
6642
|
break;
|
|
@@ -6926,6 +6956,9 @@ __decorate([
|
|
|
6926
6956
|
__decorate([
|
|
6927
6957
|
logMethod
|
|
6928
6958
|
], KwikIDFormViewComponent.prototype, "fieldMessageHide", null);
|
|
6959
|
+
__decorate([
|
|
6960
|
+
logMethod
|
|
6961
|
+
], KwikIDFormViewComponent.prototype, "removeKeyFromObjectPath", null);
|
|
6929
6962
|
__decorate([
|
|
6930
6963
|
logMethod
|
|
6931
6964
|
], KwikIDFormViewComponent.prototype, "setValue", null);
|
|
@@ -7089,7 +7122,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
7089
7122
|
type: Output
|
|
7090
7123
|
}], onClickViewForms: [{
|
|
7091
7124
|
type: Output
|
|
7092
|
-
}], resetCamera: [], ngOnInit: [], ngOnChanges: [], ngOnDestroy: [], triggerLogs: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormFieldGroupsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldGroupActions: [], handleConnectedElementFieldGroup: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleRemovedFile: [], handleViewButtonClick: [], handleGetKeyValueFile: [], handleOnClickGetRemovedMediaFile: [], handleOnClickInputCamera: [], setCameraMedia: [], handleGetCameraMedia: [], handleOnClickSaveCameraMedia: [], handleOnClickCameraBack: [], handleOnClickCameraClose: [], updateFiles: [], uploadFile: [], handleOnClickFormFieldButton: [], handleOnLocationPermission: [], handleOnClickLiveLocation: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleFieldApiCall: [], handleApiCall: [], executeApiCall: [], isValidRequestHeadersAndBody: [], handleOnClickApiCall: [], handleOnClickGoBack: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], handleOnApiTimerStop: [], handleOnScrollToField: [], toggleErrorNotification: [], togglePermissionErrorNotification: [], fieldHide: [], fieldGroupHide: [], fieldShow: [], fieldGroupShow: [], fieldDisable: [], fieldGroupDisable: [], fieldEnable: [], fieldGroupEnable: [], fieldReset: [], fieldGroupReset: [], fieldHideApiLoader: [], fieldShowApiLoader: [], setHtml: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], setValue: [], setFieldDefaultValue: [], setApiStatus: [], setApiHeaderValue: [], setApiHeaderValidity: [], setApiBodyValue: [], setApiBodyValidity: [], setFieldValidity: [], setDropdownOptions: [], apiCall: [], fieldApiCall: [], fieldMultipleApiCalls: [], fieldMultipleApiCallsEnd: [], taskApiCall: [], taskMultipleApiCalls: [], taskMultipleApiCallsEnd: [], dialogShow: [], dialogHide: [], redirectToUrl: [], patchFieldControlValue: [], setFieldControlValue: [], patchFormGroup: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], showPreview: [], showErrorPreview: [], showPopupForm: [], alertShow: [], takeActionOnFieldGroup: [], takeAction: [] } });
|
|
7125
|
+
}], resetCamera: [], ngOnInit: [], ngOnChanges: [], ngOnDestroy: [], triggerLogs: [], initFormConfig: [], setFormFieldsFromFormConfig: [], setFormFieldGroupsFromFormConfig: [], setFormDataFromAllFormsData: [], handleConnectedElementFieldGroupActions: [], handleConnectedElementFieldGroup: [], handleConnectedElementFieldActions: [], handleConnectedElementFields: [], handleConnectedElements: [], handleRemovedFile: [], handleViewButtonClick: [], handleGetKeyValueFile: [], handleOnClickGetRemovedMediaFile: [], handleOnClickInputCamera: [], setCameraMedia: [], handleGetCameraMedia: [], handleOnClickSaveCameraMedia: [], handleOnClickCameraBack: [], handleOnClickCameraClose: [], updateFiles: [], uploadFile: [], handleOnClickFormFieldButton: [], handleOnLocationPermission: [], handleOnClickLiveLocation: [], handleGetKeyValue: [], handleOnClickResetFormFields: [], handleFieldApiCall: [], handleApiCall: [], executeApiCall: [], isValidRequestHeadersAndBody: [], handleOnClickApiCall: [], handleOnClickGoBack: [], handleOnClickViewForms: [], handleOnClickSaveForm: [], handleOnApiTimerStop: [], handleOnScrollToField: [], toggleErrorNotification: [], togglePermissionErrorNotification: [], fieldHide: [], fieldGroupHide: [], fieldShow: [], fieldGroupShow: [], fieldDisable: [], fieldGroupDisable: [], fieldEnable: [], fieldGroupEnable: [], fieldReset: [], fieldGroupReset: [], fieldHideApiLoader: [], fieldShowApiLoader: [], setHtml: [], fieldErrorShow: [], fieldErrorHide: [], fieldMessageShow: [], fieldMessageHide: [], removeKeyFromObjectPath: [], setValue: [], setFieldDefaultValue: [], setApiStatus: [], setApiHeaderValue: [], setApiHeaderValidity: [], setApiBodyValue: [], setApiBodyValidity: [], setFieldValidity: [], setDropdownOptions: [], apiCall: [], fieldApiCall: [], fieldMultipleApiCalls: [], fieldMultipleApiCallsEnd: [], taskApiCall: [], taskMultipleApiCalls: [], taskMultipleApiCallsEnd: [], dialogShow: [], dialogHide: [], redirectToUrl: [], patchFieldControlValue: [], setFieldControlValue: [], patchFormGroup: [], isFieldValid: [], isFieldEnabled: [], getFormGroupRawValues: [], showPreview: [], showErrorPreview: [], showPopupForm: [], alertShow: [], takeActionOnFieldGroup: [], takeAction: [] } });
|
|
7093
7126
|
|
|
7094
7127
|
/* eslint-disable no-unused-vars */
|
|
7095
7128
|
var EFormType;
|
|
@@ -7676,6 +7709,22 @@ class KwikIDFormsRendererComponent {
|
|
|
7676
7709
|
form = setValueToObjectPath(form, "status", "completed");
|
|
7677
7710
|
form = setValueToObjectPath(form, "disabled", false);
|
|
7678
7711
|
}
|
|
7712
|
+
else if (checkObjectKeyExists(form, "dependentOn")) {
|
|
7713
|
+
const isDependent = form.dependentOn.every((r) => formsListCompleted.includes(r));
|
|
7714
|
+
if (isDependent) {
|
|
7715
|
+
form = setValueToObjectPath(form, "status", "editable");
|
|
7716
|
+
form = setValueToObjectPath(form, "disabled", false);
|
|
7717
|
+
}
|
|
7718
|
+
else {
|
|
7719
|
+
form = setValueToObjectPath(form, "status", "locked");
|
|
7720
|
+
form = setValueToObjectPath(form, "disabled", true);
|
|
7721
|
+
}
|
|
7722
|
+
}
|
|
7723
|
+
else {
|
|
7724
|
+
form = setValueToObjectPath(form, "dependentOn", []);
|
|
7725
|
+
form = setValueToObjectPath(form, "status", "editable");
|
|
7726
|
+
form = setValueToObjectPath(form, "disabled", false);
|
|
7727
|
+
}
|
|
7679
7728
|
}
|
|
7680
7729
|
}
|
|
7681
7730
|
}
|
|
@@ -8354,8 +8403,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
8354
8403
|
|
|
8355
8404
|
class JsonFormatPipe {
|
|
8356
8405
|
transform(value) {
|
|
8357
|
-
if (!value)
|
|
8406
|
+
if (!value) {
|
|
8358
8407
|
return "";
|
|
8408
|
+
}
|
|
8359
8409
|
// Trim spaces from start and end, then JSON.stringify with indentation for formatting
|
|
8360
8410
|
return JSON.stringify(value, null, 2).trim();
|
|
8361
8411
|
}
|