@aemforms/af-core 0.22.67 → 0.22.68

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.
Files changed (2) hide show
  1. package/lib/Form.js +19 -1
  2. package/package.json +2 -2
package/lib/Form.js CHANGED
@@ -156,7 +156,25 @@ class Form extends Container_1.default {
156
156
  field.subscribe((action) => {
157
157
  const field = action.target.getState();
158
158
  if (field) {
159
- const fieldChangedAction = new Events_1.FieldChanged(action.payload.changes, field);
159
+ const shallowClone = (obj) => {
160
+ if (obj && typeof obj === 'object') {
161
+ if (Array.isArray(obj)) {
162
+ return obj.map(shallowClone);
163
+ }
164
+ else {
165
+ return Object.assign({}, obj);
166
+ }
167
+ }
168
+ return obj;
169
+ };
170
+ const changes = action.payload.changes.map(({ propertyName, currentValue, prevValue }) => {
171
+ return {
172
+ propertyName,
173
+ currentValue: shallowClone(currentValue),
174
+ prevValue: shallowClone(prevValue)
175
+ };
176
+ });
177
+ const fieldChangedAction = new Events_1.FieldChanged(changes, field);
160
178
  this.dispatch(fieldChangedAction);
161
179
  }
162
180
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.67",
3
+ "version": "0.22.68",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/json-formula": "0.1.50",
38
- "@aemforms/af-formatters": "^0.22.67"
38
+ "@aemforms/af-formatters": "^0.22.68"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@babel/preset-env": "^7.20.2",