Skip to content

Commit

Permalink
chore(igxOverlay): onPosition added, WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
wnvko committed Jan 8, 2019
1 parent a45419b commit 5b6912d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
private _overlayOpenedSub: Subscription;
private _overlayClosingSub: Subscription;
private _overlayClosedSub: Subscription;
private _overlayPositionSub: Subscription;

/**
* Emits an event after the toggle container is opened.
Expand Down Expand Up @@ -112,6 +113,9 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
@Output()
public onClosing = new EventEmitter<CancelableEventArgs>();

@Output()
public onPosition = new EventEmitter();

private _collapsed = true;
/**
* @hidden
Expand Down Expand Up @@ -183,6 +187,12 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
return;
}

this._overlayPositionSub = this.overlayService.onPosition
// .pipe(...this._overlaySubFilter)
.subscribe(() => {
this.onPosition.emit();
});

if (this._overlayId) {
this.overlayService.show(this._overlayId, overlaySettings);
} else {
Expand Down Expand Up @@ -281,6 +291,7 @@ export class IgxToggleDirective implements IToggleView, OnInit, OnDestroy {
this.clearSubscription(this._overlayOpenedSub);
this.clearSubscription(this._overlayClosingSub);
this.clearSubscription(this._overlayClosedSub);
this.clearSubscription(this._overlayPositionSub);
}

private clearSubscription(subscription: Subscription) {
Expand Down
3 changes: 3 additions & 0 deletions projects/igniteui-angular/src/lib/drop-down/drop-down.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ export abstract class IgxDropDownBase implements OnInit, IToggleView {
if (eventArgs.cancel) {
return;
}
` }
onTogglePosition() {
this.scrollToItem(this.selectedItem);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="igx-drop-down__list" igxToggle [style.maxHeight]="maxHeight"
(onOpening)="onToggleOpening($event)" (onOpened)="onToggleOpened()"
(onOpening)="onToggleOpening($event)" (onOpened)="onToggleOpened()" (onPosition)="onTogglePosition()"
(onClosing)="onToggleClosing($event)" (onClosed)="onToggleClosed()">
<ng-container *ngIf="!collapsed">
<ng-content></ng-content>
Expand Down
3 changes: 3 additions & 0 deletions projects/igniteui-angular/src/lib/services/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export class IgxOverlayService implements OnDestroy {
*/
public onAnimation = new EventEmitter<OverlayAnimationEventArgs>();

public onPosition = new EventEmitter();

constructor(
private _factoryResolver: ComponentFactoryResolver,
private _appRef: ApplicationRef,
Expand Down Expand Up @@ -177,6 +179,7 @@ export class IgxOverlayService implements OnDestroy {
document,
true,
settings.positionStrategy.settings.minSize);
this.onPosition.emit();
settings.scrollStrategy.initialize(this._document, this, id);
settings.scrollStrategy.attach();
}
Expand Down

0 comments on commit 5b6912d

Please sign in to comment.