import type { PropType } from 'vue'; import type { PaginationProps } from './types/pagination'; import type { BasicColumn, FetchSetting, SorterResult, TableCustomRecord, TableRowSelection, SizeType, } from './types/table'; import type { FormProps } from '/@/components/BzForm'; import { DEFAULT_FILTER_FN, DEFAULT_SORT_FN, FETCH_SETTING, DEFAULT_SIZE } from './const'; import { propTypes } from '/@/utils/propTypes'; export const basicProps = { clickToRowSelect: { type: Boolean, default: true }, isTreeTable: Boolean, inset: Boolean, sortFn: { type: Function as PropType<(sortInfo: SorterResult) => any>, default: DEFAULT_SORT_FN, }, filterFn: { type: Function as PropType<(data: Partial>) => any>, default: DEFAULT_FILTER_FN, }, autoCreateKey: { type: Boolean, default: true }, striped: { type: Boolean, default: false }, showSummary: Boolean, summaryFunc: { type: [Function, Array] as PropType<(...arg: any[]) => any[]>, default: null, }, summaryData: { type: Array as PropType, default: null, }, indentSize: propTypes.number.def(24), canColDrag: { type: Boolean, default: true }, api: { type: Function as PropType<(...arg: any[]) => Promise>, default: null, }, beforeFetch: { type: Function as PropType, default: null, }, afterFetch: { type: Function as PropType, default: null, }, handleSearchInfoFn: { type: Function as PropType, default: null, }, fetchSetting: { type: Object as PropType, default: () => { return FETCH_SETTING; }, }, // 立即请求接口 immediate: { type: Boolean, default: true }, emptyDataIsShowTable: { type: Boolean, default: true }, // 额外的请求参数 searchInfo: { type: Object as PropType, default: null, }, // 默认的排序参数 defSort: { type: Object as PropType, default: null, }, // 使用搜索表单 useSearchForm: propTypes.bool, // 表单配置 formConfig: { type: Object as PropType>, default: null, }, columns: { type: Array as PropType, default: () => [], }, showIndexColumn: { type: Boolean, default: true }, indexColumnProps: { type: Object as PropType, default: null, }, actionColumn: { type: Object as PropType, default: null, }, ellipsis: { type: Boolean, default: true }, isCanResizeParent: { type: Boolean, default: false }, canResize: { type: Boolean, default: true }, clearSelectOnPageChange: propTypes.bool, resizeHeightOffset: propTypes.number.def(0), rowSelection: { type: Object as PropType, default: null, }, title: { type: [String, Function] as PropType string)>, default: null, }, titleHelpMessage: { type: [String, Array] as PropType, }, maxHeight: propTypes.number, dataSource: { type: Array as PropType, default: null, }, rowKey: { type: [String, Function] as PropType string)>, default: '', }, bordered: propTypes.bool, pagination: { type: [Object, Boolean] as PropType, default: null, }, loading: propTypes.bool, rowClassName: { type: Function as PropType<(record: TableCustomRecord, index: number) => string>, }, scroll: { type: Object as PropType<{ x: number | true; y: number }>, default: null, }, beforeEditSubmit: { type: Function as PropType< (data: { record: Recordable; index: number; key: string | number; value: any; }) => Promise >, }, size: { type: String as PropType, default: DEFAULT_SIZE, }, };