table-reuse
Version:
A reusable table built on top of Antd ProTable
29 lines (28 loc) • 949 B
TypeScript
import { type NavigateFunction } from "react-router-dom";
import type { TClickAction } from "action-view";
export type TCrudActionLabels = {
createLabel?: string;
viewLabel?: string;
editLabel?: string;
deleteLabel?: string;
cloneLabel?: string;
importLabel?: string;
exportLabel?: string;
};
export type TGetCrudActionsParams = {
rowKey: string;
basePath: string;
labels: TCrudActionLabels;
navigate: NavigateFunction;
apiDelete?: (rowId: string) => Promise<void>;
onImport?: () => Promise<void>;
onExport?: () => Promise<void>;
};
/**
* 根据 row 和 labels 生成页面级与行级操作
* 使用 getCrudPath 统一路径
*/
export declare function getCrudActions<TItem>({ basePath, navigate, labels, rowKey, apiDelete, onImport, onExport, }: TGetCrudActionsParams): {
pageActions: TClickAction[];
buildRowActions: (row: TItem) => TClickAction[];
};