import { ReactNode } from 'react' import { ButtonActionType, SwitchActionType, UniteOmit } from '@fexd/pro-utils' import { ProTableResponse } from '../queryField/types' import { ProTableColumnType } from '../table/types' export interface ProTableButtonActionType extends Omit { builtIn?: T hidden?: boolean onClick?: (...args: any[]) => ProTableResponse } export interface ProTableTableSwitchActionType extends Omit { builtIn?: T onClick?: (...args: any[]) => ProTableResponse } export type ProTableTableActionPureType = | UniteOmit | ProTableButtonActionType | ProTableTableSwitchActionType | Omit export type ProTableTableActionType = | ProTableTableActionPureType | ((...args: any[]) => ProTableTableActionPureType) | undefined export type ProTableBuiltInActionType = ReactNode | ((...args: any[]) => ReactNode) export type ProTableBuiltInActionNames = 'add' export type ProTableBuiltInColumnActionNames = 'view' | 'edit' | 'edit-icon' | 'table-edit' export type ProTableBuiltInIconActionNames = 'refresh' | 'table-size' | 'fullscreen' | 'search' | 'settings' export type ProTableBuiltInBatchActionNames = 'delete' // 动作插件参数 export interface ProTableActionPluginConfig { /** 表格按钮动作,目前内置了新增动作 */ actions?: (ProTableTableActionType | undefined)[] /** 表格项动作,目前内置了查看详情、编辑、删除动作 */ columnActions?: ( | ProTableTableActionPureType | ((item: R, ...args: any[]) => ProTableTableActionPureType) | undefined )[] /** 表格 icon 按钮动作,目前内置了刷新、列设置动作 */ iconActions?: (ProTableTableActionType | undefined)[] /** 多选动作,目前内置了批量删除动作 */ batchActions?: (ProTableTableActionType | undefined)[] /** 多选动作(废弃),目前内置了批量删除动作 */ multipleActions?: ProTableActionPluginConfig['batchActions'] /** 是否固定动作栏到右侧 */ fixColumnActions?: boolean builtInActions?: { actions?: Record iconActions?: Record batchActions?: Record columnActions?: Record } /** 删 */ onDelete?: (target: R | R[]) => Promise | void> | void /** 表格项动作 column 的配置 */ columnActionsConfig?: ProTableColumnType }