vi-grid-builder 1.0.6 → 2.0.1

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 +6 -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
@@ -0,0 +1,51 @@
1
+ import './assets/main.css'
2
+
3
+ import {createApp} from 'vue'
4
+ import App from './App.vue'
5
+
6
+ import ViGridBuilderPlugin from '../../ViGridBuilderPlugin.js';
7
+ import SampleCustomField from "./components/fields/SampleCustomField.vue";
8
+ import LoadingSlot from "@/components/LoadingSlot.vue";
9
+
10
+ const app = createApp(App);
11
+ app.use(ViGridBuilderPlugin, {
12
+ fieldComponents: {
13
+ SampleCustomField,
14
+ },
15
+ defaultSlots:{
16
+ loading:LoadingSlot
17
+ },
18
+
19
+ align: 'right',
20
+ disablePagination: true,
21
+
22
+ compactPagination: true,
23
+ noDataLabel: 'emtpy tabled',
24
+ noCellDataLabel: 'NA',
25
+ stripped: true,
26
+ bordered: true,
27
+ rowsPerPage: 30,
28
+ rowsPerPageOptions: [{
29
+ label: 15,
30
+ value: 15
31
+ }, {
32
+ label: 20,
33
+ value: 20
34
+ }, {
35
+ label: 30,
36
+ value: 30
37
+ }, {
38
+ label: 'all',
39
+ value: 0
40
+ }],
41
+ style: {
42
+ 'color': 'white',
43
+ 'text-color': 'black',
44
+ 'secondary-color': 'lightgrey',
45
+ 'primary-color': '#f18080',
46
+ 'primary-text-color': 'white',
47
+ }
48
+ });
49
+
50
+
51
+ app.mount('#app')
@@ -0,0 +1,17 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+
3
+ import { defineConfig } from 'vite'
4
+ import vue from '@vitejs/plugin-vue'
5
+
6
+ // https://vite.dev/config/
7
+ export default defineConfig({
8
+ plugins: [
9
+ vue(),
10
+
11
+ ],
12
+ resolve: {
13
+ alias: {
14
+ '@': fileURLToPath(new URL('./src', import.meta.url))
15
+ },
16
+ },
17
+ })
@@ -1,90 +1,189 @@
1
+ :root {
2
+ --vi-grid-primary-color: rgba(0, 0, 255, 0.65);//header, hover background
3
+ --vi-grid-primary-text-color: rgb(255, 255, 255);//header, hover text color
4
+
5
+ --vi-grid-secondary-color: rgb(243, 243, 243); //stripped background
6
+ --vi-grid-text-color: rgb(0, 0, 0); //text color in body cells
7
+ --vi-grid-color: rgb(255, 255, 255); //backgournd color for table
8
+ }
1
9
  .vi-grid-builder {
2
10
  width: 100%;
3
11
 
4
12
  .vi-table-container {
5
- overflow-x: auto;
13
+ overflow-x: visible; /* for popups */
14
+ position: relative;
6
15
  width: 100%;
7
16
 
17
+ //blurred table on loading
18
+ &.loading::before {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ bottom: 0;
23
+ width: 100%;
24
+ height: 100%;
25
+ content: '';
26
+ backdrop-filter: blur(1px);
27
+ -webkit-backdrop-filter: blur(1px);
28
+ pointer-events: none;
29
+ }
30
+
8
31
  .vi-table {
9
- border-collapse: initial;
10
- border-spacing: 0;
11
32
  width: 100%;
12
- max-width: 100%;
13
- .table-body {
14
- &.loading {
15
- opacity: .5;
33
+ border-collapse: collapse; /* Removes double borders when using borders */
34
+ table-layout: auto; /* Columns grow based on content */
35
+
36
+ color: var(--vi-grid-text-color);
37
+ background-color: var(--vi-grid-color);
38
+
39
+ //header cell styel
40
+ .vi-header-cell:not(.vi-loading-cell) {
41
+ background-color: var(--vi-grid-primary-color);
42
+ color: var(--vi-grid-primary-text-color);
43
+ font-weight: bold;
44
+
45
+ * {
46
+ font-weight: inherit;
47
+ }
48
+ &.unsorted {
49
+ .sort-button {
50
+ visibility: hidden;
51
+ }
52
+
53
+ &:hover {
54
+ .sort-button {
55
+ visibility: visible;
56
+ opacity: 0.5;
57
+ }
58
+ }
16
59
  }
17
60
  }
18
61
 
19
- tr {
20
- &.clickable{
21
- cursor: pointer;
62
+ &.stripped {
63
+ tbody tr:nth-child(even):not(.vi-footer-row) {
64
+ background-color: var(--vi-grid-secondary-color);
22
65
  }
66
+ }
23
67
 
24
- th.title {
25
- padding-bottom: 40px;
26
- text-align: left;
68
+ &.bordered {
69
+ .vi-cell {
70
+ border: 1px solid #d3cfcf; /* Light gray borders */
27
71
  }
28
- &.table-header {
29
- th {
30
- color: #A1A6AA;
31
- padding: 0 20px 20px;
32
- text-align: center;
33
- min-width: 80px;
72
+ }
34
73
 
35
- &:first-child {
36
- text-align: left;
37
- padding-left: 0;
38
- }
39
74
 
40
- &:last-child {
41
- padding-right: 0;
42
- }
43
- }
75
+
76
+ //all cells style
77
+ .vi-cell {
78
+ padding: 12px 15px;
79
+ word-wrap: break-word;
80
+ }
81
+
82
+ .vi-select-cell {
83
+ input[type='checkbox'] {
84
+ cursor: pointer;
44
85
  }
86
+ }
45
87
 
46
- td {
47
- border-top: 1px solid #A1A6AA;
48
- padding: 24px 9px;
49
- min-width: 115px;
88
+ //cell alignment
89
+ .vi-grid-field, .vi-header-cell-content {
50
90
 
51
- > div {
52
- display: flex;
53
- align-items: center;
54
- justify-content: center;
55
- text-align: center;
91
+ &.left {
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: flex-start;
95
+ }
56
96
 
57
- }
97
+ &.right {
98
+ display: flex;
99
+ justify-content: flex-end;
100
+ }
58
101
 
59
- &:first-child {
60
- padding-left: 0;
61
- text-align: left;
102
+ &.center {
103
+ display: flex;
104
+ justify-content: center;
105
+ }
106
+ }
62
107
 
63
- > div {
64
- justify-content: flex-start;
65
- }
66
- }
108
+ //Sort button
109
+ .vi-header-cell-content {
110
+ .sort-button {
111
+ margin-right: 4px;
112
+ }
113
+ }
67
114
 
68
- &:last-child {
69
- padding-right: 0;
115
+ //footer cell style (pagination cell/row )
116
+ .vi-footer-cell {
117
+ padding: 20px 15px;
118
+ }
70
119
 
71
- .actions-container {
72
- justify-content: flex-end;
120
+ .vi-body-row {
121
+ &:hover:not(.vi-footer-row) {
122
+ background-color: var(--vi-grid-primary-color) !important;
123
+ color: var(--vi-grid-primary-text-color);
124
+ }
73
125
 
74
- .sbc-button {
75
- margin-left: 10px;
76
- }
77
- }
78
- }
126
+ &.clickable {
127
+ cursor: pointer;
79
128
  }
80
129
 
130
+ &.selected {
131
+ //selected row class
132
+ }
133
+ }
134
+
135
+ //LOADING CSS
136
+
137
+ .vi-loading-row {
138
+ height: 0 !important;
81
139
  }
82
140
 
141
+ .vi-loading-cell {
142
+ padding: 0;
143
+ position: relative;
144
+
145
+ .loading-bar-container {
146
+ width: 100%;
147
+ height: 2px;
148
+ background-color: transparent;
149
+ overflow: hidden;
150
+ position: absolute;
151
+ }
152
+
153
+ /* The loading bar itself */
154
+ .loading-bar {
155
+ width: 100%;
156
+ height: 100%;
157
+ background-color: var(--vi-grid-primary-color);
158
+ position: absolute;
159
+ transform: translateX(-100%);
160
+ animation: moveBar 3s linear infinite;
161
+ }
162
+ }
163
+
164
+ @keyframes moveBar {
165
+ 0% {
166
+ transform: translateX(-100%); /* Start outside the left edge */
167
+ }
168
+ 100% {
169
+ transform: translateX(100%); /* End outside the right edge */
170
+ }
171
+ }
172
+
173
+
83
174
  }
84
- }
85
175
 
86
- .footer-container {
87
- padding: 15px 0;
88
- }
89
176
 
90
- }
177
+ @media (max-width: 600px) {
178
+ .vi-cell {
179
+ padding: 8px 10px; /* Adjust padding for smaller screens */
180
+ font-size: 0.9em; /* Reduce font size for better fit */
181
+ }
182
+ }
183
+
184
+
185
+
186
+
187
+
188
+ }
189
+ }