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