ExpandAction.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018, 2020
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['../../../../lib/@waca/core-client/js/core-client/ui/core/Class', 'jquery', 'doT', 'text!./ExpandEdges.html', '../../../../app/nls/StringResources'], function (Class, $, dot, Template, stringResources) {
  8. var ExpandAction = Class.extend({
  9. init: function init(controller) {
  10. this.controller = controller;
  11. },
  12. newSelection: function newSelection(nodes) {
  13. var iconsFeature = this.controller.dashboardApi.getFeature('Icons');
  14. var expandIcon = iconsFeature.getIcon('maximize');
  15. var html = dot.template(Template)({
  16. expandIcon: expandIcon.id
  17. });
  18. // Only show the expand action for widgets that are maximizable.
  19. $(nodes).filter('.maximizable').append(html).find('.expandHandle').attr('title', stringResources.get('expandHandle')).on('primaryaction', this.onExpand.bind(this));
  20. },
  21. onExpand: function onExpand(event) {
  22. var node = $(event.target).closest('.maximizable');
  23. if (node.length) {
  24. var n = node[0];
  25. if (n._layout) {
  26. n._layout.onMaximize();
  27. }
  28. }
  29. }
  30. });
  31. return ExpandAction;
  32. });
  33. //# sourceMappingURL=ExpandAction.js.map