import * as i0 from '@angular/core'; import { OnInit, ElementRef, EventEmitter, OnChanges, SimpleChanges, PipeTransform, AfterViewInit } from '@angular/core'; import * as i1 from '@c8y/ngx-components/assets-navigator'; import { MillerViewComponent } from '@c8y/ngx-components/assets-navigator'; import * as i2 from 'ngx-bootstrap/collapse'; import * as i3 from '@c8y/ngx-components'; import { AppStateService, ColorService, ListItemDragHandleComponent, ForOfFilterPipe } from '@c8y/ngx-components'; import * as i4 from 'ngx-bootstrap/dropdown'; import * as i5 from 'ngx-bootstrap/modal'; import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import * as i6 from 'ngx-bootstrap/tooltip'; import * as i7 from 'ngx-bootstrap/popover'; import * as i8 from '@angular/cdk/drag-drop'; import { CdkDragDrop } from '@angular/cdk/drag-drop'; import { ControlValueAccessor, Validator, FormGroup, FormBuilder, AbstractControl, ValidationErrors, FormArray, ValidatorFn } from '@angular/forms'; import { IIdentified, IManagedObject, InventoryService, MeasurementService, IResultList } from '@c8y/client'; import { BehaviorSubject, Observable } from 'rxjs'; import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons'; import { WidgetConfigComponent } from '@c8y/ngx-components/context-dashboard'; declare const AXIS_TYPES: readonly [{ readonly val: any; readonly text: "Auto"; }, { readonly val: "left"; readonly text: "Left"; }, { readonly val: "right"; readonly text: "Right"; }]; type AxisTypes = (typeof AXIS_TYPES)[1 | 2]['val']; declare const CHART_LINE_TYPES: readonly [{ readonly val: "line"; readonly text: "Line"; }, { readonly val: "points"; readonly text: "Points"; }, { readonly val: "linePoints"; readonly text: "Line and points"; }, { readonly val: "bars"; readonly text: "Bars"; }, { readonly val: "step-before"; readonly text: "Step before"; }, { readonly val: "step-after"; readonly text: "Step after"; }]; type ChartLineTypes = (typeof CHART_LINE_TYPES)[number]['val']; declare const CHART_RENDER_TYPES: readonly [{ readonly val: "min"; readonly text: "Minimum"; }, { readonly val: "max"; readonly text: "Maximum"; }, { readonly val: "area"; readonly text: "Minimum and maximum"; }, { readonly val: "avg"; readonly text: "Average"; }, { readonly val: "count"; readonly text: "Count"; }, { readonly val: "sum"; readonly text: "Sum"; }]; type ChartRenderTypes = (typeof CHART_RENDER_TYPES)[number]['val']; declare const DATAPOINT_LIBRARY_FRAGMENT = "c8y_Kpi"; interface KPIDetails { fragment: string; series: string; orientation?: string | null; __target?: IIdentified | null; __active?: boolean | null; __template?: string | null | number; unit?: string | null; min?: number | null; color?: string | null; max?: number | null; label?: string | null; target?: number | null; yellowRangeMax?: number | null; yellowRangeMin?: number | null; redRangeMin?: number | null; redRangeMax?: number | null; description?: string | null; renderType?: string | null; lineType?: string | null; yAxisType?: string | null; [key: string]: any; } interface ManagedObjectKPI extends IManagedObject { [DATAPOINT_LIBRARY_FRAGMENT]: KPIDetails; } interface DatapointAction { label: string; callback: (datapoint: KPIDetails) => void; icon: SupportedIconsSuggestions; } interface DatapointAttributesFormConfig { showAdvancedChartOptions: boolean; showTarget: boolean; showRange: boolean; showYellowRange: boolean; showRedRange: boolean; showChart: boolean; showFormIfTemplateWasSelected: boolean; selectableChartRenderTypes: ChartRenderTypes[]; selectableChartLineTypes: ChartLineTypes[]; selectableAxisTypes: AxisTypes[]; } type DatapointSelectorModalAssetSelectorOptions = Omit; declare class DatapointLibraryService { private inventory; private appState; private measurements; private color; protected cache: Promise; constructor(inventory: InventoryService, appState: AppStateService, measurements: MeasurementService, color: ColorService); getAllDatapointLibraryEntriesCached(forceCacheRenew?: boolean): Promise; getFirstDatapointLibraryPage(): Promise>; getAllDatapointLibraryItemsCached(): Promise; updateDatapoints(datapoints: KPIDetails[], skipUpdatingTarget?: boolean): Promise; getDatapointsOfAsset(parentReference: IIdentified, ignoreDatapointTemplates?: boolean, datapointTemplatesOnly?: boolean): Promise; /** * Requests the last measurement with the given fragment and series to extract it's unit. * If the source attribute is provided, it will check the last measurement for this specific source. * @returns found unit or an empty string instead */ guessUnitOfDatapoint(fragment: string, series: string, source?: IIdentified): Promise; protected combineFragmentSeriesTuplesWithDetails(tuples: Array<{ fragment: string; series: string; }>, target: IIdentified, kpis: ManagedObjectKPI[], datapointTemplatesOnly?: boolean): Promise; protected assignColorToDatapoints(datapoints: KPIDetails[]): Promise; protected getAllDatapointLibraryEntries(): Promise; protected mapDatapointLibraryEntry(entry: ManagedObjectKPI): KPIDetails; protected getCurrentTemplatesFromDatapoints(datapoints: KPIDetails[]): Promise; protected getCurrentVersionOfTargetsFromDatapoints(datapoints: KPIDetails[]): Promise; protected getMOsByIds(ids: Array): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class DatapointSelectorComponent implements OnInit, ControlValueAccessor { private datapointService; contextAsset: IIdentified; allowChangingContext: boolean; allowDatapointsFromMultipleAssets: boolean; selectedDatapoints: KPIDetails[]; defaultActiveState: boolean; ignoreDatapointTemplates: boolean; datapointTemplatesOnly: boolean; guessDatapointUnit: boolean; allowSearch: boolean; hideSelection: boolean; itemsEditable: boolean; searchString: string; maxNumberOfDatapoints: number; selectorTitle: string; emptyStateTitle: string; selectedListTitle: string; AddButtonTypes: { readonly none: "none"; readonly addRemove: "add-remove"; readonly select: "select"; }; loadingDatapoints: boolean; assetSelection: BehaviorSubject; datapoints$: Observable; filteredDatapoints$: Observable; searchStringChanges$: Observable; datapointLibraryEntries: Observable>; emptyStateSubtitleWhenNoMatchingDataPoints: "Try another search term."; emptyStateSubtitleWhenNoDataPointsInAsset: "Select an asset with data points from the list."; private searchString$; private touched; private onChange; private onTouched; constructor(datapointService: DatapointLibraryService); ngOnInit(): void; writeValue(obj: KPIDetails[]): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; datapointAdded(dp: KPIDetails): void; datapointRemoved(dp: KPIDetails): void; selectionChanged(evt: IIdentified | IIdentified[]): void; trackByFn(_index: number, item: KPIDetails): string; searchStringChanged(newValue?: string): void; private setupObservables; private selectAsset; private clearSelection; private emitCurrentSelection; private markAsTouched; private includesSearchString; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DatapointSelectorModalComponent implements OnInit { private bsModal; private elementRef; contextAsset: IIdentified; allowChangingContext: boolean; allowSearch: boolean; allowDatapointsFromMultipleAssets: boolean; selectedDatapoints: KPIDetails[]; title: string; saveButtonLabel: string; guessDatapointUnit: boolean; defaultActiveState: boolean; finishWithFirstSelection: boolean; ignoreDatapointTemplates: boolean; itemsEditable: boolean; datapointTemplatesOnly: boolean; assetSelectorConfig: Partial; readonly result: Promise; private save; private cancel; constructor(bsModal: BsModalRef, elementRef: ElementRef); ngOnInit(): void; saveChanges(): void; close(): void; selectionChange(selection: Array): void; /** * changes the z-index of the modal, to make sure this modal is on top. * required as angularJS modals are placing them selves on top via adjusting z-index. * while angular modals use the order within the dom for this.. */ private applyWorkaroundForAngularJSModalsThatMightBeOpenedInParallel; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const AddButtonTypes: { readonly none: "none"; readonly addRemove: "add-remove"; readonly select: "select"; }; type AddButtonType = (typeof AddButtonTypes)[keyof typeof AddButtonTypes]; declare class DatapointSelectorListItemComponent implements ControlValueAccessor, Validator { private formBuilder; formGroup: FormGroup; defaultFormOptions: Partial; isSelected: boolean; isCollapsed: boolean; addButtonType: AddButtonType; editable: boolean; showActiveToggle: boolean; activeToggleDisabled: boolean; showOptions: boolean; datapointLibraryEntries: Observable>; actions: DatapointAction[]; optionToRemove: boolean; hasUnlinkTemplateOption: boolean; added: EventEmitter; removed: EventEmitter; colorPickerDisabled: boolean; disableTypeaheadIfSelected: boolean; highlightText: string; dragHandle: ListItemDragHandleComponent; pattern: string; filterPipe: ForOfFilterPipe; isValid$: Observable; errorMessage: string; AddButtonTypes: { readonly none: "none"; readonly addRemove: "add-remove"; readonly select: "select"; }; constructor(formBuilder: FormBuilder); validate(_control: AbstractControl): ValidationErrors; writeValue(obj: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; collapse(): void; addOrRemoveItem(): void; remove(): void; setPipe(filterStr: string): void; unlinkDatapointTemplate(): void; dataPointTemplateSelected(template: ManagedObjectKPI): void; private resetUnusedProperties; private filterDatapointLabel; private transformFormValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type DatapointSelectorModalOptions = Omit; declare class DatapointSelectorService { protected modal: BsModalService; constructor(modal: BsModalService); selectDataPoints(initialState?: Partial): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class DatapointSelectionListComponent implements ControlValueAccessor, Validator, OnInit, OnChanges { private datapointSelector; private datapointLibrary; private formBuilder; private widgetComponent; actions: DatapointAction[]; /** * Enable or disable drag and drop functionality. */ allowDragAndDrop: boolean; config: Partial; defaultFormOptions: Partial; /** * Maximum number of active datapoints allowed in the list. */ maxActiveCount: number; /** * Minimum number of active datapoints required in the list. */ minActiveCount: number; resolveContext: boolean; listTitle: string; formArray: FormArray; datapointLibraryEntries: Observable>; maxActiveCountReached: boolean; AddButtonTypes: { readonly none: "none"; readonly addRemove: "add-remove"; readonly select: "select"; }; isValid: Observable; change: Observable; private usedValidators; constructor(datapointSelector: DatapointSelectorService, datapointLibrary: DatapointLibraryService, formBuilder: FormBuilder, widgetComponent: WidgetConfigComponent); ngOnChanges(changes: SimpleChanges): void; registerOnTouched(fn: any): void; validate(_control: AbstractControl): ValidationErrors; ngOnInit(): void; writeValue(obj: KPIDetails[]): void; registerOnChange(fn: any): void; add(): void; onItemRemoved(index: number): void; drop(event: CdkDragDrop): void; private transformValue; private calculateMaxActiveCount; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DatapointTemplatePopoverComponent { datapoint: KPIDetails; attributes: Array<{ label: string; labelColor?: string; key: keyof KPIDetails; }>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class IncludesDatapointPipe implements PipeTransform { transform(datapointList: KPIDetails[], datapoint?: KPIDetails): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class DatapointLabelPipe implements PipeTransform { transform(datapoint: KPIDetails, options?: { includeDevice: boolean; doNotUseLabel: boolean; }): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class FilterDatapointsPipe implements PipeTransform { transform(datapoints: KPIDetails[], searchString: string): KPIDetails[]; private includesSearchStringIgnoringCasing; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class DatapointAttributesFormValidationService { private formBuilder; constructor(formBuilder: FormBuilder); getDefaultFormGroup(fieldsToRemove?: string[]): FormGroup; convertToBackendFormat(formDataStructure: any, showChart: boolean): {}; convertToFormGroupFormat(backendDataStructure: any): {}; getColorValidators(): ValidatorFn[]; getLabelValidators(): ValidatorFn[]; getDescriptionValidators(): ValidatorFn[]; getFragmentValidators(): ValidatorFn[]; getSeriesValidators(): ValidatorFn[]; getMinMaxValidators(): ValidatorFn[]; getUnitValidators(): ValidatorFn[]; getTargetValidators(): ValidatorFn[]; getOverallValidators(): ValidatorFn[]; getMinMaxFormGroup(): FormGroup; getChartFormGroup(): FormGroup; getDisplayFormGroup(): FormGroup; getTargetFormGroup(): FormGroup; private convertStringToNumber; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class DatapointAttributesFormComponent implements ControlValueAccessor, Validator, OnInit, AfterViewInit { private formValidations; selectableChartRenderTypes: ChartRenderTypes[]; selectableChartLineTypes: ChartLineTypes[]; selectableAxisTypes: AxisTypes[]; showTarget: boolean; showRange: boolean; showYellowRange: boolean; showRedRange: boolean; showChart: boolean; showFormIfTemplateWasSelected: boolean; showAdvancedChartOptions: boolean; /** Displays all errors even if the form was not touched yet. */ showErrorsImmediately: boolean; formGroup: FormGroup; range: FormGroup; yellowRange: FormGroup; redRange: FormGroup; chart: FormGroup; display: FormGroup; rawValue: any; CHART_RENDER_TYPES: Array<(typeof CHART_RENDER_TYPES)[number]>; CHART_LINE_TYPES: Array<(typeof CHART_LINE_TYPES)[number]>; AXIS_TYPES: Array<(typeof AXIS_TYPES)[number]>; DEFAULT_RENDER_TYPES: ChartRenderTypes[]; customValidationErrorMessages: { [formField: string]: { [validationError: string]: string; }; }; shouldForceInitialValidation: boolean; showOnlyDisplayForm: boolean; showChartForm: boolean; constructor(formValidations: DatapointAttributesFormValidationService); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; validate(_control: AbstractControl): ValidationErrors; writeValue(obj: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; private setSubForms; private initializeFormVisibility; private filterChartTypes; private filterRenderTypes; private filterLineTypes; private filterAxisTypes; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DatapointSelectorModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { AXIS_TYPES, AddButtonTypes, CHART_LINE_TYPES, CHART_RENDER_TYPES, DATAPOINT_LIBRARY_FRAGMENT, DatapointAttributesFormComponent, DatapointAttributesFormValidationService, DatapointLabelPipe, DatapointLibraryService, DatapointSelectionListComponent, DatapointSelectorComponent, DatapointSelectorListItemComponent, DatapointSelectorModalComponent, DatapointSelectorModule, DatapointSelectorService, DatapointTemplatePopoverComponent, IncludesDatapointPipe }; export type { AddButtonType, AxisTypes, ChartLineTypes, ChartRenderTypes, DatapointAction, DatapointAttributesFormConfig, DatapointSelectorModalAssetSelectorOptions, DatapointSelectorModalOptions, KPIDetails, ManagedObjectKPI }; //# sourceMappingURL=index.d.ts.map