Skip to content

Commit c036edf

Browse files
committed
fix(QTable): top & bottom responsiveness
1 parent a2be67b commit c036edf

File tree

5 files changed

+73
-32
lines changed

5 files changed

+73
-32
lines changed

dev/components/components/data-table2.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,17 @@
9494
<h4>Filter, Column selection</h4>
9595
<q-table
9696
:data="data"
97+
title="Filter, Column selection"
9798
:columns="columns"
9899
:filter="filter"
99100
:visible-columns="visibleColumns"
100101
row-key="name"
101102
color="primary"
102103
>
103104
<template slot="top-right" slot-scope="props">
104-
<q-search hide-underline color="primary" v-model="filter" />
105-
<q-table-columns color="primary" class="on-right" v-model="visibleColumns" :columns="columns" />
106-
<q-btn color="primary" flat round dense icon="more_vert" class="on-right">
105+
<q-search hide-underline color="primary" class="q-mr-sm" v-model="filter" />
106+
<q-table-columns color="primary" class="q-mr-sm" v-model="visibleColumns" :columns="columns" />
107+
<q-btn color="primary" flat round dense icon="more_vert">
107108
<q-popover ref="popover">
108109
<q-list link>
109110
<q-item @click.native="$refs.popover.hide()">

src/components/table/table-bottom.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ export default {
2222

2323
const bottom = this.$scopedSlots.bottom
2424

25-
return h('div', { staticClass: 'q-table-bottom row items-center gutter-x-sm justify-between' },
26-
bottom ? [ bottom(this.marginalsProps) ] : this.getPaginationRow(h)
27-
)
25+
return h('div', {
26+
staticClass: 'q-table-bottom row items-center',
27+
'class': bottom ? null : 'justify-end'
28+
}, bottom ? [ bottom(this.marginalsProps) ] : this.getPaginationRow(h))
2829
},
2930
getPaginationRow (h) {
3031
const
@@ -33,12 +34,15 @@ export default {
3334
paginationSlot = this.$scopedSlots.pagination
3435

3536
return [
36-
h('div', { staticClass: 'col-auto' }, [
37-
this.hasSelectionMode && this.rowsSelectedNumber > 0
38-
? (this.selectedRowsLabel || this.$q.i18n.table.selectedRows)(this.rowsSelectedNumber)
39-
: ''
37+
h('div', { staticClass: 'q-table-control' }, [
38+
h('div', [
39+
this.hasSelectionMode && this.rowsSelectedNumber > 0
40+
? (this.selectedRowsLabel || this.$q.i18n.table.selectedRows)(this.rowsSelectedNumber)
41+
: ''
42+
])
4043
]),
41-
h('div', { staticClass: 'col-auto flex items-center no-wrap' }, [
44+
h('div', { staticClass: 'q-table-separator col' }),
45+
h('div', { staticClass: 'q-table-control' }, [
4246
h('span', { staticClass: 'q-table-bottom-item' }, [
4347
this.rowsPerPageLabel || this.$q.i18n.table.rowsPerPage
4448
]),
@@ -59,7 +63,9 @@ export default {
5963
})
6064
}
6165
}
62-
}),
66+
})
67+
]),
68+
h('div', { staticClass: 'q-table-control' }, [
6369
paginationSlot
6470
? paginationSlot(this.marginalsProps)
6571
: [

src/components/table/table-top.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default {
2222
topRight = this.$scopedSlots['top-right'],
2323
topSelection = this.$scopedSlots['top-selection'],
2424
hasSelection = this.hasSelectionMode && topSelection && this.rowsSelectedNumber > 0,
25-
staticClass = 'q-table-top relative-position row no-wrap items-center',
25+
staticClass = 'q-table-top relative-position row items-center',
2626
child = []
2727

2828
if (top) {
@@ -34,16 +34,28 @@ export default {
3434
}
3535
else {
3636
if (topLeft) {
37-
child.push(topLeft(this.marginalsProps))
37+
child.push(
38+
h('div', { staticClass: 'q-table-control' }, [
39+
topLeft(this.marginalsProps)
40+
])
41+
)
3842
}
3943
else if (this.title) {
40-
child.push(h('div', { staticClass: 'q-table-title' }, this.title))
44+
child.push(
45+
h('div', { staticClass: 'q-table-control' }, [
46+
h('div', { staticClass: 'q-table-title' }, this.title)
47+
])
48+
)
4149
}
4250
}
4351

4452
if (topRight) {
4553
child.push(h('div', { staticClass: 'q-table-separator col' }))
46-
child.push(topRight(this.marginalsProps))
54+
child.push(
55+
h('div', { staticClass: 'q-table-control' }, [
56+
topRight(this.marginalsProps)
57+
])
58+
)
4759
}
4860

4961
if (child.length === 0) {

src/components/table/table.ios.styl

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
.q-table-top
99
min-height 64px
10-
padding 4px 24px
10+
padding 8px 24px
1111
&:before
1212
content ''
1313
position absolute
@@ -18,17 +18,20 @@
1818
left 0
1919
opacity .2
2020
transition $table-transition
21+
.q-table-control
22+
min-height 36px
23+
padding 8px 0
24+
flex-wrap wrap
25+
.q-table-title
26+
font-size 20px
27+
letter-spacing 0.005em
28+
font-weight 400
2129
.q-table-separator
2230
min-width 8px !important
2331
.q-table-nodata .q-icon
2432
font-size 200%
2533
padding-right 15px
2634

27-
.q-table-title
28-
font-size 20px
29-
letter-spacing .005em
30-
font-weight 400
31-
3235
.q-table-progress
3336
height 0 !important
3437
td
@@ -44,8 +47,14 @@
4447

4548
.q-table-bottom
4649
min-height 48px
47-
padding 0 14px 0 24px
50+
padding 4px 14px 4px 24px
4851
font-size 12px
52+
.q-table-control
53+
min-height 24px
54+
55+
.q-table-control
56+
display flex
57+
align-items center
4958

5059
.q-table-sort-icon
5160
transition $table-transition
@@ -148,7 +157,9 @@ table-dense()
148157
.q-table
149158
th, td
150159
padding 4px 8px
151-
thead tr, tbody td
160+
thead tr
161+
height 40px
162+
tbody td
152163
height 28px
153164

154165
.q-table-bottom-item

src/components/table/table.mat.styl

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
.q-table-top
99
min-height 64px
10-
padding 4px 24px
10+
padding 8px 24px
1111
&:before
1212
content ''
1313
position absolute
@@ -18,17 +18,20 @@
1818
left 0
1919
opacity .2
2020
transition $table-transition
21+
.q-table-control
22+
min-height 36px
23+
padding 8px 0
24+
flex-wrap wrap
25+
.q-table-title
26+
font-size 20px
27+
letter-spacing 0.005em
28+
font-weight 400
2129
.q-table-separator
2230
min-width 8px !important
2331
.q-table-nodata .q-icon
2432
font-size 200%
2533
padding-right 15px
2634

27-
.q-table-title
28-
font-size 20px
29-
letter-spacing .005em
30-
font-weight 400
31-
3235
.q-table-progress
3336
height 0 !important
3437
td
@@ -44,8 +47,14 @@
4447

4548
.q-table-bottom
4649
min-height 48px
47-
padding 0 14px 0 24px
50+
padding 4px 14px 4px 24px
4851
font-size 12px
52+
.q-table-control
53+
min-height 24px
54+
55+
.q-table-control
56+
display flex
57+
align-items center
4958

5059
.q-table-sort-icon
5160
transition $table-transition
@@ -148,7 +157,9 @@ table-dense()
148157
.q-table
149158
th, td
150159
padding 4px 8px
151-
thead tr, tbody td
160+
thead tr
161+
height 40px
162+
tbody td
152163
height 28px
153164

154165
.q-table-bottom-item

0 commit comments

Comments
 (0)