@modeltables/fontawesome-vuetify 1.3.2 → 1.5.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.
package/README.md CHANGED
@@ -0,0 +1,73 @@
1
+ @modeltables/fontawesome-vuetify — focused Vue table toolkit
2
+
3
+ @modeltables/fontawesome-vuetify is a small, practical Vue library that makes building polished data tables quick and painless. It provides ready-to-use components and TypeScript helpers you can drop into Vuetify or plain Vue apps to add filtering, sorting, searching and pagination with minimal setup.
4
+
5
+ Why use @modeltables/fontawesome-vuetify?
6
+
7
+ - Easy to use: helpful wrappers for headers, filters and table views so your grids look intentional from the start.
8
+ - Reactive by design: components update predictably with Vue reactivity as your data or form state changes.
9
+ - Lightweight: small surface area and minimal runtime overhead so your bundle stays lean.
10
+ - Customizable: swap icons, change sizes, or theme with your existing Vuetify setup without touching core logic.
11
+ - Accessibility-minded: uses clear affordances and aria-friendly patterns to improve form and table clarity.
12
+
13
+ Install
14
+
15
+ ```bash
16
+ pnpm add @modeltables/fontawesome-vuetify
17
+ ```
18
+
19
+ Quick start
20
+
21
+ Import the components or helpers you need and register them in your app. Example (single-file component):
22
+
23
+ ```vue
24
+ <script setup lang="ts">
25
+ import TableView from '@tablemodels/table/TableView.vue'
26
+ </script>
27
+
28
+ <template>
29
+ <div>
30
+ <SearchView />
31
+ <TableView />
32
+ </div>
33
+ </template>
34
+ ```
35
+
36
+ Core models
37
+
38
+ The package includes a small TypeScript models module (see `components/models/tablemodels.ts`) that the components use and that you can reuse in your services:
39
+
40
+ - HeaderModel — column metadata (title, key, sort).
41
+ - PaginatonModel — pagination state (PageCount, PerPage, CurrentPage, TotalCount).
42
+ - PaginatedResponse<T> — generic paged response with `Items: T[]`.
43
+ - Options — a simple option shape (`Key`, `ShowKey`, `Name`, `Active`).
44
+
45
+ Example TypeScript snippet
46
+
47
+ ```ts
48
+ import { PaginatedResponse, HeaderModel } from 'tablemodels'
49
+
50
+ type Item = { id: number; name: string }
51
+
52
+ const page: PaginatedResponse<Item> = {
53
+ PageSize: 10,
54
+ PageCount: 3,
55
+ CurrentPage: 1,
56
+ TotalCount: 25,
57
+ Items: []
58
+ }
59
+
60
+ const col = new HeaderModel()
61
+ col.title = 'Name'
62
+ col.key = 'name'
63
+ ```
64
+
65
+ Contributing
66
+
67
+ PRs and issues welcome — open an issue to discuss larger changes first. Keep changes focused and lightweight.
68
+
69
+ License
70
+
71
+ ISC
72
+
73
+
@@ -60,16 +60,16 @@ export default {
60
60
  this.$emit('filterValue', event, filter);
61
61
  },
62
62
  filterDate(event: any, filter: any){
63
- this.$emit('filterValue', event, filter);
63
+ this.$emit('filterDate', event, filter);
64
64
  }
65
65
  }
66
66
  }
67
67
  </script>
68
68
  <template>
69
- <span v-if="prop == options.Key!">
69
+ <span v-if="prop == options.Key! && options.Active">
70
70
  <FontAwesomeIcon :icon="hashTag"></FontAwesomeIcon>
71
71
  </span>
72
- <span v-else>
72
+ <span v-else-if="prop">
73
73
  <div v-if="isNumber(item[prop])">
74
74
  <Number
75
75
  :filter="filters[prop]"
@@ -21,6 +21,7 @@ export declare class PaginatedResponse<T> {
21
21
 
22
22
  export declare class Options {
23
23
  Key?: string;
24
+ ShowKey: boolean;
24
25
  Name?: string;
25
- Active?: boolean;
26
+ Active: boolean;
26
27
  }
@@ -29,6 +29,7 @@ export class Options {
29
29
  constructor() {
30
30
  this.Key = "Id";
31
31
  this.Name = undefined;
32
+ this.ShowKey = false;
32
33
  this.Active = true;
33
34
  }
34
35
  }
@@ -21,6 +21,7 @@ export class PaginatedResponse<T>{
21
21
 
22
22
  export class Options{
23
23
  Key?: string;
24
+ ShowKey: boolean;
24
25
  Name?: string;
25
- Active?: boolean;
26
+ Active: boolean;
26
27
  }
@@ -57,5 +57,8 @@ export default {
57
57
  <div v-else-if="options.Active">
58
58
  {{ prop.title }}
59
59
  </div>
60
+ <div v-else>
61
+ {{ prop.title }}
62
+ </div>
60
63
 
61
64
  </template>
@@ -173,25 +173,27 @@ export default {
173
173
  this.$emit(change, item);
174
174
  }
175
175
  },
176
- filterValue(event: any, dataItem: any){
176
+ filterDate(event: any, dataItem: any){
177
177
  let item = dataItem;
178
- let value = event.target.value;
179
178
  if(item != null){
180
- dataItem = value == '' ? null : value;
179
+ dataItem = event == '' ? null : new window.Date(event);
181
180
  }else{
182
- dataItem = value;
181
+ dataItem = new window.Date(event);
183
182
  }
184
183
  },
185
- filterDate(event: any, dataItem: any){
184
+ filterValue(event: any, dataItem: any){
186
185
  let item = dataItem;
186
+ let value = event.target.value;
187
187
  if(item != null){
188
- dataItem = event == '' ? null : new window.Date(event);
188
+ dataItem = value == '' ? null : value;
189
189
  }else{
190
- dataItem = new window.Date(event);
190
+ dataItem = value;
191
191
  }
192
192
  },
193
- isNumber(n: any) {
194
- return !isNaN(parseFloat(n)) && !isNaN(n - 0)
193
+ isActive(index){
194
+ if(!this.options.Active && !this.options.ShowKey){
195
+ return index > 0;
196
+ }
195
197
  },
196
198
  optionschange(event: any){
197
199
  this.page = event!.page;
@@ -272,7 +274,8 @@ export default {
272
274
  return-object>
273
275
  <template v-slot:item="{ item, index }" >
274
276
  <tr v-if="index == 0 && showFilters" class="filter-items" >
275
- <td v-for="(prop, index) in dataheader">
277
+ <td v-for="(prop, index) in dataheader"
278
+ v-if="isActive(index)">
276
279
  <SortView
277
280
  :prop="prop"
278
281
  :index="index"
@@ -281,20 +284,23 @@ export default {
281
284
  </td>
282
285
  </tr>
283
286
  <tr v-if="index == 0 && showFilters" class="filter-items" >
284
- <td v-for="(prop, index) in Object.keys(item)">
285
- <Filters
287
+ <td v-for="(prop, index) in Object.keys(item)"
288
+ v-if="isActive(index)">
289
+ <Filters
286
290
  :item="item"
287
291
  :filters="filters"
288
292
  :showFilters="showFilters"
289
293
  :options="options"
290
294
  :prop="prop"
295
+ @filterDate="filterDate($event, filters[prop])"
291
296
  @filterValue="filterValue($event, filters[prop])">
292
297
  </Filters>
293
298
  </td>
294
299
  </tr>
295
300
  <tr @dblclick="updateItem(item, $event)">
296
- <td v-for="(prop) in Object.keys(item)">
297
- <DataItem
301
+ <td v-for="(prop, index) in Object.keys(item)"
302
+ v-if="isActive(index)">
303
+ <DataItem
298
304
  :item="item"
299
305
  :prop="prop"
300
306
  :options="options"
@@ -47,7 +47,10 @@
47
47
 
48
48
  </script>
49
49
  <template>
50
- <span v-if="prop == options.Key!">
50
+ <span v-if="prop == options.Key! && options.ShowKey">
51
+ {{ item[prop] }}
52
+ </span>
53
+ <span v-else-if="prop == options.Key! && options.Active">
51
54
  {{ index + 1 }}
52
55
  </span>
53
56
  <span v-else-if="isDateTime(item[prop])">