@azrico/reactgrid 1.6.1 → 1.6.4
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 +29 -15
- package/README.md +165 -164
- package/config/generate-theme.cjs +1 -1
- package/config/theme-extras.css +11 -16
- package/dist/src/example.js +27 -2
- package/dist/src/func/func_a11y.d.ts +14 -0
- package/dist/src/func/func_a11y.js +63 -10
- package/dist/src/func/func_grid.d.ts +6 -0
- package/dist/src/func/func_grid.js +15 -4
- package/dist/src/hooks/useGridEvents.js +6 -5
- package/dist/src/themes/azgrid-theme.css +12 -17
- package/dist/src/types/types.d.ts +4 -0
- package/dist/src/views/DataGrid.js +9 -21
- package/package.json +1 -1
- package/src/example.tsx +202 -186
- package/src/func/func_a11y.ts +62 -4
- package/src/func/func_grid.ts +351 -340
- package/src/hooks/useGridEvents.ts +8 -5
- package/src/themes/azgrid-theme.css +12 -17
- package/src/types/types.ts +157 -153
- package/src/views/DataGrid.tsx +14 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
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
|
-
###
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
* 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`.
|
|
8
|
+
* Fix a typed column's `editable` function being replaced by `true`. Functions and booleans are kept, so per-cell editability works again.
|
|
9
|
+
* 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.
|
|
10
|
+
* 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`.
|
|
11
|
+
* Add `children` to `AzGridProps`, rendered after the grid.
|
|
12
|
+
* 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.
|
|
13
|
+
* 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.
|
|
14
|
+
|
|
15
|
+
### 1.7.1 (2026-10-14)
|
|
16
|
+
|
|
17
|
+
* Fix two quick clicks on different rows firing `onRowDoubleClick`: the double-click check now keys clicks by the row's id instead of `undefined`.
|
|
18
|
+
|
|
19
|
+
### 1.7.0 (2026-10-14)
|
|
20
|
+
|
|
21
|
+
* Add `advancedFilterLabel` to rename the quick-search label (default "Search").
|
|
22
|
+
* Add `advancedFilterPlaceholder` for the quick-search input. A string is the native placeholder; any other node (custom HTML) is shown over the empty input.
|
|
23
|
+
|
|
24
|
+
### 1.6.0 (2026-10-14)
|
|
25
|
+
|
|
26
|
+
* 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.
|
|
27
|
+
* 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.
|
|
28
|
+
* Export the typed `AzDataSourceParams` and `AzDataSourceFunc` for the `dataSource` and `details_dataSource` props.
|
|
29
|
+
* Re-export `SelectFilter`, `NumberFilter`, `DateFilter` and `BoolFilter` for `column.filterEditor`.
|
package/README.md
CHANGED
|
@@ -1,164 +1,165 @@
|
|
|
1
|
-
# @azrico/reactgrid
|
|
2
|
-
|
|
3
|
-
Private React data grid package for Azrideus' projects.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { AzGrid } from '@azrico/reactgrid';
|
|
9
|
-
import '@azrico/reactgrid/dist/src/themes/azgrid-theme.css';
|
|
10
|
-
|
|
11
|
-
const columns = [{ name: 'name', header: 'Name', defaultFlex: 1 }];
|
|
12
|
-
const rows = [{ __table_id: '1', name: 'Alice' }];
|
|
13
|
-
|
|
14
|
-
<AzGrid theme="light" columns={columns} dataSource={rows} />;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
The token stylesheet is optional. Without it, the grid uses Inovua's default-light appearance.
|
|
18
|
-
|
|
19
|
-
## Accessibility
|
|
20
|
-
|
|
21
|
-
The grid exposes ARIA grid semantics, so screen readers and automation tools can read it from the accessibility tree.
|
|
22
|
-
|
|
23
|
-
| Element | Attributes |
|
|
24
|
-
| --- | --- |
|
|
25
|
-
| Grid root | `role="grid"`, `aria-rowcount` (total rows incl. header; the full data count when paginated), `aria-colcount` (visible columns), `aria-label`, `aria-readonly="true"` when the grid isn't editable, `aria-busy="true"` while loading |
|
|
26
|
-
| Header row | `role="row"`, `aria-rowindex="1"` |
|
|
27
|
-
| Header cells | `role="columnheader"`, `aria-colindex`, `aria-sort` (`ascending` / `descending` / `none`, sortable columns only) |
|
|
28
|
-
| Rows | `role="row"`, `aria-rowindex` (1-based, header is 1, includes the page offset), `aria-selected` when selection is enabled, `data-row-id` |
|
|
29
|
-
| Body cells | `role="gridcell"`, `aria-colindex`, `data-column="<column name>"`, `aria-readonly="true"` when the cell can't be edited |
|
|
30
|
-
| Row-number cells | `role="rowheader"` |
|
|
31
|
-
|
|
32
|
-
New props:
|
|
33
|
-
|
|
34
|
-
- `ariaLabel?: string` on the grid sets the accessible name of the grid.
|
|
35
|
-
- `ariaLabel?: (value, data) => string` on a column sets `aria-label` on its cells. Use it for icons, badges or values whose visible text isn't descriptive.
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
const columns = [{ name: 'status', header: 'Status', ariaLabel: (value) => `Status: ${value}` }];
|
|
39
|
-
|
|
40
|
-
<AzGrid ariaLabel="Orders" columns={columns} dataSource={rows} />;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Override any cell attribute with the column's `cellDOMProps` / `headerDOMProps`. Values you set there are kept.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
--azgrid-
|
|
65
|
-
--azgrid-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
| `--azgrid-
|
|
79
|
-
| `--azgrid-
|
|
80
|
-
| `--azgrid-
|
|
81
|
-
| `--azgrid-
|
|
82
|
-
| `--azgrid-
|
|
83
|
-
| `--azgrid-
|
|
84
|
-
| `--azgrid-
|
|
85
|
-
| `--azgrid-
|
|
86
|
-
| `--azgrid-
|
|
87
|
-
| `--azgrid-header-
|
|
88
|
-
| `--azgrid-header-
|
|
89
|
-
| `--azgrid-header-
|
|
90
|
-
| `--azgrid-header-
|
|
91
|
-
| `--azgrid-header-
|
|
92
|
-
| `--azgrid-header-
|
|
93
|
-
| `--azgrid-
|
|
94
|
-
| `--azgrid-row-bg-
|
|
95
|
-
| `--azgrid-row-bg-
|
|
96
|
-
| `--azgrid-row-
|
|
97
|
-
| `--azgrid-row-
|
|
98
|
-
| `--azgrid-row-
|
|
99
|
-
| `--azgrid-row-
|
|
100
|
-
| `--azgrid-
|
|
101
|
-
| `--azgrid-cell-border
|
|
102
|
-
| `--azgrid-cell-
|
|
103
|
-
| `--azgrid-
|
|
104
|
-
| `--azgrid-filter-
|
|
105
|
-
| `--azgrid-filter-
|
|
106
|
-
| `--azgrid-filter-
|
|
107
|
-
| `--azgrid-filter-
|
|
108
|
-
| `--azgrid-
|
|
109
|
-
| `--azgrid-pagination-
|
|
110
|
-
| `--azgrid-pagination-
|
|
111
|
-
| `--azgrid-
|
|
112
|
-
| `--azgrid-menu-
|
|
113
|
-
| `--azgrid-menu-
|
|
114
|
-
| `--azgrid-menu-
|
|
115
|
-
| `--azgrid-
|
|
116
|
-
| `--azgrid-scrollbar-
|
|
117
|
-
| `--azgrid-
|
|
118
|
-
| `--azgrid-empty-
|
|
119
|
-
| `--azgrid-
|
|
120
|
-
| `--azgrid-loading-
|
|
121
|
-
| `--azgrid-
|
|
122
|
-
| `--azgrid-tree-
|
|
123
|
-
| `--azgrid-
|
|
124
|
-
| `--azgrid-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
--azgrid-
|
|
141
|
-
--azgrid-
|
|
142
|
-
--azgrid-
|
|
143
|
-
--azgrid-
|
|
144
|
-
--azgrid-
|
|
145
|
-
--azgrid-header-
|
|
146
|
-
--azgrid-header-
|
|
147
|
-
--azgrid-header-
|
|
148
|
-
--azgrid-header-
|
|
149
|
-
--azgrid-
|
|
150
|
-
--azgrid-cell-border
|
|
151
|
-
--azgrid-
|
|
152
|
-
--azgrid-row-bg-
|
|
153
|
-
--azgrid-row-bg-
|
|
154
|
-
--azgrid-row-bg-
|
|
155
|
-
--azgrid-
|
|
156
|
-
--azgrid-scrollbar-
|
|
157
|
-
--azgrid-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
1
|
+
# @azrico/reactgrid
|
|
2
|
+
|
|
3
|
+
Private React data grid package for Azrideus' projects.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { AzGrid } from '@azrico/reactgrid';
|
|
9
|
+
import '@azrico/reactgrid/dist/src/themes/azgrid-theme.css';
|
|
10
|
+
|
|
11
|
+
const columns = [{ name: 'name', header: 'Name', defaultFlex: 1 }];
|
|
12
|
+
const rows = [{ __table_id: '1', name: 'Alice' }];
|
|
13
|
+
|
|
14
|
+
<AzGrid theme="light" columns={columns} dataSource={rows} />;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The token stylesheet is optional. Without it, the grid uses Inovua's default-light appearance.
|
|
18
|
+
|
|
19
|
+
## Accessibility
|
|
20
|
+
|
|
21
|
+
The grid exposes ARIA grid semantics, so screen readers and automation tools can read it from the accessibility tree.
|
|
22
|
+
|
|
23
|
+
| Element | Attributes |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Grid root | `role="grid"`, `aria-rowcount` (total rows incl. header; the full data count when paginated), `aria-colcount` (visible columns), `aria-label`, `aria-readonly="true"` when the grid isn't editable, `aria-busy="true"` while loading |
|
|
26
|
+
| Header row | `role="row"`, `aria-rowindex="1"` |
|
|
27
|
+
| Header cells | `role="columnheader"`, `aria-colindex`, `aria-sort` (`ascending` / `descending` / `none`, sortable columns only), `data-column="<column id>"` |
|
|
28
|
+
| Rows | `role="row"`, `aria-rowindex` (1-based, header is 1, includes the page offset), `aria-selected` when selection is enabled, `data-row-id` |
|
|
29
|
+
| Body cells | `role="gridcell"`, `aria-colindex`, `data-column="<column name>"`, `aria-readonly="true"` when the cell can't be edited |
|
|
30
|
+
| Row-number cells | `role="rowheader"` |
|
|
31
|
+
|
|
32
|
+
New props:
|
|
33
|
+
|
|
34
|
+
- `ariaLabel?: string` on the grid sets the accessible name of the grid.
|
|
35
|
+
- `ariaLabel?: (value, data) => string` on a column sets `aria-label` on its cells. Use it for icons, badges or values whose visible text isn't descriptive.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
const columns = [{ name: 'status', header: 'Status', ariaLabel: (value) => `Status: ${value}` }];
|
|
39
|
+
|
|
40
|
+
<AzGrid ariaLabel="Orders" columns={columns} dataSource={rows} />;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Override any cell attribute with the column's `cellDOMProps` / `headerDOMProps`. Values you set there are kept.
|
|
44
|
+
Pass `headerDOMProps` as an object: Inovua's prop types reject a function there. A function still works but logs a prop-type warning.
|
|
45
|
+
A `gridOptions.onRenderRow` runs after the grid's own row attributes are set, so it can change them too.
|
|
46
|
+
|
|
47
|
+
## Themes
|
|
48
|
+
|
|
49
|
+
Use `theme="light"` (default), `theme="dark"`, or a custom name. Custom names apply
|
|
50
|
+
`azgrid-theme-<name>` to the grid and use light defaults for unspecified variables.
|
|
51
|
+
|
|
52
|
+
`dark` remains a deprecated alias. `theme` takes precedence; `gridOptions.theme` is ignored.
|
|
53
|
+
|
|
54
|
+
Set `--azgrid-*` variables on a wrapper, `:root`, or a theme class. Each grid can use a different palette.
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<div className="my-grid">
|
|
58
|
+
<AzGrid theme="light" columns={columns} dataSource={rows} />
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```css
|
|
63
|
+
.my-grid {
|
|
64
|
+
--azgrid-accent: #345b93;
|
|
65
|
+
--azgrid-header-bg: #edf2f8;
|
|
66
|
+
--azgrid-row-bg-hover: #e4ecf7;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## CSS variables
|
|
71
|
+
|
|
72
|
+
All variables have light/dark defaults. Use valid CSS values for the named property.
|
|
73
|
+
`--azgrid-locked-column-shadow` accepts a complete `box-shadow` value.
|
|
74
|
+
|
|
75
|
+
<!-- azgrid-tokens -->
|
|
76
|
+
| Variable | Controls |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `--azgrid-bg` | Grid background |
|
|
79
|
+
| `--azgrid-fg` | Grid text |
|
|
80
|
+
| `--azgrid-border` | Grid border and separators |
|
|
81
|
+
| `--azgrid-font-family` | Grid and control fonts |
|
|
82
|
+
| `--azgrid-radius` | Grid, input and menu corner radius; default `0` |
|
|
83
|
+
| `--azgrid-accent` | Focus, sort arrows, checkboxes and selection handles |
|
|
84
|
+
| `--azgrid-transparent` | Transparent structural surfaces |
|
|
85
|
+
| `--azgrid-muted-fg` | Disabled text and secondary icons |
|
|
86
|
+
| `--azgrid-shadow-color` | Menu and input shadow colour |
|
|
87
|
+
| `--azgrid-header-bg` | Header background |
|
|
88
|
+
| `--azgrid-header-fg` | Header text |
|
|
89
|
+
| `--azgrid-header-border` | Header separators |
|
|
90
|
+
| `--azgrid-header-font-size` | Header font size |
|
|
91
|
+
| `--azgrid-header-text-transform` | Header text transform |
|
|
92
|
+
| `--azgrid-header-letter-spacing` | Header letter spacing |
|
|
93
|
+
| `--azgrid-header-font-weight` | Header font weight |
|
|
94
|
+
| `--azgrid-row-bg-even` | Even and non-zebra rows |
|
|
95
|
+
| `--azgrid-row-bg-odd` | Odd rows |
|
|
96
|
+
| `--azgrid-row-bg-hover` | Hovered rows and cells |
|
|
97
|
+
| `--azgrid-row-fg-hover` | Hovered row text |
|
|
98
|
+
| `--azgrid-row-bg-selected` | Selected rows and cells |
|
|
99
|
+
| `--azgrid-row-fg-selected` | Selected row text |
|
|
100
|
+
| `--azgrid-row-bg-active` | Active rows |
|
|
101
|
+
| `--azgrid-cell-border` | Cell border colour |
|
|
102
|
+
| `--azgrid-cell-border-width` | Cell border width |
|
|
103
|
+
| `--azgrid-cell-padding` | Data cell padding |
|
|
104
|
+
| `--azgrid-filter-bg` | Filter row, input, editor and search background |
|
|
105
|
+
| `--azgrid-filter-fg` | Filter input and editor text |
|
|
106
|
+
| `--azgrid-filter-border` | Filter input borders |
|
|
107
|
+
| `--azgrid-filter-placeholder` | Input placeholder text |
|
|
108
|
+
| `--azgrid-filter-focus-ring` | Focused input border and ring |
|
|
109
|
+
| `--azgrid-pagination-bg` | Pagination toolbar and control background |
|
|
110
|
+
| `--azgrid-pagination-fg` | Pagination text and icons |
|
|
111
|
+
| `--azgrid-pagination-border` | Pagination control borders |
|
|
112
|
+
| `--azgrid-menu-bg` | Menu, select dropdown and date picker background |
|
|
113
|
+
| `--azgrid-menu-fg` | Menu text and icons |
|
|
114
|
+
| `--azgrid-menu-border` | Menu borders and separators |
|
|
115
|
+
| `--azgrid-menu-bg-hover` | Hovered and focused menu entries |
|
|
116
|
+
| `--azgrid-scrollbar-track` | Scrollbar tracks |
|
|
117
|
+
| `--azgrid-scrollbar-thumb` | Scrollbar thumbs |
|
|
118
|
+
| `--azgrid-empty-bg` | Empty state background |
|
|
119
|
+
| `--azgrid-empty-fg` | Empty state text |
|
|
120
|
+
| `--azgrid-loading-bg` | Loading overlay background |
|
|
121
|
+
| `--azgrid-loading-fg` | Loading text and spinner |
|
|
122
|
+
| `--azgrid-tree-bg` | Tree and group row background |
|
|
123
|
+
| `--azgrid-tree-fg` | Tree and group text and expand icons |
|
|
124
|
+
| `--azgrid-details-bg` | Row details background |
|
|
125
|
+
| `--azgrid-locked-column-shadow` | Locked column shadow |
|
|
126
|
+
<!-- /azgrid-tokens -->
|
|
127
|
+
|
|
128
|
+
## Art Deco example
|
|
129
|
+
|
|
130
|
+
Use dark defaults with an obsidian background, gold accents, square corners and uppercase headers.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<div className="deco-grid">
|
|
134
|
+
<AzGrid theme="dark" columns={columns} dataSource={rows} />
|
|
135
|
+
</div>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```css
|
|
139
|
+
.deco-grid {
|
|
140
|
+
--azgrid-bg: #0A0A0A;
|
|
141
|
+
--azgrid-fg: #eee7d6;
|
|
142
|
+
--azgrid-border: #6b5824;
|
|
143
|
+
--azgrid-accent: #D4AF37;
|
|
144
|
+
--azgrid-radius: 0;
|
|
145
|
+
--azgrid-header-bg: var(--azgrid-bg);
|
|
146
|
+
--azgrid-header-fg: var(--azgrid-accent);
|
|
147
|
+
--azgrid-header-text-transform: uppercase;
|
|
148
|
+
--azgrid-header-letter-spacing: .1em;
|
|
149
|
+
--azgrid-header-font-weight: 600;
|
|
150
|
+
--azgrid-cell-border: var(--azgrid-border);
|
|
151
|
+
--azgrid-cell-border-width: 1px;
|
|
152
|
+
--azgrid-row-bg-odd: #12110e;
|
|
153
|
+
--azgrid-row-bg-hover: #282211;
|
|
154
|
+
--azgrid-row-bg-selected: #423619;
|
|
155
|
+
--azgrid-row-bg-active: #332a15;
|
|
156
|
+
--azgrid-scrollbar-track: var(--azgrid-bg);
|
|
157
|
+
--azgrid-scrollbar-thumb: var(--azgrid-border);
|
|
158
|
+
--azgrid-loading-bg: rgba(10, 10, 10, .85);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
See [src/example.tsx](src/example.tsx) for light, dark and a complete custom `deco` palette.
|
|
163
|
+
|
|
164
|
+
Custom renderers must style their own content. External menu portal containers need
|
|
165
|
+
`azgrid-scope`, the matching `azgrid-theme-<name>` class and the host variables.
|
|
@@ -93,7 +93,7 @@ function tokenFor(selector, prop, literal) {
|
|
|
93
93
|
return bg ? 'bg' : /fill|stroke/.test(prop) ? 'muted-fg' : 'fg';
|
|
94
94
|
}
|
|
95
95
|
let css = '/* Token overrides for Inovua 5.10.2. Generated by config/generate-theme.cjs.\n * index.css retains layout and icons. Public tokens are inherited; preset tokens\n * are fallback implementation details. Do not set public defaults on the root. */\n';
|
|
96
|
-
for (const [index, selector] of [[0, '.azgrid-scope, .azgrid, .azgrid-theme-light'], [1, '.azgrid-theme-dark']]) {
|
|
96
|
+
for (const [index, selector] of [[0, '.azgrid-scope, .azgrid, .azgrid-theme-light, .azgrid-context-menu'], [1, '.azgrid-theme-dark']]) {
|
|
97
97
|
css += `${selector} {\n`;
|
|
98
98
|
for (const [name, values] of Object.entries(tokens)) css += `\t--azgrid-preset-${name}: ${values[index]};\n`;
|
|
99
99
|
css += '}\n\n';
|
package/config/theme-extras.css
CHANGED
|
@@ -74,23 +74,18 @@
|
|
|
74
74
|
.azgrid-scope .inovua-react-toolkit-menu {
|
|
75
75
|
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
76
76
|
}
|
|
77
|
-
/*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
/* The row context menu is portaled to <body>, outside .azgrid-scope: these rules stay
|
|
78
|
+
* unscoped and read the tokens from the theme class DataGrid puts on the menu.
|
|
79
|
+
* Two classes exceed @azrico/controls' single-class menu rules. */
|
|
80
|
+
.azgrid-context-menu.azrico-controls-contextmenu {
|
|
81
|
+
--azrico-contextmenu-color: var(--azgrid-menu-fg, var(--azgrid-preset-menu-fg));
|
|
82
|
+
--azrico-contextmenu-background: var(--azgrid-menu-bg, var(--azgrid-preset-menu-bg));
|
|
83
|
+
--azrico-contextmenu-hover: var(--azgrid-menu-bg-hover, var(--azgrid-preset-menu-bg-hover));
|
|
84
|
+
--azrico-contextmenu-focus: var(--azgrid-accent, var(--azgrid-preset-accent));
|
|
85
|
+
--azrico-contextmenu-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
86
|
+
--azrico-contextmenu-shadow: 0 3px 8px var(--azgrid-shadow-color, var(--azgrid-preset-shadow-color));
|
|
87
|
+
--azrico-contextmenu-font: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
81
88
|
border: 1px solid var(--azgrid-menu-border, var(--azgrid-preset-menu-border));
|
|
82
|
-
border-radius: var(--azgrid-radius, var(--azgrid-preset-radius));
|
|
83
|
-
box-shadow: 0 3px 8px var(--azgrid-shadow-color, var(--azgrid-preset-shadow-color));
|
|
84
|
-
font-family: var(--azgrid-font-family, var(--azgrid-preset-font-family));
|
|
85
|
-
}
|
|
86
|
-
.azgrid-scope .azgrid-context-menu .MuiTypography-root,
|
|
87
|
-
.azgrid-scope .azgrid-context-menu .MuiMenuItem-root {
|
|
88
|
-
color: inherit;
|
|
89
|
-
font-family: inherit;
|
|
90
|
-
}
|
|
91
|
-
.azgrid-scope .azgrid-context-menu .MuiMenuItem-root:hover,
|
|
92
|
-
.azgrid-scope .azgrid-context-menu .MuiMenuItem-root.Mui-focusVisible {
|
|
93
|
-
background: var(--azgrid-menu-bg-hover, var(--azgrid-preset-menu-bg-hover));
|
|
94
89
|
}
|
|
95
90
|
.azgrid-scope, .azgrid-scope * {
|
|
96
91
|
accent-color: var(--azgrid-accent, var(--azgrid-preset-accent));
|
package/dist/src/example.js
CHANGED
|
@@ -30,6 +30,7 @@ const columns = [{
|
|
|
30
30
|
title: 'Name',
|
|
31
31
|
defaultFlex: 1
|
|
32
32
|
}, {
|
|
33
|
+
// typed columns are editable without editableColumns, items keep their case
|
|
33
34
|
name: 'job',
|
|
34
35
|
title: 'Job',
|
|
35
36
|
type: 'combo',
|
|
@@ -41,8 +42,20 @@ const columns = [{
|
|
|
41
42
|
type: 'number',
|
|
42
43
|
defaultFlex: 1,
|
|
43
44
|
ariaLabel: value => `${value} years`
|
|
45
|
+
}, {
|
|
46
|
+
// editable only for rows that are not saved yet (no id)
|
|
47
|
+
name: 'location',
|
|
48
|
+
title: 'Location',
|
|
49
|
+
type: 'select',
|
|
50
|
+
items: ['Shelf A', 'Shelf B', 'Back Room'],
|
|
51
|
+
editable: (value, cellProps) => {
|
|
52
|
+
var _cellProps$data;
|
|
53
|
+
return !(cellProps !== null && cellProps !== void 0 && (_cellProps$data = cellProps.data) !== null && _cellProps$data !== void 0 && _cellProps$data.id);
|
|
54
|
+
},
|
|
55
|
+
defaultFlex: 1
|
|
44
56
|
}];
|
|
45
|
-
|
|
57
|
+
// plain columns still need editableColumns
|
|
58
|
+
const editableColumns = ['name'];
|
|
46
59
|
function getData(delta, max = 200) {
|
|
47
60
|
const fd = [];
|
|
48
61
|
for (let index = 0; index < max; index++) {
|
|
@@ -50,7 +63,10 @@ function getData(delta, max = 200) {
|
|
|
50
63
|
__table_id: String(index),
|
|
51
64
|
name: 'user-' + index,
|
|
52
65
|
age: 5 + index,
|
|
53
|
-
job: 'None'
|
|
66
|
+
job: 'None',
|
|
67
|
+
location: 'Shelf A',
|
|
68
|
+
// every third row is saved, its location is readonly
|
|
69
|
+
id: index % 3 == 0 ? 'saved-' + index : undefined
|
|
54
70
|
};
|
|
55
71
|
if (delta[index] && typeof delta[index] === 'object') {
|
|
56
72
|
for (const key in delta[index]) {
|
|
@@ -139,6 +155,15 @@ function ExampleGrid() {
|
|
|
139
155
|
return [{
|
|
140
156
|
type: 'text',
|
|
141
157
|
content: product.name
|
|
158
|
+
}, {
|
|
159
|
+
title: 'Log row',
|
|
160
|
+
onClick: row => console.log('context menu: log', row)
|
|
161
|
+
}, {
|
|
162
|
+
title: 'Copy name',
|
|
163
|
+
onClick: row => {
|
|
164
|
+
var _navigator$clipboard, _row$name;
|
|
165
|
+
return (_navigator$clipboard = navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText(String((_row$name = row === null || row === void 0 ? void 0 : row.name) !== null && _row$name !== void 0 ? _row$name : ''));
|
|
166
|
+
}
|
|
142
167
|
}];
|
|
143
168
|
}, []);
|
|
144
169
|
return _react.default.createElement("div", {
|
|
@@ -6,6 +6,8 @@ export type ColumnA11yOptions = {
|
|
|
6
6
|
gridEditable?: boolean;
|
|
7
7
|
/** false skips aria-readonly (for interactive special columns like the checkbox column) */
|
|
8
8
|
markReadonly?: boolean;
|
|
9
|
+
/** column id when the column object has no id/name (inovua's special columns) */
|
|
10
|
+
id?: string;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
13
|
* wraps column dom props to add ARIA attributes,
|
|
@@ -31,6 +33,18 @@ export type RootA11yOptions = {
|
|
|
31
33
|
ariaLabel?: string;
|
|
32
34
|
editable?: boolean;
|
|
33
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* sets aria-colindex/aria-sort on the header cells of the grid,
|
|
38
|
+
* attributes the consumer set in an object headerDOMProps are left alone
|
|
39
|
+
* @param grid computed props of the grid
|
|
40
|
+
* @param root root element of the grid
|
|
41
|
+
*/
|
|
42
|
+
export declare function apply_header_a11y(grid: GridType | null | undefined, root: Element): void;
|
|
43
|
+
/**
|
|
44
|
+
* true when a header cell was (re)mounted without its aria-colindex
|
|
45
|
+
* @param root root element of the grid
|
|
46
|
+
*/
|
|
47
|
+
export declare function has_unsynced_header(root: Element | null): boolean;
|
|
34
48
|
/**
|
|
35
49
|
* true while the grid is loading (loading prop or async datasource)
|
|
36
50
|
* @param grid computed props of the grid
|