Skip to content

Commit 76c4812

Browse files
lehoffmajoejordanbrown
authored andcommitted
feat(popover): add disableAnimation option (#46)
* Add disableAnimation option
1 parent 488d556 commit 76c4812

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

projects/material-extended/mde/src/lib/popover/popover.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-template>
22
<div class="mde-popover-panel" role="dialog" [class.mde-popover-overlap]="overlapTrigger"
33
[ngClass]="_classList" [ngStyle]="popoverPanelStyles" (keydown)="_handleKeydown($event)"
4-
(click)="onClick()" (mouseover)="onMouseOver()" (mouseleave)="onMouseLeave()"
4+
(click)="onClick()" (mouseover)="onMouseOver()" (mouseleave)="onMouseLeave()" [@.disabled]="disableAnimation"
55
[@transformPopover]="'enter'">
66
<div class="mde-popover-direction-arrow" [ngStyle]="popoverArrowStyles" *ngIf="!overlapTrigger"></div>
77
<div class="mde-popover-content" [ngStyle]="popoverContentStyles" cdkTrapFocus="focusTrapEnabled">

projects/material-extended/mde/src/lib/popover/popover.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class MdePopover implements MdePopoverPanel, OnDestroy { // tslint:disabl
4646
private _enterDelay = 200;
4747
private _leaveDelay = 200;
4848
private _overlapTrigger = true;
49+
private _disableAnimation = false;
4950
private _targetOffsetX = 0;
5051
private _targetOffsetY = 0;
5152
private _arrowOffsetX = 20;
@@ -152,6 +153,13 @@ export class MdePopover implements MdePopoverPanel, OnDestroy { // tslint:disabl
152153
get closeOnClick(): boolean { return this._closeOnClick; }
153154
set closeOnClick(v: boolean) { this._closeOnClick = v; }
154155

156+
/**
157+
* Disable animations of popover and all child elements
158+
* default: false
159+
*/
160+
@Input('mdePopoverDisableAnimation')
161+
get disableAnimation(): boolean { return this._disableAnimation; }
162+
set disableAnimation(v: boolean) { this._disableAnimation = v; }
155163

156164
/**
157165
* Popover focus trap using cdkTrapFocus

src/app/pages/home/home.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</mde-popover>
6666

6767

68-
<mde-popover #popover4="mdePopover" [mdePopoverLeaveDelay]="1000">
68+
<mde-popover #popover4="mdePopover" [mdePopoverDisableAnimation]="true" [mdePopoverLeaveDelay]="1000">
6969
<mat-card class="example-card">
7070
<mat-card-content>
7171
<p>

0 commit comments

Comments
 (0)