@nubisco/ui 5.30.0 → 5.31.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/all.cjs +1 -1
- package/dist/all.mjs +1 -1
- package/dist/components/labs/Spreadsheet.d.ts +8 -0
- package/dist/components/labs/Spreadsheet.vue.d.ts +1 -0
- 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-8_dE3Ta1.cjs +4 -0
- package/dist/{main-3k7sSIY5.js → main-B7CVGoiq.js} +510 -412
- package/dist/styles/main.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/main-DmyKNXAy.cjs +0 -4
|
@@ -2,17 +2,17 @@ import { prefersReducedMotion as e } from "./composables/useReducedMotion.compos
|
|
|
2
2
|
import { TOUR_STEP_ATTRIBUTE as t } from "./utils/tourTarget.helper.mjs";
|
|
3
3
|
import { NB_COMMAND_PALETTE_KEY as n, createCommandPaletteState as r } from "./composables/useCommandPalette.composable.mjs";
|
|
4
4
|
import { t as i } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
5
|
-
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onMounted as m, openBlock as h, ref as g, renderList as ee, renderSlot as te, toDisplayString as
|
|
5
|
+
import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onMounted as m, openBlock as h, ref as g, renderList as ee, renderSlot as te, toDisplayString as ne, useTemplateRef as re, vModelText as ie, withDirectives as ae, withModifiers as oe } from "vue";
|
|
6
6
|
//#region \0rolldown/runtime.js
|
|
7
|
-
var
|
|
7
|
+
var _ = Object.defineProperty, v = (e, t) => {
|
|
8
8
|
let n = {};
|
|
9
|
-
for (var r in e)
|
|
9
|
+
for (var r in e) _(n, r, {
|
|
10
10
|
get: e[r],
|
|
11
11
|
enumerable: !0
|
|
12
12
|
});
|
|
13
|
-
return t ||
|
|
14
|
-
},
|
|
15
|
-
function
|
|
13
|
+
return t || _(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
14
|
+
}, y = /* @__PURE__ */ v({ default: () => b });
|
|
15
|
+
function b(e) {
|
|
16
16
|
e.directive("nb-context-menu", {
|
|
17
17
|
mounted(e, t) {
|
|
18
18
|
let n = (e) => {
|
|
@@ -40,10 +40,10 @@ function x(e) {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/directives/ToolTip.content.ts
|
|
43
|
-
var
|
|
44
|
-
devWarn: () =>
|
|
45
|
-
renderTooltipContent: () =>
|
|
46
|
-
}),
|
|
43
|
+
var x = /* @__PURE__ */ v({
|
|
44
|
+
devWarn: () => j,
|
|
45
|
+
renderTooltipContent: () => N
|
|
46
|
+
}), S = new Set([
|
|
47
47
|
"span",
|
|
48
48
|
"div",
|
|
49
49
|
"p",
|
|
@@ -60,17 +60,17 @@ var S = /* @__PURE__ */ y({
|
|
|
60
60
|
"ul",
|
|
61
61
|
"ol",
|
|
62
62
|
"li"
|
|
63
|
-
]),
|
|
63
|
+
]), C = new Set(["br"]), w = new Set([
|
|
64
64
|
"class",
|
|
65
65
|
"style",
|
|
66
66
|
"dir",
|
|
67
67
|
"lang"
|
|
68
|
-
]), se = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"),
|
|
68
|
+
]), se = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), ce = new Set(/* @__PURE__ */ "color.background-color.font-family.font-size.font-style.font-variant.font-weight.letter-spacing.line-height.text-align.text-decoration.text-transform.white-space.word-break.overflow-wrap.opacity.display.flex-direction.align-items.justify-content.gap.margin.margin-top.margin-right.margin-bottom.margin-left.padding.padding-top.padding-right.padding-bottom.padding-left.max-width.min-width.border-radius".split(".")), T = /url\(|image-set\(|expression\(|javascript:|@import|\\/i, le = /^[A-Za-z_-][A-Za-z0-9_-]*$/, E = (e) => e.split(";").map((e) => {
|
|
69
69
|
let t = e.indexOf(":");
|
|
70
70
|
if (t < 0) return "";
|
|
71
71
|
let n = e.slice(0, t).trim().toLowerCase(), r = e.slice(t + 1).trim();
|
|
72
|
-
return !n || !r ? "" :
|
|
73
|
-
}).filter(Boolean).join("; "),
|
|
72
|
+
return !n || !r ? "" : ce.has(n) ? T.test(r) ? (j(`style-value:${n}`, `The value of "${n}" was dropped: tooltip content may not load a resource or call a CSS function that does.`), "") : `${n}: ${r}` : (j(`style:${n}`, `"${n}" is not an allowed tooltip content style property and was dropped.`), "");
|
|
73
|
+
}).filter(Boolean).join("; "), D = (e) => e.split(/\s+/).filter((e) => e ? le.test(e) ? !0 : (j(`class:${e}`, `"${e}" is not a valid class token for tooltip content and was dropped.`), !1) : !1).join(" "), ue = (e, t) => e === "style" ? E(t) : e === "class" ? D(t) : t, O = new Set([
|
|
74
74
|
"b",
|
|
75
75
|
"strong",
|
|
76
76
|
"em",
|
|
@@ -82,47 +82,47 @@ var S = /* @__PURE__ */ y({
|
|
|
82
82
|
"kbd",
|
|
83
83
|
"br",
|
|
84
84
|
"p"
|
|
85
|
-
]),
|
|
85
|
+
]), k = {
|
|
86
86
|
"<": "<",
|
|
87
87
|
">": ">",
|
|
88
88
|
"\"": """,
|
|
89
89
|
"'": "'"
|
|
90
|
-
},
|
|
90
|
+
}, A = (e) => e.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]{1,10}|#\d{1,7}|#[xX][0-9a-fA-F]{1,6});)/g, "&").replace(/[<>"']/g, (e) => k[e]), de = (e) => e.split(/(<[^<>]*>)/g).map((e) => {
|
|
91
91
|
if (e.startsWith("<") && e.endsWith(">")) {
|
|
92
92
|
let t = /^<\s*(\/?)\s*([a-zA-Z][a-zA-Z0-9]*)\s*\/?\s*>$/.exec(e), n = t?.[2]?.toLowerCase();
|
|
93
|
-
return n &&
|
|
93
|
+
return n && O.has(n) ? `<${t[1]}${n}>` : (n && j(`string-tag:${n}`, `<${n}> is not allowed in a tooltip string and was shown as text. Use the structured content form for anything richer.`), A(e));
|
|
94
94
|
}
|
|
95
|
-
return
|
|
96
|
-
}).join(""),
|
|
97
|
-
typeof process < "u" && process.env.NODE_ENV === "production" ||
|
|
98
|
-
},
|
|
99
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
95
|
+
return A(e).replace(/\n/g, "<br>");
|
|
96
|
+
}).join(""), fe = /* @__PURE__ */ new Set(), j = (e, t) => {
|
|
97
|
+
typeof process < "u" && process.env.NODE_ENV === "production" || fe.has(e) || (fe.add(e), console.warn(`[nb-tooltip] ${t}`));
|
|
98
|
+
}, M = (e) => {
|
|
99
|
+
if (Array.isArray(e)) return e.map((e) => M(e)).join("");
|
|
100
100
|
if (!e || typeof e != "object" || !e.component) return "";
|
|
101
|
-
let { component: t, props: n = {}, children: r, content: i } = e, a = r === void 0 ? i : r, o = Array.isArray(a) ?
|
|
102
|
-
if (!
|
|
103
|
-
let c = Object.entries(n).filter(([e]) =>
|
|
104
|
-
return
|
|
105
|
-
},
|
|
106
|
-
default: () =>
|
|
107
|
-
dismissAllTooltips: () =>
|
|
108
|
-
}),
|
|
101
|
+
let { component: t, props: n = {}, children: r, content: i } = e, a = r === void 0 ? i : r, o = Array.isArray(a) ? M(a) : a === void 0 ? "" : de(String(a)), s = String(t).toLowerCase();
|
|
102
|
+
if (!S.has(s)) return j(`tag:${s}`, `<${s}> is not allowed in tooltip content and was dropped. Allowed tags: ${[...S].join(", ")}.`), o;
|
|
103
|
+
let c = Object.entries(n).filter(([e]) => w.has(e) ? !0 : (j(`prop:${e}`, `"${e}" is not an allowed tooltip content prop and was dropped. Allowed props: ${[...w].join(", ")}.`), !1)).map(([e, t]) => [e, ue(e, String(t))]).filter(([, e]) => e !== "").map(([e, t]) => `${e}="${se(t)}"`).join(" "), l = `<${s}${c ? ` ${c}` : ""}>`;
|
|
104
|
+
return C.has(s) ? l : `${l}${o}</${s}>`;
|
|
105
|
+
}, N = (e) => e ? typeof e == "string" ? de(e) : Array.isArray(e) ? M(e) : "" : "", pe = /* @__PURE__ */ v({
|
|
106
|
+
default: () => st,
|
|
107
|
+
dismissAllTooltips: () => yt
|
|
108
|
+
}), me = (e) => e.status ?? e.flavor ?? "default", P = (e) => e.chipClass ?? e.classExtra, F = /* @__PURE__ */ new Set(), he = 0, ge = () => `nb-tooltip-${++he}`, _e = 900, ve = 4e3, ye = 500, I = 0, L = (e, t) => {
|
|
109
109
|
if (!e) return !1;
|
|
110
110
|
let n = Date.now() - e;
|
|
111
111
|
return n >= 0 && n < t;
|
|
112
|
-
},
|
|
113
|
-
if (
|
|
114
|
-
|
|
112
|
+
}, be = !1, xe = () => {
|
|
113
|
+
if (be || typeof document > "u") return;
|
|
114
|
+
be = !0;
|
|
115
115
|
let e = (e) => {
|
|
116
|
-
if (
|
|
116
|
+
if (F.size === 0) return;
|
|
117
117
|
let t = e?.target;
|
|
118
|
-
t instanceof Element && t.closest(".nb-tooltip") ||
|
|
118
|
+
t instanceof Element && t.closest(".nb-tooltip") || vt("dismiss");
|
|
119
119
|
};
|
|
120
120
|
document.addEventListener("pointerdown", () => {
|
|
121
|
-
|
|
121
|
+
I = Date.now();
|
|
122
122
|
}, !0), document.addEventListener("dragstart", () => e(), !0), document.addEventListener("keydown", (t) => {
|
|
123
123
|
t.key === "Escape" && e();
|
|
124
124
|
}, !0), document.addEventListener("pointerdown", e, !0), window.addEventListener("blur", e), document.addEventListener("mouseleave", e);
|
|
125
|
-
},
|
|
125
|
+
}, R = 200, Se = 1e3, Ce = 2, we = (e) => {
|
|
126
126
|
let t = e.tooltipElement;
|
|
127
127
|
if (!t) return !1;
|
|
128
128
|
if (t.__hovered__) return !0;
|
|
@@ -131,38 +131,38 @@ var S = /* @__PURE__ */ y({
|
|
|
131
131
|
} catch {
|
|
132
132
|
return !1;
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, Te = (e) => {
|
|
135
135
|
if (!e.isConnected) return !1;
|
|
136
|
-
if (
|
|
136
|
+
if (we(e) || e.__trigger__ === "focus" && e.contains(document.activeElement) || e.__trigger__ === "touch" && L(e.__lastTouchAt__, ve)) return !0;
|
|
137
137
|
try {
|
|
138
138
|
return e.matches(":hover");
|
|
139
139
|
} catch {
|
|
140
140
|
return !0;
|
|
141
141
|
}
|
|
142
|
-
},
|
|
142
|
+
}, Ee = (e) => {
|
|
143
143
|
clearTimeout(e.__watchdogTimer__), e.__watchdogTimer__ = void 0, e.__watchdogMisses__ = 0;
|
|
144
|
-
},
|
|
145
|
-
|
|
144
|
+
}, z = (e) => {
|
|
145
|
+
Ee(e);
|
|
146
146
|
let t = () => {
|
|
147
147
|
if (!e.__chips__?.size) {
|
|
148
|
-
|
|
148
|
+
Ee(e);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
151
|
+
if (Te(e)) e.__watchdogMisses__ = 0;
|
|
152
152
|
else {
|
|
153
153
|
if (e.__watchdogMisses__ = (e.__watchdogMisses__ ?? 0) + 1, !e.isConnected) {
|
|
154
|
-
|
|
154
|
+
Q(e, !0, "program");
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
if (e.__watchdogMisses__ >=
|
|
158
|
-
|
|
157
|
+
if (e.__watchdogMisses__ >= Ce) {
|
|
158
|
+
ft(e, "dismiss");
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
e.__watchdogTimer__ = setTimeout(t,
|
|
162
|
+
e.__watchdogTimer__ = setTimeout(t, Se);
|
|
163
163
|
};
|
|
164
|
-
e.__watchdogTimer__ = setTimeout(t,
|
|
165
|
-
},
|
|
164
|
+
e.__watchdogTimer__ = setTimeout(t, Se);
|
|
165
|
+
}, B = /* @__PURE__ */ new Set(), V = null, H = (e) => `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`, De = (e) => {
|
|
166
166
|
if (typeof getComputedStyle != "function") return !1;
|
|
167
167
|
let t;
|
|
168
168
|
try {
|
|
@@ -172,110 +172,110 @@ var S = /* @__PURE__ */ y({
|
|
|
172
172
|
}
|
|
173
173
|
let n = `${t.overflow} ${t.overflowX} ${t.overflowY}`;
|
|
174
174
|
return /hidden|scroll|auto|clip|overlay/.test(n);
|
|
175
|
-
},
|
|
175
|
+
}, Oe = (e) => {
|
|
176
176
|
let t = [], n = e.parentElement;
|
|
177
|
-
for (; n && n !== document.body && n !== document.documentElement;)
|
|
177
|
+
for (; n && n !== document.body && n !== document.documentElement;) De(n) && t.push(n), n = n.parentElement;
|
|
178
178
|
return t;
|
|
179
|
-
},
|
|
179
|
+
}, U = (e) => !(e.width === 0 && e.height === 0 && e.top === 0 && e.left === 0), ke = (e, t) => {
|
|
180
180
|
if (!e.isConnected) return !1;
|
|
181
|
-
if (!
|
|
181
|
+
if (!U(t)) return !0;
|
|
182
182
|
if (t.width === 0 || t.height === 0 || !(t.bottom > 0 && t.right > 0 && t.top < window.innerHeight && t.left < window.innerWidth)) return !1;
|
|
183
183
|
for (let n of e.__clippers__ ?? []) {
|
|
184
184
|
if (!n.isConnected) continue;
|
|
185
185
|
let e = n.getBoundingClientRect();
|
|
186
|
-
if (
|
|
186
|
+
if (U(e) && (t.bottom <= e.top || t.top >= e.bottom || t.right <= e.left || t.left >= e.right)) return !1;
|
|
187
187
|
}
|
|
188
188
|
return !0;
|
|
189
|
-
},
|
|
189
|
+
}, Ae = (e) => {
|
|
190
190
|
let t = e.tooltipElement;
|
|
191
191
|
if (!t || !e.__chips__?.size) {
|
|
192
|
-
|
|
192
|
+
B.delete(e);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
let n = e.getBoundingClientRect();
|
|
196
|
-
if (!
|
|
197
|
-
e.__offscreenReported__ || (e.__offscreenReported__ = !0,
|
|
196
|
+
if (!ke(e, n)) {
|
|
197
|
+
e.__offscreenReported__ || (e.__offscreenReported__ = !0, ft(e, "dismiss"));
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
e.__offscreenReported__ = !1, e.__lastRect__ =
|
|
200
|
+
e.__offscreenReported__ = !1, e.__lastRect__ = H(n), e.__side__ !== "cursor" && $(e, t, e.__requestedSide__ ?? e.__side__);
|
|
201
|
+
}, W = () => {
|
|
202
|
+
K();
|
|
203
|
+
for (let e of Array.from(B)) Ae(e);
|
|
204
|
+
}, je = 100, G = 320, Me = 0, Ne = 0, K = () => {
|
|
205
|
+
Ne = Date.now() + G;
|
|
201
206
|
}, q = () => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}, Oe = 100, J = 320, Y = 0, ke = 0, Ae = () => {
|
|
205
|
-
ke = Date.now() + J;
|
|
206
|
-
}, je = () => {
|
|
207
|
-
if (U.size === 0) {
|
|
208
|
-
W = null;
|
|
207
|
+
if (B.size === 0) {
|
|
208
|
+
V = null;
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
let e = Date.now();
|
|
212
|
-
if (e >=
|
|
213
|
-
|
|
212
|
+
if (e >= Ne && e - Me < je) {
|
|
213
|
+
V = requestAnimationFrame(q);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
for (let e of Array.from(
|
|
216
|
+
Me = e;
|
|
217
|
+
for (let e of Array.from(B)) {
|
|
218
218
|
if (!e.tooltipElement) {
|
|
219
|
-
|
|
219
|
+
B.delete(e);
|
|
220
220
|
continue;
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
H(e.getBoundingClientRect()) !== e.__lastRect__ && (K(), Ae(e));
|
|
223
223
|
}
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
|
|
224
|
+
V = requestAnimationFrame(q);
|
|
225
|
+
}, J = !1, Pe = (e) => {
|
|
226
|
+
B.add(e), e.__lastRect__ = void 0, e.__clippers__ = Oe(e), !(typeof window > "u") && (J || (J = !0, document.addEventListener("scroll", W, {
|
|
227
227
|
capture: !0,
|
|
228
228
|
passive: !0
|
|
229
|
-
}), window.addEventListener("resize",
|
|
230
|
-
},
|
|
231
|
-
|
|
229
|
+
}), window.addEventListener("resize", W, { passive: !0 })), V === null && typeof requestAnimationFrame == "function" && (V = requestAnimationFrame(q)));
|
|
230
|
+
}, Y = (e) => {
|
|
231
|
+
B.delete(e), e.__lastRect__ = void 0, e.__clippers__ = void 0, !(B.size > 0 || typeof window > "u") && (J && (J = !1, document.removeEventListener("scroll", W, { capture: !0 }), window.removeEventListener("resize", W)), V !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(V), V = null));
|
|
232
232
|
}, Fe = (t, n, r) => {
|
|
233
233
|
if (t.__chips__?.delete(n), clearTimeout(n.__removeTimer__), n.__removeTimer__ = void 0, r || e()) {
|
|
234
234
|
n.remove();
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
n.style.animation = `tooltipDisappear ${
|
|
237
|
+
n.style.animation = `tooltipDisappear ${R}ms ease-in-out forwards`, n.__removeTimer__ = setTimeout(() => {
|
|
238
238
|
n.__removeTimer__ = void 0, n.remove();
|
|
239
|
-
},
|
|
239
|
+
}, R);
|
|
240
240
|
}, Ie = (e, t) => {
|
|
241
|
-
if (
|
|
242
|
-
e.tooltipElement = void 0, e.__lastContent__ = void 0,
|
|
243
|
-
}, Le = "a[href], button, input, select, textarea, summary, [tabindex]", Re = "data-nb-tooltip-anchor",
|
|
241
|
+
if (Y(e), e.__trigger__ = void 0, e.__side__ = void 0, e.__chips__) for (let n of Array.from(e.__chips__)) Fe(e, n, t);
|
|
242
|
+
e.tooltipElement = void 0, e.__lastContent__ = void 0, Ee(e);
|
|
243
|
+
}, Le = "a[href], button, input, select, textarea, summary, [tabindex]", Re = "data-nb-tooltip-anchor", X = (e, t) => {
|
|
244
244
|
let n = t.target;
|
|
245
245
|
if (!(n instanceof Element) || n === e) return !0;
|
|
246
246
|
let r = n.closest(`[${Re}]`);
|
|
247
247
|
return r === null || r === e;
|
|
248
|
-
},
|
|
249
|
-
let t = e.closest(
|
|
248
|
+
}, ze = "button, a[href], [role=\"button\"], [role=\"tab\"], [role=\"menuitem\"], input, select, textarea, label", Be = (e) => {
|
|
249
|
+
let t = e.closest(ze);
|
|
250
250
|
return !t || t.disabled === !0 ? !1 : t.getAttribute("aria-disabled") !== "true";
|
|
251
|
-
},
|
|
251
|
+
}, Z = (e) => {
|
|
252
252
|
if (!e) return "";
|
|
253
253
|
if (typeof e == "string") return e.replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'").replace(/\s+/g, " ").trim();
|
|
254
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
254
|
+
if (Array.isArray(e)) return e.map((e) => Z(e)).filter(Boolean).join(" ");
|
|
255
255
|
if (typeof e == "object") {
|
|
256
256
|
let t = e;
|
|
257
|
-
return
|
|
257
|
+
return Z(t.children ?? t.content);
|
|
258
258
|
}
|
|
259
259
|
return "";
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
].filter(Boolean).join(". "),
|
|
260
|
+
}, Ve = (e) => [
|
|
261
|
+
Z(e.header),
|
|
262
|
+
Z(e.body),
|
|
263
|
+
Z(e.tip)
|
|
264
|
+
].filter(Boolean).join(". "), He = (e) => {
|
|
265
265
|
if (e.hasAttribute("aria-labelledby") || e.hasAttribute("aria-label") && !e.__ownsAriaLabel__ || e.hasAttribute("title") || (e.textContent ?? "").trim().length > 0) return !0;
|
|
266
266
|
let t = e.querySelector("img[alt]");
|
|
267
267
|
return !!t && (t.getAttribute("alt") ?? "").trim().length > 0;
|
|
268
|
-
},
|
|
268
|
+
}, Ue = (e, t) => {
|
|
269
269
|
let n = t.aria ?? "auto";
|
|
270
|
-
return n === "auto" ?
|
|
271
|
-
},
|
|
272
|
-
if (!t ||
|
|
270
|
+
return n === "auto" ? He(e) ? "description" : "label" : n;
|
|
271
|
+
}, We = (e, t) => {
|
|
272
|
+
if (!t || Ue(e, t) !== "label") {
|
|
273
273
|
e.__ownsAriaLabel__ &&= (e.removeAttribute("aria-label"), !1), e.__ownsRole__ &&= (e.removeAttribute("role"), !1);
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
let n =
|
|
276
|
+
let n = Ve(t);
|
|
277
277
|
n && (e.setAttribute("aria-label", n), e.__ownsAriaLabel__ = !0, !e.__ownsRole__ && !e.hasAttribute("role") && !e.matches(Le) && (e.setAttribute("role", "img"), e.__ownsRole__ = !0));
|
|
278
|
-
},
|
|
278
|
+
}, Ge = (e, t) => {
|
|
279
279
|
let n = !!t?.focusable;
|
|
280
280
|
if (n && !e.__ownsTabIndex__) {
|
|
281
281
|
if (e.matches(Le) || e.hasAttribute("tabindex")) return;
|
|
@@ -283,118 +283,118 @@ var S = /* @__PURE__ */ y({
|
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
!n && e.__ownsTabIndex__ && (e.removeAttribute("tabindex"), e.__ownsTabIndex__ = !1);
|
|
286
|
-
},
|
|
286
|
+
}, Ke = (e, t) => {
|
|
287
287
|
e.__prevDescribedBy__ = e.getAttribute("aria-describedby");
|
|
288
288
|
let n = [e.__prevDescribedBy__, t].filter(Boolean).join(" ");
|
|
289
289
|
e.setAttribute("aria-describedby", n);
|
|
290
|
-
},
|
|
290
|
+
}, qe = (e) => {
|
|
291
291
|
e.__prevDescribedBy__ !== void 0 && (e.__prevDescribedBy__ ? e.setAttribute("aria-describedby", e.__prevDescribedBy__) : e.removeAttribute("aria-describedby"), e.__prevDescribedBy__ = void 0);
|
|
292
|
-
},
|
|
292
|
+
}, Je = "nb-tooltip-description", Ye = (e) => !!e && !!(e.body || e.header || e.tip), Xe = (e, t) => {
|
|
293
293
|
if (typeof document > "u") return;
|
|
294
|
-
let n = t &&
|
|
294
|
+
let n = t && Ye(t) && Ue(e, t) === "description" ? Ve(t) : "";
|
|
295
295
|
if (!n) {
|
|
296
|
-
|
|
296
|
+
Ze(e);
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
299
|
let r = e.__descNode__;
|
|
300
|
-
r || (r = document.createElement("span"), r.className =
|
|
301
|
-
},
|
|
302
|
-
e.__descNode__ && (
|
|
303
|
-
},
|
|
304
|
-
if (
|
|
300
|
+
r || (r = document.createElement("span"), r.className = Je, r.id = ge(), r.setAttribute("role", "tooltip"), document.body.appendChild(r), e.__descNode__ = r, Ke(e, r.id)), e.__descText__ !== n && (r.textContent = n, e.__descText__ = n);
|
|
301
|
+
}, Ze = (e) => {
|
|
302
|
+
e.__descNode__ && (qe(e), e.__descNode__.remove(), e.__descNode__ = void 0, e.__descText__ = void 0);
|
|
303
|
+
}, Qe = (e, t) => {
|
|
304
|
+
if (Ye(t)) {
|
|
305
305
|
e.__prevTitle__ === void 0 && e.hasAttribute("title") && (e.__prevTitle__ = e.getAttribute("title") ?? "", e.removeAttribute("title"));
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
},
|
|
308
|
+
$e(e);
|
|
309
|
+
}, $e = (e) => {
|
|
310
310
|
e.__prevTitle__ !== void 0 && (e.hasAttribute("title") || e.setAttribute("title", e.__prevTitle__), e.__prevTitle__ = void 0);
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
},
|
|
311
|
+
}, et = (e, t) => {
|
|
312
|
+
Qe(e, t), We(e, t), Xe(e, t);
|
|
313
|
+
}, tt = (e) => e.disabled === !0 ? !0 : !!e.closest?.("fieldset[disabled]") && !e.closest?.("fieldset[disabled] > legend:first-of-type"), nt = (e, t, n) => t >= e.left && t <= e.right && n >= e.top && n <= e.bottom, rt = (e) => {
|
|
314
314
|
let t = e.__proxyHost__;
|
|
315
315
|
t && (e.__proxyMove__ && t.removeEventListener("mousemove", e.__proxyMove__), e.__proxyLeave__ && t.removeEventListener("mouseleave", e.__proxyLeave__), e.__proxyHost__ = void 0, e.__proxyMove__ = void 0, e.__proxyLeave__ = void 0, e.__proxyInside__ = !1);
|
|
316
|
-
},
|
|
317
|
-
let t = e.__tooltipBinding__ &&
|
|
318
|
-
e.__proxyHost__ !== t && (
|
|
316
|
+
}, it = (e) => {
|
|
317
|
+
let t = e.__tooltipBinding__ && tt(e) ? e.parentElement : null;
|
|
318
|
+
e.__proxyHost__ !== t && (rt(e), t && (e.__proxyMove__ = ((t) => {
|
|
319
319
|
let n = t;
|
|
320
320
|
if (n.buttons) return;
|
|
321
321
|
let r = e.getBoundingClientRect();
|
|
322
|
-
if (
|
|
323
|
-
e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY, e.__proxyInside__ ? e.__tooltipBinding__?.followCursor &&
|
|
322
|
+
if (U(r) ? nt(r, n.clientX, n.clientY) : t.target === e || e.contains(t.target)) {
|
|
323
|
+
e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY, e.__proxyInside__ ? e.__tooltipBinding__?.followCursor && $(e, e.tooltipElement, e.__requestedSide__) : (e.__proxyInside__ = !0, e.__showTooltip__?.("pointer"));
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
326
|
e.__proxyInside__ && (e.__proxyInside__ = !1, e.__hideTooltip__?.(void 0, "pointer"));
|
|
327
327
|
}), e.__proxyLeave__ = (() => {
|
|
328
328
|
e.__proxyInside__ && (e.__proxyInside__ = !1, e.__hideTooltip__?.(void 0, "pointer"));
|
|
329
329
|
}), t.addEventListener("mousemove", e.__proxyMove__), t.addEventListener("mouseleave", e.__proxyLeave__), e.__proxyHost__ = t));
|
|
330
|
-
},
|
|
331
|
-
e.onOpenChange ||
|
|
332
|
-
},
|
|
330
|
+
}, at = (e) => {
|
|
331
|
+
e.onOpenChange || j("controlled-no-handler", "a tooltip was given `open` but no `onOpenChange`, so nothing the user does (hover, blur, Escape) can change it. Either handle `onOpenChange` or drop `open` and let the directive own visibility.");
|
|
332
|
+
}, ot = (e, t) => {
|
|
333
333
|
if (!t) return;
|
|
334
334
|
let n = t.open === void 0 ? e.__openState__ === void 0 && t.defaultOpen ? !0 : void 0 : t.open;
|
|
335
335
|
n !== void 0 && n !== (e.__openState__ === !0 || !!e.__showTimer__) && (n ? e.__showTooltip__?.("program") : e.__hideTooltip__?.(0, "program"));
|
|
336
|
-
},
|
|
337
|
-
|
|
336
|
+
}, st = (e) => {
|
|
337
|
+
xe();
|
|
338
338
|
let t = e.config.globalProperties.$router;
|
|
339
339
|
t && t.beforeEach(() => {
|
|
340
|
-
|
|
340
|
+
F.forEach((e) => e?.__hideTooltip__?.(0, "program")), F.clear();
|
|
341
341
|
}), e.directive("nb-tooltip", {
|
|
342
342
|
mounted(e, t) {
|
|
343
343
|
e.__showTooltip__ = (t = "pointer") => {
|
|
344
344
|
let n = e.__tooltipBinding__;
|
|
345
345
|
if (n) {
|
|
346
346
|
if (n.open !== void 0 && t !== "program") {
|
|
347
|
-
|
|
347
|
+
at(n), n.onOpenChange?.(!0, t);
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0,
|
|
350
|
+
clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, dt(e, n, t);
|
|
351
351
|
}
|
|
352
352
|
}, e.__hideTooltip__ = (t = e.__tooltipBinding__?.hideDelay ?? 150, n = "dismiss") => {
|
|
353
353
|
let r = e.__tooltipBinding__;
|
|
354
354
|
if (r?.open !== void 0 && n !== "program") {
|
|
355
|
-
|
|
355
|
+
at(r), r.onOpenChange?.(!1, n);
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
358
|
if (clearTimeout(e.__hideTimer__), t <= 0) {
|
|
359
|
-
e.__hideTimer__ = void 0,
|
|
359
|
+
e.__hideTimer__ = void 0, Q(e, !0, n);
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
362
|
e.__hideTimer__ = setTimeout(() => {
|
|
363
|
-
e.__hideTimer__ = void 0,
|
|
363
|
+
e.__hideTimer__ = void 0, Q(e, t <= 0, n);
|
|
364
364
|
}, t);
|
|
365
365
|
}, e.__mouseMove__ = (t) => {
|
|
366
|
-
e.__mouseX__ = t.clientX, e.__mouseY__ = t.clientY, e.__tooltipBinding__?.followCursor &&
|
|
366
|
+
e.__mouseX__ = t.clientX, e.__mouseY__ = t.clientY, e.__tooltipBinding__?.followCursor && $(e, e.tooltipElement, e.__tooltipBinding__?.position);
|
|
367
367
|
}, e.__tooltipBinding__ = t.value, e.__showHandler__ = (t) => {
|
|
368
|
-
if (
|
|
368
|
+
if (L(e.__lastTouchAt__, _e)) return;
|
|
369
369
|
let n = t;
|
|
370
370
|
n.buttons || (typeof n.clientX == "number" && (n.clientX || n.clientY) && (e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY), e.__showTooltip__?.("pointer"));
|
|
371
371
|
}, e.__hideHandler__ = () => e.__hideTooltip__?.(void 0, "pointer"), e.__focusHandler__ = (t) => {
|
|
372
|
-
|
|
372
|
+
L(I, ye) || X(e, t) && e.__showTooltip__?.("focus");
|
|
373
373
|
}, e.__blurHandler__ = () => e.__hideTooltip__?.(void 0, "focus"), e.__touchHandler__ = (t) => {
|
|
374
|
-
e.__tooltipBinding__?.touch !== !1 &&
|
|
375
|
-
},
|
|
374
|
+
e.__tooltipBinding__?.touch !== !1 && X(e, t) && (e.__lastTouchAt__ = Date.now(), !Be(e) && (e.__showTooltip__?.("touch"), e.__hideTooltip__?.(ve, "touch")));
|
|
375
|
+
}, Ge(e, t.value), et(e, t.value), e.setAttribute(Re, ""), e.addEventListener("mouseenter", e.__showHandler__), e.addEventListener("mouseleave", e.__hideHandler__), e.addEventListener("mousemove", e.__mouseMove__), e.addEventListener("focusin", e.__focusHandler__), e.addEventListener("focusout", e.__blurHandler__), e.addEventListener("touchstart", e.__touchHandler__, { passive: !0 }), it(e), ot(e, t.value);
|
|
376
376
|
},
|
|
377
377
|
updated(e, t) {
|
|
378
378
|
let n = e.__tooltipBinding__;
|
|
379
379
|
if (e.__tooltipBinding__ = t.value, !t.value) {
|
|
380
|
-
|
|
380
|
+
et(e, void 0), Ge(e, void 0), Q(e, !0);
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
if (n !== t.value && (
|
|
384
|
-
let r =
|
|
385
|
-
r !== e.__lastContent__ && (e.__lastContent__ = r,
|
|
383
|
+
if (n !== t.value && (et(e, t.value), Ge(e, t.value)), it(e), ot(e, t.value), !e.tooltipElement || n === t.value) return;
|
|
384
|
+
let r = ut(t.value);
|
|
385
|
+
r !== e.__lastContent__ && (e.__lastContent__ = r, pt(e, t.value));
|
|
386
386
|
},
|
|
387
387
|
unmounted(e) {
|
|
388
|
-
clearTimeout(e.__showTimer__), e.__showTimer__ = void 0, clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0,
|
|
388
|
+
clearTimeout(e.__showTimer__), e.__showTimer__ = void 0, clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, Q(e, !0), F.delete(e), e.__showHandler__ && e.removeEventListener("mouseenter", e.__showHandler__), e.__hideHandler__ && e.removeEventListener("mouseleave", e.__hideHandler__), e.__focusHandler__ && e.removeEventListener("focusin", e.__focusHandler__), e.__blurHandler__ && e.removeEventListener("focusout", e.__blurHandler__), e.__touchHandler__ && e.removeEventListener("touchstart", e.__touchHandler__), Ze(e), $e(e), e.__ownsAriaLabel__ &&= (e.removeAttribute("aria-label"), !1), e.__ownsTabIndex__ &&= (e.removeAttribute("tabindex"), !1), e.__ownsRole__ &&= (e.removeAttribute("role"), !1), e.removeAttribute(Re), rt(e), e.__mouseMove__ && e.removeEventListener("mousemove", e.__mouseMove__), Y(e);
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
|
-
},
|
|
391
|
+
}, ct = ({ header: e = "", body: t = "", tip: n = "" }) => `<div class="nb-tooltip-content"><div class="nb-tooltip-header">${N(e)}</div><div class="nb-tooltip-body">${N(t)}</div><div class="nb-tooltip-tip">${N(n)}</div></div>`, lt = (e, t, n) => [
|
|
392
392
|
"nb-tooltip",
|
|
393
393
|
`nb-tooltip-${e}`,
|
|
394
394
|
t ? `nb-tooltip-flavor-${t}` : "",
|
|
395
395
|
n || ""
|
|
396
|
-
].filter(Boolean).join(" "),
|
|
397
|
-
let { header: i, body: a, tip: o, delay: s = 400, animationTime: c = 300, position: l, overflowOnly: u } = n, d =
|
|
396
|
+
].filter(Boolean).join(" "), ut = (e) => `${e.position ?? ""}|${me(e)}|${P(e) ?? ""}|${ct(e)}`, dt = (t, n, r = "pointer") => {
|
|
397
|
+
let { header: i, body: a, tip: o, delay: s = 400, animationTime: c = 300, position: l, overflowOnly: u } = n, d = me(n), f = P(n);
|
|
398
398
|
if (clearTimeout(t.__showTimer__), t.__showTimer__ = void 0, Ie(t, !0), u) {
|
|
399
399
|
let e = t.getBoundingClientRect();
|
|
400
400
|
if (!(Math.round(e.width) < Math.round(t.scrollWidth))) return;
|
|
@@ -404,9 +404,9 @@ var S = /* @__PURE__ */ y({
|
|
|
404
404
|
t.__showTimer__ = setTimeout(() => {
|
|
405
405
|
if (t.__showTimer__ = void 0, !t.isConnected) return;
|
|
406
406
|
let e = r === "pointer" ? l ?? "cursor" : l && l !== "cursor" ? l : "top";
|
|
407
|
-
for (let e of Array.from(
|
|
407
|
+
for (let e of Array.from(B)) e !== t && ft(e, "superseded");
|
|
408
408
|
let s = document.createElement("span");
|
|
409
|
-
s.className =
|
|
409
|
+
s.className = lt(e, d, f), s.innerHTML = ct({
|
|
410
410
|
header: i,
|
|
411
411
|
body: a,
|
|
412
412
|
tip: o
|
|
@@ -414,29 +414,29 @@ var S = /* @__PURE__ */ y({
|
|
|
414
414
|
s.__hovered__ = !0, clearTimeout(t.__hideTimer__), t.__hideTimer__ = void 0, t.__watchdogMisses__ = 0;
|
|
415
415
|
}), s.addEventListener("mouseleave", () => {
|
|
416
416
|
s.__hovered__ = !1, t.__hideTooltip__?.();
|
|
417
|
-
}), m ? s.style.opacity = "1" : (s.style.transition = `opacity ${c}ms ease-in-out`, s.style.animation = `tooltipAppear ${c}ms ease-in-out forwards`), s.setAttribute("aria-hidden", "true"), t.__trigger__ = r, t.tooltipElement = s, (t.__chips__ ??= /* @__PURE__ */ new Set()).add(s), t.__lastContent__ =
|
|
417
|
+
}), m ? s.style.opacity = "1" : (s.style.transition = `opacity ${c}ms ease-in-out`, s.style.animation = `tooltipAppear ${c}ms ease-in-out forwards`), s.setAttribute("aria-hidden", "true"), t.__trigger__ = r, t.tooltipElement = s, (t.__chips__ ??= /* @__PURE__ */ new Set()).add(s), t.__lastContent__ = ut(n), F.add(t), document.body.appendChild(s), t.__requestedSide__ = e, t.__side__ = e, $(t, s, e), Pe(t), z(t);
|
|
418
418
|
let u = t.__openState__ === !0;
|
|
419
419
|
t.__openState__ = !0, u || n.onOpenChange?.(!0, r);
|
|
420
420
|
}, p);
|
|
421
|
-
},
|
|
421
|
+
}, ft = (e, t, n = !0) => {
|
|
422
422
|
if (e.__hideTooltip__) {
|
|
423
423
|
e.__hideTooltip__(n ? 0 : void 0, t);
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
|
-
|
|
427
|
-
},
|
|
426
|
+
Q(e, n, t);
|
|
427
|
+
}, Q = (e, t = !1, n = "dismiss") => {
|
|
428
428
|
clearTimeout(e.__showTimer__), e.__showTimer__ = void 0;
|
|
429
429
|
let r = e.__openState__ === !0;
|
|
430
|
-
Ie(e, t),
|
|
431
|
-
},
|
|
432
|
-
let { header: n, body: r, tip: i, position: a } = t, o =
|
|
433
|
-
l && (l.innerHTML =
|
|
430
|
+
Ie(e, t), F.delete(e), e.__requestedSide__ = void 0, r && (e.__openState__ = !1, e.__tooltipBinding__?.onOpenChange?.(!1, n));
|
|
431
|
+
}, pt = (e, t) => {
|
|
432
|
+
let { header: n, body: r, tip: i, position: a } = t, o = me(t), s = P(t), c = e.__requestedSide__ ?? e.__side__ ?? a, l = e.tooltipElement;
|
|
433
|
+
l && (l.innerHTML = ct({
|
|
434
434
|
header: n,
|
|
435
435
|
body: r,
|
|
436
436
|
tip: i
|
|
437
|
-
}), l.className =
|
|
437
|
+
}), l.className = lt(e.__side__ ?? c ?? "cursor", o, s), $(e, l, c));
|
|
438
438
|
};
|
|
439
|
-
function
|
|
439
|
+
function mt(e, t, n, r, i, a, o) {
|
|
440
440
|
switch (e) {
|
|
441
441
|
case "top": return {
|
|
442
442
|
top: t.top - (r + i * 2),
|
|
@@ -455,16 +455,16 @@ function ht(e, t, n, r, i, a, o) {
|
|
|
455
455
|
left: t.right + i
|
|
456
456
|
};
|
|
457
457
|
default: return {
|
|
458
|
-
top: o +
|
|
459
|
-
left: a +
|
|
458
|
+
top: o + ht,
|
|
459
|
+
left: a + ht
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
var
|
|
464
|
-
function
|
|
463
|
+
var ht = 14;
|
|
464
|
+
function gt(e, t, n, r, i) {
|
|
465
465
|
return t >= i && e >= i && t + n <= window.innerWidth - i && e + r <= window.innerHeight - i;
|
|
466
466
|
}
|
|
467
|
-
var
|
|
467
|
+
var _t = {
|
|
468
468
|
top: [
|
|
469
469
|
"bottom",
|
|
470
470
|
"right",
|
|
@@ -486,12 +486,12 @@ var vt = {
|
|
|
486
486
|
"bottom"
|
|
487
487
|
],
|
|
488
488
|
cursor: []
|
|
489
|
-
},
|
|
489
|
+
}, $ = (e, t, n) => {
|
|
490
490
|
if (!t) return;
|
|
491
|
-
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = i.width || 0, o = i.height || 0, s = e.__mouseX__ ?? 0, c = e.__mouseY__ ?? 0, l = n ?? "cursor", u = (e) =>
|
|
492
|
-
if (a > 0 && o > 0 && !
|
|
491
|
+
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = i.width || 0, o = i.height || 0, s = e.__mouseX__ ?? 0, c = e.__mouseY__ ?? 0, l = n ?? "cursor", u = (e) => mt(e, r, a, o, 4, s, c), d = u(l), f = l;
|
|
492
|
+
if (a > 0 && o > 0 && !gt(d.top, d.left, a, o, 16)) for (let e of _t[l]) {
|
|
493
493
|
let t = u(e);
|
|
494
|
-
if (
|
|
494
|
+
if (gt(t.top, t.left, a, o, 16)) {
|
|
495
495
|
d = t, f = e;
|
|
496
496
|
break;
|
|
497
497
|
}
|
|
@@ -522,24 +522,24 @@ var vt = {
|
|
|
522
522
|
}
|
|
523
523
|
t.style.top = `${p}px`, t.style.left = `${m}px`;
|
|
524
524
|
};
|
|
525
|
-
function
|
|
526
|
-
for (let t of Array.from(
|
|
525
|
+
function vt(e) {
|
|
526
|
+
for (let t of Array.from(F)) t.__hideTooltip__?.(0, e);
|
|
527
527
|
let t = /* @__PURE__ */ new Set();
|
|
528
|
-
for (let e of Array.from(
|
|
528
|
+
for (let e of Array.from(F)) for (let n of e.__chips__ ?? []) t.add(n);
|
|
529
529
|
document.querySelectorAll("span.nb-tooltip").forEach((e) => {
|
|
530
530
|
t.has(e) || e.remove();
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
for (let e of Array.from(
|
|
535
|
-
|
|
536
|
-
for (let e of Array.from(
|
|
533
|
+
function yt() {
|
|
534
|
+
for (let e of Array.from(F)) e.__hideTooltip__?.(0, "program");
|
|
535
|
+
F.clear();
|
|
536
|
+
for (let e of Array.from(B)) Y(e);
|
|
537
537
|
document.querySelectorAll("span.nb-tooltip").forEach((e) => e.remove());
|
|
538
538
|
}
|
|
539
539
|
//#endregion
|
|
540
540
|
//#region src/directives/TourStep.directive.ts
|
|
541
|
-
var
|
|
542
|
-
function
|
|
541
|
+
var bt = /* @__PURE__ */ v({ default: () => St });
|
|
542
|
+
function xt(e, n) {
|
|
543
543
|
let r = n.value;
|
|
544
544
|
if (r == null || r === "") {
|
|
545
545
|
e.removeAttribute(t);
|
|
@@ -547,41 +547,41 @@ function St(e, n) {
|
|
|
547
547
|
}
|
|
548
548
|
e.setAttribute(t, String(r));
|
|
549
549
|
}
|
|
550
|
-
var
|
|
550
|
+
var St = (e) => {
|
|
551
551
|
e.directive("nb-tour-step", {
|
|
552
|
-
mounted:
|
|
553
|
-
updated:
|
|
552
|
+
mounted: xt,
|
|
553
|
+
updated: xt,
|
|
554
554
|
unmounted(e) {
|
|
555
555
|
e.removeAttribute(t);
|
|
556
556
|
}
|
|
557
557
|
});
|
|
558
|
-
},
|
|
559
|
-
"./ContextMenu.directive.ts":
|
|
560
|
-
"./ToolTip.content.ts":
|
|
561
|
-
"./ToolTip.directive.ts":
|
|
562
|
-
"./TourStep.directive.ts":
|
|
563
|
-
}),
|
|
564
|
-
Object.values(
|
|
558
|
+
}, Ct = /* @__PURE__ */ Object.assign({
|
|
559
|
+
"./ContextMenu.directive.ts": y,
|
|
560
|
+
"./ToolTip.content.ts": x,
|
|
561
|
+
"./ToolTip.directive.ts": pe,
|
|
562
|
+
"./TourStep.directive.ts": bt
|
|
563
|
+
}), wt = { install(e) {
|
|
564
|
+
Object.values(Ct).forEach((t) => {
|
|
565
565
|
typeof t.default == "function" && t.default(e);
|
|
566
566
|
});
|
|
567
|
-
} },
|
|
567
|
+
} }, Tt = { install(e) {
|
|
568
568
|
let t = r();
|
|
569
569
|
e.provide(n, t);
|
|
570
|
-
} },
|
|
570
|
+
} }, Et = {
|
|
571
571
|
key: 0,
|
|
572
572
|
class: "nb-spreadsheet__toolbar"
|
|
573
|
-
},
|
|
573
|
+
}, Dt = {
|
|
574
574
|
key: 0,
|
|
575
575
|
class: "nb-spreadsheet__corner",
|
|
576
576
|
style: {
|
|
577
577
|
gridRow: 1,
|
|
578
578
|
gridColumn: 1
|
|
579
579
|
}
|
|
580
|
-
},
|
|
580
|
+
}, Ot = ["onClick"], kt = { class: "nb-spreadsheet__header-label" }, At = {
|
|
581
581
|
key: 0,
|
|
582
582
|
class: "nb-spreadsheet__sort",
|
|
583
583
|
"aria-hidden": "true"
|
|
584
|
-
},
|
|
584
|
+
}, jt = ["onMousedown"], Mt = [
|
|
585
585
|
"title",
|
|
586
586
|
"data-cell",
|
|
587
587
|
"data-row",
|
|
@@ -589,7 +589,7 @@ var Ct = (e) => {
|
|
|
589
589
|
"onMousedown",
|
|
590
590
|
"onMouseenter",
|
|
591
591
|
"onDblclick"
|
|
592
|
-
],
|
|
592
|
+
], Nt = ["inputmode"], Pt = 36, Ft = 32, It = /* @__PURE__ */ u({
|
|
593
593
|
__name: "Spreadsheet",
|
|
594
594
|
props: {
|
|
595
595
|
columns: {},
|
|
@@ -608,6 +608,7 @@ var Ct = (e) => {
|
|
|
608
608
|
type: Boolean,
|
|
609
609
|
default: !0
|
|
610
610
|
},
|
|
611
|
+
gutterWidth: { default: 44 },
|
|
611
612
|
windowRows: { default: 80 },
|
|
612
613
|
locale: { default: "pt-PT" }
|
|
613
614
|
},
|
|
@@ -619,7 +620,7 @@ var Ct = (e) => {
|
|
|
619
620
|
"row-reorder"
|
|
620
621
|
],
|
|
621
622
|
setup(e, { expose: t, emit: n }) {
|
|
622
|
-
let r = e, i = n, u =
|
|
623
|
+
let r = e, i = n, u = re("scrollerRef"), _ = re("editorRef"), v = g({}), y = g(null), b = g(null), x = g(null), S = g(!1), C = g(null), w = g(0), se = g(0), ce = "", T = g([]), le = g([]), E = o(() => {
|
|
623
624
|
let e = r.columns.filter((e) => e.pinned === "left"), t = r.columns.filter((e) => e.pinned === "right"), n = r.columns.filter((e) => !e.pinned);
|
|
624
625
|
return [
|
|
625
626
|
...e,
|
|
@@ -628,17 +629,17 @@ var Ct = (e) => {
|
|
|
628
629
|
];
|
|
629
630
|
});
|
|
630
631
|
function D(e) {
|
|
631
|
-
return
|
|
632
|
+
return v.value[e.id] ?? e.width ?? 120;
|
|
632
633
|
}
|
|
633
|
-
let
|
|
634
|
+
let ue = o(() => ({ gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") + E.value.map((e) => `${D(e)}px`).join(" ") })), O = o(() => {
|
|
634
635
|
let e = r.rows.filter((e) => !e.pinned);
|
|
635
|
-
if (!
|
|
636
|
-
let t = r.columns.find((e) => e.id ===
|
|
636
|
+
if (!y.value) return e;
|
|
637
|
+
let t = r.columns.find((e) => e.id === y.value.columnId);
|
|
637
638
|
if (!t) return e;
|
|
638
|
-
let n =
|
|
639
|
+
let n = y.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;
|
|
639
640
|
return [...e].sort((e, n) => i(e.values[t.id], n.values[t.id]));
|
|
640
|
-
}), k = o(() => r.rows.filter((e) => e.pinned === "top")), A = o(() => r.rows.filter((e) => e.pinned === "bottom")),
|
|
641
|
-
let e = Math.max(1, Math.ceil((u.value?.clientHeight ?? 600) /
|
|
641
|
+
}), k = o(() => r.rows.filter((e) => e.pinned === "top")), A = o(() => r.rows.filter((e) => e.pinned === "bottom")), de = o(() => {
|
|
642
|
+
let e = Math.max(1, Math.ceil((u.value?.clientHeight ?? 600) / Ft)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(w.value / Ft) - k.value.length - t, i = Math.max(0, n), a = Math.min(O.value.length, i + e + t * 2), o = k.value.map((e, t) => ({
|
|
642
643
|
...e,
|
|
643
644
|
__virtualIndex: t,
|
|
644
645
|
gutterLabel: ""
|
|
@@ -656,7 +657,7 @@ var Ct = (e) => {
|
|
|
656
657
|
...c
|
|
657
658
|
];
|
|
658
659
|
});
|
|
659
|
-
function
|
|
660
|
+
function fe(e, t) {
|
|
660
661
|
if (t == null || t === "") return "";
|
|
661
662
|
if (e.type === "number") {
|
|
662
663
|
let e = typeof t == "number" ? t : Number(t);
|
|
@@ -692,19 +693,19 @@ var Ct = (e) => {
|
|
|
692
693
|
function N(e, t) {
|
|
693
694
|
return r.cellAttrs ? r.cellAttrs(e.id, t.id, e, t) ?? {} : {};
|
|
694
695
|
}
|
|
695
|
-
function
|
|
696
|
+
function pe(e, t) {
|
|
696
697
|
let n = N(e, t);
|
|
697
698
|
if (n.display !== void 0) return n.display;
|
|
698
699
|
let r = M(e.id, t.id);
|
|
699
|
-
return t.format ? t.format(r, e) :
|
|
700
|
+
return t.format ? t.format(r, e) : fe(t, r);
|
|
700
701
|
}
|
|
701
|
-
function
|
|
702
|
-
let n = N(e, t), r =
|
|
702
|
+
function me(e, t) {
|
|
703
|
+
let n = N(e, t), r = b.value?.rowId === e.id && b.value?.columnId === t.id, i = xe(e.id, t.id);
|
|
703
704
|
return {
|
|
704
705
|
[`nb-spreadsheet__cell--${t.align ?? (t.type === "number" || t.type === "date" ? "right" : "left")}`]: !0,
|
|
705
706
|
"nb-spreadsheet__cell--focused": r,
|
|
706
707
|
"nb-spreadsheet__cell--selected": i,
|
|
707
|
-
"nb-spreadsheet__cell--readonly":
|
|
708
|
+
"nb-spreadsheet__cell--readonly": P(e, t),
|
|
708
709
|
"nb-spreadsheet__cell--computed": !!n.computed || !!e.computed,
|
|
709
710
|
"nb-spreadsheet__cell--pinned-top": e.pinned === "top",
|
|
710
711
|
"nb-spreadsheet__cell--pinned-bottom": e.pinned === "bottom",
|
|
@@ -712,31 +713,31 @@ var Ct = (e) => {
|
|
|
712
713
|
[e.className ?? ""]: !!e.className
|
|
713
714
|
};
|
|
714
715
|
}
|
|
715
|
-
function
|
|
716
|
+
function P(e, t) {
|
|
716
717
|
if (e.computed || t.readOnly) return !0;
|
|
717
718
|
let n = N(e, t);
|
|
718
719
|
return !!n.readOnly || !!n.computed;
|
|
719
720
|
}
|
|
720
|
-
function
|
|
721
|
+
function F(e, t) {
|
|
721
722
|
return N(e, t).tooltip ?? "";
|
|
722
723
|
}
|
|
723
|
-
function
|
|
724
|
+
function he(e) {
|
|
724
725
|
return {
|
|
725
726
|
"nb-spreadsheet__header--sortable": !!e.sortable,
|
|
726
727
|
"nb-spreadsheet__header--pinned-left": e.pinned === "left",
|
|
727
728
|
"nb-spreadsheet__header--pinned-right": e.pinned === "right"
|
|
728
729
|
};
|
|
729
730
|
}
|
|
730
|
-
function
|
|
731
|
+
function ge(e) {
|
|
731
732
|
if (e.pinned !== "left") return 0;
|
|
732
|
-
let t = r.showGutter ?
|
|
733
|
+
let t = r.showGutter ? r.gutterWidth : 0;
|
|
733
734
|
for (let n of E.value) {
|
|
734
735
|
if (n.id === e.id) break;
|
|
735
736
|
n.pinned === "left" && (t += D(n));
|
|
736
737
|
}
|
|
737
738
|
return t;
|
|
738
739
|
}
|
|
739
|
-
function
|
|
740
|
+
function _e(e) {
|
|
740
741
|
if (e.pinned !== "right") return 0;
|
|
741
742
|
let t = 0, n = [...E.value].reverse();
|
|
742
743
|
for (let r of n) {
|
|
@@ -745,218 +746,313 @@ var Ct = (e) => {
|
|
|
745
746
|
}
|
|
746
747
|
return t;
|
|
747
748
|
}
|
|
748
|
-
function
|
|
749
|
+
function ve(e, t) {
|
|
749
750
|
let n = (r.showGutter ? 2 : 1) + t, i = {};
|
|
750
|
-
return e.pinned === "left" ? (i.position = "sticky", i.left = `${
|
|
751
|
+
return e.pinned === "left" ? (i.position = "sticky", i.left = `${ge(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${_e(e)}px`, i.zIndex = "3"), {
|
|
751
752
|
gridRow: 1,
|
|
752
753
|
gridColumn: n,
|
|
753
754
|
...i
|
|
754
755
|
};
|
|
755
756
|
}
|
|
756
|
-
function
|
|
757
|
-
let
|
|
758
|
-
return t.pinned === "left" ? (
|
|
759
|
-
gridRow:
|
|
760
|
-
gridColumn:
|
|
761
|
-
...
|
|
757
|
+
function ye(e, t, n) {
|
|
758
|
+
let i = (r.showGutter ? 2 : 1) + n, a = e.__virtualIndex + 2, o = {};
|
|
759
|
+
return t.pinned === "left" ? (o.position = "sticky", o.left = `${ge(t)}px`, o.zIndex = "2") : t.pinned === "right" && (o.position = "sticky", o.right = `${_e(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, I(e))), {
|
|
760
|
+
gridRow: a,
|
|
761
|
+
gridColumn: i,
|
|
762
|
+
...o
|
|
762
763
|
};
|
|
763
764
|
}
|
|
764
|
-
function
|
|
765
|
-
|
|
765
|
+
function I(e) {
|
|
766
|
+
if (e.pinned === "top") {
|
|
767
|
+
let t = k.value.findIndex((t) => t.id === e.id);
|
|
768
|
+
return { top: `calc(var(--nbss-header-height) + var(--nbss-row-height) * ${Math.max(0, t)})` };
|
|
769
|
+
}
|
|
770
|
+
if (e.pinned === "bottom") {
|
|
771
|
+
let t = A.value, n = t.findIndex((t) => t.id === e.id);
|
|
772
|
+
return { bottom: `calc(var(--nbss-row-height) * ${Math.max(0, t.length - 1 - n)})` };
|
|
773
|
+
}
|
|
774
|
+
return {};
|
|
775
|
+
}
|
|
776
|
+
function L(e) {
|
|
777
|
+
return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex - k.value.length + 1) : e.gutterLabel : e.label;
|
|
778
|
+
}
|
|
779
|
+
function be(e) {
|
|
780
|
+
let t = {
|
|
766
781
|
position: "sticky",
|
|
767
782
|
left: "0",
|
|
768
783
|
zIndex: "2"
|
|
769
784
|
};
|
|
770
|
-
return
|
|
771
|
-
gridRow: e + 2,
|
|
785
|
+
return e.pinned && (Object.assign(t, I(e)), t.zIndex = "4"), {
|
|
786
|
+
gridRow: e.__virtualIndex + 2,
|
|
772
787
|
gridColumn: 1,
|
|
773
|
-
...
|
|
788
|
+
...t
|
|
774
789
|
};
|
|
775
790
|
}
|
|
776
|
-
function
|
|
777
|
-
if (!
|
|
791
|
+
function xe(e, t) {
|
|
792
|
+
if (!x.value) return !1;
|
|
778
793
|
let n = [
|
|
779
794
|
...k.value,
|
|
780
795
|
...O.value,
|
|
781
796
|
...A.value
|
|
782
|
-
].map((e) => e.id), r = E.value.map((e) => e.id), i = n.indexOf(
|
|
797
|
+
].map((e) => e.id), r = E.value.map((e) => e.id), i = n.indexOf(x.value.startRowId), a = n.indexOf(x.value.endRowId), o = r.indexOf(x.value.startColumnId), s = r.indexOf(x.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
|
|
783
798
|
return c >= Math.min(i, a) && c <= Math.max(i, a) && l >= Math.min(o, s) && l <= Math.max(o, s);
|
|
784
799
|
}
|
|
785
|
-
function
|
|
786
|
-
|
|
800
|
+
function R(e, t, n = !1) {
|
|
801
|
+
b.value = {
|
|
787
802
|
rowId: e,
|
|
788
803
|
columnId: t
|
|
789
|
-
}, n &&
|
|
790
|
-
...
|
|
804
|
+
}, n && x.value ? x.value = {
|
|
805
|
+
...x.value,
|
|
791
806
|
endRowId: e,
|
|
792
807
|
endColumnId: t
|
|
793
|
-
} :
|
|
808
|
+
} : x.value = {
|
|
794
809
|
startRowId: e,
|
|
795
810
|
startColumnId: t,
|
|
796
811
|
endRowId: e,
|
|
797
812
|
endColumnId: t
|
|
798
|
-
}, i("focus",
|
|
813
|
+
}, i("focus", b.value), i("selection", x.value);
|
|
799
814
|
}
|
|
800
|
-
function
|
|
801
|
-
|
|
815
|
+
function Se(e) {
|
|
816
|
+
ce = e.pointerType;
|
|
802
817
|
}
|
|
803
|
-
function
|
|
804
|
-
!
|
|
805
|
-
|
|
818
|
+
function Ce(e, t, n) {
|
|
819
|
+
let r = ce === "touch" && !e.shiftKey && b.value?.rowId === t.id && b.value?.columnId === n.id;
|
|
820
|
+
if (ce = "", C.value && q(), S.value = !0, R(t.id, n.id, e.shiftKey), z(), e.preventDefault(), document.addEventListener("mouseup", Te, { once: !0 }), r && !P(t, n)) {
|
|
821
|
+
let e = M(t.id, n.id);
|
|
822
|
+
G(t, n, e == null ? "" : String(e), "edit");
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
function we(e, t) {
|
|
826
|
+
!S.value || !x.value || (x.value = {
|
|
827
|
+
...x.value,
|
|
806
828
|
endRowId: e.id,
|
|
807
829
|
endColumnId: t.id
|
|
808
|
-
}, i("selection",
|
|
830
|
+
}, i("selection", x.value));
|
|
831
|
+
}
|
|
832
|
+
function Te() {
|
|
833
|
+
S.value = !1;
|
|
809
834
|
}
|
|
810
|
-
function
|
|
811
|
-
|
|
835
|
+
function Ee(e, t) {
|
|
836
|
+
if (P(e, t)) return;
|
|
837
|
+
let n = M(e.id, t.id);
|
|
838
|
+
G(e, t, n == null ? "" : String(n), "edit");
|
|
812
839
|
}
|
|
813
|
-
function
|
|
814
|
-
|
|
840
|
+
function z() {
|
|
841
|
+
u.value?.focus({ preventScroll: !0 });
|
|
815
842
|
}
|
|
816
|
-
function
|
|
817
|
-
if (!
|
|
818
|
-
let e = E.value[0], t =
|
|
819
|
-
e && t &&
|
|
843
|
+
function B(e, t, n = !1) {
|
|
844
|
+
if (!b.value) {
|
|
845
|
+
let e = E.value[0], t = de.value[0];
|
|
846
|
+
e && t && R(t.id, e.id);
|
|
820
847
|
return;
|
|
821
848
|
}
|
|
822
849
|
let r = [
|
|
823
850
|
...k.value,
|
|
824
851
|
...O.value,
|
|
825
852
|
...A.value
|
|
826
|
-
], i = r.findIndex((e) => e.id ===
|
|
827
|
-
|
|
853
|
+
], i = r.findIndex((e) => e.id === b.value.rowId), a = E.value.findIndex((e) => e.id === b.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(E.value.length - 1, a + t)), c = r[o].id, l = E.value[s].id;
|
|
854
|
+
R(c, l, n), U(c, l);
|
|
828
855
|
}
|
|
829
|
-
function
|
|
830
|
-
|
|
831
|
-
if (t < 0 || !u.value) return;
|
|
832
|
-
let n = t * $, r = u.value;
|
|
833
|
-
n < r.scrollTop ? r.scrollTop = n : n + $ > r.scrollTop + r.clientHeight - It && (r.scrollTop = n - r.clientHeight + It + $);
|
|
856
|
+
function V(e) {
|
|
857
|
+
return e.replace(/["\\]/g, "\\$&");
|
|
834
858
|
}
|
|
835
|
-
function
|
|
836
|
-
|
|
859
|
+
function H(e) {
|
|
860
|
+
let t = u.value?.querySelector(e);
|
|
861
|
+
return t ? t.offsetHeight : 0;
|
|
837
862
|
}
|
|
838
|
-
function
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
863
|
+
function De(e) {
|
|
864
|
+
let t = 0;
|
|
865
|
+
for (let n of e) t += H(`[data-row="${V(n.id)}"]`);
|
|
866
|
+
return t;
|
|
867
|
+
}
|
|
868
|
+
function Oe(e) {
|
|
869
|
+
let t = e === "left" && r.showGutter ? r.gutterWidth : 0;
|
|
870
|
+
for (let n of E.value) n.pinned === e && (t += D(n));
|
|
871
|
+
return t;
|
|
872
|
+
}
|
|
873
|
+
function U(e, t) {
|
|
874
|
+
let n = u.value;
|
|
875
|
+
if (!n) return;
|
|
876
|
+
let i = O.value.findIndex((t) => t.id === e);
|
|
877
|
+
if (i >= 0) {
|
|
878
|
+
let e = H(".nb-spreadsheet__header") || Pt, t = H(".nb-spreadsheet__cell") || Ft, r = e + (k.value.length + i) * t, a = e + De(k.value), o = De(A.value);
|
|
879
|
+
r - a < n.scrollTop ? n.scrollTop = r - a : r + t > n.scrollTop + n.clientHeight - o && (n.scrollTop = r + t - n.clientHeight + o);
|
|
880
|
+
}
|
|
881
|
+
let a = t ? E.value.find((e) => e.id === t) : void 0;
|
|
882
|
+
if (a && !a.pinned) {
|
|
883
|
+
let e = r.showGutter ? r.gutterWidth : 0;
|
|
884
|
+
for (let t of E.value) {
|
|
885
|
+
if (t.id === a.id) break;
|
|
886
|
+
e += D(t);
|
|
843
887
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
888
|
+
let t = D(a), i = Oe("left"), o = Oe("right");
|
|
889
|
+
e - i < n.scrollLeft ? n.scrollLeft = e - i : e + t > n.scrollLeft + n.clientWidth - o && (n.scrollLeft = e + t - n.clientWidth + o);
|
|
890
|
+
}
|
|
891
|
+
ke();
|
|
892
|
+
}
|
|
893
|
+
function ke() {
|
|
894
|
+
w.value = u.value?.scrollTop ?? 0, se.value = u.value?.scrollLeft ?? 0;
|
|
895
|
+
}
|
|
896
|
+
function Ae() {
|
|
897
|
+
if (!b.value) return null;
|
|
898
|
+
let e = r.rows.find((e) => e.id === b.value.rowId), t = r.columns.find((e) => e.id === b.value.columnId);
|
|
899
|
+
return e && t ? {
|
|
900
|
+
r: e,
|
|
901
|
+
c: t
|
|
902
|
+
} : null;
|
|
903
|
+
}
|
|
904
|
+
function W(e) {
|
|
905
|
+
return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
|
|
906
|
+
}
|
|
907
|
+
function je(e) {
|
|
908
|
+
if (C.value) {
|
|
909
|
+
e.target !== _.value && (W(e) ? (e.preventDefault(), C.value.draft += e.key) : K(e));
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
|
|
913
|
+
e.preventDefault(), e.shiftKey ? Be() : ze();
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
switch (e.key) {
|
|
917
|
+
case "ArrowDown":
|
|
918
|
+
e.preventDefault(), B(1, 0, e.shiftKey);
|
|
919
|
+
break;
|
|
920
|
+
case "ArrowUp":
|
|
921
|
+
e.preventDefault(), B(-1, 0, e.shiftKey);
|
|
922
|
+
break;
|
|
923
|
+
case "ArrowLeft":
|
|
924
|
+
e.preventDefault(), B(0, -1, e.shiftKey);
|
|
925
|
+
break;
|
|
926
|
+
case "ArrowRight":
|
|
927
|
+
e.preventDefault(), B(0, 1, e.shiftKey);
|
|
928
|
+
break;
|
|
929
|
+
case "Tab":
|
|
930
|
+
e.preventDefault(), B(0, e.shiftKey ? -1 : 1);
|
|
931
|
+
break;
|
|
932
|
+
case "Enter":
|
|
933
|
+
e.preventDefault(), B(e.shiftKey ? -1 : 1, 0);
|
|
934
|
+
break;
|
|
935
|
+
case "Escape":
|
|
936
|
+
x.value = null, i("selection", null);
|
|
937
|
+
break;
|
|
938
|
+
case "Delete":
|
|
939
|
+
case "Backspace":
|
|
940
|
+
e.preventDefault(), Pe();
|
|
941
|
+
break;
|
|
942
|
+
case "F2": {
|
|
943
|
+
e.preventDefault();
|
|
944
|
+
let t = Ae();
|
|
945
|
+
if (t && !P(t.r, t.c)) {
|
|
946
|
+
let e = M(t.r.id, t.c.id);
|
|
947
|
+
G(t.r, t.c, e == null ? "" : String(e), "edit");
|
|
885
948
|
}
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
default: {
|
|
952
|
+
if (!W(e)) break;
|
|
953
|
+
let t = Ae();
|
|
954
|
+
t && !P(t.r, t.c) && (e.preventDefault(), G(t.r, t.c, e.key, "enter"));
|
|
886
955
|
}
|
|
887
956
|
}
|
|
888
957
|
}
|
|
889
|
-
function
|
|
890
|
-
|
|
958
|
+
function G(e, t, n, r) {
|
|
959
|
+
U(e.id, t.id), C.value = {
|
|
891
960
|
rowId: e.id,
|
|
892
961
|
columnId: t.id,
|
|
893
|
-
draft: n
|
|
962
|
+
draft: n,
|
|
963
|
+
mode: r
|
|
894
964
|
}, d(() => {
|
|
895
|
-
|
|
965
|
+
let e = _.value;
|
|
966
|
+
if (e) if (e.focus({ preventScroll: !0 }), r === "enter") {
|
|
967
|
+
let t = e.value.length;
|
|
968
|
+
e.setSelectionRange(t, t);
|
|
969
|
+
} else e.select();
|
|
896
970
|
});
|
|
897
971
|
}
|
|
898
|
-
let
|
|
899
|
-
if (
|
|
900
|
-
}),
|
|
901
|
-
if (!
|
|
902
|
-
let e = u.value?.querySelector(`[data-cell="${
|
|
903
|
-
if (!e) return { display: "none" };
|
|
904
|
-
let
|
|
972
|
+
let Me = o(() => {
|
|
973
|
+
if (C.value) return r.columns.find((e) => e.id === C.value.columnId)?.type === "number" ? "decimal" : "text";
|
|
974
|
+
}), Ne = o(() => {
|
|
975
|
+
if (!C.value) return { display: "none" };
|
|
976
|
+
let e = u.value, t = e?.querySelector(`[data-cell="${V(`${C.value.rowId}::${C.value.columnId}`)}"]`);
|
|
977
|
+
if (!e || !t) return { display: "none" };
|
|
978
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
905
979
|
return {
|
|
906
|
-
top: `${
|
|
907
|
-
left: `${
|
|
908
|
-
width: `${
|
|
909
|
-
height: `${
|
|
980
|
+
top: `${n.top - r.top - e.clientTop + w.value}px`,
|
|
981
|
+
left: `${n.left - r.left - e.clientLeft + se.value}px`,
|
|
982
|
+
width: `${n.width}px`,
|
|
983
|
+
height: `${n.height}px`
|
|
910
984
|
};
|
|
911
985
|
});
|
|
912
|
-
function
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
986
|
+
function K(e) {
|
|
987
|
+
let t = C.value?.mode, n = null;
|
|
988
|
+
switch (e.key) {
|
|
989
|
+
case "Enter":
|
|
990
|
+
n = [e.shiftKey ? -1 : 1, 0];
|
|
991
|
+
break;
|
|
992
|
+
case "Tab":
|
|
993
|
+
n = [0, e.shiftKey ? -1 : 1];
|
|
994
|
+
break;
|
|
995
|
+
case "ArrowDown":
|
|
996
|
+
n = [1, 0];
|
|
997
|
+
break;
|
|
998
|
+
case "ArrowUp":
|
|
999
|
+
n = [-1, 0];
|
|
1000
|
+
break;
|
|
1001
|
+
case "ArrowLeft":
|
|
1002
|
+
t === "enter" && (n = [0, -1]);
|
|
1003
|
+
break;
|
|
1004
|
+
case "ArrowRight":
|
|
1005
|
+
t === "enter" && (n = [0, 1]);
|
|
1006
|
+
break;
|
|
1007
|
+
case "Escape":
|
|
1008
|
+
e.preventDefault(), C.value = null, z();
|
|
1009
|
+
return;
|
|
921
1010
|
}
|
|
1011
|
+
n && (e.preventDefault(), q(), B(n[0], n[1]));
|
|
1012
|
+
}
|
|
1013
|
+
function q(e = !0) {
|
|
1014
|
+
if (!C.value) return;
|
|
1015
|
+
let { rowId: t, columnId: n, draft: a } = C.value;
|
|
1016
|
+
C.value = null;
|
|
1017
|
+
let o = r.columns.find((e) => e.id === n);
|
|
1018
|
+
if (!o) return;
|
|
922
1019
|
let s;
|
|
923
1020
|
try {
|
|
924
1021
|
s = o.parse ? o.parse(a) : j(o, a);
|
|
925
1022
|
} catch {
|
|
926
|
-
|
|
1023
|
+
e && z();
|
|
927
1024
|
return;
|
|
928
1025
|
}
|
|
929
1026
|
let c = M(t, n);
|
|
930
|
-
if (c
|
|
931
|
-
|
|
932
|
-
|
|
1027
|
+
if (c !== s) {
|
|
1028
|
+
let e = {
|
|
1029
|
+
rowId: t,
|
|
1030
|
+
columnId: n,
|
|
1031
|
+
before: c,
|
|
1032
|
+
after: s
|
|
1033
|
+
};
|
|
1034
|
+
X([e]), i("commit", e), i("change", [e]);
|
|
933
1035
|
}
|
|
934
|
-
|
|
935
|
-
rowId: t,
|
|
936
|
-
columnId: n,
|
|
937
|
-
before: c,
|
|
938
|
-
after: s
|
|
939
|
-
};
|
|
940
|
-
J([l]), i("commit", l), i("change", [l]), w.value = null, u.value?.focus();
|
|
1036
|
+
e && z();
|
|
941
1037
|
}
|
|
942
|
-
function
|
|
943
|
-
if (!
|
|
1038
|
+
function J() {
|
|
1039
|
+
if (!x.value) return [];
|
|
944
1040
|
let e = [
|
|
945
1041
|
...k.value,
|
|
946
1042
|
...O.value,
|
|
947
1043
|
...A.value
|
|
948
|
-
].map((e) => e.id), t = E.value.map((e) => e.id), n = e.indexOf(
|
|
1044
|
+
].map((e) => e.id), t = E.value.map((e) => e.id), n = e.indexOf(x.value.startRowId), r = e.indexOf(x.value.endRowId), i = t.indexOf(x.value.startColumnId), a = t.indexOf(x.value.endColumnId), o = [];
|
|
949
1045
|
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({
|
|
950
1046
|
rowId: e[s],
|
|
951
1047
|
columnId: t[n]
|
|
952
1048
|
});
|
|
953
1049
|
return o;
|
|
954
1050
|
}
|
|
955
|
-
function
|
|
956
|
-
let e =
|
|
1051
|
+
function Pe() {
|
|
1052
|
+
let e = J(), t = [];
|
|
957
1053
|
for (let { rowId: n, columnId: i } of e) {
|
|
958
1054
|
let e = r.rows.find((e) => e.id === n), a = r.columns.find((e) => e.id === i);
|
|
959
|
-
if (!e || !a ||
|
|
1055
|
+
if (!e || !a || P(e, a)) continue;
|
|
960
1056
|
let o = M(n, i);
|
|
961
1057
|
o == null || o === "" || t.push({
|
|
962
1058
|
rowId: n,
|
|
@@ -966,18 +1062,18 @@ var Ct = (e) => {
|
|
|
966
1062
|
});
|
|
967
1063
|
}
|
|
968
1064
|
if (t.length !== 0) {
|
|
969
|
-
|
|
1065
|
+
X(t);
|
|
970
1066
|
for (let e of t) i("commit", e);
|
|
971
1067
|
i("change", t);
|
|
972
1068
|
}
|
|
973
1069
|
}
|
|
974
|
-
function
|
|
975
|
-
if (
|
|
1070
|
+
function Y(e) {
|
|
1071
|
+
if (J().length === 0) return;
|
|
976
1072
|
let t = [
|
|
977
1073
|
...k.value,
|
|
978
1074
|
...O.value,
|
|
979
1075
|
...A.value
|
|
980
|
-
].map((e) => e.id), n = E.value.map((e) => e.id), r = Math.min(t.indexOf(
|
|
1076
|
+
].map((e) => e.id), n = E.value.map((e) => e.id), r = Math.min(t.indexOf(x.value.startRowId), t.indexOf(x.value.endRowId)), i = Math.max(t.indexOf(x.value.startRowId), t.indexOf(x.value.endRowId)), a = Math.min(n.indexOf(x.value.startColumnId), n.indexOf(x.value.endColumnId)), o = Math.max(n.indexOf(x.value.startColumnId), n.indexOf(x.value.endColumnId)), s = [];
|
|
981
1077
|
for (let e = r; e <= i; e++) {
|
|
982
1078
|
let r = [];
|
|
983
1079
|
for (let i = a; i <= o; i++) {
|
|
@@ -988,11 +1084,11 @@ var Ct = (e) => {
|
|
|
988
1084
|
}
|
|
989
1085
|
e.preventDefault(), e.clipboardData?.setData("text/plain", s.join("\n"));
|
|
990
1086
|
}
|
|
991
|
-
function
|
|
992
|
-
|
|
1087
|
+
function Fe(e) {
|
|
1088
|
+
Y(e), Pe();
|
|
993
1089
|
}
|
|
994
|
-
function
|
|
995
|
-
if (!
|
|
1090
|
+
function Ie(e) {
|
|
1091
|
+
if (!b.value) return;
|
|
996
1092
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
997
1093
|
if (!t) return;
|
|
998
1094
|
e.preventDefault();
|
|
@@ -1000,13 +1096,13 @@ var Ct = (e) => {
|
|
|
1000
1096
|
...k.value,
|
|
1001
1097
|
...O.value,
|
|
1002
1098
|
...A.value
|
|
1003
|
-
].map((e) => e.id), o = E.value.map((e) => e.id), s = a.indexOf(
|
|
1099
|
+
].map((e) => e.id), o = E.value.map((e) => e.id), s = a.indexOf(b.value.rowId), c = o.indexOf(b.value.columnId), l = [];
|
|
1004
1100
|
if (n.forEach((e, t) => {
|
|
1005
1101
|
e.forEach((e, n) => {
|
|
1006
1102
|
let i = a[s + t], u = o[c + n];
|
|
1007
1103
|
if (!i || !u) return;
|
|
1008
1104
|
let d = r.rows.find((e) => e.id === i), f = r.columns.find((e) => e.id === u);
|
|
1009
|
-
if (!d || !f ||
|
|
1105
|
+
if (!d || !f || P(d, f)) return;
|
|
1010
1106
|
let p;
|
|
1011
1107
|
try {
|
|
1012
1108
|
p = f.parse ? f.parse(e) : j(f, e);
|
|
@@ -1022,16 +1118,16 @@ var Ct = (e) => {
|
|
|
1022
1118
|
});
|
|
1023
1119
|
});
|
|
1024
1120
|
}), l.length !== 0) {
|
|
1025
|
-
|
|
1121
|
+
X(l);
|
|
1026
1122
|
for (let e of l) i("commit", e);
|
|
1027
1123
|
i("change", l);
|
|
1028
1124
|
}
|
|
1029
1125
|
}
|
|
1030
|
-
function
|
|
1126
|
+
function Le(e, t) {
|
|
1031
1127
|
let n = e.clientX, r = D(t), i = t.minWidth ?? 60, a = (e) => {
|
|
1032
1128
|
let a = Math.max(i, r + (e.clientX - n));
|
|
1033
|
-
|
|
1034
|
-
...
|
|
1129
|
+
v.value = {
|
|
1130
|
+
...v.value,
|
|
1035
1131
|
[t.id]: a
|
|
1036
1132
|
};
|
|
1037
1133
|
}, o = () => {
|
|
@@ -1039,20 +1135,20 @@ var Ct = (e) => {
|
|
|
1039
1135
|
};
|
|
1040
1136
|
window.addEventListener("mousemove", a), window.addEventListener("mouseup", o);
|
|
1041
1137
|
}
|
|
1042
|
-
function
|
|
1043
|
-
e.sortable && (
|
|
1138
|
+
function Re(e) {
|
|
1139
|
+
e.sortable && (y.value?.columnId === e.id ? y.value = y.value.direction === "asc" ? {
|
|
1044
1140
|
columnId: e.id,
|
|
1045
1141
|
direction: "desc"
|
|
1046
|
-
} : null :
|
|
1142
|
+
} : null : y.value = {
|
|
1047
1143
|
columnId: e.id,
|
|
1048
1144
|
direction: "asc"
|
|
1049
1145
|
});
|
|
1050
1146
|
}
|
|
1051
|
-
function
|
|
1052
|
-
|
|
1147
|
+
function X(e) {
|
|
1148
|
+
T.value.push(e), le.value = [];
|
|
1053
1149
|
}
|
|
1054
|
-
function
|
|
1055
|
-
let e =
|
|
1150
|
+
function ze() {
|
|
1151
|
+
let e = T.value.pop();
|
|
1056
1152
|
if (!e) return;
|
|
1057
1153
|
let t = e.map((e) => ({
|
|
1058
1154
|
...e,
|
|
@@ -1060,90 +1156,92 @@ var Ct = (e) => {
|
|
|
1060
1156
|
after: e.before
|
|
1061
1157
|
}));
|
|
1062
1158
|
for (let e of t) i("commit", e);
|
|
1063
|
-
i("change", t),
|
|
1159
|
+
i("change", t), le.value.push(e);
|
|
1064
1160
|
}
|
|
1065
|
-
function
|
|
1066
|
-
let e =
|
|
1161
|
+
function Be() {
|
|
1162
|
+
let e = le.value.pop();
|
|
1067
1163
|
if (e) {
|
|
1068
1164
|
for (let t of e) i("commit", t);
|
|
1069
|
-
i("change", e),
|
|
1165
|
+
i("change", e), T.value.push(e);
|
|
1070
1166
|
}
|
|
1071
1167
|
}
|
|
1072
1168
|
return m(() => {
|
|
1073
|
-
|
|
1169
|
+
z();
|
|
1074
1170
|
}), t({
|
|
1075
|
-
focus: (e, t) =>
|
|
1076
|
-
undo:
|
|
1077
|
-
redo:
|
|
1078
|
-
getSelection: () =>
|
|
1079
|
-
}), (t, n) => (h(), c("div", { class: f(["nb-spreadsheet", { "nb-spreadsheet--editing": !!
|
|
1171
|
+
focus: (e, t) => R(e, t),
|
|
1172
|
+
undo: ze,
|
|
1173
|
+
redo: Be,
|
|
1174
|
+
getSelection: () => x.value
|
|
1175
|
+
}), (t, n) => (h(), c("div", { class: f(["nb-spreadsheet", { "nb-spreadsheet--editing": !!C.value }]) }, [t.$slots.toolbar ? (h(), c("div", Et, [te(t.$slots, "toolbar", {}, void 0, !0)])) : s("", !0), l("div", {
|
|
1080
1176
|
ref_key: "scrollerRef",
|
|
1081
1177
|
ref: u,
|
|
1082
1178
|
class: "nb-spreadsheet__scroller",
|
|
1083
1179
|
tabindex: "0",
|
|
1084
|
-
onKeydown:
|
|
1085
|
-
onCopy:
|
|
1086
|
-
onCut:
|
|
1087
|
-
onPaste:
|
|
1088
|
-
onScroll:
|
|
1180
|
+
onKeydown: je,
|
|
1181
|
+
onCopy: Y,
|
|
1182
|
+
onCut: Fe,
|
|
1183
|
+
onPaste: Ie,
|
|
1184
|
+
onScroll: ke
|
|
1089
1185
|
}, [l("div", {
|
|
1090
1186
|
class: "nb-spreadsheet__grid",
|
|
1091
|
-
style: p(
|
|
1187
|
+
style: p(ue.value)
|
|
1092
1188
|
}, [
|
|
1093
|
-
e.showGutter ? (h(), c("div",
|
|
1189
|
+
e.showGutter ? (h(), c("div", Dt)) : s("", !0),
|
|
1094
1190
|
(h(!0), c(a, null, ee(E.value, (t, n) => (h(), c("div", {
|
|
1095
1191
|
key: `h-${t.id}`,
|
|
1096
|
-
class: f(["nb-spreadsheet__header",
|
|
1097
|
-
style: p(
|
|
1098
|
-
onClick: (e) =>
|
|
1192
|
+
class: f(["nb-spreadsheet__header", he(t)]),
|
|
1193
|
+
style: p(ve(t, n)),
|
|
1194
|
+
onClick: (e) => Re(t)
|
|
1099
1195
|
}, [
|
|
1100
|
-
l("span",
|
|
1101
|
-
|
|
1196
|
+
l("span", kt, ne(t.label), 1),
|
|
1197
|
+
y.value && y.value.columnId === t.id ? (h(), c("span", At, ne(y.value.direction === "asc" ? "▲" : "▼"), 1)) : s("", !0),
|
|
1102
1198
|
e.resizable ? (h(), c("span", {
|
|
1103
1199
|
key: 1,
|
|
1104
1200
|
class: "nb-spreadsheet__resize-handle",
|
|
1105
|
-
onMousedown:
|
|
1106
|
-
}, null, 40,
|
|
1107
|
-
], 14,
|
|
1108
|
-
(h(!0), c(a, null, ee(
|
|
1201
|
+
onMousedown: oe((e) => Le(e, t), ["stop"])
|
|
1202
|
+
}, null, 40, jt)) : s("", !0)
|
|
1203
|
+
], 14, Ot))), 128)),
|
|
1204
|
+
(h(!0), c(a, null, ee(de.value, (t) => (h(), c(a, { key: `r-${t.id}` }, [e.showGutter ? (h(), c("div", {
|
|
1109
1205
|
key: 0,
|
|
1110
1206
|
class: f(["nb-spreadsheet__gutter", {
|
|
1111
1207
|
"nb-spreadsheet__gutter--pinned-top": t.pinned === "top",
|
|
1112
1208
|
"nb-spreadsheet__gutter--pinned-bottom": t.pinned === "bottom"
|
|
1113
1209
|
}]),
|
|
1114
|
-
style: p(
|
|
1115
|
-
},
|
|
1210
|
+
style: p(be(t))
|
|
1211
|
+
}, ne(L(t)), 7)) : s("", !0), (h(!0), c(a, null, ee(E.value, (e, r) => (h(), c("div", {
|
|
1116
1212
|
key: `c-${t.id}-${e.id}`,
|
|
1117
|
-
class: f(["nb-spreadsheet__cell",
|
|
1118
|
-
style: p(
|
|
1119
|
-
title:
|
|
1213
|
+
class: f(["nb-spreadsheet__cell", me(t, e)]),
|
|
1214
|
+
style: p(ye(t, e, r)),
|
|
1215
|
+
title: F(t, e),
|
|
1120
1216
|
"data-cell": `${t.id}::${e.id}`,
|
|
1121
1217
|
"data-row": t.id,
|
|
1122
1218
|
"data-col": e.id,
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1219
|
+
onPointerdown: n[0] ||= (e) => Se(e),
|
|
1220
|
+
onMousedown: (n) => Ce(n, t, e),
|
|
1221
|
+
onMouseenter: (n) => we(t, e),
|
|
1222
|
+
onDblclick: (n) => Ee(t, e)
|
|
1223
|
+
}, [l("span", null, ne(pe(t, e)), 1)], 46, Mt))), 128))], 64))), 128))
|
|
1224
|
+
], 4), C.value ? ae((h(), c("input", {
|
|
1128
1225
|
key: 0,
|
|
1129
1226
|
ref_key: "editorRef",
|
|
1130
|
-
ref:
|
|
1131
|
-
"onUpdate:modelValue": n[
|
|
1227
|
+
ref: _,
|
|
1228
|
+
"onUpdate:modelValue": n[1] ||= (e) => C.value.draft = e,
|
|
1132
1229
|
class: "nb-spreadsheet__editor",
|
|
1133
|
-
style: p(
|
|
1134
|
-
inputmode:
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1230
|
+
style: p(Ne.value),
|
|
1231
|
+
inputmode: Me.value,
|
|
1232
|
+
enterkeyhint: "next",
|
|
1233
|
+
onBlur: n[2] ||= (e) => q(!1),
|
|
1234
|
+
onKeydown: oe(K, ["stop"])
|
|
1235
|
+
}, null, 44, Nt)), [[ie, C.value.draft]]) : s("", !0)], 544)], 2));
|
|
1138
1236
|
}
|
|
1139
|
-
}),
|
|
1140
|
-
Object.keys(
|
|
1141
|
-
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r =
|
|
1237
|
+
}), Lt = /* @__PURE__ */ v({ default: () => Rt }), Rt = /* @__PURE__ */ i(It, [["__scopeId", "data-v-d04d6e9c"]]), zt = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": Lt }), Bt = { install(e) {
|
|
1238
|
+
Object.keys(zt).forEach((t) => {
|
|
1239
|
+
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = zt[t];
|
|
1142
1240
|
e.component(n, r.default);
|
|
1143
1241
|
});
|
|
1144
|
-
} },
|
|
1242
|
+
} }, Vt = { install(e, t = {}) {
|
|
1145
1243
|
if (t.components) for (let [n, r] of Object.entries(t.components)) e.component(n, r);
|
|
1146
|
-
e.use(
|
|
1244
|
+
e.use(wt), e.use(Tt);
|
|
1147
1245
|
} };
|
|
1148
1246
|
//#endregion
|
|
1149
|
-
export {
|
|
1247
|
+
export { St as a, Tt as i, Bt as n, yt as o, Rt as r, st as s, Vt as t };
|