@silurus/ooxml 0.33.2 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/pptx-BiCFrgHM.js +23301 -0
- package/dist/pptx-fT7k8Zgz.cjs +1 -0
- package/dist/pptx.cjs +1 -1
- package/dist/pptx.mjs +1 -1
- package/dist/{renderer-BOwyHm7d.cjs → renderer-8yNL4LpS.cjs} +1 -1
- package/dist/{renderer-ChX8p6Vl.js → renderer-DsT75h1z.js} +53 -20
- package/dist/types/index.d.ts +52 -0
- package/dist/types/pptx.d.ts +37 -0
- package/dist/types/xlsx.d.ts +15 -0
- package/dist/{xlsx-vrX8XqIh.cjs → xlsx-B2JQRvXf.cjs} +9 -9
- package/dist/{xlsx-ChuZ_oeP.js → xlsx-hRYBeCtQ.js} +517 -458
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.mjs +1 -1
- package/package.json +1 -1
- package/dist/pptx-D8zbD_Gd.js +0 -23281
- package/dist/pptx-x0E1O-hf.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./autoResize-D-Yz7Izt.js";
|
|
2
|
-
import { t as r } from "./renderer-
|
|
2
|
+
import { t as r } from "./renderer-DsT75h1z.js";
|
|
3
3
|
//#region packages/core/src/sparkline/renderer.ts
|
|
4
4
|
function i(e, t, n) {
|
|
5
5
|
let { values: r } = n;
|
|
@@ -361,7 +361,7 @@ function O(e, t, n, r, i, a) {
|
|
|
361
361
|
if (l) e.fillStyle = l;
|
|
362
362
|
else {
|
|
363
363
|
let t = w(o);
|
|
364
|
-
e.fillStyle = t >= 1 ? S(s) :
|
|
364
|
+
e.fillStyle = t >= 1 ? S(s) : j(s, c, t);
|
|
365
365
|
}
|
|
366
366
|
return e.fillRect(n, r, i, a), !0;
|
|
367
367
|
}
|
|
@@ -394,17 +394,17 @@ function A(e, t, n, r, i) {
|
|
|
394
394
|
let a = Math.max(4, Math.min(8, Math.min(r, i) * .18));
|
|
395
395
|
e.save(), e.fillStyle = "#D40000", e.beginPath(), e.moveTo(t + r - a, n), e.lineTo(t + r, n), e.lineTo(t + r, n + a), e.closePath(), e.fill(), e.restore();
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function j(e, t, n) {
|
|
398
398
|
let r = e.replace("#", ""), i = t.replace("#", ""), a = parseInt(r.slice(0, 2), 16), o = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16), c = parseInt(i.slice(0, 2), 16), l = parseInt(i.slice(2, 4), 16), u = parseInt(i.slice(4, 6), 16), d = Math.min(1, Math.max(0, n));
|
|
399
399
|
return `rgb(${Math.round(a * d + c * (1 - d))},${Math.round(o * d + l * (1 - d))},${Math.round(s * d + u * (1 - d))})`;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function M(e, t = 1) {
|
|
402
402
|
return `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${Math.max(1, Math.round(e.size * h * t))}px ${e.name ? `"${e.name}", ${f}` : f}`;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function N(e, t, n, r, i, a) {
|
|
405
405
|
e.save(), e.strokeStyle = i, e.lineWidth = .5, e.beginPath(), a ? (e.moveTo(t, r - 1), e.lineTo(n, r - 1), e.moveTo(t, r + 1), e.lineTo(n, r + 1)) : (e.moveTo(t, r), e.lineTo(n, r)), e.stroke(), e.restore();
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function P(e, t) {
|
|
408
408
|
let n = t.font;
|
|
409
409
|
return n ? {
|
|
410
410
|
bold: n.bold,
|
|
@@ -418,7 +418,7 @@ function j(e, t) {
|
|
|
418
418
|
vertAlign: n.vertAlign
|
|
419
419
|
} : e;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function te(e, t) {
|
|
422
422
|
let n = e.cellXfs[t] ?? e.cellXfs[0] ?? {
|
|
423
423
|
fontId: 0,
|
|
424
424
|
fillId: 0,
|
|
@@ -452,7 +452,7 @@ function ie(e, t) {
|
|
|
452
452
|
xf: n
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function F(e) {
|
|
456
456
|
switch (e.type) {
|
|
457
457
|
case "empty": return "";
|
|
458
458
|
case "text": return e.text;
|
|
@@ -461,15 +461,15 @@ function M(e) {
|
|
|
461
461
|
case "error": return e.error;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function I(e, t, n) {
|
|
465
465
|
let r = t.cellXfs[e.styleIndex ?? 0]?.numFmtId ?? 0, i = t.numFmts?.find((e) => e.numFmtId === r)?.formatCode ?? null, a = n?.numFmtId ?? r, o = n?.formatCode ?? i;
|
|
466
466
|
if (e.value.type !== "number") {
|
|
467
|
-
let t =
|
|
468
|
-
return o ?
|
|
467
|
+
let t = F(e.value);
|
|
468
|
+
return o ? L(t, o) : t;
|
|
469
469
|
}
|
|
470
|
-
return
|
|
470
|
+
return ae(R(e.formula) ?? e.value.number, a, o);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function L(e, t) {
|
|
473
473
|
let n = t.split(";");
|
|
474
474
|
if (n.length < 4) return e;
|
|
475
475
|
let r = n[3];
|
|
@@ -488,12 +488,12 @@ function P(e, t) {
|
|
|
488
488
|
}
|
|
489
489
|
return i;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function R(e) {
|
|
492
492
|
if (!e) return null;
|
|
493
493
|
let t = e.trim().replace(/^=/, "").toUpperCase().replace(/\s+/g, "");
|
|
494
|
-
return t === "TODAY()" ?
|
|
494
|
+
return t === "TODAY()" ? tt() : t === "NOW()" ? nt() : null;
|
|
495
495
|
}
|
|
496
|
-
var
|
|
496
|
+
var z = {
|
|
497
497
|
14: "m/d/yyyy",
|
|
498
498
|
15: "d-mmm-yy",
|
|
499
499
|
16: "d-mmm",
|
|
@@ -517,7 +517,7 @@ var I = {
|
|
|
517
517
|
56: "m\"月\"d\"日\"",
|
|
518
518
|
57: "[$-411]ge.m.d",
|
|
519
519
|
58: "[$-411]ggge\"年\"m\"月\"d\"日\""
|
|
520
|
-
},
|
|
520
|
+
}, B = [
|
|
521
521
|
"January",
|
|
522
522
|
"February",
|
|
523
523
|
"March",
|
|
@@ -530,7 +530,7 @@ var I = {
|
|
|
530
530
|
"October",
|
|
531
531
|
"November",
|
|
532
532
|
"December"
|
|
533
|
-
],
|
|
533
|
+
], V = [
|
|
534
534
|
"Sunday",
|
|
535
535
|
"Monday",
|
|
536
536
|
"Tuesday",
|
|
@@ -538,7 +538,7 @@ var I = {
|
|
|
538
538
|
"Thursday",
|
|
539
539
|
"Friday",
|
|
540
540
|
"Saturday"
|
|
541
|
-
],
|
|
541
|
+
], ne = [
|
|
542
542
|
"日",
|
|
543
543
|
"月",
|
|
544
544
|
"火",
|
|
@@ -546,7 +546,7 @@ var I = {
|
|
|
546
546
|
"木",
|
|
547
547
|
"金",
|
|
548
548
|
"土"
|
|
549
|
-
],
|
|
549
|
+
], re = [
|
|
550
550
|
"日曜日",
|
|
551
551
|
"月曜日",
|
|
552
552
|
"火曜日",
|
|
@@ -554,7 +554,7 @@ var I = {
|
|
|
554
554
|
"木曜日",
|
|
555
555
|
"金曜日",
|
|
556
556
|
"土曜日"
|
|
557
|
-
],
|
|
557
|
+
], H = [
|
|
558
558
|
{
|
|
559
559
|
start: new Date(Date.UTC(2019, 4, 1)),
|
|
560
560
|
abbr: "R",
|
|
@@ -586,14 +586,14 @@ var I = {
|
|
|
586
586
|
long: "明治"
|
|
587
587
|
}
|
|
588
588
|
];
|
|
589
|
-
function
|
|
590
|
-
for (let t of
|
|
589
|
+
function U(e) {
|
|
590
|
+
for (let t of H) if (e.getTime() >= t.start.getTime()) return {
|
|
591
591
|
abbr: t.abbr,
|
|
592
592
|
short: t.short,
|
|
593
593
|
long: t.long,
|
|
594
594
|
year: e.getUTCFullYear() - t.start.getUTCFullYear() + 1
|
|
595
595
|
};
|
|
596
|
-
let t =
|
|
596
|
+
let t = H[H.length - 1];
|
|
597
597
|
return {
|
|
598
598
|
abbr: t.abbr,
|
|
599
599
|
short: t.short,
|
|
@@ -601,11 +601,11 @@ function H(e) {
|
|
|
601
601
|
year: e.getUTCFullYear()
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function ie(e) {
|
|
605
605
|
return /* @__PURE__ */ new Date((e - 25569) * 86400 * 1e3);
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
let n =
|
|
607
|
+
function W(e, t) {
|
|
608
|
+
let n = ie(e), r = n.getUTCFullYear(), i = n.getUTCMonth() + 1, a = n.getUTCDate(), o = n.getUTCDay(), s = n.getUTCHours(), c = n.getUTCMinutes(), l = n.getUTCSeconds(), u = t.split(";")[0], d = /am\/pm|a\/p/i.test(u), f = null, p = () => f ??= U(n), m = "", h = 0, g = !1;
|
|
609
609
|
for (; h < u.length;) {
|
|
610
610
|
let t = u[h];
|
|
611
611
|
if (t === "\"") {
|
|
@@ -633,11 +633,11 @@ function U(e, t) {
|
|
|
633
633
|
let e = 0;
|
|
634
634
|
for (; h < u.length && u[h].toLowerCase() === "m";) e++, h++;
|
|
635
635
|
let t = u.slice(h).replace(/\[[^\]]*\]/g, "");
|
|
636
|
-
g || /^:s/i.test(t) ? m += e >= 2 ? String(c).padStart(2, "0") : String(c) : e === 1 ? m += String(i) : e === 2 ? m += String(i).padStart(2, "0") : e === 3 ? m +=
|
|
636
|
+
g || /^:s/i.test(t) ? m += e >= 2 ? String(c).padStart(2, "0") : String(c) : e === 1 ? m += String(i) : e === 2 ? m += String(i).padStart(2, "0") : e === 3 ? m += B[i - 1].slice(0, 3) : e === 4 ? m += B[i - 1] : m += B[i - 1][0], g = !1;
|
|
637
637
|
} else if (t === "d" || t === "D") {
|
|
638
638
|
let e = 0;
|
|
639
639
|
for (; h < u.length && u[h].toLowerCase() === "d";) e++, h++;
|
|
640
|
-
e === 1 ? m += String(a) : e === 2 ? m += String(a).padStart(2, "0") : e === 3 ? m +=
|
|
640
|
+
e === 1 ? m += String(a) : e === 2 ? m += String(a).padStart(2, "0") : e === 3 ? m += V[o].slice(0, 3) : m += V[o], g = !1;
|
|
641
641
|
} else if (t === "h" || t === "H") {
|
|
642
642
|
let e = 0;
|
|
643
643
|
for (; h < u.length && u[h].toLowerCase() === "h";) e++, h++;
|
|
@@ -664,48 +664,48 @@ function U(e, t) {
|
|
|
664
664
|
m += e >= 2 ? String(t).padStart(2, "0") : String(t), g = !1;
|
|
665
665
|
} else if (t === "A" || t === "a") {
|
|
666
666
|
let e = u.slice(h).toUpperCase();
|
|
667
|
-
e.startsWith("AAAA") ? (m +=
|
|
667
|
+
e.startsWith("AAAA") ? (m += re[o], h += 4) : e.startsWith("AAA") ? (m += ne[o], h += 3) : e.startsWith("AM/PM") ? (m += s < 12 ? "AM" : "PM", h += 5) : e.startsWith("A/P") ? (m += s < 12 ? "A" : "P", h += 3) : (m += t, h++), g = !1;
|
|
668
668
|
} else m += t, h++, t !== ":" && t !== "/" && t !== "-" && t !== "." && t !== " " && (g = !1);
|
|
669
669
|
}
|
|
670
670
|
return m;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function G(e) {
|
|
673
673
|
if (/\[[hms]+\]/i.test(e)) return !0;
|
|
674
674
|
let t = e.replace(/"[^"]*"/g, "").replace(/\[[^\]]*\]/g, "");
|
|
675
675
|
return /[yd]/i.test(t) || /a{3,}/i.test(t);
|
|
676
676
|
}
|
|
677
|
-
function
|
|
678
|
-
let r =
|
|
679
|
-
if (r) return
|
|
680
|
-
if (n) return
|
|
677
|
+
function ae(e, t, n) {
|
|
678
|
+
let r = z[t];
|
|
679
|
+
if (r) return W(e, r);
|
|
680
|
+
if (n) return G(n) ? W(e, n) : le(e, n);
|
|
681
681
|
switch (t) {
|
|
682
682
|
case 0: return String(e);
|
|
683
683
|
case 1: return Math.round(e).toString();
|
|
684
684
|
case 2: return e.toFixed(2);
|
|
685
|
-
case 3: return
|
|
686
|
-
case 4: return
|
|
685
|
+
case 3: return oe(e, 0);
|
|
686
|
+
case 4: return oe(e, 2);
|
|
687
687
|
case 9: return Math.round(e * 100) + "%";
|
|
688
688
|
case 10: return (e * 100).toFixed(2) + "%";
|
|
689
689
|
case 11: return e.toExponential(2);
|
|
690
690
|
case 37:
|
|
691
|
-
case 38: return
|
|
691
|
+
case 38: return oe(e, 0);
|
|
692
692
|
case 39:
|
|
693
|
-
case 40: return
|
|
693
|
+
case 40: return oe(e, 2);
|
|
694
694
|
case 49: return String(e);
|
|
695
695
|
default: return String(e);
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function oe(e, t) {
|
|
699
699
|
return e.toLocaleString("en-US", {
|
|
700
700
|
minimumFractionDigits: t,
|
|
701
701
|
maximumFractionDigits: t
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function K(e) {
|
|
705
705
|
let t = e.match(/\.([0#]+)/);
|
|
706
706
|
return t ? t[1].length : 0;
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function se(e) {
|
|
709
709
|
let t = [], n = "", r = !1, i = !1, a = (e) => {
|
|
710
710
|
if (!e) return;
|
|
711
711
|
let n = t[t.length - 1];
|
|
@@ -742,39 +742,39 @@ function ce(e) {
|
|
|
742
742
|
numSpec: n
|
|
743
743
|
};
|
|
744
744
|
}
|
|
745
|
-
function
|
|
746
|
-
let n = t.includes(",") && /[#0]/.test(t), r =
|
|
747
|
-
return n ?
|
|
745
|
+
function ce(e, t) {
|
|
746
|
+
let n = t.includes(",") && /[#0]/.test(t), r = K(t);
|
|
747
|
+
return n ? oe(e, r) : t.includes(".") ? e.toFixed(r) : /[#0?]/.test(t) ? Math.round(e).toString() : String(e);
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function le(e, t) {
|
|
750
750
|
let n = t.split(";"), r;
|
|
751
751
|
r = e > 0 ? n[0] : e < 0 ? n.length > 1 ? n[1] : n[0] : n.length > 2 ? n[2] : n[0];
|
|
752
|
-
let { tokens: i, numSpec: a } =
|
|
752
|
+
let { tokens: i, numSpec: a } = se(r), o = i.some((e) => e.kind === "percent"), s = i.find((e) => e.kind === "sci"), c = e;
|
|
753
753
|
o && (c *= 100);
|
|
754
754
|
let l, u = "";
|
|
755
755
|
if (s) {
|
|
756
|
-
let e =
|
|
756
|
+
let e = K(a), [t, n] = c.toExponential(e).split("e");
|
|
757
757
|
l = t;
|
|
758
758
|
let r = parseInt(n, 10);
|
|
759
759
|
u = (r < 0 ? "-" : s.expSign ? "+" : "") + String(Math.abs(r)).padStart(2, "0");
|
|
760
|
-
} else l =
|
|
760
|
+
} else l = ce(c, a);
|
|
761
761
|
let d = "", f = !1;
|
|
762
762
|
for (let e of i) e.kind === "lit" ? d += e.text : e.kind === "percent" ? d += "%" : e.kind === "num" ? (d += l, f = !0) : e.kind === "sci" && (d += "E" + u);
|
|
763
763
|
return !f && (a.length > 0 || s) && (d += l), d;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function ue(e, t, n) {
|
|
766
766
|
let r = [];
|
|
767
|
-
for (let i of t.split("\n")) r.push(...
|
|
767
|
+
for (let i of t.split("\n")) r.push(...q(e, i, n));
|
|
768
768
|
return r;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function de(e) {
|
|
771
771
|
return e >= 12288 && e <= 40959 || e >= 63744 && e <= 64255 || e >= 44032 && e <= 55215 || e >= 65280 && e <= 65519;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function q(e, t, n) {
|
|
774
774
|
let r = [], i = [], a = 0;
|
|
775
775
|
for (; a < t.length;) {
|
|
776
776
|
let e = t[a], n = e.codePointAt(0) ?? 0;
|
|
777
|
-
if (
|
|
777
|
+
if (de(n)) i.push(e), a += n > 65535 ? 2 : 1;
|
|
778
778
|
else if (e === " ") {
|
|
779
779
|
let e = a;
|
|
780
780
|
for (; e < t.length && t[e] === " ";) e++;
|
|
@@ -783,7 +783,7 @@ function K(e, t, n) {
|
|
|
783
783
|
let e = a;
|
|
784
784
|
for (; e < t.length;) {
|
|
785
785
|
let n = t[e], r = n.codePointAt(0) ?? 0;
|
|
786
|
-
if (n === " " ||
|
|
786
|
+
if (n === " " || de(r)) break;
|
|
787
787
|
e += r > 65535 ? 2 : 1;
|
|
788
788
|
}
|
|
789
789
|
i.push(t.slice(a, e)), a = e;
|
|
@@ -800,7 +800,7 @@ function K(e, t, n) {
|
|
|
800
800
|
}
|
|
801
801
|
return r.push(o), r;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function fe(e, t, n, r, i) {
|
|
804
804
|
let a = [], o = [], s = 0, c = 0, l = () => {
|
|
805
805
|
o.length !== 0 && (a.push({
|
|
806
806
|
segments: o,
|
|
@@ -808,7 +808,7 @@ function pe(e, t, n, r, i) {
|
|
|
808
808
|
}), o = [], s = 0, c = 0);
|
|
809
809
|
}, u = (t, n) => {
|
|
810
810
|
if (!t) return;
|
|
811
|
-
e.font =
|
|
811
|
+
e.font = M(n, r);
|
|
812
812
|
let a = e.measureText(t).width;
|
|
813
813
|
o.length > 0 && s + a > i && l(), o.push({
|
|
814
814
|
text: t,
|
|
@@ -817,7 +817,7 @@ function pe(e, t, n, r, i) {
|
|
|
817
817
|
}), s += a, n.size > c && (c = n.size);
|
|
818
818
|
}, d = (e) => e >= 12288 && e <= 40959 || e >= 63744 && e <= 64255 || e >= 44032 && e <= 55215 || e >= 65280 && e <= 65519;
|
|
819
819
|
for (let e of t) {
|
|
820
|
-
let t =
|
|
820
|
+
let t = P(n, e), r = [], i = 0;
|
|
821
821
|
for (; i < e.text.length;) {
|
|
822
822
|
let t = e.text[i], n = t.codePointAt(0) ?? 0;
|
|
823
823
|
if (n === 10) r.push("\n"), i += 1;
|
|
@@ -840,7 +840,7 @@ function pe(e, t, n, r, i) {
|
|
|
840
840
|
}
|
|
841
841
|
return l(), a;
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function pe(e) {
|
|
844
844
|
let t = "";
|
|
845
845
|
for (; e > 0;) {
|
|
846
846
|
let n = (e - 1) % 26;
|
|
@@ -848,22 +848,22 @@ function me(e) {
|
|
|
848
848
|
}
|
|
849
849
|
return t;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function me(e, t, n) {
|
|
852
852
|
for (let r of e) if (t >= r.top && t <= r.bottom && n >= r.left && n <= r.right) return !0;
|
|
853
853
|
return !1;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function he(e) {
|
|
856
856
|
return e && e.value.type === "number" ? e.value.number : null;
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function ge(e) {
|
|
859
859
|
return e && e.value.type === "text" ? e.value.text : null;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function _e(e, t) {
|
|
862
862
|
let n = [];
|
|
863
|
-
for (let r of e.rows) for (let e of r.cells) e.value.type === "number" &&
|
|
863
|
+
for (let r of e.rows) for (let e of r.cells) e.value.type === "number" && me(t, e.row, e.col) && n.push(e.value.number);
|
|
864
864
|
return n;
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function ve(e, t) {
|
|
867
867
|
let n = t.length ? Math.min(...t) : 0, r = t.length ? Math.max(...t) : 0, i = e.value == null ? NaN : parseFloat(e.value);
|
|
868
868
|
switch (e.kind) {
|
|
869
869
|
case "min": return n;
|
|
@@ -881,20 +881,20 @@ function ye(e, t) {
|
|
|
881
881
|
default: return isNaN(i) ? 0 : i;
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function ye(e) {
|
|
885
885
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
886
886
|
for (let t of e.rows) for (let e of t.cells) n.set(`${e.row}:${e.col}`, e);
|
|
887
887
|
let r = /* @__PURE__ */ new Map();
|
|
888
888
|
for (let t of e.definedNames ?? []) r.set(t.name, t);
|
|
889
889
|
for (let n of e.conditionalFormats ?? []) {
|
|
890
|
-
let r =
|
|
890
|
+
let r = _e(e, n.sqref);
|
|
891
891
|
for (let e of n.rules) {
|
|
892
892
|
let i = {
|
|
893
893
|
rule: e,
|
|
894
894
|
sqref: n.sqref
|
|
895
895
|
};
|
|
896
|
-
if (e.type === "colorScale") i.scaleStops = e.stops.map((e) =>
|
|
897
|
-
else if (e.type === "dataBar") i.barMin =
|
|
896
|
+
if (e.type === "colorScale") i.scaleStops = e.stops.map((e) => ve(e, r));
|
|
897
|
+
else if (e.type === "dataBar") i.barMin = ve(e.min, r), i.barMax = ve(e.max, r);
|
|
898
898
|
else if (e.type === "top10") {
|
|
899
899
|
let t = [...r].sort((e, t) => e - t), n = t.length;
|
|
900
900
|
if (n > 0) {
|
|
@@ -905,7 +905,7 @@ function be(e) {
|
|
|
905
905
|
} else i.top10Threshold = e.top ? t[Math.max(0, n - r)] : t[Math.min(n - 1, r - 1)];
|
|
906
906
|
i.top10IsTop = e.top;
|
|
907
907
|
}
|
|
908
|
-
} else e.type === "aboveAverage" ? r.length > 0 && (i.avgValue = r.reduce((e, t) => e + t, 0) / r.length, i.avgIsAbove = e.aboveAverage) : e.type === "iconSet" && (i.iconThresholds = e.cfvos.map((e) =>
|
|
908
|
+
} else e.type === "aboveAverage" ? r.length > 0 && (i.avgValue = r.reduce((e, t) => e + t, 0) / r.length, i.avgIsAbove = e.aboveAverage) : e.type === "iconSet" && (i.iconThresholds = e.cfvos.map((e) => ve(e, r)));
|
|
909
909
|
t.push(i);
|
|
910
910
|
}
|
|
911
911
|
}
|
|
@@ -916,7 +916,7 @@ function be(e) {
|
|
|
916
916
|
definedNames: r
|
|
917
917
|
};
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function be(e, t, n) {
|
|
920
920
|
switch (t) {
|
|
921
921
|
case "greaterThan": return e > (n[0] ?? 0);
|
|
922
922
|
case "greaterThanOrEqual": return e >= (n[0] ?? 0);
|
|
@@ -929,13 +929,13 @@ function xe(e, t, n) {
|
|
|
929
929
|
default: return !1;
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function xe(e) {
|
|
933
933
|
let t = e.trim();
|
|
934
934
|
if (t.length >= 2 && t.startsWith("\"") && t.endsWith("\"")) return { text: t.slice(1, -1).replace(/""/g, "\"") };
|
|
935
935
|
let n = parseFloat(t);
|
|
936
936
|
return isNaN(n) ? { text: t } : { num: n };
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function Se(e, t, n) {
|
|
939
939
|
let r = n[0] ?? "", i = n[1] ?? "", a = (e) => e.toLowerCase();
|
|
940
940
|
switch (t) {
|
|
941
941
|
case "equal": return a(e) === a(r);
|
|
@@ -949,21 +949,21 @@ function Ce(e, t, n) {
|
|
|
949
949
|
default: return !1;
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Ce(e, t, n) {
|
|
953
953
|
let r = e.replace("#", ""), i = t.replace("#", ""), a = parseInt(r.slice(0, 2), 16), o = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16), c = parseInt(i.slice(0, 2), 16), l = parseInt(i.slice(2, 4), 16), u = parseInt(i.slice(4, 6), 16), d = Math.round(a + (c - a) * n), f = Math.round(o + (l - o) * n), p = Math.round(s + (u - s) * n);
|
|
954
954
|
return `#${d.toString(16).padStart(2, "0").toUpperCase()}${f.toString(16).padStart(2, "0").toUpperCase()}${p.toString(16).padStart(2, "0").toUpperCase()}`;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
956
|
+
function we(e, t, n) {
|
|
957
957
|
if (!t.length) return "#FFFFFF";
|
|
958
958
|
if (e <= n[0]) return t[0].color;
|
|
959
959
|
if (e >= n[n.length - 1]) return t[t.length - 1].color;
|
|
960
960
|
for (let r = 1; r < n.length; r++) if (e <= n[r]) {
|
|
961
961
|
let i = n[r - 1], a = n[r], o = a === i ? 0 : (e - i) / (a - i);
|
|
962
|
-
return
|
|
962
|
+
return Ce(t[r - 1].color, t[r].color, o);
|
|
963
963
|
}
|
|
964
964
|
return t[t.length - 1].color;
|
|
965
965
|
}
|
|
966
|
-
function
|
|
966
|
+
function Te(e, t) {
|
|
967
967
|
if (t && (t.fill && !e.fill && (e.fill = t.fill), t.font?.color && e.fontColor == null && (e.fontColor = t.font.color), t.font?.bold && e.fontBold == null && (e.fontBold = !0), t.font?.italic && e.fontItalic == null && (e.fontItalic = !0), t.font?.underline && e.fontUnderline == null && (e.fontUnderline = !0), t.font?.strike && e.fontStrike == null && (e.fontStrike = !0), t.numFmt && e.numFmt == null && (e.numFmt = {
|
|
968
968
|
numFmtId: t.numFmt.numFmtId,
|
|
969
969
|
formatCode: t.numFmt.formatCode || null
|
|
@@ -979,16 +979,16 @@ function Ee(e, t) {
|
|
|
979
979
|
};
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function Ee(e, t, n, r, i) {
|
|
983
983
|
let a = {};
|
|
984
984
|
if (!r.compiled.length) return a;
|
|
985
985
|
for (let o of r.compiled) {
|
|
986
|
-
if (!
|
|
987
|
-
let s = o.rule, c =
|
|
986
|
+
if (!me(o.sqref, t, n)) continue;
|
|
987
|
+
let s = o.rule, c = he(e);
|
|
988
988
|
if (s.type === "expression") {
|
|
989
989
|
let e = o.sqref[0];
|
|
990
990
|
if (!e) continue;
|
|
991
|
-
if (
|
|
991
|
+
if (Oe(s.formula, {
|
|
992
992
|
row: t,
|
|
993
993
|
col: n,
|
|
994
994
|
anchorRow: e.top,
|
|
@@ -996,18 +996,18 @@ function De(e, t, n, r, i) {
|
|
|
996
996
|
cellIndex: r.cellIndex,
|
|
997
997
|
definedNames: r.definedNames,
|
|
998
998
|
depth: 0
|
|
999
|
-
}) && (
|
|
999
|
+
}) && (Te(a, s.dxfId == null ? null : i[s.dxfId]), s.stopIfTrue)) break;
|
|
1000
1000
|
continue;
|
|
1001
1001
|
}
|
|
1002
1002
|
if (s.type === "cellIs") {
|
|
1003
|
-
let t = s.formulas.map(
|
|
1004
|
-
c != null && t.every((e) => e.num != null) ? r =
|
|
1003
|
+
let t = s.formulas.map(xe), n = ge(e), r = !1;
|
|
1004
|
+
c != null && t.every((e) => e.num != null) ? r = be(c, s.operator, t.map((e) => e.num)) : n != null && t.every((e) => e.text != null) && (r = Se(n, s.operator, t.map((e) => e.text))), r && Te(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
1005
1005
|
} else if (s.type === "top10") {
|
|
1006
1006
|
if (c == null || o.top10Threshold == null) continue;
|
|
1007
|
-
(o.top10IsTop ? c >= o.top10Threshold : c <= o.top10Threshold) &&
|
|
1007
|
+
(o.top10IsTop ? c >= o.top10Threshold : c <= o.top10Threshold) && Te(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
1008
1008
|
} else if (s.type === "aboveAverage") {
|
|
1009
1009
|
if (c == null || o.avgValue == null) continue;
|
|
1010
|
-
(o.avgIsAbove ? c > o.avgValue : c < o.avgValue) &&
|
|
1010
|
+
(o.avgIsAbove ? c > o.avgValue : c < o.avgValue) && Te(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
1011
1011
|
} else if (s.type === "iconSet") {
|
|
1012
1012
|
if (c == null || !o.iconThresholds?.length) continue;
|
|
1013
1013
|
let e = o.iconThresholds, t = e.length, n = 0;
|
|
@@ -1024,7 +1024,7 @@ function De(e, t, n, r, i) {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
} else if (s.type === "colorScale") {
|
|
1026
1026
|
if (c == null || !o.scaleStops || a.fill) continue;
|
|
1027
|
-
let e =
|
|
1027
|
+
let e = we(c, s.stops, o.scaleStops);
|
|
1028
1028
|
a.fill = {
|
|
1029
1029
|
patternType: "solid",
|
|
1030
1030
|
fgColor: e,
|
|
@@ -1042,37 +1042,37 @@ function De(e, t, n, r, i) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
return a;
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function J(e) {
|
|
1046
1046
|
return Array.isArray(e) ? e : [e];
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function Y(e) {
|
|
1049
1049
|
return Array.isArray(e) ? e[0] ?? 0 : e;
|
|
1050
1050
|
}
|
|
1051
|
-
var
|
|
1052
|
-
function
|
|
1051
|
+
var De = 8;
|
|
1052
|
+
function Oe(e, t) {
|
|
1053
1053
|
try {
|
|
1054
|
-
return
|
|
1054
|
+
return ke(Fe(e, t));
|
|
1055
1055
|
} catch {
|
|
1056
1056
|
return !1;
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1060
|
-
let t =
|
|
1059
|
+
function ke(e) {
|
|
1060
|
+
let t = Y(e);
|
|
1061
1061
|
return typeof t == "boolean" ? t : typeof t == "number" ? t !== 0 : typeof t == "string" ? t.length > 0 && t.toUpperCase() !== "FALSE" : !1;
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1064
|
-
let t =
|
|
1063
|
+
function X(e) {
|
|
1064
|
+
let t = Y(e);
|
|
1065
1065
|
if (typeof t == "number") return t;
|
|
1066
1066
|
if (typeof t == "boolean") return +!!t;
|
|
1067
1067
|
if (t == null) return 0;
|
|
1068
1068
|
let n = parseFloat(String(t));
|
|
1069
1069
|
return isNaN(n) ? 0 : n;
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1072
|
-
let t =
|
|
1071
|
+
function Z(e) {
|
|
1072
|
+
let t = Y(e);
|
|
1073
1073
|
return t == null ? "" : typeof t == "boolean" ? t ? "TRUE" : "FALSE" : String(t);
|
|
1074
1074
|
}
|
|
1075
|
-
var
|
|
1075
|
+
var Ae = new Set([
|
|
1076
1076
|
"<",
|
|
1077
1077
|
">",
|
|
1078
1078
|
"=",
|
|
@@ -1084,7 +1084,7 @@ var je = new Set([
|
|
|
1084
1084
|
"^",
|
|
1085
1085
|
"%"
|
|
1086
1086
|
]);
|
|
1087
|
-
function
|
|
1087
|
+
function je(e) {
|
|
1088
1088
|
let t = [], n = 0, r = e;
|
|
1089
1089
|
for (; n < r.length;) {
|
|
1090
1090
|
let e = r[n];
|
|
@@ -1145,7 +1145,7 @@ function Me(e) {
|
|
|
1145
1145
|
}), n = e;
|
|
1146
1146
|
continue;
|
|
1147
1147
|
}
|
|
1148
|
-
if (
|
|
1148
|
+
if (Ae.has(e)) {
|
|
1149
1149
|
(e === "<" || e === ">") && (r[n + 1] === "=" || e === "<" && r[n + 1] === ">") ? (t.push({
|
|
1150
1150
|
kind: "op",
|
|
1151
1151
|
text: r.slice(n, n + 2)
|
|
@@ -1155,12 +1155,12 @@ function Me(e) {
|
|
|
1155
1155
|
}), n++);
|
|
1156
1156
|
continue;
|
|
1157
1157
|
}
|
|
1158
|
-
if (e === "$" ||
|
|
1158
|
+
if (e === "$" || Me(e)) {
|
|
1159
1159
|
let e = n;
|
|
1160
|
-
for (; e < r.length && (r[e] === "$" ||
|
|
1160
|
+
for (; e < r.length && (r[e] === "$" || Ne(r[e]));) e++;
|
|
1161
1161
|
let i = r.slice(n, e);
|
|
1162
1162
|
n = e;
|
|
1163
|
-
let a =
|
|
1163
|
+
let a = Pe(i);
|
|
1164
1164
|
if (a) t.push({
|
|
1165
1165
|
kind: "ref",
|
|
1166
1166
|
text: i,
|
|
@@ -1182,13 +1182,13 @@ function Me(e) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
return t;
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1185
|
+
function Me(e) {
|
|
1186
1186
|
return e >= "A" && e <= "Z" || e >= "a" && e <= "z" || e === "_";
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1189
|
-
return
|
|
1188
|
+
function Ne(e) {
|
|
1189
|
+
return Me(e) || e >= "0" && e <= "9" || e === ".";
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function Pe(e) {
|
|
1192
1192
|
let t = 0, n = !1, r = !1;
|
|
1193
1193
|
e[t] === "$" && (n = !0, t++);
|
|
1194
1194
|
let i = t;
|
|
@@ -1208,43 +1208,43 @@ function Fe(e) {
|
|
|
1208
1208
|
row: s
|
|
1209
1209
|
};
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1212
|
-
return
|
|
1213
|
-
toks:
|
|
1211
|
+
function Fe(e, t) {
|
|
1212
|
+
return Le({
|
|
1213
|
+
toks: je(e),
|
|
1214
1214
|
pos: 0
|
|
1215
1215
|
}, t);
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function Ie(e) {
|
|
1218
1218
|
return e.toks[e.pos];
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Q(e) {
|
|
1221
1221
|
return e.toks[e.pos++];
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1224
|
-
return
|
|
1223
|
+
function Le(e, t) {
|
|
1224
|
+
return Re(e, t);
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1227
|
-
let n =
|
|
1226
|
+
function Re(e, t) {
|
|
1227
|
+
let n = ze(e, t), r = Ie(e);
|
|
1228
1228
|
if (r && r.kind === "op" && (r.text === "<" || r.text === ">" || r.text === "<=" || r.text === ">=" || r.text === "=" || r.text === "<>")) {
|
|
1229
|
-
|
|
1230
|
-
let i =
|
|
1231
|
-
return
|
|
1229
|
+
Q(e);
|
|
1230
|
+
let i = ze(e, t);
|
|
1231
|
+
return Be(r.text, n, i);
|
|
1232
1232
|
}
|
|
1233
1233
|
return n;
|
|
1234
1234
|
}
|
|
1235
|
-
function
|
|
1236
|
-
let n =
|
|
1235
|
+
function ze(e, t) {
|
|
1236
|
+
let n = Ve(e, t);
|
|
1237
1237
|
for (;;) {
|
|
1238
|
-
let r =
|
|
1238
|
+
let r = Ie(e);
|
|
1239
1239
|
if (!r || r.kind !== "op" || r.text !== "&") break;
|
|
1240
|
-
|
|
1241
|
-
let i =
|
|
1242
|
-
n =
|
|
1240
|
+
Q(e);
|
|
1241
|
+
let i = Ve(e, t);
|
|
1242
|
+
n = Z(n) + Z(i);
|
|
1243
1243
|
}
|
|
1244
1244
|
return n;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1247
|
-
let r = typeof t == "string" && isNaN(parseFloat(t)) ? null :
|
|
1246
|
+
function Be(e, t, n) {
|
|
1247
|
+
let r = typeof t == "string" && isNaN(parseFloat(t)) ? null : X(t), i = typeof n == "string" && isNaN(parseFloat(n)) ? null : X(n);
|
|
1248
1248
|
if (r !== null && i !== null) switch (e) {
|
|
1249
1249
|
case "<": return r < i;
|
|
1250
1250
|
case ">": return r > i;
|
|
@@ -1264,67 +1264,67 @@ function Ve(e, t, n) {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
return !1;
|
|
1266
1266
|
}
|
|
1267
|
-
function
|
|
1268
|
-
let n =
|
|
1267
|
+
function Ve(e, t) {
|
|
1268
|
+
let n = He(e, t);
|
|
1269
1269
|
for (;;) {
|
|
1270
|
-
let r =
|
|
1270
|
+
let r = Ie(e);
|
|
1271
1271
|
if (!r || r.kind !== "op" || r.text !== "+" && r.text !== "-") break;
|
|
1272
|
-
|
|
1273
|
-
let i =
|
|
1274
|
-
n = r.text === "+" ?
|
|
1272
|
+
Q(e);
|
|
1273
|
+
let i = He(e, t);
|
|
1274
|
+
n = r.text === "+" ? X(n) + X(i) : X(n) - X(i);
|
|
1275
1275
|
}
|
|
1276
1276
|
return n;
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1279
|
-
let n =
|
|
1278
|
+
function He(e, t) {
|
|
1279
|
+
let n = Ue(e, t);
|
|
1280
1280
|
for (;;) {
|
|
1281
|
-
let r =
|
|
1281
|
+
let r = Ie(e);
|
|
1282
1282
|
if (!r || r.kind !== "op" || r.text !== "*" && r.text !== "/") break;
|
|
1283
|
-
|
|
1284
|
-
let i =
|
|
1285
|
-
if (r.text === "*") n =
|
|
1283
|
+
Q(e);
|
|
1284
|
+
let i = Ue(e, t);
|
|
1285
|
+
if (r.text === "*") n = X(n) * X(i);
|
|
1286
1286
|
else {
|
|
1287
|
-
let e =
|
|
1288
|
-
n = e === 0 ? 0 :
|
|
1287
|
+
let e = X(i);
|
|
1288
|
+
n = e === 0 ? 0 : X(n) / e;
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
return n;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1294
|
-
let n =
|
|
1295
|
-
return n && n.kind === "op" && n.text === "-" ? (
|
|
1293
|
+
function Ue(e, t) {
|
|
1294
|
+
let n = Ie(e);
|
|
1295
|
+
return n && n.kind === "op" && n.text === "-" ? (Q(e), -X(Ue(e, t))) : n && n.kind === "op" && n.text === "+" ? (Q(e), X(Ue(e, t))) : We(e, t);
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
let n =
|
|
1297
|
+
function We(e, t) {
|
|
1298
|
+
let n = Q(e);
|
|
1299
1299
|
if (!n) return 0;
|
|
1300
1300
|
if (n.kind === "num") return parseFloat(n.text);
|
|
1301
1301
|
if (n.kind === "str") return n.text;
|
|
1302
1302
|
if (n.kind === "bool") return n.text === "TRUE";
|
|
1303
1303
|
if (n.kind === "lparen") {
|
|
1304
|
-
let n =
|
|
1304
|
+
let n = Le(e, t), r = Q(e);
|
|
1305
1305
|
if (!r || r.kind !== "rparen") throw Error("missing )");
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
1308
|
if (n.kind === "ref") {
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1311
|
-
let r =
|
|
1309
|
+
if (Ie(e)?.kind === "colon") {
|
|
1310
|
+
Q(e);
|
|
1311
|
+
let r = Q(e);
|
|
1312
1312
|
if (r?.kind !== "ref" || !r.ref) throw Error("range: expected ref after :");
|
|
1313
|
-
return
|
|
1313
|
+
return qe(n.ref, r.ref, t);
|
|
1314
1314
|
}
|
|
1315
|
-
return
|
|
1315
|
+
return Ke(n.ref, t);
|
|
1316
1316
|
}
|
|
1317
1317
|
if (n.kind === "name") {
|
|
1318
|
-
if (
|
|
1319
|
-
|
|
1318
|
+
if (Ie(e)?.kind === "lparen") {
|
|
1319
|
+
Q(e);
|
|
1320
1320
|
let r = [];
|
|
1321
|
-
if (
|
|
1322
|
-
let i =
|
|
1321
|
+
if (Ie(e)?.kind !== "rparen") for (r.push(Le(e, t)); Ie(e)?.kind === "comma";) Q(e), r.push(Le(e, t));
|
|
1322
|
+
let i = Q(e);
|
|
1323
1323
|
if (!i || i.kind !== "rparen") throw Error("missing )");
|
|
1324
|
-
return
|
|
1324
|
+
return Ye(n.text, r, t);
|
|
1325
1325
|
}
|
|
1326
1326
|
let r = t.definedNames.get(n.text);
|
|
1327
|
-
return r && t.depth <
|
|
1327
|
+
return r && t.depth < De ? Fe(Ge(r.formula), {
|
|
1328
1328
|
...t,
|
|
1329
1329
|
anchorRow: 1,
|
|
1330
1330
|
anchorCol: 1,
|
|
@@ -1333,20 +1333,20 @@ function Ge(e, t) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
return 0;
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1336
|
+
function Ge(e) {
|
|
1337
1337
|
let t = e.match(/^(?:'[^']*'|[A-Za-z_][A-Za-z0-9_.]*)!(.*)$/);
|
|
1338
1338
|
return t ? t[1] : e;
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function Ke(e, t) {
|
|
1341
1341
|
let n = e.colAbs ? e.col : e.col + (t.col - t.anchorCol), r = e.rowAbs ? e.row : e.row + (t.row - t.anchorRow);
|
|
1342
|
-
return
|
|
1342
|
+
return Je(t.cellIndex.get(`${r}:${n}`));
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function qe(e, t, n) {
|
|
1345
1345
|
let r = e.colAbs ? e.col : e.col + (n.col - n.anchorCol), i = e.rowAbs ? e.row : e.row + (n.row - n.anchorRow), a = t.colAbs ? t.col : t.col + (n.col - n.anchorCol), o = t.rowAbs ? t.row : t.row + (n.row - n.anchorRow), s = Math.min(r, a), c = Math.max(r, a), l = Math.min(i, o), u = Math.max(i, o), d = [], f = 4096;
|
|
1346
|
-
for (let e = l; e <= u && d.length < f; e++) for (let t = s; t <= c && d.length < f; t++) d.push(
|
|
1346
|
+
for (let e = l; e <= u && d.length < f; e++) for (let t = s; t <= c && d.length < f; t++) d.push(Je(n.cellIndex.get(`${e}:${t}`)));
|
|
1347
1347
|
return d;
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function Je(e) {
|
|
1350
1350
|
if (!e) return null;
|
|
1351
1351
|
switch (e.value.type) {
|
|
1352
1352
|
case "number": return e.value.number;
|
|
@@ -1356,162 +1356,162 @@ function Ye(e) {
|
|
|
1356
1356
|
default: return null;
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
-
function
|
|
1359
|
+
function Ye(e, t, n) {
|
|
1360
1360
|
switch (e.toUpperCase()) {
|
|
1361
|
-
case "AND": return t.flatMap(
|
|
1362
|
-
case "OR": return t.flatMap(
|
|
1363
|
-
case "NOT": return !
|
|
1364
|
-
case "IF": return
|
|
1361
|
+
case "AND": return t.flatMap(J).every((e) => ke(e));
|
|
1362
|
+
case "OR": return t.flatMap(J).some((e) => ke(e));
|
|
1363
|
+
case "NOT": return !ke(t[0]);
|
|
1364
|
+
case "IF": return ke(t[0]) ? t[1] ?? !0 : t[2] ?? !1;
|
|
1365
1365
|
case "IFERROR": return t[0] == null ? t[1] ?? 0 : t[0];
|
|
1366
1366
|
case "IFS":
|
|
1367
|
-
for (let e = 0; e + 1 < t.length; e += 2) if (
|
|
1367
|
+
for (let e = 0; e + 1 < t.length; e += 2) if (ke(t[e])) return t[e + 1];
|
|
1368
1368
|
return null;
|
|
1369
1369
|
case "TRUE": return !0;
|
|
1370
1370
|
case "FALSE": return !1;
|
|
1371
1371
|
case "ISBLANK": {
|
|
1372
|
-
let e =
|
|
1372
|
+
let e = Y(t[0]);
|
|
1373
1373
|
return e == null || e === "";
|
|
1374
1374
|
}
|
|
1375
|
-
case "ISNUMBER": return typeof
|
|
1376
|
-
case "ISTEXT": return typeof
|
|
1377
|
-
case "ISNONTEXT": return typeof
|
|
1375
|
+
case "ISNUMBER": return typeof Y(t[0]) == "number";
|
|
1376
|
+
case "ISTEXT": return typeof Y(t[0]) == "string";
|
|
1377
|
+
case "ISNONTEXT": return typeof Y(t[0]) != "string";
|
|
1378
1378
|
case "ISERROR":
|
|
1379
1379
|
case "ISERR":
|
|
1380
|
-
case "ISNA": return
|
|
1381
|
-
case "ISLOGICAL": return typeof
|
|
1380
|
+
case "ISNA": return Y(t[0]) == null;
|
|
1381
|
+
case "ISLOGICAL": return typeof Y(t[0]) == "boolean";
|
|
1382
1382
|
case "ROUNDDOWN": {
|
|
1383
|
-
let e =
|
|
1383
|
+
let e = X(t[0]), n = 10 ** X(t[1]);
|
|
1384
1384
|
return (e >= 0 ? Math.floor(e * n) : Math.ceil(e * n)) / n;
|
|
1385
1385
|
}
|
|
1386
1386
|
case "ROUNDUP": {
|
|
1387
|
-
let e =
|
|
1387
|
+
let e = X(t[0]), n = 10 ** X(t[1]);
|
|
1388
1388
|
return (e >= 0 ? Math.ceil(e * n) : Math.floor(e * n)) / n;
|
|
1389
1389
|
}
|
|
1390
1390
|
case "ROUND": {
|
|
1391
|
-
let e =
|
|
1391
|
+
let e = X(t[0]), n = 10 ** X(t[1]);
|
|
1392
1392
|
return Math.round(e * n) / n;
|
|
1393
1393
|
}
|
|
1394
|
-
case "INT": return Math.floor(
|
|
1394
|
+
case "INT": return Math.floor(X(t[0]));
|
|
1395
1395
|
case "TRUNC": {
|
|
1396
|
-
let e =
|
|
1396
|
+
let e = X(t[0]), n = 10 ** X(t[1] ?? 0);
|
|
1397
1397
|
return (e >= 0 ? Math.floor(e * n) : Math.ceil(e * n)) / n;
|
|
1398
1398
|
}
|
|
1399
1399
|
case "CEILING": {
|
|
1400
|
-
let e =
|
|
1400
|
+
let e = X(t[0]), n = X(t[1] ?? 1);
|
|
1401
1401
|
return n === 0 ? 0 : Math.ceil(e / n) * n;
|
|
1402
1402
|
}
|
|
1403
1403
|
case "FLOOR": {
|
|
1404
|
-
let e =
|
|
1404
|
+
let e = X(t[0]), n = X(t[1] ?? 1);
|
|
1405
1405
|
return n === 0 ? 0 : Math.floor(e / n) * n;
|
|
1406
1406
|
}
|
|
1407
1407
|
case "MOD": {
|
|
1408
|
-
let e =
|
|
1408
|
+
let e = X(t[0]), n = X(t[1]);
|
|
1409
1409
|
return n === 0 ? null : e - Math.floor(e / n) * n;
|
|
1410
1410
|
}
|
|
1411
|
-
case "POWER": return
|
|
1411
|
+
case "POWER": return X(t[0]) ** +X(t[1]);
|
|
1412
1412
|
case "SQRT": {
|
|
1413
|
-
let e =
|
|
1413
|
+
let e = X(t[0]);
|
|
1414
1414
|
return e < 0 ? null : Math.sqrt(e);
|
|
1415
1415
|
}
|
|
1416
|
-
case "ABS": return Math.abs(
|
|
1416
|
+
case "ABS": return Math.abs(X(t[0]));
|
|
1417
1417
|
case "SIGN": {
|
|
1418
|
-
let e =
|
|
1418
|
+
let e = X(t[0]);
|
|
1419
1419
|
return e > 0 ? 1 : e < 0 ? -1 : 0;
|
|
1420
1420
|
}
|
|
1421
|
-
case "EXP": return Math.exp(
|
|
1421
|
+
case "EXP": return Math.exp(X(t[0]));
|
|
1422
1422
|
case "LN": {
|
|
1423
|
-
let e =
|
|
1423
|
+
let e = X(t[0]);
|
|
1424
1424
|
return e <= 0 ? null : Math.log(e);
|
|
1425
1425
|
}
|
|
1426
1426
|
case "LOG10": {
|
|
1427
|
-
let e =
|
|
1427
|
+
let e = X(t[0]);
|
|
1428
1428
|
return e <= 0 ? null : Math.log10(e);
|
|
1429
1429
|
}
|
|
1430
1430
|
case "MIN": {
|
|
1431
|
-
let e = t.flatMap(
|
|
1431
|
+
let e = t.flatMap(J).filter((e) => typeof e == "number");
|
|
1432
1432
|
return e.length ? Math.min(...e) : 0;
|
|
1433
1433
|
}
|
|
1434
1434
|
case "MAX": {
|
|
1435
|
-
let e = t.flatMap(
|
|
1435
|
+
let e = t.flatMap(J).filter((e) => typeof e == "number");
|
|
1436
1436
|
return e.length ? Math.max(...e) : 0;
|
|
1437
1437
|
}
|
|
1438
|
-
case "SUM": return t.flatMap(
|
|
1438
|
+
case "SUM": return t.flatMap(J).reduce((e, t) => e + (typeof t == "number" ? t : 0), 0);
|
|
1439
1439
|
case "AVERAGE": {
|
|
1440
|
-
let e = t.flatMap(
|
|
1440
|
+
let e = t.flatMap(J).filter((e) => typeof e == "number");
|
|
1441
1441
|
return e.length ? e.reduce((e, t) => e + t, 0) / e.length : null;
|
|
1442
1442
|
}
|
|
1443
|
-
case "COUNT": return t.flatMap(
|
|
1444
|
-
case "COUNTA": return t.flatMap(
|
|
1445
|
-
case "COUNTBLANK": return t.flatMap(
|
|
1446
|
-
case "COUNTIF": return
|
|
1447
|
-
case "SUMIF": return
|
|
1443
|
+
case "COUNT": return t.flatMap(J).filter((e) => typeof e == "number").length;
|
|
1444
|
+
case "COUNTA": return t.flatMap(J).filter((e) => e != null && e !== "").length;
|
|
1445
|
+
case "COUNTBLANK": return t.flatMap(J).filter((e) => e == null || e === "").length;
|
|
1446
|
+
case "COUNTIF": return Xe(J(t[0]), t[1]);
|
|
1447
|
+
case "SUMIF": return Ze(J(t[0]), t[1], t[2] === void 0 ? null : J(t[2]));
|
|
1448
1448
|
case "AVERAGEIF": {
|
|
1449
|
-
let e =
|
|
1450
|
-
return r === 0 ? null :
|
|
1449
|
+
let e = J(t[0]), n = Ze(e, t[1], t[2] === void 0 ? null : J(t[2])), r = Xe(e, t[1]);
|
|
1450
|
+
return r === 0 ? null : X(n) / r;
|
|
1451
1451
|
}
|
|
1452
|
-
case "LEN": return
|
|
1453
|
-
case "LEFT": return
|
|
1452
|
+
case "LEN": return Z(t[0]).length;
|
|
1453
|
+
case "LEFT": return Z(t[0]).slice(0, Math.max(0, X(t[1] ?? 1)));
|
|
1454
1454
|
case "RIGHT": {
|
|
1455
|
-
let e =
|
|
1455
|
+
let e = Z(t[0]), n = Math.max(0, X(t[1] ?? 1));
|
|
1456
1456
|
return n >= e.length ? e : e.slice(e.length - n);
|
|
1457
1457
|
}
|
|
1458
1458
|
case "MID": {
|
|
1459
|
-
let e =
|
|
1459
|
+
let e = Z(t[0]), n = Math.max(1, X(t[1])) - 1, r = Math.max(0, X(t[2]));
|
|
1460
1460
|
return e.slice(n, n + r);
|
|
1461
1461
|
}
|
|
1462
|
-
case "UPPER": return
|
|
1463
|
-
case "LOWER": return
|
|
1464
|
-
case "TRIM": return
|
|
1465
|
-
case "EXACT": return
|
|
1462
|
+
case "UPPER": return Z(t[0]).toUpperCase();
|
|
1463
|
+
case "LOWER": return Z(t[0]).toLowerCase();
|
|
1464
|
+
case "TRIM": return Z(t[0]).replace(/\s+/g, " ").trim();
|
|
1465
|
+
case "EXACT": return Z(t[0]) === Z(t[1]);
|
|
1466
1466
|
case "FIND": {
|
|
1467
|
-
let e =
|
|
1467
|
+
let e = Z(t[0]), n = Z(t[1]), r = Math.max(1, X(t[2] ?? 1)) - 1, i = n.indexOf(e, r);
|
|
1468
1468
|
return i < 0 ? null : i + 1;
|
|
1469
1469
|
}
|
|
1470
1470
|
case "SEARCH": {
|
|
1471
|
-
let e =
|
|
1471
|
+
let e = Z(t[0]).toLowerCase(), n = Z(t[1]).toLowerCase(), r = Math.max(1, X(t[2] ?? 1)) - 1, i = n.indexOf(e, r);
|
|
1472
1472
|
return i < 0 ? null : i + 1;
|
|
1473
1473
|
}
|
|
1474
1474
|
case "CONCATENATE":
|
|
1475
|
-
case "CONCAT": return t.flatMap(
|
|
1475
|
+
case "CONCAT": return t.flatMap(J).map((e) => e == null ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : String(e)).join("");
|
|
1476
1476
|
case "T": {
|
|
1477
|
-
let e =
|
|
1477
|
+
let e = Y(t[0]);
|
|
1478
1478
|
return typeof e == "string" ? e : "";
|
|
1479
1479
|
}
|
|
1480
1480
|
case "N": {
|
|
1481
|
-
let e =
|
|
1481
|
+
let e = Y(t[0]);
|
|
1482
1482
|
return typeof e == "number" ? e : typeof e == "boolean" ? +!!e : 0;
|
|
1483
1483
|
}
|
|
1484
|
-
case "VALUE": return
|
|
1484
|
+
case "VALUE": return X(t[0]);
|
|
1485
1485
|
case "ROW": return n.row;
|
|
1486
1486
|
case "COLUMN": return n.col;
|
|
1487
|
-
case "TODAY": return
|
|
1488
|
-
case "NOW": return
|
|
1489
|
-
case "DATE": return
|
|
1490
|
-
case "YEAR": return
|
|
1491
|
-
case "MONTH": return
|
|
1492
|
-
case "DAY": return
|
|
1487
|
+
case "TODAY": return tt();
|
|
1488
|
+
case "NOW": return nt();
|
|
1489
|
+
case "DATE": return rt(X(t[0]), X(t[1]), X(t[2]));
|
|
1490
|
+
case "YEAR": return at(X(t[0])).y;
|
|
1491
|
+
case "MONTH": return at(X(t[0])).m;
|
|
1492
|
+
case "DAY": return at(X(t[0])).d;
|
|
1493
1493
|
case "WEEKDAY": {
|
|
1494
|
-
let e =
|
|
1494
|
+
let e = it(X(t[0])).getUTCDay(), n = X(t[1] ?? 1);
|
|
1495
1495
|
return n === 2 ? e === 0 ? 7 : e : n === 3 ? e === 0 ? 6 : e - 1 : e + 1;
|
|
1496
1496
|
}
|
|
1497
1497
|
default: return 0;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
function
|
|
1501
|
-
let n =
|
|
1500
|
+
function Xe(e, t) {
|
|
1501
|
+
let n = Qe(t), r = 0;
|
|
1502
1502
|
for (let t of e) n(t) && r++;
|
|
1503
1503
|
return r;
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1506
|
-
let r =
|
|
1505
|
+
function Ze(e, t, n) {
|
|
1506
|
+
let r = Qe(t), i = n ?? e, a = 0;
|
|
1507
1507
|
for (let t = 0; t < e.length; t++) if (r(e[t])) {
|
|
1508
1508
|
let e = i[t];
|
|
1509
1509
|
typeof e == "number" && (a += e);
|
|
1510
1510
|
}
|
|
1511
1511
|
return a;
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1514
|
-
let t =
|
|
1513
|
+
function Qe(e) {
|
|
1514
|
+
let t = Y(e);
|
|
1515
1515
|
if (typeof t != "string") {
|
|
1516
1516
|
let e = typeof t == "number" ? t : null;
|
|
1517
1517
|
return (n) => e !== null && typeof n == "number" ? n === e : n === t;
|
|
@@ -1537,62 +1537,62 @@ function $e(e) {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
};
|
|
1539
1539
|
}
|
|
1540
|
-
var
|
|
1541
|
-
function
|
|
1540
|
+
var $e = 25569, et = 864e5;
|
|
1541
|
+
function tt() {
|
|
1542
1542
|
let e = /* @__PURE__ */ new Date(), t = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1543
|
-
return Math.floor(t /
|
|
1543
|
+
return Math.floor(t / et) + $e;
|
|
1544
1544
|
}
|
|
1545
|
-
function
|
|
1546
|
-
return Date.now() /
|
|
1545
|
+
function nt() {
|
|
1546
|
+
return Date.now() / et + $e;
|
|
1547
1547
|
}
|
|
1548
|
-
function
|
|
1548
|
+
function rt(e, t, n) {
|
|
1549
1549
|
let r = Date.UTC(e, t - 1, n);
|
|
1550
|
-
return Math.floor(r /
|
|
1550
|
+
return Math.floor(r / et) + $e;
|
|
1551
1551
|
}
|
|
1552
|
-
function
|
|
1553
|
-
let t = (Math.floor(e) -
|
|
1552
|
+
function it(e) {
|
|
1553
|
+
let t = (Math.floor(e) - $e) * et;
|
|
1554
1554
|
return new Date(t);
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1557
|
-
let t =
|
|
1556
|
+
function at(e) {
|
|
1557
|
+
let t = it(e);
|
|
1558
1558
|
return {
|
|
1559
1559
|
y: t.getUTCFullYear(),
|
|
1560
1560
|
m: t.getUTCMonth() + 1,
|
|
1561
1561
|
d: t.getUTCDate()
|
|
1562
1562
|
};
|
|
1563
1563
|
}
|
|
1564
|
-
var
|
|
1564
|
+
var ot = [
|
|
1565
1565
|
"#FF0000",
|
|
1566
1566
|
"#FFFF00",
|
|
1567
1567
|
"#00B050"
|
|
1568
|
-
],
|
|
1568
|
+
], st = [
|
|
1569
1569
|
"#FF0000",
|
|
1570
1570
|
"#FF6600",
|
|
1571
1571
|
"#FFFF00",
|
|
1572
1572
|
"#00B050"
|
|
1573
|
-
],
|
|
1573
|
+
], ct = [
|
|
1574
1574
|
"#FF0000",
|
|
1575
1575
|
"#FF6600",
|
|
1576
1576
|
"#FFFF00",
|
|
1577
1577
|
"#92D050",
|
|
1578
1578
|
"#00B050"
|
|
1579
1579
|
];
|
|
1580
|
-
function
|
|
1580
|
+
function lt(e, t, n, r, i, a) {
|
|
1581
1581
|
if (t === "NoIcons") return;
|
|
1582
|
-
let o = t || "3TrafficLights1", s = parseInt(o[0]) || 3, c = s === 5 ?
|
|
1582
|
+
let o = t || "3TrafficLights1", s = parseInt(o[0]) || 3, c = s === 5 ? ct : s === 4 ? st : ot, l = c[Math.max(0, Math.min(n, c.length - 1))];
|
|
1583
1583
|
if (e.save(), e.fillStyle = l, o.includes("Arrow")) {
|
|
1584
1584
|
let t = a / 2;
|
|
1585
1585
|
e.beginPath(), n === s - 1 ? (e.moveTo(r + t, i), e.lineTo(r + a, i + a), e.lineTo(r, i + a)) : n === 0 ? (e.moveTo(r, i), e.lineTo(r + a, i), e.lineTo(r + t, i + a)) : (e.moveTo(r, i + a * .3), e.lineTo(r + a, i + t), e.lineTo(r, i + a * .7)), e.closePath(), e.fill();
|
|
1586
1586
|
} else o.includes("Flag") ? (e.beginPath(), e.moveTo(r, i), e.lineTo(r + a, i), e.lineTo(r, i + a), e.closePath(), e.fill()) : (e.beginPath(), e.arc(r + a / 2, i + a / 2, a / 2, 0, Math.PI * 2), e.fill());
|
|
1587
1587
|
e.restore();
|
|
1588
1588
|
}
|
|
1589
|
-
function
|
|
1589
|
+
function ut(e, t, n, r, i) {
|
|
1590
1590
|
let a = Math.max(6, Math.round(Math.min(r, i) * .45)), o = t + r - a - 1, s = n + i - a - 1;
|
|
1591
1591
|
e.save(), e.fillStyle = "#D0D0D0", e.fillRect(o, s, a, a), e.fillStyle = "#444444";
|
|
1592
1592
|
let c = a * .55, l = o + (a - c) / 2, u = s + (a - c * .5) / 2;
|
|
1593
1593
|
e.beginPath(), e.moveTo(l, u), e.lineTo(l + c, u), e.lineTo(l + c / 2, u + c * .5), e.closePath(), e.fill(), e.restore();
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function dt(e) {
|
|
1596
1596
|
let t = /* @__PURE__ */ new Map();
|
|
1597
1597
|
for (let n of e.tables ?? []) {
|
|
1598
1598
|
if (!n.styleName) continue;
|
|
@@ -1615,7 +1615,7 @@ function ft(e) {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
return t;
|
|
1617
1617
|
}
|
|
1618
|
-
function
|
|
1618
|
+
function ft(e) {
|
|
1619
1619
|
let t = /* @__PURE__ */ new Map();
|
|
1620
1620
|
for (let n of e.sparklineGroups ?? []) {
|
|
1621
1621
|
let e = Infinity, r = -Infinity;
|
|
@@ -1652,20 +1652,20 @@ function pt(e) {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
return t;
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function pt(e) {
|
|
1656
1656
|
let t = e.replace("#", "");
|
|
1657
1657
|
if (t.length < 6) return "#F2F2F2";
|
|
1658
1658
|
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = (e) => Math.round(e * .2 + 255 * .8), o = (e) => e.toString(16).padStart(2, "0").toUpperCase();
|
|
1659
1659
|
return `#${o(a(n))}${o(a(r))}${o(a(i))}`;
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1661
|
+
function mt(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
1662
1662
|
if (p <= 0 || m <= 0) return;
|
|
1663
|
-
let { styles: g, cellMap: _, mergeAnchorMap: v, mergeSkipSet: y, cfContext: w, cs: T, dpr: E } = t, D = a.length, k = o.length, ee = [],
|
|
1664
|
-
for (let e = 0; e < D; e++) ee.push(
|
|
1665
|
-
let
|
|
1666
|
-
for (let e = 0; e < k; e++)
|
|
1663
|
+
let { styles: g, cellMap: _, mergeAnchorMap: v, mergeSkipSet: y, cfContext: w, cs: T, dpr: E } = t, D = a.length, k = o.length, ee = [], j = -s;
|
|
1664
|
+
for (let e = 0; e < D; e++) ee.push(j), j += a[e];
|
|
1665
|
+
let F = [], L = -c;
|
|
1666
|
+
for (let e = 0; e < k; e++) F.push(L), L += o[e];
|
|
1667
1667
|
e.save(), e.beginPath(), e.rect(d, f, p, m), e.clip();
|
|
1668
|
-
let
|
|
1668
|
+
let R = [];
|
|
1669
1669
|
for (let i of t.worksheet.mergeCells ?? []) {
|
|
1670
1670
|
let a = i.top, o = i.left;
|
|
1671
1671
|
if (a >= n && a < n + k && o >= r && o < r + D || i.bottom < n || i.top >= n + k || i.right < r || i.left >= r + D) continue;
|
|
@@ -1679,46 +1679,46 @@ function ht(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
|
1679
1679
|
f = l - s - e;
|
|
1680
1680
|
}
|
|
1681
1681
|
let p;
|
|
1682
|
-
if (a >= n) p = u +
|
|
1682
|
+
if (a >= n) p = u + F[a - n];
|
|
1683
1683
|
else {
|
|
1684
1684
|
let e = 0;
|
|
1685
1685
|
for (let r = a; r < n; r++) e += Math.round(x(t.worksheet.rowHeights[r] ?? t.worksheet.defaultRowHeight) * T);
|
|
1686
1686
|
p = u - c - e;
|
|
1687
1687
|
}
|
|
1688
|
-
let m = d.totalW, _ = d.totalH, v = `${a}:${o}`, y = t.cellMap.get(v), { font: E, fill: A, border:
|
|
1689
|
-
if (O(e,
|
|
1690
|
-
let t = Math.max(0, (m - 4) *
|
|
1691
|
-
C(e,
|
|
1688
|
+
let m = d.totalW, _ = d.totalH, v = `${a}:${o}`, y = t.cellMap.get(v), { font: E, fill: A, border: j, xf: N } = te(g, y?.styleIndex ?? 0), P = Ee(y, a, o, w, g.dxfs ?? []);
|
|
1689
|
+
if (O(e, P.fill ?? A, f, p, m, _), P.dataBar && P.dataBar.ratio > 0) {
|
|
1690
|
+
let t = Math.max(0, (m - 4) * P.dataBar.ratio);
|
|
1691
|
+
C(e, P.dataBar.color, f + 2, p + 2, t, _ - 4, P.dataBar.gradient);
|
|
1692
1692
|
}
|
|
1693
|
-
if (Et(e, Tt(wt(
|
|
1694
|
-
let
|
|
1695
|
-
if (!
|
|
1696
|
-
let
|
|
1697
|
-
e.font =
|
|
1693
|
+
if (Et(e, Tt(wt(j, a, o, d.right, d.bottom, t.cellMap, g), P.border), f, p, m, _), !y) continue;
|
|
1694
|
+
let L = I(y, g, P.numFmt);
|
|
1695
|
+
if (!L || L === "0" && t.worksheet.showZeros === !1) continue;
|
|
1696
|
+
let R = E.bold || !!P.fontBold, z = E.italic || !!P.fontItalic, B = E.underline || !!P.fontUnderline, V = E.strike || !!P.fontStrike;
|
|
1697
|
+
e.font = M(R !== E.bold || z !== E.italic || B !== E.underline || V !== E.strike ? {
|
|
1698
1698
|
...E,
|
|
1699
|
-
bold:
|
|
1700
|
-
italic:
|
|
1701
|
-
underline:
|
|
1702
|
-
strike:
|
|
1699
|
+
bold: R,
|
|
1700
|
+
italic: z,
|
|
1701
|
+
underline: B,
|
|
1702
|
+
strike: V
|
|
1703
1703
|
} : E, T);
|
|
1704
|
-
let
|
|
1705
|
-
e.fillStyle =
|
|
1706
|
-
let
|
|
1704
|
+
let ne = t.hyperlinkMap.get(v) ? "#0563C1" : P.fontColor ?? E.color;
|
|
1705
|
+
e.fillStyle = ne ? S(ne) : "#000000";
|
|
1706
|
+
let re = y.value.type === "number", H = N.alignH ?? (re ? "right" : "left"), U = N.alignV ?? "bottom", ie = N.indent ? Math.round(N.indent * E.size * h * .5) : 0, W = 3 + (H === "left" || !N.alignH ? ie : 0);
|
|
1707
1707
|
e.save(), e.beginPath(), e.rect(f, p, m, _), e.clip();
|
|
1708
|
-
let
|
|
1709
|
-
|
|
1710
|
-
let
|
|
1711
|
-
|
|
1708
|
+
let G;
|
|
1709
|
+
H === "right" ? (G = f + m - 3, e.textAlign = "right") : H === "center" ? (G = f + m / 2, e.textAlign = "center") : (G = f + W, e.textAlign = "left");
|
|
1710
|
+
let ae;
|
|
1711
|
+
U === "top" ? (e.textBaseline = "top", ae = p + 2) : U === "center" ? (e.textBaseline = "middle", ae = p + _ / 2) : (e.textBaseline = "bottom", ae = p + _ - 2), e.fillText(L, G, ae), e.restore();
|
|
1712
1712
|
}
|
|
1713
1713
|
for (let s = 0; s < k; s++) {
|
|
1714
|
-
let c = n + s, b = u +
|
|
1714
|
+
let c = n + s, b = u + F[s], x = o[s];
|
|
1715
1715
|
if (b + x <= f || b >= f + m) continue;
|
|
1716
|
-
let k = /* @__PURE__ */ new Set(),
|
|
1717
|
-
if (
|
|
1718
|
-
for (let t =
|
|
1719
|
-
for (let t =
|
|
1716
|
+
let k = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), L = -1, z = (e) => {
|
|
1717
|
+
if (L >= 0 && e - L >= 2) {
|
|
1718
|
+
for (let t = L; t < e - 1; t++) k.add(t);
|
|
1719
|
+
for (let t = L + 1; t < e; t++) j.add(t);
|
|
1720
1720
|
}
|
|
1721
|
-
|
|
1721
|
+
L = -1;
|
|
1722
1722
|
};
|
|
1723
1723
|
for (let e = 0; e <= D; e++) {
|
|
1724
1724
|
let t = !1, n = !1;
|
|
@@ -1726,58 +1726,58 @@ function ht(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
|
1726
1726
|
let i = `${c}:${r + e}`;
|
|
1727
1727
|
if (!y.has(i) && !v.has(i)) {
|
|
1728
1728
|
let e = _.get(i);
|
|
1729
|
-
t =
|
|
1729
|
+
t = te(g, e?.styleIndex ?? 0).xf.alignH === "centerContinuous", n = !!(e && e.value && e.value.type !== "empty");
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
|
-
t ? n &&
|
|
1732
|
+
t ? n && L >= 0 && e > L ? (z(e), L = e) : L < 0 && (L = e) : z(e);
|
|
1733
1733
|
}
|
|
1734
1734
|
for (let n = 0; n < D; n++) {
|
|
1735
1735
|
let o = r + n, u = l + ee[n], f = a[n];
|
|
1736
1736
|
if (u + f <= d || u >= d + p) continue;
|
|
1737
1737
|
let m = `${c}:${o}`;
|
|
1738
1738
|
if (y.has(m)) continue;
|
|
1739
|
-
let
|
|
1740
|
-
if (O(e,
|
|
1741
|
-
let t = Math.max(0, (
|
|
1742
|
-
C(e,
|
|
1739
|
+
let F = v.get(m), L = F ? F.totalW : f, z = F ? F.totalH : x, B = _.get(m), { font: V, fill: ne, border: re, xf: H } = te(g, B?.styleIndex ?? 0), U = Ee(B, c, o, w, g.dxfs ?? []), ie = U.fill ?? ne, W = t.tableStyleMap.get(m), G = W?.wholeTableDxf == null ? void 0 : (g.dxfs ?? [])[W.wholeTableDxf], ae = W?.headerRowDxf == null ? void 0 : (g.dxfs ?? [])[W.headerRowDxf];
|
|
1740
|
+
if (O(e, ie, u, b, L, z) || (W && W.isHeader && ae?.fill?.fgColor ? (e.fillStyle = S(ae.fill.fgColor), e.fillRect(u, b, L, z)) : W && !W.isHeader && !W.isTotals && G?.fill?.fgColor ? (e.fillStyle = S(G.fill.fgColor), e.fillRect(u, b, L, z)) : W && W.isBanded && (e.fillStyle = pt(W.accent), e.fillRect(u, b, L, z))), t.commentCells.has(m) && A(e, u, b, L, z), U.dataBar && U.dataBar.ratio > 0) {
|
|
1741
|
+
let t = Math.max(0, (L - 4) * U.dataBar.ratio);
|
|
1742
|
+
C(e, U.dataBar.color, u + 2, b + 2, t, z - 4, U.dataBar.gradient);
|
|
1743
1743
|
}
|
|
1744
|
-
let
|
|
1745
|
-
if (
|
|
1744
|
+
let oe = t.sparklineMap.get(m);
|
|
1745
|
+
if (oe && i(e, {
|
|
1746
1746
|
x: u,
|
|
1747
1747
|
y: b,
|
|
1748
|
-
w:
|
|
1749
|
-
h:
|
|
1750
|
-
},
|
|
1748
|
+
w: L,
|
|
1749
|
+
h: z
|
|
1750
|
+
}, oe), t.worksheet.showGridlines !== !1) {
|
|
1751
1751
|
let t = .5 / E;
|
|
1752
|
-
e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), k.has(n) || (e.moveTo(u +
|
|
1752
|
+
e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), k.has(n) || (e.moveTo(u + L + t, b), e.lineTo(u + L + t, b + z)), e.moveTo(u, b + z + t), e.lineTo(u + L, b + z + t), s === 0 && (e.moveTo(u, b + t), e.lineTo(u + L, b + t)), n === 0 && (e.moveTo(u + t, b), e.lineTo(u + t, b + z)), e.stroke();
|
|
1753
1753
|
}
|
|
1754
|
-
let
|
|
1755
|
-
(k.has(n) ||
|
|
1756
|
-
...
|
|
1757
|
-
left:
|
|
1758
|
-
right: k.has(n) ? null :
|
|
1754
|
+
let K = Tt(F ? wt(re, c, o, F.right, F.bottom, _, g) : re, U.border);
|
|
1755
|
+
(k.has(n) || j.has(n)) && (K = {
|
|
1756
|
+
...K,
|
|
1757
|
+
left: j.has(n) ? null : K.left,
|
|
1758
|
+
right: k.has(n) ? null : K.right
|
|
1759
1759
|
});
|
|
1760
|
-
let
|
|
1761
|
-
if (
|
|
1762
|
-
let e =
|
|
1763
|
-
|
|
1764
|
-
...
|
|
1760
|
+
let se = _.get(`${c - 1}:${o}`), ce = se ? te(g, se.styleIndex).border.bottom : null, le = !1;
|
|
1761
|
+
if (ce?.style) {
|
|
1762
|
+
let e = K.top, t = At(e, ce);
|
|
1763
|
+
K = {
|
|
1764
|
+
...K,
|
|
1765
1765
|
top: t
|
|
1766
|
-
},
|
|
1766
|
+
}, le = t === ce && e !== ce;
|
|
1767
1767
|
}
|
|
1768
|
-
let
|
|
1769
|
-
if (!
|
|
1770
|
-
let e = _.get(`${c}:${o - 1}`), t = e ?
|
|
1768
|
+
let de = !1;
|
|
1769
|
+
if (!j.has(n)) {
|
|
1770
|
+
let e = _.get(`${c}:${o - 1}`), t = e ? te(g, e.styleIndex).border.right : null;
|
|
1771
1771
|
if (t?.style) {
|
|
1772
|
-
let e =
|
|
1773
|
-
|
|
1774
|
-
...
|
|
1772
|
+
let e = K.left, n = At(e, t);
|
|
1773
|
+
K = {
|
|
1774
|
+
...K,
|
|
1775
1775
|
left: n
|
|
1776
|
-
},
|
|
1776
|
+
}, de = n === t && e !== t;
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
|
-
if (Et(e,
|
|
1780
|
-
let t =
|
|
1779
|
+
if (Et(e, K, u, b, L, z, le, de), W) {
|
|
1780
|
+
let t = G?.border?.horizontal, n = G?.border?.vertical, r = G?.border?.top, i = G?.border?.bottom, a = G?.border?.left, s = G?.border?.right, c = ae?.border?.bottom, l = ae?.border?.top;
|
|
1781
1781
|
if (t || n || r || i || a || s || c || l) {
|
|
1782
1782
|
let n = {
|
|
1783
1783
|
left: null,
|
|
@@ -1785,46 +1785,46 @@ function ht(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
|
1785
1785
|
top: null,
|
|
1786
1786
|
bottom: null
|
|
1787
1787
|
};
|
|
1788
|
-
|
|
1788
|
+
W.isTopEdge ? n.top = r ?? null : t && (n.top = t), W.isHeader && c ? n.bottom = c : W.isBottomEdge ? n.bottom = i ?? null : t && (n.bottom = t), (W.isFirstCol || o === 0) && (n.left = a ?? null), W.isLastCol && (n.right = s ?? null), Et(e, n, u, b, L, z);
|
|
1789
1789
|
} else {
|
|
1790
1790
|
let t = .5 / E;
|
|
1791
|
-
e.strokeStyle =
|
|
1791
|
+
e.strokeStyle = W.accent, e.lineWidth = W.isHeader ? 1.5 : 1, e.beginPath(), e.moveTo(u, b + z - t), e.lineTo(u + L, b + z - t), W.isTopEdge && (e.moveTo(u, b + t), e.lineTo(u + L, b + t)), e.stroke();
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
|
-
if (t.autoFilterCells.has(m) &&
|
|
1795
|
-
let
|
|
1796
|
-
!
|
|
1797
|
-
let i = !!(
|
|
1798
|
-
...
|
|
1794
|
+
if (t.autoFilterCells.has(m) && ut(e, u, b, f, z), !B) continue;
|
|
1795
|
+
let q = I(B, g, U.numFmt);
|
|
1796
|
+
!q || q === "0" && t.worksheet.showZeros === !1 || R.push(() => {
|
|
1797
|
+
let i = !!(W && (W.isHeader || W.isTotals)), s = V.bold || !!U.fontBold || i, l = V.italic || !!U.fontItalic, d = V.underline || !!U.fontUnderline, f = V.strike || !!U.fontStrike, p = s !== V.bold || l !== V.italic || d !== V.underline || f !== V.strike ? {
|
|
1798
|
+
...V,
|
|
1799
1799
|
bold: s,
|
|
1800
1800
|
italic: l,
|
|
1801
1801
|
underline: d,
|
|
1802
1802
|
strike: f
|
|
1803
|
-
} :
|
|
1804
|
-
e.font =
|
|
1805
|
-
let x = t.hyperlinkMap.get(m), C =
|
|
1803
|
+
} : V;
|
|
1804
|
+
e.font = M(p, T);
|
|
1805
|
+
let x = t.hyperlinkMap.get(m), C = W?.isHeader && ae?.font?.color ? ae.font.color : W && !W.isHeader && !W.isTotals && G?.font?.color ? G.font.color : null, w = x ? "#0563C1" : U.fontColor ?? C ?? V.color;
|
|
1806
1806
|
e.fillStyle = w ? S(w) : "#000000";
|
|
1807
|
-
let E =
|
|
1808
|
-
if (O === "centerContinuous" && !
|
|
1807
|
+
let E = B.value.type === "number", O = H.alignH ?? (E ? "right" : "left"), k = H.alignV ?? "bottom", ee = H.indent ? Math.round(H.indent * V.size * h * .5) : 0, A = U.iconSet ? Math.max(8, Math.round(Math.min(L, z) * .55)) : 0, j = A > 0 ? A + 4 : 0, I = 3 + (O === "left" || !H.alignH ? ee : 0) + j, R = L, ne = u, re = n;
|
|
1808
|
+
if (O === "centerContinuous" && !F) for (let e = n + 1; e < D; e++) {
|
|
1809
1809
|
let t = `${c}:${r + e}`;
|
|
1810
1810
|
if (y.has(t) || v.has(t)) break;
|
|
1811
1811
|
let n = _.get(t);
|
|
1812
|
-
if (n && n.value.type !== "empty" ||
|
|
1813
|
-
|
|
1812
|
+
if (n && n.value.type !== "empty" || te(g, n?.styleIndex ?? 0).xf.alignH !== "centerContinuous") break;
|
|
1813
|
+
R += a[e], re = e;
|
|
1814
1814
|
}
|
|
1815
|
-
let
|
|
1816
|
-
if (!
|
|
1817
|
-
let t = e.measureText(
|
|
1815
|
+
let ie = O === "centerContinuous" ? ne : u, oe = O === "centerContinuous" ? R : L, K = q.includes("\n");
|
|
1816
|
+
if (!F && !H.wrapText && !H.textRotation && !E && !K) {
|
|
1817
|
+
let t = e.measureText(q).width, i = O === "centerContinuous", o = i ? t + 6 : t + I + 3, s = i ? R : L;
|
|
1818
1818
|
if (o > s) {
|
|
1819
1819
|
let e = o - s, t = 0, l = 0;
|
|
1820
1820
|
if (O === "right" ? l = e : O === "center" || i ? (l = e / 2, t = e / 2) : t = e, t > 0) {
|
|
1821
|
-
let e = t, o = i ?
|
|
1821
|
+
let e = t, o = i ? re + 1 : n + 1;
|
|
1822
1822
|
for (let t = o; t < D && e > 0; t++) {
|
|
1823
1823
|
let n = `${c}:${r + t}`;
|
|
1824
1824
|
if (y.has(n) || v.has(n)) break;
|
|
1825
1825
|
let i = _.get(n);
|
|
1826
1826
|
if (i && i.value.type !== "empty") break;
|
|
1827
|
-
|
|
1827
|
+
oe += a[t], e -= a[t];
|
|
1828
1828
|
}
|
|
1829
1829
|
}
|
|
1830
1830
|
if (l > 0) {
|
|
@@ -1834,69 +1834,69 @@ function ht(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
|
1834
1834
|
if (y.has(n) || v.has(n)) break;
|
|
1835
1835
|
let i = _.get(n);
|
|
1836
1836
|
if (i && i.value.type !== "empty") break;
|
|
1837
|
-
|
|
1837
|
+
ie -= a[t], oe += a[t], e -= a[t];
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
|
-
let
|
|
1843
|
-
if (O === "fill" && !E &&
|
|
1844
|
-
let t = Math.max(1,
|
|
1842
|
+
let se = q, ce = 0;
|
|
1843
|
+
if (O === "fill" && !E && q.length > 0) {
|
|
1844
|
+
let t = Math.max(1, L - 6), n = e.measureText(q).width;
|
|
1845
1845
|
if (n > 0 && n < t) {
|
|
1846
1846
|
let e = Math.max(1, Math.floor(t / n));
|
|
1847
|
-
|
|
1847
|
+
se = q.repeat(e);
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
|
-
if (O === "distributed" || O === "justify" && !
|
|
1851
|
-
let t = Math.max(1,
|
|
1852
|
-
n < t && (
|
|
1850
|
+
if (O === "distributed" || O === "justify" && !H.wrapText && !K) {
|
|
1851
|
+
let t = Math.max(1, L - 6), n = e.measureText(se).width, r = Math.max(1, [...se].length - 1);
|
|
1852
|
+
n < t && (ce = Math.max(0, (t - n) / r));
|
|
1853
1853
|
}
|
|
1854
|
-
let
|
|
1855
|
-
O === "right" ? (
|
|
1856
|
-
let
|
|
1857
|
-
if (
|
|
1858
|
-
let t = Math.round(
|
|
1854
|
+
let le, de;
|
|
1855
|
+
O === "right" ? (le = u + L - 3, de = "right") : O === "center" ? (le = u + L / 2, de = "center") : O === "centerContinuous" ? (le = ne + R / 2, de = "center") : O === "distributed" || O === "justify" && !H.wrapText && !K ? (le = u + 3, de = "left") : (le = u + I, de = "left");
|
|
1856
|
+
let pe = H.textRotation ?? 0, me = pe === 255, he = pe > 0 && pe !== 255;
|
|
1857
|
+
if (U.iconSet && A > 0 && (e.save(), e.beginPath(), e.rect(u, b, L, z), e.clip(), lt(e, U.iconSet.name, U.iconSet.index, u + 2, b + (z - A) / 2, A), e.restore()), e.save(), e.beginPath(), e.rect(ie, b, oe, z), e.clip(), me) {
|
|
1858
|
+
let t = Math.round(V.size * h * 1.1), n = q.length * t, r = k === "top" ? b + 2 : k === "center" ? b + (z - n) / 2 : b + z - n - 2;
|
|
1859
1859
|
e.textAlign = "center", e.textBaseline = "top";
|
|
1860
|
-
for (let n of
|
|
1860
|
+
for (let n of q) e.fillText(n, u + L / 2, r), r += t;
|
|
1861
1861
|
e.restore();
|
|
1862
1862
|
return;
|
|
1863
1863
|
}
|
|
1864
|
-
if (
|
|
1865
|
-
let t =
|
|
1866
|
-
e.translate(u +
|
|
1864
|
+
if (he) {
|
|
1865
|
+
let t = pe <= 90 ? -(pe * Math.PI / 180) : (pe - 90) * Math.PI / 180;
|
|
1866
|
+
e.translate(u + L / 2, b + z / 2), e.rotate(t), e.textAlign = "center", e.textBaseline = "middle", e.fillText(q, 0, 0), e.restore();
|
|
1867
1867
|
return;
|
|
1868
1868
|
}
|
|
1869
|
-
if (
|
|
1870
|
-
let t = e.measureText(
|
|
1869
|
+
if (H.shrinkToFit) {
|
|
1870
|
+
let t = e.measureText(q).width, n = L - I - 3;
|
|
1871
1871
|
if (t > n && t > 0) {
|
|
1872
|
-
let r = n / t, i = O === "right" ? u +
|
|
1872
|
+
let r = n / t, i = O === "right" ? u + L - 3 : O === "center" ? u + L / 2 : u + I;
|
|
1873
1873
|
e.transform(r, 0, 0, 1, i * (1 - r), 0);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
if (e.textAlign =
|
|
1877
|
-
e.letterSpacing = `${
|
|
1876
|
+
if (e.textAlign = de, ce > 0) try {
|
|
1877
|
+
e.letterSpacing = `${ce}px`;
|
|
1878
1878
|
} catch {}
|
|
1879
|
-
if (
|
|
1879
|
+
if (H.readingOrder === 2) try {
|
|
1880
1880
|
e.direction = "rtl";
|
|
1881
1881
|
} catch {}
|
|
1882
|
-
else if (
|
|
1882
|
+
else if (H.readingOrder === 1) try {
|
|
1883
1883
|
e.direction = "ltr";
|
|
1884
1884
|
} catch {}
|
|
1885
|
-
let
|
|
1886
|
-
if (
|
|
1887
|
-
let t =
|
|
1888
|
-
r = k === "top" ? b + 2 : k === "center" ? b + (
|
|
1885
|
+
let ge = B.value.type === "text" ? B.value.runs : void 0, _e = ge && ge.length > 0;
|
|
1886
|
+
if (H.wrapText && _e) {
|
|
1887
|
+
let t = fe(e, ge, p, T, L - I - 3), n = t.reduce((e, t) => e + Math.round(t.maxFontSize * h * 1.2), 0), r;
|
|
1888
|
+
r = k === "top" ? b + 2 : k === "center" ? b + (z - n) / 2 : b + z - n - 2, e.textAlign = "left", e.textBaseline = "top";
|
|
1889
1889
|
for (let n of t) {
|
|
1890
1890
|
let t = Math.round(n.maxFontSize * h * 1.2), i = n.segments.reduce((e, t) => e + t.width, 0), a;
|
|
1891
|
-
a = O === "right" ? u +
|
|
1891
|
+
a = O === "right" ? u + L - 3 - i : O === "center" ? u + L / 2 - i / 2 : u + I;
|
|
1892
1892
|
for (let t of n.segments) {
|
|
1893
|
-
e.font =
|
|
1894
|
-
let n =
|
|
1893
|
+
e.font = M(t.font, T);
|
|
1894
|
+
let n = U.fontColor ?? t.font.color;
|
|
1895
1895
|
e.fillStyle = n ? S(n) : "#000000", e.fillText(t.text, a, r);
|
|
1896
1896
|
let i = Math.round(t.font.size * h);
|
|
1897
1897
|
if (t.font.underline) {
|
|
1898
1898
|
let o = n ? S(n) : "#000000", s = t.font.underlineStyle === "double" || t.font.underlineStyle === "doubleAccounting";
|
|
1899
|
-
|
|
1899
|
+
N(e, a, a + t.width, r + i + 1, o, s);
|
|
1900
1900
|
}
|
|
1901
1901
|
if (t.font.strike) {
|
|
1902
1902
|
e.save(), e.strokeStyle = n ? S(n) : "#000000", e.lineWidth = .5;
|
|
@@ -1907,85 +1907,85 @@ function ht(e, t, n, r, a, o, s, c, l, u, d, f, p, m) {
|
|
|
1907
1907
|
}
|
|
1908
1908
|
r += t;
|
|
1909
1909
|
}
|
|
1910
|
-
} else if (
|
|
1911
|
-
let t =
|
|
1912
|
-
k === "top" ? (i = b + 2, e.textBaseline = "top") : k === "center" ? (i = b + (
|
|
1913
|
-
for (let r = 0; r < t.length; r++) e.fillText(t[r],
|
|
1914
|
-
} else if (
|
|
1915
|
-
let t =
|
|
1910
|
+
} else if (H.wrapText) {
|
|
1911
|
+
let t = ue(e, q, L - I - 3), n = Math.round(V.size * h * 1.2), r = t.length * n, i;
|
|
1912
|
+
k === "top" ? (i = b + 2, e.textBaseline = "top") : k === "center" ? (i = b + (z - r) / 2, e.textBaseline = "top") : (i = b + z - r - 2, e.textBaseline = "top");
|
|
1913
|
+
for (let r = 0; r < t.length; r++) e.fillText(t[r], le, i + r * n);
|
|
1914
|
+
} else if (_e) {
|
|
1915
|
+
let t = ge.map((e) => P(p, e)), n = ge.map((e) => e.font?.vertAlign), r = t.map((e, t) => n[t] === "superscript" || n[t] === "subscript" ? {
|
|
1916
1916
|
...e,
|
|
1917
1917
|
size: e.size * .65
|
|
1918
|
-
} : e), i =
|
|
1919
|
-
o = O === "right" ? u +
|
|
1918
|
+
} : e), i = ge.map((t, n) => (e.font = M(r[n], T), e.measureText(t.text).width)), a = i.reduce((e, t) => e + t, 0), o;
|
|
1919
|
+
o = O === "right" ? u + L - 3 - a : O === "center" ? u + L / 2 - a / 2 : u + I, e.textAlign = "left";
|
|
1920
1920
|
let s;
|
|
1921
|
-
k === "top" ? (e.textBaseline = "top", s = b + 2) : k === "center" ? (e.textBaseline = "middle", s = b +
|
|
1921
|
+
k === "top" ? (e.textBaseline = "top", s = b + 2) : k === "center" ? (e.textBaseline = "middle", s = b + z / 2) : (e.textBaseline = "bottom", s = b + z - 2);
|
|
1922
1922
|
let c = o;
|
|
1923
|
-
for (let a = 0; a <
|
|
1923
|
+
for (let a = 0; a < ge.length; a++) {
|
|
1924
1924
|
let o = r[a], l = t[a];
|
|
1925
|
-
e.font =
|
|
1926
|
-
let u =
|
|
1925
|
+
e.font = M(o, T);
|
|
1926
|
+
let u = U.fontColor ?? o.color;
|
|
1927
1927
|
e.fillStyle = u ? S(u) : "#000000";
|
|
1928
1928
|
let d = Math.round(l.size * h), f = 0;
|
|
1929
|
-
n[a] === "superscript" ? f = -Math.round(d * .35) : n[a] === "subscript" && (f = Math.round(d * .1)), e.fillText(
|
|
1929
|
+
n[a] === "superscript" ? f = -Math.round(d * .35) : n[a] === "subscript" && (f = Math.round(d * .1)), e.fillText(ge[a].text, c, s + f);
|
|
1930
1930
|
let p = Math.round(o.size * h);
|
|
1931
1931
|
if (o.underline) {
|
|
1932
|
-
let t = (k === "top" ? b + 2 + p + 1 : k === "center" ? b +
|
|
1933
|
-
|
|
1932
|
+
let t = (k === "top" ? b + 2 + p + 1 : k === "center" ? b + z / 2 + Math.round(p * .55) : b + z - 2 + 1) + f, n = u ? S(u) : "#000000";
|
|
1933
|
+
N(e, c, c + i[a], t, n, o.underlineStyle === "double" || o.underlineStyle === "doubleAccounting");
|
|
1934
1934
|
}
|
|
1935
1935
|
if (o.strike) {
|
|
1936
|
-
let t = (k === "top" ? b + 2 + Math.round(p * .5) : k === "center" ? b +
|
|
1936
|
+
let t = (k === "top" ? b + 2 + Math.round(p * .5) : k === "center" ? b + z / 2 : b + z - 2 - Math.round(p * .35)) + f;
|
|
1937
1937
|
e.save(), e.strokeStyle = u ? S(u) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(c, t), e.lineTo(c + i[a], t), e.stroke(), e.restore();
|
|
1938
1938
|
}
|
|
1939
1939
|
c += i[a];
|
|
1940
1940
|
}
|
|
1941
1941
|
} else {
|
|
1942
|
-
let t = p.vertAlign, n = Math.round(
|
|
1942
|
+
let t = p.vertAlign, n = Math.round(V.size * h), r = 0;
|
|
1943
1943
|
t === "superscript" ? r = -Math.round(n * .35) : t === "subscript" && (r = Math.round(n * .1));
|
|
1944
1944
|
let i = t ? {
|
|
1945
1945
|
...p,
|
|
1946
1946
|
size: p.size * .65
|
|
1947
1947
|
} : p;
|
|
1948
|
-
t && (e.font =
|
|
1949
|
-
let a = null, o = () => a ??= e.measureText(
|
|
1950
|
-
let e = Math.min(o().width,
|
|
1948
|
+
t && (e.font = M(i, T));
|
|
1949
|
+
let a = null, o = () => a ??= e.measureText(q), s = () => {
|
|
1950
|
+
let e = Math.min(o().width, oe - I - 3);
|
|
1951
1951
|
return {
|
|
1952
|
-
x: O === "right" ? u +
|
|
1952
|
+
x: O === "right" ? u + L - 3 - e : O === "center" ? u + L / 2 - e / 2 : u + I,
|
|
1953
1953
|
width: e
|
|
1954
1954
|
};
|
|
1955
1955
|
}, c = Math.round(i.size * h);
|
|
1956
1956
|
if (p.underline || x) {
|
|
1957
|
-
let { x: t, width: n } = s(), i = (k === "top" ? b + 2 + c + 1 : k === "center" ? b +
|
|
1958
|
-
|
|
1957
|
+
let { x: t, width: n } = s(), i = (k === "top" ? b + 2 + c + 1 : k === "center" ? b + z / 2 + Math.round(c * .55) : b + z - 2 + 1) + r, a = x ? "#0563C1" : w ? S(w) : "#000000", o = p.underlineStyle === "double" || p.underlineStyle === "doubleAccounting";
|
|
1958
|
+
N(e, t, t + n, i, a, o);
|
|
1959
1959
|
}
|
|
1960
1960
|
if (p.strike) {
|
|
1961
|
-
let { x: t, width: n } = s(), i = (k === "top" ? b + 2 + Math.round(c * .5) : k === "center" ? b +
|
|
1961
|
+
let { x: t, width: n } = s(), i = (k === "top" ? b + 2 + Math.round(c * .5) : k === "center" ? b + z / 2 : b + z - 2 - Math.round(c * .35)) + r;
|
|
1962
1962
|
e.save(), e.strokeStyle = w ? S(w) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(t, i), e.lineTo(t + n, i), e.stroke(), e.restore();
|
|
1963
1963
|
}
|
|
1964
|
-
if (
|
|
1965
|
-
let t =
|
|
1966
|
-
k === "top" ? (a = b + 2, e.textBaseline = "top") : k === "center" ? (a = b + (
|
|
1967
|
-
for (let i = 0; i < t.length; i++) e.fillText(t[i],
|
|
1964
|
+
if (q.includes("\n")) {
|
|
1965
|
+
let t = q.split("\n"), n = Math.round(V.size * h * 1.2), i = t.length * n, a;
|
|
1966
|
+
k === "top" ? (a = b + 2, e.textBaseline = "top") : k === "center" ? (a = b + (z - i) / 2, e.textBaseline = "top") : (a = b + z - i - 2, e.textBaseline = "top");
|
|
1967
|
+
for (let i = 0; i < t.length; i++) e.fillText(t[i], le, a + i * n + r);
|
|
1968
1968
|
} else {
|
|
1969
1969
|
let t;
|
|
1970
|
-
k === "top" ? (e.textBaseline = "top", t = b + 2) : k === "center" ? (e.textBaseline = "middle", t = b +
|
|
1970
|
+
k === "top" ? (e.textBaseline = "top", t = b + 2) : k === "center" ? (e.textBaseline = "middle", t = b + z / 2) : (e.textBaseline = "bottom", t = b + z - 2), e.fillText(se, le, t + r);
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
e.restore(),
|
|
1974
|
-
text:
|
|
1973
|
+
e.restore(), q && t.onTextRun && t.onTextRun({
|
|
1974
|
+
text: q,
|
|
1975
1975
|
x: u,
|
|
1976
1976
|
y: b,
|
|
1977
|
-
width:
|
|
1978
|
-
height:
|
|
1977
|
+
width: L,
|
|
1978
|
+
height: z,
|
|
1979
1979
|
row: c,
|
|
1980
1980
|
col: o
|
|
1981
1981
|
});
|
|
1982
1982
|
});
|
|
1983
1983
|
}
|
|
1984
1984
|
}
|
|
1985
|
-
for (let e of
|
|
1985
|
+
for (let e of R) e();
|
|
1986
1986
|
e.restore();
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function ht(e, t, n, r, i = {}) {
|
|
1989
1989
|
let a = i.dpr ?? 1, o = i.cellScale ?? 1, s = y(t), c = e.canvas.width / a, l = e.canvas.height / a;
|
|
1990
1990
|
e.clearRect(0, 0, c, l), e.fillStyle = "#ffffff", e.fillRect(0, 0, c, l);
|
|
1991
1991
|
let u = (e) => Math.round(e * o), d = u(50), f = u(22), { row: p, col: m, rows: h, cols: _ } = r, v = (i.scrollOffsetX ?? 0) * o, S = (i.scrollOffsetY ?? 0) * o, C = i.freezeRows ?? 0, w = i.freezeCols ?? 0, T = [];
|
|
@@ -1996,41 +1996,41 @@ function gt(e, t, n, r, i = {}) {
|
|
|
1996
1996
|
for (let e = m; e < m + _; e++) k.push(u(b(t.colWidths[e] ?? t.defaultColWidth, s)));
|
|
1997
1997
|
let A = [];
|
|
1998
1998
|
for (let e = p; e < p + h; e++) A.push(u(x(t.rowHeights[e] ?? t.defaultRowHeight)));
|
|
1999
|
-
let
|
|
2000
|
-
for (let e of t.rows) for (let t of e.cells)
|
|
2001
|
-
let
|
|
1999
|
+
let j = /* @__PURE__ */ new Map();
|
|
2000
|
+
for (let e of t.rows) for (let t of e.cells) j.set(`${t.row}:${t.col}`, t);
|
|
2001
|
+
let M = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Set();
|
|
2002
2002
|
for (let e of t.mergeCells ?? []) {
|
|
2003
2003
|
let n = 0;
|
|
2004
2004
|
for (let r = e.left; r <= e.right; r++) n += u(b(t.colWidths[r] ?? t.defaultColWidth, s));
|
|
2005
2005
|
let r = 0;
|
|
2006
2006
|
for (let n = e.top; n <= e.bottom; n++) r += u(x(t.rowHeights[n] ?? t.defaultRowHeight));
|
|
2007
|
-
|
|
2007
|
+
M.set(`${e.top}:${e.left}`, {
|
|
2008
2008
|
totalW: n,
|
|
2009
2009
|
totalH: r,
|
|
2010
2010
|
right: e.right,
|
|
2011
2011
|
bottom: e.bottom
|
|
2012
2012
|
});
|
|
2013
|
-
for (let t = e.top; t <= e.bottom; t++) for (let n = e.left; n <= e.right; n++) t === e.top && n === e.left ||
|
|
2013
|
+
for (let t = e.top; t <= e.bottom; t++) for (let n = e.left; n <= e.right; n++) t === e.top && n === e.left || N.add(`${t}:${n}`);
|
|
2014
2014
|
}
|
|
2015
|
-
let
|
|
2015
|
+
let P = ye(t), te = /* @__PURE__ */ new Set();
|
|
2016
2016
|
if (t.autoFilter) {
|
|
2017
2017
|
let e = t.autoFilter;
|
|
2018
|
-
for (let t = e.left; t <= e.right; t++)
|
|
2018
|
+
for (let t = e.left; t <= e.right; t++) te.add(`${e.top}:${t}`);
|
|
2019
2019
|
}
|
|
2020
|
-
let
|
|
2021
|
-
for (let e of t.hyperlinks ?? []) e.url &&
|
|
2022
|
-
let
|
|
2020
|
+
let F = /* @__PURE__ */ new Map();
|
|
2021
|
+
for (let e of t.hyperlinks ?? []) e.url && F.set(`${e.row}:${e.col}`, e.url);
|
|
2022
|
+
let I = /* @__PURE__ */ new Set();
|
|
2023
2023
|
for (let e of t.commentRefs ?? []) {
|
|
2024
2024
|
let t = ee(e);
|
|
2025
|
-
t &&
|
|
2025
|
+
t && I.add(`${t.row}:${t.col}`);
|
|
2026
2026
|
}
|
|
2027
|
-
let
|
|
2027
|
+
let L = {
|
|
2028
2028
|
worksheet: t,
|
|
2029
2029
|
styles: n,
|
|
2030
|
-
cellMap:
|
|
2031
|
-
mergeAnchorMap:
|
|
2032
|
-
mergeSkipSet:
|
|
2033
|
-
cfContext:
|
|
2030
|
+
cellMap: j,
|
|
2031
|
+
mergeAnchorMap: M,
|
|
2032
|
+
mergeSkipSet: N,
|
|
2033
|
+
cfContext: P,
|
|
2034
2034
|
colWidths: k,
|
|
2035
2035
|
rowHeights: A,
|
|
2036
2036
|
frozenColWidths: T,
|
|
@@ -2041,52 +2041,52 @@ function gt(e, t, n, r, i = {}) {
|
|
|
2041
2041
|
startCol: m,
|
|
2042
2042
|
cs: o,
|
|
2043
2043
|
dpr: a,
|
|
2044
|
-
autoFilterCells:
|
|
2045
|
-
hyperlinkMap:
|
|
2046
|
-
commentCells:
|
|
2047
|
-
tableStyleMap:
|
|
2048
|
-
sparklineMap:
|
|
2044
|
+
autoFilterCells: te,
|
|
2045
|
+
hyperlinkMap: F,
|
|
2046
|
+
commentCells: I,
|
|
2047
|
+
tableStyleMap: dt(t),
|
|
2048
|
+
sparklineMap: ft(t),
|
|
2049
2049
|
mdw: s,
|
|
2050
2050
|
onTextRun: i.onTextRun
|
|
2051
|
-
},
|
|
2052
|
-
C > 0 && w > 0 &&
|
|
2053
|
-
}
|
|
2054
|
-
function
|
|
2055
|
-
let
|
|
2056
|
-
e.fillStyle =
|
|
2057
|
-
let
|
|
2058
|
-
e.fillStyle =
|
|
2059
|
-
},
|
|
2060
|
-
e.fillStyle =
|
|
2051
|
+
}, R = d, z = f, B = R + D, V = z + O, ne = Math.max(0, c - B), re = Math.max(0, l - V);
|
|
2052
|
+
C > 0 && w > 0 && mt(e, L, 1, 1, T, E, 0, 0, R, z, R, z, D, O), C > 0 && mt(e, L, 1, m, k, E, v, 0, B, z, B, z, ne, O), w > 0 && mt(e, L, p, 1, T, A, 0, S, R, V, R, V, D, re), mt(e, L, p, m, k, A, v, S, B, V, B, V, ne, re), t.images && t.images.length > 0 && i.loadedImages && yt(e, t, i.loadedImages, o, p, m, v, S, B, V, ne, re), t.shapeGroups && t.shapeGroups.length > 0 && bt(e, t, o, p, m, v, S, B, V, ne, re, i.loadedImages), t.charts && t.charts.length > 0 && Nt(e, t, o, p, m, v, S, B, V, ne, re), t.slicers && t.slicers.length > 0 && Kt(e, t, o, p, m, v, S, B, V, ne, re), gt(e, c, l, p, m, h, _, k, A, v, S, T, E, D, O, d, f, o, a, i.selectedRowRange ?? null, i.selectedColRange ?? null), C > 0 && (e.save(), e.strokeStyle = g, e.lineWidth = .5, e.beginPath(), e.moveTo(d, V + .5), e.lineTo(c, V + .5), e.stroke(), e.restore()), w > 0 && (e.save(), e.strokeStyle = g, e.lineWidth = .5, e.beginPath(), e.moveTo(B + .5, f), e.lineTo(B + .5, l), e.stroke(), e.restore());
|
|
2053
|
+
}
|
|
2054
|
+
function gt(e, t, n, r, i, a, o, s, c, l, u, d, p, m, h, g, _, v, y, b, x) {
|
|
2055
|
+
let S = "#f8f9fa", C = "#e8eaed", w = "#caddf6", T = "#c8ccd0", E = "#5b9bd5", D = "#444", O = (e) => !x || e < x.start || e > x.end ? S : x.strong ? w : C, k = (e) => !x || e < x.start || e > x.end ? T : x.strong ? E : T, ee = (e) => !b || e < b.start || e > b.end ? S : b.strong ? w : C, A = (e) => !b || e < b.start || e > b.end ? T : b.strong ? E : T, j = `${Math.max(1, Math.round(11 * v))}px ${f}`, M = g + m, N = _ + h, P = .5 / y;
|
|
2056
|
+
e.fillStyle = S, e.fillRect(0, 0, g, _), e.strokeStyle = T, e.lineWidth = .5, e.beginPath(), e.moveTo(P, 0), e.lineTo(P, _), e.moveTo(0, P), e.lineTo(g, P), e.moveTo(g - P, 0), e.lineTo(g - P, _), e.moveTo(0, _ - P), e.lineTo(g, _ - P), e.stroke(), e.font = j, e.fillStyle = D;
|
|
2057
|
+
let te = (t, n, r) => {
|
|
2058
|
+
e.fillStyle = O(t), e.fillRect(n, 0, r, _), e.strokeStyle = k(t), e.lineWidth = .5, e.beginPath(), e.moveTo(n + r - P, 0), e.lineTo(n + r - P, _), e.moveTo(n, _ - P), e.lineTo(n + r, _ - P), e.moveTo(n, P), e.lineTo(n + r, P), e.stroke(), e.fillStyle = D, e.textAlign = "center", e.textBaseline = "middle", e.fillText(pe(t), n + r / 2, _ / 2);
|
|
2059
|
+
}, F = (t, n, r) => {
|
|
2060
|
+
e.fillStyle = ee(t), e.fillRect(0, n, g, r), e.strokeStyle = A(t), e.lineWidth = .5, e.beginPath(), e.moveTo(g - P, n), e.lineTo(g - P, n + r), e.moveTo(0, n + r - P), e.lineTo(g, n + r - P), e.moveTo(P, n), e.lineTo(P, n + r), e.stroke(), e.fillStyle = D, e.textAlign = "right", e.textBaseline = "middle", e.fillText(String(t), g - Math.max(2, Math.round(4 * v)), n + r / 2);
|
|
2061
2061
|
};
|
|
2062
2062
|
if (d.length > 0) {
|
|
2063
2063
|
e.save(), e.beginPath(), e.rect(g, 0, m, _), e.clip();
|
|
2064
2064
|
let t = g;
|
|
2065
|
-
for (let e = 0; e < d.length; e++)
|
|
2065
|
+
for (let e = 0; e < d.length; e++) te(e + 1, t, d[e]), t += d[e];
|
|
2066
2066
|
e.restore();
|
|
2067
2067
|
}
|
|
2068
|
-
e.save(), e.beginPath(), e.rect(
|
|
2069
|
-
let
|
|
2068
|
+
e.save(), e.beginPath(), e.rect(M, 0, t - M, _), e.clip();
|
|
2069
|
+
let I = M - l;
|
|
2070
2070
|
for (let e = 0; e < s.length; e++) {
|
|
2071
2071
|
let n = s[e];
|
|
2072
|
-
|
|
2072
|
+
I + n > M && I < t && te(i + e, I, n), I += n;
|
|
2073
2073
|
}
|
|
2074
2074
|
if (e.restore(), p.length > 0) {
|
|
2075
2075
|
e.save(), e.beginPath(), e.rect(0, _, g, h), e.clip();
|
|
2076
2076
|
let t = _;
|
|
2077
|
-
for (let e = 0; e < p.length; e++)
|
|
2077
|
+
for (let e = 0; e < p.length; e++) F(e + 1, t, p[e]), t += p[e];
|
|
2078
2078
|
e.restore();
|
|
2079
2079
|
}
|
|
2080
|
-
e.save(), e.beginPath(), e.rect(0,
|
|
2081
|
-
let
|
|
2080
|
+
e.save(), e.beginPath(), e.rect(0, N, g, n - N), e.clip();
|
|
2081
|
+
let L = N - u;
|
|
2082
2082
|
for (let e = 0; e < c.length; e++) {
|
|
2083
2083
|
let t = c[e];
|
|
2084
|
-
|
|
2084
|
+
L + t > N && L < n && F(r + e, L, t), L += t;
|
|
2085
2085
|
}
|
|
2086
2086
|
e.restore();
|
|
2087
2087
|
}
|
|
2088
|
-
var
|
|
2089
|
-
function
|
|
2088
|
+
var $ = 9525;
|
|
2089
|
+
function _t(e, t, n) {
|
|
2090
2090
|
let r = y(e), i = 0;
|
|
2091
2091
|
for (let a = 1; a < t; a++) i += Math.round(b(e.colWidths[a] ?? e.defaultColWidth, r) * n);
|
|
2092
2092
|
return i;
|
|
@@ -2098,12 +2098,12 @@ function vt(e, t, n) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
function yt(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
2100
2100
|
if (u <= 0 || d <= 0) return;
|
|
2101
|
-
let f =
|
|
2101
|
+
let f = _t(t, a, r), p = vt(t, i, r);
|
|
2102
2102
|
e.save(), e.beginPath(), e.rect(c, l, u, d), e.clip();
|
|
2103
2103
|
for (let i of t.images) {
|
|
2104
2104
|
let a = n.get(i.dataUrl);
|
|
2105
2105
|
if (!a) continue;
|
|
2106
|
-
let m = i.fromCol + 1, h = i.fromRow + 1, g = i.toCol + 1, _ = i.toRow + 1, v =
|
|
2106
|
+
let m = i.fromCol + 1, h = i.fromRow + 1, g = i.toCol + 1, _ = i.toRow + 1, v = _t(t, m, r) + i.fromColOff * r / $, y = vt(t, h, r) + i.fromRowOff * r / $, b = _t(t, g, r) + i.toColOff * r / $, x = vt(t, _, r) + i.toRowOff * r / $, S = b - v, C = x - y;
|
|
2107
2107
|
if (S <= 0 || C <= 0) continue;
|
|
2108
2108
|
let w = c + (v - f) - o, T = l + (y - p) - s;
|
|
2109
2109
|
w + S < c || w > c + u || T + C < l || T > l + d || e.drawImage(a, w, T, S, C);
|
|
@@ -2114,10 +2114,10 @@ function bt(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
2114
2114
|
if (l <= 0 || u <= 0) return;
|
|
2115
2115
|
let f = t.shapeGroups;
|
|
2116
2116
|
if (!f || f.length === 0) return;
|
|
2117
|
-
let p =
|
|
2117
|
+
let p = _t(t, i, n), m = vt(t, r, n);
|
|
2118
2118
|
e.save(), e.beginPath(), e.rect(s, c, l, u), e.clip();
|
|
2119
2119
|
for (let r of f) {
|
|
2120
|
-
let i = r.fromCol + 1, f = r.fromRow + 1, h = r.toCol + 1, g = r.toRow + 1, _ =
|
|
2120
|
+
let i = r.fromCol + 1, f = r.fromRow + 1, h = r.toCol + 1, g = r.toRow + 1, _ = _t(t, i, n) + r.fromColOff * n / $, v = vt(t, f, n) + r.fromRowOff * n / $, y = _t(t, h, n) + r.toColOff * n / $, b = vt(t, g, n) + r.toRowOff * n / $, x = y - _, S = b - v;
|
|
2121
2121
|
if (x <= 0 || S <= 0) continue;
|
|
2122
2122
|
let C = s + (_ - p) - a, w = c + (v - m) - o;
|
|
2123
2123
|
if (!(C + x < s || C > s + l) && !(w + S < c || w > c + u)) for (let t of r.shapes) {
|
|
@@ -2254,14 +2254,14 @@ function St(e, t, n, r) {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
}
|
|
2256
2256
|
function Ct(e, t) {
|
|
2257
|
-
t.fillColor && (e.fillStyle = t.fillColor, e.fill()), t.strokeColor && t.strokeWidth > 0 && (e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth /
|
|
2257
|
+
t.fillColor && (e.fillStyle = t.fillColor, e.fill()), t.strokeColor && t.strokeWidth > 0 && (e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth / $), e.stroke());
|
|
2258
2258
|
}
|
|
2259
2259
|
function wt(e, t, n, r, i, a, o) {
|
|
2260
2260
|
if (r === n && i === t) return e;
|
|
2261
2261
|
let s = (e, r) => {
|
|
2262
2262
|
if (e === t && r === n) return null;
|
|
2263
2263
|
let i = a.get(`${e}:${r}`);
|
|
2264
|
-
return i ?
|
|
2264
|
+
return i ? te(o, i.styleIndex).border : null;
|
|
2265
2265
|
}, c = s(t, r), l = s(i, n), u = s(i, r), d = (e, ...t) => {
|
|
2266
2266
|
if (e?.style) return e;
|
|
2267
2267
|
for (let e of t) if (e?.style) return e;
|
|
@@ -2509,9 +2509,9 @@ function Mt(e) {
|
|
|
2509
2509
|
}
|
|
2510
2510
|
function Nt(e, t, n, i, a, o, s, c, l, u, d) {
|
|
2511
2511
|
if (u <= 0 || d <= 0) return;
|
|
2512
|
-
let f =
|
|
2512
|
+
let f = _t(t, a, n), p = vt(t, i, n);
|
|
2513
2513
|
for (let i of t.charts) {
|
|
2514
|
-
let a = i.fromCol + 1, m = i.fromRow + 1, h = i.toCol + 1, g = i.toRow + 1, _ =
|
|
2514
|
+
let a = i.fromCol + 1, m = i.fromRow + 1, h = i.toCol + 1, g = i.toRow + 1, _ = _t(t, a, n) + i.fromColOff * n / $, v = vt(t, m, n) + i.fromRowOff * n / $, y = _t(t, h, n) + i.toColOff * n / $, b = vt(t, g, n) + i.toRowOff * n / $, x = y - _, S = b - v;
|
|
2515
2515
|
if (x <= 0 || S <= 0) continue;
|
|
2516
2516
|
let C = c + (_ - f) - o, w = l + (v - p) - s;
|
|
2517
2517
|
if (C + x < c || C > c + u || w + S < l || w > l + d) continue;
|
|
@@ -2530,9 +2530,9 @@ function Kt(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
2530
2530
|
if (l <= 0 || u <= 0) return;
|
|
2531
2531
|
let d = t.slicers;
|
|
2532
2532
|
if (!d) return;
|
|
2533
|
-
let f =
|
|
2533
|
+
let f = _t(t, i, n), p = vt(t, r, n);
|
|
2534
2534
|
for (let r of d) {
|
|
2535
|
-
let i = r.fromCol + 1, d = r.fromRow + 1, m = r.toCol + 1, h = r.toRow + 1, g =
|
|
2535
|
+
let i = r.fromCol + 1, d = r.fromRow + 1, m = r.toCol + 1, h = r.toRow + 1, g = _t(t, i, n) + r.fromColOff * n / $, _ = vt(t, d, n) + r.fromRowOff * n / $, v = _t(t, m, n) + r.toColOff * n / $, y = vt(t, h, n) + r.toRowOff * n / $, b = v - g, x = y - _;
|
|
2536
2536
|
if (b <= 0 || x <= 0) continue;
|
|
2537
2537
|
let S = s + (g - f) - a, C = c + (_ - p) - o;
|
|
2538
2538
|
S + b < s || S > s + l || C + x < c || C > c + u || (e.save(), e.beginPath(), e.rect(s, c, l, u), e.clip(), qt(e, r.caption, r.items, S, C, b, x, n), e.restore());
|
|
@@ -2636,7 +2636,7 @@ var Xt = {
|
|
|
2636
2636
|
let s = r.dpr ?? (typeof window < "u" ? window.devicePixelRatio : 1), c = e instanceof HTMLCanvasElement ? e.clientWidth || 800 : e.width, l = e instanceof HTMLCanvasElement ? e.clientHeight || 600 : e.height, u = r.width ?? c, d = r.height ?? l;
|
|
2637
2637
|
e.width = Math.round(u * s), e.height = Math.round(d * s), e instanceof HTMLCanvasElement && (e.style.width = `${u}px`, e.style.height = `${d}px`);
|
|
2638
2638
|
let f = e.getContext("2d");
|
|
2639
|
-
f.scale(s, s),
|
|
2639
|
+
f.scale(s, s), ht(f, i, a, n, {
|
|
2640
2640
|
...r,
|
|
2641
2641
|
dpr: s,
|
|
2642
2642
|
loadedImages: this.imageCache
|
|
@@ -2947,11 +2947,11 @@ var Xt = {
|
|
|
2947
2947
|
}, this.activeCell = {
|
|
2948
2948
|
row: 1,
|
|
2949
2949
|
col: a.col
|
|
2950
|
-
}, i && (this.isSelecting = !0, this.scrollHost.setPointerCapture(r))), this.updateSelectionOverlay(), this.opts.onSelectionChange?.(this.selection);
|
|
2950
|
+
}, i && (this.isSelecting = !0, this.scrollHost.setPointerCapture(r))), this.updateSelectionOverlay(), this.renderCurrentSheet(), this.opts.onSelectionChange?.(this.selection);
|
|
2951
2951
|
return;
|
|
2952
2952
|
}
|
|
2953
2953
|
let o = this.getCellAt(e, t);
|
|
2954
|
-
o && (n && this.anchorCell && this.selectionMode === "cells" ? this.activeCell = o : (this.selectionMode = "cells", this.anchorCell = o, this.activeCell = o), i && (this.isSelecting = !0, this.scrollHost.setPointerCapture(r)), this.updateSelectionOverlay(), this.opts.onSelectionChange?.(this.selection));
|
|
2954
|
+
o && (n && this.anchorCell && this.selectionMode === "cells" ? this.activeCell = o : (this.selectionMode = "cells", this.anchorCell = o, this.activeCell = o), i && (this.isSelecting = !0, this.scrollHost.setPointerCapture(r)), this.updateSelectionOverlay(), this.renderCurrentSheet(), this.opts.onSelectionChange?.(this.selection));
|
|
2955
2955
|
}
|
|
2956
2956
|
setupSelectionEvents() {
|
|
2957
2957
|
this.scrollHost.addEventListener("pointerdown", (e) => {
|
|
@@ -2992,7 +2992,7 @@ var Xt = {
|
|
|
2992
2992
|
if (!t || t.row === this.activeCell?.row && t.col === this.activeCell?.col) return;
|
|
2993
2993
|
this.activeCell = t;
|
|
2994
2994
|
}
|
|
2995
|
-
this.updateSelectionOverlay(), this.opts.onSelectionChange?.(this.selection);
|
|
2995
|
+
this.updateSelectionOverlay(), this.renderCurrentSheet(), this.opts.onSelectionChange?.(this.selection);
|
|
2996
2996
|
}
|
|
2997
2997
|
}), this.scrollHost.addEventListener("pointerup", (e) => {
|
|
2998
2998
|
if (this.pendingTap && this.pendingTap.pointerId === e.pointerId) {
|
|
@@ -3080,7 +3080,7 @@ var Xt = {
|
|
|
3080
3080
|
col: d,
|
|
3081
3081
|
rows: C,
|
|
3082
3082
|
cols: S
|
|
3083
|
-
};
|
|
3083
|
+
}, { selectedRowRange: T, selectedColRange: E } = this.computeHeaderHighlight();
|
|
3084
3084
|
await this.wb.renderViewport(this.canvas, this.currentSheet, w, {
|
|
3085
3085
|
width: t,
|
|
3086
3086
|
height: n,
|
|
@@ -3089,9 +3089,68 @@ var Xt = {
|
|
|
3089
3089
|
scrollOffsetX: p,
|
|
3090
3090
|
scrollOffsetY: g,
|
|
3091
3091
|
freezeRows: a,
|
|
3092
|
-
freezeCols: o
|
|
3092
|
+
freezeCols: o,
|
|
3093
|
+
selectedRowRange: T,
|
|
3094
|
+
selectedColRange: E
|
|
3093
3095
|
});
|
|
3094
3096
|
}
|
|
3097
|
+
computeHeaderHighlight() {
|
|
3098
|
+
if (!this.anchorCell || !this.activeCell) return {
|
|
3099
|
+
selectedRowRange: null,
|
|
3100
|
+
selectedColRange: null
|
|
3101
|
+
};
|
|
3102
|
+
let e = 2 ** 53 - 1, t = Math.min(this.anchorCell.row, this.activeCell.row), n = Math.max(this.anchorCell.row, this.activeCell.row), r = Math.min(this.anchorCell.col, this.activeCell.col), i = Math.max(this.anchorCell.col, this.activeCell.col);
|
|
3103
|
+
switch (this.selectionMode) {
|
|
3104
|
+
case "cells": return {
|
|
3105
|
+
selectedRowRange: {
|
|
3106
|
+
start: t,
|
|
3107
|
+
end: n,
|
|
3108
|
+
strong: !1
|
|
3109
|
+
},
|
|
3110
|
+
selectedColRange: {
|
|
3111
|
+
start: r,
|
|
3112
|
+
end: i,
|
|
3113
|
+
strong: !1
|
|
3114
|
+
}
|
|
3115
|
+
};
|
|
3116
|
+
case "rows": return {
|
|
3117
|
+
selectedRowRange: {
|
|
3118
|
+
start: t,
|
|
3119
|
+
end: n,
|
|
3120
|
+
strong: !0
|
|
3121
|
+
},
|
|
3122
|
+
selectedColRange: {
|
|
3123
|
+
start: 1,
|
|
3124
|
+
end: e,
|
|
3125
|
+
strong: !1
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
case "cols": return {
|
|
3129
|
+
selectedRowRange: {
|
|
3130
|
+
start: 1,
|
|
3131
|
+
end: e,
|
|
3132
|
+
strong: !1
|
|
3133
|
+
},
|
|
3134
|
+
selectedColRange: {
|
|
3135
|
+
start: r,
|
|
3136
|
+
end: i,
|
|
3137
|
+
strong: !0
|
|
3138
|
+
}
|
|
3139
|
+
};
|
|
3140
|
+
case "all": return {
|
|
3141
|
+
selectedRowRange: {
|
|
3142
|
+
start: 1,
|
|
3143
|
+
end: e,
|
|
3144
|
+
strong: !0
|
|
3145
|
+
},
|
|
3146
|
+
selectedColRange: {
|
|
3147
|
+
start: 1,
|
|
3148
|
+
end: e,
|
|
3149
|
+
strong: !0
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3095
3154
|
get sheetNames() {
|
|
3096
3155
|
return this.wb.sheetNames;
|
|
3097
3156
|
}
|