mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
1 line
8.9 KiB
Plaintext
1 line
8.9 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","getTitle","_getContent","attachment","getTipElement","addClass","tip","config","$tip","setElementContent","find","removeClass","element","getAttribute","call","tabClass","attr","match","length","join","each","data","_config","test","Error","_jQueryInterface","Constructor","noConflict","jQuery"],"mappings":";;;;;;;;;;;;AAIA;;;;;;;AAOA,IAAMA,UAAW,YAAM;;AAGrB;;;;;;AAMA,MAAMC,OAAsB,SAA5B;AACA,MAAMC,UAAsB,YAA5B;AACA,MAAMC,WAAsB,YAA5B;AACA,MAAMC,kBAA0BD,QAAhC;AACA,MAAME,qBAAsBC,EAAEC,EAAF,CAAKN,IAAL,CAA5B;AACA,MAAMO,eAAsB,YAA5B;AACA,MAAMC,qBAAsB,IAAIC,MAAJ,aAAqBF,YAArB,WAAyC,GAAzC,CAA5B;;AAEA,MAAMG,UAAUL,EAAEM,MAAF,CAAS,EAAT,EAAaC,QAAQF,OAArB,EAA8B;AAC5CG,eAAY,OADgC;AAE5CC,aAAY,OAFgC;AAG5CC,aAAY,EAHgC;AAI5CC,cAAY,yCACA,2BADA,GAEA,kCAFA,GAGA;AAPgC,GAA9B,CAAhB;;AAUA,MAAMC,cAAcZ,EAAEM,MAAF,CAAS,EAAT,EAAaC,QAAQK,WAArB,EAAkC;AACpDF,aAAU;AAD0C,GAAlC,CAApB;;AAIA,MAAMG,YAAY;AAChBC,UAAO,MADS;AAEhBC,UAAO;AAFS,GAAlB;;AAKA,MA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;AAgEnB;;AAhEmB,0BAkEE;AACnB,eAAOvC,OAAP;AACD;AApEkB;AAAA;AAAA,0BAsEE;AACnB,eAAOS,OAAP;AACD;AAxEkB;AAAA;AAAA,0BA0ED;AAChB,eAAOV,IAAP;AACD;AA5EkB;AAAA;AAAA,0BA8EG;AACpB,eAAOE,QAAP;AACD;AAhFkB;AAAA;AAAA,0BAkFA;AACjB,eAAOsB,KAAP;AACD;AApFkB;AAAA;AAAA,0BAsFI;AACrB,eAAOrB,SAAP;AACD;AAxFkB;AAAA;AAAA,0BA0FM;AACvB,eAAOc,WAAP;AACD;AA5FkB;;AAAA;AAAA,IA6DCL,OA7DD;;AAqKrB;;;;;;AAMAP,IAAEC,EAAF,CAAKN,IAAL,IAAyBD,QAAQ2D,gBAAjC;AACArD,IAAEC,EAAF,CAAKN,IAAL,EAAW2D,WAAX,GAAyB5D,OAAzB;AACAM,IAAEC,EAAF,CAAKN,IAAL,EAAW4D,UAAX,GAAyB,YAAY;AACnCvD,MAAEC,EAAF,CAAKN,IAAL,IAAaI,kBAAb;AACA,WAAOL,QAAQ2D,gBAAf;AACD,GAHD;;AAKA,SAAO3D,OAAP;AAED,CApLe,CAoLb8D,MApLa,CAAhB","file":"popover.js","sourcesContent":["import $ from 'jquery'\nimport Tooltip from './tooltip'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0-beta): 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-beta'\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-header\"></h3>'\n + '<div class=\"popover-body\"></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-header',\n CONTENT : '.popover-body'\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 this.tip = this.tip || $(this.config.template)[0]\n return this.tip\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 (typeof 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"]} |