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