devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
65 lines (63 loc) • 1.8 kB
JavaScript
/**
* DevExtreme (esm/__internal/viz/tree_map/states.js)
* Version: 25.2.5
* Build date: Fri Feb 20 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
noop
} from "../../../core/utils/common";
import {
extend as _extend
} from "../../../core/utils/extend";
import Node from "../../viz/tree_map/node";
import TreeMapBase from "../../viz/tree_map/tree_map.base";
const proto = TreeMapBase.prototype;
const nodeProto = Node.prototype;
const handlers = proto._handlers;
const _calculateState = handlers.calculateState;
const {
_buildState: _buildState
} = nodeProto;
handlers.calculateState = function(options) {
const states = {
0: _calculateState(options)
};
handlers.calculateAdditionalStates(states, options);
return states
};
handlers.calculateAdditionalStates = noop;
nodeProto.code = 0;
nodeProto.statesMap = {
0: 0
};
nodeProto.additionalStates = [];
nodeProto._buildState = function(state, extra) {
const states = {
0: _buildState(state[0], extra)
};
if (this.additionalStates.length) {
buildAdditionalStates(states, states[0], state, this.additionalStates)
}
return states
};
nodeProto._getState = function() {
return this.state[this.statesMap[this.code]]
};
nodeProto.setState = function(code, state) {
if (state) {
this.code |= code
} else {
this.code &= ~code
}
this.ctx.change(["TILES"])
};
function buildAdditionalStates(states, base, source, list) {
let i;
const ii = list.length;
for (i = 0; i < ii; ++i) {
states[list[i]] = _extend({}, base, source[list[i]])
}
}