@aemforms/af-core 0.22.142 → 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.
@@ -3638,6 +3638,10 @@ class FunctionRuntimeImpl {
3638
3638
  }
3639
3639
  const FunctionRuntime = FunctionRuntimeImpl.getInstance();
3640
3640
 
3641
+ const transformFieldName = (fieldName) => {
3642
+ return fieldName.split('.').slice(1).map(p => p.match(/\[\d+\]$/) ? p : p !== '' ? `${p}[0]` : p).join('.');
3643
+ };
3644
+
3641
3645
  class Version {
3642
3646
  #minor;
3643
3647
  #major;
@@ -3805,36 +3809,39 @@ class Form extends Container {
3805
3809
  return foundFormElement;
3806
3810
  }
3807
3811
  exportSubmitMetaData() {
3808
- const captchaInfoObj = {};
3809
- this.visit(field => {
3810
- if (field.fieldType === 'captcha') {
3811
- 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
+ }
3812
3834
  }
3813
- });
3814
- const additionalMeta = {};
3815
- const draftId = this.properties['fd:draftId'] || '';
3816
- if (draftId) {
3817
- additionalMeta['fd:draftId'] = draftId;
3818
- }
3819
- const dorProps = this.properties['fd:dor'];
3820
- if (dorProps && dorProps.dorType !== 'none') {
3821
- const excludeFromDoRIfHidden = dorProps['fd:excludeFromDoRIfHidden'];
3822
- const excludeFromDoR = Object.values(this._fields)
3823
- .filter(field => field.enabled === false || (excludeFromDoRIfHidden && field.visible === false))
3824
- .map(field => field.qualifiedName);
3825
- if (excludeFromDoR && excludeFromDoR.length > 0) {
3826
- additionalMeta.excludeFromDoR = excludeFromDoR;
3835
+ if (Object.keys(additionalMeta).length > 0) {
3836
+ this.setAdditionalSubmitMetadata(additionalMeta);
3827
3837
  }
3828
- }
3829
- if (Object.keys(additionalMeta).length > 0) {
3830
- this.setAdditionalSubmitMetadata(additionalMeta);
3831
- }
3832
- const options = {
3833
- lang: this.lang,
3834
- captchaInfo: captchaInfoObj,
3835
- ...this.additionalSubmitMetadata
3836
- };
3837
- return new SubmitMetaData(options);
3838
+ const options = {
3839
+ lang: this.lang,
3840
+ captchaInfo: captchaInfoObj,
3841
+ ...this.additionalSubmitMetadata
3842
+ };
3843
+ return new SubmitMetaData(options);
3844
+ });
3838
3845
  }
3839
3846
  #getNavigableChildren(children) {
3840
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();
@@ -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.142",
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.142"
40
+ "@aemforms/af-formatters": "^0.22.143"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",