1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- '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: Dashboard
- * (C) Copyright IBM Corp. 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../lib/@waca/dashboard-common/dist/api/PropertiesProviderAPI', '../../../widgets/livewidget/nls/StringResources'], function (APIFactory, PropertiesProviderAPI, StringResources) {
- var PROP_ID_EXPANDCOLLAPSE = 'expandCollapse';
- var ExpandCollapsePropertyProvider = function () {
- function ExpandCollapsePropertyProvider(options) {
- _classCallCheck(this, ExpandCollapsePropertyProvider);
- this.content = options.content;
- // register self as a 'Properties' provider
- this.content && this.content.getFeature('Properties').registerProvider(this.getAPI());
- this.dashboard = options.dashboardAPI;
- }
- ExpandCollapsePropertyProvider.prototype.getAPI = function getAPI() {
- if (!this._api) {
- this._api = APIFactory.createAPI(this, [PropertiesProviderAPI]);
- }
- return this._api;
- };
- ExpandCollapsePropertyProvider.prototype.destroy = function destroy() {
- this.dashboard = null;
- this.content = null;
- };
- ExpandCollapsePropertyProvider.prototype.getPropertyLayoutList = function getPropertyLayoutList() {
- return [];
- };
- ExpandCollapsePropertyProvider.prototype.getPropertyList = function getPropertyList() {
- var _this = this;
- var propertyList = [];
- if (this._isSupported()) {
- propertyList.push({
- id: PROP_ID_EXPANDCOLLAPSE,
- editor: {
- 'sectionId': 'visualization.chart',
- uiControl: {
- type: 'ToggleButton',
- defaultValue: true,
- label: StringResources.get(PROP_ID_EXPANDCOLLAPSE),
- onChange: function onChange(propertyName, propertyValue) {
- _this.content.setPropertyValue(propertyName, propertyValue);
- }
- }
- },
- onPropertyChange: {
- refresh: {
- data: true
- }
- },
- defaultValue: true
- });
- }
- return propertyList;
- };
- ExpandCollapsePropertyProvider.prototype._isSupported = function _isSupported() {
- var expandCollapseFeatureFlag = !this.dashboard.getGlassCoreSvc('.FeatureChecker').checkValue('dashboard', 'expandCollapse', 'disabled');
- if (expandCollapseFeatureFlag) {
- var visApi = this.content.getFeature('Visualization');
- return visApi && this._isSupportedVisType(visApi) && this._isOlap(visApi);
- } else {
- return false;
- }
- };
- ExpandCollapsePropertyProvider.prototype._isSupportedVisType = function _isSupportedVisType(visApi) {
- return visApi.getType() === 'Crosstab';
- };
- ExpandCollapsePropertyProvider.prototype._isOlap = function _isOlap(visApi) {
- var mappedSlot = visApi.getSlots().getMappedSlotList();
- var dataItem = mappedSlot && mappedSlot[0] && mappedSlot[0].getDataItemList()[0];
- return dataItem && dataItem.getMetadataColumn().isOlapColumn() || false;
- };
- return ExpandCollapsePropertyProvider;
- }();
- return ExpandCollapsePropertyProvider;
- });
- //# sourceMappingURL=ExpandCollapsePropertyProvider.js.map
|