@omnigrid/react 0.1.30 → 0.1.32
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 +77 -62
- package/dist/OmniGrid.js +275 -182
- package/dist/cellTooltip.d.ts +6 -2
- package/dist/cellTooltip.js +38 -8
- package/dist/controls.js +36 -8
- package/dist/index.d.ts +2 -2
- package/dist/pooledRow.d.ts +8 -0
- package/dist/pooledRow.js +36 -1
- package/dist/popup.d.ts +1 -0
- package/dist/popup.js +18 -9
- package/dist/reactColumnDef.d.ts +30 -0
- package/dist/types.d.ts +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,62 +1,77 @@
|
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
+
Set `animateRows` to animate visible rows when filtering or sorting changes their
|
|
26
|
+
positions. Row animation uses a separate CSS transform component, so virtualized
|
|
27
|
+
positioning and scrolling remain independent. It is disabled by default; provide
|
|
28
|
+
a stable `getRowId` to animate rows reliably across reorderings.
|
|
29
|
+
|
|
30
|
+
During fast vertical scrolling, the React adapter keeps the current row pool
|
|
31
|
+
visually in place while the native scrollbar continues moving. It repositions
|
|
32
|
+
the existing row layers rather than creating a second copy of the rows, then
|
|
33
|
+
updates the pool after scrolling has been idle for 150 ms. The core tracks the
|
|
34
|
+
live scroll position without store notifications or scroll-driven React renders.
|
|
35
|
+
|
|
36
|
+
Column `headerRenderer` callbacks provide the header's primary content. The adapter owns the
|
|
37
|
+
shared header layout and keeps sorting, filtering, and registered plugin extensions alongside it,
|
|
38
|
+
so plugins can add controls without replacing or duplicating the header renderer.
|
|
39
|
+
|
|
40
|
+
## Overlays
|
|
41
|
+
|
|
42
|
+
Automatic loading, no-rows, and no-matching-rows overlays cover the body below the sticky
|
|
43
|
+
header. They hide vertical scrolling while preserving its gutter, so columns do not shift;
|
|
44
|
+
horizontal scrolling remains available. Automatic error overlays cover the full grid.
|
|
45
|
+
Any active overlay hides vertical scrolling and preserves its gutter, regardless of scope.
|
|
46
|
+
Manual overlays default to body-only, except errors default to full-grid; set `scope` to
|
|
47
|
+
`"bodyOnly"` or `"full"` to choose the placement. `blockScroll: true` locks horizontal
|
|
48
|
+
scrolling; vertical scrolling is always locked while an overlay is active.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { OmniGrid, type OverlayComponentProps } from "@omnigrid/react";
|
|
52
|
+
|
|
53
|
+
function LoadError<T>({ message }: OverlayComponentProps<T>) {
|
|
54
|
+
return <div role="alert">{message ?? "Unable to load rows"}</div>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
<OmniGrid
|
|
58
|
+
columns={columns}
|
|
59
|
+
data={data}
|
|
60
|
+
overlayComponents={{ error: LoadError }}
|
|
61
|
+
onGridReady={(grid) => grid.showOverlay({ type: "error", message: "Please retry" })}
|
|
62
|
+
/>;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To customize the table's color style, install a compatible `@omnigrid/*-theme`
|
|
66
|
+
package and import it in the application after `@omnigrid/react`. Theme packages
|
|
67
|
+
include their own light and dark variants; they are not light/dark mode toggles.
|
|
68
|
+
|
|
69
|
+
## Links
|
|
70
|
+
|
|
71
|
+
- **Source:** https://github.com/KRZK-Apps/omnigrid/tree/main/adapters/react
|
|
72
|
+
- **Demo:** https://omnigrid-demo.vercel.app/
|
|
73
|
+
- **Issues:** https://github.com/KRZK-Apps/omnigrid/issues
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT © KRZK Apps
|