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

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