igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
431 lines (430 loc) • 15.1 kB
JavaScript
import { IgcHTMLElement } from "igniteui-webcomponents-core";
import { HorizontalAlignment_$type } from "igniteui-webcomponents-core";
import { VerticalAlignment_$type } from "igniteui-webcomponents-core";
import { TreemapNodeStyle } from "./TreemapNodeStyle";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { NamePatcher, getAllPropertyNames, fromSpinal, toSpinal, brushToString, stringToBrush, ensureEnum, enumToString, ensureBool, initializePropertiesFromCss } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
let IgcTreemapNodeStyleComponent = /*@__PURE__*/ (() => {
class IgcTreemapNodeStyleComponent extends IgcHTMLElement {
createImplementation() {
return new TreemapNodeStyle();
}
/**
* @hidden
*/
get i() {
return this._implementation;
} /**
* @hidden
*/
static _createFromInternal(internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
let name = internal.$type.name;
let externalName = "Igc" + name + "Component";
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
}
onImplementationCreated() {
}
constructor() {
super();
this._settingAttributes = false;
this._attached = false;
this._queuedSetAttributes = [];
this._updatingFromAttribute = false;
this.__p = null;
this._hasUserValues = new Set();
this._stylingContainer = null;
this._stylingParent = null;
this._inStyling = false;
if (this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
}
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
_enqueueSetAttribute(attrName, attrValue) {
this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
}
_flushQueuedAttributes() {
this._settingAttributes = true;
for (let i = 0; i < this._queuedSetAttributes.length; i++) {
this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue);
}
this._settingAttributes = false;
this._queuedSetAttributes.length = 0;
}
_a(attrName, attrValue) {
if (this._updatingFromAttribute) {
return;
}
if (attrValue) {
attrValue = attrValue.toString();
}
this._settingAttributes = true;
attrName = toSpinal(attrName);
if (this._attached) {
this.setAttribute(attrName, attrValue);
}
else {
this._enqueueSetAttribute(attrName, attrValue);
}
this._settingAttributes = false;
}
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 (IgcTreemapNodeStyleComponent._observedAttributesIgcTreemapNodeStyleComponent == null) {
let names = getAllPropertyNames(IgcTreemapNodeStyleComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcTreemapNodeStyleComponent._observedAttributesIgcTreemapNodeStyleComponent = names;
}
return IgcTreemapNodeStyleComponent._observedAttributesIgcTreemapNodeStyleComponent;
}
attributeChangedCallback(name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
let setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
}
static register() {
if (!IgcTreemapNodeStyleComponent._isElementRegistered) {
IgcTreemapNodeStyleComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcTreemapNodeStyleComponent.htmlTagName, IgcTreemapNodeStyleComponent);
}
}
/**
* Gets or sets the background to use for the header when it is hovered.
*/
get headerHoverBackground() {
return brushToString(this.i.bg);
}
set headerHoverBackground(v) {
this.i.bg = stringToBrush(v);
this._a("headerHoverBackground", brushToString(this.i.bg));
}
/**
* Gets or sets the background to use for the header.
*/
get headerBackground() {
return brushToString(this.i.bf);
}
set headerBackground(v) {
this.i.bf = stringToBrush(v);
this._a("headerBackground", brushToString(this.i.bf));
}
/**
* Gets or sets the text color to use for the header.
*/
get headerTextColor() {
return brushToString(this.i.bi);
}
set headerTextColor(v) {
this.i.bi = stringToBrush(v);
this._a("headerTextColor", brushToString(this.i.bi));
}
/**
* Gets or sets the label to use for the node.
*/
get label() {
return this.i.aq;
}
set label(v) {
this.i.aq = v;
}
/**
* Gets or sets the text color to use for the nodes.
*/
get textColor() {
return brushToString(this.i.bk);
}
set textColor(v) {
this.i.bk = stringToBrush(v);
this._a("textColor", brushToString(this.i.bk));
}
/**
* Gets or sets the text color to use for the header.
*/
get headerHoverTextColor() {
return brushToString(this.i.bh);
}
set headerHoverTextColor(v) {
this.i.bh = stringToBrush(v);
this._a("headerHoverTextColor", brushToString(this.i.bh));
}
/**
* Gets or sets the left margin to use for the header.
*/
get headerLabelLeftMargin() {
return this.i.u;
}
set headerLabelLeftMargin(v) {
this.i.u = +v;
this._a("headerLabelLeftMargin", this.i.u);
}
/**
* Gets or sets the top margin to use for the header.
*/
get headerLabelTopMargin() {
return this.i.w;
}
set headerLabelTopMargin(v) {
this.i.w = +v;
this._a("headerLabelTopMargin", this.i.w);
}
/**
* Gets or sets the right margin to use for the header.
*/
get headerLabelRightMargin() {
return this.i.v;
}
set headerLabelRightMargin(v) {
this.i.v = +v;
this._a("headerLabelRightMargin", this.i.v);
}
/**
* Gets or sets the bottom margin to use for the labels.
*/
get headerLabelBottomMargin() {
return this.i.t;
}
set headerLabelBottomMargin(v) {
this.i.t = +v;
this._a("headerLabelBottomMargin", this.i.t);
}
/**
* Gets or sets the left margin to use for the labels.
*/
get labelLeftMargin() {
return this.i.y;
}
set labelLeftMargin(v) {
this.i.y = +v;
this._a("labelLeftMargin", this.i.y);
}
/**
* Gets or sets the top margin to use for the labels.
*/
get labelTopMargin() {
return this.i.aa;
}
set labelTopMargin(v) {
this.i.aa = +v;
this._a("labelTopMargin", this.i.aa);
}
/**
* Gets or sets the right margin to use for the labels.
*/
get labelRightMargin() {
return this.i.z;
}
set labelRightMargin(v) {
this.i.z = +v;
this._a("labelRightMargin", this.i.z);
}
/**
* Gets or sets the bottom margin to use for the labels.
*/
get labelBottomMargin() {
return this.i.x;
}
set labelBottomMargin(v) {
this.i.x = +v;
this._a("labelBottomMargin", this.i.x);
}
/**
* Gets or sets the height to use for the header.
*/
get headerHeight() {
return this.i.s;
}
set headerHeight(v) {
this.i.s = +v;
this._a("headerHeight", this.i.s);
}
/**
* Gets or sets the horizontal alignment to use for the node labels.
*/
get labelHorizontalAlignment() {
return this.i.a6;
}
set labelHorizontalAlignment(v) {
this.i.a6 = ensureEnum(HorizontalAlignment_$type, v);
this._a("labelHorizontalAlignment", enumToString(HorizontalAlignment_$type, this.i.a6));
}
/**
* Gets or sets the vertical alignment to use for the node labels.
*/
get labelVerticalAlignment() {
return this.i.bm;
}
set labelVerticalAlignment(v) {
this.i.bm = ensureEnum(VerticalAlignment_$type, v);
this._a("labelVerticalAlignment", enumToString(VerticalAlignment_$type, this.i.bm));
}
/**
* Gets or sets the fill color to use for the nodes.
*/
get fill() {
return brushToString(this.i.be);
}
set fill(v) {
this.i.be = stringToBrush(v);
this._a("fill", brushToString(this.i.be));
}
/**
* Gets or sets the outline to use for the nodes.
*/
get outline() {
return brushToString(this.i.bj);
}
set outline(v) {
this.i.bj = stringToBrush(v);
this._a("outline", brushToString(this.i.bj));
}
/**
* Gets or sets the stroke thickness to use for the node outline.
*/
get strokeThickness() {
return this.i.ac;
}
set strokeThickness(v) {
this.i.ac = +v;
this._a("strokeThickness", this.i.ac);
}
/**
* Gets or sets the opacity to use for the node.
*/
get opacity() {
return this.i.ab;
}
set opacity(v) {
this.i.ab = +v;
this._a("opacity", this.i.ab);
}
/**
* Gets or sets the fade opacity that should be used when highlighting.
*/
get fadeOpacity() {
return this.i.r;
}
set fadeOpacity(v) {
this.i.r = +v;
this._a("fadeOpacity", this.i.r);
}
/**
* Gets or sets if highlighting was handled, and whether internal highlighting logic should be skipped.
*/
get highlightingHandled() {
return this.i.c;
}
set highlightingHandled(v) {
this.i.c = ensureBool(v);
this._a("highlightingHandled", this.i.c);
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
get hasUserValues() {
return this._hasUserValues;
}
__m(propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
}
_styling(container, component, parent) {
if (this._inStyling) {
return;
}
this._inStyling = true;
this._stylingContainer = container;
this._stylingParent = component;
let genericPrefix = "";
let typeName = this.i.$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("TreemapNodeStyleComponent");
let additionalPrefixes = [];
let prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
let b = this.i.$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
let basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
let parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
let parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
}
}
IgcTreemapNodeStyleComponent._observedAttributesIgcTreemapNodeStyleComponent = null;
IgcTreemapNodeStyleComponent.htmlTagName = "igc-treemap-node-style";
IgcTreemapNodeStyleComponent._isElementRegistered = false;
return IgcTreemapNodeStyleComponent;
})();
export { IgcTreemapNodeStyleComponent };