util.d.ts 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { UseTooltipProps } from "../../tooltip/src/tooltip.js";
  2. import { TableColumnCtx } from "./table-column/defaults.js";
  3. import { DefaultRow, Table, TreeProps } from "./table/defaults.js";
  4. import { CSSProperties, VNode, VNodeArrayChildren } from "vue";
  5. //#region ../../packages/components/table/src/util.d.ts
  6. declare const createTableId: (namespace: string) => string;
  7. declare const createTableColumnId: (parentId: string) => string;
  8. type TableOverflowTooltipOptions = Partial<Omit<UseTooltipProps, 'content' | 'rawContent' | 'persistent' | 'visible' | 'autoClose' | 'referenceEl' | 'triggerTargetEl' | 'virtualRef' | 'virtualTriggering'>>;
  9. type TableOverflowTooltipFormatter<T extends DefaultRow> = (data: {
  10. row: T;
  11. column: TableColumnCtx<T>;
  12. cellValue: any;
  13. }) => VNode | string;
  14. type RemovePopperFn = (() => void) & {
  15. trigger?: HTMLElement;
  16. vm?: VNode;
  17. };
  18. declare const getCell: (event: Event) => HTMLTableCellElement | null;
  19. declare const orderBy: <T extends DefaultRow>(array: T[], sortKey: string | null, reverse: string | number | null, sortMethod: TableColumnCtx<T>["sortMethod"] | null, sortBy: string | string[] | ((a: T, index: number, array?: T[]) => string)) => T[];
  20. declare const getColumnById: <T extends DefaultRow>(table: {
  21. columns: TableColumnCtx<T>[];
  22. }, columnId: string) => null | TableColumnCtx<T>;
  23. declare const getColumnByKey: <T extends DefaultRow>(table: {
  24. columns: TableColumnCtx<T>[];
  25. }, columnKey: string) => TableColumnCtx<T>;
  26. declare const getColumnByCell: <T extends DefaultRow>(table: {
  27. columns: TableColumnCtx<T>[];
  28. }, cell: HTMLElement, namespace: string) => null | TableColumnCtx<T>;
  29. declare const getRowIdentity: <T extends DefaultRow>(row: T, rowKey: string | ((row: T) => string) | null) => string;
  30. declare const getKeysMap: <T extends DefaultRow>(array: T[], rowKey: string | null, flatten?: boolean, childrenKey?: string) => Record<PropertyKey, {
  31. row: T;
  32. index: number;
  33. }>;
  34. declare function mergeOptions<T extends DefaultRow, K extends DefaultRow>(defaults: T, config: K): T & K;
  35. declare function parseWidth(width?: number | string): number | string;
  36. declare function parseMinWidth(minWidth: number | string): number | string;
  37. declare function parseHeight(height: number | string | null): string | number | null;
  38. declare function compose(...funcs: ((...args: any[]) => void)[]): (...args: any[]) => void;
  39. declare function toggleRowStatus<T extends DefaultRow>(statusArr: T[], row: T, newVal?: boolean, tableTreeProps?: TreeProps, selectable?: ((row: T, index: number) => boolean) | null, rowIndex?: number, rowKey?: string | null): boolean;
  40. declare function walkTreeNode<T extends DefaultRow>(root: T[], cb: (parent: any, children: T | T[] | null, level: number) => void, childrenKey?: string, lazyKey?: string, lazy?: boolean): void;
  41. declare let removePopper: RemovePopperFn | null;
  42. declare function createTablePopper<T extends DefaultRow>(props: TableOverflowTooltipOptions, popperContent: string, row: T, column: TableColumnCtx<T> | null, trigger: HTMLElement | null, table: Table<DefaultRow>): void;
  43. declare const isFixedColumn: <T extends DefaultRow>(index: number, fixed: string | boolean | undefined, store: any, realColumns?: TableColumnCtx<T>[]) => {
  44. direction: string;
  45. start: number;
  46. after: number;
  47. } | {
  48. direction?: undefined;
  49. start?: undefined;
  50. after?: undefined;
  51. };
  52. declare const getFixedColumnsClass: <T extends DefaultRow>(namespace: string, index: number, fixed: string | boolean | undefined, store: any, realColumns?: TableColumnCtx<T>[], offset?: number) => string[];
  53. declare const getFixedColumnOffset: <T extends DefaultRow>(index: number, fixed: string | boolean | undefined, store: any, realColumns?: TableColumnCtx<T>[]) => CSSProperties | undefined;
  54. declare const ensurePosition: <T extends CSSProperties>(style: T | undefined, key: keyof T) => void;
  55. declare function ensureValidVNode(vnodes: VNodeArrayChildren): VNodeArrayChildren | null;
  56. //#endregion
  57. export { TableOverflowTooltipFormatter, TableOverflowTooltipOptions, compose, createTableColumnId, createTableId, createTablePopper, ensurePosition, ensureValidVNode, getCell, getColumnByCell, getColumnById, getColumnByKey, getFixedColumnOffset, getFixedColumnsClass, getKeysMap, getRowIdentity, isFixedColumn, mergeOptions, orderBy, parseHeight, parseMinWidth, parseWidth, removePopper, toggleRowStatus, walkTreeNode };