Commit cdf2c59e5c3b070d039c04fb746b53147f5e0ced
1 parent
36a7e70c
fix(table): fix the problem that multi-level header configuration does not take effect
Showing
3 changed files
with
30 additions
and
93 deletions
CHANGELOG.zh_CN.md
@@ -30,6 +30,7 @@ | @@ -30,6 +30,7 @@ | ||
30 | - 修复`useECharts`在`resize`时不能自适应,报错 | 30 | - 修复`useECharts`在`resize`时不能自适应,报错 |
31 | - 修复`useWatermark`在清空后`resize`未删除 | 31 | - 修复`useWatermark`在清空后`resize`未删除 |
32 | - 修复表单校验问题 | 32 | - 修复表单校验问题 |
33 | +- 修复多级表头配置不生效问题 | ||
33 | 34 | ||
34 | ## 2.0.0-rc.8 (2020-11-2) | 35 | ## 2.0.0-rc.8 (2020-11-2) |
35 | 36 |
src/components/Table/src/hooks/useColumns.ts
@@ -23,18 +23,11 @@ export function useColumns( | @@ -23,18 +23,11 @@ export function useColumns( | ||
23 | } | 23 | } |
24 | let pushIndexColumns = false; | 24 | let pushIndexColumns = false; |
25 | columns.forEach((item) => { | 25 | columns.forEach((item) => { |
26 | - const { key, dataIndex } = item; | ||
27 | - item.align = item.align || 'center'; | ||
28 | - if (ellipsis) { | ||
29 | - if (!key) { | ||
30 | - item.key = dataIndex; | ||
31 | - } | ||
32 | - if (!isBoolean(item.ellipsis)) { | ||
33 | - Object.assign(item, { | ||
34 | - ellipsis, | ||
35 | - }); | ||
36 | - } | ||
37 | - } | 26 | + const { children } = item; |
27 | + handleItem(item, !!ellipsis); | ||
28 | + | ||
29 | + handleChildren(children, !!ellipsis); | ||
30 | + | ||
38 | const indIndex = columns.findIndex((column) => column.flag === 'INDEX'); | 31 | const indIndex = columns.findIndex((column) => column.flag === 'INDEX'); |
39 | if (showIndexColumn && !isTreeTable) { | 32 | if (showIndexColumn && !isTreeTable) { |
40 | pushIndexColumns = indIndex === -1; | 33 | pushIndexColumns = indIndex === -1; |
@@ -88,6 +81,30 @@ export function useColumns( | @@ -88,6 +81,30 @@ export function useColumns( | ||
88 | cacheColumnsRef.value = columns; | 81 | cacheColumnsRef.value = columns; |
89 | }); | 82 | }); |
90 | 83 | ||
84 | + function handleItem(item: BasicColumn, ellipsis: boolean) { | ||
85 | + const { key, dataIndex } = item; | ||
86 | + item.align = item.align || 'center'; | ||
87 | + if (ellipsis) { | ||
88 | + if (!key) { | ||
89 | + item.key = dataIndex; | ||
90 | + } | ||
91 | + if (!isBoolean(item.ellipsis)) { | ||
92 | + Object.assign(item, { | ||
93 | + ellipsis, | ||
94 | + }); | ||
95 | + } | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + function handleChildren(children: BasicColumn[] | undefined, ellipsis: boolean) { | ||
100 | + if (!children) return; | ||
101 | + children.forEach((item) => { | ||
102 | + const { children } = item; | ||
103 | + handleItem(item, ellipsis); | ||
104 | + handleChildren(children, ellipsis); | ||
105 | + }); | ||
106 | + } | ||
107 | + | ||
91 | function setColumns(columns: BasicColumn[] | string[]) { | 108 | function setColumns(columns: BasicColumn[] | string[]) { |
92 | if (!isArray(columns)) return; | 109 | if (!isArray(columns)) return; |
93 | 110 |
src/design/ant/selection.less deleted
100644 → 0
1 | -.ant-radio { | ||
2 | - &-inner { | ||
3 | - border-color: @text-color-base; | ||
4 | - | ||
5 | - &::after { | ||
6 | - top: 1px; | ||
7 | - left: 1px; | ||
8 | - width: 12px; | ||
9 | - height: 12px; | ||
10 | - } | ||
11 | - } | ||
12 | -} | ||
13 | - | ||
14 | -.ant-radio-disabled .ant-radio-inner { | ||
15 | - border-color: @text-color-help-light !important; | ||
16 | -} | ||
17 | - | ||
18 | -.ant-checkbox { | ||
19 | - &-inner { | ||
20 | - border-color: @text-color-base; | ||
21 | - } | ||
22 | -} | ||
23 | - | ||
24 | -.ant-checkbox-disabled .ant-checkbox-inner { | ||
25 | - border-color: @text-color-help-light !important; | ||
26 | -} | ||
27 | - | ||
28 | -// select | ||
29 | -.ant-select { | ||
30 | - &-selection { | ||
31 | - border-color: @border-color-shallow-dark; | ||
32 | - } | ||
33 | - | ||
34 | - &-selection__placeholder, | ||
35 | - &-search__field__placeholder { | ||
36 | - color: @text-color-help-dark; | ||
37 | - } | ||
38 | -} | ||
39 | - | ||
40 | -.ant-select-disabled .ant-select-arrow { | ||
41 | - visibility: hidden; | ||
42 | -} | ||
43 | - | ||
44 | -.ant-select-dropdown { | ||
45 | - min-width: 84px !important; | ||
46 | - | ||
47 | - &.ant-select-dropdown--multiple { | ||
48 | - .ant-select-dropdown-menu-item-selected .ant-select-selected-icon, | ||
49 | - .ant-select-dropdown-menu-item-selected:hover .ant-select-selected-icon { | ||
50 | - color: @white; | ||
51 | - } | ||
52 | - } | ||
53 | - | ||
54 | - &-menu-item { | ||
55 | - height: 34px; | ||
56 | - min-width: 84px; | ||
57 | - line-height: 22px; | ||
58 | - color: @text-color-call-out; | ||
59 | - | ||
60 | - &:hover { | ||
61 | - // color: @--norm-select-item-hover-color; | ||
62 | - background: @tree-hover-background-color; | ||
63 | - } | ||
64 | - | ||
65 | - &-selected, | ||
66 | - &-selected:hover { | ||
67 | - color: @primary-color; | ||
68 | - background: @tree-hover-background-color; | ||
69 | - } | ||
70 | - | ||
71 | - &-disabled, | ||
72 | - &-disabled:hover { | ||
73 | - color: @disabled-color; | ||
74 | - background-color: @white; | ||
75 | - } | ||
76 | - } | ||
77 | -} | ||
78 | - | ||
79 | -.ant-select-disabled .ant-select-selection { | ||
80 | - background: @tree-hover-font-color; | ||
81 | -} |