UNPKG

@taiga-ui/kit

Version:
68 lines (67 loc) 2.91 kB
import { ChangeDetectorRef, ElementRef } from '@angular/core'; import { NgControl } from '@angular/forms'; import { AbstractTuiControl, TuiEventWith, TuiNativeFocusableElement } from '@taiga-ui/cdk'; import { TuiPluralize, TuiSizeS, TuiWithOptionalMinMax } from '@taiga-ui/core'; import { TuiKeySteps } from '@taiga-ui/kit/types'; import { Observable } from 'rxjs'; export declare const SLIDER_KEYBOARD_STEP = 0.05; export declare const DOT_WIDTH: { [key: string]: number; }; /** * @awful TODO: refactor * @internal * @dynamic */ export declare abstract class AbstractTuiSlider<T> extends AbstractTuiControl<T> implements TuiWithOptionalMinMax<number> { private readonly documentRef; readonly fromToTexts$: Observable<[string, string]>; min: number; max: number; segments: number; steps: number; pluralize: TuiPluralize | null; size: TuiSizeS; keySteps: TuiKeySteps | null; focusVisibleLeft: boolean; focusVisibleRight: boolean; protected dotLeft?: ElementRef<TuiNativeFocusableElement>; protected dotRight?: ElementRef<TuiNativeFocusableElement>; private pointerDown$; protected constructor(ngControl: NgControl | null, changeDetectorRef: ChangeDetectorRef, documentRef: Document, fromToTexts$: Observable<[string, string]>); get segmented(): boolean; get discrete(): boolean; get length(): number; get isLeftFocusable(): boolean; get isRightFocusable(): boolean; abstract get left(): number; abstract get right(): number; ngOnInit(): void; ngOnDestroy(): void; onMouseDown(event: TuiEventWith<MouseEvent, HTMLElement>): void; onTouchStart(event: TuiEventWith<TouchEvent, HTMLElement>): void; isPluralized(pluralize: TuiPluralize | null): pluralize is TuiPluralize; decrement(right: boolean): void; increment(right: boolean): void; getSegmentLabel(segment: number): number; getSegmentPrefix(segment: number, texts: [string, string]): string; onActiveZone(active: boolean): void; onLeftFocusVisible(focusVisible: boolean): void; onRightFocusVisible(focusVisible: boolean): void; protected abstract processValue(value: number, right?: boolean): void; protected abstract processStep(increment: boolean, right?: boolean): void; protected getFractionFromValue(value: number): number; protected getValueFromFraction(fraction: number): number; protected getCalibratedFractionFromEvents(rect: ClientRect, clientX: number, _: boolean): number; private processFocus; /** * Function for converting the fullness of the slider to a value and vice versa * taking into account the steps of linear dependence. * * @param value passed value * @param isFraction translation is carried out from fullness to value */ private fractionValueKeyStepConverter; private fractionGuard; private getFractionFromEvents; }