12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2019
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../../../lib/@waca/core-client/js/core-client/ui/core/Events'], function (Events) {
- var BasePropertyAction = null;
- BasePropertyAction = Events.extend({
- init: function init(controller) {
- this.controller = controller;
- this.dashboardApi = controller.dashboardApi;
- BasePropertyAction.inherited('init', this, arguments);
- },
- refreshProperties: function refreshProperties() {
- var _this = this;
- //Delay our update, as in relative layouts the model is updated again after being set to convert px sizes to %.
- setTimeout(function () {
- return _this.controller.eventRouter.trigger('properties:refreshPane');
- }, 100);
- },
- updateModel: function updateModel(styleUpdateArray, transactionToken) {
- var _this2 = this;
- var transactionApi = this.dashboardApi.getFeature('Transaction');
- var localTransactionToken = transactionApi.startTransaction(transactionToken);
- styleUpdateArray.forEach(function (styleUpdate) {
- var content = _this2.dashboardApi.getCanvas().getContent(styleUpdate.id);
- //set each property without validation first
- //This must be done so any validation in relation to previously set values is accurate
- // (ie - testing a 'left' property in relation to a 'width' property before the 'width' is set)
- var options = Object.assign(localTransactionToken || {}, { validatePropertyValue: false });
- Object.keys(styleUpdate.style).forEach(function (propertyName) {
- content.setPropertyValue(propertyName, styleUpdate.style[propertyName], localTransactionToken);
- });
- options = Object.assign(localTransactionToken || {}, { validatePropertyValue: true });
- //then validate each one.
- Object.keys(styleUpdate.style).forEach(function (propertyName) {
- content.setPropertyValue(propertyName, styleUpdate.style[propertyName], options);
- });
- });
- transactionApi.endTransaction(localTransactionToken);
- }
- });
- return BasePropertyAction;
- });
- //# sourceMappingURL=BasePropertyAction.js.map
|