@mxtommy/kip 3.0.0-beta.12 → 3.0.0-beta.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxtommy/kip",
3
- "version": "3.0.0-beta.12",
3
+ "version": "3.0.0-beta.14",
4
4
  "description": "An advanced and versatile marine instrumentation package to display Signal K data.",
5
5
  "license": "MIT",
6
6
  "author": {
package/public/main.js CHANGED
@@ -85992,9 +85992,9 @@ var UnitsService = class _UnitsService {
85992
85992
  // src/app/core/utils/base-widget.component.ts
85993
85993
  var BaseWidgetComponent = class _BaseWidgetComponent extends BaseWidget {
85994
85994
  widgetProperties;
85995
- displayName$ = new Subject();
85996
85995
  zones$ = new BehaviorSubject([]);
85997
85996
  theme = void 0;
85997
+ //TODO: Do we still need theme subscription?
85998
85998
  themeSubscription = void 0;
85999
85999
  /** Default Widget configuration Object properties. This Object is only used as the default configuration template when Widget is added in a KIP page. The default configuration will automatically be pushed to the AppSettings service (the configuration storage service). From then on, any configuration changes made by users using the Widget Options UI is stored in AppSettings service. defaultConfig will only be use from then on to insure missing properties are merged with their default values is needed insuring a safety net when adding new configuration properties. */
86000
86000
  defaultConfig = void 0;
@@ -86017,23 +86017,33 @@ var BaseWidgetComponent = class _BaseWidgetComponent extends BaseWidget {
86017
86017
  serialize() {
86018
86018
  return { widgetProperties: this.widgetProperties };
86019
86019
  }
86020
- initWidget() {
86021
- this.validateConfig();
86022
- this.observeMeta();
86023
- }
86024
- observeMeta() {
86020
+ observeMetaStream() {
86025
86021
  if (this.widgetProperties && this.widgetProperties.config.paths && Object.keys(this.widgetProperties.config.paths).length > 0) {
86026
86022
  const firstKey = Object.keys(this.widgetProperties.config.paths)[0];
86027
86023
  const path = this.widgetProperties.config.paths[firstKey].path;
86028
86024
  this.metaSubscriptions = this.DataService.getPathMetaObservable(path).subscribe((meta) => {
86029
- if (!meta)
86030
- return;
86031
- if (meta.zones) {
86025
+ if (!meta) {
86026
+ this.zones$.next([]);
86027
+ } else if (meta.zones) {
86032
86028
  this.zones$.next(meta.zones);
86029
+ } else {
86030
+ this.zones$.next([]);
86033
86031
  }
86034
86032
  });
86035
86033
  }
86036
86034
  }
86035
+ /**
86036
+ * Call this method to automatically unsubscribe all Widget Meta Observers, cleanup KIP's Observable
86037
+ * registry and reset Widget Subscriptions to free resources.
86038
+ *
86039
+ * Should be called in ngOnDestroy().
86040
+ *
86041
+ * @protected
86042
+ * @memberof BaseWidgetComponent
86043
+ */
86044
+ unsubscribeMetaStream() {
86045
+ this.metaSubscriptions?.unsubscribe();
86046
+ }
86037
86047
  /**
86038
86048
  * This method is used to insure Widget configuration property model changes (not value)
86039
86049
  * are added to older versions of Widget configuration and limit breaking changes.
@@ -86086,7 +86096,7 @@ var BaseWidgetComponent = class _BaseWidgetComponent extends BaseWidget {
86086
86096
  });
86087
86097
  }
86088
86098
  /**
86089
- * Use this method the subscribe to a Signal K data path Observable and receive a
86099
+ * Use this method to subscribe to a Signal K data path Observable and receive a
86090
86100
  * live data stream from the server. This method apply
86091
86101
  * a combination of widgetProperties.config and widgetProperties.config.paths[pathName]
86092
86102
  * objects properties to setup the Observer. Ex: Widget min/max, decimal, combined with
@@ -86183,6 +86193,20 @@ var BaseWidgetComponent = class _BaseWidgetComponent extends BaseWidget {
86183
86193
  this.dataSubscriptions.add(dataPipe$.subscribe(observer));
86184
86194
  }
86185
86195
  }
86196
+ /**
86197
+ * Call this method to automatically unsubscribe all Widget Observers, cleanup KIP's Observable
86198
+ * registry and reset Widget Subscriptions to free resources.
86199
+ *
86200
+ * Should be called in ngOnDestroy().
86201
+ *
86202
+ * @protected
86203
+ * @memberof BaseWidgetComponent
86204
+ */
86205
+ unsubscribeDataStream() {
86206
+ this.dataSubscriptions?.unsubscribe();
86207
+ this.dataSubscriptions = void 0;
86208
+ this.dataStream = void 0;
86209
+ }
86186
86210
  buildObserver(pathKey, subscribeNextFunction) {
86187
86211
  const observer = {
86188
86212
  next: (value) => subscribeNextFunction(value),
@@ -86210,20 +86234,16 @@ var BaseWidgetComponent = class _BaseWidgetComponent extends BaseWidget {
86210
86234
  return vStr;
86211
86235
  }
86212
86236
  /**
86213
- * Call this method to automatically unsubscribe all Widget Observers, cleanup KIP's Observable
86214
- * registry and reset Widget Subscriptions to free resources.
86215
- *
86216
- * Should be called in ngOnDestroy().
86217
- *
86237
+ * @description This method is used to destroy all Widget Observables and free resources.
86238
+ * This method should be called in component ngOnDestroy() to ensure all data layer
86239
+ * resources are freed.
86218
86240
  * @protected
86219
86241
  * @memberof BaseWidgetComponent
86220
86242
  */
86221
- unsubscribeDataStream() {
86222
- if (this.dataSubscriptions) {
86223
- this.dataSubscriptions.unsubscribe();
86224
- this.dataSubscriptions = void 0;
86225
- this.dataStream = void 0;
86226
- }
86243
+ destroyDataStreams() {
86244
+ this.unsubscribeDataStream();
86245
+ this.unsubscribeMetaStream();
86246
+ this.themeSubscription?.unsubscribe();
86227
86247
  }
86228
86248
  static \u0275fac = function BaseWidgetComponent_Factory(__ngFactoryType__) {
86229
86249
  return new (__ngFactoryType__ || _BaseWidgetComponent)();
@@ -117795,7 +117815,7 @@ var WidgetTextComponent = class _WidgetTextComponent extends BaseWidgetComponent
117795
117815
  };
117796
117816
  }
117797
117817
  ngOnInit() {
117798
- this.initWidget();
117818
+ this.validateConfig();
117799
117819
  this.startWidget();
117800
117820
  }
117801
117821
  startWidget() {
@@ -117815,7 +117835,7 @@ var WidgetTextComponent = class _WidgetTextComponent extends BaseWidgetComponent
117815
117835
  this.updateCanvasBG();
117816
117836
  }
117817
117837
  ngOnDestroy() {
117818
- this.unsubscribeDataStream();
117838
+ this.destroyDataStreams();
117819
117839
  }
117820
117840
  getColors(color2) {
117821
117841
  switch (color2) {
@@ -117999,7 +118019,7 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
117999
118019
  currentMinMaxLength = 0;
118000
118020
  valueFontSize = 1;
118001
118021
  minMaxFontSize = 1;
118002
- flashOn = false;
118022
+ flashOn = true;
118003
118023
  flashInterval = null;
118004
118024
  dataState = States.Normal;
118005
118025
  fontString = "px Roboto";
@@ -118034,7 +118054,7 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118034
118054
  };
118035
118055
  }
118036
118056
  ngOnInit() {
118037
- this.initWidget();
118057
+ this.validateConfig();
118038
118058
  this.startWidget();
118039
118059
  }
118040
118060
  startWidget() {
@@ -118050,15 +118070,31 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118050
118070
  } else if (this.maxValue === null || this.dataValue > this.maxValue) {
118051
118071
  this.maxValue = this.dataValue;
118052
118072
  }
118053
- if ((newValue.state == States.Alarm || newValue.state == States.Warn) && !this.flashInterval) {
118054
- this.flashInterval = setInterval(() => {
118055
- this.flashOn = !this.flashOn;
118056
- }, 350);
118057
- } else if (newValue.state == States.Normal && this.flashInterval) {
118073
+ if (this.dataState != newValue.state) {
118058
118074
  clearInterval(this.flashInterval);
118059
118075
  this.flashInterval = null;
118076
+ this.dataState = newValue.state;
118077
+ switch (newValue.state) {
118078
+ case States.Alarm:
118079
+ this.flashInterval = setInterval(() => {
118080
+ this.updateCanvasBG();
118081
+ }, 100);
118082
+ break;
118083
+ case States.Warn:
118084
+ this.flashInterval = setInterval(() => {
118085
+ this.updateCanvasBG();
118086
+ }, 300);
118087
+ break;
118088
+ case States.Alert:
118089
+ this.flashInterval = setInterval(() => {
118090
+ this.updateCanvasBG();
118091
+ }, 750);
118092
+ break;
118093
+ default:
118094
+ this.updateCanvasBG();
118095
+ break;
118096
+ }
118060
118097
  }
118061
- this.dataState = newValue.state;
118062
118098
  this.updateCanvas();
118063
118099
  });
118064
118100
  }
@@ -118129,9 +118165,7 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118129
118165
  }
118130
118166
  }
118131
118167
  ngOnDestroy() {
118132
- this.unsubscribeDataStream();
118133
- this.metaSubscriptions?.unsubscribe();
118134
- this.themeSubscription?.unsubscribe();
118168
+ this.destroyDataStreams();
118135
118169
  if (this.flashInterval) {
118136
118170
  clearInterval(this.flashInterval);
118137
118171
  this.flashInterval = null;
@@ -118153,7 +118187,36 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118153
118187
  }
118154
118188
  updateCanvasBG() {
118155
118189
  if (this.canvasBGCtx) {
118156
- this.canvasBGCtx.clearRect(0, 0, this.canvasBG.nativeElement.width, this.canvasBG.nativeElement.height);
118190
+ switch (this.dataState) {
118191
+ case States.Alarm:
118192
+ if (this.flashOn) {
118193
+ this.canvasBGCtx.fillStyle = this.theme.zoneAlarm;
118194
+ this.canvasBGCtx.fillRect(0, 0, this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
118195
+ } else {
118196
+ this.canvasBGCtx.clearRect(0, 0, this.canvasBG.nativeElement.width, this.canvasBG.nativeElement.height);
118197
+ }
118198
+ break;
118199
+ case States.Warn:
118200
+ if (this.flashOn) {
118201
+ this.canvasBGCtx.fillStyle = this.theme.zoneWarn;
118202
+ this.canvasBGCtx.fillRect(0, 0, this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
118203
+ } else {
118204
+ this.canvasBGCtx.clearRect(0, 0, this.canvasBG.nativeElement.width, this.canvasBG.nativeElement.height);
118205
+ }
118206
+ break;
118207
+ case States.Alert:
118208
+ if (this.flashOn) {
118209
+ this.canvasBGCtx.fillStyle = this.theme.zoneAlert;
118210
+ this.canvasBGCtx.fillRect(0, 0, this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
118211
+ } else {
118212
+ this.canvasBGCtx.clearRect(0, 0, this.canvasBG.nativeElement.width, this.canvasBG.nativeElement.height);
118213
+ }
118214
+ break;
118215
+ default:
118216
+ this.canvasBGCtx.clearRect(0, 0, this.canvasBG.nativeElement.width, this.canvasBG.nativeElement.height);
118217
+ break;
118218
+ }
118219
+ this.flashOn = !this.flashOn;
118157
118220
  this.drawTitle();
118158
118221
  this.drawUnit();
118159
118222
  }
@@ -118187,29 +118250,7 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118187
118250
  this.canvasValCtx.font = "bold " + this.valueFontSize.toString() + this.fontString;
118188
118251
  }
118189
118252
  }
118190
- switch (this.dataState) {
118191
- case States.Alarm:
118192
- if (this.flashOn) {
118193
- this.canvasValCtx.fillStyle = this.valueColor;
118194
- } else {
118195
- this.canvasValCtx.fillStyle = this.theme.zoneWarn;
118196
- this.canvasValCtx.fillRect(0, 0, this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
118197
- this.canvasValCtx.fillStyle = this.valueColor;
118198
- }
118199
- break;
118200
- case States.Warn:
118201
- if (this.flashOn) {
118202
- this.canvasValCtx.fillStyle = this.valueColor;
118203
- } else {
118204
- this.canvasValCtx.fillStyle = this.theme.zoneWarn;
118205
- this.canvasValCtx.fillRect(0, 0, this.canvasEl.nativeElement.width, this.canvasEl.nativeElement.height);
118206
- this.canvasValCtx.fillStyle = this.valueColor;
118207
- }
118208
- break;
118209
- default:
118210
- this.canvasValCtx.fillStyle = this.valueColor;
118211
- break;
118212
- }
118253
+ this.canvasValCtx.fillStyle = this.valueColor;
118213
118254
  this.canvasValCtx.textAlign = "center";
118214
118255
  this.canvasValCtx.textBaseline = "middle";
118215
118256
  this.canvasValCtx.fillText(valueText, this.canvasEl.nativeElement.width / 2, this.canvasEl.nativeElement.height * 0.5 + this.valueFontSize / 15, maxTextWidth);
@@ -118342,7 +118383,7 @@ var WidgetNumericComponent = class _WidgetNumericComponent extends BaseWidgetCom
118342
118383
  \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.canvasMM = _t.first);
118343
118384
  \u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.canvasBG = _t.first);
118344
118385
  }
118345
- }, standalone: true, features: [\u0275\u0275InheritDefinitionFeature, \u0275\u0275StandaloneFeature], decls: 8, vars: 2, consts: [["canvasEl", ""], ["canvasMM", ""], ["canvasBG", ""], [3, "configChange", "config", "id"], [1, "textGenericWrapper", 3, "onResize"], ["id", "canvasValue", 1, "canvas-size"], ["id", "canvasMM", 1, "canvas-size"], ["id", "canvasBG", 1, "canvas-size"]], template: function WidgetNumericComponent_Template(rf, ctx) {
118386
+ }, standalone: true, features: [\u0275\u0275InheritDefinitionFeature, \u0275\u0275StandaloneFeature], decls: 8, vars: 2, consts: [["canvasBG", ""], ["canvasEl", ""], ["canvasMM", ""], [3, "configChange", "config", "id"], [1, "textGenericWrapper", 3, "onResize"], ["id", "canvasBG", 1, "canvas-size"], ["id", "canvasValue", 1, "canvas-size"], ["id", "canvasMM", 1, "canvas-size"]], template: function WidgetNumericComponent_Template(rf, ctx) {
118346
118387
  if (rf & 1) {
118347
118388
  const _r1 = \u0275\u0275getCurrentView();
118348
118389
  \u0275\u0275elementStart(0, "widget-host", 3);
@@ -118412,7 +118453,7 @@ var WidgetDatetimeComponent = class _WidgetDatetimeComponent extends BaseWidgetC
118412
118453
  };
118413
118454
  }
118414
118455
  ngOnInit() {
118415
- this.initWidget();
118456
+ this.validateConfig();
118416
118457
  this.startWidget();
118417
118458
  }
118418
118459
  startWidget() {
@@ -118432,7 +118473,7 @@ var WidgetDatetimeComponent = class _WidgetDatetimeComponent extends BaseWidgetC
118432
118473
  this.updateCanvasBG();
118433
118474
  }
118434
118475
  ngOnDestroy() {
118435
- this.unsubscribeDataStream();
118476
+ this.destroyDataStreams();
118436
118477
  }
118437
118478
  getColors(color2) {
118438
118479
  switch (color2) {
@@ -119082,7 +119123,7 @@ var WidgetBooleanSwitchComponent = class _WidgetBooleanSwitchComponent extends B
119082
119123
  };
119083
119124
  }
119084
119125
  ngOnInit() {
119085
- this.initWidget();
119126
+ this.validateConfig();
119086
119127
  this.startWidget();
119087
119128
  }
119088
119129
  startWidget() {
@@ -119214,7 +119255,7 @@ var WidgetBooleanSwitchComponent = class _WidgetBooleanSwitchComponent extends B
119214
119255
  }
119215
119256
  }
119216
119257
  ngOnDestroy() {
119217
- this.unsubscribeDataStream();
119258
+ this.destroyDataStreams();
119218
119259
  this.skRequestSub?.unsubscribe();
119219
119260
  }
119220
119261
  static \u0275fac = function WidgetBooleanSwitchComponent_Factory(__ngFactoryType__) {
@@ -120058,12 +120099,6 @@ function WidgetAutopilotComponent_span_65_Template(rf, ctx) {
120058
120099
  \u0275\u0275propertyInterpolate("matBadge", ctx_r1.alarmsCount);
120059
120100
  }
120060
120101
  }
120061
- var defaultPpreferedDisplayMode = {
120062
- wind: "windAngleApparent",
120063
- route: "headingMag",
120064
- auto: "headingMag",
120065
- standby: "headingMag"
120066
- };
120067
120102
  var commands = {
120068
120103
  "auto": { "path": "self.steering.autopilot.state", "value": "auto" },
120069
120104
  "wind": { "path": "self.steering.autopilot.state", "value": "wind" },
@@ -120116,7 +120151,6 @@ var WidgetAutopilotComponent = class _WidgetAutopilotComponent extends BaseWidge
120116
120151
  countDownValue = 0;
120117
120152
  actionToBeConfirmed = "";
120118
120153
  skPathToAck = "";
120119
- preferedDisplayMode = defaultPpreferedDisplayMode;
120120
120154
  isWChecked = false;
120121
120155
  // used for Wind toggle
120122
120156
  isTChecked = false;
@@ -120249,7 +120283,7 @@ var WidgetAutopilotComponent = class _WidgetAutopilotComponent extends BaseWidge
120249
120283
  };
120250
120284
  }
120251
120285
  ngOnInit() {
120252
- this.initWidget();
120286
+ this.validateConfig();
120253
120287
  if (this.widgetProperties.config.autoStart) {
120254
120288
  setTimeout(() => {
120255
120289
  this.startApHead();
@@ -120264,7 +120298,7 @@ var WidgetAutopilotComponent = class _WidgetAutopilotComponent extends BaseWidge
120264
120298
  demoMode() {
120265
120299
  }
120266
120300
  ngOnDestroy() {
120267
- this.unsubscribeDataStream();
120301
+ this.destroyDataStreams();
120268
120302
  this.unsubscribeSKRequest();
120269
120303
  console.log("Autopilot Subs Stopped");
120270
120304
  }
@@ -124741,7 +124775,7 @@ var WidgetDataChartComponent = class _WidgetDataChartComponent extends BaseWidge
124741
124775
  Chart.register(annotation, registerables2);
124742
124776
  }
124743
124777
  ngOnInit() {
124744
- this.initWidget();
124778
+ this.validateConfig();
124745
124779
  this.startWidget();
124746
124780
  }
124747
124781
  startWidget() {
@@ -125166,6 +125200,7 @@ var WidgetDataChartComponent = class _WidgetDataChartComponent extends BaseWidge
125166
125200
  return newRow;
125167
125201
  }
125168
125202
  ngOnDestroy() {
125203
+ this.destroyDataStreams();
125169
125204
  this.dsServiceSub?.unsubscribe();
125170
125205
  this.chart?.destroy();
125171
125206
  }
@@ -125403,6 +125438,7 @@ var WidgetFreeboardskComponent = class _WidgetFreeboardskComponent extends BaseW
125403
125438
  ngOnDestroy() {
125404
125439
  window.removeEventListener("message", this.handleIframeGesture);
125405
125440
  this._authTokenSubscription?.unsubscribe();
125441
+ this.destroyDataStreams();
125406
125442
  }
125407
125443
  static \u0275fac = function WidgetFreeboardskComponent_Factory(__ngFactoryType__) {
125408
125444
  return new (__ngFactoryType__ || _WidgetFreeboardskComponent)();
@@ -125866,7 +125902,7 @@ var WidgetGaugeNgCompassComponent = class _WidgetGaugeNgCompassComponent extends
125866
125902
  };
125867
125903
  }
125868
125904
  ngOnInit() {
125869
- this.initWidget();
125905
+ this.validateConfig();
125870
125906
  this.setCanvasHight();
125871
125907
  this.setGaugeConfig();
125872
125908
  }
@@ -125874,7 +125910,6 @@ var WidgetGaugeNgCompassComponent = class _WidgetGaugeNgCompassComponent extends
125874
125910
  this.setGaugeConfig();
125875
125911
  this.compassGauge.update(this.gaugeOptions);
125876
125912
  this.unsubscribeDataStream();
125877
- this.metaSub?.unsubscribe();
125878
125913
  this.observeDataStream("gaugePath", (newValue) => {
125879
125914
  if (!newValue.data) {
125880
125915
  this.textValue = "--";
@@ -126034,7 +126069,7 @@ var WidgetGaugeNgCompassComponent = class _WidgetGaugeNgCompassComponent extends
126034
126069
  return themePalette[color2];
126035
126070
  }
126036
126071
  ngOnDestroy() {
126037
- this.unsubscribeDataStream();
126072
+ this.destroyDataStreams();
126038
126073
  this.metaSub?.unsubscribe();
126039
126074
  }
126040
126075
  static \u0275fac = function WidgetGaugeNgCompassComponent_Factory(__ngFactoryType__) {
@@ -126184,16 +126219,16 @@ var WidgetGaugeNgLinearComponent = class _WidgetGaugeNgLinearComponent extends B
126184
126219
  };
126185
126220
  }
126186
126221
  ngOnInit() {
126187
- this.initWidget();
126222
+ this.validateConfig();
126188
126223
  const gaugeSize = this.gauge.nativeElement.getBoundingClientRect();
126189
126224
  this.gaugeOptions.height = gaugeSize.height;
126190
126225
  this.gaugeOptions.width = gaugeSize.width;
126191
- this.startWidget();
126192
126226
  }
126193
126227
  startWidget() {
126194
126228
  this.setGaugeConfig();
126195
126229
  this.linearGauge.update(this.gaugeOptions);
126196
126230
  this.unsubscribeDataStream();
126231
+ this.unsubscribeMetaStream();
126197
126232
  this.metaSub?.unsubscribe();
126198
126233
  this.observeDataStream("gaugePath", (newValue) => {
126199
126234
  if (!newValue.data) {
@@ -126258,6 +126293,7 @@ var WidgetGaugeNgLinearComponent = class _WidgetGaugeNgLinearComponent extends B
126258
126293
  this.linearGauge.update(option);
126259
126294
  }
126260
126295
  });
126296
+ this.observeMetaStream();
126261
126297
  this.metaSub = this.zones$.subscribe((zones) => {
126262
126298
  if (zones && zones.length > 0) {
126263
126299
  this.setHighlights(zones);
@@ -126497,7 +126533,7 @@ var WidgetGaugeNgLinearComponent = class _WidgetGaugeNgLinearComponent extends B
126497
126533
  this.linearGauge.update(highlights);
126498
126534
  }
126499
126535
  ngOnDestroy() {
126500
- this.unsubscribeDataStream();
126536
+ this.destroyDataStreams();
126501
126537
  this.metaSub?.unsubscribe();
126502
126538
  }
126503
126539
  static \u0275fac = function WidgetGaugeNgLinearComponent_Factory(__ngFactoryType__) {
@@ -126604,7 +126640,7 @@ var WidgetGaugeNgRadialComponent = class _WidgetGaugeNgRadialComponent extends B
126604
126640
  };
126605
126641
  }
126606
126642
  ngOnInit() {
126607
- this.initWidget();
126643
+ this.validateConfig();
126608
126644
  this.setCanvasHight();
126609
126645
  this.setGaugeConfig();
126610
126646
  }
@@ -126612,6 +126648,7 @@ var WidgetGaugeNgRadialComponent = class _WidgetGaugeNgRadialComponent extends B
126612
126648
  this.setGaugeConfig();
126613
126649
  this.radialGauge.update(this.gaugeOptions);
126614
126650
  this.unsubscribeDataStream();
126651
+ this.unsubscribeMetaStream();
126615
126652
  this.metaSub?.unsubscribe();
126616
126653
  this.observeDataStream("gaugePath", (newValue) => {
126617
126654
  if (!newValue.data) {
@@ -126656,6 +126693,7 @@ var WidgetGaugeNgRadialComponent = class _WidgetGaugeNgRadialComponent extends B
126656
126693
  this.radialGauge.update(option);
126657
126694
  }
126658
126695
  });
126696
+ this.observeMetaStream();
126659
126697
  this.metaSub = this.zones$.subscribe((zones) => {
126660
126698
  if (zones && zones.length > 0) {
126661
126699
  this.setHighlights(zones);
@@ -126887,7 +126925,7 @@ var WidgetGaugeNgRadialComponent = class _WidgetGaugeNgRadialComponent extends B
126887
126925
  this.radialGauge.update(highlights);
126888
126926
  }
126889
126927
  ngOnDestroy() {
126890
- this.unsubscribeDataStream();
126928
+ this.destroyDataStreams();
126891
126929
  this.metaSub?.unsubscribe();
126892
126930
  }
126893
126931
  static \u0275fac = function WidgetGaugeNgRadialComponent_Factory(__ngFactoryType__) {
@@ -127208,11 +127246,12 @@ var WidgetSteelGaugeComponent = class _WidgetSteelGaugeComponent extends BaseWid
127208
127246
  };
127209
127247
  }
127210
127248
  ngOnInit() {
127211
- this.initWidget();
127249
+ this.validateConfig();
127212
127250
  this.startWidget();
127213
127251
  }
127214
127252
  startWidget() {
127215
127253
  this.unsubscribeDataStream();
127254
+ this.unsubscribeMetaStream();
127216
127255
  this.metaSub?.unsubscribe();
127217
127256
  this.observeDataStream("gaugePath", (newValue) => {
127218
127257
  if (newValue.data.value == null) {
@@ -127220,9 +127259,16 @@ var WidgetSteelGaugeComponent = class _WidgetSteelGaugeComponent extends BaseWid
127220
127259
  }
127221
127260
  this.dataValue = Math.min(Math.max(newValue.data.value, this.widgetProperties.config.displayScale.lower), this.widgetProperties.config.displayScale.upper);
127222
127261
  });
127262
+ this.observeMetaStream();
127223
127263
  this.metaSub = this.zones$.subscribe((zones) => {
127224
- if (zones && zones.length > 0) {
127225
- this.zones = zones;
127264
+ if (zones) {
127265
+ if (zones.length > 0) {
127266
+ this.zones = zones;
127267
+ } else {
127268
+ this.zones = [];
127269
+ }
127270
+ } else {
127271
+ this.zones = [];
127226
127272
  }
127227
127273
  });
127228
127274
  }
@@ -127231,7 +127277,7 @@ var WidgetSteelGaugeComponent = class _WidgetSteelGaugeComponent extends BaseWid
127231
127277
  this.startWidget();
127232
127278
  }
127233
127279
  ngOnDestroy() {
127234
- this.unsubscribeDataStream();
127280
+ this.destroyDataStreams();
127235
127281
  this.metaSub?.unsubscribe();
127236
127282
  }
127237
127283
  static \u0275fac = function WidgetSteelGaugeComponent_Factory(__ngFactoryType__) {
@@ -127310,7 +127356,7 @@ var WidgetIframeComponent = class _WidgetIframeComponent extends BaseWidgetCompo
127310
127356
  };
127311
127357
  }
127312
127358
  ngOnInit() {
127313
- this.initWidget();
127359
+ this.validateConfig();
127314
127360
  this.widgetUrl = this.widgetProperties.config.widgetUrl;
127315
127361
  window.addEventListener("message", this.handleIframeGesture);
127316
127362
  }
@@ -127521,6 +127567,7 @@ var WidgetIframeComponent = class _WidgetIframeComponent extends BaseWidgetCompo
127521
127567
  }
127522
127568
  ngOnDestroy() {
127523
127569
  window.removeEventListener("message", this.handleIframeGesture);
127570
+ this.destroyDataStreams();
127524
127571
  }
127525
127572
  static \u0275fac = function WidgetIframeComponent_Factory(__ngFactoryType__) {
127526
127573
  return new (__ngFactoryType__ || _WidgetIframeComponent)();
@@ -127694,7 +127741,7 @@ var WidgetRaceTimerComponent = class _WidgetRaceTimerComponent extends BaseWidge
127694
127741
  };
127695
127742
  }
127696
127743
  ngOnInit() {
127697
- this.initWidget();
127744
+ this.validateConfig();
127698
127745
  this.subscribeTimer();
127699
127746
  this.startWidget();
127700
127747
  }
@@ -127847,6 +127894,7 @@ var WidgetRaceTimerComponent = class _WidgetRaceTimerComponent extends BaseWidge
127847
127894
  ngOnDestroy() {
127848
127895
  this.timerSub?.unsubscribe();
127849
127896
  clearInterval(this.flashInterval);
127897
+ this.destroyDataStreams();
127850
127898
  }
127851
127899
  /* ******************************************************************************************* */
127852
127900
  /* ******************************************************************************************* */
@@ -128141,7 +128189,7 @@ var WidgetSimpleLinearComponent = class _WidgetSimpleLinearComponent extends Bas
128141
128189
  };
128142
128190
  }
128143
128191
  ngOnInit() {
128144
- this.initWidget();
128192
+ this.validateConfig();
128145
128193
  this.startWidget();
128146
128194
  }
128147
128195
  startWidget() {
@@ -128207,7 +128255,7 @@ var WidgetSimpleLinearComponent = class _WidgetSimpleLinearComponent extends Bas
128207
128255
  }
128208
128256
  }
128209
128257
  ngOnDestroy() {
128210
- this.unsubscribeDataStream();
128258
+ this.destroyDataStreams();
128211
128259
  }
128212
128260
  static \u0275fac = function WidgetSimpleLinearComponent_Factory(__ngFactoryType__) {
128213
128261
  return new (__ngFactoryType__ || _WidgetSimpleLinearComponent)();
@@ -128370,6 +128418,9 @@ var WidgetTutorialComponent = class _WidgetTutorialComponent extends BaseWidgetC
128370
128418
  }
128371
128419
  updateConfig(config2) {
128372
128420
  }
128421
+ ngOnDestroy() {
128422
+ this.destroyDataStreams();
128423
+ }
128373
128424
  static \u0275fac = function WidgetTutorialComponent_Factory(__ngFactoryType__) {
128374
128425
  return new (__ngFactoryType__ || _WidgetTutorialComponent)();
128375
128426
  };
@@ -129046,7 +129097,7 @@ var WidgetWindComponent = class _WidgetWindComponent extends BaseWidgetComponent
129046
129097
  };
129047
129098
  }
129048
129099
  ngOnInit() {
129049
- this.initWidget();
129100
+ this.validateConfig();
129050
129101
  this.startWidget();
129051
129102
  }
129052
129103
  startWidget() {
@@ -129115,7 +129166,7 @@ var WidgetWindComponent = class _WidgetWindComponent extends BaseWidgetComponent
129115
129166
  this.startWidget();
129116
129167
  }
129117
129168
  ngOnDestroy() {
129118
- this.unsubscribeDataStream();
129169
+ this.destroyDataStreams();
129119
129170
  this.stopWindSectors();
129120
129171
  }
129121
129172
  startWindSectors() {
@@ -129222,9 +129273,9 @@ function DashboardComponent_Conditional_2_Template(rf, ctx) {
129222
129273
  }
129223
129274
  }
129224
129275
  var DashboardComponent = class _DashboardComponent {
129225
- _gridstack = viewChild(GridstackComponent);
129226
129276
  _app = inject(AppService);
129227
129277
  dashboard = inject(DashboardService);
129278
+ _gridstack = viewChild.required(GridstackComponent);
129228
129279
  _previousIsStaticState = true;
129229
129280
  gridOptions = {
129230
129281
  margin: 4,
@@ -129359,10 +129410,11 @@ var DashboardComponent = class _DashboardComponent {
129359
129410
  const opt = draggedItem.gridstackNode;
129360
129411
  opt.id = UUID.create();
129361
129412
  opt.input = __spreadProps(__spreadValues({}, opt.input), {
129362
- widgetProperties: __spreadProps(__spreadValues({}, opt.input?.widgetProperties), {
129413
+ widgetProperties: {
129414
+ // ...opt.input?.widgetProperties,
129363
129415
  type: opt.selector,
129364
129416
  uuid: opt.id
129365
- })
129417
+ }
129366
129418
  });
129367
129419
  clone3.gridstackNode = opt;
129368
129420
  return clone3;
@@ -129383,20 +129435,20 @@ var DashboardComponent = class _DashboardComponent {
129383
129435
  }
129384
129436
  }
129385
129437
  };
129386
- if (this._gridstack()?.grid?.willItFit(newItem)) {
129387
- this._gridstack()?.grid?.addWidget(newItem);
129438
+ if (this._gridstack().grid.willItFit(newItem)) {
129439
+ this._gridstack().grid.addWidget(newItem);
129388
129440
  } else {
129389
129441
  newItem.h = 2;
129390
129442
  newItem.w = 2;
129391
- if (this._gridstack()?.grid?.willItFit(newItem)) {
129392
- this._gridstack()?.grid?.addWidget(newItem);
129443
+ if (this._gridstack().grid.willItFit(newItem)) {
129444
+ this._gridstack().grid.addWidget(newItem);
129393
129445
  } else {
129394
129446
  this._app.sendSnackbarNotification("Duplication failed: Insufficient space on the dashboard. Please reorganize to free up space.", 0);
129395
129447
  }
129396
129448
  }
129397
129449
  }
129398
129450
  deleteWidget(item) {
129399
- this._gridstack()?.grid?.removeWidget(item);
129451
+ this._gridstack().grid.removeWidget(item);
129400
129452
  }
129401
129453
  nextDashboard(e2) {
129402
129454
  e2.preventDefault();