From 3e59aa18b9f717d77ea5af4a1232d0919c54d487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 30 Aug 2023 09:27:36 +0300 Subject: [PATCH] Refactor #4351 - For ContextMenu --- components/lib/contextmenu/ContextMenu.vue | 20 +++++++---- components/lib/contextmenu/ContextMenuSub.vue | 35 +++++++++++++++++-- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/components/lib/contextmenu/ContextMenu.vue b/components/lib/contextmenu/ContextMenu.vue index b5f1c38b6..1ebdd5664 100755 --- a/components/lib/contextmenu/ContextMenu.vue +++ b/components/lib/contextmenu/ContextMenu.vue @@ -22,6 +22,7 @@ :level="0" :visible="submenuVisible" :pt="pt" + :unstyled="unstyled" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" @@ -78,6 +79,18 @@ export default { } } }, + beforeMount() { + if (!this.$slots.item) { + console.warn('In future versions, vue-router support will be removed. Item templating should be used.'); + } + }, + mounted() { + this.id = this.id || UniqueComponentId(); + + if (this.global) { + this.bindDocumentContextMenuListener(); + } + }, beforeUnmount() { this.unbindResizeListener(); this.unbindOutsideClickListener(); @@ -90,13 +103,6 @@ export default { this.target = null; this.container = null; }, - mounted() { - this.id = this.id || UniqueComponentId(); - - if (this.global) { - this.bindDocumentContextMenuListener(); - } - }, methods: { getItemProp(item, name) { return item ? ObjectUtils.getItemValue(item[name]) : undefined; diff --git a/components/lib/contextmenu/ContextMenuSub.vue b/components/lib/contextmenu/ContextMenuSub.vue index 70e4dd69d..3a7e01598 100755 --- a/components/lib/contextmenu/ContextMenuSub.vue +++ b/components/lib/contextmenu/ContextMenuSub.vue @@ -39,7 +39,7 @@ - +