impaktapps-ui-builder 0.0.382-alpha.325 → 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,7 +1,10 @@
|
|
|
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";
|
|
5
|
+
|
|
6
|
+
import { debounce } from "lodash";
|
|
7
|
+
|
|
5
8
|
let compType: string;
|
|
6
9
|
let eventGroups: any = {};
|
|
7
10
|
const notifyUiSchema = {
|
|
@@ -64,6 +67,14 @@ export default (funcParams: funcParamsProps) => {
|
|
|
64
67
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
65
68
|
serviceHolder: { downloadFile,download:doDownload }, eventGroups
|
|
66
69
|
};
|
|
70
|
+
const handleButtonClick = debounce(async function() {
|
|
71
|
+
await this.callHandler("onClick");
|
|
72
|
+
}, 300); // adjust the delay as needed
|
|
73
|
+
|
|
74
|
+
const throttledExecuteEvents = throttle(async (executeEventsParams) => {
|
|
75
|
+
await executeEvents(executeEventsParams);
|
|
76
|
+
}, 1000); // Adjust the time window as needed
|
|
77
|
+
|
|
67
78
|
return {
|
|
68
79
|
setPage: async function () {
|
|
69
80
|
funcParams.store.setFormdata({});
|
|
@@ -87,15 +98,18 @@ export default (funcParams: funcParamsProps) => {
|
|
|
87
98
|
funcParams.uiSchema.elements.push(notifyUiSchema);
|
|
88
99
|
funcParams.store.setUiSchema(funcParams.uiSchema);
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
|
|
91
102
|
await executeRefreshHandler({
|
|
92
103
|
config: {}, componentName: "",
|
|
93
104
|
store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
|
|
94
105
|
serviceHolder: this, eventGroups
|
|
95
106
|
})
|
|
96
107
|
},
|
|
108
|
+
// onClick: async function () {
|
|
109
|
+
// await this.callHandler("onClick")
|
|
110
|
+
// },
|
|
97
111
|
onClick: async function () {
|
|
98
|
-
|
|
112
|
+
handleButtonClick();
|
|
99
113
|
},
|
|
100
114
|
onFileDownload: async function () {
|
|
101
115
|
await this.callHandler("onDownload")
|
|
@@ -184,16 +198,31 @@ export default (funcParams: funcParamsProps) => {
|
|
|
184
198
|
functionParameters?.handleReset()
|
|
185
199
|
}
|
|
186
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
|
+
// },
|
|
187
214
|
callHandler: async function (eventType: string, functionParameters?: any) {
|
|
188
215
|
const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
|
|
189
216
|
if (eventGroups?.[eventType]?.[path] !== undefined) {
|
|
190
217
|
for (const eventConfig of eventGroups?.[eventType]?.[path]) {
|
|
191
|
-
executeEventsParameters.store.functionParameters = functionParameters
|
|
192
|
-
|
|
218
|
+
executeEventsParameters.store.functionParameters = functionParameters;
|
|
219
|
+
|
|
220
|
+
// Throttle the execution of the executeEvents function
|
|
221
|
+
await throttledExecuteEvents({
|
|
193
222
|
...executeEventsParameters,
|
|
194
223
|
config: eventConfig,
|
|
195
|
-
componentName: path
|
|
196
|
-
})
|
|
224
|
+
componentName: path,
|
|
225
|
+
});
|
|
197
226
|
}
|
|
198
227
|
}
|
|
199
228
|
},
|