|
|
@ -62,9 +62,7 @@ export function createTreeNodeFilterCreator<T extends object>( |
|
|
const regex = new RegExp('.*' + search + '.*', 'i'); |
|
|
const regex = new RegExp('.*' + search + '.*', 'i'); |
|
|
|
|
|
|
|
|
return function collectNodes(nodes: TreeNode<T>[], matches = []) { |
|
|
return function collectNodes(nodes: TreeNode<T>[], matches = []) { |
|
|
for (let i = 0; i < nodes.length; i++) { |
|
|
for (const node of nodes) { |
|
|
const node = nodes[i]; |
|
|
|
|
|
|
|
|
|
|
|
if (regex.test(mapperFn(node[key]))) matches.push(node); |
|
|
if (regex.test(mapperFn(node[key]))) matches.push(node); |
|
|
|
|
|
|
|
|
if (node.children.length) collectNodes(node.children, matches); |
|
|
if (node.children.length) collectNodes(node.children, matches); |
|
|
|