Skip to content

Commit

Permalink
Refactor #6538
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Oct 11, 2024
1 parent a745ec7 commit 22d6f8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/primevue/src/cascadeselect/CascadeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
:optionGroupIcon="optionGroupIcon"
:optionGroupLabel="optionGroupLabel"
:optionGroupChildren="optionGroupChildren"
:value="modelValue"
@option-change="onOptionClick"
@option-focus-change="onOptionMouseMove"
@option-focus-enter-change="onOptionMouseEnter"
Expand Down
10 changes: 5 additions & 5 deletions packages/primevue/src/cascadeselect/CascadeSelectSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
:optionGroupIcon="optionGroupIcon"
:optionGroupLabel="optionGroupLabel"
:optionGroupChildren="optionGroupChildren"
:value="value"
@option-change="$emit('option-change', $event)"
@option-focus-change="$emit('option-focus-change', $event)"
@option-focus-enter-change="$emit('option-focus-enter-change', $event)"
Expand All @@ -63,11 +64,10 @@
</template>

<script>
import { isNotEmpty, resolveFieldData } from '@primeuix/utils/object';
import { equals, isNotEmpty, resolveFieldData } from '@primeuix/utils/object';
import BaseComponent from '@primevue/core/basecomponent';
import AngleRightIcon from '@primevue/icons/angleright';
import Ripple from 'primevue/ripple';
export default {
name: 'CascadeSelectSub',
hostName: 'CascadeSelect',
Expand All @@ -89,9 +89,9 @@ export default {
},
activeOptionPath: Array,
level: Number,
templates: null
templates: null,
value: null
},
methods: {
getOptionId(processedOption) {
return `${this.selectId}_${processedOption.key}`;
Expand Down Expand Up @@ -128,7 +128,7 @@ export default {
return isNotEmpty(processedOption.children);
},
isOptionSelected(processedOption) {
return !this.isOptionGroup(processedOption) && this.isOptionActive(processedOption);
return equals(this.value, processedOption?.option);
},
isOptionActive(processedOption) {
return this.activeOptionPath.some((path) => path.key === processedOption.key);
Expand Down

0 comments on commit 22d6f8a

Please sign in to comment.