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.
- package/CHANGELOG.md +75 -0
- package/README.md +148 -4
- package/dist/chunks/plugin-overlay-BBrNby8v.js +8965 -0
- package/dist/chunks/worker-client.stub-CJlmpAgJ.js +190 -0
- package/dist/components/ExcelViewer.vue.d.ts +170 -19
- package/dist/components/ExportProgressOverlay.vue.d.ts +11 -0
- package/dist/components/FilterPopup.vue.d.ts +4 -4
- package/dist/components/ViewerToolbar.vue.d.ts +2 -0
- package/dist/composables/useExcelDocument.d.ts +1 -0
- package/dist/core/edit/clipboard-html.d.ts +24 -0
- package/dist/core/edit/commands.d.ts +45 -1
- package/dist/core/edit/context-menu.d.ts +19 -0
- package/dist/core/edit/edit-controller.d.ts +70 -2
- package/dist/core/edit/permissions.d.ts +41 -2
- package/dist/core/edit/types.d.ts +62 -0
- package/dist/core/export/abort.d.ts +21 -0
- package/dist/core/export/exporter.d.ts +2 -1
- package/dist/core/export/types.d.ts +8 -0
- package/dist/core/export/wps-cellimages.d.ts +6 -0
- package/dist/core/export/xlsx-writer.d.ts +9 -0
- package/dist/core/format/color.d.ts +5 -0
- package/dist/core/format/number-format.d.ts +3 -0
- package/dist/core/layout/autofit.d.ts +3 -0
- package/dist/core/layout/grid-metrics.d.ts +14 -2
- package/dist/core/loader-json.d.ts +23 -0
- package/dist/core/model/clone.d.ts +3 -4
- package/dist/core/model/inspect.d.ts +43 -0
- package/dist/core/model/mutations.d.ts +16 -1
- package/dist/core/model/types.d.ts +44 -2
- package/dist/core/parser/cell-image-parser.d.ts +9 -0
- package/dist/core/parser/row-meta-parser.d.ts +3 -0
- package/dist/core/plugin.d.ts +144 -6
- package/dist/core/progress.d.ts +23 -0
- package/dist/core/render/canvas-renderer.d.ts +56 -2
- package/dist/core/render/conditional.d.ts +7 -0
- package/dist/core/template/style-overlay.d.ts +9 -0
- package/dist/core/viewer/controller.d.ts +209 -6
- package/dist/core/viewer/lightbox-host.d.ts +16 -0
- package/dist/core.js +1 -1
- package/dist/index.js +1169 -821
- package/dist/react/ExcelViewer.d.ts +134 -3
- package/dist/react/ExportProgressOverlay.d.ts +6 -0
- package/dist/react/use-excel-document.d.ts +2 -0
- package/dist/react.js +718 -281
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/chunks/plugin-overlay-Cfnn9EOi.js +0 -7144
- package/dist/chunks/worker-client.stub-BQVZfaLd.js +0 -7
package/dist/react.js
CHANGED
|
@@ -1,195 +1,307 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as s, jsxs as m, Fragment as ot } from "react/jsx-runtime";
|
|
2
|
+
import { useState as R, useRef as C, useCallback as at, forwardRef as Pt, useReducer as Dt, useLayoutEffect as st, useEffect as p, useImperativeHandle as Ot } from "react";
|
|
3
|
+
import { p as Ct, i as Wt, j as Lt, a as Bt } from "./chunks/worker-client.stub-CJlmpAgJ.js";
|
|
4
|
+
import { r as it, l as ht, d as vt, f as xt, a as Ht, V as Vt, P as Jt, g as ut, s as dt, b as gt, e as ft, h as mt, i as Ne } from "./chunks/plugin-overlay-BBrNby8v.js";
|
|
5
|
+
const zt = {
|
|
6
|
+
render: "渲染中",
|
|
7
|
+
compose: "合成中",
|
|
8
|
+
paginate: "分页中",
|
|
9
|
+
write: "写出文件",
|
|
10
|
+
zip: "zip 压缩",
|
|
11
|
+
convert: "批量转换"
|
|
12
|
+
};
|
|
13
|
+
function Kt({
|
|
14
|
+
state: g,
|
|
15
|
+
busy: a,
|
|
16
|
+
onCancel: I
|
|
17
|
+
}) {
|
|
18
|
+
if (!a) return null;
|
|
19
|
+
const S = g == null ? void 0 : g.ratio, N = (g == null ? void 0 : g.label) || zt[(g == null ? void 0 : g.stage) ?? ""] || "处理中…";
|
|
20
|
+
return /* @__PURE__ */ s("div", { className: "rxl-export-progress", role: "dialog", "aria-modal": "true", "aria-live": "polite", children: /* @__PURE__ */ m("div", { className: "card", children: [
|
|
21
|
+
/* @__PURE__ */ s("div", { className: "title", children: N }),
|
|
22
|
+
/* @__PURE__ */ s("div", { className: "bar" + (S == null ? " indeterminate" : ""), children: S != null ? /* @__PURE__ */ s("div", { className: "fill", style: { width: Math.round(S * 100) + "%" } }) : null }),
|
|
23
|
+
/* @__PURE__ */ m("div", { className: "row", children: [
|
|
24
|
+
/* @__PURE__ */ s("span", { className: "pct", children: S != null ? Math.round(S * 100) + "%" : "正在处理…" }),
|
|
25
|
+
/* @__PURE__ */ s("button", { className: "cancel", onClick: I, title: "按 Esc 也可取消", children: "取消" })
|
|
26
|
+
] })
|
|
27
|
+
] }) });
|
|
28
|
+
}
|
|
29
|
+
function $t() {
|
|
30
|
+
const [g, a] = R(!1), [I, S] = R(null), [N, c] = R(null), [E, k] = R(null), [_, z] = R(null), D = C(null), y = at(async (A, J) => {
|
|
31
|
+
a(!0), S(null), D.current && it(D.current), D.current = null, c(null), z(null), k({ stage: "read", ratio: 0 });
|
|
8
32
|
try {
|
|
9
|
-
const w = await
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
),
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
let O = await
|
|
17
|
-
|
|
33
|
+
const w = await ht(
|
|
34
|
+
A,
|
|
35
|
+
($, W) => k({ stage: "read", ratio: W ? $ / W : void 0 })
|
|
36
|
+
), M = vt(w);
|
|
37
|
+
if (M === "xls") throw new Error("这是旧版 .xls(BIFF) 或加密文件,本预览器只支持 .xlsx/.xlsm。");
|
|
38
|
+
if (M === "not-zip") throw new Error("文件不是有效的 .xlsx(非 ZIP 包)。");
|
|
39
|
+
if (M === "empty") throw new Error("文件为空。");
|
|
40
|
+
let O = await Ct(w, ($) => k($));
|
|
41
|
+
J && (O = J(O) ?? O), xt(O), z(w.slice(0)), D.current = O, c(O);
|
|
18
42
|
} catch (w) {
|
|
19
|
-
const
|
|
20
|
-
|
|
43
|
+
const M = w == null ? void 0 : w.message;
|
|
44
|
+
S(M && /预览器|损坏|加密|为空|ZIP/.test(M) ? M : Ht(w)), console.error("[ooxml-preview] 解析失败:", w);
|
|
21
45
|
} finally {
|
|
22
|
-
|
|
46
|
+
a(!1), k(null);
|
|
23
47
|
}
|
|
48
|
+
}, []), K = at((A, J) => {
|
|
49
|
+
D.current && it(D.current), z(null), S(null), k(null);
|
|
50
|
+
const w = J ? J(A) ?? A : A;
|
|
51
|
+
D.current = w, c(w);
|
|
24
52
|
}, []);
|
|
25
|
-
return { loading:
|
|
53
|
+
return { loading: g, error: I, workbook: N, progress: E, load: y, loadModel: K, sourceBuffer: _ };
|
|
26
54
|
}
|
|
27
|
-
function
|
|
28
|
-
return isFinite(
|
|
55
|
+
function se(g) {
|
|
56
|
+
return isFinite(g) ? g.toLocaleString("en-US", { maximumFractionDigits: 2 }) : "—";
|
|
29
57
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
const Gt = Pt(function(a, I) {
|
|
59
|
+
var Ue;
|
|
60
|
+
const { loading: S, error: N, workbook: c, progress: E, load: k, loadModel: _, sourceBuffer: z } = $t(), D = (e) => e ? Wt(e) ? e : Lt(e, a.jsonOptions) : null, [y, K] = R(0), [A, J] = R(1), [w, M] = R(null), [O, $] = R(null), W = w ?? a.templateFile ?? null, X = O ?? a.templateName ?? "", bt = () => {
|
|
61
|
+
M(null), $(null);
|
|
62
|
+
}, Te = C(null), St = () => {
|
|
63
|
+
var e;
|
|
64
|
+
return (e = Te.current) == null ? void 0 : e.click();
|
|
65
|
+
}, wt = (e) => {
|
|
66
|
+
var n;
|
|
67
|
+
const t = (n = e.target.files) == null ? void 0 : n[0];
|
|
68
|
+
t && (M(t), $(t.name), e.target.value = "");
|
|
69
|
+
}, ie = a.fileName || (a.workbook ? "JSON 数据" : ((Ue = c == null ? void 0 : c.sheets[0]) == null ? void 0 : Ue.name) || ""), [ue, de] = R(!1), [, L] = Dt((e) => e + 1, 0), [Rt, ke] = R(""), Q = C(!1), Ae = C(null), Me = C(null), j = C(null), Pe = C(null), ge = C(null), fe = C(null), me = C(null), Ce = C(null), r = C(null), he = C(null), ve = C(null), xe = C(null), re = C(null), be = C(/* @__PURE__ */ new Map()), u = C(a);
|
|
70
|
+
u.current = a;
|
|
71
|
+
const le = a.plugins ?? [], U = C(le);
|
|
72
|
+
U.current = le;
|
|
73
|
+
const Z = C(c);
|
|
74
|
+
Z.current = c;
|
|
75
|
+
const Se = C(y);
|
|
76
|
+
Se.current = y;
|
|
77
|
+
function Et() {
|
|
78
|
+
const e = U.current, t = Object.assign({}, ...e.map((i) => i.theme || {}), u.current.theme || {}), n = e.map((i) => i.cellStyle).filter(Boolean);
|
|
41
79
|
u.current.cellStyle && n.push(u.current.cellStyle);
|
|
42
|
-
const l = n.length ? (
|
|
43
|
-
let
|
|
44
|
-
for (const
|
|
45
|
-
const
|
|
46
|
-
|
|
80
|
+
const l = n.length ? (i, h, o) => {
|
|
81
|
+
let d;
|
|
82
|
+
for (const v of n) {
|
|
83
|
+
const b = v(i, h, o);
|
|
84
|
+
b && (d = { ...d || {}, ...b });
|
|
47
85
|
}
|
|
48
|
-
return
|
|
86
|
+
return d;
|
|
49
87
|
} : void 0;
|
|
50
|
-
return { theme: t, cellStyle: l };
|
|
88
|
+
return { theme: t, cellStyle: l, cellImageFit: u.current.cellImageFit, readOnlyCellStyle: u.current.readOnlyCellStyle };
|
|
51
89
|
}
|
|
52
|
-
function
|
|
90
|
+
function q(e) {
|
|
53
91
|
let t = e;
|
|
54
|
-
for (const n of
|
|
92
|
+
for (const n of U.current) n.transformModel && (t = n.transformModel(t) ?? t);
|
|
55
93
|
return u.current.transformModel && (t = u.current.transformModel(t) ?? t), t;
|
|
56
94
|
}
|
|
57
|
-
function
|
|
95
|
+
function De() {
|
|
58
96
|
const e = u.current;
|
|
59
97
|
return {
|
|
60
98
|
editable: e.editable,
|
|
61
99
|
cellReadOnly: e.cellReadOnly,
|
|
62
100
|
readOnlyRanges: e.readOnlyRanges,
|
|
101
|
+
editableTargets: e.editableTargets,
|
|
102
|
+
strictDimensions: e.strictDimensions,
|
|
63
103
|
recalc: e.recalc,
|
|
64
104
|
formulaEngine: e.formulaEngine
|
|
65
105
|
};
|
|
66
106
|
}
|
|
67
|
-
function
|
|
68
|
-
if (u.current.editor ||
|
|
107
|
+
function Oe() {
|
|
108
|
+
if (u.current.editor || U.current.some((t) => t.editor))
|
|
69
109
|
return (t, n) => {
|
|
70
|
-
var
|
|
71
|
-
const l = (
|
|
110
|
+
var i, h, o;
|
|
111
|
+
const l = (h = (i = u.current).editor) == null ? void 0 : h.call(i, t, n);
|
|
72
112
|
if (l) return l;
|
|
73
|
-
for (const d of
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
113
|
+
for (const d of U.current) {
|
|
114
|
+
const v = (o = d.editor) == null ? void 0 : o.call(d, t, n);
|
|
115
|
+
if (v) return v;
|
|
76
116
|
}
|
|
77
117
|
};
|
|
78
118
|
}
|
|
79
|
-
const
|
|
119
|
+
const G = (e, t) => {
|
|
80
120
|
var n;
|
|
81
|
-
return (n =
|
|
121
|
+
return (n = be.current.get(e)) == null ? void 0 : n.forEach((l) => l(t));
|
|
122
|
+
}, We = (e) => {
|
|
123
|
+
var n, l;
|
|
124
|
+
const t = String((e == null ? void 0 : e.message) ?? e);
|
|
125
|
+
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
|
+
}, [Le, we] = R(null), [Be, He] = R(!1), Re = C(null), Ve = () => {
|
|
127
|
+
var e;
|
|
128
|
+
return (e = Re.current) == null ? void 0 : e.abort();
|
|
82
129
|
};
|
|
83
|
-
function
|
|
84
|
-
|
|
130
|
+
function x(e, t) {
|
|
131
|
+
if (u.current.exportProgress === !1) return t(e);
|
|
132
|
+
const n = new AbortController();
|
|
133
|
+
Re.current = n, e != null && e.signal && (e.signal.aborted ? n.abort() : e.signal.addEventListener("abort", () => n.abort(), { once: !0 })), He(!0), we(null);
|
|
134
|
+
const i = { ...e ?? {}, onProgress: (h) => {
|
|
135
|
+
var o;
|
|
136
|
+
we(h), (o = e == null ? void 0 : e.onProgress) == null || o.call(e, h);
|
|
137
|
+
}, signal: n.signal };
|
|
138
|
+
return t(i).finally(() => {
|
|
139
|
+
He(!1), we(null), Re.current = null;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function Ee() {
|
|
143
|
+
const e = re.current, t = r.current;
|
|
85
144
|
if (!e || !t) return;
|
|
86
145
|
const n = {
|
|
87
|
-
rectOf: (l,
|
|
146
|
+
rectOf: (l, i) => t.rectOf(l, i),
|
|
88
147
|
rectOfRange: (l) => t.rectOfRange(l),
|
|
89
148
|
tick: 0,
|
|
90
|
-
workbook:
|
|
149
|
+
workbook: Z.current
|
|
91
150
|
};
|
|
92
|
-
e.render(
|
|
151
|
+
e.render(U.current, n);
|
|
93
152
|
}
|
|
94
|
-
|
|
95
|
-
const e =
|
|
96
|
-
if (!e || !t || !n || !l || !
|
|
97
|
-
const
|
|
153
|
+
st(() => {
|
|
154
|
+
const e = Me.current, t = Ae.current, n = j.current, l = Pe.current;
|
|
155
|
+
if (!e || !t || !n || !l || !xe.current || !ge.current || !fe.current || !me.current || !Ce.current) return;
|
|
156
|
+
const i = new Vt(
|
|
98
157
|
{
|
|
99
158
|
canvas: e,
|
|
100
159
|
renderArea: t,
|
|
101
160
|
scroller: n,
|
|
102
161
|
spacer: l,
|
|
103
|
-
overlays: { main:
|
|
104
|
-
editorSlot:
|
|
162
|
+
overlays: { main: ge.current, frow: fe.current, fcol: me.current, corner: Ce.current },
|
|
163
|
+
editorSlot: xe.current
|
|
105
164
|
},
|
|
106
165
|
{
|
|
107
|
-
onRenderer: () =>
|
|
108
|
-
onRenderTick: () =>
|
|
166
|
+
onRenderer: () => L(),
|
|
167
|
+
onRenderTick: () => Ee(),
|
|
109
168
|
// 插件 overlay 随每帧重定位(纯 DOM,不触发 React 重渲)
|
|
110
|
-
onSelectionChange: () =>
|
|
111
|
-
onCellClick: (
|
|
112
|
-
var T,
|
|
113
|
-
const b = { row:
|
|
114
|
-
(
|
|
169
|
+
onSelectionChange: () => L(),
|
|
170
|
+
onCellClick: (o, d, v) => {
|
|
171
|
+
var T, V;
|
|
172
|
+
const b = { row: o, col: d, text: v };
|
|
173
|
+
(V = (T = u.current).onCellClick) == null || V.call(T, b), G("cell-click", b);
|
|
174
|
+
},
|
|
175
|
+
onCellDblClick: (o, d, v) => {
|
|
176
|
+
var T, V;
|
|
177
|
+
const b = { row: o, col: d, text: v };
|
|
178
|
+
(V = (T = u.current).onCellDblClick) == null || V.call(T, b), G("cell-dblclick", b);
|
|
179
|
+
},
|
|
180
|
+
onHyperlink: (o, d) => {
|
|
181
|
+
var v, b;
|
|
182
|
+
(b = (v = u.current).onHyperlinkClick) == null || b.call(v, { url: o, cell: d }), G("hyperlink-click", { url: o, cell: d }), u.current.openLinks !== !1 && window.open(o, "_blank", "noopener");
|
|
115
183
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const b = { row: s, col: d, text: C };
|
|
119
|
-
(z = (T = u.current).onCellDblClick) == null || z.call(T, b), X("cell-dblclick", b);
|
|
184
|
+
onTooltip: (o) => {
|
|
185
|
+
he.current = o, L();
|
|
120
186
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
187
|
+
onFindChange: () => L(),
|
|
188
|
+
onFilterChange: () => L(),
|
|
189
|
+
onEditEvent: (o, d) => {
|
|
190
|
+
var v, b, T, V, Ze, qe, Ge, _e, Qe, Ye, et, tt, nt, rt, lt, ct;
|
|
191
|
+
o === "cell-change" ? (L(), (b = (v = u.current).onCellChange) == null || b.call(v, d)) : o === "edit-start" ? (V = (T = u.current).onEditStart) == null || V.call(T, d) : o === "edit-commit" ? (qe = (Ze = u.current).onEditCommit) == null || qe.call(Ze, d) : o === "dim-change" ? (_e = (Ge = u.current).onDimChange) == null || _e.call(Ge, d) : o === "dirty-change" ? (Ye = (Qe = u.current).onDirtyChange) == null || Ye.call(Qe, d) : o === "image-change" ? (tt = (et = u.current).onImageChange) == null || tt.call(et, d) : o === "struct-change" ? (rt = (nt = u.current).onStructChange) == null || rt.call(nt, d) : o === "permission-denied" && ((ct = (lt = u.current).onPermissionDenied) == null || ct.call(lt, d)), G(o, d);
|
|
124
192
|
},
|
|
125
|
-
|
|
126
|
-
|
|
193
|
+
onContextMenuBefore: (o) => {
|
|
194
|
+
var d, v;
|
|
195
|
+
for (const b of u.current.plugins ?? [])
|
|
196
|
+
if (b.contextMenu) {
|
|
197
|
+
const T = b.contextMenu(o.ctx, o.items);
|
|
198
|
+
Array.isArray(T) && o.items.splice(0, o.items.length, ...T);
|
|
199
|
+
}
|
|
200
|
+
(v = (d = u.current).onBeforeContextMenu) == null || v.call(d, o), u.current.contextMenu === !1 && o.preventDefault();
|
|
127
201
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
var C, b, T, z, Ee, Ne, ke, Ie, Oe, De, Fe, Pe, Me, Ae;
|
|
132
|
-
s === "cell-change" ? (b = (C = u.current).onCellChange) == null || b.call(C, d) : s === "edit-start" ? (z = (T = u.current).onEditStart) == null || z.call(T, d) : s === "edit-commit" ? (Ne = (Ee = u.current).onEditCommit) == null || Ne.call(Ee, d) : s === "dim-change" ? (Ie = (ke = u.current).onDimChange) == null || Ie.call(ke, d) : s === "dirty-change" ? (De = (Oe = u.current).onDirtyChange) == null || De.call(Oe, d) : s === "image-change" ? (Pe = (Fe = u.current).onImageChange) == null || Pe.call(Fe, d) : s === "struct-change" && ((Ae = (Me = u.current).onStructChange) == null || Ae.call(Me, d)), X(s, d);
|
|
202
|
+
onContextMenuShow: (o) => {
|
|
203
|
+
var d, v;
|
|
204
|
+
return (v = (d = u.current).onContextMenuShow) == null ? void 0 : v.call(d, o);
|
|
133
205
|
}
|
|
134
206
|
}
|
|
135
207
|
);
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
208
|
+
i.fileName = u.current.fileName, i.setEditConfig(De()), i.setEditorResolver(Oe()), i.setContextMenuTransform(typeof u.current.contextMenu == "function" ? u.current.contextMenu : null), i.setLightboxEnabled(u.current.imageLightbox !== !1), r.current = i, ve.current && (re.current = new Jt(ve.current));
|
|
209
|
+
const h = new ResizeObserver(() => {
|
|
210
|
+
i.measure(), i.render();
|
|
139
211
|
});
|
|
140
|
-
return
|
|
141
|
-
var
|
|
142
|
-
|
|
212
|
+
return h.observe(t), () => {
|
|
213
|
+
var o;
|
|
214
|
+
h.disconnect(), i.dispose(), (o = re.current) == null || o.dispose(), re.current = null, r.current = null;
|
|
143
215
|
};
|
|
144
|
-
}, []),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
216
|
+
}, []), p(() => {
|
|
217
|
+
const e = W, t = D(a.workbook);
|
|
218
|
+
async function n(i) {
|
|
219
|
+
const h = await ht(i), o = vt(h);
|
|
220
|
+
if (o === "xls") throw new Error("模板文件是旧版 .xls 或加密,仅支持 .xlsx/.xlsm");
|
|
221
|
+
if (o === "not-zip") throw new Error("模板文件不是有效的 .xlsx(非 ZIP 包)");
|
|
222
|
+
if (o === "empty") throw new Error("模板文件为空");
|
|
223
|
+
const d = await Ct(h);
|
|
224
|
+
return xt(d), d;
|
|
225
|
+
}
|
|
226
|
+
async function l() {
|
|
227
|
+
if (a.src) {
|
|
228
|
+
e && console.warn("[ooxml-excel-editor] templateFile 只在 workbook (JSON / 模型) 数据源下生效;xlsx 数据源已自带格式,模板已忽略."), await k(a.src, q);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (t && e) {
|
|
232
|
+
try {
|
|
233
|
+
const i = await n(e), h = Bt(t, i);
|
|
234
|
+
_(h, q);
|
|
235
|
+
} catch (i) {
|
|
236
|
+
console.error("[ooxml-excel-editor] 模板加载失败,降级为纯 JSON 渲染:", i), _(t, q);
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (t) {
|
|
241
|
+
_(t, q);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
e && await k(e, q);
|
|
245
|
+
}
|
|
246
|
+
l();
|
|
247
|
+
}, [a.src, a.workbook, a.templateFile, w]), p(() => {
|
|
248
|
+
r.current && (r.current.fileName = a.fileName);
|
|
249
|
+
}, [a.fileName]), p(() => {
|
|
250
|
+
var e;
|
|
251
|
+
(e = r.current) == null || e.setEditConfig(De());
|
|
252
|
+
}, [a.editable, a.cellReadOnly, a.readOnlyRanges, a.editableTargets, a.strictDimensions, a.recalc, a.formulaEngine]), p(() => {
|
|
253
|
+
var e;
|
|
254
|
+
(e = r.current) == null || e.setContextMenuTransform(
|
|
255
|
+
typeof a.contextMenu == "function" ? a.contextMenu : null
|
|
256
|
+
);
|
|
257
|
+
}, [a.contextMenu]), p(() => {
|
|
149
258
|
var e;
|
|
150
|
-
(e = r.current) == null || e.
|
|
151
|
-
}, [
|
|
259
|
+
(e = r.current) == null || e.setEditorResolver(Oe());
|
|
260
|
+
}, [a.editor, a.plugins]), p(() => {
|
|
152
261
|
var e;
|
|
153
|
-
(e = r.current) == null || e.
|
|
154
|
-
}, [
|
|
262
|
+
a.cellImageFit && ((e = r.current) == null || e.setCellImageFit(a.cellImageFit));
|
|
263
|
+
}, [a.cellImageFit]), p(() => {
|
|
264
|
+
var e;
|
|
265
|
+
(e = r.current) == null || e.setLightboxEnabled(a.imageLightbox !== !1);
|
|
266
|
+
}, [a.imageLightbox]), p(() => {
|
|
155
267
|
var e, t;
|
|
156
|
-
c && (
|
|
157
|
-
}, [c]),
|
|
268
|
+
c && (K(c.activeSheet), (t = (e = u.current).onRendered) == null || t.call(e, c));
|
|
269
|
+
}, [c]), p(() => {
|
|
158
270
|
var e, t;
|
|
159
|
-
|
|
160
|
-
}, [
|
|
161
|
-
var l,
|
|
271
|
+
N && ((t = (e = u.current).onError) == null || t.call(e, N));
|
|
272
|
+
}, [N]), st(() => {
|
|
273
|
+
var l, i;
|
|
162
274
|
const e = r.current;
|
|
163
275
|
if (!e || !c) return;
|
|
164
|
-
const t = c.sheets[
|
|
276
|
+
const t = c.sheets[y] ?? c.sheets[0] ?? null;
|
|
165
277
|
if (!t) return;
|
|
166
|
-
e.rebuild(t, c,
|
|
167
|
-
const n = { index:
|
|
168
|
-
(
|
|
169
|
-
}, [c,
|
|
278
|
+
e.rebuild(t, c, A, Et()), e.setSourceBuffer(z), Ee();
|
|
279
|
+
const n = { index: y, name: t.name };
|
|
280
|
+
(i = (l = u.current).onSheetChange) == null || i.call(l, n), G("sheet-change", n);
|
|
281
|
+
}, [c, y, a.theme, a.cellStyle, a.plugins, z]), p(() => {
|
|
170
282
|
var e;
|
|
171
|
-
(e = r.current) == null || e.setZoom(
|
|
172
|
-
}, [
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
var
|
|
283
|
+
(e = r.current) == null || e.setZoom(A);
|
|
284
|
+
}, [A]);
|
|
285
|
+
const Je = C("");
|
|
286
|
+
p(() => {
|
|
287
|
+
var i, h;
|
|
176
288
|
const e = r.current;
|
|
177
289
|
if (!e) return;
|
|
178
290
|
const t = e.getSelection(), n = e.getActiveCell(), l = t && n ? `${t.top},${t.left},${t.bottom},${t.right}` : "";
|
|
179
|
-
if (l && l !==
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
(
|
|
291
|
+
if (l && l !== Je.current && n) {
|
|
292
|
+
Je.current = l;
|
|
293
|
+
const o = { range: t, active: n };
|
|
294
|
+
(h = (i = u.current).onSelectionChange) == null || h.call(i, o), G("selection-change", o);
|
|
183
295
|
}
|
|
184
296
|
});
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
297
|
+
const Y = (e) => (c == null ? void 0 : c.sheets[e ?? y]) ?? null, ze = (c == null ? void 0 : c.date1904) ?? !1, Ie = (e) => ({ ...e, date1904: ze });
|
|
298
|
+
Ot(
|
|
299
|
+
I,
|
|
188
300
|
() => ({
|
|
189
|
-
load: (e) =>
|
|
301
|
+
load: (e) => k(e, a.transformModel),
|
|
190
302
|
getWorkbook: () => c,
|
|
191
|
-
getActiveSheet: () =>
|
|
192
|
-
setActiveSheet: (e) => (c == null ? void 0 : c.sheets[e]) &&
|
|
303
|
+
getActiveSheet: () => y,
|
|
304
|
+
setActiveSheet: (e) => (c == null ? void 0 : c.sheets[e]) && K(e),
|
|
193
305
|
getSelection: () => {
|
|
194
306
|
var e;
|
|
195
307
|
return ((e = r.current) == null ? void 0 : e.getSelection()) ?? null;
|
|
@@ -214,6 +326,14 @@ const ut = je(function(i, p) {
|
|
|
214
326
|
var n;
|
|
215
327
|
return ((n = r.current) == null ? void 0 : n.isCellEditable(e, t)) ?? !1;
|
|
216
328
|
},
|
|
329
|
+
setEditableTargets: (e) => {
|
|
330
|
+
var t;
|
|
331
|
+
return (t = r.current) == null ? void 0 : t.setEditableTargets(e);
|
|
332
|
+
},
|
|
333
|
+
getEditableTargets: () => {
|
|
334
|
+
var e;
|
|
335
|
+
return (e = r.current) == null ? void 0 : e.getEditableTargets();
|
|
336
|
+
},
|
|
217
337
|
editCell: (e, t, n) => {
|
|
218
338
|
var l;
|
|
219
339
|
return ((l = r.current) == null ? void 0 : l.editCell(e, t, n)) ?? !1;
|
|
@@ -230,6 +350,50 @@ const ut = je(function(i, p) {
|
|
|
230
350
|
var n;
|
|
231
351
|
return ((n = r.current) == null ? void 0 : n.setStyle(e, t)) ?? !1;
|
|
232
352
|
},
|
|
353
|
+
getActiveFillColor: () => {
|
|
354
|
+
var e;
|
|
355
|
+
return ((e = r.current) == null ? void 0 : e.getActiveFillColor()) ?? "#FFFFFF";
|
|
356
|
+
},
|
|
357
|
+
getActiveFontColor: () => {
|
|
358
|
+
var e;
|
|
359
|
+
return ((e = r.current) == null ? void 0 : e.getActiveFontColor()) ?? "#000000";
|
|
360
|
+
},
|
|
361
|
+
setSelectionFill: (e) => {
|
|
362
|
+
var t;
|
|
363
|
+
return ((t = r.current) == null ? void 0 : t.setSelectionFill(e)) ?? !1;
|
|
364
|
+
},
|
|
365
|
+
setSelectionFontColor: (e) => {
|
|
366
|
+
var t;
|
|
367
|
+
return ((t = r.current) == null ? void 0 : t.setSelectionFontColor(e)) ?? !1;
|
|
368
|
+
},
|
|
369
|
+
getSelectionWrapState: () => {
|
|
370
|
+
var e;
|
|
371
|
+
return ((e = r.current) == null ? void 0 : e.getSelectionWrapState()) ?? "none";
|
|
372
|
+
},
|
|
373
|
+
toggleWrapTextOnSelection: () => {
|
|
374
|
+
var e;
|
|
375
|
+
return ((e = r.current) == null ? void 0 : e.toggleWrapTextOnSelection()) ?? !1;
|
|
376
|
+
},
|
|
377
|
+
mergeCells: (e) => {
|
|
378
|
+
var t;
|
|
379
|
+
return ((t = r.current) == null ? void 0 : t.mergeCells(e)) ?? !1;
|
|
380
|
+
},
|
|
381
|
+
unmergeCells: (e) => {
|
|
382
|
+
var t;
|
|
383
|
+
return ((t = r.current) == null ? void 0 : t.unmergeCells(e)) ?? !1;
|
|
384
|
+
},
|
|
385
|
+
pasteText: (e, t) => {
|
|
386
|
+
var n;
|
|
387
|
+
return ((n = r.current) == null ? void 0 : n.pasteText(e, t)) ?? !1;
|
|
388
|
+
},
|
|
389
|
+
pasteRichHtml: (e, t) => {
|
|
390
|
+
var n;
|
|
391
|
+
return ((n = r.current) == null ? void 0 : n.pasteRichHtml(e, t)) ?? !1;
|
|
392
|
+
},
|
|
393
|
+
pasteImageBlob: (e, t) => {
|
|
394
|
+
var n;
|
|
395
|
+
return ((n = r.current) == null ? void 0 : n.pasteImageBlob(e, t)) ?? Promise.resolve(!1);
|
|
396
|
+
},
|
|
233
397
|
getImages: () => {
|
|
234
398
|
var e;
|
|
235
399
|
return ((e = r.current) == null ? void 0 : e.getImages()) ?? [];
|
|
@@ -250,6 +414,66 @@ const ut = je(function(i, p) {
|
|
|
250
414
|
var l;
|
|
251
415
|
return ((l = r.current) == null ? void 0 : l.resizeImage(e, t, n)) ?? !1;
|
|
252
416
|
},
|
|
417
|
+
getCellImages: () => {
|
|
418
|
+
var e;
|
|
419
|
+
return ((e = r.current) == null ? void 0 : e.getCellImages()) ?? [];
|
|
420
|
+
},
|
|
421
|
+
getCellImageAt: (e, t) => {
|
|
422
|
+
var n;
|
|
423
|
+
return ((n = r.current) == null ? void 0 : n.getCellImageAt(e, t)) ?? null;
|
|
424
|
+
},
|
|
425
|
+
openImageLightbox: (e, t, n) => {
|
|
426
|
+
var l;
|
|
427
|
+
return (l = r.current) == null ? void 0 : l.openImageLightbox(e, t, n);
|
|
428
|
+
},
|
|
429
|
+
getCellEditString: () => {
|
|
430
|
+
var e;
|
|
431
|
+
return ((e = r.current) == null ? void 0 : e.getCellEditString()) ?? "";
|
|
432
|
+
},
|
|
433
|
+
canEditActiveCell: () => {
|
|
434
|
+
var e;
|
|
435
|
+
return ((e = r.current) == null ? void 0 : e.canEditActiveCell()) ?? !1;
|
|
436
|
+
},
|
|
437
|
+
commitActiveCellValue: (e, t) => {
|
|
438
|
+
var n;
|
|
439
|
+
return ((n = r.current) == null ? void 0 : n.commitActiveCellValue(e, t)) ?? !1;
|
|
440
|
+
},
|
|
441
|
+
setCellImageFit: (e) => {
|
|
442
|
+
var t;
|
|
443
|
+
return (t = r.current) == null ? void 0 : t.setCellImageFit(e);
|
|
444
|
+
},
|
|
445
|
+
convertImageToCell: (e, t, n) => {
|
|
446
|
+
var l;
|
|
447
|
+
return ((l = r.current) == null ? void 0 : l.convertImageToCell(e, t, n)) ?? !1;
|
|
448
|
+
},
|
|
449
|
+
convertImageToCellAuto: (e) => {
|
|
450
|
+
var t;
|
|
451
|
+
return ((t = r.current) == null ? void 0 : t.convertImageToCellAuto(e)) ?? !1;
|
|
452
|
+
},
|
|
453
|
+
convertAllImagesToCells: (e) => {
|
|
454
|
+
var t;
|
|
455
|
+
return ((t = r.current) == null ? void 0 : t.convertAllImagesToCells(e)) ?? 0;
|
|
456
|
+
},
|
|
457
|
+
convertImagesInRangeToCell: (e) => x({}, async (t) => {
|
|
458
|
+
var n, l;
|
|
459
|
+
return (n = t.onProgress) == null || n.call(t, { stage: "convert", label: "选区浮动图批量嵌入…" }), ((l = r.current) == null ? void 0 : l.convertImagesInRangeToCell(e)) ?? 0;
|
|
460
|
+
}),
|
|
461
|
+
convertCellImagesInRangeToFloat: (e, t) => x({}, async (n) => {
|
|
462
|
+
var l, i;
|
|
463
|
+
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((i = r.current) == null ? void 0 : i.convertCellImagesInRangeToFloat(e, t)) ?? 0;
|
|
464
|
+
}),
|
|
465
|
+
openContextMenu: (e, t, n) => {
|
|
466
|
+
var l;
|
|
467
|
+
return (l = r.current) == null ? void 0 : l.openContextMenu(e, t, n);
|
|
468
|
+
},
|
|
469
|
+
closeContextMenu: () => {
|
|
470
|
+
var e;
|
|
471
|
+
return (e = r.current) == null ? void 0 : e.closeContextMenu();
|
|
472
|
+
},
|
|
473
|
+
convertCellImageToFloat: (e, t, n) => {
|
|
474
|
+
var l;
|
|
475
|
+
return ((l = r.current) == null ? void 0 : l.convertCellImageToFloat(e, t, n)) ?? !1;
|
|
476
|
+
},
|
|
253
477
|
insertRows: (e, t) => {
|
|
254
478
|
var n;
|
|
255
479
|
return ((n = r.current) == null ? void 0 : n.insertRows(e, t)) ?? !1;
|
|
@@ -290,6 +514,10 @@ const ut = je(function(i, p) {
|
|
|
290
514
|
var n;
|
|
291
515
|
return ((n = r.current) == null ? void 0 : n.getCellSnapshot(e, t)) ?? null;
|
|
292
516
|
},
|
|
517
|
+
inspectCell: (e, t) => {
|
|
518
|
+
var n;
|
|
519
|
+
return ((n = r.current) == null ? void 0 : n.inspectCell(e, t)) ?? null;
|
|
520
|
+
},
|
|
293
521
|
beginEdit: (e, t) => {
|
|
294
522
|
var n;
|
|
295
523
|
return ((n = r.current) == null ? void 0 : n.beginEdit(e, t)) ?? !1;
|
|
@@ -304,16 +532,36 @@ const ut = je(function(i, p) {
|
|
|
304
532
|
},
|
|
305
533
|
setColumnWidth: (e, t) => {
|
|
306
534
|
var n;
|
|
307
|
-
return ((n = r.current) == null ? void 0 : n.setColumnWidth(e, t)) ??
|
|
535
|
+
return ((n = r.current) == null ? void 0 : n.setColumnWidth(e, t)) ?? 0;
|
|
308
536
|
},
|
|
309
537
|
setRowHeight: (e, t) => {
|
|
310
538
|
var n;
|
|
311
|
-
return ((n = r.current) == null ? void 0 : n.setRowHeight(e, t)) ??
|
|
539
|
+
return ((n = r.current) == null ? void 0 : n.setRowHeight(e, t)) ?? 0;
|
|
540
|
+
},
|
|
541
|
+
autoFitColumns: (e) => {
|
|
542
|
+
var t;
|
|
543
|
+
return ((t = r.current) == null ? void 0 : t.autoFitColumns(e)) ?? 0;
|
|
544
|
+
},
|
|
545
|
+
autoFitRows: (e) => {
|
|
546
|
+
var t;
|
|
547
|
+
return ((t = r.current) == null ? void 0 : t.autoFitRows(e)) ?? 0;
|
|
548
|
+
},
|
|
549
|
+
resetColumnWidth: (e) => {
|
|
550
|
+
var t;
|
|
551
|
+
return ((t = r.current) == null ? void 0 : t.resetColumnWidth(e)) ?? 0;
|
|
552
|
+
},
|
|
553
|
+
resetRowHeight: (e) => {
|
|
554
|
+
var t;
|
|
555
|
+
return ((t = r.current) == null ? void 0 : t.resetRowHeight(e)) ?? 0;
|
|
312
556
|
},
|
|
313
557
|
isRecalcReady: () => {
|
|
314
558
|
var e;
|
|
315
559
|
return ((e = r.current) == null ? void 0 : e.isRecalcReady()) ?? !1;
|
|
316
560
|
},
|
|
561
|
+
getVirtualExtent: () => {
|
|
562
|
+
var e;
|
|
563
|
+
return ((e = r.current) == null ? void 0 : e.getVirtualExtent()) ?? { rows: 0, cols: 0 };
|
|
564
|
+
},
|
|
317
565
|
isDirty: () => {
|
|
318
566
|
var e;
|
|
319
567
|
return ((e = r.current) == null ? void 0 : e.isDirty()) ?? !1;
|
|
@@ -322,13 +570,13 @@ const ut = je(function(i, p) {
|
|
|
322
570
|
var e;
|
|
323
571
|
return ((e = r.current) == null ? void 0 : e.resetToOriginal()) ?? !1;
|
|
324
572
|
},
|
|
325
|
-
exportImage: (e) => r.current.exportImage(
|
|
326
|
-
downloadImage: (e) => r.current.downloadImage(
|
|
327
|
-
exportPdf: (e) => r.current.exportPdf(
|
|
328
|
-
downloadPdf: (e) => r.current.downloadPdf(
|
|
329
|
-
print: (e) => r.current.print(
|
|
330
|
-
exportXlsx: (e) => r.current.exportXlsx(
|
|
331
|
-
downloadXlsx: (e) => r.current.downloadXlsx(
|
|
573
|
+
exportImage: (e) => x(e, (t) => r.current.exportImage(t)),
|
|
574
|
+
downloadImage: (e) => x(e, (t) => r.current.downloadImage(t)),
|
|
575
|
+
exportPdf: (e) => x(e, (t) => r.current.exportPdf(t)),
|
|
576
|
+
downloadPdf: (e) => x(e, (t) => r.current.downloadPdf(t)),
|
|
577
|
+
print: (e) => x(e, (t) => r.current.print(t)),
|
|
578
|
+
exportXlsx: (e) => x(e, (t) => r.current.exportXlsx(t)),
|
|
579
|
+
downloadXlsx: (e) => x(e, (t) => r.current.downloadXlsx(t)),
|
|
332
580
|
exportJson: (e) => {
|
|
333
581
|
var t;
|
|
334
582
|
return ((t = r.current) == null ? void 0 : t.exportJson(e)) ?? "{}";
|
|
@@ -346,42 +594,42 @@ const ut = je(function(i, p) {
|
|
|
346
594
|
return (t = r.current) == null ? void 0 : t.downloadCsv(e);
|
|
347
595
|
},
|
|
348
596
|
getCellValue: (e, t, n) => {
|
|
349
|
-
const l =
|
|
350
|
-
return l ?
|
|
597
|
+
const l = Y(n);
|
|
598
|
+
return l ? mt(l, e, t) : null;
|
|
351
599
|
},
|
|
352
600
|
getCellText: (e, t, n) => {
|
|
353
|
-
const l =
|
|
354
|
-
return l ?
|
|
601
|
+
const l = Y(n);
|
|
602
|
+
return l ? ft(l, e, t, ze) : "";
|
|
355
603
|
},
|
|
356
604
|
getSheetData: (e, t) => {
|
|
357
|
-
const n =
|
|
358
|
-
return n ?
|
|
605
|
+
const n = Y(t);
|
|
606
|
+
return n ? gt(n, Ie(e)) : [];
|
|
359
607
|
},
|
|
360
608
|
getSheetJSON: (e, t) => {
|
|
361
|
-
const n =
|
|
362
|
-
return n ?
|
|
609
|
+
const n = Y(t);
|
|
610
|
+
return n ? dt(n, Ie(e)) : [];
|
|
363
611
|
},
|
|
364
612
|
getRangeData: (e, t, n) => {
|
|
365
|
-
const l =
|
|
366
|
-
return l ?
|
|
613
|
+
const l = Y(n);
|
|
614
|
+
return l ? ut(l, e, Ie(t)) : [];
|
|
367
615
|
}
|
|
368
616
|
}),
|
|
369
617
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
370
|
-
[c,
|
|
618
|
+
[c, y]
|
|
371
619
|
);
|
|
372
|
-
const
|
|
620
|
+
const ee = (e) => {
|
|
373
621
|
var t;
|
|
374
|
-
return ((t =
|
|
375
|
-
},
|
|
622
|
+
return ((t = Z.current) == null ? void 0 : t.sheets[e ?? Se.current]) ?? null;
|
|
623
|
+
}, ce = () => {
|
|
376
624
|
var e;
|
|
377
|
-
return ((e =
|
|
378
|
-
},
|
|
379
|
-
load: (e) =>
|
|
380
|
-
getWorkbook: () =>
|
|
381
|
-
getActiveSheet: () =>
|
|
625
|
+
return ((e = Z.current) == null ? void 0 : e.date1904) ?? !1;
|
|
626
|
+
}, oe = C({
|
|
627
|
+
load: (e) => k(e, q),
|
|
628
|
+
getWorkbook: () => Z.current,
|
|
629
|
+
getActiveSheet: () => Se.current,
|
|
382
630
|
setActiveSheet: (e) => {
|
|
383
631
|
var t;
|
|
384
|
-
(t =
|
|
632
|
+
(t = Z.current) != null && t.sheets[e] && K(e);
|
|
385
633
|
},
|
|
386
634
|
getSelection: () => {
|
|
387
635
|
var e;
|
|
@@ -407,6 +655,14 @@ const ut = je(function(i, p) {
|
|
|
407
655
|
var n;
|
|
408
656
|
return ((n = r.current) == null ? void 0 : n.isCellEditable(e, t)) ?? !1;
|
|
409
657
|
},
|
|
658
|
+
setEditableTargets: (e) => {
|
|
659
|
+
var t;
|
|
660
|
+
return (t = r.current) == null ? void 0 : t.setEditableTargets(e);
|
|
661
|
+
},
|
|
662
|
+
getEditableTargets: () => {
|
|
663
|
+
var e;
|
|
664
|
+
return (e = r.current) == null ? void 0 : e.getEditableTargets();
|
|
665
|
+
},
|
|
410
666
|
editCell: (e, t, n) => {
|
|
411
667
|
var l;
|
|
412
668
|
return ((l = r.current) == null ? void 0 : l.editCell(e, t, n)) ?? !1;
|
|
@@ -423,6 +679,50 @@ const ut = je(function(i, p) {
|
|
|
423
679
|
var n;
|
|
424
680
|
return ((n = r.current) == null ? void 0 : n.setStyle(e, t)) ?? !1;
|
|
425
681
|
},
|
|
682
|
+
getActiveFillColor: () => {
|
|
683
|
+
var e;
|
|
684
|
+
return ((e = r.current) == null ? void 0 : e.getActiveFillColor()) ?? "#FFFFFF";
|
|
685
|
+
},
|
|
686
|
+
getActiveFontColor: () => {
|
|
687
|
+
var e;
|
|
688
|
+
return ((e = r.current) == null ? void 0 : e.getActiveFontColor()) ?? "#000000";
|
|
689
|
+
},
|
|
690
|
+
setSelectionFill: (e) => {
|
|
691
|
+
var t;
|
|
692
|
+
return ((t = r.current) == null ? void 0 : t.setSelectionFill(e)) ?? !1;
|
|
693
|
+
},
|
|
694
|
+
setSelectionFontColor: (e) => {
|
|
695
|
+
var t;
|
|
696
|
+
return ((t = r.current) == null ? void 0 : t.setSelectionFontColor(e)) ?? !1;
|
|
697
|
+
},
|
|
698
|
+
getSelectionWrapState: () => {
|
|
699
|
+
var e;
|
|
700
|
+
return ((e = r.current) == null ? void 0 : e.getSelectionWrapState()) ?? "none";
|
|
701
|
+
},
|
|
702
|
+
toggleWrapTextOnSelection: () => {
|
|
703
|
+
var e;
|
|
704
|
+
return ((e = r.current) == null ? void 0 : e.toggleWrapTextOnSelection()) ?? !1;
|
|
705
|
+
},
|
|
706
|
+
mergeCells: (e) => {
|
|
707
|
+
var t;
|
|
708
|
+
return ((t = r.current) == null ? void 0 : t.mergeCells(e)) ?? !1;
|
|
709
|
+
},
|
|
710
|
+
unmergeCells: (e) => {
|
|
711
|
+
var t;
|
|
712
|
+
return ((t = r.current) == null ? void 0 : t.unmergeCells(e)) ?? !1;
|
|
713
|
+
},
|
|
714
|
+
pasteText: (e, t) => {
|
|
715
|
+
var n;
|
|
716
|
+
return ((n = r.current) == null ? void 0 : n.pasteText(e, t)) ?? !1;
|
|
717
|
+
},
|
|
718
|
+
pasteRichHtml: (e, t) => {
|
|
719
|
+
var n;
|
|
720
|
+
return ((n = r.current) == null ? void 0 : n.pasteRichHtml(e, t)) ?? !1;
|
|
721
|
+
},
|
|
722
|
+
pasteImageBlob: (e, t) => {
|
|
723
|
+
var n;
|
|
724
|
+
return ((n = r.current) == null ? void 0 : n.pasteImageBlob(e, t)) ?? Promise.resolve(!1);
|
|
725
|
+
},
|
|
426
726
|
getImages: () => {
|
|
427
727
|
var e;
|
|
428
728
|
return ((e = r.current) == null ? void 0 : e.getImages()) ?? [];
|
|
@@ -443,6 +743,66 @@ const ut = je(function(i, p) {
|
|
|
443
743
|
var l;
|
|
444
744
|
return ((l = r.current) == null ? void 0 : l.resizeImage(e, t, n)) ?? !1;
|
|
445
745
|
},
|
|
746
|
+
getCellImages: () => {
|
|
747
|
+
var e;
|
|
748
|
+
return ((e = r.current) == null ? void 0 : e.getCellImages()) ?? [];
|
|
749
|
+
},
|
|
750
|
+
getCellImageAt: (e, t) => {
|
|
751
|
+
var n;
|
|
752
|
+
return ((n = r.current) == null ? void 0 : n.getCellImageAt(e, t)) ?? null;
|
|
753
|
+
},
|
|
754
|
+
openImageLightbox: (e, t, n) => {
|
|
755
|
+
var l;
|
|
756
|
+
return (l = r.current) == null ? void 0 : l.openImageLightbox(e, t, n);
|
|
757
|
+
},
|
|
758
|
+
getCellEditString: () => {
|
|
759
|
+
var e;
|
|
760
|
+
return ((e = r.current) == null ? void 0 : e.getCellEditString()) ?? "";
|
|
761
|
+
},
|
|
762
|
+
canEditActiveCell: () => {
|
|
763
|
+
var e;
|
|
764
|
+
return ((e = r.current) == null ? void 0 : e.canEditActiveCell()) ?? !1;
|
|
765
|
+
},
|
|
766
|
+
commitActiveCellValue: (e, t) => {
|
|
767
|
+
var n;
|
|
768
|
+
return ((n = r.current) == null ? void 0 : n.commitActiveCellValue(e, t)) ?? !1;
|
|
769
|
+
},
|
|
770
|
+
setCellImageFit: (e) => {
|
|
771
|
+
var t;
|
|
772
|
+
return (t = r.current) == null ? void 0 : t.setCellImageFit(e);
|
|
773
|
+
},
|
|
774
|
+
convertImageToCell: (e, t, n) => {
|
|
775
|
+
var l;
|
|
776
|
+
return ((l = r.current) == null ? void 0 : l.convertImageToCell(e, t, n)) ?? !1;
|
|
777
|
+
},
|
|
778
|
+
convertImageToCellAuto: (e) => {
|
|
779
|
+
var t;
|
|
780
|
+
return ((t = r.current) == null ? void 0 : t.convertImageToCellAuto(e)) ?? !1;
|
|
781
|
+
},
|
|
782
|
+
convertAllImagesToCells: (e) => {
|
|
783
|
+
var t;
|
|
784
|
+
return ((t = r.current) == null ? void 0 : t.convertAllImagesToCells(e)) ?? 0;
|
|
785
|
+
},
|
|
786
|
+
convertImagesInRangeToCell: (e) => x({}, async (t) => {
|
|
787
|
+
var n, l;
|
|
788
|
+
return (n = t.onProgress) == null || n.call(t, { stage: "convert", label: "选区浮动图批量嵌入…" }), ((l = r.current) == null ? void 0 : l.convertImagesInRangeToCell(e)) ?? 0;
|
|
789
|
+
}),
|
|
790
|
+
convertCellImagesInRangeToFloat: (e, t) => x({}, async (n) => {
|
|
791
|
+
var l, i;
|
|
792
|
+
return (l = n.onProgress) == null || l.call(n, { stage: "convert", label: "选区内嵌图批量浮动化…" }), ((i = r.current) == null ? void 0 : i.convertCellImagesInRangeToFloat(e, t)) ?? 0;
|
|
793
|
+
}),
|
|
794
|
+
openContextMenu: (e, t, n) => {
|
|
795
|
+
var l;
|
|
796
|
+
return (l = r.current) == null ? void 0 : l.openContextMenu(e, t, n);
|
|
797
|
+
},
|
|
798
|
+
closeContextMenu: () => {
|
|
799
|
+
var e;
|
|
800
|
+
return (e = r.current) == null ? void 0 : e.closeContextMenu();
|
|
801
|
+
},
|
|
802
|
+
convertCellImageToFloat: (e, t, n) => {
|
|
803
|
+
var l;
|
|
804
|
+
return ((l = r.current) == null ? void 0 : l.convertCellImageToFloat(e, t, n)) ?? !1;
|
|
805
|
+
},
|
|
446
806
|
insertRows: (e, t) => {
|
|
447
807
|
var n;
|
|
448
808
|
return ((n = r.current) == null ? void 0 : n.insertRows(e, t)) ?? !1;
|
|
@@ -483,6 +843,10 @@ const ut = je(function(i, p) {
|
|
|
483
843
|
var n;
|
|
484
844
|
return ((n = r.current) == null ? void 0 : n.getCellSnapshot(e, t)) ?? null;
|
|
485
845
|
},
|
|
846
|
+
inspectCell: (e, t) => {
|
|
847
|
+
var n;
|
|
848
|
+
return ((n = r.current) == null ? void 0 : n.inspectCell(e, t)) ?? null;
|
|
849
|
+
},
|
|
486
850
|
beginEdit: (e, t) => {
|
|
487
851
|
var n;
|
|
488
852
|
return ((n = r.current) == null ? void 0 : n.beginEdit(e, t)) ?? !1;
|
|
@@ -497,16 +861,36 @@ const ut = je(function(i, p) {
|
|
|
497
861
|
},
|
|
498
862
|
setColumnWidth: (e, t) => {
|
|
499
863
|
var n;
|
|
500
|
-
return ((n = r.current) == null ? void 0 : n.setColumnWidth(e, t)) ??
|
|
864
|
+
return ((n = r.current) == null ? void 0 : n.setColumnWidth(e, t)) ?? 0;
|
|
501
865
|
},
|
|
502
866
|
setRowHeight: (e, t) => {
|
|
503
867
|
var n;
|
|
504
|
-
return ((n = r.current) == null ? void 0 : n.setRowHeight(e, t)) ??
|
|
868
|
+
return ((n = r.current) == null ? void 0 : n.setRowHeight(e, t)) ?? 0;
|
|
869
|
+
},
|
|
870
|
+
autoFitColumns: (e) => {
|
|
871
|
+
var t;
|
|
872
|
+
return ((t = r.current) == null ? void 0 : t.autoFitColumns(e)) ?? 0;
|
|
873
|
+
},
|
|
874
|
+
autoFitRows: (e) => {
|
|
875
|
+
var t;
|
|
876
|
+
return ((t = r.current) == null ? void 0 : t.autoFitRows(e)) ?? 0;
|
|
877
|
+
},
|
|
878
|
+
resetColumnWidth: (e) => {
|
|
879
|
+
var t;
|
|
880
|
+
return ((t = r.current) == null ? void 0 : t.resetColumnWidth(e)) ?? 0;
|
|
881
|
+
},
|
|
882
|
+
resetRowHeight: (e) => {
|
|
883
|
+
var t;
|
|
884
|
+
return ((t = r.current) == null ? void 0 : t.resetRowHeight(e)) ?? 0;
|
|
505
885
|
},
|
|
506
886
|
isRecalcReady: () => {
|
|
507
887
|
var e;
|
|
508
888
|
return ((e = r.current) == null ? void 0 : e.isRecalcReady()) ?? !1;
|
|
509
889
|
},
|
|
890
|
+
getVirtualExtent: () => {
|
|
891
|
+
var e;
|
|
892
|
+
return ((e = r.current) == null ? void 0 : e.getVirtualExtent()) ?? { rows: 0, cols: 0 };
|
|
893
|
+
},
|
|
510
894
|
isDirty: () => {
|
|
511
895
|
var e;
|
|
512
896
|
return ((e = r.current) == null ? void 0 : e.isDirty()) ?? !1;
|
|
@@ -515,13 +899,13 @@ const ut = je(function(i, p) {
|
|
|
515
899
|
var e;
|
|
516
900
|
return ((e = r.current) == null ? void 0 : e.resetToOriginal()) ?? !1;
|
|
517
901
|
},
|
|
518
|
-
exportImage: (e) => r.current.exportImage(
|
|
519
|
-
downloadImage: (e) => r.current.downloadImage(
|
|
520
|
-
exportPdf: (e) => r.current.exportPdf(
|
|
521
|
-
downloadPdf: (e) => r.current.downloadPdf(
|
|
522
|
-
print: (e) => r.current.print(
|
|
523
|
-
exportXlsx: (e) => r.current.exportXlsx(
|
|
524
|
-
downloadXlsx: (e) => r.current.downloadXlsx(
|
|
902
|
+
exportImage: (e) => x(e, (t) => r.current.exportImage(t)),
|
|
903
|
+
downloadImage: (e) => x(e, (t) => r.current.downloadImage(t)),
|
|
904
|
+
exportPdf: (e) => x(e, (t) => r.current.exportPdf(t)),
|
|
905
|
+
downloadPdf: (e) => x(e, (t) => r.current.downloadPdf(t)),
|
|
906
|
+
print: (e) => x(e, (t) => r.current.print(t)),
|
|
907
|
+
exportXlsx: (e) => x(e, (t) => r.current.exportXlsx(t)),
|
|
908
|
+
downloadXlsx: (e) => x(e, (t) => r.current.downloadXlsx(t)),
|
|
525
909
|
exportJson: (e) => {
|
|
526
910
|
var t;
|
|
527
911
|
return ((t = r.current) == null ? void 0 : t.exportJson(e)) ?? "{}";
|
|
@@ -539,70 +923,90 @@ const ut = je(function(i, p) {
|
|
|
539
923
|
return (t = r.current) == null ? void 0 : t.downloadCsv(e);
|
|
540
924
|
},
|
|
541
925
|
getCellValue: (e, t, n) => {
|
|
542
|
-
const l =
|
|
543
|
-
return l ?
|
|
926
|
+
const l = ee(n);
|
|
927
|
+
return l ? mt(l, e, t) : null;
|
|
544
928
|
},
|
|
545
929
|
getCellText: (e, t, n) => {
|
|
546
|
-
const l =
|
|
547
|
-
return l ?
|
|
930
|
+
const l = ee(n);
|
|
931
|
+
return l ? ft(l, e, t, ce()) : "";
|
|
548
932
|
},
|
|
549
933
|
getSheetData: (e, t) => {
|
|
550
|
-
const n =
|
|
551
|
-
return n ?
|
|
934
|
+
const n = ee(t);
|
|
935
|
+
return n ? gt(n, { ...e, date1904: ce() }) : [];
|
|
552
936
|
},
|
|
553
937
|
getSheetJSON: (e, t) => {
|
|
554
|
-
const n =
|
|
555
|
-
return n ?
|
|
938
|
+
const n = ee(t);
|
|
939
|
+
return n ? dt(n, { ...e, date1904: ce() }) : [];
|
|
556
940
|
},
|
|
557
941
|
getRangeData: (e, t, n) => {
|
|
558
|
-
const l =
|
|
559
|
-
return l ?
|
|
942
|
+
const l = ee(n);
|
|
943
|
+
return l ? ut(l, e, { ...t, date1904: ce() }) : [];
|
|
560
944
|
}
|
|
561
945
|
}).current;
|
|
562
|
-
|
|
946
|
+
p(() => {
|
|
563
947
|
var l;
|
|
564
|
-
const e = /* @__PURE__ */ new Map(), t = [], n = (
|
|
565
|
-
let
|
|
566
|
-
|
|
948
|
+
const e = /* @__PURE__ */ new Map(), t = [], n = (i, h) => {
|
|
949
|
+
let o = e.get(i);
|
|
950
|
+
o || e.set(i, o = /* @__PURE__ */ new Set()), o.add(h);
|
|
567
951
|
};
|
|
568
|
-
for (const
|
|
569
|
-
if (
|
|
570
|
-
for (const [
|
|
571
|
-
const
|
|
572
|
-
var
|
|
573
|
-
return (
|
|
952
|
+
for (const i of le) {
|
|
953
|
+
if (i.events)
|
|
954
|
+
for (const [o, d] of Object.entries(i.events)) d && n(o, d);
|
|
955
|
+
const h = (l = i.setup) == null ? void 0 : l.call(i, { viewer: oe, on: n, redraw: () => {
|
|
956
|
+
var o;
|
|
957
|
+
return (o = r.current) == null ? void 0 : o.render();
|
|
574
958
|
} });
|
|
575
|
-
typeof
|
|
959
|
+
typeof h == "function" && t.push(h);
|
|
576
960
|
}
|
|
577
|
-
return
|
|
578
|
-
t.forEach((
|
|
961
|
+
return be.current = e, Ee(), () => {
|
|
962
|
+
t.forEach((i) => i()), be.current = /* @__PURE__ */ new Map();
|
|
579
963
|
};
|
|
580
|
-
}, [
|
|
581
|
-
const
|
|
582
|
-
(e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(),
|
|
583
|
-
},
|
|
964
|
+
}, [a.plugins]);
|
|
965
|
+
const It = (e) => {
|
|
966
|
+
(e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F") && (e.preventDefault(), de(!0));
|
|
967
|
+
}, ye = () => {
|
|
584
968
|
var e, t;
|
|
585
|
-
|
|
586
|
-
},
|
|
969
|
+
de(!1), (e = r.current) == null || e.clearFind(), (t = j.current) == null || t.focus();
|
|
970
|
+
}, yt = () => {
|
|
971
|
+
var t;
|
|
972
|
+
const e = j.current;
|
|
973
|
+
e && (he.current = null, (t = r.current) == null || t.setScroll(e.scrollLeft, e.scrollTop));
|
|
974
|
+
}, f = r.current, te = (f == null ? void 0 : f.renderer) ?? null, B = (f == null ? void 0 : f.getActiveCell()) ?? null, F = (f == null ? void 0 : f.getSelection()) ?? null, Ke = B ? Ne(B.col) + (B.row + 1) : "", $e = te && B ? te.cellFormula(B.row, B.col) ?? te.cellText(B.row, B.col) : "", Ft = !!(f != null && f.canEditActiveCell()), pt = (f == null ? void 0 : f.getCellEditString()) ?? "", Fe = Q.current ? Rt : pt, Nt = () => {
|
|
975
|
+
Q.current = !0, ke((f == null ? void 0 : f.getCellEditString()) ?? "");
|
|
976
|
+
}, Xe = (e) => {
|
|
587
977
|
var t;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
978
|
+
f == null || f.commitActiveCellValue(Fe, e), Q.current = !1, e === "down" && ((t = j.current) == null || t.focus()), L();
|
|
979
|
+
}, Tt = () => {
|
|
980
|
+
var e;
|
|
981
|
+
Q.current = !1, (e = j.current) == null || e.focus(), L();
|
|
982
|
+
}, kt = () => {
|
|
983
|
+
Q.current && Xe();
|
|
984
|
+
}, At = (e) => {
|
|
985
|
+
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), Xe("down")) : e.key === "Escape" && (e.preventDefault(), Tt());
|
|
986
|
+
}, Mt = F && !(F.top === F.bottom && F.left === F.right) ? `${Ne(F.left)}${F.top + 1}:${Ne(F.right)}${F.bottom + 1}` : "", P = te && F ? te.selectionStats(F) : null, ae = (f == null ? void 0 : f.getFindState()) ?? { query: "", count: 0, index: -1 }, H = (f == null ? void 0 : f.getFilterPopup()) ?? null, ne = he.current, pe = (c == null ? void 0 : c.sheets[y]) ?? null, je = c ? c.sheets.map((e, t) => ({ s: e, i: t })).filter(({ s: e }) => e.state === "visible") : [];
|
|
987
|
+
return /* @__PURE__ */ m("div", { className: "rxl" + (a.className ? " " + a.className : ""), style: a.style, onKeyDown: It, children: [
|
|
988
|
+
c && (ie || X) && /* @__PURE__ */ m("div", { className: "rxl-title", title: ie + (X ? " · 模板: " + X : ""), children: [
|
|
989
|
+
/* @__PURE__ */ s("span", { className: "name", children: ie || "未命名工作簿" }),
|
|
990
|
+
X && /* @__PURE__ */ m("span", { className: "tpl", children: [
|
|
991
|
+
" · 模板: ",
|
|
992
|
+
X
|
|
993
|
+
] })
|
|
994
|
+
] }),
|
|
995
|
+
/* @__PURE__ */ s("input", { ref: Te, type: "file", accept: ".xlsx,.xlsm", hidden: !0, onChange: wt }),
|
|
592
996
|
c && /* @__PURE__ */ m("div", { className: "rxl-toolbar", children: [
|
|
593
|
-
/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ s(
|
|
594
998
|
"button",
|
|
595
999
|
{
|
|
596
|
-
className:
|
|
597
|
-
onClick: () =>
|
|
1000
|
+
className: ue ? "active" : "",
|
|
1001
|
+
onClick: () => ue ? ye() : de(!0),
|
|
598
1002
|
title: "查找 (Ctrl+F)",
|
|
599
1003
|
children: "查找"
|
|
600
1004
|
}
|
|
601
1005
|
),
|
|
602
|
-
/* @__PURE__ */
|
|
1006
|
+
/* @__PURE__ */ s(
|
|
603
1007
|
"button",
|
|
604
1008
|
{
|
|
605
|
-
className:
|
|
1009
|
+
className: pe != null && pe.autoFilterRange ? "active" : "",
|
|
606
1010
|
onClick: () => {
|
|
607
1011
|
var e;
|
|
608
1012
|
return (e = r.current) == null ? void 0 : e.toggleAutoFilter();
|
|
@@ -611,40 +1015,56 @@ const ut = je(function(i, p) {
|
|
|
611
1015
|
children: "筛选"
|
|
612
1016
|
}
|
|
613
1017
|
),
|
|
614
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ s("button", { disabled: !(f != null && f.hasFilters()), onClick: () => {
|
|
615
1019
|
var e;
|
|
616
1020
|
return (e = r.current) == null ? void 0 : e.clearAllFilters();
|
|
617
1021
|
}, children: "清除筛选" }),
|
|
618
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ s("button", { disabled: !F, onClick: () => {
|
|
619
1023
|
var e;
|
|
620
1024
|
return void ((e = r.current) == null ? void 0 : e.copySelection());
|
|
621
1025
|
}, title: "复制 (Ctrl+C)", children: "复制" }),
|
|
622
|
-
/* @__PURE__ */
|
|
1026
|
+
/* @__PURE__ */ s("button", { onClick: () => {
|
|
623
1027
|
var e;
|
|
624
|
-
return void ((e = r.current) == null ? void 0 : e.downloadImage());
|
|
1028
|
+
return void ((e = r.current) == null ? void 0 : e.downloadImage().catch(We));
|
|
625
1029
|
}, children: "导出 PNG" }),
|
|
626
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ s("button", { onClick: () => {
|
|
627
1031
|
var e;
|
|
628
|
-
return void ((e = r.current) == null ? void 0 : e.downloadPdf().catch(
|
|
629
|
-
var n, l;
|
|
630
|
-
return (l = (n = u.current).onError) == null ? void 0 : l.call(n, String((t == null ? void 0 : t.message) ?? t));
|
|
631
|
-
}));
|
|
1032
|
+
return void ((e = r.current) == null ? void 0 : e.downloadPdf().catch(We));
|
|
632
1033
|
}, children: "导出 PDF" }),
|
|
633
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ s("select", { value: Math.round(A * 100), onChange: (e) => J(Number(e.target.value) / 100), title: "缩放", children: [50, 75, 100, 125, 150, 200].map((e) => /* @__PURE__ */ m("option", { value: e, children: [
|
|
634
1035
|
e,
|
|
635
1036
|
"%"
|
|
636
1037
|
] }, e)) }),
|
|
637
|
-
|
|
1038
|
+
(() => {
|
|
1039
|
+
const e = !!a.src && !a.workbook;
|
|
1040
|
+
return /* @__PURE__ */ m(ot, { children: [
|
|
1041
|
+
/* @__PURE__ */ m(
|
|
1042
|
+
"button",
|
|
1043
|
+
{
|
|
1044
|
+
className: W ? "active" : "",
|
|
1045
|
+
disabled: e,
|
|
1046
|
+
onClick: St,
|
|
1047
|
+
title: e ? "模板仅对 JSON / 模型数据源生效;当前是 xlsx 数据源,模板不可用" : W ? `模板已加载: ${X || "(未命名)"} — 点击重新导入` : "为 JSON / 模型数据源套用 .xlsx 模板的样式(模板的文字内容会被丢弃)",
|
|
1048
|
+
children: [
|
|
1049
|
+
"模板",
|
|
1050
|
+
W ? " ▾" : ""
|
|
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) => {
|
|
638
1058
|
var t, n;
|
|
639
|
-
return /* @__PURE__ */
|
|
1059
|
+
return /* @__PURE__ */ s(
|
|
640
1060
|
"button",
|
|
641
1061
|
{
|
|
642
|
-
className: (t = e.active) != null && t.call(e,
|
|
643
|
-
disabled: (n = e.disabled) == null ? void 0 : n.call(e,
|
|
1062
|
+
className: (t = e.active) != null && t.call(e, oe) ? "active" : "",
|
|
1063
|
+
disabled: (n = e.disabled) == null ? void 0 : n.call(e, oe),
|
|
644
1064
|
title: e.title,
|
|
645
1065
|
onClick: () => {
|
|
646
1066
|
var l;
|
|
647
|
-
return (l = e.onClick) == null ? void 0 : l.call(e,
|
|
1067
|
+
return (l = e.onClick) == null ? void 0 : l.call(e, oe);
|
|
648
1068
|
},
|
|
649
1069
|
children: e.label ?? e.icon ?? e.id
|
|
650
1070
|
},
|
|
@@ -653,23 +1073,35 @@ const ut = je(function(i, p) {
|
|
|
653
1073
|
})
|
|
654
1074
|
] }),
|
|
655
1075
|
c && /* @__PURE__ */ m("div", { className: "rxl-formula-bar", children: [
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ s("span", { className: "addr", children: Ke || "—" }),
|
|
1077
|
+
/* @__PURE__ */ s("span", { className: "fx", children: "fx" }),
|
|
1078
|
+
Ft ? /* @__PURE__ */ s(
|
|
1079
|
+
"input",
|
|
1080
|
+
{
|
|
1081
|
+
className: "content content-input",
|
|
1082
|
+
value: Fe,
|
|
1083
|
+
title: Fe,
|
|
1084
|
+
spellCheck: !1,
|
|
1085
|
+
onFocus: Nt,
|
|
1086
|
+
onChange: (e) => ke(e.target.value),
|
|
1087
|
+
onKeyDown: At,
|
|
1088
|
+
onBlur: kt
|
|
1089
|
+
}
|
|
1090
|
+
) : /* @__PURE__ */ s("span", { className: "content", title: $e, children: $e })
|
|
659
1091
|
] }),
|
|
660
|
-
/* @__PURE__ */ m("div", { className: "rxl-render-area", ref:
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
1092
|
+
/* @__PURE__ */ m("div", { className: "rxl-render-area", ref: Ae, children: [
|
|
1093
|
+
/* @__PURE__ */ s("canvas", { ref: Me, className: "rxl-canvas" }),
|
|
1094
|
+
/* @__PURE__ */ s("div", { className: "rxl-ov", ref: ge }),
|
|
1095
|
+
/* @__PURE__ */ s("div", { className: "rxl-ov", ref: me }),
|
|
1096
|
+
/* @__PURE__ */ s("div", { className: "rxl-ov", ref: fe }),
|
|
1097
|
+
/* @__PURE__ */ s("div", { className: "rxl-ov", ref: Ce }),
|
|
1098
|
+
/* @__PURE__ */ s(
|
|
667
1099
|
"div",
|
|
668
1100
|
{
|
|
669
1101
|
className: "rxl-scroller",
|
|
670
|
-
ref:
|
|
1102
|
+
ref: j,
|
|
671
1103
|
tabIndex: 0,
|
|
672
|
-
onScroll:
|
|
1104
|
+
onScroll: yt,
|
|
673
1105
|
onMouseDown: (e) => {
|
|
674
1106
|
var t;
|
|
675
1107
|
return (t = r.current) == null ? void 0 : t.onMouseDown(e.nativeEvent);
|
|
@@ -694,47 +1126,51 @@ const ut = je(function(i, p) {
|
|
|
694
1126
|
var t;
|
|
695
1127
|
return (t = r.current) == null ? void 0 : t.onKeyDown(e.nativeEvent);
|
|
696
1128
|
},
|
|
697
|
-
|
|
1129
|
+
onContextMenu: (e) => {
|
|
1130
|
+
var t;
|
|
1131
|
+
return (t = r.current) == null ? void 0 : t.onContextMenu(e.nativeEvent);
|
|
1132
|
+
},
|
|
1133
|
+
children: /* @__PURE__ */ s("div", { className: "rxl-spacer", ref: Pe })
|
|
698
1134
|
}
|
|
699
1135
|
),
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
|
|
703
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ s("div", { className: "rxl-ov-slot", children: /* @__PURE__ */ s("div", { ref: ve }) }),
|
|
1137
|
+
/* @__PURE__ */ s("div", { className: "rxl-editor-slot", ref: xe }),
|
|
1138
|
+
ue && c && /* @__PURE__ */ m("div", { className: "rxl-findbar", children: [
|
|
1139
|
+
/* @__PURE__ */ s(
|
|
704
1140
|
"input",
|
|
705
1141
|
{
|
|
706
1142
|
autoFocus: !0,
|
|
707
1143
|
placeholder: "查找…",
|
|
708
|
-
value:
|
|
1144
|
+
value: ae.query,
|
|
709
1145
|
onChange: (e) => {
|
|
710
1146
|
var t;
|
|
711
1147
|
return (t = r.current) == null ? void 0 : t.setFindQuery(e.target.value);
|
|
712
1148
|
},
|
|
713
1149
|
onKeyDown: (e) => {
|
|
714
1150
|
var t, n;
|
|
715
|
-
e.key === "Enter" ? e.shiftKey ? (t = r.current) == null || t.findPrev() : (n = r.current) == null || n.findNext() : e.key === "Escape" &&
|
|
1151
|
+
e.key === "Enter" ? e.shiftKey ? (t = r.current) == null || t.findPrev() : (n = r.current) == null || n.findNext() : e.key === "Escape" && ye();
|
|
716
1152
|
}
|
|
717
1153
|
}
|
|
718
1154
|
),
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ s("span", { className: "count", children: ae.count ? `${ae.index + 1}/${ae.count}` : "无结果" }),
|
|
1156
|
+
/* @__PURE__ */ s("button", { onClick: () => {
|
|
721
1157
|
var e;
|
|
722
1158
|
return (e = r.current) == null ? void 0 : e.findPrev();
|
|
723
1159
|
}, children: "↑" }),
|
|
724
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ s("button", { onClick: () => {
|
|
725
1161
|
var e;
|
|
726
1162
|
return (e = r.current) == null ? void 0 : e.findNext();
|
|
727
1163
|
}, children: "↓" }),
|
|
728
|
-
/* @__PURE__ */
|
|
1164
|
+
/* @__PURE__ */ s("button", { onClick: ye, children: "✕" })
|
|
729
1165
|
] }),
|
|
730
|
-
|
|
731
|
-
|
|
1166
|
+
H && /* @__PURE__ */ s(
|
|
1167
|
+
Xt,
|
|
732
1168
|
{
|
|
733
|
-
values:
|
|
734
|
-
selected:
|
|
735
|
-
x:
|
|
736
|
-
y:
|
|
737
|
-
sortDir:
|
|
1169
|
+
values: H.values,
|
|
1170
|
+
selected: H.selected,
|
|
1171
|
+
x: H.x,
|
|
1172
|
+
y: H.y,
|
|
1173
|
+
sortDir: H.sortDir,
|
|
738
1174
|
onApply: (e) => {
|
|
739
1175
|
var t;
|
|
740
1176
|
return (t = r.current) == null ? void 0 : t.applyFilterSelection(e);
|
|
@@ -749,90 +1185,91 @@ const ut = je(function(i, p) {
|
|
|
749
1185
|
},
|
|
750
1186
|
onSort: (e) => {
|
|
751
1187
|
var n, l;
|
|
752
|
-
const t =
|
|
1188
|
+
const t = H.col;
|
|
753
1189
|
(n = r.current) == null || n.closeFilterPopup(), (l = r.current) == null || l.sortColumn(t, e);
|
|
754
1190
|
}
|
|
755
1191
|
},
|
|
756
|
-
|
|
1192
|
+
H.col
|
|
757
1193
|
),
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
!
|
|
1194
|
+
ne && /* @__PURE__ */ s("div", { className: "rxl-tooltip " + ne.kind, style: { left: ne.x, top: ne.y }, children: ne.text }),
|
|
1195
|
+
S && /* @__PURE__ */ s("div", { className: "rxl-state", children: (E == null ? void 0 : E.stage) === "read" ? "读取文件…" : (E == null ? void 0 : E.stage) === "parse" ? "解析中…" : "构建表格…" }),
|
|
1196
|
+
!S && N && /* @__PURE__ */ m("div", { className: "rxl-state error", children: [
|
|
761
1197
|
"解析失败:",
|
|
762
|
-
|
|
1198
|
+
N
|
|
763
1199
|
] }),
|
|
764
|
-
!
|
|
1200
|
+
!S && !c && /* @__PURE__ */ s("div", { className: "rxl-state", children: "拖入或选择一个 .xlsx 文件" })
|
|
765
1201
|
] }),
|
|
766
1202
|
c && /* @__PURE__ */ m("div", { className: "rxl-status-bar", children: [
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
|
|
1203
|
+
/* @__PURE__ */ s("span", { style: { color: "#888" }, children: Mt || Ke }),
|
|
1204
|
+
/* @__PURE__ */ s("div", { className: "grow" }),
|
|
1205
|
+
P && P.numCount > 0 ? /* @__PURE__ */ m(ot, { children: [
|
|
770
1206
|
/* @__PURE__ */ m("span", { children: [
|
|
771
1207
|
"计数 ",
|
|
772
|
-
|
|
1208
|
+
P.count
|
|
773
1209
|
] }),
|
|
774
1210
|
/* @__PURE__ */ m("span", { children: [
|
|
775
1211
|
"求和 ",
|
|
776
|
-
|
|
1212
|
+
se(P.sum)
|
|
777
1213
|
] }),
|
|
778
1214
|
/* @__PURE__ */ m("span", { children: [
|
|
779
1215
|
"平均 ",
|
|
780
|
-
|
|
1216
|
+
se(P.avg)
|
|
781
1217
|
] }),
|
|
782
1218
|
/* @__PURE__ */ m("span", { children: [
|
|
783
1219
|
"最大 ",
|
|
784
|
-
|
|
1220
|
+
se(P.max)
|
|
785
1221
|
] }),
|
|
786
1222
|
/* @__PURE__ */ m("span", { children: [
|
|
787
1223
|
"最小 ",
|
|
788
|
-
|
|
1224
|
+
se(P.min)
|
|
789
1225
|
] })
|
|
790
|
-
] }) :
|
|
1226
|
+
] }) : P && P.count > 0 ? /* @__PURE__ */ m("span", { children: [
|
|
791
1227
|
"计数 ",
|
|
792
|
-
|
|
1228
|
+
P.count
|
|
793
1229
|
] }) : null
|
|
794
1230
|
] }),
|
|
795
|
-
c &&
|
|
1231
|
+
c && je.length > 0 && /* @__PURE__ */ s("div", { className: "rxl-tabs", children: je.map(({ s: e, i: t }) => /* @__PURE__ */ s("button", { className: t === y ? "active" : "", onClick: () => K(t), children: e.name }, t)) }),
|
|
1232
|
+
a.exportProgress !== !1 && (a.renderExportProgress ? a.renderExportProgress({ state: Le, busy: Be, cancel: Ve }) : /* @__PURE__ */ s(Kt, { state: Le, busy: Be, onCancel: Ve }))
|
|
796
1233
|
] });
|
|
797
1234
|
});
|
|
798
|
-
function
|
|
799
|
-
const
|
|
800
|
-
const
|
|
801
|
-
|
|
1235
|
+
function Xt(g) {
|
|
1236
|
+
const a = g.selected.length ? new Set(g.selected) : new Set(g.values), [I, S] = R(a), N = (c) => {
|
|
1237
|
+
const E = new Set(I);
|
|
1238
|
+
E.has(c) ? E.delete(c) : E.add(c), S(E);
|
|
802
1239
|
};
|
|
803
|
-
return /* @__PURE__ */ m("div", { className: "rxl-filterpop", style: { left:
|
|
1240
|
+
return /* @__PURE__ */ m("div", { className: "rxl-filterpop", style: { left: g.x, top: g.y }, children: [
|
|
804
1241
|
/* @__PURE__ */ m("div", { className: "sort", children: [
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ s("button", { className: g.sortDir === "asc" ? "on" : "", onClick: () => g.onSort("asc"), children: "↑ 升序" }),
|
|
1243
|
+
/* @__PURE__ */ s("button", { className: g.sortDir === "desc" ? "on" : "", onClick: () => g.onSort("desc"), children: "↓ 降序" })
|
|
807
1244
|
] }),
|
|
808
1245
|
/* @__PURE__ */ m("div", { className: "list", children: [
|
|
809
1246
|
/* @__PURE__ */ m("label", { children: [
|
|
810
|
-
/* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ s(
|
|
811
1248
|
"input",
|
|
812
1249
|
{
|
|
813
1250
|
type: "checkbox",
|
|
814
|
-
checked:
|
|
1251
|
+
checked: I.size === g.values.length,
|
|
815
1252
|
ref: (c) => {
|
|
816
|
-
c && (c.indeterminate =
|
|
1253
|
+
c && (c.indeterminate = I.size > 0 && I.size < g.values.length);
|
|
817
1254
|
},
|
|
818
|
-
onChange: (c) =>
|
|
1255
|
+
onChange: (c) => S(c.target.checked ? new Set(g.values) : /* @__PURE__ */ new Set())
|
|
819
1256
|
}
|
|
820
1257
|
),
|
|
821
1258
|
"(全选)"
|
|
822
1259
|
] }),
|
|
823
|
-
|
|
824
|
-
/* @__PURE__ */
|
|
1260
|
+
g.values.map((c) => /* @__PURE__ */ m("label", { children: [
|
|
1261
|
+
/* @__PURE__ */ s("input", { type: "checkbox", checked: I.has(c), onChange: () => N(c) }),
|
|
825
1262
|
c
|
|
826
1263
|
] }, c))
|
|
827
1264
|
] }),
|
|
828
1265
|
/* @__PURE__ */ m("div", { className: "foot", children: [
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ s("button", { onClick: g.onClear, children: "清除" }),
|
|
1267
|
+
/* @__PURE__ */ s("button", { onClick: () => g.onApply([...I]), children: "确定" }),
|
|
1268
|
+
/* @__PURE__ */ s("button", { onClick: g.onClose, children: "取消" })
|
|
832
1269
|
] })
|
|
833
1270
|
] });
|
|
834
1271
|
}
|
|
835
1272
|
export {
|
|
836
|
-
|
|
837
|
-
|
|
1273
|
+
Gt as ExcelViewer,
|
|
1274
|
+
$t as useExcelDocument
|
|
838
1275
|
};
|