LayoutModelData.js 972 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Storytelling
  5. * (C) Copyright IBM Corp. 2017, 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['underscore'], function (_) {
  9. return {
  10. /**
  11. * Update the data property of a model. This function will merge the provided data with the existing ones
  12. * @param model LayoutModel instance to update
  13. * @param data object containing the data that we would like to update
  14. * @returns a payload useful to the LayoutMmodel._callExtensionMethod method
  15. */
  16. update: function update(model, data) {
  17. if (!data) {
  18. return null;
  19. }
  20. if (!model.data) {
  21. model.data = {};
  22. }
  23. var prev = _.clone(model.data);
  24. _.extend(model.data, data);
  25. return {
  26. event: 'change:data',
  27. value: data,
  28. previousValue: prev
  29. };
  30. }
  31. };
  32. });
  33. //# sourceMappingURL=LayoutModelData.js.map