Skip to content

Commit

Permalink
fix(Tree): set checkedStrategy check error
Browse files Browse the repository at this point in the history
  • Loading branch information
myronliu347 committed Jun 20, 2019
1 parent 9b1c07d commit fa3c164
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/tree/view/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export function normalizeToArray(keys) {
* @param {Object} _k2n
*/
export function filterChildKey(keys, _k2n) {
const newKeys = [...keys].sort((prev, next) => {
return getDepth(prev, _k2n) - getDepth(next, _k2n);
});
const newKeys = [...keys]
.filter(key => !!_k2n[key])
.sort((prev, next) => {
return getDepth(prev, _k2n) - getDepth(next, _k2n);
});

for (let i = 0; i < newKeys.length; i++) {
for (let j = 0; j < newKeys.length; j++) {
Expand All @@ -36,9 +38,11 @@ export function filterChildKey(keys, _k2n) {
}

export function filterParentKey(keys, _k2n) {
const newKeys = [...keys].sort((prev, next) => {
return getDepth(next, _k2n) - getDepth(prev, _k2n);
});
const newKeys = [...keys]
.filter(key => !!_k2n[key])
.sort((prev, next) => {
return getDepth(next, _k2n) - getDepth(prev, _k2n);
});

for (let i = 0; i < newKeys.length; i++) {
for (let j = 0; j < newKeys.length; j++) {
Expand Down

0 comments on commit fa3c164

Please sign in to comment.