VIPRItemClass.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Business Analytics (C) Copyright IBM Corp. 2019, 2020
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['./VIPRDecoratable', '../../../widgets/livewidget/nls/StringResources', '../../../apiHelpers/SlotAPIHelper'], function (VIPRDecoratable, StringResources, SlotAPIHelper) {
  11. // implements IItemClass
  12. var VIPRItemClass = function (_VIPRDecoratable) {
  13. _inherits(VIPRItemClass, _VIPRDecoratable);
  14. function VIPRItemClass(dataItem, context) {
  15. _classCallCheck(this, VIPRItemClass);
  16. var _this = _possibleConstructorReturn(this, _VIPRDecoratable.apply(this, arguments));
  17. _this.dataItem = dataItem;
  18. _this.context = context;
  19. return _this;
  20. }
  21. VIPRItemClass.prototype.getUniqueName = function getUniqueName() {
  22. return this.dataItem.getColumnId();
  23. };
  24. VIPRItemClass.prototype.getCaption = function getCaption() {
  25. var summaryStr = void 0;
  26. if (!this.context.hideAggTypeInAxisLabels) {
  27. var aggregate = this.dataItem.getAggregation() || 'none';
  28. summaryStr = aggregate !== 'none' ? ' (' + StringResources.get(aggregate) + ')' : null;
  29. }
  30. var caption = this.dataItem.getLabel();
  31. if (this.getUniqueName() === SlotAPIHelper.MULTI_MEASURES_SERIES) {
  32. caption = StringResources.get('MeasuresCaption');
  33. }
  34. return summaryStr ? caption + summaryStr : caption;
  35. };
  36. return VIPRItemClass;
  37. }(VIPRDecoratable);
  38. return VIPRItemClass;
  39. });
  40. //# sourceMappingURL=VIPRItemClass.js.map