import * as i0 from '@angular/core'; import { OnInit, OnDestroy, EventEmitter, PipeTransform } from '@angular/core'; import { AbstractControl, ValidationErrors, FormGroup, FormControl, ControlValueAccessor, Validator, FormBuilder, FormArray } from '@angular/forms'; import { IIdentified, AlarmService, EventService, IAlarm, IEvent } from '@c8y/client'; import { KPIDetails } from '@c8y/ngx-components/datapoint-selector'; import * as i2 from '@angular/cdk/drag-drop'; import { CdkDragDrop } from '@angular/cdk/drag-drop'; import * as i1 from '@c8y/ngx-components'; import { ColorService, EmptyStateComponent, ContextRouteService } from '@c8y/ngx-components'; import { WidgetConfigComponent } from '@c8y/ngx-components/context-dashboard'; import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import * as i7 from '@angular/router'; import { ActivatedRoute } from '@angular/router'; import { Observable, BehaviorSubject } from 'rxjs'; import * as i5 from '@c8y/ngx-components/assets-navigator'; import { AssetSelectionChangeEvent } from '@c8y/ngx-components/assets-navigator'; import * as i3 from 'ngx-bootstrap/popover'; import * as i4 from 'ngx-bootstrap/tooltip'; import * as i6 from 'ngx-bootstrap/collapse'; type TimelineType = 'ALARM' | 'EVENT'; type AlarmOrEventBase = { timelineType: TimelineType; color: string; __active?: boolean; label: string; filters: { type: string; }; __target: IIdentified; }; type AlarmDetails = AlarmOrEventBase & { timelineType: 'ALARM'; filters: { type: string; }; selectedDatapoint?: SelectedDatapoint; }; type EventDetails = AlarmOrEventBase & { timelineType: 'EVENT'; filters: { type: string; }; selectedDatapoint?: SelectedDatapoint; }; type SelectedDatapoint = { target?: string; series?: string; fragment?: string; }; type AlarmOrEvent = AlarmDetails | EventDetails; type TimelineTypeTexts = { listTitle: string; emptyStateIcon: string; emptyStateTitle: string; emptyStateSubtitle: string; addButtonLabel: string; addCustomItemButtonLabel: string; selectorTitle: string; availableItemsTitle: string; assetWithNoItemsEmptyStateSubtitle: string; largeNumberOfItemsInfo: string; selectedItemsTitle: string; noSelectedItemsTitle: string; recentItemsWarningTitle: string; recentItemsWarningText: string; addCustomText: string; }; declare const EVENT_TEXTS: TimelineTypeTexts; declare const ALARM_TEXTS: TimelineTypeTexts; /** * The configuration for the alarms-events selector modal if some properties should be omitted. */ type OmitSelectorProperties = { color?: boolean; label?: boolean; }; declare class AlarmEventAttributesFormService { duplicateTypeValidator(selectedItems: AlarmOrEvent[]): (control: AbstractControl) => ValidationErrors | null; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } interface AlarmEventAttributeForm { filters: FormGroup<{ type: FormControl; }>; timelineType: FormControl; selectedDatapoint: FormControl; label?: FormControl; } declare class AlarmEventAttributesFormComponent implements ControlValueAccessor, Validator, OnInit { private formBuilder; private alarmEventAttributesFormService; timelineType: TimelineType; omitProperties: OmitSelectorProperties; selectedItems: AlarmOrEvent[]; target: IIdentified; datapoints: KPIDetails[]; formGroup: FormGroup; constructor(formBuilder: FormBuilder, alarmEventAttributesFormService: AlarmEventAttributesFormService); ngOnInit(): void; validate(_control: AbstractControl): ValidationErrors; writeValue(obj: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; changeDatapointSelection(event: Event): void; trackByFn(_index: number, item: KPIDetails): string; private filterKpis; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class AlarmEventSelectorModalComponent { private bsModal; selectType: TimelineType; contextAsset: IIdentified; allowChangingContext: boolean; allowSearch: boolean; selectedItems: AlarmOrEvent[]; title: string; groupsSelectable: boolean; hideSource: boolean; saveButtonLabel: string; omitProperties: OmitSelectorProperties; readonly result: Promise; private save; private cancel; constructor(bsModal: BsModalRef); saveChanges(): void; close(): void; selectionChange(selection: Array): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type AlarmEventSelectorModalOptions = Pick; /** * Service to open the alarm event selector modal. */ declare class AlarmEventSelectorModalService { private modal; constructor(modal: BsModalService); /** * Opents the alarm or event selector modal. * @param initialState Initial state of the modal. * @returns Promise that resolves with the selected alarms or events. */ selectItems(initialState?: Partial): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class AlarmEventSelectorService { private alarmService; private eventsService; private color; private timelineTypeTextsMap; constructor(alarmService: AlarmService, eventsService: EventService, color: ColorService); /** * This method returns the texts for the timeline type. * @param timelineType The timeline type. * @returns The texts for the timeline type. */ timelineTypeTexts(timelineType: TimelineType): TimelineTypeTexts; /** * This method returns all alarms or events of the platform based on the timeline type * @param timelineType The timeline type. * @returns The alarms or events of the asset. */ getItems(timelineType: TimelineType): Promise; /** * This method returns the items of the asset based on the timeline type. * @param parentReference The parent reference. * @param timelineType The timeline type. * @returns The alarms or events of the asset. */ getAlarmsOrEvents(parentReference: IIdentified, timelineType: TimelineType): Promise; getUniqueAlarmsOnly(data: IAlarm[]): Promise; getUniqueEventsOnly(data: IEvent[]): Promise; createItem(timelineType: 'ALARM' & TimelineType, item: IAlarm): Promise; createItem(timelineType: 'EVENT' & TimelineType, item: IEvent): Promise; private getAlarmsOfAsset; private getEventsOfAsset; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class AlarmEventSelectionListComponent implements ControlValueAccessor, Validator, OnInit, OnDestroy { private alarmEventModalService; private alarmEventSelectService; private formBuilder; private activatedRoute; private contextRouteService; private widgetComponent; /** * The type of timeline to be displayed. * Can be either 'ALARM' or 'EVENT'. */ timelineType: TimelineType; /** * Whether the user can remove items from the list. */ canRemove: boolean; /** * Whether the user can edit items in the alarm/event list. */ canEdit: boolean; canDragAndDrop: boolean; title: string; /** * The label for the button to add items to the list. * If not provided, a default label will be used based on the timeline type. */ addButtonLabel: string; /** * Hide or show the source of the alarm or event. */ hideSource: boolean; /** * Display the list inline or as a dropdown. * If set to true, the list will be displayed inline. */ inline: boolean; /** * Display the alarm/events as switch. If disabled it is displayed as checkbox instead. */ activeToggleAsSwitch: boolean; omitProperties: OmitSelectorProperties; datapoints: any[]; emptyState: EmptyStateComponent; /** * The configuration for the alarms-events selector modal. */ config: Partial; formArray: FormArray; timelineTypeTexts: TimelineTypeTexts; contextSourceId: number | string | null; private destroy$; constructor(alarmEventModalService: AlarmEventSelectorModalService, alarmEventSelectService: AlarmEventSelectorService, formBuilder: FormBuilder, activatedRoute: ActivatedRoute, contextRouteService: ContextRouteService, widgetComponent: WidgetConfigComponent); ngOnInit(): void; ngOnDestroy(): void; registerOnTouched(fn: any): void; validate(_control: AbstractControl): ValidationErrors; writeValue(val: AlarmOrEvent[]): void; registerOnChange(fn: any): void; add(): void; onItemRemoved(index: number): void; drop(event: CdkDragDrop): void; private transformValue; private initializeContextSourceId; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class AlarmEventSelectorListItemComponent implements OnInit, ControlValueAccessor, Validator, OnDestroy { private formBuilder; timelineType: TimelineType; datapoints: KPIDetails[] | undefined; highlightText: string; showAddRemoveButton: boolean; isSelected: boolean; optionToRemove: boolean; showActiveToggle: boolean; allowItemEdit: boolean; hideSource: boolean; displayAsSwitch: boolean; omitProperties: OmitSelectorProperties; colorPickerTitle: string; added: EventEmitter; removed: EventEmitter; formGroup: FormGroup; valid$: Observable; private destroy$; constructor(formBuilder: FormBuilder); ngOnInit(): void; ngOnDestroy(): void; toggleActive(): void; validate(_control: AbstractControl): ValidationErrors; writeValue(obj: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; addOrRemoveItem(): void; remove(): void; private transformFormValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class AlarmEventSelectorComponent implements OnInit { private alarmEventSelectorService; timelineType: TimelineType; contextAsset: IIdentified; allowChangingContext: boolean; selectedItems: AlarmOrEvent[]; allowSearch: boolean; groupsSelectable: boolean; hideSource: boolean; omitProperties: OmitSelectorProperties; selectionChange: EventEmitter; filterString: string; maxNumberOfItems: number; loadingItems$: BehaviorSubject; assetSelection: BehaviorSubject; items$: Observable; filteredItems$: Observable; filterStringChanges$: Observable; timelineTypeTexts: TimelineTypeTexts; isExpanded: boolean; defaultColor: string; private filterString$; constructor(alarmEventSelectorService: AlarmEventSelectorService); ngOnInit(): void; itemAdded(item: AlarmOrEvent): void; itemRemoved(alarm: AlarmOrEvent): void; assetSelectionChanged(evt: AssetSelectionChangeEvent): void; trackByFn(_index: number, item: AlarmOrEvent): string; filterStringChanged(newValue?: string): void; private setLoadingState; private setupObservables; private selectAsset; private emitCurrentSelection; private includesFilterString; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class IncludesAlarmOrEventPipe implements PipeTransform { transform(itemList: T[], item?: T): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class CustomAlarmEventFormComponent implements OnInit, OnDestroy { private formBuilder; timelineType: TimelineType; target: IIdentified; omitProperties: OmitSelectorProperties; selectedItems: AlarmOrEvent[]; defaultColor: string; added: EventEmitter; cancel: EventEmitter; formGroup: FormGroup; valid$: Observable; private destroy$; constructor(formBuilder: FormBuilder); ngOnInit(): void; ngOnDestroy(): void; add(): void; private transformFormValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class AlarmEventSelectorModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { ALARM_TEXTS, AlarmEventAttributesFormComponent, AlarmEventSelectionListComponent, AlarmEventSelectorComponent, AlarmEventSelectorListItemComponent, AlarmEventSelectorModalComponent, AlarmEventSelectorModalService, AlarmEventSelectorModule, AlarmEventSelectorService, CustomAlarmEventFormComponent, EVENT_TEXTS, IncludesAlarmOrEventPipe }; export type { AlarmDetails, AlarmEventSelectorModalOptions, AlarmOrEvent, EventDetails, OmitSelectorProperties, SelectedDatapoint, TimelineType, TimelineTypeTexts }; //# sourceMappingURL=index.d.ts.map