@modeltables/fontawesome-vuetify 1.0.1 → 1.0.4
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/README.md +0 -86
- package/components/headerFilters/Filters.vue +90 -0
- package/components/helpers/instances.ts +20 -0
- package/components/search/SearchView.vue +41 -0
- package/components/table/TableView.vue +23 -64
- 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 +56 -55
package/README.md
CHANGED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
@modelforms/fontawesome-vuetify is a focused Vue library that
|
|
2
|
-
modelforms-fontawesome-vuetify is a focused Vue library that brings Font Awesome icons into Vuetify-powered model forms with minimal fuss. It streamlines the process of decorating form fields with meaningful icons so forms feel polished and intuitive. Developers can rapidly prototype UIs by dropping in ready-made wrappers that handle both icon placement and Vuetify styling. Because it's built for the reactive Vue ecosystem, icons update predictably as form state changes. Customization is straightforward: swap icons, tweak sizes, or apply Vuetify themes without touching core logic. Accessibility is considered through aria-friendly patterns and clear visual affordances that help users understand form intent. The library’s lightweight design keeps your bundle lean while delivering a big UX payoff. Concise examples and clear documentation make it easy for new users to get productive in minutes. Whether you’re building an admin dashboard or a public-facing signup flow, it elevates both form clarity and aesthetics. In short, modelforms-fontawesome-vuetify is a practical toolkit for anyone who wants to combine the expressive power of Font Awesome with Vuetify’s polished components to make forms that both look and feel professional.
|
|
3
|
-
|
|
4
|
-
#First step create component
|
|
5
|
-
|
|
6
|
-
```ts
|
|
7
|
-
<template>
|
|
8
|
-
<FormComponent
|
|
9
|
-
:form="form"
|
|
10
|
-
@submit="submit($event)"/>
|
|
11
|
-
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script lang="ts">
|
|
15
|
-
import { FormPlate } from '@modelforms/fontawesome-vuetify';
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
|
|
19
|
-
components: {
|
|
20
|
-
FormComponent: FormPlate
|
|
21
|
-
},
|
|
22
|
-
data() {
|
|
23
|
-
return {
|
|
24
|
-
form: testForm
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
methods:{
|
|
28
|
-
submit(event){
|
|
29
|
-
console.log(event);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
</script>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
#Second step create sub model
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
import { GridModel } from '@modelforms/fontawesome-vuetify';
|
|
40
|
-
|
|
41
|
-
class UserModel {
|
|
42
|
-
name: string;
|
|
43
|
-
phone: any[] = []
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export const testForm: GridModel<UserModel> = {
|
|
47
|
-
model: new UserModel(),
|
|
48
|
-
rows: [
|
|
49
|
-
{
|
|
50
|
-
colSize: 12,
|
|
51
|
-
cols: [
|
|
52
|
-
{
|
|
53
|
-
name: "name",
|
|
54
|
-
type: "text",
|
|
55
|
-
rules: {
|
|
56
|
-
rules: [(v) => v?.length <= 3 || "Not longer than 3!"]
|
|
57
|
-
},
|
|
58
|
-
label: "Name",
|
|
59
|
-
size: 12,
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
colSize: 12,
|
|
65
|
-
cols: [
|
|
66
|
-
{
|
|
67
|
-
name: "Description",
|
|
68
|
-
type: "area",
|
|
69
|
-
label: "Description",
|
|
70
|
-
size: 6,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "phone",
|
|
74
|
-
type: "complete",
|
|
75
|
-
label: "Phone",
|
|
76
|
-
size: 12,
|
|
77
|
-
complete: {
|
|
78
|
-
items : [],
|
|
79
|
-
itemValue: [],
|
|
80
|
-
title: "title"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}]
|
|
85
|
-
}
|
|
86
|
-
```
|
|
@@ -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
|
+
}
|
|
@@ -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,15 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
4
|
-
import {
|
|
5
|
-
import { faRefresh, faSearch, faHashtag } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import { faRefresh, faSearch } from '@fortawesome/free-solid-svg-icons';
|
|
6
5
|
import { HeaderModel, PaginatonModel } from '../models/table-models';
|
|
7
6
|
import { change, Id, load, rowClick, search } from '../helpers/resources';
|
|
8
7
|
import Date from '../headerFilters/Date.vue';
|
|
8
|
+
import Search from '../search/SearchView.vue';
|
|
9
9
|
import Text from '../headerFilters/Text.vue';
|
|
10
10
|
import Number from '../headerFilters/Number.vue';
|
|
11
|
+
import Filters from '../headerFilters/Filters.vue';
|
|
11
12
|
import SortView from '../sort/SortView.vue';
|
|
12
13
|
import PaginationView from '../pagination/PaginationView.vue';
|
|
14
|
+
import DataItem from './data/ItemView.vue';
|
|
13
15
|
|
|
14
16
|
export default {
|
|
15
17
|
props: {
|
|
@@ -80,7 +82,10 @@ export default {
|
|
|
80
82
|
Text: Text,
|
|
81
83
|
Number: Number,
|
|
82
84
|
SortView: SortView,
|
|
83
|
-
PaginationView: PaginationView
|
|
85
|
+
PaginationView: PaginationView,
|
|
86
|
+
Filters: Filters,
|
|
87
|
+
DataItem: DataItem,
|
|
88
|
+
Search: Search
|
|
84
89
|
},
|
|
85
90
|
mounted() {
|
|
86
91
|
this.firstChange = true;
|
|
@@ -102,14 +107,9 @@ export default {
|
|
|
102
107
|
}
|
|
103
108
|
},
|
|
104
109
|
emits: [change, load, rowClick, search],
|
|
105
|
-
setup(props, params) {
|
|
106
|
-
const modelValue = ref([]);
|
|
107
|
-
return { modelValue };
|
|
108
|
-
},
|
|
109
110
|
data() {
|
|
110
111
|
return {
|
|
111
112
|
dataheader: this.dataheader,
|
|
112
|
-
calendar: faCalendar,
|
|
113
113
|
dataItems: this.dataItems,
|
|
114
114
|
dialog: false,
|
|
115
115
|
new: true,
|
|
@@ -130,7 +130,6 @@ export default {
|
|
|
130
130
|
page: this.pagination!.CurrentPage,
|
|
131
131
|
pageCount: this.pagination!.PageCount,
|
|
132
132
|
totalCount:this.pagination!.TotalCount,
|
|
133
|
-
hashTag: faHashtag,
|
|
134
133
|
showTime: this.showTime,
|
|
135
134
|
};
|
|
136
135
|
},
|
|
@@ -192,23 +191,6 @@ export default {
|
|
|
192
191
|
isNumber(n: any) {
|
|
193
192
|
return !isNaN(parseFloat(n)) && !isNaN(n - 0)
|
|
194
193
|
},
|
|
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
194
|
options(event: any){
|
|
213
195
|
this.page = event!.page;
|
|
214
196
|
this.filters.CurrentPage = this.page;
|
|
@@ -298,47 +280,24 @@ export default {
|
|
|
298
280
|
</tr>
|
|
299
281
|
<tr v-if="index == 0 && showFilters" class="filter-items" >
|
|
300
282
|
<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>
|
|
283
|
+
<Filters
|
|
284
|
+
:item="item"
|
|
285
|
+
:filters="filters"
|
|
286
|
+
:showFilters="showFilters"
|
|
287
|
+
:key="key"
|
|
288
|
+
:prop="prop"
|
|
289
|
+
@filterValue="filterValue($event, filters[prop])">
|
|
290
|
+
</Filters>
|
|
329
291
|
</td>
|
|
330
|
-
</tr
|
|
292
|
+
</tr>>
|
|
331
293
|
<tr @dblclick="updateItem(item, $event)">
|
|
332
294
|
<td v-for="(prop) in Object.keys(item)">
|
|
333
|
-
<
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
</
|
|
339
|
-
<span v-else>
|
|
340
|
-
{{ item[prop] }}
|
|
341
|
-
</span>
|
|
295
|
+
<DataItem
|
|
296
|
+
:item="item"
|
|
297
|
+
:prop="prop"
|
|
298
|
+
:key="key"
|
|
299
|
+
:index="index">
|
|
300
|
+
</DataItem>
|
|
342
301
|
</td>
|
|
343
302
|
</tr>
|
|
344
303
|
</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>
|