| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | 
							- 'use strict';
 
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
 
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
- /*
 
-  *+------------------------------------------------------------------------+
 
-  *| Licensed Materials - Property of IBM
 
-  *| IBM Cognos Products: BI Dashboard
 
-  *| (C) Copyright IBM Corp. 2020
 
-  *|
 
-  *| US Government Users Restricted Rights - Use, duplication or disclosure
 
-  *| restricted by GSA ADP Schedule Contract with IBM Corp.
 
-  *+------------------------------------------------------------------------+
 
-  */
 
- define(['underscore', '../../../lib/@waca/upgrades/UpgradeBase', './utils/WidgetUpgradeUtils'], function (_, UpgradeBase, WidgetUpgradeUtils) {
 
- 	/**
 
-  * Bar based chart types before R7 ignored the valueAxis.zeroOrigin property
 
-  * To avoid upgraded charts looking different we want to ensure that if a
 
-  * vis had this property set previously (say it was a line chart, the prop was
 
-  * changed and then the vis was changed to a bar chart and saved) then we have
 
-  * to set the prop to true for these chart types.
 
-  **/
 
- 	var ColBarZeroOriginValueUpgrade = function (_UpgradeBase) {
 
- 		_inherits(ColBarZeroOriginValueUpgrade, _UpgradeBase);
 
- 		function ColBarZeroOriginValueUpgrade() {
 
- 			_classCallCheck(this, ColBarZeroOriginValueUpgrade);
 
- 			var _this = _possibleConstructorReturn(this, _UpgradeBase.call(this));
 
- 			_this.VERSION = 1801;
 
- 			return _this;
 
- 		}
 
- 		/**
 
-    * Perform upgrade
 
-    *
 
-    * @param {object} spec - spec to perform upgrade on
 
-    *
 
-    * @return {Promise} Promise to be resolved when upgrade performed
 
-    */
 
- 		ColBarZeroOriginValueUpgrade.prototype.up = function up(spec) {
 
- 			var _this2 = this;
 
- 			if (!spec) {
 
- 				return Promise.resolve(spec);
 
- 			}
 
- 			if (!WidgetUpgradeUtils.specHasWidgets(spec)) {
 
- 				return Promise.resolve(spec);
 
- 			}
 
- 			/*
 
-    * Cycle through all widgets and, if they are live widgets, upgrade the property.
 
-    */
 
- 			_.each(spec.widgets, function (model) {
 
- 				if (model && WidgetUpgradeUtils.isLiveWidgetModel(model)) {
 
- 					if (!model.properties) {
 
- 						model.properties = [];
 
- 					}
 
- 					_this2._colBarZeroOriginValueUpgrade(model);
 
- 				}
 
- 			});
 
- 			return Promise.resolve(spec);
 
- 		};
 
- 		// Downgrades are not available in CA
 
- 		ColBarZeroOriginValueUpgrade.prototype.down = function down(spec) {
 
- 			return Promise.resolve(spec);
 
- 		};
 
- 		ColBarZeroOriginValueUpgrade.prototype._colBarZeroOriginValueUpgrade = function _colBarZeroOriginValueUpgrade(model) {
 
- 			var needsUpgradeVisIds = ['com.ibm.vis.rave2bundlebar', 'com.ibm.vis.rave2bundlecolumn', 'com.ibm.vis.rave2bundlestackedbar', 'com.ibm.vis.rave2bundlestackedcolumn'];
 
- 			if (_.contains(needsUpgradeVisIds, model.visId)) {
 
- 				var zeroOriginPropId = 'valueAxis.zeroOrigin';
 
- 				var zeroOriginProp = WidgetUpgradeUtils.findProperty(zeroOriginPropId, model.properties);
 
- 				if (zeroOriginProp) {
 
- 					zeroOriginProp.value = true;
 
- 				}
 
- 			}
 
- 		};
 
- 		return ColBarZeroOriginValueUpgrade;
 
- 	}(UpgradeBase);
 
- 	return new ColBarZeroOriginValueUpgrade();
 
- });
 
- //# sourceMappingURL=ColBarZeroOriginValueUpgrade.js.map
 
 
  |