UNPKG

mat-color-picker

Version:

<span class="badge-npmversion">[![npm version](https://badge.fury.io/js/mat-color-picker.svg)](https://badge.fury.io/js/mat-color-picker)</span> <span class="badge-npmdownloads"><a href="https://npmjs.org/package/mat-color-picker" title="View this project

96 lines (95 loc) 3.08 kB
import { AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, Renderer2 } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { MatColorPickerComponent } from './color-picker.component'; import { MatColorPickerOption } from './color-picker'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; /** * This directive change the background of the button */ export declare class MatColorPickerOptionDirective implements AfterViewInit { private elementRef; private render; /** * Receive the color */ color: MatColorPickerOption; private _color; constructor(elementRef: ElementRef, render: Renderer2); ngAfterViewInit(): void; } /** * Directive applied to an element to make it usable as an origin for an ColorPicker. */ export declare class MatColorPickerOriginDirective implements ControlValueAccessor { private elementRef; private renderer; /** * Emit changes from the origin */ change: BehaviorSubject<string>; /** * Propagate changes to angular */ propagateChanges: (_: any) => {}; /** * Reference to the element on which the directive is applied. */ constructor(elementRef: ElementRef, renderer: Renderer2); /** * This method will be called by the forms API to write to the view when * programmatic (model -> view) changes are requested. */ writeValue(color: string): void; /** * This method will be called by the color picker */ writeValueFromColorPicker(color: string): void; /** * This method will be called from origin whe key is up */ writeValueFromKeyup(color: string): void; /** * This is called by the forms API on initialization so it can update the * form model when values propagate from the view (view -> model). * @param fn any */ registerOnChange(fn: any): void; /** * This is called by the forms API on initialization so it can update the form model on blur * @param fn any */ registerOnTouched(fn: any): void; /** * called by the forms API when the control status changes to or from "DISABLED" * @param isDisabled boolean */ setDisabledState(isDisabled: boolean): void; } /** * Directive connect an color picker with any input, select or textarea. * The color picker will be automatically updated when the value of the origin is * changed. */ export declare class MatConnectedColorPickerDirective implements AfterViewInit, OnDestroy { private colorPicker; changeDetectorRef: ChangeDetectorRef; /** * Origin of the connected color picker */ origin: MatColorPickerOriginDirective; /** * Color picker subscription */ private _colorPickerSub; /** * Origin subscription */ private _originSub; constructor(colorPicker: MatColorPickerComponent, changeDetectorRef: ChangeDetectorRef); ngAfterViewInit(): void; ngOnDestroy(): void; /** * Attach color picker and origin */ private _attachColorPicker(); }