quasar-factory-lib 0.0.40 → 0.0.41
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 +10 -22
- package/dist/layouts/PdaLayout.vue.d.ts +10 -22
- package/dist/pages/TablePage.vue.d.ts +13 -22
- package/dist/quasar-factory-lib.js +1329 -1355
- package/dist/quasar-factory-lib.umd.cjs +11 -11
- package/package.json +1 -1
- package/src/components/Table/Table.vue +7 -22
- package/src/components/Table/utils/filterMethod.ts +6 -10
- package/src/pages/TablePage.vue +15 -2
package/package.json
CHANGED
|
@@ -99,7 +99,6 @@ import TableColumnsSelector from './components/TableColumnsSelector.vue'
|
|
|
99
99
|
import TableSlotBody from './components/TableSlotBody.vue'
|
|
100
100
|
import TableSlotGrid from './components/TableSlotGrid.vue'
|
|
101
101
|
import TableFilter from './components/TableFilter.vue'
|
|
102
|
-
import TableSort from './utils/sort.js'
|
|
103
102
|
import TableSkeleton from './components/TableSkeleton.vue'
|
|
104
103
|
import CardListSkeleton from './components/CardListSkeleton.vue'
|
|
105
104
|
|
|
@@ -128,15 +127,15 @@ export default defineComponent({
|
|
|
128
127
|
},
|
|
129
128
|
filterMethod: {
|
|
130
129
|
type: Function,
|
|
131
|
-
|
|
130
|
+
required: true
|
|
132
131
|
},
|
|
133
132
|
filterComputed: {
|
|
134
133
|
type: Object,
|
|
135
|
-
|
|
134
|
+
required: true
|
|
136
135
|
},
|
|
137
|
-
|
|
138
|
-
type:
|
|
139
|
-
|
|
136
|
+
sortMethod: {
|
|
137
|
+
type: Function,
|
|
138
|
+
required: true
|
|
140
139
|
},
|
|
141
140
|
selectionType: {
|
|
142
141
|
type: String as () => 'none' | 'single' | 'multiple',
|
|
@@ -176,10 +175,6 @@ export default defineComponent({
|
|
|
176
175
|
},
|
|
177
176
|
showSkeleton: {
|
|
178
177
|
type: Boolean
|
|
179
|
-
},
|
|
180
|
-
filteredRows: {
|
|
181
|
-
type: Array as () => object [] | [],
|
|
182
|
-
required: true
|
|
183
178
|
}
|
|
184
179
|
},
|
|
185
180
|
emits: [
|
|
@@ -288,17 +283,7 @@ export default defineComponent({
|
|
|
288
283
|
},
|
|
289
284
|
toogleLoading () {
|
|
290
285
|
this.loading = !this.loading
|
|
291
|
-
}
|
|
292
|
-
sortMethod (rows: object[], sortBy: string, descending: boolean): object[] | [] {
|
|
293
|
-
console.log(rows.length)
|
|
294
|
-
const allrowsSorted = TableSort.sortMethod(this.filteredRows, sortBy, descending, this.sortDataValues)
|
|
295
|
-
const rowsSliced = allrowsSorted.slice(0, rows.length)
|
|
296
|
-
if (this.store.filterValue === '') {
|
|
297
|
-
return rowsSliced
|
|
298
|
-
} else {
|
|
299
|
-
return TableSort.sortMethod(rows, sortBy, descending, this.sortDataValues)
|
|
300
|
-
}
|
|
301
|
-
},
|
|
286
|
+
}
|
|
302
287
|
}
|
|
303
288
|
})
|
|
304
|
-
</script>
|
|
289
|
+
</script>
|
|
@@ -2,22 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import infiniteScroll from './infiniteScroll'
|
|
4
4
|
const filterMethod = {
|
|
5
|
-
filter (self: {filterTerms: string, filteredRows: object[] | [] }, rows: string | [], terms: { search: string }): object[] | [] {
|
|
6
|
-
|
|
7
|
-
self.filterTerms = terms.search
|
|
8
|
-
if (terms.search) {
|
|
5
|
+
filter (self: {filterTerms: string, filteredRows: object [] | [] }, rows: string | [], terms: { search: string }): object[] | [] {
|
|
6
|
+
if (self.store.filterValue !== '') {
|
|
9
7
|
const filteredRows = []
|
|
10
8
|
const lowerSearch = terms.search ? terms.search.toLowerCase() : ''
|
|
11
|
-
for (let i = 0; i < rows.length; i++) {
|
|
12
|
-
if (this.containsSearchTermInRow(rows[i], lowerSearch)) {
|
|
13
|
-
filteredRows.push(rows[i])
|
|
9
|
+
for (let i = 0; i < self.rows.length; i++) {
|
|
10
|
+
if (this.containsSearchTermInRow(self.rows[i], lowerSearch)) {
|
|
11
|
+
filteredRows.push(self.rows[i])
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
// console.log(filteredRows.length, 'filteredRows terms')
|
|
14
|
+
self.filteredRows = filteredRows
|
|
18
15
|
return infiniteScroll.paginationNewTable(self, filteredRows)
|
|
19
16
|
} else {
|
|
20
|
-
self.filteredRows = rows
|
|
21
17
|
return infiniteScroll.paginationNewTable(self, rows)
|
|
22
18
|
}
|
|
23
19
|
},
|
package/src/pages/TablePage.vue
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
:selection-type="'multiple'"
|
|
19
19
|
:filter-method="filterMethod"
|
|
20
20
|
:filter-computed="filter"
|
|
21
|
+
:sort-method="sortMethod"
|
|
21
22
|
@on-select-visible-columns="saveSelectedColumns"
|
|
22
23
|
@on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
|
|
23
24
|
@on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
|
|
@@ -32,6 +33,7 @@ import Table from '../components/Table/Table.vue'
|
|
|
32
33
|
import setTableHeight from '../components/Table/utils/setTableHeight'
|
|
33
34
|
import infiniteScroll from '../components/Table/utils/infiniteScroll'
|
|
34
35
|
import FilterMethod from '../components/Table/utils/filterMethod'
|
|
36
|
+
import TableSort from '../components/Table/utils/sort.js'
|
|
35
37
|
import { tableStore } from '../store/table.js'
|
|
36
38
|
export default {
|
|
37
39
|
components: {
|
|
@@ -275,7 +277,9 @@ export default {
|
|
|
275
277
|
iron: '6%'
|
|
276
278
|
}
|
|
277
279
|
],
|
|
278
|
-
visibleColumns: []
|
|
280
|
+
visibleColumns: [],
|
|
281
|
+
sortDateValues: ['dateCreation'],
|
|
282
|
+
filteredRows: []
|
|
279
283
|
}
|
|
280
284
|
},
|
|
281
285
|
computed: {
|
|
@@ -291,10 +295,10 @@ export default {
|
|
|
291
295
|
},
|
|
292
296
|
mounted () {
|
|
293
297
|
this.store.cleanTableFilter()
|
|
298
|
+
this.visibleColumns = this.store.visiblecolumns
|
|
294
299
|
this.tableStyle = setTableHeight.setTableHeight()
|
|
295
300
|
infiniteScroll.handleInfiniteScrollNewTable(this)
|
|
296
301
|
this.rows = this.rowsData
|
|
297
|
-
this.visibleColumns = this.store.visiblecolumns
|
|
298
302
|
},
|
|
299
303
|
methods: {
|
|
300
304
|
saveSelectedColumns (columns: string []): void {
|
|
@@ -312,6 +316,15 @@ export default {
|
|
|
312
316
|
},
|
|
313
317
|
setItemNotFound (rows: object []) {
|
|
314
318
|
console.log(rows, 'onClickButton')
|
|
319
|
+
},
|
|
320
|
+
sortMethod (rows: object[], sortBy: string, descending: boolean): object[] | [] {
|
|
321
|
+
let allrowsSorted = []
|
|
322
|
+
if (this.store.filterValue !== '') {
|
|
323
|
+
allrowsSorted = TableSort.sortMethod(this.filteredRows, sortBy, descending, this.sortDateValues)
|
|
324
|
+
} else {
|
|
325
|
+
allrowsSorted = TableSort.sortMethod(this.rows, sortBy, descending, this.sortDateValues)
|
|
326
|
+
}
|
|
327
|
+
return allrowsSorted.slice(0, rows.length)
|
|
315
328
|
}
|
|
316
329
|
}
|
|
317
330
|
}
|