import type { CSSProperties, ComponentInternalInstance, PropType, Ref, VNode } from 'vue'; import type { ComponentSize } from 'element-plus/es/constants'; import type { Nullable } from 'element-plus/es/utils'; import type { Store } from '../store'; import type { TableColumnCtx } from '../table-column/defaults'; import type TableLayout from '../table-layout'; import type { TableOverflowTooltipFormatter, TableOverflowTooltipOptions } from '../util'; type DefaultRow = Record; interface TableRefs { tableWrapper: HTMLElement; headerWrapper: HTMLElement; footerWrapper: HTMLElement; fixedBodyWrapper: HTMLElement; rightFixedBodyWrapper: HTMLElement; bodyWrapper: HTMLElement; appendWrapper: HTMLElement; [key: string]: any; } interface TableState { isGroup: Ref; resizeState: Ref<{ width: any; height: any; }>; doLayout: () => void; debouncedUpdateLayout: () => void; } interface TreeProps { hasChildren?: string; children?: string; checkStrictly?: boolean; } type HoverState = Nullable<{ cell: HTMLElement; column: TableColumnCtx; row: T; }>; type RIS = { row: T; $index: number; store: Store; expanded: boolean; }; type RenderExpanded = ({ row, $index, store, expanded, }: RIS) => VNode[] | undefined; type SummaryMethod = (data: { columns: TableColumnCtx[]; data: T[]; }) => (string | VNode)[]; interface Table extends ComponentInternalInstance { $ready: boolean; hoverState?: HoverState | null; renderExpanded: RenderExpanded; store: Store; layout: TableLayout; refs: TableRefs; tableId: string; state: TableState; } type ColumnCls = string | ((data: { row: T; rowIndex: number; }) => string); type ColumnStyle = CSSProperties | ((data: { row: T; rowIndex: number; }) => CSSProperties); type CellCls = string | ((data: { row: T; rowIndex: number; column: TableColumnCtx; columnIndex: number; }) => string); type CellStyle = CSSProperties | ((data: { row: T; rowIndex: number; column: TableColumnCtx; columnIndex: number; }) => CSSProperties); type Layout = 'fixed' | 'auto'; interface TableProps { data: T[]; size?: ComponentSize; width?: string | number; height?: string | number; maxHeight?: string | number; fit?: boolean; stripe?: boolean; border?: boolean; rowKey?: string | ((row: T) => string); context?: Table; showHeader?: boolean; showSummary?: boolean; sumText?: string; summaryMethod?: SummaryMethod; rowClassName?: ColumnCls; rowStyle?: ColumnStyle; cellClassName?: CellCls; cellStyle?: CellStyle; headerRowClassName?: ColumnCls; headerRowStyle?: ColumnStyle; headerCellClassName?: CellCls; headerCellStyle?: CellStyle; highlightCurrentRow?: boolean; currentRowKey?: string | number; emptyText?: string; expandRowKeys?: Array; defaultExpandAll?: boolean; defaultSort?: Sort; tooltipEffect?: string; tooltipOptions?: TableOverflowTooltipOptions; spanMethod?: (data: { row: T; rowIndex: number; column: TableColumnCtx; columnIndex: number; }) => number[] | { rowspan: number; colspan: number; } | undefined; selectOnIndeterminate?: boolean; indent?: number; treeProps?: TreeProps; lazy?: boolean; load?: (row: T, treeNode: TreeNode, resolve: (data: T[]) => void) => void; className?: string; style?: CSSProperties; tableLayout?: Layout; scrollbarAlwaysOn?: boolean; flexible?: boolean; showOverflowTooltip?: boolean | TableOverflowTooltipOptions; tooltipFormatter?: TableOverflowTooltipFormatter; appendFilterPanelTo?: string; scrollbarTabindex?: number | string; nativeScrollbar?: boolean; } type TableTooltipData = Parameters>[0]; type TableSortOrder = 'ascending' | 'descending'; interface Sort { prop: string; order: TableSortOrder; init?: any; silent?: any; } interface Filter { column: TableColumnCtx; values: string[]; silent: any; } interface TreeNode { expanded?: boolean; loading?: boolean; noLazyChildren?: boolean; indent?: number; level?: number; display?: boolean; } interface RenderRowData { store: Store; _self: Table; column: TableColumnCtx; row: T; $index: number; cellIndex: number; treeNode?: TreeNode; expanded: boolean; } declare const _default: { /** * @description table data */ data: { type: PropType; default: () => never[]; }; /** * @description size of Table */ size: { readonly type: PropType>; readonly required: false; readonly validator: ((val: unknown) => boolean) | undefined; __epPropKey: true; }; width: (NumberConstructor | StringConstructor)[]; /** * @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles */ height: (NumberConstructor | StringConstructor)[]; /** * @description table's max-height. The legal value is a number or the height in px */ maxHeight: (NumberConstructor | StringConstructor)[]; /** * @description whether width of column automatically fits its container */ fit: { type: BooleanConstructor; default: boolean; }; /** * @description whether Table is striped */ stripe: BooleanConstructor; /** * @description whether Table has vertical border */ border: BooleanConstructor; /** * @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */ rowKey: PropType["rowKey"]>; /** * @description whether Table header is visible */ showHeader: { type: BooleanConstructor; default: boolean; }; /** * @description whether to display a summary row */ showSummary: BooleanConstructor; /** * @description displayed text for the first column of summary row */ sumText: StringConstructor; /** * @description custom summary method */ summaryMethod: PropType["summaryMethod"]>; /** * @description function that returns custom class names for a row, or a string assigning class names for every row */ rowClassName: PropType["rowClassName"]>; /** * @description function that returns custom style for a row, or an object assigning custom style for every row */ rowStyle: PropType["rowStyle"]>; /** * @description function that returns custom class names for a cell, or a string assigning class names for every cell */ cellClassName: PropType["cellClassName"]>; /** * @description function that returns custom style for a cell, or an object assigning custom style for every cell */ cellStyle: PropType["cellStyle"]>; /** * @description function that returns custom class names for a row in table header, or a string assigning class names for every row in table header */ headerRowClassName: PropType["headerRowClassName"]>; /** * @description function that returns custom style for a row in table header, or an object assigning custom style for every row in table header */ headerRowStyle: PropType["headerRowStyle"]>; /** * @description function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header */ headerCellClassName: PropType["headerCellClassName"]>; /** * @description function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header */ headerCellStyle: PropType["headerCellStyle"]>; /** * @description whether current row is highlighted */ highlightCurrentRow: BooleanConstructor; /** * @description key of current row, a set only prop */ currentRowKey: (NumberConstructor | StringConstructor)[]; /** * @description displayed text when data is empty. You can customize this area with `#empty` */ emptyText: StringConstructor; /** * @description set expanded rows by this prop, prop's value is the keys of expand rows, you should set row-key before using this prop */ expandRowKeys: PropType["expandRowKeys"]>; /** * @description whether expand all rows by default, works when the table has a column type="expand" or contains tree structure data */ defaultExpandAll: BooleanConstructor; /** * @description set the default sort column and order. property `prop` is used to set default sort column, property `order` is used to set default sort order */ defaultSort: PropType["defaultSort"]>; /** * @description the `effect` of the overflow tooltip */ tooltipEffect: StringConstructor; /** * @description the options for the overflow tooltip, [see the following tooltip component](tooltip.html#attributes) */ tooltipOptions: PropType["tooltipOptions"]>; /** * @description method that returns rowspan and colspan */ spanMethod: PropType["spanMethod"]>; /** * @description controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected */ selectOnIndeterminate: { type: BooleanConstructor; default: boolean; }; /** * @description horizontal indentation of tree data */ indent: { type: NumberConstructor; default: number; }; /** * @description configuration for rendering nested data */ treeProps: { type: PropType["treeProps"]>; default: () => { hasChildren: string; children: string; checkStrictly: boolean; }; }; /** * @description whether to lazy loading data */ lazy: BooleanConstructor; /** * @description method for loading child row data, only works when `lazy` is true */ load: PropType["load"]>; style: { type: PropType; default: () => {}; }; className: { type: StringConstructor; default: string; }; /** * @description sets the algorithm used to lay out table cells, rows, and columns */ tableLayout: { type: PropType; default: string; }; /** * @description always show scrollbar */ scrollbarAlwaysOn: BooleanConstructor; /** * @description ensure main axis minimum-size doesn't follow the content */ flexible: BooleanConstructor; /** * @description whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns */ showOverflowTooltip: PropType["showOverflowTooltip"]>; /** * @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true` */ tooltipFormatter: PropType["tooltipFormatter"]>; appendFilterPanelTo: StringConstructor; scrollbarTabindex: { type: (NumberConstructor | StringConstructor)[]; default: undefined; }; /** * @description whether to allow drag the last column */ allowDragLastColumn: { type: BooleanConstructor; default: boolean; }; /** * @description whether to preserve expanded row content in DOM when collapsed */ preserveExpandedContent: BooleanConstructor; /** * @description whether to use native scrollbars */ nativeScrollbar: BooleanConstructor; }; export default _default; export type { SummaryMethod, Table, TableProps, TableRefs, ColumnCls, ColumnStyle, CellCls, CellStyle, DefaultRow, TreeNode, RenderRowData, Sort, Filter, TableColumnCtx, TreeProps, TableTooltipData, TableSortOrder, RenderExpanded, };