searchTree.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { XEUtilsMethods } from '../xe-utils'
  2. export declare function searchTreeIterate(item: any, index: number, items: any[], path: string[], parent: any, nodes: any[]): any;
  3. export interface SearchTreeOptions {
  4. children?: string;
  5. mapChildren?: string;
  6. original?: boolean;
  7. data?: string;
  8. }
  9. /**
  10. * 从树结构中根据回调查找数据
  11. * @param {Object} obj 对象/数组
  12. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  13. * @param {Object} options {children: 'children'}
  14. * @param {Object} context 上下文
  15. */
  16. export declare function searchTree(array: any[], iterate: typeof searchTreeIterate, options?: SearchTreeOptions, context?: any): any[];
  17. declare module '../xe-utils' {
  18. interface XEUtilsMethods {
  19. /**
  20. * 从树结构中根据回调查找数据
  21. * @param {Object} obj 对象/数组
  22. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  23. * @param {Object} options {children: 'children'}
  24. * @param {Object} context 上下文
  25. */
  26. searchTree: typeof searchTree;
  27. }
  28. }
  29. export default searchTree