'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017 * 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/Model'], function (Model) { var WidgetModel = null; WidgetModel = Model.extend({ runtimeAttrs: ['filters'], validLocalizedProps: ['content', 'title', 'altText', 'name'], validWidgetTypesForLocalizationProps: ['text', 'image', 'media', 'webpage'], init: function init(spec) { this._addLocalizedProps(spec); WidgetModel.inherited('init', this, arguments); if (spec) { this.whitelistAttrs = ['id']; for (var item in spec) { if (spec.hasOwnProperty(item)) { this.whitelistAttrs.push(item); } } } }, /** * Temp for R releases. We should try and get proper models for Endor instead of them all using the same one */ _addLocalizedProps: function _addLocalizedProps(spec) { var localizedProps = []; // This is needed because both the image and text widget use a property called 'content'. Make sure // we're only adding multilingual model properties for the widget we know have them. if (spec && this.validWidgetTypesForLocalizationProps.indexOf(spec.type) !== -1) { for (var item in spec) { if (spec.hasOwnProperty(item)) { if (this.validLocalizedProps.indexOf(item) !== -1) { localizedProps.push(item); } } } } this.localizedProps = localizedProps; }, cloneWidget: function cloneWidget(idMap) { var clone = new WidgetModel(this.toJSON()); clone.replaceIds(idMap); return clone; } }); return WidgetModel; }); //# sourceMappingURL=WidgetModel.js.map