Browse Source

2.1.3

pull/65/head
sentsin 7 years ago
parent
commit
5a9b861989
  1. 1
      CHANGELOG.md
  2. 2
      bower.json
  3. 4
      dist/css/layui.css
  4. 2
      dist/css/layui.mobile.css
  5. 2
      dist/css/modules/code.css
  6. 2
      dist/css/modules/laydate/default/laydate.css
  7. 4
      dist/css/modules/layer/default/layer.css
  8. BIN
      dist/font/iconfont.eot
  9. 8
      dist/font/iconfont.svg
  10. BIN
      dist/font/iconfont.ttf
  11. BIN
      dist/font/iconfont.woff
  12. 2
      dist/lay/modules/carousel.js
  13. 2
      dist/lay/modules/code.js
  14. 2
      dist/lay/modules/element.js
  15. 2
      dist/lay/modules/flow.js
  16. 4
      dist/lay/modules/form.js
  17. 2
      dist/lay/modules/jquery.js
  18. 4
      dist/lay/modules/laydate.js
  19. 2
      dist/lay/modules/layedit.js
  20. 4
      dist/lay/modules/layer.js
  21. 2
      dist/lay/modules/laypage.js
  22. 2
      dist/lay/modules/laytpl.js
  23. 2
      dist/lay/modules/mobile.js
  24. 4
      dist/lay/modules/table.js
  25. 2
      dist/lay/modules/tree.js
  26. 2
      dist/lay/modules/upload.js
  27. 2
      dist/lay/modules/util.js
  28. 6
      dist/layui.all.js
  29. 4
      dist/layui.js
  30. 2
      examples/form.html
  31. 8
      examples/laydate.html
  32. 2
      examples/layer.html
  33. 48
      examples/table.html
  34. 52
      gulpfile.js
  35. 6
      package.json
  36. 13
      src/css/layui.css
  37. 16
      src/css/modules/laydate/default/font.css
  38. 8
      src/css/modules/layer/default/layer.css
  39. BIN
      src/font/iconfont.eot
  40. 8
      src/font/iconfont.svg
  41. BIN
      src/font/iconfont.ttf
  42. BIN
      src/font/iconfont.woff
  43. 7
      src/lay/modules/form.js
  44. 49
      src/lay/modules/laydate.js
  45. 23
      src/lay/modules/layer.js
  46. 33
      src/lay/modules/table.js
  47. 2
      src/layui.js

1
CHANGELOG.md

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

2
bower.json

@ -1,7 +1,7 @@
{
"name": "layui",
"main": "src/layui.js",
"version": "2.1.2",
"version": "2.1.3",
"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

2
dist/css/layui.mobile.css vendored

File diff suppressed because one or more lines are too long

2
dist/css/modules/code.css vendored

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

2
dist/css/modules/laydate/default/laydate.css vendored

File diff suppressed because one or more lines are too long

4
dist/css/modules/layer/default/layer.css vendored

File diff suppressed because one or more lines are too long

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

8
dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 202 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

2
dist/lay/modules/carousel.js vendored

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

2
dist/lay/modules/code.js vendored

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

2
dist/lay/modules/element.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/flow.js vendored

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

4
dist/lay/modules/form.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/jquery.js vendored

File diff suppressed because one or more lines are too long

4
dist/lay/modules/laydate.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/layedit.js vendored

File diff suppressed because one or more lines are too long

4
dist/lay/modules/layer.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/laypage.js vendored

@ -1,2 +1,2 @@
/** layui-v2.1.2 MIT License By http://www.layui.com */
/** layui-v2.1.3 MIT License By http://www.layui.com */
;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="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,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,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),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"&#x4E0A;&#x4E00;&#x9875;",a.next="next"in a?a.next:"&#x4E0B;&#x4E00;&#x9875;";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?'<a href="javascript:;" class="layui-laypage-prev'+(1==a.curr?" "+r:"")+'" data-page="'+(a.curr-1)+'">'+a.prev+"</a>":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push('<a href="javascript:;" class="layui-laypage-first" data-page="1" title="&#x9996;&#x9875;">'+(a.first||1)+"</a>");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r<t-1&&(r=u-t+1),a.first!==!1&&r>2&&e.push('<span class="layui-laypage-spr">&#x2026;</span>');r<=u;r++)r===a.curr?e.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+(/^#/.test(a.theme)?'style="background-color:'+a.theme+';"':"")+"></em><em>"+r+"</em></span>"):e.push('<a href="javascript:;" data-page="'+r+'">'+r+"</a>");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1<a.pages&&e.push('<span class="layui-laypage-spr">&#x2026;</span>'),0!==t&&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?" "+r:"")+'" 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,n){e.push('<option value="'+n+'"'+(n===a.limit?"selected":"")+">"+n+" 条/页</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){i[t]&&e.push(i[t])}),e.join("")}(),"</div>"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;o<y;o++)"a"===r[o].nodeName.toLowerCase()&&s.on(r[o],"click",function(){var e=0|this.getAttribute("data-page");e<1||e>i.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.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(i,s)});

2
dist/lay/modules/laytpl.js vendored

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

2
dist/lay/modules/mobile.js vendored

File diff suppressed because one or more lines are too long

4
dist/lay/modules/table.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/tree.js vendored

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

2
dist/lay/modules/upload.js vendored

File diff suppressed because one or more lines are too long

2
dist/lay/modules/util.js vendored

@ -1,2 +1,2 @@
/** layui-v2.1.2 MIT License By http://www.layui.com */
/** layui-v2.1.3 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

2
examples/form.html

@ -28,7 +28,7 @@ body{padding: 10px;}
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-block">
<input type="tel" name="phone" lay-verify="phone" autocomplete="off" class="layui-input">
<input type="tel" name="phone" lay-verify="number" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">

8
examples/laydate.html

@ -132,8 +132,10 @@ layui.use('laydate', function(){
//单控件
laydate.render({
elem: '#test2'
,format: 'y年MM月dd日'
,value: new Date(1989,9,14)
//,format: 'yyyy年MM月dd日'
//,value: new Date(1989,9,14)
,format: 'yyyyMMdd'
,value: '20170910'
//,max: 0
//,min: '2016-10-14'
//,max: -1
@ -164,7 +166,7 @@ layui.use('laydate', function(){
laydate.render({
elem: '#test4'
,type: 'month'
//,range: true
,range: true
//,trigger: 'click'
,max: -30
,done: function(value, date, endDate){

2
examples/layer.html

@ -15,7 +15,7 @@ body{padding: 100px;}
</head>
<body>
<button class="layui-btn demo" data-type="test">Alert</button>
<button class="layui-btn layui-btn-primary demo" data-type="test">Alert</button>
<button class="layui-btn demo" data-type="test2">Confirm</button>
<button class="layui-btn demo" data-type="test3">Msg</button>
<button class="layui-btn demo" data-type="test4">Tips</button>

48
examples/table.html

@ -144,6 +144,44 @@ body{padding: 20px;}
</tbody>
</table>
<table class="layui-table" lay-filter="parse-table-demo">
<thead>
<tr>
<td rowspan="2" lay-data="{field:'louceng', width:200}">楼层</td>
<td colspan="2">1单元</td>
<td colspan="2">2单元</td>
</tr>
<tr>
<td lay-data="{field:'men1', width:80}">1门</td>
<td lay-data="{field:'men2', width:80}">2门</td>
<td lay-data="{field:'men3', width:80}">1门</td>
<td lay-data="{field:'men4', width:80}">2门</td>
</tr>
</thead>
<tbody>
<tr>
<td>3楼</td>
<td>301</td>
<td>302</td>
<td>301</td>
<td>302</td>
</tr>
<tr>
<td>2楼</td>
<td>201</td>
<td>202</td>
<td>201</td>
<td>202</td>
</tr>
<tr>
<td>1楼</td>
<td>101</td>
<td>102</td>
<td>101</td>
<td>102</td>
</tr>
</tbody>
</table>
<script src="../src/layui.js" charset="utf-8"></script>
<script>
@ -293,7 +331,15 @@ layui.use('table', function(){
layer.close(index);
});
} else if(obj.event === 'edit'){
layer.alert('编辑行:<br>'+ JSON.stringify(data))
layer.prompt({
formType: 2
,value: data.username
}, function(value, index){
obj.update({
username: value
});
layer.close(index);
});
}
});

52
gulpfile.js

@ -3,6 +3,7 @@
*/
var pkg = require('./package.json');
var inds = pkg.independent;
var gulp = require('gulp');
var uglify = require('gulp-uglify');
@ -110,7 +111,10 @@ var argv = require('minimist')(process.argv.slice(2), {
,mincss: function(ver){
ver = ver === 'open';
var src = ['./src/css/**/*.css']
var src = [
'./src/css/**/*.css'
,'!./src/css/**/font.css'
]
,dir = ver ? release : 'dist'
,noteNew = JSON.parse(JSON.stringify(note));
@ -175,23 +179,46 @@ gulp.task('font', task.font);
gulp.task('mv', task.mv);
gulp.task('release', task.release);
//开源
//发行
gulp.task('default', ['clearRelease'], function(){ //命令:gulp
for(var key in task){
task[key]('open');
}
});
//压缩
gulp.task('zip', function(){
gulp.src('./release/layui-v' + pkg.version + '/**/*')
.pipe(zip('layui-v' + pkg.version + '.zip'))
.pipe(gulp.dest('./release'));
//完整任务
gulp.task('all', ['clear'], function(){ //命令:gulp all,过滤layim:gulp all --open
for(var key in task){
task[key]();
}
});
//打包layer独立版
gulp.task('layer', function(){
var dir = './release/layer';
gulp.src('./src/css/modules/layer/default/*')
.pipe(gulp.dest(dir + '/src/theme/default'));
return gulp.src('./src/lay/modules/layer.js')
.pipe(gulp.dest(dir + '/src'));
});
//打包layDate独立版
gulp.task('laydate', function(){
var dir = './release/laydate';
gulp.src('./src/css/modules/laydate/default/{font,laydate}.css')
.pipe(concat('laydate.css', {newLine: '\n\n'}))
.pipe(gulp.dest(dir + '/src/theme/default'));
return gulp.src('./src/lay/modules/laydate.js')
.pipe(gulp.dest(dir + '/src'));
});
//打包LayIM
//打包LayIM版本
gulp.task('layim', function(){
var dir = './release/zip/layui.layim-v'+ pkg.layimV;
var dir = './release/zip/layui.layim-v'+ inds.layim;
gulp.src('./release/doc-layim/**/*')
.pipe(gulp.dest(dir))
@ -202,12 +229,7 @@ gulp.task('layim', function(){
.pipe(gulp.dest(dir + '/dist'));
});
//完整任务
gulp.task('all', ['clear'], function(){ //命令:gulp all,过滤layim:gulp all --open
for(var key in task){
task[key]();
}
});

6
package.json

@ -1,7 +1,9 @@
{
"name": "layui",
"version": "2.1.2",
"layimV": "3.7.0",
"version": "2.1.3",
"independents": {
"layim": "3.7.2"
},
"description": "经典模块化前端框架",
"main": "layui.js",
"license": "MIT",

13
src/css/layui.css

@ -22,12 +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');
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');
src: url('../font/iconfont.eot?v=213');
src: url('../font/iconfont.eot?v=213#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=213#iconfont') format('svg'),
url('../font/iconfont.woff?v=213') format('woff'),
url('../font/iconfont.ttf?v=213') format('truetype');
}
.layui-icon{
@ -256,7 +255,7 @@ a cite{font-style: normal; *cursor:pointer;}
/** 页面元素 **/
.layui-btn, .layui-input, .layui-textarea, .layui-upload-button, .layui-select{outline: none; -webkit-transition: border-color .3s cubic-bezier(.65,.05,.35,.5); transition: border-color .3s cubic-bezier(.65,.05,.35,.5); box-sizing: border-box;}
.layui-btn, .layui-input, .layui-textarea, .layui-upload-button, .layui-select{outline: none; transition: all .3s; -webkit-transition: all .3s; box-sizing: border-box;}
/* 引用 */.layui-elem-quote{margin-bottom: 10px; padding: 15px; line-height: 22px; border-left: 5px solid #009688; border-radius: 0 2px 2px 0; background-color: #f2f2f2;}
.layui-quote-nm{border-color: #e2e2e2; border-style: solid; border-width: 1px; border-left-width: 5px; background: none;}

16
src/css/modules/laydate/default/font.css

@ -0,0 +1,16 @@
/** 图标字体 **/
@font-face {font-family: 'laydate-icon';
src: url('./font/iconfont.eot');
src: url('./font/iconfont.eot#iefix') format('embedded-opentype'),
url('./font/iconfont.svg#iconfont') format('svg'),
url('./font/iconfont.woff') format('woff'),
url('./font/iconfont.ttf') format('truetype');
}
.laydate-icon{
font-family:"laydate-icon" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

8
src/css/modules/layer/default/layer.css

@ -12,7 +12,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;}
.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}
.layui-layer{-webkit-overflow-scrolling: touch;}
.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}
.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; border-radius: 2px; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}
.layui-layer-close{position:absolute;}
.layui-layer-content{position:relative;}
.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);}
@ -26,7 +26,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;}
/* 动画 */
.layui-layer{border-radius: 2px; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}
.layer-anim{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}
@-webkit-keyframes layer-bounceIn { /* 默认 */
0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)}
@ -36,7 +36,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)}
100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)}
}
.layer-anim{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn}
.layer-anim-00{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn}
@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}
@ -172,7 +172,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);}
0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);}
}
.layer-anim-close{-webkit-animation-name: layer-bounceOut;animation-name: layer-bounceOut; -webkit-animation-duration:.2s; animation-duration:.2s;}
.layer-anim-close{-webkit-animation-name: layer-bounceOut; animation-name: layer-bounceOut; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.2s; animation-duration:.2s;}
@media screen and (max-width: 1100px) {
.layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}

BIN
src/font/iconfont.eot

Binary file not shown.

8
src/font/iconfont.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 202 KiB

BIN
src/font/iconfont.ttf

Binary file not shown.

BIN
src/font/iconfont.woff

Binary file not shown.

7
src/lay/modules/form.js

@ -35,10 +35,9 @@ layui.define('layer', function(exports){
/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/
,'链接格式不正确'
]
,number: [
/^\d+$/
,'只能填写数字'
]
,number: function(value){
if(!value || isNaN(value)) return '只能填写数字'
}
,date: [
/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/
,'日期格式不正确'

49
src/lay/modules/laydate.js

@ -1,6 +1,6 @@
/**
@Name : layDate 5.0.5 日期时间控件
@Name : layDate 5.0.6 日期时间控件
@Author: 贤心
@Sitehttp://www.layui.com/laydate/
@LicenseMIT
@ -55,7 +55,7 @@
}
,laydate = {
v: '5.0.5'
v: '5.0.6'
,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath
@ -92,7 +92,7 @@
//字符常量
,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始日期超出了结束日期<br>建议重新选择', LIMIT_YEAR = [100, 200000]
,ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time'
,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time'
//组件构造器
,Class = function(options){
@ -456,21 +456,25 @@
that.EXP_SPLIT = '';
lay.each(that.format, function(i, item){
var EXP = new RegExp(dateType).test(item)
? '\\b\\d{1,'+ function(){
if(/yyyy/.test(item)) return 4;
if(/y/.test(item)) return 308;
return 2;
}() +'}\\b'
? '\\d{'+ function(){
if(new RegExp(dateType).test(that.format[i === 0 ? i + 1 : i - 1]||'')){
if(/^yyyy|y$/.test(item)) return 4;
return item.length;
}
if(/^yyyy$/.test(item)) return '1,4';
if(/^y$/.test(item)) return '1,308';
return '1,2';
}() +'}'
: '\\' + item;
that.EXP_IF = that.EXP_IF + EXP;
that.EXP_SPLIT = that.EXP_SPLIT + (that.EXP_SPLIT ? '|' : '') + '('+ EXP + ')';
that.EXP_SPLIT = that.EXP_SPLIT + '(' + EXP + ')';
});
that.EXP_IF = new RegExp('^'+ (
options.range ?
that.EXP_IF + '\\s\\'+ options.range + '\\s' + that.EXP_IF
: that.EXP_IF
) +'$');
that.EXP_SPLIT = new RegExp(that.EXP_SPLIT, 'g');
that.EXP_SPLIT = new RegExp('^'+ that.EXP_SPLIT +'$', '');
//如果不是input|textarea元素,则默认采用click事件
if(!that.isInput(options.elem[0])){
@ -557,7 +561,7 @@
,'class': [
'layui-laydate'
,options.range ? ' layui-laydate-range' : ''
,isStatic ? ' layui-laydate-static' : ''
,isStatic ? (' '+ ELEM_STATIC) : ''
,options.theme && options.theme !== 'default' && !/^#/.test(options.theme) ? (' laydate-theme-' + options.theme) : ''
].join('')
})
@ -702,7 +706,7 @@
}
//移除上一个控件
that.remove();
that.remove(Class.thisElem);
//如果是静态定位,则插入到指定的容器中,否则,插入到body
isStatic ? options.elem.append(elem) : (
@ -721,11 +725,11 @@
};
//控件移除
Class.prototype.remove = function(){
Class.prototype.remove = function(prev){
var that = this
,options = that.config
,elem = lay('#'+ that.elemID);
if(elem[0] && options.position !== 'static'){
,elem = lay('#'+ (prev || that.elemID));
if(elem[0] && !elem.hasClass(ELEM_STATIC)){
that.checkDate(function(){
elem.remove();
});
@ -844,7 +848,7 @@
//获得初始化日期值
,initDate = function(dateTime, value, index){
var startEnd = ['startTime', 'endTime'];
value = value.match(that.EXP_SPLIT);
value = (value.match(that.EXP_SPLIT) || []).slice(1);
index = index || 0;
if(options.range){
that[startEnd[index]] = that[startEnd[index]] || {};
@ -1288,16 +1292,13 @@
}
lay(ol).find('.'+ THIS).removeClass(THIS);
lay(this).addClass(THIS);
//同步按钮可点状态
that.setBtnStatus(
null
,lay.extend({}, that.systemDate(), that.startTime)
,lay.extend({}, that.systemDate(), that.endTime)
);
setTimeStatus();
scroll();
(that.endDate || options.type === 'time') && that.done(null, 'change');
//同步按钮可点状态
that.setBtnStatus();
});
});
}
@ -1325,7 +1326,7 @@
var that = this
,options = that.config
,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM)
,isAlone = options.range && options.type !== 'date' && options.type !== 'datetime';
,isAlone = options.range && options.type !== 'date' && options.type !== 'time';
if(isAlone){
start = start || that.startDate;
end = end || that.endDate;

23
src/lay/modules/layer.js

@ -25,7 +25,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//获取节点的style属性值
getStyle: function(node, name){
var style = node.currentStyle ? node.currentStyle : win.getComputedStyle(node, null);
var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null);
return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
},
@ -62,7 +62,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//默认内置方法。
var layer = {
v: '3.0.3',
v: '3.1.0',
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
@ -83,7 +83,7 @@ var layer = {
isLayui
? layui.addcss('modules/layer/' + options.extend)
: ready.link('skin/' + options.extend);
: ready.link('theme/' + options.extend);
return this;
},
@ -183,7 +183,7 @@ Class.pt = Class.prototype;
//缓存常用字符
var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
//默认配置
Class.pt.config = {
@ -219,7 +219,7 @@ Class.pt.vessel = function(conType, callback){
config.zIndex = zIndex;
callback([
//遮罩
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; ') +'"></div>') : '',
//主体
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
@ -313,6 +313,12 @@ Class.pt.creat = function(){
that.layero = $('#'+ doms[0] + times);
config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
}).auto(times);
//遮罩
$('#layui-layer-shade'+ that.index).css({
'background-color': config.shade[1] || '#000'
,'opacity': config.shade[0]||config.shade
});
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
@ -333,7 +339,10 @@ Class.pt.creat = function(){
//为兼容jQuery3.0的css动画影响元素尺寸计算
if(doms.anim[config.anim]){
that.layero.addClass(doms.anim[config.anim]);
var animClass = 'layer-anim '+ doms.anim[config.anim];
that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
$(this).removeClass(animClass);
});
};
//记录关闭动画
@ -911,7 +920,7 @@ layer.close = function(index){
};
if(layero.data('isOutAnim')){
layero.addClass(closeAnim);
layero.addClass('layer-anim '+ closeAnim);
}
$('#layui-layer-moves, #layui-layer-shade' + index).remove();

33
src/lay/modules/table.js

@ -600,7 +600,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
if(options.page){
bodyHeight = bodyHeight - parseFloat(that.layTool.outerHeight() + 1);
}
that.layBody.css('height', bodyHeight);
that.layMain.css('height', bodyHeight);
};
//滚动条补丁
@ -609,6 +610,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
,layMainTable = that.layMain.children('table')
,scollWidth = that.layMain.width() - that.layMain.prop('clientWidth') //纵向滚动条宽度
,scollHeight = that.layMain.height() - that.layMain.prop('clientHeight'); //横向滚动条高度
if(scollWidth && scollHeight){
if(!that.elem.find('.layui-table-patch')[0]){
var patchElem = $('<th class="layui-table-patch"><div class="layui-table-cell"></div></th>'); //补丁元素
@ -620,9 +622,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
} else {
that.layHeader.eq(0).find('.layui-table-patch').remove();
}
that.layFixed.find(ELEM_BODY).css('height', that.layMain.height() - scollHeight); //固定列区域高度
that.layFixRight[layMainTable.width() > that.layMain.width() ? 'removeClass' : 'addClass'](HIDE); //表格宽度小于容器宽度时,隐藏固定列
that.layFixRight.css('right', scollWidth - 1); //操作栏
//固定列区域高度
var mainHeight = that.layMain.height()
,fixHeight = mainHeight - scollHeight;
that.layFixed.find(ELEM_BODY).css('height', layMainTable.height() > fixHeight ? fixHeight : 'auto');
//表格宽度小于容器宽度时,隐藏固定列
that.layFixRight[layMainTable.width() > that.layMain.width() ? 'removeClass' : 'addClass'](HIDE);
//操作栏
that.layFixRight.css('right', scollWidth - 1);
};
//事件处理
@ -853,16 +863,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
fields = fields || {};
layui.each(fields, function(key, value){
if(key in data){
var templet;
var templet, td = tr.children('td[data-field="'+ key +'"]');
data[key] = value;
that.eachCols(function(i, item2){
if(item2.field == key && item2.templet){
templet = item2.templet;
}
});
tr.children('td[data-field="'+ key +'"]').children(ELEM_CELL).html(
td.children(ELEM_CELL).html(
templet ? laytpl($(templet).html() || value).render(data) : value
);
td.data('content', value);
}
});
}
@ -930,15 +941,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var row = $.extend({
title: th.text()
,colspan: th.attr('colspan') //列单元格
,rowspan: th.attr('rowspan') //行单元格
,colspan: th.attr('colspan') || null //列单元格
,rowspan: th.attr('rowspan') || null //行单元格
}, itemData);
cols.push(row)
row.field && cols.push(row)
options.cols[i].push(row);
});
});
//获取表体数据
othis.find('tbody>tr').each(function(i1){
var tr = $(this), row = {};

2
src/layui.js vendored

@ -19,7 +19,7 @@
}
,Layui = function(){
this.v = '2.1.2'; //版本号
this.v = '2.1.3'; //版本号
}
//获取layui所在目录

Loading…
Cancel
Save