CrosstabEdgeIterator.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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(CrosstabEdgeIterator, _EdgeIterator);
  14. function CrosstabEdgeIterator() {
  15. _classCallCheck(this, CrosstabEdgeIterator);
  16. var _this = _possibleConstructorReturn(this, _EdgeIterator.apply(this, arguments));
  17. _this.EdgeIterator = CrosstabEdgeIterator;
  18. return _this;
  19. }
  20. CrosstabEdgeIterator.prototype.createLeafNodeInfo = function createLeafNodeInfo(descendant_or_self, value, currentEdge, ancestors, maxLevel) {
  21. var nodeInfo = {
  22. descendant_or_self: descendant_or_self,
  23. descendant_or_self_without_measures: currentEdge.isMeasure ? [] : descendant_or_self,
  24. index: this.currentKeyIndex,
  25. value: value,
  26. type: currentEdge.type,
  27. isSummary: currentEdge.isSummary,
  28. isOverallSummary: currentEdge.isOverallSummary,
  29. isLeafNode: true,
  30. ancestor_or_self: !ancestors ? [value] : ancestors.concat(value),
  31. nestLevel: currentEdge.level,
  32. isMeasure: currentEdge.isMeasure,
  33. summaryOf: currentEdge.summaryOf,
  34. formatSpec: currentEdge.formatSpec
  35. };
  36. if (!currentEdge.isSummary) {
  37. nodeInfo.cellIdx = currentEdge.cellIdx;
  38. }
  39. this.rollupSummariesOfDescendents(nodeInfo, value, maxLevel);
  40. return nodeInfo;
  41. };
  42. CrosstabEdgeIterator.prototype.createNodeInfo = function createNodeInfo(descendant_or_self, value, currentEdge, childNode, maxLevel) {
  43. var nodeInfo = {
  44. descendant_or_self: descendant_or_self,
  45. descendant_or_self_without_measures: currentEdge.isMeasure ? childNode.descendant_or_self_without_measures : descendant_or_self.concat(childNode.descendant_or_self_without_measures),
  46. index: this.numberOfLeafNodes - 1,
  47. value: value,
  48. type: currentEdge.type,
  49. isSummary: currentEdge.isSummary || childNode.isSummary,
  50. isOverallSummary: currentEdge.isOverallSummary || childNode.isOverallSummary,
  51. hasMeasureChildren: currentEdge.hasMeasureChildren,
  52. noOfChildren: this.subIterator.keys.length,
  53. hasLeafNode: childNode.isLeafNode || childNode.hasLeafNode,
  54. ancestor_or_self: this.ancestor_or_self,
  55. nestLevel: currentEdge.level,
  56. isMeasure: currentEdge.isMeasure,
  57. summaryOf: currentEdge.summaryOf || childNode.summaryOf,
  58. subCategory: childNode,
  59. formatSpec: currentEdge.formatSpec
  60. };
  61. this.rollupSummariesOfDescendents(nodeInfo, value, maxLevel, childNode);
  62. nodeInfo.descendant_or_self = nodeInfo.descendant_or_self.concat(childNode.descendant_or_self);
  63. if (!currentEdge.isSummary) {
  64. nodeInfo.cellIdx = currentEdge.cellIdx;
  65. }
  66. return nodeInfo;
  67. };
  68. return CrosstabEdgeIterator;
  69. }(EdgeIterator);
  70. });
  71. //# sourceMappingURL=CrosstabEdgeIterator.js.map