@aemforms/af-core 0.22.23 → 0.22.25

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 (75) hide show
  1. package/package.json +2 -14
  2. package/lib/cjs/index.cjs +0 -7277
  3. package/lib/esm/BaseNode-dc59ab07.js +0 -478
  4. package/lib/esm/BaseNode.d.ts +0 -93
  5. package/lib/esm/BaseNode.js +0 -26
  6. package/lib/esm/Checkbox.d.ts +0 -79
  7. package/lib/esm/Checkbox.js +0 -63
  8. package/lib/esm/CheckboxGroup.d.ts +0 -18
  9. package/lib/esm/CheckboxGroup.js +0 -60
  10. package/lib/esm/Container.d.ts +0 -53
  11. package/lib/esm/Container.js +0 -311
  12. package/lib/esm/DateField.d.ts +0 -5
  13. package/lib/esm/DateField.js +0 -57
  14. package/lib/esm/Field.d.ts +0 -206
  15. package/lib/esm/Field.js +0 -692
  16. package/lib/esm/Fieldset.d.ts +0 -16
  17. package/lib/esm/Fieldset.js +0 -78
  18. package/lib/esm/FileObject.d.ts +0 -16
  19. package/lib/esm/FileObject.js +0 -48
  20. package/lib/esm/FileUpload.d.ts +0 -22
  21. package/lib/esm/FileUpload.js +0 -141
  22. package/lib/esm/Form.d.ts +0 -113
  23. package/lib/esm/Form.js +0 -208
  24. package/lib/esm/FormInstance.d.ts +0 -13
  25. package/lib/esm/FormInstance.js +0 -129
  26. package/lib/esm/FormMetaData.d.ts +0 -7
  27. package/lib/esm/FormMetaData.js +0 -35
  28. package/lib/esm/InstanceManager.d.ts +0 -9
  29. package/lib/esm/InstanceManager.js +0 -58
  30. package/lib/esm/Node.d.ts +0 -7
  31. package/lib/esm/Node.js +0 -40
  32. package/lib/esm/Scriptable.d.ts +0 -17
  33. package/lib/esm/Scriptable.js +0 -190
  34. package/lib/esm/controller/EventQueue.d.ts +0 -17
  35. package/lib/esm/controller/EventQueue.js +0 -108
  36. package/lib/esm/controller/Events.d.ts +0 -85
  37. package/lib/esm/controller/Events.js +0 -171
  38. package/lib/esm/controller/Logger.d.ts +0 -11
  39. package/lib/esm/controller/Logger.js +0 -52
  40. package/lib/esm/data/DataGroup.d.ts +0 -20
  41. package/lib/esm/data/DataGroup.js +0 -100
  42. package/lib/esm/data/DataValue.d.ts +0 -16
  43. package/lib/esm/data/DataValue.js +0 -68
  44. package/lib/esm/data/EmptyDataValue.d.ts +0 -14
  45. package/lib/esm/data/EmptyDataValue.js +0 -51
  46. package/lib/esm/index.d.ts +0 -21
  47. package/lib/esm/index.js +0 -55
  48. package/lib/esm/rules/FunctionRuntime.d.ts +0 -51
  49. package/lib/esm/rules/FunctionRuntime.js +0 -345
  50. package/lib/esm/rules/RuleEngine.d.ts +0 -12
  51. package/lib/esm/rules/RuleEngine.js +0 -76
  52. package/lib/esm/types/Json.d.ts +0 -119
  53. package/lib/esm/types/Json.js +0 -29
  54. package/lib/esm/types/Model.d.ts +0 -131
  55. package/lib/esm/types/Model.js +0 -30
  56. package/lib/esm/types/index.d.ts +0 -2
  57. package/lib/esm/types/index.js +0 -22
  58. package/lib/esm/utils/DataRefParser.d.ts +0 -27
  59. package/lib/esm/utils/DataRefParser.js +0 -247
  60. package/lib/esm/utils/Fetch.d.ts +0 -8
  61. package/lib/esm/utils/Fetch.js +0 -83
  62. package/lib/esm/utils/FormCreationUtils.d.ts +0 -9
  63. package/lib/esm/utils/FormCreationUtils.js +0 -112
  64. package/lib/esm/utils/FormUtils.d.ts +0 -12
  65. package/lib/esm/utils/FormUtils.js +0 -212
  66. package/lib/esm/utils/JsonUtils.d.ts +0 -11
  67. package/lib/esm/utils/JsonUtils.js +0 -99
  68. package/lib/esm/utils/LogUtils.d.ts +0 -4
  69. package/lib/esm/utils/LogUtils.js +0 -28
  70. package/lib/esm/utils/SchemaUtils.d.ts +0 -3
  71. package/lib/esm/utils/SchemaUtils.js +0 -93
  72. package/lib/esm/utils/TranslationUtils.d.ts +0 -11
  73. package/lib/esm/utils/TranslationUtils.js +0 -138
  74. package/lib/esm/utils/ValidationUtils.d.ts +0 -19
  75. package/lib/esm/utils/ValidationUtils.js +0 -300
@@ -1,63 +0,0 @@
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 { Constraints } from './utils/ValidationUtils.js';
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 './Scriptable.js';
31
- import './utils/SchemaUtils.js';
32
- import '@aemforms/af-formatters';
33
- import './utils/FormUtils.js';
34
- import './utils/JsonUtils.js';
35
- import './types/Json.js';
36
- import './FileObject.js';
37
-
38
- const requiredConstraint = (offValue) => (constraint, value) => {
39
- const valid = Constraints.required(constraint, value).valid && (!constraint || value != offValue);
40
- return { valid, value };
41
- };
42
- class Checkbox extends Field {
43
- offValue() {
44
- const opts = this.enum;
45
- return opts.length > 1 ? opts[1] : null;
46
- }
47
- _getConstraintObject() {
48
- const baseConstraints = { ...super._getConstraintObject() };
49
- baseConstraints.required = requiredConstraint(this.offValue());
50
- return baseConstraints;
51
- }
52
- _getDefaults() {
53
- return {
54
- ...super._getDefaults(),
55
- enforceEnum: true
56
- };
57
- }
58
- get enum() {
59
- return this._jsonModel.enum || [];
60
- }
61
- }
62
-
63
- export { Checkbox as default };
@@ -1,18 +0,0 @@
1
- import Field from './Field.js';
2
- import { ContainerModel, FieldJson, FormModel } from './types/index.js';
3
- declare class CheckboxGroup extends Field {
4
- constructor(params: FieldJson, _options: {
5
- form: FormModel;
6
- parent: ContainerModel;
7
- });
8
- protected _getFallbackType(): string | undefined;
9
- protected _getDefaults(): {
10
- enforceEnum: boolean;
11
- enum: never[];
12
- readOnly: boolean;
13
- enabled: boolean;
14
- visible: boolean;
15
- type: string | undefined;
16
- };
17
- }
18
- export default CheckboxGroup;
@@ -1,60 +0,0 @@
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 './BaseNode-dc59ab07.js';
23
- import './controller/Events.js';
24
- import './utils/DataRefParser.js';
25
- import './data/DataGroup.js';
26
- import './data/DataValue.js';
27
- import './data/EmptyDataValue.js';
28
- import './types/Model.js';
29
- import './utils/ValidationUtils.js';
30
- import './utils/FormUtils.js';
31
- import './utils/JsonUtils.js';
32
- import './types/Json.js';
33
- import './utils/SchemaUtils.js';
34
- import './FileObject.js';
35
- import './Scriptable.js';
36
- import '@aemforms/af-formatters';
37
-
38
- class CheckboxGroup extends Field {
39
- constructor(params, _options) {
40
- super(params, _options);
41
- }
42
- _getFallbackType() {
43
- const fallbackType = super._getFallbackType();
44
- if (typeof fallbackType === 'string') {
45
- return `${fallbackType}[]`;
46
- }
47
- else {
48
- return 'string[]';
49
- }
50
- }
51
- _getDefaults() {
52
- return {
53
- ...super._getDefaults(),
54
- enforceEnum: true,
55
- enum: []
56
- };
57
- }
58
- }
59
-
60
- export { CheckboxGroup as default };
@@ -1,53 +0,0 @@
1
- import { Action, BaseModel, ContainerJson, ContainerModel, FieldModel, FieldsetModel, FormModel, IFormFieldFactory, RulesJson } from './types/index.js';
2
- import Scriptable from './Scriptable.js';
3
- import DataGroup from './data/DataGroup.js';
4
- declare abstract class Container<T extends ContainerJson & RulesJson> extends Scriptable<T> implements ContainerModel {
5
- protected _children: Array<FieldModel | FieldsetModel>;
6
- protected _childrenReference: any;
7
- private _itemTemplate;
8
- private fieldFactory;
9
- constructor(json: T, _options: {
10
- form: FormModel;
11
- parent: ContainerModel;
12
- fieldFactory: IFormFieldFactory;
13
- });
14
- ruleNodeReference(): any;
15
- get items(): (FieldModel | FieldsetModel)[];
16
- get maxItems(): number;
17
- set maxItems(m: number);
18
- get minItems(): number;
19
- hasDynamicItems(): boolean;
20
- get isContainer(): boolean;
21
- private _activeChild;
22
- getState(): T & {
23
- items: any[];
24
- properties: {
25
- [key: string]: any;
26
- };
27
- index: number;
28
- parent: undefined;
29
- qualifiedName: any;
30
- events: {};
31
- rules: {};
32
- repeatable: boolean | undefined;
33
- ':type': string;
34
- id: string;
35
- };
36
- private _createChild;
37
- private _addChildToRuleNode;
38
- private _addChild;
39
- indexOf(f: FieldModel | FieldsetModel): number;
40
- defaultDataModel(name: string): DataGroup | undefined;
41
- _initialize(): void;
42
- addItem(action: Action): void;
43
- removeItem(action: Action): void;
44
- queueEvent(action: Action): void;
45
- reset(): void;
46
- validate(): import("./types/Model.js").ValidationError[];
47
- dispatch(action: Action): void;
48
- importData(contextualDataModel: DataGroup): void;
49
- syncDataAndFormModel(contextualDataModel?: DataGroup): void;
50
- get activeChild(): BaseModel | null;
51
- set activeChild(c: BaseModel | null);
52
- }
53
- export default Container;
@@ -1,311 +0,0 @@
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;
40
- }
41
- ruleNodeReference() {
42
- return this._childrenReference;
43
- }
44
- get items() {
45
- return this._children;
46
- }
47
- get maxItems() {
48
- return this._jsonModel.maxItems;
49
- }
50
- set maxItems(m) {
51
- this._jsonModel.maxItems = m;
52
- const minItems = this._jsonModel.minItems || 1;
53
- const itemsLength = this._children.length;
54
- const items2Remove = Math.min(itemsLength - m, itemsLength - minItems);
55
- if (items2Remove > 0) {
56
- for (let i = 0; i < items2Remove; i++) {
57
- this.getDataNode().$removeDataNode(m + i);
58
- this._childrenReference.pop();
59
- }
60
- const elems = this._children.splice(m, items2Remove);
61
- this.notifyDependents(propertyChange('items', elems, null));
62
- }
63
- }
64
- get minItems() {
65
- return this._jsonModel.minItems;
66
- }
67
- hasDynamicItems() {
68
- return this._itemTemplate != null;
69
- }
70
- get isContainer() {
71
- return true;
72
- }
73
- _activeChild = null;
74
- getState() {
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
- });
88
- }
89
- _addChildToRuleNode(child, options) {
90
- const self = this;
91
- const { parent = this } = options;
92
- const name = parent.type == 'array' ? parent._children.length + '' : child.name || '';
93
- if (name.length > 0) {
94
- Object.defineProperty(parent._childrenReference, name, {
95
- get: () => {
96
- if (child.isContainer && child.hasDynamicItems()) {
97
- self.ruleEngine.trackDependency(child);
98
- }
99
- if (self.hasDynamicItems()) {
100
- self.ruleEngine.trackDependency(self);
101
- if (this._children[name] !== undefined) {
102
- return this._children[name].getRuleNode();
103
- }
104
- }
105
- else {
106
- return child.getRuleNode();
107
- }
108
- },
109
- configurable: true,
110
- enumerable: true
111
- });
112
- }
113
- }
114
- _addChild(itemJson, index, cloneIds = false) {
115
- let nonTransparentParent = this;
116
- while (nonTransparentParent != null && nonTransparentParent.isTransparent()) {
117
- nonTransparentParent = nonTransparentParent.parent;
118
- }
119
- if (typeof index !== 'number' || index > nonTransparentParent._children.length) {
120
- index = this._children.length;
121
- }
122
- const form = this.form;
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);
129
- this._addChildToRuleNode(retVal, { parent: nonTransparentParent });
130
- if (index === this._children.length) {
131
- this._children.push(retVal);
132
- }
133
- else {
134
- this._children.splice(index, 0, retVal);
135
- }
136
- return retVal;
137
- }
138
- indexOf(f) {
139
- return this._children.indexOf(f);
140
- }
141
- defaultDataModel(name) {
142
- const type = this._jsonModel.type || undefined;
143
- if (type === undefined) {
144
- return undefined;
145
- }
146
- else {
147
- const instance = type === 'array' ? [] : {};
148
- return new DataGroup(name, instance, type);
149
- }
150
- }
151
- _initialize() {
152
- super._initialize();
153
- const items = this._jsonModel.items || [];
154
- this._jsonModel.items = [];
155
- this._childrenReference = this._jsonModel.type == 'array' ? [] : {};
156
- if (this._jsonModel.type == 'array' && items.length === 1 && this.getDataNode() != null) {
157
- this._itemTemplate = deepClone(items[0]);
158
- if (typeof (this._jsonModel.minItems) !== 'number') {
159
- this._jsonModel.minItems = 0;
160
- }
161
- if (typeof (this._jsonModel.maxItems) !== 'number') {
162
- this._jsonModel.maxItems = -1;
163
- }
164
- if (typeof (this._jsonModel.initialItems) !== 'number') {
165
- this._jsonModel.initialItems = Math.max(1, this._jsonModel.minItems);
166
- }
167
- for (let i = 0; i < this._jsonModel.initialItems; i++) {
168
- const child = this._addChild(this._itemTemplate);
169
- child._initialize();
170
- }
171
- }
172
- else if (items.length > 0) {
173
- items.forEach((item) => {
174
- const child = this._addChild(item);
175
- child._initialize();
176
- });
177
- this._jsonModel.minItems = this._children.length;
178
- this._jsonModel.maxItems = this._children.length;
179
- this._jsonModel.initialItems = this._children.length;
180
- }
181
- else {
182
- this.form.logger.warn('A container exists with no items.');
183
- }
184
- this.setupRuleNode();
185
- }
186
- addItem(action) {
187
- if ((action.type === 'addItem' || action.type == 'addInstance') && this._itemTemplate != null) {
188
- if ((this._jsonModel.maxItems === -1) || (this._children.length < this._jsonModel.maxItems)) {
189
- const dataNode = this.getDataNode();
190
- let instanceIndex = action.payload;
191
- const retVal = this._addChild(this._itemTemplate, action.payload, true);
192
- if (typeof instanceIndex !== 'number' || instanceIndex > this._children.length) {
193
- instanceIndex = this._children.length;
194
- }
195
- const _data = retVal.defaultDataModel(instanceIndex);
196
- if (_data) {
197
- dataNode.$addDataNode(instanceIndex, _data);
198
- }
199
- retVal._initialize();
200
- this.notifyDependents(propertyChange('items', retVal.getState(), null));
201
- retVal.dispatch(new Initialize());
202
- retVal.dispatch(new ExecuteRule());
203
- for (let i = instanceIndex + 1; i < this._children.length; i++) {
204
- this._children[i].dispatch(new ExecuteRule());
205
- }
206
- }
207
- }
208
- }
209
- removeItem(action) {
210
- if ((action.type === 'removeItem' || action.type == 'removeInstance') && this._itemTemplate != null) {
211
- if (this._children.length == 0) {
212
- return;
213
- }
214
- let instanceIndex = action.payload;
215
- if (typeof instanceIndex !== 'number') {
216
- instanceIndex = this._children.length - 1;
217
- }
218
- const state = this._children[instanceIndex].getState();
219
- if (this._children.length > this._jsonModel.minItems) {
220
- this._childrenReference.pop();
221
- this._children.splice(instanceIndex, 1);
222
- this.getDataNode().$removeDataNode(instanceIndex);
223
- for (let i = instanceIndex; i < this._children.length; i++) {
224
- this._children[i].dispatch(new ExecuteRule());
225
- }
226
- this.notifyDependents(propertyChange('items', null, state));
227
- }
228
- }
229
- }
230
- queueEvent(action) {
231
- super.queueEvent(action);
232
- if (action.metadata?.dispatch) {
233
- this.items.forEach(x => {
234
- x.queueEvent(action);
235
- });
236
- }
237
- }
238
- reset() {
239
- this.items.forEach(x => {
240
- x.reset();
241
- });
242
- }
243
- validate() {
244
- return this.items.flatMap(x => {
245
- return x.validate();
246
- }).filter(x => x.fieldName !== '');
247
- }
248
- dispatch(action) {
249
- super.dispatch(action);
250
- }
251
- importData(contextualDataModel) {
252
- this._bindToDataModel(contextualDataModel);
253
- const dataNode = this.getDataNode() || contextualDataModel;
254
- this.syncDataAndFormModel(dataNode);
255
- }
256
- syncDataAndFormModel(contextualDataModel) {
257
- if (contextualDataModel?.$type === 'array' && this._itemTemplate != null) {
258
- const dataLength = contextualDataModel?.$value.length;
259
- const itemsLength = this._children.length;
260
- const maxItems = this._jsonModel.maxItems === -1 ? dataLength : this._jsonModel.maxItems;
261
- const minItems = this._jsonModel.minItems;
262
- let items2Add = Math.min(dataLength - itemsLength, maxItems - itemsLength);
263
- const items2Remove = Math.min(itemsLength - dataLength, itemsLength - minItems);
264
- while (items2Add > 0) {
265
- items2Add--;
266
- const child = this._addChild(this._itemTemplate);
267
- child._initialize();
268
- }
269
- if (items2Remove > 0) {
270
- this._children.splice(dataLength, items2Remove);
271
- for (let i = 0; i < items2Remove; i++) {
272
- this._childrenReference.pop();
273
- }
274
- }
275
- }
276
- this._children.forEach(x => {
277
- x.importData(contextualDataModel);
278
- });
279
- }
280
- get activeChild() {
281
- return this._activeChild;
282
- }
283
- set activeChild(c) {
284
- if (c !== this._activeChild) {
285
- let activeChild = this._activeChild;
286
- while (activeChild instanceof Container) {
287
- const temp = activeChild.activeChild;
288
- activeChild.activeChild = null;
289
- activeChild = temp;
290
- }
291
- const change = propertyChange('activeChild', c, this._activeChild);
292
- this._activeChild = c;
293
- if (this.parent && c !== null) {
294
- this.parent.activeChild = this;
295
- }
296
- this._jsonModel.activeChild = c?.id;
297
- this.notifyDependents(change);
298
- }
299
- }
300
- }
301
- __decorate([
302
- dependencyTracked()
303
- ], Container.prototype, "maxItems", null);
304
- __decorate([
305
- dependencyTracked()
306
- ], Container.prototype, "minItems", null);
307
- __decorate([
308
- dependencyTracked()
309
- ], Container.prototype, "activeChild", null);
310
-
311
- export { Container as default };
@@ -1,5 +0,0 @@
1
- import Field from './Field.js';
2
- declare class DateField extends Field {
3
- protected _applyDefaults(): void;
4
- }
5
- export default DateField;
@@ -1,57 +0,0 @@
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 };