import { BehaviorSubject, Observable } from 'rxjs'; import { ViewContainerRef, TemplateRef } from '@angular/core'; import { Destroyable } from '@bespunky/angular-zen/core'; import { TimelineCamera, TimelineConfig } from '@bespunky/angular-cdk/timeline/abstraction'; import { TickData } from '../render/tick-data'; import { DatesBetweenGenerator, DayFactor, TickLabeler, WidthCalculator } from './types'; /** * Represents a tick scale and provides tools to easily render it. * * @export * @abstract * @class TimelineTick */ export declare abstract class TimelineTick extends Destroyable { /** * The id of the tick scale (e.g. 'years', 'months', etc.). * * Currently not used anywhere. Kept for future reference. * * @defaultValue '' * @type {BehaviorSubject} */ readonly id: BehaviorSubject; /** * The minimum level of zoom at which the tick scale should render on the timeline. When the zoom level * reaches a lower number, the tick scale will disappear from the screen. * * @defaultValue 0 * @type {BehaviorSubject} */ readonly minZoom: BehaviorSubject; /** * The maximum level of zoom at which the tick scale should render on the timeline. When the zoom level * reaches a higher number, the tick scale will disappear from the screen. * * @defaultValue 100 * @type {BehaviorSubject} */ readonly maxZoom: BehaviorSubject; /** * A labeling function that will be used to produce and provide the label matching a specific date on * the timeline. When not provided, the date will be used as the value. * * @type {BehaviorSubject} */ readonly label: BehaviorSubject; /** * A function that generates an array of all dates that exist between two specified dates, truncated to * the level of the tick. The returned dates will be used to calculate the position of the ticks to render * for this scale. * * For example, between 20/12/2020 11:30 and 5/3/2021 12:00 there are: * 1 date for a year (1/1/2021 00:00) * 3 dates for months (1/1/2021 00:00, 1/2/2021 00:00, 1/3/2021 00:00) * ... * * @defaultValue () => [] * @type {BehaviorSubject} */ readonly datesBetween: BehaviorSubject; /** * The factor defining the relationship between one day and the tick level. * * Example: * For hours, this would be 24. * For minutes, this would be 24 hours x 60 minutes = 1440. * For months, this would be a function that calculates the number of days according to the specified month. * * @defaultValue 1 * @type {BehaviorSubject} */ readonly dayFactor: BehaviorSubject; /** * The view container in which ticks should be rendered. * * @abstract * @type {ViewContainerRef} */ abstract readonly view: ViewContainerRef; /** * The reference to the template to duplicate and render for each tick on the screen. * * @abstract * @type {TemplateRef} */ abstract readonly template: TemplateRef; /** * Notifies when ticks should render and unrender. Also used as an activation switch for `itemsToRender`. * * The observable depends on the current zoom level and the defined min/maxZoom properties. * * @abstract * @type {Observable} */ abstract readonly shouldRender: Observable; /** * Provides the function that will be used to calculate the width of a specific tick according to the day factor. * * @abstract * @type {Observable} */ abstract readonly width: Observable; /** * Generates the tick items to render according to what fits on the screen. * The generated array includes the additional items needed as virtualization buffer for both sides as specified in * the `state.ticksBuffer` factor. * * The observable depends on zoom, view center, view bounds, buffer size, and base tick size. Any change * would trigger the regeneration of the items. * * @abstract * @type {Observable} */ abstract readonly itemsToRender: Observable; abstract readonly config: TimelineConfig; abstract readonly camera: TimelineCamera; }