'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', './TextWidgetTypesUpgradeHelper'], function (_, TextWidgetTypesUpgradeHelper) { var LIVE_WIDGET_TYPE = 'live'; var THEME_DEFAULT = 'defaultTheme'; var WidgetTitleUpgradeHelper = function (_TextWidgetTypesUpgra) { _inherits(WidgetTitleUpgradeHelper, _TextWidgetTypesUpgra); function WidgetTitleUpgradeHelper() { _classCallCheck(this, WidgetTitleUpgradeHelper); return _possibleConstructorReturn(this, _TextWidgetTypesUpgra.apply(this, arguments)); } /** * Upgrade the widget title (<1083) to keep the old default font family by replacing its css class. * @override */ WidgetTitleUpgradeHelper.prototype._upgradeWidgets = function _upgradeWidgets(spec) { var _this2 = this; try { _.each(spec.widgets, function (model) { if (model.type === LIVE_WIDGET_TYPE) { _this2._upgradeWidgetTitle(spec.theme, model); } }); } catch (error) { throw error; } }; WidgetTitleUpgradeHelper.prototype._upgradeWidgetTitle = function _upgradeWidgetTitle() { var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : THEME_DEFAULT; var model = arguments[1]; if (!model.titleHtml) { return; } var table = model.titleHtml.translationTable; if (table) { for (var lang in table) { table[lang] = this._upgradeContent(theme, table[lang]); } } else if (typeof model.titleHtml === 'string') { model.titleHtml = this._upgradeContent(theme, model.titleHtml); } }; return WidgetTitleUpgradeHelper; }(TextWidgetTypesUpgradeHelper); return WidgetTitleUpgradeHelper; }); //# sourceMappingURL=WidgetTitleUpgradeHelper.js.map