1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/js/dist/tab.js.map

1 line
No EOL
13 KiB
Text

{"version":3,"sources":["js/src/tab.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,GAAG,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AASlB,MAAM,IAAI,GAAkB,KAAK,CAAA;AACjC,MAAM,OAAO,GAAe,OAAO,CAAA;AACnC,MAAM,QAAQ,GAAc,QAAQ,CAAA;AACpC,MAAM,SAAS,SAAiB,QAAQ,AAAE,CAAA;AAC1C,MAAM,YAAY,GAAU,WAAW,CAAA;AACvC,MAAM,kBAAkB,GAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;AACtC,MAAM,mBAAmB,GAAG,GAAG,CAAA;;AAE/B,MAAM,KAAK,GAAG;AACZ,QAAI,WAAoB,SAAS,AAAE;AACnC,UAAM,aAAoB,SAAS,AAAE;AACrC,QAAI,WAAoB,SAAS,AAAE;AACnC,SAAK,YAAoB,SAAS,AAAE;AACpC,kBAAc,YAAW,SAAS,QAAG,YAAY,AAAE;GACpD,CAAA;;AAED,MAAM,SAAS,GAAG;AAChB,iBAAa,EAAG,eAAe;AAC/B,UAAM,EAAU,QAAQ;AACxB,QAAI,EAAY,MAAM;AACtB,MAAE,EAAc,IAAI;GACrB,CAAA;;AAED,MAAM,QAAQ,GAAG;AACf,KAAC,EAAuB,GAAG;AAC3B,MAAE,EAAsB,IAAI;AAC5B,eAAW,EAAa,aAAa;AACrC,MAAE,EAAsB,wBAAwB;AAChD,cAAU,EAAc,SAAS;AACjC,UAAM,EAAkB,SAAS;AACjC,gBAAY,EAAY,WAAW;AACnC,eAAW,EAAa,2CAA2C;AACnE,yBAAqB,EAAG,4BAA4B;GACrD,CAAA;;;;;;;;MASK,GAAG;AAEI,aAFP,GAAG,CAEK,OAAO,EAAE;4BAFjB,GAAG;;AAGL,UAAI,CAAC,QAAQ,G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CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,GAAG,CAAC,gBAAgB,CAAA;GAC5B,CAAA;;AAED,SAAO,GAAG,CAAA;CAEX,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/tab.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): tab.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Tab = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'tab'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.tab'\n const EVENT_KEY = `.${DATA_KEY}`\n const DATA_API_KEY = '.data-api'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 150\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_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const ClassName = {\n DROPDOWN_MENU : 'dropdown-menu',\n ACTIVE : 'active',\n FADE : 'fade',\n IN : 'in'\n }\n\n const Selector = {\n A : 'a',\n LI : 'li',\n LI_DROPDOWN : 'li.dropdown',\n UL : 'ul:not(.dropdown-menu)',\n FADE_CHILD : '> .fade',\n ACTIVE : '.active',\n ACTIVE_CHILD : '> .active',\n DATA_TOGGLE : '[data-toggle=\"tab\"], [data-toggle=\"pill\"]',\n DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu > .active'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Tab {\n\n constructor(element) {\n this._element = element\n }\n\n\n // getters\n\n static get VERSION() {\n return VERSION\n }\n\n\n // public\n\n show() {\n if (this._element.parentNode &&\n (this._element.parentNode.nodeType == Node.ELEMENT_NODE) &&\n ($(this._element).parent().hasClass(ClassName.ACTIVE))) {\n return\n }\n\n let target\n let previous\n let ulElement = $(this._element).closest(Selector.UL)[0]\n let selector = Util.getSelectorFromElement(this._element)\n\n if (ulElement) {\n previous = $.makeArray($(ulElement).find(Selector.ACTIVE))\n previous = previous[previous.length - 1]\n\n if (previous) {\n previous = $(previous).find(Selector.A)[0]\n }\n }\n\n let hideEvent = $.Event(Event.HIDE, {\n relatedTarget: this._element\n })\n\n let showEvent = $.Event(Event.SHOW, {\n relatedTarget: previous\n })\n\n if (previous) {\n $(previous).trigger(hideEvent)\n }\n\n $(this._element).trigger(showEvent)\n\n if (showEvent.isDefaultPrevented() ||\n (hideEvent.isDefaultPrevented())) {\n return\n }\n\n if (selector) {\n target = $(selector)[0]\n }\n\n this._activate(\n $(this._element).closest(Selector.LI)[0],\n ulElement\n )\n\n let complete = () => {\n let hiddenEvent = $.Event(Event.HIDDEN, {\n relatedTarget: this._element\n })\n\n let shownEvent = $.Event(Event.SHOWN, {\n relatedTarget: previous\n })\n\n $(previous).trigger(hiddenEvent)\n $(this._element).trigger(shownEvent)\n }\n\n if (target) {\n this._activate(target, target.parentNode, complete)\n } else {\n complete()\n }\n }\n\n dispose() {\n $.removeClass(this._element, DATA_KEY)\n this._element = null\n }\n\n\n // private\n\n _activate(element, container, callback) {\n let active = $(container).find(Selector.ACTIVE_CHILD)[0]\n let isTransitioning = callback\n && Util.supportsTransitionEnd()\n && ((active && $(active).hasClass(ClassName.FADE))\n || !!$(container).find(Selector.FADE_CHILD)[0])\n\n let complete = $.proxy(\n this._transitionComplete,\n this,\n element,\n active,\n isTransitioning,\n callback\n )\n\n if (active && isTransitioning) {\n $(active)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(TRANSITION_DURATION)\n\n } else {\n complete()\n }\n\n if (active) {\n $(active).removeClass(ClassName.IN)\n }\n }\n\n _transitionComplete(element, active, isTransitioning, callback) {\n if (active) {\n $(active).removeClass(ClassName.ACTIVE)\n\n let dropdownChild = $(active).find(\n Selector.DROPDOWN_ACTIVE_CHILD\n )[0]\n if (dropdownChild) {\n $(dropdownChild).removeClass(ClassName.ACTIVE)\n }\n\n let activeToggle = $(active).find(Selector.DATA_TOGGLE)[0]\n if (activeToggle) {\n activeToggle.setAttribute('aria-expanded', false)\n }\n }\n\n $(element).addClass(ClassName.ACTIVE)\n\n let elementToggle = $(element).find(Selector.DATA_TOGGLE)[0]\n if (elementToggle) {\n elementToggle.setAttribute('aria-expanded', true)\n }\n\n if (isTransitioning) {\n Util.reflow(element)\n $(element).addClass(ClassName.IN)\n } else {\n $(element).removeClass(ClassName.FADE)\n }\n\n if (element.parentNode &&\n ($(element.parentNode).hasClass(ClassName.DROPDOWN_MENU))) {\n\n let dropdownElement = $(element).closest(Selector.LI_DROPDOWN)[0]\n if (dropdownElement) {\n $(dropdownElement).addClass(ClassName.ACTIVE)\n }\n\n elementToggle = $(element).find(Selector.DATA_TOGGLE)[0]\n if (elementToggle) {\n elementToggle.setAttribute('aria-expanded', true)\n }\n }\n\n if (callback) {\n callback()\n }\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let $this = $(this)\n let data = $this.data(DATA_KEY)\n\n if (!data) {\n data = data = new Tab(this)\n $this.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n data[config]()\n }\n })\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(document)\n .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {\n event.preventDefault()\n Tab._jQueryInterface.call($(this), 'show')\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Tab._jQueryInterface\n $.fn[NAME].Constructor = Tab\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Tab._jQueryInterface\n }\n\n return Tab\n\n})(jQuery)\n\nexport default Tab\n"]}