2016-10-09 20:26:51 -04: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 17:28:11 -04:00
2016-10-09 20:26:51 -04: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 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
2015-08-13 00:12:03 -04:00
2016-10-09 20:26:51 -04: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 17:28:11 -04:00
2016-10-09 20:26:51 -04: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 17:28:11 -04:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
2017-01-06 11:38:04 -05:00
* Bootstrap ( v4 . 0.0 - alpha . 6 ) : popover . js
2015-05-12 17:28:11 -04:00
* Licensed under MIT ( https : //github.com/twbs/bootstrap/blob/master/LICENSE)
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2016-10-09 20:26:51 -04:00
var Popover = function ( $ ) {
2015-05-12 17:28:11 -04:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Constants
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
var NAME = 'popover' ;
2017-01-06 11:38:04 -05:00
var VERSION = '4.0.0-alpha.6' ;
2015-05-12 17:28:11 -04:00
var DATA _KEY = 'bs.popover' ;
2015-05-13 15:48:34 -04:00
var EVENT _KEY = '.' + DATA _KEY ;
2015-05-12 17:28:11 -04:00
var JQUERY _NO _CONFLICT = $ . fn [ NAME ] ;
2017-05-16 03:59:44 -04:00
var CLASS _PREFIX = 'bs-popover' ;
var BSCLS _PREFIX _REGEX = new RegExp ( '(^|\\s)' + CLASS _PREFIX + '\\S+' , 'g' ) ;
2015-05-12 17:28:11 -04:00
var Default = $ . extend ( { } , Tooltip . Default , {
placement : 'right' ,
trigger : 'click' ,
content : '' ,
2017-06-15 01:03:33 -04: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 17:28:11 -04:00
} ) ;
2015-05-13 17:46:50 -04:00
var DefaultType = $ . extend ( { } , Tooltip . DefaultType , {
2015-08-29 17:03:55 -04:00
content : '(string|element|function)'
2015-05-13 17:46:50 -04:00
} ) ;
2015-05-12 17:28:11 -04:00
var ClassName = {
FADE : 'fade' ,
2016-12-20 00:48:24 -05:00
SHOW : 'show'
2015-05-12 17:28:11 -04:00
} ;
var Selector = {
2017-06-15 01:03:33 -04:00
TITLE : '.popover-header' ,
CONTENT : '.popover-body'
2015-05-12 17:28:11 -04:00
} ;
var Event = {
2015-05-13 15:48:34 -04: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
2015-05-12 17:28:11 -04:00
2017-07-02 01:25:38 -04:00
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* Class Definition
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2015-05-12 17:28:11 -04:00
2017-07-02 01:25:38 -04:00
} ;
2016-10-09 20:26:51 -04:00
var Popover = function ( _Tooltip ) {
2015-08-13 00:12:03 -04:00
_inherits ( Popover , _Tooltip ) ;
2015-05-12 17:28:11 -04:00
function Popover ( ) {
_classCallCheck ( this , Popover ) ;
2016-10-09 20:26:51 -04:00
return _possibleConstructorReturn ( this , _Tooltip . apply ( this , arguments ) ) ;
2015-05-12 17:28:11 -04:00
}
2016-10-09 20:26:51 -04:00
// overrides
2015-05-12 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
Popover . prototype . isWithContent = function isWithContent ( ) {
return this . getTitle ( ) || this . _getContent ( ) ;
} ;
2015-05-12 17:28:11 -04:00
2017-05-16 03:59:44 -04:00
Popover . prototype . addAttachmentClass = function addAttachmentClass ( attachment ) {
$ ( this . getTipElement ( ) ) . addClass ( CLASS _PREFIX + '-' + attachment ) ;
} ;
2016-10-09 20:26:51 -04:00
Popover . prototype . getTipElement = function getTipElement ( ) {
return this . tip = this . tip || $ ( this . config . template ) [ 0 ] ;
} ;
2015-05-12 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
Popover . prototype . setContent = function setContent ( ) {
2017-07-02 01:25:38 -04:00
var $tip = $ ( this . getTipElement ( )
2015-05-12 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
// we use append for html objects to maintain js events
2017-07-02 01:25:38 -04:00
) ; this . setElementContent ( $tip . find ( Selector . TITLE ) , this . getTitle ( ) ) ;
2016-10-09 20:26:51 -04:00
this . setElementContent ( $tip . find ( Selector . CONTENT ) , this . _getContent ( ) ) ;
2015-05-12 17:28:11 -04:00
2016-12-20 00:48:24 -05:00
$tip . removeClass ( ClassName . FADE + ' ' + ClassName . SHOW ) ;
2016-10-09 20:26:51 -04:00
} ;
2015-05-12 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
// private
2015-05-12 17:28:11 -04:00
2016-10-09 20:26:51 -04:00
Popover . prototype . _getContent = function _getContent ( ) {
return this . element . getAttribute ( 'data-content' ) || ( typeof this . config . content === 'function' ? this . config . content . call ( this . element ) : this . config . content ) ;
} ;
2015-08-13 00:12:03 -04:00
2017-05-16 03:59:44 -04:00
Popover . prototype . _cleanTipClass = 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 ( '' ) ) ;
}
} ;
2016-10-09 20:26:51 -04:00
// static
2015-08-13 00:12:03 -04:00
2016-10-09 20:26:51 -04:00
Popover . _jQueryInterface = 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 00:12:03 -04:00
2016-10-09 20:26:51 -04:00
if ( ! data && /destroy|hide/ . test ( config ) ) {
return ;
}
2015-08-13 00:12:03 -04:00
2016-10-09 20:26:51 -04:00
if ( ! data ) {
data = new Popover ( this , _config ) ;
$ ( this ) . data ( DATA _KEY , data ) ;
}
2015-08-13 00:12:03 -04:00
2016-10-09 20:26:51 -04:00
if ( typeof config === 'string' ) {
if ( data [ config ] === undefined ) {
throw new Error ( 'No method named "' + config + '"' ) ;
2015-08-13 00:12:03 -04:00
}
2016-10-09 20:26:51 -04:00
data [ config ] ( ) ;
}
} ) ;
} ;
_createClass ( Popover , null , [ {
2015-05-12 17:28:11 -04:00
key : 'VERSION' ,
2016-10-09 20:26:51 -04:00
2015-05-12 17:28:11 -04:00
// getters
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-12 17:28:11 -04:00
return VERSION ;
}
} , {
key : 'Default' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-12 17:28:11 -04:00
return Default ;
}
} , {
key : 'NAME' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-12 17:28:11 -04:00
return NAME ;
}
} , {
key : 'DATA_KEY' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-12 17:28:11 -04:00
return DATA _KEY ;
}
} , {
key : 'Event' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-12 17:28:11 -04:00
return Event ;
}
2015-05-13 15:48:34 -04:00
} , {
key : 'EVENT_KEY' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-13 15:48:34 -04:00
return EVENT _KEY ;
}
2015-05-13 17:46:50 -04:00
} , {
key : 'DefaultType' ,
2015-08-13 00:12:03 -04:00
get : function get ( ) {
2015-05-13 17:46:50 -04:00
return DefaultType ;
}
2015-05-12 17:28:11 -04:00
} ] ) ;
return Popover ;
2016-10-09 20:26:51 -04:00
} ( Tooltip ) ;
/ * *
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* jQuery
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* /
2015-05-12 17:28:11 -04: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-09 20:26:51 -04:00
} ( jQuery ) ;
2017-04-22 02:58:09 -04:00
//# sourceMappingURL=popover.js.map