Fixed Checkbox state in MultiSelect
parent
06f9b5f630
commit
827b8d1914
|
@ -49,6 +49,9 @@ export default {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
this.d_value = newValue;
|
this.d_value = newValue;
|
||||||
},
|
},
|
||||||
|
defaultValue(newValue) {
|
||||||
|
this.d_value = newValue;
|
||||||
|
},
|
||||||
formControl: {
|
formControl: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(newValue) {
|
handler(newValue) {
|
||||||
|
@ -66,11 +69,13 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
updateValue(value, event) {
|
updateValue(value, event) {
|
||||||
// uncontrolled
|
// uncontrolled
|
||||||
this.d_value = value;
|
if (this.uncontolled) {
|
||||||
this.$emit('value-change', value);
|
this.$emit('value-change', value);
|
||||||
|
} else {
|
||||||
// controlled
|
// controlled
|
||||||
|
this.d_value = value;
|
||||||
this.$emit('update:modelValue', value);
|
this.$emit('update:modelValue', value);
|
||||||
|
}
|
||||||
|
|
||||||
this.formField.onChange?.({ originalEvent: event, value });
|
this.formField.onChange?.({ originalEvent: event, value });
|
||||||
}
|
}
|
||||||
|
@ -85,6 +90,9 @@ export default {
|
||||||
$formName() {
|
$formName() {
|
||||||
return this.formControl?.name || this.name;
|
return this.formControl?.name || this.name;
|
||||||
},
|
},
|
||||||
|
uncontolled() {
|
||||||
|
return this.defaultValue !== undefined && this.modelValue === undefined;
|
||||||
|
},
|
||||||
// @deprecated use $filled instead
|
// @deprecated use $filled instead
|
||||||
filled() {
|
filled() {
|
||||||
return this.$filled;
|
return this.$filled;
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
:data-p-focused="focusedOptionIndex === getOptionIndex(i, getItemOptions)"
|
:data-p-focused="focusedOptionIndex === getOptionIndex(i, getItemOptions)"
|
||||||
:data-p-disabled="isOptionDisabled(option)"
|
:data-p-disabled="isOptionDisabled(option)"
|
||||||
>
|
>
|
||||||
<Checkbox :modelValue="isSelected(option)" :binary="true" :tabindex="-1" :variant="variant" :unstyled="unstyled" :pt="getCheckboxPTOptions(option, getItemOptions, i, 'pcOptionCheckbox')">
|
<Checkbox :defaultValue="isSelected(option)" :binary="true" :tabindex="-1" :variant="variant" :unstyled="unstyled" :pt="getCheckboxPTOptions(option, getItemOptions, i, 'pcOptionCheckbox')">
|
||||||
<template #icon="slotProps">
|
<template #icon="slotProps">
|
||||||
<component v-if="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :is="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :checked="slotProps.checked" :class="slotProps.class" />
|
<component v-if="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :is="$slots.optioncheckboxicon || $slots.itemcheckboxicon" :checked="slotProps.checked" :class="slotProps.class" />
|
||||||
<component
|
<component
|
||||||
|
|
Loading…
Reference in New Issue