This commit is contained in:
sentsin 2016-11-30 02:23:57 +08:00
parent 1e8bd1496c
commit c1663351cc
32 changed files with 141 additions and 122 deletions

4
.gitignore vendored
View File

@ -1,4 +1,3 @@
layui/
*.iml
.idea/
.ipr
@ -21,4 +20,5 @@ run.bat
dir.txt
/**/layim/
/**/layim.js
/**/layim.html
/**/layim.html
release/

View File

@ -1,4 +1,17 @@
# v1.0.6 2016-11-30
* 修复导航点击二级菜单时未取消其它菜单的bug
* 修复上传按钮与表单组2px偏差
* 当引入layui.all.js时如果仍然使用了layui.use则不加载相应模块因为layui.all.js已包含
* 剔除 layui.all(callback) 方法,如果要用到全部模块,直接用 layui.all.js 的方式即可
* 整个框架文件减少了 150kb
---
# v1.0.5 2016-11-29
* 增加多种table样式表格相关的功能和数据操作会在 2.0大版本时推出)

View File

@ -1,7 +1,7 @@
{
"name": "layui",
"main": "src/layui.js",
"version": "1.0.5",
"version": "1.0.6",
"homepage": "https://github.com/sentsin/layui",
"authors": [
"sentsin <xu@sentsin.com>"

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL-2.1 license By http://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #ddd;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:30px;line-height:30px;border-bottom:1px solid #ddd}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #ddd;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #ddd;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:30px;line-height:30px;border-bottom:1px solid #ddd}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #ddd;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var a=layui.jquery,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var l=layui.jquery,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon ">&#xe63e;</i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var u=l(e.elem);if(u[0]){var f=l(e.scrollElem||document),m=e.mb||50,s=!("isAuto"in e)||e.isAuto,y=e.end||"没有更多了",v=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");u.find(".layui-flow-more")[0]||u.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(y):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(f.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=v?e.height():l(window).height(),n=v?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=m&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var f=e.attr("lay-src");layui.img(f,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",f).removeAttr("lay-src"),l[0]&&u(l),i++})}},u=function(e,o){var u=a?(o||n).height():l(window).height(),f=n.scrollTop(),m=f+u;if(t.lazyimg.elem=l(r),e)c(e,u);else for(var s=0;s<t.lazyimg.elem.length;s++){var y=t.lazyimg.elem.eq(s),v=a?function(){return y.offset().top-n.offset().top+f}():y.offset().top;if(c(y,u),i=s,v>m)break}};if(u(),!o){var f;n.on("scroll",function(){var e=l(this);f&&clearTimeout(f),f=setTimeout(function(){u(null,e)},50)}),o=!0}return u},e("flow",new o)});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define(function(a){"use strict";function t(a){new p(a)}var e=document,r="getElementById",n="getElementsByTagName",s=0,p=function(a){var t=this,e=t.config=a||{};e.item=s++,t.render(!0)};p.on=function(a,t,e){return a.attachEvent?a.attachEvent("on"+t,function(){e.call(a,window.even)}):a.addEventListener(t,e,!1),p},p.prototype.type=function(){var a=this.config;if("object"==typeof a.cont)return void 0===a.cont.length?2:3},p.prototype.view=function(){var a=this,t=a.config,e=[],r={};if(t.pages=0|t.pages,t.curr=0|t.curr||1,t.groups="groups"in t?0|t.groups:5,t.first="first"in t?t.first:"&#x9996;&#x9875;",t.last="last"in t?t.last:"&#x672B;&#x9875;",t.prev="prev"in t?t.prev:"&#x4E0A;&#x4E00;&#x9875;",t.next="next"in t?t.next:"&#x4E0B;&#x4E00;&#x9875;",t.pages<=1)return"";for(t.groups>t.pages&&(t.groups=t.pages),r.index=Math.ceil((t.curr+(t.groups>1&&t.groups!==t.pages?1:0))/(0===t.groups?1:t.groups)),t.curr>1&&t.prev&&e.push('<a href="javascript:;" class="layui-laypage-prev" data-page="'+(t.curr-1)+'">'+t.prev+"</a>"),r.index>1&&t.first&&0!==t.groups&&e.push('<a href="javascript:;" class="laypage_first" data-page="1" title="&#x9996;&#x9875;">'+t.first+"</a><span>&#x2026;</span>"),r.poor=Math.floor((t.groups-1)/2),r.start=r.index>1?t.curr-r.poor:1,r.end=r.index>1?function(){var a=t.curr+(t.groups-r.poor-1);return a>t.pages?t.pages:a}():t.groups,r.end-r.start<t.groups-1&&(r.start=r.end-t.groups+1);r.start<=r.end;r.start++)r.start===t.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(t.skin)?'style="background-color:'+t.skin+';"':"")+"></em><em>"+r.start+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r.start+'">'+r.start+"</a>");return t.pages>t.groups&&r.end<t.pages&&t.last&&0!==t.groups&&e.push('<span>&#x2026;</span><a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;" data-page="'+t.pages+'">'+t.last+"</a>"),r.flow=!t.prev&&0===t.groups,(t.curr!==t.pages&&t.next||r.flow)&&e.push(function(){return r.flow&&t.curr===t.pages?'<span class="layui-laypage-nomore" title="&#x5DF2;&#x6CA1;&#x6709;&#x66F4;&#x591A;">'+t.next+"</span>":'<a href="javascript:;" class="layui-laypage-next" data-page="'+(t.curr+1)+'">'+t.next+"</a>"}()),'<div class="layui-box layui-laypage layui-laypage-'+(t.skin?function(a){return/^#/.test(a)?"molv":a}(t.skin):"default")+'" id="layui-laypage-'+a.config.item+'">'+e.join("")+function(){return t.skip?'<span class="layui-laypage-total">&#x5230;&#x7B2C; <input type="number" min="1" onkeyup="this.value=this.value.replace(/\\D/, \'\');" value="'+t.curr+'" class="layui-laypage-skip"> &#x9875; <button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button></span>':""}()+"</div>"},p.prototype.jump=function(a){if(a){for(var t=this,e=t.config,r=a.children,s=a[n]("button")[0],i=a[n]("input")[0],u=0,o=r.length;u<o;u++)"a"===r[u].nodeName.toLowerCase()&&p.on(r[u],"click",function(){var a=0|this.getAttribute("data-page");e.curr=a,t.render()});s&&p.on(s,"click",function(){var a=0|i.value.replace(/\s|\D/g,"");a&&a<=e.pages&&(e.curr=a,t.render())})}},p.prototype.render=function(a){var t=this,n=t.config,s=t.type(),p=t.view();2===s?n.cont.innerHTML=p:3===s?n.cont.html(p):e[r](n.cont).innerHTML=p,n.jump&&n.jump(n,a),t.jump(e[r]("layui-laypage-"+n.item)),n.hash&&!a&&(location.hash="!"+n.hash+"="+n.curr)},a("laypage",t)});

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},n={exp:function(e){return new RegExp(e,"g")},query:function(e,n,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return c((n||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")},error:function(e,r){var n="Laytpl Error";return"object"==typeof console&&console.error(n+e+"\n"+(r||"")),n+e}},c=n.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=c("^"+r.open+"#",""),l=c(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(c(r.open+"#"),r.open+"# ").replace(c(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(/(?="|')/g,"\\").replace(n.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(n.query(1),function(e){var n='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(c(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),n='"+_escape_('),n+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,n.escape)}catch(u){return delete o.cache,n.error(u,p)}},t.pt.render=function(e,r){var c,t=this;return e?(c=t.cache?t.cache(e,n.escape):t.parse(t.tpl,e),r?void r(c):c):n.error("no data")};var o=function(e){return"string"!=typeof e?n.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var n in e)r[n]=e[n]},o.v="1.2.0",e("laytpl",o)});

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var o=layui.jquery,a=layui.hint(),r="layui-tree-enter",i=function(e){this.options=e},t={arrow:["&#xe623;","&#xe625;"],checkbox:["&#xe626;","&#xe627;"],radio:["&#xe62b;","&#xe62a;"],branch:["&#xe622;","&#xe624;"],leaf:"&#xe621;"};i.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},i.prototype.tree=function(e,a){var r=this,i=r.options,n=a||i.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o('<ul class="'+(n.spread?"layui-show":"")+'"></ul>'),s=o(["<li "+(n.spread?'data-spread="'+n.spread+'"':"")+">",function(){return l?'<i class="layui-icon layui-tree-spread">'+(n.spread?t.arrow[1]:t.arrow[0])+"</i>":""}(),function(){return i.check?'<i class="layui-icon layui-tree-check">'+("checkbox"===i.check?t.checkbox[0]:"radio"===i.check?t.radio[0]:"")+"</i>":""}(),function(){return'<a href="'+(n.href||"javascript:;")+'" '+(i.target&&n.href?'target="'+i.target+'"':"")+">"+('<i class="layui-icon layui-tree-'+(l?"branch":"leaf")+'">'+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"</i>")+("<cite>"+(n.name||"未命名")+"</cite></a>")}(),"</li>"].join(""));l&&(s.append(c),r.tree(c,n.children)),e.append(s),"function"==typeof i.click&&r.click(s,n),r.spread(s,n),i.drag&&r.drag(s,n)})},i.prototype.click=function(e,o){var a=this,r=a.options;e.children("a").on("click",function(e){layui.stope(e),r.click(o)})},i.prototype.spread=function(e,o){var a=this,r=(a.options,e.children(".layui-tree-spread")),i=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),i.removeClass("layui-show"),r.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),i.addClass("layui-show"),r.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};i[0]&&(r.on("click",l),n.on("dblclick",l))},i.prototype.on=function(e){var a=this,i=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),i.drag&&o(document).on("mousemove",function(e){var r=a.move;if(r.from){var i=(r.to,o('<div class="layui-box '+t+'"></div>'));e.preventDefault(),o("."+t)[0]||o("body").append(i);var n=o("."+t)[0]?o("."+t):i;n.addClass("layui-show").html(r.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(r),e.to&&e.to.elem.children("a").removeClass(r),a.move={},o("."+t).remove())})},i.prototype.move={},i.prototype.drag=function(e,a){var i=this,t=(i.options,e.children("a")),n=function(){var t=o(this),n=i.move;n.from&&(n.to={item:a,elem:e},t.addClass(r))};t.on("mousedown",function(){var o=i.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=i.move;a.from&&(delete a.to,e.removeClass(r))})},e("tree",function(e){var r=new i(e=e||{}),t=o(e.elem);return t[0]?void r.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define("layer",function(e){"use strict";var a=layui.jquery,t=layui.layer,i=(layui.device(),"layui-upload-enter"),n="layui-upload-iframe",r={icon:2,shift:6},o={file:"文件",video:"视频",audio:"音频"},s=function(e){this.options=e};s.prototype.init=function(){var e=this,t=e.options,r=a("body"),s=a(t.elem||".layui-upload-file"),u=a('<iframe id="'+n+'" class="'+n+'" name="'+n+'"></iframe>');return a("#"+n)[0]||r.append(u),s.each(function(r,s){s=a(s);var u='<form target="'+n+'" method="'+(t.method||"post")+'" key="set-mine" enctype="multipart/form-data" action="'+(t.url||"")+'"></form>',l=s.attr("lay-type")||t.type;t.unwrap||(u='<div class="layui-box layui-upload-button">'+u+'<span class="layui-upload-icon"><i class="layui-icon">&#xe608;</i>'+(s.attr("lay-title")||t.title||"上传"+(o[l]||"图片"))+"</span></div>"),u=a(u),t.unwrap||u.on("dragover",function(e){e.preventDefault(),a(this).addClass(i)}).on("dragleave",function(){a(this).removeClass(i)}).on("drop",function(){a(this).removeClass(i)}),s.parent("form").attr("target")===n&&(t.unwrap?s.unwrap():(s.parent().next().remove(),s.unwrap().unwrap())),s.wrap(u),s.off("change").on("change",function(){e.action(this,l)})})},s.prototype.action=function(e,i){var o=this,s=o.options,u=e.value,l=a(e),p=l.attr("lay-ext")||s.ext||"";if(u){switch(i){case"file":if(p&&!RegExp("\\w\\.("+p+")$","i").test(escape(u)))return t.msg("不支持该文件格式",r),e.value="";break;case"video":if(!RegExp("\\w\\.("+(p||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(u)))return t.msg("不支持该视频格式",r),e.value="";break;case"audio":if(!RegExp("\\w\\.("+(p||"mp3|wav|mid")+")$","i").test(escape(u)))return t.msg("不支持该音频格式",r),e.value="";break;default:if(!RegExp("\\w\\.("+(p||"jpg|png|gif|bmp|jpeg")+")$","i").test(escape(u)))return t.msg("不支持该图片格式",r),e.value=""}s.before&&s.before(e),l.parent().submit();var c=a("#"+n),f=setInterval(function(){var a;try{a=c.contents().find("body").text()}catch(i){t.msg("上传接口存在跨域",r),clearInterval(f)}if(a){clearInterval(f),c.contents().find("body").html("");try{a=JSON.parse(a)}catch(i){return a={},t.msg("请对上传接口返回JSON字符",r)}"function"==typeof s.success&&s.success(a,e)}},30);e.value=""}},e("upload",function(e){var a=new s(e=e||{});a.init()})});

View File

@ -1,2 +1,2 @@
/** layui-v1.0.5 LGPL License By http://www.layui.com */
/** layui-v1.0.6 LGPL License By http://www.layui.com */
;layui.define("jquery",function(l){"use strict";var o=layui.jquery,i={fixbar:function(l){l=l||{},l.bgcolor=l.bgcolor?"background-color:"+l.bgcolor:"";var i,a,c="layui-fixbar-top",t=[l.bar1===!0?"&#xe606;":l.bar1,l.bar2===!0?"&#xe607;":l.bar2,"&#xe604;"],r=o(['<ul class="layui-fixbar">',l.bar1?'<li class="layui-icon" lay-type="bar1" style="'+l.bgcolor+'">'+t[0]+"</li>":"",l.bar2?'<li class="layui-icon" lay-type="bar2" style="'+l.bgcolor+'">'+t[1]+"</li>":"",'<li class="layui-icon '+c+'" lay-type="top" style="'+l.bgcolor+'">'+t[2]+"</li>","</ul>"].join("")),e=r.find("."+c),s=function(){var i=o(document).scrollTop();i>=(l.showHeight||200)?a||(e.show(),a=1):a&&(e.hide(),a=0)};o(".layui-fixbar")[0]||("object"==typeof l.css&&r.css(l.css),o("body").append(r),s(),r.find("li").on("click",function(){var i=o(this),a=i.attr("lay-type");"top"===a&&o("html,body").animate({scrollTop:0},200),l.click&&l.click.call(this,a)}),o(document).on("scroll",function(){i&&clearTimeout(i),i=setTimeout(function(){s()},100)}))}};l("util",i)});

File diff suppressed because one or more lines are too long

View File

@ -14,75 +14,93 @@ var del = require('del');
var gulpif = require('gulp-if');
var minimist = require('minimist');
//获取参数
var argv = require('minimist')(process.argv.slice(2), {
default: {
ver: 'all'
}
}), mods = 'laytpl,laypage,laydate,jquery,layer,element,upload,form,tree,util,flow,layedit,code';
})
var task = {
minjs: function() {
//可指定模块压缩
//注释
,note = [
'/** <%= pkg.name %>-v<%= pkg.version %><%= remark %> LGPL License By <%= pkg.homepage %> */\n ;'
,{pkg: pkg, remark: ''}
]
//模块
,mods = 'laytpl,laypage,laydate,jquery,layer,element,upload,form,tree,util,flow,layedit,code'
//任务
,task = {
minjs: function(ver) {
//可指定模块压缩eggulp minjs --mod layer,laytpl
var mod = argv.mod ? function(){
return '(' + argv.mod.replace(/,/g, '|') + ')';
}() : '';
return gulp.src([
}() : ''
,src = [
'./src/**/*'+ mod +'.js'
,'!./src/lay/all.js'
,'!./src/lay/mod.js'
]).pipe(uglify())
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> LGPL License By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build'))
,'!./src/lay/mod.js'
]
,dir = ver === 'open' ? 'release' : 'build';
//过滤 layim
if(ver === 'open' || argv.open){
src.push('!./src/lay/**/layim.js');
}
return gulp.src(src).pipe(uglify())
.pipe(header.apply(null, note))
.pipe(gulp.dest('./'+ dir));
}
,modjs: function(){
return gulp.src([
,'./src/lay/**/{mod,'+ mods +'}.js'
,'!./src/lay/**/layim.js' //LayIM需授权
,'!./src/lay/**/mobile/*.js'
]).pipe(uglify())
.pipe(concat('layui.mod.js', {newLine: ''}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %>(All Modules) <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build/lay/dest/'));
,alljs: function(ver){
var src = ['./src/**/{layui,all,'+ mods +'}.js']
,dir = ver === 'open' ? 'release' : 'build';
return gulp.src(src).pipe(uglify())
.pipe(concat('layui.all.js', {newLine: ''}))
.pipe(header.apply(null, note))
.pipe(gulp.dest('./'+ dir +'/lay/dest/'));
}
,alljs: function(){
return gulp.src([
,'./src/**/{layui,all,'+ mods +'}.js'
,'!./src/lay/modules/layim.js' //LayIM需授权
,'!./src/lay/modules/mobile/*.js'
]).pipe(uglify())
.pipe(concat('layui.all.js', {newLine: ''}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build/lay/dest/'));
}
,mincss: function() {
return gulp.src('./src/css/**/*.css')
.pipe(minify({
,mincss: function(ver){
var src = ['./src/css/**/*.css']
,dir = ver === 'open' ? 'release' : 'build';
if(ver === 'open' || argv.open){
src.push('!./src/css/**/layim.css');
}
return gulp.src(src).pipe(minify({
compatibility: 'ie7'
}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.license %> license By <%= pkg.homepage %> */\n', {pkg : pkg} ))
.pipe(gulp.dest('./build/css'));
})).pipe(header.apply(null, note))
.pipe(gulp.dest('./'+ dir +'/css'));
}
,font: function() {
,font: function(ver){
var dir = ver === 'open' ? 'release' : 'build';
return gulp.src('./src/font/*')
.pipe(rename({}))
.pipe(gulp.dest('./build/font'));
.pipe(gulp.dest('./'+ dir +'/font'));
}
,images: function(){
gulp.src([
'./src/css/**/*.png'
,'./src/css/**/*.jpg'
,'./src/css/**/*.gif'
]).pipe(rename({}))
.pipe(gulp.dest('./build/css'));
,images: function(ver){
var src = [
'./src/**/*.png'
,'./src/**/*.jpg'
,'./src/**/*.gif'
]
,dir = ver === 'open' ? 'release' : 'build';
return gulp.src([
'./src/images/**/*.png'
,'./src/images/**/*.jpg'
,'./src/images/**/*.gif'
]).pipe(rename({}))
.pipe(gulp.dest('./build/images'));
if(ver === 'open' || argv.open){
src.push('!./src/**/layim/**/*.*');
}
gulp.src(src).pipe(rename({}))
.pipe(gulp.dest('./'+ dir));
}
};
@ -90,6 +108,9 @@ var task = {
gulp.task('clear', function(cb) {
return del(['./build/*'], cb);
});
gulp.task('clearRelease', function(cb) {
return del(['./release/*'], cb);
});
gulp.task('minjs', task.minjs); //压缩js模块
gulp.task('modjs', task.modjs); //打包PC完整模块即各模块的合并
@ -99,17 +120,21 @@ gulp.task('mincss', task.mincss); //压缩css文件
gulp.task('font', task.font); //复制iconfont文件
gulp.task('images', task.images); //复制组件可能所需的图片
//开源版
gulp.task('default', ['clearRelease'], function(){
for(var key in task){
task[key]('open');
}
});
//完整任务
gulp.task('default', ['clear'], function(){
gulp.task('all', ['clear'], function(){
for(var key in task){
task[key]();
}
});
//开源版
gulp.task('open', ['clear'], function(){
});

View File

@ -1,6 +1,6 @@
{
"name": "layui",
"version": "1.0.5",
"version": "1.0.6",
"description": "经典模块化前端框架",
"main": "layui.js",
"license": "LGPL-2.1",

View File

@ -254,7 +254,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table[lay-skin="nob"] th, .layui-table[lay-skin="nob"] td{border: none;}
/** 文件上传 **/
.layui-upload-button{position: relative; display: inline-block; vertical-align: middle; min-width: 60px; height: 36px; line-height: 36px; border: 1px solid #DFDFDF; border-radius: 2px; overflow: hidden; background-color: #fff; color: #666;}
.layui-upload-button{position: relative; display: inline-block; vertical-align: middle; min-width: 60px; height: 38px; line-height: 38px; border: 1px solid #DFDFDF; border-radius: 2px; overflow: hidden; background-color: #fff; color: #666;}
.layui-upload-button:hover{border: 1px solid #aaa; color: #333;}
.layui-upload-button:active{border: 1px solid #4CAF50; color: #000;}
.layui-upload-file,

View File

@ -1,6 +1,6 @@
/**
/**
@Name用于打包打包PC完整版即包含layui.js和所有模块的完整合并该文件不会存在于构建后的目录
@Name用于打包PC完整版即包含layui.js和所有模块的完整合并该文件不会存在于构建后的目录
@Author贤心
@LicenseLGPL

View File

@ -1,11 +0,0 @@
/**
@Name用于打包PC完整模块该文件不会存在于构建后的目录
@Author贤心
@LicenseLGPL
*/
layui.define(function(exports){
exports('layui.mod', layui.v);
});

View File

@ -153,15 +153,16 @@ layui.define('jquery', function(exports){
,filter = parents.attr('lay-filter');
if(othis.find('.'+NAV_CHILD)[0]) return;
othis.addClass(THIS).siblings().removeClass(THIS);
parents.find('.'+THIS).removeClass(THIS);
othis.addClass(THIS);
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
}
//点击子菜单选中
,clickChild: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM)
,filter = parents.attr('lay-filter');
othis.addClass(THIS).siblings().removeClass(THIS);
parents.find('.'+THIS).removeClass(THIS);
othis.addClass(THIS);
layui.event.call(this, MOD_NAME, 'nav('+ filter +')', othis);
}
//展开二级菜单

View File

@ -13,7 +13,7 @@
"use strict";
var Lay = function(){
this.v = '1.0.5'; //版本号
this.v = '1.0.6'; //版本号
};
Lay.fn = Lay.prototype;
@ -91,6 +91,10 @@ Lay.fn.use = function(apps, callback, exports){
var head = doc.getElementsByTagName('head')[0];
apps = typeof apps === 'string' ? [apps] : apps;
if(!apps || apps.length === 0 || layui['layui.all']){
return typeof callback === 'function' && callback.apply(layui, exports), that;
}
//如果页面已经存在jQuery1.7+库且所定义的模块依赖jQuery则不加载内部jquery模块
if(window.jQuery && jQuery.fn.on){
@ -107,10 +111,6 @@ Lay.fn.use = function(apps, callback, exports){
//静态资源host
config.host = config.host || (dir.match(/\/\/([\s\S]+?)\//)||['//'+ location.host +'/'])[0];
if(apps.length === 0){
return callback();
}
//加载完毕
function onScriptLoad(e, url){
@ -177,12 +177,6 @@ Lay.fn.use = function(apps, callback, exports){
};
//使用打包好的完整Layui库
Lay.fn.all = function(callback){
this.use('layui.mod', callback)
return this;
};
//获取节点的style属性值
Lay.fn.getStyle = function(node, name){
var style = node.currentStyle ? node.currentStyle : win.getComputedStyle(node, null);

View File

@ -69,8 +69,8 @@ body{padding: 10px;}
<li class="layui-nav-item">
<a href="javascript:;">解决方案</a>
<dl class="layui-nav-child">
<dd><a href="">移动模块</a></dd>
<dd><a href="">后台模版</a></dd>
<dd><a href="javascript:;">移动模块</a></dd>
<dd><a href="javascript:;">后台模版</a></dd>
<dd><a href="">电商平台</a></dd>
</dl>
</li>

View File

@ -201,6 +201,8 @@ body{padding: 10px;}
<script src="../src/layui.js"></script>
<!-- <script src="../build/lay/dest/layui.all.js"></script> -->
<script>
layui.use('form', function(){