298 lines
13 KiB
TypeScript
298 lines
13 KiB
TypeScript
import * as i0 from '@angular/core';
|
|
import { OnChanges, ElementRef, TemplateRef, SimpleChanges, OnInit, QueryList, EventEmitter } from '@angular/core';
|
|
import { Direction } from '@angular/cdk/bidi';
|
|
import { ControlValueAccessor } from '@angular/forms';
|
|
import { NzTSType, NgStyleInterface } from 'ng-zorro-antd/core/types';
|
|
import { NzTooltipDirective } from 'ng-zorro-antd/tooltip';
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
type NzMark = string | NzMarkObj;
|
|
interface NzMarkObj {
|
|
style?: object;
|
|
label: string;
|
|
}
|
|
declare class NzMarks {
|
|
[key: string]: NzMark;
|
|
}
|
|
/**
|
|
* Processed steps that would be passed to sub components.
|
|
*/
|
|
interface NzExtendedMark {
|
|
value: number;
|
|
offset: number;
|
|
config: NzMark;
|
|
}
|
|
/**
|
|
* Marks that would be rendered.
|
|
*/
|
|
interface NzDisplayedMark extends NzExtendedMark {
|
|
active: boolean;
|
|
label: string;
|
|
style?: object;
|
|
}
|
|
/**
|
|
* Steps that would be rendered.
|
|
*/
|
|
interface NzDisplayedStep extends NzExtendedMark {
|
|
active: boolean;
|
|
style?: object;
|
|
}
|
|
type NzSliderShowTooltip = 'always' | 'never' | 'default';
|
|
type NzSliderValue = number[] | number;
|
|
interface NzSliderHandler {
|
|
offset: number | null;
|
|
value: number | null;
|
|
active: boolean;
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
declare class NzSliderHandleComponent implements OnChanges {
|
|
private cdr;
|
|
handleEl?: ElementRef;
|
|
tooltip?: NzTooltipDirective;
|
|
vertical?: boolean;
|
|
reverse?: boolean;
|
|
offset?: number;
|
|
value?: number;
|
|
tooltipVisible: NzSliderShowTooltip;
|
|
tooltipPlacement?: string;
|
|
tooltipFormatter?: null | ((value: number) => string) | TemplateRef<void>;
|
|
active: boolean;
|
|
dir: Direction;
|
|
dragging?: boolean;
|
|
tooltipTitle?: NzTSType;
|
|
style: NgStyleInterface;
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
enterHandle: () => void;
|
|
leaveHandle: () => void;
|
|
focus(): void;
|
|
private toggleTooltip;
|
|
private updateTooltipTitle;
|
|
private updateTooltipPosition;
|
|
private updateStyle;
|
|
private getHorizontalStylePosition;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderHandleComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzSliderHandleComponent, "nz-slider-handle", ["nzSliderHandle"], { "vertical": { "alias": "vertical"; "required": false; }; "reverse": { "alias": "reverse"; "required": false; }; "offset": { "alias": "offset"; "required": false; }; "value": { "alias": "value"; "required": false; }; "tooltipVisible": { "alias": "tooltipVisible"; "required": false; }; "tooltipPlacement": { "alias": "tooltipPlacement"; "required": false; }; "tooltipFormatter": { "alias": "tooltipFormatter"; "required": false; }; "active": { "alias": "active"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; "dragging": { "alias": "dragging"; "required": false; }; }, {}, never, never, true, never>;
|
|
static ngAcceptInputType_vertical: unknown;
|
|
static ngAcceptInputType_reverse: unknown;
|
|
static ngAcceptInputType_offset: unknown;
|
|
static ngAcceptInputType_value: unknown;
|
|
static ngAcceptInputType_active: unknown;
|
|
}
|
|
|
|
declare class NzSliderComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
slider: ElementRef<any>;
|
|
private destroyRef;
|
|
private cdr;
|
|
private platform;
|
|
private directionality;
|
|
handlerComponents: QueryList<NzSliderHandleComponent>;
|
|
nzDisabled: boolean;
|
|
nzDots: boolean;
|
|
nzIncluded: boolean;
|
|
nzRange: boolean;
|
|
nzVertical: boolean;
|
|
nzReverse: boolean;
|
|
nzDefaultValue?: NzSliderValue;
|
|
nzMarks: NzMarks | null;
|
|
nzMax: number;
|
|
nzMin: number;
|
|
nzStep: number;
|
|
nzTooltipVisible: NzSliderShowTooltip;
|
|
nzTooltipPlacement: string;
|
|
nzTipFormatter?: null | ((value: number) => string) | TemplateRef<void>;
|
|
readonly nzOnAfterChange: EventEmitter<NzSliderValue>;
|
|
value: NzSliderValue | null;
|
|
cacheSliderStart: number | null;
|
|
cacheSliderLength: number | null;
|
|
activeValueIndex: number | undefined;
|
|
track: {
|
|
offset: null | number;
|
|
length: null | number;
|
|
};
|
|
handles: NzSliderHandler[];
|
|
marksArray: NzExtendedMark[] | null;
|
|
bounds: {
|
|
lower: NzSliderValue | null;
|
|
upper: NzSliderValue | null;
|
|
};
|
|
dir: Direction;
|
|
readonly dragging: i0.WritableSignal<boolean>;
|
|
private dragStart$?;
|
|
private dragMove$?;
|
|
private dragEnd$?;
|
|
private dragStart_?;
|
|
private dragMove_?;
|
|
private dragEnd_?;
|
|
private isNzDisableFirstChange;
|
|
ngOnInit(): void;
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
writeValue(val: NzSliderValue | null): void;
|
|
onValueChange(_value: NzSliderValue): void;
|
|
onTouched(): void;
|
|
registerOnChange(fn: (value: NzSliderValue) => void): void;
|
|
registerOnTouched(fn: () => void): void;
|
|
setDisabledState(isDisabled: boolean): void;
|
|
/**
|
|
* Event handler is only triggered when a slider handler is focused.
|
|
*/
|
|
onKeyDown(e: KeyboardEvent): void;
|
|
onHandleFocusIn(index: number): 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.
|
|
*/
|
|
private setActiveValueIndex;
|
|
private setActiveValue;
|
|
/**
|
|
* Update track and handles' position and length.
|
|
*/
|
|
private updateTrackAndHandles;
|
|
private onDragStart;
|
|
private onDragMove;
|
|
private getLogicalValue;
|
|
private onDragEnd;
|
|
/**
|
|
* Create user interactions handles.
|
|
*/
|
|
private bindDraggingHandlers;
|
|
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;
|
|
/**
|
|
* Show one handle's tooltip and hide others'.
|
|
*/
|
|
private showHandleTooltip;
|
|
private hideAllHandleTooltip;
|
|
private generateMarkItems;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzSliderComponent, "nz-slider", ["nzSlider"], { "nzDisabled": { "alias": "nzDisabled"; "required": false; }; "nzDots": { "alias": "nzDots"; "required": false; }; "nzIncluded": { "alias": "nzIncluded"; "required": false; }; "nzRange": { "alias": "nzRange"; "required": false; }; "nzVertical": { "alias": "nzVertical"; "required": false; }; "nzReverse": { "alias": "nzReverse"; "required": false; }; "nzDefaultValue": { "alias": "nzDefaultValue"; "required": false; }; "nzMarks": { "alias": "nzMarks"; "required": false; }; "nzMax": { "alias": "nzMax"; "required": false; }; "nzMin": { "alias": "nzMin"; "required": false; }; "nzStep": { "alias": "nzStep"; "required": false; }; "nzTooltipVisible": { "alias": "nzTooltipVisible"; "required": false; }; "nzTooltipPlacement": { "alias": "nzTooltipPlacement"; "required": false; }; "nzTipFormatter": { "alias": "nzTipFormatter"; "required": false; }; }, { "nzOnAfterChange": "nzOnAfterChange"; }, never, never, true, never>;
|
|
static ngAcceptInputType_nzDisabled: unknown;
|
|
static ngAcceptInputType_nzDots: unknown;
|
|
static ngAcceptInputType_nzIncluded: unknown;
|
|
static ngAcceptInputType_nzRange: unknown;
|
|
static ngAcceptInputType_nzVertical: unknown;
|
|
static ngAcceptInputType_nzReverse: unknown;
|
|
static ngAcceptInputType_nzMax: unknown;
|
|
static ngAcceptInputType_nzMin: unknown;
|
|
static ngAcceptInputType_nzStep: unknown;
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
interface NzSliderTrackStyle {
|
|
bottom?: string | null;
|
|
height?: string | null;
|
|
left?: string | null;
|
|
right?: string | null;
|
|
width?: string | null;
|
|
visibility?: string;
|
|
}
|
|
declare class NzSliderTrackComponent implements OnChanges {
|
|
offset: number;
|
|
reverse: boolean;
|
|
dir: Direction;
|
|
length: number;
|
|
vertical: boolean;
|
|
included: boolean;
|
|
style: NzSliderTrackStyle;
|
|
ngOnChanges(): void;
|
|
private getHorizontalStylePosition;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderTrackComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzSliderTrackComponent, "nz-slider-track", ["nzSliderTrack"], { "offset": { "alias": "offset"; "required": false; }; "reverse": { "alias": "reverse"; "required": false; }; "dir": { "alias": "dir"; "required": false; }; "length": { "alias": "length"; "required": false; }; "vertical": { "alias": "vertical"; "required": false; }; "included": { "alias": "included"; "required": false; }; }, {}, never, never, true, never>;
|
|
static ngAcceptInputType_offset: unknown;
|
|
static ngAcceptInputType_reverse: unknown;
|
|
static ngAcceptInputType_length: unknown;
|
|
static ngAcceptInputType_vertical: unknown;
|
|
static ngAcceptInputType_included: unknown;
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
declare class NzSliderStepComponent implements OnChanges {
|
|
lowerBound: number | null;
|
|
upperBound: number | null;
|
|
marksArray: NzExtendedMark[];
|
|
min: number;
|
|
max: number;
|
|
vertical: boolean;
|
|
included: boolean;
|
|
reverse: boolean;
|
|
steps: NzDisplayedStep[];
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
private buildSteps;
|
|
private togglePointActive;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderStepComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzSliderStepComponent, "nz-slider-step", ["nzSliderStep"], { "lowerBound": { "alias": "lowerBound"; "required": false; }; "upperBound": { "alias": "upperBound"; "required": false; }; "marksArray": { "alias": "marksArray"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "vertical": { "alias": "vertical"; "required": false; }; "included": { "alias": "included"; "required": false; }; "reverse": { "alias": "reverse"; "required": false; }; }, {}, never, never, true, never>;
|
|
static ngAcceptInputType_min: unknown;
|
|
static ngAcceptInputType_max: unknown;
|
|
static ngAcceptInputType_vertical: unknown;
|
|
static ngAcceptInputType_included: unknown;
|
|
static ngAcceptInputType_reverse: unknown;
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
declare class NzSliderMarksComponent implements OnChanges {
|
|
lowerBound: number | null;
|
|
upperBound: number | null;
|
|
marksArray: NzExtendedMark[];
|
|
min: number;
|
|
max: number;
|
|
vertical: boolean;
|
|
included: boolean;
|
|
reverse: boolean;
|
|
marks: NzDisplayedMark[];
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
private buildMarks;
|
|
private getMarkStyles;
|
|
private togglePointActive;
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderMarksComponent, never>;
|
|
static ɵcmp: i0.ɵɵComponentDeclaration<NzSliderMarksComponent, "nz-slider-marks", ["nzSliderMarks"], { "lowerBound": { "alias": "lowerBound"; "required": false; }; "upperBound": { "alias": "upperBound"; "required": false; }; "marksArray": { "alias": "marksArray"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "vertical": { "alias": "vertical"; "required": false; }; "included": { "alias": "included"; "required": false; }; "reverse": { "alias": "reverse"; "required": false; }; }, {}, never, never, true, never>;
|
|
static ngAcceptInputType_min: unknown;
|
|
static ngAcceptInputType_max: unknown;
|
|
static ngAcceptInputType_vertical: unknown;
|
|
static ngAcceptInputType_included: unknown;
|
|
static ngAcceptInputType_reverse: unknown;
|
|
}
|
|
|
|
declare class NzSliderModule {
|
|
static ɵfac: i0.ɵɵFactoryDeclaration<NzSliderModule, never>;
|
|
static ɵmod: i0.ɵɵNgModuleDeclaration<NzSliderModule, never, [typeof NzSliderComponent, typeof NzSliderTrackComponent, typeof NzSliderHandleComponent, typeof NzSliderStepComponent, typeof NzSliderMarksComponent], [typeof NzSliderComponent, typeof NzSliderTrackComponent, typeof NzSliderHandleComponent, typeof NzSliderStepComponent, typeof NzSliderMarksComponent]>;
|
|
static ɵinj: i0.ɵɵInjectorDeclaration<NzSliderModule>;
|
|
}
|
|
|
|
export { NzMarks, NzSliderComponent, NzSliderModule, NzSliderHandleComponent as ɵNzSliderHandleComponent, NzSliderMarksComponent as ɵNzSliderMarksComponent, NzSliderStepComponent as ɵNzSliderStepComponent, NzSliderTrackComponent as ɵNzSliderTrackComponent };
|
|
export type { NzDisplayedMark, NzDisplayedStep, NzExtendedMark, NzMark, NzMarkObj, NzSliderHandler, NzSliderShowTooltip, NzSliderTrackStyle, NzSliderValue };
|