forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable-column-selection.js
More file actions
29 lines (27 loc) · 848 Bytes
/
table-column-selection.js
File metadata and controls
29 lines (27 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export default {
props: {
visibleColumns: Array
},
computed: {
computedCols () {
let { sortBy, descending } = this.computedPagination
const cols = this.visibleColumns
? this.columns.filter(col => col.required || this.visibleColumns.includes(col.name))
: this.columns
return cols.map(col => {
col.align = col.align || 'right'
col.__iconClass = `q-table-sort-icon q-table-sort-icon-${col.align}`
col.__thClass = `text-${col.align}${col.sortable ? ' sortable' : ''}${col.name === sortBy ? ` sorted ${descending ? 'sort-desc' : ''}` : ''}`
col.__tdClass = `text-${col.align}`
return col
})
},
computedColsMap () {
const names = {}
this.computedCols.forEach(col => {
names[col.name] = col
})
return names
}
}
}