@work-zhanguo/light-file-preview 0.0.11 → 0.0.13
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 +119 -91
- package/dist/SheetRenderer-Dr5f9ZTy.js +918 -0
- package/dist/{UnsupportedRenderer-vjWyKDpT.js → UnsupportedRenderer-Z8yR4DCm.js} +1 -1
- package/dist/index-CB4lf4Rv.js +346 -0
- package/dist/light-file-preview.js +1 -1
- package/dist/light-file-preview.umd.cjs +66 -66
- package/dist/standalone/light-file-preview.iife.js +50 -50
- package/dist/standalone/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/vue2/{DocxRenderer-Z4HX5Nb8.js → DocxRenderer-DGXNIVsp.js} +1 -1
- package/dist/vue2/{PdfRenderer-qVQzlsuJ.js → PdfRenderer-CANDrYvV.js} +1 -1
- package/dist/vue2/SheetRenderer-CM49qq4y.js +918 -0
- package/dist/vue2/{TextRenderer-CCh9A3GD.js → TextRenderer-CFNsDxIx.js} +1 -1
- package/dist/vue2/{UnsupportedRenderer-Bv7s0246.js → UnsupportedRenderer-NMI6uTEn.js} +1 -1
- package/dist/vue2/light-file-preview-vue2.js +1 -1
- package/dist/vue2/light-file-preview-vue2.umd.cjs +108 -108
- package/dist/vue2/{vue2-DiVuCQ1b.js → vue2-n72zoIZI.js} +1491 -1450
- package/package.json +4 -1
- package/public/screenshots/effect-docx.png +0 -0
- package/public/screenshots/effect-pdf.png +0 -0
- package/public/screenshots/effect-pptx.png +0 -0
- package/public/screenshots/effect-xlsx.png +0 -0
- package/public/screenshots/preview-dialog.png +0 -0
- package/public/screenshots/preview-docs.png +0 -0
- package/public/screenshots/preview-home.png +0 -0
- package/dist/SheetRenderer-Dfa4Vi-f.js +0 -576
- package/dist/index-CNi6OyzI.js +0 -305
- package/dist/vue2/SheetRenderer-9kIteUQN.js +0 -576
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
import { defineComponent as Xe, ref as ct, computed as Mt, onMounted as Ze, onBeforeUnmount as Je, openBlock as b, createElementBlock as y, createElementVNode as h, Fragment as ut, renderList as ft, normalizeClass as wt, toDisplayString as T, createCommentVNode as Vt, createTextVNode as fe, normalizeStyle as dt } from "vue";
|
|
2
|
+
import { r as Qe } from "./text-Bqxn_tMI.js";
|
|
3
|
+
const Ye = { class: "lfp-document lfp-sheet" }, tr = { class: "lfp-sheet__toolbar" }, er = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "lfp-sheet__tabs",
|
|
6
|
+
role: "tablist",
|
|
7
|
+
"aria-label": "工作表切换"
|
|
8
|
+
}, rr = ["onClick"], nr = { class: "lfp-sheet__tab-label" }, or = { class: "lfp-sheet__tab-meta" }, sr = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "lfp-sheet__summary"
|
|
11
|
+
}, ir = { class: "lfp-sheet__summary-item" }, lr = { class: "lfp-sheet__summary-item" }, ar = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "lfp-sheet__formula-bar"
|
|
14
|
+
}, cr = { class: "lfp-sheet__name-box" }, ur = { class: "lfp-sheet__name-box-text" }, fr = { class: "lfp-sheet__formula-input" }, dr = { class: "lfp-sheet__formula-text" }, mr = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "lfp-hint"
|
|
17
|
+
}, pr = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "lfp-sheet__table-wrap"
|
|
20
|
+
}, hr = { class: "lfp-sheet__grid" }, gr = { class: "lfp-sheet__table" }, br = { class: "lfp-sheet__header-row" }, yr = ["rowspan", "colspan", "title", "onMouseenter", "onFocus", "onClick"], Fr = ["innerHTML"], vr = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "lfp-sheet__cell-text"
|
|
23
|
+
}, xr = {
|
|
24
|
+
class: "lfp-sheet__images",
|
|
25
|
+
"aria-hidden": "true"
|
|
26
|
+
}, _r = ["src", "alt"], Cr = {
|
|
27
|
+
key: 3,
|
|
28
|
+
class: "lfp-sheet__empty"
|
|
29
|
+
}, Ar = 28, Nr = 14, wr = 24, Rr = 24, mt = 46, Rt = 28, Xt = 24, de = 64, Tr = /* @__PURE__ */ Xe({
|
|
30
|
+
__name: "SheetRenderer",
|
|
31
|
+
props: {
|
|
32
|
+
source: {},
|
|
33
|
+
maxRows: {},
|
|
34
|
+
maxCols: {}
|
|
35
|
+
},
|
|
36
|
+
emits: ["loading", "error"],
|
|
37
|
+
setup(me, { emit: pe }) {
|
|
38
|
+
const Zt = [
|
|
39
|
+
"000000",
|
|
40
|
+
"FFFFFF",
|
|
41
|
+
"FF0000",
|
|
42
|
+
"00FF00",
|
|
43
|
+
"0000FF",
|
|
44
|
+
"FFFF00",
|
|
45
|
+
"FF00FF",
|
|
46
|
+
"00FFFF",
|
|
47
|
+
"000000",
|
|
48
|
+
"FFFFFF",
|
|
49
|
+
"FF0000",
|
|
50
|
+
"00FF00",
|
|
51
|
+
"0000FF",
|
|
52
|
+
"FFFF00",
|
|
53
|
+
"FF00FF",
|
|
54
|
+
"00FFFF",
|
|
55
|
+
"800000",
|
|
56
|
+
"008000",
|
|
57
|
+
"000080",
|
|
58
|
+
"808000",
|
|
59
|
+
"800080",
|
|
60
|
+
"008080",
|
|
61
|
+
"C0C0C0",
|
|
62
|
+
"808080",
|
|
63
|
+
"9999FF",
|
|
64
|
+
"993366",
|
|
65
|
+
"FFFFCC",
|
|
66
|
+
"CCFFFF",
|
|
67
|
+
"660066",
|
|
68
|
+
"FF8080",
|
|
69
|
+
"0066CC",
|
|
70
|
+
"CCCCFF",
|
|
71
|
+
"000080",
|
|
72
|
+
"FF00FF",
|
|
73
|
+
"FFFF00",
|
|
74
|
+
"00FFFF",
|
|
75
|
+
"800080",
|
|
76
|
+
"800000",
|
|
77
|
+
"008080",
|
|
78
|
+
"0000FF",
|
|
79
|
+
"00CCFF",
|
|
80
|
+
"CCFFFF",
|
|
81
|
+
"CCFFCC",
|
|
82
|
+
"FFFF99",
|
|
83
|
+
"99CCFF",
|
|
84
|
+
"FF99CC",
|
|
85
|
+
"CC99FF",
|
|
86
|
+
"FFCC99",
|
|
87
|
+
"3366FF",
|
|
88
|
+
"33CCCC",
|
|
89
|
+
"99CC00",
|
|
90
|
+
"FFCC00",
|
|
91
|
+
"FF9900",
|
|
92
|
+
"FF6600",
|
|
93
|
+
"666699",
|
|
94
|
+
"969696",
|
|
95
|
+
"003366",
|
|
96
|
+
"339966",
|
|
97
|
+
"003300",
|
|
98
|
+
"333300",
|
|
99
|
+
"993300",
|
|
100
|
+
"993366",
|
|
101
|
+
"333399",
|
|
102
|
+
"333333"
|
|
103
|
+
], Ht = me, Wt = pe, Jt = new AbortController(), Ut = ct(0), pt = ct([]), H = ct(""), Qt = ct(null), Yt = ct(null), jt = ct([]), p = Mt(() => pt.value[Ut.value]), te = Mt(() => {
|
|
104
|
+
var e;
|
|
105
|
+
const t = p.value;
|
|
106
|
+
return !t || !H.value ? null : (e = t.cellMap[H.value]) != null ? e : null;
|
|
107
|
+
}), he = Mt(() => {
|
|
108
|
+
var t, e;
|
|
109
|
+
return (e = (t = te.value) == null ? void 0 : t.address) != null ? e : "A1";
|
|
110
|
+
}), ge = Mt(() => {
|
|
111
|
+
const t = te.value;
|
|
112
|
+
return t ? t.formula ? `=${t.formula}` : t.value : "";
|
|
113
|
+
});
|
|
114
|
+
function ee() {
|
|
115
|
+
for (const t of jt.value)
|
|
116
|
+
URL.revokeObjectURL(t);
|
|
117
|
+
jt.value = [];
|
|
118
|
+
}
|
|
119
|
+
function be(t) {
|
|
120
|
+
let e = t + 1, r = "";
|
|
121
|
+
for (; e > 0; ) {
|
|
122
|
+
const n = (e - 1) % 26;
|
|
123
|
+
r = String.fromCharCode(65 + n) + r, e = Math.floor((e - 1) / 26);
|
|
124
|
+
}
|
|
125
|
+
return r;
|
|
126
|
+
}
|
|
127
|
+
function ht(t, e) {
|
|
128
|
+
Qt.value = t, Yt.value = e;
|
|
129
|
+
}
|
|
130
|
+
function ye(t) {
|
|
131
|
+
H.value = t;
|
|
132
|
+
}
|
|
133
|
+
function re(t) {
|
|
134
|
+
Ut.value = t;
|
|
135
|
+
const e = pt.value[t];
|
|
136
|
+
H.value = e ? `${e.firstVisibleRow}:${e.firstVisibleCol}` : "", ht(null, null);
|
|
137
|
+
}
|
|
138
|
+
function ne(t, e) {
|
|
139
|
+
return t != null && t === oe() || e != null && e === se();
|
|
140
|
+
}
|
|
141
|
+
function oe() {
|
|
142
|
+
if (!H.value)
|
|
143
|
+
return null;
|
|
144
|
+
const [t] = H.value.split(":");
|
|
145
|
+
return Number.isFinite(Number(t)) ? Number(t) : null;
|
|
146
|
+
}
|
|
147
|
+
function se() {
|
|
148
|
+
if (!H.value)
|
|
149
|
+
return null;
|
|
150
|
+
const [, t] = H.value.split(":");
|
|
151
|
+
return Number.isFinite(Number(t)) ? Number(t) : null;
|
|
152
|
+
}
|
|
153
|
+
function Fe(t) {
|
|
154
|
+
if (t) {
|
|
155
|
+
if (["thin", "hair"].includes(t) || ["medium", "dashed", "dotted", "dashDot", "dashDotDot"].includes(t))
|
|
156
|
+
return "1px solid";
|
|
157
|
+
if (["thick", "double", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(t))
|
|
158
|
+
return "2px solid";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function ve(t) {
|
|
162
|
+
const e = t.replace(/^#/, ""), r = e.length === 3 ? e.split("").map((n) => `${n}${n}`).join("") : e;
|
|
163
|
+
return [
|
|
164
|
+
Number.parseInt(r.slice(0, 2), 16),
|
|
165
|
+
Number.parseInt(r.slice(2, 4), 16),
|
|
166
|
+
Number.parseInt(r.slice(4, 6), 16)
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
function xe(t) {
|
|
170
|
+
return `#${t.map((e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0")).join("")}`;
|
|
171
|
+
}
|
|
172
|
+
function _e(t) {
|
|
173
|
+
const [e, r, n] = t.map((u) => u / 255), o = Math.max(e, r, n), s = Math.min(e, r, n), i = o - s;
|
|
174
|
+
let l = 0, a = 0;
|
|
175
|
+
const c = (o + s) / 2;
|
|
176
|
+
if (i !== 0) {
|
|
177
|
+
switch (a = i / (1 - Math.abs(2 * c - 1)), o) {
|
|
178
|
+
case e:
|
|
179
|
+
l = (r - n) / i % 6;
|
|
180
|
+
break;
|
|
181
|
+
case r:
|
|
182
|
+
l = (n - e) / i + 2;
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
l = (e - r) / i + 4;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
l *= 60, l < 0 && (l += 360);
|
|
189
|
+
}
|
|
190
|
+
return [l, a, c];
|
|
191
|
+
}
|
|
192
|
+
function zt(t, e, r) {
|
|
193
|
+
let n = r;
|
|
194
|
+
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
|
|
195
|
+
}
|
|
196
|
+
function Ce(t) {
|
|
197
|
+
const [e, r, n] = t;
|
|
198
|
+
if (r === 0) {
|
|
199
|
+
const l = n * 255;
|
|
200
|
+
return [l, l, l];
|
|
201
|
+
}
|
|
202
|
+
const o = n < 0.5 ? n * (1 + r) : n + r - n * r, s = 2 * n - o, i = e / 360;
|
|
203
|
+
return [
|
|
204
|
+
zt(s, o, i + 1 / 3) * 255,
|
|
205
|
+
zt(s, o, i) * 255,
|
|
206
|
+
zt(s, o, i - 1 / 3) * 255
|
|
207
|
+
];
|
|
208
|
+
}
|
|
209
|
+
function Ae(t, e = 0) {
|
|
210
|
+
if (!e)
|
|
211
|
+
return t.startsWith("#") ? t : `#${t}`;
|
|
212
|
+
const r = _e(ve(t));
|
|
213
|
+
return e < 0 ? r[2] = r[2] * (1 + e) : r[2] = 1 - (1 - r[2]) * (1 - e), xe(Ce(r));
|
|
214
|
+
}
|
|
215
|
+
function It(t, e) {
|
|
216
|
+
var s, i, l, a;
|
|
217
|
+
if (!t || typeof t != "object")
|
|
218
|
+
return;
|
|
219
|
+
const r = t, n = "rgb" in r && typeof r.rgb == "string" ? r.rgb : "argb" in r && typeof r.argb == "string" ? r.argb : void 0;
|
|
220
|
+
if (n) {
|
|
221
|
+
const c = n.replace(/^#/, "");
|
|
222
|
+
if (/^[0-9a-fA-F]{8}$/.test(c))
|
|
223
|
+
return `#${c.slice(2)}`;
|
|
224
|
+
if (/^[0-9a-fA-F]{6}$/.test(c))
|
|
225
|
+
return `#${c}`;
|
|
226
|
+
}
|
|
227
|
+
const o = (s = r.indexed) != null ? s : r.index;
|
|
228
|
+
if (typeof o == "number" && Zt[o])
|
|
229
|
+
return `#${Zt[o]}`;
|
|
230
|
+
if (typeof r.theme == "number") {
|
|
231
|
+
const c = (a = (l = (i = e == null ? void 0 : e.themeElements) == null ? void 0 : i.clrScheme) == null ? void 0 : l[r.theme]) == null ? void 0 : a.rgb;
|
|
232
|
+
if (c)
|
|
233
|
+
return Ae(c, typeof r.tint == "number" ? r.tint : 0);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function $t(t, e, r, n) {
|
|
237
|
+
var i;
|
|
238
|
+
if (!r)
|
|
239
|
+
return;
|
|
240
|
+
const o = Fe(r.style), s = (i = It(r.color, n)) != null ? i : "rgba(31, 44, 61, 0.12)";
|
|
241
|
+
o && (e === "left" ? t.borderLeft = `${o} ${s}` : e === "right" ? t.borderRight = `${o} ${s}` : e === "top" ? t.borderTop = `${o} ${s}` : e === "bottom" && (t.borderBottom = `${o} ${s}`));
|
|
242
|
+
}
|
|
243
|
+
function ie(t) {
|
|
244
|
+
const e = typeof (t == null ? void 0 : t.hpx) == "number" ? t.hpx : typeof (t == null ? void 0 : t.hpt) == "number" ? t.hpt * 1.3334 : void 0;
|
|
245
|
+
return Math.max(e != null ? e : Xt, Xt);
|
|
246
|
+
}
|
|
247
|
+
function Ne(t) {
|
|
248
|
+
return { height: `${ie(t)}px` };
|
|
249
|
+
}
|
|
250
|
+
function le(t) {
|
|
251
|
+
return typeof (t == null ? void 0 : t.wpx) == "number" ? Math.max(t.wpx, 42) : typeof (t == null ? void 0 : t.width) == "number" ? Math.max(Math.round(t.width * 7.2 + 5), 42) : de;
|
|
252
|
+
}
|
|
253
|
+
function ae(t) {
|
|
254
|
+
return `${le(t)}px`;
|
|
255
|
+
}
|
|
256
|
+
function we(t) {
|
|
257
|
+
const e = {}, r = t == null ? void 0 : t.horizontal, n = t == null ? void 0 : t.vertical;
|
|
258
|
+
r && (e.textAlign = r), n && (e.verticalAlign = n === "center" ? "middle" : n), t != null && t.wrapText && (e.whiteSpace = "pre-wrap", e.wordBreak = "break-word");
|
|
259
|
+
const o = r === "center" ? "center" : r === "right" ? "flex-end" : "flex-start", s = n === "top" ? "flex-start" : n === "bottom" ? "flex-end" : "center";
|
|
260
|
+
return e["--lfp-cell-justify"] = o, e["--lfp-cell-align"] = s, e["--lfp-cell-white-space"] = t != null && t.wrapText ? "pre-wrap" : "nowrap", e["--lfp-cell-word-break"] = t != null && t.wrapText ? "break-word" : "normal", e;
|
|
261
|
+
}
|
|
262
|
+
function Re(t, e, r, n, o) {
|
|
263
|
+
var R, E, C, A, g, v;
|
|
264
|
+
const s = {};
|
|
265
|
+
r ? (s.minWidth = r, s.width = r) : e && (s.minWidth = e, s.width = e);
|
|
266
|
+
const i = t != null && t.s && typeof t.s == "object" ? t.s : {}, l = (E = (R = o == null ? void 0 : o.fill) != null ? R : i.fill) != null ? E : i, a = (C = o == null ? void 0 : o.font) != null ? C : i.font, c = (A = o == null ? void 0 : o.border) != null ? A : i.border, u = (g = o == null ? void 0 : o.alignment) != null ? g : i.alignment;
|
|
267
|
+
if (!l && !a && !c && !u)
|
|
268
|
+
return s;
|
|
269
|
+
const w = (v = It(l == null ? void 0 : l.fgColor, n)) != null ? v : It(l == null ? void 0 : l.bgColor, n), F = It(a == null ? void 0 : a.color, n);
|
|
270
|
+
return w && (l == null ? void 0 : l.patternType) !== "none" && (s.background = w, s.backgroundColor = w, s["--lfp-cell-bg"] = w), F && (s.color = F), a != null && a.bold && (s.fontWeight = "700"), a != null && a.italic && (s.fontStyle = "italic"), a != null && a.underline && (s.textDecoration = "underline"), typeof (a == null ? void 0 : a.sz) == "number" && (s.fontSize = `${a.sz}px`), typeof (a == null ? void 0 : a.name) == "string" && a.name.trim() && (s.fontFamily = a.name), Object.assign(s, we(u)), !(u != null && u.horizontal) && typeof (t == null ? void 0 : t.t) == "string" && ["n", "d"].includes(t.t) && (s.textAlign = "right", s["--lfp-cell-justify"] = "flex-end"), $t(s, "left", c == null ? void 0 : c.left, n), $t(s, "right", c == null ? void 0 : c.right, n), $t(s, "top", c == null ? void 0 : c.top, n), $t(s, "bottom", c == null ? void 0 : c.bottom, n), s;
|
|
271
|
+
}
|
|
272
|
+
async function Ie(t) {
|
|
273
|
+
try {
|
|
274
|
+
if (typeof createImageBitmap == "function") {
|
|
275
|
+
const e = await createImageBitmap(t), r = { width: e.width, height: e.height };
|
|
276
|
+
return e.close(), r;
|
|
277
|
+
}
|
|
278
|
+
} catch (e) {
|
|
279
|
+
}
|
|
280
|
+
return await new Promise((e) => {
|
|
281
|
+
const r = URL.createObjectURL(t), n = new Image();
|
|
282
|
+
n.onload = () => {
|
|
283
|
+
URL.revokeObjectURL(r), e({ width: n.naturalWidth, height: n.naturalHeight });
|
|
284
|
+
}, n.onerror = () => {
|
|
285
|
+
URL.revokeObjectURL(r), e(null);
|
|
286
|
+
}, n.src = r;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function $e(t, e) {
|
|
290
|
+
var r, n;
|
|
291
|
+
return e ? typeof e.w == "string" ? e.w : (r = t.utils) != null && r.format_cell ? String(t.utils.format_cell(e, (n = e.v) != null ? n : "")) : e.v != null ? String(e.v) : typeof e.f == "string" && e.f.trim() ? `=${e.f}` : "" : "";
|
|
292
|
+
}
|
|
293
|
+
function Te(t, e, r) {
|
|
294
|
+
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
295
|
+
for (const s of t) {
|
|
296
|
+
const i = e.filter((c) => c >= s.s.r && c <= s.e.r), l = r.filter((c) => c >= s.s.c && c <= s.e.c);
|
|
297
|
+
if (!i.length || !l.length)
|
|
298
|
+
continue;
|
|
299
|
+
const a = `${s.s.r}:${s.s.c}`;
|
|
300
|
+
o.set(a, {
|
|
301
|
+
rowSpan: i.length,
|
|
302
|
+
colSpan: l.length,
|
|
303
|
+
colsInRange: l
|
|
304
|
+
});
|
|
305
|
+
for (const c of i)
|
|
306
|
+
for (const u of l)
|
|
307
|
+
c === s.s.r && u === s.s.c || n.add(`${c}:${u}`);
|
|
308
|
+
}
|
|
309
|
+
return { coveredCells: n, mergeStarts: o };
|
|
310
|
+
}
|
|
311
|
+
function ce(t) {
|
|
312
|
+
return t ? t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : typeof t == "string" ? new TextEncoder().encode(t) : null : null;
|
|
313
|
+
}
|
|
314
|
+
function U(t) {
|
|
315
|
+
if (!t)
|
|
316
|
+
return "";
|
|
317
|
+
if (typeof t == "string")
|
|
318
|
+
return t;
|
|
319
|
+
const e = ce(t);
|
|
320
|
+
return e ? new TextDecoder("utf-8").decode(e) : "";
|
|
321
|
+
}
|
|
322
|
+
function j(t) {
|
|
323
|
+
if (!t.trim())
|
|
324
|
+
return null;
|
|
325
|
+
const e = new DOMParser().parseFromString(t, "application/xml");
|
|
326
|
+
return e.querySelector("parsererror") ? null : e;
|
|
327
|
+
}
|
|
328
|
+
function _(t, e) {
|
|
329
|
+
var r;
|
|
330
|
+
return t && (r = Array.from(t.children).find((n) => n.localName === e)) != null ? r : null;
|
|
331
|
+
}
|
|
332
|
+
function Tt(t, e) {
|
|
333
|
+
var r;
|
|
334
|
+
return t && (r = Array.from(t.getElementsByTagName("*")).find((n) => n.localName === e)) != null ? r : null;
|
|
335
|
+
}
|
|
336
|
+
function z(t, e) {
|
|
337
|
+
var o, s;
|
|
338
|
+
const r = (s = (o = _(t, e)) == null ? void 0 : o.textContent) != null ? s : "", n = Number.parseInt(r, 10);
|
|
339
|
+
return Number.isFinite(n) ? n : 0;
|
|
340
|
+
}
|
|
341
|
+
function ue(t) {
|
|
342
|
+
const e = t.lastIndexOf("/"), r = e >= 0 ? t.slice(0, e) : "", n = e >= 0 ? t.slice(e + 1) : t;
|
|
343
|
+
return `${r}/_rels/${n}.rels`;
|
|
344
|
+
}
|
|
345
|
+
function Ee(t, e) {
|
|
346
|
+
var o, s, i;
|
|
347
|
+
const r = j(U((o = t[e]) == null ? void 0 : o.content));
|
|
348
|
+
if (!r)
|
|
349
|
+
return {};
|
|
350
|
+
const n = {};
|
|
351
|
+
for (const l of Array.from(r.getElementsByTagName("*"))) {
|
|
352
|
+
if (l.localName !== "c")
|
|
353
|
+
continue;
|
|
354
|
+
const a = (s = l.getAttribute("r")) != null ? s : "", c = Number.parseInt((i = l.getAttribute("s")) != null ? i : "", 10);
|
|
355
|
+
a && Number.isFinite(c) && (n[a] = c);
|
|
356
|
+
}
|
|
357
|
+
return n;
|
|
358
|
+
}
|
|
359
|
+
function De(t, e) {
|
|
360
|
+
var n, o, s, i, l;
|
|
361
|
+
if (t == null || !((n = e == null ? void 0 : e.CellXf) != null && n[t]))
|
|
362
|
+
return {};
|
|
363
|
+
const r = (o = e.CellXf[t]) != null ? o : {};
|
|
364
|
+
return {
|
|
365
|
+
fill: typeof r.fillId == "number" ? (s = e.Fills) == null ? void 0 : s[r.fillId] : void 0,
|
|
366
|
+
font: typeof r.fontId == "number" ? (i = e.Fonts) == null ? void 0 : i[r.fontId] : void 0,
|
|
367
|
+
border: typeof r.borderId == "number" ? (l = e.Borders) == null ? void 0 : l[r.borderId] : void 0,
|
|
368
|
+
alignment: r.alignment
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function Se(t) {
|
|
372
|
+
var i, l, a, c, u, w, F, R, E, C, A, g, v, O, P, X, Z, J, B;
|
|
373
|
+
const e = {}, r = _(t, "font");
|
|
374
|
+
if (r) {
|
|
375
|
+
const m = {}, d = _(r, "color"), D = _(r, "sz"), N = _(r, "name");
|
|
376
|
+
_(r, "b") && (m.bold = !0), _(r, "i") && (m.italic = !0), _(r, "u") && (m.underline = !0), d && (m.color = {
|
|
377
|
+
rgb: (i = d.getAttribute("rgb")) == null ? void 0 : i.slice(-6),
|
|
378
|
+
theme: d.getAttribute("theme") ? Number.parseInt((l = d.getAttribute("theme")) != null ? l : "", 10) : void 0,
|
|
379
|
+
tint: d.getAttribute("tint") ? Number.parseFloat((a = d.getAttribute("tint")) != null ? a : "") : void 0,
|
|
380
|
+
indexed: d.getAttribute("indexed") ? Number.parseInt((c = d.getAttribute("indexed")) != null ? c : "", 10) : void 0
|
|
381
|
+
}), D != null && D.getAttribute("val") && (m.sz = Number.parseFloat((u = D.getAttribute("val")) != null ? u : "")), N != null && N.getAttribute("val") && (m.name = N.getAttribute("val")), e.font = m;
|
|
382
|
+
}
|
|
383
|
+
const n = _(t, "fill"), o = Tt(n, "patternFill");
|
|
384
|
+
if (o) {
|
|
385
|
+
e.fill = {
|
|
386
|
+
patternType: (w = o.getAttribute("patternType")) != null ? w : "solid"
|
|
387
|
+
};
|
|
388
|
+
const m = _(o, "fgColor"), d = _(o, "bgColor");
|
|
389
|
+
m && (e.fill.fgColor = {
|
|
390
|
+
rgb: (F = m.getAttribute("rgb")) == null ? void 0 : F.slice(-6),
|
|
391
|
+
theme: m.getAttribute("theme") ? Number.parseInt((R = m.getAttribute("theme")) != null ? R : "", 10) : void 0,
|
|
392
|
+
tint: m.getAttribute("tint") ? Number.parseFloat((E = m.getAttribute("tint")) != null ? E : "") : void 0,
|
|
393
|
+
indexed: m.getAttribute("indexed") ? Number.parseInt((C = m.getAttribute("indexed")) != null ? C : "", 10) : void 0
|
|
394
|
+
}), d && (e.fill.bgColor = {
|
|
395
|
+
rgb: (A = d.getAttribute("rgb")) == null ? void 0 : A.slice(-6),
|
|
396
|
+
theme: d.getAttribute("theme") ? Number.parseInt((g = d.getAttribute("theme")) != null ? g : "", 10) : void 0,
|
|
397
|
+
tint: d.getAttribute("tint") ? Number.parseFloat((v = d.getAttribute("tint")) != null ? v : "") : void 0,
|
|
398
|
+
indexed: d.getAttribute("indexed") ? Number.parseInt((O = d.getAttribute("indexed")) != null ? O : "", 10) : void 0
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
const s = _(t, "border");
|
|
402
|
+
if (s) {
|
|
403
|
+
const m = {};
|
|
404
|
+
for (const d of ["left", "right", "top", "bottom"]) {
|
|
405
|
+
const D = _(s, d);
|
|
406
|
+
if (!D) continue;
|
|
407
|
+
m[d] = {
|
|
408
|
+
style: (P = D.getAttribute("style")) != null ? P : void 0
|
|
409
|
+
};
|
|
410
|
+
const N = _(D, "color");
|
|
411
|
+
N && (m[d].color = {
|
|
412
|
+
rgb: (X = N.getAttribute("rgb")) == null ? void 0 : X.slice(-6),
|
|
413
|
+
theme: N.getAttribute("theme") ? Number.parseInt((Z = N.getAttribute("theme")) != null ? Z : "", 10) : void 0,
|
|
414
|
+
tint: N.getAttribute("tint") ? Number.parseFloat((J = N.getAttribute("tint")) != null ? J : "") : void 0,
|
|
415
|
+
indexed: N.getAttribute("indexed") ? Number.parseInt((B = N.getAttribute("indexed")) != null ? B : "", 10) : void 0
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
e.border = m;
|
|
419
|
+
}
|
|
420
|
+
return e;
|
|
421
|
+
}
|
|
422
|
+
function Oe(t) {
|
|
423
|
+
if (!t)
|
|
424
|
+
return;
|
|
425
|
+
const e = {}, r = t.getAttribute("rgb"), n = t.getAttribute("theme"), o = t.getAttribute("tint"), s = t.getAttribute("indexed");
|
|
426
|
+
return r && (e.rgb = r.slice(-6)), n && (e.theme = Number.parseInt(n, 10)), o && (e.tint = Number.parseFloat(o)), s && (e.indexed = Number.parseInt(s, 10)), Object.keys(e).length ? e : void 0;
|
|
427
|
+
}
|
|
428
|
+
function Be(t) {
|
|
429
|
+
var n;
|
|
430
|
+
const e = j(U((n = t["xl/styles.xml"]) == null ? void 0 : n.content));
|
|
431
|
+
if (!e)
|
|
432
|
+
return [];
|
|
433
|
+
const r = Array.from(e.getElementsByTagName("*")).find((o) => o.localName === "borders");
|
|
434
|
+
return r ? Array.from(r.children).filter((o) => o.localName === "border").map((o) => {
|
|
435
|
+
const s = {};
|
|
436
|
+
for (const i of ["left", "right", "top", "bottom"]) {
|
|
437
|
+
const l = _(o, i);
|
|
438
|
+
if (!l)
|
|
439
|
+
continue;
|
|
440
|
+
const a = l.getAttribute("style"), c = Oe(_(l, "color"));
|
|
441
|
+
(a || c) && (s[i] = {}, a && (s[i].style = a), c && (s[i].color = c));
|
|
442
|
+
}
|
|
443
|
+
return s;
|
|
444
|
+
}) : [];
|
|
445
|
+
}
|
|
446
|
+
function Le(t) {
|
|
447
|
+
var n;
|
|
448
|
+
const e = j(U((n = t["xl/styles.xml"]) == null ? void 0 : n.content));
|
|
449
|
+
if (!e)
|
|
450
|
+
return [];
|
|
451
|
+
const r = Array.from(e.getElementsByTagName("*")).find((o) => o.localName === "dxfs");
|
|
452
|
+
return r ? Array.from(r.children).filter((o) => o.localName === "dxf").map((o) => Se(o)) : [];
|
|
453
|
+
}
|
|
454
|
+
function Me(t, e, r) {
|
|
455
|
+
var i, l, a, c, u, w, F;
|
|
456
|
+
const n = j(U((i = t[e]) == null ? void 0 : i.content));
|
|
457
|
+
if (!n)
|
|
458
|
+
return [];
|
|
459
|
+
const o = [], s = Array.from(n.getElementsByTagName("*")).filter(
|
|
460
|
+
(R) => R.localName === "conditionalFormatting"
|
|
461
|
+
);
|
|
462
|
+
for (const R of s) {
|
|
463
|
+
const E = ((l = R.getAttribute("sqref")) != null ? l : "").split(/\s+/).filter(Boolean);
|
|
464
|
+
if (E.length)
|
|
465
|
+
for (const C of Array.from(R.children).filter((A) => A.localName === "cfRule")) {
|
|
466
|
+
const A = Number.parseInt((a = C.getAttribute("dxfId")) != null ? a : "", 10);
|
|
467
|
+
!Number.isFinite(A) || !r[A] || o.push({
|
|
468
|
+
sqrefs: E,
|
|
469
|
+
type: (c = C.getAttribute("type")) != null ? c : "",
|
|
470
|
+
operator: (u = C.getAttribute("operator")) != null ? u : void 0,
|
|
471
|
+
text: (w = C.getAttribute("text")) != null ? w : void 0,
|
|
472
|
+
formulas: Array.from(C.children).filter((g) => g.localName === "formula").map((g) => {
|
|
473
|
+
var v, O;
|
|
474
|
+
return (O = (v = g.textContent) == null ? void 0 : v.trim()) != null ? O : "";
|
|
475
|
+
}).filter(Boolean),
|
|
476
|
+
dxfStyle: r[A],
|
|
477
|
+
priority: Number.parseInt((F = C.getAttribute("priority")) != null ? F : "", 10) || Number.MAX_SAFE_INTEGER
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return o.sort((R, E) => R.priority - E.priority);
|
|
482
|
+
}
|
|
483
|
+
function Ve(t, e, r) {
|
|
484
|
+
try {
|
|
485
|
+
const n = r.utils.decode_range(e), o = r.utils.decode_cell(t);
|
|
486
|
+
return o.r >= n.s.r && o.r <= n.e.r && o.c >= n.s.c && o.c <= n.e.c;
|
|
487
|
+
} catch (n) {
|
|
488
|
+
return !1;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function He(t) {
|
|
492
|
+
return t ? typeof t.v == "number" ? t.v : t.v == null ? null : String(t.v) : null;
|
|
493
|
+
}
|
|
494
|
+
function We(t, e, r, n) {
|
|
495
|
+
if (!t.sqrefs.some((s) => Ve(e, s, n)))
|
|
496
|
+
return !1;
|
|
497
|
+
const o = He(r);
|
|
498
|
+
if (t.type === "containsText" && typeof o == "string" && t.text)
|
|
499
|
+
return o.includes(t.text);
|
|
500
|
+
if (t.type === "notContainsText" && typeof o == "string" && t.text)
|
|
501
|
+
return !o.includes(t.text);
|
|
502
|
+
if (t.type === "beginsWith" && typeof o == "string" && t.text)
|
|
503
|
+
return o.startsWith(t.text);
|
|
504
|
+
if (t.type === "endsWith" && typeof o == "string" && t.text)
|
|
505
|
+
return o.endsWith(t.text);
|
|
506
|
+
if (t.type === "cellIs" && t.formulas.length && o != null) {
|
|
507
|
+
const s = typeof o == "number" ? o : Number(o), i = Number(t.formulas[0]), l = t.formulas[1] != null ? Number(t.formulas[1]) : void 0;
|
|
508
|
+
if (!Number.isFinite(s) || !Number.isFinite(i))
|
|
509
|
+
return !1;
|
|
510
|
+
switch (t.operator) {
|
|
511
|
+
case "equal":
|
|
512
|
+
return s === i;
|
|
513
|
+
case "notEqual":
|
|
514
|
+
return s !== i;
|
|
515
|
+
case "greaterThan":
|
|
516
|
+
return s > i;
|
|
517
|
+
case "greaterThanOrEqual":
|
|
518
|
+
return s >= i;
|
|
519
|
+
case "lessThan":
|
|
520
|
+
return s < i;
|
|
521
|
+
case "lessThanOrEqual":
|
|
522
|
+
return s <= i;
|
|
523
|
+
case "between":
|
|
524
|
+
return l != null && Number.isFinite(l) ? s >= i && s <= l : !1;
|
|
525
|
+
default:
|
|
526
|
+
return !1;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return !1;
|
|
530
|
+
}
|
|
531
|
+
function Pt(t, e) {
|
|
532
|
+
if (!e)
|
|
533
|
+
return t;
|
|
534
|
+
const r = t.split("/");
|
|
535
|
+
r.pop();
|
|
536
|
+
const n = e.split("/");
|
|
537
|
+
for (const o of n)
|
|
538
|
+
!o || o === "." || (o === ".." ? r.pop() : r.push(o));
|
|
539
|
+
return r.join("/");
|
|
540
|
+
}
|
|
541
|
+
function kt(t, e) {
|
|
542
|
+
var s;
|
|
543
|
+
const r = U((s = t[e]) == null ? void 0 : s.content), n = j(r);
|
|
544
|
+
if (!n)
|
|
545
|
+
return {};
|
|
546
|
+
const o = {};
|
|
547
|
+
for (const i of Array.from(n.getElementsByTagName("*"))) {
|
|
548
|
+
if (i.localName !== "Relationship")
|
|
549
|
+
continue;
|
|
550
|
+
const l = i.getAttribute("Id"), a = i.getAttribute("Target");
|
|
551
|
+
l && a && (o[l] = a);
|
|
552
|
+
}
|
|
553
|
+
return o;
|
|
554
|
+
}
|
|
555
|
+
function Ue(t) {
|
|
556
|
+
var o;
|
|
557
|
+
const e = "xl/workbook.xml", r = j(U((o = t[e]) == null ? void 0 : o.content));
|
|
558
|
+
if (!r)
|
|
559
|
+
return [];
|
|
560
|
+
const n = kt(t, "xl/_rels/workbook.xml.rels");
|
|
561
|
+
return Array.from(r.getElementsByTagName("*")).filter((s) => s.localName === "sheet").map((s) => {
|
|
562
|
+
var l, a, c, u;
|
|
563
|
+
const i = (a = (l = s.getAttribute("r:id")) != null ? l : s.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id")) != null ? a : "";
|
|
564
|
+
return {
|
|
565
|
+
name: (c = s.getAttribute("name")) != null ? c : "",
|
|
566
|
+
path: Pt(e, (u = n[i]) != null ? u : "")
|
|
567
|
+
};
|
|
568
|
+
}).filter((s) => s.name && s.path);
|
|
569
|
+
}
|
|
570
|
+
function je(t) {
|
|
571
|
+
var r;
|
|
572
|
+
const e = (r = t.split(".").pop()) == null ? void 0 : r.toLowerCase();
|
|
573
|
+
return e === "png" ? "image/png" : e === "jpg" || e === "jpeg" ? "image/jpeg" : e === "gif" ? "image/gif" : e === "webp" ? "image/webp" : e === "svg" ? "image/svg+xml" : "application/octet-stream";
|
|
574
|
+
}
|
|
575
|
+
function tt(t) {
|
|
576
|
+
return t / 9525;
|
|
577
|
+
}
|
|
578
|
+
function Et(t, e, r, n) {
|
|
579
|
+
var s;
|
|
580
|
+
let o = n;
|
|
581
|
+
for (let i = 0; i < t.length; i += 1) {
|
|
582
|
+
if (t[i] === r)
|
|
583
|
+
return o;
|
|
584
|
+
o += (s = e[i]) != null ? s : 0;
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
function Dt(t, e, r) {
|
|
589
|
+
return Math.min(Math.max(t, e), r);
|
|
590
|
+
}
|
|
591
|
+
async function ze(t, e, r, n, o, s) {
|
|
592
|
+
var X, Z, J, B, m, d, D, N, St, gt, bt, yt, Ft;
|
|
593
|
+
const i = j(U((X = t[e]) == null ? void 0 : X.content));
|
|
594
|
+
if (!i)
|
|
595
|
+
return [];
|
|
596
|
+
const l = Array.from(i.getElementsByTagName("*")).find((I) => I.localName === "drawing");
|
|
597
|
+
if (!l)
|
|
598
|
+
return [];
|
|
599
|
+
const a = (J = (Z = l.getAttribute("r:id")) != null ? Z : l.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id")) != null ? J : "";
|
|
600
|
+
if (!a)
|
|
601
|
+
return [];
|
|
602
|
+
const c = kt(t, ue(e)), u = Pt(e, (B = c[a]) != null ? B : ""), w = j(U((m = t[u]) == null ? void 0 : m.content));
|
|
603
|
+
if (!w)
|
|
604
|
+
return [];
|
|
605
|
+
const F = kt(t, ue(u)), R = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
|
|
606
|
+
let C = mt, A = Rt;
|
|
607
|
+
n.forEach((I, W) => {
|
|
608
|
+
var $;
|
|
609
|
+
R.set(I, C), C += ($ = s[W]) != null ? $ : de;
|
|
610
|
+
}), r.forEach((I, W) => {
|
|
611
|
+
var $;
|
|
612
|
+
E.set(I, A), A += ($ = o[W]) != null ? $ : Xt;
|
|
613
|
+
});
|
|
614
|
+
const g = C, v = A, O = [], P = Array.from(w.getElementsByTagName("*")).filter(
|
|
615
|
+
(I) => ["oneCellAnchor", "twoCellAnchor"].includes(I.localName)
|
|
616
|
+
);
|
|
617
|
+
for (const I of P) {
|
|
618
|
+
const W = Tt(I, "pic"), $ = Tt(W, "blip"), vt = (D = (d = $ == null ? void 0 : $.getAttribute("r:embed")) != null ? d : $ == null ? void 0 : $.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed")) != null ? D : "";
|
|
619
|
+
if (!vt)
|
|
620
|
+
continue;
|
|
621
|
+
const et = Pt(u, (N = F[vt]) != null ? N : ""), k = ce((St = t[et]) == null ? void 0 : St.content);
|
|
622
|
+
if (!k)
|
|
623
|
+
continue;
|
|
624
|
+
const Q = _(I, "from"), xt = z(Q, "col"), _t = z(Q, "row"), Ct = Et(n, s, xt, mt), At = Et(r, o, _t, Rt);
|
|
625
|
+
if (Ct == null || At == null)
|
|
626
|
+
continue;
|
|
627
|
+
const f = tt(z(Q, "colOff")), qt = tt(z(Q, "rowOff")), rt = Ct + f, Y = At + qt;
|
|
628
|
+
let q = 160, G = 120;
|
|
629
|
+
if (I.localName === "twoCellAnchor") {
|
|
630
|
+
const x = _(I, "to"), V = z(x, "col"), at = z(x, "row"), Lt = tt(z(x, "colOff")), qe = tt(z(x, "rowOff")), Gt = Et(n, s, V, mt), Kt = Et(r, o, at, Rt), Ge = (Gt != null ? Gt : g) + Lt, Ke = (Kt != null ? Kt : v) + qe;
|
|
631
|
+
q = Math.max(Ge - rt, 32), G = Math.max(Ke - Y, 32);
|
|
632
|
+
} else {
|
|
633
|
+
const x = _(I, "ext");
|
|
634
|
+
q = Math.max(tt(Number.parseInt((gt = x == null ? void 0 : x.getAttribute("cx")) != null ? gt : "0", 10)), 32), G = Math.max(tt(Number.parseInt((bt = x == null ? void 0 : x.getAttribute("cy")) != null ? bt : "0", 10)), 32);
|
|
635
|
+
}
|
|
636
|
+
const nt = Dt(rt, mt, g), ot = Dt(Y, Rt, v), Ot = Dt(rt + q, mt, g), Bt = Dt(Y + G, Rt, v), K = Ot - nt, st = Bt - ot;
|
|
637
|
+
if (K <= 6 || st <= 6)
|
|
638
|
+
continue;
|
|
639
|
+
const it = k.buffer.slice(
|
|
640
|
+
k.byteOffset,
|
|
641
|
+
k.byteOffset + k.byteLength
|
|
642
|
+
), S = new Blob([it], { type: je(et) }), L = await Ie(S), lt = URL.createObjectURL(S);
|
|
643
|
+
jt.value.push(lt);
|
|
644
|
+
let M = q, Nt = G;
|
|
645
|
+
if (L != null && L.width && (L != null && L.height)) {
|
|
646
|
+
const x = Math.min(q / L.width, G / L.height);
|
|
647
|
+
Number.isFinite(x) && x > 0 && (M = Math.max(L.width * x, 1), Nt = Math.max(L.height * x, 1));
|
|
648
|
+
}
|
|
649
|
+
O.push({
|
|
650
|
+
key: `${e}-${_t}-${xt}-${et}`,
|
|
651
|
+
src: lt,
|
|
652
|
+
alt: (Ft = (yt = Tt(W, "cNvPr")) == null ? void 0 : yt.getAttribute("name")) != null ? Ft : "embedded image",
|
|
653
|
+
left: nt,
|
|
654
|
+
top: ot,
|
|
655
|
+
width: K,
|
|
656
|
+
height: st,
|
|
657
|
+
frameStyle: {
|
|
658
|
+
transform: `translate(${nt - rt}px, ${ot - Y}px)`,
|
|
659
|
+
width: `${M}px`,
|
|
660
|
+
height: `${Nt}px`
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return O;
|
|
665
|
+
}
|
|
666
|
+
async function Pe(t, e, r, n, o, s, i, l = [], a) {
|
|
667
|
+
var gt, bt, yt, Ft, I, W, $, vt, et, k, Q, xt, _t, Ct, At;
|
|
668
|
+
const c = (gt = r["!ref"]) != null ? gt : "A1", u = t.utils.decode_range(c), w = u.e.r + 1, F = u.e.c + 1, R = Math.max(
|
|
669
|
+
Math.max(Ht.maxRows, w) + wr,
|
|
670
|
+
Ar
|
|
671
|
+
), E = Math.max(
|
|
672
|
+
Math.max(Ht.maxCols, F) + Rr,
|
|
673
|
+
Nr
|
|
674
|
+
), C = [], A = [], g = [], v = [], O = [], P = [];
|
|
675
|
+
for (let f = 0; f <= u.e.r; f += 1)
|
|
676
|
+
(yt = (bt = r["!rows"]) == null ? void 0 : bt[f]) != null && yt.hidden || C.push(f);
|
|
677
|
+
for (let f = 0; f <= u.e.c; f += 1)
|
|
678
|
+
(I = (Ft = r["!cols"]) == null ? void 0 : Ft[f]) != null && I.hidden || A.push(f);
|
|
679
|
+
for (let f = 0; f < R; f += 1)
|
|
680
|
+
($ = (W = r["!rows"]) == null ? void 0 : W[f]) != null && $.hidden || (g.push(f), O.push(ie((vt = r["!rows"]) == null ? void 0 : vt[f])));
|
|
681
|
+
for (let f = 0; f < E; f += 1)
|
|
682
|
+
(k = (et = r["!cols"]) == null ? void 0 : et[f]) != null && k.hidden || (v.push(f), P.push(le((Q = r["!cols"]) == null ? void 0 : Q[f])));
|
|
683
|
+
const X = (xt = r["!merges"]) != null ? xt : [], { coveredCells: Z, mergeStarts: J } = Te(X, g, v), B = (_t = o[e]) != null ? _t : "", m = B ? Ee(n, B) : {}, d = B ? Me(n, B, l) : [], D = {}, N = g.map((f) => {
|
|
684
|
+
var q, G, nt, ot, Ot, Bt;
|
|
685
|
+
const qt = (q = r["!rows"]) == null ? void 0 : q[f], rt = Ne(qt), Y = [];
|
|
686
|
+
for (const K of v) {
|
|
687
|
+
const st = `${f}:${K}`;
|
|
688
|
+
if (Z.has(st))
|
|
689
|
+
continue;
|
|
690
|
+
const it = t.utils.encode_cell({ r: f, c: K }), S = r[it], L = De(m[it], i), lt = (G = d.find(
|
|
691
|
+
(V) => We(V, it, S, t)
|
|
692
|
+
)) == null ? void 0 : G.dxfStyle, M = J.get(st), Nt = ((nt = M == null ? void 0 : M.colsInRange) != null ? nt : [K]).map((V) => {
|
|
693
|
+
var at;
|
|
694
|
+
return ae((at = r["!cols"]) == null ? void 0 : at[V]);
|
|
695
|
+
}).filter(Boolean).reduce((V, at) => {
|
|
696
|
+
const Lt = Number.parseFloat(at);
|
|
697
|
+
return Number.isFinite(Lt) ? (V != null ? V : 0) + Lt : V;
|
|
698
|
+
}, null), x = {
|
|
699
|
+
key: st,
|
|
700
|
+
address: it,
|
|
701
|
+
value: $e(t, S),
|
|
702
|
+
formula: typeof (S == null ? void 0 : S.f) == "string" ? S.f : "",
|
|
703
|
+
richHtml: typeof (S == null ? void 0 : S.h) == "string" && a ? a(S.h) : "",
|
|
704
|
+
rowIndex: f,
|
|
705
|
+
colIndex: K,
|
|
706
|
+
rowSpan: (ot = M == null ? void 0 : M.rowSpan) != null ? ot : 1,
|
|
707
|
+
colSpan: (Ot = M == null ? void 0 : M.colSpan) != null ? Ot : 1,
|
|
708
|
+
style: Re(
|
|
709
|
+
S,
|
|
710
|
+
ae((Bt = r["!cols"]) == null ? void 0 : Bt[K]),
|
|
711
|
+
Nt ? `${Nt}px` : void 0,
|
|
712
|
+
s,
|
|
713
|
+
lt != null ? lt : L
|
|
714
|
+
)
|
|
715
|
+
};
|
|
716
|
+
Y.push(x), D[x.key] = x;
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
key: `${e}-${f}`,
|
|
720
|
+
rowIndex: f,
|
|
721
|
+
cells: Y,
|
|
722
|
+
style: rt
|
|
723
|
+
};
|
|
724
|
+
}), St = B ? await ze(n, B, g, v, O, P) : [];
|
|
725
|
+
return {
|
|
726
|
+
name: e,
|
|
727
|
+
rows: N,
|
|
728
|
+
totalRows: C.length,
|
|
729
|
+
totalCols: A.length,
|
|
730
|
+
visibleRows: g.length,
|
|
731
|
+
visibleCols: v.length,
|
|
732
|
+
visibleRowIndexes: g,
|
|
733
|
+
visibleColIndexes: v,
|
|
734
|
+
firstVisibleRow: (Ct = g[0]) != null ? Ct : 0,
|
|
735
|
+
firstVisibleCol: (At = v[0]) != null ? At : 0,
|
|
736
|
+
rowHeights: O,
|
|
737
|
+
colWidths: P,
|
|
738
|
+
images: St,
|
|
739
|
+
cellMap: D
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
async function ke() {
|
|
743
|
+
var t, e;
|
|
744
|
+
Wt("loading", !0), ee();
|
|
745
|
+
try {
|
|
746
|
+
const r = await Qe(Ht.source, Jt.signal), n = await import("./xlsx-j9Zzywas.js"), { default: o } = await import("./purify.es-CCmmh-Lt.js"), s = n.read(r, {
|
|
747
|
+
type: "array",
|
|
748
|
+
cellStyles: !0,
|
|
749
|
+
cellNF: !0,
|
|
750
|
+
cellText: !0,
|
|
751
|
+
cellHTML: !0,
|
|
752
|
+
cellFormula: !0,
|
|
753
|
+
bookFiles: !0
|
|
754
|
+
}), i = (t = s.files) != null ? t : {}, l = Ue(i), a = Object.fromEntries(l.map((F) => [F.name, F.path])), c = Le(i), u = (F) => o.sanitize(F), w = {
|
|
755
|
+
...(e = s.Styles) != null ? e : {},
|
|
756
|
+
Borders: Be(i)
|
|
757
|
+
};
|
|
758
|
+
pt.value = await Promise.all(
|
|
759
|
+
s.SheetNames.map(
|
|
760
|
+
(F) => Pe(
|
|
761
|
+
n,
|
|
762
|
+
F,
|
|
763
|
+
s.Sheets[F],
|
|
764
|
+
i,
|
|
765
|
+
a,
|
|
766
|
+
s.Themes,
|
|
767
|
+
w,
|
|
768
|
+
c,
|
|
769
|
+
u
|
|
770
|
+
)
|
|
771
|
+
)
|
|
772
|
+
), re(0);
|
|
773
|
+
} catch (r) {
|
|
774
|
+
Wt("error", r instanceof Error ? r : new Error("表格预览失败"));
|
|
775
|
+
} finally {
|
|
776
|
+
Wt("loading", !1);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return Ze(() => {
|
|
780
|
+
ke();
|
|
781
|
+
}), Je(() => {
|
|
782
|
+
Jt.abort(), ee();
|
|
783
|
+
}), (t, e) => (b(), y("div", Ye, [
|
|
784
|
+
h("div", tr, [
|
|
785
|
+
pt.value.length > 1 ? (b(), y("div", er, [
|
|
786
|
+
(b(!0), y(ut, null, ft(pt.value, (r, n) => (b(), y("button", {
|
|
787
|
+
key: r.name,
|
|
788
|
+
class: wt(["lfp-sheet__tab", { "is-active": n === Ut.value }]),
|
|
789
|
+
type: "button",
|
|
790
|
+
onClick: (o) => re(n)
|
|
791
|
+
}, [
|
|
792
|
+
h("span", nr, T(r.name), 1),
|
|
793
|
+
h("span", or, T(r.totalRows) + " × " + T(r.totalCols), 1)
|
|
794
|
+
], 10, rr))), 128))
|
|
795
|
+
])) : Vt("", !0),
|
|
796
|
+
p.value ? (b(), y("div", sr, [
|
|
797
|
+
h("span", ir, [
|
|
798
|
+
e[2] || (e[2] = fe(" 当前工作表 ", -1)),
|
|
799
|
+
h("strong", null, T(p.value.name), 1)
|
|
800
|
+
]),
|
|
801
|
+
h("span", lr, [
|
|
802
|
+
e[3] || (e[3] = fe(" 总览 ", -1)),
|
|
803
|
+
h("strong", null, T(p.value.totalRows) + " 行 / " + T(p.value.totalCols) + " 列", 1)
|
|
804
|
+
])
|
|
805
|
+
])) : Vt("", !0)
|
|
806
|
+
]),
|
|
807
|
+
p.value ? (b(), y("div", ar, [
|
|
808
|
+
h("span", cr, [
|
|
809
|
+
h("span", ur, T(he.value), 1),
|
|
810
|
+
e[4] || (e[4] = h("span", {
|
|
811
|
+
class: "lfp-sheet__name-box-caret",
|
|
812
|
+
"aria-hidden": "true"
|
|
813
|
+
}, null, -1))
|
|
814
|
+
]),
|
|
815
|
+
h("div", fr, [
|
|
816
|
+
e[5] || (e[5] = h("span", { class: "lfp-sheet__formula-label" }, "fx", -1)),
|
|
817
|
+
h("span", dr, T(ge.value), 1)
|
|
818
|
+
])
|
|
819
|
+
])) : Vt("", !0),
|
|
820
|
+
p.value ? (b(), y("p", mr, " 共 " + T(p.value.totalRows) + " 行," + T(p.value.totalCols) + " 列。当前展示 " + T(p.value.visibleRows) + " 行、" + T(p.value.visibleCols) + " 列。 ", 1)) : Vt("", !0),
|
|
821
|
+
p.value ? (b(), y("div", pr, [
|
|
822
|
+
h("div", hr, [
|
|
823
|
+
h("table", gr, [
|
|
824
|
+
h("colgroup", null, [
|
|
825
|
+
h("col", {
|
|
826
|
+
style: dt({ width: `${mt}px` })
|
|
827
|
+
}, null, 4),
|
|
828
|
+
(b(!0), y(ut, null, ft(p.value.colWidths, (r, n) => (b(), y("col", {
|
|
829
|
+
key: `col-width-${p.value.visibleColIndexes[n]}`,
|
|
830
|
+
style: dt({ width: `${r}px` })
|
|
831
|
+
}, null, 4))), 128))
|
|
832
|
+
]),
|
|
833
|
+
h("tbody", null, [
|
|
834
|
+
h("tr", br, [
|
|
835
|
+
e[6] || (e[6] = h("th", {
|
|
836
|
+
class: "lfp-sheet__corner-header",
|
|
837
|
+
scope: "col",
|
|
838
|
+
"aria-label": "表格左上角"
|
|
839
|
+
}, null, -1)),
|
|
840
|
+
(b(!0), y(ut, null, ft(p.value.visibleColIndexes, (r) => (b(), y("th", {
|
|
841
|
+
key: `col-header-${r}`,
|
|
842
|
+
class: wt(["lfp-sheet__col-header", {
|
|
843
|
+
"is-first-data-col": r === p.value.firstVisibleCol,
|
|
844
|
+
"is-related": ne(null, r)
|
|
845
|
+
}]),
|
|
846
|
+
scope: "col"
|
|
847
|
+
}, T(be(r)), 3))), 128))
|
|
848
|
+
]),
|
|
849
|
+
(b(!0), y(ut, null, ft(p.value.rows, (r) => (b(), y("tr", {
|
|
850
|
+
key: r.key,
|
|
851
|
+
class: wt(["lfp-sheet__row", { "is-first-row": r.rowIndex === p.value.firstVisibleRow }]),
|
|
852
|
+
style: dt(r.style)
|
|
853
|
+
}, [
|
|
854
|
+
h("th", {
|
|
855
|
+
class: wt(["lfp-sheet__row-header", {
|
|
856
|
+
"is-first-data-row": r.rowIndex === p.value.firstVisibleRow,
|
|
857
|
+
"is-related": ne(r.rowIndex, null)
|
|
858
|
+
}]),
|
|
859
|
+
scope: "row"
|
|
860
|
+
}, T(r.rowIndex + 1), 3),
|
|
861
|
+
(b(!0), y(ut, null, ft(r.cells, (n) => (b(), y("td", {
|
|
862
|
+
key: n.key,
|
|
863
|
+
class: wt({
|
|
864
|
+
"is-first-row": n.rowIndex === p.value.firstVisibleRow,
|
|
865
|
+
"is-first-col": n.colIndex === p.value.firstVisibleCol,
|
|
866
|
+
"is-corner-cell": n.rowIndex === p.value.firstVisibleRow && n.colIndex === p.value.firstVisibleCol,
|
|
867
|
+
"is-selected": H.value === n.key,
|
|
868
|
+
"is-row-active": Qt.value === n.rowIndex || oe() === n.rowIndex,
|
|
869
|
+
"is-col-active": Yt.value === n.colIndex || se() === n.colIndex,
|
|
870
|
+
"is-formula-cell": !!n.formula
|
|
871
|
+
}),
|
|
872
|
+
rowspan: n.rowSpan,
|
|
873
|
+
colspan: n.colSpan,
|
|
874
|
+
style: dt(n.style),
|
|
875
|
+
title: n.formula ? `=${n.formula}` : n.value,
|
|
876
|
+
tabindex: "0",
|
|
877
|
+
onMouseenter: (o) => ht(n.rowIndex, n.colIndex),
|
|
878
|
+
onMouseleave: e[0] || (e[0] = (o) => ht(null, null)),
|
|
879
|
+
onFocus: (o) => ht(n.rowIndex, n.colIndex),
|
|
880
|
+
onBlur: e[1] || (e[1] = (o) => ht(null, null)),
|
|
881
|
+
onClick: (o) => ye(n.key)
|
|
882
|
+
}, [
|
|
883
|
+
n.richHtml ? (b(), y("span", {
|
|
884
|
+
key: 0,
|
|
885
|
+
class: "lfp-sheet__cell-text lfp-sheet__cell-text--rich",
|
|
886
|
+
innerHTML: n.richHtml
|
|
887
|
+
}, null, 8, Fr)) : (b(), y("span", vr, T(n.value), 1))
|
|
888
|
+
], 46, yr))), 128))
|
|
889
|
+
], 6))), 128))
|
|
890
|
+
])
|
|
891
|
+
]),
|
|
892
|
+
h("div", xr, [
|
|
893
|
+
(b(!0), y(ut, null, ft(p.value.images, (r) => (b(), y("div", {
|
|
894
|
+
key: r.key,
|
|
895
|
+
style: dt({
|
|
896
|
+
left: `${r.left}px`,
|
|
897
|
+
top: `${r.top}px`,
|
|
898
|
+
width: `${r.width}px`,
|
|
899
|
+
height: `${r.height}px`
|
|
900
|
+
}),
|
|
901
|
+
class: "lfp-sheet__image-frame"
|
|
902
|
+
}, [
|
|
903
|
+
h("img", {
|
|
904
|
+
class: "lfp-sheet__floating-image",
|
|
905
|
+
src: r.src,
|
|
906
|
+
alt: r.alt,
|
|
907
|
+
style: dt(r.frameStyle)
|
|
908
|
+
}, null, 12, _r)
|
|
909
|
+
], 4))), 128))
|
|
910
|
+
])
|
|
911
|
+
])
|
|
912
|
+
])) : (b(), y("p", Cr, "当前工作表没有可展示的数据。"))
|
|
913
|
+
]));
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
export {
|
|
917
|
+
Tr as default
|
|
918
|
+
};
|