import { Semantics } from '../annotations'; import { ISlicer } from '../types'; import { EntityType, Property, PropertyDimension, PropertyHierarchy, PropertyLevel } from './sdl'; export declare enum TimeGranularity { Year = "Year", Quarter = "Quarter", Month = "Month", Week = "Week", Day = "Day" } export declare enum TimeRangeType { Standard = "Standard", Offset = "Offset" } export declare enum OffSetDirection { LookBack = "LookBack", LookAhead = "LookAhead" } export interface TimeOffSet { current?: Date; direction: OffSetDirection; granularity: TimeGranularity; amount: number; } export interface TimeRange { type: TimeRangeType; granularity: TimeGranularity; current?: Exclude; lookBack?: number; lookAhead?: number; /** * Start period * yyyy, yyyyMM, yyyyMMdd, yyyy'Q'Q, yyyy'W'W */ start?: string; /** * End period */ end?: string; selected?: boolean; /** * Format string for time value */ formatter?: string; } export interface TimeRangesSlicer extends ISlicer { currentDate: 'TODAY' | 'SYSTEMTIME'; ranges: Array; } export declare const isTimeRangesSlicer: (toBe: any) => toBe is TimeRangesSlicer; export declare function mapTimeGranularitySemantic(granularity: TimeGranularity): Semantics; export declare function mapSemanticTimeGranularity(semantic: Semantics): TimeGranularity; export declare function formatCurrentPeriod(current: number | Date, granularity: TimeGranularity, formatter?: string): string; export declare function reformat(currentDate: Date, dat: string, granularity: TimeGranularity, target: string): string; /** * Calculate relative offset time * * @param currentDate * @param param1 direction granularity amount * @returns Date */ export declare function calcOffset(currentDate: Date, { direction, granularity, amount }: Partial): Date; export declare function formatRangeCurrentPeriod(current: Date, range: TimeRange): string; export declare function calcStartEndRange(current: Date, range: TimeRange): string[]; export declare function calcOffsetRange(current: Date, range: TimeRange): string[]; /** * Calculate time range slicer to common slicer base current date * * @param currentDate * @param timeSlicer * @param entityType * @returns */ export declare function workOutTimeRangeSlicers(currentDate: Date, timeSlicer: TimeRangesSlicer, entityType?: EntityType): ISlicer[]; export declare function timeRangesSlicerAsString(slicer: TimeRangesSlicer, i18nTimeRanges?: string): string; export declare function getCalendarDimension(entityType: EntityType): Property; export declare function getCalendarHierarchy(entityType: EntityType): PropertyHierarchy; /** * Get the specified calendar dimension or the default calendar dimension * * @param entityType * @param calendar * @param timeGranularity * @returns */ export declare function getEntityCalendar(entityType: EntityType, calendar?: string, timeGranularity?: TimeGranularity): { dimension: PropertyDimension; hierarchy: PropertyHierarchy; level?: PropertyLevel; }; export declare function getTimeYearLevel(hierarchy: PropertyHierarchy): PropertyLevel; export declare function getTimeQuarterLevel(hierarchy: PropertyHierarchy): PropertyLevel;