@modeltables/fontawesome-vuetify 1.0.2 → 1.0.5
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/components/headerFilters/Filters.vue +90 -0
- package/components/helpers/instances.ts +20 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +7 -0
- package/components/models/tablemodels.d.ts +20 -0
- package/components/models/tablemodels.js +26 -0
- package/components/pagination/PaginationView.vue +4 -0
- package/components/search/SearchView.vue +41 -0
- package/components/table/TableView.vue +28 -72
- package/components/table/data/ItemView.vue +45 -0
- package/dist/index.amd.ts +14 -14
- package/dist/index.cjs.ts +14 -14
- package/dist/style.css +1 -1
- package/package.json +52 -55
- package/tsconfig.json +4 -7
- package/vue.config.js +53 -0
- /package/{README.md → components/index.html} +0 -0
- /package/components/models/{table-models.ts → tablemodels.ts} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { faHashtag } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
4
|
+
import { isDateTime, isNumber, isString } from '../helpers/instances';
|
|
5
|
+
import Date from '../headerFilters/Date.vue';
|
|
6
|
+
import Number from '../headerFilters/Number.vue';
|
|
7
|
+
import Text from '../headerFilters/Text.vue';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
components: {
|
|
11
|
+
Date,
|
|
12
|
+
Number,
|
|
13
|
+
Text,
|
|
14
|
+
FontAwesomeIcon
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
item: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
filters: {
|
|
22
|
+
type: Object,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
showFilters: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
key: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
prop: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
item: this.item,
|
|
41
|
+
index: this.index,
|
|
42
|
+
filters: this.filters,
|
|
43
|
+
showFilters: this.showFilters,
|
|
44
|
+
key: this.key,
|
|
45
|
+
hashTag: faHashtag,
|
|
46
|
+
isString: isString,
|
|
47
|
+
isNumber: isNumber,
|
|
48
|
+
isDateTime: isDateTime
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
filterValue(event: any, filter: any){
|
|
53
|
+
this.$emit('filterValue', event, filter);
|
|
54
|
+
},
|
|
55
|
+
filterDate(event: any, filter: any){
|
|
56
|
+
this.$emit('filterValue', event, filter);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
<template>
|
|
62
|
+
<span v-if="prop == key!">
|
|
63
|
+
<FontAwesomeIcon :icon="hashTag"></FontAwesomeIcon>
|
|
64
|
+
</span>
|
|
65
|
+
<span v-else>
|
|
66
|
+
<div v-if="isNumber(item[prop])">
|
|
67
|
+
<Number
|
|
68
|
+
:filter="filters[prop]"
|
|
69
|
+
:prop="prop":data="filters"
|
|
70
|
+
@filterValue="filterValue($event, filters[prop])">
|
|
71
|
+
</Number>
|
|
72
|
+
</div>
|
|
73
|
+
<div v-else-if="isDateTime(item[prop])">
|
|
74
|
+
<Date
|
|
75
|
+
:data="filters"
|
|
76
|
+
:filter="filters[prop]"
|
|
77
|
+
:prop="prop"
|
|
78
|
+
@filterValue="filterDate($event, filters[prop])">
|
|
79
|
+
</Date>
|
|
80
|
+
</div>
|
|
81
|
+
<div v-else-if="isString(item[prop])">
|
|
82
|
+
<Text
|
|
83
|
+
:data="filters"
|
|
84
|
+
:filter="filters[prop]"
|
|
85
|
+
:prop="prop"
|
|
86
|
+
@filterValue="filterValue($event, filters[prop])">
|
|
87
|
+
</Text>
|
|
88
|
+
</div>
|
|
89
|
+
</span>
|
|
90
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const isNumber = (n: any) => {
|
|
2
|
+
return !isNaN(parseFloat(n)) && !isNaN(n - 0)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const isDateTime = (d: any) =>{
|
|
6
|
+
if(/^[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}.[\d]+$/.test(d)){
|
|
7
|
+
let datetime = new window.Date(d);
|
|
8
|
+
return datetime instanceof window.Date;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const isString = (s: any) =>{
|
|
14
|
+
return typeof s === 'string' || s instanceof String;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const toDate = (value: any) => {
|
|
18
|
+
const date = new Date(value);
|
|
19
|
+
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
|
20
|
+
}
|
package/components/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! @licence MIT */
|
|
2
2
|
|
|
3
3
|
export { default as TableView } from "./table/TableView.vue";
|
|
4
|
-
export { HeaderModel, PaginatonModel, PaginatedResponse } from './models/
|
|
4
|
+
export { HeaderModel, PaginatonModel, PaginatedResponse } from './models/tablemodels';
|
|
5
5
|
|
|
6
6
|
/*!
|
|
7
7
|
* Vuetify Labs v3.4.0 by vuetify - https://vuetifyjs.com
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Minimal build entry for Vue CLI pages
|
|
2
|
+
console.log('components/index.js loaded for build');
|
|
3
|
+
|
|
4
|
+
// If you want to mount a demo app during build, import Vue and mount here.
|
|
5
|
+
// import { createApp } from 'vue';
|
|
6
|
+
// import App from './App.vue';
|
|
7
|
+
// createApp(App).mount('#app');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class HeaderModel {
|
|
2
|
+
title: string;
|
|
3
|
+
key?: string;
|
|
4
|
+
sort?: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare class PaginatonModel {
|
|
8
|
+
PageCount: number;
|
|
9
|
+
PerPage: number;
|
|
10
|
+
CurrentPage: number;
|
|
11
|
+
TotalCount: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare class PaginatedResponse<T> {
|
|
15
|
+
PageSize?: number;
|
|
16
|
+
PageCount?: number;
|
|
17
|
+
CurrentPage?: number;
|
|
18
|
+
TotalCount?: number;
|
|
19
|
+
Items: Array<T>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class HeaderModel {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.title = '';
|
|
4
|
+
this.key = undefined;
|
|
5
|
+
this.sort = undefined;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class PaginatonModel {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.PageCount = 1;
|
|
12
|
+
this.PerPage = 10;
|
|
13
|
+
this.CurrentPage = 1;
|
|
14
|
+
this.TotalCount = 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class PaginatedResponse {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.PageSize = undefined;
|
|
21
|
+
this.PageCount = undefined;
|
|
22
|
+
this.CurrentPage = undefined;
|
|
23
|
+
this.TotalCount = undefined;
|
|
24
|
+
this.Items = [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { faArrowAltCircleDown } from '@fortawesome/free-regular-svg-icons';
|
|
3
3
|
import { faChevronLeft, faChevronRight, faFastBackward, faFastForward } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
7
|
+
components: {
|
|
8
|
+
FontAwesomeIcon: FontAwesomeIcon
|
|
9
|
+
},
|
|
6
10
|
props: {
|
|
7
11
|
totalCount: {
|
|
8
12
|
type: Number,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { faRefresh, faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
components: {
|
|
7
|
+
FontAwesomeIcon: FontAwesomeIcon
|
|
8
|
+
},
|
|
9
|
+
props: {
|
|
10
|
+
showFilters: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
showFilters: this.showFilters,
|
|
18
|
+
faSearch: faSearch,
|
|
19
|
+
reload: faRefresh
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
search(){
|
|
24
|
+
this.$emit('search');
|
|
25
|
+
},
|
|
26
|
+
refresh(){
|
|
27
|
+
this.$emit('refresh');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<v-btn @click="search()" style="margin-right: 10px" color="#1697f6" v-if="showFilters" v-tooltip="'Search'">
|
|
35
|
+
<FontAwesomeIcon :icon="faSearch"></FontAwesomeIcon>
|
|
36
|
+
</v-btn>
|
|
37
|
+
<v-btn @click="refresh()" style="margin-right: 10px" color="#1697f6" v-if="showFilters" v-tooltip="'Refresh'">
|
|
38
|
+
<FontAwesomeIcon :icon="reload"></FontAwesomeIcon>
|
|
39
|
+
</v-btn>
|
|
40
|
+
|
|
41
|
+
</template>
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { faRefresh, faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { HeaderModel } from './../models/tablemodels';
|
|
6
|
+
import { PaginatonModel } from './../models/tablemodels';
|
|
7
7
|
import { change, Id, load, rowClick, search } from '../helpers/resources';
|
|
8
8
|
import Date from '../headerFilters/Date.vue';
|
|
9
|
+
import Search from '../search/SearchView.vue';
|
|
9
10
|
import Text from '../headerFilters/Text.vue';
|
|
10
11
|
import Number from '../headerFilters/Number.vue';
|
|
12
|
+
import Filters from '../headerFilters/Filters.vue';
|
|
11
13
|
import SortView from '../sort/SortView.vue';
|
|
12
14
|
import PaginationView from '../pagination/PaginationView.vue';
|
|
15
|
+
import DataItem from './data/ItemView.vue';
|
|
13
16
|
|
|
14
17
|
export default {
|
|
15
18
|
props: {
|
|
16
19
|
dataheader: {
|
|
17
|
-
type: Array<HeaderModel>,
|
|
20
|
+
type: Array<HeaderModel[]>,
|
|
21
|
+
default: () => []
|
|
18
22
|
},
|
|
19
23
|
key: {
|
|
20
24
|
type: String,
|
|
21
|
-
required: true,
|
|
22
25
|
default: () => 'Id'
|
|
23
26
|
},
|
|
24
27
|
name: {
|
|
25
28
|
type: String
|
|
26
29
|
},
|
|
27
30
|
dataItems: {
|
|
28
|
-
type: Array
|
|
29
|
-
reactive: true,
|
|
31
|
+
type: Array<Object[]>,
|
|
30
32
|
required: true
|
|
31
33
|
},
|
|
32
34
|
currentItem: {
|
|
33
35
|
type: Object,
|
|
34
|
-
reactive: true,
|
|
35
36
|
required: false
|
|
36
|
-
|
|
37
37
|
},
|
|
38
38
|
currentId: {
|
|
39
39
|
type: Number,
|
|
40
|
-
|
|
41
|
-
required: false
|
|
40
|
+
required: false
|
|
42
41
|
},
|
|
43
42
|
loading: {
|
|
44
43
|
type: Boolean,
|
|
@@ -80,7 +79,10 @@ export default {
|
|
|
80
79
|
Text: Text,
|
|
81
80
|
Number: Number,
|
|
82
81
|
SortView: SortView,
|
|
83
|
-
PaginationView: PaginationView
|
|
82
|
+
PaginationView: PaginationView,
|
|
83
|
+
Filters: Filters,
|
|
84
|
+
DataItem: DataItem,
|
|
85
|
+
Search: Search
|
|
84
86
|
},
|
|
85
87
|
mounted() {
|
|
86
88
|
this.firstChange = true;
|
|
@@ -102,14 +104,9 @@ export default {
|
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
106
|
emits: [change, load, rowClick, search],
|
|
105
|
-
setup(props, params) {
|
|
106
|
-
const modelValue = ref([]);
|
|
107
|
-
return { modelValue };
|
|
108
|
-
},
|
|
109
107
|
data() {
|
|
110
108
|
return {
|
|
111
109
|
dataheader: this.dataheader,
|
|
112
|
-
calendar: faCalendar,
|
|
113
110
|
dataItems: this.dataItems,
|
|
114
111
|
dialog: false,
|
|
115
112
|
new: true,
|
|
@@ -130,7 +127,6 @@ export default {
|
|
|
130
127
|
page: this.pagination!.CurrentPage,
|
|
131
128
|
pageCount: this.pagination!.PageCount,
|
|
132
129
|
totalCount:this.pagination!.TotalCount,
|
|
133
|
-
hashTag: faHashtag,
|
|
134
130
|
showTime: this.showTime,
|
|
135
131
|
};
|
|
136
132
|
},
|
|
@@ -192,23 +188,6 @@ export default {
|
|
|
192
188
|
isNumber(n: any) {
|
|
193
189
|
return !isNaN(parseFloat(n)) && !isNaN(n - 0)
|
|
194
190
|
},
|
|
195
|
-
isDateTime(d: any){
|
|
196
|
-
if(/^[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}.[\d]+$/.test(d)){
|
|
197
|
-
let datetime = new window.Date(d);
|
|
198
|
-
return datetime instanceof window.Date;
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
201
|
-
},
|
|
202
|
-
isString(s: any){
|
|
203
|
-
return typeof s === 'string' || s instanceof String;
|
|
204
|
-
},
|
|
205
|
-
toDate(d: any){
|
|
206
|
-
if(this.showTime){
|
|
207
|
-
return (new window.Date(d).toLocaleDateString()) + " " + (new window.Date(d).toLocaleTimeString());
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return (new window.Date(d).toLocaleDateString());
|
|
211
|
-
},
|
|
212
191
|
options(event: any){
|
|
213
192
|
this.page = event!.page;
|
|
214
193
|
this.filters.CurrentPage = this.page;
|
|
@@ -298,47 +277,24 @@ export default {
|
|
|
298
277
|
</tr>
|
|
299
278
|
<tr v-if="index == 0 && showFilters" class="filter-items" >
|
|
300
279
|
<td v-for="(prop, index) in Object.keys(item)">
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
@filterValue="filterValue($event, filters[prop])">
|
|
310
|
-
</Number>
|
|
311
|
-
</div>
|
|
312
|
-
<div v-else-if="isDateTime(item[prop])">
|
|
313
|
-
<Date
|
|
314
|
-
:data="filters"
|
|
315
|
-
:filter="filters[prop]"
|
|
316
|
-
:prop="prop"
|
|
317
|
-
@filterValue="filterDate($event, filters[prop])">
|
|
318
|
-
</Date>
|
|
319
|
-
</div>
|
|
320
|
-
<div v-else-if="isString(item[prop])">
|
|
321
|
-
<Text
|
|
322
|
-
:data="filters"
|
|
323
|
-
:filter="filters[prop]"
|
|
324
|
-
:prop="prop"
|
|
325
|
-
@filterValue="filterValue($event, filters[prop])">
|
|
326
|
-
</Text>
|
|
327
|
-
</div>
|
|
328
|
-
</span>
|
|
280
|
+
<Filters
|
|
281
|
+
:item="item"
|
|
282
|
+
:filters="filters"
|
|
283
|
+
:showFilters="showFilters"
|
|
284
|
+
:key="key"
|
|
285
|
+
:prop="prop"
|
|
286
|
+
@filterValue="filterValue($event, filters[prop])">
|
|
287
|
+
</Filters>
|
|
329
288
|
</td>
|
|
330
289
|
</tr>
|
|
331
290
|
<tr @dblclick="updateItem(item, $event)">
|
|
332
291
|
<td v-for="(prop) in Object.keys(item)">
|
|
333
|
-
<
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
</
|
|
339
|
-
<span v-else>
|
|
340
|
-
{{ item[prop] }}
|
|
341
|
-
</span>
|
|
292
|
+
<DataItem
|
|
293
|
+
:item="item"
|
|
294
|
+
:prop="prop"
|
|
295
|
+
:key="key"
|
|
296
|
+
:index="index">
|
|
297
|
+
</DataItem>
|
|
342
298
|
</td>
|
|
343
299
|
</tr>
|
|
344
300
|
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isDateTime, toDate } from '../../helpers/instances';
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
item: {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
index: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
prop: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
key: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
item: this.item,
|
|
25
|
+
index: this.index,
|
|
26
|
+
prop: this.prop,
|
|
27
|
+
key: this.key,
|
|
28
|
+
isDateTime: isDateTime,
|
|
29
|
+
toDate: toDate
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
</script>
|
|
35
|
+
<template>
|
|
36
|
+
<span v-if="prop == key!">
|
|
37
|
+
{{ index + 1 }}
|
|
38
|
+
</span>
|
|
39
|
+
<span v-else-if="isDateTime(item[prop])">
|
|
40
|
+
{{ toDate(item[prop]) }}
|
|
41
|
+
</span>
|
|
42
|
+
<span v-else>
|
|
43
|
+
{{ item[prop] }}
|
|
44
|
+
</span>
|
|
45
|
+
</template>
|