@aemforms/af-core 0.22.26 → 0.22.29

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 (54) hide show
  1. package/lib/cjs/index.cjs +345 -1886
  2. package/lib/esm/BaseNode-d78cc1b0.js +478 -0
  3. package/lib/esm/BaseNode.d.ts +1 -1
  4. package/lib/esm/BaseNode.js +26 -454
  5. package/lib/esm/Checkbox.js +37 -1
  6. package/lib/esm/CheckboxGroup.js +38 -1
  7. package/lib/esm/Container.d.ts +6 -1
  8. package/lib/esm/Container.js +108 -19
  9. package/lib/esm/DateField.js +38 -2
  10. package/lib/esm/Field.d.ts +2 -2
  11. package/lib/esm/Field.js +62 -26
  12. package/lib/esm/Fieldset.js +36 -3
  13. package/lib/esm/FileObject.js +23 -1
  14. package/lib/esm/FileUpload.js +34 -1
  15. package/lib/esm/Form.d.ts +1 -1
  16. package/lib/esm/Form.js +40 -8
  17. package/lib/esm/FormInstance.js +53 -5
  18. package/lib/esm/FormMetaData.js +26 -1
  19. package/lib/esm/InstanceManager.js +35 -8
  20. package/lib/esm/Node.js +25 -1
  21. package/lib/esm/Scriptable.js +29 -2
  22. package/lib/esm/controller/EventQueue.js +23 -1
  23. package/lib/esm/controller/Events.d.ts +1 -1
  24. package/lib/esm/controller/Events.js +41 -19
  25. package/lib/esm/controller/Logger.d.ts +2 -2
  26. package/lib/esm/controller/Logger.js +23 -1
  27. package/lib/esm/data/DataGroup.js +24 -1
  28. package/lib/esm/data/DataValue.js +23 -1
  29. package/lib/esm/data/EmptyDataValue.js +23 -1
  30. package/lib/esm/index.js +55 -21
  31. package/lib/esm/rules/FunctionRuntime.d.ts +3 -3
  32. package/lib/esm/rules/FunctionRuntime.js +31 -6
  33. package/lib/esm/rules/RuleEngine.js +30 -1
  34. package/lib/esm/types/Json.d.ts +16 -16
  35. package/lib/esm/types/Json.js +24 -2
  36. package/lib/esm/types/Model.d.ts +4 -4
  37. package/lib/esm/types/Model.js +23 -1
  38. package/lib/esm/types/index.js +22 -2
  39. package/lib/esm/utils/DataRefParser.d.ts +2 -2
  40. package/lib/esm/utils/DataRefParser.js +31 -6
  41. package/lib/esm/utils/Fetch.d.ts +1 -1
  42. package/lib/esm/utils/Fetch.js +24 -2
  43. package/lib/esm/utils/FormCreationUtils.js +40 -2
  44. package/lib/esm/utils/FormUtils.js +33 -8
  45. package/lib/esm/utils/JsonUtils.js +34 -11
  46. package/lib/esm/utils/LogUtils.js +23 -1
  47. package/lib/esm/utils/SchemaUtils.js +24 -2
  48. package/lib/esm/utils/TranslationUtils.d.ts +1 -1
  49. package/lib/esm/utils/TranslationUtils.js +32 -9
  50. package/lib/esm/utils/ValidationUtils.d.ts +4 -4
  51. package/lib/esm/utils/ValidationUtils.js +30 -4
  52. package/package.json +14 -2
  53. package/lib/browser/afb-events.js +0 -151
  54. package/lib/browser/afb-runtime.js +0 -3620
@@ -1,14 +1,34 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { deepClone } from './utils/JsonUtils.js';
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import { _ as __decorate, d as dependencyTracked } from './BaseNode-d78cc1b0.js';
22
+ import { isRepeatable, deepClone } from './utils/JsonUtils.js';
8
23
  import Scriptable from './Scriptable.js';
9
- import { ExecuteRule, Initialize, propertyChange } from './controller/Events.js';
24
+ import { propertyChange, Initialize, ExecuteRule, RemoveItem } from './controller/Events.js';
10
25
  import DataGroup from './data/DataGroup.js';
11
- import { dependencyTracked } from './BaseNode.js';
26
+ import './utils/DataRefParser.js';
27
+ import './data/DataValue.js';
28
+ import './data/EmptyDataValue.js';
29
+ import './types/Json.js';
30
+ import './utils/SchemaUtils.js';
31
+
12
32
  class Container extends Scriptable {
13
33
  _children = [];
14
34
  _childrenReference;
@@ -51,12 +71,39 @@ class Container extends Scriptable {
51
71
  return true;
52
72
  }
53
73
  _activeChild = null;
54
- getState() {
74
+ isSiteContainer(item) {
75
+ return ':items' in item;
76
+ }
77
+ isAFormField(item) {
78
+ return ('fieldType' in item || 'id' in item || 'name' in item || 'dataRef' in item || 'type' in item);
79
+ }
80
+ getItemsState(isRepeatableChild = false) {
81
+ if (this._jsonModel.type === 'array' || isRepeatable(this._jsonModel) || isRepeatableChild) {
82
+ return this._children.map(x => {
83
+ return { ...x.getState(true) };
84
+ });
85
+ }
86
+ else {
87
+ return this._jsonModel.items.map(x => {
88
+ if (this.isSiteContainer(x)) {
89
+ return {
90
+ ...x,
91
+ ':items': this.walkSiteContainerItems(x)
92
+ };
93
+ }
94
+ else if (this.isAFormField(x)) {
95
+ return { ...this.form.getElement(x?.id).getState(isRepeatableChild) };
96
+ }
97
+ else {
98
+ return x;
99
+ }
100
+ });
101
+ }
102
+ }
103
+ getState(isRepeatableChild = false) {
55
104
  return {
56
- ...super.getState(),
57
- items: this._children.map(x => {
58
- return { ...x.getState() };
59
- })
105
+ ...super.getState(isRepeatableChild),
106
+ items: this.getItemsState(isRepeatableChild)
60
107
  };
61
108
  }
62
109
  _createChild(child, options) {
@@ -66,6 +113,19 @@ class Container extends Scriptable {
66
113
  parent
67
114
  });
68
115
  }
116
+ walkSiteContainerItems(x) {
117
+ return Object.fromEntries(Object.entries(x[':items']).map(([key, value]) => {
118
+ if (this.isAFormField(value)) {
119
+ return [key, this.form.getElement(value?.id).getState()];
120
+ }
121
+ else if (this.isSiteContainer(value)) {
122
+ return this.walkSiteContainerItems(value);
123
+ }
124
+ else {
125
+ return [key, value];
126
+ }
127
+ }));
128
+ }
69
129
  _addChildToRuleNode(child, options) {
70
130
  const self = this;
71
131
  const { parent = this } = options;
@@ -105,6 +165,7 @@ class Container extends Scriptable {
105
165
  ...deepClone(itemJson, cloneIds ? () => { return form.getUniqueId(); } : undefined)
106
166
  };
107
167
  const retVal = this._createChild(itemTemplate, { parent: this, form: this.form });
168
+ itemJson.id = retVal.id;
108
169
  this.form.fieldAdded(retVal);
109
170
  this._addChildToRuleNode(retVal, { parent: nonTransparentParent });
110
171
  if (index === this._children.length) {
@@ -131,7 +192,6 @@ class Container extends Scriptable {
131
192
  _initialize() {
132
193
  super._initialize();
133
194
  const items = this._jsonModel.items || [];
134
- this._jsonModel.items = [];
135
195
  this._childrenReference = this._jsonModel.type == 'array' ? [] : {};
136
196
  if (this._jsonModel.type == 'array' && items.length === 1 && this.getDataNode() != null) {
137
197
  this._itemTemplate = deepClone(items[0]);
@@ -145,14 +205,23 @@ class Container extends Scriptable {
145
205
  this._jsonModel.initialItems = Math.max(1, this._jsonModel.minItems);
146
206
  }
147
207
  for (let i = 0; i < this._jsonModel.initialItems; i++) {
148
- const child = this._addChild(this._itemTemplate);
208
+ const child = this._addChild(this._itemTemplate, null, true);
209
+ items[0].id = child.id;
149
210
  child._initialize();
150
211
  }
151
212
  }
152
213
  else if (items.length > 0) {
153
214
  items.forEach((item) => {
154
- const child = this._addChild(item);
155
- child._initialize();
215
+ if (this.isSiteContainer(item)) {
216
+ this._initializeSiteContainer(item);
217
+ }
218
+ else if (this.isAFormField(item)) {
219
+ const child = this._addChild(item);
220
+ child._initialize();
221
+ }
222
+ else {
223
+ this.form.logger.warn('A container item was not initialized.');
224
+ }
156
225
  });
157
226
  this._jsonModel.minItems = this._children.length;
158
227
  this._jsonModel.maxItems = this._children.length;
@@ -163,6 +232,17 @@ class Container extends Scriptable {
163
232
  }
164
233
  this.setupRuleNode();
165
234
  }
235
+ _initializeSiteContainer(item) {
236
+ Object.entries(item[':items']).forEach(([key, value]) => {
237
+ if (this.isAFormField(value)) {
238
+ const child = this._addChild(value);
239
+ child._initialize();
240
+ }
241
+ else if (this.isSiteContainer(value)) {
242
+ return this._initializeSiteContainer(value);
243
+ }
244
+ });
245
+ }
166
246
  addItem(action) {
167
247
  if ((action.type === 'addItem' || action.type == 'addInstance') && this._itemTemplate != null) {
168
248
  if ((this._jsonModel.maxItems === -1) || (this._children.length < this._jsonModel.maxItems)) {
@@ -216,6 +296,14 @@ class Container extends Scriptable {
216
296
  }
217
297
  }
218
298
  reset() {
299
+ if (this.type === 'array' || isRepeatable(this._jsonModel)) {
300
+ if (this.items.length > this._jsonModel.initialItems) {
301
+ const itemsToBeRemoved = this.items.length - this._jsonModel.initialItems;
302
+ for (let i = 0; i < itemsToBeRemoved; i++) {
303
+ this.dispatch(new RemoveItem());
304
+ }
305
+ }
306
+ }
219
307
  this.items.forEach(x => {
220
308
  x.reset();
221
309
  });
@@ -287,4 +375,5 @@ __decorate([
287
375
  __decorate([
288
376
  dependencyTracked()
289
377
  ], Container.prototype, "activeChild", null);
290
- export default Container;
378
+
379
+ export { Container as default };
@@ -1,5 +1,40 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
1
21
  import Field from './Field.js';
2
- import { formatDate, parseDateSkeleton } from '@aemforms/af-formatters';
22
+ import { parseDateSkeleton, formatDate } from '@aemforms/af-formatters';
23
+ import './BaseNode-d78cc1b0.js';
24
+ import './controller/Events.js';
25
+ import './utils/DataRefParser.js';
26
+ import './data/DataGroup.js';
27
+ import './data/DataValue.js';
28
+ import './data/EmptyDataValue.js';
29
+ import './types/Model.js';
30
+ import './utils/ValidationUtils.js';
31
+ import './utils/FormUtils.js';
32
+ import './utils/JsonUtils.js';
33
+ import './types/Json.js';
34
+ import './utils/SchemaUtils.js';
35
+ import './FileObject.js';
36
+ import './Scriptable.js';
37
+
3
38
  class DateField extends Field {
4
39
  _applyDefaults() {
5
40
  super._applyDefaults();
@@ -18,4 +53,5 @@ class DateField extends Field {
18
53
  }
19
54
  }
20
55
  }
21
- export default DateField;
56
+
57
+ export { DateField as default };
@@ -145,6 +145,8 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
145
145
  importData(contextualDataModel: DataGroup): void;
146
146
  defaultDataModel(name: string | number): DataValue;
147
147
  getState(): {
148
+ editFormat: string | undefined;
149
+ displayFormat: string | undefined;
148
150
  editValue: any;
149
151
  displayValue: any;
150
152
  description?: string | undefined;
@@ -194,8 +196,6 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
194
196
  valid?: boolean | undefined;
195
197
  default?: any;
196
198
  value?: any;
197
- displayFormat?: string | undefined;
198
- editFormat?: string | undefined;
199
199
  emptyValue?: "" | "undefined" | "null" | undefined;
200
200
  index: number;
201
201
  parent: undefined;
package/lib/esm/Field.js CHANGED
@@ -1,18 +1,39 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { ValidationError } from './types/index.js';
8
- import { coerceType, Constraints, ValidConstraints } from './utils/ValidationUtils.js';
9
- import { Change, ExecuteRule, Initialize, Invalid, propertyChange, Valid } from './controller/Events.js';
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ import { _ as __decorate, s as staticFields, t as target, d as dependencyTracked, e as exclude, i as include } from './BaseNode-d78cc1b0.js';
22
+ import { ValidationError } from './types/Model.js';
23
+ import { Constraints, coerceType, ValidConstraints } from './utils/ValidationUtils.js';
24
+ import { Initialize, ExecuteRule, Change, Valid, Invalid, propertyChange } from './controller/Events.js';
10
25
  import Scriptable from './Scriptable.js';
11
26
  import { defaultFieldTypes } from './utils/SchemaUtils.js';
12
27
  import DataValue from './data/DataValue.js';
13
- import { dependencyTracked, include, exclude, target, staticFields } from './BaseNode.js';
14
28
  import NullDataValue from './data/EmptyDataValue.js';
15
29
  import { format } from '@aemforms/af-formatters';
30
+ import './utils/DataRefParser.js';
31
+ import './data/DataGroup.js';
32
+ import './utils/FormUtils.js';
33
+ import './utils/JsonUtils.js';
34
+ import './types/Json.js';
35
+ import './FileObject.js';
36
+
16
37
  const validTypes = ['string', 'number', 'boolean', 'file', 'string[]', 'number[]', 'boolean[]', 'file[]', 'array', 'object'];
17
38
  class Field extends Scriptable {
18
39
  constructor(params, _options) {
@@ -161,10 +182,10 @@ class Field extends Scriptable {
161
182
  }
162
183
  }
163
184
  get editFormat() {
164
- return this._jsonModel.editFormat;
185
+ return this.withCategory(this._jsonModel.editFormat);
165
186
  }
166
187
  get displayFormat() {
167
- return this._jsonModel.displayFormat;
188
+ return this.withCategory(this._jsonModel.displayFormat);
168
189
  }
169
190
  get placeholder() {
170
191
  return this._jsonModel.placeholder;
@@ -237,31 +258,43 @@ class Field extends Scriptable {
237
258
  return this._jsonModel.value === undefined || this._jsonModel.value === null || this._jsonModel.value === '';
238
259
  }
239
260
  withCategory(df) {
240
- const hasCategory = df?.match(/^(?:date|num)\|/);
241
- if (hasCategory == null) {
242
- if (this.format === 'date') {
243
- df = `date|${df}`;
244
- }
245
- else if (this.type === 'number') {
246
- df = `num|${df}`;
261
+ if (df) {
262
+ const hasCategory = df?.match(/^(?:date|num)\|/);
263
+ if (hasCategory === null) {
264
+ if (this.format === 'date') {
265
+ df = `date|${df}`;
266
+ }
267
+ else if (this.type === 'number') {
268
+ df = `num|${df}`;
269
+ }
270
+ return df;
247
271
  }
248
- return df;
249
272
  }
250
273
  return df;
251
274
  }
252
275
  get editValue() {
253
- const df = this.withCategory(this.editFormat);
276
+ const df = this.editFormat;
254
277
  if (df && this.isNotEmpty(this.value) && this.valid !== false) {
255
- return format(this.value, this.language, df);
278
+ try {
279
+ return format(this.value, this.language, df);
280
+ }
281
+ catch (e) {
282
+ return this.value;
283
+ }
256
284
  }
257
285
  else {
258
286
  return this.value;
259
287
  }
260
288
  }
261
289
  get displayValue() {
262
- const df = this.withCategory(this.displayFormat);
290
+ const df = this.displayFormat;
263
291
  if (df && this.isNotEmpty(this.value) && this.valid !== false) {
264
- return format(this.value, this.language, df);
292
+ try {
293
+ return format(this.value, this.language, df);
294
+ }
295
+ catch (e) {
296
+ return this.value;
297
+ }
265
298
  }
266
299
  else {
267
300
  return this.value;
@@ -401,7 +434,7 @@ class Field extends Scriptable {
401
434
  const iv = this._jsonModel.minimum || this._jsonModel.default || 0;
402
435
  const fIVal = iv * factor;
403
436
  const qt = (fVal - fIVal) / fStep;
404
- const valid = (fVal - fIVal) % fStep < .001;
437
+ const valid = Math.abs(fVal - fIVal) % fStep < .001;
405
438
  let next, prev;
406
439
  if (!valid) {
407
440
  next = (Math.ceil(qt) * fStep + fIVal) / factor;
@@ -604,6 +637,8 @@ class Field extends Scriptable {
604
637
  getState() {
605
638
  return {
606
639
  ...super.getState(),
640
+ editFormat: this.editFormat,
641
+ displayFormat: this.displayFormat,
607
642
  editValue: this.editValue,
608
643
  displayValue: this.displayValue
609
644
  };
@@ -653,4 +688,5 @@ __decorate([
653
688
  __decorate([
654
689
  dependencyTracked()
655
690
  ], Field.prototype, "exclusiveMaximum", null);
656
- export default Field;
691
+
692
+ export { Field as default };
@@ -1,9 +1,40 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
1
21
  import Container from './Container.js';
2
- import { ExecuteRule, Initialize } from './controller/Events.js';
22
+ import { Initialize, ExecuteRule } from './controller/Events.js';
23
+ import './BaseNode-d78cc1b0.js';
24
+ import './utils/DataRefParser.js';
25
+ import './data/DataGroup.js';
26
+ import './data/DataValue.js';
27
+ import './data/EmptyDataValue.js';
28
+ import './utils/JsonUtils.js';
29
+ import './types/Json.js';
30
+ import './utils/SchemaUtils.js';
31
+ import './Scriptable.js';
32
+
3
33
  const defaults = {
4
- visible: true
34
+ visible: true,
35
+ enabled: true
5
36
  };
6
- export class Fieldset extends Container {
37
+ class Fieldset extends Container {
7
38
  constructor(params, _options) {
8
39
  super(params, _options);
9
40
  this._applyDefaults();
@@ -43,3 +74,5 @@ export class Fieldset extends Container {
43
74
  this._setProperty('enabled', e);
44
75
  }
45
76
  }
77
+
78
+ export { Fieldset };
@@ -1,4 +1,24 @@
1
- export class FileObject {
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
21
+ class FileObject {
2
22
  data;
3
23
  mediaType = 'application/octet-stream';
4
24
  name = 'unknown';
@@ -24,3 +44,5 @@ export class FileObject {
24
44
  this.size === obj.size);
25
45
  }
26
46
  }
47
+
48
+ export { FileObject };
@@ -1,8 +1,40 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
1
21
  import { propertyChange } from './controller/Events.js';
2
22
  import Field from './Field.js';
3
23
  import { getFileSizeInBytes } from './utils/FormUtils.js';
4
24
  import { FileObject } from './FileObject.js';
5
25
  import { Constraints } from './utils/ValidationUtils.js';
26
+ import './BaseNode-d78cc1b0.js';
27
+ import './utils/DataRefParser.js';
28
+ import './data/DataGroup.js';
29
+ import './data/DataValue.js';
30
+ import './data/EmptyDataValue.js';
31
+ import './types/Model.js';
32
+ import './Scriptable.js';
33
+ import './utils/SchemaUtils.js';
34
+ import '@aemforms/af-formatters';
35
+ import './utils/JsonUtils.js';
36
+ import './types/Json.js';
37
+
6
38
  function addNameToDataURL(dataURL, name) {
7
39
  return dataURL.replace(';base64', `;name=${encodeURIComponent(name)};base64`);
8
40
  }
@@ -105,4 +137,5 @@ class FileUpload extends Field {
105
137
  }
106
138
  }
107
139
  }
108
- export default FileUpload;
140
+
141
+ export { FileUpload as default };
package/lib/esm/Form.d.ts CHANGED
@@ -100,8 +100,8 @@ declare class Form extends Container<FormJson> implements FormModel {
100
100
  validate(): import("./types/Model.js").ValidationError[];
101
101
  isValid(): boolean;
102
102
  dispatch(action: Action): void;
103
- executeAction(action: Action): void;
104
103
  submit(action: Action, context: any): void;
104
+ reset(): void;
105
105
  getElement(id: string): FieldModel | FieldsetModel | this;
106
106
  get qualifiedName(): string;
107
107
  getEventQueue(): EventQueue;
package/lib/esm/Form.js CHANGED
@@ -1,11 +1,43 @@
1
+ /*************************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * ___________________
4
+ *
5
+ * Copyright 2022 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+
17
+ * Adobe permits you to use and modify this file solely in accordance with
18
+ * the terms of the Adobe license agreement accompanying it.
19
+ *************************************************************************/
20
+
1
21
  import Container from './Container.js';
2
22
  import FormMetaData from './FormMetaData.js';
3
23
  import EventQueue from './controller/EventQueue.js';
4
24
  import { Logger } from './controller/Logger.js';
5
- import { getAttachments, IdGenerator } from './utils/FormUtils.js';
25
+ import { IdGenerator, getAttachments } from './utils/FormUtils.js';
6
26
  import DataGroup from './data/DataGroup.js';
7
27
  import { submit } from './rules/FunctionRuntime.js';
8
- import { ExecuteRule, FieldChanged, FormLoad, Initialize, ValidationComplete } from './controller/Events.js';
28
+ import { Initialize, ExecuteRule, FormLoad, FieldChanged, ValidationComplete } from './controller/Events.js';
29
+ import './BaseNode-d78cc1b0.js';
30
+ import './utils/DataRefParser.js';
31
+ import './data/DataValue.js';
32
+ import './data/EmptyDataValue.js';
33
+ import './utils/JsonUtils.js';
34
+ import './types/Json.js';
35
+ import './utils/SchemaUtils.js';
36
+ import './Scriptable.js';
37
+ import './Node.js';
38
+ import './FileObject.js';
39
+ import './utils/Fetch.js';
40
+
9
41
  class Form extends Container {
10
42
  _ruleEngine;
11
43
  _eventQueue;
@@ -137,17 +169,16 @@ class Form extends Container {
137
169
  super.dispatch(action);
138
170
  }
139
171
  }
140
- executeAction(action) {
141
- if ((action.type !== 'submit') || this._invalidFields.length === 0) {
142
- super.executeAction(action);
143
- }
144
- }
145
172
  submit(action, context) {
146
173
  if (this.validate().length === 0) {
147
174
  const payload = action?.payload || {};
148
175
  submit(context, payload?.success, payload?.error, payload?.submit_as, payload?.data);
149
176
  }
150
177
  }
178
+ reset() {
179
+ super.reset();
180
+ this._invalidFields = [];
181
+ }
151
182
  getElement(id) {
152
183
  if (id == this.id) {
153
184
  return this;
@@ -173,4 +204,5 @@ class Form extends Container {
173
204
  return this._jsonModel.title || '';
174
205
  }
175
206
  }
176
- export default Form;
207
+
208
+ export { Form as default };