This commit is contained in:
sentsin 2016-11-10 02:31:39 +08:00
parent e7f1a4ad42
commit 31a0586501
43 changed files with 847 additions and 379 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/** layui-v1.0.2 经典模块化前端框架@LGPL www.layui.com By 贤心 */
/** layui-v1.0.3 LGPL license By www.layui.com */
html #layuicss-layui-mobilecss{display:none;position:absolute;width:1989px}blockquote,body,button,dd,div,dl,dt,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,td,textarea,th,ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}html{font:12px 'Helvetica Neue','PingFang SC',STHeitiSC-Light,Helvetica,Arial,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0)}a{text-decoration:none;background:0 0}a:active,a:hover{outline:0}table{border-collapse:collapse;border-spacing:0}li{list-style:none}b,strong{font-weight:700}h1,h2,h3,h4,h5,h6{font-weight:500}address,cite,dfn,em,var{font-style:normal}dfn{font-style:italic}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}img{border:0;vertical-align:bottom}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:0}button,select{text-transform:none}select{-webkit-appearance:none;border:none}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}input,label{vertical-align:middle}

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,2 +1,2 @@
/** layui-v1.0.2 经典模块化前端框架 LGPL license By www.layui.com */
;layui.define("jquery",function(i){"use strict";var t=layui.jquery,a=(layui.hint(),layui.device()),e="element",n="layui-this",l="layui-show",o=function(){this.config={}};o.prototype.set=function(i){var a=this;return t.extend(!0,a.config,i),a},o.prototype.on=function(i,t){return layui.onevent(e,i,t)},o.prototype.init=function(i){var o={tabClick:function(i,a){var o=t(this),a=a||o.index(),s=o.parents(".layui-tab"),c=s.children(".layui-tab-content").children(".layui-tab-item"),r=s.attr("lay-filter");o.addClass(n).siblings().removeClass(n),c.eq(a).addClass(l).siblings().removeClass(l),layui.event.call(this,e,"tab("+r+")",{elem:s,index:a})},tabAuto:function(){var i="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",s=this;t(".layui-tab").each(function(){var c=t(this),r=c.children(".layui-tab-title"),u=(c.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),h=t('<span class="layui-unselect layui-tab-bar" '+u+"><i "+u+' class="layui-icon">&#xe61a;</i></span>');if(s===window&&8!=a.ie&&o.hideTabMore(!0),c.attr("lay-allowClose")&&!r.find("li").find("."+l)[0]){var y=t('<i class="layui-icon layui-unselect '+l+'">&#x1006;</i>');y.on("click",function(){var i=t(this).parent(),a=i.index(),e=i.parents(".layui-tab"),l=e.children(".layui-tab-content").children(".layui-tab-item");i.hasClass(n)&&(i.next()[0]?o.tabClick.call(i.next()[0],{},a+1):i.prev()[0]&&o.tabClick.call(i.prev()[0],{},a-1)),i.remove(),l.eq(a).remove()}),r.find("li").append(y)}if(r.prop("scrollWidth")>r.outerWidth()+1){if(r.find("."+e)[0])return;r.append(h),h.on("click",function(t){r[this.title?"removeClass":"addClass"](i),this.title=this.title?"":"收缩"})}else r.find("."+e).remove()})},hideTabMore:function(i){var a=t(".layui-tab-title");i!==!0&&"tabmore"===i.target.getAttribute("lay-stope")||(a.removeClass("layui-tab-more"),a.find(".layui-tab-bar").attr("title",""))}},s={tab:function(){var i=".layui-tab-title li";o.tabAuto.call({}),c.off("click",i,o.tabClick).on("click",i,o.tabClick),t(window).off("resize",o.tabAuto).on("resize",o.tabAuto),t(document).off("click",o.hideTabMore).on("click",o.hideTabMore)},nav:function(){var i,e=".layui-nav",n="layui-nav-item",l="layui-nav-bar",o="layui-nav-tree",s=200,c=function(a,e){var n=t(this);e.hasClass(o)?a.css({top:n.position().top,height:n.height(),opacity:1}):(a.css({left:n.position().left+parseFloat(n.css("marginLeft")),top:n.position().top+n.height()-5}),i=setTimeout(function(){a.css({width:n.width(),opacity:1})},s))};t(e).each(function(){var e=t(this),r=t('<span class="'+l+'"></span>');e.find("."+l)[0]||a.ie&&a.ie<10||(e.append(r),e.find("."+n).on("mouseenter",function(){c.call(this,r,e)}),e.on("mouseleave",function(){clearTimeout(i),setTimeout(function(){e.hasClass(o)?r.css({height:0,top:r.position().top+r.height()/2,opacity:0}):r.css({width:0,left:r.position().left+r.width()/2,opacity:0})},s)}))})},breadcrumb:function(){var i=".layui-breadcrumb";t(i).each(function(){var i=t(this),a=i.attr("lay-separator")||">",e=i.find("a");e.each(function(i){i!==e.length-1&&t(this).append("<span>"+a+"</span>")}),i.css("visibility","visible")})}};return layui.each(s,function(i,t){t()})};var s=new o,c=t("body");s.init(),i(e,function(i){return s.set(i)})});
/** layui-v1.0.3 LGPL license By www.layui.com */
;layui.define("jquery",function(i){"use strict";var t=layui.jquery,a=(layui.hint(),layui.device()),e="element",n="layui-this",l="layui-show",s=function(){this.config={}};s.prototype.set=function(i){var a=this;return t.extend(!0,a.config,i),a},s.prototype.on=function(i,t){return layui.onevent(e,i,t)},s.prototype.init=function(i){var s={tabClick:function(i,a){var s=t(this),a=a||s.index(),o=s.parents(".layui-tab"),c=o.children(".layui-tab-content").children(".layui-tab-item"),u=o.attr("lay-filter");s.addClass(n).siblings().removeClass(n),c.eq(a).addClass(l).siblings().removeClass(l),layui.event.call(this,e,"tab("+u+")",{elem:o,index:a})},tabAuto:function(){var i="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",o=this;t(".layui-tab").each(function(){var c=t(this),u=c.children(".layui-tab-title"),r=(c.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),d=t('<span class="layui-unselect layui-tab-bar" '+r+"><i "+r+' class="layui-icon">&#xe61a;</i></span>');if(o===window&&8!=a.ie&&s.hideTabMore(!0),c.attr("lay-allowClose")&&!u.find("li").find("."+l)[0]){var h=t('<i class="layui-icon layui-unselect '+l+'">&#x1006;</i>');h.on("click",function(){var i=t(this).parent(),a=i.index(),e=i.parents(".layui-tab"),l=e.children(".layui-tab-content").children(".layui-tab-item");i.hasClass(n)&&(i.next()[0]?s.tabClick.call(i.next()[0],{},a+1):i.prev()[0]&&s.tabClick.call(i.prev()[0],{},a-1)),i.remove(),l.eq(a).remove()}),u.find("li").append(h)}if(u.prop("scrollWidth")>u.outerWidth()+1){if(u.find("."+e)[0])return;u.append(d),d.on("click",function(t){u[this.title?"removeClass":"addClass"](i),this.title=this.title?"":"收缩"})}else u.find("."+e).remove()})},hideTabMore:function(i){var a=t(".layui-tab-title");i!==!0&&"tabmore"===i.target.getAttribute("lay-stope")||(a.removeClass("layui-tab-more"),a.find(".layui-tab-bar").attr("title",""))}},o={tab:function(){var i=".layui-tab-title li";s.tabAuto.call({}),c.off("click",i,s.tabClick).on("click",i,s.tabClick),t(window).off("resize",s.tabAuto).on("resize",s.tabAuto),t(document).off("click",s.hideTabMore).on("click",s.hideTabMore)},nav:function(){var i,e,n,l=".layui-nav",s="layui-nav-item",o="layui-nav-bar",c="layui-nav-tree",u="layui-nav-child",r="layui-nav-more",d=200,h=function(a,l){var s=t(this),o=s.find("."+u);l.hasClass(c)?a.css({top:s.position().top,height:s.children("a").height(),opacity:1}):(o.addClass("layui-anim layui-anim-upbit"),a.css({left:s.position().left+parseFloat(s.css("marginLeft")),top:s.position().top+s.height()-5}),i=setTimeout(function(){a.css({width:s.width(),opacity:1})},d),clearTimeout(n),"block"===o.css("display")&&clearTimeout(e),e=setTimeout(function(){o.show(),s.find("."+r).addClass(r+"d")},300))};t(l).each(function(){var l=t(this),f=t('<span class="'+o+'"></span>'),y=l.find("."+s);l.find("."+o)[0]||a.ie&&a.ie<10||(l.append(f),y.on("mouseenter",function(){h.call(this,f,l)}).on("mouseleave",function(){l.hasClass(c)||(clearTimeout(e),e=setTimeout(function(){l.find("."+u).hide(),l.find("."+r).removeClass(r+"d")},300))}),l.on("mouseleave",function(){clearTimeout(i),n=setTimeout(function(){l.hasClass(c)?f.css({height:0,top:f.position().top+f.height()/2,opacity:0}):f.css({width:0,left:f.position().left+f.width()/2,opacity:0})},d)})),y.each(function(){var i=t(this),a=i.find("."+u);if(a[0]&&!i.find("."+r)[0]){if(i.children("a").append('<span class="'+r+'"></span>'),!l.hasClass(c))return;i.children("a").on("click",function(){t(this);"none"===a.css("display")?i.addClass(s+"ed"):i.removeClass(s+"ed")})}})})},breadcrumb:function(){var i=".layui-breadcrumb";t(i).each(function(){var i=t(this),a=i.attr("lay-separator")||">",e=i.find("a");e.each(function(i){i!==e.length-1&&t(this).append("<span>"+a+"</span>")}),i.css("visibility","visible")})}};return layui.each(o,function(i,t){t()})};var o=new s,c=t("body");o.init(),i(e,function(i){return o.set(i)})});

View File

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

View File

@ -1,2 +1,2 @@
/** layui-v1.0.2 经典模块化前端框架 LGPL license By www.layui.com */
;layui.define("layer",function(e){"use strict";var i=layui.jquery,a=layui.layer,t=layui.hint(),n=layui.device(),l="form",c=".layui-form",s="layui-this",r=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:[/^\d+$/,"只能填写数字"],date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};r.prototype.set=function(e){var a=this;return i.extend(!0,a.config,e),a},r.prototype.verify=function(e){var a=this;return i.extend(!0,a.config.verify,e),a},r.prototype.on=function(e,i){return layui.onevent(l,e,i)},r.prototype.render=function(e){var a=this,n={select:function(){var e="请选择",a="layui-form-select",t="layui-select-title",n=i(c).find("select"),r=function(e,n){i(e.target).parent().hasClass(t)&&!n||i("."+a).removeClass(a+"ed")},u=function(e){var n=i(this),c=e.find("."+t);c.on("click",function(i){e.hasClass(a+"ed")?e.removeClass(a+"ed"):(r(i,!0),e.addClass(a+"ed"))}),e.find("ul>li").on("click",function(){var e=i(this),a=e.attr("lay-value"),t=n.attr("lay-filter");n.val(a).removeClass("layui-form-danger"),c.find("input").val(e.text()),e.addClass(s).siblings().removeClass(s),layui.event(l,"select("+t+")",{elem:n[0],value:a})}),i(document).off("click",r).on("click",r)};n.each(function(n,l){var c=i(this),r=c.next("."+a),o=l.value,d=i(l.options[l.selectedIndex]),f=i(['<div class="layui-unselect '+a+'">','<div class="'+t+'"><input type="text" placeholder="'+(l.options[0].innerHTML?l.options[0].innerHTML:e)+'" value="'+(o?d.html():"")+'" readonly class="layui-input layui-unselect">','<i class="layui-edge"></i></div>','<ul class="layui-anim layui-anim-upbit">'+function(e){var i=[];return layui.each(e,function(e,a){(0!==e||a.value)&&i.push('<li lay-value="'+a.value+'" '+(o===a.value?'class="'+s+'"':"")+">"+a.innerHTML+"</li>")}),i.join("")}(this.options)+"</ul>","</div>"].join(""));r[0]&&r.remove(),c.after(f),u.call(this,f)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},a=i(c).find("input[type=checkbox]"),t=function(e,a){var t=i(this);e.on("click",function(){var i=t.attr("lay-filter");t[0].checked?(t[0].checked=!1,e.removeClass(a[1])):(t[0].checked=!0,e.addClass(a[1])),layui.event(l,a[2]+"("+i+")",{elem:t[0],value:t[0].value})})};a.each(function(a,n){var l=i(this),c=l.attr("lay-skin");"switch"===c&&(c="_"+c);var s=e[c]||e.checkbox,r=l.next("."+s[0]),u=i(['<div class="layui-unselect '+s[0]+(n.checked?" "+s[1]:"")+'">',{_switch:"<i></i>"}[c]||"<span>"+(n.title||"勾选")+'</span><i class="layui-icon">&#xe618;</i>',"</div>"].join(""));r[0]&&r.remove(),l.after(u),t.call(this,u,s)})},radio:function(){var e="layui-form-radio",a=["&#xe643;","&#xe63f;"],t=i(c).find("input[type=radio]"),n=function(t){var n=i(this),s="layui-anim-scaleSpring";t.on("click",function(){var r=n[0].name,u=n.parents(c),o=n.attr("lay-filter"),d=u.find("input[name="+r+"]");layui.each(d,function(){var t=i(this).next("."+e);this.checked=!1,t.removeClass(e+"ed"),t.find(".layui-icon").removeClass(s).html(a[1])}),n[0].checked=!0,t.addClass(e+"ed"),t.find(".layui-icon").addClass(s).html(a[0]),layui.event(l,"radio("+o+")",{elem:n[0],value:n[0].value})})};t.each(function(t,l){var c=i(this),s=c.next("."+e),r=i(['<div class="layui-unselect '+e+(l.checked?" "+e+"ed":"")+'">','<i class="layui-anim layui-icon">'+a[l.checked?0:1]+"</i>","<span>"+(l.title||"未命名")+"</span>","</div>"].join(""));s[0]&&s.remove(),c.after(r),n.call(this,r)})}};return e?n[e]?n[e]():t.error("不支持的"+e+"表单渲染"):layui.each(n,function(e,i){i()}),a};var u=function(){var e=i(this),t=o.config.verify,s=null,r="layui-form-danger",u={},d=e.parents(c),f=d.find("*[lay-verify]"),y=e.parents("form")[0],v=d.find("input,select,textarea"),h=e.attr("lay-filter");return layui.each(f,function(e,l){var c=i(this),u=c.attr("lay-verify"),o="",d=c.val(),f="function"==typeof t[u];if(c.removeClass(r),t[u]&&(f?o=t[u](d,l):!t[u][0].test(d)))return a.msg(o||t[u][1],{icon:5,shift:6}),n.android||n.ios||l.focus(),c.addClass(r),s=!0}),!s&&(layui.each(v,function(e,i){i.name&&(/^checkbox|radio$/.test(i.type)&&!i.checked||(u[i.name]=i.value))}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:y,field:u}))},o=new r,d=i("body");o.render(),d.on("reset",c,function(){setTimeout(function(){o.render()},50)}),d.on("submit",c,u).on("click","*[lay-submit]",u),e(l,function(e){return o.set(e)})});
/** layui-v1.0.3 LGPL license By www.layui.com */
;layui.define("layer",function(e){"use strict";var i=layui.jquery,a=layui.layer,t=layui.hint(),n=layui.device(),l="form",c=".layui-form",s="layui-this",r=function(){this.config={verify:{required:[/[\S]+/,"必填项不能为空"],phone:[/^1\d{10}$/,"请输入正确的手机号"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"邮箱格式不正确"],url:[/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/,"链接格式不正确"],number:[/^\d+$/,"只能填写数字"],date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"日期格式不正确"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"请输入正确的身份证号"]}}};r.prototype.set=function(e){var a=this;return i.extend(!0,a.config,e),a},r.prototype.verify=function(e){var a=this;return i.extend(!0,a.config.verify,e),a},r.prototype.on=function(e,i){return layui.onevent(l,e,i)},r.prototype.render=function(e){var a=this,n={select:function(){var e="请选择",a="layui-form-select",t="layui-select-title",n=i(c).find("select"),r=function(e,n){i(e.target).parent().hasClass(t)&&!n||i("."+a).removeClass(a+"ed")},o=function(e){var n=i(this),c=e.find("."+t);c.on("click",function(i){e.hasClass(a+"ed")?e.removeClass(a+"ed"):(r(i,!0),e.addClass(a+"ed"))}),e.find("dl>dd").on("click",function(){var e=i(this),a=e.attr("lay-value"),t=n.attr("lay-filter");n.val(a).removeClass("layui-form-danger"),c.find("input").val(e.text()),e.addClass(s).siblings().removeClass(s),layui.event(l,"select("+t+")",{elem:n[0],value:a})}),e.find("dl>dt").on("click",function(e){layui.stope(e)}),i(document).off("click",r).on("click",r)};n.each(function(n,l){var c=i(this),r=c.next("."+a),u=l.value,d=i(l.options[l.selectedIndex]),f=i(['<div class="layui-unselect '+a+'">','<div class="'+t+'"><input type="text" placeholder="'+(l.options[0].innerHTML?l.options[0].innerHTML:e)+'" value="'+(u?d.html():"")+'" readonly class="layui-input layui-unselect">','<i class="layui-edge"></i></div>','<dl class="layui-anim layui-anim-upbit'+(c.find("optgroup")[0]?" layui-select-group":"")+'">'+function(e){var i=[];return layui.each(e,function(e,a){(0!==e||a.value)&&("optgroup"===a.tagName.toLowerCase()?i.push("<dt>"+a.label+"</dt>"):i.push('<dd lay-value="'+a.value+'" '+(u===a.value?'class="'+s+'"':"")+">"+a.innerHTML+"</dd>"))}),i.join("")}(c.find("*"))+"</dl>","</div>"].join(""));r[0]&&r.remove(),c.after(f),o.call(this,f)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},a=i(c).find("input[type=checkbox]"),t=function(e,a){var t=i(this);e.on("click",function(){var i=t.attr("lay-filter");t[0].checked?(t[0].checked=!1,e.removeClass(a[1])):(t[0].checked=!0,e.addClass(a[1])),layui.event(l,a[2]+"("+i+")",{elem:t[0],value:t[0].value})})};a.each(function(a,n){var l=i(this),c=l.attr("lay-skin");"switch"===c&&(c="_"+c);var s=e[c]||e.checkbox,r=l.next("."+s[0]),o=i(['<div class="layui-unselect '+s[0]+(n.checked?" "+s[1]:"")+'">',{_switch:"<i></i>"}[c]||"<span>"+(n.title||"勾选")+'</span><i class="layui-icon">&#xe618;</i>',"</div>"].join(""));r[0]&&r.remove(),l.after(o),t.call(this,o,s)})},radio:function(){var e="layui-form-radio",a=["&#xe643;","&#xe63f;"],t=i(c).find("input[type=radio]"),n=function(t){var n=i(this),s="layui-anim-scaleSpring";t.on("click",function(){var r=n[0].name,o=n.parents(c),u=n.attr("lay-filter"),d=o.find("input[name="+r+"]");layui.each(d,function(){var t=i(this).next("."+e);this.checked=!1,t.removeClass(e+"ed"),t.find(".layui-icon").removeClass(s).html(a[1])}),n[0].checked=!0,t.addClass(e+"ed"),t.find(".layui-icon").addClass(s).html(a[0]),layui.event(l,"radio("+u+")",{elem:n[0],value:n[0].value})})};t.each(function(t,l){var c=i(this),s=c.next("."+e),r=i(['<div class="layui-unselect '+e+(l.checked?" "+e+"ed":"")+'">','<i class="layui-anim layui-icon">'+a[l.checked?0:1]+"</i>","<span>"+(l.title||"未命名")+"</span>","</div>"].join(""));s[0]&&s.remove(),c.after(r),n.call(this,r)})}};return e?n[e]?n[e]():t.error("不支持的"+e+"表单渲染"):layui.each(n,function(e,i){i()}),a};var o=function(){var e=i(this),t=u.config.verify,s=null,r="layui-form-danger",o={},d=e.parents(c),f=d.find("*[lay-verify]"),y=e.parents("form")[0],v=d.find("input,select,textarea"),h=e.attr("lay-filter");return layui.each(f,function(e,l){var c=i(this),o=c.attr("lay-verify"),u="",d=c.val(),f="function"==typeof t[o];if(c.removeClass(r),t[o]&&(f?u=t[o](d,l):!t[o][0].test(d)))return a.msg(u||t[o][1],{icon:5,shift:6}),n.android||n.ios||l.focus(),c.addClass(r),s=!0}),!s&&(layui.each(v,function(e,i){i.name&&(/^checkbox|radio$/.test(i.type)&&!i.checked||(o[i.name]=i.value))}),layui.event.call(this,l,"submit("+h+")",{elem:this,form:y,field:o}))},u=new r,d=i("body");u.render(),d.on("reset",c,function(){setTimeout(function(){u.render()},50)}),d.on("submit",c,o).on("click","*[lay-submit]",o),e(l,function(e){return u.set(e)})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/**
/**
layui构建
*/
@ -18,7 +18,7 @@ var argv = require('minimist')(process.argv.slice(2), {
default: {
ver: 'all'
}
});
}), mods = 'laytpl,laypage,laydate,jquery,layer,element,upload,form,tree,util,flow,layedit,code';
var task = {
minjs: function() {
@ -30,20 +30,30 @@ var task = {
return gulp.src([
'./src/**/*'+ mod +'.js'
,'!./src/lay/all.js'
,'!./src/lay/mod.js'
]).pipe(uglify())
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build'))
}
,alljs: function(){
,modjs: function(){
return gulp.src([
,'./src/layui.js'
,'./src/lay/**/{all,laytpl,laypage,laydate,jquery,layer,element,upload,form,tree,util,flow,layedit,code}.js'
,'./src/lay/**/{mod,'+ mods +'}.js'
,'!./src/lay/**/layim.js' //LayIM需授权
,'!./src/lay/**/mobile/*.js'
]).pipe(uglify())
.pipe(concat('layui.mod.js', {newLine: ''}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %>(All Modules) <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build/lay/dest/'));
}
,alljs: function(){
return gulp.src([
,'./src/**/{layui,all,'+ mods +'}.js'
,'!./src/lay/modules/layim.js' //LayIM需授权
,'!./src/lay/modules/mobile/*.js'
]).pipe(uglify())
.pipe(concat('layui.all.js', {newLine: ''}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.license %> license By <%= pkg.homepage %> */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./build/lay/dest/'));
}
,mincss: function() {
@ -51,7 +61,7 @@ var task = {
.pipe(minify({
compatibility: 'ie7'
}))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.description %>@<%= pkg.license %> <%= pkg.homepage %> By <%= pkg.author %> */\n', {pkg : pkg} ))
.pipe(header('/** <%= pkg.name %>-v<%= pkg.version %> <%= pkg.license %> license By <%= pkg.homepage %> */\n', {pkg : pkg} ))
.pipe(gulp.dest('./build/css'));
}
,font: function() {
@ -80,8 +90,11 @@ var task = {
gulp.task('clear', function(cb) {
return del(['./build/*'], cb);
});
gulp.task('minjs', task.minjs); //压缩js模块
gulp.task('alljs', task.alljs); //打包模块完整版
gulp.task('modjs', task.modjs); //打包PC完整模块即各模块的合并
gulp.task('alljs', task.alljs); //打包PC合并版即包含layui.js和所有模块的合并
gulp.task('mincss', task.mincss); //压缩css文件
gulp.task('font', task.font); //复制iconfont文件
gulp.task('images', task.images); //复制组件可能所需的图片

View File

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

View File

@ -151,11 +151,15 @@ a cite{font-style: normal; *cursor:pointer;}
/* 下拉选择 */.layui-form-select{position: relative;}
.layui-form-select .layui-input{padding-right: 30px; cursor: pointer;}
.layui-form-select .layui-edge{position: absolute; right: 10px; top: 50%; margin-top: -3px; cursor: pointer; border-width: 6px; border-top-color: #c2c2c2; border-top-style: solid; transition: transform .3s; transition: transform .3s,-webkit-transform .3s;}
.layui-form-select ul{display: none; position: absolute; left: 0; top: 42px; margin-bottom: 50px; padding: 5px 0; z-index: 999; width: 100%; border: 1px solid #d2d2d2; max-height: 300px; overflow-y: auto; background-color: #fff; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.12); box-sizing: border-box;}
.layui-form-select ul li{padding: 0 10px; line-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;}
.layui-form-select ul li:hover{background-color: #f2f2f2;}
.layui-form-select ul li.layui-this{background-color: #5FB878; color: #fff;}
.layui-form-selected ul{display: block;}
.layui-form-select dl{display: none; position: absolute; left: 0; top: 42px; margin-bottom: 50px; padding: 5px 0; z-index: 999; min-width: 100%; border: 1px solid #d2d2d2; max-height: 300px; overflow-y: auto; background-color: #fff; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.12); box-sizing: border-box;}
.layui-form-select dl dt,
.layui-form-select dl dd{padding: 0 10px; line-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.layui-form-select dl dt{font-size: 12px; color: #999;}
.layui-form-select dl dd{cursor: pointer;}
.layui-form-select dl dd:hover{background-color: #f2f2f2;}
.layui-form-select .layui-select-group dd{padding-left: 20px;}
.layui-form-select dl dd.layui-this{background-color: #5FB878; color: #fff;}
.layui-form-selected dl{display: block;}
.layui-form-selected .layui-edge{margin-top: -9px; -webkit-transform:rotate(180deg); transform: rotate(180deg);}
.layui-form-selected .layui-edge{margin-top: -3px\0; }
:root .layui-form-selected .layui-edge{margin-top: -9px\0/IE9;}
@ -308,21 +312,41 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #c2c2c2; transition: all .3s; -webkit-transition: all .3s;}
.layui-nav-bar,
.layui-nav .layui-this: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{color: #fff;}
.layui-nav .layui-this:after{content: ''; top: auto; bottom: 0; width: 100%;}
.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; color: #333;}
.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: #c2c2c2;}
.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: #c2c2c2;}
/* 垂直导航菜单 */.layui-nav-tree{width: 200px; padding: 0;}
.layui-nav-tree .layui-nav-item{display: block; line-height: 45px;}
.layui-nav-tree .layui-nav-item{display: block; width: 100%; line-height: 45px;}
.layui-nav-tree .layui-nav-item a{height: 45px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.layui-nav-tree .layui-nav-bar{width: 5px; height: 0;}
.layui-nav-tree .layui-this{margin: 1px 0;}
.layui-nav-tree .layui-this a{background-color: #4E5465;}
.layui-nav-tree .layui-this>a{background-color: #4E5465;}
.layui-nav-tree .layui-this:after{width: 5px; height: 100%; top: 0; left: 0; bottom: auto;}
.layui-nav-tree .layui-nav-item a:hover{background-color: #4E5465;}
.layui-nav-tree .layui-nav-title a,
.layui-nav-tree .layui-nav-title a:hover{background-color: #2B2E37; color: #fff;}
.layui-nav-tree .layui-nav-title a:hover,
.layui-nav-itemed>a{background-color: #2B2E37 !important; color: #fff !important;}
.layui-nav-side{position: fixed; top: 0; bottom: 0; left: 0; overflow-x: hidden; z-index: 999;}
.layui-nav-tree .layui-nav-child{position: relative; top: 0; background: none; border: none; box-shadow: none;}
.layui-nav-tree .layui-nav-child a{height: 36px; line-height: 36px; padding-left: 36px;}
.layui-nav-tree .layui-nav-child a{color: #c2c2c2;}
.layui-nav-tree .layui-nav-child a:hover{color: #fff; background: none;}
.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;}
/** 面包屑 **/
.layui-breadcrumb{visibility: hidden; font-size: 0;}
.layui-breadcrumb a{padding-right: 8px; line-height: 22px; font-size: 14px; color: #333 !important;}

View File

@ -1,93 +1,42 @@
/*!
/**
@Name: layer's style
@Name: layer
@Author: 贤心
@Blog sentsin.com
*/
**/
*html{background-image:url(about:blank); background-attachment:fixed;}
html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
*html{background-image: url(about:blank); background-attachment: fixed;}
html #layuicss-skinlayercss{display: none; position: absolute; width: 1989px;}
/* common */
.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{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{-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-close{position:absolute;}
.layui-layer-content{position:relative;}
.layui-layer-border{border:1px solid #B2B2B2; border:1px solid rgba(0,0,0,.3); box-shadow: 1px 1px 5px rgba(0,0,0,.2);}
.layui-layer-moves{position:absolute; border:3px solid #666; border:3px solid rgba(0,0,0,.5); cursor:move; background-color:#fff; background-color:rgba(255,255,255,.3); filter:alpha(opacity=50);}
.layui-layer-load{background:url(default/loading-0.gif) #fff center center no-repeat;}
.layui-layer-ico{ background:url(default/icon.png) no-repeat;}
.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);}
.layui-layer-load{background:url(loading-1.gif) #eee center center no-repeat;}
.layui-layer-ico{ background:url(icon.png) no-repeat;}
.layui-layer-dialog .layui-layer-ico,
.layui-layer-setwin a,
.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;}
.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;}
.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; }
.layui-layer{border-radius: 2px; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}
@-webkit-keyframes bounceIn { /* 默认 */
0% {
opacity: 0;
-webkit-transform: scale(.5);
transform: scale(.5)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)}
100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)}
}
@keyframes bounceIn {
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)
}
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: bounceIn; animation-name: bounceIn}
@-webkit-keyframes bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.03);
transform: scale(1.03)
}
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
-ms-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.03);
-ms-transform: scale(1.03);
transform: scale(1.03)
}
0% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
.layer-anim-close{-webkit-animation-name: bounceOut;animation-name: bounceOut; -webkit-animation-duration:.2s; animation-duration:.2s;}
.layer-anim{-webkit-animation-name: bounceIn;animation-name: bounceIn}
@-webkit-keyframes 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 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:zoomInDown;animation-name:zoomInDown}
@ -101,6 +50,18 @@ html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
@-webkit-keyframes shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:shake;animation-name:shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}
@-webkit-keyframes bounceOut { /* 关闭动画 */
100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)}
30% {-webkit-transform: scale(1.05); transform: scale(1.05)}
0% {-webkit-transform: scale(1); transform: scale(1);}
}
@keyframes bounceOut {
100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);}
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: bounceOut;animation-name: bounceOut; -webkit-animation-duration:.2s; animation-duration:.2s;}
/* 标题栏 */
.layui-layer-title{padding:0 80px 0 20px; height:42px; line-height:42px; border-bottom:1px solid #eee; font-size:14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background-color: #F8F8F8; border-radius: 2px 2px 0 0;}
.layui-layer-setwin{position:absolute; right:15px; *right:0; top:15px; font-size:0; line-height: initial;}
@ -117,15 +78,17 @@ html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
.layui-layer-setwin .layui-layer-close2:hover{ background-position:-180px -31px;}
/* 按钮栏 */
.layui-layer-btn{text-align: right; padding:0 10px 12px; pointer-events: auto;}
.layui-layer-btn{text-align: right; padding:0 10px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;}
.layui-layer-btn a{height: 28px; line-height: 28px; margin: 0 6px; padding: 0 15px; border:1px #dedede solid; background-color:#f1f1f1; color: #333; border-radius: 2px; font-weight:400; cursor:pointer; text-decoration: none;}
.layui-layer-btn a:hover{opacity:0.9; text-decoration: none;}
.layui-layer-btn a:active{opacity:0.7;}
.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;}
.layui-layer-btn a:active{opacity: 0.8;}
.layui-layer-btn .layui-layer-btn0{border-color: #4898d5; background-color: #2e8ded; color:#fff;}
.layui-layer-btn-l{text-align: left;}
.layui-layer-btn-c{text-align: center;}
/* 定制化 */
.layui-layer-dialog{min-width:260px;}
.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break:break-all; overflow:hidden; font-size:14px; overflow:auto;}
.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;}
.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;}
.layui-layer-ico1{background-position:-30px 0 }
.layui-layer-ico2{background-position:-60px 0;}
@ -135,33 +98,32 @@ html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
.layui-layer-ico6{background-position:-180px 0;}
.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;}
.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;}
.layui-layer-hui{min-width:100px; background-color:#000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;}
.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;}
.layui-layer-hui .layui-layer-content{padding:12px 25px; text-align:center;}
.layui-layer-dialog .layui-layer-padding{padding: 20px 20px 20px 55px; text-align: left;}
.layui-layer-page .layui-layer-content{position:relative; overflow:auto;}
.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;}
.layui-layer-nobg{background:none;}
.layui-layer-iframe .layui-layer-content{overflow:hidden;}
.layui-layer-iframe iframe{display:block; width:100%;}
.layui-layer-iframe iframe{display: block; width: 100%;}
.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;}
.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url(default/loading-0.gif) no-repeat;}
.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url(default/loading-1.gif) no-repeat;}
.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url(default/loading-2.gif) no-repeat;}
.layui-layer-tips{background:none; box-shadow:none; border:none;}
.layui-layer-tips .layui-layer-content{position:relative; line-height:22px; min-width: 12px; padding:5px 10px; font-size:12px; _float:left; border-radius:3px; box-shadow: 1px 1px 3px rgba(0,0,0,.3); background-color:#FF9900; color:#fff;}
.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url(loading-0.gif) no-repeat;}
.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url(loading-1.gif) no-repeat;}
.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url(loading-2.gif) no-repeat;}
.layui-layer-tips{background: none; box-shadow:none; border:none;}
.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 5px 10px; font-size: 12px; _float:left; border-radius: 2px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;}
.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;}
.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;}
.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color:#FF9900;}
.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;}
.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;}
.layui-layer-tips i.layui-layer-TipsB{top:-8px;}
.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top:1px; border-bottom-style:solid; border-bottom-color:#FF9900;}
.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top:1px; border-bottom-style:solid; border-bottom-color: #000;}
.layui-layer-tips i.layui-layer-TipsR{left:-8px;}
.layui-layer-tips i.layui-layer-TipsL{right:-8px;}
/* skin */
.layui-layer-lan[type="dialog"]{min-width:280px;}
.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;}
.layui-layer-lan
.layui-layer-lan .layui-layer-btn{padding:10px; text-align: right; border-top:1px solid #E9E7E7}
.layui-layer-lan .layui-layer-btn a{background:#BBB5B5; border:none;}
.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;}
@ -171,16 +133,19 @@ html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
/*
layer.extend
*/
/**
@Name: layer拓展样式
*/
.layui-layer-iconext{background:url(default/icon-ext.png) no-repeat;}
.layui-layer-iconext{background:url(icon-ext.png) no-repeat;}
/* prompt模式 */
.layui-layer-prompt .layui-layer-input{display:block; width:220px; height:30px; margin:0 auto; line-height:30px; padding: 0 5px; border: 1px solid #ccc; box-shadow: 1px 1px 5px rgba(0,0,0,.1) inset; color:#333;}
.layui-layer-prompt textarea.layui-layer-input{width:300px; height:100px; line-height:20px;}
.layui-layer-prompt .layui-layer-content{padding: 20px;}
.layui-layer-prompt .layui-layer-btn{padding-top: 0;}
/* tab模式 */
.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);}
@ -209,3 +174,10 @@ html #layuicss-skinlayercss{display:none; position: absolute; width:1989px;}
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}
.layui-layer-imgtit em{padding-left:10px; font-style: normal;}
@media screen and (max-width: 1100px) {
.layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}
}

View File

@ -1,11 +1,15 @@
/**
@Name用于打包PC完整模块不会存在于构建后的目录
@Name用于打包打包PC完整版即包含layui.js和所有模块的完整合并该文件不会存在于构建后的目录
@Author贤心
@LicenseLGPL
*/
layui.define(function(exports){
var cache = layui.cache;
layui.config({
dir: cache.dir.replace(/lay\/dest\/$/, '')
});
exports('layui.all', layui.v);
});

11
src/lay/mod.js Normal file
View File

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

View File

@ -132,40 +132,63 @@ layui.define('jquery', function(exports){
//导航菜单
,nav: function(){
var ELEM = '.layui-nav', ITEM = 'layui-nav-item', BAR = 'layui-nav-bar'
,TREE = 'layui-nav-tree', TIME = 200, timer
,follow = function(bar, nav){
var othis = $(this);
,TREE = 'layui-nav-tree', CHILD = 'layui-nav-child', MORE = 'layui-nav-more'
,TIME = 200, timer, timerMore, timeEnd, follow = function(bar, nav){
var othis = $(this), child = othis.find('.'+CHILD);
if(nav.hasClass(TREE)){
bar.css({
top: othis.position().top
,height: othis.height()
,height: othis.children('a').height()
,opacity: 1
});
} else {
child.addClass('layui-anim layui-anim-upbit');
bar.css({
left: othis.position().left + parseFloat(othis.css('marginLeft'))
,top: othis.position().top + othis.height() - 5
});
timer = setTimeout(function(){
bar.css({
width: othis.width()
,opacity: 1
});
}, TIME);
clearTimeout(timeEnd);
if(child.css('display') === 'block'){
clearTimeout(timerMore);
}
timerMore = setTimeout(function(){
child.show()
othis.find('.'+MORE).addClass(MORE+'d');
}, 300);
}
}
$(ELEM).each(function(){
var othis = $(this)
,bar = $('<span class="'+ BAR +'"></span>');
,bar = $('<span class="'+ BAR +'"></span>')
,itemElem = othis.find('.'+ITEM);
//Hover滑动效果
if(!othis.find('.'+BAR)[0] && !(device.ie && device.ie < 10)){
othis.append(bar);
othis.find('.'+ITEM).on('mouseenter', function(){
itemElem.on('mouseenter', function(){
follow.call(this, bar, othis);
}).on('mouseleave', function(){
if(!othis.hasClass(TREE)){
clearTimeout(timerMore);
timerMore = setTimeout(function(){
othis.find('.'+CHILD).hide();
othis.find('.'+MORE).removeClass(MORE+'d');
}, 300);
}
});
othis.on('mouseleave', function(){
clearTimeout(timer)
setTimeout(function(){
timeEnd = setTimeout(function(){
if(othis.hasClass(TREE)){
bar.css({
height: 0
@ -182,6 +205,24 @@ layui.define('jquery', function(exports){
}, TIME);
});
}
//二级菜单
itemElem.each(function(){
var oitem = $(this), child = oitem.find('.'+CHILD);
if(child[0] && !oitem.find('.'+MORE)[0]){
oitem.children('a').append('<span class="'+ MORE +'"></span>');
if(!othis.hasClass(TREE)) return;
oitem.children('a').on('click', function(){
var a = $(this);
if(child.css('display') === 'none'){
oitem.addClass(ITEM+'ed');
} else {
oitem.removeClass(ITEM+'ed');
}
});
}
});
});
}
//面包屑

View File

@ -65,7 +65,7 @@ layui.define('jquery', function(exports){
if(options.isLazyimg){
var lazyimg = that.lazyimg({
elem: options.elem + ' img'
,scrollElem: scrollElem
,scrollElem: options.scrollElem
});
}

View File

@ -95,7 +95,7 @@ layui.define('layer', function(exports){
});
//选择
reElem.find('ul>li').on('click', function(){
reElem.find('dl>dd').on('click', function(){
var othis = $(this), value = othis.attr('lay-value');
var filter = select.attr('lay-filter'); //获取过滤器
@ -107,6 +107,10 @@ layui.define('layer', function(exports){
});
});
reElem.find('dl>dt').on('click', function(e){
layui.stope(e);
});
//关闭下拉
$(document).off('click', hide).on('click', hide)
}
@ -114,21 +118,25 @@ layui.define('layer', function(exports){
selects.each(function(index, select){
var othis = $(this), hasRender = othis.next('.'+CLASS);
var value = select.value, selected = $(select.options[select.selectedIndex]); //获取当前选中项
//替代元素
var reElem = $(['<div class="layui-unselect '+ CLASS +'">'
,'<div class="'+ TITLE +'"><input type="text" placeholder="'+ (select.options[0].innerHTML ? select.options[0].innerHTML : TIPS) +'" value="'+ (value ? selected.html() : '') +'" readonly class="layui-input layui-unselect">'
,'<i class="layui-edge"></i></div>'
,'<ul class="layui-anim layui-anim-upbit">'+ function(options){
,'<dl class="layui-anim layui-anim-upbit'+ (othis.find('optgroup')[0] ? ' layui-select-group' : '') +'">'+ function(options){
var arr = [];
layui.each(options, function(index, item){
if(index === 0 && !item.value) return;
arr.push('<li lay-value="'+ item.value +'" '+ (value === item.value
? 'class="'+ THIS +'"'
: '')+'>'+ item.innerHTML +'</li>');
if(item.tagName.toLowerCase() === 'optgroup'){
arr.push('<dt>'+ item.label +'</dt>');
} else {
arr.push('<dd lay-value="'+ item.value +'" '+ (value === item.value
? 'class="'+ THIS +'"'
: '')+'>'+ item.innerHTML +'</dd>');
}
});
return arr.join('');
}(this.options) +'</ul>'
}(othis.find('*')) +'</dl>'
,'</div>'].join(''));
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender

View File

@ -115,6 +115,14 @@ layui.define(['layer', 'form'], function(exports){
var textarea = $('#'+iframeWin[1].attr('textarea'));
textarea.val(toLower(iframeWin[0].document.body.innerHTML));
};
//获取编辑器选中内容
Edit.prototype.getSelection = function(index){
var iframeWin = getWin(index);
if(!iframeWin[0]) return;
var range = Range(iframeWin[0].document);
return document.selection ? range.text : range.toString();
};
//iframe初始化
var setIframe = function(editor, textArea, set){

View File

@ -1,8 +1,8 @@
/*!
/**
@Namelayui For layer v2.5 弹层组件
@Namelayer v3.0 Web弹层组件
@Author贤心
@Sitelayer.layui.com
@Sitehttp://layer.layui.com
@LicenseLGPL
*/
@ -10,63 +10,82 @@
;!function(window, undefined){
"use strict";
var $, win, ready = {
var isLayui = window.layui && layui.define, $, win, ready = {
getPath: function(){
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
if(script.getAttribute('merge')) return;
return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
}(),
config: {}, end: {},
btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;'],
config: {}, end: {}, minIndex: 0, minLeft: [],
btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
//五种原始层模式
type: ['dialog', 'page', 'iframe', 'loading', 'tips']
};
//默认内置方法。
var layer = {
v: '2.5',
ie6: !!window.ActiveXObject&&!window.XMLHttpRequest,
v: '3.0',
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
) : false;
}(),
index: (window.layer && window.layer.v) ? 100000 : 0,
path: ready.getPath,
config: function(options, fn){
var item = 0, ext;
options = options || {};
layer.cache = ready.config = $.extend(ready.config, options);
layer.cache = ready.config = $.extend({}, ready.config, options);
layer.path = ready.config.path || layer.path;
typeof options.extend === 'string' && (options.extend = [options.extend]);
fn && fn();
if(ready.config.path) layer.ready();
if(!options.extend) return this;
isLayui
? layui.addcss('modules/layer/' + options.extend)
: layer.link('skin/' + options.extend);
return this;
},
//载入配件
use: function(module, fn, readyMethod){
var i = 0, head = $('head')[0];
var module = module.replace(/\s/g, '');
var iscss = /\.css$/.test(module);
var node = document.createElement(iscss ? 'link' : 'script');
var id = 'layui_layer_' + module.replace(layui.cache.extend_dir, '').replace(/\.|\//g, '');
//载入CSS配件
link: function(href, fn, cssname){
//未设置路径则不主动加载css
if(!layer.path) return;
if(iscss){
node.rel = 'stylesheet';
}
node[iscss ? 'href' : 'src'] = /^http:\/\//.test(module) ? module : layer.path + module;
node.id = id;
var head = $('head')[0], link = document.createElement('link');
if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, '');
var id = 'layuicss-'+app, timeout = 0;
link.rel = 'stylesheet';
link.href = layer.path + href;
link.id = id;
if(!$('#'+ id)[0]){
head.appendChild(node);
head.appendChild(link);
}
//轮询加载就绪
;(function poll() {
;(iscss ? parseInt($('#'+id).css('width')) === 1989 : layer[readyMethod||id]) ? function(){
fn && fn();
try { iscss || head.removeChild(node); } catch(e){};
}() : setTimeout(poll, 100);
if(typeof fn !== 'function') return;
//轮询css是否加载完毕
(function poll() {
if(++timeout > 8 * 1000 / 100){
return window.console && console.error('layer.css: Invalid');
};
parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
}());
return this;
},
ready: function(fn){
layui.addcss('pc/layer/layer.css', fn, 'skinlayercss');
ready: function(callback){
var cssname = 'skinlayercss', ver = '1172';
isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
: layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);
return this;
},
@ -97,7 +116,7 @@ var layer = {
msg: function(content, options, end){ //最常用提示层
var type = typeof options === 'function', rskin = ready.config.skin;
var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
var shift = doms.anim.length - 1;
var anim = doms.anim.length - 1;
if(type) end = options;
return layer.open($.extend({
content: content,
@ -107,10 +126,11 @@ var layer = {
title: false,
closeBtn: false,
btn: false,
resize: false,
end: end
}, (type && !ready.config.skin) ? {
skin: skin + ' layui-layer-hui',
shift: shift
anim: anim
} : function(){
options = options || {};
if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
@ -124,6 +144,7 @@ var layer = {
return layer.open($.extend({
type: 3,
icon: icon || 0,
resize: false,
shade: 0.01
}, options));
},
@ -135,7 +156,8 @@ var layer = {
closeBtn: false,
time: 3000,
shade: false,
fix: false,
resize: false,
fixed: false,
maxWidth: 210
}, options));
}
@ -144,8 +166,10 @@ var layer = {
var Class = function(setings){
var that = this;
that.index = ++layer.index;
that.config = $.extend({}, that.config, ready.config, setings);
that.creat();
that.config = $.extend({}, that.config, ready.config, setings);
document.body ? that.creat() : setTimeout(function(){
that.creat();
}, 50);
};
Class.pt = Class.prototype;
@ -158,7 +182,7 @@ doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'l
Class.pt.config = {
type: 0,
shade: 0.3,
fix: true,
fixed: true,
move: doms[1],
title: '&#x4FE1;&#x606F;',
offset: 'auto',
@ -167,8 +191,10 @@ Class.pt.config = {
time: 0, //0表示不自动关闭
zIndex: 19891014,
maxWidth: 360,
shift: 0,
anim: 0,
icon: -1,
moveType: 1,
resize: true,
scrollbar: true, //是否允许浏览器滚动条
tips: 2
};
@ -188,12 +214,12 @@ Class.pt.vessel = function(conType, 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>') : '',
//主体
'<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.fix ? '' : ';position:absolute;') +'">'
'<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;') +'">'
+ (conType && config.type != 2 ? '' : titleHTML)
+'<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
+ '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
+ (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
+ (config.type == 1 && conType ? '' : (config.content||''))
+'</div>'
+ '</div>'
+ '<span class="layui-layer-setwin">'+ function(){
var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
@ -205,24 +231,38 @@ Class.pt.vessel = function(conType, callback){
for(var i = 0, len = config.btn.length; i < len; i++){
button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
}
return '<div class="'+ doms[6] +'">'+ button +'</div>'
return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
}() : '')
+'</div>'
], titleHTML);
+ (config.resize ? '<span class="layui-layer-resize"></span>' : '')
+ '</div>'
], titleHTML, $('<div class="layui-layer-move"></div>'));
return that;
};
//创建骨架
Class.pt.creat = function(){
var that = this, config = that.config, times = that.index, nodeIndex;
var content = config.content, conType = typeof content === 'object';
var that = this
,config = that.config
,times = that.index, nodeIndex
,content = config.content
,conType = typeof content === 'object'
,body = $('body');
if($('#'+config.id)[0]) return;
if(typeof config.area === 'string'){
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
}
//anim兼容旧版shift
if(config.shift){
config.anim = config.shift;
}
if(layer.ie == 6){
config.fixed = false;
}
switch(config.type){
case 0:
config.btn = ('btn' in config) ? config.btn : ready.btn[0];
@ -233,8 +273,8 @@ Class.pt.creat = function(){
config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
break;
case 3:
config.title = false;
config.closeBtn = false;
delete config.title;
delete config.closeBtn;
config.icon === -1 && (config.icon === 0);
layer.closeAll('loading');
break;
@ -242,34 +282,35 @@ Class.pt.creat = function(){
conType || (config.content = [config.content, 'body']);
config.follow = config.content[1];
config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
config.title = false;
delete config.title;
config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
config.tipsMore || layer.closeAll('tips');
break;
}
//建立容器
that.vessel(conType, function(html, titleHTML){
$('body').append(html[0]);
that.vessel(conType, function(html, titleHTML, moveElem){
body.append(html[0]);
conType ? function(){
(config.type == 2 || config.type == 4) ? function(){
$('body').append(html[1]);
}() : function(){
if(!content.parents('.'+doms[0])[0]){
content.show().addClass('layui-layer-wrap').wrap(html[1]);
content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
$('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
}
}();
}() : $('body').append(html[1]);
}() : body.append(html[1]);
$('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
that.layero = $('#'+ doms[0] + times);
config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
}).auto(times);
config.type == 2 && layer.ie6 && that.layero.find('iframe').attr('src', content[0]);
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
//坐标自适应浏览器窗口尺寸
config.type == 4 ? that.tips() : that.offset();
if(config.fix){
if(config.fixed){
win.on('resize', function(){
that.offset();
(/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
@ -281,9 +322,10 @@ Class.pt.creat = function(){
layer.close(that.index)
}, config.time);
that.move().callback();
if(doms.anim[config.shift]){
that.layero.addClass(doms.anim[config.shift]);
//为兼容jQuery3.0的css动画影响元素尺寸计算
if(doms.anim[config.anim]){
that.layero.addClass(doms.anim[config.anim]);
};
};
@ -292,7 +334,7 @@ Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);
if(config.area[0] === '' && config.maxWidth > 0){
//为了修复IE7下一个让人难以理解的bug
if(/MSIE 7/.test(navigator.userAgent) && config.btn){
if(layer.ie && layer.ie < 8 && config.btn){
layero.width(layero.innerWidth());
}
layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
@ -310,7 +352,7 @@ Class.pt.auto = function(index){
break;
default:
if(config.area[1] === ''){
if(config.fix && area[1] >= win.height()){
if(config.fixed && area[1] >= win.height()){
area[1] = win.height();
setHeight('.'+doms[5]);
}
@ -329,28 +371,39 @@ Class.pt.offset = function(){
var type = typeof config.offset === 'object';
that.offsetTop = (win.height() - area[1])/2;
that.offsetLeft = (win.width() - area[0])/2;
if(type){
that.offsetTop = config.offset[0];
that.offsetLeft = config.offset[1]||that.offsetLeft;
} else if(config.offset !== 'auto'){
if(config.offset === 'rt'){ //右上角
if(config.offset === 't'){ //上
that.offsetTop = 0;
} else if(config.offset === 'r'){ //右
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'rc'){ //右侧中央
} else if(config.offset === 'b'){ //下
that.offsetTop = win.height() - area[1];
} else if(config.offset === 'l'){ //左
that.offsetLeft = 0;
} else if(config.offset === 'lt'){ //左上角
that.offsetTop = 0;
that.offsetLeft = 0;
} else if(config.offset === 'lb'){ //左下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = 0;
} else if(config.offset === 'rt'){ //右上角
that.offsetTop = 0;
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'rb'){ //右下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'b'){ //正中底部
that.offsetTop = win.height() - area[1];
} else if(config.offset === 'lb'){ //左下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = 0;
} else {
that.offsetTop = config.offset;
}
}
if(!config.fix){
if(!config.fixed){
that.offsetTop = /%$/.test(that.offsetTop) ?
win.height()*parseFloat(that.offsetTop)/100
: parseFloat(that.offsetTop);
@ -360,6 +413,12 @@ Class.pt.offset = function(){
that.offsetTop += win.scrollTop();
that.offsetLeft += win.scrollLeft();
}
if(layero.attr('minLeft')){
that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
that.offsetLeft = layero.css('left');
}
layero.css({top: that.offsetTop, left: that.offsetLeft});
};
@ -423,81 +482,102 @@ Class.pt.tips = function(){
'padding-right': (config.closeBtn ? '30px' : '')
});
layero.css({
left: goal.tipLeft - (config.fix ? win.scrollLeft() : 0),
top: goal.tipTop - (config.fix ? win.scrollTop() : 0)
left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
});
}
//拖拽层
Class.pt.move = function(){
var that = this, config = that.config, conf = {
setY: 0,
moveLayer: function(){
var layero = conf.layero, mgleft = parseInt(layero.css('margin-left'));
var lefts = parseInt(conf.move.css('left'));
mgleft === 0 || (lefts = lefts - mgleft);
if(layero.css('position') !== 'fixed'){
lefts = lefts - layero.parent().offset().left;
conf.setY = 0;
}
layero.css({left: lefts, top: parseInt(conf.move.css('top')) - conf.setY});
}
};
var that = this
,config = that.config
,_DOC = $(document)
,layero = that.layero
,moveElem = layero.find(config.move)
,resizeElem = layero.find('.layui-layer-resize')
,dict = {};
var movedom = that.layero.find(config.move);
config.move && movedom.attr('move', 'ok');
movedom.css({cursor: config.move ? 'move' : 'auto'});
$(config.move).on('mousedown', function(M){
M.preventDefault();
if($(this).attr('move') === 'ok'){
conf.ismove = true;
conf.layero = $(this).parents('.'+ doms[0]);
var xx = conf.layero.offset().left, yy = conf.layero.offset().top, ww = conf.layero.outerWidth() - 6, hh = conf.layero.outerHeight() - 6;
if(!$('#layui-layer-moves')[0]){
$('body').append('<div id="layui-layer-moves" class="layui-layer-moves" style="left:'+ xx +'px; top:'+ yy +'px; width:'+ ww +'px; height:'+ hh +'px; z-index:2147483584"></div>');
}
conf.move = $('#layui-layer-moves');
config.moveType && conf.move.css({visibility: 'hidden'});
conf.moveX = M.pageX - conf.move.position().left;
conf.moveY = M.pageY - conf.move.position().top;
conf.layero.css('position') !== 'fixed' || (conf.setY = win.scrollTop());
if(config.move){
moveElem.css('cursor', 'move');
}
moveElem.on('mousedown', function(e){
e.preventDefault();
if(config.move){
dict.moveStart = true;
dict.offset = [
e.clientX - parseFloat(layero.css('left'))
,e.clientY - parseFloat(layero.css('top'))
];
ready.moveElem.css('cursor', 'move').show();
}
});
$(document).mousemove(function(M){
if(conf.ismove){
var offsetX = M.pageX - conf.moveX, offsetY = M.pageY - conf.moveY;
M.preventDefault();
resizeElem.on('mousedown', function(e){
e.preventDefault();
dict.resizeStart = true;
dict.offset = [e.clientX, e.clientY];
dict.area = [
layero.outerWidth()
,layero.outerHeight()
];
ready.moveElem.css('cursor', 'se-resize').show();
});
_DOC.on('mousemove', function(e){
//拖拽移动
if(dict.moveStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,fixed = layero.css('position') === 'fixed';
e.preventDefault();
dict.stX = fixed ? 0 : win.scrollLeft();
dict.stY = fixed ? 0 : win.scrollTop();
//控制元素不被拖出窗口外
if(!config.moveOut){
conf.setY = win.scrollTop();
var setRig = win.width() - conf.move.outerWidth(), setTop = conf.setY;
offsetX < 0 && (offsetX = 0);
offsetX > setRig && (offsetX = setRig);
offsetY < setTop && (offsetY = setTop);
offsetY > win.height() - conf.move.outerHeight() + conf.setY && (offsetY = win.height() - conf.move.outerHeight() + conf.setY);
var setRig = win.width() - layero.outerWidth() + dict.stX
,setBot = win.height() - layero.outerHeight() + dict.stY;
X < dict.stX && (X = dict.stX);
X > setRig && (X = setRig);
Y < dict.stY && (Y = dict.stY);
Y > setBot && (Y = setBot);
}
conf.move.css({left: offsetX, top: offsetY});
config.moveType && conf.moveLayer();
layero.css({
left: X
,top: Y
});
}
//Resize
if(config.resize && dict.resizeStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1];
offsetX = offsetY = setRig = setTop = null;
}
}).mouseup(function(){
try{
if(conf.ismove){
conf.moveLayer();
conf.move.remove();
config.moveEnd && config.moveEnd();
}
conf.ismove = false;
}catch(e){
conf.ismove = false;
e.preventDefault();
layer.style(that.index, {
width: dict.area[0] + X
,height: dict.area[1] + Y
})
dict.isResize = true;
}
}).on('mouseup', function(e){
if(dict.moveStart){
delete dict.moveStart;
ready.moveElem.hide();
config.moveEnd && config.moveEnd();
}
if(dict.resizeStart){
delete dict.resizeStart;
ready.moveElem.hide();
}
});
return that;
};
@ -513,7 +593,7 @@ Class.pt.callback = function(){
config.success(layero, that.index);
}
}
layer.ie6 && that.IE6(layero);
layer.ie == 6 && that.IE6(layero);
//按钮
layero.find('.'+ doms[6]).children('a').on('click', function(){
@ -582,15 +662,6 @@ ready.reselect = function(){
};
Class.pt.IE6 = function(layero){
var that = this, _ieTop = layero.offset().top;
//ie6的固定与相对定位
function ie6Fix(){
layero.css({top : _ieTop + (that.config.fix ? win.scrollTop() : 0)});
};
ie6Fix();
win.scroll(ie6Fix);
//隐藏select
$('select').each(function(index , value){
var sthis = $(this);
@ -642,6 +713,8 @@ ready.rescollbar = function(index){
/** 内置成员 */
window.layer = layer;
//获取子iframe的DOM
layer.getChildFrame = function(selector, index){
index = index || $('.'+doms[4]).attr('times');
@ -670,29 +743,75 @@ layer.iframeSrc = function(index, url){
};
//设定层的样式
layer.style = function(index, options){
var layero = $('#'+ doms[0] + index), type = layero.attr('type');
var titHeight = layero.find(doms[1]).outerHeight() || 0;
var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
if(type === ready.type[1] || type === ready.type[2]){
layero.css(options);
if(type === ready.type[2]){
layero.find('iframe').css({
height: parseFloat(options.height) - titHeight - btnHeight
});
}
layer.style = function(index, options, limit){
var layero = $('#'+ doms[0] + index)
,contElem = layero.find('.layui-layer-content')
,type = layero.attr('type')
,titHeight = layero.find(doms[1]).outerHeight() || 0
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
,minLeft = layero.attr('minLeft');
if(type === ready.type[3] || type === ready.type[4]){
return;
}
if(!limit){
if(parseFloat(options.width) <= 260){
options.width = 260;
};
if(parseFloat(options.height) - titHeight - btnHeight <= 64){
options.height = 64 + titHeight + btnHeight;
};
}
layero.css(options);
if(type === ready.type[2]){
layero.find('iframe').css({
height: parseFloat(options.height) - titHeight - btnHeight
});
} else {
contElem.css({
height: parseFloat(options.height) - titHeight - btnHeight
- parseFloat(contElem.css('padding-top'))
- parseFloat(contElem.css('padding-bottom'))
})
}
};
//最小化
layer.min = function(index, options){
var layero = $('#'+ doms[0] + index);
var titHeight = layero.find(doms[1]).outerHeight() || 0;
var layero = $('#'+ doms[0] + index)
,titHeight = layero.find(doms[1]).outerHeight() || 0
,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
,position = layero.css('position');
ready.record(layero);
layer.style(index, {width: 180, height: titHeight, overflow: 'hidden'});
if(ready.minLeft[0]){
left = ready.minLeft[0];
ready.minLeft.shift();
}
layero.attr('position', position);
layer.style(index, {
width: 180
,height: titHeight
,left: left
,top: win.height() - titHeight
,position: 'fixed'
,overflow: 'hidden'
}, true);
layero.find('.layui-layer-min').hide();
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
ready.rescollbar(index);
if(!layero.attr('minLeft')){
ready.minIndex++;
}
layero.attr('minLeft', left);
};
//还原
@ -704,6 +823,7 @@ layer.restore = function(index){
height: parseFloat(area[1]),
top: parseFloat(area[2]),
left: parseFloat(area[3]),
position: layero.attr('position'),
overflow: 'visible'
});
layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
@ -723,10 +843,10 @@ layer.full = function(index){
timer = setTimeout(function(){
var isfix = layero.css('position') === 'fixed';
layer.style(index, {
top: isfix ? 0 : win.scrollTop(),
left: isfix ? 0 : win.scrollLeft(),
width: win.width(),
height: win.height()
top: isfix ? 0 : win.scrollTop(),
left: isfix ? 0 : win.scrollLeft(),
width: win.width(),
height: win.height()
});
layero.find('.layui-layer-min').hide();
}, 100);
@ -740,31 +860,43 @@ layer.title = function(name, index){
//关闭layer总方法
layer.close = function(index){
var layero = $('#'+ doms[0] + index), type = layero.attr('type');
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
if(!layero[0]) return;
if(type === ready.type[1] && layero.attr('conType') === 'object'){
layero.children(':not(.'+ doms[5] +')').remove();
for(var i = 0; i < 2; i++){
layero.find('.layui-layer-wrap').unwrap().hide();
var WRAP = 'layui-layer-wrap', remove = function(){
if(type === ready.type[1] && layero.attr('conType') === 'object'){
layero.children(':not(.'+ doms[5] +')').remove();
var wrap = layero.find('.'+WRAP);
for(var i = 0; i < 2; i++){
wrap.unwrap();
}
wrap.css('display', wrap.data('display')).removeClass(WRAP);
} else {
//低版本IE 回收 iframe
if(type === ready.type[2]){
try {
var iframe = $('#'+doms[4]+index)[0];
iframe.contentWindow.document.write('');
iframe.contentWindow.close();
layero.find('.'+doms[5])[0].removeChild(iframe);
} catch(e){}
}
layero[0].innerHTML = '';
layero.remove();
}
} else {
//低版本IE 回收 iframe
if(type === ready.type[2]){
try {
var iframe = $('#'+doms[4]+index)[0];
iframe.contentWindow.document.write('');
iframe.contentWindow.close();
layero.find('.'+doms[5])[0].removeChild(iframe);
} catch(e){}
}
layero[0].innerHTML = '';
layero.remove();
}
};
layero.addClass(closeAnim);
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
layer.ie6 && ready.reselect();
layer.ie == 6 && ready.reselect();
ready.rescollbar(index);
typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index];
if(layero.attr('minLeft')){
ready.minIndex--;
ready.minLeft.push(layero.attr('minLeft'));
}
setTimeout(function(){
remove();
}, (layer.ie && layer.ie < 10) ? 0 : 200);
};
//关闭所有层
@ -777,8 +909,6 @@ layer.closeAll = function(type){
});
};
/**
拓展模块layui开始合并在一起
@ -791,19 +921,32 @@ var cache = layer.cache||{}, skin = function(type){
//仿系统prompt
layer.prompt = function(options, yes){
var style = '';
options = options || {};
if(typeof options === 'function') yes = options;
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input">'+ (options.value||'') +'</textarea>' : function(){
if(options.area){
var area = options.area;
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
delete options.area;
}
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
}();
return layer.open($.extend({
btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;'],
content: content,
skin: 'layui-layer-prompt' + skin('prompt'),
success: function(layero){
type: 1
,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
,content: content
,skin: 'layui-layer-prompt' + skin('prompt')
,maxWidth: win.width()
,success: function(layero){
prompt = layero.find('.layui-layer-input');
prompt.focus();
}, yes: function(index){
}
,resize: false
,yes: function(index){
var value = prompt.val();
if(value === ''){
prompt.focus();
@ -823,6 +966,7 @@ layer.tab = function(options){
return layer.open($.extend({
type: 1,
skin: 'layui-layer-tab' + skin('tab'),
resize: false,
title: function(){
var len = tab.length, ii = 1, str = '';
if(len > 0){
@ -997,13 +1141,22 @@ layer.photos = function(options, loop, key){
dict.index = layer.open($.extend({
type: 1,
area: function(){
var imgarea = [img.width, img.height];
var winarea = [$(window).width() - 50, $(window).height() - 50];
if(!options.full && imgarea[0] > winarea[0]){
imgarea[0] = winarea[0];
imgarea[1] = imgarea[0]*img.height/img.width;
}
return [imgarea[0]+'px', imgarea[1]+'px'];
var imgarea = [img.width, img.height];
var winarea = [$(window).width() - 100, $(window).height() - 100];
//如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
imgarea[0] = imgarea[0]/wh[0];
imgarea[1] = imgarea[1]/wh[0];
} else if(wh[0] < wh[1]){
imgarea[0] = imgarea[0]/wh[1];
imgarea[1] = imgarea[1]/wh[1];
}
}
return [imgarea[0]+'px', imgarea[1]+'px'];
}(),
title: false,
shade: 0.9,
@ -1013,7 +1166,7 @@ layer.photos = function(options, loop, key){
moveType: 1,
scrollbar: false,
moveOut: true,
shift: Math.random()*5|0,
anim: Math.random()*5|0,
skin: 'layui-layer-photos' + skin('photos'),
content: '<div class="layui-layer-phimg">'
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
@ -1044,10 +1197,9 @@ layer.photos = function(options, loop, key){
});
};
//主入口
ready.run = function(){
$ = layui.jquery;
ready.run = function(_$){
$ = _$;
win = $(window);
doms.html = $('html');
layer.open = function(deliver){
@ -1056,17 +1208,25 @@ ready.run = function(){
};
};
//加载组件所需的css
layui.addcss('modules/layer/layer.css', 'skinlayercss');
//加载方式
window.layui && layui.define ? (
layer.ready()
,layui.define('jquery', function(exports){ //layui加载
layer.path = layui.cache.dir;
ready.run(layui.jquery);
//定义模块
layui.define('jquery', function(exports){
layer.path = layui.cache.dir;
ready.run();
//暴露模块
window.layer = layer;
exports('layer', layer);
});
//暴露模块
window.layer = layer;
exports('layer', layer);
})
) : (
typeof define === 'function' ? define(['jquery'], function(){ //requirejs加载
ready.run(window.jQuery);
return layer;
}) : function(){ //普通script标签加载
ready.run(window.jQuery);
layer.ready();
}()
);
}(window);

View File

@ -55,7 +55,7 @@ modules = {
,jquery: 'lib/jquery' //DOM库第三方
,'layui.all': 'dest/layui.all' //PC模块合并版
,'layui.mod': 'dest/layui.mod' //PC模块合并版
};
config.modules = {}; //记录模块物理路径
@ -179,7 +179,7 @@ Lay.fn.use = function(apps, callback, exports){
//使用打包好的完整Layui库
Lay.fn.all = function(callback){
this.use('layui.all', callback)
this.use('layui.mod', callback)
return this;
};

76
test/all.html Normal file
View File

@ -0,0 +1,76 @@
<!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="../build/css/layui.css">
<style>
body{padding: 10px;}
</style>
</head>
<body>
<div id="demo1"></div>
<button class="layui-btn demo" data-type="test">测试弹出式Form</button>
<script src="../build/lay/dest/layui.all.js"></script>
<script>
;!function(){
var $ = layui.jquery
,layer = layui.layer
,form = layui.form()
,laypage = layui.laypage;
layer.ready(function(){
layer.msg('hello');
});
laypage({
cont: 'demo1'
,pages: 100 //总页数
,groups: 5 //连续显示分页数
});
//触发事件
var active = {
test: function(){
layer.open({
type: 1
,resize: false
,content: ['<ul class="layui-form" style="margin: 10px;">'
,'<li class="layui-form-item">'
,'<label class="layui-form-label">邮箱激活</label>'
,'<div class="layui-input-block">'
,'<select name="activate">'
,'<option value="0">未激活</option>'
,'<option value="1">已激活</option>'
,'<select>'
,'</div>'
,'</li>'
,'<li class="layui-form-item" style="text-align:center;">'
,'<button type="submit" lay-submit lay-filter="*" class="layui-btn">提交</button>'
,'</li>'
,'</ul>'].join('')
,success: function(layero){
layero.find('.layui-layer-content').css('overflow', 'visible');
form.render().on('submit(*)', function(data){
layer.msg(JSON.stringify(data.field));
});
}
});
}
};
$('.demo').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
}();
</script>
</body>
</html>

View File

@ -35,18 +35,41 @@ body{padding: 10px;}
<ul class="layui-nav">
<li class="layui-nav-item"><a href="">最新活动</a></li>
<li class="layui-nav-item layui-this"><a href="">产品</a></li>
<li class="layui-nav-item"><a href="">解决方案</a></li>
<li class="layui-nav-item"><a href="">大数据</a></li>
<li class="layui-nav-item">
<a href="javascript:;">解决方案</a>
<dl class="layui-nav-child">
<dd><a href="">移动模块</a></dd>
<dd><a href="">后台模版</a></dd>
<dd><a href="">电商平台</a></dd>
</dl>
</li>
</ul>
<br><br>
<ul class="layui-nav layui-nav-tree">
<li class="layui-nav-item"><a href="">最新活动</a></li>
<li class="layui-nav-item layui-this"><a href="">产品</a></li>
<li class="layui-nav-item"><a href="">解决方案</a></li>
<li class="layui-nav-item layui-nav-itemed layui-this">
<a class="" href="javascript:;">产品</a>
<dl class="layui-nav-child">
<dd><a href="">移动模块</a></dd>
<dd><a href="">后台模版</a></dd>
<dd><a href="">电商平台</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="">大数据</a></li>
<li class="layui-nav-item"><a href="">云市场</a></li>
<li class="layui-nav-item">
<a href="javascript:;">解决方案</a>
<dl class="layui-nav-child">
<dd><a href="">移动模块</a></dd>
<dd><a href="">后台模版</a></dd>
<dd><a href="">电商平台</a></dd>
</dl>
</li>
<li class="layui-nav-item"><a href="">社区</a></li>
</ul>

View File

@ -9,7 +9,7 @@
<style>
body{padding: 15px;}
.flow-default{height: 400px; overflow: auto; font-size: 0;}
.flow-default{ font-size: 0;}
.flow-default li{display: inline-block; margin-right: 10px; font-size: 14px; width: 48%; margin-bottom: 10px; height: 200px; line-height: 200px; text-align: center; background-color: #eee;}
img{width: 500px; height: 300px;}
.flow-default img{width: 100%; height: 100%;}
@ -46,16 +46,16 @@ layui.use('flow', function(){
flow.load({
elem: '.flow-default' //流加载容器
,scrollElem: '.flow-default' //滚动条所在元素默认document
//,scrollElem: '.flow-default' //滚动条所在元素默认document
//,isAuto: false
//,isShowEnd: false
//,isLazyimg: true
,isLazyimg: true
,done: function(page, next){ //加载下一页
console.log(page)
setTimeout(function(){
var lis = [];
for(var i = 0; i < 6; i++){
lis.push('<li><img src="http://s6.mogucdn.com/p2/160914/iz_5lc1cdg3j2hibl9ai99lg7c28k1fh_305x330.jpg?v='+ (page+i) +'"></li>')
lis.push('<li><img lay-src="http://s6.mogucdn.com/p2/160914/iz_5lc1cdg3j2hibl9ai99lg7c28k1fh_305x330.jpg?v='+ (page+i) +'"></li>')
}
next(lis.join(''), page > 5 ? 0 : 11);
}, 500);

View File

@ -61,6 +61,21 @@ body{padding: 10px;}
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">select分组</label>
<div class="layui-input-block">
<select name="quiz">
<option value="">请选择问题</option>
<optgroup label="城市记忆">
<option value="你工作的第一个城市">你工作的第一个城市</option>
</optgroup>
<optgroup label="学生时代">
<option value="你的工号">你的工号</option>
<option value="你最喜欢的老师">你最喜欢的老师</option>
</optgroup>
</select>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">选择框</label>

View File

@ -1,3 +1,5 @@
<!DOCTYPE html>
<html>
<head>

View File

@ -21,6 +21,7 @@ body{padding: 10px;}
</textarea>
</div>
<button class="layui-btn">提交</button>
<a class="layui-btn" id="getChoose">获取选中内容</a>
</form>
</div>
@ -30,7 +31,7 @@ body{padding: 10px;}
layui.use('layedit', function(){
var layedit = layui.layedit;
layedit.build('demo', {
var index = layedit.build('demo', {
//hideTool: ['image']
uploadImage: {
url: '/upload/test/'
@ -39,6 +40,11 @@ layui.use('layedit', function(){
//,tool: []
//,height: 100
});
getChoose.onclick = function(){
alert(layedit.getSelection(index));
};
});
</script>
</body>

47
test/layer.html Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>layer弹层 - layui</title>
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding: 50px 100px;}
</style>
</head>
<body>
<button class="layui-btn demo" data-type="test">测试一</button>
<button class="layui-btn demo" data-type="test2">测试二</button>
<script src="../src/layui.js"></script>
<script>
layui.use('layer', function(){
var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
//触发事件
var active = {
test: function(){
layer.alert('你好么,体验者');
}
,test2: function(){
layer.open({
type: 2
,content: 'http://fly.layui.com/'
,area: ['375px', '500px']
,maxmin: true
})
}
};
$('.demo').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
</body>
</html>

59
test/table.html Normal file
View File

@ -0,0 +1,59 @@
<!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: 10px;}
</style>
</head>
<body>
<table class="layui-table">
<thead>
<tr>
<th>名称</th>
<th>组合</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">原始</td>
<td>class="layui-btn layui-btn-primary"</td>
</tr>
<tr>
<td style="text-align: center;">默认</td>
<td>class="layui-btn"</td>
</tr>
<tr>
<td style="text-align: center;">百搭</td>
<td>class="layui-btn layui-btn-normal"</td>
</tr>
<tr>
<td style="text-align: center;">暖色</td>
<td>class="layui-btn layui-btn-warm"</td>
</tr>
<tr>
<td style="text-align: center;">警告</td>
<td>class="layui-btn layui-btn-danger"</td>
</tr>
<tr>
<td style="text-align: center;">禁用</td>
<td>class="layui-btn layui-btn-disabled"</td>
</tr>
</tbody>
</table>
<script src="../src/layui.js"></script>
<script>
</script>
</body>
</html>