@univerjs/sheets-conditional-formatting 0.15.4 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +508 -501
- package/lib/index.js +508 -501
- package/lib/types/models/conditional-formatting-view-model.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var H2 = Object.defineProperty;
|
|
2
2
|
var j2 = (s, r, t) => r in s ? H2(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
|
|
3
3
|
var m = (s, r, t) => j2(s, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import { generateRandomId as
|
|
5
|
-
import { isRangesEqual as
|
|
6
|
-
import { getSheetCommandTarget as
|
|
7
|
-
import { Subject as d2, BehaviorSubject as
|
|
8
|
-
import { RegisterOtherFormulaService as
|
|
9
|
-
import { distinctUntilChanged as E0, bufferTime as A0, filter as
|
|
10
|
-
import { isObject as
|
|
4
|
+
import { generateRandomId as K2, Tools as z, CommandType as $, IUndoRedoService as t2, ICommandService as q, IUniverInstanceService as Z, ObjectMatrix as O, Range as U, sequenceExecute as k2, Inject as b, Disposable as x2, RefAlias as Y2, CellValueType as y, BooleanNumber as B2, LRUMap as N2, ColorKit as T2, dayjs as v, Injector as _2, RTree as X2, IResourceManagerService as J2, merge as U2, UniverInstanceType as V2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
|
|
5
|
+
import { isRangesEqual as H1 } from "@univerjs/core";
|
|
6
|
+
import { getSheetCommandTarget as k, SheetsSelectionsService as r0, findAllRectangle as s0, createTopMatrixFromMatrix as i0, SheetInterceptorService as a0, RemoveSheetCommand as l0, CopySheetCommand as o0, ReorderRangeMutation as u0, MoveRangeMutation as c0, MoveColsMutation as d0, MoveRowsMutation as h0, InsertRowMutation as g0, RemoveRowMutation as C0, RemoveColMutation as f0, InsertColMutation as D0, SetRangeValuesMutation as m0 } from "@univerjs/sheets";
|
|
7
|
+
import { Subject as d2, BehaviorSubject as w0 } from "rxjs";
|
|
8
|
+
import { RegisterOtherFormulaService as F0, FormulaResultStatus as p, OtherFormulaBizType as v0, ERROR_TYPE_SET as M2, BooleanValue as R2, UniverFormulaEnginePlugin as p0 } from "@univerjs/engine-formula";
|
|
9
|
+
import { distinctUntilChanged as E0, bufferTime as A0, filter as x0, map as _0 } from "rxjs/operators";
|
|
10
|
+
import { isObject as y0, SpreadsheetExtensionRegistry as O2, SheetExtension as $2, FIX_ONE_PIXEL_BLUR_OFFSET as M0 } from "@univerjs/engine-render";
|
|
11
11
|
const P2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
12
|
-
var
|
|
13
|
-
const
|
|
12
|
+
var N = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(N || {}), T = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(T || {}), F = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(F || {}), M = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(M || {}), x = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(x || {}), L = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(L || {});
|
|
13
|
+
const T1 = "#fff", U1 = "#000000", V1 = () => ({
|
|
14
14
|
cfId: void 0,
|
|
15
15
|
ranges: [],
|
|
16
16
|
stopIfTrue: !1,
|
|
@@ -20,7 +20,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
20
20
|
operator: "containsText"
|
|
21
21
|
/* containsText */
|
|
22
22
|
}
|
|
23
|
-
}),
|
|
23
|
+
}), O1 = (s, r) => {
|
|
24
24
|
switch (s) {
|
|
25
25
|
case "text": {
|
|
26
26
|
if ([
|
|
@@ -43,7 +43,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
43
43
|
].includes(r) ? [10, 100] : 10;
|
|
44
44
|
}
|
|
45
45
|
return "";
|
|
46
|
-
},
|
|
46
|
+
}, $1 = (s, r) => {
|
|
47
47
|
switch (s) {
|
|
48
48
|
case "formula":
|
|
49
49
|
return "=";
|
|
@@ -56,7 +56,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
56
56
|
return r !== void 0 ? r : 10;
|
|
57
57
|
}
|
|
58
58
|
return "";
|
|
59
|
-
},
|
|
59
|
+
}, Y = (s, r, t) => {
|
|
60
60
|
if (!r)
|
|
61
61
|
return null;
|
|
62
62
|
const e = r.findIndex((n) => t(n) === s.id);
|
|
@@ -73,12 +73,12 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
73
73
|
}, R0 = (s, r, t, e) => {
|
|
74
74
|
if (!t)
|
|
75
75
|
return null;
|
|
76
|
-
const n =
|
|
77
|
-
let i =
|
|
76
|
+
const n = Y(s, t, e);
|
|
77
|
+
let i = Y(r, t, e);
|
|
78
78
|
if (n === null || i === null || n === i)
|
|
79
79
|
return;
|
|
80
80
|
const a = t.splice(n, 1)[0];
|
|
81
|
-
switch (n < i && (i =
|
|
81
|
+
switch (n < i && (i = Y(r, t, e)), r.type) {
|
|
82
82
|
case "before": {
|
|
83
83
|
t.splice(i + 1, 0, a);
|
|
84
84
|
break;
|
|
@@ -94,7 +94,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
94
94
|
return [s, r];
|
|
95
95
|
const n = { ...s }, i = { ...r };
|
|
96
96
|
if (n.type !== "after") {
|
|
97
|
-
const a =
|
|
97
|
+
const a = Y(n, t, e);
|
|
98
98
|
if (a === null)
|
|
99
99
|
return null;
|
|
100
100
|
if (a - 1 < 0) {
|
|
@@ -109,7 +109,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
if (!["after", "before"].includes(i.type)) {
|
|
112
|
-
const a =
|
|
112
|
+
const a = Y(i, t, e);
|
|
113
113
|
if (a === null)
|
|
114
114
|
return null;
|
|
115
115
|
if (a === 0)
|
|
@@ -132,7 +132,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
132
132
|
return [r, { ...s, type: "self" }];
|
|
133
133
|
}
|
|
134
134
|
return null;
|
|
135
|
-
},
|
|
135
|
+
}, P1 = (s, r) => s.id === r.id && s.type === r.type, S0 = () => `${K2(8)}`;
|
|
136
136
|
class R {
|
|
137
137
|
constructor() {
|
|
138
138
|
// Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
|
|
@@ -173,7 +173,7 @@ class R {
|
|
|
173
173
|
setRule(r, t, e, n) {
|
|
174
174
|
const a = this._ensureList(r, t).find((c) => c.cfId === n);
|
|
175
175
|
if (a) {
|
|
176
|
-
const c =
|
|
176
|
+
const c = z.deepClone(a);
|
|
177
177
|
Object.assign(a, e), this._ruleChange$.next({ rule: a, subUnitId: t, unitId: r, type: "set", oldRule: c });
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -186,11 +186,11 @@ class R {
|
|
|
186
186
|
* if targetId does not exist, it defaults to top
|
|
187
187
|
*/
|
|
188
188
|
moveRulePriority(r, t, e, n) {
|
|
189
|
-
const i = this._ensureList(r, t), a =
|
|
189
|
+
const i = this._ensureList(r, t), a = Y(e, i, (l) => l.cfId), c = Y(n, i, (l) => l.cfId);
|
|
190
190
|
if (c === null || a === null || c === a)
|
|
191
191
|
return;
|
|
192
|
-
const
|
|
193
|
-
|
|
192
|
+
const o = i[a];
|
|
193
|
+
o && (R0(e, n, i, (l) => l.cfId), this._ruleChange$.next({ rule: o, subUnitId: t, unitId: r, type: "sort" }));
|
|
194
194
|
}
|
|
195
195
|
createCfId(r, t) {
|
|
196
196
|
return S0();
|
|
@@ -200,7 +200,7 @@ class R {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
const i2 = {
|
|
203
|
-
type:
|
|
203
|
+
type: $.MUTATION,
|
|
204
204
|
id: "sheet.mutation.move-conditional-rule",
|
|
205
205
|
handler(s, r) {
|
|
206
206
|
if (!r)
|
|
@@ -216,17 +216,17 @@ const i2 = {
|
|
|
216
216
|
return [
|
|
217
217
|
{ id: i2.id, params: { unitId: r, subUnitId: t, start: n, end: i } }
|
|
218
218
|
];
|
|
219
|
-
},
|
|
220
|
-
const t = s.get(R), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((
|
|
219
|
+
}, D2 = (s, r) => {
|
|
220
|
+
const t = s.get(R), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((l) => l.cfId === i), o = a[c - 1];
|
|
221
221
|
if (c > -1) {
|
|
222
|
-
const
|
|
222
|
+
const l = a[c], d = [{
|
|
223
223
|
id: a2.id,
|
|
224
|
-
params: { unitId: e, subUnitId: n, rule:
|
|
224
|
+
params: { unitId: e, subUnitId: n, rule: z.deepClone(l) }
|
|
225
225
|
}];
|
|
226
226
|
if (a.splice(c, 1), c !== 0) {
|
|
227
227
|
const u = a[0];
|
|
228
228
|
if (u) {
|
|
229
|
-
const h = W2({ id: u.cfId, type: "before" }, { id:
|
|
229
|
+
const h = W2({ id: u.cfId, type: "before" }, { id: o.cfId, type: "after" }, a, (w) => w.cfId);
|
|
230
230
|
if (!h)
|
|
231
231
|
return d;
|
|
232
232
|
const [g, f] = h, D = {
|
|
@@ -241,8 +241,8 @@ const i2 = {
|
|
|
241
241
|
return d;
|
|
242
242
|
}
|
|
243
243
|
return [];
|
|
244
|
-
},
|
|
245
|
-
type:
|
|
244
|
+
}, X = {
|
|
245
|
+
type: $.MUTATION,
|
|
246
246
|
id: "sheet.mutation.delete-conditional-rule",
|
|
247
247
|
handler(s, r) {
|
|
248
248
|
if (!r)
|
|
@@ -250,8 +250,8 @@ const i2 = {
|
|
|
250
250
|
const { unitId: t, subUnitId: e, cfId: n } = r;
|
|
251
251
|
return s.get(R).deleteRule(t, e, n), !0;
|
|
252
252
|
}
|
|
253
|
-
}, q2 = (s, r) => ({ id:
|
|
254
|
-
type:
|
|
253
|
+
}, q2 = (s, r) => ({ id: X.id, params: { unitId: r.unitId, subUnitId: r.subUnitId, cfId: r.rule.cfId } }), a2 = {
|
|
254
|
+
type: $.MUTATION,
|
|
255
255
|
id: "sheet.mutation.add-conditional-rule",
|
|
256
256
|
handler(s, r) {
|
|
257
257
|
if (!r)
|
|
@@ -260,22 +260,22 @@ const i2 = {
|
|
|
260
260
|
return s.get(R).addRule(t, e, n), !0;
|
|
261
261
|
}
|
|
262
262
|
}, L0 = {
|
|
263
|
-
type:
|
|
263
|
+
type: $.COMMAND,
|
|
264
264
|
id: "sheet.command.add-conditional-rule",
|
|
265
265
|
handler(s, r) {
|
|
266
266
|
if (!r)
|
|
267
267
|
return !1;
|
|
268
|
-
const { rule: t } = r, e = s.get(
|
|
268
|
+
const { rule: t } = r, e = s.get(t2), n = s.get(q), i = s.get(R), a = s.get(Z), c = k(a, r);
|
|
269
269
|
if (!c) return !1;
|
|
270
|
-
const { unitId:
|
|
270
|
+
const { unitId: o, subUnitId: l } = c, d = i.createCfId(o, l), u = { unitId: o, subUnitId: l, rule: { ...t, cfId: t.cfId || d } }, h = q2(s, u), g = n.syncExecuteCommand(a2.id, u);
|
|
271
271
|
return g && e.pushUndoRedo({
|
|
272
|
-
unitID:
|
|
272
|
+
unitID: o,
|
|
273
273
|
redoMutations: [{ id: a2.id, params: u }],
|
|
274
274
|
undoMutations: [h]
|
|
275
275
|
}), g;
|
|
276
276
|
}
|
|
277
277
|
}, l2 = {
|
|
278
|
-
type:
|
|
278
|
+
type: $.MUTATION,
|
|
279
279
|
id: "sheet.mutation.set-conditional-rule",
|
|
280
280
|
handler(s, r) {
|
|
281
281
|
if (!r)
|
|
@@ -291,59 +291,59 @@ const i2 = {
|
|
|
291
291
|
unitId: e,
|
|
292
292
|
subUnitId: n,
|
|
293
293
|
cfId: i,
|
|
294
|
-
rule:
|
|
294
|
+
rule: z.deepClone(a)
|
|
295
295
|
}
|
|
296
296
|
}] : [];
|
|
297
297
|
}, k0 = {
|
|
298
|
-
type:
|
|
298
|
+
type: $.COMMAND,
|
|
299
299
|
id: "sheet.command.clear-range-conditional-rule",
|
|
300
300
|
handler(s, r) {
|
|
301
301
|
var D;
|
|
302
302
|
if (!r)
|
|
303
303
|
return !1;
|
|
304
|
-
const t = s.get(R), e = s.get(
|
|
304
|
+
const t = s.get(R), e = s.get(Z), n = s.get(q), i = s.get(t2), a = s.get(r0), c = k(e, r);
|
|
305
305
|
if (!c) return !1;
|
|
306
|
-
const { unitId:
|
|
306
|
+
const { unitId: o, subUnitId: l } = c, d = ((D = a.getCurrentSelections()) == null ? void 0 : D.map((w) => w.range)) || [], u = t.getSubunitRules(o, l);
|
|
307
307
|
if (!(u != null && u.length) || !d.length)
|
|
308
308
|
return !1;
|
|
309
309
|
const h = [], g = [];
|
|
310
|
-
u.forEach((
|
|
311
|
-
const E = new
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
E.setValue(S,
|
|
310
|
+
u.forEach((w) => {
|
|
311
|
+
const E = new O();
|
|
312
|
+
w.ranges.forEach((A) => {
|
|
313
|
+
U.foreach(A, (S, B) => {
|
|
314
|
+
E.setValue(S, B, 1);
|
|
315
315
|
});
|
|
316
316
|
}), d.forEach((A) => {
|
|
317
|
-
|
|
318
|
-
E.realDeleteValue(S,
|
|
317
|
+
U.foreach(A, (S, B) => {
|
|
318
|
+
E.realDeleteValue(S, B);
|
|
319
319
|
});
|
|
320
320
|
});
|
|
321
321
|
const I = s0(i0(E));
|
|
322
322
|
if (I.length) {
|
|
323
|
-
const A = { ...
|
|
324
|
-
h.push({ id: l2.id, params: S }), g.push(...
|
|
323
|
+
const A = { ...w, ranges: I }, S = { unitId: o, subUnitId: l, rule: A }, B = Z2(s, S);
|
|
324
|
+
h.push({ id: l2.id, params: S }), g.push(...B);
|
|
325
325
|
} else {
|
|
326
|
-
const A = { unitId:
|
|
327
|
-
h.push({ id:
|
|
326
|
+
const A = { unitId: o, subUnitId: l, cfId: w.cfId }, S = D2(s, A);
|
|
327
|
+
h.push({ id: X.id, params: A }), g.push(...S);
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
|
-
const f =
|
|
330
|
+
const f = k2(h, n).result;
|
|
331
331
|
return f && i.pushUndoRedo({
|
|
332
|
-
unitID:
|
|
332
|
+
unitID: o,
|
|
333
333
|
redoMutations: h,
|
|
334
334
|
undoMutations: g
|
|
335
335
|
}), f;
|
|
336
336
|
}
|
|
337
337
|
}, B0 = {
|
|
338
|
-
type:
|
|
338
|
+
type: $.COMMAND,
|
|
339
339
|
id: "sheet.command.clear-worksheet-conditional-rule",
|
|
340
340
|
handler(s, r) {
|
|
341
|
-
const t = s.get(R), e = s.get(
|
|
341
|
+
const t = s.get(R), e = s.get(Z), n = s.get(q), i = s.get(t2), a = k(e, r);
|
|
342
342
|
if (!a) return !1;
|
|
343
|
-
const { unitId: c, subUnitId:
|
|
344
|
-
if (!(
|
|
343
|
+
const { unitId: c, subUnitId: o } = a, l = t.getSubunitRules(c, o);
|
|
344
|
+
if (!(l != null && l.length))
|
|
345
345
|
return !1;
|
|
346
|
-
const d =
|
|
346
|
+
const d = l.map((f) => ({ cfId: f.cfId, unitId: c, subUnitId: o })), u = d.map((f) => ({ id: X.id, params: f })), h = d.map((f) => D2(s, f)[0]), g = k2(u, n).result;
|
|
347
347
|
return g && i.pushUndoRedo({
|
|
348
348
|
unitID: c,
|
|
349
349
|
redoMutations: u,
|
|
@@ -351,28 +351,28 @@ const i2 = {
|
|
|
351
351
|
}), g;
|
|
352
352
|
}
|
|
353
353
|
}, N0 = {
|
|
354
|
-
type:
|
|
354
|
+
type: $.COMMAND,
|
|
355
355
|
id: "sheet.command.delete-conditional-rule",
|
|
356
356
|
handler(s, r) {
|
|
357
357
|
if (!r)
|
|
358
358
|
return !1;
|
|
359
|
-
const t = s.get(
|
|
359
|
+
const t = s.get(t2), e = s.get(q), n = s.get(Z), i = k(n, r);
|
|
360
360
|
if (!i) return !1;
|
|
361
|
-
const { unitId: a, subUnitId: c } = i,
|
|
362
|
-
return d && t.pushUndoRedo({ unitID: a, undoMutations:
|
|
361
|
+
const { unitId: a, subUnitId: c } = i, o = { unitId: a, subUnitId: c, cfId: r.cfId }, l = D2(s, o), d = e.syncExecuteCommand(X.id, o);
|
|
362
|
+
return d && t.pushUndoRedo({ unitID: a, undoMutations: l, redoMutations: [{ id: X.id, params: o }] }), d;
|
|
363
363
|
}
|
|
364
364
|
}, T0 = {
|
|
365
|
-
type:
|
|
365
|
+
type: $.COMMAND,
|
|
366
366
|
id: "sheet.command.move-conditional-rule",
|
|
367
367
|
handler(s, r) {
|
|
368
368
|
if (!r)
|
|
369
369
|
return !1;
|
|
370
|
-
const t = s.get(
|
|
370
|
+
const t = s.get(t2), e = s.get(q), n = s.get(Z), i = s.get(R), a = k(n, r);
|
|
371
371
|
if (!a) return !1;
|
|
372
|
-
const { unitId: c, subUnitId:
|
|
373
|
-
if (!
|
|
372
|
+
const { unitId: c, subUnitId: o } = a, l = W2(r.start, r.end, i.getSubunitRules(c, o) || [], (D) => D.cfId);
|
|
373
|
+
if (!l)
|
|
374
374
|
return !1;
|
|
375
|
-
const [d, u] =
|
|
375
|
+
const [d, u] = l, h = { unitId: c, subUnitId: o, start: d, end: u }, g = b0(h), f = e.syncExecuteCommand(i2.id, h);
|
|
376
376
|
return f && t.pushUndoRedo({
|
|
377
377
|
unitID: c,
|
|
378
378
|
redoMutations: [{ id: i2.id, params: h }],
|
|
@@ -380,23 +380,23 @@ const i2 = {
|
|
|
380
380
|
}), f;
|
|
381
381
|
}
|
|
382
382
|
}, U0 = {
|
|
383
|
-
type:
|
|
383
|
+
type: $.COMMAND,
|
|
384
384
|
id: "sheet.command.set-conditional-rule",
|
|
385
385
|
handler(s, r) {
|
|
386
386
|
if (!r)
|
|
387
387
|
return !1;
|
|
388
|
-
const t = s.get(
|
|
388
|
+
const t = s.get(t2), e = s.get(q), n = s.get(Z), i = k(n, r);
|
|
389
389
|
if (!i) return !1;
|
|
390
|
-
const { unitId: a, subUnitId: c } = i,
|
|
391
|
-
return d && t.pushUndoRedo({ unitID: a, undoMutations:
|
|
390
|
+
const { unitId: a, subUnitId: c } = i, o = { unitId: a, subUnitId: c, rule: r.rule, cfId: r.cfId }, l = Z2(s, o), d = e.syncExecuteCommand(l2.id, o);
|
|
391
|
+
return d && t.pushUndoRedo({ unitID: a, undoMutations: l, redoMutations: [{ id: l2.id, params: o }] }), d;
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
var V0 = Object.getOwnPropertyDescriptor, O0 = (s, r, t, e) => {
|
|
395
395
|
for (var n = e > 1 ? void 0 : e ? V0(r, t) : r, i = s.length - 1, a; i >= 0; i--)
|
|
396
396
|
(a = s[i]) && (n = a(n) || n);
|
|
397
397
|
return n;
|
|
398
|
-
},
|
|
399
|
-
let
|
|
398
|
+
}, I2 = (s, r) => (t, e) => r(t, e, s);
|
|
399
|
+
let Q = class extends x2 {
|
|
400
400
|
constructor(r, t) {
|
|
401
401
|
super();
|
|
402
402
|
// Cache Formula ID and formula mapping.
|
|
@@ -408,11 +408,11 @@ let z = class extends x2 {
|
|
|
408
408
|
_initRuleChange() {
|
|
409
409
|
const r = (t) => {
|
|
410
410
|
switch (t.type) {
|
|
411
|
-
case
|
|
411
|
+
case M.colorScale:
|
|
412
412
|
return t.config.some((e) => e.value.type === L.formula);
|
|
413
|
-
case
|
|
413
|
+
case M.dataBar:
|
|
414
414
|
return [t.config.max, t.config.min].some((e) => e.type === L.formula);
|
|
415
|
-
case
|
|
415
|
+
case M.iconSet:
|
|
416
416
|
return t.config.some((e) => e.value.type === L.formula);
|
|
417
417
|
}
|
|
418
418
|
};
|
|
@@ -426,8 +426,8 @@ let z = class extends x2 {
|
|
|
426
426
|
*/
|
|
427
427
|
_registerRuleFormulas(r, t, e) {
|
|
428
428
|
switch (e.rule.type) {
|
|
429
|
-
case
|
|
430
|
-
if (e.rule.subType ===
|
|
429
|
+
case M.highlightCell: {
|
|
430
|
+
if (e.rule.subType === x.formula) {
|
|
431
431
|
const n = e.rule.value;
|
|
432
432
|
n && this.registerFormulaWithRange(
|
|
433
433
|
r,
|
|
@@ -450,11 +450,11 @@ let z = class extends x2 {
|
|
|
450
450
|
const a = this._ensureSubunitFormulaMap(t, e).getValue(i.formulaId, ["formulaId"]);
|
|
451
451
|
if (!a)
|
|
452
452
|
continue;
|
|
453
|
-
const
|
|
454
|
-
const d = this._registerOtherFormulaService.getFormulaValueSync(t, e,
|
|
453
|
+
const o = this._getAllFormulaResultByCfId(t, e, a.cfId).every((l) => {
|
|
454
|
+
const d = this._registerOtherFormulaService.getFormulaValueSync(t, e, l.formulaId);
|
|
455
455
|
return (d == null ? void 0 : d.status) === p.SUCCESS;
|
|
456
456
|
});
|
|
457
|
-
this._result$.next({ ...a, isAllFinished:
|
|
457
|
+
this._result$.next({ ...a, isAllFinished: o });
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
}));
|
|
@@ -463,7 +463,7 @@ let z = class extends x2 {
|
|
|
463
463
|
let e = this._formulaMap.get(r);
|
|
464
464
|
e || (e = /* @__PURE__ */ new Map(), this._formulaMap.set(r, e));
|
|
465
465
|
let n = e.get(t);
|
|
466
|
-
return n || (n = new
|
|
466
|
+
return n || (n = new Y2([], ["formulaId", "id"]), e.set(t, n)), n;
|
|
467
467
|
}
|
|
468
468
|
getSubUnitFormulaMap(r, t) {
|
|
469
469
|
var e;
|
|
@@ -473,14 +473,14 @@ let z = class extends x2 {
|
|
|
473
473
|
const a = this._ensureSubunitFormulaMap(r, t), c = this.createCFormulaId(e, n);
|
|
474
474
|
if (a.getValue(c, ["id"]))
|
|
475
475
|
return;
|
|
476
|
-
const
|
|
476
|
+
const o = this._registerOtherFormulaService.registerFormulaWithRange(r, t, n, i, void 0, v0.CONDITIONAL_FORMATTING, e);
|
|
477
477
|
a.addValue({
|
|
478
478
|
formulaText: n,
|
|
479
479
|
unitId: r,
|
|
480
480
|
subUnitId: t,
|
|
481
481
|
cfId: e,
|
|
482
482
|
id: c,
|
|
483
|
-
formulaId:
|
|
483
|
+
formulaId: o
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
_removeFormulaByCfId(r, t, e) {
|
|
@@ -492,17 +492,17 @@ let z = class extends x2 {
|
|
|
492
492
|
const c = this.getSubUnitFormulaMap(r, t);
|
|
493
493
|
if (!c)
|
|
494
494
|
return { status: p.NOT_REGISTER };
|
|
495
|
-
const
|
|
496
|
-
if (!l)
|
|
497
|
-
return { status: p.NOT_REGISTER };
|
|
498
|
-
const o = this._registerOtherFormulaService.getFormulaValueSync(r, t, l.formulaId);
|
|
495
|
+
const o = c.getValue(this.createCFormulaId(e, n), ["id"]);
|
|
499
496
|
if (!o)
|
|
500
497
|
return { status: p.NOT_REGISTER };
|
|
501
|
-
|
|
502
|
-
|
|
498
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(r, t, o.formulaId);
|
|
499
|
+
if (!l)
|
|
500
|
+
return { status: p.NOT_REGISTER };
|
|
501
|
+
if (l.status === p.SUCCESS && l.result) {
|
|
502
|
+
const u = (d = l.result[i]) == null ? void 0 : d[a];
|
|
503
503
|
return { result: this._getCellValue(u), status: p.SUCCESS };
|
|
504
504
|
}
|
|
505
|
-
return { status:
|
|
505
|
+
return { status: l.status };
|
|
506
506
|
}
|
|
507
507
|
getFormulaMatrix(r, t, e, n) {
|
|
508
508
|
const i = this.getSubUnitFormulaMap(r, t);
|
|
@@ -515,10 +515,10 @@ let z = class extends x2 {
|
|
|
515
515
|
if (!c)
|
|
516
516
|
return { status: p.NOT_REGISTER };
|
|
517
517
|
if (c.status === p.SUCCESS && c.result) {
|
|
518
|
-
const
|
|
519
|
-
return new
|
|
520
|
-
|
|
521
|
-
}), { result:
|
|
518
|
+
const o = new O();
|
|
519
|
+
return new O(c.result).forValue((d, u, h) => {
|
|
520
|
+
o.setValue(d, u, this._getCellValue(h));
|
|
521
|
+
}), { result: o, status: p.SUCCESS };
|
|
522
522
|
}
|
|
523
523
|
return { status: c.status };
|
|
524
524
|
}
|
|
@@ -526,7 +526,7 @@ let z = class extends x2 {
|
|
|
526
526
|
if (!r || !r[0] || !r[0][0])
|
|
527
527
|
return !1;
|
|
528
528
|
const t = r[0][0];
|
|
529
|
-
return (t == null ? void 0 : t.t) ===
|
|
529
|
+
return (t == null ? void 0 : t.t) === y.BOOLEAN ? t.v === B2.TRUE || t.v === !0 : t == null ? void 0 : t.v;
|
|
530
530
|
}
|
|
531
531
|
/**
|
|
532
532
|
* If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
|
|
@@ -556,18 +556,18 @@ let z = class extends x2 {
|
|
|
556
556
|
return `${r}_${t}`;
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
],
|
|
563
|
-
var
|
|
564
|
-
class
|
|
559
|
+
Q = O0([
|
|
560
|
+
I2(0, b(F0)),
|
|
561
|
+
I2(1, b(R))
|
|
562
|
+
], Q);
|
|
563
|
+
var V = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(V || {});
|
|
564
|
+
class m2 {
|
|
565
565
|
constructor(r) {
|
|
566
566
|
/**
|
|
567
567
|
* 3nd-level cache
|
|
568
568
|
*/
|
|
569
569
|
m(this, "_cache");
|
|
570
|
-
m(this, "_preComputingStatus$", new
|
|
570
|
+
m(this, "_preComputingStatus$", new w0(
|
|
571
571
|
"preComputingStart"
|
|
572
572
|
/* preComputingStart */
|
|
573
573
|
));
|
|
@@ -577,7 +577,7 @@ class F2 {
|
|
|
577
577
|
*/
|
|
578
578
|
m(this, "_preComputingCache");
|
|
579
579
|
m(this, "_rule");
|
|
580
|
-
this._context = r, this._cache = new
|
|
580
|
+
this._context = r, this._cache = new N2(r.limit), this._rule = r.rule, this._preComputingCache = null, this._initClearCacheListener();
|
|
581
581
|
}
|
|
582
582
|
setCacheLength(r) {
|
|
583
583
|
this._cache.limit = r;
|
|
@@ -634,47 +634,47 @@ class F2 {
|
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
class $0 extends
|
|
637
|
+
class $0 extends m2 {
|
|
638
638
|
preComputing(r, t, e) {
|
|
639
|
-
const n = e.rule, i = e.worksheet, a = new
|
|
639
|
+
const n = e.rule, i = e.worksheet, a = new O();
|
|
640
640
|
!n.rule.config.every((d) => d.value.type === L.num) && w2(n.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
|
|
641
|
-
|
|
641
|
+
U.foreach(u, (h, g) => {
|
|
642
642
|
const f = e.getCellValue(h, g), D = f && f.v;
|
|
643
|
-
if (!
|
|
644
|
-
const
|
|
645
|
-
!Number.isNaN(
|
|
643
|
+
if (!_(D) && (f == null ? void 0 : f.t) === y.NUMBER) {
|
|
644
|
+
const w = Number(D);
|
|
645
|
+
!Number.isNaN(w) && a.setValue(h, g, w);
|
|
646
646
|
}
|
|
647
647
|
});
|
|
648
648
|
});
|
|
649
|
-
const
|
|
649
|
+
const o = [...n.rule.config].sort((d, u) => d.index - u.index).map((d) => ({
|
|
650
650
|
value: g2(d.value, a, {
|
|
651
651
|
...e,
|
|
652
652
|
cfId: n.cfId
|
|
653
653
|
}),
|
|
654
|
-
color: new
|
|
654
|
+
color: new T2(d.color)
|
|
655
655
|
}));
|
|
656
|
-
if (!
|
|
657
|
-
const d =
|
|
656
|
+
if (!o.some((d) => y0(d.value) ? d.value.status !== p.SUCCESS : !1)) {
|
|
657
|
+
const d = o.map((u) => u.color).reduce((u, h, g) => (u.result.push({ color: h, value: u.sortValue[g] }), u), {
|
|
658
658
|
result: [],
|
|
659
|
-
sortValue:
|
|
659
|
+
sortValue: o.map((u) => u.value.result).sort((u, h) => u - h)
|
|
660
660
|
}).result;
|
|
661
|
-
this.setPreComputingCache(d), this._preComputingStatus$.next(
|
|
661
|
+
this.setPreComputingCache(d), this._preComputingStatus$.next(V.preComputingEnd);
|
|
662
662
|
return;
|
|
663
663
|
}
|
|
664
|
-
this._preComputingStatus$.next(
|
|
664
|
+
this._preComputingStatus$.next(V.preComputing);
|
|
665
665
|
}
|
|
666
666
|
getCellResult(r, t, e, n) {
|
|
667
667
|
if (!e)
|
|
668
668
|
return null;
|
|
669
669
|
const i = n.getCellValue(r, t);
|
|
670
|
-
if (i.t ===
|
|
670
|
+
if (i.t === y.NUMBER) {
|
|
671
671
|
const a = Number(i.v);
|
|
672
672
|
if (!Number.isNaN(a))
|
|
673
673
|
return n1(e, a);
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
-
const P0 = "sheet-conditional-rule-data-bar",
|
|
677
|
+
const P0 = "sheet-conditional-rule-data-bar", S2 = "#ffbe38", b2 = "#abd91a", W0 = "#000", q0 = 34, Z0 = (s) => {
|
|
678
678
|
const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
|
|
679
679
|
return `${r}-${t}-${e}-${n}`;
|
|
680
680
|
};
|
|
@@ -693,72 +693,72 @@ class G0 extends $2 {
|
|
|
693
693
|
if (!a)
|
|
694
694
|
return !1;
|
|
695
695
|
const c = /* @__PURE__ */ new Set();
|
|
696
|
-
t.save(),
|
|
697
|
-
if (!a.getRowVisible(
|
|
696
|
+
t.save(), U.foreach(n.rowColumnSegment, (o, l) => {
|
|
697
|
+
if (!a.getRowVisible(o) || !a.getColVisible(l))
|
|
698
698
|
return;
|
|
699
|
-
const d = n.getCellWithCoordByIndex(
|
|
700
|
-
let f = a.getCell(
|
|
699
|
+
const d = n.getCellWithCoordByIndex(o, l, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
|
|
700
|
+
let f = a.getCell(o, l);
|
|
701
701
|
if (u && (f = a.getCell(g.startRow, g.startColumn)), !(f != null && f.dataBar) || !this.isRenderDiffRangesByCell(g, i))
|
|
702
702
|
return;
|
|
703
703
|
if (u || h) {
|
|
704
|
-
const
|
|
705
|
-
if (c.has(
|
|
704
|
+
const P = Z0(g);
|
|
705
|
+
if (c.has(P))
|
|
706
706
|
return;
|
|
707
|
-
c.add(
|
|
707
|
+
c.add(P);
|
|
708
708
|
}
|
|
709
|
-
const { color: D, value:
|
|
710
|
-
if (
|
|
711
|
-
const
|
|
709
|
+
const { color: D, value: w, startPoint: E, isGradient: I } = f.dataBar, { startX: A, endX: S, startY: B, endY: F2 } = u || h ? g : d, o2 = S - A, v2 = F2 + M0 - B, G = o2 - this._paddingRightAndLeft * 2, y2 = v2 - this._paddingTopAndBottom * 2;
|
|
710
|
+
if (w > 0) {
|
|
711
|
+
const P = Math.max(G * (1 - E / 100) * w / 100, 1), H = A + this._paddingRightAndLeft + E / 100 * G, j = B + this._paddingTopAndBottom;
|
|
712
712
|
if (I) {
|
|
713
|
-
const
|
|
714
|
-
|
|
713
|
+
const K = t.createLinearGradient(H, j, H + P, j);
|
|
714
|
+
K.addColorStop(0, D), K.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = K, t.strokeStyle = D, t.lineWidth = 1;
|
|
715
715
|
} else
|
|
716
716
|
t.fillStyle = D;
|
|
717
|
-
this._drawRectWithRoundedCorner(t,
|
|
717
|
+
this._drawRectWithRoundedCorner(t, H, j, P, y2, !1, !0, !0, !1), I && t.stroke();
|
|
718
718
|
} else {
|
|
719
|
-
const
|
|
719
|
+
const P = Math.max(G * E / 100 * Math.abs(w) / 100, 1), H = A + this._paddingRightAndLeft + E / 100 * G - P, j = B + this._paddingTopAndBottom;
|
|
720
720
|
if (I) {
|
|
721
|
-
const
|
|
722
|
-
|
|
721
|
+
const K = t.createLinearGradient(H, j, H + P, j);
|
|
722
|
+
K.addColorStop(0, "rgb(255 255 255)"), K.addColorStop(1, D), t.fillStyle = K, t.strokeStyle = D, t.lineWidth = 1;
|
|
723
723
|
} else
|
|
724
724
|
t.fillStyle = D;
|
|
725
|
-
this._drawRectWithRoundedCorner(t,
|
|
725
|
+
this._drawRectWithRoundedCorner(t, H, j, P, y2, !0, !1, !1, !0), I && t.stroke();
|
|
726
726
|
}
|
|
727
727
|
}), t.restore();
|
|
728
728
|
}
|
|
729
|
-
_drawRectWithRoundedCorner(t, e, n, i, a, c,
|
|
729
|
+
_drawRectWithRoundedCorner(t, e, n, i, a, c, o, l, d) {
|
|
730
730
|
const u = this._radius;
|
|
731
|
-
!a || !i || (t.beginPath(), t.moveTo(e + u, n), t.lineTo(e + i - u, n),
|
|
731
|
+
!a || !i || (t.beginPath(), t.moveTo(e + u, n), t.lineTo(e + i - u, n), o ? t.arcTo(e + i, n, e + i, n + u, u) : t.lineTo(e + i, n), t.lineTo(e + i, n + a - u), l ? t.arcTo(e + i, n + a, e + i - u, n + a, u) : t.lineTo(e + i, n + a), t.lineTo(e + u, n + a), d ? t.arcTo(e, n + a, e, n + a - u, u) : t.lineTo(e, n + a), t.lineTo(e, n + u), c ? t.arcTo(e, n, e + u, n, u) : t.lineTo(e, n), t.closePath(), t.fill());
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
O2.add(G0);
|
|
735
735
|
const u2 = (s) => Math.max(Math.min(100, s), 0), H0 = (s, r, t) => {
|
|
736
736
|
const e = t(s, r);
|
|
737
|
-
if (e && e.t ===
|
|
737
|
+
if (e && e.t === y.NUMBER) {
|
|
738
738
|
const n = Number(e.v);
|
|
739
739
|
return Number.isNaN(n) ? null : n;
|
|
740
740
|
}
|
|
741
741
|
return null;
|
|
742
742
|
};
|
|
743
|
-
class j0 extends
|
|
743
|
+
class j0 extends m2 {
|
|
744
744
|
preComputing(r, t, e) {
|
|
745
|
-
const n = e.rule, i = n.rule, a = e.worksheet, c = new
|
|
745
|
+
const n = e.rule, i = n.rule, a = e.worksheet, c = new O();
|
|
746
746
|
![n.rule.config.max, n.rule.config.min].every((g) => g.type === L.num) && w2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((f) => {
|
|
747
|
-
|
|
748
|
-
const E = e.getCellValue(D,
|
|
749
|
-
if (!
|
|
747
|
+
U.foreach(f, (D, w) => {
|
|
748
|
+
const E = e.getCellValue(D, w), I = E && E.v;
|
|
749
|
+
if (!_(I) && (E == null ? void 0 : E.t) === y.NUMBER) {
|
|
750
750
|
const A = Number(I);
|
|
751
|
-
!Number.isNaN(A) && c.setValue(D,
|
|
751
|
+
!Number.isNaN(A) && c.setValue(D, w, A);
|
|
752
752
|
}
|
|
753
753
|
});
|
|
754
754
|
});
|
|
755
|
-
const
|
|
755
|
+
const l = g2(i.config.min, c, { ...e, cfId: n.cfId }), d = g2(i.config.max, c, { ...e, cfId: n.cfId });
|
|
756
756
|
let u = 0, h = 0;
|
|
757
|
-
if (
|
|
758
|
-
const g = Number(
|
|
757
|
+
if (l.status === p.SUCCESS) {
|
|
758
|
+
const g = Number(l.result);
|
|
759
759
|
u = Number.isNaN(g) ? 0 : g;
|
|
760
760
|
} else {
|
|
761
|
-
this._preComputingStatus$.next(
|
|
761
|
+
this._preComputingStatus$.next(V.preComputing);
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
764
764
|
if (d.status === p.SUCCESS) {
|
|
@@ -768,94 +768,94 @@ class j0 extends F2 {
|
|
|
768
768
|
if (u < 0 && h <= 0)
|
|
769
769
|
D = 100;
|
|
770
770
|
else if (u < 0 && h > 0) {
|
|
771
|
-
const
|
|
772
|
-
D = Math.abs(u) /
|
|
771
|
+
const w = Math.abs(h) + Math.abs(u);
|
|
772
|
+
D = Math.abs(u) / w * 100;
|
|
773
773
|
} else u >= 0 && h > 0 && (D = 0);
|
|
774
|
-
this.setPreComputingCache({ min: u, max: h, startPoint: D }), this._preComputingStatus$.next(
|
|
774
|
+
this.setPreComputingCache({ min: u, max: h, startPoint: D }), this._preComputingStatus$.next(V.preComputingEnd);
|
|
775
775
|
return;
|
|
776
776
|
}
|
|
777
|
-
this._preComputingStatus$.next(
|
|
777
|
+
this._preComputingStatus$.next(V.preComputing);
|
|
778
778
|
}
|
|
779
779
|
// eslint-disable-next-line complexity
|
|
780
780
|
getCellResult(r, t, e, n) {
|
|
781
|
-
const { min: i, max: a, startPoint: c } = e,
|
|
781
|
+
const { min: i, max: a, startPoint: c } = e, l = n.rule.rule, d = l.isShowValue, u = l.config.isGradient, h = H0(r, t, n.getCellValue);
|
|
782
782
|
if (!(h === null || h < i || i === a || a < i)) {
|
|
783
783
|
if (h === 0)
|
|
784
784
|
return { color: W0, startPoint: c, value: 0, isGradient: u, isShowValue: d };
|
|
785
785
|
if (i < 0 && a <= 0) {
|
|
786
786
|
const g = a - i, f = u2((a - h) / g * 100);
|
|
787
|
-
return f === 0 ? void 0 : { color:
|
|
787
|
+
return f === 0 ? void 0 : { color: l.config.nativeColor || b2, startPoint: c, value: -f, isGradient: u, isShowValue: d };
|
|
788
788
|
} else if (i < 0 && a > 0)
|
|
789
789
|
if (h > 0) {
|
|
790
790
|
const g = u2(Math.min(h / a, 1) * 100);
|
|
791
|
-
return g === 0 ? void 0 : { color:
|
|
791
|
+
return g === 0 ? void 0 : { color: l.config.positiveColor || S2, startPoint: c, value: g, isGradient: u, isShowValue: d };
|
|
792
792
|
} else {
|
|
793
793
|
const g = u2(Math.min(Math.abs(h) / Math.abs(i), 1) * 100);
|
|
794
|
-
return g === 0 ? void 0 : { color:
|
|
794
|
+
return g === 0 ? void 0 : { color: l.config.nativeColor || b2, startPoint: c, value: -g, isGradient: u, isShowValue: d };
|
|
795
795
|
}
|
|
796
796
|
else if (i >= 0 && a > 0) {
|
|
797
797
|
const g = a - i, f = 0, D = u2((1 - (a - h) / g) * 100);
|
|
798
|
-
return D === 0 ? void 0 : { color:
|
|
798
|
+
return D === 0 ? void 0 : { color: l.config.positiveColor || S2, startPoint: f, value: D, isGradient: u, isShowValue: d };
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
|
-
class
|
|
803
|
+
class K0 extends m2 {
|
|
804
804
|
// eslint-disable-next-line max-lines-per-function
|
|
805
805
|
preComputing(r, t, e) {
|
|
806
806
|
const n = e.rule.rule, i = w2(e.rule.ranges, e.worksheet.getMaxRows() - 1, e.worksheet.getMaxColumns() - 1), c = (() => {
|
|
807
807
|
switch (n.subType) {
|
|
808
|
-
case
|
|
809
|
-
let
|
|
808
|
+
case x.average: {
|
|
809
|
+
let o = 0, l = 0;
|
|
810
810
|
return i.forEach((d) => {
|
|
811
|
-
|
|
812
|
-
const g = e.getCellValue(u, h), f =
|
|
813
|
-
g && g.t ===
|
|
811
|
+
U.foreach(d, (u, h) => {
|
|
812
|
+
const g = e.getCellValue(u, h), f = W(g);
|
|
813
|
+
g && g.t === y.NUMBER && !_(f) && (o += Number(f) || 0, l++);
|
|
814
814
|
});
|
|
815
|
-
}), { value:
|
|
815
|
+
}), { value: o / l, type: n.subType };
|
|
816
816
|
}
|
|
817
|
-
case
|
|
818
|
-
case
|
|
819
|
-
const
|
|
820
|
-
return i.forEach((
|
|
821
|
-
|
|
822
|
-
const h = e.getCellValue(d, u), g =
|
|
823
|
-
if (!
|
|
824
|
-
const f =
|
|
825
|
-
f ?
|
|
817
|
+
case x.uniqueValues:
|
|
818
|
+
case x.duplicateValues: {
|
|
819
|
+
const o = /* @__PURE__ */ new Map();
|
|
820
|
+
return i.forEach((l) => {
|
|
821
|
+
U.foreach(l, (d, u) => {
|
|
822
|
+
const h = e.getCellValue(d, u), g = W(h);
|
|
823
|
+
if (!_(g)) {
|
|
824
|
+
const f = o.get(g);
|
|
825
|
+
f ? o.set(g, f + 1) : o.set(g, 1);
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
}), { value:
|
|
828
|
+
}), { value: o, type: n.subType };
|
|
829
829
|
}
|
|
830
|
-
case
|
|
831
|
-
let
|
|
830
|
+
case x.rank: {
|
|
831
|
+
let o = [];
|
|
832
832
|
i.forEach((u) => {
|
|
833
|
-
|
|
834
|
-
const f = e.getCellValue(h, g), D =
|
|
835
|
-
f && f.t ===
|
|
833
|
+
U.foreach(u, (h, g) => {
|
|
834
|
+
const f = e.getCellValue(h, g), D = W(f);
|
|
835
|
+
f && f.t === y.NUMBER && !_(D) && o.push(Number(D) || 0);
|
|
836
836
|
});
|
|
837
|
-
}),
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
|
|
841
|
-
const u =
|
|
842
|
-
return { value:
|
|
837
|
+
}), o.sort((u, h) => h - u);
|
|
838
|
+
const l = e.rule.rule;
|
|
839
|
+
if (l.isPercent) {
|
|
840
|
+
l.isBottom && (o = o.toReversed());
|
|
841
|
+
const u = z.clamp(l.value, 0, 100) / 100, h = Math.floor(u * o.length), g = z.clamp(h - 1, 0, o.length - 1);
|
|
842
|
+
return { value: o[g], type: n.subType };
|
|
843
843
|
}
|
|
844
|
-
const d = Math.floor(
|
|
845
|
-
return
|
|
844
|
+
const d = Math.floor(z.clamp(l.isBottom ? l.value - 1 : l.value, 0, o.length));
|
|
845
|
+
return l.isBottom ? { value: o[o.length - d - 1], type: n.subType } : { value: o[Math.max(d - 1, 0)], type: n.subType };
|
|
846
846
|
}
|
|
847
|
-
case
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
const d =
|
|
851
|
-
return d && d.status === p.SUCCESS ? (this._preComputingStatus$.next(
|
|
847
|
+
case x.formula: {
|
|
848
|
+
const o = n, l = e.accessor.get(Q);
|
|
849
|
+
l.registerFormulaWithRange(e.unitId, e.subUnitId, e.rule.cfId, o.value, e.rule.ranges);
|
|
850
|
+
const d = l.getFormulaMatrix(e.unitId, e.subUnitId, e.rule.cfId, o.value);
|
|
851
|
+
return d && d.status === p.SUCCESS ? (this._preComputingStatus$.next(V.preComputingEnd), {
|
|
852
852
|
value: d.result,
|
|
853
853
|
type: n.subType
|
|
854
|
-
}) : (this._preComputingStatus$.next(
|
|
854
|
+
}) : (this._preComputingStatus$.next(V.preComputing), null);
|
|
855
855
|
}
|
|
856
|
-
case
|
|
856
|
+
case x.timePeriod:
|
|
857
857
|
switch (n.operator) {
|
|
858
|
-
case
|
|
858
|
+
case T.last7Days:
|
|
859
859
|
return {
|
|
860
860
|
value: {
|
|
861
861
|
start: v().subtract(7, "day").valueOf(),
|
|
@@ -863,7 +863,7 @@ class X0 extends F2 {
|
|
|
863
863
|
},
|
|
864
864
|
type: n.subType
|
|
865
865
|
};
|
|
866
|
-
case
|
|
866
|
+
case T.lastMonth:
|
|
867
867
|
return {
|
|
868
868
|
value: {
|
|
869
869
|
start: v().startOf("month").subtract(1, "month").valueOf(),
|
|
@@ -871,7 +871,7 @@ class X0 extends F2 {
|
|
|
871
871
|
},
|
|
872
872
|
type: n.subType
|
|
873
873
|
};
|
|
874
|
-
case
|
|
874
|
+
case T.lastWeek:
|
|
875
875
|
return {
|
|
876
876
|
value: {
|
|
877
877
|
start: v().startOf("week").subtract(1, "week").valueOf(),
|
|
@@ -879,7 +879,7 @@ class X0 extends F2 {
|
|
|
879
879
|
},
|
|
880
880
|
type: n.subType
|
|
881
881
|
};
|
|
882
|
-
case
|
|
882
|
+
case T.nextMonth:
|
|
883
883
|
return {
|
|
884
884
|
value: {
|
|
885
885
|
start: v().startOf("month").add(1, "month").valueOf(),
|
|
@@ -887,7 +887,7 @@ class X0 extends F2 {
|
|
|
887
887
|
},
|
|
888
888
|
type: n.subType
|
|
889
889
|
};
|
|
890
|
-
case
|
|
890
|
+
case T.nextWeek:
|
|
891
891
|
return {
|
|
892
892
|
value: {
|
|
893
893
|
start: v().startOf("week").add(1, "week").valueOf(),
|
|
@@ -895,7 +895,7 @@ class X0 extends F2 {
|
|
|
895
895
|
},
|
|
896
896
|
type: n.subType
|
|
897
897
|
};
|
|
898
|
-
case
|
|
898
|
+
case T.thisMonth:
|
|
899
899
|
return {
|
|
900
900
|
value: {
|
|
901
901
|
start: v().startOf("month").valueOf(),
|
|
@@ -903,7 +903,7 @@ class X0 extends F2 {
|
|
|
903
903
|
},
|
|
904
904
|
type: n.subType
|
|
905
905
|
};
|
|
906
|
-
case
|
|
906
|
+
case T.thisWeek:
|
|
907
907
|
return {
|
|
908
908
|
value: {
|
|
909
909
|
start: v().startOf("week").valueOf(),
|
|
@@ -911,7 +911,7 @@ class X0 extends F2 {
|
|
|
911
911
|
},
|
|
912
912
|
type: n.subType
|
|
913
913
|
};
|
|
914
|
-
case
|
|
914
|
+
case T.today:
|
|
915
915
|
return {
|
|
916
916
|
value: {
|
|
917
917
|
start: v().startOf("day").valueOf(),
|
|
@@ -919,7 +919,7 @@ class X0 extends F2 {
|
|
|
919
919
|
},
|
|
920
920
|
type: n.subType
|
|
921
921
|
};
|
|
922
|
-
case
|
|
922
|
+
case T.tomorrow:
|
|
923
923
|
return {
|
|
924
924
|
value: {
|
|
925
925
|
start: v().startOf("day").add(1, "day").valueOf(),
|
|
@@ -927,7 +927,7 @@ class X0 extends F2 {
|
|
|
927
927
|
},
|
|
928
928
|
type: n.subType
|
|
929
929
|
};
|
|
930
|
-
case
|
|
930
|
+
case T.yesterday:
|
|
931
931
|
return {
|
|
932
932
|
value: {
|
|
933
933
|
start: v().startOf("day").subtract(1, "day").valueOf(),
|
|
@@ -945,91 +945,91 @@ class X0 extends F2 {
|
|
|
945
945
|
const i = n.getCellValue(r, t), a = n.rule.rule;
|
|
946
946
|
return (() => {
|
|
947
947
|
switch (a.subType) {
|
|
948
|
-
case
|
|
949
|
-
const
|
|
950
|
-
return d ?
|
|
948
|
+
case x.number: {
|
|
949
|
+
const l = i && Number(i.v), d = (i == null ? void 0 : i.t) === y.NUMBER, u = a;
|
|
950
|
+
return d ? _(l) || Number.isNaN(l) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, l || 0) : !![F.notEqual, F.notBetween].includes(u.operator);
|
|
951
951
|
}
|
|
952
|
-
case
|
|
953
|
-
const
|
|
954
|
-
switch (
|
|
955
|
-
case
|
|
952
|
+
case x.text: {
|
|
953
|
+
const l = a, d = W(i), u = _(d) ? "" : String(d), h = l.value || "";
|
|
954
|
+
switch (l.operator) {
|
|
955
|
+
case N.beginsWith:
|
|
956
956
|
return u.startsWith(h);
|
|
957
|
-
case
|
|
957
|
+
case N.containsBlanks:
|
|
958
958
|
return /^\s*$/.test(u);
|
|
959
|
-
case
|
|
959
|
+
case N.notContainsBlanks:
|
|
960
960
|
return !/^\s*$/.test(u);
|
|
961
|
-
case
|
|
962
|
-
return
|
|
963
|
-
case
|
|
964
|
-
return !
|
|
965
|
-
case
|
|
961
|
+
case N.containsErrors:
|
|
962
|
+
return M2.has(u);
|
|
963
|
+
case N.notContainsErrors:
|
|
964
|
+
return !M2.has(u);
|
|
965
|
+
case N.containsText:
|
|
966
966
|
return u.indexOf(h) > -1;
|
|
967
|
-
case
|
|
967
|
+
case N.notContainsText:
|
|
968
968
|
return u.indexOf(h) === -1;
|
|
969
|
-
case
|
|
969
|
+
case N.endsWith:
|
|
970
970
|
return u.endsWith(h);
|
|
971
|
-
case
|
|
971
|
+
case N.equal:
|
|
972
972
|
return u === h;
|
|
973
|
-
case
|
|
973
|
+
case N.notEqual:
|
|
974
974
|
return u !== h;
|
|
975
975
|
default:
|
|
976
976
|
return !1;
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
case
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
979
|
+
case x.timePeriod: {
|
|
980
|
+
const l = W(i);
|
|
981
|
+
if (_(l) || Number.isNaN(Number(l)) || (i == null ? void 0 : i.t) !== y.NUMBER || !e)
|
|
982
982
|
return;
|
|
983
|
-
const d = e1(Number(
|
|
983
|
+
const d = e1(Number(l)), { start: u, end: h } = e.value;
|
|
984
984
|
return d >= u && d <= h;
|
|
985
985
|
}
|
|
986
|
-
case
|
|
987
|
-
const
|
|
986
|
+
case x.average: {
|
|
987
|
+
const l = i && i.v, d = Number(l), u = (i == null ? void 0 : i.t) === y.NUMBER, h = a;
|
|
988
988
|
if (!u)
|
|
989
|
-
return
|
|
990
|
-
if (
|
|
989
|
+
return F.notEqual === h.operator;
|
|
990
|
+
if (_(l) || Number.isNaN(d) || !e)
|
|
991
991
|
return !1;
|
|
992
992
|
const g = e.value;
|
|
993
993
|
switch (h.operator) {
|
|
994
|
-
case
|
|
994
|
+
case F.greaterThan:
|
|
995
995
|
return d > g;
|
|
996
|
-
case
|
|
996
|
+
case F.greaterThanOrEqual:
|
|
997
997
|
return d >= g;
|
|
998
|
-
case
|
|
998
|
+
case F.lessThan:
|
|
999
999
|
return d < g;
|
|
1000
|
-
case
|
|
1000
|
+
case F.lessThanOrEqual:
|
|
1001
1001
|
return d <= g;
|
|
1002
|
-
case
|
|
1002
|
+
case F.equal:
|
|
1003
1003
|
return h2(d, g);
|
|
1004
|
-
case
|
|
1004
|
+
case F.notEqual:
|
|
1005
1005
|
return !h2(d, g);
|
|
1006
1006
|
default:
|
|
1007
1007
|
return !1;
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
case
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1010
|
+
case x.rank: {
|
|
1011
|
+
const l = W(i), d = Number(l);
|
|
1012
|
+
if (_(l) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== y.NUMBER || !e)
|
|
1013
1013
|
return !1;
|
|
1014
1014
|
const u = e.value;
|
|
1015
1015
|
return a.isBottom ? d <= u : d >= u;
|
|
1016
1016
|
}
|
|
1017
|
-
case
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1017
|
+
case x.uniqueValues: {
|
|
1018
|
+
const l = W(i);
|
|
1019
|
+
return _(l) || !e ? !1 : e.value.get(l) === 1;
|
|
1020
1020
|
}
|
|
1021
|
-
case
|
|
1022
|
-
const
|
|
1023
|
-
if (
|
|
1021
|
+
case x.duplicateValues: {
|
|
1022
|
+
const l = W(i);
|
|
1023
|
+
if (_(l) || !e)
|
|
1024
1024
|
return !1;
|
|
1025
|
-
const d = e.value.get(
|
|
1025
|
+
const d = e.value.get(l);
|
|
1026
1026
|
return d && d !== 1;
|
|
1027
1027
|
}
|
|
1028
|
-
case
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1028
|
+
case x.formula: {
|
|
1029
|
+
const l = e == null ? void 0 : e.value;
|
|
1030
|
+
if (l) {
|
|
1031
1031
|
const d = n.rule.ranges[0], u = r - d.startRow, h = t - d.startColumn;
|
|
1032
|
-
return
|
|
1032
|
+
return l.getValue(u, h) === !0;
|
|
1033
1033
|
}
|
|
1034
1034
|
return !1;
|
|
1035
1035
|
}
|
|
@@ -1037,29 +1037,29 @@ class X0 extends F2 {
|
|
|
1037
1037
|
})() ? a.style : {};
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
const
|
|
1040
|
+
const Y0 = (s, r, t) => {
|
|
1041
1041
|
const e = t(s, r);
|
|
1042
|
-
if (e && e.t ===
|
|
1042
|
+
if (e && e.t === y.NUMBER) {
|
|
1043
1043
|
const n = Number(e.v);
|
|
1044
1044
|
return Number.isNaN(n) ? null : n;
|
|
1045
1045
|
}
|
|
1046
1046
|
return null;
|
|
1047
1047
|
};
|
|
1048
|
-
class
|
|
1048
|
+
class X0 extends m2 {
|
|
1049
1049
|
preComputing(r, t, e) {
|
|
1050
|
-
const n = e.rule.rule, i = e.worksheet, a = new
|
|
1050
|
+
const n = e.rule.rule, i = e.worksheet, a = new O();
|
|
1051
1051
|
!n.config.every((d) => d.value.type === L.num) && w2(e.rule.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
|
|
1052
|
-
|
|
1052
|
+
U.foreach(u, (h, g) => {
|
|
1053
1053
|
const f = e.getCellValue(h, g), D = f && f.v;
|
|
1054
|
-
if (!
|
|
1055
|
-
const
|
|
1056
|
-
!Number.isNaN(
|
|
1054
|
+
if (!_(D) && (f == null ? void 0 : f.t) === y.NUMBER) {
|
|
1055
|
+
const w = Number(D);
|
|
1056
|
+
!Number.isNaN(w) && a.setValue(h, g, w);
|
|
1057
1057
|
}
|
|
1058
1058
|
});
|
|
1059
1059
|
});
|
|
1060
|
-
const
|
|
1061
|
-
if (!
|
|
1062
|
-
const d =
|
|
1060
|
+
const o = n.config.map((d) => g2(d.value, a, { ...e, cfId: e.rule.cfId }));
|
|
1061
|
+
if (!o.some((d) => d.status !== p.SUCCESS)) {
|
|
1062
|
+
const d = o.map((u, h) => ({
|
|
1063
1063
|
operator: n.config[h].operator,
|
|
1064
1064
|
value: Number(u.result) || 0
|
|
1065
1065
|
})).reduce((u, h, g, f) => {
|
|
@@ -1067,33 +1067,33 @@ class Y0 extends F2 {
|
|
|
1067
1067
|
if (!g || g === f.length - 1)
|
|
1068
1068
|
u.push({ ...h, iconId: D.iconId, iconType: D.iconType });
|
|
1069
1069
|
else {
|
|
1070
|
-
const
|
|
1071
|
-
r2(
|
|
1070
|
+
const w = f[g - 1];
|
|
1071
|
+
r2(w, h.value) || u.push({ ...h, iconId: D.iconId, iconType: D.iconType });
|
|
1072
1072
|
}
|
|
1073
1073
|
return u;
|
|
1074
1074
|
}, []);
|
|
1075
|
-
this.setPreComputingCache(d), this._preComputingStatus$.next(
|
|
1075
|
+
this.setPreComputingCache(d), this._preComputingStatus$.next(V.preComputingEnd);
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
|
-
this._preComputingStatus$.next(
|
|
1078
|
+
this._preComputingStatus$.next(V.preComputing);
|
|
1079
1079
|
}
|
|
1080
1080
|
getCellResult(r, t, e, n) {
|
|
1081
1081
|
if (!e)
|
|
1082
1082
|
return null;
|
|
1083
|
-
const i =
|
|
1083
|
+
const i = Y0(r, t, n.getCellValue);
|
|
1084
1084
|
if (i === null)
|
|
1085
1085
|
return;
|
|
1086
1086
|
const a = n.rule.rule, c = a.isShowValue === void 0 ? !0 : !!a.isShowValue;
|
|
1087
|
-
for (let
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1090
|
-
if (r2(
|
|
1087
|
+
for (let o = 0; o < e.length; o++) {
|
|
1088
|
+
const l = e[o], d = { ...l }, u = { ...l }, { iconId: h, iconType: g } = l;
|
|
1089
|
+
if (o === 0) {
|
|
1090
|
+
if (r2(l, i))
|
|
1091
1091
|
return { iconId: h, iconType: g, isShowValue: c };
|
|
1092
1092
|
} else {
|
|
1093
|
-
if (
|
|
1093
|
+
if (o === e.length - 1)
|
|
1094
1094
|
return { iconId: h, iconType: g, isShowValue: c };
|
|
1095
1095
|
{
|
|
1096
|
-
const f = e[
|
|
1096
|
+
const f = e[o - 1];
|
|
1097
1097
|
if (u.operator = t1(f.operator), u.value = f.value, r2(d, i) && r2(u, i))
|
|
1098
1098
|
return { iconId: h, iconType: g, isShowValue: c };
|
|
1099
1099
|
}
|
|
@@ -1106,17 +1106,17 @@ var J0 = Object.getOwnPropertyDescriptor, z0 = (s, r, t, e) => {
|
|
|
1106
1106
|
(a = s[i]) && (n = a(n) || n);
|
|
1107
1107
|
return n;
|
|
1108
1108
|
}, c2 = (s, r) => (t, e) => r(t, e, s);
|
|
1109
|
-
const
|
|
1110
|
-
let
|
|
1109
|
+
const p2 = 1e3 * 3 * 3;
|
|
1110
|
+
let e2 = class extends x2 {
|
|
1111
1111
|
constructor(r, t, e, n) {
|
|
1112
1112
|
super();
|
|
1113
1113
|
// Map<unitID ,<sheetId ,ObjectMatrix>>
|
|
1114
1114
|
m(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
|
|
1115
|
-
m(this, "_rTreeManager", new
|
|
1115
|
+
m(this, "_rTreeManager", new X2());
|
|
1116
1116
|
/**
|
|
1117
1117
|
* 1nd-level cache
|
|
1118
1118
|
*/
|
|
1119
|
-
m(this, "_cellCache", new
|
|
1119
|
+
m(this, "_cellCache", new N2(p2));
|
|
1120
1120
|
m(this, "_markDirty$", new d2());
|
|
1121
1121
|
/**
|
|
1122
1122
|
* The rendering layer listens to this variable to determine whether a reRender is necessary.
|
|
@@ -1150,13 +1150,13 @@ let Q = class extends x2 {
|
|
|
1150
1150
|
*/
|
|
1151
1151
|
m(this, "markRuleDirty", (() => {
|
|
1152
1152
|
const r = new d2();
|
|
1153
|
-
return this.disposeWithMe(r.pipe(A0(100),
|
|
1153
|
+
return this.disposeWithMe(r.pipe(A0(100), x0((t) => !!t.length), _0((t) => {
|
|
1154
1154
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
1155
1155
|
return t.forEach((i) => {
|
|
1156
1156
|
const a = `${i.unitId}_${i.subUnitId}_${i.cfId}`;
|
|
1157
1157
|
if (e.has(a)) {
|
|
1158
1158
|
if (i.isNeedResetPreComputingCache) {
|
|
1159
|
-
const c = n.find((
|
|
1159
|
+
const c = n.find((o) => o.cfId === i.cfId);
|
|
1160
1160
|
c.isNeedResetPreComputingCache = !0;
|
|
1161
1161
|
}
|
|
1162
1162
|
return;
|
|
@@ -1189,8 +1189,8 @@ let Q = class extends x2 {
|
|
|
1189
1189
|
}
|
|
1190
1190
|
_getCellCfs(r, t, e, n) {
|
|
1191
1191
|
var d;
|
|
1192
|
-
const i = (d = this._conditionalFormattingRuleModel.getSubunitRules(r, t)) != null ? d : [], a = this._ensureCalculateUnitManager(r, t), c = this._rTreeManager.bulkSearch([{ unitId: r, sheetId: t, range: { startColumn: n, endColumn: n, startRow: e, endRow: e } }]),
|
|
1193
|
-
return
|
|
1192
|
+
const i = (d = this._conditionalFormattingRuleModel.getSubunitRules(r, t)) != null ? d : [], a = this._ensureCalculateUnitManager(r, t), c = this._rTreeManager.bulkSearch([{ unitId: r, sheetId: t, range: { startColumn: n, endColumn: n, startRow: e, endRow: e } }]), o = i.filter((u) => c.has(u.cfId));
|
|
1193
|
+
return o.length ? o.map((u) => {
|
|
1194
1194
|
const h = a.get(u.cfId);
|
|
1195
1195
|
return h ? {
|
|
1196
1196
|
cfId: u.cfId,
|
|
@@ -1199,14 +1199,17 @@ let Q = class extends x2 {
|
|
|
1199
1199
|
}).filter((u) => !!u).map((u, h) => ({ ...u, priority: h })) : [];
|
|
1200
1200
|
}
|
|
1201
1201
|
dispose() {
|
|
1202
|
-
this.
|
|
1202
|
+
this.clearCache(), super.dispose();
|
|
1203
|
+
}
|
|
1204
|
+
clearCache() {
|
|
1205
|
+
this._calculateUnitManagers.clear(), this._cellCache.clear(), this._rTreeManager.clear();
|
|
1203
1206
|
}
|
|
1204
1207
|
_handleCustomFormulasSeparately() {
|
|
1205
1208
|
this.disposeWithMe(
|
|
1206
1209
|
this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
|
|
1207
1210
|
if (r.type === "set") {
|
|
1208
1211
|
const { unitId: t, subUnitId: e } = r, n = r.oldRule;
|
|
1209
|
-
n.rule.type ===
|
|
1212
|
+
n.rule.type === M.highlightCell && n.rule.subType === x.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
|
|
1210
1213
|
}
|
|
1211
1214
|
})
|
|
1212
1215
|
);
|
|
@@ -1217,29 +1220,29 @@ let Q = class extends x2 {
|
|
|
1217
1220
|
const { unitId: t, subUnitId: e, rule: n } = r, { cfId: i, ranges: a } = n, c = this._ensureCalculateUnitManager(t, e);
|
|
1218
1221
|
switch (this.markRuleDirty(t, e, i), r.type) {
|
|
1219
1222
|
case "add": {
|
|
1220
|
-
this._rTreeManager.bulkInsert(a.map((
|
|
1221
|
-
const
|
|
1222
|
-
if (!
|
|
1223
|
+
this._rTreeManager.bulkInsert(a.map((l) => ({ unitId: t, sheetId: e, id: i, range: l })));
|
|
1224
|
+
const o = this._createRuleCalculateUnitInstance(t, e, n);
|
|
1225
|
+
if (!o)
|
|
1223
1226
|
return;
|
|
1224
|
-
c.set(n.cfId,
|
|
1227
|
+
c.set(n.cfId, o);
|
|
1225
1228
|
break;
|
|
1226
1229
|
}
|
|
1227
1230
|
case "delete": {
|
|
1228
|
-
this._rTreeManager.bulkRemove(a.map((
|
|
1231
|
+
this._rTreeManager.bulkRemove(a.map((o) => ({ unitId: t, sheetId: e, id: i, range: o }))), c.delete(n.cfId);
|
|
1229
1232
|
break;
|
|
1230
1233
|
}
|
|
1231
1234
|
case "set": {
|
|
1232
|
-
const
|
|
1233
|
-
if (this._rTreeManager.bulkRemove(
|
|
1234
|
-
const
|
|
1235
|
-
if (!
|
|
1235
|
+
const o = r.oldRule;
|
|
1236
|
+
if (this._rTreeManager.bulkRemove(o.ranges.map((l) => ({ unitId: t, sheetId: e, id: o.cfId, range: l }))), this._rTreeManager.bulkInsert(a.map((l) => ({ unitId: t, sheetId: e, id: i, range: l }))), o.rule.type !== n.rule.type) {
|
|
1237
|
+
const l = this._createRuleCalculateUnitInstance(t, e, n);
|
|
1238
|
+
if (!l)
|
|
1236
1239
|
return;
|
|
1237
|
-
c.delete(
|
|
1240
|
+
c.delete(o.cfId), c.set(n.cfId, l);
|
|
1238
1241
|
} else {
|
|
1239
|
-
const
|
|
1240
|
-
if (!
|
|
1242
|
+
const l = c.get(o.cfId);
|
|
1243
|
+
if (!l)
|
|
1241
1244
|
return;
|
|
1242
|
-
|
|
1245
|
+
l.updateRule(n);
|
|
1243
1246
|
}
|
|
1244
1247
|
}
|
|
1245
1248
|
}
|
|
@@ -1263,24 +1266,24 @@ let Q = class extends x2 {
|
|
|
1263
1266
|
subUnitId: t,
|
|
1264
1267
|
accessor: this._injector,
|
|
1265
1268
|
rule: e,
|
|
1266
|
-
limit:
|
|
1267
|
-
getCellValue: (c,
|
|
1269
|
+
limit: p2,
|
|
1270
|
+
getCellValue: (c, o) => i.getCellRaw(c, o) || {}
|
|
1268
1271
|
};
|
|
1269
1272
|
switch (e.rule.type) {
|
|
1270
|
-
case
|
|
1273
|
+
case M.colorScale:
|
|
1271
1274
|
return new $0(a);
|
|
1272
|
-
case
|
|
1275
|
+
case M.dataBar:
|
|
1273
1276
|
return new j0(a);
|
|
1274
|
-
case
|
|
1277
|
+
case M.highlightCell:
|
|
1278
|
+
return new K0(a);
|
|
1279
|
+
case M.iconSet:
|
|
1275
1280
|
return new X0(a);
|
|
1276
|
-
case y.iconSet:
|
|
1277
|
-
return new Y0(a);
|
|
1278
1281
|
}
|
|
1279
1282
|
}
|
|
1280
1283
|
_createCacheKey(r, t, e, n) {
|
|
1281
1284
|
return `${r}_${t}_${e}_${n}`;
|
|
1282
1285
|
}
|
|
1283
|
-
setCacheLength(r =
|
|
1286
|
+
setCacheLength(r = p2) {
|
|
1284
1287
|
this._cellCache.limit !== r && (this._cellCache.limit = r, this._calculateUnitManagers.forEach((t) => {
|
|
1285
1288
|
t.forEach((e) => {
|
|
1286
1289
|
e.forEach((n) => {
|
|
@@ -1290,24 +1293,24 @@ let Q = class extends x2 {
|
|
|
1290
1293
|
}));
|
|
1291
1294
|
}
|
|
1292
1295
|
};
|
|
1293
|
-
|
|
1294
|
-
c2(0, b(
|
|
1296
|
+
e2 = z0([
|
|
1297
|
+
c2(0, b(_2)),
|
|
1295
1298
|
c2(1, b(R)),
|
|
1296
|
-
c2(2, b(
|
|
1297
|
-
c2(3,
|
|
1298
|
-
],
|
|
1299
|
+
c2(2, b(Q)),
|
|
1300
|
+
c2(3, Z)
|
|
1301
|
+
], e2);
|
|
1299
1302
|
function h2(s, r) {
|
|
1300
1303
|
return Math.abs(s - r) < Number.EPSILON;
|
|
1301
1304
|
}
|
|
1302
|
-
const
|
|
1305
|
+
const _ = (s) => s == null || typeof s == "string" && s.trim() === "", W = (s) => {
|
|
1303
1306
|
var e, n;
|
|
1304
1307
|
if (!s)
|
|
1305
1308
|
return null;
|
|
1306
|
-
if (s.t ===
|
|
1307
|
-
return s.v ===
|
|
1309
|
+
if (s.t === y.BOOLEAN)
|
|
1310
|
+
return s.v === B2.TRUE ? R2.TRUE : R2.FALSE;
|
|
1308
1311
|
const r = s.v, t = (n = (e = s.p) == null ? void 0 : e.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "");
|
|
1309
|
-
return
|
|
1310
|
-
},
|
|
1312
|
+
return _(r) ? _(t) ? null : t : r;
|
|
1313
|
+
}, E2 = 86400;
|
|
1311
1314
|
function Q0(s, r = !0) {
|
|
1312
1315
|
if (r && s >= 0) {
|
|
1313
1316
|
if (s === 0)
|
|
@@ -1329,11 +1332,11 @@ function Q0(s, r = !0) {
|
|
|
1329
1332
|
}
|
|
1330
1333
|
const e1 = (s) => {
|
|
1331
1334
|
let r = s | 0;
|
|
1332
|
-
const t =
|
|
1335
|
+
const t = E2 * (s - r);
|
|
1333
1336
|
let e = Math.floor(t);
|
|
1334
|
-
t - e > 0.9999 && (e += 1, e ===
|
|
1335
|
-
const n = e < 0 ?
|
|
1336
|
-
return v(`${i}/${a}/${c} ${
|
|
1337
|
+
t - e > 0.9999 && (e += 1, e === E2 && (e = 0, r += 1));
|
|
1338
|
+
const n = e < 0 ? E2 + e : e, [i, a, c] = Q0(s, !0), o = Math.floor(n / 60 / 60) % 60, l = Math.floor(n / 60) % 60, d = Math.floor(n) % 60;
|
|
1339
|
+
return v(`${i}/${a}/${c} ${o}:${l}:${d}`).valueOf();
|
|
1337
1340
|
}, g2 = (s, r, t) => {
|
|
1338
1341
|
switch (s.type) {
|
|
1339
1342
|
case L.max: {
|
|
@@ -1356,8 +1359,8 @@ const e1 = (s) => {
|
|
|
1356
1359
|
}
|
|
1357
1360
|
case L.percent: {
|
|
1358
1361
|
let e, n;
|
|
1359
|
-
r.forValue((c,
|
|
1360
|
-
(e === void 0 || n === void 0) && (e =
|
|
1362
|
+
r.forValue((c, o, l) => {
|
|
1363
|
+
(e === void 0 || n === void 0) && (e = l, n = l), l > e && (e = l), l < n && (n = l);
|
|
1361
1364
|
});
|
|
1362
1365
|
const i = (e || 0) - (n || 0), a = Math.max(Math.min(Number(s.value) || 0, 100), 0);
|
|
1363
1366
|
return {
|
|
@@ -1366,15 +1369,15 @@ const e1 = (s) => {
|
|
|
1366
1369
|
};
|
|
1367
1370
|
}
|
|
1368
1371
|
case L.percentile: {
|
|
1369
|
-
const e = r.toNativeArray().sort((
|
|
1372
|
+
const e = r.toNativeArray().sort((l, d) => l - d), n = Math.max(Math.min(Number(s.value) || 0, 100), 0), i = (e.length - 1) * n / 100, a = Math.floor(i), c = i - a, o = e[a] + (e[Math.min(a + 1, e.length - 1)] - e[a]) * c;
|
|
1370
1373
|
return {
|
|
1371
1374
|
status: p.SUCCESS,
|
|
1372
|
-
result:
|
|
1375
|
+
result: o
|
|
1373
1376
|
};
|
|
1374
1377
|
}
|
|
1375
1378
|
case L.formula: {
|
|
1376
|
-
const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value),
|
|
1377
|
-
return
|
|
1379
|
+
const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value), o = e.get(Q);
|
|
1380
|
+
return o.registerFormulaWithRange(n, i, a, c), o.getFormulaResultWithCoords(n, i, a, c);
|
|
1378
1381
|
}
|
|
1379
1382
|
case L.num:
|
|
1380
1383
|
default: {
|
|
@@ -1385,52 +1388,52 @@ const e1 = (s) => {
|
|
|
1385
1388
|
};
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
1388
|
-
},
|
|
1389
|
-
const { accessor: n } = e, i = n.get(
|
|
1391
|
+
}, W1 = (s, r, t, e) => {
|
|
1392
|
+
const { accessor: n } = e, i = n.get(e2), a = new O();
|
|
1390
1393
|
return t.ranges.forEach((c) => {
|
|
1391
|
-
|
|
1392
|
-
const d = i.getCellCfs(s, r,
|
|
1394
|
+
U.foreach(c, (o, l) => {
|
|
1395
|
+
const d = i.getCellCfs(s, r, o, l);
|
|
1393
1396
|
if (d) {
|
|
1394
1397
|
const u = d.find((h) => h.cfId === t.cfId);
|
|
1395
|
-
u != null && u.result && a.setValue(
|
|
1398
|
+
u != null && u.result && a.setValue(o, l, u.result);
|
|
1396
1399
|
}
|
|
1397
1400
|
});
|
|
1398
1401
|
}), a;
|
|
1399
1402
|
}, r2 = (s, r) => {
|
|
1400
1403
|
switch (s.operator) {
|
|
1401
|
-
case
|
|
1404
|
+
case F.between: {
|
|
1402
1405
|
if (typeof s.value != "object" || !s.value.length)
|
|
1403
1406
|
return;
|
|
1404
1407
|
const t = Math.min(...s.value), e = Math.max(...s.value);
|
|
1405
1408
|
return r >= t && r <= e;
|
|
1406
1409
|
}
|
|
1407
|
-
case
|
|
1410
|
+
case F.notBetween: {
|
|
1408
1411
|
if (typeof s.value != "object" || !s.value.length)
|
|
1409
1412
|
return;
|
|
1410
1413
|
const t = Math.min(...s.value), e = Math.max(...s.value);
|
|
1411
1414
|
return !(r >= t && r <= e);
|
|
1412
1415
|
}
|
|
1413
|
-
case
|
|
1416
|
+
case F.equal: {
|
|
1414
1417
|
const t = s.value || 0;
|
|
1415
1418
|
return h2(t, r);
|
|
1416
1419
|
}
|
|
1417
|
-
case
|
|
1420
|
+
case F.notEqual: {
|
|
1418
1421
|
const t = s.value || 0;
|
|
1419
1422
|
return !h2(t, r);
|
|
1420
1423
|
}
|
|
1421
|
-
case
|
|
1424
|
+
case F.greaterThan: {
|
|
1422
1425
|
const t = s.value || 0;
|
|
1423
1426
|
return r > t;
|
|
1424
1427
|
}
|
|
1425
|
-
case
|
|
1428
|
+
case F.greaterThanOrEqual: {
|
|
1426
1429
|
const t = s.value || 0;
|
|
1427
1430
|
return r >= t;
|
|
1428
1431
|
}
|
|
1429
|
-
case
|
|
1432
|
+
case F.lessThan: {
|
|
1430
1433
|
const t = s.value || 0;
|
|
1431
1434
|
return r < t;
|
|
1432
1435
|
}
|
|
1433
|
-
case
|
|
1436
|
+
case F.lessThanOrEqual: {
|
|
1434
1437
|
const t = s.value || 0;
|
|
1435
1438
|
return r <= t;
|
|
1436
1439
|
}
|
|
@@ -1439,14 +1442,14 @@ const e1 = (s) => {
|
|
|
1439
1442
|
}
|
|
1440
1443
|
}, t1 = (s) => {
|
|
1441
1444
|
switch (s) {
|
|
1442
|
-
case
|
|
1443
|
-
return
|
|
1444
|
-
case
|
|
1445
|
-
return
|
|
1446
|
-
case
|
|
1447
|
-
return
|
|
1448
|
-
case
|
|
1449
|
-
return
|
|
1445
|
+
case F.greaterThan:
|
|
1446
|
+
return F.lessThanOrEqual;
|
|
1447
|
+
case F.greaterThanOrEqual:
|
|
1448
|
+
return F.lessThan;
|
|
1449
|
+
case F.lessThan:
|
|
1450
|
+
return F.greaterThanOrEqual;
|
|
1451
|
+
case F.lessThanOrEqual:
|
|
1452
|
+
return F.greaterThan;
|
|
1450
1453
|
}
|
|
1451
1454
|
return s;
|
|
1452
1455
|
}, n1 = (s, r) => {
|
|
@@ -1456,11 +1459,11 @@ const e1 = (s) => {
|
|
|
1456
1459
|
if (n >= 0) {
|
|
1457
1460
|
const i = s[n], a = s[e];
|
|
1458
1461
|
if (i.color.isValid && a.color.isValid) {
|
|
1459
|
-
const c = t(i.color.toRgb()),
|
|
1462
|
+
const c = t(i.color.toRgb()), o = t(a.color.toRgb()), l = a.value - i.value, d = (r - i.value) / l, u = ["r", "g", "b", "a"].reduce((g, f) => {
|
|
1460
1463
|
const D = c[f];
|
|
1461
|
-
return g[f] = (
|
|
1464
|
+
return g[f] = (o[f] - D) * d + D, g;
|
|
1462
1465
|
}, {});
|
|
1463
|
-
return new
|
|
1466
|
+
return new T2(u).toRgbString();
|
|
1464
1467
|
}
|
|
1465
1468
|
} else
|
|
1466
1469
|
return s[s.length - 1].color.toRgbString();
|
|
@@ -1470,9 +1473,9 @@ const e1 = (s) => {
|
|
|
1470
1473
|
const n = { ...e };
|
|
1471
1474
|
return n.endRow = Math.min(n.endRow, r), n.endColumn = Math.min(n.endColumn, t), n;
|
|
1472
1475
|
}).filter((e) => !!e);
|
|
1473
|
-
function
|
|
1476
|
+
function q1(s) {
|
|
1474
1477
|
let r = 0;
|
|
1475
|
-
return new
|
|
1478
|
+
return new O(s).forValue((t, e, n) => {
|
|
1476
1479
|
r = Math.max(Number.isNaN(r) ? 0 : r, Number(n));
|
|
1477
1480
|
}), r;
|
|
1478
1481
|
}
|
|
@@ -1578,39 +1581,39 @@ for (const s in C2) {
|
|
|
1578
1581
|
const r = C2[s];
|
|
1579
1582
|
Object.freeze(r);
|
|
1580
1583
|
}
|
|
1581
|
-
const C1 = "EMPTY_ICON_TYPE", f1 = "ssheets-conditional-formatting.config",
|
|
1584
|
+
const C1 = "EMPTY_ICON_TYPE", f1 = "ssheets-conditional-formatting.config", L2 = {};
|
|
1582
1585
|
var D1 = Object.getOwnPropertyDescriptor, m1 = (s, r, t, e) => {
|
|
1583
1586
|
for (var n = e > 1 ? void 0 : e ? D1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
|
|
1584
1587
|
(a = s[i]) && (n = a(n) || n);
|
|
1585
1588
|
return n;
|
|
1586
|
-
},
|
|
1589
|
+
}, J = (s, r) => (t, e) => r(t, e, s);
|
|
1587
1590
|
let s2 = class extends x2 {
|
|
1588
1591
|
constructor(s, r, t, e, n, i) {
|
|
1589
1592
|
super(), this._conditionalFormattingRuleModel = s, this._injector = r, this._univerInstanceService = t, this._resourceManagerService = e, this._sheetInterceptorService = n, this._commandService = i, this._initCellChange(), this._initSnapshot(), this._initSheetChange();
|
|
1590
1593
|
}
|
|
1591
1594
|
get _conditionalFormattingViewModelV2() {
|
|
1592
|
-
return this._injector.get(
|
|
1595
|
+
return this._injector.get(e2);
|
|
1593
1596
|
}
|
|
1594
1597
|
composeStyle(s, r, t, e) {
|
|
1595
1598
|
const n = this._conditionalFormattingViewModelV2.getCellCfs(s, r, t, e);
|
|
1596
1599
|
if (n && (n != null && n.length)) {
|
|
1597
|
-
const i = n.map((
|
|
1598
|
-
return a > -1 && i.splice(a + 1), i.reduce((
|
|
1600
|
+
const i = n.map((o) => this._conditionalFormattingRuleModel.getRule(s, r, o.cfId)).filter((o) => !!o).reverse(), a = i.findIndex((o) => o == null ? void 0 : o.stopIfTrue);
|
|
1601
|
+
return a > -1 && i.splice(a + 1), i.reduce((o, l) => {
|
|
1599
1602
|
var h;
|
|
1600
|
-
const d =
|
|
1601
|
-
if (d ===
|
|
1602
|
-
u.result &&
|
|
1603
|
-
else if (d ===
|
|
1603
|
+
const d = l.rule.type, u = n.find((g) => g.cfId === l.cfId);
|
|
1604
|
+
if (d === M.highlightCell)
|
|
1605
|
+
u.result && U2(o, { style: u.result });
|
|
1606
|
+
else if (d === M.colorScale) {
|
|
1604
1607
|
const g = u == null ? void 0 : u.result;
|
|
1605
|
-
g && typeof g == "string" && (
|
|
1606
|
-
} else if (d ===
|
|
1608
|
+
g && typeof g == "string" && (o.style = { ...(h = o.style) != null ? h : {}, bg: { rgb: g } });
|
|
1609
|
+
} else if (d === M.dataBar) {
|
|
1607
1610
|
const g = u == null ? void 0 : u.result;
|
|
1608
|
-
g && (
|
|
1609
|
-
} else if (d ===
|
|
1611
|
+
g && (o.dataBar = g, o.isShowValue = g.isShowValue);
|
|
1612
|
+
} else if (d === M.iconSet) {
|
|
1610
1613
|
const g = u == null ? void 0 : u.result;
|
|
1611
|
-
g && (
|
|
1614
|
+
g && (o.iconSet = g, o.isShowValue = g.isShowValue);
|
|
1612
1615
|
}
|
|
1613
|
-
return
|
|
1616
|
+
return o;
|
|
1614
1617
|
}, {});
|
|
1615
1618
|
}
|
|
1616
1619
|
return null;
|
|
@@ -1633,11 +1636,11 @@ let s2 = class extends x2 {
|
|
|
1633
1636
|
this.disposeWithMe(
|
|
1634
1637
|
this._resourceManagerService.registerPluginResource({
|
|
1635
1638
|
pluginName: P2,
|
|
1636
|
-
businesses: [
|
|
1639
|
+
businesses: [V2.UNIVER_SHEET],
|
|
1637
1640
|
toJson: (t) => s(t),
|
|
1638
1641
|
parseJson: (t) => r(t),
|
|
1639
1642
|
onUnLoad: (t) => {
|
|
1640
|
-
this._conditionalFormattingRuleModel.deleteUnitId(t), !z2(t) && this._conditionalFormattingViewModelV2.
|
|
1643
|
+
this._conditionalFormattingRuleModel.deleteUnitId(t), !z2(t) && this._conditionalFormattingViewModelV2.clearCache();
|
|
1641
1644
|
},
|
|
1642
1645
|
onLoad: (t, e) => {
|
|
1643
1646
|
Object.keys(e).forEach((n) => {
|
|
@@ -1654,46 +1657,46 @@ let s2 = class extends x2 {
|
|
|
1654
1657
|
this._sheetInterceptorService.interceptCommand({
|
|
1655
1658
|
getMutations: (s) => {
|
|
1656
1659
|
if (s.id === l0.id) {
|
|
1657
|
-
const r = s.params, t =
|
|
1658
|
-
if (!
|
|
1660
|
+
const r = s.params, t = k(this._univerInstanceService, r);
|
|
1661
|
+
if (!t)
|
|
1659
1662
|
return { redos: [], undos: [] };
|
|
1660
|
-
const n = this._conditionalFormattingRuleModel.getSubunitRules(
|
|
1661
|
-
if (!
|
|
1663
|
+
const { unitId: e, subUnitId: n } = t, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
|
|
1664
|
+
if (!i)
|
|
1662
1665
|
return { redos: [], undos: [] };
|
|
1663
|
-
const
|
|
1664
|
-
return
|
|
1666
|
+
const a = [], c = [];
|
|
1667
|
+
return i.forEach((o) => {
|
|
1665
1668
|
const l = {
|
|
1666
|
-
unitId:
|
|
1667
|
-
subUnitId:
|
|
1668
|
-
cfId:
|
|
1669
|
+
unitId: e,
|
|
1670
|
+
subUnitId: n,
|
|
1671
|
+
cfId: o.cfId
|
|
1669
1672
|
};
|
|
1670
|
-
|
|
1671
|
-
id:
|
|
1673
|
+
a.push({
|
|
1674
|
+
id: X.id,
|
|
1672
1675
|
params: l
|
|
1673
|
-
}),
|
|
1676
|
+
}), c.push(...D2(this._injector, l));
|
|
1674
1677
|
}), {
|
|
1675
|
-
redos:
|
|
1676
|
-
undos:
|
|
1678
|
+
redos: a,
|
|
1679
|
+
undos: c
|
|
1677
1680
|
};
|
|
1678
1681
|
} else if (s.id === o0.id) {
|
|
1679
|
-
const r = s.params,
|
|
1680
|
-
if (!t
|
|
1682
|
+
const r = s.params, t = k(this._univerInstanceService, r);
|
|
1683
|
+
if (!t)
|
|
1681
1684
|
return { redos: [], undos: [] };
|
|
1682
|
-
const i = this._conditionalFormattingRuleModel.getSubunitRules(
|
|
1683
|
-
if (!
|
|
1685
|
+
const { unitId: e, subUnitId: n } = t, { targetSubUnitId: i } = r, a = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
|
|
1686
|
+
if (!a)
|
|
1684
1687
|
return { redos: [], undos: [] };
|
|
1685
|
-
const
|
|
1686
|
-
return
|
|
1687
|
-
const
|
|
1688
|
-
unitId:
|
|
1689
|
-
subUnitId:
|
|
1688
|
+
const c = [], o = [];
|
|
1689
|
+
return a.forEach((l) => {
|
|
1690
|
+
const d = {
|
|
1691
|
+
unitId: e,
|
|
1692
|
+
subUnitId: i,
|
|
1690
1693
|
rule: {
|
|
1691
1694
|
...l,
|
|
1692
|
-
cfId: this._conditionalFormattingRuleModel.createCfId(
|
|
1695
|
+
cfId: this._conditionalFormattingRuleModel.createCfId(e, i)
|
|
1693
1696
|
}
|
|
1694
1697
|
};
|
|
1695
|
-
|
|
1696
|
-
}), { redos:
|
|
1698
|
+
c.push({ id: a2.id, params: d }), o.push(q2(this._injector, d));
|
|
1699
|
+
}), { redos: c, undos: o };
|
|
1697
1700
|
}
|
|
1698
1701
|
return { redos: [], undos: [] };
|
|
1699
1702
|
}
|
|
@@ -1708,67 +1711,75 @@ let s2 = class extends x2 {
|
|
|
1708
1711
|
const r = (t, e, n) => {
|
|
1709
1712
|
const i = /* @__PURE__ */ new Set();
|
|
1710
1713
|
return n.forEach(([a, c]) => {
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1714
|
+
const o = this._conditionalFormattingViewModelV2.getCellCfs(t, e, a, c);
|
|
1715
|
+
o == null || o.forEach((l) => i.add(l.cfId));
|
|
1713
1716
|
}), [...i].map((a) => this._conditionalFormattingRuleModel.getRule(t, e, a)).filter((a) => !!a);
|
|
1714
1717
|
};
|
|
1715
1718
|
switch (s.id) {
|
|
1716
1719
|
case m0.id: {
|
|
1717
1720
|
const t = s.params, { subUnitId: e, unitId: n, cellValue: i } = t, a = [];
|
|
1718
|
-
new
|
|
1719
|
-
d && Object.keys(d).some((h) => ["p", "v"].includes(h)) && a.push([
|
|
1720
|
-
}), r(n, e, a).forEach((
|
|
1721
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(n, e,
|
|
1721
|
+
new O(i).forValue((o, l, d) => {
|
|
1722
|
+
d && Object.keys(d).some((h) => ["p", "v"].includes(h)) && a.push([o, l]);
|
|
1723
|
+
}), r(n, e, a).forEach((o) => {
|
|
1724
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(n, e, o.cfId);
|
|
1722
1725
|
});
|
|
1723
1726
|
break;
|
|
1724
1727
|
}
|
|
1725
1728
|
case D0.id:
|
|
1726
1729
|
case f0.id: {
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
+
const t = s.params, e = k(this._univerInstanceService, t);
|
|
1731
|
+
if (!e) return;
|
|
1732
|
+
const { worksheet: n, unitId: i, subUnitId: a } = e, { range: c } = t, o = { ...c, endColumn: n.getColumnCount() - 1 }, l = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
|
|
1733
|
+
l && l.filter((u) => u.ranges.some((h) => n2.intersects(h, o))).forEach((u) => {
|
|
1734
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(i, a, u.cfId);
|
|
1730
1735
|
});
|
|
1731
1736
|
break;
|
|
1732
1737
|
}
|
|
1733
1738
|
case C0.id:
|
|
1734
1739
|
case g0.id: {
|
|
1735
|
-
const
|
|
1736
|
-
|
|
1737
|
-
|
|
1740
|
+
const t = s.params, e = k(this._univerInstanceService, t);
|
|
1741
|
+
if (!e) return;
|
|
1742
|
+
const { worksheet: n, unitId: i, subUnitId: a } = e, { range: c } = t, o = { ...c, endRow: n.getRowCount() - 1 }, l = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
|
|
1743
|
+
l && l.filter((u) => u.ranges.some((h) => n2.intersects(h, o))).forEach((u) => {
|
|
1744
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(i, a, u.cfId);
|
|
1738
1745
|
});
|
|
1739
1746
|
break;
|
|
1740
1747
|
}
|
|
1741
1748
|
case h0.id: {
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1744
|
-
|
|
1749
|
+
const t = s.params, e = k(this._univerInstanceService, t);
|
|
1750
|
+
if (!e) return;
|
|
1751
|
+
const { worksheet: n, unitId: i, subUnitId: a } = e, { sourceRange: c, targetRange: o } = t, l = {
|
|
1752
|
+
startRow: Math.min(c.startRow, o.startRow),
|
|
1753
|
+
endRow: n.getRowCount() - 1,
|
|
1745
1754
|
startColumn: 0,
|
|
1746
|
-
endColumn:
|
|
1747
|
-
};
|
|
1748
|
-
|
|
1749
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(
|
|
1755
|
+
endColumn: n.getColumnCount() - 1
|
|
1756
|
+
}, d = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
|
|
1757
|
+
d && d.filter((h) => h.ranges.some((g) => n2.intersects(g, l))).forEach((h) => {
|
|
1758
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(i, a, h.cfId);
|
|
1750
1759
|
});
|
|
1751
1760
|
break;
|
|
1752
1761
|
}
|
|
1753
1762
|
case d0.id: {
|
|
1754
|
-
const
|
|
1763
|
+
const t = s.params, e = k(this._univerInstanceService, t);
|
|
1764
|
+
if (!e) return;
|
|
1765
|
+
const { worksheet: n, unitId: i, subUnitId: a } = e, { sourceRange: c, targetRange: o } = t, l = {
|
|
1755
1766
|
startRow: 0,
|
|
1756
|
-
endRow:
|
|
1757
|
-
startColumn: Math.min(
|
|
1758
|
-
endColumn:
|
|
1759
|
-
};
|
|
1760
|
-
|
|
1761
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(
|
|
1767
|
+
endRow: n.getRowCount() - 1,
|
|
1768
|
+
startColumn: Math.min(c.startColumn, o.startColumn),
|
|
1769
|
+
endColumn: n.getColumnCount() - 1
|
|
1770
|
+
}, d = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
|
|
1771
|
+
d && d.filter((h) => h.ranges.some((g) => n2.intersects(g, l))).forEach((h) => {
|
|
1772
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(i, a, h.cfId);
|
|
1762
1773
|
});
|
|
1763
1774
|
break;
|
|
1764
1775
|
}
|
|
1765
1776
|
case c0.id: {
|
|
1766
1777
|
const { unitId: t, to: e, from: n } = s.params, i = (a) => {
|
|
1767
1778
|
const c = [];
|
|
1768
|
-
new
|
|
1769
|
-
c.push([
|
|
1770
|
-
}), r(t, a.subUnitId, c).forEach((
|
|
1771
|
-
this._conditionalFormattingViewModelV2.markRuleDirty(t, a.subUnitId,
|
|
1779
|
+
new O(a.value).forValue((l, d) => {
|
|
1780
|
+
c.push([l, d]);
|
|
1781
|
+
}), r(t, a.subUnitId, c).forEach((l) => {
|
|
1782
|
+
this._conditionalFormattingViewModelV2.markRuleDirty(t, a.subUnitId, l.cfId);
|
|
1772
1783
|
});
|
|
1773
1784
|
};
|
|
1774
1785
|
i(e), i(n);
|
|
@@ -1776,7 +1787,7 @@ let s2 = class extends x2 {
|
|
|
1776
1787
|
}
|
|
1777
1788
|
case u0.id: {
|
|
1778
1789
|
const { range: t, unitId: e, subUnitId: n } = s.params, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
|
|
1779
|
-
i && i.filter((c) => c.ranges.some((
|
|
1790
|
+
i && i.filter((c) => c.ranges.some((o) => n2.intersects(o, t))).forEach((c) => {
|
|
1780
1791
|
this._conditionalFormattingViewModelV2.markRuleDirty(e, n, c.cfId);
|
|
1781
1792
|
});
|
|
1782
1793
|
break;
|
|
@@ -1787,35 +1798,31 @@ let s2 = class extends x2 {
|
|
|
1787
1798
|
}
|
|
1788
1799
|
};
|
|
1789
1800
|
s2 = m1([
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1801
|
+
J(0, b(R)),
|
|
1802
|
+
J(1, b(_2)),
|
|
1803
|
+
J(2, b(Z)),
|
|
1804
|
+
J(3, b(J2)),
|
|
1805
|
+
J(4, b(a0)),
|
|
1806
|
+
J(5, b(q))
|
|
1796
1807
|
], s2);
|
|
1797
|
-
|
|
1798
|
-
var r;
|
|
1799
|
-
return (r = s.getCurrentUnitForType(D2.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId();
|
|
1800
|
-
};
|
|
1801
|
-
var v1 = Object.defineProperty, p1 = Object.getOwnPropertyDescriptor, E1 = (s, r, t) => r in s ? v1(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, A1 = (s, r, t, e) => {
|
|
1802
|
-
for (var n = e > 1 ? void 0 : e ? p1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
|
|
1808
|
+
var w1 = Object.defineProperty, F1 = Object.getOwnPropertyDescriptor, v1 = (s, r, t) => r in s ? w1(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, p1 = (s, r, t, e) => {
|
|
1809
|
+
for (var n = e > 1 ? void 0 : e ? F1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
|
|
1803
1810
|
(a = s[i]) && (n = a(n) || n);
|
|
1804
1811
|
return n;
|
|
1805
|
-
},
|
|
1812
|
+
}, A2 = (s, r) => (t, e) => r(t, e, s), G2 = (s, r, t) => v1(s, typeof r != "symbol" ? r + "" : r, t);
|
|
1806
1813
|
let f2 = class extends t0 {
|
|
1807
|
-
constructor(s =
|
|
1814
|
+
constructor(s = L2, r, t, e) {
|
|
1808
1815
|
super(), this._config = s, this._injector = r, this._commandService = t, this._configService = e;
|
|
1809
|
-
const { ...n } =
|
|
1816
|
+
const { ...n } = U2(
|
|
1810
1817
|
{},
|
|
1811
|
-
|
|
1818
|
+
L2,
|
|
1812
1819
|
this._config
|
|
1813
1820
|
);
|
|
1814
1821
|
this._configService.setConfig(f1, n), [
|
|
1815
1822
|
[s2],
|
|
1816
|
-
[
|
|
1823
|
+
[Q],
|
|
1817
1824
|
[R],
|
|
1818
|
-
[
|
|
1825
|
+
[e2]
|
|
1819
1826
|
].forEach((i) => {
|
|
1820
1827
|
this._injector.add(i);
|
|
1821
1828
|
}), [
|
|
@@ -1826,7 +1833,7 @@ let f2 = class extends t0 {
|
|
|
1826
1833
|
T0,
|
|
1827
1834
|
U0,
|
|
1828
1835
|
a2,
|
|
1829
|
-
|
|
1836
|
+
X,
|
|
1830
1837
|
l2,
|
|
1831
1838
|
i2
|
|
1832
1839
|
].forEach((i) => {
|
|
@@ -1836,30 +1843,30 @@ let f2 = class extends t0 {
|
|
|
1836
1843
|
onStarting() {
|
|
1837
1844
|
this._injector.get(s2), n0(this._injector, [
|
|
1838
1845
|
[s2],
|
|
1839
|
-
[
|
|
1846
|
+
[e2]
|
|
1840
1847
|
]);
|
|
1841
1848
|
}
|
|
1842
1849
|
};
|
|
1843
1850
|
G2(f2, "pluginName", P2);
|
|
1844
|
-
G2(f2, "type",
|
|
1845
|
-
f2 =
|
|
1851
|
+
G2(f2, "type", V2.UNIVER_SHEET);
|
|
1852
|
+
f2 = p1([
|
|
1846
1853
|
Q2(p0),
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1854
|
+
A2(1, b(_2)),
|
|
1855
|
+
A2(2, b(q)),
|
|
1856
|
+
A2(3, e0)
|
|
1850
1857
|
], f2);
|
|
1851
|
-
const
|
|
1858
|
+
const E1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
|
|
1852
1859
|
const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
|
|
1853
1860
|
return `${r}-${t}-${e}-${n}`;
|
|
1854
1861
|
};
|
|
1855
|
-
class
|
|
1862
|
+
class M1 extends $2 {
|
|
1856
1863
|
constructor() {
|
|
1857
1864
|
super();
|
|
1858
|
-
m(this, "_paddingRightAndLeft",
|
|
1859
|
-
m(this, "_width",
|
|
1865
|
+
m(this, "_paddingRightAndLeft", _1);
|
|
1866
|
+
m(this, "_width", x1);
|
|
1860
1867
|
m(this, "_imageMap", /* @__PURE__ */ new Map());
|
|
1861
|
-
m(this, "uKey",
|
|
1862
|
-
m(this, "Z_INDEX",
|
|
1868
|
+
m(this, "uKey", E1);
|
|
1869
|
+
m(this, "Z_INDEX", A1);
|
|
1863
1870
|
m(this, "_radius", 1);
|
|
1864
1871
|
this._init();
|
|
1865
1872
|
}
|
|
@@ -1868,30 +1875,30 @@ class I1 extends $2 {
|
|
|
1868
1875
|
if (!a)
|
|
1869
1876
|
return !1;
|
|
1870
1877
|
const c = /* @__PURE__ */ new Set();
|
|
1871
|
-
t.save(),
|
|
1872
|
-
if (!a.getRowVisible(
|
|
1878
|
+
t.save(), U.foreach(n.rowColumnSegment, (o, l) => {
|
|
1879
|
+
if (!a.getRowVisible(o) || !a.getColVisible(l))
|
|
1873
1880
|
return;
|
|
1874
|
-
const d = n.getCellWithCoordByIndex(
|
|
1875
|
-
let f = a.getCell(
|
|
1881
|
+
const d = n.getCellWithCoordByIndex(o, l, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
|
|
1882
|
+
let f = a.getCell(o, l);
|
|
1876
1883
|
if (u && (f = a.getCell(g.startRow, g.startColumn)), !(f != null && f.iconSet))
|
|
1877
1884
|
return;
|
|
1878
|
-
const { iconType: D, iconId:
|
|
1885
|
+
const { iconType: D, iconId: w } = f.iconSet;
|
|
1879
1886
|
if (D === C1)
|
|
1880
1887
|
return;
|
|
1881
|
-
const E = this._imageMap.get(this._createKey(D,
|
|
1888
|
+
const E = this._imageMap.get(this._createKey(D, w));
|
|
1882
1889
|
if (!E || !this.isRenderDiffRangesByCell(g, i))
|
|
1883
1890
|
return;
|
|
1884
1891
|
if (u || h) {
|
|
1885
|
-
const
|
|
1886
|
-
if (c.has(
|
|
1892
|
+
const G = y1(g);
|
|
1893
|
+
if (c.has(G))
|
|
1887
1894
|
return;
|
|
1888
|
-
c.add(
|
|
1895
|
+
c.add(G);
|
|
1889
1896
|
}
|
|
1890
|
-
const { startX: I, endX: A, startY: S, endY:
|
|
1891
|
-
if (this._width > o2 || this._width >
|
|
1897
|
+
const { startX: I, endX: A, startY: S, endY: B } = u || h ? g : d, F2 = A - I, o2 = B - S;
|
|
1898
|
+
if (this._width > o2 || this._width > F2 + this._paddingRightAndLeft * 2)
|
|
1892
1899
|
return;
|
|
1893
|
-
const
|
|
1894
|
-
t.drawImage(E, I + this._paddingRightAndLeft,
|
|
1900
|
+
const v2 = (o2 - this._width) / 2 + S;
|
|
1901
|
+
t.drawImage(E, I + this._paddingRightAndLeft, v2, this._width, this._width);
|
|
1895
1902
|
}), t.restore();
|
|
1896
1903
|
}
|
|
1897
1904
|
_init() {
|
|
@@ -1907,14 +1914,14 @@ class I1 extends $2 {
|
|
|
1907
1914
|
return `${t}_${e}`;
|
|
1908
1915
|
}
|
|
1909
1916
|
}
|
|
1910
|
-
O2.add(
|
|
1911
|
-
function
|
|
1917
|
+
O2.add(M1);
|
|
1918
|
+
function R1(s) {
|
|
1912
1919
|
if (typeof s != "object" || s === null)
|
|
1913
1920
|
return s;
|
|
1914
1921
|
const r = {};
|
|
1915
1922
|
for (const t in s)
|
|
1916
1923
|
if (s.hasOwnProperty(t)) {
|
|
1917
|
-
const e =
|
|
1924
|
+
const e = R1(s[t]);
|
|
1918
1925
|
e !== void 0 && (r[t] = e);
|
|
1919
1926
|
}
|
|
1920
1927
|
return r;
|
|
@@ -1923,30 +1930,30 @@ export {
|
|
|
1923
1930
|
L0 as AddCfCommand,
|
|
1924
1931
|
a2 as AddConditionalRuleMutation,
|
|
1925
1932
|
q2 as AddConditionalRuleMutationUndoFactory,
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1933
|
+
F as CFNumberOperator,
|
|
1934
|
+
M as CFRuleType,
|
|
1935
|
+
x as CFSubRuleType,
|
|
1936
|
+
N as CFTextOperator,
|
|
1937
|
+
T as CFTimePeriodOperator,
|
|
1931
1938
|
L as CFValueType,
|
|
1932
|
-
|
|
1939
|
+
p2 as CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
|
|
1933
1940
|
k0 as ClearRangeCfCommand,
|
|
1934
1941
|
B0 as ClearWorksheetCfCommand,
|
|
1935
|
-
|
|
1936
|
-
|
|
1942
|
+
Q as ConditionalFormattingFormulaService,
|
|
1943
|
+
M1 as ConditionalFormattingIcon,
|
|
1937
1944
|
R as ConditionalFormattingRuleModel,
|
|
1938
1945
|
s2 as ConditionalFormattingService,
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1946
|
+
e2 as ConditionalFormattingViewModel,
|
|
1947
|
+
T1 as DEFAULT_BG_COLOR,
|
|
1948
|
+
U1 as DEFAULT_FONT_COLOR,
|
|
1949
|
+
_1 as DEFAULT_PADDING,
|
|
1950
|
+
x1 as DEFAULT_WIDTH,
|
|
1944
1951
|
G0 as DataBar,
|
|
1945
1952
|
N0 as DeleteCfCommand,
|
|
1946
|
-
|
|
1947
|
-
|
|
1953
|
+
X as DeleteConditionalRuleMutation,
|
|
1954
|
+
D2 as DeleteConditionalRuleMutationUndoFactory,
|
|
1948
1955
|
C1 as EMPTY_ICON_TYPE,
|
|
1949
|
-
|
|
1956
|
+
E1 as IconUKey,
|
|
1950
1957
|
T0 as MoveCfCommand,
|
|
1951
1958
|
i2 as MoveConditionalRuleMutation,
|
|
1952
1959
|
b0 as MoveConditionalRuleMutationUndoFactory,
|
|
@@ -1957,29 +1964,29 @@ export {
|
|
|
1957
1964
|
I0 as anchorUndoFactory,
|
|
1958
1965
|
r2 as compareWithNumber,
|
|
1959
1966
|
S0 as createCfId,
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1967
|
+
V1 as createDefaultRule,
|
|
1968
|
+
O1 as createDefaultValue,
|
|
1969
|
+
$1 as createDefaultValueByValueType,
|
|
1963
1970
|
P0 as dataBarUKey,
|
|
1964
|
-
|
|
1965
|
-
|
|
1971
|
+
b2 as defaultDataBarNativeColor,
|
|
1972
|
+
S2 as defaultDataBarPositiveColor,
|
|
1966
1973
|
W0 as defaultPlaceholderColor,
|
|
1967
1974
|
w2 as filterRange,
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1975
|
+
Y as findIndexByAnchor,
|
|
1976
|
+
W1 as getCacheStyleMatrix,
|
|
1977
|
+
W as getCellValue,
|
|
1971
1978
|
n1 as getColorScaleFromValue,
|
|
1972
|
-
|
|
1979
|
+
q1 as getMaxInFormulaResult,
|
|
1973
1980
|
t1 as getOppositeOperator,
|
|
1974
1981
|
g2 as getValueByType,
|
|
1975
1982
|
g1 as iconGroup,
|
|
1976
1983
|
C2 as iconMap,
|
|
1977
|
-
|
|
1984
|
+
P1 as isAnchorEqual,
|
|
1978
1985
|
h2 as isFloatsEqual,
|
|
1979
|
-
|
|
1980
|
-
|
|
1986
|
+
_ as isNullable,
|
|
1987
|
+
H1 as isRangesEqual,
|
|
1981
1988
|
R0 as moveByAnchor,
|
|
1982
|
-
|
|
1989
|
+
R1 as removeUndefinedAttr,
|
|
1983
1990
|
e1 as serialTimeToTimestamp,
|
|
1984
1991
|
Z2 as setConditionalRuleMutationUndoFactory,
|
|
1985
1992
|
Q0 as toYMD_1900,
|