@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/Field.js
CHANGED
|
@@ -28,6 +28,7 @@ const af_formatters_1 = require("@aemforms/af-formatters");
|
|
|
28
28
|
/**
|
|
29
29
|
* Defines a form object field which implements {@link FieldModel | field model} interface
|
|
30
30
|
*/
|
|
31
|
+
const validTypes = ['string', 'number', 'boolean', 'file', 'string[]', 'number[]', 'boolean[]', 'file[]', 'array', 'object'];
|
|
31
32
|
class Field extends Scriptable_1.default {
|
|
32
33
|
/**
|
|
33
34
|
* @param params
|
|
@@ -73,10 +74,31 @@ class Field extends Scriptable_1.default {
|
|
|
73
74
|
*/
|
|
74
75
|
_getFallbackType() {
|
|
75
76
|
const type = this._jsonModel.type;
|
|
76
|
-
|
|
77
|
+
let finalType = type;
|
|
78
|
+
if (typeof type !== 'string' || validTypes.indexOf(type) === -1) {
|
|
77
79
|
const _enum = this.enum;
|
|
78
|
-
|
|
80
|
+
finalType = typeof (_enum === null || _enum === void 0 ? void 0 : _enum[0]);
|
|
81
|
+
if (finalType === 'undefined' && typeof this._jsonModel.default !== 'undefined') {
|
|
82
|
+
if (this._jsonModel.default instanceof Array && this._jsonModel.default.length > 0) {
|
|
83
|
+
finalType = `${typeof (this._jsonModel.default[0])}[]`;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
finalType = typeof (this._jsonModel.default);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (finalType.indexOf('undefined') === 0) {
|
|
90
|
+
const typeMappings = {
|
|
91
|
+
'text-input': 'string',
|
|
92
|
+
'number-input': 'number',
|
|
93
|
+
'date-input': 'string',
|
|
94
|
+
'plain-text': 'string',
|
|
95
|
+
'image': 'string',
|
|
96
|
+
'checkbox': 'boolean'
|
|
97
|
+
};
|
|
98
|
+
finalType = typeMappings[this.fieldType];
|
|
99
|
+
}
|
|
79
100
|
}
|
|
101
|
+
return finalType;
|
|
80
102
|
}
|
|
81
103
|
_applyDefaults() {
|
|
82
104
|
Object.entries(this._getDefaults()).map(([key, value]) => {
|
|
@@ -86,12 +108,23 @@ class Field extends Scriptable_1.default {
|
|
|
86
108
|
this._jsonModel[key] = value;
|
|
87
109
|
}
|
|
88
110
|
});
|
|
111
|
+
const type = this._jsonModel.type;
|
|
112
|
+
if (typeof type !== 'string' || validTypes.indexOf(type) === -1) {
|
|
113
|
+
this._jsonModel.type = this._getFallbackType();
|
|
114
|
+
}
|
|
115
|
+
if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
|
|
116
|
+
this._jsonModel.value = undefined;
|
|
117
|
+
}
|
|
89
118
|
const value = this._jsonModel.value;
|
|
90
119
|
if (value === undefined) {
|
|
91
120
|
const typedRes = ValidationUtils_1.Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
|
|
92
121
|
this._jsonModel.value = typedRes.value;
|
|
93
122
|
}
|
|
123
|
+
if (this._jsonModel.type !== 'string') {
|
|
124
|
+
this._jsonModel.emptyValue = undefined;
|
|
125
|
+
}
|
|
94
126
|
if (this._jsonModel.fieldType === undefined) {
|
|
127
|
+
this.form.logger.error('fieldType property is mandatory. Please ensure all the fields have a fieldType');
|
|
95
128
|
//@ts-ignore
|
|
96
129
|
if (this._jsonModel.viewType) {
|
|
97
130
|
//@ts-ignore
|
|
@@ -114,7 +147,39 @@ class Field extends Scriptable_1.default {
|
|
|
114
147
|
this._jsonModel.enum = [true, false];
|
|
115
148
|
}
|
|
116
149
|
}
|
|
117
|
-
|
|
150
|
+
else {
|
|
151
|
+
if (typeof this._jsonModel.enumNames === 'undefined') {
|
|
152
|
+
this._jsonModel.enumNames = this._jsonModel.enum.map(_ => _.toString());
|
|
153
|
+
}
|
|
154
|
+
while (this._jsonModel.enumNames.length < this._jsonModel.enum.length) {
|
|
155
|
+
//@ts-ignore
|
|
156
|
+
this._jsonModel.enumNames.push(this._jsonModel.enum[this._jsonModel.enumNames.length].toString());
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (this._jsonModel.type !== 'string') {
|
|
160
|
+
this._jsonModel.format = undefined;
|
|
161
|
+
this._jsonModel.pattern = undefined;
|
|
162
|
+
this._jsonModel.minLength = undefined;
|
|
163
|
+
this._jsonModel.maxLength = undefined;
|
|
164
|
+
}
|
|
165
|
+
else if (this._jsonModel.fieldType === 'date-input') {
|
|
166
|
+
this._jsonModel.format = 'date';
|
|
167
|
+
}
|
|
168
|
+
if (this._jsonModel.type !== 'number' && this._jsonModel.format !== 'date') {
|
|
169
|
+
this._jsonModel.step = undefined;
|
|
170
|
+
this._jsonModel.minimum = undefined;
|
|
171
|
+
this._jsonModel.maximum = undefined;
|
|
172
|
+
this._jsonModel.exclusiveMinimum = undefined;
|
|
173
|
+
this._jsonModel.exclusiveMaximum = undefined;
|
|
174
|
+
}
|
|
175
|
+
['minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum'].forEach(c => {
|
|
176
|
+
//@ts-ignore
|
|
177
|
+
if (typeof this._jsonModel[c] !== this._jsonModel.type) {
|
|
178
|
+
//@ts-ignore
|
|
179
|
+
this._jsonModel[c] = undefined;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
if (typeof this._jsonModel.step !== 'number') {
|
|
118
183
|
this._jsonModel.step = undefined;
|
|
119
184
|
}
|
|
120
185
|
}
|
|
@@ -176,16 +241,24 @@ class Field extends Scriptable_1.default {
|
|
|
176
241
|
this._setProperty('required', r);
|
|
177
242
|
}
|
|
178
243
|
get maximum() {
|
|
179
|
-
|
|
244
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
245
|
+
return this._jsonModel.maximum;
|
|
246
|
+
}
|
|
180
247
|
}
|
|
181
248
|
set maximum(m) {
|
|
182
|
-
this.
|
|
249
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
250
|
+
this._setProperty('maximum', m);
|
|
251
|
+
}
|
|
183
252
|
}
|
|
184
253
|
get minimum() {
|
|
185
|
-
|
|
254
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
255
|
+
return this._jsonModel.minimum;
|
|
256
|
+
}
|
|
186
257
|
}
|
|
187
258
|
set minimum(m) {
|
|
188
|
-
this.
|
|
259
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
260
|
+
this._setProperty('minimum', m);
|
|
261
|
+
}
|
|
189
262
|
}
|
|
190
263
|
/**
|
|
191
264
|
* returns whether the value is empty. Empty value is either a '', undefined or null
|
|
@@ -224,13 +297,17 @@ class Field extends Scriptable_1.default {
|
|
|
224
297
|
}
|
|
225
298
|
}
|
|
226
299
|
set value(v) {
|
|
300
|
+
const dataNode = this.getDataNode();
|
|
301
|
+
if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
|
|
302
|
+
// if a static field is bound to data node it can not be updated.
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
227
305
|
const Constraints = this._getConstraintObject();
|
|
228
306
|
const typeRes = Constraints.type(this.getInternalType() || 'string', v);
|
|
229
307
|
const changes = this._setProperty('value', typeRes.value, false);
|
|
230
308
|
let uniqueRes = { valid: true };
|
|
231
309
|
if (changes.length > 0) {
|
|
232
310
|
this._updateRuleNodeReference(typeRes.value);
|
|
233
|
-
const dataNode = this.getDataNode();
|
|
234
311
|
if (typeof dataNode !== 'undefined') {
|
|
235
312
|
dataNode.setValue(this.getDataNodeValue(this._jsonModel.value), this._jsonModel.value, this);
|
|
236
313
|
}
|
|
@@ -299,6 +376,12 @@ class Field extends Scriptable_1.default {
|
|
|
299
376
|
var _a;
|
|
300
377
|
return ((_a = this._jsonModel.constraintMessages) === null || _a === void 0 ? void 0 : _a[constraint]) || '';
|
|
301
378
|
}
|
|
379
|
+
get errorMessage() {
|
|
380
|
+
return this._jsonModel.errorMessage;
|
|
381
|
+
}
|
|
382
|
+
get screenReaderText() {
|
|
383
|
+
return this._jsonModel.screenReaderText;
|
|
384
|
+
}
|
|
302
385
|
/**
|
|
303
386
|
*
|
|
304
387
|
* @private
|
|
@@ -388,7 +471,62 @@ class Field extends Scriptable_1.default {
|
|
|
388
471
|
* returns the format constraint
|
|
389
472
|
*/
|
|
390
473
|
get format() {
|
|
391
|
-
|
|
474
|
+
if (typeof this._jsonModel.format === 'undefined') {
|
|
475
|
+
if (this.type === 'string') {
|
|
476
|
+
switch (this.fieldType) {
|
|
477
|
+
case 'date-input':
|
|
478
|
+
this._jsonModel.format = 'date';
|
|
479
|
+
break;
|
|
480
|
+
case 'file-input':
|
|
481
|
+
this._jsonModel.format = 'data-url';
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return this._jsonModel.format;
|
|
487
|
+
}
|
|
488
|
+
get enforceEnum() {
|
|
489
|
+
return this._jsonModel.enforceEnum;
|
|
490
|
+
}
|
|
491
|
+
get tooltip() {
|
|
492
|
+
return this._jsonModel.tooltip;
|
|
493
|
+
}
|
|
494
|
+
get maxLength() {
|
|
495
|
+
return this._jsonModel.maxLength;
|
|
496
|
+
}
|
|
497
|
+
get minLength() {
|
|
498
|
+
return this._jsonModel.minLength;
|
|
499
|
+
}
|
|
500
|
+
get pattern() {
|
|
501
|
+
return this._jsonModel.pattern;
|
|
502
|
+
}
|
|
503
|
+
get step() {
|
|
504
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
505
|
+
return this._jsonModel.step;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
get exclusiveMinimum() {
|
|
509
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
510
|
+
return this._jsonModel.exclusiveMinimum;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
set exclusiveMinimum(eM) {
|
|
514
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
515
|
+
this._jsonModel.exclusiveMinimum = eM;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
get exclusiveMaximum() {
|
|
519
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
520
|
+
return this._jsonModel.exclusiveMaximum;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
set exclusiveMaximum(eM) {
|
|
524
|
+
if (this.type === 'number' || this.format === 'date') {
|
|
525
|
+
this._jsonModel.exclusiveMaximum = eM;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
get default() {
|
|
529
|
+
return this._jsonModel.default;
|
|
392
530
|
}
|
|
393
531
|
/**
|
|
394
532
|
* @private
|
|
@@ -407,7 +545,8 @@ class Field extends Scriptable_1.default {
|
|
|
407
545
|
}
|
|
408
546
|
if (valid && value != this.emptyValue) {
|
|
409
547
|
const invalidConstraint = supportedConstraints.find(key => {
|
|
410
|
-
|
|
548
|
+
// @ts-ignore
|
|
549
|
+
if (key in elem && elem[key] !== undefined) {
|
|
411
550
|
// @ts-ignore
|
|
412
551
|
const restriction = elem[key];
|
|
413
552
|
// @ts-ignore
|
|
@@ -494,17 +633,20 @@ class Field extends Scriptable_1.default {
|
|
|
494
633
|
* @private
|
|
495
634
|
*/
|
|
496
635
|
defaultDataModel(name) {
|
|
497
|
-
|
|
636
|
+
const value = BaseNode_1.staticFields.indexOf(this.fieldType) > -1 ? undefined : this.getDataNodeValue(this._jsonModel.value);
|
|
637
|
+
return new DataValue_1.default(name, value, this.type || 'string');
|
|
498
638
|
}
|
|
499
639
|
getState() {
|
|
500
640
|
return Object.assign(Object.assign({}, super.getState()), { editValue: this.editValue, displayValue: this.displayValue });
|
|
501
641
|
}
|
|
502
642
|
}
|
|
503
643
|
__decorate([
|
|
504
|
-
(0, BaseNode_1.dependencyTracked)()
|
|
644
|
+
(0, BaseNode_1.dependencyTracked)(),
|
|
645
|
+
(0, BaseNode_1.exclude)('button', 'image', 'plain-text')
|
|
505
646
|
], Field.prototype, "readOnly", null);
|
|
506
647
|
__decorate([
|
|
507
|
-
(0, BaseNode_1.dependencyTracked)()
|
|
648
|
+
(0, BaseNode_1.dependencyTracked)(),
|
|
649
|
+
(0, BaseNode_1.exclude)('button', 'image', 'plain-text')
|
|
508
650
|
], Field.prototype, "enabled", null);
|
|
509
651
|
__decorate([
|
|
510
652
|
(0, BaseNode_1.dependencyTracked)()
|
|
@@ -518,7 +660,31 @@ __decorate([
|
|
|
518
660
|
__decorate([
|
|
519
661
|
(0, BaseNode_1.dependencyTracked)()
|
|
520
662
|
], Field.prototype, "required", null);
|
|
663
|
+
__decorate([
|
|
664
|
+
(0, BaseNode_1.include)('date-input', 'number-input')
|
|
665
|
+
], Field.prototype, "editValue", null);
|
|
666
|
+
__decorate([
|
|
667
|
+
(0, BaseNode_1.include)('date-input', 'number-input')
|
|
668
|
+
], Field.prototype, "displayValue", null);
|
|
521
669
|
__decorate([
|
|
522
670
|
(0, BaseNode_1.dependencyTracked)()
|
|
523
671
|
], Field.prototype, "value", null);
|
|
672
|
+
__decorate([
|
|
673
|
+
(0, BaseNode_1.include)('text-input', 'date-input', 'file-input')
|
|
674
|
+
], Field.prototype, "format", null);
|
|
675
|
+
__decorate([
|
|
676
|
+
(0, BaseNode_1.include)('text-input')
|
|
677
|
+
], Field.prototype, "maxLength", null);
|
|
678
|
+
__decorate([
|
|
679
|
+
(0, BaseNode_1.include)('text-input')
|
|
680
|
+
], Field.prototype, "minLength", null);
|
|
681
|
+
__decorate([
|
|
682
|
+
(0, BaseNode_1.include)('text-input')
|
|
683
|
+
], Field.prototype, "pattern", null);
|
|
684
|
+
__decorate([
|
|
685
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
686
|
+
], Field.prototype, "exclusiveMinimum", null);
|
|
687
|
+
__decorate([
|
|
688
|
+
(0, BaseNode_1.dependencyTracked)()
|
|
689
|
+
], Field.prototype, "exclusiveMaximum", null);
|
|
524
690
|
exports.default = Field;
|
package/lib/FileObject.d.ts
CHANGED
|
@@ -4,14 +4,15 @@ import { IFileObject } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class FileObject implements IFileObject {
|
|
6
6
|
data: any;
|
|
7
|
-
|
|
7
|
+
mediaType: string;
|
|
8
8
|
name: string;
|
|
9
9
|
size: number;
|
|
10
10
|
constructor(init?: Partial<FileObject>);
|
|
11
|
+
get type(): string;
|
|
11
12
|
toJSON(): {
|
|
12
13
|
name: string;
|
|
13
14
|
size: number;
|
|
14
|
-
|
|
15
|
+
mediaType: string;
|
|
15
16
|
data: any;
|
|
16
17
|
};
|
|
17
18
|
equals(obj: IFileObject): boolean;
|
package/lib/FileObject.js
CHANGED
|
@@ -13,22 +13,25 @@ exports.FileObject = void 0;
|
|
|
13
13
|
*/
|
|
14
14
|
class FileObject {
|
|
15
15
|
constructor(init) {
|
|
16
|
-
this.
|
|
16
|
+
this.mediaType = 'application/octet-stream';
|
|
17
17
|
this.name = 'unknown';
|
|
18
18
|
this.size = 0;
|
|
19
19
|
Object.assign(this, init);
|
|
20
20
|
}
|
|
21
|
+
get type() {
|
|
22
|
+
return this.mediaType;
|
|
23
|
+
}
|
|
21
24
|
toJSON() {
|
|
22
25
|
return {
|
|
23
26
|
'name': this.name,
|
|
24
27
|
'size': this.size,
|
|
25
|
-
'
|
|
28
|
+
'mediaType': this.mediaType,
|
|
26
29
|
'data': this.data.toString()
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
equals(obj) {
|
|
30
33
|
return (this.data === obj.data &&
|
|
31
|
-
this.
|
|
34
|
+
this.mediaType === obj.mediaType &&
|
|
32
35
|
this.name === obj.name &&
|
|
33
36
|
this.size === obj.size);
|
|
34
37
|
}
|
package/lib/FileUpload.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ declare class FileUpload extends Field implements FieldModel {
|
|
|
8
8
|
protected _getDefaults(): {
|
|
9
9
|
accept: string[];
|
|
10
10
|
maxFileSize: string;
|
|
11
|
-
type: string;
|
|
12
11
|
readOnly: boolean;
|
|
13
12
|
enabled: boolean;
|
|
14
13
|
visible: boolean;
|
|
14
|
+
type: string | undefined;
|
|
15
15
|
};
|
|
16
|
+
protected _getFallbackType(): string | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* Returns the max file size in bytes as per IEC specification
|
|
18
19
|
*/
|
package/lib/FileUpload.js
CHANGED
|
@@ -56,7 +56,10 @@ function processFile(file) {
|
|
|
56
56
|
class FileUpload extends Field_1.default {
|
|
57
57
|
//private _files: FileObject[];
|
|
58
58
|
_getDefaults() {
|
|
59
|
-
return Object.assign(Object.assign({}, super._getDefaults()), { accept: ['audio/*', 'video/*', 'image/*', 'text/*', 'application/pdf'], maxFileSize: '2MB'
|
|
59
|
+
return Object.assign(Object.assign({}, super._getDefaults()), { accept: ['audio/*', 'video/*', 'image/*', 'text/*', 'application/pdf'], maxFileSize: '2MB' });
|
|
60
|
+
}
|
|
61
|
+
_getFallbackType() {
|
|
62
|
+
return 'file';
|
|
60
63
|
}
|
|
61
64
|
/**
|
|
62
65
|
* Returns the max file size in bytes as per IEC specification
|
package/lib/Form.d.ts
CHANGED
|
@@ -86,6 +86,9 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
86
86
|
properties?: {
|
|
87
87
|
[key: string]: any;
|
|
88
88
|
} | undefined;
|
|
89
|
+
screenReaderText?: string | undefined;
|
|
90
|
+
tooltip?: string | undefined;
|
|
91
|
+
altText?: string | undefined;
|
|
89
92
|
} & {
|
|
90
93
|
items: (FieldJson | import("./types").ContainerJson)[];
|
|
91
94
|
initialItems?: number | undefined;
|
|
@@ -97,8 +100,10 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
97
100
|
action?: string | undefined;
|
|
98
101
|
adaptiveForm?: string | undefined;
|
|
99
102
|
} & {
|
|
100
|
-
':type': string;
|
|
101
103
|
items: ({
|
|
104
|
+
id: string;
|
|
105
|
+
index: number;
|
|
106
|
+
':type': string;
|
|
102
107
|
description?: string | undefined;
|
|
103
108
|
rules?: Items<string> | undefined;
|
|
104
109
|
events?: Items<string | string[] | undefined> | undefined;
|
|
@@ -123,7 +128,6 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
123
128
|
validationExpression?: string | undefined;
|
|
124
129
|
uniqueItems?: boolean | undefined;
|
|
125
130
|
dataRef?: string | null | undefined;
|
|
126
|
-
':type': string;
|
|
127
131
|
label?: import("./types").Label | undefined;
|
|
128
132
|
enabled?: boolean | undefined;
|
|
129
133
|
visible?: boolean | undefined;
|
|
@@ -134,7 +138,19 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
134
138
|
properties?: {
|
|
135
139
|
[key: string]: any;
|
|
136
140
|
} | undefined;
|
|
137
|
-
|
|
141
|
+
screenReaderText?: string | undefined;
|
|
142
|
+
tooltip?: string | undefined;
|
|
143
|
+
altText?: string | undefined;
|
|
144
|
+
placeholder?: string | undefined; /**
|
|
145
|
+
* Returns the current state of the form
|
|
146
|
+
*
|
|
147
|
+
* To access the form data and attachments, one needs to use the `data` and `attachments` property.
|
|
148
|
+
* For example,
|
|
149
|
+
* ```
|
|
150
|
+
* const data = form.getState().data
|
|
151
|
+
* const attachments = form.getState().attachments
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
138
154
|
readOnly?: boolean | undefined;
|
|
139
155
|
valid?: boolean | undefined;
|
|
140
156
|
default?: any;
|
|
@@ -144,8 +160,10 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
144
160
|
editValue?: string | undefined;
|
|
145
161
|
displayValue?: string | undefined;
|
|
146
162
|
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
147
|
-
id: string;
|
|
148
163
|
} | {
|
|
164
|
+
id: string;
|
|
165
|
+
index: number;
|
|
166
|
+
':type': string;
|
|
149
167
|
description?: string | undefined;
|
|
150
168
|
rules?: Items<string> | undefined;
|
|
151
169
|
events?: Items<string | string[] | undefined> | undefined;
|
|
@@ -170,7 +188,6 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
170
188
|
validationExpression?: string | undefined;
|
|
171
189
|
uniqueItems?: boolean | undefined;
|
|
172
190
|
dataRef?: string | null | undefined;
|
|
173
|
-
':type'?: string | undefined;
|
|
174
191
|
label?: import("./types").Label | undefined;
|
|
175
192
|
enabled?: boolean | undefined;
|
|
176
193
|
visible?: boolean | undefined;
|
|
@@ -181,200 +198,22 @@ declare class Form extends Container<FormJson> implements FormModel {
|
|
|
181
198
|
properties?: {
|
|
182
199
|
[key: string]: any;
|
|
183
200
|
} | undefined;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
enum?: any[] | undefined;
|
|
189
|
-
} & {
|
|
190
|
-
accept?: string[] | undefined;
|
|
191
|
-
enforceEnum?: boolean | undefined;
|
|
192
|
-
exclusiveMinimum?: number | undefined;
|
|
193
|
-
exclusiveMaximum?: number | undefined;
|
|
194
|
-
format?: string | undefined;
|
|
195
|
-
maxFileSize?: string | number | undefined;
|
|
196
|
-
maxLength?: number | undefined;
|
|
197
|
-
maximum?: number | undefined;
|
|
198
|
-
maxItems?: number | undefined;
|
|
199
|
-
minLength?: number | undefined;
|
|
200
|
-
minimum?: number | undefined;
|
|
201
|
-
minItems?: number | undefined;
|
|
202
|
-
pattern?: string | undefined;
|
|
203
|
-
required?: boolean | undefined;
|
|
204
|
-
step?: number | undefined;
|
|
205
|
-
type?: string | undefined;
|
|
206
|
-
validationExpression?: string | undefined;
|
|
207
|
-
uniqueItems?: boolean | undefined;
|
|
208
|
-
} & {
|
|
209
|
-
dataRef?: string | null | undefined;
|
|
210
|
-
':type'?: string | undefined;
|
|
211
|
-
label?: import("./types").Label | undefined;
|
|
212
|
-
enabled?: boolean | undefined;
|
|
213
|
-
visible?: boolean | undefined;
|
|
214
|
-
name?: string | undefined;
|
|
215
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
216
|
-
fieldType?: string | undefined;
|
|
217
|
-
errorMessage?: string | undefined;
|
|
218
|
-
properties?: {
|
|
219
|
-
[key: string]: any;
|
|
220
|
-
} | undefined;
|
|
221
|
-
} & {
|
|
222
|
-
placeholder?: string | undefined;
|
|
223
|
-
} & {
|
|
224
|
-
readOnly?: boolean | undefined;
|
|
225
|
-
valid?: boolean | undefined;
|
|
226
|
-
default?: any;
|
|
227
|
-
value?: any;
|
|
228
|
-
displayFormat?: string | undefined;
|
|
229
|
-
editFormat?: string | undefined;
|
|
230
|
-
editValue?: string | undefined;
|
|
231
|
-
displayValue?: string | undefined;
|
|
232
|
-
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
233
|
-
} & {
|
|
234
|
-
id: string;
|
|
235
|
-
':type': string;
|
|
236
|
-
}) | ({
|
|
237
|
-
description?: string | undefined;
|
|
238
|
-
} & import("./types").RulesJson & {
|
|
239
|
-
enumNames?: string[] | undefined;
|
|
240
|
-
enum?: any[] | undefined;
|
|
241
|
-
} & {
|
|
242
|
-
accept?: string[] | undefined;
|
|
243
|
-
enforceEnum?: boolean | undefined;
|
|
244
|
-
exclusiveMinimum?: number | undefined;
|
|
245
|
-
exclusiveMaximum?: number | undefined;
|
|
246
|
-
format?: string | undefined;
|
|
247
|
-
maxFileSize?: string | number | undefined;
|
|
248
|
-
maxLength?: number | undefined;
|
|
249
|
-
maximum?: number | undefined;
|
|
250
|
-
maxItems?: number | undefined;
|
|
251
|
-
minLength?: number | undefined;
|
|
252
|
-
minimum?: number | undefined;
|
|
253
|
-
minItems?: number | undefined;
|
|
254
|
-
pattern?: string | undefined;
|
|
255
|
-
required?: boolean | undefined;
|
|
256
|
-
step?: number | undefined;
|
|
257
|
-
type?: string | undefined;
|
|
258
|
-
validationExpression?: string | undefined;
|
|
259
|
-
uniqueItems?: boolean | undefined;
|
|
260
|
-
} & {
|
|
261
|
-
dataRef?: string | null | undefined;
|
|
262
|
-
':type'?: string | undefined;
|
|
263
|
-
label?: import("./types").Label | undefined;
|
|
264
|
-
enabled?: boolean | undefined;
|
|
265
|
-
visible?: boolean | undefined;
|
|
266
|
-
name?: string | undefined;
|
|
267
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
268
|
-
fieldType?: string | undefined;
|
|
269
|
-
errorMessage?: string | undefined;
|
|
270
|
-
properties?: {
|
|
271
|
-
[key: string]: any;
|
|
272
|
-
} | undefined;
|
|
273
|
-
} & {
|
|
274
|
-
items: (FieldJson | import("./types").ContainerJson)[];
|
|
275
|
-
initialItems?: number | undefined;
|
|
276
|
-
activeChild?: string | undefined;
|
|
277
|
-
} & {
|
|
278
|
-
id: string;
|
|
279
|
-
items: (({
|
|
280
|
-
description?: string | undefined;
|
|
281
|
-
} & import("./types").RulesJson & {
|
|
282
|
-
enumNames?: string[] | undefined;
|
|
283
|
-
enum?: any[] | undefined;
|
|
284
|
-
} & {
|
|
285
|
-
accept?: string[] | undefined;
|
|
286
|
-
enforceEnum?: boolean | undefined;
|
|
287
|
-
exclusiveMinimum?: number | undefined;
|
|
288
|
-
exclusiveMaximum?: number | undefined;
|
|
289
|
-
format?: string | undefined;
|
|
290
|
-
maxFileSize?: string | number | undefined;
|
|
291
|
-
maxLength?: number | undefined;
|
|
292
|
-
maximum?: number | undefined;
|
|
293
|
-
maxItems?: number | undefined;
|
|
294
|
-
minLength?: number | undefined;
|
|
295
|
-
minimum?: number | undefined;
|
|
296
|
-
minItems?: number | undefined;
|
|
297
|
-
pattern?: string | undefined;
|
|
298
|
-
required?: boolean | undefined;
|
|
299
|
-
step?: number | undefined;
|
|
300
|
-
type?: string | undefined;
|
|
301
|
-
validationExpression?: string | undefined;
|
|
302
|
-
uniqueItems?: boolean | undefined;
|
|
303
|
-
} & {
|
|
304
|
-
dataRef?: string | null | undefined;
|
|
305
|
-
':type'?: string | undefined;
|
|
306
|
-
label?: import("./types").Label | undefined;
|
|
307
|
-
enabled?: boolean | undefined;
|
|
308
|
-
visible?: boolean | undefined;
|
|
309
|
-
name?: string | undefined;
|
|
310
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
311
|
-
fieldType?: string | undefined;
|
|
312
|
-
errorMessage?: string | undefined;
|
|
313
|
-
properties?: {
|
|
314
|
-
[key: string]: any;
|
|
315
|
-
} | undefined;
|
|
316
|
-
} & {
|
|
317
|
-
placeholder?: string | undefined;
|
|
318
|
-
} & {
|
|
319
|
-
readOnly?: boolean | undefined;
|
|
320
|
-
valid?: boolean | undefined;
|
|
321
|
-
default?: any;
|
|
322
|
-
value?: any;
|
|
323
|
-
displayFormat?: string | undefined;
|
|
324
|
-
editFormat?: string | undefined;
|
|
325
|
-
editValue?: string | undefined;
|
|
326
|
-
displayValue?: string | undefined;
|
|
327
|
-
emptyValue?: "" | "undefined" | "null" | undefined;
|
|
328
|
-
} & {
|
|
329
|
-
id: string;
|
|
330
|
-
':type': string;
|
|
331
|
-
}) | ({
|
|
332
|
-
description?: string | undefined;
|
|
333
|
-
} & import("./types").RulesJson & {
|
|
334
|
-
enumNames?: string[] | undefined;
|
|
335
|
-
enum?: any[] | undefined;
|
|
336
|
-
} & {
|
|
337
|
-
accept?: string[] | undefined;
|
|
338
|
-
enforceEnum?: boolean | undefined;
|
|
339
|
-
exclusiveMinimum?: number | undefined;
|
|
340
|
-
exclusiveMaximum?: number | undefined;
|
|
341
|
-
format?: string | undefined;
|
|
342
|
-
maxFileSize?: string | number | undefined;
|
|
343
|
-
maxLength?: number | undefined;
|
|
344
|
-
maximum?: number | undefined;
|
|
345
|
-
maxItems?: number | undefined;
|
|
346
|
-
minLength?: number | undefined;
|
|
347
|
-
minimum?: number | undefined;
|
|
348
|
-
minItems?: number | undefined;
|
|
349
|
-
pattern?: string | undefined;
|
|
350
|
-
required?: boolean | undefined;
|
|
351
|
-
step?: number | undefined;
|
|
352
|
-
type?: string | undefined;
|
|
353
|
-
validationExpression?: string | undefined;
|
|
354
|
-
uniqueItems?: boolean | undefined;
|
|
355
|
-
} & {
|
|
356
|
-
dataRef?: string | null | undefined;
|
|
357
|
-
':type'?: string | undefined;
|
|
358
|
-
label?: import("./types").Label | undefined;
|
|
359
|
-
enabled?: boolean | undefined;
|
|
360
|
-
visible?: boolean | undefined;
|
|
361
|
-
name?: string | undefined;
|
|
362
|
-
constraintMessages?: import("./types").ConstraintsMessages | undefined;
|
|
363
|
-
fieldType?: string | undefined;
|
|
364
|
-
errorMessage?: string | undefined;
|
|
365
|
-
properties?: {
|
|
366
|
-
[key: string]: any;
|
|
367
|
-
} | undefined;
|
|
368
|
-
} & {
|
|
369
|
-
items: (FieldJson | import("./types").ContainerJson)[];
|
|
370
|
-
initialItems?: number | undefined;
|
|
371
|
-
activeChild?: string | undefined;
|
|
372
|
-
} & any))[];
|
|
373
|
-
}))[];
|
|
201
|
+
screenReaderText?: string | undefined;
|
|
202
|
+
tooltip?: string | undefined;
|
|
203
|
+
altText?: string | undefined;
|
|
204
|
+
items: (FieldJson | import("./types").ContainerJson)[] & import("./types").State<FieldJson | import("./types").ContainerJson>[];
|
|
374
205
|
initialItems?: number | undefined;
|
|
375
206
|
activeChild?: string | undefined;
|
|
376
|
-
id: string;
|
|
377
207
|
})[];
|
|
208
|
+
properties: {
|
|
209
|
+
[key: string]: any;
|
|
210
|
+
};
|
|
211
|
+
index: number;
|
|
212
|
+
parent: undefined;
|
|
213
|
+
qualifiedName: any;
|
|
214
|
+
events: {};
|
|
215
|
+
rules: {};
|
|
216
|
+
':type': string;
|
|
378
217
|
id: string;
|
|
379
218
|
};
|
|
380
219
|
get type(): string;
|
package/lib/Scriptable.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { BaseNode } from './BaseNode';
|
|
|
7
7
|
declare abstract class Scriptable<T extends RulesJson> extends BaseNode<T> implements ScriptableField {
|
|
8
8
|
private _events;
|
|
9
9
|
private _rules;
|
|
10
|
-
|
|
10
|
+
getRules(): import("./types").Items<string>;
|
|
11
11
|
private getCompiledRule;
|
|
12
12
|
private getCompiledEvent;
|
|
13
13
|
private applyUpdates;
|