1this.BX = this.BX || {}; 2(function (exports,main_core_events,main_popup,main_core) { 3 'use strict'; 4 5 /** 6 * @namespace {BX.UI} 7 */ 8 let ButtonTag = function ButtonTag() { 9 babelHelpers.classCallCheck(this, ButtonTag); 10 }; 11 babelHelpers.defineProperty(ButtonTag, "BUTTON", 0); 12 babelHelpers.defineProperty(ButtonTag, "LINK", 1); 13 babelHelpers.defineProperty(ButtonTag, "SUBMIT", 2); 14 babelHelpers.defineProperty(ButtonTag, "INPUT", 3); 15 babelHelpers.defineProperty(ButtonTag, "DIV", 4); 16 babelHelpers.defineProperty(ButtonTag, "SPAN", 5); 17 18 let _ = t => t, 19 _t, 20 _t2, 21 _t3, 22 _t4, 23 _t5, 24 _t6, 25 _t7, 26 _t8; 27 let BaseButton = /*#__PURE__*/function () { 28 function BaseButton(options) { 29 babelHelpers.classCallCheck(this, BaseButton); 30 options = main_core.Type.isPlainObject(options) ? options : {}; 31 this.options = Object.assign(this.getDefaultOptions(), options); 32 33 /** 34 * 'buttonNode', 'textNode' and counterNode options use only in ButtonManager.createFromNode 35 */ 36 this.button = main_core.Type.isDomNode(this.options.buttonNode) ? this.options.buttonNode : null; 37 this.textNode = main_core.Type.isDomNode(this.options.textNode) ? this.options.textNode : null; 38 this.counterNode = main_core.Type.isDomNode(this.options.counterNode) ? this.options.counterNode : null; 39 this.text = ''; 40 this.counter = null; 41 this.events = {}; 42 this.link = ''; 43 this.maxWidth = null; 44 this.tag = this.isEnumValue(this.options.tag, ButtonTag) ? this.options.tag : ButtonTag.BUTTON; 45 if (main_core.Type.isStringFilled(this.options.link)) { 46 this.tag = ButtonTag.LINK; 47 } 48 this.baseClass = main_core.Type.isStringFilled(this.options.baseClass) ? this.options.baseClass : ''; 49 this.disabled = false; 50 this.handleEvent = this.handleEvent.bind(this); 51 this.init(); // needs to initialize private properties in derived classes. 52 53 if (this.options.disabled === true) { 54 this.setDisabled(); 55 } 56 this.setText(this.options.text); 57 this.setCounter(this.options.counter); 58 this.setProps(this.options.props); 59 this.setDataSet(this.options.dataset); 60 this.addClass(this.options.className); 61 this.setLink(this.options.link); 62 this.setMaxWidth(this.options.maxWidth); 63 this.bindEvent('click', this.options.onclick); 64 this.bindEvents(this.options.events); 65 } 66 67 /** 68 * @protected 69 */ 70 babelHelpers.createClass(BaseButton, [{ 71 key: "init", 72 value: function init() { 73 // needs to initialize private properties in derived classes. 74 } 75 /** 76 * @protected 77 */ 78 }, { 79 key: "getDefaultOptions", 80 value: function getDefaultOptions() { 81 return {}; 82 } 83 /** 84 * @public 85 * @return {HTMLElement} 86 */ 87 }, { 88 key: "render", 89 value: function render() { 90 return this.getContainer(); 91 } 92 /** 93 * @public 94 * @param {HTMLElement} node 95 * @return {?HTMLElement} 96 */ 97 }, { 98 key: "renderTo", 99 value: function renderTo(node) { 100 if (main_core.Type.isDomNode(node)) { 101 return node.appendChild(this.getContainer()); 102 } 103 return null; 104 } 105 /** 106 * @public 107 * @return {HTMLElement} 108 */ 109 }, { 110 key: "getContainer", 111 value: function getContainer() { 112 if (this.button !== null) { 113 return this.button; 114 } 115 switch (this.getTag()) { 116 case ButtonTag.BUTTON: 117 default: 118 this.button = main_core.Tag.render(_t || (_t = _`<button class="${0}"></button>`), this.getBaseClass()); 119 break; 120 case ButtonTag.INPUT: 121 this.button = main_core.Tag.render(_t2 || (_t2 = _`<input class="${0}" type="button">`), this.getBaseClass()); 122 break; 123 case ButtonTag.LINK: 124 this.button = main_core.Tag.render(_t3 || (_t3 = _`<a class="${0}" href=""></a>`), this.getBaseClass()); 125 break; 126 case ButtonTag.SUBMIT: 127 this.button = main_core.Tag.render(_t4 || (_t4 = _`<input class="${0}" type="submit">`), this.getBaseClass()); 128 break; 129 case ButtonTag.DIV: 130 this.button = main_core.Tag.render(_t5 || (_t5 = _`<div class="${0}"></div>`), this.getBaseClass()); 131 break; 132 case ButtonTag.SPAN: 133 this.button = main_core.Tag.render(_t6 || (_t6 = _`<span class="${0}"></span>`), this.getBaseClass()); 134 break; 135 } 136 return this.button; 137 } 138 /** 139 * @protected 140 * @return {string} 141 */ 142 }, { 143 key: "getBaseClass", 144 value: function getBaseClass() { 145 return this.baseClass; 146 } 147 /** 148 * @public 149 * @param {string} text 150 * @return {this} 151 */ 152 }, { 153 key: "setText", 154 value: function setText(text) { 155 if (main_core.Type.isString(text)) { 156 this.text = text; 157 if (this.isInputType()) { 158 this.getContainer().value = text; 159 } else if (text.length > 0) { 160 if (this.textNode === null) { 161 this.textNode = main_core.Tag.render(_t7 || (_t7 = _`<span class="ui-btn-text"></span>`)); 162 } 163 if (!this.textNode.parentNode) { 164 main_core.Dom.prepend(this.textNode, this.getContainer()); 165 } 166 this.textNode.textContent = text; 167 } else { 168 if (this.textNode !== null) { 169 main_core.Dom.remove(this.textNode); 170 } 171 } 172 } 173 return this; 174 } 175 /** 176 * @public 177 * @return {string} 178 */ 179 }, { 180 key: "getText", 181 value: function getText() { 182 return this.text; 183 } 184 /** 185 * 186 * @param {number | string} counter 187 * @return {this} 188 */ 189 }, { 190 key: "setCounter", 191 value: function setCounter(counter) { 192 if ([0, '0', '', null, false].includes(counter)) { 193 if (this.counterNode !== null) { 194 main_core.Dom.remove(this.counterNode); 195 this.counterNode = null; 196 } 197 this.counter = null; 198 } else if (main_core.Type.isNumber(counter) && counter > 0 || main_core.Type.isStringFilled(counter)) { 199 if (this.isInputType()) { 200 throw new Error('BX.UI.Button: an input button cannot have a counter.'); 201 } 202 if (this.counterNode === null) { 203 this.counterNode = main_core.Tag.render(_t8 || (_t8 = _`<span class="ui-btn-counter"></span>`)); 204 main_core.Dom.append(this.counterNode, this.getContainer()); 205 } 206 this.counter = counter; 207 this.counterNode.textContent = counter; 208 } 209 return this; 210 } 211 /** 212 * 213 * @return {number | string | null} 214 */ 215 }, { 216 key: "getCounter", 217 value: function getCounter() { 218 return this.counter; 219 } 220 /** 221 * 222 * @param {string} link 223 * @return {this} 224 */ 225 }, { 226 key: "setLink", 227 value: function setLink(link) { 228 if (main_core.Type.isString(link)) { 229 if (this.getTag() !== ButtonTag.LINK) { 230 throw new Error('BX.UI.Button: only an anchor button tag supports a link.'); 231 } 232 this.getContainer().href = link; 233 } 234 return this; 235 } 236 /** 237 * 238 * @return {string} 239 */ 240 }, { 241 key: "getLink", 242 value: function getLink() { 243 return this.getContainer().href; 244 } 245 }, { 246 key: "setMaxWidth", 247 value: function setMaxWidth(maxWidth) { 248 if (main_core.Type.isNumber(maxWidth) && maxWidth > 0) { 249 this.maxWidth = maxWidth; 250 this.getContainer().style.maxWidth = `${maxWidth}px`; 251 } else if (maxWidth === null) { 252 this.getContainer().style.removeProperty('max-width'); 253 this.maxWidth = null; 254 } 255 return this; 256 } 257 }, { 258 key: "getMaxWidth", 259 value: function getMaxWidth() { 260 return this.maxWidth; 261 } 262 /** 263 * @public 264 * @return {ButtonTag} 265 */ 266 }, { 267 key: "getTag", 268 value: function getTag() { 269 return this.tag; 270 } 271 /** 272 * @public 273 * @param {object.<string, string>} props 274 * @return {this} 275 */ 276 }, { 277 key: "setProps", 278 value: function setProps(props) { 279 if (!main_core.Type.isPlainObject(props)) { 280 return this; 281 } 282 for (let propName in props) { 283 const propValue = props[propName]; 284 main_core.Dom.attr(this.getContainer(), propName, propValue); 285 } 286 return this; 287 } 288 /** 289 * @public 290 * @return {object.<string, string>} 291 */ 292 }, { 293 key: "getProps", 294 value: function getProps() { 295 const attrs = this.getContainer().attributes; 296 const result = {}; 297 const reserved = this.isInputType() ? ['class', 'type'] : ['class']; 298 for (let i = 0; i < attrs.length; i++) { 299 const { 300 name, 301 value 302 } = attrs[i]; 303 if (reserved.includes(name) || name.startsWith('data-')) { 304 continue; 305 } 306 result[name] = value; 307 } 308 return result; 309 } 310 /** 311 * @public 312 * @param {object.<string, string>} props 313 * @return {this} 314 */ 315 }, { 316 key: "setDataSet", 317 value: function setDataSet(props) { 318 if (!main_core.Type.isPlainObject(props)) { 319 return this; 320 } 321 for (let propName in props) { 322 const propValue = props[propName]; 323 if (propValue === null) { 324 delete this.getDataSet()[propName]; 325 } else { 326 this.getDataSet()[propName] = propValue; 327 } 328 } 329 return this; 330 } 331 /** 332 * @public 333 * @return {DOMStringMap} 334 */ 335 }, { 336 key: "getDataSet", 337 value: function getDataSet() { 338 return this.getContainer().dataset; 339 } 340 /** 341 * @public 342 * @param {string} className 343 * @return {this} 344 */ 345 }, { 346 key: "addClass", 347 value: function addClass(className) { 348 if (main_core.Type.isStringFilled(className)) { 349 main_core.Dom.addClass(this.getContainer(), className); 350 } 351 return this; 352 } 353 /** 354 * @public 355 * @param {string} className 356 * @return {this} 357 */ 358 }, { 359 key: "removeClass", 360 value: function removeClass(className) { 361 if (main_core.Type.isStringFilled(className)) { 362 main_core.Dom.removeClass(this.getContainer(), className); 363 } 364 return this; 365 } 366 /** 367 * @public 368 * @param {boolean} [flag=true] 369 * @return {this} 370 */ 371 }, { 372 key: "setDisabled", 373 value: function setDisabled(flag) { 374 if (flag === false) { 375 this.disabled = false;
376 this.setProps({ 377 disabled: null 378 }); 379 } else { 380 this.disabled = true; 381 this.setProps({ 382 disabled: true 383 }); 384 } 385 return this; 386 } 387 /** 388 * 389 * @return {boolean} 390 */ 391 }, { 392 key: "isDisabled", 393 value: function isDisabled() { 394 return this.disabled; 395 } 396 /** 397 * @public 398 * @return {boolean} 399 */ 400 }, { 401 key: "isInputType", 402 value: function isInputType() { 403 return this.getTag() === ButtonTag.SUBMIT || this.getTag() === ButtonTag.INPUT; 404 } 405 /** 406 * @public 407 * @param {object.<string, function>} events 408 * @return {this} 409 */ 410 }, { 411 key: "bindEvents", 412 value: function bindEvents(events) { 413 if (main_core.Type.isPlainObject(events)) { 414 for (let eventName in events) { 415 const fn = events[eventName]; 416 this.bindEvent(eventName, fn); 417 } 418 } 419 return this; 420 } 421 /** 422 * @public 423 * @param {string[]} events 424 * @return {this} 425 */ 426 }, { 427 key: "unbindEvents", 428 value: function unbindEvents(events) { 429 if (main_core.Type.isArray(events)) { 430 events.forEach(eventName => { 431 this.unbindEvent(eventName); 432 }); 433 } 434 return this; 435 } 436 /** 437 * @public 438 * @param {string} eventName 439 * @param {function} fn 440 * @return {this} 441 */ 442 }, { 443 key: "bindEvent", 444 value: function bindEvent(eventName, fn) { 445 if (main_core.Type.isStringFilled(eventName) && main_core.Type.isFunction(fn)) { 446 this.unbindEvent(eventName); 447 this.events[eventName] = fn; 448 main_core.Event.bind(this.getContainer(), eventName, this.handleEvent); 449 } 450 return this; 451 } 452 /** 453 * @public 454 * @param {string} eventName 455 * @return {this} 456 */ 457 }, { 458 key: "unbindEvent", 459 value: function unbindEvent(eventName) { 460 if (this.events[eventName]) { 461 delete this.events[eventName]; 462 main_core.Event.unbind(this.getContainer(), eventName, this.handleEvent); 463 } 464 return this; 465 } 466 /** 467 * @private 468 * @param {MouseEvent} event 469 */ 470 }, { 471 key: "handleEvent", 472 value: function handleEvent(event) { 473 const eventName = event.type; 474 if (this.events[eventName]) { 475 const fn = this.events[eventName]; 476 fn.call(this, this, event); 477 } 478 } 479 /** 480 * @protected 481 */ 482 }, { 483 key: "isEnumValue", 484 value: function isEnumValue(value, enumeration) { 485 for (let code in enumeration) { 486 if (enumeration[code] === value) { 487 return true; 488 } 489 } 490 return false; 491 } 492 }]); 493 return BaseButton; 494 }(); 495 496 /** 497 * @namespace {BX.UI} 498 */ 499 let ButtonColor = function ButtonColor() { 500 babelHelpers.classCallCheck(this, ButtonColor); 501 }; 502 babelHelpers.defineProperty(ButtonColor, "DANGER", 'ui-btn-danger'); 503 babelHelpers.defineProperty(ButtonColor, "DANGER_DARK", 'ui-btn-danger-dark'); 504 babelHelpers.defineProperty(ButtonColor, "DANGER_LIGHT", 'ui-btn-danger-light'); 505 babelHelpers.defineProperty(ButtonColor, "SUCCESS", 'ui-btn-success'); 506 babelHelpers.defineProperty(ButtonColor, "SUCCESS_DARK", 'ui-btn-success-dark'); 507 babelHelpers.defineProperty(ButtonColor, "SUCCESS_LIGHT", 'ui-btn-success-light'); 508 babelHelpers.defineProperty(ButtonColor, "PRIMARY_DARK", 'ui-btn-primary-dark'); 509 babelHelpers.defineProperty(ButtonColor, "PRIMARY", 'ui-btn-primary'); 510 babelHelpers.defineProperty(ButtonColor, "SECONDARY", 'ui-btn-secondary'); 511 babelHelpers.defineProperty(ButtonColor, "SECONDARY_LIGHT", 'ui-btn-secondary-light'); 512 babelHelpers.defineProperty(ButtonColor, "WARNING_LIGHT", 'ui-btn-warning-light'); 513 babelHelpers.defineProperty(ButtonColor, "LINK", 'ui-btn-link'); 514 babelHelpers.defineProperty(ButtonColor, "LIGHT", 'ui-btn-light'); 515 babelHelpers.defineProperty(ButtonColor, "LIGHT_BORDER", 'ui-btn-light-border'); 516 babelHelpers.defineProperty(ButtonColor, "AI", 'ui-btn-color-ai'); 517 babelHelpers.defineProperty(ButtonColor, "BASE_LIGHT", 'ui-btn-base-light'); 518 519 /** 520 * @namespace {BX.UI} 521 */ 522 let ButtonSize = function ButtonSize() { 523 babelHelpers.classCallCheck(this, ButtonSize); 524 }; 525 babelHelpers.defineProperty(ButtonSize, "LARGE", 'ui-btn-lg'); 526 babelHelpers.defineProperty(ButtonSize, "MEDIUM", 'ui-btn-md'); 527 babelHelpers.defineProperty(ButtonSize, "SMALL", 'ui-btn-sm'); 528 babelHelpers.defineProperty(ButtonSize, "EXTRA_SMALL", 'ui-btn-xs'); 529 530 /** 531 * @namespace {BX.UI} 532 */ 533 let ButtonIcon = function ButtonIcon() { 534 babelHelpers.classCallCheck(this, ButtonIcon); 535 }; 536 babelHelpers.defineProperty(ButtonIcon, "UNFOLLOW", 'ui-btn-icon-unfollow'); 537 babelHelpers.defineProperty(ButtonIcon, "FOLLOW", 'ui-btn-icon-follow'); 538 babelHelpers.defineProperty(ButtonIcon, "ADD", 'ui-btn-icon-add'); 539 babelHelpers.defineProperty(ButtonIcon, "STOP", 'ui-btn-icon-stop'); 540 babelHelpers.defineProperty(ButtonIcon, "START", 'ui-btn-icon-start'); 541 babelHelpers.defineProperty(ButtonIcon, "PAUSE", 'ui-btn-icon-pause'); 542 babelHelpers.defineProperty(ButtonIcon, "ADD_FOLDER", 'ui-btn-icon-add-folder'); 543 babelHelpers.defineProperty(ButtonIcon, "SETTING", 'ui-btn-icon-setting'); 544 babelHelpers.defineProperty(ButtonIcon, "TASK", 'ui-btn-icon-task'); 545 babelHelpers.defineProperty(ButtonIcon, "INFO", 'ui-btn-icon-info'); 546 babelHelpers.defineProperty(ButtonIcon, "SEARCH", 'ui-btn-icon-search'); 547 babelHelpers.defineProperty(ButtonIcon, "PRINT", 'ui-btn-icon-print'); 548 babelHelpers.defineProperty(ButtonIcon, "LIST", 'ui-btn-icon-list'); 549 babelHelpers.defineProperty(ButtonIcon, "BUSINESS", 'ui-btn-icon-business'); 550 babelHelpers.defineProperty(ButtonIcon, "BUSINESS_CONFIRM", 'ui-btn-icon-business-confirm'); 551 babelHelpers.defineProperty(ButtonIcon, "BUSINESS_WARNING", 'ui-btn-icon-business-warning'); 552 babelHelpers.defineProperty(ButtonIcon, "CAMERA", 'ui-btn-icon-camera'); 553 babelHelpers.defineProperty(ButtonIcon, "PHONE_UP", 'ui-btn-icon-phone-up'); 554 babelHelpers.defineProperty(ButtonIcon, "PHONE_DOWN", 'ui-btn-icon-phone-down'); 555 babelHelpers.defineProperty(ButtonIcon, "PHONE_CALL", 'ui-btn-icon-phone-call'); 556 babelHelpers.defineProperty(ButtonIcon, "BACK", 'ui-btn-icon-back'); 557 babelHelpers.defineProperty(ButtonIcon, "REMOVE", 'ui-btn-icon-remove'); 558 babelHelpers.defineProperty(ButtonIcon, "DOWNLOAD", 'ui-btn-icon-download'); 559 babelHelpers.defineProperty(ButtonIcon, "DOTS", 'ui-btn-icon-ui-btn-icon-dots'); 560 babelHelpers.defineProperty(ButtonIcon, "DONE", 'ui-btn-icon-done'); 561 babelHelpers.defineProperty(ButtonIcon, "CANCEL", 'ui-btn-icon-cancel'); 562 babelHelpers.defineProperty(ButtonIcon, "DISK", 'ui-btn-icon-disk'); 563 babelHelpers.defineProperty(ButtonIcon, "LOCK", 'ui-btn-icon-lock'); 564 babelHelpers.defineProperty(ButtonIcon, "MAIL", 'ui-btn-icon-mail'); 565 babelHelpers.defineProperty(ButtonIcon, "CHAT", 'ui-btn-icon-chat'); 566 babelHelpers.defineProperty(ButtonIcon, "PAGE", 'ui-btn-icon-page'); 567 babelHelpers.defineProperty(ButtonIcon, "CLOUD", 'ui-btn-icon-cloud'); 568 babelHelpers.defineProperty(ButtonIcon, "EDIT", 'ui-btn-icon-edit'); 569 babelHelpers.defineProperty(ButtonIcon, "SHARE", 'ui-btn-icon-share'); 570 babelHelpers.defineProperty(ButtonIcon, "ANGLE_UP", 'ui-btn-icon-angle-up'); 571 babelHelpers.defineProperty(ButtonIcon, "ANGLE_DOWN", 'ui-btn-icon-angle-down'); 572 babelHelpers.defineProperty(ButtonIcon, "EYE_OPENED", 'ui-btn-icon-eye-opened'); 573 babelHelpers.defineProperty(ButtonIcon, "EYE_CLOSED", 'ui-btn-icon-eye-closed'); 574 babelHelpers.defineProperty(ButtonIcon, "ALERT", 'ui-btn-icon-alert'); 575 babelHelpers.defineProperty(ButtonIcon, "FAIL", 'ui-btn-icon-fail'); 576 babelHelpers.defineProperty(ButtonIcon, "SUCCESS", 'ui-btn-icon-success'); 577 babelHelpers.defineProperty(ButtonIcon, "PLAN", 'ui-btn-icon-plan'); 578 babelHelpers.defineProperty(ButtonIcon, "TARIFF", 'ui-btn-icon-tariff'); 579 babelHelpers.defineProperty(ButtonIcon, "BATTERY", 'ui-btn-icon-battery'); 580 babelHelpers.defineProperty(ButtonIcon, "NO_BATTERY", 'ui-btn-icon-no-battery'); 581 babelHelpers.defineProperty(ButtonIcon, "HALF_BATTERY", 'ui-btn-icon-half-battery'); 582 babelHelpers.defineProperty(ButtonIcon, "LOW_BATTERY", 'ui-btn-icon-low-battery'); 583 babelHelpers.defineProperty(ButtonIcon, "CRIT_BATTERY", 'ui-btn-icon-crit-battery'); 584 babelHelpers.defineProperty(ButtonIcon, "DEMO", 'ui-btn-icon-demo'); 585 babelHelpers.defineProperty(ButtonIcon, "ROBOTS", 'ui-btn-icon-robots'); 586 babelHelpers.defineProperty(ButtonIcon, "NOTE", 'ui-btn-icon-note'); 587 babelHelpers.defineProperty(ButtonIcon, "SCRIPT", 'ui-btn-icon-script'); 588 babelHelpers.defineProperty(ButtonIcon, "PRINT2", 'ui-btn-icon-print-2'); 589 babelHelpers.defineProperty(ButtonIcon, "FUNNEL", 'ui-btn-icon-funnel'); 590 babelHelpers.defineProperty(ButtonIcon, "FORWARD", 'ui-btn-icon-forward'); 591 babelHelpers.defineProperty(ButtonIcon, "COPY", 'ui-btn-icon-copy'); 592 babelHelpers.defineProperty(ButtonIcon, "AI", 'ui-btn-icon-ai ui-icon-set__scope'); 593 594 /** 595 * @namespace {BX.UI} 596 */ 597 let ButtonState = function ButtonState() { 598 babelHelpers.classCallCheck(this, ButtonState); 599 }; 600 babelHelpers.defineProperty(ButtonState, "HOVER", 'ui-btn-hover'); 601 babelHelpers.defineProperty(ButtonState, "ACTIVE", 'ui-btn-active'); 602 babelHelpers.defineProperty(ButtonState, "DISABLED", 'ui-btn-disabled'); 603 babelHelpers.defineProperty(ButtonState, "CLOCKING", 'ui-btn-clock'); 604 babelHelpers.defineProperty(ButtonState, "WAITING", 'ui-btn-wait'); 605 babelHelpers.defineProperty(ButtonState, "AI_WAITING", 'ui-btn-ai-waiting'); 606 607 /** 608 * @namespace {BX.UI} 609 */ 610 let ButtonStyle = function ButtonStyle() { 611 babelHelpers.classCallCheck(this, ButtonStyle); 612 }; 613 babelHelpers.defineProperty(ButtonStyle, "NO_CAPS", 'ui-btn-no-caps'); 614 babelHelpers.defineProperty(ButtonStyle, "ROUND", 'ui-btn-round'); 615 babelHelpers.defineProperty(ButtonStyle, "DROPDOWN", 'ui-btn-dropdown'); 616 babelHelpers.defineProperty(ButtonStyle, "COLLAPSED", 'ui-btn-collapsed'); 617 babelHelpers.defineProperty(ButtonStyle, "DEPEND_ON_THEME", 'ui-btn-themes'); 618 619 /** 620 * @namespace {BX.UI} 621 */ 622 let Button = /*#__PURE__*/function (_BaseButton) { 623 babelHelpers.inherits(Button, _BaseButton); 624 function Button(options) { 625 var _this; 626 babelHelpers.classCallCheck(this, Button); 627 options = main_core.Type.isPlainObject(options) ? options : {}; 628 options.baseClass = main_core.Type.isStringFilled(options.baseClass) ? options.baseClass : Button.BASE_CLASS; 629 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Button).call(this, options)); 630 _this.isDependOnTheme = null; 631 _this.size = null; 632 _this.color = null; 633 _this.icon = null; 634 _this.state = null; 635 _this.id = null; 636 _this.context = null; 637 _this.menuWindow = null; 638 _this.handleMenuClick = _this.handleMenuClick.bind(babelHelpers.assertThisInitialized(_this)); 639 _this.handleMenuClose = _this.handleMenuClose.bind(babelHelpers.assertThisInitialized(_this)); 640 _this.setDependOnTheme(_this.options.dependOnTheme); 641 _this.setSize(_this.options.size); 642 _this.setColor(_this.options.color); 643 _this.setIcon(_this.options.icon); 644 _this.setState(_this.options.state); 645 _this.setId(_this.options.id); 646 _this.setMenu(_this.options.menu); 647 _this.setContext(_this.options.context); 648 _this.options.noCaps && _this.setNoCaps(); 649 _this.options.round && _this.setRound(); 650 if (_this.options.dropdown || _this.getMenuWindow() && _this.options.dropdown !== false) { 651 _this.setDropdown(); 652 } 653 return _this; 654 } 655 babelHelpers.createClass(Button, [{ 656 key: "setSize", 657 /** 658 * @public 659 * @param {ButtonSize|null} size 660 * @return {this} 661 */ 662 value: function setSize(size) { 663 return this.setProperty('size', size, ButtonSize); 664 } 665 /** 666 * @public 667 * @return {?ButtonSize} 668 */ 669 }, { 670 key: "getSize", 671 value: function getSize() { 672 return this.size; 673 } 674 /** 675 * @public 676 * @param {ButtonColor|null} color 677 * @return {this} 678 */ 679 }, { 680 key: "setColor", 681 value: function setColor(color) { 682 return this.setProperty('color', color, ButtonColor); 683 } 684 /** 685 * @public 686 * @return {?ButtonSize} 687 */ 688 }, { 689 key: "getColor", 690 value: function getColor() { 691 return this.color; 692 } 693 /** 694 * @public 695 * @param {?ButtonIcon} icon 696 * @return {this} 697 */ 698 }, { 699 key: "setIcon", 700 value: function setIcon(icon) { 701 this.setProperty('icon', icon, ButtonIcon); 702 if (this.isInputType() && this.getIcon() !== null) { 703 throw new Error('BX.UI.Button: Input type button cannot have an icon.'); 704 } 705 return this; 706 } 707 /** 708 * @public 709 * @return {?ButtonIcon} 710 */ 711 }, { 712 key: "getIcon", 713 value: function getIcon() { 714 return this.icon; 715 } 716 /** 717 * @public 718 * @param {ButtonState|null} state 719 * @return {this} 720 */ 721 }, { 722 key: "setState", 723 value: function setState(state) { 724 return this.setProperty('state', state, ButtonState); 725 } 726 /** 727 * @public 728 * @return {?ButtonState} 729 */ 730 }, { 731 key: "getState", 732 value: function getState() { 733 return this.state; 734 } 735 /** 736 * @public 737 * @param {boolean} [flag=true] 738 * @return {this} 739 */ 740 }, { 741 key: "setNoCaps", 742 value: function setNoCaps(flag) { 743 if (flag === false) { 744 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.NO_CAPS); 745 } else { 746 main_core.Dom.addClass(this.getContainer(), ButtonStyle.NO_CAPS); 747 } 748 return this; 749 } 750 /** 751 * 752 * @return {boolean} 753 */ 754 }, { 755 key: "isNoCaps", 756 value: function isNoCaps() { 757 return main_core.Dom.hasClass(this.getContainer(), ButtonStyle.NO_CAPS); 758 } 759 /** 760 * @public 761 * @param {boolean} [flag=true] 762 * @return {this} 763 */ 764 }, { 765 key: "setRound", 766 value: function setRound(flag) { 767 if (flag === false) { 768 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.ROUND); 769 } else { 770 main_core.Dom.addClass(this.getContainer(), ButtonStyle.ROUND); 771 } 772 return this; 773 } 774 /** 775 * @public 776 * @return {boolean} 777 */ 778 }, { 779 key: "isRound", 780 value: function isRound() { 781 return main_core.Dom.hasClass(this.getContainer(), ButtonStyle.ROUND); 782 } 783 /** 784 * @public 785 * @param {boolean} [flag=true] 786 * @return {this} 787 */ 788 }, { 789 key: "setDependOnTheme", 790 value: function setDependOnTheme(flag) { 791 if (flag === true) { 792 main_core.Dom.addClass(this.getContainer(), ButtonStyle.DEPEND_ON_THEME); 793 } else if (flag === false) { 794 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.DEPEND_ON_THEME); 795 } 796 return this; 797 } 798 /** 799 * 800 * @return {boolean} 801 */ 802 }, { 803 key: "isDependOnTheme", 804 value: function isDependOnTheme() { 805 if (flag === false) { 806 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.DEPEND_ON_THEME); 807 } else { 808 main_core.Dom.addClass(this.getContainer(), ButtonStyle.DEPEND_ON_THEME); 809 } 810 return this; 811 } 812 /** 813 * 814 * @param {boolean} [flag=true] 815 * @return {this} 816 */ 817 }, { 818 key: "setDropdown", 819 value: function setDropdown(flag) { 820 if (flag === false) { 821 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.DROPDOWN); 822 } else { 823 main_core.Dom.addClass(this.getContainer(), ButtonStyle.DROPDOWN); 824 } 825 return this; 826 } 827 /** 828 * 829 * @return {boolean} 830 */ 831 }, { 832 key: "isDropdown", 833 value: function isDropdown() { 834 return main_core.Dom.hasClass(this.getContainer(), ButtonStyle.DROPDOWN); 835 } 836 /** 837 * 838 * @param {boolean} [flag=true] 839 * @return {this} 840 */ 841 }, { 842 key: "setCollapsed", 843 value: function setCollapsed(flag) { 844 if (flag === false) { 845 main_core.Dom.removeClass(this.getContainer(), ButtonStyle.COLLAPSED); 846 } else { 847 main_core.Dom.addClass(this.getContainer(), ButtonStyle.COLLAPSED); 848 } 849 return this; 850
850 } 851 /** 852 * 853 * @return {boolean} 854 */ 855 }, { 856 key: "isCollapsed", 857 value: function isCollapsed() { 858 return main_core.Dom.hasClass(this.getContainer(), ButtonStyle.COLLAPSED); 859 } 860 /** 861 * @protected 862 * @param {MenuOptions|false} options 863 */ 864 }, { 865 key: "setMenu", 866 value: function setMenu(options) { 867 if (main_core.Type.isPlainObject(options) && main_core.Type.isArray(options.items) && options.items.length > 0) { 868 this.setMenu(false); 869 this.menuWindow = new main_popup.Menu({ 870 id: `ui-btn-menu-${main_core.Text.getRandom().toLowerCase()}`, 871 bindElement: this.getMenuBindElement(), 872 ...options 873 }); 874 this.menuWindow.getPopupWindow().subscribe('onClose', this.handleMenuClose); 875 main_core.Event.bind(this.getMenuClickElement(), 'click', this.handleMenuClick); 876 } else if (options === false && this.menuWindow !== null) { 877 this.menuWindow.close(); 878 this.menuWindow.getPopupWindow().unsubscribe('onClose', this.handleMenuClose); 879 main_core.Event.unbind(this.getMenuClickElement(), 'click', this.handleMenuClick); 880 this.menuWindow.destroy(); 881 this.menuWindow = null; 882 } 883 return this; 884 } 885 /** 886 * @public 887 * @return {HTMLElement} 888 */ 889 }, { 890 key: "getMenuBindElement", 891 value: function getMenuBindElement() { 892 return this.getContainer(); 893 } 894 /** 895 * @public 896 * @return {HTMLElement} 897 */ 898 }, { 899 key: "getMenuClickElement", 900 value: function getMenuClickElement() { 901 return this.getContainer(); 902 } 903 /** 904 * @protected 905 * @param {MouseEvent} event 906 */ 907 }, { 908 key: "handleMenuClick", 909 value: function handleMenuClick(event) { 910 this.getMenuWindow().show(); 911 this.setActive(this.getMenuWindow().getPopupWindow().isShown()); 912 } 913 /** 914 * @protected 915 */ 916 }, { 917 key: "handleMenuClose", 918 value: function handleMenuClose() { 919 this.setActive(false); 920 } 921 /** 922 * @public 923 * @return {Menu} 924 */ 925 }, { 926 key: "getMenuWindow", 927 value: function getMenuWindow() { 928 return this.menuWindow; 929 } 930 /** 931 * @public 932 * @param {string|null} id 933 * @return {this} 934 */ 935 }, { 936 key: "setId", 937 value: function setId(id) { 938 if (main_core.Type.isStringFilled(id) || main_core.Type.isNull(id)) { 939 this.id = id; 940 } 941 return this; 942 } 943 /** 944 * @public 945 * @return {?string} 946 */ 947 }, { 948 key: "getId", 949 value: function getId() { 950 return this.id; 951 } 952 /** 953 * @public 954 * @param {boolean} [flag=true] 955 * @return {this} 956 */ 957 }, { 958 key: "setActive", 959 value: function setActive(flag) { 960 return this.setState(flag === false ? null : ButtonState.ACTIVE); 961 } 962 /** 963 * @public 964 * @return {boolean} 965 */ 966 }, { 967 key: "isActive", 968 value: function isActive() { 969 return this.getState() === ButtonState.ACTIVE; 970 } 971 /** 972 * @public 973 * @param {boolean} [flag=true] 974 * @return {this} 975 */ 976 }, { 977 key: "setHovered", 978 value: function setHovered(flag) { 979 return this.setState(flag === false ? null : ButtonState.HOVER); 980 } 981 /** 982 * @public 983 * @return {boolean} 984 */ 985 }, { 986 key: "isHover", 987 value: function isHover() { 988 return this.getState() === ButtonState.HOVER; 989 } 990 /** 991 * @public 992 * @param {boolean} [flag=true] 993 * @return {this} 994 */ 995 }, { 996 key: "setDisabled", 997 value: function setDisabled(flag) { 998 this.setState(flag === false ? null : ButtonState.DISABLED); 999 babelHelpers.get(babelHelpers.getPrototypeOf(Button.prototype), "setDisabled", this).call(this, flag); 1000 return this; 1001 } 1002 /** 1003 * @public 1004 * @return {boolean} 1005 */ 1006 }, { 1007 key: "isDisabled", 1008 value: function isDisabled() { 1009 return this.getState() === ButtonState.DISABLED; 1010 } 1011 /** 1012 * @public 1013 * @param {boolean} [flag=true] 1014 * @return {this} 1015 */ 1016 }, { 1017 key: "setWaiting", 1018 value: function setWaiting(flag) { 1019 if (flag === false) { 1020 this.setState(null); 1021 this.setProps({ 1022 disabled: null 1023 }); 1024 } else { 1025 this.setState(ButtonState.WAITING); 1026 this.setProps({ 1027 disabled: true 1028 }); 1029 } 1030 return this; 1031 } 1032 /** 1033 * @public 1034 * @return {boolean} 1035 */ 1036 }, { 1037 key: "isWaiting",
1038 value: function isWaiting() { 1039 return this.getState() === ButtonState.WAITING; 1040 } 1041 /** 1042 * @public 1043 * @param {boolean} [flag=true] 1044 * @return {this} 1045 */ 1046 }, { 1047 key: "setClocking", 1048 value: function setClocking(flag) { 1049 if (flag === false) { 1050 this.setState(null); 1051 this.setProps({ 1052 disabled: null 1053 }); 1054 } else { 1055 this.setState(ButtonState.CLOCKING); 1056 this.setProps({ 1057 disabled: true 1058 }); 1059 } 1060 return this; 1061 } 1062 /** 1063 * @public 1064 * @return {boolean} 1065 */ 1066 }, { 1067 key: "isClocking", 1068 value: function isClocking() { 1069 return this.getState() === ButtonState.CLOCKING; 1070 } 1071 /** 1072 * @protected 1073 */ 1074 }, { 1075 key: "setProperty", 1076 value: function setProperty(property, value, enumeration) { 1077 if (this.isEnumValue(value, enumeration)) { 1078 main_core.Dom.removeClass(this.getContainer(), this[property]); 1079 main_core.Dom.addClass(this.getContainer(), value); 1080 this[property] = value; 1081 } else if (value === null) { 1082 main_core.Dom.removeClass(this.getContainer(), this[property]); 1083 this[property] = null; 1084 } 1085 return this; 1086 } 1087 /** 1088 * @public 1089 * @param {*} context 1090 */ 1091 }, { 1092 key: "setContext", 1093 value: function setContext(context) { 1094 if (!main_core.Type.isUndefined(context)) { 1095 this.context = context; 1096 } 1097 return this; 1098 } 1099 /** 1100 * 1101 * @return {*} 1102 */ 1103 }, { 1104 key: "getContext", 1105 value: function getContext() { 1106 return this.context; 1107 } 1108 }]); 1109 return Button; 1110 }(BaseButton); 1111 babelHelpers.defineProperty(Button, "BASE_CLASS", 'ui-btn'); 1112 babelHelpers.defineProperty(Button, "Size", ButtonSize); 1113 babelHelpers.defineProperty(Button, "Color", ButtonColor); 1114 babelHelpers.defineProperty(Button, "State", ButtonState); 1115 babelHelpers.defineProperty(Button, "Icon", ButtonIcon); 1116 babelHelpers.defineProperty(Button, "Tag", ButtonTag); 1117 babelHelpers.defineProperty(Button, "Style", ButtonStyle); 1118 1119 /** 1120 * @namespace {BX.UI} 1121 */ 1122 let SplitButtonState = function SplitButtonState() { 1123 babelHelpers.classCallCheck(this, SplitButtonState); 1124 }; 1125 babelHelpers.defineProperty(SplitButtonState, "HOVER", 'ui-btn-hover'); 1126 babelHelpers.defineProperty(SplitButtonState, "MAIN_HOVER", 'ui-btn-main-hover'); 1127 babelHelpers.defineProperty(SplitButtonState, "MENU_HOVER", 'ui-btn-menu-hover'); 1128 babelHelpers.defineProperty(SplitButtonState, "ACTIVE", 'ui-btn-active'); 1129 babelHelpers.defineProperty(SplitButtonState, "MAIN_ACTIVE", 'ui-btn-main-active'); 1130 babelHelpers.defineProperty(SplitButtonState, "MENU_ACTIVE", 'ui-btn-menu-active'); 1131 babelHelpers.defineProperty(SplitButtonState, "DISABLED", 'ui-btn-disabled'); 1132 babelHelpers.defineProperty(SplitButtonState, "MAIN_DISABLED", 'ui-btn-main-disabled'); 1133 babelHelpers.defineProperty(SplitButtonState, "MENU_DISABLED", 'ui-btn-menu-disabled'); 1134 babelHelpers.defineProperty(SplitButtonState, "CLOCKING", 'ui-btn-clock'); 1135 babelHelpers.defineProperty(SplitButtonState, "WAITING", 'ui-btn-wait'); 1136 1137 /** 1138 * @namespace {BX.UI} 1139 */ 1140 let SplitSubButtonType = function SplitSubButtonType() { 1141 babelHelpers.classCallCheck(this, SplitSubButtonType); 1142 }; 1143 babelHelpers.defineProperty(SplitSubButtonType, "MAIN", 'ui-btn-main'); 1144 babelHelpers.defineProperty(SplitSubButtonType, "MENU", 'ui-btn-menu'); 1145 1146 /** 1147 * @namespace {BX.UI} 1148 */ 1149 let SplitSubButton = /*#__PURE__*/function (_BaseButton) { 1150 babelHelpers.inherits(SplitSubButton, _BaseButton); 1151 function SplitSubButton(options) { 1152 var _this; 1153 babelHelpers.classCallCheck(this, SplitSubButton); 1154 options = main_core.Type.isPlainObject(options) ? options : {}; 1155 options.baseClass = options.buttonType === SplitSubButtonType.MAIN ? SplitSubButtonType.MAIN : SplitSubButtonType.MENU; 1156 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SplitSubButton).call(this, options)); 1157 if (_this.isInputType()) { 1158 throw new Error('BX.UI.SplitSubButton: Split button cannot be an input tag.'); 1159 } 1160 return _this; 1161 }
1162 babelHelpers.createClass(SplitSubButton, [{ 1163 key: "init", 1164 value: function init() { 1165 this.buttonType = this.options.buttonType; 1166 this.splitButton = this.options.splitButton; 1167 babelHelpers.get(babelHelpers.getPrototypeOf(SplitSubButton.prototype), "init", this).call(this); 1168 } 1169 /** 1170 * @public 1171 * @return {SplitButton} 1172 */ 1173 }, { 1174 key: "getSplitButton", 1175 value: function getSplitButton() { 1176 return this.splitButton; 1177 } 1178 /** 1179 * @public 1180 * @return {boolean} 1181 */ 1182 }, { 1183 key: "isMainButton", 1184 value: function isMainButton() { 1185 return this.buttonType === SplitSubButtonType.MAIN; 1186 } 1187 /** 1188 * @public 1189 * @return {boolean} 1190 */ 1191 }, { 1192 key: "isMenuButton", 1193 value: function isMenuButton() { 1194 return this.buttonType === SplitSubButtonType.MENU; 1195 } 1196 }, { 1197 key: "setText", 1198 value: function setText(text) { 1199 if (main_core.Type.isString(text) && this.isMenuButton()) { 1200 throw new Error('BX.UI.SplitButton: a menu button doesn\'t support a text caption.'); 1201 } 1202 return babelHelpers.get(babelHelpers.getPrototypeOf(SplitSubButton.prototype), "setText", this).call(this, text); 1203 } 1204 /** 1205 * @public 1206 * @param {boolean} [flag=true] 1207 * @return {this} 1208 */ 1209 }, { 1210 key: "setActive", 1211 value: function setActive(flag) { 1212 this.toggleState(flag, SplitButtonState.ACTIVE, SplitButtonState.MAIN_ACTIVE, SplitButtonState.MENU_ACTIVE); 1213 return this; 1214 } 1215 /** 1216 * @public 1217 * @return {boolean} 1218 */ 1219 }, { 1220 key: "isActive", 1221 value: function isActive() { 1222 const state = this.getSplitButton().getState(); 1223 if (state === SplitButtonState.ACTIVE) { 1224 return true; 1225 } 1226 if (this.isMainButton()) { 1227 return state === SplitButtonState.MAIN_ACTIVE; 1228 } 1229 return state === SplitButtonState.MENU_ACTIVE; 1230 } 1231 /** 1232 * @public 1233 * @param {boolean} [flag=true] 1234 * @return {this} 1235 */ 1236 }, { 1237 key: "setDisabled", 1238 value: function setDisabled(flag) { 1239 this.toggleState(flag, SplitButtonState.DISABLED, SplitButtonState.MAIN_DISABLED, SplitButtonState.MENU_DISABLED); 1240 babelHelpers.get(babelHelpers.getPrototypeOf(SplitSubButton.prototype), "setDisabled", this).call(this, flag); 1241 return this; 1242 } 1243 /** 1244 * @public 1245 * @param {boolean} flag 1246 * @return {this} 1247 */ 1248 }, { 1249 key: "setHovered", 1250 value: function setHovered(flag) { 1251 this.toggleState(flag, SplitButtonState.HOVER, SplitButtonState.MAIN_HOVER, SplitButtonState.MENU_HOVER); 1252 return this; 1253 } 1254 /** 1255 * @public 1256 * @return {boolean} 1257 */ 1258 }, { 1259 key: "isHovered", 1260 value: function isHovered() { 1261 const state = this.getSplitButton().getState(); 1262 if (state === SplitButtonState.HOVER) { 1263 return true; 1264 } 1265 if (this.isMainButton()) { 1266 return state === SplitButtonState.MAIN_HOVER; 1267 } 1268 return state === SplitButtonState.MENU_HOVER; 1269 } 1270 /** 1271 * @private 1272 * @param flag 1273 * @param globalState 1274 * @param mainState 1275 * @param menuState 1276 */ 1277 }, { 1278 key: "toggleState", 1279 value: function toggleState(flag, globalState, mainState, menuState) { 1280 const state = this.getSplitButton().getState(); 1281 if (flag === false) { 1282 if (state === globalState) {
1283 this.getSplitButton().setState(this.isMainButton() ? menuState : mainState); 1284 } else { 1285 this.getSplitButton().setState(null); 1286 } 1287 } else { 1288 if (state === mainState && this.isMenuButton()) { 1289 this.getSplitButton().setState(globalState); 1290 } else if (state === menuState && this.isMainButton()) { 1291 this.getSplitButton().setState(globalState); 1292 } else if (state !== globalState) { 1293 this.getSplitButton().setState(this.isMainButton() ? mainState : menuState); 1294 } 1295 } 1296 } 1297 }]); 1298 return SplitSubButton; 1299 }(BaseButton); 1300 babelHelpers.defineProperty(SplitSubButton, "Type", SplitSubButtonType); 1301 1302 let _$1 = t => t, 1303 _t$1; 1304 1305 /** 1306 * @namespace {BX.UI} 1307 */ 1308 let SplitButton = /*#__PURE__*/function (_Button) { 1309 babelHelpers.inherits(SplitButton, _Button); 1310 function SplitButton(options) { 1311 babelHelpers.classCallCheck(this, SplitButton); 1312 options = main_core.Type.isPlainObject(options) ? options : {}; 1313 // delete options.round; 1314 1315 if (main_core.Type.isStringFilled(options.link)) { 1316 options.mainButton = main_core.Type.isPlainObject(options.mainButton) ? options.mainButton : {}; 1317 options.mainButton.link = options.link; 1318 delete options.link; 1319 } 1320 options.tag = ButtonTag.DIV; 1321 options.baseClass = SplitButton.BASE_CLASS; 1322 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SplitButton).call(this, options)); 1323 } 1324 babelHelpers.createClass(SplitButton, [{ 1325 key: "init", 1326 value: function init() { 1327 const mainOptions = main_core.Type.isPlainObject(this.options.mainButton) ? this.options.mainButton : {}; 1328 const menuOptions = main_core.Type.isPlainObject(this.options.menuButton) ? this.options.menuButton : {}; 1329 mainOptions.buttonType = SplitSubButtonType.MAIN; 1330 mainOptions.splitButton = this; 1331 menuOptions.buttonType = SplitSubButtonType.MENU; 1332 menuOptions.splitButton = this; 1333 this.mainButton = new SplitSubButton(mainOptions); 1334 this.menuButton = new SplitSubButton(menuOptions); 1335 this.menuTarget = SplitSubButtonType.MAIN; 1336 if (this.options.menuTarget === SplitSubButtonType.MENU) { 1337 this.menuTarget = SplitSubButtonType.MENU; 1338 } 1339 babelHelpers.get(babelHelpers.getPrototypeOf(SplitButton.prototype), "init", this).call(this); 1340 } 1341 }, { 1342 key: "getContainer", 1343 /** 1344 * @public 1345 * @return {HTMLElement} 1346 */ 1347 value: function getContainer() { 1348 if (this.button === null) { 1349 this.button = main_core.Tag.render(_t$1 || (_t$1 = _$1` 1350 <div class="${0}">${0}</div> 1351 `), this.getBaseClass(), [this.getMainButton().getContainer(), this.getMenuButton().getContainer()]); 1352 } 1353 return this.button; 1354 } 1355 /** 1356 * @public 1357 * @return {SplitSubButton} 1358 */ 1359 }, { 1360 key: "getMainButton", 1361 value: function getMainButton() { 1362 return this.mainButton; 1363 } 1364 /** 1365 * @public 1366 * @return {SplitSubButton} 1367 */ 1368 }, { 1369 key: "getMenuButton", 1370 value: function getMenuButton() { 1371 return this.menuButton; 1372 } 1373 /** 1374 * @public 1375 * @param {string} text 1376 * @return {this} 1377 */ 1378 }, { 1379 key: "setText", 1380 value: function setText(text) { 1381 if (main_core.Type.isString(text)) { 1382 this.getMainButton().setText(text); 1383 } 1384 return this; 1385 } 1386 /** 1387 * @public 1388 * @return {string} 1389 */ 1390 }, { 1391 key: "getText", 1392 value: function getText() { 1393 return this.getMainButton().getText(); 1394 } 1395 /** 1396 * 1397 * @param {number | string} counter 1398 * @return {this} 1399 */ 1400 }, { 1401 key: "setCounter", 1402 value: function setCounter(counter) { 1403 return this.getMainButton().setCounter(counter); 1404 } 1405 /** 1406 * 1407 * @return {number | string | null} 1408 */ 1409 }, { 1410 key: "getCounter", 1411 value: function getCounter() { 1412 return this.getMainButton().getCounter(); 1413 } 1414 /** 1415 * 1416 * @param {string} link 1417 * @return {this} 1418 */ 1419 }, { 1420 key: "setLink", 1421 value: function setLink(link) { 1422 return this.getMainButton().setLink(link); 1423 } 1424 /** 1425 * 1426 * @return {string} 1427 */ 1428 }, { 1429 key: "getLink", 1430 value: function getLink() { 1431 return this.getMainButton().getLink(); 1432 } 1433 /** 1434 * @public 1435 * @param {SplitButtonState|null} state 1436 * @return {this} 1437 */ 1438 }, { 1439 key: "setState", 1440 value: function setState(state) { 1441 return this.setProperty('state', state, SplitButtonState); 1442 } 1443 /** 1444 * @public 1445 * @param {boolean} [flag=true] 1446 * @return {this} 1447 */ 1448 }, { 1449 key: "setDisabled", 1450 value: function setDisabled(flag) { 1451 this.setState(flag === false ? null : ButtonState.DISABLED); 1452 this.getMainButton().setDisabled(flag); 1453 this.getMenuButton().setDisabled(flag); 1454 return this; 1455 } 1456 /** 1457 * @protected 1458 * @return {HTMLElement} 1459 */ 1460 }, { 1461 key: "getMenuBindElement", 1462 value: function getMenuBindElement() { 1463 if (this.getMenuTarget() === SplitSubButtonType.MENU) { 1464 return this.getMenuButton().getContainer(); 1465 } else { 1466 return this.getContainer(); 1467 } 1468 } 1469 /** 1470 * @protected 1471 * @param {MouseEvent} event 1472 */ 1473 }, { 1474 key: "handleMenuClick", 1475 value: function handleMenuClick(event) { 1476 this.getMenuWindow().show(); 1477 const isActive = this.getMenuWindow().getPopupWindow().isShown(); 1478 this.getMenuButton().setActive(isActive); 1479 } 1480 /** 1481 * @protected 1482 */ 1483 }, { 1484 key: "handleMenuClose", 1485 value: function handleMenuClose() { 1486 this.getMenuButton().setActive(false); 1487 } 1488 /** 1489 * @protected 1490 * @return {HTMLElement} 1491 */ 1492 }, { 1493 key: "getMenuClickElement", 1494 value: function getMenuClickElement() { 1495 return this.getMenuButton().getContainer(); 1496 } 1497 /** 1498 * @public 1499 * @return {SplitSubButtonType} 1500 */ 1501 }, { 1502 key: "getMenuTarget", 1503 value: function getMenuTarget() { 1504 return this.menuTarget; 1505 } 1506 /** 1507 * 1508 * @param {boolean} [flag=true] 1509 * @return {this} 1510 */ 1511 }, { 1512 key: "setDropdown", 1513 value: function setDropdown(flag) { 1514 return this; 1515 } 1516 /** 1517 * @public 1518 * @return {boolean} 1519 */ 1520 }, { 1521 key: "isDropdown", 1522 value: function isDropdown() { 1523 return true; 1524 } 1525 }]); 1526 return SplitButton; 1527 }(Button); 1528 babelHelpers.defineProperty(SplitButton, "BASE_CLASS", 'ui-btn-split'); 1529 babelHelpers.defineProperty(SplitButton, "State", SplitButtonState); 1530 1531 let _$2 = t => t, 1532 _t$2; 1533 function _classStaticPrivateMethodGet(receiver, classConstructor, method) { _classCheckPrivateStaticAccess(receiver, classConstructor); return method; } 1534 function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } } 1535 let ButtonManager = /*#__PURE__*/function () { 1536 function ButtonManager() { 1537 babelHelpers.classCallCheck(this, ButtonManager); 1538 } 1539 babelHelpers.createClass(ButtonManager, null, [{ 1540 key: "createFromNode", 1541 /** 1542 * @public 1543 * @param {HTMLButtonElement | HTMLAnchorElement | HTMLInputElement} node 1544 * @return {Button | SplitButton} 1545 */ 1546 value: function createFromNode(node) { 1547 if (!main_core.Type.isDomNode(node)) { 1548 throw new Error('BX.UI.ButtonManager.createFromNode: "node" must be a DOM node.'); 1549 } 1550 if (!main_core.Dom.hasClass(node, Button.BASE_CLASS) && !main_core.Dom.hasClass(node, SplitButton.BASE_CLASS)) { 1551 throw new Error('BX.UI.ButtonManager.createFromNode: "node" is not a button.'); 1552 } 1553 const isSplitButton = main_core.Dom.hasClass(node, SplitButton.BASE_CLASS); 1554 let tag = null; 1555 let text = null; 1556 let textNode = null; 1557 let counterNode = null; 1558 let disabled = false;
1559 let mainButtonOptions = {}; 1560 let menuButtonOptions = {}; 1561 if (isSplitButton) { 1562 const mainButton = node.querySelector(`.${SplitSubButtonType.MAIN}`); 1563 const menuButton = node.querySelector(`.${SplitSubButtonType.MENU}`); 1564 if (!mainButton) { 1565 throw new Error('BX.UI.ButtonManager.createFromNode: a split button doesn\'t have a main button.'); 1566 } 1567 if (!menuButton) { 1568 throw new Error('BX.UI.ButtonManager.createFromNode: a split button doesn\'t have a menu button.'); 1569 } 1570 const mainButtonTag = _classStaticPrivateMethodGet(this, ButtonManager, _getTag).call(this, mainButton); 1571 if (mainButtonTag === ButtonTag.INPUT || mainButtonTag === ButtonTag.SUBMIT) { 1572 text = mainButton.value; 1573 } else { 1574 [textNode, counterNode] = _classStaticPrivateMethodGet(this, ButtonManager, _getTextNode).call(this, mainButton); 1575 text = textNode.textContent; 1576 } 1577 disabled = main_core.Dom.hasClass(node, SplitButtonState.DISABLED); 1578 mainButtonOptions = { 1579 tag: mainButtonTag, 1580 textNode, 1581 counterNode, 1582 buttonNode: mainButton, 1583 disabled: main_core.Dom.hasClass(node, SplitButtonState.MAIN_DISABLED) 1584 }; 1585 menuButtonOptions = { 1586 tag: _classStaticPrivateMethodGet(this, ButtonManager, _getTag).call(this, menuButton), 1587 buttonNode: menuButton, 1588 textNode: null, 1589 counterNode: null, 1590 disabled: main_core.Dom.hasClass(node, SplitButtonState.MENU_DISABLED) 1591 }; 1592 } else { 1593 tag = _classStaticPrivateMethodGet(this, ButtonManager, _getTag).call(this, node); 1594 if (tag === null) { 1595 throw new Error('BX.UI.ButtonManager.createFromNode: "node" must be a button, link or input.'); 1596 } 1597 disabled = main_core.Dom.hasClass(node, ButtonState.DISABLED); 1598 if (tag === ButtonTag.INPUT || tag === ButtonTag.SUBMIT) { 1599 text = node.value; 1600 } else { 1601 [textNode, counterNode] = _classStaticPrivateMethodGet(this, ButtonManager, _getTextNode).call(this, node); 1602 text = textNode.textContent; 1603 } 1604 } 1605 const options = { 1606 id: node.dataset.btnUniqid, 1607 buttonNode: node, 1608 textNode: isSplitButton ? null : textNode, 1609 counterNode: isSplitButton ? null : counterNode, 1610 counter: _classStaticPrivateMethodGet(this, ButtonManager, _getCounter).call(this, counterNode), 1611 tag, 1612 text, 1613 disabled, 1614 mainButton: mainButtonOptions, 1615 menuButton: menuButtonOptions, 1616 size: _classStaticPrivateMethodGet(this, ButtonManager, _getEnumProp).call(this, node, ButtonSize), 1617 color: _classStaticPrivateMethodGet(this, ButtonManager, _getEnumProp).call(this, node, ButtonColor), 1618 icon: _classStaticPrivateMethodGet(this, ButtonManager, _getEnumProp).call(this, node, ButtonIcon), 1619 state: _classStaticPrivateMethodGet(this, ButtonManager, _getEnumProp).call(this, node, isSplitButton ? SplitButtonState : ButtonState), 1620 noCaps: main_core.Dom.hasClass(node, ButtonStyle.NO_CAPS), 1621 round: main_core.Dom.hasClass(node, ButtonStyle.ROUND) 1622 }; 1623 const nodeOptions = main_core.Dom.attr(node, 'data-json-options') || {}; 1624 if (main_core.Dom.hasClass(node, ButtonStyle.DROPDOWN)) { 1625 options.dropdown = true; 1626 } else if (nodeOptions.dropdown === false) { 1627 options.dropdown = false; 1628 } 1629 if (nodeOptions.onclick) { 1630 options.onclick = _classStaticPrivateMethodGet(this, ButtonManager, _convertEventHandler).call(this, nodeOptions.onclick); 1631 } 1632 if (main_core.Type.isPlainObject(nodeOptions.events)) { 1633 options.events = nodeOptions.events; 1634 _classStaticPrivateMethodGet(this, ButtonManager, _convertEvents).call(this, options.events); 1635 } 1636 if (main_core.Type.isPlainObject(nodeOptions.menu)) { 1637 options.menu = nodeOptions.menu; 1638 _classStaticPrivateMethodGet(this, ButtonManager, _convertMenuEvents).call(this, options.menu.items); 1639 } 1640 ['mainButton', 'menuButton'].forEach(button => { 1641 if (!main_core.Type.isPlainObject(nodeOptions[button])) { 1642 return; 1643 } 1644 options[button] = main_core.Runtime.merge(options[button], nodeOptions[button]); 1645 if (options[button].onclick) { 1646 options[button].onclick = _classStaticPrivateMethodGet(this, ButtonManager, _convertEventHandler).call(this, options[button].onclick); 1647 } 1648 _classStaticPrivateMethodGet(this, ButtonManager, _convertEvents).call(this, options[button].events); 1649 }); 1650 if (main_core.Type.isStringFilled(nodeOptions.menuTarget)) { 1651 options.menuTarget = nodeOptions.menuTarget; 1652 } 1653 return isSplitButton ? new SplitButton(options) : new Button(options); 1654 } 1655 }, { 1656 key: "createByUniqId", 1657 value: function createByUniqId(id) { 1658 if (!main_core.Type.isStringFilled(id)) { 1659 return null; 1660 } 1661 const node = document.querySelector(`[data-btn-uniqid="${id}"]`); 1662 return node ? this.createFromNode(node) : null; 1663 } 1664 /** 1665 * @private 1666 * @param {HTMLElement} node 1667 * @return {null|number} 1668 */ 1669 }, { 1670 key: "getByUniqid", 1671 /** 1672 * @deprecated 1673 * @param uniqId 1674 * @return {null|*} 1675 */ 1676 value: function getByUniqid(uniqId) { 1677 const toolbar = BX.UI.ToolbarManager.getDefaultToolbar(); 1678 return toolbar ? toolbar.getButton(uniqId) : null; 1679 } 1680 }]); 1681 return ButtonManager; 1682 }(); 1683 function _getTag(node) { 1684 if (node.nodeName === 'A') { 1685 return ButtonTag.LINK; 1686 } else if (node.nodeName === 'BUTTON') { 1687 return ButtonTag.BUTTON; 1688 } else if (node.nodeName === 'INPUT' && node.type === 'button') { 1689 return ButtonTag.INPUT; 1690 } else if (node.nodeName === 'INPUT' && node.type === 'submit') { 1691 return ButtonTag.SUBMIT; 1692 } 1693 return null; 1694 } 1695 function _getTextNode(node) { 1696 let textNode = node.querySelector('.ui-btn-text'); 1697 const counterNode = node.querySelector('.ui-btn-counter'); 1698 if (!textNode) { 1699 if (counterNode) { 1700 main_core.Dom.remove(counterNode); 1701 } 1702 textNode = main_core.Tag.render(_t$2 || (_t$2 = _$2`<span class="ui-btn-text">${0}</span>`), node.innerHTML.trim()); 1703 main_core.Dom.clean(node); 1704 main_core.Dom.append(textNode, node); 1705 if (counterNode) { 1706 main_core.Dom.append(counterNode, node); 1707 } 1708 } 1709 return [textNode, counterNode]; 1710 } 1711 function _getCounter(counterNode) { 1712 if (main_core.Type.isDomNode(counterNode)) { 1713 const textContent = counterNode.textContent; 1714 const counter = Number(textContent); 1715 return main_core.Type.isNumber(counter) ? counter : textContent; 1716 } 1717 return null; 1718 } 1719 function _getEnumProp(node, enumeration) { 1720 for (let key in enumeration) { 1721 if (!enumeration.hasOwnProperty(key)) { 1722 continue; 1723 } 1724 if (main_core.Dom.hasClass(node, enumeration[key])) { 1725 return enumeration[key]; 1726 } 1727 } 1728 return null; 1729 } 1730 function _convertEventHandler(handler) { 1731 if (main_core.Type.isFunction(handler)) { 1732 return handler; 1733 } 1734 if (!main_core.Type.isObject(handler)) { 1735 throw new Error('BX.UI.ButtonManager.createFromNode: Event handler must be described as object or function.'); 1736 } 1737 if (main_core.Type.isStringFilled(handler.code)) { 1738 return function () { 1739 // handle code can use callback arguments 1740 eval(handler.code); 1741 }; 1742 } else if (main_core.Type.isStringFilled(handler.event)) { 1743 return function (...args) { 1744 let event; 1745 if (args[0] instanceof main_core_events.BaseEvent) { 1746 event = args[0]; 1747 } else { 1748 if (args[0] instanceof BaseButton) { 1749 event = new main_core_events.BaseEvent({ 1750 data: { 1751 button: args[0], 1752 event: args[1] 1753 } 1754 }); 1755 } else if (args[1] instanceof main_popup.MenuItem) { 1756 event = new main_core_events.BaseEvent({ 1757 data: { 1758 item: args[1], 1759 event: args[0] 1760 } 1761 }); 1762 } else { 1763 event = new main_core_events.BaseEvent({ 1764 data: args 1765 }); 1766 } 1767 } 1768 main_core_events.EventEmitter.emit(handler.event, event); 1769 }; 1770 } else if (main_core.Type.isStringFilled(handler.handler)) { 1771 return function (...args) { 1772 const fn = main_core.Reflection.getClass(handler.handler); 1773 if (main_core.Type.isFunction(fn)) { 1774 let context = this; 1775 if (main_core.Type.isStringFilled(handler.context)) { 1776 context = main_core.Reflection.getClass(handler.context); 1777 }
1778 return fn.apply(context, args); 1779 } else { 1780 console.warn(`BX.UI.ButtonManager.createFromNode: be aware, the handler ${handler.handler} is not a function.`); 1781 } 1782 return null; 1783 }; 1784 } 1785 return null; 1786 } 1787 function _convertEvents(events) { 1788 if (main_core.Type.isPlainObject(events)) { 1789 for (let [eventName, eventFn] of Object.entries(events)) { 1790 events[eventName] = _classStaticPrivateMethodGet(this, ButtonManager, _convertEventHandler).call(this, eventFn); 1791 } 1792 } 1793 } 1794 function _convertMenuEvents(items) { 1795 if (!main_core.Type.isArray(items)) { 1796 return; 1797 } 1798 items.forEach(item => { 1799 if (item.onclick) { 1800 item.onclick = _classStaticPrivateMethodGet(this, ButtonManager, _convertEventHandler).call(this, item.onclick); 1801 } 1802 if (item.events) { 1803 _classStaticPrivateMethodGet(this, ButtonManager, _convertEvents).call(this, item.events); 1804 } 1805 if (main_core.Type.isArray(item.items)) { 1806 _classStaticPrivateMethodGet(this, ButtonManager, _convertMenuEvents).call(this, item.items); 1807 } 1808 }); 1809 } 1810 1811 /** 1812 * @namespace {BX.UI} 1813 */ 1814 let IButton = /*#__PURE__*/function () { 1815 function IButton() { 1816 babelHelpers.classCallCheck(this, IButton); 1817 } 1818 babelHelpers.createClass(IButton, [{ 1819 key: "render", 1820 value: function render() { 1821 throw new Error('BX.UI.IButton: Must be implemented by a subclass'); 1822 } 1823 }]); 1824 return IButton; 1825 }(); 1826 1827 /** 1828 * @namespace {BX.UI} 1829 */ 1830 let AddButton = /*#__PURE__*/function (_Button) { 1831 babelHelpers.inherits(AddButton, _Button); 1832 function AddButton() { 1833 babelHelpers.classCallCheck(this, AddButton); 1834 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(AddButton).apply(this, arguments)); 1835 } 1836 babelHelpers.createClass(AddButton, [{ 1837 key: "getDefaultOptions", 1838 value: function getDefaultOptions() { 1839 return { 1840 text: main_core.Loc.getMessage('UI_BUTTONS_ADD_BTN_TEXT'), 1841 color: ButtonColor.SUCCESS 1842 }; 1843 } 1844 }]); 1845 return AddButton; 1846 }(Button); 1847 1848 /** 1849 * @namespace {BX.UI} 1850 */ 1851 let ApplyButton = /*#__PURE__*/function (_Button) { 1852 babelHelpers.inherits(ApplyButton, _Button); 1853 function ApplyButton() { 1854 babelHelpers.classCallCheck(this, ApplyButton); 1855 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ApplyButton).apply(this, arguments)); 1856 } 1857 babelHelpers.createClass(ApplyButton, [{ 1858 key: "getDefaultOptions", 1859 value: function getDefaultOptions() { 1860 return { 1861 text: main_core.Loc.getMessage('UI_BUTTONS_APPLY_BTN_TEXT'), 1862 color: ButtonColor.LIGHT_BORDER 1863 }; 1864 } 1865 }]); 1866 return ApplyButton; 1867 }(Button); 1868 1869 /** 1870 * @namespace {BX.UI} 1871 */ 1872 let CancelButton = /*#__PURE__*/function (_Button) { 1873 babelHelpers.inherits(CancelButton, _Button); 1874 function CancelButton() { 1875 babelHelpers.classCallCheck(this, CancelButton); 1876 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CancelButton).apply(this, arguments)); 1877 } 1878 babelHelpers.createClass(CancelButton, [{ 1879 key: "getDefaultOptions", 1880 value: function getDefaultOptions() { 1881 return { 1882 text: main_core.Loc.getMessage('UI_BUTTONS_CANCEL_BTN_TEXT'), 1883 color: ButtonColor.LINK 1884 }; 1885 } 1886 }]); 1887 return CancelButton; 1888 }(Button); 1889 1890 /** 1891 * @namespace {BX.UI} 1892 */ 1893 let CloseButton = /*#__PURE__*/function (_Button) { 1894 babelHelpers.inherits(CloseButton, _Button); 1895 function CloseButton() { 1896 babelHelpers.classCallCheck(this, CloseButton); 1897 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CloseButton).apply(this, arguments)); 1898 } 1899 babelHelpers.createClass(CloseButton, [{ 1900 key: "getDefaultOptions", 1901 value: function getDefaultOptions() { 1902 return { 1903 text: main_core.Loc.getMessage('UI_BUTTONS_CLOSE_BTN_TEXT'), 1904 color: ButtonColor.LINK 1905 }; 1906 } 1907 }]); 1908 return CloseButton; 1909 }(Button); 1910 1911 /** 1912 * @namespace {BX.UI} 1913 */ 1914 let CreateButton = /*#__PURE__*/function (_Button) { 1915 babelHelpers.inherits(CreateButton, _Button); 1916 function CreateButton() { 1917 babelHelpers.classCallCheck(this, CreateButton); 1918 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CreateButton).apply(this, arguments)); 1919 } 1920 babelHelpers.createClass(CreateButton, [{ 1921 key: "getDefaultOptions", 1922 value: function getDefaultOptions() { 1923 return { 1924 text: main_core.Loc.getMessage('UI_BUTTONS_CREATE_BTN_TEXT'), 1925 color: ButtonColor.SUCCESS 1926 }; 1927 } 1928 }]); 1929 return CreateButton; 1930 }(Button); 1931 1932 /** 1933 * @namespace {BX.UI} 1934 */ 1935 let SaveButton = /*#__PURE__*/function (_Button) { 1936 babelHelpers.inherits(SaveButton, _Button); 1937 function SaveButton() { 1938 babelHelpers.classCallCheck(this, SaveButton); 1939 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SaveButton).apply(this, arguments)); 1940 } 1941 babelHelpers.createClass(SaveButton, [{ 1942 key: "getDefaultOptions", 1943 value: function getDefaultOptions() { 1944 return { 1945 text: main_core.Loc.getMessage('UI_BUTTONS_SAVE_BTN_TEXT'), 1946 color: ButtonColor.SUCCESS 1947 }; 1948 } 1949 }]); 1950 return SaveButton; 1951 }(Button); 1952 1953 /** 1954 * @namespace {BX.UI} 1955 */ 1956 let SendButton = /*#__PURE__*/function (_Button) { 1957 babelHelpers.inherits(SendButton, _Button); 1958 function SendButton() { 1959 babelHelpers.classCallCheck(this, SendButton); 1960 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Sen
1960dButton).apply(this, arguments)); 1961 } 1962 babelHelpers.createClass(SendButton, [{ 1963 key: "getDefaultOptions", 1964 value: function getDefaultOptions() { 1965 return { 1966 text: main_core.Loc.getMessage('UI_BUTTONS_SEND_BTN_TEXT'), 1967 color: ButtonColor.SUCCESS 1968 }; 1969 } 1970 }]); 1971 return SendButton; 1972 }(Button); 1973 1974 /** 1975 * @namespace {BX.UI} 1976 */ 1977 let SettingsButton = /*#__PURE__*/function (_Button) { 1978 babelHelpers.inherits(SettingsButton, _Button); 1979 function SettingsButton() { 1980 babelHelpers.classCallCheck(this, SettingsButton); 1981 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SettingsButton).apply(this, arguments)); 1982 } 1983 babelHelpers.createClass(SettingsButton, [{ 1984 key: "getDefaultOptions", 1985 value: function getDefaultOptions() { 1986 return { 1987 icon: ButtonIcon.SETTING, 1988 color: ButtonColor.LIGHT_BORDER, 1989 dropdown: false 1990 }; 1991 } 1992 }]); 1993 return SettingsButton; 1994 }(Button); 1995 1996 /** 1997 * @namespace {BX.UI} 1998 */ 1999 let AddSplitButton = /*#__PURE__*/function (_SplitButton) { 2000 babelHelpers.inherits(AddSplitButton, _SplitButton); 2001 function AddSplitButton() { 2002 babelHelpers.classCallCheck(this, AddSplitButton); 2003 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(AddSplitButton).apply(this, arguments)); 2004 } 2005 babelHelpers.createClass(AddSplitButton, [{ 2006 key: "getDefaultOptions", 2007 value: function getDefaultOptions() { 2008 return { 2009 text: main_core.Loc.getMessage('UI_BUTTONS_ADD_BTN_TEXT'), 2010 color: ButtonColor.SUCCESS 2011 }; 2012 } 2013 }]); 2014 return AddSplitButton; 2015 }(SplitButton); 2016 2017 /** 2018 * @namespace {BX.UI} 2019 */ 2020 let ApplySplitButton = /*#__PURE__*/function (_SplitButton) { 2021 babelHelpers.inherits(ApplySplitButton, _SplitButton); 2022 function ApplySplitButton() { 2023 babelHelpers.classCallCheck(this, ApplySplitButton); 2024 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ApplySplitButton).apply(this, arguments)); 2025 } 2026 babelHelpers.createClass(ApplySplitButton, [{ 2027 key: "getDefaultOptions", 2028 value: function getDefaultOptions() { 2029 return { 2030 text: main_core.Loc.getMessage('UI_BUTTONS_APPLY_BTN_TEXT'), 2031 color: ButtonColor.LIGHT_BORDER 2032 }; 2033 } 2034 }]); 2035 return ApplySplitButton; 2036 }(SplitButton); 2037 2038 /** 2039 * @namespace {BX.UI} 2040 */ 2041 let CancelSplitButton = /*#__PURE__*/function (_SplitButton) { 2042 babelHelpers.inherits(CancelSplitButton, _SplitButton); 2043 function CancelSplitButton() { 2044 babelHelpers.classCallCheck(this, CancelSplitButton); 2045 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CancelSplitButton).apply(this, arguments)); 2046 } 2047 babelHelpers.createClass(CancelSplitButton, [{ 2048 key: "getDefaultOptions", 2049 value: function getDefaultOptions() { 2050 return { 2051 text: main_core.Loc.getMessage('UI_BUTTONS_CANCEL_BTN_TEXT'), 2052 color: ButtonColor.LINK 2053 }; 2054 } 2055 }]); 2056 return CancelSplitButton; 2057 }(SplitButton); 2058 2059 /** 2060 * @namespace {BX.UI} 2061 */ 2062 let CloseSplitButton = /*#__PURE__*/function (_SplitButton) { 2063 babelHelpers.inherits(CloseSplitButton, _SplitButton); 2064 function CloseSplitButton() { 2065 babelHelpers.classCallCheck(this, CloseSplitButton); 2066 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CloseSplitButton).apply(this, arguments)); 2067 } 2068 babelHelpers.createClass(CloseSplitButton, [{ 2069 key: "getDefaultOptions", 2070 value: function getDefaultOptions() { 2071 return { 2072 text: main_core.Loc.getMessage('UI_BUTTONS_CLOSE_BTN_TEXT'), 2073 color: ButtonColor.LINK 2074 }; 2075 } 2076 }]); 2077 return CloseSplitButton; 2078 }(SplitButton); 2079 2080 /** 2081 * @namespace {BX.UI} 2082 */ 2083 let CreateSplitButton = /*#__PURE__*/function (_SplitButton) { 2084 babelHelpers.inherits(CreateSplitButton, _SplitButton); 2085 function CreateSplitButton() { 2086 babelHelpers.classCallCheck(this, CreateSplitButton); 2087 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CreateSplitButton).apply(this, arguments)); 2088 } 2089 babelHelpers.createClass(CreateSplitButton, [{ 2090 key: "getDefaultOptions", 2091 value: function getDefaultOptions() { 2092 return { 2093 text: main_core.Loc.getMessage('UI_BUTTONS_CREATE_BTN_TEXT'), 2094 color: ButtonColor.SUCCESS 2095 }; 2096 } 2097 }]); 2098 return CreateSplitButton; 2099 }(SplitButton); 2100 2101 /** 2102 * @namespace {BX.UI} 2103 */
2104 let SaveSplitButton = /*#__PURE__*/function (_SplitButton) { 2105 babelHelpers.inherits(SaveSplitButton, _SplitButton); 2106 function SaveSplitButton() { 2107 babelHelpers.classCallCheck(this, SaveSplitButton); 2108 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SaveSplitButton).apply(this, arguments)); 2109 } 2110 babelHelpers.createClass(SaveSplitButton, [{ 2111 key: "getDefaultOptions", 2112 value: function getDefaultOptions() { 2113 return { 2114 text: main_core.Loc.getMessage('UI_BUTTONS_SAVE_BTN_TEXT'), 2115 color: ButtonColor.SUCCESS 2116 }; 2117 } 2118 }]); 2119 return SaveSplitButton; 2120 }(SplitButton); 2121 2122 /** 2123 * @namespace {BX.UI} 2124 */ 2125 let SendSplitButton = /*#__PURE__*/function (_SplitButton) { 2126 babelHelpers.inherits(SendSplitButton, _SplitButton); 2127 function SendSplitButton() { 2128 babelHelpers.classCallCheck(this, SendSplitButton); 2129 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(SendSplitButton).apply(this, arguments)); 2130 } 2131 babelHelpers.createClass(SendSplitButton, [{ 2132 key: "getDefaultOptions", 2133 value: function getDefaultOptions() { 2134 return { 2135 text: main_core.Loc.getMessage('UI_BUTTONS_SEND_BTN_TEXT'), 2136 color: ButtonColor.SUCCESS 2137 }; 2138 } 2139 }]); 2140 return SendSplitButton; 2141 }(SplitButton); 2142 2143 exports.IButton = IButton; 2144 exports.BaseButton = BaseButton; 2145 exports.Button = Button; 2146 exports.SplitButton = SplitButton; 2147 exports.SplitSubButton = SplitSubButton; 2148 exports.ButtonManager = ButtonManager; 2149 exports.ButtonIcon = ButtonIcon; 2150 exports.ButtonSize = ButtonSize; 2151 exports.ButtonState = ButtonState; 2152 exports.ButtonColor = ButtonColor; 2153 exports.ButtonStyle = ButtonStyle; 2154 exports.ButtonTag = ButtonTag; 2155 exports.SplitButtonState = SplitButtonState; 2156 exports.SplitSubButtonType = SplitSubButtonType; 2157 exports.AddButton = AddButton; 2158 exports.ApplyButton = ApplyButton; 2159 exports.CancelButton = CancelButton; 2160 exports.CloseButton = CloseButton; 2161 exports.CreateButton = CreateButton; 2162 exports.SaveButton = SaveButton; 2163 exports.SendButton = SendButton; 2164 exports.SettingsButton = SettingsButton; 2165 exports.AddSplitButton = AddSplitButton; 2166 exports.ApplySplitButton = ApplySplitButton; 2167 exports.CancelSplitButton = CancelSplitButton; 2168 exports.CloseSplitButton = CloseSplitButton; 2169 exports.CreateSplitButton = CreateSplitButton; 2170 exports.SaveSplitButton = SaveSplitButton; 2171 exports.SendSplitButton = SendSplitButton; 2172 2173}((this.BX.UI = this.BX.UI || {}),BX.Event,BX.Main,BX)); 2174//# sourceMappingURL=ui.buttons.bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.