impaktapps-ui-builder 0.0.382-alpha.321 → 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,37 +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
- 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
- console.log("11 ", funcParams.store.formData);
9162
- const res = await fetch("https://jsonplaceholder.typicode.com/todos");
9163
- await res.json();
9164
- console.log("22 ", funcParams.store.formData);
9165
- funcParams.store.setSchema(funcParams.schema);
9166
- funcParams.uiSchema.elements.push(notifyUiSchema);
9167
- funcParams.store.setUiSchema(funcParams.uiSchema);
9168
- await executeRefreshHandler({
9169
- config: {},
9170
- componentName: "",
9171
- store: funcParams.store,
9172
- dynamicData: funcParams.dynamicData,
9173
- userValue: funcParams.userValue,
9174
- service: funcParams.service,
9175
- serviceHolder: this,
9172
+ serviceHolder: void 0,
9176
9173
  eventGroups
9177
9174
  });
9178
- },
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,
9179
9186
  onClick: async function() {
9180
9187
  await this.callHandler("onClick");
9181
9188
  },
@@ -9209,18 +9216,20 @@ var service = (funcParams) => {
9209
9216
  onChange: async function() {
9210
9217
  if (eventGroups.onChange) {
9211
9218
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
9212
- Promise.all(ChangeEventsKeysArray.map(async (componentName) => {
9213
- var _a, _b;
9214
- 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) {
9215
- for (const eventConfig of eventGroups.onChange[componentName]) {
9216
- await executeEvents({
9217
- ...executeEventsParameters,
9218
- config: eventConfig,
9219
- componentName
9220
- });
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
+ }
9221
9230
  }
9222
- }
9223
- }));
9231
+ })
9232
+ );
9224
9233
  }
9225
9234
  },
9226
9235
  updateConfigApiBody: async function(paramValue, apiBody) {
@@ -9228,10 +9237,7 @@ var service = (funcParams) => {
9228
9237
  let LastCallResponse = void 0;
9229
9238
  for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paramValue.path]) {
9230
9239
  if (eventConfig.body) {
9231
- eventConfig.body = [
9232
- ...eventConfig.body,
9233
- ...apiBody
9234
- ];
9240
+ eventConfig.body = [...eventConfig.body, ...apiBody];
9235
9241
  } else {
9236
9242
  eventConfig.body = apiBody;
9237
9243
  }