ooxml-excel-editor 1.1.0 → 1.3.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 (54) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/README.md +206 -18
  3. package/dist/assets/exceljs.min-DH9BABny.js +23046 -0
  4. package/dist/assets/parse.worker-DIaMHX0x.js +2646 -0
  5. package/dist/chunks/plugin-overlay-DLb6sRhU.js +9005 -0
  6. package/dist/chunks/toolbar-icons-BcnMin5s.js +223 -0
  7. package/dist/components/ExcelViewer.vue.d.ts +172 -19
  8. package/dist/components/ExportProgressOverlay.vue.d.ts +11 -0
  9. package/dist/components/FilterPopup.vue.d.ts +4 -4
  10. package/dist/components/ViewerToolbar.vue.d.ts +2 -0
  11. package/dist/composables/useExcelDocument.d.ts +1 -0
  12. package/dist/core/edit/clipboard-html.d.ts +24 -0
  13. package/dist/core/edit/commands.d.ts +45 -1
  14. package/dist/core/edit/context-menu.d.ts +19 -0
  15. package/dist/core/edit/edit-controller.d.ts +70 -2
  16. package/dist/core/edit/editor-context.d.ts +18 -3
  17. package/dist/core/edit/editor-host.d.ts +6 -1
  18. package/dist/core/edit/permissions.d.ts +41 -2
  19. package/dist/core/edit/types.d.ts +62 -0
  20. package/dist/core/export/abort.d.ts +21 -0
  21. package/dist/core/export/exporter.d.ts +2 -1
  22. package/dist/core/export/types.d.ts +8 -0
  23. package/dist/core/export/wps-cellimages.d.ts +6 -0
  24. package/dist/core/export/xlsx-writer.d.ts +9 -0
  25. package/dist/core/format/color.d.ts +5 -0
  26. package/dist/core/format/number-format.d.ts +3 -0
  27. package/dist/core/layout/autofit.d.ts +3 -0
  28. package/dist/core/layout/grid-metrics.d.ts +14 -2
  29. package/dist/core/loader-json.d.ts +23 -0
  30. package/dist/core/model/clone.d.ts +3 -4
  31. package/dist/core/model/inspect.d.ts +43 -0
  32. package/dist/core/model/mutations.d.ts +16 -1
  33. package/dist/core/model/types.d.ts +44 -2
  34. package/dist/core/parser/cell-image-parser.d.ts +9 -0
  35. package/dist/core/parser/row-meta-parser.d.ts +3 -0
  36. package/dist/core/plugin.d.ts +144 -6
  37. package/dist/core/progress.d.ts +23 -0
  38. package/dist/core/render/canvas-renderer.d.ts +56 -2
  39. package/dist/core/render/conditional.d.ts +7 -0
  40. package/dist/core/template/style-overlay.d.ts +9 -0
  41. package/dist/core/viewer/controller.d.ts +209 -6
  42. package/dist/core/viewer/lightbox-host.d.ts +16 -0
  43. package/dist/core.js +1 -1
  44. package/dist/index.js +1169 -841
  45. package/dist/react/ExcelViewer.d.ts +143 -3
  46. package/dist/react/ExportProgressOverlay.d.ts +6 -0
  47. package/dist/react/use-excel-document.d.ts +2 -0
  48. package/dist/react.js +938 -335
  49. package/dist/style.css +1 -1
  50. package/dist/vue2.css +1 -0
  51. package/dist/vue2.js +10433 -0
  52. package/package.json +18 -6
  53. package/dist/chunks/plugin-overlay-Cfnn9EOi.js +0 -7144
  54. package/dist/chunks/worker-client.stub-BQVZfaLd.js +0 -7
package/dist/index.js CHANGED
@@ -1,168 +1,178 @@
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 };
1
+ import { ref as C, shallowRef as ct, defineComponent as X, onBeforeUnmount as Oe, openBlock as v, createElementBlock as c, createElementVNode as n, createTextVNode as N, toDisplayString as E, createCommentVNode as F, withModifiers as He, Fragment as U, renderList as ce, computed as T, normalizeClass as B, reactive as Mt, withDirectives as V, vModelRadio as Me, vModelSelect as rt, vModelCheckbox as dt, onMounted as Ue, normalizeStyle as We, vModelText as cl, unref as h, nextTick as ve, watch as A, createBlock as ie, Teleport as fl, renderSlot as ee, createVNode as vt } from "vue";
2
+ import { r as ft, l as Rt, d as Pt, f as Dt, a as ml, h as Pe, V as pl, P as gl, g as bl, s as yl, b as kl, c as Cl, e as xl } from "./chunks/plugin-overlay-DLb6sRhU.js";
3
+ import { D as $s, j as Ss, k as Es, m as Ts, i as Fs, n as Is, o as Ms, q as Rs, t as Ps, u as Ds, v as As, p as zs } from "./chunks/plugin-overlay-DLb6sRhU.js";
4
+ import { p as At, s as Re, T as Be, a as wl, i as hl, j as $l } from "./chunks/toolbar-icons-BcnMin5s.js";
5
+ import { definePlugin as Ns } from "./core.js";
6
+ function Sl() {
7
+ const d = C(!1), $ = C(null), g = ct(null), o = C(null), y = ct(null);
8
+ async function b(f, p) {
9
+ d.value = !0, $.value = null, g.value && ft(g.value), g.value = null, y.value = null, o.value = { stage: "read", ratio: 0 };
10
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;
11
+ const a = await Rt(f, (z, P) => {
12
+ o.value = { stage: "read", ratio: P ? z / P : void 0 };
13
+ }), r = Pt(a);
14
+ if (r === "xls") throw new Error("这是旧版 .xls(BIFF) 或加密文件,本预览器只支持 .xlsx/.xlsm。");
15
+ if (r === "not-zip") throw new Error("文件不是有效的 .xlsx(非 ZIP 包)。");
16
+ if (r === "empty") throw new Error("文件为空。");
17
+ let I = await At(a, (z) => {
18
+ o.value = z;
19
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);
20
+ p && (I = p(I) ?? I), Dt(I), y.value = a.slice(0), g.value = I;
21
+ } catch (a) {
22
+ $.value = a != null && a.message && /预览器|损坏|加密|为空|ZIP/.test(a.message) ? a.message : ml(a), console.error("[ooxml-preview] 解析失败:", a);
23
23
  } finally {
24
- c.value = !1, i.value = null;
24
+ d.value = !1, o.value = null;
25
25
  }
26
26
  }
27
- return { loading: c, error: w, workbook: k, load: g, progress: i, sourceBuffer: y };
27
+ function u(f, p) {
28
+ g.value && ft(g.value), y.value = null, $.value = null, o.value = null, g.value = p ? p(f) ?? f : f;
29
+ }
30
+ return { loading: d, error: $, workbook: g, load: b, loadModel: u, progress: o, sourceBuffer: y };
28
31
  }
29
- const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = { class: "export-wrap" }, jt = {
32
+ const El = { class: "toolbar" }, Tl = ["title"], Fl = {
33
+ key: 0,
34
+ class: "tpl"
35
+ }, Il = { class: "meta" }, Ml = { class: "export-wrap" }, Rl = {
30
36
  key: 0,
31
37
  class: "menu"
32
- }, Xt = { class: "zoom" }, Zt = ["value"], Gt = ["value"], Qt = ["value"], Yt = /* @__PURE__ */ J({
38
+ }, Pl = { class: "zoom" }, Dl = ["value"], Al = ["value"], zl = ["value"], Ll = /* @__PURE__ */ X({
33
39
  __name: "ViewerToolbar",
34
40
  props: {
35
41
  fileName: {},
42
+ templateName: {},
36
43
  sheetCount: {},
37
44
  zoom: {}
38
45
  },
39
46
  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)));
47
+ setup(d, { emit: $ }) {
48
+ const g = $, o = [0.5, 0.75, 1, 1.25, 1.5, 2];
49
+ function y(a) {
50
+ g("update:zoom", Math.min(3, Math.max(0.3, a)));
44
51
  }
45
- const g = h(!1);
46
- function r() {
47
- g.value = !g.value;
52
+ const b = C(!1);
53
+ function u() {
54
+ b.value = !b.value;
48
55
  }
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");
56
+ function f(a) {
57
+ b.value = !1, g(a === "export-image" ? "export-image" : a === "export-pdf" ? "export-pdf" : a === "export-pdf-vector" ? "export-pdf-vector" : a === "print" ? "print" : "open-settings");
51
58
  }
52
- function f(s) {
53
- var u;
54
- (u = s.target) != null && u.closest(".export-wrap") || (g.value = !1);
59
+ function p(a) {
60
+ var r;
61
+ (r = a.target) != null && r.closest(".export-wrap") || (b.value = !1);
55
62
  }
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, [
63
+ return typeof document < "u" && document.addEventListener("click", p), Oe(() => {
64
+ typeof document < "u" && document.removeEventListener("click", p);
65
+ }), (a, r) => (v(), c("div", El, [
59
66
  n("span", {
60
67
  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, [
68
+ title: (d.fileName || "未命名工作簿") + (d.templateName ? " · 模板: " + d.templateName : "")
69
+ }, [
70
+ N(E(d.fileName || "未命名工作簿"), 1),
71
+ d.templateName ? (v(), c("span", Fl, " · 模板: " + E(d.templateName), 1)) : F("", !0)
72
+ ], 8, Tl),
73
+ n("span", Il, E(d.sheetCount) + " 个工作表", 1),
74
+ r[10] || (r[10] = n("div", { class: "spacer" }, null, -1)),
75
+ n("div", Ml, [
66
76
  n("button", {
67
77
  class: "export-btn",
68
- onClick: ze(r, ["stop"]),
78
+ onClick: He(u, ["stop"]),
69
79
  title: "导出 / 打印"
70
- }, [...u[8] || (u[8] = [
71
- L(" 导出 ", -1),
80
+ }, [...r[8] || (r[8] = [
81
+ N(" 导出 ", -1),
72
82
  n("span", { class: "caret" }, "▾", -1)
73
83
  ])]),
74
- g.value ? (d(), v("div", jt, [
84
+ b.value ? (v(), c("div", Rl, [
75
85
  n("button", {
76
- onClick: u[0] || (u[0] = (S) => m("export-image"))
86
+ onClick: r[0] || (r[0] = (I) => f("export-image"))
77
87
  }, "导出为图片 (PNG)"),
78
88
  n("button", {
79
- onClick: u[1] || (u[1] = (S) => m("export-pdf"))
89
+ onClick: r[1] || (r[1] = (I) => f("export-pdf"))
80
90
  }, "导出为 PDF (位图)"),
81
91
  n("button", {
82
- onClick: u[2] || (u[2] = (S) => m("export-pdf-vector"))
92
+ onClick: r[2] || (r[2] = (I) => f("export-pdf-vector"))
83
93
  }, "导出为 PDF (矢量·文字可选)"),
84
94
  n("button", {
85
- onClick: u[3] || (u[3] = (S) => m("print"))
95
+ onClick: r[3] || (r[3] = (I) => f("print"))
86
96
  }, "打印…"),
87
- u[9] || (u[9] = n("div", { class: "sep" }, null, -1)),
97
+ r[9] || (r[9] = n("div", { class: "sep" }, null, -1)),
88
98
  n("button", {
89
- onClick: u[4] || (u[4] = (S) => m("open-settings"))
99
+ onClick: r[4] || (r[4] = (I) => f("open-settings"))
90
100
  }, "导出设置…")
91
- ])) : R("", !0)
101
+ ])) : F("", !0)
92
102
  ]),
93
- n("div", Xt, [
103
+ n("div", Pl, [
94
104
  n("button", {
95
- onClick: u[5] || (u[5] = (S) => y(c.zoom - 0.1)),
105
+ onClick: r[5] || (r[5] = (I) => y(d.zoom - 0.1)),
96
106
  title: "缩小"
97
107
  }, "−"),
98
108
  n("select", {
99
- value: c.zoom,
100
- onChange: u[6] || (u[6] = (S) => y(parseFloat(S.target.value)))
109
+ value: d.zoom,
110
+ onChange: r[6] || (r[6] = (I) => y(parseFloat(I.target.value)))
101
111
  }, [
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", {
112
+ (v(), c(U, null, ce(o, (I) => n("option", {
113
+ key: I,
114
+ value: I
115
+ }, E(Math.round(I * 100)) + "%", 9, Al)), 64)),
116
+ o.includes(d.zoom) ? F("", !0) : (v(), c("option", {
107
117
  key: 0,
108
- value: c.zoom
109
- }, E(Math.round(c.zoom * 100)) + "%", 9, Qt))
110
- ], 40, Zt),
118
+ value: d.zoom
119
+ }, E(Math.round(d.zoom * 100)) + "%", 9, zl))
120
+ ], 40, Dl),
111
121
  n("button", {
112
- onClick: u[7] || (u[7] = (S) => y(c.zoom + 0.1)),
122
+ onClick: r[7] || (r[7] = (I) => y(d.zoom + 0.1)),
113
123
  title: "放大"
114
124
  }, "+")
115
125
  ])
116
126
  ]));
117
127
  }
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({
128
+ }), Z = (d, $) => {
129
+ const g = d.__vccOpts || d;
130
+ for (const [o, y] of $)
131
+ g[o] = y;
132
+ return g;
133
+ }, Nl = /* @__PURE__ */ Z(Ll, [["__scopeId", "data-v-eafc1f94"]]), Vl = { class: "sheet-tabs" }, Bl = ["onClick", "title"], Wl = /* @__PURE__ */ X({
124
134
  __name: "SheetTabs",
125
135
  props: {
126
136
  workbook: {},
127
137
  active: {}
128
138
  },
129
139
  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))
140
+ setup(d, { emit: $ }) {
141
+ const g = d, o = $, y = T(() => g.workbook.sheets.filter((b) => b.state === "visible"));
142
+ return (b, u) => (v(), c("div", Vl, [
143
+ (v(!0), c(U, null, ce(y.value, (f) => (v(), c("button", {
144
+ key: f.index,
145
+ class: B(["tab", { active: f.index === d.active }]),
146
+ onClick: (p) => o("select", f.index),
147
+ title: f.name
148
+ }, E(f.name), 11, Bl))), 128))
139
149
  ]));
140
150
  }
141
- }), sl = /* @__PURE__ */ j(nl, [["__scopeId", "data-v-431b6f9c"]]), ol = {
151
+ }), Ol = /* @__PURE__ */ Z(Wl, [["__scopeId", "data-v-431b6f9c"]]), Hl = {
142
152
  class: "dlg",
143
153
  role: "dialog",
144
154
  "aria-label": "导出设置"
145
- }, al = { class: "dlg-head" }, il = { class: "dlg-body" }, ul = { class: "field" }, rl = { class: "opts" }, dl = ["disabled"], cl = {
155
+ }, Ul = { class: "dlg-head" }, _l = { class: "dlg-body" }, Kl = { class: "field" }, ql = { class: "opts" }, Jl = ["disabled"], jl = {
146
156
  key: 0,
147
157
  class: "hint"
148
- }, vl = {
158
+ }, Gl = {
149
159
  key: 1,
150
160
  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({
161
+ }, Xl = { class: "field" }, Zl = { class: "field" }, Ql = { class: "opts inline" }, Yl = { class: "field" }, en = { class: "opts" }, tn = { class: "field" }, ln = { class: "opts inline" }, nn = { class: "dlg-foot" }, sn = /* @__PURE__ */ X({
152
162
  __name: "ExportDialog",
153
163
  props: {
154
164
  selection: {},
155
165
  sheetCount: {}
156
166
  },
157
167
  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({
168
+ setup(d, { emit: $ }) {
169
+ const g = d, o = $, y = T(() => {
170
+ const p = g.selection;
171
+ return !!p && !(p.top === p.bottom && p.left === p.right);
172
+ }), b = T(() => {
173
+ const p = g.selection;
174
+ return p ? `${Pe(p.left)}${p.top + 1}:${Pe(p.right)}${p.bottom + 1}` : "";
175
+ }), u = Mt({
166
176
  action: "png",
167
177
  scope: y.value ? "selection" : "sheet",
168
178
  scale: 2,
@@ -173,187 +183,187 @@ const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = {
173
183
  fitToWidth: !0,
174
184
  pdfVector: !1
175
185
  });
176
- function m(f) {
177
- i("export", { ...r, action: f });
186
+ function f(p) {
187
+ o("export", { ...u, action: p });
178
188
  }
179
- return (f, s) => (d(), v("div", {
189
+ return (p, a) => (v(), c("div", {
180
190
  class: "dlg-mask",
181
- onClick: s[16] || (s[16] = ze((u) => i("close"), ["self"]))
191
+ onClick: a[16] || (a[16] = He((r) => o("close"), ["self"]))
182
192
  }, [
183
- n("div", ol, [
184
- n("div", al, [
185
- s[17] || (s[17] = n("span", null, "导出 / 打印设置", -1)),
193
+ n("div", Hl, [
194
+ n("div", Ul, [
195
+ a[17] || (a[17] = n("span", null, "导出 / 打印设置", -1)),
186
196
  n("button", {
187
197
  class: "x",
188
- onClick: s[0] || (s[0] = (u) => i("close")),
198
+ onClick: a[0] || (a[0] = (r) => o("close")),
189
199
  title: "关闭"
190
200
  }, "×")
191
201
  ]),
192
- n("div", il, [
193
- n("div", ul, [
194
- s[20] || (s[20] = n("label", { class: "lbl" }, "范围", -1)),
195
- n("div", rl, [
202
+ n("div", _l, [
203
+ n("div", Kl, [
204
+ a[20] || (a[20] = n("label", { class: "lbl" }, "范围", -1)),
205
+ n("div", ql, [
196
206
  n("label", {
197
- class: U({ disabled: !y.value })
207
+ class: B({ disabled: !y.value })
198
208
  }, [
199
- O(n("input", {
209
+ V(n("input", {
200
210
  type: "radio",
201
211
  value: "selection",
202
- "onUpdate:modelValue": s[1] || (s[1] = (u) => r.scope = u),
212
+ "onUpdate:modelValue": a[1] || (a[1] = (r) => u.scope = r),
203
213
  disabled: !y.value
204
- }, null, 8, dl), [
205
- [ye, r.scope]
214
+ }, null, 8, Jl), [
215
+ [Me, u.scope]
206
216
  ]),
207
- s[18] || (s[18] = L(" 当前选区 ", -1)),
208
- y.value ? (d(), v("span", cl, E(g.value), 1)) : (d(), v("span", vl, "(未选多格)"))
217
+ a[18] || (a[18] = N(" 当前选区 ", -1)),
218
+ y.value ? (v(), c("span", jl, E(b.value), 1)) : (v(), c("span", Gl, "(未选多格)"))
209
219
  ], 2),
210
220
  n("label", null, [
211
- O(n("input", {
221
+ V(n("input", {
212
222
  type: "radio",
213
223
  value: "sheet",
214
- "onUpdate:modelValue": s[2] || (s[2] = (u) => r.scope = u)
224
+ "onUpdate:modelValue": a[2] || (a[2] = (r) => u.scope = r)
215
225
  }, null, 512), [
216
- [ye, r.scope]
226
+ [Me, u.scope]
217
227
  ]),
218
- s[19] || (s[19] = L(" 当前工作表", -1))
228
+ a[19] || (a[19] = N(" 当前工作表", -1))
219
229
  ]),
220
230
  n("label", null, [
221
- O(n("input", {
231
+ V(n("input", {
222
232
  type: "radio",
223
233
  value: "all",
224
- "onUpdate:modelValue": s[3] || (s[3] = (u) => r.scope = u)
234
+ "onUpdate:modelValue": a[3] || (a[3] = (r) => u.scope = r)
225
235
  }, null, 512), [
226
- [ye, r.scope]
236
+ [Me, u.scope]
227
237
  ]),
228
- L(" 全部工作表 (" + E(c.sheetCount) + ")", 1)
238
+ N(" 全部工作表 (" + E(d.sheetCount) + ")", 1)
229
239
  ])
230
240
  ])
231
241
  ]),
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] = [
242
+ n("div", Xl, [
243
+ a[22] || (a[22] = n("label", { class: "lbl" }, "清晰度", -1)),
244
+ V(n("select", {
245
+ "onUpdate:modelValue": a[4] || (a[4] = (r) => u.scale = r)
246
+ }, [...a[21] || (a[21] = [
237
247
  n("option", { value: 1 }, "标准 (1×)", -1),
238
248
  n("option", { value: 2 }, "高清 (2×)", -1),
239
249
  n("option", { value: 3 }, "超清 (3×)", -1)
240
250
  ])], 512), [
241
251
  [
242
- Xe,
243
- r.scale,
252
+ rt,
253
+ u.scale,
244
254
  void 0,
245
255
  { number: !0 }
246
256
  ]
247
257
  ])
248
258
  ]),
249
- n("div", pl, [
250
- s[25] || (s[25] = n("label", { class: "lbl" }, "内容", -1)),
251
- n("div", ml, [
259
+ n("div", Zl, [
260
+ a[25] || (a[25] = n("label", { class: "lbl" }, "内容", -1)),
261
+ n("div", Ql, [
252
262
  n("label", null, [
253
- O(n("input", {
263
+ V(n("input", {
254
264
  type: "checkbox",
255
- "onUpdate:modelValue": s[5] || (s[5] = (u) => r.includeHeaders = u)
265
+ "onUpdate:modelValue": a[5] || (a[5] = (r) => u.includeHeaders = r)
256
266
  }, null, 512), [
257
- [Ze, r.includeHeaders]
267
+ [dt, u.includeHeaders]
258
268
  ]),
259
- s[23] || (s[23] = L(" 含行列号", -1))
269
+ a[23] || (a[23] = N(" 含行列号", -1))
260
270
  ]),
261
271
  n("label", null, [
262
- O(n("input", {
272
+ V(n("input", {
263
273
  type: "checkbox",
264
- "onUpdate:modelValue": s[6] || (s[6] = (u) => r.gridlines = u)
274
+ "onUpdate:modelValue": a[6] || (a[6] = (r) => u.gridlines = r)
265
275
  }, null, 512), [
266
- [Ze, r.gridlines]
276
+ [dt, u.gridlines]
267
277
  ]),
268
- s[24] || (s[24] = L(" 网格线", -1))
278
+ a[24] || (a[24] = N(" 网格线", -1))
269
279
  ])
270
280
  ])
271
281
  ]),
272
- n("div", gl, [
273
- s[30] || (s[30] = n("label", { class: "lbl" }, "PDF 类型", -1)),
274
- n("div", yl, [
282
+ n("div", Yl, [
283
+ a[30] || (a[30] = n("label", { class: "lbl" }, "PDF 类型", -1)),
284
+ n("div", en, [
275
285
  n("label", null, [
276
- O(n("input", {
286
+ V(n("input", {
277
287
  type: "radio",
278
288
  value: !1,
279
- "onUpdate:modelValue": s[7] || (s[7] = (u) => r.pdfVector = u)
289
+ "onUpdate:modelValue": a[7] || (a[7] = (r) => u.pdfVector = r)
280
290
  }, null, 512), [
281
- [ye, r.pdfVector]
291
+ [Me, u.pdfVector]
282
292
  ]),
283
- s[26] || (s[26] = L(" 位图 ", -1)),
284
- s[27] || (s[27] = n("span", { class: "hint" }, "(完整还原观感)", -1))
293
+ a[26] || (a[26] = N(" 位图 ", -1)),
294
+ a[27] || (a[27] = n("span", { class: "hint" }, "(完整还原观感)", -1))
285
295
  ]),
286
296
  n("label", null, [
287
- O(n("input", {
297
+ V(n("input", {
288
298
  type: "radio",
289
299
  value: !0,
290
- "onUpdate:modelValue": s[8] || (s[8] = (u) => r.pdfVector = u)
300
+ "onUpdate:modelValue": a[8] || (a[8] = (r) => u.pdfVector = r)
291
301
  }, null, 512), [
292
- [ye, r.pdfVector]
302
+ [Me, u.pdfVector]
293
303
  ]),
294
- s[28] || (s[28] = L(" 矢量 ", -1)),
295
- s[29] || (s[29] = n("span", { class: "hint" }, "(文字可选可搜·清晰·文件小;中文需注册字体,否则该格转图)", -1))
304
+ a[28] || (a[28] = N(" 矢量 ", -1)),
305
+ a[29] || (a[29] = n("span", { class: "hint" }, "(文字可选可搜·清晰·文件小;中文需注册字体,否则该格转图)", -1))
296
306
  ])
297
307
  ])
298
308
  ]),
299
- n("div", kl, [
300
- s[34] || (s[34] = n("label", { class: "lbl" }, [
301
- L("纸张 "),
309
+ n("div", tn, [
310
+ a[34] || (a[34] = n("label", { class: "lbl" }, [
311
+ N("纸张 "),
302
312
  n("span", { class: "hint" }, "(PDF/打印)")
303
313
  ], -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] = [
314
+ n("div", ln, [
315
+ V(n("select", {
316
+ "onUpdate:modelValue": a[9] || (a[9] = (r) => u.format = r)
317
+ }, [...a[31] || (a[31] = [
308
318
  n("option", { value: "auto" }, "自动(跟随表)", -1),
309
319
  n("option", { value: "a4" }, "A4", -1),
310
320
  n("option", { value: "a3" }, "A3", -1),
311
321
  n("option", { value: "letter" }, "Letter", -1)
312
322
  ])], 512), [
313
- [Xe, r.format]
323
+ [rt, u.format]
314
324
  ]),
315
- O(n("select", {
316
- "onUpdate:modelValue": s[10] || (s[10] = (u) => r.orientation = u)
317
- }, [...s[32] || (s[32] = [
325
+ V(n("select", {
326
+ "onUpdate:modelValue": a[10] || (a[10] = (r) => u.orientation = r)
327
+ }, [...a[32] || (a[32] = [
318
328
  n("option", { value: "auto" }, "方向: 自动", -1),
319
329
  n("option", { value: "portrait" }, "纵向", -1),
320
330
  n("option", { value: "landscape" }, "横向", -1)
321
331
  ])], 512), [
322
- [Xe, r.orientation]
332
+ [rt, u.orientation]
323
333
  ]),
324
334
  n("label", null, [
325
- O(n("input", {
335
+ V(n("input", {
326
336
  type: "checkbox",
327
- "onUpdate:modelValue": s[11] || (s[11] = (u) => r.fitToWidth = u)
337
+ "onUpdate:modelValue": a[11] || (a[11] = (r) => u.fitToWidth = r)
328
338
  }, null, 512), [
329
- [Ze, r.fitToWidth]
339
+ [dt, u.fitToWidth]
330
340
  ]),
331
- s[33] || (s[33] = L(" 适应页宽", -1))
341
+ a[33] || (a[33] = N(" 适应页宽", -1))
332
342
  ])
333
343
  ])
334
344
  ])
335
345
  ]),
336
- n("div", Cl, [
346
+ n("div", nn, [
337
347
  n("button", {
338
348
  class: "ghost",
339
- onClick: s[12] || (s[12] = (u) => i("close"))
349
+ onClick: a[12] || (a[12] = (r) => o("close"))
340
350
  }, "取消"),
341
- s[35] || (s[35] = n("div", { class: "grow" }, null, -1)),
351
+ a[35] || (a[35] = n("div", { class: "grow" }, null, -1)),
342
352
  n("button", {
343
- onClick: s[13] || (s[13] = (u) => m("png"))
353
+ onClick: a[13] || (a[13] = (r) => f("png"))
344
354
  }, "导出 PNG"),
345
355
  n("button", {
346
- onClick: s[14] || (s[14] = (u) => m("pdf"))
356
+ onClick: a[14] || (a[14] = (r) => f("pdf"))
347
357
  }, "导出 PDF"),
348
358
  n("button", {
349
359
  class: "primary",
350
- onClick: s[15] || (s[15] = (u) => m("print"))
360
+ onClick: a[15] || (a[15] = (r) => f("print"))
351
361
  }, "打印…")
352
362
  ])
353
363
  ])
354
364
  ]));
355
365
  }
356
- }), hl = /* @__PURE__ */ j(xl, [["__scopeId", "data-v-544df24f"]]), wl = ["value"], $l = ["disabled"], El = ["disabled"], Sl = /* @__PURE__ */ J({
366
+ }), an = /* @__PURE__ */ Z(sn, [["__scopeId", "data-v-544df24f"]]), on = ["value"], un = ["disabled"], rn = ["disabled"], dn = /* @__PURE__ */ X({
357
367
  __name: "FindBar",
358
368
  props: {
359
369
  query: {},
@@ -363,22 +373,22 @@ const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = {
363
373
  wholeCell: { type: Boolean }
364
374
  },
365
375
  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();
376
+ setup(d, { expose: $, emit: g }) {
377
+ const o = g, y = C(null);
378
+ Ue(() => {
379
+ var u;
380
+ return (u = y.value) == null ? void 0 : u.focus();
371
381
  });
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"));
382
+ function b(u) {
383
+ var f;
384
+ (u.ctrlKey || u.metaKey) && (u.key === "f" || u.key === "F") ? (u.preventDefault(), (f = y.value) == null || f.select()) : u.key === "Enter" ? (u.preventDefault(), u.shiftKey ? o("prev") : o("next")) : u.key === "Escape" && (u.preventDefault(), o("close"));
375
385
  }
376
- return w({ focus: () => {
377
- var r;
378
- return (r = y.value) == null ? void 0 : r.focus();
379
- } }), (r, m) => (d(), v("div", {
386
+ return $({ focus: () => {
387
+ var u;
388
+ return (u = y.value) == null ? void 0 : u.focus();
389
+ } }), (u, f) => (v(), c("div", {
380
390
  class: "find-bar",
381
- onKeydown: m[6] || (m[6] = ze(() => {
391
+ onKeydown: f[6] || (f[6] = He(() => {
382
392
  }, ["stop"]))
383
393
  }, [
384
394
  n("input", {
@@ -387,46 +397,46 @@ const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = {
387
397
  class: "q",
388
398
  type: "text",
389
399
  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),
400
+ value: d.query,
401
+ onInput: f[0] || (f[0] = (p) => o("update:query", p.target.value)),
402
+ onKeydown: b
403
+ }, null, 40, on),
394
404
  n("span", {
395
- class: U(["count", { none: c.query && c.matchCount === 0 }])
396
- }, E(c.matchCount ? `${c.current + 1}/${c.matchCount}` : c.query ? "无结果" : ""), 3),
405
+ class: B(["count", { none: d.query && d.matchCount === 0 }])
406
+ }, E(d.matchCount ? `${d.current + 1}/${d.matchCount}` : d.query ? "无结果" : ""), 3),
397
407
  n("button", {
398
- class: U(["opt", { on: c.matchCase }]),
408
+ class: B(["opt", { on: d.matchCase }]),
399
409
  title: "区分大小写",
400
- onClick: m[1] || (m[1] = (f) => i("update:matchCase", !c.matchCase))
410
+ onClick: f[1] || (f[1] = (p) => o("update:matchCase", !d.matchCase))
401
411
  }, "Aa", 2),
402
412
  n("button", {
403
- class: U(["opt", { on: c.wholeCell }]),
413
+ class: B(["opt", { on: d.wholeCell }]),
404
414
  title: "全字匹配(整格相等)",
405
- onClick: m[2] || (m[2] = (f) => i("update:wholeCell", !c.wholeCell))
415
+ onClick: f[2] || (f[2] = (p) => o("update:wholeCell", !d.wholeCell))
406
416
  }, "▢", 2),
407
417
  n("button", {
408
418
  class: "nav",
409
419
  title: "上一个 (Shift+Enter)",
410
- disabled: !c.matchCount,
411
- onClick: m[3] || (m[3] = (f) => i("prev"))
412
- }, "▲", 8, $l),
420
+ disabled: !d.matchCount,
421
+ onClick: f[3] || (f[3] = (p) => o("prev"))
422
+ }, "▲", 8, un),
413
423
  n("button", {
414
424
  class: "nav",
415
425
  title: "下一个 (Enter)",
416
- disabled: !c.matchCount,
417
- onClick: m[4] || (m[4] = (f) => i("next"))
418
- }, "▼", 8, El),
426
+ disabled: !d.matchCount,
427
+ onClick: f[4] || (f[4] = (p) => o("next"))
428
+ }, "▼", 8, rn),
419
429
  n("button", {
420
430
  class: "close",
421
431
  title: "关闭 (Esc)",
422
- onClick: m[5] || (m[5] = (f) => i("close"))
432
+ onClick: f[5] || (f[5] = (p) => o("close"))
423
433
  }, "×")
424
434
  ], 32));
425
435
  }
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 = {
436
+ }), vn = /* @__PURE__ */ Z(dn, [["__scopeId", "data-v-36abc020"]]), cn = { class: "sort" }, fn = { class: "all" }, mn = ["checked"], pn = { class: "list" }, gn = ["checked", "onChange"], bn = ["title"], yn = {
427
437
  key: 0,
428
438
  class: "empty"
429
- }, Il = { class: "foot" }, Ll = /* @__PURE__ */ J({
439
+ }, kn = { class: "foot" }, Cn = /* @__PURE__ */ X({
430
440
  __name: "FilterPopup",
431
441
  props: {
432
442
  values: {},
@@ -436,606 +446,795 @@ const _t = { class: "toolbar" }, qt = ["title"], Kt = { class: "meta" }, Jt = {
436
446
  sortDir: {}
437
447
  },
438
448
  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($);
449
+ setup(d, { emit: $ }) {
450
+ const g = d, o = $, y = C(""), b = Mt(new Set(g.selected.length ? g.selected : g.values)), u = T(() => {
451
+ const P = y.value.trim().toLowerCase();
452
+ return P ? g.values.filter((M) => M.toLowerCase().includes(P)) : g.values;
453
+ }), f = T(() => u.value.length > 0 && u.value.every((P) => b.has(P)));
454
+ function p(P) {
455
+ b.has(P) ? b.delete(P) : b.add(P);
450
456
  }
451
- function u() {
452
- i("apply", [...g]);
457
+ function a() {
458
+ const P = !f.value;
459
+ for (const M of u.value) P ? b.add(M) : b.delete(M);
460
+ }
461
+ function r() {
462
+ o("apply", [...b]);
453
463
  }
454
- const S = h(null);
455
- function P(D) {
456
- S.value && !S.value.contains(D.target) && i("close");
464
+ const I = C(null);
465
+ function z(P) {
466
+ I.value && !I.value.contains(P.target) && o("close");
457
467
  }
458
- return Fe(() => setTimeout(() => document.addEventListener("mousedown", P), 0)), Re(() => document.removeEventListener("mousedown", P)), (D, $) => (d(), v("div", {
468
+ return Ue(() => setTimeout(() => document.addEventListener("mousedown", z), 0)), Oe(() => document.removeEventListener("mousedown", z)), (P, M) => (v(), c("div", {
459
469
  class: "filter-pop",
460
470
  ref_key: "rootEl",
461
- ref: S,
462
- style: Qe({ left: c.x + "px", top: c.y + "px" }),
463
- onKeydown: $[5] || ($[5] = ze(() => {
471
+ ref: I,
472
+ style: We({ left: d.x + "px", top: d.y + "px" }),
473
+ onKeydown: M[5] || (M[5] = He(() => {
464
474
  }, ["stop"]))
465
475
  }, [
466
- n("div", Tl, [
476
+ n("div", cn, [
467
477
  n("button", {
468
- class: U({ on: c.sortDir === "asc" }),
469
- onClick: $[0] || ($[0] = (b) => i("sort", "asc")),
478
+ class: B({ on: d.sortDir === "asc" }),
479
+ onClick: M[0] || (M[0] = (k) => o("sort", "asc")),
470
480
  title: "升序"
471
481
  }, "↑ 升序", 2),
472
482
  n("button", {
473
- class: U({ on: c.sortDir === "desc" }),
474
- onClick: $[1] || ($[1] = (b) => i("sort", "desc")),
483
+ class: B({ on: d.sortDir === "desc" }),
484
+ onClick: M[1] || (M[1] = (k) => o("sort", "desc")),
475
485
  title: "降序"
476
486
  }, "↓ 降序", 2)
477
487
  ]),
478
- O(n("input", {
488
+ V(n("input", {
479
489
  class: "search",
480
490
  type: "text",
481
491
  placeholder: "搜索…",
482
- "onUpdate:modelValue": $[2] || ($[2] = (b) => y.value = b)
492
+ "onUpdate:modelValue": M[2] || (M[2] = (k) => y.value = k)
483
493
  }, null, 512), [
484
- [zt, y.value]
494
+ [cl, y.value]
485
495
  ]),
486
- n("label", Rl, [
496
+ n("label", fn, [
487
497
  n("input", {
488
498
  type: "checkbox",
489
- checked: m.value,
490
- onChange: s
491
- }, null, 40, zl),
492
- $[6] || ($[6] = L(" (全选) ", -1))
499
+ checked: f.value,
500
+ onChange: a
501
+ }, null, 40, mn),
502
+ M[6] || (M[6] = N(" (全选) ", -1))
493
503
  ]),
494
- n("div", Fl, [
495
- (d(!0), v(W, null, oe(r.value, (b) => (d(), v("label", {
496
- key: b,
504
+ n("div", pn, [
505
+ (v(!0), c(U, null, ce(u.value, (k) => (v(), c("label", {
506
+ key: k,
497
507
  class: "row"
498
508
  }, [
499
509
  n("input", {
500
510
  type: "checkbox",
501
- checked: g.has(b),
502
- onChange: (_) => f(b)
503
- }, null, 40, Dl),
511
+ checked: b.has(k),
512
+ onChange: (_) => p(k)
513
+ }, null, 40, gn),
504
514
  n("span", {
505
515
  class: "val",
506
- title: b
507
- }, E(b), 9, Vl)
516
+ title: k
517
+ }, E(k), 9, bn)
508
518
  ]))), 128)),
509
- r.value.length ? R("", !0) : (d(), v("div", Pl, "无匹配值"))
519
+ u.value.length ? F("", !0) : (v(), c("div", yn, "无匹配值"))
510
520
  ]),
511
- n("div", Il, [
521
+ n("div", kn, [
512
522
  n("button", {
513
523
  class: "link",
514
- onClick: $[3] || ($[3] = (b) => i("clear"))
524
+ onClick: M[3] || (M[3] = (k) => o("clear"))
515
525
  }, "清除筛选"),
516
- $[7] || ($[7] = n("div", { class: "grow" }, null, -1)),
526
+ M[7] || (M[7] = n("div", { class: "grow" }, null, -1)),
517
527
  n("button", {
518
- onClick: $[4] || ($[4] = (b) => i("close"))
528
+ onClick: M[4] || (M[4] = (k) => o("close"))
519
529
  }, "取消"),
520
530
  n("button", {
521
531
  class: "primary",
522
- onClick: u
532
+ onClick: r
523
533
  }, "确定")
524
534
  ])
525
535
  ], 36));
526
536
  }
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 = {
537
+ }), xn = /* @__PURE__ */ Z(Cn, [["__scopeId", "data-v-4b0bc283"]]), wn = { class: "tb-menu" }, hn = {
553
538
  key: 0,
554
539
  class: "sep"
555
- }, Nl = ["disabled", "onClick"], Ul = ["innerHTML"], Hl = {
540
+ }, $n = ["disabled", "onClick"], Sn = ["innerHTML"], En = {
556
541
  key: 1,
557
542
  class: "ic-e"
558
- }, Wl = { class: "lb" }, _l = /* @__PURE__ */ J({
543
+ }, Tn = { class: "lb" }, Fn = /* @__PURE__ */ X({
559
544
  __name: "ToolbarMenu",
560
545
  props: {
561
546
  items: {}
562
547
  },
563
548
  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
549
+ setup(d, { emit: $ }) {
550
+ const g = $;
551
+ return (o, y) => (v(), c("div", wn, [
552
+ (v(!0), c(U, null, ce(d.items, (b) => (v(), c(U, {
553
+ key: b.id
569
554
  }, [
570
- g.type === "separator" ? (d(), v("div", Bl)) : (d(), v("button", {
555
+ b.type === "separator" ? (v(), c("div", hn)) : (v(), c("button", {
571
556
  key: 1,
572
- class: U(["mi", { active: g.active }]),
573
- disabled: g.disabled,
574
- onClick: (r) => k("pick", g)
557
+ class: B(["mi", { active: b.active }]),
558
+ disabled: b.disabled,
559
+ onClick: (u) => g("pick", b)
575
560
  }, [
576
- g.iconSvg ? (d(), v("span", {
561
+ b.iconSvg ? (v(), c("span", {
577
562
  key: 0,
578
563
  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))
564
+ innerHTML: h(Re)(b.iconSvg)
565
+ }, null, 8, Sn)) : b.icon ? (v(), c("span", En, E(b.icon), 1)) : F("", !0),
566
+ n("span", Tn, E(b.label || b.id), 1)
567
+ ], 10, $n))
583
568
  ], 64))), 128))
584
569
  ]));
585
570
  }
586
- }), it = /* @__PURE__ */ j(_l, [["__scopeId", "data-v-322e2c67"]]), ql = {
571
+ }), Ft = /* @__PURE__ */ Z(Fn, [["__scopeId", "data-v-322e2c67"]]), In = {
587
572
  key: 0,
588
573
  class: "divider"
589
- }, Kl = {
574
+ }, Mn = {
590
575
  key: 1,
591
576
  class: "tool"
592
- }, Jl = ["innerHTML"], jl = {
577
+ }, Rn = ["innerHTML"], Pn = {
593
578
  key: 1,
594
579
  class: "ic-e"
595
- }, Xl = {
580
+ }, Dn = {
596
581
  key: 2,
597
582
  class: "lb"
598
- }, Zl = ["innerHTML"], Gl = {
583
+ }, An = ["innerHTML"], zn = {
599
584
  key: 0,
600
585
  class: "divider"
601
- }, Ql = {
586
+ }, Ln = {
602
587
  key: 1,
603
588
  class: "dd"
604
- }, Yl = ["disabled", "title", "onClick"], en = ["innerHTML"], tn = {
589
+ }, Nn = ["disabled", "title", "onClick"], Vn = ["innerHTML"], Bn = {
605
590
  key: 1,
606
591
  class: "ic-e"
607
- }, ln = {
592
+ }, Wn = {
608
593
  key: 2,
609
594
  class: "lb"
610
- }, nn = ["innerHTML"], sn = {
595
+ }, On = ["innerHTML"], Hn = {
611
596
  key: 0,
612
597
  class: "dd more"
613
- }, on = ["innerHTML"], an = 46, ut = 4, un = /* @__PURE__ */ J({
598
+ }, Un = ["innerHTML"], _n = 46, It = 4, Kn = /* @__PURE__ */ X({
614
599
  __name: "ActionToolbar",
615
600
  props: {
616
601
  items: {}
617
602
  },
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;
603
+ setup(d) {
604
+ const $ = d, g = C(null), o = C(null), y = C([]), b = C(0), u = C(null);
605
+ function f() {
606
+ var L;
607
+ const w = o.value;
608
+ w && (y.value = Array.from(w.children).map((x) => x.offsetWidth), b.value = ((L = g.value) == null ? void 0 : L.clientWidth) ?? 0);
609
+ }
610
+ const p = T(() => {
611
+ const w = b.value, L = y.value;
612
+ if (!w || L.length !== $.items.length) return $.items.length;
613
+ let x = 0, ue = !0;
614
+ for (let O = 0; O < $.items.length; O++)
615
+ if (x += L[O] + It, x > w) {
616
+ ue = !1;
632
617
  break;
633
618
  }
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", {
619
+ if (ue) return $.items.length;
620
+ let fe = _n, me = 0;
621
+ for (let O = 0; O < $.items.length && (fe += L[O] + It, !(fe > w)); O++)
622
+ me++;
623
+ return Math.max(0, me);
624
+ }), a = T(() => $.items.slice(0, p.value)), r = T(() => $.items.slice(p.value)), I = Be.more;
625
+ function z(w) {
626
+ u.value = u.value === w ? null : w;
627
+ }
628
+ function P(w) {
629
+ var L;
630
+ w.disabled || (L = w.onClick) == null || L.call(w);
631
+ }
632
+ function M(w) {
633
+ var L;
634
+ w.disabled || ((L = w.items) != null && L.length ? z(w.id) : (P(w), u.value = null));
635
+ }
636
+ function k(w) {
637
+ P(w), u.value = null;
638
+ }
639
+ function _(w) {
640
+ return w.iconSvg ? Re(w.iconSvg) : null;
641
+ }
642
+ let K = null;
643
+ function te(w) {
644
+ g.value && !g.value.contains(w.target) && (u.value = null);
645
+ }
646
+ return Ue(() => {
647
+ ve(f), K = new ResizeObserver(() => {
648
+ var w;
649
+ return b.value = ((w = g.value) == null ? void 0 : w.clientWidth) ?? 0;
650
+ }), g.value && K.observe(g.value), document.addEventListener("mousedown", te);
651
+ }), Oe(() => {
652
+ K == null || K.disconnect(), document.removeEventListener("mousedown", te);
653
+ }), A(
654
+ () => $.items.map((w) => w.id + (w.label ?? "")).join("|"),
655
+ () => ve(f)
656
+ ), (w, L) => (v(), c("div", {
672
657
  class: "action-toolbar",
673
658
  ref_key: "containerEl",
674
- ref: k
659
+ ref: g
675
660
  }, [
676
661
  n("div", {
677
662
  class: "measure",
678
663
  ref_key: "measureEl",
679
- ref: i,
664
+ ref: o,
680
665
  "aria-hidden": "true"
681
666
  }, [
682
- (d(!0), v(W, null, oe(c.items, (p) => (d(), v(W, {
683
- key: "m" + p.id
667
+ (v(!0), c(U, null, ce(d.items, (x) => (v(), c(U, {
668
+ key: "m" + x.id
684
669
  }, [
685
- p.type === "separator" ? (d(), v("span", ql)) : (d(), v("button", Kl, [
686
- _(p) ? (d(), v("span", {
670
+ x.type === "separator" ? (v(), c("span", In)) : (v(), c("button", Mn, [
671
+ _(x) ? (v(), c("span", {
687
672
  key: 0,
688
673
  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", {
674
+ innerHTML: _(x)
675
+ }, null, 8, Rn)) : x.icon ? (v(), c("span", Pn, E(x.icon), 1)) : F("", !0),
676
+ x.label ? (v(), c("span", Dn, E(x.label), 1)) : F("", !0),
677
+ x.items ? (v(), c("span", {
693
678
  key: 3,
694
679
  class: "caret",
695
- innerHTML: x(ke)(x(Me).caret)
696
- }, null, 8, Zl)) : R("", !0)
680
+ innerHTML: h(Re)(h(Be).caret)
681
+ }, null, 8, An)) : F("", !0)
697
682
  ]))
698
683
  ], 64))), 128))
699
684
  ], 512),
700
- (d(!0), v(W, null, oe(s.value, (p) => (d(), v(W, {
701
- key: p.id
685
+ (v(!0), c(U, null, ce(a.value, (x) => (v(), c(U, {
686
+ key: x.id
702
687
  }, [
703
- p.type === "separator" ? (d(), v("span", Gl)) : (d(), v("div", Ql, [
688
+ x.type === "separator" ? (v(), c("span", zn)) : (v(), c("div", Ln, [
704
689
  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)
690
+ class: B(["tool", { active: x.active, open: u.value === x.id }]),
691
+ disabled: x.disabled,
692
+ title: x.title || x.label || x.id,
693
+ onClick: (ue) => M(x)
709
694
  }, [
710
- _(p) ? (d(), v("span", {
695
+ _(x) ? (v(), c("span", {
711
696
  key: 0,
712
697
  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", {
698
+ innerHTML: _(x)
699
+ }, null, 8, Vn)) : x.icon ? (v(), c("span", Bn, E(x.icon), 1)) : F("", !0),
700
+ x.label ? (v(), c("span", Wn, E(x.label), 1)) : F("", !0),
701
+ x.items ? (v(), c("span", {
717
702
  key: 3,
718
703
  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, {
704
+ innerHTML: h(Re)(h(Be).caret)
705
+ }, null, 8, On)) : F("", !0)
706
+ ], 10, Nn),
707
+ x.items && u.value === x.id ? (v(), ie(Ft, {
723
708
  key: 0,
724
- items: p.items,
725
- onPick: b
726
- }, null, 8, ["items"])) : R("", !0)
709
+ items: x.items,
710
+ onPick: k
711
+ }, null, 8, ["items"])) : F("", !0)
727
712
  ]))
728
713
  ], 64))), 128)),
729
- u.value.length ? (d(), v("div", sn, [
714
+ r.value.length ? (v(), c("div", Hn, [
730
715
  n("button", {
731
- class: U(["tool", { open: r.value === "__more" }]),
716
+ class: B(["tool", { open: u.value === "__more" }]),
732
717
  title: "更多",
733
- onClick: z[0] || (z[0] = (p) => P("__more"))
718
+ onClick: L[0] || (L[0] = (x) => z("__more"))
734
719
  }, [
735
720
  n("span", {
736
721
  class: "ic",
737
- innerHTML: x(ke)(x(S))
738
- }, null, 8, on)
722
+ innerHTML: h(Re)(h(I))
723
+ }, null, 8, Un)
739
724
  ], 2),
740
- r.value === "__more" ? (d(), se(it, {
725
+ u.value === "__more" ? (v(), ie(Ft, {
741
726
  key: 0,
742
- items: u.value,
743
- onPick: b
744
- }, null, 8, ["items"])) : R("", !0)
745
- ])) : R("", !0)
727
+ items: r.value,
728
+ onPick: k
729
+ }, null, 8, ["items"])) : F("", !0)
730
+ ])) : F("", !0)
746
731
  ], 512));
747
732
  }
748
- }), rn = /* @__PURE__ */ j(un, [["__scopeId", "data-v-0a4aa655"]]), dn = {
733
+ }), qn = /* @__PURE__ */ Z(Kn, [["__scopeId", "data-v-0a4aa655"]]), Jn = {
734
+ key: 0,
735
+ class: "export-progress-overlay",
736
+ role: "dialog",
737
+ "aria-modal": "true",
738
+ "aria-live": "polite"
739
+ }, jn = { class: "card" }, Gn = { class: "title" }, Xn = { class: "row" }, Zn = { class: "pct" }, Qn = /* @__PURE__ */ X({
740
+ __name: "ExportProgressOverlay",
741
+ props: {
742
+ state: {},
743
+ busy: { type: Boolean }
744
+ },
745
+ emits: ["cancel"],
746
+ setup(d, { emit: $ }) {
747
+ const g = $, o = {
748
+ render: "渲染中",
749
+ compose: "合成中",
750
+ paginate: "分页中",
751
+ write: "写出文件",
752
+ zip: "zip 压缩",
753
+ convert: "批量转换"
754
+ };
755
+ return (y, b) => {
756
+ var u, f, p, a, r;
757
+ return v(), ie(fl, { to: "body" }, [
758
+ d.busy ? (v(), c("div", Jn, [
759
+ n("div", jn, [
760
+ n("div", Gn, E(((u = d.state) == null ? void 0 : u.label) || o[((f = d.state) == null ? void 0 : f.stage) ?? ""] || "处理中…"), 1),
761
+ n("div", {
762
+ class: B(["bar", { indeterminate: ((p = d.state) == null ? void 0 : p.ratio) == null }])
763
+ }, [
764
+ ((a = d.state) == null ? void 0 : a.ratio) != null ? (v(), c("div", {
765
+ key: 0,
766
+ class: "fill",
767
+ style: We({ width: Math.round((d.state.ratio ?? 0) * 100) + "%" })
768
+ }, null, 4)) : F("", !0)
769
+ ], 2),
770
+ n("div", Xn, [
771
+ n("span", Zn, E(((r = d.state) == null ? void 0 : r.ratio) != null ? Math.round(d.state.ratio * 100) + "%" : "正在处理…"), 1),
772
+ n("button", {
773
+ class: "cancel",
774
+ onClick: b[0] || (b[0] = (I) => g("cancel")),
775
+ title: "按 Esc 也可取消"
776
+ }, "取消")
777
+ ])
778
+ ])
779
+ ])) : F("", !0)
780
+ ]);
781
+ };
782
+ }
783
+ }), Yn = /* @__PURE__ */ Z(Qn, [["__scopeId", "data-v-629027ad"]]), es = {
749
784
  key: 2,
750
785
  class: "formula-bar"
751
- }, cn = { class: "addr" }, vn = ["title"], fn = { class: "ov-slot" }, pn = {
786
+ }, ts = { class: "addr" }, ls = ["value", "title"], ns = ["title"], ss = { class: "ov-slot" }, as = {
752
787
  key: 3,
753
788
  class: "state"
754
- }, mn = { class: "loader" }, gn = { class: "loader-label" }, yn = { key: 0 }, kn = { class: "loader-track" }, bn = {
789
+ }, os = { class: "loader" }, is = { class: "loader-label" }, us = { key: 0 }, rs = { class: "loader-track" }, ds = {
755
790
  key: 1,
756
791
  class: "loader-fill indeterminate"
757
- }, Cn = {
792
+ }, vs = {
758
793
  key: 4,
759
794
  class: "state error"
760
- }, xn = {
795
+ }, cs = {
761
796
  key: 5,
762
797
  class: "state hint"
763
- }, hn = {
798
+ }, fs = {
764
799
  key: 3,
765
800
  class: "status-bar"
766
- }, wn = { class: "sel" }, $n = { key: 1 }, En = /* @__PURE__ */ J({
801
+ }, ms = { class: "sel" }, ps = { key: 1 }, gs = /* @__PURE__ */ X({
767
802
  __name: "ExcelViewer",
768
803
  props: {
769
804
  src: {},
805
+ workbook: {},
806
+ jsonOptions: {},
807
+ templateFile: {},
808
+ templateName: {},
770
809
  fileName: {},
771
810
  theme: {},
772
811
  transformModel: {},
773
812
  cellStyle: {},
813
+ cellImageFit: {},
814
+ imageLightbox: { type: Boolean, default: !0 },
774
815
  openLinks: { type: Boolean, default: !0 },
775
816
  plugins: {},
776
817
  toolbar: { type: [Boolean, Array], default: !0 },
777
818
  editable: { type: Boolean },
778
819
  cellReadOnly: {},
779
820
  readOnlyRanges: {},
821
+ editableTargets: {},
822
+ strictDimensions: { type: Boolean },
823
+ readOnlyCellStyle: { type: [Boolean, Object, Function] },
780
824
  editor: {},
781
825
  recalc: { type: Boolean },
782
- formulaEngine: {}
826
+ formulaEngine: {},
827
+ exportProgress: { type: Boolean, default: !0 },
828
+ contextMenu: { type: [Boolean, Function], default: void 0 }
783
829
  },
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 });
830
+ 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", "permission-denied", "before-context-menu", "context-menu"],
831
+ setup(d, { expose: $, emit: g }) {
832
+ const o = d, y = T(() => o.plugins ?? []), b = T(
833
+ () => Object.assign({}, ...y.value.map((e) => e.theme || {}), o.theme || {})
834
+ ), u = T(() => !!o.cellStyle || y.value.some((e) => e.cellStyle));
835
+ function f(e, l, s) {
836
+ let i;
837
+ const m = (S) => {
838
+ const D = S == null ? void 0 : S(e, l, s);
839
+ D && (i = { ...i || {}, ...D });
794
840
  };
795
- for (const M of y.value) a(M.cellStyle);
796
- return a(i.cellStyle), o;
841
+ for (const S of y.value) m(S.cellStyle);
842
+ return m(o.cellStyle), i;
797
843
  }
798
- function f(e) {
844
+ function p(e) {
799
845
  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
846
+ for (const s of y.value) s.transformModel && (l = s.transformModel(l) ?? l);
847
+ return o.transformModel && (l = o.transformModel(l) ?? l), l;
848
+ }
849
+ const a = T(() => ({
850
+ editable: o.editable,
851
+ cellReadOnly: o.cellReadOnly,
852
+ readOnlyRanges: o.readOnlyRanges,
853
+ editableTargets: o.editableTargets,
854
+ strictDimensions: o.strictDimensions,
855
+ recalc: o.recalc,
856
+ formulaEngine: o.formulaEngine
809
857
  }));
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;
858
+ function r(e, l) {
859
+ var i, m;
860
+ const s = (i = o.editor) == null ? void 0 : i.call(o, e, l);
861
+ if (s) return s;
862
+ for (const S of y.value) {
863
+ const D = (m = S.editor) == null ? void 0 : m.call(S, e, l);
864
+ if (D) return D;
817
865
  }
818
866
  }
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;
867
+ const I = T(() => !!o.editor || y.value.some((e) => e.editor)), z = g, { loading: P, error: M, workbook: k, load: _, loadModel: K, progress: te, sourceBuffer: w } = Sl();
868
+ function L(e) {
869
+ return e ? hl(e) ? e : $l(e, o.jsonOptions) : null;
870
+ }
871
+ const x = C(null), ue = C(null), fe = T(() => x.value ?? o.templateFile ?? null), me = T(() => ue.value ?? o.templateName ?? "");
872
+ function O(e, l) {
873
+ x.value = e, ue.value = l;
874
+ }
875
+ function mt() {
876
+ O(null, null);
877
+ }
878
+ const pt = C(null);
879
+ function zt() {
880
+ var e;
881
+ (e = pt.value) == null || e.click();
882
+ }
883
+ function Lt(e) {
884
+ var s;
885
+ const l = (s = e.target.files) == null ? void 0 : s[0];
886
+ l && (O(l, l.name), e.target.value = "");
887
+ }
888
+ const Nt = T(() => {
889
+ var e, l;
890
+ return o.fileName ? o.fileName : o.workbook ? "JSON 数据" : ((l = (e = k.value) == null ? void 0 : e.sheets[0]) == null ? void 0 : l.name) || "";
891
+ });
892
+ async function Vt(e) {
893
+ const l = await Rt(e), s = Pt(l);
894
+ if (s === "xls") throw new Error("模板文件是旧版 .xls 或加密,仅支持 .xlsx/.xlsm");
895
+ if (s === "not-zip") throw new Error("模板文件不是有效的 .xlsx(非 ZIP 包)");
896
+ if (s === "empty") throw new Error("模板文件为空");
897
+ const i = await At(l);
898
+ return Dt(i), i;
899
+ }
900
+ async function gt() {
901
+ const e = fe.value, l = L(o.workbook);
902
+ if (o.src) {
903
+ e && console.warn("[ooxml-excel-editor] :templateFile 只在 :workbook (JSON / 模型) 数据源下生效;xlsx 数据源已自带格式,模板已忽略."), await _(o.src, p);
904
+ return;
905
+ }
906
+ if (l && e) {
907
+ try {
908
+ const s = await Vt(e), i = wl(l, s);
909
+ K(i, p);
910
+ } catch (s) {
911
+ console.error("[ooxml-excel-editor] 模板加载失败,降级为纯 JSON 渲染:", s), K(l, p);
912
+ }
913
+ return;
914
+ }
915
+ if (l) {
916
+ K(l, p);
917
+ return;
918
+ }
919
+ e && await _(e, p);
920
+ }
921
+ const bt = T(() => {
922
+ const e = te.value;
821
923
  return e ? e.stage === "read" ? "读取文件…" : e.stage === "parse" ? "解析中…" : "构建表格…" : "";
822
- }), z = T(() => {
823
- const e = H.value;
924
+ }), pe = T(() => {
925
+ const e = te.value;
824
926
  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);
927
+ }), q = C(0), J = C(1), Bt = C(null), ge = C(null), _e = C(null), le = C(null), Ke = C(null), qe = C(null), Je = C(null), je = C(null), re = ct(null), Wt = C({ scrollX: 0, scrollY: 0, width: 0, height: 0, zoom: 1 }), be = T(() => {
928
+ const e = k.value;
929
+ return e ? e.sheets[q.value] ?? e.sheets[0] ?? null : null;
930
+ }), ne = C(0), Ge = C(null), Xe = C(null);
829
931
  let t = null;
830
- function we() {
932
+ function De() {
831
933
  t == null || t.render();
832
934
  }
833
- function vt() {
935
+ function Ot() {
834
936
  t == null || t.measure();
835
937
  }
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));
938
+ function Ze() {
939
+ const e = be.value, l = k.value;
940
+ !e || !l || !t || (t.rebuild(e, l, J.value, {
941
+ theme: b.value,
942
+ cellStyle: u.value ? f : void 0,
943
+ cellImageFit: o.cellImageFit,
944
+ readOnlyCellStyle: o.readOnlyCellStyle
945
+ // Phase C 2026-06-08
946
+ }), t.setSourceBuffer(w.value));
842
947
  }
843
- function ft() {
844
- const e = ae.value;
845
- e && (X.value = null, t == null || t.setScroll(e.scrollLeft, e.scrollTop));
948
+ function Ht() {
949
+ const e = le.value;
950
+ e && (se.value = null, t == null || t.setScroll(e.scrollLeft, e.scrollTop));
846
951
  }
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(
952
+ let ye = null;
953
+ Ue(() => {
954
+ Tt(), _e.value && ge.value && le.value && Ge.value && Xe.value && Ke.value && qe.value && Je.value && je.value && (t = new pl(
850
955
  {
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
956
+ canvas: _e.value,
957
+ renderArea: ge.value,
958
+ scroller: le.value,
959
+ spacer: Ge.value,
960
+ overlays: { main: Ke.value, frow: qe.value, fcol: Je.value, corner: je.value },
961
+ editorSlot: Xe.value
857
962
  },
858
963
  {
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 }),
964
+ onRenderer: (e) => re.value = e,
965
+ onRenderTick: () => ne.value++,
966
+ onSelectionChange: () => Q.value++,
967
+ onCellClick: (e, l, s) => de("cell-click", { row: e, col: l, text: s }),
968
+ onCellDblClick: (e, l, s) => de("cell-dblclick", { row: e, col: l, text: s }),
864
969
  onHyperlink: (e, l) => {
865
- ne("hyperlink-click", { url: e, cell: l }), i.openLinks && window.open(e, "_blank", "noopener");
970
+ de("hyperlink-click", { url: e, cell: l }), o.openLinks && window.open(e, "_blank", "noopener");
866
971
  },
867
- onTooltip: (e) => X.value = e,
868
- onFindChange: () => We.value++,
869
- onFilterChange: () => _e.value++,
870
- onEditEvent: (e, l) => ne(e, l)
972
+ onTooltip: (e) => se.value = e,
973
+ onFindChange: () => nt.value++,
974
+ onFilterChange: () => st.value++,
975
+ onEditEvent: (e, l) => de(e, l),
976
+ onContextMenuBefore: (e) => {
977
+ for (const l of y.value)
978
+ if (l.contextMenu) {
979
+ const s = l.contextMenu(e.ctx, e.items);
980
+ Array.isArray(s) && e.items.splice(0, e.items.length, ...s);
981
+ }
982
+ o.contextMenu === !1 && e.preventDefault(), z("before-context-menu", e);
983
+ },
984
+ onContextMenuShow: (e) => z("context-menu", e)
871
985
  }
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) => {
986
+ ), Wt.value = t.view, t.fileName = o.fileName, t.setEditConfig(a.value), t.setEditorResolver(I.value ? r : void 0), t.setLightboxEnabled(o.imageLightbox !== !1), t.setContextMenuTransform(typeof o.contextMenu == "function" ? o.contextMenu : null)), ut.value && (oe = new gl(ut.value)), gt(), ye = new ResizeObserver(() => {
987
+ Ot(), De();
988
+ }), ge.value && ye.observe(ge.value);
989
+ }), Oe(() => {
990
+ ye == null || ye.disconnect(), t == null || t.dispose(), oe == null || oe.dispose(), Ve.forEach((e) => e()), k.value && ft(k.value);
991
+ }), A([() => o.src, () => o.workbook, () => o.templateFile, x], () => {
992
+ gt();
993
+ }), A(() => o.fileName, (e) => {
880
994
  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],
995
+ }), A(a, (e) => t == null ? void 0 : t.setEditConfig(e)), A(() => o.contextMenu, (e) => t == null ? void 0 : t.setContextMenuTransform(typeof e == "function" ? e : null)), A([() => o.editor, y], () => t == null ? void 0 : t.setEditorResolver(I.value ? r : void 0)), A(() => o.cellImageFit, (e) => {
996
+ e && (t == null || t.setCellImageFit(e));
997
+ }), A(() => o.imageLightbox, (e) => t == null ? void 0 : t.setLightboxEnabled(e !== !1)), A(
998
+ () => [b.value, o.cellStyle, o.plugins],
883
999
  () => {
884
- ee.value && Oe();
1000
+ re.value && Ze();
885
1001
  },
886
1002
  { 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;
1003
+ ), A(() => o.plugins, () => Tt(), { deep: !1 }), A(k, async (e) => {
1004
+ e && (t == null || t.clearFilterState(), q.value = e.activeSheet, await ve(), Ze(), z("rendered", e));
1005
+ }), A(q, (e) => {
1006
+ const l = k.value;
1007
+ l != null && l.sheets[e] && de("sheet-change", { index: e, name: l.sheets[e].name });
1008
+ }), A(M, (e) => {
1009
+ e && z("error", e);
1010
+ }), A(te, (e) => {
1011
+ e && z("progress", e);
1012
+ }), A(q, async (e, l) => {
1013
+ var s;
1014
+ l != null && (t == null || t.resetFilter((s = k.value) == null ? void 0 : s.sheets[l])), await ve(), Ze();
1015
+ }), A(J, (e) => t == null ? void 0 : t.setZoom(e));
1016
+ const Q = C(0), se = C(null), Y = T(() => (Q.value, re.value, (t == null ? void 0 : t.getSelection()) ?? null)), Qe = T(() => {
1017
+ Q.value;
902
1018
  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();
1019
+ return e ? Pe(e.col) + (e.row + 1) : "";
1020
+ }), yt = T(() => {
1021
+ const e = Y.value;
1022
+ return !e || e.top === e.bottom && e.left === e.right ? "" : `${Pe(e.left)}${e.top + 1}:${Pe(e.right)}${e.bottom + 1}`;
1023
+ }), kt = T(() => {
1024
+ Q.value;
1025
+ const e = re.value, l = t == null ? void 0 : t.getActiveCell();
910
1026
  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;
1027
+ }), j = C(""), ke = C(!1), Ct = C(null);
1028
+ function Ye() {
1029
+ const e = Ct.value;
1030
+ e && (e.style.height = "auto", e.style.height = e.scrollHeight + "px");
1031
+ }
1032
+ function Ut(e) {
1033
+ j.value = e.target.value, Ye();
1034
+ }
1035
+ const _t = T(() => (Q.value, ne.value, !!(t != null && t.canEditActiveCell()))), Ae = T(() => (Q.value, ne.value, (t == null ? void 0 : t.getCellEditString()) ?? ""));
1036
+ A(Ae, (e) => {
1037
+ ke.value || (j.value = e);
1038
+ }, { immediate: !0 }), A(j, () => ve(Ye));
1039
+ function Kt() {
1040
+ ke.value = !0, j.value = Ae.value, ve(Ye);
1041
+ }
1042
+ function xt(e) {
1043
+ var l;
1044
+ t == null || t.commitActiveCellValue(j.value, e), ke.value = !1, j.value = Ae.value, e === "down" && ((l = le.value) == null || l.focus());
1045
+ }
1046
+ function qt() {
1047
+ var e;
1048
+ ke.value = !1, j.value = Ae.value, (e = le.value) == null || e.focus();
1049
+ }
1050
+ function Jt() {
1051
+ ke.value && xt();
1052
+ }
1053
+ function jt(e) {
1054
+ e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), xt("down")) : e.key === "Escape" && (e.preventDefault(), qt());
1055
+ }
1056
+ const W = T(() => {
1057
+ Q.value;
1058
+ const e = re.value, l = (t == null ? void 0 : t.getSelection()) ?? null;
914
1059
  return e && l ? e.selectionStats(l) : null;
915
1060
  });
916
- function $e(e) {
1061
+ function ze(e) {
917
1062
  return isFinite(e) ? e.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "—";
918
1063
  }
919
- function pt(e) {
1064
+ function Gt(e) {
920
1065
  t == null || t.onMouseDown(e);
921
1066
  }
922
- function mt(e) {
1067
+ function Xt(e) {
1068
+ t == null || t.onContextMenu(e);
1069
+ }
1070
+ function Zt(e) {
923
1071
  t == null || t.onMouseMove(e);
924
1072
  }
925
- function gt(e) {
1073
+ function Qt(e) {
926
1074
  t == null || t.onMouseUp(e);
927
1075
  }
928
- function yt() {
1076
+ function Yt() {
929
1077
  t == null || t.onMouseLeave();
930
1078
  }
931
- function kt(e) {
1079
+ function el(e) {
932
1080
  t == null || t.onDblClick(e);
933
1081
  }
934
- function bt(e) {
1082
+ function tl(e) {
935
1083
  t == null || t.onKeyDown(e);
936
1084
  }
937
- V(le, (e) => {
1085
+ A(Y, (e) => {
938
1086
  const l = t == null ? void 0 : t.getActiveCell();
939
- e && l && ne("selection-change", { range: e, active: l });
1087
+ e && l && de("selection-change", { range: e, active: l });
940
1088
  });
941
- function Ne(e, l) {
1089
+ function et(e, l) {
942
1090
  return (t == null ? void 0 : t.rectOf(e, l)) ?? null;
943
1091
  }
944
- function Ue(e) {
1092
+ function tt(e) {
945
1093
  return (t == null ? void 0 : t.rectOfRange(e)) ?? null;
946
1094
  }
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() {
1095
+ const Ce = C(null), Le = C(!1);
1096
+ let xe = null;
1097
+ function wt() {
1098
+ xe == null || xe.abort();
1099
+ }
1100
+ function G(e, l) {
1101
+ if (o.exportProgress === !1) return l(e);
1102
+ const s = new AbortController();
1103
+ xe = s, e != null && e.signal && (e.signal.aborted ? s.abort() : e.signal.addEventListener("abort", () => s.abort(), { once: !0 })), Le.value = !0, Ce.value = null;
1104
+ const m = { ...e ?? {}, onProgress: (S) => {
1105
+ var D;
1106
+ Ce.value = S, (D = e == null ? void 0 : e.onProgress) == null || D.call(e, S);
1107
+ }, signal: s.signal };
1108
+ return l(m).finally(() => {
1109
+ Le.value = !1, Ce.value = null, xe = null;
1110
+ });
1111
+ }
1112
+ const ll = (e) => G(e, (l) => t.exportImage(l)), we = (e) => G(e, (l) => t.downloadImage(l)), nl = (e) => G(e, (l) => t.exportPdf(l)), he = (e) => G(e, (l) => t.downloadPdf(l)), $e = (e) => G(e, (l) => t.print(l));
1113
+ async function ht() {
949
1114
  try {
950
- await de();
1115
+ await he();
951
1116
  } catch (e) {
952
- He(e);
1117
+ lt(e);
953
1118
  }
954
1119
  }
955
- async function lt() {
1120
+ async function $t() {
956
1121
  try {
957
- await de({ vector: !0 });
1122
+ await he({ vector: !0 });
958
1123
  } catch (e) {
959
- He(e);
1124
+ lt(e);
960
1125
  }
961
1126
  }
962
- function He(e) {
1127
+ function lt(e) {
963
1128
  const l = (e == null ? void 0 : e.message) || String(e);
964
- P("error", l), typeof window < "u" && window.alert && window.alert(l);
1129
+ console.error("[ooxml-excel-editor] 导出失败:", e), z("error", l), typeof window < "u" && window.alert && window.alert(l);
965
1130
  }
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;
1131
+ const Se = C(!1), nt = C(0), Ee = T(() => (nt.value, (t == null ? void 0 : t.getFindState()) ?? { query: "", matchCase: !1, wholeCell: !1, count: 0, index: -1 }));
1132
+ function St() {
1133
+ Se.value = !0;
969
1134
  }
970
- function st() {
1135
+ function Et() {
971
1136
  var e;
972
- ve.value = !1, t == null || t.clearFind(), (e = ae.value) == null || e.focus();
1137
+ Se.value = !1, t == null || t.clearFind(), (e = le.value) == null || e.focus();
973
1138
  }
974
- function ht(e) {
975
- (e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(), nt());
1139
+ function sl(e) {
1140
+ (e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(), St());
976
1141
  }
977
- const _e = h(0), Z = T(() => (_e.value, (t == null ? void 0 : t.getFilterPopup()) ?? null));
978
- function wt() {
1142
+ const st = C(0), ae = T(() => (st.value, (t == null ? void 0 : t.getFilterPopup()) ?? null));
1143
+ function al() {
979
1144
  t == null || t.toggleAutoFilter();
980
1145
  }
981
- function $t() {
982
- const e = he.value, l = ee.value;
1146
+ function ol() {
1147
+ const e = be.value, l = re.value;
983
1148
  if (!e || !l) return;
984
- const o = e.freeze;
985
- if (o.frozenRows || o.frozenCols)
1149
+ const s = e.freeze;
1150
+ if (s.frozenRows || s.frozenCols)
986
1151
  e.freeze = { frozenRows: 0, frozenCols: 0 };
987
1152
  else {
988
- const a = t == null ? void 0 : t.getActiveCell();
989
- e.freeze = { frozenRows: a ? a.row : 1, frozenCols: a ? a.col : 0 };
1153
+ const i = t == null ? void 0 : t.getActiveCell();
1154
+ e.freeze = { frozenRows: i ? i.row : 1, frozenCols: i ? i.col : 0 };
990
1155
  }
991
- l.rebuildMetrics(), t == null || t.refreshContentSize(), we();
1156
+ l.rebuildMetrics(), t == null || t.refreshContentSize(), De();
992
1157
  }
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 = {
1158
+ const Te = C(!1);
1159
+ async function il(e) {
1160
+ Te.value = !1;
1161
+ const l = e.scope === "all" ? "all" : "active", s = e.scope === "selection" ? Y.value ?? void 0 : void 0, i = {
997
1162
  target: l,
998
- range: o,
1163
+ range: s,
999
1164
  scale: e.scale,
1000
1165
  includeHeaders: e.includeHeaders,
1001
1166
  gridlines: e.gridlines
1002
- }, M = {
1167
+ }, m = {
1003
1168
  ...e.format !== "auto" ? { format: e.format } : {},
1004
1169
  ...e.orientation !== "auto" ? { orientation: e.orientation } : {},
1005
1170
  fitToWidth: e.fitToWidth
1006
1171
  };
1007
1172
  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);
1173
+ e.action === "png" ? await we(i) : e.action === "pdf" ? await he({ ...i, ...m, vector: e.pdfVector }) : await $e({ ...i, ...m });
1174
+ } catch (S) {
1175
+ lt(S);
1011
1176
  }
1012
1177
  }
1013
- function St(e) {
1178
+ function ul(e) {
1014
1179
  t == null || t.setSelectionRange(e);
1015
1180
  }
1016
- const me = {
1017
- load: (e) => _(e, f),
1018
- getWorkbook: () => b.value,
1019
- getActiveSheet: () => p.value,
1181
+ const Fe = {
1182
+ load: (e) => _(e, p),
1183
+ getWorkbook: () => k.value,
1184
+ getActiveSheet: () => q.value,
1020
1185
  setActiveSheet: (e) => {
1021
1186
  var l;
1022
- (l = b.value) != null && l.sheets[e] && (p.value = e);
1187
+ (l = k.value) != null && l.sheets[e] && (q.value = e);
1023
1188
  },
1024
- getSelection: () => le.value,
1025
- setSelection: St,
1026
- rectOf: Ne,
1027
- rectOfRange: Ue,
1028
- redraw: () => we(),
1189
+ getSelection: () => Y.value,
1190
+ setSelection: ul,
1191
+ rectOf: et,
1192
+ rectOfRange: tt,
1193
+ redraw: () => De(),
1029
1194
  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,
1195
+ setEditableTargets: (e) => t == null ? void 0 : t.setEditableTargets(e),
1196
+ getEditableTargets: () => t == null ? void 0 : t.getEditableTargets(),
1197
+ editCell: (e, l, s) => (t == null ? void 0 : t.editCell(e, l, s)) ?? !1,
1031
1198
  editRange: (e, l) => (t == null ? void 0 : t.editRange(e, l)) ?? !1,
1032
1199
  clearRange: (e) => (t == null ? void 0 : t.clearRange(e)) ?? !1,
1033
1200
  setStyle: (e, l) => (t == null ? void 0 : t.setStyle(e, l)) ?? !1,
1201
+ getActiveFillColor: () => (t == null ? void 0 : t.getActiveFillColor()) ?? "#FFFFFF",
1202
+ getActiveFontColor: () => (t == null ? void 0 : t.getActiveFontColor()) ?? "#000000",
1203
+ setSelectionFill: (e) => (t == null ? void 0 : t.setSelectionFill(e)) ?? !1,
1204
+ setSelectionFontColor: (e) => (t == null ? void 0 : t.setSelectionFontColor(e)) ?? !1,
1205
+ getSelectionWrapState: () => (t == null ? void 0 : t.getSelectionWrapState()) ?? "none",
1206
+ toggleWrapTextOnSelection: () => (t == null ? void 0 : t.toggleWrapTextOnSelection()) ?? !1,
1207
+ mergeCells: (e) => (t == null ? void 0 : t.mergeCells(e)) ?? !1,
1208
+ unmergeCells: (e) => (t == null ? void 0 : t.unmergeCells(e)) ?? !1,
1209
+ pasteText: (e, l) => (t == null ? void 0 : t.pasteText(e, l)) ?? !1,
1210
+ pasteRichHtml: (e, l) => (t == null ? void 0 : t.pasteRichHtml(e, l)) ?? !1,
1211
+ pasteImageBlob: (e, l) => (t == null ? void 0 : t.pasteImageBlob(e, l)) ?? Promise.resolve(!1),
1034
1212
  getImages: () => (t == null ? void 0 : t.getImages()) ?? [],
1035
1213
  addImage: (e) => (t == null ? void 0 : t.addImage(e)) ?? -1,
1036
1214
  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,
1215
+ moveImage: (e, l, s) => (t == null ? void 0 : t.moveImage(e, l, s)) ?? !1,
1216
+ resizeImage: (e, l, s) => (t == null ? void 0 : t.resizeImage(e, l, s)) ?? !1,
1217
+ getCellEditString: () => (t == null ? void 0 : t.getCellEditString()) ?? "",
1218
+ canEditActiveCell: () => (t == null ? void 0 : t.canEditActiveCell()) ?? !1,
1219
+ commitActiveCellValue: (e, l) => (t == null ? void 0 : t.commitActiveCellValue(e, l)) ?? !1,
1220
+ getCellImages: () => (t == null ? void 0 : t.getCellImages()) ?? [],
1221
+ getCellImageAt: (e, l) => (t == null ? void 0 : t.getCellImageAt(e, l)) ?? null,
1222
+ openImageLightbox: (e, l, s) => t == null ? void 0 : t.openImageLightbox(e, l, s),
1223
+ setCellImageFit: (e) => t == null ? void 0 : t.setCellImageFit(e),
1224
+ convertImageToCell: (e, l, s) => (t == null ? void 0 : t.convertImageToCell(e, l, s)) ?? !1,
1225
+ convertImageToCellAuto: (e) => (t == null ? void 0 : t.convertImageToCellAuto(e)) ?? !1,
1226
+ convertAllImagesToCells: (e) => (t == null ? void 0 : t.convertAllImagesToCells(e)) ?? 0,
1227
+ convertImagesInRangeToCell: (e) => G({}, async (l) => {
1228
+ var s;
1229
+ return (s = l.onProgress) == null || s.call(l, { stage: "convert", label: "选区浮动图批量嵌入…", ratio: void 0 }), (t == null ? void 0 : t.convertImagesInRangeToCell(e)) ?? 0;
1230
+ }),
1231
+ convertCellImagesInRangeToFloat: (e, l) => G({}, async (s) => {
1232
+ var i;
1233
+ return (i = s.onProgress) == null || i.call(s, { stage: "convert", label: "选区内嵌图批量浮动化…", ratio: void 0 }), (t == null ? void 0 : t.convertCellImagesInRangeToFloat(e, l)) ?? 0;
1234
+ }),
1235
+ openContextMenu: (e, l, s) => t == null ? void 0 : t.openContextMenu(e, l, s),
1236
+ closeContextMenu: () => t == null ? void 0 : t.closeContextMenu(),
1237
+ convertCellImageToFloat: (e, l, s) => (t == null ? void 0 : t.convertCellImageToFloat(e, l, s)) ?? !1,
1039
1238
  insertRows: (e, l) => (t == null ? void 0 : t.insertRows(e, l)) ?? !1,
1040
1239
  deleteRows: (e, l) => (t == null ? void 0 : t.deleteRows(e, l)) ?? !1,
1041
1240
  insertCols: (e, l) => (t == null ? void 0 : t.insertCols(e, l)) ?? !1,
@@ -1046,142 +1245,235 @@ const Ol = { class: "tb-menu" }, Bl = {
1046
1245
  canRedo: () => (t == null ? void 0 : t.canRedo()) ?? !1,
1047
1246
  getEditingCell: () => (t == null ? void 0 : t.getEditingCell()) ?? null,
1048
1247
  getCellSnapshot: (e, l) => (t == null ? void 0 : t.getCellSnapshot(e, l)) ?? null,
1248
+ inspectCell: (e, l) => (t == null ? void 0 : t.inspectCell(e, l)) ?? null,
1049
1249
  beginEdit: (e, l) => (t == null ? void 0 : t.beginEdit(e, l)) ?? !1,
1050
1250
  cancelEdit: () => t == null ? void 0 : t.cancelEdit(),
1051
1251
  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,
1252
+ setColumnWidth: (e, l) => (t == null ? void 0 : t.setColumnWidth(e, l)) ?? 0,
1253
+ setRowHeight: (e, l) => (t == null ? void 0 : t.setRowHeight(e, l)) ?? 0,
1254
+ autoFitColumns: (e) => (t == null ? void 0 : t.autoFitColumns(e)) ?? 0,
1255
+ autoFitRows: (e) => (t == null ? void 0 : t.autoFitRows(e)) ?? 0,
1256
+ resetColumnWidth: (e) => (t == null ? void 0 : t.resetColumnWidth(e)) ?? 0,
1257
+ resetRowHeight: (e) => (t == null ? void 0 : t.resetRowHeight(e)) ?? 0,
1054
1258
  isRecalcReady: () => (t == null ? void 0 : t.isRecalcReady()) ?? !1,
1259
+ getVirtualExtent: () => (t == null ? void 0 : t.getVirtualExtent()) ?? { rows: 0, cols: 0 },
1055
1260
  isDirty: () => (t == null ? void 0 : t.isDirty()) ?? !1,
1056
1261
  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),
1262
+ exportImage: ll,
1263
+ downloadImage: we,
1264
+ exportPdf: nl,
1265
+ downloadPdf: he,
1266
+ print: $e,
1267
+ exportXlsx: (e) => G(e, (l) => t.exportXlsx(l)),
1268
+ downloadXlsx: (e) => G(e, (l) => t.downloadXlsx(l)),
1064
1269
  exportJson: (e) => (t == null ? void 0 : t.exportJson(e)) ?? "{}",
1065
1270
  downloadJson: (e) => t == null ? void 0 : t.downloadJson(e),
1066
1271
  exportCsv: (e) => (t == null ? void 0 : t.exportCsv(e)) ?? "",
1067
1272
  downloadCsv: (e) => t == null ? void 0 : t.downloadCsv(e),
1068
1273
  // ---- 数据读取(委托独立函数,自动绑 date1904 + 默认当前表) ----
1069
- getCellValue: (e, l, o) => {
1070
- const a = ge(o);
1071
- return a ? Ut(a, e, l) : null;
1274
+ getCellValue: (e, l, s) => {
1275
+ const i = Ie(s);
1276
+ return i ? xl(i, e, l) : null;
1072
1277
  },
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) : "";
1278
+ getCellText: (e, l, s) => {
1279
+ var m;
1280
+ const i = Ie(s);
1281
+ return i ? Cl(i, e, l, ((m = k.value) == null ? void 0 : m.date1904) ?? !1) : "";
1077
1282
  },
1078
1283
  getSheetData: (e, l) => {
1079
- const o = ge(l);
1080
- return o ? Bt(o, qe(e)) : [];
1284
+ const s = Ie(l);
1285
+ return s ? kl(s, at(e)) : [];
1081
1286
  },
1082
1287
  getSheetJSON: (e, l) => {
1083
- const o = ge(l);
1084
- return o ? Ot(o, qe(e)) : [];
1288
+ const s = Ie(l);
1289
+ return s ? yl(s, at(e)) : [];
1085
1290
  },
1086
- getRangeData: (e, l, o) => {
1087
- const a = ge(o);
1088
- return a ? At(a, e, qe(l)) : [];
1291
+ getRangeData: (e, l, s) => {
1292
+ const i = Ie(s);
1293
+ return i ? bl(i, e, at(l)) : [];
1089
1294
  }
1090
1295
  };
1091
- function ge(e) {
1092
- const l = b.value;
1093
- return l ? l.sheets[e ?? p.value] ?? null : null;
1296
+ function Ie(e) {
1297
+ const l = k.value;
1298
+ return l ? l.sheets[e ?? q.value] ?? null : null;
1094
1299
  }
1095
- function qe(e) {
1300
+ function at(e) {
1096
1301
  var l;
1097
- return { ...e, date1904: ((l = b.value) == null ? void 0 : l.date1904) ?? !1 };
1302
+ return { ...e, date1904: ((l = k.value) == null ? void 0 : l.date1904) ?? !1 };
1098
1303
  }
1099
- w(me);
1100
- const G = (e) => Me[e];
1101
- function I(e) {
1304
+ $(Fe);
1305
+ const H = (e) => Be[e];
1306
+ function R(e) {
1102
1307
  return { kind: "builtin", ...e };
1103
1308
  }
1104
- function Mt(e) {
1105
- var l, o;
1309
+ function rl(e) {
1310
+ var l, s, i;
1106
1311
  switch (e) {
1107
1312
  case "find":
1108
- return I({
1313
+ return R({
1109
1314
  id: e,
1110
- iconSvg: G("find"),
1315
+ iconSvg: H("find"),
1111
1316
  label: "查找",
1112
1317
  title: "查找 (Ctrl+F)",
1113
- active: ve.value,
1114
- onClick: () => ve.value ? st() : nt()
1318
+ active: Se.value,
1319
+ onClick: () => Se.value ? Et() : St()
1115
1320
  });
1116
1321
  case "filter":
1117
- return I({
1322
+ return R({
1118
1323
  id: e,
1119
- iconSvg: G("filter"),
1324
+ iconSvg: H("filter"),
1120
1325
  label: "筛选",
1121
1326
  title: "切换自动筛选",
1122
- active: !!((l = he.value) != null && l.autoFilterRange),
1123
- onClick: wt
1327
+ active: !!((l = be.value) != null && l.autoFilterRange),
1328
+ onClick: al
1124
1329
  });
1125
1330
  case "clear-filter":
1126
- return I({
1331
+ return R({
1127
1332
  id: e,
1128
- iconSvg: G("clear-filter"),
1333
+ iconSvg: H("clear-filter"),
1129
1334
  label: "清除筛选",
1130
1335
  title: "清除当前表全部筛选",
1131
1336
  disabled: !(t != null && t.hasFilters()),
1132
1337
  onClick: () => t == null ? void 0 : t.clearAllFilters()
1133
1338
  });
1134
1339
  case "copy":
1135
- return I({
1340
+ return R({
1136
1341
  id: e,
1137
- iconSvg: G("copy"),
1342
+ iconSvg: H("copy"),
1138
1343
  label: "复制",
1139
1344
  title: "复制选区 (Ctrl+C)",
1140
- disabled: !le.value,
1345
+ disabled: !Y.value,
1141
1346
  onClick: () => void (t == null ? void 0 : t.copySelection())
1142
1347
  });
1348
+ case "wrap-text": {
1349
+ const m = (t == null ? void 0 : t.getSelectionWrapState()) ?? "none";
1350
+ return R({
1351
+ id: e,
1352
+ iconSvg: H("wrap-text"),
1353
+ label: "自动换行",
1354
+ title: "自动换行(选区,WPS 风格 toggle)",
1355
+ active: m === "all",
1356
+ disabled: !Y.value || !o.editable,
1357
+ onClick: () => void (t == null ? void 0 : t.toggleWrapTextOnSelection())
1358
+ });
1359
+ }
1360
+ case "template": {
1361
+ const m = !!fe.value, S = me.value, D = !!o.src && !o.workbook;
1362
+ return R({
1363
+ id: e,
1364
+ iconSvg: H("template"),
1365
+ label: "模板",
1366
+ title: D ? "模板仅对 JSON / 模型数据源生效;当前是 .xlsx 数据源,模板不可用" : m ? `模板已加载:${S || "(未命名)"}` : "为 JSON / 模型数据源套用 .xlsx 模板的样式(边框 / 字体 / 列宽 / 合并 等);模板的文字内容会被丢弃",
1367
+ active: m,
1368
+ disabled: D,
1369
+ items: [
1370
+ R({
1371
+ id: "tpl-default",
1372
+ label: (m ? "" : "✓ ") + "默认渲染",
1373
+ title: "不套模板,数据按默认样式渲染",
1374
+ disabled: !m,
1375
+ onClick: mt
1376
+ }),
1377
+ R({ id: "tpl-sep", type: "separator" }),
1378
+ R({
1379
+ id: "tpl-import",
1380
+ label: "导入 .xlsx 模板…",
1381
+ title: "选一份 .xlsx,把它的 styling(边框/字体/列宽/合并/freeze) 套到当前 JSON 数据上;模板的文字内容会被丢弃",
1382
+ onClick: zt
1383
+ }),
1384
+ R({
1385
+ id: "tpl-clear",
1386
+ label: "清除模板",
1387
+ title: "切回默认样式渲染",
1388
+ disabled: !m,
1389
+ onClick: mt
1390
+ })
1391
+ ]
1392
+ });
1393
+ }
1394
+ case "image-tools": {
1395
+ const m = Y.value, S = t == null ? void 0 : t.getActiveCell(), D = (((s = be.value) == null ? void 0 : s.images.length) ?? 0) > 0;
1396
+ return R({
1397
+ id: e,
1398
+ iconSvg: H("image-tools"),
1399
+ label: "图片工具",
1400
+ title: "浮动图 ⇄ 单元格内嵌图(WPS DISPIMG)互转",
1401
+ disabled: !o.editable,
1402
+ items: [
1403
+ R({
1404
+ id: "img-sel-to-cell",
1405
+ label: "选区:浮动 → 嵌入",
1406
+ title: '把选区里"中心格在选区内"的浮动图,就近嵌入',
1407
+ disabled: !m || !D,
1408
+ onClick: () => m && (t == null ? void 0 : t.convertImagesInRangeToCell(m))
1409
+ }),
1410
+ R({
1411
+ id: "img-sel-to-float",
1412
+ label: "选区:嵌入 → 浮动",
1413
+ title: "把选区内所有 DISPIMG 格拎成浮动图",
1414
+ disabled: !m,
1415
+ onClick: () => m && (t == null ? void 0 : t.convertCellImagesInRangeToFloat(m))
1416
+ }),
1417
+ R({ id: "img-sep", type: "separator" }),
1418
+ R({
1419
+ id: "img-all-to-cell",
1420
+ label: "整表:浮动 → 嵌入",
1421
+ title: "全表浮动图按几何就近嵌入各自单元格",
1422
+ disabled: !D,
1423
+ onClick: () => t == null ? void 0 : t.convertAllImagesToCells()
1424
+ }),
1425
+ R({
1426
+ id: "img-col-to-cell",
1427
+ label: "整列:浮动 → 嵌入(活动列)",
1428
+ title: "把中心落在活动列的浮动图就近嵌入",
1429
+ disabled: !D || !S,
1430
+ onClick: () => S && (t == null ? void 0 : t.convertAllImagesToCells(S.col))
1431
+ })
1432
+ ]
1433
+ });
1434
+ }
1143
1435
  case "freeze": {
1144
- const a = (o = he.value) == null ? void 0 : o.freeze;
1145
- return I({
1436
+ const m = (i = be.value) == null ? void 0 : i.freeze;
1437
+ return R({
1146
1438
  id: e,
1147
- iconSvg: G("freeze"),
1439
+ iconSvg: H("freeze"),
1148
1440
  label: "冻结",
1149
1441
  title: "冻结/取消冻结(在活动单元格)",
1150
- active: !!(a && (a.frozenRows || a.frozenCols)),
1151
- onClick: $t
1442
+ active: !!(m && (m.frozenRows || m.frozenCols)),
1443
+ onClick: ol
1152
1444
  });
1153
1445
  }
1154
1446
  case "export":
1155
- return I({
1447
+ return R({
1156
1448
  id: e,
1157
- iconSvg: G("export"),
1449
+ iconSvg: H("export"),
1158
1450
  label: "导出",
1159
1451
  title: "导出 / 打印",
1160
1452
  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 })
1453
+ R({ id: "export-png", label: "导出为图片 (PNG)", onClick: () => void we() }),
1454
+ R({ id: "export-pdf", label: "导出为 PDF (位图)", onClick: ht }),
1455
+ R({ id: "export-pdf-vector", label: "导出为 PDF (矢量·文字可选)", onClick: $t }),
1456
+ R({ id: "export-print", label: "打印…", onClick: () => void $e() }),
1457
+ R({ id: "export-sep", type: "separator" }),
1458
+ R({ id: "export-settings", label: "导出设置…", onClick: () => Te.value = !0 })
1167
1459
  ]
1168
1460
  });
1169
1461
  case "zoom":
1170
- return I({
1462
+ return R({
1171
1463
  id: e,
1172
- iconSvg: G("zoom"),
1173
- label: Math.round(A.value * 100) + "%",
1464
+ iconSvg: H("zoom"),
1465
+ label: Math.round(J.value * 100) + "%",
1174
1466
  title: "缩放",
1175
1467
  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 })
1468
+ (m) => R({ id: "zoom-" + m, label: m + "%", active: Math.round(J.value * 100) === m, onClick: () => J.value = m / 100 })
1177
1469
  )
1178
1470
  });
1179
1471
  default:
1180
1472
  return null;
1181
1473
  }
1182
1474
  }
1183
- function Ke(e, l) {
1184
- var o, a, M;
1475
+ function ot(e, l) {
1476
+ var s, i, m;
1185
1477
  return {
1186
1478
  id: e.id,
1187
1479
  type: e.type,
@@ -1189,305 +1481,341 @@ const Ol = { class: "tb-menu" }, Bl = {
1189
1481
  icon: e.icon,
1190
1482
  label: e.label,
1191
1483
  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)),
1484
+ active: !!((s = e.active) != null && s.call(e, Fe)),
1485
+ disabled: !!((i = e.disabled) != null && i.call(e, Fe)),
1486
+ onClick: e.onClick ? () => e.onClick(Fe) : void 0,
1487
+ items: (m = e.items) == null ? void 0 : m.map((S) => ot(S, l)),
1196
1488
  kind: l
1197
1489
  };
1198
1490
  }
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" });
1491
+ const it = T(() => {
1492
+ if (ne.value, Q.value, nt.value, st.value, o.toolbar === !1) return [];
1493
+ const e = Array.isArray(o.toolbar) ? o.toolbar : ["find", "filter"], l = [];
1494
+ for (const s of e)
1495
+ if (typeof s == "string")
1496
+ if (s === "separator" || s === "|") l.push({ id: "sep-" + l.length, type: "separator", kind: "builtin" });
1205
1497
  else {
1206
- const a = Mt(o);
1207
- a && l.push(a);
1498
+ const i = rl(s);
1499
+ i && l.push(i);
1208
1500
  }
1209
1501
  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"));
1502
+ l.push(ot(s, "custom"));
1503
+ for (const s of y.value)
1504
+ for (const i of s.toolbar ?? []) l.push(ot(i, "plugin"));
1213
1505
  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);
1506
+ }), dl = T(() => o.toolbar !== !1 && it.value.length > 0), Ne = /* @__PURE__ */ new Map();
1507
+ let Ve = [];
1508
+ function de(e, l) {
1509
+ var s;
1510
+ z(e, l), (s = Ne.get(e)) == null || s.forEach((i) => i(l));
1511
+ }
1512
+ function Tt() {
1513
+ var s;
1514
+ Ve.forEach((i) => i()), Ve = [], Ne.clear();
1515
+ const e = (i, m) => {
1516
+ let S = Ne.get(i);
1517
+ S || Ne.set(i, S = /* @__PURE__ */ new Set()), S.add(m);
1518
+ }, l = { viewer: Fe, on: e, redraw: () => De() };
1519
+ for (const i of y.value) {
1520
+ if (i.events)
1521
+ for (const [S, D] of Object.entries(i.events)) D && e(S, D);
1522
+ const m = (s = i.setup) == null ? void 0 : s.call(i, l);
1523
+ typeof m == "function" && Ve.push(m);
1232
1524
  }
1233
1525
  }
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);
1526
+ const ut = C(null);
1527
+ let oe = null;
1528
+ function vl() {
1529
+ const e = { rectOf: et, rectOfRange: tt, tick: ne.value, workbook: k.value };
1530
+ oe == null || oe.render(y.value, e);
1239
1531
  }
1240
- return V([ie, y], Rt, { flush: "post" }), (e, l) => (d(), v("div", {
1532
+ return A([ne, y], vl, { flush: "post" }), (e, l) => (v(), c("div", {
1241
1533
  class: "excel-viewer",
1242
1534
  ref_key: "rootEl",
1243
- ref: xe,
1244
- onKeydown: ht
1535
+ ref: Bt,
1536
+ onKeydown: sl
1245
1537
  }, [
1246
- x(b) ? Y(e.$slots, "header", {
1538
+ h(k) ? ee(e.$slots, "header", {
1247
1539
  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
1540
+ workbook: h(k),
1541
+ zoom: J.value,
1542
+ setZoom: (s) => J.value = s,
1543
+ downloadImage: we,
1544
+ downloadPdf: he,
1545
+ print: $e
1254
1546
  }, () => [
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", {
1547
+ vt(Nl, {
1548
+ "file-name": Nt.value,
1549
+ "template-name": me.value,
1550
+ "sheet-count": h(k).sheets.filter((s) => s.state === "visible").length,
1551
+ zoom: J.value,
1552
+ "onUpdate:zoom": l[0] || (l[0] = (s) => J.value = s),
1553
+ onExportImage: l[1] || (l[1] = (s) => we()),
1554
+ onExportPdf: ht,
1555
+ onExportPdfVector: $t,
1556
+ onPrint: l[2] || (l[2] = (s) => $e()),
1557
+ onOpenSettings: l[3] || (l[3] = (s) => Te.value = !0)
1558
+ }, null, 8, ["file-name", "template-name", "sheet-count", "zoom"])
1559
+ ], !0) : F("", !0),
1560
+ h(k) && dl.value ? ee(e.$slots, "toolbar", {
1268
1561
  key: 1,
1269
- items: Je.value
1562
+ items: it.value
1270
1563
  }, () => [
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),
1564
+ vt(qn, { items: it.value }, null, 8, ["items"])
1565
+ ], !0) : F("", !0),
1566
+ h(k) ? (v(), c("div", es, [
1567
+ n("span", ts, E(Qe.value || "—"), 1),
1275
1568
  l[15] || (l[15] = n("span", { class: "fx" }, "fx", -1)),
1276
- n("span", {
1569
+ _t.value ? (v(), c("textarea", {
1570
+ key: 0,
1571
+ ref_key: "fbEl",
1572
+ ref: Ct,
1573
+ class: "content content-input",
1574
+ value: j.value,
1575
+ title: j.value,
1576
+ rows: "1",
1577
+ spellcheck: "false",
1578
+ onFocus: Kt,
1579
+ onInput: Ut,
1580
+ onKeydown: jt,
1581
+ onBlur: Jt
1582
+ }, null, 40, ls)) : (v(), c("span", {
1583
+ key: 1,
1277
1584
  class: "content",
1278
- title: et.value
1279
- }, E(et.value), 9, vn)
1280
- ])) : R("", !0),
1585
+ title: kt.value
1586
+ }, E(kt.value), 9, ns))
1587
+ ])) : F("", !0),
1281
1588
  n("div", {
1282
1589
  class: "render-area",
1283
1590
  ref_key: "renderAreaEl",
1284
- ref: q
1591
+ ref: ge
1285
1592
  }, [
1286
1593
  n("canvas", {
1287
1594
  ref_key: "canvasEl",
1288
- ref: B,
1595
+ ref: _e,
1289
1596
  class: "grid-canvas"
1290
1597
  }, null, 512),
1291
1598
  n("div", {
1292
1599
  class: "ov",
1293
1600
  ref_key: "ovMain",
1294
- ref: De
1601
+ ref: Ke
1295
1602
  }, null, 512),
1296
1603
  n("div", {
1297
1604
  class: "ov",
1298
1605
  ref_key: "ovFCol",
1299
- ref: Pe
1606
+ ref: Je
1300
1607
  }, null, 512),
1301
1608
  n("div", {
1302
1609
  class: "ov",
1303
1610
  ref_key: "ovFRow",
1304
- ref: Ve
1611
+ ref: qe
1305
1612
  }, null, 512),
1306
1613
  n("div", {
1307
1614
  class: "ov",
1308
1615
  ref_key: "ovCorner",
1309
- ref: Ie
1616
+ ref: je
1310
1617
  }, null, 512),
1311
1618
  n("div", {
1312
1619
  class: "scroller",
1313
1620
  ref_key: "scrollerEl",
1314
- ref: ae,
1621
+ ref: le,
1315
1622
  tabindex: "0",
1316
- onScroll: ft,
1317
- onMousedown: pt,
1318
- onMousemove: mt,
1319
- onMouseup: gt,
1320
- onMouseleave: yt,
1321
- onDblclick: kt,
1322
- onKeydown: bt
1623
+ onScroll: Ht,
1624
+ onMousedown: Gt,
1625
+ onMousemove: Zt,
1626
+ onMouseup: Qt,
1627
+ onMouseleave: Yt,
1628
+ onDblclick: el,
1629
+ onKeydown: tl,
1630
+ onContextmenu: Xt
1323
1631
  }, [
1324
1632
  n("div", {
1325
1633
  class: "spacer",
1326
1634
  ref_key: "spacerEl",
1327
- ref: Le
1635
+ ref: Ge
1328
1636
  }, null, 512)
1329
1637
  ], 544),
1330
- ve.value && x(b) ? (d(), se(Ml, {
1638
+ Se.value && h(k) ? (v(), ie(vn, {
1331
1639
  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);
1640
+ query: Ee.value.query,
1641
+ "match-count": Ee.value.count,
1642
+ current: Ee.value.index,
1643
+ "match-case": Ee.value.matchCase,
1644
+ "whole-cell": Ee.value.wholeCell,
1645
+ "onUpdate:query": l[4] || (l[4] = (s) => {
1646
+ var i;
1647
+ return (i = h(t)) == null ? void 0 : i.setFindQuery(s);
1340
1648
  }),
1341
- "onUpdate:matchCase": l[5] || (l[5] = (o) => {
1342
- var a;
1343
- return (a = x(t)) == null ? void 0 : a.setFindMatchCase(o);
1649
+ "onUpdate:matchCase": l[5] || (l[5] = (s) => {
1650
+ var i;
1651
+ return (i = h(t)) == null ? void 0 : i.setFindMatchCase(s);
1344
1652
  }),
1345
- "onUpdate:wholeCell": l[6] || (l[6] = (o) => {
1346
- var a;
1347
- return (a = x(t)) == null ? void 0 : a.setFindWholeCell(o);
1653
+ "onUpdate:wholeCell": l[6] || (l[6] = (s) => {
1654
+ var i;
1655
+ return (i = h(t)) == null ? void 0 : i.setFindWholeCell(s);
1348
1656
  }),
1349
- onNext: l[7] || (l[7] = (o) => {
1350
- var a;
1351
- return (a = x(t)) == null ? void 0 : a.findNext();
1657
+ onNext: l[7] || (l[7] = (s) => {
1658
+ var i;
1659
+ return (i = h(t)) == null ? void 0 : i.findNext();
1352
1660
  }),
1353
- onPrev: l[8] || (l[8] = (o) => {
1354
- var a;
1355
- return (a = x(t)) == null ? void 0 : a.findPrev();
1661
+ onPrev: l[8] || (l[8] = (s) => {
1662
+ var i;
1663
+ return (i = h(t)) == null ? void 0 : i.findPrev();
1356
1664
  }),
1357
- onClose: st
1358
- }, null, 8, ["query", "match-count", "current", "match-case", "whole-cell"])) : R("", !0),
1359
- Z.value ? (d(), se(Al, {
1665
+ onClose: Et
1666
+ }, null, 8, ["query", "match-count", "current", "match-case", "whole-cell"])) : F("", !0),
1667
+ ae.value ? (v(), ie(xn, {
1360
1668
  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);
1669
+ values: ae.value.values,
1670
+ selected: ae.value.selected,
1671
+ x: ae.value.x,
1672
+ y: ae.value.y,
1673
+ "sort-dir": ae.value.sortDir,
1674
+ onApply: l[9] || (l[9] = (s) => {
1675
+ var i;
1676
+ return (i = h(t)) == null ? void 0 : i.applyFilterSelection(s);
1369
1677
  }),
1370
- onClear: l[10] || (l[10] = (o) => {
1371
- var a;
1372
- return (a = x(t)) == null ? void 0 : a.clearFilterColumn();
1678
+ onClear: l[10] || (l[10] = (s) => {
1679
+ var i;
1680
+ return (i = h(t)) == null ? void 0 : i.clearFilterColumn();
1373
1681
  }),
1374
- onClose: l[11] || (l[11] = (o) => {
1375
- var a;
1376
- return (a = x(t)) == null ? void 0 : a.closeFilterPopup();
1682
+ onClose: l[11] || (l[11] = (s) => {
1683
+ var i;
1684
+ return (i = h(t)) == null ? void 0 : i.closeFilterPopup();
1377
1685
  }),
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));
1686
+ onSort: l[12] || (l[12] = (s) => {
1687
+ var m, S, D;
1688
+ const i = (m = ae.value) == null ? void 0 : m.col;
1689
+ (S = h(t)) == null || S.closeFilterPopup(), i != null && ((D = h(t)) == null || D.sortColumn(i, s));
1382
1690
  })
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
1691
+ }, null, 8, ["values", "selected", "x", "y", "sort-dir"])) : F("", !0),
1692
+ n("div", ss, [
1693
+ ee(e.$slots, "overlay", {
1694
+ rectOf: et,
1695
+ rectOfRange: tt,
1696
+ tick: ne.value
1389
1697
  }, void 0, !0),
1390
1698
  n("div", {
1391
1699
  ref_key: "pluginOvEl",
1392
- ref: je
1700
+ ref: ut
1393
1701
  }, null, 512)
1394
1702
  ]),
1395
1703
  n("div", {
1396
1704
  class: "editor-slot",
1397
1705
  ref_key: "editorSlotEl",
1398
- ref: Ae
1706
+ ref: Xe
1399
1707
  }, null, 512),
1400
- X.value ? (d(), v("div", {
1708
+ se.value ? (v(), c("div", {
1401
1709
  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
1710
+ class: B(["cell-tooltip", se.value.kind]),
1711
+ style: We({ left: se.value.x + "px", top: se.value.y + "px" })
1712
+ }, E(se.value.text), 7)) : F("", !0),
1713
+ h(P) ? (v(), c("div", as, [
1714
+ ee(e.$slots, "loading", {
1715
+ progress: h(te),
1716
+ label: bt.value,
1717
+ pct: pe.value
1410
1718
  }, () => [
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)
1719
+ n("div", os, [
1720
+ n("div", is, [
1721
+ N(E(bt.value), 1),
1722
+ pe.value != null ? (v(), c("span", us, E(pe.value) + "%", 1)) : F("", !0)
1415
1723
  ]),
1416
- n("div", kn, [
1417
- z.value != null ? (d(), v("div", {
1724
+ n("div", rs, [
1725
+ pe.value != null ? (v(), c("div", {
1418
1726
  key: 0,
1419
1727
  class: "loader-fill",
1420
- style: Qe({ width: z.value + "%" })
1421
- }, null, 4)) : (d(), v("div", bn))
1728
+ style: We({ width: pe.value + "%" })
1729
+ }, null, 4)) : (v(), c("div", ds))
1422
1730
  ])
1423
1731
  ])
1424
1732
  ], !0)
1425
- ])) : x($) ? (d(), v("div", Cn, [
1426
- Y(e.$slots, "error", { error: x($) }, () => [
1427
- L("解析失败:" + E(x($)), 1)
1733
+ ])) : h(M) ? (v(), c("div", vs, [
1734
+ ee(e.$slots, "error", { error: h(M) }, () => [
1735
+ N("解析失败:" + E(h(M)), 1)
1428
1736
  ], !0)
1429
- ])) : x(b) ? R("", !0) : (d(), v("div", xn, [
1430
- Y(e.$slots, "empty", {}, () => [
1431
- l[16] || (l[16] = L("拖入或选择一个 .xlsx 文件", -1))
1737
+ ])) : h(k) ? F("", !0) : (v(), c("div", cs, [
1738
+ ee(e.$slots, "empty", {}, () => [
1739
+ l[16] || (l[16] = N("拖入或选择一个 .xlsx 文件", -1))
1432
1740
  ], !0)
1433
1741
  ]))
1434
1742
  ], 512),
1435
- x(b) ? (d(), v("div", hn, [
1436
- Y(e.$slots, "statusbar", {
1437
- stats: N.value,
1438
- range: Ye.value || Be.value
1743
+ h(k) ? (v(), c("div", fs, [
1744
+ ee(e.$slots, "statusbar", {
1745
+ stats: W.value,
1746
+ range: yt.value || Qe.value
1439
1747
  }, () => [
1440
- n("span", wn, E(Ye.value || Be.value), 1),
1748
+ n("span", ms, E(yt.value || Qe.value), 1),
1441
1749
  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)
1750
+ W.value && W.value.numCount > 0 ? (v(), c(U, { key: 0 }, [
1751
+ n("span", null, "计数 " + E(W.value.count), 1),
1752
+ n("span", null, "求和 " + E(ze(W.value.sum)), 1),
1753
+ n("span", null, "平均 " + E(ze(W.value.avg)), 1),
1754
+ n("span", null, "最大 " + E(ze(W.value.max)), 1),
1755
+ n("span", null, "最小 " + E(ze(W.value.min)), 1)
1756
+ ], 64)) : W.value && W.value.count > 0 ? (v(), c("span", ps, "计数 " + E(W.value.count), 1)) : F("", !0)
1449
1757
  ], !0)
1450
- ])) : R("", !0),
1451
- x(b) ? (d(), se(sl, {
1758
+ ])) : F("", !0),
1759
+ h(k) ? (v(), ie(Ol, {
1452
1760
  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, {
1761
+ workbook: h(k),
1762
+ active: q.value,
1763
+ onSelect: l[13] || (l[13] = (s) => q.value = s)
1764
+ }, null, 8, ["workbook", "active"])) : F("", !0),
1765
+ Te.value && h(k) ? (v(), ie(an, {
1458
1766
  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)
1767
+ selection: Y.value,
1768
+ "sheet-count": h(k).sheets.filter((s) => s.state === "visible").length,
1769
+ onClose: l[14] || (l[14] = (s) => Te.value = !1),
1770
+ onExport: il
1771
+ }, null, 8, ["selection", "sheet-count"])) : F("", !0),
1772
+ n("input", {
1773
+ ref_key: "templateInputEl",
1774
+ ref: pt,
1775
+ type: "file",
1776
+ accept: ".xlsx,.xlsm",
1777
+ hidden: "",
1778
+ onChange: Lt
1779
+ }, null, 544),
1780
+ d.exportProgress !== !1 ? ee(e.$slots, "export-progress", {
1781
+ key: 6,
1782
+ state: Ce.value,
1783
+ busy: Le.value,
1784
+ cancel: wt
1785
+ }, () => [
1786
+ vt(Yn, {
1787
+ state: Ce.value,
1788
+ busy: Le.value,
1789
+ onCancel: wt
1790
+ }, null, 8, ["state", "busy"])
1791
+ ], !0) : F("", !0)
1464
1792
  ], 544));
1465
1793
  }
1466
- }), Sn = /* @__PURE__ */ j(En, [["__scopeId", "data-v-3a1333cc"]]), zn = {
1467
- install(c) {
1468
- c.component("ExcelViewer", Sn);
1794
+ }), bs = /* @__PURE__ */ Z(gs, [["__scopeId", "data-v-80983538"]]), xs = {
1795
+ install(d) {
1796
+ d.component("ExcelViewer", bs);
1469
1797
  }
1470
1798
  };
1471
1799
  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
1800
+ $s as DEFAULT_THEME,
1801
+ bs as ExcelViewer,
1802
+ Ss as canvasToBlob,
1803
+ Es as canvasToDataURL,
1804
+ Ts as cellDisplayText,
1805
+ Fs as cellKey,
1806
+ xs as default,
1807
+ Ns as definePlugin,
1808
+ Is as downloadBlob,
1809
+ Ms as formatValue,
1810
+ Rs as getCell,
1811
+ Ps as getCellStyle,
1812
+ Cl as getCellText,
1813
+ xl as getCellValue,
1814
+ bl as getRangeData,
1815
+ kl as getSheetData,
1816
+ Ds as getWorkbookJSON,
1817
+ Rt as loadArrayBuffer,
1818
+ As as mergeTheme,
1819
+ zs as parseWorkbook,
1820
+ yl as sheetToJSON
1493
1821
  };