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;
`;
const HintSpan = styled.span`
color: gray;
margin-left: 5px;
`;
function isDataCell(cell) {
return cell[1] % 2 == 1;
}
@ -310,6 +315,11 @@ export default function FormView(props) {
copyToClipboard();
}
if (event.keyCode == keycodes.f5) {
event.preventDefault();
onReload();
}
if (
!event.ctrlKey &&
!event.altKey &&
@ -452,6 +462,11 @@ export default function FormView(props) {
) : (
<>
<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>

View File

@ -32,7 +32,7 @@ async function loadRow(props, sql) {
}
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 [reloadToken, setReloadToken] = React.useState(0);
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(() => {
if (formDisplay) handleLoadCurrentRow();
setRowCountInfo(null);