@teammodlr/ui-kit 3.0.0-beta.37 → 3.0.0-beta.38
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/components/select/Select.vue.d.ts +9 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +1627 -1622
- package/package.json +1 -1
- package/src/components/select/Select.vue +17 -4
package/package.json
CHANGED
|
@@ -233,6 +233,11 @@ export default defineComponent({
|
|
|
233
233
|
type: Boolean,
|
|
234
234
|
default: false
|
|
235
235
|
},
|
|
236
|
+
// Value a single select resets to when cleared (e.g. a "Don't restrict" option)
|
|
237
|
+
clearValue: {
|
|
238
|
+
type: [String, Number, Boolean, Object] as PropType<string | number | boolean | object | null>,
|
|
239
|
+
default: undefined
|
|
240
|
+
},
|
|
236
241
|
showDataOptions: {
|
|
237
242
|
type: Boolean,
|
|
238
243
|
default: true
|
|
@@ -624,9 +629,15 @@ export default defineComponent({
|
|
|
624
629
|
}
|
|
625
630
|
|
|
626
631
|
const hasValue = computed(() => {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
632
|
+
if (props.multiple) {
|
|
633
|
+
return Array.isArray(selected.value) && selected.value.length > 0;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (props.clearValue !== undefined && selected.value === props.clearValue) {
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return !!selected.value;
|
|
630
641
|
});
|
|
631
642
|
|
|
632
643
|
const showClear = computed(() => {
|
|
@@ -637,7 +648,9 @@ export default defineComponent({
|
|
|
637
648
|
});
|
|
638
649
|
|
|
639
650
|
function clearSelected() {
|
|
640
|
-
selected.value = props.multiple
|
|
651
|
+
selected.value = props.multiple
|
|
652
|
+
? []
|
|
653
|
+
: (props.clearValue !== undefined ? props.clearValue : '');
|
|
641
654
|
emit('clear');
|
|
642
655
|
container.value?.focus();
|
|
643
656
|
}
|