UNPKG

nsn-comp

Version:

NSN核心组件

57 lines (48 loc) 1.71 kB
import { ButtonProps } from 'antd/es/button'; import { PopconfirmProps } from 'antd/es/popconfirm'; import { BaseEntity } from 'nsn-entity'; import { NDispatchType } from 'nsn-model-type'; import { Component } from 'react'; import { MoreMenusProps } from './MoreMenusProps'; import { TableProps } from './Props'; import { TableState } from './State'; import { TableTreeProps } from './TableTreeProps'; export type NButtonProps<DT extends string> = { /** 按钮文字 */ text?: string; } & Pick<Partial<TableTreeProps<DT>>, 'dtype'> & Omit<ButtonProps, 'type'>; export type OthersProps<DT extends string> = { /** 确认框 */ popconfirm?: PopconfirmProps; } & Omit<NButtonProps<DT>, 'dtype'>; /** Table 的工具栏属性 */ export interface ToolbarProps<T extends BaseEntity, DT extends string, S = {}> { /** * 新建按钮属性 * @type false | 不显示 * @type object | 透传到antd按钮组件 */ create?: false | Omit<NButtonProps<DT>, 'dtype'>; /** * 删除按钮属性 * @type false | 不显示 * @type string | 异步动作 * @type object | 透传到antd按钮组件 */ remove?: false | NDispatchType<DT> | NButtonProps<DT>; /** * 其他按钮 * @type Array | 多个按钮 * @type object | 单个按钮(透传到antd按钮组件) */ others?: OthersProps<DT> | Array<OthersProps<DT>> | ((comp: Component<TableProps<T, DT, S>, TableState<T, S>>) => Array<OthersProps<DT>>), /** * 下拉按钮属性 * @type Array | 自定义下拉菜单项. 透传给 Menu.Item * @type object | 自定义下拉菜单项 和 其他配置 */ menus?: MoreMenusProps<T, DT, S>['items'] | Omit<MoreMenusProps<T, DT, S>, 'comp'>; }