close_button.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. exports.CloseButton = void 0;
  17. var abstract_postable_js_1 = require("./abstract_postable.js");
  18. var html_classes_js_1 = require("./html_classes.js");
  19. var CloseButton = (function (_super) {
  20. __extends(CloseButton, _super);
  21. function CloseButton(element) {
  22. var _this = _super.call(this) || this;
  23. _this.element = element;
  24. _this.className = html_classes_js_1.HtmlClasses['MENUCLOSE'];
  25. _this.role = 'button';
  26. return _this;
  27. }
  28. CloseButton.prototype.generateHtml = function () {
  29. var html = document.createElement('span');
  30. html.classList.add(this.className);
  31. html.setAttribute('role', this.role);
  32. html.setAttribute('tabindex', '0');
  33. var content = document.createElement('span');
  34. content.textContent = '\u00D7';
  35. html.appendChild(content);
  36. this.html = html;
  37. };
  38. CloseButton.prototype.display = function () { };
  39. CloseButton.prototype.unpost = function () {
  40. _super.prototype.unpost.call(this);
  41. this.element.unpost();
  42. };
  43. CloseButton.prototype.keydown = function (event) {
  44. this.bubbleKey();
  45. _super.prototype.keydown.call(this, event);
  46. };
  47. CloseButton.prototype.space = function (event) {
  48. this.unpost();
  49. this.stop(event);
  50. };
  51. CloseButton.prototype.mousedown = function (event) {
  52. this.unpost();
  53. this.stop(event);
  54. };
  55. return CloseButton;
  56. }(abstract_postable_js_1.AbstractPostable));
  57. exports.CloseButton = CloseButton;
  58. //# sourceMappingURL=close_button.js.map