@coreui/coreui 4.0.2 → 4.1.0
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 +255 -206
- 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 +256 -207
- 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 +182 -82
- 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 +725 -350
- 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 +733 -373
- 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 +782 -704
- package/dist/js/coreui.bundle.js.map +1 -1
- package/dist/js/coreui.bundle.min.js +2 -2
- package/dist/js/coreui.bundle.min.js.map +1 -1
- package/dist/js/coreui.esm.js +663 -611
- package/dist/js/coreui.esm.js.map +1 -1
- package/dist/js/coreui.esm.min.js +2 -2
- package/dist/js/coreui.esm.min.js.map +1 -1
- package/dist/js/coreui.js +673 -623
- package/dist/js/coreui.js.map +1 -1
- package/dist/js/coreui.min.js +2 -2
- package/dist/js/coreui.min.js.map +1 -1
- package/js/dist/alert.js +81 -48
- package/js/dist/alert.js.map +1 -1
- package/js/dist/base-component.js +25 -17
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +22 -12
- package/js/dist/button.js.map +1 -1
- package/js/dist/carousel.js +69 -44
- package/js/dist/carousel.js.map +1 -1
- package/js/dist/collapse.js +117 -131
- package/js/dist/collapse.js.map +1 -1
- package/js/dist/dom/data.js +5 -5
- package/js/dist/dom/data.js.map +1 -1
- package/js/dist/dom/event-handler.js +14 -5
- package/js/dist/dom/event-handler.js.map +1 -1
- package/js/dist/dom/manipulator.js +6 -6
- package/js/dist/dom/manipulator.js.map +1 -1
- package/js/dist/dom/selector-engine.js +53 -8
- package/js/dist/dom/selector-engine.js.map +1 -1
- package/js/dist/dropdown.js +99 -106
- package/js/dist/dropdown.js.map +1 -1
- package/js/dist/modal.js +244 -87
- package/js/dist/modal.js.map +1 -1
- package/js/dist/offcanvas.js +205 -56
- package/js/dist/offcanvas.js.map +1 -1
- package/js/dist/popover.js +28 -58
- package/js/dist/popover.js.map +1 -1
- package/js/dist/scrollspy.js +40 -30
- package/js/dist/scrollspy.js.map +1 -1
- package/js/dist/tab.js +44 -22
- package/js/dist/tab.js.map +1 -1
- package/js/dist/toast.js +127 -29
- package/js/dist/toast.js.map +1 -1
- package/js/dist/tooltip.js +122 -104
- 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 +9 -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 +6 -4
- 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 +14 -5
- package/js/src/util/sanitizer.js +21 -22
- package/js/src/util/scrollbar.js +1 -1
- package/package.json +47 -44
- 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 +1 -11
- 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 +184 -12
- 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 +29 -10
- package/scss/mixins/_ltr-rtl.scss +21 -0
- package/scss/mixins/_utilities.scss +26 -26
- package/scss/mixins/_visually-hidden.scss +1 -1
- package/scss/sidebar/_sidebar.scss +22 -16
package/dist/js/coreui.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI v4.0
|
|
2
|
+
* CoreUI v4.1.0 (https://coreui.io)
|
|
3
3
|
* Copyright 2021 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://coreui.io)
|
|
5
5
|
*/
|
|
@@ -7,88 +7,13 @@ import * as Popper from '@popperjs/core';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* --------------------------------------------------------------------------
|
|
10
|
-
* CoreUI (v4.0
|
|
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.2): alert.js
|
|
10
|
+
* CoreUI (v4.1.0): 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)
|
|
@@ -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;
|
|
@@ -266,8 +191,20 @@ const findShadowRoot = element => {
|
|
|
266
191
|
};
|
|
267
192
|
|
|
268
193
|
const noop = () => {};
|
|
194
|
+
/**
|
|
195
|
+
* Trick to restart an element's animation
|
|
196
|
+
*
|
|
197
|
+
* @param {HTMLElement} element
|
|
198
|
+
* @return void
|
|
199
|
+
*
|
|
200
|
+
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
|
201
|
+
*/
|
|
269
202
|
|
|
270
|
-
|
|
203
|
+
|
|
204
|
+
const reflow = element => {
|
|
205
|
+
// eslint-disable-next-line no-unused-expressions
|
|
206
|
+
element.offsetHeight;
|
|
207
|
+
};
|
|
271
208
|
|
|
272
209
|
const getjQuery = () => {
|
|
273
210
|
const {
|
|
@@ -384,7 +321,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
|
|
|
384
321
|
|
|
385
322
|
/**
|
|
386
323
|
* --------------------------------------------------------------------------
|
|
387
|
-
* CoreUI (v4.0
|
|
324
|
+
* CoreUI (v4.1.0): dom/event-handler.js
|
|
388
325
|
* Licensed under MIT (https://coreui.io/license)
|
|
389
326
|
*
|
|
390
327
|
* This component is a modified version of the Bootstrap's dom/event-handler.js
|
|
@@ -450,7 +387,6 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
|
|
450
387
|
event.delegateTarget = target;
|
|
451
388
|
|
|
452
389
|
if (handler.oneOff) {
|
|
453
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
454
390
|
EventHandler.off(element, event.type, selector, fn);
|
|
455
391
|
}
|
|
456
392
|
|
|
@@ -676,7 +612,7 @@ const EventHandler = {
|
|
|
676
612
|
|
|
677
613
|
/**
|
|
678
614
|
* --------------------------------------------------------------------------
|
|
679
|
-
* CoreUI (v4.0
|
|
615
|
+
* CoreUI (v4.1.0): dom/data.js
|
|
680
616
|
* Licensed under MIT (https://coreui.io/license)
|
|
681
617
|
*
|
|
682
618
|
* This component is a modified version of the Bootstrap's dom/data.js
|
|
@@ -690,7 +626,7 @@ const EventHandler = {
|
|
|
690
626
|
* ------------------------------------------------------------------------
|
|
691
627
|
*/
|
|
692
628
|
const elementMap = new Map();
|
|
693
|
-
|
|
629
|
+
const Data = {
|
|
694
630
|
set(element, key, instance) {
|
|
695
631
|
if (!elementMap.has(element)) {
|
|
696
632
|
elementMap.set(element, new Map());
|
|
@@ -733,7 +669,7 @@ var Data = {
|
|
|
733
669
|
|
|
734
670
|
/**
|
|
735
671
|
* --------------------------------------------------------------------------
|
|
736
|
-
* CoreUI (v4.0
|
|
672
|
+
* CoreUI (v4.1.0): alert.js
|
|
737
673
|
* Licensed under MIT (https://coreui.io/license)
|
|
738
674
|
*
|
|
739
675
|
* This component is a modified version of the Bootstrap's base-component.js
|
|
@@ -746,7 +682,7 @@ var Data = {
|
|
|
746
682
|
* ------------------------------------------------------------------------
|
|
747
683
|
*/
|
|
748
684
|
|
|
749
|
-
const VERSION = '4.0
|
|
685
|
+
const VERSION = '4.1.0';
|
|
750
686
|
|
|
751
687
|
class BaseComponent {
|
|
752
688
|
constructor(element) {
|
|
@@ -775,7 +711,7 @@ class BaseComponent {
|
|
|
775
711
|
|
|
776
712
|
|
|
777
713
|
static getInstance(element) {
|
|
778
|
-
return Data.get(element, this.DATA_KEY);
|
|
714
|
+
return Data.get(getElement(element), this.DATA_KEY);
|
|
779
715
|
}
|
|
780
716
|
|
|
781
717
|
static getOrCreateInstance(element, config = {}) {
|
|
@@ -802,7 +738,33 @@ class BaseComponent {
|
|
|
802
738
|
|
|
803
739
|
/**
|
|
804
740
|
* --------------------------------------------------------------------------
|
|
805
|
-
*
|
|
741
|
+
* Bootstrap (v5.1.3): util/component-functions.js
|
|
742
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
743
|
+
* --------------------------------------------------------------------------
|
|
744
|
+
*/
|
|
745
|
+
|
|
746
|
+
const enableDismissTrigger = (component, method = 'hide') => {
|
|
747
|
+
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
|
748
|
+
const name = component.NAME;
|
|
749
|
+
EventHandler.on(document, clickEvent, `[data-coreui-dismiss="${name}"]`, function (event) {
|
|
750
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
|
751
|
+
event.preventDefault();
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (isDisabled(this)) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
|
759
|
+
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
|
760
|
+
|
|
761
|
+
instance[method]();
|
|
762
|
+
});
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* --------------------------------------------------------------------------
|
|
767
|
+
* CoreUI (v4.1.0): alert.js
|
|
806
768
|
* Licensed under MIT (https://coreui.io/license)
|
|
807
769
|
*
|
|
808
770
|
* This component is a modified version of the Bootstrap's alert.js
|
|
@@ -815,17 +777,13 @@ class BaseComponent {
|
|
|
815
777
|
* ------------------------------------------------------------------------
|
|
816
778
|
*/
|
|
817
779
|
|
|
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';
|
|
780
|
+
const NAME$f = 'alert';
|
|
781
|
+
const DATA_KEY$e = 'coreui.alert';
|
|
782
|
+
const EVENT_KEY$e = `.${DATA_KEY$e}`;
|
|
783
|
+
const EVENT_CLOSE = `close${EVENT_KEY$e}`;
|
|
784
|
+
const EVENT_CLOSED = `closed${EVENT_KEY$e}`;
|
|
785
|
+
const CLASS_NAME_FADE$6 = 'fade';
|
|
786
|
+
const CLASS_NAME_SHOW$a = 'show';
|
|
829
787
|
/**
|
|
830
788
|
* ------------------------------------------------------------------------
|
|
831
789
|
* Class Definition
|
|
@@ -835,41 +793,30 @@ const CLASS_NAME_SHOW$b = 'show';
|
|
|
835
793
|
class Alert extends BaseComponent {
|
|
836
794
|
// Getters
|
|
837
795
|
static get NAME() {
|
|
838
|
-
return NAME$
|
|
796
|
+
return NAME$f;
|
|
839
797
|
} // Public
|
|
840
798
|
|
|
841
799
|
|
|
842
|
-
close(
|
|
843
|
-
const
|
|
800
|
+
close() {
|
|
801
|
+
const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
|
|
844
802
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (customEvent === null || customEvent.defaultPrevented) {
|
|
803
|
+
if (closeEvent.defaultPrevented) {
|
|
848
804
|
return;
|
|
849
805
|
}
|
|
850
806
|
|
|
851
|
-
this.
|
|
852
|
-
} // Private
|
|
853
|
-
|
|
807
|
+
this._element.classList.remove(CLASS_NAME_SHOW$a);
|
|
854
808
|
|
|
855
|
-
|
|
856
|
-
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
|
857
|
-
}
|
|
809
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$6);
|
|
858
810
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
811
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
|
812
|
+
} // Private
|
|
862
813
|
|
|
863
|
-
_removeElement(element) {
|
|
864
|
-
element.classList.remove(CLASS_NAME_SHOW$b);
|
|
865
|
-
const isAnimated = element.classList.contains(CLASS_NAME_FADE$7);
|
|
866
814
|
|
|
867
|
-
|
|
868
|
-
|
|
815
|
+
_destroyElement() {
|
|
816
|
+
this._element.remove();
|
|
869
817
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
EventHandler.trigger(element, EVENT_CLOSED);
|
|
818
|
+
EventHandler.trigger(this._element, EVENT_CLOSED);
|
|
819
|
+
this.dispose();
|
|
873
820
|
} // Static
|
|
874
821
|
|
|
875
822
|
|
|
@@ -877,20 +824,16 @@ class Alert extends BaseComponent {
|
|
|
877
824
|
return this.each(function () {
|
|
878
825
|
const data = Alert.getOrCreateInstance(this);
|
|
879
826
|
|
|
880
|
-
if (config
|
|
881
|
-
|
|
827
|
+
if (typeof config !== 'string') {
|
|
828
|
+
return;
|
|
882
829
|
}
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
830
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
if (event) {
|
|
889
|
-
event.preventDefault();
|
|
831
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
|
832
|
+
throw new TypeError(`No method named "${config}"`);
|
|
890
833
|
}
|
|
891
834
|
|
|
892
|
-
|
|
893
|
-
};
|
|
835
|
+
data[config](this);
|
|
836
|
+
});
|
|
894
837
|
}
|
|
895
838
|
|
|
896
839
|
}
|
|
@@ -901,7 +844,7 @@ class Alert extends BaseComponent {
|
|
|
901
844
|
*/
|
|
902
845
|
|
|
903
846
|
|
|
904
|
-
|
|
847
|
+
enableDismissTrigger(Alert, 'close');
|
|
905
848
|
/**
|
|
906
849
|
* ------------------------------------------------------------------------
|
|
907
850
|
* jQuery
|
|
@@ -913,7 +856,7 @@ defineJQueryPlugin(Alert);
|
|
|
913
856
|
|
|
914
857
|
/**
|
|
915
858
|
* --------------------------------------------------------------------------
|
|
916
|
-
* CoreUI (v4.0
|
|
859
|
+
* CoreUI (v4.1.0): alert.js
|
|
917
860
|
* Licensed under MIT (https://coreui.io/license)
|
|
918
861
|
*
|
|
919
862
|
* This component is a modified version of the Bootstrap's button.js
|
|
@@ -926,13 +869,13 @@ defineJQueryPlugin(Alert);
|
|
|
926
869
|
* ------------------------------------------------------------------------
|
|
927
870
|
*/
|
|
928
871
|
|
|
929
|
-
const NAME$
|
|
930
|
-
const DATA_KEY$
|
|
931
|
-
const EVENT_KEY$
|
|
872
|
+
const NAME$e = 'button';
|
|
873
|
+
const DATA_KEY$d = 'coreui.button';
|
|
874
|
+
const EVENT_KEY$d = `.${DATA_KEY$d}`;
|
|
932
875
|
const DATA_API_KEY$9 = '.data-api';
|
|
933
876
|
const CLASS_NAME_ACTIVE$4 = 'active';
|
|
934
877
|
const SELECTOR_DATA_TOGGLE$6 = '[data-coreui-toggle="button"]';
|
|
935
|
-
const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$
|
|
878
|
+
const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$d}${DATA_API_KEY$9}`;
|
|
936
879
|
/**
|
|
937
880
|
* ------------------------------------------------------------------------
|
|
938
881
|
* Class Definition
|
|
@@ -942,7 +885,7 @@ const EVENT_CLICK_DATA_API$8 = `click${EVENT_KEY$c}${DATA_API_KEY$9}`;
|
|
|
942
885
|
class Button extends BaseComponent {
|
|
943
886
|
// Getters
|
|
944
887
|
static get NAME() {
|
|
945
|
-
return NAME$
|
|
888
|
+
return NAME$e;
|
|
946
889
|
} // Public
|
|
947
890
|
|
|
948
891
|
|
|
@@ -987,7 +930,7 @@ defineJQueryPlugin(Button);
|
|
|
987
930
|
|
|
988
931
|
/**
|
|
989
932
|
* --------------------------------------------------------------------------
|
|
990
|
-
* CoreUI (v4.0
|
|
933
|
+
* CoreUI (v4.1.0): dom/manipulator.js
|
|
991
934
|
* Licensed under MIT (https://coreui.io/license)
|
|
992
935
|
*
|
|
993
936
|
* This component is a modified version of the Bootstrap's dom/manipulator.js
|
|
@@ -1048,8 +991,8 @@ const Manipulator = {
|
|
|
1048
991
|
offset(element) {
|
|
1049
992
|
const rect = element.getBoundingClientRect();
|
|
1050
993
|
return {
|
|
1051
|
-
top: rect.top +
|
|
1052
|
-
left: rect.left +
|
|
994
|
+
top: rect.top + window.pageYOffset,
|
|
995
|
+
left: rect.left + window.pageXOffset
|
|
1053
996
|
};
|
|
1054
997
|
},
|
|
1055
998
|
|
|
@@ -1064,7 +1007,80 @@ const Manipulator = {
|
|
|
1064
1007
|
|
|
1065
1008
|
/**
|
|
1066
1009
|
* --------------------------------------------------------------------------
|
|
1067
|
-
* CoreUI (v4.0
|
|
1010
|
+
* CoreUI (v4.1.0): dom/selector-engine.js
|
|
1011
|
+
* Licensed under MIT (https://coreui.io/license)
|
|
1012
|
+
*
|
|
1013
|
+
* This component is a modified version of the Bootstrap's dom/selector-engine.js
|
|
1014
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
1015
|
+
* --------------------------------------------------------------------------
|
|
1016
|
+
*/
|
|
1017
|
+
const NODE_TEXT = 3;
|
|
1018
|
+
const SelectorEngine = {
|
|
1019
|
+
find(selector, element = document.documentElement) {
|
|
1020
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
|
1021
|
+
},
|
|
1022
|
+
|
|
1023
|
+
findOne(selector, element = document.documentElement) {
|
|
1024
|
+
return Element.prototype.querySelector.call(element, selector);
|
|
1025
|
+
},
|
|
1026
|
+
|
|
1027
|
+
children(element, selector) {
|
|
1028
|
+
return [].concat(...element.children).filter(child => child.matches(selector));
|
|
1029
|
+
},
|
|
1030
|
+
|
|
1031
|
+
parents(element, selector) {
|
|
1032
|
+
const parents = [];
|
|
1033
|
+
let ancestor = element.parentNode;
|
|
1034
|
+
|
|
1035
|
+
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
|
1036
|
+
if (ancestor.matches(selector)) {
|
|
1037
|
+
parents.push(ancestor);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
ancestor = ancestor.parentNode;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
return parents;
|
|
1044
|
+
},
|
|
1045
|
+
|
|
1046
|
+
prev(element, selector) {
|
|
1047
|
+
let previous = element.previousElementSibling;
|
|
1048
|
+
|
|
1049
|
+
while (previous) {
|
|
1050
|
+
if (previous.matches(selector)) {
|
|
1051
|
+
return [previous];
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
previous = previous.previousElementSibling;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return [];
|
|
1058
|
+
},
|
|
1059
|
+
|
|
1060
|
+
next(element, selector) {
|
|
1061
|
+
let next = element.nextElementSibling;
|
|
1062
|
+
|
|
1063
|
+
while (next) {
|
|
1064
|
+
if (next.matches(selector)) {
|
|
1065
|
+
return [next];
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
next = next.nextElementSibling;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
return [];
|
|
1072
|
+
},
|
|
1073
|
+
|
|
1074
|
+
focusableChildren(element) {
|
|
1075
|
+
const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
|
|
1076
|
+
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* --------------------------------------------------------------------------
|
|
1083
|
+
* CoreUI (v4.1.0): carousel.js
|
|
1068
1084
|
* Licensed under MIT (https://coreui.io/license)
|
|
1069
1085
|
*
|
|
1070
1086
|
* This component is a modified version of the Bootstrap's carousel.js
|
|
@@ -1077,16 +1093,16 @@ const Manipulator = {
|
|
|
1077
1093
|
* ------------------------------------------------------------------------
|
|
1078
1094
|
*/
|
|
1079
1095
|
|
|
1080
|
-
const NAME$
|
|
1081
|
-
const DATA_KEY$
|
|
1082
|
-
const EVENT_KEY$
|
|
1096
|
+
const NAME$d = 'carousel';
|
|
1097
|
+
const DATA_KEY$c = 'coreui.carousel';
|
|
1098
|
+
const EVENT_KEY$c = `.${DATA_KEY$c}`;
|
|
1083
1099
|
const DATA_API_KEY$8 = '.data-api';
|
|
1084
1100
|
const ARROW_LEFT_KEY = 'ArrowLeft';
|
|
1085
1101
|
const ARROW_RIGHT_KEY = 'ArrowRight';
|
|
1086
1102
|
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
|
1087
1103
|
|
|
1088
1104
|
const SWIPE_THRESHOLD = 40;
|
|
1089
|
-
const Default$
|
|
1105
|
+
const Default$c = {
|
|
1090
1106
|
interval: 5000,
|
|
1091
1107
|
keyboard: true,
|
|
1092
1108
|
slide: false,
|
|
@@ -1094,7 +1110,7 @@ const Default$b = {
|
|
|
1094
1110
|
wrap: true,
|
|
1095
1111
|
touch: true
|
|
1096
1112
|
};
|
|
1097
|
-
const DefaultType$
|
|
1113
|
+
const DefaultType$c = {
|
|
1098
1114
|
interval: '(number|boolean)',
|
|
1099
1115
|
keyboard: 'boolean',
|
|
1100
1116
|
slide: '(boolean|string)',
|
|
@@ -1110,19 +1126,19 @@ const KEY_TO_DIRECTION = {
|
|
|
1110
1126
|
[ARROW_LEFT_KEY]: DIRECTION_RIGHT,
|
|
1111
1127
|
[ARROW_RIGHT_KEY]: DIRECTION_LEFT
|
|
1112
1128
|
};
|
|
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$
|
|
1129
|
+
const EVENT_SLIDE = `slide${EVENT_KEY$c}`;
|
|
1130
|
+
const EVENT_SLID = `slid${EVENT_KEY$c}`;
|
|
1131
|
+
const EVENT_KEYDOWN = `keydown${EVENT_KEY$c}`;
|
|
1132
|
+
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$c}`;
|
|
1133
|
+
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$c}`;
|
|
1134
|
+
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$c}`;
|
|
1135
|
+
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$c}`;
|
|
1136
|
+
const EVENT_TOUCHEND = `touchend${EVENT_KEY$c}`;
|
|
1137
|
+
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$c}`;
|
|
1138
|
+
const EVENT_POINTERUP = `pointerup${EVENT_KEY$c}`;
|
|
1139
|
+
const EVENT_DRAG_START = `dragstart${EVENT_KEY$c}`;
|
|
1140
|
+
const EVENT_LOAD_DATA_API$4 = `load${EVENT_KEY$c}${DATA_API_KEY$8}`;
|
|
1141
|
+
const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$c}${DATA_API_KEY$8}`;
|
|
1126
1142
|
const CLASS_NAME_CAROUSEL = 'carousel';
|
|
1127
1143
|
const CLASS_NAME_ACTIVE$3 = 'active';
|
|
1128
1144
|
const CLASS_NAME_SLIDE = 'slide';
|
|
@@ -1169,11 +1185,11 @@ class Carousel extends BaseComponent {
|
|
|
1169
1185
|
|
|
1170
1186
|
|
|
1171
1187
|
static get Default() {
|
|
1172
|
-
return Default$
|
|
1188
|
+
return Default$c;
|
|
1173
1189
|
}
|
|
1174
1190
|
|
|
1175
1191
|
static get NAME() {
|
|
1176
|
-
return NAME$
|
|
1192
|
+
return NAME$d;
|
|
1177
1193
|
} // Public
|
|
1178
1194
|
|
|
1179
1195
|
|
|
@@ -1251,11 +1267,11 @@ class Carousel extends BaseComponent {
|
|
|
1251
1267
|
|
|
1252
1268
|
|
|
1253
1269
|
_getConfig(config) {
|
|
1254
|
-
config = { ...Default$
|
|
1270
|
+
config = { ...Default$c,
|
|
1255
1271
|
...Manipulator.getDataAttributes(this._element),
|
|
1256
1272
|
...(typeof config === 'object' ? config : {})
|
|
1257
1273
|
};
|
|
1258
|
-
typeCheckConfig(NAME$
|
|
1274
|
+
typeCheckConfig(NAME$d, config, DefaultType$c);
|
|
1259
1275
|
return config;
|
|
1260
1276
|
}
|
|
1261
1277
|
|
|
@@ -1292,8 +1308,12 @@ class Carousel extends BaseComponent {
|
|
|
1292
1308
|
}
|
|
1293
1309
|
|
|
1294
1310
|
_addTouchEventListeners() {
|
|
1311
|
+
const hasPointerPenTouch = event => {
|
|
1312
|
+
return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1295
1315
|
const start = event => {
|
|
1296
|
-
if (
|
|
1316
|
+
if (hasPointerPenTouch(event)) {
|
|
1297
1317
|
this.touchStartX = event.clientX;
|
|
1298
1318
|
} else if (!this._pointerEvent) {
|
|
1299
1319
|
this.touchStartX = event.touches[0].clientX;
|
|
@@ -1306,7 +1326,7 @@ class Carousel extends BaseComponent {
|
|
|
1306
1326
|
};
|
|
1307
1327
|
|
|
1308
1328
|
const end = event => {
|
|
1309
|
-
if (
|
|
1329
|
+
if (hasPointerPenTouch(event)) {
|
|
1310
1330
|
this.touchDeltaX = event.clientX - this.touchStartX;
|
|
1311
1331
|
}
|
|
1312
1332
|
|
|
@@ -1331,7 +1351,7 @@ class Carousel extends BaseComponent {
|
|
|
1331
1351
|
};
|
|
1332
1352
|
|
|
1333
1353
|
SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
|
|
1334
|
-
EventHandler.on(itemImg, EVENT_DRAG_START,
|
|
1354
|
+
EventHandler.on(itemImg, EVENT_DRAG_START, event => event.preventDefault());
|
|
1335
1355
|
});
|
|
1336
1356
|
|
|
1337
1357
|
if (this._pointerEvent) {
|
|
@@ -1612,7 +1632,7 @@ defineJQueryPlugin(Carousel);
|
|
|
1612
1632
|
|
|
1613
1633
|
/**
|
|
1614
1634
|
* --------------------------------------------------------------------------
|
|
1615
|
-
* CoreUI (v4.0
|
|
1635
|
+
* CoreUI (v4.1.0): collapse.js
|
|
1616
1636
|
* Licensed under MIT (https://coreui.io/license)
|
|
1617
1637
|
*
|
|
1618
1638
|
* This component is a modified version of the Bootstrap's collapse.js
|
|
@@ -1625,30 +1645,32 @@ defineJQueryPlugin(Carousel);
|
|
|
1625
1645
|
* ------------------------------------------------------------------------
|
|
1626
1646
|
*/
|
|
1627
1647
|
|
|
1628
|
-
const NAME$
|
|
1629
|
-
const DATA_KEY$
|
|
1630
|
-
const EVENT_KEY$
|
|
1648
|
+
const NAME$c = 'collapse';
|
|
1649
|
+
const DATA_KEY$b = 'coreui.collapse';
|
|
1650
|
+
const EVENT_KEY$b = `.${DATA_KEY$b}`;
|
|
1631
1651
|
const DATA_API_KEY$7 = '.data-api';
|
|
1632
|
-
const Default$
|
|
1652
|
+
const Default$b = {
|
|
1633
1653
|
toggle: true,
|
|
1634
|
-
parent:
|
|
1654
|
+
parent: null
|
|
1635
1655
|
};
|
|
1636
|
-
const DefaultType$
|
|
1656
|
+
const DefaultType$b = {
|
|
1637
1657
|
toggle: 'boolean',
|
|
1638
|
-
parent: '(
|
|
1658
|
+
parent: '(null|element)'
|
|
1639
1659
|
};
|
|
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$
|
|
1660
|
+
const EVENT_SHOW$6 = `show${EVENT_KEY$b}`;
|
|
1661
|
+
const EVENT_SHOWN$6 = `shown${EVENT_KEY$b}`;
|
|
1662
|
+
const EVENT_HIDE$6 = `hide${EVENT_KEY$b}`;
|
|
1663
|
+
const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$b}`;
|
|
1664
|
+
const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$b}${DATA_API_KEY$7}`;
|
|
1665
|
+
const CLASS_NAME_SHOW$9 = 'show';
|
|
1646
1666
|
const CLASS_NAME_COLLAPSE = 'collapse';
|
|
1647
1667
|
const CLASS_NAME_COLLAPSING = 'collapsing';
|
|
1648
1668
|
const CLASS_NAME_COLLAPSED = 'collapsed';
|
|
1669
|
+
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
|
1670
|
+
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
|
1649
1671
|
const WIDTH = 'width';
|
|
1650
1672
|
const HEIGHT = 'height';
|
|
1651
|
-
const SELECTOR_ACTIVES = '.show, .collapsing';
|
|
1673
|
+
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
|
|
1652
1674
|
const SELECTOR_DATA_TOGGLE$5 = '[data-coreui-toggle="collapse"]';
|
|
1653
1675
|
/**
|
|
1654
1676
|
* ------------------------------------------------------------------------
|
|
@@ -1661,7 +1683,7 @@ class Collapse extends BaseComponent {
|
|
|
1661
1683
|
super(element);
|
|
1662
1684
|
this._isTransitioning = false;
|
|
1663
1685
|
this._config = this._getConfig(config);
|
|
1664
|
-
this._triggerArray =
|
|
1686
|
+
this._triggerArray = [];
|
|
1665
1687
|
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$5);
|
|
1666
1688
|
|
|
1667
1689
|
for (let i = 0, len = toggleList.length; i < len; i++) {
|
|
@@ -1676,10 +1698,10 @@ class Collapse extends BaseComponent {
|
|
|
1676
1698
|
}
|
|
1677
1699
|
}
|
|
1678
1700
|
|
|
1679
|
-
this.
|
|
1701
|
+
this._initializeChildren();
|
|
1680
1702
|
|
|
1681
1703
|
if (!this._config.parent) {
|
|
1682
|
-
this._addAriaAndCollapsedClass(this.
|
|
1704
|
+
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
|
1683
1705
|
}
|
|
1684
1706
|
|
|
1685
1707
|
if (this._config.toggle) {
|
|
@@ -1689,16 +1711,16 @@ class Collapse extends BaseComponent {
|
|
|
1689
1711
|
|
|
1690
1712
|
|
|
1691
1713
|
static get Default() {
|
|
1692
|
-
return Default$
|
|
1714
|
+
return Default$b;
|
|
1693
1715
|
}
|
|
1694
1716
|
|
|
1695
1717
|
static get NAME() {
|
|
1696
|
-
return NAME$
|
|
1718
|
+
return NAME$c;
|
|
1697
1719
|
} // Public
|
|
1698
1720
|
|
|
1699
1721
|
|
|
1700
1722
|
toggle() {
|
|
1701
|
-
if (this.
|
|
1723
|
+
if (this._isShown()) {
|
|
1702
1724
|
this.hide();
|
|
1703
1725
|
} else {
|
|
1704
1726
|
this.show();
|
|
@@ -1706,30 +1728,21 @@ class Collapse extends BaseComponent {
|
|
|
1706
1728
|
}
|
|
1707
1729
|
|
|
1708
1730
|
show() {
|
|
1709
|
-
if (this._isTransitioning || this.
|
|
1731
|
+
if (this._isTransitioning || this._isShown()) {
|
|
1710
1732
|
return;
|
|
1711
1733
|
}
|
|
1712
1734
|
|
|
1713
|
-
let actives;
|
|
1735
|
+
let actives = [];
|
|
1714
1736
|
let activesData;
|
|
1715
1737
|
|
|
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
|
-
}
|
|
1738
|
+
if (this._config.parent) {
|
|
1739
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
|
1740
|
+
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
|
|
1728
1741
|
}
|
|
1729
1742
|
|
|
1730
1743
|
const container = SelectorEngine.findOne(this._selector);
|
|
1731
1744
|
|
|
1732
|
-
if (actives) {
|
|
1745
|
+
if (actives.length) {
|
|
1733
1746
|
const tempActiveData = actives.find(elem => container !== elem);
|
|
1734
1747
|
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
|
|
1735
1748
|
|
|
@@ -1744,17 +1757,17 @@ class Collapse extends BaseComponent {
|
|
|
1744
1757
|
return;
|
|
1745
1758
|
}
|
|
1746
1759
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
}
|
|
1760
|
+
actives.forEach(elemActive => {
|
|
1761
|
+
if (container !== elemActive) {
|
|
1762
|
+
Collapse.getOrCreateInstance(elemActive, {
|
|
1763
|
+
toggle: false
|
|
1764
|
+
}).hide();
|
|
1765
|
+
}
|
|
1752
1766
|
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
}
|
|
1767
|
+
if (!activesData) {
|
|
1768
|
+
Data.set(elemActive, DATA_KEY$b, null);
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1758
1771
|
|
|
1759
1772
|
const dimension = this._getDimension();
|
|
1760
1773
|
|
|
@@ -1764,22 +1777,18 @@ class Collapse extends BaseComponent {
|
|
|
1764
1777
|
|
|
1765
1778
|
this._element.style[dimension] = 0;
|
|
1766
1779
|
|
|
1767
|
-
|
|
1768
|
-
this._triggerArray.forEach(element => {
|
|
1769
|
-
element.classList.remove(CLASS_NAME_COLLAPSED);
|
|
1770
|
-
element.setAttribute('aria-expanded', true);
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1780
|
+
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
|
1773
1781
|
|
|
1774
|
-
this.
|
|
1782
|
+
this._isTransitioning = true;
|
|
1775
1783
|
|
|
1776
1784
|
const complete = () => {
|
|
1785
|
+
this._isTransitioning = false;
|
|
1786
|
+
|
|
1777
1787
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
1778
1788
|
|
|
1779
|
-
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
|
1789
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
|
|
1780
1790
|
|
|
1781
1791
|
this._element.style[dimension] = '';
|
|
1782
|
-
this.setTransitioning(false);
|
|
1783
1792
|
EventHandler.trigger(this._element, EVENT_SHOWN$6);
|
|
1784
1793
|
};
|
|
1785
1794
|
|
|
@@ -1792,7 +1801,7 @@ class Collapse extends BaseComponent {
|
|
|
1792
1801
|
}
|
|
1793
1802
|
|
|
1794
1803
|
hide() {
|
|
1795
|
-
if (this._isTransitioning || !this.
|
|
1804
|
+
if (this._isTransitioning || !this._isShown()) {
|
|
1796
1805
|
return;
|
|
1797
1806
|
}
|
|
1798
1807
|
|
|
@@ -1809,26 +1818,23 @@ class Collapse extends BaseComponent {
|
|
|
1809
1818
|
|
|
1810
1819
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
|
1811
1820
|
|
|
1812
|
-
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$
|
|
1821
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$9);
|
|
1813
1822
|
|
|
1814
1823
|
const triggerArrayLength = this._triggerArray.length;
|
|
1815
1824
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
const elem = getElementFromSelector(trigger);
|
|
1825
|
+
for (let i = 0; i < triggerArrayLength; i++) {
|
|
1826
|
+
const trigger = this._triggerArray[i];
|
|
1827
|
+
const elem = getElementFromSelector(trigger);
|
|
1820
1828
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
trigger.setAttribute('aria-expanded', false);
|
|
1824
|
-
}
|
|
1829
|
+
if (elem && !this._isShown(elem)) {
|
|
1830
|
+
this._addAriaAndCollapsedClass([trigger], false);
|
|
1825
1831
|
}
|
|
1826
1832
|
}
|
|
1827
1833
|
|
|
1828
|
-
this.
|
|
1834
|
+
this._isTransitioning = true;
|
|
1829
1835
|
|
|
1830
1836
|
const complete = () => {
|
|
1831
|
-
this.
|
|
1837
|
+
this._isTransitioning = false;
|
|
1832
1838
|
|
|
1833
1839
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
|
1834
1840
|
|
|
@@ -1842,45 +1848,47 @@ class Collapse extends BaseComponent {
|
|
|
1842
1848
|
this._queueCallback(complete, this._element, true);
|
|
1843
1849
|
}
|
|
1844
1850
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1851
|
+
_isShown(element = this._element) {
|
|
1852
|
+
return element.classList.contains(CLASS_NAME_SHOW$9);
|
|
1847
1853
|
} // Private
|
|
1848
1854
|
|
|
1849
1855
|
|
|
1850
1856
|
_getConfig(config) {
|
|
1851
|
-
config = { ...Default$
|
|
1857
|
+
config = { ...Default$b,
|
|
1858
|
+
...Manipulator.getDataAttributes(this._element),
|
|
1852
1859
|
...config
|
|
1853
1860
|
};
|
|
1854
1861
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
|
1855
1862
|
|
|
1856
|
-
|
|
1863
|
+
config.parent = getElement(config.parent);
|
|
1864
|
+
typeCheckConfig(NAME$c, config, DefaultType$b);
|
|
1857
1865
|
return config;
|
|
1858
1866
|
}
|
|
1859
1867
|
|
|
1860
1868
|
_getDimension() {
|
|
1861
|
-
return this._element.classList.contains(
|
|
1869
|
+
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
|
1862
1870
|
}
|
|
1863
1871
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
const
|
|
1870
|
-
SelectorEngine.find(
|
|
1872
|
+
_initializeChildren() {
|
|
1873
|
+
if (!this._config.parent) {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
|
1878
|
+
SelectorEngine.find(SELECTOR_DATA_TOGGLE$5, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
|
|
1871
1879
|
const selected = getElementFromSelector(element);
|
|
1872
1880
|
|
|
1873
|
-
|
|
1881
|
+
if (selected) {
|
|
1882
|
+
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
|
1883
|
+
}
|
|
1874
1884
|
});
|
|
1875
|
-
return parent;
|
|
1876
1885
|
}
|
|
1877
1886
|
|
|
1878
|
-
_addAriaAndCollapsedClass(
|
|
1879
|
-
if (!
|
|
1887
|
+
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
|
1888
|
+
if (!triggerArray.length) {
|
|
1880
1889
|
return;
|
|
1881
1890
|
}
|
|
1882
1891
|
|
|
1883
|
-
const isOpen = element.classList.contains(CLASS_NAME_SHOW$a);
|
|
1884
1892
|
triggerArray.forEach(elem => {
|
|
1885
1893
|
if (isOpen) {
|
|
1886
1894
|
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
|
@@ -1893,33 +1901,23 @@ class Collapse extends BaseComponent {
|
|
|
1893
1901
|
} // Static
|
|
1894
1902
|
|
|
1895
1903
|
|
|
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
|
-
}
|
|
1904
|
+
static jQueryInterface(config) {
|
|
1905
|
+
return this.each(function () {
|
|
1906
|
+
const _config = {};
|
|
1910
1907
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
throw new TypeError(`No method named "${config}"`);
|
|
1908
|
+
if (typeof config === 'string' && /show|hide/.test(config)) {
|
|
1909
|
+
_config.toggle = false;
|
|
1914
1910
|
}
|
|
1915
1911
|
|
|
1916
|
-
data
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1912
|
+
const data = Collapse.getOrCreateInstance(this, _config);
|
|
1919
1913
|
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1914
|
+
if (typeof config === 'string') {
|
|
1915
|
+
if (typeof data[config] === 'undefined') {
|
|
1916
|
+
throw new TypeError(`No method named "${config}"`);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
data[config]();
|
|
1920
|
+
}
|
|
1923
1921
|
});
|
|
1924
1922
|
}
|
|
1925
1923
|
|
|
@@ -1937,26 +1935,12 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, functi
|
|
|
1937
1935
|
event.preventDefault();
|
|
1938
1936
|
}
|
|
1939
1937
|
|
|
1940
|
-
const triggerData = Manipulator.getDataAttributes(this);
|
|
1941
1938
|
const selector = getSelectorFromElement(this);
|
|
1942
1939
|
const selectorElements = SelectorEngine.find(selector);
|
|
1943
1940
|
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);
|
|
1941
|
+
Collapse.getOrCreateInstance(element, {
|
|
1942
|
+
toggle: false
|
|
1943
|
+
}).toggle();
|
|
1960
1944
|
});
|
|
1961
1945
|
});
|
|
1962
1946
|
/**
|
|
@@ -1970,7 +1954,7 @@ defineJQueryPlugin(Collapse);
|
|
|
1970
1954
|
|
|
1971
1955
|
/**
|
|
1972
1956
|
* --------------------------------------------------------------------------
|
|
1973
|
-
* CoreUI (v4.0
|
|
1957
|
+
* CoreUI (v4.1.0): dropdown.js
|
|
1974
1958
|
* Licensed under MIT (https://coreui.io/license)
|
|
1975
1959
|
*
|
|
1976
1960
|
* This component is a modified version of the Bootstrap's dropdown.js
|
|
@@ -1983,27 +1967,26 @@ defineJQueryPlugin(Collapse);
|
|
|
1983
1967
|
* ------------------------------------------------------------------------
|
|
1984
1968
|
*/
|
|
1985
1969
|
|
|
1986
|
-
const NAME$
|
|
1987
|
-
const DATA_KEY$
|
|
1988
|
-
const EVENT_KEY$
|
|
1970
|
+
const NAME$b = 'dropdown';
|
|
1971
|
+
const DATA_KEY$a = 'coreui.dropdown';
|
|
1972
|
+
const EVENT_KEY$a = `.${DATA_KEY$a}`;
|
|
1989
1973
|
const DATA_API_KEY$6 = '.data-api';
|
|
1990
1974
|
const ESCAPE_KEY$2 = 'Escape';
|
|
1991
1975
|
const SPACE_KEY = 'Space';
|
|
1992
|
-
const TAB_KEY = 'Tab';
|
|
1976
|
+
const TAB_KEY$1 = 'Tab';
|
|
1993
1977
|
const ARROW_UP_KEY = 'ArrowUp';
|
|
1994
1978
|
const ARROW_DOWN_KEY = 'ArrowDown';
|
|
1995
1979
|
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
|
1996
1980
|
|
|
1997
1981
|
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';
|
|
1982
|
+
const EVENT_HIDE$5 = `hide${EVENT_KEY$a}`;
|
|
1983
|
+
const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$a}`;
|
|
1984
|
+
const EVENT_SHOW$5 = `show${EVENT_KEY$a}`;
|
|
1985
|
+
const EVENT_SHOWN$5 = `shown${EVENT_KEY$a}`;
|
|
1986
|
+
const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
1987
|
+
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
1988
|
+
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$a}${DATA_API_KEY$6}`;
|
|
1989
|
+
const CLASS_NAME_SHOW$8 = 'show';
|
|
2007
1990
|
const CLASS_NAME_DROPUP = 'dropup';
|
|
2008
1991
|
const CLASS_NAME_DROPEND = 'dropend';
|
|
2009
1992
|
const CLASS_NAME_DROPSTART = 'dropstart';
|
|
@@ -2018,7 +2001,7 @@ const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
|
|
|
2018
2001
|
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
|
2019
2002
|
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
|
2020
2003
|
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
|
2021
|
-
const Default$
|
|
2004
|
+
const Default$a = {
|
|
2022
2005
|
offset: [0, 2],
|
|
2023
2006
|
boundary: 'clippingParents',
|
|
2024
2007
|
reference: 'toggle',
|
|
@@ -2026,7 +2009,7 @@ const Default$9 = {
|
|
|
2026
2009
|
popperConfig: null,
|
|
2027
2010
|
autoClose: true
|
|
2028
2011
|
};
|
|
2029
|
-
const DefaultType$
|
|
2012
|
+
const DefaultType$a = {
|
|
2030
2013
|
offset: '(array|string|function)',
|
|
2031
2014
|
boundary: '(string|element)',
|
|
2032
2015
|
reference: '(string|element|object)',
|
|
@@ -2047,45 +2030,31 @@ class Dropdown extends BaseComponent {
|
|
|
2047
2030
|
this._config = this._getConfig(config);
|
|
2048
2031
|
this._menu = this._getMenuElement();
|
|
2049
2032
|
this._inNavbar = this._detectNavbar();
|
|
2050
|
-
|
|
2051
|
-
this._addEventListeners();
|
|
2052
2033
|
} // Getters
|
|
2053
2034
|
|
|
2054
2035
|
|
|
2055
2036
|
static get Default() {
|
|
2056
|
-
return Default$
|
|
2037
|
+
return Default$a;
|
|
2057
2038
|
}
|
|
2058
2039
|
|
|
2059
2040
|
static get DefaultType() {
|
|
2060
|
-
return DefaultType$
|
|
2041
|
+
return DefaultType$a;
|
|
2061
2042
|
}
|
|
2062
2043
|
|
|
2063
2044
|
static get NAME() {
|
|
2064
|
-
return NAME$
|
|
2045
|
+
return NAME$b;
|
|
2065
2046
|
} // Public
|
|
2066
2047
|
|
|
2067
2048
|
|
|
2068
2049
|
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();
|
|
2050
|
+
return this._isShown() ? this.hide() : this.show();
|
|
2081
2051
|
}
|
|
2082
2052
|
|
|
2083
2053
|
show() {
|
|
2084
|
-
if (isDisabled(this._element) || this._menu
|
|
2054
|
+
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
|
2085
2055
|
return;
|
|
2086
2056
|
}
|
|
2087
2057
|
|
|
2088
|
-
const parent = Dropdown.getParentFromElement(this._element);
|
|
2089
2058
|
const relatedTarget = {
|
|
2090
2059
|
relatedTarget: this._element
|
|
2091
2060
|
};
|
|
@@ -2093,34 +2062,14 @@ class Dropdown extends BaseComponent {
|
|
|
2093
2062
|
|
|
2094
2063
|
if (showEvent.defaultPrevented) {
|
|
2095
2064
|
return;
|
|
2096
|
-
}
|
|
2065
|
+
}
|
|
2097
2066
|
|
|
2067
|
+
const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
|
|
2098
2068
|
|
|
2099
2069
|
if (this._inNavbar) {
|
|
2100
2070
|
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
|
|
2101
2071
|
} 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
|
-
}
|
|
2072
|
+
this._createPopper(parent);
|
|
2124
2073
|
} // If this is a touch-enabled device we add extra
|
|
2125
2074
|
// empty mouseover listeners to the body's immediate children;
|
|
2126
2075
|
// only needed because of broken event delegation on iOS
|
|
@@ -2135,15 +2084,15 @@ class Dropdown extends BaseComponent {
|
|
|
2135
2084
|
|
|
2136
2085
|
this._element.setAttribute('aria-expanded', true);
|
|
2137
2086
|
|
|
2138
|
-
this._menu.classList.
|
|
2087
|
+
this._menu.classList.add(CLASS_NAME_SHOW$8);
|
|
2139
2088
|
|
|
2140
|
-
this._element.classList.
|
|
2089
|
+
this._element.classList.add(CLASS_NAME_SHOW$8);
|
|
2141
2090
|
|
|
2142
2091
|
EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
|
|
2143
2092
|
}
|
|
2144
2093
|
|
|
2145
2094
|
hide() {
|
|
2146
|
-
if (isDisabled(this._element) || !this._menu
|
|
2095
|
+
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
|
2147
2096
|
return;
|
|
2148
2097
|
}
|
|
2149
2098
|
|
|
@@ -2171,13 +2120,6 @@ class Dropdown extends BaseComponent {
|
|
|
2171
2120
|
} // Private
|
|
2172
2121
|
|
|
2173
2122
|
|
|
2174
|
-
_addEventListeners() {
|
|
2175
|
-
EventHandler.on(this._element, EVENT_CLICK, event => {
|
|
2176
|
-
event.preventDefault();
|
|
2177
|
-
this.toggle();
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
2123
|
_completeHide(relatedTarget) {
|
|
2182
2124
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
|
|
2183
2125
|
|
|
@@ -2195,9 +2137,9 @@ class Dropdown extends BaseComponent {
|
|
|
2195
2137
|
this._popper.destroy();
|
|
2196
2138
|
}
|
|
2197
2139
|
|
|
2198
|
-
this._menu.classList.remove(CLASS_NAME_SHOW$
|
|
2140
|
+
this._menu.classList.remove(CLASS_NAME_SHOW$8);
|
|
2199
2141
|
|
|
2200
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
2142
|
+
this._element.classList.remove(CLASS_NAME_SHOW$8);
|
|
2201
2143
|
|
|
2202
2144
|
this._element.setAttribute('aria-expanded', 'false');
|
|
2203
2145
|
|
|
@@ -2210,16 +2152,45 @@ class Dropdown extends BaseComponent {
|
|
|
2210
2152
|
...Manipulator.getDataAttributes(this._element),
|
|
2211
2153
|
...config
|
|
2212
2154
|
};
|
|
2213
|
-
typeCheckConfig(NAME$
|
|
2155
|
+
typeCheckConfig(NAME$b, config, this.constructor.DefaultType);
|
|
2214
2156
|
|
|
2215
2157
|
if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
|
|
2216
2158
|
// Popper virtual elements require a getBoundingClientRect method
|
|
2217
|
-
throw new TypeError(`${NAME$
|
|
2159
|
+
throw new TypeError(`${NAME$b.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
|
2218
2160
|
}
|
|
2219
2161
|
|
|
2220
2162
|
return config;
|
|
2221
2163
|
}
|
|
2222
2164
|
|
|
2165
|
+
_createPopper(parent) {
|
|
2166
|
+
if (typeof Popper === 'undefined') {
|
|
2167
|
+
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
let referenceElement = this._element;
|
|
2171
|
+
|
|
2172
|
+
if (this._config.reference === 'parent') {
|
|
2173
|
+
referenceElement = parent;
|
|
2174
|
+
} else if (isElement(this._config.reference)) {
|
|
2175
|
+
referenceElement = getElement(this._config.reference);
|
|
2176
|
+
} else if (typeof this._config.reference === 'object') {
|
|
2177
|
+
referenceElement = this._config.reference;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
const popperConfig = this._getPopperConfig();
|
|
2181
|
+
|
|
2182
|
+
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
|
2183
|
+
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
|
|
2184
|
+
|
|
2185
|
+
if (isDisplayStatic) {
|
|
2186
|
+
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
_isShown(element = this._element) {
|
|
2191
|
+
return element.classList.contains(CLASS_NAME_SHOW$8);
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2223
2194
|
_getMenuElement() {
|
|
2224
2195
|
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
|
|
2225
2196
|
}
|
|
@@ -2309,26 +2280,24 @@ class Dropdown extends BaseComponent {
|
|
|
2309
2280
|
} // Static
|
|
2310
2281
|
|
|
2311
2282
|
|
|
2312
|
-
static
|
|
2313
|
-
|
|
2283
|
+
static jQueryInterface(config) {
|
|
2284
|
+
return this.each(function () {
|
|
2285
|
+
const data = Dropdown.getOrCreateInstance(this, config);
|
|
2286
|
+
|
|
2287
|
+
if (typeof config !== 'string') {
|
|
2288
|
+
return;
|
|
2289
|
+
}
|
|
2314
2290
|
|
|
2315
|
-
if (typeof config === 'string') {
|
|
2316
2291
|
if (typeof data[config] === 'undefined') {
|
|
2317
2292
|
throw new TypeError(`No method named "${config}"`);
|
|
2318
2293
|
}
|
|
2319
2294
|
|
|
2320
2295
|
data[config]();
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
|
-
static jQueryInterface(config) {
|
|
2325
|
-
return this.each(function () {
|
|
2326
|
-
Dropdown.dropdownInterface(this, config);
|
|
2327
2296
|
});
|
|
2328
2297
|
}
|
|
2329
2298
|
|
|
2330
2299
|
static clearMenus(event) {
|
|
2331
|
-
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
|
|
2300
|
+
if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1)) {
|
|
2332
2301
|
return;
|
|
2333
2302
|
}
|
|
2334
2303
|
|
|
@@ -2341,7 +2310,7 @@ class Dropdown extends BaseComponent {
|
|
|
2341
2310
|
continue;
|
|
2342
2311
|
}
|
|
2343
2312
|
|
|
2344
|
-
if (!context.
|
|
2313
|
+
if (!context._isShown()) {
|
|
2345
2314
|
continue;
|
|
2346
2315
|
}
|
|
2347
2316
|
|
|
@@ -2358,7 +2327,7 @@ class Dropdown extends BaseComponent {
|
|
|
2358
2327
|
} // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
|
|
2359
2328
|
|
|
2360
2329
|
|
|
2361
|
-
if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
|
2330
|
+
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
2331
|
continue;
|
|
2363
2332
|
}
|
|
2364
2333
|
|
|
@@ -2387,7 +2356,7 @@ class Dropdown extends BaseComponent {
|
|
|
2387
2356
|
return;
|
|
2388
2357
|
}
|
|
2389
2358
|
|
|
2390
|
-
const isActive = this.classList.contains(CLASS_NAME_SHOW$
|
|
2359
|
+
const isActive = this.classList.contains(CLASS_NAME_SHOW$8);
|
|
2391
2360
|
|
|
2392
2361
|
if (!isActive && event.key === ESCAPE_KEY$2) {
|
|
2393
2362
|
return;
|
|
@@ -2400,20 +2369,20 @@ class Dropdown extends BaseComponent {
|
|
|
2400
2369
|
return;
|
|
2401
2370
|
}
|
|
2402
2371
|
|
|
2403
|
-
const getToggleButton =
|
|
2372
|
+
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$4) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$4)[0];
|
|
2373
|
+
const instance = Dropdown.getOrCreateInstance(getToggleButton);
|
|
2404
2374
|
|
|
2405
2375
|
if (event.key === ESCAPE_KEY$2) {
|
|
2406
|
-
|
|
2407
|
-
Dropdown.clearMenus();
|
|
2376
|
+
instance.hide();
|
|
2408
2377
|
return;
|
|
2409
2378
|
}
|
|
2410
2379
|
|
|
2411
2380
|
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
|
2412
2381
|
if (!isActive) {
|
|
2413
|
-
|
|
2382
|
+
instance.show();
|
|
2414
2383
|
}
|
|
2415
2384
|
|
|
2416
|
-
|
|
2385
|
+
instance._selectMenuItem(event);
|
|
2417
2386
|
|
|
2418
2387
|
return;
|
|
2419
2388
|
}
|
|
@@ -2437,7 +2406,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, Dropdown.clearMenus);
|
|
|
2437
2406
|
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
|
2438
2407
|
EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$4, function (event) {
|
|
2439
2408
|
event.preventDefault();
|
|
2440
|
-
Dropdown.
|
|
2409
|
+
Dropdown.getOrCreateInstance(this).toggle();
|
|
2441
2410
|
});
|
|
2442
2411
|
/**
|
|
2443
2412
|
* ------------------------------------------------------------------------
|
|
@@ -2450,7 +2419,7 @@ defineJQueryPlugin(Dropdown);
|
|
|
2450
2419
|
|
|
2451
2420
|
/**
|
|
2452
2421
|
* --------------------------------------------------------------------------
|
|
2453
|
-
* Bootstrap (v5.
|
|
2422
|
+
* Bootstrap (v5.1.3): util/scrollBar.js
|
|
2454
2423
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2455
2424
|
* --------------------------------------------------------------------------
|
|
2456
2425
|
*/
|
|
@@ -2554,11 +2523,12 @@ class ScrollBarHelper {
|
|
|
2554
2523
|
|
|
2555
2524
|
/**
|
|
2556
2525
|
* --------------------------------------------------------------------------
|
|
2557
|
-
* Bootstrap (v5.
|
|
2558
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/
|
|
2526
|
+
* Bootstrap (v5.1.3): util/backdrop.js
|
|
2527
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2559
2528
|
* --------------------------------------------------------------------------
|
|
2560
2529
|
*/
|
|
2561
|
-
const Default$
|
|
2530
|
+
const Default$9 = {
|
|
2531
|
+
className: 'modal-backdrop',
|
|
2562
2532
|
isVisible: true,
|
|
2563
2533
|
// if false, we use the backdrop helper without adding any element to the dom
|
|
2564
2534
|
isAnimated: false,
|
|
@@ -2566,17 +2536,17 @@ const Default$8 = {
|
|
|
2566
2536
|
// give the choice to place backdrop under different elements
|
|
2567
2537
|
clickCallback: null
|
|
2568
2538
|
};
|
|
2569
|
-
const DefaultType$
|
|
2539
|
+
const DefaultType$9 = {
|
|
2540
|
+
className: 'string',
|
|
2570
2541
|
isVisible: 'boolean',
|
|
2571
2542
|
isAnimated: 'boolean',
|
|
2572
2543
|
rootElement: '(element|string)',
|
|
2573
2544
|
clickCallback: '(function|null)'
|
|
2574
2545
|
};
|
|
2575
|
-
const NAME$
|
|
2576
|
-
const
|
|
2577
|
-
const
|
|
2578
|
-
const
|
|
2579
|
-
const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$9}`;
|
|
2546
|
+
const NAME$a = 'backdrop';
|
|
2547
|
+
const CLASS_NAME_FADE$5 = 'fade';
|
|
2548
|
+
const CLASS_NAME_SHOW$7 = 'show';
|
|
2549
|
+
const EVENT_MOUSEDOWN = `mousedown.coreui.${NAME$a}`;
|
|
2580
2550
|
|
|
2581
2551
|
class Backdrop {
|
|
2582
2552
|
constructor(config) {
|
|
@@ -2597,7 +2567,7 @@ class Backdrop {
|
|
|
2597
2567
|
reflow(this._getElement());
|
|
2598
2568
|
}
|
|
2599
2569
|
|
|
2600
|
-
this._getElement().classList.add(CLASS_NAME_SHOW$
|
|
2570
|
+
this._getElement().classList.add(CLASS_NAME_SHOW$7);
|
|
2601
2571
|
|
|
2602
2572
|
this._emulateAnimation(() => {
|
|
2603
2573
|
execute(callback);
|
|
@@ -2610,7 +2580,7 @@ class Backdrop {
|
|
|
2610
2580
|
return;
|
|
2611
2581
|
}
|
|
2612
2582
|
|
|
2613
|
-
this._getElement().classList.remove(CLASS_NAME_SHOW$
|
|
2583
|
+
this._getElement().classList.remove(CLASS_NAME_SHOW$7);
|
|
2614
2584
|
|
|
2615
2585
|
this._emulateAnimation(() => {
|
|
2616
2586
|
this.dispose();
|
|
@@ -2622,10 +2592,10 @@ class Backdrop {
|
|
|
2622
2592
|
_getElement() {
|
|
2623
2593
|
if (!this._element) {
|
|
2624
2594
|
const backdrop = document.createElement('div');
|
|
2625
|
-
backdrop.className =
|
|
2595
|
+
backdrop.className = this._config.className;
|
|
2626
2596
|
|
|
2627
2597
|
if (this._config.isAnimated) {
|
|
2628
|
-
backdrop.classList.add(CLASS_NAME_FADE$
|
|
2598
|
+
backdrop.classList.add(CLASS_NAME_FADE$5);
|
|
2629
2599
|
}
|
|
2630
2600
|
|
|
2631
2601
|
this._element = backdrop;
|
|
@@ -2635,12 +2605,12 @@ class Backdrop {
|
|
|
2635
2605
|
}
|
|
2636
2606
|
|
|
2637
2607
|
_getConfig(config) {
|
|
2638
|
-
config = { ...Default$
|
|
2608
|
+
config = { ...Default$9,
|
|
2639
2609
|
...(typeof config === 'object' ? config : {})
|
|
2640
2610
|
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
|
|
2641
2611
|
|
|
2642
2612
|
config.rootElement = getElement(config.rootElement);
|
|
2643
|
-
typeCheckConfig(NAME$
|
|
2613
|
+
typeCheckConfig(NAME$a, config, DefaultType$9);
|
|
2644
2614
|
return config;
|
|
2645
2615
|
}
|
|
2646
2616
|
|
|
@@ -2649,7 +2619,7 @@ class Backdrop {
|
|
|
2649
2619
|
return;
|
|
2650
2620
|
}
|
|
2651
2621
|
|
|
2652
|
-
this._config.rootElement.
|
|
2622
|
+
this._config.rootElement.append(this._getElement());
|
|
2653
2623
|
|
|
2654
2624
|
EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
|
|
2655
2625
|
execute(this._config.clickCallback);
|
|
@@ -2677,7 +2647,110 @@ class Backdrop {
|
|
|
2677
2647
|
|
|
2678
2648
|
/**
|
|
2679
2649
|
* --------------------------------------------------------------------------
|
|
2680
|
-
|
|
2650
|
+
* Bootstrap (v5.1.3): util/focustrap.js
|
|
2651
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
2652
|
+
* --------------------------------------------------------------------------
|
|
2653
|
+
*/
|
|
2654
|
+
const Default$8 = {
|
|
2655
|
+
trapElement: null,
|
|
2656
|
+
// The element to trap focus inside of
|
|
2657
|
+
autofocus: true
|
|
2658
|
+
};
|
|
2659
|
+
const DefaultType$8 = {
|
|
2660
|
+
trapElement: 'element',
|
|
2661
|
+
autofocus: 'boolean'
|
|
2662
|
+
};
|
|
2663
|
+
const NAME$9 = 'focustrap';
|
|
2664
|
+
const DATA_KEY$9 = 'coreui.focustrap';
|
|
2665
|
+
const EVENT_KEY$9 = `.${DATA_KEY$9}`;
|
|
2666
|
+
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$9}`;
|
|
2667
|
+
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$9}`;
|
|
2668
|
+
const TAB_KEY = 'Tab';
|
|
2669
|
+
const TAB_NAV_FORWARD = 'forward';
|
|
2670
|
+
const TAB_NAV_BACKWARD = 'backward';
|
|
2671
|
+
|
|
2672
|
+
class FocusTrap {
|
|
2673
|
+
constructor(config) {
|
|
2674
|
+
this._config = this._getConfig(config);
|
|
2675
|
+
this._isActive = false;
|
|
2676
|
+
this._lastTabNavDirection = null;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
activate() {
|
|
2680
|
+
const {
|
|
2681
|
+
trapElement,
|
|
2682
|
+
autofocus
|
|
2683
|
+
} = this._config;
|
|
2684
|
+
|
|
2685
|
+
if (this._isActive) {
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2688
|
+
|
|
2689
|
+
if (autofocus) {
|
|
2690
|
+
trapElement.focus();
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
EventHandler.off(document, EVENT_KEY$9); // guard against infinite focus loop
|
|
2694
|
+
|
|
2695
|
+
EventHandler.on(document, EVENT_FOCUSIN$1, event => this._handleFocusin(event));
|
|
2696
|
+
EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
|
2697
|
+
this._isActive = true;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
deactivate() {
|
|
2701
|
+
if (!this._isActive) {
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
this._isActive = false;
|
|
2706
|
+
EventHandler.off(document, EVENT_KEY$9);
|
|
2707
|
+
} // Private
|
|
2708
|
+
|
|
2709
|
+
|
|
2710
|
+
_handleFocusin(event) {
|
|
2711
|
+
const {
|
|
2712
|
+
target
|
|
2713
|
+
} = event;
|
|
2714
|
+
const {
|
|
2715
|
+
trapElement
|
|
2716
|
+
} = this._config;
|
|
2717
|
+
|
|
2718
|
+
if (target === document || target === trapElement || trapElement.contains(target)) {
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
const elements = SelectorEngine.focusableChildren(trapElement);
|
|
2723
|
+
|
|
2724
|
+
if (elements.length === 0) {
|
|
2725
|
+
trapElement.focus();
|
|
2726
|
+
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
|
2727
|
+
elements[elements.length - 1].focus();
|
|
2728
|
+
} else {
|
|
2729
|
+
elements[0].focus();
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
_handleKeydown(event) {
|
|
2734
|
+
if (event.key !== TAB_KEY) {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
_getConfig(config) {
|
|
2742
|
+
config = { ...Default$8,
|
|
2743
|
+
...(typeof config === 'object' ? config : {})
|
|
2744
|
+
};
|
|
2745
|
+
typeCheckConfig(NAME$9, config, DefaultType$8);
|
|
2746
|
+
return config;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
/**
|
|
2752
|
+
* --------------------------------------------------------------------------
|
|
2753
|
+
* CoreUI (v4.1.0): modal.js
|
|
2681
2754
|
* Licensed under MIT (https://coreui.io/license)
|
|
2682
2755
|
*
|
|
2683
2756
|
* This component is a modified version of the Bootstrap's modal.js
|
|
@@ -2710,21 +2783,20 @@ const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$8}`;
|
|
|
2710
2783
|
const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$8}`;
|
|
2711
2784
|
const EVENT_SHOW$4 = `show${EVENT_KEY$8}`;
|
|
2712
2785
|
const EVENT_SHOWN$4 = `shown${EVENT_KEY$8}`;
|
|
2713
|
-
const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$8}`;
|
|
2714
2786
|
const EVENT_RESIZE$1 = `resize${EVENT_KEY$8}`;
|
|
2715
|
-
const EVENT_CLICK_DISMISS
|
|
2787
|
+
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$8}`;
|
|
2716
2788
|
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$8}`;
|
|
2717
2789
|
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$8}`;
|
|
2718
2790
|
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$8}`;
|
|
2719
2791
|
const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
|
|
2720
2792
|
const CLASS_NAME_OPEN = 'modal-open';
|
|
2721
|
-
const CLASS_NAME_FADE$
|
|
2722
|
-
const CLASS_NAME_SHOW$
|
|
2793
|
+
const CLASS_NAME_FADE$4 = 'fade';
|
|
2794
|
+
const CLASS_NAME_SHOW$6 = 'show';
|
|
2723
2795
|
const CLASS_NAME_STATIC = 'modal-static';
|
|
2796
|
+
const OPEN_SELECTOR$1 = '.modal.show';
|
|
2724
2797
|
const SELECTOR_DIALOG = '.modal-dialog';
|
|
2725
2798
|
const SELECTOR_MODAL_BODY = '.modal-body';
|
|
2726
2799
|
const SELECTOR_DATA_TOGGLE$3 = '[data-coreui-toggle="modal"]';
|
|
2727
|
-
const SELECTOR_DATA_DISMISS$2 = '[data-coreui-dismiss="modal"]';
|
|
2728
2800
|
/**
|
|
2729
2801
|
* ------------------------------------------------------------------------
|
|
2730
2802
|
* Class Definition
|
|
@@ -2737,6 +2809,7 @@ class Modal extends BaseComponent {
|
|
|
2737
2809
|
this._config = this._getConfig(config);
|
|
2738
2810
|
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
|
|
2739
2811
|
this._backdrop = this._initializeBackDrop();
|
|
2812
|
+
this._focustrap = this._initializeFocusTrap();
|
|
2740
2813
|
this._isShown = false;
|
|
2741
2814
|
this._ignoreBackdropClick = false;
|
|
2742
2815
|
this._isTransitioning = false;
|
|
@@ -2786,7 +2859,6 @@ class Modal extends BaseComponent {
|
|
|
2786
2859
|
|
|
2787
2860
|
this._setResizeEvent();
|
|
2788
2861
|
|
|
2789
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
|
|
2790
2862
|
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
|
2791
2863
|
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
|
2792
2864
|
if (event.target === this._element) {
|
|
@@ -2798,11 +2870,7 @@ class Modal extends BaseComponent {
|
|
|
2798
2870
|
this._showBackdrop(() => this._showElement(relatedTarget));
|
|
2799
2871
|
}
|
|
2800
2872
|
|
|
2801
|
-
hide(
|
|
2802
|
-
if (event && ['A', 'AREA'].includes(event.target.tagName)) {
|
|
2803
|
-
event.preventDefault();
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2873
|
+
hide() {
|
|
2806
2874
|
if (!this._isShown || this._isTransitioning) {
|
|
2807
2875
|
return;
|
|
2808
2876
|
}
|
|
@@ -2825,11 +2893,11 @@ class Modal extends BaseComponent {
|
|
|
2825
2893
|
|
|
2826
2894
|
this._setResizeEvent();
|
|
2827
2895
|
|
|
2828
|
-
|
|
2896
|
+
this._focustrap.deactivate();
|
|
2829
2897
|
|
|
2830
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
2898
|
+
this._element.classList.remove(CLASS_NAME_SHOW$6);
|
|
2831
2899
|
|
|
2832
|
-
EventHandler.off(this._element, EVENT_CLICK_DISMISS
|
|
2900
|
+
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
|
2833
2901
|
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
|
2834
2902
|
|
|
2835
2903
|
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
|
|
@@ -2840,14 +2908,9 @@ class Modal extends BaseComponent {
|
|
|
2840
2908
|
|
|
2841
2909
|
this._backdrop.dispose();
|
|
2842
2910
|
|
|
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
|
-
*/
|
|
2911
|
+
this._focustrap.deactivate();
|
|
2849
2912
|
|
|
2850
|
-
|
|
2913
|
+
super.dispose();
|
|
2851
2914
|
}
|
|
2852
2915
|
|
|
2853
2916
|
handleUpdate() {
|
|
@@ -2863,6 +2926,12 @@ class Modal extends BaseComponent {
|
|
|
2863
2926
|
});
|
|
2864
2927
|
}
|
|
2865
2928
|
|
|
2929
|
+
_initializeFocusTrap() {
|
|
2930
|
+
return new FocusTrap({
|
|
2931
|
+
trapElement: this._element
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2866
2935
|
_getConfig(config) {
|
|
2867
2936
|
config = { ...Default$7,
|
|
2868
2937
|
...Manipulator.getDataAttributes(this._element),
|
|
@@ -2879,7 +2948,7 @@ class Modal extends BaseComponent {
|
|
|
2879
2948
|
|
|
2880
2949
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
|
2881
2950
|
// Don't move modal's DOM position
|
|
2882
|
-
document.body.
|
|
2951
|
+
document.body.append(this._element);
|
|
2883
2952
|
}
|
|
2884
2953
|
|
|
2885
2954
|
this._element.style.display = 'block';
|
|
@@ -2900,15 +2969,11 @@ class Modal extends BaseComponent {
|
|
|
2900
2969
|
reflow(this._element);
|
|
2901
2970
|
}
|
|
2902
2971
|
|
|
2903
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
|
2904
|
-
|
|
2905
|
-
if (this._config.focus) {
|
|
2906
|
-
this._enforceFocus();
|
|
2907
|
-
}
|
|
2972
|
+
this._element.classList.add(CLASS_NAME_SHOW$6);
|
|
2908
2973
|
|
|
2909
2974
|
const transitionComplete = () => {
|
|
2910
2975
|
if (this._config.focus) {
|
|
2911
|
-
this.
|
|
2976
|
+
this._focustrap.activate();
|
|
2912
2977
|
}
|
|
2913
2978
|
|
|
2914
2979
|
this._isTransitioning = false;
|
|
@@ -2920,16 +2985,6 @@ class Modal extends BaseComponent {
|
|
|
2920
2985
|
this._queueCallback(transitionComplete, this._dialog, isAnimated);
|
|
2921
2986
|
}
|
|
2922
2987
|
|
|
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
2988
|
_setEscapeEvent() {
|
|
2934
2989
|
if (this._isShown) {
|
|
2935
2990
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
|
|
@@ -2976,7 +3031,7 @@ class Modal extends BaseComponent {
|
|
|
2976
3031
|
}
|
|
2977
3032
|
|
|
2978
3033
|
_showBackdrop(callback) {
|
|
2979
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS
|
|
3034
|
+
EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => {
|
|
2980
3035
|
if (this._ignoreBackdropClick) {
|
|
2981
3036
|
this._ignoreBackdropClick = false;
|
|
2982
3037
|
return;
|
|
@@ -2997,7 +3052,7 @@ class Modal extends BaseComponent {
|
|
|
2997
3052
|
}
|
|
2998
3053
|
|
|
2999
3054
|
_isAnimated() {
|
|
3000
|
-
return this._element.classList.contains(CLASS_NAME_FADE$
|
|
3055
|
+
return this._element.classList.contains(CLASS_NAME_FADE$4);
|
|
3001
3056
|
}
|
|
3002
3057
|
|
|
3003
3058
|
_triggerBackdropTransition() {
|
|
@@ -3104,10 +3159,18 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$3, functi
|
|
|
3104
3159
|
this.focus();
|
|
3105
3160
|
}
|
|
3106
3161
|
});
|
|
3107
|
-
});
|
|
3162
|
+
}); // avoid conflict when clicking moddal toggler while another one is open
|
|
3163
|
+
|
|
3164
|
+
const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
|
|
3165
|
+
|
|
3166
|
+
if (allReadyOpen) {
|
|
3167
|
+
Modal.getInstance(allReadyOpen).hide();
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3108
3170
|
const data = Modal.getOrCreateInstance(target);
|
|
3109
3171
|
data.toggle(this);
|
|
3110
3172
|
});
|
|
3173
|
+
enableDismissTrigger(Modal);
|
|
3111
3174
|
/**
|
|
3112
3175
|
* ------------------------------------------------------------------------
|
|
3113
3176
|
* jQuery
|
|
@@ -3119,7 +3182,7 @@ defineJQueryPlugin(Modal);
|
|
|
3119
3182
|
|
|
3120
3183
|
/**
|
|
3121
3184
|
* --------------------------------------------------------------------------
|
|
3122
|
-
* CoreUI (v4.0
|
|
3185
|
+
* CoreUI (v4.1.0): navigation.js
|
|
3123
3186
|
* Licensed under MIT (https://coreui.io/license)
|
|
3124
3187
|
* --------------------------------------------------------------------------
|
|
3125
3188
|
*/
|
|
@@ -3142,7 +3205,7 @@ const DefaultType$6 = {
|
|
|
3142
3205
|
groupsAutoCollapse: '(string|boolean)'
|
|
3143
3206
|
};
|
|
3144
3207
|
const CLASS_NAME_ACTIVE$2 = 'active';
|
|
3145
|
-
const CLASS_NAME_SHOW$
|
|
3208
|
+
const CLASS_NAME_SHOW$5 = 'show';
|
|
3146
3209
|
const CLASS_NAME_NAV_GROUP = 'nav-group';
|
|
3147
3210
|
const CLASS_NAME_NAV_GROUP_TOGGLE = 'nav-group-toggle';
|
|
3148
3211
|
const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
|
|
@@ -3181,6 +3244,10 @@ class Navigation extends BaseComponent {
|
|
|
3181
3244
|
|
|
3182
3245
|
static get DefaultType() {
|
|
3183
3246
|
return DefaultType$6;
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
static get NAME() {
|
|
3250
|
+
return NAME$7;
|
|
3184
3251
|
} // Private
|
|
3185
3252
|
|
|
3186
3253
|
|
|
@@ -3215,7 +3282,7 @@ class Navigation extends BaseComponent {
|
|
|
3215
3282
|
if (this._config.activeLinksExact && element.href === currentUrl) {
|
|
3216
3283
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3217
3284
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3218
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3285
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3219
3286
|
element.setAttribute('aria-expanded', true);
|
|
3220
3287
|
});
|
|
3221
3288
|
}
|
|
@@ -3223,7 +3290,7 @@ class Navigation extends BaseComponent {
|
|
|
3223
3290
|
if (!this._config.activeLinksExact && element.href.startsWith(currentUrl)) {
|
|
3224
3291
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3225
3292
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3226
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3293
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3227
3294
|
element.setAttribute('aria-expanded', true);
|
|
3228
3295
|
});
|
|
3229
3296
|
}
|
|
@@ -3322,28 +3389,28 @@ class Navigation extends BaseComponent {
|
|
|
3322
3389
|
toggler = toggler.closest(SELECTOR_NAV_GROUP_TOGGLE);
|
|
3323
3390
|
}
|
|
3324
3391
|
|
|
3325
|
-
const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$
|
|
3392
|
+
const filter = element => Boolean(element.classList.contains(CLASS_NAME_NAV_GROUP) && element.classList.contains(CLASS_NAME_SHOW$5)); // Close other groups
|
|
3326
3393
|
|
|
3327
3394
|
|
|
3328
3395
|
if (this._config.groupsAutoCollapse === true) {
|
|
3329
3396
|
this._getSiblings(toggler.parentNode, filter).forEach(element => {
|
|
3330
3397
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, element), () => {
|
|
3331
|
-
element.classList.remove(CLASS_NAME_SHOW$
|
|
3398
|
+
element.classList.remove(CLASS_NAME_SHOW$5);
|
|
3332
3399
|
element.setAttribute('aria-expanded', false);
|
|
3333
3400
|
});
|
|
3334
3401
|
});
|
|
3335
3402
|
}
|
|
3336
3403
|
|
|
3337
|
-
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$
|
|
3404
|
+
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$5)) {
|
|
3338
3405
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode), () => {
|
|
3339
|
-
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$
|
|
3406
|
+
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$5);
|
|
3340
3407
|
toggler.parentNode.setAttribute('aria-expanded', false);
|
|
3341
3408
|
});
|
|
3342
3409
|
|
|
3343
3410
|
return;
|
|
3344
3411
|
}
|
|
3345
3412
|
|
|
3346
|
-
toggler.parentNode.classList.add(CLASS_NAME_SHOW$
|
|
3413
|
+
toggler.parentNode.classList.add(CLASS_NAME_SHOW$5);
|
|
3347
3414
|
toggler.parentNode.setAttribute('aria-expanded', true);
|
|
3348
3415
|
|
|
3349
3416
|
this._slideDown(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode));
|
|
@@ -3396,11 +3463,11 @@ EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
|
|
|
3396
3463
|
* add .Navigation to jQuery only if jQuery is present
|
|
3397
3464
|
*/
|
|
3398
3465
|
|
|
3399
|
-
defineJQueryPlugin(
|
|
3466
|
+
defineJQueryPlugin(Navigation);
|
|
3400
3467
|
|
|
3401
3468
|
/**
|
|
3402
3469
|
* --------------------------------------------------------------------------
|
|
3403
|
-
* CoreUI (v4.0
|
|
3470
|
+
* CoreUI (v4.1.0): dropdown.js
|
|
3404
3471
|
* Licensed under MIT (https://coreui.io/license)
|
|
3405
3472
|
*
|
|
3406
3473
|
* This component is a modified version of the Bootstrap's offcanvas.js
|
|
@@ -3429,17 +3496,15 @@ const DefaultType$5 = {
|
|
|
3429
3496
|
keyboard: 'boolean',
|
|
3430
3497
|
scroll: 'boolean'
|
|
3431
3498
|
};
|
|
3432
|
-
const CLASS_NAME_SHOW$
|
|
3499
|
+
const CLASS_NAME_SHOW$4 = 'show';
|
|
3500
|
+
const CLASS_NAME_BACKDROP$1 = 'offcanvas-backdrop';
|
|
3433
3501
|
const OPEN_SELECTOR = '.offcanvas.show';
|
|
3434
3502
|
const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
|
|
3435
3503
|
const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
|
|
3436
3504
|
const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
|
|
3437
3505
|
const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
|
|
3438
|
-
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
|
|
3439
3506
|
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
3507
|
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
|
|
3442
|
-
const SELECTOR_DATA_DISMISS$1 = '[data-coreui-dismiss="offcanvas"]';
|
|
3443
3508
|
const SELECTOR_DATA_TOGGLE$2 = '[data-coreui-toggle="offcanvas"]';
|
|
3444
3509
|
/**
|
|
3445
3510
|
* ------------------------------------------------------------------------
|
|
@@ -3453,6 +3518,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3453
3518
|
this._config = this._getConfig(config);
|
|
3454
3519
|
this._isShown = false;
|
|
3455
3520
|
this._backdrop = this._initializeBackDrop();
|
|
3521
|
+
this._focustrap = this._initializeFocusTrap();
|
|
3456
3522
|
|
|
3457
3523
|
this._addEventListeners();
|
|
3458
3524
|
} // Getters
|
|
@@ -3491,8 +3557,6 @@ class Offcanvas extends BaseComponent {
|
|
|
3491
3557
|
|
|
3492
3558
|
if (!this._config.scroll) {
|
|
3493
3559
|
new ScrollBarHelper().hide();
|
|
3494
|
-
|
|
3495
|
-
this._enforceFocusOnElement(this._element);
|
|
3496
3560
|
}
|
|
3497
3561
|
|
|
3498
3562
|
this._element.removeAttribute('aria-hidden');
|
|
@@ -3501,9 +3565,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3501
3565
|
|
|
3502
3566
|
this._element.setAttribute('role', 'dialog');
|
|
3503
3567
|
|
|
3504
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
|
3568
|
+
this._element.classList.add(CLASS_NAME_SHOW$4);
|
|
3505
3569
|
|
|
3506
3570
|
const completeCallBack = () => {
|
|
3571
|
+
if (!this._config.scroll) {
|
|
3572
|
+
this._focustrap.activate();
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3507
3575
|
EventHandler.trigger(this._element, EVENT_SHOWN$3, {
|
|
3508
3576
|
relatedTarget
|
|
3509
3577
|
});
|
|
@@ -3523,13 +3591,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3523
3591
|
return;
|
|
3524
3592
|
}
|
|
3525
3593
|
|
|
3526
|
-
|
|
3594
|
+
this._focustrap.deactivate();
|
|
3527
3595
|
|
|
3528
3596
|
this._element.blur();
|
|
3529
3597
|
|
|
3530
3598
|
this._isShown = false;
|
|
3531
3599
|
|
|
3532
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
3600
|
+
this._element.classList.remove(CLASS_NAME_SHOW$4);
|
|
3533
3601
|
|
|
3534
3602
|
this._backdrop.hide();
|
|
3535
3603
|
|
|
@@ -3555,8 +3623,9 @@ class Offcanvas extends BaseComponent {
|
|
|
3555
3623
|
dispose() {
|
|
3556
3624
|
this._backdrop.dispose();
|
|
3557
3625
|
|
|
3626
|
+
this._focustrap.deactivate();
|
|
3627
|
+
|
|
3558
3628
|
super.dispose();
|
|
3559
|
-
EventHandler.off(document, EVENT_FOCUSIN$1);
|
|
3560
3629
|
} // Private
|
|
3561
3630
|
|
|
3562
3631
|
|
|
@@ -3571,6 +3640,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3571
3640
|
|
|
3572
3641
|
_initializeBackDrop() {
|
|
3573
3642
|
return new Backdrop({
|
|
3643
|
+
className: CLASS_NAME_BACKDROP$1,
|
|
3574
3644
|
isVisible: this._config.backdrop,
|
|
3575
3645
|
isAnimated: true,
|
|
3576
3646
|
rootElement: this._element.parentNode,
|
|
@@ -3578,19 +3648,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3578
3648
|
});
|
|
3579
3649
|
}
|
|
3580
3650
|
|
|
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
|
-
}
|
|
3651
|
+
_initializeFocusTrap() {
|
|
3652
|
+
return new FocusTrap({
|
|
3653
|
+
trapElement: this._element
|
|
3588
3654
|
});
|
|
3589
|
-
element.focus();
|
|
3590
3655
|
}
|
|
3591
3656
|
|
|
3592
3657
|
_addEventListeners() {
|
|
3593
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
|
|
3594
3658
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
|
3595
3659
|
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
|
3596
3660
|
this.hide();
|
|
@@ -3651,6 +3715,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
|
|
|
3651
3715
|
data.toggle(this);
|
|
3652
3716
|
});
|
|
3653
3717
|
EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
|
|
3718
|
+
enableDismissTrigger(Offcanvas);
|
|
3654
3719
|
/**
|
|
3655
3720
|
* ------------------------------------------------------------------------
|
|
3656
3721
|
* jQuery
|
|
@@ -3661,45 +3726,45 @@ defineJQueryPlugin(Offcanvas);
|
|
|
3661
3726
|
|
|
3662
3727
|
/**
|
|
3663
3728
|
* --------------------------------------------------------------------------
|
|
3664
|
-
* CoreUI (v4.0
|
|
3729
|
+
* CoreUI (v4.1.0): alert.js
|
|
3665
3730
|
* Licensed under MIT (https://coreui.io/license)
|
|
3666
3731
|
*
|
|
3667
3732
|
* This component is a modified version of the Bootstrap's util/sanitizer.js
|
|
3668
3733
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
3669
3734
|
* --------------------------------------------------------------------------
|
|
3670
3735
|
*/
|
|
3671
|
-
const
|
|
3736
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
|
3672
3737
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
3673
3738
|
/**
|
|
3674
3739
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
3675
3740
|
*
|
|
3676
|
-
* Shoutout to Angular
|
|
3741
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3677
3742
|
*/
|
|
3678
3743
|
|
|
3679
|
-
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3744
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3680
3745
|
/**
|
|
3681
3746
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
3682
3747
|
*
|
|
3683
|
-
* Shoutout to Angular
|
|
3748
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3684
3749
|
*/
|
|
3685
3750
|
|
|
3686
3751
|
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
3752
|
|
|
3688
|
-
const allowedAttribute = (
|
|
3689
|
-
const
|
|
3753
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
3754
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
|
3690
3755
|
|
|
3691
|
-
if (allowedAttributeList.includes(
|
|
3692
|
-
if (
|
|
3693
|
-
return Boolean(SAFE_URL_PATTERN.test(
|
|
3756
|
+
if (allowedAttributeList.includes(attributeName)) {
|
|
3757
|
+
if (uriAttributes.has(attributeName)) {
|
|
3758
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
|
|
3694
3759
|
}
|
|
3695
3760
|
|
|
3696
3761
|
return true;
|
|
3697
3762
|
}
|
|
3698
3763
|
|
|
3699
|
-
const regExp = allowedAttributeList.filter(
|
|
3764
|
+
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
|
|
3700
3765
|
|
|
3701
3766
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
|
3702
|
-
if (regExp[i].test(
|
|
3767
|
+
if (regExp[i].test(attributeName)) {
|
|
3703
3768
|
return true;
|
|
3704
3769
|
}
|
|
3705
3770
|
}
|
|
@@ -3751,23 +3816,22 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3751
3816
|
|
|
3752
3817
|
const domParser = new window.DOMParser();
|
|
3753
3818
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
3754
|
-
const allowlistKeys = Object.keys(allowList);
|
|
3755
3819
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
|
3756
3820
|
|
|
3757
3821
|
for (let i = 0, len = elements.length; i < len; i++) {
|
|
3758
|
-
const
|
|
3759
|
-
const
|
|
3822
|
+
const element = elements[i];
|
|
3823
|
+
const elementName = element.nodeName.toLowerCase();
|
|
3760
3824
|
|
|
3761
|
-
if (!
|
|
3762
|
-
|
|
3825
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
3826
|
+
element.remove();
|
|
3763
3827
|
continue;
|
|
3764
3828
|
}
|
|
3765
3829
|
|
|
3766
|
-
const attributeList = [].concat(...
|
|
3767
|
-
const allowedAttributes = [].concat(allowList['*'] || [], allowList[
|
|
3768
|
-
attributeList.forEach(
|
|
3769
|
-
if (!allowedAttribute(
|
|
3770
|
-
|
|
3830
|
+
const attributeList = [].concat(...element.attributes);
|
|
3831
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
|
3832
|
+
attributeList.forEach(attribute => {
|
|
3833
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
|
3834
|
+
element.removeAttribute(attribute.nodeName);
|
|
3771
3835
|
}
|
|
3772
3836
|
});
|
|
3773
3837
|
}
|
|
@@ -3777,7 +3841,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3777
3841
|
|
|
3778
3842
|
/**
|
|
3779
3843
|
* --------------------------------------------------------------------------
|
|
3780
|
-
* CoreUI (v4.0
|
|
3844
|
+
* CoreUI (v4.1.0): tooltip.js
|
|
3781
3845
|
* Licensed under MIT (https://coreui.io/license)
|
|
3782
3846
|
*
|
|
3783
3847
|
* This component is a modified version of the Bootstrap's tooltip.js
|
|
@@ -3794,7 +3858,6 @@ const NAME$5 = 'tooltip';
|
|
|
3794
3858
|
const DATA_KEY$5 = 'coreui.tooltip';
|
|
3795
3859
|
const EVENT_KEY$5 = `.${DATA_KEY$5}`;
|
|
3796
3860
|
const CLASS_PREFIX$1 = 'bs-tooltip';
|
|
3797
|
-
const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
|
|
3798
3861
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
|
3799
3862
|
const DefaultType$4 = {
|
|
3800
3863
|
animation: 'boolean',
|
|
@@ -3853,12 +3916,14 @@ const Event$2 = {
|
|
|
3853
3916
|
MOUSEENTER: `mouseenter${EVENT_KEY$5}`,
|
|
3854
3917
|
MOUSELEAVE: `mouseleave${EVENT_KEY$5}`
|
|
3855
3918
|
};
|
|
3856
|
-
const CLASS_NAME_FADE$
|
|
3919
|
+
const CLASS_NAME_FADE$3 = 'fade';
|
|
3857
3920
|
const CLASS_NAME_MODAL = 'modal';
|
|
3858
|
-
const CLASS_NAME_SHOW$
|
|
3921
|
+
const CLASS_NAME_SHOW$3 = 'show';
|
|
3859
3922
|
const HOVER_STATE_SHOW = 'show';
|
|
3860
3923
|
const HOVER_STATE_OUT = 'out';
|
|
3861
3924
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
|
3925
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
|
3926
|
+
const EVENT_MODAL_HIDE = 'hide.coreui.modal';
|
|
3862
3927
|
const TRIGGER_HOVER = 'hover';
|
|
3863
3928
|
const TRIGGER_FOCUS = 'focus';
|
|
3864
3929
|
const TRIGGER_CLICK = 'click';
|
|
@@ -3935,7 +4000,7 @@ class Tooltip extends BaseComponent {
|
|
|
3935
4000
|
context._leave(null, context);
|
|
3936
4001
|
}
|
|
3937
4002
|
} else {
|
|
3938
|
-
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4003
|
+
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
|
|
3939
4004
|
this._leave(null, this);
|
|
3940
4005
|
|
|
3941
4006
|
return;
|
|
@@ -3947,15 +4012,13 @@ class Tooltip extends BaseComponent {
|
|
|
3947
4012
|
|
|
3948
4013
|
dispose() {
|
|
3949
4014
|
clearTimeout(this._timeout);
|
|
3950
|
-
EventHandler.off(this._element.closest(
|
|
4015
|
+
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
3951
4016
|
|
|
3952
4017
|
if (this.tip) {
|
|
3953
4018
|
this.tip.remove();
|
|
3954
4019
|
}
|
|
3955
4020
|
|
|
3956
|
-
|
|
3957
|
-
this._popper.destroy();
|
|
3958
|
-
}
|
|
4021
|
+
this._disposePopper();
|
|
3959
4022
|
|
|
3960
4023
|
super.dispose();
|
|
3961
4024
|
}
|
|
@@ -3975,6 +4038,15 @@ class Tooltip extends BaseComponent {
|
|
|
3975
4038
|
|
|
3976
4039
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
|
3977
4040
|
return;
|
|
4041
|
+
} // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-coreui-original-title`
|
|
4042
|
+
// This will be removed later in favor of a `setContent` method
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) {
|
|
4046
|
+
this._disposePopper();
|
|
4047
|
+
|
|
4048
|
+
this.tip.remove();
|
|
4049
|
+
this.tip = null;
|
|
3978
4050
|
}
|
|
3979
4051
|
|
|
3980
4052
|
const tip = this.getTipElement();
|
|
@@ -3983,10 +4055,8 @@ class Tooltip extends BaseComponent {
|
|
|
3983
4055
|
|
|
3984
4056
|
this._element.setAttribute('aria-describedby', tipId);
|
|
3985
4057
|
|
|
3986
|
-
this.setContent();
|
|
3987
|
-
|
|
3988
4058
|
if (this._config.animation) {
|
|
3989
|
-
tip.classList.add(CLASS_NAME_FADE$
|
|
4059
|
+
tip.classList.add(CLASS_NAME_FADE$3);
|
|
3990
4060
|
}
|
|
3991
4061
|
|
|
3992
4062
|
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
|
|
@@ -4001,7 +4071,7 @@ class Tooltip extends BaseComponent {
|
|
|
4001
4071
|
Data.set(tip, this.constructor.DATA_KEY, this);
|
|
4002
4072
|
|
|
4003
4073
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
|
4004
|
-
container.
|
|
4074
|
+
container.append(tip);
|
|
4005
4075
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
|
4006
4076
|
}
|
|
4007
4077
|
|
|
@@ -4011,8 +4081,9 @@ class Tooltip extends BaseComponent {
|
|
|
4011
4081
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
|
4012
4082
|
}
|
|
4013
4083
|
|
|
4014
|
-
tip.classList.add(CLASS_NAME_SHOW$
|
|
4015
|
-
|
|
4084
|
+
tip.classList.add(CLASS_NAME_SHOW$3);
|
|
4085
|
+
|
|
4086
|
+
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
|
4016
4087
|
|
|
4017
4088
|
if (customClass) {
|
|
4018
4089
|
tip.classList.add(...customClass.split(' '));
|
|
@@ -4038,7 +4109,7 @@ class Tooltip extends BaseComponent {
|
|
|
4038
4109
|
}
|
|
4039
4110
|
};
|
|
4040
4111
|
|
|
4041
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4112
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
|
|
4042
4113
|
|
|
4043
4114
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4044
4115
|
}
|
|
@@ -4065,11 +4136,7 @@ class Tooltip extends BaseComponent {
|
|
|
4065
4136
|
|
|
4066
4137
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
|
4067
4138
|
|
|
4068
|
-
|
|
4069
|
-
this._popper.destroy();
|
|
4070
|
-
|
|
4071
|
-
this._popper = null;
|
|
4072
|
-
}
|
|
4139
|
+
this._disposePopper();
|
|
4073
4140
|
};
|
|
4074
4141
|
|
|
4075
4142
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
|
@@ -4078,7 +4145,7 @@ class Tooltip extends BaseComponent {
|
|
|
4078
4145
|
return;
|
|
4079
4146
|
}
|
|
4080
4147
|
|
|
4081
|
-
tip.classList.remove(CLASS_NAME_SHOW$
|
|
4148
|
+
tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
|
|
4082
4149
|
// empty mouseover listeners we added for iOS support
|
|
4083
4150
|
|
|
4084
4151
|
if ('ontouchstart' in document.documentElement) {
|
|
@@ -4088,7 +4155,7 @@ class Tooltip extends BaseComponent {
|
|
|
4088
4155
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
|
4089
4156
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
|
4090
4157
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
|
4091
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4158
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
|
|
4092
4159
|
|
|
4093
4160
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4094
4161
|
|
|
@@ -4113,14 +4180,27 @@ class Tooltip extends BaseComponent {
|
|
|
4113
4180
|
|
|
4114
4181
|
const element = document.createElement('div');
|
|
4115
4182
|
element.innerHTML = this._config.template;
|
|
4116
|
-
|
|
4183
|
+
const tip = element.children[0];
|
|
4184
|
+
this.setContent(tip);
|
|
4185
|
+
tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
|
|
4186
|
+
this.tip = tip;
|
|
4117
4187
|
return this.tip;
|
|
4118
4188
|
}
|
|
4119
4189
|
|
|
4120
|
-
setContent() {
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4190
|
+
setContent(tip) {
|
|
4191
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
_sanitizeAndSetContent(template, content, selector) {
|
|
4195
|
+
const templateElement = SelectorEngine.findOne(selector, template);
|
|
4196
|
+
|
|
4197
|
+
if (!content && templateElement) {
|
|
4198
|
+
templateElement.remove();
|
|
4199
|
+
return;
|
|
4200
|
+
} // we use append for html objects to maintain js events
|
|
4201
|
+
|
|
4202
|
+
|
|
4203
|
+
this.setElementContent(templateElement, content);
|
|
4124
4204
|
}
|
|
4125
4205
|
|
|
4126
4206
|
setElementContent(element, content) {
|
|
@@ -4134,7 +4214,7 @@ class Tooltip extends BaseComponent {
|
|
|
4134
4214
|
if (this._config.html) {
|
|
4135
4215
|
if (content.parentNode !== element) {
|
|
4136
4216
|
element.innerHTML = '';
|
|
4137
|
-
element.
|
|
4217
|
+
element.append(content);
|
|
4138
4218
|
}
|
|
4139
4219
|
} else {
|
|
4140
4220
|
element.textContent = content.textContent;
|
|
@@ -4155,13 +4235,9 @@ class Tooltip extends BaseComponent {
|
|
|
4155
4235
|
}
|
|
4156
4236
|
|
|
4157
4237
|
getTitle() {
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
if (!title) {
|
|
4161
|
-
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
|
4162
|
-
}
|
|
4238
|
+
const title = this._element.getAttribute('data-coreui-original-title') || this._config.title;
|
|
4163
4239
|
|
|
4164
|
-
return title;
|
|
4240
|
+
return this._resolvePossibleFunction(title);
|
|
4165
4241
|
}
|
|
4166
4242
|
|
|
4167
4243
|
updateAttachment(attachment) {
|
|
@@ -4178,15 +4254,7 @@ class Tooltip extends BaseComponent {
|
|
|
4178
4254
|
|
|
4179
4255
|
|
|
4180
4256
|
_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;
|
|
4257
|
+
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
|
4190
4258
|
}
|
|
4191
4259
|
|
|
4192
4260
|
_getOffset() {
|
|
@@ -4205,6 +4273,10 @@ class Tooltip extends BaseComponent {
|
|
|
4205
4273
|
return offset;
|
|
4206
4274
|
}
|
|
4207
4275
|
|
|
4276
|
+
_resolvePossibleFunction(content) {
|
|
4277
|
+
return typeof content === 'function' ? content.call(this._element) : content;
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4208
4280
|
_getPopperConfig(attachment) {
|
|
4209
4281
|
const defaultBsPopperConfig = {
|
|
4210
4282
|
placement: attachment,
|
|
@@ -4246,7 +4318,7 @@ class Tooltip extends BaseComponent {
|
|
|
4246
4318
|
}
|
|
4247
4319
|
|
|
4248
4320
|
_addAttachmentClass(attachment) {
|
|
4249
|
-
this.getTipElement().classList.add(`${
|
|
4321
|
+
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
|
4250
4322
|
}
|
|
4251
4323
|
|
|
4252
4324
|
_getAttachment(placement) {
|
|
@@ -4273,7 +4345,7 @@ class Tooltip extends BaseComponent {
|
|
|
4273
4345
|
}
|
|
4274
4346
|
};
|
|
4275
4347
|
|
|
4276
|
-
EventHandler.on(this._element.closest(
|
|
4348
|
+
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
4277
4349
|
|
|
4278
4350
|
if (this._config.selector) {
|
|
4279
4351
|
this._config = { ...this._config,
|
|
@@ -4308,7 +4380,7 @@ class Tooltip extends BaseComponent {
|
|
|
4308
4380
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
|
4309
4381
|
}
|
|
4310
4382
|
|
|
4311
|
-
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4383
|
+
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
|
|
4312
4384
|
context._hoverState = HOVER_STATE_SHOW;
|
|
4313
4385
|
return;
|
|
4314
4386
|
}
|
|
@@ -4404,26 +4476,32 @@ class Tooltip extends BaseComponent {
|
|
|
4404
4476
|
_getDelegateConfig() {
|
|
4405
4477
|
const config = {};
|
|
4406
4478
|
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
config[key] = this._config[key];
|
|
4411
|
-
}
|
|
4479
|
+
for (const key in this._config) {
|
|
4480
|
+
if (this.constructor.Default[key] !== this._config[key]) {
|
|
4481
|
+
config[key] = this._config[key];
|
|
4412
4482
|
}
|
|
4413
|
-
}
|
|
4483
|
+
} // In the future can be replaced with:
|
|
4484
|
+
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
|
4485
|
+
// `Object.fromEntries(keysWithDifferentValues)`
|
|
4486
|
+
|
|
4414
4487
|
|
|
4415
4488
|
return config;
|
|
4416
4489
|
}
|
|
4417
4490
|
|
|
4418
4491
|
_cleanTipClass() {
|
|
4419
4492
|
const tip = this.getTipElement();
|
|
4420
|
-
const
|
|
4493
|
+
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
|
4494
|
+
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
|
4421
4495
|
|
|
4422
4496
|
if (tabClass !== null && tabClass.length > 0) {
|
|
4423
4497
|
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
|
4424
4498
|
}
|
|
4425
4499
|
}
|
|
4426
4500
|
|
|
4501
|
+
_getBasicClassPrefix() {
|
|
4502
|
+
return CLASS_PREFIX$1;
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4427
4505
|
_handlePopperPlacementChange(popperData) {
|
|
4428
4506
|
const {
|
|
4429
4507
|
state
|
|
@@ -4438,6 +4516,14 @@ class Tooltip extends BaseComponent {
|
|
|
4438
4516
|
this._cleanTipClass();
|
|
4439
4517
|
|
|
4440
4518
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
_disposePopper() {
|
|
4522
|
+
if (this._popper) {
|
|
4523
|
+
this._popper.destroy();
|
|
4524
|
+
|
|
4525
|
+
this._popper = null;
|
|
4526
|
+
}
|
|
4441
4527
|
} // Static
|
|
4442
4528
|
|
|
4443
4529
|
|
|
@@ -4468,7 +4554,7 @@ defineJQueryPlugin(Tooltip);
|
|
|
4468
4554
|
|
|
4469
4555
|
/**
|
|
4470
4556
|
* --------------------------------------------------------------------------
|
|
4471
|
-
* CoreUI (v4.0
|
|
4557
|
+
* CoreUI (v4.1.0): popover.js
|
|
4472
4558
|
* Licensed under MIT (https://coreui.io/license)
|
|
4473
4559
|
*
|
|
4474
4560
|
* This component is a modified version of the Bootstrap's popover.js
|
|
@@ -4485,7 +4571,6 @@ const NAME$4 = 'popover';
|
|
|
4485
4571
|
const DATA_KEY$4 = 'coreui.popover';
|
|
4486
4572
|
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
|
|
4487
4573
|
const CLASS_PREFIX = 'bs-popover';
|
|
4488
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
|
4489
4574
|
const Default$3 = { ...Tooltip.Default,
|
|
4490
4575
|
placement: 'right',
|
|
4491
4576
|
offset: [0, 8],
|
|
@@ -4508,8 +4593,6 @@ const Event$1 = {
|
|
|
4508
4593
|
MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
|
|
4509
4594
|
MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
|
|
4510
4595
|
};
|
|
4511
|
-
const CLASS_NAME_FADE$3 = 'fade';
|
|
4512
|
-
const CLASS_NAME_SHOW$3 = 'show';
|
|
4513
4596
|
const SELECTOR_TITLE = '.popover-header';
|
|
4514
4597
|
const SELECTOR_CONTENT = '.popover-body';
|
|
4515
4598
|
/**
|
|
@@ -4541,55 +4624,19 @@ class Popover extends Tooltip {
|
|
|
4541
4624
|
return this.getTitle() || this._getContent();
|
|
4542
4625
|
}
|
|
4543
4626
|
|
|
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
|
|
4564
|
-
|
|
4565
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
|
4566
|
-
|
|
4567
|
-
let content = this._getContent();
|
|
4627
|
+
setContent(tip) {
|
|
4628
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
|
4568
4629
|
|
|
4569
|
-
|
|
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);
|
|
4630
|
+
this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
|
4575
4631
|
} // Private
|
|
4576
4632
|
|
|
4577
4633
|
|
|
4578
|
-
_addAttachmentClass(attachment) {
|
|
4579
|
-
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
|
4580
|
-
}
|
|
4581
|
-
|
|
4582
4634
|
_getContent() {
|
|
4583
|
-
return this.
|
|
4635
|
+
return this._resolvePossibleFunction(this._config.content);
|
|
4584
4636
|
}
|
|
4585
4637
|
|
|
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
|
-
}
|
|
4638
|
+
_getBasicClassPrefix() {
|
|
4639
|
+
return CLASS_PREFIX;
|
|
4593
4640
|
} // Static
|
|
4594
4641
|
|
|
4595
4642
|
|
|
@@ -4620,7 +4667,7 @@ defineJQueryPlugin(Popover);
|
|
|
4620
4667
|
|
|
4621
4668
|
/**
|
|
4622
4669
|
* --------------------------------------------------------------------------
|
|
4623
|
-
* CoreUI (v4.0
|
|
4670
|
+
* CoreUI (v4.1.0): scrollspy.js
|
|
4624
4671
|
* Licensed under MIT (https://coreui.io/license)
|
|
4625
4672
|
*
|
|
4626
4673
|
* This component is a modified version of the Bootstrap's scrollspy.js
|
|
@@ -4858,7 +4905,7 @@ defineJQueryPlugin(ScrollSpy);
|
|
|
4858
4905
|
|
|
4859
4906
|
/**
|
|
4860
4907
|
* --------------------------------------------------------------------------
|
|
4861
|
-
* CoreUI (v4.0
|
|
4908
|
+
* CoreUI (v4.1.0): sidebar.js
|
|
4862
4909
|
* Licensed under MIT (https://coreui.io/license)
|
|
4863
4910
|
* --------------------------------------------------------------------------
|
|
4864
4911
|
*/
|
|
@@ -5078,7 +5125,7 @@ class Sidebar extends BaseComponent {
|
|
|
5078
5125
|
|
|
5079
5126
|
_removeBackdrop() {
|
|
5080
5127
|
if (this._backdrop) {
|
|
5081
|
-
this._backdrop.
|
|
5128
|
+
this._backdrop.remove();
|
|
5082
5129
|
|
|
5083
5130
|
this._backdrop = null;
|
|
5084
5131
|
}
|
|
@@ -5091,7 +5138,7 @@ class Sidebar extends BaseComponent {
|
|
|
5091
5138
|
|
|
5092
5139
|
this._backdrop.classList.add(CLASS_NAME_FADE$2);
|
|
5093
5140
|
|
|
5094
|
-
document.body.
|
|
5141
|
+
document.body.append(this._backdrop);
|
|
5095
5142
|
reflow(this._backdrop);
|
|
5096
5143
|
|
|
5097
5144
|
this._backdrop.classList.add(CLASS_NAME_SHOW$2);
|
|
@@ -5187,11 +5234,11 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|
|
5187
5234
|
* ------------------------------------------------------------------------
|
|
5188
5235
|
*/
|
|
5189
5236
|
|
|
5190
|
-
defineJQueryPlugin(
|
|
5237
|
+
defineJQueryPlugin(Sidebar);
|
|
5191
5238
|
|
|
5192
5239
|
/**
|
|
5193
5240
|
* --------------------------------------------------------------------------
|
|
5194
|
-
* CoreUI (v4.0
|
|
5241
|
+
* CoreUI (v4.1.0): tab.js
|
|
5195
5242
|
* Licensed under MIT (https://coreui.io/license)
|
|
5196
5243
|
*
|
|
5197
5244
|
* This component is a modified version of the Bootstrap's tab.js
|
|
@@ -5392,7 +5439,7 @@ defineJQueryPlugin(Tab);
|
|
|
5392
5439
|
|
|
5393
5440
|
/**
|
|
5394
5441
|
* --------------------------------------------------------------------------
|
|
5395
|
-
* CoreUI (v4.0
|
|
5442
|
+
* CoreUI (v4.1.0): toast.js
|
|
5396
5443
|
* Licensed under MIT (https://coreui.io/license)
|
|
5397
5444
|
*
|
|
5398
5445
|
* This component is a modified version of the Bootstrap's toast.js
|
|
@@ -5408,7 +5455,6 @@ defineJQueryPlugin(Tab);
|
|
|
5408
5455
|
const NAME = 'toast';
|
|
5409
5456
|
const DATA_KEY = 'coreui.toast';
|
|
5410
5457
|
const EVENT_KEY = `.${DATA_KEY}`;
|
|
5411
|
-
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
|
5412
5458
|
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
|
|
5413
5459
|
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
|
|
5414
5460
|
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
|
@@ -5418,7 +5464,8 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
|
|
5418
5464
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
|
5419
5465
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
|
5420
5466
|
const CLASS_NAME_FADE = 'fade';
|
|
5421
|
-
const CLASS_NAME_HIDE = 'hide';
|
|
5467
|
+
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
|
5468
|
+
|
|
5422
5469
|
const CLASS_NAME_SHOW = 'show';
|
|
5423
5470
|
const CLASS_NAME_SHOWING = 'showing';
|
|
5424
5471
|
const DefaultType = {
|
|
@@ -5431,7 +5478,6 @@ const Default = {
|
|
|
5431
5478
|
autohide: true,
|
|
5432
5479
|
delay: 5000
|
|
5433
5480
|
};
|
|
5434
|
-
const SELECTOR_DATA_DISMISS = '[data-coreui-dismiss="toast"]';
|
|
5435
5481
|
/**
|
|
5436
5482
|
* ------------------------------------------------------------------------
|
|
5437
5483
|
* Class Definition
|
|
@@ -5479,17 +5525,18 @@ class Toast extends BaseComponent {
|
|
|
5479
5525
|
const complete = () => {
|
|
5480
5526
|
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
5481
5527
|
|
|
5482
|
-
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5483
|
-
|
|
5484
5528
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
|
5485
5529
|
|
|
5486
5530
|
this._maybeScheduleHide();
|
|
5487
5531
|
};
|
|
5488
5532
|
|
|
5489
|
-
this._element.classList.remove(CLASS_NAME_HIDE);
|
|
5533
|
+
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
|
5534
|
+
|
|
5490
5535
|
|
|
5491
5536
|
reflow(this._element);
|
|
5492
5537
|
|
|
5538
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5539
|
+
|
|
5493
5540
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5494
5541
|
|
|
5495
5542
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
@@ -5507,12 +5554,17 @@ class Toast extends BaseComponent {
|
|
|
5507
5554
|
}
|
|
5508
5555
|
|
|
5509
5556
|
const complete = () => {
|
|
5510
|
-
this._element.classList.add(CLASS_NAME_HIDE);
|
|
5557
|
+
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
|
|
5558
|
+
|
|
5559
|
+
|
|
5560
|
+
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
5561
|
+
|
|
5562
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
|
5511
5563
|
|
|
5512
5564
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
|
5513
5565
|
};
|
|
5514
5566
|
|
|
5515
|
-
this._element.classList.
|
|
5567
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5516
5568
|
|
|
5517
5569
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
5518
5570
|
}
|
|
@@ -5580,7 +5632,6 @@ class Toast extends BaseComponent {
|
|
|
5580
5632
|
}
|
|
5581
5633
|
|
|
5582
5634
|
_setListeners() {
|
|
5583
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
|
5584
5635
|
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
|
|
5585
5636
|
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
|
|
5586
5637
|
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
|
|
@@ -5608,6 +5659,8 @@ class Toast extends BaseComponent {
|
|
|
5608
5659
|
}
|
|
5609
5660
|
|
|
5610
5661
|
}
|
|
5662
|
+
|
|
5663
|
+
enableDismissTrigger(Toast);
|
|
5611
5664
|
/**
|
|
5612
5665
|
* ------------------------------------------------------------------------
|
|
5613
5666
|
* jQuery
|
|
@@ -5615,8 +5668,7 @@ class Toast extends BaseComponent {
|
|
|
5615
5668
|
* add .Toast to jQuery only if jQuery is present
|
|
5616
5669
|
*/
|
|
5617
5670
|
|
|
5618
|
-
|
|
5619
5671
|
defineJQueryPlugin(Toast);
|
|
5620
5672
|
|
|
5621
|
-
export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas
|
|
5673
|
+
export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Navigation, Offcanvas, Popover, ScrollSpy, Sidebar, Tab, Toast, Tooltip };
|
|
5622
5674
|
//# sourceMappingURL=coreui.esm.js.map
|