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