Skip to content

Commit

Permalink
fix(conditional-formatting): support row/col hidden (#1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gggpound committed Mar 30, 2024
1 parent 662b4e0 commit 7ed59d1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Expand Up @@ -30,7 +30,7 @@ interface IAddAverageCfParams {
operator: IAverageHighlightCell['operator'];
}
// { ranges: [{ startRow: 0, endRow: 10, startColumn: 3, endColumn: 3 }, { startRow: 0, endRow: 10, startColumn: 5, endColumn: 5 }], style: { fs: 30 }, operator: 'greaterThan' };
export const DddAverageCfCommand: ICommand<IAddAverageCfParams> = {
export const AddAverageCfCommand: ICommand<IAddAverageCfParams> = {
type: CommandType.COMMAND,
id: 'sheet.command.add-average-conditional-rule',
handler(accessor, params) {
Expand Down
4 changes: 2 additions & 2 deletions packages/sheets-conditional-formatting-ui/src/plugin.ts
Expand Up @@ -17,7 +17,7 @@
import { ICommandService, Plugin, PluginType } from '@univerjs/core';
import { Inject, Injector } from '@wendellhu/redi';
import { SHEET_CONDITIONAL_FORMATTING_PLUGIN, SheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { DddAverageCfCommand } from './commands/commands/add-average-cf.command';
import { AddAverageCfCommand } from './commands/commands/add-average-cf.command';
import { AddColorScaleConditionalRuleCommand } from './commands/commands/add-color-scale-cf.command';
import { AddDataBarConditionalRuleCommand } from './commands/commands/add-data-bar-cf.command';
import { AddDuplicateValuesCfCommand } from './commands/commands/add-duplicate-values-cf.command';
Expand Down Expand Up @@ -46,7 +46,7 @@ import { ConditionalFormattingClearController } from './controllers/cf.clear.con
export class SheetsConditionalFormattingUiPlugin extends Plugin {
static override type = PluginType.Sheet;
static commandList = [
DddAverageCfCommand,
AddAverageCfCommand,
AddColorScaleConditionalRuleCommand,
AddDataBarConditionalRuleCommand,
AddDuplicateValuesCfCommand,
Expand Down
Expand Up @@ -46,6 +46,10 @@ export class DataBar extends SheetExtension {
Range.foreach(spreadsheetSkeleton.rowColumnSegment, (row, col) => {
const cellData = worksheet.getCell(row, col) as IDataBarCellData;
if (cellData && cellData.dataBar) {
if (!worksheet.getColVisible(col) || !worksheet.getRowVisible(row)) {
return;
}

const { color, value, startPoint, isGradient } = cellData.dataBar;
const cellInfo = this.getCellIndex(row, col, rowHeightAccumulation, columnWidthAccumulation, dataMergeCache);
let { isMerged, isMergedMainCell, mergeInfo, startY, endY, startX, endX } = cellInfo;
Expand Down
Expand Up @@ -58,6 +58,10 @@ export class ConditionalFormattingIcon extends SheetExtension {
Range.foreach(spreadsheetSkeleton.rowColumnSegment, (row, col) => {
const cellData = worksheet.getCell(row, col) as IIconSetCellData;
if (cellData?.iconSet) {
if (!worksheet.getColVisible(col) || !worksheet.getRowVisible(row)) {
return;
}

const { iconType, iconId } = cellData.iconSet;
if (iconType === EMPTY_ICON_TYPE) {
return;
Expand Down

0 comments on commit 7ed59d1

Please sign in to comment.