@@ -29,7 +29,7 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
29
29
import { PrimaryColor } from "constants/style" ;
30
30
import { trans } from "i18n" ;
31
31
import _ from "lodash" ;
32
- import { darkenColor , isDarkColor , ScrollBar } from "lowcoder-design" ;
32
+ import { darkenColor , isDarkColor , isValidColor , ScrollBar } from "lowcoder-design" ;
33
33
import React , { Children , useCallback , useContext , useEffect , useMemo , useRef , useState } from "react" ;
34
34
import { Resizable } from "react-resizable" ;
35
35
import styled , { css } from "styled-components" ;
@@ -52,7 +52,7 @@ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
52
52
export const EMPTY_ROW_KEY = 'empty_row' ;
53
53
54
54
function genLinerGradient ( color : string ) {
55
- return `linear-gradient(${ color } , ${ color } )` ;
55
+ return isValidColor ( color ) ? `linear-gradient(${ color } , ${ color } )` : color ;
56
56
}
57
57
58
58
const getStyle = (
@@ -72,64 +72,77 @@ const getStyle = (
72
72
}
73
73
.ant-table-tbody {
74
74
> tr:nth-of-type(2n + 1) {
75
+ background: ${ genLinerGradient ( rowStyle . background ) } ;
75
76
&,
76
77
> td {
77
- background: ${ genLinerGradient ( rowStyle . background ) } ;
78
78
// border-bottom:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
79
79
// border-right:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
80
80
}
81
81
}
82
82
83
83
> tr:nth-of-type(2n) {
84
+ background: ${ alternateBackground } ;
84
85
&,
85
86
> td {
86
- background: ${ alternateBackground } ;
87
87
// border-bottom:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
88
88
// border-right:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
89
89
}
90
90
}
91
91
92
92
// selected row
93
93
> tr:nth-of-type(2n + 1).ant-table-row-selected {
94
+ background: ${ selectedRowBackground } , ${ rowStyle . background } !important;
94
95
> td {
95
- background: ${ selectedRowBackground } , ${ rowStyle . background } !important;
96
96
}
97
97
98
- > td.ant-table-cell-row-hover,
99
- &:hover > td {
98
+ // > td.ant-table-cell-row-hover,
99
+ &:hover {
100
100
background: ${ hoverRowBackground } , ${ selectedRowBackground } , ${ rowStyle . background } !important;
101
101
}
102
+
103
+ > td {
104
+ }
102
105
}
103
106
104
107
> tr:nth-of-type(2n).ant-table-row-selected {
108
+ background: ${ selectedRowBackground } , ${ alternateBackground } !important;
105
109
> td {
106
- background: ${ selectedRowBackground } , ${ alternateBackground } !important;
107
110
}
108
111
109
- > td.ant-table-cell-row-hover,
110
- &:hover > td {
112
+ // > td.ant-table-cell-row-hover,
113
+ &:hover {
111
114
background: ${ hoverRowBackground } , ${ selectedRowBackground } , ${ alternateBackground } !important;
112
115
}
116
+ > td {
117
+ }
113
118
}
114
119
115
120
// hover row
121
+ > tr:nth-of-type(2n + 1).row-hover {
122
+ background: ${ hoverRowBackground } , ${ rowStyle . background } !important;
123
+ }
124
+ > tr:nth-of-type(2n).row-hover {
125
+ background: ${ hoverRowBackground } , ${ alternateBackground } !important;
126
+ }
116
127
> tr:nth-of-type(2n + 1) > td.ant-table-cell-row-hover {
117
128
&,
118
129
> div:nth-of-type(2) {
119
- background: ${ hoverRowBackground } , ${ rowStyle . background } !important;
130
+ // background: ${ hoverRowBackground } , ${ rowStyle . background } !important;
120
131
}
121
132
}
122
133
123
134
> tr:nth-of-type(2n) > td.ant-table-cell-row-hover {
135
+ // background: ${ hoverRowBackground } , ${ alternateBackground } !important;
124
136
&,
125
137
> div:nth-of-type(2) {
126
- background: ${ hoverRowBackground } , ${ alternateBackground } !important;
127
138
}
128
139
}
129
140
130
- > tr.ant-table-expanded-row > td {
141
+ > tr.ant-table-expanded-row {
131
142
background: ${ background } ;
132
143
}
144
+ > td {
145
+ }
133
146
}
134
147
` ;
135
148
} ;
@@ -255,9 +268,11 @@ const TableWrapper = styled.div<{
255
268
z-index: 99;
256
269
`
257
270
}
271
+ > tr {
272
+ background: ${ ( props ) => props . $headerStyle . headerBackground } ;
273
+ }
258
274
> tr > th {
259
- background-color: ${ ( props ) => props . $headerStyle . headerBackground } ;
260
-
275
+ background: transparent;
261
276
border-color: ${ ( props ) => props . $headerStyle . border } ;
262
277
border-width: ${ ( props ) => props . $headerStyle . borderWidth } ;
263
278
color: ${ ( props ) => props . $headerStyle . headerText } ;
@@ -606,6 +621,7 @@ function TableCellView(props: {
606
621
if ( rowContext . hover ) {
607
622
background = genLinerGradient ( handleToHoverRow ( background ) ) + "," + background ;
608
623
}
624
+
609
625
tdView = (
610
626
< TableTd
611
627
{ ...restProps }
@@ -639,6 +655,7 @@ function TableRowView(props: any) {
639
655
< TableRowContext . Provider value = { { hover : hover , selected : selected } } >
640
656
< tr
641
657
{ ...props }
658
+ className = { hover ? 'row-hover' : '' }
642
659
tabIndex = { - 1 }
643
660
onMouseEnter = { ( ) => setHover ( true ) }
644
661
onMouseLeave = { ( ) => setHover ( false ) }
0 commit comments