@univerjs/sheets-conditional-formatting 1.0.0-insiders.20260809-70eefdd → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BooleanNumber, CellValueType, ColorKit, CommandType, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, generateRandomId, getIntersectRange, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
1
+ import { BooleanNumber, CellValueType, ColorKit, CommandType, DateSystem, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, excelSerialToDateTime, generateRandomId, getIntersectRange, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@univerjs/core";
2
2
  import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget } from "@univerjs/sheets";
3
3
  import { BehaviorSubject, Subject } from "rxjs";
4
4
  import { BooleanValue, ERROR_TYPE_SET, FormulaResultStatus, OtherFormulaBizType, RegisterOtherFormulaService, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
@@ -1202,15 +1202,21 @@ var DataBar = class extends SheetExtension {
1202
1202
  super(..._args);
1203
1203
  _defineProperty(this, "_paddingRightAndLeft", 2);
1204
1204
  _defineProperty(this, "_paddingTopAndBottom", 2);
1205
+ _defineProperty(this, "_renderRangeResolver", null);
1205
1206
  _defineProperty(this, "uKey", dataBarUKey);
1206
1207
  _defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
1207
1208
  _defineProperty(this, "_radius", 1);
1208
1209
  }
1210
+ setRenderRangeResolver(resolver) {
1211
+ this._renderRangeResolver = resolver;
1212
+ }
1209
1213
  draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
1210
1214
  const { worksheet } = spreadsheetSkeleton;
1211
1215
  if (!worksheet) return false;
1212
1216
  const mergeCellRendered = /* @__PURE__ */ new Set();
1213
- const renderRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
1217
+ const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
1218
+ const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
1219
+ if (!renderRanges.length) return;
1214
1220
  ctx.save();
1215
1221
  renderRanges.forEach((range) => {
1216
1222
  Range.foreach(range, (row, col) => {
@@ -1265,6 +1271,10 @@ var DataBar = class extends SheetExtension {
1265
1271
  });
1266
1272
  ctx.restore();
1267
1273
  }
1274
+ dispose() {
1275
+ this._renderRangeResolver = null;
1276
+ super.dispose();
1277
+ }
1268
1278
  _drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
1269
1279
  const radius = this._radius;
1270
1280
  if (!height || !width) return;
@@ -1628,7 +1638,7 @@ var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
1628
1638
  case "timePeriod": {
1629
1639
  const value = getCellValue(cellValue);
1630
1640
  if (isNullable(value) || Number.isNaN(Number(value)) || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== CellValueType.NUMBER || !preComputingResult) return;
1631
- const v = serialTimeToTimestamp(Number(value));
1641
+ const v = serialTimeToTimestamp(Number(value), context.workbook.getDateSystem());
1632
1642
  const { start, end } = preComputingResult.value;
1633
1643
  return v >= start && v <= end;
1634
1644
  }
@@ -1799,7 +1809,9 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
1799
1809
  _defineProperty(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
1800
1810
  _defineProperty(this, "_cellCache", new LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
1801
1811
  _defineProperty(this, "_markDirty$", new Subject());
1812
+ _defineProperty(this, "_cacheClear$", new Subject());
1802
1813
  _defineProperty(this, "markDirty$", this._markDirty$.asObservable());
1814
+ _defineProperty(this, "cacheClear$", this._cacheClear$.asObservable());
1803
1815
  _defineProperty(this, "_markRuleDirtyAtOnce", (unitId, subUnitId, cfId, isNeedResetPreComputingCache = true) => {
1804
1816
  this._cellCache.clear();
1805
1817
  if (isNeedResetPreComputingCache) {
@@ -1885,6 +1897,7 @@ let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extend
1885
1897
  clearCache() {
1886
1898
  this._calculateUnitManagers.clear();
1887
1899
  this._cellCache.clear();
1900
+ this._cacheClear$.next();
1888
1901
  }
1889
1902
  _handleCustomFormulasSeparately() {
1890
1903
  this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
@@ -1998,54 +2011,10 @@ const getCellValue = (cell) => {
1998
2011
  const dataStream = (_cell$p = cell.p) === null || _cell$p === void 0 || (_cell$p = _cell$p.body) === null || _cell$p === void 0 ? void 0 : _cell$p.dataStream.replace(/\r\n$/, "");
1999
2012
  return !isNullable(v) ? v : !isNullable(dataStream) ? dataStream : null;
2000
2013
  };
2001
- const DAY_SIZE = 86400;
2002
- function toYMD_1900(ord, leap1900 = true) {
2003
- if (leap1900 && ord >= 0) {
2004
- if (ord === 0) return [
2005
- 1900,
2006
- 1,
2007
- 0
2008
- ];
2009
- if (ord === 60) return [
2010
- 1900,
2011
- 2,
2012
- 29
2013
- ];
2014
- if (ord < 60) return [
2015
- 1900,
2016
- ord < 32 ? 1 : 2,
2017
- (ord - 1) % 31 + 1
2018
- ];
2019
- }
2020
- let l = ord + 68569 + 2415019;
2021
- const n = Math.floor(4 * l / 146097);
2022
- l = l - Math.floor((146097 * n + 3) / 4);
2023
- const i = Math.floor(4e3 * (l + 1) / 1461001);
2024
- l = l - Math.floor(1461 * i / 4) + 31;
2025
- const j = Math.floor(80 * l / 2447);
2026
- const nDay = l - Math.floor(2447 * j / 80);
2027
- l = Math.floor(j / 11);
2028
- const nMonth = j + 2 - 12 * l;
2029
- return [
2030
- 100 * (n - 49) + i + l | 0,
2031
- nMonth | 0,
2032
- nDay | 0
2033
- ];
2034
- }
2035
- const serialTimeToTimestamp = (value) => {
2036
- let date = value | 0;
2037
- const t = DAY_SIZE * (value - date);
2038
- let time = Math.floor(t);
2039
- if (t - time > .9999) {
2040
- time += 1;
2041
- if (time === DAY_SIZE) {
2042
- time = 0;
2043
- date += 1;
2044
- }
2045
- }
2046
- const x = time < 0 ? DAY_SIZE + time : time;
2047
- const [y, m, d] = toYMD_1900(value, true);
2048
- return dateKit(`${y}/${m}/${d} ${Math.floor(x / 60 / 60) % 60}:${Math.floor(x / 60) % 60}:${Math.floor(x) % 60}`).valueOf();
2014
+ const serialTimeToTimestamp = (value, dateSystem = DateSystem.Date1900) => {
2015
+ const utcDate = excelSerialToDateTime(value, dateSystem);
2016
+ if (Number.isNaN(utcDate.getTime())) return NaN;
2017
+ return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate(), utcDate.getUTCHours(), utcDate.getUTCMinutes(), utcDate.getUTCSeconds(), utcDate.getUTCMilliseconds()).getTime();
2049
2018
  };
2050
2019
  const getValueByType = (value, matrix, context) => {
2051
2020
  switch (value.type) {
@@ -2542,7 +2511,7 @@ for (const key in iconMap) {
2542
2511
  //#endregion
2543
2512
  //#region package.json
2544
2513
  var name = "@univerjs/sheets-conditional-formatting";
2545
- var version = "1.0.0-insiders.20260809-70eefdd";
2514
+ var version = "1.0.0-rc.0";
2546
2515
 
2547
2516
  //#endregion
2548
2517
  //#region src/config/config.ts
@@ -2567,14 +2536,28 @@ const defaultPluginConfig = {};
2567
2536
 
2568
2537
  //#endregion
2569
2538
  //#region src/services/conditional-formatting-style-composer.service.ts
2570
- let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleComposer {
2539
+ let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleComposer extends Disposable {
2571
2540
  constructor(_conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
2541
+ super();
2572
2542
  this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
2573
2543
  this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
2544
+ _defineProperty(this, "_cache", new LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
2545
+ this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(() => this._cache.clear()));
2546
+ this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.subscribe(() => this._cache.clear()));
2547
+ this.disposeWithMe(this._conditionalFormattingViewModel.cacheClear$.subscribe(() => this._cache.clear()));
2548
+ }
2549
+ dispose() {
2550
+ this._cache.clear();
2551
+ super.dispose();
2574
2552
  }
2575
2553
  composeStyle(unitId, subUnitId, row, col) {
2554
+ const cacheKey = `${unitId}_${subUnitId}_${row}_${col}`;
2555
+ if (this._cache.has(cacheKey)) return this._cache.get(cacheKey) ?? null;
2576
2556
  const cellCfs = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
2577
- if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) return null;
2557
+ if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) {
2558
+ this._cache.set(cacheKey, null);
2559
+ return null;
2560
+ }
2578
2561
  const matchedRules = [];
2579
2562
  let stopIfTrueIndex = -1;
2580
2563
  for (const cacheItem of cellCfs) {
@@ -2586,13 +2569,17 @@ let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleCompose
2586
2569
  });
2587
2570
  if (stopIfTrueIndex === -1 && rule.stopIfTrue && this._isRuleMatched(rule, cacheItem.result)) stopIfTrueIndex = matchedRules.length - 1;
2588
2571
  }
2589
- if (!matchedRules.length) return null;
2572
+ if (!matchedRules.length) {
2573
+ this._cache.set(cacheKey, null);
2574
+ return null;
2575
+ }
2590
2576
  const effectiveRules = stopIfTrueIndex > -1 ? matchedRules.slice(0, stopIfTrueIndex + 1) : matchedRules;
2591
2577
  const result = {};
2592
2578
  for (let i = effectiveRules.length - 1; i >= 0; i--) {
2593
2579
  const { rule, cacheItem } = effectiveRules[i];
2594
2580
  this._mergeComposeResult(result, rule, cacheItem.result);
2595
2581
  }
2582
+ this._cache.set(cacheKey, result);
2596
2583
  return result;
2597
2584
  }
2598
2585
  _mergeComposeResult(result, rule, ruleResult) {
@@ -2956,16 +2943,22 @@ var ConditionalFormattingIcon = class extends SheetExtension {
2956
2943
  _defineProperty(this, "_paddingRightAndLeft", 2);
2957
2944
  _defineProperty(this, "_width", 15);
2958
2945
  _defineProperty(this, "_imageMap", /* @__PURE__ */ new Map());
2946
+ _defineProperty(this, "_renderRangeResolver", null);
2959
2947
  _defineProperty(this, "uKey", IconUKey);
2960
2948
  _defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX);
2961
2949
  _defineProperty(this, "_radius", 1);
2962
2950
  this._init();
2963
2951
  }
2952
+ setRenderRangeResolver(resolver) {
2953
+ this._renderRangeResolver = resolver;
2954
+ }
2964
2955
  draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
2965
2956
  const { worksheet } = spreadsheetSkeleton;
2966
2957
  if (!worksheet) return false;
2967
2958
  const mergeCellRendered = /* @__PURE__ */ new Set();
2968
- const renderRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
2959
+ const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
2960
+ const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
2961
+ if (!renderRanges.length) return;
2969
2962
  ctx.save();
2970
2963
  renderRanges.forEach((range) => {
2971
2964
  Range.foreach(range, (row, col) => {
@@ -2995,6 +2988,10 @@ var ConditionalFormattingIcon = class extends SheetExtension {
2995
2988
  });
2996
2989
  ctx.restore();
2997
2990
  }
2991
+ dispose() {
2992
+ this._renderRangeResolver = null;
2993
+ super.dispose();
2994
+ }
2998
2995
  _init() {
2999
2996
  for (const type in iconMap) iconMap[type].forEach((base64, index) => {
3000
2997
  const key = this._createKey(type, String(index));
@@ -3039,4 +3036,4 @@ function removeUndefinedAttr(obj) {
3039
3036
  }
3040
3037
 
3041
3038
  //#endregion
3042
- export { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingFormulaService, ConditionalFormattingIcon, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingStyleComposer, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DataBar, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, IconUKey, MoveCfCommand, MoveConditionalRuleMutation, MoveConditionalRuleMutationUndoFactory, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, anchorUndoFactory, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, dataBarUKey, defaultDataBarNativeColor, defaultDataBarPositiveColor, defaultPlaceholderColor, filterRange, findIndexByAnchor, getCacheStyleMatrix, getCellValue, getColorScaleFromValue, getMaxInFormulaResult, getOppositeOperator, getValueByType, iconGroup, iconMap, isAnchorEqual, isFloatsEqual, isNullable, moveByAnchor, removeUndefinedAttr, serialTimeToTimestamp, setConditionalRuleMutationUndoFactory, toYMD_1900, transformSupportSymmetryAnchor };
3039
+ export { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingFormulaService, ConditionalFormattingIcon, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingStyleComposer, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DataBar, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, IconUKey, MoveCfCommand, MoveConditionalRuleMutation, MoveConditionalRuleMutationUndoFactory, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, anchorUndoFactory, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, dataBarUKey, defaultDataBarNativeColor, defaultDataBarPositiveColor, defaultPlaceholderColor, filterRange, findIndexByAnchor, getCacheStyleMatrix, getCellValue, getColorScaleFromValue, getMaxInFormulaResult, getOppositeOperator, getValueByType, iconGroup, iconMap, isAnchorEqual, isFloatsEqual, isNullable, moveByAnchor, removeUndefinedAttr, serialTimeToTimestamp, setConditionalRuleMutationUndoFactory, transformSupportSymmetryAnchor };
@@ -16,14 +16,13 @@
16
16
  import type { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
17
17
  import type { IConditionFormattingRule, IValueConfig } from '../type';
18
18
  import type { IContext } from './base-calculate-unit';
19
- import { ColorKit, ObjectMatrix } from '@univerjs/core';
19
+ import { ColorKit, DateSystem, ObjectMatrix } from '@univerjs/core';
20
20
  import { FormulaResultStatus } from '@univerjs/engine-formula';
21
21
  import { CFNumberOperator } from '../../base/const';
22
22
  export declare function isFloatsEqual(a: number, b: number): boolean;
23
23
  export declare const isNullable: (v: Nullable<CellValue>) => boolean;
24
24
  export declare const getCellValue: (cell?: ICellData) => Nullable<CellValue>;
25
- export declare function toYMD_1900(ord: number, leap1900?: boolean): number[];
26
- export declare const serialTimeToTimestamp: (value: number) => number;
25
+ export declare const serialTimeToTimestamp: (value: number, dateSystem?: DateSystem) => number;
27
26
  export declare const getValueByType: (value: IValueConfig, matrix: ObjectMatrix<number>, context: IContext & {
28
27
  cfId: string;
29
28
  }) => {
@@ -30,6 +30,7 @@ export declare class ConditionalFormattingViewModel extends Disposable {
30
30
  */
31
31
  private _cellCache;
32
32
  private _markDirty$;
33
+ private _cacheClear$;
33
34
  /**
34
35
  * The rendering layer listens to this variable to determine whether a reRender is necessary.
35
36
  * @memberof ConditionalFormattingViewModel
@@ -40,6 +41,7 @@ export declare class ConditionalFormattingViewModel extends Disposable {
40
41
  subUnitId: string;
41
42
  isImmediately?: boolean;
42
43
  }>;
44
+ cacheClear$: import("rxjs").Observable<void>;
43
45
  constructor(_injector: Injector, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel: ConditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService: ConditionalFormattingFormulaService, _univerInstanceService: IUniverInstanceService);
44
46
  private _initCFFormulaListener;
45
47
  getCellCfs(unitId: string, subUnitId: string, row: number, col: number): {
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { IRange, IScale } from '@univerjs/core';
17
17
  import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
18
+ import type { IConditionalFormattingRenderRangeResolver } from './type';
18
19
  import { SheetExtension } from '@univerjs/engine-render';
19
20
  export declare const dataBarUKey = "sheet-conditional-rule-data-bar";
20
21
  export declare const defaultDataBarPositiveColor = "#ffbe38";
@@ -23,9 +24,12 @@ export declare const defaultPlaceholderColor = "#000";
23
24
  export declare class DataBar extends SheetExtension {
24
25
  private _paddingRightAndLeft;
25
26
  private _paddingTopAndBottom;
27
+ private _renderRangeResolver;
26
28
  uKey: string;
27
29
  Z_INDEX: number;
28
30
  _radius: number;
31
+ setRenderRangeResolver(resolver: IConditionalFormattingRenderRangeResolver | null): void;
29
32
  draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[]): false | undefined;
33
+ dispose(): void;
30
34
  private _drawRectWithRoundedCorner;
31
35
  }
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { IRange, IScale } from '@univerjs/core';
17
17
  import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
18
+ import type { IConditionalFormattingRenderRangeResolver } from './type';
18
19
  import { SheetExtension } from '@univerjs/engine-render';
19
20
  export declare const IconUKey = "sheet-conditional-rule-icon";
20
21
  export declare const DEFAULT_WIDTH = 15;
@@ -23,11 +24,14 @@ export declare class ConditionalFormattingIcon extends SheetExtension {
23
24
  private _paddingRightAndLeft;
24
25
  private _width;
25
26
  private _imageMap;
27
+ private _renderRangeResolver;
26
28
  uKey: string;
27
29
  Z_INDEX: number;
28
30
  _radius: number;
29
31
  constructor();
32
+ setRenderRangeResolver(resolver: IConditionalFormattingRenderRangeResolver | null): void;
30
33
  draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[]): false | undefined;
34
+ dispose(): void;
31
35
  private _init;
32
36
  private _createKey;
33
37
  }
@@ -13,8 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ICellData } from '@univerjs/core';
16
+ import type { ICellData, IRange } from '@univerjs/core';
17
17
  import type { IIconSetType } from '../models/icon-map';
18
+ export type IConditionalFormattingRenderRangeResolver = (unitId: string, subUnitId: string, ranges: IRange[]) => IRange[] | null;
18
19
  export interface IDataBarRenderParams {
19
20
  color: string;
20
21
  value: number;
@@ -15,17 +15,22 @@
15
15
  */
16
16
  import type { IHighlightCell } from '../models/type';
17
17
  import type { IDataBarCellData, IIconSetCellData } from '../render/type';
18
+ import { Disposable } from '@univerjs/core';
18
19
  import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
19
20
  import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
20
- export declare class ConditionalFormattingStyleComposer {
21
+ type IComposedStyle = {
22
+ style?: IHighlightCell['style'];
23
+ } & IDataBarCellData & IIconSetCellData & {
24
+ isShowValue: boolean;
25
+ };
26
+ export declare class ConditionalFormattingStyleComposer extends Disposable {
21
27
  private _conditionalFormattingRuleModel;
22
28
  private _conditionalFormattingViewModel;
29
+ private _cache;
23
30
  constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingViewModel: ConditionalFormattingViewModel);
24
- composeStyle(unitId: string, subUnitId: string, row: number, col: number): ({
25
- style?: IHighlightCell["style"];
26
- } & IDataBarCellData & IIconSetCellData & {
27
- isShowValue: boolean;
28
- }) | null;
31
+ dispose(): void;
32
+ composeStyle(unitId: string, subUnitId: string, row: number, col: number): IComposedStyle | null;
29
33
  private _mergeComposeResult;
30
34
  private _isRuleMatched;
31
35
  }
36
+ export {};