@coreui/coreui 4.0.5 → 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 +4 -7
- package/dist/css/coreui-grid.css +254 -205
- package/dist/css/coreui-grid.css.map +1 -1
- package/dist/css/coreui-grid.min.css +2 -2
- package/dist/css/coreui-grid.min.css.map +1 -1
- package/dist/css/coreui-grid.rtl.css +255 -206
- 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 +693 -327
- 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 +676 -325
- 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 +776 -702
- 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 +659 -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 +669 -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 +1 -1
- 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 +3 -3
- 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 +26 -7
- package/scss/mixins/_ltr-rtl.scss +21 -0
- package/scss/mixins/_utilities.scss +26 -26
- package/scss/mixins/_visually-hidden.scss +1 -1
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.5): 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
|
-
const selectorElements = SelectorEngine.find(selector);
|
|
1943
|
-
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);
|
|
1939
|
+
const selectorElements = SelectorEngine.find(selector);
|
|
1940
|
+
selectorElements.forEach(element => {
|
|
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}`;
|
|
@@ -3219,7 +3282,7 @@ class Navigation extends BaseComponent {
|
|
|
3219
3282
|
if (this._config.activeLinksExact && element.href === currentUrl) {
|
|
3220
3283
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3221
3284
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3222
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3285
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3223
3286
|
element.setAttribute('aria-expanded', true);
|
|
3224
3287
|
});
|
|
3225
3288
|
}
|
|
@@ -3227,7 +3290,7 @@ class Navigation extends BaseComponent {
|
|
|
3227
3290
|
if (!this._config.activeLinksExact && element.href.startsWith(currentUrl)) {
|
|
3228
3291
|
element.classList.add(CLASS_NAME_ACTIVE$2);
|
|
3229
3292
|
Array.from(this._getParents(element, SELECTOR_NAV_GROUP)).forEach(element => {
|
|
3230
|
-
element.classList.add(CLASS_NAME_SHOW$
|
|
3293
|
+
element.classList.add(CLASS_NAME_SHOW$5);
|
|
3231
3294
|
element.setAttribute('aria-expanded', true);
|
|
3232
3295
|
});
|
|
3233
3296
|
}
|
|
@@ -3326,28 +3389,28 @@ class Navigation extends BaseComponent {
|
|
|
3326
3389
|
toggler = toggler.closest(SELECTOR_NAV_GROUP_TOGGLE);
|
|
3327
3390
|
}
|
|
3328
3391
|
|
|
3329
|
-
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
|
|
3330
3393
|
|
|
3331
3394
|
|
|
3332
3395
|
if (this._config.groupsAutoCollapse === true) {
|
|
3333
3396
|
this._getSiblings(toggler.parentNode, filter).forEach(element => {
|
|
3334
3397
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, element), () => {
|
|
3335
|
-
element.classList.remove(CLASS_NAME_SHOW$
|
|
3398
|
+
element.classList.remove(CLASS_NAME_SHOW$5);
|
|
3336
3399
|
element.setAttribute('aria-expanded', false);
|
|
3337
3400
|
});
|
|
3338
3401
|
});
|
|
3339
3402
|
}
|
|
3340
3403
|
|
|
3341
|
-
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$
|
|
3404
|
+
if (toggler.parentNode.classList.contains(CLASS_NAME_SHOW$5)) {
|
|
3342
3405
|
this._slideUp(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode), () => {
|
|
3343
|
-
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$
|
|
3406
|
+
toggler.parentNode.classList.remove(CLASS_NAME_SHOW$5);
|
|
3344
3407
|
toggler.parentNode.setAttribute('aria-expanded', false);
|
|
3345
3408
|
});
|
|
3346
3409
|
|
|
3347
3410
|
return;
|
|
3348
3411
|
}
|
|
3349
3412
|
|
|
3350
|
-
toggler.parentNode.classList.add(CLASS_NAME_SHOW$
|
|
3413
|
+
toggler.parentNode.classList.add(CLASS_NAME_SHOW$5);
|
|
3351
3414
|
toggler.parentNode.setAttribute('aria-expanded', true);
|
|
3352
3415
|
|
|
3353
3416
|
this._slideDown(SelectorEngine.findOne(SELECTOR_NAV_GROUP_ITEMS, toggler.parentNode));
|
|
@@ -3404,7 +3467,7 @@ defineJQueryPlugin(Navigation);
|
|
|
3404
3467
|
|
|
3405
3468
|
/**
|
|
3406
3469
|
* --------------------------------------------------------------------------
|
|
3407
|
-
* CoreUI (v4.0
|
|
3470
|
+
* CoreUI (v4.1.0): dropdown.js
|
|
3408
3471
|
* Licensed under MIT (https://coreui.io/license)
|
|
3409
3472
|
*
|
|
3410
3473
|
* This component is a modified version of the Bootstrap's offcanvas.js
|
|
@@ -3433,17 +3496,15 @@ const DefaultType$5 = {
|
|
|
3433
3496
|
keyboard: 'boolean',
|
|
3434
3497
|
scroll: 'boolean'
|
|
3435
3498
|
};
|
|
3436
|
-
const CLASS_NAME_SHOW$
|
|
3499
|
+
const CLASS_NAME_SHOW$4 = 'show';
|
|
3500
|
+
const CLASS_NAME_BACKDROP$1 = 'offcanvas-backdrop';
|
|
3437
3501
|
const OPEN_SELECTOR = '.offcanvas.show';
|
|
3438
3502
|
const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
|
|
3439
3503
|
const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
|
|
3440
3504
|
const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
|
|
3441
3505
|
const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
|
|
3442
|
-
const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$6}`;
|
|
3443
3506
|
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
|
|
3444
|
-
const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$6}`;
|
|
3445
3507
|
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$6}`;
|
|
3446
|
-
const SELECTOR_DATA_DISMISS$1 = '[data-coreui-dismiss="offcanvas"]';
|
|
3447
3508
|
const SELECTOR_DATA_TOGGLE$2 = '[data-coreui-toggle="offcanvas"]';
|
|
3448
3509
|
/**
|
|
3449
3510
|
* ------------------------------------------------------------------------
|
|
@@ -3457,6 +3518,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3457
3518
|
this._config = this._getConfig(config);
|
|
3458
3519
|
this._isShown = false;
|
|
3459
3520
|
this._backdrop = this._initializeBackDrop();
|
|
3521
|
+
this._focustrap = this._initializeFocusTrap();
|
|
3460
3522
|
|
|
3461
3523
|
this._addEventListeners();
|
|
3462
3524
|
} // Getters
|
|
@@ -3495,8 +3557,6 @@ class Offcanvas extends BaseComponent {
|
|
|
3495
3557
|
|
|
3496
3558
|
if (!this._config.scroll) {
|
|
3497
3559
|
new ScrollBarHelper().hide();
|
|
3498
|
-
|
|
3499
|
-
this._enforceFocusOnElement(this._element);
|
|
3500
3560
|
}
|
|
3501
3561
|
|
|
3502
3562
|
this._element.removeAttribute('aria-hidden');
|
|
@@ -3505,9 +3565,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3505
3565
|
|
|
3506
3566
|
this._element.setAttribute('role', 'dialog');
|
|
3507
3567
|
|
|
3508
|
-
this._element.classList.add(CLASS_NAME_SHOW$
|
|
3568
|
+
this._element.classList.add(CLASS_NAME_SHOW$4);
|
|
3509
3569
|
|
|
3510
3570
|
const completeCallBack = () => {
|
|
3571
|
+
if (!this._config.scroll) {
|
|
3572
|
+
this._focustrap.activate();
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3511
3575
|
EventHandler.trigger(this._element, EVENT_SHOWN$3, {
|
|
3512
3576
|
relatedTarget
|
|
3513
3577
|
});
|
|
@@ -3527,13 +3591,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3527
3591
|
return;
|
|
3528
3592
|
}
|
|
3529
3593
|
|
|
3530
|
-
|
|
3594
|
+
this._focustrap.deactivate();
|
|
3531
3595
|
|
|
3532
3596
|
this._element.blur();
|
|
3533
3597
|
|
|
3534
3598
|
this._isShown = false;
|
|
3535
3599
|
|
|
3536
|
-
this._element.classList.remove(CLASS_NAME_SHOW$
|
|
3600
|
+
this._element.classList.remove(CLASS_NAME_SHOW$4);
|
|
3537
3601
|
|
|
3538
3602
|
this._backdrop.hide();
|
|
3539
3603
|
|
|
@@ -3559,8 +3623,9 @@ class Offcanvas extends BaseComponent {
|
|
|
3559
3623
|
dispose() {
|
|
3560
3624
|
this._backdrop.dispose();
|
|
3561
3625
|
|
|
3626
|
+
this._focustrap.deactivate();
|
|
3627
|
+
|
|
3562
3628
|
super.dispose();
|
|
3563
|
-
EventHandler.off(document, EVENT_FOCUSIN$1);
|
|
3564
3629
|
} // Private
|
|
3565
3630
|
|
|
3566
3631
|
|
|
@@ -3575,6 +3640,7 @@ class Offcanvas extends BaseComponent {
|
|
|
3575
3640
|
|
|
3576
3641
|
_initializeBackDrop() {
|
|
3577
3642
|
return new Backdrop({
|
|
3643
|
+
className: CLASS_NAME_BACKDROP$1,
|
|
3578
3644
|
isVisible: this._config.backdrop,
|
|
3579
3645
|
isAnimated: true,
|
|
3580
3646
|
rootElement: this._element.parentNode,
|
|
@@ -3582,19 +3648,13 @@ class Offcanvas extends BaseComponent {
|
|
|
3582
3648
|
});
|
|
3583
3649
|
}
|
|
3584
3650
|
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
EventHandler.on(document, EVENT_FOCUSIN$1, event => {
|
|
3589
|
-
if (document !== event.target && element !== event.target && !element.contains(event.target)) {
|
|
3590
|
-
element.focus();
|
|
3591
|
-
}
|
|
3651
|
+
_initializeFocusTrap() {
|
|
3652
|
+
return new FocusTrap({
|
|
3653
|
+
trapElement: this._element
|
|
3592
3654
|
});
|
|
3593
|
-
element.focus();
|
|
3594
3655
|
}
|
|
3595
3656
|
|
|
3596
3657
|
_addEventListeners() {
|
|
3597
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
|
|
3598
3658
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
|
3599
3659
|
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
|
3600
3660
|
this.hide();
|
|
@@ -3655,6 +3715,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, functi
|
|
|
3655
3715
|
data.toggle(this);
|
|
3656
3716
|
});
|
|
3657
3717
|
EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
|
|
3718
|
+
enableDismissTrigger(Offcanvas);
|
|
3658
3719
|
/**
|
|
3659
3720
|
* ------------------------------------------------------------------------
|
|
3660
3721
|
* jQuery
|
|
@@ -3665,45 +3726,45 @@ defineJQueryPlugin(Offcanvas);
|
|
|
3665
3726
|
|
|
3666
3727
|
/**
|
|
3667
3728
|
* --------------------------------------------------------------------------
|
|
3668
|
-
* CoreUI (v4.0
|
|
3729
|
+
* CoreUI (v4.1.0): alert.js
|
|
3669
3730
|
* Licensed under MIT (https://coreui.io/license)
|
|
3670
3731
|
*
|
|
3671
3732
|
* This component is a modified version of the Bootstrap's util/sanitizer.js
|
|
3672
3733
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
3673
3734
|
* --------------------------------------------------------------------------
|
|
3674
3735
|
*/
|
|
3675
|
-
const
|
|
3736
|
+
const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
|
|
3676
3737
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
3677
3738
|
/**
|
|
3678
3739
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
3679
3740
|
*
|
|
3680
|
-
* Shoutout to Angular
|
|
3741
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3681
3742
|
*/
|
|
3682
3743
|
|
|
3683
|
-
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3744
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
|
3684
3745
|
/**
|
|
3685
3746
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
3686
3747
|
*
|
|
3687
|
-
* Shoutout to Angular
|
|
3748
|
+
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
|
3688
3749
|
*/
|
|
3689
3750
|
|
|
3690
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;
|
|
3691
3752
|
|
|
3692
|
-
const allowedAttribute = (
|
|
3693
|
-
const
|
|
3753
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
3754
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
|
3694
3755
|
|
|
3695
|
-
if (allowedAttributeList.includes(
|
|
3696
|
-
if (
|
|
3697
|
-
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));
|
|
3698
3759
|
}
|
|
3699
3760
|
|
|
3700
3761
|
return true;
|
|
3701
3762
|
}
|
|
3702
3763
|
|
|
3703
|
-
const regExp = allowedAttributeList.filter(
|
|
3764
|
+
const regExp = allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp); // Check if a regular expression validates the attribute.
|
|
3704
3765
|
|
|
3705
3766
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
|
3706
|
-
if (regExp[i].test(
|
|
3767
|
+
if (regExp[i].test(attributeName)) {
|
|
3707
3768
|
return true;
|
|
3708
3769
|
}
|
|
3709
3770
|
}
|
|
@@ -3755,23 +3816,22 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3755
3816
|
|
|
3756
3817
|
const domParser = new window.DOMParser();
|
|
3757
3818
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
3758
|
-
const allowlistKeys = Object.keys(allowList);
|
|
3759
3819
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
|
3760
3820
|
|
|
3761
3821
|
for (let i = 0, len = elements.length; i < len; i++) {
|
|
3762
|
-
const
|
|
3763
|
-
const
|
|
3822
|
+
const element = elements[i];
|
|
3823
|
+
const elementName = element.nodeName.toLowerCase();
|
|
3764
3824
|
|
|
3765
|
-
if (!
|
|
3766
|
-
|
|
3825
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
3826
|
+
element.remove();
|
|
3767
3827
|
continue;
|
|
3768
3828
|
}
|
|
3769
3829
|
|
|
3770
|
-
const attributeList = [].concat(...
|
|
3771
|
-
const allowedAttributes = [].concat(allowList['*'] || [], allowList[
|
|
3772
|
-
attributeList.forEach(
|
|
3773
|
-
if (!allowedAttribute(
|
|
3774
|
-
|
|
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);
|
|
3775
3835
|
}
|
|
3776
3836
|
});
|
|
3777
3837
|
}
|
|
@@ -3781,7 +3841,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
|
|
3781
3841
|
|
|
3782
3842
|
/**
|
|
3783
3843
|
* --------------------------------------------------------------------------
|
|
3784
|
-
* CoreUI (v4.0
|
|
3844
|
+
* CoreUI (v4.1.0): tooltip.js
|
|
3785
3845
|
* Licensed under MIT (https://coreui.io/license)
|
|
3786
3846
|
*
|
|
3787
3847
|
* This component is a modified version of the Bootstrap's tooltip.js
|
|
@@ -3798,7 +3858,6 @@ const NAME$5 = 'tooltip';
|
|
|
3798
3858
|
const DATA_KEY$5 = 'coreui.tooltip';
|
|
3799
3859
|
const EVENT_KEY$5 = `.${DATA_KEY$5}`;
|
|
3800
3860
|
const CLASS_PREFIX$1 = 'bs-tooltip';
|
|
3801
|
-
const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
|
|
3802
3861
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
|
3803
3862
|
const DefaultType$4 = {
|
|
3804
3863
|
animation: 'boolean',
|
|
@@ -3857,12 +3916,14 @@ const Event$2 = {
|
|
|
3857
3916
|
MOUSEENTER: `mouseenter${EVENT_KEY$5}`,
|
|
3858
3917
|
MOUSELEAVE: `mouseleave${EVENT_KEY$5}`
|
|
3859
3918
|
};
|
|
3860
|
-
const CLASS_NAME_FADE$
|
|
3919
|
+
const CLASS_NAME_FADE$3 = 'fade';
|
|
3861
3920
|
const CLASS_NAME_MODAL = 'modal';
|
|
3862
|
-
const CLASS_NAME_SHOW$
|
|
3921
|
+
const CLASS_NAME_SHOW$3 = 'show';
|
|
3863
3922
|
const HOVER_STATE_SHOW = 'show';
|
|
3864
3923
|
const HOVER_STATE_OUT = 'out';
|
|
3865
3924
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
|
3925
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
|
3926
|
+
const EVENT_MODAL_HIDE = 'hide.coreui.modal';
|
|
3866
3927
|
const TRIGGER_HOVER = 'hover';
|
|
3867
3928
|
const TRIGGER_FOCUS = 'focus';
|
|
3868
3929
|
const TRIGGER_CLICK = 'click';
|
|
@@ -3939,7 +4000,7 @@ class Tooltip extends BaseComponent {
|
|
|
3939
4000
|
context._leave(null, context);
|
|
3940
4001
|
}
|
|
3941
4002
|
} else {
|
|
3942
|
-
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4003
|
+
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
|
|
3943
4004
|
this._leave(null, this);
|
|
3944
4005
|
|
|
3945
4006
|
return;
|
|
@@ -3951,15 +4012,13 @@ class Tooltip extends BaseComponent {
|
|
|
3951
4012
|
|
|
3952
4013
|
dispose() {
|
|
3953
4014
|
clearTimeout(this._timeout);
|
|
3954
|
-
EventHandler.off(this._element.closest(
|
|
4015
|
+
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
3955
4016
|
|
|
3956
4017
|
if (this.tip) {
|
|
3957
4018
|
this.tip.remove();
|
|
3958
4019
|
}
|
|
3959
4020
|
|
|
3960
|
-
|
|
3961
|
-
this._popper.destroy();
|
|
3962
|
-
}
|
|
4021
|
+
this._disposePopper();
|
|
3963
4022
|
|
|
3964
4023
|
super.dispose();
|
|
3965
4024
|
}
|
|
@@ -3979,6 +4038,15 @@ class Tooltip extends BaseComponent {
|
|
|
3979
4038
|
|
|
3980
4039
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
|
3981
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;
|
|
3982
4050
|
}
|
|
3983
4051
|
|
|
3984
4052
|
const tip = this.getTipElement();
|
|
@@ -3987,10 +4055,8 @@ class Tooltip extends BaseComponent {
|
|
|
3987
4055
|
|
|
3988
4056
|
this._element.setAttribute('aria-describedby', tipId);
|
|
3989
4057
|
|
|
3990
|
-
this.setContent();
|
|
3991
|
-
|
|
3992
4058
|
if (this._config.animation) {
|
|
3993
|
-
tip.classList.add(CLASS_NAME_FADE$
|
|
4059
|
+
tip.classList.add(CLASS_NAME_FADE$3);
|
|
3994
4060
|
}
|
|
3995
4061
|
|
|
3996
4062
|
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
|
|
@@ -4005,7 +4071,7 @@ class Tooltip extends BaseComponent {
|
|
|
4005
4071
|
Data.set(tip, this.constructor.DATA_KEY, this);
|
|
4006
4072
|
|
|
4007
4073
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
|
4008
|
-
container.
|
|
4074
|
+
container.append(tip);
|
|
4009
4075
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
|
4010
4076
|
}
|
|
4011
4077
|
|
|
@@ -4015,8 +4081,9 @@ class Tooltip extends BaseComponent {
|
|
|
4015
4081
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
|
4016
4082
|
}
|
|
4017
4083
|
|
|
4018
|
-
tip.classList.add(CLASS_NAME_SHOW$
|
|
4019
|
-
|
|
4084
|
+
tip.classList.add(CLASS_NAME_SHOW$3);
|
|
4085
|
+
|
|
4086
|
+
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
|
4020
4087
|
|
|
4021
4088
|
if (customClass) {
|
|
4022
4089
|
tip.classList.add(...customClass.split(' '));
|
|
@@ -4042,7 +4109,7 @@ class Tooltip extends BaseComponent {
|
|
|
4042
4109
|
}
|
|
4043
4110
|
};
|
|
4044
4111
|
|
|
4045
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4112
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
|
|
4046
4113
|
|
|
4047
4114
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4048
4115
|
}
|
|
@@ -4069,11 +4136,7 @@ class Tooltip extends BaseComponent {
|
|
|
4069
4136
|
|
|
4070
4137
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
|
4071
4138
|
|
|
4072
|
-
|
|
4073
|
-
this._popper.destroy();
|
|
4074
|
-
|
|
4075
|
-
this._popper = null;
|
|
4076
|
-
}
|
|
4139
|
+
this._disposePopper();
|
|
4077
4140
|
};
|
|
4078
4141
|
|
|
4079
4142
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
|
@@ -4082,7 +4145,7 @@ class Tooltip extends BaseComponent {
|
|
|
4082
4145
|
return;
|
|
4083
4146
|
}
|
|
4084
4147
|
|
|
4085
|
-
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
|
|
4086
4149
|
// empty mouseover listeners we added for iOS support
|
|
4087
4150
|
|
|
4088
4151
|
if ('ontouchstart' in document.documentElement) {
|
|
@@ -4092,7 +4155,7 @@ class Tooltip extends BaseComponent {
|
|
|
4092
4155
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
|
4093
4156
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
|
4094
4157
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
|
4095
|
-
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$
|
|
4158
|
+
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
|
|
4096
4159
|
|
|
4097
4160
|
this._queueCallback(complete, this.tip, isAnimated);
|
|
4098
4161
|
|
|
@@ -4117,14 +4180,27 @@ class Tooltip extends BaseComponent {
|
|
|
4117
4180
|
|
|
4118
4181
|
const element = document.createElement('div');
|
|
4119
4182
|
element.innerHTML = this._config.template;
|
|
4120
|
-
|
|
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;
|
|
4121
4187
|
return this.tip;
|
|
4122
4188
|
}
|
|
4123
4189
|
|
|
4124
|
-
setContent() {
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
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);
|
|
4128
4204
|
}
|
|
4129
4205
|
|
|
4130
4206
|
setElementContent(element, content) {
|
|
@@ -4138,7 +4214,7 @@ class Tooltip extends BaseComponent {
|
|
|
4138
4214
|
if (this._config.html) {
|
|
4139
4215
|
if (content.parentNode !== element) {
|
|
4140
4216
|
element.innerHTML = '';
|
|
4141
|
-
element.
|
|
4217
|
+
element.append(content);
|
|
4142
4218
|
}
|
|
4143
4219
|
} else {
|
|
4144
4220
|
element.textContent = content.textContent;
|
|
@@ -4159,13 +4235,9 @@ class Tooltip extends BaseComponent {
|
|
|
4159
4235
|
}
|
|
4160
4236
|
|
|
4161
4237
|
getTitle() {
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
if (!title) {
|
|
4165
|
-
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
|
4166
|
-
}
|
|
4238
|
+
const title = this._element.getAttribute('data-coreui-original-title') || this._config.title;
|
|
4167
4239
|
|
|
4168
|
-
return title;
|
|
4240
|
+
return this._resolvePossibleFunction(title);
|
|
4169
4241
|
}
|
|
4170
4242
|
|
|
4171
4243
|
updateAttachment(attachment) {
|
|
@@ -4182,15 +4254,7 @@ class Tooltip extends BaseComponent {
|
|
|
4182
4254
|
|
|
4183
4255
|
|
|
4184
4256
|
_initializeOnDelegatedTarget(event, context) {
|
|
4185
|
-
|
|
4186
|
-
context = context || Data.get(event.delegateTarget, dataKey);
|
|
4187
|
-
|
|
4188
|
-
if (!context) {
|
|
4189
|
-
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
|
4190
|
-
Data.set(event.delegateTarget, dataKey, context);
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
return context;
|
|
4257
|
+
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
|
4194
4258
|
}
|
|
4195
4259
|
|
|
4196
4260
|
_getOffset() {
|
|
@@ -4209,6 +4273,10 @@ class Tooltip extends BaseComponent {
|
|
|
4209
4273
|
return offset;
|
|
4210
4274
|
}
|
|
4211
4275
|
|
|
4276
|
+
_resolvePossibleFunction(content) {
|
|
4277
|
+
return typeof content === 'function' ? content.call(this._element) : content;
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4212
4280
|
_getPopperConfig(attachment) {
|
|
4213
4281
|
const defaultBsPopperConfig = {
|
|
4214
4282
|
placement: attachment,
|
|
@@ -4250,7 +4318,7 @@ class Tooltip extends BaseComponent {
|
|
|
4250
4318
|
}
|
|
4251
4319
|
|
|
4252
4320
|
_addAttachmentClass(attachment) {
|
|
4253
|
-
this.getTipElement().classList.add(`${
|
|
4321
|
+
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
|
4254
4322
|
}
|
|
4255
4323
|
|
|
4256
4324
|
_getAttachment(placement) {
|
|
@@ -4277,7 +4345,7 @@ class Tooltip extends BaseComponent {
|
|
|
4277
4345
|
}
|
|
4278
4346
|
};
|
|
4279
4347
|
|
|
4280
|
-
EventHandler.on(this._element.closest(
|
|
4348
|
+
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
4281
4349
|
|
|
4282
4350
|
if (this._config.selector) {
|
|
4283
4351
|
this._config = { ...this._config,
|
|
@@ -4312,7 +4380,7 @@ class Tooltip extends BaseComponent {
|
|
|
4312
4380
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
|
4313
4381
|
}
|
|
4314
4382
|
|
|
4315
|
-
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$
|
|
4383
|
+
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
|
|
4316
4384
|
context._hoverState = HOVER_STATE_SHOW;
|
|
4317
4385
|
return;
|
|
4318
4386
|
}
|
|
@@ -4408,26 +4476,32 @@ class Tooltip extends BaseComponent {
|
|
|
4408
4476
|
_getDelegateConfig() {
|
|
4409
4477
|
const config = {};
|
|
4410
4478
|
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
config[key] = this._config[key];
|
|
4415
|
-
}
|
|
4479
|
+
for (const key in this._config) {
|
|
4480
|
+
if (this.constructor.Default[key] !== this._config[key]) {
|
|
4481
|
+
config[key] = this._config[key];
|
|
4416
4482
|
}
|
|
4417
|
-
}
|
|
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
|
+
|
|
4418
4487
|
|
|
4419
4488
|
return config;
|
|
4420
4489
|
}
|
|
4421
4490
|
|
|
4422
4491
|
_cleanTipClass() {
|
|
4423
4492
|
const tip = this.getTipElement();
|
|
4424
|
-
const
|
|
4493
|
+
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
|
4494
|
+
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
|
4425
4495
|
|
|
4426
4496
|
if (tabClass !== null && tabClass.length > 0) {
|
|
4427
4497
|
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
|
4428
4498
|
}
|
|
4429
4499
|
}
|
|
4430
4500
|
|
|
4501
|
+
_getBasicClassPrefix() {
|
|
4502
|
+
return CLASS_PREFIX$1;
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4431
4505
|
_handlePopperPlacementChange(popperData) {
|
|
4432
4506
|
const {
|
|
4433
4507
|
state
|
|
@@ -4442,6 +4516,14 @@ class Tooltip extends BaseComponent {
|
|
|
4442
4516
|
this._cleanTipClass();
|
|
4443
4517
|
|
|
4444
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
|
+
}
|
|
4445
4527
|
} // Static
|
|
4446
4528
|
|
|
4447
4529
|
|
|
@@ -4472,7 +4554,7 @@ defineJQueryPlugin(Tooltip);
|
|
|
4472
4554
|
|
|
4473
4555
|
/**
|
|
4474
4556
|
* --------------------------------------------------------------------------
|
|
4475
|
-
* CoreUI (v4.0
|
|
4557
|
+
* CoreUI (v4.1.0): popover.js
|
|
4476
4558
|
* Licensed under MIT (https://coreui.io/license)
|
|
4477
4559
|
*
|
|
4478
4560
|
* This component is a modified version of the Bootstrap's popover.js
|
|
@@ -4489,7 +4571,6 @@ const NAME$4 = 'popover';
|
|
|
4489
4571
|
const DATA_KEY$4 = 'coreui.popover';
|
|
4490
4572
|
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
|
|
4491
4573
|
const CLASS_PREFIX = 'bs-popover';
|
|
4492
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
|
4493
4574
|
const Default$3 = { ...Tooltip.Default,
|
|
4494
4575
|
placement: 'right',
|
|
4495
4576
|
offset: [0, 8],
|
|
@@ -4512,8 +4593,6 @@ const Event$1 = {
|
|
|
4512
4593
|
MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
|
|
4513
4594
|
MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
|
|
4514
4595
|
};
|
|
4515
|
-
const CLASS_NAME_FADE$3 = 'fade';
|
|
4516
|
-
const CLASS_NAME_SHOW$3 = 'show';
|
|
4517
4596
|
const SELECTOR_TITLE = '.popover-header';
|
|
4518
4597
|
const SELECTOR_CONTENT = '.popover-body';
|
|
4519
4598
|
/**
|
|
@@ -4545,55 +4624,19 @@ class Popover extends Tooltip {
|
|
|
4545
4624
|
return this.getTitle() || this._getContent();
|
|
4546
4625
|
}
|
|
4547
4626
|
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
return this.tip;
|
|
4551
|
-
}
|
|
4552
|
-
|
|
4553
|
-
this.tip = super.getTipElement();
|
|
4554
|
-
|
|
4555
|
-
if (!this.getTitle()) {
|
|
4556
|
-
SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
if (!this._getContent()) {
|
|
4560
|
-
SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
|
|
4561
|
-
}
|
|
4562
|
-
|
|
4563
|
-
return this.tip;
|
|
4564
|
-
}
|
|
4565
|
-
|
|
4566
|
-
setContent() {
|
|
4567
|
-
const tip = this.getTipElement(); // we use append for html objects to maintain js events
|
|
4568
|
-
|
|
4569
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
|
4570
|
-
|
|
4571
|
-
let content = this._getContent();
|
|
4627
|
+
setContent(tip) {
|
|
4628
|
+
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
|
4572
4629
|
|
|
4573
|
-
|
|
4574
|
-
content = content.call(this._element);
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
|
4578
|
-
tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
|
|
4630
|
+
this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
|
4579
4631
|
} // Private
|
|
4580
4632
|
|
|
4581
4633
|
|
|
4582
|
-
_addAttachmentClass(attachment) {
|
|
4583
|
-
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
|
4584
|
-
}
|
|
4585
|
-
|
|
4586
4634
|
_getContent() {
|
|
4587
|
-
return this.
|
|
4635
|
+
return this._resolvePossibleFunction(this._config.content);
|
|
4588
4636
|
}
|
|
4589
4637
|
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
|
4593
|
-
|
|
4594
|
-
if (tabClass !== null && tabClass.length > 0) {
|
|
4595
|
-
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
|
4596
|
-
}
|
|
4638
|
+
_getBasicClassPrefix() {
|
|
4639
|
+
return CLASS_PREFIX;
|
|
4597
4640
|
} // Static
|
|
4598
4641
|
|
|
4599
4642
|
|
|
@@ -4624,7 +4667,7 @@ defineJQueryPlugin(Popover);
|
|
|
4624
4667
|
|
|
4625
4668
|
/**
|
|
4626
4669
|
* --------------------------------------------------------------------------
|
|
4627
|
-
* CoreUI (v4.0
|
|
4670
|
+
* CoreUI (v4.1.0): scrollspy.js
|
|
4628
4671
|
* Licensed under MIT (https://coreui.io/license)
|
|
4629
4672
|
*
|
|
4630
4673
|
* This component is a modified version of the Bootstrap's scrollspy.js
|
|
@@ -4862,7 +4905,7 @@ defineJQueryPlugin(ScrollSpy);
|
|
|
4862
4905
|
|
|
4863
4906
|
/**
|
|
4864
4907
|
* --------------------------------------------------------------------------
|
|
4865
|
-
* CoreUI (v4.0
|
|
4908
|
+
* CoreUI (v4.1.0): sidebar.js
|
|
4866
4909
|
* Licensed under MIT (https://coreui.io/license)
|
|
4867
4910
|
* --------------------------------------------------------------------------
|
|
4868
4911
|
*/
|
|
@@ -5082,7 +5125,7 @@ class Sidebar extends BaseComponent {
|
|
|
5082
5125
|
|
|
5083
5126
|
_removeBackdrop() {
|
|
5084
5127
|
if (this._backdrop) {
|
|
5085
|
-
this._backdrop.
|
|
5128
|
+
this._backdrop.remove();
|
|
5086
5129
|
|
|
5087
5130
|
this._backdrop = null;
|
|
5088
5131
|
}
|
|
@@ -5095,7 +5138,7 @@ class Sidebar extends BaseComponent {
|
|
|
5095
5138
|
|
|
5096
5139
|
this._backdrop.classList.add(CLASS_NAME_FADE$2);
|
|
5097
5140
|
|
|
5098
|
-
document.body.
|
|
5141
|
+
document.body.append(this._backdrop);
|
|
5099
5142
|
reflow(this._backdrop);
|
|
5100
5143
|
|
|
5101
5144
|
this._backdrop.classList.add(CLASS_NAME_SHOW$2);
|
|
@@ -5195,7 +5238,7 @@ defineJQueryPlugin(Sidebar);
|
|
|
5195
5238
|
|
|
5196
5239
|
/**
|
|
5197
5240
|
* --------------------------------------------------------------------------
|
|
5198
|
-
* CoreUI (v4.0
|
|
5241
|
+
* CoreUI (v4.1.0): tab.js
|
|
5199
5242
|
* Licensed under MIT (https://coreui.io/license)
|
|
5200
5243
|
*
|
|
5201
5244
|
* This component is a modified version of the Bootstrap's tab.js
|
|
@@ -5396,7 +5439,7 @@ defineJQueryPlugin(Tab);
|
|
|
5396
5439
|
|
|
5397
5440
|
/**
|
|
5398
5441
|
* --------------------------------------------------------------------------
|
|
5399
|
-
* CoreUI (v4.0
|
|
5442
|
+
* CoreUI (v4.1.0): toast.js
|
|
5400
5443
|
* Licensed under MIT (https://coreui.io/license)
|
|
5401
5444
|
*
|
|
5402
5445
|
* This component is a modified version of the Bootstrap's toast.js
|
|
@@ -5412,7 +5455,6 @@ defineJQueryPlugin(Tab);
|
|
|
5412
5455
|
const NAME = 'toast';
|
|
5413
5456
|
const DATA_KEY = 'coreui.toast';
|
|
5414
5457
|
const EVENT_KEY = `.${DATA_KEY}`;
|
|
5415
|
-
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
|
5416
5458
|
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
|
|
5417
5459
|
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
|
|
5418
5460
|
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
|
@@ -5422,7 +5464,8 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
|
|
5422
5464
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
|
5423
5465
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
|
5424
5466
|
const CLASS_NAME_FADE = 'fade';
|
|
5425
|
-
const CLASS_NAME_HIDE = 'hide';
|
|
5467
|
+
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
|
5468
|
+
|
|
5426
5469
|
const CLASS_NAME_SHOW = 'show';
|
|
5427
5470
|
const CLASS_NAME_SHOWING = 'showing';
|
|
5428
5471
|
const DefaultType = {
|
|
@@ -5435,7 +5478,6 @@ const Default = {
|
|
|
5435
5478
|
autohide: true,
|
|
5436
5479
|
delay: 5000
|
|
5437
5480
|
};
|
|
5438
|
-
const SELECTOR_DATA_DISMISS = '[data-coreui-dismiss="toast"]';
|
|
5439
5481
|
/**
|
|
5440
5482
|
* ------------------------------------------------------------------------
|
|
5441
5483
|
* Class Definition
|
|
@@ -5483,17 +5525,18 @@ class Toast extends BaseComponent {
|
|
|
5483
5525
|
const complete = () => {
|
|
5484
5526
|
this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
5485
5527
|
|
|
5486
|
-
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5487
|
-
|
|
5488
5528
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
|
5489
5529
|
|
|
5490
5530
|
this._maybeScheduleHide();
|
|
5491
5531
|
};
|
|
5492
5532
|
|
|
5493
|
-
this._element.classList.remove(CLASS_NAME_HIDE);
|
|
5533
|
+
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
|
5534
|
+
|
|
5494
5535
|
|
|
5495
5536
|
reflow(this._element);
|
|
5496
5537
|
|
|
5538
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
|
5539
|
+
|
|
5497
5540
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5498
5541
|
|
|
5499
5542
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
@@ -5511,12 +5554,17 @@ class Toast extends BaseComponent {
|
|
|
5511
5554
|
}
|
|
5512
5555
|
|
|
5513
5556
|
const complete = () => {
|
|
5514
|
-
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);
|
|
5515
5563
|
|
|
5516
5564
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
|
5517
5565
|
};
|
|
5518
5566
|
|
|
5519
|
-
this._element.classList.
|
|
5567
|
+
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
5520
5568
|
|
|
5521
5569
|
this._queueCallback(complete, this._element, this._config.animation);
|
|
5522
5570
|
}
|
|
@@ -5584,7 +5632,6 @@ class Toast extends BaseComponent {
|
|
|
5584
5632
|
}
|
|
5585
5633
|
|
|
5586
5634
|
_setListeners() {
|
|
5587
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
|
5588
5635
|
EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
|
|
5589
5636
|
EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
|
|
5590
5637
|
EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
|
|
@@ -5612,6 +5659,8 @@ class Toast extends BaseComponent {
|
|
|
5612
5659
|
}
|
|
5613
5660
|
|
|
5614
5661
|
}
|
|
5662
|
+
|
|
5663
|
+
enableDismissTrigger(Toast);
|
|
5615
5664
|
/**
|
|
5616
5665
|
* ------------------------------------------------------------------------
|
|
5617
5666
|
* jQuery
|
|
@@ -5619,8 +5668,7 @@ class Toast extends BaseComponent {
|
|
|
5619
5668
|
* add .Toast to jQuery only if jQuery is present
|
|
5620
5669
|
*/
|
|
5621
5670
|
|
|
5622
|
-
|
|
5623
5671
|
defineJQueryPlugin(Toast);
|
|
5624
5672
|
|
|
5625
|
-
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 };
|
|
5626
5674
|
//# sourceMappingURL=coreui.esm.js.map
|