Skip to content

Commit b31cae1

Browse files
fix status column edited value doesn't persist
1 parent f82d015 commit b31cae1

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

client/packages/lowcoder/src/components/table/EditableCell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
104104

105105
useEffect(() => {
106106
setTmpValue(value);
107-
}, [value]);
107+
}, [JSON.stringify(value)]);
108108

109109
const onChange = useCallback(
110110
(value: T) => {
@@ -125,11 +125,11 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
125125
if(!_.isEqual(tmpValue, value)) {
126126
onTableEvent?.('columnEdited');
127127
}
128-
}, [dispatch, baseValue, tmpValue]);
128+
}, [dispatch, JSON.stringify(baseValue), JSON.stringify(tmpValue)]);
129129

130130
const editView = useMemo(
131131
() => editViewFn?.({ value, onChange, onChangeEnd }) ?? <></>,
132-
[editViewFn, value, onChange, onChangeEnd]
132+
[editViewFn, JSON.stringify(value), onChange, onChangeEnd]
133133
);
134134

135135
const enterEditFn = useCallback(() => {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,6 @@ const TableWrapper = styled.div<{
325325
border-top-right-radius: 0px;
326326
}
327327
}
328-
329-
// hide the bottom border of the last row
330-
${(props) =>
331-
props.$toolbarPosition !== "below" &&
332-
`
333-
tbody > tr:last-child > td {
334-
border-bottom: unset;
335-
}
336-
`}
337328
}
338329
339330
.ant-table-expanded-row-fixed:after {
@@ -948,6 +939,7 @@ export function TableCompView(props: {
948939
return (
949940
<TableSummary
950941
tableSize={size}
942+
istoolbarPositionBelow={toolbar.position === "below"}
951943
expandableRows={Boolean(expansion.expandModalView)}
952944
summaryRows={parseInt(summaryRows)}
953945
columns={columns}

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ import Table from "antd/es/table";
77
import { ReactNode } from "react";
88
import Tooltip from "antd/es/tooltip";
99

10-
const TableSummaryRow = styled(Table.Summary.Row)`
10+
const TableSummaryRow = styled(Table.Summary.Row)<{
11+
$istoolbarPositionBelow: boolean;
12+
}>`
1113
td:last-child {
1214
border-right: unset !important;
1315
}
16+
17+
${props => !props.$istoolbarPositionBelow && `
18+
&:last-child td {
19+
border-bottom: none !important;
20+
}
21+
`}
22+
1423
`;
1524

1625
const TableSummarCell = styled(Table.Summary.Cell)<{
@@ -168,13 +177,15 @@ export function TableSummary(props: {
168177
summaryRows: number;
169178
columns: ColumnComp[];
170179
summaryRowStyle: TableSummaryRowStyleType;
180+
istoolbarPositionBelow: boolean;
171181
}) {
172182
const {
173183
columns,
174184
summaryRows,
175185
summaryRowStyle,
176186
tableSize,
177187
expandableRows,
188+
istoolbarPositionBelow,
178189
} = props;
179190
let visibleColumns = columns.filter(col => !col.getView().hide);
180191
if (expandableRows) {
@@ -186,7 +197,7 @@ export function TableSummary(props: {
186197
return (
187198
<Table.Summary>
188199
{Array.from(Array(summaryRows)).map((_, rowIndex) => (
189-
<TableSummaryRow key={rowIndex}>
200+
<TableSummaryRow key={rowIndex} $istoolbarPositionBelow={istoolbarPositionBelow}>
190201
{visibleColumns.map((column, index) => {
191202
const summaryColumn = column.children.summaryColumns.getView()[rowIndex].getView();
192203
return (

0 commit comments

Comments
 (0)