igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
491 lines (490 loc) • 15.4 kB
JavaScript
import { __extends, __values } from "tslib";
import * as React from 'react';
import { HorizontalAlignment_$type } from "igniteui-react-core";
import { VerticalAlignment_$type } from "igniteui-react-core";
import { TreemapNodeStyle } from "./TreemapNodeStyle";
import { TypeRegistrar } from "igniteui-react-core";
import { NamePatcher, getModifiedProps, isValidProp, brushToString, stringToBrush, ensureEnum, ensureBool, toSpinal, initializePropertiesFromCss } from "igniteui-react-core";
/**
* Represents a style to apply to a treemap node.
*/
var IgrTreemapNodeStyle = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrTreemapNodeStyle, _super);
function IgrTreemapNodeStyle(props) {
var _this = _super.call(this, props) || this;
_this.mounted = 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;
}
IgrTreemapNodeStyle.prototype.createImplementation = function () {
return new TreemapNodeStyle();
};
Object.defineProperty(IgrTreemapNodeStyle.prototype, "nativeElement", {
get: function () {
return this._implementation.nativeElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgrTreemapNodeStyle._createFromInternal = function (internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
var name = internal.$type.name;
var externalName = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
};
IgrTreemapNodeStyle.prototype.onImplementationCreated = function () {
};
IgrTreemapNodeStyle.prototype.componentDidMount = function () {
var e_1, _a;
this.mounted = true;
try {
for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
};
IgrTreemapNodeStyle.prototype.shouldComponentUpdate = function (nextProps, nextState) {
var e_2, _a;
var mod = getModifiedProps(this.props, nextProps);
try {
for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
return true;
};
IgrTreemapNodeStyle.prototype.render = function () {
return null;
};
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrTreemapNodeStyle.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);
},
enumerable: false,
configurable: true
});
IgrTreemapNodeStyle.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
Object.defineProperty(IgrTreemapNodeStyle.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgrTreemapNodeStyle.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgrTreemapNodeStyle.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("TreemapNodeStyle");
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;
};
return IgrTreemapNodeStyle;
}(React.Component));
export { IgrTreemapNodeStyle };