1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- '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_SUPPRESSION = 'suppression';
- var SuppressionPropertyProvider = function () {
- function SuppressionPropertyProvider(options) {
- _classCallCheck(this, SuppressionPropertyProvider);
- this.content = options.content;
- // register self as a 'Properties' provider
- this.content && this.content.getFeature('Properties').registerProvider(this.getAPI());
- }
- SuppressionPropertyProvider.prototype.getAPI = function getAPI() {
- if (!this._api) {
- this._api = APIFactory.createAPI(this, [PropertiesProviderAPI]);
- }
- return this._api;
- };
- SuppressionPropertyProvider.prototype.destroy = function destroy() {
- this.content = null;
- };
- SuppressionPropertyProvider.prototype.getPropertyLayoutList = function getPropertyLayoutList() {
- return [];
- };
- SuppressionPropertyProvider.prototype.getPropertyList = function getPropertyList() {
- var _this = this;
- var propertyList = [];
- if (this._isSupported()) {
- propertyList.push({
- id: PROP_ID_SUPPRESSION,
- editor: {
- 'sectionId': 'visualization.chart',
- uiControl: {
- type: 'ToggleButton',
- defaultValue: 'rowsAndColumns',
- label: StringResources.get(PROP_ID_SUPPRESSION),
- onChange: function onChange(propertyName, propertyValue) {
- var overrideValue = propertyValue === false ? 'none' : 'rowsAndColumns';
- _this.content.setPropertyValue(propertyName, overrideValue);
- }
- }
- },
- onPropertyChange: {
- refresh: {
- data: true
- }
- },
- defaultValue: 'rowsAndColumns'
- });
- }
- return propertyList;
- };
- SuppressionPropertyProvider.prototype._isSupported = function _isSupported() {
- var visApi = this.content.getFeature('Visualization');
- return visApi && this._isSupportedVisType(visApi);
- };
- SuppressionPropertyProvider.prototype._isSupportedVisType = function _isSupportedVisType(visApi) {
- return visApi.getType() === 'Crosstab' || visApi.getType() === 'List';
- };
- SuppressionPropertyProvider.prototype._isOlap = function _isOlap(visApi) {
- var mappedSlot = visApi.getSlots().getMappedSlotList();
- var dataItem = mappedSlot[0] && mappedSlot[0].getDataItemList()[0];
- return dataItem && dataItem.getMetadataColumn().isOlapColumn() || false;
- };
- return SuppressionPropertyProvider;
- }();
- return SuppressionPropertyProvider;
- });
- //# sourceMappingURL=SuppressionPropertyProvider.js.map
|