@univerjs/sheets-conditional-formatting 0.13.0 → 0.14.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.
@@ -22,7 +22,6 @@ export { type IMoveCfCommandParams, MoveCfCommand } from './commands/commands/mo
22
22
  export { type ISetCfCommandParams, SetCfCommand } from './commands/commands/set-cf.command';
23
23
  export { AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, type IAddConditionalRuleMutationParams, } from './commands/mutations/add-conditional-rule.mutation';
24
24
  export { DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, type IDeleteConditionalRuleMutationParams, } from './commands/mutations/delete-conditional-rule.mutation';
25
- export { ConditionalFormattingFormulaMarkDirty } from './commands/mutations/formula-mark-dirty.mutation';
26
25
  export { type IMoveConditionalRuleMutationParams, MoveConditionalRuleMutation, MoveConditionalRuleMutationUndoFactory, } from './commands/mutations/move-conditional-rule.mutation';
27
26
  export type { ISetConditionalRuleMutationParams } from './commands/mutations/set-conditional-rule.mutation';
28
27
  export { SetConditionalRuleMutation, setConditionalRuleMutationUndoFactory } from './commands/mutations/set-conditional-rule.mutation';
@@ -1,8 +1,8 @@
1
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 './base-calculate-unit';
4
+ import { FormulaResultStatus } from '@univerjs/engine-formula';
4
5
  import { CFNumberOperator } from '../../base/const';
5
- import { FormulaResultStatus } from '../../services/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
8
  export declare const getCellValue: (cell?: ICellData) => Nullable<CellValue>;
@@ -14,7 +14,7 @@ export declare const getValueByType: (value: IValueConfig, matrix: ObjectMatrix<
14
14
  status: FormulaResultStatus;
15
15
  result?: undefined;
16
16
  } | {
17
- result: Nullable<string | number | boolean | void | null | undefined>;
17
+ result: 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>;
@@ -1,5 +1,5 @@
1
1
  import { IAnchor } from '../utils/anchor';
2
- import { IConditionFormattingRule } from './type';
2
+ import { IConditionFormattingRule, IRuleModel } from './type';
3
3
  type RuleOperatorType = 'delete' | 'set' | 'add' | 'sort';
4
4
  export declare class ConditionalFormattingRuleModel {
5
5
  private _model;
@@ -15,6 +15,7 @@ export declare class ConditionalFormattingRuleModel {
15
15
  getRule(unitId: string, subUnitId: string, cfId?: string): IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig> | null | undefined;
16
16
  getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig>[]> | null;
17
17
  getSubunitRules(unitId: string, subUnitId: string): IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig>[] | null;
18
+ getAll(): IRuleModel;
18
19
  deleteRule(unitId: string, subUnitId: string, cfId: string): void;
19
20
  setRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule, oldCfId: string): void;
20
21
  addRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule): void;
@@ -1,5 +1,5 @@
1
- import { IRange, Nullable, Disposable, ICommandService, ObjectMatrix, RefAlias } from '@univerjs/core';
2
- import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
1
+ import { IRange, Disposable, ObjectMatrix, RefAlias } from '@univerjs/core';
2
+ import { FormulaResultStatus, RegisterOtherFormulaService } from '@univerjs/engine-formula';
3
3
  import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
4
4
  type IFormulaItem = {
5
5
  formulaText: string;
@@ -7,29 +7,23 @@ type IFormulaItem = {
7
7
  id: string;
8
8
  unitId: string;
9
9
  subUnitId: string;
10
- ranges: IRange[];
11
- status: FormulaResultStatus;
12
10
  formulaId: string;
13
- result: ObjectMatrix<string | number | boolean | undefined | null | void>;
14
11
  };
15
- export declare enum FormulaResultStatus {
16
- NOT_REGISTER = 1,
17
- SUCCESS = 2,
18
- WAIT = 3,
19
- ERROR = 4
20
- }
21
12
  export declare class ConditionalFormattingFormulaService extends Disposable {
22
- private _commandService;
23
- private _activeDirtyManagerService;
13
+ private _registerOtherFormulaService;
24
14
  private _conditionalFormattingRuleModel;
25
15
  private _formulaMap;
26
16
  private _result$;
27
17
  result$: import('rxjs').Observable<IFormulaItem & {
28
18
  isAllFinished: boolean;
29
19
  }>;
30
- constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
20
+ constructor(_registerOtherFormulaService: RegisterOtherFormulaService, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
31
21
  private _initRuleChange;
32
- private _initFormulaCalculationResultChange;
22
+ /**
23
+ * Register formulas for a specific rule based on its type
24
+ */
25
+ private _registerRuleFormulas;
26
+ private _initFormulaResultChange;
33
27
  private _ensureSubunitFormulaMap;
34
28
  getSubUnitFormulaMap(unitId: string, subUnitId: string): RefAlias<IFormulaItem, "id" | "formulaId"> | undefined;
35
29
  registerFormulaWithRange(unitId: string, subUnitId: string, cfId: string, formulaText: string, ranges?: IRange[]): void;
@@ -38,7 +32,7 @@ export declare class ConditionalFormattingFormulaService extends Disposable {
38
32
  status: FormulaResultStatus;
39
33
  result?: undefined;
40
34
  } | {
41
- result: Nullable<string | number | boolean | void | null | undefined>;
35
+ result: string | number | boolean | void | null | undefined;
42
36
  status: FormulaResultStatus;
43
37
  };
44
38
  getFormulaMatrix(unitId: string, subUnitId: string, cfId: string, formulaText: string): {
@@ -47,16 +41,13 @@ export declare class ConditionalFormattingFormulaService extends Disposable {
47
41
  } | {
48
42
  result: ObjectMatrix<string | number | boolean | void | null | undefined>;
49
43
  status: FormulaResultStatus;
50
- } | undefined;
44
+ };
45
+ private _getCellValue;
51
46
  /**
52
47
  * If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
53
48
  */
54
49
  deleteCache(unitId: string, subUnitId: string, cfId: string, formulaText?: string): IFormulaItem[];
55
50
  private _getAllFormulaResultByCfId;
56
- /**
57
- * The external environment is not aware of`formulaId`;it communicates internally with the formula engine.
58
- */
59
- private _createFormulaId;
60
51
  /**
61
52
  * A conditional formatting may have multiple formulas;if the formulas are identical,then the results will be consistent.
62
53
  */