MDL-67386 theme_boost: upgrade bootstrap to version 4.5.0

This commit is contained in:
Bas Brands
2020-05-25 15:48:17 +02:00
parent 71965a8572
commit 6a4ce7b0a3
159 changed files with 6385 additions and 8424 deletions
+14 -14
View File
@@ -74,19 +74,19 @@ media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/index.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/sanitizer.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/toast.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/bootstrap/alert.js
theme/boost/amd/src/bootstrap/button.js
theme/boost/amd/src/bootstrap/carousel.js
theme/boost/amd/src/bootstrap/collapse.js
theme/boost/amd/src/bootstrap/dropdown.js
theme/boost/amd/src/bootstrap/index.js
theme/boost/amd/src/bootstrap/modal.js
theme/boost/amd/src/bootstrap/popover.js
theme/boost/amd/src/bootstrap/tools/sanitizer.js
theme/boost/amd/src/bootstrap/scrollspy.js
theme/boost/amd/src/bootstrap/tab.js
theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
+14 -14
View File
@@ -75,19 +75,19 @@ media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/index.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/sanitizer.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/toast.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/bootstrap/alert.js
theme/boost/amd/src/bootstrap/button.js
theme/boost/amd/src/bootstrap/carousel.js
theme/boost/amd/src/bootstrap/collapse.js
theme/boost/amd/src/bootstrap/dropdown.js
theme/boost/amd/src/bootstrap/index.js
theme/boost/amd/src/bootstrap/modal.js
theme/boost/amd/src/bootstrap/popover.js
theme/boost/amd/src/bootstrap/tools/sanitizer.js
theme/boost/amd/src/bootstrap/scrollspy.js
theme/boost/amd/src/bootstrap/tab.js
theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
@@ -49,7 +49,7 @@
</div>
{{#js}}
require(['jquery'], function($) {
require(['theme_boost/popover'], function() {
require(['theme_boost/bootstrap/popover'], function() {
var target = $("#calendar-day-popover-link-{{courseid}}-{{year}}-{{yday}}-{{uniqid}}");
target.popover({
content: function() {
@@ -124,9 +124,7 @@ Feature: Teacher can search and enrol users one by one into the course
And I should see "Student 001"
And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
Then I should see "Active" in the "Student 001" "table_row"
# The following line is commented out as auto-hidden toasts fire events in the wrong place.
# TODO Uncomment this when we upgrade Bootstrap. This issue is fixed in v4.4.0 - see MDL-67386.
#And I should see "1 enrolled users"
And I should see "1 enrolled users"
@javascript
Scenario: Searching for a non-existing user
+1 -1
View File
@@ -44,7 +44,7 @@
</div>
</div>
{{#js}}
require(['jquery', 'theme_boost/toast'], function(jQuery) {
require(['jquery', 'theme_boost/bootstrap/toast'], function(jQuery) {
// Show the toast.
// Bootstrap toast components are not shown automatically.
jQuery('#toast-{{uniqid}}').toast('show');
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/alert",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var j="bs.alert",k=".".concat(j),l=h.default.fn.alert,m={CLOSE:"close".concat(k),CLOSED:"closed".concat(k),CLICK_DATA_API:"click".concat(k).concat(".data-api")},n={ALERT:"alert",FADE:"fade",SHOW:"show"},o=function(){function a(b){e(this,a);this._element=b}g(a,[{key:"close",value:function(a){var b=this._element;if(a){b=this._getRootElement(a)}var c=this._triggerCloseEvent(b);if(c.isDefaultPrevented()){return}this._removeElement(b)}},{key:"dispose",value:function(){h.default.removeData(this._element,j);this._element=null}},{key:"_getRootElement",value:function(a){var b=i.default.getSelectorFromElement(a),c=!1;if(b){c=document.querySelector(b)}if(!c){c=(0,h.default)(a).closest(".".concat(n.ALERT))[0]}return c}},{key:"_triggerCloseEvent",value:function(a){var b=h.default.Event(m.CLOSE);(0,h.default)(a).trigger(b);return b}},{key:"_removeElement",value:function(a){var b=this;(0,h.default)(a).removeClass(n.SHOW);if(!(0,h.default)(a).hasClass(n.FADE)){this._destroyElement(a);return}var c=i.default.getTransitionDurationFromElement(a);(0,h.default)(a).one(i.default.TRANSITION_END,function(c){return b._destroyElement(a,c)}).emulateTransitionEnd(c)}},{key:"_destroyElement",value:function(a){(0,h.default)(a).detach().trigger(m.CLOSED).remove()}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=(0,h.default)(this),d=c.data(j);if(!d){d=new a(this);c.data(j,d)}if("close"===b){d[b](this)}})}},{key:"_handleDismiss",value:function(a){return function(b){if(b){b.preventDefault()}a.close(this)}}},{key:"VERSION",get:function(){return"4.3.1"}}]);return a}();(0,h.default)(document).on(m.CLICK_DATA_API,{DISMISS:"[data-dismiss=\"alert\"]"}.DISMISS,o._handleDismiss(new o));h.default.fn.alert=o._jQueryInterface;h.default.fn.alert.Constructor=o;h.default.fn.alert.noConflict=function(){h.default.fn.alert=l;return o._jQueryInterface};a.default=o;return a.default});
//# sourceMappingURL=alert.min.js.map
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/alert",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var h="bs.alert",i=".".concat(h),j=b.default.fn.alert,k="close".concat(i),l="closed".concat(i),m="click".concat(i).concat(".data-api"),n=function(){function a(b){e(this,a);this._element=b}g(a,[{key:"close",value:function close(a){var b=this._element;if(a){b=this._getRootElement(a)}var c=this._triggerCloseEvent(b);if(c.isDefaultPrevented()){return}this._removeElement(b)}},{key:"dispose",value:function dispose(){b.default.removeData(this._element,h);this._element=null}},{key:"_getRootElement",value:function _getRootElement(a){var d=c.default.getSelectorFromElement(a),e=!1;if(d){e=document.querySelector(d)}if(!e){e=(0,b.default)(a).closest(".".concat("alert"))[0]}return e}},{key:"_triggerCloseEvent",value:function _triggerCloseEvent(a){var c=b.default.Event(k);(0,b.default)(a).trigger(c);return c}},{key:"_removeElement",value:function _removeElement(a){var d=this;(0,b.default)(a).removeClass("show");if(!(0,b.default)(a).hasClass("fade")){this._destroyElement(a);return}var e=c.default.getTransitionDurationFromElement(a);(0,b.default)(a).one(c.default.TRANSITION_END,function(b){return d._destroyElement(a,b)}).emulateTransitionEnd(e)}},{key:"_destroyElement",value:function _destroyElement(a){(0,b.default)(a).detach().trigger(l).remove()}}],[{key:"_jQueryInterface",value:function _jQueryInterface(c){return this.each(function(){var d=(0,b.default)(this),e=d.data(h);if(!e){e=new a(this);d.data(h,e)}if("close"===c){e[c](this)}})}},{key:"_handleDismiss",value:function _handleDismiss(a){return function(b){if(b){b.preventDefault()}a.close(this)}}},{key:"VERSION",get:function get(){return"4.5.0"}}]);return a}();(0,b.default)(document).on(m,"[data-dismiss=\"alert\"]",n._handleDismiss(new n));b.default.fn.alert=n._jQueryInterface;b.default.fn.alert.Constructor=n;b.default.fn.alert.noConflict=function(){b.default.fn.alert=j;return n._jQueryInterface};a.default=n;return a.default});
//# sourceMappingURL=alert.min.js.map
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/button",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function d(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function e(a,b,c){if(b)d(a.prototype,b);if(c)d(a,c);return a}var f="bs.button",g=".".concat(f),h=".data-api",i=b.default.fn.button,j="active",k="[data-toggle^=\"button\"]",l="input:not([type=\"hidden\"])",m=".btn",n="click".concat(g).concat(h),o="focus".concat(g).concat(h," ")+"blur".concat(g).concat(h),p="load".concat(g).concat(h),q=function(){function a(b){c(this,a);this._element=b}e(a,[{key:"toggle",value:function toggle(){var a=!0,c=!0,d=(0,b.default)(this._element).closest("[data-toggle=\"buttons\"]")[0];if(d){var e=this._element.querySelector(l);if(e){if("radio"===e.type){if(e.checked&&this._element.classList.contains(j)){a=!1}else{var f=d.querySelector(".active");if(f){(0,b.default)(f).removeClass(j)}}}if(a){if("checkbox"===e.type||"radio"===e.type){e.checked=!this._element.classList.contains(j)}(0,b.default)(e).trigger("change")}e.focus();c=!1}}if(!(this._element.hasAttribute("disabled")||this._element.classList.contains("disabled"))){if(c){this._element.setAttribute("aria-pressed",!this._element.classList.contains(j))}if(a){(0,b.default)(this._element).toggleClass(j)}}}},{key:"dispose",value:function dispose(){b.default.removeData(this._element,f);this._element=null}}],[{key:"_jQueryInterface",value:function _jQueryInterface(c){return this.each(function(){var d=(0,b.default)(this).data(f);if(!d){d=new a(this);(0,b.default)(this).data(f,d)}if("toggle"===c){d[c]()}})}},{key:"VERSION",get:function get(){return"4.5.0"}}]);return a}();(0,b.default)(document).on(n,k,function(a){var c=a.target,d=c;if(!(0,b.default)(c).hasClass("btn")){c=(0,b.default)(c).closest(m)[0]}if(!c||c.hasAttribute("disabled")||c.classList.contains("disabled")){a.preventDefault()}else{var e=c.querySelector(l);if(e&&(e.hasAttribute("disabled")||e.classList.contains("disabled"))){a.preventDefault();return}if("LABEL"===d.tagName&&e&&"checkbox"===e.type){a.preventDefault()}q._jQueryInterface.call((0,b.default)(c),"toggle")}}).on(o,k,function(a){var c=(0,b.default)(a.target).closest(m)[0];(0,b.default)(c).toggleClass("focus",/^focus(in)?$/.test(a.type))});(0,b.default)(window).on(p,function(){for(var a=[].slice.call(document.querySelectorAll("[data-toggle=\"buttons\"] .btn")),b=0,c=a.length;b<c;b++){var d=a[b],e=d.querySelector(l);if(e.checked||e.hasAttribute("checked")){d.classList.add(j)}else{d.classList.remove(j)}}a=[].slice.call(document.querySelectorAll("[data-toggle=\"button\"]"));for(var f=0,g=a.length,h;f<g;f++){h=a[f];if("true"===h.getAttribute("aria-pressed")){h.classList.add(j)}else{h.classList.remove(j)}}});b.default.fn.button=q._jQueryInterface;b.default.fn.button.Constructor=q;b.default.fn.button.noConflict=function(){b.default.fn.button=i;return q._jQueryInterface};a.default=q;return a.default});
//# sourceMappingURL=button.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/index",["exports","./alert","./button","./carousel","./collapse","./dropdown","./modal","./popover","./scrollspy","./tab","./toast","./tooltip","./util"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Alert",{enumerable:!0,get:function get(){return b.default}});Object.defineProperty(a,"Button",{enumerable:!0,get:function get(){return c.default}});Object.defineProperty(a,"Carousel",{enumerable:!0,get:function get(){return d.default}});Object.defineProperty(a,"Collapse",{enumerable:!0,get:function get(){return e.default}});Object.defineProperty(a,"Dropdown",{enumerable:!0,get:function get(){return f.default}});Object.defineProperty(a,"Modal",{enumerable:!0,get:function get(){return g.default}});Object.defineProperty(a,"Popover",{enumerable:!0,get:function get(){return h.default}});Object.defineProperty(a,"Scrollspy",{enumerable:!0,get:function get(){return i.default}});Object.defineProperty(a,"Tab",{enumerable:!0,get:function get(){return j.default}});Object.defineProperty(a,"Toast",{enumerable:!0,get:function get(){return k.default}});Object.defineProperty(a,"Tooltip",{enumerable:!0,get:function get(){return l.default}});Object.defineProperty(a,"Util",{enumerable:!0,get:function get(){return m.default}});b=n(b);c=n(c);d=n(d);e=n(e);f=n(f);g=n(g);h=n(h);i=n(i);j=n(j);k=n(k);l=n(l);m=n(m);function n(a){return a&&a.__esModule?a:{default:a}}});
//# sourceMappingURL=index.min.js.map
@@ -0,0 +1 @@
{"version":3,"sources":["../../src/bootstrap/index.js"],"names":[],"mappings":"kzCAAA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,O","sourcesContent":["import Alert from './alert'\nimport Button from './button'\nimport Carousel from './carousel'\nimport Collapse from './collapse'\nimport Dropdown from './dropdown'\nimport Modal from './modal'\nimport Popover from './popover'\nimport Scrollspy from './scrollspy'\nimport Tab from './tab'\nimport Toast from './toast'\nimport Tooltip from './tooltip'\nimport Util from './util'\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.5.0): index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nexport {\n Util,\n Alert,\n Button,\n Carousel,\n Collapse,\n Dropdown,\n Modal,\n Popover,\n Scrollspy,\n Tab,\n Toast,\n Tooltip\n}\n"],"file":"index.min.js"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/tab",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var h="bs.tab",i=".".concat(h),j=b.default.fn.tab,k="hide".concat(i),l="hidden".concat(i),m="show".concat(i),n="shown".concat(i),o="click".concat(i).concat(".data-api"),p="active",q="fade",r="show",s=".active",t="> li > .active",u=function(){function a(b){e(this,a);this._element=b}g(a,[{key:"show",value:function show(){var a=this;if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&(0,b.default)(this._element).hasClass(p)||(0,b.default)(this._element).hasClass("disabled")){return}var d,e,f=(0,b.default)(this._element).closest(".nav, .list-group")[0],g=c.default.getSelectorFromElement(this._element);if(f){var o="UL"===f.nodeName||"OL"===f.nodeName?t:s;e=b.default.makeArray((0,b.default)(f).find(o));e=e[e.length-1]}var h=b.default.Event(k,{relatedTarget:this._element}),i=b.default.Event(m,{relatedTarget:e});if(e){(0,b.default)(e).trigger(h)}(0,b.default)(this._element).trigger(i);if(i.isDefaultPrevented()||h.isDefaultPrevented()){return}if(g){d=document.querySelector(g)}this._activate(this._element,f);var j=function(){var c=b.default.Event(l,{relatedTarget:a._element}),d=b.default.Event(n,{relatedTarget:e});(0,b.default)(e).trigger(c);(0,b.default)(a._element).trigger(d)};if(d){this._activate(d,d.parentNode,j)}else{j()}}},{key:"dispose",value:function dispose(){b.default.removeData(this._element,h);this._element=null}},{key:"_activate",value:function _activate(a,d,e){var f=this,g=d&&("UL"===d.nodeName||"OL"===d.nodeName)?(0,b.default)(d).find(t):(0,b.default)(d).children(s),h=g[0],i=e&&h&&(0,b.default)(h).hasClass(q),j=function(){return f._transitionComplete(a,h,e)};if(h&&i){var k=c.default.getTransitionDurationFromElement(h);(0,b.default)(h).removeClass(r).one(c.default.TRANSITION_END,j).emulateTransitionEnd(k)}else{j()}}},{key:"_transitionComplete",value:function _transitionComplete(a,d,e){if(d){(0,b.default)(d).removeClass(p);var f=(0,b.default)(d.parentNode).find("> .dropdown-menu .active")[0];if(f){(0,b.default)(f).removeClass(p)}if("tab"===d.getAttribute("role")){d.setAttribute("aria-selected",!1)}}(0,b.default)(a).addClass(p);if("tab"===a.getAttribute("role")){a.setAttribute("aria-selected",!0)}c.default.reflow(a);if(a.classList.contains(q)){a.classList.add(r)}if(a.parentNode&&(0,b.default)(a.parentNode).hasClass("dropdown-menu")){var g=(0,b.default)(a).closest(".dropdown")[0];if(g){var h=[].slice.call(g.querySelectorAll(".dropdown-toggle"));(0,b.default)(h).addClass(p)}a.setAttribute("aria-expanded",!0)}if(e){e()}}}],[{key:"_jQueryInterface",value:function _jQueryInterface(c){return this.each(function(){var d=(0,b.default)(this),e=d.data(h);if(!e){e=new a(this);d.data(h,e)}if("string"==typeof c){if("undefined"==typeof e[c]){throw new TypeError("No method named \"".concat(c,"\""))}e[c]()}})}},{key:"VERSION",get:function get(){return"4.5.0"}}]);return a}();(0,b.default)(document).on(o,"[data-toggle=\"tab\"], [data-toggle=\"pill\"], [data-toggle=\"list\"]",function(a){a.preventDefault();u._jQueryInterface.call((0,b.default)(this),"show")});b.default.fn.tab=u._jQueryInterface;b.default.fn.tab.Constructor=u;b.default.fn.tab.noConflict=function(){b.default.fn.tab=j;return u._jQueryInterface};a.default=u;return a.default});
//# sourceMappingURL=tab.min.js.map
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/toast",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){e=function(a){return typeof a}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return e(a)}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function i(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function j(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function k(a,b,c){if(b)j(a.prototype,b);if(c)j(a,c);return a}var l="bs.toast",m=".".concat(l),n=b.default.fn.toast,o="click.dismiss".concat(m),p="hide".concat(m),q="hidden".concat(m),r="show".concat(m),s="shown".concat(m),t="hide",u="show",v="showing",w={animation:"boolean",autohide:"boolean",delay:"number"},x={animation:!0,autohide:!0,delay:500},y=function(){function a(b,c){i(this,a);this._element=b;this._config=this._getConfig(c);this._timeout=null;this._setListeners()}k(a,[{key:"show",value:function show(){var a=this,d=b.default.Event(r);(0,b.default)(this._element).trigger(d);if(d.isDefaultPrevented()){return}if(this._config.animation){this._element.classList.add("fade")}var e=function(){a._element.classList.remove(v);a._element.classList.add(u);(0,b.default)(a._element).trigger(s);if(a._config.autohide){a._timeout=setTimeout(function(){a.hide()},a._config.delay)}};this._element.classList.remove(t);c.default.reflow(this._element);this._element.classList.add(v);if(this._config.animation){var f=c.default.getTransitionDurationFromElement(this._element);(0,b.default)(this._element).one(c.default.TRANSITION_END,e).emulateTransitionEnd(f)}else{e()}}},{key:"hide",value:function hide(){if(!this._element.classList.contains(u)){return}var a=b.default.Event(p);(0,b.default)(this._element).trigger(a);if(a.isDefaultPrevented()){return}this._close()}},{key:"dispose",value:function dispose(){clearTimeout(this._timeout);this._timeout=null;if(this._element.classList.contains(u)){this._element.classList.remove(u)}(0,b.default)(this._element).off(o);b.default.removeData(this._element,l);this._element=null;this._config=null}},{key:"_getConfig",value:function _getConfig(a){a=g({},x,{},(0,b.default)(this._element).data(),{},"object"===e(a)&&a?a:{});c.default.typeCheckConfig("toast",a,this.constructor.DefaultType);return a}},{key:"_setListeners",value:function _setListeners(){var a=this;(0,b.default)(this._element).on(o,"[data-dismiss=\"toast\"]",function(){return a.hide()})}},{key:"_close",value:function _close(){var a=this,d=function(){a._element.classList.add(t);(0,b.default)(a._element).trigger(q)};this._element.classList.remove(u);if(this._config.animation){var e=c.default.getTransitionDurationFromElement(this._element);(0,b.default)(this._element).one(c.default.TRANSITION_END,d).emulateTransitionEnd(e)}else{d()}}}],[{key:"_jQueryInterface",value:function _jQueryInterface(c){return this.each(function(){var d=(0,b.default)(this),f=d.data(l),g="object"===e(c)&&c;if(!f){f=new a(this,g);d.data(l,f)}if("string"==typeof c){if("undefined"==typeof f[c]){throw new TypeError("No method named \"".concat(c,"\""))}f[c](this)}})}},{key:"VERSION",get:function get(){return"4.5.0"}},{key:"DefaultType",get:function get(){return w}},{key:"Default",get:function get(){return x}}]);return a}();b.default.fn.toast=y._jQueryInterface;b.default.fn.toast.Constructor=y;b.default.fn.toast.noConflict=function(){b.default.fn.toast=n;return y._jQueryInterface};a.default=y;return a.default});
//# sourceMappingURL=toast.min.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/tools/sanitizer",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.sanitizeHtml=function(a,c,d){if(0===a.length){return a}if(d&&"function"==typeof d){return d(a)}for(var e=new window.DOMParser,f=e.parseFromString(a,"text/html"),g=Object.keys(c),h=[].slice.call(f.body.querySelectorAll("*")),j=function(a){var d=h[a],e=d.nodeName.toLowerCase();if(-1===g.indexOf(d.nodeName.toLowerCase())){d.parentNode.removeChild(d);return"continue"}var f=[].slice.call(d.attributes),i=[].concat(c["*"]||[],c[e]||[]);f.forEach(function(a){if(!b(a,i)){d.removeAttribute(a.nodeName)}})},k=0,l=h.length,m;k<l;k++){m=j(k,l);if("continue"===m)continue}return f.body.innerHTML};a.DefaultWhitelist=void 0;var c=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"];a.DefaultWhitelist={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],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:[]};function b(a,b){var d=a.nodeName.toLowerCase();if(-1!==b.indexOf(d)){if(-1!==c.indexOf(d)){return!!(a.nodeValue.match(/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi)||a.nodeValue.match(/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i))}return!0}for(var e=b.filter(function(a){return a instanceof RegExp}),f=0,g=e.length;f<g;f++){if(d.match(e[f])){return!0}}return!1}});
//# sourceMappingURL=sanitizer.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
define ("theme_boost/bootstrap/util",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){if(null===a||"undefined"==typeof a){return"".concat(a)}return{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase()}function d(){return{bindType:"transitionend",delegateType:"transitionend",handle:function handle(a){if((0,b.default)(a.target).is(this)){return a.handleObj.handler.apply(this,arguments)}}}}function e(a){var c=this,d=!1;(0,b.default)(this).one(g.TRANSITION_END,function(){d=!0});setTimeout(function(){if(!d){g.triggerTransitionEnd(c)}},a);return this}function f(){b.default.fn.emulateTransitionEnd=e;b.default.event.special[g.TRANSITION_END]=d()}var g={TRANSITION_END:"bsTransitionEnd",getUID:function getUID(a){do{a+=~~(Math.random()*1e6)}while(document.getElementById(a));return a},getSelectorFromElement:function getSelectorFromElement(a){var b=a.getAttribute("data-target");if(!b||"#"===b){var c=a.getAttribute("href");b=c&&"#"!==c?c.trim():""}try{return document.querySelector(b)?b:null}catch(a){return null}},getTransitionDurationFromElement:function getTransitionDurationFromElement(a){if(!a){return 0}var c=(0,b.default)(a).css("transition-duration"),d=(0,b.default)(a).css("transition-delay"),e=parseFloat(c),f=parseFloat(d);if(!e&&!f){return 0}c=c.split(",")[0];d=d.split(",")[0];return(parseFloat(c)+parseFloat(d))*1e3},reflow:function reflow(a){return a.offsetHeight},triggerTransitionEnd:function triggerTransitionEnd(a){(0,b.default)(a).trigger("transitionend")},supportsTransitionEnd:function supportsTransitionEnd(){return!0},isElement:function isElement(a){return(a[0]||a).nodeType},typeCheckConfig:function typeCheckConfig(a,b,d){for(var i in d){if(Object.prototype.hasOwnProperty.call(d,i)){var e=d[i],f=b[i],h=f&&g.isElement(f)?"element":c(f);if(!new RegExp(e).test(h)){throw new Error("".concat(a.toUpperCase(),": ")+"Option \"".concat(i,"\" provided type \"").concat(h,"\" ")+"but expected type \"".concat(e,"\"."))}}}},findShadowRoot:function findShadowRoot(a){if(!document.documentElement.attachShadow){return null}if("function"==typeof a.getRootNode){var b=a.getRootNode();return b instanceof ShadowRoot?b:null}if(a instanceof ShadowRoot){return a}if(!a.parentNode){return null}return g.findShadowRoot(a.parentNode)},jQueryDetection:function jQueryDetection(){if("undefined"==typeof b.default){throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.")}var a=b.default.fn.jquery.split(" ")[0].split("."),c=9;if(a[0]<2&&a[1]<c||a[0]===1&&a[1]===c&&a[2]<1||a[0]>=4){throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}}};g.jQueryDetection();f();a.default=g;return a.default});
//# sourceMappingURL=util.min.js.map
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/button",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var f=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function d(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function e(a,b,c){if(b)d(a.prototype,b);if(c)d(a,c);return a}var g="bs.button",h=".".concat(g),i=".data-api",j=f.default.fn.button,k={ACTIVE:"active",BUTTON:"btn",FOCUS:"focus"},l={DATA_TOGGLE_CARROT:"[data-toggle^=\"button\"]",DATA_TOGGLE:"[data-toggle=\"buttons\"]",INPUT:"input:not([type=\"hidden\"])",ACTIVE:".active",BUTTON:".btn"},m={CLICK_DATA_API:"click".concat(h).concat(i),FOCUS_BLUR_DATA_API:"focus".concat(h).concat(i," ")+"blur".concat(h).concat(i)},n=function(){function a(b){c(this,a);this._element=b}e(a,[{key:"toggle",value:function(){var a=!0,b=!0,c=(0,f.default)(this._element).closest(l.DATA_TOGGLE)[0];if(c){var d=this._element.querySelector(l.INPUT);if(d){if("radio"===d.type){if(d.checked&&this._element.classList.contains(k.ACTIVE)){a=!1}else{var e=c.querySelector(l.ACTIVE);if(e){(0,f.default)(e).removeClass(k.ACTIVE)}}}if(a){if(d.hasAttribute("disabled")||c.hasAttribute("disabled")||d.classList.contains("disabled")||c.classList.contains("disabled")){return}d.checked=!this._element.classList.contains(k.ACTIVE);(0,f.default)(d).trigger("change")}d.focus();b=!1}}if(b){this._element.setAttribute("aria-pressed",!this._element.classList.contains(k.ACTIVE))}if(a){(0,f.default)(this._element).toggleClass(k.ACTIVE)}}},{key:"dispose",value:function(){f.default.removeData(this._element,g);this._element=null}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=(0,f.default)(this).data(g);if(!c){c=new a(this);(0,f.default)(this).data(g,c)}if("toggle"===b){c[b]()}})}},{key:"VERSION",get:function(){return"4.3.1"}}]);return a}();(0,f.default)(document).on(m.CLICK_DATA_API,l.DATA_TOGGLE_CARROT,function(a){a.preventDefault();var b=a.target;if(!(0,f.default)(b).hasClass(k.BUTTON)){b=(0,f.default)(b).closest(l.BUTTON)}n._jQueryInterface.call((0,f.default)(b),"toggle")}).on(m.FOCUS_BLUR_DATA_API,l.DATA_TOGGLE_CARROT,function(a){var b=(0,f.default)(a.target).closest(l.BUTTON)[0];(0,f.default)(b).toggleClass(k.FOCUS,/^focus(in)?$/.test(a.type))});f.default.fn.button=n._jQueryInterface;f.default.fn.button.Constructor=n;f.default.fn.button.noConflict=function(){f.default.fn.button=j;return n._jQueryInterface};a.default=n;return a.default});
//# sourceMappingURL=button.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/index",["exports","jquery","./alert","./button","./carousel","./collapse","./dropdown","./modal","./popover","./scrollspy","./tab","./toast","./tooltip","./util"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.Tooltip=a.Toast=a.Tab=a.Scrollspy=a.Popover=a.Modal=a.Dropdown=a.Collapse=a.Carousel=a.Button=a.Alert=a.Util=void 0;var p=o(b),q=o(c),r=o(d),s=o(e),t=o(f),u=o(g),v=o(h),w=o(i),x=o(j),y=o(k),z=o(l),A=o(m),B=o(n);function o(a){return a&&a.__esModule?a:{default:a}}(function(){if("undefined"==typeof p.default){throw new TypeError("Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.")}var a=p.default.fn.jquery.split(" ")[0].split("."),b=9;if(a[0]<2&&a[1]<b||a[0]===1&&a[1]===b&&a[2]<1||a[0]>=4){throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}})();a.Util=B.default;a.Alert=q.default;a.Button=r.default;a.Carousel=s.default;a.Collapse=t.default;a.Dropdown=u.default;a.Modal=v.default;a.Popover=w.default;a.Scrollspy=x.default;a.Tab=y.default;a.Toast=z.default;a.Tooltip=A.default});
//# sourceMappingURL=index.min.js.map
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define ("theme_boost/loader",["jquery","./tether","core/event","core/custom_interaction_events"],function(a,b,c,d){window.jQuery=a;window.Tether=b;M.util.js_pending("theme_boost/loader:children");require(["theme_boost/aria","theme_boost/scroll","theme_boost/pending","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b,e){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]",placement:"auto"});d.define(a("body"),[d.events.escape]);a("body").on(d.events.escape,"[data-toggle=popover]",function(){a(this).trigger("blur")});a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}});a("html").tooltip({selector:"[data-toggle=\"tooltip\"]"});a.fn.dropdown.Constructor.Default.flip=!1;a("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(b){var c=a(b.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var f=window.location.hash;if(f){a(".nav-link[href=\""+f+"\"]").tab("show")}c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus"})})});b.init();this.scroll=new e;this.scroll.init();M.util.js_complete("theme_boost/loader:children")});return{}});
define ("theme_boost/loader",["exports","jquery","./aria","./scroll","./bootstrap/index","core/custom_interaction_events"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return e.default}});a.init=void 0;b=g(b);c=g(c);d=g(d);e=g(e);f=g(f);function g(a){return a&&a.__esModule?a:{default:a}}var h=function(){i();j();k();var a=new d.default;a.init();b.default.fn.dropdown.Constructor.Default.flip=!1;c.default.init()};a.init=h;var i=function(){(0,b.default)("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(a){var c=(0,b.default)(a.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var a=window.location.hash;if(a){(0,b.default)(".nav-link[href=\""+a+"\"]").tab("show")}},j=function(){(0,b.default)("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus hover",placement:"auto"});f.default.define((0,b.default)("body"),[f.default.events.escape]);(0,b.default)("body").on(f.default.events.escape,"[data-toggle=popover]",function(){(0,b.default)(this).trigger("blur")})},k=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})}});
//# sourceMappingURL=loader.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
"use strict";function _typeof2(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof2=function(a){return typeof a}}else{_typeof2=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof2(a)}define ("theme_boost/popover",["exports","jquery","./tooltip"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=d(b),p=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){if("function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)){e=function(a){return _typeof2(a)}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":_typeof2(a)}}return e(a)}function f(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function g(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function h(a,b,c){if(b)g(a.prototype,b);if(c)g(a,c);return a}function i(a,b){if(b&&("object"===e(b)||"function"==typeof b)){return b}return j(a)}function j(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function k(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)l(a,b)}function l(a,b){l=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return l(a,b)}function m(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{},d=Object.keys(c);if("function"==typeof Object.getOwnPropertySymbols){d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))}d.forEach(function(b){n(a,b,c[b])})}return a}function n(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}var q="bs.popover",r=".".concat(q),s=o.default.fn.popover,t="bs-popover",u=new RegExp("(^|\\s)".concat(t,"\\S+"),"g"),v=m({},p.default.Default,{placement:"right",trigger:"click",content:"",template:"<div class=\"popover\" role=\"tooltip\"><div class=\"arrow\"></div><h3 class=\"popover-header\"></h3><div class=\"popover-body\"></div></div>"}),w=m({},p.default.DefaultType,{content:"(string|element|function)"}),x={FADE:"fade",SHOW:"show"},y={TITLE:".popover-header",CONTENT:".popover-body"},z={HIDE:"hide".concat(r),HIDDEN:"hidden".concat(r),SHOW:"show".concat(r),SHOWN:"shown".concat(r),INSERTED:"inserted".concat(r),CLICK:"click".concat(r),FOCUSIN:"focusin".concat(r),FOCUSOUT:"focusout".concat(r),MOUSEENTER:"mouseenter".concat(r),MOUSELEAVE:"mouseleave".concat(r)},A=function(a){k(b,a);function b(){f(this,b);return i(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}h(b,[{key:"isWithContent",value:function(){return this.getTitle()||this._getContent()}},{key:"addAttachmentClass",value:function(a){(0,o.default)(this.getTipElement()).addClass("".concat(t,"-").concat(a))}},{key:"getTipElement",value:function(){this.tip=this.tip||(0,o.default)(this.config.template)[0];return this.tip}},{key:"setContent",value:function(){var a=(0,o.default)(this.getTipElement());this.setElementContent(a.find(y.TITLE),this.getTitle());var b=this._getContent();if("function"==typeof b){b=b.call(this.element)}this.setElementContent(a.find(y.CONTENT),b);a.removeClass("".concat(x.FADE," ").concat(x.SHOW))}},{key:"_getContent",value:function(){return this.element.getAttribute("data-content")||this.config.content}},{key:"_cleanTipClass",value:function(){var a=(0,o.default)(this.getTipElement()),b=a.attr("class").match(u);if(null!==b&&0<b.length){a.removeClass(b.join(""))}}}],[{key:"_jQueryInterface",value:function(a){return this.each(function(){var c=(0,o.default)(this).data(q),d="object"===e(a)?a:null;if(!c&&/dispose|hide/.test(a)){return}if(!c){c=new b(this,d);(0,o.default)(this).data(q,c)}if("string"==typeof a){if("undefined"==typeof c[a]){throw new TypeError("No method named \"".concat(a,"\""))}c[a]()}})}},{key:"VERSION",get:function(){return"4.3.1"}},{key:"Default",get:function(){return v}},{key:"NAME",get:function(){return"popover"}},{key:"DATA_KEY",get:function(){return q}},{key:"Event",get:function(){return z}},{key:"EVENT_KEY",get:function(){return r}},{key:"DefaultType",get:function(){return w}}]);return b}(p.default);o.default.fn.popover=A._jQueryInterface;o.default.fn.popover.Constructor=A;o.default.fn.popover.noConflict=function(){o.default.fn.popover=s;return A._jQueryInterface};a.default=A;return a.default});
define ("theme_boost/popover",["exports","./bootstrap/popover"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Popover",{enumerable:!0,get:function get(){return b.default}});b=function(a){return a&&a.__esModule?a:{default:a}}(b)});
//# sourceMappingURL=popover.min.js.map
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/sanitizer",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.sanitizeHtml=function(a,c,d){if(0===a.length){return a}if(d&&"function"==typeof d){return d(a)}for(var e=new window.DOMParser,f=e.parseFromString(a,"text/html"),g=Object.keys(c),h=[].slice.call(f.body.querySelectorAll("*")),j=function(a){var d=h[a],e=d.nodeName.toLowerCase();if(-1===g.indexOf(d.nodeName.toLowerCase())){d.parentNode.removeChild(d);return"continue"}var f=[].slice.call(d.attributes),i=[].concat(c["*"]||[],c[e]||[]);f.forEach(function(a){if(!b(a,i)){d.removeAttribute(a.nodeName)}})},k=0,l=h.length,m;k<l;k++){m=j(k,l);if("continue"===m)continue}return f.body.innerHTML};var c=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],d=a.DefaultWhitelist={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]};function b(a,b){var d=a.nodeName.toLowerCase();if(-1!==b.indexOf(d)){if(-1!==c.indexOf(d)){return!!(a.nodeValue.match(/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi)||a.nodeValue.match(/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i))}return!0}for(var e=b.filter(function(a){return a instanceof RegExp}),f=0,g=e.length;f<g;f++){if(d.match(e[f])){return!0}}return!1}});
//# sourceMappingURL=sanitizer.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/tab",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function f(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function g(a,b,c){if(b)f(a.prototype,b);if(c)f(a,c);return a}var j="bs.tab",k=".".concat(j),l=h.default.fn.tab,m={HIDE:"hide".concat(k),HIDDEN:"hidden".concat(k),SHOW:"show".concat(k),SHOWN:"shown".concat(k),CLICK_DATA_API:"click".concat(k).concat(".data-api")},n={DROPDOWN_MENU:"dropdown-menu",ACTIVE:"active",DISABLED:"disabled",FADE:"fade",SHOW:"show"},o={DROPDOWN:".dropdown",NAV_LIST_GROUP:".nav, .list-group",ACTIVE:".active",ACTIVE_UL:"> li > .active",DATA_TOGGLE:"[data-toggle=\"tab\"], [data-toggle=\"pill\"], [data-toggle=\"list\"]",DROPDOWN_TOGGLE:".dropdown-toggle",DROPDOWN_ACTIVE_CHILD:"> .dropdown-menu .active"},p=function(){function a(b){e(this,a);this._element=b}g(a,[{key:"show",value:function(){var a=this;if(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&(0,h.default)(this._element).hasClass(n.ACTIVE)||(0,h.default)(this._element).hasClass(n.DISABLED)){return}var b,c,d=(0,h.default)(this._element).closest(o.NAV_LIST_GROUP)[0],e=i.default.getSelectorFromElement(this._element);if(d){var f="UL"===d.nodeName||"OL"===d.nodeName?o.ACTIVE_UL:o.ACTIVE;c=h.default.makeArray((0,h.default)(d).find(f));c=c[c.length-1]}var g=h.default.Event(m.HIDE,{relatedTarget:this._element}),j=h.default.Event(m.SHOW,{relatedTarget:c});if(c){(0,h.default)(c).trigger(g)}(0,h.default)(this._element).trigger(j);if(j.isDefaultPrevented()||g.isDefaultPrevented()){return}if(e){b=document.querySelector(e)}this._activate(this._element,d);var k=function(){var b=h.default.Event(m.HIDDEN,{relatedTarget:a._element}),d=h.default.Event(m.SHOWN,{relatedTarget:c});(0,h.default)(c).trigger(b);(0,h.default)(a._element).trigger(d)};if(b){this._activate(b,b.parentNode,k)}else{k()}}},{key:"dispose",value:function(){h.default.removeData(this._element,j);this._element=null}},{key:"_activate",value:function(a,b,c){var d=this,e=b&&("UL"===b.nodeName||"OL"===b.nodeName)?(0,h.default)(b).find(o.ACTIVE_UL):(0,h.default)(b).children(o.ACTIVE),f=e[0],g=c&&f&&(0,h.default)(f).hasClass(n.FADE),j=function(){return d._transitionComplete(a,f,c)};if(f&&g){var k=i.default.getTransitionDurationFromElement(f);(0,h.default)(f).removeClass(n.SHOW).one(i.default.TRANSITION_END,j).emulateTransitionEnd(k)}else{j()}}},{key:"_transitionComplete",value:function(a,b,c){if(b){(0,h.default)(b).removeClass(n.ACTIVE);var d=(0,h.default)(b.parentNode).find(o.DROPDOWN_ACTIVE_CHILD)[0];if(d){(0,h.default)(d).removeClass(n.ACTIVE)}if("tab"===b.getAttribute("role")){b.setAttribute("aria-selected",!1)}}(0,h.default)(a).addClass(n.ACTIVE);if("tab"===a.getAttribute("role")){a.setAttribute("aria-selected",!0)}i.default.reflow(a);if(a.classList.contains(n.FADE)){a.classList.add(n.SHOW)}if(a.parentNode&&(0,h.default)(a.parentNode).hasClass(n.DROPDOWN_MENU)){var e=(0,h.default)(a).closest(o.DROPDOWN)[0];if(e){var f=[].slice.call(e.querySelectorAll(o.DROPDOWN_TOGGLE));(0,h.default)(f).addClass(n.ACTIVE)}a.setAttribute("aria-expanded",!0)}if(c){c()}}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=(0,h.default)(this),d=c.data(j);if(!d){d=new a(this);c.data(j,d)}if("string"==typeof b){if("undefined"==typeof d[b]){throw new TypeError("No method named \"".concat(b,"\""))}d[b]()}})}},{key:"VERSION",get:function(){return"4.3.1"}}]);return a}();(0,h.default)(document).on(m.CLICK_DATA_API,o.DATA_TOGGLE,function(a){a.preventDefault();p._jQueryInterface.call((0,h.default)(this),"show")});h.default.fn.tab=p._jQueryInterface;h.default.fn.tab.Constructor=p;h.default.fn.tab.noConflict=function(){h.default.fn.tab=l;return p._jQueryInterface};a.default=p;return a.default});
//# sourceMappingURL=tab.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
"use strict";function _typeof2(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof2=function(a){return typeof a}}else{_typeof2=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof2(a)}define ("theme_boost/toast",["exports","jquery","./util"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var k=d(b),l=d(c);function d(a){return a&&a.__esModule?a:{default:a}}function e(a){if("function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)){e=function(a){return _typeof2(a)}}else{e=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":_typeof2(a)}}return e(a)}function f(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{},d=Object.keys(c);if("function"==typeof Object.getOwnPropertySymbols){d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))}d.forEach(function(b){g(a,b,c[b])})}return a}function g(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function h(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function i(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function j(a,b,c){if(b)i(a.prototype,b);if(c)i(a,c);return a}var m="bs.toast",n=".".concat(m),o=k.default.fn.toast,p={CLICK_DISMISS:"click.dismiss".concat(n),HIDE:"hide".concat(n),HIDDEN:"hidden".concat(n),SHOW:"show".concat(n),SHOWN:"shown".concat(n)},q={FADE:"fade",HIDE:"hide",SHOW:"show",SHOWING:"showing"},r={animation:"boolean",autohide:"boolean",delay:"number"},s={animation:!0,autohide:!0,delay:500},t={DATA_DISMISS:"[data-dismiss=\"toast\"]"},u=function(){function a(b,c){h(this,a);this._element=b;this._config=this._getConfig(c);this._timeout=null;this._setListeners()}j(a,[{key:"show",value:function(){var a=this;(0,k.default)(this._element).trigger(p.SHOW);if(this._config.animation){this._element.classList.add(q.FADE)}var b=function(){a._element.classList.remove(q.SHOWING);a._element.classList.add(q.SHOW);(0,k.default)(a._element).trigger(p.SHOWN);if(a._config.autohide){a.hide()}};this._element.classList.remove(q.HIDE);this._element.classList.add(q.SHOWING);if(this._config.animation){var c=l.default.getTransitionDurationFromElement(this._element);(0,k.default)(this._element).one(l.default.TRANSITION_END,b).emulateTransitionEnd(c)}else{b()}}},{key:"hide",value:function(a){var b=this;if(!this._element.classList.contains(q.SHOW)){return}(0,k.default)(this._element).trigger(p.HIDE);if(a){this._close()}else{this._timeout=setTimeout(function(){b._close()},this._config.delay)}}},{key:"dispose",value:function(){clearTimeout(this._timeout);this._timeout=null;if(this._element.classList.contains(q.SHOW)){this._element.classList.remove(q.SHOW)}(0,k.default)(this._element).off(p.CLICK_DISMISS);k.default.removeData(this._element,m);this._element=null;this._config=null}},{key:"_getConfig",value:function(a){a=f({},s,(0,k.default)(this._element).data(),"object"===e(a)&&a?a:{});l.default.typeCheckConfig("toast",a,this.constructor.DefaultType);return a}},{key:"_setListeners",value:function(){var a=this;(0,k.default)(this._element).on(p.CLICK_DISMISS,t.DATA_DISMISS,function(){return a.hide(!0)})}},{key:"_close",value:function(){var a=this,b=function(){a._element.classList.add(q.HIDE);(0,k.default)(a._element).trigger(p.HIDDEN)};this._element.classList.remove(q.SHOW);if(this._config.animation){var c=l.default.getTransitionDurationFromElement(this._element);(0,k.default)(this._element).one(l.default.TRANSITION_END,b).emulateTransitionEnd(c)}else{b()}}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=(0,k.default)(this),d=c.data(m),f="object"===e(b)&&b;if(!d){d=new a(this,f);c.data(m,d)}if("string"==typeof b){if("undefined"==typeof d[b]){throw new TypeError("No method named \"".concat(b,"\""))}d[b](this)}})}},{key:"VERSION",get:function(){return"4.3.1"}},{key:"DefaultType",get:function(){return r}},{key:"Default",get:function(){return s}}]);return a}();k.default.fn.toast=u._jQueryInterface;k.default.fn.toast.Constructor=u;k.default.fn.toast.noConflict=function(){k.default.fn.toast=o;return u._jQueryInterface};a.default=u;return a.default});
define ("theme_boost/toast",["exports","./bootstrap/toast"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Toast",{enumerable:!0,get:function get(){return b.default}});b=function(a){return a&&a.__esModule?a:{default:a}}(b)});
//# sourceMappingURL=toast.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";define ("theme_boost/util",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var f=function(a){return a&&a.__esModule?a:{default:a}}(b);function c(a){return{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase()}function d(){return{bindType:"transitionend",delegateType:"transitionend",handle:function(a){if((0,f.default)(a.target).is(this)){return a.handleObj.handler.apply(this,arguments)}}}}function e(a){var b=this,c=!1;(0,f.default)(this).one(g.TRANSITION_END,function(){c=!0});setTimeout(function(){if(!c){g.triggerTransitionEnd(b)}},a);return this}var g={TRANSITION_END:"bsTransitionEnd",getUID:function(a){do{a+=~~(Math.random()*1e6)}while(document.getElementById(a));return a},getSelectorFromElement:function(a){var b=a.getAttribute("data-target");if(!b||"#"===b){var c=a.getAttribute("href");b=c&&"#"!==c?c.trim():""}try{return document.querySelector(b)?b:null}catch(a){return null}},getTransitionDurationFromElement:function(a){if(!a){return 0}var b=(0,f.default)(a).css("transition-duration"),c=(0,f.default)(a).css("transition-delay"),d=parseFloat(b),e=parseFloat(c);if(!d&&!e){return 0}b=b.split(",")[0];c=c.split(",")[0];return(parseFloat(b)+parseFloat(c))*1e3},reflow:function(a){return a.offsetHeight},triggerTransitionEnd:function(a){(0,f.default)(a).trigger("transitionend")},supportsTransitionEnd:function(){return!0},isElement:function(a){return(a[0]||a).nodeType},typeCheckConfig:function(a,b,d){for(var e in d){if(Object.prototype.hasOwnProperty.call(d,e)){var f=d[e],h=b[e],i=h&&g.isElement(h)?"element":c(h);if(!new RegExp(f).test(i)){throw new Error("".concat(a.toUpperCase(),": ")+"Option \"".concat(e,"\" provided type \"").concat(i,"\" ")+"but expected type \"".concat(f,"\"."))}}}},findShadowRoot:function(a){if(!document.documentElement.attachShadow){return null}if("function"==typeof a.getRootNode){var b=a.getRootNode();return b instanceof ShadowRoot?b:null}if(a instanceof ShadowRoot){return a}if(!a.parentNode){return null}return g.findShadowRoot(a.parentNode)}};(function(){f.default.fn.emulateTransitionEnd=e;f.default.event.special[g.TRANSITION_END]=d()})();a.default=g;return a.default});
//# sourceMappingURL=util.min.js.map
File diff suppressed because one or more lines are too long
-213
View File
@@ -1,213 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var Selector = {
DISMISS: '[data-dismiss="alert"]'
};
var Event = {
CLOSE: "close".concat(EVENT_KEY),
CLOSED: "closed".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
ALERT: 'alert',
FADE: 'fade',
SHOW: 'show'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Alert = function () {
function Alert(element) {
_classCallCheck(this, Alert);
this._element = element;
} // Getters
_createClass(Alert, [{
key: "close",
value: function close(element) {
var rootElement = this._element;
if (element) {
rootElement = this._getRootElement(element);
}
var customEvent = this._triggerCloseEvent(rootElement);
if (customEvent.isDefaultPrevented()) {
return;
}
this._removeElement(rootElement);
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
this._element = null;
}
}, {
key: "_getRootElement",
value: function _getRootElement(element) {
var selector = _util2.default.getSelectorFromElement(element);
var parent = false;
if (selector) {
parent = document.querySelector(selector);
}
if (!parent) {
parent = (0, _jquery2.default)(element).closest(".".concat(ClassName.ALERT))[0];
}
return parent;
}
}, {
key: "_triggerCloseEvent",
value: function _triggerCloseEvent(element) {
var closeEvent = _jquery2.default.Event(Event.CLOSE);
(0, _jquery2.default)(element).trigger(closeEvent);
return closeEvent;
}
}, {
key: "_removeElement",
value: function _removeElement(element) {
var _this = this;
(0, _jquery2.default)(element).removeClass(ClassName.SHOW);
if (!(0, _jquery2.default)(element).hasClass(ClassName.FADE)) {
this._destroyElement(element);
return;
}
var transitionDuration = _util2.default.getTransitionDurationFromElement(element);
(0, _jquery2.default)(element).one(_util2.default.TRANSITION_END, function (event) {
return _this._destroyElement(element, event);
}).emulateTransitionEnd(transitionDuration);
}
}, {
key: "_destroyElement",
value: function _destroyElement(element) {
(0, _jquery2.default)(element).detach().trigger(Event.CLOSED).remove();
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = (0, _jquery2.default)(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Alert(this);
$element.data(DATA_KEY, data);
}
if (config === 'close') {
data[config](this);
}
});
}
}, {
key: "_handleDismiss",
value: function _handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault();
}
alertInstance.close(this);
};
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Alert;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Alert._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Alert;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert._jQueryInterface;
};
exports.default = Alert;
});
+173
View File
@@ -0,0 +1,173 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'alert'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const SELECTOR_DISMISS = '[data-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 CLASS_NAME_ALERT = 'alert'
const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Alert {
constructor(element) {
this._element = element
}
// Getters
static get VERSION() {
return VERSION
}
// Public
close(element) {
let rootElement = this._element
if (element) {
rootElement = this._getRootElement(element)
}
const customEvent = this._triggerCloseEvent(rootElement)
if (customEvent.isDefaultPrevented()) {
return
}
this._removeElement(rootElement)
}
dispose() {
$.removeData(this._element, DATA_KEY)
this._element = null
}
// Private
_getRootElement(element) {
const selector = Util.getSelectorFromElement(element)
let parent = false
if (selector) {
parent = document.querySelector(selector)
}
if (!parent) {
parent = $(element).closest(`.${CLASS_NAME_ALERT}`)[0]
}
return parent
}
_triggerCloseEvent(element) {
const closeEvent = $.Event(EVENT_CLOSE)
$(element).trigger(closeEvent)
return closeEvent
}
_removeElement(element) {
$(element).removeClass(CLASS_NAME_SHOW)
if (!$(element).hasClass(CLASS_NAME_FADE)) {
this._destroyElement(element)
return
}
const transitionDuration = Util.getTransitionDurationFromElement(element)
$(element)
.one(Util.TRANSITION_END, (event) => this._destroyElement(element, event))
.emulateTransitionEnd(transitionDuration)
}
_destroyElement(element) {
$(element)
.detach()
.trigger(EVENT_CLOSED)
.remove()
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
const $element = $(this)
let data = $element.data(DATA_KEY)
if (!data) {
data = new Alert(this)
$element.data(DATA_KEY, data)
}
if (config === 'close') {
data[config](this)
}
})
}
static _handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault()
}
alertInstance.close(this)
}
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(
EVENT_CLICK_DATA_API,
SELECTOR_DISMISS,
Alert._handleDismiss(new Alert())
)
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Alert._jQueryInterface
$.fn[NAME].Constructor = Alert
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Alert._jQueryInterface
}
export default Alert
+207
View File
@@ -0,0 +1,207 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'button'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.button'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const CLASS_NAME_ACTIVE = 'active'
const CLASS_NAME_BUTTON = 'btn'
const CLASS_NAME_FOCUS = 'focus'
const SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'
const SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'
const SELECTOR_DATA_TOGGLE = '[data-toggle="button"]'
const SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'
const SELECTOR_INPUT = 'input:not([type="hidden"])'
const SELECTOR_ACTIVE = '.active'
const SELECTOR_BUTTON = '.btn'
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
const EVENT_FOCUS_BLUR_DATA_API = `focus${EVENT_KEY}${DATA_API_KEY} ` +
`blur${EVENT_KEY}${DATA_API_KEY}`
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Button {
constructor(element) {
this._element = element
}
// Getters
static get VERSION() {
return VERSION
}
// Public
toggle() {
let triggerChangeEvent = true
let addAriaPressed = true
const rootElement = $(this._element).closest(
SELECTOR_DATA_TOGGLES
)[0]
if (rootElement) {
const input = this._element.querySelector(SELECTOR_INPUT)
if (input) {
if (input.type === 'radio') {
if (input.checked &&
this._element.classList.contains(CLASS_NAME_ACTIVE)) {
triggerChangeEvent = false
} else {
const activeElement = rootElement.querySelector(SELECTOR_ACTIVE)
if (activeElement) {
$(activeElement).removeClass(CLASS_NAME_ACTIVE)
}
}
}
if (triggerChangeEvent) {
// if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
if (input.type === 'checkbox' || input.type === 'radio') {
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE)
}
$(input).trigger('change')
}
input.focus()
addAriaPressed = false
}
}
if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
if (addAriaPressed) {
this._element.setAttribute('aria-pressed',
!this._element.classList.contains(CLASS_NAME_ACTIVE))
}
if (triggerChangeEvent) {
$(this._element).toggleClass(CLASS_NAME_ACTIVE)
}
}
}
dispose() {
$.removeData(this._element, DATA_KEY)
this._element = null
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
if (!data) {
data = new Button(this)
$(this).data(DATA_KEY, data)
}
if (config === 'toggle') {
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document)
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, (event) => {
let button = event.target
const initialButton = button
if (!$(button).hasClass(CLASS_NAME_BUTTON)) {
button = $(button).closest(SELECTOR_BUTTON)[0]
}
if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
event.preventDefault() // work around Firefox bug #1540995
} else {
const inputBtn = button.querySelector(SELECTOR_INPUT)
if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
event.preventDefault() // work around Firefox bug #1540995
return
}
if (initialButton.tagName === 'LABEL' && inputBtn && inputBtn.type === 'checkbox') {
event.preventDefault() // work around event sent to label and input
}
Button._jQueryInterface.call($(button), 'toggle')
}
})
.on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, (event) => {
const button = $(event.target).closest(SELECTOR_BUTTON)[0]
$(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type))
})
$(window).on(EVENT_LOAD_DATA_API, () => {
// ensure correct active class is set to match the controls' actual values/states
// find all checkboxes/readio buttons inside data-toggle groups
let buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS))
for (let i = 0, len = buttons.length; i < len; i++) {
const button = buttons[i]
const input = button.querySelector(SELECTOR_INPUT)
if (input.checked || input.hasAttribute('checked')) {
button.classList.add(CLASS_NAME_ACTIVE)
} else {
button.classList.remove(CLASS_NAME_ACTIVE)
}
}
// find all button toggles
buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE))
for (let i = 0, len = buttons.length; i < len; i++) {
const button = buttons[i]
if (button.getAttribute('aria-pressed') === 'true') {
button.classList.add(CLASS_NAME_ACTIVE)
} else {
button.classList.remove(CLASS_NAME_ACTIVE)
}
}
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Button._jQueryInterface
$.fn[NAME].Constructor = Button
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Button._jQueryInterface
}
export default Button
+598
View File
@@ -0,0 +1,598 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'carousel'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key
const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key
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_RIGHT = 'carousel-item-right'
const CLASS_NAME_LEFT = 'carousel-item-left'
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-slide], [data-slide-to]'
const SELECTOR_DATA_RIDE = '[data-ride="carousel"]'
const PointerType = {
TOUCH : 'touch',
PEN : 'pen'
}
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Carousel {
constructor(element, config) {
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._element = element
this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS)
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent)
this._addEventListeners()
}
// Getters
static get VERSION() {
return VERSION
}
static get Default() {
return Default
}
// 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 &&
($(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden')) {
this.next()
}
}
prev() {
if (!this._isSliding) {
this._slide(DIRECTION_PREV)
}
}
pause(event) {
if (!event) {
this._isPaused = true
}
if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
Util.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.interval && !this._isPaused) {
this._interval = setInterval(
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
this._config.interval
)
}
}
to(index) {
this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM)
const activeIndex = this._getItemIndex(this._activeElement)
if (index > this._items.length - 1 || index < 0) {
return
}
if (this._isSliding) {
$(this._element).one(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() {
$(this._element).off(EVENT_KEY)
$.removeData(this._element, DATA_KEY)
this._items = null
this._config = null
this._element = null
this._interval = null
this._isPaused = null
this._isSliding = null
this._activeElement = null
this._indicatorsElement = null
}
// Private
_getConfig(config) {
config = {
...Default,
...config
}
Util.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) {
$(this._element).on(EVENT_KEYDOWN, (event) => this._keydown(event))
}
if (this._config.pause === 'hover') {
$(this._element)
.on(EVENT_MOUSEENTER, (event) => this.pause(event))
.on(EVENT_MOUSELEAVE, (event) => this.cycle(event))
}
if (this._config.touch) {
this._addTouchEventListeners()
}
}
_addTouchEventListeners() {
if (!this._touchSupported) {
return
}
const start = (event) => {
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
this.touchStartX = event.originalEvent.clientX
} else if (!this._pointerEvent) {
this.touchStartX = event.originalEvent.touches[0].clientX
}
}
const move = (event) => {
// ensure swiping with one touch and not pinching
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
this.touchDeltaX = 0
} else {
this.touchDeltaX = event.originalEvent.touches[0].clientX - this.touchStartX
}
}
const end = (event) => {
if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
this.touchDeltaX = event.originalEvent.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)
}
}
$(this._element.querySelectorAll(SELECTOR_ITEM_IMG))
.on(EVENT_DRAG_START, (e) => e.preventDefault())
if (this._pointerEvent) {
$(this._element).on(EVENT_POINTERDOWN, (event) => start(event))
$(this._element).on(EVENT_POINTERUP, (event) => end(event))
this._element.classList.add(CLASS_NAME_POINTER_EVENT)
} else {
$(this._element).on(EVENT_TOUCHSTART, (event) => start(event))
$(this._element).on(EVENT_TOUCHMOVE, (event) => move(event))
$(this._element).on(EVENT_TOUCHEND, (event) => end(event))
}
}
_keydown(event) {
if (/input|textarea/i.test(event.target.tagName)) {
return
}
switch (event.which) {
case ARROW_LEFT_KEYCODE:
event.preventDefault()
this.prev()
break
case ARROW_RIGHT_KEYCODE:
event.preventDefault()
this.next()
break
default:
}
}
_getItemIndex(element) {
this._items = element && element.parentNode
? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM))
: []
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(this._element.querySelector(SELECTOR_ACTIVE_ITEM))
const slideEvent = $.Event(EVENT_SLIDE, {
relatedTarget,
direction: eventDirectionName,
from: fromIndex,
to: targetIndex
})
$(this._element).trigger(slideEvent)
return slideEvent
}
_setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE))
$(indicators).removeClass(CLASS_NAME_ACTIVE)
const nextIndicator = this._indicatorsElement.children[
this._getItemIndex(element)
]
if (nextIndicator) {
$(nextIndicator).addClass(CLASS_NAME_ACTIVE)
}
}
}
_slide(direction, element) {
const activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM)
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_LEFT
orderClassName = CLASS_NAME_NEXT
eventDirectionName = DIRECTION_LEFT
} else {
directionalClassName = CLASS_NAME_RIGHT
orderClassName = CLASS_NAME_PREV
eventDirectionName = DIRECTION_RIGHT
}
if (nextElement && $(nextElement).hasClass(CLASS_NAME_ACTIVE)) {
this._isSliding = false
return
}
const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName)
if (slideEvent.isDefaultPrevented()) {
return
}
if (!activeElement || !nextElement) {
// Some weirdness is happening, so we bail
return
}
this._isSliding = true
if (isCycling) {
this.pause()
}
this._setActiveIndicatorElement(nextElement)
const slidEvent = $.Event(EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex
})
if ($(this._element).hasClass(CLASS_NAME_SLIDE)) {
$(nextElement).addClass(orderClassName)
Util.reflow(nextElement)
$(activeElement).addClass(directionalClassName)
$(nextElement).addClass(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 = Util.getTransitionDurationFromElement(activeElement)
$(activeElement)
.one(Util.TRANSITION_END, () => {
$(nextElement)
.removeClass(`${directionalClassName} ${orderClassName}`)
.addClass(CLASS_NAME_ACTIVE)
$(activeElement).removeClass(`${CLASS_NAME_ACTIVE} ${orderClassName} ${directionalClassName}`)
this._isSliding = false
setTimeout(() => $(this._element).trigger(slidEvent), 0)
})
.emulateTransitionEnd(transitionDuration)
} else {
$(activeElement).removeClass(CLASS_NAME_ACTIVE)
$(nextElement).addClass(CLASS_NAME_ACTIVE)
this._isSliding = false
$(this._element).trigger(slidEvent)
}
if (isCycling) {
this.cycle()
}
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
let _config = {
...Default,
...$(this).data()
}
if (typeof config === 'object') {
_config = {
..._config,
...config
}
}
const action = typeof config === 'string' ? config : _config.slide
if (!data) {
data = new Carousel(this, _config)
$(this).data(DATA_KEY, data)
}
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 _dataApiClickHandler(event) {
const selector = Util.getSelectorFromElement(this)
if (!selector) {
return
}
const target = $(selector)[0]
if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) {
return
}
const config = {
...$(target).data(),
...$(this).data()
}
const slideIndex = this.getAttribute('data-slide-to')
if (slideIndex) {
config.interval = false
}
Carousel._jQueryInterface.call($(target), config)
if (slideIndex) {
$(target).data(DATA_KEY).to(slideIndex)
}
event.preventDefault()
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler)
$(window).on(EVENT_LOAD_DATA_API, () => {
const carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE))
for (let i = 0, len = carousels.length; i < len; i++) {
const $carousel = $(carousels[i])
Carousel._jQueryInterface.call($carousel, $carousel.data())
}
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Carousel._jQueryInterface
$.fn[NAME].Constructor = Carousel
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Carousel._jQueryInterface
}
export default Carousel
+391
View File
@@ -0,0 +1,391 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'collapse'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.collapse'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
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 DIMENSION_WIDTH = 'width'
const DIMENSION_HEIGHT = 'height'
const SELECTOR_ACTIVES = '.show, .collapsing'
const SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Collapse {
constructor(element, config) {
this._isTransitioning = false
this._element = element
this._config = this._getConfig(config)
this._triggerArray = [].slice.call(document.querySelectorAll(
`[data-toggle="collapse"][href="#${element.id}"],` +
`[data-toggle="collapse"][data-target="#${element.id}"]`
))
const toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE))
for (let i = 0, len = toggleList.length; i < len; i++) {
const elem = toggleList[i]
const selector = Util.getSelectorFromElement(elem)
const filterElement = [].slice.call(document.querySelectorAll(selector))
.filter((foundElem) => foundElem === element)
if (selector !== null && filterElement.length > 0) {
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 VERSION() {
return VERSION
}
static get Default() {
return Default
}
// Public
toggle() {
if ($(this._element).hasClass(CLASS_NAME_SHOW)) {
this.hide()
} else {
this.show()
}
}
show() {
if (this._isTransitioning ||
$(this._element).hasClass(CLASS_NAME_SHOW)) {
return
}
let actives
let activesData
if (this._parent) {
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES))
.filter((elem) => {
if (typeof this._config.parent === 'string') {
return elem.getAttribute('data-parent') === this._config.parent
}
return elem.classList.contains(CLASS_NAME_COLLAPSE)
})
if (actives.length === 0) {
actives = null
}
}
if (actives) {
activesData = $(actives).not(this._selector).data(DATA_KEY)
if (activesData && activesData._isTransitioning) {
return
}
}
const startEvent = $.Event(EVENT_SHOW)
$(this._element).trigger(startEvent)
if (startEvent.isDefaultPrevented()) {
return
}
if (actives) {
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide')
if (!activesData) {
$(actives).data(DATA_KEY, null)
}
}
const dimension = this._getDimension()
$(this._element)
.removeClass(CLASS_NAME_COLLAPSE)
.addClass(CLASS_NAME_COLLAPSING)
this._element.style[dimension] = 0
if (this._triggerArray.length) {
$(this._triggerArray)
.removeClass(CLASS_NAME_COLLAPSED)
.attr('aria-expanded', true)
}
this.setTransitioning(true)
const complete = () => {
$(this._element)
.removeClass(CLASS_NAME_COLLAPSING)
.addClass(`${CLASS_NAME_COLLAPSE} ${CLASS_NAME_SHOW}`)
this._element.style[dimension] = ''
this.setTransitioning(false)
$(this._element).trigger(EVENT_SHOWN)
}
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)
const scrollSize = `scroll${capitalizedDimension}`
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
this._element.style[dimension] = `${this._element[scrollSize]}px`
}
hide() {
if (this._isTransitioning ||
!$(this._element).hasClass(CLASS_NAME_SHOW)) {
return
}
const startEvent = $.Event(EVENT_HIDE)
$(this._element).trigger(startEvent)
if (startEvent.isDefaultPrevented()) {
return
}
const dimension = this._getDimension()
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`
Util.reflow(this._element)
$(this._element)
.addClass(CLASS_NAME_COLLAPSING)
.removeClass(`${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 selector = Util.getSelectorFromElement(trigger)
if (selector !== null) {
const $elem = $([].slice.call(document.querySelectorAll(selector)))
if (!$elem.hasClass(CLASS_NAME_SHOW)) {
$(trigger).addClass(CLASS_NAME_COLLAPSED)
.attr('aria-expanded', false)
}
}
}
}
this.setTransitioning(true)
const complete = () => {
this.setTransitioning(false)
$(this._element)
.removeClass(CLASS_NAME_COLLAPSING)
.addClass(CLASS_NAME_COLLAPSE)
.trigger(EVENT_HIDDEN)
}
this._element.style[dimension] = ''
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
}
setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning
}
dispose() {
$.removeData(this._element, DATA_KEY)
this._config = null
this._parent = null
this._element = null
this._triggerArray = null
this._isTransitioning = null
}
// Private
_getConfig(config) {
config = {
...Default,
...config
}
config.toggle = Boolean(config.toggle) // Coerce string values
Util.typeCheckConfig(NAME, config, DefaultType)
return config
}
_getDimension() {
const hasWidth = $(this._element).hasClass(DIMENSION_WIDTH)
return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT
}
_getParent() {
let parent
if (Util.isElement(this._config.parent)) {
parent = this._config.parent
// It's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined') {
parent = this._config.parent[0]
}
} else {
parent = document.querySelector(this._config.parent)
}
const selector = `[data-toggle="collapse"][data-parent="${this._config.parent}"]`
const children = [].slice.call(parent.querySelectorAll(selector))
$(children).each((i, element) => {
this._addAriaAndCollapsedClass(
Collapse._getTargetFromElement(element),
[element]
)
})
return parent
}
_addAriaAndCollapsedClass(element, triggerArray) {
const isOpen = $(element).hasClass(CLASS_NAME_SHOW)
if (triggerArray.length) {
$(triggerArray)
.toggleClass(CLASS_NAME_COLLAPSED, !isOpen)
.attr('aria-expanded', isOpen)
}
}
// Static
static _getTargetFromElement(element) {
const selector = Util.getSelectorFromElement(element)
return selector ? document.querySelector(selector) : null
}
static _jQueryInterface(config) {
return this.each(function () {
const $this = $(this)
let data = $this.data(DATA_KEY)
const _config = {
...Default,
...$this.data(),
...typeof config === 'object' && config ? config : {}
}
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
_config.toggle = false
}
if (!data) {
data = new Collapse(this, _config)
$this.data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(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.currentTarget.tagName === 'A') {
event.preventDefault()
}
const $trigger = $(this)
const selector = Util.getSelectorFromElement(this)
const selectors = [].slice.call(document.querySelectorAll(selector))
$(selectors).each(function () {
const $target = $(this)
const data = $target.data(DATA_KEY)
const config = data ? 'toggle' : $trigger.data()
Collapse._jQueryInterface.call($target, config)
})
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Collapse._jQueryInterface
$.fn[NAME].Constructor = Collapse
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Collapse._jQueryInterface
}
export default Collapse
+534
View File
@@ -0,0 +1,534 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Popper from 'core/popper'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'dropdown'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.dropdown'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key
const SPACE_KEYCODE = 32 // KeyboardEvent.which value for space key
const TAB_KEYCODE = 9 // KeyboardEvent.which value for tab key
const ARROW_UP_KEYCODE = 38 // KeyboardEvent.which value for up arrow key
const ARROW_DOWN_KEYCODE = 40 // KeyboardEvent.which value for down arrow key
const RIGHT_MOUSE_BUTTON_WHICH = 3 // MouseEvent.which value for the right button (assuming a right-handed mouse)
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEYCODE}|${ARROW_DOWN_KEYCODE}|${ESCAPE_KEYCODE}`)
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_DROPRIGHT = 'dropright'
const CLASS_NAME_DROPLEFT = 'dropleft'
const CLASS_NAME_MENURIGHT = 'dropdown-menu-right'
const CLASS_NAME_POSITION_STATIC = 'position-static'
const SELECTOR_DATA_TOGGLE = '[data-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 = 'top-start'
const PLACEMENT_TOPEND = 'top-end'
const PLACEMENT_BOTTOM = 'bottom-start'
const PLACEMENT_BOTTOMEND = 'bottom-end'
const PLACEMENT_RIGHT = 'right-start'
const PLACEMENT_LEFT = 'left-start'
const Default = {
offset : 0,
flip : true,
boundary : 'scrollParent',
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 {
constructor(element, config) {
this._element = element
this._popper = null
this._config = this._getConfig(config)
this._menu = this._getMenuElement()
this._inNavbar = this._detectNavbar()
this._addEventListeners()
}
// Getters
static get VERSION() {
return VERSION
}
static get Default() {
return Default
}
static get DefaultType() {
return DefaultType
}
// Public
toggle() {
if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED)) {
return
}
const isActive = $(this._menu).hasClass(CLASS_NAME_SHOW)
Dropdown._clearMenus()
if (isActive) {
return
}
this.show(true)
}
show(usePopper = false) {
if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || $(this._menu).hasClass(CLASS_NAME_SHOW)) {
return
}
const relatedTarget = {
relatedTarget: this._element
}
const showEvent = $.Event(EVENT_SHOW, relatedTarget)
const parent = Dropdown._getParentFromElement(this._element)
$(parent).trigger(showEvent)
if (showEvent.isDefaultPrevented()) {
return
}
// Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar && usePopper) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)')
}
let referenceElement = this._element
if (this._config.reference === 'parent') {
referenceElement = parent
} else if (Util.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]
}
}
// 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).addClass(CLASS_NAME_POSITION_STATIC)
}
this._popper = new Popper(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).length === 0) {
$(document.body).children().on('mouseover', null, $.noop)
}
this._element.focus()
this._element.setAttribute('aria-expanded', true)
$(this._menu).toggleClass(CLASS_NAME_SHOW)
$(parent)
.toggleClass(CLASS_NAME_SHOW)
.trigger($.Event(EVENT_SHOWN, relatedTarget))
}
hide() {
if (this._element.disabled || $(this._element).hasClass(CLASS_NAME_DISABLED) || !$(this._menu).hasClass(CLASS_NAME_SHOW)) {
return
}
const relatedTarget = {
relatedTarget: this._element
}
const hideEvent = $.Event(EVENT_HIDE, relatedTarget)
const parent = Dropdown._getParentFromElement(this._element)
$(parent).trigger(hideEvent)
if (hideEvent.isDefaultPrevented()) {
return
}
if (this._popper) {
this._popper.destroy()
}
$(this._menu).toggleClass(CLASS_NAME_SHOW)
$(parent)
.toggleClass(CLASS_NAME_SHOW)
.trigger($.Event(EVENT_HIDDEN, relatedTarget))
}
dispose() {
$.removeData(this._element, DATA_KEY)
$(this._element).off(EVENT_KEY)
this._element = null
this._menu = null
if (this._popper !== null) {
this._popper.destroy()
this._popper = null
}
}
update() {
this._inNavbar = this._detectNavbar()
if (this._popper !== null) {
this._popper.scheduleUpdate()
}
}
// Private
_addEventListeners() {
$(this._element).on(EVENT_CLICK, (event) => {
event.preventDefault()
event.stopPropagation()
this.toggle()
})
}
_getConfig(config) {
config = {
...this.constructor.Default,
...$(this._element).data(),
...config
}
Util.typeCheckConfig(
NAME,
config,
this.constructor.DefaultType
)
return config
}
_getMenuElement() {
if (!this._menu) {
const parent = Dropdown._getParentFromElement(this._element)
if (parent) {
this._menu = parent.querySelector(SELECTOR_MENU)
}
}
return this._menu
}
_getPlacement() {
const $parentDropdown = $(this._element.parentNode)
let placement = PLACEMENT_BOTTOM
// Handle dropup
if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
placement = $(this._menu).hasClass(CLASS_NAME_MENURIGHT)
? PLACEMENT_TOPEND
: PLACEMENT_TOP
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
placement = PLACEMENT_RIGHT
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
placement = PLACEMENT_LEFT
} else if ($(this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
placement = PLACEMENT_BOTTOMEND
}
return placement
}
_detectNavbar() {
return $(this._element).closest('.navbar').length > 0
}
_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() {
const popperConfig = {
placement: this._getPlacement(),
modifiers: {
offset: this._getOffset(),
flip: {
enabled: this._config.flip
},
preventOverflow: {
boundariesElement: this._config.boundary
}
}
}
// Disable Popper.js if we have a static display
if (this._config.display === 'static') {
popperConfig.modifiers.applyStyle = {
enabled: false
}
}
return {
...popperConfig,
...this._config.popperConfig
}
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = typeof config === 'object' ? config : null
if (!data) {
data = new Dropdown(this, _config)
$(this).data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
static _clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH ||
event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return
}
const toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE))
for (let i = 0, len = toggles.length; i < len; i++) {
const parent = Dropdown._getParentFromElement(toggles[i])
const context = $(toggles[i]).data(DATA_KEY)
const relatedTarget = {
relatedTarget: toggles[i]
}
if (event && event.type === 'click') {
relatedTarget.clickEvent = event
}
if (!context) {
continue
}
const dropdownMenu = context._menu
if (!$(parent).hasClass(CLASS_NAME_SHOW)) {
continue
}
if (event && (event.type === 'click' &&
/input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) &&
$.contains(parent, event.target)) {
continue
}
const hideEvent = $.Event(EVENT_HIDE, relatedTarget)
$(parent).trigger(hideEvent)
if (hideEvent.isDefaultPrevented()) {
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) {
$(document.body).children().off('mouseover', null, $.noop)
}
toggles[i].setAttribute('aria-expanded', 'false')
if (context._popper) {
context._popper.destroy()
}
$(dropdownMenu).removeClass(CLASS_NAME_SHOW)
$(parent)
.removeClass(CLASS_NAME_SHOW)
.trigger($.Event(EVENT_HIDDEN, relatedTarget))
}
}
static _getParentFromElement(element) {
let parent
const selector = Util.getSelectorFromElement(element)
if (selector) {
parent = document.querySelector(selector)
}
return parent || element.parentNode
}
// eslint-disable-next-line complexity
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.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE &&
(event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE ||
$(event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
return
}
if (this.disabled || $(this).hasClass(CLASS_NAME_DISABLED)) {
return
}
const parent = Dropdown._getParentFromElement(this)
const isActive = $(parent).hasClass(CLASS_NAME_SHOW)
if (!isActive && event.which === ESCAPE_KEYCODE) {
return
}
event.preventDefault()
event.stopPropagation()
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) {
$(parent.querySelector(SELECTOR_DATA_TOGGLE)).trigger('focus')
}
$(this).trigger('click')
return
}
const items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS))
.filter((item) => $(item).is(':visible'))
if (items.length === 0) {
return
}
let index = items.indexOf(event.target)
if (event.which === ARROW_UP_KEYCODE && index > 0) { // Up
index--
}
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { // Down
index++
}
if (index < 0) {
index = 0
}
items[index].focus()
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document)
.on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown._dataApiKeydownHandler)
.on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler)
.on(`${EVENT_CLICK_DATA_API} ${EVENT_KEYUP_DATA_API}`, Dropdown._clearMenus)
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault()
event.stopPropagation()
Dropdown._jQueryInterface.call($(this), 'toggle')
})
.on(EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => {
e.stopPropagation()
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Dropdown._jQueryInterface
$.fn[NAME].Constructor = Dropdown
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Dropdown._jQueryInterface
}
export default Dropdown
+34
View File
@@ -0,0 +1,34 @@
import Alert from './alert'
import Button from './button'
import Carousel from './carousel'
import Collapse from './collapse'
import Dropdown from './dropdown'
import Modal from './modal'
import Popover from './popover'
import Scrollspy from './scrollspy'
import Tab from './tab'
import Toast from './toast'
import Tooltip from './tooltip'
import Util from './util'
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
export {
Util,
Alert,
Button,
Carousel,
Collapse,
Dropdown,
Modal,
Popover,
Scrollspy,
Tab,
Toast,
Tooltip
}
+612
View File
@@ -0,0 +1,612 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'modal'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.modal'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key
const Default = {
backdrop : true,
keyboard : true,
focus : true,
show : true
}
const DefaultType = {
backdrop : '(boolean|string)',
keyboard : 'boolean',
focus : 'boolean',
show : '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_SCROLLABLE = 'modal-dialog-scrollable'
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-toggle="modal"]'
const SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]'
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
const SELECTOR_STICKY_CONTENT = '.sticky-top'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Modal {
constructor(element, config) {
this._config = this._getConfig(config)
this._element = element
this._dialog = element.querySelector(SELECTOR_DIALOG)
this._backdrop = null
this._isShown = false
this._isBodyOverflowing = false
this._ignoreBackdropClick = false
this._isTransitioning = false
this._scrollbarWidth = 0
}
// Getters
static get VERSION() {
return VERSION
}
static get Default() {
return Default
}
// Public
toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget)
}
show(relatedTarget) {
if (this._isShown || this._isTransitioning) {
return
}
if ($(this._element).hasClass(CLASS_NAME_FADE)) {
this._isTransitioning = true
}
const showEvent = $.Event(EVENT_SHOW, {
relatedTarget
})
$(this._element).trigger(showEvent)
if (this._isShown || showEvent.isDefaultPrevented()) {
return
}
this._isShown = true
this._checkScrollbar()
this._setScrollbar()
this._adjustDialog()
this._setEscapeEvent()
this._setResizeEvent()
$(this._element).on(
EVENT_CLICK_DISMISS,
SELECTOR_DATA_DISMISS,
(event) => this.hide(event)
)
$(this._dialog).on(EVENT_MOUSEDOWN_DISMISS, () => {
$(this._element).one(EVENT_MOUSEUP_DISMISS, (event) => {
if ($(event.target).is(this._element)) {
this._ignoreBackdropClick = true
}
})
})
this._showBackdrop(() => this._showElement(relatedTarget))
}
hide(event) {
if (event) {
event.preventDefault()
}
if (!this._isShown || this._isTransitioning) {
return
}
const hideEvent = $.Event(EVENT_HIDE)
$(this._element).trigger(hideEvent)
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return
}
this._isShown = false
const transition = $(this._element).hasClass(CLASS_NAME_FADE)
if (transition) {
this._isTransitioning = true
}
this._setEscapeEvent()
this._setResizeEvent()
$(document).off(EVENT_FOCUSIN)
$(this._element).removeClass(CLASS_NAME_SHOW)
$(this._element).off(EVENT_CLICK_DISMISS)
$(this._dialog).off(EVENT_MOUSEDOWN_DISMISS)
if (transition) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element)
.one(Util.TRANSITION_END, (event) => this._hideModal(event))
.emulateTransitionEnd(transitionDuration)
} else {
this._hideModal()
}
}
dispose() {
[window, this._element, this._dialog]
.forEach((htmlElement) => $(htmlElement).off(EVENT_KEY))
/**
* `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
*/
$(document).off(EVENT_FOCUSIN)
$.removeData(this._element, DATA_KEY)
this._config = null
this._element = 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,
...config
}
Util.typeCheckConfig(NAME, config, DefaultType)
return config
}
_triggerBackdropTransition() {
if (this._config.backdrop === 'static') {
const hideEventPrevented = $.Event(EVENT_HIDE_PREVENTED)
$(this._element).trigger(hideEventPrevented)
if (hideEventPrevented.defaultPrevented) {
return
}
this._element.classList.add(CLASS_NAME_STATIC)
const modalTransitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element).one(Util.TRANSITION_END, () => {
this._element.classList.remove(CLASS_NAME_STATIC)
})
.emulateTransitionEnd(modalTransitionDuration)
this._element.focus()
} else {
this.hide()
}
}
_showElement(relatedTarget) {
const transition = $(this._element).hasClass(CLASS_NAME_FADE)
const modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null
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)
if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
modalBody.scrollTop = 0
} else {
this._element.scrollTop = 0
}
if (transition) {
Util.reflow(this._element)
}
$(this._element).addClass(CLASS_NAME_SHOW)
if (this._config.focus) {
this._enforceFocus()
}
const shownEvent = $.Event(EVENT_SHOWN, {
relatedTarget
})
const transitionComplete = () => {
if (this._config.focus) {
this._element.focus()
}
this._isTransitioning = false
$(this._element).trigger(shownEvent)
}
if (transition) {
const transitionDuration = Util.getTransitionDurationFromElement(this._dialog)
$(this._dialog)
.one(Util.TRANSITION_END, transitionComplete)
.emulateTransitionEnd(transitionDuration)
} else {
transitionComplete()
}
}
_enforceFocus() {
$(document)
.off(EVENT_FOCUSIN) // Guard against infinite focus loop
.on(EVENT_FOCUSIN, (event) => {
if (document !== event.target &&
this._element !== event.target &&
$(this._element).has(event.target).length === 0) {
this._element.focus()
}
})
}
_setEscapeEvent() {
if (this._isShown) {
$(this._element).on(EVENT_KEYDOWN_DISMISS, (event) => {
if (this._config.keyboard && event.which === ESCAPE_KEYCODE) {
event.preventDefault()
this.hide()
} else if (!this._config.keyboard && event.which === ESCAPE_KEYCODE) {
this._triggerBackdropTransition()
}
})
} else if (!this._isShown) {
$(this._element).off(EVENT_KEYDOWN_DISMISS)
}
}
_setResizeEvent() {
if (this._isShown) {
$(window).on(EVENT_RESIZE, (event) => this.handleUpdate(event))
} else {
$(window).off(EVENT_RESIZE)
}
}
_hideModal() {
this._element.style.display = 'none'
this._element.setAttribute('aria-hidden', true)
this._element.removeAttribute('aria-modal')
this._isTransitioning = false
this._showBackdrop(() => {
$(document.body).removeClass(CLASS_NAME_OPEN)
this._resetAdjustments()
this._resetScrollbar()
$(this._element).trigger(EVENT_HIDDEN)
})
}
_removeBackdrop() {
if (this._backdrop) {
$(this._backdrop).remove()
this._backdrop = null
}
}
_showBackdrop(callback) {
const animate = $(this._element).hasClass(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)
}
$(this._backdrop).appendTo(document.body)
$(this._element).on(EVENT_CLICK_DISMISS, (event) => {
if (this._ignoreBackdropClick) {
this._ignoreBackdropClick = false
return
}
if (event.target !== event.currentTarget) {
return
}
this._triggerBackdropTransition()
})
if (animate) {
Util.reflow(this._backdrop)
}
$(this._backdrop).addClass(CLASS_NAME_SHOW)
if (!callback) {
return
}
if (!animate) {
callback()
return
}
const backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop)
$(this._backdrop)
.one(Util.TRANSITION_END, callback)
.emulateTransitionEnd(backdropTransitionDuration)
} else if (!this._isShown && this._backdrop) {
$(this._backdrop).removeClass(CLASS_NAME_SHOW)
const callbackRemove = () => {
this._removeBackdrop()
if (callback) {
callback()
}
}
if ($(this._element).hasClass(CLASS_NAME_FADE)) {
const backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop)
$(this._backdrop)
.one(Util.TRANSITION_END, callbackRemove)
.emulateTransitionEnd(backdropTransitionDuration)
} else {
callbackRemove()
}
} else if (callback) {
callback()
}
}
// ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js
// ----------------------------------------------------------------------
_adjustDialog() {
const isModalOverflowing =
this._element.scrollHeight > document.documentElement.clientHeight
if (!this._isBodyOverflowing && isModalOverflowing) {
this._element.style.paddingLeft = `${this._scrollbarWidth}px`
}
if (this._isBodyOverflowing && !isModalOverflowing) {
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
const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT))
const stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT))
// Adjust fixed content padding
$(fixedContent).each((index, element) => {
const actualPadding = element.style.paddingRight
const calculatedPadding = $(element).css('padding-right')
$(element)
.data('padding-right', actualPadding)
.css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`)
})
// Adjust sticky content margin
$(stickyContent).each((index, element) => {
const actualMargin = element.style.marginRight
const calculatedMargin = $(element).css('margin-right')
$(element)
.data('margin-right', actualMargin)
.css('margin-right', `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`)
})
// Adjust body padding
const actualPadding = document.body.style.paddingRight
const calculatedPadding = $(document.body).css('padding-right')
$(document.body)
.data('padding-right', actualPadding)
.css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`)
}
$(document.body).addClass(CLASS_NAME_OPEN)
}
_resetScrollbar() {
// Restore fixed content padding
const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT))
$(fixedContent).each((index, element) => {
const padding = $(element).data('padding-right')
$(element).removeData('padding-right')
element.style.paddingRight = padding ? padding : ''
})
// Restore sticky content
const elements = [].slice.call(document.querySelectorAll(`${SELECTOR_STICKY_CONTENT}`))
$(elements).each((index, element) => {
const margin = $(element).data('margin-right')
if (typeof margin !== 'undefined') {
$(element).css('margin-right', margin).removeData('margin-right')
}
})
// Restore body padding
const padding = $(document.body).data('padding-right')
$(document.body).removeData('padding-right')
document.body.style.paddingRight = padding ? 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 = $(this).data(DATA_KEY)
const _config = {
...Default,
...$(this).data(),
...typeof config === 'object' && config ? config : {}
}
if (!data) {
data = new Modal(this, _config)
$(this).data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config](relatedTarget)
} else if (_config.show) {
data.show(relatedTarget)
}
})
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
let target
const selector = Util.getSelectorFromElement(this)
if (selector) {
target = document.querySelector(selector)
}
const config = $(target).data(DATA_KEY)
? 'toggle' : {
...$(target).data(),
...$(this).data()
}
if (this.tagName === 'A' || this.tagName === 'AREA') {
event.preventDefault()
}
const $target = $(target).one(EVENT_SHOW, (showEvent) => {
if (showEvent.isDefaultPrevented()) {
// Only register focus restorer if modal will actually get shown
return
}
$target.one(EVENT_HIDDEN, () => {
if ($(this).is(':visible')) {
this.focus()
}
})
})
Modal._jQueryInterface.call($(target), config, this)
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Modal._jQueryInterface
$.fn[NAME].Constructor = Modal
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Modal._jQueryInterface
}
export default Modal
+180
View File
@@ -0,0 +1,180 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Tooltip from './tooltip'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'popover'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
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="arrow"></div>' +
'<h3 class="popover-header"></h3>' +
'<div class="popover-body"></div></div>'
}
const DefaultType = {
...Tooltip.DefaultType,
content : '(string|element|function)'
}
const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
const SELECTOR_TITLE = '.popover-header'
const SELECTOR_CONTENT = '.popover-body'
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}`
}
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Popover extends Tooltip {
// Getters
static get VERSION() {
return VERSION
}
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()
}
addAttachmentClass(attachment) {
$(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)
}
getTipElement() {
this.tip = this.tip || $(this.config.template)[0]
return this.tip
}
setContent() {
const $tip = $(this.getTipElement())
// We use append for html objects to maintain js events
this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle())
let content = this._getContent()
if (typeof content === 'function') {
content = content.call(this.element)
}
this.setElementContent($tip.find(SELECTOR_CONTENT), content)
$tip.removeClass(`${CLASS_NAME_FADE} ${CLASS_NAME_SHOW}`)
}
// Private
_getContent() {
return this.element.getAttribute('data-content') ||
this.config.content
}
_cleanTipClass() {
const $tip = $(this.getTipElement())
const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX)
if (tabClass !== null && tabClass.length > 0) {
$tip.removeClass(tabClass.join(''))
}
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = typeof config === 'object' ? config : null
if (!data && /dispose|hide/.test(config)) {
return
}
if (!data) {
data = new Popover(this, _config)
$(this).data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface
$.fn[NAME].Constructor = Popover
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Popover._jQueryInterface
}
export default Popover
+320
View File
@@ -0,0 +1,320 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'scrollspy'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.scrollspy'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
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-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_ITEMS = '.dropdown-item'
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
const METHOD_OFFSET = 'offset'
const METHOD_POSITION = 'position'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class ScrollSpy {
constructor(element, config) {
this._element = 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} ${SELECTOR_DROPDOWN_ITEMS}`
this._offsets = []
this._targets = []
this._activeTarget = null
this._scrollHeight = 0
$(this._scrollElement).on(EVENT_SCROLL, (event) => this._process(event))
this.refresh()
this._process()
}
// Getters
static get VERSION() {
return VERSION
}
static get Default() {
return Default
}
// 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 = [].slice.call(document.querySelectorAll(this._selector))
targets
.map((element) => {
let target
const targetSelector = Util.getSelectorFromElement(element)
if (targetSelector) {
target = document.querySelector(targetSelector)
}
if (target) {
const targetBCR = target.getBoundingClientRect()
if (targetBCR.width || targetBCR.height) {
// TODO (fat): remove sketch reliance on jQuery position/offset
return [
$(target)[offsetMethod]().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() {
$.removeData(this._element, DATA_KEY)
$(this._scrollElement).off(EVENT_KEY)
this._element = null
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' && Util.isElement(config.target)) {
let id = $(config.target).attr('id')
if (!id) {
id = Util.getUID(NAME)
$(config.target).attr('id', id)
}
config.target = `#${id}`
}
Util.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-target="${target}"],${selector}[href="${target}"]`)
const $link = $([].slice.call(document.querySelectorAll(queries.join(','))))
if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
$link.closest(SELECTOR_DROPDOWN)
.find(SELECTOR_DROPDOWN_TOGGLE)
.addClass(CLASS_NAME_ACTIVE)
$link.addClass(CLASS_NAME_ACTIVE)
} else {
// Set triggered link as active
$link.addClass(CLASS_NAME_ACTIVE)
// Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
$link.parents(SELECTOR_NAV_LIST_GROUP)
.prev(`${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`)
.addClass(CLASS_NAME_ACTIVE)
// Handle special case when .nav-link is inside .nav-item
$link.parents(SELECTOR_NAV_LIST_GROUP)
.prev(SELECTOR_NAV_ITEMS)
.children(SELECTOR_NAV_LINKS)
.addClass(CLASS_NAME_ACTIVE)
}
$(this._scrollElement).trigger(EVENT_ACTIVATE, {
relatedTarget: target
})
}
_clear() {
[].slice.call(document.querySelectorAll(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 = $(this).data(DATA_KEY)
const _config = typeof config === 'object' && config
if (!data) {
data = new ScrollSpy(this, _config)
$(this).data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(window).on(EVENT_LOAD_DATA_API, () => {
const scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY))
const scrollSpysLength = scrollSpys.length
for (let i = scrollSpysLength; i--;) {
const $spy = $(scrollSpys[i])
ScrollSpy._jQueryInterface.call($spy, $spy.data())
}
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = ScrollSpy._jQueryInterface
$.fn[NAME].Constructor = ScrollSpy
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return ScrollSpy._jQueryInterface
}
export default ScrollSpy
+254
View File
@@ -0,0 +1,254 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'tab'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.tab'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]
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 = '> li > .active'
const SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
const SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Tab {
constructor(element) {
this._element = element
}
// Getters
static get VERSION() {
return VERSION
}
// Public
show() {
if (this._element.parentNode &&
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
$(this._element).hasClass(CLASS_NAME_ACTIVE) ||
$(this._element).hasClass(CLASS_NAME_DISABLED)) {
return
}
let target
let previous
const listElement = $(this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]
const selector = Util.getSelectorFromElement(this._element)
if (listElement) {
const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE
previous = $.makeArray($(listElement).find(itemSelector))
previous = previous[previous.length - 1]
}
const hideEvent = $.Event(EVENT_HIDE, {
relatedTarget: this._element
})
const showEvent = $.Event(EVENT_SHOW, {
relatedTarget: previous
})
if (previous) {
$(previous).trigger(hideEvent)
}
$(this._element).trigger(showEvent)
if (showEvent.isDefaultPrevented() ||
hideEvent.isDefaultPrevented()) {
return
}
if (selector) {
target = document.querySelector(selector)
}
this._activate(
this._element,
listElement
)
const complete = () => {
const hiddenEvent = $.Event(EVENT_HIDDEN, {
relatedTarget: this._element
})
const shownEvent = $.Event(EVENT_SHOWN, {
relatedTarget: previous
})
$(previous).trigger(hiddenEvent)
$(this._element).trigger(shownEvent)
}
if (target) {
this._activate(target, target.parentNode, complete)
} else {
complete()
}
}
dispose() {
$.removeData(this._element, DATA_KEY)
this._element = null
}
// Private
_activate(element, container, callback) {
const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL')
? $(container).find(SELECTOR_ACTIVE_UL)
: $(container).children(SELECTOR_ACTIVE)
const active = activeElements[0]
const isTransitioning = callback && (active && $(active).hasClass(CLASS_NAME_FADE))
const complete = () => this._transitionComplete(
element,
active,
callback
)
if (active && isTransitioning) {
const transitionDuration = Util.getTransitionDurationFromElement(active)
$(active)
.removeClass(CLASS_NAME_SHOW)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
} else {
complete()
}
}
_transitionComplete(element, active, callback) {
if (active) {
$(active).removeClass(CLASS_NAME_ACTIVE)
const dropdownChild = $(active.parentNode).find(
SELECTOR_DROPDOWN_ACTIVE_CHILD
)[0]
if (dropdownChild) {
$(dropdownChild).removeClass(CLASS_NAME_ACTIVE)
}
if (active.getAttribute('role') === 'tab') {
active.setAttribute('aria-selected', false)
}
}
$(element).addClass(CLASS_NAME_ACTIVE)
if (element.getAttribute('role') === 'tab') {
element.setAttribute('aria-selected', true)
}
Util.reflow(element)
if (element.classList.contains(CLASS_NAME_FADE)) {
element.classList.add(CLASS_NAME_SHOW)
}
if (element.parentNode && $(element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
const dropdownElement = $(element).closest(SELECTOR_DROPDOWN)[0]
if (dropdownElement) {
const dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE))
$(dropdownToggleList).addClass(CLASS_NAME_ACTIVE)
}
element.setAttribute('aria-expanded', true)
}
if (callback) {
callback()
}
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
const $this = $(this)
let data = $this.data(DATA_KEY)
if (!data) {
data = new Tab(this)
$this.data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document)
.on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault()
Tab._jQueryInterface.call($(this), 'show')
})
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tab._jQueryInterface
$.fn[NAME].Constructor = Tab
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Tab._jQueryInterface
}
export default Tab
+224
View File
@@ -0,0 +1,224 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'toast'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.toast'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
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 : 500
}
const SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Toast {
constructor(element, config) {
this._element = element
this._config = this._getConfig(config)
this._timeout = null
this._setListeners()
}
// Getters
static get VERSION() {
return VERSION
}
static get DefaultType() {
return DefaultType
}
static get Default() {
return Default
}
// Public
show() {
const showEvent = $.Event(EVENT_SHOW)
$(this._element).trigger(showEvent)
if (showEvent.isDefaultPrevented()) {
return
}
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)
$(this._element).trigger(EVENT_SHOWN)
if (this._config.autohide) {
this._timeout = setTimeout(() => {
this.hide()
}, this._config.delay)
}
}
this._element.classList.remove(CLASS_NAME_HIDE)
Util.reflow(this._element)
this._element.classList.add(CLASS_NAME_SHOWING)
if (this._config.animation) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
} else {
complete()
}
}
hide() {
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
return
}
const hideEvent = $.Event(EVENT_HIDE)
$(this._element).trigger(hideEvent)
if (hideEvent.isDefaultPrevented()) {
return
}
this._close()
}
dispose() {
clearTimeout(this._timeout)
this._timeout = null
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
this._element.classList.remove(CLASS_NAME_SHOW)
}
$(this._element).off(EVENT_CLICK_DISMISS)
$.removeData(this._element, DATA_KEY)
this._element = null
this._config = null
}
// Private
_getConfig(config) {
config = {
...Default,
...$(this._element).data(),
...typeof config === 'object' && config ? config : {}
}
Util.typeCheckConfig(
NAME,
config,
this.constructor.DefaultType
)
return config
}
_setListeners() {
$(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
}
_close() {
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE)
$(this._element).trigger(EVENT_HIDDEN)
}
this._element.classList.remove(CLASS_NAME_SHOW)
if (this._config.animation) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
$(this._element)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
} else {
complete()
}
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
const $element = $(this)
let data = $element.data(DATA_KEY)
const _config = typeof config === 'object' && config
if (!data) {
data = new Toast(this, _config)
$element.data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config](this)
}
})
}
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Toast._jQueryInterface
$.fn[NAME].Constructor = Toast
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Toast._jQueryInterface
}
export default Toast
@@ -0,0 +1,127 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): tools/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
const uriAttrs = [
'background',
'cite',
'href',
'itemtype',
'longdesc',
'poster',
'src',
'xlink:href'
]
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
export const DefaultWhitelist = {
// 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: []
}
/**
* 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
function allowedAttribute(attr, allowedAttributeList) {
const attrName = attr.nodeName.toLowerCase()
if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.indexOf(attrName) !== -1) {
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 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
if (unsafeHtml.length === 0) {
return unsafeHtml
}
if (sanitizeFn && typeof sanitizeFn === 'function') {
return sanitizeFn(unsafeHtml)
}
const domParser = new window.DOMParser()
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')
const whitelistKeys = Object.keys(whiteList)
const elements = [].slice.call(createdDocument.body.querySelectorAll('*'))
for (let i = 0, len = elements.length; i < len; i++) {
const el = elements[i]
const elName = el.nodeName.toLowerCase()
if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
el.parentNode.removeChild(el)
continue
}
const attributeList = [].slice.call(el.attributes)
const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
attributeList.forEach((attr) => {
if (!allowedAttribute(attr, whitelistedAttributes)) {
el.removeAttribute(attr.nodeName)
}
})
}
return createdDocument.body.innerHTML
}
+772
View File
@@ -0,0 +1,772 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import {
DefaultWhitelist,
sanitizeHtml
} from './tools/sanitizer'
import $ from 'jquery'
import Popper from 'core/popper'
import Util from './util'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'tooltip'
const VERSION = '4.5.0'
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
const CLASS_PREFIX = 'bs-tooltip'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
const DefaultType = {
animation : 'boolean',
template : 'string',
title : '(string|element|function)',
trigger : 'string',
delay : '(number|object)',
html : 'boolean',
selector : '(string|boolean)',
placement : '(string|function)',
offset : '(number|string|function)',
container : '(string|element|boolean)',
fallbackPlacement : '(string|array)',
boundary : '(string|element)',
sanitize : 'boolean',
sanitizeFn : '(null|function)',
whiteList : 'object',
popperConfig : '(null|object)'
}
const AttachmentMap = {
AUTO : 'auto',
TOP : 'top',
RIGHT : 'right',
BOTTOM : 'bottom',
LEFT : 'left'
}
const Default = {
animation : true,
template : '<div class="tooltip" role="tooltip">' +
'<div class="arrow"></div>' +
'<div class="tooltip-inner"></div></div>',
trigger : 'hover focus',
title : '',
delay : 0,
html : false,
selector : false,
placement : 'top',
offset : 0,
container : false,
fallbackPlacement : 'flip',
boundary : 'scrollParent',
sanitize : true,
sanitizeFn : null,
whiteList : DefaultWhitelist,
popperConfig : null
}
const HOVER_STATE_SHOW = 'show'
const HOVER_STATE_OUT = 'out'
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_TOOLTIP_INNER = '.tooltip-inner'
const SELECTOR_ARROW = '.arrow'
const TRIGGER_HOVER = 'hover'
const TRIGGER_FOCUS = 'focus'
const TRIGGER_CLICK = 'click'
const TRIGGER_MANUAL = 'manual'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Tooltip {
constructor(element, config) {
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)')
}
// private
this._isEnabled = true
this._timeout = 0
this._hoverState = ''
this._activeTrigger = {}
this._popper = null
// Protected
this.element = element
this.config = this._getConfig(config)
this.tip = null
this._setListeners()
}
// Getters
static get VERSION() {
return VERSION
}
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 = $(event.currentTarget).data(dataKey)
if (!context) {
context = new this.constructor(
event.currentTarget,
this._getDelegateConfig()
)
$(event.currentTarget).data(dataKey, context)
}
context._activeTrigger.click = !context._activeTrigger.click
if (context._isWithActiveTrigger()) {
context._enter(null, context)
} else {
context._leave(null, context)
}
} else {
if ($(this.getTipElement()).hasClass(CLASS_NAME_SHOW)) {
this._leave(null, this)
return
}
this._enter(null, this)
}
}
dispose() {
clearTimeout(this._timeout)
$.removeData(this.element, this.constructor.DATA_KEY)
$(this.element).off(this.constructor.EVENT_KEY)
$(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler)
if (this.tip) {
$(this.tip).remove()
}
this._isEnabled = null
this._timeout = null
this._hoverState = null
this._activeTrigger = null
if (this._popper) {
this._popper.destroy()
}
this._popper = null
this.element = null
this.config = null
this.tip = null
}
show() {
if ($(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements')
}
const showEvent = $.Event(this.constructor.Event.SHOW)
if (this.isWithContent() && this._isEnabled) {
$(this.element).trigger(showEvent)
const shadowRoot = Util.findShadowRoot(this.element)
const isInTheDom = $.contains(
shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement,
this.element
)
if (showEvent.isDefaultPrevented() || !isInTheDom) {
return
}
const tip = this.getTipElement()
const tipId = Util.getUID(this.constructor.NAME)
tip.setAttribute('id', tipId)
this.element.setAttribute('aria-describedby', tipId)
this.setContent()
if (this.config.animation) {
$(tip).addClass(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()
$(tip).data(this.constructor.DATA_KEY, this)
if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
$(tip).appendTo(container)
}
$(this.element).trigger(this.constructor.Event.INSERTED)
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment))
$(tip).addClass(CLASS_NAME_SHOW)
// 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) {
$(document.body).children().on('mouseover', null, $.noop)
}
const complete = () => {
if (this.config.animation) {
this._fixTransition()
}
const prevHoverState = this._hoverState
this._hoverState = null
$(this.element).trigger(this.constructor.Event.SHOWN)
if (prevHoverState === HOVER_STATE_OUT) {
this._leave(null, this)
}
}
if ($(this.tip).hasClass(CLASS_NAME_FADE)) {
const transitionDuration = Util.getTransitionDurationFromElement(this.tip)
$(this.tip)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
} else {
complete()
}
}
}
hide(callback) {
const tip = this.getTipElement()
const hideEvent = $.Event(this.constructor.Event.HIDE)
const complete = () => {
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip)
}
this._cleanTipClass()
this.element.removeAttribute('aria-describedby')
$(this.element).trigger(this.constructor.Event.HIDDEN)
if (this._popper !== null) {
this._popper.destroy()
}
if (callback) {
callback()
}
}
$(this.element).trigger(hideEvent)
if (hideEvent.isDefaultPrevented()) {
return
}
$(tip).removeClass(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) {
$(document.body).children().off('mouseover', null, $.noop)
}
this._activeTrigger[TRIGGER_CLICK] = false
this._activeTrigger[TRIGGER_FOCUS] = false
this._activeTrigger[TRIGGER_HOVER] = false
if ($(this.tip).hasClass(CLASS_NAME_FADE)) {
const transitionDuration = Util.getTransitionDurationFromElement(tip)
$(tip)
.one(Util.TRANSITION_END, complete)
.emulateTransitionEnd(transitionDuration)
} else {
complete()
}
this._hoverState = ''
}
update() {
if (this._popper !== null) {
this._popper.scheduleUpdate()
}
}
// Protected
isWithContent() {
return Boolean(this.getTitle())
}
addAttachmentClass(attachment) {
$(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)
}
getTipElement() {
this.tip = this.tip || $(this.config.template)[0]
return this.tip
}
setContent() {
const tip = this.getTipElement()
this.setElementContent($(tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle())
$(tip).removeClass(`${CLASS_NAME_FADE} ${CLASS_NAME_SHOW}`)
}
setElementContent($element, content) {
if (typeof content === 'object' && (content.nodeType || content.jquery)) {
// Content is a DOM node or a jQuery
if (this.config.html) {
if (!$(content).parent().is($element)) {
$element.empty().append(content)
}
} else {
$element.text($(content).text())
}
return
}
if (this.config.html) {
if (this.config.sanitize) {
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn)
}
$element.html(content)
} else {
$element.text(content)
}
}
getTitle() {
let title = this.element.getAttribute('data-original-title')
if (!title) {
title = typeof this.config.title === 'function'
? this.config.title.call(this.element)
: this.config.title
}
return title
}
// Private
_getPopperConfig(attachment) {
const defaultBsConfig = {
placement: attachment,
modifiers: {
offset: this._getOffset(),
flip: {
behavior: this.config.fallbackPlacement
},
arrow: {
element: SELECTOR_ARROW
},
preventOverflow: {
boundariesElement: this.config.boundary
}
},
onCreate: (data) => {
if (data.originalPlacement !== data.placement) {
this._handlePopperPlacementChange(data)
}
},
onUpdate: (data) => this._handlePopperPlacementChange(data)
}
return {
...defaultBsConfig,
...this.config.popperConfig
}
}
_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() {
if (this.config.container === false) {
return document.body
}
if (Util.isElement(this.config.container)) {
return $(this.config.container)
}
return $(document).find(this.config.container)
}
_getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()]
}
_setListeners() {
const triggers = this.config.trigger.split(' ')
triggers.forEach((trigger) => {
if (trigger === 'click') {
$(this.element).on(
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
$(this.element)
.on(eventIn, this.config.selector, (event) => this._enter(event))
.on(eventOut, this.config.selector, (event) => this._leave(event))
}
})
this._hideModalHandler = () => {
if (this.element) {
this.hide()
}
}
$(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler)
if (this.config.selector) {
this.config = {
...this.config,
trigger: 'manual',
selector: ''
}
} else {
this._fixTitle()
}
}
_fixTitle() {
const titleType = typeof this.element.getAttribute('data-original-title')
if (this.element.getAttribute('title') || titleType !== 'string') {
this.element.setAttribute(
'data-original-title',
this.element.getAttribute('title') || ''
)
this.element.setAttribute('title', '')
}
}
_enter(event, context) {
const dataKey = this.constructor.DATA_KEY
context = context || $(event.currentTarget).data(dataKey)
if (!context) {
context = new this.constructor(
event.currentTarget,
this._getDelegateConfig()
)
$(event.currentTarget).data(dataKey, context)
}
if (event) {
context._activeTrigger[
event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER
] = true
}
if ($(context.getTipElement()).hasClass(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 || $(event.currentTarget).data(dataKey)
if (!context) {
context = new this.constructor(
event.currentTarget,
this._getDelegateConfig()
)
$(event.currentTarget).data(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 = $(this.element).data()
Object.keys(dataAttributes)
.forEach((dataAttr) => {
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
delete dataAttributes[dataAttr]
}
})
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()
}
Util.typeCheckConfig(
NAME,
config,
this.constructor.DefaultType
)
if (config.sanitize) {
config.template = sanitizeHtml(config.template, config.whiteList, 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.attr('class').match(BSCLS_PREFIX_REGEX)
if (tabClass !== null && tabClass.length) {
$tip.removeClass(tabClass.join(''))
}
}
_handlePopperPlacementChange(popperData) {
this.tip = popperData.instance.popper
this._cleanTipClass()
this.addAttachmentClass(this._getAttachment(popperData.placement))
}
_fixTransition() {
const tip = this.getTipElement()
const initConfigAnimation = this.config.animation
if (tip.getAttribute('x-placement') !== null) {
return
}
$(tip).removeClass(CLASS_NAME_FADE)
this.config.animation = false
this.hide()
this.show()
this.config.animation = initConfigAnimation
}
// Static
static _jQueryInterface(config) {
return this.each(function () {
let data = $(this).data(DATA_KEY)
const _config = typeof config === 'object' && config
if (!data && /dispose|hide/.test(config)) {
return
}
if (!data) {
data = new Tooltip(this, _config)
$(this).data(DATA_KEY, data)
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tooltip._jQueryInterface
$.fn[NAME].Constructor = Tooltip
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return Tooltip._jQueryInterface
}
export default Tooltip
+198
View File
@@ -0,0 +1,198 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.5.0): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import $ from 'jquery'
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
const TRANSITION_END = 'transitionend'
const MAX_UID = 1000000
const MILLISECONDS_MULTIPLIER = 1000
// Shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
if (obj === null || typeof obj === 'undefined') {
return `${obj}`
}
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase()
}
function getSpecialTransitionEndEvent() {
return {
bindType: TRANSITION_END,
delegateType: TRANSITION_END,
handle(event) {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params
}
return undefined
}
}
}
function transitionEndEmulator(duration) {
let called = false
$(this).one(Util.TRANSITION_END, () => {
called = true
})
setTimeout(() => {
if (!called) {
Util.triggerTransitionEnd(this)
}
}, duration)
return this
}
function setTransitionEndSupport() {
$.fn.emulateTransitionEnd = transitionEndEmulator
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
const Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix))
return prefix
},
getSelectorFromElement(element) {
let selector = element.getAttribute('data-target')
if (!selector || selector === '#') {
const hrefAttr = element.getAttribute('href')
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''
}
try {
return document.querySelector(selector) ? selector : null
} catch (err) {
return null
}
},
getTransitionDurationFromElement(element) {
if (!element) {
return 0
}
// Get transition-duration of the element
let transitionDuration = $(element).css('transition-duration')
let transitionDelay = $(element).css('transition-delay')
const floatTransitionDuration = parseFloat(transitionDuration)
const floatTransitionDelay = 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 (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER
},
reflow(element) {
return element.offsetHeight
},
triggerTransitionEnd(element) {
$(element).trigger(TRANSITION_END)
},
// TODO: Remove in v5
supportsTransitionEnd() {
return Boolean(TRANSITION_END)
},
isElement(obj) {
return (obj[0] || obj).nodeType
},
typeCheckConfig(componentName, config, configTypes) {
for (const property in configTypes) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
const expectedTypes = configTypes[property]
const value = config[property]
const valueType = value && Util.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}".`)
}
}
}
},
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 Util.findShadowRoot(element.parentNode)
},
jQueryDetection() {
if (typeof $ === 'undefined') {
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
}
const version = $.fn.jquery.split(' ')[0].split('.')
const minMajor = 1
const ltMajor = 2
const minMinor = 9
const minPatch = 1
const maxMajor = 4
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
}
}
}
Util.jQueryDetection()
setTransitionEndSupport()
export default Util
-193
View File
@@ -1,193 +0,0 @@
"use strict";
define(["exports", "jquery"], function (exports, _jquery) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.button';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var ClassName = {
ACTIVE: 'active',
BUTTON: 'btn',
FOCUS: 'focus'
};
var Selector = {
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
DATA_TOGGLE: '[data-toggle="buttons"]',
INPUT: 'input:not([type="hidden"])',
ACTIVE: '.active',
BUTTON: '.btn'
};
var Event = {
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY),
FOCUS_BLUR_DATA_API: "focus".concat(EVENT_KEY).concat(DATA_API_KEY, " ") + "blur".concat(EVENT_KEY).concat(DATA_API_KEY)
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Button = function () {
function Button(element) {
_classCallCheck(this, Button);
this._element = element;
} // Getters
_createClass(Button, [{
key: "toggle",
value: function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = (0, _jquery2.default)(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
var input = this._element.querySelector(Selector.INPUT);
if (input) {
if (input.type === 'radio') {
if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = rootElement.querySelector(Selector.ACTIVE);
if (activeElement) {
(0, _jquery2.default)(activeElement).removeClass(ClassName.ACTIVE);
}
}
}
if (triggerChangeEvent) {
if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
return;
}
input.checked = !this._element.classList.contains(ClassName.ACTIVE);
(0, _jquery2.default)(input).trigger('change');
}
input.focus();
addAriaPressed = false;
}
}
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE));
}
if (triggerChangeEvent) {
(0, _jquery2.default)(this._element).toggleClass(ClassName.ACTIVE);
}
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
this._element = null;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
if (!data) {
data = new Button(this);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (config === 'toggle') {
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Button;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault();
var button = event.target;
if (!(0, _jquery2.default)(button).hasClass(ClassName.BUTTON)) {
button = (0, _jquery2.default)(button).closest(Selector.BUTTON);
}
Button._jQueryInterface.call((0, _jquery2.default)(button), 'toggle');
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
var button = (0, _jquery2.default)(event.target).closest(Selector.BUTTON)[0];
(0, _jquery2.default)(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Button._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Button;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Button._jQueryInterface;
};
exports.default = Button;
});
-712
View File
@@ -1,712 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
var SWIPE_THRESHOLD = 40;
var Default = {
interval: 5000,
keyboard: true,
slide: false,
pause: 'hover',
wrap: true,
touch: true
};
var DefaultType = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
pause: '(string|boolean)',
wrap: 'boolean',
touch: 'boolean'
};
var Direction = {
NEXT: 'next',
PREV: 'prev',
LEFT: 'left',
RIGHT: 'right'
};
var Event = {
SLIDE: "slide".concat(EVENT_KEY),
SLID: "slid".concat(EVENT_KEY),
KEYDOWN: "keydown".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY),
TOUCHSTART: "touchstart".concat(EVENT_KEY),
TOUCHMOVE: "touchmove".concat(EVENT_KEY),
TOUCHEND: "touchend".concat(EVENT_KEY),
POINTERDOWN: "pointerdown".concat(EVENT_KEY),
POINTERUP: "pointerup".concat(EVENT_KEY),
DRAG_START: "dragstart".concat(EVENT_KEY),
LOAD_DATA_API: "load".concat(EVENT_KEY).concat(DATA_API_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
CAROUSEL: 'carousel',
ACTIVE: 'active',
SLIDE: 'slide',
RIGHT: 'carousel-item-right',
LEFT: 'carousel-item-left',
NEXT: 'carousel-item-next',
PREV: 'carousel-item-prev',
ITEM: 'carousel-item',
POINTER_EVENT: 'pointer-event'
};
var Selector = {
ACTIVE: '.active',
ACTIVE_ITEM: '.active.carousel-item',
ITEM: '.carousel-item',
ITEM_IMG: '.carousel-item img',
NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
INDICATORS: '.carousel-indicators',
DATA_SLIDE: '[data-slide], [data-slide-to]',
DATA_RIDE: '[data-ride="carousel"]'
};
var PointerType = {
TOUCH: 'touch',
PEN: 'pen'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Carousel = function () {
function Carousel(element, config) {
_classCallCheck(this, Carousel);
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._element = element;
this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
this._addEventListeners();
} // Getters
_createClass(Carousel, [{
key: "next",
value: function next() {
if (!this._isSliding) {
this._slide(Direction.NEXT);
}
}
}, {
key: "nextWhenVisible",
value: function nextWhenVisible() {
// Don't call next when the page isn't visible
// or the carousel or its parent isn't visible
if (!document.hidden && (0, _jquery2.default)(this._element).is(':visible') && (0, _jquery2.default)(this._element).css('visibility') !== 'hidden') {
this.next();
}
}
}, {
key: "prev",
value: function prev() {
if (!this._isSliding) {
this._slide(Direction.PREV);
}
}
}, {
key: "pause",
value: function pause(event) {
if (!event) {
this._isPaused = true;
}
if (this._element.querySelector(Selector.NEXT_PREV)) {
_util2.default.triggerTransitionEnd(this._element);
this.cycle(true);
}
clearInterval(this._interval);
this._interval = null;
}
}, {
key: "cycle",
value: function cycle(event) {
if (!event) {
this._isPaused = false;
}
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
if (this._config.interval && !this._isPaused) {
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
}
}
}, {
key: "to",
value: function to(index) {
var _this = this;
this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeIndex = this._getItemIndex(this._activeElement);
if (index > this._items.length - 1 || index < 0) {
return;
}
if (this._isSliding) {
(0, _jquery2.default)(this._element).one(Event.SLID, function () {
return _this.to(index);
});
return;
}
if (activeIndex === index) {
this.pause();
this.cycle();
return;
}
var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
this._slide(direction, this._items[index]);
}
}, {
key: "dispose",
value: function dispose() {
(0, _jquery2.default)(this._element).off(EVENT_KEY);
_jquery2.default.removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, Default, config);
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_handleSwipe",
value: function _handleSwipe() {
var absDeltax = Math.abs(this.touchDeltaX);
if (absDeltax <= SWIPE_THRESHOLD) {
return;
}
var direction = absDeltax / this.touchDeltaX; // swipe left
if (direction > 0) {
this.prev();
} // swipe right
if (direction < 0) {
this.next();
}
}
}, {
key: "_addEventListeners",
value: function _addEventListeners() {
var _this2 = this;
if (this._config.keyboard) {
(0, _jquery2.default)(this._element).on(Event.KEYDOWN, function (event) {
return _this2._keydown(event);
});
}
if (this._config.pause === 'hover') {
(0, _jquery2.default)(this._element).on(Event.MOUSEENTER, function (event) {
return _this2.pause(event);
}).on(Event.MOUSELEAVE, function (event) {
return _this2.cycle(event);
});
}
if (this._config.touch) {
this._addTouchEventListeners();
}
}
}, {
key: "_addTouchEventListeners",
value: function _addTouchEventListeners() {
var _this3 = this;
if (!this._touchSupported) {
return;
}
var start = function start(event) {
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
_this3.touchStartX = event.originalEvent.clientX;
} else if (!_this3._pointerEvent) {
_this3.touchStartX = event.originalEvent.touches[0].clientX;
}
};
var move = function move(event) {
// ensure swiping with one touch and not pinching
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
_this3.touchDeltaX = 0;
} else {
_this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
}
};
var end = function end(event) {
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
_this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
}
_this3._handleSwipe();
if (_this3._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
_this3.pause();
if (_this3.touchTimeout) {
clearTimeout(_this3.touchTimeout);
}
_this3.touchTimeout = setTimeout(function (event) {
return _this3.cycle(event);
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
}
};
(0, _jquery2.default)(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
return e.preventDefault();
});
if (this._pointerEvent) {
(0, _jquery2.default)(this._element).on(Event.POINTERDOWN, function (event) {
return start(event);
});
(0, _jquery2.default)(this._element).on(Event.POINTERUP, function (event) {
return end(event);
});
this._element.classList.add(ClassName.POINTER_EVENT);
} else {
(0, _jquery2.default)(this._element).on(Event.TOUCHSTART, function (event) {
return start(event);
});
(0, _jquery2.default)(this._element).on(Event.TOUCHMOVE, function (event) {
return move(event);
});
(0, _jquery2.default)(this._element).on(Event.TOUCHEND, function (event) {
return end(event);
});
}
}
}, {
key: "_keydown",
value: function _keydown(event) {
if (/input|textarea/i.test(event.target.tagName)) {
return;
}
switch (event.which) {
case ARROW_LEFT_KEYCODE:
event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEYCODE:
event.preventDefault();
this.next();
break;
default:
}
}
}, {
key: "_getItemIndex",
value: function _getItemIndex(element) {
this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
return this._items.indexOf(element);
}
}, {
key: "_getItemByDirection",
value: function _getItemByDirection(direction, activeElement) {
var isNextDirection = direction === Direction.NEXT;
var isPrevDirection = direction === Direction.PREV;
var activeIndex = this._getItemIndex(activeElement);
var lastItemIndex = this._items.length - 1;
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
if (isGoingToWrap && !this._config.wrap) {
return activeElement;
}
var delta = direction === Direction.PREV ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
}
}, {
key: "_triggerSlideEvent",
value: function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
var slideEvent = _jquery2.default.Event(Event.SLIDE, {
relatedTarget: relatedTarget,
direction: eventDirectionName,
from: fromIndex,
to: targetIndex
});
(0, _jquery2.default)(this._element).trigger(slideEvent);
return slideEvent;
}
}, {
key: "_setActiveIndicatorElement",
value: function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
(0, _jquery2.default)(indicators).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
(0, _jquery2.default)(nextIndicator).addClass(ClassName.ACTIVE);
}
}
}
}, {
key: "_slide",
value: function _slide(direction, element) {
var _this4 = this;
var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
var activeElementIndex = this._getItemIndex(activeElement);
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
var nextElementIndex = this._getItemIndex(nextElement);
var isCycling = Boolean(this._interval);
var directionalClassName;
var orderClassName;
var eventDirectionName;
if (direction === Direction.NEXT) {
directionalClassName = ClassName.LEFT;
orderClassName = ClassName.NEXT;
eventDirectionName = Direction.LEFT;
} else {
directionalClassName = ClassName.RIGHT;
orderClassName = ClassName.PREV;
eventDirectionName = Direction.RIGHT;
}
if (nextElement && (0, _jquery2.default)(nextElement).hasClass(ClassName.ACTIVE)) {
this._isSliding = false;
return;
}
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
if (slideEvent.isDefaultPrevented()) {
return;
}
if (!activeElement || !nextElement) {
// Some weirdness is happening, so we bail
return;
}
this._isSliding = true;
if (isCycling) {
this.pause();
}
this._setActiveIndicatorElement(nextElement);
var slidEvent = _jquery2.default.Event(Event.SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex
});
if ((0, _jquery2.default)(this._element).hasClass(ClassName.SLIDE)) {
(0, _jquery2.default)(nextElement).addClass(orderClassName);
_util2.default.reflow(nextElement);
(0, _jquery2.default)(activeElement).addClass(directionalClassName);
(0, _jquery2.default)(nextElement).addClass(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 = _util2.default.getTransitionDurationFromElement(activeElement);
(0, _jquery2.default)(activeElement).one(_util2.default.TRANSITION_END, function () {
(0, _jquery2.default)(nextElement).removeClass("".concat(directionalClassName, " ").concat(orderClassName)).addClass(ClassName.ACTIVE);
(0, _jquery2.default)(activeElement).removeClass("".concat(ClassName.ACTIVE, " ").concat(orderClassName, " ").concat(directionalClassName));
_this4._isSliding = false;
setTimeout(function () {
return (0, _jquery2.default)(_this4._element).trigger(slidEvent);
}, 0);
}).emulateTransitionEnd(transitionDuration);
} else {
(0, _jquery2.default)(activeElement).removeClass(ClassName.ACTIVE);
(0, _jquery2.default)(nextElement).addClass(ClassName.ACTIVE);
this._isSliding = false;
(0, _jquery2.default)(this._element).trigger(slidEvent);
}
if (isCycling) {
this.cycle();
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _objectSpread({}, Default, (0, _jquery2.default)(this).data());
if (_typeof(config) === 'object') {
_config = _objectSpread({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
if (!data) {
data = new Carousel(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'number') {
data.to(config);
} else if (typeof action === 'string') {
if (typeof data[action] === 'undefined') {
throw new TypeError("No method named \"".concat(action, "\""));
}
data[action]();
} else if (_config.interval && _config.ride) {
data.pause();
data.cycle();
}
});
}
}, {
key: "_dataApiClickHandler",
value: function _dataApiClickHandler(event) {
var selector = _util2.default.getSelectorFromElement(this);
if (!selector) {
return;
}
var target = (0, _jquery2.default)(selector)[0];
if (!target || !(0, _jquery2.default)(target).hasClass(ClassName.CAROUSEL)) {
return;
}
var config = _objectSpread({}, (0, _jquery2.default)(target).data(), (0, _jquery2.default)(this).data());
var slideIndex = this.getAttribute('data-slide-to');
if (slideIndex) {
config.interval = false;
}
Carousel._jQueryInterface.call((0, _jquery2.default)(target), config);
if (slideIndex) {
(0, _jquery2.default)(target).data(DATA_KEY).to(slideIndex);
}
event.preventDefault();
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Carousel;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
(0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
for (var i = 0, len = carousels.length; i < len; i++) {
var $carousel = (0, _jquery2.default)(carousels[i]);
Carousel._jQueryInterface.call($carousel, $carousel.data());
}
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Carousel._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Carousel;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel._jQueryInterface;
};
exports.default = Carousel;
});
-471
View File
@@ -1,471 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var Default = {
toggle: true,
parent: ''
};
var DefaultType = {
toggle: 'boolean',
parent: '(string|element)'
};
var Event = {
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
SHOW: 'show',
COLLAPSE: 'collapse',
COLLAPSING: 'collapsing',
COLLAPSED: 'collapsed'
};
var Dimension = {
WIDTH: 'width',
HEIGHT: 'height'
};
var Selector = {
ACTIVES: '.show, .collapsing',
DATA_TOGGLE: '[data-toggle="collapse"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Collapse = function () {
function Collapse(element, config) {
_classCallCheck(this, Collapse);
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#".concat(element.id, "\"],") + "[data-toggle=\"collapse\"][data-target=\"#".concat(element.id, "\"]")));
var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = toggleList[i];
var selector = _util2.default.getSelectorFromElement(elem);
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
return foundElem === element;
});
if (selector !== null && filterElement.length > 0) {
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
_createClass(Collapse, [{
key: "toggle",
value: function toggle() {
if ((0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
this.hide();
} else {
this.show();
}
}
}, {
key: "show",
value: function show() {
var _this = this;
if (this._isTransitioning || (0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
return;
}
var actives;
var activesData;
if (this._parent) {
actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
if (typeof _this._config.parent === 'string') {
return elem.getAttribute('data-parent') === _this._config.parent;
}
return elem.classList.contains(ClassName.COLLAPSE);
});
if (actives.length === 0) {
actives = null;
}
}
if (actives) {
activesData = (0, _jquery2.default)(actives).not(this._selector).data(DATA_KEY);
if (activesData && activesData._isTransitioning) {
return;
}
}
var startEvent = _jquery2.default.Event(Event.SHOW);
(0, _jquery2.default)(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
if (actives) {
Collapse._jQueryInterface.call((0, _jquery2.default)(actives).not(this._selector), 'hide');
if (!activesData) {
(0, _jquery2.default)(actives).data(DATA_KEY, null);
}
}
var dimension = this._getDimension();
(0, _jquery2.default)(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0;
if (this._triggerArray.length) {
(0, _jquery2.default)(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
}
this.setTransitioning(true);
var complete = function complete() {
(0, _jquery2.default)(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
_this._element.style[dimension] = '';
_this.setTransitioning(false);
(0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
};
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = "scroll".concat(capitalizedDimension);
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._element);
(0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
this._element.style[dimension] = "".concat(this._element[scrollSize], "px");
}
}, {
key: "hide",
value: function hide() {
var _this2 = this;
if (this._isTransitioning || !(0, _jquery2.default)(this._element).hasClass(ClassName.SHOW)) {
return;
}
var startEvent = _jquery2.default.Event(Event.HIDE);
(0, _jquery2.default)(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
var dimension = this._getDimension();
this._element.style[dimension] = "".concat(this._element.getBoundingClientRect()[dimension], "px");
_util2.default.reflow(this._element);
(0, _jquery2.default)(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
var triggerArrayLength = this._triggerArray.length;
if (triggerArrayLength > 0) {
for (var i = 0; i < triggerArrayLength; i++) {
var trigger = this._triggerArray[i];
var selector = _util2.default.getSelectorFromElement(trigger);
if (selector !== null) {
var $elem = (0, _jquery2.default)([].slice.call(document.querySelectorAll(selector)));
if (!$elem.hasClass(ClassName.SHOW)) {
(0, _jquery2.default)(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
}
}
}
}
this.setTransitioning(true);
var complete = function complete() {
_this2.setTransitioning(false);
(0, _jquery2.default)(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
};
this._element.style[dimension] = '';
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._element);
(0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
}
}, {
key: "setTransitioning",
value: function setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
this._config = null;
this._parent = null;
this._element = null;
this._triggerArray = null;
this._isTransitioning = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, Default, config);
config.toggle = Boolean(config.toggle); // Coerce string values
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_getDimension",
value: function _getDimension() {
var hasWidth = (0, _jquery2.default)(this._element).hasClass(Dimension.WIDTH);
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
}
}, {
key: "_getParent",
value: function _getParent() {
var _this3 = this;
var parent;
if (_util2.default.isElement(this._config.parent)) {
parent = this._config.parent; // It's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined') {
parent = this._config.parent[0];
}
} else {
parent = document.querySelector(this._config.parent);
}
var selector = "[data-toggle=\"collapse\"][data-parent=\"".concat(this._config.parent, "\"]");
var children = [].slice.call(parent.querySelectorAll(selector));
(0, _jquery2.default)(children).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
});
return parent;
}
}, {
key: "_addAriaAndCollapsedClass",
value: function _addAriaAndCollapsedClass(element, triggerArray) {
var isOpen = (0, _jquery2.default)(element).hasClass(ClassName.SHOW);
if (triggerArray.length) {
(0, _jquery2.default)(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
}
}], [{
key: "_getTargetFromElement",
value: function _getTargetFromElement(element) {
var selector = _util2.default.getSelectorFromElement(element);
return selector ? document.querySelector(selector) : null;
}
}, {
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = (0, _jquery2.default)(this);
var data = $this.data(DATA_KEY);
var _config = _objectSpread({}, Default, $this.data(), _typeof(config) === 'object' && config ? config : {});
if (!data && _config.toggle && /show|hide/.test(config)) {
_config.toggle = false;
}
if (!data) {
data = new Collapse(this, _config);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Collapse;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(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.currentTarget.tagName === 'A') {
event.preventDefault();
}
var $trigger = (0, _jquery2.default)(this);
var selector = _util2.default.getSelectorFromElement(this);
var selectors = [].slice.call(document.querySelectorAll(selector));
(0, _jquery2.default)(selectors).each(function () {
var $target = (0, _jquery2.default)(this);
var data = $target.data(DATA_KEY);
var config = data ? 'toggle' : $trigger.data();
Collapse._jQueryInterface.call($target, config);
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Collapse._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Collapse;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse._jQueryInterface;
};
exports.default = Collapse;
});
-636
View File
@@ -1,636 +0,0 @@
"use strict";
define(["exports", "jquery", "core/popper", "./util"], function (exports, _jquery, _popper, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _popper2 = _interopRequireDefault(_popper);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.dropdown';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
var REGEXP_KEYDOWN = new RegExp("".concat(ARROW_UP_KEYCODE, "|").concat(ARROW_DOWN_KEYCODE, "|").concat(ESCAPE_KEYCODE));
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY),
KEYDOWN_DATA_API: "keydown".concat(EVENT_KEY).concat(DATA_API_KEY),
KEYUP_DATA_API: "keyup".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DISABLED: 'disabled',
SHOW: 'show',
DROPUP: 'dropup',
DROPRIGHT: 'dropright',
DROPLEFT: 'dropleft',
MENURIGHT: 'dropdown-menu-right',
MENULEFT: 'dropdown-menu-left',
POSITION_STATIC: 'position-static'
};
var Selector = {
DATA_TOGGLE: '[data-toggle="dropdown"]',
FORM_CHILD: '.dropdown form',
MENU: '.dropdown-menu',
NAVBAR_NAV: '.navbar-nav',
VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
};
var AttachmentMap = {
TOP: 'top-start',
TOPEND: 'top-end',
BOTTOM: 'bottom-start',
BOTTOMEND: 'bottom-end',
RIGHT: 'right-start',
RIGHTEND: 'right-end',
LEFT: 'left-start',
LEFTEND: 'left-end'
};
var Default = {
offset: 0,
flip: true,
boundary: 'scrollParent',
reference: 'toggle',
display: 'dynamic'
};
var DefaultType = {
offset: '(number|string|function)',
flip: 'boolean',
boundary: '(string|element)',
reference: '(string|element)',
display: 'string'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Dropdown = function () {
function Dropdown(element, config) {
_classCallCheck(this, Dropdown);
this._element = element;
this._popper = null;
this._config = this._getConfig(config);
this._menu = this._getMenuElement();
this._inNavbar = this._detectNavbar();
this._addEventListeners();
} // Getters
_createClass(Dropdown, [{
key: "toggle",
value: function toggle() {
if (this._element.disabled || (0, _jquery2.default)(this._element).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this._element);
var isActive = (0, _jquery2.default)(this._menu).hasClass(ClassName.SHOW);
Dropdown._clearMenus();
if (isActive) {
return;
}
var relatedTarget = {
relatedTarget: this._element
};
var showEvent = _jquery2.default.Event(Event.SHOW, relatedTarget);
(0, _jquery2.default)(parent).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return;
} // Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof _popper2.default === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
}
var referenceElement = this._element;
if (this._config.reference === 'parent') {
referenceElement = parent;
} else if (_util2.default.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];
}
} // 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') {
(0, _jquery2.default)(parent).addClass(ClassName.POSITION_STATIC);
}
this._popper = new _popper2.default(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 && (0, _jquery2.default)(parent).closest(Selector.NAVBAR_NAV).length === 0) {
(0, _jquery2.default)(document.body).children().on('mouseover', null, _jquery2.default.noop);
}
this._element.focus();
this._element.setAttribute('aria-expanded', true);
(0, _jquery2.default)(this._menu).toggleClass(ClassName.SHOW);
(0, _jquery2.default)(parent).toggleClass(ClassName.SHOW).trigger(_jquery2.default.Event(Event.SHOWN, relatedTarget));
}
}, {
key: "show",
value: function show() {
if (this._element.disabled || (0, _jquery2.default)(this._element).hasClass(ClassName.DISABLED) || (0, _jquery2.default)(this._menu).hasClass(ClassName.SHOW)) {
return;
}
var relatedTarget = {
relatedTarget: this._element
};
var showEvent = _jquery2.default.Event(Event.SHOW, relatedTarget);
var parent = Dropdown._getParentFromElement(this._element);
(0, _jquery2.default)(parent).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return;
}
(0, _jquery2.default)(this._menu).toggleClass(ClassName.SHOW);
(0, _jquery2.default)(parent).toggleClass(ClassName.SHOW).trigger(_jquery2.default.Event(Event.SHOWN, relatedTarget));
}
}, {
key: "hide",
value: function hide() {
if (this._element.disabled || (0, _jquery2.default)(this._element).hasClass(ClassName.DISABLED) || !(0, _jquery2.default)(this._menu).hasClass(ClassName.SHOW)) {
return;
}
var relatedTarget = {
relatedTarget: this._element
};
var hideEvent = _jquery2.default.Event(Event.HIDE, relatedTarget);
var parent = Dropdown._getParentFromElement(this._element);
(0, _jquery2.default)(parent).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
return;
}
(0, _jquery2.default)(this._menu).toggleClass(ClassName.SHOW);
(0, _jquery2.default)(parent).toggleClass(ClassName.SHOW).trigger(_jquery2.default.Event(Event.HIDDEN, relatedTarget));
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
(0, _jquery2.default)(this._element).off(EVENT_KEY);
this._element = null;
this._menu = null;
if (this._popper !== null) {
this._popper.destroy();
this._popper = null;
}
}
}, {
key: "update",
value: function update() {
this._inNavbar = this._detectNavbar();
if (this._popper !== null) {
this._popper.scheduleUpdate();
}
}
}, {
key: "_addEventListeners",
value: function _addEventListeners() {
var _this = this;
(0, _jquery2.default)(this._element).on(Event.CLICK, function (event) {
event.preventDefault();
event.stopPropagation();
_this.toggle();
});
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, this.constructor.Default, (0, _jquery2.default)(this._element).data(), config);
_util2.default.typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
}
}, {
key: "_getMenuElement",
value: function _getMenuElement() {
if (!this._menu) {
var parent = Dropdown._getParentFromElement(this._element);
if (parent) {
this._menu = parent.querySelector(Selector.MENU);
}
}
return this._menu;
}
}, {
key: "_getPlacement",
value: function _getPlacement() {
var $parentDropdown = (0, _jquery2.default)(this._element.parentNode);
var placement = AttachmentMap.BOTTOM; // Handle dropup
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
placement = AttachmentMap.TOP;
if ((0, _jquery2.default)(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.TOPEND;
}
} else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
placement = AttachmentMap.RIGHT;
} else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
placement = AttachmentMap.LEFT;
} else if ((0, _jquery2.default)(this._menu).hasClass(ClassName.MENURIGHT)) {
placement = AttachmentMap.BOTTOMEND;
}
return placement;
}
}, {
key: "_detectNavbar",
value: function _detectNavbar() {
return (0, _jquery2.default)(this._element).closest('.navbar').length > 0;
}
}, {
key: "_getOffset",
value: function _getOffset() {
var _this2 = this;
var offset = {};
if (typeof this._config.offset === 'function') {
offset.fn = function (data) {
data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
return data;
};
} else {
offset.offset = this._config.offset;
}
return offset;
}
}, {
key: "_getPopperConfig",
value: function _getPopperConfig() {
var popperConfig = {
placement: this._getPlacement(),
modifiers: {
offset: this._getOffset(),
flip: {
enabled: this._config.flip
},
preventOverflow: {
boundariesElement: this._config.boundary
}
} // Disable Popper.js if we have a static display
};
if (this._config.display === 'static') {
popperConfig.modifiers.applyStyle = {
enabled: false
};
}
return popperConfig;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' ? config : null;
if (!data) {
data = new Dropdown(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "_clearMenus",
value: function _clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return;
}
var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown._getParentFromElement(toggles[i]);
var context = (0, _jquery2.default)(toggles[i]).data(DATA_KEY);
var relatedTarget = {
relatedTarget: toggles[i]
};
if (event && event.type === 'click') {
relatedTarget.clickEvent = event;
}
if (!context) {
continue;
}
var dropdownMenu = context._menu;
if (!(0, _jquery2.default)(parent).hasClass(ClassName.SHOW)) {
continue;
}
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && _jquery2.default.contains(parent, event.target)) {
continue;
}
var hideEvent = _jquery2.default.Event(Event.HIDE, relatedTarget);
(0, _jquery2.default)(parent).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
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) {
(0, _jquery2.default)(document.body).children().off('mouseover', null, _jquery2.default.noop);
}
toggles[i].setAttribute('aria-expanded', 'false');
(0, _jquery2.default)(dropdownMenu).removeClass(ClassName.SHOW);
(0, _jquery2.default)(parent).removeClass(ClassName.SHOW).trigger(_jquery2.default.Event(Event.HIDDEN, relatedTarget));
}
}
}, {
key: "_getParentFromElement",
value: function _getParentFromElement(element) {
var parent;
var selector = _util2.default.getSelectorFromElement(element);
if (selector) {
parent = document.querySelector(selector);
}
return parent || element.parentNode;
}
}, {
key: "_dataApiKeydownHandler",
value: function _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.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || (0, _jquery2.default)(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
return;
}
event.preventDefault();
event.stopPropagation();
if (this.disabled || (0, _jquery2.default)(this).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this);
var isActive = (0, _jquery2.default)(parent).hasClass(ClassName.SHOW);
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) {
var toggle = parent.querySelector(Selector.DATA_TOGGLE);
(0, _jquery2.default)(toggle).trigger('focus');
}
(0, _jquery2.default)(this).trigger('click');
return;
}
var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS));
if (items.length === 0) {
return;
}
var index = items.indexOf(event.target);
if (event.which === ARROW_UP_KEYCODE && index > 0) {
// Up
index--;
}
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
// Down
index++;
}
if (index < 0) {
index = 0;
}
items[index].focus();
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Dropdown;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on("".concat(Event.CLICK_DATA_API, " ").concat(Event.KEYUP_DATA_API), Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
event.stopPropagation();
Dropdown._jQueryInterface.call((0, _jquery2.default)(this), 'toggle');
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
e.stopPropagation();
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Dropdown._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Dropdown;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown._jQueryInterface;
};
exports.default = Dropdown;
});
-79
View File
@@ -1,79 +0,0 @@
"use strict";
define(["exports", "jquery", "./alert", "./button", "./carousel", "./collapse", "./dropdown", "./modal", "./popover", "./scrollspy", "./tab", "./toast", "./tooltip", "./util"], function (exports, _jquery, _alert, _button, _carousel, _collapse, _dropdown, _modal, _popover, _scrollspy, _tab, _toast, _tooltip, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Tooltip = exports.Toast = exports.Tab = exports.Scrollspy = exports.Popover = exports.Modal = exports.Dropdown = exports.Collapse = exports.Carousel = exports.Button = exports.Alert = exports.Util = undefined;
var _jquery2 = _interopRequireDefault(_jquery);
var _alert2 = _interopRequireDefault(_alert);
var _button2 = _interopRequireDefault(_button);
var _carousel2 = _interopRequireDefault(_carousel);
var _collapse2 = _interopRequireDefault(_collapse);
var _dropdown2 = _interopRequireDefault(_dropdown);
var _modal2 = _interopRequireDefault(_modal);
var _popover2 = _interopRequireDefault(_popover);
var _scrollspy2 = _interopRequireDefault(_scrollspy);
var _tab2 = _interopRequireDefault(_tab);
var _toast2 = _interopRequireDefault(_toast);
var _tooltip2 = _interopRequireDefault(_tooltip);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
(function () {
if (typeof _jquery2.default === 'undefined') {
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
}
var version = _jquery2.default.fn.jquery.split(' ')[0].split('.');
var minMajor = 1;
var ltMajor = 2;
var minMinor = 9;
var minPatch = 1;
var maxMajor = 4;
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
}
})();
exports.Util = _util2.default;
exports.Alert = _alert2.default;
exports.Button = _button2.default;
exports.Carousel = _carousel2.default;
exports.Collapse = _collapse2.default;
exports.Dropdown = _dropdown2.default;
exports.Modal = _modal2.default;
exports.Popover = _popover2.default;
exports.Scrollspy = _scrollspy2.default;
exports.Tab = _tab2.default;
exports.Toast = _toast2.default;
exports.Tooltip = _tooltip2.default;
});
+70 -74
View File
@@ -23,91 +23,87 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9
*/
define(['jquery', './tether', 'core/event', 'core/custom_interaction_events'], function(jQuery, Tether, Event, customEvents) {
window.jQuery = jQuery;
window.Tether = Tether;
M.util.js_pending('theme_boost/loader:children');
import $ from 'jquery';
import Aria from './aria';
import Scroll from './scroll';
import Bootstrap from './bootstrap/index';
import CustomEvents from 'core/custom_interaction_events';
require(['theme_boost/aria',
'theme_boost/scroll',
'theme_boost/pending',
'theme_boost/util',
'theme_boost/alert',
'theme_boost/button',
'theme_boost/carousel',
'theme_boost/collapse',
'theme_boost/dropdown',
'theme_boost/modal',
'theme_boost/scrollspy',
'theme_boost/tab',
'theme_boost/tooltip',
'theme_boost/popover'],
function(Aria, MoodleScroll) {
/**
* Set up the search.
*
* @method init
*/
export {
init,
Bootstrap
};
// We do twice because: https://github.com/twbs/bootstrap/issues/10547
jQuery('body').popover({
trigger: 'focus',
selector: "[data-toggle=popover][data-trigger!=hover]",
placement: 'auto'
});
/**
* Bootstrap init function
*/
const init = () => {
rememberTabs();
// Popovers must close on Escape for accessibility reasons.
customEvents.define(jQuery('body'), [
customEvents.events.escape,
]);
jQuery('body').on(customEvents.events.escape, '[data-toggle=popover]', function() {
// Use "blur" instead of "popover('hide')" to prevent issue that the same tooltip can't be opened again.
jQuery(this).trigger('blur');
});
enablePopovers();
jQuery("html").popover({
container: "body",
selector: "[data-toggle=popover][data-trigger=hover]",
trigger: "hover",
delay: {
hide: 500
}
});
enableTooltips();
jQuery("html").tooltip({
selector: '[data-toggle="tooltip"]'
});
const scroll = new Scroll();
scroll.init();
// Disables flipping the dropdowns up and getting hidden behind the navbar.
jQuery.fn.dropdown.Constructor.Default.flip = false;
// Disables flipping the dropdowns up and getting hidden behind the navbar.
$.fn.dropdown.Constructor.Default.flip = false;
jQuery('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
var hash = jQuery(e.target).attr('href');
if (history.replaceState) {
history.replaceState(null, null, hash);
} else {
location.hash = hash;
}
});
Aria.init();
};
var hash = window.location.hash;
if (hash) {
jQuery('.nav-link[href="' + hash + '"]').tab('show');
/**
* Rember the last visited tabs.
*/
const rememberTabs = () => {
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
var hash = $(e.target).attr('href');
if (history.replaceState) {
history.replaceState(null, null, hash);
} else {
location.hash = hash;
}
});
var hash = window.location.hash;
if (hash) {
$('.nav-link[href="' + hash + '"]').tab('show');
}
};
// We need to call popover automatically if nodes are added to the page later.
Event.getLegacyEvents().done(function(events) {
jQuery(document).on(events.FILTER_CONTENT_UPDATED, function() {
jQuery('body').popover({
selector: '[data-toggle="popover"]',
trigger: 'focus'
});
});
});
Aria.init();
this.scroll = new MoodleScroll();
this.scroll.init();
M.util.js_complete('theme_boost/loader:children');
/**
* Enable all popovers
*
*/
const enablePopovers = () => {
$('body').popover({
selector: '[data-toggle="popover"]',
trigger: 'focus hover',
placement: 'auto'
});
CustomEvents.define($('body'), [
CustomEvents.events.escape,
]);
$('body').on(CustomEvents.events.escape, '[data-toggle=popover]', function() {
return {};
});
$(this).trigger('blur');
});
};
/**
* Enable tooltips
*
*/
const enableTooltips = () => {
$('body').tooltip({
container: 'body',
selector: '[data-toggle="tooltip"]'
});
};
-692
View File
@@ -1,692 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'modal';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.modal';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
RESIZE: "resize".concat(EVENT_KEY),
CLICK_DISMISS: "click.dismiss".concat(EVENT_KEY),
KEYDOWN_DISMISS: "keydown.dismiss".concat(EVENT_KEY),
MOUSEUP_DISMISS: "mouseup.dismiss".concat(EVENT_KEY),
MOUSEDOWN_DISMISS: "mousedown.dismiss".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
SCROLLABLE: 'modal-dialog-scrollable',
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
DIALOG: '.modal-dialog',
MODAL_BODY: '.modal-body',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
STICKY_CONTENT: '.sticky-top'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Modal = function () {
function Modal(element, config) {
_classCallCheck(this, Modal);
this._config = this._getConfig(config);
this._element = element;
this._dialog = element.querySelector(Selector.DIALOG);
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters
_createClass(Modal, [{
key: "toggle",
value: function toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
}, {
key: "show",
value: function show(relatedTarget) {
var _this = this;
if (this._isShown || this._isTransitioning) {
return;
}
if ((0, _jquery2.default)(this._element).hasClass(ClassName.FADE)) {
this._isTransitioning = true;
}
var showEvent = _jquery2.default.Event(Event.SHOW, {
relatedTarget: relatedTarget
});
(0, _jquery2.default)(this._element).trigger(showEvent);
if (this._isShown || showEvent.isDefaultPrevented()) {
return;
}
this._isShown = true;
this._checkScrollbar();
this._setScrollbar();
this._adjustDialog();
this._setEscapeEvent();
this._setResizeEvent();
(0, _jquery2.default)(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
return _this.hide(event);
});
(0, _jquery2.default)(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
(0, _jquery2.default)(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
if ((0, _jquery2.default)(event.target).is(_this._element)) {
_this._ignoreBackdropClick = true;
}
});
});
this._showBackdrop(function () {
return _this._showElement(relatedTarget);
});
}
}, {
key: "hide",
value: function hide(event) {
var _this2 = this;
if (event) {
event.preventDefault();
}
if (!this._isShown || this._isTransitioning) {
return;
}
var hideEvent = _jquery2.default.Event(Event.HIDE);
(0, _jquery2.default)(this._element).trigger(hideEvent);
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return;
}
this._isShown = false;
var transition = (0, _jquery2.default)(this._element).hasClass(ClassName.FADE);
if (transition) {
this._isTransitioning = true;
}
this._setEscapeEvent();
this._setResizeEvent();
(0, _jquery2.default)(document).off(Event.FOCUSIN);
(0, _jquery2.default)(this._element).removeClass(ClassName.SHOW);
(0, _jquery2.default)(this._element).off(Event.CLICK_DISMISS);
(0, _jquery2.default)(this._dialog).off(Event.MOUSEDOWN_DISMISS);
if (transition) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._element);
(0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, function (event) {
return _this2._hideModal(event);
}).emulateTransitionEnd(transitionDuration);
} else {
this._hideModal();
}
}
}, {
key: "dispose",
value: function dispose() {
[window, this._element, this._dialog].forEach(function (htmlElement) {
return (0, _jquery2.default)(htmlElement).off(EVENT_KEY);
});
/**
* `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
*/
(0, _jquery2.default)(document).off(Event.FOCUSIN);
_jquery2.default.removeData(this._element, DATA_KEY);
this._config = null;
this._element = null;
this._dialog = null;
this._backdrop = null;
this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null;
this._isTransitioning = null;
this._scrollbarWidth = null;
}
}, {
key: "handleUpdate",
value: function handleUpdate() {
this._adjustDialog();
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, Default, config);
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_showElement",
value: function _showElement(relatedTarget) {
var _this3 = this;
var transition = (0, _jquery2.default)(this._element).hasClass(ClassName.FADE);
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);
if ((0, _jquery2.default)(this._dialog).hasClass(ClassName.SCROLLABLE)) {
this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0;
} else {
this._element.scrollTop = 0;
}
if (transition) {
_util2.default.reflow(this._element);
}
(0, _jquery2.default)(this._element).addClass(ClassName.SHOW);
if (this._config.focus) {
this._enforceFocus();
}
var shownEvent = _jquery2.default.Event(Event.SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
if (_this3._config.focus) {
_this3._element.focus();
}
_this3._isTransitioning = false;
(0, _jquery2.default)(_this3._element).trigger(shownEvent);
};
if (transition) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._dialog);
(0, _jquery2.default)(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
} else {
transitionComplete();
}
}
}, {
key: "_enforceFocus",
value: function _enforceFocus() {
var _this4 = this;
(0, _jquery2.default)(document).off(Event.FOCUSIN) // Guard against infinite focus loop
.on(Event.FOCUSIN, function (event) {
if (document !== event.target && _this4._element !== event.target && (0, _jquery2.default)(_this4._element).has(event.target).length === 0) {
_this4._element.focus();
}
});
}
}, {
key: "_setEscapeEvent",
value: function _setEscapeEvent() {
var _this5 = this;
if (this._isShown && this._config.keyboard) {
(0, _jquery2.default)(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
if (event.which === ESCAPE_KEYCODE) {
event.preventDefault();
_this5.hide();
}
});
} else if (!this._isShown) {
(0, _jquery2.default)(this._element).off(Event.KEYDOWN_DISMISS);
}
}
}, {
key: "_setResizeEvent",
value: function _setResizeEvent() {
var _this6 = this;
if (this._isShown) {
(0, _jquery2.default)(window).on(Event.RESIZE, function (event) {
return _this6.handleUpdate(event);
});
} else {
(0, _jquery2.default)(window).off(Event.RESIZE);
}
}
}, {
key: "_hideModal",
value: function _hideModal() {
var _this7 = this;
this._element.style.display = 'none';
this._element.setAttribute('aria-hidden', true);
this._element.removeAttribute('aria-modal');
this._isTransitioning = false;
this._showBackdrop(function () {
(0, _jquery2.default)(document.body).removeClass(ClassName.OPEN);
_this7._resetAdjustments();
_this7._resetScrollbar();
(0, _jquery2.default)(_this7._element).trigger(Event.HIDDEN);
});
}
}, {
key: "_removeBackdrop",
value: function _removeBackdrop() {
if (this._backdrop) {
(0, _jquery2.default)(this._backdrop).remove();
this._backdrop = null;
}
}
}, {
key: "_showBackdrop",
value: function _showBackdrop(callback) {
var _this8 = this;
var animate = (0, _jquery2.default)(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
if (this._isShown && this._config.backdrop) {
this._backdrop = document.createElement('div');
this._backdrop.className = ClassName.BACKDROP;
if (animate) {
this._backdrop.classList.add(animate);
}
(0, _jquery2.default)(this._backdrop).appendTo(document.body);
(0, _jquery2.default)(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this8._ignoreBackdropClick) {
_this8._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (_this8._config.backdrop === 'static') {
_this8._element.focus();
} else {
_this8.hide();
}
});
if (animate) {
_util2.default.reflow(this._backdrop);
}
(0, _jquery2.default)(this._backdrop).addClass(ClassName.SHOW);
if (!callback) {
return;
}
if (!animate) {
callback();
return;
}
var backdropTransitionDuration = _util2.default.getTransitionDurationFromElement(this._backdrop);
(0, _jquery2.default)(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
(0, _jquery2.default)(this._backdrop).removeClass(ClassName.SHOW);
var callbackRemove = function callbackRemove() {
_this8._removeBackdrop();
if (callback) {
callback();
}
};
if ((0, _jquery2.default)(this._element).hasClass(ClassName.FADE)) {
var _backdropTransitionDuration = _util2.default.getTransitionDurationFromElement(this._backdrop);
(0, _jquery2.default)(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
} else {
callbackRemove();
}
} else if (callback) {
callback();
}
}
}, {
key: "_adjustDialog",
value: function _adjustDialog() {
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!this._isBodyOverflowing && isModalOverflowing) {
this._element.style.paddingLeft = "".concat(this._scrollbarWidth, "px");
}
if (this._isBodyOverflowing && !isModalOverflowing) {
this._element.style.paddingRight = "".concat(this._scrollbarWidth, "px");
}
}
}, {
key: "_resetAdjustments",
value: function _resetAdjustments() {
this._element.style.paddingLeft = '';
this._element.style.paddingRight = '';
}
}, {
key: "_checkScrollbar",
value: function _checkScrollbar() {
var rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
}, {
key: "_setScrollbar",
value: function _setScrollbar() {
var _this9 = this;
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
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)); // Adjust fixed content padding
(0, _jquery2.default)(fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = (0, _jquery2.default)(element).css('padding-right');
(0, _jquery2.default)(element).data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + _this9._scrollbarWidth, "px"));
}); // Adjust sticky content margin
(0, _jquery2.default)(stickyContent).each(function (index, element) {
var actualMargin = element.style.marginRight;
var calculatedMargin = (0, _jquery2.default)(element).css('margin-right');
(0, _jquery2.default)(element).data('margin-right', actualMargin).css('margin-right', "".concat(parseFloat(calculatedMargin) - _this9._scrollbarWidth, "px"));
}); // Adjust body padding
var actualPadding = document.body.style.paddingRight;
var calculatedPadding = (0, _jquery2.default)(document.body).css('padding-right');
(0, _jquery2.default)(document.body).data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + this._scrollbarWidth, "px"));
}
(0, _jquery2.default)(document.body).addClass(ClassName.OPEN);
}
}, {
key: "_resetScrollbar",
value: function _resetScrollbar() {
// Restore fixed content padding
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
(0, _jquery2.default)(fixedContent).each(function (index, element) {
var padding = (0, _jquery2.default)(element).data('padding-right');
(0, _jquery2.default)(element).removeData('padding-right');
element.style.paddingRight = padding ? padding : '';
}); // Restore sticky content
var elements = [].slice.call(document.querySelectorAll("".concat(Selector.STICKY_CONTENT)));
(0, _jquery2.default)(elements).each(function (index, element) {
var margin = (0, _jquery2.default)(element).data('margin-right');
if (typeof margin !== 'undefined') {
(0, _jquery2.default)(element).css('margin-right', margin).removeData('margin-right');
}
}); // Restore body padding
var padding = (0, _jquery2.default)(document.body).data('padding-right');
(0, _jquery2.default)(document.body).removeData('padding-right');
document.body.style.paddingRight = padding ? padding : '';
}
}, {
key: "_getScrollbarWidth",
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _objectSpread({}, Default, (0, _jquery2.default)(this).data(), _typeof(config) === 'object' && config ? config : {});
if (!data) {
data = new Modal(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Modal;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this10 = this;
var target;
var selector = _util2.default.getSelectorFromElement(this);
if (selector) {
target = document.querySelector(selector);
}
var config = (0, _jquery2.default)(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, (0, _jquery2.default)(target).data(), (0, _jquery2.default)(this).data());
if (this.tagName === 'A' || this.tagName === 'AREA') {
event.preventDefault();
}
var $target = (0, _jquery2.default)(target).one(Event.SHOW, function (showEvent) {
if (showEvent.isDefaultPrevented()) {
// Only register focus restorer if modal will actually get shown
return;
}
$target.one(Event.HIDDEN, function () {
if ((0, _jquery2.default)(_this10).is(':visible')) {
_this10.focus();
}
});
});
Modal._jQueryInterface.call((0, _jquery2.default)(target), config, this);
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Modal._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Modal;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal._jQueryInterface;
};
exports.default = Modal;
});
+25 -314
View File
@@ -1,317 +1,28 @@
"use strict";
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
define(["exports", "jquery", "./tooltip"], function (exports, _jquery, _tooltip) {
"use strict";
/**
* Backward compatibility file for the old popover.js
*
* @module theme_boost/popover
* @copyright 2020 Bas Brands <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
import Popover from './bootstrap/popover';
var _jquery2 = _interopRequireDefault(_jquery);
var _tooltip2 = _interopRequireDefault(_tooltip);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'popover';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.popover';
var EVENT_KEY = ".".concat(DATA_KEY);
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var CLASS_PREFIX = 'bs-popover';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g');
var Default = _objectSpread({}, _tooltip2.default.Default, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
});
var DefaultType = _objectSpread({}, _tooltip2.default.DefaultType, {
content: '(string|element|function)'
});
var ClassName = {
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
TITLE: '.popover-header',
CONTENT: '.popover-body'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
INSERTED: "inserted".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
FOCUSOUT: "focusout".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY)
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
return _possibleConstructorReturn(this, (Popover.__proto__ || Object.getPrototypeOf(Popover)).apply(this, arguments));
}
_createClass(Popover, [{
key: "isWithContent",
value: function isWithContent() {
return this.getTitle() || this._getContent();
}
}, {
key: "addAttachmentClass",
value: function addAttachmentClass(attachment) {
(0, _jquery2.default)(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment));
}
}, {
key: "getTipElement",
value: function getTipElement() {
this.tip = this.tip || (0, _jquery2.default)(this.config.template)[0];
return this.tip;
}
}, {
key: "setContent",
value: function setContent() {
var $tip = (0, _jquery2.default)(this.getTipElement()); // We use append for html objects to maintain js events
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
var content = this._getContent();
if (typeof content === 'function') {
content = content.call(this.element);
}
this.setElementContent($tip.find(Selector.CONTENT), content);
$tip.removeClass("".concat(ClassName.FADE, " ").concat(ClassName.SHOW));
}
}, {
key: "_getContent",
value: function _getContent() {
return this.element.getAttribute('data-content') || this.config.content;
}
}, {
key: "_cleanTipClass",
value: function _cleanTipClass() {
var $tip = (0, _jquery2.default)(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length > 0) {
$tip.removeClass(tabClass.join(''));
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' ? config : null;
if (!data && /dispose|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "NAME",
get: function get() {
return NAME;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}, {
key: "Event",
get: function get() {
return Event;
}
}, {
key: "EVENT_KEY",
get: function get() {
return EVENT_KEY;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Popover;
}(_tooltip2.default);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Popover._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Popover;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover._jQueryInterface;
};
exports.default = Popover;
});
export {
Popover
};
-131
View File
@@ -1,131 +0,0 @@
"use strict";
define(["exports"], function (exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.sanitizeHtml = sanitizeHtml;
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): tools/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
var DefaultWhitelist = exports.DefaultWhitelist = {
// 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', 'alt', 'title', 'width', 'height'],
li: [],
ol: [],
p: [],
pre: [],
s: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
u: [],
ul: []
/**
* 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
*/
};
var 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
*/
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase();
if (allowedAttributeList.indexOf(attrName) !== -1) {
if (uriAttrs.indexOf(attrName) !== -1) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
}
return true;
}
var regExp = allowedAttributeList.filter(function (attrRegex) {
return attrRegex instanceof RegExp;
}); // Check if a regular expression validates the attribute.
for (var i = 0, l = regExp.length; i < l; i++) {
if (attrName.match(regExp[i])) {
return true;
}
}
return false;
}
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
if (unsafeHtml.length === 0) {
return unsafeHtml;
}
if (sanitizeFn && typeof sanitizeFn === 'function') {
return sanitizeFn(unsafeHtml);
}
var domParser = new window.DOMParser();
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
var whitelistKeys = Object.keys(whiteList);
var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
var _loop = function _loop(i, len) {
var el = elements[i];
var elName = el.nodeName.toLowerCase();
if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
el.parentNode.removeChild(el);
return "continue";
}
var attributeList = [].slice.call(el.attributes);
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
attributeList.forEach(function (attr) {
if (!allowedAttribute(attr, whitelistedAttributes)) {
el.removeAttribute(attr.nodeName);
}
});
};
for (var i = 0, len = elements.length; i < len; i++) {
var _ret = _loop(i, len);
if (_ret === "continue") continue;
}
return createdDocument.body.innerHTML;
}
});
-404
View File
@@ -1,404 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'scrollspy';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var Default = {
offset: 10,
method: 'auto',
target: ''
};
var DefaultType = {
offset: 'number',
method: 'string',
target: '(string|element)'
};
var Event = {
ACTIVATE: "activate".concat(EVENT_KEY),
SCROLL: "scroll".concat(EVENT_KEY),
LOAD_DATA_API: "load".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DROPDOWN_ITEM: 'dropdown-item',
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active'
};
var Selector = {
DATA_SPY: '[data-spy="scroll"]',
ACTIVE: '.active',
NAV_LIST_GROUP: '.nav, .list-group',
NAV_LINKS: '.nav-link',
NAV_ITEMS: '.nav-item',
LIST_ITEMS: '.list-group-item',
DROPDOWN: '.dropdown',
DROPDOWN_ITEMS: '.dropdown-item',
DROPDOWN_TOGGLE: '.dropdown-toggle'
};
var OffsetMethod = {
OFFSET: 'offset',
POSITION: 'position'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var ScrollSpy = function () {
function ScrollSpy(element, config) {
var _this = this;
_classCallCheck(this, ScrollSpy);
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = "".concat(this._config.target, " ").concat(Selector.NAV_LINKS, ",") + "".concat(this._config.target, " ").concat(Selector.LIST_ITEMS, ",") + "".concat(this._config.target, " ").concat(Selector.DROPDOWN_ITEMS);
this._offsets = [];
this._targets = [];
this._activeTarget = null;
this._scrollHeight = 0;
(0, _jquery2.default)(this._scrollElement).on(Event.SCROLL, function (event) {
return _this._process(event);
});
this.refresh();
this._process();
} // Getters
_createClass(ScrollSpy, [{
key: "refresh",
value: function refresh() {
var _this2 = this;
var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
var targets = [].slice.call(document.querySelectorAll(this._selector));
targets.map(function (element) {
var target;
var targetSelector = _util2.default.getSelectorFromElement(element);
if (targetSelector) {
target = document.querySelector(targetSelector);
}
if (target) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
// TODO (fat): remove sketch reliance on jQuery position/offset
return [(0, _jquery2.default)(target)[offsetMethod]().top + offsetBase, targetSelector];
}
}
return null;
}).filter(function (item) {
return item;
}).sort(function (a, b) {
return a[0] - b[0];
}).forEach(function (item) {
_this2._offsets.push(item[0]);
_this2._targets.push(item[1]);
});
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
(0, _jquery2.default)(this._scrollElement).off(EVENT_KEY);
this._element = null;
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, Default, _typeof(config) === 'object' && config ? config : {});
if (typeof config.target !== 'string') {
var id = (0, _jquery2.default)(config.target).attr('id');
if (!id) {
id = _util2.default.getUID(NAME);
(0, _jquery2.default)(config.target).attr('id', id);
}
config.target = "#".concat(id);
}
_util2.default.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: "_getScrollTop",
value: function _getScrollTop() {
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
}
}, {
key: "_getScrollHeight",
value: function _getScrollHeight() {
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
}
}, {
key: "_getOffsetHeight",
value: function _getOffsetHeight() {
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
}
}, {
key: "_process",
value: function _process() {
var scrollTop = this._getScrollTop() + this._config.offset;
var scrollHeight = this._getScrollHeight();
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
if (this._scrollHeight !== scrollHeight) {
this.refresh();
}
if (scrollTop >= maxScroll) {
var 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;
}
var offsetLength = this._offsets.length;
for (var i = offsetLength; i--;) {
var 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]);
}
}
}
}, {
key: "_activate",
value: function _activate(target) {
this._activeTarget = target;
this._clear();
var queries = this._selector.split(',').map(function (selector) {
return "".concat(selector, "[data-target=\"").concat(target, "\"],").concat(selector, "[href=\"").concat(target, "\"]");
});
var $link = (0, _jquery2.default)([].slice.call(document.querySelectorAll(queries.join(','))));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
$link.addClass(ClassName.ACTIVE);
} else {
// Set triggered link as active
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
$link.parents(Selector.NAV_LIST_GROUP).prev("".concat(Selector.NAV_LINKS, ", ").concat(Selector.LIST_ITEMS)).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
}
(0, _jquery2.default)(this._scrollElement).trigger(Event.ACTIVATE, {
relatedTarget: target
});
}
}, {
key: "_clear",
value: function _clear() {
[].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
return node.classList.contains(ClassName.ACTIVE);
}).forEach(function (node) {
return node.classList.remove(ClassName.ACTIVE);
});
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' && config;
if (!data) {
data = new ScrollSpy(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return ScrollSpy;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
var scrollSpysLength = scrollSpys.length;
for (var i = scrollSpysLength; i--;) {
var $spy = (0, _jquery2.default)(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data());
}
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = ScrollSpy._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = ScrollSpy;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy._jQueryInterface;
};
exports.default = ScrollSpy;
});
-282
View File
@@ -1,282 +0,0 @@
"use strict";
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tab';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.tab';
var EVENT_KEY = ".".concat(DATA_KEY);
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
CLICK_DATA_API: "click".concat(EVENT_KEY).concat(DATA_API_KEY)
};
var ClassName = {
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active',
DISABLED: 'disabled',
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
DROPDOWN: '.dropdown',
NAV_LIST_GROUP: '.nav, .list-group',
ACTIVE: '.active',
ACTIVE_UL: '> li > .active',
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
DROPDOWN_TOGGLE: '.dropdown-toggle',
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tab = function () {
function Tab(element) {
_classCallCheck(this, Tab);
this._element = element;
} // Getters
_createClass(Tab, [{
key: "show",
value: function show() {
var _this = this;
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && (0, _jquery2.default)(this._element).hasClass(ClassName.ACTIVE) || (0, _jquery2.default)(this._element).hasClass(ClassName.DISABLED)) {
return;
}
var target;
var previous;
var listElement = (0, _jquery2.default)(this._element).closest(Selector.NAV_LIST_GROUP)[0];
var selector = _util2.default.getSelectorFromElement(this._element);
if (listElement) {
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
previous = _jquery2.default.makeArray((0, _jquery2.default)(listElement).find(itemSelector));
previous = previous[previous.length - 1];
}
var hideEvent = _jquery2.default.Event(Event.HIDE, {
relatedTarget: this._element
});
var showEvent = _jquery2.default.Event(Event.SHOW, {
relatedTarget: previous
});
if (previous) {
(0, _jquery2.default)(previous).trigger(hideEvent);
}
(0, _jquery2.default)(this._element).trigger(showEvent);
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
return;
}
if (selector) {
target = document.querySelector(selector);
}
this._activate(this._element, listElement);
var complete = function complete() {
var hiddenEvent = _jquery2.default.Event(Event.HIDDEN, {
relatedTarget: _this._element
});
var shownEvent = _jquery2.default.Event(Event.SHOWN, {
relatedTarget: previous
});
(0, _jquery2.default)(previous).trigger(hiddenEvent);
(0, _jquery2.default)(_this._element).trigger(shownEvent);
};
if (target) {
this._activate(target, target.parentNode, complete);
} else {
complete();
}
}
}, {
key: "dispose",
value: function dispose() {
_jquery2.default.removeData(this._element, DATA_KEY);
this._element = null;
}
}, {
key: "_activate",
value: function _activate(element, container, callback) {
var _this2 = this;
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? (0, _jquery2.default)(container).find(Selector.ACTIVE_UL) : (0, _jquery2.default)(container).children(Selector.ACTIVE);
var active = activeElements[0];
var isTransitioning = callback && active && (0, _jquery2.default)(active).hasClass(ClassName.FADE);
var complete = function complete() {
return _this2._transitionComplete(element, active, callback);
};
if (active && isTransitioning) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(active);
(0, _jquery2.default)(active).removeClass(ClassName.SHOW).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
} else {
complete();
}
}
}, {
key: "_transitionComplete",
value: function _transitionComplete(element, active, callback) {
if (active) {
(0, _jquery2.default)(active).removeClass(ClassName.ACTIVE);
var dropdownChild = (0, _jquery2.default)(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
if (dropdownChild) {
(0, _jquery2.default)(dropdownChild).removeClass(ClassName.ACTIVE);
}
if (active.getAttribute('role') === 'tab') {
active.setAttribute('aria-selected', false);
}
}
(0, _jquery2.default)(element).addClass(ClassName.ACTIVE);
if (element.getAttribute('role') === 'tab') {
element.setAttribute('aria-selected', true);
}
_util2.default.reflow(element);
if (element.classList.contains(ClassName.FADE)) {
element.classList.add(ClassName.SHOW);
}
if (element.parentNode && (0, _jquery2.default)(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
var dropdownElement = (0, _jquery2.default)(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) {
var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
(0, _jquery2.default)(dropdownToggleList).addClass(ClassName.ACTIVE);
}
element.setAttribute('aria-expanded', true);
}
if (callback) {
callback();
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = (0, _jquery2.default)(this);
var data = $this.data(DATA_KEY);
if (!data) {
data = new Tab(this);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return Tab;
}();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
(0, _jquery2.default)(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
Tab._jQueryInterface.call((0, _jquery2.default)(this), 'show');
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Tab._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Tab;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab._jQueryInterface;
};
exports.default = Tab;
});
File diff suppressed because it is too large Load Diff
+25 -309
View File
@@ -1,312 +1,28 @@
"use strict";
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
define(["exports", "jquery", "./util"], function (exports, _jquery, _util) {
"use strict";
/**
* Backward compatibility file for the old toast.js
*
* @module theme_boost/toast
* @copyright 2020 Bas Brands <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
import Toast from './bootstrap/toast';
var _jquery2 = _interopRequireDefault(_jquery);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'toast';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.toast';
var EVENT_KEY = ".".concat(DATA_KEY);
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var Event = {
CLICK_DISMISS: "click.dismiss".concat(EVENT_KEY),
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY)
};
var ClassName = {
FADE: 'fade',
HIDE: 'hide',
SHOW: 'show',
SHOWING: 'showing'
};
var DefaultType = {
animation: 'boolean',
autohide: 'boolean',
delay: 'number'
};
var Default = {
animation: true,
autohide: true,
delay: 500
};
var Selector = {
DATA_DISMISS: '[data-dismiss="toast"]'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Toast = function () {
function Toast(element, config) {
_classCallCheck(this, Toast);
this._element = element;
this._config = this._getConfig(config);
this._timeout = null;
this._setListeners();
} // Getters
_createClass(Toast, [{
key: "show",
value: function show() {
var _this = this;
(0, _jquery2.default)(this._element).trigger(Event.SHOW);
if (this._config.animation) {
this._element.classList.add(ClassName.FADE);
}
var complete = function complete() {
_this._element.classList.remove(ClassName.SHOWING);
_this._element.classList.add(ClassName.SHOW);
(0, _jquery2.default)(_this._element).trigger(Event.SHOWN);
if (_this._config.autohide) {
_this.hide();
}
};
this._element.classList.remove(ClassName.HIDE);
this._element.classList.add(ClassName.SHOWING);
if (this._config.animation) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._element);
(0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
} else {
complete();
}
}
}, {
key: "hide",
value: function hide(withoutTimeout) {
var _this2 = this;
if (!this._element.classList.contains(ClassName.SHOW)) {
return;
}
(0, _jquery2.default)(this._element).trigger(Event.HIDE);
if (withoutTimeout) {
this._close();
} else {
this._timeout = setTimeout(function () {
_this2._close();
}, this._config.delay);
}
}
}, {
key: "dispose",
value: function dispose() {
clearTimeout(this._timeout);
this._timeout = null;
if (this._element.classList.contains(ClassName.SHOW)) {
this._element.classList.remove(ClassName.SHOW);
}
(0, _jquery2.default)(this._element).off(Event.CLICK_DISMISS);
_jquery2.default.removeData(this._element, DATA_KEY);
this._element = null;
this._config = null;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
config = _objectSpread({}, Default, (0, _jquery2.default)(this._element).data(), _typeof(config) === 'object' && config ? config : {});
_util2.default.typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
}
}, {
key: "_setListeners",
value: function _setListeners() {
var _this3 = this;
(0, _jquery2.default)(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
return _this3.hide(true);
});
}
}, {
key: "_close",
value: function _close() {
var _this4 = this;
var complete = function complete() {
_this4._element.classList.add(ClassName.HIDE);
(0, _jquery2.default)(_this4._element).trigger(Event.HIDDEN);
};
this._element.classList.remove(ClassName.SHOW);
if (this._config.animation) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(this._element);
(0, _jquery2.default)(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
} else {
complete();
}
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = (0, _jquery2.default)(this);
var data = $element.data(DATA_KEY);
var _config = _typeof(config) === 'object' && config;
if (!data) {
data = new Toast(this, _config);
$element.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config](this);
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Toast;
}();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Toast._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Toast;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Toast._jQueryInterface;
};
exports.default = Toast;
});
export {
Toast
};
-839
View File
@@ -1,839 +0,0 @@
"use strict";
define(["exports", "./sanitizer", "jquery", "core/popper", "./util"], function (exports, _sanitizer, _jquery, _popper, _util) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
var _popper2 = _interopRequireDefault(_popper);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(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(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tooltip';
var VERSION = '4.3.1';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = ".".concat(DATA_KEY);
var JQUERY_NO_CONFLICT = _jquery2.default.fn[NAME];
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g');
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
var DefaultType = {
animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
delay: '(number|object)',
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
offset: '(number|string|function)',
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
whiteList: 'object'
};
var AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
RIGHT: 'right',
BOTTOM: 'bottom',
LEFT: 'left'
};
var Default = {
animation: true,
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
offset: 0,
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent',
sanitize: true,
sanitizeFn: null,
whiteList: _sanitizer.DefaultWhitelist
};
var HoverState = {
SHOW: 'show',
OUT: 'out'
};
var Event = {
HIDE: "hide".concat(EVENT_KEY),
HIDDEN: "hidden".concat(EVENT_KEY),
SHOW: "show".concat(EVENT_KEY),
SHOWN: "shown".concat(EVENT_KEY),
INSERTED: "inserted".concat(EVENT_KEY),
CLICK: "click".concat(EVENT_KEY),
FOCUSIN: "focusin".concat(EVENT_KEY),
FOCUSOUT: "focusout".concat(EVENT_KEY),
MOUSEENTER: "mouseenter".concat(EVENT_KEY),
MOUSELEAVE: "mouseleave".concat(EVENT_KEY)
};
var ClassName = {
FADE: 'fade',
SHOW: 'show'
};
var Selector = {
TOOLTIP: '.tooltip',
TOOLTIP_INNER: '.tooltip-inner',
ARROW: '.arrow'
};
var Trigger = {
HOVER: 'hover',
FOCUS: 'focus',
CLICK: 'click',
MANUAL: 'manual'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tooltip = function () {
function Tooltip(element, config) {
_classCallCheck(this, Tooltip);
/**
* Check for Popper dependency
* Popper - https://popper.js.org
*/
if (typeof _popper2.default === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
} // private
this._isEnabled = true;
this._timeout = 0;
this._hoverState = '';
this._activeTrigger = {};
this._popper = null; // Protected
this.element = element;
this.config = this._getConfig(config);
this.tip = null;
this._setListeners();
} // Getters
_createClass(Tooltip, [{
key: "enable",
value: function enable() {
this._isEnabled = true;
}
}, {
key: "disable",
value: function disable() {
this._isEnabled = false;
}
}, {
key: "toggleEnabled",
value: function toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
}, {
key: "toggle",
value: function toggle(event) {
if (!this._isEnabled) {
return;
}
if (event) {
var dataKey = this.constructor.DATA_KEY;
var context = (0, _jquery2.default)(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
(0, _jquery2.default)(event.currentTarget).data(dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click;
if (context._isWithActiveTrigger()) {
context._enter(null, context);
} else {
context._leave(null, context);
}
} else {
if ((0, _jquery2.default)(this.getTipElement()).hasClass(ClassName.SHOW)) {
this._leave(null, this);
return;
}
this._enter(null, this);
}
}
}, {
key: "dispose",
value: function dispose() {
clearTimeout(this._timeout);
_jquery2.default.removeData(this.element, this.constructor.DATA_KEY);
(0, _jquery2.default)(this.element).off(this.constructor.EVENT_KEY);
(0, _jquery2.default)(this.element).closest('.modal').off('hide.bs.modal');
if (this.tip) {
(0, _jquery2.default)(this.tip).remove();
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
if (this._popper !== null) {
this._popper.destroy();
}
this._popper = null;
this.element = null;
this.config = null;
this.tip = null;
}
}, {
key: "show",
value: function show() {
var _this = this;
if ((0, _jquery2.default)(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements');
}
var showEvent = _jquery2.default.Event(this.constructor.Event.SHOW);
if (this.isWithContent() && this._isEnabled) {
(0, _jquery2.default)(this.element).trigger(showEvent);
var shadowRoot = _util2.default.findShadowRoot(this.element);
var isInTheDom = _jquery2.default.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
if (showEvent.isDefaultPrevented() || !isInTheDom) {
return;
}
var tip = this.getTipElement();
var tipId = _util2.default.getUID(this.constructor.NAME);
tip.setAttribute('id', tipId);
this.element.setAttribute('aria-describedby', tipId);
this.setContent();
if (this.config.animation) {
(0, _jquery2.default)(tip).addClass(ClassName.FADE);
}
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
var attachment = this._getAttachment(placement);
this.addAttachmentClass(attachment);
var container = this._getContainer();
(0, _jquery2.default)(tip).data(this.constructor.DATA_KEY, this);
if (!_jquery2.default.contains(this.element.ownerDocument.documentElement, this.tip)) {
(0, _jquery2.default)(tip).appendTo(container);
}
(0, _jquery2.default)(this.element).trigger(this.constructor.Event.INSERTED);
this._popper = new _popper2.default(this.element, tip, {
placement: attachment,
modifiers: {
offset: this._getOffset(),
flip: {
behavior: this.config.fallbackPlacement
},
arrow: {
element: Selector.ARROW
},
preventOverflow: {
boundariesElement: this.config.boundary
}
},
onCreate: function onCreate(data) {
if (data.originalPlacement !== data.placement) {
_this._handlePopperPlacementChange(data);
}
},
onUpdate: function onUpdate(data) {
return _this._handlePopperPlacementChange(data);
}
});
(0, _jquery2.default)(tip).addClass(ClassName.SHOW); // 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) {
(0, _jquery2.default)(document.body).children().on('mouseover', null, _jquery2.default.noop);
}
var complete = function complete() {
if (_this.config.animation) {
_this._fixTransition();
}
var prevHoverState = _this._hoverState;
_this._hoverState = null;
(0, _jquery2.default)(_this.element).trigger(_this.constructor.Event.SHOWN);
if (prevHoverState === HoverState.OUT) {
_this._leave(null, _this);
}
};
if ((0, _jquery2.default)(this.tip).hasClass(ClassName.FADE)) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(this.tip);
(0, _jquery2.default)(this.tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
} else {
complete();
}
}
}
}, {
key: "hide",
value: function hide(callback) {
var _this2 = this;
var tip = this.getTipElement();
var hideEvent = _jquery2.default.Event(this.constructor.Event.HIDE);
var complete = function complete() {
if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
_this2._cleanTipClass();
_this2.element.removeAttribute('aria-describedby');
(0, _jquery2.default)(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
if (_this2._popper !== null) {
_this2._popper.destroy();
}
if (callback) {
callback();
}
};
(0, _jquery2.default)(this.element).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
return;
}
(0, _jquery2.default)(tip).removeClass(ClassName.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) {
(0, _jquery2.default)(document.body).children().off('mouseover', null, _jquery2.default.noop);
}
this._activeTrigger[Trigger.CLICK] = false;
this._activeTrigger[Trigger.FOCUS] = false;
this._activeTrigger[Trigger.HOVER] = false;
if ((0, _jquery2.default)(this.tip).hasClass(ClassName.FADE)) {
var transitionDuration = _util2.default.getTransitionDurationFromElement(tip);
(0, _jquery2.default)(tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
} else {
complete();
}
this._hoverState = '';
}
}, {
key: "update",
value: function update() {
if (this._popper !== null) {
this._popper.scheduleUpdate();
}
}
}, {
key: "isWithContent",
value: function isWithContent() {
return Boolean(this.getTitle());
}
}, {
key: "addAttachmentClass",
value: function addAttachmentClass(attachment) {
(0, _jquery2.default)(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment));
}
}, {
key: "getTipElement",
value: function getTipElement() {
this.tip = this.tip || (0, _jquery2.default)(this.config.template)[0];
return this.tip;
}
}, {
key: "setContent",
value: function setContent() {
var tip = this.getTipElement();
this.setElementContent((0, _jquery2.default)(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
(0, _jquery2.default)(tip).removeClass("".concat(ClassName.FADE, " ").concat(ClassName.SHOW));
}
}, {
key: "setElementContent",
value: function setElementContent($element, content) {
if (_typeof(content) === 'object' && (content.nodeType || content.jquery)) {
// Content is a DOM node or a jQuery
if (this.config.html) {
if (!(0, _jquery2.default)(content).parent().is($element)) {
$element.empty().append(content);
}
} else {
$element.text((0, _jquery2.default)(content).text());
}
return;
}
if (this.config.html) {
if (this.config.sanitize) {
content = (0, _sanitizer.sanitizeHtml)(content, this.config.whiteList, this.config.sanitizeFn);
}
$element.html(content);
} else {
$element.text(content);
}
}
}, {
key: "getTitle",
value: function getTitle() {
var title = this.element.getAttribute('data-original-title');
if (!title) {
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
}
return title;
}
}, {
key: "_getOffset",
value: function _getOffset() {
var _this3 = this;
var offset = {};
if (typeof this.config.offset === 'function') {
offset.fn = function (data) {
data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
return data;
};
} else {
offset.offset = this.config.offset;
}
return offset;
}
}, {
key: "_getContainer",
value: function _getContainer() {
if (this.config.container === false) {
return document.body;
}
if (_util2.default.isElement(this.config.container)) {
return (0, _jquery2.default)(this.config.container);
}
return (0, _jquery2.default)(document).find(this.config.container);
}
}, {
key: "_getAttachment",
value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
}, {
key: "_setListeners",
value: function _setListeners() {
var _this4 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
(0, _jquery2.default)(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
return _this4.toggle(event);
});
} else if (trigger !== Trigger.MANUAL) {
var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
(0, _jquery2.default)(_this4.element).on(eventIn, _this4.config.selector, function (event) {
return _this4._enter(event);
}).on(eventOut, _this4.config.selector, function (event) {
return _this4._leave(event);
});
}
});
(0, _jquery2.default)(this.element).closest('.modal').on('hide.bs.modal', function () {
if (_this4.element) {
_this4.hide();
}
});
if (this.config.selector) {
this.config = _objectSpread({}, this.config, {
trigger: 'manual',
selector: ''
});
} else {
this._fixTitle();
}
}
}, {
key: "_fixTitle",
value: function _fixTitle() {
var titleType = _typeof(this.element.getAttribute('data-original-title'));
if (this.element.getAttribute('title') || titleType !== 'string') {
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
this.element.setAttribute('title', '');
}
}
}, {
key: "_enter",
value: function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || (0, _jquery2.default)(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
(0, _jquery2.default)(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
}
if ((0, _jquery2.default)(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
context._hoverState = HoverState.SHOW;
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.SHOW;
if (!context.config.delay || !context.config.delay.show) {
context.show();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.SHOW) {
context.show();
}
}, context.config.delay.show);
}
}, {
key: "_leave",
value: function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || (0, _jquery2.default)(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
(0, _jquery2.default)(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
}
if (context._isWithActiveTrigger()) {
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.OUT;
if (!context.config.delay || !context.config.delay.hide) {
context.hide();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.OUT) {
context.hide();
}
}, context.config.delay.hide);
}
}, {
key: "_isWithActiveTrigger",
value: function _isWithActiveTrigger() {
for (var trigger in this._activeTrigger) {
if (this._activeTrigger[trigger]) {
return true;
}
}
return false;
}
}, {
key: "_getConfig",
value: function _getConfig(config) {
var dataAttributes = (0, _jquery2.default)(this.element).data();
Object.keys(dataAttributes).forEach(function (dataAttr) {
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
delete dataAttributes[dataAttr];
}
});
config = _objectSpread({}, 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();
}
_util2.default.typeCheckConfig(NAME, config, this.constructor.DefaultType);
if (config.sanitize) {
config.template = (0, _sanitizer.sanitizeHtml)(config.template, config.whiteList, config.sanitizeFn);
}
return config;
}
}, {
key: "_getDelegateConfig",
value: function _getDelegateConfig() {
var config = {};
if (this.config) {
for (var key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
}
}
}
return config;
}
}, {
key: "_cleanTipClass",
value: function _cleanTipClass() {
var $tip = (0, _jquery2.default)(this.getTipElement());
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
if (tabClass !== null && tabClass.length) {
$tip.removeClass(tabClass.join(''));
}
}
}, {
key: "_handlePopperPlacementChange",
value: function _handlePopperPlacementChange(popperData) {
var popperInstance = popperData.instance;
this.tip = popperInstance.popper;
this._cleanTipClass();
this.addAttachmentClass(this._getAttachment(popperData.placement));
}
}, {
key: "_fixTransition",
value: function _fixTransition() {
var tip = this.getTipElement();
var initConfigAnimation = this.config.animation;
if (tip.getAttribute('x-placement') !== null) {
return;
}
(0, _jquery2.default)(tip).removeClass(ClassName.FADE);
this.config.animation = false;
this.hide();
this.show();
this.config.animation = initConfigAnimation;
}
}], [{
key: "_jQueryInterface",
value: function _jQueryInterface(config) {
return this.each(function () {
var data = (0, _jquery2.default)(this).data(DATA_KEY);
var _config = _typeof(config) === 'object' && config;
if (!data && /dispose|hide/.test(config)) {
return;
}
if (!data) {
data = new Tooltip(this, _config);
(0, _jquery2.default)(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"".concat(config, "\""));
}
data[config]();
}
});
}
}, {
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}, {
key: "NAME",
get: function get() {
return NAME;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}, {
key: "Event",
get: function get() {
return Event;
}
}, {
key: "EVENT_KEY",
get: function get() {
return EVENT_KEY;
}
}, {
key: "DefaultType",
get: function get() {
return DefaultType;
}
}]);
return Tooltip;
}();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_jquery2.default.fn[NAME] = Tooltip._jQueryInterface;
_jquery2.default.fn[NAME].Constructor = Tooltip;
_jquery2.default.fn[NAME].noConflict = function () {
_jquery2.default.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip._jQueryInterface;
};
exports.default = Tooltip;
});
-172
View File
@@ -1,172 +0,0 @@
"use strict";
define(["exports", "jquery"], function (exports, _jquery) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.3.1): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
var TRANSITION_END = 'transitionend';
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
}
function getSpecialTransitionEndEvent() {
return {
bindType: TRANSITION_END,
delegateType: TRANSITION_END,
handle: function handle(event) {
if ((0, _jquery2.default)(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
}
return undefined; // eslint-disable-line no-undefined
}
};
}
function transitionEndEmulator(duration) {
var _this = this;
var called = false;
(0, _jquery2.default)(this).one(Util.TRANSITION_END, function () {
called = true;
});
setTimeout(function () {
if (!called) {
Util.triggerTransitionEnd(_this);
}
}, duration);
return this;
}
function setTransitionEndSupport() {
_jquery2.default.fn.emulateTransitionEnd = transitionEndEmulator;
_jquery2.default.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
var Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID: function getUID(prefix) {
do {
// eslint-disable-next-line no-bitwise
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
} while (document.getElementById(prefix));
return prefix;
},
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href');
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
}
try {
return document.querySelector(selector) ? selector : null;
} catch (err) {
return null;
}
},
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
if (!element) {
return 0;
} // Get transition-duration of the element
var transitionDuration = (0, _jquery2.default)(element).css('transition-duration');
var transitionDelay = (0, _jquery2.default)(element).css('transition-delay');
var floatTransitionDuration = parseFloat(transitionDuration);
var floatTransitionDelay = 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 (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
},
reflow: function reflow(element) {
return element.offsetHeight;
},
triggerTransitionEnd: function triggerTransitionEnd(element) {
(0, _jquery2.default)(element).trigger(TRANSITION_END);
},
supportsTransitionEnd: function supportsTransitionEnd() {
return Boolean(TRANSITION_END);
},
isElement: function isElement(obj) {
return (obj[0] || obj).nodeType;
},
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
for (var property in configTypes) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
var expectedTypes = configTypes[property];
var value = config[property];
var valueType = value && Util.isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error("".concat(componentName.toUpperCase(), ": ") + "Option \"".concat(property, "\" provided type \"").concat(valueType, "\" ") + "but expected type \"".concat(expectedTypes, "\"."));
}
}
}
},
findShadowRoot: function findShadowRoot(element) {
if (!document.documentElement.attachShadow) {
return null;
} // Can find the shadow root otherwise it'll return the document
if (typeof element.getRootNode === 'function') {
var 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 Util.findShadowRoot(element.parentNode);
}
};
setTransitionEndSupport();
exports.default = Util;
});
+17 -25
View File
@@ -4,37 +4,29 @@ Twitter bootstrap
-----------------
Sass:
This theme uses the version 4.3.1 Twitter bootstrap sass files.
The bootstrap repository is available on:
This theme uses Bootstrap version 4.5.0
The Bootstrap repository is available on:
https://github.com/twitter/bootstrap.git
To update to the latest release of twitter bootstrap:
* remove all files from scss/bootstrap,
* download the new scss files and store them in scss/bootstrap
* remove left: 0; from .popover {} in scss/bootstrap/_popover.scss. In RTL mode this prevents popovers from showing and it is not required in LTR mode.
* download bootstrap to your home folder
* remove folder theme/boost/scss/bootstrap
* copy the scss files from ~/bootstrap/scss to theme/boost/scss/bootstrap
* comment out left: 0; from .popover {} in scss/bootstrap/_popover.scss. In RTL mode this prevents popovers from showing and it is not required in LTR mode.
* comment out this line in theme/boost/scss/_print.scss
@page {
size: $print-page-size;
}
It breaks when compiled with phpscss.
* update ./thirdpartylibs.xml
Javascript:
This theme uses the transpiled javascript from bootstrap4 as amd modules.
To update the javascript files:
Checkout the version you are updating to in a folder, Run the follwing inside the cloned Bootstrap repository:
```
$ npm install @babel/[email protected] @babel/[email protected] babel-plugin-transform-es2015-modules-amd @babel/plugin-proposal-object-rest-spread
$ mkdir out
$ ./node_modules/@babel/cli/bin/babel.js --presets @babel/preset-env --plugins transform-es2015-modules-amd,@babel/plugin-proposal-object-rest-spread -d ./out/ js/src/
```
Copy the transpiled files from out/ into the amd/src/ folder for the theme.
Moodle core includes the popper.js Library, so make sure each of the new js files references the "core/popper" library instead of "popper.js".
For version 4.3.1 these files were: tooltip.js and dropdown.js
Move the amd/src/tools/sanatizer.js to amd/src/sanatizer.js and update libraries including sanatizer.js.
For version 4.3.1 this file was: tooltip.js
Run grunt to re-compile the JS files. (thanks to Joby Harding)
* copy the js files from ~/bootstrap/js/src to theme/boost/amd/src/bootstrap (including the subfolder)
* Moodle core includes the popper.js library, make sure each of the new Bootstrap js files
includes the 'core/popper' library instead of 'popper.js'. For version 4.5.0 these files were: tooltip.js and dropdown.js
* update ./thirdpartylibs.xml to include all new Bootstrap js files
* run "Grunt ignorefiles" to prevent linting errors appearing from the new Bootstrap js files.
* in folder theme/boost run "Grunt amd" to compile the bootstrap JS
+1 -1
View File
@@ -16,7 +16,7 @@
@include transition($badge-transition);
@at-root a#{&} {
@include hover-focus {
@include hover-focus() {
text-decoration: none;
}
}
+4 -1
View File
@@ -3,12 +3,15 @@
flex-wrap: wrap;
padding: $breadcrumb-padding-y $breadcrumb-padding-x;
margin-bottom: $breadcrumb-margin-bottom;
@include font-size($breadcrumb-font-size);
list-style: none;
background-color: $breadcrumb-bg;
@include border-radius($breadcrumb-border-radius);
}
.breadcrumb-item {
display: flex;
// The separator between breadcrumbs (by default, a forward-slash: "/")
+ .breadcrumb-item {
padding-left: $breadcrumb-item-padding;
@@ -17,7 +20,7 @@
display: inline-block; // Suppress underlining of the separator in modern browsers
padding-right: $breadcrumb-item-padding;
color: $breadcrumb-divider-color;
content: $breadcrumb-divider;
content: escape-svg($breadcrumb-divider);
}
}
@@ -13,7 +13,7 @@
// Bring the hover, focused, and "active" buttons to the front to overlay
// the borders properly
@include hover {
@include hover() {
z-index: 1;
}
&:focus,
+13 -8
View File
@@ -10,6 +10,8 @@
font-weight: $btn-font-weight;
color: $body-color;
text-align: center;
text-decoration: if($link-decoration == none, null, none);
white-space: $btn-white-space;
vertical-align: middle;
user-select: none;
background-color: transparent;
@@ -17,7 +19,7 @@
@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
@include transition($btn-transition);
@include hover {
@include hover() {
color: $body-color;
text-decoration: none;
}
@@ -35,12 +37,16 @@
@include box-shadow(none);
}
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active {
@include box-shadow($btn-active-box-shadow);
&:not(:disabled):not(.disabled) {
cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
&:focus {
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
&:active,
&.active {
@include box-shadow($btn-active-box-shadow);
&:focus {
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
}
}
}
}
@@ -79,7 +85,7 @@ fieldset:disabled a.btn {
color: $link-color;
text-decoration: $link-decoration;
@include hover {
@include hover() {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
@@ -87,7 +93,6 @@ fieldset:disabled a.btn {
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
box-shadow: none;
}
&:disabled,

Some files were not shown because too many files have changed in this diff Show More