Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(conditional-formatting): gradient fills may conceal cell values (#1898)

Gpound.liu70d3a7e8f3b8
diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts
index 57c566b8e2..1ab3dac715 100644
--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts
+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.render.controller.ts
@@ -94,34 +94,35 @@ export class RenderController extends Disposable {
}
_initViewModelInterceptor() {
- this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, { handler: (cell, context, next) => {
- const result = this._conditionalFormattingService.composeStyle(context.unitId, context.subUnitId, context.row, context.col);
- if (!result) {
- return next(cell);
- }
- const styleMap = context.workbook.getStyles();
- const defaultStyle = (typeof cell?.s === 'string' ? styleMap.get(cell?.s) : cell?.s) || {};
- const s = { ...defaultStyle };
- const cloneCell = { ...cell, s } as IConditionalFormattingCellData & ISheetFontRenderExtension;
- if (result.style) {
- Object.assign(s, result.style);
- }
- if (!cloneCell.fontRenderExtension) {
- cloneCell.fontRenderExtension = {};
- if (!result.isShowValue) {
- cloneCell.fontRenderExtension.isSkip = true;
+ this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
+ handler: (cell, context, next) => {
+ const result = this._conditionalFormattingService.composeStyle(context.unitId, context.subUnitId, context.row, context.col);
+ if (!result) {
+ return next(cell);
+ }
+ const styleMap = context.workbook.getStyles();
+ const defaultStyle = (typeof cell?.s === 'string' ? styleMap.get(cell?.s) : cell?.s) || {};
+ const s = { ...defaultStyle };
+ const cloneCell = { ...cell, s } as IConditionalFormattingCellData & ISheetFontRenderExtension;
+ if (result.style) {
+ Object.assign(s, result.style);
+ }
+ if (!cloneCell.fontRenderExtension) {
+ cloneCell.fontRenderExtension = {};
+ if (result.isShowValue !== undefined) {
+ cloneCell.fontRenderExtension.isSkip = !result.isShowValue;
+ }
+ }
+ if (result.dataBar) {
+ cloneCell.dataBar = result.dataBar;
+ }
+ if (result.iconSet) {
+ cloneCell.iconSet = result.iconSet;
+ cloneCell.fontRenderExtension.leftOffset = DEFAULT_PADDING + DEFAULT_WIDTH;
}
- }
- if (result.dataBar) {
- cloneCell.dataBar = result.dataBar;
- }
- if (result.iconSet) {
- cloneCell.iconSet = result.iconSet;
- cloneCell.fontRenderExtension.leftOffset = DEFAULT_PADDING + DEFAULT_WIDTH;
- }
- return next(cloneCell);
- },
+ return next(cloneCell);
+ },
}));
}
}