From ac499d21f7afd069443995b694eeccfda094889b Mon Sep 17 00:00:00 2001 From: Nejc Zdovc Date: Sun, 20 Nov 2016 13:24:17 +0100 Subject: [PATCH] Removed current keymap from switch (#165) Closes #160 --- src/components/popover/popover.component.ts | 6 +++++- .../popover/tab/keymap/keymap-tab.component.ts | 13 +++++++------ .../svg/wrap/svg-keyboard-wrap.component.html | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/popover/popover.component.ts b/src/components/popover/popover.component.ts index 2923aa76..ee4118eb 100644 --- a/src/components/popover/popover.component.ts +++ b/src/components/popover/popover.component.ts @@ -35,6 +35,7 @@ enum TabName { }) export class PopoverComponent implements OnInit { @Input() defaultKeyAction: KeyAction; + @Input() currentKeymap: Keymap; @Output() cancel = new EventEmitter(); @Output() remap = new EventEmitter(); @@ -49,7 +50,10 @@ export class PopoverComponent implements OnInit { private keymaps$: Observable; constructor(private store: Store) { - this.keymaps$ = store.let(getKeymapEntities()); + this.keymaps$ = store.let(getKeymapEntities()) + .map((keymaps: Keymap[]) => + keymaps.filter((keymap: Keymap) => this.currentKeymap.abbreviation !== keymap.abbreviation) + ); } ngOnInit() { diff --git a/src/components/popover/tab/keymap/keymap-tab.component.ts b/src/components/popover/tab/keymap/keymap-tab.component.ts index d9e473df..a0ad45be 100644 --- a/src/components/popover/tab/keymap/keymap-tab.component.ts +++ b/src/components/popover/tab/keymap/keymap-tab.component.ts @@ -24,12 +24,13 @@ export class KeymapTabComponent implements OnInit, Tab { } ngOnInit() { - this.keymapOptions = this.keymaps.map((keymap: Keymap): Select2OptionData => { - return { - id: keymap.abbreviation, - text: keymap.name - }; - }); + this.keymapOptions = this.keymaps + .map((keymap: Keymap): Select2OptionData => { + return { + id: keymap.abbreviation, + text: keymap.name + }; + }); this.keymapOptions = [ { diff --git a/src/components/svg/wrap/svg-keyboard-wrap.component.html b/src/components/svg/wrap/svg-keyboard-wrap.component.html index af624d2d..6dbfa013 100644 --- a/src/components/svg/wrap/svg-keyboard-wrap.component.html +++ b/src/components/svg/wrap/svg-keyboard-wrap.component.html @@ -9,7 +9,7 @@ > - +