@formio/js 5.1.0-dev.6068.fbce2f7 → 5.1.0-dev.6070.c51663f
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 +543 -532
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +545 -534
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +21 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +22 -11
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -32
- package/lib/cjs/components/_classes/component/Component.js +37 -68
- package/lib/cjs/components/editgrid/EditGrid.js +3 -1
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +20 -12
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +18 -18
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +9 -1
- package/lib/cjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/cjs/components/unknown/Unknown.form.js +13 -9
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/utils.js +2 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -32
- package/lib/mjs/components/_classes/component/Component.js +37 -68
- package/lib/mjs/components/editgrid/EditGrid.js +3 -1
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +20 -12
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +18 -18
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +9 -1
- package/lib/mjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/mjs/components/unknown/Unknown.form.js +13 -9
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/utils.js +2 -1
- package/package.json +2 -2
@@ -422,20 +422,10 @@ export default class Component extends Element {
|
|
422
422
|
get componentsMap() {
|
423
423
|
return this.root?.childComponentsMap || {};
|
424
424
|
}
|
425
|
-
/**
|
426
|
-
* Returns if the parent should conditionally clear.
|
427
|
-
* This method does not need to walk up the parent tree since the variables
|
428
|
-
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
429
|
-
* before the child component is determined, and the parent component also references
|
430
|
-
* its parent component.
|
431
|
-
*
|
432
|
-
* @returns {boolean} - If the parent should conditionally clear.
|
433
|
-
*/
|
434
425
|
parentShouldConditionallyClear() {
|
435
426
|
let currentParent = this.parent;
|
436
427
|
while (currentParent) {
|
437
|
-
if (
|
438
|
-
(!currentParent.allowData && currentParent._conditionallyHidden)) {
|
428
|
+
if (currentParent.shouldConditionallyClear(true)) {
|
439
429
|
return true;
|
440
430
|
}
|
441
431
|
currentParent = currentParent.parent;
|
@@ -445,21 +435,7 @@ export default class Component extends Element {
|
|
445
435
|
parentConditionallyHidden() {
|
446
436
|
let currentParent = this.parent;
|
447
437
|
while (currentParent) {
|
448
|
-
if (currentParent.
|
449
|
-
return true;
|
450
|
-
}
|
451
|
-
currentParent = currentParent.parent;
|
452
|
-
}
|
453
|
-
return false;
|
454
|
-
}
|
455
|
-
/**
|
456
|
-
* Returns true if any of the parents default their component "hidden" property to true.
|
457
|
-
* @returns {boolean} - If any parent defaults the hidden property to true.
|
458
|
-
*/
|
459
|
-
anyParentDefaultsHidden() {
|
460
|
-
let currentParent = this.parent;
|
461
|
-
while (currentParent) {
|
462
|
-
if (currentParent.component.hidden) {
|
438
|
+
if (currentParent.conditionallyHidden(true)) {
|
463
439
|
return true;
|
464
440
|
}
|
465
441
|
currentParent = currentParent.parent;
|
@@ -677,58 +653,48 @@ export default class Component extends Element {
|
|
677
653
|
}
|
678
654
|
return this._logicallyHidden;
|
679
655
|
}
|
680
|
-
|
681
|
-
* Determines if the component should clear its value when the root form is pristine.
|
682
|
-
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
683
|
-
*/
|
684
|
-
shouldConditionallyClearOnPristine() {
|
685
|
-
// If the form is pristine, we should NOT clear the value of a conditionally hidden child component
|
686
|
-
// of a layout component that defaults to hidden using the "hidden" component property.
|
687
|
-
return !this.anyParentDefaultsHidden();
|
688
|
-
}
|
689
|
-
/**
|
690
|
-
* Returns if the component should clear its value when conditionally hidden.
|
691
|
-
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
692
|
-
*/
|
693
|
-
shouldConditionallyClear() {
|
656
|
+
shouldConditionallyClear(skipParent = false) {
|
694
657
|
// Skip if this component has clearOnHide set to false.
|
695
658
|
if (this.component.clearOnHide === false) {
|
696
|
-
|
697
|
-
return this._conditionallyClear;
|
659
|
+
return false;
|
698
660
|
}
|
699
661
|
// If the component is logically hidden, then it is conditionally hidden and should clear.
|
700
662
|
if (this.logicallyHidden) {
|
701
|
-
|
702
|
-
return this._conditionallyClear;
|
663
|
+
return true;
|
703
664
|
}
|
704
665
|
// If we have a condition and it is not conditionally visible, the it should conditionally clear.
|
705
|
-
if (this.hasCondition() &&
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
666
|
+
if (this.hasCondition() && !this.conditionallyVisible()) {
|
667
|
+
return true;
|
668
|
+
}
|
669
|
+
if (skipParent) {
|
670
|
+
// Stop recurrsion for the parent checks.
|
671
|
+
return false;
|
672
|
+
}
|
673
|
+
// If this component has a set value, then it should ONLY clear if a parent is hidden
|
674
|
+
// and has the clearOnHide set to true.
|
675
|
+
if (this.hasSetValue) {
|
676
|
+
return this.parentShouldConditionallyClear();
|
710
677
|
}
|
711
|
-
|
712
|
-
return this.
|
678
|
+
// Clear the value if the parent is conditionally hidden.
|
679
|
+
return this.parentConditionallyHidden();
|
713
680
|
}
|
714
|
-
|
715
|
-
* Returns if the component is conditionally hidden.
|
716
|
-
* @returns {boolean} - If the component is conditionally hidden.
|
717
|
-
*/
|
718
|
-
conditionallyHidden() {
|
719
|
-
// If it is logically hidden, then it is conditionally hidden.
|
681
|
+
conditionallyHidden(skipParent = false) {
|
720
682
|
if (this.logicallyHidden) {
|
721
|
-
|
722
|
-
return this._conditionallyHidden;
|
683
|
+
return true;
|
723
684
|
}
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
685
|
+
if (!this.hasCondition() && !skipParent) {
|
686
|
+
return this.parentConditionallyHidden();
|
687
|
+
}
|
688
|
+
// Return if we are not conditionally visible (conditionallyHidden)
|
689
|
+
if (!this.conditionallyVisible()) {
|
690
|
+
return true;
|
691
|
+
}
|
692
|
+
if (skipParent) {
|
693
|
+
// Stop recurrsion for the parent checks.
|
694
|
+
return false;
|
728
695
|
}
|
729
|
-
//
|
730
|
-
|
731
|
-
return this._conditionallyHidden;
|
696
|
+
// Check the parent.
|
697
|
+
return this.parentConditionallyHidden();
|
732
698
|
}
|
733
699
|
get currentForm() {
|
734
700
|
return this._currentForm;
|
@@ -3001,9 +2967,11 @@ export default class Component extends Element {
|
|
3001
2967
|
* @param {boolean} dirty - If the component is dirty.
|
3002
2968
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
3003
2969
|
* @param {*} row - Contextual row data for this component.
|
2970
|
+
* @param {*} options - Additional options for validation.
|
3004
2971
|
* @returns {string} - The message to show when the component is invalid.
|
3005
2972
|
*/
|
3006
|
-
invalidMessage(data, dirty, ignoreCondition, row) {
|
2973
|
+
invalidMessage(data, dirty, ignoreCondition, row, options = {}) {
|
2974
|
+
const { local } = options;
|
3007
2975
|
if (!row) {
|
3008
2976
|
row = getContextualRowData(this.component, data, this.paths);
|
3009
2977
|
}
|
@@ -3023,6 +2991,7 @@ export default class Component extends Element {
|
|
3023
2991
|
component: this.component,
|
3024
2992
|
data,
|
3025
2993
|
row,
|
2994
|
+
local,
|
3026
2995
|
path: this.path || this.component.key,
|
3027
2996
|
parent: this.parent?.component,
|
3028
2997
|
paths: this.paths,
|
@@ -3199,7 +3168,7 @@ export default class Component extends Element {
|
|
3199
3168
|
row = row || this.data;
|
3200
3169
|
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3201
3170
|
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3202
|
-
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3171
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3203
3172
|
// an infinite loop by only checking this component once.
|
3204
3173
|
if (this.checkingData) {
|
3205
3174
|
return;
|
@@ -1099,7 +1099,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1099
1099
|
errors.push(...this._errors);
|
1100
1100
|
return false;
|
1101
1101
|
}
|
1102
|
-
|
1102
|
+
// TODO: this is the only place invalidMessage gets called, and it's not clear why it's needed - we already validate the editGrid
|
1103
|
+
// component above with super.checkComponentValidity
|
1104
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row, options);
|
1103
1105
|
if (allRowErrors.length && this.root?.submitted && !message) {
|
1104
1106
|
this._errors = this.setCustomValidity(message, dirty);
|
1105
1107
|
errors.push(...this._errors);
|
@@ -98,6 +98,7 @@ export default class FormComponent extends Component {
|
|
98
98
|
* @returns {void}
|
99
99
|
*/
|
100
100
|
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
101
|
+
areAllComponentsEmpty(data: any): boolean;
|
101
102
|
updateSubFormVisibility(): void;
|
102
103
|
/**
|
103
104
|
* Determines if this form is a Nested Wizard
|
@@ -96,9 +96,6 @@ export default class FormComponent extends Component {
|
|
96
96
|
}
|
97
97
|
return this.createSubForm();
|
98
98
|
}
|
99
|
-
shouldConditionallyClearOnPristine() {
|
100
|
-
return !this.hasSetValue && super.shouldConditionallyClearOnPristine();
|
101
|
-
}
|
102
99
|
get dataReady() {
|
103
100
|
return this.subForm?.dataReady || this.subFormReady || Promise.resolve();
|
104
101
|
}
|
@@ -289,13 +286,11 @@ export default class FormComponent extends Component {
|
|
289
286
|
}
|
290
287
|
this.subForm.attach(element);
|
291
288
|
this.valueChanged = this.hasSetValue;
|
292
|
-
if (!this.
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
this.restoreValue();
|
298
|
-
}
|
289
|
+
if (!this.valueChanged && this.dataValue.state !== 'submitted') {
|
290
|
+
this.setDefaultValue();
|
291
|
+
}
|
292
|
+
else {
|
293
|
+
this.restoreValue();
|
299
294
|
}
|
300
295
|
}
|
301
296
|
if (!this.builderMode && this.component.modalEdit) {
|
@@ -410,7 +405,7 @@ export default class FormComponent extends Component {
|
|
410
405
|
_.assign(componentsMap, formComponentsMap);
|
411
406
|
this.component.components = this.subForm.components.map((comp) => comp.component);
|
412
407
|
this.subForm.on('change', () => {
|
413
|
-
if (this.subForm
|
408
|
+
if (this.subForm) {
|
414
409
|
this.dataValue = this.subForm.getValue();
|
415
410
|
this.triggerChange({
|
416
411
|
noEmit: true
|
@@ -673,7 +668,20 @@ export default class FormComponent extends Component {
|
|
673
668
|
}
|
674
669
|
}
|
675
670
|
isEmpty(value = this.dataValue) {
|
676
|
-
return value === null || _.isEqual(value, this.emptyValue);
|
671
|
+
return value === null || _.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value?.data) && !value?._id);
|
672
|
+
}
|
673
|
+
areAllComponentsEmpty(data) {
|
674
|
+
let res = true;
|
675
|
+
if (this.subForm) {
|
676
|
+
this.subForm.everyComponent((comp) => {
|
677
|
+
const componentValue = _.get(data, comp.key);
|
678
|
+
res &= comp.isEmpty(componentValue);
|
679
|
+
});
|
680
|
+
}
|
681
|
+
else {
|
682
|
+
res = false;
|
683
|
+
}
|
684
|
+
return res;
|
677
685
|
}
|
678
686
|
getValue() {
|
679
687
|
if (this.subForm) {
|
@@ -17,8 +17,8 @@ declare const _default: ({
|
|
17
17
|
tooltip?: undefined;
|
18
18
|
description?: undefined;
|
19
19
|
conditional?: undefined;
|
20
|
-
reorder?: undefined;
|
21
20
|
defaultValue?: undefined;
|
21
|
+
reorder?: undefined;
|
22
22
|
components?: undefined;
|
23
23
|
dataSrc?: undefined;
|
24
24
|
authenticate?: undefined;
|
@@ -59,8 +59,8 @@ declare const _default: ({
|
|
59
59
|
};
|
60
60
|
};
|
61
61
|
data?: undefined;
|
62
|
-
reorder?: undefined;
|
63
62
|
defaultValue?: undefined;
|
63
|
+
reorder?: undefined;
|
64
64
|
components?: undefined;
|
65
65
|
dataSrc?: undefined;
|
66
66
|
authenticate?: undefined;
|
@@ -88,6 +88,7 @@ declare const _default: ({
|
|
88
88
|
key: string;
|
89
89
|
tooltip: string;
|
90
90
|
weight: number;
|
91
|
+
defaultValue: boolean;
|
91
92
|
conditional: {
|
92
93
|
json: {
|
93
94
|
and: ({
|
@@ -110,7 +111,6 @@ declare const _default: ({
|
|
110
111
|
editor?: undefined;
|
111
112
|
description?: undefined;
|
112
113
|
reorder?: undefined;
|
113
|
-
defaultValue?: undefined;
|
114
114
|
components?: undefined;
|
115
115
|
dataSrc?: undefined;
|
116
116
|
authenticate?: undefined;
|
@@ -220,8 +220,8 @@ declare const _default: ({
|
|
220
220
|
as?: undefined;
|
221
221
|
editor?: undefined;
|
222
222
|
description?: undefined;
|
223
|
-
reorder?: undefined;
|
224
223
|
defaultValue?: undefined;
|
224
|
+
reorder?: undefined;
|
225
225
|
components?: undefined;
|
226
226
|
skipMerge?: undefined;
|
227
227
|
refreshOn?: undefined;
|
@@ -256,8 +256,8 @@ declare const _default: ({
|
|
256
256
|
data?: undefined;
|
257
257
|
as?: undefined;
|
258
258
|
editor?: undefined;
|
259
|
-
reorder?: undefined;
|
260
259
|
defaultValue?: undefined;
|
260
|
+
reorder?: undefined;
|
261
261
|
components?: undefined;
|
262
262
|
dataSrc?: undefined;
|
263
263
|
authenticate?: undefined;
|
@@ -328,8 +328,8 @@ declare const _default: ({
|
|
328
328
|
as?: undefined;
|
329
329
|
editor?: undefined;
|
330
330
|
description?: undefined;
|
331
|
-
reorder?: undefined;
|
332
331
|
defaultValue?: undefined;
|
332
|
+
reorder?: undefined;
|
333
333
|
components?: undefined;
|
334
334
|
authenticate?: undefined;
|
335
335
|
placeholder?: undefined;
|
@@ -363,8 +363,8 @@ declare const _default: ({
|
|
363
363
|
editor?: undefined;
|
364
364
|
description?: undefined;
|
365
365
|
conditional?: undefined;
|
366
|
-
reorder?: undefined;
|
367
366
|
defaultValue?: undefined;
|
367
|
+
reorder?: undefined;
|
368
368
|
components?: undefined;
|
369
369
|
authenticate?: undefined;
|
370
370
|
valueProperty?: undefined;
|
@@ -395,8 +395,8 @@ declare const _default: ({
|
|
395
395
|
editor?: undefined;
|
396
396
|
description?: undefined;
|
397
397
|
conditional?: undefined;
|
398
|
-
reorder?: undefined;
|
399
398
|
defaultValue?: undefined;
|
399
|
+
reorder?: undefined;
|
400
400
|
components?: undefined;
|
401
401
|
dataSrc?: undefined;
|
402
402
|
authenticate?: undefined;
|
@@ -436,8 +436,8 @@ declare const _default: ({
|
|
436
436
|
as?: undefined;
|
437
437
|
editor?: undefined;
|
438
438
|
description?: undefined;
|
439
|
-
reorder?: undefined;
|
440
439
|
defaultValue?: undefined;
|
440
|
+
reorder?: undefined;
|
441
441
|
components?: undefined;
|
442
442
|
dataSrc?: undefined;
|
443
443
|
authenticate?: undefined;
|
@@ -478,8 +478,8 @@ declare const _default: ({
|
|
478
478
|
data?: undefined;
|
479
479
|
as?: undefined;
|
480
480
|
editor?: undefined;
|
481
|
-
reorder?: undefined;
|
482
481
|
defaultValue?: undefined;
|
482
|
+
reorder?: undefined;
|
483
483
|
components?: undefined;
|
484
484
|
dataSrc?: undefined;
|
485
485
|
authenticate?: undefined;
|
@@ -626,8 +626,8 @@ declare const _default: ({
|
|
626
626
|
data?: undefined;
|
627
627
|
as?: undefined;
|
628
628
|
editor?: undefined;
|
629
|
-
reorder?: undefined;
|
630
629
|
defaultValue?: undefined;
|
630
|
+
reorder?: undefined;
|
631
631
|
components?: undefined;
|
632
632
|
dataSrc?: undefined;
|
633
633
|
authenticate?: undefined;
|
@@ -669,8 +669,8 @@ declare const _default: ({
|
|
669
669
|
data?: undefined;
|
670
670
|
as?: undefined;
|
671
671
|
description?: undefined;
|
672
|
-
reorder?: undefined;
|
673
672
|
defaultValue?: undefined;
|
673
|
+
reorder?: undefined;
|
674
674
|
components?: undefined;
|
675
675
|
dataSrc?: undefined;
|
676
676
|
authenticate?: undefined;
|
@@ -718,8 +718,8 @@ declare const _default: ({
|
|
718
718
|
as?: undefined;
|
719
719
|
editor?: undefined;
|
720
720
|
description?: undefined;
|
721
|
-
reorder?: undefined;
|
722
721
|
defaultValue?: undefined;
|
722
|
+
reorder?: undefined;
|
723
723
|
components?: undefined;
|
724
724
|
authenticate?: undefined;
|
725
725
|
template?: undefined;
|
@@ -932,8 +932,8 @@ declare const _default: ({
|
|
932
932
|
as?: undefined;
|
933
933
|
editor?: undefined;
|
934
934
|
description?: undefined;
|
935
|
-
reorder?: undefined;
|
936
935
|
defaultValue?: undefined;
|
936
|
+
reorder?: undefined;
|
937
937
|
components?: undefined;
|
938
938
|
dataSrc?: undefined;
|
939
939
|
authenticate?: undefined;
|
@@ -965,8 +965,8 @@ declare const _default: ({
|
|
965
965
|
editor?: undefined;
|
966
966
|
description?: undefined;
|
967
967
|
conditional?: undefined;
|
968
|
-
reorder?: undefined;
|
969
968
|
defaultValue?: undefined;
|
969
|
+
reorder?: undefined;
|
970
970
|
components?: undefined;
|
971
971
|
dataSrc?: undefined;
|
972
972
|
authenticate?: undefined;
|
@@ -1035,8 +1035,8 @@ declare const _default: ({
|
|
1035
1035
|
tooltip?: undefined;
|
1036
1036
|
description?: undefined;
|
1037
1037
|
conditional?: undefined;
|
1038
|
-
reorder?: undefined;
|
1039
1038
|
defaultValue?: undefined;
|
1039
|
+
reorder?: undefined;
|
1040
1040
|
components?: undefined;
|
1041
1041
|
dataSrc?: undefined;
|
1042
1042
|
authenticate?: undefined;
|
@@ -1115,8 +1115,8 @@ declare const _default: ({
|
|
1115
1115
|
label?: undefined;
|
1116
1116
|
tooltip?: undefined;
|
1117
1117
|
description?: undefined;
|
1118
|
-
reorder?: undefined;
|
1119
1118
|
defaultValue?: undefined;
|
1119
|
+
reorder?: undefined;
|
1120
1120
|
components?: undefined;
|
1121
1121
|
dataSrc?: undefined;
|
1122
1122
|
authenticate?: undefined;
|
@@ -1150,8 +1150,8 @@ declare const _default: ({
|
|
1150
1150
|
tooltip?: undefined;
|
1151
1151
|
description?: undefined;
|
1152
1152
|
conditional?: undefined;
|
1153
|
-
reorder?: undefined;
|
1154
1153
|
defaultValue?: undefined;
|
1154
|
+
reorder?: undefined;
|
1155
1155
|
components?: undefined;
|
1156
1156
|
dataSrc?: undefined;
|
1157
1157
|
authenticate?: undefined;
|
@@ -77,6 +77,7 @@ export default [
|
|
77
77
|
key: 'lazyLoad',
|
78
78
|
tooltip: 'When set, this will not fire off the request to the URL until this control is within focus. This can improve performance if you have many Select dropdowns on your form where the API\'s will only fire when the control is activated.',
|
79
79
|
weight: 11,
|
80
|
+
defaultValue: true,
|
80
81
|
conditional: {
|
81
82
|
json: {
|
82
83
|
and: [
|
@@ -118,7 +118,7 @@ export default class SurveyComponent extends Field {
|
|
118
118
|
return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);
|
119
119
|
}
|
120
120
|
getInputName(question) {
|
121
|
-
return `${this.options.name}[${question.value}]`;
|
121
|
+
return `${this.options.name}[${question.value}][${this.id}]`;
|
122
122
|
}
|
123
123
|
getValueAsString(value, options) {
|
124
124
|
if (options?.email) {
|
@@ -57,7 +57,15 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
57
57
|
info.content = value;
|
58
58
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
59
59
|
const elementStyle = this.info.attr.style || '';
|
60
|
-
const children =
|
60
|
+
const children = `
|
61
|
+
<div ${this._referenceAttributeName}="input"
|
62
|
+
class="formio-editor-read-only-content"
|
63
|
+
${elementStyle ? `style='${elementStyle}'` : ''}
|
64
|
+
role="textbox"
|
65
|
+
aria-multiline="true"
|
66
|
+
aria-readonly="true"
|
67
|
+
>
|
68
|
+
</div>`;
|
61
69
|
return this.renderTemplate('well', {
|
62
70
|
children,
|
63
71
|
nestedKey: this.key,
|
@@ -1,22 +1,26 @@
|
|
1
|
+
import { unionWith } from 'lodash';
|
1
2
|
import UnknownEditDisplay from './editForm/Unknown.edit.display';
|
3
|
+
import EditFormUtils from '../../components/_classes/component/editForm/utils';
|
2
4
|
/**
|
3
5
|
* Unknown Component schema.
|
6
|
+
* @param {...any} extend
|
4
7
|
* @returns {object} - The Unknown Component edit form.
|
5
8
|
*/
|
6
|
-
export default function () {
|
9
|
+
export default function (...extend) {
|
10
|
+
const components = [
|
11
|
+
{
|
12
|
+
label: 'Custom',
|
13
|
+
key: 'display',
|
14
|
+
weight: 0,
|
15
|
+
components: UnknownEditDisplay
|
16
|
+
}
|
17
|
+
].concat(...extend);
|
7
18
|
return {
|
8
19
|
components: [
|
9
20
|
{
|
10
21
|
type: 'tabs',
|
11
22
|
key: 'tabs',
|
12
|
-
components:
|
13
|
-
{
|
14
|
-
label: 'Custom',
|
15
|
-
key: 'display',
|
16
|
-
weight: 0,
|
17
|
-
components: UnknownEditDisplay
|
18
|
-
}
|
19
|
-
]
|
23
|
+
components: unionWith(components, EditFormUtils.unifyComponents)
|
20
24
|
}
|
21
25
|
]
|
22
26
|
};
|
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
29
|
-
export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
30
|
-
export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
32
32
|
export const getContextualRowPath: typeof Utils.getContextualRowPath;
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
package/lib/mjs/utils/utils.js
CHANGED
@@ -8,6 +8,7 @@ import dompurify from 'dompurify';
|
|
8
8
|
import { getValue } from './formUtils';
|
9
9
|
import { Evaluator } from './Evaluator';
|
10
10
|
import ConditionOperators from './conditionOperators';
|
11
|
+
import { convertShowToBoolean } from '@formio/core';
|
11
12
|
const interpolate = Evaluator.interpolate;
|
12
13
|
export * from './formUtils';
|
13
14
|
// Configure JsonLogic
|
@@ -236,7 +237,7 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
236
237
|
default:
|
237
238
|
result = _.every(conditionsResult.flat(), res => !!res);
|
238
239
|
}
|
239
|
-
return show ? result : !result;
|
240
|
+
return convertShowToBoolean(show) ? result : !result;
|
240
241
|
}
|
241
242
|
}
|
242
243
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.0-dev.
|
3
|
+
"version": "5.1.0-dev.6070.c51663f",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
82
82
|
"dependencies": {
|
83
83
|
"@formio/bootstrap": "v3.0.0-dev.121.085d187",
|
84
|
-
"@formio/core": "v2.4.0-dev.
|
84
|
+
"@formio/core": "v2.4.0-dev.232.d91b1e4",
|
85
85
|
"@formio/text-mask-addons": "3.8.0-formio.4",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|