impaktapps-ui-builder 0.0.411 → 0.0.412-b

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.412b",
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,10 @@ 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
+ const updatedData = _.cloneDeep(params.store.ctx.core.data)
107
+ params.store.setFormdata(updatedData)
108
+ })
106
109
  };
107
110
  export function executeApiRequest(params: any) {
108
111
  const initialBody = { ...params.userValue?.payload };
@@ -173,12 +176,16 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
173
176
  }
174
177
  else if (eventConfig.type === "page") {
175
178
  if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
176
- store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
179
+ store.ctx.core.data = { ...store.ctx.core.data, ...handlerResponse.data }
180
+ // store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
177
181
  }
178
182
  }
179
183
  else {
180
184
  if (handlerResponse) {
181
- store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
185
+ store.ctx.core.data[componentName] =
186
+ eventConfig.lazyLoading ?
187
+ handlerResponse?.data?.data : handlerResponse.data
188
+ // store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
182
189
  }
183
190
  }
184
191
  }
@@ -184,7 +184,10 @@ export default (funcParams: funcParamsProps) => {
184
184
  })
185
185
  }
186
186
  }
187
- }))
187
+ })).then((res) => {
188
+ const updatedData = _.cloneDeep(funcParams.store.ctx.core.data)
189
+ funcParams.store.setFormdata(updatedData)
190
+ })
188
191
  }
189
192
  },
190
193
  updateConfigApiBody: async function (paramValue, apiBody) {
@@ -232,14 +235,18 @@ export default (funcParams: funcParamsProps) => {
232
235
  callHandler: async function (eventType: string, functionParameters?: any) {
233
236
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
234
237
  if (eventGroups?.[eventType]?.[path] !== undefined) {
235
- for (const eventConfig of eventGroups?.[eventType]?.[path]) {
238
+ Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
236
239
  executeEventsParameters.store.functionParameters = functionParameters
237
240
  executeEvents({
238
241
  ...executeEventsParameters,
239
242
  config: eventConfig,
240
243
  componentName: path
241
244
  })
242
- }
245
+ })).then((res) => {
246
+ const updatedData = _.cloneDeep(funcParams.store.ctx.core.data)
247
+ funcParams.store.setFormdata(updatedData)
248
+ })
249
+
243
250
  }
244
251
  },
245
252