@aemforms/af-core 0.22.17 → 0.22.18
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/BaseNode.d.ts +11 -0
- package/lib/BaseNode.js +36 -8
- package/lib/CheckboxGroup.js +3 -0
- package/lib/Container.d.ts +22 -215
- package/lib/Container.js +6 -3
- package/lib/Field.d.ts +24 -8
- package/lib/Field.js +179 -13
- package/lib/FileObject.d.ts +3 -2
- package/lib/FileObject.js +6 -3
- package/lib/FileUpload.d.ts +2 -1
- package/lib/FileUpload.js +4 -1
- package/lib/Form.d.ts +35 -196
- package/lib/Scriptable.d.ts +1 -1
- package/lib/Scriptable.js +4 -4
- package/lib/types/Json.d.ts +3 -0
- package/lib/types/Model.d.ts +7 -6
- package/lib/utils/FormUtils.js +8 -5
- package/lib/utils/ValidationUtils.js +14 -0
- package/package.json +2 -2
package/lib/BaseNode.d.ts
CHANGED
|
@@ -9,9 +9,12 @@ export declare const editableProperties: string[];
|
|
|
9
9
|
* Defines props that are dynamic and can be changed at runtime.
|
|
10
10
|
*/
|
|
11
11
|
export declare const dynamicProps: string[];
|
|
12
|
+
export declare const staticFields: string[];
|
|
12
13
|
export declare const target: unique symbol;
|
|
13
14
|
export declare const qualifiedName: unique symbol;
|
|
14
15
|
export declare function dependencyTracked(): (target: BaseNode<any>, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
16
|
+
export declare const include: (...fieldTypes: string[]) => (target: BaseNode<any>, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
17
|
+
export declare const exclude: (...fieldTypes: string[]) => (target: BaseNode<any>, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
15
18
|
/**
|
|
16
19
|
* Defines a generic base class which all objects of form runtime model should extend from.
|
|
17
20
|
* @typeparam T type of the form object which extends from {@link BaseJson | base type}
|
|
@@ -69,6 +72,14 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
|
|
|
69
72
|
*/
|
|
70
73
|
isTransparent(): boolean;
|
|
71
74
|
getState(): T & {
|
|
75
|
+
properties: {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
};
|
|
78
|
+
index: number;
|
|
79
|
+
parent: undefined;
|
|
80
|
+
qualifiedName: any;
|
|
81
|
+
events: {};
|
|
82
|
+
rules: {};
|
|
72
83
|
':type': string;
|
|
73
84
|
id: string;
|
|
74
85
|
};
|
package/lib/BaseNode.js
CHANGED
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.BaseNode = exports.dependencyTracked = exports.qualifiedName = exports.target = exports.dynamicProps = exports.editableProperties = void 0;
|
|
19
|
+
exports.BaseNode = exports.exclude = exports.include = exports.dependencyTracked = exports.qualifiedName = exports.target = exports.staticFields = exports.dynamicProps = exports.editableProperties = void 0;
|
|
20
20
|
const controller_1 = require("./controller");
|
|
21
21
|
const DataRefParser_1 = require("./utils/DataRefParser");
|
|
22
22
|
const EmptyDataValue_1 = __importDefault(require("./data/EmptyDataValue"));
|
|
@@ -37,13 +37,13 @@ exports.editableProperties = [
|
|
|
37
37
|
// 'enforceEnum', // not exposed for now
|
|
38
38
|
'exclusiveMinimum',
|
|
39
39
|
'exclusiveMaximum',
|
|
40
|
-
'maxLength',
|
|
40
|
+
// 'maxLength',
|
|
41
41
|
'maximum',
|
|
42
42
|
'maxItems',
|
|
43
|
-
'minLength',
|
|
43
|
+
// 'minLength',
|
|
44
44
|
'minimum',
|
|
45
|
-
'minItems'
|
|
46
|
-
'step'
|
|
45
|
+
'minItems'
|
|
46
|
+
// 'step'
|
|
47
47
|
// 'placeholder' // not exposed for now.
|
|
48
48
|
];
|
|
49
49
|
/**
|
|
@@ -55,6 +55,7 @@ exports.dynamicProps = [
|
|
|
55
55
|
'index',
|
|
56
56
|
'activeChild'
|
|
57
57
|
];
|
|
58
|
+
exports.staticFields = ['plain-text', 'image'];
|
|
58
59
|
/**
|
|
59
60
|
* Implementation of action with target
|
|
60
61
|
* @private
|
|
@@ -107,6 +108,29 @@ function dependencyTracked() {
|
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
exports.dependencyTracked = dependencyTracked;
|
|
111
|
+
const addOnly = (includeOrExclude) => (...fieldTypes) => (target, propertyKey, descriptor) => {
|
|
112
|
+
const get = descriptor.get;
|
|
113
|
+
if (get != undefined) {
|
|
114
|
+
descriptor.get = function () {
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
if (fieldTypes.indexOf(this.fieldType) > -1 === includeOrExclude) {
|
|
117
|
+
return get.call(this);
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const set = descriptor.set;
|
|
123
|
+
if (set != undefined) {
|
|
124
|
+
descriptor.set = function (value) {
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
if (fieldTypes.indexOf(this.fieldType) > -1 === includeOrExclude) {
|
|
127
|
+
set.call(this, value);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.include = addOnly(true);
|
|
133
|
+
exports.exclude = addOnly(false);
|
|
110
134
|
/**
|
|
111
135
|
* Defines a generic base class which all objects of form runtime model should extend from.
|
|
112
136
|
* @typeparam T type of the form object which extends from {@link BaseJson | base type}
|
|
@@ -202,7 +226,10 @@ class BaseNode {
|
|
|
202
226
|
return this._jsonModel.id;
|
|
203
227
|
}
|
|
204
228
|
get index() {
|
|
205
|
-
|
|
229
|
+
if (this.parent) {
|
|
230
|
+
return this.parent.indexOf(this);
|
|
231
|
+
}
|
|
232
|
+
return 0;
|
|
206
233
|
}
|
|
207
234
|
get parent() {
|
|
208
235
|
return this._options.parent;
|
|
@@ -269,7 +296,7 @@ class BaseNode {
|
|
|
269
296
|
return !this._jsonModel.name && !isNonTransparent;
|
|
270
297
|
}
|
|
271
298
|
getState() {
|
|
272
|
-
return Object.assign(Object.assign({}, this._jsonModel), { ':type': this[':type'] });
|
|
299
|
+
return Object.assign(Object.assign({}, this._jsonModel), { properties: this.properties, index: this.index, parent: undefined, qualifiedName: this.qualifiedName, events: {}, rules: {}, ':type': this[':type'] });
|
|
273
300
|
}
|
|
274
301
|
/**
|
|
275
302
|
* @private
|
|
@@ -393,8 +420,9 @@ class BaseNode {
|
|
|
393
420
|
}
|
|
394
421
|
}
|
|
395
422
|
else { // name data binding
|
|
423
|
+
// static fields do not have name bindings
|
|
396
424
|
if ( //@ts-ignore
|
|
397
|
-
contextualDataModel !== EmptyDataValue_1.default) {
|
|
425
|
+
contextualDataModel !== EmptyDataValue_1.default && exports.staticFields.indexOf(this.fieldType) === -1) {
|
|
398
426
|
_parent = contextualDataModel;
|
|
399
427
|
const name = this._jsonModel.name || '';
|
|
400
428
|
const key = contextualDataModel.$type === 'array' ? this.index : name;
|
package/lib/CheckboxGroup.js
CHANGED
|
@@ -32,6 +32,9 @@ class CheckboxGroup extends Field_1.default {
|
|
|
32
32
|
if (typeof fallbackType === 'string') {
|
|
33
33
|
return `${fallbackType}[]`;
|
|
34
34
|
}
|
|
35
|
+
else {
|
|
36
|
+
return 'string[]';
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
_getDefaults() {
|
|
37
40
|
return Object.assign(Object.assign({}, super._getDefaults()), { enforceEnum: true, enum: [] });
|
package/lib/Container.d.ts
CHANGED
|
@@ -35,8 +35,10 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
35
35
|
* Returns the current container state
|
|
36
36
|
*/
|
|
37
37
|
getState(): T & {
|
|
38
|
-
':type': string;
|
|
39
38
|
items: ({
|
|
39
|
+
id: string;
|
|
40
|
+
index: number;
|
|
41
|
+
':type': string;
|
|
40
42
|
description?: string | undefined;
|
|
41
43
|
rules?: import("./types").Items<string> | undefined;
|
|
42
44
|
events?: import("./types").Items<string | string[] | undefined> | undefined;
|
|
@@ -64,7 +66,6 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
64
66
|
validationExpression?: string | undefined;
|
|
65
67
|
uniqueItems?: boolean | undefined;
|
|
66
68
|
dataRef?: string | null | undefined;
|
|
67
|
-
':type': string;
|
|
68
69
|
label?: import("./types").Label | undefined;
|
|
69
70
|
enabled?: boolean | undefined;
|
|
70
71
|
visible?: boolean | undefined;
|
|
@@ -77,6 +78,9 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
77
78
|
properties?: {
|
|
78
79
|
[key: string]: any;
|
|
79
80
|
} | undefined;
|
|
81
|
+
screenReaderText?: string | undefined;
|
|
82
|
+
tooltip?: string | undefined;
|
|
83
|
+
altText?: string | undefined;
|
|
80
84
|
placeholder?: string | undefined;
|
|
81
85
|
readOnly?: boolean | undefined;
|
|
82
86
|
valid?: boolean | undefined;
|
|
@@ -87,8 +91,10 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
87
91
|
editValue?: string | undefined;
|
|
88
92
|
displayValue?: string | undefined;
|
|
89
93
|
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
90
|
-
id: string;
|
|
91
94
|
} | {
|
|
95
|
+
id: string;
|
|
96
|
+
index: number;
|
|
97
|
+
':type': string;
|
|
92
98
|
description?: string | undefined;
|
|
93
99
|
rules?: import("./types").Items<string> | undefined;
|
|
94
100
|
events?: import("./types").Items<string | string[] | undefined> | undefined;
|
|
@@ -116,7 +122,6 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
116
122
|
validationExpression?: string | undefined;
|
|
117
123
|
uniqueItems?: boolean | undefined;
|
|
118
124
|
dataRef?: string | null | undefined;
|
|
119
|
-
':type'?: string | undefined;
|
|
120
125
|
label?: import("./types").Label | undefined;
|
|
121
126
|
enabled?: boolean | undefined;
|
|
122
127
|
visible?: boolean | undefined;
|
|
@@ -129,220 +134,22 @@ declare abstract class Container<T extends ContainerJson & RulesJson> extends Sc
|
|
|
129
134
|
properties?: {
|
|
130
135
|
[key: string]: any;
|
|
131
136
|
} | undefined;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
enum?: any[] | undefined;
|
|
137
|
-
} & {
|
|
138
|
-
accept?: string[] | undefined;
|
|
139
|
-
enforceEnum?: boolean | undefined;
|
|
140
|
-
exclusiveMinimum?: number | undefined;
|
|
141
|
-
exclusiveMaximum?: number | undefined;
|
|
142
|
-
format?: string | undefined;
|
|
143
|
-
maxFileSize?: string | number | undefined;
|
|
144
|
-
maxLength?: number | undefined;
|
|
145
|
-
maximum?: number | undefined;
|
|
146
|
-
maxItems?: number | undefined;
|
|
147
|
-
minLength?: number | undefined;
|
|
148
|
-
minimum?: number | undefined;
|
|
149
|
-
minItems?: number | undefined;
|
|
150
|
-
pattern?: string | undefined;
|
|
151
|
-
required?: boolean | undefined;
|
|
152
|
-
/**
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
step?: number | undefined;
|
|
156
|
-
type?: string | undefined;
|
|
157
|
-
validationExpression?: string | undefined;
|
|
158
|
-
uniqueItems?: boolean | undefined;
|
|
159
|
-
} & {
|
|
160
|
-
dataRef?: string | null | undefined;
|
|
161
|
-
':type'?: string | undefined;
|
|
162
|
-
label?: import("./types").Label | undefined;
|
|
163
|
-
enabled?: boolean | undefined;
|
|
164
|
-
visible?: boolean | undefined;
|
|
165
|
-
name?: string | undefined;
|
|
166
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
167
|
-
fieldType?: string | undefined; /**
|
|
168
|
-
* Returns the current container state
|
|
169
|
-
*/
|
|
170
|
-
errorMessage?: string | undefined;
|
|
171
|
-
properties?: {
|
|
172
|
-
[key: string]: any;
|
|
173
|
-
} | undefined;
|
|
174
|
-
} & {
|
|
175
|
-
placeholder?: string | undefined;
|
|
176
|
-
} & {
|
|
177
|
-
readOnly?: boolean | undefined;
|
|
178
|
-
valid?: boolean | undefined;
|
|
179
|
-
default?: any;
|
|
180
|
-
value?: any;
|
|
181
|
-
displayFormat?: string | undefined;
|
|
182
|
-
editFormat?: string | undefined;
|
|
183
|
-
editValue?: string | undefined;
|
|
184
|
-
displayValue?: string | undefined;
|
|
185
|
-
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
186
|
-
} & {
|
|
187
|
-
id: string;
|
|
188
|
-
':type': string;
|
|
189
|
-
}) | ({
|
|
190
|
-
description?: string | undefined;
|
|
191
|
-
} & RulesJson & {
|
|
192
|
-
enumNames?: string[] | undefined;
|
|
193
|
-
enum?: any[] | undefined;
|
|
194
|
-
} & {
|
|
195
|
-
accept?: string[] | undefined;
|
|
196
|
-
enforceEnum?: boolean | undefined;
|
|
197
|
-
exclusiveMinimum?: number | undefined;
|
|
198
|
-
exclusiveMaximum?: number | undefined;
|
|
199
|
-
format?: string | undefined;
|
|
200
|
-
maxFileSize?: string | number | undefined;
|
|
201
|
-
maxLength?: number | undefined;
|
|
202
|
-
maximum?: number | undefined;
|
|
203
|
-
maxItems?: number | undefined;
|
|
204
|
-
minLength?: number | undefined;
|
|
205
|
-
minimum?: number | undefined;
|
|
206
|
-
minItems?: number | undefined;
|
|
207
|
-
pattern?: string | undefined;
|
|
208
|
-
required?: boolean | undefined;
|
|
209
|
-
/**
|
|
210
|
-
* @private
|
|
211
|
-
*/
|
|
212
|
-
step?: number | undefined;
|
|
213
|
-
type?: string | undefined;
|
|
214
|
-
validationExpression?: string | undefined;
|
|
215
|
-
uniqueItems?: boolean | undefined;
|
|
216
|
-
} & {
|
|
217
|
-
dataRef?: string | null | undefined;
|
|
218
|
-
':type'?: string | undefined;
|
|
219
|
-
label?: import("./types").Label | undefined;
|
|
220
|
-
enabled?: boolean | undefined;
|
|
221
|
-
visible?: boolean | undefined;
|
|
222
|
-
name?: string | undefined;
|
|
223
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
224
|
-
fieldType?: string | undefined; /**
|
|
225
|
-
* Returns the current container state
|
|
226
|
-
*/
|
|
227
|
-
errorMessage?: string | undefined;
|
|
228
|
-
properties?: {
|
|
229
|
-
[key: string]: any;
|
|
230
|
-
} | undefined;
|
|
231
|
-
} & {
|
|
232
|
-
items: (FieldJson | ContainerJson)[];
|
|
233
|
-
initialItems?: number | undefined;
|
|
234
|
-
activeChild?: string | undefined;
|
|
235
|
-
} & {
|
|
236
|
-
id: string;
|
|
237
|
-
items: (({
|
|
238
|
-
description?: string | undefined;
|
|
239
|
-
} & RulesJson & {
|
|
240
|
-
enumNames?: string[] | undefined;
|
|
241
|
-
enum?: any[] | undefined;
|
|
242
|
-
} & {
|
|
243
|
-
accept?: string[] | undefined;
|
|
244
|
-
enforceEnum?: boolean | undefined;
|
|
245
|
-
exclusiveMinimum?: number | undefined;
|
|
246
|
-
exclusiveMaximum?: number | undefined;
|
|
247
|
-
format?: string | undefined;
|
|
248
|
-
maxFileSize?: string | number | undefined;
|
|
249
|
-
maxLength?: number | undefined;
|
|
250
|
-
maximum?: number | undefined;
|
|
251
|
-
maxItems?: number | undefined;
|
|
252
|
-
minLength?: number | undefined;
|
|
253
|
-
minimum?: number | undefined;
|
|
254
|
-
minItems?: number | undefined;
|
|
255
|
-
pattern?: string | undefined;
|
|
256
|
-
required?: boolean | undefined;
|
|
257
|
-
/**
|
|
258
|
-
* @private
|
|
259
|
-
*/
|
|
260
|
-
step?: number | undefined;
|
|
261
|
-
type?: string | undefined;
|
|
262
|
-
validationExpression?: string | undefined;
|
|
263
|
-
uniqueItems?: boolean | undefined;
|
|
264
|
-
} & {
|
|
265
|
-
dataRef?: string | null | undefined;
|
|
266
|
-
':type'?: string | undefined;
|
|
267
|
-
label?: import("./types").Label | undefined;
|
|
268
|
-
enabled?: boolean | undefined;
|
|
269
|
-
visible?: boolean | undefined;
|
|
270
|
-
name?: string | undefined;
|
|
271
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
272
|
-
fieldType?: string | undefined; /**
|
|
273
|
-
* Returns the current container state
|
|
274
|
-
*/
|
|
275
|
-
errorMessage?: string | undefined;
|
|
276
|
-
properties?: {
|
|
277
|
-
[key: string]: any;
|
|
278
|
-
} | undefined;
|
|
279
|
-
} & {
|
|
280
|
-
placeholder?: string | undefined;
|
|
281
|
-
} & {
|
|
282
|
-
readOnly?: boolean | undefined;
|
|
283
|
-
valid?: boolean | undefined;
|
|
284
|
-
default?: any;
|
|
285
|
-
value?: any;
|
|
286
|
-
displayFormat?: string | undefined;
|
|
287
|
-
editFormat?: string | undefined;
|
|
288
|
-
editValue?: string | undefined;
|
|
289
|
-
displayValue?: string | undefined;
|
|
290
|
-
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
291
|
-
} & {
|
|
292
|
-
id: string;
|
|
293
|
-
':type': string;
|
|
294
|
-
}) | ({
|
|
295
|
-
description?: string | undefined;
|
|
296
|
-
} & RulesJson & {
|
|
297
|
-
enumNames?: string[] | undefined;
|
|
298
|
-
enum?: any[] | undefined;
|
|
299
|
-
} & {
|
|
300
|
-
accept?: string[] | undefined;
|
|
301
|
-
enforceEnum?: boolean | undefined;
|
|
302
|
-
exclusiveMinimum?: number | undefined;
|
|
303
|
-
exclusiveMaximum?: number | undefined;
|
|
304
|
-
format?: string | undefined;
|
|
305
|
-
maxFileSize?: string | number | undefined;
|
|
306
|
-
maxLength?: number | undefined;
|
|
307
|
-
maximum?: number | undefined;
|
|
308
|
-
maxItems?: number | undefined;
|
|
309
|
-
minLength?: number | undefined;
|
|
310
|
-
minimum?: number | undefined;
|
|
311
|
-
minItems?: number | undefined;
|
|
312
|
-
pattern?: string | undefined;
|
|
313
|
-
required?: boolean | undefined;
|
|
314
|
-
/**
|
|
315
|
-
* @private
|
|
316
|
-
*/
|
|
317
|
-
step?: number | undefined;
|
|
318
|
-
type?: string | undefined;
|
|
319
|
-
validationExpression?: string | undefined;
|
|
320
|
-
uniqueItems?: boolean | undefined;
|
|
321
|
-
} & {
|
|
322
|
-
dataRef?: string | null | undefined;
|
|
323
|
-
':type'?: string | undefined;
|
|
324
|
-
label?: import("./types").Label | undefined;
|
|
325
|
-
enabled?: boolean | undefined;
|
|
326
|
-
visible?: boolean | undefined;
|
|
327
|
-
name?: string | undefined;
|
|
328
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
329
|
-
fieldType?: string | undefined; /**
|
|
330
|
-
* Returns the current container state
|
|
331
|
-
*/
|
|
332
|
-
errorMessage?: string | undefined;
|
|
333
|
-
properties?: {
|
|
334
|
-
[key: string]: any;
|
|
335
|
-
} | undefined;
|
|
336
|
-
} & {
|
|
337
|
-
items: (FieldJson | ContainerJson)[];
|
|
338
|
-
initialItems?: number | undefined;
|
|
339
|
-
activeChild?: string | undefined;
|
|
340
|
-
} & any))[];
|
|
341
|
-
}))[];
|
|
137
|
+
screenReaderText?: string | undefined;
|
|
138
|
+
tooltip?: string | undefined;
|
|
139
|
+
altText?: string | undefined;
|
|
140
|
+
items: (FieldJson | ContainerJson)[] & import("./types").State<FieldJson | ContainerJson>[];
|
|
342
141
|
initialItems?: number | undefined;
|
|
343
142
|
activeChild?: string | undefined;
|
|
344
|
-
id: string;
|
|
345
143
|
})[];
|
|
144
|
+
properties: {
|
|
145
|
+
[key: string]: any;
|
|
146
|
+
};
|
|
147
|
+
index: number;
|
|
148
|
+
parent: undefined;
|
|
149
|
+
qualifiedName: any;
|
|
150
|
+
events: {};
|
|
151
|
+
rules: {};
|
|
152
|
+
':type': string;
|
|
346
153
|
id: string;
|
|
347
154
|
};
|
|
348
155
|
protected abstract _createChild(child: FieldsetJson | FieldJson): FieldModel | FieldsetModel;
|
package/lib/Container.js
CHANGED
|
@@ -75,7 +75,7 @@ class Container extends Scriptable_1.default {
|
|
|
75
75
|
* Returns the current container state
|
|
76
76
|
*/
|
|
77
77
|
getState() {
|
|
78
|
-
return Object.assign(Object.assign({},
|
|
78
|
+
return Object.assign(Object.assign({}, super.getState()), { items: this._children.map(x => {
|
|
79
79
|
return Object.assign({}, x.getState());
|
|
80
80
|
}) });
|
|
81
81
|
}
|
|
@@ -154,7 +154,7 @@ class Container extends Scriptable_1.default {
|
|
|
154
154
|
*/
|
|
155
155
|
_initialize() {
|
|
156
156
|
super._initialize();
|
|
157
|
-
const items = this._jsonModel.items;
|
|
157
|
+
const items = this._jsonModel.items || [];
|
|
158
158
|
this._jsonModel.items = [];
|
|
159
159
|
this._childrenReference = this._jsonModel.type == 'array' ? [] : {};
|
|
160
160
|
if (this._jsonModel.type == 'array' && items.length === 1 && this.getDataNode() != null) {
|
|
@@ -183,6 +183,9 @@ class Container extends Scriptable_1.default {
|
|
|
183
183
|
this._jsonModel.maxItems = this._children.length;
|
|
184
184
|
this._jsonModel.initialItems = this._children.length;
|
|
185
185
|
}
|
|
186
|
+
else {
|
|
187
|
+
this.form.logger.warn('A container exists with no items.');
|
|
188
|
+
}
|
|
186
189
|
this.setupRuleNode();
|
|
187
190
|
}
|
|
188
191
|
/**
|
|
@@ -203,7 +206,7 @@ class Container extends Scriptable_1.default {
|
|
|
203
206
|
dataNode.$addDataNode(index, _data);
|
|
204
207
|
}
|
|
205
208
|
retVal._initialize();
|
|
206
|
-
this.notifyDependents((0, controller_1.propertyChange)('items', retVal.getState, null));
|
|
209
|
+
this.notifyDependents((0, controller_1.propertyChange)('items', retVal.getState(), null));
|
|
207
210
|
retVal.dispatch(new controller_1.Initialize());
|
|
208
211
|
retVal.dispatch(new controller_1.ExecuteRule());
|
|
209
212
|
for (let i = index + 1; i < this._children.length; i++) {
|
package/lib/Field.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ import { ConstraintsMessages, ContainerModel, FieldJson, FieldModel, FormModel,
|
|
|
2
2
|
import Scriptable from './Scriptable';
|
|
3
3
|
import DataValue from './data/DataValue';
|
|
4
4
|
import DataGroup from './data/DataGroup';
|
|
5
|
-
/**
|
|
6
|
-
* Defines a form object field which implements {@link FieldModel | field model} interface
|
|
7
|
-
*/
|
|
8
5
|
declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
9
6
|
/**
|
|
10
7
|
* @param params
|
|
@@ -73,6 +70,8 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
73
70
|
* @param constraint
|
|
74
71
|
*/
|
|
75
72
|
getErrorMessage(constraint: keyof (ConstraintsMessages)): string;
|
|
73
|
+
get errorMessage(): string | undefined;
|
|
74
|
+
get screenReaderText(): string | undefined;
|
|
76
75
|
/**
|
|
77
76
|
*
|
|
78
77
|
* @private
|
|
@@ -176,7 +175,18 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
176
175
|
/**
|
|
177
176
|
* returns the format constraint
|
|
178
177
|
*/
|
|
179
|
-
get format(): string;
|
|
178
|
+
get format(): string | undefined;
|
|
179
|
+
get enforceEnum(): boolean | undefined;
|
|
180
|
+
get tooltip(): string | undefined;
|
|
181
|
+
get maxLength(): number | undefined;
|
|
182
|
+
get minLength(): number | undefined;
|
|
183
|
+
get pattern(): string | undefined;
|
|
184
|
+
get step(): number | undefined;
|
|
185
|
+
get exclusiveMinimum(): number | undefined;
|
|
186
|
+
set exclusiveMinimum(eM: number | undefined);
|
|
187
|
+
get exclusiveMaximum(): number | undefined;
|
|
188
|
+
set exclusiveMaximum(eM: number | undefined);
|
|
189
|
+
get default(): any;
|
|
180
190
|
/**
|
|
181
191
|
* @private
|
|
182
192
|
*/
|
|
@@ -196,8 +206,8 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
196
206
|
editValue: any;
|
|
197
207
|
displayValue: any;
|
|
198
208
|
description?: string | undefined;
|
|
199
|
-
rules
|
|
200
|
-
events
|
|
209
|
+
rules: import("./types").Items<string> & {};
|
|
210
|
+
events: import("./types").Items<string | string[] | undefined> & {};
|
|
201
211
|
enumNames?: string[] | undefined;
|
|
202
212
|
enum?: any[] | undefined;
|
|
203
213
|
accept?: string[] | undefined;
|
|
@@ -227,9 +237,12 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
227
237
|
constraintMessages?: ConstraintsMessages | undefined;
|
|
228
238
|
fieldType?: string | undefined;
|
|
229
239
|
errorMessage?: string | undefined;
|
|
230
|
-
properties
|
|
240
|
+
properties: {
|
|
231
241
|
[key: string]: any;
|
|
232
|
-
}
|
|
242
|
+
};
|
|
243
|
+
screenReaderText?: string | undefined;
|
|
244
|
+
tooltip?: string | undefined;
|
|
245
|
+
altText?: string | undefined;
|
|
233
246
|
placeholder?: string | undefined;
|
|
234
247
|
readOnly?: boolean | undefined;
|
|
235
248
|
valid?: boolean | undefined;
|
|
@@ -238,6 +251,9 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
|
|
|
238
251
|
displayFormat?: string | undefined;
|
|
239
252
|
editFormat?: string | undefined;
|
|
240
253
|
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
254
|
+
index: number;
|
|
255
|
+
parent: undefined;
|
|
256
|
+
qualifiedName: any;
|
|
241
257
|
id: string;
|
|
242
258
|
};
|
|
243
259
|
}
|