mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"version":3,"sources":["js/src/scrollspy.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,SAAS,GAAG,CAAC,UAAC,CAAC,EAAK;;;;;;;;AASxB,MAAM,IAAI,GAAiB,WAAW,CAAA;AACtC,MAAM,OAAO,GAAc,OAAO,CAAA;AAClC,MAAM,QAAQ,GAAa,cAAc,CAAA;AACzC,MAAM,SAAS,SAAgB,QAAQ,AAAE,CAAA;AACzC,MAAM,YAAY,GAAS,WAAW,CAAA;AACtC,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;;AAErC,MAAM,OAAO,GAAG;AACd,UAAM,EAAG,EAAE;AACX,UAAM,EAAG,MAAM;AACf,UAAM,EAAG,EAAE;GACZ,CAAA;;AAED,MAAM,WAAW,GAAG;AAClB,UAAM,EAAG,QAAQ;AACjB,UAAM,EAAG,QAAQ;AACjB,UAAM,EAAG,kBAAkB;GAC5B,CAAA;;AAED,MAAM,KAAK,GAAG;AACZ,YAAQ,eAAmB,SAAS,AAAE;AACtC,UAAM,aAAmB,SAAS,AAAE;AACpC,iBAAa,WAAU,SAAS,QAAG,YAAY,AAAE;GAClD,CAAA;;AAED,MAAM,SAAS,GAAG;AAChB,iBAAa,EAAG,eAAe;AAC/B,UAAM,EAAU,QAAQ;GACzB,CAAA;;AAED,MAAM,QAAQ,GAAG;AACf,YAAQ,EAAM,qBAAqB;AACnC,UAAM,EAAQ,SAAS;AACvB,MAAE,EAAY,IAAI;AAClB,eAAW,EAAG,aAAa;AAC3B,eAAW,EAAG,aAAa;GAC5B,CAAA;;AAED,MAAM,YAAY,GAAG;AACnB,UAAM,EAAK,QAAQ;AACnB,YAAQ,EAAG,UAAU;GACtB,CAAA;;;;;;;;MASK,SAAS;AAEF,aAFP,SAAS,CAED,OAAO,EAAE,MAAM,EAAE;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,IAAI,EAAE,CAAC,CAAA;KACnD;GACF,CAAC,CAAA;;;;;;;;AASF,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,SAAS,CAAC,gBAAgB,CAAA;AACnD,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,SAAS,CAAA;AAClC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAA;AAC/B,WAAO,SAAS,CAAC,gBAAgB,CAAA;GAClC,CAAA;;AAED,SAAO,SAAS,CAAA;CAEjB,CAAA,CAAE,MAAM,CAAC,CAAA","file":"js/src/scrollspy.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst ScrollSpy = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'scrollspy'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.scrollspy'\n const EVENT_KEY = `.${DATA_KEY}`\n const DATA_API_KEY = '.data-api'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n\n const Default = {\n offset : 10,\n method : 'auto',\n target : ''\n }\n\n const DefaultType = {\n offset : 'number',\n method : 'string',\n target : '(string|element)'\n }\n\n const Event = {\n ACTIVATE : `activate${EVENT_KEY}`,\n SCROLL : `scroll${EVENT_KEY}`,\n LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`\n }\n\n const ClassName = {\n DROPDOWN_MENU : 'dropdown-menu',\n ACTIVE : 'active'\n }\n\n const Selector = {\n DATA_SPY : '[data-spy=\"scroll\"]',\n ACTIVE : '.active',\n LI : 'li',\n LI_DROPDOWN : 'li.dropdown',\n NAV_ANCHORS : '.nav li > a'\n }\n\n const OffsetMethod = {\n OFFSET : 'offset',\n POSITION : 'position'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class ScrollSpy {\n\n constructor(element, config) {\n this._element = element\n this._scrollElement = element.tagName === 'BODY' ? window : element\n this._config = this._getConfig(config)\n this._selector = `${this._config.target} ${Selector.NAV_ANCHORS}`\n this._offsets = []\n this._targets = []\n this._activeTarget = null\n this._scrollHeight = 0\n\n $(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this))\n\n this.refresh()\n this._process()\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\n // public\n\n refresh() {\n let autoMethod = this._scrollElement !== this._scrollElement.window ?\n OffsetMethod.POSITION : OffsetMethod.OFFSET\n\n let offsetMethod = this._config.method === 'auto' ?\n autoMethod : this._config.method\n\n let offsetBase = offsetMethod === OffsetMethod.POSITION ?\n this._getScrollTop() : 0\n\n this._offsets = []\n this._targets = []\n\n this._scrollHeight = this._getScrollHeight()\n\n let targets = $.makeArray($(this._selector))\n\n targets\n .map((element) => {\n let target\n let targetSelector = Util.getSelectorFromElement(element)\n\n if (targetSelector) {\n target = $(targetSelector)[0]\n }\n\n if (target && (target.offsetWidth || target.offsetHeight)) {\n // todo (fat): remove sketch reliance on jQuery position/offset\n return [\n $(target)[offsetMethod]().top + offsetBase,\n targetSelector\n ]\n }\n })\n .filter((item) => item)\n .sort((a, b) => a[0] - b[0])\n .forEach((item) => {\n this._offsets.push(item[0])\n this._targets.push(item[1])\n })\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n $(this._scrollElement).off(EVENT_KEY)\n\n this._element = null\n this._scrollElement = null\n this._config = null\n this._selector = null\n this._offsets = null\n this._targets = null\n this._activeTarget = null\n this._scrollHeight = null\n }\n\n\n // private\n\n _getConfig(config) {\n config = $.extend({}, Default, config)\n\n if (typeof config.target !== 'string') {\n let id = $(config.target).attr('id')\n if (!id) {\n id = Util.getUID(NAME)\n $(config.target).attr('id', id)\n }\n config.target = `#${id}`\n }\n\n Util.typeCheckConfig(NAME, config, DefaultType)\n\n return config\n }\n\n _getScrollTop() {\n return this._scrollElement === window ?\n this._scrollElement.scrollY : this._scrollElement.scrollTop\n }\n\n _getScrollHeight() {\n return this._scrollElement.scrollHeight || Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight\n )\n }\n\n _process() {\n let scrollTop = this._getScrollTop() + this._config.offset\n let scrollHeight = this._getScrollHeight()\n let maxScroll = this._config.offset\n + scrollHeight\n - this._scrollElement.offsetHeight\n\n if (this._scrollHeight !== scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n let target = this._targets[this._targets.length - 1]\n\n if (this._activeTarget !== target) {\n this._activate(target)\n }\n }\n\n if (this._activeTarget && scrollTop < this._offsets[0]) {\n this._activeTarget = null\n this._clear()\n return\n }\n\n for (let i = this._offsets.length; i--;) {\n let isActiveTarget = this._activeTarget !== this._targets[i]\n && scrollTop >= this._offsets[i]\n && (this._offsets[i + 1] === undefined ||\n scrollTop < this._offsets[i + 1])\n\n if (isActiveTarget) {\n this._activate(this._targets[i])\n }\n }\n }\n\n _activate(target) {\n this._activeTarget = target\n\n this._clear()\n\n let selector =\n `${this._selector}[data-target=\"${target}\"],` +\n `${this._selector}[href=\"${target}\"]`\n\n // todo (fat): getting all the raw li's up the tree is not great.\n let parentListItems = $(selector).parents(Selector.LI)\n\n for (let i = parentListItems.length; i--;) {\n $(parentListItems[i]).addClass(ClassName.ACTIVE)\n\n let itemParent = parentListItems[i].parentNode\n\n if (itemParent && $(itemParent).hasClass(ClassName.DROPDOWN_MENU)) {\n let closestDropdown = $(itemParent)\n .closest(Selector.LI_DROPDOWN)[0]\n $(closestDropdown).addClass(ClassName.ACTIVE)\n }\n }\n\n $(this._scrollElement).trigger(Event.ACTIVATE, {\n relatedTarget: target\n })\n }\n\n _clear() {\n let activeParents = $(this._selector).parentsUntil(\n this._config.target,\n Selector.ACTIVE\n )\n\n for (let i = activeParents.length; i--;) {\n $(activeParents[i]).removeClass(ClassName.ACTIVE)\n }\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY)\n let _config = typeof config === 'object' && config || null\n\n if (!data) {\n data = new ScrollSpy(this, _config)\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 * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(window).on(Event.LOAD_DATA_API, function () {\n let scrollSpys = $.makeArray($(Selector.DATA_SPY))\n\n for (let i = scrollSpys.length; i--;) {\n let $spy = $(scrollSpys[i])\n ScrollSpy._jQueryInterface.call($spy, $spy.data())\n }\n })\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = ScrollSpy._jQueryInterface\n $.fn[NAME].Constructor = ScrollSpy\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return ScrollSpy._jQueryInterface\n }\n\n return ScrollSpy\n\n})(jQuery)\n\nexport default ScrollSpy\n"]} |