@coreui/coreui 4.0.4 → 4.1.1
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.
- package/README.md +5 -8
- package/dist/css/coreui-grid.css +254 -205
- package/dist/css/coreui-grid.css.map +1 -1
- package/dist/css/coreui-grid.min.css +2 -2
- package/dist/css/coreui-grid.min.css.map +1 -1
- package/dist/css/coreui-grid.rtl.css +411 -362
- package/dist/css/coreui-grid.rtl.css.map +1 -1
- package/dist/css/coreui-grid.rtl.min.css +3 -3
- package/dist/css/coreui-grid.rtl.min.css.map +1 -1
- package/dist/css/coreui-reboot.css +63 -8
- package/dist/css/coreui-reboot.css.map +1 -1
- package/dist/css/coreui-reboot.min.css +2 -2
- package/dist/css/coreui-reboot.min.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.css +64 -9
- package/dist/css/coreui-reboot.rtl.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.min.css +3 -3
- package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
- package/dist/css/coreui-utilities.css +181 -81
- package/dist/css/coreui-utilities.css.map +1 -1
- package/dist/css/coreui-utilities.min.css +2 -2
- package/dist/css/coreui-utilities.min.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.css +380 -280
- package/dist/css/coreui-utilities.rtl.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.min.css +3 -3
- package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
- package/dist/css/coreui.css +712 -345
- package/dist/css/coreui.css.map +1 -1
- package/dist/css/coreui.min.css +2 -2
- package/dist/css/coreui.min.css.map +1 -1
- package/dist/css/coreui.rtl.css +893 -541
- package/dist/css/coreui.rtl.css.map +1 -1
- package/dist/css/coreui.rtl.min.css +3 -3
- package/dist/css/coreui.rtl.min.css.map +1 -1
- package/dist/js/coreui.bundle.js +855 -746
- package/dist/js/coreui.bundle.js.map +1 -1
- package/dist/js/coreui.bundle.min.js +3 -3
- package/dist/js/coreui.bundle.min.js.map +1 -1
- package/dist/js/coreui.esm.js +708 -644
- package/dist/js/coreui.esm.js.map +1 -1
- package/dist/js/coreui.esm.min.js +3 -3
- package/dist/js/coreui.esm.min.js.map +1 -1
- package/dist/js/coreui.js +718 -656
- package/dist/js/coreui.js.map +1 -1
- package/dist/js/coreui.min.js +3 -3
- package/dist/js/coreui.min.js.map +1 -1
- package/js/dist/alert.js +82 -49
- package/js/dist/alert.js.map +1 -1
- package/js/dist/base-component.js +26 -18
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +23 -13
- package/js/dist/button.js.map +1 -1
- package/js/dist/carousel.js +95 -50
- package/js/dist/carousel.js.map +1 -1
- package/js/dist/collapse.js +125 -139
- package/js/dist/collapse.js.map +1 -1
- package/js/dist/dom/data.js +6 -6
- package/js/dist/dom/data.js.map +1 -1
- package/js/dist/dom/event-handler.js +15 -6
- package/js/dist/dom/event-handler.js.map +1 -1
- package/js/dist/dom/manipulator.js +7 -7
- package/js/dist/dom/manipulator.js.map +1 -1
- package/js/dist/dom/selector-engine.js +74 -9
- package/js/dist/dom/selector-engine.js.map +1 -1
- package/js/dist/dropdown.js +125 -112
- package/js/dist/dropdown.js.map +1 -1
- package/js/dist/modal.js +270 -93
- package/js/dist/modal.js.map +1 -1
- package/js/dist/offcanvas.js +231 -62
- package/js/dist/offcanvas.js.map +1 -1
- package/js/dist/popover.js +29 -59
- package/js/dist/popover.js.map +1 -1
- package/js/dist/scrollspy.js +45 -35
- package/js/dist/scrollspy.js.map +1 -1
- package/js/dist/tab.js +45 -23
- package/js/dist/tab.js.map +1 -1
- package/js/dist/toast.js +132 -34
- package/js/dist/toast.js.map +1 -1
- package/js/dist/tooltip.js +127 -109
- package/js/dist/tooltip.js.map +1 -1
- package/js/src/alert.js +21 -47
- package/js/src/base-component.js +3 -3
- package/js/src/button.js +1 -1
- package/js/src/carousel.js +10 -4
- package/js/src/collapse.js +66 -119
- package/js/src/dom/data.js +1 -1
- package/js/src/dom/event-handler.js +1 -2
- package/js/src/dom/manipulator.js +3 -3
- package/js/src/dom/selector-engine.js +18 -1
- package/js/src/dropdown.js +53 -68
- package/js/src/modal.js +24 -35
- package/js/src/navigation.js +6 -4
- package/js/src/offcanvas.js +16 -18
- package/js/src/popover.js +7 -49
- package/js/src/scrollspy.js +1 -1
- package/js/src/sidebar.js +23 -27
- package/js/src/tab.js +1 -1
- package/js/src/toast.js +11 -11
- package/js/src/tooltip.js +66 -50
- package/js/src/util/backdrop.js +6 -5
- package/js/src/util/component-functions.js +34 -0
- package/js/src/util/focustrap.js +105 -0
- package/js/src/util/index.js +39 -11
- package/js/src/util/sanitizer.js +21 -22
- package/js/src/util/scrollbar.js +1 -1
- package/package.json +54 -55
- package/scss/_buttons.scss +1 -2
- package/scss/_card.scss +2 -1
- package/scss/_dropdown.scss +1 -1
- package/scss/_functions.scss +51 -12
- package/scss/_grid.scss +0 -23
- package/scss/_helpers.scss +2 -0
- package/scss/_mixins.scss +1 -0
- package/scss/_modal.scss +2 -12
- package/scss/_nav.scss +1 -2
- package/scss/_navbar.scss +30 -1
- package/scss/_offcanvas.scss +6 -2
- package/scss/_placeholders.scss +51 -0
- package/scss/_reboot.scss +12 -8
- package/scss/_root.scss +36 -7
- package/scss/_tables.scss +9 -5
- package/scss/_toasts.scss +2 -2
- package/scss/_transitions.scss +6 -0
- package/scss/_utilities.scss +31 -8
- package/scss/_variables.scss +188 -13
- package/scss/coreui-grid.rtl.scss +1 -1
- package/scss/coreui-grid.scss +3 -1
- package/scss/coreui-reboot.rtl.scss +1 -1
- package/scss/coreui-reboot.scss +2 -4
- package/scss/coreui-utilities.rtl.scss +1 -1
- package/scss/coreui-utilities.scss +1 -1
- package/scss/coreui.rtl.scss +1 -1
- package/scss/coreui.scss +2 -1
- package/scss/forms/_form-control.scss +1 -1
- package/scss/forms/_form-select.scss +2 -0
- package/scss/helpers/_stacks.scss +15 -0
- package/scss/helpers/_vr.scss +8 -0
- package/scss/mixins/_backdrop.scss +14 -0
- package/scss/mixins/_grid.scss +26 -7
- package/scss/mixins/_ltr-rtl.scss +21 -0
- package/scss/mixins/_reset-text.scss +1 -1
- package/scss/mixins/_utilities.scss +27 -39
- package/scss/mixins/_visually-hidden.scss +1 -1
- package/scss/sidebar/_sidebar-nav.scss +1 -0
- package/scss/sidebar/_sidebar.scss +17 -17
package/dist/js/coreui.esm.js
CHANGED
|
@@ -1,104 +1,29 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI v4.
|
|
3
|
-
* Copyright
|
|
2
|
+
* CoreUI v4.1.1 (https://coreui.io)
|
|
3
|
+
* Copyright 2022 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://coreui.io)
|
|
5
5
|
*/
|
|
6
6
|
import * as Popper from '@popperjs/core';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* --------------------------------------------------------------------------
|
|
10
|
-
* CoreUI (v4.
|
|
11
|
-
* Licensed under MIT (https://coreui.io/license)
|
|
12
|
-
*
|
|
13
|
-
* This component is a modified version of the Bootstrap's dom/selector-engine.js
|
|
14
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
15
|
-
* --------------------------------------------------------------------------
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* ------------------------------------------------------------------------
|
|
20
|
-
* Constants
|
|
21
|
-
* ------------------------------------------------------------------------
|
|
22
|
-
*/
|
|
23
|
-
const NODE_TEXT = 3;
|
|
24
|
-
const SelectorEngine = {
|
|
25
|
-
find(selector, element = document.documentElement) {
|
|
26
|
-
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
findOne(selector, element = document.documentElement) {
|
|
30
|
-
return Element.prototype.querySelector.call(element, selector);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
children(element, selector) {
|
|
34
|
-
return [].concat(...element.children).filter(child => child.matches(selector));
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
parents(element, selector) {
|
|
38
|
-
const parents = [];
|
|
39
|
-
let ancestor = element.parentNode;
|
|
40
|
-
|
|
41
|
-
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
|
42
|
-
if (ancestor.matches(selector)) {
|
|
43
|
-
parents.push(ancestor);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
ancestor = ancestor.parentNode;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return parents;
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
prev(element, selector) {
|
|
53
|
-
let previous = element.previousElementSibling;
|
|
54
|
-
|
|
55
|
-
while (previous) {
|
|
56
|
-
if (previous.matches(selector)) {
|
|
57
|
-
return [previous];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
previous = previous.previousElementSibling;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return [];
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
next(element, selector) {
|
|
67
|
-
let next = element.nextElementSibling;
|
|
68
|
-
|
|
69
|
-
while (next) {
|
|
70
|
-
if (next.matches(selector)) {
|
|
71
|
-
return [next];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
next = next.nextElementSibling;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return [];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* --------------------------------------------------------------------------
|
|
84
|
-
* CoreUI (v4.0.4): alert.js
|
|
10
|
+
* CoreUI (v4.1.1): alert.js
|
|
85
11
|
* Licensed under MIT (https://coreui.io/license)
|
|
86
12
|
*
|
|
87
13
|
* This component is a modified version of the Bootstrap's util/index.js
|
|
88
14
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
89
15
|
* --------------------------------------------------------------------------
|
|
90
16
|
*/
|
|
91
|
-
|
|
92
17
|
const MAX_UID = 1000000;
|
|
93
18
|
const MILLISECONDS_MULTIPLIER = 1000;
|
|
94
19
|
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
|
95
20
|
|
|
96
|
-
const toType =
|
|
97
|
-
if (
|
|
98
|
-
return `${
|
|
21
|
+
const toType = object => {
|
|
22
|
+
if (object === null || object === undefined) {
|
|
23
|
+
return `${object}`;
|
|
99
24
|
}
|
|
100
25
|
|
|
101
|
-
return
|
|
26
|
+
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
|
|
102
27
|
};
|
|
103
28
|
/**
|
|
104
29
|
* --------------------------------------------------------------------------
|
|
@@ -200,7 +125,7 @@ const getElement = obj => {
|
|
|
200
125
|
}
|
|
201
126
|
|
|
202
127
|
if (typeof obj === 'string' && obj.length > 0) {
|
|
203
|
-
return
|
|
128
|
+
return document.querySelector(obj);
|
|
204
129
|
}
|
|
205
130
|
|
|
206
131
|
return null;
|
|
@@ -223,7 +148,27 @@ const isVisible = element => {
|
|
|
223
148
|
return false;
|
|
224
149
|
}
|
|
225
150
|
|
|
226
|
-
|
|
151
|
+
const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; // Handle `details` element as its content may falsie appear visible when it is closed
|
|
152
|
+
|
|
153
|
+
const closedDetails = element.closest('details:not([open])');
|
|
154
|
+
|
|
155
|
+
if (!closedDetails) {
|
|
156
|
+
return elementIsVisible;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (closedDetails !== element) {
|
|
160
|
+
const summary = element.closest('summary');
|
|
161
|
+
|
|
162
|
+
if (summary && summary.parentNode !== closedDetails) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (summary === null) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return elementIsVisible;
|
|
227
172
|
};
|
|
228
173
|
|
|
229
174
|
const isDisabled = element => {
|
|
@@ -266,8 +211,20 @@ const findShadowRoot = element => {
|
|
|
266
211
|
};
|
|
267
212
|
|
|
268
213
|
const noop = () => {};
|
|
214
|
+
/**
|
|
215
|
+
* Trick to restart an element's animation
|
|
216
|
+
*
|
|
217
|
+
* @param {HTMLElement} element
|
|
218
|
+
* @return void
|
|
219
|
+
*
|
|
220
|
+
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
|
221
|
+
*/
|
|
222
|
+
|
|
269
223
|
|
|
270
|
-
const reflow = element =>
|
|
224
|
+
const reflow = element => {
|
|
225
|
+
// eslint-disable-next-line no-unused-expressions
|
|
226
|
+
element.offsetHeight;
|
|
227
|
+
};
|
|
271
228
|
|
|
272
229
|
const getjQuery = () => {
|
|
273
230
|
const {
|
|
@@ -384,7 +341,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
|
|
|
384
341
|
|
|
385
342
|
/**
|
|
386
343
|
* --------------------------------------------------------------------------
|
|
387
|
-
* CoreUI (v4.
|
|
344
|
+
* CoreUI (v4.1.1): dom/event-handler.js
|
|
388
345
|
* Licensed under MIT (https://coreui.io/license)
|
|
389
346
|
*
|
|
390
347
|
* This component is a modified version of the Bootstrap's dom/event-handler.js
|
|
@@ -450,7 +407,6 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
|
|
450
407
|
event.delegateTarget = target;
|
|
451
408
|
|
|
452
409
|
if (handler.oneOff) {
|
|
453
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
454
410
|
EventHandler.off(element, event.type, selector, fn);
|
|
455
411
|
}
|
|
456
412
|
|
|
@@ -676,7 +632,7 @@ const EventHandler = {
|
|
|
676
632
|
|
|
677
633
|
/**
|
|
678
634
|
* --------------------------------------------------------------------------
|
|
679
|
-
* CoreUI (v4.
|
|
635
|
+
* CoreUI (v4.1.1): dom/data.js
|
|
680
636
|
* Licensed under MIT (https://coreui.io/license)
|
|
681
637
|
*
|
|
682
638
|
* This component is a modified version of the Bootstrap's dom/data.js
|
|
@@ -690,7 +646,7 @@ const EventHandler = {
|
|
|
690
646
|
* ------------------------------------------------------------------------
|
|
691
647
|
*/
|
|
692
648
|
const elementMap = new Map();
|
|
693
|
-
|
|
649
|
+
const Data = {
|
|
694
650
|
set(element, key, instance) {
|
|
695
651
|
if (!elementMap.has(element)) {
|
|
696
652
|
elementMap.set(element, new Map());
|
|
@@ -733,7 +689,7 @@ var Data = {
|
|
|
733
689
|
|
|
734
690
|
/**
|
|
735
691
|
* --------------------------------------------------------------------------
|
|
736
|
-
* CoreUI (v4.
|
|
692
|
+
* CoreUI (v4.1.1): alert.js
|
|
737
693
|
* Licensed under MIT (https://coreui.io/license)
|
|
738
694
|
*
|
|
739
695
|
* This component is a modified version of the Bootstrap's base-component.js
|
|
@@ -746,7 +702,7 @@ var Data = {
|
|
|
746
702
|
* ------------------------------------------------------------------------
|
|
747
703
|
*/
|
|
748
704
|
|
|
749
|
-
const VERSION = '4.
|
|
705
|
+
const VERSION = '4.1.1';
|
|
750
706
|
|
|
751
707
|
class BaseComponent {
|
|
752
708
|
constructor(element) {
|
|
@@ -775,7 +731,7 @@ class BaseComponent {
|
|
|
775
731
|
|
|
776
732
|
|
|
777
733
|
static getInstance(element) {
|
|
778
|
-
return Data.get(element, this.DATA_KEY);
|
|
734
|
+
return Data.get(getElement(element), this.DATA_KEY);
|
|
779
735
|
}
|
|
780
736
|
|
|
781
737
|
static getOrCreateInstance(element, config = {}) {
|
|
@@ -802,7 +758,33 @@ class BaseComponent {
|
|
|
802
758
|
|
|
803
759
|
/**
|
|
804
760
|
* --------------------------------------------------------------------------
|
|
805
|
-
*
|
|
761
|
+
* Bootstrap (v5.1.3): util/component-functions.js
|
|
762
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
763
|
+
* --------------------------------------------------------------------------
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
const enableDismissTrigger = (component, method = 'hide') => {
|
|
767
|
+
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
|
768
|
+
const name = component.NAME;
|
|
769
|
+
EventHandler.on(document, clickEvent, `[data-coreui-dismiss="${name}"]`, function (event) {
|
|
770
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
|
771
|
+
event.preventDefault();
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
if (isDisabled(this)) {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
|
779
|
+
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
|
780
|
+
|
|
781
|
+
instance[method]();
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* --------------------------------------------------------------------------
|
|
787
|
+
* CoreUI (v4.1.1): alert.js
|
|
806
788
|
* Licensed under MIT (https://coreui.io/license)
|
|
807
789
|
*
|
|
808
790
|
* This component is a modified version of the Bootstrap's alert.js
|
|
@@ -815,17 +797,13 @@ class BaseComponent {
|
|
|
815
797
|
* ------------------------------------------------------------------------
|
|
816
798
|
*/
|
|
817
799
|
|
|
818
|
-
const NAME$
|
|
819
|
-
const DATA_KEY$
|
|
820
|
-
const EVENT_KEY$
|
|
821
|
-
const
|
|
822
|
-
const
|
|
823
|
-
const
|
|
824
|
-
const
|
|
825
|
-
const EVENT_CLICK_DATA_API$9 = `click${EVENT_KEY$d}${DATA_API_KEY$a}`;
|
|
826
|
-
const CLASS_NAME_ALERT = 'alert';
|
|
827
|
-
const CLASS_NAME_FADE$7 = 'fade';
|
|
828
|
-
const CLASS_NAME_SHOW$b = 'show';
|
|
800
|
+
const NAME$f = 'alert';
|
|
801
|
+
const DATA_KEY$e = 'coreui.alert';
|
|
802
|
+
const EVENT_KEY$e = `.${DATA_KEY$e}`;
|
|
803
|
+
const EVENT_CLOSE = `close${EVENT_KEY$e}`;
|
|
804
|
+
const EVENT_CLOSED = `closed${EVENT_KEY$e}`;
|
|
805
|
+
const CLASS_NAME_FADE$5 = 'fade';
|
|
806
|
+
const CLASS_NAME_SHOW$a = 'show';
|
|
829
807
|
/**
|
|
830
808
|
* ------------------------------------------------------------------------
|
|
831
809
|
* Class Definition
|
|
@@ -835,41 +813,30 @@ const CLASS_NAME_SHOW$b = 'show';
|
|
|
835
813
|
class Alert extends BaseComponent {
|
|
836
814
|
// Getters
|
|
837
815
|
static get NAME() {
|
|
838
|
-
return NAME$
|
|
816
|
+
return NAME$f;
|
|
839
817
|
} // Public
|
|
840
818
|
|
|
841
819
|
|
|
842
|
-
close(
|
|
843
|
-
const
|
|
820
|
+
close() {
|
|
821
|
+
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
|
|
844
822
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (customEvent === null || customEvent.defaultPrevented) {
|
|
823
|
+
if (closeEvent.defaultPrevented) {
|
|
848
824
|
return;
|
|
849
825
|
}
|
|
850
826
|
|
|
851
|
-
this.
|
|
852
|
-
} // Private
|
|
853
|
-
|
|
827
|
+
this._element.classList.remove(CLASS_NAME_SHOW$a);
|
|
854
828
|
|
|
855
|
-
|
|
856
|
-
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
|
857
|
-
}
|
|
829
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
|
|
858
830
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
831
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
|
832
|
+
} // Private
|
|
862
833
|
|
|
863
|
-
_removeElement(element) {
|
|
864
|
-
element.classList.remove(CLASS_NAME_SHOW$b);
|
|
865
|
-
const isAnimated = element.classList.contains(CLASS_NAME_FADE$7);
|
|
866
834
|
|
|
867
|
-
|
|
868
|
-
|
|
835
|
+
_destroyElement() {
|
|
836
|
+
this._element.remove();
|
|
869
837
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
EventHandler.trigger(element, EVENT_CLOSED);
|
|
838
|
+
EventHandler.trigger(this._element, EVENT_CLOSED);
|
|
839
|
+
this.dispose();
|
|
873
840
|
} // Static
|
|
874
841
|
|
|
875
842
|
|
|
@@ -877,20 +844,16 @@ class Alert extends BaseComponent {
|
|
|
877
844
|
return this.each(function () {
|
|
878
845
|
const data = Alert.getOrCreateInstance(this);
|
|
879
846
|
|
|
880
|
-
if (config
|
|
881
|
-
|
|
847
|
+
if (typeof config !== 'string') {
|
|
848
|
+
return;
|
|
882
849
|
}
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
850
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
if (event) {
|
|
889
|
-
event.preventDefault();
|
|
851
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
|
852
|
+
throw new TypeError(`No method named "${config}"`);
|
|
890
853
|
}
|
|
891
854
|
|
|
892
|
-
|
|
893
|
-
};
|
|
855
|
+
data[config](this);
|
|
856
|
+
});
|
|
894
857
|
}
|
|
895
858
|
|
|
896
859
|
}
|
|
@@ -901,7 +864,7 @@ class Alert extends BaseComponent {
|
|
|
901
864
|
*/
|
|
902
865
|
|
|
903
866
|
|
|
904
|
-
|
|
867
|
+
enableDismissTrigger(Alert, 'close');
|
|
905
868
|
/**
|
|
906
869
|
* ------------------------------------------------------------------------
|
|
907
870
|
* jQuery
|
|
@@ -913,7 +876,7 @@ defineJQueryPlugin(Alert);
|
|
|
913
876
|
|
|
914
877
|
/**
|
|
915
878
|
* --------------------------------------------------------------------------
|
|
916
|
-
* CoreUI (v4.
|
|
879
|
+
* CoreUI (v4.1.1): alert.js
|
|
917
880
|
* Licensed under MIT (https://coreui.io/license)
|
|
918
881
|
*
|
|
919
882
|
* This component is a modified version of the Bootstrap's button.js
|
|
@@ -926,13 +889,13 @@ defineJQueryPlugin(Alert);
|
|
|
926
889
|
* ------------------------------------------------------------------------
|
|
927
890
|
*/
|
|
928
891
|
|
|
929
|
-
const NAME$
|
|
930
|
-
const DATA_KEY$
|
|
931
|
-
const EVENT_KEY$
|
|
892
|
+
const NAME$e = 'button';
|
|
893
|
+
const DATA_KEY$d = 'coreui.button';
|
|
894
|
+
const EVENT_KEY$d = `.${DATA_KEY$d}`;
|
|
932
895
|
const DATA_API_KEY$9 = '.data-api';
|
|
933
896
|
const CLASS_NAME_ACTIVE$4 = 'active';
|
|
934
897
|
const SELECTOR_DATA_TOGGLE$6 = '[data-coreui-toggle="button"]';
|
|
935
|
-
const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$
|
|
898
|
+
const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$d}${DATA_API_KEY$9}`;
|
|
936
899
|
/**
|
|
937
900
|
* ------------------------------------------------------------------------
|
|
938
901
|
* Class Definition
|
|
@@ -942,7 +905,7 @@ const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$c}${DATA_API_KEY$9}`;
|
|
|
942
905
|
class Button extends BaseComponent {
|
|
943
906
|
// Getters
|
|
944
907
|
static get NAME() {
|
|
945
|
-
return NAME$
|
|
908
|
+
return NAME$e;
|
|
946
909
|
} // Public
|
|
947
910
|
|
|
948
911
|
|
|
@@ -987,7 +950,7 @@ defineJQueryPlugin(Button);
|
|
|
987
950
|
|
|
988
951
|
/**
|
|
989
952
|
* --------------------------------------------------------------------------
|
|
990
|
-
* CoreUI (v4.
|
|
953
|
+
* CoreUI (v4.1.1): dom/manipulator.js
|
|
991
954
|
* Licensed under MIT (https://coreui.io/license)
|
|
992
955
|
*
|
|
993
956
|
* This component is a modified version of the Bootstrap's dom/manipulator.js
|
|
@@ -1048,8 +1011,8 @@ const Manipulator = {
|
|
|
1048
1011
|
offset(element) {
|
|
1049
1012
|
const rect = element.getBoundingClientRect();
|
|
1050
1013
|
return {
|
|
1051
|
-
top: rect.top +
|
|
1052
|
-
left: rect.left +
|
|
1014
|
+
top: rect.top + window.pageYOffset,
|
|
1015
|
+
left: rect.left + window.pageXOffset
|
|
1053
1016
|
};
|
|
1054
1017
|
},
|
|
1055
1018
|
|
|
@@ -1064,7 +1027,80 @@ const Manipulator = {
|
|
|
1064
1027
|
|
|
1065
1028
|
/**
|
|
1066
1029
|
* --------------------------------------------------------------------------
|
|
1067
|
-
* CoreUI (v4.
|
|
1030
|
+
* CoreUI (v4.1.1): dom/selector-engine.js
|
|
1031
|
+
* Licensed under MIT (https://coreui.io/license)
|
|
1032
|
+
*
|
|
1033
|
+
* This component is a modified version of the Bootstrap's dom/selector-engine.js
|
|
1034
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
1035
|
+
* --------------------------------------------------------------------------
|
|
1036
|
+
*/
|
|
1037
|
+
const NODE_TEXT = 3;
|
|
1038
|
+
const SelectorEngine = {
|
|
1039
|
+
find(selector, element = document.documentElement) {
|
|
1040
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
|
1041
|
+
},
|
|
1042
|
+
|
|
1043
|
+
findOne(selector, element = document.documentElement) {
|
|
1044
|
+
return Element.prototype.querySelector.call(element, selector);
|
|
1045
|
+
},
|
|
1046
|
+
|
|
1047
|
+
children(element, selector) {
|
|
1048
|
+
return [].concat(...element.children).filter(child => child.matches(selector));
|
|
1049
|
+
},
|
|
1050
|
+
|
|
1051
|
+
parents(element, selector) {
|
|
1052
|
+
const parents = [];
|
|
1053
|
+
let ancestor = element.parentNode;
|
|
1054
|
+
|
|
1055
|
+
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
|
1056
|
+
if (ancestor.matches(selector)) {
|
|
1057
|
+
parents.push(ancestor);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
ancestor = ancestor.parentNode;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
return parents;
|
|
1064
|
+
},
|
|
1065
|
+
|
|
1066
|
+
prev(element, selector) {
|
|
1067
|
+
let previous = element.previousElementSibling;
|
|
1068
|
+
|
|
1069
|
+
while (previous) {
|
|
1070
|
+
if (previous.matches(selector)) {
|
|
1071
|
+
return [previous];
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
previous = previous.previousElementSibling;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
return [];
|
|
1078
|
+
},
|
|
1079
|
+
|
|
1080
|
+
next(element, selector) {
|
|
1081
|
+
let next = element.nextElementSibling;
|
|
1082
|
+
|
|
1083
|
+
while (next) {
|
|
1084
|
+
if (next.matches(selector)) {
|
|
1085
|
+
return [next];
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
next = next.nextElementSibling;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return [];
|
|
1092
|
+
},
|
|
1093
|
+
|
|
1094
|
+
focusableChildren(element) {
|
|
1095
|
+
const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
|
|
1096
|
+
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* --------------------------------------------------------------------------
|
|
1103
|
+
* CoreUI (v4.1.1): carousel.js
|
|
1068
1104
|
* Licensed under MIT (https://coreui.io/license)
|
|
1069
1105
|
*
|
|
1070
1106
|
* This component is a modified version of the Bootstrap's carousel.js
|
|
@@ -1077,16 +1113,16 @@ const Manipulator = {
|
|
|
1077
1113
|
* ------------------------------------------------------------------------
|
|
1078
1114
|
*/
|
|
1079
1115
|
|
|
1080
|
-
const NAME$
|
|
1081
|
-
const DATA_KEY$
|
|
1082
|
-
const EVENT_KEY$
|
|
1116
|
+
const NAME$d = 'carousel';
|
|
1117
|
+
const DATA_KEY$c = 'coreui.carousel';
|
|
1118
|
+
const EVENT_KEY$c = `.${DATA_KEY$c}`;
|
|
1083
1119
|
const DATA_API_KEY$8 = '.data-api';
|
|
1084
1120
|
const ARROW_LEFT_KEY = 'ArrowLeft';
|
|
1085
1121
|
const ARROW_RIGHT_KEY = 'ArrowRight';
|
|
1086
1122
|
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
|
1087
1123
|
|
|
1088
1124
|
const SWIPE_THRESHOLD = 40;
|
|
1089
|
-
const Default$
|
|
1125
|
+
const Default$c = {
|
|
1090
1126
|
interval: 5000,
|
|
1091
1127
|
keyboard: true,
|
|
1092
1128
|
slide: false,
|
|
@@ -1094,7 +1130,7 @@ const Default$b = {
|
|
|
1094
1130
|
wrap: true,
|
|
1095
1131
|
touch: true
|
|
1096
1132
|
};
|
|
1097
|
-
const DefaultType$
|
|
1133
|
+
const DefaultType$c = {
|
|
1098
1134
|
interval: '(number|boolean)',
|
|
1099
1135
|
keyboard: 'boolean',
|
|
1100
1136
|
slide: '(boolean|string)',
|
|
@@ -1110,19 +1146,19 @@ const KEY_TO_DIRECTION = {
|
|
|
1110
1146
|
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
|
|
1111
1147
|
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
|
|
1112
1148
|
};
|
|
1113
|
-
const EVENT_SLIDE = `slide${EVENT_KEY$
|
|
1114
|
-
const EVENT_SLID = `slid${EVENT_KEY$
|
|
1115
|
-
const EVENT_KEYDOWN = `keydown${EVENT_KEY$
|
|
1116
|
-
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$
|
|
1117
|
-
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$
|
|
1118
|
-
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$
|
|
1119
|
-
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$
|
|
1120
|
-
const EVENT_TOUCHEND = `touchend${EVENT_KEY$
|
|
1121
|
-
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$
|
|
1122
|
-
const EVENT_POINTERUP = `pointerup${EVENT_KEY$
|
|
1123
|
-
const EVENT_DRAG_START = `dragstart${EVENT_KEY$
|
|
1124
|
-
const EVENT_LOAD_DATA_API$4 = `load${EVENT_KEY$
|
|
1125
|
-
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$
|
|
1149
|
+
const EVENT_SLIDE = `slide${EVENT_KEY$c}`;
|
|
1150
|
+
const EVENT_SLID = `slid${EVENT_KEY$c}`;
|
|
1151
|
+
const EVENT_KEYDOWN = `keydown${EVENT_KEY$c}`;
|
|
1152
|
+
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$c}`;
|
|
1153
|
+
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$c}`;
|
|
1154
|
+
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$c}`;
|
|
1155
|
+
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$c}`;
|
|
1156
|
+
const EVENT_TOUCHEND = `touchend${EVENT_KEY$c}`;
|
|
1157
|
+
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$c}`;
|
|
1158
|
+
const EVENT_POINTERUP = `pointerup${EVENT_KEY$c}`;
|
|
1159
|
+
const EVENT_DRAG_START = `dragstart${EVENT_KEY$c}`;
|
|
1160
|
+
const EVENT_LOAD_DATA_API$4 = `load${EVENT_KEY$c}${DATA_API_KEY$8}`;
|
|
1161
|
+
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$c}${DATA_API_KEY$8}`;
|
|
1126
1162
|
const CLASS_NAME_CAROUSEL = 'carousel';
|
|
1127
1163
|
const CLASS_NAME_ACTIVE$3 = 'active';
|
|
1128
1164
|
const CLASS_NAME_SLIDE = 'slide';
|
|
@@ -1169,11 +1205,11 @@ class Carousel extends BaseComponent {
|
|
|
1169
1205
|
|
|
1170
1206
|
|
|
1171
1207
|
static get Default() {
|
|
1172
|
-
return Default$
|
|
1208
|
+
return Default$c;
|
|
1173
1209
|
}
|
|
1174
1210
|
|
|
1175
1211
|
static get NAME() {
|
|
1176
|
-
return NAME$
|
|
1212
|
+
return NAME$d;
|
|
1177
1213
|
} // Public
|
|
1178
1214
|
|
|
1179
1215
|
|
|
@@ -1251,11 +1287,11 @@ class Carousel extends BaseComponent {
|
|
|
1251
1287
|
|
|
1252
1288
|
|
|
1253
1289
|
_getConfig(config) {
|
|
1254
|
-
config = { ...Default$
|
|
1290
|
+
config = { ...Default$c,
|
|
1255
1291
|
...Manipulator.getDataAttributes(this._element),
|
|
1256
1292
|
...(typeof config === 'object' ? config : {})
|
|
1257
1293
|
};
|
|
1258
|
-
typeCheckConfig(NAME$
|
|
1294
|
+
typeCheckConfig(NAME$d, config, DefaultType$c);
|
|
1259
1295
|
return config;
|
|
1260
1296
|
}
|
|
1261
1297
|
|
|
@@ -1292,8 +1328,12 @@ class Carousel extends BaseComponent {
|
|
|
1292
1328
|
}
|
|
1293
1329
|
|
|
1294
1330
|
_addTouchEventListeners() {
|
|
1331
|
+
const hasPointerPenTouch = event => {
|
|
1332
|
+
return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1295
1335
|
const start = event => {
|
|
1296
|
-
if (
|
|
1336
|
+
if (hasPointerPenTouch(event)) {
|
|
1297
1337
|
this.touchStartX = event.clientX;
|
|
1298
1338
|
} else if (!this._pointerEvent) {
|
|
1299
1339
|
this.touchStartX = event.touches[0].clientX;
|
|
@@ -1306,7 +1346,7 @@ class Carousel extends BaseComponent {
|
|
|
1306
1346
|
};
|
|
1307
1347
|
|
|
1308
1348
|
const end = event => {
|
|
1309
|
-
if (
|
|
1349
|
+
if (hasPointerPenTouch(event)) {
|
|
1310
1350
|
this.touchDeltaX = event.clientX - this.touchStartX;
|
|
1311
1351
|
}
|
|
1312
1352
|
|
|
@@ -1331,7 +1371,7 @@ class Carousel extends BaseComponent {
|
|
|
1331
1371
|
};
|
|
1332
1372
|
|
|
1333
1373
|
SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
|
|
1334
|
-
EventHandler.on(itemImg, EVENT_DRAG_START,
|
|
1374
|
+
EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
|
|
1335
1375
|
});
|
|
1336
1376
|
|
|
1337
1377
|
if (this._pointerEvent) {
|
|
@@ -1388,7 +1428,7 @@ class Carousel extends BaseComponent {
|
|
|
1388
1428
|
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
|
|
1389
1429
|
activeIndicator.classList.remove(CLASS_NAME_ACTIVE$3);
|
|
1390
1430
|
activeIndicator.removeAttribute('aria-current');
|
|
1391
|
-
const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
|
|
1431
|
+
const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement); // eslint-disable-next-line unicorn/no-for-loop
|
|
1392
1432
|
|
|
1393
1433
|
for (let i = 0; i < indicators.length; i++) {
|
|
1394
1434
|
if (Number.parseInt(indicators[i].getAttribute('data-coreui-slide-to'), 10) === this._getItemIndex(element)) {
|
|
@@ -1612,7 +1652,7 @@ defineJQueryPlugin(Carousel);
|
|
|
1612
1652
|
|
|
1613
1653
|
/**
|
|
1614
1654
|
* --------------------------------------------------------------------------
|
|
1615
|
-
* CoreUI (v4.
|
|
1655
|
+
* CoreUI (v4.1.1): collapse.js
|
|
1616
1656
|
* Licensed under MIT (https://coreui.io/license)
|
|
1617
1657
|
*
|
|
1618
1658
|
* This component is a modified version of the Bootstrap's collapse.js
|
|
@@ -1625,30 +1665,32 @@ defineJQueryPlugin(Carousel);
|
|
|
1625
1665
|
* ------------------------------------------------------------------------
|
|
1626
1666
|
*/
|
|
1627
1667
|
|
|
1628
|
-
const NAME$
|
|
1629
|
-
const DATA_KEY$
|
|
1630
|
-
const EVENT_KEY$
|
|
1668
|
+
const NAME$c = 'collapse';
|
|
1669
|
+
const DATA_KEY$b = 'coreui.collapse';
|
|
1670
|
+
const EVENT_KEY$b = `.${DATA_KEY$b}`;
|
|
1631
1671
|
const DATA_API_KEY$7 = '.data-api';
|
|
1632
|
-
const Default$
|
|
1672
|
+
const Default$b = {
|
|
1633
1673
|
toggle: true,
|
|
1634
|
-
parent:
|
|
1674
|
+
parent: null
|
|
1635
1675
|
};
|
|
1636
|
-
const DefaultType$
|
|
1676
|
+
const DefaultType$b = {
|
|
1637
1677
|
toggle: 'boolean',
|
|
1638
|
-
parent: '(
|
|
1678
|
+
parent: '(null|element)'
|
|
1639
1679
|
};
|
|
1640
|
-
const EVENT_SHOW$6 = `show${EVENT_KEY$
|
|
1641
|
-
const EVENT_SHOWN$6 = `shown${EVENT_KEY$
|
|
1642
|
-
const EVENT_HIDE$6 = `hide${EVENT_KEY$
|
|
1643
|
-
const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$
|
|
1644
|
-
const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$
|
|
1645
|
-
const CLASS_NAME_SHOW$
|
|
1680
|
+
const EVENT_SHOW$6 = `show${EVENT_KEY$b}`;
|
|
1681
|
+
const EVENT_SHOWN$6 = `shown${EVENT_KEY$b}`;
|
|
1682
|
+
const EVENT_HIDE$6 = `hide${EVENT_KEY$b}`;
|
|
1683
|
+
const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$b}`;
|
|
1684
|
+
const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
|
|
1685
|
+
const CLASS_NAME_SHOW$9 = 'show';
|
|
1646
1686
|
const CLASS_NAME_COLLAPSE = 'collapse';
|
|
1647
1687
|
const CLASS_NAME_COLLAPSING = 'collapsing';
|
|
1648
1688
|
const CLASS_NAME_COLLAPSED = 'collapsed';
|
|
1689
|
+
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
|
1690
|
+
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
|
1649
1691
|
const WIDTH = 'width';
|
|
1650
1692
|
const HEIGHT = 'height';
|
|
1651
|
-
const SELECTOR_ACTIVES = '.show, .collapsing';
|
|
1693
|
+
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
|
|
1652
1694
|
const SELECTOR_DATA_TOGGLE$5 = '[data-coreui-toggle="collapse"]';
|
|
1653
1695
|
/**
|
|
1654
1696
|
* ------------------------------------------------------------------------
|
|
@@ -1661,7 +1703,7 @@ class Collapse extends BaseComponent {
|
|
|
1661
1703
|
super(element);
|
|
1662
1704
|
this._isTransitioning = false;
|
|
1663
1705
|
this._config = this._getConfig(config);
|
|
1664
|
-
this._triggerArray =
|
|
1706
|
+
this._triggerArray = [];
|
|
1665
1707
|
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$5);
|
|
1666
1708
|
|
|
1667
1709
|
for (let i = 0, len = toggleList.length; i < len; i++) {
|
|
@@ -1676,10 +1718,10 @@ class Collapse extends BaseComponent {
|
|
|
1676
1718
|
}
|
|
1677
1719
|
}
|
|
1678
1720
|
|
|
1679
|
-
this.
|
|
1721
|
+
this._initializeChildren();
|
|
1680
1722
|
|
|
1681
1723
|
if (!this._config.parent) {
|
|
1682
|
-
this._addAriaAndCollapsedClass(this.
|
|
1724
|
+
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
|
1683
1725
|
}
|
|
1684
1726
|
|
|
1685
1727
|
if (this._config.toggle) {
|
|
@@ -1689,16 +1731,16 @@ class Collapse extends BaseComponent {
|
|
|
1689
1731
|
|
|
1690
1732
|
|
|
1691
1733
|
static get Default() {
|
|
1692
|
-
return Default$
|
|
1734
|
+
return Default$b;
|
|
1693
1735
|
}
|
|
1694
1736
|
|
|
1695
1737
|
static get NAME() {
|
|
1696
|
-
return NAME$
|
|
1738
|
+
return NAME$c;
|
|
1697
1739
|
} // Public
|
|
1698
1740
|
|
|
1699
1741
|
|
|
1700
1742
|
toggle() {
|
|
1701
|
-
if (this.
|
|
1743
|
+
if (this._isShown()) {
|
|
1702
1744
|
this.hide();
|
|
1703
1745
|
} else {
|
|
1704
1746
|
this.show();
|
|
@@ -1706,30 +1748,21 @@ class Collapse extends BaseComponent {
|
|
|
1706
1748
|
}
|
|
1707
1749
|
|
|
1708
1750
|
show() {
|
|
1709
|
-
if (this._isTransitioning || this.
|
|
1751
|
+
if (this._isTransitioning || this._isShown()) {
|
|
1710
1752
|
return;
|
|
1711
1753
|
}
|
|
1712
1754
|
|
|
1713
|
-
let actives;
|
|
1755
|
+
let actives = [];
|
|
1714
1756
|
let activesData;
|
|
1715
1757
|
|
|
1716
|
-
if (this.
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
return elem.getAttribute('data-coreui-parent') === this._config.parent;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
|
1723
|
-
});
|
|
1724
|
-
|
|
1725
|
-
if (actives.length === 0) {
|
|
1726
|
-
actives = null;
|
|
1727
|
-
}
|
|
1758
|
+
if (this._config.parent) {
|
|
1759
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
|
1760
|
+
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
|
|
1728
1761
|
}
|
|
1729
1762
|
|
|
1730
1763
|
const container = SelectorEngine.findOne(this._selector);
|
|
1731
1764
|
|
|
1732
|
-
if (actives) {
|
|
1765
|
+
if (actives.length) {
|
|
1733
1766
|
const tempActiveData = actives.find(elem => container !== elem);
|
|
1734
1767
|
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
|
|
1735
1768
|
|
|
@@ -1744,17 +1777,17 @@ class Collapse extends BaseComponent {
|
|
|
1744
1777
|
return;
|
|
1745
1778
|
}
|
|
1746
1779
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
}
|
|
1780
|
+
actives.forEach(elemActive => {
|
|
1781
|
+
if (container !== elemActive) {
|
|
1782
|
+
Collapse.getOrCreateInstance(elemActive, {
|
|
1783
|
+
toggle: false
|
|
1784
|
+
}).hide();
|
|
1785
|
+
}
|
|
1752
1786
|
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
}
|
|
1787
|
+
if (!activesData) {
|
|
1788
|
+
Data.set(elemActive, DATA_KEY$b, null);
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1758
1791
|
|
|
1759
1792
|
const dimension = this._getDimension();
|
|
1760
1793
|
|
|
@@ -1764,22 +1797,18 @@ class Collapse extends BaseComponent {
|
|
|
1764
1797
|
|
|
1765
1798
|
this._element.style[dimension] = 0;
|
|
1766
1799
|
|
|
1767
|
-
|
|
1768
|
-
this._triggerArray.forEach(element => {
|
|
1769
|
-
element.classList.remove(CLASS_NAME_COLLAPSED);
|
|
1770
|
-
element.setAttribute('aria-expanded', true);
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1800
|
+
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
|
1773
1801
|
|
|
1774
|
-
this.
|
|
1802
|
+
this._isTransitioning = true;
|
|
1775
1803
|
|
|
1776
1804
|
const complete = () => {
|
|
1805
|
+
this._isTransitioning = false;
|
|
1806
|
+
|
|
1777
1807
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
1778
1808
|
|
|
1779
|
-
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
|
1809
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
|
|
1780
1810
|
|
|
1781
1811
|
this._element.style[dimension] = '';
|
|
1782
|
-
this.setTransitioning(false);
|
|
1783
1812
|
EventHandler.trigger(this._element, EVENT_SHOWN$6);
|
|
1784
1813
|
};
|
|
1785
1814
|
|
|
@@ -1792,7 +1821,7 @@ class Collapse extends BaseComponent {
|
|
|
1792
1821
|
}
|
|
1793
1822
|
|
|
1794
1823
|
hide() {
|
|
1795
|
-
if (this._isTransitioning || !this.
|
|
1824
|
+
if (this._isTransitioning || !this._isShown()) {
|
|
1796
1825
|
return;
|
|
1797
1826
|
}
|
|
1798
1827
|
|
|
@@ -1809,26 +1838,23 @@ class Collapse extends BaseComponent {
|
|
|
1809
1838
|
|
|
1810
1839
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
|
1811
1840
|
|
|
1812
|
-
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
|
1841
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
|
|
1813
1842
|
|
|
1814
1843
|
const triggerArrayLength = this._triggerArray.length;
|
|
1815
1844
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
const elem = getElementFromSelector(trigger);
|
|
1845
|
+
for (let i = 0; i < triggerArrayLength; i++) {
|
|
1846
|
+
const trigger = this._triggerArray[i];
|
|
1847
|
+
const elem = getElementFromSelector(trigger);
|
|
1820
1848
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
trigger.setAttribute('aria-expanded', false);
|
|
1824
|
-
}
|
|
1849
|
+
if (elem && !this._isShown(elem)) {
|
|
1850
|
+
this._addAriaAndCollapsedClass([trigger], false);
|
|
1825
1851
|
}
|
|
1826
1852
|
}
|
|
1827
1853
|
|
|
1828
|
-
this.
|
|
1854
|
+
this._isTransitioning = true;
|
|
1829
1855
|
|
|
1830
1856
|
const complete = () => {
|
|
1831
|
-
this.
|
|
1857
|
+
this._isTransitioning = false;
|
|
1832
1858
|
|
|
1833
1859
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
1834
1860
|
|
|
@@ -1842,45 +1868,47 @@ class Collapse extends BaseComponent {
|
|
|
1842
1868
|
this._queueCallback(complete, this._element, true);
|
|
1843
1869
|
}
|
|
1844
1870
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1871
|
+
_isShown(element = this._element) {
|
|
1872
|
+
return element.classList.contains(CLASS_NAME_SHOW$9);
|
|
1847
1873
|
} // Private
|
|
1848
1874
|
|
|
1849
1875
|
|
|
1850
1876
|
_getConfig(config) {
|
|
1851
|
-
config = { ...Default$
|
|
1877
|
+
config = { ...Default$b,
|
|
1878
|
+
...Manipulator.getDataAttributes(this._element),
|
|
1852
1879
|
...config
|
|
1853
1880
|
};
|
|
1854
1881
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
|
1855
1882
|
|
|
1856
|
-
|
|
1883
|
+
config.parent = getElement(config.parent);
|
|
1884
|
+
typeCheckConfig(NAME$c, config, DefaultType$b);
|
|
1857
1885
|
return config;
|
|
1858
1886
|
}
|
|
1859
1887
|
|
|
1860
1888
|
_getDimension() {
|
|
1861
|
-
return this._element.classList.contains(
|
|
1889
|
+
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
|
1862
1890
|
}
|
|
1863
1891
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
const
|
|
1870
|
-
SelectorEngine.find(
|
|
1892
|
+
_initializeChildren() {
|
|
1893
|
+
if (!this._config.parent) {
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
|
1898
|
+
SelectorEngine.find(SELECTOR_DATA_TOGGLE$5, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
|
|
1871
1899
|
const selected = getElementFromSelector(element);
|
|
1872
1900
|
|
|
1873
|
-
|
|
1901
|
+
if (selected) {
|
|
1902
|
+
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
|
1903
|
+
}
|
|
1874
1904
|
});
|
|
1875
|
-
return parent;
|
|
1876
1905
|
}
|
|
1877
1906
|
|
|
1878
|
-
_addAriaAndCollapsedClass(
|
|
1879
|
-
if (!
|
|
1907
|
+
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
|
1908
|
+
if (!triggerArray.length) {
|
|
1880
1909
|
return;
|
|
1881
1910
|
}
|
|
1882
1911
|
|
|
1883
|
-
const isOpen = element.classList.contains(CLASS_NAME_SHOW$a);
|
|
1884
1912
|
triggerArray.forEach(elem => {
|
|
1885
1913
|
if (isOpen) {
|
|
1886
1914
|
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
|
@@ -1893,33 +1921,23 @@ class Collapse extends BaseComponent {
|
|
|
1893
1921
|
} // Static
|
|
1894
1922
|
|
|
1895
1923
|
|
|
1896
|
-
static
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
...Manipulator.getDataAttributes(element),
|
|
1900
|
-
...(typeof config === 'object' && config ? config : {})
|
|
1901
|
-
};
|
|
1902
|
-
|
|
1903
|
-
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
|
1904
|
-
_config.toggle = false;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
if (!data) {
|
|
1908
|
-
data = new Collapse(element, _config);
|
|
1909
|
-
}
|
|
1924
|
+
static jQueryInterface(config) {
|
|
1925
|
+
return this.each(function () {
|
|
1926
|
+
const _config = {};
|
|
1910
1927
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
throw new TypeError(`No method named "${config}"`);
|
|
1928
|
+
if (typeof config === 'string' && /show|hide/.test(config)) {
|
|
1929
|
+
_config.toggle = false;
|
|
1914
1930
|
}
|
|
1915
1931
|
|
|
1916
|
-
data
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1932
|
+
const data = Collapse.getOrCreateInstance(this, _config);
|
|
1919
1933
|
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1934
|
+
if (typeof config === 'string') {
|
|
1935
|
+
if (typeof data[config] === 'undefined') {
|
|
1936
|
+
throw new TypeError(`No method named "${config}"`);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
data[config]();
|
|
1940
|
+
}
|
|
1923
1941
|
});
|
|
1924
1942
|
}
|
|
1925
1943
|
|
|
@@ -1937,26 +1955,12 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, functi
|
|
|
1937
1955
|
event.preventDefault();
|
|
1938
1956
|
}
|
|
1939
1957
|
|
|
1940
|
-
const triggerData = Manipulator.getDataAttributes(this);
|
|
1941
1958
|
const selector = getSelectorFromElement(this);
|
|
1942
1959
|
const selectorElements = SelectorEngine.find(selector);
|
|
1943
1960
|
selectorElements.forEach(element => {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
if (data) {
|
|
1948
|
-
// update parent attribute
|
|
1949
|
-
if (data._parent === null && typeof triggerData.parent === 'string') {
|
|
1950
|
-
data._config.parent = triggerData.parent;
|
|
1951
|
-
data._parent = data._getParent();
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
config = 'toggle';
|
|
1955
|
-
} else {
|
|
1956
|
-
config = triggerData;
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
|
-
Collapse.collapseInterface(element, config);
|
|
1961
|
+
Collapse.getOrCreateInstance(element, {
|
|
1962
|
+
toggle: false
|
|
1963
|
+
}).toggle();
|
|
1960
1964
|
});
|
|
1961
1965
|
});
|
|
1962
1966
|
/**
|
|
@@ -1970,7 +1974,7 @@ defineJQueryPlugin(Collapse);
|
|
|
1970
1974
|
|
|
1971
1975
|
/**
|
|
1972
1976
|
* --------------------------------------------------------------------------
|
|
1973
|
-
* CoreUI (v4.
|
|
1977
|
+
* CoreUI (v4.1.1): dropdown.js
|
|
1974
1978
|
* Licensed under MIT (https://coreui.io/license)
|
|
1975
1979
|
*
|
|
1976
1980
|
* This component is a modified version of the Bootstrap's dropdown.js
|
|
@@ -1983,27 +1987,26 @@ defineJQueryPlugin(Collapse);
|
|
|
1983
1987
|
* ------------------------------------------------------------------------
|
|
1984
1988
|
*/
|
|
1985
1989
|
|
|
1986
|
-
const NAME$
|
|
1987
|
-
const DATA_KEY$
|
|
1988
|
-
const EVENT_KEY$
|
|
1990
|
+
const NAME$b = 'dropdown';
|
|
1991
|
+
const DATA_KEY$a = 'coreui.dropdown';
|
|
1992
|
+
const EVENT_KEY$a = `.${DATA_KEY$a}`;
|
|
1989
1993
|
const DATA_API_KEY$6 = '.data-api';
|
|
1990
1994
|
const ESCAPE_KEY$2 = 'Escape';
|
|
1991
1995
|
const SPACE_KEY = 'Space';
|
|
1992
|
-
const TAB_KEY = 'Tab';
|
|
1996
|
+
const TAB_KEY$1 = 'Tab';
|
|
1993
1997
|
const ARROW_UP_KEY = 'ArrowUp';
|
|
1994
1998
|
const ARROW_DOWN_KEY = 'ArrowDown';
|
|
1995
1999
|
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
|
1996
2000
|
|
|
1997
2001
|
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
|
|
1998
|
-
const EVENT_HIDE$5 = `hide${EVENT_KEY$
|
|
1999
|
-
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$
|
|
2000
|
-
const EVENT_SHOW$5 = `show${EVENT_KEY$
|
|
2001
|
-
const EVENT_SHOWN$5 = `shown${EVENT_KEY$
|
|
2002
|
-
const
|
|
2003
|
-
const
|
|
2004
|
-
const
|
|
2005
|
-
const
|
|
2006
|
-
const CLASS_NAME_SHOW$9 = 'show';
|
|
2002
|
+
const EVENT_HIDE$5 = `hide${EVENT_KEY$a}`;
|
|
2003
|
+
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$a}`;
|
|
2004
|
+
const EVENT_SHOW$5 = `show${EVENT_KEY$a}`;
|
|
2005
|
+
const EVENT_SHOWN$5 = `shown${EVENT_KEY$a}`;
|
|
2006
|
+
const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
2007
|
+
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
2008
|
+
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
2009
|
+
const CLASS_NAME_SHOW$8 = 'show';
|
|
2007
2010
|
const CLASS_NAME_DROPUP = 'dropup';
|
|
2008
2011
|
const CLASS_NAME_DROPEND = 'dropend';
|
|
2009
2012
|
const CLASS_NAME_DROPSTART = 'dropstart';
|
|
@@ -2018,7 +2021,7 @@ const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
|
|
|
2018
2021
|
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
|
2019
2022
|
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
|
2020
2023
|
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
|
2021
|
-
const Default$
|
|
2024
|
+
const Default$a = {
|
|
2022
2025
|
offset: [0, 2],
|
|
2023
2026
|
boundary: 'clippingParents',
|
|
2024
2027
|
reference: 'toggle',
|
|
@@ -2026,7 +2029,7 @@ const Default$9 = {
|
|
|
2026
2029
|
popperConfig: null,
|
|
2027
2030
|
autoClose: true
|
|
2028
2031
|
};
|
|
2029
|
-
const DefaultType$
|
|
2032
|
+
const DefaultType$a = {
|
|
2030
2033
|
offset: '(array|string|function)',
|
|
2031
2034
|
boundary: '(string|element)',
|
|
2032
2035
|
reference: '(string|element|object)',
|
|
@@ -2047,45 +2050,31 @@ class Dropdown extends BaseComponent {
|
|
|
2047
2050
|
this._config = this._getConfig(config);
|
|
2048
2051
|
this._menu = this._getMenuElement();
|
|
2049
2052
|
this._inNavbar = this._detectNavbar();
|
|
2050
|
-
|
|
2051
|
-
this._addEventListeners();
|
|
2052
2053
|
} // Getters
|
|
2053
2054
|
|
|
2054
2055
|
|
|
2055
2056
|
static get Default() {
|
|
2056
|
-
return Default$
|
|
2057
|
+
return Default$a;
|
|
2057
2058
|
}
|
|
2058
2059
|
|
|
2059
2060
|
static get DefaultType() {
|
|
2060
|
-
return DefaultType$
|
|
2061
|
+
return DefaultType$a;
|
|
2061
2062
|
}
|
|
2062
2063
|
|
|
2063
2064
|
static get NAME() {
|
|
2064
|
-
return NAME$
|
|
2065
|
+
return NAME$b;
|
|
2065
2066
|
} // Public
|
|
2066
2067
|
|
|
2067
2068
|
|
|
2068
|
-
toggle() {
|
|
2069
|
-
|
|
2070
|
-
return;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
const isActive = this._element.classList.contains(CLASS_NAME_SHOW$9);
|
|
2074
|
-
|
|
2075
|
-
if (isActive) {
|
|
2076
|
-
this.hide();
|
|
2077
|
-
return;
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
this.show();
|
|
2069
|
+
toggle() {
|
|
2070
|
+
return this._isShown() ? this.hide() : this.show();
|
|
2081
2071
|
}
|
|
2082
2072
|
|
|
2083
2073
|
show() {
|
|
2084
|
-
if (isDisabled(this._element) || this._menu
|
|
2074
|
+
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
|
2085
2075
|
return;
|
|
2086
2076
|
}
|
|
2087
2077
|
|
|
2088
|
-
const parent = Dropdown.getParentFromElement(this._element);
|
|
2089
2078
|
const relatedTarget = {
|
|
2090
2079
|
relatedTarget: this._element
|
|
2091
2080
|
};
|
|
@@ -2093,34 +2082,14 @@ class Dropdown extends BaseComponent {
|
|
|
2093
2082
|
|
|
2094
2083
|
if (showEvent.defaultPrevented) {
|
|
2095
2084
|
return;
|
|
2096
|
-
}
|
|
2085
|
+
}
|
|
2097
2086
|
|
|
2087
|
+
const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
|
|
2098
2088
|
|
|
2099
2089
|
if (this._inNavbar) {
|
|
2100
2090
|
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
|
|
2101
2091
|
} else {
|
|
2102
|
-
|
|
2103
|
-
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
let referenceElement = this._element;
|
|
2107
|
-
|
|
2108
|
-
if (this._config.reference === 'parent') {
|
|
2109
|
-
referenceElement = parent;
|
|
2110
|
-
} else if (isElement(this._config.reference)) {
|
|
2111
|
-
referenceElement = getElement(this._config.reference);
|
|
2112
|
-
} else if (typeof this._config.reference === 'object') {
|
|
2113
|
-
referenceElement = this._config.reference;
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
const popperConfig = this._getPopperConfig();
|
|
2117
|
-
|
|
2118
|
-
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
|
2119
|
-
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
|
|
2120
|
-
|
|
2121
|
-
if (isDisplayStatic) {
|
|
2122
|
-
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
|
|
2123
|
-
}
|
|
2092
|
+
this._createPopper(parent);
|
|
2124
2093
|
} // If this is a touch-enabled device we add extra
|
|
2125
2094
|
// empty mouseover listeners to the body's immediate children;
|
|
2126
2095
|
// only needed because of broken event delegation on iOS
|
|
@@ -2135,15 +2104,15 @@ class Dropdown extends BaseComponent {
|
|
|
2135
2104
|
|
|
2136
2105
|
this._element.setAttribute('aria-expanded', true);
|
|
2137
2106
|
|
|
2138
|
-
this._menu.classList.
|
|
2107
|
+
this._menu.classList.add(CLASS_NAME_SHOW$8);
|
|
2139
2108
|
|
|
2140
|
-
this._element.classList.
|
|
2109
|
+
this._element.classList.add(CLASS_NAME_SHOW$8);
|
|
2141
2110
|
|
|
2142
2111
|
EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
|
|
2143
2112
|
}
|
|
2144
2113
|
|
|
2145
2114
|
hide() {
|
|
2146
|
-
if (isDisabled(this._element) || !this._menu
|
|
2115
|
+
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
|
2147
2116
|
return;
|
|
2148
2117
|
}
|
|
2149
2118
|
|
|
@@ -2171,13 +2140,6 @@ class Dropdown extends BaseComponent {
|
|
|
2171
2140
|
} // Private
|
|
2172
2141
|
|
|
2173
2142
|
|
|
2174
|
-
_addEventListeners() {
|
|
2175
|
-
EventHandler.on(this._element, EVENT_CLICK, event => {
|
|
2176
|
-
event.preventDefault();
|
|
2177
|
-
this.toggle();
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
2143
|
_completeHide(relatedTarget) {
|
|
2182
2144
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
|
|
2183
2145
|
|
|
@@ -2195,9 +2157,9 @@ class Dropdown extends BaseComponent {
|
|
|
2195
2157
|
this._popper.destroy();
|
|
2196
2158
|
}
|
|
2197
2159
|
|
|
2198
|
-
this._menu.classList.remove(CLASS_NAME_SHOW$
|
|
2160
|
+
this._menu.classList.remove(CLASS_NAME_SHOW$8);
|
|
2199
2161
|
|
|
2200
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
2162
|
+
this._element.classList.remove(CLASS_NAME_SHOW$8);
|
|
2201
2163
|
|
|
2202
2164
|
this._element.setAttribute('aria-expanded', 'false');
|
|
2203
2165
|
|
|
@@ -2210,16 +2172,45 @@ class Dropdown extends BaseComponent {
|
|
|
2210
2172
|
...Manipulator.getDataAttributes(this._element),
|
|
2211
2173
|
...config
|
|
2212
2174
|
};
|
|
2213
|
-
typeCheckConfig(NAME$
|
|
2175
|
+
typeCheckConfig(NAME$b, config, this.constructor.DefaultType);
|
|
2214
2176
|
|
|
2215
2177
|
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
|
|
2216
2178
|
// Popper virtual elements require a getBoundingClientRect method
|
|
2217
|
-
throw new TypeError(`${NAME$
|
|
2179
|
+
throw new TypeError(`${NAME$b.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
|
2218
2180
|
}
|
|
2219
2181
|
|
|
2220
2182
|
return config;
|
|
2221
2183
|
}
|
|
2222
2184
|
|
|
2185
|
+
_createPopper(parent) {
|
|
2186
|
+
if (typeof Popper === 'undefined') {
|
|
2187
|
+
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
let referenceElement = this._element;
|
|
2191
|
+
|
|
2192
|
+
if (this._config.reference === 'parent') {
|
|
2193
|
+
referenceElement = parent;
|
|
2194
|
+
} else if (isElement(this._config.reference)) {
|
|
2195
|
+
referenceElement = getElement(this._config.reference);
|
|
2196
|
+
} else if (typeof this._config.reference === 'object') {
|
|
2197
|
+
referenceElement = this._config.reference;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
const popperConfig = this._getPopperConfig();
|
|
2201
|
+
|
|
2202
|
+
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
|
2203
|
+
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
|
|
2204
|
+
|
|
2205
|
+
if (isDisplayStatic) {
|
|
2206
|
+
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
_isShown(element = this._element) {
|
|
2211
|
+
return element.classList.contains(CLASS_NAME_SHOW$8);
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2223
2214
|
_getMenuElement() {
|
|
2224
2215
|
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
|
|
2225
2216
|
}
|
|
@@ -2309,26 +2300,24 @@ class Dropdown extends BaseComponent {
|
|
|
2309
2300
|
} // Static
|
|
2310
2301
|
|
|
2311
2302
|
|
|
2312
|
-
static
|
|
2313
|
-
|
|
2303
|
+
static jQueryInterface(config) {
|
|
2304
|
+
return this.each(function () {
|
|
2305
|
+
const data = Dropdown.getOrCreateInstance(this, config);
|
|
2306
|
+
|
|
2307
|
+
if (typeof config !== 'string') {
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2314
2310
|
|
|
2315
|
-
if (typeof config === 'string') {
|
|
2316
2311
|
if (typeof data[config] === 'undefined') {
|
|
2317
2312
|
throw new TypeError(`No method named "${config}"`);
|
|
2318
2313
|
}
|
|
2319
2314
|
|
|
2320
2315
|
data[config]();
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
|
-
static jQueryInterface(config) {
|
|
2325
|
-
return this.each(function () {
|
|
2326
|
-
Dropdown.dropdownInterface(this, config);
|
|
2327
2316
|
});
|
|
2328
2317
|
}
|
|
2329
2318
|
|
|
2330
2319
|
static clearMenus(event) {
|
|
2331
|
-
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
|
|
2320
|
+
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
|
|
2332
2321
|
return;
|
|
2333
2322
|
}
|
|
2334
2323
|
|
|
@@ -2341,7 +2330,7 @@ class Dropdown extends BaseComponent {
|
|
|
2341
2330
|
continue;
|
|
2342
2331
|
}
|
|
2343
2332
|
|
|
2344
|
-
if (!context.
|
|
2333
|
+
if (!context._isShown()) {
|
|
2345
2334
|
continue;
|
|
2346
2335
|
}
|
|
2347
2336
|
|
|
@@ -2358,7 +2347,7 @@ class Dropdown extends BaseComponent {
|
|
|
2358
2347
|
} // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
|
|
2359
2348
|
|
|
2360
2349
|
|
|
2361
|
-
if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
|
2350
|
+
if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
|
2362
2351
|
continue;
|
|
2363
2352
|
}
|
|
2364
2353
|
|
|
@@ -2387,7 +2376,7 @@ class Dropdown extends BaseComponent {
|
|
|
2387
2376
|
return;
|
|
2388
2377
|
}
|
|
2389
2378
|
|
|
2390
|
-
const isActive = this.classList.contains(CLASS_NAME_SHOW$
|
|
2379
|
+
const isActive = this.classList.contains(CLASS_NAME_SHOW$8);
|
|
2391
2380
|
|
|
2392
2381
|
if (!isActive && event.key === ESCAPE_KEY$2) {
|
|
2393
2382
|
return;
|
|
@@ -2400,20 +2389,20 @@ class Dropdown extends BaseComponent {
|
|
|
2400
2389
|
return;
|
|
2401
2390
|
}
|
|
2402
2391
|
|
|
2403
|
-
const getToggleButton =
|
|
2392
|
+
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$4) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$4)[0];
|
|
2393
|
+
const instance = Dropdown.getOrCreateInstance(getToggleButton);
|
|
2404
2394
|
|
|
2405
2395
|
if (event.key === ESCAPE_KEY$2) {
|
|
2406
|
-
|
|
2407
|
-
Dropdown.clearMenus();
|
|
2396
|
+
instance.hide();
|
|
2408
2397
|
return;
|
|
2409
2398
|
}
|
|
2410
2399
|
|
|
2411
2400
|
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
|
2412
2401
|
if (!isActive) {
|
|
2413
|
-
|
|
2402
|
+
instance.show();
|
|
2414
2403
|
}
|
|
2415
2404
|
|
|
2416
|
-
|
|
2405
|
+
instance._selectMenuItem(event);
|
|
2417
2406
|
|
|
2418
2407
|
return;
|
|
2419
2408
|
}
|
|
@@ -2437,7 +2426,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, Dropdown.clearMenus);
|
|
|
2437
2426
|
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
|
2438
2427
|
EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$4, function (event) {
|
|
2439
2428
|
event.preventDefault();
|
|
2440
|
-
Dropdown.
|
|
2429
|
+
Dropdown.getOrCreateInstance(this).toggle();
|
|
2441
2430
|
});
|
|
2442
2431
|
/**
|
|
2443
2432
|
* ------------------------------------------------------------------------
|
|
@@ -2450,7 +2439,7 @@ defineJQueryPlugin(Dropdown);
|
|
|
2450
2439
|
|
|
2451
2440
|
/**
|
|
2452
2441
|
* --------------------------------------------------------------------------
|
|
2453
|
-
* Bootstrap (v5.
|
|
2442
|
+
* Bootstrap (v5.1.3): util/scrollBar.js
|
|
2454
2443
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2455
2444
|
* --------------------------------------------------------------------------
|
|
2456
2445
|
*/
|
|
@@ -2554,11 +2543,12 @@ class ScrollBarHelper {
|
|
|
2554
2543
|
|
|
2555
2544
|
/**
|
|
2556
2545
|
* --------------------------------------------------------------------------
|
|
2557
|
-
* Bootstrap (v5.
|
|
2558
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/
|
|
2546
|
+
* Bootstrap (v5.1.3): util/backdrop.js
|
|
2547
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2559
2548
|
* --------------------------------------------------------------------------
|
|
2560
2549
|
*/
|
|
2561
|
-
const Default$
|
|
2550
|
+
const Default$9 = {
|
|
2551
|
+
className: 'modal-backdrop',
|
|
2562
2552
|
isVisible: true,
|
|
2563
2553
|
// if false, we use the backdrop helper without adding any element to the dom
|
|
2564
2554
|
isAnimated: false,
|
|
@@ -2566,17 +2556,17 @@ const Default$8 = {
|
|
|
2566
2556
|
// give the choice to place backdrop under different elements
|
|
2567
2557
|
clickCallback: null
|
|
2568
2558
|
};
|
|
2569
|
-
const DefaultType$
|
|
2559
|
+
const DefaultType$9 = {
|
|
2560
|
+
className: 'string',
|
|
2570
2561
|
isVisible: 'boolean',
|
|
2571
2562
|
isAnimated: 'boolean',
|
|
2572
2563
|
rootElement: '(element|string)',
|
|
2573
2564
|
clickCallback: '(function|null)'
|
|
2574
2565
|
};
|
|
2575
|
-
const NAME$
|
|
2576
|
-
const
|
|
2577
|
-
const
|
|
2578
|
-
const
|
|
2579
|
-
const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$9}`;
|
|
2566
|
+
const NAME$a = 'backdrop';
|
|
2567
|
+
const CLASS_NAME_FADE$4 = 'fade';
|
|
2568
|
+
const CLASS_NAME_SHOW$7 = 'show';
|
|
2569
|
+
const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$a}`;
|
|
2580
2570
|
|
|
2581
2571
|
class Backdrop {
|
|
2582
2572
|
constructor(config) {
|
|
@@ -2597,7 +2587,7 @@ class Backdrop {
|
|
|
2597
2587
|
reflow(this._getElement());
|
|
2598
2588
|
}
|
|
2599
2589
|
|
|
2600
|
-
this._getElement().classList.add(CLASS_NAME_SHOW$
|
|
2590
|
+
this._getElement().classList.add(CLASS_NAME_SHOW$7);
|
|
2601
2591
|
|
|
2602
2592
|
this._emulateAnimation(() => {
|
|
2603
2593
|
execute(callback);
|
|
@@ -2610,7 +2600,7 @@ class Backdrop {
|
|
|
2610
2600
|
return;
|
|
2611
2601
|
}
|
|
2612
2602
|
|
|
2613
|
-
this._getElement().classList.remove(CLASS_NAME_SHOW$
|
|
2603
|
+
this._getElement().classList.remove(CLASS_NAME_SHOW$7);
|
|
2614
2604
|
|
|
2615
2605
|
this._emulateAnimation(() => {
|
|
2616
2606
|
this.dispose();
|
|
@@ -2622,10 +2612,10 @@ class Backdrop {
|
|
|
2622
2612
|
_getElement() {
|
|
2623
2613
|
if (!this._element) {
|
|
2624
2614
|
const backdrop = document.createElement('div');
|
|
2625
|
-
backdrop.className =
|
|
2615
|
+
backdrop.className = this._config.className;
|
|
2626
2616
|
|
|
2627
2617
|
if (this._config.isAnimated) {
|
|
2628
|
-
backdrop.classList.add(CLASS_NAME_FADE$
|
|
2618
|
+
backdrop.classList.add(CLASS_NAME_FADE$4);
|
|
2629
2619
|
}
|
|
2630
2620
|
|
|
2631
2621
|
this._element = backdrop;
|
|
@@ -2635,12 +2625,12 @@ class Backdrop {
|
|
|
2635
2625
|
}
|
|
2636
2626
|
|
|
2637
2627
|
_getConfig(config) {
|
|
2638
|
-
config = { ...Default$
|
|
2628
|
+
config = { ...Default$9,
|
|
2639
2629
|
...(typeof config === 'object' ? config : {})
|
|
2640
2630
|
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
|
|
2641
2631
|
|
|
2642
2632
|
config.rootElement = getElement(config.rootElement);
|
|
2643
|
-
typeCheckConfig(NAME$
|
|
2633
|
+
typeCheckConfig(NAME$a, config, DefaultType$9);
|
|
2644
2634
|
return config;
|
|
2645
2635
|
}
|
|
2646
2636
|
|
|
@@ -2649,7 +2639,7 @@ class Backdrop {
|
|
|
2649
2639
|
return;
|
|
2650
2640
|
}
|
|
2651
2641
|
|
|
2652
|
-
this._config.rootElement.
|
|
2642
|
+
this._config.rootElement.append(this._getElement());
|
|
2653
2643
|
|
|
2654
2644
|
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
|
|
2655
2645
|
execute(this._config.clickCallback);
|
|
@@ -2677,7 +2667,110 @@ class Backdrop {
|
|
|
2677
2667
|
|
|
2678
2668
|
/**
|
|
2679
2669
|
* --------------------------------------------------------------------------
|
|
2680
|
-
|
|
2670
|
+
* Bootstrap (v5.1.3): util/focustrap.js
|
|
2671
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2672
|
+
* --------------------------------------------------------------------------
|
|
2673
|
+
*/
|
|
2674
|
+
const Default$8 = {
|
|
2675
|
+
trapElement: null,
|
|
2676
|
+
// The element to trap focus inside of
|
|
2677
|
+
autofocus: true
|
|
2678
|
+
};
|
|
2679
|
+
const DefaultType$8 = {
|
|
2680
|
+
trapElement: 'element',
|
|
2681
|
+
autofocus: 'boolean'
|
|
2682
|
+
};
|
|
2683
|
+
const NAME$9 = 'focustrap';
|
|
2684
|
+
const DATA_KEY$9 = 'coreui.focustrap';
|
|
2685
|
+
const EVENT_KEY$9 = `.${DATA_KEY$9}`;
|
|
2686
|
+
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$9}`;
|
|
2687
|
+
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$9}`;
|
|
2688
|
+
const TAB_KEY = 'Tab';
|
|
2689
|
+
const TAB_NAV_FORWARD = 'forward';
|
|
2690
|
+
const TAB_NAV_BACKWARD = 'backward';
|
|
2691
|
+
|
|
2692
|
+
class FocusTrap {
|
|
2693
|
+
constructor(config) {
|
|
2694
|
+
this._config = this._getConfig(config);
|
|
2695
|
+
this._isActive = false;
|
|
2696
|
+
this._lastTabNavDirection = null;
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
activate() {
|
|
2700
|
+
const {
|
|
2701
|
+
trapElement,
|
|
2702
|
+
autofocus
|
|
2703
|
+
} = this._config;
|
|
2704
|
+
|
|
2705
|
+
if (this._isActive) {
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
if (autofocus) {
|
|
2710
|
+
trapElement.focus();
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
EventHandler.off(document, EVENT_KEY$9); // guard against infinite focus loop
|
|
2714
|
+
|
|
2715
|
+
EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
|
|
2716
|
+
EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
|
2717
|
+
this._isActive = true;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
deactivate() {
|
|
2721
|
+
if (!this._isActive) {
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
this._isActive = false;
|
|
2726
|
+
EventHandler.off(document, EVENT_KEY$9);
|
|
2727
|
+
} // Private
|
|
2728
|
+
|
|
2729
|
+
|
|
2730
|
+
_handleFocusin(event) {
|
|
2731
|
+
const {
|
|
2732
|
+
target
|
|
2733
|
+
} = event;
|
|
2734
|
+
const {
|
|
2735
|
+
trapElement
|
|
2736
|
+
} = this._config;
|
|
2737
|
+
|
|
2738
|
+
if (target === document || target === trapElement || trapElement.contains(target)) {
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
const elements = SelectorEngine.focusableChildren(trapElement);
|
|
2743
|
+
|
|
2744
|
+
if (elements.length === 0) {
|
|
2745
|
+
trapElement.focus();
|
|
2746
|
+
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
|
2747
|
+
elements[elements.length - 1].focus();
|
|
2748
|
+
} else {
|
|
2749
|
+
elements[0].focus();
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
_handleKeydown(event) {
|
|
2754
|
+
if (event.key !== TAB_KEY) {
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
_getConfig(config) {
|
|
2762
|
+
config = { ...Default$8,
|
|
2763
|
+
...(typeof config === 'object' ? config : {})
|
|
2764
|
+
};
|
|
2765
|
+
typeCheckConfig(NAME$9, config, DefaultType$8);
|
|
2766
|
+
return config;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* --------------------------------------------------------------------------
|
|
2773
|
+
* CoreUI (v4.1.1): modal.js
|
|
2681
2774
|
* Licensed under MIT (https://coreui.io/license)
|
|
2682
2775
|
*
|
|
2683
2776
|
* This component is a modified version of the Bootstrap's modal.js
|
|
@@ -2710,21 +2803,20 @@ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$8}`;
|
|
|
2710
2803
|
const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
|
|
2711
2804
|
const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
|
|
2712
2805
|
const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
|
|
2713
|
-
const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$8}`;
|
|
2714
2806
|
const EVENT_RESIZE$1 = `resize${EVENT_KEY$8}`;
|
|
2715
|
-
const EVENT_CLICK_DISMISS
|
|
2807
|
+
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$8}`;
|
|
2716
2808
|
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$8}`;
|
|
2717
2809
|
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$8}`;
|
|
2718
2810
|
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$8}`;
|
|
2719
2811
|
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
|
|
2720
2812
|
const CLASS_NAME_OPEN = 'modal-open';
|
|
2721
|
-
const CLASS_NAME_FADE$
|
|
2722
|
-
const CLASS_NAME_SHOW$
|
|
2813
|
+
const CLASS_NAME_FADE$3 = 'fade';
|
|
2814
|
+
const CLASS_NAME_SHOW$6 = 'show';
|
|
2723
2815
|
const CLASS_NAME_STATIC = 'modal-static';
|
|
2816
|
+
const OPEN_SELECTOR$1 = '.modal.show';
|
|
2724
2817
|
const SELECTOR_DIALOG = '.modal-dialog';
|
|
2725
2818
|
const SELECTOR_MODAL_BODY = '.modal-body';
|
|
2726
2819
|
const SELECTOR_DATA_TOGGLE$3 = '[data-coreui-toggle="modal"]';
|
|
2727
|
-
const SELECTOR_DATA_DISMISS$2 = '[data-coreui-dismiss="modal"]';
|
|
2728
2820
|
/**
|
|
2729
2821
|
* ------------------------------------------------------------------------
|
|
2730
2822
|
* Class Definition
|
|
@@ -2737,6 +2829,7 @@ class Modal extends BaseComponent {
|
|
|
2737
2829
|
this._config = this._getConfig(config);
|
|
2738
2830
|
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
|
|
2739
2831
|
this._backdrop = this._initializeBackDrop();
|
|
2832
|
+
this._focustrap = this._initializeFocusTrap();
|
|
2740
2833
|
this._isShown = false;
|
|
2741
2834
|
this._ignoreBackdropClick = false;
|
|
2742
2835
|
this._isTransitioning = false;
|
|
@@ -2786,7 +2879,6 @@ class Modal extends BaseComponent {
|
|
|
2786
2879
|
|
|
2787
2880
|
this._setResizeEvent();
|
|
2788
2881
|
|
|
2789
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
|
|
2790
2882
|
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
|
2791
2883
|
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
|
2792
2884
|
if (event.target === this._element) {
|
|
@@ -2798,11 +2890,7 @@ class Modal extends BaseComponent {
|
|
|
2798
2890
|
this._showBackdrop(() => this._showElement(relatedTarget));
|
|
2799
2891
|
}
|
|
2800
2892
|
|
|
2801
|
-
hide(
|
|
2802
|
-
if (event && ['A', 'AREA'].includes(event.target.tagName)) {
|
|
2803
|
-
event.preventDefault();
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2893
|
+
hide() {
|
|
2806
2894
|
if (!this._isShown || this._isTransitioning) {
|
|
2807
2895
|
return;
|
|
2808
2896
|
}
|
|
@@ -2825,11 +2913,11 @@ class Modal extends BaseComponent {
|
|
|
2825
2913
|
|
|
2826
2914
|
this._setResizeEvent();
|
|
2827
2915
|
|
|
2828
|
-
|
|
2916
|
+
this._focustrap.deactivate();
|
|
2829
2917
|
|
|
2830
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
2918
|
+
this._element.classList.remove(CLASS_NAME_SHOW$6);
|
|
2831
2919
|
|
|
2832
|
-
EventHandler.off(this._element, EVENT_CLICK_DISMISS
|
|
2920
|
+
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
|
2833
2921
|
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
|
2834
2922
|
|
|
2835
2923
|
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
|
|
@@ -2840,14 +2928,9 @@ class Modal extends BaseComponent {
|
|
|
2840
2928
|
|
|
2841
2929
|
this._backdrop.dispose();
|
|
2842
2930
|
|
|
2843
|
-
|
|
2844
|
-
/**
|
|
2845
|
-
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
|
2846
|
-
* Do not move `document` in `htmlElements` array
|
|
2847
|
-
* It will remove `EVENT_CLICK_DATA_API` event that should remain
|
|
2848
|
-
*/
|
|
2931
|
+
this._focustrap.deactivate();
|
|
2849
2932
|
|
|
2850
|
-
|
|
2933
|
+
super.dispose();
|
|
2851
2934
|
}
|
|
2852
2935
|
|
|
2853
2936
|
handleUpdate() {
|
|
@@ -2863,6 +2946,12 @@ class Modal extends BaseComponent {
|
|
|
2863
2946
|
});
|
|
2864
2947
|
}
|
|
2865
2948
|
|
|
2949
|
+
_initializeFocusTrap() {
|
|
2950
|
+
return new FocusTrap({
|
|
2951
|
+
trapElement: this._element
|
|
2952
|
+
});
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2866
2955
|
_getConfig(config) {
|
|
2867
2956
|
config = { ...Default$7,
|
|
2868
2957
|
...Manipulator.getDataAttributes(this._element),
|
|
@@ -2879,7 +2968,7 @@ class Modal extends BaseComponent {
|
|
|
2879
2968
|
|
|
2880
2969
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
|
2881
2970
|
// Don't move modal's DOM position
|
|
2882
|
-
document.body.
|
|
2971
|
+
document.body.append(this._element);
|
|
2883
2972
|
}
|
|
2884
2973
|
|
|
2885
2974
|
this._element.style.display = 'block';
|
|
@@ -2900,15 +2989,11 @@ class Modal extends BaseComponent {
|
|
|
2900
2989
|
reflow(this._element);
|
|
2901
2990
|
}
|
|
2902
2991
|
|
|
2903
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
|
2904
|
-
|
|
2905
|
-
if (this._config.focus) {
|
|
2906
|
-
this._enforceFocus();
|
|
2907
|
-
}
|
|
2992
|
+
this._element.classList.add(CLASS_NAME_SHOW$6);
|
|
2908
2993
|
|
|
2909
2994
|
const transitionComplete = () => {
|
|
2910
2995
|
if (this._config.focus) {
|
|
2911
|
-
this.
|
|
2996
|
+
this._focustrap.activate();
|
|
2912
2997
|
}
|
|
2913
2998
|
|
|
2914
2999
|
this._isTransitioning = false;
|
|
@@ -2920,16 +3005,6 @@ class Modal extends BaseComponent {
|
|
|
2920
3005
|
this._queueCallback(transitionComplete, this._dialog, isAnimated);
|
|
2921
3006
|
}
|
|
2922
3007
|
|
|
2923
|
-
_enforceFocus() {
|
|
2924
|
-
EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop
|
|
2925
|
-
|
|
2926
|
-
EventHandler.on(document, EVENT_FOCUSIN$2, event => {
|
|
2927
|
-
if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
|
|
2928
|
-
this._element.focus();
|
|
2929
|
-
}
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
3008
|
_setEscapeEvent() {
|
|
2934
3009
|
if (this._isShown) {
|
|
2935
3010
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
|
|
@@ -2976,7 +3051,7 @@ class Modal extends BaseComponent {
|
|
|
2976
3051
|
}
|
|
2977
3052
|
|
|
2978
3053
|
_showBackdrop(callback) {
|
|
2979
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS
|
|
3054
|
+
EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
|
|
2980
3055
|
if (this._ignoreBackdropClick) {
|
|
2981
3056
|
this._ignoreBackdropClick = false;
|
|
2982
3057
|
return;
|
|
@@ -2997,7 +3072,7 @@ class Modal extends BaseComponent {
|
|
|
2997
3072
|
}
|
|
2998
3073
|
|
|
2999
3074
|
_isAnimated() {
|
|
3000
|
-
return this._element.classList.contains(CLASS_NAME_FADE$
|
|
3075
|
+
return this._element.classList.contains(CLASS_NAME_FADE$3);
|
|
3001
3076
|
}
|
|
3002
3077
|
|
|
3003
3078
|
_triggerBackdropTransition() {
|
|
@@ -3104,10 +3179,18 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$3, functi
|
|
|
3104
3179
|
this.focus();
|
|
3105
3180
|
}
|
|
3106
3181
|
});
|
|
3107
|
-
});
|
|
3182
|
+
}); // avoid conflict when clicking moddal toggler while another one is open
|
|
3183
|
+
|
|
3184
|
+
const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
|
|
3185
|
+
|
|
3186
|
+
if (allReadyOpen) {
|
|
3187
|
+
Modal.getInstance(allReadyOpen).hide();
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3108
3190
|
const data = Modal.getOrCreateInstance(target);
|
|
3109
3191
|
data.toggle(this);
|
|
3110
3192
|
});
|
|
3193
|
+
enableDismissTrigger(Modal);
|
|
3111
3194
|
/**
|
|
3112
3195
|
* ------------------------------------------------------------------------
|
|
3113
3196
|
* jQuery
|
|
@@ -3119,7 +3202,7 @@ defineJQueryPlugin(Modal);
|
|
|
3119
3202
|
|
|
3120
3203
|
/**
|
|
3121
3204
|
* --------------------------------------------------------------------------
|
|
3122
|
-
* CoreUI (v4.
|
|
3205
|
+
* CoreUI (v4.1.1): navigation.js
|
|
3123
3206
|
* Licensed under MIT (https://coreui.io/license)
|
|
3124
3207
|
* --------------------------------------------------------------------------
|
|
3125
3208
|
*/
|
|
@@ -3142,7 +3225,7 @@ const DefaultType$6 = {
|
|
|
3142
3225
|
groupsAutoCollapse: '(string|boolean)'
|
|
3143
3226
|
};
|
|
3144
3227
|
const CLASS_NAME_ACTIVE$2 = 'active';
|
|
3145
|
-
const CLASS_NAME_SHOW$
|
|
3228
|
+
const CLASS_NAME_SHOW$5 = 'show';
|
|
3146
3229
|
const CLASS_NAME_NAV_GROUP = 'nav-group';
|
|
3147
3230
|
const CLASS_NAME_NAV_GROUP_TOGGLE = 'nav-group-toggle';
|
|
3148
3231
|
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
|
|
@@ -3181,6 +3264,10 @@ class Navigation extends BaseComponent {
|
|
|
3181
3264
|
|
|
3182
3265
|
static get DefaultType() {
|
|
3183
3266
|
return DefaultType$6;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
static get NAME() {
|
|
3270
|
+
return NAME$7;
|
|
3184
3271
|
} // Private
|
|
3185
3272
|
|
|
3186
3273
|
|
|
@@ -3215,7 +3302,7 @@ class Navigation extends BaseComponent {
|
|
|
3215
3302
|
if (this._config.activeLinksExact && element.href === currentUrl) {
|
|
3216
3303
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3217
3304
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3218
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3305
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3219
3306
|
element.setAttribute('aria-expanded', true);
|
|
3220
3307
|
});
|
|
3221
3308
|
}
|
|
@@ -3223,7 +3310,7 @@ class Navigation extends BaseComponent {
|
|
|
3223
3310
|
if (!this._config.activeLinksExact && element.href.startsWith(currentUrl)) {
|
|
3224
3311
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3225
3312
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3226
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3313
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3227
3314
|
element.setAttribute('aria-expanded', true);
|
|
3228
3315
|
});
|
|
3229
3316
|
}
|
|
@@ -3322,28 +3409,28 @@ class Navigation extends BaseComponent {
|
|
|
3322
3409
|
toggler = toggler.closest(SELECTOR_NAV_GROUP_TOGGLE);
|
|
3323
3410
|
}
|
|
3324
3411
|
|
|
3325
|
-
const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$
|
|
3412
|
+
const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$5)); // Close other groups
|
|
3326
3413
|
|
|
3327
3414
|
|
|
3328
3415
|
if (this._config.groupsAutoCollapse === true) {
|
|
3329
3416
|
this._getSiblings(toggler.parentNode, filter).forEach(element => {
|
|
3330
3417
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, element), () => {
|
|
3331
|
-
element.classList.remove(CLASS_NAME_SHOW$
|
|
3418
|
+
element.classList.remove(CLASS_NAME_SHOW$5);
|
|
3332
3419
|
element.setAttribute('aria-expanded', false);
|
|
3333
3420
|
});
|
|
3334
3421
|
});
|
|
3335
3422
|
}
|
|
3336
3423
|
|
|
3337
|
-
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$
|
|
3424
|
+
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$5)) {
|
|
3338
3425
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode), () => {
|
|
3339
|
-
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$
|
|
3426
|
+
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$5);
|
|
3340
3427
|
toggler.parentNode.setAttribute('aria-expanded', false);
|
|
3341
3428
|
});
|
|
3342
3429
|
|
|
3343
3430
|
return;
|
|
3344
3431
|
}
|
|
3345
3432
|
|
|
3346
|
-
toggler.parentNode.classList.add(CLASS_NAME_SHOW$
|
|
3433
|
+
toggler.parentNode.classList.add(CLASS_NAME_SHOW$5);
|
|
3347
3434
|
toggler.parentNode.setAttribute('aria-expanded', true);
|
|
3348
3435
|
|
|
3349
3436
|
this._slideDown(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode));
|
|
@@ -3396,11 +3483,11 @@ EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
|
|
|
3396
3483
|
* add .Navigation to jQuery only if jQuery is present
|
|
3397
3484
|
*/
|
|
3398
3485
|
|
|
3399
|
-
defineJQueryPlugin(
|
|
3486
|
+
defineJQueryPlugin(Navigation);
|
|
3400
3487
|
|
|
3401
3488
|
/**
|
|
3402
3489
|
* --------------------------------------------------------------------------
|
|
3403
|
-
* CoreUI (v4.
|
|
3490
|
+
* CoreUI (v4.1.1): dropdown.js
|
|
3404
3491
|
* Licensed under MIT (https://coreui.io/license)
|
|
3405
3492
|
*
|
|
3406
3493
|
* This component is a modified version of the Bootstrap's offcanvas.js
|
|
@@ -3429,17 +3516,15 @@ const DefaultType$5 = {
|
|
|
3429
3516
|
keyboard: 'boolean',
|
|
3430
3517
|
scroll: 'boolean'
|
|
3431
3518
|
};
|
|
3432
|
-
const CLASS_NAME_SHOW$
|
|
3519
|
+
const CLASS_NAME_SHOW$4 = 'show';
|
|
3520
|
+
const CLASS_NAME_BACKDROP$1 = 'offcanvas-backdrop';
|
|
3433
3521
|
const OPEN_SELECTOR = '.offcanvas.show';
|
|
3434
3522
|
const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
|
|
3435
3523
|
const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
|
|
3436
3524
|
const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
|
|
3437
3525
|
const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
|
|
3438
|
-
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
|
|
3439
3526
|
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
|
|
3440
|
-
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$6}`;
|
|
3441
3527
|
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
|
|
3442
|
-
const SELECTOR_DATA_DISMISS$1 = '[data-coreui-dismiss="offcanvas"]';
|
|
3443
3528
|
const SELECTOR_DATA_TOGGLE$2 = '[data-coreui-toggle="offcanvas"]';
|
|
3444
3529
|
/**
|
|
3445
3530
|
* ------------------------------------------------------------------------
|
|
@@ -3453,6 +3538,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3453
3538
|
this._config = this._getConfig(config);
|
|
3454
3539
|
this._isShown = false;
|
|
3455
3540
|
this._backdrop = this._initializeBackDrop();
|
|
3541
|
+
this._focustrap = this._initializeFocusTrap();
|
|
3456
3542
|
|
|
3457
3543
|
this._addEventListeners();
|
|
3458
3544
|
} // Getters
|
|
@@ -3491,8 +3577,6 @@ class Offcanvas extends BaseComponent {
|
|
|
3491
3577
|
|
|
3492
3578
|
if (!this._config.scroll) {
|
|
3493
3579
|
new ScrollBarHelper().hide();
|
|
3494
|
-
|
|
3495
|
-
this._enforceFocusOnElement(this._element);
|
|
3496
3580
|
}
|
|
3497
3581
|
|
|
3498
3582
|
this._element.removeAttribute('aria-hidden');
|
|
@@ -3501,9 +3585,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3501
3585
|
|
|
3502
3586
|
this._element.setAttribute('role', 'dialog');
|
|
3503
3587
|
|
|
3504
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
|
3588
|
+
this._element.classList.add(CLASS_NAME_SHOW$4);
|
|
3505
3589
|
|
|
3506
3590
|
const completeCallBack = () => {
|
|
3591
|
+
if (!this._config.scroll) {
|
|
3592
|
+
this._focustrap.activate();
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3507
3595
|
EventHandler.trigger(this._element, EVENT_SHOWN$3, {
|
|
3508
3596
|
relatedTarget
|
|
3509
3597
|
});
|
|
@@ -3523,13 +3611,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3523
3611
|
return;
|
|
3524
3612
|
}
|
|
3525
3613
|
|
|
3526
|
-
|
|
3614
|
+
this._focustrap.deactivate();
|
|
3527
3615
|
|
|
3528
3616
|
this._element.blur();
|
|
3529
3617
|
|
|
3530
3618
|
this._isShown = false;
|
|
3531
3619
|
|
|
3532
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
3620
|
+
this._element.classList.remove(CLASS_NAME_SHOW$4);
|
|
3533
3621
|
|
|
3534
3622
|
this._backdrop.hide();
|
|
3535
3623
|
|
|
@@ -3555,8 +3643,9 @@ class Offcanvas extends BaseComponent {
|
|
|
3555
3643
|
dispose() {
|
|
3556
3644
|
this._backdrop.dispose();
|
|
3557
3645
|
|
|
3646
|
+
this._focustrap.deactivate();
|
|
3647
|
+
|
|
3558
3648
|
super.dispose();
|
|
3559
|
-
EventHandler.off(document, EVENT_FOCUSIN$1);
|
|
3560
3649
|
} // Private
|
|
3561
3650
|
|
|
3562
3651
|
|
|
@@ -3571,6 +3660,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3571
3660
|
|
|
3572
3661
|
_initializeBackDrop() {
|
|
3573
3662
|
return new Backdrop({
|
|
3663
|
+
className: CLASS_NAME_BACKDROP$1,
|
|
3574
3664
|
isVisible: this._config.backdrop,
|
|
3575
3665
|
isAnimated: true,
|
|
3576
3666
|
rootElement: this._element.parentNode,
|
|
@@ -3578,19 +3668,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3578
3668
|
});
|
|
3579
3669
|
}
|
|
3580
3670
|
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
EventHandler.on(document, EVENT_FOCUSIN$1, event => {
|
|
3585
|
-
if (document !== event.target && element !== event.target && !element.contains(event.target)) {
|
|
3586
|
-
element.focus();
|
|
3587
|
-
}
|
|
3671
|
+
_initializeFocusTrap() {
|
|
3672
|
+
return new FocusTrap({
|
|
3673
|
+
trapElement: this._element
|
|
3588
3674
|
});
|
|
3589
|
-
element.focus();
|
|
3590
3675
|
}
|
|
3591
3676
|
|
|
3592
3677
|
_addEventListeners() {
|
|
3593
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
|
|
3594
3678
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
|
3595
3679
|
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
|
3596
3680
|
this.hide();
|
|
@@ -3651,6 +3735,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
|
|
|
3651
3735
|
data.toggle(this);
|
|
3652
3736
|
});
|
|
3653
3737
|
EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
|
|
3738
|
+
enableDismissTrigger(Offcanvas);
|
|
3654
3739
|
/**
|
|
3655
3740
|
* ------------------------------------------------------------------------
|
|
3656
3741
|
* jQuery
|
|
@@ -3661,45 +3746,45 @@ defineJQueryPlugin(Offcanvas);
|
|
|
3661
3746
|
|
|
3662
3747
|
/**
|
|
3663
3748
|
* --------------------------------------------------------------------------
|
|
3664
|
-
* CoreUI (v4.
|
|
3749
|
+
* CoreUI (v4.1.1): alert.js
|
|
3665
3750
|
* Licensed under MIT (https://coreui.io/license)
|
|
3666
3751
|
*
|
|
3667
3752
|
* This component is a modified version of the Bootstrap's util/sanitizer.js
|
|
3668
3753
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
3669
3754
|
* --------------------------------------------------------------------------
|
|
3670
3755
|
*/
|
|
3671
|
-
const
|
|
3756
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
|
3672
3757
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
3673
3758
|
/**
|
|
3674
3759
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
3675
3760
|
*
|
|
3676
|
-
* Shoutout to Angular
|
|
3761
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3677
3762
|
*/
|
|
3678
3763
|
|
|
3679
|
-
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3764
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3680
3765
|
/**
|
|
3681
3766
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
3682
3767
|
*
|
|
3683
|
-
* Shoutout to Angular
|
|
3768
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3684
3769
|
*/
|
|
3685
3770
|
|
|
3686
3771
|
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;
|
|
3687
3772
|
|
|
3688
|
-
const allowedAttribute = (
|
|
3689
|
-
const
|
|
3773
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
3774
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
|
3690
3775
|
|
|
3691
|
-
if (allowedAttributeList.includes(
|
|
3692
|
-
if (
|
|
3693
|
-
return Boolean(SAFE_URL_PATTERN.test(
|
|
3776
|
+
if (allowedAttributeList.includes(attributeName)) {
|
|
3777
|
+
if (uriAttributes.has(attributeName)) {
|
|
3778
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
|
|
3694
3779
|
}
|
|
3695
3780
|
|
|
3696
3781
|
return true;
|
|
3697
3782
|
}
|
|
3698
3783
|
|
|
3699
|
-
const regExp = allowedAttributeList.filter(
|
|
3784
|
+
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
|
|
3700
3785
|
|
|
3701
3786
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
|
3702
|
-
if (regExp[i].test(
|
|
3787
|
+
if (regExp[i].test(attributeName)) {
|
|
3703
3788
|
return true;
|
|
3704
3789
|
}
|
|
3705
3790
|
}
|
|
@@ -3751,23 +3836,22 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3751
3836
|
|
|
3752
3837
|
const domParser = new window.DOMParser();
|
|
3753
3838
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
3754
|
-
const allowlistKeys = Object.keys(allowList);
|
|
3755
3839
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
|
3756
3840
|
|
|
3757
3841
|
for (let i = 0, len = elements.length; i < len; i++) {
|
|
3758
|
-
const
|
|
3759
|
-
const
|
|
3842
|
+
const element = elements[i];
|
|
3843
|
+
const elementName = element.nodeName.toLowerCase();
|
|
3760
3844
|
|
|
3761
|
-
if (!
|
|
3762
|
-
|
|
3845
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
3846
|
+
element.remove();
|
|
3763
3847
|
continue;
|
|
3764
3848
|
}
|
|
3765
3849
|
|
|
3766
|
-
const attributeList = [].concat(...
|
|
3767
|
-
const allowedAttributes = [].concat(allowList['*'] || [], allowList[
|
|
3768
|
-
attributeList.forEach(
|
|
3769
|
-
if (!allowedAttribute(
|
|
3770
|
-
|
|
3850
|
+
const attributeList = [].concat(...element.attributes);
|
|
3851
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
|
3852
|
+
attributeList.forEach(attribute => {
|
|
3853
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
|
3854
|
+
element.removeAttribute(attribute.nodeName);
|
|
3771
3855
|
}
|
|
3772
3856
|
});
|
|
3773
3857
|
}
|
|
@@ -3777,7 +3861,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3777
3861
|
|
|
3778
3862
|
/**
|
|
3779
3863
|
* --------------------------------------------------------------------------
|
|
3780
|
-
* CoreUI (v4.
|
|
3864
|
+
* CoreUI (v4.1.1): tooltip.js
|
|
3781
3865
|
* Licensed under MIT (https://coreui.io/license)
|
|
3782
3866
|
*
|
|
3783
3867
|
* This component is a modified version of the Bootstrap's tooltip.js
|
|
@@ -3794,7 +3878,6 @@ const NAME$5 = 'tooltip';
|
|
|
3794
3878
|
const DATA_KEY$5 = 'coreui.tooltip';
|
|
3795
3879
|
const EVENT_KEY$5 = `.${DATA_KEY$5}`;
|
|
3796
3880
|
const CLASS_PREFIX$1 = 'bs-tooltip';
|
|
3797
|
-
const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
|
|
3798
3881
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
|
3799
3882
|
const DefaultType$4 = {
|
|
3800
3883
|
animation: 'boolean',
|
|
@@ -3853,12 +3936,14 @@ const Event$2 = {
|
|
|
3853
3936
|
MOUSEENTER: `mouseenter${EVENT_KEY$5}`,
|
|
3854
3937
|
MOUSELEAVE: `mouseleave${EVENT_KEY$5}`
|
|
3855
3938
|
};
|
|
3856
|
-
const CLASS_NAME_FADE$
|
|
3939
|
+
const CLASS_NAME_FADE$2 = 'fade';
|
|
3857
3940
|
const CLASS_NAME_MODAL = 'modal';
|
|
3858
|
-
const CLASS_NAME_SHOW$
|
|
3941
|
+
const CLASS_NAME_SHOW$3 = 'show';
|
|
3859
3942
|
const HOVER_STATE_SHOW = 'show';
|
|
3860
3943
|
const HOVER_STATE_OUT = 'out';
|
|
3861
3944
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
|
3945
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
|
3946
|
+
const EVENT_MODAL_HIDE = 'hide.coreui.modal';
|
|
3862
3947
|
const TRIGGER_HOVER = 'hover';
|
|
3863
3948
|
const TRIGGER_FOCUS = 'focus';
|
|
3864
3949
|
const TRIGGER_CLICK = 'click';
|
|
@@ -3935,7 +4020,7 @@ class Tooltip extends BaseComponent {
|
|
|
3935
4020
|
context._leave(null, context);
|
|
3936
4021
|
}
|
|
3937
4022
|
} else {
|
|
3938
|
-
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4023
|
+
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
|
|
3939
4024
|
this._leave(null, this);
|
|
3940
4025
|
|
|
3941
4026
|
return;
|
|
@@ -3947,15 +4032,13 @@ class Tooltip extends BaseComponent {
|
|
|
3947
4032
|
|
|
3948
4033
|
dispose() {
|
|
3949
4034
|
clearTimeout(this._timeout);
|
|
3950
|
-
EventHandler.off(this._element.closest(
|
|
4035
|
+
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
3951
4036
|
|
|
3952
4037
|
if (this.tip) {
|
|
3953
4038
|
this.tip.remove();
|
|
3954
4039
|
}
|
|
3955
4040
|
|
|
3956
|
-
|
|
3957
|
-
this._popper.destroy();
|
|
3958
|
-
}
|
|
4041
|
+
this._disposePopper();
|
|
3959
4042
|
|
|
3960
4043
|
super.dispose();
|
|
3961
4044
|
}
|
|
@@ -3975,6 +4058,15 @@ class Tooltip extends BaseComponent {
|
|
|
3975
4058
|
|
|
3976
4059
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
|
3977
4060
|
return;
|
|
4061
|
+
} // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-coreui-original-title`
|
|
4062
|
+
// This will be removed later in favor of a `setContent` method
|
|
4063
|
+
|
|
4064
|
+
|
|
4065
|
+
if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
|
|
4066
|
+
this._disposePopper();
|
|
4067
|
+
|
|
4068
|
+
this.tip.remove();
|
|
4069
|
+
this.tip = null;
|
|
3978
4070
|
}
|
|
3979
4071
|
|
|
3980
4072
|
const tip = this.getTipElement();
|
|
@@ -3983,10 +4075,8 @@ class Tooltip extends BaseComponent {
|
|
|
3983
4075
|
|
|
3984
4076
|
this._element.setAttribute('aria-describedby', tipId);
|
|
3985
4077
|
|
|
3986
|
-
this.setContent();
|
|
3987
|
-
|
|
3988
4078
|
if (this._config.animation) {
|
|
3989
|
-
tip.classList.add(CLASS_NAME_FADE$
|
|
4079
|
+
tip.classList.add(CLASS_NAME_FADE$2);
|
|
3990
4080
|
}
|
|
3991
4081
|
|
|
3992
4082
|
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
|
|
@@ -4001,7 +4091,7 @@ class Tooltip extends BaseComponent {
|
|
|
4001
4091
|
Data.set(tip, this.constructor.DATA_KEY, this);
|
|
4002
4092
|
|
|
4003
4093
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
|
4004
|
-
container.
|
|
4094
|
+
container.append(tip);
|
|
4005
4095
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
|
4006
4096
|
}
|
|
4007
4097
|
|
|
@@ -4011,8 +4101,9 @@ class Tooltip extends BaseComponent {
|
|
|
4011
4101
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
|
4012
4102
|
}
|
|
4013
4103
|
|
|
4014
|
-
tip.classList.add(CLASS_NAME_SHOW$
|
|
4015
|
-
|
|
4104
|
+
tip.classList.add(CLASS_NAME_SHOW$3);
|
|
4105
|
+
|
|
4106
|
+
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
|
4016
4107
|
|
|
4017
4108
|
if (customClass) {
|
|
4018
4109
|
tip.classList.add(...customClass.split(' '));
|
|
@@ -4038,7 +4129,7 @@ class Tooltip extends BaseComponent {
|
|
|
4038
4129
|
}
|
|
4039
4130
|
};
|
|
4040
4131
|
|
|
4041
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4132
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
|
|
4042
4133
|
|
|
4043
4134
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4044
4135
|
}
|
|
@@ -4065,11 +4156,7 @@ class Tooltip extends BaseComponent {
|
|
|
4065
4156
|
|
|
4066
4157
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
|
4067
4158
|
|
|
4068
|
-
|
|
4069
|
-
this._popper.destroy();
|
|
4070
|
-
|
|
4071
|
-
this._popper = null;
|
|
4072
|
-
}
|
|
4159
|
+
this._disposePopper();
|
|
4073
4160
|
};
|
|
4074
4161
|
|
|
4075
4162
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
|
@@ -4078,7 +4165,7 @@ class Tooltip extends BaseComponent {
|
|
|
4078
4165
|
return;
|
|
4079
4166
|
}
|
|
4080
4167
|
|
|
4081
|
-
tip.classList.remove(CLASS_NAME_SHOW$
|
|
4168
|
+
tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
|
|
4082
4169
|
// empty mouseover listeners we added for iOS support
|
|
4083
4170
|
|
|
4084
4171
|
if ('ontouchstart' in document.documentElement) {
|
|
@@ -4088,7 +4175,7 @@ class Tooltip extends BaseComponent {
|
|
|
4088
4175
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
|
4089
4176
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
|
4090
4177
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
|
4091
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4178
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$2);
|
|
4092
4179
|
|
|
4093
4180
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4094
4181
|
|
|
@@ -4113,14 +4200,27 @@ class Tooltip extends BaseComponent {
|
|
|
4113
4200
|
|
|
4114
4201
|
const element = document.createElement('div');
|
|
4115
4202
|
element.innerHTML = this._config.template;
|
|
4116
|
-
|
|
4203
|
+
const tip = element.children[0];
|
|
4204
|
+
this.setContent(tip);
|
|
4205
|
+
tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$3);
|
|
4206
|
+
this.tip = tip;
|
|
4117
4207
|
return this.tip;
|
|
4118
4208
|
}
|
|
4119
4209
|
|
|
4120
|
-
setContent() {
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4210
|
+
setContent(tip) {
|
|
4211
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
_sanitizeAndSetContent(template, content, selector) {
|
|
4215
|
+
const templateElement = SelectorEngine.findOne(selector, template);
|
|
4216
|
+
|
|
4217
|
+
if (!content && templateElement) {
|
|
4218
|
+
templateElement.remove();
|
|
4219
|
+
return;
|
|
4220
|
+
} // we use append for html objects to maintain js events
|
|
4221
|
+
|
|
4222
|
+
|
|
4223
|
+
this.setElementContent(templateElement, content);
|
|
4124
4224
|
}
|
|
4125
4225
|
|
|
4126
4226
|
setElementContent(element, content) {
|
|
@@ -4134,7 +4234,7 @@ class Tooltip extends BaseComponent {
|
|
|
4134
4234
|
if (this._config.html) {
|
|
4135
4235
|
if (content.parentNode !== element) {
|
|
4136
4236
|
element.innerHTML = '';
|
|
4137
|
-
element.
|
|
4237
|
+
element.append(content);
|
|
4138
4238
|
}
|
|
4139
4239
|
} else {
|
|
4140
4240
|
element.textContent = content.textContent;
|
|
@@ -4155,13 +4255,9 @@ class Tooltip extends BaseComponent {
|
|
|
4155
4255
|
}
|
|
4156
4256
|
|
|
4157
4257
|
getTitle() {
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
if (!title) {
|
|
4161
|
-
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
|
4162
|
-
}
|
|
4258
|
+
const title = this._element.getAttribute('data-coreui-original-title') || this._config.title;
|
|
4163
4259
|
|
|
4164
|
-
return title;
|
|
4260
|
+
return this._resolvePossibleFunction(title);
|
|
4165
4261
|
}
|
|
4166
4262
|
|
|
4167
4263
|
updateAttachment(attachment) {
|
|
@@ -4178,15 +4274,7 @@ class Tooltip extends BaseComponent {
|
|
|
4178
4274
|
|
|
4179
4275
|
|
|
4180
4276
|
_initializeOnDelegatedTarget(event, context) {
|
|
4181
|
-
|
|
4182
|
-
context = context || Data.get(event.delegateTarget, dataKey);
|
|
4183
|
-
|
|
4184
|
-
if (!context) {
|
|
4185
|
-
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
|
4186
|
-
Data.set(event.delegateTarget, dataKey, context);
|
|
4187
|
-
}
|
|
4188
|
-
|
|
4189
|
-
return context;
|
|
4277
|
+
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
|
4190
4278
|
}
|
|
4191
4279
|
|
|
4192
4280
|
_getOffset() {
|
|
@@ -4205,6 +4293,10 @@ class Tooltip extends BaseComponent {
|
|
|
4205
4293
|
return offset;
|
|
4206
4294
|
}
|
|
4207
4295
|
|
|
4296
|
+
_resolvePossibleFunction(content) {
|
|
4297
|
+
return typeof content === 'function' ? content.call(this._element) : content;
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4208
4300
|
_getPopperConfig(attachment) {
|
|
4209
4301
|
const defaultBsPopperConfig = {
|
|
4210
4302
|
placement: attachment,
|
|
@@ -4246,7 +4338,7 @@ class Tooltip extends BaseComponent {
|
|
|
4246
4338
|
}
|
|
4247
4339
|
|
|
4248
4340
|
_addAttachmentClass(attachment) {
|
|
4249
|
-
this.getTipElement().classList.add(`${
|
|
4341
|
+
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
|
4250
4342
|
}
|
|
4251
4343
|
|
|
4252
4344
|
_getAttachment(placement) {
|
|
@@ -4273,7 +4365,7 @@ class Tooltip extends BaseComponent {
|
|
|
4273
4365
|
}
|
|
4274
4366
|
};
|
|
4275
4367
|
|
|
4276
|
-
EventHandler.on(this._element.closest(
|
|
4368
|
+
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
4277
4369
|
|
|
4278
4370
|
if (this._config.selector) {
|
|
4279
4371
|
this._config = { ...this._config,
|
|
@@ -4308,7 +4400,7 @@ class Tooltip extends BaseComponent {
|
|
|
4308
4400
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
|
4309
4401
|
}
|
|
4310
4402
|
|
|
4311
|
-
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4403
|
+
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
|
|
4312
4404
|
context._hoverState = HOVER_STATE_SHOW;
|
|
4313
4405
|
return;
|
|
4314
4406
|
}
|
|
@@ -4404,26 +4496,32 @@ class Tooltip extends BaseComponent {
|
|
|
4404
4496
|
_getDelegateConfig() {
|
|
4405
4497
|
const config = {};
|
|
4406
4498
|
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
config[key] = this._config[key];
|
|
4411
|
-
}
|
|
4499
|
+
for (const key in this._config) {
|
|
4500
|
+
if (this.constructor.Default[key] !== this._config[key]) {
|
|
4501
|
+
config[key] = this._config[key];
|
|
4412
4502
|
}
|
|
4413
|
-
}
|
|
4503
|
+
} // In the future can be replaced with:
|
|
4504
|
+
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
|
4505
|
+
// `Object.fromEntries(keysWithDifferentValues)`
|
|
4506
|
+
|
|
4414
4507
|
|
|
4415
4508
|
return config;
|
|
4416
4509
|
}
|
|
4417
4510
|
|
|
4418
4511
|
_cleanTipClass() {
|
|
4419
4512
|
const tip = this.getTipElement();
|
|
4420
|
-
const
|
|
4513
|
+
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
|
4514
|
+
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
|
4421
4515
|
|
|
4422
4516
|
if (tabClass !== null && tabClass.length > 0) {
|
|
4423
4517
|
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
|
4424
4518
|
}
|
|
4425
4519
|
}
|
|
4426
4520
|
|
|
4521
|
+
_getBasicClassPrefix() {
|
|
4522
|
+
return CLASS_PREFIX$1;
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4427
4525
|
_handlePopperPlacementChange(popperData) {
|
|
4428
4526
|
const {
|
|
4429
4527
|
state
|
|
@@ -4438,6 +4536,14 @@ class Tooltip extends BaseComponent {
|
|
|
4438
4536
|
this._cleanTipClass();
|
|
4439
4537
|
|
|
4440
4538
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
_disposePopper() {
|
|
4542
|
+
if (this._popper) {
|
|
4543
|
+
this._popper.destroy();
|
|
4544
|
+
|
|
4545
|
+
this._popper = null;
|
|
4546
|
+
}
|
|
4441
4547
|
} // Static
|
|
4442
4548
|
|
|
4443
4549
|
|
|
@@ -4468,7 +4574,7 @@ defineJQueryPlugin(Tooltip);
|
|
|
4468
4574
|
|
|
4469
4575
|
/**
|
|
4470
4576
|
* --------------------------------------------------------------------------
|
|
4471
|
-
* CoreUI (v4.
|
|
4577
|
+
* CoreUI (v4.1.1): popover.js
|
|
4472
4578
|
* Licensed under MIT (https://coreui.io/license)
|
|
4473
4579
|
*
|
|
4474
4580
|
* This component is a modified version of the Bootstrap's popover.js
|
|
@@ -4485,7 +4591,6 @@ const NAME$4 = 'popover';
|
|
|
4485
4591
|
const DATA_KEY$4 = 'coreui.popover';
|
|
4486
4592
|
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
|
|
4487
4593
|
const CLASS_PREFIX = 'bs-popover';
|
|
4488
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
|
4489
4594
|
const Default$3 = { ...Tooltip.Default,
|
|
4490
4595
|
placement: 'right',
|
|
4491
4596
|
offset: [0, 8],
|
|
@@ -4508,8 +4613,6 @@ const Event$1 = {
|
|
|
4508
4613
|
MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
|
|
4509
4614
|
MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
|
|
4510
4615
|
};
|
|
4511
|
-
const CLASS_NAME_FADE$3 = 'fade';
|
|
4512
|
-
const CLASS_NAME_SHOW$3 = 'show';
|
|
4513
4616
|
const SELECTOR_TITLE = '.popover-header';
|
|
4514
4617
|
const SELECTOR_CONTENT = '.popover-body';
|
|
4515
4618
|
/**
|
|
@@ -4541,55 +4644,19 @@ class Popover extends Tooltip {
|
|
|
4541
4644
|
return this.getTitle() || this._getContent();
|
|
4542
4645
|
}
|
|
4543
4646
|
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
return this.tip;
|
|
4547
|
-
}
|
|
4548
|
-
|
|
4549
|
-
this.tip = super.getTipElement();
|
|
4550
|
-
|
|
4551
|
-
if (!this.getTitle()) {
|
|
4552
|
-
SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
|
|
4553
|
-
}
|
|
4554
|
-
|
|
4555
|
-
if (!this._getContent()) {
|
|
4556
|
-
SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
return this.tip;
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
setContent() {
|
|
4563
|
-
const tip = this.getTipElement(); // we use append for html objects to maintain js events
|
|
4647
|
+
setContent(tip) {
|
|
4648
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
|
4564
4649
|
|
|
4565
|
-
this.
|
|
4566
|
-
|
|
4567
|
-
let content = this._getContent();
|
|
4568
|
-
|
|
4569
|
-
if (typeof content === 'function') {
|
|
4570
|
-
content = content.call(this._element);
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
|
4574
|
-
tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
|
|
4650
|
+
this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
|
4575
4651
|
} // Private
|
|
4576
4652
|
|
|
4577
4653
|
|
|
4578
|
-
_addAttachmentClass(attachment) {
|
|
4579
|
-
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
|
4580
|
-
}
|
|
4581
|
-
|
|
4582
4654
|
_getContent() {
|
|
4583
|
-
return this.
|
|
4655
|
+
return this._resolvePossibleFunction(this._config.content);
|
|
4584
4656
|
}
|
|
4585
4657
|
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
|
4589
|
-
|
|
4590
|
-
if (tabClass !== null && tabClass.length > 0) {
|
|
4591
|
-
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
|
4592
|
-
}
|
|
4658
|
+
_getBasicClassPrefix() {
|
|
4659
|
+
return CLASS_PREFIX;
|
|
4593
4660
|
} // Static
|
|
4594
4661
|
|
|
4595
4662
|
|
|
@@ -4620,7 +4687,7 @@ defineJQueryPlugin(Popover);
|
|
|
4620
4687
|
|
|
4621
4688
|
/**
|
|
4622
4689
|
* --------------------------------------------------------------------------
|
|
4623
|
-
* CoreUI (v4.
|
|
4690
|
+
* CoreUI (v4.1.1): scrollspy.js
|
|
4624
4691
|
* Licensed under MIT (https://coreui.io/license)
|
|
4625
4692
|
*
|
|
4626
4693
|
* This component is a modified version of the Bootstrap's scrollspy.js
|
|
@@ -4858,7 +4925,7 @@ defineJQueryPlugin(ScrollSpy);
|
|
|
4858
4925
|
|
|
4859
4926
|
/**
|
|
4860
4927
|
* --------------------------------------------------------------------------
|
|
4861
|
-
* CoreUI (v4.
|
|
4928
|
+
* CoreUI (v4.1.1): sidebar.js
|
|
4862
4929
|
* Licensed under MIT (https://coreui.io/license)
|
|
4863
4930
|
* --------------------------------------------------------------------------
|
|
4864
4931
|
*/
|
|
@@ -4875,7 +4942,6 @@ const DATA_API_KEY$1 = '.data-api';
|
|
|
4875
4942
|
const Default$1 = {};
|
|
4876
4943
|
const DefaultType$1 = {};
|
|
4877
4944
|
const CLASS_NAME_BACKDROP = 'sidebar-backdrop';
|
|
4878
|
-
const CLASS_NAME_FADE$2 = 'fade';
|
|
4879
4945
|
const CLASS_NAME_HIDE$1 = 'hide';
|
|
4880
4946
|
const CLASS_NAME_SHOW$2 = 'show';
|
|
4881
4947
|
const CLASS_NAME_SIDEBAR_NARROW = 'sidebar-narrow';
|
|
@@ -4906,7 +4972,7 @@ class Sidebar extends BaseComponent {
|
|
|
4906
4972
|
this._overlaid = this._isOverlaid();
|
|
4907
4973
|
this._narrow = this._isNarrow();
|
|
4908
4974
|
this._unfoldable = this._isUnfoldable();
|
|
4909
|
-
this._backdrop =
|
|
4975
|
+
this._backdrop = this._initializeBackDrop();
|
|
4910
4976
|
|
|
4911
4977
|
this._addEventListeners();
|
|
4912
4978
|
} // Getters
|
|
@@ -4935,7 +5001,9 @@ class Sidebar extends BaseComponent {
|
|
|
4935
5001
|
if (this._isMobile()) {
|
|
4936
5002
|
this._element.classList.add(CLASS_NAME_SHOW$2);
|
|
4937
5003
|
|
|
4938
|
-
this.
|
|
5004
|
+
this._backdrop.show();
|
|
5005
|
+
|
|
5006
|
+
new ScrollBarHelper().hide();
|
|
4939
5007
|
}
|
|
4940
5008
|
|
|
4941
5009
|
const complete = () => {
|
|
@@ -4961,7 +5029,9 @@ class Sidebar extends BaseComponent {
|
|
|
4961
5029
|
}
|
|
4962
5030
|
|
|
4963
5031
|
if (this._isMobile()) {
|
|
4964
|
-
this.
|
|
5032
|
+
this._backdrop.hide();
|
|
5033
|
+
|
|
5034
|
+
new ScrollBarHelper().reset();
|
|
4965
5035
|
} else {
|
|
4966
5036
|
this._element.classList.add(CLASS_NAME_HIDE$1);
|
|
4967
5037
|
}
|
|
@@ -5050,6 +5120,16 @@ class Sidebar extends BaseComponent {
|
|
|
5050
5120
|
return config;
|
|
5051
5121
|
}
|
|
5052
5122
|
|
|
5123
|
+
_initializeBackDrop() {
|
|
5124
|
+
return new Backdrop({
|
|
5125
|
+
className: CLASS_NAME_BACKDROP,
|
|
5126
|
+
isVisible: this._isMobile(),
|
|
5127
|
+
isAnimated: true,
|
|
5128
|
+
rootElement: this._element.parentNode,
|
|
5129
|
+
clickCallback: () => this.hide()
|
|
5130
|
+
});
|
|
5131
|
+
}
|
|
5132
|
+
|
|
5053
5133
|
_isMobile() {
|
|
5054
5134
|
return Boolean(window.getComputedStyle(this._element, null).getPropertyValue('--cui-is-mobile'));
|
|
5055
5135
|
}
|
|
@@ -5069,35 +5149,13 @@ class Sidebar extends BaseComponent {
|
|
|
5069
5149
|
_isVisible() {
|
|
5070
5150
|
const rect = this._element.getBoundingClientRect();
|
|
5071
5151
|
|
|
5072
|
-
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
5152
|
+
return rect.top >= 0 && rect.left >= 0 && Math.floor(rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) && Math.floor(rect.right) <= (window.innerWidth || document.documentElement.clientWidth);
|
|
5073
5153
|
}
|
|
5074
5154
|
|
|
5075
5155
|
_addClassName(className) {
|
|
5076
5156
|
this._element.classList.add(className);
|
|
5077
5157
|
}
|
|
5078
5158
|
|
|
5079
|
-
_removeBackdrop() {
|
|
5080
|
-
if (this._backdrop) {
|
|
5081
|
-
this._backdrop.parentNode.removeChild(this._backdrop);
|
|
5082
|
-
|
|
5083
|
-
this._backdrop = null;
|
|
5084
|
-
}
|
|
5085
|
-
}
|
|
5086
|
-
|
|
5087
|
-
_showBackdrop() {
|
|
5088
|
-
if (!this._backdrop) {
|
|
5089
|
-
this._backdrop = document.createElement('div');
|
|
5090
|
-
this._backdrop.className = CLASS_NAME_BACKDROP;
|
|
5091
|
-
|
|
5092
|
-
this._backdrop.classList.add(CLASS_NAME_FADE$2);
|
|
5093
|
-
|
|
5094
|
-
document.body.appendChild(this._backdrop);
|
|
5095
|
-
reflow(this._backdrop);
|
|
5096
|
-
|
|
5097
|
-
this._backdrop.classList.add(CLASS_NAME_SHOW$2);
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
|
|
5101
5159
|
_clickOutListener(event, sidebar) {
|
|
5102
5160
|
if (event.target.closest(SELECTOR_SIDEBAR) === null) {
|
|
5103
5161
|
event.preventDefault();
|
|
@@ -5145,6 +5203,7 @@ class Sidebar extends BaseComponent {
|
|
|
5145
5203
|
EventHandler.on(window, EVENT_RESIZE, () => {
|
|
5146
5204
|
if (this._isMobile() && this._isVisible()) {
|
|
5147
5205
|
this.hide();
|
|
5206
|
+
this._backdrop = this._initializeBackDrop();
|
|
5148
5207
|
}
|
|
5149
5208
|
});
|
|
5150
5209
|
} // Static
|
|
@@ -5187,11 +5246,11 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
|
5187
5246
|
* ------------------------------------------------------------------------
|
|
5188
5247
|
*/
|
|
5189
5248
|
|
|
5190
|
-
defineJQueryPlugin(
|
|
5249
|
+
defineJQueryPlugin(Sidebar);
|
|
5191
5250
|
|
|
5192
5251
|
/**
|
|
5193
5252
|
* --------------------------------------------------------------------------
|
|
5194
|
-
* CoreUI (v4.
|
|
5253
|
+
* CoreUI (v4.1.1): tab.js
|
|
5195
5254
|
* Licensed under MIT (https://coreui.io/license)
|
|
5196
5255
|
*
|
|
5197
5256
|
* This component is a modified version of the Bootstrap's tab.js
|
|
@@ -5392,7 +5451,7 @@ defineJQueryPlugin(Tab);
|
|
|
5392
5451
|
|
|
5393
5452
|
/**
|
|
5394
5453
|
* --------------------------------------------------------------------------
|
|
5395
|
-
* CoreUI (v4.
|
|
5454
|
+
* CoreUI (v4.1.1): toast.js
|
|
5396
5455
|
* Licensed under MIT (https://coreui.io/license)
|
|
5397
5456
|
*
|
|
5398
5457
|
* This component is a modified version of the Bootstrap's toast.js
|
|
@@ -5408,7 +5467,6 @@ defineJQueryPlugin(Tab);
|
|
|
5408
5467
|
const NAME = 'toast';
|
|
5409
5468
|
const DATA_KEY = 'coreui.toast';
|
|
5410
5469
|
const EVENT_KEY = `.${DATA_KEY}`;
|
|
5411
|
-
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
|
5412
5470
|
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
|
|
5413
5471
|
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
|
|
5414
5472
|
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
|
@@ -5418,7 +5476,8 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
|
|
5418
5476
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
|
5419
5477
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
|
5420
5478
|
const CLASS_NAME_FADE = 'fade';
|
|
5421
|
-
const CLASS_NAME_HIDE = 'hide';
|
|
5479
|
+
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
|
5480
|
+
|
|
5422
5481
|
const CLASS_NAME_SHOW = 'show';
|
|
5423
5482
|
const CLASS_NAME_SHOWING = 'showing';
|
|
5424
5483
|
const DefaultType = {
|
|
@@ -5431,7 +5490,6 @@ const Default = {
|
|
|
5431
5490
|
autohide: true,
|
|
5432
5491
|
delay: 5000
|
|
5433
5492
|
};
|
|
5434
|
-
const SELECTOR_DATA_DISMISS = '[data-coreui-dismiss="toast"]';
|
|
5435
5493
|
/**
|
|
5436
5494
|
* ------------------------------------------------------------------------
|
|
5437
5495
|
* Class Definition
|
|
@@ -5479,17 +5537,18 @@ class Toast extends BaseComponent {
|
|
|
5479
5537
|
const complete = () => {
|
|
5480
5538
|
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
5481
5539
|
|
|
5482
|
-
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5483
|
-
|
|
5484
5540
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
|
5485
5541
|
|
|
5486
5542
|
this._maybeScheduleHide();
|
|
5487
5543
|
};
|
|
5488
5544
|
|
|
5489
|
-
this._element.classList.remove(CLASS_NAME_HIDE);
|
|
5545
|
+
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
|
5546
|
+
|
|
5490
5547
|
|
|
5491
5548
|
reflow(this._element);
|
|
5492
5549
|
|
|
5550
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5551
|
+
|
|
5493
5552
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5494
5553
|
|
|
5495
5554
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
@@ -5507,12 +5566,17 @@ class Toast extends BaseComponent {
|
|
|
5507
5566
|
}
|
|
5508
5567
|
|
|
5509
5568
|
const complete = () => {
|
|
5510
|
-
this._element.classList.add(CLASS_NAME_HIDE);
|
|
5569
|
+
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
|
|
5570
|
+
|
|
5571
|
+
|
|
5572
|
+
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
5573
|
+
|
|
5574
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
|
5511
5575
|
|
|
5512
5576
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
|
5513
5577
|
};
|
|
5514
5578
|
|
|
5515
|
-
this._element.classList.
|
|
5579
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5516
5580
|
|
|
5517
5581
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
5518
5582
|
}
|
|
@@ -5580,7 +5644,6 @@ class Toast extends BaseComponent {
|
|
|
5580
5644
|
}
|
|
5581
5645
|
|
|
5582
5646
|
_setListeners() {
|
|
5583
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
|
5584
5647
|
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
|
|
5585
5648
|
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
|
|
5586
5649
|
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
|
|
@@ -5608,6 +5671,8 @@ class Toast extends BaseComponent {
|
|
|
5608
5671
|
}
|
|
5609
5672
|
|
|
5610
5673
|
}
|
|
5674
|
+
|
|
5675
|
+
enableDismissTrigger(Toast);
|
|
5611
5676
|
/**
|
|
5612
5677
|
* ------------------------------------------------------------------------
|
|
5613
5678
|
* jQuery
|
|
@@ -5615,8 +5680,7 @@ class Toast extends BaseComponent {
|
|
|
5615
5680
|
* add .Toast to jQuery only if jQuery is present
|
|
5616
5681
|
*/
|
|
5617
5682
|
|
|
5618
|
-
|
|
5619
5683
|
defineJQueryPlugin(Toast);
|
|
5620
5684
|
|
|
5621
|
-
export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas
|
|
5685
|
+
export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas, Popover, ScrollSpy, Sidebar, Tab, Toast, Tooltip };
|
|
5622
5686
|
//# sourceMappingURL=coreui.esm.js.map
|