Commit cdf0a600e505daf429446b8a7968269e1034de04
1 parent
efbde0d5
perf: perf table
Showing
8 changed files
with
40 additions
and
23 deletions
src/components/Button/src/PopConfirmButton.vue
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | inheritAttrs: false, |
14 | 14 | components: { Popconfirm, BasicButton }, |
15 | 15 | props: { |
16 | + size: propTypes.oneOf(['large', 'default', 'small']).def(), | |
16 | 17 | enable: propTypes.bool.def(true), |
17 | 18 | okText: propTypes.string, |
18 | 19 | cancelText: propTypes.string, |
... | ... | @@ -31,7 +32,7 @@ |
31 | 32 | return popValues; |
32 | 33 | }); |
33 | 34 | return () => { |
34 | - const Button = h(BasicButton, omit(unref(attrs), 'icon'), extendSlots(slots)); | |
35 | + const Button = h(BasicButton, unref(getBindValues), extendSlots(slots)); | |
35 | 36 | if (!props.enable) { |
36 | 37 | return Button; |
37 | 38 | } | ... | ... |
src/components/Table/index.ts
... | ... | @@ -2,11 +2,9 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; |
2 | 2 | |
3 | 3 | export { default as BasicTable } from './src/BasicTable.vue'; |
4 | 4 | export { default as TableAction } from './src/components/TableAction.vue'; |
5 | -// export { default as TableImg } from './src/components/TableImg.vue'; | |
6 | 5 | export { default as EditTableHeaderIcon } from './src/components/EditTableHeaderIcon.vue'; |
7 | 6 | |
8 | 7 | export const TableImg = createAsyncComponent(() => import('./src/components/TableImg.vue')); |
9 | -// export const TableAction = createAsyncComponent(() => import('./src/components/TableAction.vue')); | |
10 | 8 | |
11 | 9 | export * from './src/types/table'; |
12 | 10 | export * from './src/types/pagination'; | ... | ... |
src/components/Table/src/components/TableAction.vue
... | ... | @@ -5,7 +5,10 @@ |
5 | 5 | <Icon :icon="action.icon" class="mr-1" v-if="action.icon" /> |
6 | 6 | {{ action.label }} |
7 | 7 | </PopConfirmButton> |
8 | - <Divider type="vertical" v-if="divider && index < getActions.length" /> | |
8 | + <Divider | |
9 | + type="vertical" | |
10 | + v-if="divider && index < getActions.length - (dropDownActions ? 0 : 1)" | |
11 | + /> | |
9 | 12 | </template> |
10 | 13 | <Dropdown :trigger="['hover']" :dropMenuList="getDropList" v-if="dropDownActions"> |
11 | 14 | <slot name="more" /> |
... | ... | @@ -44,17 +47,31 @@ |
44 | 47 | }, |
45 | 48 | setup(props) { |
46 | 49 | const { prefixCls } = useDesign('basic-table-action'); |
47 | - let table = {}; | |
50 | + let table: Partial<TableActionType> = {}; | |
48 | 51 | if (!props.outside) { |
49 | 52 | table = useTableContext(); |
50 | 53 | } |
51 | 54 | |
55 | + // const getSize = computed(() => { | |
56 | + // const size = table?.getSize?.(); | |
57 | + // if (size === 'middle' || !size) { | |
58 | + // return; | |
59 | + // } | |
60 | + | |
61 | + // if (size === 'default') { | |
62 | + // return 'large'; | |
63 | + // } | |
64 | + // return size; | |
65 | + // }); | |
66 | + | |
52 | 67 | const getActions = computed(() => { |
53 | 68 | return (props.actions || []).map((action) => { |
54 | 69 | const { popConfirm } = action; |
70 | + // const size = unref(getSize); | |
55 | 71 | return { |
56 | 72 | type: 'link', |
57 | 73 | size: 'small', |
74 | + // ...(size ? { size } : {}), | |
58 | 75 | ...action, |
59 | 76 | ...(popConfirm || {}), |
60 | 77 | onConfirm: popConfirm?.confirm, | ... | ... |
src/components/Table/src/components/editable/EditableCell.vue
... | ... | @@ -85,6 +85,18 @@ |
85 | 85 | return unref(ruleMessage) && unref(ruleVisible); |
86 | 86 | }); |
87 | 87 | |
88 | + // const getSize = computed(() => { | |
89 | + // const size = table?.getSize?.(); | |
90 | + // if (size === 'middle' || !size) { | |
91 | + // return; | |
92 | + // } | |
93 | + | |
94 | + // if (size === 'default') { | |
95 | + // return 'large'; | |
96 | + // } | |
97 | + // return size; | |
98 | + // }); | |
99 | + | |
88 | 100 | const getIsCheckComp = computed(() => { |
89 | 101 | const component = unref(getComponent); |
90 | 102 | return ['Checkbox', 'Switch'].includes(component); |
... | ... | @@ -300,6 +312,7 @@ |
300 | 312 | handleOptionsChange, |
301 | 313 | getWrapperStyle, |
302 | 314 | getRowEditable, |
315 | + // getSize, | |
303 | 316 | }; |
304 | 317 | }, |
305 | 318 | }); | ... | ... |
src/components/Table/src/components/editable/helper.ts
... | ... | @@ -8,10 +8,10 @@ const { t } = useI18n(); |
8 | 8 | */ |
9 | 9 | export function createPlaceholderMessage(component: ComponentType) { |
10 | 10 | if (component.includes('Input')) { |
11 | - return t('component.form.input'); | |
11 | + return t('common.inputText'); | |
12 | 12 | } |
13 | 13 | if (component.includes('Picker')) { |
14 | - return t('component.form.choose'); | |
14 | + return t('common.chooseText'); | |
15 | 15 | } |
16 | 16 | |
17 | 17 | if ( |
... | ... | @@ -20,7 +20,7 @@ export function createPlaceholderMessage(component: ComponentType) { |
20 | 20 | component.includes('Radio') || |
21 | 21 | component.includes('Switch') |
22 | 22 | ) { |
23 | - return t('component.form.choose'); | |
23 | + return t('common.chooseText'); | |
24 | 24 | } |
25 | 25 | return ''; |
26 | 26 | } | ... | ... |
src/components/Table/src/hooks/useTableScroll.ts
... | ... | @@ -143,7 +143,7 @@ export function useTableScroll( |
143 | 143 | |
144 | 144 | const table = unref(tableElRef); |
145 | 145 | const tableWidth = table?.$el?.offsetWidth ?? 0; |
146 | - return tableWidth > width ? tableWidth - 24 : width; | |
146 | + return tableWidth > width ? '100%' : width; | |
147 | 147 | }); |
148 | 148 | |
149 | 149 | const getScrollRef = computed(() => { | ... | ... |
src/components/Table/src/style/index.less
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | // |
52 | 52 | .ant-table { |
53 | 53 | width: 100%; |
54 | - overflow-x: auto; | |
54 | + overflow-x: hidden; | |
55 | 55 | border: none; |
56 | 56 | |
57 | 57 | &-title { |
... | ... | @@ -107,22 +107,11 @@ |
107 | 107 | border: 1px solid @border-color !important; |
108 | 108 | } |
109 | 109 | |
110 | - .ant-table td { | |
111 | - white-space: nowrap; | |
112 | - } | |
113 | - | |
114 | 110 | .ant-table-tbody > tr > td, |
115 | 111 | .ant-table-tbody > tr > th, |
116 | 112 | .ant-table-thead > tr > td, |
117 | 113 | .ant-table-thead > tr > th { |
118 | - white-space: pre; | |
119 | - } | |
120 | - | |
121 | - .ant-table-tbody > tr > td > span, | |
122 | - .ant-table-tbody > tr > th > span, | |
123 | - .ant-table-thead > tr > td > span, | |
124 | - .ant-table-thead > tr > th > span { | |
125 | - display: block; | |
114 | + white-space: nowrap; | |
126 | 115 | } |
127 | 116 | |
128 | 117 | .ant-table-row-cell-last { | ... | ... |