mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-25 11:04:09 +03:00
Release 3.0.0
This commit is contained in:
parent
96444ac375
commit
02e6fffdb3
|
@ -1,5 +1,5 @@
|
||||||
MDB5
|
MDB5
|
||||||
Version: FREE 2.2.1
|
Version: FREE 3.0.0
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
https://mdbootstrap.com/docs/standard/
|
https://mdbootstrap.com/docs/standard/
|
||||||
|
|
8
css/mdb.min.css
vendored
8
css/mdb.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
22
css/mdb.rtl.min.css
vendored
Normal file
22
css/mdb.rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
css/mdb.rtl.min.css.map
Normal file
1
css/mdb.rtl.min.css.map
Normal file
File diff suppressed because one or more lines are too long
178
index.html
178
index.html
|
@ -18,20 +18,11 @@
|
||||||
<link rel="stylesheet" href="css/mdb.min.css" />
|
<link rel="stylesheet" href="css/mdb.min.css" />
|
||||||
<!-- Custom styles -->
|
<!-- Custom styles -->
|
||||||
<style>
|
<style>
|
||||||
body {
|
body{
|
||||||
background-color: #2e2e2e;
|
background-color: #f6e0a2;
|
||||||
}
|
}
|
||||||
|
.icon-color {
|
||||||
.text-poppy-red {
|
background-color:#94536d !important;
|
||||||
color: #ef5350 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-poppy-red {
|
|
||||||
background-color: #ef5350 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-poppy-red {
|
|
||||||
background-color: #ef5350 !important;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -40,20 +31,155 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
|
<div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="text-white text-poppy-red">BLACK NOVEMBER SURPRISE!</h1>
|
<h1 class=" text-one" style="color: #6a8255 ;">CHRISTMAS SALE!</h1>
|
||||||
<i class="fas fa-shopping-basket text-white fa-10x"></i>
|
<!-- Image -->
|
||||||
<p class="mt-2 text-white">
|
<svg id="e1a9485c-0f43-4303-9e0d-5e4a75181bc4" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg"
|
||||||
Check what we have prepared and start using the richest UI Kit today.<br />Hurry up &
|
xmlns:xlink="http://www.w3.org/1999/xlink" width="558.07" height="404.61" viewBox="0 0 858.07 804.61">
|
||||||
don't loose your chance.
|
<defs>
|
||||||
</p>
|
<linearGradient id="fa2440bd-da04-40b7-bd3b-ddfb35b0a42b" x1="592.9" y1="385.11" x2="592.9" y2="236.35"
|
||||||
<p>
|
gradientUnits="userSpaceOnUse">
|
||||||
<a
|
<stop offset="0" stop-color="gray" stop-opacity="0.25" />
|
||||||
type="button"
|
<stop offset="0.54" stop-color="gray" stop-opacity="0.12" />
|
||||||
class="btn btn-danger btn-rounded btn-lg text-white bg-poppy-red"
|
<stop offset="1" stop-color="gray" stop-opacity="0.1" />
|
||||||
href="https://mdbootstrap.com/sale/"
|
</linearGradient>
|
||||||
><i class="fas fa-cart-arrow-down"></i> CLAIM OFFER</a
|
<linearGradient id="07fe1e9f-5680-428a-971a-ff84304916dd" x1="420.04" y1="804.61" x2="420.04" y2="320.21"
|
||||||
>
|
xlink:href="#fa2440bd-da04-40b7-bd3b-ddfb35b0a42b" />
|
||||||
|
<linearGradient id="00ef2338-96af-4b11-80f8-5a4c3164adbb" x1="811.83" y1="471.54" x2="811.83" y2="185.81"
|
||||||
|
xlink:href="#fa2440bd-da04-40b7-bd3b-ddfb35b0a42b" />
|
||||||
|
</defs>
|
||||||
|
<title>gift1</title>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<rect x="107.3" y="37.85" width="3.33" height="18.87" fill="#47e6b1" />
|
||||||
|
<rect x="276.52" y="77.53" width="3.33" height="18.87" transform="translate(195.93 -230.9) rotate(90)"
|
||||||
|
fill="#47e6b1" />
|
||||||
|
</g>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<rect x="811.66" y="769.53" width="3.33" height="18.87" fill="#47e6b1" />
|
||||||
|
<rect x="980.89" y="809.21" width="3.33" height="18.87" transform="translate(1631.97 -203.59) rotate(90)"
|
||||||
|
fill="#47e6b1" />
|
||||||
|
</g>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<rect x="812.98" y="215.34" width="3.33" height="18.87" fill="#47e6b1" />
|
||||||
|
<rect x="982.2" y="255.02" width="3.33" height="18.87" transform="translate(1079.1 -759.09) rotate(90)"
|
||||||
|
fill="#47e6b1" />
|
||||||
|
</g>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<rect x="846.98" y="45.34" width="3.33" height="18.87" fill="#47e6b1" />
|
||||||
|
<rect x="1016.2" y="85.02" width="3.33" height="18.87" transform="translate(943.1 -963.09) rotate(90)"
|
||||||
|
fill="#47e6b1" />
|
||||||
|
</g>
|
||||||
|
<g opacity="0.5">
|
||||||
|
<rect x="267.08" y="36.27" width="3.33" height="18.87" fill="#47e6b1" />
|
||||||
|
<rect x="436.31" y="75.96" width="3.33" height="18.87" transform="translate(354.13 -392.27) rotate(90)"
|
||||||
|
fill="#47e6b1" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
d="M230.44,357.88a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4,4.08,4.08,0,0,1-4.93,2.27,2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23,4.08,4.08,0,0,1,2.27,4.93,2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4,4.08,4.08,0,0,1,4.93-2.27,2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,230.44,357.88Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<path
|
||||||
|
d="M291.92,736.22a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4,4.08,4.08,0,0,1-4.93,2.27,2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23,4.08,4.08,0,0,1,2.27,4.93,2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4,4.08,4.08,0,0,1,4.93-2.27,2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,291.92,736.22Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<path
|
||||||
|
d="M850.92,235.22a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4,4.08,4.08,0,0,1-4.93,2.27,2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23,4.08,4.08,0,0,1,2.27,4.93,2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4,4.08,4.08,0,0,1,4.93-2.27,2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,850.92,235.22Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<path
|
||||||
|
d="M843.47,325.61a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4,4.08,4.08,0,0,1-4.93,2.27,2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23,4.08,4.08,0,0,1,2.27,4.93,2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4,4.08,4.08,0,0,1,4.93-2.27,2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,843.47,325.61Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<path
|
||||||
|
d="M844,47.24a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4A4.08,4.08,0,0,1,833,43.18a2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23,4.08,4.08,0,0,1,2.27,4.93,2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4A4.08,4.08,0,0,1,842.56,51a2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,844,47.24Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<path
|
||||||
|
d="M1012.16,504.28a4.08,4.08,0,0,1-2.27-4.93,2,2,0,0,0,.09-.45h0a2,2,0,0,0-3.67-1.36h0a2,2,0,0,0-.23.4,4.08,4.08,0,0,1-4.93,2.27,2,2,0,0,0-.45-.09h0a2,2,0,0,0-1.36,3.67h0a2,2,0,0,0,.4.23A4.08,4.08,0,0,1,1002,509a2,2,0,0,0-.09.45h0a2,2,0,0,0,3.67,1.36h0a2,2,0,0,0,.23-.4,4.08,4.08,0,0,1,4.93-2.27,2,2,0,0,0,.45.09h0a2,2,0,0,0,1.36-3.67h0A2,2,0,0,0,1012.16,504.28Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" opacity="0.5" />
|
||||||
|
<circle cx="61.77" cy="166.12" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<circle cx="12.94" cy="644.43" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<circle cx="439.66" cy="45.68" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<circle cx="506.66" cy="172.68" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<circle cx="6.66" cy="478.68" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<circle cx="267.5" cy="155.34" r="6.66" fill="#47e6b1" opacity="0.5" />
|
||||||
|
<circle cx="725.6" cy="597.75" r="6.66" fill="#f55f44" opacity="0.5" />
|
||||||
|
<g opacity="0.5">
|
||||||
|
<path
|
||||||
|
d="M713.77,253.75c-12.9-12.94-31.71-18.09-53-14.5-19.89,3.36-39.79,14.13-56,30.33a65.49,65.49,0,0,0-11.72,16.08A65.64,65.64,0,0,0,581.43,269h0c-16-16.47-35.67-27.58-55.5-31.29-21.19-4-40.08.86-53.2,13.58S454.18,282.74,457.48,304C460.56,324,471,344,487,360.49,520.58,395.13,587.59,381.6,590.43,381l.84-.17,2.58.59c2.83.64,69.59,15.32,103.75-18.73,16.25-16.19,27.08-36.06,30.51-55.94C731.76,285.52,726.67,266.69,713.77,253.75ZM579.08,361c-16.19,2.18-56.55,5.14-76.59-15.53-12.88-13.29-21.31-29.19-23.71-44.75-2.2-14.2,1-26.27,8.94-34a29.93,29.93,0,0,1,10.92-6.69c6.68-2.37,14.63-2.81,23.32-1.18,15.48,2.89,31.1,11.81,44,25.1C586,304.67,581.76,344.92,579.08,361Zm127.78-57.93c-2.67,15.52-11.37,31.26-24.48,44.33-20.4,20.33-60.7,16.67-76.84,14.21-2.41-16.16-5.94-56.47,14.45-76.8,13.11-13.07,28.88-21.71,44.41-24.34,8.72-1.47,16.66-.9,23.3,1.58a29.93,29.93,0,0,1,10.8,6.88C706.33,276.82,709.3,288.94,706.86,303.09Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="url(#fa2440bd-da04-40b7-bd3b-ddfb35b0a42b)" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
d="M596.91,376.65,590.53,378c-2.71.57-66.83,13.51-99-19.63-15.28-15.76-25.31-34.95-28.26-54-3.15-20.38,2-38.31,14.58-50.48s30.64-16.78,50.91-13c19,3.55,37.84,14.18,53.11,29.94h0c32.12,33.15,17.18,96.83,16.52,99.52ZM502.7,262.26a28.64,28.64,0,0,0-10.45,6.4c-7.62,7.38-10.66,18.93-8.56,32.52,2.3,14.89,10.36,30.1,22.69,42.82,19.17,19.78,57.79,17,73.28,14.86,2.57-15.41,6.61-53.93-12.56-73.71h0c-12.33-12.72-27.28-21.25-42.09-24C516.71,259.57,509.1,260,502.7,262.26Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#e85656" />
|
||||||
|
<path
|
||||||
|
d="M587.45,376.93,586,370.57c-.61-2.71-14.45-66.64,18.24-99.22h0c15.54-15.5,34.59-25.8,53.62-29,20.33-3.44,38.33,1.49,50.68,13.87s17.21,30.4,13.71,50.72c-3.28,19-13.65,38-29.19,53.53C660.39,393,596.51,379,593.8,378.38Zm96.17-112.75c-6.36-2.38-14-2.93-22.29-1.52-14.86,2.51-30,10.78-42.5,23.29h0c-19.51,19.45-16.14,58-13.83,73.49,15.45,2.35,54,5.86,73.53-13.6,12.55-12.51,20.87-27.57,23.43-42.42,2.34-13.55-.5-25.15-8-32.66A28.64,28.64,0,0,0,683.61,264.18Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#e85656" />
|
||||||
|
<g opacity="0.5">
|
||||||
|
<polygon
|
||||||
|
points="730.87 320.21 109.21 320.21 109.21 444.6 141.51 444.6 141.51 804.61 698.57 804.61 698.57 444.6 730.87 444.6 730.87 320.21"
|
||||||
|
fill="url(#07fe1e9f-5680-428a-971a-ff84304916dd)" />
|
||||||
|
</g>
|
||||||
|
<rect x="148.56" y="357.82" width="542.96" height="440.67" fill="#f5f5f5" />
|
||||||
|
<rect x="368.89" y="436.51" width="102.3" height="361.98" fill="#e85656" />
|
||||||
|
<rect x="148.56" y="334.21" width="542.96" height="110.17" opacity="0.1" />
|
||||||
|
<rect x="117.08" y="326.34" width="605.91" height="110.17" fill="#f5f5f5" />
|
||||||
|
<rect x="368.89" y="326.34" width="102.3" height="110.17" fill="#e85656" />
|
||||||
|
<path
|
||||||
|
d="M951.92,375.92C950,370.37,929,386,929,386l-4.84-.29-9.31-8.62,6.5-6.5-54.59-46.79a13.77,13.77,0,0,0-10.67-3.21l-45.37,5.67c-.19-2.6-1.8-5.69-4.06-8.84-4.65-7.63-14.45-16.26-18.08-19.33l-5.53-37.31,4.7-7.05a23.73,23.73,0,0,1-2.56-.86l1-1.49-.37-.1.47-.54-.06,0L798,237.16a5.14,5.14,0,0,0-.39-7.12l-26.21-19.88a14.45,14.45,0,0,0,1.12-6c.2-4-1.56-8-7.5-10.94a57.9,57.9,0,0,0-11.48-4.05,37.67,37.67,0,0,0-19.85.29l-.34-.4c-8.07-9.22-18.64,4-19.05,4.55l-41.34,46A8.4,8.4,0,0,0,675,250.81l21.88,16.41-.07.14,1.24.93c-.94,1.84-2.19,3.07-3.86,3.25l3.35,1.68a3.86,3.86,0,0,1-1.78.67l15.34,7.67c0,8,.82,44.47,13.79,62.39A33.13,33.13,0,0,0,729.6,350s1.1-.6,3.12-1.57l2.32,4.63a27.11,27.11,0,0,0,28.09,14.72l72-10.29-.76,2.29.41-.06-23.34,70,3.86,1.29-.07.14.54.23-4.85,9.17-15.28,11.75S840.3,474.69,845,471.16s-16.46-18.81-16.46-18.81l-1.18-4.7,5.14-10.85,4.31,1.44L871.42,369h0l1.18-2.35L896,395.94l6.6-6.6.71.72.06-.06,9.15,9.26,6.63,18.1S953.87,381.46,951.92,375.92ZM770.24,241.31l-.46-.53a43.89,43.89,0,0,1-13.23,10.58v-3.85l.26-.23v-1.67A25.4,25.4,0,0,0,764,219.82l15.19,11.69Zm-51.61-43.4-.37-.37.37.36Zm-12.15,24.48q-.15,1.82-.12,3.68a38.28,38.28,0,0,0,.3,5.37c.78,6.22,3,11.3,7.6,13.72,4,2.1,6.63,2,8.31.55l.18.16a18,18,0,0,0,1.86,7,74,74,0,0,1-24.17-9.73s0,.31.06.87l-6.29-6.29Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="url(#00ef2338-96af-4b11-80f8-5a4c3164adbb)" />
|
||||||
|
<polygon points="651.99 378.3 641.71 397.71 657.69 404.56 667.97 382.87 651.99 378.3" fill="#fda57d" />
|
||||||
|
<path d="M826.92,444.24l1.14,4.57s20.55,14.84,16,18.27-48-18.27-48-18.27l14.84-11.42Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#333" />
|
||||||
|
<polygon points="666.87 384.88 650.71 379.49 645.9 388.57 661.88 395.43 666.87 384.88" opacity="0.1" />
|
||||||
|
<polygon points="725 341.94 740.43 357.56 751.76 344.37 734.15 328.06 725 341.94" fill="#fda57d" />
|
||||||
|
<polygon points="734.78 328.82 725.63 342.7 731.48 348.63 743.35 336.76 734.78 328.82" opacity="0.1" />
|
||||||
|
<path d="M921,384.05l4.7.28s20.32-15.15,22.22-9.77-31.8,40.27-31.8,40.27l-6.44-17.58Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#333" />
|
||||||
|
<path d="M774.66,267.22l23.72-27.44a5,5,0,0,0-.38-6.91l-51.61-39.14-6.28,9.78,40,30.79-17,18.62Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#fda57d" />
|
||||||
|
<path d="M771.94,243.31l-8.3,9.1,11.53,14.31L787.06,253A34.67,34.67,0,0,1,771.94,243.31Z"
|
||||||
|
transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<path d="M705.78,273.18,678.93,253a8.16,8.16,0,0,1-2-10.87l40.18-44.71,8.22,8.22-27.75,34.64L714,256.75Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#fda57d" />
|
||||||
|
<path d="M700.12,269.13l4.39,3.3L712.73,256l-10.32-10.32C702.63,249.18,703.25,262.76,700.12,269.13Z"
|
||||||
|
transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<polygon points="666.87 313.25 642.22 387.19 666.87 395.41 707.95 313.25 675.09 305.04 666.87 313.25"
|
||||||
|
fill="#4d8af0" />
|
||||||
|
<polygon
|
||||||
|
points="665.73 315.53 664.5 319.23 690.38 315.53 700.49 328.17 706.81 315.53 673.94 307.32 665.73 315.53"
|
||||||
|
opacity="0.1" />
|
||||||
|
<path d="M717.07,197.51s10.53-13.57,18.52-4.44S723,203.34,723,203.34Z" transform="translate(-169.23 -39.68)"
|
||||||
|
fill="#fda57d" />
|
||||||
|
<path
|
||||||
|
d="M729.29,336.5l7.94,15.89a26.34,26.34,0,0,0,27.28,14.29l96.23-13.75L893.61,394l24.65-24.65-53-45.45a13.37,13.37,0,0,0-10.36-3.12Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#4d8af0" />
|
||||||
|
<path
|
||||||
|
d="M705.14,247.87s2.16,26.68-6.05,27.6l16.43,8.22s-.91,48.38,16.43,65.73c0,0,32-17.34,65.73-16.43s-8.22-32.86-8.22-32.86l-5.55-37.4,4.57-6.85a34.33,34.33,0,0,1-16-10.28h0c-4.57,5.71-15,13.45-24.12,13.45h-3.93c-13.53,0-27.92-2.73-39.32-10Z"
|
||||||
|
transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<path
|
||||||
|
d="M703.62,245.59s2.16,26.68-6.05,27.6L714,281.4s-.91,48.38,16.43,65.73c0,0,32-17.34,65.73-16.43s-8.22-32.86-8.22-32.86l-5.55-37.4,4.57-6.85a34.33,34.33,0,0,1-16-10.28h0c-4.57,5.71-15,13.45-24.12,13.45h-3.93a74.73,74.73,0,0,1-39.32-11.17Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#3ad29f" />
|
||||||
|
<path d="M725.26,238.07v9.17a17.53,17.53,0,0,0,5.13,12.39l19.51,19.51,6.5-13a16.29,16.29,0,0,0,1.72-7.29v-20.8Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#fda57d" />
|
||||||
|
<path d="M725.51,248.63c0,.34,0,.67,0,1a24.64,24.64,0,0,0,32.83,0V239.46H725.51Z"
|
||||||
|
transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<circle cx="572.46" cy="190.17" r="24.65" fill="#fda57d" />
|
||||||
|
<path
|
||||||
|
d="M725.26,222.9h41.08s16.43-16.43,0-24.65a56.24,56.24,0,0,0-11.15-3.94c-25-6.34-48.74,14.33-45.53,39.91.76,6,2.93,11,7.38,13.32C734.39,256.68,725.26,222.9,725.26,222.9Z"
|
||||||
|
transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<path
|
||||||
|
d="M725.26,221.76h41.08s16.43-16.43,0-24.65a56.24,56.24,0,0,0-11.15-3.94c-25-6.34-48.74,14.33-45.53,39.91.76,6,2.93,11,7.38,13.32C734.39,255.54,725.26,221.76,725.26,221.76Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#333" />
|
||||||
|
<ellipse cx="557.23" cy="190.49" rx="2.28" ry="4" fill="#fda57d" />
|
||||||
|
<polygon points="544.67 241.3 545.81 237.87 549.23 240.16 544.67 241.3" opacity="0.1" />
|
||||||
|
<path d="M788,297.85s-12.43,6-15.86,11.67" transform="translate(-169.23 -39.68)" opacity="0.1" />
|
||||||
|
<polygon points="613.17 220.75 612.03 224.17 609.74 220.75 613.17 220.75" opacity="0.1" />
|
||||||
|
<path
|
||||||
|
d="M725.26,221.76h41.08s16.43-16.43,0-24.65a56.24,56.24,0,0,0-11.15-3.94c-25-6.34-48.74,14.33-45.53,39.91.76,6,2.93,11,7.38,13.32C734.39,255.54,725.26,221.76,725.26,221.76Z"
|
||||||
|
transform="translate(-169.23 -39.68)" fill="#333" />
|
||||||
|
</svg>
|
||||||
|
<!-- Image -->
|
||||||
|
<p class="mt-4 text-two">
|
||||||
|
Get Templates & Plugins as a gift!<br />Hurry up & don't
|
||||||
|
lose your chance.
|
||||||
</p>
|
</p>
|
||||||
|
<a type="button" class="btn btn-danger text-white btn-rounded btn-lg" href="https://mdbootstrap.com/sale/"><i
|
||||||
|
class="fas fa-gifts"></i> GET Your gift</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
29
js/mdb.min.js
vendored
29
js/mdb.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mdb-ui-kit",
|
"name": "mdb-ui-kit",
|
||||||
"version": "2.2.1",
|
"version": "3.0.0",
|
||||||
"main": "js/mdb.min.js",
|
"main": "js/mdb.min.js",
|
||||||
"repository": "https://github.com/mdbootstrap/mdb-ui-kit.git",
|
"repository": "https://github.com/mdbootstrap/mdb-ui-kit.git",
|
||||||
"author": "MDBootstrap",
|
"author": "MDBootstrap",
|
||||||
|
|
151
src/js/bootstrap/dist/alert.js
vendored
151
src/js/bootstrap/dist/alert.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap alert.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap alert.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')))
|
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./dom/data.js', './dom/event-handler.js'], factory)
|
? define(['./dom/data', './dom/event-handler'], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Alert = factory(global.Data, global.EventHandler)));
|
(global.Alert = factory(global.Data, global.EventHandler)));
|
||||||
})(this, function (Data, EventHandler) {
|
})(this, function (Data, EventHandler) {
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -54,8 +54,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,7 +63,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -92,13 +95,23 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -120,12 +133,74 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'alert';
|
var NAME = 'alert';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.alert';
|
var DATA_KEY = 'bs.alert';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
|
var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
||||||
var EVENT_CLOSE = 'close' + EVENT_KEY;
|
var EVENT_CLOSE = 'close' + EVENT_KEY;
|
||||||
var EVENT_CLOSED = 'closed' + EVENT_KEY;
|
var EVENT_CLOSED = 'closed' + EVENT_KEY;
|
||||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||||
|
@ -138,14 +213,12 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Alert = /*#__PURE__*/ (function () {
|
var Alert = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
function Alert(element) {
|
_inheritsLoose(Alert, _BaseComponent);
|
||||||
this._element = element;
|
|
||||||
|
|
||||||
if (this._element) {
|
function Alert() {
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
return _BaseComponent.apply(this, arguments) || this;
|
||||||
}
|
}
|
||||||
} // Getters
|
|
||||||
|
|
||||||
var _proto = Alert.prototype;
|
var _proto = Alert.prototype;
|
||||||
|
|
||||||
|
@ -160,11 +233,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this._removeElement(rootElement);
|
this._removeElement(rootElement);
|
||||||
};
|
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
_proto._getRootElement = function _getRootElement(element) {
|
_proto._getRootElement = function _getRootElement(element) {
|
||||||
|
@ -225,21 +293,18 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Alert.getInstance = function getInstance(element) {
|
_createClass$1(Alert, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Alert, null, [
|
|
||||||
{
|
{
|
||||||
key: 'VERSION',
|
key: 'DATA_KEY',
|
||||||
|
// Getters
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Alert;
|
return Alert;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -252,26 +317,28 @@
|
||||||
SELECTOR_DISMISS,
|
SELECTOR_DISMISS,
|
||||||
Alert.handleDismiss(new Alert())
|
Alert.handleDismiss(new Alert())
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .alert to jQuery only if jQuery is present
|
* add .Alert to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Alert.jQueryInterface;
|
$.fn[NAME] = Alert.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Alert;
|
$.fn[NAME].Constructor = Alert;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Alert.jQueryInterface;
|
return Alert.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Alert;
|
return Alert;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/alert.js.map
vendored
2
src/js/bootstrap/dist/alert.js.map
vendored
File diff suppressed because one or more lines are too long
139
src/js/bootstrap/dist/button.js
vendored
139
src/js/bootstrap/dist/button.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap button.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap button.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')))
|
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./dom/data.js', './dom/event-handler.js'], factory)
|
? define(['./dom/data', './dom/event-handler'], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Button = factory(global.Data, global.EventHandler)));
|
(global.Button = factory(global.Data, global.EventHandler)));
|
||||||
})(this, function (Data, EventHandler) {
|
})(this, function (Data, EventHandler) {
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -31,13 +31,23 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -59,13 +69,75 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'button';
|
var NAME = 'button';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.button';
|
var DATA_KEY = 'bs.button';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var CLASS_NAME_ACTIVE = 'active';
|
var CLASS_NAME_ACTIVE = 'active';
|
||||||
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
|
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
|
||||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -73,11 +145,12 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Button = /*#__PURE__*/ (function () {
|
var Button = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
function Button(element) {
|
_inheritsLoose(Button, _BaseComponent);
|
||||||
this._element = element;
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
function Button() {
|
||||||
} // Getters
|
return _BaseComponent.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
|
||||||
var _proto = Button.prototype;
|
var _proto = Button.prototype;
|
||||||
|
|
||||||
|
@ -85,11 +158,6 @@
|
||||||
_proto.toggle = function toggle() {
|
_proto.toggle = function toggle() {
|
||||||
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
|
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
|
||||||
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
||||||
};
|
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}; // Static
|
}; // Static
|
||||||
|
|
||||||
Button.jQueryInterface = function jQueryInterface(config) {
|
Button.jQueryInterface = function jQueryInterface(config) {
|
||||||
|
@ -106,21 +174,18 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Button.getInstance = function getInstance(element) {
|
_createClass$1(Button, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Button, null, [
|
|
||||||
{
|
{
|
||||||
key: 'VERSION',
|
key: 'DATA_KEY',
|
||||||
|
// Getters
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Button;
|
return Button;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -143,26 +208,28 @@
|
||||||
data.toggle();
|
data.toggle();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .button to jQuery only if jQuery is present
|
* add .Button to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Button.jQueryInterface;
|
$.fn[NAME] = Button.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Button;
|
$.fn[NAME].Constructor = Button;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Button.jQueryInterface;
|
return Button.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Button;
|
return Button;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/button.js.map
vendored
2
src/js/bootstrap/dist/button.js.map
vendored
File diff suppressed because one or more lines are too long
317
src/js/bootstrap/dist/carousel.js
vendored
317
src/js/bootstrap/dist/carousel.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap carousel.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap carousel.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -13,10 +13,10 @@
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'./dom/data',
|
||||||
'./dom/event-handler.js',
|
'./dom/event-handler',
|
||||||
'./dom/manipulator.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Carousel = factory(
|
(global.Carousel = factory(
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -82,8 +82,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -91,7 +91,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -163,29 +166,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -208,8 +204,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'carousel';
|
var NAME = 'carousel';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.carousel';
|
var DATA_KEY = 'bs.carousel';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -254,8 +329,8 @@
|
||||||
var CLASS_NAME_CAROUSEL = 'carousel';
|
var CLASS_NAME_CAROUSEL = 'carousel';
|
||||||
var CLASS_NAME_ACTIVE = 'active';
|
var CLASS_NAME_ACTIVE = 'active';
|
||||||
var CLASS_NAME_SLIDE = 'slide';
|
var CLASS_NAME_SLIDE = 'slide';
|
||||||
var CLASS_NAME_RIGHT = 'carousel-item-right';
|
var CLASS_NAME_END = 'carousel-item-end';
|
||||||
var CLASS_NAME_LEFT = 'carousel-item-left';
|
var CLASS_NAME_START = 'carousel-item-start';
|
||||||
var CLASS_NAME_NEXT = 'carousel-item-next';
|
var CLASS_NAME_NEXT = 'carousel-item-next';
|
||||||
var CLASS_NAME_PREV = 'carousel-item-prev';
|
var CLASS_NAME_PREV = 'carousel-item-prev';
|
||||||
var CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
var CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
||||||
|
@ -265,8 +340,8 @@
|
||||||
var SELECTOR_ITEM_IMG = '.carousel-item img';
|
var SELECTOR_ITEM_IMG = '.carousel-item img';
|
||||||
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
||||||
var SELECTOR_INDICATORS = '.carousel-indicators';
|
var SELECTOR_INDICATORS = '.carousel-indicators';
|
||||||
var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
|
var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
|
||||||
var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
|
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
|
||||||
var PointerType = {
|
var PointerType = {
|
||||||
TOUCH: 'touch',
|
TOUCH: 'touch',
|
||||||
PEN: 'pen',
|
PEN: 'pen',
|
||||||
|
@ -277,29 +352,33 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Carousel = /*#__PURE__*/ (function () {
|
var Carousel = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Carousel, _BaseComponent);
|
||||||
|
|
||||||
function Carousel(element, config) {
|
function Carousel(element, config) {
|
||||||
this._items = null;
|
var _this;
|
||||||
this._interval = null;
|
|
||||||
this._activeElement = null;
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
this._isPaused = false;
|
_this._items = null;
|
||||||
this._isSliding = false;
|
_this._interval = null;
|
||||||
this.touchTimeout = null;
|
_this._activeElement = null;
|
||||||
this.touchStartX = 0;
|
_this._isPaused = false;
|
||||||
this.touchDeltaX = 0;
|
_this._isSliding = false;
|
||||||
this._config = this._getConfig(config);
|
_this.touchTimeout = null;
|
||||||
this._element = element;
|
_this.touchStartX = 0;
|
||||||
this._indicatorsElement = SelectorEngine__default['default'].findOne(
|
_this.touchDeltaX = 0;
|
||||||
|
_this._config = _this._getConfig(config);
|
||||||
|
_this._indicatorsElement = SelectorEngine__default['default'].findOne(
|
||||||
SELECTOR_INDICATORS,
|
SELECTOR_INDICATORS,
|
||||||
this._element
|
_this._element
|
||||||
);
|
);
|
||||||
this._touchSupported =
|
_this._touchSupported =
|
||||||
'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
||||||
this._pointerEvent = Boolean(window.PointerEvent);
|
_this._pointerEvent = Boolean(window.PointerEvent);
|
||||||
|
|
||||||
this._addEventListeners();
|
_this._addEventListeners();
|
||||||
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Carousel.prototype;
|
var _proto = Carousel.prototype;
|
||||||
|
@ -350,6 +429,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config && this._config.interval && !this._isPaused) {
|
if (this._config && this._config.interval && !this._isPaused) {
|
||||||
|
this._updateInterval();
|
||||||
|
|
||||||
this._interval = setInterval(
|
this._interval = setInterval(
|
||||||
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
|
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
|
||||||
this._config.interval
|
this._config.interval
|
||||||
|
@ -358,7 +439,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.to = function to(index) {
|
_proto.to = function to(index) {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
this._activeElement = SelectorEngine__default['default'].findOne(
|
this._activeElement = SelectorEngine__default['default'].findOne(
|
||||||
SELECTOR_ACTIVE_ITEM,
|
SELECTOR_ACTIVE_ITEM,
|
||||||
|
@ -373,7 +454,7 @@
|
||||||
|
|
||||||
if (this._isSliding) {
|
if (this._isSliding) {
|
||||||
EventHandler__default['default'].one(this._element, EVENT_SLID, function () {
|
EventHandler__default['default'].one(this._element, EVENT_SLID, function () {
|
||||||
return _this.to(index);
|
return _this2.to(index);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -390,11 +471,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
|
|
||||||
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._items = null;
|
this._items = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
|
||||||
this._interval = null;
|
this._interval = null;
|
||||||
this._isPaused = null;
|
this._isPaused = null;
|
||||||
this._isSliding = null;
|
this._isSliding = null;
|
||||||
|
@ -428,20 +509,20 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._addEventListeners = function _addEventListeners() {
|
_proto._addEventListeners = function _addEventListeners() {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) {
|
||||||
return _this2._keydown(event);
|
return _this3._keydown(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause === 'hover') {
|
if (this._config.pause === 'hover') {
|
||||||
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, function (event) {
|
||||||
return _this2.pause(event);
|
return _this3.pause(event);
|
||||||
});
|
});
|
||||||
EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, function (event) {
|
||||||
return _this2.cycle(event);
|
return _this3.cycle(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,33 +532,33 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._addTouchEventListeners = function _addTouchEventListeners() {
|
_proto._addTouchEventListeners = function _addTouchEventListeners() {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var start = function start(event) {
|
var start = function start(event) {
|
||||||
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
_this3.touchStartX = event.clientX;
|
_this4.touchStartX = event.clientX;
|
||||||
} else if (!_this3._pointerEvent) {
|
} else if (!_this4._pointerEvent) {
|
||||||
_this3.touchStartX = event.touches[0].clientX;
|
_this4.touchStartX = event.touches[0].clientX;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var move = function move(event) {
|
var move = function move(event) {
|
||||||
// ensure swiping with one touch and not pinching
|
// ensure swiping with one touch and not pinching
|
||||||
if (event.touches && event.touches.length > 1) {
|
if (event.touches && event.touches.length > 1) {
|
||||||
_this3.touchDeltaX = 0;
|
_this4.touchDeltaX = 0;
|
||||||
} else {
|
} else {
|
||||||
_this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
|
_this4.touchDeltaX = event.touches[0].clientX - _this4.touchStartX;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var end = function end(event) {
|
var end = function end(event) {
|
||||||
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
_this3.touchDeltaX = event.clientX - _this3.touchStartX;
|
_this4.touchDeltaX = event.clientX - _this4.touchStartX;
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3._handleSwipe();
|
_this4._handleSwipe();
|
||||||
|
|
||||||
if (_this3._config.pause === 'hover') {
|
if (_this4._config.pause === 'hover') {
|
||||||
// If it's a touch-enabled device, mouseenter/leave are fired as
|
// If it's a touch-enabled device, mouseenter/leave are fired as
|
||||||
// part of the mouse compatibility events on first tap - the carousel
|
// part of the mouse compatibility events on first tap - the carousel
|
||||||
// would stop cycling until user tapped out of it;
|
// would stop cycling until user tapped out of it;
|
||||||
|
@ -485,15 +566,15 @@
|
||||||
// (as if it's the second time we tap on it, mouseenter compat event
|
// (as if it's the second time we tap on it, mouseenter compat event
|
||||||
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
||||||
// events to fire) we explicitly restart cycling
|
// events to fire) we explicitly restart cycling
|
||||||
_this3.pause();
|
_this4.pause();
|
||||||
|
|
||||||
if (_this3.touchTimeout) {
|
if (_this4.touchTimeout) {
|
||||||
clearTimeout(_this3.touchTimeout);
|
clearTimeout(_this4.touchTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3.touchTimeout = setTimeout(function (event) {
|
_this4.touchTimeout = setTimeout(function (event) {
|
||||||
return _this3.cycle(event);
|
return _this4.cycle(event);
|
||||||
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
|
}, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -607,8 +688,27 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_proto._updateInterval = function _updateInterval() {
|
||||||
|
var element =
|
||||||
|
this._activeElement ||
|
||||||
|
SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
|
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
|
||||||
|
|
||||||
|
if (elementInterval) {
|
||||||
|
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
||||||
|
this._config.interval = elementInterval;
|
||||||
|
} else {
|
||||||
|
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
_proto._slide = function _slide(direction, element) {
|
_proto._slide = function _slide(direction, element) {
|
||||||
var _this4 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
var activeElement = SelectorEngine__default['default'].findOne(
|
var activeElement = SelectorEngine__default['default'].findOne(
|
||||||
SELECTOR_ACTIVE_ITEM,
|
SELECTOR_ACTIVE_ITEM,
|
||||||
|
@ -628,11 +728,11 @@
|
||||||
var eventDirectionName;
|
var eventDirectionName;
|
||||||
|
|
||||||
if (direction === DIRECTION_NEXT) {
|
if (direction === DIRECTION_NEXT) {
|
||||||
directionalClassName = CLASS_NAME_LEFT;
|
directionalClassName = CLASS_NAME_START;
|
||||||
orderClassName = CLASS_NAME_NEXT;
|
orderClassName = CLASS_NAME_NEXT;
|
||||||
eventDirectionName = DIRECTION_LEFT;
|
eventDirectionName = DIRECTION_LEFT;
|
||||||
} else {
|
} else {
|
||||||
directionalClassName = CLASS_NAME_RIGHT;
|
directionalClassName = CLASS_NAME_END;
|
||||||
orderClassName = CLASS_NAME_PREV;
|
orderClassName = CLASS_NAME_PREV;
|
||||||
eventDirectionName = DIRECTION_RIGHT;
|
eventDirectionName = DIRECTION_RIGHT;
|
||||||
}
|
}
|
||||||
|
@ -661,28 +761,21 @@
|
||||||
|
|
||||||
this._setActiveIndicatorElement(nextElement);
|
this._setActiveIndicatorElement(nextElement);
|
||||||
|
|
||||||
|
this._activeElement = nextElement;
|
||||||
|
|
||||||
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
||||||
nextElement.classList.add(orderClassName);
|
nextElement.classList.add(orderClassName);
|
||||||
reflow(nextElement);
|
reflow(nextElement);
|
||||||
activeElement.classList.add(directionalClassName);
|
activeElement.classList.add(directionalClassName);
|
||||||
nextElement.classList.add(directionalClassName);
|
nextElement.classList.add(directionalClassName);
|
||||||
var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
|
||||||
|
|
||||||
if (nextElementInterval) {
|
|
||||||
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
|
||||||
this._config.interval = nextElementInterval;
|
|
||||||
} else {
|
|
||||||
this._config.interval = this._config.defaultInterval || this._config.interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
var transitionDuration = getTransitionDurationFromElement(activeElement);
|
var transitionDuration = getTransitionDurationFromElement(activeElement);
|
||||||
EventHandler__default['default'].one(activeElement, TRANSITION_END, function () {
|
EventHandler__default['default'].one(activeElement, TRANSITION_END, function () {
|
||||||
nextElement.classList.remove(directionalClassName, orderClassName);
|
nextElement.classList.remove(directionalClassName, orderClassName);
|
||||||
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
||||||
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
||||||
_this4._isSliding = false;
|
_this5._isSliding = false;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
EventHandler__default['default'].trigger(_this4._element, EVENT_SLID, {
|
EventHandler__default['default'].trigger(_this5._element, EVENT_SLID, {
|
||||||
relatedTarget: nextElement,
|
relatedTarget: nextElement,
|
||||||
direction: eventDirectionName,
|
direction: eventDirectionName,
|
||||||
from: activeElementIndex,
|
from: activeElementIndex,
|
||||||
|
@ -760,7 +853,7 @@
|
||||||
Manipulator__default['default'].getDataAttributes(this)
|
Manipulator__default['default'].getDataAttributes(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
var slideIndex = this.getAttribute('data-slide-to');
|
var slideIndex = this.getAttribute('data-bs-slide-to');
|
||||||
|
|
||||||
if (slideIndex) {
|
if (slideIndex) {
|
||||||
config.interval = false;
|
config.interval = false;
|
||||||
|
@ -775,27 +868,23 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
Carousel.getInstance = function getInstance(element) {
|
_createClass$1(Carousel, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Carousel, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Carousel;
|
return Carousel;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -818,26 +907,28 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .carousel to jQuery only if jQuery is present
|
* add .Carousel to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Carousel.jQueryInterface;
|
$.fn[NAME] = Carousel.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Carousel;
|
$.fn[NAME].Constructor = Carousel;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Carousel.jQueryInterface;
|
return Carousel.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Carousel;
|
return Carousel;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/carousel.js.map
vendored
2
src/js/bootstrap/dist/carousel.js.map
vendored
File diff suppressed because one or more lines are too long
253
src/js/bootstrap/dist/collapse.js
vendored
253
src/js/bootstrap/dist/collapse.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap collapse.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap collapse.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -13,10 +13,10 @@
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'./dom/data',
|
||||||
'./dom/event-handler.js',
|
'./dom/event-handler',
|
||||||
'./dom/manipulator.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Collapse = factory(
|
(global.Collapse = factory(
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -92,8 +92,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -101,7 +101,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -155,29 +158,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -200,8 +196,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'collapse';
|
var NAME = 'collapse';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.collapse';
|
var DATA_KEY = 'bs.collapse';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -225,24 +300,28 @@
|
||||||
var WIDTH = 'width';
|
var WIDTH = 'width';
|
||||||
var HEIGHT = 'height';
|
var HEIGHT = 'height';
|
||||||
var SELECTOR_ACTIVES = '.show, .collapsing';
|
var SELECTOR_ACTIVES = '.show, .collapsing';
|
||||||
var SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
|
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Class Definition
|
* Class Definition
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Collapse = /*#__PURE__*/ (function () {
|
var Collapse = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Collapse, _BaseComponent);
|
||||||
|
|
||||||
function Collapse(element, config) {
|
function Collapse(element, config) {
|
||||||
this._isTransitioning = false;
|
var _this;
|
||||||
this._element = element;
|
|
||||||
this._config = this._getConfig(config);
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
this._triggerArray = SelectorEngine__default['default'].find(
|
_this._isTransitioning = false;
|
||||||
|
_this._config = _this._getConfig(config);
|
||||||
|
_this._triggerArray = SelectorEngine__default['default'].find(
|
||||||
SELECTOR_DATA_TOGGLE +
|
SELECTOR_DATA_TOGGLE +
|
||||||
'[href="#' +
|
'[href="#' +
|
||||||
element.id +
|
element.id +
|
||||||
'"],' +
|
'"],' +
|
||||||
(SELECTOR_DATA_TOGGLE + '[data-target="#' + element.id + '"]')
|
(SELECTOR_DATA_TOGGLE + '[data-bs-target="#' + element.id + '"]')
|
||||||
);
|
);
|
||||||
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
||||||
|
|
||||||
|
@ -256,23 +335,23 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (selector !== null && filterElement.length) {
|
if (selector !== null && filterElement.length) {
|
||||||
this._selector = selector;
|
_this._selector = selector;
|
||||||
|
|
||||||
this._triggerArray.push(elem);
|
_this._triggerArray.push(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._parent = this._config.parent ? this._getParent() : null;
|
_this._parent = _this._config.parent ? _this._getParent() : null;
|
||||||
|
|
||||||
if (!this._config.parent) {
|
if (!_this._config.parent) {
|
||||||
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
_this._addAriaAndCollapsedClass(_this._element, _this._triggerArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.toggle) {
|
if (_this._config.toggle) {
|
||||||
this.toggle();
|
_this.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Collapse.prototype;
|
var _proto = Collapse.prototype;
|
||||||
|
@ -287,7 +366,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
return;
|
return;
|
||||||
|
@ -300,8 +379,8 @@
|
||||||
actives = SelectorEngine__default['default']
|
actives = SelectorEngine__default['default']
|
||||||
.find(SELECTOR_ACTIVES, this._parent)
|
.find(SELECTOR_ACTIVES, this._parent)
|
||||||
.filter(function (elem) {
|
.filter(function (elem) {
|
||||||
if (typeof _this._config.parent === 'string') {
|
if (typeof _this2._config.parent === 'string') {
|
||||||
return elem.getAttribute('data-parent') === _this._config.parent;
|
return elem.getAttribute('data-bs-parent') === _this2._config.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
||||||
|
@ -315,11 +394,11 @@
|
||||||
var container = SelectorEngine__default['default'].findOne(this._selector);
|
var container = SelectorEngine__default['default'].findOne(this._selector);
|
||||||
|
|
||||||
if (actives) {
|
if (actives) {
|
||||||
var tempActiveData = actives.filter(function (elem) {
|
var tempActiveData = actives.find(function (elem) {
|
||||||
return container !== elem;
|
return container !== elem;
|
||||||
});
|
});
|
||||||
activesData = tempActiveData[0]
|
activesData = tempActiveData
|
||||||
? Data__default['default'].getData(tempActiveData[0], DATA_KEY)
|
? Data__default['default'].getData(tempActiveData, DATA_KEY)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (activesData && activesData._isTransitioning) {
|
if (activesData && activesData._isTransitioning) {
|
||||||
|
@ -363,15 +442,15 @@
|
||||||
this.setTransitioning(true);
|
this.setTransitioning(true);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
_this2._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||||
|
|
||||||
_this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
_this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||||
|
|
||||||
_this._element.style[dimension] = '';
|
_this2._element.style[dimension] = '';
|
||||||
|
|
||||||
_this.setTransitioning(false);
|
_this2.setTransitioning(false);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN);
|
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
|
||||||
};
|
};
|
||||||
|
|
||||||
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||||||
|
@ -383,7 +462,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide() {
|
_proto.hide = function hide() {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
return;
|
return;
|
||||||
|
@ -421,13 +500,13 @@
|
||||||
this.setTransitioning(true);
|
this.setTransitioning(true);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this2.setTransitioning(false);
|
_this3.setTransitioning(false);
|
||||||
|
|
||||||
_this2._element.classList.remove(CLASS_NAME_COLLAPSING);
|
_this3._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||||
|
|
||||||
_this2._element.classList.add(CLASS_NAME_COLLAPSE);
|
_this3._element.classList.add(CLASS_NAME_COLLAPSE);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this2._element, EVENT_HIDDEN);
|
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._element.style[dimension] = '';
|
this._element.style[dimension] = '';
|
||||||
|
@ -441,10 +520,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
|
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
this._element = null;
|
|
||||||
this._triggerArray = null;
|
this._triggerArray = null;
|
||||||
this._isTransitioning = null;
|
this._isTransitioning = null;
|
||||||
}; // Private
|
}; // Private
|
||||||
|
@ -462,7 +541,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getParent = function _getParent() {
|
_proto._getParent = function _getParent() {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var parent = this._config.parent;
|
var parent = this._config.parent;
|
||||||
|
|
||||||
|
@ -475,11 +554,11 @@
|
||||||
parent = SelectorEngine__default['default'].findOne(parent);
|
parent = SelectorEngine__default['default'].findOne(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
var selector = SELECTOR_DATA_TOGGLE + '[data-parent="' + parent + '"]';
|
var selector = SELECTOR_DATA_TOGGLE + '[data-bs-parent="' + parent + '"]';
|
||||||
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
|
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
|
||||||
var selected = getElementFromSelector(element);
|
var selected = getElementFromSelector(element);
|
||||||
|
|
||||||
_this3._addAriaAndCollapsedClass(selected, [element]);
|
_this4._addAriaAndCollapsedClass(selected, [element]);
|
||||||
});
|
});
|
||||||
return parent;
|
return parent;
|
||||||
};
|
};
|
||||||
|
@ -534,27 +613,23 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Collapse.getInstance = function getInstance(element) {
|
_createClass$1(Collapse, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Collapse, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Collapse;
|
return Collapse;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -594,26 +669,28 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .collapse to jQuery only if jQuery is present
|
* add .Collapse to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Collapse.jQueryInterface;
|
$.fn[NAME] = Collapse.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Collapse;
|
$.fn[NAME].Constructor = Collapse;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Collapse.jQueryInterface;
|
return Collapse.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Collapse;
|
return Collapse;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/collapse.js.map
vendored
2
src/js/bootstrap/dist/collapse.js.map
vendored
File diff suppressed because one or more lines are too long
4
src/js/bootstrap/dist/dom/data.js
vendored
4
src/js/bootstrap/dist/dom/data.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap data.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap data.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/data.js
|
* Bootstrap (v5.0.0-beta1): dom/data.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
2
src/js/bootstrap/dist/dom/data.js.map
vendored
2
src/js/bootstrap/dist/dom/data.js.map
vendored
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha2): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst mapData = (() => {\n const storeData = {}\n let id = 1\n return {\n set(element, key, data) {\n if (typeof element.bsKey === 'undefined') {\n element.bsKey = {\n key,\n id\n }\n id++\n }\n\n storeData[element.bsKey.id] = data\n },\n get(element, key) {\n if (!element || typeof element.bsKey === 'undefined') {\n return null\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n\n return null\n },\n delete(element, key) {\n if (typeof element.bsKey === 'undefined') {\n return\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.bsKey\n }\n }\n }\n})()\n\nconst Data = {\n setData(instance, key, data) {\n mapData.set(instance, key, data)\n },\n getData(instance, key) {\n return mapData.get(instance, key)\n },\n removeData(instance, key) {\n mapData.delete(instance, key)\n }\n}\n\nexport default Data\n"],"names":["mapData","storeData","id","set","element","key","data","bsKey","get","keyProperties","delete","Data","setData","instance","getData","removeData"],"mappings":";;;;;;;;;;;EAAA;;;;;;;EAOA;;;;;EAMA,IAAMA,OAAO,GAAI,YAAM;EACrB,MAAMC,SAAS,GAAG,EAAlB;EACA,MAAIC,EAAE,GAAG,CAAT;EACA,SAAO;EACLC,IAAAA,GADK,eACDC,OADC,EACQC,GADR,EACaC,IADb,EACmB;EACtB,UAAI,OAAOF,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxCH,QAAAA,OAAO,CAACG,KAAR,GAAgB;EACdF,UAAAA,GAAG,EAAHA,GADc;EAEdH,UAAAA,EAAE,EAAFA;EAFc,SAAhB;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACG,KAAR,CAAcL,EAAf,CAAT,GAA8BI,IAA9B;EACD,KAXI;EAYLE,IAAAA,GAZK,eAYDJ,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACG,KAAf,KAAyB,WAAzC,EAAsD;EACpD,eAAO,IAAP;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACD;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLQ,IAAAA,MAxBK,mBAwBEN,OAxBF,EAwBWC,GAxBX,EAwBgB;EACnB,UAAI,OAAOD,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxC;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACG,KAAf;EACD;EACF;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMI,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOR,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYU,QAAZ,EAAsBR,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXQ,EAAAA,OAJW,mBAIHD,QAJG,EAIOR,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACQ,GAAR,CAAYK,QAAZ,EAAsBR,GAAtB,CAAP;EACD,GANU;EAOXU,EAAAA,UAPW,sBAOAF,QAPA,EAOUR,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACU,MAAR,CAAeG,QAAf,EAAyBR,GAAzB;EACD;EATU;;;;;;;;"}
|
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst mapData = (() => {\n const storeData = {}\n let id = 1\n return {\n set(element, key, data) {\n if (typeof element.bsKey === 'undefined') {\n element.bsKey = {\n key,\n id\n }\n id++\n }\n\n storeData[element.bsKey.id] = data\n },\n get(element, key) {\n if (!element || typeof element.bsKey === 'undefined') {\n return null\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n\n return null\n },\n delete(element, key) {\n if (typeof element.bsKey === 'undefined') {\n return\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.bsKey\n }\n }\n }\n})()\n\nconst Data = {\n setData(instance, key, data) {\n mapData.set(instance, key, data)\n },\n getData(instance, key) {\n return mapData.get(instance, key)\n },\n removeData(instance, key) {\n mapData.delete(instance, key)\n }\n}\n\nexport default Data\n"],"names":["mapData","storeData","id","set","element","key","data","bsKey","get","keyProperties","delete","Data","setData","instance","getData","removeData"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,OAAO,GAAI,YAAM;EACrB,MAAMC,SAAS,GAAG,EAAlB;EACA,MAAIC,EAAE,GAAG,CAAT;EACA,SAAO;EACLC,IAAAA,GADK,eACDC,OADC,EACQC,GADR,EACaC,IADb,EACmB;EACtB,UAAI,OAAOF,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxCH,QAAAA,OAAO,CAACG,KAAR,GAAgB;EACdF,UAAAA,GAAG,EAAHA,GADc;EAEdH,UAAAA,EAAE,EAAFA;EAFc,SAAhB;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACG,KAAR,CAAcL,EAAf,CAAT,GAA8BI,IAA9B;EACD,KAXI;EAYLE,IAAAA,GAZK,eAYDJ,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACG,KAAf,KAAyB,WAAzC,EAAsD;EACpD,eAAO,IAAP;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACD;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLQ,IAAAA,MAxBK,mBAwBEN,OAxBF,EAwBWC,GAxBX,EAwBgB;EACnB,UAAI,OAAOD,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxC;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACG,KAAf;EACD;EACF;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMI,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOR,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYU,QAAZ,EAAsBR,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXQ,EAAAA,OAJW,mBAIHD,QAJG,EAIOR,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACQ,GAAR,CAAYK,QAAZ,EAAsBR,GAAtB,CAAP;EACD,GANU;EAOXU,EAAAA,UAPW,sBAOAF,QAPA,EAOUR,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACU,MAAR,CAAeG,QAAf,EAAyBR,GAAzB;EACD;EATU;;;;;;;;"}
|
42
src/js/bootstrap/dist/dom/event-handler.js
vendored
42
src/js/bootstrap/dist/dom/event-handler.js
vendored
|
@ -1,21 +1,21 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap event-handler.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap event-handler.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(require('./polyfill.js')))
|
? (module.exports = factory())
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./polyfill.js'], factory)
|
? define(factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.EventHandler = factory(global.Polyfill)));
|
(global.EventHandler = factory()));
|
||||||
})(this, function (polyfill_js) {
|
})(this, function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -24,16 +24,18 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/event-handler.js
|
* Bootstrap (v5.0.0-beta1): dom/event-handler.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +45,6 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $ = getjQuery();
|
|
||||||
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||||
var stripNameRegex = /\..*/;
|
var stripNameRegex = /\..*/;
|
||||||
var stripUidRegex = /::\d+$/;
|
var stripUidRegex = /::\d+$/;
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
mouseenter: 'mouseover',
|
mouseenter: 'mouseover',
|
||||||
mouseleave: 'mouseout',
|
mouseleave: 'mouseout',
|
||||||
};
|
};
|
||||||
var nativeEvents = [
|
var nativeEvents = new Set([
|
||||||
'click',
|
'click',
|
||||||
'dblclick',
|
'dblclick',
|
||||||
'mouseup',
|
'mouseup',
|
||||||
|
@ -101,7 +102,7 @@
|
||||||
'error',
|
'error',
|
||||||
'abort',
|
'abort',
|
||||||
'scroll',
|
'scroll',
|
||||||
];
|
]);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Private methods
|
* Private methods
|
||||||
|
@ -182,7 +183,7 @@
|
||||||
typeEvent = custom;
|
typeEvent = custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isNative = nativeEvents.indexOf(typeEvent) > -1;
|
var isNative = nativeEvents.has(typeEvent);
|
||||||
|
|
||||||
if (!isNative) {
|
if (!isNative) {
|
||||||
typeEvent = originalTypeEvent;
|
typeEvent = originalTypeEvent;
|
||||||
|
@ -241,7 +242,7 @@
|
||||||
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||||
var storeElementEvent = events[typeEvent] || {};
|
var storeElementEvent = events[typeEvent] || {};
|
||||||
Object.keys(storeElementEvent).forEach(function (handlerKey) {
|
Object.keys(storeElementEvent).forEach(function (handlerKey) {
|
||||||
if (handlerKey.indexOf(namespace) > -1) {
|
if (handlerKey.includes(namespace)) {
|
||||||
var event = storeElementEvent[handlerKey];
|
var event = storeElementEvent[handlerKey];
|
||||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
}
|
}
|
||||||
|
@ -267,7 +268,7 @@
|
||||||
|
|
||||||
var inNamespace = typeEvent !== originalTypeEvent;
|
var inNamespace = typeEvent !== originalTypeEvent;
|
||||||
var events = getEvent(element);
|
var events = getEvent(element);
|
||||||
var isNamespace = originalTypeEvent.charAt(0) === '.';
|
var isNamespace = originalTypeEvent.startsWith('.');
|
||||||
|
|
||||||
if (typeof originalHandler !== 'undefined') {
|
if (typeof originalHandler !== 'undefined') {
|
||||||
// Simplest case: handler is passed, remove that listener ONLY.
|
// Simplest case: handler is passed, remove that listener ONLY.
|
||||||
|
@ -289,7 +290,7 @@
|
||||||
Object.keys(storeElementEvent).forEach(function (keyHandlers) {
|
Object.keys(storeElementEvent).forEach(function (keyHandlers) {
|
||||||
var handlerKey = keyHandlers.replace(stripUidRegex, '');
|
var handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||||
|
|
||||||
if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
|
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||||
var event = storeElementEvent[keyHandlers];
|
var event = storeElementEvent[keyHandlers];
|
||||||
removeHandler(
|
removeHandler(
|
||||||
element,
|
element,
|
||||||
|
@ -306,9 +307,10 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var $ = getjQuery();
|
||||||
var typeEvent = event.replace(stripNameRegex, '');
|
var typeEvent = event.replace(stripNameRegex, '');
|
||||||
var inNamespace = event !== typeEvent;
|
var inNamespace = event !== typeEvent;
|
||||||
var isNative = nativeEvents.indexOf(typeEvent) > -1;
|
var isNative = nativeEvents.has(typeEvent);
|
||||||
var jQueryEvent;
|
var jQueryEvent;
|
||||||
var bubbles = true;
|
var bubbles = true;
|
||||||
var nativeDispatch = true;
|
var nativeDispatch = true;
|
||||||
|
@ -345,14 +347,6 @@
|
||||||
|
|
||||||
if (defaultPrevented) {
|
if (defaultPrevented) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
if (!polyfill_js.defaultPreventedPreservedOnDispatch) {
|
|
||||||
Object.defineProperty(evt, 'defaultPrevented', {
|
|
||||||
get: function get() {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nativeDispatch) {
|
if (nativeDispatch) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
53
src/js/bootstrap/dist/dom/manipulator.js
vendored
53
src/js/bootstrap/dist/dom/manipulator.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap manipulator.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap manipulator.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -13,26 +13,9 @@
|
||||||
})(this, function () {
|
})(this, function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _extends() {
|
|
||||||
_extends =
|
|
||||||
Object.assign ||
|
|
||||||
function (target) {
|
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
|
||||||
var source = arguments[i];
|
|
||||||
for (var key in source) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/manipulator.js
|
* Bootstrap (v5.0.0-beta1): dom/manipulator.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -64,25 +47,30 @@
|
||||||
|
|
||||||
var Manipulator = {
|
var Manipulator = {
|
||||||
setDataAttribute: function setDataAttribute(element, key, value) {
|
setDataAttribute: function setDataAttribute(element, key, value) {
|
||||||
element.setAttribute('data-' + normalizeDataKey(key), value);
|
element.setAttribute('data-bs-' + normalizeDataKey(key), value);
|
||||||
},
|
},
|
||||||
removeDataAttribute: function removeDataAttribute(element, key) {
|
removeDataAttribute: function removeDataAttribute(element, key) {
|
||||||
element.removeAttribute('data-' + normalizeDataKey(key));
|
element.removeAttribute('data-bs-' + normalizeDataKey(key));
|
||||||
},
|
},
|
||||||
getDataAttributes: function getDataAttributes(element) {
|
getDataAttributes: function getDataAttributes(element) {
|
||||||
if (!element) {
|
if (!element) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributes = _extends({}, element.dataset);
|
var attributes = {};
|
||||||
|
Object.keys(element.dataset)
|
||||||
Object.keys(attributes).forEach(function (key) {
|
.filter(function (key) {
|
||||||
attributes[key] = normalizeData(attributes[key]);
|
return key.startsWith('bs');
|
||||||
});
|
})
|
||||||
|
.forEach(function (key) {
|
||||||
|
var pureKey = key.replace(/^bs/, '');
|
||||||
|
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||||||
|
attributes[pureKey] = normalizeData(element.dataset[key]);
|
||||||
|
});
|
||||||
return attributes;
|
return attributes;
|
||||||
},
|
},
|
||||||
getDataAttribute: function getDataAttribute(element, key) {
|
getDataAttribute: function getDataAttribute(element, key) {
|
||||||
return normalizeData(element.getAttribute('data-' + normalizeDataKey(key)));
|
return normalizeData(element.getAttribute('data-bs-' + normalizeDataKey(key)));
|
||||||
},
|
},
|
||||||
offset: function offset(element) {
|
offset: function offset(element) {
|
||||||
var rect = element.getBoundingClientRect();
|
var rect = element.getBoundingClientRect();
|
||||||
|
@ -97,17 +85,6 @@
|
||||||
left: element.offsetLeft,
|
left: element.offsetLeft,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
toggleClass: function toggleClass(element, className) {
|
|
||||||
if (!element) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element.classList.contains(className)) {
|
|
||||||
element.classList.remove(className);
|
|
||||||
} else {
|
|
||||||
element.classList.add(className);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return Manipulator;
|
return Manipulator;
|
||||||
|
|
2
src/js/bootstrap/dist/dom/manipulator.js.map
vendored
2
src/js/bootstrap/dist/dom/manipulator.js.map
vendored
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha2): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {\n ...element.dataset\n }\n\n Object.keys(attributes).forEach(key => {\n attributes[key] = normalizeData(attributes[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n },\n\n toggleClass(element, className) {\n if (!element) {\n return\n }\n\n if (element.classList.contains(className)) {\n element.classList.remove(className)\n } else {\n element.classList.add(className)\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","dataset","Object","keys","forEach","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft","toggleClass","className","classList","contains","remove","add"],"mappings":";;;;;;;;;;;;;EAAA;;;;;;EAOA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsB,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,WAAW,GAAG;EAClBC,EAAAA,gBADkB,4BACDC,OADC,EACQN,GADR,EACaO,KADb,EACoB;EACpCD,IAAAA,OAAO,CAACE,YAAR,WAA6BT,gBAAgB,CAACC,GAAD,CAA7C,EAAsDO,KAAtD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,WAAgCX,gBAAgB,CAACC,GAAD,CAAhD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,gBACXN,OAAO,CAACO,OADG,CAAhB;;EAIAC,IAAAA,MAAM,CAACC,IAAP,CAAYH,UAAZ,EAAwBI,OAAxB,CAAgC,UAAAhB,GAAG,EAAI;EACrCY,MAAAA,UAAU,CAACZ,GAAD,CAAV,GAAkBL,aAAa,CAACiB,UAAU,CAACZ,GAAD,CAAX,CAA/B;EACD,KAFD;EAIA,WAAOY,UAAP;EACD,GAvBiB;EAyBlBK,EAAAA,gBAzBkB,4BAyBDX,OAzBC,EAyBQN,GAzBR,EAyBa;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACY,YAAR,WAA6BnB,gBAAgB,CAACC,GAAD,CAA7C,CAAD,CAApB;EACD,GA3BiB;EA6BlBmB,EAAAA,MA7BkB,kBA6BXb,OA7BW,EA6BF;EACd,QAAMc,IAAI,GAAGd,OAAO,CAACe,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GApCiB;EAsClBC,EAAAA,QAtCkB,oBAsCTtB,OAtCS,EAsCA;EAChB,WAAO;EACLgB,MAAAA,GAAG,EAAEhB,OAAO,CAACuB,SADR;EAELH,MAAAA,IAAI,EAAEpB,OAAO,CAACwB;EAFT,KAAP;EAID,GA3CiB;EA6ClBC,EAAAA,WA7CkB,uBA6CNzB,OA7CM,EA6CG0B,SA7CH,EA6Cc;EAC9B,QAAI,CAAC1B,OAAL,EAAc;EACZ;EACD;;EAED,QAAIA,OAAO,CAAC2B,SAAR,CAAkBC,QAAlB,CAA2BF,SAA3B,CAAJ,EAA2C;EACzC1B,MAAAA,OAAO,CAAC2B,SAAR,CAAkBE,MAAlB,CAAyBH,SAAzB;EACD,KAFD,MAEO;EACL1B,MAAAA,OAAO,CAAC2B,SAAR,CAAkBG,GAAlB,CAAsBJ,SAAtB;EACD;EACF;EAvDiB;;;;;;;;"}
|
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsB,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,WAAW,GAAG;EAClBC,EAAAA,gBADkB,4BACDC,OADC,EACQN,GADR,EACaO,KADb,EACoB;EACpCD,IAAAA,OAAO,CAACE,YAAR,cAAgCT,gBAAgB,CAACC,GAAD,CAAhD,EAAyDO,KAAzD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,cAAmCX,gBAAgB,CAACC,GAAD,CAAnD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACU,UAAAhB,GAAG;EAAA,aAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CAAJ;EAAA,KADb,EAEGC,OAFH,CAEW,UAAAlB,GAAG,EAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;EA2BlBW,EAAAA,gBA3BkB,4BA2BDjB,OA3BC,EA2BQN,GA3BR,EA2Ba;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,cAAgCzB,gBAAgB,CAACC,GAAD,CAAhD,CAAD,CAApB;EACD,GA7BiB;EA+BlByB,EAAAA,MA/BkB,kBA+BXnB,OA/BW,EA+BF;EACd,QAAMoB,IAAI,GAAGpB,OAAO,CAACqB,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GAtCiB;EAwClBC,EAAAA,QAxCkB,oBAwCT5B,OAxCS,EAwCA;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;EA7CiB;;;;;;;;"}
|
113
src/js/bootstrap/dist/dom/polyfill.js
vendored
113
src/js/bootstrap/dist/dom/polyfill.js
vendored
|
@ -1,113 +0,0 @@
|
||||||
/*!
|
|
||||||
* Bootstrap polyfill.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
||||||
*/
|
|
||||||
(function (global, factory) {
|
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
|
||||||
? factory(exports)
|
|
||||||
: typeof define === 'function' && define.amd
|
|
||||||
? define(['exports'], factory)
|
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
|
||||||
factory((global.Polyfill = {})));
|
|
||||||
})(this, function (exports) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
var MAX_UID = 1000000;
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Public Util Api
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
var getUID = function getUID(prefix) {
|
|
||||||
do {
|
|
||||||
prefix += Math.floor(Math.random() * MAX_UID);
|
|
||||||
} while (document.getElementById(prefix));
|
|
||||||
|
|
||||||
return prefix;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* istanbul ignore file */
|
|
||||||
exports.find = Element.prototype.querySelectorAll;
|
|
||||||
exports.findOne = Element.prototype.querySelector; // MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
|
||||||
|
|
||||||
var defaultPreventedPreservedOnDispatch = (function () {
|
|
||||||
var e = new CustomEvent('Bootstrap', {
|
|
||||||
cancelable: true,
|
|
||||||
});
|
|
||||||
var element = document.createElement('div');
|
|
||||||
element.addEventListener('Bootstrap', function () {
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
e.preventDefault();
|
|
||||||
element.dispatchEvent(e);
|
|
||||||
return e.defaultPrevented;
|
|
||||||
})();
|
|
||||||
|
|
||||||
var scopeSelectorRegex = /:scope\b/;
|
|
||||||
|
|
||||||
var supportScopeQuery = (function () {
|
|
||||||
var element = document.createElement('div');
|
|
||||||
|
|
||||||
try {
|
|
||||||
element.querySelectorAll(':scope *');
|
|
||||||
} catch (_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (!supportScopeQuery) {
|
|
||||||
exports.find = function find(selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelectorAll(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
var hasId = Boolean(this.id);
|
|
||||||
|
|
||||||
if (!hasId) {
|
|
||||||
this.id = getUID('scope');
|
|
||||||
}
|
|
||||||
|
|
||||||
var nodeList = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
selector = selector.replace(scopeSelectorRegex, '#' + this.id);
|
|
||||||
nodeList = this.querySelectorAll(selector);
|
|
||||||
} finally {
|
|
||||||
if (!hasId) {
|
|
||||||
this.removeAttribute('id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodeList;
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.findOne = function findOne(selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelector(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
var matches = exports.find.call(this, selector);
|
|
||||||
|
|
||||||
if (typeof matches[0] !== 'undefined') {
|
|
||||||
return matches[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.defaultPreventedPreservedOnDispatch = defaultPreventedPreservedOnDispatch;
|
|
||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
|
||||||
});
|
|
||||||
//# sourceMappingURL=polyfill.js.map
|
|
1
src/js/bootstrap/dist/dom/polyfill.js.map
vendored
1
src/js/bootstrap/dist/dom/polyfill.js.map
vendored
File diff suppressed because one or more lines are too long
21
src/js/bootstrap/dist/dom/selector-engine.js
vendored
21
src/js/bootstrap/dist/dom/selector-engine.js
vendored
|
@ -1,30 +1,30 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap selector-engine.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap selector-engine.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(require('./polyfill.js')))
|
? (module.exports = factory())
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./polyfill.js'], factory)
|
? define(factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.SelectorEngine = factory(global.Polyfill)));
|
(global.SelectorEngine = factory()));
|
||||||
})(this, function (polyfill_js) {
|
})(this, function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
|
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var NODE_TEXT = 3;
|
var NODE_TEXT = 3;
|
||||||
var SelectorEngine = {
|
var SelectorEngine = {
|
||||||
matches: function matches(element, selector) {
|
matches: function matches(element, selector) {
|
||||||
|
@ -37,14 +37,17 @@
|
||||||
element = document.documentElement;
|
element = document.documentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_ref = []).concat.apply(_ref, polyfill_js.find.call(element, selector));
|
return (_ref = []).concat.apply(
|
||||||
|
_ref,
|
||||||
|
Element.prototype.querySelectorAll.call(element, selector)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
findOne: function findOne(selector, element) {
|
findOne: function findOne(selector, element) {
|
||||||
if (element === void 0) {
|
if (element === void 0) {
|
||||||
element = document.documentElement;
|
element = document.documentElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return polyfill_js.findOne.call(element, selector);
|
return Element.prototype.querySelector.call(element, selector);
|
||||||
},
|
},
|
||||||
children: function children(element, selector) {
|
children: function children(element, selector) {
|
||||||
var _ref2;
|
var _ref2;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha2): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { find as findFn, findOne } from './polyfill'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n matches(element, selector) {\n return element.matches(selector)\n },\n\n find(selector, element = document.documentElement) {\n return [].concat(...findFn.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return findOne.call(element, selector)\n },\n\n children(element, selector) {\n const children = [].concat(...element.children)\n\n return children.filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (this.matches(ancestor, selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (this.matches(next, selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","matches","element","selector","find","document","documentElement","concat","findFn","call","findOne","children","filter","child","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;;;;;;EASA;;;;;;EAMA,IAAMA,SAAS,GAAG,CAAlB;MAEMC,cAAc,GAAG;EACrBC,EAAAA,OADqB,mBACbC,OADa,EACJC,QADI,EACM;EACzB,WAAOD,OAAO,CAACD,OAAR,CAAgBE,QAAhB,CAAP;EACD,GAHoB;EAKrBC,EAAAA,IALqB,gBAKhBD,QALgB,EAKND,OALM,EAK8B;EAAA;;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACjD,WAAO,YAAGC,MAAH,aAAaC,gBAAM,CAACC,IAAP,CAAYP,OAAZ,EAAqBC,QAArB,CAAb,CAAP;EACD,GAPoB;EASrBO,EAAAA,OATqB,mBASbP,QATa,EASHD,OATG,EASiC;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACpD,WAAOI,mBAAO,CAACD,IAAR,CAAaP,OAAb,EAAsBC,QAAtB,CAAP;EACD,GAXoB;EAarBQ,EAAAA,QAbqB,oBAaZT,OAbY,EAaHC,QAbG,EAaO;EAAA;;EAC1B,QAAMQ,QAAQ,GAAG,aAAGJ,MAAH,cAAaL,OAAO,CAACS,QAArB,CAAjB;;EAEA,WAAOA,QAAQ,CAACC,MAAT,CAAgB,UAAAC,KAAK;EAAA,aAAIA,KAAK,CAACZ,OAAN,CAAcE,QAAd,CAAJ;EAAA,KAArB,CAAP;EACD,GAjBoB;EAmBrBW,EAAAA,OAnBqB,mBAmBbZ,OAnBa,EAmBJC,QAnBI,EAmBM;EACzB,QAAMW,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGb,OAAO,CAACc,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBlB,SAApF,EAA+F;EAC7F,UAAI,KAAKE,OAAL,CAAac,QAAb,EAAuBZ,QAAvB,CAAJ,EAAsC;EACpCW,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GAjCoB;EAmCrBO,EAAAA,IAnCqB,gBAmChBnB,OAnCgB,EAmCPC,QAnCO,EAmCG;EACtB,QAAImB,QAAQ,GAAGpB,OAAO,CAACqB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACrB,OAAT,CAAiBE,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACmB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA/CoB;EAiDrBC,EAAAA,IAjDqB,gBAiDhBtB,OAjDgB,EAiDPC,QAjDO,EAiDG;EACtB,QAAIqB,IAAI,GAAGtB,OAAO,CAACuB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAI,KAAKvB,OAAL,CAAauB,IAAb,EAAmBrB,QAAnB,CAAJ,EAAkC;EAChC,eAAO,CAACqB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;EA7DoB;;;;;;;;"}
|
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n matches(element, selector) {\n return element.matches(selector)\n },\n\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n const children = [].concat(...element.children)\n\n return children.filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (this.matches(ancestor, selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (this.matches(next, selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","matches","element","selector","find","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,SAAS,GAAG,CAAlB;MAEMC,cAAc,GAAG;EACrBC,EAAAA,OADqB,mBACbC,OADa,EACJC,QADI,EACM;EACzB,WAAOD,OAAO,CAACD,OAAR,CAAgBE,QAAhB,CAAP;EACD,GAHoB;EAKrBC,EAAAA,IALqB,gBAKhBD,QALgB,EAKND,OALM,EAK8B;EAAA;;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACjD,WAAO,YAAGC,MAAH,aAAaC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCT,OAAxC,EAAiDC,QAAjD,CAAb,CAAP;EACD,GAPoB;EASrBS,EAAAA,OATqB,mBASbT,QATa,EASHD,OATG,EASiC;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCT,OAArC,EAA8CC,QAA9C,CAAP;EACD,GAXoB;EAarBW,EAAAA,QAbqB,oBAaZZ,OAbY,EAaHC,QAbG,EAaO;EAAA;;EAC1B,QAAMW,QAAQ,GAAG,aAAGP,MAAH,cAAaL,OAAO,CAACY,QAArB,CAAjB;;EAEA,WAAOA,QAAQ,CAACC,MAAT,CAAgB,UAAAC,KAAK;EAAA,aAAIA,KAAK,CAACf,OAAN,CAAcE,QAAd,CAAJ;EAAA,KAArB,CAAP;EACD,GAjBoB;EAmBrBc,EAAAA,OAnBqB,mBAmBbf,OAnBa,EAmBJC,QAnBI,EAmBM;EACzB,QAAMc,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGhB,OAAO,CAACiB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAI,KAAKE,OAAL,CAAaiB,QAAb,EAAuBf,QAAvB,CAAJ,EAAsC;EACpCc,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GAjCoB;EAmCrBO,EAAAA,IAnCqB,gBAmChBtB,OAnCgB,EAmCPC,QAnCO,EAmCG;EACtB,QAAIsB,QAAQ,GAAGvB,OAAO,CAACwB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACxB,OAAT,CAAiBE,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACsB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA/CoB;EAiDrBC,EAAAA,IAjDqB,gBAiDhBzB,OAjDgB,EAiDPC,QAjDO,EAiDG;EACtB,QAAIwB,IAAI,GAAGzB,OAAO,CAAC0B,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAI,KAAK1B,OAAL,CAAa0B,IAAb,EAAmBxB,QAAnB,CAAJ,EAAkC;EAChC,eAAO,CAACwB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;EA7DoB;;;;;;;;"}
|
369
src/js/bootstrap/dist/dropdown.js
vendored
369
src/js/bootstrap/dist/dropdown.js
vendored
|
@ -1,49 +1,75 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap dropdown.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap dropdown.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(
|
? (module.exports = factory(
|
||||||
|
require('@popperjs/core'),
|
||||||
require('./dom/data.js'),
|
require('./dom/data.js'),
|
||||||
require('./dom/event-handler.js'),
|
require('./dom/event-handler.js'),
|
||||||
require('./dom/manipulator.js'),
|
require('./dom/manipulator.js'),
|
||||||
require('popper.js'),
|
|
||||||
require('./dom/selector-engine.js')
|
require('./dom/selector-engine.js')
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'@popperjs/core',
|
||||||
'./dom/event-handler.js',
|
'./dom/data',
|
||||||
'./dom/manipulator.js',
|
'./dom/event-handler',
|
||||||
'popper.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Dropdown = factory(
|
(global.Dropdown = factory(
|
||||||
|
global.Popper,
|
||||||
global.Data,
|
global.Data,
|
||||||
global.EventHandler,
|
global.EventHandler,
|
||||||
global.Manipulator,
|
global.Manipulator,
|
||||||
global.Popper,
|
|
||||||
global.SelectorEngine
|
global.SelectorEngine
|
||||||
)));
|
)));
|
||||||
})(this, function (Data, EventHandler, Manipulator, Popper, SelectorEngine) {
|
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _interopDefaultLegacy(e) {
|
function _interopDefaultLegacy(e) {
|
||||||
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _interopNamespace(e) {
|
||||||
|
if (e && e.__esModule) return e;
|
||||||
|
var n = Object.create(null);
|
||||||
|
if (e) {
|
||||||
|
Object.keys(e).forEach(function (k) {
|
||||||
|
if (k !== 'default') {
|
||||||
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||||
|
Object.defineProperty(
|
||||||
|
n,
|
||||||
|
k,
|
||||||
|
d.get
|
||||||
|
? d
|
||||||
|
: {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return e[k];
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
n['default'] = e;
|
||||||
|
return Object.freeze(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var Popper__namespace = /*#__PURE__*/ _interopNamespace(Popper);
|
||||||
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
||||||
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
||||||
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
||||||
var Popper__default = /*#__PURE__*/ _interopDefaultLegacy(Popper);
|
|
||||||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +86,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -122,29 +148,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -167,8 +186,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'dropdown';
|
var NAME = 'dropdown';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.dropdown';
|
var DATA_KEY = 'bs.dropdown';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -191,26 +289,24 @@
|
||||||
var CLASS_NAME_DISABLED = 'disabled';
|
var CLASS_NAME_DISABLED = 'disabled';
|
||||||
var CLASS_NAME_SHOW = 'show';
|
var CLASS_NAME_SHOW = 'show';
|
||||||
var CLASS_NAME_DROPUP = 'dropup';
|
var CLASS_NAME_DROPUP = 'dropup';
|
||||||
var CLASS_NAME_DROPRIGHT = 'dropright';
|
var CLASS_NAME_DROPEND = 'dropend';
|
||||||
var CLASS_NAME_DROPLEFT = 'dropleft';
|
var CLASS_NAME_DROPSTART = 'dropstart';
|
||||||
var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
|
|
||||||
var CLASS_NAME_NAVBAR = 'navbar';
|
var CLASS_NAME_NAVBAR = 'navbar';
|
||||||
var CLASS_NAME_POSITION_STATIC = 'position-static';
|
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]';
|
||||||
var SELECTOR_DATA_TOGGLE = '[data-toggle="dropdown"]';
|
|
||||||
var SELECTOR_FORM_CHILD = '.dropdown form';
|
var SELECTOR_FORM_CHILD = '.dropdown form';
|
||||||
var SELECTOR_MENU = '.dropdown-menu';
|
var SELECTOR_MENU = '.dropdown-menu';
|
||||||
var SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
var SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||||
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||||
var PLACEMENT_TOP = 'top-start';
|
var PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||||
var PLACEMENT_TOPEND = 'top-end';
|
var PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||||
var PLACEMENT_BOTTOM = 'bottom-start';
|
var PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||||
var PLACEMENT_BOTTOMEND = 'bottom-end';
|
var PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||||
var PLACEMENT_RIGHT = 'right-start';
|
var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||||
var PLACEMENT_LEFT = 'left-start';
|
var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||||
var Default = {
|
var Default = {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
flip: true,
|
flip: true,
|
||||||
boundary: 'scrollParent',
|
boundary: 'clippingParents',
|
||||||
reference: 'toggle',
|
reference: 'toggle',
|
||||||
display: 'dynamic',
|
display: 'dynamic',
|
||||||
popperConfig: null,
|
popperConfig: null,
|
||||||
|
@ -229,17 +325,21 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Dropdown = /*#__PURE__*/ (function () {
|
var Dropdown = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Dropdown, _BaseComponent);
|
||||||
|
|
||||||
function Dropdown(element, config) {
|
function Dropdown(element, config) {
|
||||||
this._element = element;
|
var _this;
|
||||||
this._popper = null;
|
|
||||||
this._config = this._getConfig(config);
|
|
||||||
this._menu = this._getMenuElement();
|
|
||||||
this._inNavbar = this._detectNavbar();
|
|
||||||
|
|
||||||
this._addEventListeners();
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
|
_this._popper = null;
|
||||||
|
_this._config = _this._getConfig(config);
|
||||||
|
_this._menu = _this._getMenuElement();
|
||||||
|
_this._inNavbar = _this._detectNavbar();
|
||||||
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
_this._addEventListeners();
|
||||||
|
|
||||||
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Dropdown.prototype;
|
var _proto = Dropdown.prototype;
|
||||||
|
@ -282,11 +382,11 @@
|
||||||
|
|
||||||
if (showEvent.defaultPrevented) {
|
if (showEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
} // Disable totally Popper.js for Dropdown in Navbar
|
} // Totally disable Popper for Dropdowns in Navbar
|
||||||
|
|
||||||
if (!this._inNavbar) {
|
if (!this._inNavbar) {
|
||||||
if (typeof Popper__default['default'] === 'undefined') {
|
if (typeof Popper__namespace === 'undefined') {
|
||||||
throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org)");
|
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
|
||||||
}
|
}
|
||||||
|
|
||||||
var referenceElement = this._element;
|
var referenceElement = this._element;
|
||||||
|
@ -299,19 +399,9 @@
|
||||||
if (typeof this._config.reference.jquery !== 'undefined') {
|
if (typeof this._config.reference.jquery !== 'undefined') {
|
||||||
referenceElement = this._config.reference[0];
|
referenceElement = this._config.reference[0];
|
||||||
}
|
}
|
||||||
} // If boundary is not `scrollParent`, then set position to `static`
|
|
||||||
// to allow the menu to "escape" the scroll parent's boundaries
|
|
||||||
// https://github.com/twbs/bootstrap/issues/24251
|
|
||||||
|
|
||||||
if (this._config.boundary !== 'scrollParent') {
|
|
||||||
parent.classList.add(CLASS_NAME_POSITION_STATIC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._popper = new Popper__default['default'](
|
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig());
|
||||||
referenceElement,
|
|
||||||
this._menu,
|
|
||||||
this._getPopperConfig()
|
|
||||||
);
|
|
||||||
} // If this is a touch-enabled device we add extra
|
} // If this is a touch-enabled device we add extra
|
||||||
// empty mouseover listeners to the body's immediate children;
|
// empty mouseover listeners to the body's immediate children;
|
||||||
// only needed because of broken event delegation on iOS
|
// only needed because of broken event delegation on iOS
|
||||||
|
@ -329,8 +419,10 @@
|
||||||
|
|
||||||
this._element.setAttribute('aria-expanded', true);
|
this._element.setAttribute('aria-expanded', true);
|
||||||
|
|
||||||
Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
|
|
||||||
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget);
|
EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -357,15 +449,17 @@
|
||||||
this._popper.destroy();
|
this._popper.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
|
|
||||||
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
|
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
|
|
||||||
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
||||||
this._element = null;
|
|
||||||
this._menu = null;
|
this._menu = null;
|
||||||
|
|
||||||
if (this._popper) {
|
if (this._popper) {
|
||||||
|
@ -379,18 +473,18 @@
|
||||||
this._inNavbar = this._detectNavbar();
|
this._inNavbar = this._detectNavbar();
|
||||||
|
|
||||||
if (this._popper) {
|
if (this._popper) {
|
||||||
this._popper.scheduleUpdate();
|
this._popper.update();
|
||||||
}
|
}
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
_proto._addEventListeners = function _addEventListeners() {
|
_proto._addEventListeners = function _addEventListeners() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
_this.toggle();
|
_this2.toggle();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -411,68 +505,49 @@
|
||||||
|
|
||||||
_proto._getPlacement = function _getPlacement() {
|
_proto._getPlacement = function _getPlacement() {
|
||||||
var parentDropdown = this._element.parentNode;
|
var parentDropdown = this._element.parentNode;
|
||||||
var placement = PLACEMENT_BOTTOM; // Handle dropup
|
|
||||||
|
|
||||||
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
||||||
placement = PLACEMENT_TOP;
|
return PLACEMENT_RIGHT;
|
||||||
|
|
||||||
if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
|
|
||||||
placement = PLACEMENT_TOPEND;
|
|
||||||
}
|
|
||||||
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
|
|
||||||
placement = PLACEMENT_RIGHT;
|
|
||||||
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
|
|
||||||
placement = PLACEMENT_LEFT;
|
|
||||||
} else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
|
|
||||||
placement = PLACEMENT_BOTTOMEND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return placement;
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
|
||||||
|
return PLACEMENT_LEFT;
|
||||||
|
} // We need to trim the value because custom properties can also include spaces
|
||||||
|
|
||||||
|
var isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
|
||||||
|
|
||||||
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
||||||
|
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._detectNavbar = function _detectNavbar() {
|
_proto._detectNavbar = function _detectNavbar() {
|
||||||
return Boolean(this._element.closest('.' + CLASS_NAME_NAVBAR));
|
return this._element.closest('.' + CLASS_NAME_NAVBAR) !== null;
|
||||||
};
|
|
||||||
|
|
||||||
_proto._getOffset = function _getOffset() {
|
|
||||||
var _this2 = this;
|
|
||||||
|
|
||||||
var offset = {};
|
|
||||||
|
|
||||||
if (typeof this._config.offset === 'function') {
|
|
||||||
offset.fn = function (data) {
|
|
||||||
data.offsets = _extends(
|
|
||||||
{},
|
|
||||||
data.offsets,
|
|
||||||
_this2._config.offset(data.offsets, _this2._element) || {}
|
|
||||||
);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
offset.offset = this._config.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getPopperConfig = function _getPopperConfig() {
|
_proto._getPopperConfig = function _getPopperConfig() {
|
||||||
var popperConfig = {
|
var popperConfig = {
|
||||||
placement: this._getPlacement(),
|
placement: this._getPlacement(),
|
||||||
modifiers: {
|
modifiers: [
|
||||||
offset: this._getOffset(),
|
{
|
||||||
flip: {
|
name: 'preventOverflow',
|
||||||
enabled: this._config.flip,
|
options: {
|
||||||
|
altBoundary: this._config.flip,
|
||||||
|
rootBoundary: this._config.boundary,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
preventOverflow: {
|
],
|
||||||
boundariesElement: this._config.boundary,
|
}; // Disable Popper if we have a static display
|
||||||
},
|
|
||||||
},
|
|
||||||
}; // Disable Popper.js if we have a static display
|
|
||||||
|
|
||||||
if (this._config.display === 'static') {
|
if (this._config.display === 'static') {
|
||||||
popperConfig.modifiers.applyStyle = {
|
popperConfig.modifiers = [
|
||||||
enabled: false,
|
{
|
||||||
};
|
name: 'applyStyles',
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return _extends({}, popperConfig, this._config.popperConfig);
|
return _extends({}, popperConfig, this._config.popperConfig);
|
||||||
|
@ -624,15 +699,13 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = items.indexOf(event.target);
|
var index = items.indexOf(event.target); // Up
|
||||||
|
|
||||||
if (event.key === ARROW_UP_KEY && index > 0) {
|
if (event.key === ARROW_UP_KEY && index > 0) {
|
||||||
// Up
|
|
||||||
index--;
|
index--;
|
||||||
}
|
} // Down
|
||||||
|
|
||||||
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
|
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
|
||||||
// Down
|
|
||||||
index++;
|
index++;
|
||||||
} // index is -1 if the first keydown is an ArrowUp
|
} // index is -1 if the first keydown is an ArrowUp
|
||||||
|
|
||||||
|
@ -640,17 +713,7 @@
|
||||||
items[index].focus();
|
items[index].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
Dropdown.getInstance = function getInstance(element) {
|
_createClass$1(Dropdown, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Dropdown, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -663,10 +726,16 @@
|
||||||
return DefaultType;
|
return DefaultType;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Dropdown;
|
return Dropdown;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -705,26 +774,28 @@
|
||||||
return e.stopPropagation();
|
return e.stopPropagation();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .dropdown to jQuery only if jQuery is present
|
* add .Dropdown to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Dropdown.jQueryInterface;
|
$.fn[NAME] = Dropdown.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Dropdown;
|
$.fn[NAME].Constructor = Dropdown;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Dropdown.jQueryInterface;
|
return Dropdown.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Dropdown;
|
return Dropdown;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/dropdown.js.map
vendored
2
src/js/bootstrap/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
364
src/js/bootstrap/dist/modal.js
vendored
364
src/js/bootstrap/dist/modal.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap modal.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap modal.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -13,10 +13,10 @@
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'./dom/data',
|
||||||
'./dom/event-handler.js',
|
'./dom/event-handler',
|
||||||
'./dom/manipulator.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Modal = factory(
|
(global.Modal = factory(
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -82,8 +82,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -91,7 +91,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -163,29 +166,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -208,8 +204,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'modal';
|
var NAME = 'modal';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.modal';
|
var DATA_KEY = 'bs.modal';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -218,13 +293,11 @@
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
focus: true,
|
focus: true,
|
||||||
show: true,
|
|
||||||
};
|
};
|
||||||
var DefaultType = {
|
var DefaultType = {
|
||||||
backdrop: '(boolean|string)',
|
backdrop: '(boolean|string)',
|
||||||
keyboard: 'boolean',
|
keyboard: 'boolean',
|
||||||
focus: 'boolean',
|
focus: 'boolean',
|
||||||
show: 'boolean',
|
|
||||||
};
|
};
|
||||||
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
||||||
var EVENT_HIDE_PREVENTED = 'hidePrevented' + EVENT_KEY;
|
var EVENT_HIDE_PREVENTED = 'hidePrevented' + EVENT_KEY;
|
||||||
|
@ -246,8 +319,8 @@
|
||||||
var CLASS_NAME_STATIC = 'modal-static';
|
var CLASS_NAME_STATIC = 'modal-static';
|
||||||
var SELECTOR_DIALOG = '.modal-dialog';
|
var SELECTOR_DIALOG = '.modal-dialog';
|
||||||
var SELECTOR_MODAL_BODY = '.modal-body';
|
var SELECTOR_MODAL_BODY = '.modal-body';
|
||||||
var SELECTOR_DATA_TOGGLE = '[data-toggle="modal"]';
|
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]';
|
||||||
var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
|
var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
|
||||||
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
||||||
var SELECTOR_STICKY_CONTENT = '.sticky-top';
|
var SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||||
/**
|
/**
|
||||||
|
@ -256,18 +329,22 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Modal = /*#__PURE__*/ (function () {
|
var Modal = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Modal, _BaseComponent);
|
||||||
|
|
||||||
function Modal(element, config) {
|
function Modal(element, config) {
|
||||||
this._config = this._getConfig(config);
|
var _this;
|
||||||
this._element = element;
|
|
||||||
this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element);
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
this._backdrop = null;
|
_this._config = _this._getConfig(config);
|
||||||
this._isShown = false;
|
_this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element);
|
||||||
this._isBodyOverflowing = false;
|
_this._backdrop = null;
|
||||||
this._ignoreBackdropClick = false;
|
_this._isShown = false;
|
||||||
this._isTransitioning = false;
|
_this._isBodyOverflowing = false;
|
||||||
this._scrollbarWidth = 0;
|
_this._ignoreBackdropClick = false;
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
_this._isTransitioning = false;
|
||||||
|
_this._scrollbarWidth = 0;
|
||||||
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Modal.prototype;
|
var _proto = Modal.prototype;
|
||||||
|
@ -278,7 +355,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.show = function show(relatedTarget) {
|
_proto.show = function show(relatedTarget) {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
if (this._isShown || this._isTransitioning) {
|
if (this._isShown || this._isTransitioning) {
|
||||||
return;
|
return;
|
||||||
|
@ -313,26 +390,26 @@
|
||||||
EVENT_CLICK_DISMISS,
|
EVENT_CLICK_DISMISS,
|
||||||
SELECTOR_DATA_DISMISS,
|
SELECTOR_DATA_DISMISS,
|
||||||
function (event) {
|
function (event) {
|
||||||
return _this.hide(event);
|
return _this2.hide(event);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
|
EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
|
||||||
EventHandler__default['default'].one(_this._element, EVENT_MOUSEUP_DISMISS, function (
|
EventHandler__default['default'].one(_this2._element, EVENT_MOUSEUP_DISMISS, function (
|
||||||
event
|
event
|
||||||
) {
|
) {
|
||||||
if (event.target === _this._element) {
|
if (event.target === _this2._element) {
|
||||||
_this._ignoreBackdropClick = true;
|
_this2._ignoreBackdropClick = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this._showBackdrop(function () {
|
this._showBackdrop(function () {
|
||||||
return _this._showElement(relatedTarget);
|
return _this2._showElement(relatedTarget);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide(event) {
|
_proto.hide = function hide(event) {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -370,7 +447,7 @@
|
||||||
if (transition) {
|
if (transition) {
|
||||||
var transitionDuration = getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
|
EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
|
||||||
return _this2._hideModal(event);
|
return _this3._hideModal(event);
|
||||||
});
|
});
|
||||||
emulateTransitionEnd(this._element, transitionDuration);
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
|
@ -382,6 +459,8 @@
|
||||||
[window, this._element, this._dialog].forEach(function (htmlElement) {
|
[window, this._element, this._dialog].forEach(function (htmlElement) {
|
||||||
return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
|
return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
/**
|
/**
|
||||||
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||||
* Do not move `document` in `htmlElements` array
|
* Do not move `document` in `htmlElements` array
|
||||||
|
@ -389,9 +468,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
this._backdrop = null;
|
this._backdrop = null;
|
||||||
this._isShown = null;
|
this._isShown = null;
|
||||||
|
@ -412,7 +489,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._showElement = function _showElement(relatedTarget) {
|
_proto._showElement = function _showElement(relatedTarget) {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var transition = this._element.classList.contains(CLASS_NAME_FADE);
|
var transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||||
|
|
||||||
|
@ -448,12 +525,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var transitionComplete = function transitionComplete() {
|
var transitionComplete = function transitionComplete() {
|
||||||
if (_this3._config.focus) {
|
if (_this4._config.focus) {
|
||||||
_this3._element.focus();
|
_this4._element.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3._isTransitioning = false;
|
_this4._isTransitioning = false;
|
||||||
EventHandler__default['default'].trigger(_this3._element, EVENT_SHOWN, {
|
EventHandler__default['default'].trigger(_this4._element, EVENT_SHOWN, {
|
||||||
relatedTarget: relatedTarget,
|
relatedTarget: relatedTarget,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -468,32 +545,32 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._enforceFocus = function _enforceFocus() {
|
_proto._enforceFocus = function _enforceFocus() {
|
||||||
var _this4 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||||
|
|
||||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) {
|
EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) {
|
||||||
if (
|
if (
|
||||||
document !== event.target &&
|
document !== event.target &&
|
||||||
_this4._element !== event.target &&
|
_this5._element !== event.target &&
|
||||||
!_this4._element.contains(event.target)
|
!_this5._element.contains(event.target)
|
||||||
) {
|
) {
|
||||||
_this4._element.focus();
|
_this5._element.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setEscapeEvent = function _setEscapeEvent() {
|
_proto._setEscapeEvent = function _setEscapeEvent() {
|
||||||
var _this5 = this;
|
var _this6 = this;
|
||||||
|
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
|
||||||
if (_this5._config.keyboard && event.key === ESCAPE_KEY) {
|
if (_this6._config.keyboard && event.key === ESCAPE_KEY) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
_this5.hide();
|
_this6.hide();
|
||||||
} else if (!_this5._config.keyboard && event.key === ESCAPE_KEY) {
|
} else if (!_this6._config.keyboard && event.key === ESCAPE_KEY) {
|
||||||
_this5._triggerBackdropTransition();
|
_this6._triggerBackdropTransition();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -502,11 +579,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setResizeEvent = function _setResizeEvent() {
|
_proto._setResizeEvent = function _setResizeEvent() {
|
||||||
var _this6 = this;
|
var _this7 = this;
|
||||||
|
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
|
EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
|
||||||
return _this6._adjustDialog();
|
return _this7._adjustDialog();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
EventHandler__default['default'].off(window, EVENT_RESIZE);
|
EventHandler__default['default'].off(window, EVENT_RESIZE);
|
||||||
|
@ -514,7 +591,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._hideModal = function _hideModal() {
|
_proto._hideModal = function _hideModal() {
|
||||||
var _this7 = this;
|
var _this8 = this;
|
||||||
|
|
||||||
this._element.style.display = 'none';
|
this._element.style.display = 'none';
|
||||||
|
|
||||||
|
@ -529,11 +606,11 @@
|
||||||
this._showBackdrop(function () {
|
this._showBackdrop(function () {
|
||||||
document.body.classList.remove(CLASS_NAME_OPEN);
|
document.body.classList.remove(CLASS_NAME_OPEN);
|
||||||
|
|
||||||
_this7._resetAdjustments();
|
_this8._resetAdjustments();
|
||||||
|
|
||||||
_this7._resetScrollbar();
|
_this8._resetScrollbar();
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this7._element, EVENT_HIDDEN);
|
EventHandler__default['default'].trigger(_this8._element, EVENT_HIDDEN);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -544,7 +621,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._showBackdrop = function _showBackdrop(callback) {
|
_proto._showBackdrop = function _showBackdrop(callback) {
|
||||||
var _this8 = this;
|
var _this9 = this;
|
||||||
|
|
||||||
var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
|
var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
|
||||||
|
|
||||||
|
@ -558,8 +635,8 @@
|
||||||
|
|
||||||
document.body.appendChild(this._backdrop);
|
document.body.appendChild(this._backdrop);
|
||||||
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
|
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
|
||||||
if (_this8._ignoreBackdropClick) {
|
if (_this9._ignoreBackdropClick) {
|
||||||
_this8._ignoreBackdropClick = false;
|
_this9._ignoreBackdropClick = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +644,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_this8._triggerBackdropTransition();
|
if (_this9._config.backdrop === 'static') {
|
||||||
|
_this9._triggerBackdropTransition();
|
||||||
|
} else {
|
||||||
|
_this9.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
|
@ -588,7 +669,7 @@
|
||||||
this._backdrop.classList.remove(CLASS_NAME_SHOW);
|
this._backdrop.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
var callbackRemove = function callbackRemove() {
|
var callbackRemove = function callbackRemove() {
|
||||||
_this8._removeBackdrop();
|
_this9._removeBackdrop();
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
|
@ -607,44 +688,37 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
|
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
|
||||||
var _this9 = this;
|
var _this10 = this;
|
||||||
|
|
||||||
if (this._config.backdrop === 'static') {
|
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED);
|
||||||
var hideEvent = EventHandler__default['default'].trigger(
|
|
||||||
this._element,
|
|
||||||
EVENT_HIDE_PREVENTED
|
|
||||||
);
|
|
||||||
|
|
||||||
if (hideEvent.defaultPrevented) {
|
if (hideEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
this._element.style.overflowY = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_STATIC);
|
||||||
|
|
||||||
|
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||||
|
EventHandler__default['default'].off(this._element, TRANSITION_END);
|
||||||
|
EventHandler__default['default'].one(this._element, TRANSITION_END, function () {
|
||||||
|
_this10._element.classList.remove(CLASS_NAME_STATIC);
|
||||||
|
|
||||||
if (!isModalOverflowing) {
|
if (!isModalOverflowing) {
|
||||||
this._element.style.overflowY = 'hidden';
|
EventHandler__default['default'].one(_this10._element, TRANSITION_END, function () {
|
||||||
|
_this10._element.style.overflowY = '';
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(_this10._element, modalTransitionDuration);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(this._element, modalTransitionDuration);
|
||||||
|
|
||||||
this._element.classList.add(CLASS_NAME_STATIC);
|
this._element.focus();
|
||||||
|
|
||||||
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
|
|
||||||
EventHandler__default['default'].off(this._element, TRANSITION_END);
|
|
||||||
EventHandler__default['default'].one(this._element, TRANSITION_END, function () {
|
|
||||||
_this9._element.classList.remove(CLASS_NAME_STATIC);
|
|
||||||
|
|
||||||
if (!isModalOverflowing) {
|
|
||||||
EventHandler__default['default'].one(_this9._element, TRANSITION_END, function () {
|
|
||||||
_this9._element.style.overflowY = '';
|
|
||||||
});
|
|
||||||
emulateTransitionEnd(_this9._element, modalTransitionDuration);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
emulateTransitionEnd(this._element, modalTransitionDuration);
|
|
||||||
|
|
||||||
this._element.focus();
|
|
||||||
} else {
|
|
||||||
this.hide();
|
|
||||||
}
|
|
||||||
}; // ----------------------------------------------------------------------
|
}; // ----------------------------------------------------------------------
|
||||||
// the following methods are used to handle overflowing modals
|
// the following methods are used to handle overflowing modals
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -652,11 +726,17 @@
|
||||||
_proto._adjustDialog = function _adjustDialog() {
|
_proto._adjustDialog = function _adjustDialog() {
|
||||||
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
if (!this._isBodyOverflowing && isModalOverflowing) {
|
if (
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && !isRTL) ||
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
this._element.style.paddingLeft = this._scrollbarWidth + 'px';
|
this._element.style.paddingLeft = this._scrollbarWidth + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._isBodyOverflowing && !isModalOverflowing) {
|
if (
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && !isRTL) ||
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
this._element.style.paddingRight = this._scrollbarWidth + 'px';
|
this._element.style.paddingRight = this._scrollbarWidth + 'px';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -673,7 +753,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setScrollbar = function _setScrollbar() {
|
_proto._setScrollbar = function _setScrollbar() {
|
||||||
var _this10 = this;
|
var _this11 = this;
|
||||||
|
|
||||||
if (this._isBodyOverflowing) {
|
if (this._isBodyOverflowing) {
|
||||||
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
||||||
|
@ -684,7 +764,7 @@
|
||||||
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
||||||
Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding);
|
Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding);
|
||||||
element.style.paddingRight =
|
element.style.paddingRight =
|
||||||
parseFloat(calculatedPadding) + _this10._scrollbarWidth + 'px';
|
Number.parseFloat(calculatedPadding) + _this11._scrollbarWidth + 'px';
|
||||||
}); // Adjust sticky content margin
|
}); // Adjust sticky content margin
|
||||||
|
|
||||||
SelectorEngine__default['default']
|
SelectorEngine__default['default']
|
||||||
|
@ -694,7 +774,7 @@
|
||||||
var calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
var calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
||||||
Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin);
|
Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin);
|
||||||
element.style.marginRight =
|
element.style.marginRight =
|
||||||
parseFloat(calculatedMargin) - _this10._scrollbarWidth + 'px';
|
Number.parseFloat(calculatedMargin) - _this11._scrollbarWidth + 'px';
|
||||||
}); // Adjust body padding
|
}); // Adjust body padding
|
||||||
|
|
||||||
var actualPadding = document.body.style.paddingRight;
|
var actualPadding = document.body.style.paddingRight;
|
||||||
|
@ -705,7 +785,7 @@
|
||||||
actualPadding
|
actualPadding
|
||||||
);
|
);
|
||||||
document.body.style.paddingRight =
|
document.body.style.paddingRight =
|
||||||
parseFloat(calculatedPadding) + this._scrollbarWidth + 'px';
|
Number.parseFloat(calculatedPadding) + this._scrollbarWidth + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
document.body.classList.add(CLASS_NAME_OPEN);
|
document.body.classList.add(CLASS_NAME_OPEN);
|
||||||
|
@ -777,33 +857,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config](relatedTarget);
|
data[config](relatedTarget);
|
||||||
} else if (_config.show) {
|
|
||||||
data.show(relatedTarget);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Modal.getInstance = function getInstance(element) {
|
_createClass$1(Modal, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Modal, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Modal;
|
return Modal;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -815,7 +889,7 @@
|
||||||
EVENT_CLICK_DATA_API,
|
EVENT_CLICK_DATA_API,
|
||||||
SELECTOR_DATA_TOGGLE,
|
SELECTOR_DATA_TOGGLE,
|
||||||
function (event) {
|
function (event) {
|
||||||
var _this11 = this;
|
var _this12 = this;
|
||||||
|
|
||||||
var target = getElementFromSelector(this);
|
var target = getElementFromSelector(this);
|
||||||
|
|
||||||
|
@ -830,8 +904,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
|
EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
|
||||||
if (isVisible(_this11)) {
|
if (isVisible(_this12)) {
|
||||||
_this11.focus();
|
_this12.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -850,26 +924,28 @@
|
||||||
data.show(this);
|
data.show(this);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .modal to jQuery only if jQuery is present
|
* add .Modal to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Modal.jQueryInterface;
|
$.fn[NAME] = Modal.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Modal;
|
$.fn[NAME].Constructor = Modal;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Modal.jQueryInterface;
|
return Modal.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Modal;
|
return Modal;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/modal.js.map
vendored
2
src/js/bootstrap/dist/modal.js.map
vendored
File diff suppressed because one or more lines are too long
66
src/js/bootstrap/dist/popover.js
vendored
66
src/js/bootstrap/dist/popover.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap popover.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap popover.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
require('./tooltip.js')
|
require('./tooltip.js')
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./dom/data.js', './dom/selector-engine.js', './tooltip.js'], factory)
|
? define(['./dom/data', './dom/selector-engine', './tooltip'], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip)));
|
(global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip)));
|
||||||
})(this, function (Data, SelectorEngine, Tooltip) {
|
})(this, function (Data, SelectorEngine, Tooltip) {
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -36,13 +36,23 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -88,7 +98,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var NAME = 'popover';
|
var NAME = 'popover';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.popover';
|
var DATA_KEY = 'bs.popover';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var CLASS_PREFIX = 'bs-popover';
|
var CLASS_PREFIX = 'bs-popover';
|
||||||
|
@ -102,7 +111,8 @@
|
||||||
'<div class="popover" role="tooltip">' +
|
'<div class="popover" role="tooltip">' +
|
||||||
'<div class="popover-arrow"></div>' +
|
'<div class="popover-arrow"></div>' +
|
||||||
'<h3 class="popover-header"></h3>' +
|
'<h3 class="popover-header"></h3>' +
|
||||||
'<div class="popover-body"></div></div>',
|
'<div class="popover-body"></div>' +
|
||||||
|
'</div>',
|
||||||
});
|
});
|
||||||
|
|
||||||
var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
|
var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
|
||||||
|
@ -156,7 +166,7 @@
|
||||||
var content = this._getContent();
|
var content = this._getContent();
|
||||||
|
|
||||||
if (typeof content === 'function') {
|
if (typeof content === 'function') {
|
||||||
content = content.call(this.element);
|
content = content.call(this._element);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setElementContent(
|
this.setElementContent(
|
||||||
|
@ -167,11 +177,11 @@
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
||||||
this.getTipElement().classList.add(CLASS_PREFIX + '-' + attachment);
|
this.getTipElement().classList.add(CLASS_PREFIX + '-' + this.updateAttachment(attachment));
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getContent = function _getContent() {
|
_proto._getContent = function _getContent() {
|
||||||
return this.element.getAttribute('data-content') || this.config.content;
|
return this._element.getAttribute('data-bs-content') || this.config.content;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._cleanTipClass = function _cleanTipClass() {
|
_proto._cleanTipClass = function _cleanTipClass() {
|
||||||
|
@ -214,20 +224,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Popover.getInstance = function getInstance(element) {
|
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Popover, null, [
|
_createClass(Popover, null, [
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
// Getters
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
|
// Getters
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
|
@ -266,26 +266,28 @@
|
||||||
|
|
||||||
return Popover;
|
return Popover;
|
||||||
})(Tooltip__default['default']);
|
})(Tooltip__default['default']);
|
||||||
|
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Popover to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Popover.jQueryInterface;
|
$.fn[NAME] = Popover.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Popover;
|
$.fn[NAME].Constructor = Popover;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Popover.jQueryInterface;
|
return Popover.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Popover;
|
return Popover;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/popover.js.map
vendored
2
src/js/bootstrap/dist/popover.js.map
vendored
File diff suppressed because one or more lines are too long
216
src/js/bootstrap/dist/scrollspy.js
vendored
216
src/js/bootstrap/dist/scrollspy.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap scrollspy.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap scrollspy.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -13,10 +13,10 @@
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'./dom/data',
|
||||||
'./dom/event-handler.js',
|
'./dom/event-handler',
|
||||||
'./dom/manipulator.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.ScrollSpy = factory(
|
(global.ScrollSpy = factory(
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -115,29 +115,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -160,8 +153,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'scrollspy';
|
var NAME = 'scrollspy';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.scrollspy';
|
var DATA_KEY = 'bs.scrollspy';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -180,7 +252,7 @@
|
||||||
var EVENT_LOAD_DATA_API = 'load' + EVENT_KEY + DATA_API_KEY;
|
var EVENT_LOAD_DATA_API = 'load' + EVENT_KEY + DATA_API_KEY;
|
||||||
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
||||||
var CLASS_NAME_ACTIVE = 'active';
|
var CLASS_NAME_ACTIVE = 'active';
|
||||||
var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
|
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
||||||
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
var SELECTOR_NAV_LINKS = '.nav-link';
|
var SELECTOR_NAV_LINKS = '.nav-link';
|
||||||
var SELECTOR_NAV_ITEMS = '.nav-item';
|
var SELECTOR_NAV_ITEMS = '.nav-item';
|
||||||
|
@ -195,37 +267,40 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ScrollSpy = /*#__PURE__*/ (function () {
|
var ScrollSpy = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
function ScrollSpy(element, config) {
|
_inheritsLoose(ScrollSpy, _BaseComponent);
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
this._element = element;
|
function ScrollSpy(element, config) {
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
var _this;
|
||||||
this._config = this._getConfig(config);
|
|
||||||
this._selector =
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
this._config.target +
|
_this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
|
_this._config = _this._getConfig(config);
|
||||||
|
_this._selector =
|
||||||
|
_this._config.target +
|
||||||
' ' +
|
' ' +
|
||||||
SELECTOR_NAV_LINKS +
|
SELECTOR_NAV_LINKS +
|
||||||
', ' +
|
', ' +
|
||||||
this._config.target +
|
_this._config.target +
|
||||||
' ' +
|
' ' +
|
||||||
SELECTOR_LIST_ITEMS +
|
SELECTOR_LIST_ITEMS +
|
||||||
', ' +
|
', ' +
|
||||||
this._config.target +
|
_this._config.target +
|
||||||
' .' +
|
' .' +
|
||||||
CLASS_NAME_DROPDOWN_ITEM;
|
CLASS_NAME_DROPDOWN_ITEM;
|
||||||
this._offsets = [];
|
_this._offsets = [];
|
||||||
this._targets = [];
|
_this._targets = [];
|
||||||
this._activeTarget = null;
|
_this._activeTarget = null;
|
||||||
this._scrollHeight = 0;
|
_this._scrollHeight = 0;
|
||||||
EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, function (event) {
|
EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function (event) {
|
||||||
return _this._process(event);
|
return _this._process(event);
|
||||||
});
|
});
|
||||||
this.refresh();
|
|
||||||
|
|
||||||
this._process();
|
_this.refresh();
|
||||||
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
_this._process();
|
||||||
|
|
||||||
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = ScrollSpy.prototype;
|
var _proto = ScrollSpy.prototype;
|
||||||
|
@ -276,9 +351,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
|
|
||||||
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
|
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
|
||||||
this._element = null;
|
|
||||||
this._scrollElement = null;
|
this._scrollElement = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._selector = null;
|
this._selector = null;
|
||||||
|
@ -372,7 +447,9 @@
|
||||||
this._clear();
|
this._clear();
|
||||||
|
|
||||||
var queries = this._selector.split(',').map(function (selector) {
|
var queries = this._selector.split(',').map(function (selector) {
|
||||||
return selector + '[data-target="' + target + '"],' + selector + '[href="' + target + '"]';
|
return (
|
||||||
|
selector + '[data-bs-target="' + target + '"],' + selector + '[href="' + target + '"]'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var link = SelectorEngine__default['default'].findOne(queries.join(','));
|
var link = SelectorEngine__default['default'].findOne(queries.join(','));
|
||||||
|
@ -444,27 +521,23 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ScrollSpy.getInstance = function getInstance(element) {
|
_createClass$1(ScrollSpy, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(ScrollSpy, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return ScrollSpy;
|
return ScrollSpy;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -476,25 +549,28 @@
|
||||||
return new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy));
|
return new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .ScrollSpy to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = ScrollSpy;
|
$.fn[NAME].Constructor = ScrollSpy;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return ScrollSpy.jQueryInterface;
|
return ScrollSpy.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return ScrollSpy;
|
return ScrollSpy;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/scrollspy.js.map
vendored
2
src/js/bootstrap/dist/scrollspy.js.map
vendored
File diff suppressed because one or more lines are too long
151
src/js/bootstrap/dist/tab.js
vendored
151
src/js/bootstrap/dist/tab.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap tab.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap tab.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
require('./dom/selector-engine.js')
|
require('./dom/selector-engine.js')
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./dom/data.js', './dom/event-handler.js', './dom/selector-engine.js'], factory)
|
? define(['./dom/data', './dom/event-handler', './dom/selector-engine'], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine)));
|
(global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine)));
|
||||||
})(this, function (Data, EventHandler, SelectorEngine) {
|
})(this, function (Data, EventHandler, SelectorEngine) {
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
var getSelector = function getSelector(element) {
|
var getSelector = function getSelector(element) {
|
||||||
var selector = element.getAttribute('data-target');
|
var selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
var hrefAttr = element.getAttribute('href');
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -68,7 +68,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -101,13 +104,23 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -129,8 +142,70 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'tab';
|
var NAME = 'tab';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.tab';
|
var DATA_KEY = 'bs.tab';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
|
@ -148,7 +223,8 @@
|
||||||
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
var SELECTOR_ACTIVE = '.active';
|
var SELECTOR_ACTIVE = '.active';
|
||||||
var SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
var SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||||
var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
|
var SELECTOR_DATA_TOGGLE =
|
||||||
|
'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
|
||||||
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||||
var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||||
/**
|
/**
|
||||||
|
@ -157,11 +233,12 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Tab = /*#__PURE__*/ (function () {
|
var Tab = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
function Tab(element) {
|
_inheritsLoose(Tab, _BaseComponent);
|
||||||
this._element = element;
|
|
||||||
Data__default['default'].setData(this._element, DATA_KEY, this);
|
function Tab() {
|
||||||
} // Getters
|
return _BaseComponent.apply(this, arguments) || this;
|
||||||
|
}
|
||||||
|
|
||||||
var _proto = Tab.prototype;
|
var _proto = Tab.prototype;
|
||||||
|
|
||||||
|
@ -224,11 +301,6 @@
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
_proto._activate = function _activate(element, container, callback) {
|
_proto._activate = function _activate(element, container, callback) {
|
||||||
|
@ -317,21 +389,18 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Tab.getInstance = function getInstance(element) {
|
_createClass$1(Tab, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Tab, null, [
|
|
||||||
{
|
{
|
||||||
key: 'VERSION',
|
key: 'DATA_KEY',
|
||||||
|
// Getters
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Tab;
|
return Tab;
|
||||||
})();
|
})(BaseComponent);
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Data Api implementation
|
* Data Api implementation
|
||||||
|
@ -348,26 +417,28 @@
|
||||||
data.show();
|
data.show();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .tab to jQuery only if jQuery is present
|
* add .Tab to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Tab.jQueryInterface;
|
$.fn[NAME] = Tab.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Tab;
|
$.fn[NAME].Constructor = Tab;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tab.jQueryInterface;
|
return Tab.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Tab;
|
return Tab;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/tab.js.map
vendored
2
src/js/bootstrap/dist/tab.js.map
vendored
File diff suppressed because one or more lines are too long
219
src/js/bootstrap/dist/toast.js
vendored
219
src/js/bootstrap/dist/toast.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap toast.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap toast.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
require('./dom/manipulator.js')
|
require('./dom/manipulator.js')
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js'], factory)
|
? define(['./dom/data', './dom/event-handler', './dom/manipulator'], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Toast = factory(global.Data, global.EventHandler, global.Manipulator)));
|
(global.Toast = factory(global.Data, global.EventHandler, global.Manipulator)));
|
||||||
})(this, function (Data, EventHandler, Manipulator) {
|
})(this, function (Data, EventHandler, Manipulator) {
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -54,8 +54,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,7 +63,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -117,29 +120,22 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function _extends() {
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
_extends =
|
if (document.readyState === 'loading') {
|
||||||
Object.assign ||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
function (target) {
|
} else {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
callback();
|
||||||
var source = arguments[i];
|
}
|
||||||
for (var key in source) {
|
};
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -162,8 +158,87 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'toast';
|
var NAME = 'toast';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.toast';
|
var DATA_KEY = 'bs.toast';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var EVENT_CLICK_DISMISS = 'click.dismiss' + EVENT_KEY;
|
var EVENT_CLICK_DISMISS = 'click.dismiss' + EVENT_KEY;
|
||||||
|
@ -185,29 +260,33 @@
|
||||||
autohide: true,
|
autohide: true,
|
||||||
delay: 5000,
|
delay: 5000,
|
||||||
};
|
};
|
||||||
var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]';
|
var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Class Definition
|
* Class Definition
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Toast = /*#__PURE__*/ (function () {
|
var Toast = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Toast, _BaseComponent);
|
||||||
|
|
||||||
function Toast(element, config) {
|
function Toast(element, config) {
|
||||||
this._element = element;
|
var _this;
|
||||||
this._config = this._getConfig(config);
|
|
||||||
this._timeout = null;
|
|
||||||
|
|
||||||
this._setListeners();
|
_this = _BaseComponent.call(this, element) || this;
|
||||||
|
_this._config = _this._getConfig(config);
|
||||||
|
_this._timeout = null;
|
||||||
|
|
||||||
Data__default['default'].setData(element, DATA_KEY, this);
|
_this._setListeners();
|
||||||
|
|
||||||
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Toast.prototype;
|
var _proto = Toast.prototype;
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
||||||
|
|
||||||
|
@ -222,16 +301,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this._element.classList.remove(CLASS_NAME_SHOWING);
|
_this2._element.classList.remove(CLASS_NAME_SHOWING);
|
||||||
|
|
||||||
_this._element.classList.add(CLASS_NAME_SHOW);
|
_this2._element.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN);
|
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
|
||||||
|
|
||||||
if (_this._config.autohide) {
|
if (_this2._config.autohide) {
|
||||||
_this._timeout = setTimeout(function () {
|
_this2._timeout = setTimeout(function () {
|
||||||
_this.hide();
|
_this2.hide();
|
||||||
}, _this._config.delay);
|
}, _this2._config.delay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -251,7 +330,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide() {
|
_proto.hide = function hide() {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
return;
|
return;
|
||||||
|
@ -264,9 +343,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this2._element.classList.add(CLASS_NAME_HIDE);
|
_this3._element.classList.add(CLASS_NAME_HIDE);
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this2._element, EVENT_HIDDEN);
|
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
@ -288,8 +367,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
|
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
|
||||||
Data__default['default'].removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
|
|
||||||
this._config = null;
|
this._config = null;
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
|
@ -305,14 +385,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setListeners = function _setListeners() {
|
_proto._setListeners = function _setListeners() {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
EventHandler__default['default'].on(
|
EventHandler__default['default'].on(
|
||||||
this._element,
|
this._element,
|
||||||
EVENT_CLICK_DISMISS,
|
EVENT_CLICK_DISMISS,
|
||||||
SELECTOR_DATA_DISMISS,
|
SELECTOR_DATA_DISMISS,
|
||||||
function () {
|
function () {
|
||||||
return _this3.hide();
|
return _this4.hide();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -342,17 +422,7 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Toast.getInstance = function getInstance(element) {
|
_createClass$1(Toast, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Toast, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'DefaultType',
|
key: 'DefaultType',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -365,31 +435,38 @@
|
||||||
return Default;
|
return Default;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'DATA_KEY',
|
||||||
|
get: function get() {
|
||||||
|
return DATA_KEY;
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Toast;
|
return Toast;
|
||||||
})();
|
})(BaseComponent);
|
||||||
|
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .toast to jQuery only if jQuery is present
|
* add .Toast to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Toast.jQueryInterface;
|
$.fn[NAME] = Toast.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Toast;
|
$.fn[NAME].Constructor = Toast;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Toast.jQueryInterface;
|
return Toast.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Toast;
|
return Toast;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/toast.js.map
vendored
2
src/js/bootstrap/dist/toast.js.map
vendored
File diff suppressed because one or more lines are too long
494
src/js/bootstrap/dist/tooltip.js
vendored
494
src/js/bootstrap/dist/tooltip.js
vendored
|
@ -1,49 +1,75 @@
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap tooltip.js v5.0.0-alpha2 (https://getbootstrap.com/)
|
* Bootstrap tooltip.js v5.0.0-beta1 (https://getbootstrap.com/)
|
||||||
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined'
|
typeof exports === 'object' && typeof module !== 'undefined'
|
||||||
? (module.exports = factory(
|
? (module.exports = factory(
|
||||||
|
require('@popperjs/core'),
|
||||||
require('./dom/data.js'),
|
require('./dom/data.js'),
|
||||||
require('./dom/event-handler.js'),
|
require('./dom/event-handler.js'),
|
||||||
require('./dom/manipulator.js'),
|
require('./dom/manipulator.js'),
|
||||||
require('popper.js'),
|
|
||||||
require('./dom/selector-engine.js')
|
require('./dom/selector-engine.js')
|
||||||
))
|
))
|
||||||
: typeof define === 'function' && define.amd
|
: typeof define === 'function' && define.amd
|
||||||
? define([
|
? define([
|
||||||
'./dom/data.js',
|
'@popperjs/core',
|
||||||
'./dom/event-handler.js',
|
'./dom/data',
|
||||||
'./dom/manipulator.js',
|
'./dom/event-handler',
|
||||||
'popper.js',
|
'./dom/manipulator',
|
||||||
'./dom/selector-engine.js',
|
'./dom/selector-engine',
|
||||||
], factory)
|
], factory)
|
||||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||||
(global.Tooltip = factory(
|
(global.Tooltip = factory(
|
||||||
|
global.Popper,
|
||||||
global.Data,
|
global.Data,
|
||||||
global.EventHandler,
|
global.EventHandler,
|
||||||
global.Manipulator,
|
global.Manipulator,
|
||||||
global.Popper,
|
|
||||||
global.SelectorEngine
|
global.SelectorEngine
|
||||||
)));
|
)));
|
||||||
})(this, function (Data, EventHandler, Manipulator, Popper, SelectorEngine) {
|
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _interopDefaultLegacy(e) {
|
function _interopDefaultLegacy(e) {
|
||||||
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _interopNamespace(e) {
|
||||||
|
if (e && e.__esModule) return e;
|
||||||
|
var n = Object.create(null);
|
||||||
|
if (e) {
|
||||||
|
Object.keys(e).forEach(function (k) {
|
||||||
|
if (k !== 'default') {
|
||||||
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||||
|
Object.defineProperty(
|
||||||
|
n,
|
||||||
|
k,
|
||||||
|
d.get
|
||||||
|
? d
|
||||||
|
: {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return e[k];
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
n['default'] = e;
|
||||||
|
return Object.freeze(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
var Popper__namespace = /*#__PURE__*/ _interopNamespace(Popper);
|
||||||
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
||||||
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
||||||
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
||||||
var Popper__default = /*#__PURE__*/ _interopDefaultLegacy(Popper);
|
|
||||||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -84,8 +110,8 @@
|
||||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -93,7 +119,10 @@
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
@ -168,20 +197,30 @@
|
||||||
var _window = window,
|
var _window = window,
|
||||||
jQuery = _window.jQuery;
|
jQuery = _window.jQuery;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/sanitizer.js
|
* Bootstrap (v5.0.0-beta1): util/sanitizer.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
var uriAttrs = [
|
var uriAttrs = new Set([
|
||||||
'background',
|
'background',
|
||||||
'cite',
|
'cite',
|
||||||
'href',
|
'href',
|
||||||
|
@ -190,7 +229,7 @@
|
||||||
'poster',
|
'poster',
|
||||||
'src',
|
'src',
|
||||||
'xlink:href',
|
'xlink:href',
|
||||||
];
|
]);
|
||||||
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
||||||
/**
|
/**
|
||||||
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
||||||
|
@ -210,8 +249,8 @@
|
||||||
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
|
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
|
||||||
var attrName = attr.nodeName.toLowerCase();
|
var attrName = attr.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
if (allowedAttributeList.includes(attrName)) {
|
||||||
if (uriAttrs.indexOf(attrName) !== -1) {
|
if (uriAttrs.has(attrName)) {
|
||||||
return Boolean(
|
return Boolean(
|
||||||
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||||
);
|
);
|
||||||
|
@ -289,7 +328,7 @@
|
||||||
var el = elements[i];
|
var el = elements[i];
|
||||||
var elName = el.nodeName.toLowerCase();
|
var elName = el.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (allowlistKeys.indexOf(elName) === -1) {
|
if (!allowlistKeys.includes(elName)) {
|
||||||
el.parentNode.removeChild(el);
|
el.parentNode.removeChild(el);
|
||||||
return 'continue';
|
return 'continue';
|
||||||
}
|
}
|
||||||
|
@ -313,23 +352,6 @@
|
||||||
return createdDocument.body.innerHTML;
|
return createdDocument.body.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _extends() {
|
|
||||||
_extends =
|
|
||||||
Object.assign ||
|
|
||||||
function (target) {
|
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
|
||||||
var source = arguments[i];
|
|
||||||
for (var key in source) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -351,13 +373,92 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
var BaseComponent = /*#__PURE__*/ (function () {
|
||||||
|
function BaseComponent(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _proto = BaseComponent.prototype;
|
||||||
|
|
||||||
|
_proto.dispose = function dispose() {
|
||||||
|
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
};
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
BaseComponent.getInstance = function getInstance(element) {
|
||||||
|
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
|
_createClass(BaseComponent, null, [
|
||||||
|
{
|
||||||
|
key: 'VERSION',
|
||||||
|
get: function get() {
|
||||||
|
return VERSION;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
return BaseComponent;
|
||||||
|
})();
|
||||||
|
|
||||||
|
function _extends() {
|
||||||
|
_extends =
|
||||||
|
Object.assign ||
|
||||||
|
function (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
return _extends.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _defineProperties$1(target, props) {
|
||||||
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
var descriptor = props[i];
|
||||||
|
descriptor.enumerable = descriptor.enumerable || false;
|
||||||
|
descriptor.configurable = true;
|
||||||
|
if ('value' in descriptor) descriptor.writable = true;
|
||||||
|
Object.defineProperty(target, descriptor.key, descriptor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
||||||
|
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
||||||
|
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
||||||
|
return Constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _inheritsLoose(subClass, superClass) {
|
||||||
|
subClass.prototype = Object.create(superClass.prototype);
|
||||||
|
subClass.prototype.constructor = subClass;
|
||||||
|
subClass.__proto__ = superClass;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
var NAME = 'tooltip';
|
var NAME = 'tooltip';
|
||||||
var VERSION = '5.0.0-alpha2';
|
|
||||||
var DATA_KEY = 'bs.tooltip';
|
var DATA_KEY = 'bs.tooltip';
|
||||||
var EVENT_KEY = '.' + DATA_KEY;
|
var EVENT_KEY = '.' + DATA_KEY;
|
||||||
var CLASS_PREFIX = 'bs-tooltip';
|
var CLASS_PREFIX = 'bs-tooltip';
|
||||||
var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
|
var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
|
||||||
var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
|
var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
||||||
var DefaultType = {
|
var DefaultType = {
|
||||||
animation: 'boolean',
|
animation: 'boolean',
|
||||||
template: 'string',
|
template: 'string',
|
||||||
|
@ -367,10 +468,10 @@
|
||||||
html: 'boolean',
|
html: 'boolean',
|
||||||
selector: '(string|boolean)',
|
selector: '(string|boolean)',
|
||||||
placement: '(string|function)',
|
placement: '(string|function)',
|
||||||
offset: '(number|string|function)',
|
|
||||||
container: '(string|element|boolean)',
|
container: '(string|element|boolean)',
|
||||||
fallbackPlacement: '(string|array)',
|
fallbackPlacements: '(null|array)',
|
||||||
boundary: '(string|element)',
|
boundary: '(string|element)',
|
||||||
|
customClass: '(string|function)',
|
||||||
sanitize: 'boolean',
|
sanitize: 'boolean',
|
||||||
sanitizeFn: '(null|function)',
|
sanitizeFn: '(null|function)',
|
||||||
allowList: 'object',
|
allowList: 'object',
|
||||||
|
@ -379,26 +480,27 @@
|
||||||
var AttachmentMap = {
|
var AttachmentMap = {
|
||||||
AUTO: 'auto',
|
AUTO: 'auto',
|
||||||
TOP: 'top',
|
TOP: 'top',
|
||||||
RIGHT: 'right',
|
RIGHT: isRTL ? 'left' : 'right',
|
||||||
BOTTOM: 'bottom',
|
BOTTOM: 'bottom',
|
||||||
LEFT: 'left',
|
LEFT: isRTL ? 'right' : 'left',
|
||||||
};
|
};
|
||||||
var Default = {
|
var Default = {
|
||||||
animation: true,
|
animation: true,
|
||||||
template:
|
template:
|
||||||
'<div class="tooltip" role="tooltip">' +
|
'<div class="tooltip" role="tooltip">' +
|
||||||
'<div class="tooltip-arrow"></div>' +
|
'<div class="tooltip-arrow"></div>' +
|
||||||
'<div class="tooltip-inner"></div></div>',
|
'<div class="tooltip-inner"></div>' +
|
||||||
|
'</div>',
|
||||||
trigger: 'hover focus',
|
trigger: 'hover focus',
|
||||||
title: '',
|
title: '',
|
||||||
delay: 0,
|
delay: 0,
|
||||||
html: false,
|
html: false,
|
||||||
selector: false,
|
selector: false,
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
offset: 0,
|
|
||||||
container: false,
|
container: false,
|
||||||
fallbackPlacement: 'flip',
|
fallbackPlacements: null,
|
||||||
boundary: 'scrollParent',
|
boundary: 'clippingParents',
|
||||||
|
customClass: '',
|
||||||
sanitize: true,
|
sanitize: true,
|
||||||
sanitizeFn: null,
|
sanitizeFn: null,
|
||||||
allowList: DefaultAllowlist,
|
allowList: DefaultAllowlist,
|
||||||
|
@ -432,25 +534,30 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Tooltip = /*#__PURE__*/ (function () {
|
var Tooltip = /*#__PURE__*/ (function (_BaseComponent) {
|
||||||
|
_inheritsLoose(Tooltip, _BaseComponent);
|
||||||
|
|
||||||
function Tooltip(element, config) {
|
function Tooltip(element, config) {
|
||||||
if (typeof Popper__default['default'] === 'undefined') {
|
var _this;
|
||||||
throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org)");
|
|
||||||
} // private
|
|
||||||
|
|
||||||
this._isEnabled = true;
|
if (typeof Popper__namespace === 'undefined') {
|
||||||
this._timeout = 0;
|
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
|
||||||
this._hoverState = '';
|
}
|
||||||
this._activeTrigger = {};
|
|
||||||
this._popper = null; // Protected
|
|
||||||
|
|
||||||
this.element = element;
|
_this = _BaseComponent.call(this, element) || this; // private
|
||||||
this.config = this._getConfig(config);
|
|
||||||
this.tip = null;
|
|
||||||
|
|
||||||
this._setListeners();
|
_this._isEnabled = true;
|
||||||
|
_this._timeout = 0;
|
||||||
|
_this._hoverState = '';
|
||||||
|
_this._activeTrigger = {};
|
||||||
|
_this._popper = null; // Protected
|
||||||
|
|
||||||
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
_this.config = _this._getConfig(config);
|
||||||
|
_this.tip = null;
|
||||||
|
|
||||||
|
_this._setListeners();
|
||||||
|
|
||||||
|
return _this;
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
var _proto = Tooltip.prototype;
|
var _proto = Tooltip.prototype;
|
||||||
|
@ -502,10 +609,9 @@
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
|
EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
|
||||||
EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
|
|
||||||
EventHandler__default['default'].off(
|
EventHandler__default['default'].off(
|
||||||
this.element.closest('.' + CLASS_NAME_MODAL),
|
this._element.closest('.' + CLASS_NAME_MODAL),
|
||||||
'hide.bs.modal',
|
'hide.bs.modal',
|
||||||
this._hideModalHandler
|
this._hideModalHandler
|
||||||
);
|
);
|
||||||
|
@ -524,28 +630,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this._popper = null;
|
this._popper = null;
|
||||||
this.element = null;
|
|
||||||
this.config = null;
|
this.config = null;
|
||||||
this.tip = null;
|
this.tip = null;
|
||||||
|
|
||||||
|
_BaseComponent.prototype.dispose.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this2 = this;
|
||||||
|
|
||||||
if (this.element.style.display === 'none') {
|
if (this._element.style.display === 'none') {
|
||||||
throw new Error('Please use show on visible elements');
|
throw new Error('Please use show on visible elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isWithContent() && this._isEnabled) {
|
if (this.isWithContent() && this._isEnabled) {
|
||||||
var showEvent = EventHandler__default['default'].trigger(
|
var showEvent = EventHandler__default['default'].trigger(
|
||||||
this.element,
|
this._element,
|
||||||
this.constructor.Event.SHOW
|
this.constructor.Event.SHOW
|
||||||
);
|
);
|
||||||
var shadowRoot = findShadowRoot(this.element);
|
var shadowRoot = findShadowRoot(this._element);
|
||||||
var isInTheDom =
|
var isInTheDom =
|
||||||
shadowRoot === null
|
shadowRoot === null
|
||||||
? this.element.ownerDocument.documentElement.contains(this.element)
|
? this._element.ownerDocument.documentElement.contains(this._element)
|
||||||
: shadowRoot.contains(this.element);
|
: shadowRoot.contains(this._element);
|
||||||
|
|
||||||
if (showEvent.defaultPrevented || !isInTheDom) {
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||||
return;
|
return;
|
||||||
|
@ -554,7 +661,9 @@
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var tipId = getUID(this.constructor.NAME);
|
var tipId = getUID(this.constructor.NAME);
|
||||||
tip.setAttribute('id', tipId);
|
tip.setAttribute('id', tipId);
|
||||||
this.element.setAttribute('aria-describedby', tipId);
|
|
||||||
|
this._element.setAttribute('aria-describedby', tipId);
|
||||||
|
|
||||||
this.setContent();
|
this.setContent();
|
||||||
|
|
||||||
if (this.config.animation) {
|
if (this.config.animation) {
|
||||||
|
@ -563,7 +672,7 @@
|
||||||
|
|
||||||
var placement =
|
var placement =
|
||||||
typeof this.config.placement === 'function'
|
typeof this.config.placement === 'function'
|
||||||
? this.config.placement.call(this, tip, this.element)
|
? this.config.placement.call(this, tip, this._element)
|
||||||
: this.config.placement;
|
: this.config.placement;
|
||||||
|
|
||||||
var attachment = this._getAttachment(placement);
|
var attachment = this._getAttachment(placement);
|
||||||
|
@ -574,17 +683,23 @@
|
||||||
|
|
||||||
Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
|
Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
|
||||||
|
|
||||||
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
||||||
container.appendChild(tip);
|
container.appendChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
|
EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
|
||||||
this._popper = new Popper__default['default'](
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||||
this.element,
|
tip.classList.add(CLASS_NAME_SHOW);
|
||||||
tip,
|
var customClass =
|
||||||
this._getPopperConfig(attachment)
|
typeof this.config.customClass === 'function'
|
||||||
);
|
? this.config.customClass()
|
||||||
tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
|
: this.config.customClass;
|
||||||
|
|
||||||
|
if (customClass) {
|
||||||
|
var _tip$classList;
|
||||||
|
|
||||||
|
(_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
|
||||||
|
} // If this is a touch-enabled device we add extra
|
||||||
// empty mouseover listeners to the body's immediate children;
|
// empty mouseover listeners to the body's immediate children;
|
||||||
// only needed because of broken event delegation on iOS
|
// only needed because of broken event delegation on iOS
|
||||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||||
|
@ -598,16 +713,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this.config.animation) {
|
var prevHoverState = _this2._hoverState;
|
||||||
_this._fixTransition();
|
_this2._hoverState = null;
|
||||||
}
|
EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
|
||||||
|
|
||||||
var prevHoverState = _this._hoverState;
|
|
||||||
_this._hoverState = null;
|
|
||||||
EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
|
|
||||||
|
|
||||||
if (prevHoverState === HOVER_STATE_OUT) {
|
if (prevHoverState === HOVER_STATE_OUT) {
|
||||||
_this._leave(null, _this);
|
_this2._leave(null, _this2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -622,7 +733,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide() {
|
_proto.hide = function hide() {
|
||||||
var _this2 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
if (!this._popper) {
|
if (!this._popper) {
|
||||||
return;
|
return;
|
||||||
|
@ -631,21 +742,25 @@
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
if (_this3._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||||
tip.parentNode.removeChild(tip);
|
tip.parentNode.removeChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
_this2._cleanTipClass();
|
_this3._cleanTipClass();
|
||||||
|
|
||||||
_this2.element.removeAttribute('aria-describedby');
|
_this3._element.removeAttribute('aria-describedby');
|
||||||
|
|
||||||
EventHandler__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
|
EventHandler__default['default'].trigger(_this3._element, _this3.constructor.Event.HIDDEN);
|
||||||
|
|
||||||
_this2._popper.destroy();
|
if (_this3._popper) {
|
||||||
|
_this3._popper.destroy();
|
||||||
|
|
||||||
|
_this3._popper = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var hideEvent = EventHandler__default['default'].trigger(
|
var hideEvent = EventHandler__default['default'].trigger(
|
||||||
this.element,
|
this._element,
|
||||||
this.constructor.Event.HIDE
|
this.constructor.Event.HIDE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -681,7 +796,7 @@
|
||||||
|
|
||||||
_proto.update = function update() {
|
_proto.update = function update() {
|
||||||
if (this._popper !== null) {
|
if (this._popper !== null) {
|
||||||
this._popper.scheduleUpdate();
|
this._popper.update();
|
||||||
}
|
}
|
||||||
}; // Protected
|
}; // Protected
|
||||||
|
|
||||||
|
@ -743,70 +858,80 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.getTitle = function getTitle() {
|
_proto.getTitle = function getTitle() {
|
||||||
var title = this.element.getAttribute('data-original-title');
|
var title = this._element.getAttribute('data-bs-original-title');
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
title =
|
title =
|
||||||
typeof this.config.title === 'function'
|
typeof this.config.title === 'function'
|
||||||
? this.config.title.call(this.element)
|
? this.config.title.call(this._element)
|
||||||
: this.config.title;
|
: this.config.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
return title;
|
return title;
|
||||||
|
};
|
||||||
|
|
||||||
|
_proto.updateAttachment = function updateAttachment(attachment) {
|
||||||
|
if (attachment === 'right') {
|
||||||
|
return 'end';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attachment === 'left') {
|
||||||
|
return 'start';
|
||||||
|
}
|
||||||
|
|
||||||
|
return attachment;
|
||||||
}; // Private
|
}; // Private
|
||||||
|
|
||||||
_proto._getPopperConfig = function _getPopperConfig(attachment) {
|
_proto._getPopperConfig = function _getPopperConfig(attachment) {
|
||||||
var _this3 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
|
var flipModifier = {
|
||||||
|
name: 'flip',
|
||||||
|
options: {
|
||||||
|
altBoundary: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.config.fallbackPlacements) {
|
||||||
|
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
|
||||||
|
}
|
||||||
|
|
||||||
var defaultBsConfig = {
|
var defaultBsConfig = {
|
||||||
placement: attachment,
|
placement: attachment,
|
||||||
modifiers: {
|
modifiers: [
|
||||||
offset: this._getOffset(),
|
flipModifier,
|
||||||
flip: {
|
{
|
||||||
behavior: this.config.fallbackPlacement,
|
name: 'preventOverflow',
|
||||||
|
options: {
|
||||||
|
rootBoundary: this.config.boundary,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
arrow: {
|
{
|
||||||
element: '.' + this.constructor.NAME + '-arrow',
|
name: 'arrow',
|
||||||
|
options: {
|
||||||
|
element: '.' + this.constructor.NAME + '-arrow',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
preventOverflow: {
|
{
|
||||||
boundariesElement: this.config.boundary,
|
name: 'onChange',
|
||||||
|
enabled: true,
|
||||||
|
phase: 'afterWrite',
|
||||||
|
fn: function fn(data) {
|
||||||
|
return _this4._handlePopperPlacementChange(data);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
onCreate: function onCreate(data) {
|
onFirstUpdate: function onFirstUpdate(data) {
|
||||||
if (data.originalPlacement !== data.placement) {
|
if (data.options.placement !== data.placement) {
|
||||||
_this3._handlePopperPlacementChange(data);
|
_this4._handlePopperPlacementChange(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate: function onUpdate(data) {
|
|
||||||
return _this3._handlePopperPlacementChange(data);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
return _extends({}, defaultBsConfig, this.config.popperConfig);
|
return _extends({}, defaultBsConfig, this.config.popperConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
||||||
this.getTipElement().classList.add(CLASS_PREFIX + '-' + attachment);
|
this.getTipElement().classList.add(CLASS_PREFIX + '-' + this.updateAttachment(attachment));
|
||||||
};
|
|
||||||
|
|
||||||
_proto._getOffset = function _getOffset() {
|
|
||||||
var _this4 = this;
|
|
||||||
|
|
||||||
var offset = {};
|
|
||||||
|
|
||||||
if (typeof this.config.offset === 'function') {
|
|
||||||
offset.fn = function (data) {
|
|
||||||
data.offsets = _extends(
|
|
||||||
{},
|
|
||||||
data.offsets,
|
|
||||||
_this4.config.offset(data.offsets, _this4.element) || {}
|
|
||||||
);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
offset.offset = this.config.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getContainer = function _getContainer() {
|
_proto._getContainer = function _getContainer() {
|
||||||
|
@ -832,7 +957,7 @@
|
||||||
triggers.forEach(function (trigger) {
|
triggers.forEach(function (trigger) {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
EventHandler__default['default'].on(
|
EventHandler__default['default'].on(
|
||||||
_this5.element,
|
_this5._element,
|
||||||
_this5.constructor.Event.CLICK,
|
_this5.constructor.Event.CLICK,
|
||||||
_this5.config.selector,
|
_this5.config.selector,
|
||||||
function (event) {
|
function (event) {
|
||||||
|
@ -849,7 +974,7 @@
|
||||||
? _this5.constructor.Event.MOUSELEAVE
|
? _this5.constructor.Event.MOUSELEAVE
|
||||||
: _this5.constructor.Event.FOCUSOUT;
|
: _this5.constructor.Event.FOCUSOUT;
|
||||||
EventHandler__default['default'].on(
|
EventHandler__default['default'].on(
|
||||||
_this5.element,
|
_this5._element,
|
||||||
eventIn,
|
eventIn,
|
||||||
_this5.config.selector,
|
_this5.config.selector,
|
||||||
function (event) {
|
function (event) {
|
||||||
|
@ -857,7 +982,7 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
EventHandler__default['default'].on(
|
EventHandler__default['default'].on(
|
||||||
_this5.element,
|
_this5._element,
|
||||||
eventOut,
|
eventOut,
|
||||||
_this5.config.selector,
|
_this5.config.selector,
|
||||||
function (event) {
|
function (event) {
|
||||||
|
@ -868,13 +993,13 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this._hideModalHandler = function () {
|
this._hideModalHandler = function () {
|
||||||
if (_this5.element) {
|
if (_this5._element) {
|
||||||
_this5.hide();
|
_this5.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EventHandler__default['default'].on(
|
EventHandler__default['default'].on(
|
||||||
this.element.closest('.' + CLASS_NAME_MODAL),
|
this._element.closest('.' + CLASS_NAME_MODAL),
|
||||||
'hide.bs.modal',
|
'hide.bs.modal',
|
||||||
this._hideModalHandler
|
this._hideModalHandler
|
||||||
);
|
);
|
||||||
|
@ -890,11 +1015,18 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._fixTitle = function _fixTitle() {
|
_proto._fixTitle = function _fixTitle() {
|
||||||
var titleType = typeof this.element.getAttribute('data-original-title');
|
var title = this._element.getAttribute('title');
|
||||||
|
|
||||||
if (this.element.getAttribute('title') || titleType !== 'string') {
|
var originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
|
||||||
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
|
||||||
this.element.setAttribute('title', '');
|
if (title || originalTitleType !== 'string') {
|
||||||
|
this._element.setAttribute('data-bs-original-title', title || '');
|
||||||
|
|
||||||
|
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||||
|
this._element.setAttribute('aria-label', title);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.setAttribute('title', '');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -977,9 +1109,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
|
var dataAttributes = Manipulator__default['default'].getDataAttributes(this._element);
|
||||||
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
||||||
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
|
||||||
delete dataAttributes[dataAttr];
|
delete dataAttributes[dataAttr];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1049,26 +1181,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
|
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
|
||||||
this.tip = popperData.instance.popper;
|
var state = popperData.state;
|
||||||
|
|
||||||
this._cleanTipClass();
|
if (!state) {
|
||||||
|
|
||||||
this._addAttachmentClass(this._getAttachment(popperData.placement));
|
|
||||||
};
|
|
||||||
|
|
||||||
_proto._fixTransition = function _fixTransition() {
|
|
||||||
var tip = this.getTipElement();
|
|
||||||
var initConfigAnimation = this.config.animation;
|
|
||||||
|
|
||||||
if (tip.getAttribute('x-placement') !== null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tip.classList.remove(CLASS_NAME_FADE);
|
this.tip = state.elements.popper;
|
||||||
this.config.animation = false;
|
|
||||||
this.hide();
|
this._cleanTipClass();
|
||||||
this.show();
|
|
||||||
this.config.animation = initConfigAnimation;
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
||||||
}; // Static
|
}; // Static
|
||||||
|
|
||||||
Tooltip.jQueryInterface = function jQueryInterface(config) {
|
Tooltip.jQueryInterface = function jQueryInterface(config) {
|
||||||
|
@ -1095,17 +1218,7 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Tooltip.getInstance = function getInstance(element) {
|
_createClass$1(Tooltip, null, [
|
||||||
return Data__default['default'].getData(element, DATA_KEY);
|
|
||||||
};
|
|
||||||
|
|
||||||
_createClass(Tooltip, null, [
|
|
||||||
{
|
|
||||||
key: 'VERSION',
|
|
||||||
get: function get() {
|
|
||||||
return VERSION;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'Default',
|
key: 'Default',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -1145,28 +1258,29 @@
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return Tooltip;
|
return Tooltip;
|
||||||
})();
|
})(BaseComponent);
|
||||||
|
|
||||||
var $ = getjQuery();
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .tooltip to jQuery only if jQuery is present
|
* add .Tooltip to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(function () {
|
||||||
|
var $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Tooltip.jQueryInterface;
|
$.fn[NAME] = Tooltip.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Tooltip;
|
$.fn[NAME].Constructor = Tooltip;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tooltip.jQueryInterface;
|
return Tooltip.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return Tooltip;
|
return Tooltip;
|
||||||
});
|
});
|
||||||
|
|
2
src/js/bootstrap/dist/tooltip.js.map
vendored
2
src/js/bootstrap/dist/tooltip.js.map
vendored
File diff suppressed because one or more lines are too long
154
src/js/bootstrap/mdb-prefix/alert.js
Normal file
154
src/js/bootstrap/mdb-prefix/alert.js
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): alert.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'alert';
|
||||||
|
const DATA_KEY = 'bs.alert';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const SELECTOR_DISMISS = '[data-mdb-dismiss="alert"]';
|
||||||
|
|
||||||
|
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
||||||
|
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASSNAME_ALERT = 'alert';
|
||||||
|
const CLASSNAME_FADE = 'fade';
|
||||||
|
const CLASSNAME_SHOW = 'show';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Alert extends BaseComponent {
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
close(element) {
|
||||||
|
const rootElement = element ? this._getRootElement(element) : this._element;
|
||||||
|
const customEvent = this._triggerCloseEvent(rootElement);
|
||||||
|
|
||||||
|
if (customEvent === null || customEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._removeElement(rootElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getRootElement(element) {
|
||||||
|
return getElementFromSelector(element) || element.closest(`.${CLASSNAME_ALERT}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
_triggerCloseEvent(element) {
|
||||||
|
return EventHandler.trigger(element, EVENT_CLOSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
_removeElement(element) {
|
||||||
|
element.classList.remove(CLASSNAME_SHOW);
|
||||||
|
|
||||||
|
if (!element.classList.contains(CLASSNAME_FADE)) {
|
||||||
|
this._destroyElement(element);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(element);
|
||||||
|
|
||||||
|
EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element));
|
||||||
|
emulateTransitionEnd(element, transitionDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
_destroyElement(element) {
|
||||||
|
if (element.parentNode) {
|
||||||
|
element.parentNode.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.trigger(element, EVENT_CLOSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Alert(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config === 'close') {
|
||||||
|
data[config](this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static handleDismiss(alertInstance) {
|
||||||
|
return function (event) {
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
alertInstance.close(this);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Alert to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Alert.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Alert;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Alert.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Alert;
|
44
src/js/bootstrap/mdb-prefix/base-component.js
Normal file
44
src/js/bootstrap/mdb-prefix/base-component.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): base-component.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Data from './dom/data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
class BaseComponent {
|
||||||
|
constructor(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data.setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
Data.removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
static getInstance(element) {
|
||||||
|
return Data.getData(element, this.DATA_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
static get VERSION() {
|
||||||
|
return VERSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BaseComponent;
|
108
src/js/bootstrap/mdb-prefix/button.js
Normal file
108
src/js/bootstrap/mdb-prefix/button.js
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): button.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { getjQuery, onDOMContentLoaded } from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'button';
|
||||||
|
const DATA_KEY = 'bs.button';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
|
||||||
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="button"]';
|
||||||
|
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Button extends BaseComponent {
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
|
||||||
|
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Button(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config === 'toggle') {
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
||||||
|
|
||||||
|
let data = Data.getData(button, DATA_KEY);
|
||||||
|
if (!data) {
|
||||||
|
data = new Button(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Button to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Button.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Button;
|
||||||
|
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Button.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Button;
|
632
src/js/bootstrap/mdb-prefix/carousel.js
Normal file
632
src/js/bootstrap/mdb-prefix/carousel.js
Normal file
|
@ -0,0 +1,632 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): carousel.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
isVisible,
|
||||||
|
reflow,
|
||||||
|
triggerTransitionEnd,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'carousel';
|
||||||
|
const DATA_KEY = 'bs.carousel';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const ARROW_LEFT_KEY = 'ArrowLeft';
|
||||||
|
const ARROW_RIGHT_KEY = 'ArrowRight';
|
||||||
|
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
||||||
|
const SWIPE_THRESHOLD = 40;
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
interval: 5000,
|
||||||
|
keyboard: true,
|
||||||
|
slide: false,
|
||||||
|
pause: 'hover',
|
||||||
|
wrap: true,
|
||||||
|
touch: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
interval: '(number|boolean)',
|
||||||
|
keyboard: 'boolean',
|
||||||
|
slide: '(boolean|string)',
|
||||||
|
pause: '(string|boolean)',
|
||||||
|
wrap: 'boolean',
|
||||||
|
touch: 'boolean',
|
||||||
|
};
|
||||||
|
|
||||||
|
const DIRECTION_NEXT = 'next';
|
||||||
|
const DIRECTION_PREV = 'prev';
|
||||||
|
const DIRECTION_LEFT = 'left';
|
||||||
|
const DIRECTION_RIGHT = 'right';
|
||||||
|
|
||||||
|
const EVENT_SLIDE = `slide${EVENT_KEY}`;
|
||||||
|
const EVENT_SLID = `slid${EVENT_KEY}`;
|
||||||
|
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
|
||||||
|
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`;
|
||||||
|
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`;
|
||||||
|
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`;
|
||||||
|
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`;
|
||||||
|
const EVENT_TOUCHEND = `touchend${EVENT_KEY}`;
|
||||||
|
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`;
|
||||||
|
const EVENT_POINTERUP = `pointerup${EVENT_KEY}`;
|
||||||
|
const EVENT_DRAG_START = `dragstart${EVENT_KEY}`;
|
||||||
|
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_CAROUSEL = 'carousel';
|
||||||
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
const CLASS_NAME_SLIDE = 'slide';
|
||||||
|
const CLASS_NAME_END = 'carousel-item-end';
|
||||||
|
const CLASS_NAME_START = 'carousel-item-start';
|
||||||
|
const CLASS_NAME_NEXT = 'carousel-item-next';
|
||||||
|
const CLASS_NAME_PREV = 'carousel-item-prev';
|
||||||
|
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
||||||
|
|
||||||
|
const SELECTOR_ACTIVE = '.active';
|
||||||
|
const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
|
||||||
|
const SELECTOR_ITEM = '.carousel-item';
|
||||||
|
const SELECTOR_ITEM_IMG = '.carousel-item img';
|
||||||
|
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
||||||
|
const SELECTOR_INDICATORS = '.carousel-indicators';
|
||||||
|
const SELECTOR_DATA_SLIDE = '[data-mdb-slide], [data-mdb-slide-to]';
|
||||||
|
const SELECTOR_DATA_RIDE = '[data-mdb-ride="carousel"]';
|
||||||
|
|
||||||
|
const PointerType = {
|
||||||
|
TOUCH: 'touch',
|
||||||
|
PEN: 'pen',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
class Carousel extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
this._items = null;
|
||||||
|
this._interval = null;
|
||||||
|
this._activeElement = null;
|
||||||
|
this._isPaused = false;
|
||||||
|
this._isSliding = false;
|
||||||
|
this.touchTimeout = null;
|
||||||
|
this.touchStartX = 0;
|
||||||
|
this.touchDeltaX = 0;
|
||||||
|
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
|
||||||
|
this._touchSupported =
|
||||||
|
'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
||||||
|
this._pointerEvent = Boolean(window.PointerEvent);
|
||||||
|
|
||||||
|
this._addEventListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
next() {
|
||||||
|
if (!this._isSliding) {
|
||||||
|
this._slide(DIRECTION_NEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nextWhenVisible() {
|
||||||
|
// Don't call next when the page isn't visible
|
||||||
|
// or the carousel or its parent isn't visible
|
||||||
|
if (!document.hidden && isVisible(this._element)) {
|
||||||
|
this.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prev() {
|
||||||
|
if (!this._isSliding) {
|
||||||
|
this._slide(DIRECTION_PREV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pause(event) {
|
||||||
|
if (!event) {
|
||||||
|
this._isPaused = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
|
||||||
|
triggerTransitionEnd(this._element);
|
||||||
|
this.cycle(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearInterval(this._interval);
|
||||||
|
this._interval = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
cycle(event) {
|
||||||
|
if (!event) {
|
||||||
|
this._isPaused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._interval) {
|
||||||
|
clearInterval(this._interval);
|
||||||
|
this._interval = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._config && this._config.interval && !this._isPaused) {
|
||||||
|
this._updateInterval();
|
||||||
|
|
||||||
|
this._interval = setInterval(
|
||||||
|
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
|
||||||
|
this._config.interval
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to(index) {
|
||||||
|
this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
|
const activeIndex = this._getItemIndex(this._activeElement);
|
||||||
|
|
||||||
|
if (index > this._items.length - 1 || index < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._isSliding) {
|
||||||
|
EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeIndex === index) {
|
||||||
|
this.pause();
|
||||||
|
this.cycle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
|
||||||
|
|
||||||
|
this._slide(direction, this._items[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
|
|
||||||
|
this._items = null;
|
||||||
|
this._config = null;
|
||||||
|
this._interval = null;
|
||||||
|
this._isPaused = null;
|
||||||
|
this._isSliding = null;
|
||||||
|
this._activeElement = null;
|
||||||
|
this._indicatorsElement = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...Default,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleSwipe() {
|
||||||
|
const absDeltax = Math.abs(this.touchDeltaX);
|
||||||
|
|
||||||
|
if (absDeltax <= SWIPE_THRESHOLD) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const direction = absDeltax / this.touchDeltaX;
|
||||||
|
|
||||||
|
this.touchDeltaX = 0;
|
||||||
|
|
||||||
|
// swipe left
|
||||||
|
if (direction > 0) {
|
||||||
|
this.prev();
|
||||||
|
}
|
||||||
|
|
||||||
|
// swipe right
|
||||||
|
if (direction < 0) {
|
||||||
|
this.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_addEventListeners() {
|
||||||
|
if (this._config.keyboard) {
|
||||||
|
EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._config.pause === 'hover') {
|
||||||
|
EventHandler.on(this._element, EVENT_MOUSEENTER, (event) => this.pause(event));
|
||||||
|
EventHandler.on(this._element, EVENT_MOUSELEAVE, (event) => this.cycle(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._config.touch && this._touchSupported) {
|
||||||
|
this._addTouchEventListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_addTouchEventListeners() {
|
||||||
|
const start = (event) => {
|
||||||
|
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
|
this.touchStartX = event.clientX;
|
||||||
|
} else if (!this._pointerEvent) {
|
||||||
|
this.touchStartX = event.touches[0].clientX;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const move = (event) => {
|
||||||
|
// ensure swiping with one touch and not pinching
|
||||||
|
if (event.touches && event.touches.length > 1) {
|
||||||
|
this.touchDeltaX = 0;
|
||||||
|
} else {
|
||||||
|
this.touchDeltaX = event.touches[0].clientX - this.touchStartX;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const end = (event) => {
|
||||||
|
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
|
this.touchDeltaX = event.clientX - this.touchStartX;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._handleSwipe();
|
||||||
|
if (this._config.pause === 'hover') {
|
||||||
|
// If it's a touch-enabled device, mouseenter/leave are fired as
|
||||||
|
// part of the mouse compatibility events on first tap - the carousel
|
||||||
|
// would stop cycling until user tapped out of it;
|
||||||
|
// here, we listen for touchend, explicitly pause the carousel
|
||||||
|
// (as if it's the second time we tap on it, mouseenter compat event
|
||||||
|
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
||||||
|
// events to fire) we explicitly restart cycling
|
||||||
|
|
||||||
|
this.pause();
|
||||||
|
if (this.touchTimeout) {
|
||||||
|
clearTimeout(this.touchTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.touchTimeout = setTimeout(
|
||||||
|
(event) => this.cycle(event),
|
||||||
|
TOUCHEVENT_COMPAT_WAIT + this._config.interval
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach((itemImg) => {
|
||||||
|
EventHandler.on(itemImg, EVENT_DRAG_START, (e) => e.preventDefault());
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this._pointerEvent) {
|
||||||
|
EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => start(event));
|
||||||
|
EventHandler.on(this._element, EVENT_POINTERUP, (event) => end(event));
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
|
||||||
|
} else {
|
||||||
|
EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => start(event));
|
||||||
|
EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => move(event));
|
||||||
|
EventHandler.on(this._element, EVENT_TOUCHEND, (event) => end(event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_keydown(event) {
|
||||||
|
if (/input|textarea/i.test(event.target.tagName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event.key) {
|
||||||
|
case ARROW_LEFT_KEY:
|
||||||
|
event.preventDefault();
|
||||||
|
this.prev();
|
||||||
|
break;
|
||||||
|
case ARROW_RIGHT_KEY:
|
||||||
|
event.preventDefault();
|
||||||
|
this.next();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_getItemIndex(element) {
|
||||||
|
this._items =
|
||||||
|
element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
|
||||||
|
|
||||||
|
return this._items.indexOf(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getItemByDirection(direction, activeElement) {
|
||||||
|
const isNextDirection = direction === DIRECTION_NEXT;
|
||||||
|
const isPrevDirection = direction === DIRECTION_PREV;
|
||||||
|
const activeIndex = this._getItemIndex(activeElement);
|
||||||
|
const lastItemIndex = this._items.length - 1;
|
||||||
|
const isGoingToWrap =
|
||||||
|
(isPrevDirection && activeIndex === 0) || (isNextDirection && activeIndex === lastItemIndex);
|
||||||
|
|
||||||
|
if (isGoingToWrap && !this._config.wrap) {
|
||||||
|
return activeElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
const delta = direction === DIRECTION_PREV ? -1 : 1;
|
||||||
|
const itemIndex = (activeIndex + delta) % this._items.length;
|
||||||
|
|
||||||
|
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
_triggerSlideEvent(relatedTarget, eventDirectionName) {
|
||||||
|
const targetIndex = this._getItemIndex(relatedTarget);
|
||||||
|
const fromIndex = this._getItemIndex(
|
||||||
|
SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)
|
||||||
|
);
|
||||||
|
|
||||||
|
return EventHandler.trigger(this._element, EVENT_SLIDE, {
|
||||||
|
relatedTarget,
|
||||||
|
direction: eventDirectionName,
|
||||||
|
from: fromIndex,
|
||||||
|
to: targetIndex,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_setActiveIndicatorElement(element) {
|
||||||
|
if (this._indicatorsElement) {
|
||||||
|
const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
|
||||||
|
|
||||||
|
for (let i = 0; i < indicators.length; i++) {
|
||||||
|
indicators[i].classList.remove(CLASS_NAME_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
||||||
|
|
||||||
|
if (nextIndicator) {
|
||||||
|
nextIndicator.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateInterval() {
|
||||||
|
const element =
|
||||||
|
this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
|
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const elementInterval = Number.parseInt(element.getAttribute('data-mdb-interval'), 10);
|
||||||
|
|
||||||
|
if (elementInterval) {
|
||||||
|
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
||||||
|
this._config.interval = elementInterval;
|
||||||
|
} else {
|
||||||
|
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_slide(direction, element) {
|
||||||
|
const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
|
const activeElementIndex = this._getItemIndex(activeElement);
|
||||||
|
const nextElement =
|
||||||
|
element || (activeElement && this._getItemByDirection(direction, activeElement));
|
||||||
|
|
||||||
|
const nextElementIndex = this._getItemIndex(nextElement);
|
||||||
|
const isCycling = Boolean(this._interval);
|
||||||
|
|
||||||
|
let directionalClassName;
|
||||||
|
let orderClassName;
|
||||||
|
let eventDirectionName;
|
||||||
|
|
||||||
|
if (direction === DIRECTION_NEXT) {
|
||||||
|
directionalClassName = CLASS_NAME_START;
|
||||||
|
orderClassName = CLASS_NAME_NEXT;
|
||||||
|
eventDirectionName = DIRECTION_LEFT;
|
||||||
|
} else {
|
||||||
|
directionalClassName = CLASS_NAME_END;
|
||||||
|
orderClassName = CLASS_NAME_PREV;
|
||||||
|
eventDirectionName = DIRECTION_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
||||||
|
this._isSliding = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
||||||
|
if (slideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!activeElement || !nextElement) {
|
||||||
|
// Some weirdness is happening, so we bail
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isSliding = true;
|
||||||
|
|
||||||
|
if (isCycling) {
|
||||||
|
this.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._setActiveIndicatorElement(nextElement);
|
||||||
|
this._activeElement = nextElement;
|
||||||
|
|
||||||
|
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
||||||
|
nextElement.classList.add(orderClassName);
|
||||||
|
|
||||||
|
reflow(nextElement);
|
||||||
|
|
||||||
|
activeElement.classList.add(directionalClassName);
|
||||||
|
nextElement.classList.add(directionalClassName);
|
||||||
|
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(activeElement);
|
||||||
|
|
||||||
|
EventHandler.one(activeElement, TRANSITION_END, () => {
|
||||||
|
nextElement.classList.remove(directionalClassName, orderClassName);
|
||||||
|
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
|
||||||
|
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
||||||
|
|
||||||
|
this._isSliding = false;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
EventHandler.trigger(this._element, EVENT_SLID, {
|
||||||
|
relatedTarget: nextElement,
|
||||||
|
direction: eventDirectionName,
|
||||||
|
from: activeElementIndex,
|
||||||
|
to: nextElementIndex,
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
emulateTransitionEnd(activeElement, transitionDuration);
|
||||||
|
} else {
|
||||||
|
activeElement.classList.remove(CLASS_NAME_ACTIVE);
|
||||||
|
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
|
||||||
|
this._isSliding = false;
|
||||||
|
EventHandler.trigger(this._element, EVENT_SLID, {
|
||||||
|
relatedTarget: nextElement,
|
||||||
|
direction: eventDirectionName,
|
||||||
|
from: activeElementIndex,
|
||||||
|
to: nextElementIndex,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCycling) {
|
||||||
|
this.cycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static carouselInterface(element, config) {
|
||||||
|
let data = Data.getData(element, DATA_KEY);
|
||||||
|
let _config = {
|
||||||
|
...Default,
|
||||||
|
...Manipulator.getDataAttributes(element),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof config === 'object') {
|
||||||
|
_config = {
|
||||||
|
..._config,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = typeof config === 'string' ? config : _config.slide;
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Carousel(element, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'number') {
|
||||||
|
data.to(config);
|
||||||
|
} else if (typeof action === 'string') {
|
||||||
|
if (typeof data[action] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${action}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[action]();
|
||||||
|
} else if (_config.interval && _config.ride) {
|
||||||
|
data.pause();
|
||||||
|
data.cycle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Carousel.carouselInterface(this, config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static dataApiClickHandler(event) {
|
||||||
|
const target = getElementFromSelector(this);
|
||||||
|
|
||||||
|
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
...Manipulator.getDataAttributes(target),
|
||||||
|
...Manipulator.getDataAttributes(this),
|
||||||
|
};
|
||||||
|
const slideIndex = this.getAttribute('data-mdb-slide-to');
|
||||||
|
|
||||||
|
if (slideIndex) {
|
||||||
|
config.interval = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Carousel.carouselInterface(target, config);
|
||||||
|
|
||||||
|
if (slideIndex) {
|
||||||
|
Data.getData(target, DATA_KEY).to(slideIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
|
||||||
|
|
||||||
|
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||||
|
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
||||||
|
|
||||||
|
for (let i = 0, len = carousels.length; i < len; i++) {
|
||||||
|
Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Carousel to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Carousel.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Carousel;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Carousel.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Carousel;
|
420
src/js/bootstrap/mdb-prefix/collapse.js
Normal file
420
src/js/bootstrap/mdb-prefix/collapse.js
Normal file
|
@ -0,0 +1,420 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): collapse.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getSelectorFromElement,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
isElement,
|
||||||
|
reflow,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'collapse';
|
||||||
|
const DATA_KEY = 'bs.collapse';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
toggle: true,
|
||||||
|
parent: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
toggle: 'boolean',
|
||||||
|
parent: '(string|element)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
const CLASS_NAME_COLLAPSE = 'collapse';
|
||||||
|
const CLASS_NAME_COLLAPSING = 'collapsing';
|
||||||
|
const CLASS_NAME_COLLAPSED = 'collapsed';
|
||||||
|
|
||||||
|
const WIDTH = 'width';
|
||||||
|
const HEIGHT = 'height';
|
||||||
|
|
||||||
|
const SELECTOR_ACTIVES = '.show, .collapsing';
|
||||||
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="collapse"]';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Collapse extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
this._isTransitioning = false;
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._triggerArray = SelectorEngine.find(
|
||||||
|
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
|
||||||
|
`${SELECTOR_DATA_TOGGLE}[data-mdb-target="#${element.id}"]`
|
||||||
|
);
|
||||||
|
|
||||||
|
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||||
|
|
||||||
|
for (let i = 0, len = toggleList.length; i < len; i++) {
|
||||||
|
const elem = toggleList[i];
|
||||||
|
const selector = getSelectorFromElement(elem);
|
||||||
|
const filterElement = SelectorEngine.find(selector).filter(
|
||||||
|
(foundElem) => foundElem === element
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selector !== null && filterElement.length) {
|
||||||
|
this._selector = selector;
|
||||||
|
this._triggerArray.push(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._parent = this._config.parent ? this._getParent() : null;
|
||||||
|
|
||||||
|
if (!this._config.parent) {
|
||||||
|
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._config.toggle) {
|
||||||
|
this.toggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
this.hide();
|
||||||
|
} else {
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let actives;
|
||||||
|
let activesData;
|
||||||
|
|
||||||
|
if (this._parent) {
|
||||||
|
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
|
||||||
|
if (typeof this._config.parent === 'string') {
|
||||||
|
return elem.getAttribute('data-mdb-parent') === this._config.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (actives.length === 0) {
|
||||||
|
actives = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const container = SelectorEngine.findOne(this._selector);
|
||||||
|
if (actives) {
|
||||||
|
const tempActiveData = actives.find((elem) => container !== elem);
|
||||||
|
activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null;
|
||||||
|
|
||||||
|
if (activesData && activesData._isTransitioning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
||||||
|
if (startEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actives) {
|
||||||
|
actives.forEach((elemActive) => {
|
||||||
|
if (container !== elemActive) {
|
||||||
|
Collapse.collapseInterface(elemActive, 'hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!activesData) {
|
||||||
|
Data.setData(elemActive, DATA_KEY, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const dimension = this._getDimension();
|
||||||
|
|
||||||
|
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
||||||
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
||||||
|
|
||||||
|
this._element.style[dimension] = 0;
|
||||||
|
|
||||||
|
if (this._triggerArray.length) {
|
||||||
|
this._triggerArray.forEach((element) => {
|
||||||
|
element.classList.remove(CLASS_NAME_COLLAPSED);
|
||||||
|
element.setAttribute('aria-expanded', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setTransitioning(true);
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||||
|
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
this._element.style[dimension] = '';
|
||||||
|
|
||||||
|
this.setTransitioning(false);
|
||||||
|
|
||||||
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
||||||
|
};
|
||||||
|
|
||||||
|
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||||||
|
const scrollSize = `scroll${capitalizedDimension}`;
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
|
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
|
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
||||||
|
if (startEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dimension = this._getDimension();
|
||||||
|
|
||||||
|
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
||||||
|
|
||||||
|
reflow(this._element);
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
||||||
|
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
const triggerArrayLength = this._triggerArray.length;
|
||||||
|
if (triggerArrayLength > 0) {
|
||||||
|
for (let i = 0; i < triggerArrayLength; i++) {
|
||||||
|
const trigger = this._triggerArray[i];
|
||||||
|
const elem = getElementFromSelector(trigger);
|
||||||
|
|
||||||
|
if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
trigger.classList.add(CLASS_NAME_COLLAPSED);
|
||||||
|
trigger.setAttribute('aria-expanded', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setTransitioning(true);
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
this.setTransitioning(false);
|
||||||
|
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||||
|
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
||||||
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
||||||
|
};
|
||||||
|
|
||||||
|
this._element.style[dimension] = '';
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
|
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTransitioning(isTransitioning) {
|
||||||
|
this._isTransitioning = isTransitioning;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
this._config = null;
|
||||||
|
this._parent = null;
|
||||||
|
this._triggerArray = null;
|
||||||
|
this._isTransitioning = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...Default,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
||||||
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getDimension() {
|
||||||
|
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getParent() {
|
||||||
|
let { parent } = this._config;
|
||||||
|
|
||||||
|
if (isElement(parent)) {
|
||||||
|
// it's a jQuery object
|
||||||
|
if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
|
||||||
|
parent = parent[0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parent = SelectorEngine.findOne(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
const selector = `${SELECTOR_DATA_TOGGLE}[data-mdb-parent="${parent}"]`;
|
||||||
|
|
||||||
|
SelectorEngine.find(selector, parent).forEach((element) => {
|
||||||
|
const selected = getElementFromSelector(element);
|
||||||
|
|
||||||
|
this._addAriaAndCollapsedClass(selected, [element]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
_addAriaAndCollapsedClass(element, triggerArray) {
|
||||||
|
if (!element || !triggerArray.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isOpen = element.classList.contains(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
triggerArray.forEach((elem) => {
|
||||||
|
if (isOpen) {
|
||||||
|
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
||||||
|
} else {
|
||||||
|
elem.classList.add(CLASS_NAME_COLLAPSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.setAttribute('aria-expanded', isOpen);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static collapseInterface(element, config) {
|
||||||
|
let data = Data.getData(element, DATA_KEY);
|
||||||
|
const _config = {
|
||||||
|
...Default,
|
||||||
|
...Manipulator.getDataAttributes(element),
|
||||||
|
...(typeof config === 'object' && config ? config : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
||||||
|
_config.toggle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Collapse(element, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Collapse.collapseInterface(this, config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||||
|
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
||||||
|
if (event.target.tagName === 'A') {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
const triggerData = Manipulator.getDataAttributes(this);
|
||||||
|
const selector = getSelectorFromElement(this);
|
||||||
|
const selectorElements = SelectorEngine.find(selector);
|
||||||
|
|
||||||
|
selectorElements.forEach((element) => {
|
||||||
|
const data = Data.getData(element, DATA_KEY);
|
||||||
|
let config;
|
||||||
|
if (data) {
|
||||||
|
// update parent attribute
|
||||||
|
if (data._parent === null && typeof triggerData.parent === 'string') {
|
||||||
|
data._config.parent = triggerData.parent;
|
||||||
|
data._parent = data._getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
config = 'toggle';
|
||||||
|
} else {
|
||||||
|
config = triggerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collapse.collapseInterface(element, config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Collapse to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Collapse.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Collapse;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Collapse.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Collapse;
|
67
src/js/bootstrap/mdb-prefix/dom/data.js
Normal file
67
src/js/bootstrap/mdb-prefix/dom/data.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): dom/data.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const mapData = (() => {
|
||||||
|
const storeData = {};
|
||||||
|
let id = 1;
|
||||||
|
return {
|
||||||
|
set(element, key, data) {
|
||||||
|
if (typeof element.bsKey === 'undefined') {
|
||||||
|
element.bsKey = {
|
||||||
|
key,
|
||||||
|
id,
|
||||||
|
};
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeData[element.bsKey.id] = data;
|
||||||
|
},
|
||||||
|
get(element, key) {
|
||||||
|
if (!element || typeof element.bsKey === 'undefined') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyProperties = element.bsKey;
|
||||||
|
if (keyProperties.key === key) {
|
||||||
|
return storeData[keyProperties.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
delete(element, key) {
|
||||||
|
if (typeof element.bsKey === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyProperties = element.bsKey;
|
||||||
|
if (keyProperties.key === key) {
|
||||||
|
delete storeData[keyProperties.id];
|
||||||
|
delete element.bsKey;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
const Data = {
|
||||||
|
setData(instance, key, data) {
|
||||||
|
mapData.set(instance, key, data);
|
||||||
|
},
|
||||||
|
getData(instance, key) {
|
||||||
|
return mapData.get(instance, key);
|
||||||
|
},
|
||||||
|
removeData(instance, key) {
|
||||||
|
mapData.delete(instance, key);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Data;
|
338
src/js/bootstrap/mdb-prefix/dom/event-handler.js
Normal file
338
src/js/bootstrap/mdb-prefix/dom/event-handler.js
Normal file
|
@ -0,0 +1,338 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): dom/event-handler.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { getjQuery } from '../util/index';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||||
|
const stripNameRegex = /\..*/;
|
||||||
|
const stripUidRegex = /::\d+$/;
|
||||||
|
const eventRegistry = {}; // Events storage
|
||||||
|
let uidEvent = 1;
|
||||||
|
const customEvents = {
|
||||||
|
mouseenter: 'mouseover',
|
||||||
|
mouseleave: 'mouseout',
|
||||||
|
};
|
||||||
|
const nativeEvents = new Set([
|
||||||
|
'click',
|
||||||
|
'dblclick',
|
||||||
|
'mouseup',
|
||||||
|
'mousedown',
|
||||||
|
'contextmenu',
|
||||||
|
'mousewheel',
|
||||||
|
'DOMMouseScroll',
|
||||||
|
'mouseover',
|
||||||
|
'mouseout',
|
||||||
|
'mousemove',
|
||||||
|
'selectstart',
|
||||||
|
'selectend',
|
||||||
|
'keydown',
|
||||||
|
'keypress',
|
||||||
|
'keyup',
|
||||||
|
'orientationchange',
|
||||||
|
'touchstart',
|
||||||
|
'touchmove',
|
||||||
|
'touchend',
|
||||||
|
'touchcancel',
|
||||||
|
'pointerdown',
|
||||||
|
'pointermove',
|
||||||
|
'pointerup',
|
||||||
|
'pointerleave',
|
||||||
|
'pointercancel',
|
||||||
|
'gesturestart',
|
||||||
|
'gesturechange',
|
||||||
|
'gestureend',
|
||||||
|
'focus',
|
||||||
|
'blur',
|
||||||
|
'change',
|
||||||
|
'reset',
|
||||||
|
'select',
|
||||||
|
'submit',
|
||||||
|
'focusin',
|
||||||
|
'focusout',
|
||||||
|
'load',
|
||||||
|
'unload',
|
||||||
|
'beforeunload',
|
||||||
|
'resize',
|
||||||
|
'move',
|
||||||
|
'DOMContentLoaded',
|
||||||
|
'readystatechange',
|
||||||
|
'error',
|
||||||
|
'abort',
|
||||||
|
'scroll',
|
||||||
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Private methods
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getUidEvent(element, uid) {
|
||||||
|
return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEvent(element) {
|
||||||
|
const uid = getUidEvent(element);
|
||||||
|
|
||||||
|
element.uidEvent = uid;
|
||||||
|
eventRegistry[uid] = eventRegistry[uid] || {};
|
||||||
|
|
||||||
|
return eventRegistry[uid];
|
||||||
|
}
|
||||||
|
|
||||||
|
function bootstrapHandler(element, fn) {
|
||||||
|
return function handler(event) {
|
||||||
|
event.delegateTarget = element;
|
||||||
|
|
||||||
|
if (handler.oneOff) {
|
||||||
|
EventHandler.off(element, event.type, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn.apply(element, [event]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function bootstrapDelegationHandler(element, selector, fn) {
|
||||||
|
return function handler(event) {
|
||||||
|
const domElements = element.querySelectorAll(selector);
|
||||||
|
|
||||||
|
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
||||||
|
for (let i = domElements.length; i--; ) {
|
||||||
|
if (domElements[i] === target) {
|
||||||
|
event.delegateTarget = target;
|
||||||
|
|
||||||
|
if (handler.oneOff) {
|
||||||
|
EventHandler.off(element, event.type, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn.apply(target, [event]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// To please ESLint
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findHandler(events, handler, delegationSelector = null) {
|
||||||
|
const uidEventList = Object.keys(events);
|
||||||
|
|
||||||
|
for (let i = 0, len = uidEventList.length; i < len; i++) {
|
||||||
|
const event = events[uidEventList[i]];
|
||||||
|
|
||||||
|
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
||||||
|
const delegation = typeof handler === 'string';
|
||||||
|
const originalHandler = delegation ? delegationFn : handler;
|
||||||
|
|
||||||
|
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
||||||
|
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
|
||||||
|
const custom = customEvents[typeEvent];
|
||||||
|
|
||||||
|
if (custom) {
|
||||||
|
typeEvent = custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isNative = nativeEvents.has(typeEvent);
|
||||||
|
|
||||||
|
if (!isNative) {
|
||||||
|
typeEvent = originalTypeEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [delegation, originalHandler, typeEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
||||||
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handler) {
|
||||||
|
handler = delegationFn;
|
||||||
|
delegationFn = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [delegation, originalHandler, typeEvent] = normalizeParams(
|
||||||
|
originalTypeEvent,
|
||||||
|
handler,
|
||||||
|
delegationFn
|
||||||
|
);
|
||||||
|
const events = getEvent(element);
|
||||||
|
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
||||||
|
const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
|
||||||
|
|
||||||
|
if (previousFn) {
|
||||||
|
previousFn.oneOff = previousFn.oneOff && oneOff;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
|
||||||
|
const fn = delegation
|
||||||
|
? bootstrapDelegationHandler(element, handler, delegationFn)
|
||||||
|
: bootstrapHandler(element, handler);
|
||||||
|
|
||||||
|
fn.delegationSelector = delegation ? handler : null;
|
||||||
|
fn.originalHandler = originalHandler;
|
||||||
|
fn.oneOff = oneOff;
|
||||||
|
fn.uidEvent = uid;
|
||||||
|
handlers[uid] = fn;
|
||||||
|
|
||||||
|
element.addEventListener(typeEvent, fn, delegation);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
||||||
|
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
||||||
|
|
||||||
|
if (!fn) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
||||||
|
delete events[typeEvent][fn.uidEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||||
|
const storeElementEvent = events[typeEvent] || {};
|
||||||
|
|
||||||
|
Object.keys(storeElementEvent).forEach((handlerKey) => {
|
||||||
|
if (handlerKey.includes(namespace)) {
|
||||||
|
const event = storeElementEvent[handlerKey];
|
||||||
|
|
||||||
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const EventHandler = {
|
||||||
|
on(element, event, handler, delegationFn) {
|
||||||
|
addHandler(element, event, handler, delegationFn, false);
|
||||||
|
},
|
||||||
|
|
||||||
|
one(element, event, handler, delegationFn) {
|
||||||
|
addHandler(element, event, handler, delegationFn, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
off(element, originalTypeEvent, handler, delegationFn) {
|
||||||
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [delegation, originalHandler, typeEvent] = normalizeParams(
|
||||||
|
originalTypeEvent,
|
||||||
|
handler,
|
||||||
|
delegationFn
|
||||||
|
);
|
||||||
|
const inNamespace = typeEvent !== originalTypeEvent;
|
||||||
|
const events = getEvent(element);
|
||||||
|
const isNamespace = originalTypeEvent.startsWith('.');
|
||||||
|
|
||||||
|
if (typeof originalHandler !== 'undefined') {
|
||||||
|
// Simplest case: handler is passed, remove that listener ONLY.
|
||||||
|
if (!events || !events[typeEvent]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNamespace) {
|
||||||
|
Object.keys(events).forEach((elementEvent) => {
|
||||||
|
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const storeElementEvent = events[typeEvent] || {};
|
||||||
|
Object.keys(storeElementEvent).forEach((keyHandlers) => {
|
||||||
|
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||||
|
|
||||||
|
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||||
|
const event = storeElementEvent[keyHandlers];
|
||||||
|
|
||||||
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
trigger(element, event, args) {
|
||||||
|
if (typeof event !== 'string' || !element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const $ = getjQuery();
|
||||||
|
const typeEvent = event.replace(stripNameRegex, '');
|
||||||
|
const inNamespace = event !== typeEvent;
|
||||||
|
const isNative = nativeEvents.has(typeEvent);
|
||||||
|
|
||||||
|
let jQueryEvent;
|
||||||
|
let bubbles = true;
|
||||||
|
let nativeDispatch = true;
|
||||||
|
let defaultPrevented = false;
|
||||||
|
let evt = null;
|
||||||
|
|
||||||
|
if (inNamespace && $) {
|
||||||
|
jQueryEvent = $.Event(event, args);
|
||||||
|
|
||||||
|
$(element).trigger(jQueryEvent);
|
||||||
|
bubbles = !jQueryEvent.isPropagationStopped();
|
||||||
|
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
||||||
|
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNative) {
|
||||||
|
evt = document.createEvent('HTMLEvents');
|
||||||
|
evt.initEvent(typeEvent, bubbles, true);
|
||||||
|
} else {
|
||||||
|
evt = new CustomEvent(event, {
|
||||||
|
bubbles,
|
||||||
|
cancelable: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge custom information in our event
|
||||||
|
if (typeof args !== 'undefined') {
|
||||||
|
Object.keys(args).forEach((key) => {
|
||||||
|
Object.defineProperty(evt, key, {
|
||||||
|
get() {
|
||||||
|
return args[key];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultPrevented) {
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nativeDispatch) {
|
||||||
|
element.dispatchEvent(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
|
||||||
|
jQueryEvent.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return evt;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EventHandler;
|
80
src/js/bootstrap/mdb-prefix/dom/manipulator.js
Normal file
80
src/js/bootstrap/mdb-prefix/dom/manipulator.js
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): dom/manipulator.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizeData(val) {
|
||||||
|
if (val === 'true') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === 'false') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === Number(val).toString()) {
|
||||||
|
return Number(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === '' || val === 'null') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeDataKey(key) {
|
||||||
|
return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Manipulator = {
|
||||||
|
setDataAttribute(element, key, value) {
|
||||||
|
element.setAttribute(`data-mdb-${normalizeDataKey(key)}`, value);
|
||||||
|
},
|
||||||
|
|
||||||
|
removeDataAttribute(element, key) {
|
||||||
|
element.removeAttribute(`data-mdb-${normalizeDataKey(key)}`);
|
||||||
|
},
|
||||||
|
|
||||||
|
getDataAttributes(element) {
|
||||||
|
if (!element) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const attributes = {};
|
||||||
|
|
||||||
|
Object.keys(element.dataset)
|
||||||
|
.filter((key) => key.startsWith('mdb'))
|
||||||
|
.forEach((key) => {
|
||||||
|
let pureKey = key.replace(/^mdb/, '');
|
||||||
|
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||||||
|
attributes[pureKey] = normalizeData(element.dataset[key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return attributes;
|
||||||
|
},
|
||||||
|
|
||||||
|
getDataAttribute(element, key) {
|
||||||
|
return normalizeData(element.getAttribute(`data-mdb-${normalizeDataKey(key)}`));
|
||||||
|
},
|
||||||
|
|
||||||
|
offset(element) {
|
||||||
|
const rect = element.getBoundingClientRect();
|
||||||
|
|
||||||
|
return {
|
||||||
|
top: rect.top + document.body.scrollTop,
|
||||||
|
left: rect.left + document.body.scrollLeft,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
position(element) {
|
||||||
|
return {
|
||||||
|
top: element.offsetTop,
|
||||||
|
left: element.offsetLeft,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Manipulator;
|
80
src/js/bootstrap/mdb-prefix/dom/selector-engine.js
Normal file
80
src/js/bootstrap/mdb-prefix/dom/selector-engine.js
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NODE_TEXT = 3;
|
||||||
|
|
||||||
|
const SelectorEngine = {
|
||||||
|
matches(element, selector) {
|
||||||
|
return element.matches(selector);
|
||||||
|
},
|
||||||
|
|
||||||
|
find(selector, element = document.documentElement) {
|
||||||
|
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||||
|
},
|
||||||
|
|
||||||
|
findOne(selector, element = document.documentElement) {
|
||||||
|
return Element.prototype.querySelector.call(element, selector);
|
||||||
|
},
|
||||||
|
|
||||||
|
children(element, selector) {
|
||||||
|
const children = [].concat(...element.children);
|
||||||
|
|
||||||
|
return children.filter((child) => child.matches(selector));
|
||||||
|
},
|
||||||
|
|
||||||
|
parents(element, selector) {
|
||||||
|
const parents = [];
|
||||||
|
|
||||||
|
let ancestor = element.parentNode;
|
||||||
|
|
||||||
|
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
||||||
|
if (this.matches(ancestor, selector)) {
|
||||||
|
parents.push(ancestor);
|
||||||
|
}
|
||||||
|
|
||||||
|
ancestor = ancestor.parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parents;
|
||||||
|
},
|
||||||
|
|
||||||
|
prev(element, selector) {
|
||||||
|
let previous = element.previousElementSibling;
|
||||||
|
|
||||||
|
while (previous) {
|
||||||
|
if (previous.matches(selector)) {
|
||||||
|
return [previous];
|
||||||
|
}
|
||||||
|
|
||||||
|
previous = previous.previousElementSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
|
||||||
|
next(element, selector) {
|
||||||
|
let next = element.nextElementSibling;
|
||||||
|
|
||||||
|
while (next) {
|
||||||
|
if (this.matches(next, selector)) {
|
||||||
|
return [next];
|
||||||
|
}
|
||||||
|
|
||||||
|
next = next.nextElementSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SelectorEngine;
|
535
src/js/bootstrap/mdb-prefix/dropdown.js
Normal file
535
src/js/bootstrap/mdb-prefix/dropdown.js
Normal file
|
@ -0,0 +1,535 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): dropdown.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as Popper from '@popperjs/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
getElementFromSelector,
|
||||||
|
isElement,
|
||||||
|
isVisible,
|
||||||
|
isRTL,
|
||||||
|
noop,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'dropdown';
|
||||||
|
const DATA_KEY = 'bs.dropdown';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const ESCAPE_KEY = 'Escape';
|
||||||
|
const SPACE_KEY = 'Space';
|
||||||
|
const TAB_KEY = 'Tab';
|
||||||
|
const ARROW_UP_KEY = 'ArrowUp';
|
||||||
|
const ARROW_DOWN_KEY = 'ArrowDown';
|
||||||
|
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
||||||
|
|
||||||
|
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY}`);
|
||||||
|
|
||||||
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK = `click${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_DISABLED = 'disabled';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
const CLASS_NAME_DROPUP = 'dropup';
|
||||||
|
const CLASS_NAME_DROPEND = 'dropend';
|
||||||
|
const CLASS_NAME_DROPSTART = 'dropstart';
|
||||||
|
const CLASS_NAME_NAVBAR = 'navbar';
|
||||||
|
|
||||||
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="dropdown"]';
|
||||||
|
const SELECTOR_FORM_CHILD = '.dropdown form';
|
||||||
|
const SELECTOR_MENU = '.dropdown-menu';
|
||||||
|
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||||
|
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||||
|
|
||||||
|
const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||||
|
const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||||
|
const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||||
|
const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||||
|
const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||||
|
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
offset: 0,
|
||||||
|
flip: true,
|
||||||
|
boundary: 'clippingParents',
|
||||||
|
reference: 'toggle',
|
||||||
|
display: 'dynamic',
|
||||||
|
popperConfig: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
offset: '(number|string|function)',
|
||||||
|
flip: 'boolean',
|
||||||
|
boundary: '(string|element)',
|
||||||
|
reference: '(string|element)',
|
||||||
|
display: 'string',
|
||||||
|
popperConfig: '(null|object)',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Dropdown extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
this._popper = null;
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._menu = this._getMenuElement();
|
||||||
|
this._inNavbar = this._detectNavbar();
|
||||||
|
|
||||||
|
this._addEventListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DefaultType() {
|
||||||
|
return DefaultType;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isActive = this._element.classList.contains(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
Dropdown.clearMenus();
|
||||||
|
|
||||||
|
if (isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (
|
||||||
|
this._element.disabled ||
|
||||||
|
this._element.classList.contains(CLASS_NAME_DISABLED) ||
|
||||||
|
this._menu.classList.contains(CLASS_NAME_SHOW)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = Dropdown.getParentFromElement(this._element);
|
||||||
|
const relatedTarget = {
|
||||||
|
relatedTarget: this._element,
|
||||||
|
};
|
||||||
|
|
||||||
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget);
|
||||||
|
|
||||||
|
if (showEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Totally disable Popper for Dropdowns in Navbar
|
||||||
|
if (!this._inNavbar) {
|
||||||
|
if (typeof Popper === 'undefined') {
|
||||||
|
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
|
||||||
|
}
|
||||||
|
|
||||||
|
let referenceElement = this._element;
|
||||||
|
|
||||||
|
if (this._config.reference === 'parent') {
|
||||||
|
referenceElement = parent;
|
||||||
|
} else if (isElement(this._config.reference)) {
|
||||||
|
referenceElement = this._config.reference;
|
||||||
|
|
||||||
|
// Check if it's jQuery element
|
||||||
|
if (typeof this._config.reference.jquery !== 'undefined') {
|
||||||
|
referenceElement = this._config.reference[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is a touch-enabled device we add extra
|
||||||
|
// empty mouseover listeners to the body's immediate children;
|
||||||
|
// only needed because of broken event delegation on iOS
|
||||||
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||||
|
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||||||
|
[]
|
||||||
|
.concat(...document.body.children)
|
||||||
|
.forEach((elem) => EventHandler.on(elem, 'mouseover', null, noop()));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.focus();
|
||||||
|
this._element.setAttribute('aria-expanded', true);
|
||||||
|
|
||||||
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
if (
|
||||||
|
this._element.disabled ||
|
||||||
|
this._element.classList.contains(CLASS_NAME_DISABLED) ||
|
||||||
|
!this._menu.classList.contains(CLASS_NAME_SHOW)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = Dropdown.getParentFromElement(this._element);
|
||||||
|
const relatedTarget = {
|
||||||
|
relatedTarget: this._element,
|
||||||
|
};
|
||||||
|
|
||||||
|
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
|
||||||
|
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
|
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
|
this._menu = null;
|
||||||
|
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy();
|
||||||
|
this._popper = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this._inNavbar = this._detectNavbar();
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_addEventListeners() {
|
||||||
|
EventHandler.on(this._element, EVENT_CLICK, (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...this.constructor.Default,
|
||||||
|
...Manipulator.getDataAttributes(this._element),
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
|
||||||
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getMenuElement() {
|
||||||
|
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
_getPlacement() {
|
||||||
|
const parentDropdown = this._element.parentNode;
|
||||||
|
|
||||||
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
||||||
|
return PLACEMENT_RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
|
||||||
|
return PLACEMENT_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to trim the value because custom properties can also include spaces
|
||||||
|
const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
|
||||||
|
|
||||||
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
||||||
|
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
_detectNavbar() {
|
||||||
|
return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getPopperConfig() {
|
||||||
|
const popperConfig = {
|
||||||
|
placement: this._getPlacement(),
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: 'preventOverflow',
|
||||||
|
options: {
|
||||||
|
altBoundary: this._config.flip,
|
||||||
|
rootBoundary: this._config.boundary,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Disable Popper if we have a static display
|
||||||
|
if (this._config.display === 'static') {
|
||||||
|
popperConfig.modifiers = [
|
||||||
|
{
|
||||||
|
name: 'applyStyles',
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...popperConfig,
|
||||||
|
...this._config.popperConfig,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static dropdownInterface(element, config) {
|
||||||
|
let data = Data.getData(element, DATA_KEY);
|
||||||
|
const _config = typeof config === 'object' ? config : null;
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Dropdown(element, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Dropdown.dropdownInterface(this, config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static clearMenus(event) {
|
||||||
|
if (
|
||||||
|
event &&
|
||||||
|
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||||
|
|
||||||
|
for (let i = 0, len = toggles.length; i < len; i++) {
|
||||||
|
const parent = Dropdown.getParentFromElement(toggles[i]);
|
||||||
|
const context = Data.getData(toggles[i], DATA_KEY);
|
||||||
|
const relatedTarget = {
|
||||||
|
relatedTarget: toggles[i],
|
||||||
|
};
|
||||||
|
|
||||||
|
if (event && event.type === 'click') {
|
||||||
|
relatedTarget.clickEvent = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!context) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dropdownMenu = context._menu;
|
||||||
|
if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
event &&
|
||||||
|
((event.type === 'click' && /input|textarea/i.test(event.target.tagName)) ||
|
||||||
|
(event.type === 'keyup' && event.key === TAB_KEY)) &&
|
||||||
|
dropdownMenu.contains(event.target)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is a touch-enabled device we remove the extra
|
||||||
|
// empty mouseover listeners we added for iOS support
|
||||||
|
if ('ontouchstart' in document.documentElement) {
|
||||||
|
[]
|
||||||
|
.concat(...document.body.children)
|
||||||
|
.forEach((elem) => EventHandler.off(elem, 'mouseover', null, noop()));
|
||||||
|
}
|
||||||
|
|
||||||
|
toggles[i].setAttribute('aria-expanded', 'false');
|
||||||
|
|
||||||
|
if (context._popper) {
|
||||||
|
context._popper.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdownMenu.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
toggles[i].classList.remove(CLASS_NAME_SHOW);
|
||||||
|
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static getParentFromElement(element) {
|
||||||
|
return getElementFromSelector(element) || element.parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static dataApiKeydownHandler(event) {
|
||||||
|
// If not input/textarea:
|
||||||
|
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
|
||||||
|
// If input/textarea:
|
||||||
|
// - If space key => not a dropdown command
|
||||||
|
// - If key is other than escape
|
||||||
|
// - If key is not up or down => not a dropdown command
|
||||||
|
// - If trigger inside the menu => not a dropdown command
|
||||||
|
if (
|
||||||
|
/input|textarea/i.test(event.target.tagName)
|
||||||
|
? event.key === SPACE_KEY ||
|
||||||
|
(event.key !== ESCAPE_KEY &&
|
||||||
|
((event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY) ||
|
||||||
|
event.target.closest(SELECTOR_MENU)))
|
||||||
|
: !REGEXP_KEYDOWN.test(event.key)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = Dropdown.getParentFromElement(this);
|
||||||
|
const isActive = this.classList.contains(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
if (event.key === ESCAPE_KEY) {
|
||||||
|
const button = this.matches(SELECTOR_DATA_TOGGLE)
|
||||||
|
? this
|
||||||
|
: SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0];
|
||||||
|
button.focus();
|
||||||
|
Dropdown.clearMenus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isActive || event.key === SPACE_KEY) {
|
||||||
|
Dropdown.clearMenus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
|
||||||
|
|
||||||
|
if (!items.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let index = items.indexOf(event.target);
|
||||||
|
|
||||||
|
// Up
|
||||||
|
if (event.key === ARROW_UP_KEY && index > 0) {
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Down
|
||||||
|
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// index is -1 if the first keydown is an ArrowUp
|
||||||
|
index = index === -1 ? 0 : index;
|
||||||
|
|
||||||
|
items[index].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(
|
||||||
|
document,
|
||||||
|
EVENT_KEYDOWN_DATA_API,
|
||||||
|
SELECTOR_DATA_TOGGLE,
|
||||||
|
Dropdown.dataApiKeydownHandler
|
||||||
|
);
|
||||||
|
EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
|
||||||
|
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
Dropdown.dropdownInterface(this, 'toggle');
|
||||||
|
});
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.stopPropagation());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Dropdown to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Dropdown.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Dropdown;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Dropdown.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Dropdown;
|
632
src/js/bootstrap/mdb-prefix/modal.js
Normal file
632
src/js/bootstrap/mdb-prefix/modal.js
Normal file
|
@ -0,0 +1,632 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): modal.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
isVisible,
|
||||||
|
isRTL,
|
||||||
|
reflow,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'modal';
|
||||||
|
const DATA_KEY = 'bs.modal';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
const ESCAPE_KEY = 'Escape';
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
backdrop: true,
|
||||||
|
keyboard: true,
|
||||||
|
focus: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
backdrop: '(boolean|string)',
|
||||||
|
keyboard: 'boolean',
|
||||||
|
focus: 'boolean',
|
||||||
|
};
|
||||||
|
|
||||||
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||||
|
const EVENT_RESIZE = `resize${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||||
|
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`;
|
||||||
|
const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY}`;
|
||||||
|
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
|
||||||
|
const CLASS_NAME_BACKDROP = 'modal-backdrop';
|
||||||
|
const CLASS_NAME_OPEN = 'modal-open';
|
||||||
|
const CLASS_NAME_FADE = 'fade';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
const CLASS_NAME_STATIC = 'modal-static';
|
||||||
|
|
||||||
|
const SELECTOR_DIALOG = '.modal-dialog';
|
||||||
|
const SELECTOR_MODAL_BODY = '.modal-body';
|
||||||
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="modal"]';
|
||||||
|
const SELECTOR_DATA_DISMISS = '[data-mdb-dismiss="modal"]';
|
||||||
|
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
||||||
|
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Modal extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
|
||||||
|
this._backdrop = null;
|
||||||
|
this._isShown = false;
|
||||||
|
this._isBodyOverflowing = false;
|
||||||
|
this._ignoreBackdropClick = false;
|
||||||
|
this._isTransitioning = false;
|
||||||
|
this._scrollbarWidth = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
toggle(relatedTarget) {
|
||||||
|
return this._isShown ? this.hide() : this.show(relatedTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
show(relatedTarget) {
|
||||||
|
if (this._isShown || this._isTransitioning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||||
|
this._isTransitioning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
|
||||||
|
relatedTarget,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this._isShown || showEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isShown = true;
|
||||||
|
|
||||||
|
this._checkScrollbar();
|
||||||
|
this._setScrollbar();
|
||||||
|
|
||||||
|
this._adjustDialog();
|
||||||
|
|
||||||
|
this._setEscapeEvent();
|
||||||
|
this._setResizeEvent();
|
||||||
|
|
||||||
|
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, (event) =>
|
||||||
|
this.hide(event)
|
||||||
|
);
|
||||||
|
|
||||||
|
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
||||||
|
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, (event) => {
|
||||||
|
if (event.target === this._element) {
|
||||||
|
this._ignoreBackdropClick = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this._showBackdrop(() => this._showElement(relatedTarget));
|
||||||
|
}
|
||||||
|
|
||||||
|
hide(event) {
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this._isShown || this._isTransitioning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
||||||
|
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isShown = false;
|
||||||
|
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||||
|
|
||||||
|
if (transition) {
|
||||||
|
this._isTransitioning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._setEscapeEvent();
|
||||||
|
this._setResizeEvent();
|
||||||
|
|
||||||
|
EventHandler.off(document, EVENT_FOCUSIN);
|
||||||
|
|
||||||
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
||||||
|
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
||||||
|
|
||||||
|
if (transition) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
|
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, (event) => this._hideModal(event));
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
|
} else {
|
||||||
|
this._hideModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
[window, this._element, this._dialog].forEach((htmlElement) =>
|
||||||
|
EventHandler.off(htmlElement, EVENT_KEY)
|
||||||
|
);
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||||
|
* Do not move `document` in `htmlElements` array
|
||||||
|
* It will remove `EVENT_CLICK_DATA_API` event that should remain
|
||||||
|
*/
|
||||||
|
EventHandler.off(document, EVENT_FOCUSIN);
|
||||||
|
|
||||||
|
this._config = null;
|
||||||
|
this._dialog = null;
|
||||||
|
this._backdrop = null;
|
||||||
|
this._isShown = null;
|
||||||
|
this._isBodyOverflowing = null;
|
||||||
|
this._ignoreBackdropClick = null;
|
||||||
|
this._isTransitioning = null;
|
||||||
|
this._scrollbarWidth = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleUpdate() {
|
||||||
|
this._adjustDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...Default,
|
||||||
|
...Manipulator.getDataAttributes(this._element),
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_showElement(relatedTarget) {
|
||||||
|
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||||
|
const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
|
||||||
|
|
||||||
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
||||||
|
// Don't move modal's DOM position
|
||||||
|
document.body.appendChild(this._element);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.style.display = 'block';
|
||||||
|
this._element.removeAttribute('aria-hidden');
|
||||||
|
this._element.setAttribute('aria-modal', true);
|
||||||
|
this._element.setAttribute('role', 'dialog');
|
||||||
|
this._element.scrollTop = 0;
|
||||||
|
|
||||||
|
if (modalBody) {
|
||||||
|
modalBody.scrollTop = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transition) {
|
||||||
|
reflow(this._element);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
if (this._config.focus) {
|
||||||
|
this._enforceFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
const transitionComplete = () => {
|
||||||
|
if (this._config.focus) {
|
||||||
|
this._element.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isTransitioning = false;
|
||||||
|
EventHandler.trigger(this._element, EVENT_SHOWN, {
|
||||||
|
relatedTarget,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (transition) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||||
|
|
||||||
|
EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
|
||||||
|
emulateTransitionEnd(this._dialog, transitionDuration);
|
||||||
|
} else {
|
||||||
|
transitionComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_enforceFocus() {
|
||||||
|
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||||
|
EventHandler.on(document, EVENT_FOCUSIN, (event) => {
|
||||||
|
if (
|
||||||
|
document !== event.target &&
|
||||||
|
this._element !== event.target &&
|
||||||
|
!this._element.contains(event.target)
|
||||||
|
) {
|
||||||
|
this._element.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_setEscapeEvent() {
|
||||||
|
if (this._isShown) {
|
||||||
|
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
|
||||||
|
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||||
|
event.preventDefault();
|
||||||
|
this.hide();
|
||||||
|
} else if (!this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||||
|
this._triggerBackdropTransition();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_setResizeEvent() {
|
||||||
|
if (this._isShown) {
|
||||||
|
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
|
||||||
|
} else {
|
||||||
|
EventHandler.off(window, EVENT_RESIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_hideModal() {
|
||||||
|
this._element.style.display = 'none';
|
||||||
|
this._element.setAttribute('aria-hidden', true);
|
||||||
|
this._element.removeAttribute('aria-modal');
|
||||||
|
this._element.removeAttribute('role');
|
||||||
|
this._isTransitioning = false;
|
||||||
|
this._showBackdrop(() => {
|
||||||
|
document.body.classList.remove(CLASS_NAME_OPEN);
|
||||||
|
this._resetAdjustments();
|
||||||
|
this._resetScrollbar();
|
||||||
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_removeBackdrop() {
|
||||||
|
this._backdrop.parentNode.removeChild(this._backdrop);
|
||||||
|
this._backdrop = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_showBackdrop(callback) {
|
||||||
|
const animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
|
||||||
|
|
||||||
|
if (this._isShown && this._config.backdrop) {
|
||||||
|
this._backdrop = document.createElement('div');
|
||||||
|
this._backdrop.className = CLASS_NAME_BACKDROP;
|
||||||
|
|
||||||
|
if (animate) {
|
||||||
|
this._backdrop.classList.add(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(this._backdrop);
|
||||||
|
|
||||||
|
EventHandler.on(this._element, EVENT_CLICK_DISMISS, (event) => {
|
||||||
|
if (this._ignoreBackdropClick) {
|
||||||
|
this._ignoreBackdropClick = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.target !== event.currentTarget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._config.backdrop === 'static') {
|
||||||
|
this._triggerBackdropTransition();
|
||||||
|
} else {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (animate) {
|
||||||
|
reflow(this._backdrop);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._backdrop.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
if (!animate) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||||
|
|
||||||
|
EventHandler.one(this._backdrop, TRANSITION_END, callback);
|
||||||
|
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
|
||||||
|
} else if (!this._isShown && this._backdrop) {
|
||||||
|
this._backdrop.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
const callbackRemove = () => {
|
||||||
|
this._removeBackdrop();
|
||||||
|
callback();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||||
|
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||||
|
EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
|
||||||
|
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
|
||||||
|
} else {
|
||||||
|
callbackRemove();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_triggerBackdropTransition() {
|
||||||
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
this._element.style.overflowY = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_STATIC);
|
||||||
|
const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||||
|
EventHandler.off(this._element, TRANSITION_END);
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, () => {
|
||||||
|
this._element.classList.remove(CLASS_NAME_STATIC);
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, () => {
|
||||||
|
this._element.style.overflowY = '';
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(this._element, modalTransitionDuration);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(this._element, modalTransitionDuration);
|
||||||
|
this._element.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// the following methods are used to handle overflowing modals
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
_adjustDialog() {
|
||||||
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
|
if (
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && !isRTL) ||
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
|
this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && !isRTL) ||
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
|
this._element.style.paddingRight = `${this._scrollbarWidth}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_resetAdjustments() {
|
||||||
|
this._element.style.paddingLeft = '';
|
||||||
|
this._element.style.paddingRight = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
_checkScrollbar() {
|
||||||
|
const rect = document.body.getBoundingClientRect();
|
||||||
|
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
|
||||||
|
this._scrollbarWidth = this._getScrollbarWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
_setScrollbar() {
|
||||||
|
if (this._isBodyOverflowing) {
|
||||||
|
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
||||||
|
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
||||||
|
|
||||||
|
// Adjust fixed content padding
|
||||||
|
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => {
|
||||||
|
const actualPadding = element.style.paddingRight;
|
||||||
|
const calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
||||||
|
Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
|
||||||
|
element.style.paddingRight = `${
|
||||||
|
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
|
||||||
|
}px`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Adjust sticky content margin
|
||||||
|
SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach((element) => {
|
||||||
|
const actualMargin = element.style.marginRight;
|
||||||
|
const calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
||||||
|
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
|
||||||
|
element.style.marginRight = `${
|
||||||
|
Number.parseFloat(calculatedMargin) - this._scrollbarWidth
|
||||||
|
}px`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Adjust body padding
|
||||||
|
const actualPadding = document.body.style.paddingRight;
|
||||||
|
const calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
|
||||||
|
|
||||||
|
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
|
||||||
|
document.body.style.paddingRight = `${
|
||||||
|
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
|
||||||
|
}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.classList.add(CLASS_NAME_OPEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resetScrollbar() {
|
||||||
|
// Restore fixed content padding
|
||||||
|
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => {
|
||||||
|
const padding = Manipulator.getDataAttribute(element, 'padding-right');
|
||||||
|
if (typeof padding !== 'undefined') {
|
||||||
|
Manipulator.removeDataAttribute(element, 'padding-right');
|
||||||
|
element.style.paddingRight = padding;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Restore sticky content and navbar-toggler margin
|
||||||
|
SelectorEngine.find(`${SELECTOR_STICKY_CONTENT}`).forEach((element) => {
|
||||||
|
const margin = Manipulator.getDataAttribute(element, 'margin-right');
|
||||||
|
if (typeof margin !== 'undefined') {
|
||||||
|
Manipulator.removeDataAttribute(element, 'margin-right');
|
||||||
|
element.style.marginRight = margin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Restore body padding
|
||||||
|
const padding = Manipulator.getDataAttribute(document.body, 'padding-right');
|
||||||
|
if (typeof padding === 'undefined') {
|
||||||
|
document.body.style.paddingRight = '';
|
||||||
|
} else {
|
||||||
|
Manipulator.removeDataAttribute(document.body, 'padding-right');
|
||||||
|
document.body.style.paddingRight = padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_getScrollbarWidth() {
|
||||||
|
// thx d.walsh
|
||||||
|
const scrollDiv = document.createElement('div');
|
||||||
|
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
|
||||||
|
document.body.appendChild(scrollDiv);
|
||||||
|
const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
||||||
|
document.body.removeChild(scrollDiv);
|
||||||
|
return scrollbarWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config, relatedTarget) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
const _config = {
|
||||||
|
...Default,
|
||||||
|
...Manipulator.getDataAttributes(this),
|
||||||
|
...(typeof config === 'object' && config ? config : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Modal(this, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config](relatedTarget);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||||
|
const target = getElementFromSelector(this);
|
||||||
|
|
||||||
|
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.one(target, EVENT_SHOW, (showEvent) => {
|
||||||
|
if (showEvent.defaultPrevented) {
|
||||||
|
// only register focus restorer if modal will actually get shown
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.one(target, EVENT_HIDDEN, () => {
|
||||||
|
if (isVisible(this)) {
|
||||||
|
this.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let data = Data.getData(target, DATA_KEY);
|
||||||
|
if (!data) {
|
||||||
|
const config = {
|
||||||
|
...Manipulator.getDataAttributes(target),
|
||||||
|
...Manipulator.getDataAttributes(this),
|
||||||
|
};
|
||||||
|
|
||||||
|
data = new Modal(target, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.show(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Modal to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Modal.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Modal;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Modal.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Modal;
|
182
src/js/bootstrap/mdb-prefix/popover.js
Normal file
182
src/js/bootstrap/mdb-prefix/popover.js
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): popover.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { getjQuery, onDOMContentLoaded } from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import Tooltip from './tooltip';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'popover';
|
||||||
|
const DATA_KEY = 'bs.popover';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const CLASS_PREFIX = 'bs-popover';
|
||||||
|
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
...Tooltip.Default,
|
||||||
|
placement: 'right',
|
||||||
|
trigger: 'click',
|
||||||
|
content: '',
|
||||||
|
template:
|
||||||
|
'<div class="popover" role="tooltip">' +
|
||||||
|
'<div class="popover-arrow"></div>' +
|
||||||
|
'<h3 class="popover-header"></h3>' +
|
||||||
|
'<div class="popover-body"></div>' +
|
||||||
|
'</div>',
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
...Tooltip.DefaultType,
|
||||||
|
content: '(string|element|function)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const Event = {
|
||||||
|
HIDE: `hide${EVENT_KEY}`,
|
||||||
|
HIDDEN: `hidden${EVENT_KEY}`,
|
||||||
|
SHOW: `show${EVENT_KEY}`,
|
||||||
|
SHOWN: `shown${EVENT_KEY}`,
|
||||||
|
INSERTED: `inserted${EVENT_KEY}`,
|
||||||
|
CLICK: `click${EVENT_KEY}`,
|
||||||
|
FOCUSIN: `focusin${EVENT_KEY}`,
|
||||||
|
FOCUSOUT: `focusout${EVENT_KEY}`,
|
||||||
|
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
||||||
|
MOUSELEAVE: `mouseleave${EVENT_KEY}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
const CLASS_NAME_FADE = 'fade';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
|
||||||
|
const SELECTOR_TITLE = '.popover-header';
|
||||||
|
const SELECTOR_CONTENT = '.popover-body';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Popover extends Tooltip {
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get NAME() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get Event() {
|
||||||
|
return Event;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get EVENT_KEY() {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DefaultType() {
|
||||||
|
return DefaultType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
|
||||||
|
isWithContent() {
|
||||||
|
return this.getTitle() || this._getContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
setContent() {
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
|
||||||
|
// we use append for html objects to maintain js events
|
||||||
|
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
||||||
|
let content = this._getContent();
|
||||||
|
if (typeof content === 'function') {
|
||||||
|
content = content.call(this._element);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
||||||
|
|
||||||
|
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_addAttachmentClass(attachment) {
|
||||||
|
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getContent() {
|
||||||
|
return this._element.getAttribute('data-mdb-content') || this.config.content;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cleanTipClass() {
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||||
|
if (tabClass !== null && tabClass.length > 0) {
|
||||||
|
tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
const _config = typeof config === 'object' ? config : null;
|
||||||
|
|
||||||
|
if (!data && /dispose|hide/.test(config)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Popover(this, _config);
|
||||||
|
Data.setData(this, DATA_KEY, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Popover to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Popover.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Popover;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Popover.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Popover;
|
331
src/js/bootstrap/mdb-prefix/scrollspy.js
Normal file
331
src/js/bootstrap/mdb-prefix/scrollspy.js
Normal file
|
@ -0,0 +1,331 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): scrollspy.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
getSelectorFromElement,
|
||||||
|
getUID,
|
||||||
|
isElement,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'scrollspy';
|
||||||
|
const DATA_KEY = 'bs.scrollspy';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
offset: 10,
|
||||||
|
method: 'auto',
|
||||||
|
target: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
offset: 'number',
|
||||||
|
method: 'string',
|
||||||
|
target: '(string|element)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
||||||
|
const EVENT_SCROLL = `scroll${EVENT_KEY}`;
|
||||||
|
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
||||||
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
|
||||||
|
const SELECTOR_DATA_SPY = '[data-mdb-spy="scroll"]';
|
||||||
|
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
|
const SELECTOR_NAV_LINKS = '.nav-link';
|
||||||
|
const SELECTOR_NAV_ITEMS = '.nav-item';
|
||||||
|
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
||||||
|
const SELECTOR_DROPDOWN = '.dropdown';
|
||||||
|
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||||
|
|
||||||
|
const METHOD_OFFSET = 'offset';
|
||||||
|
const METHOD_POSITION = 'position';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ScrollSpy extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
||||||
|
this._offsets = [];
|
||||||
|
this._targets = [];
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._scrollHeight = 0;
|
||||||
|
|
||||||
|
EventHandler.on(this._scrollElement, EVENT_SCROLL, (event) => this._process(event));
|
||||||
|
|
||||||
|
this.refresh();
|
||||||
|
this._process();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
const autoMethod =
|
||||||
|
this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
|
||||||
|
|
||||||
|
const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
||||||
|
|
||||||
|
const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
|
||||||
|
|
||||||
|
this._offsets = [];
|
||||||
|
this._targets = [];
|
||||||
|
this._scrollHeight = this._getScrollHeight();
|
||||||
|
|
||||||
|
const targets = SelectorEngine.find(this._selector);
|
||||||
|
|
||||||
|
targets
|
||||||
|
.map((element) => {
|
||||||
|
const targetSelector = getSelectorFromElement(element);
|
||||||
|
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
|
||||||
|
|
||||||
|
if (target) {
|
||||||
|
const targetBCR = target.getBoundingClientRect();
|
||||||
|
if (targetBCR.width || targetBCR.height) {
|
||||||
|
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter((item) => item)
|
||||||
|
.sort((a, b) => a[0] - b[0])
|
||||||
|
.forEach((item) => {
|
||||||
|
this._offsets.push(item[0]);
|
||||||
|
this._targets.push(item[1]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
EventHandler.off(this._scrollElement, EVENT_KEY);
|
||||||
|
|
||||||
|
this._scrollElement = null;
|
||||||
|
this._config = null;
|
||||||
|
this._selector = null;
|
||||||
|
this._offsets = null;
|
||||||
|
this._targets = null;
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._scrollHeight = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...Default,
|
||||||
|
...(typeof config === 'object' && config ? config : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof config.target !== 'string' && isElement(config.target)) {
|
||||||
|
let { id } = config.target;
|
||||||
|
if (!id) {
|
||||||
|
id = getUID(NAME);
|
||||||
|
config.target.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.target = `#${id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getScrollTop() {
|
||||||
|
return this._scrollElement === window
|
||||||
|
? this._scrollElement.pageYOffset
|
||||||
|
: this._scrollElement.scrollTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getScrollHeight() {
|
||||||
|
return (
|
||||||
|
this._scrollElement.scrollHeight ||
|
||||||
|
Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getOffsetHeight() {
|
||||||
|
return this._scrollElement === window
|
||||||
|
? window.innerHeight
|
||||||
|
: this._scrollElement.getBoundingClientRect().height;
|
||||||
|
}
|
||||||
|
|
||||||
|
_process() {
|
||||||
|
const scrollTop = this._getScrollTop() + this._config.offset;
|
||||||
|
const scrollHeight = this._getScrollHeight();
|
||||||
|
const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
||||||
|
|
||||||
|
if (this._scrollHeight !== scrollHeight) {
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scrollTop >= maxScroll) {
|
||||||
|
const target = this._targets[this._targets.length - 1];
|
||||||
|
|
||||||
|
if (this._activeTarget !== target) {
|
||||||
|
this._activate(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
||||||
|
this._activeTarget = null;
|
||||||
|
this._clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = this._offsets.length; i--; ) {
|
||||||
|
const isActiveTarget =
|
||||||
|
this._activeTarget !== this._targets[i] &&
|
||||||
|
scrollTop >= this._offsets[i] &&
|
||||||
|
(typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
||||||
|
|
||||||
|
if (isActiveTarget) {
|
||||||
|
this._activate(this._targets[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_activate(target) {
|
||||||
|
this._activeTarget = target;
|
||||||
|
|
||||||
|
this._clear();
|
||||||
|
|
||||||
|
const queries = this._selector
|
||||||
|
.split(',')
|
||||||
|
.map((selector) => `${selector}[data-mdb-target="${target}"],${selector}[href="${target}"]`);
|
||||||
|
|
||||||
|
const link = SelectorEngine.findOne(queries.join(','));
|
||||||
|
|
||||||
|
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
||||||
|
SelectorEngine.findOne(
|
||||||
|
SELECTOR_DROPDOWN_TOGGLE,
|
||||||
|
link.closest(SELECTOR_DROPDOWN)
|
||||||
|
).classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
|
||||||
|
link.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
} else {
|
||||||
|
// Set triggered link as active
|
||||||
|
link.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
|
||||||
|
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach((listGroup) => {
|
||||||
|
// Set triggered links parents as active
|
||||||
|
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
||||||
|
SelectorEngine.prev(
|
||||||
|
listGroup,
|
||||||
|
`${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`
|
||||||
|
).forEach((item) => item.classList.add(CLASS_NAME_ACTIVE));
|
||||||
|
|
||||||
|
// Handle special case when .nav-link is inside .nav-item
|
||||||
|
SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach((navItem) => {
|
||||||
|
SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach((item) =>
|
||||||
|
item.classList.add(CLASS_NAME_ACTIVE)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
|
||||||
|
relatedTarget: target,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_clear() {
|
||||||
|
SelectorEngine.find(this._selector)
|
||||||
|
.filter((node) => node.classList.contains(CLASS_NAME_ACTIVE))
|
||||||
|
.forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
const _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new ScrollSpy(this, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||||
|
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(
|
||||||
|
(spy) => new ScrollSpy(spy, Manipulator.getDataAttributes(spy))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .ScrollSpy to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = ScrollSpy;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return ScrollSpy.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ScrollSpy;
|
247
src/js/bootstrap/mdb-prefix/tab.js
Normal file
247
src/js/bootstrap/mdb-prefix/tab.js
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): tab.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
reflow,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'tab';
|
||||||
|
const DATA_KEY = 'bs.tab';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
||||||
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
const CLASS_NAME_DISABLED = 'disabled';
|
||||||
|
const CLASS_NAME_FADE = 'fade';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
|
||||||
|
const SELECTOR_DROPDOWN = '.dropdown';
|
||||||
|
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
|
const SELECTOR_ACTIVE = '.active';
|
||||||
|
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||||
|
const SELECTOR_DATA_TOGGLE =
|
||||||
|
'[data-mdb-toggle="tab"], [data-mdb-toggle="pill"], [data-mdb-toggle="list"]';
|
||||||
|
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||||
|
const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Tab extends BaseComponent {
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (
|
||||||
|
(this._element.parentNode &&
|
||||||
|
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
|
||||||
|
this._element.classList.contains(CLASS_NAME_ACTIVE)) ||
|
||||||
|
this._element.classList.contains(CLASS_NAME_DISABLED)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let previous;
|
||||||
|
const target = getElementFromSelector(this._element);
|
||||||
|
const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
|
||||||
|
|
||||||
|
if (listElement) {
|
||||||
|
const itemSelector =
|
||||||
|
listElement.nodeName === 'UL' || listElement.nodeName === 'OL'
|
||||||
|
? SELECTOR_ACTIVE_UL
|
||||||
|
: SELECTOR_ACTIVE;
|
||||||
|
previous = SelectorEngine.find(itemSelector, listElement);
|
||||||
|
previous = previous[previous.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
let hideEvent = null;
|
||||||
|
|
||||||
|
if (previous) {
|
||||||
|
hideEvent = EventHandler.trigger(previous, EVENT_HIDE, {
|
||||||
|
relatedTarget: this._element,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
|
||||||
|
relatedTarget: previous,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (showEvent.defaultPrevented || (hideEvent !== null && hideEvent.defaultPrevented)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._activate(this._element, listElement);
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
EventHandler.trigger(previous, EVENT_HIDDEN, {
|
||||||
|
relatedTarget: this._element,
|
||||||
|
});
|
||||||
|
EventHandler.trigger(this._element, EVENT_SHOWN, {
|
||||||
|
relatedTarget: previous,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (target) {
|
||||||
|
this._activate(target, target.parentNode, complete);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_activate(element, container, callback) {
|
||||||
|
const activeElements =
|
||||||
|
container && (container.nodeName === 'UL' || container.nodeName === 'OL')
|
||||||
|
? SelectorEngine.find(SELECTOR_ACTIVE_UL, container)
|
||||||
|
: SelectorEngine.children(container, SELECTOR_ACTIVE);
|
||||||
|
|
||||||
|
const active = activeElements[0];
|
||||||
|
const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE);
|
||||||
|
|
||||||
|
const complete = () => this._transitionComplete(element, active, callback);
|
||||||
|
|
||||||
|
if (active && isTransitioning) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(active);
|
||||||
|
active.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
EventHandler.one(active, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(active, transitionDuration);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_transitionComplete(element, active, callback) {
|
||||||
|
if (active) {
|
||||||
|
active.classList.remove(CLASS_NAME_ACTIVE);
|
||||||
|
|
||||||
|
const dropdownChild = SelectorEngine.findOne(
|
||||||
|
SELECTOR_DROPDOWN_ACTIVE_CHILD,
|
||||||
|
active.parentNode
|
||||||
|
);
|
||||||
|
|
||||||
|
if (dropdownChild) {
|
||||||
|
dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (active.getAttribute('role') === 'tab') {
|
||||||
|
active.setAttribute('aria-selected', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
element.classList.add(CLASS_NAME_ACTIVE);
|
||||||
|
if (element.getAttribute('role') === 'tab') {
|
||||||
|
element.setAttribute('aria-selected', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
reflow(element);
|
||||||
|
|
||||||
|
if (element.classList.contains(CLASS_NAME_FADE)) {
|
||||||
|
element.classList.add(CLASS_NAME_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
|
||||||
|
const dropdownElement = element.closest(SELECTOR_DROPDOWN);
|
||||||
|
|
||||||
|
if (dropdownElement) {
|
||||||
|
SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach((dropdown) =>
|
||||||
|
dropdown.classList.add(CLASS_NAME_ACTIVE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.setAttribute('aria-expanded', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Data Api implementation
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||||
|
data.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Tab to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Tab.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Tab;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Tab.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Tab;
|
233
src/js/bootstrap/mdb-prefix/toast.js
Normal file
233
src/js/bootstrap/mdb-prefix/toast.js
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): toast.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
reflow,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'toast';
|
||||||
|
const DATA_KEY = 'bs.toast';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
|
||||||
|
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
|
||||||
|
const CLASS_NAME_FADE = 'fade';
|
||||||
|
const CLASS_NAME_HIDE = 'hide';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
const CLASS_NAME_SHOWING = 'showing';
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
animation: 'boolean',
|
||||||
|
autohide: 'boolean',
|
||||||
|
delay: 'number',
|
||||||
|
};
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
animation: true,
|
||||||
|
autohide: true,
|
||||||
|
delay: 5000,
|
||||||
|
};
|
||||||
|
|
||||||
|
const SELECTOR_DATA_DISMISS = '[data-mdb-dismiss="toast"]';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Toast extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
this._config = this._getConfig(config);
|
||||||
|
this._timeout = null;
|
||||||
|
this._setListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get DefaultType() {
|
||||||
|
return DefaultType;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
show() {
|
||||||
|
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
|
||||||
|
|
||||||
|
if (showEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._clearTimeout();
|
||||||
|
|
||||||
|
if (this._config.animation) {
|
||||||
|
this._element.classList.add(CLASS_NAME_FADE);
|
||||||
|
}
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
this._element.classList.remove(CLASS_NAME_SHOWING);
|
||||||
|
this._element.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
EventHandler.trigger(this._element, EVENT_SHOWN);
|
||||||
|
|
||||||
|
if (this._config.autohide) {
|
||||||
|
this._timeout = setTimeout(() => {
|
||||||
|
this.hide();
|
||||||
|
}, this._config.delay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this._element.classList.remove(CLASS_NAME_HIDE);
|
||||||
|
reflow(this._element);
|
||||||
|
this._element.classList.add(CLASS_NAME_SHOWING);
|
||||||
|
if (this._config.animation) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
|
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
||||||
|
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
this._element.classList.add(CLASS_NAME_HIDE);
|
||||||
|
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
||||||
|
};
|
||||||
|
|
||||||
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
if (this._config.animation) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
|
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
this._clearTimeout();
|
||||||
|
|
||||||
|
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
this._config = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
config = {
|
||||||
|
...Default,
|
||||||
|
...Manipulator.getDataAttributes(this._element),
|
||||||
|
...(typeof config === 'object' && config ? config : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_setListeners() {
|
||||||
|
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
||||||
|
}
|
||||||
|
|
||||||
|
_clearTimeout() {
|
||||||
|
clearTimeout(this._timeout);
|
||||||
|
this._timeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
const _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Toast(this, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config](this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Toast to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Toast.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Toast;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Toast.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Toast;
|
818
src/js/bootstrap/mdb-prefix/tooltip.js
Normal file
818
src/js/bootstrap/mdb-prefix/tooltip.js
Normal file
|
@ -0,0 +1,818 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): tooltip.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as Popper from '@popperjs/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
TRANSITION_END,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
findShadowRoot,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
getUID,
|
||||||
|
isElement,
|
||||||
|
isRTL,
|
||||||
|
noop,
|
||||||
|
typeCheckConfig,
|
||||||
|
} from './util/index';
|
||||||
|
import { DefaultAllowlist, sanitizeHtml } from './util/sanitizer';
|
||||||
|
import Data from './dom/data';
|
||||||
|
import EventHandler from './dom/event-handler';
|
||||||
|
import Manipulator from './dom/manipulator';
|
||||||
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const NAME = 'tooltip';
|
||||||
|
const DATA_KEY = 'bs.tooltip';
|
||||||
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const CLASS_PREFIX = 'bs-tooltip';
|
||||||
|
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||||
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
||||||
|
|
||||||
|
const DefaultType = {
|
||||||
|
animation: 'boolean',
|
||||||
|
template: 'string',
|
||||||
|
title: '(string|element|function)',
|
||||||
|
trigger: 'string',
|
||||||
|
delay: '(number|object)',
|
||||||
|
html: 'boolean',
|
||||||
|
selector: '(string|boolean)',
|
||||||
|
placement: '(string|function)',
|
||||||
|
container: '(string|element|boolean)',
|
||||||
|
fallbackPlacements: '(null|array)',
|
||||||
|
boundary: '(string|element)',
|
||||||
|
customClass: '(string|function)',
|
||||||
|
sanitize: 'boolean',
|
||||||
|
sanitizeFn: '(null|function)',
|
||||||
|
allowList: 'object',
|
||||||
|
popperConfig: '(null|object)',
|
||||||
|
};
|
||||||
|
|
||||||
|
const AttachmentMap = {
|
||||||
|
AUTO: 'auto',
|
||||||
|
TOP: 'top',
|
||||||
|
RIGHT: isRTL ? 'left' : 'right',
|
||||||
|
BOTTOM: 'bottom',
|
||||||
|
LEFT: isRTL ? 'right' : 'left',
|
||||||
|
};
|
||||||
|
|
||||||
|
const Default = {
|
||||||
|
animation: true,
|
||||||
|
template:
|
||||||
|
'<div class="tooltip" role="tooltip">' +
|
||||||
|
'<div class="tooltip-arrow"></div>' +
|
||||||
|
'<div class="tooltip-inner"></div>' +
|
||||||
|
'</div>',
|
||||||
|
trigger: 'hover focus',
|
||||||
|
title: '',
|
||||||
|
delay: 0,
|
||||||
|
html: false,
|
||||||
|
selector: false,
|
||||||
|
placement: 'top',
|
||||||
|
container: false,
|
||||||
|
fallbackPlacements: null,
|
||||||
|
boundary: 'clippingParents',
|
||||||
|
customClass: '',
|
||||||
|
sanitize: true,
|
||||||
|
sanitizeFn: null,
|
||||||
|
allowList: DefaultAllowlist,
|
||||||
|
popperConfig: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Event = {
|
||||||
|
HIDE: `hide${EVENT_KEY}`,
|
||||||
|
HIDDEN: `hidden${EVENT_KEY}`,
|
||||||
|
SHOW: `show${EVENT_KEY}`,
|
||||||
|
SHOWN: `shown${EVENT_KEY}`,
|
||||||
|
INSERTED: `inserted${EVENT_KEY}`,
|
||||||
|
CLICK: `click${EVENT_KEY}`,
|
||||||
|
FOCUSIN: `focusin${EVENT_KEY}`,
|
||||||
|
FOCUSOUT: `focusout${EVENT_KEY}`,
|
||||||
|
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
||||||
|
MOUSELEAVE: `mouseleave${EVENT_KEY}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
const CLASS_NAME_FADE = 'fade';
|
||||||
|
const CLASS_NAME_MODAL = 'modal';
|
||||||
|
const CLASS_NAME_SHOW = 'show';
|
||||||
|
|
||||||
|
const HOVER_STATE_SHOW = 'show';
|
||||||
|
const HOVER_STATE_OUT = 'out';
|
||||||
|
|
||||||
|
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
||||||
|
|
||||||
|
const TRIGGER_HOVER = 'hover';
|
||||||
|
const TRIGGER_FOCUS = 'focus';
|
||||||
|
const TRIGGER_CLICK = 'click';
|
||||||
|
const TRIGGER_MANUAL = 'manual';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Class Definition
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Tooltip extends BaseComponent {
|
||||||
|
constructor(element, config) {
|
||||||
|
if (typeof Popper === 'undefined') {
|
||||||
|
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
|
||||||
|
}
|
||||||
|
|
||||||
|
super(element);
|
||||||
|
|
||||||
|
// private
|
||||||
|
this._isEnabled = true;
|
||||||
|
this._timeout = 0;
|
||||||
|
this._hoverState = '';
|
||||||
|
this._activeTrigger = {};
|
||||||
|
this._popper = null;
|
||||||
|
|
||||||
|
// Protected
|
||||||
|
this.config = this._getConfig(config);
|
||||||
|
this.tip = null;
|
||||||
|
|
||||||
|
this._setListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
|
||||||
|
static get Default() {
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get NAME() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get Event() {
|
||||||
|
return Event;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get EVENT_KEY() {
|
||||||
|
return EVENT_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get DefaultType() {
|
||||||
|
return DefaultType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public
|
||||||
|
|
||||||
|
enable() {
|
||||||
|
this._isEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
disable() {
|
||||||
|
this._isEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleEnabled() {
|
||||||
|
this._isEnabled = !this._isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle(event) {
|
||||||
|
if (!this._isEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
const dataKey = this.constructor.DATA_KEY;
|
||||||
|
let context = Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
|
if (!context) {
|
||||||
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
context._activeTrigger.click = !context._activeTrigger.click;
|
||||||
|
|
||||||
|
if (context._isWithActiveTrigger()) {
|
||||||
|
context._enter(null, context);
|
||||||
|
} else {
|
||||||
|
context._leave(null, context);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
|
||||||
|
this._leave(null, this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._enter(null, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
clearTimeout(this._timeout);
|
||||||
|
|
||||||
|
EventHandler.off(this._element, this.constructor.EVENT_KEY);
|
||||||
|
EventHandler.off(
|
||||||
|
this._element.closest(`.${CLASS_NAME_MODAL}`),
|
||||||
|
'hide.bs.modal',
|
||||||
|
this._hideModalHandler
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.tip) {
|
||||||
|
this.tip.parentNode.removeChild(this.tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isEnabled = null;
|
||||||
|
this._timeout = null;
|
||||||
|
this._hoverState = null;
|
||||||
|
this._activeTrigger = null;
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._popper = null;
|
||||||
|
this.config = null;
|
||||||
|
this.tip = null;
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (this._element.style.display === 'none') {
|
||||||
|
throw new Error('Please use show on visible elements');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isWithContent() && this._isEnabled) {
|
||||||
|
const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
|
||||||
|
const shadowRoot = findShadowRoot(this._element);
|
||||||
|
const isInTheDom =
|
||||||
|
shadowRoot === null
|
||||||
|
? this._element.ownerDocument.documentElement.contains(this._element)
|
||||||
|
: shadowRoot.contains(this._element);
|
||||||
|
|
||||||
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
const tipId = getUID(this.constructor.NAME);
|
||||||
|
|
||||||
|
tip.setAttribute('id', tipId);
|
||||||
|
this._element.setAttribute('aria-describedby', tipId);
|
||||||
|
|
||||||
|
this.setContent();
|
||||||
|
|
||||||
|
if (this.config.animation) {
|
||||||
|
tip.classList.add(CLASS_NAME_FADE);
|
||||||
|
}
|
||||||
|
|
||||||
|
const placement =
|
||||||
|
typeof this.config.placement === 'function'
|
||||||
|
? this.config.placement.call(this, tip, this._element)
|
||||||
|
: this.config.placement;
|
||||||
|
|
||||||
|
const attachment = this._getAttachment(placement);
|
||||||
|
this._addAttachmentClass(attachment);
|
||||||
|
|
||||||
|
const container = this._getContainer();
|
||||||
|
Data.setData(tip, this.constructor.DATA_KEY, this);
|
||||||
|
|
||||||
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
||||||
|
container.appendChild(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
||||||
|
|
||||||
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||||
|
|
||||||
|
tip.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
const customClass =
|
||||||
|
typeof this.config.customClass === 'function'
|
||||||
|
? this.config.customClass()
|
||||||
|
: this.config.customClass;
|
||||||
|
if (customClass) {
|
||||||
|
tip.classList.add(...customClass.split(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is a touch-enabled device we add extra
|
||||||
|
// empty mouseover listeners to the body's immediate children;
|
||||||
|
// only needed because of broken event delegation on iOS
|
||||||
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||||
|
if ('ontouchstart' in document.documentElement) {
|
||||||
|
[].concat(...document.body.children).forEach((element) => {
|
||||||
|
EventHandler.on(element, 'mouseover', noop());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const complete = () => {
|
||||||
|
const prevHoverState = this._hoverState;
|
||||||
|
|
||||||
|
this._hoverState = null;
|
||||||
|
EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
|
||||||
|
|
||||||
|
if (prevHoverState === HOVER_STATE_OUT) {
|
||||||
|
this._leave(null, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(this.tip);
|
||||||
|
EventHandler.one(this.tip, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this.tip, transitionDuration);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hide() {
|
||||||
|
if (!this._popper) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
const complete = () => {
|
||||||
|
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||||
|
tip.parentNode.removeChild(tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._cleanTipClass();
|
||||||
|
this._element.removeAttribute('aria-describedby');
|
||||||
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
||||||
|
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy();
|
||||||
|
this._popper = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
||||||
|
if (hideEvent.defaultPrevented) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tip.classList.remove(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
// If this is a touch-enabled device we remove the extra
|
||||||
|
// empty mouseover listeners we added for iOS support
|
||||||
|
if ('ontouchstart' in document.documentElement) {
|
||||||
|
[]
|
||||||
|
.concat(...document.body.children)
|
||||||
|
.forEach((element) => EventHandler.off(element, 'mouseover', noop));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
||||||
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
||||||
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
||||||
|
|
||||||
|
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
||||||
|
const transitionDuration = getTransitionDurationFromElement(tip);
|
||||||
|
|
||||||
|
EventHandler.one(tip, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(tip, transitionDuration);
|
||||||
|
} else {
|
||||||
|
complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._hoverState = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
if (this._popper !== null) {
|
||||||
|
this._popper.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Protected
|
||||||
|
|
||||||
|
isWithContent() {
|
||||||
|
return Boolean(this.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
getTipElement() {
|
||||||
|
if (this.tip) {
|
||||||
|
return this.tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
const element = document.createElement('div');
|
||||||
|
element.innerHTML = this.config.template;
|
||||||
|
|
||||||
|
this.tip = element.children[0];
|
||||||
|
return this.tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
setContent() {
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
|
||||||
|
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
setElementContent(element, content) {
|
||||||
|
if (element === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof content === 'object' && isElement(content)) {
|
||||||
|
if (content.jquery) {
|
||||||
|
content = content[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// content is a DOM node or a jQuery
|
||||||
|
if (this.config.html) {
|
||||||
|
if (content.parentNode !== element) {
|
||||||
|
element.innerHTML = '';
|
||||||
|
element.appendChild(content);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
element.textContent = content.textContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.config.html) {
|
||||||
|
if (this.config.sanitize) {
|
||||||
|
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.innerHTML = content;
|
||||||
|
} else {
|
||||||
|
element.textContent = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle() {
|
||||||
|
let title = this._element.getAttribute('data-mdb-original-title');
|
||||||
|
|
||||||
|
if (!title) {
|
||||||
|
title =
|
||||||
|
typeof this.config.title === 'function'
|
||||||
|
? this.config.title.call(this._element)
|
||||||
|
: this.config.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAttachment(attachment) {
|
||||||
|
if (attachment === 'right') {
|
||||||
|
return 'end';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attachment === 'left') {
|
||||||
|
return 'start';
|
||||||
|
}
|
||||||
|
|
||||||
|
return attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
_getPopperConfig(attachment) {
|
||||||
|
const flipModifier = {
|
||||||
|
name: 'flip',
|
||||||
|
options: {
|
||||||
|
altBoundary: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.config.fallbackPlacements) {
|
||||||
|
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultBsConfig = {
|
||||||
|
placement: attachment,
|
||||||
|
modifiers: [
|
||||||
|
flipModifier,
|
||||||
|
{
|
||||||
|
name: 'preventOverflow',
|
||||||
|
options: {
|
||||||
|
rootBoundary: this.config.boundary,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'arrow',
|
||||||
|
options: {
|
||||||
|
element: `.${this.constructor.NAME}-arrow`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'onChange',
|
||||||
|
enabled: true,
|
||||||
|
phase: 'afterWrite',
|
||||||
|
fn: (data) => this._handlePopperPlacementChange(data),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onFirstUpdate: (data) => {
|
||||||
|
if (data.options.placement !== data.placement) {
|
||||||
|
this._handlePopperPlacementChange(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...defaultBsConfig,
|
||||||
|
...this.config.popperConfig,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
_addAttachmentClass(attachment) {
|
||||||
|
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getContainer() {
|
||||||
|
if (this.config.container === false) {
|
||||||
|
return document.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isElement(this.config.container)) {
|
||||||
|
return this.config.container;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SelectorEngine.findOne(this.config.container);
|
||||||
|
}
|
||||||
|
|
||||||
|
_getAttachment(placement) {
|
||||||
|
return AttachmentMap[placement.toUpperCase()];
|
||||||
|
}
|
||||||
|
|
||||||
|
_setListeners() {
|
||||||
|
const triggers = this.config.trigger.split(' ');
|
||||||
|
|
||||||
|
triggers.forEach((trigger) => {
|
||||||
|
if (trigger === 'click') {
|
||||||
|
EventHandler.on(
|
||||||
|
this._element,
|
||||||
|
this.constructor.Event.CLICK,
|
||||||
|
this.config.selector,
|
||||||
|
(event) => this.toggle(event)
|
||||||
|
);
|
||||||
|
} else if (trigger !== TRIGGER_MANUAL) {
|
||||||
|
const eventIn =
|
||||||
|
trigger === TRIGGER_HOVER
|
||||||
|
? this.constructor.Event.MOUSEENTER
|
||||||
|
: this.constructor.Event.FOCUSIN;
|
||||||
|
const eventOut =
|
||||||
|
trigger === TRIGGER_HOVER
|
||||||
|
? this.constructor.Event.MOUSELEAVE
|
||||||
|
: this.constructor.Event.FOCUSOUT;
|
||||||
|
|
||||||
|
EventHandler.on(this._element, eventIn, this.config.selector, (event) =>
|
||||||
|
this._enter(event)
|
||||||
|
);
|
||||||
|
EventHandler.on(this._element, eventOut, this.config.selector, (event) =>
|
||||||
|
this._leave(event)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this._hideModalHandler = () => {
|
||||||
|
if (this._element) {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EventHandler.on(
|
||||||
|
this._element.closest(`.${CLASS_NAME_MODAL}`),
|
||||||
|
'hide.bs.modal',
|
||||||
|
this._hideModalHandler
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.config.selector) {
|
||||||
|
this.config = {
|
||||||
|
...this.config,
|
||||||
|
trigger: 'manual',
|
||||||
|
selector: '',
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this._fixTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_fixTitle() {
|
||||||
|
const title = this._element.getAttribute('title');
|
||||||
|
const originalTitleType = typeof this._element.getAttribute('data-mdb-original-title');
|
||||||
|
|
||||||
|
if (title || originalTitleType !== 'string') {
|
||||||
|
this._element.setAttribute('data-mdb-original-title', title || '');
|
||||||
|
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||||
|
this._element.setAttribute('aria-label', title);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.setAttribute('title', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_enter(event, context) {
|
||||||
|
const dataKey = this.constructor.DATA_KEY;
|
||||||
|
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
|
if (!context) {
|
||||||
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
context.getTipElement().classList.contains(CLASS_NAME_SHOW) ||
|
||||||
|
context._hoverState === HOVER_STATE_SHOW
|
||||||
|
) {
|
||||||
|
context._hoverState = HOVER_STATE_SHOW;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTimeout(context._timeout);
|
||||||
|
|
||||||
|
context._hoverState = HOVER_STATE_SHOW;
|
||||||
|
|
||||||
|
if (!context.config.delay || !context.config.delay.show) {
|
||||||
|
context.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context._timeout = setTimeout(() => {
|
||||||
|
if (context._hoverState === HOVER_STATE_SHOW) {
|
||||||
|
context.show();
|
||||||
|
}
|
||||||
|
}, context.config.delay.show);
|
||||||
|
}
|
||||||
|
|
||||||
|
_leave(event, context) {
|
||||||
|
const dataKey = this.constructor.DATA_KEY;
|
||||||
|
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
|
if (!context) {
|
||||||
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context._isWithActiveTrigger()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTimeout(context._timeout);
|
||||||
|
|
||||||
|
context._hoverState = HOVER_STATE_OUT;
|
||||||
|
|
||||||
|
if (!context.config.delay || !context.config.delay.hide) {
|
||||||
|
context.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context._timeout = setTimeout(() => {
|
||||||
|
if (context._hoverState === HOVER_STATE_OUT) {
|
||||||
|
context.hide();
|
||||||
|
}
|
||||||
|
}, context.config.delay.hide);
|
||||||
|
}
|
||||||
|
|
||||||
|
_isWithActiveTrigger() {
|
||||||
|
for (const trigger in this._activeTrigger) {
|
||||||
|
if (this._activeTrigger[trigger]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getConfig(config) {
|
||||||
|
const dataAttributes = Manipulator.getDataAttributes(this._element);
|
||||||
|
|
||||||
|
Object.keys(dataAttributes).forEach((dataAttr) => {
|
||||||
|
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
|
||||||
|
delete dataAttributes[dataAttr];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (config && typeof config.container === 'object' && config.container.jquery) {
|
||||||
|
config.container = config.container[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
config = {
|
||||||
|
...this.constructor.Default,
|
||||||
|
...dataAttributes,
|
||||||
|
...(typeof config === 'object' && config ? config : {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof config.delay === 'number') {
|
||||||
|
config.delay = {
|
||||||
|
show: config.delay,
|
||||||
|
hide: config.delay,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config.title === 'number') {
|
||||||
|
config.title = config.title.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config.content === 'number') {
|
||||||
|
config.content = config.content.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
|
|
||||||
|
if (config.sanitize) {
|
||||||
|
config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getDelegateConfig() {
|
||||||
|
const config = {};
|
||||||
|
|
||||||
|
if (this.config) {
|
||||||
|
for (const key in this.config) {
|
||||||
|
if (this.constructor.Default[key] !== this.config[key]) {
|
||||||
|
config[key] = this.config[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cleanTipClass() {
|
||||||
|
const tip = this.getTipElement();
|
||||||
|
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||||
|
if (tabClass !== null && tabClass.length > 0) {
|
||||||
|
tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_handlePopperPlacementChange(popperData) {
|
||||||
|
const { state } = popperData;
|
||||||
|
|
||||||
|
if (!state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tip = state.elements.popper;
|
||||||
|
this._cleanTipClass();
|
||||||
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static
|
||||||
|
|
||||||
|
static jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
let data = Data.getData(this, DATA_KEY);
|
||||||
|
const _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
|
if (!data && /dispose|hide/.test(config)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = new Tooltip(this, _config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* jQuery
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Tooltip to jQuery only if jQuery is present
|
||||||
|
*/
|
||||||
|
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
/* istanbul ignore if */
|
||||||
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Tooltip.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Tooltip;
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Tooltip.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Tooltip;
|
215
src/js/bootstrap/mdb-prefix/util/index.js
Normal file
215
src/js/bootstrap/mdb-prefix/util/index.js
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const MAX_UID = 1000000;
|
||||||
|
const MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
const TRANSITION_END = 'transitionend';
|
||||||
|
|
||||||
|
// Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
const toType = (obj) => {
|
||||||
|
if (obj === null || obj === undefined) {
|
||||||
|
return `${obj}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}.toString
|
||||||
|
.call(obj)
|
||||||
|
.match(/\s([a-z]+)/i)[1]
|
||||||
|
.toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Public Util Api
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const getUID = (prefix) => {
|
||||||
|
do {
|
||||||
|
prefix += Math.floor(Math.random() * MAX_UID);
|
||||||
|
} while (document.getElementById(prefix));
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSelector = (element) => {
|
||||||
|
let selector = element.getAttribute('data-mdb-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
const hrefAttr = element.getAttribute('href');
|
||||||
|
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return selector;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSelectorFromElement = (element) => {
|
||||||
|
const selector = getSelector(element);
|
||||||
|
|
||||||
|
if (selector) {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getElementFromSelector = (element) => {
|
||||||
|
const selector = getSelector(element);
|
||||||
|
|
||||||
|
return selector ? document.querySelector(selector) : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTransitionDurationFromElement = (element) => {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get transition-duration of the element
|
||||||
|
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||||
|
|
||||||
|
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
|
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
||||||
|
|
||||||
|
// Return 0 if element or transition duration is not found
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If multiple durations are defined, take the first
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const triggerTransitionEnd = (element) => {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||||
|
|
||||||
|
const emulateTransitionEnd = (element, duration) => {
|
||||||
|
let called = false;
|
||||||
|
const durationPadding = 5;
|
||||||
|
const emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||||
|
Object.keys(configTypes).forEach((property) => {
|
||||||
|
const expectedTypes = configTypes[property];
|
||||||
|
const value = config[property];
|
||||||
|
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(
|
||||||
|
`${componentName.toUpperCase()}: ` +
|
||||||
|
`Option "${property}" provided type "${valueType}" ` +
|
||||||
|
`but expected type "${expectedTypes}".`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const isVisible = (element) => {
|
||||||
|
if (!element) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.style && element.parentNode && element.parentNode.style) {
|
||||||
|
const elementStyle = getComputedStyle(element);
|
||||||
|
const parentNodeStyle = getComputedStyle(element.parentNode);
|
||||||
|
|
||||||
|
return (
|
||||||
|
elementStyle.display !== 'none' &&
|
||||||
|
parentNodeStyle.display !== 'none' &&
|
||||||
|
elementStyle.visibility !== 'hidden'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const findShadowRoot = (element) => {
|
||||||
|
if (!document.documentElement.attachShadow) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can find the shadow root otherwise it'll return the document
|
||||||
|
if (typeof element.getRootNode === 'function') {
|
||||||
|
const root = element.getRootNode();
|
||||||
|
return root instanceof ShadowRoot ? root : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element instanceof ShadowRoot) {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
// when we don't find a shadow root
|
||||||
|
if (!element.parentNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findShadowRoot(element.parentNode);
|
||||||
|
};
|
||||||
|
|
||||||
|
const noop = () => function () {};
|
||||||
|
|
||||||
|
const reflow = (element) => element.offsetHeight;
|
||||||
|
|
||||||
|
const getjQuery = () => {
|
||||||
|
const { jQuery } = window;
|
||||||
|
|
||||||
|
if (jQuery && !document.body.hasAttribute('data-mdb-no-jquery')) {
|
||||||
|
return jQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDOMContentLoaded = (callback) => {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
|
export {
|
||||||
|
TRANSITION_END,
|
||||||
|
getUID,
|
||||||
|
getSelectorFromElement,
|
||||||
|
getElementFromSelector,
|
||||||
|
getTransitionDurationFromElement,
|
||||||
|
triggerTransitionEnd,
|
||||||
|
isElement,
|
||||||
|
emulateTransitionEnd,
|
||||||
|
typeCheckConfig,
|
||||||
|
isVisible,
|
||||||
|
findShadowRoot,
|
||||||
|
noop,
|
||||||
|
reflow,
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
isRTL,
|
||||||
|
};
|
129
src/js/bootstrap/mdb-prefix/util/sanitizer.js
Normal file
129
src/js/bootstrap/mdb-prefix/util/sanitizer.js
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): util/sanitizer.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const uriAttrs = new Set([
|
||||||
|
'background',
|
||||||
|
'cite',
|
||||||
|
'href',
|
||||||
|
'itemtype',
|
||||||
|
'longdesc',
|
||||||
|
'poster',
|
||||||
|
'src',
|
||||||
|
'xlink:href',
|
||||||
|
]);
|
||||||
|
|
||||||
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
||||||
|
*
|
||||||
|
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||||
|
*/
|
||||||
|
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
||||||
|
*
|
||||||
|
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
|
const allowedAttribute = (attr, allowedAttributeList) => {
|
||||||
|
const attrName = attr.nodeName.toLowerCase();
|
||||||
|
|
||||||
|
if (allowedAttributeList.includes(attrName)) {
|
||||||
|
if (uriAttrs.has(attrName)) {
|
||||||
|
return Boolean(
|
||||||
|
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const regExp = allowedAttributeList.filter((attrRegex) => attrRegex instanceof RegExp);
|
||||||
|
|
||||||
|
// Check if a regular expression validates the attribute.
|
||||||
|
for (let i = 0, len = regExp.length; i < len; i++) {
|
||||||
|
if (attrName.match(regExp[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DefaultAllowlist = {
|
||||||
|
// Global attributes allowed on any supplied element below.
|
||||||
|
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
||||||
|
a: ['target', 'href', 'title', 'rel'],
|
||||||
|
area: [],
|
||||||
|
b: [],
|
||||||
|
br: [],
|
||||||
|
col: [],
|
||||||
|
code: [],
|
||||||
|
div: [],
|
||||||
|
em: [],
|
||||||
|
hr: [],
|
||||||
|
h1: [],
|
||||||
|
h2: [],
|
||||||
|
h3: [],
|
||||||
|
h4: [],
|
||||||
|
h5: [],
|
||||||
|
h6: [],
|
||||||
|
i: [],
|
||||||
|
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
||||||
|
li: [],
|
||||||
|
ol: [],
|
||||||
|
p: [],
|
||||||
|
pre: [],
|
||||||
|
s: [],
|
||||||
|
small: [],
|
||||||
|
span: [],
|
||||||
|
sub: [],
|
||||||
|
sup: [],
|
||||||
|
strong: [],
|
||||||
|
u: [],
|
||||||
|
ul: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
||||||
|
if (!unsafeHtml.length) {
|
||||||
|
return unsafeHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sanitizeFn && typeof sanitizeFn === 'function') {
|
||||||
|
return sanitizeFn(unsafeHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
const domParser = new window.DOMParser();
|
||||||
|
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
||||||
|
const allowlistKeys = Object.keys(allowList);
|
||||||
|
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
||||||
|
|
||||||
|
for (let i = 0, len = elements.length; i < len; i++) {
|
||||||
|
const el = elements[i];
|
||||||
|
const elName = el.nodeName.toLowerCase();
|
||||||
|
|
||||||
|
if (!allowlistKeys.includes(elName)) {
|
||||||
|
el.parentNode.removeChild(el);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const attributeList = [].concat(...el.attributes);
|
||||||
|
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
|
||||||
|
|
||||||
|
attributeList.forEach((attr) => {
|
||||||
|
if (!allowedAttribute(attr, allowedAttributes)) {
|
||||||
|
el.removeAttribute(attr.nodeName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return createdDocument.body.innerHTML;
|
||||||
|
}
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): alert.js
|
* Bootstrap (v5.0.0-beta1): alert.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
|
@ -14,6 +15,7 @@ import {
|
||||||
} from './util/index';
|
} from './util/index';
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -22,12 +24,11 @@ import EventHandler from './dom/event-handler';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'alert';
|
const NAME = 'alert';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.alert';
|
const DATA_KEY = 'bs.alert';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
const SELECTOR_DISMISS = '[data-dismiss="alert"]';
|
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
||||||
|
|
||||||
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
||||||
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
||||||
|
@ -43,19 +44,11 @@ const CLASSNAME_SHOW = 'show';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Alert {
|
class Alert extends BaseComponent {
|
||||||
constructor(element) {
|
|
||||||
this._element = element;
|
|
||||||
|
|
||||||
if (this._element) {
|
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
static get DATA_KEY() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
@ -71,11 +64,6 @@ class Alert {
|
||||||
this._removeElement(rootElement);
|
this._removeElement(rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
_getRootElement(element) {
|
_getRootElement(element) {
|
||||||
|
@ -133,10 +121,6 @@ class Alert {
|
||||||
alertInstance.close(this);
|
alertInstance.close(this);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,24 +130,25 @@ class Alert {
|
||||||
*/
|
*/
|
||||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .alert to jQuery only if jQuery is present
|
* add .Alert to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* istanbul ignore if */
|
onDOMContentLoaded(() => {
|
||||||
if ($) {
|
const $ = getjQuery();
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
/* istanbul ignore if */
|
||||||
$.fn[NAME] = Alert.jQueryInterface;
|
if ($) {
|
||||||
$.fn[NAME].Constructor = Alert;
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME] = Alert.jQueryInterface;
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME].Constructor = Alert;
|
||||||
return Alert.jQueryInterface;
|
$.fn[NAME].noConflict = () => {
|
||||||
};
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
}
|
return Alert.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Alert;
|
export default Alert;
|
||||||
|
|
44
src/js/bootstrap/src/base-component.js
Normal file
44
src/js/bootstrap/src/base-component.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v5.0.0-beta1): base-component.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Data from './dom/data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const VERSION = '5.0.0-beta1';
|
||||||
|
|
||||||
|
class BaseComponent {
|
||||||
|
constructor(element) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element = element;
|
||||||
|
Data.setData(element, this.constructor.DATA_KEY, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
Data.removeData(this._element, this.constructor.DATA_KEY);
|
||||||
|
this._element = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Static */
|
||||||
|
|
||||||
|
static getInstance(element) {
|
||||||
|
return Data.getData(element, this.DATA_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
static get VERSION() {
|
||||||
|
return VERSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BaseComponent;
|
|
@ -1,13 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): button.js
|
* Bootstrap (v5.0.0-beta1): button.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getjQuery } from './util/index';
|
import { getjQuery, onDOMContentLoaded } from './util/index';
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -16,14 +17,13 @@ import EventHandler from './dom/event-handler';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'button';
|
const NAME = 'button';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.button';
|
const DATA_KEY = 'bs.button';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
const CLASS_NAME_ACTIVE = 'active';
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
|
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
|
||||||
|
|
||||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
|
@ -33,16 +33,11 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Button {
|
class Button extends BaseComponent {
|
||||||
constructor(element) {
|
|
||||||
this._element = element;
|
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
static get DATA_KEY() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
@ -52,11 +47,6 @@ class Button {
|
||||||
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
|
||||||
static jQueryInterface(config) {
|
static jQueryInterface(config) {
|
||||||
|
@ -72,10 +62,6 @@ class Button {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,24 +83,26 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
|
||||||
data.toggle();
|
data.toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .button to jQuery only if jQuery is present
|
* add .Button to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
$.fn[NAME] = Button.jQueryInterface;
|
|
||||||
$.fn[NAME].Constructor = Button;
|
|
||||||
|
|
||||||
$.fn[NAME].noConflict = () => {
|
onDOMContentLoaded(() => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
const $ = getjQuery();
|
||||||
return Button.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
};
|
if ($) {
|
||||||
}
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
|
$.fn[NAME] = Button.jQueryInterface;
|
||||||
|
$.fn[NAME].Constructor = Button;
|
||||||
|
|
||||||
|
$.fn[NAME].noConflict = () => {
|
||||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Button.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Button;
|
export default Button;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): carousel.js
|
* Bootstrap (v5.0.0-beta1): carousel.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
|
@ -20,6 +21,7 @@ import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -28,7 +30,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'carousel';
|
const NAME = 'carousel';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.carousel';
|
const DATA_KEY = 'bs.carousel';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -78,8 +79,8 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
const CLASS_NAME_CAROUSEL = 'carousel';
|
const CLASS_NAME_CAROUSEL = 'carousel';
|
||||||
const CLASS_NAME_ACTIVE = 'active';
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
const CLASS_NAME_SLIDE = 'slide';
|
const CLASS_NAME_SLIDE = 'slide';
|
||||||
const CLASS_NAME_RIGHT = 'carousel-item-right';
|
const CLASS_NAME_END = 'carousel-item-end';
|
||||||
const CLASS_NAME_LEFT = 'carousel-item-left';
|
const CLASS_NAME_START = 'carousel-item-start';
|
||||||
const CLASS_NAME_NEXT = 'carousel-item-next';
|
const CLASS_NAME_NEXT = 'carousel-item-next';
|
||||||
const CLASS_NAME_PREV = 'carousel-item-prev';
|
const CLASS_NAME_PREV = 'carousel-item-prev';
|
||||||
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
||||||
|
@ -90,8 +91,8 @@ const SELECTOR_ITEM = '.carousel-item';
|
||||||
const SELECTOR_ITEM_IMG = '.carousel-item img';
|
const SELECTOR_ITEM_IMG = '.carousel-item img';
|
||||||
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
||||||
const SELECTOR_INDICATORS = '.carousel-indicators';
|
const SELECTOR_INDICATORS = '.carousel-indicators';
|
||||||
const SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
|
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
|
||||||
const SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
|
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
|
||||||
|
|
||||||
const PointerType = {
|
const PointerType = {
|
||||||
TOUCH: 'touch',
|
TOUCH: 'touch',
|
||||||
|
@ -103,8 +104,10 @@ const PointerType = {
|
||||||
* Class Definition
|
* Class Definition
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
class Carousel {
|
class Carousel extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
this._items = null;
|
this._items = null;
|
||||||
this._interval = null;
|
this._interval = null;
|
||||||
this._activeElement = null;
|
this._activeElement = null;
|
||||||
|
@ -115,26 +118,24 @@ class Carousel {
|
||||||
this.touchDeltaX = 0;
|
this.touchDeltaX = 0;
|
||||||
|
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._element = element;
|
|
||||||
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
|
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
|
||||||
this._touchSupported =
|
this._touchSupported =
|
||||||
'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
||||||
this._pointerEvent = Boolean(window.PointerEvent);
|
this._pointerEvent = Boolean(window.PointerEvent);
|
||||||
|
|
||||||
this._addEventListeners();
|
this._addEventListeners();
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
next() {
|
next() {
|
||||||
|
@ -182,6 +183,8 @@ class Carousel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config && this._config.interval && !this._isPaused) {
|
if (this._config && this._config.interval && !this._isPaused) {
|
||||||
|
this._updateInterval();
|
||||||
|
|
||||||
this._interval = setInterval(
|
this._interval = setInterval(
|
||||||
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
|
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
|
||||||
this._config.interval
|
this._config.interval
|
||||||
|
@ -214,12 +217,11 @@ class Carousel {
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
EventHandler.off(this._element, EVENT_KEY);
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
|
|
||||||
this._items = null;
|
this._items = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
|
||||||
this._interval = null;
|
this._interval = null;
|
||||||
this._isPaused = null;
|
this._isPaused = null;
|
||||||
this._isSliding = null;
|
this._isSliding = null;
|
||||||
|
@ -396,6 +398,7 @@ class Carousel {
|
||||||
_setActiveIndicatorElement(element) {
|
_setActiveIndicatorElement(element) {
|
||||||
if (this._indicatorsElement) {
|
if (this._indicatorsElement) {
|
||||||
const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
|
const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
|
||||||
|
|
||||||
for (let i = 0; i < indicators.length; i++) {
|
for (let i = 0; i < indicators.length; i++) {
|
||||||
indicators[i].classList.remove(CLASS_NAME_ACTIVE);
|
indicators[i].classList.remove(CLASS_NAME_ACTIVE);
|
||||||
}
|
}
|
||||||
|
@ -408,6 +411,24 @@ class Carousel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updateInterval() {
|
||||||
|
const element =
|
||||||
|
this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
|
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
|
||||||
|
|
||||||
|
if (elementInterval) {
|
||||||
|
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
||||||
|
this._config.interval = elementInterval;
|
||||||
|
} else {
|
||||||
|
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_slide(direction, element) {
|
_slide(direction, element) {
|
||||||
const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||||
const activeElementIndex = this._getItemIndex(activeElement);
|
const activeElementIndex = this._getItemIndex(activeElement);
|
||||||
|
@ -422,11 +443,11 @@ class Carousel {
|
||||||
let eventDirectionName;
|
let eventDirectionName;
|
||||||
|
|
||||||
if (direction === DIRECTION_NEXT) {
|
if (direction === DIRECTION_NEXT) {
|
||||||
directionalClassName = CLASS_NAME_LEFT;
|
directionalClassName = CLASS_NAME_START;
|
||||||
orderClassName = CLASS_NAME_NEXT;
|
orderClassName = CLASS_NAME_NEXT;
|
||||||
eventDirectionName = DIRECTION_LEFT;
|
eventDirectionName = DIRECTION_LEFT;
|
||||||
} else {
|
} else {
|
||||||
directionalClassName = CLASS_NAME_RIGHT;
|
directionalClassName = CLASS_NAME_END;
|
||||||
orderClassName = CLASS_NAME_PREV;
|
orderClassName = CLASS_NAME_PREV;
|
||||||
eventDirectionName = DIRECTION_RIGHT;
|
eventDirectionName = DIRECTION_RIGHT;
|
||||||
}
|
}
|
||||||
|
@ -453,6 +474,7 @@ class Carousel {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setActiveIndicatorElement(nextElement);
|
this._setActiveIndicatorElement(nextElement);
|
||||||
|
this._activeElement = nextElement;
|
||||||
|
|
||||||
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
||||||
nextElement.classList.add(orderClassName);
|
nextElement.classList.add(orderClassName);
|
||||||
|
@ -462,14 +484,6 @@ class Carousel {
|
||||||
activeElement.classList.add(directionalClassName);
|
activeElement.classList.add(directionalClassName);
|
||||||
nextElement.classList.add(directionalClassName);
|
nextElement.classList.add(directionalClassName);
|
||||||
|
|
||||||
const nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
|
||||||
if (nextElementInterval) {
|
|
||||||
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
|
||||||
this._config.interval = nextElementInterval;
|
|
||||||
} else {
|
|
||||||
this._config.interval = this._config.defaultInterval || this._config.interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
const transitionDuration = getTransitionDurationFromElement(activeElement);
|
const transitionDuration = getTransitionDurationFromElement(activeElement);
|
||||||
|
|
||||||
EventHandler.one(activeElement, TRANSITION_END, () => {
|
EventHandler.one(activeElement, TRANSITION_END, () => {
|
||||||
|
@ -562,7 +576,7 @@ class Carousel {
|
||||||
...Manipulator.getDataAttributes(target),
|
...Manipulator.getDataAttributes(target),
|
||||||
...Manipulator.getDataAttributes(this),
|
...Manipulator.getDataAttributes(this),
|
||||||
};
|
};
|
||||||
const slideIndex = this.getAttribute('data-slide-to');
|
const slideIndex = this.getAttribute('data-bs-slide-to');
|
||||||
|
|
||||||
if (slideIndex) {
|
if (slideIndex) {
|
||||||
config.interval = false;
|
config.interval = false;
|
||||||
|
@ -576,10 +590,6 @@ class Carousel {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -598,23 +608,25 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .carousel to jQuery only if jQuery is present
|
* add .Carousel to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Carousel.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Carousel;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Carousel.jQueryInterface;
|
||||||
return Carousel.jQueryInterface;
|
$.fn[NAME].Constructor = Carousel;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Carousel.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Carousel;
|
export default Carousel;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): collapse.js
|
* Bootstrap (v5.0.0-beta1): collapse.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getSelectorFromElement,
|
getSelectorFromElement,
|
||||||
|
@ -20,6 +21,7 @@ import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -28,7 +30,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'collapse';
|
const NAME = 'collapse';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.collapse';
|
const DATA_KEY = 'bs.collapse';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -58,7 +59,7 @@ const WIDTH = 'width';
|
||||||
const HEIGHT = 'height';
|
const HEIGHT = 'height';
|
||||||
|
|
||||||
const SELECTOR_ACTIVES = '.show, .collapsing';
|
const SELECTOR_ACTIVES = '.show, .collapsing';
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
|
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -66,14 +67,15 @@ const SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Collapse {
|
class Collapse extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
this._element = element;
|
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._triggerArray = SelectorEngine.find(
|
this._triggerArray = SelectorEngine.find(
|
||||||
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
|
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
|
||||||
`${SELECTOR_DATA_TOGGLE}[data-target="#${element.id}"]`
|
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${element.id}"]`
|
||||||
);
|
);
|
||||||
|
|
||||||
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||||
|
@ -100,20 +102,18 @@ class Collapse {
|
||||||
if (this._config.toggle) {
|
if (this._config.toggle) {
|
||||||
this.toggle();
|
this.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
toggle() {
|
toggle() {
|
||||||
|
@ -135,7 +135,7 @@ class Collapse {
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
|
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter((elem) => {
|
||||||
if (typeof this._config.parent === 'string') {
|
if (typeof this._config.parent === 'string') {
|
||||||
return elem.getAttribute('data-parent') === this._config.parent;
|
return elem.getAttribute('data-bs-parent') === this._config.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
||||||
|
@ -148,8 +148,8 @@ class Collapse {
|
||||||
|
|
||||||
const container = SelectorEngine.findOne(this._selector);
|
const container = SelectorEngine.findOne(this._selector);
|
||||||
if (actives) {
|
if (actives) {
|
||||||
const tempActiveData = actives.filter((elem) => container !== elem);
|
const tempActiveData = actives.find((elem) => container !== elem);
|
||||||
activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null;
|
activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null;
|
||||||
|
|
||||||
if (activesData && activesData._isTransitioning) {
|
if (activesData && activesData._isTransitioning) {
|
||||||
return;
|
return;
|
||||||
|
@ -263,11 +263,9 @@ class Collapse {
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
Data.removeData(this._element, DATA_KEY);
|
super.dispose();
|
||||||
|
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
this._element = null;
|
|
||||||
this._triggerArray = null;
|
this._triggerArray = null;
|
||||||
this._isTransitioning = null;
|
this._isTransitioning = null;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +298,7 @@ class Collapse {
|
||||||
parent = SelectorEngine.findOne(parent);
|
parent = SelectorEngine.findOne(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const selector = `${SELECTOR_DATA_TOGGLE}[data-parent="${parent}"]`;
|
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
|
||||||
|
|
||||||
SelectorEngine.find(selector, parent).forEach((element) => {
|
SelectorEngine.find(selector, parent).forEach((element) => {
|
||||||
const selected = getElementFromSelector(element);
|
const selected = getElementFromSelector(element);
|
||||||
|
@ -361,10 +359,6 @@ class Collapse {
|
||||||
Collapse.collapseInterface(this, config);
|
Collapse.collapseInterface(this, config);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,23 +396,25 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .collapse to jQuery only if jQuery is present
|
* add .Collapse to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Collapse.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Collapse;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Collapse.jQueryInterface;
|
||||||
return Collapse.jQueryInterface;
|
$.fn[NAME].Constructor = Collapse;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Collapse.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Collapse;
|
export default Collapse;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/data.js
|
* Bootstrap (v5.0.0-beta1): dom/data.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/event-handler.js
|
* Bootstrap (v5.0.0-beta1): dom/event-handler.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getjQuery } from '../util/index';
|
import { getjQuery } from '../util/index';
|
||||||
import { defaultPreventedPreservedOnDispatch } from './polyfill';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -14,7 +13,6 @@ import { defaultPreventedPreservedOnDispatch } from './polyfill';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||||
const stripNameRegex = /\..*/;
|
const stripNameRegex = /\..*/;
|
||||||
const stripUidRegex = /::\d+$/;
|
const stripUidRegex = /::\d+$/;
|
||||||
|
@ -24,7 +22,7 @@ const customEvents = {
|
||||||
mouseenter: 'mouseover',
|
mouseenter: 'mouseover',
|
||||||
mouseleave: 'mouseout',
|
mouseleave: 'mouseout',
|
||||||
};
|
};
|
||||||
const nativeEvents = [
|
const nativeEvents = new Set([
|
||||||
'click',
|
'click',
|
||||||
'dblclick',
|
'dblclick',
|
||||||
'mouseup',
|
'mouseup',
|
||||||
|
@ -71,7 +69,7 @@ const nativeEvents = [
|
||||||
'error',
|
'error',
|
||||||
'abort',
|
'abort',
|
||||||
'scroll',
|
'scroll',
|
||||||
];
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -153,7 +151,7 @@ function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
||||||
typeEvent = custom;
|
typeEvent = custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNative = nativeEvents.indexOf(typeEvent) > -1;
|
const isNative = nativeEvents.has(typeEvent);
|
||||||
|
|
||||||
if (!isNative) {
|
if (!isNative) {
|
||||||
typeEvent = originalTypeEvent;
|
typeEvent = originalTypeEvent;
|
||||||
|
@ -216,7 +214,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||||
const storeElementEvent = events[typeEvent] || {};
|
const storeElementEvent = events[typeEvent] || {};
|
||||||
|
|
||||||
Object.keys(storeElementEvent).forEach((handlerKey) => {
|
Object.keys(storeElementEvent).forEach((handlerKey) => {
|
||||||
if (handlerKey.indexOf(namespace) > -1) {
|
if (handlerKey.includes(namespace)) {
|
||||||
const event = storeElementEvent[handlerKey];
|
const event = storeElementEvent[handlerKey];
|
||||||
|
|
||||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
@ -245,7 +243,7 @@ const EventHandler = {
|
||||||
);
|
);
|
||||||
const inNamespace = typeEvent !== originalTypeEvent;
|
const inNamespace = typeEvent !== originalTypeEvent;
|
||||||
const events = getEvent(element);
|
const events = getEvent(element);
|
||||||
const isNamespace = originalTypeEvent.charAt(0) === '.';
|
const isNamespace = originalTypeEvent.startsWith('.');
|
||||||
|
|
||||||
if (typeof originalHandler !== 'undefined') {
|
if (typeof originalHandler !== 'undefined') {
|
||||||
// Simplest case: handler is passed, remove that listener ONLY.
|
// Simplest case: handler is passed, remove that listener ONLY.
|
||||||
|
@ -267,7 +265,7 @@ const EventHandler = {
|
||||||
Object.keys(storeElementEvent).forEach((keyHandlers) => {
|
Object.keys(storeElementEvent).forEach((keyHandlers) => {
|
||||||
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||||
|
|
||||||
if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
|
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||||
const event = storeElementEvent[keyHandlers];
|
const event = storeElementEvent[keyHandlers];
|
||||||
|
|
||||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
@ -280,9 +278,10 @@ const EventHandler = {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const $ = getjQuery();
|
||||||
const typeEvent = event.replace(stripNameRegex, '');
|
const typeEvent = event.replace(stripNameRegex, '');
|
||||||
const inNamespace = event !== typeEvent;
|
const inNamespace = event !== typeEvent;
|
||||||
const isNative = nativeEvents.indexOf(typeEvent) > -1;
|
const isNative = nativeEvents.has(typeEvent);
|
||||||
|
|
||||||
let jQueryEvent;
|
let jQueryEvent;
|
||||||
let bubbles = true;
|
let bubbles = true;
|
||||||
|
@ -322,12 +321,6 @@ const EventHandler = {
|
||||||
|
|
||||||
if (defaultPrevented) {
|
if (defaultPrevented) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
if (!defaultPreventedPreservedOnDispatch) {
|
|
||||||
Object.defineProperty(evt, 'defaultPrevented', {
|
|
||||||
get: () => true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nativeDispatch) {
|
if (nativeDispatch) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/manipulator.js
|
* Bootstrap (v5.0.0-beta1): dom/manipulator.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -31,11 +31,11 @@ function normalizeDataKey(key) {
|
||||||
|
|
||||||
const Manipulator = {
|
const Manipulator = {
|
||||||
setDataAttribute(element, key, value) {
|
setDataAttribute(element, key, value) {
|
||||||
element.setAttribute(`data-${normalizeDataKey(key)}`, value);
|
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeDataAttribute(element, key) {
|
removeDataAttribute(element, key) {
|
||||||
element.removeAttribute(`data-${normalizeDataKey(key)}`);
|
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataAttributes(element) {
|
getDataAttributes(element) {
|
||||||
|
@ -43,26 +43,29 @@ const Manipulator = {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const attributes = {
|
const attributes = {};
|
||||||
...element.dataset,
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.keys(attributes).forEach((key) => {
|
Object.keys(element.dataset)
|
||||||
attributes[key] = normalizeData(attributes[key]);
|
.filter((key) => key.startsWith('bs'))
|
||||||
});
|
.forEach((key) => {
|
||||||
|
let pureKey = key.replace(/^bs/, '');
|
||||||
|
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||||||
|
attributes[pureKey] = normalizeData(element.dataset[key]);
|
||||||
|
});
|
||||||
|
|
||||||
return attributes;
|
return attributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataAttribute(element, key) {
|
getDataAttribute(element, key) {
|
||||||
return normalizeData(element.getAttribute(`data-${normalizeDataKey(key)}`));
|
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
|
||||||
},
|
},
|
||||||
|
|
||||||
offset(element) {
|
offset(element) {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top: rect.top + (document.body.scrollTop || document.documentElement.scrollTop),
|
top: rect.top + document.body.scrollTop,
|
||||||
left: rect.left + (document.body.scrollLeft || document.documentElement.scrollLeft),
|
left: rect.left + document.body.scrollLeft,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -72,18 +75,6 @@ const Manipulator = {
|
||||||
left: element.offsetLeft,
|
left: element.offsetLeft,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleClass(element, className) {
|
|
||||||
if (!element) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element.classList.contains(className)) {
|
|
||||||
element.classList.remove(className);
|
|
||||||
} else {
|
|
||||||
element.classList.add(className);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Manipulator;
|
export default Manipulator;
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
/* istanbul ignore file */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/polyfill.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { getUID } from '../util/index';
|
|
||||||
|
|
||||||
let find = Element.prototype.querySelectorAll;
|
|
||||||
let findOne = Element.prototype.querySelector;
|
|
||||||
|
|
||||||
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
|
||||||
const defaultPreventedPreservedOnDispatch = (() => {
|
|
||||||
const e = new CustomEvent('Bootstrap', {
|
|
||||||
cancelable: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const element = document.createElement('div');
|
|
||||||
element.addEventListener('Bootstrap', () => null);
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
element.dispatchEvent(e);
|
|
||||||
return e.defaultPrevented;
|
|
||||||
})();
|
|
||||||
|
|
||||||
const scopeSelectorRegex = /:scope\b/;
|
|
||||||
const supportScopeQuery = (() => {
|
|
||||||
const element = document.createElement('div');
|
|
||||||
|
|
||||||
try {
|
|
||||||
element.querySelectorAll(':scope *');
|
|
||||||
} catch (_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (!supportScopeQuery) {
|
|
||||||
find = function (selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelectorAll(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasId = Boolean(this.id);
|
|
||||||
|
|
||||||
if (!hasId) {
|
|
||||||
this.id = getUID('scope');
|
|
||||||
}
|
|
||||||
|
|
||||||
let nodeList = null;
|
|
||||||
try {
|
|
||||||
selector = selector.replace(scopeSelectorRegex, `#${this.id}`);
|
|
||||||
nodeList = this.querySelectorAll(selector);
|
|
||||||
} finally {
|
|
||||||
if (!hasId) {
|
|
||||||
this.removeAttribute('id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodeList;
|
|
||||||
};
|
|
||||||
|
|
||||||
findOne = function (selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelector(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
const matches = find.call(this, selector);
|
|
||||||
|
|
||||||
if (typeof matches[0] !== 'undefined') {
|
|
||||||
return matches[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export { find, findOne, defaultPreventedPreservedOnDispatch };
|
|
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
|
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { find as findFn, findOne } from './polyfill';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -21,11 +19,11 @@ const SelectorEngine = {
|
||||||
},
|
},
|
||||||
|
|
||||||
find(selector, element = document.documentElement) {
|
find(selector, element = document.documentElement) {
|
||||||
return [].concat(...findFn.call(element, selector));
|
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||||
},
|
},
|
||||||
|
|
||||||
findOne(selector, element = document.documentElement) {
|
findOne(selector, element = document.documentElement) {
|
||||||
return findOne.call(element, selector);
|
return Element.prototype.querySelector.call(element, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
children(element, selector) {
|
children(element, selector) {
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): dropdown.js
|
* Bootstrap (v5.0.0-beta1): dropdown.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import * as Popper from '@popperjs/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
isElement,
|
isElement,
|
||||||
isVisible,
|
isVisible,
|
||||||
|
isRTL,
|
||||||
noop,
|
noop,
|
||||||
typeCheckConfig,
|
typeCheckConfig,
|
||||||
} from './util/index';
|
} from './util/index';
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import Popper from 'popper.js';
|
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -26,7 +30,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'dropdown';
|
const NAME = 'dropdown';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.dropdown';
|
const DATA_KEY = 'bs.dropdown';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -52,29 +55,27 @@ const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
const CLASS_NAME_DISABLED = 'disabled';
|
const CLASS_NAME_DISABLED = 'disabled';
|
||||||
const CLASS_NAME_SHOW = 'show';
|
const CLASS_NAME_SHOW = 'show';
|
||||||
const CLASS_NAME_DROPUP = 'dropup';
|
const CLASS_NAME_DROPUP = 'dropup';
|
||||||
const CLASS_NAME_DROPRIGHT = 'dropright';
|
const CLASS_NAME_DROPEND = 'dropend';
|
||||||
const CLASS_NAME_DROPLEFT = 'dropleft';
|
const CLASS_NAME_DROPSTART = 'dropstart';
|
||||||
const CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
|
|
||||||
const CLASS_NAME_NAVBAR = 'navbar';
|
const CLASS_NAME_NAVBAR = 'navbar';
|
||||||
const CLASS_NAME_POSITION_STATIC = 'position-static';
|
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="dropdown"]';
|
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]';
|
||||||
const SELECTOR_FORM_CHILD = '.dropdown form';
|
const SELECTOR_FORM_CHILD = '.dropdown form';
|
||||||
const SELECTOR_MENU = '.dropdown-menu';
|
const SELECTOR_MENU = '.dropdown-menu';
|
||||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||||
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||||
|
|
||||||
const PLACEMENT_TOP = 'top-start';
|
const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||||
const PLACEMENT_TOPEND = 'top-end';
|
const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||||
const PLACEMENT_BOTTOM = 'bottom-start';
|
const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||||
const PLACEMENT_BOTTOMEND = 'bottom-end';
|
const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||||
const PLACEMENT_RIGHT = 'right-start';
|
const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||||
const PLACEMENT_LEFT = 'left-start';
|
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
flip: true,
|
flip: true,
|
||||||
boundary: 'scrollParent',
|
boundary: 'clippingParents',
|
||||||
reference: 'toggle',
|
reference: 'toggle',
|
||||||
display: 'dynamic',
|
display: 'dynamic',
|
||||||
popperConfig: null,
|
popperConfig: null,
|
||||||
|
@ -95,24 +96,20 @@ const DefaultType = {
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Dropdown {
|
class Dropdown extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
this._element = element;
|
super(element);
|
||||||
|
|
||||||
this._popper = null;
|
this._popper = null;
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._menu = this._getMenuElement();
|
this._menu = this._getMenuElement();
|
||||||
this._inNavbar = this._detectNavbar();
|
this._inNavbar = this._detectNavbar();
|
||||||
|
|
||||||
this._addEventListeners();
|
this._addEventListeners();
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
@ -121,6 +118,10 @@ class Dropdown {
|
||||||
return DefaultType;
|
return DefaultType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
toggle() {
|
toggle() {
|
||||||
|
@ -159,10 +160,10 @@ class Dropdown {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable totally Popper.js for Dropdown in Navbar
|
// Totally disable Popper for Dropdowns in Navbar
|
||||||
if (!this._inNavbar) {
|
if (!this._inNavbar) {
|
||||||
if (typeof Popper === 'undefined') {
|
if (typeof Popper === 'undefined') {
|
||||||
throw new TypeError("Bootstrap's dropdowns require Popper.js (https://popper.js.org)");
|
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
|
||||||
}
|
}
|
||||||
|
|
||||||
let referenceElement = this._element;
|
let referenceElement = this._element;
|
||||||
|
@ -178,14 +179,7 @@ class Dropdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If boundary is not `scrollParent`, then set position to `static`
|
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig());
|
||||||
// to allow the menu to "escape" the scroll parent's boundaries
|
|
||||||
// https://github.com/twbs/bootstrap/issues/24251
|
|
||||||
if (this._config.boundary !== 'scrollParent') {
|
|
||||||
parent.classList.add(CLASS_NAME_POSITION_STATIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a touch-enabled device we add extra
|
// If this is a touch-enabled device we add extra
|
||||||
|
@ -201,8 +195,8 @@ class Dropdown {
|
||||||
this._element.focus();
|
this._element.focus();
|
||||||
this._element.setAttribute('aria-expanded', true);
|
this._element.setAttribute('aria-expanded', true);
|
||||||
|
|
||||||
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget);
|
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,16 +224,16 @@ class Dropdown {
|
||||||
this._popper.destroy();
|
this._popper.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
|
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||||
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
|
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||||
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
|
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
Data.removeData(this._element, DATA_KEY);
|
super.dispose();
|
||||||
EventHandler.off(this._element, EVENT_KEY);
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
this._element = null;
|
|
||||||
this._menu = null;
|
this._menu = null;
|
||||||
|
|
||||||
if (this._popper) {
|
if (this._popper) {
|
||||||
this._popper.destroy();
|
this._popper.destroy();
|
||||||
this._popper = null;
|
this._popper = null;
|
||||||
|
@ -249,7 +243,7 @@ class Dropdown {
|
||||||
update() {
|
update() {
|
||||||
this._inNavbar = this._detectNavbar();
|
this._inNavbar = this._detectNavbar();
|
||||||
if (this._popper) {
|
if (this._popper) {
|
||||||
this._popper.scheduleUpdate();
|
this._popper.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,67 +275,51 @@ class Dropdown {
|
||||||
|
|
||||||
_getPlacement() {
|
_getPlacement() {
|
||||||
const parentDropdown = this._element.parentNode;
|
const parentDropdown = this._element.parentNode;
|
||||||
let placement = PLACEMENT_BOTTOM;
|
|
||||||
|
|
||||||
// Handle dropup
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
||||||
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
return PLACEMENT_RIGHT;
|
||||||
placement = PLACEMENT_TOP;
|
|
||||||
if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
|
|
||||||
placement = PLACEMENT_TOPEND;
|
|
||||||
}
|
|
||||||
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPRIGHT)) {
|
|
||||||
placement = PLACEMENT_RIGHT;
|
|
||||||
} else if (parentDropdown.classList.contains(CLASS_NAME_DROPLEFT)) {
|
|
||||||
placement = PLACEMENT_LEFT;
|
|
||||||
} else if (this._menu.classList.contains(CLASS_NAME_MENURIGHT)) {
|
|
||||||
placement = PLACEMENT_BOTTOMEND;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return placement;
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
|
||||||
|
return PLACEMENT_LEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to trim the value because custom properties can also include spaces
|
||||||
|
const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
|
||||||
|
|
||||||
|
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
||||||
|
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
_detectNavbar() {
|
_detectNavbar() {
|
||||||
return Boolean(this._element.closest(`.${CLASS_NAME_NAVBAR}`));
|
return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
|
||||||
}
|
|
||||||
|
|
||||||
_getOffset() {
|
|
||||||
const offset = {};
|
|
||||||
|
|
||||||
if (typeof this._config.offset === 'function') {
|
|
||||||
offset.fn = (data) => {
|
|
||||||
data.offsets = {
|
|
||||||
...data.offsets,
|
|
||||||
...(this._config.offset(data.offsets, this._element) || {}),
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
offset.offset = this._config.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getPopperConfig() {
|
_getPopperConfig() {
|
||||||
const popperConfig = {
|
const popperConfig = {
|
||||||
placement: this._getPlacement(),
|
placement: this._getPlacement(),
|
||||||
modifiers: {
|
modifiers: [
|
||||||
offset: this._getOffset(),
|
{
|
||||||
flip: {
|
name: 'preventOverflow',
|
||||||
enabled: this._config.flip,
|
options: {
|
||||||
|
altBoundary: this._config.flip,
|
||||||
|
rootBoundary: this._config.boundary,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
preventOverflow: {
|
],
|
||||||
boundariesElement: this._config.boundary,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disable Popper.js if we have a static display
|
// Disable Popper if we have a static display
|
||||||
if (this._config.display === 'static') {
|
if (this._config.display === 'static') {
|
||||||
popperConfig.modifiers.applyStyle = {
|
popperConfig.modifiers = [
|
||||||
enabled: false,
|
{
|
||||||
};
|
name: 'applyStyles',
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -494,13 +472,13 @@ class Dropdown {
|
||||||
|
|
||||||
let index = items.indexOf(event.target);
|
let index = items.indexOf(event.target);
|
||||||
|
|
||||||
|
// Up
|
||||||
if (event.key === ARROW_UP_KEY && index > 0) {
|
if (event.key === ARROW_UP_KEY && index > 0) {
|
||||||
// Up
|
|
||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Down
|
||||||
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
|
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
|
||||||
// Down
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,10 +487,6 @@ class Dropdown {
|
||||||
|
|
||||||
items[index].focus();
|
items[index].focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,23 +511,25 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
||||||
});
|
});
|
||||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.stopPropagation());
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.stopPropagation());
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .dropdown to jQuery only if jQuery is present
|
* add .Dropdown to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Dropdown.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Dropdown;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Dropdown.jQueryInterface;
|
||||||
return Dropdown.jQueryInterface;
|
$.fn[NAME].Constructor = Dropdown;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Dropdown.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Dropdown;
|
export default Dropdown;
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): modal.js
|
* Bootstrap (v5.0.0-beta1): modal.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
getTransitionDurationFromElement,
|
getTransitionDurationFromElement,
|
||||||
isVisible,
|
isVisible,
|
||||||
|
isRTL,
|
||||||
reflow,
|
reflow,
|
||||||
typeCheckConfig,
|
typeCheckConfig,
|
||||||
} from './util/index';
|
} from './util/index';
|
||||||
|
@ -19,6 +21,7 @@ import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -27,7 +30,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'modal';
|
const NAME = 'modal';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.modal';
|
const DATA_KEY = 'bs.modal';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -37,14 +39,12 @@ const Default = {
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
keyboard: true,
|
keyboard: true,
|
||||||
focus: true,
|
focus: true,
|
||||||
show: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const DefaultType = {
|
const DefaultType = {
|
||||||
backdrop: '(boolean|string)',
|
backdrop: '(boolean|string)',
|
||||||
keyboard: 'boolean',
|
keyboard: 'boolean',
|
||||||
focus: 'boolean',
|
focus: 'boolean',
|
||||||
show: 'boolean',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
|
@ -69,8 +69,8 @@ const CLASS_NAME_STATIC = 'modal-static';
|
||||||
|
|
||||||
const SELECTOR_DIALOG = '.modal-dialog';
|
const SELECTOR_DIALOG = '.modal-dialog';
|
||||||
const SELECTOR_MODAL_BODY = '.modal-body';
|
const SELECTOR_MODAL_BODY = '.modal-body';
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="modal"]';
|
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]';
|
||||||
const SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
|
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
|
||||||
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
||||||
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||||
|
|
||||||
|
@ -80,10 +80,11 @@ const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Modal {
|
class Modal extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
|
super(element);
|
||||||
|
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._element = element;
|
|
||||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
|
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
|
||||||
this._backdrop = null;
|
this._backdrop = null;
|
||||||
this._isShown = false;
|
this._isShown = false;
|
||||||
|
@ -91,19 +92,18 @@ class Modal {
|
||||||
this._ignoreBackdropClick = false;
|
this._ignoreBackdropClick = false;
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
this._scrollbarWidth = 0;
|
this._scrollbarWidth = 0;
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
toggle(relatedTarget) {
|
toggle(relatedTarget) {
|
||||||
|
@ -199,6 +199,8 @@ class Modal {
|
||||||
EventHandler.off(htmlElement, EVENT_KEY)
|
EventHandler.off(htmlElement, EVENT_KEY)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||||
* Do not move `document` in `htmlElements` array
|
* Do not move `document` in `htmlElements` array
|
||||||
|
@ -206,10 +208,7 @@ class Modal {
|
||||||
*/
|
*/
|
||||||
EventHandler.off(document, EVENT_FOCUSIN);
|
EventHandler.off(document, EVENT_FOCUSIN);
|
||||||
|
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
|
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
this._backdrop = null;
|
this._backdrop = null;
|
||||||
this._isShown = null;
|
this._isShown = null;
|
||||||
|
@ -362,7 +361,11 @@ class Modal {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._triggerBackdropTransition();
|
if (this._config.backdrop === 'static') {
|
||||||
|
this._triggerBackdropTransition();
|
||||||
|
} else {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
|
@ -401,35 +404,31 @@ class Modal {
|
||||||
}
|
}
|
||||||
|
|
||||||
_triggerBackdropTransition() {
|
_triggerBackdropTransition() {
|
||||||
if (this._config.backdrop === 'static') {
|
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
||||||
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
if (hideEvent.defaultPrevented) {
|
||||||
if (hideEvent.defaultPrevented) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
|
||||||
|
|
||||||
if (!isModalOverflowing) {
|
|
||||||
this._element.style.overflowY = 'hidden';
|
|
||||||
}
|
|
||||||
|
|
||||||
this._element.classList.add(CLASS_NAME_STATIC);
|
|
||||||
const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
|
|
||||||
EventHandler.off(this._element, TRANSITION_END);
|
|
||||||
EventHandler.one(this._element, TRANSITION_END, () => {
|
|
||||||
this._element.classList.remove(CLASS_NAME_STATIC);
|
|
||||||
if (!isModalOverflowing) {
|
|
||||||
EventHandler.one(this._element, TRANSITION_END, () => {
|
|
||||||
this._element.style.overflowY = '';
|
|
||||||
});
|
|
||||||
emulateTransitionEnd(this._element, modalTransitionDuration);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
emulateTransitionEnd(this._element, modalTransitionDuration);
|
|
||||||
this._element.focus();
|
|
||||||
} else {
|
|
||||||
this.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
this._element.style.overflowY = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
this._element.classList.add(CLASS_NAME_STATIC);
|
||||||
|
const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||||
|
EventHandler.off(this._element, TRANSITION_END);
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, () => {
|
||||||
|
this._element.classList.remove(CLASS_NAME_STATIC);
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
EventHandler.one(this._element, TRANSITION_END, () => {
|
||||||
|
this._element.style.overflowY = '';
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(this._element, modalTransitionDuration);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
emulateTransitionEnd(this._element, modalTransitionDuration);
|
||||||
|
this._element.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -439,11 +438,17 @@ class Modal {
|
||||||
_adjustDialog() {
|
_adjustDialog() {
|
||||||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||||
|
|
||||||
if (!this._isBodyOverflowing && isModalOverflowing) {
|
if (
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && !isRTL) ||
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
|
this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._isBodyOverflowing && !isModalOverflowing) {
|
if (
|
||||||
|
(this._isBodyOverflowing && !isModalOverflowing && !isRTL) ||
|
||||||
|
(!this._isBodyOverflowing && isModalOverflowing && isRTL)
|
||||||
|
) {
|
||||||
this._element.style.paddingRight = `${this._scrollbarWidth}px`;
|
this._element.style.paddingRight = `${this._scrollbarWidth}px`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,7 +474,9 @@ class Modal {
|
||||||
const actualPadding = element.style.paddingRight;
|
const actualPadding = element.style.paddingRight;
|
||||||
const calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
const calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
||||||
Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
|
Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
|
||||||
element.style.paddingRight = `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`;
|
element.style.paddingRight = `${
|
||||||
|
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
|
||||||
|
}px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adjust sticky content margin
|
// Adjust sticky content margin
|
||||||
|
@ -477,7 +484,9 @@ class Modal {
|
||||||
const actualMargin = element.style.marginRight;
|
const actualMargin = element.style.marginRight;
|
||||||
const calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
const calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
||||||
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
|
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
|
||||||
element.style.marginRight = `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`;
|
element.style.marginRight = `${
|
||||||
|
Number.parseFloat(calculatedMargin) - this._scrollbarWidth
|
||||||
|
}px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adjust body padding
|
// Adjust body padding
|
||||||
|
@ -486,7 +495,7 @@ class Modal {
|
||||||
|
|
||||||
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
|
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
|
||||||
document.body.style.paddingRight = `${
|
document.body.style.paddingRight = `${
|
||||||
parseFloat(calculatedPadding) + this._scrollbarWidth
|
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
|
||||||
}px`;
|
}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,15 +562,9 @@ class Modal {
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config](relatedTarget);
|
data[config](relatedTarget);
|
||||||
} else if (_config.show) {
|
|
||||||
data.show(relatedTarget);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -603,23 +606,25 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
||||||
data.show(this);
|
data.show(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .modal to jQuery only if jQuery is present
|
* add .Modal to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Modal.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Modal;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Modal.jQueryInterface;
|
||||||
return Modal.jQueryInterface;
|
$.fn[NAME].Constructor = Modal;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Modal.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Modal;
|
export default Modal;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): popover.js
|
* Bootstrap (v5.0.0-beta1): popover.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getjQuery } from './util/index';
|
import { getjQuery, onDOMContentLoaded } from './util/index';
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
import Tooltip from './tooltip';
|
import Tooltip from './tooltip';
|
||||||
|
@ -17,7 +17,6 @@ import Tooltip from './tooltip';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'popover';
|
const NAME = 'popover';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.popover';
|
const DATA_KEY = 'bs.popover';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const CLASS_PREFIX = 'bs-popover';
|
const CLASS_PREFIX = 'bs-popover';
|
||||||
|
@ -32,7 +31,8 @@ const Default = {
|
||||||
'<div class="popover" role="tooltip">' +
|
'<div class="popover" role="tooltip">' +
|
||||||
'<div class="popover-arrow"></div>' +
|
'<div class="popover-arrow"></div>' +
|
||||||
'<h3 class="popover-header"></h3>' +
|
'<h3 class="popover-header"></h3>' +
|
||||||
'<div class="popover-body"></div></div>',
|
'<div class="popover-body"></div>' +
|
||||||
|
'</div>',
|
||||||
};
|
};
|
||||||
|
|
||||||
const DefaultType = {
|
const DefaultType = {
|
||||||
|
@ -68,10 +68,6 @@ const SELECTOR_CONTENT = '.popover-body';
|
||||||
class Popover extends Tooltip {
|
class Popover extends Tooltip {
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +105,7 @@ class Popover extends Tooltip {
|
||||||
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
|
||||||
let content = this._getContent();
|
let content = this._getContent();
|
||||||
if (typeof content === 'function') {
|
if (typeof content === 'function') {
|
||||||
content = content.call(this.element);
|
content = content.call(this._element);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
|
||||||
|
@ -120,11 +116,11 @@ class Popover extends Tooltip {
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
_addAttachmentClass(attachment) {
|
_addAttachmentClass(attachment) {
|
||||||
this.getTipElement().classList.add(`${CLASS_PREFIX}-${attachment}`);
|
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getContent() {
|
_getContent() {
|
||||||
return this.element.getAttribute('data-content') || this.config.content;
|
return this._element.getAttribute('data-bs-content') || this.config.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cleanTipClass() {
|
_cleanTipClass() {
|
||||||
|
@ -160,28 +156,27 @@ class Popover extends Tooltip {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .Popover to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Popover.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Popover;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Popover.jQueryInterface;
|
||||||
return Popover.jQueryInterface;
|
$.fn[NAME].Constructor = Popover;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Popover.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Popover;
|
export default Popover;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): scrollspy.js
|
* Bootstrap (v5.0.0-beta1): scrollspy.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
getSelectorFromElement,
|
getSelectorFromElement,
|
||||||
getUID,
|
getUID,
|
||||||
isElement,
|
isElement,
|
||||||
|
@ -16,6 +17,7 @@ import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -24,7 +26,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'scrollspy';
|
const NAME = 'scrollspy';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.scrollspy';
|
const DATA_KEY = 'bs.scrollspy';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -48,7 +49,7 @@ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
||||||
const CLASS_NAME_ACTIVE = 'active';
|
const CLASS_NAME_ACTIVE = 'active';
|
||||||
|
|
||||||
const SELECTOR_DATA_SPY = '[data-spy="scroll"]';
|
const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
||||||
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
const SELECTOR_NAV_LINKS = '.nav-link';
|
const SELECTOR_NAV_LINKS = '.nav-link';
|
||||||
const SELECTOR_NAV_ITEMS = '.nav-item';
|
const SELECTOR_NAV_ITEMS = '.nav-item';
|
||||||
|
@ -65,9 +66,9 @@ const METHOD_POSITION = 'position';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ScrollSpy {
|
class ScrollSpy extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
this._element = element;
|
super(element);
|
||||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
||||||
|
@ -80,20 +81,18 @@ class ScrollSpy {
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this._process();
|
this._process();
|
||||||
|
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
@ -133,10 +132,9 @@ class ScrollSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
Data.removeData(this._element, DATA_KEY);
|
super.dispose();
|
||||||
EventHandler.off(this._scrollElement, EVENT_KEY);
|
EventHandler.off(this._scrollElement, EVENT_KEY);
|
||||||
|
|
||||||
this._element = null;
|
|
||||||
this._scrollElement = null;
|
this._scrollElement = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._selector = null;
|
this._selector = null;
|
||||||
|
@ -232,7 +230,7 @@ class ScrollSpy {
|
||||||
|
|
||||||
const queries = this._selector
|
const queries = this._selector
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((selector) => `${selector}[data-target="${target}"],${selector}[href="${target}"]`);
|
.map((selector) => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
||||||
|
|
||||||
const link = SelectorEngine.findOne(queries.join(','));
|
const link = SelectorEngine.findOne(queries.join(','));
|
||||||
|
|
||||||
|
@ -295,10 +293,6 @@ class ScrollSpy {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,22 +307,25 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .ScrollSpy to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = ScrollSpy;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
||||||
return ScrollSpy.jQueryInterface;
|
$.fn[NAME].Constructor = ScrollSpy;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return ScrollSpy.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default ScrollSpy;
|
export default ScrollSpy;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): tab.js
|
* Bootstrap (v5.0.0-beta1): tab.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
|
@ -16,6 +17,7 @@ import {
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -24,7 +26,6 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'tab';
|
const NAME = 'tab';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.tab';
|
const DATA_KEY = 'bs.tab';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const DATA_API_KEY = '.data-api';
|
const DATA_API_KEY = '.data-api';
|
||||||
|
@ -45,7 +46,8 @@ const SELECTOR_DROPDOWN = '.dropdown';
|
||||||
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
const SELECTOR_ACTIVE = '.active';
|
const SELECTOR_ACTIVE = '.active';
|
||||||
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
|
const SELECTOR_DATA_TOGGLE =
|
||||||
|
'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
|
||||||
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||||
const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||||
|
|
||||||
|
@ -55,17 +57,11 @@ const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Tab {
|
class Tab extends BaseComponent {
|
||||||
constructor(element) {
|
|
||||||
this._element = element;
|
|
||||||
|
|
||||||
Data.setData(this._element, DATA_KEY, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
static get DATA_KEY() {
|
||||||
return VERSION;
|
return DATA_KEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
@ -127,11 +123,6 @@ class Tab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose() {
|
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
this._element = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
_activate(element, container, callback) {
|
_activate(element, container, callback) {
|
||||||
|
@ -217,10 +208,6 @@ class Tab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,23 +223,25 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
||||||
data.show();
|
data.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .tab to jQuery only if jQuery is present
|
* add .Tab to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Tab.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Tab;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Tab.jQueryInterface;
|
||||||
return Tab.jQueryInterface;
|
$.fn[NAME].Constructor = Tab;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Tab.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Tab;
|
export default Tab;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): toast.js
|
* Bootstrap (v5.0.0-beta1): toast.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
getTransitionDurationFromElement,
|
getTransitionDurationFromElement,
|
||||||
|
@ -16,6 +17,7 @@ import {
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -24,7 +26,6 @@ import Manipulator from './dom/manipulator';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'toast';
|
const NAME = 'toast';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.toast';
|
const DATA_KEY = 'bs.toast';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ const Default = {
|
||||||
delay: 5000,
|
delay: 5000,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]';
|
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -59,21 +60,17 @@ const SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Toast {
|
class Toast extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
this._element = element;
|
super(element);
|
||||||
|
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._timeout = null;
|
this._timeout = null;
|
||||||
this._setListeners();
|
this._setListeners();
|
||||||
Data.setData(element, DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get DefaultType() {
|
static get DefaultType() {
|
||||||
return DefaultType;
|
return DefaultType;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +79,10 @@ class Toast {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get DATA_KEY() {
|
||||||
|
return DATA_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
|
@ -158,9 +159,8 @@ class Toast {
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
||||||
Data.removeData(this._element, DATA_KEY);
|
|
||||||
|
|
||||||
this._element = null;
|
super.dispose();
|
||||||
this._config = null;
|
this._config = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,29 +207,27 @@ class Toast {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .toast to jQuery only if jQuery is present
|
* add .Toast to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Toast.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Toast;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Toast.jQueryInterface;
|
||||||
return Toast.jQueryInterface;
|
$.fn[NAME].Constructor = Toast;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Toast.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Toast;
|
export default Toast;
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): tooltip.js
|
* Bootstrap (v5.0.0-beta1): tooltip.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import * as Popper from '@popperjs/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getjQuery,
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
emulateTransitionEnd,
|
emulateTransitionEnd,
|
||||||
findShadowRoot,
|
findShadowRoot,
|
||||||
getTransitionDurationFromElement,
|
getTransitionDurationFromElement,
|
||||||
getUID,
|
getUID,
|
||||||
isElement,
|
isElement,
|
||||||
|
isRTL,
|
||||||
noop,
|
noop,
|
||||||
typeCheckConfig,
|
typeCheckConfig,
|
||||||
} from './util/index';
|
} from './util/index';
|
||||||
|
@ -20,8 +24,8 @@ import { DefaultAllowlist, sanitizeHtml } from './util/sanitizer';
|
||||||
import Data from './dom/data';
|
import Data from './dom/data';
|
||||||
import EventHandler from './dom/event-handler';
|
import EventHandler from './dom/event-handler';
|
||||||
import Manipulator from './dom/manipulator';
|
import Manipulator from './dom/manipulator';
|
||||||
import Popper from 'popper.js';
|
|
||||||
import SelectorEngine from './dom/selector-engine';
|
import SelectorEngine from './dom/selector-engine';
|
||||||
|
import BaseComponent from './base-component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -30,12 +34,11 @@ import SelectorEngine from './dom/selector-engine';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'tooltip';
|
const NAME = 'tooltip';
|
||||||
const VERSION = '5.0.0-alpha2';
|
|
||||||
const DATA_KEY = 'bs.tooltip';
|
const DATA_KEY = 'bs.tooltip';
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
const CLASS_PREFIX = 'bs-tooltip';
|
const CLASS_PREFIX = 'bs-tooltip';
|
||||||
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||||
const DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
|
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
||||||
|
|
||||||
const DefaultType = {
|
const DefaultType = {
|
||||||
animation: 'boolean',
|
animation: 'boolean',
|
||||||
|
@ -46,10 +49,10 @@ const DefaultType = {
|
||||||
html: 'boolean',
|
html: 'boolean',
|
||||||
selector: '(string|boolean)',
|
selector: '(string|boolean)',
|
||||||
placement: '(string|function)',
|
placement: '(string|function)',
|
||||||
offset: '(number|string|function)',
|
|
||||||
container: '(string|element|boolean)',
|
container: '(string|element|boolean)',
|
||||||
fallbackPlacement: '(string|array)',
|
fallbackPlacements: '(null|array)',
|
||||||
boundary: '(string|element)',
|
boundary: '(string|element)',
|
||||||
|
customClass: '(string|function)',
|
||||||
sanitize: 'boolean',
|
sanitize: 'boolean',
|
||||||
sanitizeFn: '(null|function)',
|
sanitizeFn: '(null|function)',
|
||||||
allowList: 'object',
|
allowList: 'object',
|
||||||
|
@ -59,9 +62,9 @@ const DefaultType = {
|
||||||
const AttachmentMap = {
|
const AttachmentMap = {
|
||||||
AUTO: 'auto',
|
AUTO: 'auto',
|
||||||
TOP: 'top',
|
TOP: 'top',
|
||||||
RIGHT: 'right',
|
RIGHT: isRTL ? 'left' : 'right',
|
||||||
BOTTOM: 'bottom',
|
BOTTOM: 'bottom',
|
||||||
LEFT: 'left',
|
LEFT: isRTL ? 'right' : 'left',
|
||||||
};
|
};
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
|
@ -69,17 +72,18 @@ const Default = {
|
||||||
template:
|
template:
|
||||||
'<div class="tooltip" role="tooltip">' +
|
'<div class="tooltip" role="tooltip">' +
|
||||||
'<div class="tooltip-arrow"></div>' +
|
'<div class="tooltip-arrow"></div>' +
|
||||||
'<div class="tooltip-inner"></div></div>',
|
'<div class="tooltip-inner"></div>' +
|
||||||
|
'</div>',
|
||||||
trigger: 'hover focus',
|
trigger: 'hover focus',
|
||||||
title: '',
|
title: '',
|
||||||
delay: 0,
|
delay: 0,
|
||||||
html: false,
|
html: false,
|
||||||
selector: false,
|
selector: false,
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
offset: 0,
|
|
||||||
container: false,
|
container: false,
|
||||||
fallbackPlacement: 'flip',
|
fallbackPlacements: null,
|
||||||
boundary: 'scrollParent',
|
boundary: 'clippingParents',
|
||||||
|
customClass: '',
|
||||||
sanitize: true,
|
sanitize: true,
|
||||||
sanitizeFn: null,
|
sanitizeFn: null,
|
||||||
allowList: DefaultAllowlist,
|
allowList: DefaultAllowlist,
|
||||||
|
@ -119,12 +123,14 @@ const TRIGGER_MANUAL = 'manual';
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Tooltip {
|
class Tooltip extends BaseComponent {
|
||||||
constructor(element, config) {
|
constructor(element, config) {
|
||||||
if (typeof Popper === 'undefined') {
|
if (typeof Popper === 'undefined') {
|
||||||
throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org)");
|
throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super(element);
|
||||||
|
|
||||||
// private
|
// private
|
||||||
this._isEnabled = true;
|
this._isEnabled = true;
|
||||||
this._timeout = 0;
|
this._timeout = 0;
|
||||||
|
@ -133,20 +139,14 @@ class Tooltip {
|
||||||
this._popper = null;
|
this._popper = null;
|
||||||
|
|
||||||
// Protected
|
// Protected
|
||||||
this.element = element;
|
|
||||||
this.config = this._getConfig(config);
|
this.config = this._getConfig(config);
|
||||||
this.tip = null;
|
this.tip = null;
|
||||||
|
|
||||||
this._setListeners();
|
this._setListeners();
|
||||||
Data.setData(element, this.constructor.DATA_KEY, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
|
||||||
static get VERSION() {
|
|
||||||
return VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get Default() {
|
static get Default() {
|
||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,9 @@ class Tooltip {
|
||||||
dispose() {
|
dispose() {
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
|
|
||||||
Data.removeData(this.element, this.constructor.DATA_KEY);
|
EventHandler.off(this._element, this.constructor.EVENT_KEY);
|
||||||
|
|
||||||
EventHandler.off(this.element, this.constructor.EVENT_KEY);
|
|
||||||
EventHandler.off(
|
EventHandler.off(
|
||||||
this.element.closest(`.${CLASS_NAME_MODAL}`),
|
this._element.closest(`.${CLASS_NAME_MODAL}`),
|
||||||
'hide.bs.modal',
|
'hide.bs.modal',
|
||||||
this._hideModalHandler
|
this._hideModalHandler
|
||||||
);
|
);
|
||||||
|
@ -241,23 +239,23 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._popper = null;
|
this._popper = null;
|
||||||
this.element = null;
|
|
||||||
this.config = null;
|
this.config = null;
|
||||||
this.tip = null;
|
this.tip = null;
|
||||||
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
if (this.element.style.display === 'none') {
|
if (this._element.style.display === 'none') {
|
||||||
throw new Error('Please use show on visible elements');
|
throw new Error('Please use show on visible elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isWithContent() && this._isEnabled) {
|
if (this.isWithContent() && this._isEnabled) {
|
||||||
const showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
|
const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
|
||||||
const shadowRoot = findShadowRoot(this.element);
|
const shadowRoot = findShadowRoot(this._element);
|
||||||
const isInTheDom =
|
const isInTheDom =
|
||||||
shadowRoot === null
|
shadowRoot === null
|
||||||
? this.element.ownerDocument.documentElement.contains(this.element)
|
? this._element.ownerDocument.documentElement.contains(this._element)
|
||||||
: shadowRoot.contains(this.element);
|
: shadowRoot.contains(this._element);
|
||||||
|
|
||||||
if (showEvent.defaultPrevented || !isInTheDom) {
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||||
return;
|
return;
|
||||||
|
@ -267,7 +265,7 @@ class Tooltip {
|
||||||
const tipId = getUID(this.constructor.NAME);
|
const tipId = getUID(this.constructor.NAME);
|
||||||
|
|
||||||
tip.setAttribute('id', tipId);
|
tip.setAttribute('id', tipId);
|
||||||
this.element.setAttribute('aria-describedby', tipId);
|
this._element.setAttribute('aria-describedby', tipId);
|
||||||
|
|
||||||
this.setContent();
|
this.setContent();
|
||||||
|
|
||||||
|
@ -277,7 +275,7 @@ class Tooltip {
|
||||||
|
|
||||||
const placement =
|
const placement =
|
||||||
typeof this.config.placement === 'function'
|
typeof this.config.placement === 'function'
|
||||||
? this.config.placement.call(this, tip, this.element)
|
? this.config.placement.call(this, tip, this._element)
|
||||||
: this.config.placement;
|
: this.config.placement;
|
||||||
|
|
||||||
const attachment = this._getAttachment(placement);
|
const attachment = this._getAttachment(placement);
|
||||||
|
@ -286,16 +284,24 @@ class Tooltip {
|
||||||
const container = this._getContainer();
|
const container = this._getContainer();
|
||||||
Data.setData(tip, this.constructor.DATA_KEY, this);
|
Data.setData(tip, this.constructor.DATA_KEY, this);
|
||||||
|
|
||||||
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
|
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
||||||
container.appendChild(tip);
|
container.appendChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
|
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
||||||
|
|
||||||
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
|
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||||
|
|
||||||
tip.classList.add(CLASS_NAME_SHOW);
|
tip.classList.add(CLASS_NAME_SHOW);
|
||||||
|
|
||||||
|
const customClass =
|
||||||
|
typeof this.config.customClass === 'function'
|
||||||
|
? this.config.customClass()
|
||||||
|
: this.config.customClass;
|
||||||
|
if (customClass) {
|
||||||
|
tip.classList.add(...customClass.split(' '));
|
||||||
|
}
|
||||||
|
|
||||||
// If this is a touch-enabled device we add extra
|
// If this is a touch-enabled device we add extra
|
||||||
// empty mouseover listeners to the body's immediate children;
|
// empty mouseover listeners to the body's immediate children;
|
||||||
// only needed because of broken event delegation on iOS
|
// only needed because of broken event delegation on iOS
|
||||||
|
@ -307,14 +313,10 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
const complete = () => {
|
const complete = () => {
|
||||||
if (this.config.animation) {
|
|
||||||
this._fixTransition();
|
|
||||||
}
|
|
||||||
|
|
||||||
const prevHoverState = this._hoverState;
|
const prevHoverState = this._hoverState;
|
||||||
this._hoverState = null;
|
|
||||||
|
|
||||||
EventHandler.trigger(this.element, this.constructor.Event.SHOWN);
|
this._hoverState = null;
|
||||||
|
EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
|
||||||
|
|
||||||
if (prevHoverState === HOVER_STATE_OUT) {
|
if (prevHoverState === HOVER_STATE_OUT) {
|
||||||
this._leave(null, this);
|
this._leave(null, this);
|
||||||
|
@ -343,12 +345,16 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._cleanTipClass();
|
this._cleanTipClass();
|
||||||
this.element.removeAttribute('aria-describedby');
|
this._element.removeAttribute('aria-describedby');
|
||||||
EventHandler.trigger(this.element, this.constructor.Event.HIDDEN);
|
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
|
||||||
this._popper.destroy();
|
|
||||||
|
if (this._popper) {
|
||||||
|
this._popper.destroy();
|
||||||
|
this._popper = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
|
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
|
||||||
if (hideEvent.defaultPrevented) {
|
if (hideEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +387,7 @@ class Tooltip {
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
if (this._popper !== null) {
|
if (this._popper !== null) {
|
||||||
this._popper.scheduleUpdate();
|
this._popper.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,41 +450,72 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle() {
|
getTitle() {
|
||||||
let title = this.element.getAttribute('data-original-title');
|
let title = this._element.getAttribute('data-bs-original-title');
|
||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
title =
|
title =
|
||||||
typeof this.config.title === 'function'
|
typeof this.config.title === 'function'
|
||||||
? this.config.title.call(this.element)
|
? this.config.title.call(this._element)
|
||||||
: this.config.title;
|
: this.config.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateAttachment(attachment) {
|
||||||
|
if (attachment === 'right') {
|
||||||
|
return 'end';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attachment === 'left') {
|
||||||
|
return 'start';
|
||||||
|
}
|
||||||
|
|
||||||
|
return attachment;
|
||||||
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
_getPopperConfig(attachment) {
|
_getPopperConfig(attachment) {
|
||||||
|
const flipModifier = {
|
||||||
|
name: 'flip',
|
||||||
|
options: {
|
||||||
|
altBoundary: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.config.fallbackPlacements) {
|
||||||
|
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
|
||||||
|
}
|
||||||
|
|
||||||
const defaultBsConfig = {
|
const defaultBsConfig = {
|
||||||
placement: attachment,
|
placement: attachment,
|
||||||
modifiers: {
|
modifiers: [
|
||||||
offset: this._getOffset(),
|
flipModifier,
|
||||||
flip: {
|
{
|
||||||
behavior: this.config.fallbackPlacement,
|
name: 'preventOverflow',
|
||||||
|
options: {
|
||||||
|
rootBoundary: this.config.boundary,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
arrow: {
|
{
|
||||||
element: `.${this.constructor.NAME}-arrow`,
|
name: 'arrow',
|
||||||
|
options: {
|
||||||
|
element: `.${this.constructor.NAME}-arrow`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
preventOverflow: {
|
{
|
||||||
boundariesElement: this.config.boundary,
|
name: 'onChange',
|
||||||
|
enabled: true,
|
||||||
|
phase: 'afterWrite',
|
||||||
|
fn: (data) => this._handlePopperPlacementChange(data),
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
onCreate: (data) => {
|
onFirstUpdate: (data) => {
|
||||||
if (data.originalPlacement !== data.placement) {
|
if (data.options.placement !== data.placement) {
|
||||||
this._handlePopperPlacementChange(data);
|
this._handlePopperPlacementChange(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate: (data) => this._handlePopperPlacementChange(data),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -488,26 +525,7 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
_addAttachmentClass(attachment) {
|
_addAttachmentClass(attachment) {
|
||||||
this.getTipElement().classList.add(`${CLASS_PREFIX}-${attachment}`);
|
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||||
}
|
|
||||||
|
|
||||||
_getOffset() {
|
|
||||||
const offset = {};
|
|
||||||
|
|
||||||
if (typeof this.config.offset === 'function') {
|
|
||||||
offset.fn = (data) => {
|
|
||||||
data.offsets = {
|
|
||||||
...data.offsets,
|
|
||||||
...(this.config.offset(data.offsets, this.element) || {}),
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
offset.offset = this.config.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getContainer() {
|
_getContainer() {
|
||||||
|
@ -531,8 +549,11 @@ class Tooltip {
|
||||||
|
|
||||||
triggers.forEach((trigger) => {
|
triggers.forEach((trigger) => {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
EventHandler.on(this.element, this.constructor.Event.CLICK, this.config.selector, (event) =>
|
EventHandler.on(
|
||||||
this.toggle(event)
|
this._element,
|
||||||
|
this.constructor.Event.CLICK,
|
||||||
|
this.config.selector,
|
||||||
|
(event) => this.toggle(event)
|
||||||
);
|
);
|
||||||
} else if (trigger !== TRIGGER_MANUAL) {
|
} else if (trigger !== TRIGGER_MANUAL) {
|
||||||
const eventIn =
|
const eventIn =
|
||||||
|
@ -544,21 +565,23 @@ class Tooltip {
|
||||||
? this.constructor.Event.MOUSELEAVE
|
? this.constructor.Event.MOUSELEAVE
|
||||||
: this.constructor.Event.FOCUSOUT;
|
: this.constructor.Event.FOCUSOUT;
|
||||||
|
|
||||||
EventHandler.on(this.element, eventIn, this.config.selector, (event) => this._enter(event));
|
EventHandler.on(this._element, eventIn, this.config.selector, (event) =>
|
||||||
EventHandler.on(this.element, eventOut, this.config.selector, (event) =>
|
this._enter(event)
|
||||||
|
);
|
||||||
|
EventHandler.on(this._element, eventOut, this.config.selector, (event) =>
|
||||||
this._leave(event)
|
this._leave(event)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._hideModalHandler = () => {
|
this._hideModalHandler = () => {
|
||||||
if (this.element) {
|
if (this._element) {
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EventHandler.on(
|
EventHandler.on(
|
||||||
this.element.closest(`.${CLASS_NAME_MODAL}`),
|
this._element.closest(`.${CLASS_NAME_MODAL}`),
|
||||||
'hide.bs.modal',
|
'hide.bs.modal',
|
||||||
this._hideModalHandler
|
this._hideModalHandler
|
||||||
);
|
);
|
||||||
|
@ -575,12 +598,16 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
_fixTitle() {
|
_fixTitle() {
|
||||||
const titleType = typeof this.element.getAttribute('data-original-title');
|
const title = this._element.getAttribute('title');
|
||||||
|
const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
|
||||||
|
|
||||||
if (this.element.getAttribute('title') || titleType !== 'string') {
|
if (title || originalTitleType !== 'string') {
|
||||||
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
this._element.setAttribute('data-bs-original-title', title || '');
|
||||||
|
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
|
||||||
|
this._element.setAttribute('aria-label', title);
|
||||||
|
}
|
||||||
|
|
||||||
this.element.setAttribute('title', '');
|
this._element.setAttribute('title', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,10 +692,10 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getConfig(config) {
|
_getConfig(config) {
|
||||||
const dataAttributes = Manipulator.getDataAttributes(this.element);
|
const dataAttributes = Manipulator.getDataAttributes(this._element);
|
||||||
|
|
||||||
Object.keys(dataAttributes).forEach((dataAttr) => {
|
Object.keys(dataAttributes).forEach((dataAttr) => {
|
||||||
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
|
||||||
delete dataAttributes[dataAttr];
|
delete dataAttributes[dataAttr];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -730,23 +757,15 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
_handlePopperPlacementChange(popperData) {
|
_handlePopperPlacementChange(popperData) {
|
||||||
this.tip = popperData.instance.popper;
|
const { state } = popperData;
|
||||||
this._cleanTipClass();
|
|
||||||
this._addAttachmentClass(this._getAttachment(popperData.placement));
|
|
||||||
}
|
|
||||||
|
|
||||||
_fixTransition() {
|
if (!state) {
|
||||||
const tip = this.getTipElement();
|
|
||||||
const initConfigAnimation = this.config.animation;
|
|
||||||
if (tip.getAttribute('x-placement') !== null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tip.classList.remove(CLASS_NAME_FADE);
|
this.tip = state.elements.popper;
|
||||||
this.config.animation = false;
|
this._cleanTipClass();
|
||||||
this.hide();
|
this._addAttachmentClass(this._getAttachment(state.placement));
|
||||||
this.show();
|
|
||||||
this.config.animation = initConfigAnimation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
|
@ -773,29 +792,27 @@ class Tooltip {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static getInstance(element) {
|
|
||||||
return Data.getData(element, DATA_KEY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const $ = getjQuery();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .tooltip to jQuery only if jQuery is present
|
* add .Tooltip to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
/* istanbul ignore if */
|
|
||||||
if ($) {
|
onDOMContentLoaded(() => {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const $ = getjQuery();
|
||||||
$.fn[NAME] = Tooltip.jQueryInterface;
|
/* istanbul ignore if */
|
||||||
$.fn[NAME].Constructor = Tooltip;
|
if ($) {
|
||||||
$.fn[NAME].noConflict = () => {
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = Tooltip.jQueryInterface;
|
||||||
return Tooltip.jQueryInterface;
|
$.fn[NAME].Constructor = Tooltip;
|
||||||
};
|
$.fn[NAME].noConflict = () => {
|
||||||
}
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
|
return Tooltip.jQueryInterface;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Tooltip;
|
export default Tooltip;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@ const getUID = (prefix) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelector = (element) => {
|
const getSelector = (element) => {
|
||||||
let selector = element.getAttribute('data-target');
|
let selector = element.getAttribute('data-bs-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
const hrefAttr = element.getAttribute('href');
|
const hrefAttr = element.getAttribute('href');
|
||||||
|
@ -71,8 +71,8 @@ const getTransitionDurationFromElement = (element) => {
|
||||||
// Get transition-duration of the element
|
// Get transition-duration of the element
|
||||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||||
|
|
||||||
const floatTransitionDuration = parseFloat(transitionDuration);
|
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
const floatTransitionDelay = parseFloat(transitionDelay);
|
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
||||||
|
|
||||||
// Return 0 if element or transition duration is not found
|
// Return 0 if element or transition duration is not found
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
@ -83,7 +83,10 @@ const getTransitionDurationFromElement = (element) => {
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const triggerTransitionEnd = (element) => {
|
const triggerTransitionEnd = (element) => {
|
||||||
|
@ -96,6 +99,7 @@ const emulateTransitionEnd = (element, duration) => {
|
||||||
let called = false;
|
let called = false;
|
||||||
const durationPadding = 5;
|
const durationPadding = 5;
|
||||||
const emulatedDuration = duration + durationPadding;
|
const emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
function listener() {
|
function listener() {
|
||||||
called = true;
|
called = true;
|
||||||
element.removeEventListener(TRANSITION_END, listener);
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
@ -174,15 +178,24 @@ const reflow = (element) => element.offsetHeight;
|
||||||
const getjQuery = () => {
|
const getjQuery = () => {
|
||||||
const { jQuery } = window;
|
const { jQuery } = window;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDOMContentLoaded = (callback) => {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getjQuery,
|
|
||||||
TRANSITION_END,
|
TRANSITION_END,
|
||||||
getUID,
|
getUID,
|
||||||
getSelectorFromElement,
|
getSelectorFromElement,
|
||||||
|
@ -196,4 +209,7 @@ export {
|
||||||
findShadowRoot,
|
findShadowRoot,
|
||||||
noop,
|
noop,
|
||||||
reflow,
|
reflow,
|
||||||
|
getjQuery,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
isRTL,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha2): util/sanitizer.js
|
* Bootstrap (v5.0.0-beta1): util/sanitizer.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uriAttrs = [
|
const uriAttrs = new Set([
|
||||||
'background',
|
'background',
|
||||||
'cite',
|
'cite',
|
||||||
'href',
|
'href',
|
||||||
|
@ -14,7 +14,7 @@ const uriAttrs = [
|
||||||
'poster',
|
'poster',
|
||||||
'src',
|
'src',
|
||||||
'xlink:href',
|
'xlink:href',
|
||||||
];
|
]);
|
||||||
|
|
||||||
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|vid
|
||||||
const allowedAttribute = (attr, allowedAttributeList) => {
|
const allowedAttribute = (attr, allowedAttributeList) => {
|
||||||
const attrName = attr.nodeName.toLowerCase();
|
const attrName = attr.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
if (allowedAttributeList.includes(attrName)) {
|
||||||
if (uriAttrs.indexOf(attrName) !== -1) {
|
if (uriAttrs.has(attrName)) {
|
||||||
return Boolean(
|
return Boolean(
|
||||||
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||||
);
|
);
|
||||||
|
@ -109,7 +109,7 @@ export function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
|
||||||
const el = elements[i];
|
const el = elements[i];
|
||||||
const elName = el.nodeName.toLowerCase();
|
const elName = el.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (allowlistKeys.indexOf(elName) === -1) {
|
if (!allowlistKeys.includes(elName)) {
|
||||||
el.parentNode.removeChild(el);
|
el.parentNode.removeChild(el);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSAlert from '../bootstrap/src/alert';
|
import BSAlert from '../bootstrap/mdb-prefix/alert';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -78,17 +78,18 @@ SelectorEngine.find(SELECTOR_ALERT).forEach((el) => {
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
const $ = getjQuery();
|
if ($) {
|
||||||
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
if ($) {
|
$.fn[NAME] = Alert.jQueryInterface;
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
$.fn[NAME].Constructor = Alert;
|
||||||
$.fn[NAME] = Alert.jQueryInterface;
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME].Constructor = Alert;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
$.fn[NAME].noConflict = () => {
|
return Alert.jQueryInterface;
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
};
|
||||||
return Alert.jQueryInterface;
|
}
|
||||||
};
|
});
|
||||||
}
|
|
||||||
|
|
||||||
export default Alert;
|
export default Alert;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSCarousel from '../bootstrap/src/carousel';
|
import BSCarousel from '../bootstrap/mdb-prefix/carousel';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -19,7 +19,7 @@ const EVENT_SLID_BS = 'slid.bs.carousel';
|
||||||
const EVENT_SLIDE = `slide${EVENT_KEY}`;
|
const EVENT_SLIDE = `slide${EVENT_KEY}`;
|
||||||
const EVENT_SLID = `slid${EVENT_KEY}`;
|
const EVENT_SLID = `slid${EVENT_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
|
const SELECTOR_DATA_RIDE = '[data-mdb-ride="carousel"]';
|
||||||
|
|
||||||
class Carousel extends BSCarousel {
|
class Carousel extends BSCarousel {
|
||||||
constructor(element, data) {
|
constructor(element, data) {
|
||||||
|
@ -89,16 +89,18 @@ SelectorEngine.find(SELECTOR_DATA_RIDE).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Carousel.jQueryInterface;
|
$.fn[NAME] = Carousel.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Carousel;
|
$.fn[NAME].Constructor = Carousel;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Carousel.jQueryInterface;
|
return Carousel.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Carousel;
|
export default Carousel;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getjQuery, typeCheckConfig } from '../mdb/util/index';
|
import { getjQuery, typeCheckConfig, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../bootstrap/src/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSDropdown from '../bootstrap/src/dropdown';
|
import Manipulator from '../mdb/dom/manipulator';
|
||||||
import Manipulator from '../bootstrap/src/dom/manipulator';
|
import BSDropdown from '../bootstrap/mdb-prefix/dropdown';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -14,7 +14,7 @@ const NAME = 'dropdown';
|
||||||
const DATA_KEY = `mdb.${NAME}`;
|
const DATA_KEY = `mdb.${NAME}`;
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_EXPAND = '[data-toggle="dropdown"]';
|
const SELECTOR_EXPAND = '[data-mdb-toggle="dropdown"]';
|
||||||
|
|
||||||
const Default = {
|
const Default = {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
@ -56,7 +56,7 @@ class Dropdown extends BSDropdown {
|
||||||
this._config = this._getConfig(data);
|
this._config = this._getConfig(data);
|
||||||
this._parent = Dropdown.getParentFromElement(this._element);
|
this._parent = Dropdown.getParentFromElement(this._element);
|
||||||
this._menuStyle = '';
|
this._menuStyle = '';
|
||||||
this._xPlacement = '';
|
this._popperPlacement = '';
|
||||||
|
|
||||||
//* prevents dropdown close issue when system animation is turned off
|
//* prevents dropdown close issue when system animation is turned off
|
||||||
const isPrefersReducedMotionSet = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
const isPrefersReducedMotionSet = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||||
|
@ -97,6 +97,56 @@ class Dropdown extends BSDropdown {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getOffset() {
|
||||||
|
const offset = [];
|
||||||
|
|
||||||
|
if (Manipulator.getDataAttribute(this._element, 'offset')) {
|
||||||
|
Manipulator.getDataAttribute(this._element, 'offset')
|
||||||
|
.split(',')
|
||||||
|
.forEach((value) => {
|
||||||
|
offset.push(parseInt(value, 10));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getPopperConfig() {
|
||||||
|
const popperConfig = {
|
||||||
|
placement: this._getPlacement(),
|
||||||
|
modifiers: [
|
||||||
|
{
|
||||||
|
name: 'preventOverflow',
|
||||||
|
options: {
|
||||||
|
altBoundary: this._config.flip,
|
||||||
|
rootBoundary: this._config.boundary,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'offset',
|
||||||
|
options: {
|
||||||
|
offset: this._getOffset(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Disable Popper if we have a static display
|
||||||
|
if (this._config.display === 'static') {
|
||||||
|
popperConfig.modifiers = [
|
||||||
|
{
|
||||||
|
name: 'applyStyles',
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...popperConfig,
|
||||||
|
...this._config.popperConfig,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
_bindShowEvent() {
|
_bindShowEvent() {
|
||||||
EventHandler.on(this._element, EVENT_SHOW, (e) => {
|
EventHandler.on(this._element, EVENT_SHOW, (e) => {
|
||||||
EventHandler.trigger(this._element, EVENT_SHOW_MDB, { relatedTarget: e.relatedTarget });
|
EventHandler.trigger(this._element, EVENT_SHOW_MDB, { relatedTarget: e.relatedTarget });
|
||||||
|
@ -116,7 +166,7 @@ class Dropdown extends BSDropdown {
|
||||||
EventHandler.trigger(this._parent, EVENT_HIDE_MDB, { relatedTarget: e.relatedTarget });
|
EventHandler.trigger(this._parent, EVENT_HIDE_MDB, { relatedTarget: e.relatedTarget });
|
||||||
|
|
||||||
this._menuStyle = this._menu.style.cssText;
|
this._menuStyle = this._menu.style.cssText;
|
||||||
this._xPlacement = this._menu.getAttribute('x-placement');
|
this._popperPlacement = this._menu.getAttribute('data-popper-placement');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +174,11 @@ class Dropdown extends BSDropdown {
|
||||||
EventHandler.on(this._parent, EVENT_HIDDEN, (e) => {
|
EventHandler.on(this._parent, EVENT_HIDDEN, (e) => {
|
||||||
EventHandler.trigger(this._parent, EVENT_HIDDEN_MDB, { relatedTarget: e.relatedTarget });
|
EventHandler.trigger(this._parent, EVENT_HIDDEN_MDB, { relatedTarget: e.relatedTarget });
|
||||||
|
|
||||||
this._menu.style.cssText = this._menuStyle;
|
if (this._config.display !== 'static' && this._menuStyle !== '') {
|
||||||
this._menu.setAttribute('x-placement', this._xPlacement);
|
this._menu.style.cssText = this._menuStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._menu.setAttribute('data-popper-placement', this._popperPlacement);
|
||||||
|
|
||||||
this._dropdownAnimationStart('hide');
|
this._dropdownAnimationStart('hide');
|
||||||
});
|
});
|
||||||
|
@ -174,16 +227,18 @@ SelectorEngine.find(SELECTOR_EXPAND).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Dropdown.jQueryInterface;
|
$.fn[NAME] = Dropdown.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Dropdown;
|
$.fn[NAME].Constructor = Dropdown;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Dropdown.jQueryInterface;
|
return Dropdown.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Dropdown;
|
export default Dropdown;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { element, getjQuery } from '../mdb/util/index';
|
import { element, getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import Data from '../mdb/dom/data';
|
import Data from '../mdb/dom/data';
|
||||||
import EventHandler from '../bootstrap/src/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import Manipulator from '../mdb/dom/manipulator';
|
import Manipulator from '../mdb/dom/manipulator';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import 'detect-autofill';
|
import 'detect-autofill';
|
||||||
|
@ -327,16 +327,18 @@ EventHandler.on(window, 'onautocomplete', (e) => {
|
||||||
instance.forceActive();
|
instance.forceActive();
|
||||||
});
|
});
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Input.jQueryInterface;
|
$.fn[NAME] = Input.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Input;
|
$.fn[NAME].Constructor = Input;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Input.jQueryInterface;
|
return Input.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Input;
|
export default Input;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery, getSelectorFromElement } from '../mdb/util/index';
|
import { getjQuery, getSelectorFromElement, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSModal from '../bootstrap/src/modal';
|
import BSModal from '../bootstrap/mdb-prefix/modal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,7 @@ const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="modal"]';
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="modal"]';
|
||||||
|
|
||||||
class Modal extends BSModal {
|
class Modal extends BSModal {
|
||||||
constructor(element, data) {
|
constructor(element, data) {
|
||||||
|
@ -109,19 +109,21 @@ SelectorEngine.find(SELECTOR_DATA_TOGGLE).forEach((el) => {
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .modal to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Modal.jQueryInterface;
|
$.fn[NAME] = Modal.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Modal;
|
$.fn[NAME].Constructor = Modal;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Modal.jQueryInterface;
|
return Modal.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Modal;
|
export default Modal;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSPopover from '../bootstrap/src/popover';
|
import BSPopover from '../bootstrap/mdb-prefix/popover';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,7 @@ const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||||
const EVENT_INSERTED = `inserted${EVENT_KEY}`;
|
const EVENT_INSERTED = `inserted${EVENT_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="popover"]';
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="popover"]';
|
||||||
|
|
||||||
class Popover extends BSPopover {
|
class Popover extends BSPopover {
|
||||||
constructor(element, data) {
|
constructor(element, data) {
|
||||||
|
@ -109,16 +109,18 @@ SelectorEngine.find(SELECTOR_DATA_TOGGLE).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Popover.jQueryInterface;
|
$.fn[NAME] = Popover.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Popover;
|
$.fn[NAME].Constructor = Popover;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Popover.jQueryInterface;
|
return Popover.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Popover;
|
export default Popover;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { getjQuery, element } from '../mdb/util/index';
|
import { getjQuery, element, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import Data from '../mdb/dom/data';
|
import Data from '../mdb/dom/data';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import Manipulator from '../mdb/dom/manipulator';
|
import Manipulator from '../mdb/dom/manipulator';
|
||||||
|
@ -142,16 +142,18 @@ class Range {
|
||||||
SelectorEngine.find(SELECTOR_WRAPPER).map((element) => new Range(element));
|
SelectorEngine.find(SELECTOR_WRAPPER).map((element) => new Range(element));
|
||||||
|
|
||||||
// jQuery init
|
// jQuery init
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Range.jQueryInterface;
|
$.fn[NAME] = Range.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Range;
|
$.fn[NAME].Constructor = Range;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Range.jQueryInterface;
|
return Range.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Range;
|
export default Range;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { element, getjQuery, typeCheckConfig } from '../mdb/util/index';
|
import { element, getjQuery, typeCheckConfig, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import Data from '../mdb/dom/data';
|
import Data from '../mdb/dom/data';
|
||||||
import EventHandler from '../bootstrap/src/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import Manipulator from '../mdb/dom/manipulator';
|
import Manipulator from '../mdb/dom/manipulator';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
|
|
||||||
|
@ -353,16 +353,18 @@ SELECTOR_COMPONENT.forEach((selector) => {
|
||||||
* add .ripple to jQuery only if jQuery is present
|
* add .ripple to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Ripple.jQueryInterface;
|
$.fn[NAME] = Ripple.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Ripple;
|
$.fn[NAME].Constructor = Ripple;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Ripple.jQueryInterface;
|
return Ripple.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Ripple;
|
export default Ripple;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import Manipulator from '../mdb/dom/manipulator';
|
import Manipulator from '../mdb/dom/manipulator';
|
||||||
import BSScrollSpy from '../bootstrap/src/scrollspy';
|
import BSScrollSpy from '../bootstrap/mdb-prefix/scrollspy';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -13,12 +13,14 @@ import BSScrollSpy from '../bootstrap/src/scrollspy';
|
||||||
const NAME = 'scrollspy';
|
const NAME = 'scrollspy';
|
||||||
const DATA_KEY = `mdb.${NAME}`;
|
const DATA_KEY = `mdb.${NAME}`;
|
||||||
const EVENT_KEY = `.${DATA_KEY}`;
|
const EVENT_KEY = `.${DATA_KEY}`;
|
||||||
|
const DATA_API_KEY = '.data-api';
|
||||||
|
|
||||||
const EVENT_ACTIVATE_BS = 'activate.bs.scrollspy';
|
const EVENT_ACTIVATE_BS = 'activate.bs.scrollspy';
|
||||||
|
|
||||||
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_DATA_SPY = '[data-spy="scroll"]';
|
const SELECTOR_DATA_SPY = '[data-mdb-spy="scroll"]';
|
||||||
|
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||||
|
|
||||||
class ScrollSpy extends BSScrollSpy {
|
class ScrollSpy extends BSScrollSpy {
|
||||||
constructor(element, data) {
|
constructor(element, data) {
|
||||||
|
@ -61,11 +63,13 @@ class ScrollSpy extends BSScrollSpy {
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SelectorEngine.find(SELECTOR_DATA_SPY).forEach((el) => {
|
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||||
let instance = ScrollSpy.getInstance(el);
|
SelectorEngine.find(SELECTOR_DATA_SPY).forEach((el) => {
|
||||||
if (!instance) {
|
let instance = ScrollSpy.getInstance(el);
|
||||||
instance = new ScrollSpy(el, Manipulator.getDataAttributes(el));
|
if (!instance) {
|
||||||
}
|
instance = new ScrollSpy(el, Manipulator.getDataAttributes(el));
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,16 +79,18 @@ SelectorEngine.find(SELECTOR_DATA_SPY).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
$.fn[NAME] = ScrollSpy.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = ScrollSpy;
|
$.fn[NAME].Constructor = ScrollSpy;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return ScrollSpy.jQueryInterface;
|
return ScrollSpy.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default ScrollSpy;
|
export default ScrollSpy;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery, getElementFromSelector } from '../mdb/util/index';
|
import { getjQuery, getElementFromSelector, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSTab from '../bootstrap/src/tab';
|
import BSTab from '../bootstrap/mdb-prefix/tab';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -31,7 +31,8 @@ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||||
const SELECTOR_ACTIVE = '.active';
|
const SELECTOR_ACTIVE = '.active';
|
||||||
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
|
const SELECTOR_DATA_TOGGLE =
|
||||||
|
'[data-mdb-toggle="tab"], [data-mdb-toggle="pill"], [data-mdb-toggle="list"]';
|
||||||
|
|
||||||
class Tab extends BSTab {
|
class Tab extends BSTab {
|
||||||
constructor(element) {
|
constructor(element) {
|
||||||
|
@ -180,16 +181,18 @@ SelectorEngine.find(SELECTOR_DATA_TOGGLE).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Tab.jQueryInterface;
|
$.fn[NAME] = Tab.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Tab;
|
$.fn[NAME].Constructor = Tab;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tab.jQueryInterface;
|
return Tab.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Tab;
|
export default Tab;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../mdb/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
import BSToast from '../bootstrap/src/toast';
|
import BSToast from '../bootstrap/mdb-prefix/toast';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -99,16 +99,18 @@ SelectorEngine.find(SELECTOR_TOAST).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Toast.jQueryInterface;
|
$.fn[NAME] = Toast.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Toast;
|
$.fn[NAME].Constructor = Toast;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Toast.jQueryInterface;
|
return Toast.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Toast;
|
export default Toast;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { getjQuery } from '../mdb/util/index';
|
import { getjQuery, onDOMContentLoaded } from '../mdb/util/index';
|
||||||
import EventHandler from '../bootstrap/src/dom/event-handler';
|
import EventHandler from '../mdb/dom/event-handler';
|
||||||
import BSTooltip from '../bootstrap/src/tooltip';
|
import BSTooltip from '../bootstrap/mdb-prefix/tooltip';
|
||||||
import SelectorEngine from '../mdb/dom/selector-engine';
|
import SelectorEngine from '../mdb/dom/selector-engine';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@ const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||||
const EVENT_INSERTED = `inserted${EVENT_KEY}`;
|
const EVENT_INSERTED = `inserted${EVENT_KEY}`;
|
||||||
|
|
||||||
const SELECTOR_DATA_TOGGLE = '[data-toggle="tooltip"]';
|
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="tooltip"]';
|
||||||
|
|
||||||
class Tooltip extends BSTooltip {
|
class Tooltip extends BSTooltip {
|
||||||
constructor(element, data) {
|
constructor(element, data) {
|
||||||
|
@ -109,16 +109,18 @@ SelectorEngine.find(SELECTOR_DATA_TOGGLE).forEach((el) => {
|
||||||
* add .rating to jQuery only if jQuery is present
|
* add .rating to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const $ = getjQuery();
|
onDOMContentLoaded(() => {
|
||||||
|
const $ = getjQuery();
|
||||||
|
|
||||||
if ($) {
|
if ($) {
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
const JQUERY_NO_CONFLICT = $.fn[NAME];
|
||||||
$.fn[NAME] = Tooltip.jQueryInterface;
|
$.fn[NAME] = Tooltip.jQueryInterface;
|
||||||
$.fn[NAME].Constructor = Tooltip;
|
$.fn[NAME].Constructor = Tooltip;
|
||||||
$.fn[NAME].noConflict = () => {
|
$.fn[NAME].noConflict = () => {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tooltip.jQueryInterface;
|
return Tooltip.jQueryInterface;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default Tooltip;
|
export default Tooltip;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// BOOTSTRAP CORE COMPONENTS
|
// BOOTSTRAP CORE COMPONENTS
|
||||||
import Collapse from './bootstrap/src/collapse';
|
import Button from './bootstrap/mdb-prefix/button';
|
||||||
|
import Collapse from './bootstrap/mdb-prefix/collapse';
|
||||||
import Alert from './free/alert';
|
import Alert from './free/alert';
|
||||||
import Button from './bootstrap/src/button';
|
|
||||||
import Carousel from './free/carousel';
|
import Carousel from './free/carousel';
|
||||||
import Modal from './free/modal';
|
import Modal from './free/modal';
|
||||||
import Popover from './free/popover';
|
import Popover from './free/popover';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): dom/data.js
|
* Bootstrap (v5.0.0-beta1): dom/data.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): dom/event-handler.js
|
* Bootstrap (v5.0.0-beta1): dom/event-handler.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defaultPreventedPreservedOnDispatch } from './polyfill';
|
|
||||||
import { getjQuery } from '../util/index';
|
import { getjQuery } from '../util/index';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,6 +93,8 @@ function getEvent(element) {
|
||||||
|
|
||||||
function bootstrapHandler(element, fn) {
|
function bootstrapHandler(element, fn) {
|
||||||
return function handler(event) {
|
return function handler(event) {
|
||||||
|
event.delegateTarget = element;
|
||||||
|
|
||||||
if (handler.oneOff) {
|
if (handler.oneOff) {
|
||||||
EventHandler.off(element, event.type, fn);
|
EventHandler.off(element, event.type, fn);
|
||||||
}
|
}
|
||||||
|
@ -109,6 +110,8 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
||||||
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
||||||
for (let i = domElements.length; i--; '') {
|
for (let i = domElements.length; i--; '') {
|
||||||
if (domElements[i] === target) {
|
if (domElements[i] === target) {
|
||||||
|
event.delegateTarget = target;
|
||||||
|
|
||||||
if (handler.oneOff) {
|
if (handler.oneOff) {
|
||||||
EventHandler.off(element, event.type, fn);
|
EventHandler.off(element, event.type, fn);
|
||||||
}
|
}
|
||||||
|
@ -318,12 +321,6 @@ const EventHandler = {
|
||||||
|
|
||||||
if (defaultPrevented) {
|
if (defaultPrevented) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
if (!defaultPreventedPreservedOnDispatch) {
|
|
||||||
Object.defineProperty(evt, 'defaultPrevented', {
|
|
||||||
get: () => true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nativeDispatch) {
|
if (nativeDispatch) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): dom/manipulator.js
|
* Bootstrap (v5.0.0-beta1): dom/manipulator.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ function normalizeDataKey(key) {
|
||||||
|
|
||||||
const Manipulator = {
|
const Manipulator = {
|
||||||
setDataAttribute(element, key, value) {
|
setDataAttribute(element, key, value) {
|
||||||
element.setAttribute(`data-${normalizeDataKey(key)}`, value);
|
element.setAttribute(`data-mdb-${normalizeDataKey(key)}`, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeDataAttribute(element, key) {
|
removeDataAttribute(element, key) {
|
||||||
element.removeAttribute(`data-${normalizeDataKey(key)}`);
|
element.removeAttribute(`data-mdb-${normalizeDataKey(key)}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataAttributes(element) {
|
getDataAttributes(element) {
|
||||||
|
@ -47,15 +47,19 @@ const Manipulator = {
|
||||||
...element.dataset,
|
...element.dataset,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(attributes).forEach((key) => {
|
Object.keys(attributes)
|
||||||
attributes[key] = normalizeData(attributes[key]);
|
.filter((key) => key.startsWith('mdb'))
|
||||||
});
|
.forEach((key) => {
|
||||||
|
let pureKey = key.replace(/^mdb/, '');
|
||||||
|
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||||||
|
attributes[pureKey] = normalizeData(attributes[key]);
|
||||||
|
});
|
||||||
|
|
||||||
return attributes;
|
return attributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDataAttribute(element, key) {
|
getDataAttribute(element, key) {
|
||||||
return normalizeData(element.getAttribute(`data-${normalizeDataKey(key)}`));
|
return normalizeData(element.getAttribute(`data-mdb-${normalizeDataKey(key)}`));
|
||||||
},
|
},
|
||||||
|
|
||||||
offset(element) {
|
offset(element) {
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
/* istanbul ignore file */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v5.0.0-alpha1): dom/polyfill.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { getUID } from '../util/index';
|
|
||||||
|
|
||||||
let findElements = Element.prototype.querySelectorAll;
|
|
||||||
let findElement = Element.prototype.querySelector;
|
|
||||||
|
|
||||||
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
|
||||||
const defaultPreventedPreservedOnDispatch = (() => {
|
|
||||||
const e = new CustomEvent('Bootstrap', {
|
|
||||||
cancelable: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const element = document.createElement('div');
|
|
||||||
element.addEventListener('Bootstrap', () => null);
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
element.dispatchEvent(e);
|
|
||||||
return e.defaultPrevented;
|
|
||||||
})();
|
|
||||||
|
|
||||||
const scopeSelectorRegex = /:scope\b/;
|
|
||||||
const supportScopeQuery = (() => {
|
|
||||||
const element = document.createElement('div');
|
|
||||||
|
|
||||||
try {
|
|
||||||
element.querySelectorAll(':scope *');
|
|
||||||
} catch (_) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (!supportScopeQuery) {
|
|
||||||
findElements = function (selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelectorAll(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasId = Boolean(this.id);
|
|
||||||
|
|
||||||
if (!hasId) {
|
|
||||||
this.id = getUID('scope');
|
|
||||||
}
|
|
||||||
|
|
||||||
let nodeList = null;
|
|
||||||
try {
|
|
||||||
selector = selector.replace(scopeSelectorRegex, `#${this.id}`);
|
|
||||||
nodeList = this.querySelectorAll(selector);
|
|
||||||
} finally {
|
|
||||||
if (!hasId) {
|
|
||||||
this.removeAttribute('id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodeList;
|
|
||||||
};
|
|
||||||
|
|
||||||
findElement = function (selector) {
|
|
||||||
if (!scopeSelectorRegex.test(selector)) {
|
|
||||||
return this.querySelector(selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
const matches = find.call(this, selector);
|
|
||||||
|
|
||||||
if (typeof matches[0] !== 'undefined') {
|
|
||||||
return matches[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const find = findElements;
|
|
||||||
const findOne = findElement;
|
|
||||||
|
|
||||||
export { find, findOne, defaultPreventedPreservedOnDispatch };
|
|
|
@ -1,12 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): dom/selector-engine.js
|
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { find as findFn, findOne } from './polyfill';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -25,11 +23,11 @@ const SelectorEngine = {
|
||||||
},
|
},
|
||||||
|
|
||||||
find(selector, element = document.documentElement) {
|
find(selector, element = document.documentElement) {
|
||||||
return [].concat(...findFn.call(element, selector));
|
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||||
},
|
},
|
||||||
|
|
||||||
findOne(selector, element = document.documentElement) {
|
findOne(selector, element = document.documentElement) {
|
||||||
return findOne.call(element, selector);
|
return Element.prototype.querySelector.call(element, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
children(element, selector) {
|
children(element, selector) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): util/index.js
|
* Bootstrap (v5.0.0-beta1): util/index.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const getUID = (prefix) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelector = (element) => {
|
const getSelector = (element) => {
|
||||||
let selector = element.getAttribute('data-target');
|
let selector = element.getAttribute('data-mdb-target');
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
if (!selector || selector === '#') {
|
||||||
const hrefAttr = element.getAttribute('href');
|
const hrefAttr = element.getAttribute('href');
|
||||||
|
@ -71,8 +71,8 @@ const getTransitionDurationFromElement = (element) => {
|
||||||
// Get transition-duration of the element
|
// Get transition-duration of the element
|
||||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||||
|
|
||||||
const floatTransitionDuration = parseFloat(transitionDuration);
|
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||||
const floatTransitionDelay = parseFloat(transitionDelay);
|
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
||||||
|
|
||||||
// Return 0 if element or transition duration is not found
|
// Return 0 if element or transition duration is not found
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
@ -83,7 +83,10 @@ const getTransitionDurationFromElement = (element) => {
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
return (
|
||||||
|
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||||
|
MILLISECONDS_MULTIPLIER
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const triggerTransitionEnd = (element) => {
|
const triggerTransitionEnd = (element) => {
|
||||||
|
@ -96,6 +99,7 @@ const emulateTransitionEnd = (element, duration) => {
|
||||||
let called = false;
|
let called = false;
|
||||||
const durationPadding = 5;
|
const durationPadding = 5;
|
||||||
const emulatedDuration = duration + durationPadding;
|
const emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
function listener() {
|
function listener() {
|
||||||
called = true;
|
called = true;
|
||||||
element.removeEventListener(TRANSITION_END, listener);
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
@ -174,13 +178,23 @@ const reflow = (element) => element.offsetHeight;
|
||||||
const getjQuery = () => {
|
const getjQuery = () => {
|
||||||
const { jQuery } = window;
|
const { jQuery } = window;
|
||||||
|
|
||||||
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
if (jQuery && !document.body.hasAttribute('data-mdb-no-jquery')) {
|
||||||
return jQuery;
|
return jQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDOMContentLoaded = (callback) => {
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', callback);
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isRTL = document.documentElement.dir === 'rtl';
|
||||||
|
|
||||||
const array = (collection) => {
|
const array = (collection) => {
|
||||||
return Array.from(collection);
|
return Array.from(collection);
|
||||||
};
|
};
|
||||||
|
@ -206,4 +220,6 @@ export {
|
||||||
reflow,
|
reflow,
|
||||||
array,
|
array,
|
||||||
element,
|
element,
|
||||||
|
onDOMContentLoaded,
|
||||||
|
isRTL,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v5.0.0-alpha1): util/sanitizer.js
|
* Bootstrap (v5.0.0-beta1): util/sanitizer.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const uriAttrs = [
|
const uriAttrs = new Set([
|
||||||
'background',
|
'background',
|
||||||
'cite',
|
'cite',
|
||||||
'href',
|
'href',
|
||||||
|
@ -14,7 +14,7 @@ const uriAttrs = [
|
||||||
'poster',
|
'poster',
|
||||||
'src',
|
'src',
|
||||||
'xlink:href',
|
'xlink:href',
|
||||||
];
|
]);
|
||||||
|
|
||||||
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
||||||
|
|
||||||
|
@ -35,9 +35,11 @@ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|vid
|
||||||
const allowedAttribute = (attr, allowedAttributeList) => {
|
const allowedAttribute = (attr, allowedAttributeList) => {
|
||||||
const attrName = attr.nodeName.toLowerCase();
|
const attrName = attr.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
if (allowedAttributeList.includes(attrName)) {
|
||||||
if (uriAttrs.indexOf(attrName) !== -1) {
|
if (uriAttrs.has(attrName)) {
|
||||||
return SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue);
|
return Boolean(
|
||||||
|
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
124
src/scss/bootstrap/_accordion.scss
Normal file
124
src/scss/bootstrap/_accordion.scss
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
//
|
||||||
|
// Base styles
|
||||||
|
//
|
||||||
|
|
||||||
|
.accordion-button {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
padding: $accordion-button-padding-y $accordion-button-padding-x;
|
||||||
|
@include font-size($font-size-base);
|
||||||
|
color: $accordion-button-color;
|
||||||
|
background-color: $accordion-button-bg;
|
||||||
|
border: $accordion-border-width solid $accordion-border-color;
|
||||||
|
@include border-radius(0);
|
||||||
|
overflow-anchor: none;
|
||||||
|
@include transition($accordion-transition);
|
||||||
|
|
||||||
|
&.collapsed {
|
||||||
|
border-bottom-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.collapsed) {
|
||||||
|
color: $accordion-button-active-color;
|
||||||
|
background-color: $accordion-button-active-bg;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
background-image: escape-svg($accordion-button-active-icon);
|
||||||
|
transform: $accordion-icon-transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accordion icon
|
||||||
|
&::after {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: $accordion-icon-width;
|
||||||
|
height: $accordion-icon-width;
|
||||||
|
margin-left: auto;
|
||||||
|
content: '';
|
||||||
|
background-image: escape-svg($accordion-button-icon);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: $accordion-icon-width;
|
||||||
|
@include transition($accordion-icon-transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
z-index: 3;
|
||||||
|
border-color: $accordion-button-focus-border-color;
|
||||||
|
outline: 0;
|
||||||
|
box-shadow: $accordion-button-focus-box-shadow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-header {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-item {
|
||||||
|
&:first-of-type {
|
||||||
|
.accordion-button {
|
||||||
|
@include border-top-radius($accordion-border-radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
.accordion-button {
|
||||||
|
// Only set a border-radius on the last item if the accordion is collapsed
|
||||||
|
&.collapsed {
|
||||||
|
border-bottom-width: $accordion-border-width;
|
||||||
|
@include border-bottom-radius($accordion-border-radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-collapse {
|
||||||
|
border-bottom-width: $accordion-border-width;
|
||||||
|
@include border-bottom-radius($accordion-border-radius);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-collapse {
|
||||||
|
border: solid $accordion-border-color;
|
||||||
|
border-width: 0 $accordion-border-width;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-body {
|
||||||
|
padding: $accordion-body-padding-y $accordion-body-padding-x;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flush accordion items
|
||||||
|
//
|
||||||
|
// Remove borders and border-radius to keep accordion items edge-to-edge.
|
||||||
|
|
||||||
|
.accordion-flush {
|
||||||
|
.accordion-button {
|
||||||
|
border-right: 0;
|
||||||
|
border-left: 0;
|
||||||
|
@include border-radius(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-collapse {
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-item {
|
||||||
|
&:first-of-type {
|
||||||
|
.accordion-button {
|
||||||
|
border-top-width: 0;
|
||||||
|
@include border-top-radius(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
.accordion-button.collapsed {
|
||||||
|
border-bottom-width: 0;
|
||||||
|
@include border-bottom-radius(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
z-index: $stretched-link-z-index + 1;
|
||||||
padding: $alert-padding-y * 1.25 $alert-padding-x;
|
padding: $alert-padding-y * 1.25 $alert-padding-x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,13 +41,15 @@
|
||||||
// scss-docs-start alert-modifiers
|
// scss-docs-start alert-modifiers
|
||||||
// Generate contextual modifier classes for colorizing the alert.
|
// Generate contextual modifier classes for colorizing the alert.
|
||||||
|
|
||||||
@each $color, $value in $theme-colors {
|
@each $state, $value in $theme-colors {
|
||||||
.alert-#{$color} {
|
$background: shift-color($value, $alert-bg-scale);
|
||||||
@include alert-variant(
|
$border: shift-color($value, $alert-border-scale);
|
||||||
color-level($value, $alert-bg-level),
|
$color: shift-color($value, $alert-color-scale);
|
||||||
color-level($value, $alert-border-level),
|
@if (contrast-ratio($background, $color) < $min-contrast-ratio) {
|
||||||
color-level($value, $alert-color-level)
|
$color: mix($value, color-contrast($background), abs($alert-color-scale));
|
||||||
);
|
}
|
||||||
|
.alert-#{$state} {
|
||||||
|
@include alert-variant($background, $border, $color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// scss-docs-end alert-modifiers
|
// scss-docs-end alert-modifiers
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user