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