import { CSSProperties, Component, VNode } from 'vue'; import { CardProps, PaginationProps as ElPaginationProps } from 'element-plus'; import { VxeColgroupProps, VxeColumnProps, VxeTableInstance } from 'vxe-table'; import { CompSize, IconType, Merge } from '../../utils/typescript'; import { AdvancedFilterValue, Condition, ConditionInfo, FilterLogic, FilterMultipleUiType } from '../filter/type'; import { OperateData } from '../operate/type'; import { Border, CellRender, CheckboxConfig, ColumnConfig, ColumnInfo, DefaultSlotParams, EditConfig, EditRender, EditSlotParams, FilterCheckedParams, FilterConfig, HeaderSlotParams, Row, RowConfig, ScrollY, SeqConfig, ShowOverflow, SortCheckedParams, SortConfig, TableFilterItem, TreeConfig } from './vxe-type'; export interface TreeTableProps { data?: RowData[]; size?: string; sortConfig?: SortConfig; filterConfig?: FilterConfig; seqConfig?: SeqConfig; rowConfig?: RowConfig; editConfig?: EditConfig; scrollY?: ScrollY; columnConfig?: ColumnConfig; checkboxConfig?: CheckboxConfig; treeConfig?: TreeConfig; showOverflow?: ShowOverflow; autoResize?: boolean; height?: string | number; align?: string; border?: Border; emptyText?: string; rowStyle?: CSSProperties | ((rowInfo: Row) => CSSProperties); footerData?: RowData[]; column: Column[]; showPage?: boolean; useTree?: boolean; isRemoteQuery?: boolean; isServerPaging?: boolean; paginationConfig?: TablePaginationConfig; showDescription?: boolean; showHeaderTools?: boolean; batchOperations?: OperateData[]; showBatchOperation?: boolean; batchOperateConfig?: BatchOperateConfig; showColumnMenu?: boolean; showDragColumn?: boolean; cellClickToggleHighlight?: boolean; widgets?: (string | WidgetItem)[]; showSearchInput?: boolean; showFilter?: boolean; showRefresh?: boolean; showTransfer?: boolean; showSizeControl?: boolean; advancedFilterConfig?: AdvancedFilterConfig; searchConfig?: SearchConfig; style?: CSSProperties; class?: string | { [className: string]: boolean; } | Array; simple?: boolean; defaultTransferData?: (() => TableHeaderControl[] | Promise) | TableHeaderControl[]; onTransferShow?: () => void; onTransferHide?: (transferData: TableHeaderControl[]) => void; onTransferChange?: (transferData: TableHeaderControl[]) => void; onAdvancedFilterShow?: () => void; onAdvancedFilterHide?: (filterInfo: { conditionInfo: ConditionInfo; filterData: RowData[]; }) => void; useAntStyle?: boolean; round?: boolean; adaptive?: boolean; hasSpace?: boolean; requestMethod?: (params: RequestMethodParams) => Promise; requestConfig?: RequestConfig; cardOptions?: CardOptions; defaultMode?: TableMode; transferConfig?: TransferConfig; clearCurrentByClick?: boolean; } export interface Column extends VxeColumnProps { visible?: boolean; key?: string | number; field?: string; title?: string; width?: string | number; filters?: Array; treeNode?: boolean; cellRender?: CellRender; editRender?: EditRender; minWidth?: string | number; sortable?: boolean; showIcon?: boolean; showColumnMenu?: boolean; group?: (Column & VxeColgroupProps)[]; dataType?: TableDataType; format?: string; valueFormat?: string; render?: (arg: DefaultSlotParams) => VNode; renderEdit?: (arg: EditSlotParams) => VNode; renderHeader?: (arg: HeaderSlotParams) => VNode; allowChangeVisible?: boolean; logics?: FilterLogic[]; ignoreCase?: boolean; [key: string]: any; } export type Columns = Column[]; export type WidgetItem = { id: string; widget?: Component | (() => VNode | Component); }; export type Widgets = (string | WidgetItem)[]; export type FilterColumn = { title: string; field: string; dataType?: TableDataType; multiple?: boolean | FilterMultipleUiType; logics?: FilterLogic[]; options?: { label: string; value: AdvancedFilterValue; children?: FilterColumnOption[]; }[]; }; export type FilterColumnOption = { label: string; value: string; disabled?: boolean; [key: string]: any; }; export type TablePaginationConfig = Merge<{ size?: CompSize; isRemotePaging?: boolean; }, { -readonly [K in keyof ElPaginationProps]: ElPaginationProps[K]; }>; export interface DataStore { data: RowData[]; } export interface TableHeaderControl { label: string; key: string; visible?: boolean; disabled?: boolean; width?: string; } export interface AdvancedFilterConfig { filterColumns?: FilterColumn[]; filterAll?: boolean; exclude?: string[]; ignoreCase?: boolean; remote?: boolean; dateFormat?: string; timeFormat?: string; defaultCondition?: { conditionList?: Condition[]; filterRule?: number; }; isEvery?: boolean; } export interface SearchConfig { strict?: boolean; searchMethod?: (params: SearchMethodParams) => boolean; isRemoteQuery?: boolean; ignoreCase?: boolean; searchColumns?: string[]; supportPinYin?: string[] | boolean; placeholder?: string; isEvery?: boolean; } export interface TransferConfig { showSearch?: boolean; excludes?: string[]; drag?: boolean; } export interface RequestConfig { immediate?: boolean; } export interface BatchOperateConfig { data?: OperateData[]; showTotal?: boolean; total?: number; checkMethod?: (args: OperateData) => RowData[]; } export interface RowData { icon?: IconType; __folder?: boolean; iconStyle?: CSSProperties & { empty?: boolean; size?: number; }; allowChangeVisible?: boolean; [key: string]: any; } export interface RequestMethodParams { searchKeyword: string; currentPage: number | undefined; pageSize: number | undefined; pageSizes: number[] | undefined; total: number; conditionInfo: ConditionInfo; currentData?: RowData[]; filterInfo: FilterCheckedParams[]; sortInfo: SortCheckedParams[]; } export interface SearchMethodParams { searchKeyword: string; row: RowData; } export type RequestMethodReturn = { data: RowData[]; total?: number; beforeReload?: (params: RequestMethodCallbackParams) => void | Promise; afterReload?: (params: RequestMethodCallbackParams) => void | Promise; }; export type RowOrRowid = RowData | string | number; export type TableMode = 'list' | 'card'; export type CardOptions = CardProps; export type SortOrder = 'asc' | 'desc' | '' | null; export type TableDataType = 'string' | 'number' | 'date' | 'time' | 'boolean'; export type ExportDataMode = 'all' | 'current' | 'selected' | 'empty'; export type ColumnType = 'seq' | 'checkbox' | 'radio' | 'expand' | 'html' | null; export type FilterDateType = TableDataType; export type SeqMethodParams = { $table: VxeTableInstance; column: ColumnInfo; columnIndex: number; $columnIndex: number; row: Row; rowIndex: number; $rowIndex: number; }; export interface RequestMethodCallbackParams { tableData: RowData[]; columns: Column[]; } export * from './vxe-type';