No Description

ToolbarButton.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var ToolbarButton = (function () {
  4. function ToolbarButton(toolbarItem, clickHandler) {
  5. var _this = this;
  6. this.getElement = function () {
  7. var div = document.createElement('div');
  8. if (_this.toolbarItem.name !== 'separator') {
  9. div.className = 'fc-whiteboardtoolbar-button';
  10. if (_this.clickHandler) {
  11. div.addEventListener('click', function (ev) {
  12. if (_this.clickHandler) {
  13. _this.clickHandler(ev, _this.toolbarItem);
  14. }
  15. });
  16. }
  17. if (_this.toolbarItem.icon) {
  18. div.title = _this.toolbarItem.tooltipText;
  19. div.innerHTML = _this.toolbarItem.icon;
  20. }
  21. else {
  22. div.innerText = _this.toolbarItem.tooltipText;
  23. }
  24. }
  25. else {
  26. div.className = 'fc-whiteboardtoolbar-separator';
  27. }
  28. return div;
  29. };
  30. this.toolbarItem = toolbarItem;
  31. if (clickHandler) {
  32. this.clickHandler = clickHandler;
  33. }
  34. }
  35. return ToolbarButton;
  36. }());
  37. exports.ToolbarButton = ToolbarButton;