@nubisco/ui 5.56.0 → 5.56.1
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/all.cjs +1 -1
- package/dist/all.mjs +1 -1
- package/dist/components/labs/Spreadsheet.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{main-B-SiH7ks.js → main-BDjSW3PC.js} +283 -281
- package/dist/main-CjGCxppI.cjs +4 -0
- package/dist/styles/main.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/main-CH_BN_4v.cjs +0 -4
|
@@ -4,10 +4,10 @@ import { NB_COMMAND_PALETTE_KEY as a, createCommandPaletteState as o } from "./c
|
|
|
4
4
|
import { NB_HYDRATION as s } from "./composables/useTeleportReady.composable.mjs";
|
|
5
5
|
import { t as c } from "./_plugin-vue_export-helper-C6QCLu9I.js";
|
|
6
6
|
import { usePhoneLayout as l } from "./composables/usePhoneLayout.composable.mjs";
|
|
7
|
-
import { Fragment as u, computed as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, defineComponent as h, nextTick as g, normalizeClass as _, normalizeStyle as v, onBeforeUnmount as ee, onMounted as te, openBlock as y, ref as b, renderList as x, renderSlot as ne, toDisplayString as S, useTemplateRef as
|
|
7
|
+
import { Fragment as u, computed as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, defineComponent as h, nextTick as g, normalizeClass as _, normalizeStyle as v, onBeforeUnmount as ee, onMounted as te, openBlock as y, ref as b, renderList as x, renderSlot as ne, toDisplayString as S, useTemplateRef as C, vModelText as re, watch as ie, withDirectives as ae, withModifiers as oe } from "vue";
|
|
8
8
|
//#region src/directives/ContextMenu.directive.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
9
|
+
var w = /* @__PURE__ */ r({ default: () => T });
|
|
10
|
+
function T(e) {
|
|
11
11
|
e.directive("nb-context-menu", {
|
|
12
12
|
mounted(e, t) {
|
|
13
13
|
let n = (e) => {
|
|
@@ -35,8 +35,8 @@ function w(e) {
|
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/directives/TourStep.directive.ts
|
|
38
|
-
var
|
|
39
|
-
function
|
|
38
|
+
var E = /* @__PURE__ */ r({ default: () => O });
|
|
39
|
+
function D(e, t) {
|
|
40
40
|
let n = t.value;
|
|
41
41
|
if (n == null || n === "") {
|
|
42
42
|
e.removeAttribute(i);
|
|
@@ -44,43 +44,43 @@ function E(e, t) {
|
|
|
44
44
|
}
|
|
45
45
|
e.setAttribute(i, String(n));
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var O = (e) => {
|
|
48
48
|
e.directive("nb-tour-step", {
|
|
49
|
-
mounted:
|
|
50
|
-
updated:
|
|
49
|
+
mounted: D,
|
|
50
|
+
updated: D,
|
|
51
51
|
unmounted(e) {
|
|
52
52
|
e.removeAttribute(i);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
|
-
},
|
|
56
|
-
"./ContextMenu.directive.ts":
|
|
55
|
+
}, k = /* @__PURE__ */ Object.assign({
|
|
56
|
+
"./ContextMenu.directive.ts": w,
|
|
57
57
|
"./ToolTip.content.ts": t,
|
|
58
58
|
"./ToolTip.directive.ts": e,
|
|
59
|
-
"./TourStep.directive.ts":
|
|
60
|
-
}),
|
|
61
|
-
Object.values(
|
|
59
|
+
"./TourStep.directive.ts": E
|
|
60
|
+
}), A = { install(e) {
|
|
61
|
+
Object.values(k).forEach((t) => {
|
|
62
62
|
typeof t.default == "function" && t.default(e);
|
|
63
63
|
});
|
|
64
|
-
} },
|
|
64
|
+
} }, j = { install(e) {
|
|
65
65
|
let t = o();
|
|
66
66
|
e.provide(a, t);
|
|
67
|
-
} },
|
|
67
|
+
} }, M = /* @__PURE__ */ function(e) {
|
|
68
68
|
return e.Object = "object", e.Array = "array", e.Primitive = "primitive", e;
|
|
69
|
-
}(
|
|
69
|
+
}(M || {}), se = {
|
|
70
70
|
key: 0,
|
|
71
71
|
class: "nb-spreadsheet__toolbar"
|
|
72
|
-
},
|
|
72
|
+
}, ce = {
|
|
73
73
|
key: 0,
|
|
74
74
|
class: "nb-spreadsheet__corner",
|
|
75
75
|
style: {
|
|
76
76
|
gridRow: 1,
|
|
77
77
|
gridColumn: 1
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, le = ["data-header-col", "onClick"], ue = ["title"], de = {
|
|
80
80
|
key: 0,
|
|
81
81
|
class: "nb-spreadsheet__sort",
|
|
82
82
|
"aria-hidden": "true"
|
|
83
|
-
},
|
|
83
|
+
}, fe = ["onMousedown"], pe = [
|
|
84
84
|
"title",
|
|
85
85
|
"data-cell",
|
|
86
86
|
"data-row",
|
|
@@ -88,7 +88,7 @@ var D = (e) => {
|
|
|
88
88
|
"onMousedown",
|
|
89
89
|
"onMouseenter",
|
|
90
90
|
"onDblclick"
|
|
91
|
-
],
|
|
91
|
+
], me = ["inputmode"], he = 36, ge = 32, _e = 20, N = /* @__PURE__ */ h({
|
|
92
92
|
__name: "Spreadsheet",
|
|
93
93
|
props: {
|
|
94
94
|
columns: {},
|
|
@@ -123,7 +123,7 @@ var D = (e) => {
|
|
|
123
123
|
"row-reorder"
|
|
124
124
|
],
|
|
125
125
|
setup(e, { expose: t, emit: n }) {
|
|
126
|
-
let r = e, i = n, a =
|
|
126
|
+
let r = e, i = n, a = C("rootRef"), o = C("scrollerRef"), s = C("editorRef"), c = b({}), h = b(null), w = b(null), T = b(null), E = b(!1), D = b(null), O = b(0), k = b(0), A = "", j = b([]), M = b([]), N = d(() => {
|
|
127
127
|
let e = r.columns.filter((e) => e.pinned === "left"), t = r.columns.filter((e) => e.pinned === "right"), n = r.columns.filter((e) => !e.pinned);
|
|
128
128
|
return [
|
|
129
129
|
...e,
|
|
@@ -131,67 +131,67 @@ var D = (e) => {
|
|
|
131
131
|
...t
|
|
132
132
|
];
|
|
133
133
|
});
|
|
134
|
-
function
|
|
135
|
-
return
|
|
136
|
-
}
|
|
137
|
-
let { phoneTouch:
|
|
138
|
-
function
|
|
139
|
-
let e = a.value;
|
|
140
|
-
if (!r.fit ||
|
|
141
|
-
|
|
134
|
+
function P(e) {
|
|
135
|
+
return c.value[e.id] ?? e.width ?? 120;
|
|
136
|
+
}
|
|
137
|
+
let { phoneTouch: F } = l(), I = b(null), L = d(() => I.value ?? ge);
|
|
138
|
+
function R() {
|
|
139
|
+
let e = a.value, t = o.value;
|
|
140
|
+
if (!r.fit || F.value || !e || !t || !r.rows.length) {
|
|
141
|
+
I.value = null;
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
let t =
|
|
145
|
-
|
|
144
|
+
let n = e.querySelector(".nb-spreadsheet__toolbar"), i = t.offsetHeight - t.clientHeight, s = e.clientHeight - (n?.offsetHeight ?? 0) - i, c = Q(".nb-spreadsheet__header") || he, l = Math.floor((s - c) / r.rows.length);
|
|
145
|
+
I.value = Math.min(ge, Math.max(_e, l));
|
|
146
146
|
}
|
|
147
|
-
let
|
|
148
|
-
|
|
147
|
+
let z = null;
|
|
148
|
+
ie(() => [
|
|
149
149
|
r.fit,
|
|
150
150
|
r.rows.length,
|
|
151
|
-
|
|
152
|
-
], () =>
|
|
153
|
-
let
|
|
154
|
-
gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") +
|
|
151
|
+
F.value
|
|
152
|
+
], () => R());
|
|
153
|
+
let ve = d(() => I.value === null ? void 0 : { "--nbss-row-height": `${I.value}px` }), ye = d(() => ({
|
|
154
|
+
gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") + N.value.map((e) => r.fit && !e.pinned ? `minmax(${P(e)}px, 1fr)` : `${P(e)}px`).join(" "),
|
|
155
155
|
gridTemplateRows: "var(--nbss-header-height)"
|
|
156
|
-
})),
|
|
157
|
-
function
|
|
158
|
-
let e =
|
|
156
|
+
})), B = b(/* @__PURE__ */ new Set()), be = /* @__PURE__ */ new Map();
|
|
157
|
+
function V() {
|
|
158
|
+
let e = o.value;
|
|
159
159
|
if (!e) return;
|
|
160
160
|
let t = [], n = !1, i = !1;
|
|
161
161
|
for (let a of r.columns) {
|
|
162
162
|
if (!a.shortLabel) continue;
|
|
163
|
-
let r = e.querySelector(`[data-header-col="${
|
|
163
|
+
let r = e.querySelector(`[data-header-col="${Z(a.id)}"] .nb-spreadsheet__header-label`);
|
|
164
164
|
if (!r) continue;
|
|
165
165
|
let o = `${a.id}::${a.label}`;
|
|
166
|
-
|
|
167
|
-
let s =
|
|
166
|
+
B.value.has(a.id) || be.set(o, r.scrollWidth);
|
|
167
|
+
let s = be.get(o);
|
|
168
168
|
if (s === void 0) {
|
|
169
169
|
i = !0;
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
172
|
t.push(a.id), s > r.clientWidth && (n = !0);
|
|
173
173
|
}
|
|
174
|
-
|
|
174
|
+
B.value = new Set(n ? t : []), i && g(V);
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
let
|
|
176
|
+
ie(() => [r.columns, c.value], () => void g(V), { deep: !0 });
|
|
177
|
+
let H = d(() => {
|
|
178
178
|
let e = r.rows.filter((e) => !e.pinned);
|
|
179
|
-
if (!
|
|
180
|
-
let t = r.columns.find((e) => e.id ===
|
|
179
|
+
if (!h.value) return e;
|
|
180
|
+
let t = r.columns.find((e) => e.id === h.value.columnId);
|
|
181
181
|
if (!t) return e;
|
|
182
|
-
let n =
|
|
182
|
+
let n = h.value.direction === "asc" ? 1 : -1, i = (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;
|
|
183
183
|
return [...e].sort((e, n) => i(e.values[t.id], n.values[t.id]));
|
|
184
|
-
}),
|
|
185
|
-
let e = Math.max(1, Math.ceil((
|
|
184
|
+
}), U = d(() => r.rows.filter((e) => e.pinned === "top")), W = d(() => r.rows.filter((e) => e.pinned === "bottom")), xe = d(() => {
|
|
185
|
+
let e = Math.max(1, Math.ceil((o.value?.clientHeight ?? 600) / L.value)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(O.value / L.value) - U.value.length - t, i = Math.max(0, n), a = Math.min(H.value.length, i + e + t * 2), s = U.value.map((e, t) => ({
|
|
186
186
|
...e,
|
|
187
187
|
__virtualIndex: t,
|
|
188
188
|
gutterLabel: ""
|
|
189
|
-
})), c =
|
|
189
|
+
})), c = H.value.slice(i, a).map((e, t) => ({
|
|
190
190
|
...e,
|
|
191
|
-
__virtualIndex: i + t +
|
|
192
|
-
})), l =
|
|
191
|
+
__virtualIndex: i + t + U.value.length
|
|
192
|
+
})), l = W.value.map((e, t) => ({
|
|
193
193
|
...e,
|
|
194
|
-
__virtualIndex:
|
|
194
|
+
__virtualIndex: U.value.length + H.value.length + t,
|
|
195
195
|
gutterLabel: ""
|
|
196
196
|
}));
|
|
197
197
|
return [
|
|
@@ -200,7 +200,7 @@ var D = (e) => {
|
|
|
200
200
|
...l
|
|
201
201
|
];
|
|
202
202
|
});
|
|
203
|
-
function
|
|
203
|
+
function Se(e, t) {
|
|
204
204
|
if (t == null || t === "") return "";
|
|
205
205
|
if (e.type === "number") {
|
|
206
206
|
let e = typeof t == "number" ? t : Number(t);
|
|
@@ -212,7 +212,7 @@ var D = (e) => {
|
|
|
212
212
|
}
|
|
213
213
|
return String(t);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ce(e, t) {
|
|
216
216
|
if (t === "") return null;
|
|
217
217
|
if (e.type === "number") {
|
|
218
218
|
let e = t.replace(/\s/g, "").replace(",", "."), n = Number(e);
|
|
@@ -226,29 +226,29 @@ var D = (e) => {
|
|
|
226
226
|
}
|
|
227
227
|
return t;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function G(e, t) {
|
|
230
230
|
let n = r.rows.find((t) => t.id === e);
|
|
231
231
|
if (!n) return;
|
|
232
232
|
let i = n.values[t];
|
|
233
233
|
if (i !== void 0) return i;
|
|
234
|
-
if (r.computed) return r.computed(e, t,
|
|
234
|
+
if (r.computed) return r.computed(e, t, G);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function K(e, t) {
|
|
237
237
|
return r.cellAttrs ? r.cellAttrs(e.id, t.id, e, t) ?? {} : {};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
let n =
|
|
239
|
+
function we(e, t) {
|
|
240
|
+
let n = K(e, t);
|
|
241
241
|
if (n.display !== void 0) return n.display;
|
|
242
|
-
let r =
|
|
243
|
-
return t.format ? t.format(r, e) :
|
|
242
|
+
let r = G(e.id, t.id);
|
|
243
|
+
return t.format ? t.format(r, e) : Se(t, r);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
let n =
|
|
245
|
+
function Te(e, t) {
|
|
246
|
+
let n = K(e, t), r = w.value?.rowId === e.id && w.value?.columnId === t.id, i = Fe(e.id, t.id);
|
|
247
247
|
return {
|
|
248
248
|
[`nb-spreadsheet__cell--${t.align ?? (t.type === "number" || t.type === "date" ? "right" : "left")}`]: !0,
|
|
249
249
|
"nb-spreadsheet__cell--focused": r,
|
|
250
250
|
"nb-spreadsheet__cell--selected": i,
|
|
251
|
-
"nb-spreadsheet__cell--readonly":
|
|
251
|
+
"nb-spreadsheet__cell--readonly": q(e, t),
|
|
252
252
|
"nb-spreadsheet__cell--computed": !!n.computed || !!e.computed,
|
|
253
253
|
"nb-spreadsheet__cell--pinned-top": e.pinned === "top",
|
|
254
254
|
"nb-spreadsheet__cell--pinned-bottom": e.pinned === "bottom",
|
|
@@ -256,228 +256,228 @@ var D = (e) => {
|
|
|
256
256
|
[e.className ?? ""]: !!e.className
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function q(e, t) {
|
|
260
260
|
if (e.computed || t.readOnly) return !0;
|
|
261
|
-
let n =
|
|
261
|
+
let n = K(e, t);
|
|
262
262
|
return !!n.readOnly || !!n.computed;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
264
|
+
function Ee(e, t) {
|
|
265
|
+
return K(e, t).tooltip ?? "";
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function De(e) {
|
|
268
268
|
return {
|
|
269
269
|
"nb-spreadsheet__header--sortable": !!e.sortable,
|
|
270
270
|
"nb-spreadsheet__header--pinned-left": e.pinned === "left",
|
|
271
271
|
"nb-spreadsheet__header--pinned-right": e.pinned === "right",
|
|
272
|
-
"nb-spreadsheet__header--last": e.id ===
|
|
272
|
+
"nb-spreadsheet__header--last": e.id === N.value[N.value.length - 1]?.id
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Oe(e) {
|
|
276
276
|
if (e.pinned !== "left") return 0;
|
|
277
277
|
let t = r.showGutter ? r.gutterWidth : 0;
|
|
278
|
-
for (let n of
|
|
278
|
+
for (let n of N.value) {
|
|
279
279
|
if (n.id === e.id) break;
|
|
280
|
-
n.pinned === "left" && (t +=
|
|
280
|
+
n.pinned === "left" && (t += P(n));
|
|
281
281
|
}
|
|
282
282
|
return t;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ke(e) {
|
|
285
285
|
if (e.pinned !== "right") return 0;
|
|
286
|
-
let t = 0, n = [...
|
|
286
|
+
let t = 0, n = [...N.value].reverse();
|
|
287
287
|
for (let r of n) {
|
|
288
288
|
if (r.id === e.id) break;
|
|
289
|
-
r.pinned === "right" && (t +=
|
|
289
|
+
r.pinned === "right" && (t += P(r));
|
|
290
290
|
}
|
|
291
291
|
return t;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Ae(e, t) {
|
|
294
294
|
let n = (r.showGutter ? 2 : 1) + t, i = {};
|
|
295
|
-
return e.pinned === "left" ? (i.position = "sticky", i.left = `${
|
|
295
|
+
return e.pinned === "left" ? (i.position = "sticky", i.left = `${Oe(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${ke(e)}px`, i.zIndex = "3"), {
|
|
296
296
|
gridRow: 1,
|
|
297
297
|
gridColumn: n,
|
|
298
298
|
...i
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function je(e, t, n) {
|
|
302
302
|
let i = (r.showGutter ? 2 : 1) + n, a = e.__virtualIndex + 2, o = {};
|
|
303
|
-
return t.pinned === "left" ? (o.position = "sticky", o.left = `${
|
|
303
|
+
return t.pinned === "left" ? (o.position = "sticky", o.left = `${Oe(t)}px`, o.zIndex = "2") : t.pinned === "right" && (o.position = "sticky", o.right = `${ke(t)}px`, o.zIndex = "2"), (e.pinned === "top" || e.pinned === "bottom") && (o.position = "sticky", o.zIndex = String(Math.max(Number(o.zIndex ?? 0), 2)), Object.assign(o, Me(e))), {
|
|
304
304
|
gridRow: a,
|
|
305
305
|
gridColumn: i,
|
|
306
306
|
...o
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Me(e) {
|
|
310
310
|
if (e.pinned === "top") {
|
|
311
|
-
let t =
|
|
311
|
+
let t = U.value.findIndex((t) => t.id === e.id);
|
|
312
312
|
return { top: `calc(var(--nbss-header-height) + var(--nbss-row-height) * ${Math.max(0, t)})` };
|
|
313
313
|
}
|
|
314
314
|
if (e.pinned === "bottom") {
|
|
315
|
-
let t =
|
|
315
|
+
let t = W.value, n = t.findIndex((t) => t.id === e.id);
|
|
316
316
|
return { bottom: `calc(var(--nbss-row-height) * ${Math.max(0, t.length - 1 - n)})` };
|
|
317
317
|
}
|
|
318
318
|
return {};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex -
|
|
320
|
+
function Ne(e) {
|
|
321
|
+
return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex - U.value.length + 1) : e.gutterLabel : e.label;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function Pe(e) {
|
|
324
324
|
let t = {
|
|
325
325
|
position: "sticky",
|
|
326
326
|
left: "0",
|
|
327
327
|
zIndex: "2"
|
|
328
328
|
};
|
|
329
|
-
return e.pinned && (Object.assign(t,
|
|
329
|
+
return e.pinned && (Object.assign(t, Me(e)), t.zIndex = "4"), {
|
|
330
330
|
gridRow: e.__virtualIndex + 2,
|
|
331
331
|
gridColumn: 1,
|
|
332
332
|
...t
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
if (!
|
|
335
|
+
function Fe(e, t) {
|
|
336
|
+
if (!T.value) return !1;
|
|
337
337
|
let n = [
|
|
338
|
-
...
|
|
339
|
-
...
|
|
340
|
-
...
|
|
341
|
-
].map((e) => e.id), r =
|
|
338
|
+
...U.value,
|
|
339
|
+
...H.value,
|
|
340
|
+
...W.value
|
|
341
|
+
].map((e) => e.id), r = N.value.map((e) => e.id), i = n.indexOf(T.value.startRowId), a = n.indexOf(T.value.endRowId), o = r.indexOf(T.value.startColumnId), s = r.indexOf(T.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
|
|
342
342
|
return c >= Math.min(i, a) && c <= Math.max(i, a) && l >= Math.min(o, s) && l <= Math.max(o, s);
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
|
|
344
|
+
function J(e, t, n = !1) {
|
|
345
|
+
w.value = {
|
|
346
346
|
rowId: e,
|
|
347
347
|
columnId: t
|
|
348
|
-
}, n &&
|
|
349
|
-
...
|
|
348
|
+
}, n && T.value ? T.value = {
|
|
349
|
+
...T.value,
|
|
350
350
|
endRowId: e,
|
|
351
351
|
endColumnId: t
|
|
352
|
-
} :
|
|
352
|
+
} : T.value = {
|
|
353
353
|
startRowId: e,
|
|
354
354
|
startColumnId: t,
|
|
355
355
|
endRowId: e,
|
|
356
356
|
endColumnId: t
|
|
357
|
-
}, i("focus",
|
|
357
|
+
}, i("focus", w.value), i("selection", T.value);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
|
|
359
|
+
function Ie(e) {
|
|
360
|
+
A = e.pointerType;
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
let r =
|
|
364
|
-
if (
|
|
365
|
-
let e =
|
|
366
|
-
|
|
362
|
+
function Le(e, t, n) {
|
|
363
|
+
let r = A === "touch" && !e.shiftKey && w.value?.rowId === t.id && w.value?.columnId === n.id;
|
|
364
|
+
if (A = "", D.value && Ze(), E.value = !0, J(t.id, n.id, e.shiftKey), Y(), e.preventDefault(), document.addEventListener("mouseup", ze, { once: !0 }), r && !q(t, n)) {
|
|
365
|
+
let e = G(t.id, n.id);
|
|
366
|
+
$(t, n, e == null ? "" : String(e), "edit");
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
!
|
|
371
|
-
...
|
|
369
|
+
function Re(e, t) {
|
|
370
|
+
!E.value || !T.value || (T.value = {
|
|
371
|
+
...T.value,
|
|
372
372
|
endRowId: e.id,
|
|
373
373
|
endColumnId: t.id
|
|
374
|
-
}, i("selection",
|
|
374
|
+
}, i("selection", T.value));
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
|
|
376
|
+
function ze() {
|
|
377
|
+
E.value = !1;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
if (
|
|
381
|
-
let n =
|
|
382
|
-
|
|
379
|
+
function Be(e, t) {
|
|
380
|
+
if (q(e, t)) return;
|
|
381
|
+
let n = G(e.id, t.id);
|
|
382
|
+
$(e, t, n == null ? "" : String(n), "edit");
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
|
|
384
|
+
function Y() {
|
|
385
|
+
o.value?.focus({ preventScroll: !0 });
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
if (!
|
|
389
|
-
let e =
|
|
390
|
-
e && t &&
|
|
387
|
+
function X(e, t, n = !1) {
|
|
388
|
+
if (!w.value) {
|
|
389
|
+
let e = N.value[0], t = xe.value[0];
|
|
390
|
+
e && t && J(t.id, e.id);
|
|
391
391
|
return;
|
|
392
392
|
}
|
|
393
393
|
let r = [
|
|
394
|
-
...
|
|
395
|
-
...
|
|
396
|
-
...
|
|
397
|
-
], i = r.findIndex((e) => e.id ===
|
|
398
|
-
|
|
394
|
+
...U.value,
|
|
395
|
+
...H.value,
|
|
396
|
+
...W.value
|
|
397
|
+
], i = r.findIndex((e) => e.id === w.value.rowId), a = N.value.findIndex((e) => e.id === w.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(N.value.length - 1, a + t)), c = r[o].id, l = N.value[s].id;
|
|
398
|
+
J(c, l, n), Ue(c, l);
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Z(e) {
|
|
401
401
|
return e.replace(/["\\]/g, "\\$&");
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
let t =
|
|
403
|
+
function Q(e) {
|
|
404
|
+
let t = o.value?.querySelector(e);
|
|
405
405
|
return t ? t.offsetHeight : 0;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Ve(e) {
|
|
408
408
|
let t = 0;
|
|
409
|
-
for (let n of e) t +=
|
|
409
|
+
for (let n of e) t += Q(`[data-row="${Z(n.id)}"]`);
|
|
410
410
|
return t;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function He(e) {
|
|
413
413
|
let t = e === "left" && r.showGutter ? r.gutterWidth : 0;
|
|
414
|
-
for (let n of
|
|
414
|
+
for (let n of N.value) n.pinned === e && (t += P(n));
|
|
415
415
|
return t;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
let n =
|
|
417
|
+
function Ue(e, t) {
|
|
418
|
+
let n = o.value;
|
|
419
419
|
if (!n) return;
|
|
420
|
-
let i =
|
|
420
|
+
let i = H.value.findIndex((t) => t.id === e);
|
|
421
421
|
if (i >= 0) {
|
|
422
|
-
let e =
|
|
422
|
+
let e = Q(".nb-spreadsheet__header") || he, t = Q(".nb-spreadsheet__cell") || L.value, r = e + (U.value.length + i) * t, a = e + Ve(U.value), o = Ve(W.value);
|
|
423
423
|
r - a < n.scrollTop ? n.scrollTop = r - a : r + t > n.scrollTop + n.clientHeight - o && (n.scrollTop = r + t - n.clientHeight + o);
|
|
424
424
|
}
|
|
425
|
-
let
|
|
426
|
-
if (
|
|
425
|
+
let a = t ? N.value.find((e) => e.id === t) : void 0;
|
|
426
|
+
if (a && !a.pinned) {
|
|
427
427
|
let e = r.showGutter ? r.gutterWidth : 0;
|
|
428
|
-
for (let t of
|
|
429
|
-
if (t.id ===
|
|
430
|
-
e +=
|
|
428
|
+
for (let t of N.value) {
|
|
429
|
+
if (t.id === a.id) break;
|
|
430
|
+
e += P(t);
|
|
431
431
|
}
|
|
432
|
-
let t =
|
|
433
|
-
e - i < n.scrollLeft ? n.scrollLeft = e - i : e + t > n.scrollLeft + n.clientWidth -
|
|
432
|
+
let t = P(a), i = He("left"), o = He("right");
|
|
433
|
+
e - i < n.scrollLeft ? n.scrollLeft = e - i : e + t > n.scrollLeft + n.clientWidth - o && (n.scrollLeft = e + t - n.clientWidth + o);
|
|
434
434
|
}
|
|
435
|
-
|
|
435
|
+
We();
|
|
436
436
|
}
|
|
437
|
-
function
|
|
438
|
-
|
|
437
|
+
function We() {
|
|
438
|
+
O.value = o.value?.scrollTop ?? 0, k.value = o.value?.scrollLeft ?? 0;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
if (!
|
|
442
|
-
let e = r.rows.find((e) => e.id ===
|
|
440
|
+
function Ge() {
|
|
441
|
+
if (!w.value) return null;
|
|
442
|
+
let e = r.rows.find((e) => e.id === w.value.rowId), t = r.columns.find((e) => e.id === w.value.columnId);
|
|
443
443
|
return e && t ? {
|
|
444
444
|
r: e,
|
|
445
445
|
c: t
|
|
446
446
|
} : null;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Ke(e) {
|
|
449
449
|
return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
if (
|
|
453
|
-
e.target !==
|
|
451
|
+
function qe(e) {
|
|
452
|
+
if (D.value) {
|
|
453
|
+
e.target !== s.value && (Ke(e) ? (e.preventDefault(), D.value.draft += e.key) : Xe(e));
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
456
456
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
|
|
457
|
-
e.preventDefault(), e.shiftKey ?
|
|
457
|
+
e.preventDefault(), e.shiftKey ? st() : ot();
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
switch (e.key) {
|
|
461
461
|
case "ArrowDown":
|
|
462
|
-
e.preventDefault(),
|
|
462
|
+
e.preventDefault(), X(1, 0, e.shiftKey);
|
|
463
463
|
break;
|
|
464
464
|
case "ArrowUp":
|
|
465
|
-
e.preventDefault(),
|
|
465
|
+
e.preventDefault(), X(-1, 0, e.shiftKey);
|
|
466
466
|
break;
|
|
467
467
|
case "ArrowLeft":
|
|
468
|
-
e.preventDefault(),
|
|
468
|
+
e.preventDefault(), X(0, -1, e.shiftKey);
|
|
469
469
|
break;
|
|
470
470
|
case "ArrowRight":
|
|
471
|
-
e.preventDefault(),
|
|
471
|
+
e.preventDefault(), X(0, 1, e.shiftKey);
|
|
472
472
|
break;
|
|
473
473
|
case "Tab":
|
|
474
|
-
e.preventDefault(),
|
|
474
|
+
e.preventDefault(), X(0, e.shiftKey ? -1 : 1);
|
|
475
475
|
break;
|
|
476
476
|
case "Enter":
|
|
477
|
-
e.preventDefault(),
|
|
477
|
+
e.preventDefault(), X(e.shiftKey ? -1 : 1, 0);
|
|
478
478
|
break;
|
|
479
479
|
case "Escape":
|
|
480
|
-
|
|
480
|
+
T.value = null, i("selection", null);
|
|
481
481
|
break;
|
|
482
482
|
case "Delete":
|
|
483
483
|
case "Backspace":
|
|
@@ -485,50 +485,50 @@ var D = (e) => {
|
|
|
485
485
|
break;
|
|
486
486
|
case "F2": {
|
|
487
487
|
e.preventDefault();
|
|
488
|
-
let t =
|
|
489
|
-
if (t && !
|
|
490
|
-
let e =
|
|
491
|
-
|
|
488
|
+
let t = Ge();
|
|
489
|
+
if (t && !q(t.r, t.c)) {
|
|
490
|
+
let e = G(t.r.id, t.c.id);
|
|
491
|
+
$(t.r, t.c, e == null ? "" : String(e), "edit");
|
|
492
492
|
}
|
|
493
493
|
break;
|
|
494
494
|
}
|
|
495
495
|
default: {
|
|
496
|
-
if (!
|
|
497
|
-
let t =
|
|
498
|
-
t && !
|
|
496
|
+
if (!Ke(e)) break;
|
|
497
|
+
let t = Ge();
|
|
498
|
+
t && !q(t.r, t.c) && (e.preventDefault(), $(t.r, t.c, e.key, "enter"));
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
function
|
|
503
|
-
|
|
502
|
+
function $(e, t, n, r) {
|
|
503
|
+
Ue(e.id, t.id), D.value = {
|
|
504
504
|
rowId: e.id,
|
|
505
505
|
columnId: t.id,
|
|
506
506
|
draft: n,
|
|
507
507
|
mode: r
|
|
508
508
|
}, g(() => {
|
|
509
|
-
let e =
|
|
509
|
+
let e = s.value;
|
|
510
510
|
if (e) if (e.focus({ preventScroll: !0 }), r === "enter") {
|
|
511
511
|
let t = e.value.length;
|
|
512
512
|
e.setSelectionRange(t, t);
|
|
513
513
|
} else e.select();
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
|
-
let
|
|
517
|
-
if (
|
|
518
|
-
}),
|
|
519
|
-
if (!
|
|
520
|
-
let e =
|
|
516
|
+
let Je = d(() => {
|
|
517
|
+
if (D.value) return r.columns.find((e) => e.id === D.value.columnId)?.type === "number" ? "decimal" : "text";
|
|
518
|
+
}), Ye = d(() => {
|
|
519
|
+
if (!D.value) return { display: "none" };
|
|
520
|
+
let e = o.value, t = e?.querySelector(`[data-cell="${Z(`${D.value.rowId}::${D.value.columnId}`)}"]`);
|
|
521
521
|
if (!e || !t) return { display: "none" };
|
|
522
522
|
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
523
523
|
return {
|
|
524
|
-
top: `${n.top - r.top - e.clientTop +
|
|
525
|
-
left: `${n.left - r.left - e.clientLeft +
|
|
524
|
+
top: `${n.top - r.top - e.clientTop + O.value}px`,
|
|
525
|
+
left: `${n.left - r.left - e.clientLeft + k.value}px`,
|
|
526
526
|
width: `${n.width}px`,
|
|
527
527
|
height: `${n.height}px`
|
|
528
528
|
};
|
|
529
529
|
});
|
|
530
|
-
function
|
|
531
|
-
let t =
|
|
530
|
+
function Xe(e) {
|
|
531
|
+
let t = D.value?.mode, n = null;
|
|
532
532
|
switch (e.key) {
|
|
533
533
|
case "Enter":
|
|
534
534
|
n = [e.shiftKey ? -1 : 1, 0];
|
|
@@ -549,25 +549,25 @@ var D = (e) => {
|
|
|
549
549
|
t === "enter" && (n = [0, 1]);
|
|
550
550
|
break;
|
|
551
551
|
case "Escape":
|
|
552
|
-
e.preventDefault(),
|
|
552
|
+
e.preventDefault(), D.value = null, Y();
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
|
-
n && (e.preventDefault(),
|
|
555
|
+
n && (e.preventDefault(), Ze(), X(n[0], n[1]));
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
if (!
|
|
559
|
-
let { rowId: t, columnId: n, draft: a } =
|
|
560
|
-
|
|
557
|
+
function Ze(e = !0) {
|
|
558
|
+
if (!D.value) return;
|
|
559
|
+
let { rowId: t, columnId: n, draft: a } = D.value;
|
|
560
|
+
D.value = null;
|
|
561
561
|
let o = r.columns.find((e) => e.id === n);
|
|
562
562
|
if (!o) return;
|
|
563
563
|
let s;
|
|
564
564
|
try {
|
|
565
|
-
s = o.parse ? o.parse(a) :
|
|
565
|
+
s = o.parse ? o.parse(a) : Ce(o, a);
|
|
566
566
|
} catch {
|
|
567
|
-
e &&
|
|
567
|
+
e && Y();
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
|
-
let c =
|
|
570
|
+
let c = G(t, n);
|
|
571
571
|
if (c !== s) {
|
|
572
572
|
let e = {
|
|
573
573
|
rowId: t,
|
|
@@ -575,17 +575,17 @@ var D = (e) => {
|
|
|
575
575
|
before: c,
|
|
576
576
|
after: s
|
|
577
577
|
};
|
|
578
|
-
|
|
578
|
+
at([e]), i("commit", e), i("change", [e]);
|
|
579
579
|
}
|
|
580
|
-
e &&
|
|
580
|
+
e && Y();
|
|
581
581
|
}
|
|
582
582
|
function Qe() {
|
|
583
|
-
if (!
|
|
583
|
+
if (!T.value) return [];
|
|
584
584
|
let e = [
|
|
585
|
-
...
|
|
586
|
-
...
|
|
587
|
-
...
|
|
588
|
-
].map((e) => e.id), t =
|
|
585
|
+
...U.value,
|
|
586
|
+
...H.value,
|
|
587
|
+
...W.value
|
|
588
|
+
].map((e) => e.id), t = N.value.map((e) => e.id), n = e.indexOf(T.value.startRowId), r = e.indexOf(T.value.endRowId), i = t.indexOf(T.value.startColumnId), a = t.indexOf(T.value.endColumnId), o = [];
|
|
589
589
|
for (let s = Math.min(n, r); s <= Math.max(n, r); s++) for (let n = Math.min(i, a); n <= Math.max(i, a); n++) o.push({
|
|
590
590
|
rowId: e[s],
|
|
591
591
|
columnId: t[n]
|
|
@@ -596,8 +596,8 @@ var D = (e) => {
|
|
|
596
596
|
let e = Qe(), t = [];
|
|
597
597
|
for (let { rowId: n, columnId: i } of e) {
|
|
598
598
|
let e = r.rows.find((e) => e.id === n), a = r.columns.find((e) => e.id === i);
|
|
599
|
-
if (!e || !a ||
|
|
600
|
-
let o =
|
|
599
|
+
if (!e || !a || q(e, a)) continue;
|
|
600
|
+
let o = G(n, i);
|
|
601
601
|
o == null || o === "" || t.push({
|
|
602
602
|
rowId: n,
|
|
603
603
|
columnId: i,
|
|
@@ -606,7 +606,7 @@ var D = (e) => {
|
|
|
606
606
|
});
|
|
607
607
|
}
|
|
608
608
|
if (t.length !== 0) {
|
|
609
|
-
|
|
609
|
+
at(t);
|
|
610
610
|
for (let e of t) i("commit", e);
|
|
611
611
|
i("change", t);
|
|
612
612
|
}
|
|
@@ -614,14 +614,14 @@ var D = (e) => {
|
|
|
614
614
|
function et(e) {
|
|
615
615
|
if (Qe().length === 0) return;
|
|
616
616
|
let t = [
|
|
617
|
-
...
|
|
618
|
-
...
|
|
619
|
-
...
|
|
620
|
-
].map((e) => e.id), n =
|
|
617
|
+
...U.value,
|
|
618
|
+
...H.value,
|
|
619
|
+
...W.value
|
|
620
|
+
].map((e) => e.id), n = N.value.map((e) => e.id), r = Math.min(t.indexOf(T.value.startRowId), t.indexOf(T.value.endRowId)), i = Math.max(t.indexOf(T.value.startRowId), t.indexOf(T.value.endRowId)), a = Math.min(n.indexOf(T.value.startColumnId), n.indexOf(T.value.endColumnId)), o = Math.max(n.indexOf(T.value.startColumnId), n.indexOf(T.value.endColumnId)), s = [];
|
|
621
621
|
for (let e = r; e <= i; e++) {
|
|
622
622
|
let r = [];
|
|
623
623
|
for (let i = a; i <= o; i++) {
|
|
624
|
-
let a =
|
|
624
|
+
let a = G(t[e], n[i]);
|
|
625
625
|
r.push(a == null ? "" : String(a));
|
|
626
626
|
}
|
|
627
627
|
s.push(r.join(" "));
|
|
@@ -632,28 +632,28 @@ var D = (e) => {
|
|
|
632
632
|
et(e), $e();
|
|
633
633
|
}
|
|
634
634
|
function nt(e) {
|
|
635
|
-
if (!
|
|
635
|
+
if (!w.value) return;
|
|
636
636
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
637
637
|
if (!t) return;
|
|
638
638
|
e.preventDefault();
|
|
639
639
|
let n = t.replace(/\r\n?/g, "\n").split("\n").map((e) => e.split(" ")), a = [
|
|
640
|
-
...
|
|
641
|
-
...
|
|
642
|
-
...
|
|
643
|
-
].map((e) => e.id), o =
|
|
640
|
+
...U.value,
|
|
641
|
+
...H.value,
|
|
642
|
+
...W.value
|
|
643
|
+
].map((e) => e.id), o = N.value.map((e) => e.id), s = a.indexOf(w.value.rowId), c = o.indexOf(w.value.columnId), l = [];
|
|
644
644
|
if (n.forEach((e, t) => {
|
|
645
645
|
e.forEach((e, n) => {
|
|
646
646
|
let i = a[s + t], u = o[c + n];
|
|
647
647
|
if (!i || !u) return;
|
|
648
648
|
let d = r.rows.find((e) => e.id === i), f = r.columns.find((e) => e.id === u);
|
|
649
|
-
if (!d || !f ||
|
|
649
|
+
if (!d || !f || q(d, f)) return;
|
|
650
650
|
let p;
|
|
651
651
|
try {
|
|
652
|
-
p = f.parse ? f.parse(e) :
|
|
652
|
+
p = f.parse ? f.parse(e) : Ce(f, e);
|
|
653
653
|
} catch {
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
|
-
let m =
|
|
656
|
+
let m = G(i, u);
|
|
657
657
|
m !== p && l.push({
|
|
658
658
|
rowId: i,
|
|
659
659
|
columnId: u,
|
|
@@ -662,16 +662,16 @@ var D = (e) => {
|
|
|
662
662
|
});
|
|
663
663
|
});
|
|
664
664
|
}), l.length !== 0) {
|
|
665
|
-
|
|
665
|
+
at(l);
|
|
666
666
|
for (let e of l) i("commit", e);
|
|
667
667
|
i("change", l);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
670
|
function rt(e, t) {
|
|
671
|
-
let n = e.clientX, r =
|
|
671
|
+
let n = e.clientX, r = P(t), i = t.minWidth ?? 60, a = (e) => {
|
|
672
672
|
let a = Math.max(i, r + (e.clientX - n));
|
|
673
|
-
|
|
674
|
-
...
|
|
673
|
+
c.value = {
|
|
674
|
+
...c.value,
|
|
675
675
|
[t.id]: a
|
|
676
676
|
};
|
|
677
677
|
}, o = () => {
|
|
@@ -680,19 +680,19 @@ var D = (e) => {
|
|
|
680
680
|
window.addEventListener("mousemove", a), window.addEventListener("mouseup", o);
|
|
681
681
|
}
|
|
682
682
|
function it(e) {
|
|
683
|
-
e.sortable && (
|
|
683
|
+
e.sortable && (h.value?.columnId === e.id ? h.value = h.value.direction === "asc" ? {
|
|
684
684
|
columnId: e.id,
|
|
685
685
|
direction: "desc"
|
|
686
|
-
} : null :
|
|
686
|
+
} : null : h.value = {
|
|
687
687
|
columnId: e.id,
|
|
688
688
|
direction: "asc"
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
|
|
691
|
+
function at(e) {
|
|
692
|
+
j.value.push(e), M.value = [];
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
let e =
|
|
694
|
+
function ot() {
|
|
695
|
+
let e = j.value.pop();
|
|
696
696
|
if (!e) return;
|
|
697
697
|
let t = e.map((e) => ({
|
|
698
698
|
...e,
|
|
@@ -700,102 +700,104 @@ var D = (e) => {
|
|
|
700
700
|
after: e.before
|
|
701
701
|
}));
|
|
702
702
|
for (let e of t) i("commit", e);
|
|
703
|
-
i("change", t),
|
|
703
|
+
i("change", t), M.value.push(e);
|
|
704
704
|
}
|
|
705
|
-
function
|
|
706
|
-
let e =
|
|
705
|
+
function st() {
|
|
706
|
+
let e = M.value.pop();
|
|
707
707
|
if (e) {
|
|
708
708
|
for (let t of e) i("commit", t);
|
|
709
|
-
i("change", e),
|
|
709
|
+
i("change", e), j.value.push(e);
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
return te(() => {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}),
|
|
716
|
-
}), ee(() =>
|
|
717
|
-
focus: (e, t) =>
|
|
718
|
-
undo:
|
|
719
|
-
redo:
|
|
720
|
-
getSelection: () =>
|
|
713
|
+
Y(), R(), V(), typeof ResizeObserver < "u" && o.value && (z = new ResizeObserver(() => {
|
|
714
|
+
R(), V();
|
|
715
|
+
}), z.observe(o.value), a.value && z.observe(a.value));
|
|
716
|
+
}), ee(() => z?.disconnect()), t({
|
|
717
|
+
focus: (e, t) => J(e, t),
|
|
718
|
+
undo: ot,
|
|
719
|
+
redo: st,
|
|
720
|
+
getSelection: () => T.value
|
|
721
721
|
}), (t, n) => (y(), p("div", {
|
|
722
|
+
ref_key: "rootRef",
|
|
723
|
+
ref: a,
|
|
722
724
|
class: _(["nb-spreadsheet", {
|
|
723
|
-
"nb-spreadsheet--editing": !!
|
|
725
|
+
"nb-spreadsheet--editing": !!D.value,
|
|
724
726
|
"nb-spreadsheet--fit": e.fit
|
|
725
727
|
}]),
|
|
726
|
-
style: v(
|
|
727
|
-
}, [t.$slots.toolbar ? (y(), p("div",
|
|
728
|
+
style: v(ve.value)
|
|
729
|
+
}, [t.$slots.toolbar ? (y(), p("div", se, [ne(t.$slots, "toolbar", {}, void 0, !0)])) : f("", !0), m("div", {
|
|
728
730
|
ref_key: "scrollerRef",
|
|
729
|
-
ref:
|
|
731
|
+
ref: o,
|
|
730
732
|
class: "nb-spreadsheet__scroller",
|
|
731
733
|
tabindex: "0",
|
|
732
|
-
onKeydown:
|
|
734
|
+
onKeydown: qe,
|
|
733
735
|
onCopy: et,
|
|
734
736
|
onCut: tt,
|
|
735
737
|
onPaste: nt,
|
|
736
|
-
onScroll:
|
|
738
|
+
onScroll: We
|
|
737
739
|
}, [m("div", {
|
|
738
740
|
class: "nb-spreadsheet__grid",
|
|
739
|
-
style: v(
|
|
741
|
+
style: v(ye.value)
|
|
740
742
|
}, [
|
|
741
|
-
e.showGutter ? (y(), p("div",
|
|
742
|
-
(y(!0), p(u, null, x(
|
|
743
|
+
e.showGutter ? (y(), p("div", ce)) : f("", !0),
|
|
744
|
+
(y(!0), p(u, null, x(N.value, (t, n) => (y(), p("div", {
|
|
743
745
|
key: `h-${t.id}`,
|
|
744
|
-
class: _(["nb-spreadsheet__header",
|
|
746
|
+
class: _(["nb-spreadsheet__header", De(t)]),
|
|
745
747
|
"data-header-col": t.id,
|
|
746
|
-
style: v(
|
|
748
|
+
style: v(Ae(t, n)),
|
|
747
749
|
onClick: (e) => it(t)
|
|
748
750
|
}, [
|
|
749
751
|
m("span", {
|
|
750
752
|
class: "nb-spreadsheet__header-label",
|
|
751
|
-
title:
|
|
752
|
-
}, S(
|
|
753
|
-
|
|
753
|
+
title: B.value.has(t.id) ? t.label : void 0
|
|
754
|
+
}, S(B.value.has(t.id) ? t.shortLabel : t.label), 9, ue),
|
|
755
|
+
h.value && h.value.columnId === t.id ? (y(), p("span", de, S(h.value.direction === "asc" ? "▲" : "▼"), 1)) : f("", !0),
|
|
754
756
|
e.resizable ? (y(), p("span", {
|
|
755
757
|
key: 1,
|
|
756
758
|
class: "nb-spreadsheet__resize-handle",
|
|
757
|
-
onMousedown:
|
|
758
|
-
}, null, 40,
|
|
759
|
-
], 14,
|
|
760
|
-
(y(!0), p(u, null, x(
|
|
759
|
+
onMousedown: oe((e) => rt(e, t), ["stop"])
|
|
760
|
+
}, null, 40, fe)) : f("", !0)
|
|
761
|
+
], 14, le))), 128)),
|
|
762
|
+
(y(!0), p(u, null, x(xe.value, (t) => (y(), p(u, { key: `r-${t.id}` }, [e.showGutter ? (y(), p("div", {
|
|
761
763
|
key: 0,
|
|
762
764
|
class: _(["nb-spreadsheet__gutter", {
|
|
763
765
|
"nb-spreadsheet__gutter--pinned-top": t.pinned === "top",
|
|
764
766
|
"nb-spreadsheet__gutter--pinned-bottom": t.pinned === "bottom"
|
|
765
767
|
}]),
|
|
766
|
-
style: v(
|
|
767
|
-
}, S(
|
|
768
|
+
style: v(Pe(t))
|
|
769
|
+
}, S(Ne(t)), 7)) : f("", !0), (y(!0), p(u, null, x(N.value, (e, r) => (y(), p("div", {
|
|
768
770
|
key: `c-${t.id}-${e.id}`,
|
|
769
|
-
class: _(["nb-spreadsheet__cell",
|
|
770
|
-
style: v(
|
|
771
|
-
title:
|
|
771
|
+
class: _(["nb-spreadsheet__cell", Te(t, e)]),
|
|
772
|
+
style: v(je(t, e, r)),
|
|
773
|
+
title: Ee(t, e),
|
|
772
774
|
"data-cell": `${t.id}::${e.id}`,
|
|
773
775
|
"data-row": t.id,
|
|
774
776
|
"data-col": e.id,
|
|
775
|
-
onPointerdown: n[0] ||= (e) =>
|
|
776
|
-
onMousedown: (n) =>
|
|
777
|
-
onMouseenter: (n) =>
|
|
778
|
-
onDblclick: (n) =>
|
|
779
|
-
}, [m("span", null, S(
|
|
780
|
-
], 4),
|
|
777
|
+
onPointerdown: n[0] ||= (e) => Ie(e),
|
|
778
|
+
onMousedown: (n) => Le(n, t, e),
|
|
779
|
+
onMouseenter: (n) => Re(t, e),
|
|
780
|
+
onDblclick: (n) => Be(t, e)
|
|
781
|
+
}, [m("span", null, S(we(t, e)), 1)], 46, pe))), 128))], 64))), 128))
|
|
782
|
+
], 4), D.value ? ae((y(), p("input", {
|
|
781
783
|
key: 0,
|
|
782
784
|
ref_key: "editorRef",
|
|
783
|
-
ref:
|
|
784
|
-
"onUpdate:modelValue": n[1] ||= (e) =>
|
|
785
|
+
ref: s,
|
|
786
|
+
"onUpdate:modelValue": n[1] ||= (e) => D.value.draft = e,
|
|
785
787
|
class: "nb-spreadsheet__editor",
|
|
786
|
-
style: v(
|
|
787
|
-
inputmode:
|
|
788
|
+
style: v(Ye.value),
|
|
789
|
+
inputmode: Je.value,
|
|
788
790
|
enterkeyhint: "next",
|
|
789
|
-
onBlur: n[2] ||= (e) =>
|
|
790
|
-
onKeydown:
|
|
791
|
-
}, null, 44,
|
|
791
|
+
onBlur: n[2] ||= (e) => Ze(!1),
|
|
792
|
+
onKeydown: oe(Xe, ["stop"])
|
|
793
|
+
}, null, 44, me)), [[re, D.value.draft]]) : f("", !0)], 544)], 6));
|
|
792
794
|
}
|
|
793
|
-
}),
|
|
794
|
-
Object.keys(
|
|
795
|
-
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r =
|
|
795
|
+
}), P = /* @__PURE__ */ r({ default: () => F }), F = /* @__PURE__ */ c(N, [["__scopeId", "data-v-d10d022d"]]), I = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": P }), L = { install(e) {
|
|
796
|
+
Object.keys(I).forEach((t) => {
|
|
797
|
+
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = I[t];
|
|
796
798
|
e.component(n, r.default);
|
|
797
799
|
});
|
|
798
|
-
} },
|
|
800
|
+
} }, R = { install(e, t = {}) {
|
|
799
801
|
if (t.components) for (let [n, r] of Object.entries(t.components)) e.component(n, r);
|
|
800
802
|
if (e.provide(n, { ...t.button }), t.ssr) {
|
|
801
803
|
let t = b(!0);
|
|
@@ -806,7 +808,7 @@ var D = (e) => {
|
|
|
806
808
|
return t.value = !1, r;
|
|
807
809
|
});
|
|
808
810
|
}
|
|
809
|
-
e.use(
|
|
811
|
+
e.use(A), e.use(j);
|
|
810
812
|
} };
|
|
811
813
|
//#endregion
|
|
812
|
-
export {
|
|
814
|
+
export { j as a, M as i, L as n, O as o, F as r, R as t };
|