vuetable-next 1.0.12 → 1.1.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/README.md +527 -84
- package/dist/index.js +1 -0
- package/dist/portable/components/useVuetableField.d.ts +2 -0
- package/dist/public.d.ts +76 -1
- package/dist/style.css +2 -2
- package/dist/types/components/Vuetable.vue.d.ts +172 -62
- package/dist/types/components/VuetableColGroup.vue.d.ts +8 -20
- package/dist/types/components/VuetableColGutter.vue.d.ts +1 -0
- package/dist/types/components/VuetableColumn.d.ts +39 -0
- package/dist/types/components/VuetableContext.d.ts +11 -0
- package/dist/types/components/VuetableFieldCheckboxMixin.vue.d.ts +1 -1
- package/dist/types/components/VuetableFieldHandle.vue.d.ts +1 -1
- package/dist/types/components/VuetableFieldMixin.vue.d.ts +1 -1
- package/dist/types/components/VuetableFieldSequence.vue.d.ts +1 -1
- package/dist/types/components/VuetableRenderBoundary.d.ts +4 -1
- package/dist/types/components/VuetableRowHeader.vue.d.ts +15 -3
- package/dist/types/components/useVuetableColumnGroups.d.ts +53 -0
- package/dist/types/components/useVuetableColumns.d.ts +12 -0
- package/dist/types/components/useVuetableField.d.ts +2 -0
- package/dist/types/components/useVuetableFixedColumns.d.ts +53 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/vue2.cjs +9 -5
- package/dist/vue2.cjs.map +1 -1
- package/dist/vue2.js +1358 -878
- package/dist/vue2.js.map +1 -1
- package/dist/vue3.cjs +2 -2
- package/dist/vue3.cjs.map +1 -1
- package/dist/vue3.js +1536 -982
- package/dist/vue3.js.map +1 -1
- package/package.json +1 -1
- package/style.css +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
# Vuetable Next
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
**A familiar table API. A smoother path from Vue 2 to Vue 3.**
|
|
6
|
+
|
|
7
|
+
Data tables, custom fields, selection, pagination and expandable rows — across Vue generations.
|
|
8
|
+
|
|
9
|
+
[](#compatibility)
|
|
10
|
+
[](https://vuetable.com/guide/)
|
|
11
|
+
[](https://github.com/Artles777/vuetable-next/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
## Contents
|
|
14
|
+
|
|
15
|
+
- [Why Vuetable Next?](#why-vuetable-next)
|
|
16
|
+
- [Quick start](#quick-start): [install](#install) · [Vue 3](#vue-3) · [Vue 2.6](#vue-26) · [Vue 2.7](#vue-27)
|
|
17
|
+
- [Compatibility](#compatibility)
|
|
18
|
+
- [Features in 1.1.0](#features-in-110): [declarative columns](#declarative-columns-opt-in) · [grouped headers and slots](#grouped-headers-and-extra-rows-opt-in) · [fixed columns](#fixed-columns-opt-in)
|
|
19
|
+
- [Documentation and migration](#documentation-and-migration): [upstream API](#familiar-vuetable-2-documentation) · [performance](#vue-3-automatic-row-render-optimization) · [migration](#moving-an-existing-table) · [API request ordering](#overlapping-api-requests) · [initial page](#initial-page-in-api-mode) · [checkbox events](#checkbox-events-and-row-data) · [row identity](#row-identity-and-custom-field-loading) · [row order](#row-order-and-drag-handles) · [mixins and composables](#mixins-or-composables) · [TypeScript](#explicit-framework-entries-and-types)
|
|
20
|
+
- [Semantic UI and Vuetify styles](#semantic-ui-and-vuetify-styles)
|
|
21
|
+
- [Live demos](#live-demos) · [screenshots](#screenshots)
|
|
22
|
+
- [Development and checks](#development-and-checks) · [contributing](#contributing)
|
|
23
|
+
- [Limitations and security](#limitations-and-security) · [license and credits](#license-and-credits)
|
|
24
|
+
|
|
25
|
+
**First time here?** Start with your Vue version in [Quick start](#quick-start).
|
|
26
|
+
For task-oriented guides and complete API examples, open the [documentation index](https://github.com/Artles777/vuetable-next/blob/main/docs/README.md).
|
|
27
|
+
For release history, see the [changelog](https://github.com/Artles777/vuetable-next/blob/main/CHANGELOG.md).
|
|
28
|
+
|
|
29
|
+
---
|
|
23
30
|
|
|
24
31
|
## Why Vuetable Next?
|
|
25
32
|
|
|
@@ -36,61 +43,25 @@ familiar table API while supporting both Vue 2 and Vue 3 applications.
|
|
|
36
43
|
- **Keep dependencies shared.** Vue, `vue-demi` and Axios are external, not private copies embedded in the bundle.
|
|
37
44
|
- **Use TypeScript.** Portable root declarations work across supported Vue generations; the explicit Vue 3 entry provides richer generated types.
|
|
38
45
|
|
|
39
|
-
> **
|
|
46
|
+
> **Compatibility note:** releases from `1.0.11` onward include the Vue 2.6 / Vue 2.7 / Vue 3 packaging,
|
|
40
47
|
> public composables and portable declarations described here. The older
|
|
41
48
|
> `1.0.10` release does not contain these compatibility changes.
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Vue 3 · selection and expandable details
|
|
46
|
-
|
|
47
|
-

|
|
48
|
-
|
|
49
|
-
<details>
|
|
50
|
-
<summary><strong>See the same component on Vue 2.6 and Vue 2.7</strong></summary>
|
|
51
|
-
|
|
52
|
-
#### Vue 2.6 + Composition API
|
|
53
|
-
|
|
54
|
-

|
|
55
|
-
|
|
56
|
-
#### Vue 2.7 · native Composition API
|
|
57
|
-
|
|
58
|
-

|
|
59
|
-
|
|
60
|
-
</details>
|
|
61
|
-
|
|
62
|
-
These are real browser captures of the **same packed library** in three isolated
|
|
63
|
-
Vue applications. The surrounding dashboard and green theme are showcase styles,
|
|
64
|
-
not a theme automatically installed by the library. No live customer data is used.
|
|
65
|
-
|
|
66
|
-
## Compatibility
|
|
67
|
-
|
|
68
|
-
| Application runtime | Declared support | Tested runtime | Composition API plugin |
|
|
69
|
-
| --- | --- | --- | --- |
|
|
70
|
-
| Vue 2.6 | `^2.6.14` | `2.6.14` | Install `@vue/composition-api` |
|
|
71
|
-
| Vue 2.7 | Included in the Vue 2 range | `2.7.16` | Not needed |
|
|
72
|
-
| Vue 3 | `^3.5.3` | `3.5.46` | Not needed |
|
|
73
|
-
|
|
74
|
-
The package contains separately compiled Vue 2 and Vue 3 render functions.
|
|
75
|
-
`vue-demi` selects the correct build for the installed runtime; no application
|
|
76
|
-
alias or manual dependency patch is needed for normal root imports.
|
|
77
|
-
|
|
78
|
-
Checks cover actual rendering, reactive data updates, legacy field mixins, custom
|
|
79
|
-
fields, checkbox selection, events, detail-row parent access, component methods,
|
|
80
|
-
teardown, module resolution and public declarations. Vue 2.6 is also checked with
|
|
81
|
-
a webpack 4 consumer toolchain. This is not a claim that every upstream example
|
|
82
|
-
or every possible consumer integration has been exhaustively tested.
|
|
50
|
+
---
|
|
83
51
|
|
|
84
52
|
## Quick start
|
|
85
53
|
|
|
86
54
|
### Install
|
|
87
55
|
|
|
88
|
-
Install the
|
|
56
|
+
Install the latest stable release:
|
|
89
57
|
|
|
90
58
|
```sh
|
|
91
|
-
npm install vuetable-next
|
|
59
|
+
npm install vuetable-next@latest
|
|
92
60
|
```
|
|
93
61
|
|
|
62
|
+
`@latest` uses the package's current npm `latest` tag, so this command does not
|
|
63
|
+
need to change for each release. Your application's lockfile records the resolved version.
|
|
64
|
+
|
|
94
65
|
For Vue 2.6, also install the Composition API plugin:
|
|
95
66
|
|
|
96
67
|
```sh
|
|
@@ -104,10 +75,11 @@ npm install --legacy-peer-deps --package-lock=false
|
|
|
104
75
|
npm pack
|
|
105
76
|
```
|
|
106
77
|
|
|
107
|
-
Then install the generated archive from your application directory
|
|
78
|
+
Then install the generated archive from your application directory, replacing
|
|
79
|
+
`VERSION` with the version in the filename printed by `npm pack`:
|
|
108
80
|
|
|
109
81
|
```sh
|
|
110
|
-
npm install /absolute/path/to/vuetable-next/vuetable-next-
|
|
82
|
+
npm install /absolute/path/to/vuetable-next/vuetable-next-VERSION.tgz
|
|
111
83
|
```
|
|
112
84
|
|
|
113
85
|
`npm pack` runs the dual build and package checks through `prepack`. The archive
|
|
@@ -221,6 +193,91 @@ new Vue({ render: createElement => createElement(App) }).$mount("#app");
|
|
|
221
193
|
For global registration on either Vue 2 version, import `Vuetable` in your
|
|
222
194
|
entry point and call `Vue.use(Vuetable)` before creating the root instance.
|
|
223
195
|
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Compatibility
|
|
199
|
+
|
|
200
|
+
| Application runtime | Declared support | Tested runtime | Composition API plugin |
|
|
201
|
+
| --- | --- | --- | --- |
|
|
202
|
+
| Vue 2.6 | `^2.6.14` | `2.6.14` | Install `@vue/composition-api` |
|
|
203
|
+
| Vue 2.7 | Included in the Vue 2 range | `2.7.16` | Not needed |
|
|
204
|
+
| Vue 3 | `^3.5.3` | `3.5.46` | Not needed |
|
|
205
|
+
|
|
206
|
+
The package contains separately compiled Vue 2 and Vue 3 render functions.
|
|
207
|
+
`vue-demi` selects the correct build for the installed runtime; no application
|
|
208
|
+
alias or manual dependency patch is needed for normal root imports.
|
|
209
|
+
|
|
210
|
+
Checks cover actual rendering, reactive data updates, legacy field mixins, custom
|
|
211
|
+
fields, checkbox selection, events, detail-row parent access, component methods,
|
|
212
|
+
teardown, module resolution and public declarations. Vue 2.6 is also checked with
|
|
213
|
+
a webpack 4 consumer toolchain. This is not a claim that every upstream example
|
|
214
|
+
or every possible consumer integration has been exhaustively tested.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Features in 1.1.0
|
|
219
|
+
|
|
220
|
+
The new column, layout and pinning APIs are additive. Existing `fields` tables
|
|
221
|
+
keep working without migration. See [1.1.0 release notes](https://github.com/Artles777/vuetable-next/blob/main/CHANGELOG.md#110---2026-12-02).
|
|
222
|
+
|
|
223
|
+
### Declarative columns (opt-in)
|
|
224
|
+
|
|
225
|
+
For left/right column pinning, dynamic group headers and custom totals, see
|
|
226
|
+
[fixed columns](https://github.com/Artles777/vuetable-next/blob/main/docs/fixed-columns.md) and [table layout](https://github.com/Artles777/vuetable-next/blob/main/docs/table-layout.md).
|
|
227
|
+
|
|
228
|
+
Alongside the existing `fields` API, declarations can provide column metadata and
|
|
229
|
+
scoped templates. Import `Vuetable, { VuetableColumn }` from `vuetable-next`:
|
|
230
|
+
|
|
231
|
+
```vue
|
|
232
|
+
<Vuetable :data="rows" :api-mode="false">
|
|
233
|
+
<VuetableColumn field="name" label="Customer" sortable width="180px">
|
|
234
|
+
<template #default="{ row }"><strong>{{ row.name }}</strong></template>
|
|
235
|
+
</VuetableColumn>
|
|
236
|
+
</Vuetable>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
See the [declarative columns guide](https://github.com/Artles777/vuetable-next/blob/main/docs/declarative-columns.md) for all three
|
|
240
|
+
runtime setups, both APIs, precedence and migration limits. This is additive,
|
|
241
|
+
not full Buefy compatibility; existing `fields` tables need no migration.
|
|
242
|
+
The [shared showcase](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#declarative-columns) has interactive controls.
|
|
243
|
+
|
|
244
|
+
### Grouped headers and extra rows (opt-in)
|
|
245
|
+
|
|
246
|
+
Keep the standard sortable header and add subheaders or totals with
|
|
247
|
+
`beforeHeader`, `afterHeader`, `beforeFooter` and `afterFooter`. Enable
|
|
248
|
+
`group-by="headerName"` for field objects or `group-by="group"` for declarative
|
|
249
|
+
columns. Visible groups calculate their own spans and expose semantic boundary
|
|
250
|
+
classes when columns are hidden or reordered.
|
|
251
|
+
|
|
252
|
+
See [table layout and grouped headers](https://github.com/Artles777/vuetable-next/blob/main/docs/table-layout.md) for slot scope,
|
|
253
|
+
precedence, gutter alignment and migration examples. Available starting with `1.1.0`.
|
|
254
|
+
|
|
255
|
+
### Fixed columns (opt-in)
|
|
256
|
+
|
|
257
|
+
Pin multiple columns on either side with `fixed: "left"` or `fixed: "right"`.
|
|
258
|
+
Pinned columns move to their edge by default; `fixedOrder` sets their rank from
|
|
259
|
+
that edge, and automatic ranks follow pin activation order. Choose
|
|
260
|
+
`fixed-mode="in-place"` to keep the original column positions.
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
For example, with object fields:
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
const fields = [
|
|
267
|
+
{ name: "customer", title: "Customer", fixed: "left", width: "180px" },
|
|
268
|
+
{ name: "campaign", title: "Campaign", width: "320px" },
|
|
269
|
+
{ name: "revenue", title: "Revenue", fixed: "right", fixedOrder: 1, width: "130px" }
|
|
270
|
+
];
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The same metadata works on `VuetableColumn`. Generated headers, grouped headers,
|
|
274
|
+
custom subheaders and totals can share pinning styles through the public slot
|
|
275
|
+
helpers. See the [fixed columns guide](https://github.com/Artles777/vuetable-next/blob/main/docs/fixed-columns.md) for ordering,
|
|
276
|
+
custom rows, theme variables and viewport limits, then try the
|
|
277
|
+
[scrolling playground](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#pinned-columns-playground).
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
224
281
|
## Documentation and migration
|
|
225
282
|
|
|
226
283
|
### Familiar Vuetable-2 documentation
|
|
@@ -275,11 +332,13 @@ The generic `Vuetable` remains fully dynamic and warning-free for arbitrary
|
|
|
275
332
|
prefixes/custom events. Vue 2 users keep the generic component:
|
|
276
333
|
importing the factory is safe, but calling it throws a Vue-3-only error.
|
|
277
334
|
|
|
278
|
-
For sorting state, inspect the live table ref’s `order`.
|
|
279
|
-
detaches the table’s local order and leaves the owner’s
|
|
280
|
-
unchanged
|
|
281
|
-
|
|
282
|
-
the table
|
|
335
|
+
For sorting state, inspect the live table ref’s `sortOrder` or `order`.
|
|
336
|
+
`clearSortOrder()` detaches the table’s local order and leaves the owner’s input
|
|
337
|
+
array unchanged. For legacy compatibility, when the parent explicitly supplies
|
|
338
|
+
`sortOrder`, its next update restores that input; replacing or extending the
|
|
339
|
+
input array also resynchronizes the table. Without a supplied `sortOrder`, local
|
|
340
|
+
sorting remains local. This behavior applies to Vue 2.6, Vue 2.7 and Vue 3 without
|
|
341
|
+
prop-mutation warnings.
|
|
283
342
|
|
|
284
343
|
### Moving an existing table
|
|
285
344
|
|
|
@@ -306,6 +365,355 @@ Built-in field components `VuetableFieldCheckbox`, `VuetableFieldHandle` and
|
|
|
306
365
|
`VuetableFieldSequence`, plus `VuetableColGutter`, are also named exports.
|
|
307
366
|
Internal `.vue` source paths are not public package entry points.
|
|
308
367
|
|
|
368
|
+
### Semantic UI and Vuetify styles
|
|
369
|
+
|
|
370
|
+
The built-in class defaults target Semantic UI. Include your Semantic UI theme
|
|
371
|
+
and import the library stylesheet once:
|
|
372
|
+
|
|
373
|
+
```js
|
|
374
|
+
import "vuetable-next/style.css";
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Vuetify 2 uses generic `blue` and `grey` utility classes that can otherwise
|
|
378
|
+
paint the table and sorting/drag icons with solid backgrounds
|
|
379
|
+
([upstream vuetable-2 #691](https://github.com/ratiw/vuetable-2/issues/691)).
|
|
380
|
+
Inside Vuetify's `.v-application` container, the library protects its built-in
|
|
381
|
+
defaults: the table stays white with the standard Semantic UI blue top border,
|
|
382
|
+
and the icons keep transparent backgrounds. This also covers the separate
|
|
383
|
+
header/body tables used by fixed headers. Outside Vuetify, the existing theme
|
|
384
|
+
classes and styling are unchanged.
|
|
385
|
+
|
|
386
|
+
Explicit `css` entries remain application-owned and are not rewritten. For a
|
|
387
|
+
custom theme, supply its table and icon classes through the existing `css` prop:
|
|
388
|
+
|
|
389
|
+
```vue
|
|
390
|
+
<Vuetable
|
|
391
|
+
:fields="fields"
|
|
392
|
+
:css="{ tableClass: 'my-table', sortableIcon: 'my-sort-icon' }"
|
|
393
|
+
/>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
An explicitly supplied `tableClass` containing `blue` still opts into that
|
|
397
|
+
class's framework styles; remove conflicting utilities from your custom theme
|
|
398
|
+
or resolve their cascade in application CSS. The compatibility correction is
|
|
399
|
+
not a replacement for a full Vuetify table theme.
|
|
400
|
+
|
|
401
|
+
### Overlapping API requests
|
|
402
|
+
|
|
403
|
+
API tables apply results from the **most recently started load**, not whichever
|
|
404
|
+
response happens to arrive last. This applies to Vue 2.6, Vue 2.7 and Vue 3,
|
|
405
|
+
including `createVuetable()` and custom `http-fetch` transports.
|
|
406
|
+
|
|
407
|
+
For example, searching `Ju` and then `Junaid` can produce two overlapping
|
|
408
|
+
requests. If the `Junaid` response is empty, a slower `Ju` response must not bring
|
|
409
|
+
the previous rows back. This fixes the request-ordering scenario reported in
|
|
410
|
+
[upstream vuetable-2 #618](https://github.com/ratiw/vuetable-2/issues/618).
|
|
411
|
+
|
|
412
|
+
```js
|
|
413
|
+
methods: {
|
|
414
|
+
async searchChanged(value) {
|
|
415
|
+
this.filters.search = value
|
|
416
|
+
await this.$nextTick()
|
|
417
|
+
await this.$refs.table.refresh()
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Bind `filters` with `:append-params="filters"`. `refresh()` resets to `first-page`;
|
|
423
|
+
`reload()` keeps the current page. No debounce or cancellation setup is required
|
|
424
|
+
for correct response ordering. Debouncing remains an optional application-level
|
|
425
|
+
way to reduce network traffic.
|
|
426
|
+
|
|
427
|
+
- Obsolete responses do not replace rows or pagination, invoke the response
|
|
428
|
+
transform/custom completion callbacks, or emit new success/error/completion
|
|
429
|
+
events. Already-emitted events are not undone.
|
|
430
|
+
- Starting another load inside a loading/completion handler also supersedes the
|
|
431
|
+
older operation. Its remaining work and queued pagination/loaded events are
|
|
432
|
+
skipped; an old response cannot finish a newer load's spinner.
|
|
433
|
+
- Unmounting, `resetData()` or an explicit non-null `setData()` invalidates pending
|
|
434
|
+
responses. Overlapping asynchronous data-manager results follow the same rule.
|
|
435
|
+
- Each request receives its own top-level options and query parameters; POST
|
|
436
|
+
requests do not remove `params` from the supplied `http-options` object.
|
|
437
|
+
- Requests are **not automatically cancelled** on the server. `instanceFetch`
|
|
438
|
+
remains the raw transport promise; it can still settle even when the table
|
|
439
|
+
ignores that request's result. The promise returned by `reload()` / `loadData()`
|
|
440
|
+
still waits for its own request. Arbitrary async side effects inside your own
|
|
441
|
+
callbacks remain your application's responsibility.
|
|
442
|
+
|
|
443
|
+
This is response-order protection, not server-side filtering: the API must still
|
|
444
|
+
return the correct records and pagination for the requested filter.
|
|
445
|
+
|
|
446
|
+
### Initial page in API mode
|
|
447
|
+
|
|
448
|
+
Use a numeric binding to start the first API request on another page:
|
|
449
|
+
|
|
450
|
+
```vue
|
|
451
|
+
<Vuetable
|
|
452
|
+
ref="table"
|
|
453
|
+
api-url="/api/articles"
|
|
454
|
+
:fields="fields"
|
|
455
|
+
:initial-page="3"
|
|
456
|
+
/>
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
The first request sends `page=3`, not an initial page-one request followed by
|
|
460
|
+
page three. This works with GET, POST, custom `queryParams` mappings/callbacks,
|
|
461
|
+
and all three supported Vue runtimes. Your server must honor the page parameter
|
|
462
|
+
and return matching rows and pagination metadata.
|
|
463
|
+
|
|
464
|
+
- `initial-page` defaults to `1` and initializes the table when it is created;
|
|
465
|
+
it is not a controlled current-page prop. Changing it later does not navigate.
|
|
466
|
+
- `reload()` loads the current page. With `:load-on-start="false"`, calling
|
|
467
|
+
`reload()` for the first time still uses `initial-page`.
|
|
468
|
+
- `refresh()` intentionally resets to `first-page` (default `1`). Sorting and a
|
|
469
|
+
changed `api-url` with `reactive-api-url` enabled also reset the page.
|
|
470
|
+
- If a saved page number or URL arrives asynchronously, use `v-if` to create the
|
|
471
|
+
table only after both are ready. Otherwise an initial value of `1` can already
|
|
472
|
+
have been read, or a later URL change can trigger a reset.
|
|
473
|
+
- A `queryParams` callback owns the generated parameters; forward its `page`
|
|
474
|
+
argument. Avoid a conflicting page key in `append-params`, whose values
|
|
475
|
+
override generated query parameters.
|
|
476
|
+
|
|
477
|
+
[Upstream vuetable-2 #727 — initial-page not working](https://github.com/ratiw/vuetable-2/issues/727)
|
|
478
|
+
reports page one being requested despite an initial page of three. This symptom
|
|
479
|
+
does **not** reproduce in this fork's current implementation. Regression tests
|
|
480
|
+
verify the first request, rendered rows and pagination event across Vue 2.6,
|
|
481
|
+
Vue 2.7 and Vue 3; no runtime behavior was changed for this issue.
|
|
482
|
+
|
|
483
|
+
#### Zero-based API pagination
|
|
484
|
+
|
|
485
|
+
For an API whose first page index is `0`, configure the table and the separate
|
|
486
|
+
pagination component consistently:
|
|
487
|
+
|
|
488
|
+
```vue
|
|
489
|
+
<Vuetable
|
|
490
|
+
ref="table"
|
|
491
|
+
api-url="/api/articles"
|
|
492
|
+
:fields="fields"
|
|
493
|
+
pagination-path="pagination"
|
|
494
|
+
:initial-page="0"
|
|
495
|
+
:first-page="0"
|
|
496
|
+
@vuetable:pagination-data="onPaginationData"
|
|
497
|
+
/>
|
|
498
|
+
<VuetablePagination
|
|
499
|
+
ref="pagination"
|
|
500
|
+
:first-page="0"
|
|
501
|
+
@vuetable-pagination:change-page="onChangePage"
|
|
502
|
+
/>
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
```js
|
|
506
|
+
onPaginationData(data) {
|
|
507
|
+
this.$refs.pagination.setPaginationData(data);
|
|
508
|
+
},
|
|
509
|
+
onChangePage(page) {
|
|
510
|
+
this.$refs.table.changePage(page);
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
The handlers belong in the application's `methods`. `initial-page` controls the
|
|
515
|
+
first request; the table's `first-page` controls reset/navigation boundaries;
|
|
516
|
+
the paginator's `first-page` controls emitted page indices. Setting only the
|
|
517
|
+
table's `first-page` does not replace its default `initial-page="1"` behavior.
|
|
518
|
+
`VuetablePaginationDropdown` accepts the same numeric `first-page` setting.
|
|
519
|
+
|
|
520
|
+
API pagination metadata must use the same zero-based convention: for three
|
|
521
|
+
pages, return `current_page` in `0..2` and `last_page: 2`, not `3`. Visible page
|
|
522
|
+
labels remain human-readable `1`, `2`, `3`; their request indices are `0`, `1`,
|
|
523
|
+
`2`. Forward `vuetable:pagination-data` explicitly; a separate paginator is not
|
|
524
|
+
automatically connected to the table.
|
|
525
|
+
|
|
526
|
+
[Upstream #627](https://github.com/ratiw/vuetable-2/issues/627) reports confusion
|
|
527
|
+
about this configuration. The configured API flow works in the current package;
|
|
528
|
+
the behavior is covered by regression tests rather than a runtime correction.
|
|
529
|
+
|
|
530
|
+
### Checkbox events and row data
|
|
531
|
+
|
|
532
|
+
The built-in `__checkbox` field emits `vuetable:checkbox-toggled` when an
|
|
533
|
+
individual row is checked or unchecked. The handler receives three arguments:
|
|
534
|
+
|
|
535
|
+
```js
|
|
536
|
+
function onCheckboxToggled(checked, fieldName, rowData) {
|
|
537
|
+
console.log(checked, fieldName, rowData.id);
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
```vue
|
|
542
|
+
<Vuetable
|
|
543
|
+
:fields="['__checkbox', 'name']"
|
|
544
|
+
:data="rows"
|
|
545
|
+
:api-mode="false"
|
|
546
|
+
@vuetable:checkbox-toggled="onCheckboxToggled"
|
|
547
|
+
/>
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
The same signature applies on Vue 2.6, Vue 2.7 and Vue 3:
|
|
551
|
+
|
|
552
|
+
- `checked` is the new boolean state.
|
|
553
|
+
- `fieldName` is the normalized checkbox field name, not the record or its ID.
|
|
554
|
+
- `rowData` is the complete current-row object, using your configured `track-by`
|
|
555
|
+
identifier. It is supplied on both selection and deselection, after the
|
|
556
|
+
table's selected IDs have been updated.
|
|
557
|
+
|
|
558
|
+
Existing handlers taking only `(checked, fieldName)` can continue to ignore the
|
|
559
|
+
third argument. Do not treat the first argument (`$event` in an inline listener)
|
|
560
|
+
as the row: it is the boolean. A custom `event-prefix` changes the event name,
|
|
561
|
+
not the argument order.
|
|
562
|
+
|
|
563
|
+
`vuetable:checkbox-toggled-all` remains a separate bulk event with only the
|
|
564
|
+
`checked` boolean; there is no single row associated with select-all.
|
|
565
|
+
|
|
566
|
+
This corrects the missing row payload described in
|
|
567
|
+
[upstream vuetable-2 #716](https://github.com/ratiw/vuetable-2/issues/716). Earlier
|
|
568
|
+
builds passed the row into the table's checkbox handler but dropped it when
|
|
569
|
+
emitting the outward event. The correction is included in [1.1.1](CHANGELOG.md#111---2026-12-02).
|
|
570
|
+
|
|
571
|
+
### Row identity and custom-field loading
|
|
572
|
+
|
|
573
|
+
**`track-by` selects the identifier; `rowKeys` is the internal render identity.**
|
|
574
|
+
`track-by` is an existing public prop naming the record property used for
|
|
575
|
+
identity. It defaults to `"id"` and is also used by row selection and expanded
|
|
576
|
+
details. The internal computed `rowKeys` derives Vue render keys from those
|
|
577
|
+
values; it is not another prop you need to supply. Neither mechanism searches
|
|
578
|
+
the API or generates a business ID for your records.
|
|
579
|
+
|
|
580
|
+
#### Can I omit track-by?
|
|
581
|
+
|
|
582
|
+
Yes, if your records already contain stable, unique `id` values. These two
|
|
583
|
+
declarations are equivalent on Vue 2.6, Vue 2.7 and Vue 3:
|
|
584
|
+
|
|
585
|
+
```vue
|
|
586
|
+
<!-- rows: [{ id: 101, name: "Ada" }, { id: 102, name: "Sam" }] -->
|
|
587
|
+
<Vuetable :fields="fields" :data="rows" :api-mode="false" />
|
|
588
|
+
<Vuetable :fields="fields" :data="rows" :api-mode="false" track-by="id" />
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
If the identifier has another name, specify it explicitly:
|
|
592
|
+
|
|
593
|
+
```vue
|
|
594
|
+
<!-- rows: [{ articleId: "article-101", title: "First article" }] -->
|
|
595
|
+
<Vuetable
|
|
596
|
+
:fields="fields"
|
|
597
|
+
:data="rows"
|
|
598
|
+
:api-mode="false"
|
|
599
|
+
track-by="articleId"
|
|
600
|
+
/>
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
The lookup is the direct property `row[trackBy]`, not a nested path. For example,
|
|
604
|
+
`track-by="article.id"` refers to a literal property named `"article.id"`; it
|
|
605
|
+
does not read `row.article.id`. Normalize nested API identifiers to a top-level
|
|
606
|
+
property when needed.
|
|
607
|
+
|
|
608
|
+
#### Can I omit the identifier itself?
|
|
609
|
+
|
|
610
|
+
Ordinary cells can still render without IDs, but that is not equivalent to
|
|
611
|
+
having reliable record identity. Give every record a stable, unique identifier:
|
|
612
|
+
it must be unique across pages, not a row number starting again on each page.
|
|
613
|
+
Use string or finite-number IDs (`0` and the empty string are supported). Rows
|
|
614
|
+
with missing, unsupported or duplicated IDs retain positional fallback behavior;
|
|
615
|
+
they cannot reliably preserve record-specific component state across pages.
|
|
616
|
+
Selection and expanded details also need unique IDs; positional render fallback
|
|
617
|
+
does not provide them. Do not generate a fresh random ID on every refresh or use
|
|
618
|
+
the array index as a substitute for a persistent record ID.
|
|
619
|
+
|
|
620
|
+
#### Why not just use the row index?
|
|
621
|
+
|
|
622
|
+
Vue uses keys to decide which rendered component belongs to which item; see
|
|
623
|
+
[maintaining state with key](https://vuejs.org/guide/essentials/list.html#maintaining-state-with-key).
|
|
624
|
+
An index identifies a position, not a record: row zero on page two is usually a
|
|
625
|
+
different record from row zero on page one. Reusing the positional component can
|
|
626
|
+
therefore reuse its old local state as well.
|
|
627
|
+
|
|
628
|
+
The internal key calculation separates numeric and string IDs, keeps fallback
|
|
629
|
+
keys separate from real IDs, and handles every duplicate consistently. It uses
|
|
630
|
+
two linear passes, cached in a computed value. Replacing it with
|
|
631
|
+
`row[trackBy] || index` would lose valid `0`/empty-string IDs and reintroduce key
|
|
632
|
+
collisions; the extra handling is deliberate, not extra configuration for users.
|
|
633
|
+
|
|
634
|
+
#### Pagination fix: upstream issue #737
|
|
635
|
+
|
|
636
|
+
The symptom reported in
|
|
637
|
+
[vuetable-2 #737 — calling api in component field error with pagination](https://github.com/ratiw/vuetable-2/issues/737)
|
|
638
|
+
was that a custom field fetching data in `mounted` kept showing the first page's
|
|
639
|
+
result after moving to the second page. We reproduced the same symptom in this
|
|
640
|
+
fork and corrected its positional row keys. This fix is recorded under
|
|
641
|
+
[1.1.1](CHANGELOG.md#111---2026-12-02); it does not change the upstream repository.
|
|
642
|
+
|
|
643
|
+
Stateful cells follow their record when rows reorder. Changing pages to different
|
|
644
|
+
record IDs creates new cell instances, so a custom field that loads data in
|
|
645
|
+
`mounted` loads it for the new record instead of retaining the previous page's
|
|
646
|
+
result. Refreshing the same ID preserves its component state.
|
|
647
|
+
Expanded details also receive record-specific keys so they cannot display another
|
|
648
|
+
record's cached content. Vue 2 may recreate expanded detail components when rows
|
|
649
|
+
reorder; do not rely on their local state surviving a reorder.
|
|
650
|
+
|
|
651
|
+
If the loaded data also depends on a property that can change **without changing
|
|
652
|
+
the record ID**, watch that property in your custom component and reload there.
|
|
653
|
+
`mounted` runs once per component instance, not on every data refresh. Cancel or
|
|
654
|
+
ignore stale asynchronous requests when their component is unmounted or their
|
|
655
|
+
input changes.
|
|
656
|
+
|
|
657
|
+
### Row order and drag handles
|
|
658
|
+
|
|
659
|
+
**Programmatic row reordering is supported; built-in drag-and-drop is not.**
|
|
660
|
+
In local data mode, the table displays rows in the order supplied through `data`.
|
|
661
|
+
Replace that array with a reordered copy to move records. Use unique, stable
|
|
662
|
+
`track-by` values, not array positions, so selection and record identity keep
|
|
663
|
+
following the same records.
|
|
664
|
+
|
|
665
|
+
```vue
|
|
666
|
+
<template>
|
|
667
|
+
<div>
|
|
668
|
+
<button type="button" @click="moveRow(0, 1)">Move first row down</button>
|
|
669
|
+
<Vuetable :fields="fields" :data="rows" :api-mode="false" track-by="id" />
|
|
670
|
+
</div>
|
|
671
|
+
</template>
|
|
672
|
+
|
|
673
|
+
<script>
|
|
674
|
+
import Vuetable from "vuetable-next"
|
|
675
|
+
|
|
676
|
+
export default {
|
|
677
|
+
components: { Vuetable },
|
|
678
|
+
data() {
|
|
679
|
+
return {
|
|
680
|
+
fields: ["name"],
|
|
681
|
+
rows: [{ id: 1, name: "Alice" }, { id: 2, name: "Bob" }]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
methods: {
|
|
685
|
+
moveRow(fromIndex, toIndex) {
|
|
686
|
+
if (!Number.isInteger(fromIndex) || !Number.isInteger(toIndex) ||
|
|
687
|
+
fromIndex < 0 || toIndex < 0 ||
|
|
688
|
+
fromIndex >= this.rows.length || toIndex >= this.rows.length) return
|
|
689
|
+
const reordered = [...this.rows]
|
|
690
|
+
const [record] = reordered.splice(fromIndex, 1)
|
|
691
|
+
reordered.splice(toIndex, 0, record)
|
|
692
|
+
this.rows = reordered
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
</script>
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
This Options API example works on Vue 2.6, Vue 2.7 and Vue 3 with the appropriate
|
|
700
|
+
[runtime bootstrap](#quick-start). Vue 3 `createVuetable()` tables use the same
|
|
701
|
+
data-order behavior. Expanded detail components have the Vue 2 lifecycle
|
|
702
|
+
limitation described in [row identity](#row-identity-and-custom-field-loading).
|
|
703
|
+
|
|
704
|
+
The legacy `__handle` field renders a handle icon with the `.handle-icon` class.
|
|
705
|
+
It does **not** initialize SortableJS, attach drag listeners, update the data array
|
|
706
|
+
or save a new order. The question in
|
|
707
|
+
[upstream vuetable-2 #612](https://github.com/ratiw/vuetable-2/issues/612) concerns
|
|
708
|
+
this distinction. External drag integrations must synchronize application data,
|
|
709
|
+
not only move DOM elements, and must account for expanded detail and empty rows.
|
|
710
|
+
No ready-made SortableJS adapter is shipped or documented as supported.
|
|
711
|
+
|
|
712
|
+
In API mode the server controls returned order. Persisting a move, handling
|
|
713
|
+
pagination/filtering/sorting conflicts and retaining that order after a reload
|
|
714
|
+
are application/server responsibilities. An opt-in drag-and-drop feature is
|
|
715
|
+
planned for a future feature release, not included in the current bugfix release.
|
|
716
|
+
|
|
309
717
|
### Mixins or composables?
|
|
310
718
|
|
|
311
719
|
Keep legacy mixins for existing Options API components, or choose a composable
|
|
@@ -327,7 +735,7 @@ import {
|
|
|
327
735
|
} from "vuetable-next";
|
|
328
736
|
```
|
|
329
737
|
|
|
330
|
-
See [Mixins and composables](docs/mixins-and-composables.md) for paired component
|
|
738
|
+
See [Mixins and composables](https://github.com/Artles777/vuetable-next/blob/main/docs/mixins-and-composables.md) for paired component
|
|
331
739
|
examples, props, event wiring, pagination data, and complete Vue 2.6 / Vue 2.7 /
|
|
332
740
|
Vue 3 startup examples. Vue 2.6 registers `@vue/composition-api` once; Vue 2.7 and
|
|
333
741
|
Vue 3 do not need that plugin. Existing mixins remain public — no forced migration.
|
|
@@ -348,7 +756,9 @@ declarations are portable; `/vue3` exposes the richer generated Vue 3 types.
|
|
|
348
756
|
Portable composable refs support `.value`, reactive inputs and template usage.
|
|
349
757
|
For native Vue 3 branded `Ref`/`ComputedRef` types or direct-ref `watch()`
|
|
350
758
|
inference, import from `/vue3`; with the root entry, watch a getter instead.
|
|
351
|
-
See the [typing examples](docs/mixins-and-composables.md#typescript-ref-interop).
|
|
759
|
+
See the [typing examples](https://github.com/Artles777/vuetable-next/blob/main/docs/mixins-and-composables.md#typescript-ref-interop).
|
|
760
|
+
|
|
761
|
+
---
|
|
352
762
|
|
|
353
763
|
## Live demos
|
|
354
764
|
|
|
@@ -387,10 +797,37 @@ For source-level Vue 3 development, `npm run dev` starts the Vite demo. The lega
|
|
|
387
797
|
`dev:2` source demo is not the cross-version compatibility gate; use the packed
|
|
388
798
|
demo and consumer matrix for Vue 2 verification.
|
|
389
799
|
|
|
800
|
+
---
|
|
801
|
+
|
|
802
|
+
## Screenshots
|
|
803
|
+
|
|
804
|
+
### Vue 3 · selection and expandable details
|
|
805
|
+
|
|
806
|
+

|
|
807
|
+
|
|
808
|
+
<details>
|
|
809
|
+
<summary><strong>See the same component on Vue 2.6 and Vue 2.7</strong></summary>
|
|
810
|
+
|
|
811
|
+
#### Vue 2.6 + Composition API
|
|
812
|
+
|
|
813
|
+

|
|
814
|
+
|
|
815
|
+
#### Vue 2.7 · native Composition API
|
|
816
|
+
|
|
817
|
+

|
|
818
|
+
|
|
819
|
+
</details>
|
|
820
|
+
|
|
821
|
+
These are real browser captures of the **same packed library** in three isolated
|
|
822
|
+
Vue applications. The surrounding dashboard and green theme are showcase styles,
|
|
823
|
+
not a theme automatically installed by the library. No live customer data is used.
|
|
824
|
+
|
|
825
|
+
---
|
|
826
|
+
|
|
390
827
|
## Development and checks
|
|
391
828
|
|
|
392
829
|
Use Node.js 22 for the documented development workflow. See
|
|
393
|
-
[CONTRIBUTING.md](CONTRIBUTING.md) for complete setup, fork/collaborator Git
|
|
830
|
+
[CONTRIBUTING.md](https://github.com/Artles777/vuetable-next/blob/main/CONTRIBUTING.md) for complete setup, fork/collaborator Git
|
|
394
831
|
commands, linting, regression tests, package validation, the three-runtime matrix,
|
|
395
832
|
type checks, browser verification and pull request requirements.
|
|
396
833
|
|
|
@@ -407,6 +844,19 @@ package on each supported framework. The build produces framework-specific
|
|
|
407
844
|
render artifacts from shared component sources; generated files are not edited
|
|
408
845
|
by hand.
|
|
409
846
|
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## Contributing
|
|
850
|
+
|
|
851
|
+
Bug reports, focused fixes and documentation improvements are welcome. Both fork
|
|
852
|
+
contributors and repository collaborators should use feature branches and open
|
|
853
|
+
pull requests against **`main`**.
|
|
854
|
+
|
|
855
|
+
Read the [contribution guide](https://github.com/Artles777/vuetable-next/blob/main/CONTRIBUTING.md), include a reproduction and actual
|
|
856
|
+
validation results, and use the [pull request template](https://github.com/Artles777/vuetable-next/blob/main/.github/pull_request_template.md).
|
|
857
|
+
|
|
858
|
+
---
|
|
859
|
+
|
|
410
860
|
## Limitations and security
|
|
411
861
|
|
|
412
862
|
- Vue 2.6 needs Composition API; Vue 2.7 and Vue 3 do not.
|
|
@@ -415,18 +865,11 @@ by hand.
|
|
|
415
865
|
- Vue 2 has a known low-severity framework advisory, [GHSA-5j4c-8p2g-v4jx](https://github.com/advisories/GHSA-5j4c-8p2g-v4jx). Compatibility support does not make an end-of-life runtime security-supported.
|
|
416
866
|
- Consumer verification is not a blanket guarantee for every upstream example or application integration. Test your own custom renderers, API contracts and migration scenarios.
|
|
417
867
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
Bug reports, focused fixes and documentation improvements are welcome. Both fork
|
|
421
|
-
contributors and repository collaborators should use feature branches and open
|
|
422
|
-
pull requests against **`main`**.
|
|
423
|
-
|
|
424
|
-
Read the [contribution guide](CONTRIBUTING.md), include a reproduction and actual
|
|
425
|
-
validation results, and use the [pull request template](.github/pull_request_template.md).
|
|
868
|
+
---
|
|
426
869
|
|
|
427
870
|
## License and credits
|
|
428
871
|
|
|
429
|
-
[MIT](LICENSE) · Maintained by Artem Alesenko.
|
|
872
|
+
[MIT](https://github.com/Artles777/vuetable-next/blob/main/LICENSE) · Maintained by Artem Alesenko.
|
|
430
873
|
|
|
431
874
|
Based on [Vuetable-2](https://github.com/ratiw/vuetable-2). Thanks to its original
|
|
432
875
|
authors and contributors for the table API and documentation that this fork builds on.
|