mat-color-picker
Version:
<span class="badge-npmversion">[](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
135 lines (134 loc) • 3.17 kB
TypeScript
import { AfterViewInit, ElementRef, EventEmitter, OnInit, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
export declare class MatColorPickerSelectorComponent implements AfterViewInit, OnInit, OnChanges, OnDestroy {
private formBuilder;
private render;
/**
* ElemenRef of the main color
*/
_block: ElementRef;
/**
* ElemenRef of the pointer main color
*/
_bp: ElementRef;
/**
* Canvas of the block
*/
blockCursor: ElementRef;
private _bc;
private _blockContext;
/**
* ElementRef of the color base
*/
_strip: ElementRef;
private _stripContext;
/**
* Container of the strip
*/
stripCursor: ElementRef;
private _sc;
/**
* Receive selected color from the component
*/
selectedColor: string;
private _selectedColor;
/**
* Emit update when a color is selected
*/
changeSelectedColor: EventEmitter<{}>;
/**
* RGBA current color
*/
private _rgbaColor;
/**
* Subject of the current selected color by the user
*/
private _tmpSelectedColor;
/**
* Subscription of the tmpSelectedColor Observable
*/
private _tmpSelectedColorSub;
/**
* Subscription of the hexForm values change
*/
private _hexValuesSub;
/**
* Subscription of the rbgForm values change
*/
private _rgbValuesSub;
/**
* Handle color of the text
*/
textClass: string;
/**
* Validate if the mouse button is pressed
*/
_isPressed: boolean;
/**
* Form of the color in hexa
*/
hexForm: FormGroup;
/**
* Form and keys of the fields in RGB
*/
rgbKeys: string[];
rgbForm: FormGroup;
constructor(formBuilder: FormBuilder, render: Renderer2);
ngOnInit(): void;
/**
* Update RGB, RGBA and Gradient when selectedColor change and
* the mouse button is pressed
* @param changes SimpleChanges
*/
ngOnChanges(changes: SimpleChanges): void;
/**
* Destroy all subscriptions
*/
ngOnDestroy(): void;
ngAfterViewInit(): void;
/**
* Generate colors based on the RGBA color
*/
private _fillGradient();
/**
* Watch change on forms
*/
private _onChanges();
/**
* Convert HEX/canvas value to rgb
* @param data any
* @returns number[]
*/
private _getRGB(data?);
/**
* Convert RGB value to HEX
* @param data any
* @returns string
*/
private _getHex(data);
/**
* Update RGBA color
* @param data any
*/
private _updateRGBA(data?);
/**
* Update RGB form
* @param data any
*/
private _updateRGB(data?);
/**
* Get selected base color from the canvas
* @param e MouseEvent
*/
private changeBaseColor(e);
/**
* Get selected color from the canvas
* @param e MouseEvent
*/
private changeColor(e);
/**
* Emit update from the selected color
* @param data any
*/
private updateValues(data);
}