interface CallbackFun {
  <T>(data: T): T;
}

// Color name for component from the Quasar Color Palette
interface CellRenderButtonsType {
  hide?: boolean;
  label?: string;
  icon?: string;
  color?: string;
  textColor?: string;
  tooltip?: string;
  loading?: boolean;
  disable?: boolean;
  dense?: boolean;
  noCaps?: boolean;
  round?: boolean;
  flat?: boolean;
  outline?: boolean;
  unelevated?: boolean;
  rounded?: boolean;
  push?: boolean;
  square?: boolean;
  glossy?: boolean;
  fab?: boolean;
  callback: CallbackFun;
}

interface MoreButtonsItemType {
  hide?: boolean;
  label: string;
  icon?: string;
  color?: string;
  callback: CallbackFun;
}

type OmitMoreButtonsType = Omit<CellRenderButtonsType, 'callback'>;

interface MoreButtonsType extends OmitMoreButtonsType {
  children?: Array<MoreButtonsItemType>;
}

interface ButtonCellRenderType {
  buttons: Array<CellRenderButtonsType>;
  moreButtons?: MoreButtonsType;
  [proppName: string]: any;
}

interface ColumnDefsType {
  field?: string;
  headerName?: string;
  width?: number;
  minWidth?: number;
  minHeight?: number;
  maxWidth?: number;
  maxHeight?: number;
  pinned?: string; // 固定在左/右 left right
  editable?: boolean; // 可以编辑单元格
  flex?: number;
  cellEditor?: any;
  cellRenderer?: any;
  cellRendererParams?: any;
  [proppName: string]: any;
}

export type {
  ColumnDefsType,
  ButtonCellRenderType,
  CellRenderButtonsType,
  MoreButtonsType,
};
