Compare commits
47 Commits
master
...
MOODLE_37_
Author | SHA1 | Date |
---|---|---|
Matheus Garcia | 2d30d1988b | 3 years ago |
Matheus Garcia | ff718ebefa | 4 years ago |
Matheus | e4b3034217 | 5 years ago |
MateusO97 | 530f6eed04 | 5 years ago |
thiagourias | 8ae94adcd6 | 5 years ago |
thiagourias | 4142f176e7 | 5 years ago |
Matheus Garcia | 42ec6f8e5a | 5 years ago |
thiagourias | de6eba99ee | 5 years ago |
Matheus Garcia | ba6d101f3c | 5 years ago |
Matheus Garcia | 1890ae202f | 5 years ago |
thiagourias | a97d46b0f5 | 5 years ago |
Matheus Garcia | d99a125372 | 5 years ago |
Matheus Garcia | ebe4923151 | 6 years ago |
Matheus Garcia | e2aaeb114a | 6 years ago |
thiagourias | 102f670bd0 | 6 years ago |
Matheus Garcia | c85467541b | 6 years ago |
Matheus Garcia | 401d1ff93a | 6 years ago |
Matheus Garcia | c38ceac26a | 6 years ago |
thiagourias | 59846a6529 | 6 years ago |
thiagourias | c3c9a1ab99 | 6 years ago |
thiagourias | af72b75a97 | 6 years ago |
thiagourias | 79b3549db4 | 6 years ago |
thiagourias | 5ba286d185 | 6 years ago |
thiagourias | 40fd28d73e | 6 years ago |
thiagourias | 122c74aad9 | 6 years ago |
thiagourias | fb9f847692 | 6 years ago |
Matheus Garcia | d8fc551ecf | 6 years ago |
Matheus Garcia | c8eafa8e59 | 6 years ago |
thiagourias | d8338335c8 | 6 years ago |
thiagourias | b49dd3ac03 | 6 years ago |
Matheus Garcia | d85caa732e | 6 years ago |
thiagourias | cde357f2eb | 6 years ago |
thiagourias | fc6fe248e9 | 6 years ago |
thiagourias | fcb80bcd2e | 6 years ago |
Matheus Garcia | 9a0a838f12 | 6 years ago |
Matheus Garcia | cac2cf0c0b | 6 years ago |
Matheus Garcia | c0ce11e4a2 | 6 years ago |
Matheus Garcia | 01715a5e59 | 6 years ago |
thiagourias | 1121f04b2a | 6 years ago |
thiagourias | af8ed07a7b | 6 years ago |
thiagourias | 9a4ca44bd6 | 6 years ago |
thiagourias | 70ca983f23 | 6 years ago |
thiagourias | e3a02cd893 | 6 years ago |
thiagourias | c984eed920 | 6 years ago |
thiagourias | e3310bb470 | 6 years ago |
Matheus Garcia | 4bced6d898 | 6 years ago |
thiagourias | bcfe236430 | 6 years ago |
338 changed files with 30993 additions and 11289 deletions
@ -1,6 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<project version="4"> |
|
||||
<component name="VcsDirectoryMappings"> |
|
||||
<mapping directory="" vcs="Git" /> |
|
||||
</component> |
|
||||
</project> |
|
@ -0,0 +1 @@ |
|||||
|
define(["exports","jquery","./util"],function(a,b,c){"use strict";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;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c),j=function(a){var b="alert",c="4.0.0",d="bs.alert",f=".".concat(d),h=".data-api",j=a.fn[b],k=150,l={DISMISS:'[data-dismiss="alert"]'},m={CLOSE:"close".concat(f),CLOSED:"closed".concat(f),CLICK_DATA_API:"click".concat(f).concat(h)},n={ALERT:"alert",FADE:"fade",SHOW:"show"},o=function(){function b(a){e(this,b),this._element=a}return g(b,[{key:"close",value:function(a){a=a||this._element;var b=this._getRootElement(a),c=this._triggerCloseEvent(b);c.isDefaultPrevented()||this._removeElement(b)}},{key:"dispose",value:function(){a.removeData(this._element,d),this._element=null}},{key:"_getRootElement",value:function(b){var c=i["default"].getSelectorFromElement(b),d=!1;return c&&(d=a(c)[0]),d||(d=a(b).closest(".".concat(n.ALERT))[0]),d}},{key:"_triggerCloseEvent",value:function(b){var c=a.Event(m.CLOSE);return a(b).trigger(c),c}},{key:"_removeElement",value:function(b){var c=this;return a(b).removeClass(n.SHOW),i["default"].supportsTransitionEnd()&&a(b).hasClass(n.FADE)?void a(b).one(i["default"].TRANSITION_END,function(a){return c._destroyElement(b,a)}).emulateTransitionEnd(k):void this._destroyElement(b)}},{key:"_destroyElement",value:function(b){a(b).detach().trigger(m.CLOSED).remove()}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var e=a(this),f=e.data(d);f||(f=new b(this),e.data(d,f)),"close"===c&&f[c](this)})}},{key:"_handleDismiss",value:function(a){return function(b){b&&b.preventDefault(),a.close(this)}}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(m.CLICK_DATA_API,l.DISMISS,o._handleDismiss(new o)),a.fn[b]=o._jQueryInterface,a.fn[b].Constructor=o,a.fn[b].noConflict=function(){return a.fn[b]=j,o._jQueryInterface},o}(h["default"]);a["default"]=j}); |
@ -0,0 +1 @@ |
|||||
|
define(["jquery","core/pending"],function(a,b){return{init:function(){var c=!1,d=function(){c=!0},e=function(){var a=c;return c=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var c,e=b.which||b.keyCode;38==e&&d(),27==e&&(c=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==c&&a(b.target).click()),32!=e&&13!=e||(b.preventDefault(),a(b.target).click())});var f=function(c){var d=function(b){a(this).focus(),b.resolve()}.bind(c);setTimeout(d,50,new b("core/aria:delayed-focus"))};a(".dropdown").on("shown.bs.dropdown",function(b){var c=a(b.target).find('[role="menu"]'),d=!1,g=!1;c&&(d=a(c).find('[role="menuitem"]')),d&&d.length>0&&(g=e()?d[d.length-1]:d[0]),g&&f(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,e=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(e=e.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(e)){f(c);break}}),a('.dropdown [role="menu"] [role="menuitem"]').keydown(function(b){var c=b.which||b.keyCode,d=!1,e=a(b.target).closest('[role="menu"]'),g=0,h=!1;if(e&&(h=a(e).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}d||(d=h[0])}else if(38==c){for(g=1;g<h.length;g++)if(h[g]==b.target){d=h[g-1];break}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),f(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');c&&f(c)}),a(function(){window.setTimeout(function(b){var c=a('[role="alert"][data-aria-autofocus="true"]');c.length>0&&(a(c[0]).attr("tabindex","0"),a(c[0]).focus()),b.resolve()},300,new b("core/aria:delayed-focus"))})}}}); |
@ -0,0 +1 @@ |
|||||
|
define(["exports","jquery"],function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function f(a,b,c){return b&&e(a.prototype,b),c&&e(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var g=c(b),h=function(a){var b="button",c="4.0.0",e="bs.button",g=".".concat(e),h=".data-api",i=a.fn[b],j={ACTIVE:"active",BUTTON:"btn",FOCUS:"focus"},k={DATA_TOGGLE_CARROT:'[data-toggle^="button"]',DATA_TOGGLE:'[data-toggle="buttons"]',INPUT:"input",ACTIVE:".active",BUTTON:".btn"},l={CLICK_DATA_API:"click".concat(g).concat(h),FOCUS_BLUR_DATA_API:"focus".concat(g).concat(h," ")+"blur".concat(g).concat(h)},m=function(){function b(a){d(this,b),this._element=a}return f(b,[{key:"toggle",value:function(){var b=!0,c=!0,d=a(this._element).closest(k.DATA_TOGGLE)[0];if(d){var e=a(this._element).find(k.INPUT)[0];if(e){if("radio"===e.type)if(e.checked&&a(this._element).hasClass(j.ACTIVE))b=!1;else{var f=a(d).find(k.ACTIVE)[0];f&&a(f).removeClass(j.ACTIVE)}if(b){if(e.hasAttribute("disabled")||d.hasAttribute("disabled")||e.classList.contains("disabled")||d.classList.contains("disabled"))return;e.checked=!a(this._element).hasClass(j.ACTIVE),a(e).trigger("change")}e.focus(),c=!1}}c&&this._element.setAttribute("aria-pressed",!a(this._element).hasClass(j.ACTIVE)),b&&a(this._element).toggleClass(j.ACTIVE)}},{key:"dispose",value:function(){a.removeData(this._element,e),this._element=null}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var d=a(this).data(e);d||(d=new b(this),a(this).data(e,d)),"toggle"===c&&d[c]()})}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(l.CLICK_DATA_API,k.DATA_TOGGLE_CARROT,function(b){b.preventDefault();var c=b.target;a(c).hasClass(j.BUTTON)||(c=a(c).closest(k.BUTTON)),m._jQueryInterface.call(a(c),"toggle")}).on(l.FOCUS_BLUR_DATA_API,k.DATA_TOGGLE_CARROT,function(b){var c=a(b.target).closest(k.BUTTON)[0];a(c).toggleClass(j.FOCUS,/^focus(in)?$/.test(b.type))}),a.fn[b]=m._jQueryInterface,a.fn[b].Constructor=m,a.fn[b].noConflict=function(){return a.fn[b]=i,m._jQueryInterface},m}(g["default"]);a["default"]=h}); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||
|
define(["jquery","core/custom_interaction_events","core/log","core/pubsub"],function(a,b,c,d){var e={TOGGLE_REGION:'[data-region="drawer-toggle"]',TOGGLE_ACTION:'[data-action="toggle-drawer"]',TOGGLE_TARGET:"aria-controls",TOGGLE_SIDE:"left",BODY:"body",SECTION:'.list-group-item[href*="#section-"]',DRAWER:"#nav-drawer"},f=a(document).width()<768,g=function(){a(e.TOGGLE_REGION).length||c.debug("Page is missing a drawer region"),a(e.TOGGLE_ACTION).length||c.debug("Page is missing a drawer toggle link"),a(e.TOGGLE_REGION).each(function(b,c){var d=a(c).find(e.TOGGLE_ACTION),g=d.attr("aria-controls"),h=a(document.getElementById(g)),i="false"==d.attr("aria-expanded"),j=d.attr("data-side"),k=a(e.BODY),l=d.attr("data-preference");f&&M.util.set_user_preference(l,"false"),h.on("mousewheel DOMMouseScroll",this.preventPageScroll),i?d.attr("aria-expanded","false"):(k.addClass("drawer-open-"+j),d.attr("aria-expanded","true"))}.bind(this)),this.registerEventListeners(),f&&this.closeAll()};return g.prototype.closeAll=function(){a(e.TOGGLE_REGION).each(function(b,c){var d=a(c).find(e.TOGGLE_ACTION),g=d.attr("data-side"),h=a(e.BODY),i=d.attr("aria-controls"),j=a(document.getElementById(i)),k=d.attr("data-preference");d.attr("aria-expanded","false"),h.removeClass("drawer-open-"+g),j.attr("aria-hidden","true"),j.addClass("closed"),f||M.util.set_user_preference(k,"false")})},g.prototype.toggleDrawer=function(b){var c=a(b.target).closest("[data-action=toggle-drawer]"),g=c.attr("aria-controls"),h=a(document.getElementById(g)),i=a(e.BODY),j=c.attr("data-side"),k=c.attr("data-preference");f&&M.util.set_user_preference(k,"false"),i.addClass("drawer-ease");var l="true"==c.attr("aria-expanded");l?(i.removeClass("drawer-open-"+j),c.attr("aria-expanded","false"),h.attr("aria-hidden","true"),h.addClass("closed"),f||M.util.set_user_preference(k,"false")):(c.attr("aria-expanded","true"),h.attr("aria-hidden","false"),h.focus(),i.addClass("drawer-open-"+j),h.removeClass("closed"),f||M.util.set_user_preference(k,"true")),d.publish("nav-drawer-toggle-start",l)},g.prototype.preventPageScroll=function(b){var c=b.wheelDelta||b.originalEvent&&b.originalEvent.wheelDelta||-b.originalEvent.detail,d=this.scrollTop+a(this).outerHeight()-this.scrollHeight>=0,e=this.scrollTop<=0;(c<0&&d||c>0&&e)&&b.preventDefault()},g.prototype.registerEventListeners=function(){a(e.TOGGLE_ACTION).each(function(c,d){b.define(a(d),[b.events.activate]),a(d).on(b.events.activate,function(a,b){this.toggleDrawer(b.originalEvent),b.originalEvent.preventDefault()}.bind(this))}.bind(this)),a(e.SECTION).click(function(){f&&this.closeAll()}.bind(this)),a(e.DRAWER).on("webkitTransitionEnd msTransitionEnd transitionend",function(b){var c=a(b.target).closest(e.DRAWER),f="false"==c.attr("aria-hidden");d.publish("nav-drawer-toggle-end",f)})},{init:function(){return new g}}}); |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||
|
define(["jquery","core/event"],function(a,b){return{enhance:function(c){var d=document.getElementById(c);a(d).on(b.Events.FORM_FIELD_VALIDATION,function(b,c){b.preventDefault();var e=a(d).closest(".form-group"),f=e.find(".form-control-feedback");"TEXTAREA"==a(d).prop("tagName")&&e.find("[contenteditable]")&&(d=e.find("[contenteditable]")),""!==c?(e.addClass("has-danger"),e.data("client-validation-error",!0),a(d).addClass("is-invalid"),a(d).attr("aria-describedby",f.attr("id")),a(d).attr("aria-invalid",!0),f.attr("tabindex",0),f.html(c),f.is(":visible")||(f.show(),f.focus())):e.data("client-validation-error")===!0&&(e.removeClass("has-danger"),e.data("client-validation-error",!1),a(d).removeClass("is-invalid"),a(d).removeAttr("aria-describedby"),a(d).attr("aria-invalid",!1),f.hide())})}}}); |
@ -0,0 +1 @@ |
|||||
|
define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,require(["theme_ilb/aria","theme_ilb/pending","theme_ilb/util","theme_ilb/alert","theme_ilb/button","theme_ilb/carousel","theme_ilb/collapse","theme_ilb/dropdown","theme_ilb/modal","theme_ilb/scrollspy","theme_ilb/tab","theme_ilb/tooltip","theme_ilb/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})}),b.init()}),{}}); |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||
|
define(["jquery"],function(a){var b={alert:[{start:"close",end:"closed"}],carousel:[{start:"slide",end:"slid"}],collapse:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}],dropdown:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}],modal:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}],popover:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}],tab:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}],tooltip:[{start:"hide",end:"hidden"},{start:"show",end:"shown"}]};Object.keys(b).forEach(function(c){b[c].forEach(function(b){var d=b.start+".bs."+c,e=b.end+".bs."+c;a(document.body).on(d,function(){M.util.js_pending(e)}),a(document.body).on(e,function(){M.util.js_complete(e)})})})}); |
@ -0,0 +1 @@ |
|||||
|
define(["exports","jquery","./tooltip"],function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(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;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function h(a,b,c){return b&&g(a.prototype,b),c&&g(a,c),a}function i(a,b){if(b&&("object"===e(b)||"function"==typeof b))return b;if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function j(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,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(){return k=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},k.apply(this,arguments)}Object.defineProperty(a,"__esModule",{value:!0});var l=d(b),m=d(c),n=function(a){var b="popover",c="4.0.0",d="bs.popover",g=".".concat(d),l=a.fn[b],n="bs-popover",o=new RegExp("(^|\\s)".concat(n,"\\S+"),"g"),p=k({},m["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>'}),q=k({},m["default"].DefaultType,{content:"(string|element|function)"}),r={FADE:"fade",SHOW:"show"},s={TITLE:".popover-header",CONTENT:".popover-body"},t={HIDE:"hide".concat(g),HIDDEN:"hidden".concat(g),SHOW:"show".concat(g),SHOWN:"shown".concat(g),INSERTED:"inserted".concat(g),CLICK:"click".concat(g),FOCUSIN:"focusin".concat(g),FOCUSOUT:"focusout".concat(g),MOUSEENTER:"mouseenter".concat(g),MOUSELEAVE:"mouseleave".concat(g)},u=function(k){function l(){return f(this,l),i(this,(l.__proto__||Object.getPrototypeOf(l)).apply(this,arguments))}return j(l,k),h(l,[{key:"isWithContent",value:function(){return this.getTitle()||this._getContent()}},{key:"addAttachmentClass",value:function(b){a(this.getTipElement()).addClass("".concat(n,"-").concat(b))}},{key:"getTipElement",value:function(){return this.tip=this.tip||a(this.config.template)[0],this.tip}},{key:"setContent",value:function(){var b=a(this.getTipElement());this.setElementContent(b.find(s.TITLE),this.getTitle());var c=this._getContent();"function"==typeof c&&(c=c.call(this.element)),this.setElementContent(b.find(s.CONTENT),c),b.removeClass("".concat(r.FADE," ").concat(r.SHOW))}},{key:"_getContent",value:function(){return this.element.getAttribute("data-content")||this.config.content}},{key:"_cleanTipClass",value:function(){var b=a(this.getTipElement()),c=b.attr("class").match(o);null!==c&&c.length>0&&b.removeClass(c.join(""))}}],[{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=a(this).data(d),f="object"===e(b)?b:null;if((c||!/destroy|hide/.test(b))&&(c||(c=new l(this,f),a(this).data(d,c)),"string"==typeof b)){if("undefined"==typeof c[b])throw new TypeError('No method named "'.concat(b,'"'));c[b]()}})}},{key:"VERSION",get:function(){return c}},{key:"Default",get:function(){return p}},{key:"NAME",get:function(){return b}},{key:"DATA_KEY",get:function(){return d}},{key:"Event",get:function(){return t}},{key:"EVENT_KEY",get:function(){return g}},{key:"DefaultType",get:function(){return q}}]),l}(m["default"]);return a.fn[b]=u._jQueryInterface,a.fn[b].Constructor=u,a.fn[b].noConflict=function(){return a.fn[b]=l,u._jQueryInterface},u}(l["default"]);a["default"]=n}); |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||
|
define(["exports","jquery","./util"],function(a,b,c){"use strict";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;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}function g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),a}Object.defineProperty(a,"__esModule",{value:!0});var h=d(b),i=d(c),j=function(a){var b="tab",c="4.0.0",d="bs.tab",f=".".concat(d),h=".data-api",j=a.fn[b],k=150,l={HIDE:"hide".concat(f),HIDDEN:"hidden".concat(f),SHOW:"show".concat(f),SHOWN:"shown".concat(f),CLICK_DATA_API:"click".concat(f).concat(h)},m={DROPDOWN_MENU:"dropdown-menu",ACTIVE:"active",DISABLED:"disabled",FADE:"fade",SHOW:"show"},n={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"},o=function(){function b(a){e(this,b),this._element=a}return g(b,[{key:"show",value:function(){var b=this;if(!(this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE&&a(this._element).hasClass(m.ACTIVE)||a(this._element).hasClass(m.DISABLED))){var c,d,e=a(this._element).closest(n.NAV_LIST_GROUP)[0],f=i["default"].getSelectorFromElement(this._element);if(e){var g="UL"===e.nodeName?n.ACTIVE_UL:n.ACTIVE;d=a.makeArray(a(e).find(g)),d=d[d.length-1]}var h=a.Event(l.HIDE,{relatedTarget:this._element}),j=a.Event(l.SHOW,{relatedTarget:d});if(d&&a(d).trigger(h),a(this._element).trigger(j),!j.isDefaultPrevented()&&!h.isDefaultPrevented()){f&&(c=a(f)[0]),this._activate(this._element,e);var k=function(){var c=a.Event(l.HIDDEN,{relatedTarget:b._element}),e=a.Event(l.SHOWN,{relatedTarget:d});a(d).trigger(c),a(b._element).trigger(e)};c?this._activate(c,c.parentNode,k):k()}}}},{key:"dispose",value:function(){a.removeData(this._element,d),this._element=null}},{key:"_activate",value:function(b,c,d){var e,f=this;e="UL"===c.nodeName?a(c).find(n.ACTIVE_UL):a(c).children(n.ACTIVE);var g=e[0],h=d&&i["default"].supportsTransitionEnd()&&g&&a(g).hasClass(m.FADE),j=function(){return f._transitionComplete(b,g,d)};g&&h?a(g).one(i["default"].TRANSITION_END,j).emulateTransitionEnd(k):j()}},{key:"_transitionComplete",value:function(b,c,d){if(c){a(c).removeClass("".concat(m.SHOW," ").concat(m.ACTIVE));var e=a(c.parentNode).find(n.DROPDOWN_ACTIVE_CHILD)[0];e&&a(e).removeClass(m.ACTIVE),"tab"===c.getAttribute("role")&&c.setAttribute("aria-selected",!1)}if(a(b).addClass(m.ACTIVE),"tab"===b.getAttribute("role")&&b.setAttribute("aria-selected",!0),i["default"].reflow(b),a(b).addClass(m.SHOW),b.parentNode&&a(b.parentNode).hasClass(m.DROPDOWN_MENU)){var f=a(b).closest(n.DROPDOWN)[0];f&&a(f).find(n.DROPDOWN_TOGGLE).addClass(m.ACTIVE),b.setAttribute("aria-expanded",!0)}d&&d()}}],[{key:"_jQueryInterface",value:function(c){return this.each(function(){var e=a(this),f=e.data(d);if(f||(f=new b(this),e.data(d,f)),"string"==typeof c){if("undefined"==typeof f[c])throw new TypeError('No method named "'.concat(c,'"'));f[c]()}})}},{key:"VERSION",get:function(){return c}}]),b}();return a(document).on(l.CLICK_DATA_API,n.DATA_TOGGLE,function(b){b.preventDefault(),o._jQueryInterface.call(a(this),"show")}),a.fn[b]=o._jQueryInterface,a.fn[b].Constructor=o,a.fn[b].noConflict=function(){return a.fn[b]=j,o._jQueryInterface},o}(h["default"]);a["default"]=j}); |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||||
|
define(["exports","jquery"],function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}Object.defineProperty(a,"__esModule",{value:!0});var d=c(b),e=function(a){function b(a){return{}.toString.call(a).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function c(){return{bindType:h.end,delegateType:h.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}}}function d(){return("undefined"==typeof window||!window.QUnit)&&{end:"transitionend"}}function e(b){var c=this,d=!1;return a(this).one(j.TRANSITION_END,function(){d=!0}),setTimeout(function(){d||j.triggerTransitionEnd(c)},b),this}function f(){h=d(),a.fn.emulateTransitionEnd=e,j.supportsTransitionEnd()&&(a.event.special[j.TRANSITION_END]=c())}function g(b){return b="function"==typeof a.escapeSelector?a.escapeSelector(b).substr(1):b.replace(/(:|\.|\[|\]|,|=|@)/g,"\\$1")}var h=!1,i=1e6,j={TRANSITION_END:"bsTransitionEnd",getUID:function(a){do a+=~~(Math.random()*i);while(document.getElementById(a));return a},getSelectorFromElement:function(b){var c=b.getAttribute("data-target");c&&"#"!==c||(c=b.getAttribute("href")||""),"#"===c.charAt(0)&&(c=g(c));try{var d=a(document).find(c);return d.length>0?c:null}catch(e){return null}},reflow:function(a){return a.offsetHeight},triggerTransitionEnd:function(b){a(b).trigger(h.end)},supportsTransitionEnd:function(){return Boolean(h)},isElement:function(a){return(a[0]||a).nodeType},typeCheckConfig:function(a,c,d){for(var e in d)if(Object.prototype.hasOwnProperty.call(d,e)){var f=d[e],g=c[e],h=g&&j.isElement(g)?"element":b(g);if(!new RegExp(f).test(h))throw new Error("".concat(a.toUpperCase(),": ")+'Option "'.concat(e,'" provided type "').concat(h,'" ')+'but expected type "'.concat(f,'".'))}}};return f(),j}(d["default"]);a["default"]=e}); |
@ -0,0 +1,216 @@ |
|||||
|
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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): alert.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Alert = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'alert'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.alert'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 150; |
||||
|
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) { |
||||
|
element = element || this._element; |
||||
|
|
||||
|
var rootElement = this._getRootElement(element); |
||||
|
|
||||
|
var customEvent = this._triggerCloseEvent(rootElement); |
||||
|
|
||||
|
if (customEvent.isDefaultPrevented()) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
this._removeElement(rootElement); |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function dispose() { |
||||
|
$.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 = $(selector)[0]; |
||||
|
} |
||||
|
|
||||
|
if (!parent) { |
||||
|
parent = $(element).closest(".".concat(ClassName.ALERT))[0]; |
||||
|
} |
||||
|
|
||||
|
return parent; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_triggerCloseEvent", |
||||
|
value: function _triggerCloseEvent(element) { |
||||
|
var closeEvent = $.Event(Event.CLOSE); |
||||
|
$(element).trigger(closeEvent); |
||||
|
return closeEvent; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_removeElement", |
||||
|
value: function _removeElement(element) { |
||||
|
var _this = this; |
||||
|
|
||||
|
$(element).removeClass(ClassName.SHOW); |
||||
|
|
||||
|
if (!_util2.default.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { |
||||
|
this._destroyElement(element); |
||||
|
|
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$(element).one(_util2.default.TRANSITION_END, function (event) { |
||||
|
return _this._destroyElement(element, event); |
||||
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_destroyElement", |
||||
|
value: function _destroyElement(element) { |
||||
|
$(element).detach().trigger(Event.CLOSED).remove(); |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var $element = $(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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Alert._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Alert; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Alert._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Alert; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Alert; |
||||
|
}); |
@ -0,0 +1,201 @@ |
|||||
|
// 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/>.
|
||||
|
|
||||
|
/** |
||||
|
* Enhancements to Bootstrap components for accessibility. |
||||
|
* |
||||
|
* @module theme_ilb/aria |
||||
|
* @copyright 2018 Damyon Wiese <damyon@moodle.com> |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
*/ |
||||
|
define(['jquery', 'core/pending'], function($, Pending) { |
||||
|
return { |
||||
|
init: function() { |
||||
|
// Drop downs from bootstrap don't support keyboard accessibility by default.
|
||||
|
var focusEnd = false, |
||||
|
setFocusEnd = function() { |
||||
|
focusEnd = true; |
||||
|
}, |
||||
|
getFocusEnd = function() { |
||||
|
var result = focusEnd; |
||||
|
focusEnd = false; |
||||
|
return result; |
||||
|
}; |
||||
|
|
||||
|
// Special handling for "up" keyboard control.
|
||||
|
$('[data-toggle="dropdown"]').keydown(function(e) { |
||||
|
var trigger = e.which || e.keyCode, |
||||
|
expanded; |
||||
|
|
||||
|
// Up key opens the menu at the end.
|
||||
|
if (trigger == 38) { |
||||
|
// Focus the end of the menu, not the beginning.
|
||||
|
setFocusEnd(); |
||||
|
} |
||||
|
|
||||
|
// Escape key only closes the menu, it doesn't open it.
|
||||
|
if (trigger == 27) { |
||||
|
expanded = $(e.target).attr('aria-expanded'); |
||||
|
e.preventDefault(); |
||||
|
if (expanded == "false") { |
||||
|
$(e.target).click(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Space key or Enter key opens the menu.
|
||||
|
if (trigger == 32 || trigger == 13) { |
||||
|
// Cancel random scroll.
|
||||
|
e.preventDefault(); |
||||
|
// Open the menu instead.
|
||||
|
$(e.target).click(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// Special handling for navigation keys when menu is open.
|
||||
|
var shiftFocus = function(element) { |
||||
|
var delayedFocus = function(pendingPromise) { |
||||
|
$(this).focus(); |
||||
|
pendingPromise.resolve(); |
||||
|
}.bind(element); |
||||
|
setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus')); |
||||
|
}; |
||||
|
|
||||
|
$('.dropdown').on('shown.bs.dropdown', function(e) { |
||||
|
// We need to focus on the first menuitem.
|
||||
|
var menu = $(e.target).find('[role="menu"]'), |
||||
|
menuItems = false, |
||||
|
foundMenuItem = false; |
||||
|
|
||||
|
if (menu) { |
||||
|
menuItems = $(menu).find('[role="menuitem"]'); |
||||
|
} |
||||
|
if (menuItems && menuItems.length > 0) { |
||||
|
if (getFocusEnd()) { |
||||
|
foundMenuItem = menuItems[menuItems.length - 1]; |
||||
|
} else { |
||||
|
// The first menu entry, pretty reasonable.
|
||||
|
foundMenuItem = menuItems[0]; |
||||
|
} |
||||
|
} |
||||
|
if (foundMenuItem) { |
||||
|
shiftFocus(foundMenuItem); |
||||
|
} |
||||
|
}); |
||||
|
// Search for menu items by finding the first item that has
|
||||
|
// text starting with the typed character (case insensitive).
|
||||
|
$('.dropdown [role="menu"] [role="menuitem"]').keypress(function(e) { |
||||
|
var trigger = String.fromCharCode(e.which || e.keyCode), |
||||
|
menu = $(e.target).closest('[role="menu"]'), |
||||
|
i = 0, |
||||
|
menuItems = false, |
||||
|
item, |
||||
|
itemText; |
||||
|
|
||||
|
if (!menu) { |
||||
|
return; |
||||
|
} |
||||
|
menuItems = $(menu).find('[role="menuitem"]'); |
||||
|
if (!menuItems) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
trigger = trigger.toLowerCase(); |
||||
|
for (i = 0; i < menuItems.length; i++) { |
||||
|
item = $(menuItems[i]); |
||||
|
itemText = item.text().trim().toLowerCase(); |
||||
|
if (itemText.indexOf(trigger) == 0) { |
||||
|
shiftFocus(item); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// Keyboard navigation for arrow keys, home and end keys.
|
||||
|
$('.dropdown [role="menu"] [role="menuitem"]').keydown(function(e) { |
||||
|
var trigger = e.which || e.keyCode, |
||||
|
next = false, |
||||
|
menu = $(e.target).closest('[role="menu"]'), |
||||
|
i = 0, |
||||
|
menuItems = false; |
||||
|
if (!menu) { |
||||
|
return; |
||||
|
} |
||||
|
menuItems = $(menu).find('[role="menuitem"]'); |
||||
|
if (!menuItems) { |
||||
|
return; |
||||
|
} |
||||
|
// Down key.
|
||||
|
if (trigger == 40) { |
||||
|
for (i = 0; i < menuItems.length - 1; i++) { |
||||
|
if (menuItems[i] == e.target) { |
||||
|
next = menuItems[i + 1]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (!next) { |
||||
|
// Wrap to first item.
|
||||
|
next = menuItems[0]; |
||||
|
} |
||||
|
|
||||
|
} else if (trigger == 38) { |
||||
|
// Up key.
|
||||
|
for (i = 1; i < menuItems.length; i++) { |
||||
|
if (menuItems[i] == e.target) { |
||||
|
next = menuItems[i - 1]; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (!next) { |
||||
|
// Wrap to last item.
|
||||
|
next = menuItems[menuItems.length - 1]; |
||||
|
} |
||||
|
|
||||
|
} else if (trigger == 36) { |
||||
|
// Home key.
|
||||
|
next = menuItems[0]; |
||||
|
|
||||
|
} else if (trigger == 35) { |
||||
|
// End key.
|
||||
|
next = menuItems[menuItems.length - 1]; |
||||
|
} |
||||
|
// Variable next is set if we do want to act on the keypress.
|
||||
|
if (next) { |
||||
|
e.preventDefault(); |
||||
|
shiftFocus(next); |
||||
|
} |
||||
|
return; |
||||
|
}); |
||||
|
$('.dropdown').on('hidden.bs.dropdown', function(e) { |
||||
|
// We need to focus on the menu trigger.
|
||||
|
var trigger = $(e.target).find('[data-toggle="dropdown"]'); |
||||
|
if (trigger) { |
||||
|
shiftFocus(trigger); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// After page load, focus on any element with special autofocus attribute.
|
||||
|
$(function() { |
||||
|
window.setTimeout(function(pendingPromise) { |
||||
|
var alerts = $('[role="alert"][data-aria-autofocus="true"]'); |
||||
|
if (alerts.length > 0) { |
||||
|
$(alerts[0]).attr('tabindex', '0'); |
||||
|
$(alerts[0]).focus(); |
||||
|
} |
||||
|
pendingPromise.resolve(); |
||||
|
}, 300, new Pending('core/aria:delayed-focus')); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
}); |
@ -0,0 +1,200 @@ |
|||||
|
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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): button.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Button = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'button'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.button'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.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', |
||||
|
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 = $(this._element).closest(Selector.DATA_TOGGLE)[0]; |
||||
|
|
||||
|
if (rootElement) { |
||||
|
var input = $(this._element).find(Selector.INPUT)[0]; |
||||
|
|
||||
|
if (input) { |
||||
|
if (input.type === 'radio') { |
||||
|
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { |
||||
|
triggerChangeEvent = false; |
||||
|
} else { |
||||
|
var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; |
||||
|
|
||||
|
if (activeElement) { |
||||
|
$(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).hasClass(ClassName.ACTIVE); |
||||
|
$(input).trigger('change'); |
||||
|
} |
||||
|
|
||||
|
input.focus(); |
||||
|
addAriaPressed = false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (addAriaPressed) { |
||||
|
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); |
||||
|
} |
||||
|
|
||||
|
if (triggerChangeEvent) { |
||||
|
$(this._element).toggleClass(ClassName.ACTIVE); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function dispose() { |
||||
|
$.removeData(this._element, DATA_KEY); |
||||
|
this._element = null; |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var data = $(this).data(DATA_KEY); |
||||
|
|
||||
|
if (!data) { |
||||
|
data = new Button(this); |
||||
|
$(this).data(DATA_KEY, data); |
||||
|
} |
||||
|
|
||||
|
if (config === 'toggle') { |
||||
|
data[config](); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "VERSION", |
||||
|
get: function get() { |
||||
|
return VERSION; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return Button; |
||||
|
}(); |
||||
|
|
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Data Api implementation |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { |
||||
|
event.preventDefault(); |
||||
|
var button = event.target; |
||||
|
|
||||
|
if (!$(button).hasClass(ClassName.BUTTON)) { |
||||
|
button = $(button).closest(Selector.BUTTON); |
||||
|
} |
||||
|
|
||||
|
Button._jQueryInterface.call($(button), 'toggle'); |
||||
|
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { |
||||
|
var button = $(event.target).closest(Selector.BUTTON)[0]; |
||||
|
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Button._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Button; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Button._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Button; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Button; |
||||
|
}); |
@ -0,0 +1,589 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): carousel.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Carousel = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'carousel'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.carousel'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 600; |
||||
|
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 Default = { |
||||
|
interval: 5000, |
||||
|
keyboard: true, |
||||
|
slide: false, |
||||
|
pause: 'hover', |
||||
|
wrap: true |
||||
|
}; |
||||
|
var DefaultType = { |
||||
|
interval: '(number|boolean)', |
||||
|
keyboard: 'boolean', |
||||
|
slide: '(boolean|string)', |
||||
|
pause: '(string|boolean)', |
||||
|
wrap: '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), |
||||
|
TOUCHEND: "touchend".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' |
||||
|
}; |
||||
|
var Selector = { |
||||
|
ACTIVE: '.active', |
||||
|
ACTIVE_ITEM: '.active.carousel-item', |
||||
|
ITEM: '.carousel-item', |
||||
|
NEXT_PREV: '.carousel-item-next, .carousel-item-prev', |
||||
|
INDICATORS: '.carousel-indicators', |
||||
|
DATA_SLIDE: '[data-slide], [data-slide-to]', |
||||
|
DATA_RIDE: '[data-ride="carousel"]' |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* 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._config = this._getConfig(config); |
||||
|
this._element = $(element)[0]; |
||||
|
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0]; |
||||
|
|
||||
|
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 && $(this._element).is(':visible') && $(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).find(Selector.NEXT_PREV)[0] && _util2.default.supportsTransitionEnd()) { |
||||
|
_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).find(Selector.ACTIVE_ITEM)[0]; |
||||
|
|
||||
|
var activeIndex = this._getItemIndex(this._activeElement); |
||||
|
|
||||
|
if (index > this._items.length - 1 || index < 0) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this._isSliding) { |
||||
|
$(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() { |
||||
|
$(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; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getConfig", |
||||
|
value: function _getConfig(config) { |
||||
|
config = _extends({}, Default, config); |
||||
|
|
||||
|
_util2.default.typeCheckConfig(NAME, config, DefaultType); |
||||
|
|
||||
|
return config; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_addEventListeners", |
||||
|
value: function _addEventListeners() { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
if (this._config.keyboard) { |
||||
|
$(this._element).on(Event.KEYDOWN, function (event) { |
||||
|
return _this2._keydown(event); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
if (this._config.pause === 'hover') { |
||||
|
$(this._element).on(Event.MOUSEENTER, function (event) { |
||||
|
return _this2.pause(event); |
||||
|
}).on(Event.MOUSELEAVE, function (event) { |
||||
|
return _this2.cycle(event); |
||||
|
}); |
||||
|
|
||||
|
if ('ontouchstart' in document.documentElement) { |
||||
|
// 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._element).on(Event.TOUCHEND, function () { |
||||
|
_this2.pause(); |
||||
|
|
||||
|
if (_this2.touchTimeout) { |
||||
|
clearTimeout(_this2.touchTimeout); |
||||
|
} |
||||
|
|
||||
|
_this2.touchTimeout = setTimeout(function (event) { |
||||
|
return _this2.cycle(event); |
||||
|
}, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
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 = $.makeArray($(element).parent().find(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).find(Selector.ACTIVE_ITEM)[0]); |
||||
|
|
||||
|
var slideEvent = $.Event(Event.SLIDE, { |
||||
|
relatedTarget: relatedTarget, |
||||
|
direction: eventDirectionName, |
||||
|
from: fromIndex, |
||||
|
to: targetIndex |
||||
|
}); |
||||
|
$(this._element).trigger(slideEvent); |
||||
|
return slideEvent; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_setActiveIndicatorElement", |
||||
|
value: function _setActiveIndicatorElement(element) { |
||||
|
if (this._indicatorsElement) { |
||||
|
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); |
||||
|
|
||||
|
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; |
||||
|
|
||||
|
if (nextIndicator) { |
||||
|
$(nextIndicator).addClass(ClassName.ACTIVE); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_slide", |
||||
|
value: function _slide(direction, element) { |
||||
|
var _this3 = this; |
||||
|
|
||||
|
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; |
||||
|
|
||||
|
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 && $(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 = $.Event(Event.SLID, { |
||||
|
relatedTarget: nextElement, |
||||
|
direction: eventDirectionName, |
||||
|
from: activeElementIndex, |
||||
|
to: nextElementIndex |
||||
|
}); |
||||
|
|
||||
|
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { |
||||
|
$(nextElement).addClass(orderClassName); |
||||
|
|
||||
|
_util2.default.reflow(nextElement); |
||||
|
|
||||
|
$(activeElement).addClass(directionalClassName); |
||||
|
$(nextElement).addClass(directionalClassName); |
||||
|
$(activeElement).one(_util2.default.TRANSITION_END, function () { |
||||
|
$(nextElement).removeClass("".concat(directionalClassName, " ").concat(orderClassName)).addClass(ClassName.ACTIVE); |
||||
|
$(activeElement).removeClass("".concat(ClassName.ACTIVE, " ").concat(orderClassName, " ").concat(directionalClassName)); |
||||
|
_this3._isSliding = false; |
||||
|
setTimeout(function () { |
||||
|
return $(_this3._element).trigger(slidEvent); |
||||
|
}, 0); |
||||
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} else { |
||||
|
$(activeElement).removeClass(ClassName.ACTIVE); |
||||
|
$(nextElement).addClass(ClassName.ACTIVE); |
||||
|
this._isSliding = false; |
||||
|
$(this._element).trigger(slidEvent); |
||||
|
} |
||||
|
|
||||
|
if (isCycling) { |
||||
|
this.cycle(); |
||||
|
} |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var data = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _config = _extends({}, Default, $(this).data()); |
||||
|
|
||||
|
if (_typeof(config) === 'object') { |
||||
|
_config = _extends({}, _config, config); |
||||
|
} |
||||
|
|
||||
|
var 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 \"".concat(action, "\"")); |
||||
|
} |
||||
|
|
||||
|
data[action](); |
||||
|
} else if (_config.interval) { |
||||
|
data.pause(); |
||||
|
data.cycle(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_dataApiClickHandler", |
||||
|
value: function _dataApiClickHandler(event) { |
||||
|
var selector = _util2.default.getSelectorFromElement(this); |
||||
|
|
||||
|
if (!selector) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var target = $(selector)[0]; |
||||
|
|
||||
|
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var config = _extends({}, $(target).data(), $(this).data()); |
||||
|
|
||||
|
var 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(); |
||||
|
} |
||||
|
}, { |
||||
|
key: "VERSION", |
||||
|
get: function get() { |
||||
|
return VERSION; |
||||
|
} |
||||
|
}, { |
||||
|
key: "Default", |
||||
|
get: function get() { |
||||
|
return Default; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return Carousel; |
||||
|
}(); |
||||
|
|
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Data Api implementation |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); |
||||
|
$(window).on(Event.LOAD_DATA_API, function () { |
||||
|
$(Selector.DATA_RIDE).each(function () { |
||||
|
var $carousel = $(this); |
||||
|
|
||||
|
Carousel._jQueryInterface.call($carousel, $carousel.data()); |
||||
|
}); |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Carousel._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Carousel; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Carousel._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Carousel; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Carousel; |
||||
|
}); |
@ -0,0 +1,455 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): collapse.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Collapse = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'collapse'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.collapse'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 600; |
||||
|
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 = $.makeArray($("[data-toggle=\"collapse\"][href=\"#".concat(element.id, "\"],") + "[data-toggle=\"collapse\"][data-target=\"#".concat(element.id, "\"]"))); |
||||
|
var tabToggles = $(Selector.DATA_TOGGLE); |
||||
|
|
||||
|
for (var i = 0; i < tabToggles.length; i++) { |
||||
|
var elem = tabToggles[i]; |
||||
|
|
||||
|
var selector = _util2.default.getSelectorFromElement(elem); |
||||
|
|
||||
|
if (selector !== null && $(selector).filter(element).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 ($(this._element).hasClass(ClassName.SHOW)) { |
||||
|
this.hide(); |
||||
|
} else { |
||||
|
this.show(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "show", |
||||
|
value: function show() { |
||||
|
var _this = this; |
||||
|
|
||||
|
if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var actives; |
||||
|
var activesData; |
||||
|
|
||||
|
if (this._parent) { |
||||
|
actives = $.makeArray($(this._parent).find(Selector.ACTIVES).filter("[data-parent=\"".concat(this._config.parent, "\"]"))); |
||||
|
|
||||
|
if (actives.length === 0) { |
||||
|
actives = null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (actives) { |
||||
|
activesData = $(actives).not(this._selector).data(DATA_KEY); |
||||
|
|
||||
|
if (activesData && activesData._isTransitioning) { |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var 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); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var dimension = this._getDimension(); |
||||
|
|
||||
|
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); |
||||
|
this._element.style[dimension] = 0; |
||||
|
|
||||
|
if (this._triggerArray.length > 0) { |
||||
|
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); |
||||
|
} |
||||
|
|
||||
|
this.setTransitioning(true); |
||||
|
|
||||
|
var complete = function complete() { |
||||
|
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); |
||||
|
_this._element.style[dimension] = ''; |
||||
|
|
||||
|
_this.setTransitioning(false); |
||||
|
|
||||
|
$(_this._element).trigger(Event.SHOWN); |
||||
|
}; |
||||
|
|
||||
|
if (!_util2.default.supportsTransitionEnd()) { |
||||
|
complete(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); |
||||
|
var scrollSize = "scroll".concat(capitalizedDimension); |
||||
|
$(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
this._element.style[dimension] = "".concat(this._element[scrollSize], "px"); |
||||
|
} |
||||
|
}, { |
||||
|
key: "hide", |
||||
|
value: function hide() { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var startEvent = $.Event(Event.HIDE); |
||||
|
$(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); |
||||
|
|
||||
|
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); |
||||
|
|
||||
|
if (this._triggerArray.length > 0) { |
||||
|
for (var i = 0; i < this._triggerArray.length; i++) { |
||||
|
var trigger = this._triggerArray[i]; |
||||
|
|
||||
|
var selector = _util2.default.getSelectorFromElement(trigger); |
||||
|
|
||||
|
if (selector !== null) { |
||||
|
var $elem = $(selector); |
||||
|
|
||||
|
if (!$elem.hasClass(ClassName.SHOW)) { |
||||
|
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
this.setTransitioning(true); |
||||
|
|
||||
|
var complete = function complete() { |
||||
|
_this2.setTransitioning(false); |
||||
|
|
||||
|
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); |
||||
|
}; |
||||
|
|
||||
|
this._element.style[dimension] = ''; |
||||
|
|
||||
|
if (!_util2.default.supportsTransitionEnd()) { |
||||
|
complete(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$(this._element).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} |
||||
|
}, { |
||||
|
key: "setTransitioning", |
||||
|
value: function setTransitioning(isTransitioning) { |
||||
|
this._isTransitioning = isTransitioning; |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function dispose() { |
||||
|
$.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 = _extends({}, 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 = $(this._element).hasClass(Dimension.WIDTH); |
||||
|
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getParent", |
||||
|
value: function _getParent() { |
||||
|
var _this3 = this; |
||||
|
|
||||
|
var parent = null; |
||||
|
|
||||
|
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 = $(this._config.parent)[0]; |
||||
|
} |
||||
|
|
||||
|
var selector = "[data-toggle=\"collapse\"][data-parent=\"".concat(this._config.parent, "\"]"); |
||||
|
$(parent).find(selector).each(function (i, element) { |
||||
|
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); |
||||
|
}); |
||||
|
return parent; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_addAriaAndCollapsedClass", |
||||
|
value: function _addAriaAndCollapsedClass(element, triggerArray) { |
||||
|
if (element) { |
||||
|
var isOpen = $(element).hasClass(ClassName.SHOW); |
||||
|
|
||||
|
if (triggerArray.length > 0) { |
||||
|
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_getTargetFromElement", |
||||
|
value: function _getTargetFromElement(element) { |
||||
|
var selector = _util2.default.getSelectorFromElement(element); |
||||
|
|
||||
|
return selector ? $(selector)[0] : null; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var $this = $(this); |
||||
|
var data = $this.data(DATA_KEY); |
||||
|
|
||||
|
var _config = _extends({}, Default, $this.data(), _typeof(config) === 'object' && 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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(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 = $(this); |
||||
|
|
||||
|
var selector = _util2.default.getSelectorFromElement(this); |
||||
|
|
||||
|
$(selector).each(function () { |
||||
|
var $target = $(this); |
||||
|
var data = $target.data(DATA_KEY); |
||||
|
var config = data ? 'toggle' : $trigger.data(); |
||||
|
|
||||
|
Collapse._jQueryInterface.call($target, config); |
||||
|
}); |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Collapse._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Collapse; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Collapse._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Collapse; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Collapse; |
||||
|
}); |
@ -0,0 +1,181 @@ |
|||||
|
// 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/>.
|
||||
|
|
||||
|
/** |
||||
|
* Contain the logic for a drawer. |
||||
|
* |
||||
|
* @package theme_ilb |
||||
|
* @copyright 2016 Damyon Wiese |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
*/ |
||||
|
define(['jquery', 'core/custom_interaction_events', 'core/log'], |
||||
|
function($, CustomEvents, Log) { |
||||
|
|
||||
|
var SELECTORS = { |
||||
|
TOGGLE_REGION: '[data-region="drawer-toggle"]', |
||||
|
TOGGLE_ACTION: '[data-action="toggle-drawer"]', |
||||
|
TOGGLE_TARGET: 'aria-controls', |
||||
|
TOGGLE_SIDE: 'left', |
||||
|
BODY: 'body', |
||||
|
SECTION: '.list-group-item[href*="#section-"]' |
||||
|
}; |
||||
|
|
||||
|
var small = $(document).width() < 768; |
||||
|
|
||||
|
/** |
||||
|
* Constructor for the Drawer. |
||||
|
* |
||||
|
* @param {object} root The root jQuery element for the modal |
||||
|
*/ |
||||
|
var Drawer = function() { |
||||
|
|
||||
|
if (!$(SELECTORS.TOGGLE_REGION).length) { |
||||
|
Log.debug('Page is missing a drawer region'); |
||||
|
} |
||||
|
if (!$(SELECTORS.TOGGLE_ACTION).length) { |
||||
|
Log.debug('Page is missing a drawer toggle link'); |
||||
|
} |
||||
|
$(SELECTORS.TOGGLE_REGION).each(function(index, ele) { |
||||
|
var trigger = $(ele).find(SELECTORS.TOGGLE_ACTION); |
||||
|
var drawerid = trigger.attr('aria-controls'); |
||||
|
var drawer = $(document.getElementById(drawerid)); |
||||
|
var hidden = trigger.attr('aria-expanded') == 'false'; |
||||
|
var side = trigger.attr('data-side'); |
||||
|
var body = $(SELECTORS.BODY); |
||||
|
var preference = trigger.attr('data-preference'); |
||||
|
if (small) { |
||||
|
M.util.set_user_preference(preference, 'false'); |
||||
|
} |
||||
|
|
||||
|
drawer.on('mousewheel DOMMouseScroll', this.preventPageScroll); |
||||
|
|
||||
|
if (!hidden) { |
||||
|
body.addClass('drawer-open-' + side); |
||||
|
trigger.attr('aria-expanded', 'true'); |
||||
|
} else { |
||||
|
trigger.attr('aria-expanded', 'false'); |
||||
|
} |
||||
|
}.bind(this)); |
||||
|
|
||||
|
this.registerEventListeners(); |
||||
|
if (small) { |
||||
|
this.closeAll(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
Drawer.prototype.closeAll = function() { |
||||
|
$(SELECTORS.TOGGLE_REGION).each(function(index, ele) { |
||||
|
var trigger = $(ele).find(SELECTORS.TOGGLE_ACTION); |
||||
|
var side = trigger.attr('data-side'); |
||||
|
var body = $(SELECTORS.BODY); |
||||
|
var drawerid = trigger.attr('aria-controls'); |
||||
|
var drawer = $(document.getElementById(drawerid)); |
||||
|
var preference = trigger.attr('data-preference'); |
||||
|
|
||||
|
trigger.attr('aria-expanded', 'false'); |
||||
|
body.removeClass('drawer-open-' + side); |
||||
|
drawer.attr('aria-hidden', 'true'); |
||||
|
drawer.addClass('closed'); |
||||
|
if (!small) { |
||||
|
M.util.set_user_preference(preference, 'false'); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Open / close the blocks drawer. |
||||
|
* |
||||
|
* @method toggleDrawer |
||||
|
* @param {Event} e |
||||
|
*/ |
||||
|
Drawer.prototype.toggleDrawer = function(e) { |
||||
|
var trigger = $(e.target).closest('[data-action=toggle-drawer]'); |
||||
|
var drawerid = trigger.attr('aria-controls'); |
||||
|
var drawer = $(document.getElementById(drawerid)); |
||||
|
var body = $(SELECTORS.BODY); |
||||
|
var side = trigger.attr('data-side'); |
||||
|
var preference = trigger.attr('data-preference'); |
||||
|
if (small) { |
||||
|
M.util.set_user_preference(preference, 'false'); |
||||
|
} |
||||
|
|
||||
|
body.addClass('drawer-ease'); |
||||
|
var open = trigger.attr('aria-expanded') == 'true'; |
||||
|
if (!open) { |
||||
|
// Open.
|
||||
|
trigger.attr('aria-expanded', 'true'); |
||||
|
drawer.attr('aria-hidden', 'false'); |
||||
|
drawer.focus(); |
||||
|
body.addClass('drawer-open-' + side); |
||||
|
drawer.removeClass('closed'); |
||||
|
if (!small) { |
||||
|
M.util.set_user_preference(preference, 'true'); |
||||
|
} |
||||
|
} else { |
||||
|
// Close.
|
||||
|
body.removeClass('drawer-open-' + side); |
||||
|
trigger.attr('aria-expanded', 'false'); |
||||
|
drawer.attr('aria-hidden', 'true'); |
||||
|
drawer.addClass('closed'); |
||||
|
if (!small) { |
||||
|
M.util.set_user_preference(preference, 'false'); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Prevent the page from scrolling when the drawer is at max scroll. |
||||
|
* |
||||
|
* @method preventPageScroll |
||||
|
* @param {Event} e |
||||
|
*/ |
||||
|
Drawer.prototype.preventPageScroll = function(e) { |
||||
|
var delta = e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta) || -e.originalEvent.detail, |
||||
|
bottomOverflow = (this.scrollTop + $(this).outerHeight() - this.scrollHeight) >= 0, |
||||
|
topOverflow = this.scrollTop <= 0; |
||||
|
|
||||
|
if ((delta < 0 && bottomOverflow) || (delta > 0 && topOverflow)) { |
||||
|
e.preventDefault(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
* Set up all of the event handling for the modal. |
||||
|
* |
||||
|
* @method registerEventListeners |
||||
|
*/ |
||||
|
Drawer.prototype.registerEventListeners = function() { |
||||
|
|
||||
|
$(SELECTORS.TOGGLE_ACTION).each(function(index, element) { |
||||
|
CustomEvents.define($(element), [CustomEvents.events.activate]); |
||||
|
$(element).on(CustomEvents.events.activate, function(e, data) { |
||||
|
this.toggleDrawer(data.originalEvent); |
||||
|
data.originalEvent.preventDefault(); |
||||
|
}.bind(this)); |
||||
|
}.bind(this)); |
||||
|
|
||||
|
$(SELECTORS.SECTION).click(function() { |
||||
|
if (small) { |
||||
|
this.closeAll(); |
||||
|
} |
||||
|
}.bind(this)); |
||||
|
}; |
||||
|
|
||||
|
return { |
||||
|
'init': function() { |
||||
|
return new Drawer(); |
||||
|
} |
||||
|
}; |
||||
|
}); |
@ -0,0 +1,549 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): dropdown.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Dropdown = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'dropdown'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.dropdown'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.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)' |
||||
|
}; |
||||
|
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: false, |
||||
|
boundary: 'scrollParent' |
||||
|
}; |
||||
|
var DefaultType = { |
||||
|
offset: '(number|string|function)', |
||||
|
flip: 'boolean', |
||||
|
boundary: '(string|element)' |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* 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 || $(this._element).hasClass(ClassName.DISABLED)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var parent = Dropdown._getParentFromElement(this._element); |
||||
|
|
||||
|
var isActive = $(this._menu).hasClass(ClassName.SHOW); |
||||
|
|
||||
|
Dropdown._clearMenus(); |
||||
|
|
||||
|
if (isActive) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var relatedTarget = { |
||||
|
relatedTarget: this._element |
||||
|
}; |
||||
|
var showEvent = $.Event(Event.SHOW, relatedTarget); |
||||
|
$(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 dropdown require Popper.js (https://popper.js.org)'); |
||||
|
} |
||||
|
|
||||
|
var element = this._element; // For dropup with alignment we use the parent as popper container
|
||||
|
|
||||
|
if ($(parent).hasClass(ClassName.DROPUP)) { |
||||
|
if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) { |
||||
|
element = parent; |
||||
|
} |
||||
|
} // 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(ClassName.POSITION_STATIC); |
||||
|
} |
||||
|
|
||||
|
this._popper = new _popper2.default(element, 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) { |
||||
|
$('body').children().on('mouseover', null, $.noop); |
||||
|
} |
||||
|
|
||||
|
this._element.focus(); |
||||
|
|
||||
|
this._element.setAttribute('aria-expanded', true); |
||||
|
|
||||
|
$(this._menu).toggleClass(ClassName.SHOW); |
||||
|
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function 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; |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "update", |
||||
|
value: function update() { |
||||
|
this._inNavbar = this._detectNavbar(); |
||||
|
|
||||
|
if (this._popper !== null) { |
||||
|
this._popper.scheduleUpdate(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_addEventListeners", |
||||
|
value: function _addEventListeners() { |
||||
|
var _this = this; |
||||
|
|
||||
|
$(this._element).on(Event.CLICK, function (event) { |
||||
|
event.preventDefault(); |
||||
|
event.stopPropagation(); |
||||
|
|
||||
|
_this.toggle(); |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getConfig", |
||||
|
value: function _getConfig(config) { |
||||
|
config = _extends({}, this.constructor.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); |
||||
|
|
||||
|
this._menu = $(parent).find(Selector.MENU)[0]; |
||||
|
} |
||||
|
|
||||
|
return this._menu; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getPlacement", |
||||
|
value: function _getPlacement() { |
||||
|
var $parentDropdown = $(this._element).parent(); |
||||
|
var placement = AttachmentMap.BOTTOM; // Handle dropup
|
||||
|
|
||||
|
if ($parentDropdown.hasClass(ClassName.DROPUP)) { |
||||
|
placement = AttachmentMap.TOP; |
||||
|
|
||||
|
if ($(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 ($(this._menu).hasClass(ClassName.MENURIGHT)) { |
||||
|
placement = AttachmentMap.BOTTOMEND; |
||||
|
} |
||||
|
|
||||
|
return placement; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_detectNavbar", |
||||
|
value: function _detectNavbar() { |
||||
|
return $(this._element).closest('.navbar').length > 0; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getPopperConfig", |
||||
|
value: function _getPopperConfig() { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
var offsetConf = {}; |
||||
|
|
||||
|
if (typeof this._config.offset === 'function') { |
||||
|
offsetConf.fn = function (data) { |
||||
|
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {}); |
||||
|
return data; |
||||
|
}; |
||||
|
} else { |
||||
|
offsetConf.offset = this._config.offset; |
||||
|
} |
||||
|
|
||||
|
var popperConfig = { |
||||
|
placement: this._getPlacement(), |
||||
|
modifiers: { |
||||
|
offset: offsetConf, |
||||
|
flip: { |
||||
|
enabled: this._config.flip |
||||
|
}, |
||||
|
preventOverflow: { |
||||
|
boundariesElement: this._config.boundary |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
return popperConfig; |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var data = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _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 \"".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 = $.makeArray($(Selector.DATA_TOGGLE)); |
||||
|
|
||||
|
for (var i = 0; i < toggles.length; i++) { |
||||
|
var parent = Dropdown._getParentFromElement(toggles[i]); |
||||
|
|
||||
|
var context = $(toggles[i]).data(DATA_KEY); |
||||
|
var relatedTarget = { |
||||
|
relatedTarget: toggles[i] |
||||
|
}; |
||||
|
|
||||
|
if (!context) { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
var dropdownMenu = context._menu; |
||||
|
|
||||
|
if (!$(parent).hasClass(ClassName.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; |
||||
|
} |
||||
|
|
||||
|
var 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) { |
||||
|
$('body').children().off('mouseover', null, $.noop); |
||||
|
} |
||||
|
|
||||
|
toggles[i].setAttribute('aria-expanded', 'false'); |
||||
|
$(dropdownMenu).removeClass(ClassName.SHOW); |
||||
|
$(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getParentFromElement", |
||||
|
value: function _getParentFromElement(element) { |
||||
|
var parent; |
||||
|
|
||||
|
var selector = _util2.default.getSelectorFromElement(element); |
||||
|
|
||||
|
if (selector) { |
||||
|
parent = $(selector)[0]; |
||||
|
} |
||||
|
|
||||
|
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 || $(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
event.preventDefault(); |
||||
|
event.stopPropagation(); |
||||
|
|
||||
|
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var parent = Dropdown._getParentFromElement(this); |
||||
|
|
||||
|
var isActive = $(parent).hasClass(ClassName.SHOW); |
||||
|
|
||||
|
if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { |
||||
|
if (event.which === ESCAPE_KEYCODE) { |
||||
|
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; |
||||
|
$(toggle).trigger('focus'); |
||||
|
} |
||||
|
|
||||
|
$(this).trigger('click'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var items = $(parent).find(Selector.VISIBLE_ITEMS).get(); |
||||
|
|
||||
|
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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(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($(this), 'toggle'); |
||||
|
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { |
||||
|
e.stopPropagation(); |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Dropdown._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Dropdown; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Dropdown._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Dropdown; |
||||
|
}(_jquery2.default, _popper2.default); |
||||
|
|
||||
|
exports.default = Dropdown; |
||||
|
}); |
@ -0,0 +1,65 @@ |
|||||
|
// 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/>.
|
||||
|
|
||||
|
/** |
||||
|
* Custom form error event handler to manipulate the bootstrap markup and show |
||||
|
* nicely styled errors in an mform. |
||||
|
* |
||||
|
* @module theme_ilb/form-display-errors |
||||
|
* @copyright 2016 Damyon Wiese <damyon@moodle.com> |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
*/ |
||||
|
define(['jquery', 'core/event'], function($, Event) { |
||||
|
return { |
||||
|
enhance: function(elementid) { |
||||
|
var element = document.getElementById(elementid); |
||||
|
$(element).on(Event.Events.FORM_FIELD_VALIDATION, function(event, msg) { |
||||
|
event.preventDefault(); |
||||
|
var parent = $(element).closest('.form-group'); |
||||
|
var feedback = parent.find('.form-control-feedback'); |
||||
|
|
||||
|
// Sometimes (atto) we have a hidden textarea backed by a real contenteditable div.
|
||||
|
if (($(element).prop("tagName") == 'TEXTAREA') && parent.find('[contenteditable]')) { |
||||
|
element = parent.find('[contenteditable]'); |
||||
|
} |
||||
|
if (msg !== '') { |
||||
|
parent.addClass('has-danger'); |
||||
|
parent.data('client-validation-error', true); |
||||
|
$(element).addClass('is-invalid'); |
||||
|
$(element).attr('aria-describedby', feedback.attr('id')); |
||||
|
$(element).attr('aria-invalid', true); |
||||
|
feedback.attr('tabindex', 0); |
||||
|
feedback.html(msg); |
||||
|
|
||||
|
// Only display and focus when the error was not already visible.
|
||||
|
if (!feedback.is(':visible')) { |
||||
|
feedback.show(); |
||||
|
feedback.focus(); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
if (parent.data('client-validation-error') === true) { |
||||
|
parent.removeClass('has-danger'); |
||||
|
parent.data('client-validation-error', false); |
||||
|
$(element).removeClass('is-invalid'); |
||||
|
$(element).removeAttr('aria-describedby'); |
||||
|
$(element).attr('aria-invalid', false); |
||||
|
feedback.hide(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
}); |
@ -0,0 +1,76 @@ |
|||||
|
// 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/>.
|
||||
|
|
||||
|
/** |
||||
|
* Template renderer for Moodle. Load and render Moodle templates with Mustache. |
||||
|
* |
||||
|
* @module core/templates |
||||
|
* @package core |
||||
|
* @class templates |
||||
|
* @copyright 2015 Damyon Wiese <damyon@moodle.com> |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
* @since 2.9 |
||||
|
*/ |
||||
|
define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) { |
||||
|
|
||||
|
window.jQuery = jQuery; |
||||
|
window.Tether = Tether; |
||||
|
|
||||
|
require(['theme_ilb/aria', |
||||
|
'theme_ilb/util', |
||||
|
'theme_ilb/alert', |
||||
|
'theme_ilb/button', |
||||
|
'theme_ilb/carousel', |
||||
|
'theme_ilb/collapse', |
||||
|
'theme_ilb/dropdown', |
||||
|
'theme_ilb/modal', |
||||
|
'theme_ilb/scrollspy', |
||||
|
'theme_ilb/tab', |
||||
|
'theme_ilb/tooltip', |
||||
|
'theme_ilb/popover'], |
||||
|
function(Aria) { |
||||
|
|
||||
|
// We do twice because: https://github.com/twbs/bootstrap/issues/10547
|
||||
|
jQuery('body').popover({ |
||||
|
trigger: 'focus', |
||||
|
selector: "[data-toggle=popover][data-trigger!=hover]" |
||||
|
}); |
||||
|
|
||||
|
jQuery("html").popover({ |
||||
|
container: "body", |
||||
|
selector: "[data-toggle=popover][data-trigger=hover]", |
||||
|
trigger: "hover", |
||||
|
delay: { |
||||
|
hide: 500 |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 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(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
return {}; |
||||
|
}); |
@ -0,0 +1,662 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): modal.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Modal = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'modal'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.modal'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 300; |
||||
|
var BACKDROP_TRANSITION_DURATION = 150; |
||||
|
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 = { |
||||
|
SCROLLBAR_MEASURER: 'modal-scrollbar-measure', |
||||
|
BACKDROP: 'modal-backdrop', |
||||
|
OPEN: 'modal-open', |
||||
|
FADE: 'fade', |
||||
|
SHOW: 'show' |
||||
|
}; |
||||
|
var Selector = { |
||||
|
DIALOG: '.modal-dialog', |
||||
|
DATA_TOGGLE: '[data-toggle="modal"]', |
||||
|
DATA_DISMISS: '[data-dismiss="modal"]', |
||||
|
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', |
||||
|
STICKY_CONTENT: '.sticky-top', |
||||
|
NAVBAR_TOGGLER: '.navbar-toggler' |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Class Definition |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
var Modal = function () { |
||||
|
function Modal(element, config) { |
||||
|
_classCallCheck(this, Modal); |
||||
|
|
||||
|
this._config = this._getConfig(config); |
||||
|
this._element = element; |
||||
|
this._dialog = $(element).find(Selector.DIALOG)[0]; |
||||
|
this._backdrop = null; |
||||
|
this._isShown = false; |
||||
|
this._isBodyOverflowing = false; |
||||
|
this._ignoreBackdropClick = false; |
||||
|
this._originalBodyPadding = 0; |
||||
|
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._isTransitioning || this._isShown) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { |
||||
|
this._isTransitioning = true; |
||||
|
} |
||||
|
|
||||
|
var showEvent = $.Event(Event.SHOW, { |
||||
|
relatedTarget: relatedTarget |
||||
|
}); |
||||
|
$(this._element).trigger(showEvent); |
||||
|
|
||||
|
if (this._isShown || showEvent.isDefaultPrevented()) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
this._isShown = true; |
||||
|
|
||||
|
this._checkScrollbar(); |
||||
|
|
||||
|
this._setScrollbar(); |
||||
|
|
||||
|
this._adjustDialog(); |
||||
|
|
||||
|
$(document.body).addClass(ClassName.OPEN); |
||||
|
|
||||
|
this._setEscapeEvent(); |
||||
|
|
||||
|
this._setResizeEvent(); |
||||
|
|
||||
|
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { |
||||
|
return _this.hide(event); |
||||
|
}); |
||||
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { |
||||
|
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { |
||||
|
if ($(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._isTransitioning || !this._isShown) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var hideEvent = $.Event(Event.HIDE); |
||||
|
$(this._element).trigger(hideEvent); |
||||
|
|
||||
|
if (!this._isShown || hideEvent.isDefaultPrevented()) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
this._isShown = false; |
||||
|
var transition = _util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); |
||||
|
|
||||
|
if (transition) { |
||||
|
this._isTransitioning = true; |
||||
|
} |
||||
|
|
||||
|
this._setEscapeEvent(); |
||||
|
|
||||
|
this._setResizeEvent(); |
||||
|
|
||||
|
$(document).off(Event.FOCUSIN); |
||||
|
$(this._element).removeClass(ClassName.SHOW); |
||||
|
$(this._element).off(Event.CLICK_DISMISS); |
||||
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS); |
||||
|
|
||||
|
if (transition) { |
||||
|
$(this._element).one(_util2.default.TRANSITION_END, function (event) { |
||||
|
return _this2._hideModal(event); |
||||
|
}).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} else { |
||||
|
this._hideModal(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function dispose() { |
||||
|
$.removeData(this._element, DATA_KEY); |
||||
|
$(window, document, this._element, this._backdrop).off(EVENT_KEY); |
||||
|
this._config = null; |
||||
|
this._element = null; |
||||
|
this._dialog = null; |
||||
|
this._backdrop = null; |
||||
|
this._isShown = null; |
||||
|
this._isBodyOverflowing = null; |
||||
|
this._ignoreBackdropClick = null; |
||||
|
this._scrollbarWidth = null; |
||||
|
} |
||||
|
}, { |
||||
|
key: "handleUpdate", |
||||
|
value: function handleUpdate() { |
||||
|
this._adjustDialog(); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getConfig", |
||||
|
value: function _getConfig(config) { |
||||
|
config = _extends({}, Default, config); |
||||
|
|
||||
|
_util2.default.typeCheckConfig(NAME, config, DefaultType); |
||||
|
|
||||
|
return config; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_showElement", |
||||
|
value: function _showElement(relatedTarget) { |
||||
|
var _this3 = this; |
||||
|
|
||||
|
var transition = _util2.default.supportsTransitionEnd() && $(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.scrollTop = 0; |
||||
|
|
||||
|
if (transition) { |
||||
|
_util2.default.reflow(this._element); |
||||
|
} |
||||
|
|
||||
|
$(this._element).addClass(ClassName.SHOW); |
||||
|
|
||||
|
if (this._config.focus) { |
||||
|
this._enforceFocus(); |
||||
|
} |
||||
|
|
||||
|
var shownEvent = $.Event(Event.SHOWN, { |
||||
|
relatedTarget: relatedTarget |
||||
|
}); |
||||
|
|
||||
|
var transitionComplete = function transitionComplete() { |
||||
|
if (_this3._config.focus) { |
||||
|
_this3._element.focus(); |
||||
|
} |
||||
|
|
||||
|
_this3._isTransitioning = false; |
||||
|
$(_this3._element).trigger(shownEvent); |
||||
|
}; |
||||
|
|
||||
|
if (transition) { |
||||
|
$(this._dialog).one(_util2.default.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} else { |
||||
|
transitionComplete(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_enforceFocus", |
||||
|
value: function _enforceFocus() { |
||||
|
var _this4 = this; |
||||
|
|
||||
|
$(document).off(Event.FOCUSIN) // Guard against infinite focus loop
|
||||
|
.on(Event.FOCUSIN, function (event) { |
||||
|
if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { |
||||
|
_this4._element.focus(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_setEscapeEvent", |
||||
|
value: function _setEscapeEvent() { |
||||
|
var _this5 = this; |
||||
|
|
||||
|
if (this._isShown && this._config.keyboard) { |
||||
|
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) { |
||||
|
if (event.which === ESCAPE_KEYCODE) { |
||||
|
event.preventDefault(); |
||||
|
|
||||
|
_this5.hide(); |
||||
|
} |
||||
|
}); |
||||
|
} else if (!this._isShown) { |
||||
|
$(this._element).off(Event.KEYDOWN_DISMISS); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_setResizeEvent", |
||||
|
value: function _setResizeEvent() { |
||||
|
var _this6 = this; |
||||
|
|
||||
|
if (this._isShown) { |
||||
|
$(window).on(Event.RESIZE, function (event) { |
||||
|
return _this6.handleUpdate(event); |
||||
|
}); |
||||
|
} else { |
||||
|
$(window).off(Event.RESIZE); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_hideModal", |
||||
|
value: function _hideModal() { |
||||
|
var _this7 = this; |
||||
|
|
||||
|
this._element.style.display = 'none'; |
||||
|
|
||||
|
this._element.setAttribute('aria-hidden', true); |
||||
|
|
||||
|
this._isTransitioning = false; |
||||
|
|
||||
|
this._showBackdrop(function () { |
||||
|
$(document.body).removeClass(ClassName.OPEN); |
||||
|
|
||||
|
_this7._resetAdjustments(); |
||||
|
|
||||
|
_this7._resetScrollbar(); |
||||
|
|
||||
|
$(_this7._element).trigger(Event.HIDDEN); |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_removeBackdrop", |
||||
|
value: function _removeBackdrop() { |
||||
|
if (this._backdrop) { |
||||
|
$(this._backdrop).remove(); |
||||
|
this._backdrop = null; |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_showBackdrop", |
||||
|
value: function _showBackdrop(callback) { |
||||
|
var _this8 = this; |
||||
|
|
||||
|
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; |
||||
|
|
||||
|
if (this._isShown && this._config.backdrop) { |
||||
|
var doAnimate = _util2.default.supportsTransitionEnd() && animate; |
||||
|
this._backdrop = document.createElement('div'); |
||||
|
this._backdrop.className = ClassName.BACKDROP; |
||||
|
|
||||
|
if (animate) { |
||||
|
$(this._backdrop).addClass(animate); |
||||
|
} |
||||
|
|
||||
|
$(this._backdrop).appendTo(document.body); |
||||
|
$(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 (doAnimate) { |
||||
|
_util2.default.reflow(this._backdrop); |
||||
|
} |
||||
|
|
||||
|
$(this._backdrop).addClass(ClassName.SHOW); |
||||
|
|
||||
|
if (!callback) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (!doAnimate) { |
||||
|
callback(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$(this._backdrop).one(_util2.default.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); |
||||
|
} else if (!this._isShown && this._backdrop) { |
||||
|
$(this._backdrop).removeClass(ClassName.SHOW); |
||||
|
|
||||
|
var callbackRemove = function callbackRemove() { |
||||
|
_this8._removeBackdrop(); |
||||
|
|
||||
|
if (callback) { |
||||
|
callback(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
if (_util2.default.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { |
||||
|
$(this._backdrop).one(_util2.default.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); |
||||
|
} 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
|
||||
|
// Adjust fixed content padding
|
||||
|
$(Selector.FIXED_CONTENT).each(function (index, element) { |
||||
|
var actualPadding = $(element)[0].style.paddingRight; |
||||
|
var calculatedPadding = $(element).css('padding-right'); |
||||
|
$(element).data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + _this9._scrollbarWidth, "px")); |
||||
|
}); // Adjust sticky content margin
|
||||
|
|
||||
|
$(Selector.STICKY_CONTENT).each(function (index, element) { |
||||
|
var actualMargin = $(element)[0].style.marginRight; |
||||
|
var calculatedMargin = $(element).css('margin-right'); |
||||
|
$(element).data('margin-right', actualMargin).css('margin-right', "".concat(parseFloat(calculatedMargin) - _this9._scrollbarWidth, "px")); |
||||
|
}); // Adjust navbar-toggler margin
|
||||
|
|
||||
|
$(Selector.NAVBAR_TOGGLER).each(function (index, element) { |
||||
|
var actualMargin = $(element)[0].style.marginRight; |
||||
|
var calculatedMargin = $(element).css('margin-right'); |
||||
|
$(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 = $('body').css('padding-right'); |
||||
|
$('body').data('padding-right', actualPadding).css('padding-right', "".concat(parseFloat(calculatedPadding) + this._scrollbarWidth, "px")); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_resetScrollbar", |
||||
|
value: function _resetScrollbar() { |
||||
|
// Restore fixed content padding
|
||||
|
$(Selector.FIXED_CONTENT).each(function (index, element) { |
||||
|
var padding = $(element).data('padding-right'); |
||||
|
|
||||
|
if (typeof padding !== 'undefined') { |
||||
|
$(element).css('padding-right', padding).removeData('padding-right'); |
||||
|
} |
||||
|
}); // Restore sticky content and navbar-toggler margin
|
||||
|
|
||||
|
$("".concat(Selector.STICKY_CONTENT, ", ").concat(Selector.NAVBAR_TOGGLER)).each(function (index, element) { |
||||
|
var margin = $(element).data('margin-right'); |
||||
|
|
||||
|
if (typeof margin !== 'undefined') { |
||||
|
$(element).css('margin-right', margin).removeData('margin-right'); |
||||
|
} |
||||
|
}); // Restore body padding
|
||||
|
|
||||
|
var padding = $('body').data('padding-right'); |
||||
|
|
||||
|
if (typeof padding !== 'undefined') { |
||||
|
$('body').css('padding-right', padding).removeData('padding-right'); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
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 = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _config = _extends({}, Modal.Default, $(this).data(), _typeof(config) === 'object' && 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 \"".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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(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 = $(selector)[0]; |
||||
|
} |
||||
|
|
||||
|
var config = $(target).data(DATA_KEY) ? 'toggle' : _extends({}, $(target).data(), $(this).data()); |
||||
|
|
||||
|
if (this.tagName === 'A' || this.tagName === 'AREA') { |
||||
|
event.preventDefault(); |
||||
|
} |
||||
|
|
||||
|
var $target = $(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 ($(_this10).is(':visible')) { |
||||
|
_this10.focus(); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
Modal._jQueryInterface.call($(target), config, this); |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = Modal._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Modal; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Modal._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Modal; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Modal; |
||||
|
}); |
@ -0,0 +1,120 @@ |
|||||
|
// 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/>.
|
||||
|
|
||||
|
/** |
||||
|
* Add Pending JS checks to stock Bootstrap transitions. |
||||
|
* |
||||
|
* @module theme_boost/pending |
||||
|
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk> |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
*/ |
||||
|
define(['jquery'], function($) { |
||||
|
var moduleTransitions = { |
||||
|
alert: [ |
||||
|
// Alert.
|
||||
|
{ |
||||
|
start: 'close', |
||||
|
end: 'closed', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
carousel: [ |
||||
|
{ |
||||
|
start: 'slide', |
||||
|
end: 'slid', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
collapse: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
dropdown: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
modal: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
popover: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
tab: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
tooltip: [ |
||||
|
{ |
||||
|
start: 'hide', |
||||
|
end: 'hidden', |
||||
|
}, |
||||
|
{ |
||||
|
start: 'show', |
||||
|
end: 'shown', |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
|
||||
|
Object.keys(moduleTransitions).forEach(function(key) { |
||||
|
moduleTransitions[key].forEach(function(pair) { |
||||
|
var eventStart = pair.start + '.bs.' + key; |
||||
|
var eventEnd = pair.end + '.bs.' + key; |
||||
|
$(document.body).on(eventStart, function() { |
||||
|
M.util.js_pending(eventEnd); |
||||
|
}); |
||||
|
|
||||
|
$(document.body).on(eventEnd, function() { |
||||
|
M.util.js_complete(eventEnd); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
@ -0,0 +1,297 @@ |
|||||
|
define(["exports", "jquery", "./tooltip"], function (exports, _jquery, _tooltip) { |
||||
|
"use strict"; |
||||
|
|
||||
|
Object.defineProperty(exports, "__esModule", { |
||||
|
value: true |
||||
|
}); |
||||
|
|
||||
|
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; |
||||
|
} |
||||
|
|
||||
|
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, |
||||
|
enumerable: false, |
||||
|
writable: true, |
||||
|
configurable: true |
||||
|
} |
||||
|
}); |
||||
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; |
||||
|
} |
||||
|
|
||||
|
function _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): popover.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Popover = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'popover'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.popover'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var CLASS_PREFIX = 'bs-popover'; |
||||
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g'); |
||||
|
|
||||
|
var Default = _extends({}, _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 = _extends({}, _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) { |
||||
|
$(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment)); |
||||
|
} |
||||
|
}, { |
||||
|
key: "getTipElement", |
||||
|
value: function getTipElement() { |
||||
|
this.tip = this.tip || $(this.config.template)[0]; |
||||
|
return this.tip; |
||||
|
} |
||||
|
}, { |
||||
|
key: "setContent", |
||||
|
value: function setContent() { |
||||
|
var $tip = $(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 = $(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 = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _config = _typeof(config) === 'object' ? config : null; |
||||
|
|
||||
|
if (!data && /destroy|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 \"".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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$.fn[NAME] = Popover._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Popover; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Popover._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Popover; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Popover; |
||||
|
}); |
@ -0,0 +1,390 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): scrollspy.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var ScrollSpy = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'scrollspy'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.scrollspy'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.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; |
||||
|
$(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 = $.makeArray($(this._selector)); |
||||
|
targets.map(function (element) { |
||||
|
var target; |
||||
|
|
||||
|
var targetSelector = _util2.default.getSelectorFromElement(element); |
||||
|
|
||||
|
if (targetSelector) { |
||||
|
target = $(targetSelector)[0]; |
||||
|
} |
||||
|
|
||||
|
if (target) { |
||||
|
var 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(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() { |
||||
|
$.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; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_getConfig", |
||||
|
value: function _getConfig(config) { |
||||
|
config = _extends({}, Default, config); |
||||
|
|
||||
|
if (typeof config.target !== 'string') { |
||||
|
var id = $(config.target).attr('id'); |
||||
|
|
||||
|
if (!id) { |
||||
|
id = _util2.default.getUID(NAME); |
||||
|
$(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; |
||||
|
} |
||||
|
|
||||
|
for (var i = this._offsets.length; 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(','); // eslint-disable-next-line arrow-body-style
|
||||
|
|
||||
|
|
||||
|
queries = queries.map(function (selector) { |
||||
|
return "".concat(selector, "[data-target=\"").concat(target, "\"],") + "".concat(selector, "[href=\"").concat(target, "\"]"); |
||||
|
}); |
||||
|
var $link = $(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); |
||||
|
} |
||||
|
|
||||
|
$(this._scrollElement).trigger(Event.ACTIVATE, { |
||||
|
relatedTarget: target |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_clear", |
||||
|
value: function _clear() { |
||||
|
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var data = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _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 \"".concat(config, "\"")); |
||||
|
} |
||||
|
|
||||
|
data[config](); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: "VERSION", |
||||
|
get: function get() { |
||||
|
return VERSION; |
||||
|
} |
||||
|
}, { |
||||
|
key: "Default", |
||||
|
get: function get() { |
||||
|
return Default; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return ScrollSpy; |
||||
|
}(); |
||||
|
|
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Data Api implementation |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(window).on(Event.LOAD_DATA_API, function () { |
||||
|
var scrollSpys = $.makeArray($(Selector.DATA_SPY)); |
||||
|
|
||||
|
for (var i = scrollSpys.length; i--;) { |
||||
|
var $spy = $(scrollSpys[i]); |
||||
|
|
||||
|
ScrollSpy._jQueryInterface.call($spy, $spy.data()); |
||||
|
} |
||||
|
}); |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* jQuery |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
|
||||
|
$.fn[NAME] = ScrollSpy._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = ScrollSpy; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return ScrollSpy._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return ScrollSpy; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = ScrollSpy; |
||||
|
}); |
@ -0,0 +1,289 @@ |
|||||
|
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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): tab.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Tab = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'tab'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.tab'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var DATA_API_KEY = '.data-api'; |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 150; |
||||
|
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 && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var target; |
||||
|
var previous; |
||||
|
var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]; |
||||
|
|
||||
|
var selector = _util2.default.getSelectorFromElement(this._element); |
||||
|
|
||||
|
if (listElement) { |
||||
|
var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; |
||||
|
previous = $.makeArray($(listElement).find(itemSelector)); |
||||
|
previous = previous[previous.length - 1]; |
||||
|
} |
||||
|
|
||||
|
var hideEvent = $.Event(Event.HIDE, { |
||||
|
relatedTarget: this._element |
||||
|
}); |
||||
|
var showEvent = $.Event(Event.SHOW, { |
||||
|
relatedTarget: previous |
||||
|
}); |
||||
|
|
||||
|
if (previous) { |
||||
|
$(previous).trigger(hideEvent); |
||||
|
} |
||||
|
|
||||
|
$(this._element).trigger(showEvent); |
||||
|
|
||||
|
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (selector) { |
||||
|
target = $(selector)[0]; |
||||
|
} |
||||
|
|
||||
|
this._activate(this._element, listElement); |
||||
|
|
||||
|
var complete = function complete() { |
||||
|
var hiddenEvent = $.Event(Event.HIDDEN, { |
||||
|
relatedTarget: _this._element |
||||
|
}); |
||||
|
var shownEvent = $.Event(Event.SHOWN, { |
||||
|
relatedTarget: previous |
||||
|
}); |
||||
|
$(previous).trigger(hiddenEvent); |
||||
|
$(_this._element).trigger(shownEvent); |
||||
|
}; |
||||
|
|
||||
|
if (target) { |
||||
|
this._activate(target, target.parentNode, complete); |
||||
|
} else { |
||||
|
complete(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function dispose() { |
||||
|
$.removeData(this._element, DATA_KEY); |
||||
|
this._element = null; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_activate", |
||||
|
value: function _activate(element, container, callback) { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
var activeElements; |
||||
|
|
||||
|
if (container.nodeName === 'UL') { |
||||
|
activeElements = $(container).find(Selector.ACTIVE_UL); |
||||
|
} else { |
||||
|
activeElements = $(container).children(Selector.ACTIVE); |
||||
|
} |
||||
|
|
||||
|
var active = activeElements[0]; |
||||
|
var isTransitioning = callback && _util2.default.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE); |
||||
|
|
||||
|
var complete = function complete() { |
||||
|
return _this2._transitionComplete(element, active, callback); |
||||
|
}; |
||||
|
|
||||
|
if (active && isTransitioning) { |
||||
|
$(active).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} else { |
||||
|
complete(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_transitionComplete", |
||||
|
value: function _transitionComplete(element, active, callback) { |
||||
|
if (active) { |
||||
|
$(active).removeClass("".concat(ClassName.SHOW, " ").concat(ClassName.ACTIVE)); |
||||
|
var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; |
||||
|
|
||||
|
if (dropdownChild) { |
||||
|
$(dropdownChild).removeClass(ClassName.ACTIVE); |
||||
|
} |
||||
|
|
||||
|
if (active.getAttribute('role') === 'tab') { |
||||
|
active.setAttribute('aria-selected', false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$(element).addClass(ClassName.ACTIVE); |
||||
|
|
||||
|
if (element.getAttribute('role') === 'tab') { |
||||
|
element.setAttribute('aria-selected', true); |
||||
|
} |
||||
|
|
||||
|
_util2.default.reflow(element); |
||||
|
|
||||
|
$(element).addClass(ClassName.SHOW); |
||||
|
|
||||
|
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { |
||||
|
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; |
||||
|
|
||||
|
if (dropdownElement) { |
||||
|
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); |
||||
|
} |
||||
|
|
||||
|
element.setAttribute('aria-expanded', true); |
||||
|
} |
||||
|
|
||||
|
if (callback) { |
||||
|
callback(); |
||||
|
} |
||||
|
} |
||||
|
}], [{ |
||||
|
key: "_jQueryInterface", |
||||
|
value: function _jQueryInterface(config) { |
||||
|
return this.each(function () { |
||||
|
var $this = $(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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$(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 = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Tab._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Tab; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Tab; |
||||
|
}); |
File diff suppressed because it is too large
@ -0,0 +1,762 @@ |
|||||
|
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 _extends() { |
||||
|
_extends = Object.assign || function (target) { |
||||
|
for (var i = 1; i < arguments.length; i++) { |
||||
|
var source = arguments[i]; |
||||
|
|
||||
|
for (var key in source) { |
||||
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
||||
|
target[key] = source[key]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return target; |
||||
|
}; |
||||
|
|
||||
|
return _extends.apply(this, arguments); |
||||
|
} |
||||
|
|
||||
|
function _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; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* Bootstrap (v4.0.0): tooltip.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Tooltip = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Constants |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var NAME = 'tooltip'; |
||||
|
var VERSION = '4.0.0'; |
||||
|
var DATA_KEY = 'bs.tooltip'; |
||||
|
var EVENT_KEY = ".".concat(DATA_KEY); |
||||
|
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
||||
|
var TRANSITION_DURATION = 150; |
||||
|
var CLASS_PREFIX = 'bs-tooltip'; |
||||
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)".concat(CLASS_PREFIX, "\\S+"), 'g'); |
||||
|
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)', |
||||
|
container: '(string|element|boolean)', |
||||
|
fallbackPlacement: '(string|array)', |
||||
|
boundary: '(string|element)' |
||||
|
}; |
||||
|
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' |
||||
|
}; |
||||
|
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 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 = $(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(ClassName.SHOW)) { |
||||
|
this._leave(null, this); |
||||
|
|
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
this._enter(null, this); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "dispose", |
||||
|
value: function 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'); |
||||
|
|
||||
|
if (this.tip) { |
||||
|
$(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 ($(this.element).css('display') === 'none') { |
||||
|
throw new Error('Please use show on visible elements'); |
||||
|
} |
||||
|
|
||||
|
var showEvent = $.Event(this.constructor.Event.SHOW); |
||||
|
|
||||
|
if (this.isWithContent() && this._isEnabled) { |
||||
|
$(this.element).trigger(showEvent); |
||||
|
var isInTheDom = $.contains(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) { |
||||
|
$(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.config.container === false ? document.body : $(this.config.container); |
||||
|
$(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 _popper2.default(this.element, tip, { |
||||
|
placement: attachment, |
||||
|
modifiers: { |
||||
|
offset: { |
||||
|
offset: this.config.offset |
||||
|
}, |
||||
|
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) { |
||||
|
_this._handlePopperPlacementChange(data); |
||||
|
} |
||||
|
}); |
||||
|
$(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) { |
||||
|
$('body').children().on('mouseover', null, $.noop); |
||||
|
} |
||||
|
|
||||
|
var complete = function complete() { |
||||
|
if (_this.config.animation) { |
||||
|
_this._fixTransition(); |
||||
|
} |
||||
|
|
||||
|
var prevHoverState = _this._hoverState; |
||||
|
_this._hoverState = null; |
||||
|
$(_this.element).trigger(_this.constructor.Event.SHOWN); |
||||
|
|
||||
|
if (prevHoverState === HoverState.OUT) { |
||||
|
_this._leave(null, _this); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
if (_util2.default.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { |
||||
|
$(this.tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); |
||||
|
} else { |
||||
|
complete(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "hide", |
||||
|
value: function hide(callback) { |
||||
|
var _this2 = this; |
||||
|
|
||||
|
var tip = this.getTipElement(); |
||||
|
var hideEvent = $.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'); |
||||
|
|
||||
|
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN); |
||||
|
|
||||
|
if (_this2._popper !== null) { |
||||
|
_this2._popper.destroy(); |
||||
|
} |
||||
|
|
||||
|
if (callback) { |
||||
|
callback(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
$(this.element).trigger(hideEvent); |
||||
|
|
||||
|
if (hideEvent.isDefaultPrevented()) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$(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) { |
||||
|
$('body').children().off('mouseover', null, $.noop); |
||||
|
} |
||||
|
|
||||
|
this._activeTrigger[Trigger.CLICK] = false; |
||||
|
this._activeTrigger[Trigger.FOCUS] = false; |
||||
|
this._activeTrigger[Trigger.HOVER] = false; |
||||
|
|
||||
|
if (_util2.default.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { |
||||
|
$(tip).one(_util2.default.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); |
||||
|
} 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) { |
||||
|
$(this.getTipElement()).addClass("".concat(CLASS_PREFIX, "-").concat(attachment)); |
||||
|
} |
||||
|
}, { |
||||
|
key: "getTipElement", |
||||
|
value: function getTipElement() { |
||||
|
this.tip = this.tip || $(this.config.template)[0]; |
||||
|
return this.tip; |
||||
|
} |
||||
|
}, { |
||||
|
key: "setContent", |
||||
|
value: function setContent() { |
||||
|
var $tip = $(this.getTipElement()); |
||||
|
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); |
||||
|
$tip.removeClass("".concat(ClassName.FADE, " ").concat(ClassName.SHOW)); |
||||
|
} |
||||
|
}, { |
||||
|
key: "setElementContent", |
||||
|
value: function setElementContent($element, content) { |
||||
|
var html = this.config.html; |
||||
|
|
||||
|
if (_typeof(content) === 'object' && (content.nodeType || content.jquery)) { |
||||
|
// Content is a DOM node or a jQuery
|
||||
|
if (html) { |
||||
|
if (!$(content).parent().is($element)) { |
||||
|
$element.empty().append(content); |
||||
|
} |
||||
|
} else { |
||||
|
$element.text($(content).text()); |
||||
|
} |
||||
|
} else { |
||||
|
$element[html ? 'html' : '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: "_getAttachment", |
||||
|
value: function _getAttachment(placement) { |
||||
|
return AttachmentMap[placement.toUpperCase()]; |
||||
|
} |
||||
|
}, { |
||||
|
key: "_setListeners", |
||||
|
value: function _setListeners() { |
||||
|
var _this3 = this; |
||||
|
|
||||
|
var triggers = this.config.trigger.split(' '); |
||||
|
triggers.forEach(function (trigger) { |
||||
|
if (trigger === 'click') { |
||||
|
$(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) { |
||||
|
return _this3.toggle(event); |
||||
|
}); |
||||
|
} else if (trigger !== Trigger.MANUAL) { |
||||
|
var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; |
||||
|
var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; |
||||
|
$(_this3.element).on(eventIn, _this3.config.selector, function (event) { |
||||
|
return _this3._enter(event); |
||||
|
}).on(eventOut, _this3.config.selector, function (event) { |
||||
|
return _this3._leave(event); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
$(_this3.element).closest('.modal').on('hide.bs.modal', function () { |
||||
|
return _this3.hide(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
if (this.config.selector) { |
||||
|
this.config = _extends({}, 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 || $(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(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 || $(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 = 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) { |
||||
|
config = _extends({}, this.constructor.Default, $(this.element).data(), 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); |
||||
|
|
||||
|
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 = $(this.getTipElement()); |
||||
|
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
||||
|
|
||||
|
if (tabClass !== null && tabClass.length > 0) { |
||||
|
$tip.removeClass(tabClass.join('')); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: "_handlePopperPlacementChange", |
||||
|
value: function _handlePopperPlacementChange(data) { |
||||
|
this._cleanTipClass(); |
||||
|
|
||||
|
this.addAttachmentClass(this._getAttachment(data.placement)); |
||||
|
} |
||||
|
}, { |
||||
|
key: "_fixTransition", |
||||
|
value: function _fixTransition() { |
||||
|
var tip = this.getTipElement(); |
||||
|
var initConfigAnimation = this.config.animation; |
||||
|
|
||||
|
if (tip.getAttribute('x-placement') !== null) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$(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 = $(this).data(DATA_KEY); |
||||
|
|
||||
|
var _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 \"".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 |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
$.fn[NAME] = Tooltip._jQueryInterface; |
||||
|
$.fn[NAME].Constructor = Tooltip; |
||||
|
|
||||
|
$.fn[NAME].noConflict = function () { |
||||
|
$.fn[NAME] = JQUERY_NO_CONFLICT; |
||||
|
return Tooltip._jQueryInterface; |
||||
|
}; |
||||
|
|
||||
|
return Tooltip; |
||||
|
}(_jquery2.default, _popper2.default); |
||||
|
|
||||
|
exports.default = Tooltip; |
||||
|
}); |
@ -0,0 +1,156 @@ |
|||||
|
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.0.0): util.js |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
|
* -------------------------------------------------------------------------- |
||||
|
*/ |
||||
|
var Util = function ($) { |
||||
|
/** |
||||
|
* ------------------------------------------------------------------------ |
||||
|
* Private TransitionEnd Helpers |
||||
|
* ------------------------------------------------------------------------ |
||||
|
*/ |
||||
|
var transition = false; |
||||
|
var MAX_UID = 1000000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
|
||||
|
function toType(obj) { |
||||
|
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); |
||||
|
} |
||||
|
|
||||
|
function getSpecialTransitionEndEvent() { |
||||
|
return { |
||||
|
bindType: transition.end, |
||||
|
delegateType: transition.end, |
||||
|
handle: function handle(event) { |
||||
|
if ($(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 transitionEndTest() { |
||||
|
if (typeof window !== 'undefined' && window.QUnit) { |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
end: 'transitionend' |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
function transitionEndEmulator(duration) { |
||||
|
var _this = this; |
||||
|
|
||||
|
var called = false; |
||||
|
$(this).one(Util.TRANSITION_END, function () { |
||||
|
called = true; |
||||
|
}); |
||||
|
setTimeout(function () { |
||||
|
if (!called) { |
||||
|
Util.triggerTransitionEnd(_this); |
||||
|
} |
||||
|
}, duration); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
function setTransitionEndSupport() { |
||||
|
transition = transitionEndTest(); |
||||
|
$.fn.emulateTransitionEnd = transitionEndEmulator; |
||||
|
|
||||
|
if (Util.supportsTransitionEnd()) { |
||||
|
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function escapeId(selector) { |
||||
|
// We escape IDs in case of special selectors (selector = '#myId:something')
|
||||
|
// $.escapeSelector does not exist in jQuery < 3
|
||||
|
selector = typeof $.escapeSelector === 'function' ? $.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1'); |
||||
|
return selector; |
||||
|
} |
||||
|
/** |
||||
|
* -------------------------------------------------------------------------- |
||||
|
* 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 === '#') { |
||||
|
selector = element.getAttribute('href') || ''; |
||||
|
} // If it's an ID
|
||||
|
|
||||
|
|
||||
|
if (selector.charAt(0) === '#') { |
||||
|
selector = escapeId(selector); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
var $selector = $(document).find(selector); |
||||
|
return $selector.length > 0 ? selector : null; |
||||
|
} catch (err) { |
||||
|
return null; |
||||
|
} |
||||
|
}, |
||||
|
reflow: function reflow(element) { |
||||
|
return element.offsetHeight; |
||||
|
}, |
||||
|
triggerTransitionEnd: function triggerTransitionEnd(element) { |
||||
|
$(element).trigger(transition.end); |
||||
|
}, |
||||
|
supportsTransitionEnd: function supportsTransitionEnd() { |
||||
|
return Boolean(transition); |
||||
|
}, |
||||
|
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, "\".")); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
setTransitionEndSupport(); |
||||
|
return Util; |
||||
|
}(_jquery2.default); |
||||
|
|
||||
|
exports.default = Util; |
||||
|
}); |
@ -1,50 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
/** |
|
||||
* Overriden block settings renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
namespace theme_boost\output; |
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
require_once($CFG->dirroot . '/blocks/settings/renderer.php'); |
|
||||
|
|
||||
use moodle_url; |
|
||||
|
|
||||
/** |
|
||||
* Overriden block settings renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class block_settings_renderer extends \block_settings_renderer { |
|
||||
|
|
||||
public function search_form(moodle_url $formtarget, $searchvalue) { |
|
||||
$data = [ |
|
||||
'action' => $formtarget->out(false), |
|
||||
'label' => get_string('searchinsettings', 'admin'), |
|
||||
'searchvalue' => $searchvalue |
|
||||
]; |
|
||||
return $this->render_from_template('block_settings/search_form', $data); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,52 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
/** |
|
||||
* Admin renderer. |
|
||||
* |
|
||||
* @package theme_noanme |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
namespace theme_boost\output\core; |
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
use moodle_url; |
|
||||
|
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/renderer.php'); |
|
||||
|
|
||||
/** |
|
||||
* Admin renderer class. |
|
||||
* |
|
||||
* @package theme_noanme |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class admin_renderer extends \core_admin_renderer { |
|
||||
|
|
||||
/** |
|
||||
* Output a warning message. |
|
||||
* |
|
||||
* @param string $message the message to display. |
|
||||
* @param string $type type class |
|
||||
* @return string HTML to output. |
|
||||
*/ |
|
||||
protected function warning($message, $type = 'warning') { |
|
||||
return $this->box($message, 'generalbox m-b-1 admin' . $type); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,140 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
namespace theme_boost\output\core; |
|
||||
|
|
||||
use plugin_renderer_base; |
|
||||
|
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
require_once($CFG->dirroot . '/files/renderer.php'); |
|
||||
|
|
||||
/** |
|
||||
* Rendering of files viewer related widgets. |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Damyon Wiese |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
/** |
|
||||
* Rendering of files viewer related widgets. |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Damyon Wiese |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class files_renderer extends \core_files_renderer { |
|
||||
/** |
|
||||
* FileManager JS template for window with file information/actions. |
|
||||
* |
|
||||
*/ |
|
||||
protected function fm_js_template_fileselectlayout() { |
|
||||
$context = [ |
|
||||
'helpicon' => $this->help_icon('setmainfile', 'repository') |
|
||||
]; |
|
||||
return $this->render_from_template('core/filemanager_fileselect', $context); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FileManager JS template for popup confirm dialogue window. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fm_js_template_confirmdialog() { |
|
||||
return $this->render_from_template('core/filemanager_confirmdialog', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Template for FilePicker with general layout (not QuickUpload). |
|
||||
* |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_generallayout() { |
|
||||
return $this->render_from_template('core/filemanager_modal_generallayout', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Returns html for displaying one file manager |
|
||||
* |
|
||||
* @param form_filemanager $fm |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fm_print_generallayout($fm) { |
|
||||
$context = [ |
|
||||
'client_id' => $fm->options->client_id, |
|
||||
'helpicon' => $this->help_icon('setmainfile', 'repository'), |
|
||||
'restrictions' => $this->fm_print_restrictions($fm) |
|
||||
]; |
|
||||
return $this->render_from_template('core/filemanager_page_generallayout', $context); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Returns HTML for default repository searchform to be passed to Filepicker |
|
||||
* |
|
||||
* This will be used as contents for search form defined in generallayout template |
|
||||
* (form with id {TOOLSEARCHID}). |
|
||||
* Default contents is one text input field with name="s" |
|
||||
*/ |
|
||||
public function repository_default_searchform() { |
|
||||
return $this->render_from_template('core/filemanager_default_searchform', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FilePicker JS template for 'Upload file' repository |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_uploadform() { |
|
||||
return $this->render_from_template('core/filemanager_uploadform', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FilePicker JS template for repository login form including templates for each element type |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_loginform() { |
|
||||
return $this->render_from_template('core/filemanager_loginform', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FilePicker JS template for window appearing to select a file. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_selectlayout() { |
|
||||
return $this->render_from_template('core/filemanager_selectlayout', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists |
|
||||
* (multiple-file version). |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_processexistingfilemultiple() { |
|
||||
return $this->render_from_template('core/filemanager_processexistingfilemultiple', []); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
protected function fp_js_template_processexistingfile() { |
|
||||
return $this->render_from_template('core/filemanager_processexistingfile', []); |
|
||||
} |
|
||||
} |
|
@ -1,58 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
/** |
|
||||
* Question renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com> |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
namespace theme_boost\output\core_question; |
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/renderer.php'); |
|
||||
|
|
||||
/** |
|
||||
* Question renderer class. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com> |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class bank_renderer extends \core_question_bank_renderer { |
|
||||
|
|
||||
/** |
|
||||
* Display additional navigation if needed. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function extra_horizontal_navigation() { |
|
||||
// Horizontal navigation for question bank. |
|
||||
if ($questionnode = $this->page->settingsnav->find("questionbank", \navigation_node::TYPE_CONTAINER)) { |
|
||||
if ($children = $questionnode->children) { |
|
||||
$tabs = []; |
|
||||
foreach ($children as $key => $node) { |
|
||||
$tabs[] = new \tabobject($node->key, $node->action, $node->text); |
|
||||
} |
|
||||
$active = $questionnode->find_active_node()->key; |
|
||||
return \html_writer::div(print_tabs([$tabs], $active, null, null, true), 'questionbank-navigation'); |
|
||||
} |
|
||||
} |
|
||||
return ''; |
|
||||
} |
|
||||
} |
|
@ -1,197 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
|
|
||||
/** |
|
||||
* Overriden core maintenance renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
namespace theme_boost\output; |
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
use coding_exception; |
|
||||
use moodle_page; |
|
||||
use block_contents; |
|
||||
use stdClass; |
|
||||
|
|
||||
/** |
|
||||
* The maintenance renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class core_renderer_maintenance extends core_renderer { |
|
||||
|
|
||||
/** |
|
||||
* Initialises the renderer instance. |
|
||||
* |
|
||||
* @param moodle_page $page |
|
||||
* @param string $target |
|
||||
* @throws coding_exception |
|
||||
*/ |
|
||||
public function __construct(moodle_page $page, $target) { |
|
||||
if ($target !== RENDERER_TARGET_MAINTENANCE || $page->pagelayout !== 'maintenance') { |
|
||||
throw new coding_exception('Invalid request for the maintenance renderer.'); |
|
||||
} |
|
||||
parent::__construct($page, $target); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce blocks. |
|
||||
* |
|
||||
* @param block_contents $bc |
|
||||
* @param string $region |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function block(block_contents $bc, $region) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce blocks. |
|
||||
* |
|
||||
* @param string $region |
|
||||
* @param array $classes |
|
||||
* @param string $tag |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function blocks($region, $classes = array(), $tag = 'aside') { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce blocks. |
|
||||
* |
|
||||
* @param string $region |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function blocks_for_region($region) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a course content header. |
|
||||
* |
|
||||
* @param bool $onlyifnotcalledbefore |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function course_content_header($onlyifnotcalledbefore = false) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a course content footer. |
|
||||
* |
|
||||
* @param bool $onlyifnotcalledbefore |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function course_content_footer($onlyifnotcalledbefore = false) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a course header. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function course_header() { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a course footer. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function course_footer() { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a custom menu. |
|
||||
* |
|
||||
* @param string $custommenuitems |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function custom_menu($custommenuitems = '') { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce a file picker. |
|
||||
* |
|
||||
* @param array $options |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function file_picker($options) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce and HTML file tree. |
|
||||
* |
|
||||
* @param array $dir |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function htmllize_file_tree($dir) { |
|
||||
return ''; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer does not support JS. |
|
||||
* |
|
||||
* @param block_contents $bc |
|
||||
*/ |
|
||||
public function init_block_hider_js(block_contents $bc) { |
|
||||
// Does nothing. |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce language menus. |
|
||||
* |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function lang_menu() { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer has no need for login information. |
|
||||
* |
|
||||
* @param null $withlinks |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function login_info($withlinks = null) { |
|
||||
return ''; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Does nothing. The maintenance renderer cannot produce user pictures. |
|
||||
* |
|
||||
* @param stdClass $user |
|
||||
* @param array $options |
|
||||
* @return string |
|
||||
*/ |
|
||||
public function user_picture(stdClass $user, array $options = null) { |
|
||||
return ''; |
|
||||
} |
|
||||
} |
|
@ -1,44 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
/** |
|
||||
* Overriden gradereport_history renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
namespace theme_boost\output; |
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
use gradereport_history\output\user_button; |
|
||||
|
|
||||
/** |
|
||||
* Overriden gradereport_history renderer. |
|
||||
* |
|
||||
* @package theme_boost |
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
class gradereport_history_renderer extends \gradereport_history\output\renderer { |
|
||||
|
|
||||
public function render_user_button(user_button $button) { |
|
||||
$data = $button->export_for_template($this); |
|
||||
return $this->render_from_template('gradereport_history/user_button', $data); |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -0,0 +1,106 @@ |
|||||
|
<?php |
||||
|
// 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/>. |
||||
|
|
||||
|
/** |
||||
|
* Used to convert a bootswatch file from https://bootswatch.com/ to a Moodle preset. |
||||
|
* |
||||
|
* @package theme_ilb |
||||
|
* @subpackage cli |
||||
|
* @copyright 2016 Damyon Wiese |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
|
define('CLI_SCRIPT', true); |
||||
|
|
||||
|
require(__DIR__.'/../../../config.php'); |
||||
|
require_once($CFG->libdir.'/clilib.php'); |
||||
|
|
||||
|
$usage = " |
||||
|
Utility to convert a Bootswatch theme to a Moodle preset compatible with Bootstrap 4. |
||||
|
|
||||
|
Download _variables.scss and _bootswatch.scss files from https://bootswatch.com/ |
||||
|
Run this script. It will generate a new file 'preset.scss' which can be used as |
||||
|
a Moodle preset. |
||||
|
|
||||
|
Usage: |
||||
|
# php import-bootswatch.php [--help|-h] |
||||
|
# php import-bootswatch.php --variables=<path> --bootswatch=<path> --preset=<path> |
||||
|
|
||||
|
Options: |
||||
|
-h --help Print this help. |
||||
|
--variables=<path> Path to the input variables file, defaults to _variables.scss |
||||
|
--bootswatch=<path> Path to the input bootswatch file, defauls to _bootswatch.scss |
||||
|
--preset=<path> Path to the output preset file, defaults to preset.scss |
||||
|
"; |
||||
|
|
||||
|
list($options, $unrecognised) = cli_get_params([ |
||||
|
'help' => false, |
||||
|
'variables' => '_variables.scss', |
||||
|
'bootswatch' => '_bootswatch.scss', |
||||
|
'preset' => 'preset.scss', |
||||
|
], [ |
||||
|
'h' => 'help', |
||||
|
]); |
||||
|
|
||||
|
if ($unrecognised) { |
||||
|
$unrecognised = implode(PHP_EOL.' ', $unrecognised); |
||||
|
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised)); |
||||
|
} |
||||
|
|
||||
|
if ($options['help']) { |
||||
|
cli_writeln($usage); |
||||
|
exit(2); |
||||
|
} |
||||
|
|
||||
|
if (is_readable($options['variables'])) { |
||||
|
$sourcevariables = file_get_contents($options['variables']); |
||||
|
} else { |
||||
|
cli_writeln($usage); |
||||
|
cli_error('Error reading the variables file: '.$options['variables']); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (is_readable($options['bootswatch'])) { |
||||
|
$sourcebootswatch = file_get_contents($options['bootswatch']); |
||||
|
} else { |
||||
|
cli_writeln($usage); |
||||
|
cli_error('Error reading the bootswatch file: '.$options['bootswatch']); |
||||
|
} |
||||
|
|
||||
|
// Write the preset file. |
||||
|
$out = fopen($options['preset'], 'w'); |
||||
|
|
||||
|
if (!$out) { |
||||
|
cli_error('Error writing to the preset file'); |
||||
|
} |
||||
|
|
||||
|
fwrite($out, $sourcevariables); |
||||
|
|
||||
|
fwrite($out, ' |
||||
|
// Import FontAwesome. |
||||
|
@import "fontawesome"; |
||||
|
|
||||
|
// Import All of Bootstrap |
||||
|
@import "bootstrap"; |
||||
|
|
||||
|
// Import Core moodle CSS |
||||
|
@import "moodle"; |
||||
|
'); |
||||
|
|
||||
|
// Add the bootswatch file. |
||||
|
fwrite($out, $sourcebootswatch); |
||||
|
|
||||
|
fclose($out); |
@ -1,12 +1,54 @@ |
|||||
<?php |
<?php |
||||
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real. |
// 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/>. |
||||
|
|
||||
|
/** |
||||
|
* Language file. |
||||
|
* |
||||
|
* @package theme_ilb |
||||
|
* @copyright 2016 Frédéric Massart |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
|
||||
// This line protects the file from being accessed by a URL directly. |
|
||||
defined('MOODLE_INTERNAL') || die(); |
defined('MOODLE_INTERNAL') || die(); |
||||
|
|
||||
// A description shown in the admin theme selector. |
$string['advancedsettings'] = 'Advanced settings'; |
||||
$string['choosereadme'] = 'Tema do ILB para o Moodle'; |
$string['backgroundimage'] = 'Background image'; |
||||
// The name of our plugin. |
$string['backgroundimage_desc'] = 'The image to display as a background of the site. The background image you upload here will override the background image in your theme preset files.'; |
||||
$string['pluginname'] = 'ILB'; |
$string['brandcolor'] = 'Brand colour'; |
||||
// We need to include a lang string for each block region. |
$string['brandcolor_desc'] = 'The accent colour.'; |
||||
|
$string['bootswatch'] = 'Bootswatch'; |
||||
|
$string['bootswatch_desc'] = 'A bootswatch is a set of Bootstrap variables and css to style Bootstrap'; |
||||
|
$string['choosereadme'] = 'Ilb is a modern highly-customisable theme. This theme is intended to be used directly, or as a parent theme when creating new themes utilising Bootstrap 4.'; |
||||
|
$string['currentinparentheses'] = '(current)'; |
||||
|
$string['configtitle'] = 'Ilb'; |
||||
|
$string['fontsize'] = 'Theme base fontsize'; |
||||
|
$string['fontsize_desc'] = 'Enter a fontsize in %'; |
||||
|
$string['generalsettings'] = 'General settings'; |
||||
|
$string['nobootswatch'] = 'None'; |
||||
|
$string['pluginname'] = 'Ilb'; |
||||
|
$string['presetfiles'] = 'Additional theme preset files'; |
||||
|
$string['presetfiles_desc'] = 'Preset files can be used to dramatically alter the appearance of the theme. See <a href="https://docs.moodle.org/dev/Ilb_Presets">Ilb presets</a> for information on creating and sharing your own preset files, and see the <a href="http://moodle.net/ilb">Presets repository</a> for presets that others have shared.'; |
||||
|
$string['preset'] = 'Theme preset'; |
||||
|
$string['preset_desc'] = 'Pick a preset to broadly change the look of the theme.'; |
||||
|
$string['privacy:metadata'] = 'The Ilb theme does not store any personal data about any user.'; |
||||
|
$string['rawscss'] = 'Raw SCSS'; |
||||
|
$string['rawscss_desc'] = 'Use this field to provide SCSS or CSS code which will be injected at the end of the style sheet.'; |
||||
|
$string['rawscsspre'] = 'Raw initial SCSS'; |
||||
|
$string['rawscsspre_desc'] = 'In this field you can provide initialising SCSS code, it will be injected before everything else. Most of the time you will use this setting to define variables.'; |
||||
$string['region-side-pre'] = 'Right'; |
$string['region-side-pre'] = 'Right'; |
||||
|
$string['privacy:metadata:preference:draweropennav'] = 'The user\'s preference for hiding or showing the drawer menu navigation.'; |
||||
|
$string['privacy:drawernavclosed'] = 'The current preference for the navigation drawer is closed.'; |
||||
|
$string['privacy:drawernavopen'] = 'The current preference for the navigation drawer is open.'; |
||||
|
@ -1,36 +0,0 @@ |
|||||
<?php |
|
||||
// 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/>. |
|
||||
|
|
||||
defined('MOODLE_INTERNAL') || die(); |
|
||||
|
|
||||
/** |
|
||||
* A login page layout for the ilb theme. |
|
||||
* |
|
||||
* @package theme_ilb |
|
||||
* @copyright 2016 Damyon Wiese |
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
||||
*/ |
|
||||
|
|
||||
$bodyattributes = $OUTPUT->body_attributes(); |
|
||||
|
|
||||
$templatecontext = [ |
|
||||
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), |
|
||||
'output' => $OUTPUT, |
|
||||
'bodyattributes' => $bodyattributes |
|
||||
]; |
|
||||
|
|
||||
echo $OUTPUT->render_from_template('theme_ilb/login_nova_conta', $templatecontext); |
|
||||
|
|
After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 135 KiB |
@ -0,0 +1,35 @@ |
|||||
|
Description of Twitter bootstrap import into Moodle |
||||
|
|
||||
|
Twitter bootstrap |
||||
|
----------------- |
||||
|
|
||||
|
Sass: |
||||
|
This theme uses the version 4.0.0 Twitter bootstrap sass files. |
||||
|
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 |
||||
|
* re-apply /* rtl:begin:ignore */ on the top of _popover.scss before .popover rule and /* rtl:end:ignore */ before |
||||
|
.popover-arrow::after rule. See MDL-56763 commit (1a4faf9b). |
||||
|
* comment out all uses of the @supports syntax in SCSS (see https://github.com/sabberworm/PHP-CSS-Parser/issues/127). In Bootstrap 4.0 The @supports rules are used for carousal transitions (nice sliding) and the .sticky-top helper class. The carousel bootstrap component will still be functional. |
||||
|
* update ./thirdpartylibs.xml |
||||
|
|
||||
|
Javascript: |
||||
|
|
||||
|
This theme uses the transpiled javascript from bootstrap4 as amd modules. |
||||
|
|
||||
|
To update the javascript files: |
||||
|
Checkout the latest branch of bootstrap to a folder, Run the follwing inside the cloned Bootstrap repository: |
||||
|
|
||||
|
``` |
||||
|
$ npm install @babel/cli@7.0.0-beta.37 @babel/preset-env@7.0.0-beta.37 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. |
||||
|
Run grunt to re-compile the JS files. (thanks to Joby Harding) |
@ -0,0 +1,2 @@ |
|||||
|
// Import Bootstrap. |
||||
|
@import "bootstrap/bootstrap"; |
@ -0,0 +1,47 @@ |
|||||
|
// Base class |
||||
|
// |
||||
|
// Requires one of the contextual, color modifier classes for `color` and |
||||
|
// `background-color`. |
||||
|
|
||||
|
.badge { |
||||
|
display: inline-block; |
||||
|
padding: $badge-padding-y $badge-padding-x; |
||||
|
font-size: $badge-font-size; |
||||
|
font-weight: $badge-font-weight; |
||||
|
line-height: 1; |
||||
|
text-align: center; |
||||
|
white-space: nowrap; |
||||
|
vertical-align: baseline; |
||||
|
@include border-radius($badge-border-radius); |
||||
|
|
||||
|
// Empty badges collapse automatically |
||||
|
&:empty { |
||||
|
display: none; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Quick fix for badges in buttons |
||||
|
.btn .badge { |
||||
|
position: relative; |
||||
|
top: -1px; |
||||
|
} |
||||
|
|
||||
|
// Pill badges |
||||
|
// |
||||
|
// Make them extra rounded with a modifier to replace v3's badges. |
||||
|
|
||||
|
.badge-pill { |
||||
|
padding-right: $badge-pill-padding-x; |
||||
|
padding-left: $badge-pill-padding-x; |
||||
|
@include border-radius($badge-pill-border-radius); |
||||
|
} |
||||
|
|
||||
|
// Colors |
||||
|
// |
||||
|
// Contextual variations (linked badges get darker on :hover). |
||||
|
|
||||
|
@each $color, $value in $theme-colors { |
||||
|
.badge-#{$color} { |
||||
|
@include badge-variant($value); |
||||
|
} |
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
// Bootstrap functions |
||||
|
// |
||||
|
// Utility mixins and functions for evalutating source code across our variables, maps, and mixins. |
||||
|
|
||||
|
// Ascending |
||||
|
// Used to evaluate Sass maps like our grid breakpoints. |
||||
|
@mixin _assert-ascending($map, $map-name) { |
||||
|
$prev-key: null; |
||||
|
$prev-num: null; |
||||
|
@each $key, $num in $map { |
||||
|
@if $prev-num == null { |
||||
|
// Do nothing |
||||
|
} @else if not comparable($prev-num, $num) { |
||||
|
@warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !"; |
||||
|
} @else if $prev-num >= $num { |
||||
|
@warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !"; |
||||
|
} |
||||
|
$prev-key: $key; |
||||
|
$prev-num: $num; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Starts at zero |
||||
|
// Another grid mixin that ensures the min-width of the lowest breakpoint starts at 0. |
||||
|
@mixin _assert-starts-at-zero($map) { |
||||
|
$values: map-values($map); |
||||
|
$first-value: nth($values, 1); |
||||
|
@if $first-value != 0 { |
||||
|
@warn "First breakpoint in `$grid-breakpoints` must start at 0, but starts at #{$first-value}."; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Replace `$search` with `$replace` in `$string` |
||||
|
// Used on our SVG icon backgrounds for custom forms. |
||||
|
// |
||||
|
// @author Hugo Giraudel |
||||
|
// @param {String} $string - Initial string |
||||
|
// @param {String} $search - Substring to replace |
||||
|
// @param {String} $replace ('') - New value |
||||
|
// @return {String} - Updated string |
||||
|
@function str-replace($string, $search, $replace: "") { |
||||
|
$index: str-index($string, $search); |
||||
|
|
||||
|
@if $index { |
||||
|
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); |
||||
|
} |
||||
|
|
||||
|
@return $string; |
||||
|
} |
||||
|
|
||||
|
// Color contrast |
||||
|
@function color-yiq($color) { |
||||
|
$r: red($color); |
||||
|
$g: green($color); |
||||
|
$b: blue($color); |
||||
|
|
||||
|
$yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000; |
||||
|
|
||||
|
@if ($yiq >= $yiq-contrasted-threshold) { |
||||
|
@return $yiq-text-dark; |
||||
|
} @else { |
||||
|
@return $yiq-text-light; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Retrieve color Sass maps |
||||
|
@function color($key: "blue") { |
||||
|
@return map-get($colors, $key); |
||||
|
} |
||||
|
|
||||
|
@function theme-color($key: "primary") { |
||||
|
@return map-get($theme-colors, $key); |
||||
|
} |
||||
|
|
||||
|
@function gray($key: "100") { |
||||
|
@return map-get($grays, $key); |
||||
|
} |
||||
|
|
||||
|
// Request a theme color level |
||||
|
@function theme-color-level($color-name: "primary", $level: 0) { |
||||
|
$color: theme-color($color-name); |
||||
|
$color-base: if($level > 0, #000, #fff); |
||||
|
$level: abs($level); |
||||
|
|
||||
|
@return mix($color-base, $color, $level * $theme-color-interval); |
||||
|
} |
@ -1,188 +1,159 @@ |
|||||
|
// stylelint-disable selector-no-qualifying-type |
||||
|
|
||||
// |
// |
||||
// Base styles |
// Base styles |
||||
// |
// |
||||
|
|
||||
.input-group { |
.input-group { |
||||
position: relative; |
position: relative; |
||||
|
display: flex; |
||||
|
flex-wrap: wrap; // For form validation feedback |
||||
|
align-items: stretch; |
||||
width: 100%; |
width: 100%; |
||||
|
|
||||
@if $enable-flex { |
> .form-control, |
||||
display: flex; |
> .custom-select, |
||||
} @else { |
> .custom-file { |
||||
display: table; |
position: relative; // For focus state's z-index |
||||
// Prevent input groups from inheriting border styles from table cells when |
flex: 1 1 auto; |
||||
// placed within a table. |
// Add width 1% and flex-basis auto to ensure that button will not wrap out |
||||
border-collapse: separate; |
// the column. Applies to IE Edge+ and Firefox. Chrome does not require this. |
||||
} |
width: 1%; |
||||
|
margin-bottom: 0; |
||||
|
|
||||
.form-control { |
// Bring the "active" form control to the top of surrounding elements |
||||
// Ensure that the input is always above the *appended* addon button for |
&:focus { |
||||
// proper border colors. |
|
||||
position: relative; |
|
||||
z-index: 2; |
|
||||
// Bring the "active" form control to the front |
|
||||
@include hover-focus-active { |
|
||||
z-index: 3; |
z-index: 3; |
||||
} |
} |
||||
@if $enable-flex { |
|
||||
flex: 1; |
+ .form-control, |
||||
} @else { |
+ .custom-select, |
||||
// IE9 fubars the placeholder attribute in text inputs and the arrows on |
+ .custom-file { |
||||
// select elements in input groups. To fix it, we float the input. Details: |
margin-left: -$input-border-width; |
||||
// https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855 |
|
||||
float: left; |
|
||||
width: 100%; |
|
||||
} |
} |
||||
margin-bottom: 0; |
|
||||
} |
} |
||||
} |
|
||||
|
|
||||
.input-group-addon, |
> .form-control, |
||||
.input-group-btn, |
> .custom-select { |
||||
.input-group .form-control { |
&:not(:last-child) { @include border-right-radius(0); } |
||||
@if not $enable-flex { |
&:not(:first-child) { @include border-left-radius(0); } |
||||
display: table-cell; |
|
||||
} |
} |
||||
|
|
||||
&:not(:first-child):not(:last-child) { |
// Custom file inputs have more complex markup, thus requiring different |
||||
@include border-radius(0); |
// border-radius overrides. |
||||
} |
> .custom-file { |
||||
} |
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
.input-group-addon, |
&:not(:last-child) .custom-file-label, |
||||
.input-group-btn { |
&:not(:last-child) .custom-file-label::before { @include border-right-radius(0); } |
||||
@if not $enable-flex { |
&:not(:first-child) .custom-file-label, |
||||
width: 1%; |
&:not(:first-child) .custom-file-label::before { @include border-left-radius(0); } |
||||
} |
} |
||||
white-space: nowrap; |
|
||||
vertical-align: middle; // Match the inputs |
|
||||
} |
} |
||||
|
|
||||
|
|
||||
// Sizing options |
// Prepend and append |
||||
// |
// |
||||
// Remix the default form control sizing classes into new ones for easier |
// While it requires one extra layer of HTML for each, dedicated prepend and |
||||
// manipulation. |
// append elements allow us to 1) be less clever, 2) simplify our selectors, and |
||||
|
// 3) support HTML5 form validation. |
||||
|
|
||||
.input-group-lg > .form-control, |
.input-group-prepend, |
||||
.input-group-lg > .input-group-addon, |
.input-group-append { |
||||
.input-group-lg > .input-group-btn > .btn { |
display: flex; |
||||
@extend .form-control-lg; |
|
||||
} |
// Ensure buttons are always above inputs for more visually pleasing borders. |
||||
.input-group-sm > .form-control, |
// This isn't needed for `.input-group-text` since it shares the same border-color |
||||
.input-group-sm > .input-group-addon, |
// as our inputs. |
||||
.input-group-sm > .input-group-btn > .btn { |
.btn { |
||||
@extend .form-control-sm; |
position: relative; |
||||
|
z-index: 2; |
||||
|
} |
||||
|
|
||||
|
.btn + .btn, |
||||
|
.btn + .input-group-text, |
||||
|
.input-group-text + .input-group-text, |
||||
|
.input-group-text + .btn { |
||||
|
margin-left: -$input-border-width; |
||||
|
} |
||||
} |
} |
||||
|
|
||||
|
.input-group-prepend { margin-right: -$input-border-width; } |
||||
|
.input-group-append { margin-left: -$input-border-width; } |
||||
|
|
||||
|
|
||||
|
// Textual addons |
||||
// |
// |
||||
// Text input groups |
// Serves as a catch-all element for any text or radio/checkbox input you wish |
||||
// |
// to prepend or append to an input. |
||||
|
|
||||
.input-group-addon { |
.input-group-text { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
padding: $input-padding-y $input-padding-x; |
padding: $input-padding-y $input-padding-x; |
||||
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom |
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom |
||||
font-size: $font-size-base; |
font-size: $font-size-base; // Match inputs |
||||
font-weight: normal; |
font-weight: $font-weight-normal; |
||||
line-height: $input-line-height; |
line-height: $input-line-height; |
||||
color: $input-color; |
color: $input-group-addon-color; |
||||
text-align: center; |
text-align: center; |
||||
|
white-space: nowrap; |
||||
background-color: $input-group-addon-bg; |
background-color: $input-group-addon-bg; |
||||
border: $input-btn-border-width solid $input-group-addon-border-color; |
border: $input-border-width solid $input-group-addon-border-color; |
||||
@include border-radius($input-border-radius); |
@include border-radius($input-border-radius); |
||||
|
|
||||
// Sizing |
|
||||
&.form-control-sm { |
|
||||
padding: $input-padding-y-sm $input-padding-x-sm; |
|
||||
font-size: $font-size-sm; |
|
||||
@include border-radius($input-border-radius-sm); |
|
||||
} |
|
||||
&.form-control-lg { |
|
||||
padding: $input-padding-y-lg $input-padding-x-lg; |
|
||||
font-size: $font-size-lg; |
|
||||
@include border-radius($input-border-radius-lg); |
|
||||
} |
|
||||
|
|
||||
// scss-lint:disable QualifyingElement |
|
||||
// Nuke default margins from checkboxes and radios to vertically center within. |
// Nuke default margins from checkboxes and radios to vertically center within. |
||||
input[type="radio"], |
input[type="radio"], |
||||
input[type="checkbox"] { |
input[type="checkbox"] { |
||||
margin-top: 0; |
margin-top: 0; |
||||
} |
} |
||||
// scss-lint:enable QualifyingElement |
|
||||
} |
} |
||||
|
|
||||
|
|
||||
|
// Sizing |
||||
// |
// |
||||
// Reset rounded corners |
// Remix the default form control sizing classes into new ones for easier |
||||
// |
// manipulation. |
||||
|
|
||||
.input-group .form-control:not(:last-child), |
.input-group-lg > .form-control, |
||||
.input-group-addon:not(:last-child), |
.input-group-lg > .input-group-prepend > .input-group-text, |
||||
.input-group-btn:not(:last-child) > .btn, |
.input-group-lg > .input-group-append > .input-group-text, |
||||
.input-group-btn:not(:last-child) > .btn-group > .btn, |
.input-group-lg > .input-group-prepend > .btn, |
||||
.input-group-btn:not(:last-child) > .dropdown-toggle, |
.input-group-lg > .input-group-append > .btn { |
||||
.input-group-btn:not(:first-child) > .btn:not(:last-child):not(.dropdown-toggle), |
@extend .form-control-lg; |
||||
.input-group-btn:not(:first-child) > .btn-group:not(:last-child) > .btn { |
|
||||
@include border-right-radius(0); |
|
||||
} |
|
||||
.input-group-addon:not(:last-child) { |
|
||||
border-right: 0; |
|
||||
} |
|
||||
.input-group .form-control:not(:first-child), |
|
||||
.input-group-addon:not(:first-child), |
|
||||
.input-group-btn:not(:first-child) > .btn, |
|
||||
.input-group-btn:not(:first-child) > .btn-group > .btn, |
|
||||
.input-group-btn:not(:first-child) > .dropdown-toggle, |
|
||||
.input-group-btn:not(:last-child) > .btn:not(:first-child), |
|
||||
.input-group-btn:not(:last-child) > .btn-group:not(:first-child) > .btn { |
|
||||
@include border-left-radius(0); |
|
||||
} |
} |
||||
.form-control + .input-group-addon:not(:first-child) { |
|
||||
border-left: 0; |
.input-group-sm > .form-control, |
||||
|
.input-group-sm > .input-group-prepend > .input-group-text, |
||||
|
.input-group-sm > .input-group-append > .input-group-text, |
||||
|
.input-group-sm > .input-group-prepend > .btn, |
||||
|
.input-group-sm > .input-group-append > .btn { |
||||
|
@extend .form-control-sm; |
||||
} |
} |
||||
|
|
||||
|
|
||||
|
// Prepend and append rounded corners |
||||
// |
// |
||||
// Button input groups |
// These rulesets must come after the sizing ones to properly override sm and lg |
||||
// |
// border-radius values when extending. They're more specific than we'd like |
||||
|
// with the `.input-group >` part, but without it, we cannot override the sizing. |
||||
|
|
||||
.input-group-btn { |
|
||||
position: relative; |
|
||||
// Jankily prevent input button groups from wrapping with `white-space` and |
|
||||
// `font-size` in combination with `inline-block` on buttons. |
|
||||
font-size: 0; |
|
||||
white-space: nowrap; |
|
||||
|
|
||||
// Negative margin for spacing, position for bringing hovered/focused/actived |
.input-group > .input-group-prepend > .btn, |
||||
// element above the siblings. |
.input-group > .input-group-prepend > .input-group-text, |
||||
> .btn { |
.input-group > .input-group-append:not(:last-child) > .btn, |
||||
position: relative; |
.input-group > .input-group-append:not(:last-child) > .input-group-text, |
||||
+ .btn { |
.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle), |
||||
margin-left: (-$input-btn-border-width); |
.input-group > .input-group-append:last-child > .input-group-text:not(:last-child) { |
||||
} |
@include border-right-radius(0); |
||||
// Bring the "active" button to the front |
} |
||||
@include hover-focus-active { |
|
||||
z-index: 3; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// Negative margin to only have a single, shared border between the two |
.input-group > .input-group-append > .btn, |
||||
&:not(:last-child) { |
.input-group > .input-group-append > .input-group-text, |
||||
> .btn, |
.input-group > .input-group-prepend:not(:first-child) > .btn, |
||||
> .btn-group { |
.input-group > .input-group-prepend:not(:first-child) > .input-group-text, |
||||
margin-right: (-$input-btn-border-width); |
.input-group > .input-group-prepend:first-child > .btn:not(:first-child), |
||||
} |
.input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) { |
||||
} |
@include border-left-radius(0); |
||||
&:not(:first-child) { |
|
||||
> .btn, |
|
||||
> .btn-group { |
|
||||
z-index: 2; |
|
||||
margin-left: (-$input-btn-border-width); |
|
||||
// Because specificity |
|
||||
@include hover-focus-active { |
|
||||
z-index: 3; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
|
@ -1,81 +1,8 @@ |
|||||
@if $enable-flex { |
.media { |
||||
.media { |
|
||||
display: flex; |
display: flex; |
||||
} |
align-items: flex-start; |
||||
.media-body { |
|
||||
flex: 1; |
|
||||
} |
|
||||
.media-middle { |
|
||||
align-self: center; |
|
||||
} |
|
||||
.media-bottom { |
|
||||
align-self: flex-end; |
|
||||
} |
|
||||
} @else { |
|
||||
.media, |
|
||||
.media-body { |
|
||||
overflow: hidden; |
|
||||
} |
|
||||
.media-body { |
|
||||
width: 10000px; |
|
||||
} |
|
||||
.media-left, |
|
||||
.media-right, |
|
||||
.media-body { |
|
||||
display: table-cell; |
|
||||
vertical-align: top; |
|
||||
} |
|
||||
.media-middle { |
|
||||
vertical-align: middle; |
|
||||
} |
|
||||
.media-bottom { |
|
||||
vertical-align: bottom; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// Images/elements as the media anchor |
|
||||
// |
|
||||
|
|
||||
.media-object { |
|
||||
display: block; |
|
||||
|
|
||||
// Fix collapse in webkit from max-width: 100% and display: table-cell. |
|
||||
&.img-thumbnail { |
|
||||
max-width: none; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// Alignment |
|
||||
// |
|
||||
|
|
||||
.media-right { |
|
||||
padding-left: $media-alignment-padding-x; |
|
||||
} |
} |
||||
|
|
||||
.media-left { |
.media-body { |
||||
padding-right: $media-alignment-padding-x; |
flex: 1; |
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// Headings |
|
||||
// |
|
||||
|
|
||||
.media-heading { |
|
||||
margin-top: 0; |
|
||||
margin-bottom: $media-heading-margin-bottom; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// Media list variation |
|
||||
// |
|
||||
|
|
||||
.media-list { |
|
||||
padding-left: 0; |
|
||||
list-style: none; |
|
||||
} |
} |
||||
|
@ -1,145 +1,33 @@ |
|||||
// |
|
||||
// Progress animations |
|
||||
// |
|
||||
|
|
||||
@keyframes progress-bar-stripes { |
@keyframes progress-bar-stripes { |
||||
from { background-position: $spacer-y 0; } |
from { background-position: $progress-height 0; } |
||||
to { background-position: 0 0; } |
to { background-position: 0 0; } |
||||
} |
} |
||||
|
|
||||
|
|
||||
// |
|
||||
// Basic progress bar |
|
||||
// |
|
||||
|
|
||||
.progress { |
.progress { |
||||
display: block; |
display: flex; |
||||
width: 100%; |
height: $progress-height; |
||||
height: $spacer-y; // todo: make a new var for this |
overflow: hidden; // force rounded corners by cropping it |
||||
margin-bottom: $spacer-y; |
font-size: $progress-font-size; |
||||
} |
|
||||
.progress[value] { |
|
||||
// Set overall background |
|
||||
background-color: $progress-bg; |
|
||||
// Remove Firefox and Opera border |
|
||||
border: 0; |
|
||||
// Reset the default appearance |
|
||||
appearance: none; |
|
||||
// Set overall border radius |
|
||||
@include border-radius($progress-border-radius); |
|
||||
} |
|
||||
|
|
||||
// Filled-in portion of the bar |
|
||||
.progress[value]::-ms-fill { |
|
||||
background-color: $progress-bar-color; |
|
||||
// Remove right-hand border of value bar from IE10+/Edge |
|
||||
border: 0; |
|
||||
} |
|
||||
.progress[value]::-moz-progress-bar { |
|
||||
background-color: $progress-bar-color; |
|
||||
@include border-left-radius($progress-border-radius); |
|
||||
} |
|
||||
.progress[value]::-webkit-progress-value { |
|
||||
background-color: $progress-bar-color; |
|
||||
@include border-left-radius($progress-border-radius); |
|
||||
} |
|
||||
// Tweaks for full progress bar |
|
||||
.progress[value="100"]::-moz-progress-bar { |
|
||||
@include border-right-radius($progress-border-radius); |
|
||||
} |
|
||||
.progress[value="100"]::-webkit-progress-value { |
|
||||
@include border-right-radius($progress-border-radius); |
|
||||
} |
|
||||
|
|
||||
// Unfilled portion of the bar |
|
||||
.progress[value]::-webkit-progress-bar { |
|
||||
background-color: $progress-bg; |
|
||||
@include border-radius($progress-border-radius); |
|
||||
@include box-shadow($progress-box-shadow); |
|
||||
} |
|
||||
base::-moz-progress-bar, // Absurd-but-syntactically-valid selector to make these styles Firefox-only |
|
||||
.progress[value] { |
|
||||
background-color: $progress-bg; |
background-color: $progress-bg; |
||||
@include border-radius($progress-border-radius); |
@include border-radius($progress-border-radius); |
||||
@include box-shadow($progress-box-shadow); |
@include box-shadow($progress-box-shadow); |
||||
} |
} |
||||
|
|
||||
// IE9 hacks to accompany custom markup. We don't need to scope this via media queries, but I feel better doing it anyway. |
.progress-bar { |
||||
@media screen and (min-width:0\0) { |
display: flex; |
||||
.progress { |
flex-direction: column; |
||||
background-color: $progress-bg; |
justify-content: center; |
||||
@include border-radius($progress-border-radius); |
color: $progress-bar-color; |
||||
@include box-shadow($progress-box-shadow); |
text-align: center; |
||||
} |
background-color: $progress-bar-bg; |
||||
.progress-bar { |
@include transition($progress-bar-transition); |
||||
display: inline-block; |
|
||||
height: $spacer-y; |
|
||||
text-indent: -999rem; // Simulate hiding of value as in native `<progress>` |
|
||||
background-color: $progress-bar-color; |
|
||||
@include border-left-radius($progress-border-radius); |
|
||||
} |
|
||||
.progress[width="100%"] { |
|
||||
@include border-right-radius($progress-border-radius); |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
|
.progress-bar-striped { |
||||
// |
|
||||
// Striped |
|
||||
// |
|
||||
|
|
||||
.progress-striped[value]::-webkit-progress-value { |
|
||||
@include gradient-striped(); |
|
||||
background-size: $spacer-y $spacer-y; |
|
||||
} |
|
||||
.progress-striped[value]::-moz-progress-bar { |
|
||||
@include gradient-striped(); |
@include gradient-striped(); |
||||
background-size: $spacer-y $spacer-y; |
background-size: $progress-height $progress-height; |
||||
} |
|
||||
.progress-striped[value]::-ms-fill { |
|
||||
@include gradient-striped(); |
|
||||
background-size: $spacer-y $spacer-y; |
|
||||
} |
|
||||
// IE9 |
|
||||
@media screen and (min-width:0\0) { |
|
||||
.progress-bar-striped { |
|
||||
@include gradient-striped(); |
|
||||
background-size: $spacer-y $spacer-y; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// |
|
||||
// Animated |
|
||||
// |
|
||||
|
|
||||
.progress-animated[value]::-webkit-progress-value { |
|
||||
animation: progress-bar-stripes 2s linear infinite; |
|
||||
} |
|
||||
.progress-animated[value]::-moz-progress-bar { |
|
||||
animation: progress-bar-stripes 2s linear infinite; |
|
||||
} |
|
||||
// IE9 |
|
||||
@media screen and (min-width:0\0) { |
|
||||
.progress-animated .progress-bar-striped { |
|
||||
animation: progress-bar-stripes 2s linear infinite; |
|
||||
} |
|
||||
} |
} |
||||
|
|
||||
|
.progress-bar-animated { |
||||
// |
animation: progress-bar-stripes $progress-bar-animation-timing; |
||||
// Variations |
|
||||
// |
|
||||
|
|
||||
.progress-success { |
|
||||
@include progress-variant($progress-bar-success-bg); |
|
||||
} |
|
||||
.progress-info { |
|
||||
@include progress-variant($progress-bar-info-bg); |
|
||||
} |
|
||||
.progress-warning { |
|
||||
@include progress-variant($progress-bar-warning-bg); |
|
||||
} |
|
||||
.progress-danger { |
|
||||
@include progress-variant($progress-bar-danger-bg); |
|
||||
} |
} |
||||
|
@ -0,0 +1,19 @@ |
|||||
|
:root { |
||||
|
// Custom variable values only support SassScript inside `#{}`. |
||||
|
@each $color, $value in $colors { |
||||
|
--#{$color}: #{$value}; |
||||
|
} |
||||
|
|
||||
|
@each $color, $value in $theme-colors { |
||||
|
--#{$color}: #{$value}; |
||||
|
} |
||||
|
|
||||
|
@each $bp, $value in $grid-breakpoints { |
||||
|
--breakpoint-#{$bp}: #{$value}; |
||||
|
} |
||||
|
|
||||
|
// Use `inspect` for lists so that quoted items keep the quotes. |
||||
|
// See https://github.com/sass/sass/issues/2383#issuecomment-336349172 |
||||
|
--font-family-sans-serif: #{inspect($font-family-sans-serif)}; |
||||
|
--font-family-monospace: #{inspect($font-family-monospace)}; |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
// stylelint-disable selector-no-qualifying-type |
||||
|
|
||||
|
.fade { |
||||
|
opacity: 0; |
||||
|
@include transition($transition-fade); |
||||
|
|
||||
|
&.show { |
||||
|
opacity: 1; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.collapse { |
||||
|
display: none; |
||||
|
&.show { |
||||
|
display: block; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
tr { |
||||
|
&.collapse.show { |
||||
|
display: table-row; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
tbody { |
||||
|
&.collapse.show { |
||||
|
display: table-row-group; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.collapsing { |
||||
|
position: relative; |
||||
|
height: 0; |
||||
|
overflow: hidden; |
||||
|
@include transition($transition-collapse); |
||||
|
} |
@ -1,9 +1,14 @@ |
|||||
|
@import "utilities/align"; |
||||
@import "utilities/background"; |
@import "utilities/background"; |
||||
|
@import "utilities/borders"; |
||||
@import "utilities/clearfix"; |
@import "utilities/clearfix"; |
||||
@import "utilities/display"; |
@import "utilities/display"; |
||||
|
@import "utilities/embed"; |
||||
@import "utilities/flex"; |
@import "utilities/flex"; |
||||
@import "utilities/pulls"; |
@import "utilities/float"; |
||||
|
@import "utilities/position"; |
||||
@import "utilities/screenreaders"; |
@import "utilities/screenreaders"; |
||||
|
@import "utilities/sizing"; |
||||
@import "utilities/spacing"; |
@import "utilities/spacing"; |
||||
@import "utilities/text"; |
@import "utilities/text"; |
||||
@import "utilities/visibility"; |
@import "utilities/visibility"; |
||||
|
File diff suppressed because it is too large
@ -1,23 +1,32 @@ |
|||||
// Bootstrap Grid only |
/*! |
||||
// |
* Bootstrap Grid v4.0.0 (https://getbootstrap.com) |
||||
// Includes relevant variables and mixins for the regular (non-flexbox) grid |
* Copyright 2011-2018 The Bootstrap Authors |
||||
// system, as well as the generated predefined classes (e.g., `.col-4-sm`). |
* Copyright 2011-2018 Twitter, Inc. |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
||||
|
*/ |
||||
|
|
||||
|
@at-root { |
||||
|
@-ms-viewport { width: device-width; } // stylelint-disable-line at-rule-no-vendor-prefix |
||||
|
} |
||||
|
|
||||
// |
html { |
||||
// Variables |
box-sizing: border-box; |
||||
// |
-ms-overflow-style: scrollbar; |
||||
|
} |
||||
|
|
||||
@import "custom"; |
*, |
||||
@import "variables"; |
*::before, |
||||
|
*::after { |
||||
|
box-sizing: inherit; |
||||
|
} |
||||
|
|
||||
// |
@import "functions"; |
||||
// Grid mixins |
@import "variables"; |
||||
// |
|
||||
|
|
||||
@import "mixins/clearfix"; |
|
||||
@import "mixins/breakpoints"; |
@import "mixins/breakpoints"; |
||||
@import "mixins/grid-framework"; |
@import "mixins/grid-framework"; |
||||
@import "mixins/grid"; |
@import "mixins/grid"; |
||||
|
|
||||
@import "grid"; |
@import "grid"; |
||||
|
@import "utilities/display"; |
||||
|
@import "utilities/flex"; |
||||
|
@ -1,11 +1,12 @@ |
|||||
// Bootstrap Reboot only |
/*! |
||||
// |
* Bootstrap Reboot v4.0.0 (https://getbootstrap.com) |
||||
// Includes only Normalize and our custom Reboot reset. |
* Copyright 2011-2018 The Bootstrap Authors |
||||
|
* Copyright 2011-2018 Twitter, Inc. |
||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
||||
|
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) |
||||
|
*/ |
||||
|
|
||||
@import "custom"; |
@import "functions"; |
||||
@import "variables"; |
@import "variables"; |
||||
@import "mixins/hover"; |
@import "mixins"; |
||||
@import "mixins/tab-focus"; |
|
||||
|
|
||||
@import "normalize"; |
|
||||
@import "reboot"; |
@import "reboot"; |
||||
|
@ -1,14 +1,13 @@ |
|||||
// Alerts |
@mixin alert-variant($background, $border, $color) { |
||||
|
color: $color; |
||||
@mixin alert-variant($background, $border, $body-color) { |
@include gradient-bg($background); |
||||
background-color: $background; |
|
||||
border-color: $border; |
border-color: $border; |
||||
color: $body-color; |
|
||||
|
|
||||
hr { |
hr { |
||||
border-top-color: darken($border, 5%); |
border-top-color: darken($border, 5%); |
||||
} |
} |
||||
|
|
||||
.alert-link { |
.alert-link { |
||||
color: darken($body-color, 10%); |
color: darken($color, 10%); |
||||
} |
} |
||||
} |
} |
||||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue