@nxgt/material-vue 0.26.0 → 0.26.1
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 +6 -0
- package/docs/troubleshooting.md +82 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @nxgt/material-vue
|
|
2
2
|
|
|
3
|
+
## 0.26.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#433](https://github.com/softistx/nxgt-material/pull/433) [`620527a`](https://github.com/softistx/nxgt-material/commit/620527a02ac7f8136e271bc51c32dd28a6d99a25) Thanks [@SteveGT96](https://github.com/SteveGT96)! - Troubleshooting entries for the DataTable server mode: a link or button in the first column of a `getRowHref` table, a row that does not navigate after `onRowClick` / `@row-click`, a disabled Previous or Next, and (Vue) a `:sorting` or `:row-selection` bound without its `update:` half.
|
|
8
|
+
|
|
3
9
|
## 0.26.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/docs/troubleshooting.md
CHANGED
|
@@ -118,6 +118,10 @@ words in your error.
|
|
|
118
118
|
- [A `RichTextEditor` became editable after upgrading](#a-richtexteditor-became-editable-after-upgrading)
|
|
119
119
|
- [Focus falls to `<body>` when a controlled `Drawer` closes](#focus-falls-to-body-when-a-controlled-drawer-closes)
|
|
120
120
|
- [A `TimePicker` test expects AM / PM to add 12 hours, or a click on the pressed half to switch to PM](#a-timepicker-test-expects-am--pm-to-add-12-hours-or-a-click-on-the-pressed-half-to-switch-to-pm)
|
|
121
|
+
- [A link or button in the first column of a `DataTable` with `getRowHref`](#a-link-or-button-in-the-first-column-of-a-datatable-with-getrowhref)
|
|
122
|
+
- [A row does not navigate after `@row-click` ran](#a-row-does-not-navigate-after-row-click-ran)
|
|
123
|
+
- [A `DataTable` Previous or Next button is disabled](#a-datatable-previous-or-next-button-is-disabled)
|
|
124
|
+
- [A `DataTable` shows a sorting or a selection the URL never got](#a-datatable-shows-a-sorting-or-a-selection-the-url-never-got)
|
|
121
125
|
|
|
122
126
|
**PDF reader**
|
|
123
127
|
|
|
@@ -2101,6 +2105,84 @@ expect(onChange).toHaveBeenLastCalledWith(new Date(2026, 0, 1, 21, 30)); // from
|
|
|
2101
2105
|
await userEvent.type(canvas.getByRole('spinbutton', { name: 'Hours' }), '10');
|
|
2102
2106
|
```
|
|
2103
2107
|
|
|
2108
|
+
### A link or button in the first column of a `DataTable` with `getRowHref`
|
|
2109
|
+
|
|
2110
|
+
**When:** a `DataTable` has `getRowHref`, and the cell of its first data column (the first visible column with an accessor; without one, the first that is not `select` or `expand`) renders a link or a button of its own.
|
|
2111
|
+
**Why:** with `getRowHref` that cell's content is wrapped in the row's link, so a link or button inside it is interactive content nested in a link: a nested `<a>` is invalid HTML, so server and client markup can disagree (a hydration warning in an SSR app), and a click or Enter lands on the inner control or the outer link depending on the target. The row's click handling skips clicks on any control, so the row does not follow its link from there either.
|
|
2112
|
+
**Fix:** keep that column plain, and put the control in another column:
|
|
2113
|
+
|
|
2114
|
+
```vue
|
|
2115
|
+
<DataTable
|
|
2116
|
+
manual
|
|
2117
|
+
:data="rows"
|
|
2118
|
+
:columns="columns"
|
|
2119
|
+
:get-row-href="(student) => `/students/${student.id}`"
|
|
2120
|
+
:link-component="RouterLink"
|
|
2121
|
+
/>
|
|
2122
|
+
```
|
|
2123
|
+
```ts
|
|
2124
|
+
// columns: the first accessor column renders plain content
|
|
2125
|
+
columnHelper.accessor('name', { header: 'Name' }),
|
|
2126
|
+
// the control goes in a column of its own, after it
|
|
2127
|
+
columnHelper.display({
|
|
2128
|
+
id: 'open',
|
|
2129
|
+
cell: ({ row }) => h(Button, { onClick: () => openSheet(row.original) }, () => 'Quick view'),
|
|
2130
|
+
}),
|
|
2131
|
+
```
|
|
2132
|
+
|
|
2133
|
+
Anything else that must not make the row follow its link on a click (a custom widget that is not a button, link or field) can carry `data-row-click-ignore`.
|
|
2134
|
+
|
|
2135
|
+
### A row does not navigate after `@row-click` ran
|
|
2136
|
+
|
|
2137
|
+
**When:** a `DataTable` has both `getRowHref` and `@row-click`; the handler runs, and a mouse click does not go to the row's page.
|
|
2138
|
+
**Why:** the handler runs first, and the row follows its link only if the click's `defaultPrevented` is still false after it. A handler that calls `event.preventDefault()` therefore stops the navigation by design, which is how a handler cancels it (for a row that opens a sheet instead). Ctrl/Cmd+click on the link, and Enter on it, do not go through the row handler.
|
|
2139
|
+
**Fix:** do not call `preventDefault()` in the handler when the row should still navigate:
|
|
2140
|
+
|
|
2141
|
+
```vue
|
|
2142
|
+
<DataTable
|
|
2143
|
+
manual
|
|
2144
|
+
:data="rows"
|
|
2145
|
+
:columns="columns"
|
|
2146
|
+
:get-row-href="(row) => `/students/${row.id}`"
|
|
2147
|
+
@row-click="(row, event) => openSheet(row)"
|
|
2148
|
+
/>
|
|
2149
|
+
```
|
|
2150
|
+
|
|
2151
|
+
### A `DataTable` Previous or Next button is disabled
|
|
2152
|
+
|
|
2153
|
+
**When:** a server-mode `DataTable` (`manual`) renders its footer with Previous or Next greyed out, though the server has more pages.
|
|
2154
|
+
**Why:** each button is enabled only when `pagination.previous` / `pagination.next` is an href string or a function, and the table is not `loading`. An absent or `null` value gives a disabled button, and both buttons are disabled while `loading` is true, so a `loading` that stays on (a flag never reset after the navigation ended) leaves them disabled. A `pagination` that is not passed renders no buttons at all.
|
|
2155
|
+
**Fix:** pass a target on each side that has a page, and turn `loading` off when the page has arrived:
|
|
2156
|
+
|
|
2157
|
+
```vue
|
|
2158
|
+
<DataTable
|
|
2159
|
+
manual
|
|
2160
|
+
:data="rows"
|
|
2161
|
+
:columns="columns"
|
|
2162
|
+
:loading="navigating"
|
|
2163
|
+
:pagination="{ previous: hasPrevious ? previousHref : null, next: hasNext ? nextHref : null, totalCount, offset }"
|
|
2164
|
+
/>
|
|
2165
|
+
```
|
|
2166
|
+
|
|
2167
|
+
### A `DataTable` shows a sorting or a selection the URL never got
|
|
2168
|
+
|
|
2169
|
+
**When:** a `DataTable` has `:sorting` (or `:row-selection`) bound to state you derive from the URL, with no `@update:sorting` (or `@update:row-selection`), and clicking a header changes the arrow while the rows and the URL stay as they were.
|
|
2170
|
+
**Why:** `sorting` and `rowSelection` are `defineModel`s. Vue keeps a local copy and applies a change to it unless the parent binds both the prop and its `update:` listener, so a one-way `:sorting` is a starting value the table then overrides, until the prop changes.
|
|
2171
|
+
**Fix:** bind both halves, and write the new value where the data comes from:
|
|
2172
|
+
|
|
2173
|
+
```vue
|
|
2174
|
+
<DataTable
|
|
2175
|
+
manual
|
|
2176
|
+
:data="rows"
|
|
2177
|
+
:columns="columns"
|
|
2178
|
+
:sorting="sorting"
|
|
2179
|
+
@update:sorting="(next) => router.push({ query: { ...route.query, sort: toQuery(next) } })"
|
|
2180
|
+
v-model:row-selection="rowSelection"
|
|
2181
|
+
/>
|
|
2182
|
+
```
|
|
2183
|
+
|
|
2184
|
+
---
|
|
2185
|
+
|
|
2104
2186
|
---
|
|
2105
2187
|
|
|
2106
2188
|
## PDF reader
|