@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.
Files changed (211) hide show
  1. package/dist/{AccordionItem--XeLRz2P.js → AccordionItem-BY-p8UkV.js} +1 -1
  2. package/dist/{AccordionItem-BYSH6dZK.cjs → AccordionItem-p0mYXIj8.cjs} +1 -1
  3. package/dist/{ActionGroup-Cn22xj1t.js → ActionGroup-CjRSKyOa.js} +1 -1
  4. package/dist/{ActionGroup-0rG92kFk.cjs → ActionGroup-DIMZhC7N.cjs} +1 -1
  5. package/dist/AiLabel-BDccQ2iQ.js +242 -0
  6. package/dist/AiLabel-jRrBTu6c.cjs +1 -0
  7. package/dist/{AiProvider-CLtCD_UR.cjs → AiProvider-CGB9EiSf.cjs} +1 -1
  8. package/dist/{AiProvider-gprbR5ts.js → AiProvider-CMbPWtU-.js} +2 -2
  9. package/dist/{BatchActions-Ckx8kyZt.js → BatchActions-Kr2S6CJI.js} +1 -1
  10. package/dist/{BatchActions-6IO5GRFm.cjs → BatchActions-jfvfpZeT.cjs} +1 -1
  11. package/dist/{Board-BdqGOVNF.js → Board-C3_cXRl6.js} +177 -176
  12. package/dist/Board-D6A-irdx.cjs +1 -0
  13. package/dist/{Breadcrumbs-BzyDVvEk.cjs → Breadcrumbs-0rRFiO31.cjs} +1 -1
  14. package/dist/{Breadcrumbs-Bc-acmPE.js → Breadcrumbs-DqagVknq.js} +1 -1
  15. package/dist/{Briefing-DwKWCOGm.cjs → Briefing-B-O-9bhN.cjs} +1 -1
  16. package/dist/{Briefing-BiEICh1u.js → Briefing-DNH-707q.js} +1 -1
  17. package/dist/{ChatMessage-1L_xCXZF.cjs → ChatMessage-B45Xhl8x.cjs} +1 -1
  18. package/dist/{ChatMessage-C2Ecm175.js → ChatMessage-BDOdvI4h.js} +1 -1
  19. package/dist/{ChatThread-B_F3xTdE.cjs → ChatThread-B7F1r4t4.cjs} +1 -1
  20. package/dist/{ChatThread-COdOb1rH.js → ChatThread-DqvsnVOr.js} +1 -1
  21. package/dist/CommandPalette-BaRqoURY.cjs +1 -0
  22. package/dist/CommandPalette-DWv1UV8r.js +294 -0
  23. package/dist/{Confirm-Baz2WG7b.cjs → Confirm-B5vMzPbN.cjs} +1 -1
  24. package/dist/{Confirm-CvMuXK9Q.js → Confirm-C4lT-6HD.js} +1 -1
  25. package/dist/{DataTable-B8THDBLS.js → DataTable-CcwD0PSJ.js} +2 -2
  26. package/dist/{DataTable-DeFzOlcP.cjs → DataTable-xEw-NvHM.cjs} +1 -1
  27. package/dist/{DatePicker-BrUXcNUj.js → DatePicker-3pCNky8d.js} +234 -230
  28. package/dist/DatePicker-BrMicYUx.cjs +1 -0
  29. package/dist/FloatingToolbar-BV-iGNxe.js +120 -0
  30. package/dist/FloatingToolbar-C8xB4BzH.cjs +1 -0
  31. package/dist/{ImagePicker-vhg7b-UL.cjs → ImagePicker-5qPI77Jo.cjs} +1 -1
  32. package/dist/{ImagePicker-LhpR7jjR.js → ImagePicker-BnHg403Q.js} +1 -1
  33. package/dist/InfoHint-CdluaJqE.cjs +1 -0
  34. package/dist/InfoHint-zMuSw_99.js +182 -0
  35. package/dist/{InlineLoading-CA0_IT29.cjs → InlineLoading-CqGrNWHf.cjs} +1 -1
  36. package/dist/{InlineLoading-Cknqq0vv.js → InlineLoading-_j2KKhNQ.js} +1 -1
  37. package/dist/Menu-CWxBEMC4.js +193 -0
  38. package/dist/Menu-D0TerdRm.cjs +1 -0
  39. package/dist/{MenuBarItem-yr5aizl3.js → MenuBarItem-BYh4YWR4.js} +1 -1
  40. package/dist/{MenuBarItem-DlnIAhRw.cjs → MenuBarItem-DTOqacvg.cjs} +1 -1
  41. package/dist/Modal-CmGFLEo4.cjs +1 -0
  42. package/dist/{Modal-CESCi2dE.js → Modal-DwL90AoV.js} +73 -69
  43. package/dist/NotificationCenter-EMlV-oPh.cjs +1 -0
  44. package/dist/{NotificationCenter-DkGc0ETD.js → NotificationCenter-YZnPMH7c.js} +217 -213
  45. package/dist/{OverflowMenu-BWZ7c8oI.js → OverflowMenu-DliuDrTK.js} +1 -1
  46. package/dist/{OverflowMenu-C8q28FrD.cjs → OverflowMenu-DuRgj1DU.cjs} +1 -1
  47. package/dist/{PageHeader-DElq_kdh.cjs → PageHeader-BoEdR_T5.cjs} +1 -1
  48. package/dist/{PageHeader-DOYN9sto.js → PageHeader-c6117xYf.js} +1 -1
  49. package/dist/{Pagination-9mPN8ych.cjs → Pagination-B3lmxggo.cjs} +1 -1
  50. package/dist/{Pagination-CxBHFwy0.js → Pagination-DwAc-4d9.js} +1 -1
  51. package/dist/Select-CDs-7QtW.js +619 -0
  52. package/dist/Select-CJqwMI69.cjs +1 -0
  53. package/dist/{SidebarCollapseToggle-DraqbhwM.js → SidebarCollapseToggle-C38R19gG.js} +1 -1
  54. package/dist/{SidebarCollapseToggle-CABmF-PC.cjs → SidebarCollapseToggle-DOck3Txy.cjs} +1 -1
  55. package/dist/SidebarMenuItem-DzJ_R2__.cjs +1 -0
  56. package/dist/SidebarMenuItem-E410HTei.js +302 -0
  57. package/dist/Spinner-BlzVODzE.js +161 -0
  58. package/dist/Spinner-Bpfgl-mN.cjs +1 -0
  59. package/dist/{Stat-BCvXYr-z.cjs → Stat-BByeMKkT.cjs} +1 -1
  60. package/dist/{Stat-No3RhGB3.js → Stat-DWliDbWE.js} +1 -1
  61. package/dist/Submenu-BkHGYo7X.js +168 -0
  62. package/dist/Submenu-CCQnBpln.cjs +1 -0
  63. package/dist/{SuggestionList-Cxy4jjjd.cjs → SuggestionList-C61Dj6en.cjs} +1 -1
  64. package/dist/{SuggestionList-Dv4yQAi-.js → SuggestionList-D48Ojcf3.js} +1 -1
  65. package/dist/Toaster-Dwjm0bsR.js +285 -0
  66. package/dist/Toaster-aJJvxlEr.cjs +1 -0
  67. package/dist/{UserMenu-CjmhyTwN.js → UserMenu-BTihjCKC.js} +94 -90
  68. package/dist/UserMenu-CHkbByFS.cjs +1 -0
  69. package/dist/{Walkthrough-DYYqtpwJ.js → Walkthrough-BqGB1yaX.js} +63 -59
  70. package/dist/Walkthrough-sGAypY5d.cjs +1 -0
  71. package/dist/all.cjs +1 -1
  72. package/dist/all.mjs +284 -283
  73. package/dist/components/AccordionItem.cjs +1 -1
  74. package/dist/components/AccordionItem.mjs +1 -1
  75. package/dist/components/ActionGroup.cjs +1 -1
  76. package/dist/components/ActionGroup.mjs +1 -1
  77. package/dist/components/AiLabel.cjs +1 -1
  78. package/dist/components/AiLabel.mjs +1 -1
  79. package/dist/components/AiLabel.vue.d.ts.map +1 -1
  80. package/dist/components/AiProvider.cjs +1 -1
  81. package/dist/components/AiProvider.mjs +1 -1
  82. package/dist/components/BatchActions.cjs +1 -1
  83. package/dist/components/BatchActions.mjs +1 -1
  84. package/dist/components/Board.cjs +1 -1
  85. package/dist/components/Board.mjs +1 -1
  86. package/dist/components/Board.vue.d.ts.map +1 -1
  87. package/dist/components/Breadcrumbs.cjs +1 -1
  88. package/dist/components/Breadcrumbs.mjs +1 -1
  89. package/dist/components/Briefing.cjs +1 -1
  90. package/dist/components/Briefing.mjs +1 -1
  91. package/dist/components/ChatMessage.cjs +1 -1
  92. package/dist/components/ChatMessage.mjs +1 -1
  93. package/dist/components/ChatThread.cjs +1 -1
  94. package/dist/components/ChatThread.mjs +1 -1
  95. package/dist/components/CommandPalette.cjs +1 -1
  96. package/dist/components/CommandPalette.mjs +1 -1
  97. package/dist/components/CommandPalette.vue.d.ts.map +1 -1
  98. package/dist/components/Confirm.cjs +1 -1
  99. package/dist/components/Confirm.mjs +1 -1
  100. package/dist/components/DataTable.cjs +1 -1
  101. package/dist/components/DataTable.mjs +1 -1
  102. package/dist/components/DatePicker.cjs +1 -1
  103. package/dist/components/DatePicker.mjs +1 -1
  104. package/dist/components/DatePicker.vue.d.ts.map +1 -1
  105. package/dist/components/FloatingToolbar.cjs +1 -1
  106. package/dist/components/FloatingToolbar.mjs +1 -1
  107. package/dist/components/FloatingToolbar.vue.d.ts.map +1 -1
  108. package/dist/components/ImagePicker.cjs +1 -1
  109. package/dist/components/ImagePicker.mjs +1 -1
  110. package/dist/components/InfoHint.cjs +1 -1
  111. package/dist/components/InfoHint.mjs +1 -1
  112. package/dist/components/InfoHint.vue.d.ts.map +1 -1
  113. package/dist/components/InlineLoading.cjs +1 -1
  114. package/dist/components/InlineLoading.mjs +1 -1
  115. package/dist/components/Menu.cjs +1 -1
  116. package/dist/components/Menu.mjs +1 -1
  117. package/dist/components/Menu.vue.d.ts.map +1 -1
  118. package/dist/components/MenuBarItem.cjs +1 -1
  119. package/dist/components/MenuBarItem.mjs +1 -1
  120. package/dist/components/Modal.cjs +1 -1
  121. package/dist/components/Modal.mjs +1 -1
  122. package/dist/components/Modal.vue.d.ts.map +1 -1
  123. package/dist/components/NotificationCenter.cjs +1 -1
  124. package/dist/components/NotificationCenter.mjs +1 -1
  125. package/dist/components/NotificationCenter.vue.d.ts.map +1 -1
  126. package/dist/components/OverflowMenu.cjs +1 -1
  127. package/dist/components/OverflowMenu.mjs +1 -1
  128. package/dist/components/PageHeader.cjs +1 -1
  129. package/dist/components/PageHeader.mjs +1 -1
  130. package/dist/components/Pagination.cjs +1 -1
  131. package/dist/components/Pagination.mjs +1 -1
  132. package/dist/components/Select.cjs +1 -1
  133. package/dist/components/Select.mjs +1 -1
  134. package/dist/components/Select.vue.d.ts.map +1 -1
  135. package/dist/components/SidebarCollapseToggle.cjs +1 -1
  136. package/dist/components/SidebarCollapseToggle.mjs +1 -1
  137. package/dist/components/SidebarMenuItem.cjs +1 -1
  138. package/dist/components/SidebarMenuItem.mjs +1 -1
  139. package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
  140. package/dist/components/Spinner.cjs +1 -1
  141. package/dist/components/Spinner.mjs +1 -1
  142. package/dist/components/Spinner.vue.d.ts.map +1 -1
  143. package/dist/components/Stat.cjs +1 -1
  144. package/dist/components/Stat.mjs +1 -1
  145. package/dist/components/Submenu.cjs +1 -1
  146. package/dist/components/Submenu.mjs +1 -1
  147. package/dist/components/Submenu.vue.d.ts.map +1 -1
  148. package/dist/components/SuggestionList.cjs +1 -1
  149. package/dist/components/SuggestionList.mjs +1 -1
  150. package/dist/components/Toaster.cjs +1 -1
  151. package/dist/components/Toaster.mjs +1 -1
  152. package/dist/components/Toaster.vue.d.ts.map +1 -1
  153. package/dist/components/UserMenu.cjs +1 -1
  154. package/dist/components/UserMenu.mjs +1 -1
  155. package/dist/components/UserMenu.vue.d.ts.map +1 -1
  156. package/dist/components/Walkthrough.cjs +1 -1
  157. package/dist/components/Walkthrough.mjs +1 -1
  158. package/dist/components/Walkthrough.vue.d.ts.map +1 -1
  159. package/dist/components/labs/Spreadsheet.d.ts +14 -0
  160. package/dist/components/labs/Spreadsheet.vue.d.ts +1 -0
  161. package/dist/components/labs/Spreadsheet.vue.d.ts.map +1 -1
  162. package/dist/composables/useConfirm.composable.cjs +1 -1
  163. package/dist/composables/useConfirm.composable.mjs +2 -2
  164. package/dist/composables/useTeleportReady.composable.cjs +1 -0
  165. package/dist/composables/useTeleportReady.composable.d.ts +30 -0
  166. package/dist/composables/useTeleportReady.composable.d.ts.map +1 -0
  167. package/dist/composables/useTeleportReady.composable.mjs +11 -0
  168. package/dist/index.cjs +1 -1
  169. package/dist/index.mjs +152 -151
  170. package/dist/{main-D6qY7QeE.js → main-B-SiH7ks.js} +305 -237
  171. package/dist/main-CH_BN_4v.cjs +4 -0
  172. package/dist/main.d.ts +10 -1
  173. package/dist/main.d.ts.map +1 -1
  174. package/dist/styles/AiLabel.css +1 -1
  175. package/dist/styles/FloatingToolbar.css +1 -1
  176. package/dist/styles/InfoHint.css +1 -1
  177. package/dist/styles/Modal.css +1 -1
  178. package/dist/styles/SidebarMenuItem.css +1 -1
  179. package/dist/styles/Spinner.css +1 -1
  180. package/dist/styles/Toaster.css +1 -1
  181. package/dist/styles/Walkthrough.css +1 -1
  182. package/dist/styles/main.css +1 -1
  183. package/dist/ui.css +9 -9
  184. package/package.json +1 -1
  185. package/dist/AiLabel-AGSSBanb.cjs +0 -1
  186. package/dist/AiLabel-D32aNf1F.js +0 -240
  187. package/dist/Board-DtOWyvKh.cjs +0 -1
  188. package/dist/CommandPalette-CC_Aj4Uh.cjs +0 -1
  189. package/dist/CommandPalette-zqTMjpm8.js +0 -290
  190. package/dist/DatePicker-B5YRb64p.cjs +0 -1
  191. package/dist/FloatingToolbar-BikX_AsP.js +0 -116
  192. package/dist/FloatingToolbar-DWVY8Fxo.cjs +0 -1
  193. package/dist/InfoHint-BEzkNQTM.cjs +0 -1
  194. package/dist/InfoHint-BlHxrTw6.js +0 -178
  195. package/dist/Menu-7EgnchVu.js +0 -189
  196. package/dist/Menu-Bs2Co1sl.cjs +0 -1
  197. package/dist/Modal-C_EWDvmH.cjs +0 -1
  198. package/dist/NotificationCenter-DxZgHQyt.cjs +0 -1
  199. package/dist/Select-7gJ3_fWh.js +0 -615
  200. package/dist/Select-Dg4HSHOu.cjs +0 -1
  201. package/dist/SidebarMenuItem-DQRQtqrp.js +0 -300
  202. package/dist/SidebarMenuItem-Dwk7vKN5.cjs +0 -1
  203. package/dist/Spinner-DYFhiTB1.js +0 -160
  204. package/dist/Spinner-j13gRoUF.cjs +0 -1
  205. package/dist/Submenu-BDs-yAqv.js +0 -164
  206. package/dist/Submenu-BLjx2kWl.cjs +0 -1
  207. package/dist/Toaster-ByObLDkk.js +0 -284
  208. package/dist/Toaster-CJAbZ9pv.cjs +0 -1
  209. package/dist/UserMenu-BjSO_Uml.cjs +0 -1
  210. package/dist/Walkthrough-DxAIdo3M.cjs +0 -1
  211. 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 { t as s } from "./_plugin-vue_export-helper-C6QCLu9I.js";
5
- import { Fragment as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onMounted as ee, openBlock as _, ref as v, renderList as y, renderSlot as te, toDisplayString as b, useTemplateRef as x, vModelText as ne, withDirectives as re, withModifiers as S } from "vue";
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 || {}), ie = {
69
+ }(j || {}), ce = {
68
70
  key: 0,
69
71
  class: "nb-spreadsheet__toolbar"
70
- }, ae = {
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
- }, oe = ["onClick"], se = { class: "nb-spreadsheet__header-label" }, ce = {
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
- }, le = ["onMousedown"], ue = [
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
- ], de = ["inputmode"], fe = 36, M = 32, N = /* @__PURE__ */ p({
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 = x("scrollerRef"), o = x("editorRef"), s = v({}), p = v(null), C = v(null), w = v(null), T = v(!1), E = v(null), D = v(0), O = v(0), k = "", A = v([]), j = v([]), N = l(() => {
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 P(e) {
134
+ function M(e) {
129
135
  return s.value[e.id] ?? e.width ?? 120;
130
136
  }
131
- let F = l(() => ({ gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") + N.value.map((e) => `${P(e)}px`).join(" ") })), I = l(() => {
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 (!p.value) return e;
134
- let t = r.columns.find((e) => e.id === p.value.columnId);
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 = p.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;
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
- }), L = l(() => r.rows.filter((e) => e.pinned === "top")), R = l(() => r.rows.filter((e) => e.pinned === "bottom")), z = l(() => {
139
- let e = Math.max(1, Math.ceil((a.value?.clientHeight ?? 600) / M)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(D.value / M) - L.value.length - t, i = Math.max(0, n), o = Math.min(I.value.length, i + e + t * 2), s = L.value.map((e, t) => ({
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 = I.value.slice(i, o).map((e, t) => ({
189
+ })), c = B.value.slice(i, o).map((e, t) => ({
144
190
  ...e,
145
- __virtualIndex: i + t + L.value.length
146
- })), l = R.value.map((e, t) => ({
191
+ __virtualIndex: i + t + V.value.length
192
+ })), l = H.value.map((e, t) => ({
147
193
  ...e,
148
- __virtualIndex: L.value.length + I.value.length + t,
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 pe(e, t) {
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 B(e, t) {
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 V(e, t) {
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, V);
234
+ if (r.computed) return r.computed(e, t, U);
189
235
  }
190
- function H(e, t) {
236
+ function W(e, t) {
191
237
  return r.cellAttrs ? r.cellAttrs(e.id, t.id, e, t) ?? {} : {};
192
238
  }
193
- function me(e, t) {
194
- let n = H(e, t);
239
+ function Te(e, t) {
240
+ let n = W(e, t);
195
241
  if (n.display !== void 0) return n.display;
196
- let r = V(e.id, t.id);
197
- return t.format ? t.format(r, e) : pe(t, r);
242
+ let r = U(e.id, t.id);
243
+ return t.format ? t.format(r, e) : Ce(t, r);
198
244
  }
199
- function he(e, t) {
200
- let n = H(e, t), r = C.value?.rowId === e.id && C.value?.columnId === t.id, i = Ce(e.id, t.id);
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": U(e, t),
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 U(e, t) {
259
+ function G(e, t) {
214
260
  if (e.computed || t.readOnly) return !0;
215
- let n = H(e, t);
261
+ let n = W(e, t);
216
262
  return !!n.readOnly || !!n.computed;
217
263
  }
218
- function ge(e, t) {
219
- return H(e, t).tooltip ?? "";
264
+ function De(e, t) {
265
+ return W(e, t).tooltip ?? "";
220
266
  }
221
- function _e(e) {
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 W(e) {
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 N.value) {
278
+ for (let n of j.value) {
232
279
  if (n.id === e.id) break;
233
- n.pinned === "left" && (t += P(n));
280
+ n.pinned === "left" && (t += M(n));
234
281
  }
235
282
  return t;
236
283
  }
237
- function G(e) {
284
+ function Ae(e) {
238
285
  if (e.pinned !== "right") return 0;
239
- let t = 0, n = [...N.value].reverse();
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 += P(r));
289
+ r.pinned === "right" && (t += M(r));
243
290
  }
244
291
  return t;
245
292
  }
246
- function ve(e, t) {
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 = `${W(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${G(e)}px`, i.zIndex = "3"), {
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 ye(e, t, n) {
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 = `${W(t)}px`, o.zIndex = "2") : t.pinned === "right" && (o.position = "sticky", o.right = `${G(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, be(e))), {
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 be(e) {
309
+ function Ne(e) {
263
310
  if (e.pinned === "top") {
264
- let t = L.value.findIndex((t) => t.id === e.id);
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 = R.value, n = t.findIndex((t) => t.id === e.id);
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 xe(e) {
274
- return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex - L.value.length + 1) : e.gutterLabel : e.label;
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 Se(e) {
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, be(e)), t.zIndex = "4"), {
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 Ce(e, t) {
289
- if (!w.value) return !1;
335
+ function Ie(e, t) {
336
+ if (!C.value) return !1;
290
337
  let n = [
291
- ...L.value,
292
- ...I.value,
293
- ...R.value
294
- ].map((e) => e.id), r = N.value.map((e) => e.id), i = n.indexOf(w.value.startRowId), a = n.indexOf(w.value.endRowId), o = r.indexOf(w.value.startColumnId), s = r.indexOf(w.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
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
- C.value = {
345
+ h.value = {
299
346
  rowId: e,
300
347
  columnId: t
301
- }, n && w.value ? w.value = {
302
- ...w.value,
348
+ }, n && C.value ? C.value = {
349
+ ...C.value,
303
350
  endRowId: e,
304
351
  endColumnId: t
305
- } : w.value = {
352
+ } : C.value = {
306
353
  startRowId: e,
307
354
  startColumnId: t,
308
355
  endRowId: e,
309
356
  endColumnId: t
310
- }, i("focus", C.value), i("selection", w.value);
357
+ }, i("focus", h.value), i("selection", C.value);
311
358
  }
312
- function we(e) {
313
- k = e.pointerType;
359
+ function Le(e) {
360
+ O = e.pointerType;
314
361
  }
315
- function Te(e, t, n) {
316
- let r = k === "touch" && !e.shiftKey && C.value?.rowId === t.id && C.value?.columnId === n.id;
317
- if (k = "", E.value && Z(), T.value = !0, K(t.id, n.id, e.shiftKey), q(), e.preventDefault(), document.addEventListener("mouseup", De, { once: !0 }), r && !U(t, n)) {
318
- let e = V(t.id, n.id);
319
- X(t, n, e == null ? "" : String(e), "edit");
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 Ee(e, t) {
323
- !T.value || !w.value || (w.value = {
324
- ...w.value,
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", w.value));
374
+ }, i("selection", C.value));
328
375
  }
329
- function De() {
330
- T.value = !1;
376
+ function Be() {
377
+ w.value = !1;
331
378
  }
332
- function Oe(e, t) {
333
- if (U(e, t)) return;
334
- let n = V(e.id, t.id);
335
- X(e, t, n == null ? "" : String(n), "edit");
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 (!C.value) {
342
- let e = N.value[0], t = z.value[0];
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
- ...L.value,
348
- ...I.value,
349
- ...R.value
350
- ], i = r.findIndex((e) => e.id === C.value.rowId), a = N.value.findIndex((e) => e.id === C.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(N.value.length - 1, a + t)), c = r[o].id, l = N.value[s].id;
351
- K(c, l, n), Me(c, l);
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 ke(e) {
400
+ function Y(e) {
354
401
  return e.replace(/["\\]/g, "\\$&");
355
402
  }
356
- function Y(e) {
403
+ function X(e) {
357
404
  let t = a.value?.querySelector(e);
358
405
  return t ? t.offsetHeight : 0;
359
406
  }
360
- function Ae(e) {
407
+ function He(e) {
361
408
  let t = 0;
362
- for (let n of e) t += Y(`[data-row="${ke(n.id)}"]`);
409
+ for (let n of e) t += X(`[data-row="${Y(n.id)}"]`);
363
410
  return t;
364
411
  }
365
- function je(e) {
412
+ function Ue(e) {
366
413
  let t = e === "left" && r.showGutter ? r.gutterWidth : 0;
367
- for (let n of N.value) n.pinned === e && (t += P(n));
414
+ for (let n of j.value) n.pinned === e && (t += M(n));
368
415
  return t;
369
416
  }
370
- function Me(e, t) {
417
+ function We(e, t) {
371
418
  let n = a.value;
372
419
  if (!n) return;
373
- let i = I.value.findIndex((t) => t.id === e);
420
+ let i = B.value.findIndex((t) => t.id === e);
374
421
  if (i >= 0) {
375
- let e = Y(".nb-spreadsheet__header") || fe, t = Y(".nb-spreadsheet__cell") || M, r = e + (L.value.length + i) * t, a = e + Ae(L.value), o = Ae(R.value);
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 ? N.value.find((e) => e.id === t) : void 0;
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 N.value) {
428
+ for (let t of j.value) {
382
429
  if (t.id === o.id) break;
383
- e += P(t);
430
+ e += M(t);
384
431
  }
385
- let t = P(o), i = je("left"), a = je("right");
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
- Ne();
435
+ Ge();
389
436
  }
390
- function Ne() {
391
- D.value = a.value?.scrollTop ?? 0, O.value = a.value?.scrollLeft ?? 0;
437
+ function Ge() {
438
+ E.value = a.value?.scrollTop ?? 0, D.value = a.value?.scrollLeft ?? 0;
392
439
  }
393
- function Pe() {
394
- if (!C.value) return null;
395
- let e = r.rows.find((e) => e.id === C.value.rowId), t = r.columns.find((e) => e.id === C.value.columnId);
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 Fe(e) {
448
+ function qe(e) {
402
449
  return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
403
450
  }
404
- function Ie(e) {
405
- if (E.value) {
406
- e.target !== o.value && (Fe(e) ? (e.preventDefault(), E.value.draft += e.key) : ze(e));
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 ? $() : qe();
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
- w.value = null, i("selection", null);
480
+ C.value = null, i("selection", null);
434
481
  break;
435
482
  case "Delete":
436
483
  case "Backspace":
437
- e.preventDefault(), Ve();
484
+ e.preventDefault(), $e();
438
485
  break;
439
486
  case "F2": {
440
487
  e.preventDefault();
441
- let t = Pe();
442
- if (t && !U(t.r, t.c)) {
443
- let e = V(t.r.id, t.c.id);
444
- X(t.r, t.c, e == null ? "" : String(e), "edit");
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 (!Fe(e)) break;
450
- let t = Pe();
451
- t && !U(t.r, t.c) && (e.preventDefault(), X(t.r, t.c, e.key, "enter"));
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 X(e, t, n, r) {
456
- Me(e.id, t.id), E.value = {
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
- }, m(() => {
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 Le = l(() => {
470
- if (E.value) return r.columns.find((e) => e.id === E.value.columnId)?.type === "number" ? "decimal" : "text";
471
- }), Re = l(() => {
472
- if (!E.value) return { display: "none" };
473
- let e = a.value, t = e?.querySelector(`[data-cell="${ke(`${E.value.rowId}::${E.value.columnId}`)}"]`);
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 + D.value}px`,
478
- left: `${n.left - r.left - e.clientLeft + O.value}px`,
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 ze(e) {
484
- let t = E.value?.mode, n = null;
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(), E.value = null, q();
552
+ e.preventDefault(), T.value = null, q();
506
553
  return;
507
554
  }
508
- n && (e.preventDefault(), Z(), J(n[0], n[1]));
555
+ n && (e.preventDefault(), Q(), J(n[0], n[1]));
509
556
  }
510
- function Z(e = !0) {
511
- if (!E.value) return;
512
- let { rowId: t, columnId: n, draft: a } = E.value;
513
- E.value = null;
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) : B(o, 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 = V(t, n);
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
- Q([e]), i("commit", e), i("change", [e]);
578
+ $([e]), i("commit", e), i("change", [e]);
532
579
  }
533
580
  e && q();
534
581
  }
535
- function Be() {
536
- if (!w.value) return [];
582
+ function Qe() {
583
+ if (!C.value) return [];
537
584
  let e = [
538
- ...L.value,
539
- ...I.value,
540
- ...R.value
541
- ].map((e) => e.id), t = N.value.map((e) => e.id), n = e.indexOf(w.value.startRowId), r = e.indexOf(w.value.endRowId), i = t.indexOf(w.value.startColumnId), a = t.indexOf(w.value.endColumnId), o = [];
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 Ve() {
549
- let e = Be(), t = [];
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 || U(e, a)) continue;
553
- let o = V(n, i);
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
- Q(t);
609
+ $(t);
563
610
  for (let e of t) i("commit", e);
564
611
  i("change", t);
565
612
  }
566
613
  }
567
- function He(e) {
568
- if (Be().length === 0) return;
614
+ function et(e) {
615
+ if (Qe().length === 0) return;
569
616
  let t = [
570
- ...L.value,
571
- ...I.value,
572
- ...R.value
573
- ].map((e) => e.id), n = N.value.map((e) => e.id), r = Math.min(t.indexOf(w.value.startRowId), t.indexOf(w.value.endRowId)), i = Math.max(t.indexOf(w.value.startRowId), t.indexOf(w.value.endRowId)), a = Math.min(n.indexOf(w.value.startColumnId), n.indexOf(w.value.endColumnId)), o = Math.max(n.indexOf(w.value.startColumnId), n.indexOf(w.value.endColumnId)), s = [];
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 = V(t[e], n[i]);
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 Ue(e) {
585
- He(e), Ve();
631
+ function tt(e) {
632
+ et(e), $e();
586
633
  }
587
- function We(e) {
588
- if (!C.value) return;
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
- ...L.value,
594
- ...I.value,
595
- ...R.value
596
- ].map((e) => e.id), o = N.value.map((e) => e.id), s = a.indexOf(C.value.rowId), c = o.indexOf(C.value.columnId), l = [];
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 || U(d, f)) return;
649
+ if (!d || !f || G(d, f)) return;
603
650
  let p;
604
651
  try {
605
- p = f.parse ? f.parse(e) : B(f, e);
652
+ p = f.parse ? f.parse(e) : we(f, e);
606
653
  } catch {
607
654
  return;
608
655
  }
609
- let m = V(i, u);
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
- Q(l);
665
+ $(l);
619
666
  for (let e of l) i("commit", e);
620
667
  i("change", l);
621
668
  }
622
669
  }
623
- function Ge(e, t) {
624
- let n = e.clientX, r = P(t), i = t.minWidth ?? 60, a = (e) => {
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 Ke(e) {
636
- e.sortable && (p.value?.columnId === e.id ? p.value = p.value.direction === "asc" ? {
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 : p.value = {
686
+ } : null : c.value = {
640
687
  columnId: e.id,
641
688
  direction: "asc"
642
689
  });
643
690
  }
644
- function Q(e) {
645
- A.value.push(e), j.value = [];
691
+ function $(e) {
692
+ k.value.push(e), A.value = [];
646
693
  }
647
- function qe() {
648
- let e = A.value.pop();
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), j.value.push(e);
703
+ i("change", t), A.value.push(e);
657
704
  }
658
- function $() {
659
- let e = j.value.pop();
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), A.value.push(e);
709
+ i("change", e), k.value.push(e);
663
710
  }
664
711
  }
665
- return ee(() => {
666
- q();
667
- }), t({
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: qe,
670
- redo: $,
671
- getSelection: () => w.value
672
- }), (t, n) => (_(), d("div", { class: h(["nb-spreadsheet", { "nb-spreadsheet--editing": !!E.value }]) }, [t.$slots.toolbar ? (_(), d("div", ie, [te(t.$slots, "toolbar", {}, void 0, !0)])) : u("", !0), f("div", {
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: Ie,
678
- onCopy: He,
679
- onCut: Ue,
680
- onPaste: We,
681
- onScroll: Ne
682
- }, [f("div", {
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: g(F.value)
739
+ style: v(be.value)
685
740
  }, [
686
- e.showGutter ? (_(), d("div", ae)) : u("", !0),
687
- (_(!0), d(c, null, y(N.value, (t, n) => (_(), d("div", {
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: h(["nb-spreadsheet__header", _e(t)]),
690
- style: g(ve(t, n)),
691
- onClick: (e) => Ke(t)
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
- f("span", se, b(t.label), 1),
694
- p.value && p.value.columnId === t.id ? (_(), d("span", ce, b(p.value.direction === "asc" ? "▲" : "▼"), 1)) : u("", !0),
695
- e.resizable ? (_(), d("span", {
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: S((e) => Ge(e, t), ["stop"])
699
- }, null, 40, le)) : u("", !0)
700
- ], 14, oe))), 128)),
701
- (_(!0), d(c, null, y(z.value, (t) => (_(), d(c, { key: `r-${t.id}` }, [e.showGutter ? (_(), d("div", {
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: h(["nb-spreadsheet__gutter", {
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: g(Se(t))
708
- }, b(xe(t)), 7)) : u("", !0), (_(!0), d(c, null, y(N.value, (e, r) => (_(), d("div", {
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: h(["nb-spreadsheet__cell", he(t, e)]),
711
- style: g(ye(t, e, r)),
712
- title: ge(t, e),
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) => we(e),
717
- onMousedown: (n) => Te(n, t, e),
718
- onMouseenter: (n) => Ee(t, e),
719
- onDblclick: (n) => Oe(t, e)
720
- }, [f("span", null, b(me(t, e)), 1)], 46, ue))), 128))], 64))), 128))
721
- ], 4), E.value ? re((_(), d("input", {
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) => E.value.draft = e,
784
+ "onUpdate:modelValue": n[1] ||= (e) => T.value.draft = e,
726
785
  class: "nb-spreadsheet__editor",
727
- style: g(Re.value),
728
- inputmode: Le.value,
786
+ style: v(Xe.value),
787
+ inputmode: Ye.value,
729
788
  enterkeyhint: "next",
730
- onBlur: n[2] ||= (e) => Z(!1),
731
- onKeydown: S(ze, ["stop"])
732
- }, null, 44, de)), [[ne, E.value.draft]]) : u("", !0)], 544)], 2));
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
- }), P = /* @__PURE__ */ r({ default: () => F }), F = /* @__PURE__ */ s(N, [["__scopeId", "data-v-a10ecfbb"]]), I = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": P }), L = { install(e) {
735
- Object.keys(I).forEach((t) => {
736
- let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = I[t];
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
- } }, R = { install(e, t = {}) {
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 }), e.use(k), e.use(A);
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, L as n, D as o, F as r, R as t };
812
+ export { A as a, j as i, I as n, D as o, P as r, L as t };