impaktapps-ui-builder 1.0.421 → 1.0.422

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.
@@ -24,7 +24,7 @@ declare const _default: (funcParams: funcParamsProps) => {
24
24
  onRowMovement: (paginationValues: any) => Promise<any>;
25
25
  onPaginationChange: (paginationValues: any) => Promise<any>;
26
26
  getSelectOptions: (param: any) => Promise<any>;
27
- onChange: () => void;
27
+ onChange: (updatedData: any) => void;
28
28
  callExecuteEvents: (paramValue: any, apiBody: any, eventType: string) => Promise<any>;
29
29
  onBack: (functionParameters: any) => Promise<void>;
30
30
  onNext: (functionParameters: any) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "1.0.421",
3
+ "version": "1.0.422",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -205,38 +205,44 @@ export default (funcParams: funcParamsProps) => {
205
205
  return response?.data;
206
206
  }
207
207
  },
208
- onChange: function () {
208
+ onChange: function (updatedData) {
209
209
  if (!eventGroups.onChange) return;
210
-
211
210
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
212
-
213
211
  const promises = ChangeEventsKeysArray.flatMap((componentName: string) => {
214
212
  if (
215
- funcParams.store?.formData[componentName] === funcParams.store.newData[componentName] ||
216
- funcParams.store?.newData[componentName] === undefined
213
+ funcParams.store?.formData[componentName] !== funcParams.store.newData[componentName]
217
214
  ) {
218
- return [];
219
- }
220
-
221
- return eventGroups.onChange[componentName].map(eventConfig =>
222
- Promise.resolve(
223
- executeEvents({
224
- ...executeEventsParameters,
225
- config: eventConfig,
226
- componentName,
227
- formDataHolder
215
+ if (funcParams.store.newData[componentName] === undefined) {
216
+ const allKeys = _.union(
217
+ Object.keys(funcParams.store.formData),
218
+ Object.keys(updatedData),
219
+ );
220
+ const changedKeys = allKeys.filter(
221
+ (key) => !_.isEqual(funcParams.store.formData[key], updatedData[key]),
222
+ );
223
+ if (!changedKeys[0]) { return [] }
224
+ }
225
+ return eventGroups.onChange[componentName].map(eventConfig =>
226
+ Promise.resolve(
227
+ executeEvents({
228
+ ...executeEventsParameters,
229
+ config: eventConfig,
230
+ componentName,
231
+ formDataHolder
232
+ })
233
+ ).then(() => {
234
+ if (!isEmpty(formDataHolder)) {
235
+ funcParams.store.setFormdata(pre => ({
236
+ ...pre,
237
+ ...formDataHolder
238
+ }));
239
+ }
228
240
  })
229
- ).then(() => {
230
- if (!isEmpty(formDataHolder)) {
231
- funcParams.store.setFormdata(pre => ({
232
- ...pre,
233
- ...formDataHolder
234
- }));
235
- }
236
- })
237
- );
238
- });
241
+ );
239
242
 
243
+ }
244
+ return [];
245
+ });
240
246
  Promise.allSettled(promises);
241
247
  },
242
248
  callExecuteEvents: async function (paramValue, apiBody, eventType: string) {