@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 +62 -59
- package/dist/OmniGrid.js +7 -5
- package/package.json +1 -1
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
|
-
|
|
28
|
-
scrolling
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
129
|
+
const overlayScope = overlayState.type
|
|
130
|
+
? (overlayState.scope ?? (overlayState.type === "error" ? "full" : "bodyOnly"))
|
|
131
|
+
: undefined;
|
|
130
132
|
const overlayBlocksHorizontalScroll = overlayState.type
|
|
131
|
-
? (overlayState.blockScroll ??
|
|
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:
|
|
637
|
-
overflowY:
|
|
638
|
+
overflowX: overlayBlocksHorizontalScroll ? "hidden" : needsHorizontalScroll ? "auto" : "hidden",
|
|
639
|
+
overflowY: overlayScope || autoHeight ? "hidden" : "auto",
|
|
638
640
|
position: "relative",
|
|
639
|
-
scrollbarGutter:
|
|
641
|
+
scrollbarGutter: verticalScrollbarGutter,
|
|
640
642
|
width: "100%",
|
|
641
643
|
}, children: [_jsxs("div", { style: {
|
|
642
644
|
display: "flex",
|