diff options
author | Mark Otto <markdotto@gmail.com> | 2018-07-24 03:51:14 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2018-07-24 03:51:14 +0300 |
commit | 72447ad4972105e920f1767f369b98a76dcfa107 (patch) | |
tree | c0240d4188573cc3aedd090fb99e0bea358088b6 /js/dist/button.js | |
parent | d18045210cdd09271ac033992341d4460d6bafac (diff) |
dist
Diffstat (limited to 'js/dist/button.js')
-rw-r--r-- | js/dist/button.js | 275 |
1 files changed, 150 insertions, 125 deletions
diff --git a/js/dist/button.js b/js/dist/button.js index 3dc17f1f92..99d93ae192 100644 --- a/js/dist/button.js +++ b/js/dist/button.js @@ -1,167 +1,192 @@ -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : + typeof define === 'function' && define.amd ? define(['jquery'], factory) : + (global.Button = factory(global.jQuery)); +}(this, (function ($) { 'use strict'; + + $ = $ && $.hasOwnProperty('default') ? $['default'] : $; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.1.2): button.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ -var Button = function ($) { /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ + * -------------------------------------------------------------------------- + * Bootstrap (v4.1.2): button.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- */ - var NAME = 'button'; - var VERSION = '4.1.2'; - var DATA_KEY = 'bs.button'; - var EVENT_KEY = "." + DATA_KEY; - var DATA_API_KEY = '.data-api'; - var JQUERY_NO_CONFLICT = $.fn[NAME]; - var ClassName = { - ACTIVE: 'active', - BUTTON: 'btn', - FOCUS: 'focus' - }; - var Selector = { - DATA_TOGGLE_CARROT: '[data-toggle^="button"]', - DATA_TOGGLE: '[data-toggle="buttons"]', - INPUT: 'input', - ACTIVE: '.active', - BUTTON: '.btn' - }; - var Event = { - CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, - FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY) + + var Button = function ($$$1) { /** * ------------------------------------------------------------------------ - * Class Definition + * Constants * ------------------------------------------------------------------------ */ + var NAME = 'button'; + var VERSION = '4.1.2'; + var DATA_KEY = 'bs.button'; + var EVENT_KEY = "." + DATA_KEY; + var DATA_API_KEY = '.data-api'; + var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; + var ClassName = { + ACTIVE: 'active', + BUTTON: 'btn', + FOCUS: 'focus' + }; + var Selector = { + DATA_TOGGLE_CARROT: '[data-toggle^="button"]', + DATA_TOGGLE: '[data-toggle="buttons"]', + INPUT: 'input', + ACTIVE: '.active', + BUTTON: '.btn' + }; + var Event = { + CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, + FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY) + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ - }; + }; - var Button = - /*#__PURE__*/ - function () { - function Button(element) { - this._element = element; - } // Getters + var Button = + /*#__PURE__*/ + function () { + function Button(element) { + this._element = element; + } // Getters - var _proto = Button.prototype; + var _proto = Button.prototype; - // Public - _proto.toggle = function toggle() { - var triggerChangeEvent = true; - var addAriaPressed = true; - var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; + // Public + _proto.toggle = function toggle() { + var triggerChangeEvent = true; + var addAriaPressed = true; + var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0]; - if (rootElement) { - var input = this._element.querySelector(Selector.INPUT); + if (rootElement) { + var input = this._element.querySelector(Selector.INPUT); - if (input) { - if (input.type === 'radio') { - if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = rootElement.querySelector(Selector.ACTIVE); + if (input) { + if (input.type === 'radio') { + if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) { + triggerChangeEvent = false; + } else { + var activeElement = rootElement.querySelector(Selector.ACTIVE); - if (activeElement) { - $(activeElement).removeClass(ClassName.ACTIVE); + if (activeElement) { + $$$1(activeElement).removeClass(ClassName.ACTIVE); + } } } - } - if (triggerChangeEvent) { - if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { - return; + if (triggerChangeEvent) { + if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { + return; + } + + input.checked = !this._element.classList.contains(ClassName.ACTIVE); + $$$1(input).trigger('change'); } - input.checked = !this._element.classList.contains(ClassName.ACTIVE); - $(input).trigger('change'); + input.focus(); + addAriaPressed = false; } + } - input.focus(); - addAriaPressed = false; + if (addAriaPressed) { + this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE)); } - } - if (addAriaPressed) { - this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE)); - } + if (triggerChangeEvent) { + $$$1(this._element).toggleClass(ClassName.ACTIVE); + } + }; - if (triggerChangeEvent) { - $(this._element).toggleClass(ClassName.ACTIVE); - } - }; + _proto.dispose = function dispose() { + $$$1.removeData(this._element, DATA_KEY); + this._element = null; + }; // Static - _proto.dispose = function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; - }; // Static + Button._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $$$1(this).data(DATA_KEY); - Button._jQueryInterface = function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); + if (!data) { + data = new Button(this); + $$$1(this).data(DATA_KEY, data); + } - if (!data) { - data = new Button(this); - $(this).data(DATA_KEY, data); - } + if (config === 'toggle') { + data[config](); + } + }); + }; - if (config === 'toggle') { - data[config](); + _createClass(Button, null, [{ + key: "VERSION", + get: function get() { + return VERSION; } - }); - }; + }]); - _createClass(Button, null, [{ - key: "VERSION", - get: function get() { - return VERSION; - } - }]); + return Button; + }(); + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ - return Button; - }(); - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ + $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { + event.preventDefault(); + var button = event.target; - $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { - event.preventDefault(); - var button = event.target; + if (!$$$1(button).hasClass(ClassName.BUTTON)) { + button = $$$1(button).closest(Selector.BUTTON); + } - if (!$(button).hasClass(ClassName.BUTTON)) { - button = $(button).closest(Selector.BUTTON); - } + Button._jQueryInterface.call($$$1(button), 'toggle'); + }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { + var button = $$$1(event.target).closest(Selector.BUTTON)[0]; + $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); + }); + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ - Button._jQueryInterface.call($(button), 'toggle'); - }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { - var button = $(event.target).closest(Selector.BUTTON)[0]; - $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); - }); - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ + $$$1.fn[NAME] = Button._jQueryInterface; + $$$1.fn[NAME].Constructor = Button; - $.fn[NAME] = Button._jQueryInterface; - $.fn[NAME].Constructor = Button; + $$$1.fn[NAME].noConflict = function () { + $$$1.fn[NAME] = JQUERY_NO_CONFLICT; + return Button._jQueryInterface; + }; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Button._jQueryInterface; - }; + return Button; + }($); return Button; -}($); -//# sourceMappingURL=button.js.map
\ No newline at end of file + +}))); +//# sourceMappingURL=button.js.map |