@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
116 lines (111 loc) • 4.99 kB
TypeScript
import * as _angular_core from '@angular/core';
import { OnChanges, OnInit, TemplateRef, SimpleChanges } from '@angular/core';
import { FormBuilder, NgForm, ValidatorFn } from '@angular/forms';
import { OnBeforeSave, DashboardChildComponent } from '@c8y/ngx-components';
import { WidgetConfigComponent, WidgetConfigService } from '@c8y/ngx-components/context-dashboard';
import { KPIDetails, DatapointSelectorModalOptions, DatapointAttributesFormConfig } from '@c8y/ngx-components/datapoint-selector';
import { Observable } from 'rxjs';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
import { GlobalContextState, PresetName, GLOBAL_CONTEXT_DISPLAY_MODE } from '@c8y/ngx-components/global-context';
interface KpiWidgetConfig extends Partial<GlobalContextState> {
datapoints: KPIDetails[];
icon?: SupportedIconsSuggestions | null;
showTimestamp?: boolean | null;
showTrend?: boolean | null;
showIcon?: boolean | null;
numberOfDecimalPlaces?: number | null;
fontSize?: number | null;
}
interface MeasurementValue {
unit?: string;
value: number;
date: string;
}
declare enum ColorClass {
danger = "text-danger",
warning = "text-warning",
unknown = ""
}
type KpiState = {
latestMeasurement: MeasurementValue;
previousValue: MeasurementValue | undefined;
trend: string;
unit: string;
colorClass: ColorClass;
};
declare function exactlyASingleDatapointActive(): ValidatorFn;
declare class KpiWidgetConfigComponent implements OnChanges, OnInit, OnBeforeSave {
private formBuilder;
private form;
private widgetConfig;
private widgetConfigService;
set previewMapSet(template: TemplateRef<unknown>);
config: KpiWidgetConfig;
previewActiveDatapoint: KPIDetails;
datapointSelectionConfig: Partial<DatapointSelectorModalOptions>;
defaultFormOptions: Partial<DatapointAttributesFormConfig>;
formGroup: ReturnType<KpiWidgetConfigComponent['createForm']>;
previewConfig: KpiWidgetConfig;
private destroyRef;
private limits;
constructor(formBuilder: FormBuilder, form: NgForm, widgetConfig: WidgetConfigComponent, widgetConfigService: WidgetConfigService);
onBeforeSave(config?: KpiWidgetConfig): boolean | Promise<boolean> | Observable<boolean>;
ngOnChanges(changes: SimpleChanges): void;
ngOnInit(): void;
private initForm;
private applyLimitsToPreview;
private clamp;
private createForm;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<KpiWidgetConfigComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<KpiWidgetConfigComponent, "c8y-kpi-widget-config", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}
declare class KpiWidgetViewComponent implements OnChanges, OnInit {
config: KpiWidgetConfig;
displayMode: _angular_core.WritableSignal<"dashboard" | "config" | "view_and_config">;
contextConfig: _angular_core.WritableSignal<GlobalContextState>;
isLinkedToGlobal: _angular_core.WritableSignal<boolean>;
widgetControls: _angular_core.WritableSignal<PresetName>;
isHistoryMode: _angular_core.WritableSignal<boolean>;
state$: Observable<KpiState | null>;
noDataInitiallyInDB: _angular_core.WritableSignal<boolean>;
readonly GLOBAL_CONTEXT_DISPLAY_MODE: typeof GLOBAL_CONTEXT_DISPLAY_MODE;
private dashboardChild;
private dashboard;
private measurementRealtime;
private widgetConfigMigrationService;
private destroyRef;
private context$;
private refresh$;
private lastDatapoint;
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
onContextChange(event: {
context: GlobalContextState;
diff: GlobalContextState;
}): void;
onRefresh(): void;
getDashboardChild(): DashboardChildComponent;
setupObservable(datapoint: KPIDetails, context: GlobalContextState): Observable<KpiState>;
private buildStatePipeline;
private syncDisplayState;
private emitContext;
private isDashboardMode;
private isOnRealDashboard;
private isDashboardPreviewWaitingForContext;
private resolveDisplayMode;
private extractContext;
private findActiveDatapoint;
private hasDatapointChanged;
private getLiveMeasurement$;
private getHistoryMeasurement$;
private toMeasurementValue;
private getColorClass$;
private getTrend$;
private inRange;
private assignContextFromContextDashboard;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<KpiWidgetViewComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<KpiWidgetViewComponent, "c8y-kpi-widget-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}
export { ColorClass, KpiWidgetConfigComponent, KpiWidgetViewComponent, exactlyASingleDatapointActive };
export type { KpiState, KpiWidgetConfig, MeasurementValue };
//# sourceMappingURL=index.d.ts.map