@aemforms/af-core 0.22.138 → 0.22.140

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.
@@ -3047,9 +3047,12 @@ class FunctionRuntimeImpl {
3047
3047
  event: interpreter.globals.$event,
3048
3048
  functions: {
3049
3049
  setProperty: (target, payload) => {
3050
- const eventName = 'custom:setProperty';
3051
- const args = [target, eventName, payload];
3052
- return FunctionRuntimeImpl.getInstance().getFunctions().dispatchEvent._func.call(undefined, args, data, interpreter);
3050
+ const field = interpreter.globals.form.getElement(target.$id);
3051
+ Object.entries(payload).forEach(([key, value]) => {
3052
+ if (value !== null) {
3053
+ field[key] = value;
3054
+ }
3055
+ });
3053
3056
  },
3054
3057
  reset: (target) => {
3055
3058
  const eventName = 'reset';
@@ -3292,7 +3295,7 @@ class FunctionRuntimeImpl {
3292
3295
  const variableValueElement = interpreter.globals.form.getElement(variableValue.$id);
3293
3296
  variableValue = variableValueElement._jsonModel.value;
3294
3297
  }
3295
- const target = interpreter.globals.form.getElement(normalFieldOrPanel.$id);
3298
+ const target = normalFieldOrPanel.$id ? interpreter.globals.form.getElement(normalFieldOrPanel.$id) : interpreter.globals.form;
3296
3299
  const propertiesManager = target.getPropertiesManager();
3297
3300
  propertiesManager.updateSimpleProperty(variableName, variableValue);
3298
3301
  return {};
@@ -3306,7 +3309,7 @@ class FunctionRuntimeImpl {
3306
3309
  if (!variableName) {
3307
3310
  return undefined;
3308
3311
  }
3309
- const target = interpreter.globals.form.getElement(normalFieldOrPanel.$id);
3312
+ const target = normalFieldOrPanel.$id ? interpreter.globals.form.getElement(normalFieldOrPanel.$id) : interpreter.globals.form;
3310
3313
  const propertiesManager = target.getPropertiesManager();
3311
3314
  if (variableName.includes('.')) {
3312
3315
  const properties = parsePropertyPath(variableName);
@@ -248,9 +248,12 @@ class FunctionRuntimeImpl {
248
248
  event: interpreter.globals.$event,
249
249
  functions: {
250
250
  setProperty: (target, payload) => {
251
- const eventName = 'custom:setProperty';
252
- const args = [target, eventName, payload];
253
- return FunctionRuntimeImpl.getInstance().getFunctions().dispatchEvent._func.call(undefined, args, data, interpreter);
251
+ const field = interpreter.globals.form.getElement(target.$id);
252
+ Object.entries(payload).forEach(([key, value]) => {
253
+ if (value !== null) {
254
+ field[key] = value;
255
+ }
256
+ });
254
257
  },
255
258
  reset: (target) => {
256
259
  const eventName = 'reset';
@@ -495,7 +498,7 @@ class FunctionRuntimeImpl {
495
498
  const variableValueElement = interpreter.globals.form.getElement(variableValue.$id);
496
499
  variableValue = variableValueElement._jsonModel.value;
497
500
  }
498
- const target = interpreter.globals.form.getElement(normalFieldOrPanel.$id);
501
+ const target = normalFieldOrPanel.$id ? interpreter.globals.form.getElement(normalFieldOrPanel.$id) : interpreter.globals.form;
499
502
  const propertiesManager = target.getPropertiesManager();
500
503
  propertiesManager.updateSimpleProperty(variableName, variableValue);
501
504
  return {};
@@ -509,7 +512,7 @@ class FunctionRuntimeImpl {
509
512
  if (!variableName) {
510
513
  return undefined;
511
514
  }
512
- const target = interpreter.globals.form.getElement(normalFieldOrPanel.$id);
515
+ const target = normalFieldOrPanel.$id ? interpreter.globals.form.getElement(normalFieldOrPanel.$id) : interpreter.globals.form;
513
516
  const propertiesManager = target.getPropertiesManager();
514
517
  if (variableName.includes('.')) {
515
518
  const properties = parsePropertyPath(variableName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.138",
3
+ "version": "0.22.140",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.138"
40
+ "@aemforms/af-formatters": "^0.22.140"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",