12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI
- * (C) Copyright IBM Corp. 2019, 2020
- * 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', './properties/PropertiesModel'], function (Model, PropertiesModel) {
- var ContentModel = Model.extend({
- nestedModels: {
- properties: PropertiesModel
- },
- whitelistAttrs: ['properties', 'features'],
- init: function init() {
- var contentSpec = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- ContentModel.inherited('init', this, arguments);
- if (contentSpec.conditionalFormatting) {
- this.whitelistAttrs.push('conditionalFormatting');
- }
- this.features = contentSpec.features || {};
- },
- /**
- * Sets a property in the nested PropertiesModel. If the PropertiesModel doesn't exist yet, a default empty one is created
- * @param {String} propertyName - The name of the property to set
- * @param {Object} propertyValue - The value to set
- * @param {TransactionToken} options
- */
- setPropertyValue: function setPropertyValue(propertyName, propertyValue, options) {
- if (!this.properties) {
- this.properties = new PropertiesModel();
- }
- this.properties.setPropertyValue(propertyName, propertyValue, options);
- },
- /**
- * Gets a property value from the nested PropertyModel. If the property model doesn't exist, undefined is returned.
- * @param {String} propertyName - The name of the property to set
- */
- getPropertyValue: function getPropertyValue(propertyName) {
- if (!this.properties) {
- return undefined;
- }
- return this.properties.getPropertyValue(propertyName);
- },
- /**
- * This is temporary until the code to allow a feature to contibute to our model is complete
- */
- getConditionalFormatting: function getConditionalFormatting() {
- return this.get('conditionalFormatting');
- },
- /**
- * This is temporary until the code to allow a feature to contibute to our model is complete
- */
- setConditionalFormatting: function setConditionalFormatting(value, options) {
- if (this.whitelistAttrs.indexOf('conditionalFormatting') === -1) {
- this.whitelistAttrs.push('conditionalFormatting');
- }
- var paylaod = {
- conditionalFormatting: value
- };
- this.set(paylaod, options);
- }
- });
- return ContentModel;
- });
- //# sourceMappingURL=ContentModel.js.map
|