igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
111 lines (110 loc) • 4.64 kB
JavaScript
import { ColorScaleInterpolationMode_$type } from "./ColorScaleInterpolationMode";
import { IgcColorScaleComponent } from "./igc-color-scale-component";
import { CustomPaletteColorScale } from "./CustomPaletteColorScale";
import { getAllPropertyNames, toSpinal, toColorCollection, fromColorCollection, colorCollectionToString, ensureEnum, enumToString } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
/**
* ColorScale class for selecting a color from a given palette, or interpolating between adjacent colors in that palette.
*/
export let IgcCustomPaletteColorScaleComponent = /*@__PURE__*/ (() => {
class IgcCustomPaletteColorScaleComponent extends IgcColorScaleComponent {
createImplementation() {
return new CustomPaletteColorScale();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
}
connectedCallback() {
if (super["connectedCallback"]) {
super["connectedCallback"]();
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
}
disconnectedCallback() {
if (super["disconnectedCallback"]) {
super["disconnectedCallback"]();
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
}
static get observedAttributes() {
if (IgcCustomPaletteColorScaleComponent._observedAttributesIgcCustomPaletteColorScaleComponent == null) {
let names = getAllPropertyNames(IgcCustomPaletteColorScaleComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcCustomPaletteColorScaleComponent._observedAttributesIgcCustomPaletteColorScaleComponent = names;
}
return IgcCustomPaletteColorScaleComponent._observedAttributesIgcCustomPaletteColorScaleComponent;
}
static register() {
if (!IgcCustomPaletteColorScaleComponent._isElementRegistered) {
IgcCustomPaletteColorScaleComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcCustomPaletteColorScaleComponent.htmlTagName, IgcCustomPaletteColorScaleComponent);
}
}
/**
* The lowest value to assign a color. Any given value less than this value will be made Transparent.
*/
get minimumValue() {
return this.i.minimumValue;
}
set minimumValue(v) {
this.i.minimumValue = +v;
this._a("minimumValue", this.i.minimumValue);
}
/**
* The highest value to assign a color. Any given value greater than this value will be made Transparent.
*/
get maximumValue() {
return this.i.maximumValue;
}
set maximumValue(v) {
this.i.maximumValue = +v;
this._a("maximumValue", this.i.maximumValue);
}
/**
* A list of colors to select from or interpolate between.
*/
get palette() {
return fromColorCollection(this.i.palette);
}
set palette(v) {
this.i.palette = toColorCollection(v);
this._a("palette", colorCollectionToString(this.i.palette));
}
/**
* The approach to use when getting a color from the palette.
*/
get interpolationMode() {
return this.i.interpolationMode;
}
set interpolationMode(v) {
this.i.interpolationMode = ensureEnum(ColorScaleInterpolationMode_$type, v);
this._a("interpolationMode", enumToString(ColorScaleInterpolationMode_$type, this.i.interpolationMode));
}
providePalette(colors) {
this.i.providePalette(colors);
}
}
IgcCustomPaletteColorScaleComponent._observedAttributesIgcCustomPaletteColorScaleComponent = null;
IgcCustomPaletteColorScaleComponent.htmlTagName = "igc-custom-palette-color-scale";
IgcCustomPaletteColorScaleComponent._isElementRegistered = false;
return IgcCustomPaletteColorScaleComponent;
})();