import React from 'react'; import { DetailField, DetailFieldConfig } from '../common'; import OperationHelper, { OperationConfig } from '../../../util/operation'; /** * 表格操作配置项 * - type: 操作类型 * - actions: 操作按钮配置 */ export interface OperationDetailConfig extends DetailFieldConfig { type: 'operation'; actions: Array | []; } declare type ActionConfig = ActionButtonConfig | ActionLinkConfig; export interface ActionButtonConfig { type: 'button'; label: string; level: 'normal' | 'primary' | 'danger'; handle: OperationConfig; } export interface ActionLinkConfig { type: 'link'; label: string; level: 'normal' | 'primary' | 'danger'; handle: OperationConfig; } export interface IButtonProps { label: string; level: 'normal' | 'primary' | 'danger'; onClick: () => void; } export interface IOperationDetail { actions: Array; } export default class DetailOperation extends DetailField { OperationHelper: typeof OperationHelper; renderComponent: (props: IOperationDetail) => JSX.Element; /** * button组件 * @param props */ renderButtonComponent: (props: IButtonProps) => JSX.Element; /** * link组件 * @param props */ renderLinkComponent: (props: IButtonProps) => JSX.Element; state: { pageAuth: {}; }; /** * 页面权限获取状态 * fulfilled |pending */ pageAuth: { [page: string]: boolean; }; checkPageAuth: (page: string) => void; getValue: () => string; /** * 处理按钮列表按钮项回调 * @param action 按钮项配置 */ handleCallback: (action: ActionConfig, success: boolean) => Promise; render: () => JSX.Element; } export {};