drilldown.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * DevExtreme (viz/tree_map/drilldown.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var proto = require("./tree_map.base").prototype;
  11. var _expand = require("../core/helpers").expand;
  12. require("./api");
  13. proto._eventsMap.onDrill = {
  14. name: "drill"
  15. };
  16. _expand(proto, "_extendProxyType", function(proto) {
  17. var that = this;
  18. proto.drillDown = function() {
  19. that._drillToNode(this._id)
  20. }
  21. });
  22. _expand(proto, "_onNodesCreated", function() {
  23. this._drilldownIndex = -1
  24. });
  25. proto._drillToNode = function(index) {
  26. var that = this;
  27. var node;
  28. if (that._drilldownIndex !== index) {
  29. node = that._nodes[index] || that._root;
  30. if (node.nodes) {
  31. that._drilldownIndex = index;
  32. that._topNode = node;
  33. that._context.suspend();
  34. that._context.change(["MAX_DEPTH", "NODES_RESET"]);
  35. that._context.resume();
  36. that._eventTrigger("drill", {
  37. node: node.proxy
  38. })
  39. }
  40. }
  41. };
  42. proto.resetDrillDown = function() {
  43. this._drillToNode(-1);
  44. return this
  45. };
  46. proto.drillUp = function() {
  47. this._drillToNode(this._topNode.parent._id || -1);
  48. return this
  49. };
  50. proto.getCurrentNode = function() {
  51. return this._topNode.proxy
  52. };