Skip to content

Commit

Permalink
fix(cf): when previewing a number format, the conditional format styl…
Browse files Browse the repository at this point in the history
…e does not take effect (#439)
  • Loading branch information
Gggpound committed Mar 19, 2024
1 parent 83599d3 commit d9e1e2a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/sheets-numfmt/src/controllers/numfmt.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export class NumfmtController extends Disposable implements INumfmtController {
priority: 99,
handler: (cell, location, next) => {
const { row, col } = location;
const defaultValue = next(cell) || {};
if (
selectionRanges.find(
(range) =>
Expand All @@ -308,26 +309,26 @@ export class NumfmtController extends Disposable implements INumfmtController {
type !== CellValueType.NUMBER ||
this._previewPattern === null
) {
return next(cell);
return defaultValue;
}
const info = getPatternPreview(this._previewPattern, value as number, this._localeService.getCurrentLocale());
if (info.color) {
const colorMap = this._themeService.getCurrentTheme();
const color = colorMap[`${info.color}500`];
return {
...cell,
...defaultValue,
v: info.result,
t: CellValueType.STRING,
s: { cl: { rgb: color } },
};
}
return {
...cell,
...defaultValue,
v: info.result,
t: CellValueType.STRING,
};
}
return next(cell);
return defaultValue;
},
})
);
Expand Down

0 comments on commit d9e1e2a

Please sign in to comment.