@sheetxl/grid-react 0.8.0-beta.6 → 0.8.0-beta.9

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.
@@ -1,6 +1,6 @@
1
1
  (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._grid-stage_rzp9d_1{width:100%;height:100%;position:absolute;top:0;left:0}._grid-stage_rzp9d_1>*{pointer-events:none;position:absolute;inset:0}._grid-stage_rzp9d_1>*>*{pointer-events:auto}._sheetxl-grid_5yo0n_7{box-sizing:border-box;user-select:none;contain:strict;width:100%;height:100%;position:relative}._sheetxl-grid_5yo0n_7 *{box-sizing:border-box!important}._sheetxl-grid_5yo0n_7 :focus{outline:none}._sheetxl-grid_5yo0n_7>*{contain:size layout style}._virtual-div_16eab_1{position:absolute}._tiles_ikr1b_7{will-change:transform}._tiles_ikr1b_7 .tile{white-space:pre;position:absolute}._tiles_ikr1b_7 .tile>*{contain:strict;position:absolute}._gridlines_ikr1b_26,._gridlines_ikr1b_26 *{pointer-events:none;position:absolute;overflow:visible}.cell{letter-spacing:-.25px;padding:2px 4px;font-family:Calibri;line-height:1.2}._search_b1nag_5{box-sizing:border-box;width:100%;min-width:0;font:inherit;color:inherit;background:light-dark(#fff,#2b2b2b);border:1px solid light-dark(#c4c4c4,#5a5a5a);border-radius:2px;outline:none;margin:0;padding:3px 8px}._search_b1nag_5:focus{border-color:var(--sxl-color-primary,#0078d7)}._search_b1nag_5::placeholder{opacity:.6}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
2
2
  /**
3
- * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.8.0-beta.6
3
+ * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.8.0-beta.9
4
4
  *
5
5
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
6
6
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -2660,12 +2660,20 @@ var Kn = (e, t) => {
2660
2660
  options: [e, t]
2661
2661
  };
2662
2662
  }, Yn = (e) => {
2663
- let t = I(), n = B(), r = e?.getElement(), i = {}, a = r?.closest(`[${O}]`)?.getAttribute(O), o = r?.closest(`[${k}]`)?.getAttribute(k);
2664
- a && (i[O] = a), o && (i[k] = o);
2665
- let s = [...t?.themeScope?.classes ?? [], n?.scopeClass].filter(Boolean);
2663
+ let t = I(), n = B(), r = e?.getElement(), i = r?.ownerDocument, a = c((e) => {
2664
+ if (!i || typeof MutationObserver > "u") return () => {};
2665
+ let t = new MutationObserver(e);
2666
+ return t.observe(i.documentElement, {
2667
+ attributes: !0,
2668
+ subtree: !0,
2669
+ attributeFilter: [O, k]
2670
+ }), () => t.disconnect();
2671
+ }, [i]), o = () => `${r?.closest(`[${O}]`)?.getAttribute(O) ?? ""}\n${r?.closest(`[${k}]`)?.getAttribute(k) ?? ""}`, [s, l] = _(a, o, o).split("\n"), u = {};
2672
+ s && (u[O] = s), l && (u[k] = l);
2673
+ let d = [...t?.themeScope?.classes ?? [], n?.scopeClass].filter(Boolean);
2666
2674
  return {
2667
- className: s.length ? s.join(" ") : void 0,
2668
- attrs: i
2675
+ className: d.length ? d.join(" ") : void 0,
2676
+ attrs: u
2669
2677
  };
2670
2678
  }, Xn = (e) => {
2671
2679
  let { side: t, align: n = "center" } = e;
@@ -2839,7 +2847,8 @@ var nr = ({ outOfView: e, close: t }) => (u(() => {
2839
2847
  key: e.key ?? Ee(e.range),
2840
2848
  range: e.range,
2841
2849
  data: e.data,
2842
- placement: e.placement
2850
+ placement: e.placement,
2851
+ alignOffset: e.alignOffset
2843
2852
  }), lr = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, ur = (e) => {
2844
2853
  let t = e.getCoords();
2845
2854
  return t ? `${t.rowIndex},${t.colIndex}` : null;
@@ -2889,7 +2898,7 @@ var nr = ({ outOfView: e, close: t }) => (u(() => {
2889
2898
  anchor: { range: B.range },
2890
2899
  placement: B.placement ?? s,
2891
2900
  offset: c,
2892
- alignOffset: d,
2901
+ alignOffset: B.alignOffset ?? d,
2893
2902
  boundary: h,
2894
2903
  zIndex: g,
2895
2904
  open: V,
@@ -6152,40 +6161,49 @@ var Fa, Ia = parseInt(v.split(".")[0], 10) >= 19 ? function(e) {
6152
6161
  tabIndex: -1,
6153
6162
  style: { margin: 0 }
6154
6163
  }), Ha = a(function(e, t) {
6155
- let { itemCount: n, isChecked: r, onCheckedChange: i, renderValue: a, renderCheckbox: o = Va, renderDivider: s, selectAllLabel: l, itemHeight: u, selection: d, cacheToken: f, autoFocus: g, viewport: _, className: v, style: S, children: C, ...w } = e, T = p(() => new Ci({ getBounds: () => ({
6164
+ let { itemCount: n, isChecked: r, isIndeterminate: i, onCheckedChange: a, renderValue: o, renderCheckbox: s = Va, renderDivider: l, selectAllLabel: d, itemHeight: f, selection: g, cacheToken: _, autoFocus: v, viewport: S, className: C, style: w, children: T, ...E } = e, D = h(n);
6165
+ D.current = n;
6166
+ let O = p(() => new Ci({ getBounds: () => ({
6156
6167
  rowStart: 0,
6157
6168
  colStart: 0,
6158
- rowEnd: Math.max(0, n - 1),
6169
+ rowEnd: Math.max(0, D.current - 1),
6159
6170
  colEnd: 0
6160
- }) }), [n]), E = d ?? T, D = F(() => {
6171
+ }) }), []), k = g ?? O;
6172
+ u(() => {
6173
+ n !== 0 && k.getSelection().cell.rowIndex >= n && k.setSelection({ cell: {
6174
+ rowIndex: n - 1,
6175
+ colIndex: 0
6176
+ } });
6177
+ }, [k, n]);
6178
+ let A = F(() => {
6161
6179
  if (n === 0) return;
6162
- let e = !r(E.getSelection().cell.rowIndex);
6163
- i(((e) => {
6180
+ let e = !r(k.getSelection().cell.rowIndex);
6181
+ a(((e) => {
6164
6182
  let t = e.getSelection();
6165
6183
  return t.ranges && t.ranges.length ? t.ranges.flatMap((e) => Array.from({ length: e.rowEnd - e.rowStart + 1 }, (t, n) => e.rowStart + n)) : [t.cell.rowIndex];
6166
- })(E), e);
6184
+ })(k), e);
6167
6185
  }, [
6168
- E,
6186
+ k,
6169
6187
  n,
6170
6188
  r,
6171
- i
6172
- ]), O = h(null), [, k] = m((e) => e + 1, 0), A = F(() => n === 0 ? -1 : E.getSelection().cell.rowIndex, [E, n]), j = F((e) => {
6189
+ a
6190
+ ]), j = h(null), [, M] = m((e) => e + 1, 0), N = F(() => n === 0 ? -1 : k.getSelection().cell.rowIndex, [k, n]), P = F((e) => {
6173
6191
  if (n === 0) return;
6174
- let t = Math.min(Math.max(0, E.getSelection().cell.rowIndex + e), n - 1);
6175
- E.setSelection({ cell: {
6192
+ let t = Math.min(Math.max(0, k.getSelection().cell.rowIndex + e), n - 1);
6193
+ k.setSelection({ cell: {
6176
6194
  rowIndex: t,
6177
6195
  colIndex: 0
6178
- } }), O.current = { row: t }, k();
6179
- }, [E, n]), M = R(t, () => ({
6196
+ } }), j.current = { row: t }, M();
6197
+ }, [k, n]), I = R(t, () => ({
6180
6198
  isCheckboxList: () => !0,
6181
- getHighlightIndex: A,
6182
- moveHighlight: j,
6183
- toggleHighlighted: D
6199
+ getHighlightIndex: N,
6200
+ moveHighlight: P,
6201
+ toggleHighlighted: A
6184
6202
  }), [
6185
- A,
6186
- j,
6187
- D
6188
- ]), N = c((e) => x("div", {
6203
+ N,
6204
+ P,
6205
+ A
6206
+ ]), L = c((e) => x("div", {
6189
6207
  style: {
6190
6208
  display: "flex",
6191
6209
  alignItems: "center",
@@ -6196,30 +6214,31 @@ var Fa, Ia = parseInt(v.split(".")[0], 10) >= 19 ? function(e) {
6196
6214
  cursor: "pointer"
6197
6215
  },
6198
6216
  onMouseDown: (t) => {
6199
- t.preventDefault(), i([e], !r(e));
6217
+ t.preventDefault(), a([e], !r(e));
6200
6218
  },
6201
6219
  children: [b("div", {
6202
6220
  style: {
6203
6221
  display: "inline-flex",
6204
6222
  pointerEvents: "none"
6205
6223
  },
6206
- children: o(r(e))
6224
+ children: s(r(e), i?.(e))
6207
6225
  }), b("div", {
6208
6226
  style: {
6209
6227
  overflow: "hidden",
6210
6228
  textOverflow: "ellipsis"
6211
6229
  },
6212
- children: a(e)
6230
+ children: o(e)
6213
6231
  })]
6214
6232
  }), [
6215
6233
  r,
6216
6234
  i,
6217
6235
  a,
6218
- o
6219
- ]), P = c((e) => {
6220
- e.key !== " " && e.key !== "Enter" || (e.preventDefault(), e.stopPropagation(), D());
6221
- }, [D]), { allChecked: I, someChecked: L } = p(() => {
6222
- if (l == null || n === 0) return {
6236
+ o,
6237
+ s
6238
+ ]), z = c((e) => {
6239
+ e.key !== " " && e.key !== "Enter" || (e.preventDefault(), e.stopPropagation(), A());
6240
+ }, [A]), { allChecked: ee, someChecked: B } = p(() => {
6241
+ if (d == null || n === 0) return {
6223
6242
  allChecked: !1,
6224
6243
  someChecked: !1
6225
6244
  };
@@ -6230,22 +6249,22 @@ var Fa, Ia = parseInt(v.split(".")[0], 10) >= 19 ? function(e) {
6230
6249
  someChecked: t && !e
6231
6250
  };
6232
6251
  }, [
6233
- l,
6252
+ d,
6234
6253
  n,
6235
6254
  r,
6236
- f
6255
+ _
6237
6256
  ]);
6238
6257
  return x("div", {
6239
- ref: M,
6240
- className: q("checkbox-list", v),
6258
+ ref: I,
6259
+ className: q("checkbox-list", C),
6241
6260
  style: {
6242
6261
  display: "flex",
6243
6262
  flexDirection: "column",
6244
6263
  minHeight: 0,
6245
- ...S
6264
+ ...w
6246
6265
  },
6247
- ...w,
6248
- children: [l != null && x(y, { children: [x("div", {
6266
+ ...E,
6267
+ children: [d != null && x(y, { children: [x("div", {
6249
6268
  style: {
6250
6269
  display: "flex",
6251
6270
  alignItems: "center",
@@ -6255,25 +6274,25 @@ var Fa, Ia = parseInt(v.split(".")[0], 10) >= 19 ? function(e) {
6255
6274
  cursor: "pointer"
6256
6275
  },
6257
6276
  onMouseDown: (e) => {
6258
- e.preventDefault(), i(Array.from({ length: n }, (e, t) => t), !I);
6277
+ e.preventDefault(), a(Array.from({ length: n }, (e, t) => t), !ee);
6259
6278
  },
6260
6279
  children: [b("div", {
6261
6280
  style: {
6262
6281
  display: "inline-flex",
6263
6282
  pointerEvents: "none"
6264
6283
  },
6265
- children: o(I, L)
6266
- }), l]
6267
- }), s?.()] }), b(Ba, {
6284
+ children: s(ee, B)
6285
+ }), d]
6286
+ }), l?.()] }), b(Ba, {
6268
6287
  itemCount: n,
6269
- itemHeight: u,
6270
- selection: E,
6271
- renderItem: N,
6272
- onKeyDown: P,
6273
- cacheToken: f,
6274
- scrollTo: O.current,
6275
- autoFocus: g,
6276
- viewport: _,
6288
+ itemHeight: f,
6289
+ selection: k,
6290
+ renderItem: L,
6291
+ onKeyDown: z,
6292
+ cacheToken: _,
6293
+ scrollTo: j.current,
6294
+ autoFocus: v,
6295
+ viewport: S,
6277
6296
  style: {
6278
6297
  flex: "1 1 100%",
6279
6298
  minHeight: 0