import type { TableProps } from 'antd-v4';

export interface RecordType {
  [key: string]: any; // 根据实际需求调整类型
}

interface ColumnType {
  colSpan?: number;
  dataIndex: string;
  render?: (
    value: any,
    record: RecordType,
    index: number,
  ) => React.ReactNode | any;
  shouldCellUpdate?: (record: RecordType, prevRecord: RecordType) => boolean;
  rowSpan?: number;
  width?: number | string;
  minWidth?: number;
  onCell?: (
    data: RecordType,
    index?: number,
  ) => React.HTMLAttributes<any> & React.TdHTMLAttributes<any>;
  ellipsis?: boolean;
  title?: React.ReactNode | any;
  bNotEmpty?: boolean;
  bReadonly?: boolean;
  // [key: string]: any; // 其他属性
}

export interface ShowConfigType {
  bVisible?: boolean;
  sName: string;
  sControlName?: string;
  iTag?: number;
  sAssignField?: string;
  [key: string]: any; // 其他属性
}

export interface PropsType {
  enabled?: boolean;
  name: string;
  data: TableProps['dataSource'];
  headerColumn: ColumnType[];
  config: {
    gdsconfigformslave: ShowConfigType[];
    [key: string]: any; // 其他属性
  };
  customConfig: ShowConfigType[];
  slaveInfo?: PropsType;
  onSaveRowData: (data: any) => void;
  onSaveState: (data: any) => void;
  getShowConfig: (sName: string, bSlaveInfo?: boolean) => ShowConfigType;
  onGetTableChildNode: (
    sName: string,
    record: RecordType,
    children: React.ReactNode,
  ) => any;
  [key: string]: any; // 其他属性
}

export interface EditableRowProps {
  index: number;
}

export interface EditableCellProps extends ColumnType {
  children: React.ReactNode;
  record: any;
}
