@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.
- package/LICENSE +18 -4
- package/lib/cjs/index.cjs +7277 -0
- package/lib/{BaseNode.js → esm/BaseNode-dc59ab07.js} +108 -184
- package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
- package/lib/esm/BaseNode.js +26 -0
- package/lib/esm/Checkbox.d.ts +79 -0
- package/lib/esm/Checkbox.js +63 -0
- package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
- package/lib/esm/CheckboxGroup.js +60 -0
- package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
- package/lib/{Container.js → esm/Container.js} +81 -122
- package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
- package/lib/esm/DateField.js +57 -0
- package/lib/{Field.d.ts → esm/Field.d.ts} +41 -106
- package/lib/{Field.js → esm/Field.js} +186 -216
- package/lib/esm/Fieldset.d.ts +16 -0
- package/lib/esm/Fieldset.js +78 -0
- package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
- package/lib/esm/FileObject.js +48 -0
- package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
- package/lib/esm/FileUpload.js +141 -0
- package/lib/{Form.d.ts → esm/Form.d.ts} +20 -86
- package/lib/esm/Form.js +208 -0
- package/lib/esm/FormInstance.d.ts +13 -0
- package/lib/esm/FormInstance.js +129 -0
- package/lib/esm/FormMetaData.d.ts +7 -0
- package/lib/esm/FormMetaData.js +35 -0
- package/lib/esm/InstanceManager.d.ts +9 -0
- package/lib/esm/InstanceManager.js +58 -0
- package/lib/esm/Node.d.ts +7 -0
- package/lib/esm/Node.js +40 -0
- package/lib/esm/Scriptable.d.ts +17 -0
- package/lib/{Scriptable.js → esm/Scriptable.js} +38 -54
- package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
- package/lib/{controller → esm/controller}/EventQueue.js +32 -26
- package/lib/esm/controller/Events.d.ts +85 -0
- package/lib/esm/controller/Events.js +171 -0
- package/lib/{controller → esm/controller}/Logger.d.ts +2 -8
- package/lib/esm/controller/Logger.js +52 -0
- package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
- package/lib/{data → esm/data}/DataGroup.js +38 -34
- package/lib/{data → esm/data}/DataValue.d.ts +1 -7
- package/lib/esm/data/DataValue.js +68 -0
- package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
- package/lib/esm/data/EmptyDataValue.js +51 -0
- package/lib/esm/index.d.ts +21 -0
- package/lib/esm/index.js +55 -0
- package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +3 -25
- package/lib/{rules → esm/rules}/FunctionRuntime.js +66 -117
- package/lib/esm/rules/RuleEngine.d.ts +12 -0
- package/lib/esm/rules/RuleEngine.js +76 -0
- package/lib/esm/types/Json.d.ts +119 -0
- package/lib/esm/types/Json.js +29 -0
- package/lib/esm/types/Model.d.ts +131 -0
- package/lib/esm/types/Model.js +30 -0
- package/lib/esm/types/index.d.ts +2 -0
- package/lib/esm/types/index.js +22 -0
- package/lib/{utils → esm/utils}/DataRefParser.d.ts +4 -7
- package/lib/{utils → esm/utils}/DataRefParser.js +42 -44
- package/lib/{utils → esm/utils}/Fetch.d.ts +1 -7
- package/lib/esm/utils/Fetch.js +83 -0
- package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
- package/lib/esm/utils/FormCreationUtils.js +112 -0
- package/lib/esm/utils/FormUtils.d.ts +12 -0
- package/lib/esm/utils/FormUtils.js +212 -0
- package/lib/esm/utils/JsonUtils.d.ts +11 -0
- package/lib/esm/utils/JsonUtils.js +99 -0
- package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
- package/lib/esm/utils/LogUtils.js +28 -0
- package/lib/esm/utils/SchemaUtils.d.ts +3 -0
- package/lib/esm/utils/SchemaUtils.js +93 -0
- package/lib/esm/utils/TranslationUtils.d.ts +11 -0
- package/lib/esm/utils/TranslationUtils.js +138 -0
- package/lib/esm/utils/ValidationUtils.d.ts +19 -0
- package/lib/{utils → esm/utils}/ValidationUtils.js +55 -187
- package/package.json +18 -10
- package/lib/Checkbox.d.ts +0 -88
- package/lib/Checkbox.js +0 -49
- package/lib/CheckboxGroup.js +0 -43
- package/lib/DateField.js +0 -35
- package/lib/Fieldset.d.ts +0 -24
- package/lib/Fieldset.js +0 -74
- package/lib/FileObject.js +0 -39
- package/lib/FileUpload.js +0 -155
- package/lib/Form.js +0 -252
- package/lib/FormInstance.d.ts +0 -38
- package/lib/FormInstance.js +0 -127
- package/lib/FormMetaData.d.ts +0 -11
- package/lib/FormMetaData.js +0 -28
- package/lib/InstanceManager.d.ts +0 -16
- package/lib/InstanceManager.js +0 -53
- package/lib/Node.d.ts +0 -12
- package/lib/Node.js +0 -27
- package/lib/Scriptable.d.ts +0 -31
- package/lib/controller/Controller.d.ts +0 -255
- package/lib/controller/Controller.js +0 -328
- package/lib/controller/Logger.js +0 -36
- package/lib/controller/index.d.ts +0 -1
- package/lib/controller/index.js +0 -24
- package/lib/data/DataValue.js +0 -56
- package/lib/data/EmptyDataValue.js +0 -46
- package/lib/index.d.ts +0 -28
- package/lib/index.js +0 -63
- package/lib/rules/RuleEngine.d.ts +0 -23
- package/lib/rules/RuleEngine.js +0 -62
- package/lib/types/Json.d.ts +0 -138
- package/lib/types/Json.js +0 -19
- package/lib/types/Model.d.ts +0 -393
- package/lib/types/Model.js +0 -20
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.js +0 -25
- package/lib/utils/Fetch.js +0 -87
- package/lib/utils/FormCreationUtils.d.ts +0 -11
- package/lib/utils/FormCreationUtils.js +0 -83
- package/lib/utils/FormUtils.d.ts +0 -47
- package/lib/utils/FormUtils.js +0 -257
- package/lib/utils/JsonUtils.d.ts +0 -63
- package/lib/utils/JsonUtils.js +0 -157
- package/lib/utils/LogUtils.js +0 -17
- package/lib/utils/SchemaUtils.d.ts +0 -16
- package/lib/utils/SchemaUtils.js +0 -92
- package/lib/utils/TranslationUtils.d.ts +0 -41
- package/lib/utils/TranslationUtils.js +0 -185
- package/lib/utils/ValidationUtils.d.ts +0 -170
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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(
|
|
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
|
|
79
|
-
|
|
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);
|
|
97
|
+
self.ruleEngine.trackDependency(child);
|
|
95
98
|
}
|
|
96
99
|
if (self.hasDynamicItems()) {
|
|
97
|
-
self.ruleEngine.trackDependency(self);
|
|
98
|
-
if (this._children[name] !== undefined) {
|
|
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 =
|
|
124
|
-
|
|
125
|
-
|
|
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
|
|
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 =
|
|
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(
|
|
210
|
-
retVal.dispatch(new
|
|
211
|
-
retVal.dispatch(new
|
|
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
|
|
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
|
|
224
|
+
this._children[i].dispatch(new ExecuteRule());
|
|
241
225
|
}
|
|
242
|
-
this.notifyDependents(
|
|
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 (
|
|
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 (
|
|
298
|
-
const dataLength = contextualDataModel
|
|
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 =
|
|
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
|
|
296
|
+
this._jsonModel.activeChild = c?.id;
|
|
339
297
|
this.notifyDependents(change);
|
|
340
298
|
}
|
|
341
299
|
}
|
|
342
300
|
}
|
|
343
301
|
__decorate([
|
|
344
|
-
|
|
302
|
+
dependencyTracked()
|
|
345
303
|
], Container.prototype, "maxItems", null);
|
|
346
304
|
__decorate([
|
|
347
|
-
|
|
305
|
+
dependencyTracked()
|
|
348
306
|
], Container.prototype, "minItems", null);
|
|
349
307
|
__decorate([
|
|
350
|
-
|
|
308
|
+
dependencyTracked()
|
|
351
309
|
], Container.prototype, "activeChild", null);
|
|
352
|
-
|
|
310
|
+
|
|
311
|
+
export { Container as default };
|
|
@@ -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 };
|