impaktapps-ui-builder 0.0.412-a → 0.0.412-d

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<void>;
4
+ export declare function executeRefreshHandler(params: handlersProps): Promise<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): {
@@ -9,4 +9,5 @@ export interface handlersProps {
9
9
  eventGroups?: any;
10
10
  parentEventOutput?: any;
11
11
  functionsProvider?: Record<string, any>;
12
+ formDataHolder?: Record<string, any>;
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.412a",
3
+ "version": "0.0.412d",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -68,7 +68,8 @@ function executeEventsHandler(params: handlersProps) {
68
68
  params.componentName,
69
69
  params.config,
70
70
  params.store,
71
- params.service
71
+ params.service,
72
+ params.formDataHolder
72
73
  );
73
74
  } else if (params.config.Handler === "onBackHandler") {
74
75
  return params.store.functionParameters?.handleBack();
@@ -102,9 +103,7 @@ export function executeRefreshHandler(params: handlersProps) {
102
103
  return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
103
104
  return executeEvents({ ...params, config: compEventConfig, componentName });
104
105
  }));
105
- })).then(() => {
106
- params.store.setFormdata(params.store.ctx.core.data)
107
- })
106
+ }))
108
107
  };
109
108
  export function executeApiRequest(params: any) {
110
109
  const initialBody = { ...params.userValue?.payload };
@@ -145,7 +144,7 @@ function executeCustomHandler(params: handlersProps) {
145
144
 
146
145
  }
147
146
 
148
- function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
147
+ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any,formDataHolder:any) {
149
148
  if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
150
149
  store.setSchema((pre) => {
151
150
  return {
@@ -175,16 +174,14 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
175
174
  }
176
175
  else if (eventConfig.type === "page") {
177
176
  if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
178
- store.ctx.core.data = { ...store.ctx.core.data, ...handlerResponse.data }
179
- // store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
177
+
178
+ store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
180
179
  }
181
180
  }
182
181
  else {
183
182
  if (handlerResponse) {
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 } });
183
+ formDataHolder[componentName] = eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data
184
+ store.setFormdata((pre) => { return { ...pre,...formDataHolder } });
188
185
  }
189
186
  }
190
187
  }
@@ -9,4 +9,5 @@ export interface handlersProps {
9
9
  eventGroups?: any,
10
10
  parentEventOutput?: any,
11
11
  functionsProvider?:Record<string,any>
12
+ formDataHolder?:Record<string,any>
12
13
  }
@@ -12,7 +12,7 @@ const notifyUiSchema = {
12
12
  },
13
13
  layout: 6,
14
14
  };
15
-
15
+ let formDataHolder = {}
16
16
  interface funcParamsProps {
17
17
  store: any,
18
18
  dynamicData: any,
@@ -72,7 +72,7 @@ export default (funcParams: funcParamsProps) => {
72
72
  config: {}, componentName: "",
73
73
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
74
74
  serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
75
- functionsProvider: funcParams.functionsProvider,
75
+ functionsProvider: funcParams.functionsProvider,formDataHolder
76
76
  };
77
77
  return {
78
78
  setPage: async function () {
@@ -184,9 +184,7 @@ export default (funcParams: funcParamsProps) => {
184
184
  })
185
185
  }
186
186
  }
187
- })).then((res) => {
188
- funcParams.store.setFormdata(funcParams.store.ctx.core.data)
189
- })
187
+ }))
190
188
  }
191
189
  },
192
190
  updateConfigApiBody: async function (paramValue, apiBody) {
@@ -232,6 +230,7 @@ export default (funcParams: funcParamsProps) => {
232
230
  }
233
231
  },
234
232
  callHandler: async function (eventType: string, functionParameters?: any) {
233
+ formDataHolder = {}
235
234
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
236
235
  if (eventGroups?.[eventType]?.[path] !== undefined) {
237
236
  Promise.all(eventGroups?.[eventType]?.[path].map((eventConfig) => {
@@ -241,9 +240,7 @@ export default (funcParams: funcParamsProps) => {
241
240
  config: eventConfig,
242
241
  componentName: path
243
242
  })
244
- })).then((res) => {
245
- funcParams.store.setFormdata(funcParams.store.ctx.core.data)
246
- })
243
+ }))
247
244
 
248
245
  }
249
246
  },