SummaryPropertyCallbacks.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 Business Analytics (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. /**
  9. * @class KpiPropertyCallbacks
  10. * @hideconstructor
  11. * @classdesc This class provides APIs for dashboard avtivity state
  12. */
  13. define([], function () {
  14. /**
  15. * this class is used in VisPropertyProvider.
  16. */
  17. var SummaryPropertyCallbacks = function () {
  18. function SummaryPropertyCallbacks(options) {
  19. _classCallCheck(this, SummaryPropertyCallbacks);
  20. this.dashboardApi = options.features['API'];
  21. }
  22. SummaryPropertyCallbacks.prototype.getAPI = function getAPI() {
  23. // we have to return implementation here.
  24. return this;
  25. };
  26. SummaryPropertyCallbacks.prototype.preRenderAlignmentProperty = function preRenderAlignmentProperty(_content) {
  27. // [livewidget-cleanup] todo: once we have the infografic property, we can remove the dependence on view
  28. var curVis = _content.getFeature('livewidget.internal').getVisView();
  29. if (curVis.isInfographic()) {
  30. return {
  31. removeProperty: true //if we remove 'removeProperty' here, we should reimplement onChangeValueSizeProperty()
  32. };
  33. } else {
  34. return {};
  35. }
  36. };
  37. SummaryPropertyCallbacks.prototype.preRenderValueSizeProperty = function preRenderValueSizeProperty(_content, property) {
  38. // [livewidget-cleanup] todo: once we have the infografic property, we can remove the dependence on view
  39. var curVis = _content.getFeature('livewidget.internal').getVisView();
  40. var kpiPropertyCallbacks = this.dashboardApi.getFeature('KpiPropertyCallbacks');
  41. if (curVis.isInfographic()) {
  42. return {
  43. removeProperty: true //if we remove 'removeProperty' here, we should reimplement onChangeValueSizeProperty()
  44. };
  45. } else {
  46. return kpiPropertyCallbacks.preRenderValueSizeProperty(_content, property);
  47. }
  48. };
  49. SummaryPropertyCallbacks.prototype.preRenderBaseLabelProperty = function preRenderBaseLabelProperty(_content) {
  50. var kpiPropertyCallbacks = this.dashboardApi.getFeature('KpiPropertyCallbacks');
  51. return kpiPropertyCallbacks.preRenderBaseLabelProperty(_content);
  52. };
  53. SummaryPropertyCallbacks.prototype.preRenderFillDirectionProperty = function preRenderFillDirectionProperty(_content) {
  54. var curVis = _content.getFeature('livewidget.internal').getVisView();
  55. if (curVis.isInfographic()) {
  56. return {};
  57. } else {
  58. return {
  59. removeProperty: true //if we remove 'removeProperty' here, we should reimplement onChangeValueSizeProperty()
  60. };
  61. }
  62. };
  63. SummaryPropertyCallbacks.prototype.onChangeValueSizeProperty = function onChangeValueSizeProperty(_content, propertyName, propertyValue) {
  64. void propertyValue;
  65. void propertyName;
  66. /**
  67. * The property is not using now since we set "removeProperty:true".
  68. * [todo] if we want to re-enable the property, we should directly use widgetModel.properties...
  69. * There is an example in VisPropertyPropvider.
  70. */
  71. /*
  72. const transactionId = _.uniqueId('kpi_font_size');
  73. const ownerWidget = _content.getFeature('livewidget.internal').getWidget();
  74. ownerWidget.onPropertyUpdate({
  75. 'category': propertyName,
  76. 'item': propertyValue,
  77. 'transactionId': transactionId
  78. });
  79. */
  80. };
  81. return SummaryPropertyCallbacks;
  82. }();
  83. return SummaryPropertyCallbacks;
  84. });
  85. //# sourceMappingURL=SummaryPropertyCallbacks.js.map