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.
Files changed (63) hide show
  1. package/README.md +240 -11
  2. package/ViGridBuilderPlugin.js +35 -36
  3. package/package.json +5 -2
  4. package/playground/.vscode/extensions.json +3 -0
  5. package/playground/README.md +29 -0
  6. package/playground/index.html +13 -0
  7. package/playground/jsconfig.json +8 -0
  8. package/playground/package-lock.json +2524 -0
  9. package/playground/package.json +20 -0
  10. package/playground/public/favicon.ico +0 -0
  11. package/playground/src/App.vue +84 -0
  12. package/playground/src/assets/base.css +86 -0
  13. package/playground/src/assets/logo.svg +1 -0
  14. package/playground/src/assets/main.css +35 -0
  15. package/playground/src/components/ActionsField.vue +99 -0
  16. package/playground/src/components/ClickableRow.vue +68 -0
  17. package/playground/src/components/ClientSideData.vue +86 -0
  18. package/playground/src/components/ColumnVisibility.vue +85 -0
  19. package/playground/src/components/CustomField.vue +64 -0
  20. package/playground/src/components/CustomHeader.vue +85 -0
  21. package/playground/src/components/GlobalOptions.vue +68 -0
  22. package/playground/src/components/LoadingSlot.vue +11 -0
  23. package/playground/src/components/PaginationOptions.vue +130 -0
  24. package/playground/src/components/RowSelect.vue +72 -0
  25. package/playground/src/components/ServerSideData.vue +62 -0
  26. package/playground/src/components/SortableColumnServerSide.vue +73 -0
  27. package/playground/src/components/TableStyle.vue +112 -0
  28. package/playground/src/components/fields/SampleCustomField.vue +24 -0
  29. package/playground/src/components/icons/IconCommunity.vue +7 -0
  30. package/playground/src/components/icons/IconDocumentation.vue +7 -0
  31. package/playground/src/components/icons/IconEcosystem.vue +7 -0
  32. package/playground/src/components/icons/IconSupport.vue +7 -0
  33. package/playground/src/components/icons/IconTooling.vue +19 -0
  34. package/playground/src/main.js +51 -0
  35. package/playground/vite.config.js +17 -0
  36. package/src/ViGridBuilder.scss +157 -58
  37. package/src/ViGridBuilder.vue +367 -207
  38. package/src/ViGridField.scss +1 -2
  39. package/src/ViGridField.vue +13 -6
  40. package/src/ViGridHeadCell.vue +32 -0
  41. package/src/ViGridHeadColumnCell.vue +42 -0
  42. package/src/ViGridHeader.vue +67 -0
  43. package/src/composables/useColumns.js +21 -0
  44. package/src/composables/useGridActions.js +17 -3
  45. package/src/composables/useGridSettings.js +18 -0
  46. package/src/composables/usePagination.js +39 -0
  47. package/src/composables/useRowHelper.js +38 -0
  48. package/src/composables/useRowSelect.js +53 -0
  49. package/src/composables/useSettings.js +29 -0
  50. package/src/composables/useSort.js +103 -0
  51. package/src/fields/ViGridActions.scss +0 -1
  52. package/src/fields/ViGridActions.vue +37 -13
  53. package/src/fields/ViGridCheckbox.vue +31 -0
  54. package/src/fields/ViGridNumber.vue +18 -0
  55. package/src/fields/partials/ViGridKebabMenu.scss +60 -25
  56. package/src/fields/partials/ViGridKebabMenu.vue +75 -54
  57. package/src/fields/partials/{ViGridBuilderActions.vue → ViGridSimpleActions.vue} +3 -3
  58. package/src/settings/GridSettings.js +24 -0
  59. package/vite.config.js +12 -2
  60. package/src/examples/App.vue +0 -123
  61. package/src/examples/components/TableTitle.vue +0 -20
  62. package/src/examples/main.js +0 -11
  63. /package/src/fields/partials/{ViGridBuilderActions.scss → ViGridSimpleActions.scss} +0 -0
@@ -1,30 +1,65 @@
1
1
  .vi-grid-kebab-menu {
2
- .q-btn {
3
- background-color: transparent;
4
- color: #000 !important;
5
- padding: 0;
6
- border-radius: 50%;
2
+ cursor: pointer;
3
+ min-height: 10px;
4
+ width: 100%;
5
+ position: relative;
6
+
7
+ .actions-menu-button {
8
+ box-sizing: border-box;
9
+ position: relative;
10
+ display: block;
11
+ width: 4px;
12
+ height: 4px;
13
+ background: currentColor;
14
+ border-radius: 100%;
15
+
16
+ &::after,
17
+ &::before {
18
+ content: "";
19
+ position: absolute;
20
+ top: 0;
21
+ box-sizing: border-box;
22
+ display: block;
23
+ width: 4px;
24
+ height: 4px;
25
+ background: currentColor;
26
+ border-radius: 100%;
27
+ }
28
+
29
+ &::after {
30
+ left: -6px;
31
+ }
32
+
33
+ &::before {
34
+ right: -6px;
35
+ }
36
+ }
37
+
38
+ .actions-menu {
39
+ padding: 5px;
40
+ white-space: nowrap;
41
+
42
+ position: absolute;
43
+ z-index: 1000;
44
+ background-color: white;
45
+ border: 1px solid #ddd;
46
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow */
47
+ border-radius: 5px;
48
+ min-width: 200px;
49
+ overflow: hidden; /* Ensure rounded corners */
50
+ .actions-menu-item {
51
+ padding: 10px 15px;
52
+ font-size: 14px;
53
+ color: #333; /* Dark gray */
54
+ cursor: pointer;
55
+ transition: background-color 0.3s ease;
56
+
57
+ &:hover {
58
+ background-color: #f5f5f5;
59
+ }
60
+ }
7
61
  }
8
62
  }
9
63
 
10
64
 
11
- //.confirm-delete-dialog {
12
- // &.btns-container {
13
- // display: flex;
14
- //
15
- // .btn-cancel {
16
- // flex: 1;
17
- // }
18
- //
19
- // .btn-confirm {
20
- // flex: 1;
21
- // text-align: right;
22
- // }
23
- //
24
- // .vi-button {
25
- // .q-btn {
26
- // background-color: transparent;
27
- // }
28
- // }
29
- // }
30
- //}
65
+
@@ -1,69 +1,90 @@
1
1
  <template>
2
- <div class="vi-grid-kebab-menu">
3
- <i class="eva eva-more-vertical-outline"/>
4
-
5
- <q-menu anchor="bottom left" self="top left" :offset="[-25, 0]" v-model="showing">
6
- <template>
7
- <q-item
8
- v-for="(action, index) in actions" :key="index"
9
- @click.prevent="$emit('actionClicked',action.action)"
10
- clickable
11
- v-close-popup>
12
- <q-item-section
13
- :style="{ color: action.color }">
14
- <div style="display: flex; align-items: center">
15
- <!-- <q-icon-->
16
- <!-- :name="icons[action.action].icon"-->
17
- <!-- size="sm"-->
18
- <!-- />-->
19
-
20
- <span>
21
- {{ action.name }}
22
- </span>
23
- </div>
24
- </q-item-section>
25
- </q-item>
26
- </template>
27
- </q-menu>
28
-
29
-
30
-
2
+ <div class="vi-grid-kebab-menu" ref="kebabMenu" @click.stop="$emit('toggleMenu')">
3
+ <font-awesome-icon :icon="['fas', 'ellipsis']" />
4
+ <div class="actions-menu" v-if="showMenu">
5
+ <div v-for="action in actions" :key="action.action" @click="$ev => $emit('action-clicked',action.action)"
6
+ class="actions-menu-item">
7
+ {{ action.name }}
8
+ </div>
9
+ </div>
31
10
  </div>
32
11
  </template>
33
12
 
34
13
  <script>
35
14
 
36
- // import icons from "../../../../icons";
37
- export default {
38
- name: 'ViGridKebabMenu',
15
+ import {FontAwesomeIcon} from "@fortawesome/vue-fontawesome";
39
16
 
40
- props: {
41
- actions: {
42
- type: Array
43
- },
44
- },
45
-
46
- data() {
47
- return {
17
+ export default {
18
+ name: 'ViGridKebabMenu',
19
+ components: {FontAwesomeIcon},
48
20
 
49
- showing:false
50
- }
21
+ props: {
22
+ actions: {
23
+ type: Array
24
+ },
25
+ rowKey: {
26
+ type: String
27
+ },
28
+ row: {
29
+ type: Object
51
30
  },
52
31
 
53
- methods: {
54
- onMenuItemClick(action) {
55
- this.$emit(action.action);
56
- },
57
- toggleMenu(ev) {
58
- this.showing = !this.showing
59
-
60
- console.log('toggleMenutoggleMenu',ev,this.showing);
61
- ev.stopPropagation()
62
- }
32
+ showMenu: {
33
+ type: Boolean,
63
34
  }
64
- }
35
+ },
36
+
37
+ // setup() {
38
+ // // const showMenu = ref(false);
39
+ // const kebabMenu = ref(null)
40
+ //
41
+ // const {toggleRowMenu} = useGridActions(props)
42
+ //
43
+ //
44
+ //
45
+ // return {
46
+ // // showMenu,
47
+ // kebabMenu,
48
+ // // toggleMenu
49
+ // }
50
+ // }
51
+ }
65
52
  </script>
66
53
 
67
54
  <style lang="scss">
68
- @import "ViGridKebabMenu";
55
+ @import "ViGridKebabMenu";
56
+
57
+
58
+ .actions-menu-button {
59
+ cursor: pointer;
60
+ transform: scale(var(--ggs, 1));
61
+ }
62
+
63
+ .actions-menu-button,
64
+ .actions-menu-button::after,
65
+ .actions-menu-button::before {
66
+ box-sizing: border-box;
67
+ position: relative;
68
+ display: block;
69
+ width: 4px;
70
+ height: 4px;
71
+ background: currentColor;
72
+ border-radius: 100%;
73
+ }
74
+
75
+ .actions-menu-button::after,
76
+ .actions-menu-button::before {
77
+ content: "";
78
+ position: absolute;
79
+ top: 0;
80
+ }
81
+
82
+ .actions-menu-button::after {
83
+ left: -6px;
84
+ }
85
+
86
+ .actions-menu-button::before {
87
+ right: -6px;
88
+ }
89
+
69
90
  </style>
@@ -2,7 +2,7 @@
2
2
  <div class="vi-grid-builder-actions">
3
3
  <div v-for="(action, index) in actions" :key="index">
4
4
  <button
5
- @click="$emit('action-clicked',action.action)"
5
+ @click.stop="$emit('action-clicked',action.action)"
6
6
  >
7
7
  {{action.name}}
8
8
  </button>
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
  <script>
13
13
  export default {
14
- name: "ViGridBuilderActions",
14
+ name: "ViGridSimpleActions",
15
15
  props: {
16
16
  actions: {
17
17
  type: Array
@@ -21,5 +21,5 @@ export default {
21
21
  }
22
22
  </script>
23
23
  <style lang="scss">
24
- @import "ViGridBuilderActions";
24
+ @import "ViGridSimpleActions";
25
25
  </style>
@@ -0,0 +1,24 @@
1
+ export default {
2
+ align: 'center',
3
+ bordered: false,
4
+ stripped: true,
5
+ disablePagination: false,
6
+ noDataLabel: 'No data',
7
+ noCellDataLabel: '/',
8
+ compactPagination: true,
9
+ rowsPerPageOptions: [{
10
+ label: 5,
11
+ value: 5,
12
+ }, {
13
+ label: 10,
14
+ value: 10,
15
+ }, {
16
+ label: 15,
17
+ value: 15
18
+ }, {
19
+ label: 20,
20
+ value: 20
21
+ }],
22
+ rowsPerPage: 10,
23
+ defaultSlots:{}
24
+ }
package/vite.config.js CHANGED
@@ -1,7 +1,17 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+
1
3
  import { defineConfig } from 'vite'
2
4
  import vue from '@vitejs/plugin-vue'
3
5
 
4
- // https://vitejs.dev/config/
6
+ // https://vite.dev/config/
5
7
  export default defineConfig({
6
- plugins: [vue()],
8
+ plugins: [
9
+ vue(),
10
+
11
+ ],
12
+ resolve: {
13
+ alias: {
14
+ '@': fileURLToPath(new URL('./src', import.meta.url))
15
+ },
16
+ },
7
17
  })
@@ -1,123 +0,0 @@
1
-
2
- <template>
3
-
4
- <vi-grid-builder :columns="columns" :rows="tableData"
5
- title="hellooe"
6
- row-key="id" :pagination="pagination" @pagination-change="onPage" :fetch-server-data="fetchServerData">
7
-
8
- <template #title="{title}">
9
- <div> Overriede title {{title}}</div>
10
- </template>
11
- <template #loading>
12
- <div> Hellooo wait</div>
13
- </template>
14
- </vi-grid-builder>
15
- <vi-pagination v-model:current-page="page" :max-pages-displayed="5" v-model:rows-per-page="rowsPerPage" :total-rows="53"/>
16
-
17
- </template>
18
-
19
- <script>
20
-
21
- const LeadDetailsGrid = {
22
-
23
- pagination: {
24
- rowsPerPage: 5,
25
- page:2,
26
- totalRows:6
27
- },
28
- fields: [
29
- {
30
- name: 'id',
31
- type: 'vi-grid-text',
32
- label: 'ID',
33
- align: 'left',
34
- },
35
- {
36
- name: 'fullName',
37
- type: 'vi-grid-text',
38
- label: 'Lead',
39
- align: 'left',
40
- },
41
- {
42
- name: 'city',
43
- type: 'vi-grid-date',
44
- label: 'City',
45
- align: 'end'
46
- }
47
- ],
48
-
49
- rows:[
50
- {
51
- id:1,
52
- fullName:'Anja T',
53
- city:"SK",
54
- },
55
- { id:2,
56
- fullName:'Anja 2',
57
- city:"SK",
58
- },
59
- { id:3,
60
- fullName:'Anja 3',
61
- city:"SK",
62
- },
63
- { id:4,
64
- fullName:'Anja 4',
65
- city:"PP",
66
- },
67
- { id:5,
68
- fullName:'Anja 5',
69
- city:"SK",
70
- },
71
- { id:6,
72
- fullName:'Anja 6',
73
- city:"PP",
74
- }
75
- ]
76
- }
77
- export default {
78
- data:() => ({
79
- columns: LeadDetailsGrid.fields,
80
- rows:LeadDetailsGrid.rows,
81
- pagination:LeadDetailsGrid.pagination,
82
- tableData:[],
83
- page: 1,
84
- rowsPerPage:5,
85
-
86
- }),
87
- methods:{
88
- onPage(pagination) {
89
- console.log('paginationpagination',pagination);
90
- this.pagination = pagination;
91
- },
92
- fetchServerData({pagination}){
93
-
94
- return new Promise((resolve,reject) => {
95
- const startIndex = (pagination.page - 1) * pagination.rowsPerPage;
96
- const endIndex = startIndex + pagination.rowsPerPage;
97
- setTimeout(()=> {
98
- resolve(this.tableData = this.rows.slice(startIndex, endIndex))
99
- }, 3000)
100
- })
101
-
102
-
103
-
104
- }
105
- }
106
- }
107
-
108
- </script>
109
-
110
- <style scoped>
111
- .logo {
112
- height: 6em;
113
- padding: 1.5em;
114
- will-change: filter;
115
- transition: filter 300ms;
116
- }
117
- .logo:hover {
118
- filter: drop-shadow(0 0 2em #646cffaa);
119
- }
120
- .logo.vue:hover {
121
- filter: drop-shadow(0 0 2em #42b883aa);
122
- }
123
- </style>
@@ -1,20 +0,0 @@
1
- <template>
2
- <div class="TableTitle">
3
- lalalala my slot title {{title}}
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: "TableTitle",
10
- props:{
11
- title:{
12
- type:String
13
- }
14
- }
15
- }
16
- </script>
17
-
18
- <style lang="scss">
19
- /*@import "TableTitle";*/
20
- </style>
@@ -1,11 +0,0 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
3
- import ViGridBuilderPlugin from "vi-grid-builder"
4
- import TableTitle from "./components/TableTitle.vue";
5
- createApp(App)
6
- .use(ViGridBuilderPlugin, {
7
- defaultSlots:{
8
- title: TableTitle
9
- }
10
- })
11
- .mount('#app')