mapTree.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import { XEUtilsMethods } from '../xe-utils'
  2. export declare function mapTreeIterate(item: any, index: number, items: any[], path: string[], parent: any, nodes: any[]): any;
  3. interface MapTreeOptions {
  4. children?: string;
  5. mapChildren?: string;
  6. }
  7. /**
  8. * 从树结构中指定方法后的返回值组成的新数组
  9. * @param {Object} obj 对象/数组
  10. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  11. * @param {Object} options {children: 'children', mapChildren: 'children}
  12. * @param {Object} context 上下文
  13. */
  14. export declare function mapTree(array: any[], iterate: typeof mapTreeIterate, options?: MapTreeOptions, context?: any): any[];
  15. declare module '../xe-utils' {
  16. interface XEUtilsMethods {
  17. /**
  18. * 从树结构中指定方法后的返回值组成的新数组
  19. * @param {Object} obj 对象/数组
  20. * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  21. * @param {Object} options {children: 'children', mapChildren: 'children}
  22. * @param {Object} context 上下文
  23. */
  24. mapTree: typeof mapTree;
  25. }
  26. }
  27. export default mapTree