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.
- package/dist/impaktapps-ui-builder.es.js +49 -43
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +12 -12
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/runtime/services/service.ts +120 -101
|
@@ -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 (
|
|
9120
|
-
event2.events.push({
|
|
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 (
|
|
9123
|
-
event2.events.push({
|
|
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({
|
|
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
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
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:
|
|
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(
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
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
|
}
|