quasar-factory-lib 0.0.47 → 0.0.49
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/dist/components/Table/Table.vue.d.ts +32 -18
- package/dist/components/Table/components/TableSlotBody.vue.d.ts +9 -0
- package/dist/components/Table/components/TableSlotGrid.vue.d.ts +9 -0
- package/dist/components/Table/utils/filterMethod.d.ts +1 -1
- package/dist/layouts/PdaLayout.vue.d.ts +34 -26
- package/dist/pages/TablePage.vue.d.ts +88 -54
- package/dist/quasar-factory-lib.js +1734 -1687
- package/dist/quasar-factory-lib.umd.cjs +11 -11
- package/dist/store/table.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Table/Table.vue +103 -11
- package/src/components/Table/components/TableSlotBody.vue +5 -1
- package/src/components/Table/components/TableSlotGrid.vue +5 -1
- package/src/components/Table/utils/filterMethod.ts +3 -1
- package/src/css/app.css +10 -1
- package/src/layouts/PdaLayout.vue +0 -15
- package/src/pages/TablePage.vue +107 -45
- package/src/store/table.js +1 -1
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<!-- eslint-disable vue/no-v-model-argument -->
|
|
4
4
|
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
|
|
5
5
|
<div>
|
|
6
|
+
{{filteredRows.length}}
|
|
6
7
|
<q-table
|
|
7
8
|
v-if="!showSkeleton"
|
|
8
9
|
ref="myTable"
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
:grid="smallDevice"
|
|
12
13
|
:style="tableStyle"
|
|
13
14
|
flat
|
|
15
|
+
:filter-method="customFilter"
|
|
14
16
|
bordered
|
|
15
17
|
:rows="rowsData"
|
|
16
18
|
:columns="columns"
|
|
@@ -21,8 +23,7 @@
|
|
|
21
23
|
table-class="text-grey-9"
|
|
22
24
|
table-header-class="main-color"
|
|
23
25
|
:filter="filterComputed"
|
|
24
|
-
:
|
|
25
|
-
:sort-method="sortMethod"
|
|
26
|
+
:sort-method="customSortMethod"
|
|
26
27
|
separator="horizontal"
|
|
27
28
|
binary-state-sort
|
|
28
29
|
:selected-rows-label="getSelectedString"
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
v-if="!showSkeleton"
|
|
62
63
|
:table-props="props"
|
|
63
64
|
:selection-type="selectionType"
|
|
65
|
+
:getCellClass="getCellClass"
|
|
64
66
|
@on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
|
|
65
67
|
@on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
|
|
66
68
|
@on-save-value-popup-edit="onSaveValuePopupEdit"
|
|
@@ -74,6 +76,7 @@
|
|
|
74
76
|
:table-props="props"
|
|
75
77
|
:selection-type="selectionType"
|
|
76
78
|
:popup-edit-number-options="popupEditNumberOptions"
|
|
79
|
+
:getCellClass="getCellClass"
|
|
77
80
|
@on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
|
|
78
81
|
@on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
|
|
79
82
|
@on-save-value-popup-edit="onSaveValuePopupEdit"
|
|
@@ -125,14 +128,14 @@ export default defineComponent({
|
|
|
125
128
|
type: Array as () => string[],
|
|
126
129
|
required: true
|
|
127
130
|
},
|
|
128
|
-
filterMethod: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
sortMethod: {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
131
|
+
// filterMethod: {
|
|
132
|
+
// type: Function,
|
|
133
|
+
// default: function () {}
|
|
134
|
+
// },
|
|
135
|
+
// sortMethod: {
|
|
136
|
+
// type: Function,
|
|
137
|
+
// default: function () {}
|
|
138
|
+
// },
|
|
136
139
|
selectionType: {
|
|
137
140
|
type: String as () => 'none' | 'single' | 'multiple',
|
|
138
141
|
default: 'none'
|
|
@@ -175,7 +178,15 @@ export default defineComponent({
|
|
|
175
178
|
filterComputedOptions: {
|
|
176
179
|
type: Object,
|
|
177
180
|
default: {}
|
|
181
|
+
},
|
|
182
|
+
getCellClass: {
|
|
183
|
+
type: Function,
|
|
184
|
+
default: function () {}
|
|
178
185
|
}
|
|
186
|
+
// filteredRows: {
|
|
187
|
+
// type: Array,
|
|
188
|
+
// required: true
|
|
189
|
+
// }
|
|
179
190
|
},
|
|
180
191
|
emits: [
|
|
181
192
|
'onSelectVisibleColumns',
|
|
@@ -201,7 +212,8 @@ export default defineComponent({
|
|
|
201
212
|
loading: false,
|
|
202
213
|
forceRender: false,
|
|
203
214
|
totalPage: 0,
|
|
204
|
-
pageSize:
|
|
215
|
+
pageSize: 5,
|
|
216
|
+
filteredRows: [] as object | []
|
|
205
217
|
}
|
|
206
218
|
},
|
|
207
219
|
computed: {
|
|
@@ -230,6 +242,7 @@ export default defineComponent({
|
|
|
230
242
|
pageLength (): number {
|
|
231
243
|
return (this.totalPage + 1) * this.pageSize
|
|
232
244
|
}
|
|
245
|
+
|
|
233
246
|
},
|
|
234
247
|
watch: {
|
|
235
248
|
rows (val) {
|
|
@@ -238,6 +251,7 @@ export default defineComponent({
|
|
|
238
251
|
visibleColumns (val: string [] | []) {
|
|
239
252
|
this.visibleColumnsData = val
|
|
240
253
|
}
|
|
254
|
+
|
|
241
255
|
},
|
|
242
256
|
mounted () {
|
|
243
257
|
},
|
|
@@ -292,6 +306,84 @@ export default defineComponent({
|
|
|
292
306
|
},
|
|
293
307
|
toogleLoading () {
|
|
294
308
|
this.loading = !this.loading
|
|
309
|
+
},
|
|
310
|
+
customSortMethod(
|
|
311
|
+
rows,
|
|
312
|
+
sortBy: string,
|
|
313
|
+
descending: boolean
|
|
314
|
+
) {
|
|
315
|
+
let data = []
|
|
316
|
+
if (this.store.filterValue === '') {
|
|
317
|
+
data = [...this.rows];
|
|
318
|
+
} else {
|
|
319
|
+
data = [...this.filteredRows];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (sortBy) {
|
|
323
|
+
data.sort((a, b) => {
|
|
324
|
+
const x = descending ? b : a;
|
|
325
|
+
const y = descending ? a : b;
|
|
326
|
+
|
|
327
|
+
const xValue = x[sortBy];
|
|
328
|
+
const yValue = y[sortBy];
|
|
329
|
+
|
|
330
|
+
const parseDate = (dateString: string): Date => {
|
|
331
|
+
const [day, month, year] = dateString.split('/');
|
|
332
|
+
return new Date(`${year}-${month}-${day}`); // Converte para 'yyyy-mm-dd'
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const parseTime = (timeString: string): number => {
|
|
336
|
+
const [hours, minutes, seconds] = timeString.split(':').map(Number);
|
|
337
|
+
return (hours * 3600) + (minutes * 60) + seconds; // Converte para o total de segundos
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
if (typeof xValue === 'string' && typeof yValue === 'string') {
|
|
341
|
+
const xDate = parseDate(xValue);
|
|
342
|
+
const yDate = parseDate(yValue);
|
|
343
|
+
|
|
344
|
+
if (!isNaN(xDate.getTime()) && !isNaN(yDate.getTime())) {
|
|
345
|
+
return xDate.getTime() - yDate.getTime();
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const xTime = parseTime(xValue);
|
|
349
|
+
const yTime = parseTime(yValue);
|
|
350
|
+
|
|
351
|
+
if (!isNaN(xTime) && !isNaN(yTime)) {
|
|
352
|
+
return xTime - yTime;
|
|
353
|
+
} else {
|
|
354
|
+
return xValue.localeCompare(yValue);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else if (typeof xValue === 'number' && typeof yValue === 'number') {
|
|
358
|
+
return xValue - yValue;
|
|
359
|
+
}
|
|
360
|
+
else if (typeof xValue === 'boolean' && typeof yValue === 'boolean') {
|
|
361
|
+
return xValue === yValue ? 0 : xValue ? 1 : -1;
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
return String(xValue) > String(yValue) ? 1 : String(xValue) < String(yValue) ? -1 : 0;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
return data.slice(0, this.pageLength);
|
|
369
|
+
},
|
|
370
|
+
customFilter(rows: string | [], terms: { search: string }) {
|
|
371
|
+
console.log('terms', terms)
|
|
372
|
+
if (this.store.filterValue === '') return this.rows.slice(0, this.pageLength);
|
|
373
|
+
|
|
374
|
+
const filteredRows = this.rows.filter((row) => {
|
|
375
|
+
const rowValues = Object.values(row).join(" ").toLowerCase();
|
|
376
|
+
|
|
377
|
+
if (terms.search && terms.search.trim() !== '') {
|
|
378
|
+
if (rowValues.includes(terms.search.toLowerCase())) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return false
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
this.filteredRows = filteredRows
|
|
386
|
+
return filteredRows.slice(0, this.pageLength);
|
|
295
387
|
}
|
|
296
388
|
}
|
|
297
389
|
})
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
:props="tablePropsData"
|
|
20
20
|
>
|
|
21
21
|
<span
|
|
22
|
-
:
|
|
22
|
+
:class="getCellClass(tablePropsData.row, col)"
|
|
23
23
|
v-if="getColumnValue(col)"
|
|
24
24
|
v-html="tablePropsData.row[col.name]"
|
|
25
25
|
/>
|
|
@@ -114,6 +114,10 @@ export default {
|
|
|
114
114
|
selectionType: {
|
|
115
115
|
type: String,
|
|
116
116
|
default: 'none'
|
|
117
|
+
},
|
|
118
|
+
getCellClass: {
|
|
119
|
+
type: Function,
|
|
120
|
+
default: function () {}
|
|
117
121
|
}
|
|
118
122
|
},
|
|
119
123
|
watch: {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<q-item-label
|
|
40
40
|
v-if="getColumnValue(col)"
|
|
41
41
|
class="itemsFontSize text-almost-black"
|
|
42
|
-
:
|
|
42
|
+
:class="getCellClass(tablePropsData.row, col)"
|
|
43
43
|
>
|
|
44
44
|
<q-icon
|
|
45
45
|
v-if="col.editable"
|
|
@@ -147,6 +147,10 @@ export default {
|
|
|
147
147
|
},
|
|
148
148
|
popupEditNumberOptions: {
|
|
149
149
|
type: Array
|
|
150
|
+
},
|
|
151
|
+
getCellClass: {
|
|
152
|
+
type: Function,
|
|
153
|
+
default: function () {}
|
|
150
154
|
}
|
|
151
155
|
},
|
|
152
156
|
emits: [
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import infiniteScroll from './infiniteScroll'
|
|
4
4
|
const filterMethod = {
|
|
5
|
-
filter (self: { filteredRows: object [] | [] }, rows: string | [], terms: { search: string })
|
|
5
|
+
filter (self: { filteredRows: object [] | [] }, rows: string | [], terms: { search: string }) {
|
|
6
|
+
console.log(rows)
|
|
6
7
|
if (terms.search !== '') {
|
|
7
8
|
const filteredRows = []
|
|
8
9
|
const lowerSearch = terms.search ? terms.search.toLowerCase() : ''
|
|
@@ -14,6 +15,7 @@ const filterMethod = {
|
|
|
14
15
|
self.filteredRows = filteredRows
|
|
15
16
|
return infiniteScroll.paginationNewTable(self, filteredRows)
|
|
16
17
|
} else {
|
|
18
|
+
self.filteredRows = rows
|
|
17
19
|
return infiniteScroll.paginationNewTable(self, rows)
|
|
18
20
|
}
|
|
19
21
|
},
|
package/src/css/app.css
CHANGED
|
@@ -44,4 +44,13 @@
|
|
|
44
44
|
|
|
45
45
|
.text-color-positive {
|
|
46
46
|
color: var(--positive);
|
|
47
|
-
|
|
47
|
+
font-weight: bold;
|
|
48
|
+
}
|
|
49
|
+
.text-color-negative-bold {
|
|
50
|
+
color: var(--negative);
|
|
51
|
+
font-weight: bold;
|
|
52
|
+
font-size: 30px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* const labelTextColor = 'color: #597765 !important;'
|
|
56
|
+
const labelTextColorBold = 'color: #597765 !important; font-weight: bold;' */
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
:show-skeleton="false"
|
|
31
31
|
:selection-type="'multiple'"
|
|
32
32
|
:filter-method="filterMethod"
|
|
33
|
-
:filter-computed="filter"
|
|
34
33
|
@on-select-visible-columns="saveSelectedColumns"
|
|
35
34
|
@on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
|
|
36
35
|
@on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
|
|
@@ -58,10 +57,7 @@ export default {
|
|
|
58
57
|
data () {
|
|
59
58
|
return {
|
|
60
59
|
showDialog: false,
|
|
61
|
-
forceRender: false,
|
|
62
60
|
store: tableStore(),
|
|
63
|
-
totalPage: 0,
|
|
64
|
-
pageSize: 20,
|
|
65
61
|
tableStyle: '',
|
|
66
62
|
columns: [{
|
|
67
63
|
name: 'name',
|
|
@@ -312,17 +308,6 @@ export default {
|
|
|
312
308
|
visibleColumns: []
|
|
313
309
|
}
|
|
314
310
|
},
|
|
315
|
-
computed: {
|
|
316
|
-
pageLength (): number {
|
|
317
|
-
return (this.totalPage + 1) * this.pageSize
|
|
318
|
-
},
|
|
319
|
-
filter ():object {
|
|
320
|
-
return {
|
|
321
|
-
search: this.store.filterValue,
|
|
322
|
-
forceRender: this.forceRender
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
311
|
mounted () {
|
|
327
312
|
this.store.cleanTableFilter()
|
|
328
313
|
this.tableStyle = setTableHeight.setTableHeight()
|
package/src/pages/TablePage.vue
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
<q-page-container class=" full-width column justify-center">
|
|
3
3
|
<q-page
|
|
4
4
|
class="full-width column justify-center align-center items-center"
|
|
5
|
-
style="
|
|
5
|
+
style=""
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
8
|
class="full-width"
|
|
9
9
|
>
|
|
10
10
|
<Table
|
|
11
|
+
ref="table"
|
|
11
12
|
:rows="rows"
|
|
12
13
|
:columns="columns"
|
|
13
14
|
:visible-columns="visibleColumns"
|
|
@@ -16,9 +17,8 @@
|
|
|
16
17
|
:table-style="tableStyle"
|
|
17
18
|
:show-skeleton="false"
|
|
18
19
|
:selection-type="'multiple'"
|
|
19
|
-
:
|
|
20
|
-
:
|
|
21
|
-
:sort-method="sortMethod"
|
|
20
|
+
:getCellClass="getCellClass"
|
|
21
|
+
:filtered-rows="filteredRows"
|
|
22
22
|
@on-select-visible-columns="saveSelectedColumns"
|
|
23
23
|
@on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
|
|
24
24
|
@on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
|
|
@@ -33,7 +33,7 @@ import Table from '../components/Table/Table.vue'
|
|
|
33
33
|
import setTableHeight from '../components/Table/utils/setTableHeight'
|
|
34
34
|
import infiniteScroll from '../components/Table/utils/infiniteScroll'
|
|
35
35
|
import FilterMethod from '../components/Table/utils/filterMethod'
|
|
36
|
-
import TableSort from '../components/Table/utils/sort.js'
|
|
36
|
+
// import TableSort from '../components/Table/utils/sort.js'
|
|
37
37
|
import { tableStore } from '../store/table.js'
|
|
38
38
|
export default {
|
|
39
39
|
components: {
|
|
@@ -42,17 +42,32 @@ export default {
|
|
|
42
42
|
data () {
|
|
43
43
|
return {
|
|
44
44
|
showDialog: false,
|
|
45
|
-
forceRender: false,
|
|
46
45
|
store: tableStore(),
|
|
47
|
-
totalPage: 0,
|
|
48
|
-
pageSize: 20,
|
|
49
46
|
tableStyle: '',
|
|
50
|
-
columns: [
|
|
51
|
-
|
|
47
|
+
columns: [
|
|
48
|
+
{
|
|
49
|
+
name: 'date',
|
|
50
|
+
required: true,
|
|
51
|
+
label: 'Date',
|
|
52
|
+
align: 'left',
|
|
53
|
+
sortable: true,
|
|
54
|
+
field: 'date',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'time',
|
|
58
|
+
required: true,
|
|
59
|
+
label: 'Time',
|
|
60
|
+
align: 'left',
|
|
61
|
+
sortable: true,
|
|
62
|
+
field: 'time',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'dessert',
|
|
52
66
|
required: true,
|
|
53
|
-
label: 'Dessert
|
|
67
|
+
label: 'Dessert',
|
|
54
68
|
align: 'left',
|
|
55
|
-
sortable: true
|
|
69
|
+
sortable: true,
|
|
70
|
+
field: 'dessert'
|
|
56
71
|
},
|
|
57
72
|
{
|
|
58
73
|
name: 'available',
|
|
@@ -60,7 +75,8 @@ export default {
|
|
|
60
75
|
label: 'Available',
|
|
61
76
|
align: 'left',
|
|
62
77
|
sortable: true,
|
|
63
|
-
showBasicCheckbox: true
|
|
78
|
+
showBasicCheckbox: true,
|
|
79
|
+
field: 'available'
|
|
64
80
|
},
|
|
65
81
|
{
|
|
66
82
|
name: 'booleanIcon',
|
|
@@ -72,10 +88,10 @@ export default {
|
|
|
72
88
|
},
|
|
73
89
|
{
|
|
74
90
|
name: 'calories',
|
|
75
|
-
align: 'center',
|
|
76
91
|
label: 'Calories',
|
|
77
92
|
field: 'calories',
|
|
78
93
|
sortable: true,
|
|
94
|
+
align: 'left',
|
|
79
95
|
editable: true,
|
|
80
96
|
showEditIcon: true,
|
|
81
97
|
popupEditEmit: 'onSaveValuePopupEdit',
|
|
@@ -88,6 +104,7 @@ export default {
|
|
|
88
104
|
label: 'Fat (g)',
|
|
89
105
|
field: 'fat',
|
|
90
106
|
sortable: true,
|
|
107
|
+
align: 'left',
|
|
91
108
|
showCustomizedButton: true,
|
|
92
109
|
btnIcon: 'save',
|
|
93
110
|
btnEmit: 'onClickButton',
|
|
@@ -97,7 +114,10 @@ export default {
|
|
|
97
114
|
{
|
|
98
115
|
name: 'carbs',
|
|
99
116
|
label: 'Carbs (g)',
|
|
100
|
-
field: 'carbs'
|
|
117
|
+
field: 'carbs',
|
|
118
|
+
align: 'left',
|
|
119
|
+
sortable: true,
|
|
120
|
+
format: (val: number) => `${val}`
|
|
101
121
|
},
|
|
102
122
|
{
|
|
103
123
|
name: 'checked',
|
|
@@ -105,6 +125,7 @@ export default {
|
|
|
105
125
|
field: 'carbs',
|
|
106
126
|
sortable: true,
|
|
107
127
|
required: true,
|
|
128
|
+
align: 'left',
|
|
108
129
|
showCustomizedCheckBox: true,
|
|
109
130
|
checkedIcon: 'check_circle',
|
|
110
131
|
uncheckedIcon: 'cancel',
|
|
@@ -116,6 +137,7 @@ export default {
|
|
|
116
137
|
name: 'protein',
|
|
117
138
|
label: 'Protein (g)',
|
|
118
139
|
field: 'protein',
|
|
140
|
+
align: 'left',
|
|
119
141
|
sortable: true,
|
|
120
142
|
required: true,
|
|
121
143
|
editable: true,
|
|
@@ -128,26 +150,30 @@ export default {
|
|
|
128
150
|
{
|
|
129
151
|
name: 'sodium',
|
|
130
152
|
label: 'Sodium (mg)',
|
|
153
|
+
align: 'left',
|
|
131
154
|
field: 'sodium'
|
|
132
155
|
},
|
|
133
156
|
{
|
|
134
157
|
name: 'calcium',
|
|
135
158
|
label: 'Calcium (%)',
|
|
136
159
|
field: 'calcium',
|
|
160
|
+
align: 'left',
|
|
137
161
|
sortable: true
|
|
138
162
|
},
|
|
139
163
|
{
|
|
140
164
|
name: 'iron',
|
|
141
165
|
label: 'Iron (%)',
|
|
142
166
|
field: 'iron',
|
|
167
|
+
align: 'left',
|
|
143
168
|
sortable: true
|
|
144
169
|
}
|
|
145
170
|
],
|
|
146
171
|
rows: [],
|
|
147
172
|
rowsData: [
|
|
148
173
|
{
|
|
149
|
-
|
|
150
|
-
|
|
174
|
+
date: '12/12/2024',
|
|
175
|
+
time: '12:20:40',
|
|
176
|
+
dessert: 'Frozen Yogurt',
|
|
151
177
|
booleanIcon: true,
|
|
152
178
|
available: true,
|
|
153
179
|
calories: 159,
|
|
@@ -160,7 +186,9 @@ export default {
|
|
|
160
186
|
iron: '1%'
|
|
161
187
|
},
|
|
162
188
|
{
|
|
163
|
-
|
|
189
|
+
date: '18/12/2024',
|
|
190
|
+
time: '11:00:54',
|
|
191
|
+
dessert: 'Ice cream sandwich',
|
|
164
192
|
booleanIcon: true,
|
|
165
193
|
available: false,
|
|
166
194
|
calories: 237,
|
|
@@ -173,7 +201,9 @@ export default {
|
|
|
173
201
|
iron: '1%'
|
|
174
202
|
},
|
|
175
203
|
{
|
|
176
|
-
|
|
204
|
+
date: '05/07/2024',
|
|
205
|
+
time: ' 7:01:24',
|
|
206
|
+
dessert: 'Eclair',
|
|
177
207
|
booleanIcon: true,
|
|
178
208
|
available: true,
|
|
179
209
|
calories: 262,
|
|
@@ -186,7 +216,9 @@ export default {
|
|
|
186
216
|
iron: '7%'
|
|
187
217
|
},
|
|
188
218
|
{
|
|
189
|
-
|
|
219
|
+
date: '10/12/2023',
|
|
220
|
+
time: '12:04:33',
|
|
221
|
+
dessert: 'Cupcake',
|
|
190
222
|
booleanIcon: false,
|
|
191
223
|
available: false,
|
|
192
224
|
calories: 305,
|
|
@@ -199,7 +231,9 @@ export default {
|
|
|
199
231
|
iron: '8%'
|
|
200
232
|
},
|
|
201
233
|
{
|
|
202
|
-
|
|
234
|
+
date: '16/05/1999',
|
|
235
|
+
time: '10:43:25',
|
|
236
|
+
dessert: 'Gingerbread',
|
|
203
237
|
booleanIcon: true,
|
|
204
238
|
available: true,
|
|
205
239
|
calories: 356,
|
|
@@ -212,7 +246,9 @@ export default {
|
|
|
212
246
|
iron: '16%'
|
|
213
247
|
},
|
|
214
248
|
{
|
|
215
|
-
|
|
249
|
+
date: '01/01/0001',
|
|
250
|
+
time: '11:35:04',
|
|
251
|
+
dessert: 'Jelly bean',
|
|
216
252
|
booleanIcon: false,
|
|
217
253
|
available: false,
|
|
218
254
|
calories: 375,
|
|
@@ -225,7 +261,9 @@ export default {
|
|
|
225
261
|
iron: '0%'
|
|
226
262
|
},
|
|
227
263
|
{
|
|
228
|
-
|
|
264
|
+
date: '12/12/2024',
|
|
265
|
+
time: '12:51:01',
|
|
266
|
+
dessert: 'Lollipop',
|
|
229
267
|
booleanIcon: true,
|
|
230
268
|
available: true,
|
|
231
269
|
calories: 392,
|
|
@@ -238,7 +276,9 @@ export default {
|
|
|
238
276
|
iron: '2%'
|
|
239
277
|
},
|
|
240
278
|
{
|
|
241
|
-
|
|
279
|
+
date: '05/07/2022',
|
|
280
|
+
time: '14:39:34',
|
|
281
|
+
dessert: 'Honeycomb',
|
|
242
282
|
booleanIcon: true,
|
|
243
283
|
available: false,
|
|
244
284
|
calories: 408,
|
|
@@ -251,7 +291,9 @@ export default {
|
|
|
251
291
|
iron: '45%'
|
|
252
292
|
},
|
|
253
293
|
{
|
|
254
|
-
|
|
294
|
+
date: '14/03/2023',
|
|
295
|
+
time: '10:43:26',
|
|
296
|
+
dessert: 'Donut',
|
|
255
297
|
booleanIcon: true,
|
|
256
298
|
available: true,
|
|
257
299
|
calories: 452,
|
|
@@ -264,7 +306,9 @@ export default {
|
|
|
264
306
|
iron: '22%'
|
|
265
307
|
},
|
|
266
308
|
{
|
|
267
|
-
|
|
309
|
+
date: '12/12/2023',
|
|
310
|
+
time: '07:45:12',
|
|
311
|
+
dessert: 'KitKat',
|
|
268
312
|
booleanIcon: false,
|
|
269
313
|
available: false,
|
|
270
314
|
calories: 518,
|
|
@@ -282,25 +326,37 @@ export default {
|
|
|
282
326
|
filteredRows: []
|
|
283
327
|
}
|
|
284
328
|
},
|
|
285
|
-
computed: {
|
|
286
|
-
pageLength (): number {
|
|
287
|
-
return (this.totalPage + 1) * this.pageSize
|
|
288
|
-
},
|
|
289
|
-
filter ():object {
|
|
290
|
-
return {
|
|
291
|
-
search: this.store.filterValue,
|
|
292
|
-
forceRender: this.forceRender
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
329
|
mounted () {
|
|
297
330
|
this.store.cleanTableFilter()
|
|
298
331
|
this.visibleColumns = this.store.visiblecolumns
|
|
299
332
|
this.tableStyle = setTableHeight.setTableHeight()
|
|
300
333
|
infiniteScroll.handleInfiniteScrollNewTable(this)
|
|
301
|
-
this.
|
|
334
|
+
this.getRows()
|
|
335
|
+
|
|
302
336
|
},
|
|
303
337
|
methods: {
|
|
338
|
+
getRows () {
|
|
339
|
+
this.rows = []
|
|
340
|
+
const lista = this.rowsData
|
|
341
|
+
for (let i = 0; i < lista.length; i++) {
|
|
342
|
+
this.rows.push({
|
|
343
|
+
id: i + '-' + lista[i].dessert,
|
|
344
|
+
date: lista[i].date,
|
|
345
|
+
time: lista[i].time,
|
|
346
|
+
dessert: lista[i].dessert,
|
|
347
|
+
booleanIcon: lista[i].booleanIcon,
|
|
348
|
+
available: lista[i].available,
|
|
349
|
+
calories: lista[i].calories,
|
|
350
|
+
fat: lista[i].fat,
|
|
351
|
+
carbs: lista[i].carbs,
|
|
352
|
+
checked: lista[i].checked,
|
|
353
|
+
protein: lista[i].protein,
|
|
354
|
+
sodium: lista[i].sodium,
|
|
355
|
+
calcium: lista[i].calcium,
|
|
356
|
+
iron: lista[i].iron
|
|
357
|
+
})
|
|
358
|
+
}
|
|
359
|
+
},
|
|
304
360
|
saveSelectedColumns (columns: string []): void {
|
|
305
361
|
this.store.visiblecolumns = columns
|
|
306
362
|
this.visibleColumns = columns
|
|
@@ -317,14 +373,20 @@ export default {
|
|
|
317
373
|
setItemNotFound (rows: object []) {
|
|
318
374
|
console.log(rows, 'onClickButton')
|
|
319
375
|
},
|
|
320
|
-
sortMethod (rows: object[], sortBy: string, descending: boolean): object[] | [] {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
376
|
+
// sortMethod (rows: object[], sortBy: string, descending: boolean): object[] | [] {
|
|
377
|
+
// let allrowsSorted = []
|
|
378
|
+
// if (this.store.filterValue !== '') {
|
|
379
|
+
// allrowsSorted = TableSort.sortMethod(this.filteredRows, sortBy, descending, this.sortDateValues)
|
|
380
|
+
// } else {
|
|
381
|
+
// allrowsSorted = TableSort.sortMethod(this.rows, sortBy, descending, this.sortDateValues)
|
|
382
|
+
// }
|
|
383
|
+
// return allrowsSorted.slice(0, rows.length)
|
|
384
|
+
// },
|
|
385
|
+
getCellClass (row, col) {
|
|
386
|
+
if (col.name === 'dessert' && row.dessert === 'Frozen Yogurt') {
|
|
387
|
+
return 'text-color-negative-bold';
|
|
326
388
|
}
|
|
327
|
-
|
|
389
|
+
return '';
|
|
328
390
|
}
|
|
329
391
|
}
|
|
330
392
|
}
|
package/src/store/table.js
CHANGED
|
@@ -6,7 +6,7 @@ export const tableStore = defineStore('tableStore', {
|
|
|
6
6
|
filterValue: useStorage('filterValue', ''),
|
|
7
7
|
lastFilterValue: useStorage('lastFilterValue', ''),
|
|
8
8
|
visiblecolumns: useStorage('visiblecolumns', []),
|
|
9
|
-
|
|
9
|
+
prepared: useStorage('prepared', false),
|
|
10
10
|
}),
|
|
11
11
|
getters: {
|
|
12
12
|
},
|