bit fields fixed in dbgrid

This commit is contained in:
Jan Prochazka
2020-04-25 21:46:02 +02:00
parent 52d2560c78
commit fd7f3d7e47

View File

@@ -15,7 +15,7 @@ const TableBodyCell = styled.td`
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
${props => ${(props) =>
props.isSelected && props.isSelected &&
!props.isAutofillSelected && !props.isAutofillSelected &&
` `
@@ -23,14 +23,14 @@ const TableBodyCell = styled.td`
background-color: deepskyblue; background-color: deepskyblue;
color: white;`} color: white;`}
${props => ${(props) =>
props.isAutofillSelected && props.isAutofillSelected &&
` `
background: initial; background: initial;
background-color: magenta; background-color: magenta;
color: white;`} color: white;`}
${props => ${(props) =>
props.isModifiedRow && props.isModifiedRow &&
!props.isInsertedRow && !props.isInsertedRow &&
!props.isSelected && !props.isSelected &&
@@ -38,7 +38,7 @@ const TableBodyCell = styled.td`
!props.isModifiedCell && !props.isModifiedCell &&
` `
background-color: #FFFFDB;`} background-color: #FFFFDB;`}
${props => ${(props) =>
!props.isSelected && !props.isSelected &&
!props.isAutofillSelected && !props.isAutofillSelected &&
!props.isInsertedRow && !props.isInsertedRow &&
@@ -46,14 +46,14 @@ const TableBodyCell = styled.td`
` `
background-color: bisque;`} background-color: bisque;`}
${props => ${(props) =>
!props.isSelected && !props.isSelected &&
!props.isAutofillSelected && !props.isAutofillSelected &&
props.isInsertedRow && props.isInsertedRow &&
` `
background-color: #DBFFDB;`} background-color: #DBFFDB;`}
${props => ${(props) =>
!props.isSelected && !props.isSelected &&
!props.isAutofillSelected && !props.isAutofillSelected &&
props.isDeletedRow && props.isDeletedRow &&
@@ -61,7 +61,7 @@ const TableBodyCell = styled.td`
background-color: #FFDBFF; background-color: #FFDBFF;
`} `}
${props => ${(props) =>
props.isDeletedRow && props.isDeletedRow &&
` `
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAEElEQVQImWNgIAX8x4KJBAD+agT8INXz9wAAAABJRU5ErkJggg=='); background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAEElEQVQImWNgIAX8x4KJBAD+agT8INXz9wAAAABJRU5ErkJggg==');
@@ -113,6 +113,8 @@ const AutoFillPoint = styled.div`
function CellFormattedValue({ value }) { function CellFormattedValue({ value }) {
if (value == null) return <NullSpan>(NULL)</NullSpan>; if (value == null) return <NullSpan>(NULL)</NullSpan>;
if (_.isDate(value)) return moment(value).format('YYYY-MM-DD HH:mm:ss'); if (_.isDate(value)) return moment(value).format('YYYY-MM-DD HH:mm:ss');
if (value === true) return '1';
if (value === false) return '0';
return value; return value;
} }
@@ -153,20 +155,20 @@ function DataGridRow({
const [matchedField, matchedChangeSetItem] = findExistingChangeSetItem(changeSet, rowDefinition); const [matchedField, matchedChangeSetItem] = findExistingChangeSetItem(changeSet, rowDefinition);
const rowUpdated = matchedChangeSetItem ? { ...row, ...matchedChangeSetItem.fields } : row; const rowUpdated = matchedChangeSetItem ? { ...row, ...matchedChangeSetItem.fields } : row;
const hintFieldsAllowed = visibleRealColumns const hintFieldsAllowed = visibleRealColumns
.filter(col => { .filter((col) => {
if (!col.hintColumnName) return false; if (!col.hintColumnName) return false;
if (matchedChangeSetItem && matchedField == 'updates' && col.uniqueName in matchedChangeSetItem.fields) if (matchedChangeSetItem && matchedField == 'updates' && col.uniqueName in matchedChangeSetItem.fields)
return false; return false;
return true; return true;
}) })
.map(col => col.uniqueName); .map((col) => col.uniqueName);
return ( return (
<TableBodyRow style={{ height: `${rowHeight}px` }}> <TableBodyRow style={{ height: `${rowHeight}px` }}>
<TableHeaderCell data-row={rowIndex} data-col="header"> <TableHeaderCell data-row={rowIndex} data-col="header">
{rowIndex + 1} {rowIndex + 1}
</TableHeaderCell> </TableHeaderCell>
{visibleRealColumns.map(col => ( {visibleRealColumns.map((col) => (
<TableBodyCell <TableBodyCell
key={col.uniqueName} key={col.uniqueName}
style={{ style={{