bootstrap 5.0.1 → 5.1.2
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 +2 -2
- data/assets/javascripts/bootstrap/alert.js +89 -58
- data/assets/javascripts/bootstrap/base-component.js +53 -39
- data/assets/javascripts/bootstrap/button.js +31 -25
- data/assets/javascripts/bootstrap/carousel.js +126 -89
- data/assets/javascripts/bootstrap/collapse.js +125 -133
- 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 +147 -140
- data/assets/javascripts/bootstrap/modal.js +397 -180
- data/assets/javascripts/bootstrap/offcanvas.js +333 -138
- data/assets/javascripts/bootstrap/popover.js +36 -54
- data/assets/javascripts/bootstrap/scrollspy.js +58 -68
- data/assets/javascripts/bootstrap/tab.js +53 -26
- data/assets/javascripts/bootstrap/toast.js +138 -41
- data/assets/javascripts/bootstrap/tooltip.js +137 -120
- data/assets/javascripts/bootstrap-sprockets.js +8 -8
- data/assets/javascripts/bootstrap.js +937 -886
- 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/_buttons.scss +1 -0
- data/assets/stylesheets/bootstrap/_card.scss +7 -6
- data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
- data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
- data/assets/stylesheets/bootstrap/_functions.scss +100 -3
- data/assets/stylesheets/bootstrap/_grid.scss +11 -0
- data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +5 -15
- data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
- data/assets/stylesheets/bootstrap/_offcanvas.scss +8 -2
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +10 -10
- data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
- data/assets/stylesheets/bootstrap/_root.scss +40 -2
- data/assets/stylesheets/bootstrap/_tables.scss +9 -5
- data/assets/stylesheets/bootstrap/_toasts.scss +3 -3
- data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
- data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
- data/assets/stylesheets/bootstrap/_variables.scss +206 -29
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +5 -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/_buttons.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +35 -9
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +1 -1
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
- data/bootstrap.gemspec +3 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -2
- metadata +12 -8
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap v5.
|
2
|
+
* Bootstrap v5.1.2 (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
|
*/
|
@@ -7,108 +7,34 @@
|
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) :
|
8
8
|
typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) :
|
9
9
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper));
|
10
|
-
}(this, (function (Popper) { 'use strict';
|
10
|
+
})(this, (function (Popper) { 'use strict';
|
11
11
|
|
12
12
|
function _interopNamespace(e) {
|
13
13
|
if (e && e.__esModule) return e;
|
14
|
-
|
14
|
+
const n = Object.create(null);
|
15
15
|
if (e) {
|
16
|
-
|
16
|
+
for (const k in e) {
|
17
17
|
if (k !== 'default') {
|
18
|
-
|
18
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
19
19
|
Object.defineProperty(n, k, d.get ? d : {
|
20
20
|
enumerable: true,
|
21
|
-
get:
|
22
|
-
return e[k];
|
23
|
-
}
|
21
|
+
get: () => e[k]
|
24
22
|
});
|
25
23
|
}
|
26
|
-
}
|
24
|
+
}
|
27
25
|
}
|
28
|
-
n
|
26
|
+
n.default = e;
|
29
27
|
return Object.freeze(n);
|
30
28
|
}
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
/**
|
35
|
-
* --------------------------------------------------------------------------
|
36
|
-
* Bootstrap (v5.0.1): dom/selector-engine.js
|
37
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
38
|
-
* --------------------------------------------------------------------------
|
39
|
-
*/
|
40
|
-
|
41
|
-
/**
|
42
|
-
* ------------------------------------------------------------------------
|
43
|
-
* Constants
|
44
|
-
* ------------------------------------------------------------------------
|
45
|
-
*/
|
46
|
-
const NODE_TEXT = 3;
|
47
|
-
const SelectorEngine = {
|
48
|
-
find(selector, element = document.documentElement) {
|
49
|
-
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
50
|
-
},
|
51
|
-
|
52
|
-
findOne(selector, element = document.documentElement) {
|
53
|
-
return Element.prototype.querySelector.call(element, selector);
|
54
|
-
},
|
55
|
-
|
56
|
-
children(element, selector) {
|
57
|
-
return [].concat(...element.children).filter(child => child.matches(selector));
|
58
|
-
},
|
59
|
-
|
60
|
-
parents(element, selector) {
|
61
|
-
const parents = [];
|
62
|
-
let ancestor = element.parentNode;
|
63
|
-
|
64
|
-
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
65
|
-
if (ancestor.matches(selector)) {
|
66
|
-
parents.push(ancestor);
|
67
|
-
}
|
68
|
-
|
69
|
-
ancestor = ancestor.parentNode;
|
70
|
-
}
|
71
|
-
|
72
|
-
return parents;
|
73
|
-
},
|
74
|
-
|
75
|
-
prev(element, selector) {
|
76
|
-
let previous = element.previousElementSibling;
|
77
|
-
|
78
|
-
while (previous) {
|
79
|
-
if (previous.matches(selector)) {
|
80
|
-
return [previous];
|
81
|
-
}
|
82
|
-
|
83
|
-
previous = previous.previousElementSibling;
|
84
|
-
}
|
85
|
-
|
86
|
-
return [];
|
87
|
-
},
|
88
|
-
|
89
|
-
next(element, selector) {
|
90
|
-
let next = element.nextElementSibling;
|
91
|
-
|
92
|
-
while (next) {
|
93
|
-
if (next.matches(selector)) {
|
94
|
-
return [next];
|
95
|
-
}
|
96
|
-
|
97
|
-
next = next.nextElementSibling;
|
98
|
-
}
|
99
|
-
|
100
|
-
return [];
|
101
|
-
}
|
102
|
-
|
103
|
-
};
|
30
|
+
const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
|
104
31
|
|
105
32
|
/**
|
106
33
|
* --------------------------------------------------------------------------
|
107
|
-
* Bootstrap (v5.
|
34
|
+
* Bootstrap (v5.1.2): util/index.js
|
108
35
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
109
36
|
* --------------------------------------------------------------------------
|
110
37
|
*/
|
111
|
-
|
112
38
|
const MAX_UID = 1000000;
|
113
39
|
const MILLISECONDS_MULTIPLIER = 1000;
|
114
40
|
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
@@ -220,30 +146,12 @@
|
|
220
146
|
}
|
221
147
|
|
222
148
|
if (typeof obj === 'string' && obj.length > 0) {
|
223
|
-
return
|
149
|
+
return document.querySelector(obj);
|
224
150
|
}
|
225
151
|
|
226
152
|
return null;
|
227
153
|
};
|
228
154
|
|
229
|
-
const emulateTransitionEnd = (element, duration) => {
|
230
|
-
let called = false;
|
231
|
-
const durationPadding = 5;
|
232
|
-
const emulatedDuration = duration + durationPadding;
|
233
|
-
|
234
|
-
function listener() {
|
235
|
-
called = true;
|
236
|
-
element.removeEventListener(TRANSITION_END, listener);
|
237
|
-
}
|
238
|
-
|
239
|
-
element.addEventListener(TRANSITION_END, listener);
|
240
|
-
setTimeout(() => {
|
241
|
-
if (!called) {
|
242
|
-
triggerTransitionEnd(element);
|
243
|
-
}
|
244
|
-
}, emulatedDuration);
|
245
|
-
};
|
246
|
-
|
247
155
|
const typeCheckConfig = (componentName, config, configTypes) => {
|
248
156
|
Object.keys(configTypes).forEach(property => {
|
249
157
|
const expectedTypes = configTypes[property];
|
@@ -257,17 +165,11 @@
|
|
257
165
|
};
|
258
166
|
|
259
167
|
const isVisible = element => {
|
260
|
-
if (!element) {
|
168
|
+
if (!isElement(element) || element.getClientRects().length === 0) {
|
261
169
|
return false;
|
262
170
|
}
|
263
171
|
|
264
|
-
|
265
|
-
const elementStyle = getComputedStyle(element);
|
266
|
-
const parentNodeStyle = getComputedStyle(element.parentNode);
|
267
|
-
return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
|
268
|
-
}
|
269
|
-
|
270
|
-
return false;
|
172
|
+
return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
271
173
|
};
|
272
174
|
|
273
175
|
const isDisabled = element => {
|
@@ -310,8 +212,20 @@
|
|
310
212
|
};
|
311
213
|
|
312
214
|
const noop = () => {};
|
215
|
+
/**
|
216
|
+
* Trick to restart an element's animation
|
217
|
+
*
|
218
|
+
* @param {HTMLElement} element
|
219
|
+
* @return void
|
220
|
+
*
|
221
|
+
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
222
|
+
*/
|
313
223
|
|
314
|
-
|
224
|
+
|
225
|
+
const reflow = element => {
|
226
|
+
// eslint-disable-next-line no-unused-expressions
|
227
|
+
element.offsetHeight;
|
228
|
+
};
|
315
229
|
|
316
230
|
const getjQuery = () => {
|
317
231
|
const {
|
@@ -325,9 +239,18 @@
|
|
325
239
|
return null;
|
326
240
|
};
|
327
241
|
|
242
|
+
const DOMContentLoadedCallbacks = [];
|
243
|
+
|
328
244
|
const onDOMContentLoaded = callback => {
|
329
245
|
if (document.readyState === 'loading') {
|
330
|
-
document
|
246
|
+
// add listener on the first call when the document is in loading state
|
247
|
+
if (!DOMContentLoadedCallbacks.length) {
|
248
|
+
document.addEventListener('DOMContentLoaded', () => {
|
249
|
+
DOMContentLoadedCallbacks.forEach(callback => callback());
|
250
|
+
});
|
251
|
+
}
|
252
|
+
|
253
|
+
DOMContentLoadedCallbacks.push(callback);
|
331
254
|
} else {
|
332
255
|
callback();
|
333
256
|
}
|
@@ -360,63 +283,66 @@
|
|
360
283
|
}
|
361
284
|
};
|
362
285
|
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
*/
|
369
|
-
|
370
|
-
/**
|
371
|
-
* ------------------------------------------------------------------------
|
372
|
-
* Constants
|
373
|
-
* ------------------------------------------------------------------------
|
374
|
-
*/
|
375
|
-
const elementMap = new Map();
|
376
|
-
var Data = {
|
377
|
-
set(element, key, instance) {
|
378
|
-
if (!elementMap.has(element)) {
|
379
|
-
elementMap.set(element, new Map());
|
380
|
-
}
|
286
|
+
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
287
|
+
if (!waitForTransition) {
|
288
|
+
execute(callback);
|
289
|
+
return;
|
290
|
+
}
|
381
291
|
|
382
|
-
|
383
|
-
|
292
|
+
const durationPadding = 5;
|
293
|
+
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
294
|
+
let called = false;
|
384
295
|
|
385
|
-
|
386
|
-
|
387
|
-
|
296
|
+
const handler = ({
|
297
|
+
target
|
298
|
+
}) => {
|
299
|
+
if (target !== transitionElement) {
|
388
300
|
return;
|
389
301
|
}
|
390
302
|
|
391
|
-
|
392
|
-
|
303
|
+
called = true;
|
304
|
+
transitionElement.removeEventListener(TRANSITION_END, handler);
|
305
|
+
execute(callback);
|
306
|
+
};
|
393
307
|
|
394
|
-
|
395
|
-
|
396
|
-
|
308
|
+
transitionElement.addEventListener(TRANSITION_END, handler);
|
309
|
+
setTimeout(() => {
|
310
|
+
if (!called) {
|
311
|
+
triggerTransitionEnd(transitionElement);
|
397
312
|
}
|
313
|
+
}, emulatedDuration);
|
314
|
+
};
|
315
|
+
/**
|
316
|
+
* Return the previous/next element of a list.
|
317
|
+
*
|
318
|
+
* @param {array} list The list of elements
|
319
|
+
* @param activeElement The active element
|
320
|
+
* @param shouldGetNext Choose to get next or previous element
|
321
|
+
* @param isCycleAllowed
|
322
|
+
* @return {Element|elem} The proper element
|
323
|
+
*/
|
398
324
|
|
399
|
-
return null;
|
400
|
-
},
|
401
325
|
|
402
|
-
|
403
|
-
|
404
|
-
return;
|
405
|
-
}
|
326
|
+
const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
327
|
+
let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
|
406
328
|
|
407
|
-
|
408
|
-
|
329
|
+
if (index === -1) {
|
330
|
+
return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
|
331
|
+
}
|
409
332
|
|
410
|
-
|
411
|
-
|
412
|
-
|
333
|
+
const listLength = list.length;
|
334
|
+
index += shouldGetNext ? 1 : -1;
|
335
|
+
|
336
|
+
if (isCycleAllowed) {
|
337
|
+
index = (index + listLength) % listLength;
|
413
338
|
}
|
414
339
|
|
340
|
+
return list[Math.max(0, Math.min(index, listLength - 1))];
|
415
341
|
};
|
416
342
|
|
417
343
|
/**
|
418
344
|
* --------------------------------------------------------------------------
|
419
|
-
* Bootstrap (v5.
|
345
|
+
* Bootstrap (v5.1.2): dom/event-handler.js
|
420
346
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
421
347
|
* --------------------------------------------------------------------------
|
422
348
|
*/
|
@@ -479,7 +405,6 @@
|
|
479
405
|
event.delegateTarget = target;
|
480
406
|
|
481
407
|
if (handler.oneOff) {
|
482
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
483
408
|
EventHandler.off(element, event.type, selector, fn);
|
484
409
|
}
|
485
410
|
|
@@ -705,17 +630,71 @@
|
|
705
630
|
|
706
631
|
/**
|
707
632
|
* --------------------------------------------------------------------------
|
708
|
-
* Bootstrap (v5.
|
633
|
+
* Bootstrap (v5.1.2): dom/data.js
|
709
634
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
710
635
|
* --------------------------------------------------------------------------
|
711
636
|
*/
|
637
|
+
|
712
638
|
/**
|
713
639
|
* ------------------------------------------------------------------------
|
714
640
|
* Constants
|
715
641
|
* ------------------------------------------------------------------------
|
716
642
|
*/
|
643
|
+
const elementMap = new Map();
|
644
|
+
const Data = {
|
645
|
+
set(element, key, instance) {
|
646
|
+
if (!elementMap.has(element)) {
|
647
|
+
elementMap.set(element, new Map());
|
648
|
+
}
|
649
|
+
|
650
|
+
const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
|
651
|
+
// can be removed later when multiple key/instances are fine to be used
|
652
|
+
|
653
|
+
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
654
|
+
// eslint-disable-next-line no-console
|
655
|
+
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
656
|
+
return;
|
657
|
+
}
|
658
|
+
|
659
|
+
instanceMap.set(key, instance);
|
660
|
+
},
|
661
|
+
|
662
|
+
get(element, key) {
|
663
|
+
if (elementMap.has(element)) {
|
664
|
+
return elementMap.get(element).get(key) || null;
|
665
|
+
}
|
666
|
+
|
667
|
+
return null;
|
668
|
+
},
|
669
|
+
|
670
|
+
remove(element, key) {
|
671
|
+
if (!elementMap.has(element)) {
|
672
|
+
return;
|
673
|
+
}
|
674
|
+
|
675
|
+
const instanceMap = elementMap.get(element);
|
676
|
+
instanceMap.delete(key); // free up element references if there are no instances left for an element
|
677
|
+
|
678
|
+
if (instanceMap.size === 0) {
|
679
|
+
elementMap.delete(element);
|
680
|
+
}
|
681
|
+
}
|
717
682
|
|
718
|
-
|
683
|
+
};
|
684
|
+
|
685
|
+
/**
|
686
|
+
* --------------------------------------------------------------------------
|
687
|
+
* Bootstrap (v5.1.2): base-component.js
|
688
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
689
|
+
* --------------------------------------------------------------------------
|
690
|
+
*/
|
691
|
+
/**
|
692
|
+
* ------------------------------------------------------------------------
|
693
|
+
* Constants
|
694
|
+
* ------------------------------------------------------------------------
|
695
|
+
*/
|
696
|
+
|
697
|
+
const VERSION = '5.1.2';
|
719
698
|
|
720
699
|
class BaseComponent {
|
721
700
|
constructor(element) {
|
@@ -738,20 +717,17 @@
|
|
738
717
|
}
|
739
718
|
|
740
719
|
_queueCallback(callback, element, isAnimated = true) {
|
741
|
-
|
742
|
-
execute(callback);
|
743
|
-
return;
|
744
|
-
}
|
745
|
-
|
746
|
-
const transitionDuration = getTransitionDurationFromElement(element);
|
747
|
-
EventHandler.one(element, 'transitionend', () => execute(callback));
|
748
|
-
emulateTransitionEnd(element, transitionDuration);
|
720
|
+
executeAfterTransition(callback, element, isAnimated);
|
749
721
|
}
|
750
722
|
/** Static */
|
751
723
|
|
752
724
|
|
753
725
|
static getInstance(element) {
|
754
|
-
return Data.get(element, this.DATA_KEY);
|
726
|
+
return Data.get(getElement(element), this.DATA_KEY);
|
727
|
+
}
|
728
|
+
|
729
|
+
static getOrCreateInstance(element, config = {}) {
|
730
|
+
return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
|
755
731
|
}
|
756
732
|
|
757
733
|
static get VERSION() {
|
@@ -774,7 +750,33 @@
|
|
774
750
|
|
775
751
|
/**
|
776
752
|
* --------------------------------------------------------------------------
|
777
|
-
* Bootstrap (v5.
|
753
|
+
* Bootstrap (v5.1.2): util/component-functions.js
|
754
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
755
|
+
* --------------------------------------------------------------------------
|
756
|
+
*/
|
757
|
+
|
758
|
+
const enableDismissTrigger = (component, method = 'hide') => {
|
759
|
+
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
760
|
+
const name = component.NAME;
|
761
|
+
EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
762
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
763
|
+
event.preventDefault();
|
764
|
+
}
|
765
|
+
|
766
|
+
if (isDisabled(this)) {
|
767
|
+
return;
|
768
|
+
}
|
769
|
+
|
770
|
+
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
771
|
+
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
772
|
+
|
773
|
+
instance[method]();
|
774
|
+
});
|
775
|
+
};
|
776
|
+
|
777
|
+
/**
|
778
|
+
* --------------------------------------------------------------------------
|
779
|
+
* Bootstrap (v5.1.2): alert.js
|
778
780
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
779
781
|
* --------------------------------------------------------------------------
|
780
782
|
*/
|
@@ -784,17 +786,13 @@
|
|
784
786
|
* ------------------------------------------------------------------------
|
785
787
|
*/
|
786
788
|
|
787
|
-
const NAME$
|
788
|
-
const DATA_KEY$
|
789
|
-
const EVENT_KEY$
|
790
|
-
const
|
791
|
-
const
|
792
|
-
const
|
793
|
-
const
|
794
|
-
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
|
795
|
-
const CLASS_NAME_ALERT = 'alert';
|
796
|
-
const CLASS_NAME_FADE$6 = 'fade';
|
797
|
-
const CLASS_NAME_SHOW$9 = 'show';
|
789
|
+
const NAME$d = 'alert';
|
790
|
+
const DATA_KEY$c = 'bs.alert';
|
791
|
+
const EVENT_KEY$c = `.${DATA_KEY$c}`;
|
792
|
+
const EVENT_CLOSE = `close${EVENT_KEY$c}`;
|
793
|
+
const EVENT_CLOSED = `closed${EVENT_KEY$c}`;
|
794
|
+
const CLASS_NAME_FADE$5 = 'fade';
|
795
|
+
const CLASS_NAME_SHOW$8 = 'show';
|
798
796
|
/**
|
799
797
|
* ------------------------------------------------------------------------
|
800
798
|
* Class Definition
|
@@ -804,69 +802,47 @@
|
|
804
802
|
class Alert extends BaseComponent {
|
805
803
|
// Getters
|
806
804
|
static get NAME() {
|
807
|
-
return NAME$
|
805
|
+
return NAME$d;
|
808
806
|
} // Public
|
809
807
|
|
810
808
|
|
811
|
-
close(
|
812
|
-
const
|
813
|
-
|
814
|
-
const customEvent = this._triggerCloseEvent(rootElement);
|
809
|
+
close() {
|
810
|
+
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
|
815
811
|
|
816
|
-
if (
|
812
|
+
if (closeEvent.defaultPrevented) {
|
817
813
|
return;
|
818
814
|
}
|
819
815
|
|
820
|
-
this.
|
821
|
-
} // Private
|
822
|
-
|
823
|
-
|
824
|
-
_getRootElement(element) {
|
825
|
-
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
826
|
-
}
|
816
|
+
this._element.classList.remove(CLASS_NAME_SHOW$8);
|
827
817
|
|
828
|
-
|
829
|
-
return EventHandler.trigger(element, EVENT_CLOSE);
|
830
|
-
}
|
818
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
|
831
819
|
|
832
|
-
|
833
|
-
|
834
|
-
const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
|
820
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
821
|
+
} // Private
|
835
822
|
|
836
|
-
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
|
837
|
-
}
|
838
823
|
|
839
|
-
_destroyElement(
|
840
|
-
|
841
|
-
element.parentNode.removeChild(element);
|
842
|
-
}
|
824
|
+
_destroyElement() {
|
825
|
+
this._element.remove();
|
843
826
|
|
844
|
-
EventHandler.trigger(
|
827
|
+
EventHandler.trigger(this._element, EVENT_CLOSED);
|
828
|
+
this.dispose();
|
845
829
|
} // Static
|
846
830
|
|
847
831
|
|
848
832
|
static jQueryInterface(config) {
|
849
833
|
return this.each(function () {
|
850
|
-
|
834
|
+
const data = Alert.getOrCreateInstance(this);
|
851
835
|
|
852
|
-
if (
|
853
|
-
|
854
|
-
}
|
855
|
-
|
856
|
-
if (config === 'close') {
|
857
|
-
data[config](this);
|
836
|
+
if (typeof config !== 'string') {
|
837
|
+
return;
|
858
838
|
}
|
859
|
-
});
|
860
|
-
}
|
861
839
|
|
862
|
-
|
863
|
-
|
864
|
-
if (event) {
|
865
|
-
event.preventDefault();
|
840
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
841
|
+
throw new TypeError(`No method named "${config}"`);
|
866
842
|
}
|
867
843
|
|
868
|
-
|
869
|
-
};
|
844
|
+
data[config](this);
|
845
|
+
});
|
870
846
|
}
|
871
847
|
|
872
848
|
}
|
@@ -877,7 +853,7 @@
|
|
877
853
|
*/
|
878
854
|
|
879
855
|
|
880
|
-
|
856
|
+
enableDismissTrigger(Alert, 'close');
|
881
857
|
/**
|
882
858
|
* ------------------------------------------------------------------------
|
883
859
|
* jQuery
|
@@ -889,7 +865,7 @@
|
|
889
865
|
|
890
866
|
/**
|
891
867
|
* --------------------------------------------------------------------------
|
892
|
-
* Bootstrap (v5.
|
868
|
+
* Bootstrap (v5.1.2): button.js
|
893
869
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
894
870
|
* --------------------------------------------------------------------------
|
895
871
|
*/
|
@@ -899,13 +875,13 @@
|
|
899
875
|
* ------------------------------------------------------------------------
|
900
876
|
*/
|
901
877
|
|
902
|
-
const NAME$
|
903
|
-
const DATA_KEY$
|
904
|
-
const EVENT_KEY$
|
878
|
+
const NAME$c = 'button';
|
879
|
+
const DATA_KEY$b = 'bs.button';
|
880
|
+
const EVENT_KEY$b = `.${DATA_KEY$b}`;
|
905
881
|
const DATA_API_KEY$7 = '.data-api';
|
906
882
|
const CLASS_NAME_ACTIVE$3 = 'active';
|
907
883
|
const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
|
908
|
-
const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$
|
884
|
+
const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
|
909
885
|
/**
|
910
886
|
* ------------------------------------------------------------------------
|
911
887
|
* Class Definition
|
@@ -915,7 +891,7 @@
|
|
915
891
|
class Button extends BaseComponent {
|
916
892
|
// Getters
|
917
893
|
static get NAME() {
|
918
|
-
return NAME$
|
894
|
+
return NAME$c;
|
919
895
|
} // Public
|
920
896
|
|
921
897
|
|
@@ -927,11 +903,7 @@
|
|
927
903
|
|
928
904
|
static jQueryInterface(config) {
|
929
905
|
return this.each(function () {
|
930
|
-
|
931
|
-
|
932
|
-
if (!data) {
|
933
|
-
data = new Button(this);
|
934
|
-
}
|
906
|
+
const data = Button.getOrCreateInstance(this);
|
935
907
|
|
936
908
|
if (config === 'toggle') {
|
937
909
|
data[config]();
|
@@ -950,12 +922,7 @@
|
|
950
922
|
EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
|
951
923
|
event.preventDefault();
|
952
924
|
const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
|
953
|
-
|
954
|
-
|
955
|
-
if (!data) {
|
956
|
-
data = new Button(button);
|
957
|
-
}
|
958
|
-
|
925
|
+
const data = Button.getOrCreateInstance(button);
|
959
926
|
data.toggle();
|
960
927
|
});
|
961
928
|
/**
|
@@ -969,7 +936,7 @@
|
|
969
936
|
|
970
937
|
/**
|
971
938
|
* --------------------------------------------------------------------------
|
972
|
-
* Bootstrap (v5.
|
939
|
+
* Bootstrap (v5.1.2): dom/manipulator.js
|
973
940
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
974
941
|
* --------------------------------------------------------------------------
|
975
942
|
*/
|
@@ -1027,8 +994,8 @@
|
|
1027
994
|
offset(element) {
|
1028
995
|
const rect = element.getBoundingClientRect();
|
1029
996
|
return {
|
1030
|
-
top: rect.top +
|
1031
|
-
left: rect.left +
|
997
|
+
top: rect.top + window.pageYOffset,
|
998
|
+
left: rect.left + window.pageXOffset
|
1032
999
|
};
|
1033
1000
|
},
|
1034
1001
|
|
@@ -1043,7 +1010,77 @@
|
|
1043
1010
|
|
1044
1011
|
/**
|
1045
1012
|
* --------------------------------------------------------------------------
|
1046
|
-
* Bootstrap (v5.
|
1013
|
+
* Bootstrap (v5.1.2): dom/selector-engine.js
|
1014
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
1015
|
+
* --------------------------------------------------------------------------
|
1016
|
+
*/
|
1017
|
+
const NODE_TEXT = 3;
|
1018
|
+
const SelectorEngine = {
|
1019
|
+
find(selector, element = document.documentElement) {
|
1020
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
1021
|
+
},
|
1022
|
+
|
1023
|
+
findOne(selector, element = document.documentElement) {
|
1024
|
+
return Element.prototype.querySelector.call(element, selector);
|
1025
|
+
},
|
1026
|
+
|
1027
|
+
children(element, selector) {
|
1028
|
+
return [].concat(...element.children).filter(child => child.matches(selector));
|
1029
|
+
},
|
1030
|
+
|
1031
|
+
parents(element, selector) {
|
1032
|
+
const parents = [];
|
1033
|
+
let ancestor = element.parentNode;
|
1034
|
+
|
1035
|
+
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
1036
|
+
if (ancestor.matches(selector)) {
|
1037
|
+
parents.push(ancestor);
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
ancestor = ancestor.parentNode;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
return parents;
|
1044
|
+
},
|
1045
|
+
|
1046
|
+
prev(element, selector) {
|
1047
|
+
let previous = element.previousElementSibling;
|
1048
|
+
|
1049
|
+
while (previous) {
|
1050
|
+
if (previous.matches(selector)) {
|
1051
|
+
return [previous];
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
previous = previous.previousElementSibling;
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
return [];
|
1058
|
+
},
|
1059
|
+
|
1060
|
+
next(element, selector) {
|
1061
|
+
let next = element.nextElementSibling;
|
1062
|
+
|
1063
|
+
while (next) {
|
1064
|
+
if (next.matches(selector)) {
|
1065
|
+
return [next];
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
next = next.nextElementSibling;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
return [];
|
1072
|
+
},
|
1073
|
+
|
1074
|
+
focusableChildren(element) {
|
1075
|
+
const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
|
1076
|
+
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
};
|
1080
|
+
|
1081
|
+
/**
|
1082
|
+
* --------------------------------------------------------------------------
|
1083
|
+
* Bootstrap (v5.1.2): carousel.js
|
1047
1084
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
1048
1085
|
* --------------------------------------------------------------------------
|
1049
1086
|
*/
|
@@ -1053,16 +1090,16 @@
|
|
1053
1090
|
* ------------------------------------------------------------------------
|
1054
1091
|
*/
|
1055
1092
|
|
1056
|
-
const NAME$
|
1057
|
-
const DATA_KEY$
|
1058
|
-
const EVENT_KEY$
|
1093
|
+
const NAME$b = 'carousel';
|
1094
|
+
const DATA_KEY$a = 'bs.carousel';
|
1095
|
+
const EVENT_KEY$a = `.${DATA_KEY$a}`;
|
1059
1096
|
const DATA_API_KEY$6 = '.data-api';
|
1060
1097
|
const ARROW_LEFT_KEY = 'ArrowLeft';
|
1061
1098
|
const ARROW_RIGHT_KEY = 'ArrowRight';
|
1062
1099
|
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
1063
1100
|
|
1064
1101
|
const SWIPE_THRESHOLD = 40;
|
1065
|
-
const Default$
|
1102
|
+
const Default$a = {
|
1066
1103
|
interval: 5000,
|
1067
1104
|
keyboard: true,
|
1068
1105
|
slide: false,
|
@@ -1070,7 +1107,7 @@
|
|
1070
1107
|
wrap: true,
|
1071
1108
|
touch: true
|
1072
1109
|
};
|
1073
|
-
const DefaultType$
|
1110
|
+
const DefaultType$a = {
|
1074
1111
|
interval: '(number|boolean)',
|
1075
1112
|
keyboard: 'boolean',
|
1076
1113
|
slide: '(boolean|string)',
|
@@ -1082,19 +1119,23 @@
|
|
1082
1119
|
const ORDER_PREV = 'prev';
|
1083
1120
|
const DIRECTION_LEFT = 'left';
|
1084
1121
|
const DIRECTION_RIGHT = 'right';
|
1085
|
-
const
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
const
|
1090
|
-
const
|
1091
|
-
const
|
1092
|
-
const
|
1093
|
-
const
|
1094
|
-
const
|
1095
|
-
const
|
1096
|
-
const
|
1097
|
-
const
|
1122
|
+
const KEY_TO_DIRECTION = {
|
1123
|
+
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
|
1124
|
+
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
|
1125
|
+
};
|
1126
|
+
const EVENT_SLIDE = `slide${EVENT_KEY$a}`;
|
1127
|
+
const EVENT_SLID = `slid${EVENT_KEY$a}`;
|
1128
|
+
const EVENT_KEYDOWN = `keydown${EVENT_KEY$a}`;
|
1129
|
+
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$a}`;
|
1130
|
+
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$a}`;
|
1131
|
+
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$a}`;
|
1132
|
+
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$a}`;
|
1133
|
+
const EVENT_TOUCHEND = `touchend${EVENT_KEY$a}`;
|
1134
|
+
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$a}`;
|
1135
|
+
const EVENT_POINTERUP = `pointerup${EVENT_KEY$a}`;
|
1136
|
+
const EVENT_DRAG_START = `dragstart${EVENT_KEY$a}`;
|
1137
|
+
const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
1138
|
+
const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
1098
1139
|
const CLASS_NAME_CAROUSEL = 'carousel';
|
1099
1140
|
const CLASS_NAME_ACTIVE$2 = 'active';
|
1100
1141
|
const CLASS_NAME_SLIDE = 'slide';
|
@@ -1141,18 +1182,16 @@
|
|
1141
1182
|
|
1142
1183
|
|
1143
1184
|
static get Default() {
|
1144
|
-
return Default$
|
1185
|
+
return Default$a;
|
1145
1186
|
}
|
1146
1187
|
|
1147
1188
|
static get NAME() {
|
1148
|
-
return NAME$
|
1189
|
+
return NAME$b;
|
1149
1190
|
} // Public
|
1150
1191
|
|
1151
1192
|
|
1152
1193
|
next() {
|
1153
|
-
|
1154
|
-
this._slide(ORDER_NEXT);
|
1155
|
-
}
|
1194
|
+
this._slide(ORDER_NEXT);
|
1156
1195
|
}
|
1157
1196
|
|
1158
1197
|
nextWhenVisible() {
|
@@ -1164,9 +1203,7 @@
|
|
1164
1203
|
}
|
1165
1204
|
|
1166
1205
|
prev() {
|
1167
|
-
|
1168
|
-
this._slide(ORDER_PREV);
|
1169
|
-
}
|
1206
|
+
this._slide(ORDER_PREV);
|
1170
1207
|
}
|
1171
1208
|
|
1172
1209
|
pause(event) {
|
@@ -1227,10 +1264,11 @@
|
|
1227
1264
|
|
1228
1265
|
|
1229
1266
|
_getConfig(config) {
|
1230
|
-
config = { ...Default$
|
1231
|
-
...
|
1267
|
+
config = { ...Default$a,
|
1268
|
+
...Manipulator.getDataAttributes(this._element),
|
1269
|
+
...(typeof config === 'object' ? config : {})
|
1232
1270
|
};
|
1233
|
-
typeCheckConfig(NAME$
|
1271
|
+
typeCheckConfig(NAME$b, config, DefaultType$a);
|
1234
1272
|
return config;
|
1235
1273
|
}
|
1236
1274
|
|
@@ -1267,8 +1305,12 @@
|
|
1267
1305
|
}
|
1268
1306
|
|
1269
1307
|
_addTouchEventListeners() {
|
1308
|
+
const hasPointerPenTouch = event => {
|
1309
|
+
return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
|
1310
|
+
};
|
1311
|
+
|
1270
1312
|
const start = event => {
|
1271
|
-
if (
|
1313
|
+
if (hasPointerPenTouch(event)) {
|
1272
1314
|
this.touchStartX = event.clientX;
|
1273
1315
|
} else if (!this._pointerEvent) {
|
1274
1316
|
this.touchStartX = event.touches[0].clientX;
|
@@ -1281,7 +1323,7 @@
|
|
1281
1323
|
};
|
1282
1324
|
|
1283
1325
|
const end = event => {
|
1284
|
-
if (
|
1326
|
+
if (hasPointerPenTouch(event)) {
|
1285
1327
|
this.touchDeltaX = event.clientX - this.touchStartX;
|
1286
1328
|
}
|
1287
1329
|
|
@@ -1306,7 +1348,7 @@
|
|
1306
1348
|
};
|
1307
1349
|
|
1308
1350
|
SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
|
1309
|
-
EventHandler.on(itemImg, EVENT_DRAG_START,
|
1351
|
+
EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
|
1310
1352
|
});
|
1311
1353
|
|
1312
1354
|
if (this._pointerEvent) {
|
@@ -1326,14 +1368,12 @@
|
|
1326
1368
|
return;
|
1327
1369
|
}
|
1328
1370
|
|
1329
|
-
|
1330
|
-
event.preventDefault();
|
1371
|
+
const direction = KEY_TO_DIRECTION[event.key];
|
1331
1372
|
|
1332
|
-
|
1333
|
-
} else if (event.key === ARROW_RIGHT_KEY) {
|
1373
|
+
if (direction) {
|
1334
1374
|
event.preventDefault();
|
1335
1375
|
|
1336
|
-
this._slide(
|
1376
|
+
this._slide(direction);
|
1337
1377
|
}
|
1338
1378
|
}
|
1339
1379
|
|
@@ -1344,20 +1384,7 @@
|
|
1344
1384
|
|
1345
1385
|
_getItemByOrder(order, activeElement) {
|
1346
1386
|
const isNext = order === ORDER_NEXT;
|
1347
|
-
|
1348
|
-
|
1349
|
-
const activeIndex = this._getItemIndex(activeElement);
|
1350
|
-
|
1351
|
-
const lastItemIndex = this._items.length - 1;
|
1352
|
-
const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
|
1353
|
-
|
1354
|
-
if (isGoingToWrap && !this._config.wrap) {
|
1355
|
-
return activeElement;
|
1356
|
-
}
|
1357
|
-
|
1358
|
-
const delta = isPrev ? -1 : 1;
|
1359
|
-
const itemIndex = (activeIndex + delta) % this._items.length;
|
1360
|
-
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
1387
|
+
return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
|
1361
1388
|
}
|
1362
1389
|
|
1363
1390
|
_triggerSlideEvent(relatedTarget, eventDirectionName) {
|
@@ -1430,6 +1457,10 @@
|
|
1430
1457
|
return;
|
1431
1458
|
}
|
1432
1459
|
|
1460
|
+
if (this._isSliding) {
|
1461
|
+
return;
|
1462
|
+
}
|
1463
|
+
|
1433
1464
|
const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
1434
1465
|
|
1435
1466
|
if (slideEvent.defaultPrevented) {
|
@@ -1513,10 +1544,10 @@
|
|
1513
1544
|
|
1514
1545
|
|
1515
1546
|
static carouselInterface(element, config) {
|
1516
|
-
|
1517
|
-
let
|
1518
|
-
|
1519
|
-
};
|
1547
|
+
const data = Carousel.getOrCreateInstance(element, config);
|
1548
|
+
let {
|
1549
|
+
_config
|
1550
|
+
} = data;
|
1520
1551
|
|
1521
1552
|
if (typeof config === 'object') {
|
1522
1553
|
_config = { ..._config,
|
@@ -1526,10 +1557,6 @@
|
|
1526
1557
|
|
1527
1558
|
const action = typeof config === 'string' ? config : _config.slide;
|
1528
1559
|
|
1529
|
-
if (!data) {
|
1530
|
-
data = new Carousel(element, _config);
|
1531
|
-
}
|
1532
|
-
|
1533
1560
|
if (typeof config === 'number') {
|
1534
1561
|
data.to(config);
|
1535
1562
|
} else if (typeof action === 'string') {
|
@@ -1569,7 +1596,7 @@
|
|
1569
1596
|
Carousel.carouselInterface(target, config);
|
1570
1597
|
|
1571
1598
|
if (slideIndex) {
|
1572
|
-
|
1599
|
+
Carousel.getInstance(target).to(slideIndex);
|
1573
1600
|
}
|
1574
1601
|
|
1575
1602
|
event.preventDefault();
|
@@ -1588,7 +1615,7 @@
|
|
1588
1615
|
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
1589
1616
|
|
1590
1617
|
for (let i = 0, len = carousels.length; i < len; i++) {
|
1591
|
-
Carousel.carouselInterface(carousels[i],
|
1618
|
+
Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
|
1592
1619
|
}
|
1593
1620
|
});
|
1594
1621
|
/**
|
@@ -1602,7 +1629,7 @@
|
|
1602
1629
|
|
1603
1630
|
/**
|
1604
1631
|
* --------------------------------------------------------------------------
|
1605
|
-
* Bootstrap (v5.
|
1632
|
+
* Bootstrap (v5.1.2): collapse.js
|
1606
1633
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
1607
1634
|
* --------------------------------------------------------------------------
|
1608
1635
|
*/
|
@@ -1612,30 +1639,32 @@
|
|
1612
1639
|
* ------------------------------------------------------------------------
|
1613
1640
|
*/
|
1614
1641
|
|
1615
|
-
const NAME$
|
1616
|
-
const DATA_KEY$
|
1617
|
-
const EVENT_KEY$
|
1642
|
+
const NAME$a = 'collapse';
|
1643
|
+
const DATA_KEY$9 = 'bs.collapse';
|
1644
|
+
const EVENT_KEY$9 = `.${DATA_KEY$9}`;
|
1618
1645
|
const DATA_API_KEY$5 = '.data-api';
|
1619
|
-
const Default$
|
1646
|
+
const Default$9 = {
|
1620
1647
|
toggle: true,
|
1621
|
-
parent:
|
1648
|
+
parent: null
|
1622
1649
|
};
|
1623
|
-
const DefaultType$
|
1650
|
+
const DefaultType$9 = {
|
1624
1651
|
toggle: 'boolean',
|
1625
|
-
parent: '(
|
1652
|
+
parent: '(null|element)'
|
1626
1653
|
};
|
1627
|
-
const EVENT_SHOW$5 = `show${EVENT_KEY$
|
1628
|
-
const EVENT_SHOWN$5 = `shown${EVENT_KEY$
|
1629
|
-
const EVENT_HIDE$5 = `hide${EVENT_KEY$
|
1630
|
-
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$
|
1631
|
-
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$
|
1632
|
-
const CLASS_NAME_SHOW$
|
1654
|
+
const EVENT_SHOW$5 = `show${EVENT_KEY$9}`;
|
1655
|
+
const EVENT_SHOWN$5 = `shown${EVENT_KEY$9}`;
|
1656
|
+
const EVENT_HIDE$5 = `hide${EVENT_KEY$9}`;
|
1657
|
+
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$9}`;
|
1658
|
+
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$9}${DATA_API_KEY$5}`;
|
1659
|
+
const CLASS_NAME_SHOW$7 = 'show';
|
1633
1660
|
const CLASS_NAME_COLLAPSE = 'collapse';
|
1634
1661
|
const CLASS_NAME_COLLAPSING = 'collapsing';
|
1635
1662
|
const CLASS_NAME_COLLAPSED = 'collapsed';
|
1663
|
+
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
1664
|
+
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
1636
1665
|
const WIDTH = 'width';
|
1637
1666
|
const HEIGHT = 'height';
|
1638
|
-
const SELECTOR_ACTIVES = '.show, .collapsing';
|
1667
|
+
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
|
1639
1668
|
const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
|
1640
1669
|
/**
|
1641
1670
|
* ------------------------------------------------------------------------
|
@@ -1648,7 +1677,7 @@
|
|
1648
1677
|
super(element);
|
1649
1678
|
this._isTransitioning = false;
|
1650
1679
|
this._config = this._getConfig(config);
|
1651
|
-
this._triggerArray =
|
1680
|
+
this._triggerArray = [];
|
1652
1681
|
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
|
1653
1682
|
|
1654
1683
|
for (let i = 0, len = toggleList.length; i < len; i++) {
|
@@ -1663,10 +1692,10 @@
|
|
1663
1692
|
}
|
1664
1693
|
}
|
1665
1694
|
|
1666
|
-
this.
|
1695
|
+
this._initializeChildren();
|
1667
1696
|
|
1668
1697
|
if (!this._config.parent) {
|
1669
|
-
this._addAriaAndCollapsedClass(this.
|
1698
|
+
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
1670
1699
|
}
|
1671
1700
|
|
1672
1701
|
if (this._config.toggle) {
|
@@ -1676,16 +1705,16 @@
|
|
1676
1705
|
|
1677
1706
|
|
1678
1707
|
static get Default() {
|
1679
|
-
return Default$
|
1708
|
+
return Default$9;
|
1680
1709
|
}
|
1681
1710
|
|
1682
1711
|
static get NAME() {
|
1683
|
-
return NAME$
|
1712
|
+
return NAME$a;
|
1684
1713
|
} // Public
|
1685
1714
|
|
1686
1715
|
|
1687
1716
|
toggle() {
|
1688
|
-
if (this.
|
1717
|
+
if (this._isShown()) {
|
1689
1718
|
this.hide();
|
1690
1719
|
} else {
|
1691
1720
|
this.show();
|
@@ -1693,32 +1722,23 @@
|
|
1693
1722
|
}
|
1694
1723
|
|
1695
1724
|
show() {
|
1696
|
-
if (this._isTransitioning || this.
|
1725
|
+
if (this._isTransitioning || this._isShown()) {
|
1697
1726
|
return;
|
1698
1727
|
}
|
1699
1728
|
|
1700
|
-
let actives;
|
1729
|
+
let actives = [];
|
1701
1730
|
let activesData;
|
1702
1731
|
|
1703
|
-
if (this.
|
1704
|
-
|
1705
|
-
|
1706
|
-
return elem.getAttribute('data-bs-parent') === this._config.parent;
|
1707
|
-
}
|
1708
|
-
|
1709
|
-
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
1710
|
-
});
|
1711
|
-
|
1712
|
-
if (actives.length === 0) {
|
1713
|
-
actives = null;
|
1714
|
-
}
|
1732
|
+
if (this._config.parent) {
|
1733
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
1734
|
+
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
|
1715
1735
|
}
|
1716
1736
|
|
1717
1737
|
const container = SelectorEngine.findOne(this._selector);
|
1718
1738
|
|
1719
|
-
if (actives) {
|
1739
|
+
if (actives.length) {
|
1720
1740
|
const tempActiveData = actives.find(elem => container !== elem);
|
1721
|
-
activesData = tempActiveData ?
|
1741
|
+
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
|
1722
1742
|
|
1723
1743
|
if (activesData && activesData._isTransitioning) {
|
1724
1744
|
return;
|
@@ -1731,17 +1751,17 @@
|
|
1731
1751
|
return;
|
1732
1752
|
}
|
1733
1753
|
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
}
|
1754
|
+
actives.forEach(elemActive => {
|
1755
|
+
if (container !== elemActive) {
|
1756
|
+
Collapse.getOrCreateInstance(elemActive, {
|
1757
|
+
toggle: false
|
1758
|
+
}).hide();
|
1759
|
+
}
|
1739
1760
|
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
}
|
1761
|
+
if (!activesData) {
|
1762
|
+
Data.set(elemActive, DATA_KEY$9, null);
|
1763
|
+
}
|
1764
|
+
});
|
1745
1765
|
|
1746
1766
|
const dimension = this._getDimension();
|
1747
1767
|
|
@@ -1751,22 +1771,18 @@
|
|
1751
1771
|
|
1752
1772
|
this._element.style[dimension] = 0;
|
1753
1773
|
|
1754
|
-
|
1755
|
-
this._triggerArray.forEach(element => {
|
1756
|
-
element.classList.remove(CLASS_NAME_COLLAPSED);
|
1757
|
-
element.setAttribute('aria-expanded', true);
|
1758
|
-
});
|
1759
|
-
}
|
1774
|
+
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
1760
1775
|
|
1761
|
-
this.
|
1776
|
+
this._isTransitioning = true;
|
1762
1777
|
|
1763
1778
|
const complete = () => {
|
1779
|
+
this._isTransitioning = false;
|
1780
|
+
|
1764
1781
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
1765
1782
|
|
1766
|
-
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
1783
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
|
1767
1784
|
|
1768
1785
|
this._element.style[dimension] = '';
|
1769
|
-
this.setTransitioning(false);
|
1770
1786
|
EventHandler.trigger(this._element, EVENT_SHOWN$5);
|
1771
1787
|
};
|
1772
1788
|
|
@@ -1779,7 +1795,7 @@
|
|
1779
1795
|
}
|
1780
1796
|
|
1781
1797
|
hide() {
|
1782
|
-
if (this._isTransitioning || !this.
|
1798
|
+
if (this._isTransitioning || !this._isShown()) {
|
1783
1799
|
return;
|
1784
1800
|
}
|
1785
1801
|
|
@@ -1796,26 +1812,23 @@
|
|
1796
1812
|
|
1797
1813
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
1798
1814
|
|
1799
|
-
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
1815
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
|
1800
1816
|
|
1801
1817
|
const triggerArrayLength = this._triggerArray.length;
|
1802
1818
|
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
const elem = getElementFromSelector(trigger);
|
1819
|
+
for (let i = 0; i < triggerArrayLength; i++) {
|
1820
|
+
const trigger = this._triggerArray[i];
|
1821
|
+
const elem = getElementFromSelector(trigger);
|
1807
1822
|
|
1808
|
-
|
1809
|
-
|
1810
|
-
trigger.setAttribute('aria-expanded', false);
|
1811
|
-
}
|
1823
|
+
if (elem && !this._isShown(elem)) {
|
1824
|
+
this._addAriaAndCollapsedClass([trigger], false);
|
1812
1825
|
}
|
1813
1826
|
}
|
1814
1827
|
|
1815
|
-
this.
|
1828
|
+
this._isTransitioning = true;
|
1816
1829
|
|
1817
1830
|
const complete = () => {
|
1818
|
-
this.
|
1831
|
+
this._isTransitioning = false;
|
1819
1832
|
|
1820
1833
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
1821
1834
|
|
@@ -1829,45 +1842,47 @@
|
|
1829
1842
|
this._queueCallback(complete, this._element, true);
|
1830
1843
|
}
|
1831
1844
|
|
1832
|
-
|
1833
|
-
|
1845
|
+
_isShown(element = this._element) {
|
1846
|
+
return element.classList.contains(CLASS_NAME_SHOW$7);
|
1834
1847
|
} // Private
|
1835
1848
|
|
1836
1849
|
|
1837
1850
|
_getConfig(config) {
|
1838
|
-
config = { ...Default$
|
1851
|
+
config = { ...Default$9,
|
1852
|
+
...Manipulator.getDataAttributes(this._element),
|
1839
1853
|
...config
|
1840
1854
|
};
|
1841
1855
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
1842
1856
|
|
1843
|
-
|
1857
|
+
config.parent = getElement(config.parent);
|
1858
|
+
typeCheckConfig(NAME$a, config, DefaultType$9);
|
1844
1859
|
return config;
|
1845
1860
|
}
|
1846
1861
|
|
1847
1862
|
_getDimension() {
|
1848
|
-
return this._element.classList.contains(
|
1863
|
+
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
1849
1864
|
}
|
1850
1865
|
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
}
|
1855
|
-
|
1856
|
-
const
|
1857
|
-
SelectorEngine.find(
|
1866
|
+
_initializeChildren() {
|
1867
|
+
if (!this._config.parent) {
|
1868
|
+
return;
|
1869
|
+
}
|
1870
|
+
|
1871
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
1872
|
+
SelectorEngine.find(SELECTOR_DATA_TOGGLE$4, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
|
1858
1873
|
const selected = getElementFromSelector(element);
|
1859
1874
|
|
1860
|
-
|
1875
|
+
if (selected) {
|
1876
|
+
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
1877
|
+
}
|
1861
1878
|
});
|
1862
|
-
return parent;
|
1863
1879
|
}
|
1864
1880
|
|
1865
|
-
_addAriaAndCollapsedClass(
|
1866
|
-
if (!
|
1881
|
+
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
1882
|
+
if (!triggerArray.length) {
|
1867
1883
|
return;
|
1868
1884
|
}
|
1869
1885
|
|
1870
|
-
const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
|
1871
1886
|
triggerArray.forEach(elem => {
|
1872
1887
|
if (isOpen) {
|
1873
1888
|
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
@@ -1880,33 +1895,23 @@
|
|
1880
1895
|
} // Static
|
1881
1896
|
|
1882
1897
|
|
1883
|
-
static
|
1884
|
-
|
1885
|
-
|
1886
|
-
...Manipulator.getDataAttributes(element),
|
1887
|
-
...(typeof config === 'object' && config ? config : {})
|
1888
|
-
};
|
1889
|
-
|
1890
|
-
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
1891
|
-
_config.toggle = false;
|
1892
|
-
}
|
1893
|
-
|
1894
|
-
if (!data) {
|
1895
|
-
data = new Collapse(element, _config);
|
1896
|
-
}
|
1898
|
+
static jQueryInterface(config) {
|
1899
|
+
return this.each(function () {
|
1900
|
+
const _config = {};
|
1897
1901
|
|
1898
|
-
|
1899
|
-
|
1900
|
-
throw new TypeError(`No method named "${config}"`);
|
1902
|
+
if (typeof config === 'string' && /show|hide/.test(config)) {
|
1903
|
+
_config.toggle = false;
|
1901
1904
|
}
|
1902
1905
|
|
1903
|
-
data
|
1904
|
-
}
|
1905
|
-
}
|
1906
|
+
const data = Collapse.getOrCreateInstance(this, _config);
|
1906
1907
|
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1908
|
+
if (typeof config === 'string') {
|
1909
|
+
if (typeof data[config] === 'undefined') {
|
1910
|
+
throw new TypeError(`No method named "${config}"`);
|
1911
|
+
}
|
1912
|
+
|
1913
|
+
data[config]();
|
1914
|
+
}
|
1910
1915
|
});
|
1911
1916
|
}
|
1912
1917
|
|
@@ -1924,26 +1929,12 @@
|
|
1924
1929
|
event.preventDefault();
|
1925
1930
|
}
|
1926
1931
|
|
1927
|
-
const triggerData = Manipulator.getDataAttributes(this);
|
1928
1932
|
const selector = getSelectorFromElement(this);
|
1929
1933
|
const selectorElements = SelectorEngine.find(selector);
|
1930
1934
|
selectorElements.forEach(element => {
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
if (data) {
|
1935
|
-
// update parent attribute
|
1936
|
-
if (data._parent === null && typeof triggerData.parent === 'string') {
|
1937
|
-
data._config.parent = triggerData.parent;
|
1938
|
-
data._parent = data._getParent();
|
1939
|
-
}
|
1940
|
-
|
1941
|
-
config = 'toggle';
|
1942
|
-
} else {
|
1943
|
-
config = triggerData;
|
1944
|
-
}
|
1945
|
-
|
1946
|
-
Collapse.collapseInterface(element, config);
|
1935
|
+
Collapse.getOrCreateInstance(element, {
|
1936
|
+
toggle: false
|
1937
|
+
}).toggle();
|
1947
1938
|
});
|
1948
1939
|
});
|
1949
1940
|
/**
|
@@ -1957,7 +1948,7 @@
|
|
1957
1948
|
|
1958
1949
|
/**
|
1959
1950
|
* --------------------------------------------------------------------------
|
1960
|
-
* Bootstrap (v5.
|
1951
|
+
* Bootstrap (v5.1.2): dropdown.js
|
1961
1952
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
1962
1953
|
* --------------------------------------------------------------------------
|
1963
1954
|
*/
|
@@ -1967,27 +1958,26 @@
|
|
1967
1958
|
* ------------------------------------------------------------------------
|
1968
1959
|
*/
|
1969
1960
|
|
1970
|
-
const NAME$
|
1971
|
-
const DATA_KEY$
|
1972
|
-
const EVENT_KEY$
|
1961
|
+
const NAME$9 = 'dropdown';
|
1962
|
+
const DATA_KEY$8 = 'bs.dropdown';
|
1963
|
+
const EVENT_KEY$8 = `.${DATA_KEY$8}`;
|
1973
1964
|
const DATA_API_KEY$4 = '.data-api';
|
1974
1965
|
const ESCAPE_KEY$2 = 'Escape';
|
1975
1966
|
const SPACE_KEY = 'Space';
|
1976
|
-
const TAB_KEY = 'Tab';
|
1967
|
+
const TAB_KEY$1 = 'Tab';
|
1977
1968
|
const ARROW_UP_KEY = 'ArrowUp';
|
1978
1969
|
const ARROW_DOWN_KEY = 'ArrowDown';
|
1979
1970
|
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
1980
1971
|
|
1981
1972
|
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
|
1982
|
-
const EVENT_HIDE$4 = `hide${EVENT_KEY$
|
1983
|
-
const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$
|
1984
|
-
const EVENT_SHOW$4 = `show${EVENT_KEY$
|
1985
|
-
const EVENT_SHOWN$4 = `shown${EVENT_KEY$
|
1986
|
-
const
|
1987
|
-
const
|
1988
|
-
const
|
1989
|
-
const
|
1990
|
-
const CLASS_NAME_SHOW$7 = 'show';
|
1973
|
+
const EVENT_HIDE$4 = `hide${EVENT_KEY$8}`;
|
1974
|
+
const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
|
1975
|
+
const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
|
1976
|
+
const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
|
1977
|
+
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$8}${DATA_API_KEY$4}`;
|
1978
|
+
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$8}${DATA_API_KEY$4}`;
|
1979
|
+
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$8}${DATA_API_KEY$4}`;
|
1980
|
+
const CLASS_NAME_SHOW$6 = 'show';
|
1991
1981
|
const CLASS_NAME_DROPUP = 'dropup';
|
1992
1982
|
const CLASS_NAME_DROPEND = 'dropend';
|
1993
1983
|
const CLASS_NAME_DROPSTART = 'dropstart';
|
@@ -2002,7 +1992,7 @@
|
|
2002
1992
|
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
2003
1993
|
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
2004
1994
|
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
2005
|
-
const Default$
|
1995
|
+
const Default$8 = {
|
2006
1996
|
offset: [0, 2],
|
2007
1997
|
boundary: 'clippingParents',
|
2008
1998
|
reference: 'toggle',
|
@@ -2010,7 +2000,7 @@
|
|
2010
2000
|
popperConfig: null,
|
2011
2001
|
autoClose: true
|
2012
2002
|
};
|
2013
|
-
const DefaultType$
|
2003
|
+
const DefaultType$8 = {
|
2014
2004
|
offset: '(array|string|function)',
|
2015
2005
|
boundary: '(string|element)',
|
2016
2006
|
reference: '(string|element|object)',
|
@@ -2031,45 +2021,31 @@
|
|
2031
2021
|
this._config = this._getConfig(config);
|
2032
2022
|
this._menu = this._getMenuElement();
|
2033
2023
|
this._inNavbar = this._detectNavbar();
|
2034
|
-
|
2035
|
-
this._addEventListeners();
|
2036
2024
|
} // Getters
|
2037
2025
|
|
2038
2026
|
|
2039
2027
|
static get Default() {
|
2040
|
-
return Default$
|
2028
|
+
return Default$8;
|
2041
2029
|
}
|
2042
2030
|
|
2043
2031
|
static get DefaultType() {
|
2044
|
-
return DefaultType$
|
2032
|
+
return DefaultType$8;
|
2045
2033
|
}
|
2046
2034
|
|
2047
2035
|
static get NAME() {
|
2048
|
-
return NAME$
|
2036
|
+
return NAME$9;
|
2049
2037
|
} // Public
|
2050
2038
|
|
2051
2039
|
|
2052
2040
|
toggle() {
|
2053
|
-
|
2054
|
-
return;
|
2055
|
-
}
|
2056
|
-
|
2057
|
-
const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
|
2058
|
-
|
2059
|
-
if (isActive) {
|
2060
|
-
this.hide();
|
2061
|
-
return;
|
2062
|
-
}
|
2063
|
-
|
2064
|
-
this.show();
|
2041
|
+
return this._isShown() ? this.hide() : this.show();
|
2065
2042
|
}
|
2066
2043
|
|
2067
2044
|
show() {
|
2068
|
-
if (isDisabled(this._element) || this._menu
|
2045
|
+
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
2069
2046
|
return;
|
2070
2047
|
}
|
2071
2048
|
|
2072
|
-
const parent = Dropdown.getParentFromElement(this._element);
|
2073
2049
|
const relatedTarget = {
|
2074
2050
|
relatedTarget: this._element
|
2075
2051
|
};
|
@@ -2077,34 +2053,14 @@
|
|
2077
2053
|
|
2078
2054
|
if (showEvent.defaultPrevented) {
|
2079
2055
|
return;
|
2080
|
-
}
|
2056
|
+
}
|
2081
2057
|
|
2058
|
+
const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
|
2082
2059
|
|
2083
2060
|
if (this._inNavbar) {
|
2084
2061
|
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
|
2085
2062
|
} else {
|
2086
|
-
|
2087
|
-
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
2088
|
-
}
|
2089
|
-
|
2090
|
-
let referenceElement = this._element;
|
2091
|
-
|
2092
|
-
if (this._config.reference === 'parent') {
|
2093
|
-
referenceElement = parent;
|
2094
|
-
} else if (isElement(this._config.reference)) {
|
2095
|
-
referenceElement = getElement(this._config.reference);
|
2096
|
-
} else if (typeof this._config.reference === 'object') {
|
2097
|
-
referenceElement = this._config.reference;
|
2098
|
-
}
|
2099
|
-
|
2100
|
-
const popperConfig = this._getPopperConfig();
|
2101
|
-
|
2102
|
-
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
2103
|
-
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
2104
|
-
|
2105
|
-
if (isDisplayStatic) {
|
2106
|
-
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
|
2107
|
-
}
|
2063
|
+
this._createPopper(parent);
|
2108
2064
|
} // If this is a touch-enabled device we add extra
|
2109
2065
|
// empty mouseover listeners to the body's immediate children;
|
2110
2066
|
// only needed because of broken event delegation on iOS
|
@@ -2119,15 +2075,15 @@
|
|
2119
2075
|
|
2120
2076
|
this._element.setAttribute('aria-expanded', true);
|
2121
2077
|
|
2122
|
-
this._menu.classList.
|
2078
|
+
this._menu.classList.add(CLASS_NAME_SHOW$6);
|
2123
2079
|
|
2124
|
-
this._element.classList.
|
2080
|
+
this._element.classList.add(CLASS_NAME_SHOW$6);
|
2125
2081
|
|
2126
2082
|
EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
|
2127
2083
|
}
|
2128
2084
|
|
2129
2085
|
hide() {
|
2130
|
-
if (isDisabled(this._element) || !this._menu
|
2086
|
+
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
2131
2087
|
return;
|
2132
2088
|
}
|
2133
2089
|
|
@@ -2155,13 +2111,6 @@
|
|
2155
2111
|
} // Private
|
2156
2112
|
|
2157
2113
|
|
2158
|
-
_addEventListeners() {
|
2159
|
-
EventHandler.on(this._element, EVENT_CLICK, event => {
|
2160
|
-
event.preventDefault();
|
2161
|
-
this.toggle();
|
2162
|
-
});
|
2163
|
-
}
|
2164
|
-
|
2165
2114
|
_completeHide(relatedTarget) {
|
2166
2115
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
|
2167
2116
|
|
@@ -2179,9 +2128,9 @@
|
|
2179
2128
|
this._popper.destroy();
|
2180
2129
|
}
|
2181
2130
|
|
2182
|
-
this._menu.classList.remove(CLASS_NAME_SHOW$
|
2131
|
+
this._menu.classList.remove(CLASS_NAME_SHOW$6);
|
2183
2132
|
|
2184
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
2133
|
+
this._element.classList.remove(CLASS_NAME_SHOW$6);
|
2185
2134
|
|
2186
2135
|
this._element.setAttribute('aria-expanded', 'false');
|
2187
2136
|
|
@@ -2194,16 +2143,45 @@
|
|
2194
2143
|
...Manipulator.getDataAttributes(this._element),
|
2195
2144
|
...config
|
2196
2145
|
};
|
2197
|
-
typeCheckConfig(NAME$
|
2146
|
+
typeCheckConfig(NAME$9, config, this.constructor.DefaultType);
|
2198
2147
|
|
2199
2148
|
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
|
2200
2149
|
// Popper virtual elements require a getBoundingClientRect method
|
2201
|
-
throw new TypeError(`${NAME$
|
2150
|
+
throw new TypeError(`${NAME$9.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
2202
2151
|
}
|
2203
2152
|
|
2204
2153
|
return config;
|
2205
2154
|
}
|
2206
2155
|
|
2156
|
+
_createPopper(parent) {
|
2157
|
+
if (typeof Popper__namespace === 'undefined') {
|
2158
|
+
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
2159
|
+
}
|
2160
|
+
|
2161
|
+
let referenceElement = this._element;
|
2162
|
+
|
2163
|
+
if (this._config.reference === 'parent') {
|
2164
|
+
referenceElement = parent;
|
2165
|
+
} else if (isElement(this._config.reference)) {
|
2166
|
+
referenceElement = getElement(this._config.reference);
|
2167
|
+
} else if (typeof this._config.reference === 'object') {
|
2168
|
+
referenceElement = this._config.reference;
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
const popperConfig = this._getPopperConfig();
|
2172
|
+
|
2173
|
+
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
2174
|
+
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
2175
|
+
|
2176
|
+
if (isDisplayStatic) {
|
2177
|
+
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
|
2178
|
+
}
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
_isShown(element = this._element) {
|
2182
|
+
return element.classList.contains(CLASS_NAME_SHOW$6);
|
2183
|
+
}
|
2184
|
+
|
2207
2185
|
_getMenuElement() {
|
2208
2186
|
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
|
2209
2187
|
}
|
@@ -2277,69 +2255,53 @@
|
|
2277
2255
|
};
|
2278
2256
|
}
|
2279
2257
|
|
2280
|
-
_selectMenuItem(
|
2258
|
+
_selectMenuItem({
|
2259
|
+
key,
|
2260
|
+
target
|
2261
|
+
}) {
|
2281
2262
|
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
|
2282
2263
|
|
2283
2264
|
if (!items.length) {
|
2284
2265
|
return;
|
2285
|
-
}
|
2286
|
-
|
2287
|
-
let index = items.indexOf(event.target); // Up
|
2288
|
-
|
2289
|
-
if (event.key === ARROW_UP_KEY && index > 0) {
|
2290
|
-
index--;
|
2291
|
-
} // Down
|
2266
|
+
} // if target isn't included in items (e.g. when expanding the dropdown)
|
2267
|
+
// allow cycling to get the last item in case key equals ARROW_UP_KEY
|
2292
2268
|
|
2293
2269
|
|
2294
|
-
|
2295
|
-
index++;
|
2296
|
-
} // index is -1 if the first keydown is an ArrowUp
|
2297
|
-
|
2298
|
-
|
2299
|
-
index = index === -1 ? 0 : index;
|
2300
|
-
items[index].focus();
|
2270
|
+
getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
|
2301
2271
|
} // Static
|
2302
2272
|
|
2303
2273
|
|
2304
|
-
static
|
2305
|
-
|
2306
|
-
|
2307
|
-
const _config = typeof config === 'object' ? config : null;
|
2274
|
+
static jQueryInterface(config) {
|
2275
|
+
return this.each(function () {
|
2276
|
+
const data = Dropdown.getOrCreateInstance(this, config);
|
2308
2277
|
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2278
|
+
if (typeof config !== 'string') {
|
2279
|
+
return;
|
2280
|
+
}
|
2312
2281
|
|
2313
|
-
if (typeof config === 'string') {
|
2314
2282
|
if (typeof data[config] === 'undefined') {
|
2315
2283
|
throw new TypeError(`No method named "${config}"`);
|
2316
2284
|
}
|
2317
2285
|
|
2318
2286
|
data[config]();
|
2319
|
-
}
|
2320
|
-
}
|
2321
|
-
|
2322
|
-
static jQueryInterface(config) {
|
2323
|
-
return this.each(function () {
|
2324
|
-
Dropdown.dropdownInterface(this, config);
|
2325
2287
|
});
|
2326
2288
|
}
|
2327
2289
|
|
2328
2290
|
static clearMenus(event) {
|
2329
|
-
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
|
2291
|
+
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
|
2330
2292
|
return;
|
2331
2293
|
}
|
2332
2294
|
|
2333
2295
|
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
|
2334
2296
|
|
2335
2297
|
for (let i = 0, len = toggles.length; i < len; i++) {
|
2336
|
-
const context =
|
2298
|
+
const context = Dropdown.getInstance(toggles[i]);
|
2337
2299
|
|
2338
2300
|
if (!context || context._config.autoClose === false) {
|
2339
2301
|
continue;
|
2340
2302
|
}
|
2341
2303
|
|
2342
|
-
if (!context.
|
2304
|
+
if (!context._isShown()) {
|
2343
2305
|
continue;
|
2344
2306
|
}
|
2345
2307
|
|
@@ -2356,7 +2318,7 @@
|
|
2356
2318
|
} // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
|
2357
2319
|
|
2358
2320
|
|
2359
|
-
if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
2321
|
+
if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
2360
2322
|
continue;
|
2361
2323
|
}
|
2362
2324
|
|
@@ -2385,7 +2347,7 @@
|
|
2385
2347
|
return;
|
2386
2348
|
}
|
2387
2349
|
|
2388
|
-
const isActive = this.classList.contains(CLASS_NAME_SHOW$
|
2350
|
+
const isActive = this.classList.contains(CLASS_NAME_SHOW$6);
|
2389
2351
|
|
2390
2352
|
if (!isActive && event.key === ESCAPE_KEY$2) {
|
2391
2353
|
return;
|
@@ -2398,25 +2360,27 @@
|
|
2398
2360
|
return;
|
2399
2361
|
}
|
2400
2362
|
|
2401
|
-
const getToggleButton =
|
2363
|
+
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
|
2364
|
+
const instance = Dropdown.getOrCreateInstance(getToggleButton);
|
2402
2365
|
|
2403
2366
|
if (event.key === ESCAPE_KEY$2) {
|
2404
|
-
|
2405
|
-
Dropdown.clearMenus();
|
2367
|
+
instance.hide();
|
2406
2368
|
return;
|
2407
2369
|
}
|
2408
2370
|
|
2409
|
-
if (
|
2410
|
-
|
2371
|
+
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
2372
|
+
if (!isActive) {
|
2373
|
+
instance.show();
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
instance._selectMenuItem(event);
|
2377
|
+
|
2411
2378
|
return;
|
2412
2379
|
}
|
2413
2380
|
|
2414
2381
|
if (!isActive || event.key === SPACE_KEY) {
|
2415
2382
|
Dropdown.clearMenus();
|
2416
|
-
return;
|
2417
2383
|
}
|
2418
|
-
|
2419
|
-
Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
|
2420
2384
|
}
|
2421
2385
|
|
2422
2386
|
}
|
@@ -2433,7 +2397,7 @@
|
|
2433
2397
|
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
2434
2398
|
EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
|
2435
2399
|
event.preventDefault();
|
2436
|
-
Dropdown.
|
2400
|
+
Dropdown.getOrCreateInstance(this).toggle();
|
2437
2401
|
});
|
2438
2402
|
/**
|
2439
2403
|
* ------------------------------------------------------------------------
|
@@ -2446,103 +2410,134 @@
|
|
2446
2410
|
|
2447
2411
|
/**
|
2448
2412
|
* --------------------------------------------------------------------------
|
2449
|
-
* Bootstrap (v5.
|
2413
|
+
* Bootstrap (v5.1.2): util/scrollBar.js
|
2450
2414
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
2451
2415
|
* --------------------------------------------------------------------------
|
2452
2416
|
*/
|
2453
2417
|
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
2454
2418
|
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
2455
2419
|
|
2456
|
-
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2420
|
+
class ScrollBarHelper {
|
2421
|
+
constructor() {
|
2422
|
+
this._element = document.body;
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
getWidth() {
|
2426
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
2427
|
+
const documentWidth = document.documentElement.clientWidth;
|
2428
|
+
return Math.abs(window.innerWidth - documentWidth);
|
2429
|
+
}
|
2430
|
+
|
2431
|
+
hide() {
|
2432
|
+
const width = this.getWidth();
|
2433
|
+
|
2434
|
+
this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
|
2435
|
+
|
2436
|
+
|
2437
|
+
this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
|
2438
|
+
|
2439
|
+
|
2440
|
+
this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
|
2461
2441
|
|
2462
|
-
|
2463
|
-
|
2442
|
+
this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
|
2443
|
+
}
|
2464
2444
|
|
2445
|
+
_disableOverFlow() {
|
2446
|
+
this._saveInitialAttribute(this._element, 'overflow');
|
2465
2447
|
|
2466
|
-
|
2448
|
+
this._element.style.overflow = 'hidden';
|
2449
|
+
}
|
2467
2450
|
|
2451
|
+
_setElementAttributes(selector, styleProp, callback) {
|
2452
|
+
const scrollbarWidth = this.getWidth();
|
2468
2453
|
|
2469
|
-
|
2454
|
+
const manipulationCallBack = element => {
|
2455
|
+
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
2456
|
+
return;
|
2457
|
+
}
|
2470
2458
|
|
2471
|
-
|
2472
|
-
};
|
2459
|
+
this._saveInitialAttribute(element, styleProp);
|
2473
2460
|
|
2474
|
-
|
2475
|
-
|
2461
|
+
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
2462
|
+
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
|
2463
|
+
};
|
2476
2464
|
|
2477
|
-
|
2478
|
-
Manipulator.setDataAttribute(document.body, 'overflow', actualValue);
|
2465
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
2479
2466
|
}
|
2480
2467
|
|
2481
|
-
|
2482
|
-
|
2468
|
+
reset() {
|
2469
|
+
this._resetElementAttributes(this._element, 'overflow');
|
2483
2470
|
|
2484
|
-
|
2485
|
-
const scrollbarWidth = getWidth();
|
2486
|
-
SelectorEngine.find(selector).forEach(element => {
|
2487
|
-
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
2488
|
-
return;
|
2489
|
-
}
|
2471
|
+
this._resetElementAttributes(this._element, 'paddingRight');
|
2490
2472
|
|
2491
|
-
|
2492
|
-
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
2493
|
-
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
2494
|
-
element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
|
2495
|
-
});
|
2496
|
-
};
|
2473
|
+
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
|
2497
2474
|
|
2498
|
-
|
2499
|
-
|
2475
|
+
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
|
2476
|
+
}
|
2477
|
+
|
2478
|
+
_saveInitialAttribute(element, styleProp) {
|
2479
|
+
const actualValue = element.style[styleProp];
|
2500
2480
|
|
2501
|
-
|
2481
|
+
if (actualValue) {
|
2482
|
+
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
2483
|
+
}
|
2484
|
+
}
|
2502
2485
|
|
2503
|
-
_resetElementAttributes(
|
2486
|
+
_resetElementAttributes(selector, styleProp) {
|
2487
|
+
const manipulationCallBack = element => {
|
2488
|
+
const value = Manipulator.getDataAttribute(element, styleProp);
|
2504
2489
|
|
2505
|
-
|
2506
|
-
|
2490
|
+
if (typeof value === 'undefined') {
|
2491
|
+
element.style.removeProperty(styleProp);
|
2492
|
+
} else {
|
2493
|
+
Manipulator.removeDataAttribute(element, styleProp);
|
2494
|
+
element.style[styleProp] = value;
|
2495
|
+
}
|
2496
|
+
};
|
2507
2497
|
|
2508
|
-
|
2509
|
-
|
2510
|
-
const value = Manipulator.getDataAttribute(element, styleProp);
|
2498
|
+
this._applyManipulationCallback(selector, manipulationCallBack);
|
2499
|
+
}
|
2511
2500
|
|
2512
|
-
|
2513
|
-
|
2501
|
+
_applyManipulationCallback(selector, callBack) {
|
2502
|
+
if (isElement(selector)) {
|
2503
|
+
callBack(selector);
|
2514
2504
|
} else {
|
2515
|
-
|
2516
|
-
element.style[styleProp] = value;
|
2505
|
+
SelectorEngine.find(selector, this._element).forEach(callBack);
|
2517
2506
|
}
|
2518
|
-
}
|
2519
|
-
|
2507
|
+
}
|
2508
|
+
|
2509
|
+
isOverflowing() {
|
2510
|
+
return this.getWidth() > 0;
|
2511
|
+
}
|
2512
|
+
|
2513
|
+
}
|
2520
2514
|
|
2521
2515
|
/**
|
2522
2516
|
* --------------------------------------------------------------------------
|
2523
|
-
* Bootstrap (v5.
|
2524
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/
|
2517
|
+
* Bootstrap (v5.1.2): util/backdrop.js
|
2518
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
2525
2519
|
* --------------------------------------------------------------------------
|
2526
2520
|
*/
|
2527
|
-
const Default$
|
2521
|
+
const Default$7 = {
|
2522
|
+
className: 'modal-backdrop',
|
2528
2523
|
isVisible: true,
|
2529
2524
|
// if false, we use the backdrop helper without adding any element to the dom
|
2530
2525
|
isAnimated: false,
|
2531
|
-
rootElement:
|
2526
|
+
rootElement: 'body',
|
2532
2527
|
// give the choice to place backdrop under different elements
|
2533
2528
|
clickCallback: null
|
2534
2529
|
};
|
2535
|
-
const DefaultType$
|
2530
|
+
const DefaultType$7 = {
|
2531
|
+
className: 'string',
|
2536
2532
|
isVisible: 'boolean',
|
2537
2533
|
isAnimated: 'boolean',
|
2538
|
-
rootElement: 'element',
|
2534
|
+
rootElement: '(element|string)',
|
2539
2535
|
clickCallback: '(function|null)'
|
2540
2536
|
};
|
2541
|
-
const NAME$
|
2542
|
-
const
|
2543
|
-
const
|
2544
|
-
const
|
2545
|
-
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
|
2537
|
+
const NAME$8 = 'backdrop';
|
2538
|
+
const CLASS_NAME_FADE$4 = 'fade';
|
2539
|
+
const CLASS_NAME_SHOW$5 = 'show';
|
2540
|
+
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$8}`;
|
2546
2541
|
|
2547
2542
|
class Backdrop {
|
2548
2543
|
constructor(config) {
|
@@ -2563,7 +2558,7 @@
|
|
2563
2558
|
reflow(this._getElement());
|
2564
2559
|
}
|
2565
2560
|
|
2566
|
-
this._getElement().classList.add(CLASS_NAME_SHOW$
|
2561
|
+
this._getElement().classList.add(CLASS_NAME_SHOW$5);
|
2567
2562
|
|
2568
2563
|
this._emulateAnimation(() => {
|
2569
2564
|
execute(callback);
|
@@ -2576,7 +2571,7 @@
|
|
2576
2571
|
return;
|
2577
2572
|
}
|
2578
2573
|
|
2579
|
-
this._getElement().classList.remove(CLASS_NAME_SHOW$
|
2574
|
+
this._getElement().classList.remove(CLASS_NAME_SHOW$5);
|
2580
2575
|
|
2581
2576
|
this._emulateAnimation(() => {
|
2582
2577
|
this.dispose();
|
@@ -2588,10 +2583,10 @@
|
|
2588
2583
|
_getElement() {
|
2589
2584
|
if (!this._element) {
|
2590
2585
|
const backdrop = document.createElement('div');
|
2591
|
-
backdrop.className =
|
2586
|
+
backdrop.className = this._config.className;
|
2592
2587
|
|
2593
2588
|
if (this._config.isAnimated) {
|
2594
|
-
backdrop.classList.add(CLASS_NAME_FADE$
|
2589
|
+
backdrop.classList.add(CLASS_NAME_FADE$4);
|
2595
2590
|
}
|
2596
2591
|
|
2597
2592
|
this._element = backdrop;
|
@@ -2601,11 +2596,12 @@
|
|
2601
2596
|
}
|
2602
2597
|
|
2603
2598
|
_getConfig(config) {
|
2604
|
-
config = { ...Default$
|
2599
|
+
config = { ...Default$7,
|
2605
2600
|
...(typeof config === 'object' ? config : {})
|
2606
|
-
};
|
2607
|
-
|
2608
|
-
|
2601
|
+
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
|
2602
|
+
|
2603
|
+
config.rootElement = getElement(config.rootElement);
|
2604
|
+
typeCheckConfig(NAME$8, config, DefaultType$7);
|
2609
2605
|
return config;
|
2610
2606
|
}
|
2611
2607
|
|
@@ -2614,7 +2610,7 @@
|
|
2614
2610
|
return;
|
2615
2611
|
}
|
2616
2612
|
|
2617
|
-
this._config.rootElement.
|
2613
|
+
this._config.rootElement.append(this._getElement());
|
2618
2614
|
|
2619
2615
|
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
|
2620
2616
|
execute(this._config.clickCallback);
|
@@ -2629,27 +2625,123 @@
|
|
2629
2625
|
|
2630
2626
|
EventHandler.off(this._element, EVENT_MOUSEDOWN);
|
2631
2627
|
|
2632
|
-
this.
|
2628
|
+
this._element.remove();
|
2633
2629
|
|
2634
2630
|
this._isAppended = false;
|
2635
2631
|
}
|
2636
2632
|
|
2637
2633
|
_emulateAnimation(callback) {
|
2638
|
-
|
2639
|
-
|
2634
|
+
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
|
2635
|
+
}
|
2636
|
+
|
2637
|
+
}
|
2638
|
+
|
2639
|
+
/**
|
2640
|
+
* --------------------------------------------------------------------------
|
2641
|
+
* Bootstrap (v5.1.2): util/focustrap.js
|
2642
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
2643
|
+
* --------------------------------------------------------------------------
|
2644
|
+
*/
|
2645
|
+
const Default$6 = {
|
2646
|
+
trapElement: null,
|
2647
|
+
// The element to trap focus inside of
|
2648
|
+
autofocus: true
|
2649
|
+
};
|
2650
|
+
const DefaultType$6 = {
|
2651
|
+
trapElement: 'element',
|
2652
|
+
autofocus: 'boolean'
|
2653
|
+
};
|
2654
|
+
const NAME$7 = 'focustrap';
|
2655
|
+
const DATA_KEY$7 = 'bs.focustrap';
|
2656
|
+
const EVENT_KEY$7 = `.${DATA_KEY$7}`;
|
2657
|
+
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$7}`;
|
2658
|
+
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$7}`;
|
2659
|
+
const TAB_KEY = 'Tab';
|
2660
|
+
const TAB_NAV_FORWARD = 'forward';
|
2661
|
+
const TAB_NAV_BACKWARD = 'backward';
|
2662
|
+
|
2663
|
+
class FocusTrap {
|
2664
|
+
constructor(config) {
|
2665
|
+
this._config = this._getConfig(config);
|
2666
|
+
this._isActive = false;
|
2667
|
+
this._lastTabNavDirection = null;
|
2668
|
+
}
|
2669
|
+
|
2670
|
+
activate() {
|
2671
|
+
const {
|
2672
|
+
trapElement,
|
2673
|
+
autofocus
|
2674
|
+
} = this._config;
|
2675
|
+
|
2676
|
+
if (this._isActive) {
|
2677
|
+
return;
|
2678
|
+
}
|
2679
|
+
|
2680
|
+
if (autofocus) {
|
2681
|
+
trapElement.focus();
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
EventHandler.off(document, EVENT_KEY$7); // guard against infinite focus loop
|
2685
|
+
|
2686
|
+
EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
|
2687
|
+
EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
2688
|
+
this._isActive = true;
|
2689
|
+
}
|
2690
|
+
|
2691
|
+
deactivate() {
|
2692
|
+
if (!this._isActive) {
|
2693
|
+
return;
|
2694
|
+
}
|
2695
|
+
|
2696
|
+
this._isActive = false;
|
2697
|
+
EventHandler.off(document, EVENT_KEY$7);
|
2698
|
+
} // Private
|
2699
|
+
|
2700
|
+
|
2701
|
+
_handleFocusin(event) {
|
2702
|
+
const {
|
2703
|
+
target
|
2704
|
+
} = event;
|
2705
|
+
const {
|
2706
|
+
trapElement
|
2707
|
+
} = this._config;
|
2708
|
+
|
2709
|
+
if (target === document || target === trapElement || trapElement.contains(target)) {
|
2710
|
+
return;
|
2711
|
+
}
|
2712
|
+
|
2713
|
+
const elements = SelectorEngine.focusableChildren(trapElement);
|
2714
|
+
|
2715
|
+
if (elements.length === 0) {
|
2716
|
+
trapElement.focus();
|
2717
|
+
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
2718
|
+
elements[elements.length - 1].focus();
|
2719
|
+
} else {
|
2720
|
+
elements[0].focus();
|
2721
|
+
}
|
2722
|
+
}
|
2723
|
+
|
2724
|
+
_handleKeydown(event) {
|
2725
|
+
if (event.key !== TAB_KEY) {
|
2640
2726
|
return;
|
2641
2727
|
}
|
2642
2728
|
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2729
|
+
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
2730
|
+
}
|
2731
|
+
|
2732
|
+
_getConfig(config) {
|
2733
|
+
config = { ...Default$6,
|
2734
|
+
...(typeof config === 'object' ? config : {})
|
2735
|
+
};
|
2736
|
+
typeCheckConfig(NAME$7, config, DefaultType$6);
|
2737
|
+
return config;
|
2646
2738
|
}
|
2647
2739
|
|
2648
2740
|
}
|
2649
2741
|
|
2650
2742
|
/**
|
2651
2743
|
* --------------------------------------------------------------------------
|
2652
|
-
* Bootstrap (v5.
|
2744
|
+
* Bootstrap (v5.1.2): modal.js
|
2653
2745
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
2654
2746
|
* --------------------------------------------------------------------------
|
2655
2747
|
*/
|
@@ -2679,21 +2771,20 @@
|
|
2679
2771
|
const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
|
2680
2772
|
const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
|
2681
2773
|
const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
|
2682
|
-
const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
|
2683
2774
|
const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
|
2684
|
-
const EVENT_CLICK_DISMISS
|
2775
|
+
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$6}`;
|
2685
2776
|
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
|
2686
2777
|
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
|
2687
2778
|
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
|
2688
2779
|
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
|
2689
2780
|
const CLASS_NAME_OPEN = 'modal-open';
|
2690
|
-
const CLASS_NAME_FADE$
|
2691
|
-
const CLASS_NAME_SHOW$
|
2781
|
+
const CLASS_NAME_FADE$3 = 'fade';
|
2782
|
+
const CLASS_NAME_SHOW$4 = 'show';
|
2692
2783
|
const CLASS_NAME_STATIC = 'modal-static';
|
2784
|
+
const OPEN_SELECTOR$1 = '.modal.show';
|
2693
2785
|
const SELECTOR_DIALOG = '.modal-dialog';
|
2694
2786
|
const SELECTOR_MODAL_BODY = '.modal-body';
|
2695
2787
|
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
|
2696
|
-
const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
|
2697
2788
|
/**
|
2698
2789
|
* ------------------------------------------------------------------------
|
2699
2790
|
* Class Definition
|
@@ -2706,9 +2797,11 @@
|
|
2706
2797
|
this._config = this._getConfig(config);
|
2707
2798
|
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
|
2708
2799
|
this._backdrop = this._initializeBackDrop();
|
2800
|
+
this._focustrap = this._initializeFocusTrap();
|
2709
2801
|
this._isShown = false;
|
2710
2802
|
this._ignoreBackdropClick = false;
|
2711
2803
|
this._isTransitioning = false;
|
2804
|
+
this._scrollBar = new ScrollBarHelper();
|
2712
2805
|
} // Getters
|
2713
2806
|
|
2714
2807
|
|
@@ -2730,20 +2823,22 @@
|
|
2730
2823
|
return;
|
2731
2824
|
}
|
2732
2825
|
|
2733
|
-
if (this._isAnimated()) {
|
2734
|
-
this._isTransitioning = true;
|
2735
|
-
}
|
2736
|
-
|
2737
2826
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
|
2738
2827
|
relatedTarget
|
2739
2828
|
});
|
2740
2829
|
|
2741
|
-
if (
|
2830
|
+
if (showEvent.defaultPrevented) {
|
2742
2831
|
return;
|
2743
2832
|
}
|
2744
2833
|
|
2745
2834
|
this._isShown = true;
|
2746
|
-
|
2835
|
+
|
2836
|
+
if (this._isAnimated()) {
|
2837
|
+
this._isTransitioning = true;
|
2838
|
+
}
|
2839
|
+
|
2840
|
+
this._scrollBar.hide();
|
2841
|
+
|
2747
2842
|
document.body.classList.add(CLASS_NAME_OPEN);
|
2748
2843
|
|
2749
2844
|
this._adjustDialog();
|
@@ -2752,7 +2847,6 @@
|
|
2752
2847
|
|
2753
2848
|
this._setResizeEvent();
|
2754
2849
|
|
2755
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
|
2756
2850
|
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
2757
2851
|
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
2758
2852
|
if (event.target === this._element) {
|
@@ -2764,11 +2858,7 @@
|
|
2764
2858
|
this._showBackdrop(() => this._showElement(relatedTarget));
|
2765
2859
|
}
|
2766
2860
|
|
2767
|
-
hide(
|
2768
|
-
if (event) {
|
2769
|
-
event.preventDefault();
|
2770
|
-
}
|
2771
|
-
|
2861
|
+
hide() {
|
2772
2862
|
if (!this._isShown || this._isTransitioning) {
|
2773
2863
|
return;
|
2774
2864
|
}
|
@@ -2791,11 +2881,11 @@
|
|
2791
2881
|
|
2792
2882
|
this._setResizeEvent();
|
2793
2883
|
|
2794
|
-
|
2884
|
+
this._focustrap.deactivate();
|
2795
2885
|
|
2796
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
2886
|
+
this._element.classList.remove(CLASS_NAME_SHOW$4);
|
2797
2887
|
|
2798
|
-
EventHandler.off(this._element, EVENT_CLICK_DISMISS
|
2888
|
+
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
2799
2889
|
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
2800
2890
|
|
2801
2891
|
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
|
@@ -2806,14 +2896,9 @@
|
|
2806
2896
|
|
2807
2897
|
this._backdrop.dispose();
|
2808
2898
|
|
2809
|
-
|
2810
|
-
/**
|
2811
|
-
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
2812
|
-
* Do not move `document` in `htmlElements` array
|
2813
|
-
* It will remove `EVENT_CLICK_DATA_API` event that should remain
|
2814
|
-
*/
|
2899
|
+
this._focustrap.deactivate();
|
2815
2900
|
|
2816
|
-
|
2901
|
+
super.dispose();
|
2817
2902
|
}
|
2818
2903
|
|
2819
2904
|
handleUpdate() {
|
@@ -2829,10 +2914,16 @@
|
|
2829
2914
|
});
|
2830
2915
|
}
|
2831
2916
|
|
2917
|
+
_initializeFocusTrap() {
|
2918
|
+
return new FocusTrap({
|
2919
|
+
trapElement: this._element
|
2920
|
+
});
|
2921
|
+
}
|
2922
|
+
|
2832
2923
|
_getConfig(config) {
|
2833
2924
|
config = { ...Default$5,
|
2834
2925
|
...Manipulator.getDataAttributes(this._element),
|
2835
|
-
...config
|
2926
|
+
...(typeof config === 'object' ? config : {})
|
2836
2927
|
};
|
2837
2928
|
typeCheckConfig(NAME$6, config, DefaultType$5);
|
2838
2929
|
return config;
|
@@ -2845,7 +2936,7 @@
|
|
2845
2936
|
|
2846
2937
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
2847
2938
|
// Don't move modal's DOM position
|
2848
|
-
document.body.
|
2939
|
+
document.body.append(this._element);
|
2849
2940
|
}
|
2850
2941
|
|
2851
2942
|
this._element.style.display = 'block';
|
@@ -2866,15 +2957,11 @@
|
|
2866
2957
|
reflow(this._element);
|
2867
2958
|
}
|
2868
2959
|
|
2869
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
2870
|
-
|
2871
|
-
if (this._config.focus) {
|
2872
|
-
this._enforceFocus();
|
2873
|
-
}
|
2960
|
+
this._element.classList.add(CLASS_NAME_SHOW$4);
|
2874
2961
|
|
2875
2962
|
const transitionComplete = () => {
|
2876
2963
|
if (this._config.focus) {
|
2877
|
-
this.
|
2964
|
+
this._focustrap.activate();
|
2878
2965
|
}
|
2879
2966
|
|
2880
2967
|
this._isTransitioning = false;
|
@@ -2886,16 +2973,6 @@
|
|
2886
2973
|
this._queueCallback(transitionComplete, this._dialog, isAnimated);
|
2887
2974
|
}
|
2888
2975
|
|
2889
|
-
_enforceFocus() {
|
2890
|
-
EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop
|
2891
|
-
|
2892
|
-
EventHandler.on(document, EVENT_FOCUSIN$2, event => {
|
2893
|
-
if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
|
2894
|
-
this._element.focus();
|
2895
|
-
}
|
2896
|
-
});
|
2897
|
-
}
|
2898
|
-
|
2899
2976
|
_setEscapeEvent() {
|
2900
2977
|
if (this._isShown) {
|
2901
2978
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
|
@@ -2935,13 +3012,14 @@
|
|
2935
3012
|
|
2936
3013
|
this._resetAdjustments();
|
2937
3014
|
|
2938
|
-
reset();
|
3015
|
+
this._scrollBar.reset();
|
3016
|
+
|
2939
3017
|
EventHandler.trigger(this._element, EVENT_HIDDEN$3);
|
2940
3018
|
});
|
2941
3019
|
}
|
2942
3020
|
|
2943
3021
|
_showBackdrop(callback) {
|
2944
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS
|
3022
|
+
EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
|
2945
3023
|
if (this._ignoreBackdropClick) {
|
2946
3024
|
this._ignoreBackdropClick = false;
|
2947
3025
|
return;
|
@@ -2962,7 +3040,7 @@
|
|
2962
3040
|
}
|
2963
3041
|
|
2964
3042
|
_isAnimated() {
|
2965
|
-
return this._element.classList.contains(CLASS_NAME_FADE$
|
3043
|
+
return this._element.classList.contains(CLASS_NAME_FADE$3);
|
2966
3044
|
}
|
2967
3045
|
|
2968
3046
|
_triggerBackdropTransition() {
|
@@ -2972,27 +3050,32 @@
|
|
2972
3050
|
return;
|
2973
3051
|
}
|
2974
3052
|
|
2975
|
-
const
|
3053
|
+
const {
|
3054
|
+
classList,
|
3055
|
+
scrollHeight,
|
3056
|
+
style
|
3057
|
+
} = this._element;
|
3058
|
+
const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
|
3059
|
+
|
3060
|
+
if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
|
3061
|
+
return;
|
3062
|
+
}
|
2976
3063
|
|
2977
3064
|
if (!isModalOverflowing) {
|
2978
|
-
|
3065
|
+
style.overflowY = 'hidden';
|
2979
3066
|
}
|
2980
3067
|
|
2981
|
-
|
3068
|
+
classList.add(CLASS_NAME_STATIC);
|
2982
3069
|
|
2983
|
-
|
2984
|
-
|
2985
|
-
EventHandler.one(this._element, 'transitionend', () => {
|
2986
|
-
this._element.classList.remove(CLASS_NAME_STATIC);
|
3070
|
+
this._queueCallback(() => {
|
3071
|
+
classList.remove(CLASS_NAME_STATIC);
|
2987
3072
|
|
2988
3073
|
if (!isModalOverflowing) {
|
2989
|
-
|
2990
|
-
|
2991
|
-
});
|
2992
|
-
emulateTransitionEnd(this._element, modalTransitionDuration);
|
3074
|
+
this._queueCallback(() => {
|
3075
|
+
style.overflowY = '';
|
3076
|
+
}, this._dialog);
|
2993
3077
|
}
|
2994
|
-
});
|
2995
|
-
emulateTransitionEnd(this._element, modalTransitionDuration);
|
3078
|
+
}, this._dialog);
|
2996
3079
|
|
2997
3080
|
this._element.focus();
|
2998
3081
|
} // ----------------------------------------------------------------------
|
@@ -3002,7 +3085,9 @@
|
|
3002
3085
|
|
3003
3086
|
_adjustDialog() {
|
3004
3087
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
3005
|
-
|
3088
|
+
|
3089
|
+
const scrollbarWidth = this._scrollBar.getWidth();
|
3090
|
+
|
3006
3091
|
const isBodyOverflowing = scrollbarWidth > 0;
|
3007
3092
|
|
3008
3093
|
if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
|
@@ -3022,7 +3107,7 @@
|
|
3022
3107
|
|
3023
3108
|
static jQueryInterface(config, relatedTarget) {
|
3024
3109
|
return this.each(function () {
|
3025
|
-
const data = Modal.
|
3110
|
+
const data = Modal.getOrCreateInstance(this, config);
|
3026
3111
|
|
3027
3112
|
if (typeof config !== 'string') {
|
3028
3113
|
return;
|
@@ -3062,10 +3147,18 @@
|
|
3062
3147
|
this.focus();
|
3063
3148
|
}
|
3064
3149
|
});
|
3065
|
-
});
|
3066
|
-
|
3150
|
+
}); // avoid conflict when clicking moddal toggler while another one is open
|
3151
|
+
|
3152
|
+
const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
|
3153
|
+
|
3154
|
+
if (allReadyOpen) {
|
3155
|
+
Modal.getInstance(allReadyOpen).hide();
|
3156
|
+
}
|
3157
|
+
|
3158
|
+
const data = Modal.getOrCreateInstance(target);
|
3067
3159
|
data.toggle(this);
|
3068
3160
|
});
|
3161
|
+
enableDismissTrigger(Modal);
|
3069
3162
|
/**
|
3070
3163
|
* ------------------------------------------------------------------------
|
3071
3164
|
* jQuery
|
@@ -3077,8 +3170,8 @@
|
|
3077
3170
|
|
3078
3171
|
/**
|
3079
3172
|
* --------------------------------------------------------------------------
|
3080
|
-
* Bootstrap (v5.
|
3081
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/
|
3173
|
+
* Bootstrap (v5.1.2): offcanvas.js
|
3174
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
3082
3175
|
* --------------------------------------------------------------------------
|
3083
3176
|
*/
|
3084
3177
|
/**
|
@@ -3103,17 +3196,15 @@
|
|
3103
3196
|
keyboard: 'boolean',
|
3104
3197
|
scroll: 'boolean'
|
3105
3198
|
};
|
3106
|
-
const CLASS_NAME_SHOW$
|
3199
|
+
const CLASS_NAME_SHOW$3 = 'show';
|
3200
|
+
const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
|
3107
3201
|
const OPEN_SELECTOR = '.offcanvas.show';
|
3108
3202
|
const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
|
3109
3203
|
const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
|
3110
3204
|
const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
|
3111
3205
|
const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
|
3112
|
-
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
|
3113
3206
|
const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
|
3114
|
-
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
|
3115
3207
|
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
|
3116
|
-
const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
|
3117
3208
|
const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
|
3118
3209
|
/**
|
3119
3210
|
* ------------------------------------------------------------------------
|
@@ -3127,6 +3218,7 @@
|
|
3127
3218
|
this._config = this._getConfig(config);
|
3128
3219
|
this._isShown = false;
|
3129
3220
|
this._backdrop = this._initializeBackDrop();
|
3221
|
+
this._focustrap = this._initializeFocusTrap();
|
3130
3222
|
|
3131
3223
|
this._addEventListeners();
|
3132
3224
|
} // Getters
|
@@ -3164,9 +3256,7 @@
|
|
3164
3256
|
this._backdrop.show();
|
3165
3257
|
|
3166
3258
|
if (!this._config.scroll) {
|
3167
|
-
hide();
|
3168
|
-
|
3169
|
-
this._enforceFocusOnElement(this._element);
|
3259
|
+
new ScrollBarHelper().hide();
|
3170
3260
|
}
|
3171
3261
|
|
3172
3262
|
this._element.removeAttribute('aria-hidden');
|
@@ -3175,9 +3265,13 @@
|
|
3175
3265
|
|
3176
3266
|
this._element.setAttribute('role', 'dialog');
|
3177
3267
|
|
3178
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
3268
|
+
this._element.classList.add(CLASS_NAME_SHOW$3);
|
3179
3269
|
|
3180
3270
|
const completeCallBack = () => {
|
3271
|
+
if (!this._config.scroll) {
|
3272
|
+
this._focustrap.activate();
|
3273
|
+
}
|
3274
|
+
|
3181
3275
|
EventHandler.trigger(this._element, EVENT_SHOWN$2, {
|
3182
3276
|
relatedTarget
|
3183
3277
|
});
|
@@ -3197,13 +3291,13 @@
|
|
3197
3291
|
return;
|
3198
3292
|
}
|
3199
3293
|
|
3200
|
-
|
3294
|
+
this._focustrap.deactivate();
|
3201
3295
|
|
3202
3296
|
this._element.blur();
|
3203
3297
|
|
3204
3298
|
this._isShown = false;
|
3205
3299
|
|
3206
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
3300
|
+
this._element.classList.remove(CLASS_NAME_SHOW$3);
|
3207
3301
|
|
3208
3302
|
this._backdrop.hide();
|
3209
3303
|
|
@@ -3217,7 +3311,7 @@
|
|
3217
3311
|
this._element.style.visibility = 'hidden';
|
3218
3312
|
|
3219
3313
|
if (!this._config.scroll) {
|
3220
|
-
reset();
|
3314
|
+
new ScrollBarHelper().reset();
|
3221
3315
|
}
|
3222
3316
|
|
3223
3317
|
EventHandler.trigger(this._element, EVENT_HIDDEN$2);
|
@@ -3229,8 +3323,9 @@
|
|
3229
3323
|
dispose() {
|
3230
3324
|
this._backdrop.dispose();
|
3231
3325
|
|
3326
|
+
this._focustrap.deactivate();
|
3327
|
+
|
3232
3328
|
super.dispose();
|
3233
|
-
EventHandler.off(document, EVENT_FOCUSIN$1);
|
3234
3329
|
} // Private
|
3235
3330
|
|
3236
3331
|
|
@@ -3245,6 +3340,7 @@
|
|
3245
3340
|
|
3246
3341
|
_initializeBackDrop() {
|
3247
3342
|
return new Backdrop({
|
3343
|
+
className: CLASS_NAME_BACKDROP,
|
3248
3344
|
isVisible: this._config.backdrop,
|
3249
3345
|
isAnimated: true,
|
3250
3346
|
rootElement: this._element.parentNode,
|
@@ -3252,19 +3348,13 @@
|
|
3252
3348
|
});
|
3253
3349
|
}
|
3254
3350
|
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
EventHandler.on(document, EVENT_FOCUSIN$1, event => {
|
3259
|
-
if (document !== event.target && element !== event.target && !element.contains(event.target)) {
|
3260
|
-
element.focus();
|
3261
|
-
}
|
3351
|
+
_initializeFocusTrap() {
|
3352
|
+
return new FocusTrap({
|
3353
|
+
trapElement: this._element
|
3262
3354
|
});
|
3263
|
-
element.focus();
|
3264
3355
|
}
|
3265
3356
|
|
3266
3357
|
_addEventListeners() {
|
3267
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
|
3268
3358
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
3269
3359
|
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
3270
3360
|
this.hide();
|
@@ -3275,7 +3365,7 @@
|
|
3275
3365
|
|
3276
3366
|
static jQueryInterface(config) {
|
3277
3367
|
return this.each(function () {
|
3278
|
-
const data =
|
3368
|
+
const data = Offcanvas.getOrCreateInstance(this, config);
|
3279
3369
|
|
3280
3370
|
if (typeof config !== 'string') {
|
3281
3371
|
return;
|
@@ -3321,12 +3411,11 @@
|
|
3321
3411
|
Offcanvas.getInstance(allReadyOpen).hide();
|
3322
3412
|
}
|
3323
3413
|
|
3324
|
-
const data =
|
3414
|
+
const data = Offcanvas.getOrCreateInstance(target);
|
3325
3415
|
data.toggle(this);
|
3326
3416
|
});
|
3327
|
-
EventHandler.on(window, EVENT_LOAD_DATA_API$1, () =>
|
3328
|
-
|
3329
|
-
});
|
3417
|
+
EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
|
3418
|
+
enableDismissTrigger(Offcanvas);
|
3330
3419
|
/**
|
3331
3420
|
* ------------------------------------------------------------------------
|
3332
3421
|
* jQuery
|
@@ -3337,42 +3426,42 @@
|
|
3337
3426
|
|
3338
3427
|
/**
|
3339
3428
|
* --------------------------------------------------------------------------
|
3340
|
-
* Bootstrap (v5.
|
3429
|
+
* Bootstrap (v5.1.2): util/sanitizer.js
|
3341
3430
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
3342
3431
|
* --------------------------------------------------------------------------
|
3343
3432
|
*/
|
3344
|
-
const
|
3433
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
3345
3434
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
3346
3435
|
/**
|
3347
3436
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
3348
3437
|
*
|
3349
|
-
* Shoutout to Angular
|
3438
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
3350
3439
|
*/
|
3351
3440
|
|
3352
|
-
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
3441
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
3353
3442
|
/**
|
3354
3443
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
3355
3444
|
*
|
3356
|
-
* Shoutout to Angular
|
3445
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
3357
3446
|
*/
|
3358
3447
|
|
3359
3448
|
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;
|
3360
3449
|
|
3361
|
-
const allowedAttribute = (
|
3362
|
-
const
|
3450
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
3451
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
3363
3452
|
|
3364
|
-
if (allowedAttributeList.includes(
|
3365
|
-
if (
|
3366
|
-
return Boolean(SAFE_URL_PATTERN.test(
|
3453
|
+
if (allowedAttributeList.includes(attributeName)) {
|
3454
|
+
if (uriAttributes.has(attributeName)) {
|
3455
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
|
3367
3456
|
}
|
3368
3457
|
|
3369
3458
|
return true;
|
3370
3459
|
}
|
3371
3460
|
|
3372
|
-
const regExp = allowedAttributeList.filter(
|
3461
|
+
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
|
3373
3462
|
|
3374
3463
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
3375
|
-
if (regExp[i].test(
|
3464
|
+
if (regExp[i].test(attributeName)) {
|
3376
3465
|
return true;
|
3377
3466
|
}
|
3378
3467
|
}
|
@@ -3424,23 +3513,22 @@
|
|
3424
3513
|
|
3425
3514
|
const domParser = new window.DOMParser();
|
3426
3515
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
3427
|
-
const allowlistKeys = Object.keys(allowList);
|
3428
3516
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
3429
3517
|
|
3430
3518
|
for (let i = 0, len = elements.length; i < len; i++) {
|
3431
|
-
const
|
3432
|
-
const
|
3519
|
+
const element = elements[i];
|
3520
|
+
const elementName = element.nodeName.toLowerCase();
|
3433
3521
|
|
3434
|
-
if (!
|
3435
|
-
|
3522
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
3523
|
+
element.remove();
|
3436
3524
|
continue;
|
3437
3525
|
}
|
3438
3526
|
|
3439
|
-
const attributeList = [].concat(...
|
3440
|
-
const allowedAttributes = [].concat(allowList['*'] || [], allowList[
|
3441
|
-
attributeList.forEach(
|
3442
|
-
if (!allowedAttribute(
|
3443
|
-
|
3527
|
+
const attributeList = [].concat(...element.attributes);
|
3528
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
3529
|
+
attributeList.forEach(attribute => {
|
3530
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
3531
|
+
element.removeAttribute(attribute.nodeName);
|
3444
3532
|
}
|
3445
3533
|
});
|
3446
3534
|
}
|
@@ -3450,7 +3538,7 @@
|
|
3450
3538
|
|
3451
3539
|
/**
|
3452
3540
|
* --------------------------------------------------------------------------
|
3453
|
-
* Bootstrap (v5.
|
3541
|
+
* Bootstrap (v5.1.2): tooltip.js
|
3454
3542
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
3455
3543
|
* --------------------------------------------------------------------------
|
3456
3544
|
*/
|
@@ -3464,7 +3552,6 @@
|
|
3464
3552
|
const DATA_KEY$4 = 'bs.tooltip';
|
3465
3553
|
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
|
3466
3554
|
const CLASS_PREFIX$1 = 'bs-tooltip';
|
3467
|
-
const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
|
3468
3555
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
3469
3556
|
const DefaultType$3 = {
|
3470
3557
|
animation: 'boolean',
|
@@ -3523,12 +3610,14 @@
|
|
3523
3610
|
MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
|
3524
3611
|
MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
|
3525
3612
|
};
|
3526
|
-
const CLASS_NAME_FADE$
|
3613
|
+
const CLASS_NAME_FADE$2 = 'fade';
|
3527
3614
|
const CLASS_NAME_MODAL = 'modal';
|
3528
|
-
const CLASS_NAME_SHOW$
|
3615
|
+
const CLASS_NAME_SHOW$2 = 'show';
|
3529
3616
|
const HOVER_STATE_SHOW = 'show';
|
3530
3617
|
const HOVER_STATE_OUT = 'out';
|
3531
3618
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
3619
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
3620
|
+
const EVENT_MODAL_HIDE = 'hide.bs.modal';
|
3532
3621
|
const TRIGGER_HOVER = 'hover';
|
3533
3622
|
const TRIGGER_FOCUS = 'focus';
|
3534
3623
|
const TRIGGER_CLICK = 'click';
|
@@ -3605,7 +3694,7 @@
|
|
3605
3694
|
context._leave(null, context);
|
3606
3695
|
}
|
3607
3696
|
} else {
|
3608
|
-
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
3697
|
+
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$2)) {
|
3609
3698
|
this._leave(null, this);
|
3610
3699
|
|
3611
3700
|
return;
|
@@ -3617,15 +3706,13 @@
|
|
3617
3706
|
|
3618
3707
|
dispose() {
|
3619
3708
|
clearTimeout(this._timeout);
|
3620
|
-
EventHandler.off(this._element.closest(
|
3709
|
+
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
3621
3710
|
|
3622
|
-
if (this.tip
|
3623
|
-
this.tip.
|
3711
|
+
if (this.tip) {
|
3712
|
+
this.tip.remove();
|
3624
3713
|
}
|
3625
3714
|
|
3626
|
-
|
3627
|
-
this._popper.destroy();
|
3628
|
-
}
|
3715
|
+
this._disposePopper();
|
3629
3716
|
|
3630
3717
|
super.dispose();
|
3631
3718
|
}
|
@@ -3645,6 +3732,15 @@
|
|
3645
3732
|
|
3646
3733
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
3647
3734
|
return;
|
3735
|
+
} // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title`
|
3736
|
+
// This will be removed later in favor of a `setContent` method
|
3737
|
+
|
3738
|
+
|
3739
|
+
if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
|
3740
|
+
this._disposePopper();
|
3741
|
+
|
3742
|
+
this.tip.remove();
|
3743
|
+
this.tip = null;
|
3648
3744
|
}
|
3649
3745
|
|
3650
3746
|
const tip = this.getTipElement();
|
@@ -3653,10 +3749,8 @@
|
|
3653
3749
|
|
3654
3750
|
this._element.setAttribute('aria-describedby', tipId);
|
3655
3751
|
|
3656
|
-
this.setContent();
|
3657
|
-
|
3658
3752
|
if (this._config.animation) {
|
3659
|
-
tip.classList.add(CLASS_NAME_FADE$
|
3753
|
+
tip.classList.add(CLASS_NAME_FADE$2);
|
3660
3754
|
}
|
3661
3755
|
|
3662
3756
|
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
|
@@ -3671,7 +3765,7 @@
|
|
3671
3765
|
Data.set(tip, this.constructor.DATA_KEY, this);
|
3672
3766
|
|
3673
3767
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
3674
|
-
container.
|
3768
|
+
container.append(tip);
|
3675
3769
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
3676
3770
|
}
|
3677
3771
|
|
@@ -3681,8 +3775,9 @@
|
|
3681
3775
|
this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
3682
3776
|
}
|
3683
3777
|
|
3684
|
-
tip.classList.add(CLASS_NAME_SHOW$
|
3685
|
-
|
3778
|
+
tip.classList.add(CLASS_NAME_SHOW$2);
|
3779
|
+
|
3780
|
+
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
3686
3781
|
|
3687
3782
|
if (customClass) {
|
3688
3783
|
tip.classList.add(...customClass.split(' '));
|
@@ -3708,7 +3803,7 @@
|
|
3708
3803
|
}
|
3709
3804
|
};
|
3710
3805
|
|
3711
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
3806
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
|
3712
3807
|
|
3713
3808
|
this._queueCallback(complete, this.tip, isAnimated);
|
3714
3809
|
}
|
@@ -3725,8 +3820,8 @@
|
|
3725
3820
|
return;
|
3726
3821
|
}
|
3727
3822
|
|
3728
|
-
if (this._hoverState !== HOVER_STATE_SHOW
|
3729
|
-
tip.
|
3823
|
+
if (this._hoverState !== HOVER_STATE_SHOW) {
|
3824
|
+
tip.remove();
|
3730
3825
|
}
|
3731
3826
|
|
3732
3827
|
this._cleanTipClass();
|
@@ -3735,11 +3830,7 @@
|
|
3735
3830
|
|
3736
3831
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
3737
3832
|
|
3738
|
-
|
3739
|
-
this._popper.destroy();
|
3740
|
-
|
3741
|
-
this._popper = null;
|
3742
|
-
}
|
3833
|
+
this._disposePopper();
|
3743
3834
|
};
|
3744
3835
|
|
3745
3836
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
@@ -3748,7 +3839,7 @@
|
|
3748
3839
|
return;
|
3749
3840
|
}
|
3750
3841
|
|
3751
|
-
tip.classList.remove(CLASS_NAME_SHOW$
|
3842
|
+
tip.classList.remove(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we remove the extra
|
3752
3843
|
// empty mouseover listeners we added for iOS support
|
3753
3844
|
|
3754
3845
|
if ('ontouchstart' in document.documentElement) {
|
@@ -3758,7 +3849,7 @@
|
|
3758
3849
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
3759
3850
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
3760
3851
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
3761
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
3852
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
|
3762
3853
|
|
3763
3854
|
this._queueCallback(complete, this.tip, isAnimated);
|
3764
3855
|
|
@@ -3783,14 +3874,27 @@
|
|
3783
3874
|
|
3784
3875
|
const element = document.createElement('div');
|
3785
3876
|
element.innerHTML = this._config.template;
|
3786
|
-
|
3877
|
+
const tip = element.children[0];
|
3878
|
+
this.setContent(tip);
|
3879
|
+
tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
|
3880
|
+
this.tip = tip;
|
3787
3881
|
return this.tip;
|
3788
3882
|
}
|
3789
3883
|
|
3790
|
-
setContent() {
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3884
|
+
setContent(tip) {
|
3885
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
|
3886
|
+
}
|
3887
|
+
|
3888
|
+
_sanitizeAndSetContent(template, content, selector) {
|
3889
|
+
const templateElement = SelectorEngine.findOne(selector, template);
|
3890
|
+
|
3891
|
+
if (!content && templateElement) {
|
3892
|
+
templateElement.remove();
|
3893
|
+
return;
|
3894
|
+
} // we use append for html objects to maintain js events
|
3895
|
+
|
3896
|
+
|
3897
|
+
this.setElementContent(templateElement, content);
|
3794
3898
|
}
|
3795
3899
|
|
3796
3900
|
setElementContent(element, content) {
|
@@ -3804,7 +3908,7 @@
|
|
3804
3908
|
if (this._config.html) {
|
3805
3909
|
if (content.parentNode !== element) {
|
3806
3910
|
element.innerHTML = '';
|
3807
|
-
element.
|
3911
|
+
element.append(content);
|
3808
3912
|
}
|
3809
3913
|
} else {
|
3810
3914
|
element.textContent = content.textContent;
|
@@ -3825,13 +3929,9 @@
|
|
3825
3929
|
}
|
3826
3930
|
|
3827
3931
|
getTitle() {
|
3828
|
-
|
3932
|
+
const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
|
3829
3933
|
|
3830
|
-
|
3831
|
-
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
3832
|
-
}
|
3833
|
-
|
3834
|
-
return title;
|
3934
|
+
return this._resolvePossibleFunction(title);
|
3835
3935
|
}
|
3836
3936
|
|
3837
3937
|
updateAttachment(attachment) {
|
@@ -3848,15 +3948,7 @@
|
|
3848
3948
|
|
3849
3949
|
|
3850
3950
|
_initializeOnDelegatedTarget(event, context) {
|
3851
|
-
|
3852
|
-
context = context || Data.get(event.delegateTarget, dataKey);
|
3853
|
-
|
3854
|
-
if (!context) {
|
3855
|
-
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
3856
|
-
Data.set(event.delegateTarget, dataKey, context);
|
3857
|
-
}
|
3858
|
-
|
3859
|
-
return context;
|
3951
|
+
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
3860
3952
|
}
|
3861
3953
|
|
3862
3954
|
_getOffset() {
|
@@ -3875,6 +3967,10 @@
|
|
3875
3967
|
return offset;
|
3876
3968
|
}
|
3877
3969
|
|
3970
|
+
_resolvePossibleFunction(content) {
|
3971
|
+
return typeof content === 'function' ? content.call(this._element) : content;
|
3972
|
+
}
|
3973
|
+
|
3878
3974
|
_getPopperConfig(attachment) {
|
3879
3975
|
const defaultBsPopperConfig = {
|
3880
3976
|
placement: attachment,
|
@@ -3916,7 +4012,7 @@
|
|
3916
4012
|
}
|
3917
4013
|
|
3918
4014
|
_addAttachmentClass(attachment) {
|
3919
|
-
this.getTipElement().classList.add(`${
|
4015
|
+
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
3920
4016
|
}
|
3921
4017
|
|
3922
4018
|
_getAttachment(placement) {
|
@@ -3943,7 +4039,7 @@
|
|
3943
4039
|
}
|
3944
4040
|
};
|
3945
4041
|
|
3946
|
-
EventHandler.on(this._element.closest(
|
4042
|
+
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
3947
4043
|
|
3948
4044
|
if (this._config.selector) {
|
3949
4045
|
this._config = { ...this._config,
|
@@ -3978,7 +4074,7 @@
|
|
3978
4074
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
3979
4075
|
}
|
3980
4076
|
|
3981
|
-
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
4077
|
+
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$2) || context._hoverState === HOVER_STATE_SHOW) {
|
3982
4078
|
context._hoverState = HOVER_STATE_SHOW;
|
3983
4079
|
return;
|
3984
4080
|
}
|
@@ -4074,26 +4170,32 @@
|
|
4074
4170
|
_getDelegateConfig() {
|
4075
4171
|
const config = {};
|
4076
4172
|
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
config[key] = this._config[key];
|
4081
|
-
}
|
4173
|
+
for (const key in this._config) {
|
4174
|
+
if (this.constructor.Default[key] !== this._config[key]) {
|
4175
|
+
config[key] = this._config[key];
|
4082
4176
|
}
|
4083
|
-
}
|
4177
|
+
} // In the future can be replaced with:
|
4178
|
+
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
4179
|
+
// `Object.fromEntries(keysWithDifferentValues)`
|
4180
|
+
|
4084
4181
|
|
4085
4182
|
return config;
|
4086
4183
|
}
|
4087
4184
|
|
4088
4185
|
_cleanTipClass() {
|
4089
4186
|
const tip = this.getTipElement();
|
4090
|
-
const
|
4187
|
+
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
4188
|
+
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
4091
4189
|
|
4092
4190
|
if (tabClass !== null && tabClass.length > 0) {
|
4093
4191
|
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
4094
4192
|
}
|
4095
4193
|
}
|
4096
4194
|
|
4195
|
+
_getBasicClassPrefix() {
|
4196
|
+
return CLASS_PREFIX$1;
|
4197
|
+
}
|
4198
|
+
|
4097
4199
|
_handlePopperPlacementChange(popperData) {
|
4098
4200
|
const {
|
4099
4201
|
state
|
@@ -4108,22 +4210,20 @@
|
|
4108
4210
|
this._cleanTipClass();
|
4109
4211
|
|
4110
4212
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
4213
|
+
}
|
4214
|
+
|
4215
|
+
_disposePopper() {
|
4216
|
+
if (this._popper) {
|
4217
|
+
this._popper.destroy();
|
4218
|
+
|
4219
|
+
this._popper = null;
|
4220
|
+
}
|
4111
4221
|
} // Static
|
4112
4222
|
|
4113
4223
|
|
4114
4224
|
static jQueryInterface(config) {
|
4115
4225
|
return this.each(function () {
|
4116
|
-
|
4117
|
-
|
4118
|
-
const _config = typeof config === 'object' && config;
|
4119
|
-
|
4120
|
-
if (!data && /dispose|hide/.test(config)) {
|
4121
|
-
return;
|
4122
|
-
}
|
4123
|
-
|
4124
|
-
if (!data) {
|
4125
|
-
data = new Tooltip(this, _config);
|
4126
|
-
}
|
4226
|
+
const data = Tooltip.getOrCreateInstance(this, config);
|
4127
4227
|
|
4128
4228
|
if (typeof config === 'string') {
|
4129
4229
|
if (typeof data[config] === 'undefined') {
|
@@ -4148,7 +4248,7 @@
|
|
4148
4248
|
|
4149
4249
|
/**
|
4150
4250
|
* --------------------------------------------------------------------------
|
4151
|
-
* Bootstrap (v5.
|
4251
|
+
* Bootstrap (v5.1.2): popover.js
|
4152
4252
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
4153
4253
|
* --------------------------------------------------------------------------
|
4154
4254
|
*/
|
@@ -4162,7 +4262,6 @@
|
|
4162
4262
|
const DATA_KEY$3 = 'bs.popover';
|
4163
4263
|
const EVENT_KEY$3 = `.${DATA_KEY$3}`;
|
4164
4264
|
const CLASS_PREFIX = 'bs-popover';
|
4165
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
4166
4265
|
const Default$2 = { ...Tooltip.Default,
|
4167
4266
|
placement: 'right',
|
4168
4267
|
offset: [0, 8],
|
@@ -4185,8 +4284,6 @@
|
|
4185
4284
|
MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
|
4186
4285
|
MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
|
4187
4286
|
};
|
4188
|
-
const CLASS_NAME_FADE$2 = 'fade';
|
4189
|
-
const CLASS_NAME_SHOW$2 = 'show';
|
4190
4287
|
const SELECTOR_TITLE = '.popover-header';
|
4191
4288
|
const SELECTOR_CONTENT = '.popover-body';
|
4192
4289
|
/**
|
@@ -4218,54 +4315,25 @@
|
|
4218
4315
|
return this.getTitle() || this._getContent();
|
4219
4316
|
}
|
4220
4317
|
|
4221
|
-
setContent() {
|
4222
|
-
|
4223
|
-
|
4224
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
4225
|
-
|
4226
|
-
let content = this._getContent();
|
4318
|
+
setContent(tip) {
|
4319
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
4227
4320
|
|
4228
|
-
|
4229
|
-
content = content.call(this._element);
|
4230
|
-
}
|
4231
|
-
|
4232
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
4233
|
-
tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
|
4321
|
+
this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
4234
4322
|
} // Private
|
4235
4323
|
|
4236
4324
|
|
4237
|
-
_addAttachmentClass(attachment) {
|
4238
|
-
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
4239
|
-
}
|
4240
|
-
|
4241
4325
|
_getContent() {
|
4242
|
-
return this.
|
4326
|
+
return this._resolvePossibleFunction(this._config.content);
|
4243
4327
|
}
|
4244
4328
|
|
4245
|
-
|
4246
|
-
|
4247
|
-
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
4248
|
-
|
4249
|
-
if (tabClass !== null && tabClass.length > 0) {
|
4250
|
-
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
4251
|
-
}
|
4329
|
+
_getBasicClassPrefix() {
|
4330
|
+
return CLASS_PREFIX;
|
4252
4331
|
} // Static
|
4253
4332
|
|
4254
4333
|
|
4255
4334
|
static jQueryInterface(config) {
|
4256
4335
|
return this.each(function () {
|
4257
|
-
|
4258
|
-
|
4259
|
-
const _config = typeof config === 'object' ? config : null;
|
4260
|
-
|
4261
|
-
if (!data && /dispose|hide/.test(config)) {
|
4262
|
-
return;
|
4263
|
-
}
|
4264
|
-
|
4265
|
-
if (!data) {
|
4266
|
-
data = new Popover(this, _config);
|
4267
|
-
Data.set(this, DATA_KEY$3, data);
|
4268
|
-
}
|
4336
|
+
const data = Popover.getOrCreateInstance(this, config);
|
4269
4337
|
|
4270
4338
|
if (typeof config === 'string') {
|
4271
4339
|
if (typeof data[config] === 'undefined') {
|
@@ -4290,7 +4358,7 @@
|
|
4290
4358
|
|
4291
4359
|
/**
|
4292
4360
|
* --------------------------------------------------------------------------
|
4293
|
-
* Bootstrap (v5.
|
4361
|
+
* Bootstrap (v5.1.2): scrollspy.js
|
4294
4362
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
4295
4363
|
* --------------------------------------------------------------------------
|
4296
4364
|
*/
|
@@ -4324,6 +4392,7 @@
|
|
4324
4392
|
const SELECTOR_NAV_LINKS = '.nav-link';
|
4325
4393
|
const SELECTOR_NAV_ITEMS = '.nav-item';
|
4326
4394
|
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
4395
|
+
const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
|
4327
4396
|
const SELECTOR_DROPDOWN$1 = '.dropdown';
|
4328
4397
|
const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
|
4329
4398
|
const METHOD_OFFSET = 'offset';
|
@@ -4339,7 +4408,6 @@
|
|
4339
4408
|
super(element);
|
4340
4409
|
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
|
4341
4410
|
this._config = this._getConfig(config);
|
4342
|
-
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
4343
4411
|
this._offsets = [];
|
4344
4412
|
this._targets = [];
|
4345
4413
|
this._activeTarget = null;
|
@@ -4367,7 +4435,7 @@
|
|
4367
4435
|
this._offsets = [];
|
4368
4436
|
this._targets = [];
|
4369
4437
|
this._scrollHeight = this._getScrollHeight();
|
4370
|
-
const targets = SelectorEngine.find(this.
|
4438
|
+
const targets = SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target);
|
4371
4439
|
targets.map(element => {
|
4372
4440
|
const targetSelector = getSelectorFromElement(element);
|
4373
4441
|
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
|
@@ -4399,20 +4467,7 @@
|
|
4399
4467
|
...Manipulator.getDataAttributes(this._element),
|
4400
4468
|
...(typeof config === 'object' && config ? config : {})
|
4401
4469
|
};
|
4402
|
-
|
4403
|
-
if (typeof config.target !== 'string' && isElement(config.target)) {
|
4404
|
-
let {
|
4405
|
-
id
|
4406
|
-
} = config.target;
|
4407
|
-
|
4408
|
-
if (!id) {
|
4409
|
-
id = getUID(NAME$2);
|
4410
|
-
config.target.id = id;
|
4411
|
-
}
|
4412
|
-
|
4413
|
-
config.target = `#${id}`;
|
4414
|
-
}
|
4415
|
-
|
4470
|
+
config.target = getElement(config.target) || document.documentElement;
|
4416
4471
|
typeCheckConfig(NAME$2, config, DefaultType$1);
|
4417
4472
|
return config;
|
4418
4473
|
}
|
@@ -4472,16 +4527,13 @@
|
|
4472
4527
|
|
4473
4528
|
this._clear();
|
4474
4529
|
|
4475
|
-
const queries =
|
4476
|
-
|
4477
|
-
|
4530
|
+
const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
4531
|
+
const link = SelectorEngine.findOne(queries.join(','), this._config.target);
|
4532
|
+
link.classList.add(CLASS_NAME_ACTIVE$1);
|
4478
4533
|
|
4479
4534
|
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
4480
4535
|
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
|
4481
|
-
link.classList.add(CLASS_NAME_ACTIVE$1);
|
4482
4536
|
} else {
|
4483
|
-
// Set triggered link as active
|
4484
|
-
link.classList.add(CLASS_NAME_ACTIVE$1);
|
4485
4537
|
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
|
4486
4538
|
// Set triggered links parents as active
|
4487
4539
|
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
@@ -4499,13 +4551,13 @@
|
|
4499
4551
|
}
|
4500
4552
|
|
4501
4553
|
_clear() {
|
4502
|
-
SelectorEngine.find(this.
|
4554
|
+
SelectorEngine.find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
|
4503
4555
|
} // Static
|
4504
4556
|
|
4505
4557
|
|
4506
4558
|
static jQueryInterface(config) {
|
4507
4559
|
return this.each(function () {
|
4508
|
-
const data = ScrollSpy.
|
4560
|
+
const data = ScrollSpy.getOrCreateInstance(this, config);
|
4509
4561
|
|
4510
4562
|
if (typeof config !== 'string') {
|
4511
4563
|
return;
|
@@ -4541,7 +4593,7 @@
|
|
4541
4593
|
|
4542
4594
|
/**
|
4543
4595
|
* --------------------------------------------------------------------------
|
4544
|
-
* Bootstrap (v5.
|
4596
|
+
* Bootstrap (v5.1.2): tab.js
|
4545
4597
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
4546
4598
|
* --------------------------------------------------------------------------
|
4547
4599
|
*/
|
@@ -4696,7 +4748,7 @@
|
|
4696
4748
|
|
4697
4749
|
static jQueryInterface(config) {
|
4698
4750
|
return this.each(function () {
|
4699
|
-
const data =
|
4751
|
+
const data = Tab.getOrCreateInstance(this);
|
4700
4752
|
|
4701
4753
|
if (typeof config === 'string') {
|
4702
4754
|
if (typeof data[config] === 'undefined') {
|
@@ -4725,7 +4777,7 @@
|
|
4725
4777
|
return;
|
4726
4778
|
}
|
4727
4779
|
|
4728
|
-
const data =
|
4780
|
+
const data = Tab.getOrCreateInstance(this);
|
4729
4781
|
data.show();
|
4730
4782
|
});
|
4731
4783
|
/**
|
@@ -4739,7 +4791,7 @@
|
|
4739
4791
|
|
4740
4792
|
/**
|
4741
4793
|
* --------------------------------------------------------------------------
|
4742
|
-
* Bootstrap (v5.
|
4794
|
+
* Bootstrap (v5.1.2): toast.js
|
4743
4795
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
4744
4796
|
* --------------------------------------------------------------------------
|
4745
4797
|
*/
|
@@ -4752,7 +4804,6 @@
|
|
4752
4804
|
const NAME = 'toast';
|
4753
4805
|
const DATA_KEY = 'bs.toast';
|
4754
4806
|
const EVENT_KEY = `.${DATA_KEY}`;
|
4755
|
-
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
4756
4807
|
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
|
4757
4808
|
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
|
4758
4809
|
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
@@ -4762,7 +4813,8 @@
|
|
4762
4813
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
4763
4814
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
4764
4815
|
const CLASS_NAME_FADE = 'fade';
|
4765
|
-
const CLASS_NAME_HIDE = 'hide';
|
4816
|
+
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
4817
|
+
|
4766
4818
|
const CLASS_NAME_SHOW = 'show';
|
4767
4819
|
const CLASS_NAME_SHOWING = 'showing';
|
4768
4820
|
const DefaultType = {
|
@@ -4775,7 +4827,6 @@
|
|
4775
4827
|
autohide: true,
|
4776
4828
|
delay: 5000
|
4777
4829
|
};
|
4778
|
-
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
4779
4830
|
/**
|
4780
4831
|
* ------------------------------------------------------------------------
|
4781
4832
|
* Class Definition
|
@@ -4823,17 +4874,18 @@
|
|
4823
4874
|
const complete = () => {
|
4824
4875
|
this._element.classList.remove(CLASS_NAME_SHOWING);
|
4825
4876
|
|
4826
|
-
this._element.classList.add(CLASS_NAME_SHOW);
|
4827
|
-
|
4828
4877
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
4829
4878
|
|
4830
4879
|
this._maybeScheduleHide();
|
4831
4880
|
};
|
4832
4881
|
|
4833
|
-
this._element.classList.remove(CLASS_NAME_HIDE);
|
4882
|
+
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
4883
|
+
|
4834
4884
|
|
4835
4885
|
reflow(this._element);
|
4836
4886
|
|
4887
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
4888
|
+
|
4837
4889
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
4838
4890
|
|
4839
4891
|
this._queueCallback(complete, this._element, this._config.animation);
|
@@ -4851,12 +4903,17 @@
|
|
4851
4903
|
}
|
4852
4904
|
|
4853
4905
|
const complete = () => {
|
4854
|
-
this._element.classList.add(CLASS_NAME_HIDE);
|
4906
|
+
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
|
4907
|
+
|
4908
|
+
|
4909
|
+
this._element.classList.remove(CLASS_NAME_SHOWING);
|
4910
|
+
|
4911
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
4855
4912
|
|
4856
4913
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
4857
4914
|
};
|
4858
4915
|
|
4859
|
-
this._element.classList.
|
4916
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
4860
4917
|
|
4861
4918
|
this._queueCallback(complete, this._element, this._config.animation);
|
4862
4919
|
}
|
@@ -4924,7 +4981,6 @@
|
|
4924
4981
|
}
|
4925
4982
|
|
4926
4983
|
_setListeners() {
|
4927
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
4928
4984
|
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
|
4929
4985
|
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
|
4930
4986
|
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
|
@@ -4939,13 +4995,7 @@
|
|
4939
4995
|
|
4940
4996
|
static jQueryInterface(config) {
|
4941
4997
|
return this.each(function () {
|
4942
|
-
|
4943
|
-
|
4944
|
-
const _config = typeof config === 'object' && config;
|
4945
|
-
|
4946
|
-
if (!data) {
|
4947
|
-
data = new Toast(this, _config);
|
4948
|
-
}
|
4998
|
+
const data = Toast.getOrCreateInstance(this, config);
|
4949
4999
|
|
4950
5000
|
if (typeof config === 'string') {
|
4951
5001
|
if (typeof data[config] === 'undefined') {
|
@@ -4958,6 +5008,8 @@
|
|
4958
5008
|
}
|
4959
5009
|
|
4960
5010
|
}
|
5011
|
+
|
5012
|
+
enableDismissTrigger(Toast);
|
4961
5013
|
/**
|
4962
5014
|
* ------------------------------------------------------------------------
|
4963
5015
|
* jQuery
|
@@ -4965,16 +5017,15 @@
|
|
4965
5017
|
* add .Toast to jQuery only if jQuery is present
|
4966
5018
|
*/
|
4967
5019
|
|
4968
|
-
|
4969
5020
|
defineJQueryPlugin(Toast);
|
4970
5021
|
|
4971
5022
|
/**
|
4972
5023
|
* --------------------------------------------------------------------------
|
4973
|
-
* Bootstrap (v5.
|
5024
|
+
* Bootstrap (v5.1.2): index.umd.js
|
4974
5025
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
4975
5026
|
* --------------------------------------------------------------------------
|
4976
5027
|
*/
|
4977
|
-
|
5028
|
+
const index_umd = {
|
4978
5029
|
Alert,
|
4979
5030
|
Button,
|
4980
5031
|
Carousel,
|
@@ -4991,4 +5042,4 @@
|
|
4991
5042
|
|
4992
5043
|
return index_umd;
|
4993
5044
|
|
4994
|
-
}))
|
5045
|
+
}));
|