@work-zhanguo/light-file-preview 0.0.10 → 0.0.11

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.
@@ -0,0 +1,576 @@
1
+ import { d as Te, g as Nt, o as Ee, a as Oe, b as d, c as p, f as u, F as V, h as j, e as At, i as re, t as y, n as M, r as H, j as mt } from "./vue2-DiVuCQ1b.js";
2
+ import { r as Be } from "./text-Bqxn_tMI.js";
3
+ const Le = { class: "lfp-document lfp-sheet" }, Fe = { class: "lfp-sheet__toolbar" }, Ue = {
4
+ key: 0,
5
+ class: "lfp-sheet__tabs",
6
+ role: "tablist",
7
+ "aria-label": "工作表切换"
8
+ }, Ve = ["onClick"], je = { class: "lfp-sheet__tab-label" }, Me = { class: "lfp-sheet__tab-meta" }, He = {
9
+ key: 1,
10
+ class: "lfp-sheet__summary"
11
+ }, We = { class: "lfp-sheet__summary-item" }, ze = { class: "lfp-sheet__summary-item" }, Pe = {
12
+ key: 0,
13
+ class: "lfp-sheet__formula-bar"
14
+ }, Ke = { class: "lfp-sheet__name-box" }, Ge = { class: "lfp-sheet__name-box-text" }, qe = { class: "lfp-sheet__formula-input" }, Ze = { class: "lfp-sheet__formula-text" }, Je = {
15
+ key: 1,
16
+ class: "lfp-hint"
17
+ }, Qe = {
18
+ key: 2,
19
+ class: "lfp-sheet__table-wrap"
20
+ }, Ye = { class: "lfp-sheet__grid" }, Xe = { class: "lfp-sheet__table" }, to = { class: "lfp-sheet__header-row" }, eo = ["rowspan", "colspan", "title", "onMouseenter", "onFocus", "onClick"], oo = { class: "lfp-sheet__cell-text" }, no = {
21
+ class: "lfp-sheet__images",
22
+ "aria-hidden": "true"
23
+ }, so = ["src", "alt"], ro = {
24
+ key: 3,
25
+ class: "lfp-sheet__empty"
26
+ }, lo = 28, io = 14, W = 46, gt = 28, Mt = 24, le = 64, uo = /* @__PURE__ */ Te({
27
+ __name: "SheetRenderer",
28
+ props: {
29
+ source: {},
30
+ maxRows: {},
31
+ maxCols: {}
32
+ },
33
+ emits: ["loading", "error"],
34
+ setup(ie, { emit: ae }) {
35
+ const It = ie, Dt = ae, Ht = new AbortController(), Tt = H(0), z = H([]), R = H(""), Et = H(null), Ot = H(null), Bt = H([]), c = Nt(() => z.value[Tt.value]), Wt = Nt(() => {
36
+ var e;
37
+ const t = c.value;
38
+ return !t || !R.value ? null : (e = t.cellMap[R.value]) != null ? e : null;
39
+ }), ce = Nt(() => {
40
+ var t, e;
41
+ return (e = (t = Wt.value) == null ? void 0 : t.address) != null ? e : "A1";
42
+ }), ue = Nt(() => {
43
+ const t = Wt.value;
44
+ return t ? t.formula ? `=${t.formula}` : t.value : "";
45
+ });
46
+ function zt() {
47
+ for (const t of Bt.value)
48
+ URL.revokeObjectURL(t);
49
+ Bt.value = [];
50
+ }
51
+ function fe(t) {
52
+ let e = t + 1, o = "";
53
+ for (; e > 0; ) {
54
+ const n = (e - 1) % 26;
55
+ o = String.fromCharCode(65 + n) + o, e = Math.floor((e - 1) / 26);
56
+ }
57
+ return o;
58
+ }
59
+ function P(t, e) {
60
+ Et.value = t, Ot.value = e;
61
+ }
62
+ function de(t) {
63
+ R.value = t;
64
+ }
65
+ function Pt(t) {
66
+ Tt.value = t;
67
+ const e = z.value[t];
68
+ R.value = e ? `${e.firstVisibleRow}:${e.firstVisibleCol}` : "", P(null, null);
69
+ }
70
+ function Kt(t, e) {
71
+ return t != null && (t === Et.value || t === Gt()) || e != null && (e === Ot.value || e === qt());
72
+ }
73
+ function Gt() {
74
+ if (!R.value)
75
+ return null;
76
+ const [t] = R.value.split(":");
77
+ return Number.isFinite(Number(t)) ? Number(t) : null;
78
+ }
79
+ function qt() {
80
+ if (!R.value)
81
+ return null;
82
+ const [, t] = R.value.split(":");
83
+ return Number.isFinite(Number(t)) ? Number(t) : null;
84
+ }
85
+ function pe(t) {
86
+ if (t) {
87
+ if (["thin", "hair"].includes(t) || ["medium", "dashed", "dotted", "dashDot", "dashDotDot"].includes(t))
88
+ return "1px solid";
89
+ if (["thick", "double", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(t))
90
+ return "2px solid";
91
+ }
92
+ }
93
+ function bt(t) {
94
+ if (!t || typeof t != "object")
95
+ return;
96
+ const e = "rgb" in t && typeof t.rgb == "string" ? t.rgb : "argb" in t && typeof t.argb == "string" ? t.argb : void 0;
97
+ if (!e)
98
+ return;
99
+ const o = e.replace(/^#/, "");
100
+ if (/^[0-9a-fA-F]{8}$/.test(o))
101
+ return `#${o.slice(2)}`;
102
+ if (/^[0-9a-fA-F]{6}$/.test(o))
103
+ return `#${o}`;
104
+ }
105
+ function vt(t, e, o) {
106
+ var s;
107
+ if (!o)
108
+ return;
109
+ const n = pe(o.style), r = (s = bt(o.color)) != null ? s : "rgba(31, 44, 61, 0.12)";
110
+ n && (e === "left" ? t.borderLeft = `${n} ${r}` : e === "right" ? t.borderRight = `${n} ${r}` : e === "top" ? t.borderTop = `${n} ${r}` : e === "bottom" && (t.borderBottom = `${n} ${r}`));
111
+ }
112
+ function Zt(t) {
113
+ 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;
114
+ return Math.max(e != null ? e : Mt, Mt);
115
+ }
116
+ function he(t) {
117
+ return { height: `${Zt(t)}px` };
118
+ }
119
+ function Jt(t) {
120
+ 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) : le;
121
+ }
122
+ function Qt(t) {
123
+ return `${Jt(t)}px`;
124
+ }
125
+ function me(t) {
126
+ const e = {}, o = t == null ? void 0 : t.horizontal, n = t == null ? void 0 : t.vertical;
127
+ o && (e.textAlign = o), n && (e.verticalAlign = n === "center" ? "middle" : n), t != null && t.wrapText && (e.whiteSpace = "pre-wrap", e.wordBreak = "break-word");
128
+ const r = o === "center" ? "center" : o === "right" ? "flex-end" : "flex-start", s = n === "top" ? "flex-start" : n === "bottom" ? "flex-end" : "center";
129
+ return e["--lfp-cell-justify"] = r, 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;
130
+ }
131
+ function ge(t, e, o) {
132
+ var f, b;
133
+ const n = {};
134
+ if (o ? (n.minWidth = o, n.width = o) : e && (n.minWidth = e, n.width = e), !(t != null && t.s) || typeof t.s != "object")
135
+ return n;
136
+ const r = t.s.fill, s = t.s.font, l = t.s.border, a = (f = bt(r == null ? void 0 : r.fgColor)) != null ? f : bt(r == null ? void 0 : r.bgColor), g = bt(s == null ? void 0 : s.color);
137
+ return a && (r == null ? void 0 : r.patternType) !== "none" && (n.backgroundColor = a, n["--lfp-cell-bg"] = a), g && (n.color = g), s != null && s.bold && (n.fontWeight = "700"), s != null && s.italic && (n.fontStyle = "italic"), s != null && s.underline && (n.textDecoration = "underline"), typeof (s == null ? void 0 : s.sz) == "number" && (n.fontSize = `${s.sz}px`), typeof (s == null ? void 0 : s.name) == "string" && s.name.trim() && (n.fontFamily = s.name), Object.assign(n, me(t.s.alignment)), !((b = t.s.alignment) != null && b.horizontal) && typeof (t == null ? void 0 : t.t) == "string" && ["n", "d"].includes(t.t) && (n.textAlign = "right", n["--lfp-cell-justify"] = "flex-end"), vt(n, "left", l == null ? void 0 : l.left), vt(n, "right", l == null ? void 0 : l.right), vt(n, "top", l == null ? void 0 : l.top), vt(n, "bottom", l == null ? void 0 : l.bottom), n;
138
+ }
139
+ async function be(t) {
140
+ try {
141
+ if (typeof createImageBitmap == "function") {
142
+ const e = await createImageBitmap(t), o = { width: e.width, height: e.height };
143
+ return e.close(), o;
144
+ }
145
+ } catch (e) {
146
+ }
147
+ return await new Promise((e) => {
148
+ const o = URL.createObjectURL(t), n = new Image();
149
+ n.onload = () => {
150
+ URL.revokeObjectURL(o), e({ width: n.naturalWidth, height: n.naturalHeight });
151
+ }, n.onerror = () => {
152
+ URL.revokeObjectURL(o), e(null);
153
+ }, n.src = o;
154
+ });
155
+ }
156
+ function ve(t, e) {
157
+ var o, n;
158
+ return e ? typeof e.w == "string" ? e.w : (o = t.utils) != null && o.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}` : "" : "";
159
+ }
160
+ function _e(t, e, o) {
161
+ const n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
162
+ for (const s of t) {
163
+ const l = e.filter((f) => f >= s.s.r && f <= s.e.r), a = o.filter((f) => f >= s.s.c && f <= s.e.c);
164
+ if (!l.length || !a.length)
165
+ continue;
166
+ const g = `${s.s.r}:${s.s.c}`;
167
+ r.set(g, {
168
+ rowSpan: l.length,
169
+ colSpan: a.length,
170
+ colsInRange: a
171
+ });
172
+ for (const f of l)
173
+ for (const b of a)
174
+ f === s.s.r && b === s.s.c || n.add(`${f}:${b}`);
175
+ }
176
+ return { coveredCells: n, mergeStarts: r };
177
+ }
178
+ function Yt(t) {
179
+ return t ? t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : typeof t == "string" ? new TextEncoder().encode(t) : null : null;
180
+ }
181
+ function _t(t) {
182
+ if (!t)
183
+ return "";
184
+ if (typeof t == "string")
185
+ return t;
186
+ const e = Yt(t);
187
+ return e ? new TextDecoder("utf-8").decode(e) : "";
188
+ }
189
+ function yt(t) {
190
+ if (!t.trim())
191
+ return null;
192
+ const e = new DOMParser().parseFromString(t, "application/xml");
193
+ return e.querySelector("parsererror") ? null : e;
194
+ }
195
+ function wt(t, e) {
196
+ var o;
197
+ return t && (o = Array.from(t.children).find((n) => n.localName === e)) != null ? o : null;
198
+ }
199
+ function Lt(t, e) {
200
+ var o;
201
+ return t && (o = Array.from(t.getElementsByTagName("*")).find((n) => n.localName === e)) != null ? o : null;
202
+ }
203
+ function S(t, e) {
204
+ var r, s;
205
+ const o = (s = (r = wt(t, e)) == null ? void 0 : r.textContent) != null ? s : "", n = Number.parseInt(o, 10);
206
+ return Number.isFinite(n) ? n : 0;
207
+ }
208
+ function Xt(t) {
209
+ const e = t.lastIndexOf("/"), o = e >= 0 ? t.slice(0, e) : "", n = e >= 0 ? t.slice(e + 1) : t;
210
+ return `${o}/_rels/${n}.rels`;
211
+ }
212
+ function Ft(t, e) {
213
+ if (!e)
214
+ return t;
215
+ const o = t.split("/");
216
+ o.pop();
217
+ const n = e.split("/");
218
+ for (const r of n)
219
+ !r || r === "." || (r === ".." ? o.pop() : o.push(r));
220
+ return o.join("/");
221
+ }
222
+ function Ut(t, e) {
223
+ var s;
224
+ const o = _t((s = t[e]) == null ? void 0 : s.content), n = yt(o);
225
+ if (!n)
226
+ return {};
227
+ const r = {};
228
+ for (const l of Array.from(n.getElementsByTagName("*"))) {
229
+ if (l.localName !== "Relationship")
230
+ continue;
231
+ const a = l.getAttribute("Id"), g = l.getAttribute("Target");
232
+ a && g && (r[a] = g);
233
+ }
234
+ return r;
235
+ }
236
+ function ye(t) {
237
+ var r;
238
+ const e = "xl/workbook.xml", o = yt(_t((r = t[e]) == null ? void 0 : r.content));
239
+ if (!o)
240
+ return [];
241
+ const n = Ut(t, "xl/_rels/workbook.xml.rels");
242
+ return Array.from(o.getElementsByTagName("*")).filter((s) => s.localName === "sheet").map((s) => {
243
+ var a, g, f, b;
244
+ const l = (g = (a = s.getAttribute("r:id")) != null ? a : s.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id")) != null ? g : "";
245
+ return {
246
+ name: (f = s.getAttribute("name")) != null ? f : "",
247
+ path: Ft(e, (b = n[l]) != null ? b : "")
248
+ };
249
+ }).filter((s) => s.name && s.path);
250
+ }
251
+ function we(t) {
252
+ var o;
253
+ const e = (o = t.split(".").pop()) == null ? void 0 : o.toLowerCase();
254
+ 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";
255
+ }
256
+ function B(t) {
257
+ return t / 9525;
258
+ }
259
+ function xt(t, e, o, n) {
260
+ var s;
261
+ let r = n;
262
+ for (let l = 0; l < t.length; l += 1) {
263
+ if (t[l] === o)
264
+ return r;
265
+ r += (s = e[l]) != null ? s : 0;
266
+ }
267
+ return null;
268
+ }
269
+ function Ct(t, e, o) {
270
+ return Math.min(Math.max(t, e), o);
271
+ }
272
+ async function xe(t, e, o, n, r, s) {
273
+ var kt, Q, Y, X, tt, et, ot, nt, st, rt, lt, it, at;
274
+ const l = yt(_t((kt = t[e]) == null ? void 0 : kt.content));
275
+ if (!l)
276
+ return [];
277
+ const a = Array.from(l.getElementsByTagName("*")).find((h) => h.localName === "drawing");
278
+ if (!a)
279
+ return [];
280
+ const g = (Y = (Q = a.getAttribute("r:id")) != null ? Q : a.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id")) != null ? Y : "";
281
+ if (!g)
282
+ return [];
283
+ const f = Ut(t, Xt(e)), b = Ft(e, (X = f[g]) != null ? X : ""), x = yt(_t((tt = t[b]) == null ? void 0 : tt.content));
284
+ if (!x)
285
+ return [];
286
+ const $ = Ut(t, Xt(b)), K = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map();
287
+ let q = W, Z = gt;
288
+ n.forEach((h, k) => {
289
+ var v;
290
+ K.set(h, q), q += (v = s[k]) != null ? v : le;
291
+ }), o.forEach((h, k) => {
292
+ var v;
293
+ G.set(h, Z), Z += (v = r[k]) != null ? v : Mt;
294
+ });
295
+ const J = q, L = Z, Rt = [], $t = Array.from(x.getElementsByTagName("*")).filter(
296
+ (h) => ["oneCellAnchor", "twoCellAnchor"].includes(h.localName)
297
+ );
298
+ for (const h of $t) {
299
+ const k = Lt(h, "pic"), v = Lt(k, "blip"), i = (ot = (et = v == null ? void 0 : v.getAttribute("r:embed")) != null ? et : v == null ? void 0 : v.getAttributeNS("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "embed")) != null ? ot : "";
300
+ if (!i)
301
+ continue;
302
+ const ct = Ft(b, (nt = $[i]) != null ? nt : ""), I = Yt((st = t[ct]) == null ? void 0 : st.content);
303
+ if (!I)
304
+ continue;
305
+ const D = wt(h, "from"), ut = S(D, "col"), ft = S(D, "row"), dt = xt(n, s, ut, W), pt = xt(o, r, ft, gt);
306
+ if (dt == null || pt == null)
307
+ continue;
308
+ const St = B(S(D, "colOff")), T = B(S(D, "rowOff")), N = dt + St, E = pt + T;
309
+ let w = 160, _ = 120;
310
+ if (h.localName === "twoCellAnchor") {
311
+ const m = wt(h, "to"), ke = S(m, "col"), Se = S(m, "row"), Ne = B(S(m, "colOff")), Ae = B(S(m, "rowOff")), Vt = xt(n, s, ke, W), jt = xt(o, r, Se, gt), Ie = (Vt != null ? Vt : J) + Ne, De = (jt != null ? jt : L) + Ae;
312
+ w = Math.max(Ie - N, 32), _ = Math.max(De - E, 32);
313
+ } else {
314
+ const m = wt(h, "ext");
315
+ w = Math.max(B(Number.parseInt((rt = m == null ? void 0 : m.getAttribute("cx")) != null ? rt : "0", 10)), 32), _ = Math.max(B(Number.parseInt((lt = m == null ? void 0 : m.getAttribute("cy")) != null ? lt : "0", 10)), 32);
316
+ }
317
+ const F = Ct(N, W, J), O = Ct(E, gt, L), A = Ct(N + w, W, J), U = Ct(E + _, gt, L), ht = A - F, te = U - O;
318
+ if (ht <= 6 || te <= 6)
319
+ continue;
320
+ const $e = I.buffer.slice(
321
+ I.byteOffset,
322
+ I.byteOffset + I.byteLength
323
+ ), ee = new Blob([$e], { type: we(ct) }), C = await be(ee), oe = URL.createObjectURL(ee);
324
+ Bt.value.push(oe);
325
+ let ne = w, se = _;
326
+ if (C != null && C.width && (C != null && C.height)) {
327
+ const m = Math.min(w / C.width, _ / C.height);
328
+ Number.isFinite(m) && m > 0 && (ne = Math.max(C.width * m, 1), se = Math.max(C.height * m, 1));
329
+ }
330
+ Rt.push({
331
+ key: `${e}-${ft}-${ut}-${ct}`,
332
+ src: oe,
333
+ alt: (at = (it = Lt(k, "cNvPr")) == null ? void 0 : it.getAttribute("name")) != null ? at : "embedded image",
334
+ left: F,
335
+ top: O,
336
+ width: ht,
337
+ height: te,
338
+ frameStyle: {
339
+ transform: `translate(${F - N}px, ${O - E}px)`,
340
+ width: `${ne}px`,
341
+ height: `${se}px`
342
+ }
343
+ });
344
+ }
345
+ return Rt;
346
+ }
347
+ async function Ce(t, e, o, n, r) {
348
+ var Q, Y, X, tt, et, ot, nt, st, rt, lt, it, at, h, k, v;
349
+ const s = (Q = o["!ref"]) != null ? Q : "A1", l = t.utils.decode_range(s), a = Math.max(Math.min(It.maxRows, Math.max(l.e.r + 1, lo)), 1), g = Math.max(Math.min(It.maxCols, Math.max(l.e.c + 1, io)), 1), f = [], b = [], x = [], $ = [], K = [], G = [];
350
+ for (let i = 0; i <= l.e.r; i += 1)
351
+ (X = (Y = o["!rows"]) == null ? void 0 : Y[i]) != null && X.hidden || f.push(i);
352
+ for (let i = 0; i <= l.e.c; i += 1)
353
+ (et = (tt = o["!cols"]) == null ? void 0 : tt[i]) != null && et.hidden || b.push(i);
354
+ for (let i = 0; i < a; i += 1)
355
+ (nt = (ot = o["!rows"]) == null ? void 0 : ot[i]) != null && nt.hidden || (x.push(i), K.push(Zt((st = o["!rows"]) == null ? void 0 : st[i])));
356
+ for (let i = 0; i < g; i += 1)
357
+ (lt = (rt = o["!cols"]) == null ? void 0 : rt[i]) != null && lt.hidden || ($.push(i), G.push(Jt((it = o["!cols"]) == null ? void 0 : it[i])));
358
+ const q = (at = o["!merges"]) != null ? at : [], { coveredCells: Z, mergeStarts: J } = _e(q, x, $), L = {}, Rt = x.map((i) => {
359
+ var ut, ft, dt, pt, St;
360
+ const ct = (ut = o["!rows"]) == null ? void 0 : ut[i], I = he(ct), D = [];
361
+ for (const T of $) {
362
+ const N = `${i}:${T}`;
363
+ if (Z.has(N))
364
+ continue;
365
+ const E = t.utils.encode_cell({ r: i, c: T }), w = o[E], _ = J.get(N), F = ((ft = _ == null ? void 0 : _.colsInRange) != null ? ft : [T]).map((A) => {
366
+ var U;
367
+ return Qt((U = o["!cols"]) == null ? void 0 : U[A]);
368
+ }).filter(Boolean).reduce((A, U) => {
369
+ const ht = Number.parseFloat(U);
370
+ return Number.isFinite(ht) ? (A != null ? A : 0) + ht : A;
371
+ }, null), O = {
372
+ key: N,
373
+ address: E,
374
+ value: ve(t, w),
375
+ formula: typeof (w == null ? void 0 : w.f) == "string" ? w.f : "",
376
+ rowIndex: i,
377
+ colIndex: T,
378
+ rowSpan: (dt = _ == null ? void 0 : _.rowSpan) != null ? dt : 1,
379
+ colSpan: (pt = _ == null ? void 0 : _.colSpan) != null ? pt : 1,
380
+ style: ge(
381
+ w,
382
+ Qt((St = o["!cols"]) == null ? void 0 : St[T]),
383
+ F ? `${F}px` : void 0
384
+ )
385
+ };
386
+ D.push(O), L[O.key] = O;
387
+ }
388
+ return {
389
+ key: `${e}-${i}`,
390
+ rowIndex: i,
391
+ cells: D,
392
+ style: I
393
+ };
394
+ }), $t = (h = r[e]) != null ? h : "", kt = $t ? await xe(n, $t, x, $, K, G) : [];
395
+ return {
396
+ name: e,
397
+ rows: Rt,
398
+ totalRows: f.length,
399
+ totalCols: b.length,
400
+ visibleRows: x.length,
401
+ visibleCols: $.length,
402
+ visibleRowIndexes: x,
403
+ visibleColIndexes: $,
404
+ firstVisibleRow: (k = x[0]) != null ? k : 0,
405
+ firstVisibleCol: (v = $[0]) != null ? v : 0,
406
+ rowHeights: K,
407
+ colWidths: G,
408
+ images: kt,
409
+ cellMap: L
410
+ };
411
+ }
412
+ async function Re() {
413
+ var t;
414
+ Dt("loading", !0), zt();
415
+ try {
416
+ const e = await Be(It.source, Ht.signal), o = await import("./xlsx-j9Zzywas.js"), n = o.read(e, {
417
+ type: "array",
418
+ cellStyles: !0,
419
+ cellNF: !0,
420
+ cellText: !0,
421
+ cellFormula: !0,
422
+ bookFiles: !0
423
+ }), r = (t = n.files) != null ? t : {}, s = ye(r), l = Object.fromEntries(s.map((a) => [a.name, a.path]));
424
+ z.value = await Promise.all(
425
+ n.SheetNames.map(
426
+ (a) => Ce(
427
+ o,
428
+ a,
429
+ n.Sheets[a],
430
+ r,
431
+ l
432
+ )
433
+ )
434
+ ), Pt(0);
435
+ } catch (e) {
436
+ Dt("error", e instanceof Error ? e : new Error("表格预览失败"));
437
+ } finally {
438
+ Dt("loading", !1);
439
+ }
440
+ }
441
+ return Ee(() => {
442
+ Re();
443
+ }), Oe(() => {
444
+ Ht.abort(), zt();
445
+ }), (t, e) => (d(), p("div", Le, [
446
+ u("div", Fe, [
447
+ z.value.length > 1 ? (d(), p("div", Ue, [
448
+ (d(!0), p(V, null, j(z.value, (o, n) => (d(), p("button", {
449
+ key: o.name,
450
+ class: mt(["lfp-sheet__tab", { "is-active": n === Tt.value }]),
451
+ type: "button",
452
+ onClick: (r) => Pt(n)
453
+ }, [
454
+ u("span", je, y(o.name), 1),
455
+ u("span", Me, y(o.totalRows) + " × " + y(o.totalCols), 1)
456
+ ], 10, Ve))), 128))
457
+ ])) : At("", !0),
458
+ c.value ? (d(), p("div", He, [
459
+ u("span", We, [
460
+ e[2] || (e[2] = re(" 当前工作表 ", -1)),
461
+ u("strong", null, y(c.value.name), 1)
462
+ ]),
463
+ u("span", ze, [
464
+ e[3] || (e[3] = re(" 总览 ", -1)),
465
+ u("strong", null, y(c.value.totalRows) + " 行 / " + y(c.value.totalCols) + " 列", 1)
466
+ ])
467
+ ])) : At("", !0)
468
+ ]),
469
+ c.value ? (d(), p("div", Pe, [
470
+ u("span", Ke, [
471
+ u("span", Ge, y(ce.value), 1),
472
+ e[4] || (e[4] = u("span", {
473
+ class: "lfp-sheet__name-box-caret",
474
+ "aria-hidden": "true"
475
+ }, null, -1))
476
+ ]),
477
+ u("div", qe, [
478
+ e[5] || (e[5] = u("span", { class: "lfp-sheet__formula-label" }, "fx", -1)),
479
+ u("span", Ze, y(ue.value), 1)
480
+ ])
481
+ ])) : At("", !0),
482
+ c.value ? (d(), p("p", Je, " 共 " + y(c.value.totalRows) + " 行," + y(c.value.totalCols) + " 列。当前展示 " + y(c.value.visibleRows) + " 行、" + y(c.value.visibleCols) + " 列。 ", 1)) : At("", !0),
483
+ c.value ? (d(), p("div", Qe, [
484
+ u("div", Ye, [
485
+ u("table", Xe, [
486
+ u("colgroup", null, [
487
+ u("col", {
488
+ style: M({ width: `${W}px` })
489
+ }, null, 4),
490
+ (d(!0), p(V, null, j(c.value.colWidths, (o, n) => (d(), p("col", {
491
+ key: `col-width-${c.value.visibleColIndexes[n]}`,
492
+ style: M({ width: `${o}px` })
493
+ }, null, 4))), 128))
494
+ ]),
495
+ u("tbody", null, [
496
+ u("tr", to, [
497
+ e[6] || (e[6] = u("th", {
498
+ class: "lfp-sheet__corner-header",
499
+ scope: "col",
500
+ "aria-label": "表格左上角"
501
+ }, null, -1)),
502
+ (d(!0), p(V, null, j(c.value.visibleColIndexes, (o) => (d(), p("th", {
503
+ key: `col-header-${o}`,
504
+ class: mt(["lfp-sheet__col-header", {
505
+ "is-first-data-col": o === c.value.firstVisibleCol,
506
+ "is-related": Kt(null, o)
507
+ }]),
508
+ scope: "col"
509
+ }, y(fe(o)), 3))), 128))
510
+ ]),
511
+ (d(!0), p(V, null, j(c.value.rows, (o) => (d(), p("tr", {
512
+ key: o.key,
513
+ class: mt(["lfp-sheet__row", { "is-first-row": o.rowIndex === c.value.firstVisibleRow }]),
514
+ style: M(o.style)
515
+ }, [
516
+ u("th", {
517
+ class: mt(["lfp-sheet__row-header", {
518
+ "is-first-data-row": o.rowIndex === c.value.firstVisibleRow,
519
+ "is-related": Kt(o.rowIndex, null)
520
+ }]),
521
+ scope: "row"
522
+ }, y(o.rowIndex + 1), 3),
523
+ (d(!0), p(V, null, j(o.cells, (n) => (d(), p("td", {
524
+ key: n.key,
525
+ class: mt({
526
+ "is-first-row": n.rowIndex === c.value.firstVisibleRow,
527
+ "is-first-col": n.colIndex === c.value.firstVisibleCol,
528
+ "is-corner-cell": n.rowIndex === c.value.firstVisibleRow && n.colIndex === c.value.firstVisibleCol,
529
+ "is-selected": R.value === n.key,
530
+ "is-row-active": Et.value === n.rowIndex || Gt() === n.rowIndex,
531
+ "is-col-active": Ot.value === n.colIndex || qt() === n.colIndex,
532
+ "is-formula-cell": !!n.formula
533
+ }),
534
+ rowspan: n.rowSpan,
535
+ colspan: n.colSpan,
536
+ style: M(n.style),
537
+ title: n.formula ? `=${n.formula}` : n.value,
538
+ tabindex: "0",
539
+ onMouseenter: (r) => P(n.rowIndex, n.colIndex),
540
+ onMouseleave: e[0] || (e[0] = (r) => P(null, null)),
541
+ onFocus: (r) => P(n.rowIndex, n.colIndex),
542
+ onBlur: e[1] || (e[1] = (r) => P(null, null)),
543
+ onClick: (r) => de(n.key)
544
+ }, [
545
+ u("span", oo, y(n.value), 1)
546
+ ], 46, eo))), 128))
547
+ ], 6))), 128))
548
+ ])
549
+ ]),
550
+ u("div", no, [
551
+ (d(!0), p(V, null, j(c.value.images, (o) => (d(), p("div", {
552
+ key: o.key,
553
+ style: M({
554
+ left: `${o.left}px`,
555
+ top: `${o.top}px`,
556
+ width: `${o.width}px`,
557
+ height: `${o.height}px`
558
+ }),
559
+ class: "lfp-sheet__image-frame"
560
+ }, [
561
+ u("img", {
562
+ class: "lfp-sheet__floating-image",
563
+ src: o.src,
564
+ alt: o.alt,
565
+ style: M(o.frameStyle)
566
+ }, null, 12, so)
567
+ ], 4))), 128))
568
+ ])
569
+ ])
570
+ ])) : (d(), p("p", ro, "当前工作表没有可展示的数据。"))
571
+ ]));
572
+ }
573
+ });
574
+ export {
575
+ uo as default
576
+ };
@@ -1,4 +1,4 @@
1
- import { d as g, g as f, o as h, a as k, b as n, c as a, t as p, e as B, f as w, r as c } from "./vue2-BEoHyqmm.js";
1
+ import { d as g, g as f, o as h, a as k, b as n, c as a, t as p, e as B, f as w, r as c } from "./vue2-DiVuCQ1b.js";
2
2
  import { a as M } from "./text-Bqxn_tMI.js";
3
3
  const C = { class: "lfp-document" }, T = {
4
4
  key: 0,
@@ -1,4 +1,4 @@
1
- import { d as n, b as l, c as o, f as t, t as s, u as i, k as r } from "./vue2-BEoHyqmm.js";
1
+ import { d as n, b as l, c as o, f as t, t as s, u as i, k as r } from "./vue2-DiVuCQ1b.js";
2
2
  const d = { class: "lfp-empty" }, p = { class: "lfp-hint" }, c = /* @__PURE__ */ n({
3
3
  __name: "UnsupportedRenderer",
4
4
  props: {
@@ -1,4 +1,4 @@
1
- import { L as i, v as r } from "./vue2-BEoHyqmm.js";
1
+ import { L as i, v as r } from "./vue2-DiVuCQ1b.js";
2
2
  export {
3
3
  i as LightFilePreviewVue2,
4
4
  r as default