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

fix: Various minor bugfixes #245

Merged
merged 4 commits into from
Aug 14, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/modules/modal/components/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ModalConfig, ModalSize } from "../classes/modal-config";
[class.scroll]="mustScroll"
[class.inverted]="isInverted"
[ngClass]="dynamicClasses"
(click)="onClick($event)"
#modal>

<!-- Configurable close icon -->
Expand Down Expand Up @@ -282,6 +283,11 @@ export class SuiModal<T, U> implements OnInit, AfterViewInit {
}
}

public onClick(e:MouseEvent):void {
// Makes sense here, as the modal shouldn't be attached to any DOM element.
e.stopPropagation();
}

@HostListener("document:keyup", ["$event"])
public onDocumentKeyup(e:KeyboardEvent):void {
if (e.keyCode === KeyCode.Escape) {
Expand Down
1 change: 0 additions & 1 deletion src/modules/popup/classes/popup-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export abstract class SuiPopupController implements IPopup, OnDestroy {

@HostListener("focusout", ["$event"])
private onFocusOut(e:any):void {
console.log(e.relatedTarget);
if (!this._element.nativeElement.contains(e.relatedTarget) &&
!this.popup.elementRef.nativeElement.contains(e.relatedTarget) &&
this.popup.config.trigger === PopupTrigger.Focus) {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/popup/directives/popup.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { SuiPopupConfig } from "../services/popup.service";
import { SuiPopupController } from "../classes/popup-controller";
import { SuiPopupTemplateController, ITemplatePopupContext, ITemplatePopupConfig } from "../classes/popup-template-controller";

const templateRef = TemplateRef;

@Directive({
selector: "[suiPopup]",
exportAs: "suiPopup"
Expand Down
10 changes: 7 additions & 3 deletions src/modules/select/classes/select-base.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ViewChild, HostBinding, ElementRef, HostListener, Input, ContentChildren, QueryList,
AfterContentInit, TemplateRef, ViewContainerRef, ContentChild, EventEmitter, Output
AfterContentInit, TemplateRef, ViewContainerRef, ContentChild, EventEmitter, Output, OnDestroy
} from "@angular/core";
import { Subscription } from "rxjs/Subscription";
import { DropdownService, SuiDropdownMenu } from "../../dropdown";
Expand All @@ -16,7 +16,7 @@ export interface IOptionContext<T> extends ITemplateRefContext<T> {

// We use generic type T to specify the type of the options we are working with,
// and U to specify the type of the property of the option used as the value.
export abstract class SuiSelectBase<T, U> implements AfterContentInit {
export abstract class SuiSelectBase<T, U> implements AfterContentInit, OnDestroy {
public dropdownService:DropdownService;
public searchService:SearchService<T, U>;

Expand Down Expand Up @@ -322,7 +322,7 @@ export abstract class SuiSelectBase<T, U> implements AfterContentInit {
this.drawTemplate(option.templateSibling, option.value);
}

option.changeDetector.detectChanges();
option.changeDetector.markForCheck();
}

public abstract selectOption(option:T):void;
Expand Down Expand Up @@ -418,4 +418,8 @@ export abstract class SuiSelectBase<T, U> implements AfterContentInit {
query: this.query
});
}

public ngOnDestroy():void {
this._renderedSubscriptions.forEach(s => s.unsubscribe());
}
}