form view

This commit is contained in:
Jan Prochazka 2021-01-11 17:34:09 +01:00
parent 9d50ac0093
commit 7485582612
2 changed files with 20 additions and 1 deletions

View File

@ -95,6 +95,11 @@ const RowCountLabel = styled.div`
bottom: 20px; bottom: 20px;
`; `;
const HintSpan = styled.span`
color: gray;
margin-left: 5px;
`;
function isDataCell(cell) { function isDataCell(cell) {
return cell[1] % 2 == 1; return cell[1] % 2 == 1;
} }
@ -310,6 +315,11 @@ export default function FormView(props) {
copyToClipboard(); copyToClipboard();
} }
if (event.keyCode == keycodes.f5) {
event.preventDefault();
onReload();
}
if ( if (
!event.ctrlKey && !event.ctrlKey &&
!event.altKey && !event.altKey &&
@ -452,6 +462,11 @@ export default function FormView(props) {
) : ( ) : (
<> <>
<CellFormattedValue value={rowData && rowData[col.columnName]} dataType={col.dataType} /> <CellFormattedValue value={rowData && rowData[col.columnName]} dataType={col.dataType} />
{!!col.hintColumnName &&
rowData &&
!(rowStatus.modifiedFields && rowStatus.modifiedFields.has(col.uniqueName)) && (
<HintSpan>{rowData[col.hintColumnName]}</HintSpan>
)}
</> </>
)} )}
</TableBodyCell> </TableBodyCell>

View File

@ -32,7 +32,7 @@ async function loadRow(props, sql) {
} }
export default function SqlFormView(props) { export default function SqlFormView(props) {
const { formDisplay, changeSetState, dispatchChangeSet, conid, database } = props; const { formDisplay, changeSetState, dispatchChangeSet, conid, database, onReferenceSourceChanged } = props;
const [rowData, setRowData] = React.useState(null); const [rowData, setRowData] = React.useState(null);
const [reloadToken, setReloadToken] = React.useState(0); const [reloadToken, setReloadToken] = React.useState(0);
const [rowCountInfo, setRowCountInfo] = React.useState(null); const [rowCountInfo, setRowCountInfo] = React.useState(null);
@ -70,6 +70,10 @@ export default function SqlFormView(props) {
} }
}; };
React.useEffect(() => {
if (onReferenceSourceChanged && rowData) onReferenceSourceChanged([rowData]);
}, [rowData]);
React.useEffect(() => { React.useEffect(() => {
if (formDisplay) handleLoadCurrentRow(); if (formDisplay) handleLoadCurrentRow();
setRowCountInfo(null); setRowCountInfo(null);