import { ProColumns } from '@ant-design/pro-table';
import { BaseEntity } from 'nsn-entity';
import { ReactNode } from 'react';
import { OptionColumnMenu } from './OptionColumnMenu';

export type TableOptionColumnProps<T extends BaseEntity, ExtraDT extends string, S = {}> = {

  /** 隐藏编辑菜单*/
  hideEdit?: boolean | ((item: T) => boolean);

  /** 编辑菜单是否可用 */
  editDisabled?: boolean | ((item: T) => boolean);

  /** 显示详情菜单*/
  showDetail?: boolean | ((item: T) => boolean);

  /** 详情菜单是否可用 */
  detailDisabled?: boolean | ((item: T) => boolean);

  /** 操作列的 其他菜单, 当数组元素为 undefined 时会被显示为 分割线 */
  menus?: Array<OptionColumnMenu<T, ExtraDT, S> | undefined>;

  /** menus 显示个数为 0 时，需要显示的内容 */
  zeroMenu?: ReactNode;
}
  & Pick<ProColumns<T>, 'width' | 'title'>