-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(expansion-panel): introducing expansion-panel-group to only give…
… margin to expansion panels when grouped (#666) * feat(expansion): introducing expansion-panel-group this will give spec marging to grouped expansion panels following the spec * chore(expansion): update DEMO with group example * fix(): only add transition when grouped and change to 120ms
- Loading branch information
1 parent
dda5d9c
commit 9ae0ba5
Showing
10 changed files
with
167 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/platform/core/expansion-panel/expansion-panel-group.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ng-content></ng-content> |
Empty file.
15 changes: 15 additions & 0 deletions
15
src/platform/core/expansion-panel/expansion-panel-group.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, Renderer2, ElementRef } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'td-expansion-panel-group', | ||
styleUrls: ['./expansion-panel-group.component.scss' ], | ||
templateUrl: './expansion-panel-group.component.html', | ||
}) | ||
export class TdExpansionPanelGroupComponent { | ||
|
||
constructor(private _renderer: Renderer2, | ||
private _elementRef: ElementRef) { | ||
this._renderer.addClass(this._elementRef.nativeElement, 'td-expansion-panel-group'); | ||
} | ||
|
||
} |
67 changes: 32 additions & 35 deletions
67
src/platform/core/expansion-panel/expansion-panel.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,35 @@ | ||
<div class="td-expansion-panel" | ||
[class.td-expanded]="expand"> | ||
<div class="td-expansion-panel-header" | ||
<div class="td-expansion-panel-header" | ||
[class.mat-disabled]="disabled" | ||
md-ripple | ||
[mdRippleDisabled]="disabled" | ||
[tabIndex]="disabled? -1 : 0" | ||
(keydown.enter)="clickEvent()" | ||
(click)="clickEvent()"> | ||
<ng-template [cdkPortalHost]="expansionPanelHeader"></ng-template> | ||
<div class="td-expansion-panel-header-content" | ||
[class.mat-disabled]="disabled" | ||
md-ripple | ||
[mdRippleDisabled]="disabled" | ||
[tabIndex]="disabled? -1 : 0" | ||
(keydown.enter)="clickEvent()" | ||
(click)="clickEvent()"> | ||
<ng-template [cdkPortalHost]="expansionPanelHeader"></ng-template> | ||
<div class="td-expansion-panel-header-content" | ||
[class.mat-disabled]="disabled" | ||
*ngIf="!expansionPanelHeader" | ||
layout="row" | ||
layout-align="start center" | ||
flex> | ||
<div *ngIf="label || expansionPanelLabel" class="md-subhead td-expansion-label" [attr.flex-gt-xs]="(sublabel || expansionPanelSublabel) ? 40 : null"> | ||
<ng-template [cdkPortalHost]="expansionPanelLabel"></ng-template> | ||
<ng-template [ngIf]="!expansionPanelLabel">{{label}}</ng-template> | ||
</div> | ||
<div *ngIf="sublabel || expansionPanelSublabel" class="md-body-1 td-expansion-sublabel"> | ||
<ng-template [cdkPortalHost]="expansionPanelSublabel"></ng-template> | ||
<ng-template [ngIf]="!expansionPanelSublabel">{{sublabel}}</ng-template> | ||
</div> | ||
<span flex></span> | ||
<md-icon class="td-expand-icon" *ngIf="!expand && !disabled">keyboard_arrow_down</md-icon> | ||
<md-icon class="td-expand-icon" *ngIf="expand">keyboard_arrow_up</md-icon> | ||
*ngIf="!expansionPanelHeader" | ||
layout="row" | ||
layout-align="start center" | ||
flex> | ||
<div *ngIf="label || expansionPanelLabel" class="md-subhead td-expansion-label" [attr.flex-gt-xs]="(sublabel || expansionPanelSublabel) ? 40 : null"> | ||
<ng-template [cdkPortalHost]="expansionPanelLabel"></ng-template> | ||
<ng-template [ngIf]="!expansionPanelLabel">{{label}}</ng-template> | ||
</div> | ||
<div *ngIf="sublabel || expansionPanelSublabel" class="md-body-1 td-expansion-sublabel"> | ||
<ng-template [cdkPortalHost]="expansionPanelSublabel"></ng-template> | ||
<ng-template [ngIf]="!expansionPanelSublabel">{{sublabel}}</ng-template> | ||
</div> | ||
<span flex></span> | ||
<md-icon class="td-expand-icon" *ngIf="!expand && !disabled">keyboard_arrow_down</md-icon> | ||
<md-icon class="td-expand-icon" *ngIf="expand">keyboard_arrow_up</md-icon> | ||
</div> | ||
<div class="td-expansion-content" | ||
[@tdCollapse]="!expand"> | ||
<ng-content></ng-content> | ||
</div> | ||
<div class="td-expansion-summary" | ||
[@tdCollapse]="expand"> | ||
<ng-content select="td-expansion-summary"></ng-content> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="td-expansion-content" | ||
[@tdCollapse]="!expand"> | ||
<ng-content></ng-content> | ||
</div> | ||
<div class="td-expansion-summary" | ||
[@tdCollapse]="expand"> | ||
<ng-content select="td-expansion-summary"></ng-content> | ||
</div> |
31 changes: 14 additions & 17 deletions
31
src/platform/core/expansion-panel/expansion-panel.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters