-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
function dig(list: DefaultOptionType[], keepAll: boolean = false) { |
function dig(list: DefaultOptionType[], keepAll: boolean = false): DefaultOptionType[] {
function digRecursive(list: DefaultOptionType[], result: DefaultOptionType[]): DefaultOptionType[] {
if (list.length === 0) {
return result;
}
const dataNode = list[0];
const children = dataNode[fieldChildren];
const match = keepAll || filterOptionFunc(searchValue, fillLegacyProps(dataNode));
const childList = dig(children || [], match);
if (match || childList.length) {
result.push({
...dataNode,
isLeaf: undefined,
[fieldChildren]: childList,
});
}
return digRecursive(list.slice(1), result);
}
return digRecursive(list, []);
}
Metadata
Metadata
Assignees
Labels
No labels