@omnigrid/react 0.1.12 → 0.1.13

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/README.md CHANGED
@@ -1,59 +1,62 @@
1
- # @omnigrid/react
2
-
3
- React adapter and renderer for OmniGrid. Renders the headless core engine into the DOM using React.
4
-
5
- ## What it provides
6
-
7
- - **`<OmniGrid />`** — React component that accepts `GridOptions` and renders a fully virtualized, 2D scrolled data grid
8
- - **`useGrid()`** — hook that creates and manages a `GridCore` instance with full lifecycle handling
9
- - **Cell / Row pooling** — reusable React content via DOM-pool integration for minimal re-renders
10
- - **Styles and default theme** — required structural styles and light/dark default colors are included automatically
11
- - **`transpilePackages`-ready** — works out of the box with Next.js and other bundlers
12
-
13
- ## Usage
14
-
15
- ```tsx
16
- import { OmniGrid } from "@omnigrid/react";
17
- import { useMemo } from "react";
18
-
19
- const columns = useMemo(() => [...], []);
20
- const data = [...];
21
-
22
- <OmniGrid columns={columns} data={data} />;
23
- ```
24
-
25
- ## Overlays
26
-
27
- The adapter renders body-only overlays below the sticky header. While one is active, vertical
28
- scrolling and its scrollbar are disabled; horizontal scrolling remains available for
29
- `noMatchingRows` (or when `blockScroll: false`). Use `scope: "full"` to cover the header and
30
- body as well.
31
-
32
- ```tsx
33
- import { OmniGrid, type OverlayComponentProps } from "@omnigrid/react";
34
-
35
- function LoadError<T>({ message }: OverlayComponentProps<T>) {
36
- return <div role="alert">{message ?? "Unable to load rows"}</div>;
37
- }
38
-
39
- <OmniGrid
40
- columns={columns}
41
- data={data}
42
- overlayComponents={{ error: LoadError }}
43
- onGridReady={(grid) => grid.showOverlay({ type: "error", message: "Please retry" })}
44
- />;
45
- ```
46
-
47
- To customize the table's color style, install a compatible `@omnigrid/*-theme`
48
- package and import it in the application after `@omnigrid/react`. Theme packages
49
- include their own light and dark variants; they are not light/dark mode toggles.
50
-
51
- ## Links
52
-
53
- - **Source:** https://github.com/KRZK-Apps/omnigrid/tree/main/adapters/react
54
- - **Demo:** https://omnigrid-demo.vercel.app/
55
- - **Issues:** https://github.com/KRZK-Apps/omnigrid/issues
56
-
57
- ## License
58
-
59
- MIT © KRZK Apps
1
+ # @omnigrid/react
2
+
3
+ React adapter and renderer for OmniGrid. Renders the headless core engine into the DOM using React.
4
+
5
+ ## What it provides
6
+
7
+ - **`<OmniGrid />`** — React component that accepts `GridOptions` and renders a fully virtualized, 2D scrolled data grid
8
+ - **`useGrid()`** — hook that creates and manages a `GridCore` instance with full lifecycle handling
9
+ - **Cell / Row pooling** — reusable React content via DOM-pool integration for minimal re-renders
10
+ - **Styles and default theme** — required structural styles and light/dark default colors are included automatically
11
+ - **`transpilePackages`-ready** — works out of the box with Next.js and other bundlers
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import { OmniGrid } from "@omnigrid/react";
17
+ import { useMemo } from "react";
18
+
19
+ const columns = useMemo(() => [...], []);
20
+ const data = [...];
21
+
22
+ <OmniGrid columns={columns} data={data} />;
23
+ ```
24
+
25
+ ## Overlays
26
+
27
+ Automatic loading, no-rows, and no-matching-rows overlays cover the body below the sticky
28
+ header. They hide vertical scrolling while preserving its gutter, so columns do not shift;
29
+ horizontal scrolling remains available. Automatic error overlays cover the full grid.
30
+ Any active overlay hides vertical scrolling and preserves its gutter, regardless of scope.
31
+ Manual overlays default to body-only, except errors default to full-grid; set `scope` to
32
+ `"bodyOnly"` or `"full"` to choose the placement. `blockScroll: true` locks horizontal
33
+ scrolling; vertical scrolling is always locked while an overlay is active.
34
+
35
+ ```tsx
36
+ import { OmniGrid, type OverlayComponentProps } from "@omnigrid/react";
37
+
38
+ function LoadError<T>({ message }: OverlayComponentProps<T>) {
39
+ return <div role="alert">{message ?? "Unable to load rows"}</div>;
40
+ }
41
+
42
+ <OmniGrid
43
+ columns={columns}
44
+ data={data}
45
+ overlayComponents={{ error: LoadError }}
46
+ onGridReady={(grid) => grid.showOverlay({ type: "error", message: "Please retry" })}
47
+ />;
48
+ ```
49
+
50
+ To customize the table's color style, install a compatible `@omnigrid/*-theme`
51
+ package and import it in the application after `@omnigrid/react`. Theme packages
52
+ include their own light and dark variants; they are not light/dark mode toggles.
53
+
54
+ ## Links
55
+
56
+ - **Source:** https://github.com/KRZK-Apps/omnigrid/tree/main/adapters/react
57
+ - **Demo:** https://omnigrid-demo.vercel.app/
58
+ - **Issues:** https://github.com/KRZK-Apps/omnigrid/issues
59
+
60
+ ## License
61
+
62
+ MIT © KRZK Apps
package/dist/OmniGrid.js CHANGED
@@ -126,9 +126,11 @@ export function OmniGrid({ className, style, slotComponents, ...options }) {
126
126
  const suppressRowHoverHighlight = options.suppressRowHoverHighlight ?? false;
127
127
  const viewportClassName = ["omnigrid", className, suppressRowHoverHighlight ? "omnigrid-no-row-hover" : null].filter(Boolean).join(" ");
128
128
  const overlayState = state.overlay;
129
- const overlayScope = overlayState.type ? (overlayState.scope ?? "bodyOnly") : undefined;
129
+ const overlayScope = overlayState.type
130
+ ? (overlayState.scope ?? (overlayState.type === "error" ? "full" : "bodyOnly"))
131
+ : undefined;
130
132
  const overlayBlocksHorizontalScroll = overlayState.type
131
- ? (overlayState.blockScroll ?? overlayState.type !== "noMatchingRows")
133
+ ? (overlayState.blockScroll ?? false)
132
134
  : false;
133
135
  const isFullOverlay = overlayScope === "full";
134
136
  /**
@@ -633,10 +635,10 @@ export function OmniGrid({ className, style, slotComponents, ...options }) {
633
635
  height: autoHeight ? measuredHeight : "100%",
634
636
  minHeight: 0,
635
637
  minWidth: 0,
636
- overflowX: isFullOverlay || (overlayScope === "bodyOnly" && overlayBlocksHorizontalScroll) ? "hidden" : needsHorizontalScroll ? "auto" : "hidden",
637
- overflowY: isFullOverlay || overlayScope === "bodyOnly" || autoHeight ? "hidden" : "auto",
638
+ overflowX: overlayBlocksHorizontalScroll ? "hidden" : needsHorizontalScroll ? "auto" : "hidden",
639
+ overflowY: overlayScope || autoHeight ? "hidden" : "auto",
638
640
  position: "relative",
639
- scrollbarGutter: overlayScope === "bodyOnly" ? "auto" : verticalScrollbarGutter,
641
+ scrollbarGutter: verticalScrollbarGutter,
640
642
  width: "100%",
641
643
  }, children: [_jsxs("div", { style: {
642
644
  display: "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/react",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "React adapter and renderer for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",