@aemforms/af-core 0.22.141 → 0.22.143

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.
@@ -3052,9 +3052,7 @@ class FunctionRuntimeImpl {
3052
3052
  setProperty: (target, payload) => {
3053
3053
  const field = interpreter.globals.form.getElement(target.$id);
3054
3054
  Object.entries(payload).forEach(([key, value]) => {
3055
- if (value !== null) {
3056
- field[key] = value;
3057
- }
3055
+ field[key] = value;
3058
3056
  });
3059
3057
  },
3060
3058
  reset: (target) => {
@@ -3640,6 +3638,10 @@ class FunctionRuntimeImpl {
3640
3638
  }
3641
3639
  const FunctionRuntime = FunctionRuntimeImpl.getInstance();
3642
3640
 
3641
+ const transformFieldName = (fieldName) => {
3642
+ return fieldName.split('.').slice(1).map(p => p.match(/\[\d+\]$/) ? p : p !== '' ? `${p}[0]` : p).join('.');
3643
+ };
3644
+
3643
3645
  class Version {
3644
3646
  #minor;
3645
3647
  #major;
@@ -3807,36 +3809,39 @@ class Form extends Container {
3807
3809
  return foundFormElement;
3808
3810
  }
3809
3811
  exportSubmitMetaData() {
3810
- const captchaInfoObj = {};
3811
- this.visit(field => {
3812
- if (field.fieldType === 'captcha') {
3813
- captchaInfoObj[field.qualifiedName] = field.value;
3812
+ return this.withDependencyTrackingControl(true, () => {
3813
+ const captchaInfoObj = {};
3814
+ this.visit(field => {
3815
+ if (field.fieldType === 'captcha') {
3816
+ captchaInfoObj[field.qualifiedName] = field.value;
3817
+ }
3818
+ });
3819
+ const additionalMeta = {};
3820
+ const draftId = this.properties['fd:draftId'] || '';
3821
+ if (draftId) {
3822
+ additionalMeta['fd:draftId'] = draftId;
3823
+ }
3824
+ const dorProps = this.properties['fd:dor'];
3825
+ if (dorProps && dorProps.dorType !== 'none') {
3826
+ const excludeFromDoRIfHidden = dorProps['fd:excludeFromDoRIfHidden'];
3827
+ let excludeFromDoR = [];
3828
+ excludeFromDoR = Object.values(this._fields)
3829
+ .filter(field => field.enabled === false || (excludeFromDoRIfHidden && field.visible === false))
3830
+ .map(field => transformFieldName(field.qualifiedName));
3831
+ if (excludeFromDoR && excludeFromDoR.length > 0) {
3832
+ additionalMeta.excludeFromDoR = excludeFromDoR;
3833
+ }
3814
3834
  }
3815
- });
3816
- const additionalMeta = {};
3817
- const draftId = this.properties['fd:draftId'] || '';
3818
- if (draftId) {
3819
- additionalMeta['fd:draftId'] = draftId;
3820
- }
3821
- const dorProps = this.properties['fd:dor'];
3822
- if (dorProps && dorProps.dorType !== 'none') {
3823
- const excludeFromDoRIfHidden = dorProps['fd:excludeFromDoRIfHidden'];
3824
- const excludeFromDoR = Object.values(this._fields)
3825
- .filter(field => field.enabled === false || (excludeFromDoRIfHidden && field.visible === false))
3826
- .map(field => field.qualifiedName);
3827
- if (excludeFromDoR && excludeFromDoR.length > 0) {
3828
- additionalMeta.excludeFromDoR = excludeFromDoR;
3835
+ if (Object.keys(additionalMeta).length > 0) {
3836
+ this.setAdditionalSubmitMetadata(additionalMeta);
3829
3837
  }
3830
- }
3831
- if (Object.keys(additionalMeta).length > 0) {
3832
- this.setAdditionalSubmitMetadata(additionalMeta);
3833
- }
3834
- const options = {
3835
- lang: this.lang,
3836
- captchaInfo: captchaInfoObj,
3837
- ...this.additionalSubmitMetadata
3838
- };
3839
- return new SubmitMetaData(options);
3838
+ const options = {
3839
+ lang: this.lang,
3840
+ captchaInfo: captchaInfoObj,
3841
+ ...this.additionalSubmitMetadata
3842
+ };
3843
+ return new SubmitMetaData(options);
3844
+ });
3840
3845
  }
3841
3846
  #getNavigableChildren(children) {
3842
3847
  return children.filter(child => child.visible === true);
@@ -0,0 +1 @@
1
+ export declare const transformFieldName: (fieldName: string) => string;
package/lib/Form.js CHANGED
@@ -29,6 +29,7 @@ const DataGroup_1 = __importDefault(require("./data/DataGroup"));
29
29
  const FunctionRuntime_1 = require("./rules/FunctionRuntime");
30
30
  const index_1 = require("./types/index");
31
31
  const FormUtils_1 = require("./utils/FormUtils");
32
+ const DorUtils_1 = require("./utils/DorUtils");
32
33
  const Version_1 = require("./utils/Version");
33
34
  exports.currentVersion = new Version_1.Version('0.13');
34
35
  const changeEventVersion = new Version_1.Version('0.13');
@@ -153,32 +154,35 @@ class Form extends Container_1.default {
153
154
  return foundFormElement;
154
155
  }
155
156
  exportSubmitMetaData() {
156
- const captchaInfoObj = {};
157
- this.visit(field => {
158
- if (field.fieldType === 'captcha') {
159
- captchaInfoObj[field.qualifiedName] = field.value;
157
+ return this.withDependencyTrackingControl(true, () => {
158
+ const captchaInfoObj = {};
159
+ this.visit(field => {
160
+ if (field.fieldType === 'captcha') {
161
+ captchaInfoObj[field.qualifiedName] = field.value;
162
+ }
163
+ });
164
+ const additionalMeta = {};
165
+ const draftId = this.properties['fd:draftId'] || '';
166
+ if (draftId) {
167
+ additionalMeta['fd:draftId'] = draftId;
160
168
  }
161
- });
162
- const additionalMeta = {};
163
- const draftId = this.properties['fd:draftId'] || '';
164
- if (draftId) {
165
- additionalMeta['fd:draftId'] = draftId;
166
- }
167
- const dorProps = this.properties['fd:dor'];
168
- if (dorProps && dorProps.dorType !== 'none') {
169
- const excludeFromDoRIfHidden = dorProps['fd:excludeFromDoRIfHidden'];
170
- const excludeFromDoR = Object.values(this._fields)
171
- .filter(field => field.enabled === false || (excludeFromDoRIfHidden && field.visible === false))
172
- .map(field => field.qualifiedName);
173
- if (excludeFromDoR && excludeFromDoR.length > 0) {
174
- additionalMeta.excludeFromDoR = excludeFromDoR;
169
+ const dorProps = this.properties['fd:dor'];
170
+ if (dorProps && dorProps.dorType !== 'none') {
171
+ const excludeFromDoRIfHidden = dorProps['fd:excludeFromDoRIfHidden'];
172
+ let excludeFromDoR = [];
173
+ excludeFromDoR = Object.values(this._fields)
174
+ .filter(field => field.enabled === false || (excludeFromDoRIfHidden && field.visible === false))
175
+ .map(field => (0, DorUtils_1.transformFieldName)(field.qualifiedName));
176
+ if (excludeFromDoR && excludeFromDoR.length > 0) {
177
+ additionalMeta.excludeFromDoR = excludeFromDoR;
178
+ }
175
179
  }
176
- }
177
- if (Object.keys(additionalMeta).length > 0) {
178
- this.setAdditionalSubmitMetadata(additionalMeta);
179
- }
180
- const options = Object.assign({ lang: this.lang, captchaInfo: captchaInfoObj }, this.additionalSubmitMetadata);
181
- return new SubmitMetaData_1.default(options);
180
+ if (Object.keys(additionalMeta).length > 0) {
181
+ this.setAdditionalSubmitMetadata(additionalMeta);
182
+ }
183
+ const options = Object.assign({ lang: this.lang, captchaInfo: captchaInfoObj }, this.additionalSubmitMetadata);
184
+ return new SubmitMetaData_1.default(options);
185
+ });
182
186
  }
183
187
  setFocus(field, focusOption) {
184
188
  const dependencyTracking = this._ruleEngine.getDependencyTracking();
@@ -250,9 +250,7 @@ class FunctionRuntimeImpl {
250
250
  setProperty: (target, payload) => {
251
251
  const field = interpreter.globals.form.getElement(target.$id);
252
252
  Object.entries(payload).forEach(([key, value]) => {
253
- if (value !== null) {
254
- field[key] = value;
255
- }
253
+ field[key] = value;
256
254
  });
257
255
  },
258
256
  reset: (target) => {
@@ -0,0 +1 @@
1
+ export declare const transformFieldName: (fieldName: string) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformFieldName = void 0;
4
+ const transformFieldName = (fieldName) => {
5
+ return fieldName.split('.').slice(1).map(p => p.match(/\[\d+\]$/) ? p : p !== '' ? `${p}[0]` : p).join('.');
6
+ };
7
+ exports.transformFieldName = transformFieldName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.141",
3
+ "version": "0.22.143",
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.141"
40
+ "@aemforms/af-formatters": "^0.22.143"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",