UNPKG

@blox/material

Version:

Material Components for Angular

142 lines (141 loc) 5.63 kB
import { AfterContentInit, AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { MdcEventRegistry } from '../../utils/mdc.event.registry'; /** * Directive for creating a Material Design slider input. * (Modelled after the <code>&lt;input type="range"/&gt;</code> element). * The slider is fully accessible. The current implementation * will add and manage all DOM child elements that are required for the wrapped * <code>mdc-slider</code> component. * Future implementations will also support supplying (customized) * DOM children. */ export declare class MdcSliderDirective implements AfterContentInit, AfterViewInit, OnChanges, OnDestroy { private _rndr; private _root; private _registry; /** * Event emitted when the value changes. The value may change because of user input, * or as a side affect of setting new min, max, or step values. */ readonly valueChange: EventEmitter<number>; /** * Event emitted when the min range value changes. This may happen as a side effect * of setting a new max value (when the new max is smaller than the old min). */ readonly minValueChange: EventEmitter<number>; /** * Event emitted when the max range value changes. This may happen as a side effect * of setting a new min value (when the new min is larger than the old max). */ readonly maxValueChange: EventEmitter<number>; /** * Event emitted when the step value changes. This may happen as a side effect * of making the slider discrete. */ readonly stepValueChange: EventEmitter<number>; private trackCntr; private _elmThumbCntr; private _elmSliderPin; private _elmValueMarker; private _elmTrack; private _elmTrackMarkerCntr; private _reinitTabIndex; private _onChange; private _onTouched; private _discrete; private _markers; private _disabled; private _value; private _min; private _max; private _step; private _lastWidth; private mdcAdapter; private foundation; private document; constructor(_rndr: Renderer2, _root: ElementRef, _registry: MdcEventRegistry, doc: any); ngAfterContentInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; ngOnChanges(changes: SimpleChanges): void; private isChanged; private initElements; private addElement; private initDefaultAttributes; private updateValues; private updateLayout; private notifyValueChanged; /** * Make the slider discrete. Note from the wrapped <code>mdc-slider</code> * component: * <blockquote>If a slider contains a step value it does not mean that the slider is a "discrete" slider. * "Discrete slider" is a UX treatment, while having a step value is behavioral.</blockquote> */ get discrete(): boolean; set discrete(value: boolean); static ngAcceptInputType_discrete: boolean | ''; /** * Property to enable/disable the display of track markers. Display markers * are only supported for discrete sliders. Thus they are only shown when the values * of both markers and discrete equal true. */ get markers(): boolean; set markers(value: boolean); static ngAcceptInputType_markers: boolean | ''; /** * The current value of the slider. */ get value(): number; set value(value: number); static ngAcceptInputType_value: string | number; /** * The minumum allowed value of the slider. */ get minValue(): number; set minValue(value: number); static ngAcceptInputType_minValue: string | number; /** * The maximum allowed value of the slider. */ get maxValue(): number; set maxValue(value: number); static ngAcceptInputType_maxValue: string | number; /** * Set the step value (or set to 0 for no step value). * The step value can be a floating point value &gt;= 0. * The slider will quantize all values to match the step value, except for the minimum and * maximum, which can always be set. * Discrete sliders are required to have a step value other than 0. * Note from the wrapped <code>mdc-slider</code> component: * <blockquote>If a slider contains a step value it does not mean that the slider is a "discrete" slider. * "Discrete slider" is a UX treatment, while having a step value is behavioral.</blockquote> */ get stepValue(): number; set stepValue(value: number); static ngAcceptInputType_stepValue: string | number; /** * A property to disable the slider. */ get disabled(): boolean; set disabled(value: boolean); static ngAcceptInputType_disabled: boolean | ''; } /** * Directive for adding Angular Forms (<code>ControlValueAccessor</code>) behavior to an * <code>MdcSliderDirective</code>. Allows the use of the Angular Forms API with * icon toggles, e.g. binding to <code>[(ngModel)]</code>, form validation, etc. */ export declare class MdcFormsSliderDirective implements ControlValueAccessor { private mdcSlider; constructor(mdcSlider: MdcSliderDirective); /** @docs-private */ writeValue(obj: any): void; /** @docs-private */ registerOnChange(onChange: (value: any) => void): void; /** @docs-private */ registerOnTouched(onTouched: () => any): void; /** @docs-private */ setDisabledState(disabled: boolean): void; } export declare const SLIDER_DIRECTIVES: (typeof MdcSliderDirective | typeof MdcFormsSliderDirective)[];