import { TableColumn } from '../DataTable/DataTable.vue.d';
import { ClassComponent } from '../ts-helpers';

export type DragableColumn = TableColumn & { order?: number };

export interface DataTableColumnConfig {
  field: string;
  pinned: boolean;
  width?: number | string;
  visible: boolean;
}

export type CustomColumnEmits = {
  'update:visibleColumns': [columns: TableColumn[]];
  'update:reorderColumns': [columns: TableColumn[]];
};

export interface CustomColumnProps {
  tableId: string;
  tableKey?: string;
  tableName?: string;
  tableData?: Data[];
  defaultColumns: TableColumn[];
  defaultReorderColumns?: TableColumn[];
  visibleColumns: TableColumn[];
  /**
   * The maximum column count allowed
   * @default infinity
   */
  maxColumn?: number;
  type?: 'menu' | 'flat';
}

declare class CustomColumn extends ClassComponent<
  CustomColumnProps,
  CustomColumnEmits
> {
  /**
   * Method to show custom column menu.
   */
  toggleMenu: (event?: Event) => void;
  /**
   * Resets the column visibility to default
   */
  resetToDefault: () => void;
}

export default CustomColumn;
