toArrayTree.d.ts 844 B

12345678910111213141516171819202122232425262728293031
  1. import { OrderByFieldConfs } from './orderBy'
  2. export interface ToArrayTreeOptions<T> {
  3. strict?: boolean;
  4. key?: string;
  5. parentKey?: string;
  6. children?: string;
  7. sortKey?: OrderByFieldConfs<T, any>;
  8. data?: string;
  9. /**
  10. * 已废弃,被 sortKey: { ...,order: 'desc' } 替换
  11. * @deprecated
  12. */
  13. reverse?: boolean;
  14. }
  15. /**
  16. * 将一个带层级的数据列表转成树结构
  17. * @param {Array} list 数组
  18. * @param {Object} options {strict: false, parentKey: 'parentId', key: 'id', children: 'children', data: 'data'}
  19. */
  20. export declare function toArrayTree<T>(list: T[], options?: ToArrayTreeOptions<T>): T[];
  21. export declare function toArrayTree(list: any, options?: ToArrayTreeOptions<any>): any[];
  22. declare module './ctor' {
  23. interface XEUtilsMethods {
  24. toArrayTree: typeof toArrayTree;
  25. }
  26. }
  27. export default toArrayTree