Skip to content

Commit a2f4175

Browse files
committed
feat: QLayoutHeader/Footer emits @reveal when changing state
1 parent 1c06dc6 commit a2f4175

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

src/components/layout/QLayoutFooter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export default {
3131
offset (val) {
3232
this.__update('offset', val)
3333
},
34-
revealed () {
34+
revealed (val) {
3535
this.layout.__animate()
36+
this.$emit('reveal', val)
3637
},
3738
'layout.scroll' () {
3839
this.__updateRevealed()

src/components/layout/QLayoutHeader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ export default {
3535
offset (val) {
3636
this.__update('offset', val)
3737
},
38-
revealed () {
38+
revealed (val) {
3939
this.layout.__animate()
40+
this.$emit('reveal', val)
4041
},
4142
'layout.scroll' (scroll) {
4243
if (!this.reveal) {

src/components/table/table-body.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
: h('td', { staticClass: col.__tdClass }, this.getCellValue(col, row))
4141
})
4242

43-
if (this.selection) {
43+
if (this.hasSelectionMode) {
4444
child.unshift(h('td', { staticClass: 'q-table-col-auto-width' }, [
4545
h(QCheckbox, {
4646
props: {
@@ -71,7 +71,7 @@ export default {
7171
return h('tbody', child)
7272
},
7373
addBodyRowMeta (data) {
74-
if (this.selection) {
74+
if (this.hasSelectionMode) {
7575
Object.defineProperty(data, 'selected', {
7676
get: () => this.isRowSelected(data.key),
7777
set: adding => {

src/components/table/table-bottom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default {
3434

3535
return [
3636
h('div', { staticClass: 'col' }, [
37-
this.selection && this.rowsSelectedNumber > 0
37+
this.hasSelectionMode && this.rowsSelectedNumber > 0
3838
? (this.selectedRowsLabel || this.$q.i18n.table.selectedRows)(this.rowsSelectedNumber)
3939
: ''
4040
]),

src/components/table/table-row-selection.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export default {
22
props: {
33
selection: {
44
type: String,
5-
validator: v => ['single', 'multiple'].includes(v)
5+
default: 'none',
6+
validator: v => ['single', 'multiple', 'none'].includes(v)
67
},
78
selected: {
89
type: Array,
@@ -17,6 +18,9 @@ export default {
1718
})
1819
return keys
1920
},
21+
hasSelectionMode () {
22+
return this.selection !== 'none'
23+
},
2024
singleSelection () {
2125
return this.selection === 'single'
2226
},

src/components/table/table-top.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
topLeft = this.$scopedSlots['top-left'],
2222
topRight = this.$scopedSlots['top-right'],
2323
topSelection = this.$scopedSlots['top-selection'],
24-
hasSelection = this.selection && topSelection && this.rowsSelectedNumber > 0,
24+
hasSelection = this.hasSelectionMode && topSelection && this.rowsSelectedNumber > 0,
2525
staticClass = 'q-table-top relative-position row no-wrap items-center',
2626
child = []
2727

0 commit comments

Comments
 (0)