@formio/js 5.1.0-dev.6217.4c14467 → 5.1.0-dev.6220.2e623f9
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 +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/WebformBuilder.js +5 -3
- package/lib/cjs/components/_classes/component/Component.js +5 -2
- package/lib/cjs/components/number/Number.js +4 -1
- package/lib/mjs/WebformBuilder.js +5 -3
- package/lib/mjs/components/_classes/component/Component.js +5 -2
- package/lib/mjs/components/number/Number.js +4 -1
- package/package.json +1 -1
@@ -529,8 +529,8 @@ class WebformBuilder extends Component_1.default {
|
|
529
529
|
}
|
530
530
|
return elem;
|
531
531
|
};
|
532
|
-
const hideShow = (group,
|
533
|
-
if (show) {
|
532
|
+
const hideShow = (group, forceShow, toggle = false) => {
|
533
|
+
if (forceShow || (toggle && !Array.from(group.classList).includes('show'))) {
|
534
534
|
group.classList.add(['show']);
|
535
535
|
group.style.display = 'inherit';
|
536
536
|
}
|
@@ -552,7 +552,9 @@ class WebformBuilder extends Component_1.default {
|
|
552
552
|
const openByDefault = getAttribute(group, 'default') === 'true';
|
553
553
|
const groupId = group.getAttribute('id').slice('group-'.length);
|
554
554
|
const groupParent = getAttribute(group, 'parent').slice('#builder-sidebar-'.length);
|
555
|
-
|
555
|
+
if (((openByDefault && groupParent === clickedId) || groupId === clickedParentId || groupIndex === index)) {
|
556
|
+
hideShow(group, false, true);
|
557
|
+
}
|
556
558
|
});
|
557
559
|
}, true);
|
558
560
|
});
|
@@ -633,10 +633,13 @@ class Component extends Element_1.default {
|
|
633
633
|
if (!component) {
|
634
634
|
component = this.component;
|
635
635
|
}
|
636
|
+
if (!this.path) {
|
637
|
+
return false;
|
638
|
+
}
|
636
639
|
if (lodash_1.default.isArray(this.options[visibility])) {
|
637
|
-
return this.options[visibility].includes(
|
640
|
+
return this.options[visibility].includes(this.path);
|
638
641
|
}
|
639
|
-
return this.options[visibility][
|
642
|
+
return this.options[visibility][this.path];
|
640
643
|
}
|
641
644
|
shouldForceHide(component) {
|
642
645
|
return this.shouldForceVisibility(component, 'hide');
|
@@ -91,10 +91,13 @@ class NumberComponent extends Input_1.default {
|
|
91
91
|
}
|
92
92
|
get defaultValue() {
|
93
93
|
let defaultValue = super.defaultValue;
|
94
|
-
if (typeof defaultValue === 'string') {
|
94
|
+
if (typeof defaultValue === 'string' && defaultValue) {
|
95
95
|
// Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
|
96
96
|
// parseNumber on it
|
97
97
|
defaultValue = this.parseNumber(defaultValue);
|
98
|
+
if (lodash_1.default.isNaN(defaultValue)) {
|
99
|
+
defaultValue = null;
|
100
|
+
}
|
98
101
|
}
|
99
102
|
if (!defaultValue && this.component.defaultValue === 0) {
|
100
103
|
defaultValue = this.component.defaultValue;
|
@@ -515,8 +515,8 @@ export default class WebformBuilder extends Component {
|
|
515
515
|
}
|
516
516
|
return elem;
|
517
517
|
};
|
518
|
-
const hideShow = (group,
|
519
|
-
if (show) {
|
518
|
+
const hideShow = (group, forceShow, toggle = false) => {
|
519
|
+
if (forceShow || (toggle && !Array.from(group.classList).includes('show'))) {
|
520
520
|
group.classList.add(['show']);
|
521
521
|
group.style.display = 'inherit';
|
522
522
|
}
|
@@ -538,7 +538,9 @@ export default class WebformBuilder extends Component {
|
|
538
538
|
const openByDefault = getAttribute(group, 'default') === 'true';
|
539
539
|
const groupId = group.getAttribute('id').slice('group-'.length);
|
540
540
|
const groupParent = getAttribute(group, 'parent').slice('#builder-sidebar-'.length);
|
541
|
-
|
541
|
+
if (((openByDefault && groupParent === clickedId) || groupId === clickedParentId || groupIndex === index)) {
|
542
|
+
hideShow(group, false, true);
|
543
|
+
}
|
542
544
|
});
|
543
545
|
}, true);
|
544
546
|
});
|
@@ -620,10 +620,13 @@ export default class Component extends Element {
|
|
620
620
|
if (!component) {
|
621
621
|
component = this.component;
|
622
622
|
}
|
623
|
+
if (!this.path) {
|
624
|
+
return false;
|
625
|
+
}
|
623
626
|
if (_.isArray(this.options[visibility])) {
|
624
|
-
return this.options[visibility].includes(
|
627
|
+
return this.options[visibility].includes(this.path);
|
625
628
|
}
|
626
|
-
return this.options[visibility][
|
629
|
+
return this.options[visibility][this.path];
|
627
630
|
}
|
628
631
|
shouldForceHide(component) {
|
629
632
|
return this.shouldForceVisibility(component, 'hide');
|
@@ -89,10 +89,13 @@ export default class NumberComponent extends Input {
|
|
89
89
|
}
|
90
90
|
get defaultValue() {
|
91
91
|
let defaultValue = super.defaultValue;
|
92
|
-
if (typeof defaultValue === 'string') {
|
92
|
+
if (typeof defaultValue === 'string' && defaultValue) {
|
93
93
|
// Default value may be a string or have custom thousands separators or decimal symbols, so we need to call
|
94
94
|
// parseNumber on it
|
95
95
|
defaultValue = this.parseNumber(defaultValue);
|
96
|
+
if (_.isNaN(defaultValue)) {
|
97
|
+
defaultValue = null;
|
98
|
+
}
|
96
99
|
}
|
97
100
|
if (!defaultValue && this.component.defaultValue === 0) {
|
98
101
|
defaultValue = this.component.defaultValue;
|