@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
44 lines • 2.58 kB
TypeScript
import { Interval } from '@c8y/ngx-components/interval-picker';
import { AggregationOption, AggregationOptionStatus } from './aggregation.model';
import * as i0 from "@angular/core";
export declare class AggregationService {
readonly AGGREGATION_MAP: {
minutes: "NONE";
hours: import("packages/client/lib").aggregationType.MINUTELY;
days: import("packages/client/lib").aggregationType.HOURLY;
};
/**
* Determines which aggregation options should be disabled based on the time range between two dates.
* It calculates the time difference and checks against predefined time spans to decide if daily,
* hourly, or minutely aggregations should be disabled.
*
* @param dateFrom - The start date of the time range, as a `Date` object or an ISO date string.
* @param dateTo - The end date of the time range, as a `Date` object or an ISO date string.
* @returns An `AggregationOptionStatus` object indicating the disabled state of each aggregation option.
*/
getDisabledAggregationOptions(dateFrom: Date | string, dateTo: Date | string): AggregationOptionStatus;
/**
* Determines the new aggregation value based on the current value and disabled options.
*
* Goal is to switch to the next available aggregation option if the current one is disabled.
* - If the current option is disabled, sets the control to the first available (non-disabled) option based on the following order:
* - If the current value is `DAILY`, it switches to `HOURLY` if it's not disabled, otherwise to `MINUTELY` if `HOURLY` is also disabled.
* - If the current value is `HOURLY`, it switches to `MINUTELY` if it's not disabled.
* - If all options are disabled, it sets the value to `NONE`.
*
* @param currentValue - The current aggregation option.
* @param disabledOptions - An object containing disabled options.
* @returns The new aggregation option.
*/
determineFirstNewAvailableAggregationValue(currentValue: AggregationOption, disabledOptions: AggregationOptionStatus): AggregationOption;
/**
* Determines the aggregation value based on the provided interval.
*
* @param interval - The time range interval.
* @returns The corresponding aggregation value.
*/
determineAggregationValue(interval: Interval['id']): AggregationOption;
static ɵfac: i0.ɵɵFactoryDeclaration<AggregationService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<AggregationService>;
}
//# sourceMappingURL=aggregation.service.d.ts.map