'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['underscore', 'baglass/core-client/js/core-client/utils/BrowserUtils', 'gemini/lib/@waca/dashboard-common/dist/core/APIFactory', 'gemini/lib/@waca/dashboard-common/dist/api/PropertiesProviderAPI'], function (_, BrowserUtils, APIFactory, PropertiesProviderAPI) { var SUPPORTED_REVEAL_VIS_TYPES = ['Line', 'Column', 'StackedColumn', 'Bar', 'StackedBar']; var RevealPropertiesProvider = function () { function RevealPropertiesProvider(options) { _classCallCheck(this, RevealPropertiesProvider); this.dashboardApi = options.dashboardAPI; this.content = options.content; this.stringResources = this.dashboardApi.getFeature('.StringResources'); this._api = APIFactory.createAPI(this, [PropertiesProviderAPI]); // register self as a properties provider contributing storytelling RevealPropertiesProvider properties this.content.getFeature('Properties').registerProvider(this.getAPI()); } RevealPropertiesProvider.prototype.getAPI = function getAPI() { return this._api; }; RevealPropertiesProvider.prototype.getPropertyLayoutList = function getPropertyLayoutList() { if (!this._isVisTypeSupported() || !this._shouldShow()) { return []; } return [{ id: 'animation', type: 'Group', label: this.stringResources.get('tabName_animation') }, { id: 'propAniTypeDataEntrance', type: 'Section', label: this.stringResources.get('propAniTypeDataEntrance'), position: 0 }]; }; RevealPropertiesProvider.prototype.getPropertyList = function getPropertyList() { if (!this._isVisTypeSupported() || !this._shouldShow()) { return []; } return this._getRevealPropertiesList(); }; RevealPropertiesProvider.prototype._isVisTypeSupported = function _isVisTypeSupported() { return SUPPORTED_REVEAL_VIS_TYPES.indexOf(this._getVisType()) !== -1; }; RevealPropertiesProvider.prototype._getVisType = function _getVisType() { return this.content.getFeature('Visualization').getType(); }; RevealPropertiesProvider.prototype._shouldShow = function _shouldShow() { var timelineController = this.dashboardApi.getFeature('.StoryPaneService').timelineController; var episode = timelineController.getTimelineEpisodeById(this.content.getId()); if (!episode) { return false; } else { return !BrowserUtils.isIE11() && !episode.touchesStart(); } }; RevealPropertiesProvider.prototype._getRevealPropertiesList = function _getRevealPropertiesList() { if (this._getVisType() === 'Line') { return [{ id: 'effect.entry.line.type', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 1 } }, { id: 'effect.entry.line.stagger', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 2 } }, { id: 'effect.entry.line.duration', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 3, uiControl: { decimalPlaces: 2, label: this.stringResources.get('propAniRevealDuration'), ariaLabel: this.stringResources.get('propAniRevealDuration') } } }]; } else { return [{ id: 'effect.entry.bar.type', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 1 } }, { id: 'effect.entry.bar.stagger', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 2 } }, { id: 'effect.entry.bar.duration', editor: { sectionId: 'animation.propAniTypeDataEntrance', hidden: false, position: 3, uiControl: { decimalPlaces: 2, label: this.stringResources.get('propAniRevealDuration'), ariaLabel: this.stringResources.get('propAniRevealDuration') } } }]; } }; return RevealPropertiesProvider; }(); return RevealPropertiesProvider; }); //# sourceMappingURL=RevealPropertiesProvider.js.map