xiaodao-spreader 0.1.2
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/README.md +91 -0
- package/dist/style.css +1 -0
- package/dist/types/components/spreader/constants.d.ts +15 -0
- package/dist/types/components/spreader/formula.d.ts +36 -0
- package/dist/types/components/spreader/spreader.vue.d.ts +28 -0
- package/dist/types/components/spreader/theme.d.ts +4 -0
- package/dist/types/components/spreader/types.d.ts +115 -0
- package/dist/types/components/spreader/utils.d.ts +26 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/xiaodao-spreader.es.js +1632 -0
- package/dist/xiaodao-spreader.umd.js +4 -0
- package/package.json +52 -0
|
@@ -0,0 +1,1632 @@
|
|
|
1
|
+
import { defineComponent as kn, computed as I, useModel as Rn, reactive as wl, ref as N, onMounted as Mn, nextTick as J, watch as Ve, onBeforeUnmount as Tn, openBlock as j, createElementBlock as P, normalizeStyle as Ce, createElementVNode as $, Fragment as Yt, renderList as Ut, withModifiers as ue, normalizeClass as vt, toDisplayString as dt, unref as se, createCommentVNode as Fe, createBlock as Dn, Teleport as Hn, mergeModels as _n } from "vue";
|
|
2
|
+
const w = 52, y = 24, Je = 100, Ze = 24, Q = 11, En = 50, $n = {
|
|
3
|
+
"zh-CN": {
|
|
4
|
+
insert: "插入",
|
|
5
|
+
delete: "删除",
|
|
6
|
+
rename: "重命名",
|
|
7
|
+
moveLeft: "左移",
|
|
8
|
+
moveRight: "右移",
|
|
9
|
+
cut: "剪切",
|
|
10
|
+
copy: "复制",
|
|
11
|
+
paste: "粘贴",
|
|
12
|
+
addSheet: "新建工作表",
|
|
13
|
+
moveSheetLeft: "左移",
|
|
14
|
+
moveSheetRight: "右移",
|
|
15
|
+
scrollUp: "向上滚动",
|
|
16
|
+
scrollDown: "向下滚动",
|
|
17
|
+
scrollLeft: "向左滚动",
|
|
18
|
+
scrollRight: "向右滚动",
|
|
19
|
+
calculate: "计算",
|
|
20
|
+
sum: "求和"
|
|
21
|
+
},
|
|
22
|
+
"en-US": {
|
|
23
|
+
insert: "Insert",
|
|
24
|
+
delete: "Delete",
|
|
25
|
+
rename: "Rename",
|
|
26
|
+
moveLeft: "Move Left",
|
|
27
|
+
moveRight: "Move Right",
|
|
28
|
+
cut: "Cut",
|
|
29
|
+
copy: "Copy",
|
|
30
|
+
paste: "Paste",
|
|
31
|
+
addSheet: "Add new sheet",
|
|
32
|
+
moveSheetLeft: "Move Left",
|
|
33
|
+
moveSheetRight: "Move Right",
|
|
34
|
+
scrollUp: "Scroll up",
|
|
35
|
+
scrollDown: "Scroll down",
|
|
36
|
+
scrollLeft: "Scroll left",
|
|
37
|
+
scrollRight: "Scroll right",
|
|
38
|
+
calculate: "Calculate",
|
|
39
|
+
sum: "Sum"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function C(u, f) {
|
|
43
|
+
var s;
|
|
44
|
+
return ((s = $n[u]) == null ? void 0 : s[f]) ?? f;
|
|
45
|
+
}
|
|
46
|
+
const In = {
|
|
47
|
+
bg: "#f4f4f4",
|
|
48
|
+
gridBg: "#ffffff",
|
|
49
|
+
headerBg: "#e8e8e8",
|
|
50
|
+
headerBorder: "#c8c8c8",
|
|
51
|
+
headerText: "#444",
|
|
52
|
+
headerSep: "#b0b0b0",
|
|
53
|
+
cornerBg: "#e0e0e0",
|
|
54
|
+
gridLine: "#e0e0e0",
|
|
55
|
+
selectionBg: "rgba(0, 120, 215, 0.12)",
|
|
56
|
+
activeCellBorder: "#0078d7",
|
|
57
|
+
cellText: "#1a1a1a",
|
|
58
|
+
scrollTrack: "rgba(0,0,0,0.08)",
|
|
59
|
+
scrollThumb: "rgba(0,0,0,0.25)",
|
|
60
|
+
formulaBarBg: "#f0f0f0",
|
|
61
|
+
formulaBarBorder: "#c8c8c8",
|
|
62
|
+
formulaBarLabelText: "#333",
|
|
63
|
+
formulaBarLabelBg: "#fff",
|
|
64
|
+
formulaBarLabelBorder: "#c0c0c0",
|
|
65
|
+
formulaBarInputBg: "#fff",
|
|
66
|
+
formulaBarInputBorder: "#c0c0c0",
|
|
67
|
+
formulaBarInputText: "#1a1a1a",
|
|
68
|
+
formulaBarInputFocusBorder: "#0078d7",
|
|
69
|
+
formulaBarInputFocusShadow: "rgba(0, 120, 215, 0.3)",
|
|
70
|
+
wrapperBg: "#e8e8e8",
|
|
71
|
+
cellEditorBorder: "#0078d7",
|
|
72
|
+
cellEditorText: "#1a1a1a",
|
|
73
|
+
cellEditorBg: "#fff",
|
|
74
|
+
cellEditorShadow: "#0078d7",
|
|
75
|
+
tabBarBg: "#e8e8e8",
|
|
76
|
+
tabBarBorder: "#c0c0c0",
|
|
77
|
+
tabActiveBg: "#ffffff",
|
|
78
|
+
tabActiveText: "#1a1a1a",
|
|
79
|
+
tabActiveBorder: "#0078d7",
|
|
80
|
+
tabInactiveBg: "#dfdfdf",
|
|
81
|
+
tabInactiveText: "#666",
|
|
82
|
+
tabInactiveBorder: "transparent",
|
|
83
|
+
tabHoverBg: "#e0e0e0",
|
|
84
|
+
tabAddBtnColor: "#555",
|
|
85
|
+
tabAddBtnHoverBg: "#d0d0d0",
|
|
86
|
+
tabScrollBtnColor: "#888",
|
|
87
|
+
tabScrollBtnHoverBg: "#d0d0d0",
|
|
88
|
+
scrollbarThumb: "rgba(0,0,0,0.25)",
|
|
89
|
+
scrollbarThumbHover: "rgba(0,0,0,0.4)",
|
|
90
|
+
scrollBtnBg: "#e8e8e8",
|
|
91
|
+
scrollBtnColor: "#666",
|
|
92
|
+
scrollBtnHoverBg: "#d0d0d0",
|
|
93
|
+
scrollBtnActiveBg: "#c0c0c0",
|
|
94
|
+
scrollTrackBg: "rgba(0,0,0,0.06)"
|
|
95
|
+
}, Wn = {
|
|
96
|
+
bg: "#1e1e1e",
|
|
97
|
+
gridBg: "#252526",
|
|
98
|
+
headerBg: "#252525",
|
|
99
|
+
headerBorder: "#3e3e3e",
|
|
100
|
+
headerText: "#999",
|
|
101
|
+
headerSep: "#3e3e3e",
|
|
102
|
+
cornerBg: "#2a2a2a",
|
|
103
|
+
gridLine: "#3e3e3e",
|
|
104
|
+
selectionBg: "rgba(0, 120, 215, 0.25)",
|
|
105
|
+
activeCellBorder: "#0078d7",
|
|
106
|
+
cellText: "#d4d4d4",
|
|
107
|
+
scrollTrack: "rgba(255,255,255,0.06)",
|
|
108
|
+
scrollThumb: "rgba(255,255,255,0.2)",
|
|
109
|
+
formulaBarBg: "#2d2d2d",
|
|
110
|
+
formulaBarBorder: "#3e3e3e",
|
|
111
|
+
formulaBarLabelText: "#ccc",
|
|
112
|
+
formulaBarLabelBg: "#3c3c3c",
|
|
113
|
+
formulaBarLabelBorder: "#555",
|
|
114
|
+
formulaBarInputBg: "#3c3c3c",
|
|
115
|
+
formulaBarInputBorder: "#555",
|
|
116
|
+
formulaBarInputText: "#d4d4d4",
|
|
117
|
+
formulaBarInputFocusBorder: "#0078d7",
|
|
118
|
+
formulaBarInputFocusShadow: "rgba(0, 120, 215, 0.4)",
|
|
119
|
+
wrapperBg: "#1e1e1e",
|
|
120
|
+
cellEditorBorder: "#0078d7",
|
|
121
|
+
cellEditorText: "#d4d4d4",
|
|
122
|
+
cellEditorBg: "#3c3c3c",
|
|
123
|
+
cellEditorShadow: "#0078d7",
|
|
124
|
+
tabBarBg: "#2a2a2a",
|
|
125
|
+
tabBarBorder: "#3e3e3e",
|
|
126
|
+
tabActiveBg: "#1e1e1e",
|
|
127
|
+
tabActiveText: "#e0e0e0",
|
|
128
|
+
tabActiveBorder: "#0078d7",
|
|
129
|
+
tabInactiveBg: "#333333",
|
|
130
|
+
tabInactiveText: "#888",
|
|
131
|
+
tabInactiveBorder: "transparent",
|
|
132
|
+
tabHoverBg: "#3a3a3a",
|
|
133
|
+
tabAddBtnColor: "#999",
|
|
134
|
+
tabAddBtnHoverBg: "#3a3a3a",
|
|
135
|
+
tabScrollBtnColor: "#777",
|
|
136
|
+
tabScrollBtnHoverBg: "#3a3a3a",
|
|
137
|
+
scrollbarThumb: "rgba(255,255,255,0.2)",
|
|
138
|
+
scrollbarThumbHover: "rgba(255,255,255,0.35)",
|
|
139
|
+
scrollBtnBg: "#2d2d2d",
|
|
140
|
+
scrollBtnColor: "#999",
|
|
141
|
+
scrollBtnHoverBg: "#3d3d3d",
|
|
142
|
+
scrollBtnActiveBg: "#4d4d4d",
|
|
143
|
+
scrollTrackBg: "rgba(255,255,255,0.05)"
|
|
144
|
+
};
|
|
145
|
+
function ce(u) {
|
|
146
|
+
let f = "", s = u;
|
|
147
|
+
do
|
|
148
|
+
f = String.fromCharCode(65 + s % 26) + f, s = Math.floor(s / 26) - 1;
|
|
149
|
+
while (s >= 0);
|
|
150
|
+
return f;
|
|
151
|
+
}
|
|
152
|
+
function Kt(u) {
|
|
153
|
+
let f = 0;
|
|
154
|
+
for (let s = 0; s < u.length; s++)
|
|
155
|
+
f = f * 26 + (u.toUpperCase().charCodeAt(s) - 64);
|
|
156
|
+
return f - 1;
|
|
157
|
+
}
|
|
158
|
+
function Se(u) {
|
|
159
|
+
if (u == null)
|
|
160
|
+
return null;
|
|
161
|
+
if (typeof u == "number")
|
|
162
|
+
return u;
|
|
163
|
+
if (typeof u == "string") {
|
|
164
|
+
const f = parseFloat(u);
|
|
165
|
+
return u.endsWith("%") || isNaN(f) ? null : f;
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
function jt(u) {
|
|
170
|
+
navigator.clipboard.writeText(u).catch(() => {
|
|
171
|
+
const f = document.createElement("textarea");
|
|
172
|
+
f.value = u, f.style.position = "fixed", f.style.opacity = "0", document.body.appendChild(f), f.select(), document.execCommand("copy"), document.body.removeChild(f);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function Xe(u, f) {
|
|
176
|
+
return `${u},${f}`;
|
|
177
|
+
}
|
|
178
|
+
function ht(u, f, s) {
|
|
179
|
+
const c = u.match(/^\$?([A-Z]+)\$?(\d+)$/i);
|
|
180
|
+
if (!c)
|
|
181
|
+
return null;
|
|
182
|
+
const r = Kt(c[1]), m = parseInt(c[2], 10) - 1;
|
|
183
|
+
return r < 0 || r >= f || m < 0 || m >= s ? null : { col: r, row: m };
|
|
184
|
+
}
|
|
185
|
+
function ke(u, f) {
|
|
186
|
+
if (!f)
|
|
187
|
+
return { x: 0, y: 0 };
|
|
188
|
+
const s = f.getBoundingClientRect();
|
|
189
|
+
return { x: u.clientX - s.left, y: u.clientY - s.top };
|
|
190
|
+
}
|
|
191
|
+
function An(u, f, s) {
|
|
192
|
+
const c = u.split(":");
|
|
193
|
+
if (c.length !== 2)
|
|
194
|
+
return null;
|
|
195
|
+
const r = ht(c[0], f, s), m = ht(c[1], f, s);
|
|
196
|
+
return !r || !m ? null : {
|
|
197
|
+
sc: Math.min(r.col, m.col),
|
|
198
|
+
sr: Math.min(r.row, m.row),
|
|
199
|
+
ec: Math.max(r.col, m.col),
|
|
200
|
+
er: Math.max(r.row, m.row)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function Nn(u, f, s, c, r) {
|
|
204
|
+
const m = s[Xe(u, f)];
|
|
205
|
+
if (!m)
|
|
206
|
+
return 0;
|
|
207
|
+
const k = m.value;
|
|
208
|
+
if (k.startsWith("="))
|
|
209
|
+
return Bl(Xe(u, f), s, c, r) ?? 0;
|
|
210
|
+
const b = parseFloat(k);
|
|
211
|
+
return isNaN(b) ? 0 : b;
|
|
212
|
+
}
|
|
213
|
+
const Oe = /* @__PURE__ */ new Map();
|
|
214
|
+
function yl() {
|
|
215
|
+
Oe.clear();
|
|
216
|
+
}
|
|
217
|
+
function Bl(u, f, s, c) {
|
|
218
|
+
return Ln(u, f, s, c);
|
|
219
|
+
}
|
|
220
|
+
function Ln(u, f, s, c, r) {
|
|
221
|
+
if (Oe.has(u))
|
|
222
|
+
return NaN;
|
|
223
|
+
Oe.set(u, NaN);
|
|
224
|
+
const m = f[u];
|
|
225
|
+
if (!m)
|
|
226
|
+
return NaN;
|
|
227
|
+
const k = m.value;
|
|
228
|
+
if (!k.startsWith("=")) {
|
|
229
|
+
const g = parseFloat(k), h = isNaN(g) ? 0 : g;
|
|
230
|
+
return Oe.set(u, h), h;
|
|
231
|
+
}
|
|
232
|
+
const b = k.slice(1).trim();
|
|
233
|
+
if (b.toUpperCase().startsWith("SUM(") && b.endsWith(")")) {
|
|
234
|
+
const g = b.slice(4, -1).trim(), h = An(g, s, c);
|
|
235
|
+
if (h) {
|
|
236
|
+
let R = 0;
|
|
237
|
+
for (let O = h.sc; O <= h.ec; O++)
|
|
238
|
+
for (let H = h.sr; H <= h.er; H++)
|
|
239
|
+
R += Nn(O, H, f, s, c);
|
|
240
|
+
return isNaN(R) ? NaN : (Oe.set(u, R), R);
|
|
241
|
+
}
|
|
242
|
+
return NaN;
|
|
243
|
+
}
|
|
244
|
+
return NaN;
|
|
245
|
+
}
|
|
246
|
+
function xl(u, f, s) {
|
|
247
|
+
const c = [], r = /(\$?[A-Z]+\$?\d+)(?::(\$?[A-Z]+\$?\d+))?/gi;
|
|
248
|
+
let m;
|
|
249
|
+
for (; (m = r.exec(u)) !== null; ) {
|
|
250
|
+
const k = ht(m[1], f, s);
|
|
251
|
+
if (k)
|
|
252
|
+
if (m[2]) {
|
|
253
|
+
const b = ht(m[2], f, s);
|
|
254
|
+
if (!b)
|
|
255
|
+
continue;
|
|
256
|
+
for (let Y = Math.min(k.col, b.col); Y <= Math.max(k.col, b.col); Y++)
|
|
257
|
+
for (let g = Math.min(k.row, b.row); g <= Math.max(k.row, b.row); g++)
|
|
258
|
+
c.push(Xe(Y, g));
|
|
259
|
+
} else
|
|
260
|
+
c.push(Xe(k.col, k.row));
|
|
261
|
+
}
|
|
262
|
+
return c;
|
|
263
|
+
}
|
|
264
|
+
function Fn(u, f, s, c, r) {
|
|
265
|
+
const m = s[Xe(u, f)];
|
|
266
|
+
if (!m)
|
|
267
|
+
return "";
|
|
268
|
+
const k = m.value;
|
|
269
|
+
if (!k.startsWith("="))
|
|
270
|
+
return k;
|
|
271
|
+
const b = Bl(Xe(u, f), s, c, r);
|
|
272
|
+
return isNaN(b) ? "#ERROR" : String(b);
|
|
273
|
+
}
|
|
274
|
+
function On(u, f, s, c, r, m) {
|
|
275
|
+
return f === 0 && s === 0 ? u : u.replace(
|
|
276
|
+
/(\$?)([A-Z]+)(\$?)(\d+)/gi,
|
|
277
|
+
(k, b, Y, g, h) => {
|
|
278
|
+
const R = b ? Kt(Y) : Kt(Y) + f, O = g ? parseInt(h, 10) - 1 : parseInt(h, 10) - 1 + s;
|
|
279
|
+
let H;
|
|
280
|
+
R < 0 ? H = "A" : R >= c ? H = m(c - 1) : H = m(R);
|
|
281
|
+
let E;
|
|
282
|
+
return O < 0 ? E = "1" : O >= r ? E = String(r) : E = String(O + 1), (b || "") + H + (g || "") + E;
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
class Xn {
|
|
287
|
+
constructor() {
|
|
288
|
+
this.deps = /* @__PURE__ */ new Map(), this.rev = /* @__PURE__ */ new Map(), this.dirty = /* @__PURE__ */ new Set();
|
|
289
|
+
}
|
|
290
|
+
clear(f) {
|
|
291
|
+
var c;
|
|
292
|
+
const s = this.deps.get(f);
|
|
293
|
+
if (s) {
|
|
294
|
+
for (const r of s)
|
|
295
|
+
(c = this.rev.get(r)) == null || c.delete(f);
|
|
296
|
+
this.deps.delete(f);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
set(f, s) {
|
|
300
|
+
if (this.clear(f), s.length !== 0) {
|
|
301
|
+
this.deps.set(f, s);
|
|
302
|
+
for (const c of s)
|
|
303
|
+
this.rev.has(c) || this.rev.set(c, /* @__PURE__ */ new Set()), this.rev.get(c).add(f);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
markDirty(f) {
|
|
307
|
+
const s = [f];
|
|
308
|
+
for (; s.length > 0; ) {
|
|
309
|
+
const c = s.pop(), r = this.rev.get(c);
|
|
310
|
+
if (r)
|
|
311
|
+
for (const m of r)
|
|
312
|
+
this.dirty.has(m) || (this.dirty.add(m), s.push(m));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
getDirtyAndClear() {
|
|
316
|
+
const f = this.dirty;
|
|
317
|
+
return this.dirty = /* @__PURE__ */ new Set(), f;
|
|
318
|
+
}
|
|
319
|
+
/** 从 cells 快照重建所有依赖关系 */
|
|
320
|
+
rebuild(f, s, c) {
|
|
321
|
+
this.deps.clear(), this.rev.clear(), this.dirty.clear(), Oe.clear();
|
|
322
|
+
for (const [r, m] of Object.entries(f))
|
|
323
|
+
if (m.value.startsWith("=")) {
|
|
324
|
+
const k = xl(m.value.slice(1), s, c);
|
|
325
|
+
this.set(r, k);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function Yn(u, f, s, c) {
|
|
330
|
+
const r = {}, m = c(f), k = c(s);
|
|
331
|
+
return m != null && (r.width = `${m}px`), k != null && (r.height = `${k}px`), r["--sp-formula-bar-bg"] = u.formulaBarBg, r["--sp-formula-bar-border"] = u.formulaBarBorder, r["--sp-formula-bar-label-color"] = u.formulaBarLabelText, r["--sp-formula-bar-label-bg"] = u.formulaBarLabelBg, r["--sp-formula-bar-label-border"] = u.formulaBarLabelBorder, r["--sp-formula-bar-input-bg"] = u.formulaBarInputBg, r["--sp-formula-bar-input-border"] = u.formulaBarInputBorder, r["--sp-formula-bar-input-color"] = u.formulaBarInputText, r["--sp-formula-bar-input-focus-border"] = u.formulaBarInputFocusBorder, r["--sp-formula-bar-input-focus-shadow"] = u.formulaBarInputFocusShadow, r["--sp-wrapper-bg"] = u.wrapperBg, r["--sp-cell-editor-border"] = u.cellEditorBorder, r["--sp-cell-editor-color"] = u.cellEditorText, r["--sp-cell-editor-bg"] = u.cellEditorBg, r["--sp-cell-editor-shadow"] = u.cellEditorShadow, r["--sp-tab-bar-bg"] = u.tabBarBg, r["--sp-tab-bar-border"] = u.tabBarBorder, r["--sp-tab-active-bg"] = u.tabActiveBg, r["--sp-tab-active-color"] = u.tabActiveText, r["--sp-tab-active-border"] = u.tabActiveBorder, r["--sp-tab-inactive-bg"] = u.tabInactiveBg, r["--sp-tab-inactive-color"] = u.tabInactiveText, r["--sp-tab-inactive-border"] = u.tabInactiveBorder, r["--sp-tab-hover-bg"] = u.tabHoverBg, r["--sp-tab-add-btn-color"] = u.tabAddBtnColor, r["--sp-tab-add-btn-hover-bg"] = u.tabAddBtnHoverBg, r["--sp-tab-scroll-btn-color"] = u.tabScrollBtnColor, r["--sp-tab-scroll-btn-hover-bg"] = u.tabScrollBtnHoverBg, r["--sp-scroll-thumb"] = u.scrollbarThumb, r["--sp-scroll-thumb-hover"] = u.scrollbarThumbHover, r["--sp-scroll-btn-bg"] = u.scrollBtnBg, r["--sp-scroll-btn-color"] = u.scrollBtnColor, r["--sp-scroll-btn-hover-bg"] = u.scrollBtnHoverBg, r["--sp-scroll-btn-active-bg"] = u.scrollBtnActiveBg, r["--sp-scroll-track-bg"] = u.scrollTrackBg, r;
|
|
332
|
+
}
|
|
333
|
+
const Un = { class: "tab-list" }, jn = ["onClick", "onDblclick", "onContextmenu"], Kn = ["value"], Pn = {
|
|
334
|
+
key: 1,
|
|
335
|
+
class: "tab-item__name"
|
|
336
|
+
}, zn = ["title"], Vn = { class: "formula-bar" }, Jn = { class: "formula-bar__cell-label" }, Zn = ["value"], qn = ["value"], Gn = ["title"], Qn = ["title"], eo = ["title"], to = ["title"], lo = {
|
|
337
|
+
key: 2,
|
|
338
|
+
class: "sb-corner"
|
|
339
|
+
}, no = ["onClick", "onMouseenter"], oo = { class: "context-menu__label" }, ao = {
|
|
340
|
+
key: 0,
|
|
341
|
+
class: "context-menu__arrow"
|
|
342
|
+
}, ro = ["onClick"], uo = /* @__PURE__ */ kn({
|
|
343
|
+
__name: "spreader",
|
|
344
|
+
props: /* @__PURE__ */ _n({
|
|
345
|
+
rowCount: { default: 200 },
|
|
346
|
+
colCount: { default: 26 },
|
|
347
|
+
width: {},
|
|
348
|
+
height: {},
|
|
349
|
+
theme: { default: "light" },
|
|
350
|
+
locale: { default: "zh-CN" }
|
|
351
|
+
}, {
|
|
352
|
+
data: { default: () => [] },
|
|
353
|
+
dataModifiers: {}
|
|
354
|
+
}),
|
|
355
|
+
emits: ["update:data"],
|
|
356
|
+
setup(u) {
|
|
357
|
+
const f = u, s = I(() => f.locale === "zh-CN" ? "zh-CN" : "en-US"), c = f.colCount, r = f.rowCount, m = Rn(u, "data");
|
|
358
|
+
let k = "";
|
|
359
|
+
const b = wl({}), Y = new Xn(), g = N(null), h = N({ col: 0, row: 0 }), R = N(null), O = N(""), H = N(new Array(c).fill(Je)), E = N(new Array(r).fill(Ze)), M = N(0), T = N(0), he = I(() => {
|
|
360
|
+
const e = [0];
|
|
361
|
+
for (let t = 0; t < c; t++)
|
|
362
|
+
e.push(e[t] + H.value[t]);
|
|
363
|
+
return e;
|
|
364
|
+
}), pe = I(() => {
|
|
365
|
+
const e = [0];
|
|
366
|
+
for (let t = 0; t < r; t++)
|
|
367
|
+
e.push(e[t] + E.value[t]);
|
|
368
|
+
return e;
|
|
369
|
+
}), pt = I(() => he.value[c]), bt = I(() => pe.value[r]);
|
|
370
|
+
function ee(e, t) {
|
|
371
|
+
h.value = { col: e, row: t }, g.value = { startCol: e, startRow: t, endCol: e, endRow: t };
|
|
372
|
+
}
|
|
373
|
+
function te(e, t, n, l) {
|
|
374
|
+
h.value = { col: e, row: t }, g.value = {
|
|
375
|
+
startCol: Math.min(e, n),
|
|
376
|
+
startRow: Math.min(t, l),
|
|
377
|
+
endCol: Math.max(e, n),
|
|
378
|
+
endRow: Math.max(t, l)
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function mt() {
|
|
382
|
+
te(0, 0, c - 1, r - 1);
|
|
383
|
+
}
|
|
384
|
+
function Pt(e, t) {
|
|
385
|
+
const n = g.value;
|
|
386
|
+
return n ? e >= n.startCol && e <= n.endCol && t >= n.startRow && t <= n.endRow : !1;
|
|
387
|
+
}
|
|
388
|
+
function L(e, t) {
|
|
389
|
+
return `${e},${t}`;
|
|
390
|
+
}
|
|
391
|
+
function X(e) {
|
|
392
|
+
Reflect.deleteProperty(b, e);
|
|
393
|
+
}
|
|
394
|
+
function Re(e, t) {
|
|
395
|
+
var n;
|
|
396
|
+
return ((n = b[L(e, t)]) == null ? void 0 : n.value) ?? "";
|
|
397
|
+
}
|
|
398
|
+
function Cl(e, t) {
|
|
399
|
+
return yl(), Fn(e, t, b, c, r);
|
|
400
|
+
}
|
|
401
|
+
function Me(e, t, n) {
|
|
402
|
+
var d;
|
|
403
|
+
const l = L(e, t);
|
|
404
|
+
if (yl(), n === "" || n == null) {
|
|
405
|
+
Y.clear(l), X(l), Y.markDirty(l);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const o = String(n), a = ((d = b[l]) == null ? void 0 : d.style) ?? null;
|
|
409
|
+
b[l] = { value: o, style: a }, o.startsWith("=") ? Y.set(l, xl(o.slice(1), c, r)) : Y.clear(l), Y.markDirty(l);
|
|
410
|
+
}
|
|
411
|
+
function zt(e, t, n, l) {
|
|
412
|
+
for (let o = e; o <= t; o++)
|
|
413
|
+
for (let a = n; a <= l; a++) {
|
|
414
|
+
const d = L(o, a);
|
|
415
|
+
Y.clear(d), X(d), Y.markDirty(d);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function ve(e) {
|
|
419
|
+
R.value || (R.value = { ...h.value }, O.value = e ?? Re(h.value.col, h.value.row));
|
|
420
|
+
}
|
|
421
|
+
function be() {
|
|
422
|
+
R.value && (Me(R.value.col, R.value.row, O.value), R.value = null, O.value = "");
|
|
423
|
+
}
|
|
424
|
+
function me() {
|
|
425
|
+
R.value = null, O.value = "";
|
|
426
|
+
}
|
|
427
|
+
function ie(e, t) {
|
|
428
|
+
ee(
|
|
429
|
+
Math.max(0, Math.min(c - 1, h.value.col + e)),
|
|
430
|
+
Math.max(0, Math.min(r - 1, h.value.row + t))
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
function W(e, t) {
|
|
434
|
+
const n = Math.max(0, U.w - w - Q), l = Math.max(0, U.h - y - Q), o = he.value[e], a = pe.value[t], d = H.value[e], p = E.value[t];
|
|
435
|
+
let B = M.value, S = T.value;
|
|
436
|
+
o < B ? B = o : o + d > B + n && (B = o + d - n), a < S ? S = a : a + p > S + l && (S = a + p - l), z(B, S);
|
|
437
|
+
}
|
|
438
|
+
function le(e) {
|
|
439
|
+
const t = he.value;
|
|
440
|
+
if (e < 0 || e >= t[c])
|
|
441
|
+
return -1;
|
|
442
|
+
let n = 0, l = c - 1;
|
|
443
|
+
for (; n < l; ) {
|
|
444
|
+
const o = n + l + 1 >> 1;
|
|
445
|
+
t[o] <= e ? n = o : l = o - 1;
|
|
446
|
+
}
|
|
447
|
+
return n;
|
|
448
|
+
}
|
|
449
|
+
function ne(e) {
|
|
450
|
+
const t = pe.value;
|
|
451
|
+
if (e < 0 || e >= t[r])
|
|
452
|
+
return -1;
|
|
453
|
+
let n = 0, l = r - 1;
|
|
454
|
+
for (; n < l; ) {
|
|
455
|
+
const o = n + l + 1 >> 1;
|
|
456
|
+
t[o] <= e ? n = o : l = o - 1;
|
|
457
|
+
}
|
|
458
|
+
return n;
|
|
459
|
+
}
|
|
460
|
+
const de = N([]), qe = N([]);
|
|
461
|
+
function gt() {
|
|
462
|
+
const e = {};
|
|
463
|
+
for (const [t, n] of Object.entries(b))
|
|
464
|
+
e[t] = { value: n.value, style: n.style };
|
|
465
|
+
return { cells: e, colWidths: [...H.value], rowHeights: [...E.value] };
|
|
466
|
+
}
|
|
467
|
+
function Vt(e) {
|
|
468
|
+
Object.keys(b).forEach((t) => X(t)), Object.assign(b, e.cells), H.value = e.colWidths, E.value = e.rowHeights, Y.rebuild(b, c, r);
|
|
469
|
+
}
|
|
470
|
+
function K() {
|
|
471
|
+
const e = gt(), t = de.value[de.value.length - 1];
|
|
472
|
+
t && JSON.stringify(t) === JSON.stringify(e) || (de.value.push(e), qe.value = [], de.value.length > En && de.value.shift());
|
|
473
|
+
}
|
|
474
|
+
function Sl() {
|
|
475
|
+
de.value.length && (qe.value.push(gt()), Vt(de.value.pop()), g.value = null, v());
|
|
476
|
+
}
|
|
477
|
+
function kl() {
|
|
478
|
+
qe.value.length && (de.value.push(gt()), Vt(qe.value.pop()), g.value = null, v());
|
|
479
|
+
}
|
|
480
|
+
let Jt = null;
|
|
481
|
+
function Ge() {
|
|
482
|
+
const e = g.value;
|
|
483
|
+
if (!e)
|
|
484
|
+
return;
|
|
485
|
+
Jt = { ...e };
|
|
486
|
+
const t = [];
|
|
487
|
+
for (let n = e.startRow; n <= e.endRow; n++) {
|
|
488
|
+
const l = [];
|
|
489
|
+
for (let o = e.startCol; o <= e.endCol; o++)
|
|
490
|
+
l.push(Re(o, n));
|
|
491
|
+
t.push(l.join(" "));
|
|
492
|
+
}
|
|
493
|
+
jt(t.join(`
|
|
494
|
+
`));
|
|
495
|
+
}
|
|
496
|
+
function Qe() {
|
|
497
|
+
const e = g.value;
|
|
498
|
+
if (e) {
|
|
499
|
+
if (e.startCol === 0 && e.endCol === c - 1) {
|
|
500
|
+
const t = [];
|
|
501
|
+
for (let n = e.startRow; n <= e.endRow; n++) {
|
|
502
|
+
const l = [];
|
|
503
|
+
for (let o = 0; o < c; o++)
|
|
504
|
+
l.push(Re(o, n));
|
|
505
|
+
t.push(l.join(" "));
|
|
506
|
+
}
|
|
507
|
+
jt(t.join(`
|
|
508
|
+
`));
|
|
509
|
+
} else if (e.startRow === 0 && e.endRow === r - 1) {
|
|
510
|
+
const t = [];
|
|
511
|
+
for (let n = 0; n < r; n++) {
|
|
512
|
+
const l = [];
|
|
513
|
+
for (let o = e.startCol; o <= e.endCol; o++)
|
|
514
|
+
l.push(Re(o, n));
|
|
515
|
+
t.push(l.join(" "));
|
|
516
|
+
}
|
|
517
|
+
jt(t.join(`
|
|
518
|
+
`));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
async function Ye() {
|
|
523
|
+
let e = "";
|
|
524
|
+
try {
|
|
525
|
+
e = await navigator.clipboard.readText();
|
|
526
|
+
} catch {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (!e && e !== "")
|
|
530
|
+
return;
|
|
531
|
+
const t = e.split(/\r?\n/), n = h.value, l = Jt;
|
|
532
|
+
for (let o = 0; o < t.length; o++) {
|
|
533
|
+
const a = t[o].split(" ");
|
|
534
|
+
for (let d = 0; d < a.length; d++) {
|
|
535
|
+
const p = n.col + d, B = n.row + o;
|
|
536
|
+
if (p < c && B < r) {
|
|
537
|
+
let S = a[d];
|
|
538
|
+
S.startsWith("=") && l && (S = On(
|
|
539
|
+
S,
|
|
540
|
+
p - (l.startCol + d),
|
|
541
|
+
B - (l.startRow + o),
|
|
542
|
+
c,
|
|
543
|
+
r,
|
|
544
|
+
ce
|
|
545
|
+
)), Me(p, B, S);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function wt() {
|
|
551
|
+
if (Ge(), g.value) {
|
|
552
|
+
const e = g.value;
|
|
553
|
+
zt(e.startCol, e.endCol, e.startRow, e.endRow), v();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function yt() {
|
|
557
|
+
if (g.value) {
|
|
558
|
+
const e = g.value;
|
|
559
|
+
zt(e.startCol, e.endCol, e.startRow, e.endRow), v();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function Rl() {
|
|
563
|
+
const e = g.value;
|
|
564
|
+
if (!e)
|
|
565
|
+
return;
|
|
566
|
+
K();
|
|
567
|
+
const t = e.startCol, n = e.startRow, l = e.endCol, o = e.endRow;
|
|
568
|
+
if (n === o)
|
|
569
|
+
if (l + 1 < c) {
|
|
570
|
+
const a = `${ce(t)}${n + 1}:${ce(l)}${n + 1}`;
|
|
571
|
+
Me(l + 1, n, `=SUM(${a})`);
|
|
572
|
+
} else {
|
|
573
|
+
const a = `${ce(t)}${n + 1}:${ce(l - 1)}${n + 1}`;
|
|
574
|
+
Me(l, n, `=SUM(${a})`);
|
|
575
|
+
}
|
|
576
|
+
else
|
|
577
|
+
for (let a = t; a <= l; a++)
|
|
578
|
+
if (o + 1 < r) {
|
|
579
|
+
const d = `${ce(a)}${n + 1}:${ce(a)}${o + 1}`;
|
|
580
|
+
Me(a, o + 1, `=SUM(${d})`);
|
|
581
|
+
} else {
|
|
582
|
+
const d = `${ce(a)}${n + 1}:${ce(a)}${o}`;
|
|
583
|
+
Me(a, o, `=SUM(${d})`);
|
|
584
|
+
}
|
|
585
|
+
v(), A();
|
|
586
|
+
}
|
|
587
|
+
function Ml(e, t) {
|
|
588
|
+
const n = t - e + 1;
|
|
589
|
+
for (let l = e; l <= t; l++)
|
|
590
|
+
for (let o = 0; o < c; o++)
|
|
591
|
+
X(L(o, l));
|
|
592
|
+
for (let l = e; l < r - n; l++) {
|
|
593
|
+
for (let o = 0; o < c; o++) {
|
|
594
|
+
const a = L(o, l + n), d = L(o, l);
|
|
595
|
+
b[a] ? (b[d] = b[a], X(a)) : X(d);
|
|
596
|
+
}
|
|
597
|
+
E.value[l] = E.value[l + n];
|
|
598
|
+
}
|
|
599
|
+
for (let l = r - n; l < r; l++) {
|
|
600
|
+
for (let o = 0; o < c; o++)
|
|
601
|
+
X(L(o, l));
|
|
602
|
+
E.value[l] = Ze;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function Tl(e, t) {
|
|
606
|
+
const n = t - e + 1;
|
|
607
|
+
if (!(t >= r - 1)) {
|
|
608
|
+
for (let l = r - 1; l > t; l--) {
|
|
609
|
+
for (let o = 0; o < c; o++) {
|
|
610
|
+
const a = L(o, l - n), d = L(o, l);
|
|
611
|
+
b[a] ? b[d] = b[a] : X(d);
|
|
612
|
+
}
|
|
613
|
+
E.value[l] = E.value[l - n];
|
|
614
|
+
}
|
|
615
|
+
for (let l = t + 1; l <= t + n; l++) {
|
|
616
|
+
for (let o = 0; o < c; o++)
|
|
617
|
+
X(L(o, l));
|
|
618
|
+
E.value[l] = Ze;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
function Dl(e, t) {
|
|
623
|
+
const n = t - e + 1;
|
|
624
|
+
if (!(t >= c - 1)) {
|
|
625
|
+
for (let l = c - 1; l > t; l--) {
|
|
626
|
+
for (let o = 0; o < r; o++) {
|
|
627
|
+
const a = L(l - n, o), d = L(l, o);
|
|
628
|
+
b[a] ? b[d] = b[a] : X(d);
|
|
629
|
+
}
|
|
630
|
+
H.value[l] = H.value[l - n];
|
|
631
|
+
}
|
|
632
|
+
for (let l = t + 1; l <= t + n; l++) {
|
|
633
|
+
for (let o = 0; o < r; o++)
|
|
634
|
+
X(L(l, o));
|
|
635
|
+
H.value[l] = Je;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function Hl(e, t) {
|
|
640
|
+
const n = t - e + 1;
|
|
641
|
+
for (let l = e; l <= t; l++)
|
|
642
|
+
for (let o = 0; o < r; o++)
|
|
643
|
+
X(L(l, o));
|
|
644
|
+
for (let l = e; l < c - n; l++) {
|
|
645
|
+
for (let o = 0; o < r; o++) {
|
|
646
|
+
const a = L(l + n, o), d = L(l, o);
|
|
647
|
+
b[a] ? (b[d] = b[a], X(a)) : X(d);
|
|
648
|
+
}
|
|
649
|
+
H.value[l] = H.value[l + n];
|
|
650
|
+
}
|
|
651
|
+
for (let l = c - n; l < c; l++) {
|
|
652
|
+
for (let o = 0; o < r; o++)
|
|
653
|
+
X(L(l, o));
|
|
654
|
+
H.value[l] = Je;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
let Zt = 0;
|
|
658
|
+
function qt() {
|
|
659
|
+
return Zt++, `s_${Zt}`;
|
|
660
|
+
}
|
|
661
|
+
function et(e) {
|
|
662
|
+
return {
|
|
663
|
+
id: qt(),
|
|
664
|
+
name: e,
|
|
665
|
+
cells: {},
|
|
666
|
+
selection: { startCol: 0, startRow: 0, endCol: 0, endRow: 0 },
|
|
667
|
+
activeCell: { col: 0, row: 0 },
|
|
668
|
+
scrollX: 0,
|
|
669
|
+
scrollY: 0,
|
|
670
|
+
colWidths: new Array(c).fill(Je),
|
|
671
|
+
rowHeights: new Array(r).fill(Ze)
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
const D = N([et("Sheet1")]), Z = N(0);
|
|
675
|
+
function Ue() {
|
|
676
|
+
const e = D.value[Z.value];
|
|
677
|
+
e && (e.cells = { ...b }, e.selection = g.value ? { ...g.value } : null, e.activeCell = { ...h.value }, e.scrollX = M.value, e.scrollY = T.value, e.colWidths = [...H.value], e.rowHeights = [...E.value]);
|
|
678
|
+
}
|
|
679
|
+
function ge(e) {
|
|
680
|
+
const t = D.value[e];
|
|
681
|
+
t && (Object.keys(b).forEach((n) => X(n)), Object.assign(b, t.cells), g.value = t.selection ? { ...t.selection } : null, h.value = { ...t.activeCell }, M.value = t.scrollX, T.value = t.scrollY, H.value = [...t.colWidths], E.value = [...t.rowHeights], Z.value = e);
|
|
682
|
+
}
|
|
683
|
+
function _l(e) {
|
|
684
|
+
e === Z.value || e < 0 || e >= D.value.length || (me(), Ue(), ge(e));
|
|
685
|
+
}
|
|
686
|
+
function Bt(e) {
|
|
687
|
+
return me(), Ue(), D.value.push(et(`Sheet${D.value.length + 1}`)), ge(D.value.length - 1), D.value.length - 1;
|
|
688
|
+
}
|
|
689
|
+
function El(e) {
|
|
690
|
+
return D.value.length <= 1 || (me(), D.value.splice(e, 1), ge(Math.min(e, D.value.length - 1))), Z.value;
|
|
691
|
+
}
|
|
692
|
+
function $l(e, t) {
|
|
693
|
+
D.value[e] && t.trim() && (D.value[e].name = t.trim());
|
|
694
|
+
}
|
|
695
|
+
function Il(e) {
|
|
696
|
+
me(), Ue();
|
|
697
|
+
const t = D.value[e];
|
|
698
|
+
if (!t)
|
|
699
|
+
return e;
|
|
700
|
+
let n = t.name;
|
|
701
|
+
const l = n.match(/^(.*?)\s*\((\d+)\)$/);
|
|
702
|
+
let o = l ? parseInt(l[2], 10) + 1 : 2;
|
|
703
|
+
l && (n = l[1]);
|
|
704
|
+
let a = `${n} (${o})`;
|
|
705
|
+
const d = new Set(D.value.map((B) => B.name));
|
|
706
|
+
for (; d.has(a); )
|
|
707
|
+
o++, a = `${n} (${o})`;
|
|
708
|
+
const p = {
|
|
709
|
+
id: qt(),
|
|
710
|
+
name: a,
|
|
711
|
+
cells: { ...t.cells },
|
|
712
|
+
selection: t.selection ? { ...t.selection } : null,
|
|
713
|
+
activeCell: t.activeCell ? { ...t.activeCell } : { col: 0, row: 0 },
|
|
714
|
+
scrollX: t.scrollX,
|
|
715
|
+
scrollY: t.scrollY,
|
|
716
|
+
colWidths: [...t.colWidths],
|
|
717
|
+
rowHeights: [...t.rowHeights]
|
|
718
|
+
};
|
|
719
|
+
return D.value.splice(e + 1, 0, p), ge(e + 1), e + 1;
|
|
720
|
+
}
|
|
721
|
+
function Gt(e, t) {
|
|
722
|
+
const n = e + t;
|
|
723
|
+
if (n < 0 || n >= D.value.length)
|
|
724
|
+
return;
|
|
725
|
+
const l = Z.value, o = D.value.splice(e, 1)[0];
|
|
726
|
+
D.value.splice(n, 0, o), l === e ? Z.value = n : e < l && n >= l ? Z.value = l - 1 : e > l && n <= l && (Z.value = l + 1), v();
|
|
727
|
+
}
|
|
728
|
+
const Wl = I(() => D.value.length);
|
|
729
|
+
function A() {
|
|
730
|
+
Ue();
|
|
731
|
+
const e = D.value.map((n) => {
|
|
732
|
+
const l = {};
|
|
733
|
+
for (const [p, B] of Object.entries(n.cells))
|
|
734
|
+
l[p] = { value: B.value }, B.style && (l[p].style = B.style);
|
|
735
|
+
const o = { name: n.name, cells: l }, a = {};
|
|
736
|
+
for (let p = 0; p < n.colWidths.length; p++)
|
|
737
|
+
n.colWidths[p] !== 100 && (a[p] = n.colWidths[p]);
|
|
738
|
+
Object.keys(a).length && (o.colWidths = a);
|
|
739
|
+
const d = {};
|
|
740
|
+
for (let p = 0; p < n.rowHeights.length; p++)
|
|
741
|
+
n.rowHeights[p] !== 24 && (d[p] = n.rowHeights[p]);
|
|
742
|
+
return Object.keys(d).length && (o.rowHeights = d), o;
|
|
743
|
+
}), t = JSON.stringify(e);
|
|
744
|
+
t !== k && (k = t, m.value = e);
|
|
745
|
+
}
|
|
746
|
+
let xt = !1;
|
|
747
|
+
function Qt() {
|
|
748
|
+
xt || (xt = !0, Promise.resolve().then(() => {
|
|
749
|
+
xt = !1, A();
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
const el = I(() => f.theme === "dark" ? Wn : In), Al = I(() => Yn(el.value, f.width, f.height, Se)), we = N(null), oe = N(null), Ct = N(null), St = N(null), U = wl({ w: 800, h: 600 }), Te = I(() => Math.max(0, pt.value - Math.max(0, U.w - w - Q))), De = I(() => Math.max(0, bt.value - Math.max(0, U.h - y - Q)));
|
|
753
|
+
function z(e, t) {
|
|
754
|
+
const n = Math.max(0, U.w - w - Q), l = Math.max(0, U.h - y - Q);
|
|
755
|
+
M.value = Math.max(0, Math.min(e ?? M.value, Math.max(0, pt.value - n))), T.value = Math.max(0, Math.min(t ?? T.value, Math.max(0, bt.value - l)));
|
|
756
|
+
}
|
|
757
|
+
function Nl() {
|
|
758
|
+
var e;
|
|
759
|
+
return typeof window > "u" ? !1 : !((e = window.matchMedia) != null && e.call(window, "(hover: none) and (pointer: coarse)").matches);
|
|
760
|
+
}
|
|
761
|
+
function V(e = !1) {
|
|
762
|
+
J(() => {
|
|
763
|
+
const t = Ct.value;
|
|
764
|
+
if (t) {
|
|
765
|
+
if (!R.value && !Nl()) {
|
|
766
|
+
document.activeElement === t && t.blur();
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
t.focus(), e && t.select();
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
function Ll() {
|
|
774
|
+
V();
|
|
775
|
+
}
|
|
776
|
+
let kt = !1, i = null, je = 1;
|
|
777
|
+
function v() {
|
|
778
|
+
kt || (kt = !0, requestAnimationFrame(() => {
|
|
779
|
+
kt = !1, Fl();
|
|
780
|
+
}));
|
|
781
|
+
}
|
|
782
|
+
function Fl() {
|
|
783
|
+
const e = oe.value;
|
|
784
|
+
if (!e)
|
|
785
|
+
return;
|
|
786
|
+
const t = we.value;
|
|
787
|
+
if (!t || (i = e.getContext("2d"), !i))
|
|
788
|
+
return;
|
|
789
|
+
je = window.devicePixelRatio || 1;
|
|
790
|
+
const n = t.getBoundingClientRect(), l = n.width, o = n.height;
|
|
791
|
+
U.w = l, U.h = o, e.width = l * je, e.height = o * je, e.style.width = l + "px", e.style.height = o + "px", i.setTransform(je, 0, 0, je, 0, 0);
|
|
792
|
+
const a = M.value, d = T.value, p = w, B = y, S = el.value, Ft = he.value, Ot = pe.value, vl = H.value, dl = E.value, it = Math.max(0, le(a));
|
|
793
|
+
let hl = it;
|
|
794
|
+
for (let x = it; x < c && !(p + Ft[x] - a >= l); x++)
|
|
795
|
+
hl = x;
|
|
796
|
+
const pl = hl, ft = Math.max(0, ne(d));
|
|
797
|
+
let bl = ft;
|
|
798
|
+
for (let x = ft; x < r && !(B + Ot[x] - d >= o); x++)
|
|
799
|
+
bl = x;
|
|
800
|
+
const ml = bl;
|
|
801
|
+
i.fillStyle = S.bg, i.fillRect(0, 0, l, o), i.fillStyle = S.gridBg, i.fillRect(p, B, l - p, o - B), i.save(), i.beginPath(), i.rect(p + 0.5, B + 0.5, l - p - 1, o - B - 1), i.clip();
|
|
802
|
+
const G = g.value, Xt = R.value;
|
|
803
|
+
for (let x = ft; x <= ml; x++)
|
|
804
|
+
for (let _ = it; _ <= pl; _++) {
|
|
805
|
+
const F = p + Ft[_] - a, xe = B + Ot[x] - d, ze = vl[_], Le = dl[x];
|
|
806
|
+
if (!(F + ze < p || xe + Le < B || F > l || xe > o) && (Pt(_, x) && (i.fillStyle = S.selectionBg, i.fillRect(F, xe, ze, Le)), h.value.col === _ && h.value.row === x && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.strokeRect(F + 1, xe + 1, ze - 2, Le - 2)), i.strokeStyle = S.gridLine, i.lineWidth = 0.5, i.strokeRect(F + 0.25, xe + 0.25, ze - 0.5, Le - 0.5), !(Xt && Xt.col === _ && Xt.row === x))) {
|
|
807
|
+
const gl = Cl(_, x);
|
|
808
|
+
gl && (i.fillStyle = S.cellText, i.font = '13px -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif', i.textBaseline = "middle", i.save(), i.beginPath(), i.rect(F + 5, xe + 1, ze - 10, Le - 2), i.clip(), i.fillText(gl, F + 5, xe + Le / 2 + 0.5), i.restore());
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
i.restore(), i.fillStyle = S.headerBg, i.fillRect(p, 0, l - p, B);
|
|
812
|
+
for (let x = it; x <= pl; x++) {
|
|
813
|
+
const _ = p + Ft[x] - a, F = vl[x];
|
|
814
|
+
_ + F < p || _ > l || (G && x >= G.startCol && x <= G.endCol && (i.fillStyle = S.selectionBg, i.fillRect(_, 0, F, B)), i.strokeStyle = S.headerBorder, i.lineWidth = 0.5, i.strokeRect(_ + 0.25, 0.25, F - 0.5, B - 0.5), G && x >= G.startCol && x <= G.endCol && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.beginPath(), i.moveTo(_, B - 1), i.lineTo(_ + F, B - 1), i.stroke()), i.fillStyle = S.headerText, i.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', i.textAlign = "center", i.textBaseline = "middle", i.fillText(ce(x), _ + F / 2, B / 2));
|
|
815
|
+
}
|
|
816
|
+
i.strokeStyle = S.headerSep, i.lineWidth = 1, i.beginPath(), i.moveTo(p, B + 0.5), i.lineTo(l, B + 0.5), i.stroke(), i.fillStyle = S.headerBg, i.fillRect(0, B, p, o - B);
|
|
817
|
+
for (let x = ft; x <= ml; x++) {
|
|
818
|
+
const _ = B + Ot[x] - d, F = dl[x];
|
|
819
|
+
_ + F < B || _ > o || (G && x >= G.startRow && x <= G.endRow && (i.fillStyle = S.selectionBg, i.fillRect(0, _, p, F)), i.strokeStyle = S.headerBorder, i.lineWidth = 0.5, i.strokeRect(0.25, _ + 0.25, p - 0.5, F - 0.5), G && x >= G.startRow && x <= G.endRow && (i.strokeStyle = S.activeCellBorder, i.lineWidth = 2, i.beginPath(), i.moveTo(p - 1, _), i.lineTo(p - 1, _ + F), i.stroke()), i.fillStyle = S.headerText, i.font = '11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', i.textAlign = "center", i.textBaseline = "middle", i.fillText(String(x + 1), p / 2, _ + F / 2 + 0.5));
|
|
820
|
+
}
|
|
821
|
+
i.strokeStyle = S.headerSep, i.lineWidth = 1, i.beginPath(), i.moveTo(p + 0.5, B), i.lineTo(p + 0.5, o), i.stroke(), i.fillStyle = S.headerBg, i.fillRect(0, 0, p, B), i.strokeStyle = S.headerSep, i.lineWidth = 1, i.strokeRect(0.5, 0.5, p - 0.5, B - 0.5);
|
|
822
|
+
}
|
|
823
|
+
const Ol = I(() => ce(h.value.col) + String(h.value.row + 1)), Xl = I(() => R.value ? O.value : Re(h.value.col, h.value.row));
|
|
824
|
+
function Yl() {
|
|
825
|
+
R.value || (W(h.value.col, h.value.row), O.value = Re(h.value.col, h.value.row), ve(), v());
|
|
826
|
+
}
|
|
827
|
+
function Ul(e) {
|
|
828
|
+
O.value = e.target.value;
|
|
829
|
+
}
|
|
830
|
+
function jl(e) {
|
|
831
|
+
var t, n;
|
|
832
|
+
e.key === "Enter" ? (e.preventDefault(), be(), ie(0, 1), W(h.value.col, h.value.row), (t = St.value) == null || t.blur(), v(), V()) : e.key === "Escape" && (e.preventDefault(), me(), (n = St.value) == null || n.blur(), v(), V());
|
|
833
|
+
}
|
|
834
|
+
function Kl() {
|
|
835
|
+
setTimeout(() => {
|
|
836
|
+
R.value && (be(), v());
|
|
837
|
+
}, 0);
|
|
838
|
+
}
|
|
839
|
+
const ye = N(null), He = N("");
|
|
840
|
+
function Pl(e) {
|
|
841
|
+
ye.value === null && (_l(e), v());
|
|
842
|
+
}
|
|
843
|
+
function tl(e) {
|
|
844
|
+
e !== Z.value && (Ue(), ge(e), v()), ye.value = e, He.value = D.value[e].name, J(() => {
|
|
845
|
+
const t = document.querySelector(".tab-rename-input");
|
|
846
|
+
t == null || t.focus(), t == null || t.select();
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
function ll() {
|
|
850
|
+
ye.value !== null && ($l(ye.value, He.value), J(A)), ye.value = null, He.value = "";
|
|
851
|
+
}
|
|
852
|
+
function zl() {
|
|
853
|
+
ye.value = null, He.value = "";
|
|
854
|
+
}
|
|
855
|
+
function Vl(e) {
|
|
856
|
+
e.key === "Enter" ? (e.preventDefault(), ll()) : e.key === "Escape" && (e.preventDefault(), zl());
|
|
857
|
+
}
|
|
858
|
+
const fe = N(null);
|
|
859
|
+
let Ke = null;
|
|
860
|
+
function nl() {
|
|
861
|
+
Ke && (document.removeEventListener("click", Ke), Ke = null);
|
|
862
|
+
}
|
|
863
|
+
function _e(e, t, n) {
|
|
864
|
+
nl();
|
|
865
|
+
const l = 140, o = n.length * 28 + 8, a = window.innerWidth, d = window.innerHeight;
|
|
866
|
+
e + l > a && (e -= l), t + o > d && (t -= o), fe.value = { x: e, y: t, items: n }, Ke = () => {
|
|
867
|
+
fe.value = null, nl();
|
|
868
|
+
}, setTimeout(() => document.addEventListener("click", Ke, { once: !0 }), 0);
|
|
869
|
+
}
|
|
870
|
+
const tt = N(!1);
|
|
871
|
+
function Jl(e, t) {
|
|
872
|
+
if (!t.children) {
|
|
873
|
+
tt.value = !1;
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
const l = e.currentTarget.querySelector(".context-submenu");
|
|
877
|
+
if (!l) {
|
|
878
|
+
tt.value = !1;
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
const o = l.getBoundingClientRect();
|
|
882
|
+
tt.value = o.right > window.innerWidth;
|
|
883
|
+
}
|
|
884
|
+
function Zl(e, t) {
|
|
885
|
+
e.preventDefault(), e.stopPropagation(), _e(e.clientX, e.clientY, [
|
|
886
|
+
{
|
|
887
|
+
label: C(s.value, "insert"),
|
|
888
|
+
action: () => {
|
|
889
|
+
Bt(), v();
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
{ label: C(s.value, "copy"), action: () => {
|
|
893
|
+
Il(t);
|
|
894
|
+
} },
|
|
895
|
+
{ label: C(s.value, "rename"), action: () => {
|
|
896
|
+
tl(t);
|
|
897
|
+
} },
|
|
898
|
+
{
|
|
899
|
+
label: C(s.value, "delete"),
|
|
900
|
+
action: () => {
|
|
901
|
+
El(t), v();
|
|
902
|
+
},
|
|
903
|
+
disabled: Wl.value <= 1
|
|
904
|
+
},
|
|
905
|
+
{ label: C(s.value, "moveSheetLeft"), action: () => {
|
|
906
|
+
Gt(t, -1);
|
|
907
|
+
}, disabled: t === 0 },
|
|
908
|
+
{ label: C(s.value, "moveSheetRight"), action: () => {
|
|
909
|
+
Gt(t, 1);
|
|
910
|
+
}, disabled: t === D.value.length - 1 }
|
|
911
|
+
]);
|
|
912
|
+
}
|
|
913
|
+
function ql(e) {
|
|
914
|
+
e.preventDefault(), !(e.target.closest(".tab-item") || e.target.closest(".tab-bar__add-btn")) && _e(e.clientX, e.clientY, [
|
|
915
|
+
{
|
|
916
|
+
label: C(s.value, "insert"),
|
|
917
|
+
action: () => {
|
|
918
|
+
Bt(), v();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
]);
|
|
922
|
+
}
|
|
923
|
+
function Gl(e) {
|
|
924
|
+
e.preventDefault(), mt(), v(), _e(e.clientX, e.clientY, [
|
|
925
|
+
{
|
|
926
|
+
label: C(s.value, "cut"),
|
|
927
|
+
action: () => {
|
|
928
|
+
wt(), A();
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
{ label: C(s.value, "copy"), action: () => Ge() },
|
|
932
|
+
{
|
|
933
|
+
label: C(s.value, "paste"),
|
|
934
|
+
action: () => {
|
|
935
|
+
K(), Ye().then(() => {
|
|
936
|
+
v(), J(A);
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
{ label: C(s.value, "delete"), action: () => {
|
|
941
|
+
K(), yt();
|
|
942
|
+
for (let t = 0; t < c; t++)
|
|
943
|
+
H.value[t] = Je;
|
|
944
|
+
for (let t = 0; t < r; t++)
|
|
945
|
+
E.value[t] = Ze;
|
|
946
|
+
v(), A();
|
|
947
|
+
} }
|
|
948
|
+
]);
|
|
949
|
+
}
|
|
950
|
+
function Ql(e, t) {
|
|
951
|
+
e.preventDefault();
|
|
952
|
+
const n = g.value;
|
|
953
|
+
n && n.startCol === 0 && n.endCol === c - 1 && t >= n.startRow && t <= n.endRow || (te(0, t, c - 1, t), v());
|
|
954
|
+
const l = g.value;
|
|
955
|
+
_e(e.clientX, e.clientY, [
|
|
956
|
+
{
|
|
957
|
+
label: C(s.value, "insert"),
|
|
958
|
+
action: () => {
|
|
959
|
+
K(), Tl(l.startRow, l.endRow), v(), A();
|
|
960
|
+
},
|
|
961
|
+
disabled: l.endRow >= r - 1
|
|
962
|
+
},
|
|
963
|
+
{ label: C(s.value, "cut"), action: () => {
|
|
964
|
+
K(), Qe();
|
|
965
|
+
for (let o = l.startRow; o <= l.endRow; o++)
|
|
966
|
+
for (let a = 0; a < c; a++)
|
|
967
|
+
X(L(a, o));
|
|
968
|
+
v(), A();
|
|
969
|
+
} },
|
|
970
|
+
{ label: C(s.value, "copy"), action: () => Qe() },
|
|
971
|
+
{
|
|
972
|
+
label: C(s.value, "paste"),
|
|
973
|
+
action: () => {
|
|
974
|
+
K(), Ye().then(() => {
|
|
975
|
+
v(), J(A);
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
label: C(s.value, "delete"),
|
|
981
|
+
action: () => {
|
|
982
|
+
K(), Ml(l.startRow, l.endRow), v(), A();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
]);
|
|
986
|
+
}
|
|
987
|
+
function en(e, t) {
|
|
988
|
+
e.preventDefault();
|
|
989
|
+
const n = g.value;
|
|
990
|
+
n && n.startRow === 0 && n.endRow === r - 1 && t >= n.startCol && t <= n.endCol || (te(t, 0, t, r - 1), v());
|
|
991
|
+
const l = g.value;
|
|
992
|
+
_e(e.clientX, e.clientY, [
|
|
993
|
+
{
|
|
994
|
+
label: C(s.value, "insert"),
|
|
995
|
+
action: () => {
|
|
996
|
+
K(), Dl(l.startCol, l.endCol), v(), A();
|
|
997
|
+
},
|
|
998
|
+
disabled: l.endCol >= c - 1
|
|
999
|
+
},
|
|
1000
|
+
{ label: C(s.value, "cut"), action: () => {
|
|
1001
|
+
K(), Qe();
|
|
1002
|
+
for (let o = l.startCol; o <= l.endCol; o++)
|
|
1003
|
+
for (let a = 0; a < r; a++)
|
|
1004
|
+
X(L(o, a));
|
|
1005
|
+
v(), A();
|
|
1006
|
+
} },
|
|
1007
|
+
{ label: C(s.value, "copy"), action: () => Qe() },
|
|
1008
|
+
{
|
|
1009
|
+
label: C(s.value, "paste"),
|
|
1010
|
+
action: () => {
|
|
1011
|
+
K(), Ye().then(() => {
|
|
1012
|
+
v(), J(A);
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
label: C(s.value, "delete"),
|
|
1018
|
+
action: () => {
|
|
1019
|
+
K(), Hl(l.startCol, l.endCol), v(), A();
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
]);
|
|
1023
|
+
}
|
|
1024
|
+
function tn(e, t, n) {
|
|
1025
|
+
e.preventDefault(), Pt(t, n) || (ee(t, n), v());
|
|
1026
|
+
const l = g.value, o = !!(l && l.startCol === l.endCol && l.startRow === l.endRow);
|
|
1027
|
+
_e(e.clientX, e.clientY, [
|
|
1028
|
+
{
|
|
1029
|
+
label: C(s.value, "cut"),
|
|
1030
|
+
action: () => {
|
|
1031
|
+
wt(), A();
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
{ label: C(s.value, "copy"), action: () => Ge() },
|
|
1035
|
+
{
|
|
1036
|
+
label: C(s.value, "paste"),
|
|
1037
|
+
action: () => {
|
|
1038
|
+
K(), Ye().then(() => {
|
|
1039
|
+
v(), J(A);
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
label: C(s.value, "delete"),
|
|
1045
|
+
action: () => {
|
|
1046
|
+
K(), yt(), v(), A();
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
label: C(s.value, "calculate"),
|
|
1051
|
+
children: [
|
|
1052
|
+
{ label: C(s.value, "sum"), action: Rl, disabled: o }
|
|
1053
|
+
]
|
|
1054
|
+
}
|
|
1055
|
+
]);
|
|
1056
|
+
}
|
|
1057
|
+
const ln = I(() => {
|
|
1058
|
+
const e = !R.value, t = R.value ?? h.value, n = t.col, l = t.row;
|
|
1059
|
+
return {
|
|
1060
|
+
left: `${w + he.value[n] - M.value}px`,
|
|
1061
|
+
top: `${y + pe.value[l] - T.value}px`,
|
|
1062
|
+
width: `${H.value[n]}px`,
|
|
1063
|
+
height: `${E.value[l]}px`,
|
|
1064
|
+
opacity: e ? 0 : 1,
|
|
1065
|
+
pointerEvents: e ? "none" : "auto",
|
|
1066
|
+
color: e ? "transparent" : void 0,
|
|
1067
|
+
caretColor: e ? "transparent" : void 0,
|
|
1068
|
+
borderColor: e ? "transparent" : void 0,
|
|
1069
|
+
background: e ? "transparent" : void 0,
|
|
1070
|
+
boxShadow: e ? "none" : void 0
|
|
1071
|
+
};
|
|
1072
|
+
}), nn = I(() => Math.max(0, U.w - w - Q)), on = I(() => Math.max(0, U.h - y - Q)), lt = I(() => Math.max(0, nn.value - 11 * 2)), nt = I(() => Math.max(0, on.value - 11 * 2));
|
|
1073
|
+
function Rt() {
|
|
1074
|
+
return Math.max(0, U.w - w - Q);
|
|
1075
|
+
}
|
|
1076
|
+
function Mt() {
|
|
1077
|
+
return Math.max(0, U.h - y - Q);
|
|
1078
|
+
}
|
|
1079
|
+
const ot = I(() => Te.value <= 0 ? lt.value : Math.max(24, Rt() / pt.value * lt.value)), Tt = I(() => Te.value <= 0 ? 0 : M.value / Te.value * (lt.value - ot.value)), at = I(() => De.value <= 0 ? nt.value : Math.max(24, Mt() / bt.value * nt.value)), Dt = I(() => De.value <= 0 ? 0 : T.value / De.value * (nt.value - at.value));
|
|
1080
|
+
let Be = null, rt = 0, ut = 0;
|
|
1081
|
+
function an(e) {
|
|
1082
|
+
e.preventDefault(), Be = "v", rt = e.clientY, ut = T.value, document.addEventListener("mousemove", Ht), document.addEventListener("mouseup", _t);
|
|
1083
|
+
}
|
|
1084
|
+
function rn(e) {
|
|
1085
|
+
e.preventDefault(), Be = "h", rt = e.clientX, ut = M.value, document.addEventListener("mousemove", Ht), document.addEventListener("mouseup", _t);
|
|
1086
|
+
}
|
|
1087
|
+
function Ht(e) {
|
|
1088
|
+
if (Be === "v") {
|
|
1089
|
+
const n = (e.clientY - rt) / (nt.value - at.value);
|
|
1090
|
+
z(null, ut + n * De.value), v();
|
|
1091
|
+
} else if (Be === "h") {
|
|
1092
|
+
const n = (e.clientX - rt) / (lt.value - ot.value);
|
|
1093
|
+
z(ut + n * Te.value, null), v();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
function _t() {
|
|
1097
|
+
Be = null, document.removeEventListener("mousemove", Ht), document.removeEventListener("mouseup", _t);
|
|
1098
|
+
}
|
|
1099
|
+
function un(e) {
|
|
1100
|
+
if (Be)
|
|
1101
|
+
return;
|
|
1102
|
+
const t = e.currentTarget.getBoundingClientRect(), n = e.clientY - t.top;
|
|
1103
|
+
n < Dt.value ? z(null, T.value - Mt()) : n > Dt.value + at.value && z(null, T.value + Mt()), v();
|
|
1104
|
+
}
|
|
1105
|
+
function sn(e) {
|
|
1106
|
+
if (Be)
|
|
1107
|
+
return;
|
|
1108
|
+
const t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left;
|
|
1109
|
+
n < Tt.value ? z(M.value - Rt(), null) : n > Tt.value + ot.value && z(M.value + Rt(), null), v();
|
|
1110
|
+
}
|
|
1111
|
+
let Ee = !1, ae = 0, re = 0, $e = !1, Ie = !1, ol = 0, al = 0, We = 0, st = 0, Et = 0, $t = 0, rl = 0, ul = 0, Pe = !1, It = !1, Ae = 0, Ne = 0, Wt = 0, sl = -1, cl = -1;
|
|
1112
|
+
function cn(e) {
|
|
1113
|
+
if (e.button !== 0)
|
|
1114
|
+
return;
|
|
1115
|
+
e.preventDefault(), fe.value = null;
|
|
1116
|
+
const t = ke(e, oe.value);
|
|
1117
|
+
if (t.y < y && t.x >= w) {
|
|
1118
|
+
const o = t.x - w + M.value, a = le(o);
|
|
1119
|
+
if (a >= 0 && Math.abs(t.x - (w + he.value[a + 1] - M.value)) <= 4) {
|
|
1120
|
+
$e = !0, ol = a, We = H.value[a], st = o, v();
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
if (t.x < w && t.y >= y) {
|
|
1125
|
+
const o = t.y - y + T.value, a = ne(o);
|
|
1126
|
+
if (a >= 0 && Math.abs(t.y - (y + pe.value[a + 1] - T.value)) <= 4) {
|
|
1127
|
+
Ie = !0, al = a, We = E.value[a], st = o, v();
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
if (t.x < w || t.y < y) {
|
|
1132
|
+
if (t.y < y && t.x >= w) {
|
|
1133
|
+
const o = le(t.x - w + M.value);
|
|
1134
|
+
o >= 0 && (te(o, 0, o, r - 1), Ee = !0, ae = o, re = 0);
|
|
1135
|
+
} else if (t.x < w && t.y >= y) {
|
|
1136
|
+
const o = ne(t.y - y + T.value);
|
|
1137
|
+
o >= 0 && (te(0, o, c - 1, o), Ee = !0, ae = 0, re = o);
|
|
1138
|
+
} else
|
|
1139
|
+
t.x < w && t.y < y && mt();
|
|
1140
|
+
v();
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
|
|
1144
|
+
if (!(n < 0 || l < 0)) {
|
|
1145
|
+
if (be(), e.shiftKey && g.value) {
|
|
1146
|
+
const o = g.value;
|
|
1147
|
+
te(o.startCol, o.startRow, n, l);
|
|
1148
|
+
} else
|
|
1149
|
+
ee(n, l);
|
|
1150
|
+
Ee = !0, ae = n, re = l, V(), v();
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
function fn(e) {
|
|
1154
|
+
if ($e) {
|
|
1155
|
+
const a = ke(e, oe.value).x - w + M.value - st;
|
|
1156
|
+
We + a >= 30 && (H.value[ol] = We + a), v();
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
if (Ie) {
|
|
1160
|
+
const a = ke(e, oe.value).y - y + T.value - st;
|
|
1161
|
+
We + a >= 24 && (E.value[al] = We + a), v();
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
if (!Ee) {
|
|
1165
|
+
const o = oe.value;
|
|
1166
|
+
if (!o)
|
|
1167
|
+
return;
|
|
1168
|
+
const a = ke(e, o);
|
|
1169
|
+
if (a.y < y && a.x >= w) {
|
|
1170
|
+
const d = le(a.x - w + M.value);
|
|
1171
|
+
if (d >= 0 && Math.abs(a.x - (w + he.value[d + 1] - M.value)) <= 4) {
|
|
1172
|
+
o.style.cursor = "col-resize";
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
if (a.x < w && a.y >= y) {
|
|
1177
|
+
const d = ne(a.y - y + T.value);
|
|
1178
|
+
if (d >= 0 && Math.abs(a.y - (y + pe.value[d + 1] - T.value)) <= 4) {
|
|
1179
|
+
o.style.cursor = "row-resize";
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
o.style.cursor = "cell";
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const t = ke(e, oe.value);
|
|
1187
|
+
if (ae < 0 || re < 0)
|
|
1188
|
+
return;
|
|
1189
|
+
if (t.x < w || t.y < y) {
|
|
1190
|
+
if (t.y < y && t.x >= w) {
|
|
1191
|
+
const o = le(t.x - w + M.value);
|
|
1192
|
+
o >= 0 && te(Math.min(ae, o), 0, Math.max(ae, o), r - 1);
|
|
1193
|
+
} else if (t.x < w && t.y >= y) {
|
|
1194
|
+
const o = ne(t.y - y + T.value);
|
|
1195
|
+
o >= 0 && te(0, Math.min(re, o), c - 1, Math.max(re, o));
|
|
1196
|
+
}
|
|
1197
|
+
v();
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
|
|
1201
|
+
n < 0 || l < 0 || (re === 0 && ae >= 0 && g.value && g.value.startRow === 0 && g.value.endRow === r - 1 ? te(Math.min(ae, n), 0, Math.max(ae, n), r - 1) : ae === 0 && re >= 0 && g.value && g.value.startCol === 0 && g.value.endCol === c - 1 ? te(0, Math.min(re, l), c - 1, Math.max(re, l)) : te(ae, re, n, l), v());
|
|
1202
|
+
}
|
|
1203
|
+
function vn() {
|
|
1204
|
+
const e = $e || Ie;
|
|
1205
|
+
Ee = !1, $e = !1, Ie = !1, e && Qt();
|
|
1206
|
+
}
|
|
1207
|
+
function dn() {
|
|
1208
|
+
const e = $e || Ie;
|
|
1209
|
+
Ee = !1, $e = !1, Ie = !1, e && Qt();
|
|
1210
|
+
}
|
|
1211
|
+
function hn(e) {
|
|
1212
|
+
e.preventDefault();
|
|
1213
|
+
const t = ke(e, oe.value);
|
|
1214
|
+
if (t.x < w && t.y < y) {
|
|
1215
|
+
Gl(e);
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (t.y < y && t.x >= w) {
|
|
1219
|
+
const n = le(t.x - w + M.value);
|
|
1220
|
+
n >= 0 && en(e, n);
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
if (t.x < w && t.y >= y) {
|
|
1224
|
+
const n = ne(t.y - y + T.value);
|
|
1225
|
+
n >= 0 && Ql(e, n);
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
if (t.x >= w && t.y >= y) {
|
|
1229
|
+
const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
|
|
1230
|
+
n >= 0 && l >= 0 && tn(e, n, l);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
function pn(e) {
|
|
1234
|
+
const t = ke(e, oe.value);
|
|
1235
|
+
if (t.x < w || t.y < y)
|
|
1236
|
+
return;
|
|
1237
|
+
const n = le(t.x - w + M.value), l = ne(t.y - y + T.value);
|
|
1238
|
+
n < 0 || l < 0 || (ee(n, l), W(n, l), ve(), v(), V());
|
|
1239
|
+
}
|
|
1240
|
+
function bn(e) {
|
|
1241
|
+
z(M.value + e.deltaX, T.value + e.deltaY), v();
|
|
1242
|
+
}
|
|
1243
|
+
function mn(e) {
|
|
1244
|
+
if (e.touches.length !== 1) {
|
|
1245
|
+
Pe = !1;
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
const t = e.touches[0], n = oe.value;
|
|
1249
|
+
if (!n)
|
|
1250
|
+
return;
|
|
1251
|
+
const l = n.getBoundingClientRect(), o = t.clientX - l.left, a = t.clientY - l.top;
|
|
1252
|
+
o >= w && a >= y && (e.preventDefault(), Pe = !0, It = !1, Et = o, $t = a, rl = M.value, ul = T.value, Ae = le(o - w + M.value), Ne = ne(a - y + T.value));
|
|
1253
|
+
}
|
|
1254
|
+
function gn(e) {
|
|
1255
|
+
if (!Pe || e.touches.length !== 1)
|
|
1256
|
+
return;
|
|
1257
|
+
const t = e.touches[0], n = oe.value;
|
|
1258
|
+
if (!n)
|
|
1259
|
+
return;
|
|
1260
|
+
const l = n.getBoundingClientRect(), o = t.clientX - l.left, a = t.clientY - l.top;
|
|
1261
|
+
(Math.abs(o - Et) > 8 || Math.abs(a - $t) > 8) && (It = !0, e.preventDefault(), z(rl + (Et - o), ul + ($t - a)), v());
|
|
1262
|
+
}
|
|
1263
|
+
function wn() {
|
|
1264
|
+
if (Pe && (Pe = !1, !It && Ae >= 0 && Ne >= 0)) {
|
|
1265
|
+
const e = Date.now();
|
|
1266
|
+
Ae === sl && Ne === cl && e - Wt < 300 ? (ee(Ae, Ne), ve(), v(), V(), Wt = 0) : (be(), ee(Ae, Ne), v(), Wt = e), sl = Ae, cl = Ne, V();
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function At(e) {
|
|
1270
|
+
return e.isComposing || e.key === "Process" || e.keyCode === 229;
|
|
1271
|
+
}
|
|
1272
|
+
function il(e) {
|
|
1273
|
+
return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
1274
|
+
}
|
|
1275
|
+
function fl(e) {
|
|
1276
|
+
if (R.value)
|
|
1277
|
+
return;
|
|
1278
|
+
const t = e.ctrlKey || e.metaKey, n = e.shiftKey;
|
|
1279
|
+
switch (!0) {
|
|
1280
|
+
case (t && (e.key === "c" || e.key === "C")):
|
|
1281
|
+
e.preventDefault(), Ge();
|
|
1282
|
+
return;
|
|
1283
|
+
case (t && (e.key === "x" || e.key === "X")):
|
|
1284
|
+
e.preventDefault(), wt();
|
|
1285
|
+
return;
|
|
1286
|
+
case (t && (e.key === "z" || e.key === "Z")):
|
|
1287
|
+
e.preventDefault(), Sl();
|
|
1288
|
+
return;
|
|
1289
|
+
case (t && (e.key === "y" || e.key === "Y")):
|
|
1290
|
+
e.preventDefault(), kl();
|
|
1291
|
+
return;
|
|
1292
|
+
case (t && (e.key === "v" || e.key === "V")):
|
|
1293
|
+
e.preventDefault(), K(), Ye().then(() => {
|
|
1294
|
+
v(), J(A);
|
|
1295
|
+
});
|
|
1296
|
+
return;
|
|
1297
|
+
case (t && (e.key === "a" || e.key === "A")):
|
|
1298
|
+
e.preventDefault(), mt(), v();
|
|
1299
|
+
return;
|
|
1300
|
+
case (t && e.key === "Home"):
|
|
1301
|
+
e.preventDefault(), ee(0, 0), W(0, 0), v();
|
|
1302
|
+
return;
|
|
1303
|
+
case (t && e.key === "End"):
|
|
1304
|
+
e.preventDefault(), ee(c - 1, r - 1), W(c - 1, r - 1), v();
|
|
1305
|
+
return;
|
|
1306
|
+
case e.key === "Home":
|
|
1307
|
+
e.preventDefault(), ee(0, h.value.row), W(0, h.value.row), v();
|
|
1308
|
+
return;
|
|
1309
|
+
case e.key === "End":
|
|
1310
|
+
e.preventDefault(), ee(c - 1, h.value.row), W(c - 1, h.value.row), v();
|
|
1311
|
+
return;
|
|
1312
|
+
case e.key === "ArrowUp":
|
|
1313
|
+
e.preventDefault(), ie(0, -1), W(h.value.col, h.value.row), v();
|
|
1314
|
+
return;
|
|
1315
|
+
case e.key === "ArrowDown":
|
|
1316
|
+
e.preventDefault(), ie(0, 1), W(h.value.col, h.value.row), v();
|
|
1317
|
+
return;
|
|
1318
|
+
case e.key === "ArrowLeft":
|
|
1319
|
+
e.preventDefault(), ie(-1, 0), W(h.value.col, h.value.row), v();
|
|
1320
|
+
return;
|
|
1321
|
+
case e.key === "ArrowRight":
|
|
1322
|
+
e.preventDefault(), ie(1, 0), W(h.value.col, h.value.row), v();
|
|
1323
|
+
return;
|
|
1324
|
+
case e.key === "Tab":
|
|
1325
|
+
e.preventDefault(), ie(n ? -1 : 1, 0), W(h.value.col, h.value.row), v();
|
|
1326
|
+
return;
|
|
1327
|
+
case e.key === "Enter":
|
|
1328
|
+
e.preventDefault(), ie(0, n ? -1 : 1), W(h.value.col, h.value.row), v();
|
|
1329
|
+
return;
|
|
1330
|
+
case e.key === "F2":
|
|
1331
|
+
e.preventDefault(), W(h.value.col, h.value.row), ve(), v(), V();
|
|
1332
|
+
return;
|
|
1333
|
+
case e.key === "Delete":
|
|
1334
|
+
case e.key === "Backspace":
|
|
1335
|
+
e.preventDefault(), K(), yt(), v();
|
|
1336
|
+
return;
|
|
1337
|
+
case e.key === "Escape":
|
|
1338
|
+
e.preventDefault(), me(), v();
|
|
1339
|
+
return;
|
|
1340
|
+
case il(e):
|
|
1341
|
+
if (At(e)) {
|
|
1342
|
+
W(h.value.col, h.value.row), ve(""), v(), V();
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
e.preventDefault(), W(h.value.col, h.value.row), ve(e.key), v(), J(() => {
|
|
1346
|
+
const l = Ct.value;
|
|
1347
|
+
l && (l.focus(), l.setSelectionRange(1, 1));
|
|
1348
|
+
});
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
let Nt = !1, Lt = !1;
|
|
1353
|
+
function yn(e) {
|
|
1354
|
+
const t = e.target.value;
|
|
1355
|
+
if (!R.value) {
|
|
1356
|
+
W(h.value.col, h.value.row), ve(t), v();
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
O.value = t;
|
|
1360
|
+
}
|
|
1361
|
+
function Bn() {
|
|
1362
|
+
Nt = !0, R.value || (W(h.value.col, h.value.row), ve(""), v());
|
|
1363
|
+
}
|
|
1364
|
+
function xn(e) {
|
|
1365
|
+
Nt = !1, Lt = !0, setTimeout(() => {
|
|
1366
|
+
Lt = !1;
|
|
1367
|
+
}, 0), O.value = e.target.value;
|
|
1368
|
+
}
|
|
1369
|
+
function Cn(e) {
|
|
1370
|
+
if (!R.value) {
|
|
1371
|
+
if (il(e) || At(e))
|
|
1372
|
+
return;
|
|
1373
|
+
fl(e);
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
Nt || At(e) || Lt && (e.key === "Enter" || e.key === "Escape") || (e.key === "Enter" ? (e.preventDefault(), be(), ie(0, 1), W(h.value.col, h.value.row), v(), V()) : e.key === "Tab" ? (e.preventDefault(), be(), ie(e.shiftKey ? -1 : 1, 0), W(h.value.col, h.value.row), v(), V()) : e.key === "Escape" && (e.preventDefault(), me(), v(), V()));
|
|
1377
|
+
}
|
|
1378
|
+
function Sn() {
|
|
1379
|
+
setTimeout(() => {
|
|
1380
|
+
R.value && (be(), v());
|
|
1381
|
+
}, 0);
|
|
1382
|
+
}
|
|
1383
|
+
function ct() {
|
|
1384
|
+
var t;
|
|
1385
|
+
const e = (t = we.value) == null ? void 0 : t.getBoundingClientRect();
|
|
1386
|
+
if (e) {
|
|
1387
|
+
const n = Se(f.width), l = Se(f.height);
|
|
1388
|
+
n != null ? U.w = n : U.w = e.width, l != null ? U.h = l : U.h = e.height;
|
|
1389
|
+
}
|
|
1390
|
+
z(null, null), v();
|
|
1391
|
+
}
|
|
1392
|
+
let q = null;
|
|
1393
|
+
return Mn(() => {
|
|
1394
|
+
const e = Se(f.width), t = Se(f.height);
|
|
1395
|
+
(e == null || t == null) && (q = new ResizeObserver(() => ct()), we.value && q.observe(we.value)), J(() => {
|
|
1396
|
+
ct(), V();
|
|
1397
|
+
}), ee(0, 0), m.value && m.value.length > 0 && (k = JSON.stringify(m.value), D.value = m.value.map((n) => {
|
|
1398
|
+
const l = et(n.name);
|
|
1399
|
+
for (const [o, a] of Object.entries(n.cells))
|
|
1400
|
+
l.cells[o] = { value: a.value, style: a.style ?? null };
|
|
1401
|
+
if (n.colWidths)
|
|
1402
|
+
for (const [o, a] of Object.entries(n.colWidths)) {
|
|
1403
|
+
const d = Number(o);
|
|
1404
|
+
d >= 0 && d < c && a >= 30 && (l.colWidths[d] = a);
|
|
1405
|
+
}
|
|
1406
|
+
if (n.rowHeights)
|
|
1407
|
+
for (const [o, a] of Object.entries(n.rowHeights)) {
|
|
1408
|
+
const d = Number(o);
|
|
1409
|
+
d >= 0 && d < r && a >= 24 && (l.rowHeights[d] = a);
|
|
1410
|
+
}
|
|
1411
|
+
return l;
|
|
1412
|
+
}), D.value.length > 0 && ge(0));
|
|
1413
|
+
}), Ve(() => [f.width, f.height], () => {
|
|
1414
|
+
const e = Se(f.width), t = Se(f.height);
|
|
1415
|
+
e != null && t != null ? (q == null || q.disconnect(), q = null) : !q && we.value && (q = new ResizeObserver(() => ct()), q.observe(we.value)), J(() => ct());
|
|
1416
|
+
}), Ve(() => f.theme, () => v()), Ve(() => ({ ...b }), () => J(A), { deep: !1 }), Ve(Z, () => J(A)), Ve(() => m.value, (e) => {
|
|
1417
|
+
if (!e || e.length === 0)
|
|
1418
|
+
return;
|
|
1419
|
+
const t = JSON.stringify(e);
|
|
1420
|
+
t !== k && (k = t, D.value = e.map((n) => {
|
|
1421
|
+
const l = et(n.name);
|
|
1422
|
+
for (const [o, a] of Object.entries(n.cells))
|
|
1423
|
+
l.cells[o] = { value: a.value, style: a.style ?? null };
|
|
1424
|
+
if (n.colWidths)
|
|
1425
|
+
for (const [o, a] of Object.entries(n.colWidths)) {
|
|
1426
|
+
const d = Number(o);
|
|
1427
|
+
d >= 0 && d < c && a >= 30 && (l.colWidths[d] = a);
|
|
1428
|
+
}
|
|
1429
|
+
if (n.rowHeights)
|
|
1430
|
+
for (const [o, a] of Object.entries(n.rowHeights)) {
|
|
1431
|
+
const d = Number(o);
|
|
1432
|
+
d >= 0 && d < r && a >= 24 && (l.rowHeights[d] = a);
|
|
1433
|
+
}
|
|
1434
|
+
return l;
|
|
1435
|
+
}), D.value.length > 0 && ge(0), v());
|
|
1436
|
+
}, { deep: !0 }), Tn(() => {
|
|
1437
|
+
q == null || q.disconnect();
|
|
1438
|
+
}), (e, t) => (j(), P("div", {
|
|
1439
|
+
class: "spreadsheet-outer",
|
|
1440
|
+
style: Ce(Al.value)
|
|
1441
|
+
}, [
|
|
1442
|
+
$("div", {
|
|
1443
|
+
class: "tab-bar",
|
|
1444
|
+
onContextmenu: ql
|
|
1445
|
+
}, [
|
|
1446
|
+
$("div", Un, [
|
|
1447
|
+
(j(!0), P(Yt, null, Ut(D.value, (n, l) => (j(), P("div", {
|
|
1448
|
+
key: n.id,
|
|
1449
|
+
class: vt(["tab-item", { "tab-item--active": l === Z.value }]),
|
|
1450
|
+
onClick: (o) => Pl(l),
|
|
1451
|
+
onDblclick: ue((o) => tl(l), ["prevent"]),
|
|
1452
|
+
onContextmenu: (o) => Zl(o, l)
|
|
1453
|
+
}, [
|
|
1454
|
+
ye.value === l ? (j(), P("input", {
|
|
1455
|
+
key: 0,
|
|
1456
|
+
class: "tab-rename-input",
|
|
1457
|
+
value: He.value,
|
|
1458
|
+
onInput: t[0] || (t[0] = (o) => He.value = o.target.value),
|
|
1459
|
+
onKeydown: Vl,
|
|
1460
|
+
onBlur: ll,
|
|
1461
|
+
onClick: t[1] || (t[1] = ue(() => {
|
|
1462
|
+
}, ["stop"]))
|
|
1463
|
+
}, null, 40, Kn)) : (j(), P("span", Pn, dt(n.name), 1))
|
|
1464
|
+
], 42, jn))), 128))
|
|
1465
|
+
]),
|
|
1466
|
+
$("button", {
|
|
1467
|
+
class: "tab-bar__add-btn",
|
|
1468
|
+
title: se(C)(s.value, "addSheet"),
|
|
1469
|
+
onClick: t[2] || (t[2] = (n) => {
|
|
1470
|
+
Bt(), v();
|
|
1471
|
+
})
|
|
1472
|
+
}, " + ", 8, zn)
|
|
1473
|
+
], 32),
|
|
1474
|
+
$("div", Vn, [
|
|
1475
|
+
$("div", Jn, dt(Ol.value), 1),
|
|
1476
|
+
$("input", {
|
|
1477
|
+
ref_key: "formulaBarRef",
|
|
1478
|
+
ref: St,
|
|
1479
|
+
class: "formula-bar__input",
|
|
1480
|
+
value: Xl.value,
|
|
1481
|
+
onFocus: Yl,
|
|
1482
|
+
onInput: Ul,
|
|
1483
|
+
onKeydown: jl,
|
|
1484
|
+
onBlur: Kl
|
|
1485
|
+
}, null, 40, Zn)
|
|
1486
|
+
]),
|
|
1487
|
+
$("div", {
|
|
1488
|
+
ref_key: "wrapperRef",
|
|
1489
|
+
ref: we,
|
|
1490
|
+
class: "spreadsheet-wrapper"
|
|
1491
|
+
}, [
|
|
1492
|
+
$("canvas", {
|
|
1493
|
+
ref_key: "canvasRef",
|
|
1494
|
+
ref: oe,
|
|
1495
|
+
class: "grid-canvas",
|
|
1496
|
+
tabindex: "0",
|
|
1497
|
+
onMousedown: cn,
|
|
1498
|
+
onMousemove: fn,
|
|
1499
|
+
onMouseup: vn,
|
|
1500
|
+
onMouseleave: dn,
|
|
1501
|
+
onDblclick: pn,
|
|
1502
|
+
onWheel: ue(bn, ["prevent"]),
|
|
1503
|
+
onFocus: Ll,
|
|
1504
|
+
onKeydown: fl,
|
|
1505
|
+
onContextmenu: hn,
|
|
1506
|
+
onTouchstart: ue(mn, ["prevent"]),
|
|
1507
|
+
onTouchmove: ue(gn, ["prevent"]),
|
|
1508
|
+
onTouchend: wn
|
|
1509
|
+
}, null, 544),
|
|
1510
|
+
$("input", {
|
|
1511
|
+
ref_key: "editInputRef",
|
|
1512
|
+
ref: Ct,
|
|
1513
|
+
class: "cell-editor",
|
|
1514
|
+
value: O.value,
|
|
1515
|
+
style: Ce(ln.value),
|
|
1516
|
+
onInput: yn,
|
|
1517
|
+
onKeydown: Cn,
|
|
1518
|
+
onCompositionstart: Bn,
|
|
1519
|
+
onCompositionend: xn,
|
|
1520
|
+
onBlur: Sn
|
|
1521
|
+
}, null, 44, qn),
|
|
1522
|
+
De.value > 0 ? (j(), P("div", {
|
|
1523
|
+
key: 0,
|
|
1524
|
+
class: "v-scrollbar",
|
|
1525
|
+
style: Ce({ top: se(y) + "px", height: `calc(100% - ${se(y) + se(Q)}px)` })
|
|
1526
|
+
}, [
|
|
1527
|
+
$("button", {
|
|
1528
|
+
class: "sb-btn sb-btn--up",
|
|
1529
|
+
title: se(C)(s.value, "scrollUp"),
|
|
1530
|
+
onMousedown: t[3] || (t[3] = ue((n) => {
|
|
1531
|
+
z(null, T.value - 50), v();
|
|
1532
|
+
}, ["prevent"]))
|
|
1533
|
+
}, [...t[8] || (t[8] = [
|
|
1534
|
+
$("span", { class: "sb-arrow sb-arrow--up" }, null, -1)
|
|
1535
|
+
])], 40, Gn),
|
|
1536
|
+
$("div", {
|
|
1537
|
+
class: "sb-track sb-track--v",
|
|
1538
|
+
onMousedown: un
|
|
1539
|
+
}, [
|
|
1540
|
+
$("div", {
|
|
1541
|
+
class: "sb-thumb sb-thumb--v",
|
|
1542
|
+
style: Ce({ top: Dt.value + "px", height: at.value + "px" }),
|
|
1543
|
+
onMousedown: an
|
|
1544
|
+
}, null, 36)
|
|
1545
|
+
], 32),
|
|
1546
|
+
$("button", {
|
|
1547
|
+
class: "sb-btn sb-btn--down",
|
|
1548
|
+
title: se(C)(s.value, "scrollDown"),
|
|
1549
|
+
onMousedown: t[4] || (t[4] = ue((n) => {
|
|
1550
|
+
z(null, T.value + 50), v();
|
|
1551
|
+
}, ["prevent"]))
|
|
1552
|
+
}, [...t[9] || (t[9] = [
|
|
1553
|
+
$("span", { class: "sb-arrow sb-arrow--down" }, null, -1)
|
|
1554
|
+
])], 40, Qn)
|
|
1555
|
+
], 4)) : Fe("", !0),
|
|
1556
|
+
Te.value > 0 ? (j(), P("div", {
|
|
1557
|
+
key: 1,
|
|
1558
|
+
class: "h-scrollbar",
|
|
1559
|
+
style: Ce({ left: se(w) + "px", width: `calc(100% - ${se(w) + se(Q)}px)` })
|
|
1560
|
+
}, [
|
|
1561
|
+
$("button", {
|
|
1562
|
+
class: "sb-btn sb-btn--left",
|
|
1563
|
+
title: se(C)(s.value, "scrollLeft"),
|
|
1564
|
+
onMousedown: t[5] || (t[5] = ue((n) => {
|
|
1565
|
+
z(M.value - 50, null), v();
|
|
1566
|
+
}, ["prevent"]))
|
|
1567
|
+
}, [...t[10] || (t[10] = [
|
|
1568
|
+
$("span", { class: "sb-arrow sb-arrow--left" }, null, -1)
|
|
1569
|
+
])], 40, eo),
|
|
1570
|
+
$("div", {
|
|
1571
|
+
class: "sb-track sb-track--h",
|
|
1572
|
+
onMousedown: sn
|
|
1573
|
+
}, [
|
|
1574
|
+
$("div", {
|
|
1575
|
+
class: "sb-thumb sb-thumb--h",
|
|
1576
|
+
style: Ce({ left: Tt.value + "px", width: ot.value + "px" }),
|
|
1577
|
+
onMousedown: rn
|
|
1578
|
+
}, null, 36)
|
|
1579
|
+
], 32),
|
|
1580
|
+
$("button", {
|
|
1581
|
+
class: "sb-btn sb-btn--right",
|
|
1582
|
+
title: se(C)(s.value, "scrollRight"),
|
|
1583
|
+
onMousedown: t[6] || (t[6] = ue((n) => {
|
|
1584
|
+
z(M.value + 50, null), v();
|
|
1585
|
+
}, ["prevent"]))
|
|
1586
|
+
}, [...t[11] || (t[11] = [
|
|
1587
|
+
$("span", { class: "sb-arrow sb-arrow--right" }, null, -1)
|
|
1588
|
+
])], 40, to)
|
|
1589
|
+
], 4)) : Fe("", !0),
|
|
1590
|
+
Te.value > 0 && De.value > 0 ? (j(), P("div", lo)) : Fe("", !0)
|
|
1591
|
+
], 512),
|
|
1592
|
+
(j(), Dn(Hn, { to: "body" }, [
|
|
1593
|
+
fe.value ? (j(), P("div", {
|
|
1594
|
+
key: 0,
|
|
1595
|
+
class: "context-menu",
|
|
1596
|
+
style: Ce({ left: fe.value.x + "px", top: fe.value.y + "px" }),
|
|
1597
|
+
onClick: t[7] || (t[7] = ue(() => {
|
|
1598
|
+
}, ["stop"]))
|
|
1599
|
+
}, [
|
|
1600
|
+
(j(!0), P(Yt, null, Ut(fe.value.items, (n, l) => (j(), P("div", {
|
|
1601
|
+
key: l,
|
|
1602
|
+
class: vt(["context-menu__item", { "context-menu__item--disabled": n.disabled }]),
|
|
1603
|
+
onClick: (o) => !n.disabled && n.action && (n.action(), fe.value = null),
|
|
1604
|
+
onMouseenter: (o) => Jl(o, n)
|
|
1605
|
+
}, [
|
|
1606
|
+
$("span", oo, dt(n.label), 1),
|
|
1607
|
+
n.children ? (j(), P("span", ao)) : Fe("", !0),
|
|
1608
|
+
n.children ? (j(), P("div", {
|
|
1609
|
+
key: 1,
|
|
1610
|
+
class: vt(["context-submenu", { "context-submenu--left": tt.value }])
|
|
1611
|
+
}, [
|
|
1612
|
+
(j(!0), P(Yt, null, Ut(n.children, (o, a) => (j(), P("div", {
|
|
1613
|
+
key: a,
|
|
1614
|
+
class: vt(["context-menu__item", { "context-menu__item--disabled": o.disabled }]),
|
|
1615
|
+
onClick: ue((d) => !o.disabled && o.action && (o.action(), fe.value = null), ["stop"])
|
|
1616
|
+
}, dt(o.label), 11, ro))), 128))
|
|
1617
|
+
], 2)) : Fe("", !0)
|
|
1618
|
+
], 42, no))), 128))
|
|
1619
|
+
], 4)) : Fe("", !0)
|
|
1620
|
+
]))
|
|
1621
|
+
], 4));
|
|
1622
|
+
}
|
|
1623
|
+
}), so = (u, f) => {
|
|
1624
|
+
const s = u.__vccOpts || u;
|
|
1625
|
+
for (const [c, r] of f)
|
|
1626
|
+
s[c] = r;
|
|
1627
|
+
return s;
|
|
1628
|
+
}, io = /* @__PURE__ */ so(uo, [["__scopeId", "data-v-5100e6d6"]]);
|
|
1629
|
+
export {
|
|
1630
|
+
io as Spreader,
|
|
1631
|
+
io as default
|
|
1632
|
+
};
|