From 8cc457318b01319976aa3324ff1338d50c212479 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:40:53 +0300 Subject: [PATCH] Refactor #4351 - For Menubar --- components/lib/menubar/Menubar.vue | 6 +++++ components/lib/menubar/MenubarSub.vue | 33 ++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/components/lib/menubar/Menubar.vue b/components/lib/menubar/Menubar.vue index 9a49711dd..7ccbf17da 100755 --- a/components/lib/menubar/Menubar.vue +++ b/components/lib/menubar/Menubar.vue @@ -39,6 +39,7 @@ :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" :pt="pt" + :unstyled="unstyled" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" @@ -88,6 +89,11 @@ export default { outsideClickListener: null, container: null, menubar: null, + 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(); }, diff --git a/components/lib/menubar/MenubarSub.vue b/components/lib/menubar/MenubarSub.vue index c660250de..220fd1482 100755 --- a/components/lib/menubar/MenubarSub.vue +++ b/components/lib/menubar/MenubarSub.vue @@ -38,7 +38,7 @@ - + this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1; + }, + getMenuItemProps(processedItem, index) { + return { + action: mergeProps( + { + class: this.cx('action'), + tabindex: -1, + 'aria-hidden': true + }, + this.getPTOptions(processedItem, index, 'action') + ), + icons: mergeProps( + { + class: [this.cx('icon'), this.getItemProp(processedItem, 'icon')] + }, + this.getPTOptions(processedItem, index, 'icon') + ), + label: mergeProps( + { + class: this.cx('label') + }, + this.getPTOptions(processedItem, index, 'label') + ), + submenuicon: mergeProps( + { + class: this.cx('submenuIcon') + }, + this.getPTOptions(processedItem, index, 'submenuIcon') + ) + }; } }, components: {