You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1 lines
6.9 KiB

{"version":3,"sources":["../../src/bootstrap/alert.js"],"names":["DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","$","fn","EVENT_CLOSE","EVENT_CLOSED","EVENT_CLICK_DATA_API","Alert","element","_element","rootElement","_getRootElement","customEvent","_triggerCloseEvent","isDefaultPrevented","_removeElement","removeData","selector","Util","getSelectorFromElement","parent","document","querySelector","closest","closeEvent","Event","trigger","removeClass","hasClass","_destroyElement","transitionDuration","getTransitionDurationFromElement","one","TRANSITION_END","event","emulateTransitionEnd","detach","remove","config","each","$element","data","alertInstance","preventDefault","close","on","_handleDismiss","_jQueryInterface","Constructor","noConflict"],"mappings":"mKAOA,OACA,O,uXAUMA,CAAAA,CAAQ,CAAG,U,CACXC,CAAS,YAAOD,CAAP,C,CAETE,CAAkB,CAAGC,UAAEC,EAAF,M,CAIrBC,CAAW,gBAAWJ,CAAX,C,CACXK,CAAY,iBAAYL,CAAZ,C,CACZM,CAAoB,gBAAWN,CAAX,SAPL,WAOK,C,CAYpBO,C,YACJ,WAAYC,CAAZ,CAAqB,WACnB,KAAKC,QAAL,CAAgBD,CACjB,C,uCAUKA,C,CAAS,CACb,GAAIE,CAAAA,CAAW,CAAG,KAAKD,QAAvB,CACA,GAAID,CAAJ,CAAa,CACXE,CAAW,CAAG,KAAKC,eAAL,CAAqBH,CAArB,CACf,CAED,GAAMI,CAAAA,CAAW,CAAG,KAAKC,kBAAL,CAAwBH,CAAxB,CAApB,CAEA,GAAIE,CAAW,CAACE,kBAAZ,EAAJ,CAAsC,CACpC,MACD,CAED,KAAKC,cAAL,CAAoBL,CAApB,CACD,C,yCAES,CACRR,UAAEc,UAAF,CAAa,KAAKP,QAAlB,CAA4BV,CAA5B,EACA,KAAKU,QAAL,CAAgB,IACjB,C,wDAIeD,C,CAAS,IACjBS,CAAAA,CAAQ,CAAGC,UAAKC,sBAAL,CAA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C,CAAQ,CAACC,IAAT,CAAc1C,CAAd,CAAwB0C,CAAxB,CACD,CAED,GAAe,OAAX,GAAAH,CAAJ,CAAwB,CACtBG,CAAI,CAACH,CAAD,CAAJ,CAAa,IAAb,CACD,CACF,CAZM,CAaR,C,sDAEqBI,C,CAAe,CACnC,MAAO,UAAUR,CAAV,CAAiB,CACtB,GAAIA,CAAJ,CAAW,CACTA,CAAK,CAACS,cAAN,EACD,CAEDD,CAAa,CAACE,KAAd,CAAoB,IAApB,CACD,CACF,C,mCAlGoB,CACnB,MA9BY,OA+Bb,C,gBAyGH,cAAEvB,QAAF,EAAYwB,EAAZ,CACEvC,CADF,CAlIyB,0BAkIzB,CAGEC,CAAK,CAACuC,cAAN,CAAqB,GAAIvC,CAAAA,CAAzB,CAHF,EAYAL,UAAEC,EAAF,OAAaI,CAAK,CAACwC,gBAAnB,CACA7C,UAAEC,EAAF,OAAW6C,WAAX,CAAyBzC,CAAzB,CACAL,UAAEC,EAAF,OAAW8C,UAAX,CAAwB,UAAM,CAC5B/C,UAAEC,EAAF,OAAaF,CAAb,CACA,MAAOM,CAAAA,CAAK,CAACwC,gBACd,CAHD,C,UAKexC,C","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.6.0): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\nimport Util from './util'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'alert'\nconst VERSION = '4.6.0'\nconst DATA_KEY = 'bs.alert'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\n\nconst SELECTOR_DISMISS = '[data-dismiss=\"alert\"]'\n\nconst EVENT_CLOSE = `close${EVENT_KEY}`\nconst EVENT_CLOSED = `closed${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_ALERT = 'alert'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Alert {\n constructor(element) {\n this._element = element\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n // Public\n\n close(element) {\n let rootElement = this._element\n if (element) {\n rootElement = this._getRootElement(element)\n }\n\n const customEvent = this._triggerCloseEvent(rootElement)\n\n if (customEvent.isDefaultPrevented()) {\n return\n }\n\n this._removeElement(rootElement)\n }\n\n dispose() {\n $.removeData(this._element, DATA_KEY)\n this._element = null\n }\n\n // Private\n\n _getRootElement(element) {\n const selector = Util.getSelectorFromElement(element)\n let parent = false\n\n if (selector) {\n parent = document.querySelector(selector)\n }\n\n if (!parent) {\n parent = $(element).closest(`.${CLASS_NAME_ALERT}`)[0]\n }\n\n return parent\n }\n\n _triggerCloseEvent(element) {\n const closeEvent = $.Event(EVENT_CLOSE)\n\n $(element).trigger(closeEvent)\n return closeEvent\n }\n\n _removeElement(element) {\n $(element).removeClass(CLASS_NAME_SHOW)\n\n if (!$(element).hasClass(CLASS_NAME_FADE)) {\n this._destroyElement(element)\n return\n }\n\n const transitionDuration = Util.getTransitionDurationFromElement(element)\n\n $(element)\n .one(Util.TRANSITION_END, event => this._destroyElement(element, event))\n .emulateTransitionEnd(transitionDuration)\n }\n\n _destroyElement(element) {\n $(element)\n .detach()\n .trigger(EVENT_CLOSED)\n .remove()\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Alert(this)\n $element.data(DATA_KEY, data)\n }\n\n if (config === 'close') {\n data[config](this)\n }\n })\n }\n\n static _handleDismiss(alertInstance) {\n return function (event) {\n if (event) {\n event.preventDefault()\n }\n\n alertInstance.close(this)\n }\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n$(document).on(\n EVENT_CLICK_DATA_API,\n SELECTOR_DISMISS,\n Alert._handleDismiss(new Alert())\n)\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Alert._jQueryInterface\n$.fn[NAME].Constructor = Alert\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Alert._jQueryInterface\n}\n\nexport default Alert\n"],"file":"alert.min.js"}