Skip to content

Commit 062e6f4

Browse files
committed
feat: vue 3 support
1 parent 9a8e125 commit 062e6f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5687
-5053
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['eslint-config-kouts/vue2']
2+
extends: ['eslint-config-kouts/vue3']
33
}

CHANGELOG.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# vue-dataset <a href="https://npm.im/vue-dataset"><img src="https://badgen.net/npm/v/vue-dataset"></a> ![](https://img.badgesize.io/kouts/vue-dataset/master/dist/umd/VueDataset.min.js.svg) ![](https://img.badgesize.io/kouts/vue-dataset/master/dist/umd/VueDataset.min.js.svg?compression=gzip)
1+
# vue-dataset <a href="https://npm.im/vue-dataset"><img src="https://badgen.net/npm/v/vue-dataset/next"></a> ![](https://img.badgesize.io/kouts/vue-dataset/next/dist/vue-dataset.umd.js) ![](https://img.badgesize.io/kouts/vue-dataset/next/dist/vue-dataset.umd.js.svg?compression=gzip)
22

33

44
---
55

6-
:fire: **HEADS UP!** You're currently looking at vue-dataset branch for **Vue.js 2**.
7-
If you're looking for a Vue.js 3 compatible version of vue-dataset, [please check out the `next` branch](https://github.com/kouts/vue-dataset/tree/next).
6+
:fire: **HEADS UP!** You're currently looking at vue-dataset `next` branch for **Vue.js 3**.
7+
If you're looking for a Vue.js 2 compatible version of vue-dataset, [please check out the `master` branch](https://github.com/kouts/vue-dataset/tree/master).
88

99
---
1010

11-
A set of Vue.js components to display datasets (lists) with filtering, paging, and sorting capabilities!
11+
A set of Vue.js 3 components to display datasets (lists) with filtering, paging, and sorting capabilities!
1212
Created with reusability in mind, so that one doesn't have to recreate the same functionality for lists over and over again.
1313

1414
> vue-dataset does not impose any structure or layout limitations on your HTML, you can use divs, tables or anything you like to present your data.
@@ -27,12 +27,12 @@ Created with reusability in mind, so that one doesn't have to recreate the same
2727

2828
## Browsers support
2929

30-
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Opera |
30+
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Opera |
3131
| --------- | --------- | --------- | --------- | --------- |
32-
| IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions
32+
| Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions
3333

3434
Documentation and examples
35-
https://vue-dataset-demo.netlify.app/
35+
https://vue-dataset-demo-next.netlify.app/
3636

3737
# Development
3838

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
extends: ['@commitlint/config-conventional'],
33
rules: {
4-
'body-max-line-length': () => [1, 'always', 200]
4+
'body-max-line-length': [1, 'always', 200]
55
}
66
}

docs/.vuepress/clientAppEnhance.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Dataset from '@/Dataset.vue'
2+
import DatasetSearch from '@/DatasetSearch.vue'
3+
import DatasetShow from '@/DatasetShow.vue'
4+
import DatasetPager from '@/DatasetPager.vue'
5+
import DatasetItem from '@/DatasetItem.vue'
6+
import DatasetInfo from '@/DatasetInfo.vue'
7+
import './styles/styles.scss'
8+
9+
import { defineClientAppEnhance } from '@vuepress/client'
10+
11+
export default defineClientAppEnhance(({ app, router, siteData }) => {
12+
app.component('Dataset', Dataset)
13+
app.component('DatasetShow', DatasetShow)
14+
app.component('DatasetSearch', DatasetSearch)
15+
app.component('DatasetPager', DatasetPager)
16+
app.component('DatasetItem', DatasetItem)
17+
app.component('DatasetInfo', DatasetInfo)
18+
})

docs/.vuepress/components/Example1.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</template>
5151

5252
<script>
53-
import users from '../../../example-data/users.json'
53+
import users from '@root/example-data/users.json'
5454
5555
export default {
5656
name: 'Example1',

docs/.vuepress/components/Example2.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@
125125
</template>
126126

127127
<script>
128-
import users from '../../../example-data/users.json'
128+
import users from '@root/example-data/users.json'
129129
import { filterList, clone, isoDateToEuroDate, searchAsEuroDate } from '../utilities'
130-
import { debounce } from '../../../src/helpers'
130+
import { debounce } from '@/helpers'
131131
132132
// const lessUsers = clone(data).slice(0, 2);
133133

docs/.vuepress/components/Example3.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</template>
5252

5353
<script>
54-
import users from '../../../example-data/users.json'
54+
import users from '@root/example-data/users.json'
5555
import { isoDateToEuroDate, isoDateToDate, searchAsEuroDate } from '../utilities'
5656
5757
export default {

docs/.vuepress/config.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const VueExamplePlugin = require('vuepress-plugin-vue-example')
1+
const path = require('path')
2+
const VueExamplePlugin = require('../../vuepress-plugin-vue-example/index.js')
23

34
module.exports = {
45
plugins: [
@@ -10,26 +11,40 @@ module.exports = {
1011
title: 'vue-dataset',
1112
description: 'A vue component to display datasets with filtering, paging and sorting capabilities!',
1213
themeConfig: {
13-
nav: [{ text: 'Github', link: 'https://github.com/kouts/vue-dataset' }],
14+
repo: 'https://github.com/kouts/vue-dataset',
15+
darkMode: false,
1416
sidebar: [
15-
['/', 'Introduction'],
16-
['/installation/', 'Installation'],
17-
['/components/', 'Components'],
1817
{
19-
title: 'Examples',
18+
link: '/',
19+
text: 'Introduction'
20+
},
21+
{
22+
link: '/installation/',
23+
text: 'Installation'
24+
},
25+
{
26+
link: '/components/',
27+
text: 'Components'
28+
},
29+
{
30+
text: 'Examples',
2031
collapsable: true,
2132
children: [
22-
['/examples/cards/', 'Cards'],
23-
['/examples/datatable/', 'Datatable']
33+
{
34+
link: '/examples/cards/',
35+
text: 'Cards'
36+
},
37+
{
38+
link: '/examples/datatable/',
39+
text: 'Datatable'
40+
}
2441
]
2542
}
2643
]
2744
},
28-
head: [
29-
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' }],
30-
['script', { src: 'https://polyfill.io/v3/polyfill.min.js?features=Array.from' }],
31-
['script', { src: 'https://polyfill.io/v3/polyfill.min.js?features=Promise' }],
32-
['script', { src: 'https://polyfill.io/v3/polyfill.min.js?features=NodeList.prototype.forEach' }],
33-
['script', { src: 'https://polyfill.io/v3/polyfill.min.js?features=Object.assign' }]
34-
]
45+
alias: {
46+
'@': path.resolve(__dirname, '../../src'),
47+
'@playground': path.resolve(__dirname, '../../playground'),
48+
'@root': path.resolve(__dirname, '../../')
49+
}
3550
}

docs/.vuepress/enhanceApp.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/.vuepress/styles/styles.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,15 @@ blockquote p {color: #777;}
102102
.theme-container .theme-default-content:not(.custom) > h5,
103103
.theme-container .theme-default-content:not(.custom) > h6 {
104104
margin-bottom: 1rem !important;
105+
}
106+
107+
/* Fix footer nav links */
108+
.page-nav .nav-link, .page-meta .nav-link {
109+
display: inline;
110+
padding: 0;
111+
}
112+
113+
/* Fix stripped table rows colors */
114+
.table.table-striped tr:nth-child(2n) {
115+
background-color: #f6f8fa;
105116
}

docs/components/index.md

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ sortAsDate: function (isoDate) {
131131

132132
### Provides
133133

134-
Dataset `provides` functions that return computed data, data and methods to the child components.
134+
Dataset `provides` reactive data and methods to the child components.
135135
You can leverage these using `inject` to create your own **custom child components**.
136136

137-
##### Functions that return computed data
137+
##### Reactive data provided by `vue-dataset`
138138
<table class="table table-bordered">
139139
<thead>
140140
<tr>
@@ -145,68 +145,40 @@ You can leverage these using `inject` to create your own **custom child componen
145145
</thead>
146146
<tbody>
147147
<tr>
148-
<td>rdsRows</td>
148+
<td>dsRows</td>
149149
<td>Array</td>
150150
<td>The indexes of the data rows currently displaying</td>
151151
</tr>
152152
<tr>
153-
<td>rdsPages</td>
153+
<td>dsPages</td>
154154
<td>Array</td>
155155
<td>The array used to create pagination links</td>
156156
</tr>
157157
<tr>
158-
<td>rdsResultsNumber</td>
158+
<td>dsResultsNumber</td>
159159
<td>Number</td>
160160
<td>The number of rows currently displaying</td>
161161
</tr>
162162
<tr>
163-
<td>rdsPagecount</td>
163+
<td>dsPagecount</td>
164164
<td>Number</td>
165165
<td>The number of pagination pages</td>
166166
</tr>
167167
<tr>
168-
<td>rdsFrom</td>
168+
<td>dsFrom</td>
169169
<td>Number</td>
170170
<td>The item "from" of paginated items currently displaying</td>
171171
</tr>
172172
<tr>
173-
<td>rdsTo</td>
173+
<td>dsTo</td>
174174
<td>Number</td>
175175
<td>The item "to" of paginated items currently displaying</td>
176176
</tr>
177177
<tr>
178-
<td>rdsPage</td>
178+
<td>dsPage</td>
179179
<td>Number</td>
180180
<td>The number of the current page in pagination</td>
181-
</tr>
182-
</tbody>
183-
</table>
184-
185-
> In order to use the functions that provide computed data you'll need to setup a computed property
186-
> as the example below.
187-
188-
Example:
189-
``` js
190-
...
191-
inject: ['rdsPage'],
192-
computed: {
193-
dsPage () {
194-
return this.rdsPage()
195-
}
196-
}
197-
...
198-
```
199-
200-
##### Data
201-
<table class="table table-bordered">
202-
<thead>
203-
<tr>
204-
<th>Property</th>
205-
<th>Type</th>
206-
<th>Description</th>
207181
</tr>
208-
</thead>
209-
<tbody>
210182
<tr>
211183
<td>dsData</td>
212184
<td>Array of Objects</td>
@@ -216,9 +188,34 @@ Example:
216188
<td>datasetI18n</td>
217189
<td>Object</td>
218190
<td>An object containing translation strings</td>
219-
</tr>
191+
</tr>
220192
</tbody>
221-
</table>
193+
</table>
194+
195+
Example:
196+
``` vue
197+
<template>
198+
<div>
199+
{{ dsRows }} - {{ dsPages }}
200+
</div>
201+
</template>
202+
203+
<script>
204+
import { inject } from 'vue'
205+
206+
export default {
207+
setup(props) {
208+
const dsRows = inject('dsRows')
209+
const dsPages = inject('dsPages')
210+
211+
return {
212+
dsRows,
213+
dsPages
214+
}
215+
}
216+
}
217+
</script>
218+
```
222219

223220
##### Methods
224221
<table class="table table-bordered w-100 d-block d-md-table">

0 commit comments

Comments
 (0)