react-gridix 0.2.6 → 0.2.7
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 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React-gridix
|
|
2
2
|
|
|
3
3
|
A React `DataGrid` with row selection, server-side mode, typed per-column filters, date columns, in-cell editing, resizing and pinning, virtualization, export to CSV / Excel / JSON / PDF, 12 row animations, filter comparisons and 8 themes, plus the `Checkbox` it uses.
|
|
4
4
|
|
|
@@ -2685,7 +2685,82 @@ function NothingHere({ reason, clearAll, search }: EmptyStateProps<User>) {
|
|
|
2685
2685
|
- When rows are removed with an exit animation, the component appears once the last row has left.
|
|
2686
2686
|
- Keep using `emptyMessage` for a plain sentence. `emptyComponent` wins when both are set.
|
|
2687
2687
|
|
|
2688
|
-
### 6.27
|
|
2688
|
+
### 6.27 Column widths
|
|
2689
|
+
|
|
2690
|
+
`width` takes a number (pixels) or any CSS length. `minWidth` and `maxWidth` limit the column.
|
|
2691
|
+
|
|
2692
|
+
```tsx
|
|
2693
|
+
const columns = [
|
|
2694
|
+
{ field: "id", header: "ID", width: 70 }, // 70 px
|
|
2695
|
+
{ field: "name", header: "Name", width: "30%" }, // a share of the grid
|
|
2696
|
+
{ field: "email", header: "Email", width: "16rem" }, // any CSS length
|
|
2697
|
+
{ field: "notes", header: "Notes", minWidth: 200 }, // no width: takes the space that is left
|
|
2698
|
+
];
|
|
2699
|
+
```
|
|
2700
|
+
|
|
2701
|
+
- When any column has a `width`, the grid uses a fixed table layout, so the browser takes your widths literally.
|
|
2702
|
+
- If **every** column has a numeric width, the table is exactly as wide as their sum (it does not stretch).
|
|
2703
|
+
- Columns without a `width` share the remaining space.
|
|
2704
|
+
- Dragging a column border still works and overrides the starting width (limited by `minWidth` / `maxWidth`).
|
|
2705
|
+
|
|
2706
|
+
### 6.28 Sticky toolbar and header, and scroll bars
|
|
2707
|
+
|
|
2708
|
+
**With an inner scroll box** (`maxHeight`) the header already stays at the top and the toolbar and footer stay outside the scrolling part:
|
|
2709
|
+
|
|
2710
|
+
```tsx
|
|
2711
|
+
<DataGrid rows={rows} columns={columns} maxHeight="60vh" />
|
|
2712
|
+
```
|
|
2713
|
+
|
|
2714
|
+
**While the whole page scrolls** (optional, off by default):
|
|
2715
|
+
|
|
2716
|
+
```tsx
|
|
2717
|
+
<DataGrid rows={rows} columns={columns} stickyToolbar stickyHeader />
|
|
2718
|
+
|
|
2719
|
+
// Under a fixed top bar of your own that is 64px tall
|
|
2720
|
+
<DataGrid rows={rows} columns={columns} stickyToolbar stickyHeader stickyOffset={64} />
|
|
2721
|
+
|
|
2722
|
+
// Only the header
|
|
2723
|
+
<DataGrid rows={rows} columns={columns} stickyHeader stickyOffset="4rem" />
|
|
2724
|
+
```
|
|
2725
|
+
|
|
2726
|
+
The header sits right under the toolbar when both are sticky. In this mode the grid has no scroll box of its own, so a table wider than the page overflows: give the columns widths that fit (see 6.28). It is ignored when `maxHeight` or `virtualize` is set, because those already scroll inside the grid.
|
|
2727
|
+
|
|
2728
|
+
**Scroll bars inside the grid** are thin by default. Use `scrollbar` to change them:
|
|
2729
|
+
|
|
2730
|
+
```tsx
|
|
2731
|
+
<DataGrid scrollbar="thin" /> // default: slim bar
|
|
2732
|
+
<DataGrid scrollbar="auto" /> // the browser's normal bar
|
|
2733
|
+
<DataGrid scrollbar="hidden" /> // no bar, scrolling still works
|
|
2734
|
+
<DataGrid scrollbar="custom" /> // no style from the grid: your CSS applies
|
|
2735
|
+
```
|
|
2736
|
+
|
|
2737
|
+
Colours of the thin bar come from CSS variables:
|
|
2738
|
+
|
|
2739
|
+
```css
|
|
2740
|
+
.my-grid {
|
|
2741
|
+
--rg-scrollbar-thumb: #6366f1; /* the moving part */
|
|
2742
|
+
--rg-scrollbar-track: #eef2ff; /* the rail */
|
|
2743
|
+
--rg-scrollbar-width: auto; /* thin | auto | none */
|
|
2744
|
+
}
|
|
2745
|
+
```
|
|
2746
|
+
|
|
2747
|
+
Full control (size, rounded ends, hover colour) with `scrollbar="custom"`:
|
|
2748
|
+
|
|
2749
|
+
```tsx
|
|
2750
|
+
<DataGrid scrollbar="custom" classNames={{ scroll: "my-scroll" }} />
|
|
2751
|
+
```
|
|
2752
|
+
|
|
2753
|
+
```css
|
|
2754
|
+
.my-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
|
|
2755
|
+
.my-scroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 999px; }
|
|
2756
|
+
.my-scroll::-webkit-scrollbar-thumb:hover { background: #475569; }
|
|
2757
|
+
.my-scroll { scrollbar-width: thin; scrollbar-color: #94a3b8 transparent; } /* Firefox */
|
|
2758
|
+
```
|
|
2759
|
+
|
|
2760
|
+
The list of options in a `filterType: "select"` popup scrolls without showing a scroll bar.
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
### 6.29 Known limitations
|
|
2689
2764
|
|
|
2690
2765
|
Not included:
|
|
2691
2766
|
|