ag-grid.ts 1.43 KB
Newer Older
hucy's avatar
hucy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
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,
};