2017-09-06 06:05:12 +02:00
'use strict' ;
2016-10-10 02:26:51 +02:00
var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
2015-05-12 23:28:11 +02:00
2016-10-10 02:26:51 +02:00
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
2015-05-12 23:28:11 +02:00
2016-10-10 02:26:51 +02:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
2015-08-13 06:12:03 +02:00
2016-10-10 02:26:51 +02:00
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
2015-05-12 23:28:11 +02:00
2016-10-10 02:26:51 +02:00
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
2015-05-12 23:28:11 +02:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
2017-08-11 05:56:35 +02:00
* Bootstrap ( v4 . 0.0 - beta ) : popover . js
2015-05-12 23:28:11 +02:00
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/master/LICENSE)
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2017-09-06 06:05:12 +02:00
var Popover = function ( ) {
2015-05-12 23:28:11 +02:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Constants
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
var NAME = 'popover' ;
2017-08-11 05:56:35 +02:00
var VERSION = '4.0.0-beta' ;
2015-05-12 23:28:11 +02:00
var DATA _KEY = 'bs.popover' ;
2015-05-13 21:48:34 +02:00
var EVENT _KEY = '.' + DATA _KEY ;
2015-05-12 23:28:11 +02:00
var JQUERY _NO _CONFLICT = $ . fn [ NAME ] ;
2017-05-16 09:59:44 +02:00
var CLASS _PREFIX = 'bs-popover' ;
var BSCLS _PREFIX _REGEX = new RegExp ( '(^|\\s)' + CLASS _PREFIX + '\\S+' , 'g' ) ;
2015-05-12 23:28:11 +02:00
var Default = $ . extend ( { } , Tooltip . Default , {
placement : 'right' ,
trigger : 'click' ,
content : '' ,
2017-06-15 07:03:33 +02:00
template : '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
2015-05-12 23:28:11 +02:00
} ) ;
2015-05-13 23:46:50 +02:00
var DefaultType = $ . extend ( { } , Tooltip . DefaultType , {
2015-08-29 23:03:55 +02:00
content : '(string|element|function)'
2015-05-13 23:46:50 +02:00
} ) ;
2015-05-12 23:28:11 +02:00
var ClassName = {
FADE : 'fade' ,
2016-12-20 06:48:24 +01:00
SHOW : 'show'
2015-05-12 23:28:11 +02:00
} ;
var Selector = {
2017-06-15 07:03:33 +02:00
TITLE : '.popover-header' ,
CONTENT : '.popover-body'
2015-05-12 23:28:11 +02:00
} ;
var Event = {
2015-05-13 21:48:34 +02:00
HIDE : 'hide' + EVENT _KEY ,
HIDDEN : 'hidden' + EVENT _KEY ,
SHOW : 'show' + EVENT _KEY ,
SHOWN : 'shown' + EVENT _KEY ,
INSERTED : 'inserted' + EVENT _KEY ,
CLICK : 'click' + EVENT _KEY ,
FOCUSIN : 'focusin' + EVENT _KEY ,
FOCUSOUT : 'focusout' + EVENT _KEY ,
MOUSEENTER : 'mouseenter' + EVENT _KEY ,
MOUSELEAVE : 'mouseleave' + EVENT _KEY
2017-09-10 01:59:37 +02:00
} ;
2015-05-12 23:28:11 +02:00
2017-09-10 01:59:37 +02:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Class Definition
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2015-05-12 23:28:11 +02:00
2016-10-10 02:26:51 +02:00
var Popover = function ( _Tooltip ) {
2015-08-13 06:12:03 +02:00
_inherits ( Popover , _Tooltip ) ;
2015-05-12 23:28:11 +02:00
function Popover ( ) {
_classCallCheck ( this , Popover ) ;
2017-09-06 06:05:12 +02:00
return _possibleConstructorReturn ( this , ( Popover . _ _proto _ _ || Object . getPrototypeOf ( Popover ) ) . apply ( this , arguments ) ) ;
2015-05-12 23:28:11 +02:00
}
2017-09-06 06:05:12 +02:00
_createClass ( Popover , [ {
key : 'isWithContent' ,
2017-05-16 09:59:44 +02:00
2015-05-12 23:28:11 +02:00
2017-09-06 06:05:12 +02:00
// overrides
2015-05-12 23:28:11 +02:00
2017-09-06 06:05:12 +02:00
value : function isWithContent ( ) {
return this . getTitle ( ) || this . _getContent ( ) ;
}
} , {
key : 'addAttachmentClass' ,
value : function addAttachmentClass ( attachment ) {
$ ( this . getTipElement ( ) ) . addClass ( CLASS _PREFIX + '-' + attachment ) ;
}
} , {
key : 'getTipElement' ,
value : function getTipElement ( ) {
this . tip = this . tip || $ ( this . config . template ) [ 0 ] ;
return this . tip ;
}
} , {
key : 'setContent' ,
value : function setContent ( ) {
var $tip = $ ( this . getTipElement ( ) ) ;
2015-05-12 23:28:11 +02:00
2017-09-06 06:05:12 +02:00
// we use append for html objects to maintain js events
this . setElementContent ( $tip . find ( Selector . TITLE ) , this . getTitle ( ) ) ;
this . setElementContent ( $tip . find ( Selector . CONTENT ) , this . _getContent ( ) ) ;
2015-05-12 23:28:11 +02:00
2017-09-06 06:05:12 +02:00
$tip . removeClass ( ClassName . FADE + ' ' + ClassName . SHOW ) ;
}
2015-05-12 23:28:11 +02:00
2017-09-06 06:05:12 +02:00
// private
2015-08-13 06:12:03 +02:00
2017-09-06 06:05:12 +02:00
} , {
key : '_getContent' ,
value : function _getContent ( ) {
return this . element . getAttribute ( 'data-content' ) || ( typeof this . config . content === 'function' ? this . config . content . call ( this . element ) : this . config . content ) ;
}
} , {
key : '_cleanTipClass' ,
value : function _cleanTipClass ( ) {
var $tip = $ ( this . getTipElement ( ) ) ;
var tabClass = $tip . attr ( 'class' ) . match ( BSCLS _PREFIX _REGEX ) ;
if ( tabClass !== null && tabClass . length > 0 ) {
$tip . removeClass ( tabClass . join ( '' ) ) ;
}
2017-05-16 09:59:44 +02:00
}
2015-08-13 06:12:03 +02:00
2017-09-06 06:05:12 +02:00
// static
2015-08-13 06:12:03 +02:00
2017-09-06 06:05:12 +02:00
} ] , [ {
key : '_jQueryInterface' ,
value : function _jQueryInterface ( config ) {
return this . each ( function ( ) {
var data = $ ( this ) . data ( DATA _KEY ) ;
var _config = ( typeof config === 'undefined' ? 'undefined' : _typeof ( config ) ) === 'object' ? config : null ;
2015-08-13 06:12:03 +02:00
2017-09-06 06:05:12 +02:00
if ( ! data && /destroy|hide/ . test ( config ) ) {
return ;
}
2015-08-13 06:12:03 +02:00
2017-09-06 06:05:12 +02:00
if ( ! data ) {
data = new Popover ( this , _config ) ;
$ ( this ) . data ( DATA _KEY , data ) ;
2015-08-13 06:12:03 +02:00
}
2016-10-10 02:26:51 +02:00
2017-09-06 06:05:12 +02:00
if ( typeof config === 'string' ) {
if ( typeof data [ config ] === 'undefined' ) {
throw new Error ( 'No method named "' + config + '"' ) ;
}
data [ config ] ( ) ;
}
} ) ;
}
} , {
2015-05-12 23:28:11 +02:00
key : 'VERSION' ,
2016-10-10 02:26:51 +02:00
2015-05-12 23:28:11 +02:00
// getters
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-12 23:28:11 +02:00
return VERSION ;
}
} , {
key : 'Default' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-12 23:28:11 +02:00
return Default ;
}
} , {
key : 'NAME' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-12 23:28:11 +02:00
return NAME ;
}
} , {
key : 'DATA_KEY' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-12 23:28:11 +02:00
return DATA _KEY ;
}
} , {
key : 'Event' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-12 23:28:11 +02:00
return Event ;
}
2015-05-13 21:48:34 +02:00
} , {
key : 'EVENT_KEY' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-13 21:48:34 +02:00
return EVENT _KEY ;
}
2015-05-13 23:46:50 +02:00
} , {
key : 'DefaultType' ,
2015-08-13 06:12:03 +02:00
get : function get ( ) {
2015-05-13 23:46:50 +02:00
return DefaultType ;
}
2015-05-12 23:28:11 +02:00
} ] ) ;
return Popover ;
2016-10-10 02:26:51 +02:00
} ( Tooltip ) ;
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* jQuery
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2015-05-12 23:28:11 +02:00
$ . fn [ NAME ] = Popover . _jQueryInterface ;
$ . fn [ NAME ] . Constructor = Popover ;
$ . fn [ NAME ] . noConflict = function ( ) {
$ . fn [ NAME ] = JQUERY _NO _CONFLICT ;
return Popover . _jQueryInterface ;
} ;
return Popover ;
2016-10-10 02:26:51 +02:00
} ( jQuery ) ;
2017-04-22 08:58:09 +02:00
//# sourceMappingURL=popover.js.map