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.
@@ -10946,32 +10946,44 @@ var service = (funcParams) => {
10946
10946
  return response == null ? void 0 : response.data;
10947
10947
  }
10948
10948
  },
10949
- onChange: function() {
10949
+ onChange: function(updatedData) {
10950
10950
  if (!eventGroups.onChange)
10951
10951
  return;
10952
10952
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
10953
10953
  const promises = ChangeEventsKeysArray.flatMap((componentName) => {
10954
- var _a, _b;
10955
- if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) === funcParams.store.newData[componentName] || ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName]) === void 0) {
10956
- return [];
10957
- }
10958
- return eventGroups.onChange[componentName].map(
10959
- (eventConfig) => Promise.resolve(
10960
- executeEvents({
10961
- ...executeEventsParameters,
10962
- config: eventConfig,
10963
- componentName,
10964
- formDataHolder
10965
- })
10966
- ).then(() => {
10967
- if (!lodash.exports.isEmpty(formDataHolder)) {
10968
- funcParams.store.setFormdata((pre) => ({
10969
- ...pre,
10970
- ...formDataHolder
10971
- }));
10954
+ var _a;
10955
+ if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) !== funcParams.store.newData[componentName]) {
10956
+ if (funcParams.store.newData[componentName] === void 0) {
10957
+ const allKeys = _.union(
10958
+ Object.keys(funcParams.store.formData),
10959
+ Object.keys(updatedData)
10960
+ );
10961
+ const changedKeys = allKeys.filter(
10962
+ (key) => !_.isEqual(funcParams.store.formData[key], updatedData[key])
10963
+ );
10964
+ if (!changedKeys[0]) {
10965
+ return [];
10972
10966
  }
10973
- })
10974
- );
10967
+ }
10968
+ return eventGroups.onChange[componentName].map(
10969
+ (eventConfig) => Promise.resolve(
10970
+ executeEvents({
10971
+ ...executeEventsParameters,
10972
+ config: eventConfig,
10973
+ componentName,
10974
+ formDataHolder
10975
+ })
10976
+ ).then(() => {
10977
+ if (!lodash.exports.isEmpty(formDataHolder)) {
10978
+ funcParams.store.setFormdata((pre) => ({
10979
+ ...pre,
10980
+ ...formDataHolder
10981
+ }));
10982
+ }
10983
+ })
10984
+ );
10985
+ }
10986
+ return [];
10975
10987
  });
10976
10988
  Promise.allSettled(promises);
10977
10989
  },