@aemforms/af-core 0.22.118 → 0.22.119

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.
@@ -3450,28 +3450,35 @@ class Form extends Container {
3450
3450
  }
3451
3451
  }
3452
3452
  setFocus(field, focusOption) {
3453
- if (!focusOption) {
3454
- this.#clearCurrentFocus(field);
3455
- this.#setActiveFirstDeepChild(field);
3456
- return;
3457
- }
3458
- const parent = (field?.isContainer ? field : field.parent);
3459
- const navigableChidren = this.#getNavigableChildren(parent.items);
3460
- let activeChild = parent.activeChild;
3461
- let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
3462
- if (parent.activeChild === null) {
3463
- this.#setActiveFirstDeepChild(navigableChidren[0]);
3464
- currActiveChildIndex = 0;
3465
- return;
3466
- }
3467
- if (focusOption === FocusOption.NEXT_ITEM) {
3468
- activeChild = this.#getNextItem(currActiveChildIndex, navigableChidren);
3469
- }
3470
- else if (focusOption === FocusOption.PREVIOUS_ITEM) {
3471
- activeChild = this.#getPreviousItem(currActiveChildIndex, navigableChidren);
3453
+ const dependencyTracking = this._ruleEngine.getDependencyTracking();
3454
+ this._ruleEngine.setDependencyTracking(false);
3455
+ try {
3456
+ if (!focusOption) {
3457
+ this.#clearCurrentFocus(field);
3458
+ this.#setActiveFirstDeepChild(field);
3459
+ return;
3460
+ }
3461
+ const parent = (field?.isContainer ? field : field.parent);
3462
+ const navigableChidren = this.#getNavigableChildren(parent.items);
3463
+ let activeChild = parent.activeChild;
3464
+ let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
3465
+ if (parent.activeChild === null) {
3466
+ this.#setActiveFirstDeepChild(navigableChidren[0]);
3467
+ currActiveChildIndex = 0;
3468
+ return;
3469
+ }
3470
+ if (focusOption === FocusOption.NEXT_ITEM) {
3471
+ activeChild = this.#getNextItem(currActiveChildIndex, navigableChidren);
3472
+ }
3473
+ else if (focusOption === FocusOption.PREVIOUS_ITEM) {
3474
+ activeChild = this.#getPreviousItem(currActiveChildIndex, navigableChidren);
3475
+ }
3476
+ if (activeChild !== null) {
3477
+ this.#setActiveFirstDeepChild(activeChild);
3478
+ }
3472
3479
  }
3473
- if (activeChild !== null) {
3474
- this.#setActiveFirstDeepChild(activeChild);
3480
+ finally {
3481
+ this._ruleEngine.setDependencyTracking(dependencyTracking);
3475
3482
  }
3476
3483
  }
3477
3484
  getState(forRestore = false) {
@@ -3681,6 +3688,7 @@ class RuleEngine {
3681
3688
  ];
3682
3689
  customFunctions;
3683
3690
  debugInfo = [];
3691
+ dependencyTracking = true;
3684
3692
  constructor() {
3685
3693
  this.customFunctions = FunctionRuntime.getFunctions();
3686
3694
  }
@@ -3715,10 +3723,16 @@ class RuleEngine {
3715
3723
  return finalRes;
3716
3724
  }
3717
3725
  trackDependency(subscriber) {
3718
- if (this._context && this._context.field !== undefined && this._context.field !== subscriber) {
3726
+ if (this.dependencyTracking && this._context && this._context.field !== undefined && this._context.field !== subscriber) {
3719
3727
  subscriber._addDependent(this._context.field);
3720
3728
  }
3721
3729
  }
3730
+ setDependencyTracking(track) {
3731
+ this.dependencyTracking = track;
3732
+ }
3733
+ getDependencyTracking() {
3734
+ return this.dependencyTracking;
3735
+ }
3722
3736
  }
3723
3737
 
3724
3738
  class Fieldset extends Container {
@@ -3873,6 +3887,9 @@ class Field extends Scriptable {
3873
3887
  if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
3874
3888
  this._jsonModel.value = undefined;
3875
3889
  }
3890
+ else if (this.fieldType === 'image') {
3891
+ this._jsonModel.value = this._jsonModel.properties['fd:repoPath'] ?? this._jsonModel.value;
3892
+ }
3876
3893
  else {
3877
3894
  this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
3878
3895
  }
@@ -5,6 +5,7 @@ declare class RuleEngine {
5
5
  private _globalNames;
6
6
  private readonly customFunctions;
7
7
  private debugInfo;
8
+ private dependencyTracking;
8
9
  constructor();
9
10
  compileRule(rule: string, locale?: string): {
10
11
  formula: Formula;
@@ -12,5 +13,7 @@ declare class RuleEngine {
12
13
  };
13
14
  execute(node: any, data: any, globals: any, useValueOf: boolean | undefined, eString: string): any;
14
15
  trackDependency(subscriber: BaseModel): void;
16
+ setDependencyTracking(track: boolean): void;
17
+ getDependencyTracking(): boolean;
15
18
  }
16
19
  export default RuleEngine;
package/lib/Field.js CHANGED
@@ -100,6 +100,7 @@ class Field extends Scriptable_1.default {
100
100
  return finalType;
101
101
  }
102
102
  _applyDefaults() {
103
+ var _a;
103
104
  super._applyDefaultsInModel();
104
105
  this.coerceParam('required', 'boolean');
105
106
  this.coerceParam('readOnly', 'boolean');
@@ -111,6 +112,9 @@ class Field extends Scriptable_1.default {
111
112
  if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
112
113
  this._jsonModel.value = undefined;
113
114
  }
115
+ else if (this.fieldType === 'image') {
116
+ this._jsonModel.value = (_a = this._jsonModel.properties['fd:repoPath']) !== null && _a !== void 0 ? _a : this._jsonModel.value;
117
+ }
114
118
  else {
115
119
  this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
116
120
  }
package/lib/Form.js CHANGED
@@ -166,28 +166,35 @@ class Form extends Container_1.default {
166
166
  return new SubmitMetaData_1.default(options);
167
167
  }
168
168
  setFocus(field, focusOption) {
169
- if (!focusOption) {
170
- __classPrivateFieldGet(this, _Form_instances, "m", _Form_clearCurrentFocus).call(this, field);
171
- __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, field);
172
- return;
173
- }
174
- const parent = ((field === null || field === void 0 ? void 0 : field.isContainer) ? field : field.parent);
175
- const navigableChidren = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNavigableChildren).call(this, parent.items);
176
- let activeChild = parent.activeChild;
177
- let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
178
- if (parent.activeChild === null) {
179
- __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, navigableChidren[0]);
180
- currActiveChildIndex = 0;
181
- return;
182
- }
183
- if (focusOption === index_1.FocusOption.NEXT_ITEM) {
184
- activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNextItem).call(this, currActiveChildIndex, navigableChidren);
185
- }
186
- else if (focusOption === index_1.FocusOption.PREVIOUS_ITEM) {
187
- activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getPreviousItem).call(this, currActiveChildIndex, navigableChidren);
169
+ const dependencyTracking = this._ruleEngine.getDependencyTracking();
170
+ this._ruleEngine.setDependencyTracking(false);
171
+ try {
172
+ if (!focusOption) {
173
+ __classPrivateFieldGet(this, _Form_instances, "m", _Form_clearCurrentFocus).call(this, field);
174
+ __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, field);
175
+ return;
176
+ }
177
+ const parent = ((field === null || field === void 0 ? void 0 : field.isContainer) ? field : field.parent);
178
+ const navigableChidren = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNavigableChildren).call(this, parent.items);
179
+ let activeChild = parent.activeChild;
180
+ let currActiveChildIndex = activeChild !== null ? navigableChidren.indexOf(activeChild) : -1;
181
+ if (parent.activeChild === null) {
182
+ __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, navigableChidren[0]);
183
+ currActiveChildIndex = 0;
184
+ return;
185
+ }
186
+ if (focusOption === index_1.FocusOption.NEXT_ITEM) {
187
+ activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getNextItem).call(this, currActiveChildIndex, navigableChidren);
188
+ }
189
+ else if (focusOption === index_1.FocusOption.PREVIOUS_ITEM) {
190
+ activeChild = __classPrivateFieldGet(this, _Form_instances, "m", _Form_getPreviousItem).call(this, currActiveChildIndex, navigableChidren);
191
+ }
192
+ if (activeChild !== null) {
193
+ __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, activeChild);
194
+ }
188
195
  }
189
- if (activeChild !== null) {
190
- __classPrivateFieldGet(this, _Form_instances, "m", _Form_setActiveFirstDeepChild).call(this, activeChild);
196
+ finally {
197
+ this._ruleEngine.setDependencyTracking(dependencyTracking);
191
198
  }
192
199
  }
193
200
  getState(forRestore = false) {
@@ -5,6 +5,7 @@ declare class RuleEngine {
5
5
  private _globalNames;
6
6
  private readonly customFunctions;
7
7
  private debugInfo;
8
+ private dependencyTracking;
8
9
  constructor();
9
10
  compileRule(rule: string, locale?: string): {
10
11
  formula: Formula;
@@ -12,5 +13,7 @@ declare class RuleEngine {
12
13
  };
13
14
  execute(node: any, data: any, globals: any, useValueOf: boolean | undefined, eString: string): any;
14
15
  trackDependency(subscriber: BaseModel): void;
16
+ setDependencyTracking(track: boolean): void;
17
+ getDependencyTracking(): boolean;
15
18
  }
16
19
  export default RuleEngine;
@@ -21,6 +21,7 @@ class RuleEngine {
21
21
  '$event'
22
22
  ];
23
23
  this.debugInfo = [];
24
+ this.dependencyTracking = true;
24
25
  this.customFunctions = FunctionRuntime_1.FunctionRuntime.getFunctions();
25
26
  }
26
27
  compileRule(rule, locale) {
@@ -55,9 +56,15 @@ class RuleEngine {
55
56
  return finalRes;
56
57
  }
57
58
  trackDependency(subscriber) {
58
- if (this._context && this._context.field !== undefined && this._context.field !== subscriber) {
59
+ if (this.dependencyTracking && this._context && this._context.field !== undefined && this._context.field !== subscriber) {
59
60
  subscriber._addDependent(this._context.field);
60
61
  }
61
62
  }
63
+ setDependencyTracking(track) {
64
+ this.dependencyTracking = track;
65
+ }
66
+ getDependencyTracking() {
67
+ return this.dependencyTracking;
68
+ }
62
69
  }
63
70
  exports.default = RuleEngine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.118",
3
+ "version": "0.22.119",
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.118"
40
+ "@aemforms/af-formatters": "^0.22.119"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",