import type { FormProps } from '../Form/types/form';
import type { tableProp } from './types';
export const basicProps = {
  showTableAction: {
    type: Boolean,
    default: true
  },
  immediate: {
    type: Boolean,
    default: true
  },
  api: {
    type: Function as PropType<tableProp['api']>,
    default: () => Promise.resolve()
  },
  columns: {
    type: Array as PropType<tableProp['columns']>,
    default: () => []
  },
  defaultParams: {
    type: Object as PropType<tableProp['defaultParams']>,
    default: () => ({})
  },
  searchFormConfig: {
    type: Object as PropType<FormProps>,
    default: {
      labelWidth: 120,
      layout: 'horizontal',
      gridProps: {
        cols: '1 xl:4 s:1 l:3',
        itemResponsive: true
      },
      collapsedRows: 1
    }
  },

  tableConfig: {
    type: Object as PropType<tableProp>,
    default: {
      opWdith: 130,
      title: '',
      showDeleteButton: false,
      showAddButton: true,
      keyField: 'id',
      scrollX: 1000,
      showTableHeaderAction: true,
      showSearch: true
    }
  }
};
export interface ZTableSlots<T = any> {
  /**
   * 操作列插槽
   * @param row 当前行数据
   */
  op?: (props: { row: T }) => any;

  /**
   * 表格头部前缀区域插槽
   * @param data 当前加载状态
   */
  prefix?: (props: { loading: boolean }) => any;
}
