vi-grid-builder 0.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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3
+ }
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Vue 3 + Vite
2
+
3
+ This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
+
9
+
10
+ import TableTitle from "./components/TableTitle.vue";
11
+ createApp(App)
12
+ .use(ViGridBuilderPlugin, {
13
+ defaultSlots:{
14
+ title: TableTitle
15
+ }
16
+ })
17
+ .mount('#app')
@@ -0,0 +1,26 @@
1
+ import ViGridBuilder from "./src/ViGridBuilder.vue"
2
+ import ViPaginationPlugin from 'vi-pagination'
3
+ export default {
4
+ install(app, options ={pagination:{}, fieldComponents:{}, defaultSlots:{}}) {
5
+
6
+ // if (options?.fieldComponents) {
7
+ // Object.keys(options.fieldComponents).forEach(key => {
8
+ // ViGridBuilder.components[key] = options.fieldComponents[key]
9
+ // });
10
+ // }
11
+ app.use(ViPaginationPlugin, options?.pagination);
12
+ app.component('ViGridBuilder', {
13
+ extends:ViGridBuilder,
14
+ components:options.fieldComponents ?? {},
15
+ props:{
16
+ defaultSlots: {
17
+ type: Object,
18
+ default: function () {
19
+
20
+ return options?.defaultSlots ?? {}
21
+ }
22
+ }
23
+ }
24
+ });
25
+ }
26
+ };
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/examples/main.js"></script>
12
+ </body>
13
+ </html>
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "vi-grid-builder",
3
+ "main": "ViGridBuilderPlugin",
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "vi-pagination": "^0.0.2",
13
+ "vue": "^3.3.4"
14
+ },
15
+ "devDependencies": {
16
+ "@vitejs/plugin-vue": "^4.2.3",
17
+ "sass": "^1.66.1",
18
+ "vite": "^4.4.5"
19
+ }
20
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,78 @@
1
+ .vi-grid-builder {
2
+ width: 100%;
3
+
4
+ .vi-table-container {
5
+ overflow-x: auto;
6
+ width: 100%;
7
+
8
+ .vi-table {
9
+ border-collapse: initial;
10
+ border-spacing: 0;
11
+ width: 100%;
12
+ max-width: 100%;
13
+
14
+ tr {
15
+
16
+ th.title {
17
+ padding-bottom: 40px;
18
+ text-align: left;
19
+ }
20
+ &.table-header {
21
+ th {
22
+ color: #A1A6AA;
23
+ padding: 0 20px 20px;
24
+ text-align: center;
25
+ min-width: 80px;
26
+
27
+ &:first-child {
28
+ text-align: left;
29
+ padding-left: 0;
30
+ }
31
+
32
+ &:last-child {
33
+ padding-right: 0;
34
+ }
35
+ }
36
+ }
37
+
38
+ td {
39
+ border-top: 1px solid #A1A6AA;
40
+ padding: 24px 9px;
41
+ min-width: 115px;
42
+
43
+ > div {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ text-align: center;
48
+
49
+ }
50
+
51
+ &:first-child {
52
+ padding-left: 0;
53
+ text-align: left;
54
+
55
+ > div {
56
+ justify-content: flex-start;
57
+ }
58
+ }
59
+
60
+ &:last-child {
61
+ padding-right: 0;
62
+
63
+ .actions-container {
64
+ justify-content: flex-end;
65
+
66
+ .sbc-button {
67
+ margin-left: 10px;
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ }
74
+
75
+ }
76
+ }
77
+
78
+ }
@@ -0,0 +1,174 @@
1
+ <template>
2
+ <div class="vi-grid-builder">
3
+ <div class="vi-table-container">
4
+ <table class="vi-table">
5
+ <tr v-if="title">
6
+ <th :colspan="columns.length" class="title">
7
+ <slot name="title" :title="title">
8
+ <component v-if="defaultSlots.title" :is="defaultSlots.title" :title="title"/>
9
+ <span v-else>{{title}}</span>
10
+ </slot>
11
+ </th>
12
+ </tr>
13
+ <tr class="table-header">
14
+ <th v-for="column in columns" :key="column.name">
15
+ <slot :name="`vi-header-cell-${column.name}`">{{column.label}}</slot>
16
+ </th>
17
+ </tr>
18
+ <tbody v-if="isDataLoading" class="table-body">
19
+ <tr>
20
+ <td :colspan="columns.length" class="loading">
21
+ <slot name="loading">
22
+ <component v-if="defaultSlots.loading" :is="defaultSlots.loading"/>
23
+ <div style="display: flex;align-items: center" v-else>Loading ...</div>
24
+ </slot>
25
+ </td>
26
+ </tr>
27
+ </tbody>
28
+ <tbody v-else class="table-body">
29
+
30
+ <tr v-for="row in currentVisibleRows" :key="row[rowKey]">
31
+
32
+ <td v-for="column in columns" :key="column.name">
33
+ <vi-grid-field
34
+ :field="column"
35
+ :field-value="column.field ? column.field(row) : row[column.name]"
36
+ :row-value="row"
37
+ @action-clicked="$event => $emit($event.action, $event.row)"
38
+ >
39
+ <template v-slot:custom-field="props">
40
+ <component
41
+ v-bind:is="column.type"
42
+ v-bind="props"
43
+ />
44
+ </template>
45
+ </vi-grid-field>
46
+
47
+ </td>
48
+ </tr>
49
+ </tbody>
50
+ </table>
51
+ </div>
52
+ <div class="footer-container">
53
+ <slot name="footer" :pagination="{...pagination, totalRows:totalRows}">
54
+ <component v-if="defaultSlots.footer" :is="defaultSlots.footer"
55
+ :pagination="{...pagination, totalRows:totalRows}"/>
56
+ <vi-pagination v-else-if="!disablePagination"
57
+ :rows-per-page="pagination.rowsPerPage"
58
+ :current-page="pagination.page"
59
+ :total-rows="totalRows"
60
+ :max-pages-displayed="3"
61
+ @update:currentPage="$ev => onPaginationChange({page:$ev})"
62
+ @update:rowsPerPage="$ev => onPaginationChange({rowsPerPage:$ev, page:1})"
63
+ />
64
+ </slot>
65
+ </div>
66
+ </div>
67
+ </template>
68
+
69
+ <script>
70
+ import ViGridField from "./ViGridField.vue";
71
+
72
+ export default {
73
+ name: "ViGridBuilder",
74
+ components: {ViGridField},
75
+ props: {
76
+
77
+ rows: {
78
+ type: Array,
79
+ },
80
+ rowKey: {
81
+ type: String,
82
+ },
83
+ columns: {
84
+ type: Array,
85
+ required: true
86
+ },
87
+ title: {
88
+ type: String
89
+ },
90
+ pagination: {
91
+ type: Object,
92
+ default: function () {
93
+ return {
94
+ page: 1,
95
+ rowsPerPage: 10,
96
+ }
97
+ }
98
+ },
99
+ disablePagination: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ fetchServerData: {
104
+ type: Function
105
+ },
106
+ fetchOnInit: {
107
+ type: Boolean,
108
+ default: true
109
+ },
110
+ filter: {
111
+ type: Object
112
+ },
113
+ loading: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ defaultSlots: {
118
+ type: Object
119
+ }
120
+ },
121
+ data: () => ({search: null, isFetchingData: false}),
122
+ computed: {
123
+ isServerSide() {
124
+ return this.fetchServerData!==undefined;
125
+ },
126
+ totalRows() {
127
+ return this.pagination.totalRows ?? this.rows.length;
128
+ },
129
+ currentVisibleRows() {
130
+ if (this.isServerSide || this.disablePagination) {
131
+ return this.rows;
132
+ }
133
+
134
+ const startIndex = (this.pagination.page - 1) * this.pagination.rowsPerPage;
135
+ const endIndex = startIndex + this.pagination.rowsPerPage;
136
+
137
+ return this.rows.slice(startIndex, endIndex)
138
+ },
139
+ isDataLoading() {
140
+ return this.loading || this.isFetchingData;
141
+ }
142
+ },
143
+ methods: {
144
+ fetchData({pagination, filter, search} = {}) {
145
+ this.isFetchingData = true;
146
+ return this.fetchServerData({
147
+ pagination: pagination ?? this.pagination,
148
+ filter: filter ?? this.filter,
149
+ search: search ?? this.search,
150
+ })
151
+ .finally(() => this.isFetchingData = false)
152
+ },
153
+ onPaginationChange(pagination) {
154
+ const newPagination = {
155
+ ...this.pagination,
156
+ ...pagination
157
+ };
158
+ this.$emit('pagination-change', newPagination);
159
+ if (this.isServerSide) {
160
+ this.fetchData({pagination: newPagination})
161
+ }
162
+ }
163
+ },
164
+ created() {
165
+ if (this.isServerSide && this.fetchOnInit) {
166
+ this.fetchData()
167
+ }
168
+ }
169
+ }
170
+ </script>
171
+
172
+ <style lang="scss">
173
+ @import "./ViGridBuilder.scss";
174
+ </style>
@@ -0,0 +1,2 @@
1
+ .vi-grid-field {
2
+ }
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="vi-grid-field">
3
+ <component
4
+ v-if="fieldComponent"
5
+ v-bind:is="fieldComponent"
6
+ :field="field"
7
+ :value="fieldValue"
8
+ :row="rowValue"
9
+ />
10
+ <slot v-else name="custom-field" :field="field"
11
+ :value="fieldValue"
12
+ :row="rowValue">
13
+ </slot>
14
+
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ const snakeToCamel = str =>
20
+ str.toLowerCase().replace(/([-_][a-z])/g, group =>
21
+ group
22
+ .toUpperCase()
23
+ .replace('-', '')
24
+ .replace('_', '')
25
+ );
26
+ const uppercaseFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);
27
+
28
+ import ViGridBadge from "./fields/ViGridBadge.vue";
29
+ import ViGridImage from "./fields/ViGridImage.vue";
30
+ import ViGridText from "./fields/ViGridText.vue";
31
+ import ViGridDate from "./fields/ViGridDate.vue";
32
+ import ViGridActions from "./fields/ViGridActions.vue";
33
+ import ViGridLink from "./fields/ViGridLink.vue";
34
+ export default {
35
+ name: "ViGridField",
36
+ components:{
37
+ ViGridBadge,
38
+ ViGridImage,
39
+ ViGridText,
40
+ ViGridDate,
41
+ ViGridActions,
42
+ ViGridLink,
43
+ },
44
+ props: {
45
+ field: {
46
+ type: Object,
47
+ required: true
48
+ },
49
+ fieldValue: {},
50
+ rowValue: {},
51
+ },
52
+ computed: {
53
+
54
+ fieldComponent() {
55
+ let component = uppercaseFirstLetter(snakeToCamel(this.field.type))
56
+
57
+ if (this.$options.components[component]) {
58
+ return this.field.type
59
+ } else {
60
+ return null
61
+ }
62
+ }
63
+ },
64
+ }
65
+ </script>
66
+
67
+ <style lang="scss">
68
+ @import "ViGridField";
69
+ </style>
@@ -0,0 +1,123 @@
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>
@@ -0,0 +1,20 @@
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>
@@ -0,0 +1,11 @@
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')
@@ -0,0 +1,3 @@
1
+ .vi-grid-actions {
2
+
3
+ }
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div class="vi-grid-actions">
3
+
4
+ <vi-grid-kebab-menu
5
+ v-if="field.kebab"
6
+ :actions="visibleActions"
7
+ @actionClicked="$action => $emit(`action-clicked`, {action:$action, row})"
8
+ />
9
+
10
+ <vi-grid-builder-actions
11
+ v-else
12
+ :actions="visibleActions"
13
+
14
+ />
15
+
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ import ViGridKebabMenu from "./partials/ViGridKebabMenu.vue";
21
+ import ViGridBuilderActions from "./partials/ViGridBuilderActions.vue";
22
+
23
+ export default {
24
+ name: "ViGridActions",
25
+ components: {ViGridBuilderActions, ViGridKebabMenu},
26
+ props: {
27
+ field: {
28
+ type: Object,
29
+ required: true
30
+ },
31
+ row:{
32
+
33
+ }
34
+
35
+ },
36
+ computed:{
37
+ visibleActions() {
38
+ return this.field.actions.filter((action ) => {
39
+ if (action.isVisible === undefined) {
40
+ return true
41
+
42
+ }
43
+ return action.isVisible(this.row)
44
+
45
+ })
46
+ }
47
+ },
48
+
49
+ }
50
+ </script>
51
+
52
+ <style lang="scss">
53
+ @import "ViGridActions";
54
+ </style>
@@ -0,0 +1,10 @@
1
+ .vi-grid-badge {
2
+ width: 100%;
3
+ //padding: 5px 10px;
4
+ border-radius: 12px;
5
+ font-size: .8rem !important;
6
+ line-height: 1;
7
+ //font-weight: 600;
8
+ text-transform: uppercase;
9
+
10
+ }
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <div class="vi-grid-badge" v-bind="$attrs">
3
+ {{value}}
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ //todo colors
10
+ export default {
11
+ name: "ViGridBadge",
12
+ props: {
13
+ field: {
14
+ type: Object,
15
+ required: true
16
+ },
17
+ value: {},
18
+ },
19
+ }
20
+ </script>
21
+
22
+ <style lang="scss">
23
+ @import "ViGridBadge";
24
+ </style>
@@ -0,0 +1,3 @@
1
+ .vi-grid-date {
2
+
3
+ }
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="vi-grid-date">
3
+ {{dateFormatted}}
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "ViGridDate",
10
+ props: {
11
+ field: {
12
+ type: Object,
13
+ required: true
14
+ },
15
+ value: {},
16
+ },
17
+ computed: {
18
+ dateFormatted() {
19
+ return this.value;
20
+ ///todo format date
21
+ // if (!this.value) {
22
+ // return this.value;
23
+ // }
24
+ // switch (this.field.format) {
25
+ // case 'date':
26
+ // return this.$options.filters.viFormatDate(this.value);
27
+ //
28
+ // case 'time':
29
+ // return this.$options.filters.viFormatTime(this.value);
30
+ //
31
+ // default:
32
+ // return this.$options.filters.viFormatDateTime(this.value);
33
+ //
34
+ // }
35
+ }
36
+ }
37
+ }
38
+ </script>
39
+
40
+ <style lang="scss">
41
+ @import "ViGridDate";
42
+ </style>
@@ -0,0 +1,3 @@
1
+ .vi-grid-image {
2
+
3
+ }
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="vi-grid-image">
3
+ <img :src="value"/>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "ViGridImage",
10
+ props: {
11
+ field: {
12
+ type: Object,
13
+ required: true
14
+ },
15
+
16
+ value: {},
17
+ },
18
+ }
19
+ </script>
20
+
21
+ <style lang="scss">
22
+ @import "ViGridImage";
23
+ </style>
@@ -0,0 +1,3 @@
1
+ .vi-grid-link {
2
+
3
+ }
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="vi-grid-link">
3
+ <a :href="row[field.link]" target="_blank" v-if="row[field.link]">{{value}}</a>
4
+ <div v-else>{{value}}</div>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ name: "ViGridLink",
11
+ props: {
12
+ field: {
13
+ type: Object,
14
+ required: true
15
+ },
16
+ row: {
17
+ type: Object,
18
+ required: true
19
+ },
20
+ value: {},
21
+ },
22
+
23
+ }
24
+ </script>
25
+
26
+ <style lang="scss">
27
+ @import "ViGridLink";
28
+ </style>
File without changes
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div class="vi-grid-text">
3
+ {{value}}
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "ViGridText",
10
+ props: {
11
+ field: {
12
+ type: Object,
13
+ required: true
14
+ },
15
+ value: {},
16
+ },
17
+ }
18
+ </script>
19
+
20
+ <style lang="scss">
21
+ @import "ViGridText";
22
+ </style>
@@ -0,0 +1,4 @@
1
+ .vi-grid-builder-actions{
2
+ display: flex;
3
+ color: black;
4
+ }
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div class="vi-grid-builder-actions">
3
+ <div v-for="(action, index) in actions" :key="index">
4
+ <q-btn
5
+ flat
6
+ padding="none"
7
+ @click="$emit('action',action.action)"
8
+ >
9
+ <span>
10
+ <vi-icon-button :action="action.action"/>
11
+ </span>
12
+
13
+ <q-tooltip anchor="top middle" :offset="[30, 30]">
14
+ {{ action.name }}
15
+ </q-tooltip>
16
+ </q-btn>
17
+ </div>
18
+ </div>
19
+ </template>
20
+ <script>
21
+ export default {
22
+ name: "ViGridBuilderActions",
23
+ props: {
24
+ actions: {
25
+ type: Array
26
+ },
27
+ },
28
+
29
+ }
30
+ </script>
31
+ <style lang="scss">
32
+ @import "ViGridBuilderActions";
33
+ </style>
@@ -0,0 +1,30 @@
1
+ .vi-grid-kebab-menu {
2
+ .q-btn {
3
+ background-color: transparent;
4
+ color: #000 !important;
5
+ padding: 0;
6
+ border-radius: 50%;
7
+ }
8
+ }
9
+
10
+
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
+ //}
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div class="vi-grid-kebab-menu">
3
+ <q-btn
4
+ round
5
+ flat
6
+ :dense="true"
7
+ icon="eva-more-vertical-outline"
8
+ button-label=""
9
+ @click="toggleMenu"
10
+ >
11
+ </q-btn>
12
+ <q-menu anchor="bottom left" self="top left" :offset="[-25, 0]" v-model="showing">
13
+ <template>
14
+ <q-item
15
+ v-for="(action, index) in actions" :key="index"
16
+ @click.prevent="$emit('actionClicked',action.action)"
17
+ clickable
18
+ v-close-popup>
19
+ <q-item-section
20
+ :style="{ color: action.color }">
21
+ <div style="display: flex; align-items: center">
22
+ <q-icon
23
+ :name="icons[action.action].icon"
24
+ size="sm"
25
+ />
26
+
27
+ <span>
28
+ {{ action.name }}
29
+ </span>
30
+ </div>
31
+ </q-item-section>
32
+ </q-item>
33
+ </template>
34
+ </q-menu>
35
+
36
+
37
+
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+
43
+ import icons from "../../../../icons";
44
+ export default {
45
+ name: 'ViGridKebabMenu',
46
+
47
+ props: {
48
+ actions: {
49
+ type: Array
50
+ },
51
+ },
52
+
53
+ data() {
54
+ return {
55
+ icons,
56
+ showing:false
57
+ }
58
+ },
59
+
60
+ methods: {
61
+ onMenuItemClick(action) {
62
+ this.$emit(action.action);
63
+ },
64
+ toggleMenu(ev) {
65
+ this.showing = !this.showing
66
+
67
+ console.log('toggleMenutoggleMenu',ev,this.showing);
68
+ ev.stopPropagation()
69
+ }
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <style lang="scss">
75
+ @import "ViGridKebabMenu";
76
+ </style>
package/src/style.css ADDED
@@ -0,0 +1,89 @@
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+
6
+ color-scheme: light dark;
7
+ color: rgba(255, 255, 255, 0.87);
8
+ background-color: #242424;
9
+
10
+ font-synthesis: none;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ -webkit-text-size-adjust: 100%;
15
+ }
16
+
17
+ a {
18
+ font-weight: 500;
19
+ color: #646cff;
20
+ text-decoration: inherit;
21
+ }
22
+ a:hover {
23
+ color: #535bf2;
24
+ }
25
+
26
+ a {
27
+ font-weight: 500;
28
+ color: #646cff;
29
+ text-decoration: inherit;
30
+ }
31
+ a:hover {
32
+ color: #535bf2;
33
+ }
34
+
35
+ body {
36
+ margin: 0;
37
+ display: flex;
38
+ place-items: center;
39
+ min-width: 320px;
40
+ min-height: 100vh;
41
+ }
42
+
43
+ h1 {
44
+ font-size: 3.2em;
45
+ line-height: 1.1;
46
+ }
47
+
48
+ button {
49
+ border-radius: 8px;
50
+ border: 1px solid transparent;
51
+ padding: 0.6em 1.2em;
52
+ font-size: 1em;
53
+ font-weight: 500;
54
+ font-family: inherit;
55
+ background-color: #1a1a1a;
56
+ cursor: pointer;
57
+ transition: border-color 0.25s;
58
+ }
59
+ button:hover {
60
+ border-color: #646cff;
61
+ }
62
+ button:focus,
63
+ button:focus-visible {
64
+ outline: 4px auto -webkit-focus-ring-color;
65
+ }
66
+
67
+ .card {
68
+ padding: 2em;
69
+ }
70
+
71
+ #app {
72
+ max-width: 1280px;
73
+ margin: 0 auto;
74
+ padding: 2rem;
75
+ text-align: center;
76
+ }
77
+
78
+ @media (prefers-color-scheme: light) {
79
+ :root {
80
+ color: #213547;
81
+ background-color: #ffffff;
82
+ }
83
+ a:hover {
84
+ color: #747bff;
85
+ }
86
+ button {
87
+ background-color: #f9f9f9;
88
+ }
89
+ }
package/vite.config.js ADDED
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ })