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