bootstrap 5.0.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/javascripts/bootstrap/alert.js +78 -48
- data/assets/javascripts/bootstrap/base-component.js +22 -17
- data/assets/javascripts/bootstrap/button.js +19 -12
- data/assets/javascripts/bootstrap/carousel.js +66 -44
- data/assets/javascripts/bootstrap/collapse.js +114 -131
- data/assets/javascripts/bootstrap/dom/data.js +5 -5
- data/assets/javascripts/bootstrap/dom/event-handler.js +11 -5
- data/assets/javascripts/bootstrap/dom/manipulator.js +6 -6
- data/assets/javascripts/bootstrap/dom/selector-engine.js +49 -7
- data/assets/javascripts/bootstrap/dropdown.js +96 -106
- data/assets/javascripts/bootstrap/modal.js +241 -87
- data/assets/javascripts/bootstrap/offcanvas.js +203 -57
- data/assets/javascripts/bootstrap/popover.js +25 -58
- data/assets/javascripts/bootstrap/scrollspy.js +47 -66
- data/assets/javascripts/bootstrap/tab.js +41 -22
- data/assets/javascripts/bootstrap/toast.js +124 -29
- data/assets/javascripts/bootstrap/tooltip.js +122 -104
- data/assets/javascripts/bootstrap-sprockets.js +7 -7
- data/assets/javascripts/bootstrap.js +660 -630
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/stylesheets/_bootstrap-grid.scss +3 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +2 -4
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_card.scss +2 -1
- data/assets/stylesheets/bootstrap/_functions.scss +51 -12
- data/assets/stylesheets/bootstrap/_grid.scss +11 -0
- data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +1 -11
- data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
- data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -0
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
- data/assets/stylesheets/bootstrap/_root.scss +40 -2
- data/assets/stylesheets/bootstrap/_tables.scss +8 -4
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -2
- data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
- data/assets/stylesheets/bootstrap/_variables.scss +184 -11
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +2 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +29 -10
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +1 -1
- data/bootstrap.gemspec +3 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -2
- metadata +12 -8
@@ -1,50 +1,47 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap tooltip.js v5.
|
2
|
+
* Bootstrap tooltip.js v5.1.3 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/
|
8
|
-
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.
|
10
|
-
}(this, (function (Popper,
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
10
|
+
})(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
11
11
|
|
12
|
-
|
12
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
14
|
function _interopNamespace(e) {
|
15
15
|
if (e && e.__esModule) return e;
|
16
|
-
|
16
|
+
const n = Object.create(null);
|
17
17
|
if (e) {
|
18
|
-
|
18
|
+
for (const k in e) {
|
19
19
|
if (k !== 'default') {
|
20
|
-
|
20
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
21
21
|
Object.defineProperty(n, k, d.get ? d : {
|
22
22
|
enumerable: true,
|
23
|
-
get:
|
24
|
-
return e[k];
|
25
|
-
}
|
23
|
+
get: () => e[k]
|
26
24
|
});
|
27
25
|
}
|
28
|
-
}
|
26
|
+
}
|
29
27
|
}
|
30
|
-
n
|
28
|
+
n.default = e;
|
31
29
|
return Object.freeze(n);
|
32
30
|
}
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
|
33
|
+
const Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
34
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
35
|
+
const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
36
|
+
const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
37
|
+
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
40
38
|
|
41
39
|
/**
|
42
40
|
* --------------------------------------------------------------------------
|
43
|
-
* Bootstrap (v5.
|
41
|
+
* Bootstrap (v5.1.3): util/index.js
|
44
42
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
45
43
|
* --------------------------------------------------------------------------
|
46
44
|
*/
|
47
|
-
|
48
45
|
const MAX_UID = 1000000;
|
49
46
|
|
50
47
|
const toType = obj => {
|
@@ -88,7 +85,7 @@
|
|
88
85
|
}
|
89
86
|
|
90
87
|
if (typeof obj === 'string' && obj.length > 0) {
|
91
|
-
return
|
88
|
+
return document.querySelector(obj);
|
92
89
|
}
|
93
90
|
|
94
91
|
return null;
|
@@ -183,42 +180,42 @@
|
|
183
180
|
|
184
181
|
/**
|
185
182
|
* --------------------------------------------------------------------------
|
186
|
-
* Bootstrap (v5.
|
183
|
+
* Bootstrap (v5.1.3): util/sanitizer.js
|
187
184
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
188
185
|
* --------------------------------------------------------------------------
|
189
186
|
*/
|
190
|
-
const
|
187
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
191
188
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
192
189
|
/**
|
193
190
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
194
191
|
*
|
195
|
-
* Shoutout to Angular
|
192
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
196
193
|
*/
|
197
194
|
|
198
|
-
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
195
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
199
196
|
/**
|
200
197
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
201
198
|
*
|
202
|
-
* Shoutout to Angular
|
199
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
203
200
|
*/
|
204
201
|
|
205
202
|
const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
|
206
203
|
|
207
|
-
const allowedAttribute = (
|
208
|
-
const
|
204
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
205
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
209
206
|
|
210
|
-
if (allowedAttributeList.includes(
|
211
|
-
if (
|
212
|
-
return Boolean(SAFE_URL_PATTERN.test(
|
207
|
+
if (allowedAttributeList.includes(attributeName)) {
|
208
|
+
if (uriAttributes.has(attributeName)) {
|
209
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
|
213
210
|
}
|
214
211
|
|
215
212
|
return true;
|
216
213
|
}
|
217
214
|
|
218
|
-
const regExp = allowedAttributeList.filter(
|
215
|
+
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
|
219
216
|
|
220
217
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
221
|
-
if (regExp[i].test(
|
218
|
+
if (regExp[i].test(attributeName)) {
|
222
219
|
return true;
|
223
220
|
}
|
224
221
|
}
|
@@ -270,23 +267,22 @@
|
|
270
267
|
|
271
268
|
const domParser = new window.DOMParser();
|
272
269
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
273
|
-
const allowlistKeys = Object.keys(allowList);
|
274
270
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
275
271
|
|
276
272
|
for (let i = 0, len = elements.length; i < len; i++) {
|
277
|
-
const
|
278
|
-
const
|
273
|
+
const element = elements[i];
|
274
|
+
const elementName = element.nodeName.toLowerCase();
|
279
275
|
|
280
|
-
if (!
|
281
|
-
|
276
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
277
|
+
element.remove();
|
282
278
|
continue;
|
283
279
|
}
|
284
280
|
|
285
|
-
const attributeList = [].concat(...
|
286
|
-
const allowedAttributes = [].concat(allowList['*'] || [], allowList[
|
287
|
-
attributeList.forEach(
|
288
|
-
if (!allowedAttribute(
|
289
|
-
|
281
|
+
const attributeList = [].concat(...element.attributes);
|
282
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
283
|
+
attributeList.forEach(attribute => {
|
284
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
285
|
+
element.removeAttribute(attribute.nodeName);
|
290
286
|
}
|
291
287
|
});
|
292
288
|
}
|
@@ -296,7 +292,7 @@
|
|
296
292
|
|
297
293
|
/**
|
298
294
|
* --------------------------------------------------------------------------
|
299
|
-
* Bootstrap (v5.
|
295
|
+
* Bootstrap (v5.1.3): tooltip.js
|
300
296
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
301
297
|
* --------------------------------------------------------------------------
|
302
298
|
*/
|
@@ -310,7 +306,6 @@
|
|
310
306
|
const DATA_KEY = 'bs.tooltip';
|
311
307
|
const EVENT_KEY = `.${DATA_KEY}`;
|
312
308
|
const CLASS_PREFIX = 'bs-tooltip';
|
313
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
314
309
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
315
310
|
const DefaultType = {
|
316
311
|
animation: 'boolean',
|
@@ -375,6 +370,8 @@
|
|
375
370
|
const HOVER_STATE_SHOW = 'show';
|
376
371
|
const HOVER_STATE_OUT = 'out';
|
377
372
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
373
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
374
|
+
const EVENT_MODAL_HIDE = 'hide.bs.modal';
|
378
375
|
const TRIGGER_HOVER = 'hover';
|
379
376
|
const TRIGGER_FOCUS = 'focus';
|
380
377
|
const TRIGGER_CLICK = 'click';
|
@@ -385,7 +382,7 @@
|
|
385
382
|
* ------------------------------------------------------------------------
|
386
383
|
*/
|
387
384
|
|
388
|
-
class Tooltip extends BaseComponent__default
|
385
|
+
class Tooltip extends BaseComponent__default.default {
|
389
386
|
constructor(element, config) {
|
390
387
|
if (typeof Popper__namespace === 'undefined') {
|
391
388
|
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
|
@@ -463,15 +460,13 @@
|
|
463
460
|
|
464
461
|
dispose() {
|
465
462
|
clearTimeout(this._timeout);
|
466
|
-
EventHandler__default
|
463
|
+
EventHandler__default.default.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
467
464
|
|
468
465
|
if (this.tip) {
|
469
466
|
this.tip.remove();
|
470
467
|
}
|
471
468
|
|
472
|
-
|
473
|
-
this._popper.destroy();
|
474
|
-
}
|
469
|
+
this._disposePopper();
|
475
470
|
|
476
471
|
super.dispose();
|
477
472
|
}
|
@@ -485,12 +480,21 @@
|
|
485
480
|
return;
|
486
481
|
}
|
487
482
|
|
488
|
-
const showEvent = EventHandler__default
|
483
|
+
const showEvent = EventHandler__default.default.trigger(this._element, this.constructor.Event.SHOW);
|
489
484
|
const shadowRoot = findShadowRoot(this._element);
|
490
485
|
const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
|
491
486
|
|
492
487
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
493
488
|
return;
|
489
|
+
} // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
|
490
|
+
// This will be removed later in favor of a `setContent` method
|
491
|
+
|
492
|
+
|
493
|
+
if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
|
494
|
+
this._disposePopper();
|
495
|
+
|
496
|
+
this.tip.remove();
|
497
|
+
this.tip = null;
|
494
498
|
}
|
495
499
|
|
496
500
|
const tip = this.getTipElement();
|
@@ -499,8 +503,6 @@
|
|
499
503
|
|
500
504
|
this._element.setAttribute('aria-describedby', tipId);
|
501
505
|
|
502
|
-
this.setContent();
|
503
|
-
|
504
506
|
if (this._config.animation) {
|
505
507
|
tip.classList.add(CLASS_NAME_FADE);
|
506
508
|
}
|
@@ -514,11 +516,11 @@
|
|
514
516
|
const {
|
515
517
|
container
|
516
518
|
} = this._config;
|
517
|
-
Data__default
|
519
|
+
Data__default.default.set(tip, this.constructor.DATA_KEY, this);
|
518
520
|
|
519
521
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
520
|
-
container.
|
521
|
-
EventHandler__default
|
522
|
+
container.append(tip);
|
523
|
+
EventHandler__default.default.trigger(this._element, this.constructor.Event.INSERTED);
|
522
524
|
}
|
523
525
|
|
524
526
|
if (this._popper) {
|
@@ -528,7 +530,8 @@
|
|
528
530
|
}
|
529
531
|
|
530
532
|
tip.classList.add(CLASS_NAME_SHOW);
|
531
|
-
|
533
|
+
|
534
|
+
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
532
535
|
|
533
536
|
if (customClass) {
|
534
537
|
tip.classList.add(...customClass.split(' '));
|
@@ -540,14 +543,14 @@
|
|
540
543
|
|
541
544
|
if ('ontouchstart' in document.documentElement) {
|
542
545
|
[].concat(...document.body.children).forEach(element => {
|
543
|
-
EventHandler__default
|
546
|
+
EventHandler__default.default.on(element, 'mouseover', noop);
|
544
547
|
});
|
545
548
|
}
|
546
549
|
|
547
550
|
const complete = () => {
|
548
551
|
const prevHoverState = this._hoverState;
|
549
552
|
this._hoverState = null;
|
550
|
-
EventHandler__default
|
553
|
+
EventHandler__default.default.trigger(this._element, this.constructor.Event.SHOWN);
|
551
554
|
|
552
555
|
if (prevHoverState === HOVER_STATE_OUT) {
|
553
556
|
this._leave(null, this);
|
@@ -579,16 +582,12 @@
|
|
579
582
|
|
580
583
|
this._element.removeAttribute('aria-describedby');
|
581
584
|
|
582
|
-
EventHandler__default
|
583
|
-
|
584
|
-
if (this._popper) {
|
585
|
-
this._popper.destroy();
|
585
|
+
EventHandler__default.default.trigger(this._element, this.constructor.Event.HIDDEN);
|
586
586
|
|
587
|
-
|
588
|
-
}
|
587
|
+
this._disposePopper();
|
589
588
|
};
|
590
589
|
|
591
|
-
const hideEvent = EventHandler__default
|
590
|
+
const hideEvent = EventHandler__default.default.trigger(this._element, this.constructor.Event.HIDE);
|
592
591
|
|
593
592
|
if (hideEvent.defaultPrevented) {
|
594
593
|
return;
|
@@ -598,7 +597,7 @@
|
|
598
597
|
// empty mouseover listeners we added for iOS support
|
599
598
|
|
600
599
|
if ('ontouchstart' in document.documentElement) {
|
601
|
-
[].concat(...document.body.children).forEach(element => EventHandler__default
|
600
|
+
[].concat(...document.body.children).forEach(element => EventHandler__default.default.off(element, 'mouseover', noop));
|
602
601
|
}
|
603
602
|
|
604
603
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
@@ -629,14 +628,27 @@
|
|
629
628
|
|
630
629
|
const element = document.createElement('div');
|
631
630
|
element.innerHTML = this._config.template;
|
632
|
-
|
631
|
+
const tip = element.children[0];
|
632
|
+
this.setContent(tip);
|
633
|
+
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
634
|
+
this.tip = tip;
|
633
635
|
return this.tip;
|
634
636
|
}
|
635
637
|
|
636
|
-
setContent() {
|
637
|
-
|
638
|
-
|
639
|
-
|
638
|
+
setContent(tip) {
|
639
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
|
640
|
+
}
|
641
|
+
|
642
|
+
_sanitizeAndSetContent(template, content, selector) {
|
643
|
+
const templateElement = SelectorEngine__default.default.findOne(selector, template);
|
644
|
+
|
645
|
+
if (!content && templateElement) {
|
646
|
+
templateElement.remove();
|
647
|
+
return;
|
648
|
+
} // we use append for html objects to maintain js events
|
649
|
+
|
650
|
+
|
651
|
+
this.setElementContent(templateElement, content);
|
640
652
|
}
|
641
653
|
|
642
654
|
setElementContent(element, content) {
|
@@ -650,7 +662,7 @@
|
|
650
662
|
if (this._config.html) {
|
651
663
|
if (content.parentNode !== element) {
|
652
664
|
element.innerHTML = '';
|
653
|
-
element.
|
665
|
+
element.append(content);
|
654
666
|
}
|
655
667
|
} else {
|
656
668
|
element.textContent = content.textContent;
|
@@ -671,13 +683,9 @@
|
|
671
683
|
}
|
672
684
|
|
673
685
|
getTitle() {
|
674
|
-
|
686
|
+
const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
|
675
687
|
|
676
|
-
|
677
|
-
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
678
|
-
}
|
679
|
-
|
680
|
-
return title;
|
688
|
+
return this._resolvePossibleFunction(title);
|
681
689
|
}
|
682
690
|
|
683
691
|
updateAttachment(attachment) {
|
@@ -694,15 +702,7 @@
|
|
694
702
|
|
695
703
|
|
696
704
|
_initializeOnDelegatedTarget(event, context) {
|
697
|
-
|
698
|
-
context = context || Data__default['default'].get(event.delegateTarget, dataKey);
|
699
|
-
|
700
|
-
if (!context) {
|
701
|
-
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
702
|
-
Data__default['default'].set(event.delegateTarget, dataKey, context);
|
703
|
-
}
|
704
|
-
|
705
|
-
return context;
|
705
|
+
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
706
706
|
}
|
707
707
|
|
708
708
|
_getOffset() {
|
@@ -721,6 +721,10 @@
|
|
721
721
|
return offset;
|
722
722
|
}
|
723
723
|
|
724
|
+
_resolvePossibleFunction(content) {
|
725
|
+
return typeof content === 'function' ? content.call(this._element) : content;
|
726
|
+
}
|
727
|
+
|
724
728
|
_getPopperConfig(attachment) {
|
725
729
|
const defaultBsPopperConfig = {
|
726
730
|
placement: attachment,
|
@@ -762,7 +766,7 @@
|
|
762
766
|
}
|
763
767
|
|
764
768
|
_addAttachmentClass(attachment) {
|
765
|
-
this.getTipElement().classList.add(`${
|
769
|
+
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
766
770
|
}
|
767
771
|
|
768
772
|
_getAttachment(placement) {
|
@@ -774,12 +778,12 @@
|
|
774
778
|
|
775
779
|
triggers.forEach(trigger => {
|
776
780
|
if (trigger === 'click') {
|
777
|
-
EventHandler__default
|
781
|
+
EventHandler__default.default.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
|
778
782
|
} else if (trigger !== TRIGGER_MANUAL) {
|
779
783
|
const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
|
780
784
|
const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
|
781
|
-
EventHandler__default
|
782
|
-
EventHandler__default
|
785
|
+
EventHandler__default.default.on(this._element, eventIn, this._config.selector, event => this._enter(event));
|
786
|
+
EventHandler__default.default.on(this._element, eventOut, this._config.selector, event => this._leave(event));
|
783
787
|
}
|
784
788
|
});
|
785
789
|
|
@@ -789,7 +793,7 @@
|
|
789
793
|
}
|
790
794
|
};
|
791
795
|
|
792
|
-
EventHandler__default
|
796
|
+
EventHandler__default.default.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
793
797
|
|
794
798
|
if (this._config.selector) {
|
795
799
|
this._config = { ...this._config,
|
@@ -881,7 +885,7 @@
|
|
881
885
|
}
|
882
886
|
|
883
887
|
_getConfig(config) {
|
884
|
-
const dataAttributes = Manipulator__default
|
888
|
+
const dataAttributes = Manipulator__default.default.getDataAttributes(this._element);
|
885
889
|
Object.keys(dataAttributes).forEach(dataAttr => {
|
886
890
|
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
|
887
891
|
delete dataAttributes[dataAttr];
|
@@ -920,26 +924,32 @@
|
|
920
924
|
_getDelegateConfig() {
|
921
925
|
const config = {};
|
922
926
|
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
config[key] = this._config[key];
|
927
|
-
}
|
927
|
+
for (const key in this._config) {
|
928
|
+
if (this.constructor.Default[key] !== this._config[key]) {
|
929
|
+
config[key] = this._config[key];
|
928
930
|
}
|
929
|
-
}
|
931
|
+
} // In the future can be replaced with:
|
932
|
+
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
933
|
+
// `Object.fromEntries(keysWithDifferentValues)`
|
934
|
+
|
930
935
|
|
931
936
|
return config;
|
932
937
|
}
|
933
938
|
|
934
939
|
_cleanTipClass() {
|
935
940
|
const tip = this.getTipElement();
|
936
|
-
const
|
941
|
+
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
942
|
+
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
937
943
|
|
938
944
|
if (tabClass !== null && tabClass.length > 0) {
|
939
945
|
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
940
946
|
}
|
941
947
|
}
|
942
948
|
|
949
|
+
_getBasicClassPrefix() {
|
950
|
+
return CLASS_PREFIX;
|
951
|
+
}
|
952
|
+
|
943
953
|
_handlePopperPlacementChange(popperData) {
|
944
954
|
const {
|
945
955
|
state
|
@@ -954,6 +964,14 @@
|
|
954
964
|
this._cleanTipClass();
|
955
965
|
|
956
966
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
967
|
+
}
|
968
|
+
|
969
|
+
_disposePopper() {
|
970
|
+
if (this._popper) {
|
971
|
+
this._popper.destroy();
|
972
|
+
|
973
|
+
this._popper = null;
|
974
|
+
}
|
957
975
|
} // Static
|
958
976
|
|
959
977
|
|
@@ -984,4 +1002,4 @@
|
|
984
1002
|
|
985
1003
|
return Tooltip;
|
986
1004
|
|
987
|
-
}))
|
1005
|
+
}));
|
@@ -2,18 +2,18 @@
|
|
2
2
|
//= require ./bootstrap/dom/data
|
3
3
|
//= require ./bootstrap/dom/event-handler
|
4
4
|
//= require ./bootstrap/base-component
|
5
|
+
//= require ./bootstrap/alert
|
6
|
+
//= require ./bootstrap/button
|
5
7
|
//= require ./bootstrap/dom/manipulator
|
6
8
|
//= require ./bootstrap/dom/selector-engine
|
7
9
|
//= require ./bootstrap/carousel
|
8
10
|
//= require ./bootstrap/collapse
|
9
|
-
//= require ./bootstrap/
|
10
|
-
//= require ./bootstrap/
|
11
|
-
//= require ./bootstrap/
|
11
|
+
//= require ./bootstrap/dropdown
|
12
|
+
//= require ./bootstrap/modal
|
13
|
+
//= require ./bootstrap/offcanvas
|
12
14
|
//= require ./bootstrap/tooltip
|
13
15
|
//= require ./bootstrap/popover
|
14
|
-
//= require ./bootstrap/alert
|
15
|
-
//= require ./bootstrap/offcanvas
|
16
16
|
//= require ./bootstrap/scrollspy
|
17
|
-
//= require ./bootstrap/
|
18
|
-
//= require ./bootstrap/
|
17
|
+
//= require ./bootstrap/tab
|
18
|
+
//= require ./bootstrap/toast
|
19
19
|
//= require ./bootstrap-global-this-undefine
|