@aemforms/af-core 0.22.102 → 0.22.104
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/esm/afb-events.js +186 -1
- package/esm/afb-runtime.js +167 -57
- package/esm/types/src/BaseNode.d.ts +2 -0
- package/esm/types/src/Container.d.ts +3 -1
- package/esm/types/src/Form.d.ts +1 -0
- package/esm/types/src/controller/Events.d.ts +7 -7
- package/esm/types/src/rules/RuleEngine.d.ts +1 -1
- package/esm/types/src/types/Model.d.ts +2 -0
- package/lib/BaseNode.d.ts +2 -0
- package/lib/BaseNode.js +11 -0
- package/lib/Container.d.ts +3 -1
- package/lib/Container.js +16 -37
- package/lib/Form.d.ts +1 -0
- package/lib/Form.js +3 -0
- package/lib/Scriptable.js +26 -7
- package/lib/controller/Events.d.ts +7 -7
- package/lib/controller/Events.js +6 -2
- package/lib/rules/FunctionRuntime.js +20 -10
- package/lib/rules/RuleEngine.d.ts +1 -1
- package/lib/rules/RuleEngine.js +7 -4
- package/lib/types/Model.d.ts +2 -0
- package/package.json +2 -2
- package/esm/Events-f062426b.js +0 -270
package/esm/Events-f062426b.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
const ConstraintType = Object.freeze({
|
|
2
|
-
PATTERN_MISMATCH: 'patternMismatch',
|
|
3
|
-
TOO_SHORT: 'tooShort',
|
|
4
|
-
TOO_LONG: 'tooLong',
|
|
5
|
-
RANGE_OVERFLOW: 'rangeOverflow',
|
|
6
|
-
RANGE_UNDERFLOW: 'rangeUnderflow',
|
|
7
|
-
TYPE_MISMATCH: 'typeMismatch',
|
|
8
|
-
VALUE_MISSING: 'valueMissing',
|
|
9
|
-
STEP_MISMATCH: 'stepMismatch',
|
|
10
|
-
FORMAT_MISMATCH: 'formatMismatch',
|
|
11
|
-
ACCEPT_MISMATCH: 'acceptMismatch',
|
|
12
|
-
FILE_SIZE_MISMATCH: 'fileSizeMismatch',
|
|
13
|
-
UNIQUE_ITEMS_MISMATCH: 'uniqueItemsMismatch',
|
|
14
|
-
MIN_ITEMS_MISMATCH: 'minItemsMismatch',
|
|
15
|
-
MAX_ITEMS_MISMATCH: 'maxItemsMismatch',
|
|
16
|
-
EXPRESSION_MISMATCH: 'expressionMismatch',
|
|
17
|
-
EXCLUSIVE_MAXIMUM_MISMATCH: 'exclusiveMaximumMismatch',
|
|
18
|
-
EXCLUSIVE_MINIMUM_MISMATCH: 'exclusiveMinimumMismatch'
|
|
19
|
-
});
|
|
20
|
-
const constraintKeys = Object.freeze({
|
|
21
|
-
pattern: ConstraintType.PATTERN_MISMATCH,
|
|
22
|
-
minLength: ConstraintType.TOO_SHORT,
|
|
23
|
-
maxLength: ConstraintType.TOO_LONG,
|
|
24
|
-
maximum: ConstraintType.RANGE_OVERFLOW,
|
|
25
|
-
minimum: ConstraintType.RANGE_UNDERFLOW,
|
|
26
|
-
type: ConstraintType.TYPE_MISMATCH,
|
|
27
|
-
required: ConstraintType.VALUE_MISSING,
|
|
28
|
-
step: ConstraintType.STEP_MISMATCH,
|
|
29
|
-
format: ConstraintType.FORMAT_MISMATCH,
|
|
30
|
-
accept: ConstraintType.ACCEPT_MISMATCH,
|
|
31
|
-
maxFileSize: ConstraintType.FILE_SIZE_MISMATCH,
|
|
32
|
-
uniqueItems: ConstraintType.UNIQUE_ITEMS_MISMATCH,
|
|
33
|
-
minItems: ConstraintType.MIN_ITEMS_MISMATCH,
|
|
34
|
-
maxItems: ConstraintType.MAX_ITEMS_MISMATCH,
|
|
35
|
-
validationExpression: ConstraintType.EXPRESSION_MISMATCH,
|
|
36
|
-
exclusiveMinimum: ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH,
|
|
37
|
-
exclusiveMaximum: ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH
|
|
38
|
-
});
|
|
39
|
-
const defaultConstraintTypeMessages = Object.freeze({
|
|
40
|
-
[ConstraintType.PATTERN_MISMATCH]: 'Please match the format requested.',
|
|
41
|
-
[ConstraintType.TOO_SHORT]: 'Please lengthen this text to ${0} characters or more.',
|
|
42
|
-
[ConstraintType.TOO_LONG]: 'Please shorten this text to ${0} characters or less.',
|
|
43
|
-
[ConstraintType.RANGE_OVERFLOW]: 'Value must be less than or equal to ${0}.',
|
|
44
|
-
[ConstraintType.RANGE_UNDERFLOW]: 'Value must be greater than or equal to ${0}.',
|
|
45
|
-
[ConstraintType.TYPE_MISMATCH]: 'Please enter a valid value.',
|
|
46
|
-
[ConstraintType.VALUE_MISSING]: 'Please fill in this field.',
|
|
47
|
-
[ConstraintType.STEP_MISMATCH]: 'Please enter a valid value.',
|
|
48
|
-
[ConstraintType.FORMAT_MISMATCH]: 'Specify the value in allowed format : ${0}.',
|
|
49
|
-
[ConstraintType.ACCEPT_MISMATCH]: 'The specified file type not supported.',
|
|
50
|
-
[ConstraintType.FILE_SIZE_MISMATCH]: 'File too large. Reduce size and try again.',
|
|
51
|
-
[ConstraintType.UNIQUE_ITEMS_MISMATCH]: 'All the items must be unique.',
|
|
52
|
-
[ConstraintType.MIN_ITEMS_MISMATCH]: 'Specify a number of items equal to or greater than ${0}.',
|
|
53
|
-
[ConstraintType.MAX_ITEMS_MISMATCH]: 'Specify a number of items equal to or less than ${0}.',
|
|
54
|
-
[ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.',
|
|
55
|
-
[ConstraintType.EXCLUSIVE_MINIMUM_MISMATCH]: 'Value must be greater than ${0}.',
|
|
56
|
-
[ConstraintType.EXCLUSIVE_MAXIMUM_MISMATCH]: 'Value must be less than ${0}.'
|
|
57
|
-
});
|
|
58
|
-
let customConstraintTypeMessages = {};
|
|
59
|
-
const getConstraintTypeMessages = () => {
|
|
60
|
-
return {
|
|
61
|
-
...defaultConstraintTypeMessages,
|
|
62
|
-
...customConstraintTypeMessages
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var EventSource;
|
|
67
|
-
(function (EventSource) {
|
|
68
|
-
EventSource["CODE"] = "code";
|
|
69
|
-
EventSource["UI"] = "ui";
|
|
70
|
-
})(EventSource || (EventSource = {}));
|
|
71
|
-
class ValidationError {
|
|
72
|
-
fieldName;
|
|
73
|
-
errorMessages;
|
|
74
|
-
constructor(fieldName = '', errorMessages = []) {
|
|
75
|
-
this.errorMessages = errorMessages;
|
|
76
|
-
this.fieldName = fieldName;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
var FocusOption;
|
|
80
|
-
(function (FocusOption) {
|
|
81
|
-
FocusOption["NEXT_ITEM"] = "nextItem";
|
|
82
|
-
FocusOption["PREVIOUS_ITEM"] = "previousItem";
|
|
83
|
-
})(FocusOption || (FocusOption = {}));
|
|
84
|
-
var CaptchaDisplayMode;
|
|
85
|
-
(function (CaptchaDisplayMode) {
|
|
86
|
-
CaptchaDisplayMode["INVISIBLE"] = "invisible";
|
|
87
|
-
CaptchaDisplayMode["VISIBLE"] = "visible";
|
|
88
|
-
})(CaptchaDisplayMode || (CaptchaDisplayMode = {}));
|
|
89
|
-
|
|
90
|
-
class ActionImpl {
|
|
91
|
-
_metadata;
|
|
92
|
-
_type;
|
|
93
|
-
_payload;
|
|
94
|
-
_target;
|
|
95
|
-
_currentTarget;
|
|
96
|
-
constructor(payload, type, _metadata) {
|
|
97
|
-
this._metadata = _metadata;
|
|
98
|
-
this._payload = payload;
|
|
99
|
-
this._type = type;
|
|
100
|
-
}
|
|
101
|
-
get type() {
|
|
102
|
-
return this._type;
|
|
103
|
-
}
|
|
104
|
-
get payload() {
|
|
105
|
-
return this._payload;
|
|
106
|
-
}
|
|
107
|
-
get metadata() {
|
|
108
|
-
return this._metadata;
|
|
109
|
-
}
|
|
110
|
-
get target() {
|
|
111
|
-
return this._target;
|
|
112
|
-
}
|
|
113
|
-
get currentTarget() {
|
|
114
|
-
return this._currentTarget;
|
|
115
|
-
}
|
|
116
|
-
get isCustomEvent() {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
payloadToJson() {
|
|
120
|
-
return this.payload;
|
|
121
|
-
}
|
|
122
|
-
toJson() {
|
|
123
|
-
return {
|
|
124
|
-
payload: this.payloadToJson(),
|
|
125
|
-
type: this.type,
|
|
126
|
-
isCustomEvent: this.isCustomEvent
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
toString() {
|
|
130
|
-
return JSON.stringify(this.toJson());
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
class Change extends ActionImpl {
|
|
134
|
-
constructor(payload, dispatch = false) {
|
|
135
|
-
super(payload, 'change', { dispatch });
|
|
136
|
-
}
|
|
137
|
-
withAdditionalChange(change) {
|
|
138
|
-
return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
class UIChange extends ActionImpl {
|
|
142
|
-
constructor(payload, dispatch = false) {
|
|
143
|
-
super(payload, 'uiChange', { dispatch });
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
class Invalid extends ActionImpl {
|
|
147
|
-
constructor(payload = {}) {
|
|
148
|
-
super(payload, 'invalid', {});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
class Valid extends ActionImpl {
|
|
152
|
-
constructor(payload = {}) {
|
|
153
|
-
super(payload, 'valid', {});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
class ExecuteRule extends ActionImpl {
|
|
157
|
-
constructor(payload = {}, dispatch = false) {
|
|
158
|
-
super(payload, 'executeRule', { dispatch });
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
162
|
-
return new Change({
|
|
163
|
-
changes: [
|
|
164
|
-
{
|
|
165
|
-
propertyName,
|
|
166
|
-
currentValue,
|
|
167
|
-
prevValue
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
class Initialize extends ActionImpl {
|
|
173
|
-
constructor(payload, dispatch = false) {
|
|
174
|
-
super(payload, 'initialize', { dispatch });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
class FormLoad extends ActionImpl {
|
|
178
|
-
constructor() {
|
|
179
|
-
super({}, 'load', { dispatch: false });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
class Click extends ActionImpl {
|
|
183
|
-
constructor(payload, dispatch = false) {
|
|
184
|
-
super(payload, 'click', { dispatch });
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
class Blur extends ActionImpl {
|
|
188
|
-
constructor(payload, dispatch = false) {
|
|
189
|
-
super(payload, 'blur', { dispatch });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
class ValidationComplete extends ActionImpl {
|
|
193
|
-
constructor(payload, dispatch = false) {
|
|
194
|
-
super(payload, 'validationComplete', { dispatch });
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
class Focus extends ActionImpl {
|
|
198
|
-
constructor() {
|
|
199
|
-
super({}, 'focus', { dispatch: false });
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
class Submit extends ActionImpl {
|
|
203
|
-
constructor(payload, dispatch = false) {
|
|
204
|
-
super(payload, 'submit', { dispatch });
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
class Save extends ActionImpl {
|
|
208
|
-
constructor(payload, dispatch = false) {
|
|
209
|
-
super(payload, 'save', { dispatch });
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
class SubmitSuccess extends ActionImpl {
|
|
213
|
-
constructor(payload, dispatch = false) {
|
|
214
|
-
super(payload, 'submitSuccess', { dispatch });
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
class SubmitFailure extends ActionImpl {
|
|
218
|
-
constructor(payload, dispatch = false) {
|
|
219
|
-
super(payload, 'submitFailure', { dispatch });
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
class SubmitError extends ActionImpl {
|
|
223
|
-
constructor(payload, dispatch = false) {
|
|
224
|
-
super(payload, 'submitError', { dispatch });
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
class Reset extends ActionImpl {
|
|
228
|
-
constructor(payload, dispatch = false) {
|
|
229
|
-
super(payload, 'reset', { dispatch });
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
class FieldChanged extends ActionImpl {
|
|
233
|
-
constructor(changes, field, eventSource = EventSource.CODE) {
|
|
234
|
-
super({
|
|
235
|
-
field,
|
|
236
|
-
changes,
|
|
237
|
-
eventSource
|
|
238
|
-
}, 'fieldChanged');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
class CustomEvent extends ActionImpl {
|
|
242
|
-
constructor(eventName, payload = {}, dispatch = false) {
|
|
243
|
-
super(payload, eventName, { dispatch });
|
|
244
|
-
}
|
|
245
|
-
get isCustomEvent() {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
class AddItem extends ActionImpl {
|
|
250
|
-
constructor(payload) {
|
|
251
|
-
super(payload, 'addItem');
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
class RemoveItem extends ActionImpl {
|
|
255
|
-
constructor(payload) {
|
|
256
|
-
super(payload, 'removeItem');
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
class AddInstance extends ActionImpl {
|
|
260
|
-
constructor(payload) {
|
|
261
|
-
super(payload, 'addInstance');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
class RemoveInstance extends ActionImpl {
|
|
265
|
-
constructor(payload) {
|
|
266
|
-
super(payload, 'removeInstance');
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export { AddInstance as A, Blur as B, CustomEvent as C, EventSource as E, FormLoad as F, Initialize as I, RemoveItem as R, SubmitSuccess as S, UIChange as U, ValidationComplete as V, ExecuteRule as a, SubmitError as b, SubmitFailure as c, CaptchaDisplayMode as d, Submit as e, Save as f, RemoveInstance as g, Reset as h, AddItem as i, Click as j, Change as k, FocusOption as l, FieldChanged as m, constraintKeys as n, getConstraintTypeMessages as o, propertyChange as p, Valid as q, Invalid as r, ValidationError as s, Focus as t };
|