Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
v1.5.1 fix multi creation
Browse files Browse the repository at this point in the history
  • Loading branch information
clouless committed Jan 5, 2018
1 parent 1b5908c commit a8bb4e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"COMMENT": "THIS FILE WILL BE PARSED DURING BUILD. IT IS NOT THE ACTUAL PACKAGE FILE PUSHED TO NPMJS!",
"name": "@cloukit/dropout",
"moduleId": "dropout",
"version": "1.5.0",
"version": "1.5.1",
"description": "Dropout is a non visible helper to drop something down, up, left or right relative to a trigger element",
"license": "MIT",
"author": "codelcou.io",
Expand Down
27 changes: 15 additions & 12 deletions src/components/dropout.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,23 @@ export class CloukitDropoutDirective implements OnInit, OnDestroy {
}

_doActivate() {
const request = new DropoutComponentCreationRequest();
request.triggerElement = this.viewContainerRef.element.nativeElement;
request.template = this.cloukitDropout;
request.placement = this.cloukitDropoutPlacement;
request.zIndex = this.cloukitDropoutZIndex;
// FIXME: Calculate OutsideClick: template.elementRef.nativeElement.offsetHeight
this.dropoutRef = this.dropoutService.requestDropoutCreation(request);
this.cloukitDropoutActive.emit(true);
if (this.dropoutRef === undefined) {
const request = new DropoutComponentCreationRequest();
request.triggerElement = this.viewContainerRef.element.nativeElement;
request.template = this.cloukitDropout;
request.placement = this.cloukitDropoutPlacement;
request.zIndex = this.cloukitDropoutZIndex;
this.dropoutRef = this.dropoutService.requestDropoutCreation(request);
this.cloukitDropoutActive.emit(true);
}
}

_doDeactivate() {
this.dropoutService.destroyComponent(this.dropoutRef);
this.dropoutRef = undefined;
this.cloukitDropoutActive.emit(false);
if (this.dropoutRef !== undefined) {
this.dropoutService.destroyComponent(this.dropoutRef);
this.dropoutRef = undefined;
this.cloukitDropoutActive.emit(false);
}
}

ngOnInit() {
Expand All @@ -72,7 +75,7 @@ export class CloukitDropoutDirective implements OnInit, OnDestroy {
self._doDeactivate();
});
}
if (self.cloukitDropoutReposition instanceof Observable) {
if (self.cloukitDropoutReposition instanceof Observable && self.dropoutRef !== undefined) {
self.cloukitDropoutReposition.takeUntil(self.preDestroy).subscribe(() => {
self.dropoutService.forceReposition(self.dropoutRef);
});
Expand Down

0 comments on commit a8bb4e5

Please sign in to comment.