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

125 lines (124 loc) 3.34 kB
import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnInit, OnDestroy, QueryList } from '@angular/core'; import { MatColorPickerCollectionComponent } from './color-picker-collection.component'; import { MatColorPickerService } from './color-picker.service'; import { Observable } from 'rxjs/Observable'; export declare class MatColorPickerComponent implements AfterContentInit, OnInit, OnDestroy { private elementRef; private changeDetectorRef; private colorPickerService; /** * Get all collections */ _collections: QueryList<MatColorPickerCollectionComponent>; /** * Change label of the collection UsedColors */ usedColorLabel: string; private _usedColorLabel; /** * Set initial value for used color */ usedColorStart: string[]; /** * Hide empty slots from the collection UsedColors */ hideEmpty: boolean; private _hideEmpty; /** * Hide UsedColors collection */ hideUsedColors: boolean; private _hideUsedColors; /** * Start with a color selected */ selectedColor: string; private _selectedColor; /** * Define if the panel will be initiated open */ isOpen: boolean; private _isOpen; /** * Define if the panel will show in overlay or not */ overlay: boolean; private _overlay; /** * Hide the action buttons (cancel/confirm) */ hideButtons: boolean; private _hideButtons; /** * Set the size of the used colors */ usedSizeColors: number; /** * Change btnCancel label */ btnCancel: string; /** * Change btnConfirm label */ btnConfirm: string; /** * Event emitted when user change the selected color (without confirm) */ change: EventEmitter<{}>; /** * Event emitted when selected color is confirm */ selected: EventEmitter<{}>; /** * Event emitted when is clicked outside of the component */ clickOut: EventEmitter<{}>; /** * Return a Observable with the color the user is picking */ readonly tmpSelectedColor$: Observable<string>; private _tmpSelectedColor; /** * Array of subscriptions from the collections */ private _collectionSubs; /** * Observable with all the colors used by the user */ usedColors$: Observable<string[]>; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, colorPickerService: MatColorPickerService); ngOnInit(): void; /** * Walk throw all collections and subcribe to changes */ ngAfterContentInit(): void; /** * Destroy all subscriptions */ ngOnDestroy(): void; /** * Update selected color and emit the change */ private _updateSelectedColor(); /** * Open/close color picker panel */ toggle(): void; /** * Update selected color, close the panel and notify the user */ backdropClick(): void; /** * Update tmpSelectedColor * @param color string */ updateTmpSelectedColor(color: string): void; /** * Cancel the selection and close the panel */ cancelSelection(): void; /** * Update selectedColor and close the panel */ confirmSelectedColor(): void; }