@aemforms/af-core 0.22.89 → 0.22.91
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/Events-a66f7a2c.js +259 -0
- package/esm/afb-events.js +1 -175
- package/esm/afb-runtime.js +21 -84
- package/esm/types/src/BaseNode.d.ts +2 -1
- package/esm/types/src/controller/Events.d.ts +3 -2
- package/esm/types/src/types/Model.d.ts +5 -0
- package/lib/BaseNode.d.ts +2 -1
- package/lib/BaseNode.js +2 -0
- package/lib/DateField.js +12 -1
- package/lib/Field.js +5 -2
- package/lib/Form.js +1 -1
- package/lib/controller/Events.d.ts +3 -2
- package/lib/controller/Events.js +4 -2
- package/lib/types/Model.d.ts +5 -0
- package/lib/types/Model.js +6 -1
- package/package.json +2 -2
|
@@ -0,0 +1,259 @@
|
|
|
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
|
+
});
|
|
18
|
+
const constraintKeys = Object.freeze({
|
|
19
|
+
pattern: ConstraintType.PATTERN_MISMATCH,
|
|
20
|
+
minLength: ConstraintType.TOO_SHORT,
|
|
21
|
+
maxLength: ConstraintType.TOO_LONG,
|
|
22
|
+
maximum: ConstraintType.RANGE_OVERFLOW,
|
|
23
|
+
minimum: ConstraintType.RANGE_UNDERFLOW,
|
|
24
|
+
type: ConstraintType.TYPE_MISMATCH,
|
|
25
|
+
required: ConstraintType.VALUE_MISSING,
|
|
26
|
+
step: ConstraintType.STEP_MISMATCH,
|
|
27
|
+
format: ConstraintType.FORMAT_MISMATCH,
|
|
28
|
+
accept: ConstraintType.ACCEPT_MISMATCH,
|
|
29
|
+
maxFileSize: ConstraintType.FILE_SIZE_MISMATCH,
|
|
30
|
+
uniqueItems: ConstraintType.UNIQUE_ITEMS_MISMATCH,
|
|
31
|
+
minItems: ConstraintType.MIN_ITEMS_MISMATCH,
|
|
32
|
+
maxItems: ConstraintType.MAX_ITEMS_MISMATCH,
|
|
33
|
+
validationExpression: ConstraintType.EXPRESSION_MISMATCH
|
|
34
|
+
});
|
|
35
|
+
const defaultConstraintTypeMessages = Object.freeze({
|
|
36
|
+
[ConstraintType.PATTERN_MISMATCH]: 'Please match the format requested.',
|
|
37
|
+
[ConstraintType.TOO_SHORT]: 'Please lengthen this text to ${0} characters or more.',
|
|
38
|
+
[ConstraintType.TOO_LONG]: 'Please shorten this text to ${0} characters or less.',
|
|
39
|
+
[ConstraintType.RANGE_OVERFLOW]: 'Value must be less than or equal to ${0}.',
|
|
40
|
+
[ConstraintType.RANGE_UNDERFLOW]: 'Value must be greater than or equal to ${0}.',
|
|
41
|
+
[ConstraintType.TYPE_MISMATCH]: 'Please enter a valid value.',
|
|
42
|
+
[ConstraintType.VALUE_MISSING]: 'Please fill in this field.',
|
|
43
|
+
[ConstraintType.STEP_MISMATCH]: 'Please enter a valid value.',
|
|
44
|
+
[ConstraintType.FORMAT_MISMATCH]: 'Specify the value in allowed format : ${0}.',
|
|
45
|
+
[ConstraintType.ACCEPT_MISMATCH]: 'The specified file type not supported.',
|
|
46
|
+
[ConstraintType.FILE_SIZE_MISMATCH]: 'File too large. Reduce size and try again.',
|
|
47
|
+
[ConstraintType.UNIQUE_ITEMS_MISMATCH]: 'All the items must be unique.',
|
|
48
|
+
[ConstraintType.MIN_ITEMS_MISMATCH]: 'Specify a number of items equal to or greater than ${0}.',
|
|
49
|
+
[ConstraintType.MAX_ITEMS_MISMATCH]: 'Specify a number of items equal to or less than ${0}.',
|
|
50
|
+
[ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.'
|
|
51
|
+
});
|
|
52
|
+
let customConstraintTypeMessages = {};
|
|
53
|
+
const getConstraintTypeMessages = () => {
|
|
54
|
+
return {
|
|
55
|
+
...defaultConstraintTypeMessages,
|
|
56
|
+
...customConstraintTypeMessages
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var EventSource;
|
|
61
|
+
(function (EventSource) {
|
|
62
|
+
EventSource["CODE"] = "code";
|
|
63
|
+
EventSource["UI"] = "ui";
|
|
64
|
+
})(EventSource || (EventSource = {}));
|
|
65
|
+
class ValidationError {
|
|
66
|
+
fieldName;
|
|
67
|
+
errorMessages;
|
|
68
|
+
constructor(fieldName = '', errorMessages = []) {
|
|
69
|
+
this.errorMessages = errorMessages;
|
|
70
|
+
this.fieldName = fieldName;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var FocusOption;
|
|
74
|
+
(function (FocusOption) {
|
|
75
|
+
FocusOption["NEXT_ITEM"] = "nextItem";
|
|
76
|
+
FocusOption["PREVIOUS_ITEM"] = "previousItem";
|
|
77
|
+
})(FocusOption || (FocusOption = {}));
|
|
78
|
+
var CaptchaDisplayMode;
|
|
79
|
+
(function (CaptchaDisplayMode) {
|
|
80
|
+
CaptchaDisplayMode["INVISIBLE"] = "invisible";
|
|
81
|
+
CaptchaDisplayMode["VISIBLE"] = "visible";
|
|
82
|
+
})(CaptchaDisplayMode || (CaptchaDisplayMode = {}));
|
|
83
|
+
|
|
84
|
+
class ActionImpl {
|
|
85
|
+
_metadata;
|
|
86
|
+
_type;
|
|
87
|
+
_payload;
|
|
88
|
+
_target;
|
|
89
|
+
_currentTarget;
|
|
90
|
+
constructor(payload, type, _metadata) {
|
|
91
|
+
this._metadata = _metadata;
|
|
92
|
+
this._payload = payload;
|
|
93
|
+
this._type = type;
|
|
94
|
+
}
|
|
95
|
+
get type() {
|
|
96
|
+
return this._type;
|
|
97
|
+
}
|
|
98
|
+
get payload() {
|
|
99
|
+
return this._payload;
|
|
100
|
+
}
|
|
101
|
+
get metadata() {
|
|
102
|
+
return this._metadata;
|
|
103
|
+
}
|
|
104
|
+
get target() {
|
|
105
|
+
return this._target;
|
|
106
|
+
}
|
|
107
|
+
get currentTarget() {
|
|
108
|
+
return this._currentTarget;
|
|
109
|
+
}
|
|
110
|
+
get isCustomEvent() {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
payloadToJson() {
|
|
114
|
+
return this.payload;
|
|
115
|
+
}
|
|
116
|
+
toJson() {
|
|
117
|
+
return {
|
|
118
|
+
payload: this.payloadToJson(),
|
|
119
|
+
type: this.type,
|
|
120
|
+
isCustomEvent: this.isCustomEvent
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
toString() {
|
|
124
|
+
return JSON.stringify(this.toJson());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
class Change extends ActionImpl {
|
|
128
|
+
constructor(payload, dispatch = false) {
|
|
129
|
+
super(payload, 'change', { dispatch });
|
|
130
|
+
}
|
|
131
|
+
withAdditionalChange(change) {
|
|
132
|
+
return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
class Invalid extends ActionImpl {
|
|
136
|
+
constructor(payload = {}) {
|
|
137
|
+
super(payload, 'invalid', {});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class Valid extends ActionImpl {
|
|
141
|
+
constructor(payload = {}) {
|
|
142
|
+
super(payload, 'valid', {});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
class ExecuteRule extends ActionImpl {
|
|
146
|
+
constructor(payload = {}, dispatch = false) {
|
|
147
|
+
super(payload, 'executeRule', { dispatch });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
151
|
+
return new Change({
|
|
152
|
+
changes: [
|
|
153
|
+
{
|
|
154
|
+
propertyName,
|
|
155
|
+
currentValue,
|
|
156
|
+
prevValue
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
class Initialize extends ActionImpl {
|
|
162
|
+
constructor(payload, dispatch = false) {
|
|
163
|
+
super(payload, 'initialize', { dispatch });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
class FormLoad extends ActionImpl {
|
|
167
|
+
constructor() {
|
|
168
|
+
super({}, 'load', { dispatch: false });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
class Click extends ActionImpl {
|
|
172
|
+
constructor(payload, dispatch = false) {
|
|
173
|
+
super(payload, 'click', { dispatch });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
class Blur extends ActionImpl {
|
|
177
|
+
constructor(payload, dispatch = false) {
|
|
178
|
+
super(payload, 'blur', { dispatch });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class ValidationComplete extends ActionImpl {
|
|
182
|
+
constructor(payload, dispatch = false) {
|
|
183
|
+
super(payload, 'validationComplete', { dispatch });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
class Focus extends ActionImpl {
|
|
187
|
+
constructor() {
|
|
188
|
+
super({}, 'focus', { dispatch: false });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
class Submit extends ActionImpl {
|
|
192
|
+
constructor(payload, dispatch = false) {
|
|
193
|
+
super(payload, 'submit', { dispatch });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
class Save extends ActionImpl {
|
|
197
|
+
constructor(payload, dispatch = false) {
|
|
198
|
+
super(payload, 'save', { dispatch });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
class SubmitSuccess extends ActionImpl {
|
|
202
|
+
constructor(payload, dispatch = false) {
|
|
203
|
+
super(payload, 'submitSuccess', { dispatch });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
class SubmitFailure extends ActionImpl {
|
|
207
|
+
constructor(payload, dispatch = false) {
|
|
208
|
+
super(payload, 'submitFailure', { dispatch });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
class SubmitError extends ActionImpl {
|
|
212
|
+
constructor(payload, dispatch = false) {
|
|
213
|
+
super(payload, 'submitError', { dispatch });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
class Reset extends ActionImpl {
|
|
217
|
+
constructor(payload, dispatch = false) {
|
|
218
|
+
super(payload, 'reset', { dispatch });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
class FieldChanged extends ActionImpl {
|
|
222
|
+
constructor(changes, field, eventSource = EventSource.CODE) {
|
|
223
|
+
super({
|
|
224
|
+
field,
|
|
225
|
+
changes,
|
|
226
|
+
eventSource
|
|
227
|
+
}, 'fieldChanged');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
class CustomEvent extends ActionImpl {
|
|
231
|
+
constructor(eventName, payload = {}, dispatch = false) {
|
|
232
|
+
super(payload, eventName, { dispatch });
|
|
233
|
+
}
|
|
234
|
+
get isCustomEvent() {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
class AddItem extends ActionImpl {
|
|
239
|
+
constructor(payload) {
|
|
240
|
+
super(payload, 'addItem');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class RemoveItem extends ActionImpl {
|
|
244
|
+
constructor(payload) {
|
|
245
|
+
super(payload, 'removeItem');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
class AddInstance extends ActionImpl {
|
|
249
|
+
constructor(payload) {
|
|
250
|
+
super(payload, 'addInstance');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
class RemoveInstance extends ActionImpl {
|
|
254
|
+
constructor(payload) {
|
|
255
|
+
super(payload, 'removeInstance');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
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, 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 };
|
package/esm/afb-events.js
CHANGED
|
@@ -1,175 +1 @@
|
|
|
1
|
-
|
|
2
|
-
_metadata;
|
|
3
|
-
_type;
|
|
4
|
-
_payload;
|
|
5
|
-
_target;
|
|
6
|
-
_currentTarget;
|
|
7
|
-
constructor(payload, type, _metadata) {
|
|
8
|
-
this._metadata = _metadata;
|
|
9
|
-
this._payload = payload;
|
|
10
|
-
this._type = type;
|
|
11
|
-
}
|
|
12
|
-
get type() {
|
|
13
|
-
return this._type;
|
|
14
|
-
}
|
|
15
|
-
get payload() {
|
|
16
|
-
return this._payload;
|
|
17
|
-
}
|
|
18
|
-
get metadata() {
|
|
19
|
-
return this._metadata;
|
|
20
|
-
}
|
|
21
|
-
get target() {
|
|
22
|
-
return this._target;
|
|
23
|
-
}
|
|
24
|
-
get currentTarget() {
|
|
25
|
-
return this._currentTarget;
|
|
26
|
-
}
|
|
27
|
-
get isCustomEvent() {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
payloadToJson() {
|
|
31
|
-
return this.payload;
|
|
32
|
-
}
|
|
33
|
-
toJson() {
|
|
34
|
-
return {
|
|
35
|
-
payload: this.payloadToJson(),
|
|
36
|
-
type: this.type,
|
|
37
|
-
isCustomEvent: this.isCustomEvent
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
toString() {
|
|
41
|
-
return JSON.stringify(this.toJson());
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
class Change extends ActionImpl {
|
|
45
|
-
constructor(payload, dispatch = false) {
|
|
46
|
-
super(payload, 'change', { dispatch });
|
|
47
|
-
}
|
|
48
|
-
withAdditionalChange(change) {
|
|
49
|
-
return new Change(this.payload.changes.concat(change.payload.changes), this.metadata);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
class Invalid extends ActionImpl {
|
|
53
|
-
constructor(payload = {}) {
|
|
54
|
-
super(payload, 'invalid', {});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
class Valid extends ActionImpl {
|
|
58
|
-
constructor(payload = {}) {
|
|
59
|
-
super(payload, 'valid', {});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
class ExecuteRule extends ActionImpl {
|
|
63
|
-
constructor(payload = {}, dispatch = false) {
|
|
64
|
-
super(payload, 'executeRule', { dispatch });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const propertyChange = (propertyName, currentValue, prevValue) => {
|
|
68
|
-
return new Change({
|
|
69
|
-
changes: [
|
|
70
|
-
{
|
|
71
|
-
propertyName,
|
|
72
|
-
currentValue,
|
|
73
|
-
prevValue
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
class Initialize extends ActionImpl {
|
|
79
|
-
constructor(payload, dispatch = false) {
|
|
80
|
-
super(payload, 'initialize', { dispatch });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
class FormLoad extends ActionImpl {
|
|
84
|
-
constructor() {
|
|
85
|
-
super({}, 'load', { dispatch: false });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
class Click extends ActionImpl {
|
|
89
|
-
constructor(payload, dispatch = false) {
|
|
90
|
-
super(payload, 'click', { dispatch });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
class Blur extends ActionImpl {
|
|
94
|
-
constructor(payload, dispatch = false) {
|
|
95
|
-
super(payload, 'blur', { dispatch });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
class ValidationComplete extends ActionImpl {
|
|
99
|
-
constructor(payload, dispatch = false) {
|
|
100
|
-
super(payload, 'validationComplete', { dispatch });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
class Focus extends ActionImpl {
|
|
104
|
-
constructor() {
|
|
105
|
-
super({}, 'focus', { dispatch: false });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
class Submit extends ActionImpl {
|
|
109
|
-
constructor(payload, dispatch = false) {
|
|
110
|
-
super(payload, 'submit', { dispatch });
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
class Save extends ActionImpl {
|
|
114
|
-
constructor(payload, dispatch = false) {
|
|
115
|
-
super(payload, 'save', { dispatch });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
class SubmitSuccess extends ActionImpl {
|
|
119
|
-
constructor(payload, dispatch = false) {
|
|
120
|
-
super(payload, 'submitSuccess', { dispatch });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
class SubmitFailure extends ActionImpl {
|
|
124
|
-
constructor(payload, dispatch = false) {
|
|
125
|
-
super(payload, 'submitFailure', { dispatch });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
class SubmitError extends ActionImpl {
|
|
129
|
-
constructor(payload, dispatch = false) {
|
|
130
|
-
super(payload, 'submitError', { dispatch });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
class Reset extends ActionImpl {
|
|
134
|
-
constructor(payload, dispatch = false) {
|
|
135
|
-
super(payload, 'reset', { dispatch });
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
class FieldChanged extends ActionImpl {
|
|
139
|
-
constructor(changes, field) {
|
|
140
|
-
super({
|
|
141
|
-
field,
|
|
142
|
-
changes
|
|
143
|
-
}, 'fieldChanged');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
class CustomEvent extends ActionImpl {
|
|
147
|
-
constructor(eventName, payload = {}, dispatch = false) {
|
|
148
|
-
super(payload, eventName, { dispatch });
|
|
149
|
-
}
|
|
150
|
-
get isCustomEvent() {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
class AddItem extends ActionImpl {
|
|
155
|
-
constructor(payload) {
|
|
156
|
-
super(payload, 'addItem');
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
class RemoveItem extends ActionImpl {
|
|
160
|
-
constructor(payload) {
|
|
161
|
-
super(payload, 'removeItem');
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
class AddInstance extends ActionImpl {
|
|
165
|
-
constructor(payload) {
|
|
166
|
-
super(payload, 'addInstance');
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
class RemoveInstance extends ActionImpl {
|
|
170
|
-
constructor(payload) {
|
|
171
|
-
super(payload, 'removeInstance');
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export { AddInstance, AddItem, Blur, Change, Click, CustomEvent, ExecuteRule, FieldChanged, Focus, FormLoad, Initialize, Invalid, RemoveInstance, RemoveItem, Reset, Save, Submit, SubmitError, SubmitFailure, SubmitSuccess, Valid, ValidationComplete, propertyChange };
|
|
1
|
+
export { A as AddInstance, i as AddItem, B as Blur, k as Change, j as Click, C as CustomEvent, a as ExecuteRule, m as FieldChanged, t as Focus, F as FormLoad, I as Initialize, r as Invalid, g as RemoveInstance, R as RemoveItem, h as Reset, f as Save, e as Submit, b as SubmitError, c as SubmitFailure, S as SubmitSuccess, q as Valid, V as ValidationComplete, p as propertyChange } from './Events-a66f7a2c.js';
|
package/esm/afb-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { propertyChange, ExecuteRule, Initialize, RemoveItem, SubmitSuccess, CustomEvent, SubmitError, SubmitFailure, Submit, Save, RemoveInstance, AddInstance, Reset, AddItem, Click, Change, FormLoad, FieldChanged, ValidationComplete, Valid, Invalid } from './
|
|
1
|
+
import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-a66f7a2c.js';
|
|
2
2
|
import Formula from '@adobe/json-formula';
|
|
3
|
-
import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime } from '@aemforms/af-formatters';
|
|
3
|
+
import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime, parseDate } from '@aemforms/af-formatters';
|
|
4
4
|
|
|
5
5
|
function __decorate(decorators, target, key, desc) {
|
|
6
6
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -9,84 +9,6 @@ function __decorate(decorators, target, key, desc) {
|
|
|
9
9
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const ConstraintType = Object.freeze({
|
|
13
|
-
PATTERN_MISMATCH: 'patternMismatch',
|
|
14
|
-
TOO_SHORT: 'tooShort',
|
|
15
|
-
TOO_LONG: 'tooLong',
|
|
16
|
-
RANGE_OVERFLOW: 'rangeOverflow',
|
|
17
|
-
RANGE_UNDERFLOW: 'rangeUnderflow',
|
|
18
|
-
TYPE_MISMATCH: 'typeMismatch',
|
|
19
|
-
VALUE_MISSING: 'valueMissing',
|
|
20
|
-
STEP_MISMATCH: 'stepMismatch',
|
|
21
|
-
FORMAT_MISMATCH: 'formatMismatch',
|
|
22
|
-
ACCEPT_MISMATCH: 'acceptMismatch',
|
|
23
|
-
FILE_SIZE_MISMATCH: 'fileSizeMismatch',
|
|
24
|
-
UNIQUE_ITEMS_MISMATCH: 'uniqueItemsMismatch',
|
|
25
|
-
MIN_ITEMS_MISMATCH: 'minItemsMismatch',
|
|
26
|
-
MAX_ITEMS_MISMATCH: 'maxItemsMismatch',
|
|
27
|
-
EXPRESSION_MISMATCH: 'expressionMismatch'
|
|
28
|
-
});
|
|
29
|
-
const constraintKeys = Object.freeze({
|
|
30
|
-
pattern: ConstraintType.PATTERN_MISMATCH,
|
|
31
|
-
minLength: ConstraintType.TOO_SHORT,
|
|
32
|
-
maxLength: ConstraintType.TOO_LONG,
|
|
33
|
-
maximum: ConstraintType.RANGE_OVERFLOW,
|
|
34
|
-
minimum: ConstraintType.RANGE_UNDERFLOW,
|
|
35
|
-
type: ConstraintType.TYPE_MISMATCH,
|
|
36
|
-
required: ConstraintType.VALUE_MISSING,
|
|
37
|
-
step: ConstraintType.STEP_MISMATCH,
|
|
38
|
-
format: ConstraintType.FORMAT_MISMATCH,
|
|
39
|
-
accept: ConstraintType.ACCEPT_MISMATCH,
|
|
40
|
-
maxFileSize: ConstraintType.FILE_SIZE_MISMATCH,
|
|
41
|
-
uniqueItems: ConstraintType.UNIQUE_ITEMS_MISMATCH,
|
|
42
|
-
minItems: ConstraintType.MIN_ITEMS_MISMATCH,
|
|
43
|
-
maxItems: ConstraintType.MAX_ITEMS_MISMATCH,
|
|
44
|
-
validationExpression: ConstraintType.EXPRESSION_MISMATCH
|
|
45
|
-
});
|
|
46
|
-
const defaultConstraintTypeMessages = Object.freeze({
|
|
47
|
-
[ConstraintType.PATTERN_MISMATCH]: 'Please match the format requested.',
|
|
48
|
-
[ConstraintType.TOO_SHORT]: 'Please lengthen this text to ${0} characters or more.',
|
|
49
|
-
[ConstraintType.TOO_LONG]: 'Please shorten this text to ${0} characters or less.',
|
|
50
|
-
[ConstraintType.RANGE_OVERFLOW]: 'Value must be less than or equal to ${0}.',
|
|
51
|
-
[ConstraintType.RANGE_UNDERFLOW]: 'Value must be greater than or equal to ${0}.',
|
|
52
|
-
[ConstraintType.TYPE_MISMATCH]: 'Please enter a valid value.',
|
|
53
|
-
[ConstraintType.VALUE_MISSING]: 'Please fill in this field.',
|
|
54
|
-
[ConstraintType.STEP_MISMATCH]: 'Please enter a valid value.',
|
|
55
|
-
[ConstraintType.FORMAT_MISMATCH]: 'Specify the value in allowed format : ${0}.',
|
|
56
|
-
[ConstraintType.ACCEPT_MISMATCH]: 'The specified file type not supported.',
|
|
57
|
-
[ConstraintType.FILE_SIZE_MISMATCH]: 'File too large. Reduce size and try again.',
|
|
58
|
-
[ConstraintType.UNIQUE_ITEMS_MISMATCH]: 'All the items must be unique.',
|
|
59
|
-
[ConstraintType.MIN_ITEMS_MISMATCH]: 'Specify a number of items equal to or greater than ${0}.',
|
|
60
|
-
[ConstraintType.MAX_ITEMS_MISMATCH]: 'Specify a number of items equal to or less than ${0}.',
|
|
61
|
-
[ConstraintType.EXPRESSION_MISMATCH]: 'Please enter a valid value.'
|
|
62
|
-
});
|
|
63
|
-
let customConstraintTypeMessages = {};
|
|
64
|
-
const getConstraintTypeMessages = () => {
|
|
65
|
-
return {
|
|
66
|
-
...defaultConstraintTypeMessages,
|
|
67
|
-
...customConstraintTypeMessages
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
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
12
|
const objToMap = (o) => new Map(Object.entries(o));
|
|
91
13
|
const stringViewTypes = objToMap({ 'date': 'date-input', 'data-url': 'file-input', 'binary': 'file-input' });
|
|
92
14
|
const typeToViewTypes = objToMap({
|
|
@@ -1221,6 +1143,7 @@ class BaseNode {
|
|
|
1221
1143
|
_dependents = [];
|
|
1222
1144
|
_jsonModel;
|
|
1223
1145
|
_tokens = [];
|
|
1146
|
+
_eventSource = EventSource.CODE;
|
|
1224
1147
|
get isContainer() {
|
|
1225
1148
|
return false;
|
|
1226
1149
|
}
|
|
@@ -3262,7 +3185,7 @@ class Form extends Container {
|
|
|
3262
3185
|
prevValue: shallowClone(prevValue)
|
|
3263
3186
|
};
|
|
3264
3187
|
});
|
|
3265
|
-
const fieldChangedAction = new FieldChanged(changes, field);
|
|
3188
|
+
const fieldChangedAction = new FieldChanged(changes, field, action.payload.eventSource);
|
|
3266
3189
|
this.notifyDependents(fieldChangedAction);
|
|
3267
3190
|
}
|
|
3268
3191
|
});
|
|
@@ -3587,6 +3510,9 @@ class Field extends Scriptable {
|
|
|
3587
3510
|
if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
|
|
3588
3511
|
this._jsonModel.value = undefined;
|
|
3589
3512
|
}
|
|
3513
|
+
else {
|
|
3514
|
+
this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
|
|
3515
|
+
}
|
|
3590
3516
|
const value = this._jsonModel.value;
|
|
3591
3517
|
if (value === undefined) {
|
|
3592
3518
|
const typedRes = Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
|
|
@@ -3807,7 +3733,7 @@ class Field extends Scriptable {
|
|
|
3807
3733
|
}
|
|
3808
3734
|
updateDataNodeAndTypedValue(val) {
|
|
3809
3735
|
const dataNode = this.getDataNode();
|
|
3810
|
-
if (staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
|
|
3736
|
+
if (staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined' && dataNode !== NullDataValue) {
|
|
3811
3737
|
return;
|
|
3812
3738
|
}
|
|
3813
3739
|
const Constraints = this._getConstraintObject();
|
|
@@ -3861,7 +3787,7 @@ class Field extends Scriptable {
|
|
|
3861
3787
|
if (updates.valid) {
|
|
3862
3788
|
this.triggerValidationEvent(updates);
|
|
3863
3789
|
}
|
|
3864
|
-
const changeAction = new Change({ changes: changes.concat(Object.values(updates)) });
|
|
3790
|
+
const changeAction = new Change({ changes: changes.concat(Object.values(updates)), eventSource: this._eventSource });
|
|
3865
3791
|
this.dispatch(changeAction);
|
|
3866
3792
|
}
|
|
3867
3793
|
}
|
|
@@ -4482,7 +4408,18 @@ class DateField extends Field {
|
|
|
4482
4408
|
}
|
|
4483
4409
|
}
|
|
4484
4410
|
else {
|
|
4485
|
-
|
|
4411
|
+
if (this._jsonModel.editFormat !== 'short' && this._jsonModel.editFormat !== 'date|short') {
|
|
4412
|
+
const date = parseDate(value, this.locale, this._jsonModel.editFormat);
|
|
4413
|
+
if (date !== null) {
|
|
4414
|
+
super.value = formatDate(date, this.locale, this._dataFormat);
|
|
4415
|
+
}
|
|
4416
|
+
else {
|
|
4417
|
+
super.value = value;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
else {
|
|
4421
|
+
super.value = value;
|
|
4422
|
+
}
|
|
4486
4423
|
}
|
|
4487
4424
|
}
|
|
4488
4425
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action, BaseJson, BaseModel, callbackFn, ContainerModel, FormCreationMode, FormModel, Primitives, ValidationError } from './types/index';
|
|
1
|
+
import { Action, BaseJson, BaseModel, callbackFn, ContainerModel, FormCreationMode, FormModel, Primitives, ValidationError, EventSource } from './types/index';
|
|
2
2
|
import DataGroup from './data/DataGroup';
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
export declare const editableProperties: string[];
|
|
@@ -19,6 +19,7 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
|
|
|
19
19
|
id: string;
|
|
20
20
|
};
|
|
21
21
|
private _tokens;
|
|
22
|
+
_eventSource: EventSource;
|
|
22
23
|
get isContainer(): boolean;
|
|
23
24
|
constructor(params: T, _options: {
|
|
24
25
|
form: FormModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError } from '../types/index';
|
|
1
|
+
import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError, EventSource } from '../types/index';
|
|
2
2
|
declare class ActionImpl implements Action {
|
|
3
3
|
private _metadata?;
|
|
4
4
|
protected _type: string;
|
|
@@ -26,6 +26,7 @@ export type ChangePayload = {
|
|
|
26
26
|
prevValue?: any;
|
|
27
27
|
currentValue: any;
|
|
28
28
|
}>;
|
|
29
|
+
eventSource?: EventSource;
|
|
29
30
|
};
|
|
30
31
|
export declare class Change extends ActionImpl {
|
|
31
32
|
constructor(payload: ChangePayload, dispatch?: boolean);
|
|
@@ -78,7 +79,7 @@ export declare class Reset extends ActionImpl {
|
|
|
78
79
|
constructor(payload?: any, dispatch?: boolean);
|
|
79
80
|
}
|
|
80
81
|
export declare class FieldChanged extends ActionImpl {
|
|
81
|
-
constructor(changes: ChangePayload, field: BaseJson);
|
|
82
|
+
constructor(changes: ChangePayload, field: BaseJson, eventSource?: EventSource);
|
|
82
83
|
}
|
|
83
84
|
export declare class CustomEvent extends ActionImpl {
|
|
84
85
|
constructor(eventName: string, payload?: any, dispatch?: boolean);
|
|
@@ -42,6 +42,10 @@ export interface WithController {
|
|
|
42
42
|
dispatch(action: Action): void;
|
|
43
43
|
}
|
|
44
44
|
export type FormCreationMode = 'create' | 'restore';
|
|
45
|
+
export declare enum EventSource {
|
|
46
|
+
CODE = "code",
|
|
47
|
+
UI = "ui"
|
|
48
|
+
}
|
|
45
49
|
export interface BaseModel extends ConstraintsJson, WithController {
|
|
46
50
|
readonly lang?: string;
|
|
47
51
|
readonly name?: string;
|
|
@@ -74,6 +78,7 @@ export interface BaseModel extends ConstraintsJson, WithController {
|
|
|
74
78
|
ruleNodeReference(): any;
|
|
75
79
|
_initialize(mode?: FormCreationMode): any;
|
|
76
80
|
_addDependent(dependent: BaseModel): any;
|
|
81
|
+
_eventSource: EventSource;
|
|
77
82
|
}
|
|
78
83
|
export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJson> {
|
|
79
84
|
parent: ContainerModel;
|
package/lib/BaseNode.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action, BaseJson, BaseModel, callbackFn, ContainerModel, FormCreationMode, FormModel, Primitives, ValidationError } from './types/index';
|
|
1
|
+
import { Action, BaseJson, BaseModel, callbackFn, ContainerModel, FormCreationMode, FormModel, Primitives, ValidationError, EventSource } from './types/index';
|
|
2
2
|
import DataGroup from './data/DataGroup';
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
export declare const editableProperties: string[];
|
|
@@ -19,6 +19,7 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
|
|
|
19
19
|
id: string;
|
|
20
20
|
};
|
|
21
21
|
private _tokens;
|
|
22
|
+
_eventSource: EventSource;
|
|
22
23
|
get isContainer(): boolean;
|
|
23
24
|
constructor(params: T, _options: {
|
|
24
25
|
form: FormModel;
|
package/lib/BaseNode.js
CHANGED
|
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BaseNode = exports.exclude = exports.include = exports.dependencyTracked = exports.qualifiedName = exports.target = exports.staticFields = exports.dynamicProps = exports.editableProperties = void 0;
|
|
13
|
+
const index_1 = require("./types/index");
|
|
13
14
|
const Events_1 = require("./controller/Events");
|
|
14
15
|
const DataRefParser_1 = require("./utils/DataRefParser");
|
|
15
16
|
const EmptyDataValue_1 = __importDefault(require("./data/EmptyDataValue"));
|
|
@@ -120,6 +121,7 @@ class BaseNode {
|
|
|
120
121
|
this._callbacks = {};
|
|
121
122
|
this._dependents = [];
|
|
122
123
|
this._tokens = [];
|
|
124
|
+
this._eventSource = index_1.EventSource.CODE;
|
|
123
125
|
this[exports.qualifiedName] = null;
|
|
124
126
|
this._jsonModel = Object.assign(Object.assign({}, params), { id: 'id' in params ? params.id : this.form.getUniqueId() });
|
|
125
127
|
}
|
package/lib/DateField.js
CHANGED
|
@@ -37,7 +37,18 @@ class DateField extends Field_1.default {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
|
|
40
|
+
if (this._jsonModel.editFormat !== 'short' && this._jsonModel.editFormat !== 'date|short') {
|
|
41
|
+
const date = (0, af_formatters_1.parseDate)(value, this.locale, this._jsonModel.editFormat);
|
|
42
|
+
if (date !== null) {
|
|
43
|
+
super.value = (0, af_formatters_1.formatDate)(date, this.locale, this._dataFormat);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
super.value = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
super.value = value;
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
}
|
package/lib/Field.js
CHANGED
|
@@ -111,6 +111,9 @@ class Field extends Scriptable_1.default {
|
|
|
111
111
|
if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
|
|
112
112
|
this._jsonModel.value = undefined;
|
|
113
113
|
}
|
|
114
|
+
else {
|
|
115
|
+
this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
|
|
116
|
+
}
|
|
114
117
|
const value = this._jsonModel.value;
|
|
115
118
|
if (value === undefined) {
|
|
116
119
|
const typedRes = ValidationUtils_1.Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
|
|
@@ -329,7 +332,7 @@ class Field extends Scriptable_1.default {
|
|
|
329
332
|
}
|
|
330
333
|
updateDataNodeAndTypedValue(val) {
|
|
331
334
|
const dataNode = this.getDataNode();
|
|
332
|
-
if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
|
|
335
|
+
if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined' && dataNode !== EmptyDataValue_1.default) {
|
|
333
336
|
return;
|
|
334
337
|
}
|
|
335
338
|
const Constraints = this._getConstraintObject();
|
|
@@ -379,7 +382,7 @@ class Field extends Scriptable_1.default {
|
|
|
379
382
|
if (updates.valid) {
|
|
380
383
|
this.triggerValidationEvent(updates);
|
|
381
384
|
}
|
|
382
|
-
const changeAction = new Events_1.Change({ changes: changes.concat(Object.values(updates)) });
|
|
385
|
+
const changeAction = new Events_1.Change({ changes: changes.concat(Object.values(updates)), eventSource: this._eventSource });
|
|
383
386
|
this.dispatch(changeAction);
|
|
384
387
|
}
|
|
385
388
|
}
|
package/lib/Form.js
CHANGED
|
@@ -225,7 +225,7 @@ class Form extends Container_1.default {
|
|
|
225
225
|
prevValue: shallowClone(prevValue)
|
|
226
226
|
};
|
|
227
227
|
});
|
|
228
|
-
const fieldChangedAction = new Events_1.FieldChanged(changes, field);
|
|
228
|
+
const fieldChangedAction = new Events_1.FieldChanged(changes, field, action.payload.eventSource);
|
|
229
229
|
this.notifyDependents(fieldChangedAction);
|
|
230
230
|
}
|
|
231
231
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError } from '../types/index';
|
|
1
|
+
import { Action, BaseJson, FieldModel, FieldsetModel, FormModel, ValidationError, EventSource } from '../types/index';
|
|
2
2
|
declare class ActionImpl implements Action {
|
|
3
3
|
private _metadata?;
|
|
4
4
|
protected _type: string;
|
|
@@ -26,6 +26,7 @@ export declare type ChangePayload = {
|
|
|
26
26
|
prevValue?: any;
|
|
27
27
|
currentValue: any;
|
|
28
28
|
}>;
|
|
29
|
+
eventSource?: EventSource;
|
|
29
30
|
};
|
|
30
31
|
export declare class Change extends ActionImpl {
|
|
31
32
|
constructor(payload: ChangePayload, dispatch?: boolean);
|
|
@@ -78,7 +79,7 @@ export declare class Reset extends ActionImpl {
|
|
|
78
79
|
constructor(payload?: any, dispatch?: boolean);
|
|
79
80
|
}
|
|
80
81
|
export declare class FieldChanged extends ActionImpl {
|
|
81
|
-
constructor(changes: ChangePayload, field: BaseJson);
|
|
82
|
+
constructor(changes: ChangePayload, field: BaseJson, eventSource?: EventSource);
|
|
82
83
|
}
|
|
83
84
|
export declare class CustomEvent extends ActionImpl {
|
|
84
85
|
constructor(eventName: string, payload?: any, dispatch?: boolean);
|
package/lib/controller/Events.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemoveInstance = exports.AddInstance = exports.RemoveItem = exports.AddItem = exports.CustomEvent = exports.FieldChanged = exports.Reset = exports.SubmitError = exports.SubmitFailure = exports.SubmitSuccess = exports.Save = exports.Submit = exports.Focus = exports.ValidationComplete = exports.Blur = exports.Click = exports.FormLoad = exports.Initialize = exports.propertyChange = exports.ExecuteRule = exports.Valid = exports.Invalid = exports.Change = void 0;
|
|
4
|
+
const index_1 = require("../types/index");
|
|
4
5
|
class ActionImpl {
|
|
5
6
|
constructor(payload, type, _metadata) {
|
|
6
7
|
this._metadata = _metadata;
|
|
@@ -151,10 +152,11 @@ class Reset extends ActionImpl {
|
|
|
151
152
|
}
|
|
152
153
|
exports.Reset = Reset;
|
|
153
154
|
class FieldChanged extends ActionImpl {
|
|
154
|
-
constructor(changes, field) {
|
|
155
|
+
constructor(changes, field, eventSource = index_1.EventSource.CODE) {
|
|
155
156
|
super({
|
|
156
157
|
field,
|
|
157
|
-
changes
|
|
158
|
+
changes,
|
|
159
|
+
eventSource
|
|
158
160
|
}, 'fieldChanged');
|
|
159
161
|
}
|
|
160
162
|
}
|
package/lib/types/Model.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export interface WithController {
|
|
|
42
42
|
dispatch(action: Action): void;
|
|
43
43
|
}
|
|
44
44
|
export declare type FormCreationMode = 'create' | 'restore';
|
|
45
|
+
export declare enum EventSource {
|
|
46
|
+
CODE = "code",
|
|
47
|
+
UI = "ui"
|
|
48
|
+
}
|
|
45
49
|
export interface BaseModel extends ConstraintsJson, WithController {
|
|
46
50
|
readonly lang?: string;
|
|
47
51
|
readonly name?: string;
|
|
@@ -74,6 +78,7 @@ export interface BaseModel extends ConstraintsJson, WithController {
|
|
|
74
78
|
ruleNodeReference(): any;
|
|
75
79
|
_initialize(mode?: FormCreationMode): any;
|
|
76
80
|
_addDependent(dependent: BaseModel): any;
|
|
81
|
+
_eventSource: EventSource;
|
|
77
82
|
}
|
|
78
83
|
export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJson> {
|
|
79
84
|
parent: ContainerModel;
|
package/lib/types/Model.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CaptchaDisplayMode = exports.FocusOption = exports.ValidationError = void 0;
|
|
3
|
+
exports.CaptchaDisplayMode = exports.FocusOption = exports.ValidationError = exports.EventSource = void 0;
|
|
4
|
+
var EventSource;
|
|
5
|
+
(function (EventSource) {
|
|
6
|
+
EventSource["CODE"] = "code";
|
|
7
|
+
EventSource["UI"] = "ui";
|
|
8
|
+
})(EventSource = exports.EventSource || (exports.EventSource = {}));
|
|
4
9
|
class ValidationError {
|
|
5
10
|
constructor(fieldName = '', errorMessages = []) {
|
|
6
11
|
this.errorMessages = errorMessages;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.91",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/json-formula": "0.1.50",
|
|
40
|
-
"@aemforms/af-formatters": "^0.22.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.91"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|