@@ -29,7 +29,7 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
2929import { PrimaryColor } from "constants/style" ;
3030import { trans } from "i18n" ;
3131import _ from "lodash" ;
32- import { darkenColor , isDarkColor , ScrollBar } from "lowcoder-design" ;
32+ import { darkenColor , isDarkColor , isValidColor , ScrollBar } from "lowcoder-design" ;
3333import React , { Children , useCallback , useContext , useEffect , useMemo , useRef , useState } from "react" ;
3434import { Resizable } from "react-resizable" ;
3535import styled , { css } from "styled-components" ;
@@ -52,7 +52,7 @@ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
5252export const EMPTY_ROW_KEY = 'empty_row' ;
5353
5454function genLinerGradient ( color : string ) {
55- return `linear-gradient(${ color } , ${ color } )` ;
55+ return isValidColor ( color ) ? `linear-gradient(${ color } , ${ color } )` : color ;
5656}
5757
5858const getStyle = (
@@ -72,64 +72,77 @@ const getStyle = (
7272 }
7373 .ant-table-tbody {
7474 > tr:nth-of-type(2n + 1) {
75+ background: ${ genLinerGradient ( rowStyle . background ) } ;
7576 &,
7677 > td {
77- background: ${ genLinerGradient ( rowStyle . background ) } ;
7878 // border-bottom:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
7979 // border-right:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
8080 }
8181 }
8282
8383 > tr:nth-of-type(2n) {
84+ background: ${ alternateBackground } ;
8485 &,
8586 > td {
86- background: ${ alternateBackground } ;
8787 // border-bottom:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
8888 // border-right:${ rowStyle . borderWidth } ${ rowStyle . borderStyle } ${ rowStyle . border } !important;
8989 }
9090 }
9191
9292 // selected row
9393 > tr:nth-of-type(2n + 1).ant-table-row-selected {
94+ background: ${ selectedRowBackground } , ${ rowStyle . background } !important;
9495 > td {
95- background: ${ selectedRowBackground } , ${ rowStyle . background } !important;
9696 }
9797
98- > td.ant-table-cell-row-hover,
99- &:hover > td {
98+ // > td.ant-table-cell-row-hover,
99+ &:hover {
100100 background: ${ hoverRowBackground } , ${ selectedRowBackground } , ${ rowStyle . background } !important;
101101 }
102+
103+ > td {
104+ }
102105 }
103106
104107 > tr:nth-of-type(2n).ant-table-row-selected {
108+ background: ${ selectedRowBackground } , ${ alternateBackground } !important;
105109 > td {
106- background: ${ selectedRowBackground } , ${ alternateBackground } !important;
107110 }
108111
109- > td.ant-table-cell-row-hover,
110- &:hover > td {
112+ // > td.ant-table-cell-row-hover,
113+ &:hover {
111114 background: ${ hoverRowBackground } , ${ selectedRowBackground } , ${ alternateBackground } !important;
112115 }
116+ > td {
117+ }
113118 }
114119
115120 // 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+ }
116127 > tr:nth-of-type(2n + 1) > td.ant-table-cell-row-hover {
117128 &,
118129 > div:nth-of-type(2) {
119- background: ${ hoverRowBackground } , ${ rowStyle . background } !important;
130+ // background: ${ hoverRowBackground } , ${ rowStyle . background } !important;
120131 }
121132 }
122133
123134 > tr:nth-of-type(2n) > td.ant-table-cell-row-hover {
135+ // background: ${ hoverRowBackground } , ${ alternateBackground } !important;
124136 &,
125137 > div:nth-of-type(2) {
126- background: ${ hoverRowBackground } , ${ alternateBackground } !important;
127138 }
128139 }
129140
130- > tr.ant-table-expanded-row > td {
141+ > tr.ant-table-expanded-row {
131142 background: ${ background } ;
132143 }
144+ > td {
145+ }
133146 }
134147 ` ;
135148} ;
@@ -255,9 +268,11 @@ const TableWrapper = styled.div<{
255268 z-index: 99;
256269 `
257270 }
271+ > tr {
272+ background: ${ ( props ) => props . $headerStyle . headerBackground } ;
273+ }
258274 > tr > th {
259- background-color: ${ ( props ) => props . $headerStyle . headerBackground } ;
260-
275+ background: transparent;
261276 border-color: ${ ( props ) => props . $headerStyle . border } ;
262277 border-width: ${ ( props ) => props . $headerStyle . borderWidth } ;
263278 color: ${ ( props ) => props . $headerStyle . headerText } ;
@@ -606,6 +621,7 @@ function TableCellView(props: {
606621 if ( rowContext . hover ) {
607622 background = genLinerGradient ( handleToHoverRow ( background ) ) + "," + background ;
608623 }
624+
609625 tdView = (
610626 < TableTd
611627 { ...restProps }
@@ -639,6 +655,7 @@ function TableRowView(props: any) {
639655 < TableRowContext . Provider value = { { hover : hover , selected : selected } } >
640656 < tr
641657 { ...props }
658+ className = { hover ? 'row-hover' : '' }
642659 tabIndex = { - 1 }
643660 onMouseEnter = { ( ) => setHover ( true ) }
644661 onMouseLeave = { ( ) => setHover ( false ) }
0 commit comments