mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
1 line
9.0 KiB
Plaintext
1 line
9.0 KiB
Plaintext
{"version":3,"sources":["../src/popover.js"],"names":["Popover","$","NAME","VERSION","DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","fn","CLASS_PREFIX","BSCLS_PREFIX_REGEX","RegExp","Default","extend","Tooltip","placement","trigger","content","template","DefaultType","ClassName","FADE","SHOW","Selector","TITLE","CONTENT","Event","HIDE","HIDDEN","SHOWN","INSERTED","CLICK","FOCUSIN","FOCUSOUT","MOUSEENTER","MOUSELEAVE","isWithContent","getTitle","_getContent","addAttachmentClass","attachment","getTipElement","addClass","tip","config","setContent","$tip","setElementContent","find","removeClass","element","getAttribute","call","_cleanTipClass","tabClass","attr","match","length","join","_jQueryInterface","each","data","_config","test","undefined","Error","Constructor","noConflict","jQuery"],"mappings":";;;;;;;;;;AAGA;;;;;;;AAOA,IAAMA,UAAW,UAACC,CAAD,EAAO;;AAGtB;;;;;;AAMA,MAAMC,OAAsB,SAA5B;AACA,MAAMC,UAAsB,eAA5B;AACA,MAAMC,WAAsB,YAA5B;AACA,MAAMC,kBAA0BD,QAAhC;AACA,MAAME,qBAAsBL,EAAEM,EAAF,CAAKL,IAAL,CAA5B;AACA,MAAMM,eAAsB,YAA5B;AACA,MAAMC,qBAAsB,IAAIC,MAAJ,aAAqBF,YAArB,WAAyC,GAAzC,CAA5B;;AAEA,MAAMG,UAAUV,EAAEW,MAAF,CAAS,EAAT,EAAaC,QAAQF,OAArB,EAA8B;AAC5CG,eAAY,OADgC;AAE5CC,aAAY,OAFgC;AAG5CC,aAAY,EAHgC;AAI5CC,cAAY,yCACA,2BADA,GAEA,iCAFA,GAGA;AAPgC,GAA9B,CAAhB;;AAUA,MAAMC,cAAcjB,EAAEW,MAAF,CAAS,EAAT,EAAaC,QAAQK,WAArB,EAAkC;AACpDF,aAAU;AAD0C,GAAlC,CAApB;;AAIA,MAAMG,YAAY;AAChBC,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AgC;AAC9B,kBAAM,IAAIC,KAAJ,uBAA8BrB,MAA9B,OAAN;AACD;AACDiB,eAAKjB,MAAL;AACD;AACF,OAnBM,CAAP;AAoBD,KAhKmB;;AAAA;AAAA;;;AAgEpB;;AAhEoB,0BAkEC;AACnB,eAAOxC,OAAP;AACD;AApEmB;AAAA;AAAA,0BAsEC;AACnB,eAAOQ,OAAP;AACD;AAxEmB;AAAA;AAAA,0BA0EF;AAChB,eAAOT,IAAP;AACD;AA5EmB;AAAA;AAAA,0BA8EE;AACpB,eAAOE,QAAP;AACD;AAhFmB;AAAA;AAAA,0BAkFD;AACjB,eAAOqB,KAAP;AACD;AApFmB;AAAA;AAAA,0BAsFG;AACrB,eAAOpB,SAAP;AACD;AAxFmB;AAAA;AAAA,0BA0FK;AACvB,eAAOa,WAAP;AACD;AA5FmB;;AAAA;AAAA,IA6DAL,OA7DA;;AAoKtB;;;;;;AAMAZ,IAAEM,EAAF,CAAKL,IAAL,IAAyBF,QAAQ0D,gBAAjC;AACAzD,IAAEM,EAAF,CAAKL,IAAL,EAAW+D,WAAX,GAAyBjE,OAAzB;AACAC,IAAEM,EAAF,CAAKL,IAAL,EAAWgE,UAAX,GAAyB,YAAY;AACnCjE,MAAEM,EAAF,CAAKL,IAAL,IAAaI,kBAAb;AACA,WAAON,QAAQ0D,gBAAf;AACD,GAHD;;AAKA,SAAO1D,OAAP;AAED,CAnLe,CAmLbmE,MAnLa,CAAhB","file":"popover.js","sourcesContent":["import Tooltip from './tooltip'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-alpha.6): popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Popover = (($) => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'popover'\n const VERSION = '4.0.0-alpha.6'\n const DATA_KEY = 'bs.popover'\n const EVENT_KEY = `.${DATA_KEY}`\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const CLASS_PREFIX = 'bs-popover'\n const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\\\s)${CLASS_PREFIX}\\\\S+`, 'g')\n\n const Default = $.extend({}, Tooltip.Default, {\n placement : 'right',\n trigger : 'click',\n content : '',\n template : '<div class=\"popover\" role=\"tooltip\">'\n + '<div class=\"arrow\"></div>'\n + '<h3 class=\"popover-title\"></h3>'\n + '<div class=\"popover-content\"></div></div>'\n })\n\n const DefaultType = $.extend({}, Tooltip.DefaultType, {\n content : '(string|element|function)'\n })\n\n const ClassName = {\n FADE : 'fade',\n SHOW : 'show'\n }\n\n const Selector = {\n TITLE : '.popover-title',\n CONTENT : '.popover-content'\n }\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 INSERTED : `inserted${EVENT_KEY}`,\n CLICK : `click${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n FOCUSOUT : `focusout${EVENT_KEY}`,\n MOUSEENTER : `mouseenter${EVENT_KEY}`,\n MOUSELEAVE : `mouseleave${EVENT_KEY}`\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Popover extends Tooltip {\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 NAME() {\n return NAME\n }\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n static get Event() {\n return Event\n }\n\n static get EVENT_KEY() {\n return EVENT_KEY\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n\n // overrides\n\n isWithContent() {\n return this.getTitle() || this._getContent()\n }\n\n addAttachmentClass(attachment) {\n $(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)\n }\n\n getTipElement() {\n return this.tip = this.tip || $(this.config.template)[0]\n }\n\n setContent() {\n const $tip = $(this.getTipElement())\n\n // we use append for html objects to maintain js events\n this.setElementContent($tip.find(Selector.TITLE), this.getTitle())\n this.setElementContent($tip.find(Selector.CONTENT), this._getContent())\n\n $tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`)\n }\n\n // private\n\n _getContent() {\n return this.element.getAttribute('data-content')\n || (typeof this.config.content === 'function' ?\n this.config.content.call(this.element) :\n this.config.content)\n }\n\n _cleanTipClass() {\n const $tip = $(this.getTipElement())\n const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX)\n if (tabClass !== null && tabClass.length > 0) {\n $tip.removeClass(tabClass.join(''))\n }\n }\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 && /destroy|hide/.test(config)) {\n return\n }\n\n if (!data) {\n data = new Popover(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\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Popover._jQueryInterface\n $.fn[NAME].Constructor = Popover\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Popover._jQueryInterface\n }\n\n return Popover\n\n})(jQuery)\n\nexport default Popover\n"]} |