| | |
| | | import type { VNodeChild } from 'vue'; |
| | | import type { PaginationProps } from './pagination'; |
| | | import type { FormProps } from '/@/components/Form'; |
| | | import type { |
| | | ColumnProps, |
| | | TableRowSelection as ITableRowSelection, |
| | | } from 'ant-design-vue/lib/table/interface'; |
| | | import type { TableRowSelection as ITableRowSelection } from 'ant-design-vue/lib/table/interface'; |
| | | import type { ColumnProps } from 'ant-design-vue/lib/table'; |
| | | |
| | | import { ComponentType } from './componentType'; |
| | | import { VueNode } from '/@/utils/propTypes'; |
| | | // import { ColumnProps } from './column'; |
| | | import { RoleEnum } from '/@/enums/roleEnum'; |
| | | |
| | | export declare type SortOrder = 'ascend' | 'descend'; |
| | | |
| | | export interface TableCurrentDataSource<T = Recordable> { |
| | | currentDataSource: T[]; |
| | | } |
| | |
| | | |
| | | /** |
| | | * Callback executed when select/deselect one row |
| | | * @type FunctionT |
| | | * @type Function |
| | | */ |
| | | onSelect?: (record: T, selected: boolean, selectedRows: Object[], nativeEvent: Event) => any; |
| | | |
| | |
| | | reload: (opt?: FetchParams) => Promise<void>; |
| | | getSelectRows: <T = Recordable>() => T[]; |
| | | clearSelectedRowKeys: () => void; |
| | | expandAll: () => void; |
| | | expandRows: (keys: string[]) => void; |
| | | collapseAll: () => void; |
| | | scrollTo: (pos: string) => void; // pos: id | "top" | "bottom" |
| | | getSelectRowKeys: () => string[]; |
| | | deleteSelectRowByKey: (key: string) => void; |
| | | setPagination: (info: Partial<PaginationProps>) => void; |
| | | setTableData: <T = Recordable>(values: T[]) => void; |
| | | updateTableDataRecord: (rowKey: string | number, record: Recordable) => Recordable | void; |
| | | deleteTableDataRecord: (rowKey: string | number | string[] | number[]) => void; |
| | | insertTableDataRecord: (record: Recordable, index?: number) => Recordable | void; |
| | | findTableDataRecord: (rowKey: string | number) => Recordable | void; |
| | | getColumns: (opt?: GetColumnsParams) => BasicColumn[]; |
| | | setColumns: (columns: BasicColumn[] | string[]) => void; |
| | | getDataSource: <T = Recordable>() => T[]; |
| | | getRawDataSource: <T = Recordable>() => T; |
| | | setLoading: (loading: boolean) => void; |
| | | setProps: (props: Partial<BasicTableProps>) => void; |
| | | redoHeight: () => void; |
| | |
| | | // 查询条件请求之前处理 |
| | | handleSearchInfoFn?: Fn; |
| | | // 请求接口配置 |
| | | fetchSetting?: FetchSetting; |
| | | fetchSetting?: Partial<FetchSetting>; |
| | | // 立即请求接口 |
| | | immediate?: boolean; |
| | | // 在开起搜索表单的时候,如果没有数据是否显示表格 |
| | | emptyDataIsShowTable?: boolean; |
| | | // 额外的请求参数 |
| | | searchInfo?: Recordable; |
| | | // 默认的排序参数 |
| | | defSort?: Recordable; |
| | | // 使用搜索表单 |
| | | useSearchForm?: boolean; |
| | | // 表单配置 |
| | |
| | | actionColumn?: BasicColumn; |
| | | // 文本超过宽度是否显示。。。 |
| | | ellipsis?: boolean; |
| | | // 是否继承父级高度(父级高度-表单高度-padding高度) |
| | | isCanResizeParent?: boolean; |
| | | // 是否可以自适应高度 |
| | | canResize?: boolean; |
| | | // 自适应高度偏移, 计算结果-偏移量 |
| | |
| | | * @default 'children' |
| | | * @type string | string[] |
| | | */ |
| | | childrenColumnName?: string | string[]; |
| | | childrenColumnName?: string; |
| | | |
| | | /** |
| | | * Override default table elements |
| | |
| | | * Row's className |
| | | * @type Function |
| | | */ |
| | | rowClassName?: (record: TableCustomRecord<T>) => string; |
| | | rowClassName?: (record: TableCustomRecord<T>, index: number) => string; |
| | | |
| | | /** |
| | | * Row selection config |
| | |
| | | transformCellText?: Function; |
| | | |
| | | /** |
| | | * Callback executed before editable cell submit value, not for row-editor |
| | | * |
| | | * The cell will not submit data while callback return false |
| | | */ |
| | | beforeEditSubmit?: (data: { |
| | | record: Recordable; |
| | | index: number; |
| | | key: string | number; |
| | | value: any; |
| | | }) => Promise<any>; |
| | | |
| | | /** |
| | | * Callback executed when pagination, filters or sorter is changed |
| | | * @param pagination |
| | | * @param filters |
| | |
| | | * @param expandedRows |
| | | */ |
| | | onExpandedRowsChange?: (expandedRows: string[] | number[]) => void; |
| | | |
| | | onColumnsChange?: (data: ColumnChangeParam[]) => void; |
| | | } |
| | | |
| | | export type CellFormat = |
| | |
| | | flag?: 'INDEX' | 'DEFAULT' | 'CHECKBOX' | 'RADIO' | 'ACTION'; |
| | | customTitle?: VueNode; |
| | | |
| | | slots?: Indexable; |
| | | slots?: Recordable; |
| | | |
| | | // Whether to hide the column by default, it can be displayed in the column configuration |
| | | defaultHidden?: boolean; |
| | |
| | | editRow?: boolean; |
| | | editable?: boolean; |
| | | editComponent?: ComponentType; |
| | | editComponentProps?: Recordable; |
| | | editComponentProps?: |
| | | | ((opt: { |
| | | text: string | number | boolean | Recordable; |
| | | record: Recordable; |
| | | column: BasicColumn; |
| | | index: number; |
| | | }) => Recordable) |
| | | | Recordable; |
| | | editRule?: boolean | ((text: string, record: Recordable) => Promise<string>); |
| | | editValueMap?: (value: any) => string; |
| | | onEditRow?: () => void; |
| | | // 权限编码控制是否显示 |
| | | auth?: RoleEnum | RoleEnum[] | string | string[]; |
| | | // 业务控制是否显示 |
| | | ifShow?: boolean | ((column: BasicColumn) => boolean); |
| | | // 自定义修改后显示的内容 |
| | | editRender?: (opt: { |
| | | text: string | number | boolean | Recordable; |
| | | record: Recordable; |
| | | column: BasicColumn; |
| | | index: number; |
| | | }) => VNodeChild | JSX.Element; |
| | | } |
| | | |
| | | export type ColumnChangeParam = { |
| | | dataIndex: string; |
| | | fixed: boolean | 'left' | 'right' | undefined; |
| | | visible: boolean; |
| | | }; |
| | | |
| | | export interface InnerHandlers { |
| | | onColumnsChange: (data: ColumnChangeParam[]) => void; |
| | | } |