vi-grid-builder 2.0.7 → 2.0.8
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/dist/style.css +1 -0
- package/dist/vi-grid-builder.js +5714 -0
- package/dist/vi-grid-builder.umd.cjs +565 -0
- package/package.json +13 -1
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/vi-grid-builder.iml +0 -8
- package/.idea/watcherTasks.xml +0 -4
- package/.vscode/extensions.json +0 -3
- package/ViGridBuilderPlugin.js +0 -50
- package/playground/.vscode/extensions.json +0 -3
- package/playground/README.md +0 -29
- package/playground/index.html +0 -13
- package/playground/jsconfig.json +0 -8
- package/playground/package-lock.json +0 -2524
- package/playground/package.json +0 -20
- package/playground/public/favicon.ico +0 -0
- package/playground/src/App.vue +0 -86
- package/playground/src/assets/base.css +0 -86
- package/playground/src/assets/logo.svg +0 -1
- package/playground/src/assets/main.css +0 -35
- package/playground/src/components/ActionsField.vue +0 -99
- package/playground/src/components/ClickableRow.vue +0 -68
- package/playground/src/components/ClientSideData.vue +0 -86
- package/playground/src/components/ColumnVisibility.vue +0 -85
- package/playground/src/components/CustomField.vue +0 -64
- package/playground/src/components/CustomHeader.vue +0 -85
- package/playground/src/components/FieldTypes.vue +0 -150
- package/playground/src/components/GlobalOptions.vue +0 -68
- package/playground/src/components/PaginationOptions.vue +0 -130
- package/playground/src/components/RowSelect.vue +0 -72
- package/playground/src/components/ServerSideData.vue +0 -62
- package/playground/src/components/SortableColumnServerSide.vue +0 -73
- package/playground/src/components/TableStyle.vue +0 -112
- package/playground/src/components/fields/SampleCustomField.vue +0 -24
- package/playground/src/components/icons/IconCommunity.vue +0 -7
- package/playground/src/components/icons/IconDocumentation.vue +0 -7
- package/playground/src/components/icons/IconEcosystem.vue +0 -7
- package/playground/src/components/icons/IconSupport.vue +0 -7
- package/playground/src/components/icons/IconTooling.vue +0 -19
- package/playground/src/main.js +0 -49
- package/playground/vite.config.js +0 -17
- package/src/ViGridBuilder.scss +0 -189
- package/src/ViGridBuilder.vue +0 -393
- package/src/ViGridField.scss +0 -1
- package/src/ViGridField.vue +0 -90
- package/src/ViGridHeadCell.vue +0 -32
- package/src/ViGridHeadColumnCell.vue +0 -42
- package/src/ViGridHeader.vue +0 -67
- package/src/composables/useColumns.js +0 -21
- package/src/composables/useGridActions.js +0 -32
- package/src/composables/useGridSettings.js +0 -18
- package/src/composables/usePagination.js +0 -39
- package/src/composables/useRowHelper.js +0 -40
- package/src/composables/useRowSelect.js +0 -51
- package/src/composables/useSettings.js +0 -29
- package/src/composables/useSort.js +0 -125
- package/src/fields/ViGridActions.scss +0 -2
- package/src/fields/ViGridActions.vue +0 -83
- package/src/fields/ViGridBadge.scss +0 -13
- package/src/fields/ViGridBadge.vue +0 -20
- package/src/fields/ViGridCheckbox.vue +0 -31
- package/src/fields/ViGridDate.scss +0 -3
- package/src/fields/ViGridDate.vue +0 -40
- package/src/fields/ViGridImage.scss +0 -7
- package/src/fields/ViGridImage.vue +0 -18
- package/src/fields/ViGridLink.scss +0 -3
- package/src/fields/ViGridLink.vue +0 -28
- package/src/fields/ViGridNumber.scss +0 -3
- package/src/fields/ViGridNumber.vue +0 -30
- package/src/fields/ViGridText.scss +0 -0
- package/src/fields/ViGridText.vue +0 -18
- package/src/fields/partials/ViGridKebabMenu.scss +0 -65
- package/src/fields/partials/ViGridKebabMenu.vue +0 -90
- package/src/fields/partials/ViGridSimpleActions.scss +0 -4
- package/src/fields/partials/ViGridSimpleActions.vue +0 -25
- package/src/mixins/field-mixin.js +0 -13
- package/src/settings/DateSettings.js +0 -7
- package/src/settings/GridSettings.js +0 -24
- package/vite.config.js +0 -17
- /package/{public → dist}/vite.svg +0 -0
package/playground/package.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vi-grid-builder-playground",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"preview": "vite preview"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"axios": "^1.7.7",
|
|
13
|
-
"vue": "^3.5.12"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@vitejs/plugin-vue": "^5.1.4",
|
|
17
|
-
"vite": "^5.4.10",
|
|
18
|
-
"vite-plugin-vue-devtools": "^7.5.4"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
Binary file
|
package/playground/src/App.vue
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<div>
|
|
4
|
-
<h1> Examples</h1>
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<field-types/>
|
|
8
|
-
<custom-header/>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<custom-field/>
|
|
12
|
-
|
|
13
|
-
<clickable-row/>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<column-visibility/>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<table-style/>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<row-select/>
|
|
23
|
-
|
|
24
|
-
<sortable-column-server-side/>
|
|
25
|
-
|
|
26
|
-
<client-side-data/>
|
|
27
|
-
|
|
28
|
-
<server-side-data/>
|
|
29
|
-
|
|
30
|
-
<actions-field/>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<pagination-options/>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<script>
|
|
40
|
-
import CustomHeader from "@/components/CustomHeader.vue";
|
|
41
|
-
import ClickableRow from "@/components/ClickableRow.vue";
|
|
42
|
-
import ColumnVisibility from "@/components/ColumnVisibility.vue";
|
|
43
|
-
import RowSelect from "@/components/RowSelect.vue";
|
|
44
|
-
import SortableColumnServerSide from "@/components/SortableColumnServerSide.vue";
|
|
45
|
-
import ClientSideData from "@/components/ClientSideData.vue";
|
|
46
|
-
import ServerSideData from "@/components/ServerSideData.vue";
|
|
47
|
-
import ActionsField from "@/components/ActionsField.vue";
|
|
48
|
-
import TableStyle from "@/components/TableStyle.vue";
|
|
49
|
-
import PaginationOptions from "@/components/PaginationOptions.vue";
|
|
50
|
-
import CustomField from "@/components/CustomField.vue";
|
|
51
|
-
import GlobalOptions from "@/components/GlobalOptions.vue";
|
|
52
|
-
import FieldTypes from "@/components/FieldTypes.vue";
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export default {
|
|
56
|
-
components: {
|
|
57
|
-
FieldTypes,
|
|
58
|
-
GlobalOptions,
|
|
59
|
-
CustomField,
|
|
60
|
-
PaginationOptions,
|
|
61
|
-
TableStyle,
|
|
62
|
-
ActionsField,
|
|
63
|
-
ServerSideData,
|
|
64
|
-
ClientSideData, SortableColumnServerSide, RowSelect, ColumnVisibility, ClickableRow, CustomHeader
|
|
65
|
-
},
|
|
66
|
-
}
|
|
67
|
-
</script>
|
|
68
|
-
<style>
|
|
69
|
-
.example-container {
|
|
70
|
-
padding: 30px;
|
|
71
|
-
margin-top: 30px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.example-container > h3 {
|
|
75
|
-
font-weight: bold;
|
|
76
|
-
margin: 20px 0 30px 0;
|
|
77
|
-
text-transform: uppercase;
|
|
78
|
-
background-color: white;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.example-container > .example-body {
|
|
82
|
-
background-color: #f8f8f8;
|
|
83
|
-
text-align: center;
|
|
84
|
-
padding: 20px;
|
|
85
|
-
}
|
|
86
|
-
</style>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* color palette from <https://github.com/vuejs/theme> */
|
|
2
|
-
:root {
|
|
3
|
-
--vt-c-white: #ffffff;
|
|
4
|
-
--vt-c-white-soft: #f8f8f8;
|
|
5
|
-
--vt-c-white-mute: #f2f2f2;
|
|
6
|
-
|
|
7
|
-
--vt-c-black: #181818;
|
|
8
|
-
--vt-c-black-soft: #222222;
|
|
9
|
-
--vt-c-black-mute: #282828;
|
|
10
|
-
|
|
11
|
-
--vt-c-indigo: #2c3e50;
|
|
12
|
-
|
|
13
|
-
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
|
14
|
-
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
|
15
|
-
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
|
16
|
-
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
|
17
|
-
|
|
18
|
-
--vt-c-text-light-1: var(--vt-c-indigo);
|
|
19
|
-
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
|
20
|
-
--vt-c-text-dark-1: var(--vt-c-white);
|
|
21
|
-
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* semantic color variables for this project */
|
|
25
|
-
:root {
|
|
26
|
-
--color-background: var(--vt-c-white);
|
|
27
|
-
--color-background-soft: var(--vt-c-white-soft);
|
|
28
|
-
--color-background-mute: var(--vt-c-white-mute);
|
|
29
|
-
|
|
30
|
-
--color-border: var(--vt-c-divider-light-2);
|
|
31
|
-
--color-border-hover: var(--vt-c-divider-light-1);
|
|
32
|
-
|
|
33
|
-
--color-heading: var(--vt-c-text-light-1);
|
|
34
|
-
--color-text: var(--vt-c-text-light-1);
|
|
35
|
-
|
|
36
|
-
--section-gap: 160px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@media (prefers-color-scheme: dark) {
|
|
40
|
-
:root {
|
|
41
|
-
--color-background: var(--vt-c-black);
|
|
42
|
-
--color-background-soft: var(--vt-c-black-soft);
|
|
43
|
-
--color-background-mute: var(--vt-c-black-mute);
|
|
44
|
-
|
|
45
|
-
--color-border: var(--vt-c-divider-dark-2);
|
|
46
|
-
--color-border-hover: var(--vt-c-divider-dark-1);
|
|
47
|
-
|
|
48
|
-
--color-heading: var(--vt-c-text-dark-1);
|
|
49
|
-
--color-text: var(--vt-c-text-dark-2);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
*,
|
|
54
|
-
*::before,
|
|
55
|
-
*::after {
|
|
56
|
-
box-sizing: border-box;
|
|
57
|
-
margin: 0;
|
|
58
|
-
font-weight: normal;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
body {
|
|
62
|
-
min-height: 100vh;
|
|
63
|
-
color: var(--color-text);
|
|
64
|
-
background: var(--color-background);
|
|
65
|
-
transition:
|
|
66
|
-
color 0.5s,
|
|
67
|
-
background-color 0.5s;
|
|
68
|
-
line-height: 1.6;
|
|
69
|
-
font-family:
|
|
70
|
-
Inter,
|
|
71
|
-
-apple-system,
|
|
72
|
-
BlinkMacSystemFont,
|
|
73
|
-
'Segoe UI',
|
|
74
|
-
Roboto,
|
|
75
|
-
Oxygen,
|
|
76
|
-
Ubuntu,
|
|
77
|
-
Cantarell,
|
|
78
|
-
'Fira Sans',
|
|
79
|
-
'Droid Sans',
|
|
80
|
-
'Helvetica Neue',
|
|
81
|
-
sans-serif;
|
|
82
|
-
font-size: 15px;
|
|
83
|
-
text-rendering: optimizeLegibility;
|
|
84
|
-
-webkit-font-smoothing: antialiased;
|
|
85
|
-
-moz-osx-font-smoothing: grayscale;
|
|
86
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
@import 'base.css';
|
|
2
|
-
|
|
3
|
-
#app {
|
|
4
|
-
max-width: 1280px;
|
|
5
|
-
margin: 0 auto;
|
|
6
|
-
padding: 2rem;
|
|
7
|
-
font-weight: normal;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
a,
|
|
11
|
-
.green {
|
|
12
|
-
text-decoration: none;
|
|
13
|
-
color: hsla(160, 100%, 37%, 1);
|
|
14
|
-
transition: 0.4s;
|
|
15
|
-
padding: 3px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (hover: hover) {
|
|
19
|
-
a:hover {
|
|
20
|
-
background-color: hsla(160, 100%, 37%, 0.2);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@media (min-width: 1024px) {
|
|
25
|
-
body {
|
|
26
|
-
/*display: flex;*/
|
|
27
|
-
/*place-items: center;*/
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
#app {
|
|
31
|
-
/*display: grid;*/
|
|
32
|
-
/*grid-template-columns: 1fr 1fr;*/
|
|
33
|
-
/*padding: 0 2rem;*/
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
|
|
4
|
-
<h3 id="custom-header">Actions field</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
|
-
clickable-row
|
|
13
|
-
selectable
|
|
14
|
-
@view="viewRow"
|
|
15
|
-
@delete="removeRow"
|
|
16
|
-
@rowClicked="clickRow"
|
|
17
|
-
/>
|
|
18
|
-
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script>
|
|
24
|
-
import axios from "axios";
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
|
|
28
|
-
data: () => ({
|
|
29
|
-
|
|
30
|
-
loading: true,
|
|
31
|
-
rows: [],
|
|
32
|
-
config: {
|
|
33
|
-
rowKey: 'id',
|
|
34
|
-
columns: [{
|
|
35
|
-
label: 'ID',
|
|
36
|
-
name: 'id',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: 'Title',
|
|
40
|
-
name: 'title',
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
label: '',
|
|
45
|
-
name: 'userId',
|
|
46
|
-
type:'actions',
|
|
47
|
-
kebab:true,
|
|
48
|
-
actions:[
|
|
49
|
-
{
|
|
50
|
-
name:'Edit row',
|
|
51
|
-
action:'edit',
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
name:'View row',
|
|
56
|
-
action:'view',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name:'Remove row',
|
|
60
|
-
action:'delete',
|
|
61
|
-
isVisible: (row) =>row.id === 1
|
|
62
|
-
},
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
selectedRows: [],
|
|
68
|
-
pagination: {
|
|
69
|
-
page: 1,
|
|
70
|
-
rowsPerPage: 10,
|
|
71
|
-
rowsNumber:100
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
methods:{
|
|
75
|
-
clickRow(row){
|
|
76
|
-
alert('Row clicked'+row.id)
|
|
77
|
-
},
|
|
78
|
-
viewRow(row){
|
|
79
|
-
alert(`View row ${row.id}`);
|
|
80
|
-
},
|
|
81
|
-
removeRow(row){
|
|
82
|
-
alert(`Delete row with id ${row.id} ?`);
|
|
83
|
-
},
|
|
84
|
-
fetchData(args){
|
|
85
|
-
//todo sort example
|
|
86
|
-
return axios.get(`https://jsonplaceholder.typicode.com/posts?_page=${args.pagination.page}&_limit=${args.pagination.rowsPerPage}`)
|
|
87
|
-
.then(response => {
|
|
88
|
-
|
|
89
|
-
this.rows = response.data;
|
|
90
|
-
this.pagination = {
|
|
91
|
-
...this.pagination,
|
|
92
|
-
...args.pagination,
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
</script>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
|
|
4
|
-
<h3 id="custom-header">Clickable row</h3>
|
|
5
|
-
<div class="example-body">
|
|
6
|
-
|
|
7
|
-
<vi-grid-builder
|
|
8
|
-
v-bind="config"
|
|
9
|
-
:rows="rows"
|
|
10
|
-
:server-mode="false"
|
|
11
|
-
:loading="loading"
|
|
12
|
-
clickable-row
|
|
13
|
-
@rowClicked="onRowClicked"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import axios from "axios";
|
|
21
|
-
import {getCurrentInstance} from "vue";
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
|
|
25
|
-
data: () => ({
|
|
26
|
-
|
|
27
|
-
loading: true,
|
|
28
|
-
rows: [],
|
|
29
|
-
config: {
|
|
30
|
-
rowKey: 'id',
|
|
31
|
-
columns: [{
|
|
32
|
-
label: 'ID',
|
|
33
|
-
name: 'id',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: 'Title',
|
|
37
|
-
name: 'title',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
pagination: {page: 1, rowsPerPage: 10}
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
|
-
methods: {
|
|
45
|
-
onRowClicked(row) {
|
|
46
|
-
alert(`Clickable row ${row.id} with title ${row.title}`);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
async mounted() {
|
|
50
|
-
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
51
|
-
.then(response => {
|
|
52
|
-
this.rows = response.data.slice(0, 5);
|
|
53
|
-
this.loading = false;
|
|
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>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
|
|
4
|
-
<h3 id="custom-header">Client side data</h3>
|
|
5
|
-
<div class="example-body">
|
|
6
|
-
|
|
7
|
-
<div></div>
|
|
8
|
-
<vi-grid-builder
|
|
9
|
-
v-bind="config"
|
|
10
|
-
:rows="rows"
|
|
11
|
-
:server-mode="false"
|
|
12
|
-
v-model:pagination="pagination"
|
|
13
|
-
:loading="loading"
|
|
14
|
-
selectable
|
|
15
|
-
@selectedRowsUpdate="selectedRows = $event"
|
|
16
|
-
/>
|
|
17
|
-
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import axios from "axios";
|
|
24
|
-
|
|
25
|
-
function shuffleArray(array) {
|
|
26
|
-
const shuffled = [...array]; // Create a copy to avoid mutating the original array
|
|
27
|
-
for (let i = shuffled.length - 1; i > 0; i--) {
|
|
28
|
-
const randomIndex = Math.floor(Math.random() * (i + 1));
|
|
29
|
-
[shuffled[i], shuffled[randomIndex]] = [shuffled[randomIndex], shuffled[i]];
|
|
30
|
-
}
|
|
31
|
-
return shuffled;
|
|
32
|
-
}
|
|
33
|
-
export default {
|
|
34
|
-
|
|
35
|
-
data: () => ({
|
|
36
|
-
|
|
37
|
-
loading: true,
|
|
38
|
-
rows: [],
|
|
39
|
-
config: {
|
|
40
|
-
rowKey: 'id',
|
|
41
|
-
columns: [{
|
|
42
|
-
label: 'ID',
|
|
43
|
-
name: 'id',
|
|
44
|
-
sortable: true,
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: 'Title',
|
|
49
|
-
name: 'title',
|
|
50
|
-
sortable: true,
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
pagination: {page: 1, rowsPerPage: 10}
|
|
55
|
-
},
|
|
56
|
-
selectedRows: [],
|
|
57
|
-
pagination: {
|
|
58
|
-
page: 1,
|
|
59
|
-
rowsPerPage: 5,
|
|
60
|
-
totalRows: 11,
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
async mounted() {
|
|
64
|
-
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
65
|
-
.then(response => {
|
|
66
|
-
let that = this;
|
|
67
|
-
setTimeout(() => {
|
|
68
|
-
that.rows = shuffleArray(response.data.slice(0, 11));
|
|
69
|
-
that.loading = false;
|
|
70
|
-
}, 4000)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
.catch(error => {
|
|
74
|
-
// Handle any errors
|
|
75
|
-
console.error('Error fetching data:', error);
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<style scoped lang="scss">
|
|
85
|
-
|
|
86
|
-
</style>
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
|
|
4
|
-
<h3 id="custom-header">Column visibility</h3>
|
|
5
|
-
<div>
|
|
6
|
-
<input type="checkbox" v-model="showContentColumn"><label> Show 'content' column</label>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="example-body">
|
|
9
|
-
<vi-grid-builder
|
|
10
|
-
v-bind="config"
|
|
11
|
-
:rows="rows"
|
|
12
|
-
:server-mode="false"
|
|
13
|
-
:loading="loading"
|
|
14
|
-
clickable-row
|
|
15
|
-
/>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
import axios from "axios";
|
|
23
|
-
import {getCurrentInstance} from "vue";
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
|
|
27
|
-
data: () => ({
|
|
28
|
-
|
|
29
|
-
loading: true,
|
|
30
|
-
rows: [],
|
|
31
|
-
showContentColumn: false,
|
|
32
|
-
|
|
33
|
-
}),
|
|
34
|
-
computed: {
|
|
35
|
-
config() {
|
|
36
|
-
return {
|
|
37
|
-
rowKey: 'id',
|
|
38
|
-
|
|
39
|
-
columns: [{
|
|
40
|
-
label: 'ID',
|
|
41
|
-
name: 'id',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'User ID',
|
|
45
|
-
name: 'userId',
|
|
46
|
-
isVisible: false
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
label: 'Title',
|
|
50
|
-
name: 'title',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: 'Content',
|
|
54
|
-
name: 'body',
|
|
55
|
-
isVisible: this.showContentColumn
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
],
|
|
59
|
-
pagination: {page: 1, rowsPerPage: 10}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
async mounted() {
|
|
67
|
-
return axios.get('https://jsonplaceholder.typicode.com/posts')
|
|
68
|
-
.then(response => {
|
|
69
|
-
this.rows = response.data.slice(0, 5);
|
|
70
|
-
this.loading = false;
|
|
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>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
|
|
4
|
-
<h3 id="custom-header">Custom field </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
|
-
type:'sample-custom-field'
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: 'Title',
|
|
36
|
-
name: 'title',
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
selectedRows: [],
|
|
42
|
-
pagination: {
|
|
43
|
-
page: 1,
|
|
44
|
-
rowsPerPage: 5,
|
|
45
|
-
rowsNumber:100
|
|
46
|
-
}
|
|
47
|
-
}),
|
|
48
|
-
methods:{
|
|
49
|
-
fetchData(args){
|
|
50
|
-
//todo sort example
|
|
51
|
-
return axios.get(`https://jsonplaceholder.typicode.com/posts?_page=${args.pagination.page}&_limit=${args.pagination.rowsPerPage}`)
|
|
52
|
-
.then(response => {
|
|
53
|
-
|
|
54
|
-
this.rows = response.data;
|
|
55
|
-
this.pagination = {
|
|
56
|
-
...this.pagination,
|
|
57
|
-
...args.pagination,
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
</script>
|