@aemforms/af-core 0.22.19 → 0.22.22

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 (124) hide show
  1. package/LICENSE +18 -4
  2. package/lib/cjs/index.cjs +7277 -0
  3. package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
  4. package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
  5. package/lib/esm/BaseNode.js +26 -0
  6. package/lib/esm/Checkbox.d.ts +79 -0
  7. package/lib/esm/Checkbox.js +63 -0
  8. package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
  9. package/lib/esm/CheckboxGroup.js +60 -0
  10. package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
  11. package/lib/{Container.js → esm/Container.js} +81 -122
  12. package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
  13. package/lib/esm/DateField.js +57 -0
  14. package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
  15. package/lib/{Field.js → esm/Field.js} +186 -216
  16. package/lib/esm/Fieldset.d.ts +16 -0
  17. package/lib/esm/Fieldset.js +78 -0
  18. package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
  19. package/lib/esm/FileObject.js +48 -0
  20. package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
  21. package/lib/esm/FileUpload.js +141 -0
  22. package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
  23. package/lib/esm/Form.js +208 -0
  24. package/lib/esm/FormInstance.d.ts +13 -0
  25. package/lib/esm/FormInstance.js +129 -0
  26. package/lib/esm/FormMetaData.d.ts +7 -0
  27. package/lib/esm/FormMetaData.js +35 -0
  28. package/lib/esm/InstanceManager.d.ts +9 -0
  29. package/lib/esm/InstanceManager.js +58 -0
  30. package/lib/esm/Node.d.ts +7 -0
  31. package/lib/esm/Node.js +40 -0
  32. package/lib/esm/Scriptable.d.ts +17 -0
  33. package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
  34. package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
  35. package/lib/{controller → esm/controller}/EventQueue.js +32 -26
  36. package/lib/esm/controller/Events.d.ts +85 -0
  37. package/lib/esm/controller/Events.js +171 -0
  38. package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
  39. package/lib/esm/controller/Logger.js +52 -0
  40. package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
  41. package/lib/{data → esm/data}/DataGroup.js +38 -34
  42. package/lib/{data → esm/data}/DataValue.d.ts +1 -7
  43. package/lib/esm/data/DataValue.js +68 -0
  44. package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
  45. package/lib/esm/data/EmptyDataValue.js +51 -0
  46. package/lib/esm/index.d.ts +21 -0
  47. package/lib/esm/index.js +55 -0
  48. package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
  49. package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
  50. package/lib/esm/rules/RuleEngine.d.ts +12 -0
  51. package/lib/esm/rules/RuleEngine.js +76 -0
  52. package/lib/esm/types/Json.d.ts +119 -0
  53. package/lib/esm/types/Json.js +29 -0
  54. package/lib/esm/types/Model.d.ts +131 -0
  55. package/lib/esm/types/Model.js +30 -0
  56. package/lib/esm/types/index.d.ts +2 -0
  57. package/lib/esm/types/index.js +22 -0
  58. package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
  59. package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
  60. package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
  61. package/lib/esm/utils/Fetch.js +83 -0
  62. package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
  63. package/lib/esm/utils/FormCreationUtils.js +112 -0
  64. package/lib/esm/utils/FormUtils.d.ts +12 -0
  65. package/lib/esm/utils/FormUtils.js +212 -0
  66. package/lib/esm/utils/JsonUtils.d.ts +11 -0
  67. package/lib/esm/utils/JsonUtils.js +99 -0
  68. package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
  69. package/lib/esm/utils/LogUtils.js +28 -0
  70. package/lib/esm/utils/SchemaUtils.d.ts +3 -0
  71. package/lib/esm/utils/SchemaUtils.js +93 -0
  72. package/lib/esm/utils/TranslationUtils.d.ts +11 -0
  73. package/lib/esm/utils/TranslationUtils.js +138 -0
  74. package/lib/esm/utils/ValidationUtils.d.ts +19 -0
  75. package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
  76. package/package.json +18 -10
  77. package/lib/Checkbox.d.ts +0 -88
  78. package/lib/Checkbox.js +0 -49
  79. package/lib/CheckboxGroup.js +0 -43
  80. package/lib/DateField.js +0 -35
  81. package/lib/Fieldset.d.ts +0 -24
  82. package/lib/Fieldset.js +0 -74
  83. package/lib/FileObject.js +0 -39
  84. package/lib/FileUpload.js +0 -155
  85. package/lib/Form.js +0 -252
  86. package/lib/FormInstance.d.ts +0 -38
  87. package/lib/FormInstance.js +0 -127
  88. package/lib/FormMetaData.d.ts +0 -11
  89. package/lib/FormMetaData.js +0 -28
  90. package/lib/InstanceManager.d.ts +0 -16
  91. package/lib/InstanceManager.js +0 -53
  92. package/lib/Node.d.ts +0 -12
  93. package/lib/Node.js +0 -27
  94. package/lib/Scriptable.d.ts +0 -31
  95. package/lib/controller/Controller.d.ts +0 -255
  96. package/lib/controller/Controller.js +0 -328
  97. package/lib/controller/Logger.js +0 -36
  98. package/lib/controller/index.d.ts +0 -1
  99. package/lib/controller/index.js +0 -24
  100. package/lib/data/DataValue.js +0 -56
  101. package/lib/data/EmptyDataValue.js +0 -46
  102. package/lib/index.d.ts +0 -28
  103. package/lib/index.js +0 -63
  104. package/lib/rules/RuleEngine.d.ts +0 -23
  105. package/lib/rules/RuleEngine.js +0 -62
  106. package/lib/types/Json.d.ts +0 -138
  107. package/lib/types/Json.js +0 -19
  108. package/lib/types/Model.d.ts +0 -393
  109. package/lib/types/Model.js +0 -20
  110. package/lib/types/index.d.ts +0 -2
  111. package/lib/types/index.js +0 -25
  112. package/lib/utils/Fetch.js +0 -87
  113. package/lib/utils/FormCreationUtils.d.ts +0 -11
  114. package/lib/utils/FormCreationUtils.js +0 -83
  115. package/lib/utils/FormUtils.d.ts +0 -47
  116. package/lib/utils/FormUtils.js +0 -257
  117. package/lib/utils/JsonUtils.d.ts +0 -63
  118. package/lib/utils/JsonUtils.js +0 -157
  119. package/lib/utils/LogUtils.js +0 -17
  120. package/lib/utils/SchemaUtils.d.ts +0 -16
  121. package/lib/utils/SchemaUtils.js +0 -92
  122. package/lib/utils/TranslationUtils.d.ts +0 -41
  123. package/lib/utils/TranslationUtils.js +0 -185
  124. package/lib/utils/ValidationUtils.d.ts +0 -170
@@ -1,44 +1,46 @@
1
- "use strict";
2
- /*
3
- * Copyright 2022 Adobe, Inc.
4
- *
5
- * Your access and use of this software is governed by the Adobe Customer Feedback Program Terms and Conditions or other Beta License Agreement signed by your employer and Adobe, Inc.. This software is NOT open source and may not be used without one of the foregoing licenses. Even with a foregoing license, your access and use of this file is limited to the earlier of (a) 180 days, (b) general availability of the product(s) which utilize this software (i.e. AEM Forms), (c) January 1, 2023, (d) Adobe providing notice to you that you may no longer use the software or that your beta trial has otherwise ended.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ADOBE NOR ITS THIRD PARTY PROVIDERS AND PARTNERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
- */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- 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;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
14
- };
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- const JsonUtils_1 = require("./utils/JsonUtils");
20
- const Scriptable_1 = __importDefault(require("./Scriptable"));
21
- const controller_1 = require("./controller");
22
- const DataGroup_1 = __importDefault(require("./data/DataGroup"));
23
- const BaseNode_1 = require("./BaseNode");
24
- /**
25
- * Defines a generic container class which any form container should extend from.
26
- * @typeparam T type of the node which extends {@link ContainerJson} and {@link RulesJson}
27
- */
28
- class Container extends Scriptable_1.default {
29
- constructor() {
30
- super(...arguments);
31
- this._children = [];
32
- this._itemTemplate = null;
33
- this._activeChild = null;
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-dc59ab07.js';
22
+ import { deepClone } from './utils/JsonUtils.js';
23
+ import Scriptable from './Scriptable.js';
24
+ import { propertyChange, Initialize, ExecuteRule } from './controller/Events.js';
25
+ import DataGroup from './data/DataGroup.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
+
32
+ class Container extends Scriptable {
33
+ _children = [];
34
+ _childrenReference;
35
+ _itemTemplate = null;
36
+ fieldFactory;
37
+ constructor(json, _options) {
38
+ super(json, { form: _options.form, parent: _options.parent });
39
+ this.fieldFactory = _options.fieldFactory;
34
40
  }
35
- /**
36
- * @private
37
- */
38
41
  ruleNodeReference() {
39
42
  return this._childrenReference;
40
43
  }
41
- //todo : this should not be public
42
44
  get items() {
43
45
  return this._children;
44
46
  }
@@ -56,46 +58,47 @@ class Container extends Scriptable_1.default {
56
58
  this._childrenReference.pop();
57
59
  }
58
60
  const elems = this._children.splice(m, items2Remove);
59
- this.notifyDependents((0, controller_1.propertyChange)('items', elems, null));
61
+ this.notifyDependents(propertyChange('items', elems, null));
60
62
  }
61
63
  }
62
64
  get minItems() {
63
65
  return this._jsonModel.minItems;
64
66
  }
65
- /**
66
- * returns whether the items in the Panel can repeat or not
67
- */
68
67
  hasDynamicItems() {
69
68
  return this._itemTemplate != null;
70
69
  }
71
70
  get isContainer() {
72
71
  return true;
73
72
  }
74
- /**
75
- * Returns the current container state
76
- */
73
+ _activeChild = null;
77
74
  getState() {
78
- return Object.assign(Object.assign({}, super.getState()), { items: this._children.map(x => {
79
- return Object.assign({}, x.getState());
80
- }) });
75
+ return {
76
+ ...super.getState(),
77
+ items: this._children.map(x => {
78
+ return { ...x.getState() };
79
+ })
80
+ };
81
+ }
82
+ _createChild(child, options) {
83
+ const { parent = this } = options;
84
+ return this.fieldFactory.createField(child, {
85
+ form: options.form,
86
+ parent
87
+ });
81
88
  }
82
89
  _addChildToRuleNode(child, options) {
83
- // eslint-disable-next-line @typescript-eslint/no-this-alias
84
90
  const self = this;
85
91
  const { parent = this } = options;
86
- //the child has not been added to the array, hence using the length as new index
87
- // this means unnamed panel inside repeatable named parent // this is an edge case, handling it gracefully
88
- // todo: rules don't work inside repeatable array
89
92
  const name = parent.type == 'array' ? parent._children.length + '' : child.name || '';
90
93
  if (name.length > 0) {
91
94
  Object.defineProperty(parent._childrenReference, name, {
92
95
  get: () => {
93
96
  if (child.isContainer && child.hasDynamicItems()) {
94
- self.ruleEngine.trackDependency(child); //accessing dynamic panel directly
97
+ self.ruleEngine.trackDependency(child);
95
98
  }
96
99
  if (self.hasDynamicItems()) {
97
- self.ruleEngine.trackDependency(self); //accessing a child of dynamic panel
98
- if (this._children[name] !== undefined) { // pop function calls this getter in order to return the item
100
+ self.ruleEngine.trackDependency(self);
101
+ if (this._children[name] !== undefined) {
99
102
  return this._children[name].getRuleNode();
100
103
  }
101
104
  }
@@ -109,26 +112,25 @@ class Container extends Scriptable_1.default {
109
112
  }
110
113
  }
111
114
  _addChild(itemJson, index, cloneIds = false) {
112
- // get first non transparent parent
113
- // eslint-disable-next-line @typescript-eslint/no-this-alias
114
115
  let nonTransparentParent = this;
115
116
  while (nonTransparentParent != null && nonTransparentParent.isTransparent()) {
116
- // @ts-ignore
117
117
  nonTransparentParent = nonTransparentParent.parent;
118
118
  }
119
119
  if (typeof index !== 'number' || index > nonTransparentParent._children.length) {
120
120
  index = this._children.length;
121
121
  }
122
122
  const form = this.form;
123
- const itemTemplate = Object.assign({ index }, (0, JsonUtils_1.deepClone)(itemJson, cloneIds ? () => { return form.getUniqueId(); } : undefined));
124
- //@ts-ignore
125
- const retVal = this._createChild(itemTemplate, { parent: this, index });
123
+ const itemTemplate = {
124
+ index,
125
+ ...deepClone(itemJson, cloneIds ? () => { return form.getUniqueId(); } : undefined)
126
+ };
127
+ const retVal = this._createChild(itemTemplate, { parent: this, form: this.form });
128
+ this.form.fieldAdded(retVal);
126
129
  this._addChildToRuleNode(retVal, { parent: nonTransparentParent });
127
130
  if (index === this._children.length) {
128
131
  this._children.push(retVal);
129
132
  }
130
133
  else {
131
- // @ts-ignore
132
134
  this._children.splice(index, 0, retVal);
133
135
  }
134
136
  return retVal;
@@ -136,9 +138,6 @@ class Container extends Scriptable_1.default {
136
138
  indexOf(f) {
137
139
  return this._children.indexOf(f);
138
140
  }
139
- /**
140
- * @private
141
- */
142
141
  defaultDataModel(name) {
143
142
  const type = this._jsonModel.type || undefined;
144
143
  if (type === undefined) {
@@ -146,19 +145,16 @@ class Container extends Scriptable_1.default {
146
145
  }
147
146
  else {
148
147
  const instance = type === 'array' ? [] : {};
149
- return new DataGroup_1.default(name, instance, type);
148
+ return new DataGroup(name, instance, type);
150
149
  }
151
150
  }
152
- /**
153
- * @private
154
- */
155
151
  _initialize() {
156
152
  super._initialize();
157
153
  const items = this._jsonModel.items || [];
158
154
  this._jsonModel.items = [];
159
155
  this._childrenReference = this._jsonModel.type == 'array' ? [] : {};
160
156
  if (this._jsonModel.type == 'array' && items.length === 1 && this.getDataNode() != null) {
161
- this._itemTemplate = (0, JsonUtils_1.deepClone)(items[0]);
157
+ this._itemTemplate = deepClone(items[0]);
162
158
  if (typeof (this._jsonModel.minItems) !== 'number') {
163
159
  this._jsonModel.minItems = 0;
164
160
  }
@@ -169,7 +165,6 @@ class Container extends Scriptable_1.default {
169
165
  this._jsonModel.initialItems = Math.max(1, this._jsonModel.minItems);
170
166
  }
171
167
  for (let i = 0; i < this._jsonModel.initialItems; i++) {
172
- //@ts-ignore
173
168
  const child = this._addChild(this._itemTemplate);
174
169
  child._initialize();
175
170
  }
@@ -188,12 +183,8 @@ class Container extends Scriptable_1.default {
188
183
  }
189
184
  this.setupRuleNode();
190
185
  }
191
- /**
192
- * @private
193
- */
194
186
  addItem(action) {
195
187
  if ((action.type === 'addItem' || action.type == 'addInstance') && this._itemTemplate != null) {
196
- //@ts-ignore
197
188
  if ((this._jsonModel.maxItems === -1) || (this._children.length < this._jsonModel.maxItems)) {
198
189
  const dataNode = this.getDataNode();
199
190
  let instanceIndex = action.payload;
@@ -206,22 +197,18 @@ class Container extends Scriptable_1.default {
206
197
  dataNode.$addDataNode(instanceIndex, _data);
207
198
  }
208
199
  retVal._initialize();
209
- this.notifyDependents((0, controller_1.propertyChange)('items', retVal.getState(), null));
210
- retVal.dispatch(new controller_1.Initialize());
211
- retVal.dispatch(new controller_1.ExecuteRule());
200
+ this.notifyDependents(propertyChange('items', retVal.getState(), null));
201
+ retVal.dispatch(new Initialize());
202
+ retVal.dispatch(new ExecuteRule());
212
203
  for (let i = instanceIndex + 1; i < this._children.length; i++) {
213
- this._children[i].dispatch(new controller_1.ExecuteRule());
204
+ this._children[i].dispatch(new ExecuteRule());
214
205
  }
215
206
  }
216
207
  }
217
208
  }
218
- /**
219
- * @private
220
- */
221
209
  removeItem(action) {
222
210
  if ((action.type === 'removeItem' || action.type == 'removeInstance') && this._itemTemplate != null) {
223
211
  if (this._children.length == 0) {
224
- //can't remove item if there isn't any
225
212
  return;
226
213
  }
227
214
  let instanceIndex = action.payload;
@@ -229,41 +216,27 @@ class Container extends Scriptable_1.default {
229
216
  instanceIndex = this._children.length - 1;
230
217
  }
231
218
  const state = this._children[instanceIndex].getState();
232
- //@ts-ignore
233
219
  if (this._children.length > this._jsonModel.minItems) {
234
- // clear child
235
- //remove field
236
220
  this._childrenReference.pop();
237
221
  this._children.splice(instanceIndex, 1);
238
222
  this.getDataNode().$removeDataNode(instanceIndex);
239
223
  for (let i = instanceIndex; i < this._children.length; i++) {
240
- this._children[i].dispatch(new controller_1.ExecuteRule());
224
+ this._children[i].dispatch(new ExecuteRule());
241
225
  }
242
- this.notifyDependents((0, controller_1.propertyChange)('items', null, state));
226
+ this.notifyDependents(propertyChange('items', null, state));
243
227
  }
244
228
  }
245
229
  }
246
- /**
247
- * @private
248
- */
249
230
  queueEvent(action) {
250
- var _a;
251
231
  super.queueEvent(action);
252
- if ((_a = action.metadata) === null || _a === void 0 ? void 0 : _a.dispatch) {
232
+ if (action.metadata?.dispatch) {
253
233
  this.items.forEach(x => {
254
- //@ts-ignore
255
234
  x.queueEvent(action);
256
235
  });
257
236
  }
258
237
  }
259
- /**
260
- * @summary reset the data of all the Fields present inside this container
261
- * @method reset
262
- * @private
263
- */
264
238
  reset() {
265
239
  this.items.forEach(x => {
266
- //@ts-ignore
267
240
  x.reset();
268
241
  });
269
242
  }
@@ -272,36 +245,21 @@ class Container extends Scriptable_1.default {
272
245
  return x.validate();
273
246
  }).filter(x => x.fieldName !== '');
274
247
  }
275
- /**
276
- * @private
277
- */
278
248
  dispatch(action) {
279
249
  super.dispatch(action);
280
250
  }
281
- /**
282
- * @private
283
- */
284
251
  importData(contextualDataModel) {
285
252
  this._bindToDataModel(contextualDataModel);
286
253
  const dataNode = this.getDataNode() || contextualDataModel;
287
254
  this.syncDataAndFormModel(dataNode);
288
255
  }
289
- /**
290
- * prefill the form with data on the given element
291
- * @param dataModel
292
- * @param contextualDataModel
293
- * @param operation
294
- * @private
295
- */
296
256
  syncDataAndFormModel(contextualDataModel) {
297
- if ((contextualDataModel === null || contextualDataModel === void 0 ? void 0 : contextualDataModel.$type) === 'array' && this._itemTemplate != null) {
298
- const dataLength = contextualDataModel === null || contextualDataModel === void 0 ? void 0 : contextualDataModel.$value.length;
257
+ if (contextualDataModel?.$type === 'array' && this._itemTemplate != null) {
258
+ const dataLength = contextualDataModel?.$value.length;
299
259
  const itemsLength = this._children.length;
300
260
  const maxItems = this._jsonModel.maxItems === -1 ? dataLength : this._jsonModel.maxItems;
301
261
  const minItems = this._jsonModel.minItems;
302
- //@ts-ignore
303
262
  let items2Add = Math.min(dataLength - itemsLength, maxItems - itemsLength);
304
- //@ts-ignore
305
263
  const items2Remove = Math.min(itemsLength - dataLength, itemsLength - minItems);
306
264
  while (items2Add > 0) {
307
265
  items2Add--;
@@ -330,23 +288,24 @@ class Container extends Scriptable_1.default {
330
288
  activeChild.activeChild = null;
331
289
  activeChild = temp;
332
290
  }
333
- const change = (0, controller_1.propertyChange)('activeChild', c, this._activeChild);
291
+ const change = propertyChange('activeChild', c, this._activeChild);
334
292
  this._activeChild = c;
335
293
  if (this.parent && c !== null) {
336
294
  this.parent.activeChild = this;
337
295
  }
338
- this._jsonModel.activeChild = c === null || c === void 0 ? void 0 : c.id;
296
+ this._jsonModel.activeChild = c?.id;
339
297
  this.notifyDependents(change);
340
298
  }
341
299
  }
342
300
  }
343
301
  __decorate([
344
- (0, BaseNode_1.dependencyTracked)()
302
+ dependencyTracked()
345
303
  ], Container.prototype, "maxItems", null);
346
304
  __decorate([
347
- (0, BaseNode_1.dependencyTracked)()
305
+ dependencyTracked()
348
306
  ], Container.prototype, "minItems", null);
349
307
  __decorate([
350
- (0, BaseNode_1.dependencyTracked)()
308
+ dependencyTracked()
351
309
  ], Container.prototype, "activeChild", null);
352
- exports.default = Container;
310
+
311
+ export { Container as default };
@@ -1,4 +1,4 @@
1
- import Field from './Field';
1
+ import Field from './Field.js';
2
2
  declare class DateField extends Field {
3
3
  protected _applyDefaults(): void;
4
4
  }
@@ -0,0 +1,57 @@
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 Field from './Field.js';
22
+ import { parseDateSkeleton, formatDate } from '@aemforms/af-formatters';
23
+ import './BaseNode-dc59ab07.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
+
38
+ class DateField extends Field {
39
+ _applyDefaults() {
40
+ super._applyDefaults();
41
+ const locale = new Intl.DateTimeFormat().resolvedOptions().locale;
42
+ if (!this._jsonModel.editFormat) {
43
+ this._jsonModel.editFormat = 'short';
44
+ }
45
+ if (!this._jsonModel.displayFormat) {
46
+ this._jsonModel.displayFormat = this._jsonModel.editFormat;
47
+ }
48
+ if (!this._jsonModel.placeholder) {
49
+ this._jsonModel.placeholder = parseDateSkeleton(this._jsonModel.editFormat, locale);
50
+ }
51
+ if (!this._jsonModel.description) {
52
+ this._jsonModel.description = `To enter today's date use ${formatDate(new Date(), locale, this._jsonModel.editFormat)}`;
53
+ }
54
+ }
55
+ }
56
+
57
+ export { DateField as default };