0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-10 22:24:19 +01:00
Bootstrap/js/dist/tab.js.map
XhmikosR b7b448a0e7 Run grunt.
[ci skip]
2015-12-05 12:59:13 +02:00

1 line
13 KiB
Plaintext

{"version":3,"sources":["../src/tab.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,GAAG,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AASlB,MAAM,IAAI,GAAkB,KAAK,CAAA;AACjC,MAAM,OAAO,GAAe,aAAa,CAAA;AACzC,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,GAAG,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,YAAQ,EAAgB,WAAW;AACnC,MAAE,EAAsB,wBAAwB;AAChD,cAAU,EAAc,4BAA4B;AACpD,UAAM,EAAkB,SAAS;AACjC,gBAAY,EAAY,kCAAkC;AAC1D,eAAW,EAAa,2CAA2C;AACnE,mBAAe,EAAS,kBAAkB;AAC1C,yBAAqB,EAAG,0BAA0B;GACnD,CAAA;;;;;;;;MASK,GAAG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,CAAA;AAC3B,iBAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;WAC3B;;AAED,cAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,gBAAI,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE;AAC9B,oBAAM,IAAI,KAAK,uBAAqB,MAAM,OAAI,CAAA;aAC/C;AACD,gBAAI,CAAC,MAAM,CAAC,EAAE,CAAA;WACf;SACF,CAAC,CAAA;OACH;;;WA3KiB,eAAG;AACnB,eAAO,OAAO,CAAA;OACf;;;WAXG,GAAG;;;AA+LT,GAAC,CAAC,QAAQ,CAAC,CACR,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,UAAU,KAAK,EAAE;AAC/D,SAAK,CAAC,cAAc,EAAE,CAAA;AACtB,OAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;GAC3C,CAAC,CAAA;;;;;;;;AASJ,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,GAAG,CAAC,gBAAgB,CAAA;AAC7C,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,GAAG,CAAA;AAC5B,GAAC,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":"tab.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-alpha): 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-alpha'\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 DROPDOWN : '.dropdown',\n UL : 'ul:not(.dropdown-menu)',\n FADE_CHILD : '> .nav-item .fade, > .fade',\n ACTIVE : '.active',\n ACTIVE_CHILD : '> .nav-item > .active, > .active',\n DATA_TOGGLE : '[data-toggle=\"tab\"], [data-toggle=\"pill\"]',\n DROPDOWN_TOGGLE : '.dropdown-toggle',\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).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\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,\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 || Boolean($(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\n if (dropdownChild) {\n $(dropdownChild).removeClass(ClassName.ACTIVE)\n }\n\n active.setAttribute('aria-expanded', false)\n }\n\n $(element).addClass(ClassName.ACTIVE)\n element.setAttribute('aria-expanded', true)\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.DROPDOWN)[0]\n if (dropdownElement) {\n $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE)\n }\n\n element.setAttribute('aria-expanded', true)\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 if (data[config] === undefined) {\n throw new Error(`No method named \"${config}\"`)\n }\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"]}