@nubisco/ui 5.57.0 → 5.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Spreadsheet-B6RYTbSl.cjs +4 -0
- package/dist/Spreadsheet-BDtrRHRe.js +1205 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +2 -2
- package/dist/component-styles.json +4 -0
- package/dist/components/Spreadsheet.cjs +1 -1
- package/dist/components/Spreadsheet.d.ts +22 -0
- package/dist/components/Spreadsheet.mjs +1 -1
- package/dist/components/Spreadsheet.vue.d.ts +31 -3
- package/dist/components/Spreadsheet.vue.d.ts.map +1 -1
- package/dist/composables/useNbStrings.composable.cjs +1 -1
- package/dist/composables/useNbStrings.composable.d.ts +15 -0
- package/dist/composables/useNbStrings.composable.d.ts.map +1 -1
- package/dist/composables/useNbStrings.composable.mjs +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{main-BIq8MyYB.js → main-0YVTG0l1.js} +1 -1
- package/dist/{main-T6vehYuf.cjs → main-B3vVWHCO.cjs} +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/Spreadsheet.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/Spreadsheet-BDkXKuLU.cjs +0 -4
- package/dist/Spreadsheet-Du_JiJDw.js +0 -869
|
@@ -0,0 +1,1205 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-C6QCLu9I.js";
|
|
2
|
+
import { t } from "./Icon-B2tiGiqZ.js";
|
|
3
|
+
import { useStableId as n } from "./composables/useStableId.composable.mjs";
|
|
4
|
+
import { usePhoneLayout as r } from "./composables/usePhoneLayout.composable.mjs";
|
|
5
|
+
import { useNbStrings as i } from "./composables/useNbStrings.composable.mjs";
|
|
6
|
+
import { t as a } from "./Menu-CWxBEMC4.js";
|
|
7
|
+
import { t as o } from "./MenuItem-DMYDHaa0.js";
|
|
8
|
+
import { t as s } from "./MenuDivider-DdwhPon9.js";
|
|
9
|
+
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as ee, createVNode as m, defineComponent as te, mergeModels as ne, nextTick as re, normalizeClass as ie, normalizeStyle as h, onBeforeUnmount as ae, onMounted as oe, openBlock as g, ref as _, renderList as se, renderSlot as ce, toDisplayString as le, unref as v, useModel as ue, useTemplateRef as de, vModelText as fe, watch as pe, withCtx as me, withDirectives as he, withModifiers as y } from "vue";
|
|
10
|
+
import * as ge from "@nubisco/ui/icons/arrow-down";
|
|
11
|
+
import * as _e from "@nubisco/ui/icons/arrow-up";
|
|
12
|
+
import * as ve from "@nubisco/ui/icons/arrows-down-up";
|
|
13
|
+
//#region src/components/Spreadsheet.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
var ye = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "nb-spreadsheet__toolbar"
|
|
17
|
+
}, be = [
|
|
18
|
+
"aria-label",
|
|
19
|
+
"aria-rowcount",
|
|
20
|
+
"aria-colcount",
|
|
21
|
+
"aria-activedescendant"
|
|
22
|
+
], xe = ["aria-rowindex"], Se = [
|
|
23
|
+
"aria-colindex",
|
|
24
|
+
"aria-sort",
|
|
25
|
+
"aria-label",
|
|
26
|
+
"data-header-col",
|
|
27
|
+
"data-header-row",
|
|
28
|
+
"onMousedown",
|
|
29
|
+
"onContextmenu"
|
|
30
|
+
], Ce = ["title"], we = ["title"], Te = [
|
|
31
|
+
"title",
|
|
32
|
+
"aria-label",
|
|
33
|
+
"onClick"
|
|
34
|
+
], Ee = ["title", "aria-label"], De = ["onMousedown"], Oe = ["aria-rowindex"], ke = ["onMousedown", "onContextmenu"], Ae = [
|
|
35
|
+
"title",
|
|
36
|
+
"aria-label",
|
|
37
|
+
"onClick"
|
|
38
|
+
], je = ["title", "aria-label"], Me = [
|
|
39
|
+
"id",
|
|
40
|
+
"aria-colindex",
|
|
41
|
+
"aria-selected",
|
|
42
|
+
"aria-readonly",
|
|
43
|
+
"title",
|
|
44
|
+
"data-cell",
|
|
45
|
+
"data-row",
|
|
46
|
+
"data-col",
|
|
47
|
+
"onMousedown",
|
|
48
|
+
"onMouseenter",
|
|
49
|
+
"onDblclick",
|
|
50
|
+
"onContextmenu"
|
|
51
|
+
], Ne = ["inputmode", "aria-label"], Pe = 20, Fe = 8, b = /* @__PURE__ */ e(/* @__PURE__ */ te({
|
|
52
|
+
__name: "Spreadsheet",
|
|
53
|
+
props: /* @__PURE__ */ ne({
|
|
54
|
+
columns: {},
|
|
55
|
+
rows: {},
|
|
56
|
+
cellAttrs: {},
|
|
57
|
+
computed: {},
|
|
58
|
+
resizable: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !0
|
|
61
|
+
},
|
|
62
|
+
rowReorderable: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
},
|
|
66
|
+
showGutter: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !0
|
|
69
|
+
},
|
|
70
|
+
gutterWidth: { default: 44 },
|
|
71
|
+
windowRows: { default: 80 },
|
|
72
|
+
locale: { default: "pt-PT" },
|
|
73
|
+
fit: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !1
|
|
76
|
+
},
|
|
77
|
+
size: { default: "sm" },
|
|
78
|
+
ariaLabel: { default: void 0 },
|
|
79
|
+
columnHeaders: { default: "label" },
|
|
80
|
+
contextMenu: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
hiddenColumns: { default: () => [] },
|
|
86
|
+
hiddenColumnsModifiers: {},
|
|
87
|
+
hiddenRows: { default: () => [] },
|
|
88
|
+
hiddenRowsModifiers: {}
|
|
89
|
+
}),
|
|
90
|
+
emits: /* @__PURE__ */ ne([
|
|
91
|
+
"commit",
|
|
92
|
+
"change",
|
|
93
|
+
"selection",
|
|
94
|
+
"focus",
|
|
95
|
+
"row-reorder",
|
|
96
|
+
"column-resize"
|
|
97
|
+
], ["update:hiddenColumns", "update:hiddenRows"]),
|
|
98
|
+
setup(e, { expose: te, emit: ne }) {
|
|
99
|
+
let b = e, x = ue(e, "hiddenColumns"), S = ue(e, "hiddenRows"), C = ne, w = i(), Ie = de("rootRef"), T = de("scrollerRef"), Le = de("editorRef"), Re = _({}), E = _(null), ze = n({}), D = _(null), O = _(null), Be = _(!1), k = _(null), Ve = _(0), He = _(0), Ue = "", We = _([]), Ge = _([]), A = l(() => {
|
|
100
|
+
let e = b.columns.filter((e) => e.pinned === "left"), t = b.columns.filter((e) => e.pinned === "right"), n = b.columns.filter((e) => !e.pinned);
|
|
101
|
+
return [
|
|
102
|
+
...e,
|
|
103
|
+
...n,
|
|
104
|
+
...t
|
|
105
|
+
];
|
|
106
|
+
}), Ke = l(() => new Set(x.value)), qe = l(() => new Set(S.value)), j = l(() => A.value.filter((e) => !Ke.value.has(e.id))), Je = l(() => A.value.filter((e) => Ke.value.has(e.id)).map((e) => e.id)), Ye = l(() => b.rows.filter((e) => qe.value.has(e.id)).map((e) => e.id)), Xe = l(() => new Map(A.value.map((e, t) => [e.id, Ze(t)])));
|
|
107
|
+
function Ze(e) {
|
|
108
|
+
let t = e + 1, n = "";
|
|
109
|
+
for (; t > 0;) {
|
|
110
|
+
let e = (t - 1) % 26;
|
|
111
|
+
n = String.fromCharCode(65 + e) + n, t = Math.floor((t - 1) / 26);
|
|
112
|
+
}
|
|
113
|
+
return n;
|
|
114
|
+
}
|
|
115
|
+
function Qe(e) {
|
|
116
|
+
return Xe.value.get(e) ?? "";
|
|
117
|
+
}
|
|
118
|
+
let M = l(() => {
|
|
119
|
+
let e = b.columnHeaders;
|
|
120
|
+
return e === "letters" ? ["letters"] : e === "both" ? ["letters", "label"] : ["label"];
|
|
121
|
+
}), $e = l(() => {
|
|
122
|
+
let e = /* @__PURE__ */ new Map(), t = [];
|
|
123
|
+
for (let n of A.value) Ke.value.has(n.id) ? t.push(n.id) : t.length && (e.set(n.id, t), t = []);
|
|
124
|
+
return e;
|
|
125
|
+
}), et = l(() => {
|
|
126
|
+
let e = [];
|
|
127
|
+
for (let t = A.value.length - 1; t >= 0; t--) {
|
|
128
|
+
let n = A.value[t];
|
|
129
|
+
if (!Ke.value.has(n.id)) break;
|
|
130
|
+
e.unshift(n.id);
|
|
131
|
+
}
|
|
132
|
+
return e;
|
|
133
|
+
}), tt = l(() => b.showGutter ? 1 : 0), N = l(() => new Map(b.rows.map((e) => [e.id, e]))), P = l(() => new Map(b.columns.map((e) => [e.id, e]))), F = l(() => new Map(j.value.map((e, t) => [e.id, t])));
|
|
134
|
+
function I(e) {
|
|
135
|
+
return Re.value[e.id] ?? e.width ?? 120;
|
|
136
|
+
}
|
|
137
|
+
let nt = {
|
|
138
|
+
xs: 24,
|
|
139
|
+
sm: 32,
|
|
140
|
+
md: 40,
|
|
141
|
+
lg: 48
|
|
142
|
+
}, rt = l(() => nt[b.size] ?? nt.sm), { phoneTouch: it } = r(), L = _(null), at = l(() => L.value ?? rt.value);
|
|
143
|
+
function ot() {
|
|
144
|
+
let e = Ie.value, t = T.value, n = H.value.length;
|
|
145
|
+
if (!b.fit || it.value || !e || !t || !n) {
|
|
146
|
+
L.value = null;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
let r = e.querySelector(".nb-spreadsheet__toolbar"), i = t.offsetHeight - t.clientHeight, a = e.clientHeight - (r?.offsetHeight ?? 0) - i, o = Math.floor((a - $t()) / n);
|
|
150
|
+
L.value = Math.min(rt.value, Math.max(Pe, o));
|
|
151
|
+
}
|
|
152
|
+
let st = null, ct = l(() => L.value === null ? void 0 : { "--nbss-row-height": `${L.value}px` }), lt = l(() => ({
|
|
153
|
+
gridTemplateColumns: (b.showGutter ? `${b.gutterWidth}px ` : "") + j.value.map((e) => b.fit && !e.pinned ? `minmax(${I(e)}px, 1fr)` : `${I(e)}px`).join(" "),
|
|
154
|
+
gridTemplateRows: M.value.length === 2 ? "var(--nbss-letter-height) var(--nbss-header-height)" : "var(--nbss-header-height)"
|
|
155
|
+
})), ut = _(/* @__PURE__ */ new Set()), dt = /* @__PURE__ */ new Map();
|
|
156
|
+
function ft() {
|
|
157
|
+
let e = T.value;
|
|
158
|
+
if (!e) return;
|
|
159
|
+
let t = [], n = !1, r = !1;
|
|
160
|
+
for (let i of b.columns) {
|
|
161
|
+
if (!i.shortLabel) continue;
|
|
162
|
+
let a = e.querySelector(`[data-header-col="${Zt(i.id)}"] .nb-spreadsheet__header-label`);
|
|
163
|
+
if (!a) continue;
|
|
164
|
+
let o = `${i.id}::${i.label}`;
|
|
165
|
+
ut.value.has(i.id) || dt.set(o, a.scrollWidth);
|
|
166
|
+
let s = dt.get(o);
|
|
167
|
+
if (s === void 0) {
|
|
168
|
+
r = !0;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
t.push(i.id), s > a.clientWidth && (n = !0);
|
|
172
|
+
}
|
|
173
|
+
ut.value = new Set(n ? t : []), r && re(ft);
|
|
174
|
+
}
|
|
175
|
+
pe(() => [b.columns, Re.value], () => void re(ft), { deep: !0 });
|
|
176
|
+
let R = l(() => {
|
|
177
|
+
let e = b.rows.filter((e) => !e.pinned);
|
|
178
|
+
if (!E.value) return e;
|
|
179
|
+
let t = P.value.get(E.value.columnId);
|
|
180
|
+
if (!t) return e;
|
|
181
|
+
let n = E.value.direction === "asc" ? 1 : -1, r = (e, t) => e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? (e - t) * n : String(e).localeCompare(String(t)) * n;
|
|
182
|
+
return [...e].sort((e, n) => r(e.values[t.id], n.values[t.id]));
|
|
183
|
+
}), pt = l(() => new Map(R.value.map((e, t) => [e.id, t + 1]))), z = (e) => !qe.value.has(e.id), B = l(() => R.value.filter(z)), V = l(() => b.rows.filter((e) => e.pinned === "top" && z(e))), mt = l(() => b.rows.filter((e) => e.pinned === "bottom" && z(e))), ht = l(() => {
|
|
184
|
+
let e = /* @__PURE__ */ new Map(), t = [];
|
|
185
|
+
for (let n of R.value) z(n) ? t.length && (e.set(n.id, t), t = []) : t.push(n.id);
|
|
186
|
+
return e;
|
|
187
|
+
}), gt = l(() => {
|
|
188
|
+
let e = [], t = R.value;
|
|
189
|
+
for (let n = t.length - 1; n >= 0 && !z(t[n]); n--) e.unshift(t[n].id);
|
|
190
|
+
return e;
|
|
191
|
+
}), _t = l(() => B.value[B.value.length - 1]?.id), H = l(() => [
|
|
192
|
+
...V.value,
|
|
193
|
+
...B.value,
|
|
194
|
+
...mt.value
|
|
195
|
+
]), U = l(() => new Map(H.value.map((e, t) => [e.id, t]))), vt = l(() => {
|
|
196
|
+
let e = Math.max(1, Math.ceil((T.value?.clientHeight ?? 600) / at.value)), t = Math.max(10, Math.floor(b.windowRows / 4)), n = Math.floor(Ve.value / at.value) - V.value.length - t, r = Math.max(0, n), i = Math.min(B.value.length, r + e + t * 2), a = V.value.map((e, t) => ({
|
|
197
|
+
...e,
|
|
198
|
+
__virtualIndex: t,
|
|
199
|
+
gutterLabel: ""
|
|
200
|
+
})), o = B.value.slice(r, i).map((e, t) => ({
|
|
201
|
+
...e,
|
|
202
|
+
__virtualIndex: r + t + V.value.length
|
|
203
|
+
})), s = mt.value.map((e, t) => ({
|
|
204
|
+
...e,
|
|
205
|
+
__virtualIndex: V.value.length + B.value.length + t,
|
|
206
|
+
gutterLabel: ""
|
|
207
|
+
}));
|
|
208
|
+
return [
|
|
209
|
+
...a,
|
|
210
|
+
...o,
|
|
211
|
+
...s
|
|
212
|
+
];
|
|
213
|
+
});
|
|
214
|
+
function yt(e, t) {
|
|
215
|
+
if (t == null || t === "") return "";
|
|
216
|
+
if (e.type === "number") {
|
|
217
|
+
let e = typeof t == "number" ? t : Number(t);
|
|
218
|
+
return Number.isFinite(e) ? new Intl.NumberFormat(b.locale, { maximumFractionDigits: 4 }).format(e) : String(t);
|
|
219
|
+
}
|
|
220
|
+
if (e.type === "date") {
|
|
221
|
+
let e = t instanceof Date ? t : new Date(t);
|
|
222
|
+
return Number.isNaN(e.getTime()) ? String(t) : new Intl.DateTimeFormat(b.locale).format(e);
|
|
223
|
+
}
|
|
224
|
+
return String(t);
|
|
225
|
+
}
|
|
226
|
+
function bt(e, t) {
|
|
227
|
+
if (t === "") return null;
|
|
228
|
+
if (e.type === "number") {
|
|
229
|
+
let e = t.replace(/\s/g, "").replace(",", "."), n = Number(e);
|
|
230
|
+
if (!Number.isFinite(n)) throw Error("Invalid number");
|
|
231
|
+
return n;
|
|
232
|
+
}
|
|
233
|
+
if (e.type === "date") {
|
|
234
|
+
let e = new Date(t);
|
|
235
|
+
if (Number.isNaN(e.getTime())) throw Error("Invalid date");
|
|
236
|
+
return e.toISOString().slice(0, 10);
|
|
237
|
+
}
|
|
238
|
+
return t;
|
|
239
|
+
}
|
|
240
|
+
function W(e, t) {
|
|
241
|
+
let n = N.value.get(e);
|
|
242
|
+
if (!n) return;
|
|
243
|
+
let r = n.values[t];
|
|
244
|
+
if (r !== void 0) return r;
|
|
245
|
+
if (b.computed) return b.computed(e, t, W);
|
|
246
|
+
}
|
|
247
|
+
function xt(e, t) {
|
|
248
|
+
return b.cellAttrs ? b.cellAttrs(e.id, t.id, e, t) ?? {} : {};
|
|
249
|
+
}
|
|
250
|
+
function St(e, t) {
|
|
251
|
+
let n = xt(e, t);
|
|
252
|
+
if (n.display !== void 0) return n.display;
|
|
253
|
+
let r = W(e.id, t.id);
|
|
254
|
+
return t.format ? t.format(r, e) : yt(t, r);
|
|
255
|
+
}
|
|
256
|
+
function Ct(e, t) {
|
|
257
|
+
let n = xt(e, t), r = D.value?.rowId === e.id && D.value?.columnId === t.id, i = Lt(e.id, t.id);
|
|
258
|
+
return {
|
|
259
|
+
[`nb-spreadsheet__cell--${t.align ?? (t.type === "number" || t.type === "date" ? "right" : "left")}`]: !0,
|
|
260
|
+
"nb-spreadsheet__cell--focused": r,
|
|
261
|
+
"nb-spreadsheet__cell--selected": i,
|
|
262
|
+
"nb-spreadsheet__cell--readonly": G(e, t),
|
|
263
|
+
"nb-spreadsheet__cell--computed": !!n.computed || !!e.computed,
|
|
264
|
+
"nb-spreadsheet__cell--pinned-top": e.pinned === "top",
|
|
265
|
+
"nb-spreadsheet__cell--pinned-bottom": e.pinned === "bottom",
|
|
266
|
+
[n.className ?? ""]: !!n.className,
|
|
267
|
+
[e.className ?? ""]: !!e.className
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function G(e, t) {
|
|
271
|
+
if (e.computed || t.readOnly) return !0;
|
|
272
|
+
let n = xt(e, t);
|
|
273
|
+
return !!n.readOnly || !!n.computed;
|
|
274
|
+
}
|
|
275
|
+
function wt(e, t) {
|
|
276
|
+
return xt(e, t).tooltip ?? "";
|
|
277
|
+
}
|
|
278
|
+
function Tt(e, t) {
|
|
279
|
+
return `${ze}-r${U.value.get(e)}-c${F.value.get(t)}`;
|
|
280
|
+
}
|
|
281
|
+
let Et = l(() => D.value ? Tt(D.value.rowId, D.value.columnId) : void 0);
|
|
282
|
+
function Dt(e, t, n) {
|
|
283
|
+
let r = K.value;
|
|
284
|
+
return {
|
|
285
|
+
"nb-spreadsheet__header--letters": n === "letters",
|
|
286
|
+
"nb-spreadsheet__header--stacked": M.value.length === 2,
|
|
287
|
+
"nb-spreadsheet__header--sortable": n === "label" && !!e.sortable,
|
|
288
|
+
"nb-spreadsheet__header--sorted": E.value?.columnId === e.id,
|
|
289
|
+
"nb-spreadsheet__header--selected": !!r && t >= r.c1 && t <= r.c2,
|
|
290
|
+
"nb-spreadsheet__header--pinned-left": e.pinned === "left",
|
|
291
|
+
"nb-spreadsheet__header--pinned-right": e.pinned === "right",
|
|
292
|
+
"nb-spreadsheet__header--last": t === j.value.length - 1
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function Ot(e) {
|
|
296
|
+
if (e.sortable) return E.value?.columnId === e.id ? E.value.direction === "asc" ? "ascending" : "descending" : "none";
|
|
297
|
+
}
|
|
298
|
+
function kt(e) {
|
|
299
|
+
return E.value?.columnId === e.id ? E.value.direction === "asc" ? _e : ge : ve;
|
|
300
|
+
}
|
|
301
|
+
function At(e) {
|
|
302
|
+
if (e.pinned !== "left") return 0;
|
|
303
|
+
let t = b.showGutter ? b.gutterWidth : 0;
|
|
304
|
+
for (let n of j.value) {
|
|
305
|
+
if (n.id === e.id) break;
|
|
306
|
+
n.pinned === "left" && (t += I(n));
|
|
307
|
+
}
|
|
308
|
+
return t;
|
|
309
|
+
}
|
|
310
|
+
function jt(e) {
|
|
311
|
+
if (e.pinned !== "right") return 0;
|
|
312
|
+
let t = 0, n = [...j.value].reverse();
|
|
313
|
+
for (let r of n) {
|
|
314
|
+
if (r.id === e.id) break;
|
|
315
|
+
r.pinned === "right" && (t += I(r));
|
|
316
|
+
}
|
|
317
|
+
return t;
|
|
318
|
+
}
|
|
319
|
+
function Mt(e, t, n) {
|
|
320
|
+
let r = tt.value + 1 + t, i = { top: n === 0 ? "0" : "var(--nbss-letter-height)" };
|
|
321
|
+
return e.pinned === "left" ? (i.position = "sticky", i.left = `${At(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${jt(e)}px`, i.zIndex = "3"), {
|
|
322
|
+
gridRow: n + 1,
|
|
323
|
+
gridColumn: r,
|
|
324
|
+
...i
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function Nt(e, t, n) {
|
|
328
|
+
let r = tt.value + 1 + n, i = e.__virtualIndex + 1 + M.value.length, a = {};
|
|
329
|
+
return t.pinned === "left" ? (a.position = "sticky", a.left = `${At(t)}px`, a.zIndex = "2") : t.pinned === "right" && (a.position = "sticky", a.right = `${jt(t)}px`, a.zIndex = "2"), (e.pinned === "top" || e.pinned === "bottom") && (a.position = "sticky", a.zIndex = String(Math.max(Number(a.zIndex ?? 0), 2)), Object.assign(a, Pt(e))), {
|
|
330
|
+
gridRow: i,
|
|
331
|
+
gridColumn: r,
|
|
332
|
+
...a
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function Pt(e) {
|
|
336
|
+
if (e.pinned === "top") {
|
|
337
|
+
let t = V.value.findIndex((t) => t.id === e.id);
|
|
338
|
+
return { top: `calc(var(--nbss-head-height) + var(--nbss-row-height) * ${Math.max(0, t)})` };
|
|
339
|
+
}
|
|
340
|
+
if (e.pinned === "bottom") {
|
|
341
|
+
let t = mt.value, n = t.findIndex((t) => t.id === e.id);
|
|
342
|
+
return { bottom: `calc(var(--nbss-row-height) * ${Math.max(0, t.length - 1 - n)})` };
|
|
343
|
+
}
|
|
344
|
+
return {};
|
|
345
|
+
}
|
|
346
|
+
function Ft(e) {
|
|
347
|
+
return e.label === void 0 ? e.gutterLabel === void 0 ? String(pt.value.get(e.id) ?? "") : e.gutterLabel : e.label;
|
|
348
|
+
}
|
|
349
|
+
function It(e) {
|
|
350
|
+
let t = {
|
|
351
|
+
position: "sticky",
|
|
352
|
+
left: "0",
|
|
353
|
+
zIndex: "2"
|
|
354
|
+
};
|
|
355
|
+
return e.pinned && (Object.assign(t, Pt(e)), t.zIndex = "4"), {
|
|
356
|
+
gridRow: e.__virtualIndex + 1 + M.value.length,
|
|
357
|
+
gridColumn: 1,
|
|
358
|
+
...t
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
let K = l(() => {
|
|
362
|
+
let e = O.value;
|
|
363
|
+
if (!e) return null;
|
|
364
|
+
let t = U.value.get(e.startRowId) ?? -1, n = U.value.get(e.endRowId) ?? -1, r = F.value.get(e.startColumnId) ?? -1, i = F.value.get(e.endColumnId) ?? -1;
|
|
365
|
+
return t < 0 || n < 0 || r < 0 || i < 0 ? null : {
|
|
366
|
+
r1: Math.min(t, n),
|
|
367
|
+
r2: Math.max(t, n),
|
|
368
|
+
c1: Math.min(r, i),
|
|
369
|
+
c2: Math.max(r, i)
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
function Lt(e, t) {
|
|
373
|
+
let n = K.value;
|
|
374
|
+
if (!n) return !1;
|
|
375
|
+
let r = U.value.get(e) ?? -1, i = F.value.get(t) ?? -1;
|
|
376
|
+
return r >= n.r1 && r <= n.r2 && i >= n.c1 && i <= n.c2;
|
|
377
|
+
}
|
|
378
|
+
function Rt(e) {
|
|
379
|
+
let t = K.value;
|
|
380
|
+
if (!t) return !1;
|
|
381
|
+
let n = U.value.get(e) ?? -1;
|
|
382
|
+
return n >= t.r1 && n <= t.r2;
|
|
383
|
+
}
|
|
384
|
+
function q(e, t, n = !1) {
|
|
385
|
+
D.value = {
|
|
386
|
+
rowId: e,
|
|
387
|
+
columnId: t
|
|
388
|
+
}, n && O.value ? O.value = {
|
|
389
|
+
...O.value,
|
|
390
|
+
endRowId: e,
|
|
391
|
+
endColumnId: t
|
|
392
|
+
} : O.value = {
|
|
393
|
+
startRowId: e,
|
|
394
|
+
startColumnId: t,
|
|
395
|
+
endRowId: e,
|
|
396
|
+
endColumnId: t
|
|
397
|
+
}, C("focus", D.value), C("selection", O.value);
|
|
398
|
+
}
|
|
399
|
+
function zt(e, t, n) {
|
|
400
|
+
D.value = {
|
|
401
|
+
rowId: e,
|
|
402
|
+
columnId: t
|
|
403
|
+
}, O.value = n, C("focus", D.value), C("selection", O.value);
|
|
404
|
+
}
|
|
405
|
+
function Bt(e, t = !1) {
|
|
406
|
+
let n = H.value;
|
|
407
|
+
if (!n.length) return;
|
|
408
|
+
let r = t && O.value ? O.value.startColumnId : e;
|
|
409
|
+
zt(n[0].id, r, {
|
|
410
|
+
startRowId: n[0].id,
|
|
411
|
+
startColumnId: r,
|
|
412
|
+
endRowId: n[n.length - 1].id,
|
|
413
|
+
endColumnId: e
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
function Vt(e, t = !1) {
|
|
417
|
+
let n = j.value;
|
|
418
|
+
if (!n.length) return;
|
|
419
|
+
let r = t && O.value ? O.value.startRowId : e;
|
|
420
|
+
zt(r, n[0].id, {
|
|
421
|
+
startRowId: r,
|
|
422
|
+
startColumnId: n[0].id,
|
|
423
|
+
endRowId: e,
|
|
424
|
+
endColumnId: n[n.length - 1].id
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function Ht() {
|
|
428
|
+
let e = H.value, t = j.value;
|
|
429
|
+
!e.length || !t.length || zt(e[0].id, t[0].id, {
|
|
430
|
+
startRowId: e[0].id,
|
|
431
|
+
startColumnId: t[0].id,
|
|
432
|
+
endRowId: e[e.length - 1].id,
|
|
433
|
+
endColumnId: t[t.length - 1].id
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function Ut(e) {
|
|
437
|
+
Ue = e.pointerType;
|
|
438
|
+
}
|
|
439
|
+
function Wt(e, t, n) {
|
|
440
|
+
if (e.button === 2) {
|
|
441
|
+
Ue = "";
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
let r = Ue === "touch" && !e.shiftKey && D.value?.rowId === t.id && D.value?.columnId === n.id;
|
|
445
|
+
if (Ue = "", k.value && X(), Be.value = !0, q(t.id, n.id, e.shiftKey), J(), e.preventDefault(), document.addEventListener("mouseup", Kt, { once: !0 }), r && !G(t, n)) {
|
|
446
|
+
let e = W(t.id, n.id);
|
|
447
|
+
cn(t, n, e == null ? "" : String(e), "edit");
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function Gt(e, t) {
|
|
451
|
+
!Be.value || !O.value || (O.value = {
|
|
452
|
+
...O.value,
|
|
453
|
+
endRowId: e.id,
|
|
454
|
+
endColumnId: t.id
|
|
455
|
+
}, C("selection", O.value));
|
|
456
|
+
}
|
|
457
|
+
function Kt() {
|
|
458
|
+
Be.value = !1;
|
|
459
|
+
}
|
|
460
|
+
function qt(e, t) {
|
|
461
|
+
if (G(e, t)) return;
|
|
462
|
+
let n = W(e.id, t.id);
|
|
463
|
+
cn(e, t, n == null ? "" : String(n), "edit");
|
|
464
|
+
}
|
|
465
|
+
function Jt(e, t, n = "label") {
|
|
466
|
+
e.button === 0 && (e.preventDefault(), k.value && X(), J(), t.sortable && (n === "label" || M.value.length === 1) ? Cn(t) : Bt(t.id, e.shiftKey));
|
|
467
|
+
}
|
|
468
|
+
function Yt(e, t) {
|
|
469
|
+
e.button === 0 && (k.value && X(), J(), Vt(t.id, e.shiftKey));
|
|
470
|
+
}
|
|
471
|
+
function Xt(e) {
|
|
472
|
+
e.button === 0 && (k.value && X(), J(), Ht());
|
|
473
|
+
}
|
|
474
|
+
function J() {
|
|
475
|
+
T.value?.focus({ preventScroll: !0 });
|
|
476
|
+
}
|
|
477
|
+
function Y(e, t, n = !1) {
|
|
478
|
+
if (!D.value) {
|
|
479
|
+
let e = j.value[0], t = vt.value[0];
|
|
480
|
+
e && t && q(t.id, e.id);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
let r = H.value, i = U.value.get(D.value.rowId) ?? 0, a = F.value.get(D.value.columnId) ?? 0, o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(j.value.length - 1, a + t)), c = r[o].id, l = j.value[s].id;
|
|
484
|
+
q(c, l, n), nn(c, l);
|
|
485
|
+
}
|
|
486
|
+
function Zt(e) {
|
|
487
|
+
return e.replace(/["\\]/g, "\\$&");
|
|
488
|
+
}
|
|
489
|
+
function Qt(e) {
|
|
490
|
+
let t = T.value?.querySelector(e);
|
|
491
|
+
return t ? t.offsetHeight : 0;
|
|
492
|
+
}
|
|
493
|
+
function $t() {
|
|
494
|
+
let e = 0;
|
|
495
|
+
return M.value.forEach((t, n) => {
|
|
496
|
+
e += Qt(`[data-header-row="${n}"]`) || (t === "letters" && n === 0 && M.value.length === 2 ? 24 : rt.value);
|
|
497
|
+
}), e;
|
|
498
|
+
}
|
|
499
|
+
function en(e) {
|
|
500
|
+
let t = 0;
|
|
501
|
+
for (let n of e) t += Qt(`[data-row="${Zt(n.id)}"]`);
|
|
502
|
+
return t;
|
|
503
|
+
}
|
|
504
|
+
function tn(e) {
|
|
505
|
+
let t = e === "left" && b.showGutter ? b.gutterWidth : 0;
|
|
506
|
+
for (let n of j.value) n.pinned === e && (t += I(n));
|
|
507
|
+
return t;
|
|
508
|
+
}
|
|
509
|
+
function nn(e, t) {
|
|
510
|
+
let n = T.value;
|
|
511
|
+
if (!n) return;
|
|
512
|
+
let r = B.value.findIndex((t) => t.id === e);
|
|
513
|
+
if (r >= 0) {
|
|
514
|
+
let e = $t(), t = Qt(".nb-spreadsheet__cell") || at.value, i = e + (V.value.length + r) * t, a = e + en(V.value), o = en(mt.value);
|
|
515
|
+
i - a < n.scrollTop ? n.scrollTop = i - a : i + t > n.scrollTop + n.clientHeight - o && (n.scrollTop = i + t - n.clientHeight + o);
|
|
516
|
+
}
|
|
517
|
+
let i = t ? P.value.get(t) : void 0;
|
|
518
|
+
if (i && !i.pinned) {
|
|
519
|
+
let e = b.showGutter ? b.gutterWidth : 0;
|
|
520
|
+
for (let t of j.value) {
|
|
521
|
+
if (t.id === i.id) break;
|
|
522
|
+
e += I(t);
|
|
523
|
+
}
|
|
524
|
+
let t = I(i), r = tn("left"), a = tn("right");
|
|
525
|
+
e - r < n.scrollLeft ? n.scrollLeft = e - r : e + t > n.scrollLeft + n.clientWidth - a && (n.scrollLeft = e + t - n.clientWidth + a);
|
|
526
|
+
}
|
|
527
|
+
rn();
|
|
528
|
+
}
|
|
529
|
+
function rn() {
|
|
530
|
+
Ve.value = T.value?.scrollTop ?? 0, He.value = T.value?.scrollLeft ?? 0;
|
|
531
|
+
}
|
|
532
|
+
function an() {
|
|
533
|
+
if (!D.value) return null;
|
|
534
|
+
let e = N.value.get(D.value.rowId), t = P.value.get(D.value.columnId);
|
|
535
|
+
return e && t ? {
|
|
536
|
+
r: e,
|
|
537
|
+
c: t
|
|
538
|
+
} : null;
|
|
539
|
+
}
|
|
540
|
+
function on(e) {
|
|
541
|
+
return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
|
|
542
|
+
}
|
|
543
|
+
function sn(e) {
|
|
544
|
+
if (k.value) {
|
|
545
|
+
e.target !== Le.value && (on(e) ? (e.preventDefault(), k.value.draft += e.key) : fn(e));
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
let t = e.metaKey || e.ctrlKey;
|
|
549
|
+
if (t && e.key.toLowerCase() === "z") {
|
|
550
|
+
e.preventDefault(), e.shiftKey ? Wn() : Un();
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (t && e.key.toLowerCase() === "a") {
|
|
554
|
+
e.preventDefault(), Ht();
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (e.key === " " && (e.ctrlKey || e.shiftKey) && !e.metaKey && !e.altKey) {
|
|
558
|
+
let t = D.value;
|
|
559
|
+
if (!t) return;
|
|
560
|
+
e.preventDefault(), e.ctrlKey ? Bt(t.columnId) : Vt(t.rowId);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (e.altKey && e.shiftKey && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
564
|
+
let t = D.value ? P.value.get(D.value.columnId) : void 0;
|
|
565
|
+
if (!b.resizable || !t) return;
|
|
566
|
+
e.preventDefault();
|
|
567
|
+
let n = e.key === "ArrowRight" ? Fe : -Fe;
|
|
568
|
+
xn(t, I(t) + n);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) {
|
|
572
|
+
if (!b.contextMenu || !D.value) return;
|
|
573
|
+
e.preventDefault(), Ln();
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
switch (e.key) {
|
|
577
|
+
case "ArrowDown":
|
|
578
|
+
e.preventDefault(), Y(1, 0, e.shiftKey);
|
|
579
|
+
break;
|
|
580
|
+
case "ArrowUp":
|
|
581
|
+
e.preventDefault(), Y(-1, 0, e.shiftKey);
|
|
582
|
+
break;
|
|
583
|
+
case "ArrowLeft":
|
|
584
|
+
e.preventDefault(), Y(0, -1, e.shiftKey);
|
|
585
|
+
break;
|
|
586
|
+
case "ArrowRight":
|
|
587
|
+
e.preventDefault(), Y(0, 1, e.shiftKey);
|
|
588
|
+
break;
|
|
589
|
+
case "Tab":
|
|
590
|
+
e.preventDefault(), Y(0, e.shiftKey ? -1 : 1);
|
|
591
|
+
break;
|
|
592
|
+
case "Enter":
|
|
593
|
+
e.preventDefault(), Y(e.shiftKey ? -1 : 1, 0);
|
|
594
|
+
break;
|
|
595
|
+
case "Escape":
|
|
596
|
+
O.value = null, C("selection", null);
|
|
597
|
+
break;
|
|
598
|
+
case "Delete":
|
|
599
|
+
case "Backspace":
|
|
600
|
+
e.preventDefault(), mn();
|
|
601
|
+
break;
|
|
602
|
+
case "F2": {
|
|
603
|
+
e.preventDefault();
|
|
604
|
+
let t = an();
|
|
605
|
+
if (t && !G(t.r, t.c)) {
|
|
606
|
+
let e = W(t.r.id, t.c.id);
|
|
607
|
+
cn(t.r, t.c, e == null ? "" : String(e), "edit");
|
|
608
|
+
}
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
default: {
|
|
612
|
+
if (!on(e)) break;
|
|
613
|
+
let t = an();
|
|
614
|
+
t && !G(t.r, t.c) && (e.preventDefault(), cn(t.r, t.c, e.key, "enter"));
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function cn(e, t, n, r) {
|
|
619
|
+
nn(e.id, t.id), k.value = {
|
|
620
|
+
rowId: e.id,
|
|
621
|
+
columnId: t.id,
|
|
622
|
+
draft: n,
|
|
623
|
+
mode: r
|
|
624
|
+
}, re(() => {
|
|
625
|
+
let e = Le.value;
|
|
626
|
+
if (e) if (e.focus({ preventScroll: !0 }), r === "enter") {
|
|
627
|
+
let t = e.value.length;
|
|
628
|
+
e.setSelectionRange(t, t);
|
|
629
|
+
} else e.select();
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
let ln = l(() => {
|
|
633
|
+
if (k.value) return P.value.get(k.value.columnId)?.type === "number" ? "decimal" : "text";
|
|
634
|
+
}), un = l(() => {
|
|
635
|
+
if (!k.value) return;
|
|
636
|
+
let e = P.value.get(k.value.columnId), t = N.value.get(k.value.rowId), n = t?.label ?? String(pt.value.get(t?.id ?? "") ?? "");
|
|
637
|
+
return [e?.label, n].filter(Boolean).join(" ");
|
|
638
|
+
}), dn = l(() => {
|
|
639
|
+
if (!k.value) return { display: "none" };
|
|
640
|
+
let e = T.value, t = e?.querySelector(`[data-cell="${Zt(`${k.value.rowId}::${k.value.columnId}`)}"]`);
|
|
641
|
+
if (!e || !t) return { display: "none" };
|
|
642
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
643
|
+
return {
|
|
644
|
+
top: `${n.top - r.top - e.clientTop + Ve.value}px`,
|
|
645
|
+
left: `${n.left - r.left - e.clientLeft + He.value}px`,
|
|
646
|
+
width: `${n.width}px`,
|
|
647
|
+
height: `${n.height}px`
|
|
648
|
+
};
|
|
649
|
+
});
|
|
650
|
+
function fn(e) {
|
|
651
|
+
let t = k.value?.mode, n = null;
|
|
652
|
+
switch (e.key) {
|
|
653
|
+
case "Enter":
|
|
654
|
+
n = [e.shiftKey ? -1 : 1, 0];
|
|
655
|
+
break;
|
|
656
|
+
case "Tab":
|
|
657
|
+
n = [0, e.shiftKey ? -1 : 1];
|
|
658
|
+
break;
|
|
659
|
+
case "ArrowDown":
|
|
660
|
+
n = [1, 0];
|
|
661
|
+
break;
|
|
662
|
+
case "ArrowUp":
|
|
663
|
+
n = [-1, 0];
|
|
664
|
+
break;
|
|
665
|
+
case "ArrowLeft":
|
|
666
|
+
t === "enter" && (n = [0, -1]);
|
|
667
|
+
break;
|
|
668
|
+
case "ArrowRight":
|
|
669
|
+
t === "enter" && (n = [0, 1]);
|
|
670
|
+
break;
|
|
671
|
+
case "Escape":
|
|
672
|
+
e.preventDefault(), k.value = null, J();
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
n && (e.preventDefault(), X(), Y(n[0], n[1]));
|
|
676
|
+
}
|
|
677
|
+
function X(e = !0) {
|
|
678
|
+
if (!k.value) return;
|
|
679
|
+
let { rowId: t, columnId: n, draft: r } = k.value;
|
|
680
|
+
k.value = null;
|
|
681
|
+
let i = P.value.get(n);
|
|
682
|
+
if (!i) return;
|
|
683
|
+
let a;
|
|
684
|
+
try {
|
|
685
|
+
a = i.parse ? i.parse(r) : bt(i, r);
|
|
686
|
+
} catch {
|
|
687
|
+
e && J();
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
let o = W(t, n);
|
|
691
|
+
if (o !== a) {
|
|
692
|
+
let e = {
|
|
693
|
+
rowId: t,
|
|
694
|
+
columnId: n,
|
|
695
|
+
before: o,
|
|
696
|
+
after: a
|
|
697
|
+
};
|
|
698
|
+
Hn([e]), C("commit", e), C("change", [e]);
|
|
699
|
+
}
|
|
700
|
+
e && J();
|
|
701
|
+
}
|
|
702
|
+
function pn() {
|
|
703
|
+
let e = K.value;
|
|
704
|
+
if (!e) return [];
|
|
705
|
+
let t = H.value, n = j.value, r = [];
|
|
706
|
+
for (let i = e.r1; i <= e.r2; i++) for (let a = e.c1; a <= e.c2; a++) r.push({
|
|
707
|
+
rowId: t[i].id,
|
|
708
|
+
columnId: n[a].id
|
|
709
|
+
});
|
|
710
|
+
return r;
|
|
711
|
+
}
|
|
712
|
+
function mn() {
|
|
713
|
+
let e = pn(), t = [];
|
|
714
|
+
for (let { rowId: n, columnId: r } of e) {
|
|
715
|
+
let e = N.value.get(n), i = P.value.get(r);
|
|
716
|
+
if (!e || !i || G(e, i)) continue;
|
|
717
|
+
let a = W(n, r);
|
|
718
|
+
a == null || a === "" || t.push({
|
|
719
|
+
rowId: n,
|
|
720
|
+
columnId: r,
|
|
721
|
+
before: a,
|
|
722
|
+
after: null
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
if (t.length !== 0) {
|
|
726
|
+
Hn(t);
|
|
727
|
+
for (let e of t) C("commit", e);
|
|
728
|
+
C("change", t);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
function hn() {
|
|
732
|
+
let e = K.value;
|
|
733
|
+
if (!e) return null;
|
|
734
|
+
let t = H.value.map((e) => e.id), n = j.value.map((e) => e.id), r = [];
|
|
735
|
+
for (let i = e.r1; i <= e.r2; i++) {
|
|
736
|
+
let a = [];
|
|
737
|
+
for (let r = e.c1; r <= e.c2; r++) {
|
|
738
|
+
let e = W(t[i], n[r]);
|
|
739
|
+
a.push(e == null ? "" : String(e));
|
|
740
|
+
}
|
|
741
|
+
r.push(a.join(" "));
|
|
742
|
+
}
|
|
743
|
+
return r.join("\n");
|
|
744
|
+
}
|
|
745
|
+
function gn(e) {
|
|
746
|
+
let t = hn();
|
|
747
|
+
t !== null && (e.preventDefault(), e.clipboardData?.setData("text/plain", t));
|
|
748
|
+
}
|
|
749
|
+
function _n(e) {
|
|
750
|
+
gn(e), mn();
|
|
751
|
+
}
|
|
752
|
+
function vn(e) {
|
|
753
|
+
if (!D.value) return;
|
|
754
|
+
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
755
|
+
t && (e.preventDefault(), yn(t));
|
|
756
|
+
}
|
|
757
|
+
function yn(e) {
|
|
758
|
+
if (!D.value || !e) return;
|
|
759
|
+
let t = e.replace(/\r\n?/g, "\n").split("\n").map((e) => e.split(" ")), n = H.value.map((e) => e.id), r = j.value.map((e) => e.id), i = U.value.get(D.value.rowId) ?? 0, a = F.value.get(D.value.columnId) ?? 0, o = [];
|
|
760
|
+
if (t.forEach((e, t) => {
|
|
761
|
+
e.forEach((e, s) => {
|
|
762
|
+
let c = n[i + t], l = r[a + s];
|
|
763
|
+
if (!c || !l) return;
|
|
764
|
+
let u = N.value.get(c), d = P.value.get(l);
|
|
765
|
+
if (!u || !d || G(u, d)) return;
|
|
766
|
+
let f;
|
|
767
|
+
try {
|
|
768
|
+
f = d.parse ? d.parse(e) : bt(d, e);
|
|
769
|
+
} catch {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
let p = W(c, l);
|
|
773
|
+
p !== f && o.push({
|
|
774
|
+
rowId: c,
|
|
775
|
+
columnId: l,
|
|
776
|
+
before: p,
|
|
777
|
+
after: f
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
}), o.length !== 0) {
|
|
781
|
+
Hn(o);
|
|
782
|
+
for (let e of o) C("commit", e);
|
|
783
|
+
C("change", o);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function bn(e, t) {
|
|
787
|
+
let n = Math.max(e.minWidth ?? 60, Math.round(t));
|
|
788
|
+
return Re.value = {
|
|
789
|
+
...Re.value,
|
|
790
|
+
[e.id]: n
|
|
791
|
+
}, n;
|
|
792
|
+
}
|
|
793
|
+
function xn(e, t) {
|
|
794
|
+
let n = I(e), r = bn(e, t);
|
|
795
|
+
r !== n && C("column-resize", {
|
|
796
|
+
columnId: e.id,
|
|
797
|
+
width: r
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
function Sn(e, t) {
|
|
801
|
+
let n = e.clientX, r = I(t), i = (e) => {
|
|
802
|
+
bn(t, r + (e.clientX - n));
|
|
803
|
+
}, a = () => {
|
|
804
|
+
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a);
|
|
805
|
+
let e = I(t);
|
|
806
|
+
e !== r && C("column-resize", {
|
|
807
|
+
columnId: t.id,
|
|
808
|
+
width: e
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a);
|
|
812
|
+
}
|
|
813
|
+
function Cn(e) {
|
|
814
|
+
E.value?.columnId === e.id ? E.value = E.value.direction === "asc" ? {
|
|
815
|
+
columnId: e.id,
|
|
816
|
+
direction: "desc"
|
|
817
|
+
} : null : E.value = {
|
|
818
|
+
columnId: e.id,
|
|
819
|
+
direction: "asc"
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function wn(e, t) {
|
|
823
|
+
E.value = {
|
|
824
|
+
columnId: e.id,
|
|
825
|
+
direction: t
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function Tn(e) {
|
|
829
|
+
j.value.filter((t) => !e.includes(t.id)).length && (x.value = [...new Set([...x.value, ...e])]);
|
|
830
|
+
}
|
|
831
|
+
function Z(e) {
|
|
832
|
+
x.value = x.value.filter((t) => !e.includes(t));
|
|
833
|
+
}
|
|
834
|
+
function En(e) {
|
|
835
|
+
H.value.filter((t) => !e.includes(t.id)).length && (S.value = [...new Set([...S.value, ...e])]);
|
|
836
|
+
}
|
|
837
|
+
function Dn(e) {
|
|
838
|
+
S.value = S.value.filter((t) => !e.includes(t));
|
|
839
|
+
}
|
|
840
|
+
function On(e, t, n) {
|
|
841
|
+
let r = e.findIndex((e) => e.id === t);
|
|
842
|
+
if (!(r < 0)) {
|
|
843
|
+
for (let t = r + 1; t < e.length; t++) if (n(e[t])) return e[t].id;
|
|
844
|
+
for (let t = r - 1; t >= 0; t--) if (n(e[t])) return e[t].id;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
pe([j, H], () => {
|
|
848
|
+
let e = D.value;
|
|
849
|
+
if (!e) return;
|
|
850
|
+
let t = F.value.has(e.columnId), n = U.value.has(e.rowId);
|
|
851
|
+
if (t && n) {
|
|
852
|
+
O.value && !K.value && (O.value = null, C("selection", null));
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
let r = [
|
|
856
|
+
...b.rows.filter((e) => e.pinned === "top"),
|
|
857
|
+
...R.value,
|
|
858
|
+
...b.rows.filter((e) => e.pinned === "bottom")
|
|
859
|
+
], i = t ? e.columnId : On(A.value, e.columnId, (e) => F.value.has(e.id)), a = n ? e.rowId : On(r, e.rowId, (e) => U.value.has(e.id));
|
|
860
|
+
i && a ? q(a, i) : (D.value = null, O.value = null, C("focus", null), C("selection", null));
|
|
861
|
+
});
|
|
862
|
+
let kn = de("menuRef"), An = _(!1), jn = _("cell"), Mn = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl+", Nn = typeof navigator < "u" && !!navigator.clipboard?.readText, Q = l(() => {
|
|
863
|
+
let e = K.value;
|
|
864
|
+
return e ? j.value.slice(e.c1, e.c2 + 1).map((e) => e.id) : [];
|
|
865
|
+
}), Pn = l(() => {
|
|
866
|
+
let e = K.value;
|
|
867
|
+
return e ? H.value.slice(e.r1, e.r2 + 1).map((e) => e.id) : [];
|
|
868
|
+
});
|
|
869
|
+
function Fn() {
|
|
870
|
+
let e = K.value;
|
|
871
|
+
if (!e) return "cell";
|
|
872
|
+
let t = e.r1 === 0 && e.r2 === H.value.length - 1, n = e.c1 === 0 && e.c2 === j.value.length - 1;
|
|
873
|
+
return t && !n ? "column" : n && !t ? "row" : "cell";
|
|
874
|
+
}
|
|
875
|
+
let In = l(() => {
|
|
876
|
+
if (jn.value !== "column" || Q.value.length !== 1) return null;
|
|
877
|
+
let e = P.value.get(Q.value[0]);
|
|
878
|
+
return e?.sortable ? e : null;
|
|
879
|
+
});
|
|
880
|
+
function $(e, t, n, r) {
|
|
881
|
+
if (!b.contextMenu) return;
|
|
882
|
+
e.preventDefault(), k.value && X();
|
|
883
|
+
let i = K.value;
|
|
884
|
+
if (t === "column" && r) {
|
|
885
|
+
let e = F.value.get(r) ?? -1;
|
|
886
|
+
(Fn() !== "column" || !i || e < i.c1 || e > i.c2) && Bt(r);
|
|
887
|
+
} else if (t === "row" && n) {
|
|
888
|
+
let e = U.value.get(n) ?? -1;
|
|
889
|
+
(Fn() !== "row" || !i || e < i.r1 || e > i.r2) && Vt(n);
|
|
890
|
+
} else n && r ? Lt(n, r) || q(n, r) : Ht();
|
|
891
|
+
J(), Rn(t, e.clientX, e.clientY);
|
|
892
|
+
}
|
|
893
|
+
function Ln() {
|
|
894
|
+
let e = D.value;
|
|
895
|
+
if (!e) return;
|
|
896
|
+
nn(e.rowId, e.columnId);
|
|
897
|
+
let t = (T.value?.querySelector(`[data-cell="${Zt(`${e.rowId}::${e.columnId}`)}"]`))?.getBoundingClientRect();
|
|
898
|
+
Rn(Fn(), t?.left ?? 0, t?.bottom ?? 0);
|
|
899
|
+
}
|
|
900
|
+
function Rn(e, t, n) {
|
|
901
|
+
jn.value = e, kn.value?.setPositionXY(t, n), An.value = !0;
|
|
902
|
+
}
|
|
903
|
+
function zn() {
|
|
904
|
+
let e = hn();
|
|
905
|
+
e !== null && navigator.clipboard?.writeText(e).catch(() => {});
|
|
906
|
+
}
|
|
907
|
+
function Bn() {
|
|
908
|
+
zn(), mn();
|
|
909
|
+
}
|
|
910
|
+
function Vn() {
|
|
911
|
+
navigator.clipboard?.readText().then(yn).catch(() => {});
|
|
912
|
+
}
|
|
913
|
+
function Hn(e) {
|
|
914
|
+
We.value.push(e), Ge.value = [];
|
|
915
|
+
}
|
|
916
|
+
function Un() {
|
|
917
|
+
let e = We.value.pop();
|
|
918
|
+
if (!e) return;
|
|
919
|
+
let t = e.map((e) => ({
|
|
920
|
+
...e,
|
|
921
|
+
before: e.after,
|
|
922
|
+
after: e.before
|
|
923
|
+
}));
|
|
924
|
+
for (let e of t) C("commit", e);
|
|
925
|
+
C("change", t), Ge.value.push(e);
|
|
926
|
+
}
|
|
927
|
+
function Wn() {
|
|
928
|
+
let e = Ge.value.pop();
|
|
929
|
+
if (e) {
|
|
930
|
+
for (let t of e) C("commit", t);
|
|
931
|
+
C("change", e), We.value.push(e);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return pe(() => [
|
|
935
|
+
b.fit,
|
|
936
|
+
H.value.length,
|
|
937
|
+
it.value,
|
|
938
|
+
b.size,
|
|
939
|
+
b.columnHeaders
|
|
940
|
+
], () => ot()), oe(() => {
|
|
941
|
+
J(), ot(), ft(), typeof ResizeObserver < "u" && T.value && (st = new ResizeObserver(() => {
|
|
942
|
+
ot(), ft();
|
|
943
|
+
}), st.observe(T.value), Ie.value && st.observe(Ie.value));
|
|
944
|
+
}), ae(() => st?.disconnect()), te({
|
|
945
|
+
focus: (e, t) => q(e, t),
|
|
946
|
+
undo: Un,
|
|
947
|
+
redo: Wn,
|
|
948
|
+
getSelection: () => O.value,
|
|
949
|
+
selectAll: Ht,
|
|
950
|
+
selectColumn: (e) => Bt(e),
|
|
951
|
+
selectRow: (e) => Vt(e),
|
|
952
|
+
hideColumns: Tn,
|
|
953
|
+
showColumns: Z,
|
|
954
|
+
hideRows: En,
|
|
955
|
+
showRows: Dn
|
|
956
|
+
}), (n, r) => (g(), f("div", {
|
|
957
|
+
ref_key: "rootRef",
|
|
958
|
+
ref: Ie,
|
|
959
|
+
class: ie(["nb-spreadsheet", [`nb-spreadsheet--${e.size}`, {
|
|
960
|
+
"nb-spreadsheet--editing": !!k.value,
|
|
961
|
+
"nb-spreadsheet--fit": e.fit,
|
|
962
|
+
"nb-spreadsheet--two-headers": M.value.length === 2
|
|
963
|
+
}]]),
|
|
964
|
+
style: h(ct.value)
|
|
965
|
+
}, [
|
|
966
|
+
n.$slots.toolbar ? (g(), f("div", ye, [ce(n.$slots, "toolbar", {}, void 0, !0)])) : d("", !0),
|
|
967
|
+
p("div", {
|
|
968
|
+
ref_key: "scrollerRef",
|
|
969
|
+
ref: T,
|
|
970
|
+
class: "nb-spreadsheet__scroller",
|
|
971
|
+
tabindex: "0",
|
|
972
|
+
role: "grid",
|
|
973
|
+
"aria-multiselectable": "true",
|
|
974
|
+
"aria-label": e.ariaLabel,
|
|
975
|
+
"aria-rowcount": H.value.length + 1,
|
|
976
|
+
"aria-colcount": j.value.length + (e.showGutter ? 1 : 0),
|
|
977
|
+
"aria-activedescendant": Et.value,
|
|
978
|
+
onKeydown: sn,
|
|
979
|
+
onCopy: gn,
|
|
980
|
+
onCut: _n,
|
|
981
|
+
onPaste: vn,
|
|
982
|
+
onScroll: rn
|
|
983
|
+
}, [p("div", {
|
|
984
|
+
class: "nb-spreadsheet__grid",
|
|
985
|
+
style: h(lt.value)
|
|
986
|
+
}, [(g(!0), f(c, null, se(M.value, (n, i) => (g(), f("div", {
|
|
987
|
+
key: `hr-${n}`,
|
|
988
|
+
class: "nb-spreadsheet__row",
|
|
989
|
+
role: "row",
|
|
990
|
+
"aria-rowindex": i + 1
|
|
991
|
+
}, [e.showGutter && i === 0 ? (g(), f("div", {
|
|
992
|
+
key: 0,
|
|
993
|
+
class: "nb-spreadsheet__corner",
|
|
994
|
+
role: "columnheader",
|
|
995
|
+
"aria-colindex": "1",
|
|
996
|
+
style: h({
|
|
997
|
+
gridRow: `1 / span ${M.value.length}`,
|
|
998
|
+
gridColumn: 1
|
|
999
|
+
}),
|
|
1000
|
+
onMousedown: y(Xt, ["prevent"]),
|
|
1001
|
+
onContextmenu: r[0] ||= (e) => $(e, "cell")
|
|
1002
|
+
}, null, 36)) : d("", !0), (g(!0), f(c, null, se(j.value, (a, o) => (g(), f("div", {
|
|
1003
|
+
key: `h-${n}-${a.id}`,
|
|
1004
|
+
class: ie(["nb-spreadsheet__header", Dt(a, o, n)]),
|
|
1005
|
+
role: "columnheader",
|
|
1006
|
+
"aria-colindex": o + tt.value + 1,
|
|
1007
|
+
"aria-sort": n === "label" ? Ot(a) : void 0,
|
|
1008
|
+
"aria-label": n === "letters" && M.value.length === 1 && a.label ? `${Qe(a.id)} ${a.label}` : void 0,
|
|
1009
|
+
"data-header-col": n === "label" ? a.id : void 0,
|
|
1010
|
+
"data-header-row": i,
|
|
1011
|
+
style: h(Mt(a, o, i)),
|
|
1012
|
+
onMousedown: (e) => Jt(e, a, n),
|
|
1013
|
+
onContextmenu: (e) => $(e, "column", void 0, a.id)
|
|
1014
|
+
}, [
|
|
1015
|
+
n === "letters" ? (g(), f("span", {
|
|
1016
|
+
key: 0,
|
|
1017
|
+
class: "nb-spreadsheet__header-letter",
|
|
1018
|
+
title: M.value.length === 1 ? a.label : void 0
|
|
1019
|
+
}, le(Qe(a.id)), 9, Ce)) : (g(), f(c, { key: 1 }, [p("span", {
|
|
1020
|
+
class: "nb-spreadsheet__header-label",
|
|
1021
|
+
title: ut.value.has(a.id) ? a.label : void 0
|
|
1022
|
+
}, le(ut.value.has(a.id) ? a.shortLabel : a.label), 9, we), a.sortable ? (g(), u(t, {
|
|
1023
|
+
key: 0,
|
|
1024
|
+
name: kt(a),
|
|
1025
|
+
class: "nb-spreadsheet__sort",
|
|
1026
|
+
"aria-hidden": "true"
|
|
1027
|
+
}, null, 8, ["name"])) : d("", !0)], 64)),
|
|
1028
|
+
i === M.value.length - 1 ? (g(), f(c, { key: 2 }, [$e.value.has(a.id) ? (g(), f("button", {
|
|
1029
|
+
key: 0,
|
|
1030
|
+
type: "button",
|
|
1031
|
+
tabindex: "-1",
|
|
1032
|
+
class: "nb-spreadsheet__unhide nb-spreadsheet__unhide--col-start",
|
|
1033
|
+
title: v(w).spreadsheetShowColumns($e.value.get(a.id).length),
|
|
1034
|
+
"aria-label": v(w).spreadsheetShowColumns($e.value.get(a.id).length),
|
|
1035
|
+
onMousedown: r[1] ||= y(() => {}, ["stop", "prevent"]),
|
|
1036
|
+
onClick: (e) => Z($e.value.get(a.id))
|
|
1037
|
+
}, null, 40, Te)) : d("", !0), o === j.value.length - 1 && et.value.length ? (g(), f("button", {
|
|
1038
|
+
key: 1,
|
|
1039
|
+
type: "button",
|
|
1040
|
+
tabindex: "-1",
|
|
1041
|
+
class: "nb-spreadsheet__unhide nb-spreadsheet__unhide--col-end",
|
|
1042
|
+
title: v(w).spreadsheetShowColumns(et.value.length),
|
|
1043
|
+
"aria-label": v(w).spreadsheetShowColumns(et.value.length),
|
|
1044
|
+
onMousedown: r[2] ||= y(() => {}, ["stop", "prevent"]),
|
|
1045
|
+
onClick: r[3] ||= (e) => Z(et.value)
|
|
1046
|
+
}, null, 40, Ee)) : d("", !0)], 64)) : d("", !0),
|
|
1047
|
+
e.resizable ? (g(), f("span", {
|
|
1048
|
+
key: 3,
|
|
1049
|
+
class: "nb-spreadsheet__resize-handle",
|
|
1050
|
+
onMousedown: y((e) => Sn(e, a), ["stop"])
|
|
1051
|
+
}, null, 40, De)) : d("", !0)
|
|
1052
|
+
], 46, Se))), 128))], 8, xe))), 128)), (g(!0), f(c, null, se(vt.value, (t) => (g(), f("div", {
|
|
1053
|
+
key: `r-${t.id}`,
|
|
1054
|
+
class: "nb-spreadsheet__row",
|
|
1055
|
+
role: "row",
|
|
1056
|
+
"aria-rowindex": t.__virtualIndex + 1 + M.value.length
|
|
1057
|
+
}, [e.showGutter ? (g(), f("div", {
|
|
1058
|
+
key: 0,
|
|
1059
|
+
class: ie(["nb-spreadsheet__gutter", {
|
|
1060
|
+
"nb-spreadsheet__gutter--pinned-top": t.pinned === "top",
|
|
1061
|
+
"nb-spreadsheet__gutter--pinned-bottom": t.pinned === "bottom",
|
|
1062
|
+
"nb-spreadsheet__gutter--selected": Rt(t.id)
|
|
1063
|
+
}]),
|
|
1064
|
+
role: "rowheader",
|
|
1065
|
+
"aria-colindex": "1",
|
|
1066
|
+
style: h(It(t)),
|
|
1067
|
+
onMousedown: y((e) => Yt(e, t), ["prevent"]),
|
|
1068
|
+
onContextmenu: (e) => $(e, "row", t.id)
|
|
1069
|
+
}, [
|
|
1070
|
+
ee(le(Ft(t)) + " ", 1),
|
|
1071
|
+
ht.value.has(t.id) ? (g(), f("button", {
|
|
1072
|
+
key: 0,
|
|
1073
|
+
type: "button",
|
|
1074
|
+
tabindex: "-1",
|
|
1075
|
+
class: "nb-spreadsheet__unhide nb-spreadsheet__unhide--row-start",
|
|
1076
|
+
title: v(w).spreadsheetShowRows(ht.value.get(t.id).length),
|
|
1077
|
+
"aria-label": v(w).spreadsheetShowRows(ht.value.get(t.id).length),
|
|
1078
|
+
onMousedown: r[4] ||= y(() => {}, ["stop", "prevent"]),
|
|
1079
|
+
onClick: (e) => Dn(ht.value.get(t.id))
|
|
1080
|
+
}, null, 40, Ae)) : d("", !0),
|
|
1081
|
+
t.id === _t.value && gt.value.length ? (g(), f("button", {
|
|
1082
|
+
key: 1,
|
|
1083
|
+
type: "button",
|
|
1084
|
+
tabindex: "-1",
|
|
1085
|
+
class: "nb-spreadsheet__unhide nb-spreadsheet__unhide--row-end",
|
|
1086
|
+
title: v(w).spreadsheetShowRows(gt.value.length),
|
|
1087
|
+
"aria-label": v(w).spreadsheetShowRows(gt.value.length),
|
|
1088
|
+
onMousedown: r[5] ||= y(() => {}, ["stop", "prevent"]),
|
|
1089
|
+
onClick: r[6] ||= (e) => Dn(gt.value)
|
|
1090
|
+
}, null, 40, je)) : d("", !0)
|
|
1091
|
+
], 46, ke)) : d("", !0), (g(!0), f(c, null, se(j.value, (e, n) => (g(), f("div", {
|
|
1092
|
+
id: Tt(t.id, e.id),
|
|
1093
|
+
key: `c-${t.id}-${e.id}`,
|
|
1094
|
+
class: ie(["nb-spreadsheet__cell", Ct(t, e)]),
|
|
1095
|
+
role: "gridcell",
|
|
1096
|
+
"aria-colindex": n + tt.value + 1,
|
|
1097
|
+
"aria-selected": Lt(t.id, e.id),
|
|
1098
|
+
"aria-readonly": G(t, e) || void 0,
|
|
1099
|
+
style: h(Nt(t, e, n)),
|
|
1100
|
+
title: wt(t, e),
|
|
1101
|
+
"data-cell": `${t.id}::${e.id}`,
|
|
1102
|
+
"data-row": t.id,
|
|
1103
|
+
"data-col": e.id,
|
|
1104
|
+
onPointerdown: r[7] ||= (e) => Ut(e),
|
|
1105
|
+
onMousedown: (n) => Wt(n, t, e),
|
|
1106
|
+
onMouseenter: (n) => Gt(t, e),
|
|
1107
|
+
onDblclick: (n) => qt(t, e),
|
|
1108
|
+
onContextmenu: (n) => $(n, "cell", t.id, e.id)
|
|
1109
|
+
}, [p("span", null, le(St(t, e)), 1)], 46, Me))), 128))], 8, Oe))), 128))], 4), k.value ? he((g(), f("input", {
|
|
1110
|
+
key: 0,
|
|
1111
|
+
ref_key: "editorRef",
|
|
1112
|
+
ref: Le,
|
|
1113
|
+
"onUpdate:modelValue": r[8] ||= (e) => k.value.draft = e,
|
|
1114
|
+
class: "nb-spreadsheet__editor",
|
|
1115
|
+
style: h(dn.value),
|
|
1116
|
+
inputmode: ln.value,
|
|
1117
|
+
"aria-label": un.value,
|
|
1118
|
+
enterkeyhint: "next",
|
|
1119
|
+
onBlur: r[9] ||= (e) => X(!1),
|
|
1120
|
+
onKeydown: y(fn, ["stop"])
|
|
1121
|
+
}, null, 44, Ne)), [[fe, k.value.draft]]) : d("", !0)], 40, be),
|
|
1122
|
+
e.contextMenu ? (g(), u(a, {
|
|
1123
|
+
key: 1,
|
|
1124
|
+
ref_key: "menuRef",
|
|
1125
|
+
ref: kn,
|
|
1126
|
+
open: An.value,
|
|
1127
|
+
"onUpdate:open": r[16] ||= (e) => An.value = e,
|
|
1128
|
+
size: "sm"
|
|
1129
|
+
}, {
|
|
1130
|
+
default: me(() => [
|
|
1131
|
+
m(o, {
|
|
1132
|
+
label: v(w).spreadsheetCut,
|
|
1133
|
+
shortcut: `${v(Mn)}X`,
|
|
1134
|
+
onSelect: Bn
|
|
1135
|
+
}, null, 8, ["label", "shortcut"]),
|
|
1136
|
+
m(o, {
|
|
1137
|
+
label: v(w).spreadsheetCopy,
|
|
1138
|
+
shortcut: `${v(Mn)}C`,
|
|
1139
|
+
onSelect: zn
|
|
1140
|
+
}, null, 8, ["label", "shortcut"]),
|
|
1141
|
+
m(o, {
|
|
1142
|
+
label: v(w).spreadsheetPaste,
|
|
1143
|
+
shortcut: `${v(Mn)}V`,
|
|
1144
|
+
disabled: !v(Nn),
|
|
1145
|
+
"disabled-reason": v(w).spreadsheetPasteWithKeys,
|
|
1146
|
+
onSelect: Vn
|
|
1147
|
+
}, null, 8, [
|
|
1148
|
+
"label",
|
|
1149
|
+
"shortcut",
|
|
1150
|
+
"disabled",
|
|
1151
|
+
"disabled-reason"
|
|
1152
|
+
]),
|
|
1153
|
+
m(o, {
|
|
1154
|
+
label: v(w).spreadsheetClear,
|
|
1155
|
+
shortcut: "Delete",
|
|
1156
|
+
onSelect: mn
|
|
1157
|
+
}, null, 8, ["label"]),
|
|
1158
|
+
In.value ? (g(), f(c, { key: 0 }, [
|
|
1159
|
+
m(s),
|
|
1160
|
+
m(o, {
|
|
1161
|
+
label: v(w).spreadsheetSortAscending,
|
|
1162
|
+
onSelect: r[10] ||= (e) => wn(In.value, "asc")
|
|
1163
|
+
}, null, 8, ["label"]),
|
|
1164
|
+
m(o, {
|
|
1165
|
+
label: v(w).spreadsheetSortDescending,
|
|
1166
|
+
onSelect: r[11] ||= (e) => wn(In.value, "desc")
|
|
1167
|
+
}, null, 8, ["label"])
|
|
1168
|
+
], 64)) : d("", !0),
|
|
1169
|
+
m(s),
|
|
1170
|
+
jn.value === "row" ? d("", !0) : (g(), f(c, { key: 1 }, [m(o, {
|
|
1171
|
+
label: v(w).spreadsheetHideColumns(Q.value.length),
|
|
1172
|
+
disabled: Q.value.length >= j.value.length,
|
|
1173
|
+
"disabled-reason": v(w).spreadsheetKeepOneColumn,
|
|
1174
|
+
onSelect: r[12] ||= (e) => Tn(Q.value)
|
|
1175
|
+
}, null, 8, [
|
|
1176
|
+
"label",
|
|
1177
|
+
"disabled",
|
|
1178
|
+
"disabled-reason"
|
|
1179
|
+
]), Je.value.length ? (g(), u(o, {
|
|
1180
|
+
key: 0,
|
|
1181
|
+
label: v(w).spreadsheetShowColumns(Je.value.length),
|
|
1182
|
+
onSelect: r[13] ||= (e) => Z(Je.value)
|
|
1183
|
+
}, null, 8, ["label"])) : d("", !0)], 64)),
|
|
1184
|
+
jn.value === "column" ? d("", !0) : (g(), f(c, { key: 2 }, [m(o, {
|
|
1185
|
+
label: v(w).spreadsheetHideRows(Pn.value.length),
|
|
1186
|
+
disabled: Pn.value.length >= H.value.length,
|
|
1187
|
+
"disabled-reason": v(w).spreadsheetKeepOneRow,
|
|
1188
|
+
onSelect: r[14] ||= (e) => En(Pn.value)
|
|
1189
|
+
}, null, 8, [
|
|
1190
|
+
"label",
|
|
1191
|
+
"disabled",
|
|
1192
|
+
"disabled-reason"
|
|
1193
|
+
]), Ye.value.length ? (g(), u(o, {
|
|
1194
|
+
key: 0,
|
|
1195
|
+
label: v(w).spreadsheetShowRows(Ye.value.length),
|
|
1196
|
+
onSelect: r[15] ||= (e) => Dn(Ye.value)
|
|
1197
|
+
}, null, 8, ["label"])) : d("", !0)], 64))
|
|
1198
|
+
]),
|
|
1199
|
+
_: 1
|
|
1200
|
+
}, 8, ["open"])) : d("", !0)
|
|
1201
|
+
], 6));
|
|
1202
|
+
}
|
|
1203
|
+
}), [["__scopeId", "data-v-ed303713"]]);
|
|
1204
|
+
//#endregion
|
|
1205
|
+
export { b as t };
|