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