123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var tippy_js_1 = require("tippy.js");
- var uuid_1 = require("../utils/uuid");
- var ToolbarButton = (function () {
- function ToolbarButton(toolbarItem, clickHandler) {
- var _this = this;
- this.id = uuid_1.uuid();
- this.getElement = function () {
- if (_this.toolbarItem.onRender) {
- _this.container = _this.toolbarItem.onRender().cloneNode(true);
- return _this.container;
- }
- var div = document.createElement('div');
- if (_this.toolbarItem.name !== 'separator') {
- div.className = 'fc-whiteboard-toolbar-button';
- if (_this.clickHandler) {
- div.addEventListener('click', function (ev) {
- if (_this.clickHandler) {
- _this.clickHandler(ev, _this.toolbarItem);
- }
- });
- }
- if (_this.toolbarItem.icon) {
- div.title = _this.toolbarItem.tooltipText || '';
- div.innerHTML = _this.toolbarItem.icon;
- }
- else {
- div.innerText = _this.toolbarItem.tooltipText || '';
- }
- if (_this.toolbarItem.tooltipText) {
- tippy_js_1.default(div, {
- content: _this.toolbarItem.shortcut
- ? _this.toolbarItem.tooltipText + " " + _this.toolbarItem.shortcut
- : _this.toolbarItem.tooltipText
- });
- }
- }
- else {
- div.className = 'fc-whiteboard-toolbar-separator';
- }
- div.id = "fc-whiteboard-toolbar-" + _this.toolbarItem.name;
- _this.container = div;
- return div;
- };
- this.toolbarItem = toolbarItem;
- if (clickHandler) {
- this.clickHandler = clickHandler;
- }
- }
- return ToolbarButton;
- }());
- exports.ToolbarButton = ToolbarButton;
|