ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
114 lines (113 loc) • 3.66 kB
TypeScript
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
import { Platform } from '@angular/cdk/platform';
import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { ExtendedMark, NzMarks, SliderHandler, SliderShowTooltip, SliderValue } from './nz-slider-definitions';
export declare class NzSliderComponent implements ControlValueAccessor, OnInit, OnChanges, OnDestroy {
private cdr;
private platform;
slider: ElementRef<HTMLDivElement>;
nzDisabled: boolean;
nzDots: boolean;
nzIncluded: boolean;
nzRange: boolean;
nzVertical: boolean;
nzDefaultValue: SliderValue | null;
nzMarks: NzMarks | null;
nzMax: number;
nzMin: number;
nzStep: number;
nzTooltipVisible: SliderShowTooltip;
nzTooltipPlacement: string;
nzTipFormatter: (value: number) => string;
readonly nzOnAfterChange: EventEmitter<SliderValue>;
value: SliderValue | null;
sliderDOM: HTMLDivElement;
cacheSliderStart: number | null;
cacheSliderLength: number | null;
activeValueIndex: number | undefined;
track: {
offset: null | number;
length: null | number;
};
handles: SliderHandler[];
marksArray: ExtendedMark[] | null;
bounds: {
lower: SliderValue | null;
upper: SliderValue | null;
};
isDragging: boolean;
private dragStart$;
private dragMove$;
private dragEnd$;
private dragStart_;
private dragMove_;
private dragEnd_;
constructor(cdr: ChangeDetectorRef, platform: Platform);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
writeValue(val: SliderValue | null): void;
onValueChange(_value: SliderValue): void;
onTouched(): void;
registerOnChange(fn: (value: SliderValue) => void): void;
registerOnTouched(fn: () => void): void;
setDisabledState(isDisabled: boolean): void;
private setValue;
private getValue;
/**
* Clone & sort current value and convert them to offsets, then return the new one.
*/
private getValueToOffset;
/**
* Find the closest value to be activated (only for range = true).
*/
private setActiveValueIndex;
private setActiveValue;
/**
* Update track and handles' position and length.
*/
private updateTrackAndHandles;
private onDragStart;
private onDragMove;
private onDragEnd;
/**
* Create user interactions handles.
*/
private createDraggingObservables;
private subscribeDrag;
private unsubscribeDrag;
private toggleDragMoving;
private toggleDragDisabled;
private findClosestValue;
private valueToOffset;
private getSliderStartPosition;
private getSliderLength;
/**
* Cache DOM layout/reflow operations for performance (may not necessary?)
*/
private cacheSliderProperty;
private formatValue;
/**
* Check if value is valid and throw error if value-type/range not match.
*/
private assertValueValid;
/**
* Assert that if `this.nzRange` is `true`, value is also a range, vice versa.
*/
private assertValueTypeMatch;
private valuesEqual;
/**
* Show one handle's tooltip and hide others'.
*/
private showHandleTooltip;
private hideAllHandleTooltip;
private generateHandles;
private generateMarkItems;
}