impaktapps-ui-builder 1.0.106 → 1.0.108

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.
@@ -8825,7 +8825,7 @@ var pageMaster = (funcParams) => {
8825
8825
  return formData;
8826
8826
  }
8827
8827
  saveFormdataInSessionStorage(config2);
8828
- return config2;
8828
+ return { ...config2, type: "page" };
8829
8829
  },
8830
8830
  getUiSchema: function() {
8831
8831
  const UiSchema = _.cloneDeep(PageMasterUiSchema(store2.theme.myTheme));
@@ -10026,9 +10026,7 @@ function executeEventsHandler(params2) {
10026
10026
  params2.componentName,
10027
10027
  params2.config,
10028
10028
  params2.store,
10029
- params2.service,
10030
- params2.formDataHolder,
10031
- params2.pageLoad
10029
+ params2.formDataHolder
10032
10030
  );
10033
10031
  } else if (params2.config.Handler === "onBackHandler") {
10034
10032
  return (_a = params2.store.functionParameters) == null ? void 0 : _a.handleBack();
@@ -10099,7 +10097,7 @@ function executeCustomHandler(params) {
10099
10097
  return response;
10100
10098
  }
10101
10099
  }
10102
- function mergeFormdata(handlerResponse, componentName, eventConfig, store2, service2, formDataHolder, pageLoad) {
10100
+ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, formDataHolder) {
10103
10101
  var _a, _b, _c;
10104
10102
  if (eventConfig.type === "Select" && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10105
10103
  if (!_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data)) {
@@ -10137,41 +10135,24 @@ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, serv
10137
10135
  });
10138
10136
  }
10139
10137
  } else if (eventConfig.type === "page") {
10140
- if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
10138
+ if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data) && lodash.exports.isObject(handlerResponse.data))) {
10141
10139
  store2.newData = {
10142
10140
  ...store2.newData,
10143
10141
  ...handlerResponse == null ? void 0 : handlerResponse.data
10144
10142
  };
10145
- formDataHolder = { ...formDataHolder, ...handlerResponse == null ? void 0 : handlerResponse.data };
10146
- if (!pageLoad) {
10147
- store2.setFormdata((pre) => {
10148
- return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
10149
- });
10150
- }
10143
+ const keys = Object.keys(handlerResponse.data);
10144
+ keys.map((e) => {
10145
+ formDataHolder[e] = { ...formDataHolder, [e]: handlerResponse.data[e] };
10146
+ });
10151
10147
  }
10152
10148
  } else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
10153
10149
  if (handlerResponse && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10154
10150
  formDataHolder[componentName] = (_a = handlerResponse.data) == null ? void 0 : _a.data;
10155
10151
  formDataHolder[`${componentName}_RowCount`] = (_c = (_b = handlerResponse.data) == null ? void 0 : _b.meta) == null ? void 0 : _c.totalRowCount;
10156
- if (!pageLoad) {
10157
- store2.setFormdata((pre) => {
10158
- var _a2, _b2, _c2;
10159
- return {
10160
- ...pre,
10161
- [componentName]: (_a2 = handlerResponse.data) == null ? void 0 : _a2.data,
10162
- [`${componentName}_RowCount`]: (_c2 = (_b2 = handlerResponse.data) == null ? void 0 : _b2.meta) == null ? void 0 : _c2.totalRowCount
10163
- };
10164
- });
10165
- }
10166
10152
  }
10167
10153
  } else {
10168
10154
  if (handlerResponse) {
10169
10155
  formDataHolder[componentName] = handlerResponse.data;
10170
- if (!pageLoad) {
10171
- store2.setFormdata((pre) => {
10172
- return { ...pre, [componentName]: handlerResponse.data };
10173
- });
10174
- }
10175
10156
  }
10176
10157
  }
10177
10158
  }
@@ -10362,8 +10343,7 @@ var service = (funcParams) => {
10362
10343
  service: funcParams.service,
10363
10344
  serviceHolder: this,
10364
10345
  eventGroups,
10365
- formDataHolder,
10366
- pageLoad: true
10346
+ formDataHolder
10367
10347
  });
10368
10348
  funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10369
10349
  uiSchema.elements.push(notifyUiSchema);
@@ -10488,7 +10468,7 @@ var service = (funcParams) => {
10488
10468
  onBack: async function(functionParameters) {
10489
10469
  var _a, _b;
10490
10470
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10491
- await this.callHandler("onBack", functionParameters);
10471
+ this.callHandler("onBack", functionParameters);
10492
10472
  if (((_b = eventGroups == null ? void 0 : eventGroups["onBack"]) == null ? void 0 : _b[path]) === void 0) {
10493
10473
  functionParameters == null ? void 0 : functionParameters.handleBack();
10494
10474
  }
@@ -10496,7 +10476,7 @@ var service = (funcParams) => {
10496
10476
  onNext: async function(functionParameters) {
10497
10477
  var _a, _b;
10498
10478
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10499
- await this.callHandler("onNext", functionParameters);
10479
+ this.callHandler("onNext", functionParameters);
10500
10480
  if (((_b = eventGroups == null ? void 0 : eventGroups["onNext"]) == null ? void 0 : _b[path]) === void 0) {
10501
10481
  functionParameters == null ? void 0 : functionParameters.handleNext();
10502
10482
  }
@@ -10504,23 +10484,34 @@ var service = (funcParams) => {
10504
10484
  onReset: async function(functionParameters) {
10505
10485
  var _a, _b;
10506
10486
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10507
- await this.callHandler("onReset", functionParameters);
10487
+ this.callHandler("onReset", functionParameters);
10508
10488
  if (((_b = eventGroups == null ? void 0 : eventGroups["onReset"]) == null ? void 0 : _b[path]) === void 0) {
10509
10489
  functionParameters == null ? void 0 : functionParameters.handleReset();
10510
10490
  }
10511
10491
  },
10512
- callHandler: async function(eventType, functionParameters) {
10492
+ callHandler: function(eventType, functionParameters) {
10513
10493
  var _a, _b, _c;
10514
10494
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
10515
10495
  if (((_b = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _b[path]) !== void 0) {
10516
- Promise.all((_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10496
+ (_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10517
10497
  executeEventsParameters.store.functionParameters = functionParameters;
10518
- executeEvents({
10519
- ...executeEventsParameters,
10520
- config: eventConfig,
10521
- componentName: path
10522
- });
10523
- }));
10498
+ if (eventConfig.Handler === "refresh") {
10499
+ executeEvents({
10500
+ ...executeEventsParameters,
10501
+ config: eventConfig,
10502
+ componentName: path,
10503
+ formDataHolder
10504
+ }).then((res) => {
10505
+ funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10506
+ });
10507
+ } else {
10508
+ executeEvents({
10509
+ ...executeEventsParameters,
10510
+ config: eventConfig,
10511
+ componentName: path
10512
+ });
10513
+ }
10514
+ });
10524
10515
  }
10525
10516
  },
10526
10517
  downloadFile: downloadFile$1,
@@ -12366,6 +12357,9 @@ function buildSchemaFromConfig(config2, parentSchema) {
12366
12357
  if (v.validationType === "required") {
12367
12358
  (_a2 = parentSchema.required) != null ? _a2 : parentSchema.required = [];
12368
12359
  parentSchema.required.push(config2.name);
12360
+ } else if (v.validationType === "readOnly") {
12361
+ fieldSchema.type = "string";
12362
+ fieldSchema.disabled = true;
12369
12363
  } else {
12370
12364
  fieldSchema.type = "string";
12371
12365
  fieldSchema[v.validationType] = isNaN(v.validationValue) ? v.validationValue : Number(v.validationValue);