This commit is contained in:
sentsin
2017-02-28 02:16:08 +08:00
parent e55f6f33d7
commit 1d31b8be24
50 changed files with 389 additions and 450 deletions

View File

@@ -29,11 +29,11 @@ pre{white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; w
/** 图标字体 **/
@font-face {font-family: 'layui-icon';
src: url('../font/iconfont.eot?v=1.0.8');
src: url('../font/iconfont.eot?v=1.0.8#iefix') format('embedded-opentype'),
url('../font/iconfont.woff?v=1.0.8') format('woff'),
url('../font/iconfont.ttf?v=1.0.8') format('truetype'),
url('../font/iconfont.svg?v=1.0.8#iconfont') format('svg');
src: url('../font/iconfont.eot?v=1.0.9');
src: url('../font/iconfont.eot?v=1.0.9#iefix') format('embedded-opentype'),
url('../font/iconfont.woff?v=1.0.9') format('woff'),
url('../font/iconfont.ttf?v=1.0.9') format('truetype'),
url('../font/iconfont.svg?v=1.0.9#iconfont') format('svg');
}
.layui-icon{
@@ -98,7 +98,15 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-progress-big,
.layui-progress-big .layui-progress-bar{height: 18px; line-height: 18px; text-align: right;}
.layui-progress-text{position: absolute; right: 0; top: -16px; line-height: 18px; font-size: 12px; color: #666}
.layui-progress-big .layui-progress-text{position: static; padding: 0 10px; color: #fff;}}
.layui-progress-big .layui-progress-text{position: static; padding: 0 10px; color: #fff;}
/* 折叠面板 */
.layui-collapse{border: 1px solid #e2e2e2; border-radius: 2px;}
.layui-colla-item{border-top: 1px solid #e2e2e2}
.layui-colla-item:first-child{border-top: none;}
.layui-colla-title{position: relative; height: 42px; line-height: 42px; padding: 0 15px 0 35px; color: #333; background-color: #f2f2f2; cursor: pointer;}
.layui-colla-content{display: none; padding: 10px 15px; line-height: 22px; border-top: 1px solid #e2e2e2; color: #666;}
.layui-colla-icon{position: absolute; left: 15px; top: 0; font-size: 14px;}
/* 背景颜色 */
@@ -186,6 +194,7 @@ a cite{font-style: normal; *cursor:pointer;}
.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;}
.layui-select-none{margin: 5px 0; text-align: center; color: #999;}
.layui-select-disabled .layui-disabled{border-color: #eee !important;}
.layui-select-disabled .layui-edge{border-top-color: #d2d2d2}
@@ -195,17 +204,26 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-form-checkbox *{display: inline-block; vertical-align: middle;}
.layui-form-checkbox span{padding: 0 10px; height: 100%; font-size: 14px; background-color: #d2d2d2; color: #fff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
.layui-form-checkbox:hover span{background-color: #c2c2c2;}
.layui-form-checkbox i{position: absolute; right: 0; width: 37px; color: #fff; font-size: 20px;}
.layui-form-checkbox i{position: absolute; right: 0; width: 30px; color: #fff; font-size: 20px; text-align: center;}
.layui-form-checkbox:hover i{color: #c2c2c2;}
.layui-form-checked, .layui-form-checked:hover{border: 1px solid #5FB878;}
.layui-form-checked, .layui-form-checked:hover{border-color: #5FB878;}
.layui-form-checked span, .layui-form-checked:hover span{background-color: #5FB878;}
.layui-form-checked i, .layui-form-checked:hover i{color: #5FB878;}
/* 复选框-开关风格 */.layui-form-switch{position: relative; display: inline-block; vertical-align: middle; height: 22px; line-height: 22px; width: 40px; padding: 0 5px; margin-top: 8px; border: 1px solid #d2d2d2; border-radius: 20px; cursor: pointer; background-color: #fff; -webkit-transition: .1s linear; transition: .1s linear;}
/* 复选框-原始风格 */.layui-form-checkbox[lay-skin="primary"]{margin-top: 6px; border: none!important; padding-right: 0;}
.layui-form-checkbox[lay-skin="primary"] span{float: right; background: none; color: #666;}
.layui-form-checkbox[lay-skin="primary"] i{position: relative; top: 0; width: 16px; line-height: 16px; border: 1px solid #d2d2d2; font-size: 12px; border-radius: 2px; background-color: #fff; -webkit-transition: .1s linear; transition: .1s linear;}
.layui-form-checkbox[lay-skin="primary"]:hover i{border-color: #5FB878; color: #fff;}
.layui-form-checked[lay-skin="primary"] i{border-color: #5FB878; background-color: #5FB878; color: #fff;}
.layui-checkbox-disbaled[lay-skin="primary"] span{background: none!important;}
.layui-checkbox-disbaled[lay-skin="primary"]:hover i{border-color: #d2d2d2;}
/* 复选框-开关风格 */.layui-form-switch{position: relative; display: inline-block; vertical-align: middle; height: 22px; line-height: 22px; width: 42px; padding: 0 5px; margin-top: 8px; border: 1px solid #d2d2d2; border-radius: 20px; cursor: pointer; background-color: #fff; -webkit-transition: .1s linear; transition: .1s linear;}
.layui-form-switch i{position: absolute; left: 5px; top: 3px; width: 16px; height: 16px; border-radius: 20px; background-color: #d2d2d2; -webkit-transition: .1s linear; transition: .1s linear;}
.layui-form-switch em{position: absolute; right: 5px; top: 0; width: 25px; padding: 0!important; text-align: center!important; color: #999!important; font-style: normal!important; font-size: 12px;}
.layui-form-onswitch{border-color: #5FB878; background-color: #5FB878;}
.layui-form-onswitch:before{content: 'ON'; color: #fff;}
.layui-form-onswitch i{left: 30px; background-color: #fff;}
.layui-form-onswitch i{left: 32px; background-color: #fff;}
.layui-form-onswitch em{left: 5px; right: auto; color: #fff!important;}
.layui-checkbox-disbaled{border-color: #e2e2e2 !important;}
.layui-checkbox-disbaled span{background-color: #e2e2e2 !important;}
@@ -402,15 +420,16 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-breadcrumb a span{padding-left: 8px; font-family: Sim sun;}
/** Tab选项卡 **/
.layui-tab{margin: 10px 0; overflow: hidden; text-align: left !important;}
.layui-tab{margin: 10px 0; text-align: left !important;}
.layui-tab[overflow]>.layui-tab-title{overflow: hidden;}
.layui-tab-title{position: relative; left: 0; height: 40px; white-space: nowrap; font-size: 0; border-bottom: 1px solid #e2e2e2; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab-title li{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; font-size: 14px; transition: all .3s; -webkit-transition: all .3s;}
.layui-tab-title li{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; font-size: 14px; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab-title li{position: relative; line-height: 40px; min-width: 65px; padding: 0 10px; text-align: center; cursor: pointer;}
.layui-tab-title li a{display: block;}
.layui-tab-title .layui-this{color: #000;}
.layui-tab-title .layui-this:after{position: absolute; left:0; top: 0; content: ''; width:100%; height: 41px; border: 1px solid #e2e2e2; border-bottom-color: #fff; border-radius: 2px 2px 0 0; -webkit-box-sizing: border-box !important; -moz-box-sizing: border-box !important; box-sizing: border-box !important; pointer-events: none;}
.layui-tab-bar{position: absolute; right: 0; top: 0; width: 30px; height: 39px; line-height: 39px; border: 1px solid #e2e2e2; border-radius: 2px; text-align: center; background-color: #fff; cursor: pointer;}
.layui-tab-bar{position: absolute; right: 0; top: 0; z-index: 10; width: 30px; height: 39px; line-height: 39px; border: 1px solid #e2e2e2; border-radius: 2px; text-align: center; background-color: #fff; cursor: pointer;}
.layui-tab-bar .layui-icon{position: relative; display: inline-block; top: 3px; transition: all .3s; -webkit-transition: all .3s;}
.layui-tab-item{display: none;}
.layui-tab-more{padding-right: 30px; height: auto; white-space: normal;}
@@ -420,12 +439,13 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-tab-content{padding: 10px;}
/* Tab关闭 */.layui-tab-title li .layui-tab-close{ position: relative; margin-left: 8px; top: 1px; color: #c2c2c2;}
.layui-tab-title li .layui-tab-close:hover{border-radius: 10px; background-color: #FF5722; color: #fff;}
/* Tab关闭 */.layui-tab-title li .layui-tab-close{ position: relative; margin-left: 8px; top: 1px; color: #c2c2c2; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab-title li .layui-tab-close:hover{border-radius: 2px; background-color: #FF5722; color: #fff;}
/* Tab简洁风格 */.layui-tab-brief > .layui-tab-title .layui-this{color: #009688;}
.layui-tab-brief > .layui-tab-title .layui-this:after
,.layui-tab-brief > .layui-tab-more li.layui-this:after{border: none; border-radius: 0; border-bottom: 3px solid #5FB878;}
.layui-tab-brief[overflow] > .layui-tab-title .layui-this:after{top: -1px;}
/* Tab卡片风格 */.layui-tab-card{border: 1px solid #e2e2e2; border-radius: 2px; box-shadow: 0 2px 5px 0 rgba(0,0,0,.1);}
.layui-tab-card > .layui-tab-title{ background-color: #f2f2f2;}

Binary file not shown.

View File

@@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Mon Feb 20 22:44:05 2017
Created by FontForge 20120731 at Mon Feb 27 22:32:26 2017
By admin
</metadata>
<defs>
@@ -16,7 +16,7 @@ Created by FontForge 20120731 at Mon Feb 20 22:44:05 2017
ascent="896"
descent="-128"
x-height="792"
bbox="0 -212 1487.11 896"
bbox="0 -212 1385 896"
underline-thickness="0"
underline-position="0"
unicode-range="U+0078-E6FC"
@@ -152,8 +152,8 @@ d="M587 671q-10 4 -18 -3l-259 -229h-148q-7 0 -12 -5t-5 -12v-268q0 -7 5 -12t12 -5
q4 0 7 1q10 5 10 16v726q0 11 -10 16v0zM290 171h-115v234h115v-234v0zM748 292q0 -39 -24 -69.5t-61 -40.5h-4q-13 0 -16 12q-2 7 1.5 13t10.5 8q26 7 42.5 28.5t16.5 48.5t-16.5 48.5t-42.5 28.5q-7 2 -10.5 8t-2 12.5t7.5 10t13 2.5q37 -10 61 -40.5t24 -69.5v0zM865 292
q0 -67 -34 -124t-93 -89q-4 -2 -8 -2q-10 0 -14 9q-4 6 -2 12.5t8 9.5q51 28 80 77t29 107q0 57 -29.5 106.5t-79.5 77.5q-6 3 -8 9.5t1 12.5t9.5 8t13.5 -1q59 -32 93 -89t34 -124v0z" />
<glyph glyph-name="xiangxia" unicode="&#xe61a;"
d="M888 705q12 12 28.5 12t28.5 -12v0q12 -11 12 -28t-12 -28l-406 -406q-12 -12 -28.5 -12t-27.5 12v0q-12 12 -12 28.5t12 28.5l405 405v0zM539 300q11 -12 11 -28.5t-11 -28.5v0q-12 -12 -28.5 -12t-28.5 12l-406 406q-11 11 -11 28t11 28v0q12 12 28.5 12t28.5 -12
l406 -405v0zM539 300z" />
d="M888 620q12 12 28.5 12t28.5 -12v0q12 -12 12 -28.5t-12 -28.5l-406 -405q-12 -12 -28.5 -12t-27.5 12v0q-12 11 -12 27.5t12 28.5zM539 214q11 -12 11 -28.5t-11 -27.5v0q-12 -12 -28.5 -12t-28.5 12l-406 405q-11 12 -11 28.5t11 28.5v0q12 12 28.5 12t28.5 -12z
M539 214z" />
<glyph glyph-name="wenjian" unicode="&#xe621;"
d="M887 515v-45v-45v-478q0 -29 -20 -49t-48 -20h-614q-29 0 -48.5 20t-19.5 49v705q0 28 20 48t48 20h387h45h38q14 5 23 -5l183 -183q7 -7 6 -17zM660 447q-10 0 -16.5 7t-6.5 16v205h-45h-364q-19 0 -32.5 -13.5t-13.5 -32.5v-660q0 -18 13.5 -31.5t32.5 -13.5h568
q19 0 32.5 13.5t13.5 31.5v456v22h-182zM683 666v-173h159v14z" />
@@ -161,8 +161,8 @@ q19 0 32.5 13.5t13.5 31.5v456v22h-182zM683 666v-173h159v14z" />
d="M917 -103h-810q-18 0 -30 12t-12 30v698q0 18 12 30t30 12h810q18 0 30 -12t12 -30v-698q0 -18 -12 -30t-30 -12zM316 -61h601v363h-601v-363zM107 -61h167v363h-167v-363zM148.5 637q-17.5 0 -29.5 -12t-12 -29.5t12 -30t29.5 -12.5t30 12.5t12.5 30t-12.5 29.5t-30 12z
M274.5 637q-17.5 0 -29.5 -12t-12 -29.5t12 -30t29.5 -12.5t29.5 12.5t12 30t-12 29.5t-29.5 12zM400.5 637q-17.5 0 -30 -12t-12.5 -29.5t12.5 -30t30 -12.5t29.5 12.5t12 30t-12 29.5t-29.5 12zM875 512h-768v-168h810v168h-42z" />
<glyph glyph-name="duigou" unicode="&#xe618;" horiz-adv-x="1600"
d="M1064 480zM811 263zM0 -31l1 -1q-1 0 -1 1zM423 -32v1h1q0 -1 -1 -1zM1487 465q1 -7 -7 -11q-95 -39 -170.5 -108t-144.5 -165q-70 -99 -123 -216q-5 -11 -8.5 -12t-11.5 7q-59 58 -263 258q-29 29 -38 37q-7 6 -7 10.5t9 8.5q63 29 99 49q17 9 32 -6q32 -31 164 -162
q12 -11 15 -10.5t8 16.5q27 77 96 194q107 179 275 405q0 1 2 4.5t4 5t4.5 0.5t3.5 -3t1 -5.5v-4.5q15 -70 59 -288z" />
d="M0 -31l1 -1q-1 0 -1 1zM423 -32q0 1 1 1q0 -1 -1 -1zM1189 507q0 -7 -8 -10q-95 -40 -170.5 -108.5t-144.5 -165.5q-70 -98 -123 -216q-5 -10 -8.5 -11t-11.5 7q-59 58 -262 258q-30 29 -39 37q-7 6 -7 10.5t10 8.5q62 29 98 48q18 10 33 -5q31 -32 164 -162
q12 -12 14.5 -11t7.5 17q27 77 97 193q107 180 274 406q0 1 2 4.5t4 4.5t4.5 0.5t3.5 -2.5t1 -5.5v-5.5q15 -69 60 -287z" />
<glyph glyph-name="tianjia1" unicode="&#xe608;"
d="M510 -61q-91 0 -173.5 35.5t-142.5 95t-95.5 142.5t-35.5 174t35.5 173.5t95.5 142.5t142.5 95.5t173.5 35.5t173.5 -35.5t142.5 -95.5t95.5 -142.5t35.5 -173.5t-35.5 -174t-95.5 -142.5t-142.5 -95t-173.5 -35.5v0zM510 812q-116 0 -214 -57t-155.5 -155t-57.5 -214
t57.5 -214.5t155.5 -155.5t214 -57t214 57t155.5 155.5t57.5 214.5t-57.5 214t-155.5 155t-214 57v0zM528 153h-36v215h-214v36h214v214h36v-214h214v-36h-214v-215v0zM528 153z" />

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -2,7 +2,7 @@
@Namelayui.code 代码修饰器
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Namelayui.element 常用元素操作
@Author贤心
@LicenseLGPL
@LicenseMIT
*/
@@ -33,27 +33,34 @@ layui.define('jquery', function(exports){
//外部Tab新增
Element.prototype.tabAdd = function(filter, options){
var tabElem = $('.layui-tab[lay-filter='+ filter +']')
,titElem = tabElem.children('.layui-tab-title')
var TITLE = '.layui-tab-title'
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
,titElem = tabElem.children(TITLE)
,contElem = tabElem.children('.layui-tab-content');
titElem.append('<li>'+ (options.title||'unnaming') +'</li>');
titElem.append('<li lay-id="'+ (options.id||'') +'">'+ (options.title||'unnaming') +'</li>');
contElem.append('<div class="layui-tab-item">'+ (options.content||'') +'</div>');
return call.tabAuto(), this;
call.hideTabMore(true);
call.tabAuto();
return this;
};
//外部Tab删除
Element.prototype.tabDelete = function(filter, index){
var tabElem = $('.layui-tab[lay-filter='+ filter +']')
,liElem = tabElem.children('.layui-tab-title').find('>li').eq(index);
Element.prototype.tabDelete = function(filter, layid){
var TITLE = '.layui-tab-title'
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
,titElem = tabElem.children(TITLE)
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
call.tabDelete(null, liElem);
return this;
};
//外部Tab切换
Element.prototype.tabChange = function(filter, index){
var tabElem = $('.layui-tab[lay-filter='+ filter +']')
,liElem = tabElem.children('.layui-tab-title').find('>li').eq(index);
call.tabClick(null, index, liElem);
Element.prototype.tabChange = function(filter, layid){
var TITLE = '.layui-tab-title'
,tabElem = $('.layui-tab[lay-filter='+ filter +']')
,titElem = tabElem.children(TITLE)
,liElem = titElem.find('>li[lay-id="'+ layid +'"]');
call.tabClick(null, null, liElem);
return this;
};
@@ -78,7 +85,7 @@ layui.define('jquery', function(exports){
tabClick: function(e, index, liElem){
var othis = liElem || $(this)
,index = index || othis.index()
,parents = othis.parents('.layui-tab')
,parents = othis.parents('.layui-tab').eq(0)
,item = parents.children('.layui-tab-content').children('.layui-tab-item')
,filter = parents.attr('lay-filter');
@@ -94,7 +101,7 @@ layui.define('jquery', function(exports){
//Tab删除
,tabDelete: function(e, othis){
var li = othis || $(this).parent(), index = li.index();
var parents = li.parents('.layui-tab');
var parents = li.parents('.layui-tab').eq(0);
var item = parents.children('.layui-tab-content').children('.layui-tab-item')
if(li.hasClass(THIS)){
@@ -107,12 +114,15 @@ layui.define('jquery', function(exports){
li.remove();
item.eq(index).remove();
setTimeout(function(){
call.tabAuto();
}, 50);
}
//Tab自适应
,tabAuto: function(){
var SCROLL = 'layui-tab-scroll', MORE = 'layui-tab-more', BAR = 'layui-tab-bar'
, CLOSE = 'layui-tab-close', that = this;
,CLOSE = 'layui-tab-close', that = this;
$('.layui-tab').each(function(){
var othis = $(this)
@@ -125,6 +135,10 @@ layui.define('jquery', function(exports){
call.hideTabMore(true)
}
if(!title[0]){
title = othis.children('.'+OVER).children('.layui-tab-title');
}
//允许关闭
if(othis.attr('lay-allowClose')){
title.find('li').each(function(){
@@ -141,12 +155,14 @@ layui.define('jquery', function(exports){
if(title.prop('scrollWidth') > title.outerWidth()+1){
if(title.find('.'+BAR)[0]) return;
title.append(span);
othis.attr('overflow', '');
span.on('click', function(e){
title[this.title ? 'removeClass' : 'addClass'](MORE);
this.title = this.title ? '' : '收缩';
});
} else {
title.find('.'+BAR).remove();
othis.removeAttr('overflow');
}
});
}
@@ -158,6 +174,7 @@ layui.define('jquery', function(exports){
tsbTitle.find('.layui-tab-bar').attr('title','');
}
}
//点击选中
,clickThis: function(){
var othis = $(this), parents = othis.parents(NAV_ELEM)
@@ -185,6 +202,29 @@ layui.define('jquery', function(exports){
parent[child.css('display') === 'none' ? 'addClass': 'removeClass'](NAV_ITEM+'ed');
}
}
//折叠面板
,collapse: function(){
var othis = $(this), icon = othis.find('.layui-colla-icon')
,elemCont = othis.siblings('.layui-colla-content')
,parents = othis.parents('.layui-collapse').eq(0)
,filter = parents.attr('lay-filter')
,display = elemCont.css('display') === 'none';
//是否手风琴
if(typeof parents.attr('lay-accordion') === 'string'){
var show = parents.children('.layui-colla-item').children('.'+SHOW);
show.siblings('.layui-colla-title').children('.layui-colla-icon').html('&#xe602;');
show.removeClass(SHOW);
}
elemCont[display ? 'addClass' : 'removeClass'](SHOW);
icon.html(display ? '&#xe61a;' : '&#xe602;');
layui.event.call(this, MOD_NAME, 'collapse('+ filter +')', {
title: othis
,content: elemCont
,show: display
});
}
};
//初始化元素操作
@@ -320,6 +360,28 @@ layui.define('jquery', function(exports){
}
});
}
//折叠面板
,collapse: function(){
var ELEM = 'layui-collapse';
$('.'+ELEM).each(function(){
var elemItem = $(this).find('.layui-colla-item')
elemItem.each(function(){
var othis = $(this)
,elemTitle = othis.find('.layui-colla-title')
,elemCont = othis.find('.layui-colla-content');
//初始状态
elemTitle.find('.layui-colla-icon').remove();
elemTitle.append('<i class="layui-icon layui-colla-icon">'+ (elemCont.css('display') === 'none' ? '&#xe602;' : '&#xe61a;') +'</i>');
//点击标题
elemTitle.off('click', call.collapse).on('click', call.collapse);
});
});
}
};
return layui.each(items, function(index, item){

View File

@@ -2,7 +2,7 @@
@Namelayui.flow 流加载
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -14,7 +14,7 @@ layui.define('layer', function(exports){
,hint = layui.hint()
,device = layui.device()
,MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this', SHOW = 'layui-show', DISABLED = 'layui-disabled'
,MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled'
,Form = function(){
this.config = {
@@ -73,9 +73,11 @@ layui.define('layer', function(exports){
//表单控件渲染
Form.prototype.render = function(type){
var that = this, items = {
//下拉选择框
select: function(){
var TIPS = '请选择', CLASS = 'layui-form-select', TITLE = 'layui-select-title'
,NONE = 'layui-select-none', initValue = ''
,selects = $(ELEM).find('select'), hide = function(e, clear){
if(!$(e.target).parent().hasClass(TITLE) || clear){
@@ -83,31 +85,99 @@ layui.define('layer', function(exports){
}
}
,events = function(reElem, disabled){
var select = $(this), title = reElem.find('.' + TITLE);
,events = function(reElem, disabled, isSearch){
var select = $(this)
,title = reElem.find('.' + TITLE)
,input = title.find('input')
,dl = reElem.find('dl')
,dds = dl.children('dd')
if(disabled) return;
//展开下拉
var showDown = function(){
reElem.addClass(CLASS+'ed');
initValue = input.val();
dds.removeClass(HIDE);
}, hideDown = function(){
reElem.removeClass(CLASS+'ed');
input.blur();
};
//点击标题区域
title.on('click', function(e){
reElem.hasClass(CLASS+'ed') ? reElem.removeClass(CLASS+'ed') : (
reElem.hasClass(CLASS+'ed') ? (
hideDown()
) : (
hide(e, true),
reElem.addClass(CLASS+'ed')
showDown()
);
dl.find('.'+NONE).remove();
});
//点击箭头获取焦点
title.find('.layui-edge').on('click', function(){
input.focus();
});
//键盘事件
input.on('keyup', function(e){
var keyCode = e.keyCode;
//Tab键
if(keyCode === 9){
showDown();
}
}).on('keydown', function(e){
var keyCode = e.keyCode;
//Tab键
if(keyCode === 9){
hideDown();
} else if(keyCode === 13){ //回车键
e.preventDefault();
}
});
//搜索匹配
if(isSearch){
var search = function(e){
var value = this.value, num = 0, keyCode = e.keyCode;
if(keyCode === 9 || keyCode === 13 || keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40){
return false;
}
layui.each(dds, function(){
var othis = $(this), not = othis.text().indexOf(value) === -1;
if(not) num++;
othis[not ? 'addClass' : 'removeClass'](HIDE);
});
if(num === dds.length){
dl.find('.'+NONE)[0] || dl.append('<p class="'+ NONE +'">无匹配项</p>');
} else {
dl.find('.'+NONE).remove();
}
};
input.on('keyup', search).on('blur', function(){
input.val(initValue);
});
}
//选择
reElem.find('dl>dd').on('click', function(){
dds.on('click', function(){
var othis = $(this), value = othis.attr('lay-value');
var filter = select.attr('lay-filter'); //获取过滤器
if(othis.hasClass(DISABLED)) return false;
select.val(value).removeClass('layui-form-danger'), title.find('input').val(othis.text());
select.val(value).removeClass('layui-form-danger'), input.val(othis.text());
othis.addClass(THIS).siblings().removeClass(THIS);
layui.event(MOD_NAME, 'select('+ filter +')', {
layui.event.call(this, MOD_NAME, 'select('+ filter +')', {
elem: select[0]
,value: value
,othis: reElem
});
});
@@ -116,16 +186,20 @@ layui.define('layer', function(exports){
});
//关闭下拉
$(document).off('click', hide).on('click', hide)
$(document).off('click', hide).on('click', hide);
}
selects.each(function(index, select){
var othis = $(this), hasRender = othis.next('.'+CLASS), disabled = this.disabled;
var value = select.value, selected = $(select.options[select.selectedIndex]); //获取当前选中项
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
var isSearch = typeof othis.attr('lay-search') === 'string';
//替代元素
var reElem = $(['<div class="layui-unselect '+ CLASS + (disabled ? ' layui-select-disabled' : '') +'">'
,'<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'+ (disabled ? (' '+DISABLED) : '') +'">'
,'<div class="'+ TITLE +'"><input type="text" placeholder="'+ (select.options[0].innerHTML ? select.options[0].innerHTML : TIPS) +'" value="'+ (value ? selected.html() : '') +'" '+ (isSearch ? '' : 'readonly') +' class="layui-input layui-unselect'+ (disabled ? (' '+DISABLED) : '') +'">'
,'<i class="layui-edge"></i></div>'
,'<dl class="layui-anim layui-anim-upbit'+ (othis.find('optgroup')[0] ? ' layui-select-group' : '') +'">'+ function(options){
var arr = [];
@@ -143,7 +217,7 @@ layui.define('layer', function(exports){
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender
othis.after(reElem);
events.call(this, reElem, disabled);
events.call(this, reElem, disabled, isSearch);
});
}
//复选框/开关
@@ -159,36 +233,42 @@ layui.define('layer', function(exports){
//勾选
reElem.on('click', function(){
var filter = check.attr('lay-filter'); //获取过滤器
var filter = check.attr('lay-filter') //获取过滤器
,text = (check.attr('lay-text')||'').split('|');
if(check[0].disabled) return;
check[0].checked ? (
check[0].checked = false
,reElem.removeClass(RE_CLASS[1])
,reElem.removeClass(RE_CLASS[1]).find('em').text(text[1])
) : (
check[0].checked = true
,reElem.addClass(RE_CLASS[1])
,reElem.addClass(RE_CLASS[1]).find('em').text(text[0])
);
layui.event(MOD_NAME, RE_CLASS[2]+'('+ filter +')', {
layui.event.call(check[0], MOD_NAME, RE_CLASS[2]+'('+ filter +')', {
elem: check[0]
,value: check[0].value
,othis: reElem
});
});
}
checks.each(function(index, check){
var othis = $(this), skin = othis.attr('lay-skin'), disabled = this.disabled;
var othis = $(this), skin = othis.attr('lay-skin')
,text = (othis.attr('lay-text')||'').split('|'), disabled = this.disabled;
if(skin === 'switch') skin = '_'+skin;
var RE_CLASS = CLASS[skin] || CLASS.checkbox;
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
//替代元素
var hasRender = othis.next('.' + RE_CLASS[0]);
var reElem = $(['<div class="layui-unselect '+ RE_CLASS[0] + (
check.checked ? (' '+RE_CLASS[1]) : '') + (disabled ? ' layui-checkbox-disbaled '+DISABLED : '') +'">'
check.checked ? (' '+RE_CLASS[1]) : '') + (disabled ? ' layui-checkbox-disbaled '+DISABLED : '') +'" lay-skin="'+ (skin||'') +'">'
,{
_switch: '<i></i>'
}[skin] || ('<span>'+ (check.title || '勾选') +'</span><i class="layui-icon">&#xe618;</i>')
_switch: '<em>'+ ((check.checked ? text[0] : text[1])||'') +'</em><i></i>'
}[skin] || ('<span>'+ (check.title || '勾选') +'</span><i class="layui-icon">'+ (skin ? '&#xe605;' : '&#xe618;') +'</i>')
,'</div>'].join(''));
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender
@@ -222,9 +302,10 @@ layui.define('layer', function(exports){
reElem.addClass(CLASS+'ed');
reElem.find('.layui-icon').addClass(ANIM).html(ICON[0]);
layui.event(MOD_NAME, 'radio('+ filter +')', {
layui.event.call(radio[0], MOD_NAME, 'radio('+ filter +')', {
elem: radio[0]
,value: radio[0].value
,othis: reElem
});
});
};
@@ -232,6 +313,8 @@ layui.define('layer', function(exports){
radios.each(function(index, radio){
var othis = $(this), hasRender = othis.next('.' + CLASS), disabled = this.disabled;
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
//替代元素
var reElem = $(['<div class="layui-unselect '+ CLASS + (radio.checked ? (' '+CLASS+'ed') : '') + (disabled ? ' layui-radio-disbaled '+DISABLED : '') +'">'
,'<i class="layui-anim layui-icon">'+ ICON[radio.checked ? 0 : 1] +'</i>'

View File

@@ -2,7 +2,7 @@
@Namelayui.layedit 富文本编辑器
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Name : layui.laypage 分页组件
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Name : layui.laytpl 模板引擎
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -3,7 +3,7 @@
@Namelayer mobile v2.0 弹层组件移动版
@Author贤心
@Sitehttp://layer.layui.com/mobie/
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Title: layui.upload 单文件上传 - 全浏览器兼容版
@Author: 贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Namelayui.tree 树组件
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Title: layui.upload 单文件上传 - 全浏览器兼容版
@Author: 贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -2,7 +2,7 @@
@Namelayui.util 工具集
@Author贤心
@LicenseLGPL
@LicenseMIT
*/

View File

@@ -13,7 +13,7 @@
"use strict";
var Lay = function(){
this.v = '1.0.8'; //版本号
this.v = '1.0.9'; //版本号
};
Lay.fn = Lay.prototype;
@@ -44,11 +44,11 @@ modules = {
,form: 'modules/form' //表单集
,upload: 'modules/upload' //上传
,tree: 'modules/tree' //树结构
,slide: 'modules/slide' //轮播/滚动
,table: 'modules/table' //富表格
,element: 'modules/element' //常用元素操作
,util: 'modules/util' //工具块
,flow: 'modules/flow' //流加载
,carousel: 'modules/carousel' //轮播
,code: 'modules/code' //代码修饰器
,jquery: 'modules/jquery' //DOM库第三方