From f7572320c49bc9d8ca7eb8eded2488dfb300180e 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: Fri, 28 Apr 2023 09:58:51 +0300 Subject: [PATCH] Refactor #3907 - PanelMenu options added --- components/lib/panelmenu/PanelMenu.vue | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/components/lib/panelmenu/PanelMenu.vue b/components/lib/panelmenu/PanelMenu.vue index 66342c3d9..0c62dc052 100644 --- a/components/lib/panelmenu/PanelMenu.vue +++ b/components/lib/panelmenu/PanelMenu.vue @@ -13,24 +13,24 @@ :aria-disabled="isItemDisabled(item)" @click="onHeaderClick($event, item)" @keydown="onHeaderKeyDown($event, item)" - v-bind="ptm('header')" + v-bind="getPTOptions(item, 'header')" > -
+
@@ -107,6 +107,14 @@ export default { getItemLabel(item) { return this.getItemProp(item, 'label'); }, + getPTOptions(item, key) { + return this.ptm(key, { + options: { + active: this.isItemActive(item), + focused: this.isItemFocused(item) + } + }); + }, isItemActive(item) { return this.expandedKeys ? this.expandedKeys[this.getItemProp(item, 'key')] : ObjectUtils.equals(item, this.activeItem); }, @@ -116,6 +124,9 @@ export default { isItemDisabled(item) { return this.getItemProp(item, 'disabled'); }, + isItemFocused(item) { + return ObjectUtils.equals(item, this.activeItem); + }, getPanelId(index) { return `${this.id}_${index}`; },