解决冲突

This commit is contained in:
xuexb 2017-08-31 23:09:32 +08:00
commit e644317078
41 changed files with 452 additions and 171 deletions

View File

@ -1,3 +1,6 @@
# 更新日志
* [2.1.0](http://www.layui.com/doc/base/changelog.html#2-1-0)
* [2.0.2](http://www.layui.com/doc/base/changelog.html#2-0-2)
* [2.0.1](http://www.layui.com/doc/base/changelog.html#2-0-1)
* [2.0.0](http://www.layui.com/doc/base/changelog.html#2-0-0)

View File

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

4
dist/css/layui.css vendored

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-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT 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 #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.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 #e2e2e2;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

View File

@ -1,2 +1,2 @@
/** layui-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",o=">*[carousel-item]>*",l="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(o),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.indicator(),e.elemItem.length<=1||(e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"&#xe619;":"&#xe603;")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"&#xe61a;":"&#xe602;")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,o=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),setTimeout(function(){o.eq(u.index).addClass(d),setTimeout(function(){o.eq(c).addClass(r),o.eq(u.index).addClass(r)},50)},50)):(n.addIndex(i),setTimeout(function(){o.eq(u.index).addClass(s),setTimeout(function(){o.eq(c).addClass(l),o.eq(u.index).addClass(l)},50)},50)),setTimeout(function(){o.removeClass(a+" "+d+" "+s+" "+l+" "+r),o.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:o.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});

View File

@ -1,2 +1,2 @@
/** layui-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var a=layui.$,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-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var l=layui.$,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 f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):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?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(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 m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},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

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define(function(e){"use strict";var a=document,t="getElementById",r="getElementsByTagName",n="laypage",i="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.groups=0|a.groups||5,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),a.groups<0?a.groups=0:a.groups>a.pages&&(a.groups=a.pages),a.prev="prev"in a?a.prev:"&#x4E0A;&#x4E00;&#x9875;",a.next="next"in a?a.next:"&#x4E0B;&#x4E00;&#x9875;";var t=a.pages>a.groups?Math.ceil((a.curr+(a.groups>1?1:0))/(a.groups>0?a.groups:1)):1,r={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+i:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";t>1&&a.first!==!1&&0!==a.groups&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="&#x9996;&#x9875;">'+(a.first||1)+"</a>");var r=Math.floor((a.groups-1)/2),n=t>1?a.curr-r:1,i=t>1?function(){var e=a.curr+(a.groups-r-1);return e>a.pages?a.pages:e}():a.groups;for(i-n<a.groups-1&&(n=i-a.groups+1),a.first!==!1&&n>2&&e.push('<span class="layui-laypage-spr">&#x2026;</span>');n<=i;n++)n===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+n+"</em></span>"):e.push('<a href="javascript:;" data-page="'+n+'">'+n+"</a>");return a.pages>a.groups&&a.pages>i&&a.last!==!1&&(i+1<a.pages&&e.push('<span class="layui-laypage-spr">&#x2026;</span>'),0!==a.groups&&e.push('<a href="javascript:;" class="layui-laypage-last" title="&#x5C3E;&#x9875;" data-page="'+a.pages+'">'+(a.last||a.pages)+"</a>")),e.join("")}(),next:function(){return a.next?'<a href="javascript:;" class="layui-laypage-next'+(a.curr==a.pages?" "+i:"")+'" data-page="'+(a.curr+1)+'">'+a.next+"</a>":""}(),count:'<span class="layui-laypage-count">共 '+a.count+" 条</span>",limit:function(){var e=['<span class="layui-laypage-limits"><select lay-ignore>'];return layui.each(a.limits,function(t,r){e.push('<option value="'+r+'"'+(r===a.limit?"selected":"")+">"+r+" 条/页</option>")}),e.join("")+"</select></span>"}(),skip:function(){return['<span class="layui-laypage-skip">&#x5230;&#x7B2C;','<input type="text" min="1" value="'+a.curr+'" class="layui-input">','&#x9875;<button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button>',"</span>"].join("")}()};return['<div class="layui-box layui-laypage layui-laypage-'+(a.theme?/^#/.test(a.theme)?"molv":a.theme:"default")+'" id="layui-laypage-'+a.index+'">',function(){var e=[];return layui.each(a.layout,function(a,t){r[t]&&e.push(r[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,n=t.config,i=e.children,u=e[r]("button")[0],p=e[r]("input")[0],l=e[r]("select")[0],o=function(){var e=0|p.value.replace(/\s|\D/g,"");e&&(n.curr=e,t.render())};if(a)return o();for(var c=0,g=i.length;c<g;c++)"a"===i[c].nodeName.toLowerCase()&&s.on(i[c],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>n.pages||(n.curr=e,t.render())});l&&s.on(l,"change",function(){var e=this.value;n.curr*e>n.count&&(n.curr=Math.ceil(n.count/e)),n.limit=e,t.render()}),u&&s.on(u,"click",function(){o()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[r]("input")[0];t&&s.on(t,"keyup",function(t){var r=this.value,n=t.keyCode;/^(37|38|39|40)$/.test(n)||(/\D/.test(r)&&(this.value=r.replace(/\D/,"")),13===n&&a.jump(e,!0))})}},u.prototype.render=function(e){var r=this,n=r.config,i=r.type(),u=r.view();2===i?n.elem&&(n.elem.innerHTML=u):3===i?n.elem.html(u):a[t](n.elem)&&(a[t](n.elem).innerHTML=u),n.jump&&n.jump(n,e);var s=a[t]("layui-laypage-"+n.index);r.jump(s),n.hash&&!e&&(location.hash="!"+n.hash+"="+n.curr),r.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(n,s)});

View File

@ -1,2 +1,2 @@
/** layui-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT 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)});

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-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["&#xe623;","&#xe625;"],checkbox:["&#xe626;","&#xe627;"],radio:["&#xe62b;","&#xe62a;"],branch:["&#xe622;","&#xe624;"],leaf:"&#xe621;"};r.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)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.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 r.check?'<i class="layui-icon layui-tree-check">'+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"</i>":""}(),function(){return'<a href="'+(n.href||"javascript:;")+'" '+(r.target&&n.href?'target="'+r.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),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('<div class="layui-box '+t+'"></div>'));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.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(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})});

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v2.0.1 MIT License By http://www.layui.com */
/** layui-v2.1.0 MIT License By http://www.layui.com */
;layui.define("jquery",function(e){"use strict";var o=layui.$,t={fixbar:function(e){var t,a,i="layui-fixbar",l="layui-fixbar-top",r=o(document),c=o("body");e=o.extend({showHeight:200},e),e.bar1=e.bar1===!0?"&#xe606;":e.bar1,e.bar2=e.bar2===!0?"&#xe607;":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var n=[e.bar1,e.bar2,"&#xe604;"],u=o(['<ul class="'+i+'">',e.bar1?'<li class="layui-icon" lay-type="bar1" style="'+e.bgcolor+'">'+n[0]+"</li>":"",e.bar2?'<li class="layui-icon" lay-type="bar2" style="'+e.bgcolor+'">'+n[1]+"</li>":"",'<li class="layui-icon '+l+'" lay-type="top" style="'+e.bgcolor+'">'+n[2]+"</li>","</ul>"].join("")),s=u.find("."+l),b=function(){var o=r.scrollTop();o>=e.showHeight?t||(s.show(),t=1):t&&(s.hide(),t=0)};o("."+i)[0]||("object"==typeof e.css&&u.css(e.css),c.append(u),b(),u.find("li").on("click",function(){var t=o(this),a=t.attr("lay-type");"top"===a&&o("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,a)}),r.on("scroll",function(){clearTimeout(a),a=setTimeout(function(){b()},100)}))},countdown:function(e,o,t){var a=this,i="function"==typeof o,l=new Date(e).getTime(),r=new Date(!o||i?(new Date).getTime():o).getTime(),c=l-r,n=[Math.floor(c/864e5),Math.floor(c/36e5)%24,Math.floor(c/6e4)%60,Math.floor(c/1e3)%60];i&&(t=o);var u=setTimeout(function(){a.countdown(e,r+1e3,t)},1e3);return t&&t(c>0?n:[0,0,0,0],o,u),c<=0&&clearTimeout(u),u},timeAgo:function(e,o){var t=(new Date).getTime()-new Date(e).getTime();return t>2592e6?(t=new Date(e).toLocaleString(),o&&(t=t.replace(/\s[\S]+$/g,"")),t):t>=864e5?(t/1e3/60/60/24|0)+"天前":t>=36e5?(t/1e3/60/60|0)+"小时前":t>=18e4?(t/1e3/60|0)+"分钟前":t<0?"未来":"刚刚"}};e("util",t)});

6
dist/layui.all.js vendored

File diff suppressed because one or more lines are too long

4
dist/layui.js vendored

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
{
"code": 0
,"msg": ""
,"data": {
"src": "http://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
,"title": "图片名称"
}
}

View File

@ -23,7 +23,6 @@ body{padding: 50px 100px;}
<input type="text" class="layui-input" id="test1">
</div>
<br><br><hr><br>
日期选择器:
@ -62,6 +61,21 @@ body{padding: 50px 100px;}
<br><br><hr><br>
同时绑定多个:
<div class="layui-inline">
<input type="text" class="layui-input test-item">
</div>
<div class="layui-inline">
<input type="text" class="layui-input test-item">
</div>
<div class="layui-inline">
<input type="text" class="layui-input test-item">
</div>
<br><br><hr><br>
墨绿主题:
<div class="layui-inline">
<input type="text" class="layui-input" id="test6-1">
@ -120,8 +134,8 @@ layui.use('laydate', function(){
elem: '#test2'
,format: 'y年MM月dd日'
//,value: new Date(2017,7,20)
//,min: -1 //负数代表为n天前正数代表为n天后。或这种格式min: '2017-8-20'
//,max: 1 //最大日期为n天后
,min: '2016-9-20'
,max: '2018-9-20'
,ready: function(date){
console.log(date);
}
@ -185,6 +199,14 @@ layui.use('laydate', function(){
}
});
//同时绑定多个
lay('.test-item').each(function(){
laydate.render({
elem: this
,trigger: 'click'
});
});
//自定义重要日
var ins555 = laydate.render({
elem: '#test555'

View File

@ -34,8 +34,8 @@ layui.use('layedit', function(){
var index = layedit.build('demo', {
//hideTool: ['image']
uploadImage: {
url: '/upload/test/'
,type: 'post'
url: 'json/upload/demoLayEdit.json'
,type: 'get'
}
//,tool: []
//,height: 100

29
examples/responsive.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>响应式测试 - Layui</title>
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding: 20px;}
</style>
</head>
<body>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<div class="layui-hide-xs layui-show-sm-inline layui-show-md-block">
移动:隐藏
<br>平板inline
<br>PCblock
</div>
</body>
</html>

View File

@ -21,7 +21,7 @@ body{padding: 20px;}
<button class="layui-btn" data-type="isAll">验证是否全选</button>
</div>
<table class="layui-table" lay-data="{width:900, height:330, url:'json/table/demo1.json', page:true, id:'test'}" lay-filter="test">
<table class="layui-table" lay-data="{width:900, height:'full-100', url:'json/table/demo1.json', page:true, id:'test'}" lay-filter="test">
<thead>
<tr>
<th lay-data="{checkbox:true, fixed: true}"></th>
@ -31,7 +31,7 @@ body{padding: 20px;}
<th lay-data="{field:'sex', width:80}">性别</th>
<th lay-data="{field:'city', width:100}">城市</th>
<th lay-data="{field:'sign', width:150}">签名</th>
<th lay-data="{field:'experience', width:80, sort: true}">积分</th>
<th lay-data="{field:'experience', width:80, sort: true, edit: 'text'}">积分</th>
<th lay-data="{field:'ip', width:120}">IP</th>
<th lay-data="{field:'logins', width:100}">登入次数</th>
<th lay-data="{field:'joinTime', width:120}">加入时间</th>
@ -61,13 +61,13 @@ body{padding: 20px;}
<th lay-data="{field:'ip', width:120}">IP</th>
<th lay-data="{field:'logins', width:100, sort: true}">登入次数</th>
<th lay-data="{field:'joinTime', width:120}">加入时间</th>
<th lay-data="{fixed: 'right', toolbar: '#barDemo', width:150, align:'center'}">操作</th>
<th lay-data="{fixed: 'right', toolbar: '#barDemo', width:150}">操作</th>
</tr>
</thead>
</table>
<script type="text/html" id="usernameTpl">
<a href="" class="layui-table-link">{{d.username}}</a>
<a href="" class="layui-table-link">{{d.username || ''}}</a>
</script>
<script type="text/html" id="LAY_table_tpl_email">
<span {{# if(!d.activate){ }}style="color:#999"{{# } }}>{{ d.email }}</span>
@ -245,7 +245,8 @@ layui.use('table', function(){
,width: 900
//,height: 274
,cols: [[ //标题栏
{checkbox: true, LAY_CHECKED: true}
{space: true, fixed: true}
,{checkbox: true, LAY_CHECKED: true}
,{field: 'id', title: 'ID', width: 80, sort: true}
,{field: 'username', title: '用户名', width: 120}
,{field: 'email', title: '邮箱', width: 150}
@ -255,6 +256,7 @@ layui.use('table', function(){
,{field: 'experience', title: '积分', width: 80, sort: true}
]]
,id:'test111'
,skin: 'row' //表格风格
,even: true
//,size: 'lg' //尺寸
@ -278,7 +280,6 @@ layui.use('table', function(){
,data = obj.data //得到所在行所有键值
,field = obj.field; //得到字段
data[field] = value; //更新缓存中的值
});
//监听工具条
@ -294,6 +295,16 @@ layui.use('table', function(){
}
});
//监听排序
table.on('sort(test)', function(obj){
console.log(this, obj)
return;
table.reload('test', {
height: 300
});
});
var $ = layui.jquery, active = {
getCheckData: function(){

View File

@ -51,14 +51,19 @@ hr{margin: 30px 0;}
<hr>
<button type="button" class="layui-btn" id="test3"><i class="layui-icon">&#xe67c;</i>上传文件</button>
<button type="button" class="layui-btn layui-btn-primary" id="test33"><i class="layui-icon">&#xe67c;</i>换个样式</button>
<button type="button" class="layui-btn test333" lay-data="{size:10,url:'a'}" id="test3"><i class="layui-icon">&#xe67c;</i>上传文件</button>
<button type="button" class="layui-btn layui-btn-primary test333" lay-data="{size:20,url:'b'}" id="test33"><i class="layui-icon">&#xe67c;</i>换个样式</button>
<button type="button" class="layui-btn" id="test4"><i class="layui-icon">&#xe67c;</i>上传视频</button>
<button type="button" class="layui-btn" id="test5"><i class="layui-icon">&#xe67c;</i>上传音频</button>
<hr>
<button class="layui-btn testm" lay-data="{url: '/a/'}">参数设在元素上</button>
<button class="layui-btn testm" lay-data="{url: '/b/', accept: 'file',size:5}">参数设在元素上</button>
<hr>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="test6">选择文件</button>
<button type="button" class="layui-btn" id="test7">开始上传</button>
@ -184,13 +189,26 @@ layui.use('upload', function(){
upload.render({
elem: '#test3'
,url: ''
elem: '.test333'
,url: 'a'
,accept: 'file'
,before: function(obj){
console.log(this.item);
}
,done: function(res){
console.log(res)
}
});
upload.render({
elem: '.testm'
,done: function(res, index, upload){
//获取当前触发上传的元素,一般用于 elem 绑定 class 的情况,注意:此乃 layui 2.1.0 新增
var item = this.item;
}
})
/*
upload.render({
elem: '#test33'
,url: ''
@ -198,7 +216,7 @@ layui.use('upload', function(){
,done: function(res){
console.log(res)
}
});
});*/
upload.render({
elem: '#test4'

View File

@ -13,6 +13,7 @@ var header = require('gulp-header');
var del = require('del');
var gulpif = require('gulp-if');
var minimist = require('minimist');
var zip = require('gulp-zip');
//获取参数
var argv = require('minimist')(process.argv.slice(2), {
@ -30,6 +31,10 @@ var argv = require('minimist')(process.argv.slice(2), {
//模块
,mods = 'laytpl,laypage,laydate,jquery,layer,element,upload,form,tree,table,carousel,util,flow,layedit,code'
//发行版本目录
,releaseDir = './release/layui-v' + pkg.version
,release = releaseDir + '/layui'
//任务
,task = {
@ -48,7 +53,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,'!./src/lay/all.js'
,'!./src/lay/all-mobile.js'
]
,dir = ver ? 'release' : 'dist';
,dir = ver ? release : 'dist';
//过滤 layim
if(ver || argv.open){
@ -69,7 +74,7 @@ var argv = require('minimist')(process.argv.slice(2), {
'./src/**/{layui,all,'+ mods +'}.js'
,'!./src/**/mobile/*.js'
]
,dir = ver ? 'release' : 'dist';
,dir = ver ? release : 'dist';
return gulp.src(src).pipe(uglify())
.pipe(concat('layui.all.js', {newLine: ''}))
@ -86,7 +91,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,'./src/lay/modules/laytpl.js'
,'./src/**/mobile/{'+ mods +'}.js'
]
,dir = ver ? 'release' : 'dist';
,dir = ver ? release : 'dist';
if(ver || argv.open){
src.push('./src/**/mobile/layim-mobile-open.js');
@ -106,7 +111,7 @@ var argv = require('minimist')(process.argv.slice(2), {
ver = ver === 'open';
var src = ['./src/css/**/*.css']
,dir = ver ? 'release' : 'dist'
,dir = ver ? release : 'dist'
,noteNew = JSON.parse(JSON.stringify(note));
if(ver || argv.open){
@ -125,7 +130,7 @@ var argv = require('minimist')(process.argv.slice(2), {
,font: function(ver){
ver = ver === 'open';
var dir = ver ? 'release' : 'dist';
var dir = ver ? release : 'dist';
return gulp.src('./src/font/*')
.pipe(rename({}))
@ -137,7 +142,7 @@ var argv = require('minimist')(process.argv.slice(2), {
ver = ver === 'open';
var src = ['./src/**/*.{png,jpg,gif,html,mp3,json}']
,dir = ver ? 'release' : 'dist';
,dir = ver ? release : 'dist';
if(ver || argv.open){
src.push('!./src/**/layim/**/*.*');
@ -146,6 +151,12 @@ var argv = require('minimist')(process.argv.slice(2), {
gulp.src(src).pipe(rename({}))
.pipe(gulp.dest('./'+ dir));
}
//复制发行的引导文件
,release: function(){
gulp.src('./release/doc/**/*')
.pipe(gulp.dest(releaseDir));
}
};
//清理
@ -153,7 +164,7 @@ gulp.task('clear', function(cb) {
return del(['./dist/*'], cb);
});
gulp.task('clearRelease', function(cb) {
return del(['./release/*'], cb);
return del([releaseDir], cb);
});
gulp.task('minjs', task.minjs);
@ -162,6 +173,7 @@ gulp.task('mobile', task.mobile);
gulp.task('mincss', task.mincss);
gulp.task('font', task.font);
gulp.task('mv', task.mv);
gulp.task('release', task.release);
//开源版
gulp.task('default', ['clearRelease'], function(){ //命令gulp
@ -170,6 +182,26 @@ gulp.task('default', ['clearRelease'], function(){ //命令gulp
}
});
//压缩
gulp.task('zip', function(){
gulp.src('./release/layui-v' + pkg.version + '/**/*')
.pipe(zip('layui-v' + pkg.version + '.zip'))
.pipe(gulp.dest('./release'));
});
//打包LayIM
gulp.task('layim', function(){
var dir = './release/layui.layim-v'+ pkg.layimV;
gulp.src('./release/doc-layim/**/*')
.pipe(gulp.dest(dir))
gulp.src('./src/**/*')
.pipe(gulp.dest(dir + '/src'))
return gulp.src('./dist/**/*')
.pipe(gulp.dest(dir + '/dist'));
});
//完整任务
gulp.task('all', ['clear'], function(){ //命令gulp all过滤layimgulp all --open
for(var key in task){

View File

@ -1,6 +1,7 @@
{
"name": "layui",
"version": "2.0.1",
"version": "2.1.0",
"layimV": "3.7.0",
"description": "经典模块化前端框架",
"main": "layui.js",
"license": "MIT",
@ -17,14 +18,14 @@
"author": "贤心",
"homepage": "http://www.layui.com",
"devDependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-uglify": "^1.5.4",
"gulp-concat": "^2.6.0 ",
"gulp-header": "^1.8.8",
"gulp-if": "^2.0.1",
"gulp-minify-css": "^1.2.4",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.4",
"del": "^2.2.2",
"gulp-zip": "^4.0.0",
"minimist": "^1.2.0",
"chai": "^3.5.0",

View File

@ -22,11 +22,11 @@ pre{white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; w
/** 图标字体 **/
@font-face {font-family: 'layui-icon';
src: url('../font/iconfont.eot?v=2.0.0');
src: url('../font/iconfont.eot?v=2.0.0#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=2.0.0#iconfont') format('svg'),
url('../font/iconfont.woff?v=2.0.0') format('woff'),
url('../font/iconfont.ttf?v=2.0.0') format('truetype');
src: url('../font/iconfont.eot?v=2');
src: url('../font/iconfont.eot?v=2#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=2#iconfont') format('svg'),
url('../font/iconfont.woff?v=2') format('woff'),
url('../font/iconfont.ttf?v=2') format('truetype');
}
@ -78,9 +78,13 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-layout-left{position: absolute !important; left: 200px; top: 0;}
.layui-layout-right{position: absolute !important; right: 0; top: 0;}
/* 响应式类 */
/* 栅格布局 */
.layui-container{position: relative; margin: 0 auto; padding: 0 15px; box-sizing: border-box;}
.layui-fluid{position: relative; margin: 0 auto; padding: 0 15px;}
.layui-row:before, .layui-row:after{content: ''; display: block; clear: both;}
.layui-col-xs1, .layui-col-xs2, .layui-col-xs3, .layui-col-xs4, .layui-col-xs5, .layui-col-xs6, .layui-col-xs7, .layui-col-xs8, .layui-col-xs9, .layui-col-xs10, .layui-col-xs11, .layui-col-xs12
,.layui-col-sm1, .layui-col-sm2, .layui-col-sm3, .layui-col-sm4, .layui-col-sm5, .layui-col-sm6, .layui-col-sm7, .layui-col-sm8, .layui-col-sm9, .layui-col-sm10, .layui-col-sm11, .layui-col-sm12
@ -115,8 +119,20 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-col-xs-offset11{margin-left: 91.66666667%;}
.layui-col-xs-offset12{margin-left: 100%;}
/* 小型屏幕(平板) */@media screen and (min-width: 780px) {
/* 超小屏幕(手机) */@media screen and (max-width: 768px) {
.layui-hide-xs{display: none!important;}
.layui-show-xs-block{display: block!important;}
.layui-show-xs-inline{display: inline!important;}
.layui-show-xs-inline-block{display: inline-block!important;}
}
/* 小型屏幕(平板) */@media screen and (min-width: 768px) {
.layui-container{width: 750px;}
.layui-hide-sm{display: none!important;}
.layui-show-sm-block{display: block!important;}
.layui-show-sm-inline{display: inline!important;}
.layui-show-sm-inline-block{display: inline-block!important;}
.layui-col-sm1, .layui-col-sm2, .layui-col-sm3, .layui-col-sm4, .layui-col-sm5, .layui-col-sm6, .layui-col-sm7, .layui-col-sm8, .layui-col-sm9, .layui-col-sm10, .layui-col-sm11, .layui-col-sm12{float: left;}
.layui-col-sm1{width: 8.33333333%;}
.layui-col-sm2{width: 16.66666667%;}
@ -144,8 +160,13 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-col-sm-offset11{margin-left: 91.66666667%;}
.layui-col-sm-offset12{margin-left: 100%;}
}
/* 中型屏幕(桌面) */@media screen and (min-width: 1000px) {
/* 中型屏幕(桌面) */@media screen and (min-width: 992px) {
.layui-container{width: 970px;}
.layui-hide-md{display: none!important;}
.layui-show-md-block{display: block!important;}
.layui-show-md-inline{display: inline!important;}
.layui-show-md-inline-block{display: inline-block!important;}
.layui-col-md1, .layui-col-md2, .layui-col-md3, .layui-col-md4, .layui-col-md5, .layui-col-md6, .layui-col-md7, .layui-col-md8, .layui-col-md9, .layui-col-md10, .layui-col-md11, .layui-col-md12{float: left;}
.layui-col-md1{width: 8.33333333%;}
.layui-col-md2{width: 16.66666667%;}
@ -173,8 +194,13 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-col-md-offset11{margin-left: 91.66666667%;}
.layui-col-md-offset12{margin-left: 100%;}
}
/* 大型屏幕(桌面) */@media screen and (min-width: 1200px) {
/* 大型屏幕(桌面) */@media screen and (min-width: 1200px) {
.layui-container{width: 1170px;}
.layui-hide-lg{display: none!important;}
.layui-show-lg-block{display: block!important;}
.layui-show-lg-inline{display: inline!important;}
.layui-show-lg-inline-block{display: inline-block!important;}
.layui-col-lg1, .layui-col-lg2, .layui-col-lg3, .layui-col-lg4, .layui-col-lg5, .layui-col-lg6, .layui-col-lg7, .layui-col-lg8, .layui-col-lg9, .layui-col-lg10, .layui-col-lg11, .layui-col-lg12{float: left;}
.layui-col-lg1{width: 8.33333333%;}
.layui-col-lg2{width: 16.66666667%;}
@ -560,17 +586,16 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-table-cell{height: 28px; line-height: 28px; padding: 0 15px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box;}
.layui-table-cell .layui-form-checkbox{top: -1px;}
.layui-table-cell .layui-table-link{color: #01AAED;}
.laytable-cell-space{width: 15px; padding: 0; text-align: center;}
.layui-table-body{position: relative; overflow: auto; margin-right: -1px; margin-bottom: -1px;}
.layui-table-body .layui-none{line-height: 40px; text-align: center; color: #999;}
.layui-table-fixed{position: absolute; left: 0; top: 0;}
.layui-table-fixed .layui-table-body{overflow: hidden;}
.layui-table-fixed-r{left: auto; right: -1px; box-shadow: -1px 0 8px rgba(0,0,0,.1);}
.layui-table-fixed-r th,
.layui-table-fixed-r td{border-left: 1px solid #e2e2e2!important;}
.layui-table-fixed-r{left: auto; right: -1px; border-left: 1px solid #e2e2e2; box-shadow: -1px 0 8px rgba(0,0,0,.1);}
.layui-table-fixed-r .layui-table-header{position: relative; overflow: visible;}
.layui-table-mend{position: absolute; right: -49px; top: 0; height: 100%; width: 50px;}
.layui-table-tool{position: relative; top: 1px; width: 100%; padding: 7px 10px 0 0; border-width: 0; border-top-width: 1px; height: 41px; font-size: 12px; white-space: nowrap;}
.layui-table-tool{position: relative; width: 100%; padding: 7px 10px 0 0; border-width: 0; border-top-width: 1px; height: 41px; margin-bottom: -1px; font-size: 12px; white-space: nowrap;}
.layui-table-tool:hover{overflow-x: auto;}
.layui-table-page{height: 26px;}
@ -594,7 +619,7 @@ a cite{font-style: normal; *cursor:pointer;}
body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-shadow: 0 1px 6px rgba(0,0,0,.1);}
.layui-table-tips-main{margin: -44px 0 0 -1px; max-height: 150px; padding: 8px 15px; font-size: 14px; overflow-y: scroll; background-color: #fff; color: #333; border: 1px solid #e2e2e2}
.layui-table-tips-c{position: absolute; right: -3px; top: -12px; width: 18px; height: 18px; padding: 3px; text-align: center; font-weight: 700; border-radius: 100%; font-size: 16px; cursor: pointer; background-color: #666;}
.layui-table-tips-c{position: absolute; right: -3px; top: -12px; width: 18px; height: 18px; padding: 3px; text-align: center; font-weight: 700; border-radius: 100%; font-size: 14px; cursor: pointer; background-color: #666;}
.layui-table-tips-c:hover{background-color: #999;}
@ -636,24 +661,24 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav{position: relative; padding: 0 20px; background-color: #393D49; color: #fff; border-radius: 2px; font-size: 0; box-sizing: border-box;}
.layui-nav *{font-size: 14px;}
.layui-nav .layui-nav-item{position: relative; display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; line-height: 60px;}
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #fff; opacity: 0.8; transition: all .3s; -webkit-transition: all .3s;}
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #fff; color: rgba(255,255,255,.7); transition: all .3s; -webkit-transition: all .3s;}
.layui-nav-bar,
.layui-nav .layui-this:after,
.layui-nav-tree .layui-nav-itemed:after{position: absolute; left: 0; top: 0; width: 0; height: 5px; background-color: #5FB878; transition: all .2s; -webkit-transition: all .2s;}
.layui-nav-bar{z-index: 1000;}
.layui-nav .layui-this a
,.layui-nav .layui-nav-item a:hover{opacity: 1}
,.layui-nav .layui-nav-item a:hover{color: #fff;}
.layui-nav .layui-this:after{content: ''; top: auto; bottom: 0; width: 100%;}
.layui-nav-img{width: 30px; height: 30px; margin-right: 10px; border-radius: 50%;}
.layui-nav .layui-nav-more{content:''; width: 0; height: 0; border-style: dashed; border-color: transparent; overflow: hidden; cursor: pointer; transition: all .2s; -webkit-transition: all .2s;}
.layui-nav .layui-nav-more{position: absolute; top: 28px; right: 3px; border-width: 6px; border-top-style: solid; border-top-color: #fff; opacity: 0.8;}
.layui-nav .layui-nav-more{position: absolute; top: 28px; right: 3px; border-width: 6px; border-top-style: solid; border-top-color: #fff; border-top-color: rgba(255,255,255,.7);}
.layui-nav .layui-nav-mored,
.layui-nav-itemed .layui-nav-more{top: 22px; border-style: dashed; border-color: transparent; border-bottom-style: solid; border-bottom-color: #fff;}
.layui-nav-child{display: none; position: absolute; left: 0; top: 65px; min-width: 100%; line-height: 36px; padding: 5px 0; box-shadow: 0 2px 4px rgba(0,0,0,.12); border: 1px solid #d2d2d2; background-color: #fff; z-index: 100; border-radius: 2px; white-space: nowrap;}
.layui-nav .layui-nav-child a{color: #333;}
.layui-nav .layui-nav-child a:hover{background-color: #f2f2f2;}
.layui-nav .layui-nav-child a:hover{background-color: #f2f2f2; color: #000;}
.layui-nav-child dd{position: relative;}
.layui-nav-child dd.layui-this{background-color: #5FB878; color: #fff;}
.layui-nav .layui-nav-child dd.layui-this a{background-color: #5FB878; color: #fff;}
@ -677,9 +702,9 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav-tree .layui-nav-child{position: relative; z-index: 0; top: 0; border: none; box-shadow: none;}
.layui-nav-tree .layui-nav-child a{height: 40px; line-height: 40px;}
.layui-nav-tree .layui-nav-child a{color: #fff; opacity: 0.8;}
.layui-nav-tree .layui-nav-child a{color: #fff; color: rgba(255,255,255,.7);}
.layui-nav-tree .layui-nav-child a:hover,
.layui-nav-tree .layui-nav-child{background: none; opacity: 1;}
.layui-nav-tree .layui-nav-child{background: none; color: #fff;}
.layui-nav-tree .layui-nav-more{top: 20px; right: 10px;}
.layui-nav-itemed .layui-nav-more{top: 14px;}
.layui-nav-itemed .layui-nav-child{display: block; padding: 0; background-color: rgba(0,0,0,.3) !important;}

View File

@ -80,7 +80,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.laydate-time-list p{position: relative; top: -4px; line-height: 29px;}
.laydate-time-list ol{height: 181px; overflow: hidden;}
.laydate-time-list>li:hover ol{overflow-y: auto;}
.laydate-time-list ol li{padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;}
.laydate-time-list ol li{width: 130%; padding-left: 33px; line-height: 30px; text-align: left; cursor: pointer;}
/* 提示 */
.layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;}

View File

@ -36,8 +36,10 @@ layui.define('jquery', function(exports){
var TITLE = '.layui-tab-title'
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
,titElem = tabElem.children(TITLE)
,contElem = tabElem.children('.layui-tab-content');
titElem.append('<li lay-id="'+ (options.id||'') +'">'+ (options.title||'unnaming') +'</li>');
,barElem = titElem.children('.layui-tab-bar')
,contElem = tabElem.children('.layui-tab-content')
,li = '<li lay-id="'+ (options.id||'') +'">'+ (options.title||'unnaming') +'</li>';
barElem[0] ? barElem.before(li) : titElem.append(li);
contElem.append('<div class="layui-tab-item">'+ (options.content||'') +'</div>');
call.hideTabMore(true);
call.tabAuto();

View File

@ -1,6 +1,6 @@
/**
@Name : layDate 5.0.1 日期时间控件
@Name : layDate 5.0.3 日期时间控件
@Author: 贤心
@Sitehttp://www.layui.com/laydate/
@LicenseMIT
@ -55,7 +55,7 @@
}
,laydate = {
v: '5.0.1'
v: '5.0.3'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@ -874,6 +874,12 @@
if(typeof value === 'string'){
value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, '');
}
//如果点击了开始,单未选择结束就关闭,则重新选择开始
if(that.startState && !that.endState){
delete that.startState;
that.endState = true;
};
if(typeof value === 'string' && value){
if(that.EXP_IF.test(value)){ //校验日期格式
@ -894,7 +900,7 @@
) + '<br>已为你重置');
error = true;
}
} else if(typeof value === 'object'){
} else if(value && value.constructor === Date){ //如果值为日期对象时
options.dateTime = that.systemDate(value);
} else {
options.dateTime = that.systemDate();
@ -939,7 +945,6 @@
,options = that.config, timestrap = {}
,dateTime = options[index > 41 ? 'endDate' : 'dateTime']
,isOut, thisDateTime = lay.extend({}, dateTime, date || {});
lay.each({
now: thisDateTime
,min: options.min
@ -1112,12 +1117,18 @@
lay.each(new Array(15), function(i){
var li = lay.elem('li', {
'lay-ym': yearNum
});
}), ymd = {year: yearNum};
yearNum == listYM[0] && lay(li).addClass(THIS);
li.innerHTML = yearNum + text;
ul.appendChild(li);
that.limit(lay(li), {year: yearNum}, index);
if(yearNum < that.firstDate.year){
ymd.month = options.min.month;
ymd.date = options.min.date;
} else if(yearNum > that.firstDate.year){
ymd.month = options.max.month;
ymd.date = options.max.date;
}
that.limit(lay(li), ymd, index);
yearNum++;
});
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1])
@ -1126,12 +1137,16 @@
lay.each(new Array(12), function(i){
var li = lay.elem('li', {
'lay-ym': i
});
}), ymd = {year: listYM[0], month: i};
i + 1 == listYM[1] && lay(li).addClass(THIS);
li.innerHTML = lang.month[i] + (isCN ? '月' : '');
ul.appendChild(li);
that.limit(lay(li), {year: listYM[0], month: i}, index);
if(listYM[0] < that.firstDate.year){
ymd.date = options.min.date;
} else if(listYM[0] > that.firstDate.year){
ymd.date = options.max.date;
}
that.limit(lay(li), ymd, index);
});
lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
.html(listYM[0] + text);
@ -1587,7 +1602,9 @@
,confirm: function(){
if(options.range){
if(!that.endDate) return that.hint('请先选择日期范围');
if(lay(btn).hasClass(DISABLED)) return;
if(lay(btn).hasClass(DISABLED)) return that.hint(
options.type === 'time' ? TIPS_OUT.replace(/日期/g, '时间') : TIPS_OUT
);
} else {
if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内');
}
@ -1696,8 +1713,12 @@
//选择年月
lay(header[2]).find('span').on('click', function(e){
var othis = lay(this)
,layYM = othis.attr('lay-ym').split('-')
,layYM = othis.attr('lay-ym')
,layType = othis.attr('lay-type');
if(!layYM) return;
layYM = layYM.split('-');
that.listYM[i] = [layYM[0] | 0, layYM[1] | 0];
that.list(layType, i);
@ -1763,8 +1784,8 @@
that.remove();
}).on('keydown', function(e){
if(e.keyCode === 13){
e.preventDefault();
if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){
e.preventDefault();
lay(that.footer).find(ELEM_CONFIRM)[0].click();
}
}

View File

@ -387,7 +387,7 @@ layui.define(['layer', 'form'], function(exports){
var that = this;
layui.use('upload', function(upload){
var uploadImage = set.uploadImage || {};
toolActive.haveUpload || upload.render({
upload.render({
url: uploadImage.url
,method: uploadImage.type
,elem: $(that).find('input')[0]
@ -403,7 +403,6 @@ layui.define(['layer', 'form'], function(exports){
}
}
});
toolActive.haveUpload = true;
});
}
//插入代码

View File

@ -21,6 +21,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,table = {
config: {
checkName: 'LAY_CHECKED' //是否选中状态的字段名
,indexName: 'LAY_TABLE_INDEX' //下标索引名
} //全局配置项
,cache: {} //数据缓存
,index: layui.table ? (layui.table.index + 10000) : 0
@ -40,12 +41,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
//操作当前实例
,thisTable = function(){
var that = this;
var that = this
,options = that.config
,id = options.id;
id && (thisTable.config[id] = options);
return {
reload: function(options){
that.reload.call(that, options);
}
,config: that.config
,config: options
}
}
@ -76,6 +82,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}()
,'{{# if(item2.checkbox){ }}'
,'<th data-field="{{ item2.field||i2 }}" data-type="checkbox" unresize="true"><div class="layui-table-cell laytable-cell-checkbox"><input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}></div></th>'
,'{{# } else if(item2.space){ }}'
,'<th data-field="{{ item2.field||i2 }}" unresize="true"><div class="layui-table-cell laytable-cell-space"></div></th>'
,'{{# } else { }}'
,'<th data-field="{{ item2.field||i2 }}" {{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}} {{# if(item2.unresize){ }}unresize="true"{{# } }}>'
,'{{# if(item2.colspan > 1){ }}'
@ -172,19 +180,42 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
};
//表格渲染
Class.prototype.render = function(){
var that = this, options = that.config;
Class.prototype.render = function(sets){
var that = this, options;
if(sets) that.config = sets;
options = that.config;
options.elem = $(options.elem);
options.where = options.where || {};
//请求参数的自定义格式
options.request = $.extend({
pageName: 'page'
,limitName: 'limit'
}, options.request)
//响应数据的自定义格式
options.response = $.extend({
statusName: 'code'
,statusCode: 0
,msgName: 'msg'
,dataName: 'data'
,countName: 'count'
}, options.response)
if(!options.elem[0]) return that;
var othis = options.elem
,hasRender = othis.next('.' + ELEM_VIEW)
,hasRender = othis.next('.' + ELEM_VIEW);
if(options.height && /^full-\d+$/.test(options.height)){ //full-差距值
that.fullHeightGap = options.height.split('-')[1];
options.height = _WIN.height() - that.fullHeightGap;
}
//替代元素
,reElem = that.elem = $(laytpl(TPL_MAIN).render({
var reElem = that.elem = $(laytpl(TPL_MAIN).render({
VIEW_CLASS: ELEM_VIEW
,data: options
,index: that.index //索引
@ -205,6 +236,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
that.layFixRight = reElem.find(ELEM_FIXR);
that.layTool = reElem.find(ELEM_TOOL);
//设置body区域高度
if(options.height){
that.fullSize();
}
that.pullData(1);
that.events();
};
@ -219,39 +255,44 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
//获得数据
Class.prototype.pullData = function(curr, loadIndex){
var that = this
,options = that.config;
,options = that.config
,request = options.request
,response = options.response;
if(options.url){ //Ajax请求
var params = {};
params[request.pageName] = curr;
params[request.limitName] = options.limit;
$.ajax({
type: options.method || 'get'
,url: options.url
,data: $.extend({
page: curr
,limit: options.limit
}, options.where)
,data: $.extend(params, options.where)
,dataType: 'json'
,success: function(res){
if(res.code != 0){
return layer.msg(res.msg);
if(res[response.statusName] != response.statusCode){
that.renderForm();
return that.layMain.html('<div class="layui-none">'+ (res[response.msgName] || '返回的数据状态异常') +'</div>');;
}
that.renderData(res, curr, res.count);
that.renderData(res, curr, res[response.countName]);
loadIndex && layer.close(loadIndex);
typeof options.done === 'function' && options.done(res, curr, res.count);
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
}
,error: function(e, m){
layer.msg('数据请求异常');
hint.error('初始table时的接口'+ options.url + '异常:'+ m);
that.layMain.html('<div class="layui-none">数据接口请求异常</div>');
that.renderForm();
loadIndex && layer.close(loadIndex);
}
});
} else if(options.data && options.data.constructor === Array){ //已知数据
var startLimit = curr*options.limit - options.limit
,res = {
data: options.data.concat().splice(startLimit, options.limit)
,count: options.data.length
};
var res = {}
,startLimit = curr*options.limit - options.limit
res[response.dataName] = options.data.concat().splice(startLimit, options.limit);
res[response.countName] = options.data.length;
that.renderData(res, curr, options.data.length);
typeof options.done === 'function' && options.done(res, curr, res.count);
typeof options.done === 'function' && options.done(res, curr, res[response.countName]);
}
};
@ -270,8 +311,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
//数据渲染
Class.prototype.renderData = function(res, curr, count, sort){
var that = this
,data = res.data
,options = that.config
,data = res[options.response.dataName] || []
,trs = []
,trs_fixed = []
,trs_fixed_r = []
@ -283,27 +324,29 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}
layui.each(data, function(i1, item1){
var tds = [], tds_fixed = [], tds_fixed_r = [];
if(item1.length === 0) return;
if(!sort){
item1[table.config.indexName] = i1;
}
that.eachCols(function(i3, item3){
var content = item1[item3.field||i3];
if(content === undefined || content === null){
content = (i3 === 0 ? i1+1 : '');
}
if(content === undefined || content === null) content = '';
if(item3.colspan > 1) return;
var td = ['<td data-field="'+ (item3.field||i3) +'"'+ function(){
var attr = [];
if(item3.edit) attr.push(' data-edit="true"'); //是否允许单元格编辑
if(item3.align) attr.push(' data-off="click" align="'+ item3.align +'"'); //对齐方式
if(item3.align) attr.push(' align="'+ item3.align +'"'); //对齐方式
if(item3.templet) attr.push(' data-content="'+ content +'"'); //自定义模板
if(item3.toolbar) attr.push(' data-off="true"'); //自定义模板
if(item3.event) attr.push(' lay-event="'+ item3.event +'"'); //自定义事件
if(item3.style) attr.push(' style="'+ item3.style +'"'); //自定义样式
return attr.join('');
}() +'>'
,'<div class="layui-table-cell laytable-cell-'+ function(){
if(item3.checkbox){
return 'checkbox';
}
if(item3.checkbox) return 'checkbox';
if(item3.space) return 'space'; //间距
return options.index + '-' + (item3.field||i3);
}() +'">' + function(){
if(item3.checkbox){
@ -316,8 +359,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
return item1[checkName] ? 'checked' : '';
}() +'>';
}
if(item3.fixed === 'right' && item3.toolbar){
return $(item3.toolbar).html();
if(item3.toolbar){
return laytpl($(item3.toolbar).html()||'').render(item1);
}
return item3.templet ? laytpl($(item3.templet).html() || String(content)).render(item1) : content;
}()
@ -337,7 +380,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
that.layFixLeft.find('tbody').html(trs_fixed.join(''));
that.layFixRight.find('tbody').html(trs_fixed_r.join(''));
form.render('checkbox', 'LAY-table-'+that.index);
that.renderForm();
that.syncCheckAll();
that.haveInit ? that.scrollPatch() : setTimeout(function(){
that.scrollPatch();
@ -351,20 +394,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
//排序
if(sort){
return render();
} else {
that.cacheData = data;
}
//设置body区域高度
if(options.height){
var bodyHeight = parseFloat(options.height) - parseFloat(that.layHeader.height()) - 1;
if(options.page){
bodyHeight = bodyHeight - parseFloat(that.layTool.outerHeight() + 2);
}
that.layBody.css('height', bodyHeight);
}
if(data.length === 0){
that.renderForm();
that.layFixed.remove();
return that.layMain.html('<div class="layui-none">无数据</div>');
}
@ -396,12 +430,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}
};
//渲染表单
Class.prototype.renderForm = function(type){
form.render((type || 'checkbox'), 'LAY-table-'+ this.index);
}
//数据排序
Class.prototype.sort = function(th, type, pull){
Class.prototype.sort = function(th, type, pull, formEvent){
var that = this
,field
,config = that.config
,thisData = table.cache[that.key];
,filter = config.elem.attr('lay-filter')
,data = table.cache[that.key], thisData;
//字段匹配
if(typeof th === 'string'){
@ -415,7 +455,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
}
});
}
try {
var field = field || th.data('field');
@ -431,20 +471,21 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
elemSort.attr('lay-sort', type || null);
that.layFixed.find('th')
} catch(e){
return hint.error('未到匹配field');
return hint.error('Did not match to field');
}
//记录排序索引和类型
that.sortKey = {
field: field
,sort: type
};
if(type === 'asc'){ //升序
thisData = layui.sort(thisData, field);
thisData = layui.sort(data, field);
} else if(type === 'desc'){ //降序
thisData = layui.sort(thisData, field, true);
thisData = layui.sort(data, field, true);
} else { //清除排序
thisData = that.cacheData;
thisData = layui.sort(data, table.config.indexName);
delete that.sortKey;
}
@ -452,6 +493,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
data: thisData
}, that.page, that.count, true);
layer.close(that.tipsIndex);
if(formEvent){
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
field: field
,type: type
});
}
};
//请求loading
@ -478,7 +526,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,thisData = table.cache[that.key];
if(!thisData[index]) return;
thisData[index][config.checkName] = checked;
that.cacheData[index][config.checkName] = checked;
};
//同步全选按钮状态
@ -500,13 +547,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
if(table.checkStatus(that.key).isAll){
if(!checkAllElem[0].checked){
checkAllElem.prop('checked', true);
form.render('checkbox', 'LAY-table-'+that.index);
that.renderForm();
}
syncColsCheck(true);
} else {
if(checkAllElem[0].checked){
checkAllElem.prop('checked', false);
form.render('checkbox', 'LAY-table-'+that.index);
that.renderForm();
}
syncColsCheck(false);
}
@ -525,6 +572,26 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
});
};
//尺寸始终铺满
Class.prototype.fullSize = function(){
var that = this
,options = that.config
,height = options.height, bodyHeight;
if(that.fullHeightGap){
height = _WIN.height() - that.fullHeightGap;
if(height < 135) height = 135;
that.elem.css('height', height);
}
//tbody区域高度
bodyHeight = parseFloat(height) - parseFloat(that.layHeader.height()) - 1;
if(options.page){
bodyHeight = bodyHeight - parseFloat(that.layTool.outerHeight() + 1);
}
that.layBody.css('height', bodyHeight);
};
//滚动条补丁
Class.prototype.scrollPatch = function(){
var that = this
@ -555,7 +622,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,th = that.layHeader.find('th')
,resizing
,ELEM_CELL = '.layui-table-cell'
,filter = config.id || config.elem.attr('lay-filter');
,filter = config.elem.attr('lay-filter');
//拖拽调整宽度
th.on('mousemove', function(e){
@ -622,16 +689,16 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
} else {
type = 'asc';
}
that.sort(othis, type);
that.sort(othis, type, null, true);
}).find(ELEM_SORT+' .layui-edge ').on('click', function(e){
var othis = $(this)
,index = othis.index()
,field = othis.parents('th').eq(0).data('field')
layui.stope(e);
if(index === 0){
that.sort(field, 'asc');
that.sort(field, 'asc', null, true);
} else {
that.sort(field, 'desc');
that.sort(field, 'desc', null, true);
}
});
@ -650,7 +717,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
that.setCheckData(i, checked);
});
that.syncCheckAll();
form.render('checkbox', 'LAY-table-'+that.index);
that.renderForm();
} else {
that.setCheckData(index, checked);
that.syncCheckAll();
@ -679,9 +746,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,value = this.value
,field = othis.parent().data('field')
,index = othis.parents('tr').eq(0).data('index')
,data = table.cache[that.key][index];
data[field] = value; //更新缓存中的值
layui.event.call(this, MOD_NAME, 'edit('+ filter +')', {
value: value
,data: table.cache[that.key][index]
,data: data
,field: field
});
}).on('blur', '.'+ELEM_EDIT, function(){
@ -754,20 +825,19 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var othis = $(this)
,index = othis.parents('tr').eq(0).data('index')
,tr = that.layBody.find('tr[data-index="'+ index +'"]')
,ELEM_CLICK = 'layui-table-click';
,ELEM_CLICK = 'layui-table-click'
,data = table.cache[that.key][index];
layui.event.call(this, MOD_NAME, 'tool('+ filter +')', {
data: table.cache[that.key][index]
data: table.clearCacheKey(data)
,event: othis.attr('lay-event')
,tr: tr
,del: function(){
var data = this.data;
delete data[table.config.checkName];
table.cache[that.key][index] = [];
tr.remove();
that.scrollPatch();
}
,update: function(fields){
var data = this.data;
fields = fields || {};
layui.each(fields, function(key, value){
if(key in data){
@ -801,6 +871,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
});
_WIN.on('resize', function(){ //自适应
that.fullSize();
that.scrollPatch();
});
};
@ -809,7 +880,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
table.init = function(filter, settings){
settings = settings || {};
var that = this
,elemTable = filter ? $('table[lay-filter="'+ filter +'"]') : $(ELEM + '[lay-data]');
,elemTable = filter ? $('table[lay-filter="'+ filter +'"]') : $(ELEM + '[lay-data]')
,errorTips = 'Table element property lay-data configuration item has a syntax error: ';
//遍历数据表格
elemTable.each(function(){
@ -818,7 +890,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
try{
tableData = new Function('return '+ tableData)();
} catch(e){
hint.error('table元素属性lay-data配置项存在语法错误'+ tableData)
hint.error(errorTips + tableData)
}
var cols = [], options = $.extend({
@ -841,7 +913,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
try{
itemData = new Function('return '+ itemData)();
} catch(e){
return hint.error('table元素属性lay-data配置项存在语法错误'+ itemData)
return hint.error(errorTips + itemData)
}
var row = $.extend({
@ -888,7 +960,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
layui.each(data, function(i, item){
if(item[table.config.checkName]){
nums++;
arr.push(item);
arr.push(table.clearCacheKey(item));
}
});
return {
@ -896,6 +968,14 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,isAll: nums === data.length //是否全选
};
};
//表格重载
thisTable.config = {};
table.reload = function(id, options){
var config = thisTable.config[id];
if(!config) return hint.error('The ID option was not found in the table instance');
return table.render($.extend({}, config, options));
};
//核心入口
table.render = function(options){
@ -903,6 +983,14 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
return thisTable.call(inst);
};
//清除临时Key
table.clearCacheKey = function(data){
data = $.extend({}, data);
delete data[table.config.checkName];
delete data[table.config.indexName];
return data;
};
//自动完成渲染
table.init();

View File

@ -283,7 +283,6 @@ layui.define('layer' , function(exports){
});
return that.files;
}
,elemFile: elemFile
}
//提交上传
@ -389,6 +388,18 @@ layui.define('layer' , function(exports){
//点击上传容器
options.elem.off('upload.start').on('upload.start', function(){
var othis = $(this), data = othis.attr('lay-data');
if(data){
try{
data = new Function('return '+ data)();
that.config = $.extend({}, options, data);
} catch(e){
hint.error('Upload element property lay-data configuration item has a syntax error: ' + data)
}
}
that.config.item = othis;
that.elemFile[0].click();
});
@ -417,7 +428,7 @@ layui.define('layer' , function(exports){
}
//文件选择
that.elemFile.on('change', function(){
that.elemFile.off('upload.change').on('upload.change', function(){
var files = this.files || [];
setChooseFile(files);
options.auto ? that.upload() : setChooseText(files); //是否自动触发上传
@ -431,6 +442,10 @@ layui.define('layer' , function(exports){
//防止事件重复绑定
if(options.elem.data('haveEvents')) return;
that.elemFile.on('change', function(){
$(this).trigger('upload.change');
});
options.elem.on('click', function(){
if(that.isFile()) return;
$(this).trigger('upload.start');

View File

@ -19,7 +19,7 @@
}
,Layui = function(){
this.v = '2.0.1'; //版本号
this.v = '2.1.0'; //版本号
}
//获取layui所在目录
@ -421,6 +421,12 @@
if(isNum.test(v1)) v1 = parseFloat(v1);
if(isNum.test(v2)) v2 = parseFloat(v2);
if(v1 && !v2){
return 1;
} else if(!v1 && v2){
return -1;
}
if(v1 > v2){
return 1;
@ -430,6 +436,7 @@
return 0;
}
});
desc && clone.reverse(); //倒序
return clone;
};