@univerjs/sheets-conditional-formatting 0.15.3-insiders.20260131-b9b8805 → 0.15.3
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +128 -131
- package/lib/index.js +128 -131
- package/lib/types/models/calculate-unit-v2/utils.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 X2, Tools as J, CommandType as O, IUndoRedoService as e2, ICommandService as W, IUniverInstanceService as q, ObjectMatrix as V, Range as T, sequenceExecute as B2, Inject as
|
|
4
|
+
import { generateRandomId as X2, Tools as J, CommandType as O, IUndoRedoService as e2, ICommandService as W, IUniverInstanceService as q, ObjectMatrix as V, Range as T, sequenceExecute as B2, Inject as S, Disposable as x2, RefAlias as K2, CellValueType as x, BooleanNumber as N2, LRUMap as T2, ColorKit as U2, dayjs as v, Injector as M2, RTree as Y2, IResourceManagerService as J2, merge as V2, UniverInstanceType as D2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
|
|
5
5
|
import { isRangesEqual as X1 } from "@univerjs/core";
|
|
6
6
|
import { getSheetCommandTarget as t2, 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
7
|
import { Subject as d2, BehaviorSubject as F0 } from "rxjs";
|
|
@@ -9,7 +9,7 @@ import { RegisterOtherFormulaService as w0, FormulaResultStatus as p, OtherFormu
|
|
|
9
9
|
import { distinctUntilChanged as E0, bufferTime as A0, filter as _0, map as x0 } from "rxjs/operators";
|
|
10
10
|
import { isObject as M0, SpreadsheetExtensionRegistry as O2, SheetExtension as $2, FIX_ONE_PIXEL_BLUR_OFFSET as y0 } from "@univerjs/engine-render";
|
|
11
11
|
const P2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
|
|
12
|
-
var
|
|
12
|
+
var k = /* @__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))(k || {}), B = /* @__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))(B || {}), w = /* @__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))(w || {}), M = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(M || {}), _ = /* @__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))(_ || {}), b = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(b || {});
|
|
13
13
|
const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
14
14
|
cfId: void 0,
|
|
15
15
|
ranges: [],
|
|
@@ -133,7 +133,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
|
|
|
133
133
|
}
|
|
134
134
|
return null;
|
|
135
135
|
}, q1 = (s, r) => s.id === r.id && s.type === r.type, S0 = () => `${X2(8)}`;
|
|
136
|
-
class
|
|
136
|
+
class y {
|
|
137
137
|
constructor() {
|
|
138
138
|
// Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
|
|
139
139
|
m(this, "_model", /* @__PURE__ */ new Map());
|
|
@@ -206,7 +206,7 @@ const i2 = {
|
|
|
206
206
|
if (!r)
|
|
207
207
|
return !1;
|
|
208
208
|
const { unitId: t, subUnitId: e, start: n, end: i } = r;
|
|
209
|
-
return s.get(
|
|
209
|
+
return s.get(y).moveRulePriority(t, e, n, i), !0;
|
|
210
210
|
}
|
|
211
211
|
}, b0 = (s) => {
|
|
212
212
|
const { unitId: r, subUnitId: t } = s, e = I0(s.start, s.end);
|
|
@@ -217,7 +217,7 @@ const i2 = {
|
|
|
217
217
|
{ id: i2.id, params: { unitId: r, subUnitId: t, start: n, end: i } }
|
|
218
218
|
];
|
|
219
219
|
}, m2 = (s, r) => {
|
|
220
|
-
const t = s.get(
|
|
220
|
+
const t = s.get(y), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((o) => o.cfId === i), l = a[c - 1];
|
|
221
221
|
if (c > -1) {
|
|
222
222
|
const o = a[c], d = [{
|
|
223
223
|
id: a2.id,
|
|
@@ -248,7 +248,7 @@ const i2 = {
|
|
|
248
248
|
if (!r)
|
|
249
249
|
return !1;
|
|
250
250
|
const { unitId: t, subUnitId: e, cfId: n } = r;
|
|
251
|
-
return s.get(
|
|
251
|
+
return s.get(y).deleteRule(t, e, n), !0;
|
|
252
252
|
}
|
|
253
253
|
}, q2 = (s, r) => ({ id: K.id, params: { unitId: r.unitId, subUnitId: r.subUnitId, cfId: r.rule.cfId } }), a2 = {
|
|
254
254
|
type: O.MUTATION,
|
|
@@ -257,7 +257,7 @@ const i2 = {
|
|
|
257
257
|
if (!r)
|
|
258
258
|
return !1;
|
|
259
259
|
const { unitId: t, subUnitId: e, rule: n } = r;
|
|
260
|
-
return s.get(
|
|
260
|
+
return s.get(y).addRule(t, e, n), !0;
|
|
261
261
|
}
|
|
262
262
|
}, L0 = {
|
|
263
263
|
type: O.COMMAND,
|
|
@@ -265,7 +265,7 @@ const i2 = {
|
|
|
265
265
|
handler(s, r) {
|
|
266
266
|
if (!r)
|
|
267
267
|
return !1;
|
|
268
|
-
const { rule: t } = r, e = s.get(e2), n = s.get(W), i = s.get(
|
|
268
|
+
const { rule: t } = r, e = s.get(e2), n = s.get(W), i = s.get(y), a = s.get(q), c = t2(a, r);
|
|
269
269
|
if (!c) return !1;
|
|
270
270
|
const { unitId: l, subUnitId: o } = c, d = i.createCfId(l, o), u = { unitId: l, subUnitId: o, rule: { ...t, cfId: t.cfId || d } }, h = q2(s, u), g = n.syncExecuteCommand(a2.id, u);
|
|
271
271
|
return g && e.pushUndoRedo({
|
|
@@ -281,10 +281,10 @@ const i2 = {
|
|
|
281
281
|
if (!r)
|
|
282
282
|
return !1;
|
|
283
283
|
const { unitId: t, subUnitId: e, rule: n } = r, i = r.cfId || r.rule.cfId;
|
|
284
|
-
return s.get(
|
|
284
|
+
return s.get(y).setRule(t, e, n, i), !0;
|
|
285
285
|
}
|
|
286
286
|
}, Z2 = (s, r) => {
|
|
287
|
-
const t = s.get(
|
|
287
|
+
const t = s.get(y), { unitId: e, subUnitId: n } = r, i = r.cfId || r.rule.cfId, a = t.getRule(e, n, i);
|
|
288
288
|
return a ? [{
|
|
289
289
|
id: l2.id,
|
|
290
290
|
params: {
|
|
@@ -301,7 +301,7 @@ const i2 = {
|
|
|
301
301
|
var D;
|
|
302
302
|
if (!r)
|
|
303
303
|
return !1;
|
|
304
|
-
const t = s.get(
|
|
304
|
+
const t = s.get(y), e = s.get(q), n = s.get(W), i = s.get(e2), a = s.get(r0), c = t2(e, r);
|
|
305
305
|
if (!c) return !1;
|
|
306
306
|
const { unitId: l, subUnitId: o } = c, d = ((D = a.getCurrentSelections()) == null ? void 0 : D.map((F) => F.range)) || [], u = t.getSubunitRules(l, o);
|
|
307
307
|
if (!(u != null && u.length) || !d.length)
|
|
@@ -310,21 +310,21 @@ const i2 = {
|
|
|
310
310
|
u.forEach((F) => {
|
|
311
311
|
const E = new V();
|
|
312
312
|
F.ranges.forEach((A) => {
|
|
313
|
-
T.foreach(A, (
|
|
314
|
-
E.setValue(
|
|
313
|
+
T.foreach(A, (I, L) => {
|
|
314
|
+
E.setValue(I, L, 1);
|
|
315
315
|
});
|
|
316
316
|
}), d.forEach((A) => {
|
|
317
|
-
T.foreach(A, (
|
|
318
|
-
E.realDeleteValue(
|
|
317
|
+
T.foreach(A, (I, L) => {
|
|
318
|
+
E.realDeleteValue(I, L);
|
|
319
319
|
});
|
|
320
320
|
});
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
const A = { ...F, ranges:
|
|
324
|
-
h.push({ id: l2.id, params:
|
|
321
|
+
const R = s0(i0(E));
|
|
322
|
+
if (R.length) {
|
|
323
|
+
const A = { ...F, ranges: R }, I = { unitId: l, subUnitId: o, rule: A }, L = Z2(s, I);
|
|
324
|
+
h.push({ id: l2.id, params: I }), g.push(...L);
|
|
325
325
|
} else {
|
|
326
|
-
const A = { unitId: l, subUnitId: o, cfId: F.cfId },
|
|
327
|
-
h.push({ id: K.id, params: A }), g.push(...
|
|
326
|
+
const A = { unitId: l, subUnitId: o, cfId: F.cfId }, I = m2(s, A);
|
|
327
|
+
h.push({ id: K.id, params: A }), g.push(...I);
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
const f = B2(h, n).result;
|
|
@@ -338,7 +338,7 @@ const i2 = {
|
|
|
338
338
|
type: O.COMMAND,
|
|
339
339
|
id: "sheet.command.clear-worksheet-conditional-rule",
|
|
340
340
|
handler(s, r) {
|
|
341
|
-
const t = s.get(
|
|
341
|
+
const t = s.get(y), e = s.get(q), n = s.get(W), i = s.get(e2), a = t2(e, r);
|
|
342
342
|
if (!a) return !1;
|
|
343
343
|
const { unitId: c, subUnitId: l } = a, o = t.getSubunitRules(c, l);
|
|
344
344
|
if (!(o != null && o.length))
|
|
@@ -367,7 +367,7 @@ const i2 = {
|
|
|
367
367
|
handler(s, r) {
|
|
368
368
|
if (!r)
|
|
369
369
|
return !1;
|
|
370
|
-
const t = s.get(e2), e = s.get(W), n = s.get(q), i = s.get(
|
|
370
|
+
const t = s.get(e2), e = s.get(W), n = s.get(q), i = s.get(y), a = t2(n, r);
|
|
371
371
|
if (!a) return !1;
|
|
372
372
|
const { unitId: c, subUnitId: l } = a, o = W2(r.start, r.end, i.getSubunitRules(c, l) || [], (D) => D.cfId);
|
|
373
373
|
if (!o)
|
|
@@ -408,12 +408,12 @@ let z = class extends x2 {
|
|
|
408
408
|
_initRuleChange() {
|
|
409
409
|
const r = (t) => {
|
|
410
410
|
switch (t.type) {
|
|
411
|
-
case
|
|
412
|
-
return t.config.some((e) => e.value.type ===
|
|
413
|
-
case
|
|
414
|
-
return [t.config.max, t.config.min].some((e) => e.type ===
|
|
415
|
-
case
|
|
416
|
-
return t.config.some((e) => e.value.type ===
|
|
411
|
+
case M.colorScale:
|
|
412
|
+
return t.config.some((e) => e.value.type === b.formula);
|
|
413
|
+
case M.dataBar:
|
|
414
|
+
return [t.config.max, t.config.min].some((e) => e.type === b.formula);
|
|
415
|
+
case M.iconSet:
|
|
416
|
+
return t.config.some((e) => e.value.type === b.formula);
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
419
|
this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((t) => {
|
|
@@ -426,7 +426,7 @@ let z = class extends x2 {
|
|
|
426
426
|
*/
|
|
427
427
|
_registerRuleFormulas(r, t, e) {
|
|
428
428
|
switch (e.rule.type) {
|
|
429
|
-
case
|
|
429
|
+
case M.highlightCell: {
|
|
430
430
|
if (e.rule.subType === _.formula) {
|
|
431
431
|
const n = e.rule.value;
|
|
432
432
|
n && this.registerFormulaWithRange(
|
|
@@ -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) === x.BOOLEAN ? t.v === N2.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.
|
|
@@ -557,8 +557,8 @@ let z = class extends x2 {
|
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
559
|
z = O0([
|
|
560
|
-
S2(0,
|
|
561
|
-
S2(1,
|
|
560
|
+
S2(0, S(w0)),
|
|
561
|
+
S2(1, S(y))
|
|
562
562
|
], z);
|
|
563
563
|
var U = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(U || {});
|
|
564
564
|
class F2 {
|
|
@@ -637,10 +637,10 @@ class F2 {
|
|
|
637
637
|
class $0 extends F2 {
|
|
638
638
|
preComputing(r, t, e) {
|
|
639
639
|
const n = e.rule, i = e.worksheet, a = new V();
|
|
640
|
-
!n.rule.config.every((d) => d.value.type ===
|
|
640
|
+
!n.rule.config.every((d) => d.value.type === b.num) && w2(n.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
|
|
641
641
|
T.foreach(u, (h, g) => {
|
|
642
642
|
const f = e.getCellValue(h, g), D = f && f.v;
|
|
643
|
-
if (!
|
|
643
|
+
if (!N(D) && (f == null ? void 0 : f.t) === x.NUMBER) {
|
|
644
644
|
const F = Number(D);
|
|
645
645
|
!Number.isNaN(F) && a.setValue(h, g, F);
|
|
646
646
|
}
|
|
@@ -667,7 +667,7 @@ class $0 extends F2 {
|
|
|
667
667
|
if (!e)
|
|
668
668
|
return null;
|
|
669
669
|
const i = n.getCellValue(r, t);
|
|
670
|
-
if (i.t ===
|
|
670
|
+
if (i.t === x.NUMBER) {
|
|
671
671
|
const a = Number(i.v);
|
|
672
672
|
if (!Number.isNaN(a))
|
|
673
673
|
return n1(e, a);
|
|
@@ -706,23 +706,23 @@ class G0 extends $2 {
|
|
|
706
706
|
return;
|
|
707
707
|
c.add($);
|
|
708
708
|
}
|
|
709
|
-
const { color: D, value: F, startPoint: E, isGradient:
|
|
709
|
+
const { color: D, value: F, startPoint: E, isGradient: R } = f.dataBar, { startX: A, endX: I, startY: L, endY: v2 } = u || h ? g : d, o2 = I - A, p2 = v2 + y0 - L, Z = o2 - this._paddingRightAndLeft * 2, y2 = p2 - this._paddingTopAndBottom * 2;
|
|
710
710
|
if (F > 0) {
|
|
711
|
-
const $ = Math.max(Z * (1 - E / 100) * F / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z, H =
|
|
712
|
-
if (
|
|
711
|
+
const $ = Math.max(Z * (1 - E / 100) * F / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z, H = L + this._paddingTopAndBottom;
|
|
712
|
+
if (R) {
|
|
713
713
|
const j = t.createLinearGradient(G, H, G + $, H);
|
|
714
714
|
j.addColorStop(0, D), j.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
|
|
715
715
|
} else
|
|
716
716
|
t.fillStyle = D;
|
|
717
|
-
this._drawRectWithRoundedCorner(t, G, H, $, y2, !1, !0, !0, !1),
|
|
717
|
+
this._drawRectWithRoundedCorner(t, G, H, $, y2, !1, !0, !0, !1), R && t.stroke();
|
|
718
718
|
} else {
|
|
719
|
-
const $ = Math.max(Z * E / 100 * Math.abs(F) / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z - $, H =
|
|
720
|
-
if (
|
|
719
|
+
const $ = Math.max(Z * E / 100 * Math.abs(F) / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z - $, H = L + this._paddingTopAndBottom;
|
|
720
|
+
if (R) {
|
|
721
721
|
const j = t.createLinearGradient(G, H, G + $, H);
|
|
722
722
|
j.addColorStop(0, "rgb(255 255 255)"), j.addColorStop(1, D), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
|
|
723
723
|
} else
|
|
724
724
|
t.fillStyle = D;
|
|
725
|
-
this._drawRectWithRoundedCorner(t, G, H, $, y2, !0, !1, !1, !0),
|
|
725
|
+
this._drawRectWithRoundedCorner(t, G, H, $, y2, !0, !1, !1, !0), R && t.stroke();
|
|
726
726
|
}
|
|
727
727
|
}), t.restore();
|
|
728
728
|
}
|
|
@@ -734,7 +734,7 @@ class G0 extends $2 {
|
|
|
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 === x.NUMBER) {
|
|
738
738
|
const n = Number(e.v);
|
|
739
739
|
return Number.isNaN(n) ? null : n;
|
|
740
740
|
}
|
|
@@ -743,11 +743,11 @@ const u2 = (s) => Math.max(Math.min(100, s), 0), H0 = (s, r, t) => {
|
|
|
743
743
|
class j0 extends F2 {
|
|
744
744
|
preComputing(r, t, e) {
|
|
745
745
|
const n = e.rule, i = n.rule, a = e.worksheet, c = new V();
|
|
746
|
-
![n.rule.config.max, n.rule.config.min].every((g) => g.type ===
|
|
746
|
+
![n.rule.config.max, n.rule.config.min].every((g) => g.type === b.num) && w2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((f) => {
|
|
747
747
|
T.foreach(f, (D, F) => {
|
|
748
|
-
const E = e.getCellValue(D, F),
|
|
749
|
-
if (!
|
|
750
|
-
const A = Number(
|
|
748
|
+
const E = e.getCellValue(D, F), R = E && E.v;
|
|
749
|
+
if (!N(R) && (E == null ? void 0 : E.t) === x.NUMBER) {
|
|
750
|
+
const A = Number(R);
|
|
751
751
|
!Number.isNaN(A) && c.setValue(D, F, A);
|
|
752
752
|
}
|
|
753
753
|
});
|
|
@@ -809,8 +809,8 @@ class X0 extends F2 {
|
|
|
809
809
|
let l = 0, o = 0;
|
|
810
810
|
return i.forEach((d) => {
|
|
811
811
|
T.foreach(d, (u, h) => {
|
|
812
|
-
const g = e.getCellValue(u, h), f = P(g);
|
|
813
|
-
g && g.t ===
|
|
812
|
+
const g = e.getCellValue(u, h), f = P(g || void 0);
|
|
813
|
+
g && g.t === x.NUMBER && f !== void 0 && (l += Number(f) || 0, o++);
|
|
814
814
|
});
|
|
815
815
|
}), { value: l / o, type: n.subType };
|
|
816
816
|
}
|
|
@@ -819,8 +819,8 @@ class X0 extends F2 {
|
|
|
819
819
|
const l = /* @__PURE__ */ new Map();
|
|
820
820
|
return i.forEach((o) => {
|
|
821
821
|
T.foreach(o, (d, u) => {
|
|
822
|
-
const h = e.getCellValue(d, u), g = P(h);
|
|
823
|
-
if (
|
|
822
|
+
const h = e.getCellValue(d, u), g = P(h || void 0);
|
|
823
|
+
if (g !== void 0) {
|
|
824
824
|
const f = l.get(g);
|
|
825
825
|
f ? l.set(g, f + 1) : l.set(g, 1);
|
|
826
826
|
}
|
|
@@ -831,8 +831,8 @@ class X0 extends F2 {
|
|
|
831
831
|
let l = [];
|
|
832
832
|
i.forEach((u) => {
|
|
833
833
|
T.foreach(u, (h, g) => {
|
|
834
|
-
const f = e.getCellValue(h, g), D = P(f);
|
|
835
|
-
f && f.t ===
|
|
834
|
+
const f = e.getCellValue(h, g), D = P(f || void 0);
|
|
835
|
+
f && f.t === x.NUMBER && D !== void 0 && l.push(Number(D) || 0);
|
|
836
836
|
});
|
|
837
837
|
}), l.sort((u, h) => h - u);
|
|
838
838
|
const o = e.rule.rule;
|
|
@@ -855,7 +855,7 @@ class X0 extends F2 {
|
|
|
855
855
|
}
|
|
856
856
|
case _.timePeriod:
|
|
857
857
|
switch (n.operator) {
|
|
858
|
-
case
|
|
858
|
+
case B.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 B.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 B.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 B.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 B.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 B.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 B.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 B.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 B.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 B.yesterday:
|
|
931
931
|
return {
|
|
932
932
|
value: {
|
|
933
933
|
start: v().startOf("day").subtract(1, "day").valueOf(),
|
|
@@ -946,31 +946,31 @@ class X0 extends F2 {
|
|
|
946
946
|
return (() => {
|
|
947
947
|
switch (a.subType) {
|
|
948
948
|
case _.number: {
|
|
949
|
-
const o = i && Number(i.v), d = (i == null ? void 0 : i.t) ===
|
|
950
|
-
return d ?
|
|
949
|
+
const o = i && Number(i.v), d = (i == null ? void 0 : i.t) === x.NUMBER, u = a;
|
|
950
|
+
return d ? N(o) || Number.isNaN(o) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, o || 0) : !![w.notEqual, w.notBetween].includes(u.operator);
|
|
951
951
|
}
|
|
952
952
|
case _.text: {
|
|
953
|
-
const o = a, d = P(i), u =
|
|
953
|
+
const o = a, d = P(i), u = d === null ? "" : String(d), h = o.value || "";
|
|
954
954
|
switch (o.operator) {
|
|
955
|
-
case
|
|
955
|
+
case k.beginsWith:
|
|
956
956
|
return u.startsWith(h);
|
|
957
|
-
case
|
|
957
|
+
case k.containsBlanks:
|
|
958
958
|
return /^\s*$/.test(u);
|
|
959
|
-
case
|
|
959
|
+
case k.notContainsBlanks:
|
|
960
960
|
return !/^\s*$/.test(u);
|
|
961
|
-
case
|
|
961
|
+
case k.containsErrors:
|
|
962
962
|
return R2.has(u);
|
|
963
|
-
case
|
|
963
|
+
case k.notContainsErrors:
|
|
964
964
|
return !R2.has(u);
|
|
965
|
-
case
|
|
965
|
+
case k.containsText:
|
|
966
966
|
return u.indexOf(h) > -1;
|
|
967
|
-
case
|
|
967
|
+
case k.notContainsText:
|
|
968
968
|
return u.indexOf(h) === -1;
|
|
969
|
-
case
|
|
969
|
+
case k.endsWith:
|
|
970
970
|
return u.endsWith(h);
|
|
971
|
-
case
|
|
971
|
+
case k.equal:
|
|
972
972
|
return u === h;
|
|
973
|
-
case
|
|
973
|
+
case k.notEqual:
|
|
974
974
|
return u !== h;
|
|
975
975
|
default:
|
|
976
976
|
return !1;
|
|
@@ -978,16 +978,16 @@ class X0 extends F2 {
|
|
|
978
978
|
}
|
|
979
979
|
case _.timePeriod: {
|
|
980
980
|
const o = P(i);
|
|
981
|
-
if (
|
|
981
|
+
if (N(o) || Number.isNaN(Number(o)) || (i == null ? void 0 : i.t) !== x.NUMBER || !e)
|
|
982
982
|
return;
|
|
983
983
|
const d = e1(Number(o)), { start: u, end: h } = e.value;
|
|
984
984
|
return d >= u && d <= h;
|
|
985
985
|
}
|
|
986
986
|
case _.average: {
|
|
987
|
-
const o = i && i.v, d = Number(o), u = (i == null ? void 0 : i.t) ===
|
|
987
|
+
const o = i && i.v, d = Number(o), u = (i == null ? void 0 : i.t) === x.NUMBER, h = a;
|
|
988
988
|
if (!u)
|
|
989
989
|
return w.notEqual === h.operator;
|
|
990
|
-
if (
|
|
990
|
+
if (N(o) || Number.isNaN(d) || !e)
|
|
991
991
|
return !1;
|
|
992
992
|
const g = e.value;
|
|
993
993
|
switch (h.operator) {
|
|
@@ -1009,21 +1009,18 @@ class X0 extends F2 {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
case _.rank: {
|
|
1011
1011
|
const o = P(i), d = Number(o);
|
|
1012
|
-
if (
|
|
1012
|
+
if (N(o) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== x.NUMBER || !e)
|
|
1013
1013
|
return !1;
|
|
1014
1014
|
const u = e.value;
|
|
1015
1015
|
return a.isBottom ? d <= u : d >= u;
|
|
1016
1016
|
}
|
|
1017
1017
|
case _.uniqueValues: {
|
|
1018
1018
|
const o = P(i);
|
|
1019
|
-
return
|
|
1019
|
+
return N(o) || !e ? !1 : e.value.get(o) === 1;
|
|
1020
1020
|
}
|
|
1021
1021
|
case _.duplicateValues: {
|
|
1022
1022
|
const o = P(i);
|
|
1023
|
-
|
|
1024
|
-
return !1;
|
|
1025
|
-
const d = e.value.get(o);
|
|
1026
|
-
return d && d !== 1;
|
|
1023
|
+
return N(o) || !e ? !1 : e.value.get(o) !== 1;
|
|
1027
1024
|
}
|
|
1028
1025
|
case _.formula: {
|
|
1029
1026
|
const o = e == null ? void 0 : e.value;
|
|
@@ -1039,7 +1036,7 @@ class X0 extends F2 {
|
|
|
1039
1036
|
}
|
|
1040
1037
|
const K0 = (s, r, t) => {
|
|
1041
1038
|
const e = t(s, r);
|
|
1042
|
-
if (e && e.t ===
|
|
1039
|
+
if (e && e.t === x.NUMBER) {
|
|
1043
1040
|
const n = Number(e.v);
|
|
1044
1041
|
return Number.isNaN(n) ? null : n;
|
|
1045
1042
|
}
|
|
@@ -1048,10 +1045,10 @@ const K0 = (s, r, t) => {
|
|
|
1048
1045
|
class Y0 extends F2 {
|
|
1049
1046
|
preComputing(r, t, e) {
|
|
1050
1047
|
const n = e.rule.rule, i = e.worksheet, a = new V();
|
|
1051
|
-
!n.config.every((d) => d.value.type ===
|
|
1048
|
+
!n.config.every((d) => d.value.type === b.num) && w2(e.rule.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
|
|
1052
1049
|
T.foreach(u, (h, g) => {
|
|
1053
1050
|
const f = e.getCellValue(h, g), D = f && f.v;
|
|
1054
|
-
if (!
|
|
1051
|
+
if (!N(D) && (f == null ? void 0 : f.t) === x.NUMBER) {
|
|
1055
1052
|
const F = Number(D);
|
|
1056
1053
|
!Number.isNaN(F) && a.setValue(h, g, F);
|
|
1057
1054
|
}
|
|
@@ -1206,7 +1203,7 @@ let Q = class extends x2 {
|
|
|
1206
1203
|
this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
|
|
1207
1204
|
if (r.type === "set") {
|
|
1208
1205
|
const { unitId: t, subUnitId: e } = r, n = r.oldRule;
|
|
1209
|
-
n.rule.type ===
|
|
1206
|
+
n.rule.type === M.highlightCell && n.rule.subType === _.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
|
|
1210
1207
|
}
|
|
1211
1208
|
})
|
|
1212
1209
|
);
|
|
@@ -1267,13 +1264,13 @@ let Q = class extends x2 {
|
|
|
1267
1264
|
getCellValue: (c, l) => i.getCellRaw(c, l) || {}
|
|
1268
1265
|
};
|
|
1269
1266
|
switch (e.rule.type) {
|
|
1270
|
-
case
|
|
1267
|
+
case M.colorScale:
|
|
1271
1268
|
return new $0(a);
|
|
1272
|
-
case
|
|
1269
|
+
case M.dataBar:
|
|
1273
1270
|
return new j0(a);
|
|
1274
|
-
case
|
|
1271
|
+
case M.highlightCell:
|
|
1275
1272
|
return new X0(a);
|
|
1276
|
-
case
|
|
1273
|
+
case M.iconSet:
|
|
1277
1274
|
return new Y0(a);
|
|
1278
1275
|
}
|
|
1279
1276
|
}
|
|
@@ -1291,22 +1288,22 @@ let Q = class extends x2 {
|
|
|
1291
1288
|
}
|
|
1292
1289
|
};
|
|
1293
1290
|
Q = z0([
|
|
1294
|
-
c2(0,
|
|
1295
|
-
c2(1,
|
|
1296
|
-
c2(2,
|
|
1291
|
+
c2(0, S(M2)),
|
|
1292
|
+
c2(1, S(y)),
|
|
1293
|
+
c2(2, S(z)),
|
|
1297
1294
|
c2(3, q)
|
|
1298
1295
|
], Q);
|
|
1299
1296
|
function h2(s, r) {
|
|
1300
1297
|
return Math.abs(s - r) < Number.EPSILON;
|
|
1301
1298
|
}
|
|
1302
|
-
const
|
|
1299
|
+
const N = (s) => [void 0, null].includes(s), P = (s) => {
|
|
1303
1300
|
var e, n;
|
|
1304
1301
|
if (!s)
|
|
1305
1302
|
return null;
|
|
1306
|
-
if (s.t ===
|
|
1303
|
+
if (s.t === x.BOOLEAN)
|
|
1307
1304
|
return s.v === N2.TRUE ? I2.TRUE : I2.FALSE;
|
|
1308
1305
|
const r = s.v, t = (n = (e = s.p) == null ? void 0 : e.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "");
|
|
1309
|
-
return
|
|
1306
|
+
return N(r) ? N(t) ? null : t : r;
|
|
1310
1307
|
}, A2 = 86400;
|
|
1311
1308
|
function Q0(s, r = !0) {
|
|
1312
1309
|
if (r && s >= 0) {
|
|
@@ -1336,7 +1333,7 @@ const e1 = (s) => {
|
|
|
1336
1333
|
return v(`${i}/${a}/${c} ${l}:${o}:${d}`).valueOf();
|
|
1337
1334
|
}, g2 = (s, r, t) => {
|
|
1338
1335
|
switch (s.type) {
|
|
1339
|
-
case
|
|
1336
|
+
case b.max: {
|
|
1340
1337
|
let e = 0;
|
|
1341
1338
|
return r.forValue((n, i, a) => {
|
|
1342
1339
|
a > e && (e = a);
|
|
@@ -1345,7 +1342,7 @@ const e1 = (s) => {
|
|
|
1345
1342
|
result: e
|
|
1346
1343
|
};
|
|
1347
1344
|
}
|
|
1348
|
-
case
|
|
1345
|
+
case b.min: {
|
|
1349
1346
|
let e;
|
|
1350
1347
|
return r.forValue((n, i, a) => {
|
|
1351
1348
|
e === void 0 && (e = a), a < e && (e = a);
|
|
@@ -1354,7 +1351,7 @@ const e1 = (s) => {
|
|
|
1354
1351
|
result: e
|
|
1355
1352
|
};
|
|
1356
1353
|
}
|
|
1357
|
-
case
|
|
1354
|
+
case b.percent: {
|
|
1358
1355
|
let e, n;
|
|
1359
1356
|
r.forValue((c, l, o) => {
|
|
1360
1357
|
(e === void 0 || n === void 0) && (e = o, n = o), o > e && (e = o), o < n && (n = o);
|
|
@@ -1365,18 +1362,18 @@ const e1 = (s) => {
|
|
|
1365
1362
|
result: i * (a / 100) + (n || 0)
|
|
1366
1363
|
};
|
|
1367
1364
|
}
|
|
1368
|
-
case
|
|
1365
|
+
case b.percentile: {
|
|
1369
1366
|
const e = r.toNativeArray().sort((o, d) => o - 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, l = e[a] + (e[Math.min(a + 1, e.length - 1)] - e[a]) * c;
|
|
1370
1367
|
return {
|
|
1371
1368
|
status: p.SUCCESS,
|
|
1372
1369
|
result: l
|
|
1373
1370
|
};
|
|
1374
1371
|
}
|
|
1375
|
-
case
|
|
1372
|
+
case b.formula: {
|
|
1376
1373
|
const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value), l = e.get(z);
|
|
1377
1374
|
return l.registerFormulaWithRange(n, i, a, c), l.getFormulaResultWithCoords(n, i, a, c);
|
|
1378
1375
|
}
|
|
1379
|
-
case
|
|
1376
|
+
case b.num:
|
|
1380
1377
|
default: {
|
|
1381
1378
|
const e = Number(s.value);
|
|
1382
1379
|
return {
|
|
@@ -1598,15 +1595,15 @@ let s2 = class extends x2 {
|
|
|
1598
1595
|
return a > -1 && i.splice(a + 1), i.reduce((l, o) => {
|
|
1599
1596
|
var h;
|
|
1600
1597
|
const d = o.rule.type, u = n.find((g) => g.cfId === o.cfId);
|
|
1601
|
-
if (d ===
|
|
1598
|
+
if (d === M.highlightCell)
|
|
1602
1599
|
u.result && V2(l, { style: u.result });
|
|
1603
|
-
else if (d ===
|
|
1600
|
+
else if (d === M.colorScale) {
|
|
1604
1601
|
const g = u == null ? void 0 : u.result;
|
|
1605
1602
|
g && typeof g == "string" && (l.style = { ...(h = l.style) != null ? h : {}, bg: { rgb: g } });
|
|
1606
|
-
} else if (d ===
|
|
1603
|
+
} else if (d === M.dataBar) {
|
|
1607
1604
|
const g = u == null ? void 0 : u.result;
|
|
1608
1605
|
g && (l.dataBar = g, l.isShowValue = g.isShowValue);
|
|
1609
|
-
} else if (d ===
|
|
1606
|
+
} else if (d === M.iconSet) {
|
|
1610
1607
|
const g = u == null ? void 0 : u.result;
|
|
1611
1608
|
g && (l.iconSet = g, l.isShowValue = g.isShowValue);
|
|
1612
1609
|
}
|
|
@@ -1787,12 +1784,12 @@ let s2 = class extends x2 {
|
|
|
1787
1784
|
}
|
|
1788
1785
|
};
|
|
1789
1786
|
s2 = m1([
|
|
1790
|
-
Y(0,
|
|
1791
|
-
Y(1,
|
|
1792
|
-
Y(2,
|
|
1793
|
-
Y(3,
|
|
1794
|
-
Y(4,
|
|
1795
|
-
Y(5,
|
|
1787
|
+
Y(0, S(y)),
|
|
1788
|
+
Y(1, S(M2)),
|
|
1789
|
+
Y(2, S(q)),
|
|
1790
|
+
Y(3, S(J2)),
|
|
1791
|
+
Y(4, S(a0)),
|
|
1792
|
+
Y(5, S(W))
|
|
1796
1793
|
], s2);
|
|
1797
1794
|
const F1 = (s) => s.getCurrentUnitForType(D2.UNIVER_SHEET).getUnitId(), w1 = (s) => {
|
|
1798
1795
|
var r;
|
|
@@ -1803,7 +1800,7 @@ var v1 = Object.defineProperty, p1 = Object.getOwnPropertyDescriptor, E1 = (s, r
|
|
|
1803
1800
|
(a = s[i]) && (n = a(n) || n);
|
|
1804
1801
|
return n;
|
|
1805
1802
|
}, _2 = (s, r) => (t, e) => r(t, e, s), G2 = (s, r, t) => E1(s, typeof r != "symbol" ? r + "" : r, t);
|
|
1806
|
-
let f2 = class extends
|
|
1803
|
+
let f2 = class extends t0 {
|
|
1807
1804
|
constructor(s = k2, r, t, e) {
|
|
1808
1805
|
super(), this._config = s, this._injector = r, this._commandService = t, this._configService = e;
|
|
1809
1806
|
const { ...n } = V2(
|
|
@@ -1814,7 +1811,7 @@ let f2 = class extends e0 {
|
|
|
1814
1811
|
this._configService.setConfig(f1, n), [
|
|
1815
1812
|
[s2],
|
|
1816
1813
|
[z],
|
|
1817
|
-
[
|
|
1814
|
+
[y],
|
|
1818
1815
|
[Q]
|
|
1819
1816
|
].forEach((i) => {
|
|
1820
1817
|
this._injector.add(i);
|
|
@@ -1834,7 +1831,7 @@ let f2 = class extends e0 {
|
|
|
1834
1831
|
});
|
|
1835
1832
|
}
|
|
1836
1833
|
onStarting() {
|
|
1837
|
-
this._injector.get(s2),
|
|
1834
|
+
this._injector.get(s2), n0(this._injector, [
|
|
1838
1835
|
[s2],
|
|
1839
1836
|
[Q]
|
|
1840
1837
|
]);
|
|
@@ -1844,9 +1841,9 @@ G2(f2, "pluginName", P2);
|
|
|
1844
1841
|
G2(f2, "type", D2.UNIVER_SHEET);
|
|
1845
1842
|
f2 = A1([
|
|
1846
1843
|
Q2(p0),
|
|
1847
|
-
_2(1,
|
|
1848
|
-
_2(2,
|
|
1849
|
-
_2(3,
|
|
1844
|
+
_2(1, S(M2)),
|
|
1845
|
+
_2(2, S(W)),
|
|
1846
|
+
_2(3, e0)
|
|
1850
1847
|
], f2);
|
|
1851
1848
|
const _1 = "sheet-conditional-rule-icon", x1 = 35, M1 = 15, y1 = 2, R1 = (s) => {
|
|
1852
1849
|
const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
|
|
@@ -1887,11 +1884,11 @@ class I1 extends $2 {
|
|
|
1887
1884
|
return;
|
|
1888
1885
|
c.add(Z);
|
|
1889
1886
|
}
|
|
1890
|
-
const { startX:
|
|
1887
|
+
const { startX: R, endX: A, startY: I, endY: L } = u || h ? g : d, v2 = A - R, o2 = L - I;
|
|
1891
1888
|
if (this._width > o2 || this._width > v2 + this._paddingRightAndLeft * 2)
|
|
1892
1889
|
return;
|
|
1893
|
-
const p2 = (o2 - this._width) / 2 +
|
|
1894
|
-
t.drawImage(E,
|
|
1890
|
+
const p2 = (o2 - this._width) / 2 + I;
|
|
1891
|
+
t.drawImage(E, R + this._paddingRightAndLeft, p2, this._width, this._width);
|
|
1895
1892
|
}), t.restore();
|
|
1896
1893
|
}
|
|
1897
1894
|
_init() {
|
|
@@ -1924,17 +1921,17 @@ export {
|
|
|
1924
1921
|
a2 as AddConditionalRuleMutation,
|
|
1925
1922
|
q2 as AddConditionalRuleMutationUndoFactory,
|
|
1926
1923
|
w as CFNumberOperator,
|
|
1927
|
-
|
|
1924
|
+
M as CFRuleType,
|
|
1928
1925
|
_ as CFSubRuleType,
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1926
|
+
k as CFTextOperator,
|
|
1927
|
+
B as CFTimePeriodOperator,
|
|
1928
|
+
b as CFValueType,
|
|
1932
1929
|
E2 as CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
|
|
1933
1930
|
k0 as ClearRangeCfCommand,
|
|
1934
1931
|
B0 as ClearWorksheetCfCommand,
|
|
1935
1932
|
z as ConditionalFormattingFormulaService,
|
|
1936
1933
|
I1 as ConditionalFormattingIcon,
|
|
1937
|
-
|
|
1934
|
+
y as ConditionalFormattingRuleModel,
|
|
1938
1935
|
s2 as ConditionalFormattingService,
|
|
1939
1936
|
Q as ConditionalFormattingViewModel,
|
|
1940
1937
|
V1 as DEFAULT_BG_COLOR,
|
|
@@ -1976,7 +1973,7 @@ export {
|
|
|
1976
1973
|
C2 as iconMap,
|
|
1977
1974
|
q1 as isAnchorEqual,
|
|
1978
1975
|
h2 as isFloatsEqual,
|
|
1979
|
-
|
|
1976
|
+
N as isNullable,
|
|
1980
1977
|
X1 as isRangesEqual,
|
|
1981
1978
|
R0 as moveByAnchor,
|
|
1982
1979
|
S1 as removeUndefinedAttr,
|