useFlattenRecords.d.ts 672 B

12345678910111213141516171819
  1. import type { GetRowKey, Key } from '../interface';
  2. export interface FlattenData<RecordType> {
  3. record: RecordType;
  4. indent: number;
  5. index: number;
  6. rowKey: Key;
  7. }
  8. /**
  9. * flat tree data on expanded state
  10. *
  11. * @export
  12. * @template T
  13. * @param {*} data : table data
  14. * @param {string} childrenColumnName : 指定树形结构的列名
  15. * @param {Set<Key>} expandedKeys : 展开的行对应的keys
  16. * @param {GetRowKey<T>} getRowKey : 获取当前rowKey的方法
  17. * @returns flattened data
  18. */
  19. export default function useFlattenRecords<T>(data: T[] | readonly T[], childrenColumnName: string, expandedKeys: Set<Key>, getRowKey: GetRowKey<T>): FlattenData<T>[];