Skip to content

Commit

Permalink
Fixed #171 - Ability to disable PanelMenu items
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Apr 7, 2020
1 parent bc8f7e8 commit 27fc8a1
Show file tree
Hide file tree
Showing 11 changed files with 30,654 additions and 25,323 deletions.
6,208 changes: 3,400 additions & 2,808 deletions public/themes/luna-amber/theme.css

Large diffs are not rendered by default.

6,208 changes: 3,400 additions & 2,808 deletions public/themes/luna-blue/theme.css

Large diffs are not rendered by default.

6,208 changes: 3,400 additions & 2,808 deletions public/themes/luna-green/theme.css

Large diffs are not rendered by default.

6,208 changes: 3,400 additions & 2,808 deletions public/themes/luna-pink/theme.css

Large diffs are not rendered by default.

6,230 changes: 3,411 additions & 2,819 deletions public/themes/nova-colored/theme.css

Large diffs are not rendered by default.

6,230 changes: 3,411 additions & 2,819 deletions public/themes/nova-dark/theme.css

Large diffs are not rendered by default.

6,230 changes: 3,411 additions & 2,819 deletions public/themes/nova-light/theme.css

Large diffs are not rendered by default.

6,230 changes: 3,411 additions & 2,819 deletions public/themes/nova-vue/theme.css

Large diffs are not rendered by default.

6,208 changes: 3,400 additions & 2,808 deletions public/themes/rhea/theme.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/components/panelmenu/PanelMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<template v-for="(item, index) of model">
<div :key="item.label + '_' + index" :class="getPanelClass(item)" :style="item.style">
<div :class="getHeaderClass(item)" :style="item.style">
<a :href="item.url || '#'" class="p-panelmenu-header-link" @click="onItemClick($event, item)"
<a :href="item.url" class="p-panelmenu-header-link" @click="onItemClick($event, item)" :tabindex="item.disabled ? null : '0'"
:aria-expanded="isActive(item)" :id="ariaId +'_header'" :aria-controls="ariaId +'_content'">
<span v-if="item.items" :class="getPanelToggleIcon(item)"></span>
<span v-if="item.icon" :class="getPanelIcon(item)"></span>
Expand Down Expand Up @@ -63,7 +63,7 @@ export default {
this.activeItem = item;
},
getPanelClass(item) {
return ['p-panelmenu-panel', item.class, {'p-disabled': item.disabled}];
return ['p-panelmenu-panel', item.class];
},
getPanelToggleIcon(item) {
const active = item === this.activeItem;
Expand All @@ -76,7 +76,7 @@ export default {
return item === this.activeItem;
},
getHeaderClass(item) {
return ['p-component p-panelmenu-header', {'p-highlight': this.isActive(item)}];
return ['p-component p-panelmenu-header', {'p-highlight': this.isActive(item), 'p-disabled': item.disabled}];
}
},
components: {
Expand Down
11 changes: 7 additions & 4 deletions src/components/panelmenu/PanelMenuSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<ul class="p-submenu-list" role="tree">
<template v-for="(item, i) of model">
<li role="none" :class="getItemClass(item)" :style="item.style" v-if="item.visible !== false && !item.separator" :key="item.label + i">
<router-link v-if="item.to" :to="item.to" class="p-menuitem-link" @click.native="onItemClick($event, item)"
<router-link v-if="item.to && !item.disabled" :to="item.to" :class="getLinkClass(item)" @click.native="onItemClick($event, item)"
role="treeitem" :aria-expanded="isActive(item)">
<span :class="['p-menuitem-icon', item.icon]"></span>
<span class="p-menuitem-text">{{item.label}}</span>
</router-link>
<a v-else :href="item.url||'#'" class="p-menuitem-link" :target="item.target" @click="onItemClick($event, item)"
role="treeitem" :aria-expanded="isActive(item)">
<a v-else :href="item.url" :class="getLinkClass(item)" :target="item.target" @click="onItemClick($event, item)"
role="treeitem" :aria-expanded="isActive(item)" :tabindex="item.disabled ? null : '0'">
<span :class="getSubmenuIcon(item)" v-if="item.items"></span>
<span :class="['p-menuitem-icon', item.icon]"></span>
<span class="p-menuitem-text">{{item.label}}</span>
Expand Down Expand Up @@ -62,7 +62,10 @@ export default {
this.activeItem = item;
},
getItemClass(item) {
return ['p-menuitem', item.className, {'p-disabled': item.disabled}];
return ['p-menuitem', item.className];
},
getLinkClass(item) {
return ['p-menuitem-link', {'p-disabled': item.disabled}];
},
isActive(item) {
return item === this.activeItem;
Expand Down

0 comments on commit 27fc8a1

Please sign in to comment.