@c8y/ngx-components 1023.64.2 → 1023.65.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gettext } from '@c8y/ngx-components/gettext';
|
|
2
2
|
import { aggregationType } from '@c8y/client';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { computed, signal, Injectable, inject, input, forwardRef, ChangeDetectionStrategy, Component, DestroyRef, output, Input, ChangeDetectorRef, ViewChild, EventEmitter, viewChild, effect, HostListener, Output, TemplateRef, untracked, ContentChild, NgModule } from '@angular/core';
|
|
4
|
+
import { computed, signal, Injectable, inject, input, forwardRef, ChangeDetectionStrategy, Component, DestroyRef, output, Input, ChangeDetectorRef, ViewChild, EventEmitter, viewChild, effect, HostListener, Output, InjectionToken, TemplateRef, untracked, ContentChild, NgModule } from '@angular/core';
|
|
5
5
|
import * as i4 from '@c8y/ngx-components';
|
|
6
6
|
import { ViewContext, I18nModule, IconDirective, FormGroupComponent, MessagesComponent, MessageDirective, DateTimePickerModule, C8yTranslatePipe, DatePipe, TabsOutletComponent, FormsModule as FormsModule$1, CountdownIntervalModule, CountdownIntervalComponent, AlertService, ContextRouteService, DashboardChildComponent, hookActionBar } from '@c8y/ngx-components';
|
|
7
7
|
import { BehaviorSubject, map, distinctUntilChanged, shareReplay, fromEvent, filter, debounceTime, startWith, tap as tap$1, firstValueFrom, combineLatest, Subject, take, skip, throttleTime, merge as merge$1, EMPTY } from 'rxjs';
|
|
@@ -5446,6 +5446,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
5446
5446
|
args: [ConfigurationCollapseComponent, { static: false }]
|
|
5447
5447
|
}] } });
|
|
5448
5448
|
|
|
5449
|
+
/**
|
|
5450
|
+
* Injection token for registering custom dashboard paths where Global Context should be displayed.
|
|
5451
|
+
*
|
|
5452
|
+
* Use this token to enable Global Context on named dashboard routes that don't have a
|
|
5453
|
+
* `dashboardId` route parameter. Supports `multi: true` to allow multiple providers.
|
|
5454
|
+
*
|
|
5455
|
+
* @example
|
|
5456
|
+
* ```typescript
|
|
5457
|
+
* // In app.config.ts or module providers
|
|
5458
|
+
* providers: [
|
|
5459
|
+
* {
|
|
5460
|
+
* provide: GLOBAL_CONTEXT_DASHBOARD_PATHS,
|
|
5461
|
+
* useValue: ['dashboard/my-custom-dashboard', 'dashboard/another-dashboard'],
|
|
5462
|
+
* multi: true
|
|
5463
|
+
* }
|
|
5464
|
+
* ]
|
|
5465
|
+
* ```
|
|
5466
|
+
*/
|
|
5467
|
+
const GLOBAL_CONTEXT_DASHBOARD_PATHS = new InjectionToken('GLOBAL_CONTEXT_DASHBOARD_PATHS');
|
|
5449
5468
|
/**
|
|
5450
5469
|
* Constants defining the supported route paths for global context integration.
|
|
5451
5470
|
*/
|
|
@@ -5508,6 +5527,11 @@ class GlobalContextNavigationService {
|
|
|
5508
5527
|
this.contextRoute = inject(ContextRouteService);
|
|
5509
5528
|
/** Angular router for navigation state access */
|
|
5510
5529
|
this.router = inject(Router);
|
|
5530
|
+
/**
|
|
5531
|
+
* Custom dashboard paths registered via GLOBAL_CONTEXT_DASHBOARD_PATHS injection token.
|
|
5532
|
+
* Flattened from multi-provider array.
|
|
5533
|
+
*/
|
|
5534
|
+
this.registeredDashboardPaths = (inject(GLOBAL_CONTEXT_DASHBOARD_PATHS, { optional: true }) || []).flat();
|
|
5511
5535
|
/** Signal storing the current global context instance configuration */
|
|
5512
5536
|
this.instance = signal({
|
|
5513
5537
|
...DEFAULT_INSTANCE,
|
|
@@ -5665,7 +5689,10 @@ class GlobalContextNavigationService {
|
|
|
5665
5689
|
/**
|
|
5666
5690
|
* Handles navigation to dashboard routes.
|
|
5667
5691
|
*
|
|
5668
|
-
* Dashboard routes display global context
|
|
5692
|
+
* Dashboard routes display global context if:
|
|
5693
|
+
* - A valid dashboard ID exists in route params, OR
|
|
5694
|
+
* - The route path is registered via GLOBAL_CONTEXT_DASHBOARD_PATHS token
|
|
5695
|
+
*
|
|
5669
5696
|
* Manages query parameter cleanup during dashboard transitions.
|
|
5670
5697
|
*
|
|
5671
5698
|
* @param activeRoute - The active route containing dashboard parameters
|
|
@@ -5673,16 +5700,20 @@ class GlobalContextNavigationService {
|
|
|
5673
5700
|
*/
|
|
5674
5701
|
handleDashboard(activeRoute) {
|
|
5675
5702
|
const dashboardId = this.extractDashboardId(activeRoute);
|
|
5676
|
-
|
|
5703
|
+
// For named dashboards without dashboardId, check if path is registered
|
|
5704
|
+
const routePath = this.extractRoutePath(activeRoute);
|
|
5705
|
+
const isRegisteredPath = this.isRegisteredDashboardPath(routePath);
|
|
5706
|
+
const effectiveId = dashboardId || (isRegisteredPath ? routePath : undefined);
|
|
5707
|
+
if (!effectiveId) {
|
|
5677
5708
|
return null;
|
|
5678
5709
|
}
|
|
5679
5710
|
const current = this.getInstance();
|
|
5680
5711
|
// Return existing instance if same dashboard
|
|
5681
|
-
if (current.source === ROUTE_PATHS.DASHBOARD && current.sourceId ===
|
|
5712
|
+
if (current.source === ROUTE_PATHS.DASHBOARD && current.sourceId === effectiveId) {
|
|
5682
5713
|
return current.actionBarItem;
|
|
5683
5714
|
}
|
|
5684
5715
|
// We're changing contexts if coming from a different dashboard
|
|
5685
|
-
const isChangingContext = current.source === ROUTE_PATHS.DASHBOARD && current.sourceId !==
|
|
5716
|
+
const isChangingContext = current.source === ROUTE_PATHS.DASHBOARD && current.sourceId !== effectiveId;
|
|
5686
5717
|
this.handleQueryParamCleanup(isChangingContext);
|
|
5687
5718
|
// Create new dashboard instance
|
|
5688
5719
|
const dashboardInstance = {
|
|
@@ -5691,7 +5722,7 @@ class GlobalContextNavigationService {
|
|
|
5691
5722
|
placement: 'left'
|
|
5692
5723
|
},
|
|
5693
5724
|
source: ROUTE_PATHS.DASHBOARD,
|
|
5694
|
-
sourceId:
|
|
5725
|
+
sourceId: effectiveId
|
|
5695
5726
|
};
|
|
5696
5727
|
this.instance.set(dashboardInstance);
|
|
5697
5728
|
return this.getInstance().actionBarItem;
|
|
@@ -5740,6 +5771,31 @@ class GlobalContextNavigationService {
|
|
|
5740
5771
|
const dashboardId = activeRoute?.snapshot?.params?.['dashboardId'];
|
|
5741
5772
|
return dashboardId && typeof dashboardId === 'string' ? dashboardId : undefined;
|
|
5742
5773
|
}
|
|
5774
|
+
/**
|
|
5775
|
+
* Extracts the full route path from URL segments.
|
|
5776
|
+
*
|
|
5777
|
+
* @param activeRoute - The route to extract path from
|
|
5778
|
+
* @returns Full route path (e.g., 'dashboard/my-dashboard') or undefined
|
|
5779
|
+
*/
|
|
5780
|
+
extractRoutePath(activeRoute) {
|
|
5781
|
+
const segments = activeRoute?.snapshot?.url || [];
|
|
5782
|
+
if (segments.length === 0) {
|
|
5783
|
+
return undefined;
|
|
5784
|
+
}
|
|
5785
|
+
return segments.map(s => s.path).join('/');
|
|
5786
|
+
}
|
|
5787
|
+
/**
|
|
5788
|
+
* Checks if a route path is registered as a custom dashboard path.
|
|
5789
|
+
*
|
|
5790
|
+
* @param routePath - The route path to check
|
|
5791
|
+
* @returns True if the path is registered via GLOBAL_CONTEXT_DASHBOARD_PATHS
|
|
5792
|
+
*/
|
|
5793
|
+
isRegisteredDashboardPath(routePath) {
|
|
5794
|
+
if (!routePath || this.registeredDashboardPaths.length === 0) {
|
|
5795
|
+
return false;
|
|
5796
|
+
}
|
|
5797
|
+
return this.registeredDashboardPaths.some(registeredPath => routePath === registeredPath || routePath.startsWith(registeredPath + '/'));
|
|
5798
|
+
}
|
|
5743
5799
|
/**
|
|
5744
5800
|
* Extracts device ID from route parameters.
|
|
5745
5801
|
*
|
|
@@ -11853,5 +11909,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
11853
11909
|
* Generated bundle index. Do not edit.
|
|
11854
11910
|
*/
|
|
11855
11911
|
|
|
11856
|
-
export { AGGREGATIONS, AGGREGATION_ICONS, AGGREGATION_ICON_TYPE, AGGREGATION_LABELS, AGGREGATION_LIMITS, AGGREGATION_TEXTS, AGGREGATION_VALUES, AGGREGATION_VALUES_ARR, AggregationDisplayComponent, AggregationPickerComponent, AggregationPickerService, AggregationValidationService, AutoRefreshControlComponent, CONTEXT_FEATURE, CONTROL_PRESETS, ConfigContextSelectorComponent, ConfigModeControls, ConfigModeControls as ConfigModeControlsComponent, ConfigurationCollapseComponent, ConfigurationControlsComponent, ContextControlsComponent$1 as ContextControlsComponent, DEFAULT_WIDGET_TEMPLATE, DateContextQueryParamNames, DateTimeContextPickerComponent, DateTimeContextPickerService, GLOBAL_CONTEXT_DEFAULTS, GLOBAL_CONTEXT_DISPLAY_MODE, GLOBAL_CONTEXT_EVENTS, GLOBAL_CONTEXT_SOURCE, GlobalContextComponent, GlobalContextConfigComponent, GlobalContextConnectorComponent, GlobalContextEventService, GlobalContextFormService, GlobalContextInlineComponent, GlobalContextLinkControlsComponent, GlobalContextModule, GlobalContextNavigationService, GlobalContextQueryService, GlobalContextService, GlobalContextUtilsService, GlobalContextValidationService, GlobalContextWidgetConfigComponent, GlobalContextWidgetWrapperComponent, HistoryModeConfigurationControlsComponent, INTERVALS, INTERVAL_TITLES, IntervalPickerComponent, LINK_BTNS_CONFIG, LinkButtonsComponent, LiveModeConfigurationControlsComponent, LocalControlsComponent, PRESET_NAME, PreviewControlsComponent, REFRESH_OPTION, ROUTE_PATHS, RealtimeControlComponent, TIME_DURATION, TIME_INTERVAL, TIME_SPAN_MS, TIMING, TimeRangeDisplayComponent, UI_PRIORITIES, WIDGET_DISPLAY_MODE, WIDGET_FEATURE_MAP, WidgetConfigMigrationService, WidgetControlService, applyModeConstraints, buildAggregationExtensions, buildBaselineControls, buildWidgetControlsFromPresets, controlsToSettings, createAutoRefreshHandlers, createResult, defineWidgetControls, getSupportedModes, guards, isAggregationLinked, isAggregationUnlinked, isAutoRefreshDisabled, isAutoRefreshEnabled, isConfig, isDashboard, isDateTimeContextLinked, isDateTimeContextUnlinked, isHistory, isLive, isViewAndConfig, mergePartialControls, resolveWidgetControlsInput, setAutoRefreshControlsVisibility, setAutoRefreshLinks, updateBothSettings };
|
|
11912
|
+
export { AGGREGATIONS, AGGREGATION_ICONS, AGGREGATION_ICON_TYPE, AGGREGATION_LABELS, AGGREGATION_LIMITS, AGGREGATION_TEXTS, AGGREGATION_VALUES, AGGREGATION_VALUES_ARR, AggregationDisplayComponent, AggregationPickerComponent, AggregationPickerService, AggregationValidationService, AutoRefreshControlComponent, CONTEXT_FEATURE, CONTROL_PRESETS, ConfigContextSelectorComponent, ConfigModeControls, ConfigModeControls as ConfigModeControlsComponent, ConfigurationCollapseComponent, ConfigurationControlsComponent, ContextControlsComponent$1 as ContextControlsComponent, DEFAULT_WIDGET_TEMPLATE, DateContextQueryParamNames, DateTimeContextPickerComponent, DateTimeContextPickerService, GLOBAL_CONTEXT_DASHBOARD_PATHS, GLOBAL_CONTEXT_DEFAULTS, GLOBAL_CONTEXT_DISPLAY_MODE, GLOBAL_CONTEXT_EVENTS, GLOBAL_CONTEXT_SOURCE, GlobalContextComponent, GlobalContextConfigComponent, GlobalContextConnectorComponent, GlobalContextEventService, GlobalContextFormService, GlobalContextInlineComponent, GlobalContextLinkControlsComponent, GlobalContextModule, GlobalContextNavigationService, GlobalContextQueryService, GlobalContextService, GlobalContextUtilsService, GlobalContextValidationService, GlobalContextWidgetConfigComponent, GlobalContextWidgetWrapperComponent, HistoryModeConfigurationControlsComponent, INTERVALS, INTERVAL_TITLES, IntervalPickerComponent, LINK_BTNS_CONFIG, LinkButtonsComponent, LiveModeConfigurationControlsComponent, LocalControlsComponent, PRESET_NAME, PreviewControlsComponent, REFRESH_OPTION, ROUTE_PATHS, RealtimeControlComponent, TIME_DURATION, TIME_INTERVAL, TIME_SPAN_MS, TIMING, TimeRangeDisplayComponent, UI_PRIORITIES, WIDGET_DISPLAY_MODE, WIDGET_FEATURE_MAP, WidgetConfigMigrationService, WidgetControlService, applyModeConstraints, buildAggregationExtensions, buildBaselineControls, buildWidgetControlsFromPresets, controlsToSettings, createAutoRefreshHandlers, createResult, defineWidgetControls, getSupportedModes, guards, isAggregationLinked, isAggregationUnlinked, isAutoRefreshDisabled, isAutoRefreshEnabled, isConfig, isDashboard, isDateTimeContextLinked, isDateTimeContextUnlinked, isHistory, isLive, isViewAndConfig, mergePartialControls, resolveWidgetControlsInput, setAutoRefreshControlsVisibility, setAutoRefreshLinks, updateBothSettings };
|
|
11857
11913
|
//# sourceMappingURL=c8y-ngx-components-global-context.mjs.map
|