vben
2020-10-20 968f791f4b7112730813c8c990379051c3f8340d
提交 | 用户 | age
faf3f4 1 import { PropType } from 'vue';
2 import { PaginationProps } from './types/pagination';
3 import { BasicColumn, FetchSetting } from './types/table';
4 import { TableCustomRecord, TableRowSelection } from 'ant-design-vue/types/table/table';
5 import { FormProps } from '/@/components/Form/index';
6 import { FETCH_SETTING } from './const';
7
8 // 注释看 types/table
9 export const basicProps = {
10   autoCreateKey: {
11     type: Boolean as PropType<boolean>,
12     default: true,
13   },
14   striped: {
15     type: Boolean as PropType<boolean>,
16     default: true,
17   },
18   showSummary: {
19     type: Boolean as PropType<boolean>,
20     default: false,
21   },
22
23   summaryFunc: {
24     type: [Function, Array] as PropType<(...arg: any[]) => any[]>,
25     default: null,
26   },
27
28   canColDrag: {
29     type: Boolean as PropType<boolean>,
30     default: true,
31   },
32   isTreeTable: {
33     type: Boolean as PropType<boolean>,
34     default: false,
35   },
36   api: {
37     type: Function as PropType<(...arg: any[]) => Promise<any>>,
38     default: null,
39   },
40   beforeFetch: {
41     type: Function as PropType<Fn>,
42     default: null,
43   },
44   afterFetch: {
45     type: Function as PropType<Fn>,
46     default: null,
47   },
48   handleSearchInfoFn: {
49     type: Function as PropType<Fn>,
50     default: null,
51   },
52   fetchSetting: {
53     type: Object as PropType<FetchSetting>,
54     default: () => {
55       return FETCH_SETTING;
56     },
57   },
58   // 立即请求接口
59   immediate: { type: Boolean as PropType<boolean>, default: true },
60
61   emptyDataIsShowTable: {
62     type: Boolean as PropType<boolean>,
63     default: true,
64   },
65   // 额外的请求参数
66   searchInfo: {
67     type: Object as PropType<any>,
68     default: null,
69   },
70   // 使用搜索表单
71   useSearchForm: {
72     type: Boolean as PropType<boolean>,
73     default: false,
74   },
75   // 表单配置
76   formConfig: {
77     type: Object as PropType<Partial<FormProps>>,
78     default: null,
79   },
80   columns: {
81     type: [Array] as PropType<BasicColumn[]>,
82     default: null,
83   },
84   showIndexColumn: {
85     type: Boolean as PropType<boolean>,
86     default: true,
87   },
88   indexColumnProps: {
89     type: Object as PropType<BasicColumn>,
90     default: null,
91   },
92   actionColumn: {
93     type: Object as PropType<BasicColumn>,
94     default: null,
95   },
96   ellipsis: {
97     type: Boolean as PropType<boolean>,
98     default: true,
99   },
100   canResize: {
101     type: Boolean as PropType<boolean>,
102     default: true,
103   },
104   clearSelectOnPageChange: {
105     type: Boolean as PropType<boolean>,
106     default: false,
107   },
108   resizeHeightOffset: {
109     type: Number as PropType<number>,
110     default: 0,
111   },
112   rowSelection: {
113     type: Object as PropType<TableRowSelection<any> | null>,
114     default: null,
115   },
116   title: {
117     type: [String, Function] as PropType<string | ((data: any) => any)>,
118     default: null,
119   },
120   titleHelpMessage: {
121     type: [String, Array] as PropType<string | string[]>,
122   },
123   maxHeight: {
124     type: Number as PropType<number>,
125   },
126   dataSource: {
127     type: Array as PropType<any[]>,
128     default: null,
129   },
130   rowKey: {
131     type: [String, Function] as PropType<string | ((record: any) => string)>,
132     default: '',
133   },
134   bordered: {
135     type: Boolean as PropType<boolean>,
968f79 136     default: false,
faf3f4 137   },
138   pagination: {
139     type: [Object, Boolean] as PropType<PaginationProps | boolean>,
140     default: null,
141   },
142
143   loading: {
144     type: Boolean as PropType<boolean>,
145     default: false,
146   },
147   rowClassName: {
148     type: Function as PropType<(record: TableCustomRecord<any>, index: number) => string>,
149   },
150
151   scroll: {
152     type: Object as PropType<{ x: number | true; y: number }>,
153     default: null,
154   },
155 };