devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
69 lines (65 loc) • 2 kB
JavaScript
/**
* DevExtreme (cjs/__internal/viz/tree_map/node.js)
* Version: 25.2.3
* Build date: Fri Dec 12 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extend2 = require("../../../core/utils/extend");
function Node() {}
const updateTile = [updateLeaf, updateGroup];
(0, _extend2.extend)(Node.prototype, {
value: 0,
isNode() {
return !!(this.nodes && this.level < this.ctx.maxLevel)
},
isActive() {
const {
ctx: ctx
} = this;
return this.level >= ctx.minLevel && this.level <= ctx.maxLevel
},
updateStyles() {
const isNode = Number(this.isNode());
this.state = this._buildState(this.ctx.settings[isNode].state, !isNode && this.color && {
fill: this.color
})
},
_buildState(state, extra) {
const base = (0, _extend2.extend)({}, state);
return extra ? (0, _extend2.extend)(base, extra) : base
},
updateLabelStyle() {
const settings = this.ctx.settings[Number(this.isNode())];
this.labelState = settings.labelState;
this.labelParams = settings.labelParams
},
_getState() {
return this.state
},
applyState() {
updateTile[Number(this.isNode())](this.tile, this._getState())
}
});
function updateLeaf(content, attrs) {
content.smartAttr(attrs)
}
function updateGroup(content, attrs) {
content.outer.attr({
stroke: attrs.stroke,
"stroke-width": attrs["stroke-width"],
"stroke-opacity": attrs["stroke-opacity"]
});
content.inner.smartAttr({
fill: attrs.fill,
opacity: attrs.opacity,
hatching: attrs.hatching
})
}
var _default = exports.default = Node;