1 | /*!
|
---|
2 | * Bootstrap popover.js v5.3.3 (https://getbootstrap.com/)
|
---|
3 | * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
---|
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
---|
5 | */
|
---|
6 | (function (global, factory) {
|
---|
7 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./tooltip.js'), require('./util/index.js')) :
|
---|
8 | typeof define === 'function' && define.amd ? define(['./tooltip', './util/index'], factory) :
|
---|
9 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip, global.Index));
|
---|
10 | })(this, (function (Tooltip, index_js) { 'use strict';
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * --------------------------------------------------------------------------
|
---|
14 | * Bootstrap popover.js
|
---|
15 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
---|
16 | * --------------------------------------------------------------------------
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Constants
|
---|
22 | */
|
---|
23 |
|
---|
24 | const NAME = 'popover';
|
---|
25 | const SELECTOR_TITLE = '.popover-header';
|
---|
26 | const SELECTOR_CONTENT = '.popover-body';
|
---|
27 | const Default = {
|
---|
28 | ...Tooltip.Default,
|
---|
29 | content: '',
|
---|
30 | offset: [0, 8],
|
---|
31 | placement: 'right',
|
---|
32 | template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
|
---|
33 | trigger: 'click'
|
---|
34 | };
|
---|
35 | const DefaultType = {
|
---|
36 | ...Tooltip.DefaultType,
|
---|
37 | content: '(null|string|element|function)'
|
---|
38 | };
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Class definition
|
---|
42 | */
|
---|
43 |
|
---|
44 | class Popover extends Tooltip {
|
---|
45 | // Getters
|
---|
46 | static get Default() {
|
---|
47 | return Default;
|
---|
48 | }
|
---|
49 | static get DefaultType() {
|
---|
50 | return DefaultType;
|
---|
51 | }
|
---|
52 | static get NAME() {
|
---|
53 | return NAME;
|
---|
54 | }
|
---|
55 |
|
---|
56 | // Overrides
|
---|
57 | _isWithContent() {
|
---|
58 | return this._getTitle() || this._getContent();
|
---|
59 | }
|
---|
60 |
|
---|
61 | // Private
|
---|
62 | _getContentForTemplate() {
|
---|
63 | return {
|
---|
64 | [SELECTOR_TITLE]: this._getTitle(),
|
---|
65 | [SELECTOR_CONTENT]: this._getContent()
|
---|
66 | };
|
---|
67 | }
|
---|
68 | _getContent() {
|
---|
69 | return this._resolvePossibleFunction(this._config.content);
|
---|
70 | }
|
---|
71 |
|
---|
72 | // Static
|
---|
73 | static jQueryInterface(config) {
|
---|
74 | return this.each(function () {
|
---|
75 | const data = Popover.getOrCreateInstance(this, config);
|
---|
76 | if (typeof config !== 'string') {
|
---|
77 | return;
|
---|
78 | }
|
---|
79 | if (typeof data[config] === 'undefined') {
|
---|
80 | throw new TypeError(`No method named "${config}"`);
|
---|
81 | }
|
---|
82 | data[config]();
|
---|
83 | });
|
---|
84 | }
|
---|
85 | }
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * jQuery
|
---|
89 | */
|
---|
90 |
|
---|
91 | index_js.defineJQueryPlugin(Popover);
|
---|
92 |
|
---|
93 | return Popover;
|
---|
94 |
|
---|
95 | }));
|
---|
96 | //# sourceMappingURL=popover.js.map
|
---|