@toolbox-web/grid-react 1.0.0-rc.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -4,12 +4,12 @@ import { createContext as ye, useContext as O, useRef as E, useCallback as S, us
4
4
  import { a as w, r as H, s as fe } from "./chunks/portal-bridge-B0mjqzak.js";
5
5
  import { createPortal as Ge, flushSync as ge } from "react-dom";
6
6
  import { createPluginsFromFeatures as Ae } from "@toolbox-web/grid/features/registry";
7
- import { G as xe } from "./chunks/grid-element-context-BU3WvNtM.js";
8
- function Te(n) {
7
+ import { G as Te } from "./chunks/grid-element-context-BU3WvNtM.js";
8
+ function xe(n) {
9
9
  return n.charAt(0).toUpperCase() + n.slice(1);
10
10
  }
11
11
  function pe(n) {
12
- return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(Te).join(" ");
12
+ return n.toLowerCase() === "id" ? "ID" : n.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").split(" ").filter(Boolean).map(xe).join(" ");
13
13
  }
14
14
  const Ke = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime", "currency"]);
15
15
  function Ne(n) {
@@ -58,7 +58,8 @@ const W = {
58
58
  onUndoRedo: "undo-redo",
59
59
  onExportComplete: "export-complete",
60
60
  onPrintStart: "print-start",
61
- onPrintComplete: "print-complete"
61
+ onPrintComplete: "print-complete",
62
+ onTbwScroll: "tbw-scroll"
62
63
  }, ne = ye(null), Ie = ({ icons: n, children: e }) => /* @__PURE__ */ b(ne.Provider, { value: n, children: e });
63
64
  function pt() {
64
65
  return O(ne);
@@ -300,26 +301,26 @@ function ht(n) {
300
301
  }
301
302
  );
302
303
  }
303
- const A = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new Map();
304
+ const A = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new Map();
304
305
  function Ye(n, e) {
305
306
  const t = n.getAttribute("field"), r = A.get(n) ?? {};
306
307
  if (r.renderer = e, A.set(n, r), t) {
307
- const o = x.get(t) ?? {};
308
- o.renderer = e, x.set(t, o);
308
+ const o = T.get(t) ?? {};
309
+ o.renderer = e, T.set(t, o);
309
310
  }
310
311
  }
311
312
  function Ze(n, e) {
312
313
  const t = n.getAttribute("field"), r = A.get(n) ?? {};
313
314
  if (r.editor = e, A.set(n, r), t) {
314
- const o = x.get(t) ?? {};
315
- o.editor = e, x.set(t, o);
315
+ const o = T.get(t) ?? {};
316
+ o.editor = e, T.set(t, o);
316
317
  }
317
318
  }
318
319
  function Qe(n) {
319
320
  let e = A.get(n)?.renderer;
320
321
  if (!e) {
321
322
  const t = n.getAttribute("field");
322
- t && (e = x.get(t)?.renderer);
323
+ t && (e = T.get(t)?.renderer);
323
324
  }
324
325
  return e;
325
326
  }
@@ -327,7 +328,7 @@ function Xe(n) {
327
328
  let e = A.get(n)?.editor;
328
329
  if (!e) {
329
330
  const t = n.getAttribute("field");
330
- t && (e = x.get(t)?.editor);
331
+ t && (e = T.get(t)?.editor);
331
332
  }
332
333
  return e;
333
334
  }
@@ -364,7 +365,7 @@ class et {
364
365
  const t = e.getAttribute("field");
365
366
  let r = A.get(e);
366
367
  if (!r && t) {
367
- const c = x.get(t);
368
+ const c = T.get(t);
368
369
  c && (c.renderer || c.editor) && (r = c, A.set(e, r));
369
370
  }
370
371
  const o = r?.renderer !== void 0, s = r?.editor !== void 0;
@@ -587,7 +588,7 @@ class et {
587
588
  destroy() {
588
589
  for (const e of this.allPortalKeys)
589
590
  H(e);
590
- this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear(), x.clear();
591
+ this.allPortalKeys.clear(), this.editorPortalKeys.clear(), this.keyToContainer.clear(), T.clear();
591
592
  }
592
593
  /**
593
594
  * Called when a cell's content is about to be wiped.
@@ -690,7 +691,7 @@ const vt = he(function(e, t) {
690
691
  // SSR mode
691
692
  ssr: k,
692
693
  // Legacy event handlers
693
- onRowsChange: T,
694
+ onRowsChange: x,
694
695
  // Feature props and event props are in ...rest
695
696
  ...h
696
697
  } = e, u = E(null), j = E(null), oe = O(Oe), q = O(Le), ie = [
@@ -792,10 +793,10 @@ const vt = he(function(e, t) {
792
793
  const i = u.current;
793
794
  if (!i) return;
794
795
  const l = [];
795
- return T && l.push(i.on("rows-change", (m) => T(m.rows))), () => {
796
+ return x && l.push(i.on("rows-change", (m) => x(m.rows))), () => {
796
797
  l.forEach((m) => m());
797
798
  };
798
- }, [T]);
799
+ }, [x]);
799
800
  const le = D(() => Object.keys(W).filter((i) => typeof h[i] == "function").sort().join("|"), [h]), de = E({});
800
801
  for (const i of Object.keys(W))
801
802
  de.current[i] = h[i];
@@ -873,7 +874,7 @@ const vt = he(function(e, t) {
873
874
  },
874
875
  class: K,
875
876
  style: p,
876
- children: /* @__PURE__ */ b(xe.Provider, { value: u, children: v })
877
+ children: /* @__PURE__ */ b(Te.Provider, { value: u, children: v })
877
878
  }
878
879
  )
879
880
  ] });
@@ -900,11 +901,11 @@ function Ct(n) {
900
901
  y.current = u, u && (C && Ye(u, C), R && Ze(u, R));
901
902
  },
902
903
  [C, R, e]
903
- ), T = typeof a == "number" ? `${a}px` : a, h = {
904
+ ), x = typeof a == "number" ? `${a}px` : a, h = {
904
905
  field: e,
905
906
  ref: k
906
907
  };
907
- return t !== void 0 && (h.header = t), r !== void 0 && (h.type = r), o !== void 0 && (h.editable = o), s !== void 0 && (h.sortable = s), c !== void 0 && (h.resizable = c), T !== void 0 && (h.width = T), f !== void 0 && (h["min-width"] = f), d !== void 0 && (h.hidden = d), g !== void 0 && (h["lock-visible"] = g), p !== void 0 && (h.multi = p), v && (h["data-has-format"] = "true"), K && (h["data-has-options"] = "true"), /* @__PURE__ */ b("tbw-grid-column", { ...h });
908
+ return t !== void 0 && (h.header = t), r !== void 0 && (h.type = r), o !== void 0 && (h.editable = o), s !== void 0 && (h.sortable = s), c !== void 0 && (h.resizable = c), x !== void 0 && (h.width = x), f !== void 0 && (h["min-width"] = f), d !== void 0 && (h.hidden = d), g !== void 0 && (h["lock-visible"] = g), p !== void 0 && (h.multi = p), v && (h["data-has-format"] = "true"), K && (h["data-has-options"] = "true"), /* @__PURE__ */ b("tbw-grid-column", { ...h });
908
909
  }
909
910
  function Rt({ children: n }) {
910
911
  return /* @__PURE__ */ b("tbw-grid-tool-buttons", { children: n });
@@ -1,4 +1,4 @@
1
- import { CellActivateDetail, CellChangeDetail, CellClickDetail, CellCommitDetail, ChangedRowsResetDetail, ColumnMoveDetail, ColumnResizeDetail, ColumnVisibilityDetail, CopyDetail, DetailExpandDetail, ExportCompleteDetail, FilterChangeDetail, GridColumnState, GroupToggleDetail, PasteDetail, PrintCompleteDetail, PrintStartDetail, ResponsiveChangeDetail, RowClickDetail, RowCommitDetail, RowMoveDetail, SelectionChangeDetail, SortChangeDetail, TreeExpandDetail, UndoRedoDetail } from '@toolbox-web/grid/all';
1
+ import { CellActivateDetail, CellChangeDetail, CellClickDetail, CellCommitDetail, ChangedRowsResetDetail, ColumnMoveDetail, ColumnResizeDetail, ColumnVisibilityDetail, CopyDetail, DetailExpandDetail, ExportCompleteDetail, FilterChangeDetail, GridColumnState, GroupToggleDetail, PasteDetail, PrintCompleteDetail, PrintStartDetail, ResponsiveChangeDetail, RowClickDetail, RowCommitDetail, RowMoveDetail, SelectionChangeDetail, SortChangeDetail, TbwScrollDetail, TreeExpandDetail, UndoRedoDetail } from '@toolbox-web/grid/all';
2
2
  /**
3
3
  * Event handler type with unwrapped detail.
4
4
  * Pattern: `(detail: T, event?: CustomEvent) => void`
@@ -303,6 +303,23 @@ export interface EventProps<TRow = unknown> {
303
303
  * ```
304
304
  */
305
305
  onPrintComplete?: EventHandler<PrintCompleteDetail>;
306
+ /**
307
+ * Fired (rAF-batched) when the grid's viewport scrolls vertically.
308
+ *
309
+ * For server-side pagination of large datasets prefer `ServerSidePlugin`
310
+ * — this event is the lower-level primitive for custom load-more
311
+ * triggers, deferring heavy cell content, dismissing overlays, etc.
312
+ *
313
+ * @example
314
+ * ```tsx
315
+ * onTbwScroll={(detail) => {
316
+ * if (detail.scrollTop + detail.clientHeight >= detail.scrollHeight - 200) {
317
+ * loadMore();
318
+ * }
319
+ * }}
320
+ * ```
321
+ */
322
+ onTbwScroll?: EventHandler<TbwScrollDetail>;
306
323
  }
307
324
  /**
308
325
  * Map of event handler prop names to their corresponding event names.
@@ -1 +1 @@
1
- {"version":3,"file":"event-props.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/event-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI,GAAG,OAAO;IAKxC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhD;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE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BAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAMpD;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAMlD;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAM1D;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IAElC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAMpC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAM1C;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAMtD;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAE9C;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,MAAM,CA0B3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,CAAC,MAAM,UAAU,CAAC,EAAE,CAExD"}
1
+ {"version":3,"file":"event-props.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/event-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,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eG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;CAC7C;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,MAAM,CA2B3D,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,CAAC,MAAM,UAAU,CAAC,EAAE,CAExD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolbox-web/grid-react",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.1.0",
4
4
  "description": "React adapter for @toolbox-web/grid data grid component",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -60,11 +60,11 @@
60
60
  "react-dom": "^19.0.0",
61
61
  "@types/react": "^19.0.0",
62
62
  "@types/react-dom": "^19.0.0",
63
- "@toolbox-web/grid": "^2.0.0-rc.0"
63
+ "@toolbox-web/grid": ">=1.0.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": ">=18.0.0",
67
67
  "react-dom": ">=18.0.0",
68
- "@toolbox-web/grid": "^2.0.0-rc.0"
68
+ "@toolbox-web/grid": ">=1.0.0"
69
69
  }
70
70
  }