vi-grid-builder 2.0.6 → 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.
Files changed (77) hide show
  1. package/dist/style.css +1 -0
  2. package/dist/vi-grid-builder.js +5714 -0
  3. package/dist/vi-grid-builder.umd.cjs +565 -0
  4. package/package.json +13 -1
  5. package/.vscode/extensions.json +0 -3
  6. package/ViGridBuilderPlugin.js +0 -50
  7. package/playground/.vscode/extensions.json +0 -3
  8. package/playground/README.md +0 -29
  9. package/playground/index.html +0 -13
  10. package/playground/jsconfig.json +0 -8
  11. package/playground/package-lock.json +0 -2524
  12. package/playground/package.json +0 -20
  13. package/playground/public/favicon.ico +0 -0
  14. package/playground/src/App.vue +0 -86
  15. package/playground/src/assets/base.css +0 -86
  16. package/playground/src/assets/logo.svg +0 -1
  17. package/playground/src/assets/main.css +0 -35
  18. package/playground/src/components/ActionsField.vue +0 -99
  19. package/playground/src/components/ClickableRow.vue +0 -68
  20. package/playground/src/components/ClientSideData.vue +0 -86
  21. package/playground/src/components/ColumnVisibility.vue +0 -85
  22. package/playground/src/components/CustomField.vue +0 -64
  23. package/playground/src/components/CustomHeader.vue +0 -85
  24. package/playground/src/components/FieldTypes.vue +0 -150
  25. package/playground/src/components/GlobalOptions.vue +0 -68
  26. package/playground/src/components/PaginationOptions.vue +0 -130
  27. package/playground/src/components/RowSelect.vue +0 -72
  28. package/playground/src/components/ServerSideData.vue +0 -62
  29. package/playground/src/components/SortableColumnServerSide.vue +0 -73
  30. package/playground/src/components/TableStyle.vue +0 -112
  31. package/playground/src/components/fields/SampleCustomField.vue +0 -24
  32. package/playground/src/components/icons/IconCommunity.vue +0 -7
  33. package/playground/src/components/icons/IconDocumentation.vue +0 -7
  34. package/playground/src/components/icons/IconEcosystem.vue +0 -7
  35. package/playground/src/components/icons/IconSupport.vue +0 -7
  36. package/playground/src/components/icons/IconTooling.vue +0 -19
  37. package/playground/src/main.js +0 -49
  38. package/playground/vite.config.js +0 -17
  39. package/src/ViGridBuilder.scss +0 -189
  40. package/src/ViGridBuilder.vue +0 -393
  41. package/src/ViGridField.scss +0 -1
  42. package/src/ViGridField.vue +0 -90
  43. package/src/ViGridHeadCell.vue +0 -32
  44. package/src/ViGridHeadColumnCell.vue +0 -42
  45. package/src/ViGridHeader.vue +0 -67
  46. package/src/composables/useColumns.js +0 -21
  47. package/src/composables/useGridActions.js +0 -32
  48. package/src/composables/useGridSettings.js +0 -18
  49. package/src/composables/usePagination.js +0 -39
  50. package/src/composables/useRowHelper.js +0 -40
  51. package/src/composables/useRowSelect.js +0 -51
  52. package/src/composables/useSettings.js +0 -29
  53. package/src/composables/useSort.js +0 -125
  54. package/src/fields/ViGridActions.scss +0 -2
  55. package/src/fields/ViGridActions.vue +0 -83
  56. package/src/fields/ViGridBadge.scss +0 -13
  57. package/src/fields/ViGridBadge.vue +0 -20
  58. package/src/fields/ViGridCheckbox.vue +0 -31
  59. package/src/fields/ViGridDate.scss +0 -3
  60. package/src/fields/ViGridDate.vue +0 -40
  61. package/src/fields/ViGridImage.scss +0 -7
  62. package/src/fields/ViGridImage.vue +0 -18
  63. package/src/fields/ViGridLink.scss +0 -3
  64. package/src/fields/ViGridLink.vue +0 -28
  65. package/src/fields/ViGridNumber.scss +0 -3
  66. package/src/fields/ViGridNumber.vue +0 -30
  67. package/src/fields/ViGridText.scss +0 -0
  68. package/src/fields/ViGridText.vue +0 -18
  69. package/src/fields/partials/ViGridKebabMenu.scss +0 -65
  70. package/src/fields/partials/ViGridKebabMenu.vue +0 -90
  71. package/src/fields/partials/ViGridSimpleActions.scss +0 -4
  72. package/src/fields/partials/ViGridSimpleActions.vue +0 -25
  73. package/src/mixins/field-mixin.js +0 -13
  74. package/src/settings/DateSettings.js +0 -7
  75. package/src/settings/GridSettings.js +0 -24
  76. package/vite.config.js +0 -17
  77. /package/{public → dist}/vite.svg +0 -0
@@ -1,85 +0,0 @@
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>
@@ -1,150 +0,0 @@
1
- <template>
2
- <div class="example-container">
3
-
4
- <h3 id="custom-header">Defautl field types</h3>
5
- <div class="example-body">
6
-
7
- <vi-grid-builder
8
- stripped
9
- v-bind="config"
10
- v-model:pagination="config.pagination"
11
- :rows="rows"
12
- :server-mode="false"
13
- />
14
- </div>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- import axios from "axios";
20
-
21
- function getRandomDate(startDate, endDate) {
22
- const start = new Date(startDate).getTime();
23
- const end = new Date(endDate).getTime();
24
- const randomTimestamp = Math.floor(Math.random() * (end - start + 1)) + start;
25
- return new Date(randomTimestamp).toISOString();
26
- }
27
-
28
- const posts = Array.from({length: 25}, (_, index) => ({
29
- id: index + 1,
30
- title: `Post Title ${index + 1}`,
31
- link: `https://example.com/post-${index + 1}`,
32
- image: "https://images.pexels.com/photos/2325447/pexels-photo-2325447.jpeg",
33
- status: Math.random() > 0.5 ? "published":"unpublished",
34
- date: getRandomDate("2020-01-01", "2024-12-31"),
35
- price: Math.random() * (1000 - 10) + 10
36
-
37
- }));
38
-
39
-
40
- export default {
41
-
42
- data: () => ({
43
-
44
- loading: true,
45
- rows: posts,
46
- config: {
47
- rowKey: 'id',
48
- columns: [{
49
- label: 'ID',
50
- name: 'id',
51
- type: 'number',
52
- sortable: true,
53
- },
54
- {
55
- label: 'Title',
56
- name: 'title',
57
- },
58
- {
59
- label: 'Link',
60
- name: 'link',
61
- type: 'link',
62
- // link:'link'
63
- },
64
- {
65
- label: 'Link with title',
66
- name: 'title',
67
- type: 'link',
68
- link: 'link'
69
- },
70
- {
71
- label: 'Price',
72
- name: 'price',
73
- type: 'number',
74
- sortable: true,
75
- format: {
76
- style: 'currency',
77
- currency: 'USD',
78
- }
79
- },
80
- {
81
- label: 'Image',
82
- name: 'image',
83
- type: 'image'
84
- },
85
- {
86
- label: 'Status',
87
- name: 'status',
88
- type: 'badge'
89
- },
90
- {
91
- label: 'Date',
92
- name: 'date',
93
- type: 'date',
94
- mode: 'date'
95
- },
96
- {
97
- label: 'Time',
98
- name: 'date',
99
- type: 'date',
100
- mode: 'time'
101
- },
102
- {
103
- label: 'Simple actions',
104
- name: 'actions',
105
- type: 'actions',
106
- actions: [
107
- {
108
- action: 'edit',
109
- name: 'Edit post'
110
- },
111
- {
112
- action: 'remove',
113
- name: 'Remove post'
114
- }
115
- ]
116
- },
117
- {
118
- label: 'Kebab type actions',
119
- name: 'actions',
120
- type: 'actions',
121
- kebab: true,
122
- actions: [
123
- {
124
- action: 'edit',
125
- name: 'Edit post'
126
- },
127
- {
128
- action: 'remove',
129
- name: 'Remove post'
130
- }
131
- ]
132
- },
133
- ],
134
-
135
- pagination: {page: 1, rowsPerPage: 15},
136
-
137
- },
138
- compact: false,
139
-
140
- }),
141
-
142
- }
143
-
144
-
145
- </script>
146
-
147
-
148
- <style scoped lang="scss">
149
-
150
- </style>
@@ -1,68 +0,0 @@
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>
@@ -1,130 +0,0 @@
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>
@@ -1,72 +0,0 @@
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>
@@ -1,62 +0,0 @@
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>
@@ -1,73 +0,0 @@
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>