quasar-factory-lib 0.0.29 → 0.0.31

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,9 @@
1
+ export const tableStore: import("pinia").StoreDefinition<"tableStore", {
2
+ disableScannerButtons: import("@vueuse/shared").RemovableRef<boolean>;
3
+ filterValue: import("@vueuse/shared").RemovableRef<string>;
4
+ lastFilterValue: import("@vueuse/shared").RemovableRef<string>;
5
+ visiblecolumns: import("@vueuse/shared").RemovableRef<never[]>;
6
+ }, {}, {
7
+ setFilterValue(val: any): void;
8
+ cleanTableFilter(): void;
9
+ }>;
package/package.json CHANGED
@@ -97,6 +97,6 @@
97
97
  "release": "standard-version"
98
98
  },
99
99
  "type": "module",
100
- "version": "0.0.29",
100
+ "version": "0.0.31",
101
101
  "author": ""
102
102
  }
@@ -19,16 +19,15 @@
19
19
  :props="tableProps"
20
20
  >
21
21
  <span
22
- :style="tableProps.row.rowStyleFn(col.name, tableProps.row.name)"
23
22
  v-if="getColumnValue(col)"
24
- v-html="tableProps.row[col.name]"
23
+ v-html="tablePropsData.row[col.name]"
25
24
  ></span>
26
25
  <!-- fa-solid fa-pen-to-square -->
27
26
  <q-icon
28
27
  v-if="col.editable"
29
- name="fa-solid fa-pen-to-square "
28
+ name="edit"
30
29
  color="primary"
31
- size="sm"
30
+ size="xs"
32
31
  class="cursor-pointer"
33
32
  />
34
33
  <TablePopupEdit
@@ -39,13 +39,13 @@
39
39
  <q-item-label
40
40
  v-if="getColumnValue(col)"
41
41
  class="itemsFontSize text-almost-black"
42
- :style="tableProps.row.rowStyleFn(col.name, tableProps.row.name)"
43
42
  >
43
+ <!-- fa-solid fa-pen-to-square -->
44
44
  <q-icon
45
45
  v-if="col.editable"
46
- name="fa-solid fa-pen-to-square"
46
+ name="edit"
47
47
  color="primary"
48
- size="sm"
48
+ size="sx"
49
49
  class="cursor-pointer"
50
50
  />
51
51
  <span v-html="tableProps.row[col.name]" />
@@ -0,0 +1,339 @@
1
+ <template>
2
+ <q-page-container class=" full-width column justify-center">
3
+ <q-page
4
+ class="full-width column justify-center align-center items-center"
5
+ style="height: 70vh;"
6
+ >
7
+ <div
8
+ class="full-width"
9
+ >
10
+ <Table
11
+ :rows="rows"
12
+ :columns="columns"
13
+ :visible-columns="visibleColumns"
14
+ :small-device="false"
15
+ :store="store"
16
+ :table-style="tableStyle"
17
+ :show-skeleton="showSkeleton"
18
+ :selection-type="'multiple'"
19
+ :filter-method="filterMethod"
20
+ :filter-computed="filter"
21
+ @on-select-visible-columns="saveSelectedColumns"
22
+ @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
23
+ @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
24
+ @on-click-button="setItemNotFound"
25
+ />
26
+ </div>
27
+ </q-page>
28
+ </q-page-container>
29
+ </template>
30
+ <script lang="ts">
31
+ import Table from '../components/Table/Table.vue'
32
+ import setTableHeight from '../components/Table/utils/setTableHeight'
33
+ import infiniteScroll from '../components/Table/utils/infiniteScroll'
34
+ import FilterMethod from '../components/Table/utils/filterMethod'
35
+ import { tableStore } from '../store/table.js'
36
+ export default {
37
+ components: {
38
+ Table
39
+ },
40
+ data () {
41
+ return {
42
+ showSkeleton: true,
43
+ showDialog: false,
44
+ forceRender: false,
45
+ store: tableStore(),
46
+ totalPage: 0,
47
+ pageSize: 20,
48
+ tableStyle: '',
49
+ columns: [{
50
+ name: 'name',
51
+ required: true,
52
+ label: 'Dessert (100g serving)',
53
+ align: 'left',
54
+ sortable: true
55
+ },
56
+ {
57
+ name: 'available',
58
+ required: false,
59
+ label: 'Available',
60
+ align: 'left',
61
+ sortable: true,
62
+ showBasicCheckbox: true
63
+ },
64
+ {
65
+ name: 'booleanIcon',
66
+ required: true,
67
+ label: 'Boolean Icon',
68
+ align: 'left',
69
+ sortable: true,
70
+ showCustomizedIcon: true
71
+ },
72
+ {
73
+ name: 'calories',
74
+ align: 'center',
75
+ label: 'Calories',
76
+ field: 'calories',
77
+ sortable: true,
78
+ editable: true,
79
+ showEditIcon: true,
80
+ popupEditEmit: 'onSaveValuePopupEdit',
81
+ popupEditInputtype: 'number',
82
+ popupEditDataCy: '',
83
+ popupEditMask: '#####'
84
+ },
85
+ {
86
+ name: 'fat',
87
+ label: 'Fat (g)',
88
+ field: 'fat',
89
+ sortable: true,
90
+ showCustomizedButton: true,
91
+ btnIcon: 'save',
92
+ btnEmit: 'onClickButton',
93
+ dataCy: 'onClickButton',
94
+ btnColor: 'primary'
95
+ },
96
+ {
97
+ name: 'carbs',
98
+ label: 'Carbs (g)',
99
+ field: 'carbs'
100
+ },
101
+ {
102
+ name: 'checked',
103
+ label: 'Checked',
104
+ field: 'carbs',
105
+ sortable: true,
106
+ required: false,
107
+ showCustomizedCheckBox: true,
108
+ checkedIcon: 'check_circle',
109
+ uncheckedIcon: 'cancel',
110
+ checkBoxColorCaseTrue: 'positive',
111
+ checkBoxColorCaseFalse: 'negative',
112
+ checkBoxDataCy: ''
113
+ },
114
+ {
115
+ name: 'protein',
116
+ label: 'Protein (g)',
117
+ field: 'protein',
118
+ sortable: true,
119
+ required: false,
120
+ editable: true,
121
+ showEditIcon: true,
122
+ popupEditEmit: 'onSaveValuePopupEdit',
123
+ popupEditInputtype: 'text',
124
+ popupEditDataCy: '',
125
+ showInputPopupEdit: true
126
+ },
127
+ {
128
+ name: 'sodium',
129
+ label: 'Sodium (mg)',
130
+ field: 'sodium'
131
+ },
132
+ {
133
+ name: 'calcium',
134
+ label: 'Calcium (%)',
135
+ field: 'calcium',
136
+ sortable: true
137
+ },
138
+ {
139
+ name: 'iron',
140
+ label: 'Iron (%)',
141
+ field: 'iron',
142
+ sortable: true
143
+ }
144
+ ],
145
+ rows: [],
146
+ rowsData: [
147
+ {
148
+ name: 'Frozen Yogurt',
149
+ booleanIcon: true,
150
+ available: true,
151
+ calories: 159,
152
+ fat: 6.0,
153
+ carbs: 24,
154
+ checked: false,
155
+ protein: 4.0,
156
+ sodium: 87,
157
+ calcium: '14%',
158
+ iron: '1%'
159
+ },
160
+ {
161
+ name: 'Ice cream sandwich',
162
+ booleanIcon: true,
163
+ available: false,
164
+ calories: 237,
165
+ fat: 9.0,
166
+ carbs: 37,
167
+ checked: false,
168
+ protein: 4.3,
169
+ sodium: 129,
170
+ calcium: '8%',
171
+ iron: '1%'
172
+ },
173
+ {
174
+ name: 'Eclair',
175
+ booleanIcon: true,
176
+ available: true,
177
+ calories: 262,
178
+ fat: 16.0,
179
+ carbs: 23,
180
+ checked: false,
181
+ protein: 6.0,
182
+ sodium: 337,
183
+ calcium: '6%',
184
+ iron: '7%'
185
+ },
186
+ {
187
+ name: 'Cupcake',
188
+ booleanIcon: false,
189
+ available: false,
190
+ calories: 305,
191
+ fat: 3.7,
192
+ carbs: 67,
193
+ checked: false,
194
+ protein: 4.3,
195
+ sodium: 413,
196
+ calcium: '3%',
197
+ iron: '8%'
198
+ },
199
+ {
200
+ name: 'Gingerbread',
201
+ booleanIcon: true,
202
+ available: true,
203
+ calories: 356,
204
+ fat: 16.0,
205
+ carbs: 49,
206
+ checked: false,
207
+ protein: 3.9,
208
+ sodium: 327,
209
+ calcium: '7%',
210
+ iron: '16%'
211
+ },
212
+ {
213
+ name: 'Jelly bean',
214
+ booleanIcon: false,
215
+ available: false,
216
+ calories: 375,
217
+ fat: 0.0,
218
+ carbs: 94,
219
+ checked: true,
220
+ protein: 0.0,
221
+ sodium: 50,
222
+ calcium: '0%',
223
+ iron: '0%'
224
+ },
225
+ {
226
+ name: 'Lollipop',
227
+ booleanIcon: true,
228
+ available: true,
229
+ calories: 392,
230
+ fat: 0.2,
231
+ carbs: 98,
232
+ checked: false,
233
+ protein: 0,
234
+ sodium: 38,
235
+ calcium: '0%',
236
+ iron: '2%'
237
+ },
238
+ {
239
+ name: 'Honeycomb',
240
+ booleanIcon: true,
241
+ available: false,
242
+ calories: 408,
243
+ fat: 3.2,
244
+ carbs: 87,
245
+ checked: true,
246
+ protein: 6.5,
247
+ sodium: 562,
248
+ calcium: '0%',
249
+ iron: '45%'
250
+ },
251
+ {
252
+ name: 'Donut',
253
+ booleanIcon: true,
254
+ available: true,
255
+ calories: 452,
256
+ fat: 25.0,
257
+ carbs: 51,
258
+ checked: false,
259
+ protein: 4.9,
260
+ sodium: 326,
261
+ calcium: '2%',
262
+ iron: '22%'
263
+ },
264
+ {
265
+ name: 'KitKat',
266
+ booleanIcon: false,
267
+ available: false,
268
+ calories: 518,
269
+ fat: 26.0,
270
+ carbs: 65,
271
+ checked: true,
272
+ protein: 7,
273
+ sodium: 54,
274
+ calcium: '12%',
275
+ iron: '6%'
276
+ }
277
+ ],
278
+ visibleColumns: []
279
+ }
280
+ },
281
+ computed: {
282
+ pageLength (): number {
283
+ return (this.totalPage + 1) * this.pageSize
284
+ },
285
+ filter ():object {
286
+ return {
287
+ search: this.store.filterValue,
288
+ forceRender: this.forceRender
289
+ }
290
+ }
291
+ },
292
+ mounted () {
293
+ this.store.cleanTableFilter()
294
+ this.tableStyle = setTableHeight.setTableHeight()
295
+ infiniteScroll.handleInfiniteScrollNewTable(this)
296
+ // this.rows = this.rowsData
297
+ this.visibleColumns = this.store.visiblecolumns
298
+
299
+ const lista = this.rowsData
300
+ const lista2 = []
301
+ for (let i = 0; i < lista.length; i++) {
302
+ lista2.push({
303
+ name: lista[i].name,
304
+ booleanIcon: lista[i].booleanIcon,
305
+ available: lista[i].available,
306
+ calories: lista[i].calories,
307
+ fat: lista[i]. fat,
308
+ carbs: lista[i].carbs,
309
+ checked: lista[i].checked,
310
+ protein: lista[i].protein,
311
+ sodium: lista[i].sodium,
312
+ calcium: lista[i].calcium,
313
+ iron: lista[i].iron
314
+ })
315
+ }
316
+ this.rows = lista2
317
+ this.showSkeleton = false
318
+
319
+ },
320
+ methods: {
321
+ saveSelectedColumns (columns: string []): void {
322
+ this.store.visiblecolumns = columns
323
+ this.visibleColumns = columns
324
+ },
325
+ filterMethod (rows: string | [], terms: { search: string }): object[] | [] {
326
+ return FilterMethod.filter(this, rows, terms)
327
+ },
328
+ onUpdateBasicCheckboxValue (rows: object []) {
329
+ console.log(rows, 'onUpdateBasicCheckboxValue')
330
+ },
331
+ onUpdateCustomizedCheckboxValue (rows: object []) {
332
+ console.log(rows, 'onUpdateCustomizedCheckboxValue')
333
+ },
334
+ setItemNotFound (rows: object []) {
335
+ console.log(rows, 'onClickButton')
336
+ }
337
+ }
338
+ }
339
+ </script>