fix: 修复 filterTree 深层级过滤失效的问题 (#3211)

* fix: 修复 filterTree 深层级过滤失效的问题

* 深度优先也要改一下
This commit is contained in:
RickCole 2021-12-16 14:55:38 +08:00 committed by GitHub
parent 73a1e5f246
commit ecc544e692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -891,11 +891,7 @@ export function filterTree<T extends TreeItem>(
? filterTree(item.children, iterator, level + 1, depthFirst)
: undefined;
if (
Array.isArray(children) &&
Array.isArray(item.children) &&
children.length !== item.children.length
) {
if (Array.isArray(children) && Array.isArray(item.children)) {
item = {...item, children: children};
}
@ -915,11 +911,7 @@ export function filterTree<T extends TreeItem>(
depthFirst
);
if (
Array.isArray(children) &&
Array.isArray(item.children) &&
children.length !== item.children.length
) {
if (Array.isArray(children) && Array.isArray(item.children)) {
item = {...item, children: children};
}
}
@ -1593,13 +1585,12 @@ export function JSONTraverse(
});
}
export function convertDateArrayToDate(
value: number[],
types: string[],
date: moment.Moment
): moment.Moment | null {
if (value.length === 0) return date
if (value.length === 0) return date;
for (let i = 0; i < types.length; i++) {
const type = types[i];
// @ts-ignore
@ -1622,7 +1613,7 @@ export function convertDateToObject(value: moment.Moment) {
export function getRange(min: number, max: number, step: number = 1) {
const arr = [];
for (let i = min; i <= max; i += step) {
arr.push(i);
arr.push(i);
}
return arr;
};
}