GridEdgeIterator.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. /**
  6. * Licensed Materials - Property of IBM
  7. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2016, 2020
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['../../../util/EdgeIterator'], function (EdgeIterator) {
  11. 'use strict';
  12. return function (_EdgeIterator) {
  13. _inherits(GridEdgeIterator, _EdgeIterator);
  14. function GridEdgeIterator() {
  15. _classCallCheck(this, GridEdgeIterator);
  16. var _this = _possibleConstructorReturn(this, _EdgeIterator.apply(this, arguments));
  17. _this.EdgeIterator = GridEdgeIterator;
  18. return _this;
  19. }
  20. GridEdgeIterator.prototype.createLeafNodeInfo = function createLeafNodeInfo(descendant_or_self, value, edge, maxLevel) {
  21. var nodeInfo = {
  22. descendant_or_self: descendant_or_self,
  23. index: this.currentKeyIndex,
  24. value: value,
  25. type: edge.type,
  26. isSummary: edge.isSummary,
  27. isOverallSummary: edge.isOverallSummary,
  28. isLeafNode: true,
  29. isMeasure: edge.isMeasure,
  30. summaryOf: edge.summaryOf,
  31. formatSpec: edge.formatSpec
  32. };
  33. if (!edge.isSummary) {
  34. nodeInfo.cellIdx = edge.cellIdx;
  35. }
  36. this.rollupSummariesOfDescendents(nodeInfo, value, maxLevel);
  37. return nodeInfo;
  38. };
  39. GridEdgeIterator.prototype.createNodeInfo = function createNodeInfo(descendant_or_self, value, edge, childNode, maxLevel) {
  40. var nodeInfo = {
  41. descendant_or_self: descendant_or_self,
  42. index: this.numberOfLeafNodes - 1,
  43. value: value,
  44. type: edge.type,
  45. isSummary: edge.isSummary || childNode.isSummary,
  46. isOverallSummary: edge.isOverallSummary || childNode.isOverallSummary,
  47. noOfChildren: this.subIterator.keys.length,
  48. hasLeafNode: childNode.isLeafNode || childNode.hasLeafNode,
  49. ancestor_or_self: this.ancestor_or_self,
  50. isMeasure: edge.isMeasure,
  51. summaryOf: edge.summaryOf || childNode.summaryOf,
  52. subCategory: childNode,
  53. formatSpec: edge.formatSpec
  54. };
  55. this.rollupSummariesOfDescendents(nodeInfo, value, maxLevel, childNode);
  56. nodeInfo.descendant_or_self = nodeInfo.descendant_or_self.concat(childNode.descendant_or_self);
  57. if (!edge.isSummary) {
  58. nodeInfo.cellIdx = edge.cellIdx;
  59. }
  60. return nodeInfo;
  61. };
  62. return GridEdgeIterator;
  63. }(EdgeIterator);
  64. });
  65. //# sourceMappingURL=GridEdgeIterator.js.map