@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
171 lines • 8.98 kB
TypeScript
import { OnDestroy, OnInit, Renderer2 } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ActionBarService, AlertService, BottomDrawerService, BreadcrumbItem, DashboardChange, DashboardChildChange, DashboardCopyPermission, DynamicComponentDefinition, GainsightService, ModalService, RevertChangeType, Widget, WidgetChange, WidgetsDashboardComponent } from '@c8y/ngx-components';
import { TranslateService } from '@ngx-translate/core';
import { CanDeactivateComponent, ContextDashboard, ContextDashboardConfig, ContextDashboardManagedObject, DashboardChildrenState, DashboardHistoryDescription } from './context-dashboard.model';
import { ContextDashboardService } from './context-dashboard.service';
import { DashboardDetailComponent } from './dashboard-detail.component';
import { DashboardEditModeService } from './memento/dashboard-edit-mode.service';
import { WidgetService } from './widget.service';
import * as i0 from "@angular/core";
/**
* The context dashboard is a dashboard which resolves it data from the current context (device or group)
* it is displayed on. It usually uses the route.data for it, but you can pass
* a different managedObject to the [mo] input parameter to change that behavior.
*/
export declare class ContextDashboardComponent implements OnInit, OnDestroy, CanDeactivateComponent {
private route;
private router;
private contextDashboardService;
private alert;
private renderer;
moduleConfig: ContextDashboardConfig;
private widgetService;
private bottomDrawerService;
private gainsightService;
private actionBarService;
private translateService;
private modal;
editModeService: DashboardEditModeService;
name: string;
childrenClasses: string;
context: any;
setTitle: boolean;
defaultWidgets: Widget[];
_canCopy: boolean;
canDelete: boolean;
isLoading: boolean;
breadcrumbSettings: BreadcrumbItem;
showContextHelpButton: boolean;
/** Whether to translate widget titles. However, dashboard's own setting takes precedence. It does not override dashboard's setting */
translateWidgetTitle: boolean;
/**
* Hides dashboard availability selection.
*/
hideAvailability: boolean;
class: string;
dashboardDetails: DashboardDetailComponent;
widgetsDashboard: WidgetsDashboardComponent;
isNamedDashboard: boolean;
get disabled(): boolean;
widgets: Widget[];
mo: ContextDashboardManagedObject;
dashboard: ContextDashboard;
title: string;
isCopyDisabled: DashboardCopyPermission;
isReport: boolean;
canCopy: boolean;
readonly dashboardTypeLabel: "Dashboard for \"{{ dashboardType }}\"";
readonly dashboardTypePopover: "\n The layout and configuration of this dashboard is used by all other assets of model type\n <strong>{{ dashboardType }}</strong>. Any changes made to this dashboard instance will be applied to all\n other instances.";
private dataSub;
private hasPermissionToEditDashboard;
private destroy$;
constructor(route: ActivatedRoute, router: Router, contextDashboardService: ContextDashboardService, alert: AlertService, renderer: Renderer2, moduleConfig: ContextDashboardConfig, widgetService: WidgetService, bottomDrawerService: BottomDrawerService, gainsightService: GainsightService, actionBarService: ActionBarService, translateService: TranslateService, modal: ModalService, editModeService: DashboardEditModeService);
ngOnInit(): void;
beforeUnloadHandler($event: BeforeUnloadEvent): Promise<void>;
/**
* Applies the current context to the widget
* @param widget The widget to apply the context to.
*/
applyDeviceTarget(widget: any): void;
/**
* Removes the route listener.
*/
ngOnDestroy(): void;
/**
* Guards component from unintended navigation away or closing tab without saving changes.
* Navigation continues if true is returned, and navigation is cancelled if returned value is false.
* @param omitConfirm Omits confirm calls inside method body (without this param, when method is used in
* on 'beforeunload' event handler, error is thrown in console because confirm is blocked by browser anyway and returns false)
*/
canDeactivate(omitConfirm?: boolean): Promise<boolean>;
/**
* Restores the dashboard widgets to the default widgets.
*/
restore(): Promise<void>;
/**
* Method called on every widgets dimensions or position change but also for adding new widget (because adding
* widget causes layout changes). It recognizes what type of change has been done and updates current widgets state
* accordingly.
* @param child Change object.
*/
positionOrWidgetDimensionChange(child: DashboardChildChange | DashboardChange): void;
revertChange(revertType: RevertChangeType): Promise<void>;
/**
* Updates all dashboards children's. Useful for position changes on the dashboard.
* @param child The child to change.
* @param changeName Name of the change to indicate it on undo/redo button.
* @param descriptionProp Property to add to dashboard change history.
* @param widgetsChanged List of changed widgets.
*/
updateDashboardChildren(child: DashboardChildChange | DashboardChange, changeName: DashboardChildrenState['name'], descriptionProp: keyof DashboardHistoryDescription['widgetChanges'], widgetsChanged: Widget[]): void;
/**
* Copies the dashboard and current context to a clipboard.
*/
copyDashboard(): Promise<void>;
editDashboard(): void;
/**
* Remove the complete dashboard and navigate away.
*/
deleteDashboard(): Promise<void>;
get isDeviceTypeDashboard(): boolean;
/**
* Edits a widget on the dashboard.
* @param change The widget change event.
*/
editWidget(change: WidgetChange): Promise<void>;
/**
* Adds a widget to the dashboard.
* @param selected Define a selected component to switch to edit mode directly.
*/
addWidget(selected?: DynamicComponentDefinition): Promise<void>;
saveWidgetsToDashboard(): Promise<void>;
cancelEditMode(onDeactivate?: boolean): Promise<void>;
/**
* Updates a widget or adds a new one if it doesn't exist on
* the dashboard.
* @param widget The new widget
*/
updateWidget(widget: any): Promise<void>;
/**
* Removes a widget and rearranges the remaining ones
* if necessary.
* @param change The change event.
*/
deleteWidget(change: WidgetChange): Promise<void>;
/**
* This is a workaround to ensure that the dragged-element
* (which is attached to the body) has the right styling.
*/
addDashboardClassToBody(): void;
/**
* This is a workaround to ensure that the dragged-element
* (which is attached to the body) has the right styling.
*/
removeDashboardClassFromBody(): void;
onLoad(trackExperience?: boolean): Promise<void>;
dashboardPreview(layoutChanges: ContextDashboard): Promise<void>;
reloadDashboard(dashboardMo: ContextDashboardManagedObject): Promise<void>;
private setWidgets;
private loadContextDashboard;
/**
* To enable translation for widgets within the dashboard, the "translateWidgetTitle" flag must be enabled.
* The property needs to be patched, as the "Sensor App" does not provide this setting.
*/
private patchSensorPhoneDashboard;
private loadNamedDashboard;
private mergeWidgetClasses;
private componentToWidget;
private addReportDashboardSettings;
private getDashboardCopyPermissionState;
private setNewState;
private getDescriptionForNewState;
private mapStateToHistoryDescription;
private onDeleteGSEvent;
private onLoadGSEvent;
private extractDefaultDashboardName;
private convertStringToHash;
static ɵfac: i0.ɵɵFactoryDeclaration<ContextDashboardComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ContextDashboardComponent, "c8y-context-dashboard", never, { "name": { "alias": "name"; "required": false; }; "childrenClasses": { "alias": "childrenClasses"; "required": false; }; "context": { "alias": "context"; "required": false; }; "setTitle": { "alias": "setTitle"; "required": false; }; "defaultWidgets": { "alias": "defaultWidgets"; "required": false; }; "_canCopy": { "alias": "canCopy"; "required": false; }; "canDelete": { "alias": "canDelete"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "breadcrumbSettings": { "alias": "breadcrumbSettings"; "required": false; }; "showContextHelpButton": { "alias": "showContextHelpButton"; "required": false; }; "translateWidgetTitle": { "alias": "translateWidgetTitle"; "required": false; }; "hideAvailability": { "alias": "hideAvailability"; "required": false; }; }, {}, never, never, true, never>;
}
//# sourceMappingURL=context-dashboard.component.d.ts.map