@cool-office/sheets-conditional-formatting 0.0.0-stage → 1.2.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/LICENSE +176 -0
- package/README.md +49 -2
- package/lib/cjs/facade.js +2237 -0
- package/lib/cjs/index.js +3211 -0
- package/lib/cjs/locale/ar-SA.js +10 -0
- package/lib/cjs/locale/ca-ES.js +10 -0
- package/lib/cjs/locale/de-DE.js +10 -0
- package/lib/cjs/locale/en-US.js +25 -0
- package/lib/cjs/locale/es-ES.js +10 -0
- package/lib/cjs/locale/fa-IR.js +10 -0
- package/lib/cjs/locale/fr-FR.js +10 -0
- package/lib/cjs/locale/id-ID.js +10 -0
- package/lib/cjs/locale/it-IT.js +10 -0
- package/lib/cjs/locale/ja-JP.js +10 -0
- package/lib/cjs/locale/ko-KR.js +10 -0
- package/lib/cjs/locale/pl-PL.js +10 -0
- package/lib/cjs/locale/pt-BR.js +10 -0
- package/lib/cjs/locale/ru-RU.js +10 -0
- package/lib/cjs/locale/sk-SK.js +10 -0
- package/lib/cjs/locale/vi-VN.js +10 -0
- package/lib/cjs/locale/zh-CN.js +10 -0
- package/lib/cjs/locale/zh-HK.js +10 -0
- package/lib/cjs/locale/zh-TW.js +10 -0
- package/lib/es/facade.js +2236 -0
- package/lib/es/index.js +3116 -0
- package/lib/es/locale/ar-SA.js +10 -0
- package/lib/es/locale/ca-ES.js +10 -0
- package/lib/es/locale/de-DE.js +10 -0
- package/lib/es/locale/en-US.js +25 -0
- package/lib/es/locale/es-ES.js +10 -0
- package/lib/es/locale/fa-IR.js +10 -0
- package/lib/es/locale/fr-FR.js +10 -0
- package/lib/es/locale/id-ID.js +10 -0
- package/lib/es/locale/it-IT.js +10 -0
- package/lib/es/locale/ja-JP.js +10 -0
- package/lib/es/locale/ko-KR.js +10 -0
- package/lib/es/locale/pl-PL.js +10 -0
- package/lib/es/locale/pt-BR.js +10 -0
- package/lib/es/locale/ru-RU.js +10 -0
- package/lib/es/locale/sk-SK.js +10 -0
- package/lib/es/locale/vi-VN.js +10 -0
- package/lib/es/locale/zh-CN.js +10 -0
- package/lib/es/locale/zh-HK.js +10 -0
- package/lib/es/locale/zh-TW.js +10 -0
- package/lib/facade.js +2236 -0
- package/lib/index.js +3116 -0
- package/lib/locale/ar-SA.js +10 -0
- package/lib/locale/ca-ES.js +10 -0
- package/lib/locale/de-DE.js +10 -0
- package/lib/locale/en-US.js +25 -0
- package/lib/locale/es-ES.js +10 -0
- package/lib/locale/fa-IR.js +10 -0
- package/lib/locale/fr-FR.js +10 -0
- package/lib/locale/id-ID.js +10 -0
- package/lib/locale/it-IT.js +10 -0
- package/lib/locale/ja-JP.js +10 -0
- package/lib/locale/ko-KR.js +10 -0
- package/lib/locale/pl-PL.js +10 -0
- package/lib/locale/pt-BR.js +10 -0
- package/lib/locale/ru-RU.js +10 -0
- package/lib/locale/sk-SK.js +10 -0
- package/lib/locale/vi-VN.js +10 -0
- package/lib/locale/zh-CN.js +10 -0
- package/lib/locale/zh-HK.js +10 -0
- package/lib/locale/zh-TW.js +10 -0
- package/lib/types/assets/icon-map.d.ts +79 -0
- package/lib/types/base/const.d.ts +80 -0
- package/lib/types/commands/commands/add-cf.command.d.ts +24 -0
- package/lib/types/commands/commands/clear-range-cf.command.d.ts +24 -0
- package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +21 -0
- package/lib/types/commands/commands/delete-cf.command.d.ts +22 -0
- package/lib/types/commands/commands/move-cf.command.d.ts +24 -0
- package/lib/types/commands/commands/set-cf.command.d.ts +24 -0
- package/lib/types/commands/mutations/add-conditional-rule.mutation.d.ts +28 -0
- package/lib/types/commands/mutations/delete-conditional-rule.mutation.d.ts +23 -0
- package/lib/types/commands/mutations/formula-mark-dirty.mutation.d.ts +24 -0
- package/lib/types/commands/mutations/move-conditional-rule.mutation.d.ts +28 -0
- package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +28 -0
- package/lib/types/config/config.d.ts +20 -0
- package/lib/types/facade/f-conditional-formatting-builder.d.ts +1709 -0
- package/lib/types/facade/f-enum.d.ts +48 -0
- package/lib/types/facade/f-range.d.ts +99 -0
- package/lib/types/facade/f-worksheet.d.ts +180 -0
- package/lib/types/facade/index.d.ts +21 -0
- package/lib/types/index.d.ts +55 -0
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +26 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/types.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/models/calculate-unit-v2/base-calculate-unit.d.ts +68 -0
- package/lib/types/models/calculate-unit-v2/color-scale-calculate-unit.d.ts +27 -0
- package/lib/types/models/calculate-unit-v2/data-bar-calculate-unit.d.ts +33 -0
- package/lib/types/models/calculate-unit-v2/highlight-cell-calculate-unit.d.ts +28 -0
- package/lib/types/models/calculate-unit-v2/icon-set-calculate-unit.d.ts +34 -0
- package/lib/types/models/calculate-unit-v2/utils.d.ts +46 -0
- package/lib/types/models/conditional-formatting-range-index-model.d.ts +32 -0
- package/lib/types/models/conditional-formatting-rule-model.d.ts +45 -0
- package/lib/types/models/conditional-formatting-view-model.d.ts +78 -0
- package/lib/types/models/icon-map.d.ts +48 -0
- package/lib/types/models/type.d.ts +106 -0
- package/lib/types/plugin.d.ts +29 -0
- package/lib/types/render/data-bar.render.d.ts +35 -0
- package/lib/types/render/icon.render.d.ts +37 -0
- package/lib/types/render/type.d.ts +38 -0
- package/lib/types/services/conditional-formatting-formula.service.d.ts +73 -0
- package/lib/types/services/conditional-formatting-range-transform.service.d.ts +27 -0
- package/lib/types/services/conditional-formatting-style-composer.service.d.ts +35 -0
- package/lib/types/services/conditional-formatting.service.d.ts +41 -0
- package/lib/types/utils/anchor.d.ts +34 -0
- package/lib/types/utils/create-cf-id.d.ts +16 -0
- package/lib/types/utils/range.d.ts +18 -0
- package/lib/types/utils/remove-undefined-attr.d.ts +16 -0
- package/lib/types/utils/type.d.ts +18 -0
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +1 -0
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +90 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange, IStyleBase } from '@cool-office/core';
|
|
17
|
+
import type { CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType } from '../base/const';
|
|
18
|
+
import type { IIconSetType } from './icon-map';
|
|
19
|
+
export interface IBaseCfRule {
|
|
20
|
+
type: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IHighlightCell extends IBaseCfRule {
|
|
23
|
+
style: IStyleBase;
|
|
24
|
+
type: CFRuleType.highlightCell;
|
|
25
|
+
subType: CFSubRuleType;
|
|
26
|
+
}
|
|
27
|
+
export interface IValueConfig {
|
|
28
|
+
type: CFValueType;
|
|
29
|
+
value?: number | string;
|
|
30
|
+
}
|
|
31
|
+
export interface IUniqueValuesHighlightCell extends IHighlightCell {
|
|
32
|
+
subType: CFSubRuleType.uniqueValues;
|
|
33
|
+
}
|
|
34
|
+
export interface IDuplicateValuesHighlightCell extends IHighlightCell {
|
|
35
|
+
subType: CFSubRuleType.duplicateValues;
|
|
36
|
+
}
|
|
37
|
+
export interface IRankHighlightCell extends IHighlightCell {
|
|
38
|
+
subType: CFSubRuleType.rank;
|
|
39
|
+
isBottom: boolean;
|
|
40
|
+
isPercent: boolean;
|
|
41
|
+
value: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ITextHighlightCell extends IHighlightCell {
|
|
44
|
+
subType: CFSubRuleType.text;
|
|
45
|
+
operator: CFTextOperator;
|
|
46
|
+
value?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ITimePeriodHighlightCell extends IHighlightCell {
|
|
49
|
+
subType: CFSubRuleType.timePeriod;
|
|
50
|
+
operator: CFTimePeriodOperator;
|
|
51
|
+
}
|
|
52
|
+
export interface IFormulaHighlightCell extends IHighlightCell {
|
|
53
|
+
subType: CFSubRuleType.formula;
|
|
54
|
+
value: string;
|
|
55
|
+
}
|
|
56
|
+
export type INumberHighlightCell = ({
|
|
57
|
+
subType: CFSubRuleType.number;
|
|
58
|
+
operator: CFNumberOperator.between | CFNumberOperator.notBetween;
|
|
59
|
+
value: [number, number];
|
|
60
|
+
} & IHighlightCell) | ({
|
|
61
|
+
subType: CFSubRuleType.number;
|
|
62
|
+
operator: CFNumberOperator.equal | CFNumberOperator.notEqual | CFNumberOperator.greaterThan | CFNumberOperator.greaterThanOrEqual | CFNumberOperator.lessThanOrEqual | CFNumberOperator.lessThan;
|
|
63
|
+
value?: number;
|
|
64
|
+
} & IHighlightCell);
|
|
65
|
+
export interface IAverageHighlightCell extends IHighlightCell {
|
|
66
|
+
subType: CFSubRuleType.average;
|
|
67
|
+
operator: CFNumberOperator.greaterThan | CFNumberOperator.greaterThanOrEqual | CFNumberOperator.lessThan | CFNumberOperator.lessThanOrEqual | CFNumberOperator.equal | CFNumberOperator.notEqual;
|
|
68
|
+
}
|
|
69
|
+
export interface IDataBar extends IBaseCfRule {
|
|
70
|
+
type: CFRuleType.dataBar;
|
|
71
|
+
isShowValue: boolean;
|
|
72
|
+
config: {
|
|
73
|
+
min: IValueConfig;
|
|
74
|
+
max: IValueConfig;
|
|
75
|
+
isGradient: boolean;
|
|
76
|
+
positiveColor: string;
|
|
77
|
+
nativeColor: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface IColorScale extends IBaseCfRule {
|
|
81
|
+
type: CFRuleType.colorScale;
|
|
82
|
+
config: {
|
|
83
|
+
index: number;
|
|
84
|
+
color: string;
|
|
85
|
+
value: IValueConfig;
|
|
86
|
+
}[];
|
|
87
|
+
}
|
|
88
|
+
export interface IIconSet extends IBaseCfRule {
|
|
89
|
+
type: CFRuleType.iconSet;
|
|
90
|
+
isShowValue: boolean;
|
|
91
|
+
config: {
|
|
92
|
+
operator: CFNumberOperator;
|
|
93
|
+
value: IValueConfig;
|
|
94
|
+
iconType: IIconSetType;
|
|
95
|
+
iconId: string;
|
|
96
|
+
}[];
|
|
97
|
+
}
|
|
98
|
+
export type IConditionalFormattingRuleConfig = IColorScale | IDataBar | IUniqueValuesHighlightCell | IDuplicateValuesHighlightCell | IRankHighlightCell | ITextHighlightCell | ITimePeriodHighlightCell | INumberHighlightCell | IAverageHighlightCell | IFormulaHighlightCell | IIconSet;
|
|
99
|
+
export interface IConditionFormattingRule<C = IConditionalFormattingRuleConfig> {
|
|
100
|
+
ranges: IRange[];
|
|
101
|
+
cfId: string;
|
|
102
|
+
stopIfTrue: boolean;
|
|
103
|
+
rule: C;
|
|
104
|
+
}
|
|
105
|
+
export type IRuleModel = Map<string, Map<string, IConditionFormattingRule[]>>;
|
|
106
|
+
export type IRuleModelJson = Record<string, Record<string, IConditionFormattingRule[]>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IUniverSheetsConditionalFormattingConfig } from './config/config';
|
|
17
|
+
import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@cool-office/core';
|
|
18
|
+
export declare class UniverSheetsConditionalFormattingPlugin extends Plugin {
|
|
19
|
+
private readonly _config;
|
|
20
|
+
readonly _injector: Injector;
|
|
21
|
+
private _commandService;
|
|
22
|
+
private readonly _configService;
|
|
23
|
+
static pluginName: string;
|
|
24
|
+
static packageName: string;
|
|
25
|
+
static version: string;
|
|
26
|
+
static type: UniverInstanceType;
|
|
27
|
+
constructor(_config: Partial<IUniverSheetsConditionalFormattingConfig> | undefined, _injector: Injector, _commandService: ICommandService, _configService: IConfigService);
|
|
28
|
+
onStarting(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange, IScale } from '@cool-office/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@cool-office/engine-render';
|
|
18
|
+
import type { IConditionalFormattingRenderRangeResolver } from './type';
|
|
19
|
+
import { SheetExtension } from '@cool-office/engine-render';
|
|
20
|
+
export declare const dataBarUKey = "sheet-conditional-rule-data-bar";
|
|
21
|
+
export declare const defaultDataBarPositiveColor = "#ffbe38";
|
|
22
|
+
export declare const defaultDataBarNativeColor = "#abd91a";
|
|
23
|
+
export declare const defaultPlaceholderColor = "#000";
|
|
24
|
+
export declare class DataBar extends SheetExtension {
|
|
25
|
+
private _paddingRightAndLeft;
|
|
26
|
+
private _paddingTopAndBottom;
|
|
27
|
+
private _renderRangeResolver;
|
|
28
|
+
uKey: string;
|
|
29
|
+
Z_INDEX: number;
|
|
30
|
+
_radius: number;
|
|
31
|
+
setRenderRangeResolver(resolver: IConditionalFormattingRenderRangeResolver | null): void;
|
|
32
|
+
draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[]): false | undefined;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private _drawRectWithRoundedCorner;
|
|
35
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange, IScale } from '@cool-office/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@cool-office/engine-render';
|
|
18
|
+
import type { IConditionalFormattingRenderRangeResolver } from './type';
|
|
19
|
+
import { SheetExtension } from '@cool-office/engine-render';
|
|
20
|
+
export declare const IconUKey = "sheet-conditional-rule-icon";
|
|
21
|
+
export declare const DEFAULT_WIDTH = 15;
|
|
22
|
+
export declare const DEFAULT_PADDING = 2;
|
|
23
|
+
export declare class ConditionalFormattingIcon extends SheetExtension {
|
|
24
|
+
private _paddingRightAndLeft;
|
|
25
|
+
private _width;
|
|
26
|
+
private _imageMap;
|
|
27
|
+
private _renderRangeResolver;
|
|
28
|
+
uKey: string;
|
|
29
|
+
Z_INDEX: number;
|
|
30
|
+
_radius: number;
|
|
31
|
+
constructor();
|
|
32
|
+
setRenderRangeResolver(resolver: IConditionalFormattingRenderRangeResolver | null): void;
|
|
33
|
+
draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[]): false | undefined;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
private _init;
|
|
36
|
+
private _createKey;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { ICellData, IRange } from '@cool-office/core';
|
|
17
|
+
import type { IIconSetType } from '../models/icon-map';
|
|
18
|
+
export type IConditionalFormattingRenderRangeResolver = (unitId: string, subUnitId: string, ranges: IRange[]) => IRange[] | null;
|
|
19
|
+
export interface IDataBarRenderParams {
|
|
20
|
+
color: string;
|
|
21
|
+
value: number;
|
|
22
|
+
startPoint: number;
|
|
23
|
+
isGradient: boolean;
|
|
24
|
+
isShowValue: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface IDataBarCellData extends ICellData {
|
|
27
|
+
dataBar?: IDataBarRenderParams;
|
|
28
|
+
}
|
|
29
|
+
export interface IIconSetRenderParams {
|
|
30
|
+
iconId: string;
|
|
31
|
+
iconType: IIconSetType;
|
|
32
|
+
isShowValue: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface IIconSetCellData extends ICellData {
|
|
35
|
+
iconSet?: IIconSetRenderParams;
|
|
36
|
+
_originV?: ICellData['v'];
|
|
37
|
+
}
|
|
38
|
+
export type IConditionalFormattingCellData = IDataBarCellData & IIconSetCellData;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange } from '@cool-office/core';
|
|
17
|
+
import { Disposable, IUniverInstanceService, ObjectMatrix, RefAlias } from '@cool-office/core';
|
|
18
|
+
import { FormulaResultStatus, RegisterOtherFormulaService } from '@cool-office/engine-formula';
|
|
19
|
+
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
20
|
+
type IFormulaItem = {
|
|
21
|
+
formulaText: string;
|
|
22
|
+
cfId: string;
|
|
23
|
+
id: string;
|
|
24
|
+
unitId: string;
|
|
25
|
+
subUnitId: string;
|
|
26
|
+
formulaId: string;
|
|
27
|
+
};
|
|
28
|
+
export declare class ConditionalFormattingFormulaService extends Disposable {
|
|
29
|
+
private _registerOtherFormulaService;
|
|
30
|
+
private _conditionalFormattingRuleModel;
|
|
31
|
+
private readonly _univerInstanceService;
|
|
32
|
+
private _formulaMap;
|
|
33
|
+
private _result$;
|
|
34
|
+
result$: import("rxjs").Observable<IFormulaItem & {
|
|
35
|
+
isAllFinished: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
constructor(_registerOtherFormulaService: RegisterOtherFormulaService, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _univerInstanceService: IUniverInstanceService);
|
|
38
|
+
private _initRuleChange;
|
|
39
|
+
/**
|
|
40
|
+
* Register formulas for a specific rule based on its type
|
|
41
|
+
*/
|
|
42
|
+
private _registerRuleFormulas;
|
|
43
|
+
private _initFormulaResultChange;
|
|
44
|
+
private _ensureSubunitFormulaMap;
|
|
45
|
+
getSubUnitFormulaMap(unitId: string, subUnitId: string): RefAlias<IFormulaItem, "id" | "formulaId"> | undefined;
|
|
46
|
+
registerFormulaWithRange(unitId: string, subUnitId: string, cfId: string, formulaText: string, ranges?: IRange[]): void;
|
|
47
|
+
private _removeFormulaByCfId;
|
|
48
|
+
getFormulaResultWithCoords(unitId: string, subUnitId: string, cfId: string, formulaText: string, row?: number, col?: number): {
|
|
49
|
+
status: FormulaResultStatus;
|
|
50
|
+
result?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
result: string | number | boolean | void | null | undefined;
|
|
53
|
+
status: FormulaResultStatus;
|
|
54
|
+
};
|
|
55
|
+
getFormulaMatrix(unitId: string, subUnitId: string, cfId: string, formulaText: string): {
|
|
56
|
+
status: FormulaResultStatus;
|
|
57
|
+
result?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
result: ObjectMatrix<string | number | boolean | void | null | undefined>;
|
|
60
|
+
status: FormulaResultStatus;
|
|
61
|
+
};
|
|
62
|
+
private _getCellValue;
|
|
63
|
+
/**
|
|
64
|
+
* If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
|
|
65
|
+
*/
|
|
66
|
+
deleteCache(unitId: string, subUnitId: string, cfId: string, formulaText?: string): IFormulaItem[];
|
|
67
|
+
private _getAllFormulaResultByCfId;
|
|
68
|
+
/**
|
|
69
|
+
* A conditional formatting may have multiple formulas;if the formulas are identical,then the results will be consistent.
|
|
70
|
+
*/
|
|
71
|
+
createCFormulaId(cfId: string, formulaText: string): string;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange } from '@cool-office/core';
|
|
17
|
+
export interface IRangeAnchor {
|
|
18
|
+
row: number;
|
|
19
|
+
col: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class ConditionalFormattingRangeTransformService {
|
|
22
|
+
subtractRanges(sourceRanges: IRange[], rangesToSubtract: IRange[]): IRange[];
|
|
23
|
+
addRanges(sourceRanges: IRange[], rangesToAdd: IRange[]): IRange[];
|
|
24
|
+
applyRangeDelta(sourceRanges: IRange[], rangesToSubtract: IRange[], rangesToAdd: IRange[]): IRange[];
|
|
25
|
+
copyIntersectingRanges(sourceRanges: IRange[], sourceRange: IRange, targetAnchor: IRangeAnchor): IRange[];
|
|
26
|
+
translateRange(range: IRange, offset: IRangeAnchor): IRange;
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import { Disposable } from '@cool-office/core';
|
|
17
|
+
import type { IHighlightCell } from '../models/type';
|
|
18
|
+
import type { IDataBarCellData, IIconSetCellData } from '../render/type';
|
|
19
|
+
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
20
|
+
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
21
|
+
type IComposedStyle = {
|
|
22
|
+
style?: IHighlightCell['style'];
|
|
23
|
+
} & IDataBarCellData & IIconSetCellData & {
|
|
24
|
+
isShowValue: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare class ConditionalFormattingStyleComposer extends Disposable {
|
|
27
|
+
private _conditionalFormattingRuleModel;
|
|
28
|
+
private _conditionalFormattingViewModel;
|
|
29
|
+
private _cache;
|
|
30
|
+
constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingViewModel: ConditionalFormattingViewModel);
|
|
31
|
+
dispose(): void;
|
|
32
|
+
composeStyle(unitId: string, subUnitId: string, row: number, col: number): IComposedStyle | null;
|
|
33
|
+
private _mergeComposeResult;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import { Disposable, ICommandService, Injector, IResourceManagerService, IUniverInstanceService } from '@cool-office/core';
|
|
17
|
+
import { SheetInterceptorService } from '@cool-office/sheets';
|
|
18
|
+
import { ConditionalFormattingRangeIndexModel } from '../models/conditional-formatting-range-index-model';
|
|
19
|
+
import { ConditionalFormattingRuleModel } from '../models/conditional-formatting-rule-model';
|
|
20
|
+
import { ConditionalFormattingViewModel } from '../models/conditional-formatting-view-model';
|
|
21
|
+
import { ConditionalFormattingStyleComposer } from './conditional-formatting-style-composer.service';
|
|
22
|
+
export declare class ConditionalFormattingService extends Disposable {
|
|
23
|
+
private _conditionalFormattingRuleModel;
|
|
24
|
+
private _conditionalFormattingRangeIndexModel;
|
|
25
|
+
private _conditionalFormattingStyleComposer;
|
|
26
|
+
private _injector;
|
|
27
|
+
private _univerInstanceService;
|
|
28
|
+
private _resourceManagerService;
|
|
29
|
+
private _sheetInterceptorService;
|
|
30
|
+
private _commandService;
|
|
31
|
+
get _conditionalFormattingViewModelV2(): ConditionalFormattingViewModel;
|
|
32
|
+
constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel: ConditionalFormattingRangeIndexModel, _conditionalFormattingStyleComposer: ConditionalFormattingStyleComposer, _injector: Injector, _univerInstanceService: IUniverInstanceService, _resourceManagerService: IResourceManagerService, _sheetInterceptorService: SheetInterceptorService, _commandService: ICommandService);
|
|
33
|
+
composeStyle(unitId: string, subUnitId: string, row: number, col: number): ({
|
|
34
|
+
style?: import("..").IHighlightCell["style"];
|
|
35
|
+
} & import("..").IDataBarCellData & import("..").IIconSetCellData & {
|
|
36
|
+
isShowValue: boolean;
|
|
37
|
+
}) | null;
|
|
38
|
+
private _initSnapshot;
|
|
39
|
+
private _initSheetChange;
|
|
40
|
+
private _initCellChange;
|
|
41
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 interface IAnchor {
|
|
17
|
+
id: string;
|
|
18
|
+
type: 'before' | 'after' | 'self';
|
|
19
|
+
}
|
|
20
|
+
export declare const findIndexByAnchor: <T = unknown[]>(anchor: IAnchor, ruleList: T[], get: (v: T) => string) => number | null;
|
|
21
|
+
/**
|
|
22
|
+
* This function has side effects that modify the ruleList
|
|
23
|
+
* @param {IAnchor} start
|
|
24
|
+
* @param {IAnchor} end
|
|
25
|
+
* @param {ReturnType<ConditionalFormattingRuleModel['getSubunitRules']>} ruleList
|
|
26
|
+
* @return {*}
|
|
27
|
+
*/
|
|
28
|
+
export declare const moveByAnchor: <T = unknown[]>(start: IAnchor, end: IAnchor, ruleList: T[], get: (v: T) => string) => null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Only [after,after] and [after,before] can support symmetric operations
|
|
31
|
+
*/
|
|
32
|
+
export declare const transformSupportSymmetryAnchor: <T = unknown[]>(start: IAnchor, end: IAnchor, ruleList: T[], get: (v: T) => string) => [IAnchor, IAnchor] | null;
|
|
33
|
+
export declare const anchorUndoFactory: (start: IAnchor, end: IAnchor) => [IAnchor, IAnchor] | null;
|
|
34
|
+
export declare const isAnchorEqual: (anchor1: IAnchor, anchor2: IAnchor) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 declare const createCfId: () => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IRange, Nullable, Worksheet } from '@cool-office/core';
|
|
17
|
+
export declare function getRangeInWorksheet(range: IRange, worksheet: Worksheet): Nullable<IRange>;
|
|
18
|
+
export declare function getRangesInWorksheet(ranges: IRange[], worksheet: Worksheet): IRange[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 declare function removeUndefinedAttr<T = unknown>(obj: T): T;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 type MakePropertyOptional<T, K extends keyof T> = {
|
|
17
|
+
[P in keyof T]: P extends K ? T[P] | undefined : T[P];
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@cool-office/core"),require("@cool-office/sheets-conditional-formatting"),require("@cool-office/sheets/facade"),require("@cool-office/core/facade")):typeof define==`function`&&define.amd?define([`exports`,`@cool-office/core`,`@cool-office/sheets-conditional-formatting`,`@cool-office/sheets/facade`,`@cool-office/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.CoolOfficeSheetsConditionalFormattingFacade={},e.CoolOfficeCore,e.CoolOfficeSheetsConditionalFormatting,e.CoolOfficeSheetsFacade,e.CoolOfficeCoreFacade))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class e{get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=n.CFRuleType.highlightCell){switch(e){case n.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new t.ColorKit(``).toRgbString(),value:{type:n.CFValueType.min}},{index:0,color:new t.ColorKit(`green`).toRgbString(),value:{type:n.CFValueType.max}}]};case n.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:n.CFValueType.min},max:{type:n.CFValueType.max},positiveColor:new t.ColorKit(`green`).toRgbString(),nativeColor:new t.ColorKit(``).toRgbString(),isGradient:!1}};case n.CFRuleType.highlightCell:return{type:e,subType:n.CFSubRuleType.text,operator:n.CFTextOperator.containsText,value:`abc`,style:{}};case n.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.min},iconType:n.IIconSetType.empty,iconId:``},{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.percentile,value:.5},iconType:n.IIconSetType.empty,iconId:``},{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.max},iconType:n.IIconSetType.empty,iconId:``}]}}}constructor(e={}){c(this,`_rule`,{}),this._rule=e,this._ensureAttr(this._rule,[`rule`])}_ensureAttr(e,t){return t.reduce((e,t)=>(e[t]||(e[t]={}),e[t]),e),e}build(){var e;this._rule.cfId||(this._rule.cfId=(0,n.createCfId)()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(e=this._rule.rule)!=null&&e.type||(this._rule.rule.type=n.CFRuleType.highlightCell,this._ensureAttr(this._rule,[`rule`,`style`]));let t=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...t,...this._rule.rule}}}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&=(0,n.createCfId)(),new e(r)}getRanges(){return this._rule.ranges||[]}getIconMap(){return n.iconMap}createCfId(){return(0,n.createCfId)()}setRanges(e){return this._rule.ranges=e,this}},u=class e extends l{constructor(e={}){super(e),this._ensureAttr(this._rule,[`rule`,`style`])}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&=(0,n.createCfId)(),new e(r)}setAverage(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.uniqueValues,this}setDuplicateValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.duplicateValues,this}setRank(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell){if(e){this._ensureAttr(this._ruleConfig,[`style`,`bg`]);let n=new t.ColorKit(e);this._ruleConfig.style.bg.rgb=n.toRgbString()}else delete this._ruleConfig.style.bg}return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.bl=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell){if(e){let n=new t.ColorKit(e);this._ensureAttr(this._ruleConfig,[`style`,`cl`]),this._ruleConfig.style.cl.rgb=n.toRgbString()}else delete this._ruleConfig.style.cl}return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.it=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`st`]),this._ruleConfig.style.st.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`ul`]),this._ruleConfig.style.ul.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}whenCellEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.equal,this}whenCellNotEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.notEqual,this}whenDate(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.between,this}whenNumberEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.equal,this}whenNumberGreaterThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.notEqual,this}whenTextContains(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.containsText,this}whenTextDoesNotContain(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.notContainsText,this}whenTextEndsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.endsWith,this}whenTextEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.equal,this}whenTextStartsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.beginsWith,this}},d=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&=(0,n.createCfId)(),new e(r)}setDataBar(e){let t=this._ruleConfig;return t.type=n.CFRuleType.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}},f=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&=(0,n.createCfId)(),new e(r)}setColorScale(e){let t=this._ruleConfig;return t.type=n.CFRuleType.colorScale,t.config=e,this}},p=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&=(0,n.createCfId)(),new e(r)}setIconSet(e){let t=this._ruleConfig;return t.type=n.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}},m=class{constructor(e={}){this._initConfig=e}build(){return new l(this._initConfig).build()}setAverage(e){return new u(this._initConfig).setAverage(e)}setUniqueValues(){return new u(this._initConfig).setUniqueValues()}setDuplicateValues(){return new u(this._initConfig).setDuplicateValues()}setRank(e){return new u(this._initConfig).setRank(e)}getIconMap(){return n.iconMap}setIconSet(e){return new p(this._initConfig).setIconSet(e)}setColorScale(e){return new f(this._initConfig).setColorScale(e)}setDataBar(e){return new d(this._initConfig).setDataBar(e)}setBackground(e){return new u(this._initConfig).setBackground(e)}setBold(e){return new u(this._initConfig).setBold(e)}setFontColor(e){return new u(this._initConfig).setFontColor(e)}setItalic(e){return new u(this._initConfig).setItalic(e)}setStrikethrough(e){return new u(this._initConfig).setStrikethrough(e)}setUnderline(e){return new u(this._initConfig).setUnderline(e)}whenCellEmpty(){return new u(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new u(this._initConfig).whenCellNotEmpty()}whenDate(e){return new u(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new u(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new u(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new u(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new u(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new u(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new u(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new u(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new u(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new u(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new u(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new u(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new u(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new u(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new u(this._initConfig).whenTextStartsWith(e)}},h=class extends r.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,this._range)))}createConditionalFormattingRule(){return new m({ranges:[this._range]})}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(n.ClearRangeCfCommand.id,e),this}};r.FRange.extend(h);var g=class extends r.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}newConditionalFormattingRule(){return new m}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,t){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:t};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(n.ClearWorksheetCfCommand.id,e),this}};r.FWorksheet.extend(g);var _=class extends i.FEnum{get ConditionFormatNumberOperatorEnum(){return n.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return n.CFTimePeriodOperator}get ConditionFormatIconSetTypeEnum(){return n.IIconSetType}get ConditionFormatValueTypeEnum(){return n.CFValueType}};i.FEnum.extend(_),e.FConditionalFormattingBuilder=m});
|