Skip to content

Commit

Permalink
fix(list): cleanup toggle expansion methods (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlabrecq committed Jun 27, 2018
1 parent 3db09be commit 7d0b0f4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/list/basic-list/list-expand-toggle.component.html
@@ -1,4 +1,4 @@
<div class="list-pf-chevron" (click)="toggleExpand()">
<div class="list-pf-chevron" (click)="toggleExpandItem()">
<span class="fa fa-fw fa-angle-right" [ngClass]="{'fa-angle-down': isExpanded}"></span>
<ng-template *ngIf="template" let-item="item"
[ngTemplateOutlet]="template"
Expand Down
2 changes: 1 addition & 1 deletion src/app/list/basic-list/list-expand-toggle.component.ts
Expand Up @@ -66,7 +66,7 @@ export class ListExpandToggleComponent implements OnInit {
/**
* Toggle expand item open/close
*/
toggleExpand(): void {
toggleExpandItem(): void {
// Item may already be open
if (this.item.expanded && this.item.expandId !== this.expandId) {
this.item.expandId = this.expandId;
Expand Down
6 changes: 3 additions & 3 deletions src/app/list/basic-list/list.component.html
Expand Up @@ -35,7 +35,7 @@
<div class="list-pf-item {{item?.itemStyleClass}}"
[ngClass]="{'active': item.selected || item.expanded}"
*ngFor="let item of (config.usePinItems ? (items | sortArray: 'showPin': true) : items); let i = index">
<div class="list-pf-container" [id]="getId('item', i)" (click)="toggleExpandArea($event, item)">
<div class="list-pf-container" [id]="getId('item', i)" (click)="toggleExpandItem($event, item)">
<!-- pin -->
<div class="pfng-list-pin-container" *ngIf="config.usePinItems">
<div class="pfng-list-pin-placeholder"
Expand All @@ -55,7 +55,7 @@
<div class="pfng-list-expand-placeholder" *ngIf="item.hideExpandToggle === true"></div>
<span class="fa fa-angle-right"
*ngIf="item.hideExpandToggle !== true"
(click)="toggleExpandArea($event, item)"
(click)="toggleExpandItem($event, item)"
[ngClass]="{'fa-angle-down': item.expanded && item.expandId === undefined}"></span>
</div>
<!-- checkbox -->
Expand Down Expand Up @@ -97,7 +97,7 @@
<div class="list-pf-container" tabindex="0">
<div class="list-pf-content">
<div class="close" *ngIf="config.hideClose !== true">
<span class="pficon pficon-close" (click)="closeExpandArea(item)"></span>
<span class="pficon pficon-close" (click)="closeExpandItem(item)"></span>
</div>
<ng-template [ngTemplateOutlet]="expandTemplate"
[ngTemplateOutletContext]="{ item: item, index: i }"></ng-template>
Expand Down
6 changes: 3 additions & 3 deletions src/app/list/basic-list/list.component.ts
Expand Up @@ -147,18 +147,18 @@ export class ListComponent extends ListBase implements DoCheck, OnInit {

// Toggle

private closeExpandArea(item: any): void {
private closeExpandItem(item: any): void {
item.expandId = undefined;
item.expanded = false;
}

/**
* Toggles the list item expansion
* Toggle expand item open/close
*
* @param {MouseEvent} $event The event emitted when an item has been clicked
* @param {Object} item The object associated with the current row
*/
private toggleExpandArea($event: MouseEvent, item: any): void {
private toggleExpandItem($event: MouseEvent, item: any): void {
// Do nothing if item expansion is disabled
if (!this.config.useExpandItems) {
return;
Expand Down

0 comments on commit 7d0b0f4

Please sign in to comment.