mdb-ui-kit/dist/js/bootstrap-material-design.min.js

1 line
80 KiB
JavaScript
Raw Permalink Normal View History

(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["jquery","popper.js"],t):(e=e||self,t(e.jQuery,e.Popper))})(this,function(e,t){'use strict';var f=Math.max;function n(e){return{}.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase()}function o(){return{bindType:u,delegateType:u,handle(t){return e(t.target).is(this)?t.handleObj.handler.apply(this,arguments):void 0}}}function a(t){let n=!1;return e(this).one(_.TRANSITION_END,()=>{n=!0}),setTimeout(()=>{n||_.triggerTransitionEnd(this)},t),this}function r(){e.fn.emulateTransitionEnd=a,e.event.special[_.TRANSITION_END]=o()}function i(e,t){const n=e.nodeName.toLowerCase();if(-1!==t.indexOf(n))return-1===se.indexOf(n)||!!(e.nodeValue.match(fe)||e.nodeValue.match(ue));const o=t.filter(e=>e instanceof RegExp);for(let a=0,r=o.length;a<r;a++)if(n.match(o[a]))return!0;return!1}function l(e,t,n){if(0===e.length)return e;if(n&&"function"==typeof n)return n(e);const o=new window.DOMParser,a=o.parseFromString(e,"text/html"),r=Object.keys(t),l=[].slice.call(a.body.querySelectorAll("*"));for(let o=0,a=l.length;o<a;o++){const e=l[o],n=e.nodeName.toLowerCase();if(-1===r.indexOf(e.nodeName.toLowerCase())){e.parentNode.removeChild(e);continue}const a=[].slice.call(e.attributes),d=[].concat(t["*"]||[],t[n]||[]);a.forEach(t=>{i(t,d)||e.removeAttribute(t.nodeName)})}return a.body.innerHTML}function d(e,t){for(var n,o=0;o<t.length;o++)n=t[o],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function s(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),e}function c(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}e=e&&e.hasOwnProperty("default")?e["default"]:e,t=t&&t.hasOwnProperty("default")?t["default"]:t;const u="transitionend",_={TRANSITION_END:"bsTransitionEnd",getUID(e){do e+=~~(Math.random()*1e6);while(document.getElementById(e));return e},getSelectorFromElement(e){let t=e.getAttribute("data-target");if(!t||"#"===t){const n=e.getAttribute("href");t=n&&"#"!==n?n.trim():""}try{return document.querySelector(t)?t:null}catch(e){return null}},getTransitionDurationFromElement(t){if(!t)return 0;let n=e(t).css("transition-duration"),o=e(t).css("transition-delay");const a=parseFloat(n),r=parseFloat(o);return a||r?(n=n.split(",")[0],o=o.split(",")[0],(parseFloat(n)+parseFloat(o))*1e3):0},reflow(e){return e.offsetHeight},triggerTransitionEnd(t){e(t).trigger(u)},supportsTransitionEnd(){return!0},isElement(e){return(e[0]||e).nodeType},typeCheckConfig(e,t,o){for(const a in o)if(Object.prototype.hasOwnProperty.call(o,a)){const r=o[a],i=t[a],l=i&&_.isElement(i)?"element":n(i);if(!new RegExp(r).test(l))throw new Error(`${e.toUpperCase()}: `+`Option "${a}" provided type "${l}" `+`but expected type "${r}".`)}},findShadowRoot(e){if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?_.findShadowRoot(e.parentNode):null}};r();const m="bs.alert",p=`.${m}`,g=e.fn.alert,E={CLOSE:`close${p}`,CLOSED:`closed${p}`,CLICK_DATA_API:`click${p}${".data-api"}`},h={ALERT:"alert",FADE:"fade",SHOW:"show"};class A{constructor(e){this._element=e}static get VERSION(){return"4.3.1"}close(e){let t=this._element;e&&(t=this._getRootElement(e));const n=this._triggerCloseEvent(t);n.isDefaultPrevented()||this._removeElement(t)}dispose(){e.removeData(this._element,m),this._element=null}_getRootElement(t){const n=_.getSelectorFromElement(t);let o=!1;return n&&(o=document.querySelector(n)),o||(o=e(t).closest(`.${h.ALERT}`)[0]),o}_triggerCloseEvent(t){const n=e.Event(E.CLOSE);return e(t).trigger(n),n}_removeElement(t){if(e(t).removeClass(h.SHOW),!e(t).hasClass(h.FADE))return void this._destroyElement(t);const n=_.getTransitionDurationFromElement(t);e(t).one(_.TRANSITION_END,e=>this._destroyElement(t,e)).emulateTransitionEnd(n)}_destroyElement(t){e(t).detach().trigger(E.CLOSED).remove()}static _jQueryInterfac