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