This commit is contained in:
sentsin 2018-05-08 15:51:37 +08:00
parent c9f80d74fc
commit 2a7344864b
13 changed files with 180 additions and 178 deletions

View File

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

View File

@ -18,48 +18,6 @@ body{padding: 10px;}
</head>
<body>
<form class="layui-form layui-form-pane1" action="" lay-filter="first">
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="xxx" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="arr[]" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="arr[]" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="bbb[]" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="bbb[]" autocomplete="off" class="layui-input">
</div>
</div>
<input type="checkbox" name="like1[]" lay-skin="primary" title="写作">
<input type="checkbox" name="like1[]" lay-skin="primary" title="写作">
<input type="checkbox" name="like1[]" lay-skin="primary" title="写作">
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<form class="layui-form layui-form-pane1" action="" lay-filter="first">
<div class="layui-form-item">
<label class="layui-form-label">输入框</label>
@ -142,14 +100,14 @@ body{padding: 10px;}
<div class="layui-form-item">
<label class="layui-form-label">搜索选择框</label>
<div class="layui-input-inline">
<select name="interest-search" lay-filter="interest-search" lay-search lay-write>
<select name="interest-search" lay-filter="interest-search" lay-search>
<option value=""></option>
<option value="0">写作</option>
<option value="1">阅读</option>
<option value="2">游戏</option>
<option value="3">音乐</option>
<option value="4">旅行</option>
<option value="5">读书</option>
<option value="写作">写作</option>
<option value="阅读" disabled>阅读</option>
<option value="游戏" disabled>游戏</option>
<option value="音乐">音乐</option>
<option value="旅行">旅行</option>
<option value="读书">读书</option>
</select>
</div>
</div>
@ -173,13 +131,14 @@ body{padding: 10px;}
<div class="layui-form-item" pane>
<label class="layui-form-label">开关关</label>
<div class="layui-input-block">
<input type="checkbox" name="close" lay-skin="switch" title="开关" disabled>
<input type="checkbox" name="close" lay-skin="switch" title="开关">
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">开关开</label>
<div class="layui-input-block">
<input type="checkbox" checked name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
<input type="checkbox" name="open2" lay-skin="switch" lay-filter="switchTest" lay-text="已绑定|绑定">
</div>
</div>
<div class="layui-form-item" pane>
@ -232,20 +191,20 @@ layui.use('form', function(){
}
,pass: [/(.+){6,12}$/, '密码必须6到12位']
});
form.val('first',{
'xxx': '猪猪猪'
,'title': '测试'
,'phone': 18829264233
,'email': 2321582517
//初始赋值
form.val('first', {
'title': '测试'
,'phone': 11111111111
,'email': 'xu@sentsin.com'
,'password': 123123
,'quiz': 2
,'interest': 3
,'like[write]': true
,'open': false
//,'open': false
,'sex': '男'
,'desc': '一二三四一二三四'
})
,'desc': 'form 是我们非常看重的一块'
});
//事件监听
@ -278,6 +237,7 @@ layui.use('form', function(){
//监听提交
form.on('submit(*)', function(data){
console.log(data)
alert(JSON.stringify(data.field));
return false;
});

View File

@ -104,13 +104,13 @@ layui.use(['rate'], function(){
,half: true
,theme: '#FF5722'
})
//只读
rate.render({
elem: '#test4'
,length: 8
,value: 4.8
,reader: true
,theme: '#01AAED'
,value: 3.5
,half: true
,readonly: true
})
});
</script>

View File

@ -1,7 +1,7 @@
{
"name": "layui-src",
"realname": "layui",
"version": "2.2.6",
"version": "2.3.0-rc1",
"independents": {
"layim": "3.7.6"
},

View File

@ -46,11 +46,11 @@ a cite{font-style: normal; *cursor:pointer;}
/** 图标字体 **/
@font-face {font-family: 'layui-icon';
src: url('../font/iconfont.eot?v=230');
src: url('../font/iconfont.eot?v=230#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=230#iconfont') format('svg'),
url('../font/iconfont.woff?v=230') format('woff'),
url('../font/iconfont.ttf?v=230') format('truetype');
src: url('../font/iconfont.eot?v=230-rc1');
src: url('../font/iconfont.eot?v=230-rc1#iefix') format('embedded-opentype'),
url('../font/iconfont.svg?v=230-rc1#iconfont') format('svg'),
url('../font/iconfont.woff?v=230-rc1') format('woff'),
url('../font/iconfont.ttf?v=230-rc1') format('truetype');
}
.layui-icon{
@ -100,7 +100,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-file:before{content:"\e621"}
.layui-icon-layouts:before{content:"\e632"}
.layui-icon-rate-half:before{content:"\e6c9"}
.layui-icon-layim-add:before{content:"\e608"}
.layui-icon-add-circle-fine:before{content:"\e608"}
.layui-icon-prev-circle:before{content:"\e633"}
.layui-icon-read:before{content:"\e705"}
.layui-icon-404:before{content:"\e61c"}
@ -141,7 +141,6 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-align-center:before{content:"\e647"}
.layui-icon-align-right:before{content:"\e648"}
.layui-icon-align-left:before{content:"\e649"}
.layui-icon-refresh-2:before{content:"\1002"}
.layui-icon-loading-1:before{content:"\e63e"}
.layui-icon-return:before{content:"\e65c"}
.layui-icon-fonts-strong:before{content:"\e62b"}
@ -204,11 +203,11 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-star-fill:before{content:"\e658"}
.layui-icon-rate:before{content:"\e67b"}
.layui-icon-template-1:before{content:"\e656"}
.layui-icon-loading-2:before{content:"\e66d"}
.layui-icon-vercode:before{content:"\e679"}
.layui-icon-cellphone:before{content:"\e678"}
/* 基本布局 */
.layui-main{position: relative; width: 1140px; margin: 0 auto;}
.layui-header{position: relative; z-index: 1000; height: 60px;}
@ -609,13 +608,13 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
.layui-select-disabled .layui-disabled{border-color: #eee !important;}
.layui-select-disabled .layui-edge{border-top-color: #d2d2d2}
/* 复选框 */.layui-form-checkbox{position: relative; display: inline-block; vertical-align: middle; height: 30px; line-height: 28px; margin-right: 10px; padding-right: 30px; border: 1px solid #d2d2d2; background-color: #fff; cursor: pointer; font-size: 0; border-radius: 2px; -webkit-transition: .1s linear; transition: .1s linear; box-sizing: border-box;}
.layui-form-checkbox:hover{border: 1px solid #c2c2c2;}
/* 复选框 */.layui-form-checkbox{position: relative; display: inline-block; vertical-align: middle; height: 30px; line-height: 30px; margin-right: 10px; padding-right: 30px; background-color: #fff; cursor: pointer; font-size: 0; -webkit-transition: .1s linear; transition: .1s linear; box-sizing: border-box;}
.layui-form-checkbox:hover{}
.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 span{padding: 0 10px; height: 100%; font-size: 14px; border-radius: 2px 0 0 2px; 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: 30px; color: #fff; font-size: 20px; text-align: center;}
.layui-form-checkbox:hover i{color: #c2c2c2;}
.layui-form-checkbox i{position: absolute; right: 0; top: 0; width: 30px; height: 28px; border: 1px solid #d2d2d2; border-left: none; border-radius: 0 2px 2px 0; color: #fff; font-size: 20px; text-align: center;}
.layui-form-checkbox:hover i{border-color: #c2c2c2; color: #c2c2c2;}
.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;}
@ -630,15 +629,16 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
.layui-checkbox-disbaled[lay-skin="primary"]:hover i{border-color: #d2d2d2;}
.layui-form-item .layui-form-checkbox[lay-skin="primary"]{margin-top: 10px;}
/* 复选框-开关风格 */.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{position: relative; display: inline-block; vertical-align: middle; height: 22px; line-height: 22px; min-width: 35px; 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-switch em{position: relative; top: 0; width: 25px; margin-left: 21px; 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 i{left: 32px; background-color: #fff;}
.layui-form-onswitch em{left: 5px; right: auto; color: #fff!important;}
.layui-form-onswitch i{left: 100%; margin-left: -21px; background-color: #fff;}
.layui-form-onswitch em{margin-left: 5px; margin-right: 21px; color: #fff!important;}
.layui-checkbox-disbaled{border-color: #e2e2e2 !important;}
.layui-checkbox-disbaled span{background-color: #e2e2e2 !important;}
.layui-checkbox-disbaled i{border-color: #e2e2e2 !important;}
.layui-checkbox-disbaled:hover i{color: #fff !important;}
/* 单选框 */
@ -882,15 +882,14 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-upload-wrap{position: relative; display: inline-block; vertical-align: middle;}
.layui-upload-wrap .layui-upload-file{display: block!important; position: absolute; left: 0; top: 0; z-index: 10; font-size: 100px; width: 100%; height: 100%; opacity: .01; filter: Alpha(opacity=1); cursor: pointer;}
/** 评分组件 **/
.layui-icon-rate,
.layui-icon-rate-solid,
.layui-icon-rate-half{ font-size: 20px; color: #FFB800;}
/** 评分组件 By star1029 **/
.layui-rate,
.layui-rate *{display: inline-block; vertical-align: middle;}
.layui-rate{list-style: none; padding: 10px 5px 10px 0; font-size: 0;}
.layui-rate li i{margin-right: 5px; transition: all .3s; -webkit-transition: all .3s;}
.layui-rate li i.layui-icon{ font-size: 20px; color: #FFB800;}
.layui-rate li i.layui-icon{margin-right: 5px; transition: all .3s; -webkit-transition: all .3s;}
.layui-rate li i:hover{cursor: pointer; transform: scale(1.12); -webkit-transform: scale(1.12);}
.layui-rate[readonly] li i:hover{cursor: default; transform: scale(1);}
/** 代码修饰器 **/
.layui-code{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border: 1px solid #ddd; border-left-width: 6px; background-color: #F2F2F2; color: #333; font-family: Courier New; font-size: 12px;}

Binary file not shown.

View File

@ -141,7 +141,7 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="rate-half" unicode="&#59081;" d="M1012.064 504l-359.552 31.008-140.512 331.04-140.512-331.552-359.552-30.496 273.024-236.544-82.016-351.552 309.056 186.528 309.056-186.528-81.504 351.552 272.544 236.544zM512 195.96799999999996l0 465.056 85.504-202.016 219.04-19.008-166.016-144.032 50.016-214.016-188.512 114.016z" horiz-adv-x="1024" />
<glyph glyph-name="layim-add" unicode="&#58888;" d="M509.989715-60.972421000000054c-246.734474 0-446.75195 200.023616-446.75195 446.75809 0 246.732427 200.017476 446.75195 446.75195 446.75195 246.733451 0 446.757067-200.019523 446.757067-446.75195C956.746782 139.051195 756.723166-60.972421000000054 509.989715-60.972421000000054L509.989715-60.972421000000054zM509.989715 812.433746c-235.633648 0-426.650123-191.014428-426.650123-426.648077 0-235.639788 191.016475-426.654216 426.650123-426.654216 235.638765 0 426.654216 191.014428 426.654216 426.654216C936.643931 621.419318 745.62848 812.433746 509.989715 812.433746L509.989715 812.433746zM527.863804 153.46957999999995l-35.741016 0L492.122789 367.909533 277.678742 367.909533 277.678742 403.653619l214.443024 0L492.121765 618.0956189999999l35.741016 0L527.862781 403.653619l214.442 0 0-35.744086L527.863804 367.909533 527.863804 153.46957999999995 527.863804 153.46957999999995zM527.863804 153.46957999999995" horiz-adv-x="1024" />
<glyph glyph-name="add-circle-fine" unicode="&#58888;" d="M509.989715-60.972421000000054c-246.734474 0-446.75195 200.023616-446.75195 446.75809 0 246.732427 200.017476 446.75195 446.75195 446.75195 246.733451 0 446.757067-200.019523 446.757067-446.75195C956.746782 139.051195 756.723166-60.972421000000054 509.989715-60.972421000000054L509.989715-60.972421000000054zM509.989715 812.433746c-235.633648 0-426.650123-191.014428-426.650123-426.648077 0-235.639788 191.016475-426.654216 426.650123-426.654216 235.638765 0 426.654216 191.014428 426.654216 426.654216C936.643931 621.419318 745.62848 812.433746 509.989715 812.433746L509.989715 812.433746zM527.863804 153.46957999999995l-35.741016 0L492.122789 367.909533 277.678742 367.909533 277.678742 403.653619l214.443024 0L492.121765 618.0956189999999l35.741016 0L527.862781 403.653619l214.442 0 0-35.744086L527.863804 367.909533 527.863804 153.46957999999995 527.863804 153.46957999999995zM527.863804 153.46957999999995" horiz-adv-x="1024" />
<glyph glyph-name="prev-circle" unicode="&#58931;" d="M508.638018 827.97307c-246.403458 0-446.845649-200.463469-446.845649-446.845649 0-246.382179 200.442191-446.845649 446.845649-446.845649 246.382179 0 446.845649 200.463469 446.845649 446.845649C955.483667 627.5096 755.041476 827.97307 508.638018 827.97307zM508.638018-23.16149900000005c-222.933422 0-404.28892 181.355498-404.28892 404.28892 0 222.933422 181.355498 404.28892 404.28892 404.28892 222.912144 0 404.28892-181.355498 404.28892-404.28892C912.926939 158.19399899999996 731.57144-23.16149900000005 508.638018-23.16149900000005zM252.87208 485.1999c8.639016 26.129831-32.470784 37.215859-41.067243 11.32009-27.810822-83.730363-22.321004-168.545923 14.086277-248.573851 11.362646-24.938243 48.025268-3.298146 36.747735 21.491148C230.976644 339.081373 228.806251 412.853462 252.87208 485.1999zM599.262572 247.73335499999996l-127.627629 133.394065 127.47868 133.223838c9.043305 9.064583 9.022026 23.789211-0.021278 32.832516-8.809243 8.830521-24.087108 8.766686-32.832516 0l-148.310199-148.310199c-4.617405-4.638683-6.979303-11.064749-6.553736-17.746156-0.404289-6.702685 1.936331-13.107472 6.575015-17.788712l148.310199-148.28892c4.383343-4.383343 10.213615-6.787798 16.405619-6.787798 6.170726 0 12.000997 2.404455 16.405619 6.787798C608.156928 224.114371 608.156928 238.83899899999994 599.262572 247.73335499999996z" horiz-adv-x="1024" />
@ -264,9 +264,6 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="align-left" unicode="&#58953;" d="M992 448L32 448C14.336 448 0 462.336 0 480 0 497.664 14.336 512 32 512L992 512C1009.664 512 1024 497.664 1024 480 1024 462.336 1009.664 448 992 448ZM32 704L736 704C753.68 704 768 689.664 768 672 768 654.336 753.68 640 736 640L32 640C14.336 640 0 654.336 0 672 0 689.664 14.336 704 32 704ZM992 832L32 832C14.336 832 0 846.336 0 864 0 881.664 14.336 896 32 896L992 896C1009.664 896 1024 881.664 1024 864 1024 846.336 1009.664 832 992 832ZM32 320L736 320C753.68 320 768 305.664 768 288 768 270.336 753.68 256 736 256L32 256C14.336 256 0 270.336 0 288 0 305.664 14.336 320 32 320ZM32 128L992 128C1009.664 128 1024 113.66399999999999 1024 96 1024 78.33600000000001 1009.664 64 992 64L32 64C14.336 64 0 78.33600000000001 0 96 0 113.66399999999999 14.336 128 32 128ZM32-64L736-64C753.68-64 768-78.33600000000001 768-96 768-113.66399999999999 753.68-128 736-128L32-128C14.336-128 0-113.66399999999999 0-96 0-78.33600000000001 14.336-64 32-64Z" horiz-adv-x="1024" />
<glyph glyph-name="refresh-2" unicode="&#4098;" d="M959.361841 450.833151C945.035554 547.232688 900.93515 634.716158 831.825143 703.825143S675.232688 817.036577 578.833151 831.360817c-46.37419 6.890944-93.349061 6.578836-139.621944-0.928139-46.87254-7.605212-91.967598-22.429849-134.035716-44.065612-10.051937-5.169743-14.010085-17.508769-8.840342-27.560706 5.169743-10.050913 17.507746-14.010085 27.560706-8.840342 159.536506 82.048691 352.025519 51.874461 478.985072-75.085092 97.435123-97.435123 137.857764-233.466286 114.305349-363.578646-19.110243 32.767288-43.977607 56.613392-86.173638 88.125083-8.604982 6.426363-29.939893 15.565511-33.278941-5.265934-1.428535-8.912997 37.864376-56.437383 55.593156-105.641015 20.941961-58.125839 14.232143-73.696466 22.733771-105.740276 0.211824-1.131777 0.520863-2.241041 0.918929-3.320629 0 0 0 0 0 0 5.590322-19.382443 25.494651-16.813944 32.499182-8.475022 0.01228 0.014326 0.025583 0.032746 0.037862 0.047072 1.941212 1.670036 3.608178 3.725858 4.851495 6.14393 21.635763 42.067095 36.4604 87.163175 44.065612 134.035716C965.940676 357.483066 966.251761 404.458961 959.361841 450.833151zM700.103122 18.03193399999998c-159.536506-82.047668-352.026542-51.873438-478.985072 75.085092C123.725906 190.50917100000004 83.295078 326.461539 106.779955 456.519664c19.360953-34.474163 44.457538-58.845223 88.044242-91.39557 8.604982-6.426363 29.939893-15.565511 33.278941 5.265934 1.428535 8.912997-37.864376 56.437383-55.593156 105.641015-21.653159 60.09775-13.744026 74.702376-23.652699 109.060905-1.339508 4.64581-3.50687 8.018627-6.116301 10.365068-1.559519 1.661849-3.405563 3.104711-5.548366 4.206812-10.050913 5.169743-22.390963 1.211595-27.559683-8.839319-21.63474-42.067095-36.461423-87.163175-44.065612-134.035716-7.506974-46.27186-7.819083-93.246731-0.927115-139.620921 14.325263-96.399537 58.425667-183.884031 127.535675-252.993015 69.108984-69.108984 156.592454-113.210411 252.993015-127.535675 46.373167-6.890944 93.349061-6.579859 139.620921 0.928139 46.87254 7.605212 91.968621 22.430872 134.035716 44.065612 10.051937 5.16872 14.010085 17.508769 8.840342 27.559683C722.495108 19.24864500000001 710.154036 23.201677000000018 700.103122 18.03193399999998z" horiz-adv-x="1024" />
<glyph glyph-name="loading-1" unicode="&#58942;" d="M537.574469 831.696462c-14.123672 0-25.574469-11.447726-25.574469-25.574469 0-14.123672 11.450796-25.574469 25.574469-25.574469 204.495464 0 370.82877-166.358889 370.82877-370.82877 0-14.123672 11.450796-25.574469 25.574469-25.574469 14.123672 0 25.574469 11.450796 25.574469 25.574469C959.551152 642.385838 770.241552 831.696462 537.574469 831.696462z" horiz-adv-x="1024" />
@ -453,9 +450,6 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="template-1" unicode="&#58966;" d="M512 384zM43.52 601.6l409.6-176.64c58.88-30.72 110.08 0 110.08 0l414.72 174.08 2.56 2.56c10.24 5.12 15.36 15.36 15.36 28.16 0 15.36-10.24 28.16-23.04 30.72L563.2 837.12c-56.32 23.04-97.28 0-97.28 0L46.08 660.48c-12.8-5.12-20.48-17.92-20.48-30.72s7.68-23.04 17.92-28.16z m0 0M512 222.72000000000003c-2.56 0-7.68 0-10.24 2.56l-486.4 215.04c-12.8 5.12-17.92 20.48-12.8 33.28 5.12 12.8 20.48 17.92 33.28 12.8L512 276.48 988.16 486.4c12.8 5.12 28.16 0 33.28-12.8 5.12-12.8 0-28.16-12.8-33.28l-486.4-215.04c-2.56-2.56-7.68-2.56-10.24-2.56zM512 71.67999999999995c-2.56 0-7.68 0-10.24 2.56l-486.4 215.04c-12.8 5.12-17.92 20.48-12.8 33.28 5.12 10.24 20.48 17.92 33.28 10.24L512 125.44000000000005 988.16 332.79999999999995c12.8 5.12 28.16 0 33.28-12.8 5.12-12.8 0-28.16-12.8-33.28l-486.4-215.04H512zM512-79.36000000000001c-2.56 0-7.68 0-10.24 2.56l-486.4 215.04c-12.8 5.12-17.92 20.48-12.8 33.28 5.12 12.8 20.48 17.92 33.28 12.8L512-25.600000000000023l476.16 209.92c12.8 5.12 28.16 0 33.28-12.8 5.12-12.8 0-28.16-12.8-33.28l-486.4-215.04c-2.56-2.56-7.68-2.56-10.24-2.56z" horiz-adv-x="1024" />
<glyph glyph-name="loading-2" unicode="&#58989;" d="M211.2 614.4c-115.2-153.6-102.4-364.8 32-505.6 140.8-140.8 352-147.2 505.6-32l70.4-70.4c-192-153.6-467.2-140.8-640 38.4-172.8 172.8-185.6 454.4-38.4 640l70.4-70.4zM896 83.20000000000005l-70.4 70.4c115.2 153.6 102.4 364.8-32 505.6-140.8 140.8-352 147.2-505.6 32L217.6 761.6c192 153.6 467.2 140.8 640-38.4 179.2-172.8 192-448 38.4-640z" horiz-adv-x="1024" />
<glyph glyph-name="vercode" unicode="&#59001;" d="M513.807059-128C351.171765-128 58.428235 126.19294100000002 54.211765 376.16941199999997V662.287059a93.364706 93.364706 0 0 0 81.317647 88.545882 570.428235 570.428235 0 0 1 163.237647 40.357647A393.336471 393.336471 0 0 1 446.945882 872.508235a101.797647 101.797647 0 0 0 120.470589 5.421177A629.458824 629.458824 0 0 1 716.8 792.395294a1255.303529 1255.303529 0 0 1 169.863529-38.550588 98.785882 98.785882 0 0 0 79.510589-90.955294 2911.171765 2911.171765 0 0 0-3.011765-291.538824C924.611765 49.09176500000001 672.828235-128 513.807059-128z m0 963.764706a39.152941 39.152941 0 0 1-24.696471-7.830588A438.512941 438.512941 0 0 0 319.247059 734.569412a608.376471 608.376471 0 0 0-180.705883-43.369412 33.731765 33.731765 0 0 1-24.094117-30.117647v-283.708235C118.663529 155.10588199999995 389.722353-67.76470600000005 513.807059-67.76470600000005s354.183529 148.178824 391.529412 444.536471c9.035294 175.887059 0 281.901176 0 283.105882a38.550588 38.550588 0 0 1-29.515295 33.731765 1287.830588 1287.830588 0 0 0-180.705882 41.562353A676.442353 676.442353 0 0 0 536.094118 829.741176a37.345882 37.345882 0 0 1-24.094118 6.02353zM784.865882 479.171765L487.905882 198.47529399999996a40.357647 40.357647 0 0 0-49.392941-4.818823l-7.830588 6.625882-161.430588 171.068235a40.357647 40.357647 0 1 0 60.235294 55.416471l133.722353-141.552941 267.444706 252.988235a40.357647 40.357647 0 1 0 55.41647-60.235294" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 270 KiB

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,8 @@ layui.define('layer', function(exports){
,hint = layui.hint()
,device = layui.device()
,MOD_NAME = 'form', ELEM = '.layui-form', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', 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 = {
@ -68,7 +69,7 @@ layui.define('layer', function(exports){
Form.prototype.on = function(events, callback){
return layui.onevent.call(this, MOD_NAME, events, callback);
};
//初始赋值
Form.prototype.val = function(filter, object){
var that = this
@ -76,14 +77,25 @@ layui.define('layer', function(exports){
formElem.each(function(index, item){
var itemFrom = $(this);
layui.each(object, function(key, value){
var itemElem = itemFrom.find('[name="'+ key +'"]');
itemElem.val(value);
var itemElem = itemFrom.find('[name="'+ key +'"]')
,type;
//如果对应的表单不存在,则不执行
if(!itemElem[0]) return;
//如果有 checked 的内置属性,就改变 checked 属性的值
if('checked' in itemElem[0]){
type = itemElem[0].type;
//如果为复选框
if(type === 'checkbox'){
itemElem[0].checked = value;
}
} else if(type === 'radio') { //如果为单选框
itemElem.each(function(){
if(this.value === value ){
this.checked = true
}
});
} else { //其它类型的表单
itemElem.val(value);
}
});
});
form.render(null, filter);
@ -101,8 +113,10 @@ layui.define('layer', function(exports){
select: function(){
var TIPS = '请选择', CLASS = 'layui-form-select', TITLE = 'layui-select-title'
,NONE = 'layui-select-none', initValue = '', thatInput
,selects = elemForm.find('select')
,selects = elemForm.find('select'), hide = function(e, clear){
//隐藏 select
,hide = function(e, clear){
if(!$(e.target).parent().hasClass(TITLE) || clear){
$('.'+CLASS).removeClass(CLASS+'ed ' + CLASS+'up');
thatInput && initValue && thatInput.val(initValue);
@ -110,31 +124,38 @@ layui.define('layer', function(exports){
thatInput = null;
}
//各种事件
,events = function(reElem, disabled, isSearch){
var select = $(this)
,title = reElem.find('.' + TITLE)
,input = title.find('input')
,dl = reElem.find('dl')
,dds = dl.children('dd')
,index = Number(select.val()? select.val(): -1) + 1 ;
,index = this.selectedIndex //当前选中的索引
,nearElem; //select 组件当前选中的附近元素,用于辅助快捷键功能
if(disabled) return;
//展开下拉
var showDown = function(){
var top = reElem.offset().top + reElem.outerHeight() + 5 - win.scrollTop()
var top = reElem.offset().top + reElem.outerHeight() + 5 - $win.scrollTop()
,dlHeight = dl.outerHeight();
index = select[0].selectedIndex; //获取最新的 selectedIndex
reElem.addClass(CLASS+'ed');
dds.removeClass(HIDE);
//确保没有选择的时候第一个也会有样式
dl.children('dd:eq('+index+')').addClass(THIS);
//初始选中样式
dds.eq(index).addClass(THIS).siblings().removeClass(THIS);
//上下定位识别
if(top + dlHeight > win.height() && top >= dlHeight){
if(top + dlHeight > $win.height() && top >= dlHeight){
reElem.addClass(CLASS + 'up');
}
}, hideDown = function(choose){
reElem.removeClass(CLASS+'ed ' + CLASS+'up');
input.blur();
nearElem = null;
if(choose) return;
@ -162,64 +183,68 @@ layui.define('layer', function(exports){
input.focus();
});
//键盘事件
input.on('keyup', function(e){
//select 中 input 键盘事件
input.on('keyup', function(e){ //键盘松开
var keyCode = e.keyCode;
//Tab键
//Tab键展开
if(keyCode === 9){
showDown();
}
}).on('keydown', function(e){
}).on('keydown', function(e){ //键盘按下
var keyCode = e.keyCode;
//Tab键
//Tab键隐藏
if(keyCode === 9){
hideDown();
}
//up 键
if(keyCode === 38){
e.preventDefault();
index--;
// 如果是不可点击状态,则跳过
if(dl.children('dd:eq('+index+')').hasClass(DISABLED)) index--;
if(index < 0) index = 0;
dl.children('dd:eq('+index+')').addClass(THIS).siblings().removeClass(THIS);
}
//down 键
if(keyCode === 40){
//标注 dd 的选中状态
var setThisDd = function(prevNext, thisElem){
var nearDd, cacheNearElem;
e.preventDefault();
index++;
if(dl.children('dd:eq('+index+')').hasClass(DISABLED)) index++;
if(index > dds.length - 1) index = dds.length - 1;
//得到当前队列元素
thisElem = function(){
if(thisElem && thisElem[0]){
return thisElem;
}
if(nearElem && nearElem[0]){
return nearElem;
}
return dds.eq(index);
}();
cacheNearElem = thisElem[prevNext](); //当前元素的附近元素
nearDd = thisElem[prevNext]('dd'); //当前元素的 dd 元素
//如果附近的元素不存在,则停止执行
if(!cacheNearElem[0]) return;
//记录附近的元素,让其成为下一个当前元素
nearElem = thisElem[prevNext]();
dl.children('dd:eq('+index+')').addClass(THIS).siblings().removeClass(THIS);
}
//回车键
//如果附近不是 dd ,或者附近的 dd 元素是禁用状态,则进入递归查找
if(!nearDd[0] || nearDd.hasClass(DISABLED)){
return setThisDd(prevNext, nearElem);
}
//标注样式
nearDd.addClass(THIS).siblings().removeClass(THIS);
};
if(keyCode === 38) setThisDd('prev'); //Up 键
if(keyCode === 40) setThisDd('next'); //Down 键
//Enter 键
if(keyCode === 13){
e.preventDefault();
var othis = dl.children('dd:eq('+index+')')
,value = othis.attr('lay-value')
,filter = select.attr('lay-filter'); //获取过滤器
if(index === 0){
input.val('');
} else {
input.val(othis.text());
}
select.val(value).removeClass('layui-form-danger')
layui.event.call(this, MOD_NAME, 'select('+ filter +')', {
elem: select[0]
,value: value
,othis: reElem
});
hideDown(true);
dl.children('dd.'+THIS).trigger('click');
}
});
//检测值是否不属于select项
//检测值是否不属于 select 项
var notOption = function(value, callback, origin){
var num = 0;
layui.each(dds, function(){
@ -259,8 +284,9 @@ layui.define('layer', function(exports){
if(isSearch){
input.on('keyup', search).on('blur', function(e){
thatInput = input;
initValue = dl.find('.' + THIS).html();
var selectedIndex = select[0].selectedIndex;
thatInput = input; //当前的 select 中的 input 元素
initValue = $(select[0].options[selectedIndex]).html(); //重新获得初始选中值
setTimeout(function(){
notOption(input.val(), function(none){
initValue || input.val(''); //none && !initValue
@ -273,15 +299,14 @@ layui.define('layer', function(exports){
dds.on('click', function(){
var othis = $(this), value = othis.attr('lay-value');
var filter = select.attr('lay-filter'); //获取过滤器
if(othis.hasClass(DISABLED)) return false;
if(othis.hasClass('layui-select-tips')){
input.val('');
index = 0;
} else {
input.val(othis.text());
othis.addClass(THIS);
index = Number(value) + 1;
}
othis.siblings().removeClass(THIS);
@ -300,8 +325,7 @@ layui.define('layer', function(exports){
return false;
});
//关闭下拉
$(document).off('click', hide).on('click', hide);
$(document).off('click', hide).on('click', hide); //点击其它元素关闭 select
}
selects.each(function(index, select){
@ -320,10 +344,18 @@ layui.define('layer', function(exports){
) : TIPS;
//替代元素
var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS + (disabled ? ' layui-select-disabled' : '') +'">'
,'<div class="'+ TITLE +'"><input type="text" placeholder="'+ placeholder +'" value="'+ (value ? selected.html() : '') +'" '+ (isSearch ? '' : 'readonly') +' class="layui-input'+ (isSearch ? '' : ' layui-unselect') + (disabled ? (' ' + DISABLED) : '') +'">'
var reElem = $(['<div class="'+ (isSearch ? '' : 'layui-unselect ') + CLASS
,(disabled ? ' layui-select-disabled' : '') +'">'
,'<div class="'+ TITLE +'">'
,('<input type="text" placeholder="'+ placeholder +'" '
+('value="'+ (value ? selected.html() : '') +'"') //默认值
+(isSearch ? '' : ' readonly') //是否开启搜索
+' class="layui-input'
+(isSearch ? '' : ' 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){
,'<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){
@ -380,19 +412,34 @@ layui.define('layer', function(exports){
checks.each(function(index, check){
var othis = $(this), skin = othis.attr('lay-skin')
,text = (othis.attr('lay-text')||'').split('|'), disabled = this.disabled;
,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 : '') +'" lay-skin="'+ (skin||'') +'">'
,{
_switch: '<em>'+ ((check.checked ? text[0] : text[1])||'') +'</em><i></i>'
}[skin] || ((check.title.replace(/\s/g, '') ? ('<span>'+ check.title +'</span>') : '') +'<i class="layui-icon">'+ (skin ? '&#xe605;' : '&#xe618;') +'</i>')
var hasRender = othis.next('.' + RE_CLASS[0])
,reElem = $(['<div class="layui-unselect '+ RE_CLASS[0]
,(check.checked ? (' '+ RE_CLASS[1]) : '') //选中状态
,(disabled ? ' layui-checkbox-disbaled '+ DISABLED : '') //禁用状态
,'"'
,(skin ? ' lay-skin="'+ skin +'"' : '') //风格
,'>'
,function(){ //不同风格的内容
var title = check.title.replace(/\s/g, '')
,type = {
//复选框
checkbox: [
(title ? ('<span>'+ check.title +'</span>') : '')
,'<i class="layui-icon layui-icon-ok"></i>'
].join('')
//开关
,_switch: '<em>'+ ((check.checked ? text[0] : text[1]) || '') +'</em><i></i>'
};
return type[skin] || type['checkbox'];
}()
,'</div>'].join(''));
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender
@ -441,7 +488,9 @@ layui.define('layer', function(exports){
hasRender[0] && hasRender.remove(); //如果已经渲染则Rerender
//替代元素
var reElem = $(['<div class="layui-unselect '+ CLASS + (radio.checked ? (' '+CLASS+'ed') : '') + (disabled ? ' layui-radio-disbaled '+DISABLED : '') +'">'
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>'
,'<div>'+ function(){
var title = radio.title || '';
@ -550,12 +599,12 @@ layui.define('layer', function(exports){
//自动完成渲染
var form = new Form()
,dom = $(document), win = $(window);
,$dom = $(document), $win = $(window);
form.render();
//表单reset重置渲染
dom.on('reset', ELEM, function(){
$dom.on('reset', ELEM, function(){
var filter = $(this).attr('lay-filter');
setTimeout(function(){
form.render(null, filter);
@ -563,7 +612,7 @@ layui.define('layer', function(exports){
});
//表单提交事件
dom.on('submit', ELEM, submit)
$dom.on('submit', ELEM, submit)
.on('click', '*[lay-submit]', submit);
exports(MOD_NAME, form);

View File

@ -162,7 +162,7 @@ layui.define(function(exports){
return options.join('') +'</select></span>';
}()
//刷新
//刷新当前页
,refresh: ['<a href="javascript:;" data-page="'+ config.curr +'" class="layui-laypage-refresh">'
,'<i class="layui-icon layui-icon-refresh"></i>'
,'</a>'].join('')

View File

@ -1,7 +1,7 @@
/**
@Title: layui.rate 评分评星
@Author: star
@Author: star1029
@LicenseMIT
*/
@ -58,7 +58,7 @@ layui.define('jquery',function(exports){
Class.prototype.config = {
length: 5 //初始长度
,text: false //是否显示评分等级
,reader: false //是否只读
,readonly: false //是否只读
,half: false //是否可以半星
,value: 0 //星星选中个数
,theme: ''
@ -80,7 +80,7 @@ layui.define('jquery',function(exports){
}
//组件模板
var temp = '<ul class="layui-rate">';
var temp = '<ul class="layui-rate" '+ (options.readonly ? 'readonly' : '') +'>';
for(var i = 1;i <= options.length;i++){
var item = '<li class="layui-inline"><i class="layui-icon '
+ (i>Math.floor(options.value)?ICON_RATE:ICON_RATE_SOLID)
@ -120,7 +120,7 @@ layui.define('jquery',function(exports){
othis.addClass("layui-inline");
//如果不是只读,那么进行触控事件
if(!options.reader) that.action();
if(!options.readonly) that.action();
};

View File

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