impaktapps-ui-builder 0.0.411 → 0.0.412-a

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,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<void>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.411",
3
+ "version": "0.0.412a",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -51,7 +51,7 @@ export const executeEvents = (params: handlersProps) => {
51
51
  }
52
52
  }
53
53
  return finalResponse;
54
- }
54
+ }
55
55
 
56
56
  function executeEventsHandler(params: handlersProps) {
57
57
  if (params.config.Handler === "api") {
@@ -102,7 +102,9 @@ export function executeRefreshHandler(params: handlersProps) {
102
102
  return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
103
103
  return executeEvents({ ...params, config: compEventConfig, componentName });
104
104
  }));
105
- }))
105
+ })).then(() => {
106
+ params.store.setFormdata(params.store.ctx.core.data)
107
+ })
106
108
  };
107
109
  export function executeApiRequest(params: any) {
108
110
  const initialBody = { ...params.userValue?.payload };
@@ -173,12 +175,16 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
173
175
  }
174
176
  else if (eventConfig.type === "page") {
175
177
  if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
176
- store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
178
+ store.ctx.core.data = { ...store.ctx.core.data, ...handlerResponse.data }
179
+ // store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
177
180
  }
178
181
  }
179
182
  else {
180
183
  if (handlerResponse) {
181
- store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
184
+ store.ctx.core.data[componentName] =
185
+ eventConfig.lazyLoading ?
186
+ handlerResponse?.data?.data : handlerResponse.data
187
+ // store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
182
188
  }
183
189
  }
184
190
  }
@@ -184,7 +184,9 @@ export default (funcParams: funcParamsProps) => {
184
184
  })
185
185
  }
186
186
  }
187
- }))
187
+ })).then((res) => {
188
+ funcParams.store.setFormdata(funcParams.store.ctx.core.data)
189
+ })
188
190
  }
189
191
  },
190
192
  updateConfigApiBody: async function (paramValue, apiBody) {
@@ -232,14 +234,17 @@ export default (funcParams: funcParamsProps) => {
232
234
  callHandler: async function (eventType: string, functionParameters?: any) {
233
235
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
234
236
  if (eventGroups?.[eventType]?.[path] !== undefined) {
235
- for (const eventConfig of eventGroups?.[eventType]?.[path]) {
237
+ Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
236
238
  executeEventsParameters.store.functionParameters = functionParameters
237
239
  executeEvents({
238
240
  ...executeEventsParameters,
239
241
  config: eventConfig,
240
242
  componentName: path
241
243
  })
242
- }
244
+ })).then((res) => {
245
+ funcParams.store.setFormdata(funcParams.store.ctx.core.data)
246
+ })
247
+
243
248
  }
244
249
  },
245
250