layui/dist/layui.js

3 lines
367 KiB
JavaScript
Raw Normal View History

2025-04-15 14:59:09 +08:00
/** v2.11.0-rc.3 | MIT Licensed */;!function(h){"use strict";var e,d=h.document,v=h.location,m={timeout:10,debug:!1,version:!1},g={modules:{},status:{},event:{},callback:{}},r=function(){this.v="2.11.0-rc.3"},t=h.LAYUI_GLOBAL||{},b=(e=d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()?d.currentScript.src:function(){for(var e,t=d.getElementsByTagName("script"),n=t.length-1,r=n;0<r;r--)if("interactive"===t[r].readyState){e=t[r].src;break}return e||t[n].src}(),m.dir=t.dir||e.substring(0,e.lastIndexOf("/")+1)),j=function(e,t){t=t||"log",h.console&&console[t]&&console[t]("layui error hint: "+e)},E=m.builtin={lay:"lay",layer:"layer",laydate:"laydate",laypage:"laypage",laytpl:"laytpl",form:"form",upload:"upload",dropdown:"dropdown",transfer:"transfer",tree:"tree",table:"table",treeTable:"treeTable",tabs:"tabs",element:"element",rate:"rate",colorpicker:"colorpicker",slider:"slider",carousel:"carousel",flow:"flow",util:"util",code:"code",jquery:"jquery",component:"component",all:"all","layui.all":"layui.all"},N=("function"!=typeof Object.assign&&(Object.assign=function(e){var t=Object(e);if(!(arguments.length<2))for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r!==undefined&&null!==r)for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t}),function(e,t,n){var r=function(e){"load"!==e.type&&!/^(complete|loaded)$/.test((e.currentTarget||e.srcElement).readyState)||(i(),"function"!=typeof t)||t(e)},o=function(e){i(),"function"==typeof n&&n(e)},i=function(){e.detachEvent?e.detachEvent("onreadystatechange",r):(e.removeEventListener("load",r,!1),e.removeEventListener("error",o,!1))};!e.attachEvent||e.attachEvent.toString&&e.attachEvent.toString().indexOf("[native code")<0?(e.addEventListener("load",r,!1),e.addEventListener("error",o,!1)):e.attachEvent("onreadystatechange",r)}),l=(r.prototype.cache=Object.assign(m,g),r.prototype.config=function(e){return Object.assign(m,e),this},r.prototype.define=function(e,r){return"function"==typeof e&&(r=e,e=[]),this.use(e,function(){var n=function(e,t){layui[e]=t,g.status[e]=!0};return"function"==typeof r&&r(function(e,t){n(e,t),g.callback[e]=function(){r(n)}}),this},null,"define"),this},r.prototype.use=function(n,e,t,r){var o,i,a,u,c,l,s,p,f=this,y=m.dir=m.dir||b;return n="string"==typeof n?[n]:"function"==typeof n?(e=n,["all"]):n,m.host||(m.host=(y.match(/\/\/([\s\S]+?)\//)||["//"+v.host+"/"])[0]),n&&(h.jQuery&&jQuery.fn.on&&(f.each(n,function(e,t){"jquery"===t&&n.splice(e,1)}),layui.jquery=layui.$=h.jQuery),t=t||[],o=n[0],i=f.modules[o],a="object"==typeof i,u=function(){t.push(layui[o]),1<n.length?f.use(n.slice(1),e,t,r):"function"==typeof e&&(layui.jquery&&"function"==typeof layui.jquery&&"define"!==r?layui.jquery(function(){e.apply(layui,t)}):e.apply(layui,t))},c=function(){var e=0;!function t(){return++e>1e3*m.timeout/5?j(o+" is not a valid module","error"):void((a?layui[o]=h[i.api]:g.status[o])?u():setTimeout(t,5))}()},0===n.length||layui["layui.all"]&&E[o]?u():(p=a?i.src:i,y=(E[o]?y+"modules/":p?"":m.base)+(p=(p=p||o).replace(/\s/g,"").replace(/\.js[^\/\.]*$/,""))+".js",!g.modules[o]&&layui[o]&&(g.modules[o]=y),g.modules[o]?c():(l=d.getElementsByTagName("head")[0],(s=d.createElement("script"))["async"]=!0,s.charset="utf-8",s.src=y+((p=!0===m.version?m.v||(new Date).getTime():m.version||"")?"?v="+p:""),l.appendChild(s),N(s,function(){l.removeChild(s),c()},function(){l.removeChild(s)}),g.modules[o]=y))),f},r.prototype.modules=Object.assign({},E),r.prototype.extend=function(e){var t,n,r=m.base||"",o=/^\{\/\}/;for(t in e=e||{})this[t]||this.modules[t]?j("the "+t+" module already exists, extend failure"):("string"==typeof(n=e[t])&&(n=((r=o.test(n)?"":r)+n).replace(o,"")),this.modules[t]=n);return this},r.prototype.disuse=function(e){var n=this;return e=n.isArray(e)?e:[e],n.each(e,function(e,t){delete n[t],delete E[t],delete n.modules[t],delete g.status[t],delete g.modules[t]}),n},r.prototype.getStyle=function(e,t){e=e.currentStyle||h.getComputedStyle(e,null);return e.getPropertyValue?e.getPropertyValue(t):e.getAttribute(t.replace(/-(\w)/g,function(
2023-10-25 11:21:40 +08:00
//# sourceMappingURL=layui.js.map