@c8y/ngx-components 1024.18.9 → 1024.18.13
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/fesm2022/c8y-ngx-components-echart.mjs +18 -6
- package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-file-preview.mjs +3 -0
- package/fesm2022/c8y-ngx-components-file-preview.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs +27 -6
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs.map +1 -1
- package/package.json +1 -1
- package/types/c8y-ngx-components-echart.d.ts +3 -0
- package/types/c8y-ngx-components-echart.d.ts.map +1 -1
- package/types/c8y-ngx-components-file-preview.d.ts.map +1 -1
- package/types/c8y-ngx-components-widgets-implementations-datapoints-graph.d.ts +6 -3
- package/types/c8y-ngx-components-widgets-implementations-datapoints-graph.d.ts.map +1 -1
|
@@ -9,6 +9,7 @@ import { CommonModule, FormsModule, IconDirective, C8yTranslatePipe, WidgetTimeC
|
|
|
9
9
|
import chroma from 'chroma-js';
|
|
10
10
|
import * as echarts from 'echarts';
|
|
11
11
|
import * as i1 from '@ngx-translate/core';
|
|
12
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
12
13
|
import * as i1$3 from '@c8y/client';
|
|
13
14
|
import { AlarmStatus, aggregationType, MeasurementService } from '@c8y/client';
|
|
14
15
|
import * as i6 from '@angular/router';
|
|
@@ -2747,7 +2748,10 @@ class ChartsComponent {
|
|
|
2747
2748
|
this.mediator = inject(WidgetTimeContextMediatorService);
|
|
2748
2749
|
this.widgetTimeContextDateRangeService = inject(WidgetTimeContextDateRangeService);
|
|
2749
2750
|
this.themeSwitcherService = inject(ThemeSwitcherService);
|
|
2751
|
+
this.translateService = inject(TranslateService);
|
|
2750
2752
|
this.loadedTimeRange = null;
|
|
2753
|
+
/** Range requested on the previous change, used to recognise a re-broadcast of it. */
|
|
2754
|
+
this.lastRequestedTimeRange = null;
|
|
2751
2755
|
/** Tracks if the last data fetch returned truncated data */
|
|
2752
2756
|
this.dataWasTruncated = false;
|
|
2753
2757
|
/** Tracks the aggregation interval used in the last fetch so we can detect
|
|
@@ -2841,10 +2845,15 @@ class ChartsComponent {
|
|
|
2841
2845
|
}
|
|
2842
2846
|
const wasFromZoom = this.isChangeFromZoom;
|
|
2843
2847
|
this.isChangeFromZoom = false;
|
|
2848
|
+
const requestedRange = this.getTimeRange();
|
|
2849
|
+
const isSameRangeAsLastChange = !!this.lastRequestedTimeRange &&
|
|
2850
|
+
this.lastRequestedTimeRange.dateFrom === requestedRange.dateFrom &&
|
|
2851
|
+
this.lastRequestedTimeRange.dateTo === requestedRange.dateTo;
|
|
2852
|
+
this.lastRequestedTimeRange = requestedRange;
|
|
2844
2853
|
const configContentChanged = !isEqual(this.config, this.lastConfig);
|
|
2845
2854
|
this.lastConfig = cloneDeep(this.config);
|
|
2846
2855
|
if (wasFromZoom) {
|
|
2847
|
-
const currentRange =
|
|
2856
|
+
const currentRange = requestedRange;
|
|
2848
2857
|
const isWithinLoadedRange = this.loadedTimeRange &&
|
|
2849
2858
|
new Date(currentRange.dateFrom) >= new Date(this.loadedTimeRange.dateFrom) &&
|
|
2850
2859
|
new Date(currentRange.dateTo) <= new Date(this.loadedTimeRange.dateTo);
|
|
@@ -2873,6 +2882,7 @@ class ChartsComponent {
|
|
|
2873
2882
|
needsAutoAggregationRefetch = zoomedInterval !== this.lastAutoAggregationInterval;
|
|
2874
2883
|
}
|
|
2875
2884
|
if (!isWithinLoadedRange || this.dataWasTruncated || needsAutoAggregationRefetch) {
|
|
2885
|
+
this.showLoadMore = false;
|
|
2876
2886
|
this.configChangedSubject.next();
|
|
2877
2887
|
}
|
|
2878
2888
|
}
|
|
@@ -2884,11 +2894,13 @@ class ChartsComponent {
|
|
|
2884
2894
|
return;
|
|
2885
2895
|
}
|
|
2886
2896
|
// Only reset initialTimeRange if the change is NOT from a slider zoom on another widget
|
|
2887
|
-
if (
|
|
2897
|
+
if (this.mediator.isSliderZoomUpdate()) {
|
|
2898
|
+
this.showLoadMore = false;
|
|
2899
|
+
}
|
|
2900
|
+
else if (!isSameRangeAsLastChange) {
|
|
2888
2901
|
this.widgetTimeContextDateRangeService.updateInitialTimeRange(null);
|
|
2889
2902
|
}
|
|
2890
|
-
|
|
2891
|
-
this.mediator.isSliderZoomUpdate.set(false);
|
|
2903
|
+
queueMicrotask(() => this.mediator.isSliderZoomUpdate.set(false));
|
|
2892
2904
|
this.configChangedSubject.next();
|
|
2893
2905
|
}
|
|
2894
2906
|
}
|
|
@@ -3284,7 +3296,7 @@ class ChartsComponent {
|
|
|
3284
3296
|
getDefaultChartOptions() {
|
|
3285
3297
|
return {
|
|
3286
3298
|
title: {
|
|
3287
|
-
text: gettext('No data available.'),
|
|
3299
|
+
text: this.translateService.instant(gettext('No data available.')),
|
|
3288
3300
|
left: 'center',
|
|
3289
3301
|
top: 'center',
|
|
3290
3302
|
textStyle: { fontSize: 30 }
|
|
@@ -3750,7 +3762,7 @@ class ChartsComponent {
|
|
|
3750
3762
|
}
|
|
3751
3763
|
const alert = new DynamicComponentAlert({
|
|
3752
3764
|
type: 'warning',
|
|
3753
|
-
text: gettext('Truncated data. Change aggregation or select shorter date range.')
|
|
3765
|
+
text: this.translateService.instant(gettext('Truncated data. Change aggregation or select shorter date range.'))
|
|
3754
3766
|
});
|
|
3755
3767
|
this.alerts?.addAlerts(alert);
|
|
3756
3768
|
}
|