pull/6569/head
tugcekucukoglu 2024-10-11 20:22:09 +03:00
parent a745ec7d43
commit 22d6f8a037
2 changed files with 6 additions and 5 deletions

View File

@ -71,6 +71,7 @@
:optionGroupIcon="optionGroupIcon" :optionGroupIcon="optionGroupIcon"
:optionGroupLabel="optionGroupLabel" :optionGroupLabel="optionGroupLabel"
:optionGroupChildren="optionGroupChildren" :optionGroupChildren="optionGroupChildren"
:value="modelValue"
@option-change="onOptionClick" @option-change="onOptionClick"
@option-focus-change="onOptionMouseMove" @option-focus-change="onOptionMouseMove"
@option-focus-enter-change="onOptionMouseEnter" @option-focus-enter-change="onOptionMouseEnter"

View File

@ -51,6 +51,7 @@
:optionGroupIcon="optionGroupIcon" :optionGroupIcon="optionGroupIcon"
:optionGroupLabel="optionGroupLabel" :optionGroupLabel="optionGroupLabel"
:optionGroupChildren="optionGroupChildren" :optionGroupChildren="optionGroupChildren"
:value="value"
@option-change="$emit('option-change', $event)" @option-change="$emit('option-change', $event)"
@option-focus-change="$emit('option-focus-change', $event)" @option-focus-change="$emit('option-focus-change', $event)"
@option-focus-enter-change="$emit('option-focus-enter-change', $event)" @option-focus-enter-change="$emit('option-focus-enter-change', $event)"
@ -63,11 +64,10 @@
</template> </template>
<script> <script>
import { isNotEmpty, resolveFieldData } from '@primeuix/utils/object'; import { equals, isNotEmpty, resolveFieldData } from '@primeuix/utils/object';
import BaseComponent from '@primevue/core/basecomponent'; import BaseComponent from '@primevue/core/basecomponent';
import AngleRightIcon from '@primevue/icons/angleright'; import AngleRightIcon from '@primevue/icons/angleright';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
export default { export default {
name: 'CascadeSelectSub', name: 'CascadeSelectSub',
hostName: 'CascadeSelect', hostName: 'CascadeSelect',
@ -89,9 +89,9 @@ export default {
}, },
activeOptionPath: Array, activeOptionPath: Array,
level: Number, level: Number,
templates: null templates: null,
value: null
}, },
methods: { methods: {
getOptionId(processedOption) { getOptionId(processedOption) {
return `${this.selectId}_${processedOption.key}`; return `${this.selectId}_${processedOption.key}`;
@ -128,7 +128,7 @@ export default {
return isNotEmpty(processedOption.children); return isNotEmpty(processedOption.children);
}, },
isOptionSelected(processedOption) { isOptionSelected(processedOption) {
return !this.isOptionGroup(processedOption) && this.isOptionActive(processedOption); return equals(this.value, processedOption?.option);
}, },
isOptionActive(processedOption) { isOptionActive(processedOption) {
return this.activeOptionPath.some((path) => path.key === processedOption.key); return this.activeOptionPath.some((path) => path.key === processedOption.key);