Skip to content

Commit

Permalink
primefaces#3303 added flag to expand single menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
sumragen committed Aug 29, 2017
1 parent e00b282 commit 3f5a217
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/components/panelmenu/panelmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,23 @@ export class PanelMenu extends BasePanelMenuItem {
@Input() style: any;

@Input() styleClass: string;

@Input() hasSingleItemExpanded: boolean = false;

public animating: boolean;

collapseAll() {
for( let item of this.model ) {
if(item.expanded) {
item.expanded = false;
}
}
}

handleClick(event, item) {
if(this.hasSingleItemExpanded) {
this.collapseAll();
}
this.animating = true;
super.handleClick(event, item);
}
Expand Down
6 changes: 6 additions & 0 deletions src/app/showcase/components/panelmenu/panelmenudemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ <h3>Properties</h3>
<td>null</td>
<td>Style class of the component.</td>
</tr>
<tr>
<td>hasSingleItemExpanded</td>
<td>boolean</td>
<td>false</td>
<td>Flag to expand only single menu item.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 3f5a217

Please sign in to comment.