@azrico/reactgrid 1.6.11 → 1.6.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/CHANGELOG.md +39 -37
- package/README.md +16 -0
- package/config/theme-extras.css +121 -120
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -0
- package/dist/src/func/func_colsizes.d.ts +22 -0
- package/dist/src/func/func_colsizes.js +86 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +16 -1
- package/dist/src/themes/azgrid-theme.css +121 -120
- package/dist/src/types/types.d.ts +7 -0
- package/dist/src/views/DataGrid.js +27 -2
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/func/func_colsizes.ts +74 -0
- package/src/index.tsx +1 -0
- package/src/themes/azgrid-theme.css +121 -120
- package/src/types/types.ts +170 -163
- package/src/views/DataGrid.tsx +405 -371
package/CHANGELOG.md
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### Unreleased
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Fix
|
|
14
|
-
* Fix
|
|
15
|
-
*
|
|
16
|
-
* Fix the
|
|
17
|
-
* Add `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
*
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### Unreleased
|
|
6
|
+
|
|
7
|
+
* Add `gridId` to save the column widths a user resizes in `localStorage` and restore them on the next load. A saved width replaces the column's `width`/`flex`, saved names that are no longer columns are ignored, and storage errors are ignored. With a `gridId`, a column's `width` is used as `defaultWidth` so the column can be resized. Without it nothing changes.
|
|
8
|
+
* Export `setGridStorageScope(scope)` to scope saved sizes per user (call it before the grids render) and `clearColumnSizes(gridId)` to reset a grid's saved sizes.
|
|
9
|
+
* Fix rows stopping 3px short of the grid's right and bottom edges. The grid's native scroller is now hidden (`scrollbar-width: none`) in the base theme stylesheet; `scrollbar-color` made Chrome use a 15px standard scrollbar that overflowed the 12px offset. The custom scrollbars are unaffected.
|
|
10
|
+
* Make closing the row context menu with Escape opt-in through `escapeClosesContextMenu` (default `false`).
|
|
11
|
+
* Keep the right-clicked row highlighted with the theme's hover colours while its context menu is open, preserving caller row classes and clearing the highlight on close. Correct row hover rules to use hover tokens instead of empty-state tokens.
|
|
12
|
+
* Add `dontAutoCloseContextMenu` to keep the row context menu open on outside clicks, and `hideContextMenu` to hide it while leaving the browser's context menu available.
|
|
13
|
+
* Fix columns with a `type` (`number`, `select`, `bool`, ...) staying read-only unless they were listed in `editableColumns`. A typed column is editable unless you set `editable: false`.
|
|
14
|
+
* Fix a typed column's `editable` function being replaced by `true`. Functions and booleans are kept, so per-cell editability works again.
|
|
15
|
+
* Fix select `items` given as plain strings storing a lowercased value (`"Shelf A"` was saved as `"shelf a"`). The item id is now the original string.
|
|
16
|
+
* Fix the "Failed prop type: Invalid prop `headerDOMProps` of type `function`" warning on every grid. `headerDOMProps` is now an object; `aria-colindex` and `aria-sort` are set on the header cells from the grid state. Header cells also get `data-column`.
|
|
17
|
+
* Add `children` to `AzGridProps`, rendered after the grid.
|
|
18
|
+
* Fix the row context menu ignoring the grid theme with `@azrico/controls` 1.6.2, whose menu is no longer MUI-based and is portaled to `<body>`. The menu now gets the grid's theme class (`azgrid-theme-<name>`) and is styled through the controls' `--azrico-contextmenu-*` variables from the `--azgrid-menu-*` tokens. The MUI `ThemeProvider` around the menu is removed.
|
|
19
|
+
* Add `contextMenuClassName` to add your own classes to the context menu. Use it to bring host variables set on a wrapper element, which the portaled menu no longer inherits.
|
|
20
|
+
|
|
21
|
+
### 1.6.5 (2026-10-15)
|
|
22
|
+
|
|
23
|
+
* Leave the browser's context menu available when a row has no resolved `contextMenuItems`, and close any previously open grid menu. Respect right-clicks already handled by nested row details.
|
|
24
|
+
|
|
25
|
+
### 1.7.1 (2026-10-14)
|
|
26
|
+
|
|
27
|
+
* Fix two quick clicks on different rows firing `onRowDoubleClick`: the double-click check now keys clicks by the row's id instead of `undefined`.
|
|
28
|
+
|
|
29
|
+
### 1.7.0 (2026-10-14)
|
|
30
|
+
|
|
31
|
+
* Add `advancedFilterLabel` to rename the quick-search label (default "Search").
|
|
32
|
+
* Add `advancedFilterPlaceholder` for the quick-search input. A string is the native placeholder; any other node (custom HTML) is shown over the empty input.
|
|
33
|
+
|
|
34
|
+
### 1.6.0 (2026-10-14)
|
|
35
|
+
|
|
36
|
+
* Pass `filterValue`, `sortInfo` and `groupBy` to a `dataSource` function next to `skip`, `limit`, `cached_data` and `last_cache_info`, so header filters can drive a server-side search.
|
|
37
|
+
* With `gridOptions.remoteFilter` / `remoteSort`, a filter or sort change invalidates the data cache and calls `dataSource` again. Local filtering and sorting still reuse the cached rows.
|
|
38
|
+
* Export the typed `AzDataSourceParams` and `AzDataSourceFunc` for the `dataSource` and `details_dataSource` props.
|
|
39
|
+
* Re-export `SelectFilter`, `NumberFilter`, `DateFilter` and `BoolFilter` for `column.filterEditor`.
|
package/README.md
CHANGED
|
@@ -16,6 +16,22 @@ const rows = [{ __table_id: '1', name: 'Alice' }];
|
|
|
16
16
|
|
|
17
17
|
The token stylesheet is optional. Without it, the grid uses Inovua's default-light appearance.
|
|
18
18
|
|
|
19
|
+
## Saved column widths
|
|
20
|
+
|
|
21
|
+
Set `gridId` to keep the column widths a user resizes across reloads. Widths are saved in `localStorage` and matched to columns by name.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { AzGrid, setGridStorageScope, clearColumnSizes } from '@azrico/reactgrid';
|
|
25
|
+
|
|
26
|
+
setGridStorageScope(user.id); // once, before the grids render, so users of one browser don't share widths
|
|
27
|
+
|
|
28
|
+
<AzGrid gridId="current-stock" columns={columns} dataSource={rows} />;
|
|
29
|
+
|
|
30
|
+
clearColumnSizes('current-stock'); // reset, takes effect when the grid remounts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
A column's `width` is used as its `defaultWidth` when `gridId` is set, so it can be resized.
|
|
34
|
+
|
|
19
35
|
## Accessibility
|
|
20
36
|
|
|
21
37
|
The grid exposes ARIA grid semantics, so screen readers and automation tools can read it from the accessibility tree.
|
package/config/theme-extras.css
CHANGED
|
@@ -1,120 +1,121 @@
|
|
|
1
|
-
/* Keep the menu row in its hover state while the pointer is in the portaled menu.
|
|
2
|
-
* Match the strongest selected-row :hover selectors, including their cells. */
|
|
3
|
-
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target,
|
|
4
|
-
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target .InovuaReactDataGrid__cell,
|
|
5
|
-
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target .InovuaReactDataGrid__row-index-column {
|
|
6
|
-
background: var(--azgrid-row-bg-hover, var(--azgrid-preset-row-bg-hover));
|
|
7
|
-
color: var(--azgrid-row-fg-hover, var(--azgrid-preset-row-fg-hover));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/* Additional surfaces and typography not assigned colours by Inovua. */
|
|
11
|
-
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row--active:not(.InovuaReactDataGrid__row--selected) .InovuaReactDataGrid__cell:not(.InovuaReactDataGrid__cell--no-background) {
|
|
12
|
-
background: var(--azgrid-row-bg-active, var(--azgrid-preset-row-bg-active));
|
|
13
|
-
}
|
|
14
|
-
.azgrid.azgrid-tree .InovuaReactDataGrid__row:not(.InovuaReactDataGrid__row--selected):not(.InovuaReactDataGrid__row--active) .InovuaReactDataGrid__row-hover-target:not(:hover),
|
|
15
|
-
.azgrid .InovuaReactDataGrid__row--group-row:not(.InovuaReactDataGrid__row--selected):not(.InovuaReactDataGrid__row--active) .InovuaReactDataGrid__row-hover-target:not(:hover) {
|
|
16
|
-
background: var(--azgrid-tree-bg, var(--azgrid-preset-tree-bg));
|
|
17
|
-
color: var(--azgrid-tree-fg, var(--azgrid-preset-tree-fg));
|
|
18
|
-
}
|
|
19
|
-
.azgrid.azgrid-tree .InovuaReactDataGrid__cell__content > svg,
|
|
20
|
-
.azgrid .InovuaReactDataGrid__cell--group-expand-cell svg {
|
|
21
|
-
fill: var(--azgrid-tree-fg, var(--azgrid-preset-tree-fg));
|
|
22
|
-
}
|
|
23
|
-
.azgrid.InovuaReactDataGrid {
|
|
24
|
-
background: var(--azgrid-bg, var(--azgrid-preset-bg));
|
|
25
|
-
color: var(--azgrid-fg, var(--azgrid-preset-fg));
|
|
26
|
-
border-color: var(--azgrid-border, var(--azgrid-preset-border));
|
|
27
|
-
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
28
|
-
font-family: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
29
|
-
}
|
|
30
|
-
.azgrid .InovuaReactDataGrid__column-header__content,
|
|
31
|
-
.azgrid .InovuaReactDataGrid__header-group__title {
|
|
32
|
-
color: var(--azgrid-header-fg, var(--azgrid-preset-header-fg));
|
|
33
|
-
font-size: var(--azgrid-header-font-size, var(--azgrid-preset-header-font-size));
|
|
34
|
-
font-weight: var(--azgrid-header-font-weight, var(--azgrid-preset-header-font-weight));
|
|
35
|
-
text-transform: var(--azgrid-header-text-transform, var(--azgrid-preset-header-text-transform));
|
|
36
|
-
letter-spacing: var(--azgrid-header-letter-spacing, var(--azgrid-preset-header-letter-spacing));
|
|
37
|
-
}
|
|
38
|
-
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__cell {
|
|
39
|
-
border: var(--azgrid-cell-border-width, var(--azgrid-preset-cell-border-width)) solid var(--azgrid-cell-border, var(--azgrid-preset-cell-border));
|
|
40
|
-
}
|
|
41
|
-
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row--first .InovuaReactDataGrid__cell {
|
|
42
|
-
/* Inovua's first-row border-top is !important. Keep the same border API on this row. */
|
|
43
|
-
border-top: var(--azgrid-cell-border-width, var(--azgrid-preset-cell-border-width)) solid var(--azgrid-cell-border, var(--azgrid-preset-cell-border)) !important;
|
|
44
|
-
}
|
|
45
|
-
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__cell:not(.InovuaReactDataGrid__cell--group-expand-cell):not(.InovuaReactDataGrid__cell--expand-cell):not(.InovuaReactDataGrid__cell--reorder) {
|
|
46
|
-
padding: var(--azgrid-cell-padding, var(--azgrid-preset-cell-padding));
|
|
47
|
-
}
|
|
48
|
-
.azgrid .InovuaReactDataGrid__empty-wrapper {
|
|
49
|
-
background: var(--azgrid-empty-bg, var(--azgrid-preset-empty-bg));
|
|
50
|
-
color: var(--azgrid-empty-fg, var(--azgrid-preset-empty-fg));
|
|
51
|
-
}
|
|
52
|
-
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row-details {
|
|
53
|
-
background: var(--azgrid-details-bg, var(--azgrid-preset-details-bg));
|
|
54
|
-
}
|
|
55
|
-
.azgrid .InovuaReactDataGrid__cell--locked-start.InovuaReactDataGrid__cell--last-in-section:after,
|
|
56
|
-
.azgrid .InovuaReactDataGrid__cell--locked-end.InovuaReactDataGrid__cell--first-in-section:after {
|
|
57
|
-
box-shadow: var(--azgrid-locked-column-shadow, var(--azgrid-preset-locked-column-shadow));
|
|
58
|
-
}
|
|
59
|
-
.azgrid-scope input,
|
|
60
|
-
.azgrid-scope select,
|
|
61
|
-
.azgrid-scope .azgrid-searcharea {
|
|
62
|
-
color: var(--azgrid-filter-fg, var(--azgrid-preset-filter-fg));
|
|
63
|
-
background-color: var(--azgrid-filter-bg, var(--azgrid-preset-filter-bg));
|
|
64
|
-
border-color: var(--azgrid-filter-border, var(--azgrid-preset-filter-border));
|
|
65
|
-
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
66
|
-
font-family: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
67
|
-
}
|
|
68
|
-
.azgrid-scope input::placeholder {
|
|
69
|
-
color: var(--azgrid-filter-placeholder, var(--azgrid-preset-filter-placeholder));
|
|
70
|
-
}
|
|
71
|
-
.azgrid-scope input:focus-visible,
|
|
72
|
-
.azgrid-scope select:focus-visible {
|
|
73
|
-
outline: 1px solid var(--azgrid-filter-focus-ring, var(--azgrid-preset-filter-focus-ring));
|
|
74
|
-
}
|
|
75
|
-
.azgrid-scope .inovua-react-pagination-toolbar input,
|
|
76
|
-
.azgrid-scope .inovua-react-pagination-toolbar select {
|
|
77
|
-
background: var(--azgrid-pagination-bg, var(--azgrid-preset-pagination-bg));
|
|
78
|
-
color: var(--azgrid-pagination-fg, var(--azgrid-preset-pagination-fg));
|
|
79
|
-
border-color: var(--azgrid-pagination-border, var(--azgrid-preset-pagination-border));
|
|
80
|
-
}
|
|
81
|
-
.azgrid-scope .inovua-react-toolkit-text-input,
|
|
82
|
-
.azgrid-scope .inovua-react-toolkit-combo-box,
|
|
83
|
-
.azgrid-scope .inovua-react-toolkit-menu {
|
|
84
|
-
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
85
|
-
}
|
|
86
|
-
/* The row context menu is portaled to <body>, outside .azgrid-scope: these rules stay
|
|
87
|
-
* unscoped and read the tokens from the theme class DataGrid puts on the menu.
|
|
88
|
-
* Two classes exceed @azrico/controls' single-class menu rules. */
|
|
89
|
-
.azgrid-context-menu.azrico-controls-contextmenu {
|
|
90
|
-
--azrico-contextmenu-color: var(--azgrid-menu-fg, var(--azgrid-preset-menu-fg));
|
|
91
|
-
--azrico-contextmenu-background: var(--azgrid-menu-bg, var(--azgrid-preset-menu-bg));
|
|
92
|
-
--azrico-contextmenu-hover: var(--azgrid-menu-bg-hover, var(--azgrid-preset-menu-bg-hover));
|
|
93
|
-
--azrico-contextmenu-focus: var(--azgrid-accent, var(--azgrid-preset-accent));
|
|
94
|
-
--azrico-contextmenu-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
95
|
-
--azrico-contextmenu-shadow: 0 3px 8px var(--azgrid-shadow-color, var(--azgrid-preset-shadow-color));
|
|
96
|
-
--azrico-contextmenu-font: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
97
|
-
border: 1px solid var(--azgrid-menu-border, var(--azgrid-preset-menu-border));
|
|
98
|
-
}
|
|
99
|
-
.azgrid-scope, .azgrid-scope * {
|
|
100
|
-
accent-color: var(--azgrid-accent, var(--azgrid-preset-accent));
|
|
101
|
-
scrollbar-color: var(--azgrid-scrollbar-thumb, var(--azgrid-preset-scrollbar-thumb)) var(--azgrid-scrollbar-track, var(--azgrid-preset-scrollbar-track));
|
|
102
|
-
}
|
|
103
|
-
.azgrid-scope ::-webkit-scrollbar-track {
|
|
104
|
-
background: var(--azgrid-scrollbar-track, var(--azgrid-preset-scrollbar-track));
|
|
105
|
-
}
|
|
106
|
-
.azgrid-scope ::-webkit-scrollbar-thumb {
|
|
107
|
-
background: var(--azgrid-scrollbar-thumb, var(--azgrid-preset-scrollbar-thumb));
|
|
108
|
-
}
|
|
109
|
-
/* The grid draws its own scrollbars and pushes the native one out of view by a
|
|
110
|
-
fixed offset. Setting scrollbar-color switches Chrome to the standard (wider)
|
|
111
|
-
scrollbar, which then overlaps the last pixels of the viewport. Hide it
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
/* Keep the menu row in its hover state while the pointer is in the portaled menu.
|
|
2
|
+
* Match the strongest selected-row :hover selectors, including their cells. */
|
|
3
|
+
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target,
|
|
4
|
+
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target .InovuaReactDataGrid__cell,
|
|
5
|
+
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light.InovuaReactDataGrid--show-hover-rows .InovuaReactDataGrid__row.azgrid-row--menu-open:not(.InovuaReactDataGrid__row--scrolling):not(.InovuaReactDataGrid__row--empty) .InovuaReactDataGrid__row-hover-target .InovuaReactDataGrid__row-index-column {
|
|
6
|
+
background: var(--azgrid-row-bg-hover, var(--azgrid-preset-row-bg-hover));
|
|
7
|
+
color: var(--azgrid-row-fg-hover, var(--azgrid-preset-row-fg-hover));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Additional surfaces and typography not assigned colours by Inovua. */
|
|
11
|
+
.azgrid.InovuaReactDataGrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row--active:not(.InovuaReactDataGrid__row--selected) .InovuaReactDataGrid__cell:not(.InovuaReactDataGrid__cell--no-background) {
|
|
12
|
+
background: var(--azgrid-row-bg-active, var(--azgrid-preset-row-bg-active));
|
|
13
|
+
}
|
|
14
|
+
.azgrid.azgrid-tree .InovuaReactDataGrid__row:not(.InovuaReactDataGrid__row--selected):not(.InovuaReactDataGrid__row--active) .InovuaReactDataGrid__row-hover-target:not(:hover),
|
|
15
|
+
.azgrid .InovuaReactDataGrid__row--group-row:not(.InovuaReactDataGrid__row--selected):not(.InovuaReactDataGrid__row--active) .InovuaReactDataGrid__row-hover-target:not(:hover) {
|
|
16
|
+
background: var(--azgrid-tree-bg, var(--azgrid-preset-tree-bg));
|
|
17
|
+
color: var(--azgrid-tree-fg, var(--azgrid-preset-tree-fg));
|
|
18
|
+
}
|
|
19
|
+
.azgrid.azgrid-tree .InovuaReactDataGrid__cell__content > svg,
|
|
20
|
+
.azgrid .InovuaReactDataGrid__cell--group-expand-cell svg {
|
|
21
|
+
fill: var(--azgrid-tree-fg, var(--azgrid-preset-tree-fg));
|
|
22
|
+
}
|
|
23
|
+
.azgrid.InovuaReactDataGrid {
|
|
24
|
+
background: var(--azgrid-bg, var(--azgrid-preset-bg));
|
|
25
|
+
color: var(--azgrid-fg, var(--azgrid-preset-fg));
|
|
26
|
+
border-color: var(--azgrid-border, var(--azgrid-preset-border));
|
|
27
|
+
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
28
|
+
font-family: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
29
|
+
}
|
|
30
|
+
.azgrid .InovuaReactDataGrid__column-header__content,
|
|
31
|
+
.azgrid .InovuaReactDataGrid__header-group__title {
|
|
32
|
+
color: var(--azgrid-header-fg, var(--azgrid-preset-header-fg));
|
|
33
|
+
font-size: var(--azgrid-header-font-size, var(--azgrid-preset-header-font-size));
|
|
34
|
+
font-weight: var(--azgrid-header-font-weight, var(--azgrid-preset-header-font-weight));
|
|
35
|
+
text-transform: var(--azgrid-header-text-transform, var(--azgrid-preset-header-text-transform));
|
|
36
|
+
letter-spacing: var(--azgrid-header-letter-spacing, var(--azgrid-preset-header-letter-spacing));
|
|
37
|
+
}
|
|
38
|
+
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__cell {
|
|
39
|
+
border: var(--azgrid-cell-border-width, var(--azgrid-preset-cell-border-width)) solid var(--azgrid-cell-border, var(--azgrid-preset-cell-border));
|
|
40
|
+
}
|
|
41
|
+
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row--first .InovuaReactDataGrid__cell {
|
|
42
|
+
/* Inovua's first-row border-top is !important. Keep the same border API on this row. */
|
|
43
|
+
border-top: var(--azgrid-cell-border-width, var(--azgrid-preset-cell-border-width)) solid var(--azgrid-cell-border, var(--azgrid-preset-cell-border)) !important;
|
|
44
|
+
}
|
|
45
|
+
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__cell:not(.InovuaReactDataGrid__cell--group-expand-cell):not(.InovuaReactDataGrid__cell--expand-cell):not(.InovuaReactDataGrid__cell--reorder) {
|
|
46
|
+
padding: var(--azgrid-cell-padding, var(--azgrid-preset-cell-padding));
|
|
47
|
+
}
|
|
48
|
+
.azgrid .InovuaReactDataGrid__empty-wrapper {
|
|
49
|
+
background: var(--azgrid-empty-bg, var(--azgrid-preset-empty-bg));
|
|
50
|
+
color: var(--azgrid-empty-fg, var(--azgrid-preset-empty-fg));
|
|
51
|
+
}
|
|
52
|
+
.azgrid.InovuaReactDataGrid--theme-default-light .InovuaReactDataGrid__row-details {
|
|
53
|
+
background: var(--azgrid-details-bg, var(--azgrid-preset-details-bg));
|
|
54
|
+
}
|
|
55
|
+
.azgrid .InovuaReactDataGrid__cell--locked-start.InovuaReactDataGrid__cell--last-in-section:after,
|
|
56
|
+
.azgrid .InovuaReactDataGrid__cell--locked-end.InovuaReactDataGrid__cell--first-in-section:after {
|
|
57
|
+
box-shadow: var(--azgrid-locked-column-shadow, var(--azgrid-preset-locked-column-shadow));
|
|
58
|
+
}
|
|
59
|
+
.azgrid-scope input,
|
|
60
|
+
.azgrid-scope select,
|
|
61
|
+
.azgrid-scope .azgrid-searcharea {
|
|
62
|
+
color: var(--azgrid-filter-fg, var(--azgrid-preset-filter-fg));
|
|
63
|
+
background-color: var(--azgrid-filter-bg, var(--azgrid-preset-filter-bg));
|
|
64
|
+
border-color: var(--azgrid-filter-border, var(--azgrid-preset-filter-border));
|
|
65
|
+
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
66
|
+
font-family: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
67
|
+
}
|
|
68
|
+
.azgrid-scope input::placeholder {
|
|
69
|
+
color: var(--azgrid-filter-placeholder, var(--azgrid-preset-filter-placeholder));
|
|
70
|
+
}
|
|
71
|
+
.azgrid-scope input:focus-visible,
|
|
72
|
+
.azgrid-scope select:focus-visible {
|
|
73
|
+
outline: 1px solid var(--azgrid-filter-focus-ring, var(--azgrid-preset-filter-focus-ring));
|
|
74
|
+
}
|
|
75
|
+
.azgrid-scope .inovua-react-pagination-toolbar input,
|
|
76
|
+
.azgrid-scope .inovua-react-pagination-toolbar select {
|
|
77
|
+
background: var(--azgrid-pagination-bg, var(--azgrid-preset-pagination-bg));
|
|
78
|
+
color: var(--azgrid-pagination-fg, var(--azgrid-preset-pagination-fg));
|
|
79
|
+
border-color: var(--azgrid-pagination-border, var(--azgrid-preset-pagination-border));
|
|
80
|
+
}
|
|
81
|
+
.azgrid-scope .inovua-react-toolkit-text-input,
|
|
82
|
+
.azgrid-scope .inovua-react-toolkit-combo-box,
|
|
83
|
+
.azgrid-scope .inovua-react-toolkit-menu {
|
|
84
|
+
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
85
|
+
}
|
|
86
|
+
/* The row context menu is portaled to <body>, outside .azgrid-scope: these rules stay
|
|
87
|
+
* unscoped and read the tokens from the theme class DataGrid puts on the menu.
|
|
88
|
+
* Two classes exceed @azrico/controls' single-class menu rules. */
|
|
89
|
+
.azgrid-context-menu.azrico-controls-contextmenu {
|
|
90
|
+
--azrico-contextmenu-color: var(--azgrid-menu-fg, var(--azgrid-preset-menu-fg));
|
|
91
|
+
--azrico-contextmenu-background: var(--azgrid-menu-bg, var(--azgrid-preset-menu-bg));
|
|
92
|
+
--azrico-contextmenu-hover: var(--azgrid-menu-bg-hover, var(--azgrid-preset-menu-bg-hover));
|
|
93
|
+
--azrico-contextmenu-focus: var(--azgrid-accent, var(--azgrid-preset-accent));
|
|
94
|
+
--azrico-contextmenu-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
95
|
+
--azrico-contextmenu-shadow: 0 3px 8px var(--azgrid-shadow-color, var(--azgrid-preset-shadow-color));
|
|
96
|
+
--azrico-contextmenu-font: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
97
|
+
border: 1px solid var(--azgrid-menu-border, var(--azgrid-preset-menu-border));
|
|
98
|
+
}
|
|
99
|
+
.azgrid-scope, .azgrid-scope * {
|
|
100
|
+
accent-color: var(--azgrid-accent, var(--azgrid-preset-accent));
|
|
101
|
+
scrollbar-color: var(--azgrid-scrollbar-thumb, var(--azgrid-preset-scrollbar-thumb)) var(--azgrid-scrollbar-track, var(--azgrid-preset-scrollbar-track));
|
|
102
|
+
}
|
|
103
|
+
.azgrid-scope ::-webkit-scrollbar-track {
|
|
104
|
+
background: var(--azgrid-scrollbar-track, var(--azgrid-preset-scrollbar-track));
|
|
105
|
+
}
|
|
106
|
+
.azgrid-scope ::-webkit-scrollbar-thumb {
|
|
107
|
+
background: var(--azgrid-scrollbar-thumb, var(--azgrid-preset-scrollbar-thumb));
|
|
108
|
+
}
|
|
109
|
+
/* The grid draws its own scrollbars and pushes the native one out of view by a
|
|
110
|
+
fixed offset. Setting scrollbar-color switches Chrome to the standard (wider)
|
|
111
|
+
scrollbar, which then overlaps the last pixels of the viewport. Hide it only
|
|
112
|
+
in the row viewport; toolbars need the native scrollbar for correct sizing. */
|
|
113
|
+
.azgrid-scope .InovuaReactDataGrid__virtual-list > .inovua-react-scroll-container__wrapper > div {
|
|
114
|
+
scrollbar-width: none;
|
|
115
|
+
}
|
|
116
|
+
.azgrid-scope .InovuaReactDataGrid__virtual-list > .inovua-react-scroll-container__wrapper > div::-webkit-scrollbar {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
.azgrid .InovuaReactDataGrid__row.deleted:after {
|
|
120
|
+
border-color: var(--azgrid-muted-fg, var(--azgrid-preset-muted-fg));
|
|
121
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './src/views/DataGrid';
|
|
2
2
|
export * from './src/types/types';
|
|
3
3
|
export { get_row_id, set_row_id, get_col_name, get_col_header } from './src/func/func_grid';
|
|
4
|
+
export { setGridStorageScope, clearColumnSizes } from './src/func/func_colsizes';
|
|
4
5
|
export { default as SelectFilter } from '@inovua/reactdatagrid-enterprise/SelectFilter';
|
|
5
6
|
export { default as NumberFilter } from '@inovua/reactdatagrid-enterprise/NumberFilter';
|
|
6
7
|
export { default as DateFilter } from '@inovua/reactdatagrid-enterprise/DateFilter';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ var _exportNames = {
|
|
|
8
8
|
set_row_id: true,
|
|
9
9
|
get_col_name: true,
|
|
10
10
|
get_col_header: true,
|
|
11
|
+
setGridStorageScope: true,
|
|
12
|
+
clearColumnSizes: true,
|
|
11
13
|
SelectFilter: true,
|
|
12
14
|
NumberFilter: true,
|
|
13
15
|
DateFilter: true,
|
|
@@ -37,6 +39,12 @@ Object.defineProperty(exports, "SelectFilter", {
|
|
|
37
39
|
return _SelectFilter.default;
|
|
38
40
|
}
|
|
39
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "clearColumnSizes", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _func_colsizes.clearColumnSizes;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
40
48
|
exports.default = void 0;
|
|
41
49
|
Object.defineProperty(exports, "get_col_header", {
|
|
42
50
|
enumerable: true,
|
|
@@ -56,6 +64,12 @@ Object.defineProperty(exports, "get_row_id", {
|
|
|
56
64
|
return _func_grid.get_row_id;
|
|
57
65
|
}
|
|
58
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "setGridStorageScope", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _func_colsizes.setGridStorageScope;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
59
73
|
Object.defineProperty(exports, "set_row_id", {
|
|
60
74
|
enumerable: true,
|
|
61
75
|
get: function () {
|
|
@@ -87,6 +101,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
87
101
|
});
|
|
88
102
|
});
|
|
89
103
|
var _func_grid = require("./src/func/func_grid");
|
|
104
|
+
var _func_colsizes = require("./src/func/func_colsizes");
|
|
90
105
|
var _SelectFilter = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise/SelectFilter"));
|
|
91
106
|
var _NumberFilter = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise/NumberFilter"));
|
|
92
107
|
var _DateFilter = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise/DateFilter"));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ColumnDefinition } from '../types/types';
|
|
2
|
+
/** column name -> width in px */
|
|
3
|
+
export type ColumnSizes = {
|
|
4
|
+
[columnName: string]: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Scope the saved column sizes, usually by user id, so different users of one browser don't share them.
|
|
8
|
+
* Grids read their sizes when they mount, so call this before the grids render.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setGridStorageScope(scope: string | undefined): void;
|
|
11
|
+
/** Saved column widths of a grid, an empty object when there are none or storage is unavailable. */
|
|
12
|
+
export declare function loadColumnSizes(gridId: string): ColumnSizes;
|
|
13
|
+
export declare function saveColumnSizes(gridId: string, sizes: ColumnSizes): void;
|
|
14
|
+
/** Forget the saved column widths of a grid. Grids already on screen keep their current sizes until they remount. */
|
|
15
|
+
export declare function clearColumnSizes(gridId: string): void;
|
|
16
|
+
export declare function isValidWidth(width: any): width is number;
|
|
17
|
+
/**
|
|
18
|
+
* Make the columns resizable and restore the saved widths.
|
|
19
|
+
* A column with `width` is controlled by the grid, so it could not be resized: `width` becomes `defaultWidth`.
|
|
20
|
+
* A saved width replaces the column's width and flex. Saved names that are not columns any more are ignored.
|
|
21
|
+
*/
|
|
22
|
+
export declare function apply_column_sizes(columns: ColumnDefinition[], sizes: ColumnSizes): any[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.apply_column_sizes = apply_column_sizes;
|
|
7
|
+
exports.clearColumnSizes = clearColumnSizes;
|
|
8
|
+
exports.isValidWidth = isValidWidth;
|
|
9
|
+
exports.loadColumnSizes = loadColumnSizes;
|
|
10
|
+
exports.saveColumnSizes = saveColumnSizes;
|
|
11
|
+
exports.setGridStorageScope = setGridStorageScope;
|
|
12
|
+
const KEY_PREFIX = 'azgrid:colsizes';
|
|
13
|
+
let storageScope = '';
|
|
14
|
+
/**
|
|
15
|
+
* Scope the saved column sizes, usually by user id, so different users of one browser don't share them.
|
|
16
|
+
* Grids read their sizes when they mount, so call this before the grids render.
|
|
17
|
+
*/
|
|
18
|
+
function setGridStorageScope(scope) {
|
|
19
|
+
storageScope = scope == null ? '' : String(scope);
|
|
20
|
+
}
|
|
21
|
+
function storageKey(gridId) {
|
|
22
|
+
return `${KEY_PREFIX}:${storageScope}:${gridId}`;
|
|
23
|
+
}
|
|
24
|
+
/** Saved column widths of a grid, an empty object when there are none or storage is unavailable. */
|
|
25
|
+
function loadColumnSizes(gridId) {
|
|
26
|
+
const sizes = {};
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(localStorage.getItem(storageKey(gridId)) || 'null');
|
|
29
|
+
if (parsed && typeof parsed === 'object') Object.keys(parsed).forEach(name => {
|
|
30
|
+
if (isValidWidth(parsed[name])) sizes[name] = parsed[name];
|
|
31
|
+
});
|
|
32
|
+
} catch (e) {
|
|
33
|
+
//private mode, blocked storage or corrupt JSON: behave as if nothing was saved
|
|
34
|
+
}
|
|
35
|
+
return sizes;
|
|
36
|
+
}
|
|
37
|
+
function saveColumnSizes(gridId, sizes) {
|
|
38
|
+
try {
|
|
39
|
+
localStorage.setItem(storageKey(gridId), JSON.stringify(sizes));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
//quota or blocked storage: the sizes just won't persist
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Forget the saved column widths of a grid. Grids already on screen keep their current sizes until they remount. */
|
|
45
|
+
function clearColumnSizes(gridId) {
|
|
46
|
+
try {
|
|
47
|
+
localStorage.removeItem(storageKey(gridId));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
//nothing to clear
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function isValidWidth(width) {
|
|
53
|
+
return typeof width === 'number' && isFinite(width) && width > 0;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Make the columns resizable and restore the saved widths.
|
|
57
|
+
* A column with `width` is controlled by the grid, so it could not be resized: `width` becomes `defaultWidth`.
|
|
58
|
+
* A saved width replaces the column's width and flex. Saved names that are not columns any more are ignored.
|
|
59
|
+
*/
|
|
60
|
+
function apply_column_sizes(columns, sizes) {
|
|
61
|
+
return columns.map(col => {
|
|
62
|
+
var _col$name;
|
|
63
|
+
const saved = sizes[(_col$name = col.name) !== null && _col$name !== void 0 ? _col$name : col.id];
|
|
64
|
+
if (!isValidWidth(saved) && col.width == null) return col;
|
|
65
|
+
if (isValidWidth(saved)) {
|
|
66
|
+
const {
|
|
67
|
+
width,
|
|
68
|
+
flex,
|
|
69
|
+
defaultFlex,
|
|
70
|
+
...rest
|
|
71
|
+
} = col;
|
|
72
|
+
return {
|
|
73
|
+
...rest,
|
|
74
|
+
defaultWidth: saved
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const {
|
|
78
|
+
width,
|
|
79
|
+
...rest
|
|
80
|
+
} = col;
|
|
81
|
+
return {
|
|
82
|
+
...rest,
|
|
83
|
+
defaultWidth: width
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './views/DataGrid';
|
|
2
2
|
export * from './types/types';
|
|
3
3
|
export { get_row_id, set_row_id, get_col_name, get_col_header } from './func/func_grid';
|
|
4
|
+
export { setGridStorageScope, clearColumnSizes } from './func/func_colsizes';
|
|
4
5
|
import AzGrid from './views/DataGrid';
|
|
5
6
|
export default AzGrid;
|
package/dist/src/index.js
CHANGED
|
@@ -7,8 +7,16 @@ var _exportNames = {
|
|
|
7
7
|
get_row_id: true,
|
|
8
8
|
set_row_id: true,
|
|
9
9
|
get_col_name: true,
|
|
10
|
-
get_col_header: true
|
|
10
|
+
get_col_header: true,
|
|
11
|
+
setGridStorageScope: true,
|
|
12
|
+
clearColumnSizes: true
|
|
11
13
|
};
|
|
14
|
+
Object.defineProperty(exports, "clearColumnSizes", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _func_colsizes.clearColumnSizes;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
12
20
|
exports.default = void 0;
|
|
13
21
|
Object.defineProperty(exports, "get_col_header", {
|
|
14
22
|
enumerable: true,
|
|
@@ -28,6 +36,12 @@ Object.defineProperty(exports, "get_row_id", {
|
|
|
28
36
|
return _func_grid.get_row_id;
|
|
29
37
|
}
|
|
30
38
|
});
|
|
39
|
+
Object.defineProperty(exports, "setGridStorageScope", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _func_colsizes.setGridStorageScope;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
31
45
|
Object.defineProperty(exports, "set_row_id", {
|
|
32
46
|
enumerable: true,
|
|
33
47
|
get: function () {
|
|
@@ -59,6 +73,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
59
73
|
});
|
|
60
74
|
});
|
|
61
75
|
var _func_grid = require("./func/func_grid");
|
|
76
|
+
var _func_colsizes = require("./func/func_colsizes");
|
|
62
77
|
var _react = _interopRequireDefault(require("react"));
|
|
63
78
|
var _client = _interopRequireDefault(require("react-dom/client"));
|
|
64
79
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|