@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
package/lib/es/index.js
ADDED
|
@@ -0,0 +1,3116 @@
|
|
|
1
|
+
import { BooleanNumber, CellValueType, ColorKit, CommandType, DateSystem, DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LRUMap, ObjectMatrix, Plugin, RTree, Range, Rectangle, RefAlias, Tools, UniverInstanceType, dateKit, excelSerialToDateTime, generateRandomId, getIntersectRange, isInternalEditorID, merge, sequenceExecute, touchDependencies } from "@cool-office/core";
|
|
2
|
+
import { CopySheetCommand, InsertColMutation, InsertRowMutation, MoveColsMutation, MoveRangeMutation, MoveRowsMutation, RemoveColMutation, RemoveRowMutation, RemoveSheetCommand, ReorderRangeMutation, SetRangeValuesMutation, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, getSheetCommandTarget } from "@cool-office/sheets";
|
|
3
|
+
import { BehaviorSubject, Subject } from "rxjs";
|
|
4
|
+
import { BooleanValue, ERROR_TYPE_SET, FormulaResultStatus, OtherFormulaBizType, RegisterOtherFormulaService, UniverFormulaEnginePlugin } from "@cool-office/engine-formula";
|
|
5
|
+
import { bufferTime, distinctUntilChanged, filter, map } from "rxjs/operators";
|
|
6
|
+
import { FIX_ONE_PIXEL_BLUR_OFFSET, SheetExtension, SpreadsheetExtensionRegistry, isObject } from "@cool-office/engine-render";
|
|
7
|
+
|
|
8
|
+
//#region src/base/const.ts
|
|
9
|
+
const SHEET_CONDITIONAL_FORMATTING_PLUGIN = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
10
|
+
let CFTextOperator = /* @__PURE__ */ function(CFTextOperator) {
|
|
11
|
+
CFTextOperator["beginsWith"] = "beginsWith";
|
|
12
|
+
CFTextOperator["endsWith"] = "endsWith";
|
|
13
|
+
CFTextOperator["containsText"] = "containsText";
|
|
14
|
+
CFTextOperator["notContainsText"] = "notContainsText";
|
|
15
|
+
CFTextOperator["equal"] = "equal";
|
|
16
|
+
CFTextOperator["notEqual"] = "notEqual";
|
|
17
|
+
CFTextOperator["containsBlanks"] = "containsBlanks";
|
|
18
|
+
CFTextOperator["notContainsBlanks"] = "notContainsBlanks";
|
|
19
|
+
CFTextOperator["containsErrors"] = "containsErrors";
|
|
20
|
+
CFTextOperator["notContainsErrors"] = "notContainsErrors";
|
|
21
|
+
return CFTextOperator;
|
|
22
|
+
}({});
|
|
23
|
+
let CFTimePeriodOperator = /* @__PURE__ */ function(CFTimePeriodOperator) {
|
|
24
|
+
CFTimePeriodOperator["today"] = "today";
|
|
25
|
+
CFTimePeriodOperator["yesterday"] = "yesterday";
|
|
26
|
+
CFTimePeriodOperator["tomorrow"] = "tomorrow";
|
|
27
|
+
CFTimePeriodOperator["last7Days"] = "last7Days";
|
|
28
|
+
CFTimePeriodOperator["thisMonth"] = "thisMonth";
|
|
29
|
+
CFTimePeriodOperator["lastMonth"] = "lastMonth";
|
|
30
|
+
CFTimePeriodOperator["nextMonth"] = "nextMonth";
|
|
31
|
+
CFTimePeriodOperator["thisWeek"] = "thisWeek";
|
|
32
|
+
CFTimePeriodOperator["lastWeek"] = "lastWeek";
|
|
33
|
+
CFTimePeriodOperator["nextWeek"] = "nextWeek";
|
|
34
|
+
return CFTimePeriodOperator;
|
|
35
|
+
}({});
|
|
36
|
+
let CFNumberOperator = /* @__PURE__ */ function(CFNumberOperator) {
|
|
37
|
+
CFNumberOperator["greaterThan"] = "greaterThan";
|
|
38
|
+
CFNumberOperator["greaterThanOrEqual"] = "greaterThanOrEqual";
|
|
39
|
+
CFNumberOperator["lessThan"] = "lessThan";
|
|
40
|
+
CFNumberOperator["lessThanOrEqual"] = "lessThanOrEqual";
|
|
41
|
+
CFNumberOperator["notBetween"] = "notBetween";
|
|
42
|
+
CFNumberOperator["between"] = "between";
|
|
43
|
+
CFNumberOperator["equal"] = "equal";
|
|
44
|
+
CFNumberOperator["notEqual"] = "notEqual";
|
|
45
|
+
return CFNumberOperator;
|
|
46
|
+
}({});
|
|
47
|
+
let CFRuleType = /* @__PURE__ */ function(CFRuleType) {
|
|
48
|
+
CFRuleType["highlightCell"] = "highlightCell";
|
|
49
|
+
CFRuleType["dataBar"] = "dataBar";
|
|
50
|
+
CFRuleType["colorScale"] = "colorScale";
|
|
51
|
+
CFRuleType["iconSet"] = "iconSet";
|
|
52
|
+
return CFRuleType;
|
|
53
|
+
}({});
|
|
54
|
+
let CFSubRuleType = /* @__PURE__ */ function(CFSubRuleType) {
|
|
55
|
+
CFSubRuleType["uniqueValues"] = "uniqueValues";
|
|
56
|
+
CFSubRuleType["duplicateValues"] = "duplicateValues";
|
|
57
|
+
CFSubRuleType["rank"] = "rank";
|
|
58
|
+
CFSubRuleType["text"] = "text";
|
|
59
|
+
CFSubRuleType["timePeriod"] = "timePeriod";
|
|
60
|
+
CFSubRuleType["number"] = "number";
|
|
61
|
+
CFSubRuleType["average"] = "average";
|
|
62
|
+
CFSubRuleType["formula"] = "formula";
|
|
63
|
+
return CFSubRuleType;
|
|
64
|
+
}({});
|
|
65
|
+
let CFValueType = /* @__PURE__ */ function(CFValueType) {
|
|
66
|
+
CFValueType["num"] = "num";
|
|
67
|
+
CFValueType["min"] = "min";
|
|
68
|
+
CFValueType["max"] = "max";
|
|
69
|
+
CFValueType["percent"] = "percent";
|
|
70
|
+
CFValueType["percentile"] = "percentile";
|
|
71
|
+
CFValueType["formula"] = "formula";
|
|
72
|
+
return CFValueType;
|
|
73
|
+
}({});
|
|
74
|
+
const DEFAULT_BG_COLOR = "#fff";
|
|
75
|
+
const DEFAULT_FONT_COLOR = "#000000";
|
|
76
|
+
const createDefaultRule = () => ({
|
|
77
|
+
cfId: void 0,
|
|
78
|
+
ranges: [],
|
|
79
|
+
stopIfTrue: false,
|
|
80
|
+
rule: {
|
|
81
|
+
type: "highlightCell",
|
|
82
|
+
subType: "text",
|
|
83
|
+
operator: "containsText"
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const createDefaultValue = (subType, operator) => {
|
|
87
|
+
switch (subType) {
|
|
88
|
+
case "text":
|
|
89
|
+
if ([
|
|
90
|
+
"beginsWith",
|
|
91
|
+
"containsText",
|
|
92
|
+
"endsWith",
|
|
93
|
+
"equal",
|
|
94
|
+
"notContainsText",
|
|
95
|
+
"notEqual"
|
|
96
|
+
].includes(operator)) return "";
|
|
97
|
+
break;
|
|
98
|
+
case "number":
|
|
99
|
+
if (["between", "notBetween"].includes(operator)) return [10, 100];
|
|
100
|
+
return 10;
|
|
101
|
+
}
|
|
102
|
+
return "";
|
|
103
|
+
};
|
|
104
|
+
const createDefaultValueByValueType = (type, defaultValue) => {
|
|
105
|
+
switch (type) {
|
|
106
|
+
case "formula": return "=";
|
|
107
|
+
case "max":
|
|
108
|
+
case "min": return "";
|
|
109
|
+
case "percent":
|
|
110
|
+
case "percentile":
|
|
111
|
+
case "num": return defaultValue !== void 0 ? defaultValue : 10;
|
|
112
|
+
}
|
|
113
|
+
return "";
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/utils/anchor.ts
|
|
118
|
+
const findIndexByAnchor = (anchor, ruleList, get) => {
|
|
119
|
+
if (!ruleList) return null;
|
|
120
|
+
const anchorIndex = ruleList.findIndex((rule) => get(rule) === anchor.id);
|
|
121
|
+
if (anchorIndex < 0) return null;
|
|
122
|
+
switch (anchor.type) {
|
|
123
|
+
case "after": return anchorIndex + 1;
|
|
124
|
+
case "before": return anchorIndex - 1;
|
|
125
|
+
case "self": return anchorIndex;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* This function has side effects that modify the ruleList
|
|
130
|
+
* @param {IAnchor} start
|
|
131
|
+
* @param {IAnchor} end
|
|
132
|
+
* @param {ReturnType<ConditionalFormattingRuleModel['getSubunitRules']>} ruleList
|
|
133
|
+
* @return {*}
|
|
134
|
+
*/
|
|
135
|
+
const moveByAnchor = (start, end, ruleList, get) => {
|
|
136
|
+
if (!ruleList) return null;
|
|
137
|
+
const startIndex = findIndexByAnchor(start, ruleList, get);
|
|
138
|
+
let endIndex = findIndexByAnchor(end, ruleList, get);
|
|
139
|
+
if (startIndex === null || endIndex === null || startIndex === endIndex) return;
|
|
140
|
+
const rule = ruleList.splice(startIndex, 1)[0];
|
|
141
|
+
if (startIndex < endIndex) endIndex = findIndexByAnchor(end, ruleList, get);
|
|
142
|
+
switch (end.type) {
|
|
143
|
+
case "before":
|
|
144
|
+
ruleList.splice(endIndex + 1, 0, rule);
|
|
145
|
+
break;
|
|
146
|
+
case "self":
|
|
147
|
+
case "after": ruleList.splice(endIndex, 0, rule);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Only [after,after] and [after,before] can support symmetric operations
|
|
152
|
+
*/
|
|
153
|
+
const transformSupportSymmetryAnchor = (start, end, ruleList, get) => {
|
|
154
|
+
if (start.type === "after" && ["after", "before"].includes(end.type)) return [start, end];
|
|
155
|
+
const _start = { ...start };
|
|
156
|
+
const _end = { ...end };
|
|
157
|
+
if (_start.type !== "after") {
|
|
158
|
+
const index = findIndexByAnchor(_start, ruleList, get);
|
|
159
|
+
if (index === null) return null;
|
|
160
|
+
if (index - 1 < 0) {
|
|
161
|
+
const nextItem = ruleList[index + 1];
|
|
162
|
+
if (!nextItem) return null;
|
|
163
|
+
else {
|
|
164
|
+
_start.id = get(nextItem);
|
|
165
|
+
_start.type = "before";
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
_start.id = get(ruleList[index - 1]);
|
|
169
|
+
_start.type = "after";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (!["after", "before"].includes(_end.type)) {
|
|
173
|
+
const index = findIndexByAnchor(_end, ruleList, get);
|
|
174
|
+
if (index === null) return null;
|
|
175
|
+
if (index === 0) _end.type = "before";
|
|
176
|
+
else if (index - 1 >= 0) {
|
|
177
|
+
_end.id = get(ruleList[index - 1]);
|
|
178
|
+
_end.type = "after";
|
|
179
|
+
} else if (index + 1 <= ruleList.length - 1) {
|
|
180
|
+
_end.id = get(ruleList[index + 1]);
|
|
181
|
+
_end.type = "before";
|
|
182
|
+
} else return null;
|
|
183
|
+
}
|
|
184
|
+
if (_start.id === _end.id && _start.type === _end.type) return null;
|
|
185
|
+
return [_start, _end];
|
|
186
|
+
};
|
|
187
|
+
const anchorUndoFactory = (start, end) => {
|
|
188
|
+
if (["after", "before"].includes(end.type)) {
|
|
189
|
+
if (start.type === "after") return [end, start];
|
|
190
|
+
else if (start.type === "before") return [end, {
|
|
191
|
+
...start,
|
|
192
|
+
type: "self"
|
|
193
|
+
}];
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
197
|
+
const isAnchorEqual = (anchor1, anchor2) => {
|
|
198
|
+
return anchor1.id === anchor2.id && anchor1.type === anchor2.type;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/utils/create-cf-id.ts
|
|
203
|
+
/**
|
|
204
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
205
|
+
*
|
|
206
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
+
* you may not use this file except in compliance with the License.
|
|
208
|
+
* You may obtain a copy of the License at
|
|
209
|
+
*
|
|
210
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
+
*
|
|
212
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
213
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
+
* See the License for the specific language governing permissions and
|
|
216
|
+
* limitations under the License.
|
|
217
|
+
*/
|
|
218
|
+
const createCfId = () => `${generateRandomId(8)}`;
|
|
219
|
+
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
222
|
+
function _typeof(o) {
|
|
223
|
+
"@babel/helpers - typeof";
|
|
224
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
225
|
+
return typeof o;
|
|
226
|
+
} : function(o) {
|
|
227
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
228
|
+
}, _typeof(o);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
233
|
+
function toPrimitive(t, r) {
|
|
234
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
235
|
+
var e = t[Symbol.toPrimitive];
|
|
236
|
+
if (void 0 !== e) {
|
|
237
|
+
var i = e.call(t, r || "default");
|
|
238
|
+
if ("object" != _typeof(i)) return i;
|
|
239
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
240
|
+
}
|
|
241
|
+
return ("string" === r ? String : Number)(t);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
246
|
+
function toPropertyKey(t) {
|
|
247
|
+
var i = toPrimitive(t, "string");
|
|
248
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
253
|
+
function _defineProperty(e, r, t) {
|
|
254
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
255
|
+
value: t,
|
|
256
|
+
enumerable: !0,
|
|
257
|
+
configurable: !0,
|
|
258
|
+
writable: !0
|
|
259
|
+
}) : e[r] = t, e;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/models/conditional-formatting-rule-model.ts
|
|
264
|
+
var ConditionalFormattingRuleModel = class {
|
|
265
|
+
constructor() {
|
|
266
|
+
_defineProperty(this, "_model", /* @__PURE__ */ new Map());
|
|
267
|
+
_defineProperty(this, "_ruleChange$", new Subject());
|
|
268
|
+
_defineProperty(this, "$ruleChange", this._ruleChange$.asObservable());
|
|
269
|
+
}
|
|
270
|
+
_ensureList(unitId, subUnitId) {
|
|
271
|
+
let list = this.getSubunitRules(unitId, subUnitId);
|
|
272
|
+
if (!list) {
|
|
273
|
+
list = [];
|
|
274
|
+
let unitMap = this._model.get(unitId);
|
|
275
|
+
if (!unitMap) {
|
|
276
|
+
unitMap = /* @__PURE__ */ new Map();
|
|
277
|
+
this._model.set(unitId, unitMap);
|
|
278
|
+
}
|
|
279
|
+
unitMap.set(subUnitId, list);
|
|
280
|
+
}
|
|
281
|
+
return list;
|
|
282
|
+
}
|
|
283
|
+
getRule(unitId, subUnitId, cfId) {
|
|
284
|
+
const list = this.getSubunitRules(unitId, subUnitId);
|
|
285
|
+
if (list) return list.find((item) => item.cfId === cfId);
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
getUnitRules(unitId) {
|
|
289
|
+
return this._model.get(unitId) || null;
|
|
290
|
+
}
|
|
291
|
+
getSubunitRules(unitId, subUnitId) {
|
|
292
|
+
var _this$_model$get;
|
|
293
|
+
return ((_this$_model$get = this._model.get(unitId)) === null || _this$_model$get === void 0 ? void 0 : _this$_model$get.get(subUnitId)) || null;
|
|
294
|
+
}
|
|
295
|
+
getAll() {
|
|
296
|
+
return this._model;
|
|
297
|
+
}
|
|
298
|
+
deleteRule(unitId, subUnitId, cfId) {
|
|
299
|
+
const list = this.getSubunitRules(unitId, subUnitId);
|
|
300
|
+
if (list) {
|
|
301
|
+
const index = list.findIndex((e) => e.cfId === cfId);
|
|
302
|
+
const rule = list[index];
|
|
303
|
+
if (rule) {
|
|
304
|
+
list.splice(index, 1);
|
|
305
|
+
this._ruleChange$.next({
|
|
306
|
+
rule,
|
|
307
|
+
subUnitId,
|
|
308
|
+
unitId,
|
|
309
|
+
type: "delete"
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
setRule(unitId, subUnitId, rule, oldCfId) {
|
|
315
|
+
const oldRule = this._ensureList(unitId, subUnitId).find((item) => item.cfId === oldCfId);
|
|
316
|
+
if (oldRule) {
|
|
317
|
+
const cloneRule = Tools.deepClone(oldRule);
|
|
318
|
+
Object.assign(oldRule, rule);
|
|
319
|
+
this._ruleChange$.next({
|
|
320
|
+
rule: oldRule,
|
|
321
|
+
subUnitId,
|
|
322
|
+
unitId,
|
|
323
|
+
type: "set",
|
|
324
|
+
oldRule: cloneRule
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
addRule(unitId, subUnitId, rule) {
|
|
329
|
+
const list = this._ensureList(unitId, subUnitId);
|
|
330
|
+
if (!list.find((item) => item.cfId === rule.cfId)) list.unshift(rule);
|
|
331
|
+
this._ruleChange$.next({
|
|
332
|
+
rule,
|
|
333
|
+
subUnitId,
|
|
334
|
+
unitId,
|
|
335
|
+
type: "add"
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* example [1,2,3,4,5,6],if you move behind 5 to 2, then cfId=5,targetId=2.
|
|
340
|
+
* if targetId does not exist, it defaults to top
|
|
341
|
+
*/
|
|
342
|
+
moveRulePriority(unitId, subUnitId, start, end) {
|
|
343
|
+
const list = this._ensureList(unitId, subUnitId);
|
|
344
|
+
const curIndex = findIndexByAnchor(start, list, (rule) => rule.cfId);
|
|
345
|
+
const targetCfIndex = findIndexByAnchor(end, list, (rule) => rule.cfId);
|
|
346
|
+
if (targetCfIndex === null || curIndex === null || targetCfIndex === curIndex) return;
|
|
347
|
+
const rule = list[curIndex];
|
|
348
|
+
if (rule) {
|
|
349
|
+
moveByAnchor(start, end, list, (rule) => rule.cfId);
|
|
350
|
+
this._ruleChange$.next({
|
|
351
|
+
rule,
|
|
352
|
+
subUnitId,
|
|
353
|
+
unitId,
|
|
354
|
+
type: "sort"
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
createCfId(_unitId, _subUnitId) {
|
|
359
|
+
return createCfId();
|
|
360
|
+
}
|
|
361
|
+
deleteUnitId(unitId) {
|
|
362
|
+
this._model.delete(unitId);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/commands/mutations/move-conditional-rule.mutation.ts
|
|
368
|
+
const MoveConditionalRuleMutation = {
|
|
369
|
+
type: CommandType.MUTATION,
|
|
370
|
+
id: "sheet.mutation.move-conditional-rule",
|
|
371
|
+
handler(accessor, params) {
|
|
372
|
+
if (!params) return false;
|
|
373
|
+
const { unitId, subUnitId, start, end } = params;
|
|
374
|
+
accessor.get(ConditionalFormattingRuleModel).moveRulePriority(unitId, subUnitId, start, end);
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
const MoveConditionalRuleMutationUndoFactory = (param) => {
|
|
379
|
+
const { unitId, subUnitId } = param;
|
|
380
|
+
const undo = anchorUndoFactory(param.start, param.end);
|
|
381
|
+
if (!undo) return [];
|
|
382
|
+
const [start, end] = undo;
|
|
383
|
+
return [{
|
|
384
|
+
id: MoveConditionalRuleMutation.id,
|
|
385
|
+
params: {
|
|
386
|
+
unitId,
|
|
387
|
+
subUnitId,
|
|
388
|
+
start,
|
|
389
|
+
end
|
|
390
|
+
}
|
|
391
|
+
}];
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/commands/mutations/delete-conditional-rule.mutation.ts
|
|
396
|
+
const DeleteConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
397
|
+
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
398
|
+
const { unitId, subUnitId, cfId } = param;
|
|
399
|
+
const ruleList = [...conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) || []];
|
|
400
|
+
const index = ruleList.findIndex((item) => item.cfId === cfId);
|
|
401
|
+
const beforeRule = ruleList[index - 1];
|
|
402
|
+
if (index > -1) {
|
|
403
|
+
const rule = ruleList[index];
|
|
404
|
+
const result = [{
|
|
405
|
+
id: AddConditionalRuleMutation.id,
|
|
406
|
+
params: {
|
|
407
|
+
unitId,
|
|
408
|
+
subUnitId,
|
|
409
|
+
rule: Tools.deepClone(rule)
|
|
410
|
+
}
|
|
411
|
+
}];
|
|
412
|
+
ruleList.splice(index, 1);
|
|
413
|
+
if (index !== 0) {
|
|
414
|
+
const firstRule = ruleList[0];
|
|
415
|
+
if (firstRule) {
|
|
416
|
+
const transformResult = transformSupportSymmetryAnchor({
|
|
417
|
+
id: firstRule.cfId,
|
|
418
|
+
type: "before"
|
|
419
|
+
}, {
|
|
420
|
+
id: beforeRule.cfId,
|
|
421
|
+
type: "after"
|
|
422
|
+
}, ruleList, (rule) => rule.cfId);
|
|
423
|
+
if (!transformResult) return result;
|
|
424
|
+
const [start, end] = transformResult;
|
|
425
|
+
const params = {
|
|
426
|
+
unitId,
|
|
427
|
+
subUnitId,
|
|
428
|
+
start,
|
|
429
|
+
end
|
|
430
|
+
};
|
|
431
|
+
result.push({
|
|
432
|
+
id: MoveConditionalRuleMutation.id,
|
|
433
|
+
params
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return result;
|
|
438
|
+
}
|
|
439
|
+
return [];
|
|
440
|
+
};
|
|
441
|
+
const DeleteConditionalRuleMutation = {
|
|
442
|
+
type: CommandType.MUTATION,
|
|
443
|
+
id: "sheet.mutation.delete-conditional-rule",
|
|
444
|
+
handler(accessor, params) {
|
|
445
|
+
if (!params) return false;
|
|
446
|
+
const { unitId, subUnitId, cfId } = params;
|
|
447
|
+
accessor.get(ConditionalFormattingRuleModel).deleteRule(unitId, subUnitId, cfId);
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/commands/mutations/add-conditional-rule.mutation.ts
|
|
454
|
+
const AddConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
455
|
+
return {
|
|
456
|
+
id: DeleteConditionalRuleMutation.id,
|
|
457
|
+
params: {
|
|
458
|
+
unitId: param.unitId,
|
|
459
|
+
subUnitId: param.subUnitId,
|
|
460
|
+
cfId: param.rule.cfId
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
const AddConditionalRuleMutation = {
|
|
465
|
+
type: CommandType.MUTATION,
|
|
466
|
+
id: "sheet.mutation.add-conditional-rule",
|
|
467
|
+
handler(accessor, params) {
|
|
468
|
+
if (!params) return false;
|
|
469
|
+
const { unitId, subUnitId, rule } = params;
|
|
470
|
+
accessor.get(ConditionalFormattingRuleModel).addRule(unitId, subUnitId, rule);
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/commands/commands/add-cf.command.ts
|
|
477
|
+
const AddCfCommand = {
|
|
478
|
+
type: CommandType.COMMAND,
|
|
479
|
+
id: "sheet.command.add-conditional-rule",
|
|
480
|
+
handler(accessor, params) {
|
|
481
|
+
if (!params) return false;
|
|
482
|
+
const { rule } = params;
|
|
483
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
484
|
+
const commandService = accessor.get(ICommandService);
|
|
485
|
+
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
486
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
487
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
488
|
+
if (!target) return false;
|
|
489
|
+
const { unitId, subUnitId } = target;
|
|
490
|
+
const cfId = conditionalFormattingRuleModel.createCfId(unitId, subUnitId);
|
|
491
|
+
const config = {
|
|
492
|
+
unitId,
|
|
493
|
+
subUnitId,
|
|
494
|
+
rule: {
|
|
495
|
+
...rule,
|
|
496
|
+
cfId: rule.cfId || cfId
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const undo = AddConditionalRuleMutationUndoFactory(accessor, config);
|
|
500
|
+
const result = commandService.syncExecuteCommand(AddConditionalRuleMutation.id, config);
|
|
501
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
502
|
+
unitID: unitId,
|
|
503
|
+
redoMutations: [{
|
|
504
|
+
id: AddConditionalRuleMutation.id,
|
|
505
|
+
params: config
|
|
506
|
+
}],
|
|
507
|
+
undoMutations: [undo]
|
|
508
|
+
});
|
|
509
|
+
return result;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
515
|
+
function __decorateParam(paramIndex, decorator) {
|
|
516
|
+
return function(target, key) {
|
|
517
|
+
decorator(target, key, paramIndex);
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
523
|
+
function __decorate(decorators, target, key, desc) {
|
|
524
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
525
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
526
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
527
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/models/conditional-formatting-range-index-model.ts
|
|
532
|
+
let ConditionalFormattingRangeIndexModel = class ConditionalFormattingRangeIndexModel extends Disposable {
|
|
533
|
+
constructor(_conditionalFormattingRuleModel) {
|
|
534
|
+
super();
|
|
535
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
536
|
+
_defineProperty(this, "_rTreeManager", new RTree());
|
|
537
|
+
this.rebuild();
|
|
538
|
+
this._initRuleListener();
|
|
539
|
+
}
|
|
540
|
+
getRuleIdsByCell(unitId, subUnitId, row, col) {
|
|
541
|
+
return this.getRuleIdsByRanges(unitId, subUnitId, [{
|
|
542
|
+
startRow: row,
|
|
543
|
+
endRow: row,
|
|
544
|
+
startColumn: col,
|
|
545
|
+
endColumn: col
|
|
546
|
+
}]);
|
|
547
|
+
}
|
|
548
|
+
getRuleIdsByRanges(unitId, subUnitId, ranges) {
|
|
549
|
+
if (!ranges.length) return /* @__PURE__ */ new Set();
|
|
550
|
+
const ids = this._rTreeManager.bulkSearch(ranges.map((range) => ({
|
|
551
|
+
unitId,
|
|
552
|
+
sheetId: subUnitId,
|
|
553
|
+
range
|
|
554
|
+
})));
|
|
555
|
+
return new Set(Array.from(ids).map((id) => String(id)));
|
|
556
|
+
}
|
|
557
|
+
getRulesByRanges(unitId, subUnitId, ranges) {
|
|
558
|
+
const ids = this.getRuleIdsByRanges(unitId, subUnitId, ranges);
|
|
559
|
+
return (this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? []).filter((rule) => ids.has(rule.cfId));
|
|
560
|
+
}
|
|
561
|
+
dispose() {
|
|
562
|
+
this.clear();
|
|
563
|
+
super.dispose();
|
|
564
|
+
}
|
|
565
|
+
clear() {
|
|
566
|
+
this._rTreeManager.clear();
|
|
567
|
+
}
|
|
568
|
+
rebuild() {
|
|
569
|
+
this.clear();
|
|
570
|
+
this._conditionalFormattingRuleModel.getAll().forEach((subUnitMap, unitId) => {
|
|
571
|
+
subUnitMap.forEach((rules, subUnitId) => {
|
|
572
|
+
rules.forEach((rule) => {
|
|
573
|
+
this._insert(unitId, subUnitId, rule.cfId, rule.ranges);
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
_initRuleListener() {
|
|
579
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
|
|
580
|
+
const { unitId, subUnitId, rule } = e;
|
|
581
|
+
const { cfId, ranges } = rule;
|
|
582
|
+
switch (e.type) {
|
|
583
|
+
case "add":
|
|
584
|
+
this._insert(unitId, subUnitId, cfId, ranges);
|
|
585
|
+
break;
|
|
586
|
+
case "delete":
|
|
587
|
+
this._remove(unitId, subUnitId, cfId, ranges);
|
|
588
|
+
break;
|
|
589
|
+
case "set": {
|
|
590
|
+
const oldRule = e.oldRule;
|
|
591
|
+
this._remove(unitId, subUnitId, oldRule.cfId, oldRule.ranges);
|
|
592
|
+
this._insert(unitId, subUnitId, cfId, ranges);
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}));
|
|
597
|
+
}
|
|
598
|
+
_insert(unitId, subUnitId, cfId, ranges) {
|
|
599
|
+
this._rTreeManager.bulkInsert(ranges.map((range) => ({
|
|
600
|
+
unitId,
|
|
601
|
+
sheetId: subUnitId,
|
|
602
|
+
id: cfId,
|
|
603
|
+
range
|
|
604
|
+
})));
|
|
605
|
+
}
|
|
606
|
+
_remove(unitId, subUnitId, cfId, ranges) {
|
|
607
|
+
this._rTreeManager.bulkRemove(ranges.map((range) => ({
|
|
608
|
+
unitId,
|
|
609
|
+
sheetId: subUnitId,
|
|
610
|
+
id: cfId,
|
|
611
|
+
range
|
|
612
|
+
})));
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
ConditionalFormattingRangeIndexModel = __decorate([__decorateParam(0, Inject(ConditionalFormattingRuleModel))], ConditionalFormattingRangeIndexModel);
|
|
616
|
+
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/services/conditional-formatting-range-transform.service.ts
|
|
619
|
+
var ConditionalFormattingRangeTransformService = class {
|
|
620
|
+
subtractRanges(sourceRanges, rangesToSubtract) {
|
|
621
|
+
return Rectangle.mergeRanges(Rectangle.subtractMulti(sourceRanges, rangesToSubtract));
|
|
622
|
+
}
|
|
623
|
+
addRanges(sourceRanges, rangesToAdd) {
|
|
624
|
+
return Rectangle.mergeRanges([...sourceRanges, ...rangesToAdd]);
|
|
625
|
+
}
|
|
626
|
+
applyRangeDelta(sourceRanges, rangesToSubtract, rangesToAdd) {
|
|
627
|
+
const ranges = rangesToSubtract.length ? this.subtractRanges(sourceRanges, rangesToSubtract) : sourceRanges;
|
|
628
|
+
return rangesToAdd.length ? this.addRanges(ranges, rangesToAdd) : ranges;
|
|
629
|
+
}
|
|
630
|
+
copyIntersectingRanges(sourceRanges, sourceRange, targetAnchor) {
|
|
631
|
+
const fragments = [];
|
|
632
|
+
sourceRanges.forEach((range) => {
|
|
633
|
+
const intersect = getIntersectRange(range, sourceRange);
|
|
634
|
+
if (!intersect) return;
|
|
635
|
+
fragments.push(this.translateRange(intersect, {
|
|
636
|
+
row: targetAnchor.row - sourceRange.startRow,
|
|
637
|
+
col: targetAnchor.col - sourceRange.startColumn
|
|
638
|
+
}));
|
|
639
|
+
});
|
|
640
|
+
return Rectangle.mergeRanges(fragments);
|
|
641
|
+
}
|
|
642
|
+
translateRange(range, offset) {
|
|
643
|
+
return {
|
|
644
|
+
startRow: range.startRow + offset.row,
|
|
645
|
+
endRow: range.endRow + offset.row,
|
|
646
|
+
startColumn: range.startColumn + offset.col,
|
|
647
|
+
endColumn: range.endColumn + offset.col
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
//#endregion
|
|
653
|
+
//#region src/commands/mutations/set-conditional-rule.mutation.ts
|
|
654
|
+
const SetConditionalRuleMutation = {
|
|
655
|
+
type: CommandType.MUTATION,
|
|
656
|
+
id: "sheet.mutation.set-conditional-rule",
|
|
657
|
+
handler(accessor, params) {
|
|
658
|
+
if (!params) return false;
|
|
659
|
+
const { unitId, subUnitId, rule } = params;
|
|
660
|
+
const cfId = params.cfId || params.rule.cfId;
|
|
661
|
+
accessor.get(ConditionalFormattingRuleModel).setRule(unitId, subUnitId, rule, cfId);
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
const setConditionalRuleMutationUndoFactory = (accessor, param) => {
|
|
666
|
+
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
667
|
+
const { unitId, subUnitId } = param;
|
|
668
|
+
const cfId = param.cfId || param.rule.cfId;
|
|
669
|
+
const rule = conditionalFormattingRuleModel.getRule(unitId, subUnitId, cfId);
|
|
670
|
+
if (rule) return [{
|
|
671
|
+
id: SetConditionalRuleMutation.id,
|
|
672
|
+
params: {
|
|
673
|
+
unitId,
|
|
674
|
+
subUnitId,
|
|
675
|
+
cfId,
|
|
676
|
+
rule: Tools.deepClone(rule)
|
|
677
|
+
}
|
|
678
|
+
}];
|
|
679
|
+
return [];
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/commands/commands/clear-range-cf.command.ts
|
|
684
|
+
const ClearRangeCfCommand = {
|
|
685
|
+
type: CommandType.COMMAND,
|
|
686
|
+
id: "sheet.command.clear-range-conditional-rule",
|
|
687
|
+
handler(accessor, params) {
|
|
688
|
+
var _selectionManagerServ;
|
|
689
|
+
if (!params) return false;
|
|
690
|
+
const conditionalFormattingRangeIndexModel = accessor.get(ConditionalFormattingRangeIndexModel);
|
|
691
|
+
const conditionalFormattingRangeTransformService = accessor.get(ConditionalFormattingRangeTransformService);
|
|
692
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
693
|
+
const commandService = accessor.get(ICommandService);
|
|
694
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
695
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
696
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
697
|
+
if (!target) return false;
|
|
698
|
+
const { unitId, subUnitId } = target;
|
|
699
|
+
const ranges = params.ranges ?? ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((selection) => selection.range)) ?? [];
|
|
700
|
+
const allRuleList = conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).filter((rule) => {
|
|
701
|
+
var _params$types;
|
|
702
|
+
return !((_params$types = params.types) === null || _params$types === void 0 ? void 0 : _params$types.length) || params.types.includes(rule.rule.type);
|
|
703
|
+
});
|
|
704
|
+
if (!(allRuleList === null || allRuleList === void 0 ? void 0 : allRuleList.length) || !ranges.length) return false;
|
|
705
|
+
const redos = [];
|
|
706
|
+
const undos = [];
|
|
707
|
+
allRuleList.forEach((oldRule) => {
|
|
708
|
+
const newRanges = conditionalFormattingRangeTransformService.subtractRanges(oldRule.ranges, ranges);
|
|
709
|
+
if (newRanges.length) {
|
|
710
|
+
const rule = {
|
|
711
|
+
...oldRule,
|
|
712
|
+
ranges: newRanges
|
|
713
|
+
};
|
|
714
|
+
const params = {
|
|
715
|
+
unitId,
|
|
716
|
+
subUnitId,
|
|
717
|
+
rule
|
|
718
|
+
};
|
|
719
|
+
const undo = setConditionalRuleMutationUndoFactory(accessor, params);
|
|
720
|
+
redos.push({
|
|
721
|
+
id: SetConditionalRuleMutation.id,
|
|
722
|
+
params
|
|
723
|
+
});
|
|
724
|
+
undos.push(...undo);
|
|
725
|
+
} else {
|
|
726
|
+
const params = {
|
|
727
|
+
unitId,
|
|
728
|
+
subUnitId,
|
|
729
|
+
cfId: oldRule.cfId
|
|
730
|
+
};
|
|
731
|
+
const undo = DeleteConditionalRuleMutationUndoFactory(accessor, params);
|
|
732
|
+
redos.push({
|
|
733
|
+
id: DeleteConditionalRuleMutation.id,
|
|
734
|
+
params
|
|
735
|
+
});
|
|
736
|
+
undos.push(...undo);
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
const result = sequenceExecute(redos, commandService).result;
|
|
740
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
741
|
+
unitID: unitId,
|
|
742
|
+
redoMutations: redos,
|
|
743
|
+
undoMutations: undos
|
|
744
|
+
});
|
|
745
|
+
return result;
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/commands/commands/clear-worksheet-cf.command.ts
|
|
751
|
+
const ClearWorksheetCfCommand = {
|
|
752
|
+
type: CommandType.COMMAND,
|
|
753
|
+
id: "sheet.command.clear-worksheet-conditional-rule",
|
|
754
|
+
handler(accessor, params) {
|
|
755
|
+
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
756
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
757
|
+
const commandService = accessor.get(ICommandService);
|
|
758
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
759
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
760
|
+
if (!target) return false;
|
|
761
|
+
const { unitId, subUnitId } = target;
|
|
762
|
+
const ruleList = conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
763
|
+
if (!(ruleList === null || ruleList === void 0 ? void 0 : ruleList.length)) return false;
|
|
764
|
+
const configList = ruleList.map((rule) => ({
|
|
765
|
+
cfId: rule.cfId,
|
|
766
|
+
unitId,
|
|
767
|
+
subUnitId
|
|
768
|
+
}));
|
|
769
|
+
const redos = configList.map((config) => ({
|
|
770
|
+
id: DeleteConditionalRuleMutation.id,
|
|
771
|
+
params: config
|
|
772
|
+
}));
|
|
773
|
+
const undos = configList.map((config) => DeleteConditionalRuleMutationUndoFactory(accessor, config)[0]);
|
|
774
|
+
const result = sequenceExecute(redos, commandService).result;
|
|
775
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
776
|
+
unitID: unitId,
|
|
777
|
+
redoMutations: redos,
|
|
778
|
+
undoMutations: undos
|
|
779
|
+
});
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/commands/commands/delete-cf.command.ts
|
|
786
|
+
const DeleteCfCommand = {
|
|
787
|
+
type: CommandType.COMMAND,
|
|
788
|
+
id: "sheet.command.delete-conditional-rule",
|
|
789
|
+
handler(accessor, params) {
|
|
790
|
+
if (!params) return false;
|
|
791
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
792
|
+
const commandService = accessor.get(ICommandService);
|
|
793
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
794
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
795
|
+
if (!target) return false;
|
|
796
|
+
const { unitId, subUnitId } = target;
|
|
797
|
+
const config = {
|
|
798
|
+
unitId,
|
|
799
|
+
subUnitId,
|
|
800
|
+
cfId: params.cfId
|
|
801
|
+
};
|
|
802
|
+
const undos = DeleteConditionalRuleMutationUndoFactory(accessor, config);
|
|
803
|
+
const result = commandService.syncExecuteCommand(DeleteConditionalRuleMutation.id, config);
|
|
804
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
805
|
+
unitID: unitId,
|
|
806
|
+
undoMutations: undos,
|
|
807
|
+
redoMutations: [{
|
|
808
|
+
id: DeleteConditionalRuleMutation.id,
|
|
809
|
+
params: config
|
|
810
|
+
}]
|
|
811
|
+
});
|
|
812
|
+
return result;
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region src/commands/commands/move-cf.command.ts
|
|
818
|
+
const MoveCfCommand = {
|
|
819
|
+
type: CommandType.COMMAND,
|
|
820
|
+
id: "sheet.command.move-conditional-rule",
|
|
821
|
+
handler(accessor, params) {
|
|
822
|
+
if (!params) return false;
|
|
823
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
824
|
+
const commandService = accessor.get(ICommandService);
|
|
825
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
826
|
+
const conditionalFormattingRuleModel = accessor.get(ConditionalFormattingRuleModel);
|
|
827
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
828
|
+
if (!target) return false;
|
|
829
|
+
const { unitId, subUnitId } = target;
|
|
830
|
+
const anchorList = transformSupportSymmetryAnchor(params.start, params.end, conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) || [], (rule) => rule.cfId);
|
|
831
|
+
if (!anchorList) return false;
|
|
832
|
+
const [start, end] = anchorList;
|
|
833
|
+
const config = {
|
|
834
|
+
unitId,
|
|
835
|
+
subUnitId,
|
|
836
|
+
start,
|
|
837
|
+
end
|
|
838
|
+
};
|
|
839
|
+
const undos = MoveConditionalRuleMutationUndoFactory(config);
|
|
840
|
+
const result = commandService.syncExecuteCommand(MoveConditionalRuleMutation.id, config);
|
|
841
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
842
|
+
unitID: unitId,
|
|
843
|
+
redoMutations: [{
|
|
844
|
+
id: MoveConditionalRuleMutation.id,
|
|
845
|
+
params: config
|
|
846
|
+
}],
|
|
847
|
+
undoMutations: undos
|
|
848
|
+
});
|
|
849
|
+
return result;
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region src/commands/commands/set-cf.command.ts
|
|
855
|
+
const SetCfCommand = {
|
|
856
|
+
type: CommandType.COMMAND,
|
|
857
|
+
id: "sheet.command.set-conditional-rule",
|
|
858
|
+
handler(accessor, params) {
|
|
859
|
+
if (!params) return false;
|
|
860
|
+
const undoRedoService = accessor.get(IUndoRedoService);
|
|
861
|
+
const commandService = accessor.get(ICommandService);
|
|
862
|
+
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
863
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
864
|
+
if (!target) return false;
|
|
865
|
+
const { unitId, subUnitId } = target;
|
|
866
|
+
const config = {
|
|
867
|
+
unitId,
|
|
868
|
+
subUnitId,
|
|
869
|
+
rule: params.rule,
|
|
870
|
+
cfId: params.cfId
|
|
871
|
+
};
|
|
872
|
+
const undos = setConditionalRuleMutationUndoFactory(accessor, config);
|
|
873
|
+
const result = commandService.syncExecuteCommand(SetConditionalRuleMutation.id, config);
|
|
874
|
+
if (result) undoRedoService.pushUndoRedo({
|
|
875
|
+
unitID: unitId,
|
|
876
|
+
undoMutations: undos,
|
|
877
|
+
redoMutations: [{
|
|
878
|
+
id: SetConditionalRuleMutation.id,
|
|
879
|
+
params: config
|
|
880
|
+
}]
|
|
881
|
+
});
|
|
882
|
+
return result;
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region src/utils/range.ts
|
|
888
|
+
function getRangeInWorksheet(range, worksheet) {
|
|
889
|
+
const maxRows = worksheet.getMaxRows();
|
|
890
|
+
const maxColumns = worksheet.getMaxColumns();
|
|
891
|
+
if (maxRows <= 0 || maxColumns <= 0) return null;
|
|
892
|
+
const effectiveRange = getIntersectRange(Range.transformRange(range, worksheet), {
|
|
893
|
+
startRow: 0,
|
|
894
|
+
endRow: maxRows - 1,
|
|
895
|
+
startColumn: 0,
|
|
896
|
+
endColumn: maxColumns - 1
|
|
897
|
+
});
|
|
898
|
+
if (!effectiveRange) return null;
|
|
899
|
+
return {
|
|
900
|
+
startRow: effectiveRange.startRow,
|
|
901
|
+
endRow: effectiveRange.endRow,
|
|
902
|
+
startColumn: effectiveRange.startColumn,
|
|
903
|
+
endColumn: effectiveRange.endColumn
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
function getRangesInWorksheet(ranges, worksheet) {
|
|
907
|
+
const effectiveRanges = [];
|
|
908
|
+
ranges.forEach((range) => {
|
|
909
|
+
const effectiveRange = getRangeInWorksheet(range, worksheet);
|
|
910
|
+
if (effectiveRange) effectiveRanges.push(effectiveRange);
|
|
911
|
+
});
|
|
912
|
+
return effectiveRanges;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region src/services/conditional-formatting-formula.service.ts
|
|
917
|
+
let ConditionalFormattingFormulaService = class ConditionalFormattingFormulaService extends Disposable {
|
|
918
|
+
constructor(_registerOtherFormulaService, _conditionalFormattingRuleModel, _univerInstanceService) {
|
|
919
|
+
super();
|
|
920
|
+
this._registerOtherFormulaService = _registerOtherFormulaService;
|
|
921
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
922
|
+
this._univerInstanceService = _univerInstanceService;
|
|
923
|
+
_defineProperty(this, "_formulaMap", /* @__PURE__ */ new Map());
|
|
924
|
+
_defineProperty(this, "_result$", new Subject());
|
|
925
|
+
_defineProperty(this, "result$", this._result$.asObservable());
|
|
926
|
+
this._initFormulaResultChange();
|
|
927
|
+
this._initRuleChange();
|
|
928
|
+
}
|
|
929
|
+
_initRuleChange() {
|
|
930
|
+
const isNeedMarkFormulaDirty = (rule) => {
|
|
931
|
+
switch (rule.type) {
|
|
932
|
+
case "colorScale": return rule.config.some((item) => item.value.type === "formula");
|
|
933
|
+
case "dataBar": return [rule.config.max, rule.config.min].some((item) => item.type === "formula");
|
|
934
|
+
case "iconSet": return rule.config.some((item) => item.value.type === "formula");
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((option) => {
|
|
938
|
+
const { unitId, subUnitId, rule, oldRule } = option;
|
|
939
|
+
if (option.type === "delete") this._removeFormulaByCfId(unitId, subUnitId, rule.cfId);
|
|
940
|
+
if (option.type === "set") {
|
|
941
|
+
if (isNeedMarkFormulaDirty(rule.rule) || oldRule && isNeedMarkFormulaDirty(oldRule.rule)) this._removeFormulaByCfId(unitId, subUnitId, rule.cfId);
|
|
942
|
+
}
|
|
943
|
+
if (option.type === "add") this._registerRuleFormulas(unitId, subUnitId, rule);
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Register formulas for a specific rule based on its type
|
|
948
|
+
*/
|
|
949
|
+
_registerRuleFormulas(unitId, subUnitId, rule) {
|
|
950
|
+
switch (rule.rule.type) {
|
|
951
|
+
case "highlightCell": if (rule.rule.subType === "formula") {
|
|
952
|
+
const formulaText = rule.rule.value;
|
|
953
|
+
if (formulaText) this.registerFormulaWithRange(unitId, subUnitId, rule.cfId, formulaText, rule.ranges);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
_initFormulaResultChange() {
|
|
958
|
+
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((results) => {
|
|
959
|
+
for (const unitId in results) for (const subUnitId in results[unitId]) {
|
|
960
|
+
const subUnitResults = results[unitId][subUnitId];
|
|
961
|
+
for (const formulaResult of subUnitResults) {
|
|
962
|
+
const formulaMapAlias = this._ensureSubunitFormulaMap(unitId, subUnitId).getValue(formulaResult.formulaId, ["formulaId"]);
|
|
963
|
+
if (!formulaMapAlias) continue;
|
|
964
|
+
const isAllFinished = this._getAllFormulaResultByCfId(unitId, subUnitId, formulaMapAlias.cfId).every((item) => {
|
|
965
|
+
const result = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
|
|
966
|
+
return (result === null || result === void 0 ? void 0 : result.status) === FormulaResultStatus.SUCCESS;
|
|
967
|
+
});
|
|
968
|
+
this._result$.next({
|
|
969
|
+
...formulaMapAlias,
|
|
970
|
+
isAllFinished
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}));
|
|
975
|
+
}
|
|
976
|
+
_ensureSubunitFormulaMap(unitId, subUnitId) {
|
|
977
|
+
let unitMap = this._formulaMap.get(unitId);
|
|
978
|
+
if (!unitMap) {
|
|
979
|
+
unitMap = /* @__PURE__ */ new Map();
|
|
980
|
+
this._formulaMap.set(unitId, unitMap);
|
|
981
|
+
}
|
|
982
|
+
let subUnitMap = unitMap.get(subUnitId);
|
|
983
|
+
if (!subUnitMap) {
|
|
984
|
+
subUnitMap = new RefAlias([], ["formulaId", "id"]);
|
|
985
|
+
unitMap.set(subUnitId, subUnitMap);
|
|
986
|
+
}
|
|
987
|
+
return subUnitMap;
|
|
988
|
+
}
|
|
989
|
+
getSubUnitFormulaMap(unitId, subUnitId) {
|
|
990
|
+
var _this$_formulaMap$get;
|
|
991
|
+
return (_this$_formulaMap$get = this._formulaMap.get(unitId)) === null || _this$_formulaMap$get === void 0 ? void 0 : _this$_formulaMap$get.get(subUnitId);
|
|
992
|
+
}
|
|
993
|
+
registerFormulaWithRange(unitId, subUnitId, cfId, formulaText, ranges = [{
|
|
994
|
+
startRow: 0,
|
|
995
|
+
endRow: 0,
|
|
996
|
+
startColumn: 0,
|
|
997
|
+
endColumn: 0
|
|
998
|
+
}]) {
|
|
999
|
+
var _this$_univerInstance;
|
|
1000
|
+
const formulaMap = this._ensureSubunitFormulaMap(unitId, subUnitId);
|
|
1001
|
+
const cfFormulaId = this.createCFormulaId(cfId, formulaText);
|
|
1002
|
+
if (formulaMap.getValue(cfFormulaId, ["id"])) return;
|
|
1003
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(subUnitId);
|
|
1004
|
+
if (!worksheet) return;
|
|
1005
|
+
const effectiveRanges = getRangesInWorksheet(ranges, worksheet);
|
|
1006
|
+
if (!effectiveRanges.length) return;
|
|
1007
|
+
const sortedRanges = effectiveRanges.sort((a, b) => a.startRow !== b.startRow ? a.startRow - b.startRow : a.startColumn - b.startColumn);
|
|
1008
|
+
const formulaId = this._registerOtherFormulaService.registerFormulaWithRange(unitId, subUnitId, formulaText, sortedRanges, void 0, OtherFormulaBizType.CONDITIONAL_FORMATTING, cfId);
|
|
1009
|
+
formulaMap.addValue({
|
|
1010
|
+
formulaText,
|
|
1011
|
+
unitId,
|
|
1012
|
+
subUnitId,
|
|
1013
|
+
cfId,
|
|
1014
|
+
id: cfFormulaId,
|
|
1015
|
+
formulaId
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
_removeFormulaByCfId(unitId, subUnitId, cfId) {
|
|
1019
|
+
const formulaIdList = this.deleteCache(unitId, subUnitId, cfId).map((item) => item.formulaId);
|
|
1020
|
+
this._registerOtherFormulaService.deleteFormula(unitId, subUnitId, formulaIdList);
|
|
1021
|
+
}
|
|
1022
|
+
getFormulaResultWithCoords(unitId, subUnitId, cfId, formulaText, row = 0, col = 0) {
|
|
1023
|
+
const map = this.getSubUnitFormulaMap(unitId, subUnitId);
|
|
1024
|
+
if (!map) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1025
|
+
const item = map.getValue(this.createCFormulaId(cfId, formulaText), ["id"]);
|
|
1026
|
+
if (!item) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1027
|
+
const formulaResult = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
|
|
1028
|
+
if (!formulaResult) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1029
|
+
if (formulaResult.status === FormulaResultStatus.SUCCESS && formulaResult.result) {
|
|
1030
|
+
var _formulaResult$result;
|
|
1031
|
+
const cellData = (_formulaResult$result = formulaResult.result[row]) === null || _formulaResult$result === void 0 ? void 0 : _formulaResult$result[col];
|
|
1032
|
+
return {
|
|
1033
|
+
result: this._getCellValue(cellData),
|
|
1034
|
+
status: FormulaResultStatus.SUCCESS
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
return { status: formulaResult.status };
|
|
1038
|
+
}
|
|
1039
|
+
getFormulaMatrix(unitId, subUnitId, cfId, formulaText) {
|
|
1040
|
+
const map = this.getSubUnitFormulaMap(unitId, subUnitId);
|
|
1041
|
+
if (!map) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1042
|
+
const item = map.getValue(this.createCFormulaId(cfId, formulaText), ["id"]);
|
|
1043
|
+
if (!item) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1044
|
+
const formulaResult = this._registerOtherFormulaService.getFormulaValueSync(unitId, subUnitId, item.formulaId);
|
|
1045
|
+
if (!formulaResult) return { status: FormulaResultStatus.NOT_REGISTER };
|
|
1046
|
+
if (formulaResult.status === FormulaResultStatus.SUCCESS && formulaResult.result) {
|
|
1047
|
+
const result = new ObjectMatrix();
|
|
1048
|
+
new ObjectMatrix(formulaResult.result).forValue((row, col, cellData) => {
|
|
1049
|
+
result.setValue(row, col, this._getCellValue(cellData));
|
|
1050
|
+
});
|
|
1051
|
+
return {
|
|
1052
|
+
result,
|
|
1053
|
+
status: FormulaResultStatus.SUCCESS
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
return { status: formulaResult.status };
|
|
1057
|
+
}
|
|
1058
|
+
_getCellValue(cellData) {
|
|
1059
|
+
if (!cellData || !cellData[0] || !cellData[0][0]) return false;
|
|
1060
|
+
const cell = cellData[0][0];
|
|
1061
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.t) === CellValueType.BOOLEAN) return cell.v === BooleanNumber.TRUE || cell.v === true;
|
|
1062
|
+
return cell === null || cell === void 0 ? void 0 : cell.v;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
|
|
1066
|
+
*/
|
|
1067
|
+
deleteCache(unitId, subUnitId, cfId, formulaText) {
|
|
1068
|
+
const map = this.getSubUnitFormulaMap(unitId, subUnitId);
|
|
1069
|
+
if (!map) return [];
|
|
1070
|
+
if (formulaText) {
|
|
1071
|
+
const key = this.createCFormulaId(cfId, formulaText);
|
|
1072
|
+
map.deleteValue(key, ["id"]);
|
|
1073
|
+
return [];
|
|
1074
|
+
} else {
|
|
1075
|
+
const values = map.getValues().filter((v) => v.cfId === cfId);
|
|
1076
|
+
values.forEach((e) => {
|
|
1077
|
+
map.deleteValue(e.formulaId, ["formulaId"]);
|
|
1078
|
+
});
|
|
1079
|
+
return values;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
_getAllFormulaResultByCfId(unitId, subUnitId, cfId) {
|
|
1083
|
+
const map = this.getSubUnitFormulaMap(unitId, subUnitId);
|
|
1084
|
+
if (!map) return [];
|
|
1085
|
+
return map.getValues().filter((v) => v.cfId === cfId);
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* A conditional formatting may have multiple formulas;if the formulas are identical,then the results will be consistent.
|
|
1089
|
+
*/
|
|
1090
|
+
createCFormulaId(cfId, formulaText) {
|
|
1091
|
+
return `${cfId}_${formulaText}`;
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
ConditionalFormattingFormulaService = __decorate([
|
|
1095
|
+
__decorateParam(0, Inject(RegisterOtherFormulaService)),
|
|
1096
|
+
__decorateParam(1, Inject(ConditionalFormattingRuleModel)),
|
|
1097
|
+
__decorateParam(2, IUniverInstanceService)
|
|
1098
|
+
], ConditionalFormattingFormulaService);
|
|
1099
|
+
|
|
1100
|
+
//#endregion
|
|
1101
|
+
//#region src/models/calculate-unit-v2/base-calculate-unit.ts
|
|
1102
|
+
/**
|
|
1103
|
+
* Processing Main Path Calculation Logic
|
|
1104
|
+
*/
|
|
1105
|
+
var BaseCalculateUnit = class {
|
|
1106
|
+
constructor(_context) {
|
|
1107
|
+
this._context = _context;
|
|
1108
|
+
_defineProperty(this, "_cache", void 0);
|
|
1109
|
+
_defineProperty(this, "_preComputingStatus$", new BehaviorSubject("preComputingStart"));
|
|
1110
|
+
_defineProperty(this, "preComputingStatus$", this._preComputingStatus$.asObservable().pipe(distinctUntilChanged()));
|
|
1111
|
+
_defineProperty(this, "_preComputingCache", void 0);
|
|
1112
|
+
_defineProperty(this, "_rule", void 0);
|
|
1113
|
+
this._cache = new LRUMap(_context.limit);
|
|
1114
|
+
this._rule = _context.rule;
|
|
1115
|
+
this._preComputingCache = null;
|
|
1116
|
+
this._initClearCacheListener();
|
|
1117
|
+
}
|
|
1118
|
+
setCacheLength(length) {
|
|
1119
|
+
this._cache.limit = length;
|
|
1120
|
+
}
|
|
1121
|
+
clearCache() {
|
|
1122
|
+
this._cache.clear();
|
|
1123
|
+
}
|
|
1124
|
+
resetPreComputingCache() {
|
|
1125
|
+
this._preComputingStatus$.next("preComputingStart");
|
|
1126
|
+
this._preComputingCache = null;
|
|
1127
|
+
}
|
|
1128
|
+
updateRule(rule) {
|
|
1129
|
+
this._rule = rule;
|
|
1130
|
+
this.resetPreComputingCache();
|
|
1131
|
+
}
|
|
1132
|
+
getCell(row, col) {
|
|
1133
|
+
const key = this._createKey(row, col);
|
|
1134
|
+
if (this._preComputingStatus$.getValue() === "preComputing") return this._cache.get(key);
|
|
1135
|
+
let preComputingResult = this.getPreComputingResult(row, col);
|
|
1136
|
+
if (preComputingResult === null) {
|
|
1137
|
+
this._preComputingStatus$.next("preComputingStart");
|
|
1138
|
+
this.preComputing(row, col, this._getContext());
|
|
1139
|
+
preComputingResult = this.getPreComputingResult(row, col);
|
|
1140
|
+
if (preComputingResult === null) return this._cache.get(key);
|
|
1141
|
+
}
|
|
1142
|
+
this._preComputingStatus$.next("preComputingEnd");
|
|
1143
|
+
if (this._cache.has(key)) return this._cache.get(key);
|
|
1144
|
+
const result = this.getCellResult(row, col, preComputingResult, this._getContext());
|
|
1145
|
+
if (result !== null) this._setCache(row, col, result);
|
|
1146
|
+
return result;
|
|
1147
|
+
}
|
|
1148
|
+
setPreComputingCache(v) {
|
|
1149
|
+
this._preComputingCache = v;
|
|
1150
|
+
}
|
|
1151
|
+
getPreComputingResult(_row, _col) {
|
|
1152
|
+
return this._preComputingCache;
|
|
1153
|
+
}
|
|
1154
|
+
_createKey(row, col) {
|
|
1155
|
+
return `${row}_${col}`;
|
|
1156
|
+
}
|
|
1157
|
+
_setCache(row, col, v) {
|
|
1158
|
+
const key = this._createKey(row, col);
|
|
1159
|
+
this._cache.set(key, v);
|
|
1160
|
+
}
|
|
1161
|
+
_getContext() {
|
|
1162
|
+
return {
|
|
1163
|
+
...this._context,
|
|
1164
|
+
rule: this._rule
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
_initClearCacheListener() {
|
|
1168
|
+
this.preComputingStatus$.subscribe((e) => {
|
|
1169
|
+
if (e === "preComputingEnd") this.clearCache();
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region src/models/calculate-unit-v2/color-scale-calculate-unit.ts
|
|
1176
|
+
var ColorScaleCalculateUnit = class extends BaseCalculateUnit {
|
|
1177
|
+
preComputing(_row, _col, context) {
|
|
1178
|
+
const rule = context.rule;
|
|
1179
|
+
const worksheet = context.worksheet;
|
|
1180
|
+
const matrix = new ObjectMatrix();
|
|
1181
|
+
if (!rule.rule.config.every((item) => item.value.type === "num")) filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
|
|
1182
|
+
Range.foreach(range, (row, col) => {
|
|
1183
|
+
const cell = context.getCellValue(row, col);
|
|
1184
|
+
const v = cell && cell.v;
|
|
1185
|
+
if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === CellValueType.NUMBER) {
|
|
1186
|
+
const _value = Number(v);
|
|
1187
|
+
!Number.isNaN(_value) && matrix.setValue(row, col, _value);
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
});
|
|
1191
|
+
const _configList = [...rule.rule.config].sort((a, b) => a.index - b.index).map((config) => {
|
|
1192
|
+
return {
|
|
1193
|
+
value: getValueByType(config.value, matrix, {
|
|
1194
|
+
...context,
|
|
1195
|
+
cfId: rule.cfId
|
|
1196
|
+
}),
|
|
1197
|
+
color: new ColorKit(config.color)
|
|
1198
|
+
};
|
|
1199
|
+
});
|
|
1200
|
+
if (!_configList.some((item) => isObject(item.value) ? item.value.status !== FormulaResultStatus.SUCCESS : false)) {
|
|
1201
|
+
const colorList = _configList.map((item) => item.color).reduce((result, color, index) => {
|
|
1202
|
+
result.result.push({
|
|
1203
|
+
color,
|
|
1204
|
+
value: result.sortValue[index]
|
|
1205
|
+
});
|
|
1206
|
+
return result;
|
|
1207
|
+
}, {
|
|
1208
|
+
result: [],
|
|
1209
|
+
sortValue: _configList.map((item) => item.value.result).sort((a, b) => a - b)
|
|
1210
|
+
}).result;
|
|
1211
|
+
this.setPreComputingCache(colorList);
|
|
1212
|
+
this._preComputingStatus$.next("preComputingEnd");
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
this._preComputingStatus$.next("preComputing");
|
|
1216
|
+
}
|
|
1217
|
+
getCellResult(row, col, preComputingResult, context) {
|
|
1218
|
+
if (!preComputingResult) return null;
|
|
1219
|
+
const cell = context.getCellValue(row, col);
|
|
1220
|
+
if (cell.t === CellValueType.NUMBER) {
|
|
1221
|
+
const v = Number(cell.v);
|
|
1222
|
+
if (!Number.isNaN(v)) return getColorScaleFromValue(preComputingResult, v);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/render/data-bar.render.ts
|
|
1229
|
+
const dataBarUKey = "sheet-conditional-rule-data-bar";
|
|
1230
|
+
const defaultDataBarPositiveColor = "#ffbe38";
|
|
1231
|
+
const defaultDataBarNativeColor = "#abd91a";
|
|
1232
|
+
const defaultPlaceholderColor = "#000";
|
|
1233
|
+
const EXTENSION_Z_INDEX$1 = 34;
|
|
1234
|
+
const stringifyRange$1 = (range) => {
|
|
1235
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
1236
|
+
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
1237
|
+
};
|
|
1238
|
+
var DataBar = class extends SheetExtension {
|
|
1239
|
+
constructor(..._args) {
|
|
1240
|
+
super(..._args);
|
|
1241
|
+
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
1242
|
+
_defineProperty(this, "_paddingTopAndBottom", 2);
|
|
1243
|
+
_defineProperty(this, "_renderRangeResolver", null);
|
|
1244
|
+
_defineProperty(this, "uKey", dataBarUKey);
|
|
1245
|
+
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX$1);
|
|
1246
|
+
_defineProperty(this, "_radius", 1);
|
|
1247
|
+
}
|
|
1248
|
+
setRenderRangeResolver(resolver) {
|
|
1249
|
+
this._renderRangeResolver = resolver;
|
|
1250
|
+
}
|
|
1251
|
+
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
|
|
1252
|
+
const { worksheet } = spreadsheetSkeleton;
|
|
1253
|
+
if (!worksheet) return false;
|
|
1254
|
+
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
1255
|
+
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
1256
|
+
const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
|
|
1257
|
+
if (!renderRanges.length) return;
|
|
1258
|
+
ctx.save();
|
|
1259
|
+
renderRanges.forEach((range) => {
|
|
1260
|
+
Range.foreach(range, (row, col) => {
|
|
1261
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
1262
|
+
const primaryWithCoord = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
|
|
1263
|
+
const { isMerged, isMergedMainCell, mergeInfo } = primaryWithCoord;
|
|
1264
|
+
let cellData = worksheet.getCell(row, col);
|
|
1265
|
+
if (isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
|
|
1266
|
+
if (!(cellData === null || cellData === void 0 ? void 0 : cellData.dataBar)) return;
|
|
1267
|
+
if (!this.isRenderDiffRangesByCell(mergeInfo, diffRanges)) return;
|
|
1268
|
+
if (isMerged || isMergedMainCell) {
|
|
1269
|
+
const rangeStr = stringifyRange$1(mergeInfo);
|
|
1270
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
1271
|
+
mergeCellRendered.add(rangeStr);
|
|
1272
|
+
}
|
|
1273
|
+
const { color, value, startPoint, isGradient } = cellData.dataBar;
|
|
1274
|
+
const { startX, endX, startY, endY } = isMerged || isMergedMainCell ? mergeInfo : primaryWithCoord;
|
|
1275
|
+
const borderWidth = endX - startX;
|
|
1276
|
+
const borderHeight = endY + FIX_ONE_PIXEL_BLUR_OFFSET - startY;
|
|
1277
|
+
const width = borderWidth - this._paddingRightAndLeft * 2;
|
|
1278
|
+
const height = borderHeight - this._paddingTopAndBottom * 2;
|
|
1279
|
+
if (value > 0) {
|
|
1280
|
+
const dataBarWidth = Math.max(width * (1 - startPoint / 100) * value / 100, 1);
|
|
1281
|
+
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width;
|
|
1282
|
+
const y0 = startY + this._paddingTopAndBottom;
|
|
1283
|
+
if (isGradient) {
|
|
1284
|
+
const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
|
|
1285
|
+
gradient.addColorStop(0, color);
|
|
1286
|
+
gradient.addColorStop(1, "rgb(255 255 255)");
|
|
1287
|
+
ctx.fillStyle = gradient;
|
|
1288
|
+
ctx.strokeStyle = color;
|
|
1289
|
+
ctx.lineWidth = 1;
|
|
1290
|
+
} else ctx.fillStyle = color;
|
|
1291
|
+
this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, false, true, true, false);
|
|
1292
|
+
if (isGradient) ctx.stroke();
|
|
1293
|
+
} else {
|
|
1294
|
+
const dataBarWidth = Math.max(width * startPoint / 100 * Math.abs(value) / 100, 1);
|
|
1295
|
+
const x0 = startX + this._paddingRightAndLeft + startPoint / 100 * width - dataBarWidth;
|
|
1296
|
+
const y0 = startY + this._paddingTopAndBottom;
|
|
1297
|
+
if (isGradient) {
|
|
1298
|
+
const gradient = ctx.createLinearGradient(x0, y0, x0 + dataBarWidth, y0);
|
|
1299
|
+
gradient.addColorStop(0, "rgb(255 255 255)");
|
|
1300
|
+
gradient.addColorStop(1, color);
|
|
1301
|
+
ctx.fillStyle = gradient;
|
|
1302
|
+
ctx.strokeStyle = color;
|
|
1303
|
+
ctx.lineWidth = 1;
|
|
1304
|
+
} else ctx.fillStyle = color;
|
|
1305
|
+
this._drawRectWithRoundedCorner(ctx, x0, y0, dataBarWidth, height, true, false, false, true);
|
|
1306
|
+
if (isGradient) ctx.stroke();
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
ctx.restore();
|
|
1311
|
+
}
|
|
1312
|
+
dispose() {
|
|
1313
|
+
this._renderRangeResolver = null;
|
|
1314
|
+
super.dispose();
|
|
1315
|
+
}
|
|
1316
|
+
_drawRectWithRoundedCorner(ctx, x, y, width, height, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) {
|
|
1317
|
+
const radius = this._radius;
|
|
1318
|
+
if (!height || !width) return;
|
|
1319
|
+
ctx.beginPath();
|
|
1320
|
+
ctx.moveTo(x + radius, y);
|
|
1321
|
+
ctx.lineTo(x + width - radius, y);
|
|
1322
|
+
if (topRightRadius) ctx.arcTo(x + width, y, x + width, y + radius, radius);
|
|
1323
|
+
else ctx.lineTo(x + width, y);
|
|
1324
|
+
ctx.lineTo(x + width, y + height - radius);
|
|
1325
|
+
if (bottomRightRadius) ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius);
|
|
1326
|
+
else ctx.lineTo(x + width, y + height);
|
|
1327
|
+
ctx.lineTo(x + radius, y + height);
|
|
1328
|
+
if (bottomLeftRadius) ctx.arcTo(x, y + height, x, y + height - radius, radius);
|
|
1329
|
+
else ctx.lineTo(x, y + height);
|
|
1330
|
+
ctx.lineTo(x, y + radius);
|
|
1331
|
+
if (topLeftRadius) ctx.arcTo(x, y, x + radius, y, radius);
|
|
1332
|
+
else ctx.lineTo(x, y);
|
|
1333
|
+
ctx.closePath();
|
|
1334
|
+
ctx.fill();
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
SpreadsheetExtensionRegistry.add(DataBar);
|
|
1338
|
+
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/models/calculate-unit-v2/data-bar-calculate-unit.ts
|
|
1341
|
+
const getSafeValue = (v) => Math.max(Math.min(100, v), 0);
|
|
1342
|
+
const getValue$1 = (row, col, getCell) => {
|
|
1343
|
+
const cell = getCell(row, col);
|
|
1344
|
+
if (cell && cell.t === CellValueType.NUMBER) {
|
|
1345
|
+
const value = Number(cell.v);
|
|
1346
|
+
return Number.isNaN(value) ? null : value;
|
|
1347
|
+
}
|
|
1348
|
+
return null;
|
|
1349
|
+
};
|
|
1350
|
+
var DataBarCalculateUnit = class extends BaseCalculateUnit {
|
|
1351
|
+
preComputing(row, col, context) {
|
|
1352
|
+
const rule = context.rule;
|
|
1353
|
+
const ruleConfig = rule.rule;
|
|
1354
|
+
const worksheet = context.worksheet;
|
|
1355
|
+
const matrix = new ObjectMatrix();
|
|
1356
|
+
if (![rule.rule.config.max, rule.rule.config.min].every((e) => e.type === "num")) filterRange(rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
|
|
1357
|
+
Range.foreach(range, (row, col) => {
|
|
1358
|
+
const cell = context.getCellValue(row, col);
|
|
1359
|
+
const v = cell && cell.v;
|
|
1360
|
+
if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === CellValueType.NUMBER) {
|
|
1361
|
+
const _value = Number(v);
|
|
1362
|
+
!Number.isNaN(_value) && matrix.setValue(row, col, _value);
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
const _min = getValueByType(ruleConfig.config.min, matrix, {
|
|
1367
|
+
...context,
|
|
1368
|
+
cfId: rule.cfId
|
|
1369
|
+
});
|
|
1370
|
+
const _max = getValueByType(ruleConfig.config.max, matrix, {
|
|
1371
|
+
...context,
|
|
1372
|
+
cfId: rule.cfId
|
|
1373
|
+
});
|
|
1374
|
+
let min = 0;
|
|
1375
|
+
let max = 0;
|
|
1376
|
+
if (_min.status === FormulaResultStatus.SUCCESS) {
|
|
1377
|
+
const v = Number(_min.result);
|
|
1378
|
+
min = Number.isNaN(v) ? 0 : v;
|
|
1379
|
+
} else {
|
|
1380
|
+
this._preComputingStatus$.next("preComputing");
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
if (_max.status === FormulaResultStatus.SUCCESS) {
|
|
1384
|
+
const maxResult = Number(_max.result);
|
|
1385
|
+
const v = Number.isNaN(maxResult) ? 0 : maxResult;
|
|
1386
|
+
max = Math.max(v, min);
|
|
1387
|
+
min = Math.min(v, min);
|
|
1388
|
+
let startPoint = 50;
|
|
1389
|
+
if (min < 0 && max <= 0) startPoint = 100;
|
|
1390
|
+
else if (min < 0 && max > 0) {
|
|
1391
|
+
const length = Math.abs(max) + Math.abs(min);
|
|
1392
|
+
startPoint = Math.abs(min) / length * 100;
|
|
1393
|
+
} else if (min >= 0 && max > 0) startPoint = 0;
|
|
1394
|
+
this.setPreComputingCache({
|
|
1395
|
+
min,
|
|
1396
|
+
max,
|
|
1397
|
+
startPoint
|
|
1398
|
+
});
|
|
1399
|
+
this._preComputingStatus$.next("preComputingEnd");
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
this._preComputingStatus$.next("preComputing");
|
|
1403
|
+
}
|
|
1404
|
+
getCellResult(row, col, preComputingResult, context) {
|
|
1405
|
+
const { min, max, startPoint } = preComputingResult;
|
|
1406
|
+
const ruleConfig = context.rule.rule;
|
|
1407
|
+
const isShowValue = ruleConfig.isShowValue;
|
|
1408
|
+
const isGradient = ruleConfig.config.isGradient;
|
|
1409
|
+
const value = getValue$1(row, col, context.getCellValue);
|
|
1410
|
+
if (value === null || value < min || min === max || max < min) return;
|
|
1411
|
+
if (value === 0) return {
|
|
1412
|
+
color: defaultPlaceholderColor,
|
|
1413
|
+
startPoint,
|
|
1414
|
+
value: 0,
|
|
1415
|
+
isGradient,
|
|
1416
|
+
isShowValue
|
|
1417
|
+
};
|
|
1418
|
+
if (min < 0 && max <= 0) {
|
|
1419
|
+
const length = max - min;
|
|
1420
|
+
const v = getSafeValue((max - value) / length * 100);
|
|
1421
|
+
if (v === 0) return;
|
|
1422
|
+
return {
|
|
1423
|
+
color: ruleConfig.config.nativeColor || "#abd91a",
|
|
1424
|
+
startPoint,
|
|
1425
|
+
value: -v,
|
|
1426
|
+
isGradient,
|
|
1427
|
+
isShowValue
|
|
1428
|
+
};
|
|
1429
|
+
} else if (min < 0 && max > 0) {
|
|
1430
|
+
if (value > 0) {
|
|
1431
|
+
const v = getSafeValue(Math.min(value / max, 1) * 100);
|
|
1432
|
+
if (v === 0) return;
|
|
1433
|
+
return {
|
|
1434
|
+
color: ruleConfig.config.positiveColor || "#ffbe38",
|
|
1435
|
+
startPoint,
|
|
1436
|
+
value: v,
|
|
1437
|
+
isGradient,
|
|
1438
|
+
isShowValue
|
|
1439
|
+
};
|
|
1440
|
+
} else {
|
|
1441
|
+
const v = getSafeValue(Math.min(Math.abs(value) / Math.abs(min), 1) * 100);
|
|
1442
|
+
if (v === 0) return;
|
|
1443
|
+
return {
|
|
1444
|
+
color: ruleConfig.config.nativeColor || "#abd91a",
|
|
1445
|
+
startPoint,
|
|
1446
|
+
value: -v,
|
|
1447
|
+
isGradient,
|
|
1448
|
+
isShowValue
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
} else if (min >= 0 && max > 0) {
|
|
1452
|
+
const length = max - min;
|
|
1453
|
+
const startPoint = 0;
|
|
1454
|
+
const v = getSafeValue((1 - (max - value) / length) * 100);
|
|
1455
|
+
if (v === 0) return;
|
|
1456
|
+
return {
|
|
1457
|
+
color: ruleConfig.config.positiveColor || "#ffbe38",
|
|
1458
|
+
startPoint,
|
|
1459
|
+
value: v,
|
|
1460
|
+
isGradient,
|
|
1461
|
+
isShowValue
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
//#endregion
|
|
1468
|
+
//#region src/models/calculate-unit-v2/highlight-cell-calculate-unit.ts
|
|
1469
|
+
const isFormulaResultMatched = (value) => value === true || value === 1 || value === "TRUE";
|
|
1470
|
+
const sortRangesByTopLeft = (ranges) => [...ranges].sort((a, b) => {
|
|
1471
|
+
if (a.startRow !== b.startRow) return a.startRow - b.startRow;
|
|
1472
|
+
return a.startColumn - b.startColumn;
|
|
1473
|
+
});
|
|
1474
|
+
var HighlightCellCalculateUnit = class extends BaseCalculateUnit {
|
|
1475
|
+
preComputing(row, col, context) {
|
|
1476
|
+
const ruleConfig = context.rule.rule;
|
|
1477
|
+
const ranges = filterRange(context.rule.ranges, context.worksheet.getMaxRows() - 1, context.worksheet.getMaxColumns() - 1);
|
|
1478
|
+
const getCache = () => {
|
|
1479
|
+
switch (ruleConfig.subType) {
|
|
1480
|
+
case "average": {
|
|
1481
|
+
let sum = 0;
|
|
1482
|
+
let count = 0;
|
|
1483
|
+
ranges.forEach((range) => {
|
|
1484
|
+
Range.foreach(range, (row, col) => {
|
|
1485
|
+
const cell = context.getCellValue(row, col);
|
|
1486
|
+
const v = getCellValue(cell);
|
|
1487
|
+
if (cell && cell.t === CellValueType.NUMBER && !isNullable(v)) {
|
|
1488
|
+
sum += Number(v) || 0;
|
|
1489
|
+
count++;
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
return {
|
|
1494
|
+
value: sum / count,
|
|
1495
|
+
type: ruleConfig.subType
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
case "uniqueValues":
|
|
1499
|
+
case "duplicateValues": {
|
|
1500
|
+
const cacheMap = /* @__PURE__ */ new Map();
|
|
1501
|
+
ranges.forEach((range) => {
|
|
1502
|
+
Range.foreach(range, (row, col) => {
|
|
1503
|
+
const cell = context.getCellValue(row, col);
|
|
1504
|
+
const v = getCellValue(cell);
|
|
1505
|
+
if (!isNullable(v)) {
|
|
1506
|
+
const cache = cacheMap.get(v);
|
|
1507
|
+
if (cache) cacheMap.set(v, cache + 1);
|
|
1508
|
+
else cacheMap.set(v, 1);
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
});
|
|
1512
|
+
return {
|
|
1513
|
+
value: cacheMap,
|
|
1514
|
+
type: ruleConfig.subType
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
case "rank": {
|
|
1518
|
+
let allValue = [];
|
|
1519
|
+
ranges.forEach((range) => {
|
|
1520
|
+
Range.foreach(range, (row, col) => {
|
|
1521
|
+
const cell = context.getCellValue(row, col);
|
|
1522
|
+
const v = getCellValue(cell);
|
|
1523
|
+
if (cell && cell.t === CellValueType.NUMBER && !isNullable(v)) allValue.push(Number(v) || 0);
|
|
1524
|
+
});
|
|
1525
|
+
});
|
|
1526
|
+
allValue.sort((a, b) => b - a);
|
|
1527
|
+
const configRule = context.rule.rule;
|
|
1528
|
+
if (configRule.isPercent) {
|
|
1529
|
+
if (configRule.isBottom) allValue = allValue.slice().reverse();
|
|
1530
|
+
const threshold = Tools.clamp(configRule.value, 0, 100) / 100;
|
|
1531
|
+
const targetIndex = Math.floor(threshold * allValue.length);
|
|
1532
|
+
const safeIndex = Tools.clamp(targetIndex - 1, 0, allValue.length - 1);
|
|
1533
|
+
return {
|
|
1534
|
+
value: allValue[safeIndex],
|
|
1535
|
+
type: ruleConfig.subType
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
const targetIndex = Math.floor(Tools.clamp(configRule.isBottom ? configRule.value - 1 : configRule.value, 0, allValue.length));
|
|
1539
|
+
if (configRule.isBottom) return {
|
|
1540
|
+
value: allValue[allValue.length - targetIndex - 1],
|
|
1541
|
+
type: ruleConfig.subType
|
|
1542
|
+
};
|
|
1543
|
+
else return {
|
|
1544
|
+
value: allValue[Math.max(targetIndex - 1, 0)],
|
|
1545
|
+
type: ruleConfig.subType
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
case "formula": {
|
|
1549
|
+
const _ruleConfig = ruleConfig;
|
|
1550
|
+
const conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService);
|
|
1551
|
+
const normalizedRanges = sortRangesByTopLeft(context.rule.ranges);
|
|
1552
|
+
conditionalFormattingFormulaService.registerFormulaWithRange(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, normalizedRanges);
|
|
1553
|
+
const result = conditionalFormattingFormulaService.getFormulaMatrix(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value);
|
|
1554
|
+
if (result && result.status === FormulaResultStatus.SUCCESS) {
|
|
1555
|
+
this._preComputingStatus$.next("preComputingEnd");
|
|
1556
|
+
return {
|
|
1557
|
+
value: result.result,
|
|
1558
|
+
type: ruleConfig.subType
|
|
1559
|
+
};
|
|
1560
|
+
} else this._preComputingStatus$.next("preComputing");
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
case "timePeriod": switch (ruleConfig.operator) {
|
|
1564
|
+
case "last7Days": {
|
|
1565
|
+
const today = dateKit().startOf("day");
|
|
1566
|
+
return {
|
|
1567
|
+
value: {
|
|
1568
|
+
start: today.subtract(6, "day").valueOf(),
|
|
1569
|
+
end: today.endOf("day").valueOf()
|
|
1570
|
+
},
|
|
1571
|
+
type: ruleConfig.subType
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
case "lastMonth": {
|
|
1575
|
+
const month = dateKit().startOf("month").subtract(1, "month");
|
|
1576
|
+
return {
|
|
1577
|
+
value: {
|
|
1578
|
+
start: month.valueOf(),
|
|
1579
|
+
end: month.endOf("month").valueOf()
|
|
1580
|
+
},
|
|
1581
|
+
type: ruleConfig.subType
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
case "lastWeek": return {
|
|
1585
|
+
value: {
|
|
1586
|
+
start: dateKit().startOf("week").subtract(1, "week").valueOf(),
|
|
1587
|
+
end: dateKit().endOf("week").subtract(1, "week").valueOf()
|
|
1588
|
+
},
|
|
1589
|
+
type: ruleConfig.subType
|
|
1590
|
+
};
|
|
1591
|
+
case "nextMonth": {
|
|
1592
|
+
const month = dateKit().startOf("month").add(1, "month");
|
|
1593
|
+
return {
|
|
1594
|
+
value: {
|
|
1595
|
+
start: month.valueOf(),
|
|
1596
|
+
end: month.endOf("month").valueOf()
|
|
1597
|
+
},
|
|
1598
|
+
type: ruleConfig.subType
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
case "nextWeek": return {
|
|
1602
|
+
value: {
|
|
1603
|
+
start: dateKit().startOf("week").add(1, "week").valueOf(),
|
|
1604
|
+
end: dateKit().endOf("week").add(1, "week").valueOf()
|
|
1605
|
+
},
|
|
1606
|
+
type: ruleConfig.subType
|
|
1607
|
+
};
|
|
1608
|
+
case "thisMonth": return {
|
|
1609
|
+
value: {
|
|
1610
|
+
start: dateKit().startOf("month").valueOf(),
|
|
1611
|
+
end: dateKit().endOf("month").valueOf()
|
|
1612
|
+
},
|
|
1613
|
+
type: ruleConfig.subType
|
|
1614
|
+
};
|
|
1615
|
+
case "thisWeek": return {
|
|
1616
|
+
value: {
|
|
1617
|
+
start: dateKit().startOf("week").valueOf(),
|
|
1618
|
+
end: dateKit().endOf("week").valueOf()
|
|
1619
|
+
},
|
|
1620
|
+
type: ruleConfig.subType
|
|
1621
|
+
};
|
|
1622
|
+
case "today": return {
|
|
1623
|
+
value: {
|
|
1624
|
+
start: dateKit().startOf("day").valueOf(),
|
|
1625
|
+
end: dateKit().endOf("day").valueOf()
|
|
1626
|
+
},
|
|
1627
|
+
type: ruleConfig.subType
|
|
1628
|
+
};
|
|
1629
|
+
case "tomorrow": return {
|
|
1630
|
+
value: {
|
|
1631
|
+
start: dateKit().startOf("day").add(1, "day").valueOf(),
|
|
1632
|
+
end: dateKit().endOf("day").add(1, "day").valueOf()
|
|
1633
|
+
},
|
|
1634
|
+
type: ruleConfig.subType
|
|
1635
|
+
};
|
|
1636
|
+
case "yesterday": return {
|
|
1637
|
+
value: {
|
|
1638
|
+
start: dateKit().startOf("day").subtract(1, "day").valueOf(),
|
|
1639
|
+
end: dateKit().endOf("day").subtract(1, "day").valueOf()
|
|
1640
|
+
},
|
|
1641
|
+
type: ruleConfig.subType
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
const result = getCache();
|
|
1647
|
+
this.setPreComputingCache(result);
|
|
1648
|
+
}
|
|
1649
|
+
getCellResult(row, col, preComputingResult, context) {
|
|
1650
|
+
const cellValue = context.getCellValue(row, col);
|
|
1651
|
+
const ruleConfig = context.rule.rule;
|
|
1652
|
+
const run = () => {
|
|
1653
|
+
switch (ruleConfig.subType) {
|
|
1654
|
+
case "number": {
|
|
1655
|
+
const subRuleConfig = ruleConfig;
|
|
1656
|
+
const value = cellValue === null || cellValue === void 0 ? void 0 : cellValue.v;
|
|
1657
|
+
if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== CellValueType.FORCE_STRING && ERROR_TYPE_SET.has(value)) return false;
|
|
1658
|
+
if (value != null && ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) === CellValueType.BOOLEAN || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== CellValueType.NUMBER && typeof value !== "number")) return [
|
|
1659
|
+
"notEqual",
|
|
1660
|
+
"notBetween",
|
|
1661
|
+
"greaterThan",
|
|
1662
|
+
"greaterThanOrEqual"
|
|
1663
|
+
].includes(subRuleConfig.operator);
|
|
1664
|
+
return compareWithNumber({
|
|
1665
|
+
operator: subRuleConfig.operator,
|
|
1666
|
+
value: subRuleConfig.value ?? 0
|
|
1667
|
+
}, Number(value ?? 0));
|
|
1668
|
+
}
|
|
1669
|
+
case "text": {
|
|
1670
|
+
const subRuleConfig = ruleConfig;
|
|
1671
|
+
const value = getCellValue(cellValue);
|
|
1672
|
+
const v = isNullable(value) ? "" : String(value);
|
|
1673
|
+
const condition = subRuleConfig.value || "";
|
|
1674
|
+
switch (subRuleConfig.operator) {
|
|
1675
|
+
case "beginsWith": return v.startsWith(condition);
|
|
1676
|
+
case "containsBlanks": return /^\s*$/.test(v);
|
|
1677
|
+
case "notContainsBlanks": return !/^\s*$/.test(v);
|
|
1678
|
+
case "containsErrors": return ERROR_TYPE_SET.has(v);
|
|
1679
|
+
case "notContainsErrors": return !ERROR_TYPE_SET.has(v);
|
|
1680
|
+
case "containsText": return v.indexOf(condition) > -1;
|
|
1681
|
+
case "notContainsText": return v.indexOf(condition) === -1;
|
|
1682
|
+
case "endsWith": return v.endsWith(condition);
|
|
1683
|
+
case "equal": return v === condition;
|
|
1684
|
+
case "notEqual": return v !== condition;
|
|
1685
|
+
default: return false;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
case "timePeriod": {
|
|
1689
|
+
const value = getCellValue(cellValue);
|
|
1690
|
+
if (isNullable(value) || Number.isNaN(Number(value)) || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== CellValueType.NUMBER || !preComputingResult) return;
|
|
1691
|
+
const v = serialTimeToTimestamp(Number(value), context.workbook.getDateSystem());
|
|
1692
|
+
const { start, end } = preComputingResult.value;
|
|
1693
|
+
return v >= start && v <= end;
|
|
1694
|
+
}
|
|
1695
|
+
case "average": {
|
|
1696
|
+
const value = cellValue && cellValue.v;
|
|
1697
|
+
const v = Number(value);
|
|
1698
|
+
const isNumber = (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) === CellValueType.NUMBER;
|
|
1699
|
+
const subRuleConfig = ruleConfig;
|
|
1700
|
+
if (!isNumber) {
|
|
1701
|
+
if ("notEqual" === subRuleConfig.operator) return true;
|
|
1702
|
+
return false;
|
|
1703
|
+
}
|
|
1704
|
+
if (isNullable(value) || Number.isNaN(v) || !preComputingResult) return false;
|
|
1705
|
+
const average = preComputingResult.value;
|
|
1706
|
+
switch (subRuleConfig.operator) {
|
|
1707
|
+
case "greaterThan": return v > average;
|
|
1708
|
+
case "greaterThanOrEqual": return v >= average;
|
|
1709
|
+
case "lessThan": return v < average;
|
|
1710
|
+
case "lessThanOrEqual": return v <= average;
|
|
1711
|
+
case "equal": return isFloatsEqual(v, average);
|
|
1712
|
+
case "notEqual": return !isFloatsEqual(v, average);
|
|
1713
|
+
default: return false;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
case "rank": {
|
|
1717
|
+
const value = getCellValue(cellValue);
|
|
1718
|
+
const v = Number(value);
|
|
1719
|
+
if (isNullable(value) || Number.isNaN(v) || (cellValue === null || cellValue === void 0 ? void 0 : cellValue.t) !== CellValueType.NUMBER || !preComputingResult) return false;
|
|
1720
|
+
const targetValue = preComputingResult.value;
|
|
1721
|
+
if (ruleConfig.isBottom) return v <= targetValue;
|
|
1722
|
+
else return v >= targetValue;
|
|
1723
|
+
}
|
|
1724
|
+
case "uniqueValues": {
|
|
1725
|
+
const value = getCellValue(cellValue);
|
|
1726
|
+
if (isNullable(value) || !preComputingResult) return false;
|
|
1727
|
+
return preComputingResult.value.get(value) === 1;
|
|
1728
|
+
}
|
|
1729
|
+
case "duplicateValues": {
|
|
1730
|
+
const value = getCellValue(cellValue);
|
|
1731
|
+
if (isNullable(value) || !preComputingResult) return false;
|
|
1732
|
+
const uniqueCacheValue = preComputingResult.value.get(value);
|
|
1733
|
+
return uniqueCacheValue && uniqueCacheValue !== 1;
|
|
1734
|
+
}
|
|
1735
|
+
case "formula": {
|
|
1736
|
+
const _ruleConfig = ruleConfig;
|
|
1737
|
+
const conditionalFormattingFormulaService = context.accessor.get(ConditionalFormattingFormulaService);
|
|
1738
|
+
const firstRange = sortRangesByTopLeft(context.rule.ranges)[0];
|
|
1739
|
+
const relativeRow = row - firstRange.startRow;
|
|
1740
|
+
const relativeCol = col - firstRange.startColumn;
|
|
1741
|
+
const formulaResult = conditionalFormattingFormulaService.getFormulaResultWithCoords(context.unitId, context.subUnitId, context.rule.cfId, _ruleConfig.value, relativeRow, relativeCol);
|
|
1742
|
+
if (formulaResult.status === FormulaResultStatus.SUCCESS && formulaResult.result !== void 0) return isFormulaResultMatched(formulaResult.result);
|
|
1743
|
+
const cache = preComputingResult === null || preComputingResult === void 0 ? void 0 : preComputingResult.value;
|
|
1744
|
+
if (cache) {
|
|
1745
|
+
const value = cache.getValue(relativeRow, relativeCol);
|
|
1746
|
+
return isFormulaResultMatched(value);
|
|
1747
|
+
}
|
|
1748
|
+
return false;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
return !!run();
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
//#endregion
|
|
1757
|
+
//#region src/models/calculate-unit-v2/icon-set-calculate-unit.ts
|
|
1758
|
+
const getValue = (row, col, getCell) => {
|
|
1759
|
+
const cell = getCell(row, col);
|
|
1760
|
+
if (cell && cell.t === CellValueType.NUMBER) {
|
|
1761
|
+
const value = Number(cell.v);
|
|
1762
|
+
return Number.isNaN(value) ? null : value;
|
|
1763
|
+
}
|
|
1764
|
+
return null;
|
|
1765
|
+
};
|
|
1766
|
+
var IconSetCalculateUnit = class extends BaseCalculateUnit {
|
|
1767
|
+
preComputing(_row, _col, context) {
|
|
1768
|
+
const ruleConfig = context.rule.rule;
|
|
1769
|
+
const worksheet = context.worksheet;
|
|
1770
|
+
const matrix = new ObjectMatrix();
|
|
1771
|
+
if (!ruleConfig.config.every((e) => e.value.type === "num")) filterRange(context.rule.ranges, worksheet.getMaxRows() - 1, worksheet.getMaxColumns() - 1).forEach((range) => {
|
|
1772
|
+
Range.foreach(range, (row, col) => {
|
|
1773
|
+
const cell = context.getCellValue(row, col);
|
|
1774
|
+
const v = cell && cell.v;
|
|
1775
|
+
if (!isNullable(v) && (cell === null || cell === void 0 ? void 0 : cell.t) === CellValueType.NUMBER) {
|
|
1776
|
+
const _value = Number(v);
|
|
1777
|
+
!Number.isNaN(_value) && matrix.setValue(row, col, _value);
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
});
|
|
1781
|
+
const splitValueResult = ruleConfig.config.map((v) => getValueByType(v.value, matrix, {
|
|
1782
|
+
...context,
|
|
1783
|
+
cfId: context.rule.cfId
|
|
1784
|
+
}));
|
|
1785
|
+
if (!splitValueResult.some((item) => item.status !== FormulaResultStatus.SUCCESS)) {
|
|
1786
|
+
const splitValue = splitValueResult.map((item, index) => ({
|
|
1787
|
+
operator: ruleConfig.config[index].operator,
|
|
1788
|
+
value: Number(item.result) || 0
|
|
1789
|
+
})).reduce((result, cur, index, list) => {
|
|
1790
|
+
const item = ruleConfig.config[index];
|
|
1791
|
+
if (!index || index === list.length - 1) result.push({
|
|
1792
|
+
...cur,
|
|
1793
|
+
iconId: item.iconId,
|
|
1794
|
+
iconType: item.iconType
|
|
1795
|
+
});
|
|
1796
|
+
else {
|
|
1797
|
+
const pre = list[index - 1];
|
|
1798
|
+
if (!compareWithNumber(pre, cur.value)) result.push({
|
|
1799
|
+
...cur,
|
|
1800
|
+
iconId: item.iconId,
|
|
1801
|
+
iconType: item.iconType
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
return result;
|
|
1805
|
+
}, []);
|
|
1806
|
+
this.setPreComputingCache(splitValue);
|
|
1807
|
+
this._preComputingStatus$.next("preComputingEnd");
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
this._preComputingStatus$.next("preComputing");
|
|
1811
|
+
}
|
|
1812
|
+
getCellResult(row, col, preComputingResult, context) {
|
|
1813
|
+
if (!preComputingResult) return null;
|
|
1814
|
+
const value = getValue(row, col, context.getCellValue);
|
|
1815
|
+
if (value === null) return;
|
|
1816
|
+
const ruleConfig = context.rule.rule;
|
|
1817
|
+
const isShowValue = ruleConfig.isShowValue === void 0 ? true : !!ruleConfig.isShowValue;
|
|
1818
|
+
for (let index = 0; index < preComputingResult.length; index++) {
|
|
1819
|
+
const item = preComputingResult[index];
|
|
1820
|
+
const start = { ...item };
|
|
1821
|
+
const end = { ...item };
|
|
1822
|
+
const { iconId, iconType } = item;
|
|
1823
|
+
if (index === 0) {
|
|
1824
|
+
if (compareWithNumber(item, value)) return {
|
|
1825
|
+
iconId,
|
|
1826
|
+
iconType,
|
|
1827
|
+
isShowValue
|
|
1828
|
+
};
|
|
1829
|
+
} else if (index === preComputingResult.length - 1) return {
|
|
1830
|
+
iconId,
|
|
1831
|
+
iconType,
|
|
1832
|
+
isShowValue
|
|
1833
|
+
};
|
|
1834
|
+
else {
|
|
1835
|
+
const pre = preComputingResult[index - 1];
|
|
1836
|
+
end.operator = getOppositeOperator(pre.operator);
|
|
1837
|
+
end.value = pre.value;
|
|
1838
|
+
if (compareWithNumber(start, value) && compareWithNumber(end, value)) return {
|
|
1839
|
+
iconId,
|
|
1840
|
+
iconType,
|
|
1841
|
+
isShowValue
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
//#endregion
|
|
1849
|
+
//#region src/models/conditional-formatting-view-model.ts
|
|
1850
|
+
const CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH = 9e3;
|
|
1851
|
+
let ConditionalFormattingViewModel = class ConditionalFormattingViewModel extends Disposable {
|
|
1852
|
+
constructor(_injector, _conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingFormulaService, _univerInstanceService) {
|
|
1853
|
+
super();
|
|
1854
|
+
this._injector = _injector;
|
|
1855
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
1856
|
+
this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
|
|
1857
|
+
this._conditionalFormattingFormulaService = _conditionalFormattingFormulaService;
|
|
1858
|
+
this._univerInstanceService = _univerInstanceService;
|
|
1859
|
+
_defineProperty(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
|
|
1860
|
+
_defineProperty(this, "_cellCache", new LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
|
|
1861
|
+
_defineProperty(this, "_markDirty$", new Subject());
|
|
1862
|
+
_defineProperty(this, "_cacheClear$", new Subject());
|
|
1863
|
+
_defineProperty(this, "markDirty$", this._markDirty$.asObservable());
|
|
1864
|
+
_defineProperty(this, "cacheClear$", this._cacheClear$.asObservable());
|
|
1865
|
+
_defineProperty(this, "_markRuleDirtyAtOnce", (unitId, subUnitId, cfId, isNeedResetPreComputingCache = true) => {
|
|
1866
|
+
this._cellCache.clear();
|
|
1867
|
+
if (isNeedResetPreComputingCache) {
|
|
1868
|
+
const calculateUnit = this._ensureCalculateUnitManager(unitId, subUnitId).get(cfId);
|
|
1869
|
+
if (calculateUnit) calculateUnit.resetPreComputingCache();
|
|
1870
|
+
}
|
|
1871
|
+
this._markDirty$.next({
|
|
1872
|
+
unitId,
|
|
1873
|
+
subUnitId,
|
|
1874
|
+
cfId
|
|
1875
|
+
});
|
|
1876
|
+
});
|
|
1877
|
+
_defineProperty(this, "markRuleDirty", (() => {
|
|
1878
|
+
const rxItem = new Subject();
|
|
1879
|
+
this.disposeWithMe(rxItem.pipe(bufferTime(100), filter((e) => !!e.length), map((list) => {
|
|
1880
|
+
const set = /* @__PURE__ */ new Set();
|
|
1881
|
+
const result = [];
|
|
1882
|
+
list.forEach((item) => {
|
|
1883
|
+
const kye = `${item.unitId}_${item.subUnitId}_${item.cfId}`;
|
|
1884
|
+
if (set.has(kye)) {
|
|
1885
|
+
if (item.isNeedResetPreComputingCache) {
|
|
1886
|
+
const i = result.find((e) => e.cfId === item.cfId);
|
|
1887
|
+
i.isNeedResetPreComputingCache = true;
|
|
1888
|
+
}
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
set.add(kye);
|
|
1892
|
+
result.push({ ...item });
|
|
1893
|
+
});
|
|
1894
|
+
return result;
|
|
1895
|
+
})).subscribe((list) => {
|
|
1896
|
+
list.forEach((item) => {
|
|
1897
|
+
this._markRuleDirtyAtOnce(item.unitId, item.subUnitId, item.cfId, item.isNeedResetPreComputingCache);
|
|
1898
|
+
});
|
|
1899
|
+
}));
|
|
1900
|
+
return (unitId, subUnitId, cfId, isNeedResetPreComputingCache = true) => {
|
|
1901
|
+
rxItem.next({
|
|
1902
|
+
unitId,
|
|
1903
|
+
subUnitId,
|
|
1904
|
+
cfId,
|
|
1905
|
+
isNeedResetPreComputingCache
|
|
1906
|
+
});
|
|
1907
|
+
};
|
|
1908
|
+
})());
|
|
1909
|
+
this._initRuleListener();
|
|
1910
|
+
this._handleCustomFormulasSeparately();
|
|
1911
|
+
this._initCFFormulaListener();
|
|
1912
|
+
}
|
|
1913
|
+
_initCFFormulaListener() {
|
|
1914
|
+
this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({ unitId, subUnitId, cfId, isAllFinished }) => {
|
|
1915
|
+
if (isAllFinished) this._markRuleDirtyAtOnce(unitId, subUnitId, cfId, isAllFinished);
|
|
1916
|
+
}));
|
|
1917
|
+
}
|
|
1918
|
+
getCellCfs(unitId, subUnitId, row, col) {
|
|
1919
|
+
const key = this._createCacheKey(unitId, subUnitId, row, col);
|
|
1920
|
+
if (this._cellCache.has(key)) return this._cellCache.get(key);
|
|
1921
|
+
const result = this._getCellCfs(unitId, subUnitId, row, col);
|
|
1922
|
+
if (result.length) this._cellCache.set(key, result);
|
|
1923
|
+
return result;
|
|
1924
|
+
}
|
|
1925
|
+
_getCellCfs(unitId, subUnitId, row, col) {
|
|
1926
|
+
const subunitRules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? [];
|
|
1927
|
+
const _calculateUnitManagers = this._ensureCalculateUnitManager(unitId, subUnitId);
|
|
1928
|
+
const list = this._conditionalFormattingRangeIndexModel.getRuleIdsByCell(unitId, subUnitId, row, col);
|
|
1929
|
+
const rules = subunitRules.filter((rule) => list.has(rule.cfId));
|
|
1930
|
+
if (!rules.length) return [];
|
|
1931
|
+
return rules.map((rule) => {
|
|
1932
|
+
const calculateUnit = _calculateUnitManagers.get(rule.cfId);
|
|
1933
|
+
if (!calculateUnit) return null;
|
|
1934
|
+
const result = calculateUnit.getCell(row, col);
|
|
1935
|
+
if (rule.rule.type === "highlightCell") {
|
|
1936
|
+
const matched = result === true;
|
|
1937
|
+
let style = result;
|
|
1938
|
+
if (result != null) style = matched ? rule.rule.style : {};
|
|
1939
|
+
return {
|
|
1940
|
+
cfId: rule.cfId,
|
|
1941
|
+
result: style,
|
|
1942
|
+
matched
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
return {
|
|
1946
|
+
cfId: rule.cfId,
|
|
1947
|
+
result,
|
|
1948
|
+
matched: !!result
|
|
1949
|
+
};
|
|
1950
|
+
}).filter((e) => !!e).map((e, index) => ({
|
|
1951
|
+
...e,
|
|
1952
|
+
priority: index
|
|
1953
|
+
}));
|
|
1954
|
+
}
|
|
1955
|
+
dispose() {
|
|
1956
|
+
this.clearCache();
|
|
1957
|
+
super.dispose();
|
|
1958
|
+
}
|
|
1959
|
+
clearCache() {
|
|
1960
|
+
this._calculateUnitManagers.clear();
|
|
1961
|
+
this._cellCache.clear();
|
|
1962
|
+
this._cacheClear$.next();
|
|
1963
|
+
}
|
|
1964
|
+
_handleCustomFormulasSeparately() {
|
|
1965
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
|
|
1966
|
+
if (e.type === "set") {
|
|
1967
|
+
const { unitId, subUnitId } = e;
|
|
1968
|
+
const oldRule = e.oldRule;
|
|
1969
|
+
if (oldRule.rule.type === "highlightCell" && oldRule.rule.subType === "formula") this._conditionalFormattingFormulaService.deleteCache(unitId, subUnitId, oldRule.cfId);
|
|
1970
|
+
}
|
|
1971
|
+
}));
|
|
1972
|
+
}
|
|
1973
|
+
_initRuleListener() {
|
|
1974
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((e) => {
|
|
1975
|
+
const { unitId, subUnitId, rule } = e;
|
|
1976
|
+
const { cfId, ranges } = rule;
|
|
1977
|
+
const calculateUnitManager = this._ensureCalculateUnitManager(unitId, subUnitId);
|
|
1978
|
+
this.markRuleDirty(unitId, subUnitId, cfId);
|
|
1979
|
+
switch (e.type) {
|
|
1980
|
+
case "add": {
|
|
1981
|
+
const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
|
|
1982
|
+
if (!instance) return;
|
|
1983
|
+
calculateUnitManager.set(rule.cfId, instance);
|
|
1984
|
+
break;
|
|
1985
|
+
}
|
|
1986
|
+
case "delete":
|
|
1987
|
+
calculateUnitManager.delete(rule.cfId);
|
|
1988
|
+
break;
|
|
1989
|
+
case "set": {
|
|
1990
|
+
const oldRule = e.oldRule;
|
|
1991
|
+
if (oldRule.rule.type !== rule.rule.type) {
|
|
1992
|
+
const instance = this._createRuleCalculateUnitInstance(unitId, subUnitId, rule);
|
|
1993
|
+
if (!instance) return;
|
|
1994
|
+
calculateUnitManager.delete(oldRule.cfId);
|
|
1995
|
+
calculateUnitManager.set(rule.cfId, instance);
|
|
1996
|
+
} else {
|
|
1997
|
+
const instance = calculateUnitManager.get(oldRule.cfId);
|
|
1998
|
+
if (!instance) return;
|
|
1999
|
+
instance.updateRule(rule);
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}));
|
|
2004
|
+
}
|
|
2005
|
+
_ensureCalculateUnitManager(unitId, subUnitId) {
|
|
2006
|
+
let unitMap = this._calculateUnitManagers.get(unitId);
|
|
2007
|
+
if (!unitMap) {
|
|
2008
|
+
unitMap = /* @__PURE__ */ new Map();
|
|
2009
|
+
this._calculateUnitManagers.set(unitId, unitMap);
|
|
2010
|
+
}
|
|
2011
|
+
let subUnitMap = unitMap.get(subUnitId);
|
|
2012
|
+
if (!subUnitMap) {
|
|
2013
|
+
subUnitMap = /* @__PURE__ */ new Map();
|
|
2014
|
+
unitMap.set(subUnitId, subUnitMap);
|
|
2015
|
+
}
|
|
2016
|
+
return subUnitMap;
|
|
2017
|
+
}
|
|
2018
|
+
_createRuleCalculateUnitInstance(unitId, subUnitId, rule) {
|
|
2019
|
+
const workbook = this._univerInstanceService.getUnit(unitId);
|
|
2020
|
+
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
2021
|
+
if (!workbook || !worksheet) return;
|
|
2022
|
+
const context = {
|
|
2023
|
+
workbook,
|
|
2024
|
+
worksheet,
|
|
2025
|
+
unitId,
|
|
2026
|
+
subUnitId,
|
|
2027
|
+
accessor: this._injector,
|
|
2028
|
+
rule,
|
|
2029
|
+
limit: CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
|
|
2030
|
+
getCellValue: (row, col) => worksheet.getCellRaw(row, col) || {}
|
|
2031
|
+
};
|
|
2032
|
+
switch (rule.rule.type) {
|
|
2033
|
+
case "colorScale": return new ColorScaleCalculateUnit(context);
|
|
2034
|
+
case "dataBar": return new DataBarCalculateUnit(context);
|
|
2035
|
+
case "highlightCell": return new HighlightCellCalculateUnit(context);
|
|
2036
|
+
case "iconSet": return new IconSetCalculateUnit(context);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
_createCacheKey(unitId, subUnitId, row, col) {
|
|
2040
|
+
return `${unitId}_${subUnitId}_${row}_${col}`;
|
|
2041
|
+
}
|
|
2042
|
+
setCacheLength(length = CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH) {
|
|
2043
|
+
if (this._cellCache.limit === length) return;
|
|
2044
|
+
this._cellCache.limit = length;
|
|
2045
|
+
this._calculateUnitManagers.forEach((subunitMap) => {
|
|
2046
|
+
subunitMap.forEach((unitMap) => {
|
|
2047
|
+
unitMap.forEach((unit) => {
|
|
2048
|
+
unit.setCacheLength(length);
|
|
2049
|
+
});
|
|
2050
|
+
});
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
ConditionalFormattingViewModel = __decorate([
|
|
2055
|
+
__decorateParam(0, Inject(Injector)),
|
|
2056
|
+
__decorateParam(1, Inject(ConditionalFormattingRuleModel)),
|
|
2057
|
+
__decorateParam(2, Inject(ConditionalFormattingRangeIndexModel)),
|
|
2058
|
+
__decorateParam(3, Inject(ConditionalFormattingFormulaService)),
|
|
2059
|
+
__decorateParam(4, IUniverInstanceService)
|
|
2060
|
+
], ConditionalFormattingViewModel);
|
|
2061
|
+
|
|
2062
|
+
//#endregion
|
|
2063
|
+
//#region src/models/calculate-unit-v2/utils.ts
|
|
2064
|
+
function isFloatsEqual(a, b) {
|
|
2065
|
+
return Math.abs(a - b) < Number.EPSILON;
|
|
2066
|
+
}
|
|
2067
|
+
const isNullable = (v) => v === null || v === void 0 || typeof v === "string" && v.trim() === "";
|
|
2068
|
+
const getCellValue = (cell) => {
|
|
2069
|
+
var _cell$p;
|
|
2070
|
+
if (!cell) return null;
|
|
2071
|
+
if (cell.t === CellValueType.BOOLEAN) return cell.v === BooleanNumber.TRUE ? BooleanValue.TRUE : BooleanValue.FALSE;
|
|
2072
|
+
const v = cell.v;
|
|
2073
|
+
const dataStream = (_cell$p = cell.p) === null || _cell$p === void 0 || (_cell$p = _cell$p.body) === null || _cell$p === void 0 ? void 0 : _cell$p.dataStream.replace(/\r\n$/, "");
|
|
2074
|
+
return !isNullable(v) ? v : !isNullable(dataStream) ? dataStream : null;
|
|
2075
|
+
};
|
|
2076
|
+
const serialTimeToTimestamp = (value, dateSystem = DateSystem.Date1900) => {
|
|
2077
|
+
const utcDate = excelSerialToDateTime(value, dateSystem);
|
|
2078
|
+
if (Number.isNaN(utcDate.getTime())) return NaN;
|
|
2079
|
+
return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate(), utcDate.getUTCHours(), utcDate.getUTCMinutes(), utcDate.getUTCSeconds(), utcDate.getUTCMilliseconds()).getTime();
|
|
2080
|
+
};
|
|
2081
|
+
const getValueByType = (value, matrix, context) => {
|
|
2082
|
+
switch (value.type) {
|
|
2083
|
+
case "max": {
|
|
2084
|
+
let max = 0;
|
|
2085
|
+
matrix.forValue((row, col, value) => {
|
|
2086
|
+
if (value > max) max = value;
|
|
2087
|
+
});
|
|
2088
|
+
return {
|
|
2089
|
+
status: FormulaResultStatus.SUCCESS,
|
|
2090
|
+
result: max
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
case "min": {
|
|
2094
|
+
let min;
|
|
2095
|
+
matrix.forValue((row, col, value) => {
|
|
2096
|
+
if (min === void 0) min = value;
|
|
2097
|
+
if (value < min) min = value;
|
|
2098
|
+
});
|
|
2099
|
+
return {
|
|
2100
|
+
status: FormulaResultStatus.SUCCESS,
|
|
2101
|
+
result: min
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
case "percent": {
|
|
2105
|
+
let max;
|
|
2106
|
+
let min;
|
|
2107
|
+
matrix.forValue((row, col, value) => {
|
|
2108
|
+
if (max === void 0 || min === void 0) {
|
|
2109
|
+
max = value;
|
|
2110
|
+
min = value;
|
|
2111
|
+
}
|
|
2112
|
+
if (value > max) max = value;
|
|
2113
|
+
if (value < min) min = value;
|
|
2114
|
+
});
|
|
2115
|
+
const length = (max || 0) - (min || 0);
|
|
2116
|
+
const v = Math.max(Math.min(Number(value.value) || 0, 100), 0);
|
|
2117
|
+
return {
|
|
2118
|
+
status: FormulaResultStatus.SUCCESS,
|
|
2119
|
+
result: length * (v / 100) + (min || 0)
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
case "percentile": {
|
|
2123
|
+
const list = matrix.toNativeArray().sort((a, b) => a - b);
|
|
2124
|
+
const v = Math.max(Math.min(Number(value.value) || 0, 100), 0);
|
|
2125
|
+
const index = (list.length - 1) * v / 100;
|
|
2126
|
+
const intIndex = Math.floor(index);
|
|
2127
|
+
const decimalIndex = index - intIndex;
|
|
2128
|
+
const result = list[intIndex] + (list[Math.min(intIndex + 1, list.length - 1)] - list[intIndex]) * decimalIndex;
|
|
2129
|
+
return {
|
|
2130
|
+
status: FormulaResultStatus.SUCCESS,
|
|
2131
|
+
result
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
case "formula": {
|
|
2135
|
+
const { accessor, unitId, subUnitId, cfId } = context;
|
|
2136
|
+
const formulaText = String(value.value);
|
|
2137
|
+
const conditionalFormattingFormulaService = accessor.get(ConditionalFormattingFormulaService);
|
|
2138
|
+
conditionalFormattingFormulaService.registerFormulaWithRange(unitId, subUnitId, cfId, formulaText);
|
|
2139
|
+
return conditionalFormattingFormulaService.getFormulaResultWithCoords(unitId, subUnitId, cfId, formulaText);
|
|
2140
|
+
}
|
|
2141
|
+
case "num":
|
|
2142
|
+
default: {
|
|
2143
|
+
const v = Number(value.value);
|
|
2144
|
+
return {
|
|
2145
|
+
status: FormulaResultStatus.SUCCESS,
|
|
2146
|
+
result: Number.isNaN(v) ? 0 : v
|
|
2147
|
+
};
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2151
|
+
const getCacheStyleMatrix = (unitId, subUnitId, rule, context) => {
|
|
2152
|
+
const { accessor } = context;
|
|
2153
|
+
const conditionalFormattingViewModel = accessor.get(ConditionalFormattingViewModel);
|
|
2154
|
+
const matrix = new ObjectMatrix();
|
|
2155
|
+
getRangesInWorksheet(rule.ranges, context.worksheet).forEach((range) => {
|
|
2156
|
+
Range.foreach(range, (row, col) => {
|
|
2157
|
+
const cellCfItem = conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2158
|
+
if (cellCfItem) {
|
|
2159
|
+
const item = cellCfItem.find((item) => item.cfId === rule.cfId);
|
|
2160
|
+
item !== null && item !== void 0 && item.result && matrix.setValue(row, col, item.result);
|
|
2161
|
+
}
|
|
2162
|
+
});
|
|
2163
|
+
});
|
|
2164
|
+
return matrix;
|
|
2165
|
+
};
|
|
2166
|
+
const compareWithNumber = (config, v) => {
|
|
2167
|
+
switch (config.operator) {
|
|
2168
|
+
case "between": {
|
|
2169
|
+
if (typeof config.value !== "object" || !config.value.length) return;
|
|
2170
|
+
const start = Math.min(...config.value);
|
|
2171
|
+
const end = Math.max(...config.value);
|
|
2172
|
+
return v >= start && v <= end;
|
|
2173
|
+
}
|
|
2174
|
+
case "notBetween": {
|
|
2175
|
+
if (typeof config.value !== "object" || !config.value.length) return;
|
|
2176
|
+
const start = Math.min(...config.value);
|
|
2177
|
+
const end = Math.max(...config.value);
|
|
2178
|
+
return !(v >= start && v <= end);
|
|
2179
|
+
}
|
|
2180
|
+
case "equal": return isFloatsEqual(config.value || 0, v);
|
|
2181
|
+
case "notEqual": return !isFloatsEqual(config.value || 0, v);
|
|
2182
|
+
case "greaterThan": return v > (config.value || 0);
|
|
2183
|
+
case "greaterThanOrEqual": return v >= (config.value || 0);
|
|
2184
|
+
case "lessThan": return v < (config.value || 0);
|
|
2185
|
+
case "lessThanOrEqual": return v <= (config.value || 0);
|
|
2186
|
+
default: return false;
|
|
2187
|
+
}
|
|
2188
|
+
};
|
|
2189
|
+
const getOppositeOperator = (operator) => {
|
|
2190
|
+
switch (operator) {
|
|
2191
|
+
case "greaterThan": return "lessThanOrEqual";
|
|
2192
|
+
case "greaterThanOrEqual": return "lessThan";
|
|
2193
|
+
case "lessThan": return "greaterThanOrEqual";
|
|
2194
|
+
case "lessThanOrEqual": return "greaterThan";
|
|
2195
|
+
}
|
|
2196
|
+
return operator;
|
|
2197
|
+
};
|
|
2198
|
+
const getColorScaleFromValue = (colorList, value) => {
|
|
2199
|
+
const prefixRgba = (rgb) => {
|
|
2200
|
+
if (rgb.a !== void 0) return rgb;
|
|
2201
|
+
else return {
|
|
2202
|
+
...rgb,
|
|
2203
|
+
a: 1
|
|
2204
|
+
};
|
|
2205
|
+
};
|
|
2206
|
+
const index = colorList.findIndex((item) => item.value >= value);
|
|
2207
|
+
const preIndex = index - 1;
|
|
2208
|
+
if (index === 0) return colorList[0].color.toRgbString();
|
|
2209
|
+
else if (preIndex >= 0) {
|
|
2210
|
+
const minItem = colorList[preIndex];
|
|
2211
|
+
const maxItem = colorList[index];
|
|
2212
|
+
if (minItem.color.isValid && maxItem.color.isValid) {
|
|
2213
|
+
const minRgb = prefixRgba(minItem.color.toRgb());
|
|
2214
|
+
const maxRgb = prefixRgba(maxItem.color.toRgb());
|
|
2215
|
+
const length = maxItem.value - minItem.value;
|
|
2216
|
+
const v = (value - minItem.value) / length;
|
|
2217
|
+
const rgbResult = [
|
|
2218
|
+
"r",
|
|
2219
|
+
"g",
|
|
2220
|
+
"b",
|
|
2221
|
+
"a"
|
|
2222
|
+
].reduce((obj, key) => {
|
|
2223
|
+
const minV = minRgb[key];
|
|
2224
|
+
obj[key] = (maxRgb[key] - minV) * v + minV;
|
|
2225
|
+
return obj;
|
|
2226
|
+
}, {});
|
|
2227
|
+
return new ColorKit(rgbResult).toRgbString();
|
|
2228
|
+
}
|
|
2229
|
+
} else return colorList[colorList.length - 1].color.toRgbString();
|
|
2230
|
+
};
|
|
2231
|
+
const filterRange = (ranges, maxRow, maxCol) => {
|
|
2232
|
+
return ranges.map((range) => {
|
|
2233
|
+
if (range.startColumn > maxCol || range.startRow > maxRow || range.endColumn < 0 || range.endRow < 0) return null;
|
|
2234
|
+
const _range = { ...range };
|
|
2235
|
+
_range.startRow = Math.max(_range.startRow, 0);
|
|
2236
|
+
_range.startColumn = Math.max(_range.startColumn, 0);
|
|
2237
|
+
_range.endRow = Math.min(_range.endRow, maxRow);
|
|
2238
|
+
_range.endColumn = Math.min(_range.endColumn, maxCol);
|
|
2239
|
+
if (_range.startRow > _range.endRow || _range.startColumn > _range.endColumn) return null;
|
|
2240
|
+
return _range;
|
|
2241
|
+
}).filter((range) => !!range);
|
|
2242
|
+
};
|
|
2243
|
+
function getMaxInFormulaResult(result) {
|
|
2244
|
+
let max = 0;
|
|
2245
|
+
new ObjectMatrix(result).forValue((row, col, value) => {
|
|
2246
|
+
max = Math.max(Number.isNaN(max) ? 0 : max, Number(value));
|
|
2247
|
+
});
|
|
2248
|
+
return max;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
//#endregion
|
|
2252
|
+
//#region src/assets/icon-map.ts
|
|
2253
|
+
const ICON_MAP = {
|
|
2254
|
+
"feedback": {
|
|
2255
|
+
"mistake": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20d%3D%22M5.69014%205.69014C5.45583%205.92445%205.45583%206.30435%205.69014%206.53867L7.15137%207.9999L5.6899%209.46137C5.45558%209.69569%205.45558%2010.0756%205.6899%2010.3099C5.92421%2010.5442%206.30411%2010.5442%206.53842%2010.3099L7.9999%208.84843L9.46137%2010.3099C9.69569%2010.5442%2010.0756%2010.5442%2010.3099%2010.3099C10.5442%2010.0756%2010.5442%209.69569%2010.3099%209.46137L8.84843%207.9999L10.3097%206.53867C10.544%206.30435%2010.544%205.92445%2010.3097%205.69014C10.0753%205.45583%209.69544%205.45583%209.46113%205.69014L7.9999%207.15137L6.53867%205.69014C6.30435%205.45583%205.92445%205.45583%205.69014%205.69014Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2256
|
+
"warn": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M7.4%204.4335C7.4%204.10213%207.66863%203.8335%208%203.8335C8.33137%203.8335%208.6%204.10213%208.6%204.4335V9.36683C8.6%209.6982%208.33137%209.96683%208%209.96683C7.66863%209.96683%207.4%209.6982%207.4%209.36683V4.4335Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%2211.5338%22%20r%3D%220.83333%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2257
|
+
"correct": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M11.7245%205.57564C11.4901%205.34132%2011.1102%205.34132%2010.8759%205.57564L7.3002%209.15137L5.72446%207.57564C5.49014%207.34132%205.11025%207.34132%204.87593%207.57564C4.64162%207.80995%204.64162%208.18985%204.87593%208.42417L6.87593%2010.4242C7.11025%2010.6585%207.49014%2010.6585%207.72446%2010.4242L11.7245%206.42417C11.9588%206.18985%2011.9588%205.80995%2011.7245%205.57564Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2258
|
+
},
|
|
2259
|
+
"star": {
|
|
2260
|
+
"starEmpty": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2261
|
+
"starIncomplete": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Cmask%20id%3D%22star-incomplete-mask%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%228%22%20height%3D%2216%22%3E%0A%3Crect%20width%3D%228%22%20height%3D%2216%22%20fill%3D%22white%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23star-incomplete-mask)%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",
|
|
2262
|
+
"starFull": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8%201.8L9.73075%205.30631L13.6%205.86863L10.8%208.59897L11.4615%2012.4526L8%2010.632L4.53853%2012.4526L5.2%208.59897L2.4%205.86863L6.26927%205.30631L8%201.8Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2263
|
+
},
|
|
2264
|
+
"progress": {
|
|
2265
|
+
"progress0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2266
|
+
"progress25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208H8V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2267
|
+
"progress50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208C14.5%2011.5899%2011.5899%2014.5%208%2014.5V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2268
|
+
"progress75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Cpath%20d%3D%22M8%201.5C11.5899%201.5%2014.5%204.41015%2014.5%208C14.5%2011.5899%2011.5899%2014.5%208%2014.5C4.41015%2014.5%201.5%2011.5899%201.5%208H8V1.5Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2269
|
+
"progress100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.75%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2270
|
+
},
|
|
2271
|
+
"signal": {
|
|
2272
|
+
"signal0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2273
|
+
"signal25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2274
|
+
"signal50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2275
|
+
"signal75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2276
|
+
"signal100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%221.6%22%20y%3D%2211%22%20width%3D%221.8%22%20height%3D%223%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%225.6%22%20y%3D%228%22%20width%3D%221.8%22%20height%3D%226%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%229.6%22%20y%3D%225%22%20width%3D%221.8%22%20height%3D%229%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2213.6%22%20y%3D%222%22%20width%3D%221.8%22%20height%3D%2212%22%20rx%3D%220.65%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2277
|
+
},
|
|
2278
|
+
"feeling": {
|
|
2279
|
+
"guffaw": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M4.8%209.15C5.25%2011.25%206.5%2012.55%208%2012.55C9.5%2012.55%2010.75%2011.25%2011.2%209.15H4.8Z%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2280
|
+
"smile": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%209.3C5.65%2010.65%206.65%2011.35%208%2011.35C9.35%2011.35%2010.35%2010.65%2011%209.3%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2281
|
+
"noninductive": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Crect%20x%3D%225%22%20y%3D%225.85%22%20width%3D%221.5%22%20height%3D%221.1%22%20rx%3D%220.55%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%229.5%22%20y%3D%225.85%22%20width%3D%221.5%22%20height%3D%221.1%22%20rx%3D%220.55%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5.2%2010.4H10.8%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2282
|
+
"dissatisfied": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%226.3%22%20r%3D%220.75%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%2011C5.65%209.65%206.65%208.95%208%208.95C9.35%208.95%2010.35%209.65%2011%2011%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2283
|
+
"impatient": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.4%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%2F%3E%0A%3Cpath%20d%3D%22M4.9%205.4L6.7%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Cpath%20d%3D%22M11.1%205.4L9.3%206.15%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3Ccircle%20cx%3D%225.75%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Ccircle%20cx%3D%2210.25%22%20cy%3D%227.2%22%20r%3D%220.65%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M5%2011.25C5.7%2010.05%206.7%209.45%208%209.45C9.3%209.45%2010.3%2010.05%2011%2011.25%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%221.2%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2284
|
+
},
|
|
2285
|
+
"arrow": {
|
|
2286
|
+
"down-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2287
|
+
"right-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2288
|
+
"up-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2289
|
+
"rightAndDown-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2290
|
+
"rightAndUp-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2291
|
+
"down-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2292
|
+
"right-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2293
|
+
"up-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2294
|
+
"rightAndDown-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2295
|
+
"rightAndUp-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2296
|
+
},
|
|
2297
|
+
"shape": {
|
|
2298
|
+
"cross": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%227%22%20width%3D%2210%22%20height%3D%222%22%20rx%3D%220.75%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2299
|
+
"up": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.48861%204.23829C7.75558%203.87976%208.29238%203.87976%208.55935%204.23829L12.9614%2010.1507C13.2907%2010.5929%2012.975%2011.2223%2012.4236%2011.2223H3.62432C3.07292%2011.2223%202.75722%2010.5929%203.08649%2010.1507L7.48861%204.23829Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2300
|
+
"down": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.55935%2011.7617C8.29238%2012.1202%207.75558%2012.1202%207.48861%2011.7617L3.08649%205.84931C2.75722%205.40708%203.07292%204.77771%203.62432%204.77771H12.4236C12.975%204.77771%2013.2907%205.40708%2012.9614%205.84931L8.55935%2011.7617Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2301
|
+
"rhomboid-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.57574%201.92426C7.81005%201.68995%208.18995%201.68995%208.42426%201.92426L14.0757%207.57574C14.3101%207.81005%2014.3101%208.18995%2014.0757%208.42426L8.42426%2014.0757C8.18995%2014.3101%207.81005%2014.3101%207.57574%2014.0757L1.92426%208.42426C1.68995%208.18995%201.68995%207.81005%201.92426%207.57574L7.57574%201.92426Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2302
|
+
"rhomboid-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.57574%201.92426C7.81005%201.68995%208.18995%201.68995%208.42426%201.92426L14.0757%207.57574C14.3101%207.81005%2014.3101%208.18995%2014.0757%208.42426L8.42426%2014.0757C8.18995%2014.3101%207.81005%2014.3101%207.57574%2014.0757L1.92426%208.42426C1.68995%208.18995%201.68995%207.81005%201.92426%207.57574L7.57574%201.92426Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2303
|
+
"roundness-greed": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2304
|
+
"roundness-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2305
|
+
"roundness-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2306
|
+
"roundness-pink": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2307
|
+
"roundness-gray": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2308
|
+
"roundness-black": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%226.5%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2309
|
+
"triangle-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.35127%202.31778C7.61335%201.86074%208.27331%201.86074%208.53539%202.31778L14.0808%2011.9898C14.3423%2012.4459%2014.0131%2013.0147%2013.4877%2013.0147H2.399C1.87354%2013.0147%201.54441%2012.4459%201.80595%2011.9898L7.35127%202.31778Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2310
|
+
"indicate-greed": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2311
|
+
"indicate-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2312
|
+
"indicate-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222%22%20y%3D%222%22%20width%3D%2212%22%20height%3D%2212%22%20rx%3D%222.4%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%223.75%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2313
|
+
},
|
|
2314
|
+
"feedback2": {
|
|
2315
|
+
"mistake2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.71274%202.86421C3.47843%202.6299%203.09853%202.6299%202.86421%202.86421C2.6299%203.09853%202.6299%203.47843%202.86421%203.71274L7.15154%208.00007L2.86421%2012.2874C2.6299%2012.5217%202.6299%2012.9016%202.86421%2013.1359C3.09853%2013.3702%203.47843%2013.3702%203.71274%2013.1359L8.00007%208.84859L12.2874%2013.1359C12.5217%2013.3702%2012.9016%2013.3702%2013.1359%2013.1359C13.3702%2012.9016%2013.3702%2012.5217%2013.1359%2012.2874L8.84859%208.00007L13.1359%203.71274C13.3702%203.47843%2013.3702%203.09853%2013.1359%202.86421C12.9016%202.6299%2012.5217%202.6299%2012.2874%202.86421L8.00007%207.15154L3.71274%202.86421Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2316
|
+
"warn2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M7.25%202.5C7.25%202.08579%207.58579%201.75%208%201.75C8.41421%201.75%208.75%202.08579%208.75%202.5V10C8.75%2010.4142%208.41421%2010.75%208%2010.75C7.58579%2010.75%207.25%2010.4142%207.25%2010V2.5Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Ccircle%20cx%3D%228%22%20cy%3D%2213.25%22%20r%3D%221%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2317
|
+
"correct2": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M14.1544%203.75557C14.3887%203.98988%2014.3887%204.36978%2014.1544%204.6041L6.51409%2012.2444C6.40157%2012.3569%206.24896%2012.4201%206.08983%2012.4201C5.9307%2012.4201%205.77808%2012.3569%205.66556%2012.2444L1.84541%208.42425C1.6111%208.18993%201.6111%207.81003%201.84541%207.57572C2.07973%207.34141%202.45963%207.34141%202.69394%207.57572L6.08983%2010.9716L13.3059%203.75557C13.5402%203.52126%2013.9201%203.52126%2014.1544%203.75557Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2318
|
+
},
|
|
2319
|
+
"flag": {
|
|
2320
|
+
"flag-green": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2321
|
+
"flag-gold": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2322
|
+
"flag-red": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M3.25%202.5C3.25%202.08579%203.58579%201.75%204%201.75C4.41421%201.75%204.75%202.08579%204.75%202.5V13.5C4.75%2013.9142%204.41421%2014.25%204%2014.25C3.58579%2014.25%203.25%2013.9142%203.25%2013.5V2.5Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20d%3D%22M4.75%203.088C6.02367%202.7469%207.00972%202.7044%207.8443%202.81465C8.70544%202.92841%209.37774%203.19906%2010.0279%203.46147L10.0668%203.47718C11.004%203.85549%2011.9397%204.21307%2013.4603%203.8373C13.8931%203.73034%2014.3125%204.05801%2014.3125%204.50387V10.1091C14.3125%2010.4232%2014.0992%2010.697%2013.7946%2010.774C11.8986%2011.2535%2010.6411%2010.7813%209.51441%2010.3265L9.47546%2010.3108C8.82531%2010.0484%208.153%209.77774%207.29186%209.66398C6.62487%209.5759%205.84983%209.58567%204.75%209.84134V3.088Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2323
|
+
},
|
|
2324
|
+
"cell": {
|
|
2325
|
+
"cell-0": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2326
|
+
"cell-25": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2327
|
+
"cell-50": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2328
|
+
"cell-75": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%224%22%20height%3D%224%22%20rx%3D%220.8%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A",
|
|
2329
|
+
"cell-100": "data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%229.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%223.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3Crect%20x%3D%229.4%22%20y%3D%223.4%22%20width%3D%223.2%22%20height%3D%223.2%22%20rx%3D%220.55%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.8%22%2F%3E%0A%3C%2Fsvg%3E%0A"
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
|
|
2333
|
+
//#endregion
|
|
2334
|
+
//#region src/models/icon-map.ts
|
|
2335
|
+
let IIconSetType = /* @__PURE__ */ function(IIconSetType) {
|
|
2336
|
+
IIconSetType["threeArrows"] = "3Arrows";
|
|
2337
|
+
IIconSetType["threeArrowsGray"] = "3ArrowsGray";
|
|
2338
|
+
IIconSetType["fourArrows"] = "4Arrows";
|
|
2339
|
+
IIconSetType["fourArrowsGray"] = "4ArrowsGray";
|
|
2340
|
+
IIconSetType["fiveArrows"] = "5Arrows";
|
|
2341
|
+
IIconSetType["fiveArrowsGray"] = "5ArrowsGray";
|
|
2342
|
+
IIconSetType["threeTriangles"] = "3Triangles";
|
|
2343
|
+
IIconSetType["threeTrafficLights1"] = "3TrafficLights1";
|
|
2344
|
+
IIconSetType["threeSigns"] = "3Signs";
|
|
2345
|
+
IIconSetType["threeTrafficLights2"] = "3TrafficLights2";
|
|
2346
|
+
IIconSetType["fourRedToBlack"] = "4RedToBlack";
|
|
2347
|
+
IIconSetType["fourTrafficLights"] = "4TrafficLights";
|
|
2348
|
+
IIconSetType["threeSymbols"] = "3Symbols";
|
|
2349
|
+
IIconSetType["threeSymbols2"] = "3Symbols2";
|
|
2350
|
+
IIconSetType["threeFlags"] = "3Flags";
|
|
2351
|
+
IIconSetType["fourRating"] = "4Rating";
|
|
2352
|
+
IIconSetType["fiveRating"] = "5Rating";
|
|
2353
|
+
IIconSetType["fiveQuarters"] = "5Quarters";
|
|
2354
|
+
IIconSetType["fiveFelling"] = "_5Felling";
|
|
2355
|
+
IIconSetType["fiveBoxes"] = "5Boxes";
|
|
2356
|
+
IIconSetType["threeStars"] = "3Stars";
|
|
2357
|
+
IIconSetType["empty"] = "EMPTY_ICON_TYPE";
|
|
2358
|
+
return IIconSetType;
|
|
2359
|
+
}({});
|
|
2360
|
+
const iconGroup = [
|
|
2361
|
+
{
|
|
2362
|
+
title: "sheets-conditional-formatting.iconSet.direction",
|
|
2363
|
+
group: [
|
|
2364
|
+
{
|
|
2365
|
+
name: "3Arrows",
|
|
2366
|
+
list: [
|
|
2367
|
+
ICON_MAP.arrow["up-green"],
|
|
2368
|
+
ICON_MAP.arrow["right-gold"],
|
|
2369
|
+
ICON_MAP.arrow["down-red"]
|
|
2370
|
+
]
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
name: "3ArrowsGray",
|
|
2374
|
+
list: [
|
|
2375
|
+
ICON_MAP.arrow["up-gray"],
|
|
2376
|
+
ICON_MAP.arrow["right-gray"],
|
|
2377
|
+
ICON_MAP.arrow["down-gray"]
|
|
2378
|
+
]
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
name: "4Arrows",
|
|
2382
|
+
list: [
|
|
2383
|
+
ICON_MAP.arrow["up-green"],
|
|
2384
|
+
ICON_MAP.arrow["rightAndUp-gold"],
|
|
2385
|
+
ICON_MAP.arrow["rightAndDown-gold"],
|
|
2386
|
+
ICON_MAP.arrow["down-red"]
|
|
2387
|
+
]
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
name: "4ArrowsGray",
|
|
2391
|
+
list: [
|
|
2392
|
+
ICON_MAP.arrow["up-gray"],
|
|
2393
|
+
ICON_MAP.arrow["rightAndUp-gray"],
|
|
2394
|
+
ICON_MAP.arrow["rightAndDown-gray"],
|
|
2395
|
+
ICON_MAP.arrow["down-gray"]
|
|
2396
|
+
]
|
|
2397
|
+
},
|
|
2398
|
+
{
|
|
2399
|
+
name: "5Arrows",
|
|
2400
|
+
list: [
|
|
2401
|
+
ICON_MAP.arrow["up-green"],
|
|
2402
|
+
ICON_MAP.arrow["rightAndUp-gold"],
|
|
2403
|
+
ICON_MAP.arrow["right-gold"],
|
|
2404
|
+
ICON_MAP.arrow["rightAndDown-gold"],
|
|
2405
|
+
ICON_MAP.arrow["down-red"]
|
|
2406
|
+
]
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
name: "5ArrowsGray",
|
|
2410
|
+
list: [
|
|
2411
|
+
ICON_MAP.arrow["up-gray"],
|
|
2412
|
+
ICON_MAP.arrow["rightAndUp-gray"],
|
|
2413
|
+
ICON_MAP.arrow["right-gray"],
|
|
2414
|
+
ICON_MAP.arrow["rightAndDown-gray"],
|
|
2415
|
+
ICON_MAP.arrow["down-gray"]
|
|
2416
|
+
]
|
|
2417
|
+
},
|
|
2418
|
+
{
|
|
2419
|
+
name: "3Triangles",
|
|
2420
|
+
list: [
|
|
2421
|
+
ICON_MAP.shape.up,
|
|
2422
|
+
ICON_MAP.shape.cross,
|
|
2423
|
+
ICON_MAP.shape.down
|
|
2424
|
+
]
|
|
2425
|
+
}
|
|
2426
|
+
]
|
|
2427
|
+
},
|
|
2428
|
+
{
|
|
2429
|
+
title: "sheets-conditional-formatting.iconSet.shape",
|
|
2430
|
+
group: [
|
|
2431
|
+
{
|
|
2432
|
+
name: "3TrafficLights1",
|
|
2433
|
+
list: [
|
|
2434
|
+
ICON_MAP.shape["roundness-greed"],
|
|
2435
|
+
ICON_MAP.shape["roundness-gold"],
|
|
2436
|
+
ICON_MAP.shape["roundness-red"]
|
|
2437
|
+
]
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
name: "3Signs",
|
|
2441
|
+
list: [
|
|
2442
|
+
ICON_MAP.shape["roundness-greed"],
|
|
2443
|
+
ICON_MAP.shape["triangle-gold"],
|
|
2444
|
+
ICON_MAP.shape["rhomboid-red"]
|
|
2445
|
+
]
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
name: "3TrafficLights2",
|
|
2449
|
+
list: [
|
|
2450
|
+
ICON_MAP.shape["indicate-greed"],
|
|
2451
|
+
ICON_MAP.shape["indicate-gold"],
|
|
2452
|
+
ICON_MAP.shape["indicate-red"]
|
|
2453
|
+
]
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
name: "4RedToBlack",
|
|
2457
|
+
list: [
|
|
2458
|
+
ICON_MAP.shape["roundness-red"],
|
|
2459
|
+
ICON_MAP.shape["roundness-pink"],
|
|
2460
|
+
ICON_MAP.shape["roundness-gray"],
|
|
2461
|
+
ICON_MAP.shape["roundness-black"]
|
|
2462
|
+
]
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
name: "4TrafficLights",
|
|
2466
|
+
list: [
|
|
2467
|
+
ICON_MAP.shape["roundness-greed"],
|
|
2468
|
+
ICON_MAP.shape["roundness-gold"],
|
|
2469
|
+
ICON_MAP.shape["roundness-red"],
|
|
2470
|
+
ICON_MAP.shape["roundness-black"]
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
]
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
title: "sheets-conditional-formatting.iconSet.mark",
|
|
2477
|
+
group: [
|
|
2478
|
+
{
|
|
2479
|
+
name: "3Symbols",
|
|
2480
|
+
list: [
|
|
2481
|
+
ICON_MAP.feedback.correct,
|
|
2482
|
+
ICON_MAP.feedback.warn,
|
|
2483
|
+
ICON_MAP.feedback.mistake
|
|
2484
|
+
]
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
name: "3Symbols2",
|
|
2488
|
+
list: [
|
|
2489
|
+
ICON_MAP.feedback2.correct2,
|
|
2490
|
+
ICON_MAP.feedback2.warn2,
|
|
2491
|
+
ICON_MAP.feedback2.mistake2
|
|
2492
|
+
]
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
name: "3Flags",
|
|
2496
|
+
list: [
|
|
2497
|
+
ICON_MAP.flag["flag-green"],
|
|
2498
|
+
ICON_MAP.flag["flag-gold"],
|
|
2499
|
+
ICON_MAP.flag["flag-red"]
|
|
2500
|
+
]
|
|
2501
|
+
}
|
|
2502
|
+
]
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
title: "sheets-conditional-formatting.iconSet.rank",
|
|
2506
|
+
group: [
|
|
2507
|
+
{
|
|
2508
|
+
name: "4Rating",
|
|
2509
|
+
list: [
|
|
2510
|
+
ICON_MAP.signal.signal25,
|
|
2511
|
+
ICON_MAP.signal.signal50,
|
|
2512
|
+
ICON_MAP.signal.signal75,
|
|
2513
|
+
ICON_MAP.signal.signal100
|
|
2514
|
+
]
|
|
2515
|
+
},
|
|
2516
|
+
{
|
|
2517
|
+
name: "5Rating",
|
|
2518
|
+
list: [
|
|
2519
|
+
ICON_MAP.signal.signal0,
|
|
2520
|
+
ICON_MAP.signal.signal25,
|
|
2521
|
+
ICON_MAP.signal.signal50,
|
|
2522
|
+
ICON_MAP.signal.signal75,
|
|
2523
|
+
ICON_MAP.signal.signal100
|
|
2524
|
+
]
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
name: "5Quarters",
|
|
2528
|
+
list: [
|
|
2529
|
+
ICON_MAP.progress.progress100,
|
|
2530
|
+
ICON_MAP.progress.progress75,
|
|
2531
|
+
ICON_MAP.progress.progress50,
|
|
2532
|
+
ICON_MAP.progress.progress25,
|
|
2533
|
+
ICON_MAP.progress.progress0
|
|
2534
|
+
]
|
|
2535
|
+
},
|
|
2536
|
+
{
|
|
2537
|
+
name: "_5Felling",
|
|
2538
|
+
list: [
|
|
2539
|
+
ICON_MAP.feeling.guffaw,
|
|
2540
|
+
ICON_MAP.feeling.smile,
|
|
2541
|
+
ICON_MAP.feeling.noninductive,
|
|
2542
|
+
ICON_MAP.feeling.dissatisfied,
|
|
2543
|
+
ICON_MAP.feeling.impatient
|
|
2544
|
+
]
|
|
2545
|
+
},
|
|
2546
|
+
{
|
|
2547
|
+
name: "5Boxes",
|
|
2548
|
+
list: [
|
|
2549
|
+
ICON_MAP.cell["cell-100"],
|
|
2550
|
+
ICON_MAP.cell["cell-75"],
|
|
2551
|
+
ICON_MAP.cell["cell-50"],
|
|
2552
|
+
ICON_MAP.cell["cell-25"],
|
|
2553
|
+
ICON_MAP.cell["cell-0"]
|
|
2554
|
+
]
|
|
2555
|
+
},
|
|
2556
|
+
{
|
|
2557
|
+
name: "3Stars",
|
|
2558
|
+
list: [
|
|
2559
|
+
ICON_MAP.star.starFull,
|
|
2560
|
+
ICON_MAP.star.starIncomplete,
|
|
2561
|
+
ICON_MAP.star.starEmpty
|
|
2562
|
+
]
|
|
2563
|
+
}
|
|
2564
|
+
]
|
|
2565
|
+
}
|
|
2566
|
+
];
|
|
2567
|
+
const iconMap = iconGroup.reduce((result, cur) => {
|
|
2568
|
+
const { group } = cur;
|
|
2569
|
+
for (const v of group) result[v.name] = v.list;
|
|
2570
|
+
return result;
|
|
2571
|
+
}, {});
|
|
2572
|
+
for (const key in iconMap) {
|
|
2573
|
+
const v = iconMap[key];
|
|
2574
|
+
Object.freeze(v);
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
//#endregion
|
|
2578
|
+
//#region package.json
|
|
2579
|
+
var name = "@cool-office/sheets-conditional-formatting";
|
|
2580
|
+
var version = "1.2.0";
|
|
2581
|
+
|
|
2582
|
+
//#endregion
|
|
2583
|
+
//#region src/config/config.ts
|
|
2584
|
+
/**
|
|
2585
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2586
|
+
*
|
|
2587
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2588
|
+
* you may not use this file except in compliance with the License.
|
|
2589
|
+
* You may obtain a copy of the License at
|
|
2590
|
+
*
|
|
2591
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2592
|
+
*
|
|
2593
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2594
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2595
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2596
|
+
* See the License for the specific language governing permissions and
|
|
2597
|
+
* limitations under the License.
|
|
2598
|
+
*/
|
|
2599
|
+
const SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY = "ssheets-conditional-formatting.config";
|
|
2600
|
+
const configSymbol = Symbol(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY);
|
|
2601
|
+
const defaultPluginConfig = {};
|
|
2602
|
+
|
|
2603
|
+
//#endregion
|
|
2604
|
+
//#region src/services/conditional-formatting-style-composer.service.ts
|
|
2605
|
+
/**
|
|
2606
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
2607
|
+
*
|
|
2608
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2609
|
+
* you may not use this file except in compliance with the License.
|
|
2610
|
+
* You may obtain a copy of the License at
|
|
2611
|
+
*
|
|
2612
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2613
|
+
*
|
|
2614
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2615
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2616
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2617
|
+
* See the License for the specific language governing permissions and
|
|
2618
|
+
* limitations under the License.
|
|
2619
|
+
*/
|
|
2620
|
+
let ConditionalFormattingStyleComposer = class ConditionalFormattingStyleComposer extends Disposable {
|
|
2621
|
+
constructor(_conditionalFormattingRuleModel, _conditionalFormattingViewModel) {
|
|
2622
|
+
super();
|
|
2623
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
2624
|
+
this._conditionalFormattingViewModel = _conditionalFormattingViewModel;
|
|
2625
|
+
_defineProperty(this, "_cache", new LRUMap(CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH));
|
|
2626
|
+
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(() => this._cache.clear()));
|
|
2627
|
+
this.disposeWithMe(this._conditionalFormattingViewModel.markDirty$.subscribe(() => this._cache.clear()));
|
|
2628
|
+
this.disposeWithMe(this._conditionalFormattingViewModel.cacheClear$.subscribe(() => this._cache.clear()));
|
|
2629
|
+
}
|
|
2630
|
+
dispose() {
|
|
2631
|
+
this._cache.clear();
|
|
2632
|
+
super.dispose();
|
|
2633
|
+
}
|
|
2634
|
+
composeStyle(unitId, subUnitId, row, col) {
|
|
2635
|
+
const cacheKey = `${unitId}_${subUnitId}_${row}_${col}`;
|
|
2636
|
+
if (this._cache.has(cacheKey)) return this._cache.get(cacheKey) ?? null;
|
|
2637
|
+
const cellCfs = this._conditionalFormattingViewModel.getCellCfs(unitId, subUnitId, row, col);
|
|
2638
|
+
if (!(cellCfs === null || cellCfs === void 0 ? void 0 : cellCfs.length)) {
|
|
2639
|
+
this._cache.set(cacheKey, null);
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
const matchedRules = [];
|
|
2643
|
+
let stopIfTrueIndex = -1;
|
|
2644
|
+
for (const cacheItem of cellCfs) {
|
|
2645
|
+
const rule = this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, cacheItem.cfId);
|
|
2646
|
+
if (!rule) continue;
|
|
2647
|
+
matchedRules.push({
|
|
2648
|
+
rule,
|
|
2649
|
+
cacheItem
|
|
2650
|
+
});
|
|
2651
|
+
if (stopIfTrueIndex === -1 && rule.stopIfTrue && cacheItem.matched) stopIfTrueIndex = matchedRules.length - 1;
|
|
2652
|
+
}
|
|
2653
|
+
if (!matchedRules.length) {
|
|
2654
|
+
this._cache.set(cacheKey, null);
|
|
2655
|
+
return null;
|
|
2656
|
+
}
|
|
2657
|
+
const effectiveRules = stopIfTrueIndex > -1 ? matchedRules.slice(0, stopIfTrueIndex + 1) : matchedRules;
|
|
2658
|
+
const result = {};
|
|
2659
|
+
for (let i = effectiveRules.length - 1; i >= 0; i--) {
|
|
2660
|
+
const { rule, cacheItem } = effectiveRules[i];
|
|
2661
|
+
this._mergeComposeResult(result, rule, cacheItem.result);
|
|
2662
|
+
}
|
|
2663
|
+
this._cache.set(cacheKey, result);
|
|
2664
|
+
return result;
|
|
2665
|
+
}
|
|
2666
|
+
_mergeComposeResult(result, rule, ruleResult) {
|
|
2667
|
+
const type = rule.rule.type;
|
|
2668
|
+
if (type === "highlightCell") {
|
|
2669
|
+
ruleResult && merge(result, { style: ruleResult });
|
|
2670
|
+
return;
|
|
2671
|
+
}
|
|
2672
|
+
if (type === "colorScale") {
|
|
2673
|
+
if (ruleResult && typeof ruleResult === "string") result.style = {
|
|
2674
|
+
...result.style || {},
|
|
2675
|
+
bg: { rgb: ruleResult }
|
|
2676
|
+
};
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
if (type === "dataBar") {
|
|
2680
|
+
const ruleCache = ruleResult;
|
|
2681
|
+
if (ruleCache) {
|
|
2682
|
+
result.dataBar = ruleCache;
|
|
2683
|
+
result.isShowValue = ruleCache.isShowValue;
|
|
2684
|
+
}
|
|
2685
|
+
return;
|
|
2686
|
+
}
|
|
2687
|
+
if (type === "iconSet") {
|
|
2688
|
+
const ruleCache = ruleResult;
|
|
2689
|
+
if (ruleCache) {
|
|
2690
|
+
result.iconSet = ruleCache;
|
|
2691
|
+
result.isShowValue = ruleCache.isShowValue;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
ConditionalFormattingStyleComposer = __decorate([__decorateParam(0, Inject(ConditionalFormattingRuleModel)), __decorateParam(1, Inject(ConditionalFormattingViewModel))], ConditionalFormattingStyleComposer);
|
|
2697
|
+
|
|
2698
|
+
//#endregion
|
|
2699
|
+
//#region src/services/conditional-formatting.service.ts
|
|
2700
|
+
let ConditionalFormattingService = class ConditionalFormattingService extends Disposable {
|
|
2701
|
+
get _conditionalFormattingViewModelV2() {
|
|
2702
|
+
return this._injector.get(ConditionalFormattingViewModel);
|
|
2703
|
+
}
|
|
2704
|
+
constructor(_conditionalFormattingRuleModel, _conditionalFormattingRangeIndexModel, _conditionalFormattingStyleComposer, _injector, _univerInstanceService, _resourceManagerService, _sheetInterceptorService, _commandService) {
|
|
2705
|
+
super();
|
|
2706
|
+
this._conditionalFormattingRuleModel = _conditionalFormattingRuleModel;
|
|
2707
|
+
this._conditionalFormattingRangeIndexModel = _conditionalFormattingRangeIndexModel;
|
|
2708
|
+
this._conditionalFormattingStyleComposer = _conditionalFormattingStyleComposer;
|
|
2709
|
+
this._injector = _injector;
|
|
2710
|
+
this._univerInstanceService = _univerInstanceService;
|
|
2711
|
+
this._resourceManagerService = _resourceManagerService;
|
|
2712
|
+
this._sheetInterceptorService = _sheetInterceptorService;
|
|
2713
|
+
this._commandService = _commandService;
|
|
2714
|
+
this._initCellChange();
|
|
2715
|
+
this._initSnapshot();
|
|
2716
|
+
this._initSheetChange();
|
|
2717
|
+
}
|
|
2718
|
+
composeStyle(unitId, subUnitId, row, col) {
|
|
2719
|
+
return this._conditionalFormattingStyleComposer.composeStyle(unitId, subUnitId, row, col);
|
|
2720
|
+
}
|
|
2721
|
+
_initSnapshot() {
|
|
2722
|
+
const toJson = (unitID) => {
|
|
2723
|
+
const map = this._conditionalFormattingRuleModel.getUnitRules(unitID);
|
|
2724
|
+
const resultMap = {};
|
|
2725
|
+
if (map) {
|
|
2726
|
+
map.forEach((v, key) => {
|
|
2727
|
+
resultMap[key] = v;
|
|
2728
|
+
});
|
|
2729
|
+
return JSON.stringify(resultMap);
|
|
2730
|
+
}
|
|
2731
|
+
return "";
|
|
2732
|
+
};
|
|
2733
|
+
const parseJson = (json) => {
|
|
2734
|
+
if (!json) return {};
|
|
2735
|
+
try {
|
|
2736
|
+
return JSON.parse(json);
|
|
2737
|
+
} catch {
|
|
2738
|
+
return {};
|
|
2739
|
+
}
|
|
2740
|
+
};
|
|
2741
|
+
this.disposeWithMe(this._resourceManagerService.registerPluginResource({
|
|
2742
|
+
pluginName: SHEET_CONDITIONAL_FORMATTING_PLUGIN,
|
|
2743
|
+
businesses: [UniverInstanceType.UNIVER_SHEET],
|
|
2744
|
+
toJson: (unitID) => toJson(unitID),
|
|
2745
|
+
parseJson: (json) => parseJson(json),
|
|
2746
|
+
onUnLoad: (unitID) => {
|
|
2747
|
+
this._conditionalFormattingRuleModel.deleteUnitId(unitID);
|
|
2748
|
+
this._conditionalFormattingRangeIndexModel.rebuild();
|
|
2749
|
+
if (isInternalEditorID(unitID)) return;
|
|
2750
|
+
this._conditionalFormattingViewModelV2.clearCache();
|
|
2751
|
+
},
|
|
2752
|
+
onLoad: (unitID, value) => {
|
|
2753
|
+
Object.keys(value).forEach((subunitId) => {
|
|
2754
|
+
[...value[subunitId]].reverse().forEach((rule) => {
|
|
2755
|
+
this._conditionalFormattingRuleModel.addRule(unitID, subunitId, rule);
|
|
2756
|
+
});
|
|
2757
|
+
});
|
|
2758
|
+
}
|
|
2759
|
+
}));
|
|
2760
|
+
}
|
|
2761
|
+
_initSheetChange() {
|
|
2762
|
+
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({ getMutations: (commandInfo) => {
|
|
2763
|
+
if (commandInfo.id === RemoveSheetCommand.id) {
|
|
2764
|
+
const params = commandInfo.params;
|
|
2765
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2766
|
+
if (!target) return {
|
|
2767
|
+
redos: [],
|
|
2768
|
+
undos: []
|
|
2769
|
+
};
|
|
2770
|
+
const { unitId, subUnitId } = target;
|
|
2771
|
+
const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2772
|
+
if (!ruleList) return {
|
|
2773
|
+
redos: [],
|
|
2774
|
+
undos: []
|
|
2775
|
+
};
|
|
2776
|
+
const redos = [];
|
|
2777
|
+
const undos = [];
|
|
2778
|
+
ruleList.forEach((item) => {
|
|
2779
|
+
const params = {
|
|
2780
|
+
unitId,
|
|
2781
|
+
subUnitId,
|
|
2782
|
+
cfId: item.cfId
|
|
2783
|
+
};
|
|
2784
|
+
redos.push({
|
|
2785
|
+
id: DeleteConditionalRuleMutation.id,
|
|
2786
|
+
params
|
|
2787
|
+
});
|
|
2788
|
+
undos.push(...DeleteConditionalRuleMutationUndoFactory(this._injector, params));
|
|
2789
|
+
});
|
|
2790
|
+
return {
|
|
2791
|
+
redos,
|
|
2792
|
+
undos
|
|
2793
|
+
};
|
|
2794
|
+
} else if (commandInfo.id === CopySheetCommand.id) {
|
|
2795
|
+
const params = commandInfo.params;
|
|
2796
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2797
|
+
if (!target) return {
|
|
2798
|
+
redos: [],
|
|
2799
|
+
undos: []
|
|
2800
|
+
};
|
|
2801
|
+
const { unitId, subUnitId } = target;
|
|
2802
|
+
const { targetSubUnitId } = params;
|
|
2803
|
+
const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId);
|
|
2804
|
+
if (!ruleList) return {
|
|
2805
|
+
redos: [],
|
|
2806
|
+
undos: []
|
|
2807
|
+
};
|
|
2808
|
+
const redos = [];
|
|
2809
|
+
const undos = [];
|
|
2810
|
+
ruleList.slice().reverse().forEach((item) => {
|
|
2811
|
+
const params = {
|
|
2812
|
+
unitId,
|
|
2813
|
+
subUnitId: targetSubUnitId,
|
|
2814
|
+
rule: {
|
|
2815
|
+
...item,
|
|
2816
|
+
cfId: this._conditionalFormattingRuleModel.createCfId(unitId, targetSubUnitId)
|
|
2817
|
+
}
|
|
2818
|
+
};
|
|
2819
|
+
redos.push({
|
|
2820
|
+
id: AddConditionalRuleMutation.id,
|
|
2821
|
+
params
|
|
2822
|
+
});
|
|
2823
|
+
undos.push(AddConditionalRuleMutationUndoFactory(this._injector, params));
|
|
2824
|
+
});
|
|
2825
|
+
return {
|
|
2826
|
+
redos,
|
|
2827
|
+
undos
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
return {
|
|
2831
|
+
redos: [],
|
|
2832
|
+
undos: []
|
|
2833
|
+
};
|
|
2834
|
+
} }));
|
|
2835
|
+
}
|
|
2836
|
+
_initCellChange() {
|
|
2837
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
2838
|
+
const markRulesDirtyByRanges = (unitId, subUnitId, ranges) => {
|
|
2839
|
+
this._conditionalFormattingRangeIndexModel.getRulesByRanges(unitId, subUnitId, ranges).forEach((rule) => {
|
|
2840
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(unitId, subUnitId, rule.cfId);
|
|
2841
|
+
});
|
|
2842
|
+
};
|
|
2843
|
+
switch (commandInfo.id) {
|
|
2844
|
+
case SetRangeValuesMutation.id: {
|
|
2845
|
+
const { subUnitId, unitId, cellValue } = commandInfo.params;
|
|
2846
|
+
const ranges = [];
|
|
2847
|
+
new ObjectMatrix(cellValue).forValue((row, col, value) => {
|
|
2848
|
+
if (value && Object.keys(value).some((key) => ["p", "v"].includes(key))) ranges.push({
|
|
2849
|
+
startRow: row,
|
|
2850
|
+
endRow: row,
|
|
2851
|
+
startColumn: col,
|
|
2852
|
+
endColumn: col
|
|
2853
|
+
});
|
|
2854
|
+
});
|
|
2855
|
+
markRulesDirtyByRanges(unitId, subUnitId, ranges);
|
|
2856
|
+
break;
|
|
2857
|
+
}
|
|
2858
|
+
case InsertColMutation.id:
|
|
2859
|
+
case RemoveColMutation.id: {
|
|
2860
|
+
const params = commandInfo.params;
|
|
2861
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2862
|
+
if (!target) return;
|
|
2863
|
+
const { worksheet, unitId, subUnitId } = target;
|
|
2864
|
+
const { range } = params;
|
|
2865
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2866
|
+
...range,
|
|
2867
|
+
endColumn: worksheet.getColumnCount() - 1
|
|
2868
|
+
}]);
|
|
2869
|
+
break;
|
|
2870
|
+
}
|
|
2871
|
+
case RemoveRowMutation.id:
|
|
2872
|
+
case InsertRowMutation.id: {
|
|
2873
|
+
const params = commandInfo.params;
|
|
2874
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2875
|
+
if (!target) return;
|
|
2876
|
+
const { worksheet, unitId, subUnitId } = target;
|
|
2877
|
+
const { range } = params;
|
|
2878
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2879
|
+
...range,
|
|
2880
|
+
endRow: worksheet.getRowCount() - 1
|
|
2881
|
+
}]);
|
|
2882
|
+
break;
|
|
2883
|
+
}
|
|
2884
|
+
case MoveRowsMutation.id: {
|
|
2885
|
+
const params = commandInfo.params;
|
|
2886
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2887
|
+
if (!target) return;
|
|
2888
|
+
const { worksheet, unitId, subUnitId } = target;
|
|
2889
|
+
const { sourceRange, targetRange } = params;
|
|
2890
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2891
|
+
startRow: Math.min(sourceRange.startRow, targetRange.startRow),
|
|
2892
|
+
endRow: worksheet.getRowCount() - 1,
|
|
2893
|
+
startColumn: 0,
|
|
2894
|
+
endColumn: worksheet.getColumnCount() - 1
|
|
2895
|
+
}]);
|
|
2896
|
+
break;
|
|
2897
|
+
}
|
|
2898
|
+
case MoveColsMutation.id: {
|
|
2899
|
+
const params = commandInfo.params;
|
|
2900
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
2901
|
+
if (!target) return;
|
|
2902
|
+
const { worksheet, unitId, subUnitId } = target;
|
|
2903
|
+
const { sourceRange, targetRange } = params;
|
|
2904
|
+
markRulesDirtyByRanges(unitId, subUnitId, [{
|
|
2905
|
+
startRow: 0,
|
|
2906
|
+
endRow: worksheet.getRowCount() - 1,
|
|
2907
|
+
startColumn: Math.min(sourceRange.startColumn, targetRange.startColumn),
|
|
2908
|
+
endColumn: worksheet.getColumnCount() - 1
|
|
2909
|
+
}]);
|
|
2910
|
+
break;
|
|
2911
|
+
}
|
|
2912
|
+
case MoveRangeMutation.id: {
|
|
2913
|
+
const { unitId, to, from } = commandInfo.params;
|
|
2914
|
+
const handleSubUnit = (value) => {
|
|
2915
|
+
const ranges = [];
|
|
2916
|
+
new ObjectMatrix(value.value).forValue((row, col) => {
|
|
2917
|
+
ranges.push({
|
|
2918
|
+
startRow: row,
|
|
2919
|
+
endRow: row,
|
|
2920
|
+
startColumn: col,
|
|
2921
|
+
endColumn: col
|
|
2922
|
+
});
|
|
2923
|
+
});
|
|
2924
|
+
markRulesDirtyByRanges(unitId, value.subUnitId, ranges);
|
|
2925
|
+
};
|
|
2926
|
+
handleSubUnit(to);
|
|
2927
|
+
handleSubUnit(from);
|
|
2928
|
+
break;
|
|
2929
|
+
}
|
|
2930
|
+
case ReorderRangeMutation.id: {
|
|
2931
|
+
const { range, unitId, subUnitId } = commandInfo.params;
|
|
2932
|
+
markRulesDirtyByRanges(unitId, subUnitId, [range]);
|
|
2933
|
+
break;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}));
|
|
2937
|
+
}
|
|
2938
|
+
};
|
|
2939
|
+
ConditionalFormattingService = __decorate([
|
|
2940
|
+
__decorateParam(0, Inject(ConditionalFormattingRuleModel)),
|
|
2941
|
+
__decorateParam(1, Inject(ConditionalFormattingRangeIndexModel)),
|
|
2942
|
+
__decorateParam(2, Inject(ConditionalFormattingStyleComposer)),
|
|
2943
|
+
__decorateParam(3, Inject(Injector)),
|
|
2944
|
+
__decorateParam(4, Inject(IUniverInstanceService)),
|
|
2945
|
+
__decorateParam(5, Inject(IResourceManagerService)),
|
|
2946
|
+
__decorateParam(6, Inject(SheetInterceptorService)),
|
|
2947
|
+
__decorateParam(7, Inject(ICommandService))
|
|
2948
|
+
], ConditionalFormattingService);
|
|
2949
|
+
|
|
2950
|
+
//#endregion
|
|
2951
|
+
//#region src/plugin.ts
|
|
2952
|
+
let UniverSheetsConditionalFormattingPlugin = class UniverSheetsConditionalFormattingPlugin extends Plugin {
|
|
2953
|
+
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
|
2954
|
+
super();
|
|
2955
|
+
this._config = _config;
|
|
2956
|
+
this._injector = _injector;
|
|
2957
|
+
this._commandService = _commandService;
|
|
2958
|
+
this._configService = _configService;
|
|
2959
|
+
const { ...rest } = merge({}, defaultPluginConfig, this._config);
|
|
2960
|
+
this._configService.setConfig(SHEETS_CONDITIONAL_FORMATTING_PLUGIN_CONFIG_KEY, rest);
|
|
2961
|
+
[
|
|
2962
|
+
[ConditionalFormattingService],
|
|
2963
|
+
[ConditionalFormattingFormulaService],
|
|
2964
|
+
[ConditionalFormattingRangeTransformService],
|
|
2965
|
+
[ConditionalFormattingStyleComposer],
|
|
2966
|
+
[ConditionalFormattingRuleModel],
|
|
2967
|
+
[ConditionalFormattingRangeIndexModel],
|
|
2968
|
+
[ConditionalFormattingViewModel]
|
|
2969
|
+
].forEach((dependency) => {
|
|
2970
|
+
this._injector.add(dependency);
|
|
2971
|
+
});
|
|
2972
|
+
[
|
|
2973
|
+
AddCfCommand,
|
|
2974
|
+
ClearRangeCfCommand,
|
|
2975
|
+
ClearWorksheetCfCommand,
|
|
2976
|
+
DeleteCfCommand,
|
|
2977
|
+
MoveCfCommand,
|
|
2978
|
+
SetCfCommand,
|
|
2979
|
+
AddConditionalRuleMutation,
|
|
2980
|
+
DeleteConditionalRuleMutation,
|
|
2981
|
+
SetConditionalRuleMutation,
|
|
2982
|
+
MoveConditionalRuleMutation
|
|
2983
|
+
].forEach((m) => {
|
|
2984
|
+
this._commandService.registerCommand(m);
|
|
2985
|
+
});
|
|
2986
|
+
}
|
|
2987
|
+
onStarting() {
|
|
2988
|
+
this._injector.get(ConditionalFormattingService);
|
|
2989
|
+
touchDependencies(this._injector, [
|
|
2990
|
+
[ConditionalFormattingService],
|
|
2991
|
+
[ConditionalFormattingRangeIndexModel],
|
|
2992
|
+
[ConditionalFormattingViewModel]
|
|
2993
|
+
]);
|
|
2994
|
+
}
|
|
2995
|
+
};
|
|
2996
|
+
_defineProperty(UniverSheetsConditionalFormattingPlugin, "pluginName", SHEET_CONDITIONAL_FORMATTING_PLUGIN);
|
|
2997
|
+
_defineProperty(UniverSheetsConditionalFormattingPlugin, "packageName", name);
|
|
2998
|
+
_defineProperty(UniverSheetsConditionalFormattingPlugin, "version", version);
|
|
2999
|
+
_defineProperty(UniverSheetsConditionalFormattingPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
3000
|
+
UniverSheetsConditionalFormattingPlugin = __decorate([
|
|
3001
|
+
DependentOn(UniverFormulaEnginePlugin, UniverSheetsPlugin),
|
|
3002
|
+
__decorateParam(1, Inject(Injector)),
|
|
3003
|
+
__decorateParam(2, Inject(ICommandService)),
|
|
3004
|
+
__decorateParam(3, IConfigService)
|
|
3005
|
+
], UniverSheetsConditionalFormattingPlugin);
|
|
3006
|
+
|
|
3007
|
+
//#endregion
|
|
3008
|
+
//#region src/render/icon.render.ts
|
|
3009
|
+
const IconUKey = "sheet-conditional-rule-icon";
|
|
3010
|
+
const EXTENSION_Z_INDEX = 35;
|
|
3011
|
+
const DEFAULT_WIDTH = 15;
|
|
3012
|
+
const DEFAULT_PADDING = 2;
|
|
3013
|
+
const stringifyRange = (range) => {
|
|
3014
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
3015
|
+
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
3016
|
+
};
|
|
3017
|
+
var ConditionalFormattingIcon = class extends SheetExtension {
|
|
3018
|
+
constructor() {
|
|
3019
|
+
super();
|
|
3020
|
+
_defineProperty(this, "_paddingRightAndLeft", 2);
|
|
3021
|
+
_defineProperty(this, "_width", 15);
|
|
3022
|
+
_defineProperty(this, "_imageMap", /* @__PURE__ */ new Map());
|
|
3023
|
+
_defineProperty(this, "_renderRangeResolver", null);
|
|
3024
|
+
_defineProperty(this, "uKey", IconUKey);
|
|
3025
|
+
_defineProperty(this, "Z_INDEX", EXTENSION_Z_INDEX);
|
|
3026
|
+
_defineProperty(this, "_radius", 1);
|
|
3027
|
+
this._init();
|
|
3028
|
+
}
|
|
3029
|
+
setRenderRangeResolver(resolver) {
|
|
3030
|
+
this._renderRangeResolver = resolver;
|
|
3031
|
+
}
|
|
3032
|
+
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges) {
|
|
3033
|
+
const { worksheet } = spreadsheetSkeleton;
|
|
3034
|
+
if (!worksheet) return false;
|
|
3035
|
+
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
3036
|
+
const sourceRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [spreadsheetSkeleton.rowColumnSegment];
|
|
3037
|
+
const renderRanges = this._renderRangeResolver && worksheet.getMergeData().length === 0 ? this._renderRangeResolver(worksheet.getUnitId(), worksheet.getSheetId(), sourceRanges) ?? sourceRanges : sourceRanges;
|
|
3038
|
+
if (!renderRanges.length) return;
|
|
3039
|
+
ctx.save();
|
|
3040
|
+
renderRanges.forEach((range) => {
|
|
3041
|
+
Range.foreach(range, (row, col) => {
|
|
3042
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
3043
|
+
const primaryWithCoord = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
|
|
3044
|
+
const { isMerged, isMergedMainCell, mergeInfo } = primaryWithCoord;
|
|
3045
|
+
let cellData = worksheet.getCell(row, col);
|
|
3046
|
+
if (isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
|
|
3047
|
+
if (!(cellData === null || cellData === void 0 ? void 0 : cellData.iconSet)) return;
|
|
3048
|
+
const { iconType, iconId } = cellData.iconSet;
|
|
3049
|
+
if (iconType === "EMPTY_ICON_TYPE") return;
|
|
3050
|
+
const icon = this._imageMap.get(this._createKey(iconType, iconId));
|
|
3051
|
+
if (!icon) return;
|
|
3052
|
+
if (!this.isRenderDiffRangesByCell(mergeInfo, diffRanges)) return;
|
|
3053
|
+
if (isMerged || isMergedMainCell) {
|
|
3054
|
+
const rangeStr = stringifyRange(mergeInfo);
|
|
3055
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
3056
|
+
mergeCellRendered.add(rangeStr);
|
|
3057
|
+
}
|
|
3058
|
+
const { startX, endX, startY, endY } = isMerged || isMergedMainCell ? mergeInfo : primaryWithCoord;
|
|
3059
|
+
const borderWidth = endX - startX;
|
|
3060
|
+
const borderHeight = endY - startY;
|
|
3061
|
+
if (this._width > borderHeight || this._width > borderWidth + this._paddingRightAndLeft * 2) return;
|
|
3062
|
+
const y = (borderHeight - this._width) / 2 + startY;
|
|
3063
|
+
ctx.drawImage(icon, startX + this._paddingRightAndLeft, y, this._width, this._width);
|
|
3064
|
+
});
|
|
3065
|
+
});
|
|
3066
|
+
ctx.restore();
|
|
3067
|
+
}
|
|
3068
|
+
dispose() {
|
|
3069
|
+
this._renderRangeResolver = null;
|
|
3070
|
+
super.dispose();
|
|
3071
|
+
}
|
|
3072
|
+
_init() {
|
|
3073
|
+
for (const type in iconMap) iconMap[type].forEach((base64, index) => {
|
|
3074
|
+
const key = this._createKey(type, String(index));
|
|
3075
|
+
const image = new Image();
|
|
3076
|
+
image.onload = () => {
|
|
3077
|
+
this._imageMap.set(key, image);
|
|
3078
|
+
};
|
|
3079
|
+
image.src = base64;
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3082
|
+
_createKey(iconType, iconIndex) {
|
|
3083
|
+
return `${iconType}_${iconIndex}`;
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
SpreadsheetExtensionRegistry.add(ConditionalFormattingIcon);
|
|
3087
|
+
|
|
3088
|
+
//#endregion
|
|
3089
|
+
//#region src/utils/remove-undefined-attr.ts
|
|
3090
|
+
/**
|
|
3091
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3092
|
+
*
|
|
3093
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3094
|
+
* you may not use this file except in compliance with the License.
|
|
3095
|
+
* You may obtain a copy of the License at
|
|
3096
|
+
*
|
|
3097
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3098
|
+
*
|
|
3099
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3100
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3101
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3102
|
+
* See the License for the specific language governing permissions and
|
|
3103
|
+
* limitations under the License.
|
|
3104
|
+
*/
|
|
3105
|
+
function removeUndefinedAttr(obj) {
|
|
3106
|
+
if (typeof obj !== "object" || obj === null) return obj;
|
|
3107
|
+
const result = {};
|
|
3108
|
+
for (const key in obj) if (obj.hasOwnProperty(key)) {
|
|
3109
|
+
const value = removeUndefinedAttr(obj[key]);
|
|
3110
|
+
if (value !== void 0) result[key] = value;
|
|
3111
|
+
}
|
|
3112
|
+
return result;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
//#endregion
|
|
3116
|
+
export { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingFormulaService, ConditionalFormattingIcon, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingStyleComposer, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DataBar, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, IconUKey, MoveCfCommand, MoveConditionalRuleMutation, MoveConditionalRuleMutationUndoFactory, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, anchorUndoFactory, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, dataBarUKey, defaultDataBarNativeColor, defaultDataBarPositiveColor, defaultPlaceholderColor, filterRange, findIndexByAnchor, getCacheStyleMatrix, getCellValue, getColorScaleFromValue, getMaxInFormulaResult, getOppositeOperator, getValueByType, iconGroup, iconMap, isAnchorEqual, isFloatsEqual, isNullable, moveByAnchor, removeUndefinedAttr, serialTimeToTimestamp, setConditionalRuleMutationUndoFactory, transformSupportSymmetryAnchor };
|