Skip to content

Commit 06b5caf

Browse files
fix: currentCell is undefined in conditional cell color field
1 parent 0a18b11 commit 06b5caf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const CellColorTempComp = withContext(
6767
})
6868
)
6969
.build(),
70-
["currentCell"] as const
70+
["currentCell", "currentRow"] as const
7171
);
7272

7373
// @ts-ignore
@@ -79,6 +79,7 @@ export class CellColorComp extends CellColorTempComp {
7979

8080
// fixme, should be infer from RowColorComp, but withContext type incorrect
8181
export type CellColorViewType = (param: {
82+
currentRow: any;
8283
currentCell: JSONValue | undefined; //number | string;
8384
}) => string;
8485

@@ -152,6 +153,7 @@ export class ColumnComp extends ColumnInitComp {
152153
comp.children.cellColor.reduce(
153154
CellColorComp.changeContextDataAction({
154155
currentCell: undefined,
156+
currentRow: {},
155157
})
156158
)
157159
);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ function TableCellView(props: {
535535
});
536536
const cellColor = cellColorFn({
537537
currentCell: record[title],
538+
currentRow: record,
538539
});
539540

540541
const style = {
@@ -627,7 +628,7 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
627628
},
628629
onCell: (record: RecordType, rowIndex: any) => ({
629630
record,
630-
title: col.titleText,
631+
title: String(col.dataIndex),
631632
rowColorFn: props.rowColorFn,
632633
rowHeightFn: props.rowHeightFn,
633634
cellColorFn: cellColorFn,

0 commit comments

Comments
 (0)