123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Storytelling
- * (C) Copyright IBM Corp. 2014, 2022
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['baglass/core-client/js/core-client/ui/core/View', 'text!./templates/StoryPaneView.html', './FilmStripView', '../nls/StringResources', '../lib/@ba-ui-toolkit/ba-graphics/dist/icons-js/catalog_32'], function (View, Template, FilmStripView, stringResources, svgStoryCatalog) {
- var StoryPaneView = View.extend({
- templateString: Template,
- init: function init(options) {
- StoryPaneView.inherited('init', this, arguments);
- this.dashboardApi = options.dashboardApi;
- this.services = options.services;
- this.minimumSize = 200;
- },
- initialize: function initialize() {
- return this._setupEvents();
- },
- _setupEvents: function _setupEvents() {
- var _this = this;
- return this.dashboardApi.getDashboardSvc('.LifeCycleManager').then(function (LifeCycleManager) {
- LifeCycleManager.registerLifeCycleHandler('post:dashboard.focus', function () {
- if (_this.dashboardApi.getCurrentContentView().isAuthorMode()) {
- _this.trigger('openPane');
- }
- });
- LifeCycleManager.registerLifeCycleHandler('post:mode.edit', function () {
- _this.trigger('openPane');
- });
- _this.dashboardApi.on('widget:maximize', _this._disableAndSwitchHandlerListener, _this);
- _this.dashboardApi.on('widget:restore', _this._restoreHandlerListener, _this);
- });
- },
- _disableAndSwitchHandlerListener: function _disableAndSwitchHandlerListener() {
- this.trigger('disableAndSwitchHandle');
- },
- _restoreHandlerListener: function _restoreHandlerListener() {
- this.trigger('restoreHandle');
- },
- getSplitterOpts: function getSplitterOpts() {
- return Promise.resolve({
- handleClass: 'storyHandle',
- handleIcon: svgStoryCatalog.default.id,
- handleOpenTitle: stringResources.get('filmstripHandleOpenLabel'),
- handleCloseTitle: stringResources.get('filmstripHandleCloseLabel'),
- hidden: false,
- view: this,
- initialSize: 200,
- overrideGlobalMaxSize: 200
- });
- },
- /**
- * Renders the StoryPaneView and eventually renders the FilmStripView inside it.
- *
- * @returns Promise
- */
- render: function render() {
- var sHtml = this.dotTemplate();
- this.$el
- // the 'blockOnExpandView' class is used when widgets are expanded (in 'focus mode')
- .addClass('storytelling blockOnExpandView').html(sHtml);
- // Add the first view.
- return this._createFilmStrip();
- },
- remove: function remove() {
- if (this.filmStripView) {
- this.filmStripView.remove();
- }
- this.dashboardApi.off('widget:maximize', this._disableAndSwitchHandlerListener, this);
- this.dashboardApi.off('widget:restore', this._restoreHandlerListener, this);
- StoryPaneView.inherited('remove', this, arguments);
- },
- _createFilmStrip: function _createFilmStrip() {
- var _this2 = this;
- var blankNode = document.createElement('div');
- this.el.querySelector('.content').appendChild(blankNode);
- return Promise.all([this.dashboardApi.getDashboardSvc('.DndManager'), this.dashboardApi.getDashboardSvc('.StoryPaneService')]).then(function (_ref) {
- var dndManager = _ref[0],
- storyPaneController = _ref[1];
- _this2.filmStripView = new FilmStripView({
- el: blankNode,
- dashboardApi: _this2.dashboardApi,
- controller: storyPaneController,
- dndManager: dndManager,
- glassContext: _this2.services.biGlass.glassContext,
- services: _this2.services
- });
- return _this2.filmStripView.render();
- });
- }
- });
- return StoryPaneView;
- });
- //# sourceMappingURL=StoryPaneView.js.map
|