@langeditor/plugin-spreadsheet 0.0.0-stage → 1.1.4
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/LICENSE +21 -0
- package/PRD.md +72 -0
- package/README.md +82 -2
- package/dist/chunks/SpreadsheetSurface-C5IFZ3LB.js +1762 -0
- package/dist/chunks/csv-DF3_VfSt.js +506 -0
- package/dist/chunks/exceljs.min-DrDLmZv4.js +32079 -0
- package/dist/chunks/source-BxpnMm0o.js +37 -0
- package/dist/chunks/workbook-CY5eURLn.js +351 -0
- package/dist/chunks/xlsx-DGiNLc4q.js +17499 -0
- package/dist/components/SpreadsheetStatus.vue.d.ts +7 -0
- package/dist/components/SpreadsheetSurface.vue.d.ts +37 -0
- package/dist/components/SpreadsheetToolbar.vue.d.ts +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +647 -0
- package/dist/locales/en.d.ts +57 -0
- package/dist/locales/zh.d.ts +57 -0
- package/dist/manifest.d.ts +10 -0
- package/dist/model/workbook.d.ts +55 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/serializers/csv.d.ts +7 -0
- package/dist/serializers/index.d.ts +7 -0
- package/dist/serializers/source.d.ts +6 -0
- package/dist/serializers/xlsx.d.ts +6 -0
- package/dist/style.css +3 -0
- package/dist/types.d.ts +176 -0
- package/package.json +68 -3
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
import { ActionButton as e, ActionDropdownButton as t, ActionMenuButton as n, ColorPicker as r, MenuCheckboxItem as i, Separator as a, registerEditorPlugin as o, registerLocaleMessages as s, useLocale as c } from "@langeditor/core";
|
|
2
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, normalizeStyle as _, onUnmounted as v, openBlock as y, ref as b, renderList as x, resolveDynamicComponent as ee, toDisplayString as S, unref as C, withCtx as w } from "vue";
|
|
3
|
+
import { Baseline as T, Bold as E, Columns3 as D, Eraser as O, FileDown as te, FileUp as ne, Italic as re, Merge as ie, PaintBucket as ae, Plus as oe, Rows3 as k, TextAlignCenter as A, TextAlignEnd as j, TextAlignStart as M, TextWrap as N, Underline as se } from "@lucide/vue";
|
|
4
|
+
//#region src/components/SpreadsheetStatus.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var P = { class: "flex min-w-0 items-center text-[10px] text-muted-foreground" }, F = { class: "border-r border-border px-2 pl-0.5" }, I = { class: "border-r border-border px-2" }, L = { class: "border-r border-border px-2" }, R = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "border-r border-border px-2"
|
|
8
|
+
}, z = { class: "border-r border-border px-2" }, B = { class: "border-r border-border px-2" }, V = /* @__PURE__ */ g({
|
|
9
|
+
__name: "SpreadsheetStatus",
|
|
10
|
+
props: { session: {} },
|
|
11
|
+
setup(e) {
|
|
12
|
+
let t = e, { t: n } = c(), r = b(0), i = t.session.subscribe?.(() => r.value += 1);
|
|
13
|
+
v(() => i?.());
|
|
14
|
+
let a = u(() => {
|
|
15
|
+
r.value;
|
|
16
|
+
let { selection: e, value: n } = t.session.getSpreadsheetState(), i = Math.max(0, n.sheets.findIndex((t) => t.id === e.sheetId)), a = (e.endRow - e.startRow + 1) * (e.endColumn - e.startColumn + 1), o = [], s = 0;
|
|
17
|
+
for (let n = e.startRow; n <= e.endRow; n += 1) for (let r = e.startColumn; r <= e.endColumn; r += 1) {
|
|
18
|
+
let i = t.session.getFormattedCellValue(e.sheetId, n, r).trim();
|
|
19
|
+
if (!i) continue;
|
|
20
|
+
s += 1;
|
|
21
|
+
let a = Number(i.replaceAll(",", ""));
|
|
22
|
+
Number.isFinite(a) && o.push(a);
|
|
23
|
+
}
|
|
24
|
+
let c = o.reduce((e, t) => e + t, 0);
|
|
25
|
+
return {
|
|
26
|
+
sheet: `${i + 1} / ${n.sheets.length}`,
|
|
27
|
+
selection: e.address,
|
|
28
|
+
selectedCells: a,
|
|
29
|
+
populatedCells: s,
|
|
30
|
+
numericCount: o.length,
|
|
31
|
+
average: o.length ? c / o.length : 0,
|
|
32
|
+
sum: c
|
|
33
|
+
};
|
|
34
|
+
}), o = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 });
|
|
35
|
+
return (e, t) => (y(), p("div", P, [
|
|
36
|
+
m("span", F, S(C(n)("spreadsheet.status.sheet")) + " " + S(a.value.sheet), 1),
|
|
37
|
+
m("span", I, S(C(n)("spreadsheet.status.selectionLabel")) + " " + S(a.value.selection), 1),
|
|
38
|
+
m("span", L, S(C(n)("spreadsheet.status.cells")) + " " + S(a.value.selectedCells), 1),
|
|
39
|
+
a.value.selectedCells > 1 ? (y(), p("span", R, S(C(n)("spreadsheet.status.count")) + " " + S(a.value.populatedCells), 1)) : f("", !0),
|
|
40
|
+
a.value.numericCount ? (y(), p(l, { key: 1 }, [m("span", z, S(C(n)("spreadsheet.status.average")) + " " + S(C(o).format(a.value.average)), 1), m("span", B, S(C(n)("spreadsheet.status.sum")) + " " + S(C(o).format(a.value.sum)), 1)], 64)) : f("", !0)
|
|
41
|
+
]));
|
|
42
|
+
}
|
|
43
|
+
}), H = ["aria-label"], U = { class: "flex shrink-0 items-center gap-0.5" }, W = { class: "flex shrink-0 items-center gap-0.5" }, G = { class: "flex shrink-0 items-center gap-0.5" }, ce = { class: "relative flex size-5 items-center justify-center" }, le = { class: "relative flex size-5 items-center justify-center" }, ue = { class: "flex shrink-0 items-center gap-0.5" }, de = { class: "flex shrink-0 items-center gap-0.5" }, K = /* @__PURE__ */ g({
|
|
44
|
+
__name: "SpreadsheetToolbar",
|
|
45
|
+
props: { session: {} },
|
|
46
|
+
setup(o) {
|
|
47
|
+
let s = o, { t: f } = c(), g = b(), P = b(!1), F = b(0), I = s.session.subscribe?.(() => F.value += 1);
|
|
48
|
+
v(() => I?.());
|
|
49
|
+
let L = u(() => (F.value, s.session.getSpreadsheetState())), R = u(() => L.value.selectionStyle), z = u(() => L.value.merged), B = u(() => {
|
|
50
|
+
let e = L.value.selection;
|
|
51
|
+
return e.startRow !== e.endRow || e.startColumn !== e.endColumn;
|
|
52
|
+
}), V = u(() => !s.session.editable || P.value), K = [
|
|
53
|
+
"Aptos",
|
|
54
|
+
"Calibri",
|
|
55
|
+
"Microsoft YaHei",
|
|
56
|
+
"Georgia",
|
|
57
|
+
"Menlo"
|
|
58
|
+
], q = [
|
|
59
|
+
9,
|
|
60
|
+
10,
|
|
61
|
+
11,
|
|
62
|
+
12,
|
|
63
|
+
14,
|
|
64
|
+
16,
|
|
65
|
+
18,
|
|
66
|
+
20,
|
|
67
|
+
24
|
|
68
|
+
], J = u(() => K.includes(R.value.fontFamily) ? K : [R.value.fontFamily, ...K]), Y = u(() => q.includes(R.value.fontSize) ? q : [R.value.fontSize, ...q].sort((e, t) => e - t)), X = [{
|
|
69
|
+
format: "xlsx",
|
|
70
|
+
label: "spreadsheet.toolbar.exportXlsx",
|
|
71
|
+
shortLabel: "spreadsheet.toolbar.exportXlsxShort"
|
|
72
|
+
}, {
|
|
73
|
+
format: "csv",
|
|
74
|
+
label: "spreadsheet.toolbar.exportCsv",
|
|
75
|
+
shortLabel: "spreadsheet.toolbar.exportCsvShort"
|
|
76
|
+
}], Z = [
|
|
77
|
+
{
|
|
78
|
+
value: "left",
|
|
79
|
+
label: "spreadsheet.toolbar.alignLeft",
|
|
80
|
+
icon: M
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: "center",
|
|
84
|
+
label: "spreadsheet.toolbar.alignCenter",
|
|
85
|
+
icon: A
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: "right",
|
|
89
|
+
label: "spreadsheet.toolbar.alignRight",
|
|
90
|
+
icon: j
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
async function Q(e) {
|
|
94
|
+
if (!(!s.session.editable || P.value)) {
|
|
95
|
+
P.value = !0;
|
|
96
|
+
try {
|
|
97
|
+
await s.session.applyOperations([e], { origin: "user" });
|
|
98
|
+
} finally {
|
|
99
|
+
P.value = !1;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function $(e) {
|
|
104
|
+
let t = e.target, n = t.files?.[0];
|
|
105
|
+
n && await Q({
|
|
106
|
+
type: "spreadsheet.import",
|
|
107
|
+
payload: { source: n }
|
|
108
|
+
}), t.value = "";
|
|
109
|
+
}
|
|
110
|
+
function fe(e) {
|
|
111
|
+
Q({
|
|
112
|
+
type: "spreadsheet.set-style",
|
|
113
|
+
payload: { font: { family: e } }
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function pe(e) {
|
|
117
|
+
Q({
|
|
118
|
+
type: "spreadsheet.set-style",
|
|
119
|
+
payload: { font: { size: e } }
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function me(e) {
|
|
123
|
+
Q({
|
|
124
|
+
type: "spreadsheet.set-style",
|
|
125
|
+
payload: { font: { color: e ?? "#111827" } }
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function he(e) {
|
|
129
|
+
Q({
|
|
130
|
+
type: "spreadsheet.set-style",
|
|
131
|
+
payload: { fill: { color: e ?? "#ffffff" } }
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function ge(e) {
|
|
135
|
+
Q({
|
|
136
|
+
type: "spreadsheet.set-style",
|
|
137
|
+
payload: { alignment: { horizontal: e } }
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return (o, s) => (y(), p("div", {
|
|
141
|
+
class: "flex min-w-0 items-center gap-0.5 overflow-x-auto px-2 py-1",
|
|
142
|
+
role: "toolbar",
|
|
143
|
+
"aria-label": C(f)("spreadsheet.toolbar.label")
|
|
144
|
+
}, [
|
|
145
|
+
m("input", {
|
|
146
|
+
ref_key: "fileInput",
|
|
147
|
+
ref: g,
|
|
148
|
+
accept: ".xlsx,.xlsm,.ods,.csv,.tsv,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
class: "sr-only",
|
|
151
|
+
tabindex: "-1",
|
|
152
|
+
type: "file",
|
|
153
|
+
onChange: $
|
|
154
|
+
}, null, 544),
|
|
155
|
+
m("div", U, [h(C(e), {
|
|
156
|
+
action: () => g.value?.click(),
|
|
157
|
+
"aria-label": C(f)("spreadsheet.toolbar.import"),
|
|
158
|
+
disabled: V.value,
|
|
159
|
+
tooltip: C(f)("spreadsheet.toolbar.import")
|
|
160
|
+
}, {
|
|
161
|
+
icon: w(() => [h(C(ne), { "aria-hidden": "true" })]),
|
|
162
|
+
_: 1
|
|
163
|
+
}, 8, [
|
|
164
|
+
"action",
|
|
165
|
+
"aria-label",
|
|
166
|
+
"disabled",
|
|
167
|
+
"tooltip"
|
|
168
|
+
]), (y(), p(l, null, x(X, (t) => h(C(e), {
|
|
169
|
+
key: t.format,
|
|
170
|
+
action: () => Q({
|
|
171
|
+
type: "spreadsheet.export",
|
|
172
|
+
payload: { format: t.format }
|
|
173
|
+
}),
|
|
174
|
+
"aria-label": C(f)(t.label),
|
|
175
|
+
disabled: V.value,
|
|
176
|
+
title: C(f)(t.shortLabel),
|
|
177
|
+
tooltip: C(f)(t.label)
|
|
178
|
+
}, {
|
|
179
|
+
icon: w(() => [h(C(te), { "aria-hidden": "true" })]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, [
|
|
182
|
+
"action",
|
|
183
|
+
"aria-label",
|
|
184
|
+
"disabled",
|
|
185
|
+
"title",
|
|
186
|
+
"tooltip"
|
|
187
|
+
])), 64))]),
|
|
188
|
+
h(C(a), {
|
|
189
|
+
class: "mx-1 h-5",
|
|
190
|
+
orientation: "vertical"
|
|
191
|
+
}),
|
|
192
|
+
m("div", W, [
|
|
193
|
+
h(C(t), {
|
|
194
|
+
class: "w-44",
|
|
195
|
+
btn_class: "w-[118px]",
|
|
196
|
+
disabled: V.value,
|
|
197
|
+
title: R.value.fontFamily,
|
|
198
|
+
tooltip: C(f)("spreadsheet.toolbar.fontFamily")
|
|
199
|
+
}, {
|
|
200
|
+
default: w(() => [(y(!0), p(l, null, x(J.value, (e) => (y(), d(C(i), {
|
|
201
|
+
key: e,
|
|
202
|
+
"model-value": R.value.fontFamily === e,
|
|
203
|
+
onSelect: (t) => fe(e)
|
|
204
|
+
}, {
|
|
205
|
+
default: w(() => [m("span", {
|
|
206
|
+
class: "truncate",
|
|
207
|
+
style: _({ fontFamily: e })
|
|
208
|
+
}, S(e), 5)]),
|
|
209
|
+
_: 2
|
|
210
|
+
}, 1032, ["model-value", "onSelect"]))), 128))]),
|
|
211
|
+
_: 1
|
|
212
|
+
}, 8, [
|
|
213
|
+
"disabled",
|
|
214
|
+
"title",
|
|
215
|
+
"tooltip"
|
|
216
|
+
]),
|
|
217
|
+
h(C(t), {
|
|
218
|
+
class: "w-24",
|
|
219
|
+
btn_class: "w-[68px]",
|
|
220
|
+
disabled: V.value,
|
|
221
|
+
title: String(R.value.fontSize),
|
|
222
|
+
tooltip: C(f)("spreadsheet.toolbar.fontSize")
|
|
223
|
+
}, {
|
|
224
|
+
default: w(() => [(y(!0), p(l, null, x(Y.value, (e) => (y(), d(C(i), {
|
|
225
|
+
key: e,
|
|
226
|
+
"model-value": R.value.fontSize === e,
|
|
227
|
+
onSelect: (t) => pe(e)
|
|
228
|
+
}, {
|
|
229
|
+
default: w(() => [m("span", null, S(e), 1)]),
|
|
230
|
+
_: 2
|
|
231
|
+
}, 1032, ["model-value", "onSelect"]))), 128))]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, [
|
|
234
|
+
"disabled",
|
|
235
|
+
"title",
|
|
236
|
+
"tooltip"
|
|
237
|
+
]),
|
|
238
|
+
h(C(e), {
|
|
239
|
+
action: () => Q({
|
|
240
|
+
type: "spreadsheet.set-style",
|
|
241
|
+
payload: { font: { bold: !R.value.bold } }
|
|
242
|
+
}),
|
|
243
|
+
"aria-label": C(f)("spreadsheet.toolbar.bold"),
|
|
244
|
+
disabled: V.value,
|
|
245
|
+
"is-active": () => R.value.bold,
|
|
246
|
+
tooltip: C(f)("spreadsheet.toolbar.bold")
|
|
247
|
+
}, {
|
|
248
|
+
icon: w(() => [h(C(E), { "aria-hidden": "true" })]),
|
|
249
|
+
_: 1
|
|
250
|
+
}, 8, [
|
|
251
|
+
"action",
|
|
252
|
+
"aria-label",
|
|
253
|
+
"disabled",
|
|
254
|
+
"is-active",
|
|
255
|
+
"tooltip"
|
|
256
|
+
]),
|
|
257
|
+
h(C(e), {
|
|
258
|
+
action: () => Q({
|
|
259
|
+
type: "spreadsheet.set-style",
|
|
260
|
+
payload: { font: { italic: !R.value.italic } }
|
|
261
|
+
}),
|
|
262
|
+
"aria-label": C(f)("spreadsheet.toolbar.italic"),
|
|
263
|
+
disabled: V.value,
|
|
264
|
+
"is-active": () => R.value.italic,
|
|
265
|
+
tooltip: C(f)("spreadsheet.toolbar.italic")
|
|
266
|
+
}, {
|
|
267
|
+
icon: w(() => [h(C(re), { "aria-hidden": "true" })]),
|
|
268
|
+
_: 1
|
|
269
|
+
}, 8, [
|
|
270
|
+
"action",
|
|
271
|
+
"aria-label",
|
|
272
|
+
"disabled",
|
|
273
|
+
"is-active",
|
|
274
|
+
"tooltip"
|
|
275
|
+
]),
|
|
276
|
+
h(C(e), {
|
|
277
|
+
action: () => Q({
|
|
278
|
+
type: "spreadsheet.set-style",
|
|
279
|
+
payload: { font: { underline: !R.value.underline } }
|
|
280
|
+
}),
|
|
281
|
+
"aria-label": C(f)("spreadsheet.toolbar.underline"),
|
|
282
|
+
disabled: V.value,
|
|
283
|
+
"is-active": () => R.value.underline,
|
|
284
|
+
tooltip: C(f)("spreadsheet.toolbar.underline")
|
|
285
|
+
}, {
|
|
286
|
+
icon: w(() => [h(C(se), { "aria-hidden": "true" })]),
|
|
287
|
+
_: 1
|
|
288
|
+
}, 8, [
|
|
289
|
+
"action",
|
|
290
|
+
"aria-label",
|
|
291
|
+
"disabled",
|
|
292
|
+
"is-active",
|
|
293
|
+
"tooltip"
|
|
294
|
+
])
|
|
295
|
+
]),
|
|
296
|
+
h(C(a), {
|
|
297
|
+
class: "mx-1 h-5",
|
|
298
|
+
orientation: "vertical"
|
|
299
|
+
}),
|
|
300
|
+
m("div", G, [h(C(r), {
|
|
301
|
+
disabled: V.value,
|
|
302
|
+
"model-value": R.value.fontColor,
|
|
303
|
+
onChange: me
|
|
304
|
+
}, {
|
|
305
|
+
default: w(() => [h(C(n), {
|
|
306
|
+
class: "min-w-11 px-2",
|
|
307
|
+
"aria-label": C(f)("spreadsheet.toolbar.fontColor"),
|
|
308
|
+
disabled: V.value,
|
|
309
|
+
tooltip: C(f)("spreadsheet.toolbar.fontColor")
|
|
310
|
+
}, {
|
|
311
|
+
prefix: w(() => [m("span", ce, [h(C(T), { "aria-hidden": "true" }), m("span", {
|
|
312
|
+
"aria-hidden": "true",
|
|
313
|
+
class: "absolute inset-x-0 bottom-0 h-0.5 rounded-full",
|
|
314
|
+
style: _({ backgroundColor: R.value.fontColor })
|
|
315
|
+
}, null, 4)])]),
|
|
316
|
+
_: 1
|
|
317
|
+
}, 8, [
|
|
318
|
+
"aria-label",
|
|
319
|
+
"disabled",
|
|
320
|
+
"tooltip"
|
|
321
|
+
])]),
|
|
322
|
+
_: 1
|
|
323
|
+
}, 8, ["disabled", "model-value"]), h(C(r), {
|
|
324
|
+
highlight: "",
|
|
325
|
+
disabled: V.value,
|
|
326
|
+
"model-value": R.value.fillColor,
|
|
327
|
+
onChange: he
|
|
328
|
+
}, {
|
|
329
|
+
default: w(() => [h(C(n), {
|
|
330
|
+
class: "min-w-11 px-2",
|
|
331
|
+
"aria-label": C(f)("spreadsheet.toolbar.fillColor"),
|
|
332
|
+
disabled: V.value,
|
|
333
|
+
tooltip: C(f)("spreadsheet.toolbar.fillColor")
|
|
334
|
+
}, {
|
|
335
|
+
prefix: w(() => [m("span", le, [h(C(ae), { "aria-hidden": "true" }), m("span", {
|
|
336
|
+
"aria-hidden": "true",
|
|
337
|
+
class: "absolute inset-x-0 bottom-0 h-0.5 rounded-full border border-border",
|
|
338
|
+
style: _({ backgroundColor: R.value.fillColor })
|
|
339
|
+
}, null, 4)])]),
|
|
340
|
+
_: 1
|
|
341
|
+
}, 8, [
|
|
342
|
+
"aria-label",
|
|
343
|
+
"disabled",
|
|
344
|
+
"tooltip"
|
|
345
|
+
])]),
|
|
346
|
+
_: 1
|
|
347
|
+
}, 8, ["disabled", "model-value"])]),
|
|
348
|
+
h(C(a), {
|
|
349
|
+
class: "mx-1 h-5",
|
|
350
|
+
orientation: "vertical"
|
|
351
|
+
}),
|
|
352
|
+
m("div", ue, [
|
|
353
|
+
(y(), p(l, null, x(Z, (t) => h(C(e), {
|
|
354
|
+
key: t.value,
|
|
355
|
+
action: () => ge(t.value),
|
|
356
|
+
"aria-label": C(f)(t.label),
|
|
357
|
+
disabled: V.value,
|
|
358
|
+
"is-active": () => R.value.horizontal === t.value,
|
|
359
|
+
tooltip: C(f)(t.label)
|
|
360
|
+
}, {
|
|
361
|
+
icon: w(() => [(y(), d(ee(t.icon), { "aria-hidden": "true" }))]),
|
|
362
|
+
_: 2
|
|
363
|
+
}, 1032, [
|
|
364
|
+
"action",
|
|
365
|
+
"aria-label",
|
|
366
|
+
"disabled",
|
|
367
|
+
"is-active",
|
|
368
|
+
"tooltip"
|
|
369
|
+
])), 64)),
|
|
370
|
+
h(C(e), {
|
|
371
|
+
action: () => Q({
|
|
372
|
+
type: "spreadsheet.set-style",
|
|
373
|
+
payload: { alignment: { wrapText: !R.value.wrapText } }
|
|
374
|
+
}),
|
|
375
|
+
"aria-label": C(f)("spreadsheet.toolbar.wrapText"),
|
|
376
|
+
disabled: V.value,
|
|
377
|
+
"is-active": () => R.value.wrapText,
|
|
378
|
+
tooltip: C(f)("spreadsheet.toolbar.wrapText")
|
|
379
|
+
}, {
|
|
380
|
+
icon: w(() => [h(C(N), { "aria-hidden": "true" })]),
|
|
381
|
+
_: 1
|
|
382
|
+
}, 8, [
|
|
383
|
+
"action",
|
|
384
|
+
"aria-label",
|
|
385
|
+
"disabled",
|
|
386
|
+
"is-active",
|
|
387
|
+
"tooltip"
|
|
388
|
+
]),
|
|
389
|
+
h(C(e), {
|
|
390
|
+
action: () => Q({ type: z.value ? "spreadsheet.unmerge-cells" : "spreadsheet.merge-cells" }),
|
|
391
|
+
"aria-label": C(f)(z.value ? "spreadsheet.toolbar.unmerge" : "spreadsheet.toolbar.merge"),
|
|
392
|
+
disabled: V.value || !z.value && !B.value,
|
|
393
|
+
"is-active": () => z.value,
|
|
394
|
+
title: C(f)(z.value ? "spreadsheet.toolbar.unmergeShort" : "spreadsheet.toolbar.mergeShort"),
|
|
395
|
+
tooltip: C(f)(z.value ? "spreadsheet.toolbar.unmerge" : "spreadsheet.toolbar.merge")
|
|
396
|
+
}, {
|
|
397
|
+
icon: w(() => [h(C(ie), { "aria-hidden": "true" })]),
|
|
398
|
+
_: 1
|
|
399
|
+
}, 8, [
|
|
400
|
+
"action",
|
|
401
|
+
"aria-label",
|
|
402
|
+
"disabled",
|
|
403
|
+
"is-active",
|
|
404
|
+
"title",
|
|
405
|
+
"tooltip"
|
|
406
|
+
]),
|
|
407
|
+
h(C(e), {
|
|
408
|
+
action: () => Q({ type: "spreadsheet.clear-formatting" }),
|
|
409
|
+
"aria-label": C(f)("spreadsheet.toolbar.clearFormatting"),
|
|
410
|
+
disabled: V.value,
|
|
411
|
+
tooltip: C(f)("spreadsheet.toolbar.clearFormatting")
|
|
412
|
+
}, {
|
|
413
|
+
icon: w(() => [h(C(O), { "aria-hidden": "true" })]),
|
|
414
|
+
_: 1
|
|
415
|
+
}, 8, [
|
|
416
|
+
"action",
|
|
417
|
+
"aria-label",
|
|
418
|
+
"disabled",
|
|
419
|
+
"tooltip"
|
|
420
|
+
])
|
|
421
|
+
]),
|
|
422
|
+
h(C(a), {
|
|
423
|
+
class: "mx-1 h-5",
|
|
424
|
+
orientation: "vertical"
|
|
425
|
+
}),
|
|
426
|
+
m("div", de, [
|
|
427
|
+
h(C(e), {
|
|
428
|
+
action: () => Q({ type: "spreadsheet.insert-rows" }),
|
|
429
|
+
"aria-label": C(f)("spreadsheet.toolbar.addRow"),
|
|
430
|
+
disabled: V.value,
|
|
431
|
+
tooltip: C(f)("spreadsheet.toolbar.addRow")
|
|
432
|
+
}, {
|
|
433
|
+
icon: w(() => [h(C(k), { "aria-hidden": "true" })]),
|
|
434
|
+
_: 1
|
|
435
|
+
}, 8, [
|
|
436
|
+
"action",
|
|
437
|
+
"aria-label",
|
|
438
|
+
"disabled",
|
|
439
|
+
"tooltip"
|
|
440
|
+
]),
|
|
441
|
+
h(C(e), {
|
|
442
|
+
action: () => Q({ type: "spreadsheet.insert-columns" }),
|
|
443
|
+
"aria-label": C(f)("spreadsheet.toolbar.addColumn"),
|
|
444
|
+
disabled: V.value,
|
|
445
|
+
tooltip: C(f)("spreadsheet.toolbar.addColumn")
|
|
446
|
+
}, {
|
|
447
|
+
icon: w(() => [h(C(D), { "aria-hidden": "true" })]),
|
|
448
|
+
_: 1
|
|
449
|
+
}, 8, [
|
|
450
|
+
"action",
|
|
451
|
+
"aria-label",
|
|
452
|
+
"disabled",
|
|
453
|
+
"tooltip"
|
|
454
|
+
]),
|
|
455
|
+
h(C(e), {
|
|
456
|
+
action: () => Q({ type: "spreadsheet.add-sheet" }),
|
|
457
|
+
"aria-label": C(f)("spreadsheet.toolbar.addSheet"),
|
|
458
|
+
disabled: V.value,
|
|
459
|
+
tooltip: C(f)("spreadsheet.toolbar.addSheet")
|
|
460
|
+
}, {
|
|
461
|
+
icon: w(() => [h(C(oe), { "aria-hidden": "true" })]),
|
|
462
|
+
_: 1
|
|
463
|
+
}, 8, [
|
|
464
|
+
"action",
|
|
465
|
+
"aria-label",
|
|
466
|
+
"disabled",
|
|
467
|
+
"tooltip"
|
|
468
|
+
])
|
|
469
|
+
])
|
|
470
|
+
], 8, H));
|
|
471
|
+
}
|
|
472
|
+
}), q = {
|
|
473
|
+
"spreadsheet.toolbar.label": "Spreadsheet toolbar",
|
|
474
|
+
"spreadsheet.toolbar.import": "Import XLSX or CSV",
|
|
475
|
+
"spreadsheet.toolbar.exportXlsx": "Export XLSX",
|
|
476
|
+
"spreadsheet.toolbar.exportCsv": "Export current sheet as CSV",
|
|
477
|
+
"spreadsheet.toolbar.exportXlsxShort": "XLSX",
|
|
478
|
+
"spreadsheet.toolbar.exportCsvShort": "CSV",
|
|
479
|
+
"spreadsheet.toolbar.addRow": "Insert row",
|
|
480
|
+
"spreadsheet.toolbar.addColumn": "Insert column",
|
|
481
|
+
"spreadsheet.toolbar.addSheet": "Add worksheet",
|
|
482
|
+
"spreadsheet.toolbar.fontFamily": "Font family",
|
|
483
|
+
"spreadsheet.toolbar.fontSize": "Font size",
|
|
484
|
+
"spreadsheet.toolbar.bold": "Bold",
|
|
485
|
+
"spreadsheet.toolbar.italic": "Italic",
|
|
486
|
+
"spreadsheet.toolbar.underline": "Underline",
|
|
487
|
+
"spreadsheet.toolbar.fontColor": "Text color",
|
|
488
|
+
"spreadsheet.toolbar.fillColor": "Fill color",
|
|
489
|
+
"spreadsheet.toolbar.alignLeft": "Align left",
|
|
490
|
+
"spreadsheet.toolbar.alignCenter": "Align center",
|
|
491
|
+
"spreadsheet.toolbar.alignRight": "Align right",
|
|
492
|
+
"spreadsheet.toolbar.wrapText": "Wrap text",
|
|
493
|
+
"spreadsheet.toolbar.merge": "Merge selected cells",
|
|
494
|
+
"spreadsheet.toolbar.unmerge": "Unmerge selected cells",
|
|
495
|
+
"spreadsheet.toolbar.mergeShort": "Merge",
|
|
496
|
+
"spreadsheet.toolbar.unmergeShort": "Unmerge",
|
|
497
|
+
"spreadsheet.toolbar.clearFormatting": "Clear formatting",
|
|
498
|
+
"spreadsheet.formula.name": "Name box",
|
|
499
|
+
"spreadsheet.formula.input": "Formula bar",
|
|
500
|
+
"spreadsheet.formula.placeholder": "Enter a value or a formula beginning with =",
|
|
501
|
+
"spreadsheet.sheet.add": "Add worksheet",
|
|
502
|
+
"spreadsheet.sheet.select": "Switch to worksheet {name}",
|
|
503
|
+
"spreadsheet.sheet.renameHint": "Double-click to rename worksheet",
|
|
504
|
+
"spreadsheet.sheet.renameInput": "Rename worksheet {name}",
|
|
505
|
+
"spreadsheet.sheet.renameInvalid": "Worksheet names must be 1-31 characters and cannot contain \\ / ? * : [ ].",
|
|
506
|
+
"spreadsheet.status.ready": "Spreadsheet ready",
|
|
507
|
+
"spreadsheet.status.selection": "{sheet} · {range}",
|
|
508
|
+
"spreadsheet.status.sheet": "Sheet",
|
|
509
|
+
"spreadsheet.status.selectionLabel": "Selection",
|
|
510
|
+
"spreadsheet.status.cells": "Cells",
|
|
511
|
+
"spreadsheet.status.count": "Count",
|
|
512
|
+
"spreadsheet.status.average": "Average",
|
|
513
|
+
"spreadsheet.status.sum": "Sum",
|
|
514
|
+
"spreadsheet.loading": "Loading spreadsheet calculation engine",
|
|
515
|
+
"spreadsheet.error.engine": "Failed to load the spreadsheet calculation engine",
|
|
516
|
+
"spreadsheet.error.retry": "Retry",
|
|
517
|
+
"spreadsheet.error.import": "This spreadsheet file could not be imported",
|
|
518
|
+
"spreadsheet.error.unsupportedOperation": "This spreadsheet operation is not supported",
|
|
519
|
+
"spreadsheet.diagnostic.macros-ignored": "The file contains macros. This editor neither executes nor preserves macros.",
|
|
520
|
+
"spreadsheet.diagnostic.charts-unsupported": "Charts are not editable yet and may not round-trip completely.",
|
|
521
|
+
"spreadsheet.diagnostic.images-unsupported": "Worksheet images are not editable yet and may not round-trip completely.",
|
|
522
|
+
"spreadsheet.diagnostic.styles-partial": "Some advanced styles are displayed in a compatible form.",
|
|
523
|
+
"spreadsheet.diagnostic.range-truncated": "The worksheet is very large, so the current view is bounded.",
|
|
524
|
+
"spreadsheet.diagnostic.dismiss": "Dismiss notice",
|
|
525
|
+
"spreadsheet.aria.grid": "Spreadsheet grid",
|
|
526
|
+
"spreadsheet.aria.cell": "Cell {address}"
|
|
527
|
+
}, J = {
|
|
528
|
+
"spreadsheet.toolbar.label": "电子表格工具栏",
|
|
529
|
+
"spreadsheet.toolbar.import": "导入 XLSX 或 CSV",
|
|
530
|
+
"spreadsheet.toolbar.exportXlsx": "导出 XLSX",
|
|
531
|
+
"spreadsheet.toolbar.exportCsv": "导出当前工作表 CSV",
|
|
532
|
+
"spreadsheet.toolbar.exportXlsxShort": "XLSX",
|
|
533
|
+
"spreadsheet.toolbar.exportCsvShort": "CSV",
|
|
534
|
+
"spreadsheet.toolbar.addRow": "插入行",
|
|
535
|
+
"spreadsheet.toolbar.addColumn": "插入列",
|
|
536
|
+
"spreadsheet.toolbar.addSheet": "新建工作表",
|
|
537
|
+
"spreadsheet.toolbar.fontFamily": "字体",
|
|
538
|
+
"spreadsheet.toolbar.fontSize": "字号",
|
|
539
|
+
"spreadsheet.toolbar.bold": "粗体",
|
|
540
|
+
"spreadsheet.toolbar.italic": "斜体",
|
|
541
|
+
"spreadsheet.toolbar.underline": "下划线",
|
|
542
|
+
"spreadsheet.toolbar.fontColor": "文字颜色",
|
|
543
|
+
"spreadsheet.toolbar.fillColor": "填充颜色",
|
|
544
|
+
"spreadsheet.toolbar.alignLeft": "左对齐",
|
|
545
|
+
"spreadsheet.toolbar.alignCenter": "居中对齐",
|
|
546
|
+
"spreadsheet.toolbar.alignRight": "右对齐",
|
|
547
|
+
"spreadsheet.toolbar.wrapText": "自动换行",
|
|
548
|
+
"spreadsheet.toolbar.merge": "合并选中的单元格",
|
|
549
|
+
"spreadsheet.toolbar.unmerge": "取消合并选中的单元格",
|
|
550
|
+
"spreadsheet.toolbar.mergeShort": "合并",
|
|
551
|
+
"spreadsheet.toolbar.unmergeShort": "取消合并",
|
|
552
|
+
"spreadsheet.toolbar.clearFormatting": "清除格式",
|
|
553
|
+
"spreadsheet.formula.name": "名称框",
|
|
554
|
+
"spreadsheet.formula.input": "公式栏",
|
|
555
|
+
"spreadsheet.formula.placeholder": "输入值或以 = 开头的公式",
|
|
556
|
+
"spreadsheet.sheet.add": "新建工作表",
|
|
557
|
+
"spreadsheet.sheet.select": "切换到工作表 {name}",
|
|
558
|
+
"spreadsheet.sheet.renameHint": "双击重命名工作表",
|
|
559
|
+
"spreadsheet.sheet.renameInput": "重命名工作表 {name}",
|
|
560
|
+
"spreadsheet.sheet.renameInvalid": "工作表名称不能为空、不能超过 31 个字符,也不能包含 \\ / ? * : [ ]。",
|
|
561
|
+
"spreadsheet.status.ready": "电子表格已就绪",
|
|
562
|
+
"spreadsheet.status.selection": "{sheet} · {range}",
|
|
563
|
+
"spreadsheet.status.sheet": "工作表",
|
|
564
|
+
"spreadsheet.status.selectionLabel": "选区",
|
|
565
|
+
"spreadsheet.status.cells": "单元格",
|
|
566
|
+
"spreadsheet.status.count": "计数",
|
|
567
|
+
"spreadsheet.status.average": "平均值",
|
|
568
|
+
"spreadsheet.status.sum": "求和",
|
|
569
|
+
"spreadsheet.loading": "正在加载表格计算引擎",
|
|
570
|
+
"spreadsheet.error.engine": "表格计算引擎加载失败",
|
|
571
|
+
"spreadsheet.error.retry": "重新加载",
|
|
572
|
+
"spreadsheet.error.import": "无法导入该电子表格文件",
|
|
573
|
+
"spreadsheet.error.unsupportedOperation": "当前不支持此表格操作",
|
|
574
|
+
"spreadsheet.diagnostic.macros-ignored": "文件包含宏;本编辑器不会运行或保留宏。",
|
|
575
|
+
"spreadsheet.diagnostic.charts-unsupported": "图表暂不能编辑,导出时可能无法完整保留。",
|
|
576
|
+
"spreadsheet.diagnostic.images-unsupported": "工作表图片暂不能编辑,导出时可能无法完整保留。",
|
|
577
|
+
"spreadsheet.diagnostic.styles-partial": "部分高级样式会以兼容形式显示。",
|
|
578
|
+
"spreadsheet.diagnostic.range-truncated": "工作表范围过大,当前视图已限制显示范围。",
|
|
579
|
+
"spreadsheet.diagnostic.dismiss": "关闭提示",
|
|
580
|
+
"spreadsheet.aria.grid": "电子表格网格",
|
|
581
|
+
"spreadsheet.aria.cell": "单元格 {address}"
|
|
582
|
+
}, Y = "@langeditor/plugin-spreadsheet", X = {
|
|
583
|
+
id: Y,
|
|
584
|
+
version: "1.1.4",
|
|
585
|
+
coreRange: "^1.1.4",
|
|
586
|
+
requires: [],
|
|
587
|
+
conflicts: [],
|
|
588
|
+
provides: [
|
|
589
|
+
"document:spreadsheet",
|
|
590
|
+
"serializer:xlsx",
|
|
591
|
+
"serializer:csv"
|
|
592
|
+
],
|
|
593
|
+
enhances: [
|
|
594
|
+
"document:page-layout",
|
|
595
|
+
"document:ai-context",
|
|
596
|
+
"document:operations"
|
|
597
|
+
]
|
|
598
|
+
};
|
|
599
|
+
s("zhHans", J), s("en", q);
|
|
600
|
+
var Z = o({
|
|
601
|
+
...X,
|
|
602
|
+
surfaces: [{
|
|
603
|
+
mode: "spreadsheet",
|
|
604
|
+
capabilities: [
|
|
605
|
+
"selection:range",
|
|
606
|
+
"operations",
|
|
607
|
+
"ai-context",
|
|
608
|
+
"page-layout",
|
|
609
|
+
"import:xlsx",
|
|
610
|
+
"import:csv",
|
|
611
|
+
"export:xlsx",
|
|
612
|
+
"export:csv"
|
|
613
|
+
],
|
|
614
|
+
minHeight: 640,
|
|
615
|
+
load: () => import("./chunks/SpreadsheetSurface-C5IFZ3LB.js")
|
|
616
|
+
}],
|
|
617
|
+
create: () => ({}),
|
|
618
|
+
createDocument: ({ session: e }) => e.kind === "spreadsheet" ? { ui: [{
|
|
619
|
+
id: "spreadsheet-toolbar",
|
|
620
|
+
placement: "toolbar",
|
|
621
|
+
component: K,
|
|
622
|
+
props: { session: e },
|
|
623
|
+
order: 10
|
|
624
|
+
}, {
|
|
625
|
+
id: "spreadsheet-status",
|
|
626
|
+
placement: "statusbar-left",
|
|
627
|
+
component: V,
|
|
628
|
+
props: { session: e },
|
|
629
|
+
order: 10
|
|
630
|
+
}] } : {}
|
|
631
|
+
});
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/serializers/index.ts
|
|
634
|
+
async function Q(e) {
|
|
635
|
+
let { importDocumentSource: t } = await import("./chunks/source-BxpnMm0o.js").then((e) => e.n);
|
|
636
|
+
return t(e);
|
|
637
|
+
}
|
|
638
|
+
async function $(e, t) {
|
|
639
|
+
if (t === "xlsx") {
|
|
640
|
+
let { exportXlsx: t } = await import("./chunks/xlsx-DGiNLc4q.js").then((e) => e.r);
|
|
641
|
+
return t(e);
|
|
642
|
+
}
|
|
643
|
+
let { exportCsv: n, selectedSheet: r } = await import("./chunks/csv-DF3_VfSt.js").then((e) => e.t);
|
|
644
|
+
return n(r(e));
|
|
645
|
+
}
|
|
646
|
+
//#endregion
|
|
647
|
+
export { Y as SPREADSHEET_PLUGIN_ID, $ as exportSpreadsheet, Q as importSpreadsheet, X as spreadsheetManifest, Z as unregisterSpreadsheetPlugin };
|