Skip to content

Commit

Permalink
fix: Disable applying "No formatting"
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Feb 24, 2023
1 parent 7a7fc14 commit a9f96f9
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getConditionConfig,
getDefaultStyleConfig,
ModelColumn,
FormatStyleType,
} from './ConditionalFormattingUtils';
import ConditionEditor from './ConditionEditor';
import StyleEditor from './StyleEditor';
Expand Down Expand Up @@ -83,14 +84,20 @@ function ColumnFormatEditor(props: ColumnFormatEditorProps): JSX.Element {

useEffect(
function updateColumnFormat() {
let isValid = conditionValid;

if (selectedColumn === undefined) {
log.debug('Column is not selected, skip update.');
return;
log.debug('Column is not selected, invalidating update.');
isValid = false;
}
if (selectedStyle === undefined) {
log.debug('Style is not selected, skip update.');
return;
if (
selectedStyle === undefined ||
selectedStyle.type === FormatStyleType.NO_FORMATTING
) {
log.debug('Style is not selected, invalidating update.');
isValid = false;
}

const { type, name } = selectedColumn;
const column = { type, name };
onChange(
Expand All @@ -99,7 +106,7 @@ function ColumnFormatEditor(props: ColumnFormatEditorProps): JSX.Element {
style: selectedStyle,
...conditionConfig,
},
conditionValid
isValid
);
},
[onChange, selectedColumn, selectedStyle, conditionConfig, conditionValid]
Expand Down

0 comments on commit a9f96f9

Please sign in to comment.