RevealPropertiesProvider.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. 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) {
  9. var SUPPORTED_REVEAL_VIS_TYPES = ['Line', 'Column', 'StackedColumn', 'Bar', 'StackedBar'];
  10. var RevealPropertiesProvider = function () {
  11. function RevealPropertiesProvider(options) {
  12. _classCallCheck(this, RevealPropertiesProvider);
  13. this.dashboardApi = options.dashboardAPI;
  14. this.content = options.content;
  15. this.stringResources = this.dashboardApi.getFeature('.StringResources');
  16. this._api = APIFactory.createAPI(this, [PropertiesProviderAPI]);
  17. // register self as a properties provider contributing storytelling RevealPropertiesProvider properties
  18. this.content.getFeature('Properties').registerProvider(this.getAPI());
  19. }
  20. RevealPropertiesProvider.prototype.getAPI = function getAPI() {
  21. return this._api;
  22. };
  23. RevealPropertiesProvider.prototype.getPropertyLayoutList = function getPropertyLayoutList() {
  24. if (!this._isVisTypeSupported() || !this._shouldShow()) {
  25. return [];
  26. }
  27. return [{
  28. id: 'animation',
  29. type: 'Group',
  30. label: this.stringResources.get('tabName_animation')
  31. }, {
  32. id: 'propAniTypeDataEntrance',
  33. type: 'Section',
  34. label: this.stringResources.get('propAniTypeDataEntrance'),
  35. position: 0
  36. }];
  37. };
  38. RevealPropertiesProvider.prototype.getPropertyList = function getPropertyList() {
  39. if (!this._isVisTypeSupported() || !this._shouldShow()) {
  40. return [];
  41. }
  42. return this._getRevealPropertiesList();
  43. };
  44. RevealPropertiesProvider.prototype._isVisTypeSupported = function _isVisTypeSupported() {
  45. return SUPPORTED_REVEAL_VIS_TYPES.indexOf(this._getVisType()) !== -1;
  46. };
  47. RevealPropertiesProvider.prototype._getVisType = function _getVisType() {
  48. return this.content.getFeature('Visualization').getType();
  49. };
  50. RevealPropertiesProvider.prototype._shouldShow = function _shouldShow() {
  51. var timelineController = this.dashboardApi.getFeature('.StoryPaneService').timelineController;
  52. var episode = timelineController.getTimelineEpisodeById(this.content.getId());
  53. if (!episode) {
  54. return false;
  55. } else {
  56. return !BrowserUtils.isIE11() && !episode.touchesStart();
  57. }
  58. };
  59. RevealPropertiesProvider.prototype._getRevealPropertiesList = function _getRevealPropertiesList() {
  60. if (this._getVisType() === 'Line') {
  61. return [{
  62. id: 'effect.entry.line.type',
  63. editor: {
  64. sectionId: 'animation.propAniTypeDataEntrance',
  65. hidden: false,
  66. position: 1
  67. }
  68. }, {
  69. id: 'effect.entry.line.stagger',
  70. editor: {
  71. sectionId: 'animation.propAniTypeDataEntrance',
  72. hidden: false,
  73. position: 2
  74. }
  75. }, {
  76. id: 'effect.entry.line.duration',
  77. editor: {
  78. sectionId: 'animation.propAniTypeDataEntrance',
  79. hidden: false,
  80. position: 3,
  81. uiControl: {
  82. decimalPlaces: 2,
  83. label: this.stringResources.get('propAniRevealDuration'),
  84. ariaLabel: this.stringResources.get('propAniRevealDuration')
  85. }
  86. }
  87. }];
  88. } else {
  89. return [{
  90. id: 'effect.entry.bar.type',
  91. editor: {
  92. sectionId: 'animation.propAniTypeDataEntrance',
  93. hidden: false,
  94. position: 1
  95. }
  96. }, {
  97. id: 'effect.entry.bar.stagger',
  98. editor: {
  99. sectionId: 'animation.propAniTypeDataEntrance',
  100. hidden: false,
  101. position: 2
  102. }
  103. }, {
  104. id: 'effect.entry.bar.duration',
  105. editor: {
  106. sectionId: 'animation.propAniTypeDataEntrance',
  107. hidden: false,
  108. position: 3,
  109. uiControl: {
  110. decimalPlaces: 2,
  111. label: this.stringResources.get('propAniRevealDuration'),
  112. ariaLabel: this.stringResources.get('propAniRevealDuration')
  113. }
  114. }
  115. }];
  116. }
  117. };
  118. return RevealPropertiesProvider;
  119. }();
  120. return RevealPropertiesProvider;
  121. });
  122. //# sourceMappingURL=RevealPropertiesProvider.js.map