TextWidgetScrollBarUtil.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['jquery', './ScrollBarUtil'], function ($, ScrollBarUtil) {
  8. var TextWidgetScrollBarUtil = null;
  9. TextWidgetScrollBarUtil = ScrollBarUtil.extend({
  10. /**
  11. * Initialize the utility with the specified models
  12. *
  13. * @param {JQuery|HTMLElement} inner - Inner DOM element
  14. * @param {JQuery|HTMLElement} outer - Outer DOM element
  15. * @param event
  16. */
  17. init: function init(inner, outer, event) {
  18. ScrollBarUtil.inherited('init', this, arguments);
  19. this.inner = inner || null;
  20. this.outer = outer || null;
  21. this.event = event || null;
  22. },
  23. /**
  24. * @param {JQuery} - DOM Element
  25. */
  26. _hasStaticContentClass: function _hasStaticContentClass(element) {
  27. return element.context.classList.contains('staticContent');
  28. },
  29. /**
  30. * TextWidget has a special case for getting the client width
  31. *
  32. * @param {JQuery} element - DOM element
  33. */
  34. _getContextClientWidth: function _getContextClientWidth(element) {
  35. TextWidgetScrollBarUtil.inherited('_getContextClientWidth', this, arguments);
  36. var clientWidth;
  37. if (this._hasStaticContentClass(element)) {
  38. clientWidth = element.context.clientWidth;
  39. } else {
  40. clientWidth = $(element.context).parents('.staticContent').get(0).clientWidth;
  41. }
  42. return clientWidth;
  43. }
  44. });
  45. return TextWidgetScrollBarUtil;
  46. });
  47. //# sourceMappingURL=TextWidgetScrollBarUtil.js.map