123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- 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; }
- 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; }
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../lib/@waca/core-client/js/core-client/ui/core/View', 'jquery', '../../app/ui/Splitter'], function (View, $) {
- return function (_View) {
- _inherits(SplitPaneView, _View);
- function SplitPaneView() {
- _classCallCheck(this, SplitPaneView);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- return _possibleConstructorReturn(this, _View.call.apply(_View, [this].concat(args)));
- }
- SplitPaneView.prototype.init = function init() {
- var _View$prototype$init;
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- (_View$prototype$init = _View.prototype.init).call.apply(_View$prototype$init, [this].concat(args));
- this.$bottom = null;
- this.$top = null;
- this.$content = null;
- this.splitter = null;
- var options = args[0];
- this._splitterItems = options.splitterItems || [];
- this.handlers = options.handlers;
- this.services = options.services;
- this.dashboard = options.dashboardApi;
- this.glassContext = options.services.biGlass.glassContext;
- };
- SplitPaneView.prototype.render = function render() {
- var _View$prototype$rende;
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- (_View$prototype$rende = _View.prototype.render).call.apply(_View$prototype$rende, [this].concat(args));
- var content = {};
- if (this.glassContext.appController.currentAppView.content) {
- content = this.glassContext.appController.currentAppView.content;
- }
- this.splitter = this.$el.splitter({
- items: this._splitterItems,
- panel: this.getBottomBarNode(),
- content: content,
- handlers: {
- getParentSize: this.handlers.getParentSize
- }
- }).data('splitter');
- this._setupEvents();
- return Promise.resolve();
- };
- SplitPaneView.prototype._setupEvents = function _setupEvents() {
- this.dashboard.on('enter:fullscreen', this.hideSplitter.bind(this));
- this.dashboard.on('exit:fullscreen', this.restoreSplitter.bind(this));
- };
- SplitPaneView.prototype.getBottomBarNode = function getBottomBarNode() {
- if (this.$bottom === null) {
- var $bottomPane = $('.bottomPane', this.el);
- if ($bottomPane.length === 0) {
- $bottomPane = $('<div class="bottomPane"></div>').appendTo(this.el);
- }
- this.$bottom = $bottomPane;
- }
- return this.$bottom;
- };
- SplitPaneView.prototype.getContentNode = function getContentNode() {
- if (this.$content === null) {
- var $contentNode = this.$('.pageViewContent', this.el);
- if ($contentNode.length === 0) {
- $contentNode = $('<div class="pageViewContent"></div>').prependTo(this.el);
- }
- this.$content = $contentNode;
- }
- return this.$content;
- };
- SplitPaneView.prototype.close = function close() {
- this.splitter.close();
- };
- SplitPaneView.prototype.open = function open() {
- this.splitter.open();
- };
- SplitPaneView.prototype.getSplitter = function getSplitter() {
- return this.splitter;
- };
- SplitPaneView.prototype.showHandle = function showHandle(handle) {
- this.splitter.showHandle(handle);
- };
- SplitPaneView.prototype.hideHandle = function hideHandle(handle) {
- this.splitter.hideHandle(handle);
- };
- SplitPaneView.prototype.onContainerReady = function onContainerReady() {
- var promises = [];
- this._splitterItems.forEach(function (item) {
- if (item.view.onContainerReady && typeof item.view.onContainerReady === 'function') {
- promises.push(item.view.onContainerReady());
- }
- }, this);
- return Promise.all(promises);
- };
- SplitPaneView.prototype.hideSplitter = function hideSplitter() {
- var _this2 = this;
- var result = void 0;
- if (this.splitter.isOpen()) {
- this._splitterWasOpen = true;
- result = this.splitter.close().then(function () {
- _this2._hideBottomPanel();
- });
- } else {
- this._hideBottomPanel();
- result = Promise.resolve();
- }
- return result.then(function () {
- _this2.splitter.hide();
- });
- };
- SplitPaneView.prototype.slideSplitterToMinSize = function slideSplitterToMinSize() {
- if (this.splitter.isOpen()) {
- this._splitterWasOpen = true;
- this.splitter.setPaneSize(120);
- }
- };
- SplitPaneView.prototype.restoreSplitter = function restoreSplitter() {
- var _this3 = this;
- this._showBottomPanel();
- return this.splitter.show().then(function () {
- if (_this3._splitterWasOpen) {
- _this3.splitter.open();
- _this3._splitterWasOpen = false;
- }
- });
- };
- SplitPaneView.prototype._hideBottomPanel = function _hideBottomPanel() {
- this.getBottomBarNode().hide();
- };
- SplitPaneView.prototype._showBottomPanel = function _showBottomPanel() {
- this.getBottomBarNode().show();
- };
- SplitPaneView.prototype.remove = function remove() {
- var _View$prototype$remov;
- this.dashboard.off('enter:fullscreen', this.hideSplitter.bind(this));
- this.dashboard.off('exit:fullscreen', this.restoreSplitter.bind(this));
- this.$el.destroySplitter();
- this.splitter = null;
- this.$bottom = null;
- this.$top = null;
- this.$content = null;
- this._splitterItems = null;
- this.handlers = null;
- this.services = null;
- this.glassContext = null;
- for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- args[_key4] = arguments[_key4];
- }
- (_View$prototype$remov = _View.prototype.remove).call.apply(_View$prototype$remov, [this].concat(args));
- };
- return SplitPaneView;
- }(View);
- });
- //# sourceMappingURL=SplitPaneView.js.map
|