@aemforms/af-core 0.22.19 → 0.22.20
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/lib/browser/afb-events.js +151 -0
- package/lib/browser/afb-runtime.js +3620 -0
- package/lib/cjs/index.cjs +8886 -0
- package/lib/{BaseNode.d.ts → esm/BaseNode.d.ts} +10 -69
- package/lib/{BaseNode.js → esm/BaseNode.js} +84 -184
- package/lib/esm/Checkbox.d.ts +79 -0
- package/lib/esm/Checkbox.js +27 -0
- package/lib/{CheckboxGroup.d.ts → esm/CheckboxGroup.d.ts} +2 -14
- package/lib/esm/CheckboxGroup.js +23 -0
- package/lib/{Container.d.ts → esm/Container.d.ts} +12 -59
- package/lib/{Container.js → esm/Container.js} +54 -116
- package/lib/{DateField.d.ts → esm/DateField.d.ts} +1 -1
- package/lib/esm/DateField.js +21 -0
- package/lib/{Field.d.ts → esm/Field.d.ts} +39 -104
- package/lib/{Field.js → esm/Field.js} +142 -208
- package/lib/esm/Fieldset.d.ts +16 -0
- package/lib/esm/Fieldset.js +45 -0
- package/lib/{FileObject.d.ts → esm/FileObject.d.ts} +1 -4
- package/lib/esm/FileObject.js +26 -0
- package/lib/{FileUpload.d.ts → esm/FileUpload.d.ts} +3 -18
- package/lib/esm/FileUpload.js +108 -0
- package/lib/{Form.d.ts → esm/Form.d.ts} +19 -85
- package/lib/esm/Form.js +176 -0
- package/lib/esm/FormInstance.d.ts +13 -0
- package/lib/esm/FormInstance.js +81 -0
- package/lib/esm/FormMetaData.d.ts +7 -0
- package/lib/esm/FormMetaData.js +10 -0
- package/lib/esm/InstanceManager.d.ts +9 -0
- package/lib/esm/InstanceManager.js +31 -0
- package/lib/esm/Node.d.ts +7 -0
- package/lib/esm/Node.js +16 -0
- package/lib/esm/Scriptable.d.ts +17 -0
- package/lib/{Scriptable.js → esm/Scriptable.js} +11 -54
- package/lib/{controller → esm/controller}/EventQueue.d.ts +3 -11
- package/lib/{controller → esm/controller}/EventQueue.js +10 -26
- package/lib/esm/controller/Events.d.ts +85 -0
- package/lib/esm/controller/Events.js +149 -0
- package/lib/{controller → esm/controller}/Logger.d.ts +0 -6
- package/lib/{controller → esm/controller}/Logger.js +5 -11
- package/lib/{data → esm/data}/DataGroup.d.ts +1 -7
- package/lib/{data → esm/data}/DataGroup.js +15 -34
- package/lib/{data → esm/data}/DataValue.d.ts +1 -7
- package/lib/esm/data/DataValue.js +46 -0
- package/lib/{data → esm/data}/EmptyDataValue.d.ts +1 -1
- package/lib/esm/data/EmptyDataValue.js +29 -0
- package/lib/esm/index.d.ts +21 -0
- package/lib/esm/index.js +21 -0
- package/lib/{rules → esm/rules}/FunctionRuntime.d.ts +2 -24
- package/lib/{rules → esm/rules}/FunctionRuntime.js +41 -117
- package/lib/esm/rules/RuleEngine.d.ts +12 -0
- package/lib/esm/rules/RuleEngine.js +47 -0
- package/lib/{types → esm/types}/Json.d.ts +3 -22
- package/lib/esm/types/Json.js +7 -0
- package/lib/esm/types/Model.d.ts +131 -0
- package/lib/esm/types/Model.js +8 -0
- package/lib/esm/types/index.d.ts +2 -0
- package/lib/esm/types/index.js +2 -0
- package/lib/{utils → esm/utils}/DataRefParser.d.ts +2 -5
- package/lib/{utils → esm/utils}/DataRefParser.js +22 -49
- package/lib/{utils → esm/utils}/Fetch.d.ts +0 -6
- package/lib/esm/utils/Fetch.js +61 -0
- package/lib/esm/utils/FormCreationUtils.d.ts +9 -0
- package/lib/esm/utils/FormCreationUtils.js +74 -0
- package/lib/esm/utils/FormUtils.d.ts +12 -0
- package/lib/esm/utils/FormUtils.js +187 -0
- package/lib/esm/utils/JsonUtils.d.ts +11 -0
- package/lib/esm/utils/JsonUtils.js +76 -0
- package/lib/{utils → esm/utils}/LogUtils.d.ts +1 -4
- package/lib/esm/utils/LogUtils.js +6 -0
- package/lib/esm/utils/SchemaUtils.d.ts +3 -0
- package/lib/esm/utils/SchemaUtils.js +71 -0
- package/lib/esm/utils/TranslationUtils.d.ts +11 -0
- package/lib/esm/utils/TranslationUtils.js +115 -0
- package/lib/esm/utils/ValidationUtils.d.ts +19 -0
- package/lib/{utils → esm/utils}/ValidationUtils.js +29 -187
- package/package.json +17 -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/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.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,21 +1,13 @@
|
|
|
1
|
-
import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types';
|
|
2
|
-
import Scriptable from './Scriptable';
|
|
3
|
-
import DataValue from './data/DataValue';
|
|
4
|
-
import DataGroup from './data/DataGroup';
|
|
1
|
+
import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel, ValidationError } from './types/index.js';
|
|
2
|
+
import Scriptable from './Scriptable.js';
|
|
3
|
+
import DataValue from './data/DataValue.js';
|
|
4
|
+
import DataGroup from './data/DataGroup.js';
|
|
5
5
|
declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
6
|
-
/**
|
|
7
|
-
* @param params
|
|
8
|
-
* @param _options
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
6
|
constructor(params: FieldJson, _options: {
|
|
12
7
|
form: FormModel;
|
|
13
8
|
parent: ContainerModel;
|
|
14
9
|
});
|
|
15
10
|
private _ruleNodeReference;
|
|
16
|
-
/**
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
11
|
_initialize(): any;
|
|
20
12
|
ruleNodeReference(): any;
|
|
21
13
|
protected _getDefaults(): {
|
|
@@ -24,19 +16,15 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
24
16
|
visible: boolean;
|
|
25
17
|
type: string | undefined;
|
|
26
18
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Returns the fallback type to be used for this field, in case type is not defined. Otherwise returns
|
|
29
|
-
* undefined
|
|
30
|
-
* @protected
|
|
31
|
-
*/
|
|
32
19
|
protected _getFallbackType(): string | undefined;
|
|
33
20
|
protected _applyDefaults(): void;
|
|
21
|
+
private unset;
|
|
22
|
+
private coerceParam;
|
|
34
23
|
get editFormat(): string | undefined;
|
|
35
24
|
get displayFormat(): string | undefined;
|
|
36
25
|
get placeholder(): string | undefined;
|
|
37
26
|
get readOnly(): boolean | undefined;
|
|
38
27
|
set readOnly(e: boolean | undefined);
|
|
39
|
-
get language(): string;
|
|
40
28
|
get enabled(): boolean | undefined;
|
|
41
29
|
set enabled(e: boolean | undefined);
|
|
42
30
|
get valid(): boolean | undefined;
|
|
@@ -51,137 +39,93 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
51
39
|
set maximum(m: number | undefined);
|
|
52
40
|
get minimum(): number | undefined;
|
|
53
41
|
set minimum(m: number | undefined);
|
|
54
|
-
/**
|
|
55
|
-
* returns whether the value is empty. Empty value is either a '', undefined or null
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
42
|
private isEmpty;
|
|
43
|
+
private withCategory;
|
|
59
44
|
get editValue(): any;
|
|
60
45
|
get displayValue(): any;
|
|
61
46
|
protected getDataNodeValue(typedValue: any): any;
|
|
62
47
|
private updateDataNodeAndTypedValue;
|
|
63
48
|
get value(): any;
|
|
64
49
|
set value(v: any);
|
|
65
|
-
/**
|
|
66
|
-
* @summary reset the value of the current field to its default
|
|
67
|
-
* @method reset
|
|
68
|
-
* @private
|
|
69
|
-
*/
|
|
70
50
|
reset(): void;
|
|
71
51
|
protected _updateRuleNodeReference(value: any): void;
|
|
72
52
|
protected getInternalType(): string | undefined;
|
|
73
53
|
valueOf(): any;
|
|
74
54
|
toString(): any;
|
|
75
|
-
/**
|
|
76
|
-
* Returns the error message for a given constraint
|
|
77
|
-
* @param constraint
|
|
78
|
-
*/
|
|
79
55
|
getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
|
|
80
56
|
get errorMessage(): string | undefined;
|
|
81
57
|
get screenReaderText(): string | undefined;
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
58
|
_getConstraintObject(): {
|
|
87
|
-
|
|
59
|
+
enum: (constraint: any, inputVal: any) => {
|
|
88
60
|
valid: boolean;
|
|
89
61
|
value: any;
|
|
90
62
|
};
|
|
91
|
-
|
|
92
|
-
value: string | null;
|
|
63
|
+
accept: (constraint: any, inputVal: any) => {
|
|
93
64
|
valid: boolean;
|
|
65
|
+
value: any;
|
|
94
66
|
};
|
|
95
|
-
|
|
67
|
+
exclusiveMinimum: (constraint: any, inputVal: any) => {
|
|
96
68
|
valid: boolean;
|
|
97
|
-
value:
|
|
69
|
+
value: any;
|
|
98
70
|
};
|
|
99
|
-
|
|
71
|
+
exclusiveMaximum: (constraint: any, inputVal: any) => {
|
|
100
72
|
valid: boolean;
|
|
101
|
-
value:
|
|
73
|
+
value: any;
|
|
102
74
|
};
|
|
103
|
-
|
|
75
|
+
format: (constraint: any, inputVal: any) => {
|
|
104
76
|
valid: boolean;
|
|
105
|
-
value:
|
|
77
|
+
value: any;
|
|
106
78
|
};
|
|
107
|
-
|
|
79
|
+
maxFileSize: (constraint: any, inputVal: any) => {
|
|
108
80
|
valid: boolean;
|
|
109
|
-
value:
|
|
81
|
+
value: any;
|
|
110
82
|
};
|
|
111
|
-
|
|
83
|
+
maxLength: (constraint: any, inputVal: any) => {
|
|
112
84
|
valid: boolean;
|
|
113
|
-
value:
|
|
85
|
+
value: any;
|
|
114
86
|
};
|
|
115
|
-
|
|
87
|
+
maximum: (constraint: any, inputVal: any) => {
|
|
116
88
|
valid: boolean;
|
|
117
|
-
value:
|
|
89
|
+
value: any;
|
|
118
90
|
};
|
|
119
|
-
|
|
91
|
+
maxItems: (constraint: any, inputVal: any) => {
|
|
120
92
|
valid: boolean;
|
|
121
|
-
value:
|
|
93
|
+
value: any;
|
|
122
94
|
};
|
|
123
|
-
minLength: (constraint:
|
|
124
|
-
value: string;
|
|
95
|
+
minLength: (constraint: any, inputVal: any) => {
|
|
125
96
|
valid: boolean;
|
|
97
|
+
value: any;
|
|
126
98
|
};
|
|
127
|
-
|
|
128
|
-
value: string;
|
|
99
|
+
minimum: (constraint: any, inputVal: any) => {
|
|
129
100
|
valid: boolean;
|
|
101
|
+
value: any;
|
|
130
102
|
};
|
|
131
|
-
|
|
103
|
+
minItems: (constraint: any, inputVal: any) => {
|
|
132
104
|
valid: boolean;
|
|
133
|
-
value:
|
|
105
|
+
value: any;
|
|
134
106
|
};
|
|
135
|
-
|
|
107
|
+
pattern: (constraint: any, inputVal: any) => {
|
|
136
108
|
valid: boolean;
|
|
137
109
|
value: any;
|
|
138
110
|
};
|
|
139
|
-
|
|
111
|
+
required: (constraint: any, inputVal: any) => {
|
|
140
112
|
valid: boolean;
|
|
141
113
|
value: any;
|
|
142
114
|
};
|
|
143
|
-
|
|
115
|
+
type: (constraint: any, inputVal: any) => {
|
|
144
116
|
valid: boolean;
|
|
145
117
|
value: any;
|
|
146
118
|
};
|
|
147
|
-
|
|
119
|
+
uniqueItems: (constraint: any, inputVal: any) => {
|
|
148
120
|
valid: boolean;
|
|
149
121
|
value: any;
|
|
150
122
|
};
|
|
151
123
|
};
|
|
152
|
-
/**
|
|
153
|
-
* returns whether the field is array type or not
|
|
154
|
-
* @private
|
|
155
|
-
*/
|
|
156
124
|
private isArrayType;
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
159
|
-
* @param value
|
|
160
|
-
* @param constraints
|
|
161
|
-
* @private
|
|
162
|
-
*/
|
|
163
125
|
private checkEnum;
|
|
164
|
-
/**
|
|
165
|
-
* checks whether the value can be achieved by stepping the min/default value by the step constraint.
|
|
166
|
-
* Basically to find a integer solution for n in the equation
|
|
167
|
-
* initialValue + n * step = value
|
|
168
|
-
* @param constraints
|
|
169
|
-
* @private
|
|
170
|
-
*/
|
|
171
126
|
private checkStep;
|
|
172
|
-
/**
|
|
173
|
-
* checks whether the validation expression returns a boolean value or not
|
|
174
|
-
* @private
|
|
175
|
-
*/
|
|
176
127
|
private checkValidationExpression;
|
|
177
|
-
/**
|
|
178
|
-
* Returns the applicable constraints for a given type
|
|
179
|
-
* @private
|
|
180
|
-
*/
|
|
181
128
|
private getConstraints;
|
|
182
|
-
/**
|
|
183
|
-
* returns the format constraint
|
|
184
|
-
*/
|
|
185
129
|
get format(): string | undefined;
|
|
186
130
|
get enforceEnum(): boolean | undefined;
|
|
187
131
|
get tooltip(): string | undefined;
|
|
@@ -195,27 +139,17 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
195
139
|
set exclusiveMaximum(eM: number | undefined);
|
|
196
140
|
get default(): any;
|
|
197
141
|
private isNotEmpty;
|
|
198
|
-
/**
|
|
199
|
-
* @private
|
|
200
|
-
*/
|
|
201
142
|
protected evaluateConstraints(): any;
|
|
202
143
|
triggerValidationEvent(changes: any): void;
|
|
203
|
-
/**
|
|
204
|
-
* Validates the current form object
|
|
205
|
-
*/
|
|
206
144
|
validate(): ValidationError[];
|
|
207
145
|
importData(contextualDataModel: DataGroup): void;
|
|
208
|
-
/**
|
|
209
|
-
* @param name
|
|
210
|
-
* @private
|
|
211
|
-
*/
|
|
212
146
|
defaultDataModel(name: string | number): DataValue;
|
|
213
147
|
getState(): {
|
|
214
148
|
editValue: any;
|
|
215
149
|
displayValue: any;
|
|
216
150
|
description?: string | undefined;
|
|
217
|
-
rules: import("./types").Items<string> & {};
|
|
218
|
-
events: import("./types").Items<string | string[] | undefined> & {};
|
|
151
|
+
rules: import("./types/Json.js").Items<string> & {};
|
|
152
|
+
events: import("./types/Json.js").Items<string | string[] | undefined> & {};
|
|
219
153
|
enumNames?: string[] | undefined;
|
|
220
154
|
enum?: any[] | undefined;
|
|
221
155
|
accept?: string[] | undefined;
|
|
@@ -240,7 +174,7 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
240
174
|
uniqueItems?: boolean | undefined;
|
|
241
175
|
dataRef?: string | null | undefined;
|
|
242
176
|
':type': string;
|
|
243
|
-
label?: import("./types").Label | undefined;
|
|
177
|
+
label?: import("./types/Json.js").Label | undefined;
|
|
244
178
|
enabled?: boolean | undefined;
|
|
245
179
|
visible?: boolean | undefined;
|
|
246
180
|
name?: string | undefined;
|
|
@@ -250,10 +184,11 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
250
184
|
properties: {
|
|
251
185
|
[key: string]: any;
|
|
252
186
|
};
|
|
253
|
-
repeatable
|
|
187
|
+
repeatable: boolean | undefined;
|
|
254
188
|
screenReaderText?: string | undefined;
|
|
255
189
|
tooltip?: string | undefined;
|
|
256
190
|
altText?: string | undefined;
|
|
191
|
+
viewType?: string | undefined;
|
|
257
192
|
placeholder?: string | undefined;
|
|
258
193
|
readOnly?: boolean | undefined;
|
|
259
194
|
valid?: boolean | undefined;
|