Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list: cleanup toggle expansion methods #404

Merged
merged 1 commit into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/list/basic-list/list-expand-toggle.component.html
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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