1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-11 16:14:04 +02:00
This commit is contained in:
Mark Otto
2017-09-05 21:05:12 -07:00
parent fbd1f52f89
commit df47558ef6
39 changed files with 9916 additions and 5011 deletions

122
js/dist/popover.js vendored
View File

@@ -1,3 +1,5 @@
'use strict';
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; };
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; }; }();
@@ -15,7 +17,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
* --------------------------------------------------------------------------
*/
var Popover = function ($) {
var Popover = function () {
/**
* ------------------------------------------------------------------------
@@ -77,73 +79,85 @@ var Popover = function ($) {
function Popover() {
_classCallCheck(this, Popover);
return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
return _possibleConstructorReturn(this, (Popover.__proto__ || Object.getPrototypeOf(Popover)).apply(this, arguments));
}
// overrides
_createClass(Popover, [{
key: 'isWithContent',
Popover.prototype.isWithContent = function isWithContent() {
return this.getTitle() || this._getContent();
};
Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
$(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
};
// overrides
Popover.prototype.getTipElement = function getTipElement() {
return this.tip = this.tip || $(this.config.template)[0];
};
Popover.prototype.setContent = function setContent() {
var $tip = $(this.getTipElement());
// 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());
$tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
};
// private
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);
};
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(''));
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());
// static
// 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());
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;
$tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
}
if (!data && /destroy|hide/.test(config)) {
return;
// private
}, {
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(''));
}
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
// static
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}], [{
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;
if (!data && /destroy|hide/.test(config)) {
return;
}
data[config]();
}
});
};
_createClass(Popover, null, [{
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',