NonVIPREventTarget.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. /**
  6. * Licensed Materials - Property of IBM
  7. * IBM Watson Analytics (C) Copyright IBM Corp. 2018, 2019
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['./EventTarget', 'jquery', '../../../util/KeyCodes'], function (EventTarget, $, KeyCodes) {
  11. var NonVIPREventTarget = function (_EventTarget) {
  12. _inherits(NonVIPREventTarget, _EventTarget);
  13. function NonVIPREventTarget() {
  14. _classCallCheck(this, NonVIPREventTarget);
  15. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  16. args[_key] = arguments[_key];
  17. }
  18. return _possibleConstructorReturn(this, _EventTarget.call.apply(_EventTarget, [this].concat(args)));
  19. }
  20. NonVIPREventTarget.prototype.getTargetsByCords = function getTargetsByCords() {
  21. return [];
  22. };
  23. NonVIPREventTarget.prototype.decorateTarget = function decorateTarget() {
  24. //IndentedList and Table support decorate by default
  25. return true;
  26. };
  27. NonVIPREventTarget.prototype.getDecoration = function getDecoration() {};
  28. NonVIPREventTarget.prototype.getValuesAtPoint = function getValuesAtPoint() /*event , offset*/{};
  29. NonVIPREventTarget.prototype.completeDecorations = function completeDecorations() {};
  30. NonVIPREventTarget.prototype.applyCustomDataSelection = function applyCustomDataSelection() {};
  31. NonVIPREventTarget.prototype.getCustomDataSelections = function getCustomDataSelections() {
  32. return [];
  33. };
  34. NonVIPREventTarget.prototype.canZoom = function canZoom() {
  35. return false;
  36. };
  37. NonVIPREventTarget.prototype.zoom = function zoom() {};
  38. NonVIPREventTarget.prototype.zoomStart = function zoomStart() {};
  39. NonVIPREventTarget.prototype.zoomEnd = function zoomEnd() {};
  40. NonVIPREventTarget.prototype.pan = function pan() {};
  41. NonVIPREventTarget.prototype.panStart = function panStart() {};
  42. NonVIPREventTarget.prototype.panEnd = function panEnd() {};
  43. NonVIPREventTarget.prototype._getKeyDownEventCoordinates = function _getKeyDownEventCoordinates(event) {
  44. event.clientX = $(event.target).offset().left + event.target.offsetWidth / 2;
  45. event.clientY = $(event.target).offset().top + event.target.offsetHeight / 2;
  46. return event;
  47. };
  48. NonVIPREventTarget.prototype._getTargetNode = function _getTargetNode() {
  49. var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  50. return event.gesture ? event.gesture.target : event.target;
  51. };
  52. NonVIPREventTarget.prototype._canProcessKeyDown = function _canProcessKeyDown(event) {
  53. return event.type === 'keydown' && event.keyCode === KeyCodes.KEY_ENTER;
  54. };
  55. NonVIPREventTarget.prototype.processKeyDown = function processKeyDown(event) {
  56. var result = this._canProcessKeyDown(event);
  57. if (result) {
  58. this._getKeyDownEventCoordinates(event);
  59. }
  60. return result;
  61. };
  62. NonVIPREventTarget.prototype.mouseWithinBoundCheck = function mouseWithinBoundCheck(event) {
  63. if (this.getTargetElement()) {
  64. var boundingRect = this.getTargetElement().get(0).getBoundingClientRect();
  65. return event.pageX > boundingRect.left && event.pageX < boundingRect.right && event.pageY > boundingRect.top && event.pageY < boundingRect.bottom;
  66. }
  67. return false;
  68. };
  69. return NonVIPREventTarget;
  70. }(EventTarget);
  71. return NonVIPREventTarget;
  72. });
  73. //# sourceMappingURL=NonVIPREventTarget.js.map