ooxml-excel-editor 1.1.0

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/LICENSE +21 -0
  3. package/README.md +516 -0
  4. package/dist/chunks/plugin-overlay-Cfnn9EOi.js +7144 -0
  5. package/dist/chunks/worker-client.stub-BQVZfaLd.js +7 -0
  6. package/dist/components/ActionToolbar.vue.d.ts +9 -0
  7. package/dist/components/ExcelViewer.vue.d.ts +283 -0
  8. package/dist/components/ExportDialog.vue.d.ts +14 -0
  9. package/dist/components/FilterPopup.vue.d.ts +21 -0
  10. package/dist/components/FindBar.vue.d.ts +27 -0
  11. package/dist/components/SheetTabs.vue.d.ts +11 -0
  12. package/dist/components/ToolbarMenu.vue.d.ts +10 -0
  13. package/dist/components/ViewerToolbar.vue.d.ts +21 -0
  14. package/dist/components/export-types.d.ts +14 -0
  15. package/dist/components/toolbar-icons.d.ts +7 -0
  16. package/dist/components/toolbar-types.d.ts +18 -0
  17. package/dist/composables/useExcelDocument.d.ts +17 -0
  18. package/dist/composables/worker-client.d.ts +3 -0
  19. package/dist/composables/worker-client.stub.d.ts +3 -0
  20. package/dist/core/edit/commands.d.ts +94 -0
  21. package/dist/core/edit/default-editor.d.ts +2 -0
  22. package/dist/core/edit/edit-controller.d.ts +137 -0
  23. package/dist/core/edit/editor-context.d.ts +40 -0
  24. package/dist/core/edit/editor-host.d.ts +22 -0
  25. package/dist/core/edit/permissions.d.ts +3 -0
  26. package/dist/core/edit/types.d.ts +23 -0
  27. package/dist/core/export/composite.d.ts +18 -0
  28. package/dist/core/export/data-export.d.ts +9 -0
  29. package/dist/core/export/exporter.d.ts +64 -0
  30. package/dist/core/export/index.d.ts +9 -0
  31. package/dist/core/export/paginate.d.ts +36 -0
  32. package/dist/core/export/pdf.d.ts +28 -0
  33. package/dist/core/export/print.d.ts +3 -0
  34. package/dist/core/export/raster.d.ts +13 -0
  35. package/dist/core/export/types.d.ts +92 -0
  36. package/dist/core/export/vector-pdf.d.ts +42 -0
  37. package/dist/core/export/xlsx-writer.d.ts +15 -0
  38. package/dist/core/finalize.d.ts +10 -0
  39. package/dist/core/format/builtin-formats.d.ts +7 -0
  40. package/dist/core/format/color.d.ts +11 -0
  41. package/dist/core/format/date-serial.d.ts +16 -0
  42. package/dist/core/format/number-format.d.ts +5 -0
  43. package/dist/core/formula/engine.d.ts +27 -0
  44. package/dist/core/formula/hyperformula-adapter.d.ts +3 -0
  45. package/dist/core/formula/recalc.d.ts +9 -0
  46. package/dist/core/formula/refs.d.ts +21 -0
  47. package/dist/core/index.d.ts +52 -0
  48. package/dist/core/layout/autofit.d.ts +2 -0
  49. package/dist/core/layout/freeze.d.ts +11 -0
  50. package/dist/core/layout/grid-metrics.d.ts +37 -0
  51. package/dist/core/layout/merges.d.ts +14 -0
  52. package/dist/core/layout/units.d.ts +20 -0
  53. package/dist/core/layout/viewport.d.ts +29 -0
  54. package/dist/core/loader.d.ts +5 -0
  55. package/dist/core/model/clone.d.ts +9 -0
  56. package/dist/core/model/data-access.d.ts +30 -0
  57. package/dist/core/model/mutations.d.ts +46 -0
  58. package/dist/core/model/snapshot.d.ts +14 -0
  59. package/dist/core/model/structure.d.ts +26 -0
  60. package/dist/core/model/types.d.ts +289 -0
  61. package/dist/core/overlay/anchor.d.ts +9 -0
  62. package/dist/core/overlay/chart-mapper.d.ts +3 -0
  63. package/dist/core/overlay/echarts-loader.d.ts +3 -0
  64. package/dist/core/parse.worker.d.ts +14 -0
  65. package/dist/core/parser/chart-parser.d.ts +3 -0
  66. package/dist/core/parser/drawing-parser.d.ts +3 -0
  67. package/dist/core/parser/exceljs-adapter.d.ts +8 -0
  68. package/dist/core/parser/index.d.ts +3 -0
  69. package/dist/core/parser/page-break-parser.d.ts +3 -0
  70. package/dist/core/parser/raw-xml.d.ts +15 -0
  71. package/dist/core/parser/sparkline-parser.d.ts +3 -0
  72. package/dist/core/parser/theme.d.ts +3 -0
  73. package/dist/core/plugin.d.ts +180 -0
  74. package/dist/core/progress.d.ts +7 -0
  75. package/dist/core/render/autofilter.d.ts +14 -0
  76. package/dist/core/render/borders.d.ts +13 -0
  77. package/dist/core/render/canvas-renderer.d.ts +225 -0
  78. package/dist/core/render/conditional.d.ts +25 -0
  79. package/dist/core/render/fills.d.ts +2 -0
  80. package/dist/core/render/text.d.ts +20 -0
  81. package/dist/core/render/theme.d.ts +19 -0
  82. package/dist/core/viewer/controller.d.ts +339 -0
  83. package/dist/core/viewer/overlay-manager.d.ts +27 -0
  84. package/dist/core/viewer/plugin-overlay.d.ts +8 -0
  85. package/dist/core.d.ts +2 -0
  86. package/dist/core.js +74 -0
  87. package/dist/demo-shared/demo-editor.d.ts +2 -0
  88. package/dist/index.d.ts +19 -0
  89. package/dist/index.js +1493 -0
  90. package/dist/react/ExcelViewer.d.ts +153 -0
  91. package/dist/react/index.d.ts +11 -0
  92. package/dist/react/use-excel-document.d.ts +17 -0
  93. package/dist/react.d.ts +2 -0
  94. package/dist/react.js +838 -0
  95. package/dist/style.css +1 -0
  96. package/package.json +117 -0
package/dist/index.js ADDED
@@ -0,0 +1,1493 @@
1
+ import { ref as h, shallowRef as Ge, defineComponent as J, onBeforeUnmount as Re, openBlock as d, createElementBlock as v, createElementVNode as n, toDisplayString as E, withModifiers as ze, createTextVNode as L, createCommentVNode as R, Fragment as W, renderList as oe, computed as T, normalizeClass as U, reactive as rt, withDirectives as O, vModelRadio as ye, vModelSelect as Xe, vModelCheckbox as Ze, onMounted as Fe, normalizeStyle as Qe, vModelText as zt, unref as x, nextTick as Te, watch as V, createBlock as se, renderSlot as Y, createVNode as at } from "vue";
2
+ import { r as dt, l as Ft, d as Dt, f as Vt, a as Pt, h as be, V as It, P as Lt, g as At, s as Ot, b as Bt, c as Nt, e as Ut } from "./chunks/plugin-overlay-Cfnn9EOi.js";
3
+ import { D as Vn, i as Pn, j as In, k as Ln, m as An, n as On, o as Bn, q as Nn, t as Un, u as Hn, v as Wn, p as _n } from "./chunks/plugin-overlay-Cfnn9EOi.js";
4
+ import { p as Ht } from "./chunks/worker-client.stub-BQVZfaLd.js";
5
+ import { definePlugin as Kn } from "./core.js";
6
+ function Wt() {
7
+ const c = h(!1), w = h(null), k = Ge(null), i = h(null), y = Ge(null);
8
+ async function g(r, m) {
9
+ c.value = !0, w.value = null, k.value && dt(k.value), k.value = null, y.value = null, i.value = { stage: "read", ratio: 0 };
10
+ try {
11
+ const f = await Ft(r, (S, P) => {
12
+ i.value = { stage: "read", ratio: P ? S / P : void 0 };
13
+ }), s = Dt(f);
14
+ if (s === "xls") throw new Error("这是旧版 .xls(BIFF) 或加密文件,本预览器只支持 .xlsx/.xlsm。");
15
+ if (s === "not-zip") throw new Error("文件不是有效的 .xlsx(非 ZIP 包)。");
16
+ if (s === "empty") throw new Error("文件为空。");
17
+ let u = await Ht(f, (S) => {
18
+ i.value = S;
19
+ });
20
+ m && (u = m(u) ?? u), Vt(u), y.value = f.slice(0), k.value = u;
21
+ } catch (f) {
22
+ w.value = f != null && f.message && /预览器|损坏|加密|为空|ZIP/.test(f.message) ? f.message : Pt(f), console.error("[ooxml-preview] 解析失败:", f);
23
+ } finally {
24
+ c.value = !1, i.value = null;
25
+ }
26
+ }
27
+ return { loading: c, error: w, workbook: k, load: g, progress: i, sourceBuffer: y };
28
+ }
29
+ const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = { class: "export-wrap" }, jt = {
30
+ key: 0,
31
+ class: "menu"
32
+ }, Xt = { class: "zoom" }, Zt = ["value"], Gt = ["value"], Qt = ["value"], Yt = /* @__PURE__ */ J({
33
+ __name: "ViewerToolbar",
34
+ props: {
35
+ fileName: {},
36
+ sheetCount: {},
37
+ zoom: {}
38
+ },
39
+ emits: ["update:zoom", "export-image", "export-pdf", "export-pdf-vector", "print", "open-settings"],
40
+ setup(c, { emit: w }) {
41
+ const k = w, i = [0.5, 0.75, 1, 1.25, 1.5, 2];
42
+ function y(s) {
43
+ k("update:zoom", Math.min(3, Math.max(0.3, s)));
44
+ }
45
+ const g = h(!1);
46
+ function r() {
47
+ g.value = !g.value;
48
+ }
49
+ function m(s) {
50
+ g.value = !1, k(s === "export-image" ? "export-image" : s === "export-pdf" ? "export-pdf" : s === "export-pdf-vector" ? "export-pdf-vector" : s === "print" ? "print" : "open-settings");
51
+ }
52
+ function f(s) {
53
+ var u;
54
+ (u = s.target) != null && u.closest(".export-wrap") || (g.value = !1);
55
+ }
56
+ return typeof document < "u" && document.addEventListener("click", f), Re(() => {
57
+ typeof document < "u" && document.removeEventListener("click", f);
58
+ }), (s, u) => (d(), v("div", _t, [
59
+ n("span", {
60
+ class: "file",
61
+ title: c.fileName
62
+ }, E(c.fileName || "未命名工作簿"), 9, qt),
63
+ n("span", Kt, E(c.sheetCount) + " 个工作表", 1),
64
+ u[10] || (u[10] = n("div", { class: "spacer" }, null, -1)),
65
+ n("div", Jt, [
66
+ n("button", {
67
+ class: "export-btn",
68
+ onClick: ze(r, ["stop"]),
69
+ title: "导出 / 打印"
70
+ }, [...u[8] || (u[8] = [
71
+ L(" 导出 ", -1),
72
+ n("span", { class: "caret" }, "▾", -1)
73
+ ])]),
74
+ g.value ? (d(), v("div", jt, [
75
+ n("button", {
76
+ onClick: u[0] || (u[0] = (S) => m("export-image"))
77
+ }, "导出为图片 (PNG)"),
78
+ n("button", {
79
+ onClick: u[1] || (u[1] = (S) => m("export-pdf"))
80
+ }, "导出为 PDF (位图)"),
81
+ n("button", {
82
+ onClick: u[2] || (u[2] = (S) => m("export-pdf-vector"))
83
+ }, "导出为 PDF (矢量·文字可选)"),
84
+ n("button", {
85
+ onClick: u[3] || (u[3] = (S) => m("print"))
86
+ }, "打印…"),
87
+ u[9] || (u[9] = n("div", { class: "sep" }, null, -1)),
88
+ n("button", {
89
+ onClick: u[4] || (u[4] = (S) => m("open-settings"))
90
+ }, "导出设置…")
91
+ ])) : R("", !0)
92
+ ]),
93
+ n("div", Xt, [
94
+ n("button", {
95
+ onClick: u[5] || (u[5] = (S) => y(c.zoom - 0.1)),
96
+ title: "缩小"
97
+ }, "−"),
98
+ n("select", {
99
+ value: c.zoom,
100
+ onChange: u[6] || (u[6] = (S) => y(parseFloat(S.target.value)))
101
+ }, [
102
+ (d(), v(W, null, oe(i, (S) => n("option", {
103
+ key: S,
104
+ value: S
105
+ }, E(Math.round(S * 100)) + "%", 9, Gt)), 64)),
106
+ i.includes(c.zoom) ? R("", !0) : (d(), v("option", {
107
+ key: 0,
108
+ value: c.zoom
109
+ }, E(Math.round(c.zoom * 100)) + "%", 9, Qt))
110
+ ], 40, Zt),
111
+ n("button", {
112
+ onClick: u[7] || (u[7] = (S) => y(c.zoom + 0.1)),
113
+ title: "放大"
114
+ }, "+")
115
+ ])
116
+ ]));
117
+ }
118
+ }), j = (c, w) => {
119
+ const k = c.__vccOpts || c;
120
+ for (const [i, y] of w)
121
+ k[i] = y;
122
+ return k;
123
+ }, el = /* @__PURE__ */ j(Yt, [["__scopeId", "data-v-0495df21"]]), tl = { class: "sheet-tabs" }, ll = ["onClick", "title"], nl = /* @__PURE__ */ J({
124
+ __name: "SheetTabs",
125
+ props: {
126
+ workbook: {},
127
+ active: {}
128
+ },
129
+ emits: ["select"],
130
+ setup(c, { emit: w }) {
131
+ const k = c, i = w, y = T(() => k.workbook.sheets.filter((g) => g.state === "visible"));
132
+ return (g, r) => (d(), v("div", tl, [
133
+ (d(!0), v(W, null, oe(y.value, (m) => (d(), v("button", {
134
+ key: m.index,
135
+ class: U(["tab", { active: m.index === c.active }]),
136
+ onClick: (f) => i("select", m.index),
137
+ title: m.name
138
+ }, E(m.name), 11, ll))), 128))
139
+ ]));
140
+ }
141
+ }), sl = /* @__PURE__ */ j(nl, [["__scopeId", "data-v-431b6f9c"]]), ol = {
142
+ class: "dlg",
143
+ role: "dialog",
144
+ "aria-label": "导出设置"
145
+ }, al = { class: "dlg-head" }, il = { class: "dlg-body" }, ul = { class: "field" }, rl = { class: "opts" }, dl = ["disabled"], cl = {
146
+ key: 0,
147
+ class: "hint"
148
+ }, vl = {
149
+ key: 1,
150
+ class: "hint"
151
+ }, fl = { class: "field" }, pl = { class: "field" }, ml = { class: "opts inline" }, gl = { class: "field" }, yl = { class: "opts" }, kl = { class: "field" }, bl = { class: "opts inline" }, Cl = { class: "dlg-foot" }, xl = /* @__PURE__ */ J({
152
+ __name: "ExportDialog",
153
+ props: {
154
+ selection: {},
155
+ sheetCount: {}
156
+ },
157
+ emits: ["close", "export"],
158
+ setup(c, { emit: w }) {
159
+ const k = c, i = w, y = T(() => {
160
+ const f = k.selection;
161
+ return !!f && !(f.top === f.bottom && f.left === f.right);
162
+ }), g = T(() => {
163
+ const f = k.selection;
164
+ return f ? `${be(f.left)}${f.top + 1}:${be(f.right)}${f.bottom + 1}` : "";
165
+ }), r = rt({
166
+ action: "png",
167
+ scope: y.value ? "selection" : "sheet",
168
+ scale: 2,
169
+ includeHeaders: !1,
170
+ gridlines: !0,
171
+ format: "auto",
172
+ orientation: "auto",
173
+ fitToWidth: !0,
174
+ pdfVector: !1
175
+ });
176
+ function m(f) {
177
+ i("export", { ...r, action: f });
178
+ }
179
+ return (f, s) => (d(), v("div", {
180
+ class: "dlg-mask",
181
+ onClick: s[16] || (s[16] = ze((u) => i("close"), ["self"]))
182
+ }, [
183
+ n("div", ol, [
184
+ n("div", al, [
185
+ s[17] || (s[17] = n("span", null, "导出 / 打印设置", -1)),
186
+ n("button", {
187
+ class: "x",
188
+ onClick: s[0] || (s[0] = (u) => i("close")),
189
+ title: "关闭"
190
+ }, "×")
191
+ ]),
192
+ n("div", il, [
193
+ n("div", ul, [
194
+ s[20] || (s[20] = n("label", { class: "lbl" }, "范围", -1)),
195
+ n("div", rl, [
196
+ n("label", {
197
+ class: U({ disabled: !y.value })
198
+ }, [
199
+ O(n("input", {
200
+ type: "radio",
201
+ value: "selection",
202
+ "onUpdate:modelValue": s[1] || (s[1] = (u) => r.scope = u),
203
+ disabled: !y.value
204
+ }, null, 8, dl), [
205
+ [ye, r.scope]
206
+ ]),
207
+ s[18] || (s[18] = L(" 当前选区 ", -1)),
208
+ y.value ? (d(), v("span", cl, E(g.value), 1)) : (d(), v("span", vl, "(未选多格)"))
209
+ ], 2),
210
+ n("label", null, [
211
+ O(n("input", {
212
+ type: "radio",
213
+ value: "sheet",
214
+ "onUpdate:modelValue": s[2] || (s[2] = (u) => r.scope = u)
215
+ }, null, 512), [
216
+ [ye, r.scope]
217
+ ]),
218
+ s[19] || (s[19] = L(" 当前工作表", -1))
219
+ ]),
220
+ n("label", null, [
221
+ O(n("input", {
222
+ type: "radio",
223
+ value: "all",
224
+ "onUpdate:modelValue": s[3] || (s[3] = (u) => r.scope = u)
225
+ }, null, 512), [
226
+ [ye, r.scope]
227
+ ]),
228
+ L(" 全部工作表 (" + E(c.sheetCount) + ")", 1)
229
+ ])
230
+ ])
231
+ ]),
232
+ n("div", fl, [
233
+ s[22] || (s[22] = n("label", { class: "lbl" }, "清晰度", -1)),
234
+ O(n("select", {
235
+ "onUpdate:modelValue": s[4] || (s[4] = (u) => r.scale = u)
236
+ }, [...s[21] || (s[21] = [
237
+ n("option", { value: 1 }, "标准 (1×)", -1),
238
+ n("option", { value: 2 }, "高清 (2×)", -1),
239
+ n("option", { value: 3 }, "超清 (3×)", -1)
240
+ ])], 512), [
241
+ [
242
+ Xe,
243
+ r.scale,
244
+ void 0,
245
+ { number: !0 }
246
+ ]
247
+ ])
248
+ ]),
249
+ n("div", pl, [
250
+ s[25] || (s[25] = n("label", { class: "lbl" }, "内容", -1)),
251
+ n("div", ml, [
252
+ n("label", null, [
253
+ O(n("input", {
254
+ type: "checkbox",
255
+ "onUpdate:modelValue": s[5] || (s[5] = (u) => r.includeHeaders = u)
256
+ }, null, 512), [
257
+ [Ze, r.includeHeaders]
258
+ ]),
259
+ s[23] || (s[23] = L(" 含行列号", -1))
260
+ ]),
261
+ n("label", null, [
262
+ O(n("input", {
263
+ type: "checkbox",
264
+ "onUpdate:modelValue": s[6] || (s[6] = (u) => r.gridlines = u)
265
+ }, null, 512), [
266
+ [Ze, r.gridlines]
267
+ ]),
268
+ s[24] || (s[24] = L(" 网格线", -1))
269
+ ])
270
+ ])
271
+ ]),
272
+ n("div", gl, [
273
+ s[30] || (s[30] = n("label", { class: "lbl" }, "PDF 类型", -1)),
274
+ n("div", yl, [
275
+ n("label", null, [
276
+ O(n("input", {
277
+ type: "radio",
278
+ value: !1,
279
+ "onUpdate:modelValue": s[7] || (s[7] = (u) => r.pdfVector = u)
280
+ }, null, 512), [
281
+ [ye, r.pdfVector]
282
+ ]),
283
+ s[26] || (s[26] = L(" 位图 ", -1)),
284
+ s[27] || (s[27] = n("span", { class: "hint" }, "(完整还原观感)", -1))
285
+ ]),
286
+ n("label", null, [
287
+ O(n("input", {
288
+ type: "radio",
289
+ value: !0,
290
+ "onUpdate:modelValue": s[8] || (s[8] = (u) => r.pdfVector = u)
291
+ }, null, 512), [
292
+ [ye, r.pdfVector]
293
+ ]),
294
+ s[28] || (s[28] = L(" 矢量 ", -1)),
295
+ s[29] || (s[29] = n("span", { class: "hint" }, "(文字可选可搜·清晰·文件小;中文需注册字体,否则该格转图)", -1))
296
+ ])
297
+ ])
298
+ ]),
299
+ n("div", kl, [
300
+ s[34] || (s[34] = n("label", { class: "lbl" }, [
301
+ L("纸张 "),
302
+ n("span", { class: "hint" }, "(PDF/打印)")
303
+ ], -1)),
304
+ n("div", bl, [
305
+ O(n("select", {
306
+ "onUpdate:modelValue": s[9] || (s[9] = (u) => r.format = u)
307
+ }, [...s[31] || (s[31] = [
308
+ n("option", { value: "auto" }, "自动(跟随表)", -1),
309
+ n("option", { value: "a4" }, "A4", -1),
310
+ n("option", { value: "a3" }, "A3", -1),
311
+ n("option", { value: "letter" }, "Letter", -1)
312
+ ])], 512), [
313
+ [Xe, r.format]
314
+ ]),
315
+ O(n("select", {
316
+ "onUpdate:modelValue": s[10] || (s[10] = (u) => r.orientation = u)
317
+ }, [...s[32] || (s[32] = [
318
+ n("option", { value: "auto" }, "方向: 自动", -1),
319
+ n("option", { value: "portrait" }, "纵向", -1),
320
+ n("option", { value: "landscape" }, "横向", -1)
321
+ ])], 512), [
322
+ [Xe, r.orientation]
323
+ ]),
324
+ n("label", null, [
325
+ O(n("input", {
326
+ type: "checkbox",
327
+ "onUpdate:modelValue": s[11] || (s[11] = (u) => r.fitToWidth = u)
328
+ }, null, 512), [
329
+ [Ze, r.fitToWidth]
330
+ ]),
331
+ s[33] || (s[33] = L(" 适应页宽", -1))
332
+ ])
333
+ ])
334
+ ])
335
+ ]),
336
+ n("div", Cl, [
337
+ n("button", {
338
+ class: "ghost",
339
+ onClick: s[12] || (s[12] = (u) => i("close"))
340
+ }, "取消"),
341
+ s[35] || (s[35] = n("div", { class: "grow" }, null, -1)),
342
+ n("button", {
343
+ onClick: s[13] || (s[13] = (u) => m("png"))
344
+ }, "导出 PNG"),
345
+ n("button", {
346
+ onClick: s[14] || (s[14] = (u) => m("pdf"))
347
+ }, "导出 PDF"),
348
+ n("button", {
349
+ class: "primary",
350
+ onClick: s[15] || (s[15] = (u) => m("print"))
351
+ }, "打印…")
352
+ ])
353
+ ])
354
+ ]));
355
+ }
356
+ }), hl = /* @__PURE__ */ j(xl, [["__scopeId", "data-v-544df24f"]]), wl = ["value"], $l = ["disabled"], El = ["disabled"], Sl = /* @__PURE__ */ J({
357
+ __name: "FindBar",
358
+ props: {
359
+ query: {},
360
+ matchCount: {},
361
+ current: {},
362
+ matchCase: { type: Boolean },
363
+ wholeCell: { type: Boolean }
364
+ },
365
+ emits: ["update:query", "update:matchCase", "update:wholeCell", "next", "prev", "close"],
366
+ setup(c, { expose: w, emit: k }) {
367
+ const i = k, y = h(null);
368
+ Fe(() => {
369
+ var r;
370
+ return (r = y.value) == null ? void 0 : r.focus();
371
+ });
372
+ function g(r) {
373
+ var m;
374
+ (r.ctrlKey || r.metaKey) && (r.key === "f" || r.key === "F") ? (r.preventDefault(), (m = y.value) == null || m.select()) : r.key === "Enter" ? (r.preventDefault(), r.shiftKey ? i("prev") : i("next")) : r.key === "Escape" && (r.preventDefault(), i("close"));
375
+ }
376
+ return w({ focus: () => {
377
+ var r;
378
+ return (r = y.value) == null ? void 0 : r.focus();
379
+ } }), (r, m) => (d(), v("div", {
380
+ class: "find-bar",
381
+ onKeydown: m[6] || (m[6] = ze(() => {
382
+ }, ["stop"]))
383
+ }, [
384
+ n("input", {
385
+ ref_key: "inputEl",
386
+ ref: y,
387
+ class: "q",
388
+ type: "text",
389
+ placeholder: "查找…",
390
+ value: c.query,
391
+ onInput: m[0] || (m[0] = (f) => i("update:query", f.target.value)),
392
+ onKeydown: g
393
+ }, null, 40, wl),
394
+ n("span", {
395
+ class: U(["count", { none: c.query && c.matchCount === 0 }])
396
+ }, E(c.matchCount ? `${c.current + 1}/${c.matchCount}` : c.query ? "无结果" : ""), 3),
397
+ n("button", {
398
+ class: U(["opt", { on: c.matchCase }]),
399
+ title: "区分大小写",
400
+ onClick: m[1] || (m[1] = (f) => i("update:matchCase", !c.matchCase))
401
+ }, "Aa", 2),
402
+ n("button", {
403
+ class: U(["opt", { on: c.wholeCell }]),
404
+ title: "全字匹配(整格相等)",
405
+ onClick: m[2] || (m[2] = (f) => i("update:wholeCell", !c.wholeCell))
406
+ }, "▢", 2),
407
+ n("button", {
408
+ class: "nav",
409
+ title: "上一个 (Shift+Enter)",
410
+ disabled: !c.matchCount,
411
+ onClick: m[3] || (m[3] = (f) => i("prev"))
412
+ }, "▲", 8, $l),
413
+ n("button", {
414
+ class: "nav",
415
+ title: "下一个 (Enter)",
416
+ disabled: !c.matchCount,
417
+ onClick: m[4] || (m[4] = (f) => i("next"))
418
+ }, "▼", 8, El),
419
+ n("button", {
420
+ class: "close",
421
+ title: "关闭 (Esc)",
422
+ onClick: m[5] || (m[5] = (f) => i("close"))
423
+ }, "×")
424
+ ], 32));
425
+ }
426
+ }), Ml = /* @__PURE__ */ j(Sl, [["__scopeId", "data-v-36abc020"]]), Tl = { class: "sort" }, Rl = { class: "all" }, zl = ["checked"], Fl = { class: "list" }, Dl = ["checked", "onChange"], Vl = ["title"], Pl = {
427
+ key: 0,
428
+ class: "empty"
429
+ }, Il = { class: "foot" }, Ll = /* @__PURE__ */ J({
430
+ __name: "FilterPopup",
431
+ props: {
432
+ values: {},
433
+ selected: {},
434
+ x: {},
435
+ y: {},
436
+ sortDir: {}
437
+ },
438
+ emits: ["apply", "clear", "close", "sort"],
439
+ setup(c, { emit: w }) {
440
+ const k = c, i = w, y = h(""), g = rt(new Set(k.selected.length ? k.selected : k.values)), r = T(() => {
441
+ const D = y.value.trim().toLowerCase();
442
+ return D ? k.values.filter(($) => $.toLowerCase().includes(D)) : k.values;
443
+ }), m = T(() => r.value.length > 0 && r.value.every((D) => g.has(D)));
444
+ function f(D) {
445
+ g.has(D) ? g.delete(D) : g.add(D);
446
+ }
447
+ function s() {
448
+ const D = !m.value;
449
+ for (const $ of r.value) D ? g.add($) : g.delete($);
450
+ }
451
+ function u() {
452
+ i("apply", [...g]);
453
+ }
454
+ const S = h(null);
455
+ function P(D) {
456
+ S.value && !S.value.contains(D.target) && i("close");
457
+ }
458
+ return Fe(() => setTimeout(() => document.addEventListener("mousedown", P), 0)), Re(() => document.removeEventListener("mousedown", P)), (D, $) => (d(), v("div", {
459
+ class: "filter-pop",
460
+ ref_key: "rootEl",
461
+ ref: S,
462
+ style: Qe({ left: c.x + "px", top: c.y + "px" }),
463
+ onKeydown: $[5] || ($[5] = ze(() => {
464
+ }, ["stop"]))
465
+ }, [
466
+ n("div", Tl, [
467
+ n("button", {
468
+ class: U({ on: c.sortDir === "asc" }),
469
+ onClick: $[0] || ($[0] = (b) => i("sort", "asc")),
470
+ title: "升序"
471
+ }, "↑ 升序", 2),
472
+ n("button", {
473
+ class: U({ on: c.sortDir === "desc" }),
474
+ onClick: $[1] || ($[1] = (b) => i("sort", "desc")),
475
+ title: "降序"
476
+ }, "↓ 降序", 2)
477
+ ]),
478
+ O(n("input", {
479
+ class: "search",
480
+ type: "text",
481
+ placeholder: "搜索…",
482
+ "onUpdate:modelValue": $[2] || ($[2] = (b) => y.value = b)
483
+ }, null, 512), [
484
+ [zt, y.value]
485
+ ]),
486
+ n("label", Rl, [
487
+ n("input", {
488
+ type: "checkbox",
489
+ checked: m.value,
490
+ onChange: s
491
+ }, null, 40, zl),
492
+ $[6] || ($[6] = L(" (全选) ", -1))
493
+ ]),
494
+ n("div", Fl, [
495
+ (d(!0), v(W, null, oe(r.value, (b) => (d(), v("label", {
496
+ key: b,
497
+ class: "row"
498
+ }, [
499
+ n("input", {
500
+ type: "checkbox",
501
+ checked: g.has(b),
502
+ onChange: (_) => f(b)
503
+ }, null, 40, Dl),
504
+ n("span", {
505
+ class: "val",
506
+ title: b
507
+ }, E(b), 9, Vl)
508
+ ]))), 128)),
509
+ r.value.length ? R("", !0) : (d(), v("div", Pl, "无匹配值"))
510
+ ]),
511
+ n("div", Il, [
512
+ n("button", {
513
+ class: "link",
514
+ onClick: $[3] || ($[3] = (b) => i("clear"))
515
+ }, "清除筛选"),
516
+ $[7] || ($[7] = n("div", { class: "grow" }, null, -1)),
517
+ n("button", {
518
+ onClick: $[4] || ($[4] = (b) => i("close"))
519
+ }, "取消"),
520
+ n("button", {
521
+ class: "primary",
522
+ onClick: u
523
+ }, "确定")
524
+ ])
525
+ ], 36));
526
+ }
527
+ }), Al = /* @__PURE__ */ j(Ll, [["__scopeId", "data-v-4b0bc283"]]), Me = {
528
+ // 放大镜
529
+ find: '<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>',
530
+ // 漏斗
531
+ filter: '<path d="M3 5h18l-7 8.5V20l-4-2.2V13.5z"/>',
532
+ // 漏斗 + 斜杠(清除筛选)
533
+ "clear-filter": '<path d="M3 5h18l-7 8.5V20l-4-2.2V13.5z"/><line x1="3" y1="3" x2="21" y2="21"/>',
534
+ // 上下箭头(排序)
535
+ sort: '<path d="M7 16l3 3 3-3"/><line x1="10" y1="19" x2="10" y2="5"/><path d="M17 8l-3-3-3 3"/><line x1="14" y1="5" x2="14" y2="19"/>',
536
+ // 下载(导出)
537
+ export: '<line x1="12" y1="3" x2="12" y2="15"/><path d="M8 11l4 4 4-4"/><path d="M4 19h16"/>',
538
+ // 放大镜带 +
539
+ zoom: '<circle cx="10" cy="10" r="6"/><line x1="20" y1="20" x2="14.5" y2="14.5"/><line x1="10" y1="7.5" x2="10" y2="12.5"/><line x1="7.5" y1="10" x2="12.5" y2="10"/>',
540
+ // 两个叠框(复制)
541
+ copy: '<rect x="9" y="9" width="11" height="11" rx="1.5"/><path d="M5 15H4V5a1 1 0 0 1 1-1h10v1"/>',
542
+ // 十字线(冻结行列)
543
+ freeze: '<line x1="3" y1="9" x2="21" y2="9"/><line x1="9" y1="3" x2="9" y2="21"/>',
544
+ // 三点(更多)
545
+ more: '<circle cx="5" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.6" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.6" fill="currentColor" stroke="none"/>',
546
+ // 下拉小箭头
547
+ caret: '<path d="M6 9l6 6 6-6"/>'
548
+ };
549
+ function ke(c) {
550
+ return '<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' + c + "</svg>";
551
+ }
552
+ const Ol = { class: "tb-menu" }, Bl = {
553
+ key: 0,
554
+ class: "sep"
555
+ }, Nl = ["disabled", "onClick"], Ul = ["innerHTML"], Hl = {
556
+ key: 1,
557
+ class: "ic-e"
558
+ }, Wl = { class: "lb" }, _l = /* @__PURE__ */ J({
559
+ __name: "ToolbarMenu",
560
+ props: {
561
+ items: {}
562
+ },
563
+ emits: ["pick"],
564
+ setup(c, { emit: w }) {
565
+ const k = w;
566
+ return (i, y) => (d(), v("div", Ol, [
567
+ (d(!0), v(W, null, oe(c.items, (g) => (d(), v(W, {
568
+ key: g.id
569
+ }, [
570
+ g.type === "separator" ? (d(), v("div", Bl)) : (d(), v("button", {
571
+ key: 1,
572
+ class: U(["mi", { active: g.active }]),
573
+ disabled: g.disabled,
574
+ onClick: (r) => k("pick", g)
575
+ }, [
576
+ g.iconSvg ? (d(), v("span", {
577
+ key: 0,
578
+ class: "ic",
579
+ innerHTML: x(ke)(g.iconSvg)
580
+ }, null, 8, Ul)) : g.icon ? (d(), v("span", Hl, E(g.icon), 1)) : R("", !0),
581
+ n("span", Wl, E(g.label || g.id), 1)
582
+ ], 10, Nl))
583
+ ], 64))), 128))
584
+ ]));
585
+ }
586
+ }), it = /* @__PURE__ */ j(_l, [["__scopeId", "data-v-322e2c67"]]), ql = {
587
+ key: 0,
588
+ class: "divider"
589
+ }, Kl = {
590
+ key: 1,
591
+ class: "tool"
592
+ }, Jl = ["innerHTML"], jl = {
593
+ key: 1,
594
+ class: "ic-e"
595
+ }, Xl = {
596
+ key: 2,
597
+ class: "lb"
598
+ }, Zl = ["innerHTML"], Gl = {
599
+ key: 0,
600
+ class: "divider"
601
+ }, Ql = {
602
+ key: 1,
603
+ class: "dd"
604
+ }, Yl = ["disabled", "title", "onClick"], en = ["innerHTML"], tn = {
605
+ key: 1,
606
+ class: "ic-e"
607
+ }, ln = {
608
+ key: 2,
609
+ class: "lb"
610
+ }, nn = ["innerHTML"], sn = {
611
+ key: 0,
612
+ class: "dd more"
613
+ }, on = ["innerHTML"], an = 46, ut = 4, un = /* @__PURE__ */ J({
614
+ __name: "ActionToolbar",
615
+ props: {
616
+ items: {}
617
+ },
618
+ setup(c) {
619
+ const w = c, k = h(null), i = h(null), y = h([]), g = h(0), r = h(null);
620
+ function m() {
621
+ var z;
622
+ const C = i.value;
623
+ C && (y.value = Array.from(C.children).map((p) => p.offsetWidth), g.value = ((z = k.value) == null ? void 0 : z.clientWidth) ?? 0);
624
+ }
625
+ const f = T(() => {
626
+ const C = g.value, z = y.value;
627
+ if (!C || z.length !== w.items.length) return w.items.length;
628
+ let p = 0, A = !0;
629
+ for (let B = 0; B < w.items.length; B++)
630
+ if (p += z[B] + ut, p > C) {
631
+ A = !1;
632
+ break;
633
+ }
634
+ if (A) return w.items.length;
635
+ let xe = an, q = 0;
636
+ for (let B = 0; B < w.items.length && (xe += z[B] + ut, !(xe > C)); B++)
637
+ q++;
638
+ return Math.max(0, q);
639
+ }), s = T(() => w.items.slice(0, f.value)), u = T(() => w.items.slice(f.value)), S = Me.more;
640
+ function P(C) {
641
+ r.value = r.value === C ? null : C;
642
+ }
643
+ function D(C) {
644
+ var z;
645
+ C.disabled || (z = C.onClick) == null || z.call(C);
646
+ }
647
+ function $(C) {
648
+ var z;
649
+ C.disabled || ((z = C.items) != null && z.length ? P(C.id) : (D(C), r.value = null));
650
+ }
651
+ function b(C) {
652
+ D(C), r.value = null;
653
+ }
654
+ function _(C) {
655
+ return C.iconSvg ? ke(C.iconSvg) : null;
656
+ }
657
+ let H = null;
658
+ function Ce(C) {
659
+ k.value && !k.value.contains(C.target) && (r.value = null);
660
+ }
661
+ return Fe(() => {
662
+ Te(m), H = new ResizeObserver(() => {
663
+ var C;
664
+ return g.value = ((C = k.value) == null ? void 0 : C.clientWidth) ?? 0;
665
+ }), k.value && H.observe(k.value), document.addEventListener("mousedown", Ce);
666
+ }), Re(() => {
667
+ H == null || H.disconnect(), document.removeEventListener("mousedown", Ce);
668
+ }), V(
669
+ () => w.items.map((C) => C.id + (C.label ?? "")).join("|"),
670
+ () => Te(m)
671
+ ), (C, z) => (d(), v("div", {
672
+ class: "action-toolbar",
673
+ ref_key: "containerEl",
674
+ ref: k
675
+ }, [
676
+ n("div", {
677
+ class: "measure",
678
+ ref_key: "measureEl",
679
+ ref: i,
680
+ "aria-hidden": "true"
681
+ }, [
682
+ (d(!0), v(W, null, oe(c.items, (p) => (d(), v(W, {
683
+ key: "m" + p.id
684
+ }, [
685
+ p.type === "separator" ? (d(), v("span", ql)) : (d(), v("button", Kl, [
686
+ _(p) ? (d(), v("span", {
687
+ key: 0,
688
+ class: "ic",
689
+ innerHTML: _(p)
690
+ }, null, 8, Jl)) : p.icon ? (d(), v("span", jl, E(p.icon), 1)) : R("", !0),
691
+ p.label ? (d(), v("span", Xl, E(p.label), 1)) : R("", !0),
692
+ p.items ? (d(), v("span", {
693
+ key: 3,
694
+ class: "caret",
695
+ innerHTML: x(ke)(x(Me).caret)
696
+ }, null, 8, Zl)) : R("", !0)
697
+ ]))
698
+ ], 64))), 128))
699
+ ], 512),
700
+ (d(!0), v(W, null, oe(s.value, (p) => (d(), v(W, {
701
+ key: p.id
702
+ }, [
703
+ p.type === "separator" ? (d(), v("span", Gl)) : (d(), v("div", Ql, [
704
+ n("button", {
705
+ class: U(["tool", { active: p.active, open: r.value === p.id }]),
706
+ disabled: p.disabled,
707
+ title: p.title || p.label || p.id,
708
+ onClick: (A) => $(p)
709
+ }, [
710
+ _(p) ? (d(), v("span", {
711
+ key: 0,
712
+ class: "ic",
713
+ innerHTML: _(p)
714
+ }, null, 8, en)) : p.icon ? (d(), v("span", tn, E(p.icon), 1)) : R("", !0),
715
+ p.label ? (d(), v("span", ln, E(p.label), 1)) : R("", !0),
716
+ p.items ? (d(), v("span", {
717
+ key: 3,
718
+ class: "caret",
719
+ innerHTML: x(ke)(x(Me).caret)
720
+ }, null, 8, nn)) : R("", !0)
721
+ ], 10, Yl),
722
+ p.items && r.value === p.id ? (d(), se(it, {
723
+ key: 0,
724
+ items: p.items,
725
+ onPick: b
726
+ }, null, 8, ["items"])) : R("", !0)
727
+ ]))
728
+ ], 64))), 128)),
729
+ u.value.length ? (d(), v("div", sn, [
730
+ n("button", {
731
+ class: U(["tool", { open: r.value === "__more" }]),
732
+ title: "更多",
733
+ onClick: z[0] || (z[0] = (p) => P("__more"))
734
+ }, [
735
+ n("span", {
736
+ class: "ic",
737
+ innerHTML: x(ke)(x(S))
738
+ }, null, 8, on)
739
+ ], 2),
740
+ r.value === "__more" ? (d(), se(it, {
741
+ key: 0,
742
+ items: u.value,
743
+ onPick: b
744
+ }, null, 8, ["items"])) : R("", !0)
745
+ ])) : R("", !0)
746
+ ], 512));
747
+ }
748
+ }), rn = /* @__PURE__ */ j(un, [["__scopeId", "data-v-0a4aa655"]]), dn = {
749
+ key: 2,
750
+ class: "formula-bar"
751
+ }, cn = { class: "addr" }, vn = ["title"], fn = { class: "ov-slot" }, pn = {
752
+ key: 3,
753
+ class: "state"
754
+ }, mn = { class: "loader" }, gn = { class: "loader-label" }, yn = { key: 0 }, kn = { class: "loader-track" }, bn = {
755
+ key: 1,
756
+ class: "loader-fill indeterminate"
757
+ }, Cn = {
758
+ key: 4,
759
+ class: "state error"
760
+ }, xn = {
761
+ key: 5,
762
+ class: "state hint"
763
+ }, hn = {
764
+ key: 3,
765
+ class: "status-bar"
766
+ }, wn = { class: "sel" }, $n = { key: 1 }, En = /* @__PURE__ */ J({
767
+ __name: "ExcelViewer",
768
+ props: {
769
+ src: {},
770
+ fileName: {},
771
+ theme: {},
772
+ transformModel: {},
773
+ cellStyle: {},
774
+ openLinks: { type: Boolean, default: !0 },
775
+ plugins: {},
776
+ toolbar: { type: [Boolean, Array], default: !0 },
777
+ editable: { type: Boolean },
778
+ cellReadOnly: {},
779
+ readOnlyRanges: {},
780
+ editor: {},
781
+ recalc: { type: Boolean },
782
+ formulaEngine: {}
783
+ },
784
+ emits: ["rendered", "error", "progress", "cell-click", "cell-dblclick", "selection-change", "sheet-change", "hyperlink-click", "cell-change", "edit-start", "edit-commit", "dim-change", "dirty-change", "image-change", "struct-change"],
785
+ setup(c, { expose: w, emit: k }) {
786
+ const i = c, y = T(() => i.plugins ?? []), g = T(
787
+ () => Object.assign({}, ...y.value.map((e) => e.theme || {}), i.theme || {})
788
+ ), r = T(() => !!i.cellStyle || y.value.some((e) => e.cellStyle));
789
+ function m(e, l) {
790
+ let o;
791
+ const a = (M) => {
792
+ const F = M == null ? void 0 : M(e, l);
793
+ F && (o = { ...o || {}, ...F });
794
+ };
795
+ for (const M of y.value) a(M.cellStyle);
796
+ return a(i.cellStyle), o;
797
+ }
798
+ function f(e) {
799
+ let l = e;
800
+ for (const o of y.value) o.transformModel && (l = o.transformModel(l) ?? l);
801
+ return i.transformModel && (l = i.transformModel(l) ?? l), l;
802
+ }
803
+ const s = T(() => ({
804
+ editable: i.editable,
805
+ cellReadOnly: i.cellReadOnly,
806
+ readOnlyRanges: i.readOnlyRanges,
807
+ recalc: i.recalc,
808
+ formulaEngine: i.formulaEngine
809
+ }));
810
+ function u(e, l) {
811
+ var a, M;
812
+ const o = (a = i.editor) == null ? void 0 : a.call(i, e, l);
813
+ if (o) return o;
814
+ for (const F of y.value) {
815
+ const K = (M = F.editor) == null ? void 0 : M.call(F, e, l);
816
+ if (K) return K;
817
+ }
818
+ }
819
+ const S = T(() => !!i.editor || y.value.some((e) => e.editor)), P = k, { loading: D, error: $, workbook: b, load: _, progress: H, sourceBuffer: Ce } = Wt(), C = T(() => {
820
+ const e = H.value;
821
+ return e ? e.stage === "read" ? "读取文件…" : e.stage === "parse" ? "解析中…" : "构建表格…" : "";
822
+ }), z = T(() => {
823
+ const e = H.value;
824
+ return e && e.ratio != null ? Math.round(e.ratio * 100) : null;
825
+ }), p = h(0), A = h(1), xe = h(null), q = h(null), B = h(null), ae = h(null), De = h(null), Ve = h(null), Pe = h(null), Ie = h(null), ee = Ge(null), ct = h({ scrollX: 0, scrollY: 0, width: 0, height: 0, zoom: 1 }), he = T(() => {
826
+ const e = b.value;
827
+ return e ? e.sheets[p.value] ?? e.sheets[0] ?? null : null;
828
+ }), ie = h(0), Le = h(null), Ae = h(null);
829
+ let t = null;
830
+ function we() {
831
+ t == null || t.render();
832
+ }
833
+ function vt() {
834
+ t == null || t.measure();
835
+ }
836
+ function Oe() {
837
+ const e = he.value, l = b.value;
838
+ !e || !l || !t || (t.rebuild(e, l, A.value, {
839
+ theme: g.value,
840
+ cellStyle: r.value ? m : void 0
841
+ }), t.setSourceBuffer(Ce.value));
842
+ }
843
+ function ft() {
844
+ const e = ae.value;
845
+ e && (X.value = null, t == null || t.setScroll(e.scrollLeft, e.scrollTop));
846
+ }
847
+ let ue = null;
848
+ Fe(() => {
849
+ ot(), B.value && q.value && ae.value && Le.value && Ae.value && De.value && Ve.value && Pe.value && Ie.value && (t = new It(
850
+ {
851
+ canvas: B.value,
852
+ renderArea: q.value,
853
+ scroller: ae.value,
854
+ spacer: Le.value,
855
+ overlays: { main: De.value, frow: Ve.value, fcol: Pe.value, corner: Ie.value },
856
+ editorSlot: Ae.value
857
+ },
858
+ {
859
+ onRenderer: (e) => ee.value = e,
860
+ onRenderTick: () => ie.value++,
861
+ onSelectionChange: () => te.value++,
862
+ onCellClick: (e, l, o) => ne("cell-click", { row: e, col: l, text: o }),
863
+ onCellDblClick: (e, l, o) => ne("cell-dblclick", { row: e, col: l, text: o }),
864
+ onHyperlink: (e, l) => {
865
+ ne("hyperlink-click", { url: e, cell: l }), i.openLinks && window.open(e, "_blank", "noopener");
866
+ },
867
+ onTooltip: (e) => X.value = e,
868
+ onFindChange: () => We.value++,
869
+ onFilterChange: () => _e.value++,
870
+ onEditEvent: (e, l) => ne(e, l)
871
+ }
872
+ ), ct.value = t.view, t.fileName = i.fileName, t.setEditConfig(s.value), t.setEditorResolver(S.value ? u : void 0)), je.value && (Q = new Lt(je.value)), i.src && _(i.src, f), ue = new ResizeObserver(() => {
873
+ vt(), we();
874
+ }), q.value && ue.observe(q.value);
875
+ }), Re(() => {
876
+ ue == null || ue.disconnect(), t == null || t.dispose(), Q == null || Q.dispose(), Se.forEach((e) => e()), b.value && dt(b.value);
877
+ }), V(() => i.src, (e) => {
878
+ e && _(e, f);
879
+ }), V(() => i.fileName, (e) => {
880
+ t && (t.fileName = e);
881
+ }), V(s, (e) => t == null ? void 0 : t.setEditConfig(e)), V([() => i.editor, y], () => t == null ? void 0 : t.setEditorResolver(S.value ? u : void 0)), V(
882
+ () => [g.value, i.cellStyle, i.plugins],
883
+ () => {
884
+ ee.value && Oe();
885
+ },
886
+ { deep: !0 }
887
+ ), V(() => i.plugins, () => ot(), { deep: !1 }), V(b, async (e) => {
888
+ e && (t == null || t.clearFilterState(), p.value = e.activeSheet, await Te(), Oe(), P("rendered", e));
889
+ }), V(p, (e) => {
890
+ const l = b.value;
891
+ l != null && l.sheets[e] && ne("sheet-change", { index: e, name: l.sheets[e].name });
892
+ }), V($, (e) => {
893
+ e && P("error", e);
894
+ }), V(H, (e) => {
895
+ e && P("progress", e);
896
+ }), V(p, async (e, l) => {
897
+ var o;
898
+ l != null && (t == null || t.resetFilter((o = b.value) == null ? void 0 : o.sheets[l])), await Te(), Oe();
899
+ }), V(A, (e) => t == null ? void 0 : t.setZoom(e));
900
+ const te = h(0), X = h(null), le = T(() => (te.value, ee.value, (t == null ? void 0 : t.getSelection()) ?? null)), Be = T(() => {
901
+ te.value;
902
+ const e = t == null ? void 0 : t.getActiveCell();
903
+ return e ? be(e.col) + (e.row + 1) : "";
904
+ }), Ye = T(() => {
905
+ const e = le.value;
906
+ return !e || e.top === e.bottom && e.left === e.right ? "" : `${be(e.left)}${e.top + 1}:${be(e.right)}${e.bottom + 1}`;
907
+ }), et = T(() => {
908
+ te.value;
909
+ const e = ee.value, l = t == null ? void 0 : t.getActiveCell();
910
+ return !e || !l ? "" : e.cellFormula(l.row, l.col) ?? e.cellText(l.row, l.col);
911
+ }), N = T(() => {
912
+ te.value;
913
+ const e = ee.value, l = (t == null ? void 0 : t.getSelection()) ?? null;
914
+ return e && l ? e.selectionStats(l) : null;
915
+ });
916
+ function $e(e) {
917
+ return isFinite(e) ? e.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "—";
918
+ }
919
+ function pt(e) {
920
+ t == null || t.onMouseDown(e);
921
+ }
922
+ function mt(e) {
923
+ t == null || t.onMouseMove(e);
924
+ }
925
+ function gt(e) {
926
+ t == null || t.onMouseUp(e);
927
+ }
928
+ function yt() {
929
+ t == null || t.onMouseLeave();
930
+ }
931
+ function kt(e) {
932
+ t == null || t.onDblClick(e);
933
+ }
934
+ function bt(e) {
935
+ t == null || t.onKeyDown(e);
936
+ }
937
+ V(le, (e) => {
938
+ const l = t == null ? void 0 : t.getActiveCell();
939
+ e && l && ne("selection-change", { range: e, active: l });
940
+ });
941
+ function Ne(e, l) {
942
+ return (t == null ? void 0 : t.rectOf(e, l)) ?? null;
943
+ }
944
+ function Ue(e) {
945
+ return (t == null ? void 0 : t.rectOfRange(e)) ?? null;
946
+ }
947
+ const Ct = (e) => t.exportImage(e), re = (e) => t.downloadImage(e), xt = (e) => t.exportPdf(e), de = (e) => t.downloadPdf(e), ce = (e) => t.print(e);
948
+ async function tt() {
949
+ try {
950
+ await de();
951
+ } catch (e) {
952
+ He(e);
953
+ }
954
+ }
955
+ async function lt() {
956
+ try {
957
+ await de({ vector: !0 });
958
+ } catch (e) {
959
+ He(e);
960
+ }
961
+ }
962
+ function He(e) {
963
+ const l = (e == null ? void 0 : e.message) || String(e);
964
+ P("error", l), typeof window < "u" && window.alert && window.alert(l);
965
+ }
966
+ const ve = h(!1), We = h(0), fe = T(() => (We.value, (t == null ? void 0 : t.getFindState()) ?? { query: "", matchCase: !1, wholeCell: !1, count: 0, index: -1 }));
967
+ function nt() {
968
+ ve.value = !0;
969
+ }
970
+ function st() {
971
+ var e;
972
+ ve.value = !1, t == null || t.clearFind(), (e = ae.value) == null || e.focus();
973
+ }
974
+ function ht(e) {
975
+ (e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(), nt());
976
+ }
977
+ const _e = h(0), Z = T(() => (_e.value, (t == null ? void 0 : t.getFilterPopup()) ?? null));
978
+ function wt() {
979
+ t == null || t.toggleAutoFilter();
980
+ }
981
+ function $t() {
982
+ const e = he.value, l = ee.value;
983
+ if (!e || !l) return;
984
+ const o = e.freeze;
985
+ if (o.frozenRows || o.frozenCols)
986
+ e.freeze = { frozenRows: 0, frozenCols: 0 };
987
+ else {
988
+ const a = t == null ? void 0 : t.getActiveCell();
989
+ e.freeze = { frozenRows: a ? a.row : 1, frozenCols: a ? a.col : 0 };
990
+ }
991
+ l.rebuildMetrics(), t == null || t.refreshContentSize(), we();
992
+ }
993
+ const pe = h(!1);
994
+ async function Et(e) {
995
+ pe.value = !1;
996
+ const l = e.scope === "all" ? "all" : "active", o = e.scope === "selection" ? le.value ?? void 0 : void 0, a = {
997
+ target: l,
998
+ range: o,
999
+ scale: e.scale,
1000
+ includeHeaders: e.includeHeaders,
1001
+ gridlines: e.gridlines
1002
+ }, M = {
1003
+ ...e.format !== "auto" ? { format: e.format } : {},
1004
+ ...e.orientation !== "auto" ? { orientation: e.orientation } : {},
1005
+ fitToWidth: e.fitToWidth
1006
+ };
1007
+ try {
1008
+ e.action === "png" ? await re(a) : e.action === "pdf" ? await de({ ...a, ...M, vector: e.pdfVector }) : await ce({ ...a, ...M });
1009
+ } catch (F) {
1010
+ He(F);
1011
+ }
1012
+ }
1013
+ function St(e) {
1014
+ t == null || t.setSelectionRange(e);
1015
+ }
1016
+ const me = {
1017
+ load: (e) => _(e, f),
1018
+ getWorkbook: () => b.value,
1019
+ getActiveSheet: () => p.value,
1020
+ setActiveSheet: (e) => {
1021
+ var l;
1022
+ (l = b.value) != null && l.sheets[e] && (p.value = e);
1023
+ },
1024
+ getSelection: () => le.value,
1025
+ setSelection: St,
1026
+ rectOf: Ne,
1027
+ rectOfRange: Ue,
1028
+ redraw: () => we(),
1029
+ isCellEditable: (e, l) => (t == null ? void 0 : t.isCellEditable(e, l)) ?? !1,
1030
+ editCell: (e, l, o) => (t == null ? void 0 : t.editCell(e, l, o)) ?? !1,
1031
+ editRange: (e, l) => (t == null ? void 0 : t.editRange(e, l)) ?? !1,
1032
+ clearRange: (e) => (t == null ? void 0 : t.clearRange(e)) ?? !1,
1033
+ setStyle: (e, l) => (t == null ? void 0 : t.setStyle(e, l)) ?? !1,
1034
+ getImages: () => (t == null ? void 0 : t.getImages()) ?? [],
1035
+ addImage: (e) => (t == null ? void 0 : t.addImage(e)) ?? -1,
1036
+ removeImage: (e) => (t == null ? void 0 : t.removeImage(e)) ?? !1,
1037
+ moveImage: (e, l, o) => (t == null ? void 0 : t.moveImage(e, l, o)) ?? !1,
1038
+ resizeImage: (e, l, o) => (t == null ? void 0 : t.resizeImage(e, l, o)) ?? !1,
1039
+ insertRows: (e, l) => (t == null ? void 0 : t.insertRows(e, l)) ?? !1,
1040
+ deleteRows: (e, l) => (t == null ? void 0 : t.deleteRows(e, l)) ?? !1,
1041
+ insertCols: (e, l) => (t == null ? void 0 : t.insertCols(e, l)) ?? !1,
1042
+ deleteCols: (e, l) => (t == null ? void 0 : t.deleteCols(e, l)) ?? !1,
1043
+ undo: () => t == null ? void 0 : t.undo(),
1044
+ redo: () => t == null ? void 0 : t.redo(),
1045
+ canUndo: () => (t == null ? void 0 : t.canUndo()) ?? !1,
1046
+ canRedo: () => (t == null ? void 0 : t.canRedo()) ?? !1,
1047
+ getEditingCell: () => (t == null ? void 0 : t.getEditingCell()) ?? null,
1048
+ getCellSnapshot: (e, l) => (t == null ? void 0 : t.getCellSnapshot(e, l)) ?? null,
1049
+ beginEdit: (e, l) => (t == null ? void 0 : t.beginEdit(e, l)) ?? !1,
1050
+ cancelEdit: () => t == null ? void 0 : t.cancelEdit(),
1051
+ isEditing: () => (t == null ? void 0 : t.isEditing()) ?? !1,
1052
+ setColumnWidth: (e, l) => (t == null ? void 0 : t.setColumnWidth(e, l)) ?? !1,
1053
+ setRowHeight: (e, l) => (t == null ? void 0 : t.setRowHeight(e, l)) ?? !1,
1054
+ isRecalcReady: () => (t == null ? void 0 : t.isRecalcReady()) ?? !1,
1055
+ isDirty: () => (t == null ? void 0 : t.isDirty()) ?? !1,
1056
+ resetToOriginal: () => (t == null ? void 0 : t.resetToOriginal()) ?? !1,
1057
+ exportImage: Ct,
1058
+ downloadImage: re,
1059
+ exportPdf: xt,
1060
+ downloadPdf: de,
1061
+ print: ce,
1062
+ exportXlsx: (e) => t.exportXlsx(e),
1063
+ downloadXlsx: (e) => t.downloadXlsx(e),
1064
+ exportJson: (e) => (t == null ? void 0 : t.exportJson(e)) ?? "{}",
1065
+ downloadJson: (e) => t == null ? void 0 : t.downloadJson(e),
1066
+ exportCsv: (e) => (t == null ? void 0 : t.exportCsv(e)) ?? "",
1067
+ downloadCsv: (e) => t == null ? void 0 : t.downloadCsv(e),
1068
+ // ---- 数据读取(委托独立函数,自动绑 date1904 + 默认当前表) ----
1069
+ getCellValue: (e, l, o) => {
1070
+ const a = ge(o);
1071
+ return a ? Ut(a, e, l) : null;
1072
+ },
1073
+ getCellText: (e, l, o) => {
1074
+ var M;
1075
+ const a = ge(o);
1076
+ return a ? Nt(a, e, l, ((M = b.value) == null ? void 0 : M.date1904) ?? !1) : "";
1077
+ },
1078
+ getSheetData: (e, l) => {
1079
+ const o = ge(l);
1080
+ return o ? Bt(o, qe(e)) : [];
1081
+ },
1082
+ getSheetJSON: (e, l) => {
1083
+ const o = ge(l);
1084
+ return o ? Ot(o, qe(e)) : [];
1085
+ },
1086
+ getRangeData: (e, l, o) => {
1087
+ const a = ge(o);
1088
+ return a ? At(a, e, qe(l)) : [];
1089
+ }
1090
+ };
1091
+ function ge(e) {
1092
+ const l = b.value;
1093
+ return l ? l.sheets[e ?? p.value] ?? null : null;
1094
+ }
1095
+ function qe(e) {
1096
+ var l;
1097
+ return { ...e, date1904: ((l = b.value) == null ? void 0 : l.date1904) ?? !1 };
1098
+ }
1099
+ w(me);
1100
+ const G = (e) => Me[e];
1101
+ function I(e) {
1102
+ return { kind: "builtin", ...e };
1103
+ }
1104
+ function Mt(e) {
1105
+ var l, o;
1106
+ switch (e) {
1107
+ case "find":
1108
+ return I({
1109
+ id: e,
1110
+ iconSvg: G("find"),
1111
+ label: "查找",
1112
+ title: "查找 (Ctrl+F)",
1113
+ active: ve.value,
1114
+ onClick: () => ve.value ? st() : nt()
1115
+ });
1116
+ case "filter":
1117
+ return I({
1118
+ id: e,
1119
+ iconSvg: G("filter"),
1120
+ label: "筛选",
1121
+ title: "切换自动筛选",
1122
+ active: !!((l = he.value) != null && l.autoFilterRange),
1123
+ onClick: wt
1124
+ });
1125
+ case "clear-filter":
1126
+ return I({
1127
+ id: e,
1128
+ iconSvg: G("clear-filter"),
1129
+ label: "清除筛选",
1130
+ title: "清除当前表全部筛选",
1131
+ disabled: !(t != null && t.hasFilters()),
1132
+ onClick: () => t == null ? void 0 : t.clearAllFilters()
1133
+ });
1134
+ case "copy":
1135
+ return I({
1136
+ id: e,
1137
+ iconSvg: G("copy"),
1138
+ label: "复制",
1139
+ title: "复制选区 (Ctrl+C)",
1140
+ disabled: !le.value,
1141
+ onClick: () => void (t == null ? void 0 : t.copySelection())
1142
+ });
1143
+ case "freeze": {
1144
+ const a = (o = he.value) == null ? void 0 : o.freeze;
1145
+ return I({
1146
+ id: e,
1147
+ iconSvg: G("freeze"),
1148
+ label: "冻结",
1149
+ title: "冻结/取消冻结(在活动单元格)",
1150
+ active: !!(a && (a.frozenRows || a.frozenCols)),
1151
+ onClick: $t
1152
+ });
1153
+ }
1154
+ case "export":
1155
+ return I({
1156
+ id: e,
1157
+ iconSvg: G("export"),
1158
+ label: "导出",
1159
+ title: "导出 / 打印",
1160
+ items: [
1161
+ I({ id: "export-png", label: "导出为图片 (PNG)", onClick: () => void re() }),
1162
+ I({ id: "export-pdf", label: "导出为 PDF (位图)", onClick: tt }),
1163
+ I({ id: "export-pdf-vector", label: "导出为 PDF (矢量·文字可选)", onClick: lt }),
1164
+ I({ id: "export-print", label: "打印…", onClick: () => void ce() }),
1165
+ I({ id: "export-sep", type: "separator" }),
1166
+ I({ id: "export-settings", label: "导出设置…", onClick: () => pe.value = !0 })
1167
+ ]
1168
+ });
1169
+ case "zoom":
1170
+ return I({
1171
+ id: e,
1172
+ iconSvg: G("zoom"),
1173
+ label: Math.round(A.value * 100) + "%",
1174
+ title: "缩放",
1175
+ items: [50, 75, 100, 125, 150, 200].map(
1176
+ (a) => I({ id: "zoom-" + a, label: a + "%", active: Math.round(A.value * 100) === a, onClick: () => A.value = a / 100 })
1177
+ )
1178
+ });
1179
+ default:
1180
+ return null;
1181
+ }
1182
+ }
1183
+ function Ke(e, l) {
1184
+ var o, a, M;
1185
+ return {
1186
+ id: e.id,
1187
+ type: e.type,
1188
+ iconSvg: e.iconSvg,
1189
+ icon: e.icon,
1190
+ label: e.label,
1191
+ title: e.title,
1192
+ active: !!((o = e.active) != null && o.call(e, me)),
1193
+ disabled: !!((a = e.disabled) != null && a.call(e, me)),
1194
+ onClick: e.onClick ? () => e.onClick(me) : void 0,
1195
+ items: (M = e.items) == null ? void 0 : M.map((F) => Ke(F, l)),
1196
+ kind: l
1197
+ };
1198
+ }
1199
+ const Je = T(() => {
1200
+ if (ie.value, te.value, We.value, _e.value, i.toolbar === !1) return [];
1201
+ const e = Array.isArray(i.toolbar) ? i.toolbar : ["find", "filter"], l = [];
1202
+ for (const o of e)
1203
+ if (typeof o == "string")
1204
+ if (o === "separator" || o === "|") l.push({ id: "sep-" + l.length, type: "separator", kind: "builtin" });
1205
+ else {
1206
+ const a = Mt(o);
1207
+ a && l.push(a);
1208
+ }
1209
+ else
1210
+ l.push(Ke(o, "custom"));
1211
+ for (const o of y.value)
1212
+ for (const a of o.toolbar ?? []) l.push(Ke(a, "plugin"));
1213
+ return l;
1214
+ }), Tt = T(() => i.toolbar !== !1 && Je.value.length > 0), Ee = /* @__PURE__ */ new Map();
1215
+ let Se = [];
1216
+ function ne(e, l) {
1217
+ var o;
1218
+ P(e, l), (o = Ee.get(e)) == null || o.forEach((a) => a(l));
1219
+ }
1220
+ function ot() {
1221
+ var o;
1222
+ Se.forEach((a) => a()), Se = [], Ee.clear();
1223
+ const e = (a, M) => {
1224
+ let F = Ee.get(a);
1225
+ F || Ee.set(a, F = /* @__PURE__ */ new Set()), F.add(M);
1226
+ }, l = { viewer: me, on: e, redraw: () => we() };
1227
+ for (const a of y.value) {
1228
+ if (a.events)
1229
+ for (const [F, K] of Object.entries(a.events)) K && e(F, K);
1230
+ const M = (o = a.setup) == null ? void 0 : o.call(a, l);
1231
+ typeof M == "function" && Se.push(M);
1232
+ }
1233
+ }
1234
+ const je = h(null);
1235
+ let Q = null;
1236
+ function Rt() {
1237
+ const e = { rectOf: Ne, rectOfRange: Ue, tick: ie.value, workbook: b.value };
1238
+ Q == null || Q.render(y.value, e);
1239
+ }
1240
+ return V([ie, y], Rt, { flush: "post" }), (e, l) => (d(), v("div", {
1241
+ class: "excel-viewer",
1242
+ ref_key: "rootEl",
1243
+ ref: xe,
1244
+ onKeydown: ht
1245
+ }, [
1246
+ x(b) ? Y(e.$slots, "header", {
1247
+ key: 0,
1248
+ workbook: x(b),
1249
+ zoom: A.value,
1250
+ setZoom: (o) => A.value = o,
1251
+ downloadImage: re,
1252
+ downloadPdf: de,
1253
+ print: ce
1254
+ }, () => [
1255
+ at(el, {
1256
+ "file-name": c.fileName,
1257
+ "sheet-count": x(b).sheets.filter((o) => o.state === "visible").length,
1258
+ zoom: A.value,
1259
+ "onUpdate:zoom": l[0] || (l[0] = (o) => A.value = o),
1260
+ onExportImage: l[1] || (l[1] = (o) => re()),
1261
+ onExportPdf: tt,
1262
+ onExportPdfVector: lt,
1263
+ onPrint: l[2] || (l[2] = (o) => ce()),
1264
+ onOpenSettings: l[3] || (l[3] = (o) => pe.value = !0)
1265
+ }, null, 8, ["file-name", "sheet-count", "zoom"])
1266
+ ], !0) : R("", !0),
1267
+ x(b) && Tt.value ? Y(e.$slots, "toolbar", {
1268
+ key: 1,
1269
+ items: Je.value
1270
+ }, () => [
1271
+ at(rn, { items: Je.value }, null, 8, ["items"])
1272
+ ], !0) : R("", !0),
1273
+ x(b) ? (d(), v("div", dn, [
1274
+ n("span", cn, E(Be.value || "—"), 1),
1275
+ l[15] || (l[15] = n("span", { class: "fx" }, "fx", -1)),
1276
+ n("span", {
1277
+ class: "content",
1278
+ title: et.value
1279
+ }, E(et.value), 9, vn)
1280
+ ])) : R("", !0),
1281
+ n("div", {
1282
+ class: "render-area",
1283
+ ref_key: "renderAreaEl",
1284
+ ref: q
1285
+ }, [
1286
+ n("canvas", {
1287
+ ref_key: "canvasEl",
1288
+ ref: B,
1289
+ class: "grid-canvas"
1290
+ }, null, 512),
1291
+ n("div", {
1292
+ class: "ov",
1293
+ ref_key: "ovMain",
1294
+ ref: De
1295
+ }, null, 512),
1296
+ n("div", {
1297
+ class: "ov",
1298
+ ref_key: "ovFCol",
1299
+ ref: Pe
1300
+ }, null, 512),
1301
+ n("div", {
1302
+ class: "ov",
1303
+ ref_key: "ovFRow",
1304
+ ref: Ve
1305
+ }, null, 512),
1306
+ n("div", {
1307
+ class: "ov",
1308
+ ref_key: "ovCorner",
1309
+ ref: Ie
1310
+ }, null, 512),
1311
+ n("div", {
1312
+ class: "scroller",
1313
+ ref_key: "scrollerEl",
1314
+ ref: ae,
1315
+ tabindex: "0",
1316
+ onScroll: ft,
1317
+ onMousedown: pt,
1318
+ onMousemove: mt,
1319
+ onMouseup: gt,
1320
+ onMouseleave: yt,
1321
+ onDblclick: kt,
1322
+ onKeydown: bt
1323
+ }, [
1324
+ n("div", {
1325
+ class: "spacer",
1326
+ ref_key: "spacerEl",
1327
+ ref: Le
1328
+ }, null, 512)
1329
+ ], 544),
1330
+ ve.value && x(b) ? (d(), se(Ml, {
1331
+ key: 0,
1332
+ query: fe.value.query,
1333
+ "match-count": fe.value.count,
1334
+ current: fe.value.index,
1335
+ "match-case": fe.value.matchCase,
1336
+ "whole-cell": fe.value.wholeCell,
1337
+ "onUpdate:query": l[4] || (l[4] = (o) => {
1338
+ var a;
1339
+ return (a = x(t)) == null ? void 0 : a.setFindQuery(o);
1340
+ }),
1341
+ "onUpdate:matchCase": l[5] || (l[5] = (o) => {
1342
+ var a;
1343
+ return (a = x(t)) == null ? void 0 : a.setFindMatchCase(o);
1344
+ }),
1345
+ "onUpdate:wholeCell": l[6] || (l[6] = (o) => {
1346
+ var a;
1347
+ return (a = x(t)) == null ? void 0 : a.setFindWholeCell(o);
1348
+ }),
1349
+ onNext: l[7] || (l[7] = (o) => {
1350
+ var a;
1351
+ return (a = x(t)) == null ? void 0 : a.findNext();
1352
+ }),
1353
+ onPrev: l[8] || (l[8] = (o) => {
1354
+ var a;
1355
+ return (a = x(t)) == null ? void 0 : a.findPrev();
1356
+ }),
1357
+ onClose: st
1358
+ }, null, 8, ["query", "match-count", "current", "match-case", "whole-cell"])) : R("", !0),
1359
+ Z.value ? (d(), se(Al, {
1360
+ key: 1,
1361
+ values: Z.value.values,
1362
+ selected: Z.value.selected,
1363
+ x: Z.value.x,
1364
+ y: Z.value.y,
1365
+ "sort-dir": Z.value.sortDir,
1366
+ onApply: l[9] || (l[9] = (o) => {
1367
+ var a;
1368
+ return (a = x(t)) == null ? void 0 : a.applyFilterSelection(o);
1369
+ }),
1370
+ onClear: l[10] || (l[10] = (o) => {
1371
+ var a;
1372
+ return (a = x(t)) == null ? void 0 : a.clearFilterColumn();
1373
+ }),
1374
+ onClose: l[11] || (l[11] = (o) => {
1375
+ var a;
1376
+ return (a = x(t)) == null ? void 0 : a.closeFilterPopup();
1377
+ }),
1378
+ onSort: l[12] || (l[12] = (o) => {
1379
+ var M, F, K;
1380
+ const a = (M = Z.value) == null ? void 0 : M.col;
1381
+ (F = x(t)) == null || F.closeFilterPopup(), a != null && ((K = x(t)) == null || K.sortColumn(a, o));
1382
+ })
1383
+ }, null, 8, ["values", "selected", "x", "y", "sort-dir"])) : R("", !0),
1384
+ n("div", fn, [
1385
+ Y(e.$slots, "overlay", {
1386
+ rectOf: Ne,
1387
+ rectOfRange: Ue,
1388
+ tick: ie.value
1389
+ }, void 0, !0),
1390
+ n("div", {
1391
+ ref_key: "pluginOvEl",
1392
+ ref: je
1393
+ }, null, 512)
1394
+ ]),
1395
+ n("div", {
1396
+ class: "editor-slot",
1397
+ ref_key: "editorSlotEl",
1398
+ ref: Ae
1399
+ }, null, 512),
1400
+ X.value ? (d(), v("div", {
1401
+ key: 2,
1402
+ class: U(["cell-tooltip", X.value.kind]),
1403
+ style: Qe({ left: X.value.x + "px", top: X.value.y + "px" })
1404
+ }, E(X.value.text), 7)) : R("", !0),
1405
+ x(D) ? (d(), v("div", pn, [
1406
+ Y(e.$slots, "loading", {
1407
+ progress: x(H),
1408
+ label: C.value,
1409
+ pct: z.value
1410
+ }, () => [
1411
+ n("div", mn, [
1412
+ n("div", gn, [
1413
+ L(E(C.value), 1),
1414
+ z.value != null ? (d(), v("span", yn, E(z.value) + "%", 1)) : R("", !0)
1415
+ ]),
1416
+ n("div", kn, [
1417
+ z.value != null ? (d(), v("div", {
1418
+ key: 0,
1419
+ class: "loader-fill",
1420
+ style: Qe({ width: z.value + "%" })
1421
+ }, null, 4)) : (d(), v("div", bn))
1422
+ ])
1423
+ ])
1424
+ ], !0)
1425
+ ])) : x($) ? (d(), v("div", Cn, [
1426
+ Y(e.$slots, "error", { error: x($) }, () => [
1427
+ L("解析失败:" + E(x($)), 1)
1428
+ ], !0)
1429
+ ])) : x(b) ? R("", !0) : (d(), v("div", xn, [
1430
+ Y(e.$slots, "empty", {}, () => [
1431
+ l[16] || (l[16] = L("拖入或选择一个 .xlsx 文件", -1))
1432
+ ], !0)
1433
+ ]))
1434
+ ], 512),
1435
+ x(b) ? (d(), v("div", hn, [
1436
+ Y(e.$slots, "statusbar", {
1437
+ stats: N.value,
1438
+ range: Ye.value || Be.value
1439
+ }, () => [
1440
+ n("span", wn, E(Ye.value || Be.value), 1),
1441
+ l[17] || (l[17] = n("div", { class: "grow" }, null, -1)),
1442
+ N.value && N.value.numCount > 0 ? (d(), v(W, { key: 0 }, [
1443
+ n("span", null, "计数 " + E(N.value.count), 1),
1444
+ n("span", null, "求和 " + E($e(N.value.sum)), 1),
1445
+ n("span", null, "平均 " + E($e(N.value.avg)), 1),
1446
+ n("span", null, "最大 " + E($e(N.value.max)), 1),
1447
+ n("span", null, "最小 " + E($e(N.value.min)), 1)
1448
+ ], 64)) : N.value && N.value.count > 0 ? (d(), v("span", $n, "计数 " + E(N.value.count), 1)) : R("", !0)
1449
+ ], !0)
1450
+ ])) : R("", !0),
1451
+ x(b) ? (d(), se(sl, {
1452
+ key: 4,
1453
+ workbook: x(b),
1454
+ active: p.value,
1455
+ onSelect: l[13] || (l[13] = (o) => p.value = o)
1456
+ }, null, 8, ["workbook", "active"])) : R("", !0),
1457
+ pe.value && x(b) ? (d(), se(hl, {
1458
+ key: 5,
1459
+ selection: le.value,
1460
+ "sheet-count": x(b).sheets.filter((o) => o.state === "visible").length,
1461
+ onClose: l[14] || (l[14] = (o) => pe.value = !1),
1462
+ onExport: Et
1463
+ }, null, 8, ["selection", "sheet-count"])) : R("", !0)
1464
+ ], 544));
1465
+ }
1466
+ }), Sn = /* @__PURE__ */ j(En, [["__scopeId", "data-v-3a1333cc"]]), zn = {
1467
+ install(c) {
1468
+ c.component("ExcelViewer", Sn);
1469
+ }
1470
+ };
1471
+ export {
1472
+ Vn as DEFAULT_THEME,
1473
+ Sn as ExcelViewer,
1474
+ Pn as canvasToBlob,
1475
+ In as canvasToDataURL,
1476
+ Ln as cellDisplayText,
1477
+ An as cellKey,
1478
+ zn as default,
1479
+ Kn as definePlugin,
1480
+ On as downloadBlob,
1481
+ Bn as formatValue,
1482
+ Nn as getCell,
1483
+ Un as getCellStyle,
1484
+ Nt as getCellText,
1485
+ Ut as getCellValue,
1486
+ At as getRangeData,
1487
+ Bt as getSheetData,
1488
+ Hn as getWorkbookJSON,
1489
+ Ft as loadArrayBuffer,
1490
+ Wn as mergeTheme,
1491
+ _n as parseWorkbook,
1492
+ Ot as sheetToJSON
1493
+ };