Fixed #5828 - ContextMenu:there are no emitters before-show and before-hide

pull/5850/head
tugcekucukoglu 2024-06-07 09:45:43 +03:00
parent 78b9416f06
commit 5fdba8c0c3
1 changed files with 3 additions and 1 deletions

View File

@ -44,7 +44,7 @@ export default {
name: 'ContextMenu', name: 'ContextMenu',
extends: BaseContextMenu, extends: BaseContextMenu,
inheritAttrs: false, inheritAttrs: false,
emits: ['focus', 'blur', 'show', 'hide'], emits: ['focus', 'blur', 'show', 'hide', 'before-hide', 'before-show'],
target: null, target: null,
outsideClickListener: null, outsideClickListener: null,
resizeListener: null, resizeListener: null,
@ -125,6 +125,7 @@ export default {
this.visible ? this.hide() : this.show(event); this.visible ? this.hide() : this.show(event);
}, },
show(event) { show(event) {
this.$emit('before-show');
this.activeItemPath = []; this.activeItemPath = [];
this.focusedItemInfo = { index: -1, level: 0, parentKey: '' }; this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };
DomHandler.focus(this.list); DomHandler.focus(this.list);
@ -137,6 +138,7 @@ export default {
event.preventDefault(); event.preventDefault();
}, },
hide() { hide() {
this.$emit('before-hide');
this.visible = false; this.visible = false;
this.activeItemPath = []; this.activeItemPath = [];
this.focusedItemInfo = { index: -1, level: 0, parentKey: '' }; this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };