@office-view-suite/viewer-excel 0.0.0-stage → 0.2.1
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/dist/LICENSE +201 -0
- package/dist/THIRD_PARTY_NOTICES.md +102 -0
- package/dist/asset-manifest.json +18 -0
- package/dist/assets/excel/excel_view_rs_bg.wasm +0 -0
- package/dist/assets/excel/worker.js +1 -0
- package/dist/index.js +737 -0
- package/dist/licenses/aes-0.9.3/LICENSE-APACHE +201 -0
- package/dist/licenses/aes-0.9.3/LICENSE-MIT +26 -0
- package/dist/licenses/aho-corasick-1.1.5/COPYING +3 -0
- package/dist/licenses/aho-corasick-1.1.5/LICENSE-MIT +21 -0
- package/dist/licenses/autocfg-1.5.1/LICENSE-APACHE +201 -0
- package/dist/licenses/autocfg-1.5.1/LICENSE-MIT +25 -0
- package/dist/licenses/base64-0.22.1/LICENSE-APACHE +201 -0
- package/dist/licenses/base64-0.22.1/LICENSE-MIT +21 -0
- package/dist/licenses/bit-set-0.8.0/LICENSE-APACHE +201 -0
- package/dist/licenses/bit-set-0.8.0/LICENSE-MIT +25 -0
- package/dist/licenses/bit-vec-0.8.0/LICENSE-APACHE +201 -0
- package/dist/licenses/bit-vec-0.8.0/LICENSE-MIT +25 -0
- package/dist/licenses/bitflags-1.3.2/LICENSE-APACHE +201 -0
- package/dist/licenses/bitflags-1.3.2/LICENSE-MIT +25 -0
- package/dist/licenses/block-buffer-0.12.1/LICENSE-APACHE +201 -0
- package/dist/licenses/block-buffer-0.12.1/LICENSE-MIT +25 -0
- package/dist/licenses/block-padding-0.4.2/LICENSE-APACHE +201 -0
- package/dist/licenses/block-padding-0.4.2/LICENSE-MIT +25 -0
- package/dist/licenses/bumpalo-3.20.3/LICENSE-APACHE +201 -0
- package/dist/licenses/bumpalo-3.20.3/LICENSE-MIT +25 -0
- package/dist/licenses/bytemuck-1.25.2/LICENSE-APACHE +61 -0
- package/dist/licenses/bytemuck-1.25.2/LICENSE-MIT +9 -0
- package/dist/licenses/bytemuck-1.25.2/LICENSE-ZLIB +11 -0
- package/dist/licenses/byteorder-1.5.0/COPYING +3 -0
- package/dist/licenses/byteorder-1.5.0/LICENSE-MIT +21 -0
- package/dist/licenses/cbc-0.2.1/LICENSE-APACHE +201 -0
- package/dist/licenses/cbc-0.2.1/LICENSE-MIT +26 -0
- package/dist/licenses/cfb-0.14.0/LICENSE +21 -0
- package/dist/licenses/cfg-if-1.0.5/LICENSE-APACHE +201 -0
- package/dist/licenses/cfg-if-1.0.5/LICENSE-MIT +25 -0
- package/dist/licenses/chacha20-0.10.2/LICENSE-APACHE +201 -0
- package/dist/licenses/chacha20-0.10.2/LICENSE-MIT +25 -0
- package/dist/licenses/chrono-0.4.45/LICENSE.txt +240 -0
- package/dist/licenses/cipher-0.5.2/LICENSE-APACHE +201 -0
- package/dist/licenses/cipher-0.5.2/LICENSE-MIT +25 -0
- package/dist/licenses/cmov-0.5.4/LICENSE-APACHE +202 -0
- package/dist/licenses/cmov-0.5.4/LICENSE-MIT +25 -0
- package/dist/licenses/console_error_panic_hook-0.1.7/LICENSE-APACHE +201 -0
- package/dist/licenses/console_error_panic_hook-0.1.7/LICENSE-MIT +25 -0
- package/dist/licenses/const-oid-0.10.2/LICENSE-APACHE +201 -0
- package/dist/licenses/const-oid-0.10.2/LICENSE-MIT +25 -0
- package/dist/licenses/cpubits-0.1.1/LICENSE-APACHE +201 -0
- package/dist/licenses/cpubits-0.1.1/LICENSE-MIT +25 -0
- package/dist/licenses/crc32fast-1.5.2/LICENSE-APACHE +202 -0
- package/dist/licenses/crc32fast-1.5.2/LICENSE-MIT +21 -0
- package/dist/licenses/crypto-common-0.2.2/LICENSE-APACHE +201 -0
- package/dist/licenses/crypto-common-0.2.2/LICENSE-MIT +25 -0
- package/dist/licenses/ctutils-0.4.3/LICENSE-APACHE +202 -0
- package/dist/licenses/ctutils-0.4.3/LICENSE-MIT +25 -0
- package/dist/licenses/defmt-1.1.1/LICENSE-APACHE +201 -0
- package/dist/licenses/defmt-1.1.1/LICENSE-MIT +25 -0
- package/dist/licenses/defmt-macros-1.1.1/LICENSE-APACHE +201 -0
- package/dist/licenses/defmt-macros-1.1.1/LICENSE-MIT +25 -0
- package/dist/licenses/digest-0.11.3/LICENSE-APACHE +201 -0
- package/dist/licenses/digest-0.11.3/LICENSE-MIT +26 -0
- package/dist/licenses/encoding_rs-0.8.42/LICENSE-APACHE +202 -0
- package/dist/licenses/encoding_rs-0.8.42/LICENSE-MIT +25 -0
- package/dist/licenses/encoding_rs-0.8.42/LICENSE-WHATWG +26 -0
- package/dist/licenses/equivalent-1.0.3/LICENSE-APACHE +201 -0
- package/dist/licenses/equivalent-1.0.3/LICENSE-MIT +25 -0
- package/dist/licenses/fancy-regex-0.18.0/LICENSE +21 -0
- package/dist/licenses/fastrand-2.5.0/LICENSE-APACHE +201 -0
- package/dist/licenses/fastrand-2.5.0/LICENSE-MIT +23 -0
- package/dist/licenses/flate2-1.1.10/LICENSE-APACHE +201 -0
- package/dist/licenses/flate2-1.1.10/LICENSE-MIT +25 -0
- package/dist/licenses/fnv-1.0.7/LICENSE-APACHE +201 -0
- package/dist/licenses/fnv-1.0.7/LICENSE-MIT +25 -0
- package/dist/licenses/futures-core-0.3.34/LICENSE-APACHE +202 -0
- package/dist/licenses/futures-core-0.3.34/LICENSE-MIT +26 -0
- package/dist/licenses/futures-task-0.3.34/LICENSE-APACHE +202 -0
- package/dist/licenses/futures-task-0.3.34/LICENSE-MIT +26 -0
- package/dist/licenses/futures-util-0.3.34/LICENSE-APACHE +202 -0
- package/dist/licenses/futures-util-0.3.34/LICENSE-MIT +26 -0
- package/dist/licenses/getrandom-0.4.3/LICENSE-APACHE +201 -0
- package/dist/licenses/getrandom-0.4.3/LICENSE-MIT +26 -0
- package/dist/licenses/hashbrown-0.17.1/LICENSE-APACHE +201 -0
- package/dist/licenses/hashbrown-0.17.1/LICENSE-MIT +25 -0
- package/dist/licenses/hmac-0.13.0/LICENSE-APACHE +201 -0
- package/dist/licenses/hmac-0.13.0/LICENSE-MIT +25 -0
- package/dist/licenses/html5gum-0.8.4/LICENSE +19 -0
- package/dist/licenses/hybrid-array-0.4.15/LICENSE-APACHE +201 -0
- package/dist/licenses/hybrid-array-0.4.15/LICENSE-MIT +25 -0
- package/dist/licenses/imagesize-0.14.0/LICENSE +21 -0
- package/dist/licenses/indexmap-2.14.2/LICENSE-APACHE +201 -0
- package/dist/licenses/indexmap-2.14.2/LICENSE-MIT +25 -0
- package/dist/licenses/inout-0.2.3/LICENSE-APACHE +201 -0
- package/dist/licenses/inout-0.2.3/LICENSE-MIT +26 -0
- package/dist/licenses/jetscii-0.5.3/LICENSE-APACHE +201 -0
- package/dist/licenses/jetscii-0.5.3/LICENSE-MIT +25 -0
- package/dist/licenses/jiff-0.2.38/COPYING +3 -0
- package/dist/licenses/jiff-0.2.38/LICENSE-MIT +21 -0
- package/dist/licenses/jiff-core-0.1.1/COPYING +3 -0
- package/dist/licenses/jiff-core-0.1.1/LICENSE-MIT +21 -0
- package/dist/licenses/js-sys-0.3.106/LICENSE-APACHE +201 -0
- package/dist/licenses/js-sys-0.3.106/LICENSE-MIT +25 -0
- package/dist/licenses/log-0.4.34/LICENSE-APACHE +201 -0
- package/dist/licenses/log-0.4.34/LICENSE-MIT +25 -0
- package/dist/licenses/md-5-0.11.0/LICENSE-APACHE +201 -0
- package/dist/licenses/md-5-0.11.0/LICENSE-MIT +28 -0
- package/dist/licenses/memchr-2.8.3/COPYING +3 -0
- package/dist/licenses/memchr-2.8.3/LICENSE-MIT +21 -0
- package/dist/licenses/multiversion_no_op-1.0.0/LICENSE-APACHE +202 -0
- package/dist/licenses/multiversion_no_op-1.0.0/LICENSE-MIT +25 -0
- package/dist/licenses/num-traits-0.2.19/LICENSE-APACHE +201 -0
- package/dist/licenses/num-traits-0.2.19/LICENSE-MIT +25 -0
- package/dist/licenses/once_cell-1.21.4/LICENSE-APACHE +201 -0
- package/dist/licenses/once_cell-1.21.4/LICENSE-MIT +23 -0
- package/dist/licenses/phf-0.14.0/LICENSE +20 -0
- package/dist/licenses/phf_generator-0.14.0/LICENSE +20 -0
- package/dist/licenses/phf_macros-0.14.0/LICENSE +20 -0
- package/dist/licenses/phf_shared-0.14.0/LICENSE +20 -0
- package/dist/licenses/pin-project-lite-0.2.17/LICENSE-APACHE +177 -0
- package/dist/licenses/pin-project-lite-0.2.17/LICENSE-MIT +23 -0
- package/dist/licenses/proc-macro2-1.0.107/LICENSE-APACHE +176 -0
- package/dist/licenses/proc-macro2-1.0.107/LICENSE-MIT +23 -0
- package/dist/licenses/quick-xml-0.41.0/LICENSE-MIT.md +23 -0
- package/dist/licenses/quote-1.0.47/LICENSE-APACHE +176 -0
- package/dist/licenses/quote-1.0.47/LICENSE-MIT +23 -0
- package/dist/licenses/rand-0.10.3/LICENSE-APACHE +176 -0
- package/dist/licenses/rand-0.10.3/LICENSE-MIT +26 -0
- package/dist/licenses/rand_core-0.10.1/LICENSE-APACHE +187 -0
- package/dist/licenses/rand_core-0.10.1/LICENSE-MIT +25 -0
- package/dist/licenses/regex-automata-0.4.18/LICENSE-APACHE +201 -0
- package/dist/licenses/regex-automata-0.4.18/LICENSE-MIT +25 -0
- package/dist/licenses/regex-syntax-0.8.11/LICENSE-APACHE +201 -0
- package/dist/licenses/regex-syntax-0.8.11/LICENSE-MIT +25 -0
- package/dist/licenses/rgb-0.8.53/LICENSE +21 -0
- package/dist/licenses/rustversion-1.0.23/LICENSE-APACHE +176 -0
- package/dist/licenses/rustversion-1.0.23/LICENSE-MIT +23 -0
- package/dist/licenses/scopeguard-1.2.0/LICENSE-APACHE +201 -0
- package/dist/licenses/scopeguard-1.2.0/LICENSE-MIT +25 -0
- package/dist/licenses/serde-1.0.229/LICENSE-APACHE +176 -0
- package/dist/licenses/serde-1.0.229/LICENSE-MIT +23 -0
- package/dist/licenses/serde-wasm-bindgen-0.6.5/LICENSE +21 -0
- package/dist/licenses/serde_core-1.0.229/LICENSE-APACHE +176 -0
- package/dist/licenses/serde_core-1.0.229/LICENSE-MIT +23 -0
- package/dist/licenses/serde_derive-1.0.229/LICENSE-APACHE +176 -0
- package/dist/licenses/serde_derive-1.0.229/LICENSE-MIT +23 -0
- package/dist/licenses/sha2-0.11.1/LICENSE-APACHE +201 -0
- package/dist/licenses/sha2-0.11.1/LICENSE-MIT +28 -0
- package/dist/licenses/simd-adler32-0.3.10/LICENSE.md +21 -0
- package/dist/licenses/siphasher-1.0.4/COPYING +7 -0
- package/dist/licenses/siphasher-1.0.4/LICENSE-APACHE +202 -0
- package/dist/licenses/siphasher-1.0.4/LICENSE-MIT +17 -0
- package/dist/licenses/slab-0.4.12/LICENSE +25 -0
- package/dist/licenses/syn-2.0.119/LICENSE-APACHE +176 -0
- package/dist/licenses/syn-2.0.119/LICENSE-MIT +23 -0
- package/dist/licenses/syn-3.0.9/LICENSE-APACHE +176 -0
- package/dist/licenses/syn-3.0.9/LICENSE-MIT +23 -0
- package/dist/licenses/thiserror-2.0.21/LICENSE-APACHE +176 -0
- package/dist/licenses/thiserror-2.0.21/LICENSE-MIT +23 -0
- package/dist/licenses/thiserror-impl-2.0.21/LICENSE-APACHE +176 -0
- package/dist/licenses/thiserror-impl-2.0.21/LICENSE-MIT +23 -0
- package/dist/licenses/thousands-0.2.0/LICENSE-APACHE +201 -0
- package/dist/licenses/thousands-0.2.0/LICENSE-MIT +25 -0
- package/dist/licenses/typed-path-0.12.3/LICENSE-APACHE +176 -0
- package/dist/licenses/typed-path-0.12.3/LICENSE-MIT +23 -0
- package/dist/licenses/typenum-1.20.1/LICENSE +1 -0
- package/dist/licenses/typenum-1.20.1/LICENSE-APACHE +201 -0
- package/dist/licenses/typenum-1.20.1/LICENSE-MIT +21 -0
- package/dist/licenses/umya-spreadsheet-3.1.1/LICENSE +21 -0
- package/dist/licenses/unicode-ident-1.0.27/LICENSE-APACHE +176 -0
- package/dist/licenses/unicode-ident-1.0.27/LICENSE-MIT +23 -0
- package/dist/licenses/unicode-ident-1.0.27/LICENSE-UNICODE +39 -0
- package/dist/licenses/uuid-1.28.0/LICENSE-APACHE +201 -0
- package/dist/licenses/uuid-1.28.0/LICENSE-MIT +26 -0
- package/dist/licenses/wasm-bindgen-0.2.129/LICENSE-APACHE +201 -0
- package/dist/licenses/wasm-bindgen-0.2.129/LICENSE-MIT +25 -0
- package/dist/licenses/wasm-bindgen-macro-0.2.129/LICENSE-APACHE +201 -0
- package/dist/licenses/wasm-bindgen-macro-0.2.129/LICENSE-MIT +25 -0
- package/dist/licenses/wasm-bindgen-macro-support-0.2.129/LICENSE-APACHE +201 -0
- package/dist/licenses/wasm-bindgen-macro-support-0.2.129/LICENSE-MIT +25 -0
- package/dist/licenses/wasm-bindgen-shared-0.2.129/LICENSE-APACHE +201 -0
- package/dist/licenses/wasm-bindgen-shared-0.2.129/LICENSE-MIT +25 -0
- package/dist/licenses/web-time-1.1.0/LICENSE-APACHE +201 -0
- package/dist/licenses/web-time-1.1.0/LICENSE-MIT +21 -0
- package/dist/licenses/zip-8.6.0/LICENSE +21 -0
- package/dist/licenses/zlib-rs-0.6.8/LICENSE +19 -0
- package/dist/licenses/zopfli-0.8.4/COPYING +201 -0
- package/dist/types/core/format.d.ts +4 -0
- package/dist/types/core/layout.d.ts +51 -0
- package/dist/types/core/render.d.ts +20 -0
- package/dist/types/core/styles.d.ts +4 -0
- package/dist/types/core/types.d.ts +121 -0
- package/dist/types/core/virtual.d.ts +39 -0
- package/dist/types/index.d.ts +22 -0
- package/package.json +30 -3
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
import { createWorkerAdapter as vt, createOfficeViewerError as $t } from "@office-view-suite/viewer-core";
|
|
2
|
+
const rt = { black: "#000000", blue: "#0000ff", cyan: "#00ffff", green: "#008000", magenta: "#ff00ff", red: "#ff0000", white: "#ffffff", yellow: "#ffff00" }, q = 864e5;
|
|
3
|
+
function ft(t) {
|
|
4
|
+
const e = [{ tokens: [] }];
|
|
5
|
+
for (let o = 0; o < t.length; ) {
|
|
6
|
+
const n = e[e.length - 1], r = t[o++];
|
|
7
|
+
if (r === ";") {
|
|
8
|
+
e.push({ tokens: [] });
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (r === '"') {
|
|
12
|
+
let s = "";
|
|
13
|
+
for (; o < t.length && t[o] !== '"'; ) s += t[o++];
|
|
14
|
+
t[o] === '"' && o++, n.tokens.push({ text: s, literal: !0 });
|
|
15
|
+
} else if (r === "\\") n.tokens.push({ text: t[o++] ?? "", literal: !0 });
|
|
16
|
+
else if (r === "_")
|
|
17
|
+
o++, n.tokens.push({ text: " ", literal: !0 });
|
|
18
|
+
else if (r === "*")
|
|
19
|
+
o++;
|
|
20
|
+
else if (r === "[") {
|
|
21
|
+
const s = t.indexOf("]", o);
|
|
22
|
+
if (s < 0) {
|
|
23
|
+
n.tokens.push({ text: "[", literal: !0 });
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const c = t.slice(o, s);
|
|
27
|
+
o = s + 1;
|
|
28
|
+
const a = /^(<=|>=|<>|=|<|>)(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)$/i.exec(c);
|
|
29
|
+
a ? n.condition = { op: a[1], value: Number(a[2]) } : rt[c.toLowerCase()] ? n.color = rt[c.toLowerCase()] : /^[hms]+$/i.test(c) ? n.tokens.push({ text: c.toLowerCase(), bracket: !0 }) : c.startsWith("$") && n.tokens.push({ text: c.slice(1).split("-")[0], literal: !0 });
|
|
30
|
+
} else {
|
|
31
|
+
const s = /^(AM\/PM|A\/P)/i.exec(t.slice(o - 1));
|
|
32
|
+
if (s)
|
|
33
|
+
n.tokens.push({ text: s[0] }), o += s[0].length - 1;
|
|
34
|
+
else if (/[ymdhs]/i.test(r)) {
|
|
35
|
+
let c = r;
|
|
36
|
+
for (; t[o]?.toLowerCase() === r.toLowerCase(); ) c += t[o++];
|
|
37
|
+
n.tokens.push({ text: c });
|
|
38
|
+
} else n.tokens.push({ text: r });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return e;
|
|
42
|
+
}
|
|
43
|
+
function ht(t, e) {
|
|
44
|
+
const o = ft(t);
|
|
45
|
+
if (o.slice(0, 2).some((r) => r.condition))
|
|
46
|
+
return { section: o.slice(0, 3).find((s) => {
|
|
47
|
+
if (!s.condition) return !0;
|
|
48
|
+
const { op: c, value: a } = s.condition;
|
|
49
|
+
return c === "<" ? e < a : c === ">" ? e > a : c === "<=" ? e <= a : c === ">=" ? e >= a : c === "<>" ? e !== a : e === a;
|
|
50
|
+
}) ?? { tokens: [] }, magnitude: !1 };
|
|
51
|
+
const n = e < 0 && o.length > 1 ? 1 : e === 0 && o.length > 2 ? 2 : 0;
|
|
52
|
+
return { section: o[n], magnitude: n === 1 };
|
|
53
|
+
}
|
|
54
|
+
function Mt(t, e, o) {
|
|
55
|
+
if (!(!e || o && o !== "number" || !Number.isFinite(Number(t)) || t.trim() === ""))
|
|
56
|
+
return ht(e, Number(t)).section.color;
|
|
57
|
+
}
|
|
58
|
+
function zt(t, e) {
|
|
59
|
+
const o = Math.floor(t), n = e ? o : o - (o >= 60 ? 1 : 0), r = new Date((e ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 31)) + n * q + Math.round((t - o) * q));
|
|
60
|
+
return { date: r, year: !e && o === 60 ? 1900 : r.getUTCFullYear(), month: !e && o === 60 ? 2 : r.getUTCMonth() + 1, day: !e && o === 60 ? 29 : r.getUTCDate() };
|
|
61
|
+
}
|
|
62
|
+
function St(t, e, o) {
|
|
63
|
+
const { date: n, year: r, month: s, day: c } = zt(e, o);
|
|
64
|
+
if (!Number.isFinite(n.getTime())) return String(e);
|
|
65
|
+
const a = t.some((p) => !p.literal && /^a(m)?\//i.test(p.text)), d = (p, $) => String(p).padStart($, "0"), x = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], v = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], N = t.map((p, $) => !p.literal && /^[ymdhs]+$/i.test(p.text) ? $ : -1).filter((p) => p >= 0);
|
|
66
|
+
return t.map((p, $) => {
|
|
67
|
+
if (p.literal) return p.text;
|
|
68
|
+
const C = p.text.toLowerCase(), S = p.text.length;
|
|
69
|
+
if (p.bracket) return d(Math.floor(Math.abs(e) * (C[0] === "h" ? 24 : C[0] === "m" ? 1440 : 86400) + 1e-8), S);
|
|
70
|
+
if (/^a(m)?\//i.test(p.text)) return n.getUTCHours() < 12 ? S === 3 ? "A" : "AM" : S === 3 ? "P" : "PM";
|
|
71
|
+
if (/^y+$/.test(C)) return S <= 2 ? d(r % 100, 2) : d(r, S);
|
|
72
|
+
if (/^m+$/.test(C)) {
|
|
73
|
+
const u = N.filter((M) => M < $).at(-1), A = N.find((M) => M > $);
|
|
74
|
+
return u != null && t[u].text[0].toLowerCase() === "h" || A != null && t[A].text[0].toLowerCase() === "s" ? S > 1 ? d(n.getUTCMinutes(), 2) : String(n.getUTCMinutes()) : S === 5 ? x[s - 1][0] : S === 4 ? x[s - 1] : S === 3 ? x[s - 1].slice(0, 3) : S === 2 ? d(s, 2) : String(s);
|
|
75
|
+
}
|
|
76
|
+
if (/^d+$/.test(C)) return S >= 3 ? v[n.getUTCDay()].slice(0, S === 3 ? 3 : void 0) : S === 2 ? d(c, 2) : String(c);
|
|
77
|
+
if (/^h+$/.test(C)) {
|
|
78
|
+
const u = a ? n.getUTCHours() % 12 || 12 : n.getUTCHours();
|
|
79
|
+
return S > 1 ? d(u, 2) : String(u);
|
|
80
|
+
}
|
|
81
|
+
if (/^s+$/.test(C)) return S > 1 ? d(n.getUTCSeconds(), 2) : String(n.getUTCSeconds());
|
|
82
|
+
if (p.text === "0") {
|
|
83
|
+
let u = $;
|
|
84
|
+
for (; u > 0 && t[u - 1].text === "0"; ) u--;
|
|
85
|
+
if (t[u - 1]?.text === "." && /^s+$/i.test(t[u - 2]?.text ?? "")) {
|
|
86
|
+
const A = $ - u;
|
|
87
|
+
return d(n.getUTCMilliseconds(), 3)[A] ?? "0";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return p.text;
|
|
91
|
+
}).join("");
|
|
92
|
+
}
|
|
93
|
+
function Lt(t, e, o) {
|
|
94
|
+
const n = t.map((l, T) => !l.literal && /[0#?]/.test(l.text) ? T : -1).filter((l) => l >= 0);
|
|
95
|
+
if (!n.length) return t.map((l) => l.text).join("");
|
|
96
|
+
const r = n[0];
|
|
97
|
+
let s = n.at(-1);
|
|
98
|
+
if (t[s + 1]?.text === "/" && !t[s + 1].literal) {
|
|
99
|
+
let l = s + 2;
|
|
100
|
+
for (; t[l] && !t[l].literal && /^\d$/.test(t[l].text); ) l++;
|
|
101
|
+
l > s + 2 && (s = l - 1);
|
|
102
|
+
}
|
|
103
|
+
const c = t.slice(0, r).map((l) => l.text).join("");
|
|
104
|
+
let a = s + 1, d = 0;
|
|
105
|
+
for (; t[a]?.text === "," && !t[a].literal; )
|
|
106
|
+
d++, a++;
|
|
107
|
+
const x = t.filter((l) => !l.literal && l.text === "%").length;
|
|
108
|
+
let v = (o ? Math.abs(e) : e) * 100 ** x / 1e3 ** d;
|
|
109
|
+
const N = t.slice(r, s + 1).map((l) => l.literal ? "\0" : l.text).join(""), p = t.slice(a).map((l) => l.text).join(""), $ = /^([0#?]+)(?:\.([0#?]+))?([eE])([+-])([0#?]+)$/.exec(N);
|
|
110
|
+
if ($) {
|
|
111
|
+
const l = Math.min(20, $[2]?.length ?? 0), [T, m] = v.toExponential(l).split("e"), g = Number(m);
|
|
112
|
+
return c + T + $[3] + (g < 0 ? "-" : $[4] === "+" ? "+" : "") + String(Math.abs(g)).padStart($[5].length, "0") + p;
|
|
113
|
+
}
|
|
114
|
+
const C = /^([#0?]+ )?([#0?]+)\/([#0?]+|\d+)$/.exec(N);
|
|
115
|
+
if (C) {
|
|
116
|
+
let l = C[1] ? Math.floor(Math.abs(v)) : 0;
|
|
117
|
+
const T = Math.abs(v) - l, m = /^\d+$/.test(C[3]) ? Number(C[3]) : 0;
|
|
118
|
+
let g = m || 1, b = Math.round(T * g), W = 1 / 0;
|
|
119
|
+
for (let U = 1; !m && U <= Math.min(9999, 10 ** C[3].length - 1); U++) {
|
|
120
|
+
const V = Math.round(T * U), j = Math.abs(T - V / U);
|
|
121
|
+
if (j < W && (W = j, g = U, b = V), j < 1e-12) break;
|
|
122
|
+
}
|
|
123
|
+
C[1] && b >= g && (l += Math.floor(b / g), b %= g);
|
|
124
|
+
const P = C[1] ? l === 0 && !C[1].includes("0") ? " " : `${l} ` : "", F = b === 0 && C[1] ? " ".repeat(C[2].length + C[3].length + 1) : `${b}/${g}`;
|
|
125
|
+
return c + (v < 0 ? "-" : "") + P + F + p;
|
|
126
|
+
}
|
|
127
|
+
const S = /^([0#?,]+)(?:\.([0#?]+))?$/.exec(N);
|
|
128
|
+
if (!S) {
|
|
129
|
+
const l = String(Math.round(Math.abs(v))).padStart(n.length, "0");
|
|
130
|
+
let T = Math.max(0, l.length - n.length);
|
|
131
|
+
return (v < 0 ? "-" : "") + t.map((m, g) => !m.literal && /[0#?]/.test(m.text) ? (g === r ? l.slice(0, T) : "") + (l[T++] ?? "") : m.text).join("");
|
|
132
|
+
}
|
|
133
|
+
const u = S[2] ?? "", A = u.replace(/[^0]/g, "").length, h = Math.min(20, u.length), M = S[1], y = M.includes(","), z = Math.max(1, M.replace(/[^0]/g, "").length), i = Math.abs(v);
|
|
134
|
+
let f = i.toLocaleString("en-US", { useGrouping: y, minimumIntegerDigits: Math.min(21, z), minimumFractionDigits: Math.min(A, h), maximumFractionDigits: h });
|
|
135
|
+
!M.includes("0") && i < 1 && (f = f.replace(/^0(?=\.|$)/, ""));
|
|
136
|
+
const w = u.includes("?") ? h - (f.split(".")[1]?.length ?? 0) : 0;
|
|
137
|
+
return w > 0 && (f += (f.includes(".") ? "" : ".") + " ".repeat(w)), v < 0 && (f = "-" + f), c + f + p;
|
|
138
|
+
}
|
|
139
|
+
function mt(t, e, o, n = !1) {
|
|
140
|
+
if (o === "empty" || t === "") return "";
|
|
141
|
+
if (o === "error" || o === "boolean") return t;
|
|
142
|
+
if (o === "string" || o == null && (!Number.isFinite(Number(t)) || t.trim() === "")) {
|
|
143
|
+
const a = e ? ft(e)[3] : void 0;
|
|
144
|
+
return a ? a.tokens.map((d) => !d.literal && d.text === "@" ? t : d.text).join("") : t;
|
|
145
|
+
}
|
|
146
|
+
if (!e || /^general$/i.test(e)) return t;
|
|
147
|
+
let r = Number(t);
|
|
148
|
+
if (o === "date") {
|
|
149
|
+
const a = Date.parse(t);
|
|
150
|
+
if (!Number.isFinite(a)) return t;
|
|
151
|
+
r = (a - (n ? Date.UTC(1904, 0, 1) : Date.UTC(1899, 11, 31))) / q, !n && a >= Date.UTC(1900, 2, 1) && r++;
|
|
152
|
+
}
|
|
153
|
+
if (!Number.isFinite(r)) return t;
|
|
154
|
+
const { section: s, magnitude: c } = ht(e, r);
|
|
155
|
+
return /^general$/i.test(s.tokens.filter((a) => !a.literal).map((a) => a.text).join("")) && !s.tokens.some((a) => a.literal) ? String(r) : s.tokens.some((a) => !a.literal && (a.bracket || /^[ymdhs]+$/i.test(a.text))) ? St(s.tokens, r, n) : s.tokens.some((a) => !a.literal && a.text === "@") ? t : Lt(s.tokens, r, c);
|
|
156
|
+
}
|
|
157
|
+
const pt = 1.25;
|
|
158
|
+
function ot(t, e) {
|
|
159
|
+
return t ? `${JSON.stringify(t)}, "PingFang SC", "Microsoft YaHei", sans-serif` : e;
|
|
160
|
+
}
|
|
161
|
+
const Et = `
|
|
162
|
+
:host { display: block; }
|
|
163
|
+
|
|
164
|
+
.workbook { display: flex; flex-direction: column; gap: 12px; width: 100%; }
|
|
165
|
+
.workbook--bounded { height: var(--office-excel-workbook-height); min-height: 0; }
|
|
166
|
+
.workbook--bounded > .sheet-tabs { flex: 0 0 auto; }
|
|
167
|
+
.workbook--bounded .sheet-pages, .workbook--bounded .sheet:not([hidden]) { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; }
|
|
168
|
+
.workbook--bounded .grid-wrap { flex: 1 1 0; min-height: 0; max-height: none; }
|
|
169
|
+
.sheet-tabs { position: sticky; top: 0; z-index: 20; display: flex; gap: 0; overflow-x: auto; padding: 6px 0 0; background: #f6f7f9; border-bottom: 1px solid #c9d0d7; }
|
|
170
|
+
.sheet-tab { flex: 0 0 auto; min-height: 34px; padding: 6px 14px; border: 0; border-right: 1px solid #d7dce1; border-bottom: 2px solid transparent; background: #eef1f4; color: #30363d; cursor: pointer; }
|
|
171
|
+
.sheet-tab[aria-selected="true"] { background: #fff; border-bottom-color: #217346; color: #111; font-weight: 600; }
|
|
172
|
+
.sheet[hidden] { display: none; }
|
|
173
|
+
|
|
174
|
+
.grid-wrap { overflow: auto; max-height: 63vh; max-width: var(--office-viewer-viewport-width, none); box-sizing: border-box; background: #fff; border: 1px solid #d0d7de; border-radius: 0; }
|
|
175
|
+
.grid { position: relative; display: grid; gap: 0; width: max-content; zoom: var(--office-excel-scale, 1);
|
|
176
|
+
border-left: 1px solid #e4e8ec; border-top: 1px solid #e4e8ec; }
|
|
177
|
+
|
|
178
|
+
.grid--no-lines { border-color: transparent; }
|
|
179
|
+
.grid--no-lines .cell { border-color: transparent; }
|
|
180
|
+
.cell-content { width: 100%; min-width: 0; }
|
|
181
|
+
.cell {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
justify-content: flex-end;
|
|
185
|
+
box-sizing: border-box;
|
|
186
|
+
border-right: 1px solid #e4e8ec;
|
|
187
|
+
border-bottom: 1px solid #e4e8ec;
|
|
188
|
+
padding: 3px 8px;
|
|
189
|
+
font-size: 14px;
|
|
190
|
+
line-height: ${pt};
|
|
191
|
+
white-space: nowrap;
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
text-overflow: ellipsis;
|
|
194
|
+
color: #111418;
|
|
195
|
+
background: #fff;
|
|
196
|
+
}
|
|
197
|
+
.frozen-row, .frozen-column { position: sticky; z-index: 5; }
|
|
198
|
+
.frozen-corner { z-index: 6; }
|
|
199
|
+
.virtual-grid { display: block; position: relative; overflow: clip; }
|
|
200
|
+
.virtual-window { position: absolute; overflow: hidden; }
|
|
201
|
+
.virtual-pane { position: absolute; overflow: hidden; background: #fff; }
|
|
202
|
+
.virtual-pane > .cell, .virtual-pane > .sheet-image, .virtual-pane > .sheet-shape {
|
|
203
|
+
position: absolute; box-sizing: border-box;
|
|
204
|
+
}
|
|
205
|
+
.sheet-image { position: relative; z-index: 8; align-self: start; justify-self: start; pointer-events: none; overflow: hidden; }
|
|
206
|
+
.sheet-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
|
|
207
|
+
.sheet-image-cell { width: 100%; height: 100%; align-self: stretch; justify-self: stretch; padding: 2px; box-sizing: border-box; background: #fff; }
|
|
208
|
+
.sheet-shape {
|
|
209
|
+
position: relative;
|
|
210
|
+
z-index: 9;
|
|
211
|
+
box-sizing: border-box;
|
|
212
|
+
align-self: stretch;
|
|
213
|
+
justify-self: stretch;
|
|
214
|
+
min-width: 1px;
|
|
215
|
+
min-height: 1px;
|
|
216
|
+
padding: 4px 6px;
|
|
217
|
+
border: 1px solid transparent;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
align-items: center;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
pointer-events: none;
|
|
224
|
+
white-space: pre-wrap;
|
|
225
|
+
}
|
|
226
|
+
.sheet-shape-paragraph { width: 100%; text-align: center; line-height: 1.2; }
|
|
227
|
+
.sheet-shape-line { align-self: center; min-height: 0; height: 0 !important; padding: 0; border: 0; border-top: 1px solid #666; background: transparent !important; }
|
|
228
|
+
|
|
229
|
+
@media print { .grid-wrap { overflow: visible; } }
|
|
230
|
+
`;
|
|
231
|
+
function Tt(t) {
|
|
232
|
+
let e = t.highestRow, o = t.highestCol;
|
|
233
|
+
const n = (r, s) => {
|
|
234
|
+
if (!Number.isInteger(r) || r < 0 || r > 1048576 || !Number.isInteger(s) || s < 0 || s > 16384)
|
|
235
|
+
throw new Error("Worksheet dimensions exceed Excel limits");
|
|
236
|
+
e = Math.max(e, r), o = Math.max(o, s);
|
|
237
|
+
};
|
|
238
|
+
n(e, o);
|
|
239
|
+
for (const r of t.merges) {
|
|
240
|
+
const s = nt(r);
|
|
241
|
+
n(s.r2, s.c2);
|
|
242
|
+
}
|
|
243
|
+
for (const r of t.cells) n(r.row, r.col);
|
|
244
|
+
for (const r of [...t.images, ...t.shapes])
|
|
245
|
+
n(r.row, r.col), n(r.toRow ?? r.row, r.toCol ?? r.col);
|
|
246
|
+
return { rows: e, cols: o };
|
|
247
|
+
}
|
|
248
|
+
function nt(t) {
|
|
249
|
+
const e = (s) => {
|
|
250
|
+
const c = /^\$?([A-Z]+)\$?([1-9]\d*)$/i.exec(s);
|
|
251
|
+
if (!c) throw new Error(`Invalid cell range: ${t}`);
|
|
252
|
+
let a = 0;
|
|
253
|
+
for (const x of c[1].toUpperCase()) a = a * 26 + x.charCodeAt(0) - 64;
|
|
254
|
+
const d = Number(c[2]);
|
|
255
|
+
if (a > 16384 || d > 1048576) throw new Error(`Cell range exceeds Excel limits: ${t}`);
|
|
256
|
+
return { col: a, row: d };
|
|
257
|
+
}, o = t.split(":");
|
|
258
|
+
if (o.length > 2) throw new Error(`Invalid cell range: ${t}`);
|
|
259
|
+
const n = e(o[0]), r = e(o[1] ?? o[0]);
|
|
260
|
+
return { c1: Math.min(n.col, r.col), r1: Math.min(n.row, r.row), c2: Math.max(n.col, r.col), r2: Math.max(n.row, r.row) };
|
|
261
|
+
}
|
|
262
|
+
class st {
|
|
263
|
+
offsets;
|
|
264
|
+
count;
|
|
265
|
+
total;
|
|
266
|
+
constructor(e) {
|
|
267
|
+
this.count = e.length, this.offsets = new Float64Array(e.length + 1);
|
|
268
|
+
for (let o = 0; o < e.length; o++) {
|
|
269
|
+
if (!Number.isFinite(e[o])) throw new Error("Worksheet dimensions must be finite");
|
|
270
|
+
this.offsets[o + 1] = this.offsets[o] + Math.max(0, e[o]);
|
|
271
|
+
}
|
|
272
|
+
this.total = this.offsets[e.length];
|
|
273
|
+
}
|
|
274
|
+
start(e) {
|
|
275
|
+
return this.offsets[Math.max(0, Math.min(this.count, e - 1))];
|
|
276
|
+
}
|
|
277
|
+
end(e) {
|
|
278
|
+
return this.offsets[Math.max(0, Math.min(this.count, e))];
|
|
279
|
+
}
|
|
280
|
+
size(e) {
|
|
281
|
+
return this.end(e) - this.start(e);
|
|
282
|
+
}
|
|
283
|
+
at(e) {
|
|
284
|
+
if (this.count === 0) return 0;
|
|
285
|
+
let o = 0, n = this.count;
|
|
286
|
+
for (; o < n; ) {
|
|
287
|
+
const r = o + n >>> 1;
|
|
288
|
+
this.offsets[r + 1] <= e ? o = r + 1 : n = r;
|
|
289
|
+
}
|
|
290
|
+
return Math.min(this.count, o + 1);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
class tt {
|
|
294
|
+
entries;
|
|
295
|
+
maxEnd;
|
|
296
|
+
constructor(e) {
|
|
297
|
+
this.entries = [...e].sort((n, r) => n.r1 - r.r1);
|
|
298
|
+
let o = 0;
|
|
299
|
+
this.maxEnd = this.entries.map((n) => o = Math.max(o, n.r2));
|
|
300
|
+
}
|
|
301
|
+
intersect(e) {
|
|
302
|
+
let o = 0, n = this.entries.length;
|
|
303
|
+
for (; o < n; ) {
|
|
304
|
+
const s = o + n >>> 1;
|
|
305
|
+
this.entries[s].r1 <= e.r2 ? o = s + 1 : n = s;
|
|
306
|
+
}
|
|
307
|
+
const r = [];
|
|
308
|
+
for (let s = o - 1; s >= 0 && this.maxEnd[s] >= e.r1; s--) {
|
|
309
|
+
const c = this.entries[s];
|
|
310
|
+
c.r2 >= e.r1 && c.c1 <= e.c2 && c.c2 >= e.c1 && r.push(c);
|
|
311
|
+
}
|
|
312
|
+
return r;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function at(t, e, o, n = 1, r = 2) {
|
|
316
|
+
return o <= 0 || t.count < n || e >= t.total ? { first: 1, last: 0 } : {
|
|
317
|
+
first: Math.max(n, t.at(Math.max(0, e)) - r),
|
|
318
|
+
last: Math.min(t.count, t.at(Math.max(0, e + o - 1e-3)) + r)
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function gt(t, e, o) {
|
|
322
|
+
const n = "fitCell" in t && t.fitCell, r = e.start(t.col) + (n ? 0 : t.offsetXPx ?? 0), s = o.start(t.row) + (n ? 0 : t.offsetYPx ?? 0), c = t.toCol ? t.toOffsetXPx == null ? e.end(t.toCol) : e.start(t.toCol) + t.toOffsetXPx : void 0, a = t.toRow ? t.toOffsetYPx == null ? o.end(t.toRow) : o.start(t.toRow) + t.toOffsetYPx : void 0, d = n ? e.size(t.col) : c != null ? c - r : t.widthPx ?? e.size(t.col), x = n ? o.size(t.row) : a != null ? a - s : t.heightPx ?? o.size(t.row);
|
|
323
|
+
return { x: r, y: s, width: Math.max(0, d), height: Math.max(0, x) };
|
|
324
|
+
}
|
|
325
|
+
function kt(t, e = 0) {
|
|
326
|
+
if (!Number.isFinite(e) || e % 360 === 0) return t;
|
|
327
|
+
const o = e * Math.PI / 180, n = Math.abs(t.width * Math.cos(o)) + Math.abs(t.height * Math.sin(o)), r = Math.abs(t.width * Math.sin(o)) + Math.abs(t.height * Math.cos(o));
|
|
328
|
+
return { x: t.x + (t.width - n) / 2, y: t.y + (t.height - r) / 2, width: n, height: r };
|
|
329
|
+
}
|
|
330
|
+
const Rt = 1e4, lt = 2e4;
|
|
331
|
+
function et(t, e, o) {
|
|
332
|
+
if (!Number.isInteger(t.highestRow) || t.highestRow < 0 || t.highestRow > 1048576 || !Number.isInteger(t.highestCol) || t.highestCol < 0 || t.highestCol > 16384)
|
|
333
|
+
throw new Error("Worksheet dimensions exceed Excel limits");
|
|
334
|
+
const n = new Float64Array(t.highestCol).fill(t.defaultColWidth && t.defaultColWidth > 0 ? Math.round(t.defaultColWidth * 7 + 5) : 96), r = new Float64Array(t.highestRow).fill(t.defaultRowHeight && t.defaultRowHeight > 0 ? Math.round(t.defaultRowHeight * 96 / 72) : 26), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
335
|
+
for (const i of t.colWidths) i.col >= 1 && i.col <= n.length && i.width > 0 && (n[i.col - 1] = Math.max(1, Math.round(i.width * 7 + 5)), s.add(i.col));
|
|
336
|
+
for (const i of t.rowHeights) i.row >= 1 && i.row <= r.length && i.height > 0 && (r[i.row - 1] = Math.max(1, Math.round(i.height * 96 / 72)), i.customHeight !== !1 && c.add(i.row));
|
|
337
|
+
for (const i of t.colWidths) i.hidden && i.col >= 1 && i.col <= n.length && (n[i.col - 1] = 0, s.add(i.col));
|
|
338
|
+
for (const i of t.rowHeights) i.hidden && i.row >= 1 && i.row <= r.length && (r[i.row - 1] = 0, c.add(i.row));
|
|
339
|
+
const a = t.merges.map(nt), d = new Map(a.map((i) => [`${i.c1}:${i.r1}`, i])), x = new Map(t.cells.map((i) => [`${i.col}:${i.row}`, i])), v = (i) => n[i.col - 1] > 0 && r[i.row - 1] > 0, N = new Set(t.cells.filter((i) => i.wrapText && v(i)).map((i) => i.col)), p = e.createElement("canvas").getContext("2d"), $ = (i, f) => {
|
|
340
|
+
const w = (f?.fontSize ?? i.fontSize ?? 10.5) * 96 / 72, l = f?.fontName ?? i.fontName;
|
|
341
|
+
return p && (p.font = `${f?.italic ?? i.italic ? "italic " : ""}${f?.bold ?? i.bold ? "bold " : ""}${w}px ${ot(l, o)}`), w;
|
|
342
|
+
}, C = (i) => i.richText?.length ? i.richText : [{ text: mt(i.value, i.numfmt, i.valueType, i.date1904 ?? t.date1904) }], S = (i, f) => p?.measureText(i).width ?? i.length * f;
|
|
343
|
+
for (const i of t.cells) {
|
|
344
|
+
if (!v(i) || i.col < 1 || i.col > n.length || s.has(i.col) || N.has(i.col) || d.has(`${i.col}:${i.row}`)) continue;
|
|
345
|
+
let f = 0;
|
|
346
|
+
for (const w of C(i)) f += S(w.text.replace(/\s+/g, " "), $(i, w));
|
|
347
|
+
n[i.col - 1] = Math.max(n[i.col - 1], Math.ceil(f + 17));
|
|
348
|
+
}
|
|
349
|
+
const u = new st(n);
|
|
350
|
+
for (const i of t.cells) {
|
|
351
|
+
if (!v(i) || i.row < 1 || i.row > r.length || c.has(i.row)) continue;
|
|
352
|
+
const f = d.get(`${i.col}:${i.row}`);
|
|
353
|
+
if (f && f.r2 > f.r1) continue;
|
|
354
|
+
const w = Math.max(1, u.end(f?.c2 ?? i.col) - u.start(i.col) - 17);
|
|
355
|
+
let l = 1, T = 0, m = 14;
|
|
356
|
+
for (const g of C(i)) {
|
|
357
|
+
const b = $(i, g);
|
|
358
|
+
if (m = Math.max(m, b), !i.wrapText) continue;
|
|
359
|
+
const W = g.text.match(/\r\n|[\r\n]|[\u2e80-\u9fff]|[^\s\u2e80-\u9fff]+|[^\S\r\n]+/g) ?? [];
|
|
360
|
+
for (const P of W) {
|
|
361
|
+
if (/^[\r\n]+$/.test(P)) {
|
|
362
|
+
l++, T = 0;
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const F = /^\s+$/.test(P), U = S(F ? " " : P, b);
|
|
366
|
+
!F && T > 0 && T + U > w && (l++, T = 0), (!F || T > 0) && (T += U);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
r[i.row - 1] = Math.max(r[i.row - 1], Math.ceil(l * m * pt + 7));
|
|
370
|
+
}
|
|
371
|
+
const A = new st(r), h = (i, f) => {
|
|
372
|
+
const { x: w, y: l, width: T, height: m } = gt(i, u, A), g = "data" in i ? kt({ x: w, y: l, width: T, height: m }, i.rotation) : { x: w, y: l, width: T, height: m };
|
|
373
|
+
return {
|
|
374
|
+
key: f,
|
|
375
|
+
x: w,
|
|
376
|
+
y: l,
|
|
377
|
+
width: T,
|
|
378
|
+
height: m,
|
|
379
|
+
c1: g.x,
|
|
380
|
+
r1: g.y,
|
|
381
|
+
c2: g.x + g.width - 1e-3,
|
|
382
|
+
r2: g.y + g.height - 1e-3,
|
|
383
|
+
..."data" in i ? { image: i } : { shape: i }
|
|
384
|
+
};
|
|
385
|
+
}, M = [
|
|
386
|
+
...t.images.map((i, f) => h(i, `image:${f}`)),
|
|
387
|
+
...t.shapes.map((i, f) => h(i, `shape:${f}`))
|
|
388
|
+
];
|
|
389
|
+
let y = u.total, z = A.total;
|
|
390
|
+
for (const i of M)
|
|
391
|
+
y = Math.max(y, i.c2 + 1e-3), z = Math.max(z, i.r2 + 1e-3);
|
|
392
|
+
return { columns: u, rows: A, width: y, height: z, cells: x, merges: new tt(a), overlays: new tt(M) };
|
|
393
|
+
}
|
|
394
|
+
function Nt(t, e, o, n, r, s, c, a) {
|
|
395
|
+
n.classList.add("virtual-grid"), e.dataset.virtual = "true";
|
|
396
|
+
const d = e.ownerDocument, x = d.defaultView, v = d.createElement("div");
|
|
397
|
+
v.className = "virtual-window", n.append(v);
|
|
398
|
+
const N = [[!1, !1], [!0, !1], [!1, !0], [!0, !0]].map(([f, w]) => {
|
|
399
|
+
const l = d.createElement("div");
|
|
400
|
+
return l.className = "virtual-pane", v.append(l), { element: l, nodes: /* @__PURE__ */ new Map(), frozenX: f, frozenY: w };
|
|
401
|
+
});
|
|
402
|
+
let p = !1, $ = !1, C, S = !1, u = r.layout, A = 0, h = 0;
|
|
403
|
+
const M = () => {
|
|
404
|
+
if (C = void 0, p || o.clientWidth <= 0 || o.clientHeight <= 0) return;
|
|
405
|
+
u || (u = et(t, d, x.getComputedStyle(e).fontFamily || "sans-serif"), r.layout = u);
|
|
406
|
+
const { columns: f, rows: w, cells: l, merges: T, overlays: m } = u;
|
|
407
|
+
n.style.width = `${u.width}px`, n.style.height = `${u.height}px`;
|
|
408
|
+
const g = Number.parseFloat(x.getComputedStyle(n).zoom) || 1, b = o.clientWidth / g, W = o.clientHeight / g;
|
|
409
|
+
A = o.clientWidth, h = o.clientHeight;
|
|
410
|
+
const P = o.scrollLeft / g, F = o.scrollTop / g;
|
|
411
|
+
v.style.left = `${P}px`, v.style.top = `${F}px`, v.style.width = `${b}px`, v.style.height = `${W}px`;
|
|
412
|
+
const U = Math.max(0, Math.min(f.count, t.frozenColumns)), V = Math.max(0, Math.min(w.count, t.frozenRows)), j = Math.min(b, f.end(U)), J = Math.min(W, w.end(V));
|
|
413
|
+
let xt = 0;
|
|
414
|
+
for (const R of N) {
|
|
415
|
+
const yt = R.frozenX ? 0 : j, bt = R.frozenY ? 0 : J, X = R.frozenX ? j : b - j, B = R.frozenY ? J : W - J;
|
|
416
|
+
R.element.style.left = `${yt}px`, R.element.style.top = `${bt}px`, R.element.style.width = `${X}px`, R.element.style.height = `${B}px`;
|
|
417
|
+
const Z = R.frozenX ? 0 : P + j, K = R.frozenY ? 0 : F + J, _ = at(f, Z, X, R.frozenX ? 1 : U + 1), H = at(w, K, B, R.frozenY ? 1 : V + 1);
|
|
418
|
+
R.frozenX && (_.last = Math.min(_.last, U)), R.frozenY && (H.last = Math.min(H.last, V));
|
|
419
|
+
const it = /* @__PURE__ */ new Set(), Q = (k, O, G, L, D, I) => {
|
|
420
|
+
if (D <= 0 || I <= 0) return;
|
|
421
|
+
if (++xt > lt) throw new Error(`Worksheet viewport exceeds the preview limit of ${lt} visible cells and drawings`);
|
|
422
|
+
it.add(k);
|
|
423
|
+
let E = R.nodes.get(k);
|
|
424
|
+
E || (E = O(), E.classList.contains("cell") && (E.classList.toggle("frozen-column", R.frozenX), E.classList.toggle("frozen-row", R.frozenY), E.classList.toggle("frozen-corner", R.frozenX && R.frozenY)), R.nodes.set(k, E), R.element.append(E)), E.style.left = `${G - Z}px`, E.style.top = `${L - K}px`, E.style.width = `${D}px`, E.style.height = `${I}px`;
|
|
425
|
+
};
|
|
426
|
+
if (X > 0 && B > 0 && _.last >= _.first && H.last >= H.first) {
|
|
427
|
+
const k = { c1: _.first, c2: _.last, r1: H.first, r2: H.last }, O = T.intersect(k), G = /* @__PURE__ */ new Map();
|
|
428
|
+
for (const L of O) {
|
|
429
|
+
for (let D = Math.max(H.first, L.r1); D <= Math.min(H.last, L.r2); D++) {
|
|
430
|
+
if (w.size(D) === 0) {
|
|
431
|
+
D = Math.max(D, w.at(w.start(D)) - 1);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const I = G.get(D) ?? [];
|
|
435
|
+
I.push(L), G.set(D, I);
|
|
436
|
+
}
|
|
437
|
+
Q(
|
|
438
|
+
`merge:${L.c1}:${L.r1}`,
|
|
439
|
+
() => s.cell(l.get(`${L.c1}:${L.r1}`), L.r1, L.c1),
|
|
440
|
+
f.start(L.c1),
|
|
441
|
+
w.start(L.r1),
|
|
442
|
+
f.end(L.c2) - f.start(L.c1),
|
|
443
|
+
w.end(L.r2) - w.start(L.r1)
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
for (let L = H.first; L <= H.last; L++) {
|
|
447
|
+
if (w.size(L) === 0) {
|
|
448
|
+
L = Math.max(L, w.at(w.start(L)) - 1);
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
const D = (G.get(L) ?? []).sort((E, Ct) => E.c1 - Ct.c1);
|
|
452
|
+
let I = 0;
|
|
453
|
+
for (let E = _.first; E <= _.last; E++) {
|
|
454
|
+
if (f.size(E) === 0) {
|
|
455
|
+
E = Math.max(E, f.at(f.start(E)) - 1);
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
for (; I < D.length && D[I].c2 < E; ) I++;
|
|
459
|
+
if (D[I]?.c1 <= E) {
|
|
460
|
+
E = D[I].c2;
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
Q(`cell:${E}:${L}`, () => s.cell(l.get(`${E}:${L}`), L, E), f.start(E), w.start(L), f.size(E), w.size(L));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (X > 0 && B > 0)
|
|
468
|
+
for (const k of m.intersect({ c1: Z, r1: K, c2: Z + X - 1e-3, r2: K + B - 1e-3 }))
|
|
469
|
+
Q(k.key, () => {
|
|
470
|
+
const O = k.image ? s.image(k.image) : s.shape(k.shape);
|
|
471
|
+
return k.shape && (O.style.transform = `${k.shape.rotation ? `rotate(${k.shape.rotation}deg)` : ""} scale(${k.shape.flipH ? -1 : 1}, ${k.shape.flipV ? -1 : 1})`), O;
|
|
472
|
+
}, k.x, k.shape?.geometry === "line" || k.shape?.geometry === "lineInv" ? k.y + k.height / 2 : k.y, k.width, k.height);
|
|
473
|
+
for (const [k, O] of R.nodes) it.has(k) || (O.remove(), R.nodes.delete(k));
|
|
474
|
+
}
|
|
475
|
+
S && (S = !1, a?.());
|
|
476
|
+
}, y = () => {
|
|
477
|
+
!p && !$ && C === void 0 && (C = x.requestAnimationFrame(() => {
|
|
478
|
+
try {
|
|
479
|
+
M();
|
|
480
|
+
} catch (f) {
|
|
481
|
+
if ($ = !0, c) c(f instanceof Error ? f : new Error(String(f)));
|
|
482
|
+
else throw f;
|
|
483
|
+
}
|
|
484
|
+
}));
|
|
485
|
+
};
|
|
486
|
+
o.addEventListener("scroll", y, { passive: !0 });
|
|
487
|
+
const z = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(() => {
|
|
488
|
+
(o.clientWidth !== A || o.clientHeight !== h) && y();
|
|
489
|
+
});
|
|
490
|
+
z?.observe(o);
|
|
491
|
+
const i = () => {
|
|
492
|
+
u = void 0, r.layout = void 0, S = !0, y();
|
|
493
|
+
};
|
|
494
|
+
return d.fonts?.addEventListener("loadingdone", i), {
|
|
495
|
+
element: e,
|
|
496
|
+
viewport: o,
|
|
497
|
+
resize() {
|
|
498
|
+
!u && !p && (u = et(t, d, x.getComputedStyle(e).fontFamily || "sans-serif"), r.layout = u), u && (n.style.width = `${u.width}px`, n.style.height = `${u.height}px`), C !== void 0 && (x.cancelAnimationFrame(C), C = void 0), M();
|
|
499
|
+
},
|
|
500
|
+
getContentWidth() {
|
|
501
|
+
return (u?.width ?? 0) + 1;
|
|
502
|
+
},
|
|
503
|
+
dispose() {
|
|
504
|
+
p = !0, C !== void 0 && x.cancelAnimationFrame(C), z?.disconnect(), o.removeEventListener("scroll", y), d.fonts?.removeEventListener("loadingdone", i);
|
|
505
|
+
for (const f of N) f.nodes.clear();
|
|
506
|
+
e.remove();
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
const Y = {
|
|
511
|
+
thin: "1px solid #9aa3ab",
|
|
512
|
+
medium: "2px solid #666",
|
|
513
|
+
thick: "3px solid #444",
|
|
514
|
+
hair: "1px solid #d0d7de",
|
|
515
|
+
dashed: "1px dashed #888",
|
|
516
|
+
dotted: "1px dotted #888",
|
|
517
|
+
double: "3px double #888"
|
|
518
|
+
}, At = { Center: "center", Right: "end", Left: "start" };
|
|
519
|
+
function Pt(t, e, o, n) {
|
|
520
|
+
const r = new Map(e.sheets.flatMap((m, g) => (m.state ?? "visible").toLowerCase() === "visible" ? [[g, m]] : [])), s = r.has(e.activeTab ?? 0) ? e.activeTab ?? 0 : r.keys().next().value ?? -1, c = t.shadowRoot ?? t.attachShadow({ mode: "open" });
|
|
521
|
+
c.replaceChildren();
|
|
522
|
+
const a = document.createElement("style");
|
|
523
|
+
a.textContent = Et, c.appendChild(a);
|
|
524
|
+
const d = document.createElement("div");
|
|
525
|
+
d.className = "workbook", c.appendChild(d);
|
|
526
|
+
const x = document.createElement("div");
|
|
527
|
+
x.className = "sheet-tabs", x.setAttribute("role", "tablist");
|
|
528
|
+
const v = document.createElement("div");
|
|
529
|
+
v.className = "sheet-pages", d.append(x, v);
|
|
530
|
+
let N = 0, p = 0, $ = 0, C = 0, S = 0;
|
|
531
|
+
const u = [], A = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
532
|
+
let M = -1, y, z = !1, i = 1;
|
|
533
|
+
const f = () => {
|
|
534
|
+
const m = t.ownerDocument.defaultView.getComputedStyle(t), g = Number.parseFloat(m.getPropertyValue("--office-viewer-viewport-height")), b = Number.isFinite(g) && g > 0;
|
|
535
|
+
d.classList.toggle("workbook--bounded", b), b ? d.style.setProperty("--office-excel-workbook-height", `${g}px`) : d.style.removeProperty("--office-excel-workbook-height");
|
|
536
|
+
}, w = (m) => {
|
|
537
|
+
const g = r.get(m);
|
|
538
|
+
if (z || m === M || !g) return;
|
|
539
|
+
const b = y;
|
|
540
|
+
y && A.set(M, { top: y.viewport.scrollTop / i, left: y.viewport.scrollLeft / i });
|
|
541
|
+
const W = h.get(m) ?? {};
|
|
542
|
+
h.set(m, W);
|
|
543
|
+
let P;
|
|
544
|
+
try {
|
|
545
|
+
P = Ft({ ...g, date1904: e.date1904 ?? g.date1904 }, W, o, n), P.element.dataset.sheetIndex = String(m), v.replaceChildren(P.element), f(), P.resize();
|
|
546
|
+
const F = A.get(m);
|
|
547
|
+
F && (P.viewport.scrollTop = F.top * i, P.viewport.scrollLeft = F.left * i, P.resize());
|
|
548
|
+
} catch (F) {
|
|
549
|
+
throw P?.dispose(), b && v.replaceChildren(b.element), F;
|
|
550
|
+
}
|
|
551
|
+
b?.dispose(), y = P, M = m, u.forEach((F) => F.setAttribute("aria-selected", String(Number(F.dataset.sheetIndex) === m))), b && n?.();
|
|
552
|
+
};
|
|
553
|
+
r.forEach((m, g) => {
|
|
554
|
+
const b = document.createElement("button");
|
|
555
|
+
b.type = "button", b.className = "sheet-tab", b.textContent = m.name, b.dataset.sheetIndex = String(g), b.setAttribute("role", "tab"), b.setAttribute("aria-selected", String(g === s)), u.push(b), x.appendChild(b), N += m.highestRow, p += m.highestCol, $ += m.merges.length, C += m.images.length, S += m.shapes.length;
|
|
556
|
+
});
|
|
557
|
+
const l = (m) => {
|
|
558
|
+
const g = m.target.closest(".sheet-tab");
|
|
559
|
+
if (g)
|
|
560
|
+
try {
|
|
561
|
+
w(Number(g.dataset.sheetIndex));
|
|
562
|
+
} catch (b) {
|
|
563
|
+
if (o) o(b instanceof Error ? b : new Error(String(b)));
|
|
564
|
+
else throw b;
|
|
565
|
+
}
|
|
566
|
+
}, T = () => {
|
|
567
|
+
for (const m of h.values()) m.layout = void 0;
|
|
568
|
+
};
|
|
569
|
+
x.addEventListener("click", l), t.ownerDocument.fonts?.addEventListener("loadingdone", T);
|
|
570
|
+
try {
|
|
571
|
+
w(s);
|
|
572
|
+
} catch (m) {
|
|
573
|
+
throw x.removeEventListener("click", l), t.ownerDocument.fonts?.removeEventListener("loadingdone", T), d.remove(), a.remove(), m;
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
stats: { sheets: r.size, rows: N, cols: p, merges: $, images: C, shapes: S },
|
|
577
|
+
resize() {
|
|
578
|
+
z || (f(), y?.resize());
|
|
579
|
+
},
|
|
580
|
+
setZoom(m) {
|
|
581
|
+
if (z || m === i) return;
|
|
582
|
+
const g = (y?.viewport.scrollTop ?? 0) / i, b = (y?.viewport.scrollLeft ?? 0) / i;
|
|
583
|
+
i = m, d.style.setProperty("--office-excel-scale", String(m)), y && (y.viewport.scrollTop = g * m, y.viewport.scrollLeft = b * m);
|
|
584
|
+
},
|
|
585
|
+
getContentWidth() {
|
|
586
|
+
return z ? 0 : y?.getContentWidth() ?? 0;
|
|
587
|
+
},
|
|
588
|
+
dispose() {
|
|
589
|
+
z = !0, y?.dispose(), y = void 0, x.removeEventListener("click", l), t.ownerDocument.fonts?.removeEventListener("loadingdone", T), h.clear(), A.clear(), d.remove(), a.remove();
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function Ft(t, e, o, n) {
|
|
594
|
+
const r = Tt(t);
|
|
595
|
+
t = { ...t, highestRow: r.rows, highestCol: r.cols };
|
|
596
|
+
const s = document.createElement("section");
|
|
597
|
+
s.className = "sheet";
|
|
598
|
+
const c = document.createElement("div");
|
|
599
|
+
c.className = "grid-wrap";
|
|
600
|
+
const a = document.createElement("div");
|
|
601
|
+
a.className = "grid", a.classList.toggle("grid--no-lines", t.showGridLines === !1), c.appendChild(a), s.appendChild(c);
|
|
602
|
+
const d = (N, p, $) => Dt(N, p, $, t.date1904);
|
|
603
|
+
if (r.rows * r.cols > Rt)
|
|
604
|
+
return Nt(t, s, c, a, e, { cell: d, image: ct, shape: dt }, o, n);
|
|
605
|
+
const x = () => {
|
|
606
|
+
const N = et(t, s.ownerDocument, s.ownerDocument.defaultView.getComputedStyle(s).fontFamily || "sans-serif"), { columns: p, rows: $ } = N;
|
|
607
|
+
a.replaceChildren(), a.style.gridTemplateColumns = Array.from({ length: p.count }, (h, M) => `${p.size(M + 1)}px`).join(" "), a.style.gridTemplateRows = Array.from({ length: $.count }, (h, M) => `${$.size(M + 1)}px`).join(" "), a.style.width = `${N.width}px`, a.style.height = `${N.height}px`;
|
|
608
|
+
const C = t.merges.map(nt), S = new tt(C), u = new Map(C.map((h) => [`${h.c1}:${h.r1}`, h])), A = new Map(t.cells.map((h) => [`${h.col}:${h.row}`, h]));
|
|
609
|
+
for (let h = 1; h <= t.highestRow; h++) {
|
|
610
|
+
const M = S.intersect({ c1: 1, c2: t.highestCol, r1: h, r2: h }).sort((z, i) => z.c1 - i.c1);
|
|
611
|
+
let y = 0;
|
|
612
|
+
for (let z = 1; z <= t.highestCol; z++) {
|
|
613
|
+
for (; y < M.length && M[y].c2 < z; ) y++;
|
|
614
|
+
const i = M[y];
|
|
615
|
+
if (i?.c1 <= z && !(h === i.r1 && z === i.c1)) {
|
|
616
|
+
z = i.c2;
|
|
617
|
+
continue;
|
|
618
|
+
}
|
|
619
|
+
const f = `${z}:${h}`, w = u.get(f);
|
|
620
|
+
if (p.end(w?.c2 ?? z) <= p.start(z) || $.end(w?.r2 ?? h) <= $.start(h)) continue;
|
|
621
|
+
const l = d(A.get(f), h, z);
|
|
622
|
+
l.style.gridColumn = w ? `${z} / span ${w.c2 - z + 1}` : `${z}`, l.style.gridRow = w ? `${h} / span ${w.r2 - h + 1}` : `${h}`, h <= t.frozenRows && (l.classList.add("frozen-row"), l.style.top = `${$.start(h)}px`), z <= t.frozenColumns && (l.classList.add("frozen-column"), l.style.left = `${p.start(z)}px`), h <= t.frozenRows && z <= t.frozenColumns && l.classList.add("frozen-corner"), a.appendChild(l);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
for (const h of [...t.images, ...t.shapes]) {
|
|
626
|
+
const M = gt(h, p, $);
|
|
627
|
+
if (M.width <= 0 || M.height <= 0) continue;
|
|
628
|
+
const y = "data" in h ? ct(h) : dt(h);
|
|
629
|
+
y.style.position = "absolute", y.style.left = `${M.x}px`, y.style.top = `${!("data" in h) && (h.geometry === "line" || h.geometry === "lineInv") ? M.y + M.height / 2 : M.y}px`, y.style.width = `${M.width}px`, y.style.height = `${M.height}px`, "data" in h || (y.style.transform = ut(h)), a.appendChild(y);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
x();
|
|
633
|
+
const v = () => {
|
|
634
|
+
x(), n?.();
|
|
635
|
+
};
|
|
636
|
+
return s.ownerDocument.fonts?.addEventListener("loadingdone", v), {
|
|
637
|
+
element: s,
|
|
638
|
+
viewport: c,
|
|
639
|
+
resize() {
|
|
640
|
+
},
|
|
641
|
+
getContentWidth: () => a.scrollWidth + 2,
|
|
642
|
+
dispose() {
|
|
643
|
+
s.ownerDocument.fonts?.removeEventListener("loadingdone", v), s.remove();
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function Dt(t, e, o, n) {
|
|
648
|
+
const r = document.createElement("div");
|
|
649
|
+
r.className = "cell", r.dataset.row = String(e), r.dataset.col = String(o);
|
|
650
|
+
const s = document.createElement("div");
|
|
651
|
+
return s.className = "cell-content", t?.richText?.length ? wt(s, t.richText.map((c) => ({ ...c, underline: c.underline ?? t.underline }))) : s.textContent = t ? mt(t.value, t.numfmt, t.valueType, t.date1904 ?? n) : "", r.appendChild(s), t?.formula && t.cachedValuePresent === !1 && (r.dataset.missingFormulaCache = "true", r.title = "此公式没有保存计算结果"), t && (Wt(r, t), t.wrapText && (r.style.whiteSpace = "pre-wrap")), r;
|
|
652
|
+
}
|
|
653
|
+
function ct(t) {
|
|
654
|
+
const e = document.createElement("div");
|
|
655
|
+
e.className = t.fitCell ? "sheet-image sheet-image-cell" : "sheet-image", e.style.transform = ut(t), !t.fitCell && !t.toCol && t.widthPx && (e.style.width = `${t.widthPx}px`), !t.fitCell && !t.toRow && t.heightPx && (e.style.height = `${t.heightPx}px`);
|
|
656
|
+
const o = document.createElement("img");
|
|
657
|
+
if (o.src = t.data, o.alt = t.name, o.draggable = !1, o.style.objectFit = t.fitCell ? "contain" : "fill", t.crop) {
|
|
658
|
+
const { left: n, top: r, right: s, bottom: c } = t.crop, a = 1 - n - s, d = 1 - r - c;
|
|
659
|
+
![n, r, s, c, 100 / a, 100 / d].every(Number.isFinite) || a <= 0 || d <= 0 ? (e.dataset.invalidCrop = "true", o.style.display = "none") : (o.style.position = "absolute", o.style.objectFit = "fill", o.style.width = `${100 / a}%`, o.style.height = `${100 / d}%`, o.style.left = `${-n * 100 / a}%`, o.style.top = `${-r * 100 / d}%`);
|
|
660
|
+
}
|
|
661
|
+
return e.appendChild(o), e;
|
|
662
|
+
}
|
|
663
|
+
function ut(t) {
|
|
664
|
+
return `${t.rotation ? `rotate(${t.rotation}deg)` : ""} scale(${t.flipH ? -1 : 1}, ${t.flipV ? -1 : 1})`;
|
|
665
|
+
}
|
|
666
|
+
function dt(t) {
|
|
667
|
+
const e = document.createElement("div");
|
|
668
|
+
e.className = "sheet-shape", e.dataset.geometry = t.geometry, e.setAttribute("aria-label", t.name || "形状"), !t.toCol && t.widthPx && (e.style.width = `${t.widthPx}px`), !t.toRow && t.heightPx && (e.style.height = `${t.heightPx}px`), (t.offsetXPx || t.offsetYPx) && (e.style.transform = `translate(${t.offsetXPx}px, ${t.offsetYPx}px)`), t.fill && (e.style.backgroundColor = t.fill), (t.lineColor || t.lineWidthPx) && (e.style.borderColor = t.lineColor ?? "#666", e.style.borderWidth = `${Math.max(0, t.lineWidthPx ?? 1)}px`), Ut(e, t.geometry);
|
|
669
|
+
for (const o of t.paragraphs) {
|
|
670
|
+
const n = document.createElement("div");
|
|
671
|
+
n.className = "sheet-shape-paragraph", wt(n, o.runs), e.appendChild(n);
|
|
672
|
+
}
|
|
673
|
+
return e;
|
|
674
|
+
}
|
|
675
|
+
function Ut(t, e) {
|
|
676
|
+
const o = {
|
|
677
|
+
diamond: "polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",
|
|
678
|
+
triangle: "polygon(50% 0, 100% 100%, 0 100%)",
|
|
679
|
+
rtTriangle: "polygon(0 0, 100% 100%, 0 100%)",
|
|
680
|
+
pentagon: "polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%)",
|
|
681
|
+
hexagon: "polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%)",
|
|
682
|
+
rightArrow: "polygon(0 25%, 65% 25%, 65% 0, 100% 50%, 65% 100%, 65% 75%, 0 75%)",
|
|
683
|
+
leftArrow: "polygon(35% 0, 35% 25%, 100% 25%, 100% 75%, 35% 75%, 35% 100%, 0 50%)",
|
|
684
|
+
upArrow: "polygon(50% 0, 100% 35%, 75% 35%, 75% 100%, 25% 100%, 25% 35%, 0 35%)",
|
|
685
|
+
downArrow: "polygon(25% 0, 75% 0, 75% 65%, 100% 65%, 50% 100%, 0 65%, 25% 65%)",
|
|
686
|
+
chevron: "polygon(0 0, 75% 0, 100% 50%, 75% 100%, 0 100%, 25% 50%)",
|
|
687
|
+
parallelogram: "polygon(25% 0, 100% 0, 75% 100%, 0 100%)",
|
|
688
|
+
trapezoid: "polygon(20% 0, 80% 0, 100% 100%, 0 100%)"
|
|
689
|
+
};
|
|
690
|
+
e === "ellipse" ? t.style.borderRadius = "50%" : e === "roundRect" || e.startsWith("round") ? t.style.borderRadius = "8px" : o[e] ? t.style.clipPath = o[e] : (e === "line" || e === "lineInv") && t.classList.add("sheet-shape-line");
|
|
691
|
+
}
|
|
692
|
+
function wt(t, e) {
|
|
693
|
+
for (const o of e) {
|
|
694
|
+
const n = document.createElement("span");
|
|
695
|
+
n.textContent = o.text, o.fontName && (n.style.fontFamily = ot(o.fontName, "sans-serif")), o.fontSize && (n.style.fontSize = `${o.fontSize}pt`), o.bold != null && (n.style.fontWeight = o.bold ? "700" : "400"), o.italic != null && (n.style.fontStyle = o.italic ? "italic" : "normal"), o.underline != null && (n.style.textDecoration = o.underline ? "underline" : "none"), o.fontColor && (n.style.color = o.fontColor), t.appendChild(n);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function Wt(t, e) {
|
|
699
|
+
e.fontName && (t.style.fontFamily = ot(e.fontName, "sans-serif")), e.fontSize && (t.style.fontSize = `${e.fontSize}pt`), e.bold && (t.style.fontWeight = "700"), e.italic && (t.style.fontStyle = "italic"), e.underline && !e.richText?.length && (t.style.textDecoration = "underline"), e.fontColor && (t.style.color = e.fontColor), e.fill && (t.style.background = e.fill);
|
|
700
|
+
const o = e.hAlign ? At[e.hAlign] : void 0;
|
|
701
|
+
t.style.textAlign = o ?? (e.valueType === "number" || e.valueType === "date" ? "end" : e.valueType === "boolean" || e.valueType === "error" ? "center" : "start"), t.style.justifyContent = e.vAlign === "Top" ? "flex-start" : e.vAlign === "Center" ? "center" : "flex-end", (e.hAlign === "Justify" || e.hAlign === "Distributed") && (t.style.textAlign = "justify");
|
|
702
|
+
const n = Mt(e.value, e.numfmt, e.valueType);
|
|
703
|
+
n && (t.style.color = n), e.borderTop && (t.style.borderTop = Y[e.borderTop] ?? Y.thin), e.borderLeft && (t.style.borderLeft = Y[e.borderLeft] ?? Y.thin), e.borderRight && (t.style.borderRight = Y[e.borderRight] ?? Y.thin), e.borderBottom && (t.style.borderBottom = Y[e.borderBottom] ?? Y.thin), e.borderTopColor && (t.style.borderTopColor = e.borderTopColor), e.borderLeftColor && (t.style.borderLeftColor = e.borderLeftColor), e.borderRightColor && (t.style.borderRightColor = e.borderRightColor), e.borderBottomColor && (t.style.borderBottomColor = e.borderBottomColor);
|
|
704
|
+
}
|
|
705
|
+
function Ht(t = {}) {
|
|
706
|
+
const e = new URL("" + new URL("assets/excel/worker.js?no-inline", import.meta.url).href, import.meta.url), o = new URL("" + new URL("assets/excel/excel_view_rs_bg.wasm?no-inline", import.meta.url).href, import.meta.url), n = t.assets?.baseUrl ? new URL(String(t.assets.baseUrl), document.baseURI) : void 0;
|
|
707
|
+
n && !n.pathname.endsWith("/") && (n.pathname += "/");
|
|
708
|
+
const r = (d, x, v) => d ? new URL(d, document.baseURI) : n ? new URL(x, n) : v, s = r(t.assets?.excel?.workerUrl, "excel/worker.js", e), c = r(t.assets?.excel?.wasmUrl, "excel/excel_view_rs_bg.wasm", o).href, a = vt({
|
|
709
|
+
format: "xlsx",
|
|
710
|
+
formats: ["xlsx", "xlsm"],
|
|
711
|
+
workerData: { wasmUrl: c },
|
|
712
|
+
createWorker: () => t.workerFactory ? t.workerFactory(s, { type: "module" }) : new Worker(s, { type: "module" })
|
|
713
|
+
});
|
|
714
|
+
return {
|
|
715
|
+
async open(d) {
|
|
716
|
+
const x = await a.open(d);
|
|
717
|
+
return {
|
|
718
|
+
format: d.format ?? "xlsx",
|
|
719
|
+
durationMs: x.durationMs,
|
|
720
|
+
stats: { sheets: x.document.sheets.length },
|
|
721
|
+
itemCount: x.document.sheets.length,
|
|
722
|
+
warnings: x.warnings,
|
|
723
|
+
document: x.document
|
|
724
|
+
};
|
|
725
|
+
},
|
|
726
|
+
render(d, x, v, N) {
|
|
727
|
+
const p = Pt(d, x, v ? ($) => {
|
|
728
|
+
v($t("RENDER_FAILED", $.message));
|
|
729
|
+
} : void 0, N);
|
|
730
|
+
return { ...p, stats: { ...p.stats } };
|
|
731
|
+
},
|
|
732
|
+
destroy: a.destroy
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
export {
|
|
736
|
+
Ht as createExcelAdapter
|
|
737
|
+
};
|