impaktapps-ui-builder 0.0.382-alpha.320 → 0.0.382-alpha.322

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.
@@ -1,3 +1,4 @@
1
+ import { useState, useEffect } from "react";
1
2
  const PageMasterSchema = {
2
3
  type: "object",
3
4
  properties: {
@@ -9116,13 +9117,26 @@ const extractEvents = (eventConfig) => {
9116
9117
  const SuccessEvent = (_a = event2 == null ? void 0 : event2.events) == null ? void 0 : _a.find((elem) => {
9117
9118
  return elem.eventType === "Success";
9118
9119
  });
9119
- if (!!!SuccessEvent && event2.eventType === "onLoad") {
9120
- event2.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false });
9120
+ if (!SuccessEvent && event2.eventType === "onLoad") {
9121
+ event2.events.push({
9122
+ Handler: "mergeFormdata",
9123
+ eventType: "Success",
9124
+ type: compType,
9125
+ lazyLoading: eventConfig.lazyLoading === "YES" ? true : false
9126
+ });
9121
9127
  }
9122
- if (!!!SuccessEvent && (event2.eventType === "onBack" || event2.eventType === "onNext" || event2.eventType === "onReset")) {
9123
- event2.events.push({ Handler: `${event2.eventType}Handler`, eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false });
9128
+ if (!SuccessEvent && (event2.eventType === "onBack" || event2.eventType === "onNext" || event2.eventType === "onReset")) {
9129
+ event2.events.push({
9130
+ Handler: `${event2.eventType}Handler`,
9131
+ eventType: "Success",
9132
+ type: compType,
9133
+ lazyLoading: eventConfig.lazyLoading === "YES" ? true : false
9134
+ });
9124
9135
  }
9125
- eventGroups[event2.eventType][eventConfigObj.name].push({ ...event2, type: compType });
9136
+ eventGroups[event2.eventType][eventConfigObj.name].push({
9137
+ ...event2,
9138
+ type: compType
9139
+ });
9126
9140
  });
9127
9141
  }
9128
9142
  }
@@ -9145,33 +9159,30 @@ var service = (funcParams) => {
9145
9159
  serviceHolder: { downloadFile: downloadFile$1, download: doDownload },
9146
9160
  eventGroups
9147
9161
  };
9148
- return {
9149
- setPage: async function() {
9150
- await funcParams.store.setFormdata({});
9151
- executeEventsParameters = {
9162
+ const [isReady, setIsReady] = useState(false);
9163
+ useEffect(() => {
9164
+ if (isReady) {
9165
+ executeRefreshHandler({
9152
9166
  config: {},
9153
9167
  componentName: "",
9154
9168
  store: funcParams.store,
9155
9169
  dynamicData: funcParams.dynamicData,
9156
9170
  userValue: funcParams.userValue,
9157
9171
  service: funcParams.service,
9158
- serviceHolder: this,
9159
- eventGroups
9160
- };
9161
- funcParams.store.setSchema(funcParams.schema);
9162
- funcParams.uiSchema.elements.push(notifyUiSchema);
9163
- funcParams.store.setUiSchema(funcParams.uiSchema);
9164
- await executeRefreshHandler({
9165
- config: {},
9166
- componentName: "",
9167
- store: funcParams.store,
9168
- dynamicData: funcParams.dynamicData,
9169
- userValue: funcParams.userValue,
9170
- service: funcParams.service,
9171
- serviceHolder: this,
9172
+ serviceHolder: void 0,
9172
9173
  eventGroups
9173
9174
  });
9174
- },
9175
+ }
9176
+ }, [funcParams.store.formData]);
9177
+ const setPage = async function() {
9178
+ funcParams.store.setFormdata({});
9179
+ funcParams.store.setSchema(funcParams.schema);
9180
+ funcParams.uiSchema.elements.push(notifyUiSchema);
9181
+ funcParams.store.setUiSchema(funcParams.uiSchema);
9182
+ setIsReady(true);
9183
+ };
9184
+ return {
9185
+ setPage,
9175
9186
  onClick: async function() {
9176
9187
  await this.callHandler("onClick");
9177
9188
  },
@@ -9205,18 +9216,20 @@ var service = (funcParams) => {
9205
9216
  onChange: async function() {
9206
9217
  if (eventGroups.onChange) {
9207
9218
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
9208
- Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
9209
- var _a, _b;
9210
- if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) !== funcParams.store.newData[componentName] && ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName]) !== void 0) {
9211
- for (const eventConfig of eventGroups.onChange[componentName]) {
9212
- await executeEvents({
9213
- ...executeEventsParameters,
9214
- config: eventConfig,
9215
- componentName
9216
- });
9219
+ Promise.all(
9220
+ ChangeEventsKeysArray.map(async (componentName) => {
9221
+ var _a, _b;
9222
+ if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) !== funcParams.store.newData[componentName] && ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName]) !== void 0) {
9223
+ for (const eventConfig of eventGroups.onChange[componentName]) {
9224
+ await executeEvents({
9225
+ ...executeEventsParameters,
9226
+ config: eventConfig,
9227
+ componentName
9228
+ });
9229
+ }
9217
9230
  }
9218
- }
9219
- }));
9231
+ })
9232
+ );
9220
9233
  }
9221
9234
  },
9222
9235
  updateConfigApiBody: async function(paramValue, apiBody) {
@@ -9224,10 +9237,7 @@ var service = (funcParams) => {
9224
9237
  let LastCallResponse = void 0;
9225
9238
  for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paramValue.path]) {
9226
9239
  if (eventConfig.body) {
9227
- eventConfig.body = [
9228
- ...eventConfig.body,
9229
- ...apiBody
9230
- ];
9240
+ eventConfig.body = [...eventConfig.body, ...apiBody];
9231
9241
  } else {
9232
9242
  eventConfig.body = apiBody;
9233
9243
  }