Skip to content

Commit

Permalink
Fixed #3303
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Oct 4, 2017
1 parent aef7963 commit b904fe5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/app/components/panelmenu/panelmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,27 @@ export class PanelMenu extends BasePanelMenuItem {

@Input() styleClass: string;

@Input() hasSingleItemExpanded: boolean = false;
@Input() multiple: boolean = true;

public animating: boolean;

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

handleClick(event, item) {
if(this.hasSingleItemExpanded) {
this.collapseAll();
if(!this.multiple) {
for(let modelItem of this.model) {
if(item !== modelItem && modelItem.expanded) {
modelItem.expanded = false;
}
}
}

this.animating = true;
super.handleClick(event, item);
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/showcase/components/panelmenu/panelmenudemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>

<div class="content-section implementation">
<p-panelMenu [model]="items" [style]="&#123;'width':'300px'&#125;"></p-panelMenu>
<p-panelMenu [model]="items" [style]="{'width':'300px'}" [multiple]="false"></p-panelMenu>
</div>

<div class="content-section documentation">
Expand Down Expand Up @@ -147,10 +147,10 @@ <h3>Properties</h3>
<td>Style class of the component.</td>
</tr>
<tr>
<td>hasSingleItemExpanded</td>
<td>multiple</td>
<td>boolean</td>
<td>false</td>
<td>Flag to expand only single menu item.</td>
<td>true</td>
<td>Whether multiple tabs can be activated at the same time or not.</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit b904fe5

Please sign in to comment.