Skip to content

Commit 2c41b93

Browse files
committed
feat(history mixin): Add history mixin and update QDialog/QMenu/QTooltip
1 parent 0fe0579 commit 2c41b93

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

ui/src/components/dialog/QDialog.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ export default Vue.extend({
3232

3333
mixins: [ ModelToggleMixin, PortalMixin, PreventScrollMixin ],
3434

35-
modelToggle: {
36-
history: true
37-
},
38-
3935
props: {
4036
persistent: Boolean,
4137
autoClose: Boolean,
@@ -316,6 +312,10 @@ export default Vue.extend({
316312
}
317313
},
318314

315+
mounted () {
316+
this.__processModelChange(this.value)
317+
},
318+
319319
beforeDestroy () {
320320
this.__cleanup()
321321
}

ui/src/components/menu/QMenu.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ export default Vue.extend({
267267
}
268268
},
269269

270+
mounted () {
271+
this.__processModelChange(this.value)
272+
},
273+
270274
beforeDestroy () {
271275
// When the menu is destroyed while open we can only emit the event on anchorEl
272276
if (this.showing === true && this.anchorEl !== void 0) {

ui/src/components/tooltip/QTooltip.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,5 +207,9 @@ export default Vue.extend({
207207
}, slot(this, 'default')) : null
208208
])
209209
}
210+
},
211+
212+
mounted () {
213+
this.__processModelChange(this.value)
210214
}
211215
})

ui/src/mixins/history.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import History from '../history.js'
2+
3+
export default {
4+
methods: {
5+
__addHistory () {
6+
this.__historyEntry = {
7+
condition: () => { return this.navigationHideCondition === true },
8+
handler: this.hide
9+
}
10+
History.add(this.__historyEntry)
11+
},
12+
13+
__removeHistory () {
14+
if (this.__historyEntry !== void 0) {
15+
History.remove(this.__historyEntry)
16+
this.__historyEntry = void 0
17+
}
18+
}
19+
},
20+
21+
beforeDestroy () {
22+
this.showing === true && this.__removeHistory()
23+
}
24+
}

0 commit comments

Comments
 (0)