vuetable-next 1.1.0 → 1.2.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/README.md +311 -270
- package/dist/chunks/vue2/createVuetable-GewoatYE.cjs +11 -0
- package/dist/chunks/vue2/createVuetable-zwzXUm5x.js +1511 -0
- package/dist/chunks/vue3/createVuetable-CE_PTu-W.cjs +5 -0
- package/dist/chunks/vue3/createVuetable-wZayTXed.js +1733 -0
- package/dist/portable/components/useVuetablePagination.d.ts +1 -0
- package/dist/portable/components/useVuetablePaginationInfo.d.ts +1 -0
- package/dist/public.d.ts +14 -1
- package/dist/structure.css +30 -0
- package/dist/style.css +77 -2
- package/dist/table.d.ts +13 -0
- package/dist/themes/semantic.css +47 -0
- package/dist/themes/tailwind.cjs +55 -0
- package/dist/themes/tailwind.js +35 -0
- package/dist/types/components/Vuetable.vue.d.ts +20 -53
- package/dist/types/components/VuetableContext.d.ts +1 -0
- package/dist/types/components/VuetableDetailHost.vue.d.ts +1 -1
- package/dist/types/components/VuetablePagination.vue.d.ts +13 -16
- package/dist/types/components/VuetablePaginationDropdown.vue.d.ts +13 -16
- package/dist/types/components/VuetablePaginationInfo.vue.d.ts +13 -1
- package/dist/types/components/VuetablePaginationInfoMixin.vue.d.ts +10 -0
- package/dist/types/components/VuetablePaginationMixin.vue.d.ts +10 -0
- package/dist/types/components/fetchAxios.d.ts +2 -0
- package/dist/types/components/resolveVuetableCss.d.ts +2 -0
- package/dist/types/components/useVuetableConfig.d.ts +15 -0
- package/dist/types/components/useVuetableFixedColumns.d.ts +1 -0
- package/dist/types/components/useVuetablePagination.d.ts +1 -0
- package/dist/types/components/useVuetablePaginationInfo.d.ts +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/table.d.ts +10 -0
- package/dist/types/themes/tailwind.d.ts +35 -0
- package/dist/vue2-table.cjs +1 -0
- package/dist/vue2-table.js +21 -0
- package/dist/vue2.cjs +15 -22
- package/dist/vue2.js +381 -1737
- package/dist/vue3-table.cjs +1 -0
- package/dist/vue3-table.js +21 -0
- package/dist/vue3.cjs +1 -6
- package/dist/vue3.js +454 -1995
- package/package.json +23 -4
- package/style.css +77 -2
- package/dist/vue2.cjs.map +0 -1
- package/dist/vue2.js.map +0 -1
- package/dist/vue3.cjs.map +0 -1
- package/dist/vue3.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,52 +7,51 @@
|
|
|
7
7
|
Data tables, custom fields, selection, pagination and expandable rows — across Vue generations.
|
|
8
8
|
|
|
9
9
|
[](#compatibility)
|
|
10
|
-
[](https://vuetable.com/guide/)
|
|
11
10
|
[](https://github.com/Artles777/vuetable-next/blob/main/LICENSE)
|
|
12
11
|
|
|
12
|
+
**[Documentation on GitHub](https://github.com/Artles777/vuetable-next/blob/main/docs/README.md)** ·
|
|
13
|
+
[Installation guide](https://github.com/Artles777/vuetable-next/blob/main/docs/getting-started.md) ·
|
|
14
|
+
[Table basics](https://github.com/Artles777/vuetable-next/blob/main/docs/table-basics.md) ·
|
|
15
|
+
[Changelog](https://github.com/Artles777/vuetable-next/blob/main/CHANGELOG.md)
|
|
16
|
+
|
|
17
|
+
Documentation describes the current source checkout; npm availability follows [changelog](https://github.com/Artles777/vuetable-next/blob/main/CHANGELOG.md).
|
|
18
|
+
|
|
13
19
|
## Contents
|
|
14
20
|
|
|
15
21
|
- [Why Vuetable Next?](#why-vuetable-next)
|
|
16
22
|
- [Quick start](#quick-start): [install](#install) · [Vue 3](#vue-3) · [Vue 2.6](#vue-26) · [Vue 2.7](#vue-27)
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [Development and checks](#development-and-checks) · [contributing](#contributing)
|
|
22
|
-
- [Limitations and security](#limitations-and-security) · [license and credits](#license-and-credits)
|
|
23
|
-
|
|
24
|
-
**First time here?** Start with your Vue version in [Quick start](#quick-start).
|
|
25
|
-
For task-oriented guides and complete API examples, open the [documentation index](https://github.com/Artles777/vuetable-next/blob/main/docs/README.md).
|
|
26
|
-
For release history, see the [changelog](https://github.com/Artles777/vuetable-next/blob/main/CHANGELOG.md).
|
|
27
|
-
|
|
28
|
-
---
|
|
23
|
+
- [Styling](#styling) · [Data and HTTP](#data-and-http) · [Axios usage](#axios-usage)
|
|
24
|
+
- [Table features](#table-features): [columns](#declarative-columns) · [groups and extra rows](#grouped-headers-and-extra-rows) · [fixed columns](#fixed-columns) · [selection and pagination](#custom-fields-selection-and-pagination)
|
|
25
|
+
- [TypeScript](#typescript) · [Demos](#demos) · [Development](#development)
|
|
26
|
+
- [Compatibility](#compatibility) · [Limitations and security](#limitations-and-security) · [License and credits](#license-and-credits)
|
|
29
27
|
|
|
30
28
|
## Why Vuetable Next?
|
|
31
29
|
|
|
32
|
-
`vuetable-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
A `vuetable-2` fork built around `vue-demi`: one familiar table API with separately
|
|
31
|
+
compiled Vue 2 and Vue 3 builds, local/global registration, ESM and CommonJS.
|
|
32
|
+
Keep familiar fields, selection, events, detail rows, pagination and methods;
|
|
33
|
+
choose opt-in features without rewriting existing tables. Vue, `vue-demi` and
|
|
34
|
+
Axios stay external dependencies rather than private copies embedded in the library.
|
|
35
|
+
TypeScript declarations need no separate `@types` package.
|
|
36
|
+
|
|
37
|
+
- **Local or remote rows:** field definitions, sorting state, pagination and API requests.
|
|
38
|
+
- **Custom presentation:** cell/header templates, expandable details, groups, subheaders and totals.
|
|
39
|
+
- **Pinned columns:** left/right edges, automatic or explicit order, and dynamic visibility.
|
|
40
|
+
- **Your styling:** existing Semantic UI classes, opt-in unstyled mode or a Tailwind preset.
|
|
41
|
+
- **Your Vue version:** Vue 2.6 with Composition API, Vue 2.7 or Vue 3; mixins and composables remain available.
|
|
42
|
+
- **Your bundle:** compatible root imports or explicit framework/component-only entries, with deferred default Axios loading.
|
|
43
|
+
|
|
44
|
+
Read the [documentation home](https://github.com/Artles777/vuetable-next/blob/main/docs/README.md)
|
|
45
|
+
for setup, styling, data and table APIs. All guides live in this repository;
|
|
46
|
+
no separate documentation website is required. Start with
|
|
47
|
+
[table basics](https://github.com/Artles777/vuetable-next/blob/main/docs/table-basics.md)
|
|
48
|
+
or the [Vuetable-2 migration guide](https://github.com/Artles777/vuetable-next/blob/main/docs/migration.md).
|
|
50
49
|
|
|
51
50
|
## Quick start
|
|
52
51
|
|
|
53
52
|
### Install
|
|
54
53
|
|
|
55
|
-
Install
|
|
54
|
+
Install from npm:
|
|
56
55
|
|
|
57
56
|
```sh
|
|
58
57
|
npm install vuetable-next@latest
|
|
@@ -67,23 +66,6 @@ For Vue 2.6, also install the Composition API plugin:
|
|
|
67
66
|
npm install @vue/composition-api
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
**Developing or testing a local revision?** From a checkout of this repository:
|
|
71
|
-
|
|
72
|
-
```sh
|
|
73
|
-
npm install --legacy-peer-deps --package-lock=false
|
|
74
|
-
npm pack
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Then install the generated archive from your application directory, replacing
|
|
78
|
-
`VERSION` with the version in the filename printed by `npm pack`:
|
|
79
|
-
|
|
80
|
-
```sh
|
|
81
|
-
npm install /absolute/path/to/vuetable-next/vuetable-next-VERSION.tgz
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
`npm pack` runs the dual build and package checks through `prepack`. The archive
|
|
85
|
-
uses the version currently declared in `package.json`; it does not publish anything.
|
|
86
|
-
|
|
87
69
|
### Vue 3
|
|
88
70
|
|
|
89
71
|
Import the table and stylesheet, then pass your fields and rows. This example
|
|
@@ -192,40 +174,92 @@ new Vue({ render: createElement => createElement(App) }).$mount("#app");
|
|
|
192
174
|
For global registration on either Vue 2 version, import `Vuetable` in your
|
|
193
175
|
entry point and call `Vue.use(Vuetable)` before creating the root instance.
|
|
194
176
|
|
|
195
|
-
|
|
177
|
+
## Styling
|
|
196
178
|
|
|
197
|
-
|
|
179
|
+
Choose the appearance independently of how you define columns or load data:
|
|
198
180
|
|
|
199
|
-
|
|
|
200
|
-
| --- | --- | --- |
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
181
|
+
| Mode | Setup | Who owns the appearance? |
|
|
182
|
+
| --- | --- | --- |
|
|
183
|
+
| Existing/default theme | Semantic UI CSS + `vuetable-next/style.css` | Your existing theme, with the familiar default classes |
|
|
184
|
+
| Your own CSS | `unstyled` + optional `structure.css` | Your application; no library decorative defaults |
|
|
185
|
+
| Tailwind | `unstyled`, `tailwind.table` and generated utility CSS | Your Tailwind configuration and optional preset |
|
|
186
|
+
|
|
187
|
+
The default class names target Semantic UI. Include your Semantic UI theme and
|
|
188
|
+
import `vuetable-next/style.css` once, as in the quick starts. Existing default
|
|
189
|
+
themes and imports remain supported. For framework CSS interaction, see
|
|
190
|
+
[default theme and Vuetify](https://github.com/Artles777/vuetable-next/blob/main/docs/theming.md#default-theme-and-vuetify).
|
|
204
191
|
|
|
205
|
-
|
|
206
|
-
`vue-demi` selects the correct build for the installed runtime; no application
|
|
207
|
-
alias or manual dependency patch is needed for normal root imports.
|
|
192
|
+
For application-owned CSS, opt into `unstyled`; add the optional Tailwind preset:
|
|
208
193
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
194
|
+
```vue
|
|
195
|
+
<script setup>
|
|
196
|
+
import Vuetable from "vuetable-next/vue3/table";
|
|
197
|
+
import { tailwind } from "vuetable-next/themes/tailwind";
|
|
198
|
+
import "vuetable-next/structure.css";
|
|
199
|
+
const fields = ["name"];
|
|
200
|
+
const rows = [{ id: 1, name: "Campaign" }];
|
|
201
|
+
</script>
|
|
214
202
|
|
|
215
|
-
|
|
203
|
+
<template>
|
|
204
|
+
<Vuetable unstyled :css="tailwind.table" :api-mode="false" :fields="fields" :data="rows" />
|
|
205
|
+
</template>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Use `/vue2/table` for Vue 2.6 / 2.7; omit the preset for your own CSS.
|
|
209
|
+
**The Tailwind preset supplies class names, not generated CSS.** Configure your
|
|
210
|
+
Tailwind build to scan it and import your application's generated stylesheet;
|
|
211
|
+
see the [Tailwind setup](https://github.com/Artles777/vuetable-next/blob/main/docs/theming.md#tailwind-css).
|
|
212
|
+
Dark mode follows your application's Tailwind variant and theme switch.
|
|
213
|
+
An ordinary unstyled table can omit library CSS; `structure.css` is needed for
|
|
214
|
+
library-managed scrolling, fixed headers and pinned columns.
|
|
215
|
+
Global installation accepts `{ unstyled: true }` with per-table overrides.
|
|
216
|
+
See [theming](https://github.com/Artles777/vuetable-next/blob/main/docs/theming.md) for utilities, pagination and pinned backgrounds,
|
|
217
|
+
and [bundle size](https://github.com/Artles777/vuetable-next/blob/main/docs/bundle-size.md) for optional lean imports.
|
|
218
|
+
|
|
219
|
+
## Data and HTTP
|
|
220
|
+
|
|
221
|
+
Use `:api-mode="false"` with `:data="rows"` for local data (see quick start).
|
|
222
|
+
For remote rows, enable API mode (the default) and supply your endpoint:
|
|
223
|
+
|
|
224
|
+
```vue
|
|
225
|
+
<Vuetable api-url="/api/articles" :fields="fields" />
|
|
226
|
+
<Vuetable api-url="/api/articles/search" http-method="post" :fields="fields" />
|
|
227
|
+
```
|
|
216
228
|
|
|
217
|
-
|
|
229
|
+
### Axios usage
|
|
218
230
|
|
|
219
|
-
The
|
|
220
|
-
|
|
231
|
+
The default HTTP transport automatically lazy-imports Axios on the first API
|
|
232
|
+
request: **no manual Axios import is needed**. npm installs Axios normally as a
|
|
233
|
+
dependency. Local data mode and a custom `http-fetch` do not load default Axios.
|
|
234
|
+
With API mode configured, `load-on-start` defaults to `true`, so that first
|
|
235
|
+
request normally starts on mount; `:load-on-start="false"` defers it until
|
|
236
|
+
`reload()` or another API-loading trigger.
|
|
237
|
+
Code splitting requires an explicit ESM entry and a suitable bundler; compatible
|
|
238
|
+
root/CommonJS packaging may bundle Axios eagerly.
|
|
221
239
|
|
|
222
|
-
|
|
240
|
+
GET sends generated parameters through Axios `params`; POST sends them as the
|
|
241
|
+
body with the remaining HTTP options. Responses (including custom transports)
|
|
242
|
+
are Axios-shaped: `response.data` is the body, optionally transformed, with rows
|
|
243
|
+
at `data` and pagination at `links.pagination` by default.
|
|
244
|
+
See [data and requests](https://github.com/Artles777/vuetable-next/blob/main/docs/data-and-requests.md) for response examples,
|
|
245
|
+
custom adapters, latest-started request ordering, initial/zero-based pages,
|
|
246
|
+
checkbox payloads, record identity and row ordering.
|
|
223
247
|
|
|
224
|
-
|
|
225
|
-
[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).
|
|
248
|
+
## Table features
|
|
226
249
|
|
|
227
|
-
|
|
228
|
-
|
|
250
|
+
Existing `fields` tables remain the default; these additional APIs are opt-in.
|
|
251
|
+
|
|
252
|
+
| You want to… | Start here |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| Put column metadata and custom templates together | [Declarative columns](#declarative-columns) |
|
|
255
|
+
| Add grouped headings, subheaders, totals and separators | [Grouped headers and extra rows](#grouped-headers-and-extra-rows) |
|
|
256
|
+
| Pin columns on either side and choose their order | [Fixed columns](#fixed-columns) |
|
|
257
|
+
| Extend cells, selection, details or pagination | [Custom fields, selection and pagination](#custom-fields-selection-and-pagination) |
|
|
258
|
+
| Render from a plain TypeScript file | [Render-function examples](https://github.com/Artles777/vuetable-next/blob/main/docs/migration.md#typescript-render-functions-without-sfcs) |
|
|
259
|
+
|
|
260
|
+
### Declarative columns
|
|
261
|
+
|
|
262
|
+
Import `Vuetable, { VuetableColumn }` from `vuetable-next`:
|
|
229
263
|
|
|
230
264
|
```vue
|
|
231
265
|
<Vuetable :data="rows" :api-mode="false">
|
|
@@ -235,31 +269,22 @@ scoped templates. Import `Vuetable, { VuetableColumn }` from `vuetable-next`:
|
|
|
235
269
|
</Vuetable>
|
|
236
270
|
```
|
|
237
271
|
|
|
238
|
-
See
|
|
239
|
-
|
|
240
|
-
not full Buefy compatibility; existing `fields` tables need no migration.
|
|
241
|
-
The [shared showcase](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#declarative-columns) has interactive controls.
|
|
242
|
-
|
|
243
|
-
### Grouped headers and extra rows (opt-in)
|
|
244
|
-
|
|
245
|
-
Keep the standard sortable header and add subheaders or totals with
|
|
246
|
-
`beforeHeader`, `afterHeader`, `beforeFooter` and `afterFooter`. Enable
|
|
247
|
-
`group-by="headerName"` for field objects or `group-by="group"` for declarative
|
|
248
|
-
columns. Visible groups calculate their own spans and expose semantic boundary
|
|
249
|
-
classes when columns are hidden or reordered.
|
|
272
|
+
See [declarative columns](https://github.com/Artles777/vuetable-next/blob/main/docs/declarative-columns.md) for all runtime setups,
|
|
273
|
+
metadata, precedence and migration limits. This is additive, not full Buefy compatibility.
|
|
250
274
|
|
|
251
|
-
|
|
252
|
-
precedence, gutter alignment and migration examples. Available starting with `1.1.0`.
|
|
275
|
+
### Grouped headers and extra rows
|
|
253
276
|
|
|
254
|
-
|
|
277
|
+
Add subheaders/totals via `beforeHeader`, `afterHeader`, `beforeFooter` and
|
|
278
|
+
`afterFooter` while keeping the sortable header. Use `group-by="headerName"`
|
|
279
|
+
for object fields or `group-by="group"` for declarations. Visible groups adjust
|
|
280
|
+
spans and boundary classes when columns hide/reorder.
|
|
281
|
+
See [table layout](https://github.com/Artles777/vuetable-next/blob/main/docs/table-layout.md) for scope, precedence and gutter alignment.
|
|
255
282
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
`fixed-mode="in-place"` to keep the original column positions.
|
|
283
|
+
For a scrolling body with a fixed header, set `table-height="300px"` and load
|
|
284
|
+
`style.css` or `structure.css`. Header widths follow the visible body columns;
|
|
285
|
+
custom layout rows should use the guide's slot helpers for spans and gutters.
|
|
260
286
|
|
|
261
|
-
|
|
262
|
-
For example, with object fields:
|
|
287
|
+
### Fixed columns
|
|
263
288
|
|
|
264
289
|
```js
|
|
265
290
|
const fields = [
|
|
@@ -269,128 +294,130 @@ const fields = [
|
|
|
269
294
|
];
|
|
270
295
|
```
|
|
271
296
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
[scrolling playground](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#pinned-columns-playground).
|
|
297
|
+
Pin multiple columns on either edge. `fixedOrder` ranks from that edge; automatic
|
|
298
|
+
ranks follow activation order. `fixed-mode="in-place"` retains original positions.
|
|
299
|
+
The same metadata works on `VuetableColumn`; public slot helpers align custom rows.
|
|
300
|
+
See [fixed columns](https://github.com/Artles777/vuetable-next/blob/main/docs/fixed-columns.md) for themes and viewport limits.
|
|
277
301
|
|
|
278
|
-
|
|
302
|
+
### Custom fields, selection and pagination
|
|
279
303
|
|
|
280
|
-
|
|
304
|
+
#### Selection and identity
|
|
281
305
|
|
|
282
|
-
|
|
306
|
+
Add `"__checkbox"` to `fields` for row selection. `track-by` defaults to `id`, so
|
|
307
|
+
you can omit the prop when your rows already have stable, unique `id` values:
|
|
283
308
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
309
|
+
```vue
|
|
310
|
+
<Vuetable
|
|
311
|
+
:fields="['__checkbox', 'name']"
|
|
312
|
+
:data="rows"
|
|
313
|
+
:api-mode="false"
|
|
314
|
+
@vuetable:checkbox-toggled="onSelection"
|
|
315
|
+
/>
|
|
316
|
+
```
|
|
287
317
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
318
|
+
```js
|
|
319
|
+
function onSelection (checked, fieldName, rowData) {
|
|
320
|
+
console.log(checked, fieldName, rowData.id);
|
|
321
|
+
}
|
|
322
|
+
```
|
|
291
323
|
|
|
292
|
-
|
|
324
|
+
Use `track-by="uuid"` for another record-key field. Stable IDs keep selection,
|
|
325
|
+
detail rows and stateful custom cells associated with the record, not its array
|
|
326
|
+
position. `__handle` supplies an icon; it does not install drag-and-drop.
|
|
293
327
|
|
|
294
|
-
|
|
295
|
-
only replace event listeners, including inline callbacks. No factory, special
|
|
296
|
-
registration or application-side listener caching is required. The outer
|
|
297
|
-
component can still update to keep listeners and root attributes current.
|
|
298
|
-
Reactive rows, fields and values read by formatters continue to update normally.
|
|
299
|
-
External slots are updated conservatively so their content cannot become stale;
|
|
300
|
-
this is not a promise to skip renders when table content actually changes.
|
|
328
|
+
#### Pagination wiring
|
|
301
329
|
|
|
302
|
-
|
|
303
|
-
contract. It is not required for the standard listener-only optimization.
|
|
330
|
+
Companion pagination components are connected explicitly. A Vue 3 remote table:
|
|
304
331
|
|
|
305
|
-
```
|
|
306
|
-
|
|
332
|
+
```vue
|
|
333
|
+
<script setup>
|
|
334
|
+
import { ref } from "vue";
|
|
335
|
+
import Vuetable, { VuetablePagination } from "vuetable-next";
|
|
336
|
+
import "vuetable-next/style.css";
|
|
307
337
|
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
312
|
-
```
|
|
338
|
+
const table = ref(null);
|
|
339
|
+
const pagination = ref(null);
|
|
340
|
+
const fields = [{ name: "name", title: "Customer", sortField: "name" }];
|
|
313
341
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
The prefix is fixed for each factory component: overriding its `eventPrefix`
|
|
323
|
-
prop is unsupported and warns in development. Undeclared factory events also
|
|
324
|
-
warn in development. Create another factory for a different prefix or event set.
|
|
325
|
-
Factory results are local components, not plugins (`app.use()` is unsupported).
|
|
326
|
-
For the generic component, single-word listeners such as `onCustom` are ambiguous:
|
|
327
|
-
they fall through to the root DOM element as well as receiving component events.
|
|
328
|
-
Use the factory with `events: ["custom"]` when a listener must be component-only.
|
|
329
|
-
Explicit Vue DOM listeners such as `on:custom-event` remain DOM listeners.
|
|
330
|
-
The generic `Vuetable` remains fully dynamic and warning-free for arbitrary
|
|
331
|
-
prefixes/custom events. Vue 2 users keep the generic component:
|
|
332
|
-
importing the factory is safe, but calling it throws a Vue-3-only error.
|
|
333
|
-
|
|
334
|
-
For sorting state, inspect the live table ref’s `sortOrder` or `order`.
|
|
335
|
-
`clearSortOrder()` detaches the table’s local order and leaves the owner’s input
|
|
336
|
-
array unchanged. For legacy compatibility, when the parent explicitly supplies
|
|
337
|
-
`sortOrder`, its next update restores that input; replacing or extending the
|
|
338
|
-
input array also resynchronizes the table. Without a supplied `sortOrder`, local
|
|
339
|
-
sorting remains local. This behavior applies to Vue 2.6, Vue 2.7 and Vue 3 without
|
|
340
|
-
prop-mutation warnings.
|
|
341
|
-
|
|
342
|
-
### Moving an existing table
|
|
343
|
-
|
|
344
|
-
1. Replace the `vuetable-2` dependency with the verified `vuetable-next` release or archive.
|
|
345
|
-
2. Change root imports to `vuetable-next` and import `vuetable-next/style.css` once.
|
|
346
|
-
3. Replace imports from `vuetable-2/src/...` with the named public exports below.
|
|
347
|
-
4. Keep existing field definitions, table props and event handlers, then verify your application-specific scenarios.
|
|
348
|
-
5. When migrating the application to Vue 3, adapt its own Vue-specific syntax as needed; the package chooses its Vue 3 build automatically.
|
|
342
|
+
function onPagination (data) {
|
|
343
|
+
pagination.value?.setPaginationData(data);
|
|
344
|
+
}
|
|
345
|
+
function onPage (page) {
|
|
346
|
+
table.value?.changePage(page);
|
|
347
|
+
}
|
|
348
|
+
</script>
|
|
349
349
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
VuetablePaginationInfoMixin
|
|
360
|
-
} from "vuetable-next";
|
|
350
|
+
<template>
|
|
351
|
+
<Vuetable
|
|
352
|
+
ref="table"
|
|
353
|
+
api-url="/api/customers"
|
|
354
|
+
:fields="fields"
|
|
355
|
+
@vuetable:pagination-data="onPagination"
|
|
356
|
+
/>
|
|
357
|
+
<VuetablePagination ref="pagination" @vuetable-pagination:change-page="onPage" />
|
|
358
|
+
</template>
|
|
361
359
|
```
|
|
362
360
|
|
|
363
|
-
|
|
364
|
-
`VuetableFieldSequence`, plus `VuetableColGutter`, are also named exports.
|
|
365
|
-
Internal `.vue` source paths are not public package entry points.
|
|
361
|
+
The endpoint returns an Axios response body such as:
|
|
366
362
|
|
|
367
|
-
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"data": [{ "id": 1, "name": "Alex Morgan" }],
|
|
366
|
+
"links": {
|
|
367
|
+
"pagination": {
|
|
368
|
+
"total": 1, "per_page": 10, "current_page": 1,
|
|
369
|
+
"last_page": 1, "from": 1, "to": 1
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
`initial-page` controls the first API page; `per-page` controls the requested page
|
|
376
|
+
size. A sortable field sends sort state to the server. With local arrays, your
|
|
377
|
+
application owns sorting and pagination, for example through `data-manager`;
|
|
378
|
+
clicking a sortable header alone does not reorder the array.
|
|
368
379
|
|
|
369
|
-
|
|
370
|
-
for new `setup()` components. Both styles are supported on all three runtimes.
|
|
380
|
+
#### Extend existing components
|
|
371
381
|
|
|
372
|
-
| Existing
|
|
382
|
+
| Existing helper | Composition API equivalent |
|
|
373
383
|
| --- | --- |
|
|
374
384
|
| `VuetableFieldMixin` | `useVuetableField` |
|
|
375
385
|
| `VuetableFieldCheckboxMixin` | `useVuetableFieldCheckbox` |
|
|
376
386
|
| `VuetablePaginationMixin` | `useVuetablePagination` |
|
|
377
387
|
| `VuetablePaginationInfoMixin` | `useVuetablePaginationInfo` |
|
|
378
388
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
Vue 3
|
|
392
|
-
|
|
393
|
-
|
|
389
|
+
All are named public exports. Both approaches work on all supported runtimes;
|
|
390
|
+
Vue 2.6 needs the plugin shown in the quick start. Set `detail-row-component`
|
|
391
|
+
for expandable content and call `table.toggleDetailRow(recordId)` on the table
|
|
392
|
+
instance to toggle it.
|
|
393
|
+
|
|
394
|
+
Keep legacy mixins or use composables in `setup()` on all three runtimes:
|
|
395
|
+
[paired examples and event wiring](https://github.com/Artles777/vuetable-next/blob/main/docs/mixins-and-composables.md).
|
|
396
|
+
For [checkbox events](https://github.com/Artles777/vuetable-next/blob/main/docs/data-and-requests.md#checkbox-events-and-row-data),
|
|
397
|
+
handlers receive `(checked, fieldName, rowData)`; select-all has only `checked`.
|
|
398
|
+
Use stable record IDs for [stateful cells and details](https://github.com/Artles777/vuetable-next/blob/main/docs/data-and-requests.md#row-identity-and-custom-field-loading).
|
|
399
|
+
[Programmatic row order](https://github.com/Artles777/vuetable-next/blob/main/docs/data-and-requests.md#row-order-and-drag-handles)
|
|
400
|
+
follows the supplied array; `__handle` is an icon, not built-in drag-and-drop.
|
|
401
|
+
Vue 3 skips unchanged row renders for listener-only updates automatically;
|
|
402
|
+
the optional `createVuetable()` factory specializes event configuration, not the
|
|
403
|
+
ability to use render functions. It is not required for this optimization.
|
|
404
|
+
For `h()` components in plain JavaScript/TypeScript, import the normal table and
|
|
405
|
+
return `h(Vuetable, props)` from your Vue 3 render/setup function.
|
|
406
|
+
|
|
407
|
+
#### Migrating an existing table
|
|
408
|
+
|
|
409
|
+
1. Replace the dependency and root imports with `vuetable-next`.
|
|
410
|
+
2. Keep your field objects, default theme, events, pagination wiring and methods.
|
|
411
|
+
3. Replace private `vuetable-2/src/...` imports with this package's public named exports.
|
|
412
|
+
4. Apply only the bootstrap required by your Vue version; when moving the whole
|
|
413
|
+
application to Vue 3, migrate your own custom components and Vue-specific syntax.
|
|
414
|
+
|
|
415
|
+
Unstyled, Tailwind, declarative columns and lean imports are optional; existing
|
|
416
|
+
tables do not need to adopt them. Detailed examples, edge cases and the optional
|
|
417
|
+
[factory event contract](https://github.com/Artles777/vuetable-next/blob/main/docs/migration.md#vue-3-automatic-row-render-optimization)
|
|
418
|
+
are in the extended guides, not prerequisites for this README's examples.
|
|
419
|
+
|
|
420
|
+
## TypeScript
|
|
394
421
|
|
|
395
422
|
Usually the root import is all you need. If your bundler needs an explicit target:
|
|
396
423
|
|
|
@@ -408,78 +435,86 @@ For native Vue 3 branded `Ref`/`ComputedRef` types or direct-ref `watch()`
|
|
|
408
435
|
inference, import from `/vue3`; with the root entry, watch a getter instead.
|
|
409
436
|
See the [typing examples](https://github.com/Artles777/vuetable-next/blob/main/docs/mixins-and-composables.md#typescript-ref-interop).
|
|
410
437
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
## Live demos
|
|
414
|
-
|
|
415
|
-
From a checkout, using Node.js 22:
|
|
438
|
+
Public types can be imported without adding runtime code:
|
|
416
439
|
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
not standalone demo pages. These are local development URLs, not a hosted demo;
|
|
426
|
-
another developer runs the same commands on their own computer.
|
|
440
|
+
```ts
|
|
441
|
+
import type {
|
|
442
|
+
VuetableField,
|
|
443
|
+
VuetableProps,
|
|
444
|
+
VuetableInstance,
|
|
445
|
+
VuetableColumnCellScope,
|
|
446
|
+
VuetablePaginationData
|
|
447
|
+
} from "vuetable-next";
|
|
427
448
|
|
|
428
|
-
|
|
429
|
-
|
|
449
|
+
interface Campaign {
|
|
450
|
+
id: number;
|
|
451
|
+
name: string;
|
|
452
|
+
}
|
|
430
453
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
the local URL printed by the command and choose a runtime. Initial setup needs
|
|
434
|
-
network access to install the temporary consumers.
|
|
454
|
+
const fields: VuetableField[] = [{ name: "name", title: "Campaign" }];
|
|
455
|
+
const tableProps: VuetableProps = { fields, apiMode: false };
|
|
435
456
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
457
|
+
function campaignLabel(scope: VuetableColumnCellScope<Campaign>): string {
|
|
458
|
+
return scope.row.name;
|
|
459
|
+
}
|
|
460
|
+
```
|
|
439
461
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
462
|
+
For Vue 3-native column, slot and composable types, use `import type` from
|
|
463
|
+
`"vuetable-next/vue3"`. Type-only imports are erased by TypeScript; they do not
|
|
464
|
+
load a second table build or Axios. The package supplies declarations, not a
|
|
465
|
+
claim of exhaustive strict typing: legacy extension points and some row/event
|
|
466
|
+
APIs intentionally retain `any` for compatibility. Your API responses still
|
|
467
|
+
need application-owned types and validation where appropriate.
|
|
445
468
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
demo and consumer matrix for Vue 2 verification.
|
|
469
|
+
No SFC required: [TypeScript `h()` / render examples](https://github.com/Artles777/vuetable-next/blob/main/docs/migration.md#typescript-render-functions-without-sfcs)
|
|
470
|
+
use the ordinary table; `createVuetable()` is optional, not a renderer builder.
|
|
449
471
|
|
|
450
|
-
|
|
472
|
+
## Demos
|
|
451
473
|
|
|
452
|
-
|
|
474
|
+
From a checkout, using Node.js 22:
|
|
453
475
|
|
|
454
|
-
|
|
476
|
+
```sh
|
|
477
|
+
npm install --legacy-peer-deps --package-lock=false
|
|
478
|
+
npm run demo
|
|
479
|
+
```
|
|
455
480
|
|
|
456
|
-
|
|
481
|
+
Wait for **three verified applications**, then open the printed HTTP URL and keep
|
|
482
|
+
the terminal running. The command packs one archive, checks isolated Vue 2.6,
|
|
483
|
+
Vue 2.7 and Vue 3 consumers, then serves their showcases; initial setup needs
|
|
484
|
+
network access. Do not open the HTML build inputs as local files.
|
|
485
|
+
Use `npm run demo -- --port 8001` if needed; it never stops an existing server.
|
|
486
|
+
|
|
487
|
+
Try selection, replacement, details and reload; inspect IDs, events and errors
|
|
488
|
+
in the live state panel. See the [demo guide](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md) for
|
|
489
|
+
[declarative columns](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#declarative-columns),
|
|
490
|
+
[grouped layout](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#grouped-layout-playground),
|
|
491
|
+
[pinned columns](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#pinned-columns-playground) and
|
|
492
|
+
[Vue 3 factory controls](https://github.com/Artles777/vuetable-next/blob/main/demo/README.md#factory-playground).
|
|
493
|
+
The theme playground also demonstrates unstyled, mixed-theme and Tailwind tables.
|
|
494
|
+
**Vue runtime** selects the application version; **Feature demos** opens a
|
|
495
|
+
separate example in the same browser tab. On the theme page, **All tables**
|
|
496
|
+
controls fixed headers and row count; the raw-style and dark-mode switches sit
|
|
497
|
+
beside the individual previews they affect. The Vite source playground is a
|
|
498
|
+
separate development workflow, not another runtime in the packed demo.
|
|
499
|
+
|
|
500
|
+

|
|
457
501
|
|
|
458
502
|
<details>
|
|
459
|
-
<summary
|
|
460
|
-
|
|
461
|
-
#### Vue 2.6 + Composition API
|
|
503
|
+
<summary>Same packed component on Vue 2.6 and Vue 2.7</summary>
|
|
462
504
|
|
|
463
|
-

|
|
505
|
+

|
|
506
|
+

|
|
468
507
|
|
|
469
508
|
</details>
|
|
470
509
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
not a theme automatically installed by the library. No live customer data is used.
|
|
474
|
-
|
|
475
|
-
---
|
|
510
|
+
Screenshots are real browser captures with showcase-owned dashboard/theme styling,
|
|
511
|
+
not an automatically installed dashboard. No live customer data is used.
|
|
476
512
|
|
|
477
|
-
## Development
|
|
513
|
+
## Development
|
|
478
514
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
type checks, browser verification and pull request requirements.
|
|
515
|
+
Read [CONTRIBUTING](https://github.com/Artles777/vuetable-next/blob/main/CONTRIBUTING.md) for setup, runtime/type/browser checks and PRs
|
|
516
|
+
against `main`. Include reproductions and actual validation results using the
|
|
517
|
+
[pull request template](https://github.com/Artles777/vuetable-next/blob/main/.github/pull_request_template.md).
|
|
483
518
|
|
|
484
519
|
```sh
|
|
485
520
|
npm run test -- --run
|
|
@@ -489,37 +524,43 @@ npm run build
|
|
|
489
524
|
npm run check:package
|
|
490
525
|
```
|
|
491
526
|
|
|
492
|
-
|
|
493
|
-
package
|
|
494
|
-
|
|
495
|
-
|
|
527
|
+
`npm run dev` starts source-level Vue 3 development. `dev:2` is not the Vue 2
|
|
528
|
+
compatibility gate: verify the packed package in each supported runtime.
|
|
529
|
+
Do not edit generated framework render artifacts by hand.
|
|
530
|
+
For a local archive, run `npm pack` (its `prepack` hook builds and checks), then
|
|
531
|
+
install the printed filename in your app, e.g.
|
|
532
|
+
`npm install /absolute/path/to/vuetable-next/vuetable-next-VERSION.tgz`.
|
|
533
|
+
This uses the checkout's package version and does not publish anything.
|
|
496
534
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
## Contributing
|
|
535
|
+
## Compatibility
|
|
500
536
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
537
|
+
| Application runtime | Declared support | Tested runtime | Composition API plugin |
|
|
538
|
+
| --- | --- | --- | --- |
|
|
539
|
+
| Vue 2.6 | `^2.6.14` | `2.6.14` | Install `@vue/composition-api` |
|
|
540
|
+
| Vue 2.7 | Included in the Vue 2 range | `2.7.16` | Not needed |
|
|
541
|
+
| Vue 3 | `^3.5.3` | `3.5.46` | Not needed |
|
|
504
542
|
|
|
505
|
-
|
|
506
|
-
|
|
543
|
+
Normal Vuetable-2 usage needs no rewrite of tables, default theme, fields, events,
|
|
544
|
+
methods or pagination: change package/import paths and Vue-specific bootstrap.
|
|
545
|
+
New features are opt-in; lean imports are optional payload optimization, not
|
|
546
|
+
required migration. Your custom Vue 3 components, slots and render functions
|
|
547
|
+
still need Vue's own migration; third-party extensions need application testing.
|
|
548
|
+
See [migration and public exports](https://github.com/Artles777/vuetable-next/blob/main/docs/migration.md).
|
|
507
549
|
|
|
508
|
-
|
|
550
|
+
`vue-demi` selects separately compiled builds without aliases or dependency
|
|
551
|
+
patches. Consumer checks cover rendering, reactive data, custom fields/mixins,
|
|
552
|
+
selection, events, details, methods, teardown, resolution and declarations;
|
|
553
|
+
Vue 2.6 also has a webpack 4 consumer check. This is not exhaustive certification
|
|
554
|
+
of every upstream example or application integration.
|
|
509
555
|
|
|
510
556
|
## Limitations and security
|
|
511
557
|
|
|
512
|
-
- Vue 2.6
|
|
513
|
-
-
|
|
514
|
-
-
|
|
515
|
-
-
|
|
516
|
-
- Consumer verification is not a blanket guarantee for every upstream example or application integration. Test your own custom renderers, API contracts and migration scenarios.
|
|
517
|
-
|
|
518
|
-
---
|
|
558
|
+
- Vue 2.6 requires Composition API; Vue 2.7 and Vue 3 do not.
|
|
559
|
+
- No standalone UMD/CDN script build: use a supported bundler or module environment.
|
|
560
|
+
- Vue 2 has a known low-severity [framework advisory](https://github.com/advisories/GHSA-5j4c-8p2g-v4jx); compatibility does not make an end-of-life runtime security-supported.
|
|
561
|
+
- Validate application API responses and custom integrations; declarations intentionally retain some legacy `any` boundaries.
|
|
519
562
|
|
|
520
563
|
## License and credits
|
|
521
564
|
|
|
522
565
|
[MIT](https://github.com/Artles777/vuetable-next/blob/main/LICENSE) · Maintained by Artem Alesenko.
|
|
523
|
-
|
|
524
|
-
Based on [Vuetable-2](https://github.com/ratiw/vuetable-2). Thanks to its original
|
|
525
|
-
authors and contributors for the table API and documentation that this fork builds on.
|
|
566
|
+
Based on [Vuetable-2](https://github.com/ratiw/vuetable-2); thanks to its original authors and contributors.
|