'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 Business Analytics (C) Copyright IBM Corp. 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @class LiveContentProvider * @hideconstructor * @classdesc API provider class to create LiveWidget ContentAPI instances */ define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../lib/@waca/dashboard-common/dist/api/ContentProviderAPI'], function (APIFactory, ContentProviderAPI) { var LiveContentProvider = function () { function LiveContentProvider(options) { _classCallCheck(this, LiveContentProvider); this._api = APIFactory.createAPI(this, [ContentProviderAPI]); this.base = options.features['BaseContentProvider']; this.datasources = options.features['DataSources']; options.features['ContentFactory'].registerProvider(this._api); } LiveContentProvider.prototype.getAPI = function getAPI() { return this._api; }; LiveContentProvider.prototype.getTypeList = function getTypeList() { return ['widget.live']; }; LiveContentProvider.prototype.addModel = function addModel(content, extra, options) { var _base; var widgetSpec = content && content.spec; if (widgetSpec) { this._addDataSource(widgetSpec, options); } return (_base = this.base).addModel.apply(_base, arguments); }; LiveContentProvider.prototype.createContent = function createContent() { var _base2; return (_base2 = this.base).createContent.apply(_base2, arguments); }; LiveContentProvider.prototype._addDataSource = function _addDataSource(widget, options) { var _this = this; var data = widget && widget.data; if (data && data.dataViews && data.dataViews.length) { data.dataViews.forEach(function (view) { if (view.model) { view.modelRef = _this.datasources.addDataSource(view.model, false, options); delete view.model; } }); } }; return LiveContentProvider; }(); return LiveContentProvider; }); //# sourceMappingURL=LiveContentProvider.js.map