vuetable-next 1.0.9 → 1.0.11
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/LICENSE +20 -20
- package/README.md +347 -71
- package/dist/index.js +20 -0
- package/dist/portable/components/useVuetableField.d.ts +28 -0
- package/dist/portable/components/useVuetableFieldCheckbox.d.ts +19 -0
- package/dist/portable/components/useVuetablePagination.d.ts +34 -0
- package/dist/portable/components/useVuetablePaginationInfo.d.ts +25 -0
- package/dist/portable/helpers/toValue.d.ts +4 -0
- package/dist/portable/reactivity.d.ts +7 -0
- package/dist/public.d.ts +118 -0
- package/dist/selector.cjs +1 -0
- package/dist/style.css +3 -1
- package/dist/types/components/Vuetable.vue.d.ts +1266 -0
- package/dist/types/components/VuetableColGroup.vue.d.ts +33 -0
- package/dist/types/components/VuetableColGutter.vue.d.ts +5 -0
- package/dist/types/components/VuetableContext.d.ts +21 -0
- package/dist/types/components/VuetableCssSemanticUI.d.ts +35 -0
- package/dist/types/components/VuetableDetailHost.vue.d.ts +44 -0
- package/dist/types/components/VuetableFieldCheckbox.vue.d.ts +64 -0
- package/dist/types/components/VuetableFieldCheckboxMixin.vue.d.ts +66 -0
- package/dist/types/components/VuetableFieldHandle.vue.d.ts +31 -0
- package/dist/types/components/VuetableFieldMixin.vue.d.ts +53 -0
- package/dist/types/components/VuetableFieldSequence.vue.d.ts +42 -0
- package/dist/types/components/VuetablePagination.vue.d.ts +69 -0
- package/dist/types/components/VuetablePaginationDropdown.vue.d.ts +82 -0
- package/dist/types/components/VuetablePaginationInfo.vue.d.ts +44 -0
- package/dist/types/components/VuetablePaginationInfoMixin.vue.d.ts +47 -0
- package/dist/types/components/VuetablePaginationMixin.vue.d.ts +57 -0
- package/dist/types/components/VuetableRowHeader.vue.d.ts +182 -0
- package/dist/types/components/useVuetableField.d.ts +28 -0
- package/dist/types/components/useVuetableFieldCheckbox.d.ts +19 -0
- package/dist/types/components/useVuetablePagination.d.ts +34 -0
- package/dist/types/components/useVuetablePaginationInfo.d.ts +25 -0
- package/dist/types/helpers/toValue.d.ts +4 -0
- package/dist/types/index.d.ts +28 -0
- package/dist/vue2.cjs +18 -0
- package/dist/vue2.cjs.map +1 -0
- package/dist/vue2.js +1576 -0
- package/dist/vue2.js.map +1 -0
- package/dist/vue3.cjs +6 -0
- package/dist/vue3.cjs.map +1 -0
- package/dist/vue3.js +1723 -0
- package/dist/vue3.js.map +1 -0
- package/package.json +42 -12
- package/style.css +3 -0
- package/vue2.js +2 -0
- package/vue3.js +2 -0
- package/dist/vuetable-next.d.ts +0 -728
- package/dist/vuetable-next.js +0 -3324
- package/dist/vuetable-next.js.map +0 -1
- package/dist/vuetable-next.umd.cjs +0 -11
- package/dist/vuetable-next.umd.cjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Artem Alesenko
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Artem Alesenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,102 +1,378 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/images/hero.svg" alt="Vuetable Next — one familiar table API for Vue 2.6, Vue 2.7 and Vue 3" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>A familiar table API. A smoother path from Vue 2 to Vue 3.</strong><br>
|
|
7
|
+
Data tables, custom fields, selection, pagination and expandable rows — across Vue generations.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="#compatibility"><img src="https://img.shields.io/badge/Vue-2.6%20%7C%202.7%20%7C%203-41b883?style=flat-square" alt="Vue 2.6, Vue 2.7 and Vue 3"></a>
|
|
12
|
+
<a href="https://vuetable.com/guide/"><img src="https://img.shields.io/badge/API-vuetable--2-35495e?style=flat-square" alt="vuetable-2-compatible API"></a>
|
|
13
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-438b70?style=flat-square" alt="MIT license"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="#quick-start">Quick start</a> ·
|
|
18
|
+
<a href="#screenshots">Screenshots</a> ·
|
|
19
|
+
<a href="#live-demos">Live demos</a> ·
|
|
20
|
+
<a href="https://vuetable.com/guide/">Documentation</a> ·
|
|
21
|
+
<a href="CONTRIBUTING.md">Contributing</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
## Why Vuetable Next?
|
|
25
|
+
|
|
26
|
+
`vuetable-next` is a fork of `vuetable-2`, built around `vue-demi` to retain a
|
|
27
|
+
familiar table API while supporting both Vue 2 and Vue 3 applications.
|
|
28
|
+
|
|
29
|
+
| One table API | Framework-aware packaging | Built to extend |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| Local or remote data, field definitions, events and instance methods | One package with automatic Vue 2 / Vue 3 build selection | Custom fields, legacy mixins, detail rows and pagination components |
|
|
32
|
+
|
|
33
|
+
- **Keep familiar concepts.** Use the original Vuetable-2 documentation as the API reference.
|
|
34
|
+
- **Move at your own pace.** Vue 2.6, Vue 2.7 and Vue 3 use the same root import.
|
|
35
|
+
- **Choose your integration.** Local components, global registration, ESM and CommonJS are supported.
|
|
36
|
+
- **Keep dependencies shared.** Vue, `vue-demi` and Axios are external, not private copies embedded in the bundle.
|
|
37
|
+
- **Use TypeScript.** Portable root declarations work across supported Vue generations; the explicit Vue 3 entry provides richer generated types.
|
|
38
|
+
|
|
39
|
+
> **Version 1.0.11:** introduces the Vue 2.6 / Vue 2.7 / Vue 3 packaging,
|
|
40
|
+
> public composables and portable declarations described here. The older
|
|
41
|
+
> `1.0.10` release does not contain these compatibility changes.
|
|
42
|
+
|
|
43
|
+
## Screenshots
|
|
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.
|
|
83
|
+
|
|
84
|
+
## Quick start
|
|
85
|
+
|
|
86
|
+
### Install
|
|
87
|
+
|
|
88
|
+
Install the compatibility release:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npm install vuetable-next@^1.0.11
|
|
13
92
|
```
|
|
14
93
|
|
|
15
|
-
|
|
16
|
-
## 👦Vue 3
|
|
17
|
-
### Global Registration
|
|
18
|
-
```ts
|
|
19
|
-
import Vuetable from "vuetable-next";
|
|
20
|
-
import { createApp } from "vue";
|
|
94
|
+
For Vue 2.6, also install the Composition API plugin:
|
|
21
95
|
|
|
22
|
-
|
|
23
|
-
|
|
96
|
+
```sh
|
|
97
|
+
npm install @vue/composition-api
|
|
24
98
|
```
|
|
25
|
-
### Local Registration
|
|
26
|
-
```vue
|
|
27
|
-
<script setup lang="ts">
|
|
28
|
-
import Vuetable from "vuetable-next";
|
|
29
|
-
</script>
|
|
30
99
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<template>
|
|
100
|
+
**Developing or testing a local revision?** From a checkout of this repository:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npm install --legacy-peer-deps --package-lock=false
|
|
104
|
+
npm pack
|
|
37
105
|
```
|
|
38
|
-
## 👨Vue 2.7
|
|
39
|
-
### Global Registration
|
|
40
|
-
```ts
|
|
41
|
-
import Vuetable from "vuetable-next";
|
|
42
|
-
import Vue from "vue";
|
|
43
106
|
|
|
44
|
-
|
|
107
|
+
Then install the generated archive from your application directory:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
npm install /absolute/path/to/vuetable-next/vuetable-next-1.0.11.tgz
|
|
45
111
|
```
|
|
46
|
-
|
|
112
|
+
|
|
113
|
+
`npm pack` runs the dual build and package checks through `prepack`. The archive
|
|
114
|
+
uses the version currently declared in `package.json`; it does not publish anything.
|
|
115
|
+
|
|
116
|
+
### Vue 3
|
|
117
|
+
|
|
118
|
+
Import the table and stylesheet, then pass your fields and rows. This example
|
|
119
|
+
uses local data and does not need a backend.
|
|
120
|
+
|
|
121
|
+
**`App.vue`**
|
|
122
|
+
|
|
47
123
|
```vue
|
|
48
|
-
<script setup>
|
|
124
|
+
<script setup lang="ts">
|
|
125
|
+
import { ref } from "vue";
|
|
49
126
|
import Vuetable from "vuetable-next";
|
|
127
|
+
import "vuetable-next/style.css";
|
|
128
|
+
|
|
129
|
+
const fields = ["__checkbox", "name", "email"];
|
|
130
|
+
const rows = ref([
|
|
131
|
+
{ id: 1, name: "Alex Morgan", email: "alex@example.com" },
|
|
132
|
+
{ id: 2, name: "Sam Rivera", email: "sam@example.com" }
|
|
133
|
+
]);
|
|
50
134
|
</script>
|
|
51
135
|
|
|
52
136
|
<template>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
137
|
+
<Vuetable
|
|
138
|
+
:fields="fields"
|
|
139
|
+
:data="rows"
|
|
140
|
+
:api-mode="false"
|
|
141
|
+
track-by="id"
|
|
142
|
+
/>
|
|
143
|
+
</template>
|
|
58
144
|
```
|
|
59
145
|
|
|
60
|
-
|
|
61
|
-
|
|
146
|
+
**`main.ts`**
|
|
147
|
+
|
|
62
148
|
```ts
|
|
63
|
-
import
|
|
64
|
-
import
|
|
149
|
+
import { createApp } from "vue";
|
|
150
|
+
import App from "./App.vue";
|
|
151
|
+
|
|
152
|
+
createApp(App).mount("#app");
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Prefer global registration? Import `Vuetable` in your entry point and call
|
|
156
|
+
`createApp(App).use(Vuetable).mount("#app")` instead. The plugin registers the
|
|
157
|
+
table and its companion components.
|
|
158
|
+
|
|
159
|
+
### Vue 2.6
|
|
160
|
+
|
|
161
|
+
Register Composition API **before mounting the application**.
|
|
162
|
+
|
|
163
|
+
**`main.js`**
|
|
164
|
+
|
|
165
|
+
```js
|
|
65
166
|
import Vue from "vue";
|
|
167
|
+
import VueCompositionAPI from "@vue/composition-api";
|
|
168
|
+
import App from "./App.vue";
|
|
169
|
+
import "vuetable-next/style.css";
|
|
66
170
|
|
|
67
171
|
Vue.use(VueCompositionAPI);
|
|
68
|
-
|
|
172
|
+
|
|
173
|
+
new Vue({ render: createElement => createElement(App) }).$mount("#app");
|
|
69
174
|
```
|
|
70
|
-
|
|
175
|
+
|
|
176
|
+
**`App.vue`**
|
|
177
|
+
|
|
71
178
|
```vue
|
|
179
|
+
<template>
|
|
180
|
+
<Vuetable
|
|
181
|
+
:fields="fields"
|
|
182
|
+
:data="rows"
|
|
183
|
+
:api-mode="false"
|
|
184
|
+
track-by="id"
|
|
185
|
+
/>
|
|
186
|
+
</template>
|
|
187
|
+
|
|
72
188
|
<script>
|
|
73
|
-
import VueCompositionAPI from "@vue/composition-api";
|
|
74
189
|
import Vuetable from "vuetable-next";
|
|
75
|
-
import Vue from "vue";
|
|
76
|
-
Vue.use(VueCompositionAPI);
|
|
77
190
|
|
|
78
191
|
export default {
|
|
79
|
-
components: { Vuetable }
|
|
80
|
-
|
|
192
|
+
components: { Vuetable },
|
|
193
|
+
data () {
|
|
194
|
+
return {
|
|
195
|
+
fields: ["__checkbox", "name", "email"],
|
|
196
|
+
rows: [
|
|
197
|
+
{ id: 1, name: "Alex Morgan", email: "alex@example.com" },
|
|
198
|
+
{ id: 2, name: "Sam Rivera", email: "sam@example.com" }
|
|
199
|
+
]
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
81
203
|
</script>
|
|
204
|
+
```
|
|
82
205
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
206
|
+
### Vue 2.7
|
|
207
|
+
|
|
208
|
+
Use the same `App.vue` as Vue 2.6, but **do not install or register
|
|
209
|
+
`@vue/composition-api`**: Vue 2.7 provides the API natively.
|
|
210
|
+
|
|
211
|
+
**`main.js`**
|
|
212
|
+
|
|
213
|
+
```js
|
|
214
|
+
import Vue from "vue";
|
|
215
|
+
import App from "./App.vue";
|
|
216
|
+
import "vuetable-next/style.css";
|
|
217
|
+
|
|
218
|
+
new Vue({ render: createElement => createElement(App) }).$mount("#app");
|
|
89
219
|
```
|
|
90
220
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
221
|
+
For global registration on either Vue 2 version, import `Vuetable` in your
|
|
222
|
+
entry point and call `Vue.use(Vuetable)` before creating the root instance.
|
|
223
|
+
|
|
224
|
+
## Documentation and migration
|
|
225
|
+
|
|
226
|
+
### Familiar Vuetable-2 documentation
|
|
227
|
+
|
|
228
|
+
Start with the original [Vuetable-2 guide](https://vuetable.com/guide/) and
|
|
229
|
+
[API reference](https://vuetable.com/api/) for fields, API mode, sorting,
|
|
230
|
+
pagination, events, methods, custom fields and detail rows.
|
|
231
|
+
|
|
232
|
+
The table API is intended to stay familiar on Vue 2 and Vue 3. Framework-level
|
|
233
|
+
differences still apply: use Vue 3 slot/render-function conventions in your own
|
|
234
|
+
components, and follow the setup instructions for your installed Vue version.
|
|
235
|
+
|
|
236
|
+
### Moving an existing table
|
|
237
|
+
|
|
238
|
+
1. Replace the `vuetable-2` dependency with the verified `vuetable-next` release or archive.
|
|
239
|
+
2. Change root imports to `vuetable-next` and import `vuetable-next/style.css` once.
|
|
240
|
+
3. Replace imports from `vuetable-2/src/...` with the named public exports below.
|
|
241
|
+
4. Keep existing field definitions, table props and event handlers, then verify your application-specific scenarios.
|
|
242
|
+
5. When migrating the application to Vue 3, adapt its own Vue-specific syntax as needed; the package chooses its Vue 3 build automatically.
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
import Vuetable, {
|
|
246
|
+
VuetableRowHeader,
|
|
247
|
+
VuetablePagination,
|
|
248
|
+
VuetablePaginationDropdown,
|
|
249
|
+
VuetablePaginationInfo,
|
|
250
|
+
VuetableFieldMixin,
|
|
251
|
+
VuetableFieldCheckboxMixin,
|
|
252
|
+
VuetablePaginationMixin,
|
|
253
|
+
VuetablePaginationInfoMixin
|
|
254
|
+
} from "vuetable-next";
|
|
97
255
|
```
|
|
98
|
-
# Contributions
|
|
99
|
-
Any contribution to the code must be done to the `next` branch.
|
|
100
256
|
|
|
101
|
-
|
|
102
|
-
|
|
257
|
+
Built-in field components `VuetableFieldCheckbox`, `VuetableFieldHandle` and
|
|
258
|
+
`VuetableFieldSequence`, plus `VuetableColGutter`, are also named exports.
|
|
259
|
+
Internal `.vue` source paths are not public package entry points.
|
|
260
|
+
|
|
261
|
+
### Mixins or composables?
|
|
262
|
+
|
|
263
|
+
Keep legacy mixins for existing Options API components, or choose a composable
|
|
264
|
+
for new `setup()` components. Both styles are supported on all three runtimes.
|
|
265
|
+
|
|
266
|
+
| Existing mixin | Composable alternative |
|
|
267
|
+
| --- | --- |
|
|
268
|
+
| `VuetableFieldMixin` | `useVuetableField` |
|
|
269
|
+
| `VuetableFieldCheckboxMixin` | `useVuetableFieldCheckbox` |
|
|
270
|
+
| `VuetablePaginationMixin` | `useVuetablePagination` |
|
|
271
|
+
| `VuetablePaginationInfoMixin` | `useVuetablePaginationInfo` |
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
import {
|
|
275
|
+
useVuetableField,
|
|
276
|
+
useVuetableFieldCheckbox,
|
|
277
|
+
useVuetablePagination,
|
|
278
|
+
useVuetablePaginationInfo
|
|
279
|
+
} from "vuetable-next";
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
See [Mixins and composables](docs/mixins-and-composables.md) for paired component
|
|
283
|
+
examples, props, event wiring, pagination data, and complete Vue 2.6 / Vue 2.7 /
|
|
284
|
+
Vue 3 startup examples. Vue 2.6 registers `@vue/composition-api` once; Vue 2.7 and
|
|
285
|
+
Vue 3 do not need that plugin. Existing mixins remain public — no forced migration.
|
|
286
|
+
|
|
287
|
+
### Explicit framework entries and types
|
|
288
|
+
|
|
289
|
+
Usually the root import is all you need. If your bundler needs an explicit target:
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
import VuetableForVue2 from "vuetable-next/vue2";
|
|
293
|
+
import VuetableForVue3 from "vuetable-next/vue3";
|
|
294
|
+
import type { VuetableInstance } from "vuetable-next";
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Choose **only the entry matching your application**, not both. Both entries
|
|
298
|
+
provide default and named exports in ESM and CommonJS formats. Root and `/vue2`
|
|
299
|
+
declarations are portable; `/vue3` exposes the richer generated Vue 3 types.
|
|
300
|
+
Portable composable refs support `.value`, reactive inputs and template usage.
|
|
301
|
+
For native Vue 3 branded `Ref`/`ComputedRef` types or direct-ref `watch()`
|
|
302
|
+
inference, import from `/vue3`; with the root entry, watch a getter instead.
|
|
303
|
+
See the [typing examples](docs/mixins-and-composables.md#typescript-ref-interop).
|
|
304
|
+
|
|
305
|
+
## Live demos
|
|
306
|
+
|
|
307
|
+
From a checkout, using Node.js 22:
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
npm install --legacy-peer-deps --package-lock=false
|
|
311
|
+
npm run demo
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Wait until the terminal prints **three verified applications**, then open the
|
|
315
|
+
printed HTTP address. Keep this terminal running while using the demo. Do not
|
|
316
|
+
open `index.html` or `demo/showcase.html` as a local file: they are build inputs,
|
|
317
|
+
not standalone demo pages. These are local development URLs, not a hosted demo;
|
|
318
|
+
another developer runs the same commands on their own computer.
|
|
319
|
+
|
|
320
|
+
If the default port is already in use, choose one explicitly with
|
|
321
|
+
`npm run demo -- --port 8001`. The command never stops an existing server.
|
|
322
|
+
|
|
323
|
+
The demo command packs the library, checks that same archive in isolated Vue
|
|
324
|
+
2.6, Vue 2.7 and Vue 3 consumers, and serves their interactive showcases. Open
|
|
325
|
+
the local URL printed by the command and choose a runtime. Initial setup needs
|
|
326
|
+
network access to install the temporary consumers.
|
|
327
|
+
|
|
328
|
+
Try selecting and clearing rows, replacing data, opening details, and reloading.
|
|
329
|
+
The live state panel shows the runtime version, selected IDs, emitted custom
|
|
330
|
+
events and any captured runtime errors.
|
|
331
|
+
|
|
332
|
+
For source-level Vue 3 development, `npm run dev` starts the Vite demo. The legacy
|
|
333
|
+
`dev:2` source demo is not the cross-version compatibility gate; use the packed
|
|
334
|
+
demo and consumer matrix for Vue 2 verification.
|
|
335
|
+
|
|
336
|
+
## Development and checks
|
|
337
|
+
|
|
338
|
+
Use Node.js 22 for the documented development workflow. See
|
|
339
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for complete setup, fork/collaborator Git
|
|
340
|
+
commands, linting, regression tests, package validation, the three-runtime matrix,
|
|
341
|
+
type checks, browser verification and pull request requirements.
|
|
342
|
+
|
|
343
|
+
```sh
|
|
344
|
+
npm run test -- --run
|
|
345
|
+
npm run test:demo
|
|
346
|
+
npm run lint
|
|
347
|
+
npm run build
|
|
348
|
+
npm run check:package
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Do not use a successful source test run as a substitute for checking the packed
|
|
352
|
+
package on each supported framework. The build produces framework-specific
|
|
353
|
+
render artifacts from shared component sources; generated files are not edited
|
|
354
|
+
by hand.
|
|
355
|
+
|
|
356
|
+
## Limitations and security
|
|
357
|
+
|
|
358
|
+
- Vue 2.6 needs Composition API; Vue 2.7 and Vue 3 do not.
|
|
359
|
+
- The package has no standalone UMD/CDN script build. Use a supported bundler or module environment.
|
|
360
|
+
- Showcase screenshots use custom example styling. The default table does not include the surrounding dashboard.
|
|
361
|
+
- 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.
|
|
362
|
+
- Consumer verification is not a blanket guarantee for every upstream example or application integration. Test your own custom renderers, API contracts and migration scenarios.
|
|
363
|
+
|
|
364
|
+
## Contributing
|
|
365
|
+
|
|
366
|
+
Bug reports, focused fixes and documentation improvements are welcome. Both fork
|
|
367
|
+
contributors and repository collaborators should use feature branches and open
|
|
368
|
+
pull requests against **`main`**.
|
|
369
|
+
|
|
370
|
+
Read the [contribution guide](CONTRIBUTING.md), include a reproduction and actual
|
|
371
|
+
validation results, and use the [pull request template](.github/pull_request_template.md).
|
|
372
|
+
|
|
373
|
+
## License and credits
|
|
374
|
+
|
|
375
|
+
[MIT](LICENSE) · Maintained by Artem Alesenko.
|
|
376
|
+
|
|
377
|
+
Based on [Vuetable-2](https://github.com/ratiw/vuetable-2). Thanks to its original
|
|
378
|
+
authors and contributors for the table API and documentation that this fork builds on.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import selected from "./selector.cjs";
|
|
2
|
+
export const Vuetable = selected.Vuetable;
|
|
3
|
+
export const VuetableFieldMixin = selected.VuetableFieldMixin;
|
|
4
|
+
export const VuetableFieldCheckboxMixin = selected.VuetableFieldCheckboxMixin;
|
|
5
|
+
export const VuetablePaginationInfoMixin = selected.VuetablePaginationInfoMixin;
|
|
6
|
+
export const VuetablePaginationMixin = selected.VuetablePaginationMixin;
|
|
7
|
+
export const VuetableColGutter = selected.VuetableColGutter;
|
|
8
|
+
export const VuetableFieldCheckbox = selected.VuetableFieldCheckbox;
|
|
9
|
+
export const VuetableFieldHandle = selected.VuetableFieldHandle;
|
|
10
|
+
export const VuetableFieldSequence = selected.VuetableFieldSequence;
|
|
11
|
+
export const VuetablePagination = selected.VuetablePagination;
|
|
12
|
+
export const VuetablePaginationDropdown = selected.VuetablePaginationDropdown;
|
|
13
|
+
export const VuetablePaginationInfo = selected.VuetablePaginationInfo;
|
|
14
|
+
export const VuetableRowHeader = selected.VuetableRowHeader;
|
|
15
|
+
export const install = selected.install;
|
|
16
|
+
export const useVuetableField = selected.useVuetableField;
|
|
17
|
+
export const useVuetableFieldCheckbox = selected.useVuetableFieldCheckbox;
|
|
18
|
+
export const useVuetablePagination = selected.useVuetablePagination;
|
|
19
|
+
export const useVuetablePaginationInfo = selected.useVuetablePaginationInfo;
|
|
20
|
+
export default selected.default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComputedRef } from "../reactivity.js";
|
|
2
|
+
export type VuetableFieldRow = Record<string, any>;
|
|
3
|
+
export interface VuetableFieldDefinition {
|
|
4
|
+
name?: string | object;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface VuetableFieldContext {
|
|
8
|
+
trackBy?: string;
|
|
9
|
+
tableData?: readonly VuetableFieldRow[] | null;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface VuetableFieldProps<TableContext extends VuetableFieldContext = VuetableFieldContext> {
|
|
13
|
+
rowData?: VuetableFieldRow | null;
|
|
14
|
+
rowIndex?: number;
|
|
15
|
+
rowField?: VuetableFieldDefinition | null;
|
|
16
|
+
isHeader?: boolean;
|
|
17
|
+
title?: string;
|
|
18
|
+
vuetable?: TableContext | null;
|
|
19
|
+
}
|
|
20
|
+
export interface VuetableFieldResult<TableContext extends VuetableFieldContext = VuetableFieldContext> {
|
|
21
|
+
rowData: ComputedRef<VuetableFieldRow | null>;
|
|
22
|
+
rowIndex: ComputedRef<number | undefined>;
|
|
23
|
+
rowField: ComputedRef<VuetableFieldDefinition | null | undefined>;
|
|
24
|
+
isHeader: ComputedRef<boolean>;
|
|
25
|
+
title: ComputedRef<string>;
|
|
26
|
+
vuetable: ComputedRef<TableContext | null>;
|
|
27
|
+
}
|
|
28
|
+
export declare function useVuetableField<TableContext extends VuetableFieldContext = VuetableFieldContext>(props: Readonly<VuetableFieldProps<TableContext>>): VuetableFieldResult<TableContext>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from "../reactivity.js";
|
|
2
|
+
import { VuetableFieldContext, VuetableFieldDefinition, VuetableFieldProps, VuetableFieldResult, VuetableFieldRow } from './useVuetableField.js';
|
|
3
|
+
export interface VuetableFieldCheckboxContext extends VuetableFieldContext {
|
|
4
|
+
trackBy: string;
|
|
5
|
+
isSelectedRow(identifier: any): boolean;
|
|
6
|
+
onCheckboxToggled(checked: boolean, fieldName: VuetableFieldDefinition["name"], row: VuetableFieldRow): void;
|
|
7
|
+
onCheckboxToggledAll(checked: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
export type VuetableFieldCheckboxProps = VuetableFieldProps<VuetableFieldCheckboxContext>;
|
|
10
|
+
export interface VuetableFieldCheckboxResult extends VuetableFieldResult<VuetableFieldCheckboxContext> {
|
|
11
|
+
checkbox: Ref<HTMLInputElement | null>;
|
|
12
|
+
selectedCount: ComputedRef<number>;
|
|
13
|
+
isIndeterminate: ComputedRef<boolean>;
|
|
14
|
+
toggleCheckbox(row: VuetableFieldRow | null | undefined, event: Event): void;
|
|
15
|
+
toggleAllCheckbox(event: Event): void;
|
|
16
|
+
isSelected(row: VuetableFieldRow | null | undefined): boolean;
|
|
17
|
+
isAllItemsInCurrentPageSelected(): boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function useVuetableFieldCheckbox(props: Readonly<VuetableFieldCheckboxProps>): VuetableFieldCheckboxResult;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from "../reactivity.js";
|
|
2
|
+
import { MaybeRefOrGetter } from '../helpers/toValue.js';
|
|
3
|
+
export interface TablePagination {
|
|
4
|
+
last_page: number;
|
|
5
|
+
current_page: number;
|
|
6
|
+
from?: number;
|
|
7
|
+
to?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VuetablePaginationOptions {
|
|
11
|
+
onEachSide?: MaybeRefOrGetter<number>;
|
|
12
|
+
firstPage?: MaybeRefOrGetter<number>;
|
|
13
|
+
css?: MaybeRefOrGetter<Record<string, any>>;
|
|
14
|
+
emit?: (event: "vuetable-pagination:change-page", page: number | string) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface VuetablePaginationResult {
|
|
17
|
+
tablePagination: Ref<TablePagination | null>;
|
|
18
|
+
customCss: Ref<Record<string, any>>;
|
|
19
|
+
eventPrefix: Ref<string>;
|
|
20
|
+
lastPage: ComputedRef<number>;
|
|
21
|
+
isOnFirstPage: ComputedRef<boolean>;
|
|
22
|
+
isOnLastPage: ComputedRef<boolean>;
|
|
23
|
+
notEnoughPages: ComputedRef<boolean>;
|
|
24
|
+
windowSize: ComputedRef<number>;
|
|
25
|
+
windowStart: ComputedRef<number>;
|
|
26
|
+
totalPage: ComputedRef<number>;
|
|
27
|
+
setPaginationData: (value: TablePagination | null) => void;
|
|
28
|
+
resetData: () => void;
|
|
29
|
+
isCurrentPage: (page: number) => boolean;
|
|
30
|
+
mergeCss: () => void;
|
|
31
|
+
loadPage: (page: number | string) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function useVuetablePagination(options?: VuetablePaginationOptions): VuetablePaginationResult;
|
|
34
|
+
export declare function useVuetablePagination(onEachSide?: MaybeRefOrGetter<number>, firstPage?: MaybeRefOrGetter<number>): VuetablePaginationResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from "../reactivity.js";
|
|
2
|
+
import { MaybeRefOrGetter } from '../helpers/toValue.js';
|
|
3
|
+
export interface TablePagination {
|
|
4
|
+
last_page?: number;
|
|
5
|
+
current_page?: number;
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VuetablePaginationInfoOptions {
|
|
11
|
+
noDataTemplate?: MaybeRefOrGetter<string>;
|
|
12
|
+
infoTemplate?: MaybeRefOrGetter<string>;
|
|
13
|
+
css?: MaybeRefOrGetter<Record<string, any>>;
|
|
14
|
+
}
|
|
15
|
+
export interface VuetablePaginationInfoResult {
|
|
16
|
+
tablePagination: Ref<TablePagination | null>;
|
|
17
|
+
customCss: Ref<Record<string, any>>;
|
|
18
|
+
paginationInfo: ComputedRef<string>;
|
|
19
|
+
setPaginationData: (value: TablePagination | null) => void;
|
|
20
|
+
resetData: () => void;
|
|
21
|
+
isCurrentPage: (page: number) => boolean;
|
|
22
|
+
mergeCss: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function useVuetablePaginationInfo(options?: VuetablePaginationInfoOptions): VuetablePaginationInfoResult;
|
|
25
|
+
export declare function useVuetablePaginationInfo(noDataTemplate?: MaybeRefOrGetter<string>, infoTemplate?: MaybeRefOrGetter<string>): VuetablePaginationInfoResult;
|