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

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,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.8.0-beta.4
2
+ * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.8.0-beta.6
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -4087,20 +4087,20 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4087
4087
  getRegionBounds: (e) => oe.current?.(e) ?? null
4088
4088
  }), []);
4089
4089
  e.useImperativeHandle(n, () => le, [le]);
4090
- const ie = !!j.ranges && j.ranges.length > 0, se = ie ? [...j.ranges] : [U.cellToRange(j.cell)], ae = se.length > 1, ce = j.rangeIndex ?? -1, de = ie ? ce >= 0 ? ce : se.length - 1 : 0, ue = Q.getRangeFromCell(j.cell), ge = U.unionRanges(se[de] ?? U.cellToRange(j.cell), ue), he = se.filter((e, t) => t !== de), fe = ae ? Po(fo, a) : Po(ho, s), pe = {
4090
+ const ie = !!j.ranges && j.ranges.length > 0, se = ie ? [...j.ranges] : [U.cellToRange(j.cell)], ae = se.length > 1, ce = j.rangeIndex ?? -1, de = ie ? ce >= 0 ? ce : se.length - 1 : 0, ue = Q.getRangeFromCell(j.cell), ge = se[de] ?? U.cellToRange(j.cell), he = ue && U.isRangeWithinRange(ge, ue) ? ue : ge, fe = U.intersectRanges(ue, he) ?? U.cellToRange(j.cell), pe = se.filter((e, t) => t !== de), me = ae ? Po(fo, a) : Po(ho, s), we = {
4091
4091
  ...po,
4092
4092
  ...c
4093
- }, me = Po(mo, u), { refusedColor: we, ...xe } = {
4093
+ }, xe = Po(mo, u), { refusedColor: ve, ...ye } = {
4094
4094
  ...wo,
4095
4095
  ...g
4096
- }, ve = null === f ? null : Po(xo, f), ye = (e, t) => {
4096
+ }, be = null === f ? null : Po(xo, f), Se = (e, t) => {
4097
4097
  const n = t.mods.shiftKey ? t.insert : null, o = t.mods.ctrlKey || t.mods.metaKey, r = n ? Cn(e, n, Q.getTotalRange()) : e, l = {
4098
4098
  to: r,
4099
4099
  copy: o,
4100
4100
  insert: n?.axis
4101
4101
  };
4102
- return l.refused = !!n && !o && (h ? h(ge, l) : U.isRefusedInsertCut(U.classifyInsertCut(ge, r, n.axis))), l;
4103
- }, be = (e) => {
4102
+ return l.refused = !!n && !o && (h ? h(he, l) : U.isRefusedInsertCut(U.classifyInsertCut(he, r, n.axis))), l;
4103
+ }, Ee = (e) => {
4104
4104
  const t = o.getSelection(), n = t.ranges, r = !!n && n.length > 0, l = r ? void 0 !== t.rangeIndex && t.rangeIndex >= 0 && t.rangeIndex < n.length ? t.rangeIndex : n.length - 1 : 0, i = r ? n.map((t, n) => n === l ? e : t) : [e], s = U.isCellWithinRange(t.cell, e) ? t.cell : {
4105
4105
  rowIndex: e.rowStart,
4106
4106
  colIndex: e.colStart
@@ -4110,16 +4110,16 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4110
4110
  ranges: i,
4111
4111
  rangeIndex: l
4112
4112
  });
4113
- }, Se = Z ?? ("extend" === Y.dragMode ? {
4113
+ }, Ie = Z ?? ("extend" === Y.dragMode ? {
4114
4114
  kind: "select",
4115
- range: ge
4116
- } : null), Ee = Se && A ? A(Se) : null, Ie = e.Children.map(ae ? m : p, (t) => {
4115
+ range: he
4116
+ } : null), Ce = Ie && A ? A(Ie) : null, Re = e.Children.map(ae ? m : p, (t) => {
4117
4117
  if (!e.isValidElement(t)) return t;
4118
4118
  const n = t.props;
4119
4119
  return e.cloneElement(t, {
4120
- range: ge,
4120
+ range: he,
4121
4121
  onDragEnd: (e, t) => {
4122
- n.onDragEnd?.(e, t), be(e);
4122
+ n.onDragEnd?.(e, t), Ee(e);
4123
4123
  }
4124
4124
  });
4125
4125
  });
@@ -4132,43 +4132,43 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4132
4132
  le.handleKey(e) && (e.preventDefault(), e.stopPropagation());
4133
4133
  },
4134
4134
  children: [
4135
- "move" === Z?.kind && !Z.drop.copy && ve && !U.isEqualRanges(Z.to, Z.from) && To(ve, Z.from, void 0, !1, "move-source"),
4135
+ "move" === Z?.kind && !Z.drop.copy && be && !U.isEqualRanges(Z.to, Z.from) && To(be, Z.from, void 0, !1, "move-source"),
4136
4136
  v(w, ae ? { children: [
4137
- he.map((t, n) => x(e.Fragment, { children: To(fe, t) }, `other-${n}`)),
4138
- To(fe, ge, K ? ue : void 0),
4137
+ pe.map((t, n) => x(e.Fragment, { children: To(me, t) }, `other-${n}`)),
4138
+ To(me, he, K ? fe : void 0),
4139
4139
  x(tn, {
4140
4140
  className: "anchor",
4141
- range: ue,
4142
- ...pe
4141
+ range: fe,
4142
+ ...we
4143
4143
  })
4144
- ] } : { children: [To(fe, ge, K ? ue : void 0), d && x(tn, {
4144
+ ] } : { children: [To(me, he, K ? fe : void 0), d && x(tn, {
4145
4145
  className: "anchor",
4146
- range: ue,
4146
+ range: fe,
4147
4147
  ...d
4148
4148
  })] }),
4149
4149
  !ae && y && x(Rn, {
4150
4150
  className: "move-grip",
4151
- range: ge,
4151
+ range: he,
4152
4152
  grip: "edges",
4153
4153
  dragCursor: R,
4154
4154
  renderMove: (e, t) => {
4155
- const n = ye(e, t);
4155
+ const n = Se(e, t);
4156
4156
  return n.insert ? x(nn, {
4157
4157
  range: n.to,
4158
4158
  axis: n.insert,
4159
- ...xe,
4160
- color: (n.refused ? we : void 0) ?? xe.color
4161
- }) : fe.border && x(tn, {
4159
+ ...ye,
4160
+ color: (n.refused ? ve : void 0) ?? ye.color
4161
+ }) : me.border && x(tn, {
4162
4162
  className: "move-ghost",
4163
4163
  range: n.to,
4164
- ...fe.border,
4164
+ ...me.border,
4165
4165
  animatedTransition: !0,
4166
4166
  style: { opacity: .6 }
4167
4167
  });
4168
4168
  },
4169
4169
  onEdgeDoubleClick: N,
4170
4170
  onDragStart: (e, t, n) => {
4171
- const o = ye(e, n);
4171
+ const o = Se(e, n);
4172
4172
  E?.(e, t, o), J({
4173
4173
  kind: "move",
4174
4174
  from: e,
@@ -4177,10 +4177,10 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4177
4177
  });
4178
4178
  },
4179
4179
  onDragMove: (e, t, n) => {
4180
- const o = ye(e, n);
4181
- I?.(ge, o.to, t, o), J({
4180
+ const o = Se(e, n);
4181
+ I?.(he, o.to, t, o), J({
4182
4182
  kind: "move",
4183
- from: ge,
4183
+ from: he,
4184
4184
  to: o.to,
4185
4185
  drop: o
4186
4186
  });
@@ -4189,8 +4189,8 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4189
4189
  e || (C?.(), J(null));
4190
4190
  },
4191
4191
  onDragEnd: (e, t, n) => {
4192
- const r = ye(e, n);
4193
- r.refused || (b?.(ge, r.to, t, r), o.modify({
4192
+ const r = Se(e, n);
4193
+ r.refused || (b?.(he, r.to, t, r), o.modify({
4194
4194
  rowIndex: r.to.rowEnd,
4195
4195
  colIndex: r.to.colEnd
4196
4196
  }, {
@@ -4200,9 +4200,9 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4200
4200
  }
4201
4201
  }),
4202
4202
  !ae && M && x(On, {
4203
- range: ge,
4203
+ range: he,
4204
4204
  snapDestination: P,
4205
- ...fe.border,
4205
+ ...me.border,
4206
4206
  onDragStart: (e, t) => {
4207
4207
  D?.(e, t), J({
4208
4208
  kind: "fill",
@@ -4211,41 +4211,41 @@ var Mo = (e, t) => void 0 === t ? e : null === t ? null : {
4211
4211
  });
4212
4212
  },
4213
4213
  onDragMove: (e, t) => {
4214
- T?.(ge, e, t), J({
4214
+ T?.(he, e, t), J({
4215
4215
  kind: "fill",
4216
- template: ge,
4216
+ template: he,
4217
4217
  destination: e
4218
4218
  });
4219
4219
  },
4220
4220
  onDragEnd: (e, t) => {
4221
- k?.(ge, e, t), be(e);
4221
+ k?.(he, e, t), Ee(e);
4222
4222
  },
4223
4223
  onMenu: O ? (e, t, n) => {
4224
- O(ge, e, t, n);
4224
+ O(he, e, t, n);
4225
4225
  } : void 0,
4226
4226
  onDragDone: () => {
4227
4227
  z?.(), J(null);
4228
4228
  },
4229
4229
  onDoubleClick: L ? (e, t) => {
4230
4230
  const n = L(e);
4231
- n && !U.isEqualRanges(n, e) && (k?.(e, n, t), be(n));
4231
+ n && !U.isEqualRanges(n, e) && (k?.(e, n, t), Ee(n));
4232
4232
  } : void 0
4233
4233
  }),
4234
- Y.removePreview && To(me, Y.removePreview, void 0, !1, "remove-preview"),
4235
- Ie,
4236
- null != Ee && Se && x(Tt, {
4234
+ Y.removePreview && To(xe, Y.removePreview, void 0, !1, "remove-preview"),
4235
+ Re,
4236
+ null != Ce && Ie && x(Tt, {
4237
4237
  className: "gesture-tip",
4238
- anchor: { range: (Ce = Se, "move" === Ce.kind ? Ce.to : "fill" === Ce.kind ? Ce.destination : Ce.range) },
4238
+ anchor: { range: (Me = Ie, "move" === Me.kind ? Me.to : "fill" === Me.kind ? Me.destination : Me.range) },
4239
4239
  placement: V ?? ko,
4240
4240
  offset: 8,
4241
4241
  whenOff: "clamp",
4242
4242
  open: !0,
4243
4243
  style: { pointerEvents: "none" },
4244
- children: Ee
4244
+ children: Ce
4245
4245
  })
4246
4246
  ]
4247
4247
  });
4248
- var Ce;
4248
+ var Me;
4249
4249
  });
4250
4250
  Do.displayName = "SelectionLayer";
4251
4251
  var To = (e, t, n, o = !1, r = "range") => v(w, { children: [
@@ -4723,87 +4723,93 @@ function Yo(e) {
4723
4723
  const { editable: t, renderEditor: n, alignment: o = "left", background: r = "var(--sxl-color-base-100, rgb(255, 255, 255))", borderColor: l = "var(--sxl-color-primary, rgb(33, 115, 70))", borderWidth: i = 2, zIndex: s, className: a, style: d, ...u } = e, g = Qe(), h = $(t, (e) => e.getSession()), f = B(h, (e) => e.getState()), [m, w] = p(null), v = z((e) => {
4724
4724
  w((t) => t && t.width === e.width && t.height === e.height ? t : e);
4725
4725
  }, []), y = z((e) => {
4726
- if (t.getSession()) return;
4727
- const n = t.getAnchor().getCoords();
4728
- if (!n) return;
4729
- const o = Vo(e.nativeEvent);
4730
- o && ("Process" !== e.nativeEvent.key && 229 !== e.nativeEvent.keyCode && e.preventDefault(), e.stopPropagation(), t.startEdit(n, o));
4731
- }, [t]), b = z((e) => {
4732
- if (t.getSession()) return;
4733
- const n = g?.getCellFromPointer(e.clientX, e.clientY) ?? t.getAnchor().getCoords();
4734
- n && t.startEdit(n, { mode: "edit" });
4735
- }, [g, t]), S = z((e) => {
4736
4726
  const n = t.commit(e);
4737
4727
  return n && g?.focus(), n;
4738
- }, [t, g]), E = z(() => {
4728
+ }, [t, g]), b = z(() => {
4739
4729
  t.cancel(), g?.focus();
4740
4730
  }, [t, g]);
4741
4731
  c(() => {
4742
4732
  f && g && g.scrollCellCoordsIntoView(f.coords);
4743
4733
  }, [f?.token]);
4744
- const I = f ? f.coords : t.getAnchor().getCoords();
4745
- let C = null, R = !1, M = !1;
4746
- if (g && I) {
4747
- const e = g.getRangeFromCell(I);
4748
- if (M = null !== g.toClipBounds(g.getBoundsFromRange({
4734
+ const S = f ? f.coords : t.getAnchor().getCoords();
4735
+ let E = null, I = !1, C = !1;
4736
+ if (g && S) {
4737
+ const e = g.getRangeFromCell(S);
4738
+ if (C = null !== g.toClipBounds(g.getBoundsFromRange({
4749
4739
  rowStart: e.rowStart,
4750
4740
  colStart: e.colStart,
4751
4741
  rowEnd: e.rowStart,
4752
4742
  colEnd: e.colStart
4753
4743
  })), f) {
4754
- const e = Uo(g, I, m, o, i);
4755
- C = e?.bounds ?? null, R = e?.inView ?? !1;
4756
- } else C = g.getBoundsFromRange(e);
4744
+ const e = Uo(g, S, m, o, i);
4745
+ E = e?.bounds ?? null, I = e?.inView ?? !1;
4746
+ } else E = g.getBoundsFromRange(e);
4757
4747
  }
4758
- let P = null;
4759
- if (g && I) {
4760
- const e = g.getBoundsFromRange(g.getRangeFromCell(I)), t = g.getZoom() || 1;
4761
- e && (P = {
4748
+ let R = null;
4749
+ if (g && S) {
4750
+ const e = g.getBoundsFromRange(g.getRangeFromCell(S)), t = g.getZoom() || 1;
4751
+ e && (R = {
4762
4752
  width: e.width / t,
4763
4753
  height: e.height / t
4764
4754
  });
4765
4755
  }
4766
- const k = !!f && !!C && R, D = {
4756
+ const M = !!f && !!E && I, P = {
4767
4757
  open: !!f,
4768
4758
  mode: f?.mode ?? "enter",
4769
4759
  coords: f?.coords ?? null,
4770
4760
  clean: f?.clean ?? null,
4771
4761
  dirty: f?.dirty,
4772
4762
  token: f?.token ?? 0,
4773
- autoFocus: (f?.autoFocus ?? !0) && k && M,
4763
+ autoFocus: (f?.autoFocus ?? !0) && M && C,
4774
4764
  initialSelection: f?.initialSelection,
4775
4765
  zoom: g?.getZoom() ?? 1,
4776
- cellSize: P,
4766
+ cellSize: R,
4777
4767
  onDirtyChange: (e) => h?.setDirty(e),
4778
4768
  onModeChange: (e) => h?.setMode(e),
4779
- onCommit: S,
4780
- onCancel: E,
4769
+ onCommit: y,
4770
+ onCancel: b,
4781
4771
  onNaturalSize: v
4782
- }, T = "function" == typeof r ? (I ? r(I) : void 0) ?? "transparent" : r;
4772
+ }, k = "function" == typeof r ? (S ? r(S) : void 0) ?? "transparent" : r;
4773
+ return x(nt, { children: E ? x(st, {
4774
+ ...u,
4775
+ className: H(a, "editor"),
4776
+ bounds: E,
4777
+ alignWidth: i,
4778
+ keepMounted: !0,
4779
+ style: {
4780
+ ...d,
4781
+ display: "flex",
4782
+ overflow: "hidden",
4783
+ background: k,
4784
+ borderColor: l,
4785
+ boxShadow: M ? "rgba(60,64,67,.35) 2px 2px 6px 3px" : "none",
4786
+ opacity: M ? 1 : 0,
4787
+ pointerEvents: M ? "auto" : "none"
4788
+ },
4789
+ children: n ? n(P) : x(Xo, { ...P })
4790
+ }) : null });
4791
+ }
4792
+ function qo(e) {
4793
+ const { editable: t } = e, n = Qe();
4783
4794
  return x(nt, {
4784
- onKeyDown: y,
4785
- onDoubleClick: b,
4786
- children: C ? x(st, {
4787
- ...u,
4788
- className: H(a, "editor"),
4789
- bounds: C,
4790
- alignWidth: i,
4791
- keepMounted: !0,
4792
- style: {
4793
- ...d,
4794
- display: "flex",
4795
- overflow: "hidden",
4796
- background: T,
4797
- borderColor: l,
4798
- boxShadow: k ? "rgba(60,64,67,.35) 2px 2px 6px 3px" : "none",
4799
- opacity: k ? 1 : 0,
4800
- pointerEvents: k ? "auto" : "none"
4801
- },
4802
- children: n ? n(D) : x(Xo, { ...D })
4803
- }) : null
4795
+ className: "editor-start",
4796
+ onKeyDown: z((e) => {
4797
+ if (t.getSession()) return;
4798
+ const o = n?.getElement();
4799
+ if (o && e.target !== o) return;
4800
+ const r = t.getAnchor().getCoords();
4801
+ if (!r) return;
4802
+ const l = Vo(e.nativeEvent);
4803
+ l && ("Process" !== e.nativeEvent.key && 229 !== e.nativeEvent.keyCode && e.preventDefault(), e.stopPropagation(), t.startEdit(r, l));
4804
+ }, [t, n]),
4805
+ onDoubleClick: z((e) => {
4806
+ if (t.getSession()) return;
4807
+ const o = n?.getCellFromPointer(e.clientX, e.clientY) ?? t.getAnchor().getCoords();
4808
+ o && t.startEdit(o, { mode: "edit" });
4809
+ }, [n, t])
4804
4810
  });
4805
4811
  }
4806
- function qo(e) {
4812
+ function Zo(e) {
4807
4813
  const { editable: t, renderEditor: n, idleClean: o = null, mapClean: r, editorId: l, readOnly: i, className: s, style: a } = e, c = $(t, (e) => e.getSession()), d = B(c, (e) => e.getState()), u = d?.clean ?? o, g = r ? r(u) : u, h = z((e) => t.commit(e), [t]), f = z(() => t.cancel(), [t]), p = z(() => {
4808
4814
  i || (t.getSession() || t.startEdit(t.getAnchor().getCoords(), {
4809
4815
  mode: "edit",
@@ -4836,8 +4842,8 @@ function qo(e) {
4836
4842
  children: n ? n(m) : x(Xo, { ...m })
4837
4843
  });
4838
4844
  }
4839
- Xo.displayName = "DefaultEditorInput", qo.displayName = "EditorDiv";
4840
- var Zo = "ew-resize", Jo = "ns-resize", Qo = i(r((e, t) => {
4845
+ Xo.displayName = "DefaultEditorInput", Zo.displayName = "EditorDiv";
4846
+ var Jo = "ew-resize", Qo = "ns-resize", er = i(r((e, t) => {
4841
4847
  const { axis: n, index: o, className: r, style: l, disabled: i = !1, disabledResize: s = !1, isNextHidden: a, isHidden: c, isSelected: d, isSelectedAll: u, showTouchDivider: g, bounds: h, onPointerDown: f, onAutoFit: p, ...m } = e, w = Je(), y = n === X.Column, b = 1 / E.getDevicePixelRatio(), S = d || u, I = S ? "color-mix(in srgb, var(--sxl-color-primary, rgb(33, 115, 70)) 35%, var(--sxl-color-base-300, rgb(171, 171, 171)))" : "var(--sxl-color-base-300, rgb(171, 171, 171))", C = "var(--sxl-color-base-100, #f5f5f5)", R = "touch" === E.detectIt().primaryInput;
4842
4848
  let M = y ? 14 : 8;
4843
4849
  const P = w.getZoom();
@@ -4858,7 +4864,7 @@ var Zo = "ew-resize", Jo = "ns-resize", Qo = i(r((e, t) => {
4858
4864
  position: "absolute",
4859
4865
  overflow: "visible",
4860
4866
  pointerEvents: "auto",
4861
- cursor: i || s || R ? void 0 : y ? Zo : Jo,
4867
+ cursor: i || s || R ? void 0 : y ? Jo : Qo,
4862
4868
  ...l
4863
4869
  },
4864
4870
  ...m,
@@ -4902,8 +4908,8 @@ var Zo = "ew-resize", Jo = "ns-resize", Qo = i(r((e, t) => {
4902
4908
  } })
4903
4909
  }) : null]
4904
4910
  });
4905
- })), er = (e) => x(Qo, { ...e }), tr = i(r((e, t) => {
4906
- const { axis: n, index: o, disabled: r = !1, disabledResize: l = !1, resizeThreshold: i = 1, renderDivider: s = er, onDividerMouseDown: a, onDividerResizeStart: c, onDividerResize: d, onDividerResizeEnd: u, onDividerMouseUp: g, onDividerAutoFit: h, onPointerDown: m, ...y } = e, b = Je(), S = z(m, [m]), I = z(h, [h]), C = n === X.Column;
4911
+ })), tr = (e) => x(er, { ...e }), nr = i(r((e, t) => {
4912
+ const { axis: n, index: o, disabled: r = !1, disabledResize: l = !1, resizeThreshold: i = 1, renderDivider: s = tr, onDividerMouseDown: a, onDividerResizeStart: c, onDividerResize: d, onDividerResizeEnd: u, onDividerMouseUp: g, onDividerAutoFit: h, onPointerDown: m, ...y } = e, b = Je(), S = z(m, [m]), I = z(h, [h]), C = n === X.Column;
4907
4913
  let R = C ? b.getVisibleColumns() : b.getVisibleRows(), M = null;
4908
4914
  R.length > 0 && (M = C ? b.getBoundsFromRange({
4909
4915
  rowStart: 0,
@@ -4969,7 +4975,7 @@ var Zo = "ew-resize", Jo = "ns-resize", Qo = i(r((e, t) => {
4969
4975
  let U = null;
4970
4976
  return k && k.isResizing && k.index === o && (U = q(x("div", { style: {
4971
4977
  position: "absolute",
4972
- cursor: C ? Zo : Jo,
4978
+ cursor: C ? Jo : Qo,
4973
4979
  left: 0,
4974
4980
  top: 0,
4975
4981
  width: "100%",
@@ -4989,26 +4995,26 @@ var Zo = "ew-resize", Jo = "ns-resize", Qo = i(r((e, t) => {
4989
4995
  children: W
4990
4996
  })] });
4991
4997
  }));
4992
- tr.displayName = "HeaderDividerAnchor";
4993
- var nr = (e, t, n) => t === X.Column ? {
4998
+ nr.displayName = "HeaderDividerAnchor";
4999
+ var or = (e, t, n) => t === X.Column ? {
4994
5000
  rowIndex: n.rowStart,
4995
5001
  colIndex: e.colIndex
4996
5002
  } : {
4997
5003
  rowIndex: e.rowIndex,
4998
5004
  colIndex: n.colStart
4999
- }, or = (e, t, n) => t === X.Column ? {
5005
+ }, rr = (e, t, n) => t === X.Column ? {
5000
5006
  rowIndex: n.rowEnd,
5001
5007
  colIndex: e.colIndex
5002
5008
  } : {
5003
5009
  rowIndex: e.rowIndex,
5004
5010
  colIndex: n.colEnd
5005
- }, rr = (e, t, n) => t === X.Column ? {
5011
+ }, lr = (e, t, n) => t === X.Column ? {
5006
5012
  rowIndex: n.rowStart,
5007
5013
  colIndex: e.colIndex
5008
5014
  } : {
5009
5015
  rowIndex: e.rowIndex,
5010
5016
  colIndex: n.colStart
5011
- }, lr = (e, t, n, o) => n === X.Column ? {
5017
+ }, ir = (e, t, n, o) => n === X.Column ? {
5012
5018
  rowStart: o.rowStart,
5013
5019
  rowEnd: o.rowEnd,
5014
5020
  colStart: Math.min(e.colIndex, t.colIndex),
@@ -5018,7 +5024,7 @@ var nr = (e, t, n) => t === X.Column ? {
5018
5024
  colEnd: o.colEnd,
5019
5025
  rowStart: Math.min(e.rowIndex, t.rowIndex),
5020
5026
  rowEnd: Math.max(e.rowIndex, t.rowIndex)
5021
- }, ir = (e, t, n) => {
5027
+ }, sr = (e, t, n) => {
5022
5028
  let o = null, r = null, l = 0;
5023
5029
  const i = () => t.getAllPanes()[_.Center] ?? t, s = (t, n, o) => {
5024
5030
  if (!e) return;
@@ -5061,7 +5067,7 @@ var nr = (e, t, n) => t === X.Column ? {
5061
5067
  let s = null;
5062
5068
  return t === X.Column ? e.x >= r.right - 24 && l.colEnd < o.colEnd ? s = { colIndex: l.colEnd + 1 } : e.x <= r.left + 24 && l.colStart > o.colStart && (s = { colIndex: l.colStart - 1 }) : e.y >= r.bottom - 24 && l.rowEnd < o.rowEnd ? s = { rowIndex: l.rowEnd + 1 } : e.y <= r.top + 24 && l.rowStart > o.rowStart && (s = { rowIndex: l.rowStart - 1 }), !!s && (c(s), !0);
5063
5069
  }, u = (e) => {
5064
- const { axis: t, entireRange: c, replaceActive: d = !1 } = n(), u = lr(o ?? e, e, t, c), g = r ?? rr(e, t, i().getVisibleRange());
5070
+ const { axis: t, entireRange: c, replaceActive: d = !1 } = n(), u = ir(o ?? e, e, t, c), g = r ?? lr(e, t, i().getVisibleRange());
5065
5071
  d ? a(l, u, g) : s(u, g, "replace");
5066
5072
  };
5067
5073
  return gn(t, (t, g) => {
@@ -5071,11 +5077,11 @@ var nr = (e, t, n) => t === X.Column ? {
5071
5077
  const { axis: p, entireRange: m, allowMulti: w = !0, replaceActive: x = !1, preserveFocus: v = !1, onPointerDownInterceptor: y, onDragStart: b, onDragEnd: S, onPointerUp: E } = n();
5072
5078
  if (!1 === y?.(g, t)) return null;
5073
5079
  x && g.stopPropagation(), v && h && g.preventDefault(), b?.();
5074
- const I = rr(t, p, i().getVisibleRange()), C = g.shiftKey, R = (g.ctrlKey || g.metaKey) && w;
5080
+ const I = lr(t, p, i().getVisibleRange()), C = g.shiftKey, R = (g.ctrlKey || g.metaKey) && w;
5075
5081
  if (x) {
5076
5082
  const n = e.getSelection(), i = n.ranges ?? [], s = n.rangeIndex ?? -1;
5077
- C && o ? (l = s >= 0 ? s : Math.max(0, i.length - 1), a(l, lr(o, t, p, m), r ?? I)) : (o = t, r = I, l = R || s < 0 ? i.length : s, a(l, lr(t, t, p, m), I));
5078
- } else C && o ? s(lr(o, t, p, m), r ?? I, "replace") : R ? (o = t, r = I, s(lr(t, t, p, m), I, "append")) : (o = t, r = I, s(lr(t, t, p, m), I, "clear"));
5083
+ C && o ? (l = s >= 0 ? s : Math.max(0, i.length - 1), a(l, ir(o, t, p, m), r ?? I)) : (o = t, r = I, l = R || s < 0 ? i.length : s, a(l, ir(t, t, p, m), I));
5084
+ } else C && o ? s(ir(o, t, p, m), r ?? I, "replace") : R ? (o = t, r = I, s(ir(t, t, p, m), I, "append")) : (o = t, r = I, s(ir(t, t, p, m), I, "clear"));
5079
5085
  return ((e) => {
5080
5086
  c(n().axis === X.Column ? { colIndex: e.colIndex } : { rowIndex: e.rowIndex });
5081
5087
  })(t), {
@@ -5091,16 +5097,16 @@ var nr = (e, t, n) => t === X.Column ? {
5091
5097
  captureEvents: x
5092
5098
  };
5093
5099
  });
5094
- }, sr = (e, t) => {
5100
+ }, ar = (e, t) => {
5095
5101
  const n = Je(), o = f(t);
5096
5102
  o.current = t;
5097
- const r = g(() => ir(e, n, () => o.current), [e, n]);
5103
+ const r = g(() => sr(e, n, () => o.current), [e, n]);
5098
5104
  return c(() => () => r.dispose(), [r]), {
5099
5105
  onPointerDown: r.onPointerDown,
5100
5106
  onPointerMove: r.onPointerMove,
5101
5107
  onPointerUp: r.onPointerUp
5102
5108
  };
5103
- }, ar = (e) => null == e ? [] : Array.isArray(e) ? e : [e], cr = i(r((e, t) => {
5109
+ }, cr = (e) => null == e ? [] : Array.isArray(e) ? e : [e], dr = i(r((e, t) => {
5104
5110
  const { rowCount: n = 1, columnCount: o = 1, getRowHeight: r, getColumnWidth: l, metrics: i, renderCells: a, renderBorders: c, showGridLines: d = !0, gridLineColor: u, propsGridLineRows: f, propsGridLineColumns: p, getVisibleCells: m, hiddenCellAt: w, renderBelow: v, children: y, ...b } = e, S = le({
5105
5111
  rowCount: n,
5106
5112
  columnCount: o,
@@ -5117,12 +5123,12 @@ var nr = (e, t, n) => t === X.Column ? {
5117
5123
  propsColumns: p,
5118
5124
  getVisibleCells: m,
5119
5125
  hiddenCellAt: w
5120
- }, "__gridlines")), e.push(...ar(v)), e.push(...ar(c)), a && e.push(x(jn, {
5126
+ }, "__gridlines")), e.push(...cr(v)), e.push(...cr(c)), a && e.push(x(jn, {
5121
5127
  renderCell: a,
5122
5128
  getVisibleCells: m,
5123
5129
  hiddenCellAt: w,
5124
5130
  cacheToken: R
5125
- }, "__cells")), e.push(...ar(y)), e;
5131
+ }, "__cells")), e.push(...cr(y)), e;
5126
5132
  }, [
5127
5133
  d,
5128
5134
  u,
@@ -5145,16 +5151,16 @@ var nr = (e, t, n) => t === X.Column ? {
5145
5151
  children: k
5146
5152
  });
5147
5153
  }));
5148
- cr.displayName = "Grid";
5149
- var dr, ur = {
5154
+ dr.displayName = "Grid";
5155
+ var ur, gr = {
5150
5156
  fill: { fill: "color-mix(in srgb, var(--sxl-color-primary, rgb(0, 120, 215)) 14%, transparent)" },
5151
5157
  border: null,
5152
5158
  inner: null
5153
- }, gr = {
5159
+ }, hr = {
5154
5160
  stroke: "var(--sxl-color-primary, rgb(0, 120, 215))",
5155
5161
  alignWidth: 1,
5156
5162
  inset: 1
5157
- }, hr = r(function(e, t) {
5163
+ }, fr = r(function(e, t) {
5158
5164
  const { itemCount: n, renderCell: o, getVisibleCells: r, itemHeight: l = 24, contentWidth: i, selection: s, propsLayer: a, autoFocus: d, showScrollbar: u = "auto", scrollTo: h, viewport: p, cacheToken: m, className: w, style: y, children: b, ...S } = e, E = g(() => new P(), []), I = p ?? E, R = $(I, (e) => e.getMetrics()), M = "auto" === u ? R.totalHeight > R.height : u, k = f(null);
5159
5165
  c(() => {
5160
5166
  d && k.current?.focus();
@@ -5224,9 +5230,9 @@ var dr, ur = {
5224
5230
  x(Do, {
5225
5231
  selection: T,
5226
5232
  anchorHole: !1,
5227
- singleStyle: ur,
5228
- singleAnchorStyle: gr,
5229
- multiAnchorStyle: gr
5233
+ singleStyle: gr,
5234
+ singleAnchorStyle: hr,
5235
+ multiAnchorStyle: hr
5230
5236
  }, "__selection"),
5231
5237
  x(jn, {
5232
5238
  renderCell: o,
@@ -5239,7 +5245,7 @@ var dr, ur = {
5239
5245
  })
5240
5246
  })
5241
5247
  });
5242
- }), fr = r(function(e, t) {
5248
+ }), pr = r(function(e, t) {
5243
5249
  const { itemCount: n, renderItem: o, itemHeight: r, selection: l, onKeyDown: i, cacheToken: a, scrollTo: c, autoFocus: d, viewport: u, className: h, style: f, children: p, ...m } = e, w = N(t, () => ({ isList: () => !0 }), []), v = s((e) => {
5244
5250
  const { key: t, style: n, range: r, cell: l } = e, i = r?.rowStart ?? l.rowIndex;
5245
5251
  return x("div", {
@@ -5259,7 +5265,7 @@ var dr, ur = {
5259
5265
  children: o(i)
5260
5266
  }, t);
5261
5267
  }, [o]), y = g(() => i ? { onKeyDown: i } : void 0, [i]);
5262
- return x(hr, {
5268
+ return x(fr, {
5263
5269
  ref: w,
5264
5270
  className: H("list", h),
5265
5271
  style: f,
@@ -5274,7 +5280,7 @@ var dr, ur = {
5274
5280
  viewport: u,
5275
5281
  ...m
5276
5282
  });
5277
- }), pr = (e, t) => x("input", {
5283
+ }), mr = (e, t) => x("input", {
5278
5284
  type: "checkbox",
5279
5285
  checked: e,
5280
5286
  ref: (e) => {
@@ -5283,8 +5289,8 @@ var dr, ur = {
5283
5289
  readOnly: !0,
5284
5290
  tabIndex: -1,
5285
5291
  style: { margin: 0 }
5286
- }), mr = r(function(e, t) {
5287
- const { itemCount: n, isChecked: o, onCheckedChange: r, renderValue: l, renderCheckbox: i = pr, renderDivider: a, selectAllLabel: c, itemHeight: d, selection: u, cacheToken: p, autoFocus: m, viewport: y, className: b, style: S, children: E, ...I } = e, C = g(() => new ro({ getBounds: () => ({
5292
+ }), wr = r(function(e, t) {
5293
+ const { itemCount: n, isChecked: o, onCheckedChange: r, renderValue: l, renderCheckbox: i = mr, renderDivider: a, selectAllLabel: c, itemHeight: d, selection: u, cacheToken: p, autoFocus: m, viewport: y, className: b, style: S, children: E, ...I } = e, C = g(() => new ro({ getBounds: () => ({
5288
5294
  rowStart: 0,
5289
5295
  colStart: 0,
5290
5296
  rowEnd: Math.max(0, n - 1),
@@ -5396,7 +5402,7 @@ var dr, ur = {
5396
5402
  },
5397
5403
  children: i(B, F)
5398
5404
  }), c]
5399
- }), a?.()] }), x(fr, {
5405
+ }), a?.()] }), x(pr, {
5400
5406
  itemCount: n,
5401
5407
  itemHeight: d,
5402
5408
  selection: R,
@@ -5412,21 +5418,21 @@ var dr, ur = {
5412
5418
  }
5413
5419
  })]
5414
5420
  });
5415
- }), wr = (e, t) => {
5421
+ }), xr = (e, t) => {
5416
5422
  const n = (() => {
5417
- if (void 0 !== dr) return dr;
5423
+ if (void 0 !== ur) return ur;
5418
5424
  try {
5419
- dr = ("undefined" != typeof document ? document.createElement("canvas").getContext("2d") : null) ?? null;
5425
+ ur = ("undefined" != typeof document ? document.createElement("canvas").getContext("2d") : null) ?? null;
5420
5426
  } catch {
5421
- dr = null;
5427
+ ur = null;
5422
5428
  }
5423
- return dr;
5429
+ return ur;
5424
5430
  })();
5425
5431
  if (n) return n.font = t, n.measureText(e).width;
5426
5432
  const o = Number.parseFloat((/(\d+(?:\.\d+)?)px/.exec(t) ?? [])[1] ?? "16") || 16;
5427
5433
  return e.length * o * .55;
5428
- }, xr = (e, t) => t <= 0 ? -1 : Math.min(Math.max(0, e), t - 1), vr = r(function(e, t) {
5429
- const { items: n, onChoose: o, highlightIndex: r, itemHeight: l = 24, visibleRows: i = 8, contentWidth: a, measureText: c, renderItem: d, autoFocus: u, viewport: p, className: m, style: w, children: v, ...y } = e, S = n.length, E = xr(r ?? 0, S), I = g(() => new ro({
5434
+ }, vr = (e, t) => t <= 0 ? -1 : Math.min(Math.max(0, e), t - 1), yr = r(function(e, t) {
5435
+ const { items: n, onChoose: o, highlightIndex: r, itemHeight: l = 24, visibleRows: i = 8, contentWidth: a, measureText: c, renderItem: d, autoFocus: u, viewport: p, className: m, style: w, children: v, ...y } = e, S = n.length, E = vr(r ?? 0, S), I = g(() => new ro({
5430
5436
  initial: { cell: {
5431
5437
  rowIndex: Math.max(0, E),
5432
5438
  colIndex: 0
@@ -5447,7 +5453,7 @@ var dr, ur = {
5447
5453
  S
5448
5454
  ]), D = z(() => 0 === S ? -1 : I.getSelection().cell.rowIndex, [I, S]), T = z((e) => {
5449
5455
  if (0 === S) return;
5450
- const t = xr(I.getSelection().cell.rowIndex + e, S);
5456
+ const t = vr(I.getSelection().cell.rowIndex + e, S);
5451
5457
  I.setSelection({ cell: {
5452
5458
  rowIndex: t,
5453
5459
  colIndex: 0
@@ -5467,7 +5473,7 @@ var dr, ur = {
5467
5473
  const t = e?.fontSize, n = e?.fontFamily, o = "number" == typeof t ? `${t}px` : t ?? "16px", r = [];
5468
5474
  return e?.fontStyle && "normal" !== e.fontStyle && r.push(String(e.fontStyle)), e?.fontWeight && "normal" !== e.fontWeight && r.push(String(e.fontWeight)), r.push(o, n ? String(n) : "sans-serif"), r.join(" ");
5469
5475
  })(w);
5470
- return (t) => wr(t, e);
5476
+ return (t) => xr(t, e);
5471
5477
  }, [c, w]), L = g(() => {
5472
5478
  if (null != a) return a;
5473
5479
  let e = 0;
@@ -5511,7 +5517,7 @@ var dr, ur = {
5511
5517
  e.which !== b.Enter && e.which !== b.Space || (e.preventDefault(), e.stopPropagation(), k(D()));
5512
5518
  }
5513
5519
  }), [k, D]);
5514
- return x(hr, {
5520
+ return x(fr, {
5515
5521
  ref: $,
5516
5522
  className: H("pick-list", m),
5517
5523
  role: "listbox",
@@ -5531,10 +5537,10 @@ var dr, ur = {
5531
5537
  cacheToken: n,
5532
5538
  ...y
5533
5539
  });
5534
- }), yr = "_search_b1nag_5", br = (e, t) => {
5540
+ }), br = "_search_b1nag_5", Sr = (e, t) => {
5535
5541
  const n = t.trim().toLowerCase();
5536
5542
  return n ? e.filter((e) => e.text.toLowerCase().includes(n)) : e;
5537
- }, Sr = r(function(e, t) {
5543
+ }, Er = r(function(e, t) {
5538
5544
  const { value: n, onChange: o, onClose: r, onKeyDown: l, className: i, ...a } = e, c = s((e) => {
5539
5545
  if (e.which === b.Escape) return e.preventDefault(), e.stopPropagation(), void (n ? o("") : r?.());
5540
5546
  l?.(e);
@@ -5550,19 +5556,19 @@ var dr, ur = {
5550
5556
  role: "searchbox",
5551
5557
  autoComplete: "off",
5552
5558
  spellCheck: !1,
5553
- className: H(yr, "list-search", i),
5559
+ className: H(br, "list-search", i),
5554
5560
  value: n,
5555
5561
  onChange: (e) => o(e.target.value),
5556
5562
  onKeyDown: c,
5557
5563
  ...a
5558
5564
  });
5559
- }), Er = {
5565
+ }), Ir = {
5560
5566
  light: {},
5561
5567
  dark: {
5562
5568
  "color-base-100": "#1e1e1e",
5563
5569
  "color-base-300": "#3a3a3a"
5564
5570
  }
5565
- }, Ir = {
5571
+ }, Cr = {
5566
5572
  light: {
5567
5573
  "color-base-100": "#f2f2f2",
5568
5574
  "color-base-hover": "#ececec",
@@ -5573,7 +5579,7 @@ var dr, ur = {
5573
5579
  "color-base-hover": "#2e2e2e",
5574
5580
  "color-base-300": "#4a4a4a"
5575
5581
  }
5576
- }, Cr = (e, ...t) => T(e, Er[e], ...t), Rr = (e, ...t) => T(e, Ir[e], ...t), Mr = ({ app: e, grid: t = Er, header: n = Ir, layer: o = "sxl-defaults", scope: r } = {}) => {
5582
+ }, Rr = (e, ...t) => T(e, Ir[e], ...t), Mr = (e, ...t) => T(e, Cr[e], ...t), Pr = ({ app: e, grid: t = Ir, header: n = Cr, layer: o = "sxl-defaults", scope: r } = {}) => {
5577
5583
  const l = e ?? D, i = Object.fromEntries(Object.keys(n).map((e) => [e, {
5578
5584
  "color-base-100": l[e]?.["color-base-200"],
5579
5585
  ...n[e]
@@ -5588,4 +5594,4 @@ var dr, ur = {
5588
5594
  scope: r
5589
5595
  });
5590
5596
  };
5591
- export { rn as AUTO_SCROLL_INTERVAL_MS, jn as CellLayer, Un as CellTileDiv, mr as CheckboxList, po as DEFAULT_ANCHOR_STYLE, en as DEFAULT_HANDLE_STYLE, wo as DEFAULT_INSERT_BAR_STYLE, xo as DEFAULT_MOVE_SOURCE_STYLE, fo as DEFAULT_MULTI_STYLE, mo as DEFAULT_REMOVE_PREVIEW_STYLE, ho as DEFAULT_SINGLE_STYLE, Ln as DefaultCellRenderer, Wo as DefaultEditable, Xo as DefaultEditorInput, Qo as DefaultHeaderDivider, ro as DefaultSelection, wn as DragHandle, Rn as Draggable, ln as EDGE_AUTO_SCROLL_MARGIN_PX, Ao as EditSession, qo as EditorDiv, Yo as EditorLayer, On as FillHandle, Er as GRID_SURFACE, cr as Grid, Ot as GridFloatPanel, He as GridSurface, to as GridlineLayer, Ir as HEADER_SURFACE, tr as HeaderDividerAnchor, Ut as HoverTipLayer, nt as Layer, ae as LineSVG, fr as List, Sr as ListSearch, hr as ListSurface, an as NO_DRAG_MODIFIERS, zo as PICKER_COLORS, vr as PickList, Pn as RESIZE_ANCHORS_4, kn as RESIZE_ANCHORS_8, Wt as RangeFloatLayer, nn as RangeInsertBar, Qt as RangePrompt, tn as RangeRect, Dn as RangeResizer, Bo as RangesPickerLayer, ce as RectangleSVG, oo as SELECTION_CLIP_INSETS, Do as SelectionLayer, yo as SelectionTouchGrips, ie as ShapeBoundsContext, Ct as StickyAnchor, Tt as StickyFloat, Fe as SurfaceStateContext, Ae as SurfaceStateProvider, st as VirtualDiv, Mr as buildGridThemeCSS, Ko as commitArgsFromKey, re as createAxis, gn as createDragCells, ir as createHeaderSelectionPointer, Be as createSurfaceStateStore, hn as createWindowDragCells, No as defaultRangeStyle, sn as edgeScrollPane, Uo as expandEditorBounds, br as filterByText, Cr as gridThemeVars, rr as headerAnchorCell, or as headerEntireEnd, nr as headerEntireStart, lr as headerRange, Rr as headerThemeVars, En as insertAt, Cn as insertRange, dn as isSameDragModifiers, cn as readDragModifiers, Nt as renderGridFloatPanel, $n as resolveFillDestination, Vo as startEventFromKey, mn as useDoubleClick, fn as useDragCells, _o as useEditorKeymap, Pt as useGridFloatTheme, le as useGridMetrics, Je as useGridPane, Qe as useGridPaneOptional, sr as useHeaderSelectionPointer, Ft as useHoverIntent, tt as useLayer, Ho as usePendingCaret, At as useRangeHover, vo as useSelectionPointer, se as useShapeBounds, Et as useSticky, It as useStickyOptional, et as useSurfaceState, pn as useWindowDragCells, zn as vacatedByFill };
5597
+ export { rn as AUTO_SCROLL_INTERVAL_MS, jn as CellLayer, Un as CellTileDiv, wr as CheckboxList, po as DEFAULT_ANCHOR_STYLE, en as DEFAULT_HANDLE_STYLE, wo as DEFAULT_INSERT_BAR_STYLE, xo as DEFAULT_MOVE_SOURCE_STYLE, fo as DEFAULT_MULTI_STYLE, mo as DEFAULT_REMOVE_PREVIEW_STYLE, ho as DEFAULT_SINGLE_STYLE, Ln as DefaultCellRenderer, Wo as DefaultEditable, Xo as DefaultEditorInput, er as DefaultHeaderDivider, ro as DefaultSelection, wn as DragHandle, Rn as Draggable, ln as EDGE_AUTO_SCROLL_MARGIN_PX, Ao as EditSession, Zo as EditorDiv, Yo as EditorLayer, qo as EditorStartLayer, On as FillHandle, Ir as GRID_SURFACE, dr as Grid, Ot as GridFloatPanel, He as GridSurface, to as GridlineLayer, Cr as HEADER_SURFACE, nr as HeaderDividerAnchor, Ut as HoverTipLayer, nt as Layer, ae as LineSVG, pr as List, Er as ListSearch, fr as ListSurface, an as NO_DRAG_MODIFIERS, zo as PICKER_COLORS, yr as PickList, Pn as RESIZE_ANCHORS_4, kn as RESIZE_ANCHORS_8, Wt as RangeFloatLayer, nn as RangeInsertBar, Qt as RangePrompt, tn as RangeRect, Dn as RangeResizer, Bo as RangesPickerLayer, ce as RectangleSVG, oo as SELECTION_CLIP_INSETS, Do as SelectionLayer, yo as SelectionTouchGrips, ie as ShapeBoundsContext, Ct as StickyAnchor, Tt as StickyFloat, Fe as SurfaceStateContext, Ae as SurfaceStateProvider, st as VirtualDiv, Pr as buildGridThemeCSS, Ko as commitArgsFromKey, re as createAxis, gn as createDragCells, sr as createHeaderSelectionPointer, Be as createSurfaceStateStore, hn as createWindowDragCells, No as defaultRangeStyle, sn as edgeScrollPane, Uo as expandEditorBounds, Sr as filterByText, Rr as gridThemeVars, lr as headerAnchorCell, rr as headerEntireEnd, or as headerEntireStart, ir as headerRange, Mr as headerThemeVars, En as insertAt, Cn as insertRange, dn as isSameDragModifiers, cn as readDragModifiers, Nt as renderGridFloatPanel, $n as resolveFillDestination, Vo as startEventFromKey, mn as useDoubleClick, fn as useDragCells, _o as useEditorKeymap, Pt as useGridFloatTheme, le as useGridMetrics, Je as useGridPane, Qe as useGridPaneOptional, ar as useHeaderSelectionPointer, Ft as useHoverIntent, tt as useLayer, Ho as usePendingCaret, At as useRangeHover, vo as useSelectionPointer, se as useShapeBounds, Et as useSticky, It as useStickyOptional, et as useSurfaceState, pn as useWindowDragCells, zn as vacatedByFill };