1 | /*!
|
---|
2 | * Bootstrap popover.js v5.1.3 (https://getbootstrap.com/)
|
---|
3 | * Copyright 2011-2021 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')) :
|
---|
8 | typeof define === 'function' && define.amd ? define(['./tooltip'], factory) :
|
---|
9 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip));
|
---|
10 | })(this, (function (Tooltip) { 'use strict';
|
---|
11 |
|
---|
12 | const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
---|
13 |
|
---|
14 | const Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * --------------------------------------------------------------------------
|
---|
18 | * Bootstrap (v5.1.3): util/index.js
|
---|
19 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
---|
20 | * --------------------------------------------------------------------------
|
---|
21 | */
|
---|
22 |
|
---|
23 | const getjQuery = () => {
|
---|
24 | const {
|
---|
25 | jQuery
|
---|
26 | } = window;
|
---|
27 |
|
---|
28 | if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
---|
29 | return jQuery;
|
---|
30 | }
|
---|
31 |
|
---|
32 | return null;
|
---|
33 | };
|
---|
34 |
|
---|
35 | const DOMContentLoadedCallbacks = [];
|
---|
36 |
|
---|
37 | const onDOMContentLoaded = callback => {
|
---|
38 | if (document.readyState === 'loading') {
|
---|
39 | // add listener on the first call when the document is in loading state
|
---|
40 | if (!DOMContentLoadedCallbacks.length) {
|
---|
41 | document.addEventListener('DOMContentLoaded', () => {
|
---|
42 | DOMContentLoadedCallbacks.forEach(callback => callback());
|
---|
43 | });
|
---|
44 | }
|
---|
45 |
|
---|
46 | DOMContentLoadedCallbacks.push(callback);
|
---|
47 | } else {
|
---|
48 | callback();
|
---|
49 | }
|
---|
50 | };
|
---|
51 |
|
---|
52 | const defineJQueryPlugin = plugin => {
|
---|
53 | onDOMContentLoaded(() => {
|
---|
54 | const $ = getjQuery();
|
---|
55 | /* istanbul ignore if */
|
---|
56 |
|
---|
57 | if ($) {
|
---|
58 | const name = plugin.NAME;
|
---|
59 | const JQUERY_NO_CONFLICT = $.fn[name];
|
---|
60 | $.fn[name] = plugin.jQueryInterface;
|
---|
61 | $.fn[name].Constructor = plugin;
|
---|
62 |
|
---|
63 | $.fn[name].noConflict = () => {
|
---|
64 | $.fn[name] = JQUERY_NO_CONFLICT;
|
---|
65 | return plugin.jQueryInterface;
|
---|
66 | };
|
---|
67 | }
|
---|
68 | });
|
---|
69 | };
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * --------------------------------------------------------------------------
|
---|
73 | * Bootstrap (v5.1.3): popover.js
|
---|
74 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
---|
75 | * --------------------------------------------------------------------------
|
---|
76 | */
|
---|
77 | /**
|
---|
78 | * ------------------------------------------------------------------------
|
---|
79 | * Constants
|
---|
80 | * ------------------------------------------------------------------------
|
---|
81 | */
|
---|
82 |
|
---|
83 | const NAME = 'popover';
|
---|
84 | const DATA_KEY = 'bs.popover';
|
---|
85 | const EVENT_KEY = `.${DATA_KEY}`;
|
---|
86 | const CLASS_PREFIX = 'bs-popover';
|
---|
87 | const Default = { ...Tooltip__default.default.Default,
|
---|
88 | placement: 'right',
|
---|
89 | offset: [0, 8],
|
---|
90 | trigger: 'click',
|
---|
91 | content: '',
|
---|
92 | template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
|
---|
93 | };
|
---|
94 | const DefaultType = { ...Tooltip__default.default.DefaultType,
|
---|
95 | content: '(string|element|function)'
|
---|
96 | };
|
---|
97 | const Event = {
|
---|
98 | HIDE: `hide${EVENT_KEY}`,
|
---|
99 | HIDDEN: `hidden${EVENT_KEY}`,
|
---|
100 | SHOW: `show${EVENT_KEY}`,
|
---|
101 | SHOWN: `shown${EVENT_KEY}`,
|
---|
102 | INSERTED: `inserted${EVENT_KEY}`,
|
---|
103 | CLICK: `click${EVENT_KEY}`,
|
---|
104 | FOCUSIN: `focusin${EVENT_KEY}`,
|
---|
105 | FOCUSOUT: `focusout${EVENT_KEY}`,
|
---|
106 | MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
---|
107 | MOUSELEAVE: `mouseleave${EVENT_KEY}`
|
---|
108 | };
|
---|
109 | const SELECTOR_TITLE = '.popover-header';
|
---|
110 | const SELECTOR_CONTENT = '.popover-body';
|
---|
111 | /**
|
---|
112 | * ------------------------------------------------------------------------
|
---|
113 | * Class Definition
|
---|
114 | * ------------------------------------------------------------------------
|
---|
115 | */
|
---|
116 |
|
---|
117 | class Popover extends Tooltip__default.default {
|
---|
118 | // Getters
|
---|
119 | static get Default() {
|
---|
120 | return Default;
|
---|
121 | }
|
---|
122 |
|
---|
123 | static get NAME() {
|
---|
124 | return NAME;
|
---|
125 | }
|
---|
126 |
|
---|
127 | static get Event() {
|
---|
128 | return Event;
|
---|
129 | }
|
---|
130 |
|
---|
131 | static get DefaultType() {
|
---|
132 | return DefaultType;
|
---|
133 | } // Overrides
|
---|
134 |
|
---|
135 |
|
---|
136 | isWithContent() {
|
---|
137 | return this.getTitle() || this._getContent();
|
---|
138 | }
|
---|
139 |
|
---|
140 | setContent(tip) {
|
---|
141 | this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
---|
142 |
|
---|
143 | this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
---|
144 | } // Private
|
---|
145 |
|
---|
146 |
|
---|
147 | _getContent() {
|
---|
148 | return this._resolvePossibleFunction(this._config.content);
|
---|
149 | }
|
---|
150 |
|
---|
151 | _getBasicClassPrefix() {
|
---|
152 | return CLASS_PREFIX;
|
---|
153 | } // Static
|
---|
154 |
|
---|
155 |
|
---|
156 | static jQueryInterface(config) {
|
---|
157 | return this.each(function () {
|
---|
158 | const data = Popover.getOrCreateInstance(this, config);
|
---|
159 |
|
---|
160 | if (typeof config === 'string') {
|
---|
161 | if (typeof data[config] === 'undefined') {
|
---|
162 | throw new TypeError(`No method named "${config}"`);
|
---|
163 | }
|
---|
164 |
|
---|
165 | data[config]();
|
---|
166 | }
|
---|
167 | });
|
---|
168 | }
|
---|
169 |
|
---|
170 | }
|
---|
171 | /**
|
---|
172 | * ------------------------------------------------------------------------
|
---|
173 | * jQuery
|
---|
174 | * ------------------------------------------------------------------------
|
---|
175 | * add .Popover to jQuery only if jQuery is present
|
---|
176 | */
|
---|
177 |
|
---|
178 |
|
---|
179 | defineJQueryPlugin(Popover);
|
---|
180 |
|
---|
181 | return Popover;
|
---|
182 |
|
---|
183 | }));
|
---|
184 | //# sourceMappingURL=popover.js.map
|
---|