Commit 8447331197fc0975f32f5df9cc306ece4a09f400
Committed by
GitHub
1 parent
787bc462
chore: table size放到settings (#1294)
Showing
4 changed files
with
19 additions
and
3 deletions
src/components/Table/src/BasicTable.vue
... | ... | @@ -222,7 +222,6 @@ |
222 | 222 | const getBindValues = computed(() => { |
223 | 223 | const dataSource = unref(getDataSourceRef); |
224 | 224 | let propsData: Recordable = { |
225 | - size: 'middle', | |
226 | 225 | // ...(dataSource.length === 0 ? { getPopupContainer: () => document.body } : {}), |
227 | 226 | ...attrs, |
228 | 227 | customRow, | ... | ... |
src/components/Table/src/const.ts
... | ... | @@ -2,7 +2,14 @@ import componentSetting from '/@/settings/componentSetting'; |
2 | 2 | |
3 | 3 | const { table } = componentSetting; |
4 | 4 | |
5 | -const { pageSizeOptions, defaultPageSize, fetchSetting, defaultSortFn, defaultFilterFn } = table; | |
5 | +const { | |
6 | + pageSizeOptions, | |
7 | + defaultPageSize, | |
8 | + fetchSetting, | |
9 | + defaultSize, | |
10 | + defaultSortFn, | |
11 | + defaultFilterFn, | |
12 | +} = table; | |
6 | 13 | |
7 | 14 | export const ROW_KEY = 'key'; |
8 | 15 | |
... | ... | @@ -15,6 +22,9 @@ export const PAGE_SIZE = defaultPageSize; |
15 | 22 | // Common interface field settings |
16 | 23 | export const FETCH_SETTING = fetchSetting; |
17 | 24 | |
25 | +// Default Size | |
26 | +export const DEFAULT_SIZE = defaultSize; | |
27 | + | |
18 | 28 | // Configure general sort function |
19 | 29 | export const DEFAULT_SORT_FN = defaultSortFn; |
20 | 30 | ... | ... |
src/components/Table/src/props.ts
... | ... | @@ -7,9 +7,10 @@ import type { |
7 | 7 | SorterResult, |
8 | 8 | TableCustomRecord, |
9 | 9 | TableRowSelection, |
10 | + SizeType, | |
10 | 11 | } from './types/table'; |
11 | 12 | import type { FormProps } from '/@/components/Form'; |
12 | -import { DEFAULT_FILTER_FN, DEFAULT_SORT_FN, FETCH_SETTING } from './const'; | |
13 | +import { DEFAULT_FILTER_FN, DEFAULT_SORT_FN, FETCH_SETTING, DEFAULT_SIZE } from './const'; | |
13 | 14 | import { propTypes } from '/@/utils/propTypes'; |
14 | 15 | |
15 | 16 | export const basicProps = { |
... | ... | @@ -141,4 +142,8 @@ export const basicProps = { |
141 | 142 | }) => Promise<any> |
142 | 143 | >, |
143 | 144 | }, |
145 | + size: { | |
146 | + type: String as PropType<SizeType>, | |
147 | + default: DEFAULT_SIZE, | |
148 | + }, | |
144 | 149 | }; | ... | ... |
src/settings/componentSetting.ts
... | ... | @@ -21,6 +21,8 @@ export default { |
21 | 21 | pageSizeOptions: ['10', '50', '80', '100'], |
22 | 22 | // Default display quantity on one page |
23 | 23 | defaultPageSize: 10, |
24 | + // Default Size | |
25 | + defaultSize: 'middle', | |
24 | 26 | // Custom general sort function |
25 | 27 | defaultSortFn: (sortInfo: SorterResult) => { |
26 | 28 | const { field, order } = sortInfo; | ... | ... |