* Add nouislider * Add LEDBrightnessComponent * Move LEDBrightnessComponent to correct folder * Add LED brightness page to side menu and device routes * Add LEDBrightnessComponent to device index file * Add LEDBrightnessComponent and NouisliderModule to shared module * Remove ngModelChange from LEDBrightnessComponent until onChange is implemented * Fix stylelint issue in led brightness component * Add nouislider files to webpack.config.js * Add adjusting LED brightness sliders with arrow keys * Various tweaks to LEDBrightnessComponent * Fix linting issues in LEDBrightnessComponent * Allow "::ng-deep" pseudo element in stylelint config * Add reading LED brightness settings from user configuration * led-brightness save * Move slider to its own wrapper component, add debounce for slider change events * Small fixes to imports and exports of SliderWrapperComponent * Fix slide component making change event when initial value is set * Export SliderPips interface * Fix LED Brightness slider pips * Add support for value unit in SliderWrapperComponent * Add a bit of space before LED brightness sliders so the slider handle doesn't go beyond the page in the min position * Implement onDestroy, fix slider pip values and imports in LEDBrightnessComponent * Fix imports, implement onDestroy in SliderWrapperComponent * Move fix for slider pip value style to global styles file * Reorder stylelint rules
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { AfterViewInit, Component, OnInit, OnDestroy, ViewChildren, QueryList } from '@angular/core';
|
|
import { Store } from '@ngrx/store';
|
|
import { AppState, getUserConfiguration } from '../../../store';
|
|
import { SetUserConfigurationValueAction } from '../../../store/actions/user-config';
|
|
import { SliderPips } from '../../slider-wrapper/slider-wrapper.component';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import { Subscription } from 'rxjs/Subscription';
|
|
import { UserConfiguration } from 'uhk-common';
|
|
|
|
@Component({
|
|
selector: 'device-led-brightness',
|
|
templateUrl: './led-brightness.component.html',
|
|
styleUrls: ['./led-brightness.component.scss'],
|
|
host: {
|
|
'class': 'container-fluid'
|
|
}
|
|
})
|
|
export class LEDBrightnessComponent implements OnInit, OnDestroy {
|
|
public iconsAndLayerTextsBrightness: number = 0;
|
|
public alphanumericSegmentsBrightness: number = 0;
|
|
public keyBacklightBrightness: number = 0;
|
|
public sliderPips: SliderPips = {
|
|
mode: 'positions',
|
|
values: [0, 50, 100],
|
|
density: 6,
|
|
stepped: true
|
|
};
|
|
|
|
private userConfig$: Store<UserConfiguration>;
|
|
private userConfigSubscription: Subscription;
|
|
|
|
constructor(private store: Store<AppState>) {}
|
|
|
|
ngOnInit() {
|
|
this.userConfig$ = this.store.select(getUserConfiguration);
|
|
this.userConfigSubscription = this.userConfig$.subscribe(config => {
|
|
this.iconsAndLayerTextsBrightness = config.iconsAndLayerTextsBrightness;
|
|
this.alphanumericSegmentsBrightness = config.alphanumericSegmentsBrightness;
|
|
this.keyBacklightBrightness = config.keyBacklightBrightness;
|
|
});
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.userConfigSubscription.unsubscribe();
|
|
}
|
|
|
|
onSetPropertyValue(propertyName: string, value: number): void {
|
|
this.store.dispatch(new SetUserConfigurationValueAction({
|
|
propertyName,
|
|
value
|
|
}));
|
|
}
|
|
}
|