util.d.ts 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { type ElTooltipProps } from 'element-plus/es/components/tooltip';
  2. import type { Table, TreeProps } from './table/defaults';
  3. import type { TableColumnCtx } from './table-column/defaults';
  4. import type { VNode } from 'vue';
  5. export type TableOverflowTooltipOptions = Partial<Pick<ElTooltipProps, 'appendTo' | 'effect' | 'enterable' | 'hideAfter' | 'offset' | 'placement' | 'popperClass' | 'popperOptions' | 'showAfter' | 'showArrow' | 'transition'>>;
  6. export type TableOverflowTooltipFormatter<T = any> = (data: {
  7. row: T;
  8. column: TableColumnCtx<T>;
  9. cellValue: any;
  10. }) => VNode | string;
  11. type RemovePopperFn = (() => void) & {
  12. trigger?: HTMLElement;
  13. vm?: VNode;
  14. };
  15. export declare const getCell: (event: Event) => HTMLTableCellElement | null;
  16. export declare const orderBy: <T>(array: T[], sortKey: string, reverse: string | number, sortMethod: any, sortBy: string | (string | ((a: T, b: T, array?: T[]) => number))[]) => T[];
  17. export declare const getColumnById: <T>(table: {
  18. columns: TableColumnCtx<T>[];
  19. }, columnId: string) => null | TableColumnCtx<T>;
  20. export declare const getColumnByKey: <T>(table: {
  21. columns: TableColumnCtx<T>[];
  22. }, columnKey: string) => TableColumnCtx<T>;
  23. export declare const getColumnByCell: <T>(table: {
  24. columns: TableColumnCtx<T>[];
  25. }, cell: HTMLElement, namespace: string) => null | TableColumnCtx<T>;
  26. export declare const getRowIdentity: <T>(row: T, rowKey: string | ((row: T) => any)) => string;
  27. export declare const getKeysMap: <T>(array: T[], rowKey: string, flatten?: boolean, childrenKey?: string) => Record<string, {
  28. row: T;
  29. index: number;
  30. }>;
  31. export declare function mergeOptions<T, K>(defaults: T, config: K): T & K;
  32. export declare function parseWidth(width: number | string): number | string;
  33. export declare function parseMinWidth(minWidth: number | string): number | string;
  34. export declare function parseHeight(height: number | string): string | number | null;
  35. export declare function compose(...funcs: any[]): any;
  36. export declare function toggleRowStatus<T>(statusArr: T[], row: T, newVal?: boolean, tableTreeProps?: TreeProps, selectable?: (row: T, index?: number) => boolean, rowIndex?: number): boolean;
  37. export declare function walkTreeNode(root: any, cb: any, childrenKey?: string, lazyKey?: string): void;
  38. export declare let removePopper: RemovePopperFn | null;
  39. export declare function createTablePopper(props: TableOverflowTooltipOptions, popperContent: string, row: T, column: TableColumnCtx<T>, trigger: HTMLElement, table: Table<[]>): void;
  40. export declare const isFixedColumn: <T>(index: number, fixed: string | boolean, store: any, realColumns?: TableColumnCtx<T>[]) => {
  41. direction: string;
  42. start: number;
  43. after: number;
  44. } | {
  45. direction?: undefined;
  46. start?: undefined;
  47. after?: undefined;
  48. };
  49. export declare const getFixedColumnsClass: <T>(namespace: string, index: number, fixed: string | boolean, store: any, realColumns?: TableColumnCtx<T>[], offset?: number) => string[];
  50. export declare const getFixedColumnOffset: <T>(index: number, fixed: string | boolean, store: any, realColumns?: TableColumnCtx<T>[]) => any;
  51. export declare const ensurePosition: (style: any, key: string) => void;
  52. export {};