import React from 'react'; import { type ModalFuncProps, type ButtonProps } from 'antd'; import { type DFormProps } from '../DForm'; import { DTableSourceProps, type DTableProps } from '../DTable'; import type { DModalProps } from '../DModal/interface'; import './index.less'; export type RefreshStrategy = { /** 是否保留检索条件,默认为true */ keepSearchValues?: boolean; /** 是否保持当前页码,默认为false(回到第一页) */ keepPage?: boolean; }; export type CRUDRefProps = { /** 刷新表格数据 */ refresh: (_strategy?: RefreshStrategy) => void; getSelectedRows: () => { selectedRowKeys: any[]; selectedRows: any[]; }; getSearchValues: () => Record; openAddModal: (_record?: any) => void; openEditModal: (_record?: any) => void; openDeleteModal: (_record?: any) => void; openDetailModal: (_record?: any) => void; }; export type CRUDProps = { className?: string; style?: React.CSSProperties; /** 查询表单配置 */ searchFormProps?: DFormProps & { immediate?: boolean; }; /** 表格配置 */ tableProps: DTableProps; /** 新增/编辑表单配置 */ modalFormProps?: { /** 表单配置 */ formProps?: DFormProps; /** 模态框配置 */ modalProps?: DModalProps; }; deleteModalProps?: ModalFuncProps; /** 新增按钮配置 */ addButtonProps?: ButtonProps; /** 新增按钮文本 */ addButtonText?: string; /** 是否显示新增按钮 */ showAddButton?: boolean; /** 是否显示批量删除按钮 */ showBatchDelete?: boolean; /** 批量删除按钮文本 */ batchDeleteButtonText?: string; /** 批量删除按钮配置 */ batchDeleteButtonProps?: ButtonProps; /** 显示行编辑 */ showEdit?: boolean; /** 行编辑按钮文本 */ editButtonText?: string; /** 编辑按钮配置 */ editButtonProps?: ButtonProps; /** 显示行删除 */ showDelete?: boolean; /** 删除按钮文本 */ deleteButtonText?: string; /** 删除按钮配置 */ deleteButtonProps?: ButtonProps; /** 显示行查看 */ showView?: boolean; /** 行查看按钮文本 */ viewButtonText?: string; /** 行查看按钮配置 */ viewButtonProps?: ButtonProps; /** 自定义操作栏 */ actionBar?: React.ReactNode; /** 数据刷新回调 */ onRefresh?: () => void; crudApi: { list: (_params: any) => Promise; /** 删除数据接口 */ delete: (_params: any) => Promise; /** 新增数据接口 */ add: (_params: any) => Promise; /** 编辑数据接口 */ edit: (_params: any) => Promise; /** 详情数据接口 */ detail?: (_params: any) => Promise; }; /** 全局刷新策略 */ refreshStrategy?: RefreshStrategy; /** 新增场景刷新策略,优先级高于全局配置 */ addRefreshStrategy?: RefreshStrategy; /** 编辑场景刷新策略,优先级高于全局配置 */ editRefreshStrategy?: RefreshStrategy; /** 删除场景刷新策略,优先级高于全局配置 */ deleteRefreshStrategy?: RefreshStrategy; }; declare const forwardCRUD: React.ForwardRefExoticComponent>; export default forwardCRUD;