12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 'use strict';
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI
- * (C) Copyright IBM Corp. 2019
- * 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 PropertiesModel = Model.extend({
- init: function init() {
- var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- PropertiesModel.inherited('init', this, arguments);
- // Add any property that's already in the model to the white list. This is so that
- // we don't lose properties that were added by features dynamically on subsequent saves
- for (var property in model) {
- this.whitelistAttrs.push(property);
- }
- },
- setPropertyValue: function setPropertyValue(propertyName, propertyValue, options) {
- // Ensures that the property name is part of the white list
- if (this.whitelistAttrs.indexOf(propertyName) === -1) {
- this.whitelistAttrs.push(propertyName);
- }
- var payload = {};
- // if the property value is an object, clone it before we store it.
- payload[propertyName] = propertyValue && (typeof propertyValue === 'undefined' ? 'undefined' : _typeof(propertyValue)) === 'object' ? JSON.parse(JSON.stringify(propertyValue)) : propertyValue;
- this.set(payload, options);
- },
- getPropertyValue: function getPropertyValue(propertyName) {
- var value = this.get(propertyName);
- if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
- // If the value is an object return a clone. This will force the caller to call
- // setPropertyValue to make changes to the model instead of just modifying the object directly
- value = JSON.parse(JSON.stringify(value));
- }
- return value;
- }
- });
- return PropertiesModel;
- });
- //# sourceMappingURL=PropertiesModel.js.map
|