impaktapps-ui-builder 0.0.382-alpha.326 → 0.0.382-alpha.327

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.382-alpha.326",
3
+ "version": "0.0.382-alpha.327",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -1,4 +1,4 @@
1
- import _, { isEmpty } from "lodash";
1
+ import _, { isEmpty, throttle } from "lodash";
2
2
  import { doDownload, downloadFile } from "./downloadFile";
3
3
  import { executeEvents, executeRefreshHandler } from "./events";
4
4
  import { handlersProps } from "./interface";
@@ -71,6 +71,10 @@ export default (funcParams: funcParamsProps) => {
71
71
  await this.callHandler("onClick");
72
72
  }, 300); // adjust the delay as needed
73
73
 
74
+ const throttledExecuteEvents = throttle(async (executeEventsParams) => {
75
+ await executeEvents(executeEventsParams);
76
+ }, 1000); // Adjust the time window as needed
77
+
74
78
  return {
75
79
  setPage: async function () {
76
80
  funcParams.store.setFormdata({});
@@ -194,16 +198,31 @@ export default (funcParams: funcParamsProps) => {
194
198
  functionParameters?.handleReset()
195
199
  }
196
200
  },
201
+ // callHandler: async function (eventType: string, functionParameters?: any) {
202
+ // const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
203
+ // if (eventGroups?.[eventType]?.[path] !== undefined) {
204
+ // for (const eventConfig of eventGroups?.[eventType]?.[path]) {
205
+ // executeEventsParameters.store.functionParameters = functionParameters
206
+ // await executeEvents({
207
+ // ...executeEventsParameters,
208
+ // config: eventConfig,
209
+ // componentName: path
210
+ // })
211
+ // }
212
+ // }
213
+ // },
197
214
  callHandler: async function (eventType: string, functionParameters?: any) {
198
215
  const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
199
216
  if (eventGroups?.[eventType]?.[path] !== undefined) {
200
217
  for (const eventConfig of eventGroups?.[eventType]?.[path]) {
201
- executeEventsParameters.store.functionParameters = functionParameters
202
- await executeEvents({
218
+ executeEventsParameters.store.functionParameters = functionParameters;
219
+
220
+ // Throttle the execution of the executeEvents function
221
+ await throttledExecuteEvents({
203
222
  ...executeEventsParameters,
204
223
  config: eventConfig,
205
- componentName: path
206
- })
224
+ componentName: path,
225
+ });
207
226
  }
208
227
  }
209
228
  },