import type { PropType } from 'vue';
import { propTypes } from '@/utils/propTypes';
import type { BasicColumn, TableSetting } from './types/table';
// import type { ElTable } from 'element-plus';
export const basicProps = {
  // ...ElTable, // 这里继承原 UI 组件的 props
  tableLayout: {
    type: String,
    default: 'auto',
  },
  title: {
    type: String,
    default: null,
  },
  titleTooltip: {
    type: String,
    default: null,
  },
  border: {
    type: Boolean,
    default: false,
  },
  maxHeight: {
    type: Number,
  },
  size: {
    type: String,
    default: 'default',
  },
  dataSource: {
    type: [Function, Array],
    default: () => [],
  },
  columns: {
    type: [Array] as PropType<BasicColumn[]>,
    default: () => [],
    required: true,
  },
  request: {
    type: Function as PropType<(...arg: any[]) => Promise<any>>,
    default: null,
  },
  rowKey: {
    type: [String, Function] as PropType<string | ((record) => string)>,
    default: undefined,
  },
  rowClassName: {
    type: [String, Function] as PropType<string | ((record) => string)>,
    default: undefined,
  },
  pagination: {
    type: [Object, Boolean],
    default: () => {},
  },
  //废弃
  showPagination: {
    type: [String, Boolean],
    default: 'auto',
  },
  actionColumn: {
    type: Object as PropType<BasicColumn>,
    default: null,
  },
  showTableSetting: {
    type: Boolean,
    default: true,
  },
  tableSetting: {
    type: Object as PropType<TableSetting>,
    default: () => ({
      width: 230,
      redo: true,
      size: true,
      setting: true,
      fullscreen: true,
      striped: true,
      //AdvancedTable 组件独有
      query: false,
    }),
  },
  striped: {
    type: Boolean,
    default: false,
  },
  checkedRowAlert: {
    type: Boolean,
    default: false,
  },
  canResize: propTypes.bool.def(true),
  resizeHeightOffset: propTypes.number.def(0),
  isKeepRowKeys: {
    type: Boolean,
    default: false,
  },
};
