Skip to content

Commit f560a9a

Browse files
Table: added gradients
1 parent 0d4b64d commit f560a9a

File tree

2 files changed

+27
-40
lines changed

2 files changed

+27
-40
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -73,76 +73,54 @@ const getStyle = (
7373
.ant-table-tbody {
7474
> tr:nth-of-type(2n + 1) {
7575
background: ${genLinerGradient(rowStyle.background)};
76-
&,
77-
> td {
78-
// border-bottom:${rowStyle.borderWidth} ${rowStyle.borderStyle} ${rowStyle.border} !important;
79-
// border-right:${rowStyle.borderWidth} ${rowStyle.borderStyle} ${rowStyle.border} !important;
80-
}
8176
}
8277
8378
> tr:nth-of-type(2n) {
8479
background: ${alternateBackground};
85-
&,
86-
> td {
87-
// border-bottom:${rowStyle.borderWidth} ${rowStyle.borderStyle} ${rowStyle.border} !important;
88-
// border-right:${rowStyle.borderWidth} ${rowStyle.borderStyle} ${rowStyle.border} !important;
89-
}
9080
}
9181
9282
// selected row
9383
> tr:nth-of-type(2n + 1).ant-table-row-selected {
9484
background: ${selectedRowBackground}, ${rowStyle.background} !important;
95-
> td {
85+
> td.ant-table-cell {
86+
background: transparent !important;
9687
}
9788
9889
// > td.ant-table-cell-row-hover,
9990
&:hover {
10091
background: ${hoverRowBackground}, ${selectedRowBackground}, ${rowStyle.background} !important;
10192
}
102-
103-
> td {
104-
}
10593
}
10694
10795
> tr:nth-of-type(2n).ant-table-row-selected {
10896
background: ${selectedRowBackground}, ${alternateBackground} !important;
109-
> td {
97+
> td.ant-table-cell {
98+
background: transparent !important;
11099
}
111100
112101
// > td.ant-table-cell-row-hover,
113102
&:hover {
114103
background: ${hoverRowBackground}, ${selectedRowBackground}, ${alternateBackground} !important;
115104
}
116-
> td {
117-
}
118105
}
119106
120107
// hover row
121-
> tr:nth-of-type(2n + 1).row-hover {
108+
> tr:nth-of-type(2n + 1):hover {
122109
background: ${hoverRowBackground}, ${rowStyle.background} !important;
123-
}
124-
> tr:nth-of-type(2n).row-hover {
125-
background: ${hoverRowBackground}, ${alternateBackground} !important;
126-
}
127-
> tr:nth-of-type(2n + 1) > td.ant-table-cell-row-hover {
128-
&,
129-
> div:nth-of-type(2) {
130-
// background: ${hoverRowBackground}, ${rowStyle.background} !important;
110+
> td.ant-table-cell-row-hover {
111+
background: transparent;
131112
}
132113
}
133-
134-
> tr:nth-of-type(2n) > td.ant-table-cell-row-hover {
135-
// background: ${hoverRowBackground}, ${alternateBackground} !important;
136-
&,
137-
> div:nth-of-type(2) {
114+
> tr:nth-of-type(2n):hover {
115+
background: ${hoverRowBackground}, ${alternateBackground} !important;
116+
> td.ant-table-cell-row-hover {
117+
background: transparent;
138118
}
139119
}
140120
141121
> tr.ant-table-expanded-row {
142122
background: ${background};
143123
}
144-
> td {
145-
}
146124
}
147125
`;
148126
};
@@ -615,11 +593,8 @@ function TableCellView(props: {
615593
rowHeight: rowHeight,
616594
}
617595
let { background } = style;
618-
if (rowContext.selected) {
619-
background = genLinerGradient(handleToSelectedRow(background)) + "," + background;
620-
}
621596
if (rowContext.hover) {
622-
background = genLinerGradient(handleToHoverRow(background)) + "," + background;
597+
background = 'transparent';
623598
}
624599

625600
tdView = (
@@ -655,7 +630,6 @@ function TableRowView(props: any) {
655630
<TableRowContext.Provider value={{ hover: hover, selected: selected }}>
656631
<tr
657632
{...props}
658-
className={hover ? 'row-hover': ''}
659633
tabIndex={-1}
660634
onMouseEnter={() => setHover(true)}
661635
onMouseLeave={() => setHover(false)}
@@ -999,6 +973,7 @@ export function TableCompView(props: {
999973
<TableSummary
1000974
tableSize={size}
1001975
istoolbarPositionBelow={toolbar.position === "below"}
976+
multiSelectEnabled={compChildren.selection.children.mode.value === 'multiple'}
1002977
expandableRows={Boolean(expansion.expandModalView)}
1003978
summaryRows={parseInt(summaryRows)}
1004979
columns={columns}

client/packages/lowcoder/src/comps/comps/tableComp/tableSummaryComp.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import Tooltip from "antd/es/tooltip";
99

1010
const TableSummaryRow = styled(Table.Summary.Row)<{
1111
$istoolbarPositionBelow: boolean;
12+
$background: string;
1213
}>`
14+
${props => `background: ${props.$background}`};
15+
1316
td:last-child {
1417
border-right: unset !important;
1518
}
@@ -143,7 +146,7 @@ function TableSummaryCellView(props: {
143146
} = props;
144147

145148
const style = {
146-
background: cellColor || columnStyle.background || rowStyle.background,
149+
background: cellColor || columnStyle.background,
147150
margin: columnStyle.margin || rowStyle.margin,
148151
text: columnStyle.text || rowStyle.text,
149152
border: columnStyle.border || rowStyle.border,
@@ -174,6 +177,7 @@ function TableSummaryCellView(props: {
174177
export function TableSummary(props: {
175178
tableSize: string;
176179
expandableRows: boolean;
180+
multiSelectEnabled: boolean;
177181
summaryRows: number;
178182
columns: ColumnComp[];
179183
summaryRowStyle: TableSummaryRowStyleType;
@@ -185,19 +189,27 @@ export function TableSummary(props: {
185189
summaryRowStyle,
186190
tableSize,
187191
expandableRows,
192+
multiSelectEnabled,
188193
istoolbarPositionBelow,
189194
} = props;
190195
let visibleColumns = columns.filter(col => !col.getView().hide);
191196
if (expandableRows) {
192197
visibleColumns.unshift(new ColumnComp({}));
193198
}
199+
if (multiSelectEnabled) {
200+
visibleColumns.unshift(new ColumnComp({}));
201+
}
194202

195203
if (!visibleColumns.length) return <></>;
196204

197205
return (
198206
<Table.Summary>
199207
{Array.from(Array(summaryRows)).map((_, rowIndex) => (
200-
<TableSummaryRow key={rowIndex} $istoolbarPositionBelow={istoolbarPositionBelow}>
208+
<TableSummaryRow
209+
key={rowIndex}
210+
$istoolbarPositionBelow={istoolbarPositionBelow}
211+
$background={summaryRowStyle.background}
212+
>
201213
{visibleColumns.map((column, index) => {
202214
const summaryColumn = column.children.summaryColumns.getView()[rowIndex].getView();
203215
return (

0 commit comments

Comments
 (0)