@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,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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -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 { LocaleLeafKeys } from '@cool-office/core';
|
|
17
|
+
import type enUS from './en-US';
|
|
18
|
+
export type LocaleKey = LocaleLeafKeys<typeof enUS>;
|
|
@@ -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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -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 enUS from './en-US';
|
|
17
|
+
declare const locale: typeof enUS;
|
|
18
|
+
export default locale;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { IAccessor, ICellData, Nullable, Workbook, Worksheet } from '@cool-office/core';
|
|
17
|
+
import type { IConditionFormattingRule } from '../type';
|
|
18
|
+
import { BehaviorSubject } from 'rxjs';
|
|
19
|
+
export declare enum CalculateEmitStatus {
|
|
20
|
+
preComputingStart = "preComputingStart",
|
|
21
|
+
preComputing = "preComputing",
|
|
22
|
+
preComputingEnd = "preComputingEnd",
|
|
23
|
+
preComputingError = "preComputingError"
|
|
24
|
+
}
|
|
25
|
+
export interface IContext {
|
|
26
|
+
unitId: string;
|
|
27
|
+
subUnitId: string;
|
|
28
|
+
workbook: Workbook;
|
|
29
|
+
worksheet: Worksheet;
|
|
30
|
+
accessor: IAccessor;
|
|
31
|
+
rule: IConditionFormattingRule;
|
|
32
|
+
getCellValue: (row: number, col: number) => ICellData;
|
|
33
|
+
limit: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Processing Main Path Calculation Logic
|
|
37
|
+
*/
|
|
38
|
+
export declare abstract class BaseCalculateUnit<C = any, S = any> {
|
|
39
|
+
private _context;
|
|
40
|
+
/**
|
|
41
|
+
* 3nd-level cache
|
|
42
|
+
*/
|
|
43
|
+
private _cache;
|
|
44
|
+
protected _preComputingStatus$: BehaviorSubject<CalculateEmitStatus>;
|
|
45
|
+
preComputingStatus$: import("rxjs").Observable<CalculateEmitStatus>;
|
|
46
|
+
/**
|
|
47
|
+
* 2nd-level cache
|
|
48
|
+
*/
|
|
49
|
+
private _preComputingCache;
|
|
50
|
+
private _rule;
|
|
51
|
+
constructor(_context: IContext);
|
|
52
|
+
setCacheLength(length: number): void;
|
|
53
|
+
clearCache(): void;
|
|
54
|
+
resetPreComputingCache(): void;
|
|
55
|
+
updateRule(rule: IConditionFormattingRule): void;
|
|
56
|
+
getCell(row: number, col: number): Nullable<S>;
|
|
57
|
+
abstract preComputing(row: number, col: number, context: IContext): void;
|
|
58
|
+
/**
|
|
59
|
+
* If a null value is returned, it indicates that caching is not required.
|
|
60
|
+
*/
|
|
61
|
+
protected abstract getCellResult(row: number, col: number, preComputingResult: Nullable<C>, context: IContext): Nullable<S>;
|
|
62
|
+
protected setPreComputingCache(v: C): void;
|
|
63
|
+
protected getPreComputingResult(_row: number, _col: number): Nullable<C>;
|
|
64
|
+
private _createKey;
|
|
65
|
+
private _setCache;
|
|
66
|
+
private _getContext;
|
|
67
|
+
private _initClearCacheListener;
|
|
68
|
+
}
|
|
@@ -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 { IContext } from './base-calculate-unit';
|
|
17
|
+
import { ColorKit } from '@cool-office/core';
|
|
18
|
+
import { BaseCalculateUnit } from './base-calculate-unit';
|
|
19
|
+
interface IConfigItem {
|
|
20
|
+
value: number;
|
|
21
|
+
color: ColorKit;
|
|
22
|
+
}
|
|
23
|
+
export declare class ColorScaleCalculateUnit extends BaseCalculateUnit<IConfigItem[], string> {
|
|
24
|
+
preComputing(_row: number, _col: number, context: IContext): void;
|
|
25
|
+
protected getCellResult(row: number, col: number, preComputingResult: IConfigItem[], context: IContext): string | null | undefined;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { IContext } from './base-calculate-unit';
|
|
17
|
+
import { BaseCalculateUnit } from './base-calculate-unit';
|
|
18
|
+
interface IConfig {
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
startPoint: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class DataBarCalculateUnit extends BaseCalculateUnit<IConfig> {
|
|
24
|
+
preComputing(row: number, col: number, context: IContext): void;
|
|
25
|
+
protected getCellResult(row: number, col: number, preComputingResult: IConfig, context: IContext): {
|
|
26
|
+
color: string;
|
|
27
|
+
startPoint: number;
|
|
28
|
+
value: number;
|
|
29
|
+
isGradient: boolean;
|
|
30
|
+
isShowValue: boolean;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { Nullable } from '@cool-office/core';
|
|
17
|
+
import type { IContext } from './base-calculate-unit';
|
|
18
|
+
import { CFSubRuleType } from '../../base/const';
|
|
19
|
+
import { BaseCalculateUnit } from './base-calculate-unit';
|
|
20
|
+
interface IConfig {
|
|
21
|
+
value: any;
|
|
22
|
+
type: CFSubRuleType;
|
|
23
|
+
}
|
|
24
|
+
export declare class HighlightCellCalculateUnit extends BaseCalculateUnit<Nullable<IConfig>, boolean> {
|
|
25
|
+
preComputing(row: number, col: number, context: IContext): void;
|
|
26
|
+
protected getCellResult(row: number, col: number, preComputingResult: Nullable<IConfig>, context: IContext): boolean;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -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
|
+
import type { Nullable } from '@cool-office/core';
|
|
17
|
+
import type { CFNumberOperator } from '../../base/const';
|
|
18
|
+
import type { IContext } from './base-calculate-unit';
|
|
19
|
+
import { BaseCalculateUnit } from './base-calculate-unit';
|
|
20
|
+
interface IConfigItem {
|
|
21
|
+
operator: CFNumberOperator;
|
|
22
|
+
value: number;
|
|
23
|
+
iconType: string;
|
|
24
|
+
iconId: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class IconSetCalculateUnit extends BaseCalculateUnit<IConfigItem[]> {
|
|
27
|
+
preComputing(_row: number, _col: number, context: IContext): void;
|
|
28
|
+
protected getCellResult(row: number, col: number, preComputingResult: Nullable<IConfigItem[]>, context: IContext): {
|
|
29
|
+
iconId: string;
|
|
30
|
+
iconType: string;
|
|
31
|
+
isShowValue: boolean;
|
|
32
|
+
} | null | undefined;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, Nullable } from '@cool-office/core';
|
|
17
|
+
import type { IConditionFormattingRule, IValueConfig } from '../type';
|
|
18
|
+
import type { IContext } from './base-calculate-unit';
|
|
19
|
+
import { ColorKit, DateSystem, ObjectMatrix } from '@cool-office/core';
|
|
20
|
+
import { FormulaResultStatus } from '@cool-office/engine-formula';
|
|
21
|
+
import { CFNumberOperator } from '../../base/const';
|
|
22
|
+
export declare function isFloatsEqual(a: number, b: number): boolean;
|
|
23
|
+
export declare const isNullable: (v: Nullable<CellValue>) => boolean;
|
|
24
|
+
export declare const getCellValue: (cell?: ICellData) => Nullable<CellValue>;
|
|
25
|
+
export declare const serialTimeToTimestamp: (value: number, dateSystem?: DateSystem) => number;
|
|
26
|
+
export declare const getValueByType: (value: IValueConfig, matrix: ObjectMatrix<number>, context: IContext & {
|
|
27
|
+
cfId: string;
|
|
28
|
+
}) => {
|
|
29
|
+
status: FormulaResultStatus;
|
|
30
|
+
result?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
result: string | number | boolean | void | null | undefined;
|
|
33
|
+
status: FormulaResultStatus;
|
|
34
|
+
};
|
|
35
|
+
export declare const getCacheStyleMatrix: <S = any>(unitId: string, subUnitId: string, rule: IConditionFormattingRule, context: IContext) => ObjectMatrix<S>;
|
|
36
|
+
export declare const compareWithNumber: (config: {
|
|
37
|
+
operator: CFNumberOperator;
|
|
38
|
+
value: number | [number, number];
|
|
39
|
+
}, v: number) => boolean | undefined;
|
|
40
|
+
export declare const getOppositeOperator: (operator: CFNumberOperator) => CFNumberOperator;
|
|
41
|
+
export declare const getColorScaleFromValue: (colorList: {
|
|
42
|
+
color: ColorKit;
|
|
43
|
+
value: number;
|
|
44
|
+
}[], value: number) => string | undefined;
|
|
45
|
+
export declare const filterRange: (ranges: IRange[], maxRow: number, maxCol: number) => IRange[];
|
|
46
|
+
export declare function getMaxInFormulaResult(result: IObjectMatrixPrimitiveType<Nullable<CellValue>>): number;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 } from '@cool-office/core';
|
|
18
|
+
import { ConditionalFormattingRuleModel } from './conditional-formatting-rule-model';
|
|
19
|
+
export declare class ConditionalFormattingRangeIndexModel extends Disposable {
|
|
20
|
+
private _conditionalFormattingRuleModel;
|
|
21
|
+
private _rTreeManager;
|
|
22
|
+
constructor(_conditionalFormattingRuleModel: ConditionalFormattingRuleModel);
|
|
23
|
+
getRuleIdsByCell(unitId: string, subUnitId: string, row: number, col: number): Set<string>;
|
|
24
|
+
getRuleIdsByRanges(unitId: string, subUnitId: string, ranges: IRange[]): Set<string>;
|
|
25
|
+
getRulesByRanges(unitId: string, subUnitId: string, ranges: IRange[]): import("./type").IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig>[];
|
|
26
|
+
dispose(): void;
|
|
27
|
+
clear(): void;
|
|
28
|
+
rebuild(): void;
|
|
29
|
+
private _initRuleListener;
|
|
30
|
+
private _insert;
|
|
31
|
+
private _remove;
|
|
32
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { IAnchor } from '../utils/anchor';
|
|
17
|
+
import type { IConditionFormattingRule, IRuleModel } from './type';
|
|
18
|
+
type RuleOperatorType = 'delete' | 'set' | 'add' | 'sort';
|
|
19
|
+
export declare class ConditionalFormattingRuleModel {
|
|
20
|
+
private _model;
|
|
21
|
+
private _ruleChange$;
|
|
22
|
+
$ruleChange: import("rxjs").Observable<{
|
|
23
|
+
rule: IConditionFormattingRule;
|
|
24
|
+
oldRule?: IConditionFormattingRule;
|
|
25
|
+
unitId: string;
|
|
26
|
+
subUnitId: string;
|
|
27
|
+
type: RuleOperatorType;
|
|
28
|
+
}>;
|
|
29
|
+
private _ensureList;
|
|
30
|
+
getRule(unitId: string, subUnitId: string, cfId?: string): IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig> | null | undefined;
|
|
31
|
+
getUnitRules(unitId: string): Map<string, IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig>[]> | null;
|
|
32
|
+
getSubunitRules(unitId: string, subUnitId: string): IConditionFormattingRule<import("./type").IConditionalFormattingRuleConfig>[] | null;
|
|
33
|
+
getAll(): IRuleModel;
|
|
34
|
+
deleteRule(unitId: string, subUnitId: string, cfId: string): void;
|
|
35
|
+
setRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule, oldCfId: string): void;
|
|
36
|
+
addRule(unitId: string, subUnitId: string, rule: IConditionFormattingRule): void;
|
|
37
|
+
/**
|
|
38
|
+
* example [1,2,3,4,5,6],if you move behind 5 to 2, then cfId=5,targetId=2.
|
|
39
|
+
* if targetId does not exist, it defaults to top
|
|
40
|
+
*/
|
|
41
|
+
moveRulePriority(unitId: string, subUnitId: string, start: IAnchor, end: IAnchor): void;
|
|
42
|
+
createCfId(_unitId: string, _subUnitId: string): string;
|
|
43
|
+
deleteUnitId(unitId: string): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
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, Injector, IUniverInstanceService } from '@cool-office/core';
|
|
17
|
+
import { ConditionalFormattingFormulaService } from '../services/conditional-formatting-formula.service';
|
|
18
|
+
import { ConditionalFormattingRangeIndexModel } from './conditional-formatting-range-index-model';
|
|
19
|
+
import { ConditionalFormattingRuleModel } from './conditional-formatting-rule-model';
|
|
20
|
+
export declare const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH: number;
|
|
21
|
+
export declare class ConditionalFormattingViewModel extends Disposable {
|
|
22
|
+
private _injector;
|
|
23
|
+
private _conditionalFormattingRuleModel;
|
|
24
|
+
private _conditionalFormattingRangeIndexModel;
|
|
25
|
+
private _conditionalFormattingFormulaService;
|
|
26
|
+
private _univerInstanceService;
|
|
27
|
+
private _calculateUnitManagers;
|
|
28
|
+
/**
|
|
29
|
+
* 1nd-level cache
|
|
30
|
+
*/
|
|
31
|
+
private _cellCache;
|
|
32
|
+
private _markDirty$;
|
|
33
|
+
private _cacheClear$;
|
|
34
|
+
/**
|
|
35
|
+
* The rendering layer listens to this variable to determine whether a reRender is necessary.
|
|
36
|
+
* @memberof ConditionalFormattingViewModel
|
|
37
|
+
*/
|
|
38
|
+
markDirty$: import("rxjs").Observable<{
|
|
39
|
+
cfId: string;
|
|
40
|
+
unitId: string;
|
|
41
|
+
subUnitId: string;
|
|
42
|
+
isImmediately?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
cacheClear$: import("rxjs").Observable<void>;
|
|
45
|
+
constructor(_injector: Injector, _conditionalFormattingRuleModel: ConditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel: ConditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService: ConditionalFormattingFormulaService, _univerInstanceService: IUniverInstanceService);
|
|
46
|
+
private _initCFFormulaListener;
|
|
47
|
+
getCellCfs(unitId: string, subUnitId: string, row: number, col: number): {
|
|
48
|
+
cfId: string;
|
|
49
|
+
result: any;
|
|
50
|
+
matched: boolean;
|
|
51
|
+
priority: number;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
private _getCellCfs;
|
|
54
|
+
/**
|
|
55
|
+
`isNeedResetPreComputingCache` indicates whether it is necessary to remove the 2nd-level cache for each rule individually.
|
|
56
|
+
Generally, when the logic of a rule calculation is modified, the cache for that rule needs to be removed.
|
|
57
|
+
Changes in style/priority do not require the clearing of the 2nd-level cache.
|
|
58
|
+
Rule changes/region changes require the removal of the 2nd-level cache.
|
|
59
|
+
There is also a situation where preComputing is asynchronously calculated.
|
|
60
|
+
After the calculation is finished, it is only for marking as dirty, and the 2nd-level cache need to be cleared.
|
|
61
|
+
* @param {boolean} [isNeedResetPreComputingCache]
|
|
62
|
+
*/
|
|
63
|
+
private _markRuleDirtyAtOnce;
|
|
64
|
+
/**
|
|
65
|
+
* For the same condition format being marked dirty multiple times at the same time,
|
|
66
|
+
* it will cause the style cache to be cleared, thereby causing the screen to flicker.
|
|
67
|
+
* Here,multiple dirties are merged into one..
|
|
68
|
+
*/
|
|
69
|
+
markRuleDirty: (unitId: string, subUnitId: string, cfId: string, isNeedResetPreComputingCache?: boolean) => void;
|
|
70
|
+
dispose(): void;
|
|
71
|
+
clearCache(): void;
|
|
72
|
+
private _handleCustomFormulasSeparately;
|
|
73
|
+
private _initRuleListener;
|
|
74
|
+
private _ensureCalculateUnitManager;
|
|
75
|
+
private _createRuleCalculateUnitInstance;
|
|
76
|
+
private _createCacheKey;
|
|
77
|
+
setCacheLength(length?: number): void;
|
|
78
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { LocaleKey } from '../locale/types';
|
|
17
|
+
export declare enum IIconSetType {
|
|
18
|
+
threeArrows = "3Arrows",
|
|
19
|
+
threeArrowsGray = "3ArrowsGray",
|
|
20
|
+
fourArrows = "4Arrows",
|
|
21
|
+
fourArrowsGray = "4ArrowsGray",
|
|
22
|
+
fiveArrows = "5Arrows",
|
|
23
|
+
fiveArrowsGray = "5ArrowsGray",
|
|
24
|
+
threeTriangles = "3Triangles",
|
|
25
|
+
threeTrafficLights1 = "3TrafficLights1",
|
|
26
|
+
threeSigns = "3Signs",
|
|
27
|
+
threeTrafficLights2 = "3TrafficLights2",
|
|
28
|
+
fourRedToBlack = "4RedToBlack",
|
|
29
|
+
fourTrafficLights = "4TrafficLights",
|
|
30
|
+
threeSymbols = "3Symbols",
|
|
31
|
+
threeSymbols2 = "3Symbols2",
|
|
32
|
+
threeFlags = "3Flags",
|
|
33
|
+
fourRating = "4Rating",
|
|
34
|
+
fiveRating = "5Rating",
|
|
35
|
+
fiveQuarters = "5Quarters",
|
|
36
|
+
fiveFelling = "_5Felling",
|
|
37
|
+
fiveBoxes = "5Boxes",
|
|
38
|
+
threeStars = "3Stars",
|
|
39
|
+
empty = "EMPTY_ICON_TYPE"
|
|
40
|
+
}
|
|
41
|
+
export declare const iconGroup: {
|
|
42
|
+
title: LocaleKey;
|
|
43
|
+
group: {
|
|
44
|
+
name: IIconSetType;
|
|
45
|
+
list: string[];
|
|
46
|
+
}[];
|
|
47
|
+
}[];
|
|
48
|
+
export declare const iconMap: Record<IIconSetType, string[]>;
|