Skip to content

Commit 6c48539

Browse files
Table: expose selectedCell property
1 parent 351dee0 commit 6c48539

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,5 +807,17 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
807807
},
808808
trans("table.filterDesc")
809809
),
810+
new DepsConfig(
811+
"selectedCell",
812+
(children) => {
813+
return {
814+
selectedCell: children.selectedCell.node(),
815+
};
816+
},
817+
(input) => {
818+
return input.selectedCell;
819+
},
820+
trans("table.selectedCellDesc")
821+
),
810822
new NameConfig("data", trans("table.dataDesc")),
811823
]);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
477477
columnsStyle: TableColumnStyleType;
478478
size?: string;
479479
rowAutoHeight?: boolean;
480+
onCellClick: (columnName: string) => void;
480481
};
481482

482483
function TableCellView(props: {
@@ -631,6 +632,7 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
631632
linkStyle,
632633
tableSize: props.size,
633634
autoHeight: props.rowAutoHeight,
635+
onClick: () => props.onCellClick(col.titleText),
634636
}),
635637
onHeaderCell: () => ({
636638
width: resizeWidth,
@@ -868,6 +870,9 @@ export function TableCompView(props: {
868870
(compChildren.data as any).isLoading()) ||
869871
compChildren.loading.getView()
870872
}
873+
onCellClick={(columnName: string) => {
874+
comp.children.selectedCell.dispatchChangeValueAction(columnName);
875+
}}
871876
/>
872877

873878
<SlotConfigContext.Provider value={{ modalWidth: width && Math.max(width, 300) }}>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ const tableChildrenMap = {
225225
// todo: support object config
226226
dynamicColumnConfig: ArrayStringControl,
227227
expansion: ExpansionControl,
228+
selectedCell: stateComp<string>(''),
228229
};
229230

230231
export const TableInitComp = (function () {

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,7 @@ export const en = {
19691969
"expandable": "Expandable",
19701970
"configExpandedView": "Configure Expanded View",
19711971
"toUpdateRowsDesc": "An Array of Objects for Rows to Be Updated in Editable Tables.",
1972+
"selectedCellDesc": "Selected Cell",
19721973
"empty": "Empty",
19731974
"falseValues": "Text When False",
19741975
"iconTrue": "Icon When True",

0 commit comments

Comments
 (0)