UNPKG

@ngxmc/color-picker

Version:
86 lines (85 loc) 4.39 kB
import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms'; import { ThemePalette } from '@angular/material/core'; import { MatFormField } from '@angular/material/form-field'; import { Color } from '../../models'; import { ColorAdapter, MatColorFormats } from '../../services'; import { NgxMatColorPickerComponent } from './color-picker.component'; import * as i0 from "@angular/core"; export declare class NgxMatColorPickerInputEvent { /** Reference to the colorpicker input component that emitted the event. */ target: NgxMatColorPickerInput; /** Reference to the native input element associated with the colorpicker input. */ targetElement: HTMLElement; /** The new value for the target colorpicker input. */ value: Color | null; constructor( /** Reference to the colorpicker input component that emitted the event. */ target: NgxMatColorPickerInput, /** Reference to the native input element associated with the colorpicker input. */ targetElement: HTMLElement); } export declare const MAT_COLORPICKER_VALUE_ACCESSOR: any; export declare const MAT_COLORPICKER_VALIDATORS: any; export declare class NgxMatColorPickerInput implements ControlValueAccessor, OnInit, OnDestroy, Validator { private _elementRef; private _formField; private _colorFormats; private _adapter; set ngxMatColorPicker(value: NgxMatColorPickerComponent); _picker: NgxMatColorPickerComponent; /** Whether the colorpicker-input is disabled. */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** The value of the input. */ get value(): Color | null; set value(value: Color | null); private _value; /** Emits when a `change` event is fired on this `<input>`. */ readonly colorChange: import("@angular/core").OutputEmitterRef<NgxMatColorPickerInputEvent>; /** Emits when an `input` event is fired on this `<input>`. */ readonly colorInput: import("@angular/core").OutputEmitterRef<NgxMatColorPickerInputEvent>; /** Emits when the disabled state has changed */ _disabledChange: EventEmitter<boolean>; /** Emits when the value changes (either due to user input or programmatic change). */ _valueChange: EventEmitter<Color>; _onTouched: () => void; private _cvaOnChange; private _validatorOnChange; private _pickerSubscription; /** The combined form control validator for this input. */ private _validator; /** Whether the last value set on the input was valid. */ private _lastValueValid; constructor(_elementRef: ElementRef<HTMLInputElement>, _formField: MatFormField, _colorFormats: MatColorFormats, _adapter: ColorAdapter); /** Returns the palette used by the input's form field, if any. */ getThemePalette(): ThemePalette; registerOnValidatorChange(fn: () => void): void; validate(c: AbstractControl): ValidationErrors | null; /** * @deprecated * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead */ getPopupConnectionElementRef(): ElementRef; /** * Gets the element that the colorpicker popup should be connected to. * @return The element to connect the popup to. */ getConnectedOverlayOrigin(): ElementRef; ngOnInit(): void; ngOnDestroy(): void; writeValue(value: Color): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; _onChange(): void; _onKeydown(event: KeyboardEvent): void; /** Handles blur events on the input. */ _onBlur(): void; /** Formats a value and sets it on the input element. */ private _formatValue; _onInput(value: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatColorPickerInput, [null, { optional: true; }, { optional: true; }, null]>; static ɵdir: i0.ɵɵDirectiveDeclaration<NgxMatColorPickerInput, "input[ngxMatColorPicker]", ["ngxMatColorPickerInput"], { "ngxMatColorPicker": { "alias": "ngxMatColorPicker"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "colorChange": "colorChange"; "colorInput": "colorInput"; }, never, never, true, never>; }