ooxml-excel-editor 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.md +58 -14
- package/dist/assets/exceljs.min-DH9BABny.js +23046 -0
- package/dist/assets/parse.worker-DIaMHX0x.js +2646 -0
- package/dist/chunks/{plugin-overlay-BBrNby8v.js → plugin-overlay-DLb6sRhU.js} +1424 -1384
- package/dist/chunks/toolbar-icons-BcnMin5s.js +223 -0
- package/dist/components/ExcelViewer.vue.d.ts +2 -0
- package/dist/core/edit/editor-context.d.ts +18 -3
- package/dist/core/edit/editor-host.d.ts +6 -1
- package/dist/core.js +1 -1
- package/dist/index.js +722 -742
- package/dist/react/ExcelViewer.d.ts +9 -0
- package/dist/react.js +610 -444
- package/dist/style.css +1 -1
- package/dist/vue2.css +1 -0
- package/dist/vue2.js +10433 -0
- package/package.json +18 -6
- package/dist/chunks/worker-client.stub-CJlmpAgJ.js +0 -190
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { p as
|
|
4
|
-
import { r as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as a, jsxs as g, Fragment as qt } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useRef as v, useCallback as wt, forwardRef as Qt, useEffect as E, useReducer as Yt, useLayoutEffect as It, useImperativeHandle as en } from "react";
|
|
3
|
+
import { p as Tt, s as De, i as tn, j as nn, a as rn, T as ln } from "./chunks/toolbar-icons-BcnMin5s.js";
|
|
4
|
+
import { r as yt, l as Pt, d as Mt, f as At, a as on, V as cn, P as an, g as Rt, s as Et, b as Ft, c as kt, e as Nt, h as Oe } from "./chunks/plugin-overlay-DLb6sRhU.js";
|
|
5
|
+
const sn = {
|
|
6
6
|
render: "渲染中",
|
|
7
7
|
compose: "合成中",
|
|
8
8
|
paginate: "分页中",
|
|
@@ -10,78 +10,94 @@ const zt = {
|
|
|
10
10
|
zip: "zip 压缩",
|
|
11
11
|
convert: "批量转换"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
state:
|
|
15
|
-
busy:
|
|
16
|
-
onCancel:
|
|
13
|
+
function un({
|
|
14
|
+
state: f,
|
|
15
|
+
busy: c,
|
|
16
|
+
onCancel: k
|
|
17
17
|
}) {
|
|
18
|
-
if (!
|
|
19
|
-
const
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
18
|
+
if (!c) return null;
|
|
19
|
+
const w = f == null ? void 0 : f.ratio, T = (f == null ? void 0 : f.label) || sn[(f == null ? void 0 : f.stage) ?? ""] || "处理中…";
|
|
20
|
+
return /* @__PURE__ */ a("div", { className: "rxl-export-progress", role: "dialog", "aria-modal": "true", "aria-live": "polite", children: /* @__PURE__ */ g("div", { className: "card", children: [
|
|
21
|
+
/* @__PURE__ */ a("div", { className: "title", children: T }),
|
|
22
|
+
/* @__PURE__ */ a("div", { className: "bar" + (w == null ? " indeterminate" : ""), children: w != null ? /* @__PURE__ */ a("div", { className: "fill", style: { width: Math.round(w * 100) + "%" } }) : null }),
|
|
23
|
+
/* @__PURE__ */ g("div", { className: "row", children: [
|
|
24
|
+
/* @__PURE__ */ a("span", { className: "pct", children: w != null ? Math.round(w * 100) + "%" : "正在处理…" }),
|
|
25
|
+
/* @__PURE__ */ a("button", { className: "cancel", onClick: k, title: "按 Esc 也可取消", children: "取消" })
|
|
26
26
|
] })
|
|
27
27
|
] }) });
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const [
|
|
31
|
-
|
|
29
|
+
function dn() {
|
|
30
|
+
const [f, c] = y(!1), [k, w] = y(null), [T, s] = y(null), [F, A] = y(null), [Y, K] = y(null), W = v(null), N = wt(async (p, L) => {
|
|
31
|
+
c(!0), w(null), W.current && yt(W.current), W.current = null, s(null), K(null), A({ stage: "read", ratio: 0 });
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
(
|
|
36
|
-
),
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
} catch (
|
|
43
|
-
const
|
|
44
|
-
|
|
33
|
+
const I = await Pt(
|
|
34
|
+
p,
|
|
35
|
+
(X, ee) => A({ stage: "read", ratio: ee ? X / ee : void 0 })
|
|
36
|
+
), D = Mt(I);
|
|
37
|
+
if (D === "xls") throw new Error("这是旧版 .xls(BIFF) 或加密文件,本预览器只支持 .xlsx/.xlsm。");
|
|
38
|
+
if (D === "not-zip") throw new Error("文件不是有效的 .xlsx(非 ZIP 包)。");
|
|
39
|
+
if (D === "empty") throw new Error("文件为空。");
|
|
40
|
+
let H = await Tt(I, (X) => A(X));
|
|
41
|
+
L && (H = L(H) ?? H), At(H), K(I.slice(0)), W.current = H, s(H);
|
|
42
|
+
} catch (I) {
|
|
43
|
+
const D = I == null ? void 0 : I.message;
|
|
44
|
+
w(D && /预览器|损坏|加密|为空|ZIP/.test(D) ? D : on(I)), console.error("[ooxml-preview] 解析失败:", I);
|
|
45
45
|
} finally {
|
|
46
|
-
|
|
46
|
+
c(!1), A(null);
|
|
47
47
|
}
|
|
48
|
-
}, []),
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
48
|
+
}, []), $ = wt((p, L) => {
|
|
49
|
+
W.current && yt(W.current), K(null), w(null), A(null);
|
|
50
|
+
const I = L ? L(p) ?? p : p;
|
|
51
|
+
W.current = I, s(I);
|
|
52
52
|
}, []);
|
|
53
|
-
return { loading:
|
|
53
|
+
return { loading: f, error: k, workbook: T, progress: F, load: N, loadModel: $, sourceBuffer: Y };
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return isFinite(
|
|
55
|
+
function me(f) {
|
|
56
|
+
return isFinite(f) ? f.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "—";
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
var
|
|
60
|
-
const { loading:
|
|
61
|
-
|
|
62
|
-
},
|
|
58
|
+
const vn = Qt(function(c, k) {
|
|
59
|
+
var it;
|
|
60
|
+
const { loading: w, error: T, workbook: s, progress: F, load: A, loadModel: Y, sourceBuffer: K } = dn(), W = (e) => e ? tn(e) ? e : nn(e, c.jsonOptions) : null, [N, $] = y(0), [p, L] = y(1), [I, D] = y(null), [H, X] = y(null), ee = I ?? c.templateFile ?? null, te = H ?? c.templateName ?? "", ze = () => {
|
|
61
|
+
D(null), X(null);
|
|
62
|
+
}, We = v(null), Dt = () => {
|
|
63
63
|
var e;
|
|
64
|
-
return (e =
|
|
65
|
-
},
|
|
64
|
+
return (e = We.current) == null ? void 0 : e.click();
|
|
65
|
+
}, Ot = (e) => {
|
|
66
66
|
var n;
|
|
67
67
|
const t = (n = e.target.files) == null ? void 0 : n[0];
|
|
68
|
-
t && (
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
68
|
+
t && (D(t), X(t.name), e.target.value = "");
|
|
69
|
+
}, Le = c.fileName || (c.workbook ? "JSON 数据" : ((it = s == null ? void 0 : s.sheets[0]) == null ? void 0 : it.name) || ""), [Ce, he] = y(!1), [se, j] = y(null);
|
|
70
|
+
E(() => {
|
|
71
|
+
if (typeof document > "u") return;
|
|
72
|
+
const e = (t) => {
|
|
73
|
+
var n;
|
|
74
|
+
(n = t.target) != null && n.closest("[data-tb-menu]") || j(null);
|
|
75
|
+
};
|
|
76
|
+
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
77
|
+
}, []);
|
|
78
|
+
const [, B] = Yt((e) => e + 1, 0), [zt, He] = y(""), ne = v(!1), Be = v(null), Ve = () => {
|
|
79
|
+
const e = Be.current;
|
|
80
|
+
e && (e.style.height = "auto", e.style.height = e.scrollHeight + "px");
|
|
81
|
+
};
|
|
82
|
+
E(() => {
|
|
83
|
+
Ve();
|
|
84
|
+
});
|
|
85
|
+
const Je = v(null), _e = v(null), U = v(null), Ke = v(null), ve = v(null), xe = v(null), be = v(null), pe = v(null), r = v(null), Se = v(null), we = v(null), Ie = v(null), ie = v(null), ye = v(/* @__PURE__ */ new Map()), u = v(c);
|
|
86
|
+
u.current = c;
|
|
87
|
+
const ue = c.plugins ?? [], Z = v(ue);
|
|
88
|
+
Z.current = ue;
|
|
89
|
+
const G = v(s);
|
|
90
|
+
G.current = s;
|
|
91
|
+
const Re = v(N);
|
|
92
|
+
Re.current = N;
|
|
93
|
+
function Wt() {
|
|
94
|
+
const e = Z.current, t = Object.assign({}, ...e.map((o) => o.theme || {}), u.current.theme || {}), n = e.map((o) => o.cellStyle).filter(Boolean);
|
|
79
95
|
u.current.cellStyle && n.push(u.current.cellStyle);
|
|
80
|
-
const l = n.length ? (
|
|
96
|
+
const l = n.length ? (o, m, i) => {
|
|
81
97
|
let d;
|
|
82
|
-
for (const
|
|
83
|
-
const
|
|
84
|
-
|
|
98
|
+
for (const x of n) {
|
|
99
|
+
const S = x(o, m, i);
|
|
100
|
+
S && (d = { ...d || {}, ...S });
|
|
85
101
|
}
|
|
86
102
|
return d;
|
|
87
103
|
} : void 0;
|
|
@@ -89,10 +105,10 @@ const Gt = Pt(function(a, I) {
|
|
|
89
105
|
}
|
|
90
106
|
function q(e) {
|
|
91
107
|
let t = e;
|
|
92
|
-
for (const n of
|
|
108
|
+
for (const n of Z.current) n.transformModel && (t = n.transformModel(t) ?? t);
|
|
93
109
|
return u.current.transformModel && (t = u.current.transformModel(t) ?? t), t;
|
|
94
110
|
}
|
|
95
|
-
function
|
|
111
|
+
function $e() {
|
|
96
112
|
const e = u.current;
|
|
97
113
|
return {
|
|
98
114
|
editable: e.editable,
|
|
@@ -104,204 +120,204 @@ const Gt = Pt(function(a, I) {
|
|
|
104
120
|
formulaEngine: e.formulaEngine
|
|
105
121
|
};
|
|
106
122
|
}
|
|
107
|
-
function
|
|
108
|
-
if (u.current.editor ||
|
|
123
|
+
function Xe() {
|
|
124
|
+
if (u.current.editor || Z.current.some((t) => t.editor))
|
|
109
125
|
return (t, n) => {
|
|
110
|
-
var
|
|
111
|
-
const l = (
|
|
126
|
+
var o, m, i;
|
|
127
|
+
const l = (m = (o = u.current).editor) == null ? void 0 : m.call(o, t, n);
|
|
112
128
|
if (l) return l;
|
|
113
|
-
for (const d of
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
129
|
+
for (const d of Z.current) {
|
|
130
|
+
const x = (i = d.editor) == null ? void 0 : i.call(d, t, n);
|
|
131
|
+
if (x) return x;
|
|
116
132
|
}
|
|
117
133
|
};
|
|
118
134
|
}
|
|
119
|
-
const
|
|
135
|
+
const Q = (e, t) => {
|
|
120
136
|
var n;
|
|
121
|
-
return (n =
|
|
122
|
-
},
|
|
137
|
+
return (n = ye.current.get(e)) == null ? void 0 : n.forEach((l) => l(t));
|
|
138
|
+
}, re = (e) => {
|
|
123
139
|
var n, l;
|
|
124
140
|
const t = String((e == null ? void 0 : e.message) ?? e);
|
|
125
141
|
console.error("[ooxml-excel-editor] 导出失败:", e), (l = (n = u.current).onError) == null || l.call(n, t), typeof window < "u" && window.alert && window.alert(t);
|
|
126
|
-
}, [
|
|
142
|
+
}, [je, Ee] = y(null), [Ue, Ze] = y(!1), Fe = v(null), Ge = () => {
|
|
127
143
|
var e;
|
|
128
|
-
return (e =
|
|
144
|
+
return (e = Fe.current) == null ? void 0 : e.abort();
|
|
129
145
|
};
|
|
130
|
-
function
|
|
146
|
+
function b(e, t) {
|
|
131
147
|
if (u.current.exportProgress === !1) return t(e);
|
|
132
148
|
const n = new AbortController();
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
var
|
|
136
|
-
|
|
149
|
+
Fe.current = n, e != null && e.signal && (e.signal.aborted ? n.abort() : e.signal.addEventListener("abort", () => n.abort(), { once: !0 })), Ze(!0), Ee(null);
|
|
150
|
+
const o = { ...e ?? {}, onProgress: (m) => {
|
|
151
|
+
var i;
|
|
152
|
+
Ee(m), (i = e == null ? void 0 : e.onProgress) == null || i.call(e, m);
|
|
137
153
|
}, signal: n.signal };
|
|
138
|
-
return t(
|
|
139
|
-
|
|
154
|
+
return t(o).finally(() => {
|
|
155
|
+
Ze(!1), Ee(null), Fe.current = null;
|
|
140
156
|
});
|
|
141
157
|
}
|
|
142
|
-
function
|
|
143
|
-
const e =
|
|
158
|
+
function ke() {
|
|
159
|
+
const e = ie.current, t = r.current;
|
|
144
160
|
if (!e || !t) return;
|
|
145
161
|
const n = {
|
|
146
|
-
rectOf: (l,
|
|
162
|
+
rectOf: (l, o) => t.rectOf(l, o),
|
|
147
163
|
rectOfRange: (l) => t.rectOfRange(l),
|
|
148
164
|
tick: 0,
|
|
149
|
-
workbook:
|
|
165
|
+
workbook: G.current
|
|
150
166
|
};
|
|
151
|
-
e.render(
|
|
167
|
+
e.render(Z.current, n);
|
|
152
168
|
}
|
|
153
|
-
|
|
154
|
-
const e =
|
|
155
|
-
if (!e || !t || !n || !l || !
|
|
156
|
-
const
|
|
169
|
+
It(() => {
|
|
170
|
+
const e = _e.current, t = Je.current, n = U.current, l = Ke.current;
|
|
171
|
+
if (!e || !t || !n || !l || !Ie.current || !ve.current || !xe.current || !be.current || !pe.current) return;
|
|
172
|
+
const o = new cn(
|
|
157
173
|
{
|
|
158
174
|
canvas: e,
|
|
159
175
|
renderArea: t,
|
|
160
176
|
scroller: n,
|
|
161
177
|
spacer: l,
|
|
162
|
-
overlays: { main:
|
|
163
|
-
editorSlot:
|
|
178
|
+
overlays: { main: ve.current, frow: xe.current, fcol: be.current, corner: pe.current },
|
|
179
|
+
editorSlot: Ie.current
|
|
164
180
|
},
|
|
165
181
|
{
|
|
166
|
-
onRenderer: () =>
|
|
167
|
-
onRenderTick: () =>
|
|
182
|
+
onRenderer: () => B(),
|
|
183
|
+
onRenderTick: () => ke(),
|
|
168
184
|
// 插件 overlay 随每帧重定位(纯 DOM,不触发 React 重渲)
|
|
169
|
-
onSelectionChange: () =>
|
|
170
|
-
onCellClick: (
|
|
171
|
-
var
|
|
172
|
-
const
|
|
173
|
-
(
|
|
185
|
+
onSelectionChange: () => B(),
|
|
186
|
+
onCellClick: (i, d, x) => {
|
|
187
|
+
var M, _;
|
|
188
|
+
const S = { row: i, col: d, text: x };
|
|
189
|
+
(_ = (M = u.current).onCellClick) == null || _.call(M, S), Q("cell-click", S);
|
|
174
190
|
},
|
|
175
|
-
onCellDblClick: (
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
(
|
|
191
|
+
onCellDblClick: (i, d, x) => {
|
|
192
|
+
var M, _;
|
|
193
|
+
const S = { row: i, col: d, text: x };
|
|
194
|
+
(_ = (M = u.current).onCellDblClick) == null || _.call(M, S), Q("cell-dblclick", S);
|
|
179
195
|
},
|
|
180
|
-
onHyperlink: (
|
|
181
|
-
var
|
|
182
|
-
(
|
|
196
|
+
onHyperlink: (i, d) => {
|
|
197
|
+
var x, S;
|
|
198
|
+
(S = (x = u.current).onHyperlinkClick) == null || S.call(x, { url: i, cell: d }), Q("hyperlink-click", { url: i, cell: d }), u.current.openLinks !== !1 && window.open(i, "_blank", "noopener");
|
|
183
199
|
},
|
|
184
|
-
onTooltip: (
|
|
185
|
-
|
|
200
|
+
onTooltip: (i) => {
|
|
201
|
+
Se.current = i, B();
|
|
186
202
|
},
|
|
187
|
-
onFindChange: () =>
|
|
188
|
-
onFilterChange: () =>
|
|
189
|
-
onEditEvent: (
|
|
190
|
-
var
|
|
191
|
-
|
|
203
|
+
onFindChange: () => B(),
|
|
204
|
+
onFilterChange: () => B(),
|
|
205
|
+
onEditEvent: (i, d) => {
|
|
206
|
+
var x, S, M, _, ut, dt, gt, ft, mt, Ct, ht, vt, xt, bt, pt, St;
|
|
207
|
+
i === "cell-change" ? (B(), (S = (x = u.current).onCellChange) == null || S.call(x, d)) : i === "edit-start" ? (_ = (M = u.current).onEditStart) == null || _.call(M, d) : i === "edit-commit" ? (dt = (ut = u.current).onEditCommit) == null || dt.call(ut, d) : i === "dim-change" ? (ft = (gt = u.current).onDimChange) == null || ft.call(gt, d) : i === "dirty-change" ? (Ct = (mt = u.current).onDirtyChange) == null || Ct.call(mt, d) : i === "image-change" ? (vt = (ht = u.current).onImageChange) == null || vt.call(ht, d) : i === "struct-change" ? (bt = (xt = u.current).onStructChange) == null || bt.call(xt, d) : i === "permission-denied" && ((St = (pt = u.current).onPermissionDenied) == null || St.call(pt, d)), Q(i, d);
|
|
192
208
|
},
|
|
193
|
-
onContextMenuBefore: (
|
|
194
|
-
var d,
|
|
195
|
-
for (const
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
Array.isArray(
|
|
209
|
+
onContextMenuBefore: (i) => {
|
|
210
|
+
var d, x;
|
|
211
|
+
for (const S of u.current.plugins ?? [])
|
|
212
|
+
if (S.contextMenu) {
|
|
213
|
+
const M = S.contextMenu(i.ctx, i.items);
|
|
214
|
+
Array.isArray(M) && i.items.splice(0, i.items.length, ...M);
|
|
199
215
|
}
|
|
200
|
-
(
|
|
216
|
+
(x = (d = u.current).onBeforeContextMenu) == null || x.call(d, i), u.current.contextMenu === !1 && i.preventDefault();
|
|
201
217
|
},
|
|
202
|
-
onContextMenuShow: (
|
|
203
|
-
var d,
|
|
204
|
-
return (
|
|
218
|
+
onContextMenuShow: (i) => {
|
|
219
|
+
var d, x;
|
|
220
|
+
return (x = (d = u.current).onContextMenuShow) == null ? void 0 : x.call(d, i);
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
223
|
);
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
224
|
+
o.fileName = u.current.fileName, o.setEditConfig($e()), o.setEditorResolver(Xe()), o.setContextMenuTransform(typeof u.current.contextMenu == "function" ? u.current.contextMenu : null), o.setLightboxEnabled(u.current.imageLightbox !== !1), r.current = o, we.current && (ie.current = new an(we.current));
|
|
225
|
+
const m = new ResizeObserver(() => {
|
|
226
|
+
o.measure(), o.render();
|
|
211
227
|
});
|
|
212
|
-
return
|
|
213
|
-
var
|
|
214
|
-
|
|
228
|
+
return m.observe(t), () => {
|
|
229
|
+
var i;
|
|
230
|
+
m.disconnect(), o.dispose(), (i = ie.current) == null || i.dispose(), ie.current = null, r.current = null;
|
|
215
231
|
};
|
|
216
|
-
}, []),
|
|
217
|
-
const e =
|
|
218
|
-
async function n(
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
if (
|
|
222
|
-
if (
|
|
223
|
-
const d = await
|
|
224
|
-
return
|
|
232
|
+
}, []), E(() => {
|
|
233
|
+
const e = ee, t = W(c.workbook);
|
|
234
|
+
async function n(o) {
|
|
235
|
+
const m = await Pt(o), i = Mt(m);
|
|
236
|
+
if (i === "xls") throw new Error("模板文件是旧版 .xls 或加密,仅支持 .xlsx/.xlsm");
|
|
237
|
+
if (i === "not-zip") throw new Error("模板文件不是有效的 .xlsx(非 ZIP 包)");
|
|
238
|
+
if (i === "empty") throw new Error("模板文件为空");
|
|
239
|
+
const d = await Tt(m);
|
|
240
|
+
return At(d), d;
|
|
225
241
|
}
|
|
226
242
|
async function l() {
|
|
227
|
-
if (
|
|
228
|
-
e && console.warn("[ooxml-excel-editor] templateFile 只在 workbook (JSON / 模型) 数据源下生效;xlsx 数据源已自带格式,模板已忽略."), await
|
|
243
|
+
if (c.src) {
|
|
244
|
+
e && console.warn("[ooxml-excel-editor] templateFile 只在 workbook (JSON / 模型) 数据源下生效;xlsx 数据源已自带格式,模板已忽略."), await A(c.src, q);
|
|
229
245
|
return;
|
|
230
246
|
}
|
|
231
247
|
if (t && e) {
|
|
232
248
|
try {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
} catch (
|
|
236
|
-
console.error("[ooxml-excel-editor] 模板加载失败,降级为纯 JSON 渲染:",
|
|
249
|
+
const o = await n(e), m = rn(t, o);
|
|
250
|
+
Y(m, q);
|
|
251
|
+
} catch (o) {
|
|
252
|
+
console.error("[ooxml-excel-editor] 模板加载失败,降级为纯 JSON 渲染:", o), Y(t, q);
|
|
237
253
|
}
|
|
238
254
|
return;
|
|
239
255
|
}
|
|
240
256
|
if (t) {
|
|
241
|
-
|
|
257
|
+
Y(t, q);
|
|
242
258
|
return;
|
|
243
259
|
}
|
|
244
|
-
e && await
|
|
260
|
+
e && await A(e, q);
|
|
245
261
|
}
|
|
246
262
|
l();
|
|
247
|
-
}, [
|
|
248
|
-
r.current && (r.current.fileName =
|
|
249
|
-
}, [
|
|
263
|
+
}, [c.src, c.workbook, c.templateFile, I]), E(() => {
|
|
264
|
+
r.current && (r.current.fileName = c.fileName);
|
|
265
|
+
}, [c.fileName]), E(() => {
|
|
250
266
|
var e;
|
|
251
|
-
(e = r.current) == null || e.setEditConfig(
|
|
252
|
-
}, [
|
|
267
|
+
(e = r.current) == null || e.setEditConfig($e());
|
|
268
|
+
}, [c.editable, c.cellReadOnly, c.readOnlyRanges, c.editableTargets, c.strictDimensions, c.recalc, c.formulaEngine]), E(() => {
|
|
253
269
|
var e;
|
|
254
270
|
(e = r.current) == null || e.setContextMenuTransform(
|
|
255
|
-
typeof
|
|
271
|
+
typeof c.contextMenu == "function" ? c.contextMenu : null
|
|
256
272
|
);
|
|
257
|
-
}, [
|
|
273
|
+
}, [c.contextMenu]), E(() => {
|
|
258
274
|
var e;
|
|
259
|
-
(e = r.current) == null || e.setEditorResolver(
|
|
260
|
-
}, [
|
|
275
|
+
(e = r.current) == null || e.setEditorResolver(Xe());
|
|
276
|
+
}, [c.editor, c.plugins]), E(() => {
|
|
261
277
|
var e;
|
|
262
|
-
|
|
263
|
-
}, [
|
|
278
|
+
c.cellImageFit && ((e = r.current) == null || e.setCellImageFit(c.cellImageFit));
|
|
279
|
+
}, [c.cellImageFit]), E(() => {
|
|
264
280
|
var e;
|
|
265
|
-
(e = r.current) == null || e.setLightboxEnabled(
|
|
266
|
-
}, [
|
|
281
|
+
(e = r.current) == null || e.setLightboxEnabled(c.imageLightbox !== !1);
|
|
282
|
+
}, [c.imageLightbox]), E(() => {
|
|
267
283
|
var e, t;
|
|
268
|
-
|
|
269
|
-
}, [
|
|
284
|
+
s && ($(s.activeSheet), (t = (e = u.current).onRendered) == null || t.call(e, s));
|
|
285
|
+
}, [s]), E(() => {
|
|
270
286
|
var e, t;
|
|
271
|
-
|
|
272
|
-
}, [
|
|
273
|
-
var l,
|
|
287
|
+
T && ((t = (e = u.current).onError) == null || t.call(e, T));
|
|
288
|
+
}, [T]), It(() => {
|
|
289
|
+
var l, o;
|
|
274
290
|
const e = r.current;
|
|
275
|
-
if (!e || !
|
|
276
|
-
const t =
|
|
291
|
+
if (!e || !s) return;
|
|
292
|
+
const t = s.sheets[N] ?? s.sheets[0] ?? null;
|
|
277
293
|
if (!t) return;
|
|
278
|
-
e.rebuild(t,
|
|
279
|
-
const n = { index:
|
|
280
|
-
(
|
|
281
|
-
}, [
|
|
294
|
+
e.rebuild(t, s, p, Wt()), e.setSourceBuffer(K), ke();
|
|
295
|
+
const n = { index: N, name: t.name };
|
|
296
|
+
(o = (l = u.current).onSheetChange) == null || o.call(l, n), Q("sheet-change", n);
|
|
297
|
+
}, [s, N, c.theme, c.cellStyle, c.plugins, K]), E(() => {
|
|
282
298
|
var e;
|
|
283
|
-
(e = r.current) == null || e.setZoom(
|
|
284
|
-
}, [
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
var
|
|
299
|
+
(e = r.current) == null || e.setZoom(p);
|
|
300
|
+
}, [p]);
|
|
301
|
+
const qe = v("");
|
|
302
|
+
E(() => {
|
|
303
|
+
var o, m;
|
|
288
304
|
const e = r.current;
|
|
289
305
|
if (!e) return;
|
|
290
306
|
const t = e.getSelection(), n = e.getActiveCell(), l = t && n ? `${t.top},${t.left},${t.bottom},${t.right}` : "";
|
|
291
|
-
if (l && l !==
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
(
|
|
307
|
+
if (l && l !== qe.current && n) {
|
|
308
|
+
qe.current = l;
|
|
309
|
+
const i = { range: t, active: n };
|
|
310
|
+
(m = (o = u.current).onSelectionChange) == null || m.call(o, i), Q("selection-change", i);
|
|
295
311
|
}
|
|
296
312
|
});
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
313
|
+
const le = (e) => (s == null ? void 0 : s.sheets[e ?? N]) ?? null, Qe = (s == null ? void 0 : s.date1904) ?? !1, Ne = (e) => ({ ...e, date1904: Qe });
|
|
314
|
+
en(
|
|
315
|
+
k,
|
|
300
316
|
() => ({
|
|
301
|
-
load: (e) =>
|
|
302
|
-
getWorkbook: () =>
|
|
303
|
-
getActiveSheet: () =>
|
|
304
|
-
setActiveSheet: (e) => (
|
|
317
|
+
load: (e) => A(e, c.transformModel),
|
|
318
|
+
getWorkbook: () => s,
|
|
319
|
+
getActiveSheet: () => N,
|
|
320
|
+
setActiveSheet: (e) => (s == null ? void 0 : s.sheets[e]) && $(e),
|
|
305
321
|
getSelection: () => {
|
|
306
322
|
var e;
|
|
307
323
|
return ((e = r.current) == null ? void 0 : e.getSelection()) ?? null;
|
|
@@ -454,13 +470,13 @@ const Gt = Pt(function(a, I) {
|
|
|
454
470
|
var t;
|
|
455
471
|
return ((t = r.current) == null ? void 0 : t.convertAllImagesToCells(e)) ?? 0;
|
|
456
472
|
},
|
|
457
|
-
convertImagesInRangeToCell: (e) =>
|
|
473
|
+
convertImagesInRangeToCell: (e) => b({}, async (t) => {
|
|
458
474
|
var n, l;
|
|
459
475
|
return (n = t.onProgress) == null || n.call(t, { stage: "convert", label: "选区浮动图批量嵌入…" }), ((l = r.current) == null ? void 0 : l.convertImagesInRangeToCell(e)) ?? 0;
|
|
460
476
|
}),
|
|
461
|
-
convertCellImagesInRangeToFloat: (e, t) =>
|
|
462
|
-
var l,
|
|
463
|
-
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((
|
|
477
|
+
convertCellImagesInRangeToFloat: (e, t) => b({}, async (n) => {
|
|
478
|
+
var l, o;
|
|
479
|
+
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((o = r.current) == null ? void 0 : o.convertCellImagesInRangeToFloat(e, t)) ?? 0;
|
|
464
480
|
}),
|
|
465
481
|
openContextMenu: (e, t, n) => {
|
|
466
482
|
var l;
|
|
@@ -570,13 +586,13 @@ const Gt = Pt(function(a, I) {
|
|
|
570
586
|
var e;
|
|
571
587
|
return ((e = r.current) == null ? void 0 : e.resetToOriginal()) ?? !1;
|
|
572
588
|
},
|
|
573
|
-
exportImage: (e) =>
|
|
574
|
-
downloadImage: (e) =>
|
|
575
|
-
exportPdf: (e) =>
|
|
576
|
-
downloadPdf: (e) =>
|
|
577
|
-
print: (e) =>
|
|
578
|
-
exportXlsx: (e) =>
|
|
579
|
-
downloadXlsx: (e) =>
|
|
589
|
+
exportImage: (e) => b(e, (t) => r.current.exportImage(t)),
|
|
590
|
+
downloadImage: (e) => b(e, (t) => r.current.downloadImage(t)),
|
|
591
|
+
exportPdf: (e) => b(e, (t) => r.current.exportPdf(t)),
|
|
592
|
+
downloadPdf: (e) => b(e, (t) => r.current.downloadPdf(t)),
|
|
593
|
+
print: (e) => b(e, (t) => r.current.print(t)),
|
|
594
|
+
exportXlsx: (e) => b(e, (t) => r.current.exportXlsx(t)),
|
|
595
|
+
downloadXlsx: (e) => b(e, (t) => r.current.downloadXlsx(t)),
|
|
580
596
|
exportJson: (e) => {
|
|
581
597
|
var t;
|
|
582
598
|
return ((t = r.current) == null ? void 0 : t.exportJson(e)) ?? "{}";
|
|
@@ -594,42 +610,42 @@ const Gt = Pt(function(a, I) {
|
|
|
594
610
|
return (t = r.current) == null ? void 0 : t.downloadCsv(e);
|
|
595
611
|
},
|
|
596
612
|
getCellValue: (e, t, n) => {
|
|
597
|
-
const l =
|
|
598
|
-
return l ?
|
|
613
|
+
const l = le(n);
|
|
614
|
+
return l ? Nt(l, e, t) : null;
|
|
599
615
|
},
|
|
600
616
|
getCellText: (e, t, n) => {
|
|
601
|
-
const l =
|
|
602
|
-
return l ?
|
|
617
|
+
const l = le(n);
|
|
618
|
+
return l ? kt(l, e, t, Qe) : "";
|
|
603
619
|
},
|
|
604
620
|
getSheetData: (e, t) => {
|
|
605
|
-
const n =
|
|
606
|
-
return n ?
|
|
621
|
+
const n = le(t);
|
|
622
|
+
return n ? Ft(n, Ne(e)) : [];
|
|
607
623
|
},
|
|
608
624
|
getSheetJSON: (e, t) => {
|
|
609
|
-
const n =
|
|
610
|
-
return n ?
|
|
625
|
+
const n = le(t);
|
|
626
|
+
return n ? Et(n, Ne(e)) : [];
|
|
611
627
|
},
|
|
612
628
|
getRangeData: (e, t, n) => {
|
|
613
|
-
const l =
|
|
614
|
-
return l ?
|
|
629
|
+
const l = le(n);
|
|
630
|
+
return l ? Rt(l, e, Ne(t)) : [];
|
|
615
631
|
}
|
|
616
632
|
}),
|
|
617
633
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
618
|
-
[
|
|
634
|
+
[s, N]
|
|
619
635
|
);
|
|
620
|
-
const
|
|
636
|
+
const oe = (e) => {
|
|
621
637
|
var t;
|
|
622
|
-
return ((t =
|
|
623
|
-
},
|
|
638
|
+
return ((t = G.current) == null ? void 0 : t.sheets[e ?? Re.current]) ?? null;
|
|
639
|
+
}, de = () => {
|
|
624
640
|
var e;
|
|
625
|
-
return ((e =
|
|
626
|
-
},
|
|
627
|
-
load: (e) =>
|
|
628
|
-
getWorkbook: () =>
|
|
629
|
-
getActiveSheet: () =>
|
|
641
|
+
return ((e = G.current) == null ? void 0 : e.date1904) ?? !1;
|
|
642
|
+
}, ge = v({
|
|
643
|
+
load: (e) => A(e, q),
|
|
644
|
+
getWorkbook: () => G.current,
|
|
645
|
+
getActiveSheet: () => Re.current,
|
|
630
646
|
setActiveSheet: (e) => {
|
|
631
647
|
var t;
|
|
632
|
-
(t =
|
|
648
|
+
(t = G.current) != null && t.sheets[e] && $(e);
|
|
633
649
|
},
|
|
634
650
|
getSelection: () => {
|
|
635
651
|
var e;
|
|
@@ -783,13 +799,13 @@ const Gt = Pt(function(a, I) {
|
|
|
783
799
|
var t;
|
|
784
800
|
return ((t = r.current) == null ? void 0 : t.convertAllImagesToCells(e)) ?? 0;
|
|
785
801
|
},
|
|
786
|
-
convertImagesInRangeToCell: (e) =>
|
|
802
|
+
convertImagesInRangeToCell: (e) => b({}, async (t) => {
|
|
787
803
|
var n, l;
|
|
788
804
|
return (n = t.onProgress) == null || n.call(t, { stage: "convert", label: "选区浮动图批量嵌入…" }), ((l = r.current) == null ? void 0 : l.convertImagesInRangeToCell(e)) ?? 0;
|
|
789
805
|
}),
|
|
790
|
-
convertCellImagesInRangeToFloat: (e, t) =>
|
|
791
|
-
var l,
|
|
792
|
-
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((
|
|
806
|
+
convertCellImagesInRangeToFloat: (e, t) => b({}, async (n) => {
|
|
807
|
+
var l, o;
|
|
808
|
+
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((o = r.current) == null ? void 0 : o.convertCellImagesInRangeToFloat(e, t)) ?? 0;
|
|
793
809
|
}),
|
|
794
810
|
openContextMenu: (e, t, n) => {
|
|
795
811
|
var l;
|
|
@@ -899,13 +915,13 @@ const Gt = Pt(function(a, I) {
|
|
|
899
915
|
var e;
|
|
900
916
|
return ((e = r.current) == null ? void 0 : e.resetToOriginal()) ?? !1;
|
|
901
917
|
},
|
|
902
|
-
exportImage: (e) =>
|
|
903
|
-
downloadImage: (e) =>
|
|
904
|
-
exportPdf: (e) =>
|
|
905
|
-
downloadPdf: (e) =>
|
|
906
|
-
print: (e) =>
|
|
907
|
-
exportXlsx: (e) =>
|
|
908
|
-
downloadXlsx: (e) =>
|
|
918
|
+
exportImage: (e) => b(e, (t) => r.current.exportImage(t)),
|
|
919
|
+
downloadImage: (e) => b(e, (t) => r.current.downloadImage(t)),
|
|
920
|
+
exportPdf: (e) => b(e, (t) => r.current.exportPdf(t)),
|
|
921
|
+
downloadPdf: (e) => b(e, (t) => r.current.downloadPdf(t)),
|
|
922
|
+
print: (e) => b(e, (t) => r.current.print(t)),
|
|
923
|
+
exportXlsx: (e) => b(e, (t) => r.current.exportXlsx(t)),
|
|
924
|
+
downloadXlsx: (e) => b(e, (t) => r.current.downloadXlsx(t)),
|
|
909
925
|
exportJson: (e) => {
|
|
910
926
|
var t;
|
|
911
927
|
return ((t = r.current) == null ? void 0 : t.exportJson(e)) ?? "{}";
|
|
@@ -923,185 +939,335 @@ const Gt = Pt(function(a, I) {
|
|
|
923
939
|
return (t = r.current) == null ? void 0 : t.downloadCsv(e);
|
|
924
940
|
},
|
|
925
941
|
getCellValue: (e, t, n) => {
|
|
926
|
-
const l =
|
|
927
|
-
return l ?
|
|
942
|
+
const l = oe(n);
|
|
943
|
+
return l ? Nt(l, e, t) : null;
|
|
928
944
|
},
|
|
929
945
|
getCellText: (e, t, n) => {
|
|
930
|
-
const l =
|
|
931
|
-
return l ?
|
|
946
|
+
const l = oe(n);
|
|
947
|
+
return l ? kt(l, e, t, de()) : "";
|
|
932
948
|
},
|
|
933
949
|
getSheetData: (e, t) => {
|
|
934
|
-
const n =
|
|
935
|
-
return n ?
|
|
950
|
+
const n = oe(t);
|
|
951
|
+
return n ? Ft(n, { ...e, date1904: de() }) : [];
|
|
936
952
|
},
|
|
937
953
|
getSheetJSON: (e, t) => {
|
|
938
|
-
const n =
|
|
939
|
-
return n ?
|
|
954
|
+
const n = oe(t);
|
|
955
|
+
return n ? Et(n, { ...e, date1904: de() }) : [];
|
|
940
956
|
},
|
|
941
957
|
getRangeData: (e, t, n) => {
|
|
942
|
-
const l =
|
|
943
|
-
return l ?
|
|
958
|
+
const l = oe(n);
|
|
959
|
+
return l ? Rt(l, e, { ...t, date1904: de() }) : [];
|
|
944
960
|
}
|
|
945
961
|
}).current;
|
|
946
|
-
|
|
962
|
+
E(() => {
|
|
947
963
|
var l;
|
|
948
|
-
const e = /* @__PURE__ */ new Map(), t = [], n = (
|
|
949
|
-
let
|
|
950
|
-
|
|
964
|
+
const e = /* @__PURE__ */ new Map(), t = [], n = (o, m) => {
|
|
965
|
+
let i = e.get(o);
|
|
966
|
+
i || e.set(o, i = /* @__PURE__ */ new Set()), i.add(m);
|
|
951
967
|
};
|
|
952
|
-
for (const
|
|
953
|
-
if (
|
|
954
|
-
for (const [
|
|
955
|
-
const
|
|
956
|
-
var
|
|
957
|
-
return (
|
|
968
|
+
for (const o of ue) {
|
|
969
|
+
if (o.events)
|
|
970
|
+
for (const [i, d] of Object.entries(o.events)) d && n(i, d);
|
|
971
|
+
const m = (l = o.setup) == null ? void 0 : l.call(o, { viewer: ge, on: n, redraw: () => {
|
|
972
|
+
var i;
|
|
973
|
+
return (i = r.current) == null ? void 0 : i.render();
|
|
958
974
|
} });
|
|
959
|
-
typeof
|
|
975
|
+
typeof m == "function" && t.push(m);
|
|
960
976
|
}
|
|
961
|
-
return
|
|
962
|
-
t.forEach((
|
|
977
|
+
return ye.current = e, ke(), () => {
|
|
978
|
+
t.forEach((o) => o()), ye.current = /* @__PURE__ */ new Map();
|
|
963
979
|
};
|
|
964
|
-
}, [
|
|
965
|
-
const
|
|
966
|
-
(e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(),
|
|
967
|
-
},
|
|
980
|
+
}, [c.plugins]);
|
|
981
|
+
const Lt = (e) => {
|
|
982
|
+
(e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(), he(!0));
|
|
983
|
+
}, Te = () => {
|
|
968
984
|
var e, t;
|
|
969
|
-
|
|
970
|
-
},
|
|
985
|
+
he(!1), (e = r.current) == null || e.clearFind(), (t = U.current) == null || t.focus();
|
|
986
|
+
}, Ht = () => {
|
|
971
987
|
var t;
|
|
972
|
-
const e =
|
|
973
|
-
e && (
|
|
974
|
-
},
|
|
975
|
-
|
|
976
|
-
},
|
|
988
|
+
const e = U.current;
|
|
989
|
+
e && (Se.current = null, (t = r.current) == null || t.setScroll(e.scrollLeft, e.scrollTop));
|
|
990
|
+
}, h = r.current, ce = (h == null ? void 0 : h.renderer) ?? null, V = (h == null ? void 0 : h.getActiveCell()) ?? null, R = (h == null ? void 0 : h.getSelection()) ?? null, Ye = V ? Oe(V.col) + (V.row + 1) : "", et = ce && V ? ce.cellFormula(V.row, V.col) ?? ce.cellText(V.row, V.col) : "", Bt = !!(h != null && h.canEditActiveCell()), Vt = (h == null ? void 0 : h.getCellEditString()) ?? "", Pe = ne.current ? zt : Vt, Jt = () => {
|
|
991
|
+
ne.current = !0, He((h == null ? void 0 : h.getCellEditString()) ?? "");
|
|
992
|
+
}, tt = (e) => {
|
|
977
993
|
var t;
|
|
978
|
-
|
|
979
|
-
},
|
|
994
|
+
h == null || h.commitActiveCellValue(Pe, e), ne.current = !1, e === "down" && ((t = U.current) == null || t.focus()), B();
|
|
995
|
+
}, _t = () => {
|
|
980
996
|
var e;
|
|
981
|
-
|
|
982
|
-
},
|
|
983
|
-
|
|
984
|
-
},
|
|
985
|
-
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(),
|
|
986
|
-
},
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
997
|
+
ne.current = !1, (e = U.current) == null || e.focus(), B();
|
|
998
|
+
}, Kt = () => {
|
|
999
|
+
ne.current && tt();
|
|
1000
|
+
}, $t = (e) => {
|
|
1001
|
+
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), tt("down")) : e.key === "Escape" && (e.preventDefault(), _t());
|
|
1002
|
+
}, Xt = R && !(R.top === R.bottom && R.left === R.right) ? `${Oe(R.left)}${R.top + 1}:${Oe(R.right)}${R.bottom + 1}` : "", O = ce && R ? ce.selectionStats(R) : null, fe = (h == null ? void 0 : h.getFindState()) ?? { query: "", count: 0, index: -1 }, P = (e) => ln[e], C = (e) => ({ kind: "builtin", ...e }), z = s == null ? void 0 : s.sheets[N], nt = () => {
|
|
1003
|
+
var e;
|
|
1004
|
+
return void ((e = r.current) == null ? void 0 : e.downloadPdf().catch(re));
|
|
1005
|
+
}, rt = () => {
|
|
1006
|
+
var e;
|
|
1007
|
+
return void ((e = r.current) == null ? void 0 : e.downloadPdf({ vector: !0 }).catch(re));
|
|
1008
|
+
}, lt = () => {
|
|
1009
|
+
var e;
|
|
1010
|
+
return void ((e = r.current) == null ? void 0 : e.print().catch(re));
|
|
1011
|
+
}, jt = () => {
|
|
1012
|
+
var l;
|
|
1013
|
+
const e = z, t = r.current;
|
|
1014
|
+
if (!e || !t) return;
|
|
1015
|
+
const n = e.freeze;
|
|
1016
|
+
if (n.frozenRows || n.frozenCols) e.freeze = { frozenRows: 0, frozenCols: 0 };
|
|
1017
|
+
else {
|
|
1018
|
+
const o = t.getActiveCell();
|
|
1019
|
+
e.freeze = { frozenRows: o ? o.row : 1, frozenCols: o ? o.col : 0 };
|
|
1020
|
+
}
|
|
1021
|
+
(l = t.renderer) == null || l.rebuildMetrics(), t.refreshContentSize(), t.render();
|
|
1022
|
+
};
|
|
1023
|
+
function Ut(e) {
|
|
1024
|
+
const t = r.current;
|
|
1025
|
+
switch (e) {
|
|
1026
|
+
case "find":
|
|
1027
|
+
return C({ id: e, iconSvg: P("find"), label: "查找", title: "查找 (Ctrl+F)", active: Ce, onClick: () => Ce ? Te() : he(!0) });
|
|
1028
|
+
case "filter":
|
|
1029
|
+
return C({ id: e, iconSvg: P("filter"), label: "筛选", title: "切换自动筛选", active: !!(z != null && z.autoFilterRange), onClick: () => t == null ? void 0 : t.toggleAutoFilter() });
|
|
1030
|
+
case "clear-filter":
|
|
1031
|
+
return C({ id: e, iconSvg: P("clear-filter"), label: "清除筛选", title: "清除当前表全部筛选", disabled: !(t != null && t.hasFilters()), onClick: () => t == null ? void 0 : t.clearAllFilters() });
|
|
1032
|
+
case "copy":
|
|
1033
|
+
return C({ id: e, iconSvg: P("copy"), label: "复制", title: "复制选区 (Ctrl+C)", disabled: !R, onClick: () => void (t == null ? void 0 : t.copySelection()) });
|
|
1034
|
+
case "wrap-text": {
|
|
1035
|
+
const n = (t == null ? void 0 : t.getSelectionWrapState()) ?? "none";
|
|
1036
|
+
return C({ id: e, iconSvg: P("wrap-text"), label: "自动换行", title: "自动换行(选区,WPS 风格 toggle)", active: n === "all", disabled: !R || !c.editable, onClick: () => void (t == null ? void 0 : t.toggleWrapTextOnSelection()) });
|
|
1037
|
+
}
|
|
1038
|
+
case "template": {
|
|
1039
|
+
const n = !!ee, l = te, o = !!c.src && !c.workbook;
|
|
1040
|
+
return C({
|
|
1041
|
+
id: e,
|
|
1042
|
+
iconSvg: P("template"),
|
|
1043
|
+
label: "模板",
|
|
1044
|
+
title: o ? "模板仅对 JSON / 模型数据源生效;当前是 .xlsx 数据源,模板不可用" : n ? `模板已加载:${l || "(未命名)"}` : "为 JSON / 模型数据源套用 .xlsx 模板的样式;模板的文字内容会被丢弃",
|
|
1045
|
+
active: n,
|
|
1046
|
+
disabled: o,
|
|
1047
|
+
items: [
|
|
1048
|
+
C({ id: "tpl-default", label: (n ? "" : "✓ ") + "默认渲染", title: "不套模板,数据按默认样式渲染", disabled: !n, onClick: ze }),
|
|
1049
|
+
C({ id: "tpl-sep", type: "separator" }),
|
|
1050
|
+
C({ id: "tpl-import", label: "导入 .xlsx 模板…", title: "选一份 .xlsx, 把它的 styling 套到当前 JSON 数据上", onClick: Dt }),
|
|
1051
|
+
C({ id: "tpl-clear", label: "清除模板", title: "切回默认样式渲染", disabled: !n, onClick: ze })
|
|
1052
|
+
]
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
case "image-tools": {
|
|
1056
|
+
const n = R, l = t == null ? void 0 : t.getActiveCell(), o = ((z == null ? void 0 : z.images.length) ?? 0) > 0;
|
|
1057
|
+
return C({
|
|
1058
|
+
id: e,
|
|
1059
|
+
iconSvg: P("image-tools"),
|
|
1060
|
+
label: "图片工具",
|
|
1061
|
+
title: "浮动图 ⇄ 单元格内嵌图(WPS DISPIMG)互转",
|
|
1062
|
+
disabled: !c.editable,
|
|
1063
|
+
items: [
|
|
1064
|
+
C({ id: "img-sel-to-cell", label: "选区:浮动 → 嵌入", title: '把选区里"中心格在选区内"的浮动图就近嵌入', disabled: !n || !o, onClick: () => n && (t == null ? void 0 : t.convertImagesInRangeToCell(n)) }),
|
|
1065
|
+
C({ id: "img-sel-to-float", label: "选区:嵌入 → 浮动", title: "把选区内所有 DISPIMG 格拎成浮动图", disabled: !n, onClick: () => n && (t == null ? void 0 : t.convertCellImagesInRangeToFloat(n)) }),
|
|
1066
|
+
C({ id: "img-sep", type: "separator" }),
|
|
1067
|
+
C({ id: "img-all-to-cell", label: "整表:浮动 → 嵌入", title: "全表浮动图按几何就近嵌入各自单元格", disabled: !o, onClick: () => t == null ? void 0 : t.convertAllImagesToCells() }),
|
|
1068
|
+
C({ id: "img-col-to-cell", label: "整列:浮动 → 嵌入(活动列)", title: "把中心落在活动列的浮动图就近嵌入", disabled: !o || !l, onClick: () => l && (t == null ? void 0 : t.convertAllImagesToCells(l.col)) })
|
|
1069
|
+
]
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
case "freeze": {
|
|
1073
|
+
const n = z == null ? void 0 : z.freeze;
|
|
1074
|
+
return C({ id: e, iconSvg: P("freeze"), label: "冻结", title: "冻结/取消冻结(在活动单元格)", active: !!(n && (n.frozenRows || n.frozenCols)), onClick: jt });
|
|
1075
|
+
}
|
|
1076
|
+
case "export":
|
|
1077
|
+
return C({
|
|
1078
|
+
id: e,
|
|
1079
|
+
iconSvg: P("export"),
|
|
1080
|
+
label: "导出",
|
|
1081
|
+
title: "导出 / 打印",
|
|
1082
|
+
items: [
|
|
1083
|
+
C({ id: "export-png", label: "导出为图片 (PNG)", onClick: () => void (t == null ? void 0 : t.downloadImage().catch(re)) }),
|
|
1084
|
+
C({ id: "export-pdf", label: "导出为 PDF (位图)", onClick: nt }),
|
|
1085
|
+
C({ id: "export-pdf-vector", label: "导出为 PDF (矢量·文字可选)", onClick: rt }),
|
|
1086
|
+
C({ id: "export-print", label: "打印…", onClick: lt })
|
|
1087
|
+
]
|
|
1088
|
+
});
|
|
1089
|
+
case "zoom":
|
|
1090
|
+
return C({
|
|
1091
|
+
id: e,
|
|
1092
|
+
iconSvg: P("zoom"),
|
|
1093
|
+
label: Math.round(p * 100) + "%",
|
|
1094
|
+
title: "缩放",
|
|
1095
|
+
items: [50, 75, 100, 125, 150, 200].map((n) => C({ id: "zoom-" + n, label: n + "%", active: Math.round(p * 100) === n, onClick: () => L(n / 100) }))
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
return null;
|
|
1099
|
+
}
|
|
1100
|
+
function Me(e, t) {
|
|
1101
|
+
var l;
|
|
1102
|
+
const n = { kind: t, id: e.id, type: e.type, icon: e.icon, label: e.label, title: e.title };
|
|
1103
|
+
return e.active && (n.active = !!e.active(ge)), e.disabled && (n.disabled = !!e.disabled(ge)), e.onClick && (n.onClick = () => {
|
|
1104
|
+
var o;
|
|
1105
|
+
return (o = e.onClick) == null ? void 0 : o.call(e, ge);
|
|
1106
|
+
}), (l = e.items) != null && l.length && (n.items = e.items.map((o) => Me(o, t))), n;
|
|
1107
|
+
}
|
|
1108
|
+
const ot = (() => {
|
|
1109
|
+
if (c.toolbar === !1) return [];
|
|
1110
|
+
const e = Array.isArray(c.toolbar) ? c.toolbar : ["find", "filter"], t = [];
|
|
1111
|
+
for (const n of e)
|
|
1112
|
+
if (typeof n == "string")
|
|
1113
|
+
if (n === "separator" || n === "|") t.push({ id: "sep-" + t.length, type: "separator", kind: "builtin" });
|
|
1114
|
+
else {
|
|
1115
|
+
const l = Ut(n);
|
|
1116
|
+
l && t.push(l);
|
|
1016
1117
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
},
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
W && !e && /* @__PURE__ */ s("button", { onClick: bt, title: "清除模板,切回默认渲染", children: "清除模板" })
|
|
1055
|
-
] });
|
|
1056
|
-
})(),
|
|
1057
|
-
le.flatMap((e) => e.toolbar ?? []).filter((e) => e.type !== "separator").map((e) => {
|
|
1058
|
-
var t, n;
|
|
1059
|
-
return /* @__PURE__ */ s(
|
|
1118
|
+
else
|
|
1119
|
+
t.push(Me(n, "custom"));
|
|
1120
|
+
for (const n of ue) for (const l of n.toolbar ?? []) t.push(Me(l, "plugin"));
|
|
1121
|
+
return t;
|
|
1122
|
+
})(), Zt = c.toolbar !== !1 && ot.length > 0, Gt = s ? s.sheets.filter((e) => e.state === "visible").length : 0, ct = [0.5, 0.75, 1, 1.25, 1.5, 2], Ae = (e) => L(Math.min(3, Math.max(0.3, e))), at = ({ items: e, onPick: t, className: n = "rxl-tb-menu" }) => /* @__PURE__ */ a("div", { className: n, "data-tb-menu": "true", children: e.map((l) => l.type === "separator" ? /* @__PURE__ */ a("div", { className: "sep" }, l.id) : /* @__PURE__ */ g(
|
|
1123
|
+
"button",
|
|
1124
|
+
{
|
|
1125
|
+
className: "mi" + (l.active ? " active" : ""),
|
|
1126
|
+
disabled: !!l.disabled,
|
|
1127
|
+
title: l.title,
|
|
1128
|
+
onClick: (o) => {
|
|
1129
|
+
o.stopPropagation(), l.disabled || t(l);
|
|
1130
|
+
},
|
|
1131
|
+
children: [
|
|
1132
|
+
l.iconSvg ? /* @__PURE__ */ a("span", { className: "ic", dangerouslySetInnerHTML: { __html: De(l.iconSvg) } }) : l.icon ? /* @__PURE__ */ a("span", { className: "ic-e", children: l.icon }) : null,
|
|
1133
|
+
/* @__PURE__ */ a("span", { className: "lb", children: l.label || l.id })
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1136
|
+
l.id
|
|
1137
|
+
)) }), J = (h == null ? void 0 : h.getFilterPopup()) ?? null, ae = Se.current, st = s ? s.sheets.map((e, t) => ({ s: e, i: t })).filter(({ s: e }) => e.state === "visible") : [];
|
|
1138
|
+
return /* @__PURE__ */ g("div", { className: "rxl" + (c.className ? " " + c.className : ""), style: c.style, onKeyDown: Lt, children: [
|
|
1139
|
+
/* @__PURE__ */ a("input", { ref: We, type: "file", accept: ".xlsx,.xlsm", hidden: !0, onChange: Ot }),
|
|
1140
|
+
s && /* @__PURE__ */ g("div", { className: "rxl-toolbar", children: [
|
|
1141
|
+
/* @__PURE__ */ g("span", { className: "file", title: Le + (te ? " · 模板: " + te : ""), children: [
|
|
1142
|
+
Le || "未命名工作簿",
|
|
1143
|
+
te && /* @__PURE__ */ g("span", { className: "tpl", children: [
|
|
1144
|
+
" · 模板: ",
|
|
1145
|
+
te
|
|
1146
|
+
] })
|
|
1147
|
+
] }),
|
|
1148
|
+
/* @__PURE__ */ g("span", { className: "meta", children: [
|
|
1149
|
+
Gt,
|
|
1150
|
+
" 个工作表"
|
|
1151
|
+
] }),
|
|
1152
|
+
/* @__PURE__ */ a("div", { className: "spacer" }),
|
|
1153
|
+
/* @__PURE__ */ g("div", { className: "rxl-export-wrap", "data-tb-menu": "true", children: [
|
|
1154
|
+
/* @__PURE__ */ g(
|
|
1060
1155
|
"button",
|
|
1061
1156
|
{
|
|
1062
|
-
className:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
onClick: () => {
|
|
1066
|
-
var l;
|
|
1067
|
-
return (l = e.onClick) == null ? void 0 : l.call(e, oe);
|
|
1157
|
+
className: "rxl-export-btn" + (se === "__header-export" ? " open" : ""),
|
|
1158
|
+
onClick: (e) => {
|
|
1159
|
+
e.stopPropagation(), j(se === "__header-export" ? null : "__header-export");
|
|
1068
1160
|
},
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1161
|
+
title: "导出 / 打印",
|
|
1162
|
+
children: [
|
|
1163
|
+
"导出 ",
|
|
1164
|
+
/* @__PURE__ */ a("span", { className: "caret", children: "▾" })
|
|
1165
|
+
]
|
|
1166
|
+
}
|
|
1167
|
+
),
|
|
1168
|
+
se === "__header-export" && /* @__PURE__ */ a(
|
|
1169
|
+
at,
|
|
1170
|
+
{
|
|
1171
|
+
items: [
|
|
1172
|
+
C({ id: "h-png", label: "导出为图片 (PNG)", onClick: () => {
|
|
1173
|
+
var e;
|
|
1174
|
+
return void ((e = r.current) == null ? void 0 : e.downloadImage().catch(re));
|
|
1175
|
+
} }),
|
|
1176
|
+
C({ id: "h-pdf", label: "导出为 PDF (位图)", onClick: nt }),
|
|
1177
|
+
C({ id: "h-pdf-vec", label: "导出为 PDF (矢量·文字可选)", onClick: rt }),
|
|
1178
|
+
C({ id: "h-print", label: "打印…", onClick: lt })
|
|
1179
|
+
],
|
|
1180
|
+
onPick: (e) => {
|
|
1181
|
+
var t;
|
|
1182
|
+
j(null), (t = e.onClick) == null || t.call(e);
|
|
1183
|
+
},
|
|
1184
|
+
className: "rxl-tb-menu header-menu"
|
|
1185
|
+
}
|
|
1186
|
+
)
|
|
1187
|
+
] }),
|
|
1188
|
+
/* @__PURE__ */ g("div", { className: "rxl-zoom", children: [
|
|
1189
|
+
/* @__PURE__ */ a("button", { onClick: () => Ae(p - 0.1), title: "缩小", children: "−" }),
|
|
1190
|
+
/* @__PURE__ */ g("select", { value: p, onChange: (e) => Ae(parseFloat(e.target.value)), children: [
|
|
1191
|
+
ct.map((e) => /* @__PURE__ */ g("option", { value: e, children: [
|
|
1192
|
+
Math.round(e * 100),
|
|
1193
|
+
"%"
|
|
1194
|
+
] }, e)),
|
|
1195
|
+
!ct.includes(p) && /* @__PURE__ */ g("option", { value: p, children: [
|
|
1196
|
+
Math.round(p * 100),
|
|
1197
|
+
"%"
|
|
1198
|
+
] }, "cur")
|
|
1199
|
+
] }),
|
|
1200
|
+
/* @__PURE__ */ a("button", { onClick: () => Ae(p + 0.1), title: "放大", children: "+" })
|
|
1201
|
+
] })
|
|
1074
1202
|
] }),
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
/* @__PURE__ */
|
|
1078
|
-
|
|
1079
|
-
|
|
1203
|
+
s && Zt && /* @__PURE__ */ a("div", { className: "rxl-action-toolbar", children: ot.map((e) => {
|
|
1204
|
+
var l;
|
|
1205
|
+
if (e.type === "separator") return /* @__PURE__ */ a("span", { className: "rxl-at-divider" }, e.id);
|
|
1206
|
+
const t = !!((l = e.items) != null && l.length), n = se === e.id;
|
|
1207
|
+
return /* @__PURE__ */ g("div", { className: "rxl-at-dd", "data-tb-menu": "true", children: [
|
|
1208
|
+
/* @__PURE__ */ g(
|
|
1209
|
+
"button",
|
|
1210
|
+
{
|
|
1211
|
+
className: "rxl-at-tool" + (e.active ? " active" : "") + (n ? " open" : ""),
|
|
1212
|
+
disabled: !!e.disabled,
|
|
1213
|
+
title: e.title || e.label || e.id,
|
|
1214
|
+
onClick: (o) => {
|
|
1215
|
+
var m;
|
|
1216
|
+
o.stopPropagation(), !e.disabled && (t ? j(n ? null : e.id) : ((m = e.onClick) == null || m.call(e), j(null)));
|
|
1217
|
+
},
|
|
1218
|
+
children: [
|
|
1219
|
+
e.iconSvg ? /* @__PURE__ */ a("span", { className: "rxl-at-ic", dangerouslySetInnerHTML: { __html: De(e.iconSvg) } }) : e.icon ? /* @__PURE__ */ a("span", { className: "rxl-at-ic-e", children: e.icon }) : null,
|
|
1220
|
+
e.label && /* @__PURE__ */ a("span", { className: "rxl-at-lb", children: e.label }),
|
|
1221
|
+
t && /* @__PURE__ */ a("span", { className: "rxl-at-caret", dangerouslySetInnerHTML: { __html: De(P("caret")) } })
|
|
1222
|
+
]
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
t && n && /* @__PURE__ */ a(
|
|
1226
|
+
at,
|
|
1227
|
+
{
|
|
1228
|
+
items: e.items,
|
|
1229
|
+
onPick: (o) => {
|
|
1230
|
+
var m;
|
|
1231
|
+
j(null), (m = o.onClick) == null || m.call(o);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
] }, e.id);
|
|
1236
|
+
}) }),
|
|
1237
|
+
s && /* @__PURE__ */ g("div", { className: "rxl-formula-bar", children: [
|
|
1238
|
+
/* @__PURE__ */ a("span", { className: "addr", children: Ye || "—" }),
|
|
1239
|
+
/* @__PURE__ */ a("span", { className: "fx", children: "fx" }),
|
|
1240
|
+
Bt ? /* @__PURE__ */ a(
|
|
1241
|
+
"textarea",
|
|
1080
1242
|
{
|
|
1243
|
+
ref: Be,
|
|
1081
1244
|
className: "content content-input",
|
|
1082
|
-
value:
|
|
1083
|
-
title:
|
|
1245
|
+
value: Pe,
|
|
1246
|
+
title: Pe,
|
|
1247
|
+
rows: 1,
|
|
1084
1248
|
spellCheck: !1,
|
|
1085
|
-
onFocus:
|
|
1086
|
-
onChange: (e) =>
|
|
1087
|
-
|
|
1088
|
-
|
|
1249
|
+
onFocus: Jt,
|
|
1250
|
+
onChange: (e) => {
|
|
1251
|
+
He(e.target.value), Ve();
|
|
1252
|
+
},
|
|
1253
|
+
onKeyDown: $t,
|
|
1254
|
+
onBlur: Kt
|
|
1089
1255
|
}
|
|
1090
|
-
) : /* @__PURE__ */
|
|
1256
|
+
) : /* @__PURE__ */ a("span", { className: "content", title: et, children: et })
|
|
1091
1257
|
] }),
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
/* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ g("div", { className: "rxl-render-area", ref: Je, children: [
|
|
1259
|
+
/* @__PURE__ */ a("canvas", { ref: _e, className: "rxl-canvas" }),
|
|
1260
|
+
/* @__PURE__ */ a("div", { className: "rxl-ov", ref: ve }),
|
|
1261
|
+
/* @__PURE__ */ a("div", { className: "rxl-ov", ref: be }),
|
|
1262
|
+
/* @__PURE__ */ a("div", { className: "rxl-ov", ref: xe }),
|
|
1263
|
+
/* @__PURE__ */ a("div", { className: "rxl-ov", ref: pe }),
|
|
1264
|
+
/* @__PURE__ */ a(
|
|
1099
1265
|
"div",
|
|
1100
1266
|
{
|
|
1101
1267
|
className: "rxl-scroller",
|
|
1102
|
-
ref:
|
|
1268
|
+
ref: U,
|
|
1103
1269
|
tabIndex: 0,
|
|
1104
|
-
onScroll:
|
|
1270
|
+
onScroll: Ht,
|
|
1105
1271
|
onMouseDown: (e) => {
|
|
1106
1272
|
var t;
|
|
1107
1273
|
return (t = r.current) == null ? void 0 : t.onMouseDown(e.nativeEvent);
|
|
@@ -1130,47 +1296,47 @@ const Gt = Pt(function(a, I) {
|
|
|
1130
1296
|
var t;
|
|
1131
1297
|
return (t = r.current) == null ? void 0 : t.onContextMenu(e.nativeEvent);
|
|
1132
1298
|
},
|
|
1133
|
-
children: /* @__PURE__ */
|
|
1299
|
+
children: /* @__PURE__ */ a("div", { className: "rxl-spacer", ref: Ke })
|
|
1134
1300
|
}
|
|
1135
1301
|
),
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
|
|
1139
|
-
/* @__PURE__ */
|
|
1302
|
+
/* @__PURE__ */ a("div", { className: "rxl-ov-slot", children: /* @__PURE__ */ a("div", { ref: we }) }),
|
|
1303
|
+
/* @__PURE__ */ a("div", { className: "rxl-editor-slot", ref: Ie }),
|
|
1304
|
+
Ce && s && /* @__PURE__ */ g("div", { className: "rxl-findbar", children: [
|
|
1305
|
+
/* @__PURE__ */ a(
|
|
1140
1306
|
"input",
|
|
1141
1307
|
{
|
|
1142
1308
|
autoFocus: !0,
|
|
1143
1309
|
placeholder: "查找…",
|
|
1144
|
-
value:
|
|
1310
|
+
value: fe.query,
|
|
1145
1311
|
onChange: (e) => {
|
|
1146
1312
|
var t;
|
|
1147
1313
|
return (t = r.current) == null ? void 0 : t.setFindQuery(e.target.value);
|
|
1148
1314
|
},
|
|
1149
1315
|
onKeyDown: (e) => {
|
|
1150
1316
|
var t, n;
|
|
1151
|
-
e.key === "Enter" ? e.shiftKey ? (t = r.current) == null || t.findPrev() : (n = r.current) == null || n.findNext() : e.key === "Escape" &&
|
|
1317
|
+
e.key === "Enter" ? e.shiftKey ? (t = r.current) == null || t.findPrev() : (n = r.current) == null || n.findNext() : e.key === "Escape" && Te();
|
|
1152
1318
|
}
|
|
1153
1319
|
}
|
|
1154
1320
|
),
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
/* @__PURE__ */
|
|
1321
|
+
/* @__PURE__ */ a("span", { className: "count", children: fe.count ? `${fe.index + 1}/${fe.count}` : "无结果" }),
|
|
1322
|
+
/* @__PURE__ */ a("button", { onClick: () => {
|
|
1157
1323
|
var e;
|
|
1158
1324
|
return (e = r.current) == null ? void 0 : e.findPrev();
|
|
1159
1325
|
}, children: "↑" }),
|
|
1160
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ a("button", { onClick: () => {
|
|
1161
1327
|
var e;
|
|
1162
1328
|
return (e = r.current) == null ? void 0 : e.findNext();
|
|
1163
1329
|
}, children: "↓" }),
|
|
1164
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ a("button", { onClick: Te, children: "✕" })
|
|
1165
1331
|
] }),
|
|
1166
|
-
|
|
1167
|
-
|
|
1332
|
+
J && /* @__PURE__ */ a(
|
|
1333
|
+
gn,
|
|
1168
1334
|
{
|
|
1169
|
-
values:
|
|
1170
|
-
selected:
|
|
1171
|
-
x:
|
|
1172
|
-
y:
|
|
1173
|
-
sortDir:
|
|
1335
|
+
values: J.values,
|
|
1336
|
+
selected: J.selected,
|
|
1337
|
+
x: J.x,
|
|
1338
|
+
y: J.y,
|
|
1339
|
+
sortDir: J.sortDir,
|
|
1174
1340
|
onApply: (e) => {
|
|
1175
1341
|
var t;
|
|
1176
1342
|
return (t = r.current) == null ? void 0 : t.applyFilterSelection(e);
|
|
@@ -1185,91 +1351,91 @@ const Gt = Pt(function(a, I) {
|
|
|
1185
1351
|
},
|
|
1186
1352
|
onSort: (e) => {
|
|
1187
1353
|
var n, l;
|
|
1188
|
-
const t =
|
|
1354
|
+
const t = J.col;
|
|
1189
1355
|
(n = r.current) == null || n.closeFilterPopup(), (l = r.current) == null || l.sortColumn(t, e);
|
|
1190
1356
|
}
|
|
1191
1357
|
},
|
|
1192
|
-
|
|
1358
|
+
J.col
|
|
1193
1359
|
),
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
!
|
|
1360
|
+
ae && /* @__PURE__ */ a("div", { className: "rxl-tooltip " + ae.kind, style: { left: ae.x, top: ae.y }, children: ae.text }),
|
|
1361
|
+
w && /* @__PURE__ */ a("div", { className: "rxl-state", children: (F == null ? void 0 : F.stage) === "read" ? "读取文件…" : (F == null ? void 0 : F.stage) === "parse" ? "解析中…" : "构建表格…" }),
|
|
1362
|
+
!w && T && /* @__PURE__ */ g("div", { className: "rxl-state error", children: [
|
|
1197
1363
|
"解析失败:",
|
|
1198
|
-
|
|
1364
|
+
T
|
|
1199
1365
|
] }),
|
|
1200
|
-
!
|
|
1366
|
+
!w && !s && /* @__PURE__ */ a("div", { className: "rxl-state", children: "拖入或选择一个 .xlsx 文件" })
|
|
1201
1367
|
] }),
|
|
1202
|
-
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
|
|
1206
|
-
/* @__PURE__ */
|
|
1368
|
+
s && /* @__PURE__ */ g("div", { className: "rxl-status-bar", children: [
|
|
1369
|
+
/* @__PURE__ */ a("span", { style: { color: "#888" }, children: Xt || Ye }),
|
|
1370
|
+
/* @__PURE__ */ a("div", { className: "grow" }),
|
|
1371
|
+
O && O.numCount > 0 ? /* @__PURE__ */ g(qt, { children: [
|
|
1372
|
+
/* @__PURE__ */ g("span", { children: [
|
|
1207
1373
|
"计数 ",
|
|
1208
|
-
|
|
1374
|
+
O.count
|
|
1209
1375
|
] }),
|
|
1210
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ g("span", { children: [
|
|
1211
1377
|
"求和 ",
|
|
1212
|
-
|
|
1378
|
+
me(O.sum)
|
|
1213
1379
|
] }),
|
|
1214
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ g("span", { children: [
|
|
1215
1381
|
"平均 ",
|
|
1216
|
-
|
|
1382
|
+
me(O.avg)
|
|
1217
1383
|
] }),
|
|
1218
|
-
/* @__PURE__ */
|
|
1384
|
+
/* @__PURE__ */ g("span", { children: [
|
|
1219
1385
|
"最大 ",
|
|
1220
|
-
|
|
1386
|
+
me(O.max)
|
|
1221
1387
|
] }),
|
|
1222
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ g("span", { children: [
|
|
1223
1389
|
"最小 ",
|
|
1224
|
-
|
|
1390
|
+
me(O.min)
|
|
1225
1391
|
] })
|
|
1226
|
-
] }) :
|
|
1392
|
+
] }) : O && O.count > 0 ? /* @__PURE__ */ g("span", { children: [
|
|
1227
1393
|
"计数 ",
|
|
1228
|
-
|
|
1394
|
+
O.count
|
|
1229
1395
|
] }) : null
|
|
1230
1396
|
] }),
|
|
1231
|
-
|
|
1232
|
-
|
|
1397
|
+
s && st.length > 0 && /* @__PURE__ */ a("div", { className: "rxl-tabs", children: st.map(({ s: e, i: t }) => /* @__PURE__ */ a("button", { className: t === N ? "active" : "", onClick: () => $(t), children: e.name }, t)) }),
|
|
1398
|
+
c.exportProgress !== !1 && (c.renderExportProgress ? c.renderExportProgress({ state: je, busy: Ue, cancel: Ge }) : /* @__PURE__ */ a(un, { state: je, busy: Ue, onCancel: Ge }))
|
|
1233
1399
|
] });
|
|
1234
1400
|
});
|
|
1235
|
-
function
|
|
1236
|
-
const
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1401
|
+
function gn(f) {
|
|
1402
|
+
const c = f.selected.length ? new Set(f.selected) : new Set(f.values), [k, w] = y(c), T = (s) => {
|
|
1403
|
+
const F = new Set(k);
|
|
1404
|
+
F.has(s) ? F.delete(s) : F.add(s), w(F);
|
|
1239
1405
|
};
|
|
1240
|
-
return /* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1406
|
+
return /* @__PURE__ */ g("div", { className: "rxl-filterpop", style: { left: f.x, top: f.y }, children: [
|
|
1407
|
+
/* @__PURE__ */ g("div", { className: "sort", children: [
|
|
1408
|
+
/* @__PURE__ */ a("button", { className: f.sortDir === "asc" ? "on" : "", onClick: () => f.onSort("asc"), children: "↑ 升序" }),
|
|
1409
|
+
/* @__PURE__ */ a("button", { className: f.sortDir === "desc" ? "on" : "", onClick: () => f.onSort("desc"), children: "↓ 降序" })
|
|
1244
1410
|
] }),
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ g("div", { className: "list", children: [
|
|
1412
|
+
/* @__PURE__ */ g("label", { children: [
|
|
1413
|
+
/* @__PURE__ */ a(
|
|
1248
1414
|
"input",
|
|
1249
1415
|
{
|
|
1250
1416
|
type: "checkbox",
|
|
1251
|
-
checked:
|
|
1252
|
-
ref: (
|
|
1253
|
-
|
|
1417
|
+
checked: k.size === f.values.length,
|
|
1418
|
+
ref: (s) => {
|
|
1419
|
+
s && (s.indeterminate = k.size > 0 && k.size < f.values.length);
|
|
1254
1420
|
},
|
|
1255
|
-
onChange: (
|
|
1421
|
+
onChange: (s) => w(s.target.checked ? new Set(f.values) : /* @__PURE__ */ new Set())
|
|
1256
1422
|
}
|
|
1257
1423
|
),
|
|
1258
1424
|
"(全选)"
|
|
1259
1425
|
] }),
|
|
1260
|
-
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
|
|
1263
|
-
] },
|
|
1426
|
+
f.values.map((s) => /* @__PURE__ */ g("label", { children: [
|
|
1427
|
+
/* @__PURE__ */ a("input", { type: "checkbox", checked: k.has(s), onChange: () => T(s) }),
|
|
1428
|
+
s
|
|
1429
|
+
] }, s))
|
|
1264
1430
|
] }),
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ g("div", { className: "foot", children: [
|
|
1432
|
+
/* @__PURE__ */ a("button", { onClick: f.onClear, children: "清除" }),
|
|
1433
|
+
/* @__PURE__ */ a("button", { onClick: () => f.onApply([...k]), children: "确定" }),
|
|
1434
|
+
/* @__PURE__ */ a("button", { onClick: f.onClose, children: "取消" })
|
|
1269
1435
|
] })
|
|
1270
1436
|
] });
|
|
1271
1437
|
}
|
|
1272
1438
|
export {
|
|
1273
|
-
|
|
1274
|
-
|
|
1439
|
+
vn as ExcelViewer,
|
|
1440
|
+
dn as useExcelDocument
|
|
1275
1441
|
};
|