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