@nxgt/material 3.22.0 → 3.23.0
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 +13 -0
- package/README.md +1 -1
- package/dist/{components-B0oezhGe.js → components-BaUx5Nax.js} +10099 -10047
- package/dist/components.js +1 -1
- package/dist/lib/components/ui/collections/data-table/partials/data-table-page-control.d.ts +7 -2
- package/dist/lib/components/ui/collections/data-table/partials/data-table-toolbar.d.ts +6 -2
- package/dist/lib/components/ui/collections/data-table/types.d.ts +4 -0
- package/dist/lib/components/ui/collections/data-table/use-pager-focus.d.ts +30 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-band-classes.d.ts +6 -0
- package/dist/lib/components/ui/collections/server-table/partials/server-table-band.d.ts +3 -1
- package/dist/lib/components/ui/collections/server-table/types.d.ts +3 -0
- package/dist/main.js +1 -1
- package/dist/material.css +1 -1
- package/docs/components/data-table-filter-and-lists.md +24 -2
- package/docs/troubleshooting.md +19 -0
- package/package.json +1 -1
|
@@ -122,6 +122,7 @@ table enables, for typing your own column defs.
|
|
|
122
122
|
| `getRowHref` | `(row) => string \| undefined` | — | the first data cell links to the row's page; a click elsewhere on the row follows it |
|
|
123
123
|
| `onRowClick` | `(row, event) => void` | — | a click on the row (not on a control); alone (without `getRowHref`), it makes the row focusable and Enter calls it |
|
|
124
124
|
| `linkComponent` | `ComponentType<{ href, className?, children?, rel?, 'aria-label'?, onClick? }>` | `<a>` | the link for `getRowHref` and the page links: wrap your router's. It must forward `className` and `ref` (the past-end page's "Back to the first page" is a `Button asChild` over it) |
|
|
125
|
+
| `reserveActions` | `boolean` | `true` | with `actions` and a `select` column: keep the toolbar's 68px band while nothing is selected, so the bar does not push the rows down; `false` keeps none and the bar arrives on the first selection (`ServerTable` passes `false`) |
|
|
125
126
|
| `focusable` | `boolean` | `true` with `actions`, else `false` | the `<table>` (or the list of cards or tiles) takes the focus by script (`tabindex="-1"`, never a tab stop): where the focus goes once the control that had it is gone. When the selection is cleared and the focused control went with it (a bulk action's button), the table takes the focus instead of the page's body ([focus after a bulk action](#focus-after-a-bulk-action)); `false` turns both off |
|
|
126
127
|
| `tableRef` | `Ref<HTMLTableElement>` | — | the `<table>`, to focus it yourself (with `focusable`); `controls.focusTable()` does the same from a toolbar slot. It stays `null` while the layout is a list (`cards`, `tiles`, or the phone side of `{ phone, wide }`): use `focusRef` |
|
|
127
128
|
| `focusRef` | `Ref<HTMLElement>` | — | the element `focusable` moves the focus to, whichever the layout: the `<table>`, or the list of cards |
|
|
@@ -273,6 +274,18 @@ wide screen; on a phone the extra lines still push them down).
|
|
|
273
274
|
/>
|
|
274
275
|
```
|
|
275
276
|
|
|
277
|
+
### Focus while paging
|
|
278
|
+
|
|
279
|
+
A page control that has the focus keeps it while the next page loads: a link
|
|
280
|
+
(or a button) stays the same element, `aria-disabled`, dimmed, and a click on
|
|
281
|
+
it does nothing, instead of being swapped for a disabled button (which drops the
|
|
282
|
+
focus to `<body>`, #1609). When a control really goes (Next on the last page),
|
|
283
|
+
the focus moves to its counterpart, or to the pagination `<nav>`
|
|
284
|
+
(`tabindex="-1"`, never a tab stop) when neither is left. A focus or a pointer
|
|
285
|
+
press elsewhere is never pulled back. The footer's selected count is a polite
|
|
286
|
+
status, so the first selection is announced ("1 row selected") when its bar
|
|
287
|
+
shows up.
|
|
288
|
+
|
|
276
289
|
### Focus after a bulk action
|
|
277
290
|
|
|
278
291
|
When a bulk action clears the selection, its buttons unmount and the focus
|
|
@@ -387,7 +400,10 @@ same minimum height once they do — so the "Delete selected" that appears on
|
|
|
387
400
|
the first selection does not push the tapped row down. The reserved height
|
|
388
401
|
is one row of default-size buttons (`h-9`); taller or wrapping actions still
|
|
389
402
|
grow the toolbar. Without the `select` column, or without `actions`, no band
|
|
390
|
-
is kept above the table.
|
|
403
|
+
is kept above the table. `reserveActions={false}` keeps none either: the bar
|
|
404
|
+
arrives on the first selection with a short grow (none under reduced motion),
|
|
405
|
+
and the rows move down by its height. `ServerTable` passes `false`, so its
|
|
406
|
+
bulk bar leaves no empty row under the band while nothing is selected.
|
|
391
407
|
|
|
392
408
|
```tsx
|
|
393
409
|
<DataTable
|
|
@@ -868,7 +884,8 @@ Its props are `ServerTableProps<T>`; `filter` is a `ServerTableFilter`,
|
|
|
868
884
|
| `description` | `ReactNode` | — | a muted line under the `title`, or alone above the band's controls without one; the `actions` stay at the band's end |
|
|
869
885
|
| `actions` | `ReactNode` | — | the page's actions, at the band's end |
|
|
870
886
|
| `bandDensity` | `'comfortable' \| 'compact'` | `'comfortable'` | `'compact'` halves the room above the band (16px to 8px) and under it (12px to 6px), for a list under a sticky app bar and a breadcrumb; the controls keep their size (the Filter's own `density` is the controls') |
|
|
871
|
-
| `pageControls` | `'labelled' \| 'icon'` | `'labelled'` | the footer's Previous / Next: `'icon'` is icon-only, with a tooltip and the names "Previous page" / "Next page" (`DataTable`'s default is unchanged) |
|
|
887
|
+
| `pageControls` | `'labelled' \| 'icon'` | `'labelled'` | the footer's Previous / Next: `'icon'` is icon-only, with a tooltip and the names "Previous page" / "Next page" (`DataTable`'s default is unchanged); on a coarse pointer the icon controls are 44x44 boxes (still painted 32px) |
|
|
888
|
+
| `bandActions` | `'stacked' \| 'inline'` | `'stacked'` | with `filter`, where `actions` sit below 768px: `'stacked'` gives them a row above the search; `'inline'` keeps them on the search's row (the search takes the room left), for a lone icon action such as a "+". An action wider than 3.5rem wraps under the search. From 768px both are the same |
|
|
872
889
|
| `filterRef` | `Ref<ServerTableFilterHandle>` | — | with `filter`: `filterRef.current.focus()` focuses the Filter's first control, the search, else the first quick filter, "Add filter" or "Filters (N)" the width shows |
|
|
873
890
|
| `sorting` | `createSorting(…)` | — | headers sorted from the URL |
|
|
874
891
|
| `filters` | `tableFilters(model)` | — | without `filter`: "nothing matches" and its clear |
|
|
@@ -883,6 +900,11 @@ Its props are `ServerTableProps<T>`; `filter` is a `ServerTableFilter`,
|
|
|
883
900
|
| `resultsLabel` | `(count) => string` | "N results" | without `filter`: what the list's region says. The page past the last has its own words: `material.server-table.past-end`, `past-end-hint`, `first-page` and `past-end-status` |
|
|
884
901
|
| `className` | `string` | — | on the list's surface |
|
|
885
902
|
|
|
903
|
+
```tsx
|
|
904
|
+
// A lone icon action stays on the search's row on a phone.
|
|
905
|
+
<ServerTable {...props} filter={{ model }} bandActions="inline" actions={<IconButton aria-label="New" tooltip="New"><Icon name="plus" /></IconButton>} />
|
|
906
|
+
```
|
|
907
|
+
|
|
886
908
|
**Where the focus goes.** After "Clear" on an empty page, or the last chip
|
|
887
909
|
removed, the focus returns to the Filter's search; a bar without one falls to
|
|
888
910
|
its first shown control (a quick filter, "Add filter", or "Filters (N)" on a
|
package/docs/troubleshooting.md
CHANGED
|
@@ -356,6 +356,8 @@ words in your error.
|
|
|
356
356
|
- [A `ServerTable` search shows older text, or a write is lost, over a slow router](#a-servertable-search-shows-older-text-or-a-write-is-lost-over-a-slow-router)
|
|
357
357
|
- [`ListEmpty`'s title is now a heading](#listempty-title-is-now-a-heading)
|
|
358
358
|
- [`ServerTable` keeps showing the empty page or the old rows after a failed fetch](#servertable-keeps-showing-the-empty-page-or-the-old-rows-after-a-failed-fetch)
|
|
359
|
+
- [The focus falls to `<body>` after Previous / Next on a `ServerTable`](#the-focus-falls-to-body-after-previous--next-on-a-servertable)
|
|
360
|
+
- [An empty gap under the `ServerTable` band while nothing is selected](#an-empty-gap-under-the-servertable-band-while-nothing-is-selected)
|
|
359
361
|
- [The focus falls to the page after a `DataTable` bulk action](#the-focus-falls-to-the-page-after-a-datatable-bulk-action)
|
|
360
362
|
- [A test's `getByText('No data available')` finds two elements after a change](#a-tests-getbytextno-data-available-finds-two-elements-after-a-change)
|
|
361
363
|
- [`` [@nxgt/material] DataTable: `virtual` needs `maxHeight`; the rows are not virtualized. ``](#nxgtmaterial-datatable-virtual-needs-maxheight-the-rows-are-not-virtualized)
|
|
@@ -6502,6 +6504,23 @@ const columns = [{ accessorKey: 'name', header: NameHeader }];
|
|
|
6502
6504
|
**Why:** `ServerTable` cannot tell a failed fetch from an empty answer: `error` was never passed, or it was passed and never cleared (`null`) when the next answer landed, so the failure stays on screen.
|
|
6503
6505
|
**Fix:** pass `error` while the fetch has failed, with `onRetry`, and set it back to `null` as soon as the next answer lands. See [ServerTable](components/data-table-filter-and-lists.md#servertable).
|
|
6504
6506
|
|
|
6507
|
+
### The focus falls to `<body>` after Previous / Next on a `ServerTable`
|
|
6508
|
+
|
|
6509
|
+
Versions before `reserveActions` landed swapped a page link for a disabled
|
|
6510
|
+
button while the next page loaded, which dropped the focus to `<body>`
|
|
6511
|
+
(always on a phone's tiles). Upgrade: the control now stays, `aria-disabled`,
|
|
6512
|
+
and the focus moves to its counterpart when one goes (Next on the last page).
|
|
6513
|
+
See [Focus while paging](components/data-table-filter-and-lists.md#focus-while-paging).
|
|
6514
|
+
A custom `linkComponent` must render an element that can take the focus (an
|
|
6515
|
+
`<a href>`).
|
|
6516
|
+
|
|
6517
|
+
### An empty gap under the `ServerTable` band while nothing is selected
|
|
6518
|
+
|
|
6519
|
+
Versions before `reserveActions` reserved the toolbar's 68px (`header-placeholder`) for the
|
|
6520
|
+
bulk actions. `ServerTable` now reserves nothing. On `DataTable` itself the
|
|
6521
|
+
default is still `reserveActions` `true`: pass `reserveActions={false}` to get
|
|
6522
|
+
the same.
|
|
6523
|
+
|
|
6505
6524
|
### The focus falls to the page after a `DataTable` bulk action
|
|
6506
6525
|
|
|
6507
6526
|
**When:** a bulk action clears the selection, its buttons unmount, and the next Tab starts from the top of the page.
|