Skip to content

Commit

Permalink
fix(conditional-formatting): aligning Excel Effects with 'No Interfer… (
Browse files Browse the repository at this point in the history
  • Loading branch information
Gggpound authored Feb 5, 2025
1 parent d9043ef commit ce0b939
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,19 @@ export class HighlightCellCalculateUnit extends BaseCalculateUnit<Nullable<IConf
switch (ruleConfig.subType) {
case CFSubRuleType.number: {
const v = cellValue && Number(cellValue.v);
if (isNullable(v) || Number.isNaN(v) || cellValue?.t !== CellValueType.NUMBER) {
const isNumber = cellValue?.t === CellValueType.NUMBER;
const subRuleConfig = ruleConfig as INumberHighlightCell;
if (!isNumber) {
if ([CFNumberOperator.notEqual, CFNumberOperator.notBetween].includes(subRuleConfig.operator)) {
return true;
}
return false;
}

if (isNullable(v) || Number.isNaN(v)) {
return;
}
const subRuleConfig = ruleConfig as INumberHighlightCell;

return compareWithNumber({ operator: subRuleConfig.operator, value: subRuleConfig.value || 0 }, v || 0);
}
case CFSubRuleType.text: {
Expand Down Expand Up @@ -277,10 +286,20 @@ export class HighlightCellCalculateUnit extends BaseCalculateUnit<Nullable<IConf
case CFSubRuleType.average: {
const value = cellValue && cellValue.v;
const v = Number(value);
if (isNullable(value) || Number.isNaN(v) || cellValue?.t !== CellValueType.NUMBER || !preComputingResult) {
const isNumber = cellValue?.t === CellValueType.NUMBER;
const subRuleConfig = ruleConfig as IAverageHighlightCell;

if (!isNumber) {
if (CFNumberOperator.notEqual === subRuleConfig.operator) {
return true;
}
return false;
}
const subRuleConfig = ruleConfig as IAverageHighlightCell;

if (isNullable(value) || Number.isNaN(v) || !preComputingResult) {
return false;
}

const average = preComputingResult.value;

switch (subRuleConfig.operator) {
Expand Down

0 comments on commit ce0b939

Please sign in to comment.