@formio/js 5.1.0-dev.6053.1bce8e0 → 5.1.0-dev.6054.7ae1465
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/dist/formio.form.js +5 -5
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +7 -7
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +7 -11
- package/lib/cjs/components/_classes/component/Component.js +28 -26
- package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/cjs/components/form/Form.js +4 -0
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +116 -74
- package/lib/cjs/components/select/editForm/Select.edit.data.js +36 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +7 -11
- package/lib/mjs/components/_classes/component/Component.js +28 -26
- package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/mjs/components/form/Form.js +4 -0
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +116 -74
- package/lib/mjs/components/select/editForm/Select.edit.data.js +36 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -0
- package/package.json +1 -1
@@ -9,16 +9,58 @@ declare const _default: ({
|
|
9
9
|
custom?: undefined;
|
10
10
|
};
|
11
11
|
type?: undefined;
|
12
|
-
as?: undefined;
|
13
|
-
editor?: undefined;
|
14
12
|
weight?: undefined;
|
15
13
|
input?: undefined;
|
16
14
|
label?: undefined;
|
17
15
|
tooltip?: undefined;
|
18
|
-
description?: undefined;
|
19
16
|
conditional?: undefined;
|
17
|
+
as?: undefined;
|
18
|
+
editor?: undefined;
|
19
|
+
defaultValue?: undefined;
|
20
|
+
description?: undefined;
|
20
21
|
reorder?: undefined;
|
22
|
+
components?: undefined;
|
23
|
+
dataSrc?: undefined;
|
24
|
+
authenticate?: undefined;
|
25
|
+
template?: undefined;
|
26
|
+
valueProperty?: undefined;
|
27
|
+
clearOnHide?: undefined;
|
28
|
+
lazyLoad?: undefined;
|
29
|
+
skipMerge?: undefined;
|
30
|
+
refreshOn?: undefined;
|
31
|
+
onSetItems?: undefined;
|
32
|
+
onChange?: undefined;
|
33
|
+
placeholder?: undefined;
|
34
|
+
validate?: undefined;
|
35
|
+
delimiter?: undefined;
|
36
|
+
requireDecimal?: undefined;
|
37
|
+
encrypted?: undefined;
|
38
|
+
rows?: undefined;
|
39
|
+
mask?: undefined;
|
40
|
+
tableView?: undefined;
|
41
|
+
alwaysEnabled?: undefined;
|
42
|
+
} | {
|
43
|
+
type: string;
|
44
|
+
weight: number;
|
45
|
+
input: boolean;
|
46
|
+
key: string;
|
47
|
+
label: string;
|
48
|
+
tooltip: string;
|
49
|
+
conditional: {
|
50
|
+
json: {
|
51
|
+
'===': (string | {
|
52
|
+
var: string;
|
53
|
+
})[];
|
54
|
+
and?: undefined;
|
55
|
+
in?: undefined;
|
56
|
+
};
|
57
|
+
};
|
58
|
+
data?: undefined;
|
59
|
+
as?: undefined;
|
60
|
+
editor?: undefined;
|
21
61
|
defaultValue?: undefined;
|
62
|
+
description?: undefined;
|
63
|
+
reorder?: undefined;
|
22
64
|
components?: undefined;
|
23
65
|
dataSrc?: undefined;
|
24
66
|
authenticate?: undefined;
|
@@ -48,7 +90,7 @@ declare const _default: ({
|
|
48
90
|
key: string;
|
49
91
|
label: string;
|
50
92
|
tooltip: string;
|
51
|
-
|
93
|
+
defaultValue: {};
|
52
94
|
conditional: {
|
53
95
|
json: {
|
54
96
|
'===': (string | {
|
@@ -59,8 +101,50 @@ declare const _default: ({
|
|
59
101
|
};
|
60
102
|
};
|
61
103
|
data?: undefined;
|
104
|
+
description?: undefined;
|
62
105
|
reorder?: undefined;
|
106
|
+
components?: undefined;
|
107
|
+
dataSrc?: undefined;
|
108
|
+
authenticate?: undefined;
|
109
|
+
template?: undefined;
|
110
|
+
valueProperty?: undefined;
|
111
|
+
clearOnHide?: undefined;
|
112
|
+
lazyLoad?: undefined;
|
113
|
+
skipMerge?: undefined;
|
114
|
+
refreshOn?: undefined;
|
115
|
+
onSetItems?: undefined;
|
116
|
+
onChange?: undefined;
|
117
|
+
placeholder?: undefined;
|
118
|
+
validate?: undefined;
|
119
|
+
delimiter?: undefined;
|
120
|
+
requireDecimal?: undefined;
|
121
|
+
encrypted?: undefined;
|
122
|
+
rows?: undefined;
|
123
|
+
mask?: undefined;
|
124
|
+
tableView?: undefined;
|
125
|
+
alwaysEnabled?: undefined;
|
126
|
+
} | {
|
127
|
+
type: string;
|
128
|
+
as: string;
|
129
|
+
editor: string;
|
130
|
+
weight: number;
|
131
|
+
input: boolean;
|
132
|
+
key: string;
|
133
|
+
label: string;
|
134
|
+
tooltip: string;
|
135
|
+
description: string;
|
136
|
+
conditional: {
|
137
|
+
json: {
|
138
|
+
'===': (string | {
|
139
|
+
var: string;
|
140
|
+
})[];
|
141
|
+
and?: undefined;
|
142
|
+
in?: undefined;
|
143
|
+
};
|
144
|
+
};
|
145
|
+
data?: undefined;
|
63
146
|
defaultValue?: undefined;
|
147
|
+
reorder?: undefined;
|
64
148
|
components?: undefined;
|
65
149
|
dataSrc?: undefined;
|
66
150
|
authenticate?: undefined;
|
@@ -108,9 +192,9 @@ declare const _default: ({
|
|
108
192
|
data?: undefined;
|
109
193
|
as?: undefined;
|
110
194
|
editor?: undefined;
|
195
|
+
defaultValue?: undefined;
|
111
196
|
description?: undefined;
|
112
197
|
reorder?: undefined;
|
113
|
-
defaultValue?: undefined;
|
114
198
|
components?: undefined;
|
115
199
|
dataSrc?: undefined;
|
116
200
|
authenticate?: undefined;
|
@@ -219,9 +303,9 @@ declare const _default: ({
|
|
219
303
|
};
|
220
304
|
as?: undefined;
|
221
305
|
editor?: undefined;
|
306
|
+
defaultValue?: undefined;
|
222
307
|
description?: undefined;
|
223
308
|
reorder?: undefined;
|
224
|
-
defaultValue?: undefined;
|
225
309
|
components?: undefined;
|
226
310
|
skipMerge?: undefined;
|
227
311
|
refreshOn?: undefined;
|
@@ -256,8 +340,8 @@ declare const _default: ({
|
|
256
340
|
data?: undefined;
|
257
341
|
as?: undefined;
|
258
342
|
editor?: undefined;
|
259
|
-
reorder?: undefined;
|
260
343
|
defaultValue?: undefined;
|
344
|
+
reorder?: undefined;
|
261
345
|
components?: undefined;
|
262
346
|
dataSrc?: undefined;
|
263
347
|
authenticate?: undefined;
|
@@ -327,9 +411,9 @@ declare const _default: ({
|
|
327
411
|
};
|
328
412
|
as?: undefined;
|
329
413
|
editor?: undefined;
|
414
|
+
defaultValue?: undefined;
|
330
415
|
description?: undefined;
|
331
416
|
reorder?: undefined;
|
332
|
-
defaultValue?: undefined;
|
333
417
|
components?: undefined;
|
334
418
|
authenticate?: undefined;
|
335
419
|
placeholder?: undefined;
|
@@ -359,12 +443,12 @@ declare const _default: ({
|
|
359
443
|
url?: undefined;
|
360
444
|
custom?: undefined;
|
361
445
|
};
|
446
|
+
conditional?: undefined;
|
362
447
|
as?: undefined;
|
363
448
|
editor?: undefined;
|
449
|
+
defaultValue?: undefined;
|
364
450
|
description?: undefined;
|
365
|
-
conditional?: undefined;
|
366
451
|
reorder?: undefined;
|
367
|
-
defaultValue?: undefined;
|
368
452
|
components?: undefined;
|
369
453
|
authenticate?: undefined;
|
370
454
|
valueProperty?: undefined;
|
@@ -391,53 +475,12 @@ declare const _default: ({
|
|
391
475
|
placeholder: string;
|
392
476
|
tooltip: string;
|
393
477
|
data?: undefined;
|
394
|
-
as?: undefined;
|
395
|
-
editor?: undefined;
|
396
|
-
description?: undefined;
|
397
478
|
conditional?: undefined;
|
398
|
-
reorder?: undefined;
|
399
|
-
defaultValue?: undefined;
|
400
|
-
components?: undefined;
|
401
|
-
dataSrc?: undefined;
|
402
|
-
authenticate?: undefined;
|
403
|
-
template?: undefined;
|
404
|
-
valueProperty?: undefined;
|
405
|
-
clearOnHide?: undefined;
|
406
|
-
lazyLoad?: undefined;
|
407
|
-
skipMerge?: undefined;
|
408
|
-
refreshOn?: undefined;
|
409
|
-
onSetItems?: undefined;
|
410
|
-
onChange?: undefined;
|
411
|
-
validate?: undefined;
|
412
|
-
delimiter?: undefined;
|
413
|
-
requireDecimal?: undefined;
|
414
|
-
encrypted?: undefined;
|
415
|
-
rows?: undefined;
|
416
|
-
mask?: undefined;
|
417
|
-
tableView?: undefined;
|
418
|
-
alwaysEnabled?: undefined;
|
419
|
-
} | {
|
420
|
-
type: string;
|
421
|
-
input: boolean;
|
422
|
-
key: string;
|
423
|
-
label: string;
|
424
|
-
tooltip: string;
|
425
|
-
weight: number;
|
426
|
-
conditional: {
|
427
|
-
json: {
|
428
|
-
'===': (string | {
|
429
|
-
var: string;
|
430
|
-
})[];
|
431
|
-
and?: undefined;
|
432
|
-
in?: undefined;
|
433
|
-
};
|
434
|
-
};
|
435
|
-
data?: undefined;
|
436
479
|
as?: undefined;
|
437
480
|
editor?: undefined;
|
481
|
+
defaultValue?: undefined;
|
438
482
|
description?: undefined;
|
439
483
|
reorder?: undefined;
|
440
|
-
defaultValue?: undefined;
|
441
484
|
components?: undefined;
|
442
485
|
dataSrc?: undefined;
|
443
486
|
authenticate?: undefined;
|
@@ -449,7 +492,6 @@ declare const _default: ({
|
|
449
492
|
refreshOn?: undefined;
|
450
493
|
onSetItems?: undefined;
|
451
494
|
onChange?: undefined;
|
452
|
-
placeholder?: undefined;
|
453
495
|
validate?: undefined;
|
454
496
|
delimiter?: undefined;
|
455
497
|
requireDecimal?: undefined;
|
@@ -478,8 +520,8 @@ declare const _default: ({
|
|
478
520
|
data?: undefined;
|
479
521
|
as?: undefined;
|
480
522
|
editor?: undefined;
|
481
|
-
reorder?: undefined;
|
482
523
|
defaultValue?: undefined;
|
524
|
+
reorder?: undefined;
|
483
525
|
components?: undefined;
|
484
526
|
dataSrc?: undefined;
|
485
527
|
authenticate?: undefined;
|
@@ -626,8 +668,8 @@ declare const _default: ({
|
|
626
668
|
data?: undefined;
|
627
669
|
as?: undefined;
|
628
670
|
editor?: undefined;
|
629
|
-
reorder?: undefined;
|
630
671
|
defaultValue?: undefined;
|
672
|
+
reorder?: undefined;
|
631
673
|
components?: undefined;
|
632
674
|
dataSrc?: undefined;
|
633
675
|
authenticate?: undefined;
|
@@ -668,9 +710,9 @@ declare const _default: ({
|
|
668
710
|
};
|
669
711
|
data?: undefined;
|
670
712
|
as?: undefined;
|
713
|
+
defaultValue?: undefined;
|
671
714
|
description?: undefined;
|
672
715
|
reorder?: undefined;
|
673
|
-
defaultValue?: undefined;
|
674
716
|
components?: undefined;
|
675
717
|
dataSrc?: undefined;
|
676
718
|
authenticate?: undefined;
|
@@ -717,9 +759,9 @@ declare const _default: ({
|
|
717
759
|
};
|
718
760
|
as?: undefined;
|
719
761
|
editor?: undefined;
|
762
|
+
defaultValue?: undefined;
|
720
763
|
description?: undefined;
|
721
764
|
reorder?: undefined;
|
722
|
-
defaultValue?: undefined;
|
723
765
|
components?: undefined;
|
724
766
|
authenticate?: undefined;
|
725
767
|
template?: undefined;
|
@@ -789,10 +831,10 @@ declare const _default: ({
|
|
789
831
|
defaultValue: boolean;
|
790
832
|
tooltip: string;
|
791
833
|
data?: undefined;
|
834
|
+
conditional?: undefined;
|
792
835
|
as?: undefined;
|
793
836
|
editor?: undefined;
|
794
837
|
description?: undefined;
|
795
|
-
conditional?: undefined;
|
796
838
|
reorder?: undefined;
|
797
839
|
components?: undefined;
|
798
840
|
dataSrc?: undefined;
|
@@ -885,10 +927,10 @@ declare const _default: ({
|
|
885
927
|
weight: number;
|
886
928
|
tooltip: string;
|
887
929
|
data?: undefined;
|
930
|
+
conditional?: undefined;
|
888
931
|
as?: undefined;
|
889
932
|
editor?: undefined;
|
890
933
|
description?: undefined;
|
891
|
-
conditional?: undefined;
|
892
934
|
reorder?: undefined;
|
893
935
|
components?: undefined;
|
894
936
|
dataSrc?: undefined;
|
@@ -931,9 +973,9 @@ declare const _default: ({
|
|
931
973
|
data?: undefined;
|
932
974
|
as?: undefined;
|
933
975
|
editor?: undefined;
|
976
|
+
defaultValue?: undefined;
|
934
977
|
description?: undefined;
|
935
978
|
reorder?: undefined;
|
936
|
-
defaultValue?: undefined;
|
937
979
|
components?: undefined;
|
938
980
|
dataSrc?: undefined;
|
939
981
|
authenticate?: undefined;
|
@@ -961,12 +1003,12 @@ declare const _default: ({
|
|
961
1003
|
label: string;
|
962
1004
|
tooltip: string;
|
963
1005
|
data?: undefined;
|
1006
|
+
conditional?: undefined;
|
964
1007
|
as?: undefined;
|
965
1008
|
editor?: undefined;
|
1009
|
+
defaultValue?: undefined;
|
966
1010
|
description?: undefined;
|
967
|
-
conditional?: undefined;
|
968
1011
|
reorder?: undefined;
|
969
|
-
defaultValue?: undefined;
|
970
1012
|
components?: undefined;
|
971
1013
|
dataSrc?: undefined;
|
972
1014
|
authenticate?: undefined;
|
@@ -998,8 +1040,8 @@ declare const _default: ({
|
|
998
1040
|
tooltip: string;
|
999
1041
|
defaultValue: {};
|
1000
1042
|
data?: undefined;
|
1001
|
-
description?: undefined;
|
1002
1043
|
conditional?: undefined;
|
1044
|
+
description?: undefined;
|
1003
1045
|
reorder?: undefined;
|
1004
1046
|
components?: undefined;
|
1005
1047
|
dataSrc?: undefined;
|
@@ -1027,16 +1069,16 @@ declare const _default: ({
|
|
1027
1069
|
onChange(context: any): void;
|
1028
1070
|
data?: undefined;
|
1029
1071
|
type?: undefined;
|
1030
|
-
as?: undefined;
|
1031
|
-
editor?: undefined;
|
1032
1072
|
weight?: undefined;
|
1033
1073
|
input?: undefined;
|
1034
1074
|
label?: undefined;
|
1035
1075
|
tooltip?: undefined;
|
1036
|
-
description?: undefined;
|
1037
1076
|
conditional?: undefined;
|
1038
|
-
|
1077
|
+
as?: undefined;
|
1078
|
+
editor?: undefined;
|
1039
1079
|
defaultValue?: undefined;
|
1080
|
+
description?: undefined;
|
1081
|
+
reorder?: undefined;
|
1040
1082
|
components?: undefined;
|
1041
1083
|
dataSrc?: undefined;
|
1042
1084
|
authenticate?: undefined;
|
@@ -1108,15 +1150,15 @@ declare const _default: ({
|
|
1108
1150
|
};
|
1109
1151
|
};
|
1110
1152
|
data?: undefined;
|
1111
|
-
as?: undefined;
|
1112
|
-
editor?: undefined;
|
1113
1153
|
weight?: undefined;
|
1114
1154
|
input?: undefined;
|
1115
1155
|
label?: undefined;
|
1116
1156
|
tooltip?: undefined;
|
1157
|
+
as?: undefined;
|
1158
|
+
editor?: undefined;
|
1159
|
+
defaultValue?: undefined;
|
1117
1160
|
description?: undefined;
|
1118
1161
|
reorder?: undefined;
|
1119
|
-
defaultValue?: undefined;
|
1120
1162
|
components?: undefined;
|
1121
1163
|
dataSrc?: undefined;
|
1122
1164
|
authenticate?: undefined;
|
@@ -1142,16 +1184,16 @@ declare const _default: ({
|
|
1142
1184
|
onChange(context: any): void;
|
1143
1185
|
data?: undefined;
|
1144
1186
|
type?: undefined;
|
1145
|
-
as?: undefined;
|
1146
|
-
editor?: undefined;
|
1147
1187
|
weight?: undefined;
|
1148
1188
|
input?: undefined;
|
1149
1189
|
label?: undefined;
|
1150
1190
|
tooltip?: undefined;
|
1151
|
-
description?: undefined;
|
1152
1191
|
conditional?: undefined;
|
1153
|
-
|
1192
|
+
as?: undefined;
|
1193
|
+
editor?: undefined;
|
1154
1194
|
defaultValue?: undefined;
|
1195
|
+
description?: undefined;
|
1196
|
+
reorder?: undefined;
|
1155
1197
|
components?: undefined;
|
1156
1198
|
dataSrc?: undefined;
|
1157
1199
|
authenticate?: undefined;
|
@@ -62,6 +62,42 @@ exports.default = [
|
|
62
62
|
],
|
63
63
|
},
|
64
64
|
},
|
65
|
+
{
|
66
|
+
type: 'textfield',
|
67
|
+
weight: 10,
|
68
|
+
input: true,
|
69
|
+
key: 'indexeddb.database',
|
70
|
+
label: 'Database name',
|
71
|
+
tooltip: 'The name of the indexeddb database.',
|
72
|
+
conditional: {
|
73
|
+
json: { '===': [{ var: 'data.dataSrc' }, 'indexeddb'] },
|
74
|
+
},
|
75
|
+
},
|
76
|
+
{
|
77
|
+
type: 'textfield',
|
78
|
+
input: true,
|
79
|
+
key: 'indexeddb.table',
|
80
|
+
label: 'Table name',
|
81
|
+
weight: 16,
|
82
|
+
tooltip: 'The name of table in the indexeddb database.',
|
83
|
+
conditional: {
|
84
|
+
json: { '===': [{ var: 'data.dataSrc' }, 'indexeddb'] },
|
85
|
+
}
|
86
|
+
},
|
87
|
+
{
|
88
|
+
type: 'textarea',
|
89
|
+
as: 'json',
|
90
|
+
editor: 'ace',
|
91
|
+
weight: 18,
|
92
|
+
input: true,
|
93
|
+
key: 'indexeddb.filter',
|
94
|
+
label: 'Row Filter',
|
95
|
+
tooltip: 'Filter table items that match the object.',
|
96
|
+
defaultValue: {},
|
97
|
+
conditional: {
|
98
|
+
json: { '===': [{ var: 'data.dataSrc' }, 'indexeddb'] },
|
99
|
+
},
|
100
|
+
},
|
65
101
|
{
|
66
102
|
type: 'textarea',
|
67
103
|
as: 'json',
|
@@ -64,6 +64,9 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
64
64
|
info.attr.class = 'form-check-input';
|
65
65
|
return info;
|
66
66
|
}
|
67
|
+
get hasDefaultValue() {
|
68
|
+
return true;
|
69
|
+
}
|
67
70
|
get emptyValue() {
|
68
71
|
return this.component.values.reduce((prev, value) => {
|
69
72
|
if (value.value) {
|
@@ -129,16 +129,6 @@ declare class Component extends Element {
|
|
129
129
|
* The reference attribute name for this component
|
130
130
|
*/
|
131
131
|
_referenceAttributeName: string;
|
132
|
-
/**
|
133
|
-
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
134
|
-
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
135
|
-
* if there is a "value=" within the script.
|
136
|
-
*/
|
137
|
-
shouldSetCustomDefault: any;
|
138
|
-
/**
|
139
|
-
* Same as customDefaultValue, but for calculateValue.
|
140
|
-
*/
|
141
|
-
shouldSetCalculatedValue: any;
|
142
132
|
triggerChange: (...args: any[]) => any;
|
143
133
|
/**
|
144
134
|
* Used to trigger a redraw event within this component.
|
@@ -896,7 +886,12 @@ declare class Component extends Element {
|
|
896
886
|
*/
|
897
887
|
deleteValue(): void;
|
898
888
|
getCustomDefaultValue(defaultValue: any): any;
|
899
|
-
|
889
|
+
/**
|
890
|
+
* Returns if a component has a default value set.
|
891
|
+
* @returns {boolean} - TRUE if a default value is set.
|
892
|
+
*/
|
893
|
+
get hasDefaultValue(): boolean;
|
894
|
+
get shouldAddDefaultValue(): boolean;
|
900
895
|
get defaultValue(): any;
|
901
896
|
/**
|
902
897
|
* Get the input value of this component.
|
@@ -1070,6 +1065,7 @@ declare class Component extends Element {
|
|
1070
1065
|
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
1071
1066
|
*/
|
1072
1067
|
checkData(data?: any, flags?: any, row?: any): void | boolean;
|
1068
|
+
checkingData: boolean | undefined;
|
1073
1069
|
checkModal(errors?: any[], dirty?: boolean): void;
|
1074
1070
|
get validationValue(): any;
|
1075
1071
|
isEmpty(value?: any): any;
|
@@ -326,22 +326,6 @@ export default class Component extends Element {
|
|
326
326
|
* The reference attribute name for this component
|
327
327
|
*/
|
328
328
|
this._referenceAttributeName = 'ref';
|
329
|
-
/**
|
330
|
-
* Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
|
331
|
-
* flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
|
332
|
-
* if there is a "value=" within the script.
|
333
|
-
*/
|
334
|
-
this.shouldSetCustomDefault = true;
|
335
|
-
if (this.component.customDefaultValue && (typeof this.component.customDefaultValue === 'string')) {
|
336
|
-
this.shouldSetCustomDefault = this.component.customDefaultValue.match(/value\s*=/);
|
337
|
-
}
|
338
|
-
/**
|
339
|
-
* Same as customDefaultValue, but for calculateValue.
|
340
|
-
*/
|
341
|
-
this.shouldSetCalculatedValue = true;
|
342
|
-
if (this.component.calculateValue && (typeof this.component.calculateValue === 'string')) {
|
343
|
-
this.shouldSetCalculatedValue = this.component.calculateValue.match(/value\s*=/);
|
344
|
-
}
|
345
329
|
/**
|
346
330
|
* Used to trigger a new change in this component.
|
347
331
|
* @type {Function} - Call to trigger a change in this component.
|
@@ -2521,15 +2505,27 @@ export default class Component extends Element {
|
|
2521
2505
|
}
|
2522
2506
|
getCustomDefaultValue(defaultValue) {
|
2523
2507
|
if (this.component.customDefaultValue && !this.options.preview) {
|
2524
|
-
|
2525
|
-
if (this.shouldSetCustomDefault) {
|
2526
|
-
defaultValue = customDefaultValue;
|
2527
|
-
}
|
2508
|
+
defaultValue = this.evaluate(this.component.customDefaultValue, { value: this.dataValue }, 'value');
|
2528
2509
|
}
|
2529
2510
|
return defaultValue;
|
2530
2511
|
}
|
2512
|
+
/**
|
2513
|
+
* Returns if a component has a default value set.
|
2514
|
+
* @returns {boolean} - TRUE if a default value is set.
|
2515
|
+
*/
|
2516
|
+
get hasDefaultValue() {
|
2517
|
+
return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
|
2518
|
+
(this.component.defaultValue !== null) &&
|
2519
|
+
(this.component.defaultValue !== undefined));
|
2520
|
+
}
|
2531
2521
|
get shouldAddDefaultValue() {
|
2532
|
-
|
2522
|
+
// It should add a default value if...
|
2523
|
+
// 1.) Ensure they have not set "noDefaults". If that is true, then will always return false. AND
|
2524
|
+
// 2.) The component is pristine (user has not manually modified it). AND
|
2525
|
+
// 3.) There is a default value setting present and it is not NULL or UNDEFINED.
|
2526
|
+
return !this.options.noDefaults && this.pristine && (this.hasDefaultValue ||
|
2527
|
+
// Empty strings and booleans are allowed primitives whose defaults are automatically added.
|
2528
|
+
(this.emptyValue === '' || (typeof this.emptyValue === 'boolean')));
|
2533
2529
|
}
|
2534
2530
|
get defaultValue() {
|
2535
2531
|
let defaultValue = this.emptyValue;
|
@@ -2783,7 +2779,7 @@ export default class Component extends Element {
|
|
2783
2779
|
return value;
|
2784
2780
|
}
|
2785
2781
|
doValueCalculation(dataValue, data, row) {
|
2786
|
-
|
2782
|
+
return this.evaluate(this.component.calculateValue, {
|
2787
2783
|
value: dataValue,
|
2788
2784
|
data,
|
2789
2785
|
row: row || this.data,
|
@@ -2791,10 +2787,6 @@ export default class Component extends Element {
|
|
2791
2787
|
data: this.rootValue
|
2792
2788
|
}
|
2793
2789
|
}, 'value');
|
2794
|
-
if (this.shouldSetCalculatedValue) {
|
2795
|
-
return calculatedValue;
|
2796
|
-
}
|
2797
|
-
return dataValue;
|
2798
2790
|
}
|
2799
2791
|
/* eslint-disable max-statements */
|
2800
2792
|
calculateComponentValue(data, flags, row) {
|
@@ -3124,6 +3116,14 @@ export default class Component extends Element {
|
|
3124
3116
|
data = data || this.rootValue;
|
3125
3117
|
flags = flags || {};
|
3126
3118
|
row = row || this.data;
|
3119
|
+
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3120
|
+
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3121
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3122
|
+
// an infinite loop by only checking this component once.
|
3123
|
+
if (this.checkingData) {
|
3124
|
+
return;
|
3125
|
+
}
|
3126
|
+
this.checkingData = true;
|
3127
3127
|
// Needs for Nextgen Rules Engine
|
3128
3128
|
this.resetCaches();
|
3129
3129
|
// Do not trigger refresh if change was triggered on blur event since components with Refresh on Blur have their own listeners
|
@@ -3137,6 +3137,8 @@ export default class Component extends Element {
|
|
3137
3137
|
if (this.id !== flags.triggeredComponentId) {
|
3138
3138
|
this.calculateComponentValue(data, flags, row);
|
3139
3139
|
}
|
3140
|
+
// We are done checking data.
|
3141
|
+
this.checkingData = false;
|
3140
3142
|
}
|
3141
3143
|
checkModal(errors = [], dirty = false) {
|
3142
3144
|
const messages = errors.filter(error => !error.fromServer);
|
@@ -816,7 +816,7 @@ export default class NestedComponent extends Field {
|
|
816
816
|
else if (value && component.hasValue(value)) {
|
817
817
|
return component.setValue(_.get(value, component.key), flags);
|
818
818
|
}
|
819
|
-
else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
|
819
|
+
else if ((!this.rootPristine || component.visible) && (flags.resetValue || component.shouldAddDefaultValue)) {
|
820
820
|
flags.noValidate = !flags.dirty;
|
821
821
|
flags.resetValue = true;
|
822
822
|
return component.setValue(component.defaultValue, flags);
|
@@ -826,6 +826,13 @@ export default class NestedComponent extends Field {
|
|
826
826
|
if (!value) {
|
827
827
|
return false;
|
828
828
|
}
|
829
|
+
// If the value is equal to the empty value, then this means we need to reset the values.
|
830
|
+
if (_.isEqual(value, this.emptyValue)) {
|
831
|
+
// TO-DO: For a future major release, we need to investigate removing the need for the
|
832
|
+
// "resetValue" flag. This seems like a hack that is no longer necessary and the renderer
|
833
|
+
// may behave more deterministically without it.
|
834
|
+
flags.resetValue = true;
|
835
|
+
}
|
829
836
|
return this.getComponents().reduce((changed, component) => {
|
830
837
|
return this.setNestedValue(component, value, flags, changed) || changed;
|
831
838
|
}, false);
|
@@ -3,11 +3,9 @@ export default class NestedDataComponent extends NestedComponent {
|
|
3
3
|
hasChanged(newValue: any, oldValue: any): boolean;
|
4
4
|
get allowData(): boolean;
|
5
5
|
get emptyValue(): {};
|
6
|
-
get shouldAddDefaultValue(): boolean;
|
7
6
|
componentContext(): any;
|
8
7
|
getValueAsString(value: any, options: any): string;
|
9
8
|
getDataValueAsTable(value: any, options: any): string;
|
10
|
-
everyComponent(fn: any, options?: {}): void;
|
11
9
|
/**
|
12
10
|
* Get the value of this component.
|
13
11
|
* @returns {any} - Return the value of this component.
|
@@ -90,17 +90,6 @@ export default class NestedDataComponent extends NestedComponent {
|
|
90
90
|
`);
|
91
91
|
return result;
|
92
92
|
}
|
93
|
-
everyComponent(fn, options = {}) {
|
94
|
-
if (options?.email) {
|
95
|
-
if (options.fromRoot) {
|
96
|
-
delete options.fromRoot;
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
return;
|
100
|
-
}
|
101
|
-
}
|
102
|
-
return super.everyComponent(fn, options);
|
103
|
-
}
|
104
93
|
/**
|
105
94
|
* Get the value of this component.
|
106
95
|
* @returns {any} - Return the value of this component.
|