123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- '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 Watson Analytics (C) Copyright IBM Corp. 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['jquery', '../../../lib/@waca/dashboard-common/dist/ui/AuthoringToolbar'], function ($, AuthoringToolbar) {
- 'use strict';
- /*
- * This class override the AuthoringToolbar default behaviours so that the toolbar
- * can synchronize the re-rendering of the DataSlotsView when the toolbar/flyout get
- * destroy(removed)
- *
- */
- var DataSlotsViewAuthoringToolbar = function (_AuthoringToolbar) {
- _inherits(DataSlotsViewAuthoringToolbar, _AuthoringToolbar);
- function DataSlotsViewAuthoringToolbar(options) {
- _classCallCheck(this, DataSlotsViewAuthoringToolbar);
- var _this = _possibleConstructorReturn(this, _AuthoringToolbar.call(this, options));
- DataSlotsViewAuthoringToolbar.inherited('init', _this, arguments);
- _this.dataSlotsView = options.dataSlotsView;
- _this.isShowingPreviousView = false;
- _this.isShowingNextView = false;
- _this.isRemoving = false;
- _this.on('flyout:hide', _this.onHideFlyout.bind(_this));
- _this.on('toolbar:hide', _this.onHideToolbar.bind(_this));
- return _this;
- }
- DataSlotsViewAuthoringToolbar.prototype.onHideFlyout = function onHideFlyout(event) {
- //Note that 'flyout:hide' is triggered when Flyout.close() is called
- //This is different that the 'toolbar:hide' hide event. The 'toolbar:hide' is called by the AuthoringToolbar when it destroys the flyout
- if (event instanceof $.Event) {
- // This event is triggered only when user clicks anywhere in Focuse Mode or press Escape to close and destroy the toolbar.
- this.dataSlotsView._clearToolbar();
- this.dataSlotsView._reRender();
- } else if (!this.isShowingPreviousView && !this.isShowingNextView && !this.isRemoving) {
- // Handle the case when the application manually call Flyout.close() to close the toolbar flyout
- // Currently only Filter flyouts manually call Flyout.close()
- this.dataSlotsView._setIsImplicitClosingTheToolbar(true);
- } else {
- this.dataSlotsView._clearToolbar();
- }
- };
- DataSlotsViewAuthoringToolbar.prototype.onHideToolbar = function onHideToolbar() {
- // Trigger by the AuthoringToolbar when it destroys the current opened flyout
- if (!this.isShowingPreviousView && !this.isShowingNextView && !this.isRemoving) {
- //Only reRender the if and only if:
- //1. Not launch NextView
- //2. Not click the top banner to go back to the previous view
- //3. Not destroying this toolbar
- this.dataSlotsView._reRender();
- } else if (!this.isShowingPreviousView && !this.isShowingNextView && this.isRemoving) {
- // cover case when leaving authoringToolbar and opening MUI (i.e. calculation dialog)
- // No previous or next value to show, and we are removing toolbar, in this case make sure
- // to clear the toolbar
- this.dataSlotsView._clearToolbar();
- }
- };
- DataSlotsViewAuthoringToolbar.prototype.showPreviousView = function showPreviousView() {
- var _AuthoringToolbar$pro;
- this.isShowingPreviousView = true;
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- (_AuthoringToolbar$pro = _AuthoringToolbar.prototype.showPreviousView).call.apply(_AuthoringToolbar$pro, [this].concat(args));
- };
- DataSlotsViewAuthoringToolbar.prototype.pushItemsOnStack = function pushItemsOnStack() {
- var _AuthoringToolbar$pro2;
- //This function is called when click to show NextView from the toolbar
- this.isShowingNextView = true;
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- (_AuthoringToolbar$pro2 = _AuthoringToolbar.prototype.pushItemsOnStack).call.apply(_AuthoringToolbar$pro2, [this].concat(args));
- };
- DataSlotsViewAuthoringToolbar.prototype.remove = function remove() {
- if (!this.isRemoving) {
- var _AuthoringToolbar$pro3;
- this.isRemoving = true;
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- (_AuthoringToolbar$pro3 = _AuthoringToolbar.prototype.remove).call.apply(_AuthoringToolbar$pro3, [this].concat(args));
- }
- };
- return DataSlotsViewAuthoringToolbar;
- }(AuthoringToolbar);
- return DataSlotsViewAuthoringToolbar;
- });
- //# sourceMappingURL=DataSlotsViewAuthoringToolbar.js.map
|