@c8y/ngx-components 1023.66.4 → 1023.67.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.
package/echart/index.d.ts CHANGED
@@ -299,15 +299,17 @@ declare class ChartsComponent implements OnChanges, OnInit, OnDestroy {
299
299
  loadMoreData(): void;
300
300
  debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
301
301
  /**
302
- * Toggles the visibility of a series in the chart based on the provided datapoint.
303
- * Uses explicit legendSelect/legendUnSelect based on __active state.
302
+ * Toggles datapoint series visibility via legendSelect/legendUnSelect.
303
+ * Also syncs mark-point (icon) visibility: hidden when the datapoint is hidden
304
+ * (icon has nothing to attach to), re-shown only if the alarm/event is still visible.
305
+ * Mark-lines (vertical lines) are left untouched — they stay visible regardless.
304
306
  * @param datapoint - The datapoint to toggle visibility for.
305
307
  */
306
308
  toggleDatapointSeriesVisibility(datapoint: DatapointsGraphKPIDetails): void;
307
309
  /**
308
- * Toggles the visibility of alarm/event series in the chart.
309
- * Uses explicit legendSelect/legendUnSelect based on __hidden state.
310
- * Targets specific device's series using type + deviceId.
310
+ * Toggles alarm/event series visibility via legendSelect/legendUnSelect.
311
+ * Matches all mark-line and mark-point series for the alarm type across every axis,
312
+ * because getAlarmOrEventSeries creates one series per datapoint axis.
311
313
  * @param alarmOrEvent - The alarm or event to toggle visibility for.
312
314
  */
313
315
  toggleAlarmEventSeriesVisibility(alarmOrEvent: AlarmOrEventExtended): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../../echart/models/datapoints-graph-widget.model.ts","../../echart/models/chart.model.ts","../../echart/models/svg-icons.model.ts","../../echart/charts.component.ts","../../echart/services/chart-alarms.service.ts","../../echart/services/chart-events.service.ts","../../echart/services/chart-helpers.service.ts","../../echart/chart-alerts/chart-alerts.component.ts","../../echart/select-aggregated-datapoint/select-aggregated-datapoint.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null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;AAqBW;AACC;AAEV;;AAGA;;;AAiBA;;;AAgBD;;;"}
1
+ {"version":3,"file":"index.d.ts","sources":["../../echart/models/datapoints-graph-widget.model.ts","../../echart/models/chart.model.ts","../../echart/models/svg-icons.model.ts","../../echart/charts.component.ts","../../echart/services/chart-alarms.service.ts","../../echart/services/chart-events.service.ts","../../echart/services/chart-helpers.service.ts","../../echart/chart-alerts/chart-alerts.component.ts","../../echart/select-aggregated-datapoint/select-aggregated-datapoint.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBM;;;;AAKA;AACJ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;AAOA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;;;;;;;AAWI;;;;;;;;;;AAUJ;;;AAII;;AAEJ;AACA;;AAGI;;;AAIN;;AAEG;;AAGG;AAIN;AACE;AACA;AACD;AAED;AACM;;AAEL;AAED;;;;AAIM;;;;;;;AAQL;AAED;;;;;AAUE;;;;;AAGD;;AAGC;;AAEA;;AAEE;;AAEF;;;AACD;;;;;;;AAQC;AACA;AACD;AAEK;AACA;AAEA;AAEA;AAEN;;;;AAKA;;;;;;;;;;;;;AAcM;AACA;AAEA;;;;AAKA;;;;;;;;;;;AAYL;AAED;;;;;;;;AAUE;AACA;AACD;;AChND;;;;;;AAMG;AACH;AACE;;;;AAIA;;;AACD;;;AAIA;;;AAIA;AAEK;AACA;AACJ;AACE;AACD;AACF;;AAGC;AACA;AACD;AAED;AACE;AACA;AACA;AACD;;AC3CD;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAED;;;;;;;;;;;AC0DA;AA4BE;;AAEA;;;;;;;;AAQA;;;;;;AAMK;AACK;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEV;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAsDA;;;;;AAoKuB;;;AAA4B;AAiDnD;AAOA;AAIA;AAwBA;AA6BA;AAWA;;;;;;AAMG;AACH;AAoCA;;;;;AAKG;AACH;AA4BA;AAeA;AA0BA;;AA8DA;;;AAmOA;AAiEA;AAsDA;AAkBA;AAWA;AAYA;;;AA6BD;;ACjjCD;AAEc;AAAQ;AAEpB;;;;;AAKG;AACG;;;AAqCP;;AC/CD;AAEc;AAAQ;AAEpB;;;;;AAKG;AACG;;;AAuBP;;AChCD;AAEE;;;;AAIG;;;;;;;;;;;AAcH;AAcA;;;AAGD;;AC9BD;;AAQmC;AAEjC;;;;AAQD;;ACVD;;AAqBW;AACC;AAEV;;AAGA;;;AAiBA;;;AAgBD;;;"}
@@ -1110,6 +1110,25 @@ class EchartsOptionsService {
1110
1110
  eventSeries = [...eventSeries, ...newEventSeries];
1111
1111
  alarmSeries = [...alarmSeries, ...newAlarmSeries];
1112
1112
  });
1113
+ // markLine series are x-axis-only vertical lines: they render identically regardless of
1114
+ // yAxisIndex. getAlarmOrEventSeries creates one per datapoint (as a side-effect of always
1115
+ // pairing markLine with markPoint), so with N datapoints there are N redundant copies.
1116
+ // Deduplicate to one per alarm/event type before the selectedDatapoint deduplication below.
1117
+ const deduplicateMarkLines = (seriesList) => {
1118
+ const seenTypes = new Set();
1119
+ return seriesList.filter(s => {
1120
+ const id = s.id;
1121
+ if (!id.endsWith('-markLine')) {
1122
+ return true;
1123
+ }
1124
+ const [type] = id.split('/');
1125
+ const isFirstOfType = !seenTypes.has(type);
1126
+ seenTypes.add(type);
1127
+ return isFirstOfType;
1128
+ });
1129
+ };
1130
+ alarmSeries = deduplicateMarkLines(alarmSeries);
1131
+ eventSeries = deduplicateMarkLines(eventSeries);
1113
1132
  const deduplicateFilterCallback = (obj1, i, arr) => {
1114
1133
  const duplicates = arr.filter(obj2 => obj1['id'] === obj2['id'] && i !== arr.indexOf(obj2));
1115
1134
  if (duplicates.length > 0) {
@@ -1525,7 +1544,7 @@ class ChartRealtimeService {
1525
1544
  this.currentEvents = [];
1526
1545
  this.activeDatapoints = [];
1527
1546
  }
1528
- startRealtime(echartsInstance, datapoints, timeRange, datapointOutOfSyncCallback, timeRangeChangedCallback, alarmOrEventConfig = [], displayOptions, alarms, events) {
1547
+ startRealtime(echartsInstance, datapoints, timeRange, datapointOutOfSyncCallback, timeRangeChangedCallback, alarmOrEventConfig = [], displayOptions, alarms, events, alarmOrEventReceivedCallback) {
1529
1548
  this.echartsInstance = echartsInstance;
1530
1549
  this.activeDatapoints = datapoints;
1531
1550
  this.currentTimeRange = {
@@ -1624,6 +1643,7 @@ class ChartRealtimeService {
1624
1643
  alarmOrEvent['selectedDatapoint'] = foundAlarmOrEvent.selectedDatapoint;
1625
1644
  const key = String(alarmOrEvent.id || alarmOrEvent.creationTime);
1626
1645
  this.pendingAlarmsOrEvents.set(key, alarmOrEvent);
1646
+ alarmOrEventReceivedCallback?.(alarmOrEvent);
1627
1647
  }
1628
1648
  return null;
1629
1649
  }))
@@ -1763,15 +1783,16 @@ class ChartRealtimeService {
1763
1783
  allDataSeries.push(...newEventSeries);
1764
1784
  }
1765
1785
  else if (isAlarm(alarmOrEvent)) {
1766
- // For alarms, remove existing series for this alarm type + device before adding.
1767
- // This ensures alarm status changes (e.g., ACTIVE CLEARED) are reflected.
1768
- // Series ID format: ${alarmType}/${deviceId}-markPoint/markLine
1786
+ // For alarms, remove ALL existing series for this alarm type before adding the updated
1787
+ // series. The markLine series is keyed to whichever datapoint was first in the initial
1788
+ // render loop not necessarily the alarm source device. Filtering by the alarm's
1789
+ // source device ID alone would miss it, leaving a stale markLine on the chart.
1769
1790
  const alarm = alarmOrEvent;
1770
1791
  const alarmType = alarm.type;
1771
- const datapointTargetId = datapoint.__target?.id;
1772
1792
  allDataSeries = allDataSeries.filter((series) => {
1773
1793
  const seriesId = series['id'];
1774
- return !seriesId?.startsWith(`${alarmType}/${datapointTargetId}`);
1794
+ return !(seriesId?.startsWith(`${alarmType}/`) &&
1795
+ (seriesId?.endsWith('-markLine') || seriesId?.endsWith('-markPoint')));
1775
1796
  });
1776
1797
  // For alarms, pass null as id - we want one series per alarm type/device.
1777
1798
  // Series ID will be: alarmType/deviceId-markPoint (no unique suffix).
@@ -2342,24 +2363,46 @@ class ChartsComponent {
2342
2363
  };
2343
2364
  }
2344
2365
  /**
2345
- * Toggles the visibility of a series in the chart based on the provided datapoint.
2346
- * Uses explicit legendSelect/legendUnSelect based on __active state.
2366
+ * Toggles datapoint series visibility via legendSelect/legendUnSelect.
2367
+ * Also syncs mark-point (icon) visibility: hidden when the datapoint is hidden
2368
+ * (icon has nothing to attach to), re-shown only if the alarm/event is still visible.
2369
+ * Mark-lines (vertical lines) are left untouched — they stay visible regardless.
2347
2370
  * @param datapoint - The datapoint to toggle visibility for.
2348
2371
  */
2349
2372
  toggleDatapointSeriesVisibility(datapoint) {
2350
- const series = this.echartsInstance.getOption().series;
2351
- const seriesToUpdate = series.find(s => s.datapointId === `${datapoint.__target?.id}${datapoint.fragment}${datapoint.series}`);
2373
+ const allSeries = this.echartsInstance.getOption().series;
2374
+ const seriesToUpdate = allSeries.find(s => s.datapointId === `${datapoint.__target?.id}${datapoint.fragment}${datapoint.series}`);
2352
2375
  if (seriesToUpdate) {
2353
2376
  this.echartsInstance.dispatchAction({
2354
2377
  type: datapoint.__active ? 'legendSelect' : 'legendUnSelect',
2355
2378
  name: seriesToUpdate.name
2356
2379
  });
2357
2380
  }
2381
+ const deviceId = datapoint.__target?.id;
2382
+ const isHiding = !datapoint.__active;
2383
+ const visibleTypes = new Set(this.config.alarmsEventsConfigs
2384
+ ?.filter(ae => !ae.__hidden && ae.__active)
2385
+ .map(ae => ae.filters.type));
2386
+ allSeries
2387
+ .filter(s => typeof s.name === 'string' && s.name.endsWith(`/${deviceId}-markPoint`))
2388
+ .forEach(s => {
2389
+ const name = s.name;
2390
+ if (isHiding) {
2391
+ this.echartsInstance.dispatchAction({ type: 'legendUnSelect', name });
2392
+ }
2393
+ else {
2394
+ // Re-show only if the alarm/event is itself still visible
2395
+ const type = name.split('/')[0];
2396
+ if (visibleTypes?.has(type)) {
2397
+ this.echartsInstance.dispatchAction({ type: 'legendSelect', name });
2398
+ }
2399
+ }
2400
+ });
2358
2401
  }
2359
2402
  /**
2360
- * Toggles the visibility of alarm/event series in the chart.
2361
- * Uses explicit legendSelect/legendUnSelect based on __hidden state.
2362
- * Targets specific device's series using type + deviceId.
2403
+ * Toggles alarm/event series visibility via legendSelect/legendUnSelect.
2404
+ * Matches all mark-line and mark-point series for the alarm type across every axis,
2405
+ * because getAlarmOrEventSeries creates one series per datapoint axis.
2363
2406
  * @param alarmOrEvent - The alarm or event to toggle visibility for.
2364
2407
  */
2365
2408
  toggleAlarmEventSeriesVisibility(alarmOrEvent) {
@@ -2372,13 +2415,9 @@ class ChartsComponent {
2372
2415
  return;
2373
2416
  }
2374
2417
  const type = alarmOrEvent.filters.type;
2375
- const deviceId = alarmOrEvent.__target?.id;
2376
2418
  const actionType = alarmOrEvent.__hidden ? 'legendUnSelect' : 'legendSelect';
2377
- // Series names are: ${type}/${deviceId}-markPoint and ${type}/${deviceId}-markLine
2378
- const markPointName = `${type}/${deviceId}-markPoint`;
2379
- const markLineName = `${type}/${deviceId}-markLine`;
2380
- // Find series matching this specific alarm type + device
2381
- const matchingSeries = allSeries.filter(s => s.name === markPointName || s.name === markLineName);
2419
+ const matchingSeries = allSeries.filter(s => s.name?.startsWith(`${type}/`) &&
2420
+ (s.name?.endsWith('-markLine') || s.name?.endsWith('-markPoint')));
2382
2421
  matchingSeries.forEach(series => {
2383
2422
  this.echartsInstance.dispatchAction({
2384
2423
  type: actionType,
@@ -2486,7 +2525,27 @@ class ChartsComponent {
2486
2525
  showLabelAndUnit: this.config.showLabelAndUnit || false,
2487
2526
  showSlider: this.config.showSlider || false,
2488
2527
  showOnlyAlarmsOrEvents
2489
- }, this.alarms, this.events);
2528
+ }, this.alarms, this.events,
2529
+ // Keep this.alarms/events in sync with realtime updates so that
2530
+ // isAlarmOrEventClick() and the tooltip formatter have current data.
2531
+ alarmOrEvent => {
2532
+ if ('severity' in alarmOrEvent) {
2533
+ const alarm = alarmOrEvent;
2534
+ const existingIdx = this.alarms.findIndex(a => a.id === alarm.id);
2535
+ if (existingIdx !== -1) {
2536
+ this.alarms[existingIdx] = alarm;
2537
+ }
2538
+ else {
2539
+ this.alarms.push(alarm);
2540
+ }
2541
+ }
2542
+ else {
2543
+ const event = alarmOrEvent;
2544
+ if (!this.events.some(e => e.id === event.id)) {
2545
+ this.events.push(event);
2546
+ }
2547
+ }
2548
+ });
2490
2549
  }
2491
2550
  }
2492
2551
  /*