impaktapps-ui-builder 0.0.412-f → 0.0.412-h
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 +12 -3
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +1 -1
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/runtime/services/events.ts +30 -14
- package/src/impaktapps-ui-builder/runtime/services/service.ts +3 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handlersProps } from "./interface";
|
|
2
2
|
export declare const executeEvents: (params: handlersProps) => any;
|
|
3
3
|
export declare function getRefreshElements(eventConfig: any, eventGropus: any): string[];
|
|
4
|
-
export declare function executeRefreshHandler(params: handlersProps): Promise<any[][]>;
|
|
4
|
+
export declare function executeRefreshHandler(params: handlersProps): Promise<PromiseSettledResult<void | PromiseSettledResult<any>[]>[]>;
|
|
5
5
|
export declare function executeApiRequest(params: any): any;
|
|
6
6
|
export declare function shouldEventExecute(params: handlersProps): any;
|
|
7
7
|
export declare function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service: any): {
|
package/package.json
CHANGED
|
@@ -96,15 +96,32 @@ export function getRefreshElements(eventConfig: any, eventGropus: any) {
|
|
|
96
96
|
console.log(result);
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
|
-
export function executeRefreshHandler(params: handlersProps) {
|
|
99
|
+
export async function executeRefreshHandler(params: handlersProps) {
|
|
100
100
|
const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
|
|
102
|
+
// Create an array of promises for the components to refresh
|
|
103
|
+
return Promise.allSettled(compToRefresh.map(componentName => {
|
|
104
|
+
const eventConfigs = params.eventGroups.onLoad[componentName];
|
|
105
|
+
|
|
106
|
+
// If eventConfigs is undefined, return a resolved promise
|
|
107
|
+
if (!eventConfigs) {
|
|
108
|
+
return Promise.resolve(); // Resolve immediately if there are no events to load
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Create an array of promises for the defined eventConfigs
|
|
112
|
+
return Promise.allSettled(eventConfigs.map(compEventConfig => {
|
|
104
113
|
return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
105
114
|
}));
|
|
106
|
-
}))
|
|
107
|
-
}
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
// export function executeRefreshHandler(params: handlersProps) {
|
|
118
|
+
// const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
|
|
119
|
+
// return Promise.all(compToRefresh.map(componentName => {
|
|
120
|
+
// return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
|
|
121
|
+
// return executeEvents({ ...params, config: compEventConfig, componentName });
|
|
122
|
+
// }));
|
|
123
|
+
// }))
|
|
124
|
+
// };
|
|
108
125
|
export function executeApiRequest(params: any) {
|
|
109
126
|
const initialBody = { ...params.userValue?.payload };
|
|
110
127
|
const initialHeaders = {
|
|
@@ -144,7 +161,7 @@ function executeCustomHandler(params: handlersProps) {
|
|
|
144
161
|
|
|
145
162
|
}
|
|
146
163
|
|
|
147
|
-
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any,formDataHolder:any) {
|
|
164
|
+
function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
|
|
148
165
|
if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
149
166
|
store.setSchema((pre) => {
|
|
150
167
|
return {
|
|
@@ -174,14 +191,17 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
|
|
|
174
191
|
}
|
|
175
192
|
else if (eventConfig.type === "page") {
|
|
176
193
|
if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
store.newData = {
|
|
195
|
+
...store.newData,
|
|
196
|
+
...handlerResponse?.data
|
|
197
|
+
}
|
|
198
|
+
store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
|
|
179
199
|
}
|
|
180
200
|
}
|
|
181
201
|
else {
|
|
182
202
|
if (handlerResponse) {
|
|
183
203
|
formDataHolder[componentName] = eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data
|
|
184
|
-
|
|
204
|
+
store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
|
|
185
205
|
}
|
|
186
206
|
}
|
|
187
207
|
}
|
|
@@ -248,14 +268,10 @@ export function buildApiPayload(compConfig: any, body: any, headers: any, store:
|
|
|
248
268
|
if (compConfig?.headers) {
|
|
249
269
|
headers = buildHeadersFormat(compConfig.headers);
|
|
250
270
|
}
|
|
251
|
-
|
|
252
271
|
if (compConfig.body) {
|
|
253
272
|
body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
|
|
254
273
|
}
|
|
255
|
-
|
|
256
274
|
const promiseChain = { body, headers };
|
|
257
|
-
|
|
258
|
-
|
|
259
275
|
if (compConfig.apiBody) {
|
|
260
276
|
const makeFunc = eval(compConfig.apiBody);
|
|
261
277
|
return { body: makeFunc(store, dynamicData, userValue, promiseChain.body), headers: promiseChain.headers };
|
|
@@ -54,7 +54,6 @@ export const extractEvents = (eventConfig: any) => {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
extractsConfigEvents(eventConfig)
|
|
59
58
|
if (eventConfig?.elements) {
|
|
60
59
|
eventConfig.elements.forEach(extractEvents);
|
|
@@ -72,12 +71,12 @@ export default (funcParams: funcParamsProps) => {
|
|
|
72
71
|
config: {}, componentName: "",
|
|
73
72
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
74
73
|
serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
|
|
75
|
-
functionsProvider: funcParams.functionsProvider,formDataHolder
|
|
74
|
+
functionsProvider: funcParams.functionsProvider, formDataHolder
|
|
76
75
|
};
|
|
77
76
|
return {
|
|
78
77
|
setPage: async function () {
|
|
79
|
-
funcParams.store.setFormdata({})
|
|
80
|
-
|
|
78
|
+
funcParams.store.setFormdata({});
|
|
79
|
+
funcParams.store.newData = {};
|
|
81
80
|
const pageBasicDetailString = localStorage.getItem("pagemasterMetaData")
|
|
82
81
|
if (pageBasicDetailString) {
|
|
83
82
|
pageData = JSON.parse(pageBasicDetailString)
|
|
@@ -114,7 +113,6 @@ export default (funcParams: funcParamsProps) => {
|
|
|
114
113
|
)
|
|
115
114
|
uiSchema.elements.push(notifyUiSchema);
|
|
116
115
|
funcParams.store.setUiSchema(uiSchema);
|
|
117
|
-
|
|
118
116
|
},
|
|
119
117
|
onCellRenderer: (cellParams) => {
|
|
120
118
|
if (eventGroups.onCellRenderer) {
|
|
@@ -241,10 +239,8 @@ export default (funcParams: funcParamsProps) => {
|
|
|
241
239
|
componentName: path
|
|
242
240
|
})
|
|
243
241
|
}))
|
|
244
|
-
|
|
245
242
|
}
|
|
246
243
|
},
|
|
247
|
-
|
|
248
244
|
downloadFile: downloadFile,
|
|
249
245
|
download: doDownload,
|
|
250
246
|
...funcParams.functionsProvider
|