@univerjs/sheets-conditional-formatting 0.4.2 → 0.5.0-beta.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.
@@ -1,5 +1,5 @@
1
- import { SheetExtension, SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
2
1
  import { IRange, IScale } from '@univerjs/core';
2
+ import { SpreadsheetSkeleton, UniverRenderingContext, SheetExtension } from '@univerjs/engine-render';
3
3
  export declare const dataBarUKey = "sheet-conditional-rule-data-bar";
4
4
  export declare const defaultDataBarPositiveColor = "#ffbe38";
5
5
  export declare const defaultDataBarNativeColor = "#abd91a";
@@ -1,5 +1,5 @@
1
- import { SheetExtension, SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
2
1
  import { IRange, IScale } from '@univerjs/core';
2
+ import { SpreadsheetSkeleton, UniverRenderingContext, SheetExtension } from '@univerjs/engine-render';
3
3
  export declare const IconUKey = "sheet-conditional-rule-icon";
4
4
  export declare const DEFAULT_WIDTH = 15;
5
5
  export declare const DEFAULT_PADDING = 2;
@@ -1,11 +1,11 @@
1
- import { ICellData, IRange, ColorKit, ObjectMatrix } from '@univerjs/core';
1
+ import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, Nullable, ColorKit, ObjectMatrix } from '@univerjs/core';
2
2
  import { IConditionFormattingRule, IValueConfig } from '../../models/type';
3
3
  import { IContext } from './type';
4
4
  import { CFNumberOperator } from '../../base/const';
5
5
  import { FormulaResultStatus } from '../conditional-formatting-formula.service';
6
6
  export declare function isFloatsEqual(a: number, b: number): boolean;
7
7
  export declare const isNullable: (v: any) => boolean;
8
- export declare const getCellValue: (cell?: ICellData) => import('@univerjs/core').Nullable<import('@univerjs/core').CellValue>;
8
+ export declare const getCellValue: (cell?: ICellData) => Nullable<CellValue>;
9
9
  export declare function toYMD_1900(ord: number, leap1900?: boolean): number[];
10
10
  export declare const serialTimeToTimestamp: (value: number) => number;
11
11
  export declare const getValueByType: (value: IValueConfig, matrix: ObjectMatrix<number>, context: IContext & {
@@ -14,7 +14,7 @@ export declare const getValueByType: (value: IValueConfig, matrix: ObjectMatrix<
14
14
  status: FormulaResultStatus;
15
15
  result?: undefined;
16
16
  } | {
17
- result: string | number | boolean | undefined;
17
+ result: Nullable<string | number | boolean | void | null | undefined>;
18
18
  status: FormulaResultStatus;
19
19
  };
20
20
  export declare const getCacheStyleMatrix: <S = any>(unitId: string, subUnitId: string, rule: IConditionFormattingRule, context: IContext) => ObjectMatrix<S>;
@@ -28,3 +28,4 @@ export declare const getColorScaleFromValue: (colorList: {
28
28
  value: number;
29
29
  }[], value: number) => string | undefined;
30
30
  export declare const filterRange: (ranges: IRange[], maxRow: number, maxCol: number) => IRange[];
31
+ export declare function getMaxInFormulaResult(result: IObjectMatrixPrimitiveType<Nullable<CellValue>>): number;
@@ -1,14 +1,15 @@
1
- import { ObjectMatrix, Disposable, ICommandService, Injector, RefAlias } from '@univerjs/core';
1
+ import { IRange, Nullable, Disposable, ICommandService, Injector, ObjectMatrix, RefAlias } from '@univerjs/core';
2
2
  import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
3
3
  import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
4
4
  import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
5
5
  type IFormulaItem = {
6
6
  formulaText: string;
7
7
  cfId: string;
8
- result?: boolean | number | string;
8
+ id: string;
9
+ ranges: IRange[];
9
10
  status: FormulaResultStatus;
10
- count: number;
11
11
  formulaId: string;
12
+ result: ObjectMatrix<string | number | boolean | undefined | null | void>;
12
13
  };
13
14
  export declare enum FormulaResultStatus {
14
15
  NOT_REGISTER = 1,
@@ -24,16 +25,7 @@ export declare class ConditionalFormattingFormulaService extends Disposable {
24
25
  private _conditionalFormattingRuleModel;
25
26
  private _formulaMap;
26
27
  private _cache;
27
- private _formulaChange$;
28
- formulaChange$: import('rxjs').Observable<{
29
- unitId: string;
30
- subUnitId: string;
31
- cfId: string;
32
- formulaText: string;
33
- formulaId: string;
34
- }>;
35
28
  constructor(_commandService: ICommandService, _injector: Injector, _activeDirtyManagerService: IActiveDirtyManagerService, _conditionalFormattingViewModel: ConditionalFormattingViewModel, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
36
- dispose(): void;
37
29
  private _initCache;
38
30
  private _initRuleChange;
39
31
  private _initFormulaCalculationResultChange;
@@ -41,16 +33,17 @@ export declare class ConditionalFormattingFormulaService extends Disposable {
41
33
  private _ensureCacheMap;
42
34
  private _deleteCache;
43
35
  getCache(unitId: string, subUnitId: string, cfId: string): ObjectMatrix<unknown> | undefined;
44
- getSubUnitFormulaMap(unitId: string, subUnitId: string): RefAlias<IFormulaItem, "formulaId" | "formulaText"> | undefined;
45
- registerFormula(unitId: string, subUnitId: string, cfId: string, formulaText: string): void;
36
+ getSubUnitFormulaMap(unitId: string, subUnitId: string): RefAlias<IFormulaItem, "id" | "formulaId"> | undefined;
37
+ registerFormulaWithRange(unitId: string, subUnitId: string, cfId: string, formulaText: string, ranges?: IRange[]): void;
46
38
  private _removeFormulaByCfId;
47
- getFormulaResult(unitId: string, subUnitId: string, formulaText: string): {
39
+ getFormulaResult(unitId: string, subUnitId: string, cfId: string, formulaText: string, row?: number, col?: number): {
48
40
  status: FormulaResultStatus;
49
41
  result?: undefined;
50
42
  } | {
51
- result: string | number | boolean | undefined;
43
+ result: Nullable<string | number | boolean | void | null | undefined>;
52
44
  status: FormulaResultStatus;
53
45
  };
54
- _createFormulaId(unitId: string, subUnitId: string): string;
46
+ private _createFormulaId;
47
+ createCFormulaId(cfId: string, formulaText: string): string;
55
48
  }
56
49
  export {};