searchTree.d.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. export interface SearchTreeOptions {
  2. children?: string;
  3. mapChildren?: string;
  4. original?: boolean;
  5. data?: string;
  6. }
  7. /**
  8. * 从树结构中根据回调查找数据
  9. * @param {Object} list 对象/数组
  10. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  11. * @param {Object} options {children: 'children'}
  12. * @param {Object} context 上下文
  13. */
  14. export declare function searchTree<T>(list: T[], iterate: (item: T, index: number, items: T[], path: string[], parent: T, nodes: T[]) => boolean, options?: SearchTreeOptions, context?: any): T[];
  15. export declare function searchTree(list: any[], iterate: (item: any, index: number, items: any[], path: string[], parent: any, nodes: any[]) => boolean, options?: SearchTreeOptions, context?: any): any[];
  16. export declare function searchTree(list: any, iterate: (item: any, index: number, items: any, path: string, parent: any, nodes: any) => boolean, options?: SearchTreeOptions, context?: any): any[];
  17. declare module './ctor' {
  18. interface XEUtilsMethods {
  19. searchTree: typeof searchTree;
  20. }
  21. }
  22. export default searchTree