@mxtommy/kip
Advanced tools
Comparing version 0.1.11 to 0.1.12
{ | ||
"name": "@mxtommy/kip", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -21,3 +21,2 @@ # Kip | ||
* Customization options for Historical Charts | ||
* Select default unit for each unit type in config. | ||
* Attitude Indicator * In progress | ||
@@ -32,5 +31,3 @@ | ||
* Alerts/Notifications | ||
* iFrame Widget? | ||
* Delete Page. | ||
* Numeric widget max/avg values. | ||
@@ -37,0 +34,0 @@ ### Feature Ideas |
@@ -9,9 +9,10 @@ import { Injectable } from '@angular/core'; | ||
import { IWidget } from './widget-manager.service'; | ||
import { IUnitDefaults } from './units.service'; | ||
import { BlankConfig } from './blank-config.const'; | ||
import { DemoConfig } from './demo-config.const'; | ||
import { initialDefaultUnits } from './defaultUnits.const' | ||
import { isNumber } from 'util'; | ||
const defaultSignalKUrl = 'http://demo.signalk.org/signalk'; | ||
const defaultUnlockStatus = false; | ||
const defaultTheme = 'default-light'; | ||
@@ -31,2 +32,3 @@ const configVersion = 3; // used to invalidate old configs to avoir errors loading it. | ||
rootSplits: string[]; | ||
unitDefaults: IUnitDefaults; | ||
} | ||
@@ -43,3 +45,5 @@ | ||
unlockStatus: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); | ||
unitDefaults: BehaviorSubject<IUnitDefaults> = new BehaviorSubject<IUnitDefaults>({}); | ||
widgets: Array<IWidget>; | ||
@@ -81,6 +85,21 @@ | ||
this.rootSplits = storageObject.rootSplits; | ||
if ('unitDefaults' in storageObject) { | ||
this.unitDefaults.next(storageObject.unitDefaults); | ||
} else { | ||
this.unitDefaults.next(initialDefaultUnits); | ||
} | ||
} | ||
//UnitDefaults | ||
getDefaultUnitsAsO() { | ||
return this.unitDefaults.asObservable(); | ||
} | ||
getDefaultUnits() { | ||
return this.unitDefaults.getValue(); | ||
} | ||
setDefaultUnits(newDefaults: IUnitDefaults) { | ||
this.unitDefaults.next(newDefaults); | ||
this.saveToLocalStorage(); | ||
} | ||
// SignalKURL | ||
@@ -178,2 +197,3 @@ getSignalKURLAsO() { | ||
rootSplits: this.rootSplits, | ||
unitDefaults: this.unitDefaults.getValue(), | ||
} | ||
@@ -189,2 +209,3 @@ return storageObject; | ||
saveToLocalStorage() { | ||
console.log("Saving Config to LocalStorage"); | ||
localStorage.setItem('signalKData', JSON.stringify(this.buildStorageObject())); | ||
@@ -191,0 +212,0 @@ } |
@@ -50,2 +50,3 @@ import { BrowserModule } from '@angular/platform-browser'; | ||
import { FilterSelfPipe } from './filter-self.pipe'; | ||
import { SafePipe } from './safe.pipe'; | ||
import { WidgetNumericComponent } from './widget-numeric/widget-numeric.component'; | ||
@@ -68,3 +69,5 @@ import { SettingsDatasetsComponent, SettingsDatasetsModalComponent } from './settings-datasets/settings-datasets.component'; | ||
import { ModalUnitSelectorComponent } from './modal-unit-selector/modal-unit-selector.component'; | ||
import { ObjectKeysPipe } from './object-keys.pipe' | ||
import { ObjectKeysPipe } from './object-keys.pipe'; | ||
import { SettingsUnitsComponent } from './settings-units/settings-units.component'; | ||
import { WidgetIframeComponent } from './widget-iframe/widget-iframe.component' | ||
@@ -93,2 +96,3 @@ | ||
FilterSelfPipe, | ||
SafePipe, | ||
WidgetNumericComponent, | ||
@@ -112,3 +116,5 @@ SettingsDatasetsComponent, | ||
ModalUnitSelectorComponent, | ||
ObjectKeysPipe | ||
ObjectKeysPipe, | ||
SettingsUnitsComponent, | ||
WidgetIframeComponent | ||
], | ||
@@ -146,2 +152,3 @@ imports: [ | ||
WidgetSwitchComponent, | ||
WidgetIframeComponent, | ||
WidgetTutorialComponent, | ||
@@ -148,0 +155,0 @@ |
@@ -14,2 +14,15 @@ export const BlankConfig = { | ||
"unlockStatus": false, | ||
"unitDefaults": { | ||
"unitless": 'unitless', | ||
"speed": 'kph', | ||
"flow": 'l/h', | ||
"temp": 'C', | ||
"length": 'm', | ||
"electrity": 'volts', | ||
"pressure": 'mmHg', | ||
"angularVelocity": 'deg/min', | ||
"frequency": 'Hz', | ||
"angle": 'deg', | ||
"ratio": 'percent' | ||
}, | ||
"dataSets": [], | ||
@@ -16,0 +29,0 @@ "splitSets": [ |
import { Injectable } from '@angular/core'; | ||
import * as Qty from 'js-quantities'; | ||
import { AppSettingsService } from './app-settings.service'; | ||
import { SignalKService } from './signalk.service'; | ||
import { Subscription } from 'rxjs'; | ||
export interface IUnitInfo { | ||
@@ -10,7 +12,6 @@ group: string; | ||
} | ||
interface IUnitDefaults { | ||
export interface IUnitDefaults { | ||
[key: string]: string; | ||
} | ||
@Injectable() | ||
@@ -20,28 +21,7 @@ | ||
constructor(private SignalKService: SignalKService) { | ||
// console.log(Qty.getKinds()); | ||
// console.log(Qty.getUnits()); | ||
// console.log(Qty.getAliases('naut-mile')); | ||
//build list for others. | ||
/* Object.keys(this.conversions).forEach(group => { | ||
this.conversionList[group] = []; | ||
Object.keys(this.conversions[group]).forEach(unit => { | ||
this.conversionList[group].push(unit); | ||
}); | ||
}); */ | ||
} | ||
defaultUnits: IUnitDefaults = { | ||
unitless: 'unitless', | ||
speed: 'knots', | ||
flow: 'liter/minute', | ||
temp: 'C', | ||
length: 'm', | ||
electrity: 'volts', | ||
pressure: 'mmHg', | ||
angularVelocity: 'rpm', | ||
angle: 'deg', | ||
ratio: '%' | ||
} | ||
defaultUnits: IUnitDefaults; | ||
defaultUnitsSub: Subscription; | ||
conversionList: IUnitInfo[] = [ | ||
@@ -61,2 +41,24 @@ { group: 'unitless', units: [ 'unitless' ] }, | ||
constructor( private AppSettingsService: AppSettingsService, | ||
private SignalKService: SignalKService) { | ||
this.defaultUnitsSub = this.AppSettingsService.getDefaultUnitsAsO().subscribe( | ||
newDefaults => { | ||
this.defaultUnits = newDefaults; | ||
console.log(this.defaultUnits); | ||
} | ||
); | ||
// console.log(Qty.getKinds()); | ||
// console.log(Qty.getUnits()); | ||
// console.log(Qty.getAliases('naut-mile')); | ||
//build list for others. | ||
/* Object.keys(this.conversions).forEach(group => { | ||
this.conversionList[group] = []; | ||
Object.keys(this.conversions[group]).forEach(unit => { | ||
this.conversionList[group].push(unit); | ||
}); | ||
}); */ | ||
} | ||
unitConversionFunctions = { | ||
@@ -111,3 +113,3 @@ 'unitless': function(v) { return v; }, | ||
// ratio | ||
'%': function(v) { return v * 100 }, | ||
'percent': function(v) { return v * 100 }, | ||
} | ||
@@ -136,2 +138,9 @@ | ||
getDefaults(): IUnitDefaults { | ||
return this.defaultUnits; | ||
} | ||
getConversions(): IUnitInfo[] { | ||
return this.conversionList; | ||
} | ||
} |
@@ -12,2 +12,3 @@ import { Injectable } from '@angular/core'; | ||
import { WidgetSwitchComponent } from './widget-switch/widget-switch.component'; | ||
import { WidgetIframeComponent } from './widget-iframe/widget-iframe.component'; | ||
import { WidgetTutorialComponent } from './widget-tutorial/widget-tutorial.component'; | ||
@@ -73,2 +74,7 @@ | ||
{ | ||
name: 'WidgetIframeComponent', | ||
componentName: WidgetIframeComponent, | ||
description: 'Embed Webpage', | ||
}, | ||
{ | ||
name: 'WidgetTutorial', | ||
@@ -75,0 +81,0 @@ componentName: WidgetTutorialComponent, |
@@ -56,2 +56,5 @@ import { Injectable } from '@angular/core'; | ||
putMomentaryValue?: boolean; | ||
//iFrame | ||
widgetUrl?: string; | ||
} | ||
@@ -58,0 +61,0 @@ |
@@ -109,2 +109,3 @@ import { Component, Input, OnInit, OnDestroy, Inject, ViewChild, ElementRef, AfterViewChecked } from '@angular/core'; | ||
this.currentValueLength = 0; //will force resetting the font size | ||
this.currentMinMaxLength = 0; | ||
this.updateCanvas(); | ||
@@ -111,0 +112,0 @@ this.updateCanvasBG(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8298540
274
41503
36