@mxtommy/kip 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/CONTRIBUTORS.md +4 -4
  3. package/KipGaugeSample3-1024x508.png +0 -0
  4. package/LICENSE +21 -0
  5. package/README.md +80 -42
  6. package/package.json +52 -46
  7. package/public/3rdpartylicenses.txt +61 -412
  8. package/public/assets/NoSleep.min.js +2 -2
  9. package/public/assets/icon-64x64.png +0 -0
  10. package/public/index.html +3 -3
  11. package/public/main.9dba30de44eed02b.js +1 -0
  12. package/public/manifest.json +9 -4
  13. package/public/polyfills.d1da7d2e907c253a.js +1 -0
  14. package/public/runtime.e75056c32c37f59d.js +1 -0
  15. package/public/styles.6b1c2c92be18a2cc.css +1 -0
  16. package/.angulardoc.json +0 -4
  17. package/angular.json +0 -162
  18. package/e2e/app.e2e-spec.ts +0 -14
  19. package/e2e/app.po.ts +0 -11
  20. package/e2e/tsconfig.e2e.json +0 -14
  21. package/karma.conf.js +0 -31
  22. package/public/main-es2018.98175eb4c61ccaf7eb17.js +0 -1
  23. package/public/main-es5.98175eb4c61ccaf7eb17.js +0 -1
  24. package/public/polyfills-es2018.3a61665863c173cd6ba3.js +0 -1
  25. package/public/polyfills-es5.44827ae4ff4e41de51fb.js +0 -1
  26. package/public/runtime-es2018.baedb88c6d2abacae2b8.js +0 -1
  27. package/public/runtime-es5.baedb88c6d2abacae2b8.js +0 -1
  28. package/public/styles.b92ae2c466c89712209d.css +0 -5
  29. package/src/app/alarm-menu/alarm-menu.component.html +0 -55
  30. package/src/app/alarm-menu/alarm-menu.component.scss +0 -52
  31. package/src/app/alarm-menu/alarm-menu.component.spec.ts +0 -25
  32. package/src/app/alarm-menu/alarm-menu.component.ts +0 -186
  33. package/src/app/app-help/app-help.component.css +0 -4
  34. package/src/app/app-help/app-help.component.html +0 -135
  35. package/src/app/app-help/app-help.component.ts +0 -45
  36. package/src/app/app-settings.service.spec.ts +0 -15
  37. package/src/app/app-settings.service.ts +0 -478
  38. package/src/app/app.component.css +0 -39
  39. package/src/app/app.component.html +0 -93
  40. package/src/app/app.component.scss +0 -79
  41. package/src/app/app.component.spec.ts +0 -32
  42. package/src/app/app.component.ts +0 -191
  43. package/src/app/app.module.ts +0 -200
  44. package/src/app/config.blank.const.ts +0 -52
  45. package/src/app/config.blank.notification.const.ts +0 -19
  46. package/src/app/config.blank.units.const.ts +0 -23
  47. package/src/app/config.demo.const.ts +0 -384
  48. package/src/app/data-browser/data-browser.component.css +0 -29
  49. package/src/app/data-browser/data-browser.component.html +0 -44
  50. package/src/app/data-browser/data-browser.component.spec.ts +0 -25
  51. package/src/app/data-browser/data-browser.component.ts +0 -91
  52. package/src/app/data-browser-row/data-browser-row-unit-modal.html +0 -17
  53. package/src/app/data-browser-row/data-browser-row.component.css +0 -10
  54. package/src/app/data-browser-row/data-browser-row.component.html +0 -5
  55. package/src/app/data-browser-row/data-browser-row.component.ts +0 -79
  56. package/src/app/data-set.service.spec.ts +0 -15
  57. package/src/app/data-set.service.ts +0 -273
  58. package/src/app/dynamic-widget.directive.spec.ts +0 -8
  59. package/src/app/dynamic-widget.directive.ts +0 -11
  60. package/src/app/filter-self.pipe.spec.ts +0 -8
  61. package/src/app/filter-self.pipe.ts +0 -14
  62. package/src/app/fit-text.directive.spec.ts +0 -8
  63. package/src/app/fit-text.directive.ts +0 -61
  64. package/src/app/gauge-steel/gauge-steel.component.css +0 -5
  65. package/src/app/gauge-steel/gauge-steel.component.html +0 -4
  66. package/src/app/gauge-steel/gauge-steel.component.spec.ts +0 -25
  67. package/src/app/gauge-steel/gauge-steel.component.ts +0 -282
  68. package/src/app/gauges-module/base-gauge.ts +0 -301
  69. package/src/app/gauges-module/gauges.module.ts +0 -17
  70. package/src/app/gauges-module/linear-gauge.ts +0 -50
  71. package/src/app/gauges-module/radial-gauge.ts +0 -48
  72. package/src/app/layout-split/layout-split.component.html +0 -30
  73. package/src/app/layout-split/layout-split.component.scss +0 -33
  74. package/src/app/layout-split/layout-split.component.spec.ts +0 -25
  75. package/src/app/layout-split/layout-split.component.ts +0 -59
  76. package/src/app/layout-splits.service.spec.ts +0 -15
  77. package/src/app/layout-splits.service.ts +0 -284
  78. package/src/app/modal-path-selector/modal-path-selector.component.html +0 -62
  79. package/src/app/modal-path-selector/modal-path-selector.component.scss +0 -39
  80. package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +0 -25
  81. package/src/app/modal-path-selector/modal-path-selector.component.ts +0 -132
  82. package/src/app/modal-widget/modal-widget.component.css +0 -33
  83. package/src/app/modal-widget/modal-widget.component.html +0 -341
  84. package/src/app/modal-widget/modal-widget.component.spec.ts +0 -25
  85. package/src/app/modal-widget/modal-widget.component.ts +0 -84
  86. package/src/app/notifications.service.spec.ts +0 -12
  87. package/src/app/notifications.service.ts +0 -392
  88. package/src/app/object-keys.pipe.spec.ts +0 -8
  89. package/src/app/object-keys.pipe.ts +0 -13
  90. package/src/app/reset-config/reset-config.component.css +0 -0
  91. package/src/app/reset-config/reset-config.component.html +0 -3
  92. package/src/app/reset-config/reset-config.component.spec.ts +0 -25
  93. package/src/app/reset-config/reset-config.component.ts +0 -31
  94. package/src/app/root-display/root-display.component.css +0 -0
  95. package/src/app/root-display/root-display.component.html +0 -4
  96. package/src/app/root-display/root-display.component.spec.ts +0 -25
  97. package/src/app/root-display/root-display.component.ts +0 -57
  98. package/src/app/safe.pipe.ts +0 -16
  99. package/src/app/settings/settings.component.css +0 -9
  100. package/src/app/settings/settings.component.html +0 -25
  101. package/src/app/settings/settings.component.spec.ts +0 -25
  102. package/src/app/settings/settings.component.ts +0 -22
  103. package/src/app/settings-config/settings-config.component.css +0 -39
  104. package/src/app/settings-config/settings-config.component.html +0 -118
  105. package/src/app/settings-config/settings-config.component.spec.ts +0 -25
  106. package/src/app/settings-config/settings-config.component.ts +0 -161
  107. package/src/app/settings-datasets/settings-datasets.component.html +0 -43
  108. package/src/app/settings-datasets/settings-datasets.component.scss +0 -39
  109. package/src/app/settings-datasets/settings-datasets.component.spec.ts +0 -25
  110. package/src/app/settings-datasets/settings-datasets.component.ts +0 -98
  111. package/src/app/settings-datasets/settings-datasets.modal.html +0 -54
  112. package/src/app/settings-notifications/settings-notifications.component.css +0 -0
  113. package/src/app/settings-notifications/settings-notifications.component.html +0 -65
  114. package/src/app/settings-notifications/settings-notifications.component.spec.ts +0 -25
  115. package/src/app/settings-notifications/settings-notifications.component.ts +0 -29
  116. package/src/app/settings-signalk/settings-signalk.component.css +0 -3
  117. package/src/app/settings-signalk/settings-signalk.component.html +0 -89
  118. package/src/app/settings-signalk/settings-signalk.component.spec.ts +0 -25
  119. package/src/app/settings-signalk/settings-signalk.component.ts +0 -174
  120. package/src/app/settings-units/settings-units.component.css +0 -4
  121. package/src/app/settings-units/settings-units.component.html +0 -19
  122. package/src/app/settings-units/settings-units.component.spec.ts +0 -25
  123. package/src/app/settings-units/settings-units.component.ts +0 -62
  124. package/src/app/settings-zones/settings-zones.component.css +0 -22
  125. package/src/app/settings-zones/settings-zones.component.html +0 -70
  126. package/src/app/settings-zones/settings-zones.component.ts +0 -154
  127. package/src/app/settings-zones/settings-zones.modal.css +0 -14
  128. package/src/app/settings-zones/settings-zones.modal.html +0 -39
  129. package/src/app/signalk-connection.service.ts +0 -344
  130. package/src/app/signalk-delta.service.spec.ts +0 -15
  131. package/src/app/signalk-delta.service.ts +0 -97
  132. package/src/app/signalk-full.service.spec.ts +0 -15
  133. package/src/app/signalk-full.service.ts +0 -99
  134. package/src/app/signalk-interfaces.ts +0 -129
  135. package/src/app/signalk-requests.service.spec.ts +0 -12
  136. package/src/app/signalk-requests.service.ts +0 -180
  137. package/src/app/signalk.service.spec.ts +0 -15
  138. package/src/app/signalk.service.ts +0 -428
  139. package/src/app/svg-autopilot/svg-autopilot.component.html +0 -1036
  140. package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +0 -25
  141. package/src/app/svg-autopilot/svg-autopilot.component.ts +0 -174
  142. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +0 -119
  143. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.scss +0 -0
  144. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +0 -25
  145. package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +0 -49
  146. package/src/app/svg-wind/svg-wind.component.css +0 -0
  147. package/src/app/svg-wind/svg-wind.component.html +0 -969
  148. package/src/app/svg-wind/svg-wind.component.scss +0 -76
  149. package/src/app/svg-wind/svg-wind.component.spec.ts +0 -25
  150. package/src/app/svg-wind/svg-wind.component.ts +0 -280
  151. package/src/app/unit-window/unit-window.component.css +0 -37
  152. package/src/app/unit-window/unit-window.component.html +0 -8
  153. package/src/app/unit-window/unit-window.component.spec.ts +0 -25
  154. package/src/app/unit-window/unit-window.component.ts +0 -134
  155. package/src/app/unit-window/unit-window.modal.html +0 -25
  156. package/src/app/units.service.ts +0 -300
  157. package/src/app/widget-autopilot/widget-autopilot.component.html +0 -78
  158. package/src/app/widget-autopilot/widget-autopilot.component.scss +0 -191
  159. package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +0 -25
  160. package/src/app/widget-autopilot/widget-autopilot.component.ts +0 -774
  161. package/src/app/widget-blank/widget-blank.component.html +0 -5
  162. package/src/app/widget-blank/widget-blank.component.scss +0 -21
  163. package/src/app/widget-blank/widget-blank.component.spec.ts +0 -25
  164. package/src/app/widget-blank/widget-blank.component.ts +0 -17
  165. package/src/app/widget-gauge/widget-gauge.component.css +0 -26
  166. package/src/app/widget-gauge/widget-gauge.component.html +0 -29
  167. package/src/app/widget-gauge/widget-gauge.component.spec.ts +0 -25
  168. package/src/app/widget-gauge/widget-gauge.component.ts +0 -120
  169. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +0 -126
  170. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +0 -94
  171. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +0 -25
  172. package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +0 -424
  173. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +0 -122
  174. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +0 -69
  175. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +0 -25
  176. package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +0 -553
  177. package/src/app/widget-historical/widget-historical.component.css +0 -31
  178. package/src/app/widget-historical/widget-historical.component.html +0 -14
  179. package/src/app/widget-historical/widget-historical.component.scss +0 -0
  180. package/src/app/widget-historical/widget-historical.component.spec.ts +0 -25
  181. package/src/app/widget-historical/widget-historical.component.ts +0 -306
  182. package/src/app/widget-iframe/widget-iframe.component.css +0 -12
  183. package/src/app/widget-iframe/widget-iframe.component.html +0 -21
  184. package/src/app/widget-iframe/widget-iframe.component.spec.ts +0 -25
  185. package/src/app/widget-iframe/widget-iframe.component.ts +0 -63
  186. package/src/app/widget-list.service.spec.ts +0 -15
  187. package/src/app/widget-list.service.ts +0 -135
  188. package/src/app/widget-manager.service.spec.ts +0 -15
  189. package/src/app/widget-manager.service.ts +0 -141
  190. package/src/app/widget-numeric/widget-numeric.component.html +0 -13
  191. package/src/app/widget-numeric/widget-numeric.component.scss +0 -52
  192. package/src/app/widget-numeric/widget-numeric.component.spec.ts +0 -25
  193. package/src/app/widget-numeric/widget-numeric.component.ts +0 -457
  194. package/src/app/widget-simple-linear/widget-simple-linear.component.html +0 -28
  195. package/src/app/widget-simple-linear/widget-simple-linear.component.scss +0 -64
  196. package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +0 -25
  197. package/src/app/widget-simple-linear/widget-simple-linear.component.ts +0 -199
  198. package/src/app/widget-state/widget-state.component.html +0 -27
  199. package/src/app/widget-state/widget-state.component.scss +0 -68
  200. package/src/app/widget-state/widget-state.component.spec.ts +0 -25
  201. package/src/app/widget-state/widget-state.component.ts +0 -178
  202. package/src/app/widget-switch/widget-switch.component.css +0 -70
  203. package/src/app/widget-switch/widget-switch.component.html +0 -17
  204. package/src/app/widget-switch/widget-switch.component.spec.ts +0 -25
  205. package/src/app/widget-switch/widget-switch.component.ts +0 -134
  206. package/src/app/widget-text-generic/widget-text-generic.component.css +0 -55
  207. package/src/app/widget-text-generic/widget-text-generic.component.html +0 -9
  208. package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +0 -25
  209. package/src/app/widget-text-generic/widget-text-generic.component.ts +0 -253
  210. package/src/app/widget-tutorial/widget-tutorial.component.css +0 -0
  211. package/src/app/widget-tutorial/widget-tutorial.component.html +0 -34
  212. package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +0 -25
  213. package/src/app/widget-tutorial/widget-tutorial.component.ts +0 -18
  214. package/src/app/widget-unknown/widget-unknown.component.css +0 -0
  215. package/src/app/widget-unknown/widget-unknown.component.html +0 -3
  216. package/src/app/widget-unknown/widget-unknown.component.spec.ts +0 -25
  217. package/src/app/widget-unknown/widget-unknown.component.ts +0 -15
  218. package/src/app/widget-wind/widget-wind.component.css +0 -24
  219. package/src/app/widget-wind/widget-wind.component.html +0 -20
  220. package/src/app/widget-wind/widget-wind.component.spec.ts +0 -25
  221. package/src/app/widget-wind/widget-wind.component.ts +0 -369
  222. package/src/assets/.gitkeep +0 -0
  223. package/src/assets/NoSleep.min.js +0 -2
  224. package/src/assets/alarm.mp3 +0 -0
  225. package/src/assets/alert.mp3 +0 -0
  226. package/src/assets/alertl.old.mp3 +0 -0
  227. package/src/assets/emergency.mp3 +0 -0
  228. package/src/assets/fontawesome6/css/all.min.css +0 -6
  229. package/src/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
  230. package/src/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
  231. package/src/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
  232. package/src/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
  233. package/src/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
  234. package/src/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
  235. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
  236. package/src/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
  237. package/src/assets/icon-192x192.png +0 -0
  238. package/src/assets/icon-256x256.png +0 -0
  239. package/src/assets/icon-384x384.png +0 -0
  240. package/src/assets/icon-512x512.png +0 -0
  241. package/src/assets/notification.mp3 +0 -0
  242. package/src/assets/steelseries-min.js +0 -25
  243. package/src/assets/steelseries-min.js.map +0 -8
  244. package/src/assets/steelseries.js +0 -15834
  245. package/src/assets/svg-autopilot-inkscape-plain.svg +0 -983
  246. package/src/assets/svg-wind-inkscape.svg +0 -1358
  247. package/src/assets/tween-min.js +0 -1
  248. package/src/assets/tween.js +0 -381
  249. package/src/assets/warn.mp3 +0 -0
  250. package/src/environments/environment.prod.ts +0 -3
  251. package/src/environments/environment.ts +0 -8
  252. package/src/favicon.ico +0 -0
  253. package/src/index.html +0 -20
  254. package/src/main.ts +0 -11
  255. package/src/manifest.json +0 -33
  256. package/src/polyfills.ts +0 -80
  257. package/src/styles.css +0 -47
  258. package/src/styles.scss +0 -157
  259. package/src/test.ts +0 -32
  260. package/src/themes/darkBlueTheme.scss +0 -117
  261. package/src/themes/defaultTheme.scss +0 -50
  262. package/src/themes/highContrastTheme.scss +0 -47
  263. package/src/themes/modernTheme.scss +0 -143
  264. package/src/themes/nightMode.scss +0 -185
  265. package/src/themes/platypusTheme.scss +0 -80
  266. package/src/themes/signalkTheme.scss +0 -112
  267. package/src/tsconfig.app.json +0 -15
  268. package/src/tsconfig.spec.json +0 -20
  269. package/src/typings.d.ts +0 -5
  270. package/tsconfig.json +0 -24
  271. package/tslint.json +0 -143
  272. /package/{KipGaugeSample-1-1024x545.png → KipGaugeSample1-1024x545.png} +0 -0
  273. /package/{KipMonitor-1024x488.png → KipGaugeSample2-1024x488.png} +0 -0
@@ -1,282 +0,0 @@
1
- import { Component, Input, AfterViewInit, OnInit, OnChanges, SimpleChanges, ViewChild, ElementRef } from '@angular/core';
2
- import { ResizedEvent } from 'angular-resize-event';
3
-
4
- declare var steelseries: any; // 3rd party
5
-
6
- export const SteelBackgroundColors = {
7
- 'darkGray': steelseries.BackgroundColor.DARK_GRAY,
8
- 'satinGray': steelseries.BackgroundColor.SATIN_GRAY,
9
- 'lightGray': steelseries.BackgroundColor.LIGHT_GRAY,
10
- 'white': steelseries.BackgroundColor.WHITE,
11
- 'black': steelseries.BackgroundColor.BLACK,
12
- 'beige': steelseries.BackgroundColor.BEIGE,
13
- 'brown': steelseries.BackgroundColor.BROWN,
14
- 'red': steelseries.BackgroundColor.RED,
15
- 'green': steelseries.BackgroundColor.GREEN,
16
- 'blue': steelseries.BackgroundColor.BLUE,
17
- 'anthracite': steelseries.BackgroundColor.ANTHRACITE,
18
- 'mud': steelseries.BackgroundColor.MUD,
19
- 'punchedSheet': steelseries.BackgroundColor.PUNCHED_SHEET,
20
- 'carbon': steelseries.BackgroundColor.CARBON,
21
- 'stainless': steelseries.BackgroundColor.STAINLESS,
22
- 'brushedMetal': steelseries.BackgroundColor.BRUSHED_METAL,
23
- 'brushedStainless': steelseries.BackgroundColor.BRUSHED_STAINLESS,
24
- 'turned': steelseries.BackgroundColor.TURNED
25
- }
26
-
27
- export const SteelFrameColors = {
28
- 'blackMetal': steelseries.FrameDesign.BLACK_METAL,
29
- 'metal': steelseries.FrameDesign.METAL,
30
- 'shinyMetal': steelseries.FrameDesign.SHINY_METAL,
31
- 'brass': steelseries.FrameDesign.BRASS,
32
- 'steel': steelseries.FrameDesign.STEEL,
33
- 'chrome': steelseries.FrameDesign.CHROME,
34
- 'gold': steelseries.FrameDesign.GOLD,
35
- 'anthracite': steelseries.FrameDesign.ANTHRACITE,
36
- 'tiltedGray': steelseries.FrameDesign.TILTED_GRAY,
37
- 'tiltedBlack': steelseries.FrameDesign.TILTED_BLACK,
38
- 'glossyMetal': steelseries.FrameDesign.GLOSSY_METAL
39
- }
40
-
41
-
42
- @Component({
43
- selector: 'gauge-steel',
44
- templateUrl: './gauge-steel.component.html',
45
- styleUrls: ['./gauge-steel.component.css']
46
- })
47
- export class GaugeSteelComponent implements OnInit, AfterViewInit, OnChanges {
48
-
49
- @ViewChild('wrapperDiv', {static: true, read: ElementRef}) wrapperDiv: ElementRef;
50
-
51
- @Input('widgetUUID') widgetUUID: string;
52
- @Input('gaugeType') gaugeType: string; // linear or radial
53
- @Input('barGauge') barGauge: boolean;
54
-
55
- @Input('radialSize') radialSize?: string;
56
-
57
- @Input('backgroundColor') backgroundColor?: string;
58
- @Input('frameColor') frameColor: string;
59
-
60
- @Input('minValue') minValue: number;
61
- @Input('maxValue') maxValue: number;
62
-
63
- @Input('zones') zones: Array<{ low: number; high: number; state: string}>;
64
-
65
- @Input('title') title: string;
66
- @Input('units') units: string;
67
-
68
- @Input('value') value: number;
69
- gaugeWidth: number = 0;
70
- gaugeHeight: number = 0;
71
- isInResizeWindow: boolean = false;
72
- gaugeStarted: boolean = false;
73
-
74
- constructor() { }
75
-
76
- gauge;
77
-
78
- gaugeOptions = {};
79
-
80
- // common options for both radial and linear
81
-
82
- sections;
83
-
84
-
85
- ngOnInit() {
86
-
87
- }
88
-
89
- ngAfterViewInit() {
90
- if (!this.gaugeType) { this.gaugeType = 'radial'; }
91
- }
92
-
93
- buildOptions() {
94
- this.gaugeOptions = {};
95
-
96
- //size
97
- if (this.gaugeType == 'radial') {
98
- this.gaugeOptions['size'] = Math.min(this.gaugeHeight, this.gaugeWidth); // radial takes only size as both the same
99
- } else {
100
- this.gaugeOptions['width'] = this.gaugeWidth;
101
- this.gaugeOptions['height'] = this.gaugeHeight;
102
- }
103
-
104
- //minMax
105
- this.gaugeOptions['minValue'] = this.minValue;
106
- this.gaugeOptions['maxValue'] = this.maxValue;
107
-
108
- //labels
109
- this.gaugeOptions['titleString'] = this.title;
110
- this.gaugeOptions['unitString'] = this.units;
111
-
112
- // Radial Arc size
113
- if (this.gaugeType == 'radial') {
114
- switch(this.radialSize) {
115
- case 'quarter':
116
- this.gaugeOptions['gaugeType'] = steelseries.GaugeType.TYPE1;
117
- break;
118
- case 'half':
119
- this.gaugeOptions['gaugeType'] = steelseries.GaugeType.TYPE2;
120
- break;
121
- case 'three-quarter':
122
- this.gaugeOptions['gaugeType'] = steelseries.GaugeType.TYPE3;
123
- break;
124
- case 'full':
125
- default:
126
- this.gaugeOptions['gaugeType'] = steelseries.GaugeType.TYPE4;
127
-
128
-
129
- }
130
- }
131
-
132
- // Zones
133
- // Define some sections
134
- if (this.zones) {
135
- let sections = [];
136
- let areas = []
137
- for (let i=0;i < this.zones.length; i++) {
138
- switch (this.zones[i].state) {
139
- case 'good':
140
- sections.push(steelseries.Section(this.zones[i].low, this.zones[i].high, 'rgba(0, 220, 0, 0.3)'));
141
- break;
142
- case 'warn':
143
- sections.push(steelseries.Section(this.zones[i].low, this.zones[i].high, 'rgba(220, 220, 0, 0.3)'));
144
- break;
145
- case 'alert':
146
- if (this.gaugeType == 'radial' && (!this.barGauge)) {
147
- areas.push(steelseries.Section(this.zones[i].low, this.zones[i].high, 'rgba(220, 0, 0, 0.3)'));
148
- } else {
149
- sections.push(steelseries.Section(this.zones[i].low, this.zones[i].high, 'rgba(220, 0, 0, 0.3)'));
150
- }
151
- }
152
- }
153
-
154
- this.gaugeOptions['section'] = sections;
155
- this.gaugeOptions['area'] = areas;
156
- this.gaugeOptions['useSectionColors'] = true;
157
- }
158
-
159
-
160
- //Colors
161
- if (SteelBackgroundColors[this.backgroundColor]) {
162
- this.gaugeOptions['backgroundColor'] = SteelBackgroundColors[this.backgroundColor];
163
- }
164
- if (SteelFrameColors[this.frameColor]) {
165
- this.gaugeOptions['frameDesign'] = SteelFrameColors[this.frameColor];
166
- }
167
- if (this.barGauge) {
168
- this.gaugeOptions['valueColor'] = steelseries.ColorDef.GREEN;
169
- }
170
-
171
-
172
- //defaults
173
- this.gaugeOptions['lcdVisible'] = true;
174
- this.gaugeOptions['thresholdVisible'] = false;
175
- this.gaugeOptions['threshold'] = this.maxValue;
176
- this.gaugeOptions['ledVisible'] = false;
177
- }
178
-
179
- startGauge() {
180
- this.gaugeStarted = true;
181
- this.buildOptions();
182
- // Initialzing gauges
183
- if (this.gaugeType == 'radial') {
184
- if (this.barGauge) {
185
- this.gauge = new steelseries.RadialBargraph(this.widgetUUID, this.gaugeOptions);
186
- } else {
187
- this.gauge = new steelseries.Radial(this.widgetUUID, this.gaugeOptions);
188
- }
189
- } else if (this.gaugeType == 'linear') {
190
- if (this.barGauge) {
191
- this.gauge = new steelseries.LinearBargraph(this.widgetUUID, this.gaugeOptions);
192
- } else {
193
- this.gauge = new steelseries.Linear(this.widgetUUID, this.gaugeOptions);
194
- }
195
- }
196
-
197
- }
198
-
199
- onResized(event: ResizedEvent) {
200
- if (event.newRect.height < 50) {
201
- return;
202
- }
203
- if (event.newRect.width < 50) {
204
- return;
205
- }
206
- if (!this.isInResizeWindow) {
207
- this.isInResizeWindow = true;
208
-
209
- setTimeout(() => {
210
- let rect = this.wrapperDiv.nativeElement.getBoundingClientRect();
211
- this.gaugeWidth = rect.width;
212
- this.gaugeHeight = rect.height;
213
- this.isInResizeWindow = false;
214
- this.startGauge();
215
- }, 1000);
216
- }
217
- }
218
-
219
- ngOnChanges(changes: SimpleChanges) {
220
- if (!this.gaugeStarted) { return; }
221
-
222
- if (changes.value) {
223
- if (! changes.value.firstChange) {
224
- this.gauge.setValueAnimated(changes.value.currentValue);
225
- }
226
- }
227
-
228
- if (changes.gaugeType) {
229
- if ( !changes.gaugeType.firstChange) {
230
- this.startGauge();//reset
231
- }
232
- }
233
-
234
- if (changes.barGauge) {
235
- if ( !changes.barGauge.firstChange) {
236
- this.startGauge();//reset
237
- }
238
- }
239
-
240
- if (changes.title) {
241
- if ( !changes.title.firstChange) {
242
- this.startGauge();//reset
243
- }
244
- }
245
-
246
- if (changes.units) {
247
- if ( !changes.units.firstChange) {
248
- this.startGauge();//reset
249
- }
250
- }
251
- if (changes.minValue) {
252
- if ( !changes.minValue.firstChange) {
253
- this.startGauge();//reset
254
- }
255
- }
256
- if (changes.maxValue) {
257
- if ( !changes.maxValue.firstChange) {
258
- this.startGauge();//reset
259
- }
260
- }
261
-
262
- if (changes.radialSize) {
263
- if ( !changes.radialSize.firstChange) {
264
- this.startGauge();//reset
265
- }
266
- }
267
-
268
- if (changes.backgroundColor) {
269
- if ( !changes.backgroundColor.firstChange) {
270
- this.startGauge();//reset
271
- }
272
- }
273
-
274
- if (changes.frameColor) {
275
- if ( !changes.frameColor.firstChange) {
276
- this.startGauge();//reset
277
- }
278
- }
279
-
280
- }
281
-
282
- }
@@ -1,301 +0,0 @@
1
- /*!
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2017 Vlad Martynenko <vladimir.martynenko.work@gmail.com>
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- import { ViewChild, Input, NgZone, ElementRef, OnInit, AfterViewInit, Directive } from '@angular/core';
26
- import * as CanvasGauges from 'canvas-gauges';
27
- import * as Rx from 'rx-dom-html';
28
-
29
-
30
-
31
- // String utils
32
- const toCamelCase = (str: string) => str.replace(/(\-\w)/g, (matches) => matches[1].toUpperCase());
33
-
34
- const toKebabCase = (str: string) => str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
35
-
36
- const attributeName2PropertyName = (attrName: string) => toCamelCase(attrName);
37
-
38
-
39
-
40
-
41
- /**
42
- * Base gauge component for the Gauges rendering
43
- * T - Type of the Gauge to be rendered (Currently RadialGauge, LinearGauge from the original library)
44
- * T2 - Type of config options used by the particular gauge (RadialGaugeOptions, LinearGaugeOptions)
45
- */
46
- @Directive()
47
- export abstract class BaseGauge<T extends CanvasGauges.BaseGauge, T2 extends CanvasGauges.GenericOptions>
48
- implements OnInit, AfterViewInit {
49
-
50
- /**
51
- * Canvas element on the template used by the library to draw gauge element
52
- */
53
- @ViewChild('gauge', { static: true })
54
- protected canvas: ElementRef;
55
-
56
- /**
57
- * A gauge instance responsible for rendering and updates on the canvas.
58
- * Subclasses should initialize in their ngOnInit implementation.
59
- */
60
- protected gauge: T;
61
-
62
-
63
- /**
64
- * Flag indicating that OnViewInit life-cycle has completed
65
- */
66
- private isInited = false;
67
-
68
- /**
69
- * value property of gauge prior to component view initialization
70
- */
71
- private preInitValue: number;
72
-
73
- /**
74
- * options property of gauge prior to component view initialization
75
- */
76
- private preInitOptions: T2;
77
-
78
-
79
- /**
80
- * Listen for attribute changes, i.e., options properties that are stored
81
- * as attributes on this ElementRef
82
- */
83
- private domListener: MutationObserver;
84
-
85
-
86
- /**
87
- *
88
- * @param el - reference to the element of the whole component, used to scrape options declared on the component itself
89
- * @param zone - required to redraw gauge outside of Angular, due to animation lags caused by the ovewritten function of the ngZone
90
- */
91
- constructor(private el: ElementRef, public zone: NgZone) {
92
- }
93
-
94
-
95
- /**
96
- * Subclasses should instantiate the CanvasGauge object in the child component
97
- */
98
- abstract ngOnInit(): void;
99
-
100
-
101
- /**
102
- * Returns gauges properties as an options object.
103
- * Option properties consist of the attribute-based properties and those
104
- * explicitly set.
105
- * @returns <T2>
106
- */
107
- public get options(): T2 {
108
-
109
- const options = {} as T2;
110
- options.renderTo = this.canvas.nativeElement;
111
-
112
- // Map attribute-based options onto options.
113
- // Requries converting kebab style attribute names to camelCase property names
114
- for (const attr of this.el.nativeElement.attributes) {
115
- const prop = attributeName2PropertyName(attr.name);
116
- options[prop] = CanvasGauges.DomObserver.parse(attr.value);
117
- }
118
-
119
- // merge preOptons with attribute-based properties
120
- // tslint:disable-next-line:forin
121
- for (const prop in this.preInitOptions) {
122
- options[prop] = this.preInitOptions[prop];
123
- }
124
-
125
- // clear the preInitOptions as they have already been merged
126
- // with the attribute-based properties
127
- if (this.isInited) {
128
- this.preInitOptions = null;
129
- }
130
-
131
- return options;
132
- }
133
-
134
-
135
- /**
136
- * Assign gauge options at anytime in the lifecycle.
137
- * @param newOptions - assign the style and size properties
138
- */
139
- @Input()
140
- public set options(newOptions: T2) {
141
-
142
- // cache newOptions as preInitOptions until gauge is ready
143
- if (!this.isInited) {
144
- this.preInitOptions = newOptions;
145
- return;
146
- }
147
-
148
- this.update(newOptions);
149
- }
150
-
151
-
152
- /**
153
- * Assign the value of the gauge visual indicator such as a needle or pointer
154
- * @param newValue the guage new value
155
- */
156
- @Input()
157
- public set value(newValue: number) {
158
-
159
- // case new gauge value as preInitValue until the gauge is ready
160
- if (!this.isInited) {
161
- this.preInitValue = newValue;
162
- return;
163
- }
164
-
165
- this.zone.runOutsideAngular(() => {
166
- this.gauge.value = newValue;
167
- });
168
- }
169
-
170
-
171
- /**
172
- * Update the gauge options. Do not use until after OnViewInit() before using.
173
- *
174
- * Special implementation note - options.properties are maintained as
175
- * attribute name->value on this component's elementRef. Thus this method
176
- * maps each newOptions property onto the property's corresponding attribute.
177
- * The attribute update triggers a DOM mutation event which "this" listens for.
178
- * See #listenForDOMEvents()
179
- *
180
- * @param newOptions - the options to update the gauge
181
- */
182
- public update(newOptions: T2 | {}) {
183
-
184
- // map all options onto this element's attributes
185
- // Then attribute changes will be detected and pushed to the gauge.update()
186
- if (!newOptions) { return; }
187
-
188
- // tslint:disable-next-line:forin
189
- for (const prop in newOptions) {
190
- const val = newOptions[prop].toString();
191
-
192
- if (prop === 'value') {
193
- // short circuit the value property update by calling
194
- // the gauge.value api directly for efficient animated update
195
- this.value = CanvasGauges.DomObserver.parse(val);
196
- } else {
197
- const attrName = toKebabCase(prop);
198
- this.el.nativeElement.setAttribute(attrName, val);
199
- }
200
- }
201
- }
202
-
203
-
204
- /**
205
- * Perform gauge initialization.
206
- * Subclasses that override this method must this super version
207
- * for proper operation.
208
- */
209
- public ngAfterViewInit() {
210
-
211
- // initial update of gauge properties
212
- this.initGauge();
213
-
214
- this.listenForDOMEvents();
215
-
216
- this.isInited = true;
217
-
218
- if (this.preInitValue) {
219
- this.value = this.preInitValue;
220
- }
221
- }
222
-
223
-
224
- /**
225
- * Listen for attribute-change events that are created when updating
226
- * the options of this gauge.
227
- */
228
- protected listenForDOMEvents() {
229
- // Listen to gauge element for attribute changes
230
- // Convert all changed attribtues into a GenericOptions or subclass
231
- // Update the gauge with the new options.
232
- this.domListener =
233
- Rx.DOM.fromMutationObserver(this.el.nativeElement, { attributes: true }).
234
- subscribe(changes => {
235
- const newOptions = {} as T2;
236
- changes.forEach(change => {
237
- if ('attributes' === change.type) {
238
- // console.log('DOM, change', change.attributeName);
239
- newOptions[attributeName2PropertyName(change.attributeName)] =
240
- CanvasGauges.DomObserver.parse(
241
- this.el.nativeElement.getAttribute(change.attributeName));
242
- }
243
- });
244
-
245
- this.basicUpdate(newOptions);
246
- });
247
- }
248
-
249
-
250
- /**
251
- * Discontinue listening for attribute change events.
252
- */
253
- protected stopListeningForDOMEvents() {
254
- if (this.domListener) {
255
- this.domListener.disconnect();
256
- this.domListener = null;
257
- }
258
- }
259
-
260
-
261
- /**
262
- * Initalize the gauge with all options defined by attributes and
263
- * parent component options.
264
- */
265
- protected initGauge() {
266
- const options = this.options;
267
-
268
- // init options.renderTo if needed
269
- if (!options.hasOwnProperty('renderTo') || !options.renderTo) {
270
- options.renderTo = this.canvas.nativeElement;
271
- }
272
-
273
- this.basicUpdate(options);
274
- }
275
-
276
-
277
- /**
278
- * Performs the gauge update using the current options
279
- * @param options The options for the guage
280
- */
281
- protected basicUpdate(options: T2) {
282
-
283
- // treat the value property special and update it through the
284
- // value getter.
285
- if (typeof options.value === 'number') {
286
-
287
- // use gauge api directly for most efficient update method
288
- this.value = options.value;
289
-
290
- // filter value property from options to avoid redundant
291
- // processing by gauge
292
- delete options.value;
293
- }
294
-
295
- // do nothing if no option properties to update
296
- if (Object.keys(options).length) {
297
- this.gauge.update(options);
298
- }
299
- }
300
-
301
- }
@@ -1,17 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { LinearGauge } from './linear-gauge';
3
- import { RadialGauge } from './radial-gauge';
4
-
5
- @NgModule({
6
- declarations: [
7
- LinearGauge,
8
- RadialGauge],
9
- imports: [
10
- ],
11
- exports: [
12
- LinearGauge,
13
- RadialGauge]
14
- })
15
- export class GaugesModule { }
16
-
17
- // code from module https://github.com/biacsics/ng-canvas-gauges/blob/master/projects/ng-canvas-gauges
@@ -1,50 +0,0 @@
1
- /*!
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2017 Vlad Martynenko <vladimir.martynenko.work@gmail.com>
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- import {Component, NgZone, ElementRef, OnInit} from '@angular/core';
26
- import {BaseGauge} from './base-gauge';
27
- import * as CanvasGauges from 'canvas-gauges';
28
-
29
- export { LinearGaugeOptions } from 'canvas-gauges';
30
-
31
- /**
32
- * Implements Linear Gauge from the original library
33
- */
34
- @Component({
35
- // tslint:disable-next-line:component-selector
36
- selector: 'linear-gauge',
37
- template: '<canvas #gauge></canvas>'
38
- })
39
- // tslint:disable-next-line:component-class-suffix
40
- export class LinearGauge extends BaseGauge<CanvasGauges.LinearGauge, CanvasGauges.LinearGaugeOptions> implements OnInit {
41
-
42
- constructor(el: ElementRef, zone: NgZone) {
43
- super(el, zone);
44
- }
45
-
46
-
47
- ngOnInit(): void {
48
- this.gauge = new CanvasGauges.LinearGauge(this.options).draw();
49
- }
50
- }
@@ -1,48 +0,0 @@
1
- /*!
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2017 Vlad Martynenko <vladimir.martynenko.work@gmail.com>
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- import { Component, NgZone, ElementRef, OnInit } from '@angular/core';
26
- import { BaseGauge } from './base-gauge';
27
- import * as CanvasGauges from 'canvas-gauges';
28
-
29
- export { RadialGaugeOptions } from 'canvas-gauges';
30
-
31
- /**
32
- * Implements Radial Gauge from the original library
33
- */
34
- @Component({
35
- // tslint:disable-next-line:component-selector
36
- selector: 'radial-gauge',
37
- template: '<canvas #gauge></canvas>'
38
- })
39
- // tslint:disable-next-line:component-class-suffix
40
- export class RadialGauge extends BaseGauge<CanvasGauges.RadialGauge, CanvasGauges.RadialGaugeOptions> implements OnInit {
41
- constructor(el: ElementRef, zone: NgZone) {
42
- super(el, zone);
43
- }
44
-
45
- ngOnInit() {
46
- this.gauge = new CanvasGauges.RadialGauge(this.options).draw();
47
- }
48
- }