@univerjs/sheets-conditional-formatting 0.5.0 → 0.5.1
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/cjs/index.js +1 -1
- package/lib/es/index.js +1396 -1357
- package/lib/types/base/const.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/index.d.ts +1 -2
- package/lib/types/models/calculate-unit-v2/__test__/calculate.databar.spec.d.ts +16 -0
- package/lib/types/models/calculate-unit-v2/__test__/calculate.highlight.spec.d.ts +16 -0
- package/lib/types/{services → models/calculate-unit-v2}/__test__/test.util.d.ts +3 -3
- package/lib/types/models/calculate-unit-v2/base-calculate-unit.d.ts +53 -0
- package/lib/types/models/calculate-unit-v2/color-scale-calculate-unit.d.ts +11 -0
- package/lib/types/models/calculate-unit-v2/data-bar-calculate-unit.d.ts +17 -0
- package/lib/types/models/calculate-unit-v2/highlight-cell-calculate-unit.d.ts +12 -0
- package/lib/types/models/calculate-unit-v2/icon-set-calculate-unit.d.ts +18 -0
- package/lib/types/{services/calculate-unit → models/calculate-unit-v2}/utils.d.ts +2 -2
- package/lib/types/models/conditional-formatting-rule-model.d.ts +1 -5
- package/lib/types/models/conditional-formatting-view-model.d.ts +51 -23
- package/lib/types/render/data-bar.render.d.ts +1 -0
- package/lib/types/services/conditional-formatting-formula.service.d.ts +27 -11
- package/lib/types/services/conditional-formatting.service.d.ts +3 -30
- package/lib/types/utils/is-ranges-equal.d.ts +16 -2
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
- package/lib/types/services/calculate-unit/color-scale.d.ts +0 -2
- package/lib/types/services/calculate-unit/data-bar.d.ts +0 -2
- package/lib/types/services/calculate-unit/highlight-cell.d.ts +0 -2
- package/lib/types/services/calculate-unit/icon-set.d.ts +0 -2
- package/lib/types/services/calculate-unit/type.d.ts +0 -15
- /package/lib/types/{services/__test__/calculate.databar.spec.d.ts → models/calculate-unit-v2/__test__/base-calculate.spec.d.ts} +0 -0
- /package/lib/types/{services/__test__/cf.service.spec.d.ts → models/calculate-unit-v2/__test__/calculate.color.spec.d.ts} +0 -0
|
@@ -60,6 +60,6 @@ export declare enum CFValueType {
|
|
|
60
60
|
}
|
|
61
61
|
export declare const DEFAULT_BG_COLOR = "#fff";
|
|
62
62
|
export declare const DEFAULT_FONT_COLOR = "#000000";
|
|
63
|
-
export declare const createDefaultRule: () => IConditionFormattingRule
|
|
63
|
+
export declare const createDefaultRule: () => IConditionFormattingRule;
|
|
64
64
|
export declare const createDefaultValue: (subType: CFSubRuleType, operator: CFTextOperator | CFNumberOperator | CFTimePeriodOperator) => "" | 10 | [number, number];
|
|
65
65
|
export declare const createDefaultValueByValueType: (type: CFValueType, defaultValue?: number) => number | "" | "=";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY = "ssheets-conditional-formatting.config";
|
|
17
17
|
export declare const configSymbol: unique symbol;
|
|
18
18
|
export interface IUniverSheetsConditionalFormattingConfig {
|
|
19
19
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -22,10 +22,9 @@ export { UniverSheetsConditionalFormattingPlugin } from './plugin';
|
|
|
22
22
|
export * from './render/data-bar.render';
|
|
23
23
|
export * from './render/icon.render';
|
|
24
24
|
export * from './render/type';
|
|
25
|
-
export * from './services/calculate-unit/type';
|
|
26
|
-
export * from './services/calculate-unit/utils';
|
|
27
25
|
export * from './services/conditional-formatting.service';
|
|
28
26
|
export * from './services/conditional-formatting-formula.service';
|
|
27
|
+
export * from './models/calculate-unit-v2/utils';
|
|
29
28
|
export * from './utils/anchor';
|
|
30
29
|
export * from './utils/create-cf-id';
|
|
31
30
|
export * from './utils/is-ranges-equal';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dependency, ICommandService, Univer } from '@univerjs/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ConditionalFormattingViewModel } from '../../
|
|
2
|
+
import { ConditionalFormattingRuleModel } from '../../../models/conditional-formatting-rule-model';
|
|
3
|
+
import { ConditionalFormattingService } from '../../../services/conditional-formatting.service';
|
|
4
|
+
import { ConditionalFormattingViewModel } from '../../conditional-formatting-view-model';
|
|
5
5
|
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
6
6
|
univer: Univer;
|
|
7
7
|
get: {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IAccessor, ICellData, Nullable, Workbook, Worksheet } from '@univerjs/core';
|
|
2
|
+
import { IConditionFormattingRule } from '../type';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
export declare enum CalculateEmitStatus {
|
|
5
|
+
preComputingStart = "preComputingStart",
|
|
6
|
+
preComputing = "preComputing",
|
|
7
|
+
preComputingEnd = "preComputingEnd",
|
|
8
|
+
preComputingError = "preComputingError"
|
|
9
|
+
}
|
|
10
|
+
export interface IContext {
|
|
11
|
+
unitId: string;
|
|
12
|
+
subUnitId: string;
|
|
13
|
+
workbook: Workbook;
|
|
14
|
+
worksheet: Worksheet;
|
|
15
|
+
accessor: IAccessor;
|
|
16
|
+
rule: IConditionFormattingRule;
|
|
17
|
+
getCellValue: (row: number, col: number) => ICellData;
|
|
18
|
+
limit: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Processing Main Path Calculation Logic
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class BaseCalculateUnit<C = any, S = any> {
|
|
24
|
+
private _context;
|
|
25
|
+
/**
|
|
26
|
+
* 3nd-level cache
|
|
27
|
+
*/
|
|
28
|
+
private _cache;
|
|
29
|
+
protected _preComputingStatus$: BehaviorSubject<CalculateEmitStatus>;
|
|
30
|
+
preComputingStatus$: import('rxjs').Observable<CalculateEmitStatus>;
|
|
31
|
+
/**
|
|
32
|
+
* 2nd-level cache
|
|
33
|
+
*/
|
|
34
|
+
private _preComputingCache;
|
|
35
|
+
private _rule;
|
|
36
|
+
constructor(_context: IContext);
|
|
37
|
+
setCacheLength(length: number): void;
|
|
38
|
+
clearCache(): void;
|
|
39
|
+
resetPreComputingCache(): void;
|
|
40
|
+
updateRule(rule: IConditionFormattingRule): void;
|
|
41
|
+
getCell(row: number, col: number): Nullable<S>;
|
|
42
|
+
abstract preComputing(row: number, col: number, context: IContext): void;
|
|
43
|
+
/**
|
|
44
|
+
* If a null value is returned, it indicates that caching is not required.
|
|
45
|
+
*/
|
|
46
|
+
protected abstract getCellResult(row: number, col: number, preComputingResult: Nullable<C>, context: IContext): Nullable<S>;
|
|
47
|
+
protected setPreComputingCache(v: C): void;
|
|
48
|
+
protected getPreComputingResult(_row: number, _col: number): Nullable<C>;
|
|
49
|
+
private _createKey;
|
|
50
|
+
private _setCache;
|
|
51
|
+
private _getContext;
|
|
52
|
+
private _initClearCacheListener;
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IContext, BaseCalculateUnit } from './base-calculate-unit';
|
|
2
|
+
import { ColorKit } from '@univerjs/core';
|
|
3
|
+
interface IConfigItem {
|
|
4
|
+
value: number;
|
|
5
|
+
color: ColorKit;
|
|
6
|
+
}
|
|
7
|
+
export declare class ColorScaleCalculateUnit extends BaseCalculateUnit<IConfigItem[], string> {
|
|
8
|
+
preComputing(_row: number, _col: number, context: IContext): void;
|
|
9
|
+
protected getCellResult(row: number, col: number, preComputingResult: IConfigItem[], context: IContext): string | null | undefined;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IContext, BaseCalculateUnit } from './base-calculate-unit';
|
|
2
|
+
interface IConfig {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
startPoint: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class DataBarCalculateUnit extends BaseCalculateUnit<IConfig> {
|
|
8
|
+
preComputing(row: number, col: number, context: IContext): void;
|
|
9
|
+
protected getCellResult(row: number, col: number, preComputingResult: IConfig, context: IContext): {
|
|
10
|
+
color: string;
|
|
11
|
+
startPoint: number;
|
|
12
|
+
value: number;
|
|
13
|
+
isGradient: boolean;
|
|
14
|
+
isShowValue: boolean;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IStyleData, Nullable } from '@univerjs/core';
|
|
2
|
+
import { IContext, BaseCalculateUnit } from './base-calculate-unit';
|
|
3
|
+
import { CFSubRuleType } from '../../base/const';
|
|
4
|
+
interface IConfig {
|
|
5
|
+
value: any;
|
|
6
|
+
type: CFSubRuleType;
|
|
7
|
+
}
|
|
8
|
+
export declare class HighlightCellCalculateUnit extends BaseCalculateUnit<Nullable<IConfig>, Nullable<IStyleData>> {
|
|
9
|
+
preComputing(row: number, col: number, context: IContext): void;
|
|
10
|
+
protected getCellResult(row: number, col: number, preComputingResult: Nullable<IConfig>, context: IContext): import('@univerjs/core').IStyleBase;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { CFNumberOperator } from '../../base/const';
|
|
3
|
+
import { IContext, BaseCalculateUnit } from './base-calculate-unit';
|
|
4
|
+
interface IConfigItem {
|
|
5
|
+
operator: CFNumberOperator;
|
|
6
|
+
value: number;
|
|
7
|
+
iconType: string;
|
|
8
|
+
iconId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class IconSetCalculateUnit extends BaseCalculateUnit<IConfigItem[]> {
|
|
11
|
+
preComputing(_row: number, _col: number, context: IContext): void;
|
|
12
|
+
protected getCellResult(row: number, col: number, preComputingResult: Nullable<IConfigItem[]>, context: IContext): {
|
|
13
|
+
iconId: string;
|
|
14
|
+
iconType: string;
|
|
15
|
+
isShowValue: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -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
|
-
import { IContext } from './
|
|
3
|
+
import { IContext } from './base-calculate-unit';
|
|
4
4
|
import { CFNumberOperator } from '../../base/const';
|
|
5
|
-
import { FormulaResultStatus } from '
|
|
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>;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { Injector } from '@univerjs/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
1
|
import { IAnchor } from '../utils/anchor';
|
|
4
2
|
import { IConditionFormattingRule } from './type';
|
|
5
3
|
type RuleOperatorType = 'delete' | 'set' | 'add' | 'sort';
|
|
6
4
|
export declare class ConditionalFormattingRuleModel {
|
|
7
|
-
private _injector;
|
|
8
5
|
private _model;
|
|
9
6
|
private _ruleChange$;
|
|
10
|
-
$ruleChange: Observable<{
|
|
7
|
+
$ruleChange: import('rxjs').Observable<{
|
|
11
8
|
rule: IConditionFormattingRule;
|
|
12
9
|
oldRule?: IConditionFormattingRule;
|
|
13
10
|
unitId: string;
|
|
14
11
|
subUnitId: string;
|
|
15
12
|
type: RuleOperatorType;
|
|
16
13
|
}>;
|
|
17
|
-
constructor(_injector: Injector);
|
|
18
14
|
private _ensureList;
|
|
19
15
|
getRule(unitId: string, subUnitId: string, cfId?: string): IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig> | null | undefined;
|
|
20
16
|
getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import('./type').IConditionalFormattingRuleConfig>[]> | null;
|
|
@@ -1,29 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { ConditionalFormattingFormulaService } from '../services/conditional-formatting-formula.service';
|
|
3
|
+
import { ConditionalFormattingRuleModel } from './conditional-formatting-rule-model';
|
|
4
|
+
export declare const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH: number;
|
|
5
|
+
export declare class ConditionalFormattingViewModel extends Disposable {
|
|
6
|
+
private _injector;
|
|
7
|
+
private _conditionalFormattingRuleModel;
|
|
8
|
+
private _conditionalFormattingFormulaService;
|
|
9
|
+
private _univerInstanceService;
|
|
10
|
+
private _calculateUnitManagers;
|
|
11
|
+
private _rTreeManager;
|
|
12
|
+
/**
|
|
13
|
+
* 1nd-level cache
|
|
14
|
+
*/
|
|
15
|
+
private _cellCache;
|
|
14
16
|
private _markDirty$;
|
|
17
|
+
/**
|
|
18
|
+
* The rendering layer listens to this variable to determine whether a reRender is necessary.
|
|
19
|
+
* @memberof ConditionalFormattingViewModel
|
|
20
|
+
*/
|
|
15
21
|
markDirty$: import('rxjs').Observable<{
|
|
16
|
-
|
|
22
|
+
cfId: string;
|
|
17
23
|
unitId: string;
|
|
18
24
|
subUnitId: string;
|
|
25
|
+
isImmediately?: boolean;
|
|
19
26
|
}>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
constructor(_injector: Injector, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingFormulaService: ConditionalFormattingFormulaService, _univerInstanceService: IUniverInstanceService);
|
|
28
|
+
private _initCFFormulaListener;
|
|
29
|
+
getCellCfs(unitId: string, subUnitId: string, row: number, col: number): {
|
|
30
|
+
cfId: string;
|
|
31
|
+
result: any;
|
|
32
|
+
priority: number;
|
|
33
|
+
}[] | undefined;
|
|
34
|
+
private _getCellCfs;
|
|
35
|
+
/**
|
|
36
|
+
`isNeedResetPreComputingCache` indicates whether it is necessary to remove the 2nd-level cache for each rule individually.
|
|
37
|
+
Generally, when the logic of a rule calculation is modified, the cache for that rule needs to be removed.
|
|
38
|
+
Changes in style/priority do not require the clearing of the 2nd-level cache.
|
|
39
|
+
Rule changes/region changes require the removal of the 2nd-level cache.
|
|
40
|
+
There is also a situation where preComputing is asynchronously calculated.
|
|
41
|
+
After the calculation is finished, it is only for marking as dirty, and the 2nd-level cache need to be cleared.
|
|
42
|
+
* @param {boolean} [isNeedResetPreComputingCache]
|
|
43
|
+
*/
|
|
44
|
+
private _markRuleDirtyAtOnce;
|
|
45
|
+
/**
|
|
46
|
+
* For the same condition format being marked dirty multiple times at the same time,
|
|
47
|
+
* it will cause the style cache to be cleared, thereby causing the screen to flicker.
|
|
48
|
+
* Here,multiple dirties are merged into one..
|
|
49
|
+
*/
|
|
50
|
+
markRuleDirty: (unitId: string, subUnitId: string, cfId: string, isNeedResetPreComputingCache?: boolean) => void;
|
|
51
|
+
private _handleCustomFormulasSeparately;
|
|
52
|
+
private _initRuleListener;
|
|
53
|
+
private _ensureCalculateUnitManager;
|
|
54
|
+
private _createRuleCalculateUnitInstance;
|
|
55
|
+
private _createCacheKey;
|
|
56
|
+
setCacheLength(length?: number): void;
|
|
28
57
|
}
|
|
29
|
-
export {};
|
|
@@ -3,6 +3,7 @@ import { SpreadsheetSkeleton, UniverRenderingContext, SheetExtension } from '@un
|
|
|
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";
|
|
6
|
+
export declare const defaultPlaceholderColor = "#000";
|
|
6
7
|
export declare class DataBar extends SheetExtension {
|
|
7
8
|
private _paddingRightAndLeft;
|
|
8
9
|
private _paddingTopAndBottom;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IRange, Nullable, Disposable, ICommandService,
|
|
1
|
+
import { IRange, Nullable, Disposable, ICommandService, ObjectMatrix, RefAlias } from '@univerjs/core';
|
|
2
2
|
import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
|
|
3
3
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
4
|
-
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
5
4
|
type IFormulaItem = {
|
|
6
5
|
formulaText: string;
|
|
7
6
|
cfId: string;
|
|
8
7
|
id: string;
|
|
8
|
+
unitId: string;
|
|
9
|
+
subUnitId: string;
|
|
9
10
|
ranges: IRange[];
|
|
10
11
|
status: FormulaResultStatus;
|
|
11
12
|
formulaId: string;
|
|
@@ -19,31 +20,46 @@ export declare enum FormulaResultStatus {
|
|
|
19
20
|
}
|
|
20
21
|
export declare class ConditionalFormattingFormulaService extends Disposable {
|
|
21
22
|
private _commandService;
|
|
22
|
-
private _injector;
|
|
23
23
|
private _activeDirtyManagerService;
|
|
24
|
-
private _conditionalFormattingViewModel;
|
|
25
24
|
private _conditionalFormattingRuleModel;
|
|
26
25
|
private _formulaMap;
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
private _result$;
|
|
27
|
+
result$: import('rxjs').Observable<IFormulaItem & {
|
|
28
|
+
isAllFinished: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
|
|
30
31
|
private _initRuleChange;
|
|
31
32
|
private _initFormulaCalculationResultChange;
|
|
32
33
|
private _ensureSubunitFormulaMap;
|
|
33
|
-
private _ensureCacheMap;
|
|
34
|
-
private _deleteCache;
|
|
35
|
-
getCache(unitId: string, subUnitId: string, cfId: string): ObjectMatrix<unknown> | undefined;
|
|
36
34
|
getSubUnitFormulaMap(unitId: string, subUnitId: string): RefAlias<IFormulaItem, "id" | "formulaId"> | undefined;
|
|
37
35
|
registerFormulaWithRange(unitId: string, subUnitId: string, cfId: string, formulaText: string, ranges?: IRange[]): void;
|
|
38
36
|
private _removeFormulaByCfId;
|
|
39
|
-
|
|
37
|
+
getFormulaResultWithCoords(unitId: string, subUnitId: string, cfId: string, formulaText: string, row?: number, col?: number): {
|
|
40
38
|
status: FormulaResultStatus;
|
|
41
39
|
result?: undefined;
|
|
42
40
|
} | {
|
|
43
41
|
result: Nullable<string | number | boolean | void | null | undefined>;
|
|
44
42
|
status: FormulaResultStatus;
|
|
45
43
|
};
|
|
44
|
+
getFormulaMatrix(unitId: string, subUnitId: string, cfId: string, formulaText: string): {
|
|
45
|
+
status: FormulaResultStatus;
|
|
46
|
+
result?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
result: ObjectMatrix<string | number | boolean | void | null | undefined>;
|
|
49
|
+
status: FormulaResultStatus;
|
|
50
|
+
} | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
|
|
53
|
+
*/
|
|
54
|
+
deleteCache(unitId: string, subUnitId: string, cfId: string, formulaText?: string): IFormulaItem[];
|
|
55
|
+
private _getAllFormulaResultByCfId;
|
|
56
|
+
/**
|
|
57
|
+
* The external environment is not aware of`formulaId`;it communicates internally with the formula engine.
|
|
58
|
+
*/
|
|
46
59
|
private _createFormulaId;
|
|
60
|
+
/**
|
|
61
|
+
* A conditional formatting may have multiple formulas;if the formulas are identical,then the results will be consistent.
|
|
62
|
+
*/
|
|
47
63
|
createCFormulaId(cfId: string, formulaText: string): string;
|
|
48
64
|
}
|
|
49
65
|
export {};
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
import { IHighlightCell } from '../models/type';
|
|
2
2
|
import { IDataBarCellData, IIconSetCellData } from '../render/type';
|
|
3
|
-
import { Disposable, ICommandService, Injector,
|
|
3
|
+
import { Disposable, ICommandService, Injector, IResourceManagerService, IUniverInstanceService } from '@univerjs/core';
|
|
4
4
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
5
5
|
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
6
6
|
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
7
|
-
type ComputeStatus = 'computing' | 'end' | 'error';
|
|
8
7
|
export declare class ConditionalFormattingService extends Disposable {
|
|
9
8
|
private _conditionalFormattingRuleModel;
|
|
10
9
|
private _injector;
|
|
11
|
-
private _conditionalFormattingViewModel;
|
|
12
10
|
private _univerInstanceService;
|
|
13
11
|
private _resourceManagerService;
|
|
14
12
|
private _sheetInterceptorService;
|
|
15
13
|
private _commandService;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
private _ruleComputeStatus$;
|
|
19
|
-
ruleComputeStatus$: import('rxjs').Observable<{
|
|
20
|
-
status: ComputeStatus;
|
|
21
|
-
result?: ObjectMatrix<any>;
|
|
22
|
-
unitId: string;
|
|
23
|
-
subUnitId: string;
|
|
24
|
-
cfId: string;
|
|
25
|
-
}>;
|
|
26
|
-
interceptorManager: InterceptorManager<{
|
|
27
|
-
beforeUpdateRuleResult: import('@univerjs/core').IInterceptor<{
|
|
28
|
-
subUnitId: string;
|
|
29
|
-
unitId: string;
|
|
30
|
-
cfId: string;
|
|
31
|
-
}, undefined>;
|
|
32
|
-
}>;
|
|
33
|
-
private _calculationUnitMap;
|
|
34
|
-
constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _injector: Injector, _conditionalFormattingViewModel: ConditionalFormattingViewModel, _univerInstanceService: IUniverInstanceService, _resourceManagerService: IResourceManagerService, _sheetInterceptorService: SheetInterceptorService, _commandService: ICommandService);
|
|
14
|
+
get _conditionalFormattingViewModelV2(): ConditionalFormattingViewModel;
|
|
15
|
+
constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _injector: Injector, _univerInstanceService: IUniverInstanceService, _resourceManagerService: IResourceManagerService, _sheetInterceptorService: SheetInterceptorService, _commandService: ICommandService);
|
|
35
16
|
composeStyle(unitId: string, subUnitId: string, row: number, col: number): ({
|
|
36
17
|
style?: IHighlightCell["style"];
|
|
37
18
|
} & IDataBarCellData & IIconSetCellData & {
|
|
@@ -39,13 +20,5 @@ export declare class ConditionalFormattingService extends Disposable {
|
|
|
39
20
|
}) | null;
|
|
40
21
|
private _initSnapshot;
|
|
41
22
|
private _initSheetChange;
|
|
42
|
-
private _registerCalculationUnit;
|
|
43
|
-
private _getComputedCache;
|
|
44
|
-
private _setComputedCache;
|
|
45
|
-
private _deleteComputeCache;
|
|
46
|
-
private _initCacheManager;
|
|
47
23
|
private _initCellChange;
|
|
48
|
-
private _initRemoteCalculate;
|
|
49
|
-
private _handleCalculateUnit;
|
|
50
24
|
}
|
|
51
|
-
export {};
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { isRangesEqual } from '@univerjs/core';
|