vi-grid-builder 1.0.5 → 2.0.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 +240 -11
- package/ViGridBuilderPlugin.js +35 -36
- package/package.json +5 -2
- package/playground/.vscode/extensions.json +3 -0
- package/playground/README.md +29 -0
- package/playground/index.html +13 -0
- package/playground/jsconfig.json +8 -0
- package/playground/package-lock.json +2524 -0
- package/playground/package.json +20 -0
- package/playground/public/favicon.ico +0 -0
- package/playground/src/App.vue +84 -0
- package/playground/src/assets/base.css +86 -0
- package/playground/src/assets/logo.svg +1 -0
- package/playground/src/assets/main.css +35 -0
- package/playground/src/components/ActionsField.vue +99 -0
- package/playground/src/components/ClickableRow.vue +68 -0
- package/playground/src/components/ClientSideData.vue +86 -0
- package/playground/src/components/ColumnVisibility.vue +85 -0
- package/playground/src/components/CustomField.vue +64 -0
- package/playground/src/components/CustomHeader.vue +85 -0
- package/playground/src/components/GlobalOptions.vue +68 -0
- package/playground/src/components/LoadingSlot.vue +11 -0
- package/playground/src/components/PaginationOptions.vue +130 -0
- package/playground/src/components/RowSelect.vue +72 -0
- package/playground/src/components/ServerSideData.vue +62 -0
- package/playground/src/components/SortableColumnServerSide.vue +73 -0
- package/playground/src/components/TableStyle.vue +112 -0
- package/playground/src/components/fields/SampleCustomField.vue +24 -0
- package/playground/src/components/icons/IconCommunity.vue +7 -0
- package/playground/src/components/icons/IconDocumentation.vue +7 -0
- package/playground/src/components/icons/IconEcosystem.vue +7 -0
- package/playground/src/components/icons/IconSupport.vue +7 -0
- package/playground/src/components/icons/IconTooling.vue +19 -0
- package/playground/src/main.js +51 -0
- package/playground/vite.config.js +17 -0
- package/src/ViGridBuilder.scss +157 -58
- package/src/ViGridBuilder.vue +367 -207
- package/src/ViGridField.scss +1 -2
- package/src/ViGridField.vue +13 -6
- package/src/ViGridHeadCell.vue +32 -0
- package/src/ViGridHeadColumnCell.vue +42 -0
- package/src/ViGridHeader.vue +67 -0
- package/src/composables/useColumns.js +21 -0
- package/src/composables/useGridActions.js +17 -3
- package/src/composables/useGridSettings.js +18 -0
- package/src/composables/usePagination.js +39 -0
- package/src/composables/useRowHelper.js +38 -0
- package/src/composables/useRowSelect.js +53 -0
- package/src/composables/useSettings.js +29 -0
- package/src/composables/useSort.js +103 -0
- package/src/fields/ViGridActions.scss +0 -1
- package/src/fields/ViGridActions.vue +37 -13
- package/src/fields/ViGridCheckbox.vue +31 -0
- package/src/fields/ViGridNumber.vue +18 -0
- package/src/fields/partials/ViGridKebabMenu.scss +60 -25
- package/src/fields/partials/ViGridKebabMenu.vue +75 -54
- package/src/fields/partials/{ViGridBuilderActions.vue → ViGridSimpleActions.vue} +3 -3
- package/src/settings/GridSettings.js +24 -0
- package/vite.config.js +12 -2
- package/src/examples/App.vue +0 -123
- package/src/examples/components/TableTitle.vue +0 -20
- package/src/examples/main.js +0 -11
- /package/src/fields/partials/{ViGridBuilderActions.scss → ViGridSimpleActions.scss} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Custom header cell</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
|
|
7
|
+
<vi-grid-builder
|
|
8
|
+
stripped
|
|
9
|
+
v-bind="config"
|
|
10
|
+
:rows="rows"
|
|
11
|
+
:server-mode="false"
|
|
12
|
+
:loading="loading"
|
|
13
|
+
>
|
|
14
|
+
<template #vi-header-cell-id="props">
|
|
15
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
16
|
+
</template>
|
|
17
|
+
<template #vi-header-cell-title="props">
|
|
18
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
19
|
+
</template>
|
|
20
|
+
</vi-grid-builder>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import axios from "axios";
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
|
|
30
|
+
data: () => ({
|
|
31
|
+
|
|
32
|
+
loading: true,
|
|
33
|
+
rows: [],
|
|
34
|
+
config: {
|
|
35
|
+
rowKey: 'id',
|
|
36
|
+
columns: [{
|
|
37
|
+
label: 'ID',
|
|
38
|
+
name: 'id',
|
|
39
|
+
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Title',
|
|
43
|
+
name: 'title',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
|
|
47
|
+
pagination: {page: 1, rowsPerPage:5},
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
compact: false,
|
|
51
|
+
rowsPerPageOptions: [{
|
|
52
|
+
label: 7,
|
|
53
|
+
value: 7,
|
|
54
|
+
}, {
|
|
55
|
+
label: 15,
|
|
56
|
+
value: 15
|
|
57
|
+
}, {
|
|
58
|
+
label: 20,
|
|
59
|
+
value: 20
|
|
60
|
+
}]
|
|
61
|
+
}),
|
|
62
|
+
async mounted() {
|
|
63
|
+
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
64
|
+
.then(response => {
|
|
65
|
+
let that = this;
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
that.rows = response.data.slice(0, 5);
|
|
68
|
+
that.loading = false;
|
|
69
|
+
}, 5000)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
.catch(error => {
|
|
73
|
+
// Handle any errors
|
|
74
|
+
console.error('Error fetching data:', error);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<style scoped lang="scss">
|
|
84
|
+
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Global options settings</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
|
|
7
|
+
<vi-grid-builder
|
|
8
|
+
v-bind="config"
|
|
9
|
+
:rows="rows"
|
|
10
|
+
:server-mode="false"
|
|
11
|
+
:loading="true"
|
|
12
|
+
:compact="false"
|
|
13
|
+
:disablePagination="false"
|
|
14
|
+
v-model:pagination="config.pagination"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import axios from "axios";
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
|
|
25
|
+
data: () => ({
|
|
26
|
+
loading: true,
|
|
27
|
+
rows: [],
|
|
28
|
+
config: {
|
|
29
|
+
rowKey: 'id',
|
|
30
|
+
columns: [{
|
|
31
|
+
label: 'ID',
|
|
32
|
+
name: 'id',
|
|
33
|
+
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Title',
|
|
37
|
+
name: 'title',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
pagination: {page: 1, },
|
|
41
|
+
},
|
|
42
|
+
compact: false,
|
|
43
|
+
|
|
44
|
+
}),
|
|
45
|
+
async mounted() {
|
|
46
|
+
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
47
|
+
.then(response => {
|
|
48
|
+
let that = this;
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
that.rows = response.data.slice(0, 50);
|
|
51
|
+
that.loading = false;
|
|
52
|
+
}, 200)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
.catch(error => {
|
|
56
|
+
// Handle any errors
|
|
57
|
+
console.error('Error fetching data:', error);
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<style scoped lang="scss">
|
|
67
|
+
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Pagination otpions</h3>
|
|
5
|
+
|
|
6
|
+
<div> To define pagination options globally you can do this on installation of the grid builder plugin:
|
|
7
|
+
<pre>
|
|
8
|
+
<code>
|
|
9
|
+
const app = createApp(App);
|
|
10
|
+
app.use(ViGridBuilderPlugin, {
|
|
11
|
+
pagination: {
|
|
12
|
+
rowsPerPage:0,
|
|
13
|
+
compact: true,
|
|
14
|
+
rowsPerPageOptions:[
|
|
15
|
+
{
|
|
16
|
+
label: 7,
|
|
17
|
+
value: 7,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: 15,
|
|
21
|
+
value: 15
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 20,
|
|
25
|
+
value: 20
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'A,
|
|
29
|
+
value: 20
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
</code>
|
|
34
|
+
</pre>
|
|
35
|
+
</div>
|
|
36
|
+
<div> You can also define this options per table like in the following example</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class="example-body">
|
|
40
|
+
|
|
41
|
+
<vi-grid-builder
|
|
42
|
+
v-bind="config"
|
|
43
|
+
:rows="rows"
|
|
44
|
+
:server-mode="false"
|
|
45
|
+
:loading="loading"
|
|
46
|
+
:compact-pagination="compact"
|
|
47
|
+
v-model:pagination="config.pagination"
|
|
48
|
+
:rows-per-page-options="rowsPerPageOptions"
|
|
49
|
+
>
|
|
50
|
+
<template #vi-header-cell-id="props">
|
|
51
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
52
|
+
</template>
|
|
53
|
+
<template #vi-header-cell-title="props">
|
|
54
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
55
|
+
</template>
|
|
56
|
+
</vi-grid-builder>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import axios from "axios";
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
|
|
66
|
+
data: () => ({
|
|
67
|
+
|
|
68
|
+
loading: true,
|
|
69
|
+
rows: [],
|
|
70
|
+
config: {
|
|
71
|
+
rowKey: 'id',
|
|
72
|
+
columns: [{
|
|
73
|
+
label: 'ID',
|
|
74
|
+
name: 'id',
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: 'Title',
|
|
79
|
+
name: 'title',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
|
|
83
|
+
pagination: {page: 1, rowsPerPage: 0},
|
|
84
|
+
|
|
85
|
+
},
|
|
86
|
+
compact: false,
|
|
87
|
+
rowsPerPageOptions: [{
|
|
88
|
+
label: 5,
|
|
89
|
+
value: 5,
|
|
90
|
+
}, {
|
|
91
|
+
label: 15,
|
|
92
|
+
value: 15
|
|
93
|
+
}, {
|
|
94
|
+
label: 20,
|
|
95
|
+
value: 20
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: 25,
|
|
99
|
+
value: 25
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
label: "All",
|
|
104
|
+
value: 0
|
|
105
|
+
}]
|
|
106
|
+
}),
|
|
107
|
+
async mounted() {
|
|
108
|
+
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
109
|
+
.then(response => {
|
|
110
|
+
let that = this;
|
|
111
|
+
setTimeout(() => {
|
|
112
|
+
that.rows = response.data.slice(0, 30);
|
|
113
|
+
that.loading = false;
|
|
114
|
+
}, 2000)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
.catch(error => {
|
|
118
|
+
// Handle any errors
|
|
119
|
+
console.error('Error fetching data:', error);
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<style scoped lang="scss">
|
|
129
|
+
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Row select</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
|
|
7
|
+
<div> Selected rows ids {{selectedRows}}</div>
|
|
8
|
+
<vi-grid-builder
|
|
9
|
+
v-bind="config"
|
|
10
|
+
:rows="rows"
|
|
11
|
+
:server-mode="false"
|
|
12
|
+
:loading="loading"
|
|
13
|
+
v-model:pagination="pagination"
|
|
14
|
+
selectable
|
|
15
|
+
@selectedRowsUpdate ="selectedRows = $event"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import axios from "axios";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
|
|
27
|
+
data: () => ({
|
|
28
|
+
|
|
29
|
+
loading: true,
|
|
30
|
+
rows: [],
|
|
31
|
+
config: {
|
|
32
|
+
rowKey: 'id',
|
|
33
|
+
columns: [{
|
|
34
|
+
label: 'ID',
|
|
35
|
+
name: 'id',
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Title',
|
|
40
|
+
name: 'title',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
pagination: {page: 1, rowsPerPage: 10}
|
|
45
|
+
},
|
|
46
|
+
selectedRows:[],
|
|
47
|
+
pagination: {page: 1, rowsPerPage: 5, totalRows:10}
|
|
48
|
+
}),
|
|
49
|
+
async mounted() {
|
|
50
|
+
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
51
|
+
.then(response => {
|
|
52
|
+
let that = this;
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
that.rows = response.data.slice(0, 10);
|
|
55
|
+
that.loading = false;
|
|
56
|
+
}, 4000)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
.catch(error => {
|
|
60
|
+
// Handle any errors
|
|
61
|
+
console.error('Error fetching data:', error);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<style scoped lang="scss">
|
|
71
|
+
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Server-side data</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
|
|
7
|
+
<vi-grid-builder
|
|
8
|
+
v-bind="config"
|
|
9
|
+
:rows="rows"
|
|
10
|
+
:pagination="pagination"
|
|
11
|
+
:fetch-server-data="fetchData"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import axios from "axios";
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
|
|
23
|
+
data: () => ({
|
|
24
|
+
|
|
25
|
+
loading: true,
|
|
26
|
+
rows: [],
|
|
27
|
+
config: {
|
|
28
|
+
rowKey: 'id',
|
|
29
|
+
columns: [{
|
|
30
|
+
label: 'ID',
|
|
31
|
+
name: 'id',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Title',
|
|
35
|
+
name: 'title',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
selectedRows: [],
|
|
40
|
+
pagination: {
|
|
41
|
+
page: 1,
|
|
42
|
+
rowsPerPage: 5,
|
|
43
|
+
rowsNumber:100
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
methods:{
|
|
47
|
+
fetchData(args){
|
|
48
|
+
//todo sort example
|
|
49
|
+
return axios.get(`https://jsonplaceholder.typicode.com/posts?_page=${args.pagination.page}&_limit=${args.pagination.rowsPerPage}`)
|
|
50
|
+
.then(response => {
|
|
51
|
+
|
|
52
|
+
this.rows = response.data;
|
|
53
|
+
this.pagination = {
|
|
54
|
+
...this.pagination,
|
|
55
|
+
...args.pagination,
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Sortable columns - server side</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
<vi-grid-builder
|
|
7
|
+
v-bind="config"
|
|
8
|
+
:rows="rows"
|
|
9
|
+
:fetch-server-data="fetchData"
|
|
10
|
+
selectable
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import axios from "axios";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
|
|
22
|
+
data: () => ({
|
|
23
|
+
|
|
24
|
+
loading: true,
|
|
25
|
+
rows: [],
|
|
26
|
+
config: {
|
|
27
|
+
rowKey: 'id',
|
|
28
|
+
columns: [{
|
|
29
|
+
label: 'ID',
|
|
30
|
+
name: 'id',
|
|
31
|
+
sortable: true,
|
|
32
|
+
align: 'center',
|
|
33
|
+
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Title',
|
|
37
|
+
name: 'title',
|
|
38
|
+
sortable: true,
|
|
39
|
+
align: 'left',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
pagination: {page: 1, rowsPerPage: 5, rowsNumber: 100}
|
|
44
|
+
},
|
|
45
|
+
selectedRows: [],
|
|
46
|
+
}),
|
|
47
|
+
methods: {
|
|
48
|
+
async fetchData(args) {
|
|
49
|
+
return new Promise(async (resolve, reject) => {
|
|
50
|
+
await axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
51
|
+
.then(response => {
|
|
52
|
+
this.rows = response.data.slice(0, 5);
|
|
53
|
+
this.config = {
|
|
54
|
+
...this.config,
|
|
55
|
+
pagination: {
|
|
56
|
+
...args.pagination,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
resolve()
|
|
63
|
+
}, 5000);
|
|
64
|
+
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
|
|
4
|
+
<h3 id="custom-header">Table style</h3>
|
|
5
|
+
<div class="example-body">
|
|
6
|
+
|
|
7
|
+
<div style="display: flex; justify-content: space-between; padding: 20px 0">
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<label>Bordered</label> <input type="checkbox" v-model="bordered">
|
|
11
|
+
</div>
|
|
12
|
+
<div>
|
|
13
|
+
<label>Stripped</label> <input type="checkbox" v-model="stripped">
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<label>Compact pagination</label> <input type="checkbox" v-model="compactPagination">
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<label>Align content</label>
|
|
20
|
+
<select v-model="alignment">
|
|
21
|
+
<option value="left">Left</option>
|
|
22
|
+
<option value="center">Center</option>
|
|
23
|
+
<option value="right">Right</option>
|
|
24
|
+
</select>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- :align="alignment" default aginment for table-->
|
|
29
|
+
<vi-grid-builder
|
|
30
|
+
:bordered="bordered"
|
|
31
|
+
:stripped="stripped"
|
|
32
|
+
:compact-pagination="compactPagination"
|
|
33
|
+
v-bind="config"
|
|
34
|
+
:rows="rows"
|
|
35
|
+
:server-mode="false"
|
|
36
|
+
:loading="loading"
|
|
37
|
+
selectable
|
|
38
|
+
:align="alignment"
|
|
39
|
+
|
|
40
|
+
>
|
|
41
|
+
<template #vi-header-cell-id="props">
|
|
42
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
43
|
+
</template>
|
|
44
|
+
<template #vi-header-cell-title="props">
|
|
45
|
+
<div> Custom header for column {{ props.column.name }}</div>
|
|
46
|
+
</template>
|
|
47
|
+
</vi-grid-builder>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import axios from "axios";
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
|
|
57
|
+
data: () => ({
|
|
58
|
+
|
|
59
|
+
bordered: false,
|
|
60
|
+
stripped: false,
|
|
61
|
+
compactPagination: false,
|
|
62
|
+
loading: true,
|
|
63
|
+
alignment: 'left',
|
|
64
|
+
rows: [],
|
|
65
|
+
|
|
66
|
+
}),
|
|
67
|
+
computed: {
|
|
68
|
+
|
|
69
|
+
config() {
|
|
70
|
+
return {
|
|
71
|
+
rowKey: 'id',
|
|
72
|
+
columns: [{
|
|
73
|
+
label: 'ID',
|
|
74
|
+
name: 'id',
|
|
75
|
+
align: this.alignment,
|
|
76
|
+
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Title',
|
|
80
|
+
name: 'title',
|
|
81
|
+
align: this.alignment,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
|
|
85
|
+
pagination: {page: 1, rowsPerPage: 10}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async mounted() {
|
|
90
|
+
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
91
|
+
.then(response => {
|
|
92
|
+
let that = this;
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
that.rows = response.data.slice(0, 5);
|
|
95
|
+
that.loading = false;
|
|
96
|
+
}, 3000)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
.catch(error => {
|
|
100
|
+
// Handle any errors
|
|
101
|
+
console.error('Error fetching data:', error);
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<style scoped lang="scss">
|
|
111
|
+
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div> Custom field for {{field.name}} wiht value {{value}}</div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
props: {
|
|
9
|
+
field: {
|
|
10
|
+
type: Object,
|
|
11
|
+
},
|
|
12
|
+
value: {},
|
|
13
|
+
originalValue: {},
|
|
14
|
+
row: {
|
|
15
|
+
type: Object,
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped lang="scss">
|
|
23
|
+
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
|
|
3
|
+
<path
|
|
4
|
+
d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" fill="currentColor">
|
|
3
|
+
<path
|
|
4
|
+
d="M11 2.253a1 1 0 1 0-2 0h2zm-2 13a1 1 0 1 0 2 0H9zm.447-12.167a1 1 0 1 0 1.107-1.666L9.447 3.086zM1 2.253L.447 1.42A1 1 0 0 0 0 2.253h1zm0 13H0a1 1 0 0 0 1.553.833L1 15.253zm8.447.833a1 1 0 1 0 1.107-1.666l-1.107 1.666zm0-14.666a1 1 0 1 0 1.107 1.666L9.447 1.42zM19 2.253h1a1 1 0 0 0-.447-.833L19 2.253zm0 13l-.553.833A1 1 0 0 0 20 15.253h-1zm-9.553-.833a1 1 0 1 0 1.107 1.666L9.447 14.42zM9 2.253v13h2v-13H9zm1.553-.833C9.203.523 7.42 0 5.5 0v2c1.572 0 2.961.431 3.947 1.086l1.107-1.666zM5.5 0C3.58 0 1.797.523.447 1.42l1.107 1.666C2.539 2.431 3.928 2 5.5 2V0zM0 2.253v13h2v-13H0zm1.553 13.833C2.539 15.431 3.928 15 5.5 15v-2c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM5.5 15c1.572 0 2.961.431 3.947 1.086l1.107-1.666C9.203 13.523 7.42 13 5.5 13v2zm5.053-11.914C11.539 2.431 12.928 2 14.5 2V0c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM14.5 2c1.573 0 2.961.431 3.947 1.086l1.107-1.666C18.203.523 16.421 0 14.5 0v2zm3.5.253v13h2v-13h-2zm1.553 12.167C18.203 13.523 16.421 13 14.5 13v2c1.573 0 2.961.431 3.947 1.086l1.107-1.666zM14.5 13c-1.92 0-3.703.523-5.053 1.42l1.107 1.666C11.539 15.431 12.928 15 14.5 15v-2z"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="20" fill="currentColor">
|
|
3
|
+
<path
|
|
4
|
+
d="M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
|
|
3
|
+
<path
|
|
4
|
+
d="M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
7
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- This icon is from <https://github.com/Templarian/MaterialDesign>, distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license-->
|
|
2
|
+
<template>
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
role="img"
|
|
8
|
+
class="iconify iconify--mdi"
|
|
9
|
+
width="24"
|
|
10
|
+
height="24"
|
|
11
|
+
preserveAspectRatio="xMidYMid meet"
|
|
12
|
+
viewBox="0 0 24 24"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z"
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
></path>
|
|
18
|
+
</svg>
|
|
19
|
+
</template>
|