PageContent.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. 2019
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. /**
  11. * @class PageContent
  12. * @classdesc This Content child class exists to abstract away the genericPage layout from contents of the page type. Objects of this class are created by the PageContentProvider.
  13. */
  14. define(['./Content'], function (Content) {
  15. var PageContent = function (_Content) {
  16. _inherits(PageContent, _Content);
  17. function PageContent() {
  18. _classCallCheck(this, PageContent);
  19. return _possibleConstructorReturn(this, _Content.apply(this, arguments));
  20. }
  21. PageContent.prototype.getType = function getType() {
  22. return 'page';
  23. };
  24. PageContent.prototype.getChildren = function getChildren() {
  25. var _this2 = this;
  26. var genericPage = this.layoutModel.items[0];
  27. if (genericPage.items) {
  28. return genericPage.items.map(function (item) {
  29. return _this2.getContent(item.id);
  30. });
  31. } else {
  32. return [];
  33. }
  34. };
  35. PageContent.prototype.addContent = function addContent(content) {
  36. var _Content$prototype$ad;
  37. if (content.containerId === this.layoutModel.id) {
  38. content.containerId = this.layoutModel.items[0].id;
  39. }
  40. return (_Content$prototype$ad = _Content.prototype.addContent).call.apply(_Content$prototype$ad, [this].concat(Array.prototype.slice.call(arguments)));
  41. };
  42. PageContent.prototype.moveContent = function moveContent(containerId, contentIdList, transactionToken) {
  43. containerId = this.layoutModel.items[0].id;
  44. return _Content.prototype.moveContent.call(this, containerId, contentIdList, transactionToken);
  45. };
  46. return PageContent;
  47. }(Content);
  48. return PageContent;
  49. });
  50. //# sourceMappingURL=PageContent.js.map