Skip to content

Commit 7508807

Browse files
author
Sebastian Reid
committed
Merge branch 'dev' of https://github.com/th37rose/lowcoder_dev1 into feature/bundle
2 parents 9b2fb24 + eb880ae commit 7508807

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,19 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
131131
{status === "toSave" && !isEditing && <EditableChip />}
132132
{normalView}
133133
{/* overlay on normal view to handle double click for editing */}
134-
<div
135-
style={{
136-
position: 'absolute',
137-
top: 0,
138-
left: 0,
139-
width: '100%',
140-
height: '100%',
141-
}}
142-
onDoubleClick={enterEditFn}
143-
>
144-
</div>
134+
{editable && (
135+
<div
136+
style={{
137+
position: 'absolute',
138+
top: 0,
139+
left: 0,
140+
width: '100%',
141+
height: '100%',
142+
}}
143+
onDoubleClick={enterEditFn}
144+
>
145+
</div>
146+
)}
145147
</ColumnTypeView>
146148
);
147149
}

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: 10 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, dataIndex: string) => void;
480481
};
481482

482483
function TableCellView(props: {
@@ -631,6 +632,9 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
631632
linkStyle,
632633
tableSize: props.size,
633634
autoHeight: props.rowAutoHeight,
635+
onClick: () => {
636+
props.onCellClick(col.titleText, String(col.dataIndex));
637+
}
634638
}),
635639
onHeaderCell: () => ({
636640
width: resizeWidth,
@@ -868,6 +872,12 @@ export function TableCompView(props: {
868872
(compChildren.data as any).isLoading()) ||
869873
compChildren.loading.getView()
870874
}
875+
onCellClick={(columnName: string, dataIndex: string) => {
876+
comp.children.selectedCell.dispatchChangeValueAction({
877+
name: columnName,
878+
dataIndex: dataIndex,
879+
});
880+
}}
871881
/>
872882

873883
<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<JSONObject>({}),
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)