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