internet-programming/lab2/node_modules/bootstrap/js/dist/popover.js

97 lines
2.6 KiB
JavaScript
Raw Normal View History

2023-10-23 13:48:44 +04:00
/*!
2023-11-02 21:33:55 +04:00
* Bootstrap popover.js v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2023-10-23 13:48:44 +04:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
2023-11-02 21:33:55 +04:00
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./tooltip.js'), require('./util/index.js')) :
typeof define === 'function' && define.amd ? define(['./tooltip', './util/index'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip, global.Index));
})(this, (function (Tooltip, index_js) { 'use strict';
2023-10-23 13:48:44 +04:00
/**
* --------------------------------------------------------------------------
2023-11-02 21:33:55 +04:00
* Bootstrap popover.js
2023-10-23 13:48:44 +04:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
2023-11-02 21:33:55 +04:00
2023-10-23 13:48:44 +04:00
/**
* Constants
*/
const NAME = 'popover';
const SELECTOR_TITLE = '.popover-header';
const SELECTOR_CONTENT = '.popover-body';
2023-11-02 21:33:55 +04:00
const Default = {
...Tooltip.Default,
2023-10-23 13:48:44 +04:00
content: '',
offset: [0, 8],
placement: 'right',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
trigger: 'click'
};
2023-11-02 21:33:55 +04:00
const DefaultType = {
...Tooltip.DefaultType,
2023-10-23 13:48:44 +04:00
content: '(null|string|element|function)'
};
2023-11-02 21:33:55 +04:00
2023-10-23 13:48:44 +04:00
/**
* Class definition
*/
2023-11-02 21:33:55 +04:00
class Popover extends Tooltip {
2023-10-23 13:48:44 +04:00
// Getters
static get Default() {
return Default;
}
static get DefaultType() {
return DefaultType;
}
static get NAME() {
return NAME;
2023-11-02 21:33:55 +04:00
}
2023-10-23 13:48:44 +04:00
2023-11-02 21:33:55 +04:00
// Overrides
2023-10-23 13:48:44 +04:00
_isWithContent() {
return this._getTitle() || this._getContent();
2023-11-02 21:33:55 +04:00
}
2023-10-23 13:48:44 +04:00
2023-11-02 21:33:55 +04:00
// Private
2023-10-23 13:48:44 +04:00
_getContentForTemplate() {
return {
[SELECTOR_TITLE]: this._getTitle(),
[SELECTOR_CONTENT]: this._getContent()
};
}
_getContent() {
return this._resolvePossibleFunction(this._config.content);
2023-11-02 21:33:55 +04:00
}
2023-10-23 13:48:44 +04:00
2023-11-02 21:33:55 +04:00
// Static
2023-10-23 13:48:44 +04:00
static jQueryInterface(config) {
return this.each(function () {
const data = Popover.getOrCreateInstance(this, config);
if (typeof config !== 'string') {
return;
}
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`);
}
data[config]();
});
}
}
2023-11-02 21:33:55 +04:00
2023-10-23 13:48:44 +04:00
/**
* jQuery
*/
2023-11-02 21:33:55 +04:00
index_js.defineJQueryPlugin(Popover);
2023-10-23 13:48:44 +04:00
return Popover;
}));
//# sourceMappingURL=popover.js.map