StoryNavControl.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['../navigation/ui/AutoHidingControl'], function (View) {
  8. var NavControl = View.extend({
  9. init: function init(options) {
  10. NavControl.inherited('init', this, arguments);
  11. this.subview = options.subview;
  12. },
  13. remove: function remove() {
  14. NavControl.inherited('remove', this, arguments);
  15. },
  16. _renderContent: function _renderContent() {
  17. if (this.subview) {
  18. this.subview.$el.appendTo(this.$el.empty()).show();
  19. }
  20. return Promise.resolve();
  21. },
  22. _show: function _show(options) {
  23. var _this = this;
  24. var duration = options && options.duration || 'fast';
  25. return new Promise(function (resolve) {
  26. _this.$el.css({
  27. 'pointer-events': ''
  28. });
  29. // You'd think it'd be slideUp here, but this is what works.
  30. _this.$el.slideDown(duration, function () {
  31. // Force refresh of the progress bar to ensure the scaleInfo is accurate.
  32. if (this.subview) {
  33. this.subview.updateProgressBar();
  34. }
  35. resolve();
  36. }.bind(_this));
  37. });
  38. },
  39. _hide: function _hide(options) {
  40. var _this2 = this;
  41. var duration = options && options.duration || 'fast';
  42. return new Promise(function (resolve) {
  43. if (_this2.subview && _this2.subview._flyout) {
  44. _this2.subview._flyout.close();
  45. }
  46. _this2.$el.css({
  47. 'pointer-events': 'none'
  48. });
  49. // You'd think it'd be slideDown here, but this is what works.
  50. _this2.$el.slideUp(duration, function () {
  51. resolve();
  52. });
  53. });
  54. }
  55. });
  56. return NavControl;
  57. });
  58. //# sourceMappingURL=StoryNavControl.js.map