@nubisco/ui 5.54.0 → 5.56.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/{AccordionItem--XeLRz2P.js → AccordionItem-BY-p8UkV.js} +1 -1
- package/dist/{AccordionItem-BYSH6dZK.cjs → AccordionItem-p0mYXIj8.cjs} +1 -1
- package/dist/{ActionGroup-Cn22xj1t.js → ActionGroup-CjRSKyOa.js} +1 -1
- package/dist/{ActionGroup-0rG92kFk.cjs → ActionGroup-DIMZhC7N.cjs} +1 -1
- package/dist/AiLabel-BDccQ2iQ.js +242 -0
- package/dist/AiLabel-jRrBTu6c.cjs +1 -0
- package/dist/{AiProvider-CLtCD_UR.cjs → AiProvider-CGB9EiSf.cjs} +1 -1
- package/dist/{AiProvider-gprbR5ts.js → AiProvider-CMbPWtU-.js} +2 -2
- package/dist/{BatchActions-Ckx8kyZt.js → BatchActions-Kr2S6CJI.js} +1 -1
- package/dist/{BatchActions-6IO5GRFm.cjs → BatchActions-jfvfpZeT.cjs} +1 -1
- package/dist/{Board-BdqGOVNF.js → Board-C3_cXRl6.js} +177 -176
- package/dist/Board-D6A-irdx.cjs +1 -0
- package/dist/{Breadcrumbs-BzyDVvEk.cjs → Breadcrumbs-0rRFiO31.cjs} +1 -1
- package/dist/{Breadcrumbs-Bc-acmPE.js → Breadcrumbs-DqagVknq.js} +1 -1
- package/dist/{Briefing-DwKWCOGm.cjs → Briefing-B-O-9bhN.cjs} +1 -1
- package/dist/{Briefing-BiEICh1u.js → Briefing-DNH-707q.js} +1 -1
- package/dist/{ChatMessage-1L_xCXZF.cjs → ChatMessage-B45Xhl8x.cjs} +1 -1
- package/dist/{ChatMessage-C2Ecm175.js → ChatMessage-BDOdvI4h.js} +1 -1
- package/dist/{ChatThread-B_F3xTdE.cjs → ChatThread-B7F1r4t4.cjs} +1 -1
- package/dist/{ChatThread-COdOb1rH.js → ChatThread-DqvsnVOr.js} +1 -1
- package/dist/CommandPalette-BaRqoURY.cjs +1 -0
- package/dist/CommandPalette-DWv1UV8r.js +294 -0
- package/dist/{Confirm-Baz2WG7b.cjs → Confirm-B5vMzPbN.cjs} +1 -1
- package/dist/{Confirm-CvMuXK9Q.js → Confirm-C4lT-6HD.js} +1 -1
- package/dist/{DataTable-B8THDBLS.js → DataTable-CcwD0PSJ.js} +2 -2
- package/dist/{DataTable-DeFzOlcP.cjs → DataTable-xEw-NvHM.cjs} +1 -1
- package/dist/{DatePicker-BrUXcNUj.js → DatePicker-3pCNky8d.js} +234 -230
- package/dist/DatePicker-BrMicYUx.cjs +1 -0
- package/dist/FloatingToolbar-BV-iGNxe.js +120 -0
- package/dist/FloatingToolbar-C8xB4BzH.cjs +1 -0
- package/dist/{ImagePicker-vhg7b-UL.cjs → ImagePicker-5qPI77Jo.cjs} +1 -1
- package/dist/{ImagePicker-LhpR7jjR.js → ImagePicker-BnHg403Q.js} +1 -1
- package/dist/InfoHint-CdluaJqE.cjs +1 -0
- package/dist/InfoHint-zMuSw_99.js +182 -0
- package/dist/{InlineLoading-CA0_IT29.cjs → InlineLoading-CqGrNWHf.cjs} +1 -1
- package/dist/{InlineLoading-Cknqq0vv.js → InlineLoading-_j2KKhNQ.js} +1 -1
- package/dist/Menu-CWxBEMC4.js +193 -0
- package/dist/Menu-D0TerdRm.cjs +1 -0
- package/dist/{MenuBarItem-yr5aizl3.js → MenuBarItem-BYh4YWR4.js} +1 -1
- package/dist/{MenuBarItem-DlnIAhRw.cjs → MenuBarItem-DTOqacvg.cjs} +1 -1
- package/dist/Modal-CmGFLEo4.cjs +1 -0
- package/dist/{Modal-CESCi2dE.js → Modal-DwL90AoV.js} +73 -69
- package/dist/NotificationCenter-EMlV-oPh.cjs +1 -0
- package/dist/{NotificationCenter-DkGc0ETD.js → NotificationCenter-YZnPMH7c.js} +217 -213
- package/dist/{OverflowMenu-BWZ7c8oI.js → OverflowMenu-DliuDrTK.js} +1 -1
- package/dist/{OverflowMenu-C8q28FrD.cjs → OverflowMenu-DuRgj1DU.cjs} +1 -1
- package/dist/{PageHeader-DElq_kdh.cjs → PageHeader-BoEdR_T5.cjs} +1 -1
- package/dist/{PageHeader-DOYN9sto.js → PageHeader-c6117xYf.js} +1 -1
- package/dist/{Pagination-9mPN8ych.cjs → Pagination-B3lmxggo.cjs} +1 -1
- package/dist/{Pagination-CxBHFwy0.js → Pagination-DwAc-4d9.js} +1 -1
- package/dist/Select-CDs-7QtW.js +619 -0
- package/dist/Select-CJqwMI69.cjs +1 -0
- package/dist/{SidebarCollapseToggle-DraqbhwM.js → SidebarCollapseToggle-C38R19gG.js} +1 -1
- package/dist/{SidebarCollapseToggle-CABmF-PC.cjs → SidebarCollapseToggle-DOck3Txy.cjs} +1 -1
- package/dist/SidebarMenuItem-DzJ_R2__.cjs +1 -0
- package/dist/SidebarMenuItem-E410HTei.js +302 -0
- package/dist/Spinner-BlzVODzE.js +161 -0
- package/dist/Spinner-Bpfgl-mN.cjs +1 -0
- package/dist/{Stat-BCvXYr-z.cjs → Stat-BByeMKkT.cjs} +1 -1
- package/dist/{Stat-No3RhGB3.js → Stat-DWliDbWE.js} +1 -1
- package/dist/Submenu-BkHGYo7X.js +168 -0
- package/dist/Submenu-CCQnBpln.cjs +1 -0
- package/dist/{SuggestionList-Cxy4jjjd.cjs → SuggestionList-C61Dj6en.cjs} +1 -1
- package/dist/{SuggestionList-Dv4yQAi-.js → SuggestionList-D48Ojcf3.js} +1 -1
- package/dist/Toaster-Dwjm0bsR.js +285 -0
- package/dist/Toaster-aJJvxlEr.cjs +1 -0
- package/dist/{UserMenu-CjmhyTwN.js → UserMenu-BTihjCKC.js} +94 -90
- package/dist/UserMenu-CHkbByFS.cjs +1 -0
- package/dist/{Walkthrough-DYYqtpwJ.js → Walkthrough-BqGB1yaX.js} +63 -59
- package/dist/Walkthrough-sGAypY5d.cjs +1 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +284 -283
- package/dist/components/AccordionItem.cjs +1 -1
- package/dist/components/AccordionItem.mjs +1 -1
- package/dist/components/ActionGroup.cjs +1 -1
- package/dist/components/ActionGroup.mjs +1 -1
- package/dist/components/AiLabel.cjs +1 -1
- package/dist/components/AiLabel.mjs +1 -1
- package/dist/components/AiLabel.vue.d.ts.map +1 -1
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/BatchActions.cjs +1 -1
- package/dist/components/BatchActions.mjs +1 -1
- package/dist/components/Board.cjs +1 -1
- package/dist/components/Board.mjs +1 -1
- package/dist/components/Board.vue.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.mjs +1 -1
- package/dist/components/Briefing.cjs +1 -1
- package/dist/components/Briefing.mjs +1 -1
- package/dist/components/ChatMessage.cjs +1 -1
- package/dist/components/ChatMessage.mjs +1 -1
- package/dist/components/ChatThread.cjs +1 -1
- package/dist/components/ChatThread.mjs +1 -1
- package/dist/components/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette.mjs +1 -1
- package/dist/components/CommandPalette.vue.d.ts.map +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/FloatingToolbar.cjs +1 -1
- package/dist/components/FloatingToolbar.mjs +1 -1
- package/dist/components/FloatingToolbar.vue.d.ts.map +1 -1
- package/dist/components/ImagePicker.cjs +1 -1
- package/dist/components/ImagePicker.mjs +1 -1
- package/dist/components/InfoHint.cjs +1 -1
- package/dist/components/InfoHint.mjs +1 -1
- package/dist/components/InfoHint.vue.d.ts.map +1 -1
- package/dist/components/InlineLoading.cjs +1 -1
- package/dist/components/InlineLoading.mjs +1 -1
- package/dist/components/Menu.cjs +1 -1
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/Menu.vue.d.ts.map +1 -1
- package/dist/components/MenuBarItem.cjs +1 -1
- package/dist/components/MenuBarItem.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter.mjs +1 -1
- package/dist/components/NotificationCenter.vue.d.ts.map +1 -1
- package/dist/components/OverflowMenu.cjs +1 -1
- package/dist/components/OverflowMenu.mjs +1 -1
- package/dist/components/PageHeader.cjs +1 -1
- package/dist/components/PageHeader.mjs +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/SidebarCollapseToggle.cjs +1 -1
- package/dist/components/SidebarCollapseToggle.mjs +1 -1
- package/dist/components/SidebarMenuItem.cjs +1 -1
- package/dist/components/SidebarMenuItem.mjs +1 -1
- package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/Spinner.cjs +1 -1
- package/dist/components/Spinner.mjs +1 -1
- package/dist/components/Spinner.vue.d.ts.map +1 -1
- package/dist/components/Stat.cjs +1 -1
- package/dist/components/Stat.mjs +1 -1
- package/dist/components/Submenu.cjs +1 -1
- package/dist/components/Submenu.mjs +1 -1
- package/dist/components/Submenu.vue.d.ts.map +1 -1
- package/dist/components/SuggestionList.cjs +1 -1
- package/dist/components/SuggestionList.mjs +1 -1
- package/dist/components/Toaster.cjs +1 -1
- package/dist/components/Toaster.mjs +1 -1
- package/dist/components/Toaster.vue.d.ts.map +1 -1
- package/dist/components/UserMenu.cjs +1 -1
- package/dist/components/UserMenu.mjs +1 -1
- package/dist/components/UserMenu.vue.d.ts.map +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +1 -1
- package/dist/components/Walkthrough.vue.d.ts.map +1 -1
- package/dist/components/labs/Spreadsheet.d.ts +14 -0
- package/dist/components/labs/Spreadsheet.vue.d.ts +1 -0
- package/dist/components/labs/Spreadsheet.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/composables/useTeleportReady.composable.cjs +1 -0
- package/dist/composables/useTeleportReady.composable.d.ts +30 -0
- package/dist/composables/useTeleportReady.composable.d.ts.map +1 -0
- package/dist/composables/useTeleportReady.composable.mjs +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +152 -151
- package/dist/{main-D6qY7QeE.js → main-B-SiH7ks.js} +305 -237
- package/dist/main-CH_BN_4v.cjs +4 -0
- package/dist/main.d.ts +10 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/AiLabel.css +1 -1
- package/dist/styles/FloatingToolbar.css +1 -1
- package/dist/styles/InfoHint.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/SidebarMenuItem.css +1 -1
- package/dist/styles/Spinner.css +1 -1
- package/dist/styles/Toaster.css +1 -1
- package/dist/styles/Walkthrough.css +1 -1
- package/dist/styles/main.css +1 -1
- package/dist/ui.css +9 -9
- package/package.json +1 -1
- package/dist/AiLabel-AGSSBanb.cjs +0 -1
- package/dist/AiLabel-D32aNf1F.js +0 -240
- package/dist/Board-DtOWyvKh.cjs +0 -1
- package/dist/CommandPalette-CC_Aj4Uh.cjs +0 -1
- package/dist/CommandPalette-zqTMjpm8.js +0 -290
- package/dist/DatePicker-B5YRb64p.cjs +0 -1
- package/dist/FloatingToolbar-BikX_AsP.js +0 -116
- package/dist/FloatingToolbar-DWVY8Fxo.cjs +0 -1
- package/dist/InfoHint-BEzkNQTM.cjs +0 -1
- package/dist/InfoHint-BlHxrTw6.js +0 -178
- package/dist/Menu-7EgnchVu.js +0 -189
- package/dist/Menu-Bs2Co1sl.cjs +0 -1
- package/dist/Modal-C_EWDvmH.cjs +0 -1
- package/dist/NotificationCenter-DxZgHQyt.cjs +0 -1
- package/dist/Select-7gJ3_fWh.js +0 -615
- package/dist/Select-Dg4HSHOu.cjs +0 -1
- package/dist/SidebarMenuItem-DQRQtqrp.js +0 -300
- package/dist/SidebarMenuItem-Dwk7vKN5.cjs +0 -1
- package/dist/Spinner-DYFhiTB1.js +0 -160
- package/dist/Spinner-j13gRoUF.cjs +0 -1
- package/dist/Submenu-BDs-yAqv.js +0 -164
- package/dist/Submenu-BLjx2kWl.cjs +0 -1
- package/dist/Toaster-ByObLDkk.js +0 -284
- package/dist/Toaster-CJAbZ9pv.cjs +0 -1
- package/dist/UserMenu-BjSO_Uml.cjs +0 -1
- package/dist/Walkthrough-DxAIdo3M.cjs +0 -1
- package/dist/main-Cs0FFBfV.cjs +0 -4
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { i as e, l as t, r as n, u as r } from "./Button-DmJ_J3UO.js";
|
|
2
2
|
import { TOUR_STEP_ATTRIBUTE as i } from "./utils/tourTarget.helper.mjs";
|
|
3
3
|
import { NB_COMMAND_PALETTE_KEY as a, createCommandPaletteState as o } from "./composables/useCommandPalette.composable.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { NB_HYDRATION as s } from "./composables/useTeleportReady.composable.mjs";
|
|
5
|
+
import { t as c } from "./_plugin-vue_export-helper-C6QCLu9I.js";
|
|
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 re, vModelText as ie, watch as ae, withDirectives as oe, withModifiers as se } from "vue";
|
|
6
8
|
//#region src/directives/ContextMenu.directive.ts
|
|
7
9
|
var C = /* @__PURE__ */ r({ default: () => w });
|
|
8
10
|
function w(e) {
|
|
@@ -64,21 +66,21 @@ var D = (e) => {
|
|
|
64
66
|
e.provide(a, t);
|
|
65
67
|
} }, j = /* @__PURE__ */ function(e) {
|
|
66
68
|
return e.Object = "object", e.Array = "array", e.Primitive = "primitive", e;
|
|
67
|
-
}(j || {}),
|
|
69
|
+
}(j || {}), ce = {
|
|
68
70
|
key: 0,
|
|
69
71
|
class: "nb-spreadsheet__toolbar"
|
|
70
|
-
},
|
|
72
|
+
}, le = {
|
|
71
73
|
key: 0,
|
|
72
74
|
class: "nb-spreadsheet__corner",
|
|
73
75
|
style: {
|
|
74
76
|
gridRow: 1,
|
|
75
77
|
gridColumn: 1
|
|
76
78
|
}
|
|
77
|
-
},
|
|
79
|
+
}, ue = ["data-header-col", "onClick"], de = ["title"], fe = {
|
|
78
80
|
key: 0,
|
|
79
81
|
class: "nb-spreadsheet__sort",
|
|
80
82
|
"aria-hidden": "true"
|
|
81
|
-
},
|
|
83
|
+
}, pe = ["onMousedown"], me = [
|
|
82
84
|
"title",
|
|
83
85
|
"data-cell",
|
|
84
86
|
"data-row",
|
|
@@ -86,7 +88,7 @@ var D = (e) => {
|
|
|
86
88
|
"onMousedown",
|
|
87
89
|
"onMouseenter",
|
|
88
90
|
"onDblclick"
|
|
89
|
-
],
|
|
91
|
+
], he = ["inputmode"], ge = 36, _e = 32, ve = 20, M = /* @__PURE__ */ h({
|
|
90
92
|
__name: "Spreadsheet",
|
|
91
93
|
props: {
|
|
92
94
|
columns: {},
|
|
@@ -107,7 +109,11 @@ var D = (e) => {
|
|
|
107
109
|
},
|
|
108
110
|
gutterWidth: { default: 44 },
|
|
109
111
|
windowRows: { default: 80 },
|
|
110
|
-
locale: { default: "pt-PT" }
|
|
112
|
+
locale: { default: "pt-PT" },
|
|
113
|
+
fit: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: !1
|
|
116
|
+
}
|
|
111
117
|
},
|
|
112
118
|
emits: [
|
|
113
119
|
"commit",
|
|
@@ -117,7 +123,7 @@ var D = (e) => {
|
|
|
117
123
|
"row-reorder"
|
|
118
124
|
],
|
|
119
125
|
setup(e, { expose: t, emit: n }) {
|
|
120
|
-
let r = e, i = n, a =
|
|
126
|
+
let r = e, i = n, a = re("scrollerRef"), o = re("editorRef"), s = b({}), c = b(null), h = b(null), C = b(null), w = b(!1), T = b(null), E = b(0), D = b(0), O = "", k = b([]), A = b([]), j = d(() => {
|
|
121
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);
|
|
122
128
|
return [
|
|
123
129
|
...e,
|
|
@@ -125,27 +131,67 @@ var D = (e) => {
|
|
|
125
131
|
...t
|
|
126
132
|
];
|
|
127
133
|
});
|
|
128
|
-
function
|
|
134
|
+
function M(e) {
|
|
129
135
|
return s.value[e.id] ?? e.width ?? 120;
|
|
130
136
|
}
|
|
131
|
-
let
|
|
137
|
+
let { phoneTouch: N } = l(), P = b(null), F = d(() => P.value ?? _e);
|
|
138
|
+
function I() {
|
|
139
|
+
let e = a.value;
|
|
140
|
+
if (!r.fit || N.value || !e || !r.rows.length) {
|
|
141
|
+
P.value = null;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
let t = X(".nb-spreadsheet__header") || ge, n = Math.floor((e.clientHeight - t) / r.rows.length);
|
|
145
|
+
P.value = Math.min(_e, Math.max(ve, n));
|
|
146
|
+
}
|
|
147
|
+
let L = null;
|
|
148
|
+
ae(() => [
|
|
149
|
+
r.fit,
|
|
150
|
+
r.rows.length,
|
|
151
|
+
N.value
|
|
152
|
+
], () => I());
|
|
153
|
+
let ye = d(() => P.value === null ? void 0 : { "--nbss-row-height": `${P.value}px` }), be = d(() => ({
|
|
154
|
+
gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") + j.value.map((e) => r.fit && !e.pinned ? `minmax(${M(e)}px, 1fr)` : `${M(e)}px`).join(" "),
|
|
155
|
+
gridTemplateRows: "var(--nbss-header-height)"
|
|
156
|
+
})), R = b(/* @__PURE__ */ new Set()), xe = /* @__PURE__ */ new Map();
|
|
157
|
+
function z() {
|
|
158
|
+
let e = a.value;
|
|
159
|
+
if (!e) return;
|
|
160
|
+
let t = [], n = !1, i = !1;
|
|
161
|
+
for (let a of r.columns) {
|
|
162
|
+
if (!a.shortLabel) continue;
|
|
163
|
+
let r = e.querySelector(`[data-header-col="${Y(a.id)}"] .nb-spreadsheet__header-label`);
|
|
164
|
+
if (!r) continue;
|
|
165
|
+
let o = `${a.id}::${a.label}`;
|
|
166
|
+
R.value.has(a.id) || xe.set(o, r.scrollWidth);
|
|
167
|
+
let s = xe.get(o);
|
|
168
|
+
if (s === void 0) {
|
|
169
|
+
i = !0;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
t.push(a.id), s > r.clientWidth && (n = !0);
|
|
173
|
+
}
|
|
174
|
+
R.value = new Set(n ? t : []), i && g(z);
|
|
175
|
+
}
|
|
176
|
+
ae(() => [r.columns, s.value], () => void g(z), { deep: !0 });
|
|
177
|
+
let B = d(() => {
|
|
132
178
|
let e = r.rows.filter((e) => !e.pinned);
|
|
133
|
-
if (!
|
|
134
|
-
let t = r.columns.find((e) => e.id ===
|
|
179
|
+
if (!c.value) return e;
|
|
180
|
+
let t = r.columns.find((e) => e.id === c.value.columnId);
|
|
135
181
|
if (!t) return e;
|
|
136
|
-
let n =
|
|
182
|
+
let n = c.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;
|
|
137
183
|
return [...e].sort((e, n) => i(e.values[t.id], n.values[t.id]));
|
|
138
|
-
}),
|
|
139
|
-
let e = Math.max(1, Math.ceil((a.value?.clientHeight ?? 600) /
|
|
184
|
+
}), V = d(() => r.rows.filter((e) => e.pinned === "top")), H = d(() => r.rows.filter((e) => e.pinned === "bottom")), Se = d(() => {
|
|
185
|
+
let e = Math.max(1, Math.ceil((a.value?.clientHeight ?? 600) / F.value)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(E.value / F.value) - V.value.length - t, i = Math.max(0, n), o = Math.min(B.value.length, i + e + t * 2), s = V.value.map((e, t) => ({
|
|
140
186
|
...e,
|
|
141
187
|
__virtualIndex: t,
|
|
142
188
|
gutterLabel: ""
|
|
143
|
-
})), c =
|
|
189
|
+
})), c = B.value.slice(i, o).map((e, t) => ({
|
|
144
190
|
...e,
|
|
145
|
-
__virtualIndex: i + t +
|
|
146
|
-
})), l =
|
|
191
|
+
__virtualIndex: i + t + V.value.length
|
|
192
|
+
})), l = H.value.map((e, t) => ({
|
|
147
193
|
...e,
|
|
148
|
-
__virtualIndex:
|
|
194
|
+
__virtualIndex: V.value.length + B.value.length + t,
|
|
149
195
|
gutterLabel: ""
|
|
150
196
|
}));
|
|
151
197
|
return [
|
|
@@ -154,7 +200,7 @@ var D = (e) => {
|
|
|
154
200
|
...l
|
|
155
201
|
];
|
|
156
202
|
});
|
|
157
|
-
function
|
|
203
|
+
function Ce(e, t) {
|
|
158
204
|
if (t == null || t === "") return "";
|
|
159
205
|
if (e.type === "number") {
|
|
160
206
|
let e = typeof t == "number" ? t : Number(t);
|
|
@@ -166,7 +212,7 @@ var D = (e) => {
|
|
|
166
212
|
}
|
|
167
213
|
return String(t);
|
|
168
214
|
}
|
|
169
|
-
function
|
|
215
|
+
function we(e, t) {
|
|
170
216
|
if (t === "") return null;
|
|
171
217
|
if (e.type === "number") {
|
|
172
218
|
let e = t.replace(/\s/g, "").replace(",", "."), n = Number(e);
|
|
@@ -180,29 +226,29 @@ var D = (e) => {
|
|
|
180
226
|
}
|
|
181
227
|
return t;
|
|
182
228
|
}
|
|
183
|
-
function
|
|
229
|
+
function U(e, t) {
|
|
184
230
|
let n = r.rows.find((t) => t.id === e);
|
|
185
231
|
if (!n) return;
|
|
186
232
|
let i = n.values[t];
|
|
187
233
|
if (i !== void 0) return i;
|
|
188
|
-
if (r.computed) return r.computed(e, t,
|
|
234
|
+
if (r.computed) return r.computed(e, t, U);
|
|
189
235
|
}
|
|
190
|
-
function
|
|
236
|
+
function W(e, t) {
|
|
191
237
|
return r.cellAttrs ? r.cellAttrs(e.id, t.id, e, t) ?? {} : {};
|
|
192
238
|
}
|
|
193
|
-
function
|
|
194
|
-
let n =
|
|
239
|
+
function Te(e, t) {
|
|
240
|
+
let n = W(e, t);
|
|
195
241
|
if (n.display !== void 0) return n.display;
|
|
196
|
-
let r =
|
|
197
|
-
return t.format ? t.format(r, e) :
|
|
242
|
+
let r = U(e.id, t.id);
|
|
243
|
+
return t.format ? t.format(r, e) : Ce(t, r);
|
|
198
244
|
}
|
|
199
|
-
function
|
|
200
|
-
let n =
|
|
245
|
+
function Ee(e, t) {
|
|
246
|
+
let n = W(e, t), r = h.value?.rowId === e.id && h.value?.columnId === t.id, i = Ie(e.id, t.id);
|
|
201
247
|
return {
|
|
202
248
|
[`nb-spreadsheet__cell--${t.align ?? (t.type === "number" || t.type === "date" ? "right" : "left")}`]: !0,
|
|
203
249
|
"nb-spreadsheet__cell--focused": r,
|
|
204
250
|
"nb-spreadsheet__cell--selected": i,
|
|
205
|
-
"nb-spreadsheet__cell--readonly":
|
|
251
|
+
"nb-spreadsheet__cell--readonly": G(e, t),
|
|
206
252
|
"nb-spreadsheet__cell--computed": !!n.computed || !!e.computed,
|
|
207
253
|
"nb-spreadsheet__cell--pinned-top": e.pinned === "top",
|
|
208
254
|
"nb-spreadsheet__cell--pinned-bottom": e.pinned === "bottom",
|
|
@@ -210,204 +256,205 @@ var D = (e) => {
|
|
|
210
256
|
[e.className ?? ""]: !!e.className
|
|
211
257
|
};
|
|
212
258
|
}
|
|
213
|
-
function
|
|
259
|
+
function G(e, t) {
|
|
214
260
|
if (e.computed || t.readOnly) return !0;
|
|
215
|
-
let n =
|
|
261
|
+
let n = W(e, t);
|
|
216
262
|
return !!n.readOnly || !!n.computed;
|
|
217
263
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
264
|
+
function De(e, t) {
|
|
265
|
+
return W(e, t).tooltip ?? "";
|
|
220
266
|
}
|
|
221
|
-
function
|
|
267
|
+
function Oe(e) {
|
|
222
268
|
return {
|
|
223
269
|
"nb-spreadsheet__header--sortable": !!e.sortable,
|
|
224
270
|
"nb-spreadsheet__header--pinned-left": e.pinned === "left",
|
|
225
|
-
"nb-spreadsheet__header--pinned-right": e.pinned === "right"
|
|
271
|
+
"nb-spreadsheet__header--pinned-right": e.pinned === "right",
|
|
272
|
+
"nb-spreadsheet__header--last": e.id === j.value[j.value.length - 1]?.id
|
|
226
273
|
};
|
|
227
274
|
}
|
|
228
|
-
function
|
|
275
|
+
function ke(e) {
|
|
229
276
|
if (e.pinned !== "left") return 0;
|
|
230
277
|
let t = r.showGutter ? r.gutterWidth : 0;
|
|
231
|
-
for (let n of
|
|
278
|
+
for (let n of j.value) {
|
|
232
279
|
if (n.id === e.id) break;
|
|
233
|
-
n.pinned === "left" && (t +=
|
|
280
|
+
n.pinned === "left" && (t += M(n));
|
|
234
281
|
}
|
|
235
282
|
return t;
|
|
236
283
|
}
|
|
237
|
-
function
|
|
284
|
+
function Ae(e) {
|
|
238
285
|
if (e.pinned !== "right") return 0;
|
|
239
|
-
let t = 0, n = [...
|
|
286
|
+
let t = 0, n = [...j.value].reverse();
|
|
240
287
|
for (let r of n) {
|
|
241
288
|
if (r.id === e.id) break;
|
|
242
|
-
r.pinned === "right" && (t +=
|
|
289
|
+
r.pinned === "right" && (t += M(r));
|
|
243
290
|
}
|
|
244
291
|
return t;
|
|
245
292
|
}
|
|
246
|
-
function
|
|
293
|
+
function je(e, t) {
|
|
247
294
|
let n = (r.showGutter ? 2 : 1) + t, i = {};
|
|
248
|
-
return e.pinned === "left" ? (i.position = "sticky", i.left = `${
|
|
295
|
+
return e.pinned === "left" ? (i.position = "sticky", i.left = `${ke(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${Ae(e)}px`, i.zIndex = "3"), {
|
|
249
296
|
gridRow: 1,
|
|
250
297
|
gridColumn: n,
|
|
251
298
|
...i
|
|
252
299
|
};
|
|
253
300
|
}
|
|
254
|
-
function
|
|
301
|
+
function Me(e, t, n) {
|
|
255
302
|
let i = (r.showGutter ? 2 : 1) + n, a = e.__virtualIndex + 2, o = {};
|
|
256
|
-
return t.pinned === "left" ? (o.position = "sticky", o.left = `${
|
|
303
|
+
return t.pinned === "left" ? (o.position = "sticky", o.left = `${ke(t)}px`, o.zIndex = "2") : t.pinned === "right" && (o.position = "sticky", o.right = `${Ae(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, Ne(e))), {
|
|
257
304
|
gridRow: a,
|
|
258
305
|
gridColumn: i,
|
|
259
306
|
...o
|
|
260
307
|
};
|
|
261
308
|
}
|
|
262
|
-
function
|
|
309
|
+
function Ne(e) {
|
|
263
310
|
if (e.pinned === "top") {
|
|
264
|
-
let t =
|
|
311
|
+
let t = V.value.findIndex((t) => t.id === e.id);
|
|
265
312
|
return { top: `calc(var(--nbss-header-height) + var(--nbss-row-height) * ${Math.max(0, t)})` };
|
|
266
313
|
}
|
|
267
314
|
if (e.pinned === "bottom") {
|
|
268
|
-
let t =
|
|
315
|
+
let t = H.value, n = t.findIndex((t) => t.id === e.id);
|
|
269
316
|
return { bottom: `calc(var(--nbss-row-height) * ${Math.max(0, t.length - 1 - n)})` };
|
|
270
317
|
}
|
|
271
318
|
return {};
|
|
272
319
|
}
|
|
273
|
-
function
|
|
274
|
-
return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex -
|
|
320
|
+
function Pe(e) {
|
|
321
|
+
return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex - V.value.length + 1) : e.gutterLabel : e.label;
|
|
275
322
|
}
|
|
276
|
-
function
|
|
323
|
+
function Fe(e) {
|
|
277
324
|
let t = {
|
|
278
325
|
position: "sticky",
|
|
279
326
|
left: "0",
|
|
280
327
|
zIndex: "2"
|
|
281
328
|
};
|
|
282
|
-
return e.pinned && (Object.assign(t,
|
|
329
|
+
return e.pinned && (Object.assign(t, Ne(e)), t.zIndex = "4"), {
|
|
283
330
|
gridRow: e.__virtualIndex + 2,
|
|
284
331
|
gridColumn: 1,
|
|
285
332
|
...t
|
|
286
333
|
};
|
|
287
334
|
}
|
|
288
|
-
function
|
|
289
|
-
if (!
|
|
335
|
+
function Ie(e, t) {
|
|
336
|
+
if (!C.value) return !1;
|
|
290
337
|
let n = [
|
|
291
|
-
...
|
|
292
|
-
...
|
|
293
|
-
...
|
|
294
|
-
].map((e) => e.id), r =
|
|
338
|
+
...V.value,
|
|
339
|
+
...B.value,
|
|
340
|
+
...H.value
|
|
341
|
+
].map((e) => e.id), r = j.value.map((e) => e.id), i = n.indexOf(C.value.startRowId), a = n.indexOf(C.value.endRowId), o = r.indexOf(C.value.startColumnId), s = r.indexOf(C.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
|
|
295
342
|
return c >= Math.min(i, a) && c <= Math.max(i, a) && l >= Math.min(o, s) && l <= Math.max(o, s);
|
|
296
343
|
}
|
|
297
344
|
function K(e, t, n = !1) {
|
|
298
|
-
|
|
345
|
+
h.value = {
|
|
299
346
|
rowId: e,
|
|
300
347
|
columnId: t
|
|
301
|
-
}, n &&
|
|
302
|
-
...
|
|
348
|
+
}, n && C.value ? C.value = {
|
|
349
|
+
...C.value,
|
|
303
350
|
endRowId: e,
|
|
304
351
|
endColumnId: t
|
|
305
|
-
} :
|
|
352
|
+
} : C.value = {
|
|
306
353
|
startRowId: e,
|
|
307
354
|
startColumnId: t,
|
|
308
355
|
endRowId: e,
|
|
309
356
|
endColumnId: t
|
|
310
|
-
}, i("focus",
|
|
357
|
+
}, i("focus", h.value), i("selection", C.value);
|
|
311
358
|
}
|
|
312
|
-
function
|
|
313
|
-
|
|
359
|
+
function Le(e) {
|
|
360
|
+
O = e.pointerType;
|
|
314
361
|
}
|
|
315
|
-
function
|
|
316
|
-
let r =
|
|
317
|
-
if (
|
|
318
|
-
let e =
|
|
319
|
-
|
|
362
|
+
function Re(e, t, n) {
|
|
363
|
+
let r = O === "touch" && !e.shiftKey && h.value?.rowId === t.id && h.value?.columnId === n.id;
|
|
364
|
+
if (O = "", T.value && Q(), w.value = !0, K(t.id, n.id, e.shiftKey), q(), e.preventDefault(), document.addEventListener("mouseup", Be, { once: !0 }), r && !G(t, n)) {
|
|
365
|
+
let e = U(t.id, n.id);
|
|
366
|
+
Z(t, n, e == null ? "" : String(e), "edit");
|
|
320
367
|
}
|
|
321
368
|
}
|
|
322
|
-
function
|
|
323
|
-
!
|
|
324
|
-
...
|
|
369
|
+
function ze(e, t) {
|
|
370
|
+
!w.value || !C.value || (C.value = {
|
|
371
|
+
...C.value,
|
|
325
372
|
endRowId: e.id,
|
|
326
373
|
endColumnId: t.id
|
|
327
|
-
}, i("selection",
|
|
374
|
+
}, i("selection", C.value));
|
|
328
375
|
}
|
|
329
|
-
function
|
|
330
|
-
|
|
376
|
+
function Be() {
|
|
377
|
+
w.value = !1;
|
|
331
378
|
}
|
|
332
|
-
function
|
|
333
|
-
if (
|
|
334
|
-
let n =
|
|
335
|
-
|
|
379
|
+
function Ve(e, t) {
|
|
380
|
+
if (G(e, t)) return;
|
|
381
|
+
let n = U(e.id, t.id);
|
|
382
|
+
Z(e, t, n == null ? "" : String(n), "edit");
|
|
336
383
|
}
|
|
337
384
|
function q() {
|
|
338
385
|
a.value?.focus({ preventScroll: !0 });
|
|
339
386
|
}
|
|
340
387
|
function J(e, t, n = !1) {
|
|
341
|
-
if (!
|
|
342
|
-
let e =
|
|
388
|
+
if (!h.value) {
|
|
389
|
+
let e = j.value[0], t = Se.value[0];
|
|
343
390
|
e && t && K(t.id, e.id);
|
|
344
391
|
return;
|
|
345
392
|
}
|
|
346
393
|
let r = [
|
|
347
|
-
...
|
|
348
|
-
...
|
|
349
|
-
...
|
|
350
|
-
], i = r.findIndex((e) => e.id ===
|
|
351
|
-
K(c, l, n),
|
|
394
|
+
...V.value,
|
|
395
|
+
...B.value,
|
|
396
|
+
...H.value
|
|
397
|
+
], i = r.findIndex((e) => e.id === h.value.rowId), a = j.value.findIndex((e) => e.id === h.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(j.value.length - 1, a + t)), c = r[o].id, l = j.value[s].id;
|
|
398
|
+
K(c, l, n), We(c, l);
|
|
352
399
|
}
|
|
353
|
-
function
|
|
400
|
+
function Y(e) {
|
|
354
401
|
return e.replace(/["\\]/g, "\\$&");
|
|
355
402
|
}
|
|
356
|
-
function
|
|
403
|
+
function X(e) {
|
|
357
404
|
let t = a.value?.querySelector(e);
|
|
358
405
|
return t ? t.offsetHeight : 0;
|
|
359
406
|
}
|
|
360
|
-
function
|
|
407
|
+
function He(e) {
|
|
361
408
|
let t = 0;
|
|
362
|
-
for (let n of e) t +=
|
|
409
|
+
for (let n of e) t += X(`[data-row="${Y(n.id)}"]`);
|
|
363
410
|
return t;
|
|
364
411
|
}
|
|
365
|
-
function
|
|
412
|
+
function Ue(e) {
|
|
366
413
|
let t = e === "left" && r.showGutter ? r.gutterWidth : 0;
|
|
367
|
-
for (let n of
|
|
414
|
+
for (let n of j.value) n.pinned === e && (t += M(n));
|
|
368
415
|
return t;
|
|
369
416
|
}
|
|
370
|
-
function
|
|
417
|
+
function We(e, t) {
|
|
371
418
|
let n = a.value;
|
|
372
419
|
if (!n) return;
|
|
373
|
-
let i =
|
|
420
|
+
let i = B.value.findIndex((t) => t.id === e);
|
|
374
421
|
if (i >= 0) {
|
|
375
|
-
let e =
|
|
422
|
+
let e = X(".nb-spreadsheet__header") || ge, t = X(".nb-spreadsheet__cell") || F.value, r = e + (V.value.length + i) * t, a = e + He(V.value), o = He(H.value);
|
|
376
423
|
r - a < n.scrollTop ? n.scrollTop = r - a : r + t > n.scrollTop + n.clientHeight - o && (n.scrollTop = r + t - n.clientHeight + o);
|
|
377
424
|
}
|
|
378
|
-
let o = t ?
|
|
425
|
+
let o = t ? j.value.find((e) => e.id === t) : void 0;
|
|
379
426
|
if (o && !o.pinned) {
|
|
380
427
|
let e = r.showGutter ? r.gutterWidth : 0;
|
|
381
|
-
for (let t of
|
|
428
|
+
for (let t of j.value) {
|
|
382
429
|
if (t.id === o.id) break;
|
|
383
|
-
e +=
|
|
430
|
+
e += M(t);
|
|
384
431
|
}
|
|
385
|
-
let t =
|
|
432
|
+
let t = M(o), i = Ue("left"), a = Ue("right");
|
|
386
433
|
e - i < n.scrollLeft ? n.scrollLeft = e - i : e + t > n.scrollLeft + n.clientWidth - a && (n.scrollLeft = e + t - n.clientWidth + a);
|
|
387
434
|
}
|
|
388
|
-
|
|
435
|
+
Ge();
|
|
389
436
|
}
|
|
390
|
-
function
|
|
391
|
-
|
|
437
|
+
function Ge() {
|
|
438
|
+
E.value = a.value?.scrollTop ?? 0, D.value = a.value?.scrollLeft ?? 0;
|
|
392
439
|
}
|
|
393
|
-
function
|
|
394
|
-
if (!
|
|
395
|
-
let e = r.rows.find((e) => e.id ===
|
|
440
|
+
function Ke() {
|
|
441
|
+
if (!h.value) return null;
|
|
442
|
+
let e = r.rows.find((e) => e.id === h.value.rowId), t = r.columns.find((e) => e.id === h.value.columnId);
|
|
396
443
|
return e && t ? {
|
|
397
444
|
r: e,
|
|
398
445
|
c: t
|
|
399
446
|
} : null;
|
|
400
447
|
}
|
|
401
|
-
function
|
|
448
|
+
function qe(e) {
|
|
402
449
|
return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
|
|
403
450
|
}
|
|
404
|
-
function
|
|
405
|
-
if (
|
|
406
|
-
e.target !== o.value && (
|
|
451
|
+
function Je(e) {
|
|
452
|
+
if (T.value) {
|
|
453
|
+
e.target !== o.value && (qe(e) ? (e.preventDefault(), T.value.draft += e.key) : Ze(e));
|
|
407
454
|
return;
|
|
408
455
|
}
|
|
409
456
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
|
|
410
|
-
e.preventDefault(), e.shiftKey ?
|
|
457
|
+
e.preventDefault(), e.shiftKey ? ot() : at();
|
|
411
458
|
return;
|
|
412
459
|
}
|
|
413
460
|
switch (e.key) {
|
|
@@ -430,35 +477,35 @@ var D = (e) => {
|
|
|
430
477
|
e.preventDefault(), J(e.shiftKey ? -1 : 1, 0);
|
|
431
478
|
break;
|
|
432
479
|
case "Escape":
|
|
433
|
-
|
|
480
|
+
C.value = null, i("selection", null);
|
|
434
481
|
break;
|
|
435
482
|
case "Delete":
|
|
436
483
|
case "Backspace":
|
|
437
|
-
e.preventDefault(),
|
|
484
|
+
e.preventDefault(), $e();
|
|
438
485
|
break;
|
|
439
486
|
case "F2": {
|
|
440
487
|
e.preventDefault();
|
|
441
|
-
let t =
|
|
442
|
-
if (t && !
|
|
443
|
-
let e =
|
|
444
|
-
|
|
488
|
+
let t = Ke();
|
|
489
|
+
if (t && !G(t.r, t.c)) {
|
|
490
|
+
let e = U(t.r.id, t.c.id);
|
|
491
|
+
Z(t.r, t.c, e == null ? "" : String(e), "edit");
|
|
445
492
|
}
|
|
446
493
|
break;
|
|
447
494
|
}
|
|
448
495
|
default: {
|
|
449
|
-
if (!
|
|
450
|
-
let t =
|
|
451
|
-
t && !
|
|
496
|
+
if (!qe(e)) break;
|
|
497
|
+
let t = Ke();
|
|
498
|
+
t && !G(t.r, t.c) && (e.preventDefault(), Z(t.r, t.c, e.key, "enter"));
|
|
452
499
|
}
|
|
453
500
|
}
|
|
454
501
|
}
|
|
455
|
-
function
|
|
456
|
-
|
|
502
|
+
function Z(e, t, n, r) {
|
|
503
|
+
We(e.id, t.id), T.value = {
|
|
457
504
|
rowId: e.id,
|
|
458
505
|
columnId: t.id,
|
|
459
506
|
draft: n,
|
|
460
507
|
mode: r
|
|
461
|
-
},
|
|
508
|
+
}, g(() => {
|
|
462
509
|
let e = o.value;
|
|
463
510
|
if (e) if (e.focus({ preventScroll: !0 }), r === "enter") {
|
|
464
511
|
let t = e.value.length;
|
|
@@ -466,22 +513,22 @@ var D = (e) => {
|
|
|
466
513
|
} else e.select();
|
|
467
514
|
});
|
|
468
515
|
}
|
|
469
|
-
let
|
|
470
|
-
if (
|
|
471
|
-
}),
|
|
472
|
-
if (!
|
|
473
|
-
let e = a.value, t = e?.querySelector(`[data-cell="${
|
|
516
|
+
let Ye = d(() => {
|
|
517
|
+
if (T.value) return r.columns.find((e) => e.id === T.value.columnId)?.type === "number" ? "decimal" : "text";
|
|
518
|
+
}), Xe = d(() => {
|
|
519
|
+
if (!T.value) return { display: "none" };
|
|
520
|
+
let e = a.value, t = e?.querySelector(`[data-cell="${Y(`${T.value.rowId}::${T.value.columnId}`)}"]`);
|
|
474
521
|
if (!e || !t) return { display: "none" };
|
|
475
522
|
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
476
523
|
return {
|
|
477
|
-
top: `${n.top - r.top - e.clientTop +
|
|
478
|
-
left: `${n.left - r.left - e.clientLeft +
|
|
524
|
+
top: `${n.top - r.top - e.clientTop + E.value}px`,
|
|
525
|
+
left: `${n.left - r.left - e.clientLeft + D.value}px`,
|
|
479
526
|
width: `${n.width}px`,
|
|
480
527
|
height: `${n.height}px`
|
|
481
528
|
};
|
|
482
529
|
});
|
|
483
|
-
function
|
|
484
|
-
let t =
|
|
530
|
+
function Ze(e) {
|
|
531
|
+
let t = T.value?.mode, n = null;
|
|
485
532
|
switch (e.key) {
|
|
486
533
|
case "Enter":
|
|
487
534
|
n = [e.shiftKey ? -1 : 1, 0];
|
|
@@ -502,25 +549,25 @@ var D = (e) => {
|
|
|
502
549
|
t === "enter" && (n = [0, 1]);
|
|
503
550
|
break;
|
|
504
551
|
case "Escape":
|
|
505
|
-
e.preventDefault(),
|
|
552
|
+
e.preventDefault(), T.value = null, q();
|
|
506
553
|
return;
|
|
507
554
|
}
|
|
508
|
-
n && (e.preventDefault(),
|
|
555
|
+
n && (e.preventDefault(), Q(), J(n[0], n[1]));
|
|
509
556
|
}
|
|
510
|
-
function
|
|
511
|
-
if (!
|
|
512
|
-
let { rowId: t, columnId: n, draft: a } =
|
|
513
|
-
|
|
557
|
+
function Q(e = !0) {
|
|
558
|
+
if (!T.value) return;
|
|
559
|
+
let { rowId: t, columnId: n, draft: a } = T.value;
|
|
560
|
+
T.value = null;
|
|
514
561
|
let o = r.columns.find((e) => e.id === n);
|
|
515
562
|
if (!o) return;
|
|
516
563
|
let s;
|
|
517
564
|
try {
|
|
518
|
-
s = o.parse ? o.parse(a) :
|
|
565
|
+
s = o.parse ? o.parse(a) : we(o, a);
|
|
519
566
|
} catch {
|
|
520
567
|
e && q();
|
|
521
568
|
return;
|
|
522
569
|
}
|
|
523
|
-
let c =
|
|
570
|
+
let c = U(t, n);
|
|
524
571
|
if (c !== s) {
|
|
525
572
|
let e = {
|
|
526
573
|
rowId: t,
|
|
@@ -528,29 +575,29 @@ var D = (e) => {
|
|
|
528
575
|
before: c,
|
|
529
576
|
after: s
|
|
530
577
|
};
|
|
531
|
-
|
|
578
|
+
$([e]), i("commit", e), i("change", [e]);
|
|
532
579
|
}
|
|
533
580
|
e && q();
|
|
534
581
|
}
|
|
535
|
-
function
|
|
536
|
-
if (!
|
|
582
|
+
function Qe() {
|
|
583
|
+
if (!C.value) return [];
|
|
537
584
|
let e = [
|
|
538
|
-
...
|
|
539
|
-
...
|
|
540
|
-
...
|
|
541
|
-
].map((e) => e.id), t =
|
|
585
|
+
...V.value,
|
|
586
|
+
...B.value,
|
|
587
|
+
...H.value
|
|
588
|
+
].map((e) => e.id), t = j.value.map((e) => e.id), n = e.indexOf(C.value.startRowId), r = e.indexOf(C.value.endRowId), i = t.indexOf(C.value.startColumnId), a = t.indexOf(C.value.endColumnId), o = [];
|
|
542
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({
|
|
543
590
|
rowId: e[s],
|
|
544
591
|
columnId: t[n]
|
|
545
592
|
});
|
|
546
593
|
return o;
|
|
547
594
|
}
|
|
548
|
-
function
|
|
549
|
-
let e =
|
|
595
|
+
function $e() {
|
|
596
|
+
let e = Qe(), t = [];
|
|
550
597
|
for (let { rowId: n, columnId: i } of e) {
|
|
551
598
|
let e = r.rows.find((e) => e.id === n), a = r.columns.find((e) => e.id === i);
|
|
552
|
-
if (!e || !a ||
|
|
553
|
-
let o =
|
|
599
|
+
if (!e || !a || G(e, a)) continue;
|
|
600
|
+
let o = U(n, i);
|
|
554
601
|
o == null || o === "" || t.push({
|
|
555
602
|
rowId: n,
|
|
556
603
|
columnId: i,
|
|
@@ -559,54 +606,54 @@ var D = (e) => {
|
|
|
559
606
|
});
|
|
560
607
|
}
|
|
561
608
|
if (t.length !== 0) {
|
|
562
|
-
|
|
609
|
+
$(t);
|
|
563
610
|
for (let e of t) i("commit", e);
|
|
564
611
|
i("change", t);
|
|
565
612
|
}
|
|
566
613
|
}
|
|
567
|
-
function
|
|
568
|
-
if (
|
|
614
|
+
function et(e) {
|
|
615
|
+
if (Qe().length === 0) return;
|
|
569
616
|
let t = [
|
|
570
|
-
...
|
|
571
|
-
...
|
|
572
|
-
...
|
|
573
|
-
].map((e) => e.id), n =
|
|
617
|
+
...V.value,
|
|
618
|
+
...B.value,
|
|
619
|
+
...H.value
|
|
620
|
+
].map((e) => e.id), n = j.value.map((e) => e.id), r = Math.min(t.indexOf(C.value.startRowId), t.indexOf(C.value.endRowId)), i = Math.max(t.indexOf(C.value.startRowId), t.indexOf(C.value.endRowId)), a = Math.min(n.indexOf(C.value.startColumnId), n.indexOf(C.value.endColumnId)), o = Math.max(n.indexOf(C.value.startColumnId), n.indexOf(C.value.endColumnId)), s = [];
|
|
574
621
|
for (let e = r; e <= i; e++) {
|
|
575
622
|
let r = [];
|
|
576
623
|
for (let i = a; i <= o; i++) {
|
|
577
|
-
let a =
|
|
624
|
+
let a = U(t[e], n[i]);
|
|
578
625
|
r.push(a == null ? "" : String(a));
|
|
579
626
|
}
|
|
580
627
|
s.push(r.join(" "));
|
|
581
628
|
}
|
|
582
629
|
e.preventDefault(), e.clipboardData?.setData("text/plain", s.join("\n"));
|
|
583
630
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
631
|
+
function tt(e) {
|
|
632
|
+
et(e), $e();
|
|
586
633
|
}
|
|
587
|
-
function
|
|
588
|
-
if (!
|
|
634
|
+
function nt(e) {
|
|
635
|
+
if (!h.value) return;
|
|
589
636
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
590
637
|
if (!t) return;
|
|
591
638
|
e.preventDefault();
|
|
592
639
|
let n = t.replace(/\r\n?/g, "\n").split("\n").map((e) => e.split(" ")), a = [
|
|
593
|
-
...
|
|
594
|
-
...
|
|
595
|
-
...
|
|
596
|
-
].map((e) => e.id), o =
|
|
640
|
+
...V.value,
|
|
641
|
+
...B.value,
|
|
642
|
+
...H.value
|
|
643
|
+
].map((e) => e.id), o = j.value.map((e) => e.id), s = a.indexOf(h.value.rowId), c = o.indexOf(h.value.columnId), l = [];
|
|
597
644
|
if (n.forEach((e, t) => {
|
|
598
645
|
e.forEach((e, n) => {
|
|
599
646
|
let i = a[s + t], u = o[c + n];
|
|
600
647
|
if (!i || !u) return;
|
|
601
648
|
let d = r.rows.find((e) => e.id === i), f = r.columns.find((e) => e.id === u);
|
|
602
|
-
if (!d || !f ||
|
|
649
|
+
if (!d || !f || G(d, f)) return;
|
|
603
650
|
let p;
|
|
604
651
|
try {
|
|
605
|
-
p = f.parse ? f.parse(e) :
|
|
652
|
+
p = f.parse ? f.parse(e) : we(f, e);
|
|
606
653
|
} catch {
|
|
607
654
|
return;
|
|
608
655
|
}
|
|
609
|
-
let m =
|
|
656
|
+
let m = U(i, u);
|
|
610
657
|
m !== p && l.push({
|
|
611
658
|
rowId: i,
|
|
612
659
|
columnId: u,
|
|
@@ -615,13 +662,13 @@ var D = (e) => {
|
|
|
615
662
|
});
|
|
616
663
|
});
|
|
617
664
|
}), l.length !== 0) {
|
|
618
|
-
|
|
665
|
+
$(l);
|
|
619
666
|
for (let e of l) i("commit", e);
|
|
620
667
|
i("change", l);
|
|
621
668
|
}
|
|
622
669
|
}
|
|
623
|
-
function
|
|
624
|
-
let n = e.clientX, r =
|
|
670
|
+
function rt(e, t) {
|
|
671
|
+
let n = e.clientX, r = M(t), i = t.minWidth ?? 60, a = (e) => {
|
|
625
672
|
let a = Math.max(i, r + (e.clientX - n));
|
|
626
673
|
s.value = {
|
|
627
674
|
...s.value,
|
|
@@ -632,20 +679,20 @@ var D = (e) => {
|
|
|
632
679
|
};
|
|
633
680
|
window.addEventListener("mousemove", a), window.addEventListener("mouseup", o);
|
|
634
681
|
}
|
|
635
|
-
function
|
|
636
|
-
e.sortable && (
|
|
682
|
+
function it(e) {
|
|
683
|
+
e.sortable && (c.value?.columnId === e.id ? c.value = c.value.direction === "asc" ? {
|
|
637
684
|
columnId: e.id,
|
|
638
685
|
direction: "desc"
|
|
639
|
-
} : null :
|
|
686
|
+
} : null : c.value = {
|
|
640
687
|
columnId: e.id,
|
|
641
688
|
direction: "asc"
|
|
642
689
|
});
|
|
643
690
|
}
|
|
644
|
-
function
|
|
645
|
-
|
|
691
|
+
function $(e) {
|
|
692
|
+
k.value.push(e), A.value = [];
|
|
646
693
|
}
|
|
647
|
-
function
|
|
648
|
-
let e =
|
|
694
|
+
function at() {
|
|
695
|
+
let e = k.value.pop();
|
|
649
696
|
if (!e) return;
|
|
650
697
|
let t = e.map((e) => ({
|
|
651
698
|
...e,
|
|
@@ -653,92 +700,113 @@ var D = (e) => {
|
|
|
653
700
|
after: e.before
|
|
654
701
|
}));
|
|
655
702
|
for (let e of t) i("commit", e);
|
|
656
|
-
i("change", t),
|
|
703
|
+
i("change", t), A.value.push(e);
|
|
657
704
|
}
|
|
658
|
-
function
|
|
659
|
-
let e =
|
|
705
|
+
function ot() {
|
|
706
|
+
let e = A.value.pop();
|
|
660
707
|
if (e) {
|
|
661
708
|
for (let t of e) i("commit", t);
|
|
662
|
-
i("change", e),
|
|
709
|
+
i("change", e), k.value.push(e);
|
|
663
710
|
}
|
|
664
711
|
}
|
|
665
|
-
return
|
|
666
|
-
q()
|
|
667
|
-
|
|
712
|
+
return te(() => {
|
|
713
|
+
q(), I(), z(), typeof ResizeObserver < "u" && a.value && (L = new ResizeObserver(() => {
|
|
714
|
+
I(), z();
|
|
715
|
+
}), L.observe(a.value));
|
|
716
|
+
}), ee(() => L?.disconnect()), t({
|
|
668
717
|
focus: (e, t) => K(e, t),
|
|
669
|
-
undo:
|
|
670
|
-
redo:
|
|
671
|
-
getSelection: () =>
|
|
672
|
-
}), (t, n) => (
|
|
718
|
+
undo: at,
|
|
719
|
+
redo: ot,
|
|
720
|
+
getSelection: () => C.value
|
|
721
|
+
}), (t, n) => (y(), p("div", {
|
|
722
|
+
class: _(["nb-spreadsheet", {
|
|
723
|
+
"nb-spreadsheet--editing": !!T.value,
|
|
724
|
+
"nb-spreadsheet--fit": e.fit
|
|
725
|
+
}]),
|
|
726
|
+
style: v(ye.value)
|
|
727
|
+
}, [t.$slots.toolbar ? (y(), p("div", ce, [ne(t.$slots, "toolbar", {}, void 0, !0)])) : f("", !0), m("div", {
|
|
673
728
|
ref_key: "scrollerRef",
|
|
674
729
|
ref: a,
|
|
675
730
|
class: "nb-spreadsheet__scroller",
|
|
676
731
|
tabindex: "0",
|
|
677
|
-
onKeydown:
|
|
678
|
-
onCopy:
|
|
679
|
-
onCut:
|
|
680
|
-
onPaste:
|
|
681
|
-
onScroll:
|
|
682
|
-
}, [
|
|
732
|
+
onKeydown: Je,
|
|
733
|
+
onCopy: et,
|
|
734
|
+
onCut: tt,
|
|
735
|
+
onPaste: nt,
|
|
736
|
+
onScroll: Ge
|
|
737
|
+
}, [m("div", {
|
|
683
738
|
class: "nb-spreadsheet__grid",
|
|
684
|
-
style:
|
|
739
|
+
style: v(be.value)
|
|
685
740
|
}, [
|
|
686
|
-
e.showGutter ? (
|
|
687
|
-
(
|
|
741
|
+
e.showGutter ? (y(), p("div", le)) : f("", !0),
|
|
742
|
+
(y(!0), p(u, null, x(j.value, (t, n) => (y(), p("div", {
|
|
688
743
|
key: `h-${t.id}`,
|
|
689
|
-
class:
|
|
690
|
-
|
|
691
|
-
|
|
744
|
+
class: _(["nb-spreadsheet__header", Oe(t)]),
|
|
745
|
+
"data-header-col": t.id,
|
|
746
|
+
style: v(je(t, n)),
|
|
747
|
+
onClick: (e) => it(t)
|
|
692
748
|
}, [
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
749
|
+
m("span", {
|
|
750
|
+
class: "nb-spreadsheet__header-label",
|
|
751
|
+
title: R.value.has(t.id) ? t.label : void 0
|
|
752
|
+
}, S(R.value.has(t.id) ? t.shortLabel : t.label), 9, de),
|
|
753
|
+
c.value && c.value.columnId === t.id ? (y(), p("span", fe, S(c.value.direction === "asc" ? "▲" : "▼"), 1)) : f("", !0),
|
|
754
|
+
e.resizable ? (y(), p("span", {
|
|
696
755
|
key: 1,
|
|
697
756
|
class: "nb-spreadsheet__resize-handle",
|
|
698
|
-
onMousedown:
|
|
699
|
-
}, null, 40,
|
|
700
|
-
], 14,
|
|
701
|
-
(
|
|
757
|
+
onMousedown: se((e) => rt(e, t), ["stop"])
|
|
758
|
+
}, null, 40, pe)) : f("", !0)
|
|
759
|
+
], 14, ue))), 128)),
|
|
760
|
+
(y(!0), p(u, null, x(Se.value, (t) => (y(), p(u, { key: `r-${t.id}` }, [e.showGutter ? (y(), p("div", {
|
|
702
761
|
key: 0,
|
|
703
|
-
class:
|
|
762
|
+
class: _(["nb-spreadsheet__gutter", {
|
|
704
763
|
"nb-spreadsheet__gutter--pinned-top": t.pinned === "top",
|
|
705
764
|
"nb-spreadsheet__gutter--pinned-bottom": t.pinned === "bottom"
|
|
706
765
|
}]),
|
|
707
|
-
style:
|
|
708
|
-
},
|
|
766
|
+
style: v(Fe(t))
|
|
767
|
+
}, S(Pe(t)), 7)) : f("", !0), (y(!0), p(u, null, x(j.value, (e, r) => (y(), p("div", {
|
|
709
768
|
key: `c-${t.id}-${e.id}`,
|
|
710
|
-
class:
|
|
711
|
-
style:
|
|
712
|
-
title:
|
|
769
|
+
class: _(["nb-spreadsheet__cell", Ee(t, e)]),
|
|
770
|
+
style: v(Me(t, e, r)),
|
|
771
|
+
title: De(t, e),
|
|
713
772
|
"data-cell": `${t.id}::${e.id}`,
|
|
714
773
|
"data-row": t.id,
|
|
715
774
|
"data-col": e.id,
|
|
716
|
-
onPointerdown: n[0] ||= (e) =>
|
|
717
|
-
onMousedown: (n) =>
|
|
718
|
-
onMouseenter: (n) =>
|
|
719
|
-
onDblclick: (n) =>
|
|
720
|
-
}, [
|
|
721
|
-
], 4),
|
|
775
|
+
onPointerdown: n[0] ||= (e) => Le(e),
|
|
776
|
+
onMousedown: (n) => Re(n, t, e),
|
|
777
|
+
onMouseenter: (n) => ze(t, e),
|
|
778
|
+
onDblclick: (n) => Ve(t, e)
|
|
779
|
+
}, [m("span", null, S(Te(t, e)), 1)], 46, me))), 128))], 64))), 128))
|
|
780
|
+
], 4), T.value ? oe((y(), p("input", {
|
|
722
781
|
key: 0,
|
|
723
782
|
ref_key: "editorRef",
|
|
724
783
|
ref: o,
|
|
725
|
-
"onUpdate:modelValue": n[1] ||= (e) =>
|
|
784
|
+
"onUpdate:modelValue": n[1] ||= (e) => T.value.draft = e,
|
|
726
785
|
class: "nb-spreadsheet__editor",
|
|
727
|
-
style:
|
|
728
|
-
inputmode:
|
|
786
|
+
style: v(Xe.value),
|
|
787
|
+
inputmode: Ye.value,
|
|
729
788
|
enterkeyhint: "next",
|
|
730
|
-
onBlur: n[2] ||= (e) =>
|
|
731
|
-
onKeydown:
|
|
732
|
-
}, null, 44,
|
|
789
|
+
onBlur: n[2] ||= (e) => Q(!1),
|
|
790
|
+
onKeydown: se(Ze, ["stop"])
|
|
791
|
+
}, null, 44, he)), [[ie, T.value.draft]]) : f("", !0)], 544)], 6));
|
|
733
792
|
}
|
|
734
|
-
}),
|
|
735
|
-
Object.keys(
|
|
736
|
-
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r =
|
|
793
|
+
}), N = /* @__PURE__ */ r({ default: () => P }), P = /* @__PURE__ */ c(M, [["__scopeId", "data-v-08b9812f"]]), F = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": N }), I = { install(e) {
|
|
794
|
+
Object.keys(F).forEach((t) => {
|
|
795
|
+
let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = F[t];
|
|
737
796
|
e.component(n, r.default);
|
|
738
797
|
});
|
|
739
|
-
} },
|
|
798
|
+
} }, L = { install(e, t = {}) {
|
|
740
799
|
if (t.components) for (let [n, r] of Object.entries(t.components)) e.component(n, r);
|
|
741
|
-
e.provide(n, { ...t.button }),
|
|
800
|
+
if (e.provide(n, { ...t.button }), t.ssr) {
|
|
801
|
+
let t = b(!0);
|
|
802
|
+
e.provide(s, { pending: t });
|
|
803
|
+
let n = e.mount.bind(e);
|
|
804
|
+
e.mount = ((...e) => {
|
|
805
|
+
let r = n(...e);
|
|
806
|
+
return t.value = !1, r;
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
e.use(k), e.use(A);
|
|
742
810
|
} };
|
|
743
811
|
//#endregion
|
|
744
|
-
export { A as a, j as i,
|
|
812
|
+
export { A as a, j as i, I as n, D as o, P as r, L as t };
|