mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
1 line
24 KiB
Plaintext
1 line
24 KiB
Plaintext
{"version":3,"sources":["../src/dropdown.js"],"names":["Dropdown","$","Popper","Error","NAME","VERSION","DATA_KEY","EVENT_KEY","DATA_API_KEY","JQUERY_NO_CONFLICT","fn","ESCAPE_KEYCODE","SPACE_KEYCODE","TAB_KEYCODE","ARROW_UP_KEYCODE","ARROW_DOWN_KEYCODE","RIGHT_MOUSE_BUTTON_WHICH","REGEXP_KEYDOWN","RegExp","Event","HIDE","HIDDEN","SHOW","SHOWN","CLICK","CLICK_DATA_API","KEYDOWN_DATA_API","KEYUP_DATA_API","ClassName","DISABLED","DROPUP","MENURIGHT","MENULEFT","Selector","DATA_TOGGLE","FORM_CHILD","MENU","NAVBAR_NAV","VISIBLE_ITEMS","AttachmentMap","TOP","TOPEND","BOTTOM","BOTTOMEND","Default","placement","offset","flip","DefaultType","element","config","_element","_popper","_config","_getConfig","_menu","_getMenuElement","_inNavbar","_detectNavbar","_addEventListeners","toggle","disabled","hasClass","parent","_getParentFromElement","isActive","_clearMenus","relatedTarget","showEvent","trigger","isDefaultPrevented","_getPopperConfig","document","documentElement","closest","length","children","on","noop","focus","setAttribute","toggleClass","dispose","removeData","off","destroy","update","scheduleUpdate","event","preventDefault","stopPropagation","elementData","data","undefined","toUpperCase","extend","constructor","Util","typeCheckConfig","find","_getPlacement","$parentDropdown","popperConfig","modifiers","enabled","AfterApplyStyle","order","attr","_jQueryInterface","each","which","type","toggles","makeArray","i","context","dropdownMenu","test","target","tagName","contains","hideEvent","removeClass","selector","getSelectorFromElement","parentNode","_dataApiKeydownHandler","items","get","index","indexOf","call","e","Constructor","noConflict","jQuery"],"mappings":";;;;;;AAKA;;;;;;;AAOA,IAAMA,WAAY,UAACC,CAAD,EAAO;;AAEvB;;;;AAIA,MAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;AACjC,UAAM,IAAIC,KAAJ,CAAU,8DAAV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SAASE,UATrC,EASiD,UAACiG,CAAD,EAAO;AACpDA,MAAE1C,eAAF;AACD;;AAGH;;;;;;AAdA,IAoBAzF,EAAES,EAAF,CAAKN,IAAL,IAAyBJ,SAAS4G,gBAAlC;AACA3G,IAAES,EAAF,CAAKN,IAAL,EAAWiI,WAAX,GAAyBrI,QAAzB;AACAC,IAAES,EAAF,CAAKN,IAAL,EAAWkI,UAAX,GAAyB,YAAY;AACnCrI,MAAES,EAAF,CAAKN,IAAL,IAAaK,kBAAb;AACA,WAAOT,SAAS4G,gBAAhB;AACD,GAHD;;AAKA,SAAO5G,QAAP;AAED,CAvbgB,CAubduI,MAvbc,CAAjB,C,CAZA","file":"dropdown.js","sourcesContent":["/* global Popper */\n\nimport Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-alpha.6): dropdown.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Dropdown = (($) => {\n\n /**\n * Check for Popper dependency\n * Popper - https://popper.js.org\n */\n if (typeof Popper === 'undefined') {\n throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)')\n }\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'dropdown'\n const VERSION = '4.0.0-alpha.6'\n const DATA_KEY = 'bs.dropdown'\n const EVENT_KEY = `.${DATA_KEY}`\n const DATA_API_KEY = '.data-api'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key\n const SPACE_KEYCODE = 32 // KeyboardEvent.which value for space key\n const TAB_KEYCODE = 9 // KeyboardEvent.which value for tab key\n const ARROW_UP_KEYCODE = 38 // KeyboardEvent.which value for up arrow key\n const ARROW_DOWN_KEYCODE = 40 // KeyboardEvent.which value for down arrow key\n const RIGHT_MOUSE_BUTTON_WHICH = 3 // MouseEvent.which value for the right button (assuming a right-handed mouse)\n const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEYCODE}|${ARROW_DOWN_KEYCODE}|${ESCAPE_KEYCODE}`)\n\n const Event = {\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n CLICK : `click${EVENT_KEY}`,\n CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`,\n KEYDOWN_DATA_API : `keydown${EVENT_KEY}${DATA_API_KEY}`,\n KEYUP_DATA_API : `keyup${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const ClassName = {\n DISABLED : 'disabled',\n SHOW : 'show',\n DROPUP : 'dropup',\n MENURIGHT : 'dropdown-menu-right',\n MENULEFT : 'dropdown-menu-left'\n }\n\n const Selector = {\n DATA_TOGGLE : '[data-toggle=\"dropdown\"]',\n FORM_CHILD : '.dropdown form',\n MENU : '.dropdown-menu',\n NAVBAR_NAV : '.navbar-nav',\n VISIBLE_ITEMS : '.dropdown-menu .dropdown-item:not(.disabled)'\n }\n\n const AttachmentMap = {\n TOP : 'top-start',\n TOPEND : 'top-end',\n BOTTOM : 'bottom-start',\n BOTTOMEND : 'bottom-end'\n }\n\n const Default = {\n placement : AttachmentMap.BOTTOM,\n offset : 0,\n flip : true\n }\n\n const DefaultType = {\n placement : 'string',\n offset : '(number|string)',\n flip : 'boolean'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Dropdown {\n\n constructor(element, config) {\n this._element = element\n this._popper = null\n this._config = this._getConfig(config)\n this._menu = this._getMenuElement()\n this._inNavbar = this._detectNavbar()\n\n this._addEventListeners()\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n // public\n\n toggle() {\n if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) {\n return\n }\n\n const parent = Dropdown._getParentFromElement(this._element)\n const isActive = $(this._menu).hasClass(ClassName.SHOW)\n\n Dropdown._clearMenus()\n\n if (isActive) {\n return\n }\n\n const relatedTarget = {\n relatedTarget : this._element\n }\n const showEvent = $.Event(Event.SHOW, relatedTarget)\n\n $(parent).trigger(showEvent)\n\n if (showEvent.isDefaultPrevented()) {\n return\n }\n\n let element = this._element\n // for dropup with alignment we use the parent as popper container\n if ($(parent).hasClass(ClassName.DROPUP)) {\n if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {\n element = parent\n }\n }\n this._popper = new Popper(element, this._menu, this._getPopperConfig())\n\n // if this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement &&\n !$(parent).closest(Selector.NAVBAR_NAV).length) {\n $('body').children().on('mouseover', null, $.noop)\n }\n\n this._element.focus()\n this._element.setAttribute('aria-expanded', true)\n\n $(this._menu).toggleClass(ClassName.SHOW)\n $(parent)\n .toggleClass(ClassName.SHOW)\n .trigger($.Event(Event.SHOWN, relatedTarget))\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n $(this._element).off(EVENT_KEY)\n this._element = null\n this._menu = null\n if (this._popper !== null) {\n this._popper.destroy()\n }\n this._popper = null\n }\n\n update() {\n this._inNavbar = this._detectNavbar()\n if (this._popper !== null) {\n this._popper.scheduleUpdate()\n }\n }\n\n // private\n\n _addEventListeners() {\n $(this._element).on(Event.CLICK, (event) => {\n event.preventDefault()\n event.stopPropagation()\n this.toggle()\n })\n }\n\n _getConfig(config) {\n const elementData = $(this._element).data()\n if (elementData.placement !== undefined) {\n elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]\n }\n\n config = $.extend(\n {},\n this.constructor.Default,\n $(this._element).data(),\n config\n )\n\n Util.typeCheckConfig(\n NAME,\n config,\n this.constructor.DefaultType\n )\n\n return config\n }\n\n _getMenuElement() {\n if (!this._menu) {\n const parent = Dropdown._getParentFromElement(this._element)\n this._menu = $(parent).find(Selector.MENU)[0]\n }\n return this._menu\n }\n\n _getPlacement() {\n const $parentDropdown = $(this._element).parent()\n let placement = this._config.placement\n\n // Handle dropup\n if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) {\n placement = AttachmentMap.TOP\n if ($(this._menu).hasClass(ClassName.MENURIGHT)) {\n placement = AttachmentMap.TOPEND\n }\n } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {\n placement = AttachmentMap.BOTTOMEND\n }\n return placement\n }\n\n _detectNavbar() {\n return $(this._element).closest('.navbar').length > 0\n }\n\n _getPopperConfig() {\n const popperConfig = {\n placement : this._getPlacement(),\n modifiers : {\n offset : {\n offset : this._config.offset\n },\n flip : {\n enabled : this._config.flip\n }\n }\n }\n\n if (this._inNavbar) {\n popperConfig.modifiers.AfterApplyStyle = {\n enabled: true,\n order: 901, // ApplyStyle order + 1\n fn: () => {\n // reset Popper styles\n $(this._menu).attr('style', '')\n }\n }\n }\n return popperConfig\n }\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n const _config = typeof config === 'object' ? config : null\n\n if (!data) {\n data = new Dropdown(this, _config)\n $(this).data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined) {\n throw new Error(`No method named \"${config}\"`)\n }\n data[config]()\n }\n })\n }\n\n static _clearMenus(event) {\n if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH ||\n event.type === 'keyup' && event.which !== TAB_KEYCODE)) {\n return\n }\n\n const toggles = $.makeArray($(Selector.DATA_TOGGLE))\n for (let i = 0; i < toggles.length; i++) {\n const parent = Dropdown._getParentFromElement(toggles[i])\n const context = $(toggles[i]).data(DATA_KEY)\n const relatedTarget = {\n relatedTarget : toggles[i]\n }\n\n if (!context) {\n continue\n }\n\n const dropdownMenu = context._menu\n if (!$(parent).hasClass(ClassName.SHOW)) {\n continue\n }\n\n if (event && (event.type === 'click' &&\n /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE)\n && $.contains(parent, event.target)) {\n continue\n }\n\n const hideEvent = $.Event(Event.HIDE, relatedTarget)\n $(parent).trigger(hideEvent)\n if (hideEvent.isDefaultPrevented()) {\n continue\n }\n\n // if this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n $('body').children().off('mouseover', null, $.noop)\n }\n\n toggles[i].setAttribute('aria-expanded', 'false')\n\n $(dropdownMenu).removeClass(ClassName.SHOW)\n $(parent)\n .removeClass(ClassName.SHOW)\n .trigger($.Event(Event.HIDDEN, relatedTarget))\n }\n }\n\n static _getParentFromElement(element) {\n let parent\n const selector = Util.getSelectorFromElement(element)\n\n if (selector) {\n parent = $(selector)[0]\n }\n\n return parent || element.parentNode\n }\n\n static _dataApiKeydownHandler(event) {\n if (!REGEXP_KEYDOWN.test(event.which) || /button/i.test(event.target.tagName) && event.which === SPACE_KEYCODE ||\n /input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {\n return\n }\n\n const parent = Dropdown._getParentFromElement(this)\n const isActive = $(parent).hasClass(ClassName.SHOW)\n\n if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) ||\n isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {\n\n if (event.which === ESCAPE_KEYCODE) {\n const toggle = $(parent).find(Selector.DATA_TOGGLE)[0]\n $(toggle).trigger('focus')\n }\n\n $(this).trigger('click')\n return\n }\n\n const items = $(parent).find(Selector.VISIBLE_ITEMS).get()\n\n if (!items.length) {\n return\n }\n\n let index = items.indexOf(event.target)\n\n if (event.which === ARROW_UP_KEYCODE && index > 0) { // up\n index--\n }\n\n if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { // down\n index++\n }\n\n if (index < 0) {\n index = 0\n }\n\n items[index].focus()\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(document)\n .on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler)\n .on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler)\n .on(`${Event.CLICK_DATA_API} ${Event.KEYUP_DATA_API}`, Dropdown._clearMenus)\n .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n event.preventDefault()\n event.stopPropagation()\n Dropdown._jQueryInterface.call($(this), 'toggle')\n })\n .on(Event.CLICK_DATA_API, Selector.FORM_CHILD, (e) => {\n e.stopPropagation()\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Dropdown._jQueryInterface\n $.fn[NAME].Constructor = Dropdown\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Dropdown._jQueryInterface\n }\n\n return Dropdown\n\n})(jQuery)\n\nexport default Dropdown\n"]} |