fix: popover components use OnPush change detection (#727)

* fix: popover components use OnPush change detection

* fix: select2 selection bug

* chore: upgrade @ert78gb/ngx-select-ex => 3.7.0
This commit is contained in:
Róbert Kiss
2018-07-26 05:37:58 +02:00
committed by László Monda
parent ac7d66e338
commit f6092ea195
9 changed files with 20 additions and 11 deletions

View File

@@ -1155,9 +1155,9 @@
}
},
"@ert78gb/ngx-select-ex": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/@ert78gb/ngx-select-ex/-/ngx-select-ex-3.6.0.tgz",
"integrity": "sha512-bR6uL7T/wxDUEhlAA90QcclMawEYzWAjk1Ra8SAYlLv15QCRU8WKZM+WSsdYKgseCDnmYTf/9eXDZQI/DsM0eQ==",
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/@ert78gb/ngx-select-ex/-/ngx-select-ex-3.7.0.tgz",
"integrity": "sha512-m3DyGB1VZrxsItgc/NjBt5ZfW1DuQrxLz82ekw/ur79DZHG89EYohKWbx68lonfu8wM+AT4IHUDVqF1gFhyK0g==",
"requires": {
"tslib": "1.9.0"
}

View File

@@ -62,7 +62,7 @@
"ng2-dragula": "1.5.0",
"ng2-nouislider": "^1.7.7",
"ngx-clipboard": "10.0.0",
"@ert78gb/ngx-select-ex": "3.6.0",
"@ert78gb/ngx-select-ex": "3.7.0",
"ngrx-store-freeze": "0.1.9",
"nouislider": "^11.1.0",
"postcss-url": "^7.1.2",

View File

@@ -2,7 +2,7 @@
<b class="setting-label">Scancode:</b>
<div class="scancode-container">
<ngx-select [items]="scanCodeGroups"
[ngModel]="selectedScancodeOption.id"
[ngModel]="selectedScancodeOption?.id"
[autoActiveOnMouseEnter]="false"
size="small"
optionValueField="id"

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnChanges } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
import { KeyAction, KeystrokeAction, KeystrokeType, SCANCODES, SECONDARY_ROLES } from 'uhk-common';
import { Tab } from '../tab';
@@ -7,6 +7,7 @@ import { SelectOptionData } from '../../../../models/select-option-data';
@Component({
selector: 'keypress-tab',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './keypress-tab.component.html',
styleUrls: ['./keypress-tab.component.scss']
})
@@ -176,6 +177,10 @@ export class KeypressTabComponent extends Tab implements OnChanges {
}
private toScancodeTypePair(option: SelectOptionData): [number, string] {
if (!option) {
return [0, 'basic'];
}
let scanCode: number;
let type: string;
if (option.additional) {

View File

@@ -1,4 +1,4 @@
import { Component, HostBinding, Input, OnChanges, SimpleChanges } from '@angular/core';
import { ChangeDetectionStrategy, Component, HostBinding, Input, OnChanges, SimpleChanges } from '@angular/core';
import { KeyAction, LayerName, SwitchLayerAction, SwitchLayerMode } from 'uhk-common';
import { Tab } from '../tab';
@@ -7,6 +7,7 @@ export type toggleType = 'active' | 'toggle';
@Component({
selector: 'layer-tab',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './layer-tab.component.html',
styleUrls: ['./layer-tab.component.scss']
})

View File

@@ -6,7 +6,7 @@
<div class="macro-selector">
<b> Play macro: </b>
<ngx-select [items]="macroOptions"
[ngModel]="macroOptions[selectedMacroIndex].id"
[ngModel]="macroOptions[selectedMacroIndex]?.id"
[autoActiveOnMouseEnter]="false"
size="small"
optionValueField="id"

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Subscription } from 'rxjs/Subscription';
import { KeyAction, Macro, PlayMacroAction } from 'uhk-common';
@@ -11,6 +11,7 @@ import { SelectOptionData } from '../../../../models/select-option-data';
@Component({
selector: 'macro-tab',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './macro-tab.component.html',
styleUrls: ['./macro-tab.component.scss']
})

View File

@@ -1,10 +1,11 @@
import { Component, Input, OnChanges } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
import { KeyAction, MouseAction, MouseActionParam } from 'uhk-common';
import { Tab } from '../tab';
@Component({
selector: 'mouse-tab',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './mouse-tab.component.html',
styleUrls: ['./mouse-tab.component.scss']
})

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Tab } from '../tab';
@Component({
selector: 'none-tab',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './none-tab.component.html',
styleUrls: ['./none-tab.component.scss']
})