cell data view for form view

This commit is contained in:
Jan Prochazka
2021-01-11 18:03:22 +01:00
parent 49849820e8
commit 817efb1c72
3 changed files with 23 additions and 7 deletions

View File

@@ -65,7 +65,9 @@ const TableBodyCell = styled.td`
padding: 2px;
white-space: nowrap;
position: relative;
max-width: 500px;
overflow: hidden;
text-overflow: ellipsis;
${(props) =>
props.isSelected &&
@@ -119,6 +121,7 @@ export default function FormView(props) {
onReconnect,
allRowCount,
rowCountBefore,
onSelectionChanged,
} = props;
/** @type {import('dbgate-datalib').FormViewDisplay} */
const formDisplay = props.formDisplay;
@@ -162,6 +165,13 @@ export default function FormView(props) {
}
}, [tabVisible, focusFieldRef.current]);
React.useEffect(() => {
if (!onSelectionChanged || !rowData) return;
const col = getCellColumn(currentCell);
if (!col) return;
onSelectionChanged(rowData[col.uniqueName]);
}, [onSelectionChanged, currentCell, rowData]);
const checkMoveCursorBounds = (row, col) => {
if (row < 0) row = 0;
if (col < 0) col = 0;