import { cellTypes, GridSettings } from '@sc/handsontable';

// 自定义checkbox，默认的checkBox value为undefined时灰显
export default function checkBoxRender(
  instance: Handsontable,
  TD: HTMLElement,
  row: number,
  col: number,
  prop: string | number,
  value: any,
  cellProperties: GridSettings
): HTMLElement {
  const container = cellTypes.checkbox.renderer(instance, TD, row, col, prop, value, cellProperties);
  const element = TD.children[0] as any;
  if (!value) element.className = 'htCheckboxRendererInput';

  return container;
}
