UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

118 lines 5.12 kB
import { AfterViewInit, EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { FormBuilder } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { aggregationType } from '@c8y/client'; import { BsDropdownDirective } from 'ngx-bootstrap/dropdown'; import { ActionBarService } from '../../action-bar'; import { AggregationService } from '../../aggregation/aggregation.service'; import { DashboardChildActionComponent } from '../dashboard-child-action.component'; import { DashboardChildComponent } from '../dashboard-child.component'; import { WidgetsDashboardEventService } from '../widgets-dashboard-event.service'; import { WidgetTimeContextHelperService } from './widget-time-context-helper.service'; import { WidgetTimeContextQueryService } from './widget-time-context-query.service'; import { WidgetDisplaySettings } from './widget-time-context.model'; import { Interval } from '@c8y/ngx-components/interval-picker'; import { WidgetTimeContextDateRangeService } from './widget-time-context-date-range.service'; import * as i0 from "@angular/core"; export declare class WidgetTimeContextComponent implements OnInit, OnDestroy, AfterViewInit { private widgetEventService; private dashboardChild; private formBuilder; private queryService; private helperService; private router; private actionBarService; private aggregationService; private route; private widgetTimeContextDateRangeService; readonly INTERVAL_TITLES: Record<"custom" | "hours" | "minutes" | "days" | "weeks" | "months", string>; readonly DATE_FORMAT = "short"; /** * Indicates if the component can decouple or not. */ canDecouple: boolean; displaySettings: WidgetDisplaySettings; hidden: boolean; /** * Emits each change as an array of dates [from, to]. */ dateContextChange: EventEmitter<any>; /** * @ignore */ action: DashboardChildActionComponent; dropdown: BsDropdownDirective; /** * Indicates if the time context is bound to the global scope. */ isCoupled: boolean; decoupleTimeContextLabel: "Decouple time context"; coupleTimeContextLabel: "Couple time context"; form: ReturnType<WidgetTimeContextComponent['createForm']>; actionBarInGroupPriority: number; disabledAggregations: Partial<Record<aggregationType, boolean>>; isAutoRefreshEnabled: boolean; readonly DEFAULT_INTERVAL: Interval['id']; readonly ACTION_BAR_PRIORITY = 7; readonly ACTION_BAR_GROUP_ID = "timecontext"; readonly REALTIME_INTERVAL = 1000; private subscription; private destroy$; private navigationInProgress; private realtimeSubscription; /** * @ignore only DI. */ constructor(widgetEventService: WidgetsDashboardEventService, dashboardChild: DashboardChildComponent, formBuilder: FormBuilder, queryService: WidgetTimeContextQueryService, helperService: WidgetTimeContextHelperService, router: Router, actionBarService: ActionBarService, aggregationService: AggregationService, route: ActivatedRoute, widgetTimeContextDateRangeService: WidgetTimeContextDateRangeService); /** * @ignore Subscribing to the global context. */ ngOnInit(): void; /** * @ignore Adding custom actions. */ ngAfterViewInit(): void; /** * Toggles the coupling on or off. */ toggleDecoupling(): void; /** * Applies form value to global or local date context. */ applyDatetimeContext(): void; /** * Resets form to initial value and update context. */ reset(): void; /** * @ignore unsubscribing. */ ngOnDestroy(): void; private subscribeToIntervalChange; private subscribeToRealtimeChange; private subscribeToAggregationChange; private createForm; /** * Fires a new WidgetChangeEvent either on the local change emitter or on the global one. * @param widgetTimeContextState New widget time context value.*/ private update; private subscribeToGlobalContext; private updateFormValues; private unsubscribeFromGlobalContext; private getInitialContext; private subscribeToQueryParamsChange; private clearQueryParamsIfNeeded; private subscribeToRouterEvents; private getDefaultContext; private startRealtime; private handleAutoRefreshChange; private onDisableAutoRefresh; private disableDateRangeAndAggregation; private enableDateRangeAndAggregation; private stopRealtime; private onRealtimeValueChange; private calculateAggregation; static ɵfac: i0.ɵɵFactoryDeclaration<WidgetTimeContextComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<WidgetTimeContextComponent, "c8y-widget-time-context", never, { "canDecouple": { "alias": "canDecouple"; "required": false; }; "displaySettings": { "alias": "displaySettings"; "required": false; }; "hidden": { "alias": "hidden"; "required": false; }; }, { "dateContextChange": "dateContextChange"; }, never, never, true, never>; } //# sourceMappingURL=widget-time-context.component.d.ts.map