Skip to content

Commit

Permalink
fix(comp:tree): indeterminateKeys shouldn't check disabled state
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Dec 23, 2022
1 parent f19efbe commit 20b1845
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 2 additions & 7 deletions packages/components/tree/src/composables/useCheckable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,15 @@ export function useCheckable(props: TreeProps, mergedNodeMap: ComputedRef<Map<VK
}

const indeterminateKeySet = new Set<VKey>()
const disabledKeys = checkDisabledKeys.value
const nodeMap = mergedNodeMap.value
_checkedKeys.forEach(key => {
const { parentKey } = nodeMap.get(key) || {}
if (!isNil(parentKey)) {
let parent = nodeMap.get(parentKey)
if (parent && !_checkedKeys.includes(parent.key)) {
if (!disabledKeys.includes(parentKey)) {
indeterminateKeySet.add(parentKey)
}
indeterminateKeySet.add(parentKey)
while (parent && !isNil(parent.parentKey)) {
if (!disabledKeys.includes(parent.parentKey)) {
indeterminateKeySet.add(parent.parentKey)
}
indeterminateKeySet.add(parent.parentKey)
parent = nodeMap.get(parent.parentKey)
}
}
Expand Down
9 changes: 8 additions & 1 deletion packages/pro/transfer/demo/BasicTree.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<template>
<IxProTransfer v-model:value="targetKeys" type="tree" :data-source="dataSource" />
<IxProTransfer
v-model:value="targetKeys"
type="tree"
disabled
mode="immediate"
:data-source="dataSource"
flat-target-data
/>
</template>

<script setup lang="ts">
Expand Down

0 comments on commit 20b1845

Please sign in to comment.