This commit is contained in:
贤心 2018-05-28 18:50:37 +08:00
parent 452dc4bbb4
commit 756081b680
15 changed files with 116 additions and 20 deletions

View File

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

View File

@ -108,6 +108,14 @@ body{padding: 10px;}
<option value="音乐">音乐</option>
<option value="旅行">旅行</option>
<option value="读书">读书</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
</div>
</div>
@ -190,6 +198,10 @@ layui.use('form', function(){
}
}
,pass: [/(.+){6,12}$/, '密码必须6到12位']
,money: [
/^\d+\.\b\d{2}\b$/
,'金额必须为小数保留两位'
]
});
//初始赋值
@ -256,6 +268,27 @@ layui.use('form', function(){
<option disabled value="你工作的第一个城市">你工作的第一个城市</option>
<option value="你的工号">你的工号</option>
<option value="你最喜欢的老师">你最喜欢的老师</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号" selected>你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
<option value="你的工号">你的工号</option>
</select>
<button>Go</button>
</form>

View File

@ -15,8 +15,6 @@ body{padding: 20px; /*overflow-y: scroll;*/}
</head>
<body>
<table id="test2" lay-filter="test2"></table>
<div class="layui-btn-group">
<button class="layui-btn" data-type="getCheckData">获取选中行数据</button>
<button class="layui-btn" data-type="getCheckLength">获取选中数目</button>
@ -46,6 +44,7 @@ body{padding: 20px; /*overflow-y: scroll;*/}
<span {{# if(!d.activate){ }}style="color:#999"{{# } }}>{{ d.email }}</span>
</script>
<table id="test2" lay-filter="test2"></table>
<table class="layui-table" lay-data="{width:800, height: 300, url:'json/table/demo2.json', page: true, limit: 6}">
<thead>
@ -180,6 +179,7 @@ layui.use('table', function(){
elem: '#test'
,height: 350
,url: 'json/table/demo1.json'
//,size: 'sm'
,page: {
}

View File

@ -93,6 +93,15 @@ layui.use('upload', function(){
,accept: 'file'
,fileAccept: 'image/*'
,exts: "jpg|png|gif|bmp|jpeg|pdf"
,data: { //额外参数
a: 1
,b: function(){
return 2
}
}
,choose: function(){
console.log(1)
}
,before: function(obj){
//预读本地文件示例不支持ie8
obj.preview(function(index, file, result){
@ -248,14 +257,24 @@ layui.use('upload', function(){
});
//手动上传
upload.render({
elem: '#test6'
,url: ''
,auto: false
//,multiple: true
,bindAction: '#test7'
,choose: function(obj){
var that = this;
obj.preview(function(index, file){
obj.resetFile(index, file, '123.jpg');
});
}
,before: function(){
console.log(345);
}
,done: function(res){
console.log(res)
console.log(res);
}
});
@ -263,7 +282,7 @@ layui.use('upload', function(){
elem: '#test8'
,url: ''
,done: function(res){
console.log(res)
console.log(res);
}
});
@ -271,7 +290,7 @@ layui.use('upload', function(){
elem: '#test9'
,url: ''
,done: function(res){
console.log(res)
console.log(res);
}
});

View File

@ -1,7 +1,7 @@
{
"name": "layui-src",
"realname": "layui",
"version": "2.3.0-rc1",
"version": "2.3.0",
"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-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');
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');
}
.layui-icon{
@ -205,7 +205,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-icon-template-1:before{content:"\e656"}
.layui-icon-vercode:before{content:"\e679"}
.layui-icon-cellphone:before{content:"\e678"}
.layui-icon-screen-full:before{content:"\e622";}
.layui-icon-screen-restore:before{content:"\e758";}
/* 基本布局 */

Binary file not shown.

View File

@ -297,6 +297,9 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="fonts-html" unicode="&#58955;" d="M194.33 416.235h-101.295v101.28h-46.035v-267.03h46.035v119.7h101.28v-119.7h46.035v267.03h-46.035v-101.28zM277.205 480.69h73.665v-230.205h46.035v230.205h73.665v36.825h-193.365v-36.825zM627.815 335.58000000000004l-46.755 181.935h-73.665v-267.03h46.035v211.785l46.035-211.785h55.245l46.83 213.93-0.795-213.93h46.035v267.03h-73.665l-45.3-181.935zM848.09 287.30999999999995v230.205h-46.035v-267.03h174.945v36.825h-128.91z" horiz-adv-x="1024" />
<glyph glyph-name="screen-full" unicode="&#58914;" d="M641.750109 511.899972l205.227128 204.519-0.704035-115.89966c-0.282433-9.611915 7.489578-18.09103 17.101493-17.808598l12.297071 0c9.611915 0.283456 17.667382 5.936199 17.808598 15.689331l0.565888 172.57752c0 0.14224 0.282433 9.187243 0.282433 9.187243 0.14224 4.804423-0.99056 9.187243-4.100388 12.297071-3.109828 3.109828-7.347339 5.086855-12.297071 4.946662l-8.763594-0.14224c-0.141216 0-0.278339 0-0.420579-0.14224L697.581696 797.833213c-9.611915-0.283456-17.667382-8.200776-17.808598-17.950837l0-12.297071c1.416256-11.44875 10.458189-18.092054 20.070104-17.808598l112.789832-0.283456-204.66124-203.814965c-9.329483-9.329483-9.329483-24.449855 0-33.778314 9.329483-9.470699 24.452925-9.470699 33.782408 0L641.750109 511.899972zM383.095141 319.11010699999997L177.726797 115.29411900000002l0.707105 115.338888c0.283456 9.607822-7.492648 18.086937-17.104563 17.808598l-13.001105 0c-9.611915-0.283456-17.667382-5.937223-17.808598-15.690354l-0.565888-172.718737c0-0.14224-0.282433-9.187243-0.282433-9.187243-0.14224-4.808516 0.99056-9.187243 4.096295-12.297071 3.109828-3.109828 7.351432-5.086855 12.297071-4.946662l8.762571 0.14224c0.14224 0 0.283456 0 0.425695 0.14224l171.873486-0.708128c9.607822 0.283456 17.667382 8.196683 17.808598 17.950837L344.93503 63.42477399999996c-1.415232 11.44875-10.461259 18.092054-20.074198 17.808598L212.069977 81.51682800000003 416.59 285.32872299999997c9.329483 9.329483 9.329483 24.453948 0 33.782408C407.40685 328.58182999999997 392.424624 328.58182999999997 383.095141 319.11010699999997L383.095141 319.11010699999997zM894.047276 60.03251399999999l-0.424672 172.718737c-0.283456 9.612938-8.200776 15.406898-17.809621 15.690354l-12.296047 0c-9.612938 0.278339-17.243733-8.200776-17.105586-17.808598l0.708128-115.903753L641.750109 319.11010699999997c-9.329483 9.329483-24.452925 9.329483-33.782408 0-9.325389-9.328459-9.325389-24.452925 0-33.782408L812.490795 81.51682800000003l-112.789832-0.283456c-9.611915 0.283456-18.515702-6.502088-20.073174-17.808598l0-12.297071c0.282433-9.611915 8.200776-17.667382 17.808598-17.950837l171.166381 0.708128c0.141216 0 0.282433-0.14224 0.424672-0.14224l8.763594-0.14224c4.803399-0.141216 9.187243 1.694595 12.296047 4.946662 3.109828 3.109828 4.238534 7.488555 4.097318 12.297071 0 0-0.14224 9.046027-0.14224 9.187243L894.047276 60.03149099999996zM212.216309 749.493252l112.789832 0.283456c9.607822-0.283456 18.512632 6.502088 20.070104 17.808598L345.076246 779.883399c-0.283456 9.611915-8.196683 17.667382-17.808598 17.950837l-172.011632-0.708128c-0.14224 0-0.283456 0.14224-0.425695 0.14224l-8.761548 0.14224c-4.808516 0.141216-9.187243-1.694595-12.297071-4.946662-3.109828-3.109828-4.242627-7.488555-4.096295-12.297071 0 0 0.282433-9.046027 0.282433-9.187243l0.420579-172.718737c0.14224-9.608845 8.200776-15.406898 17.808598-15.686261l13.005198 0c9.611915-0.282433 17.242709 8.196683 17.10047 17.808598l-0.564865 115.334795 205.231221-203.958228c9.324366-9.329483 24.448832-9.329483 33.777291 0 9.329483 9.329483 9.329483 24.452925 0 33.782408L212.216309 749.493252 212.216309 749.493252zM212.216309 749.493252" horiz-adv-x="1024" />
<glyph glyph-name="form" unicode="&#58940;" d="M314.278111 437.019389l395.439892 0 0-30.297458-395.439892 0L314.278111 437.019389zM314.278111 315.83495200000004l395.439892 0 0-30.297458-395.439892 0L314.278111 315.83495200000004zM314.278111 194.62833l263.626661 0 0-30.297458L314.278111 164.330872 314.278111 194.62833zM609.376235 739.9931730000001c-7.849678 42.966669-48.394988 75.742447-97.378777 75.742447-48.961604 0-89.51311-32.775778-97.380776-75.742447L116.55177 739.9931730000001l0-787.725922 790.893774 0 0 787.725922L609.376235 739.9931730000001zM446.091342 670.440529l0 17.613058 0 36.791056c0 33.410348 29.57295 60.594317 65.906116 60.594317 36.352353 0 65.907115-27.183969 65.907115-60.594317l0-36.791056 0-17.621053 16.672696-8.712493c32.358061-16.929922 57.169039-42.663874 71.406386-73.213161L358.043239 588.50688c14.240345 30.555683 39.051523 56.281241 71.408385 73.213161L446.091342 670.440529zM874.489888-17.436289999999985L149.505227-17.436289999999985 149.505227 709.694715 413.138884 709.694715l0-21.641327c-51.44492-26.923746-88.727643-74.124144-98.86377-129.845165l395.44289 0c-10.102151 55.730615-47.40466 102.921419-98.859773 129.845165l0 21.641327 263.631658 0L874.489888-17.436289999999985z" horiz-adv-x="1024" />
@ -426,6 +429,9 @@ t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-
<glyph glyph-name="male" unicode="&#58978;" d="M889.6 800h-240s-35.2 0-38.4-41.6c0-19.2 16-38.4 38.4-38.4h140.8l-179.2-179.2C556.8 582.4 489.6 608 416 608 240 608 96 464 96 288s144-320 320-320 320 144 320 320c0 73.6-25.6 140.8-67.2 195.2l179.2 179.2v-140.8c0-22.4 19.2-38.4 38.4-38.4 22.4 0 38.4 19.2 38.4 41.6V764.8h3.2C924.8 800 889.6 800 889.6 800zM416 48c-131.2 0-236.8 105.6-236.8 236.8 0 131.2 105.6 236.8 236.8 236.8s236.8-105.6 236.8-236.8c0-131.2-105.6-236.8-236.8-236.8z" horiz-adv-x="1024" />
<glyph glyph-name="screen-restore" unicode="&#59224;" d="M582.6 454.6v320h50V540l274 274 35.4-35.4-274-274h234.6v-50h-320zM117.4-46l274 274v-234.6h50v320h-320v-50H356l-274-274 35.4-35.4zM132 764h302V814H82v-352h50V764z m760-760H590v-50h352V306h-50v-302z" horiz-adv-x="1024" />
<glyph glyph-name="password" unicode="&#58995;" d="M519.2 343.29999999999995c-41.1 0-74.4-33.3-74.4-74.4 0-29.7 17.5-55 42.5-67.1v-81.9c0-17.6 14.3-31.9 31.9-31.9 17.6 0 31.9 14.3 31.9 31.9v81.9c25.1 12 42.5 37.4 42.5 66.9 0 41.3-33.2 74.6-74.4 74.6zM827.6-62.10000000000002H189.4c-35.9 0-65.1 29.2-65.1 65.1V428.4c0 35.9 29.2 65.1 65.1 65.1h638.2c17.3 0 33.7-6.7 46-19.1 12.3-12.3 19.1-28.7 19.1-46V3c0-35.9-29.2-65.1-65.1-65.1zM231.9 427.2c-34.8 0-41.3-6.6-41.3-41.3v-340.4c0-34.8 6.6-41.3 41.3-41.3h553.2c34.8 0 41.3 6.6 41.3 41.3V385.9c0 34.8-6.6 41.3-41.3 41.3H231.9zM519.2 86.70000000000005c-18.3 0-33.2 14.8-33.2 33.2V201c-26.3 12.8-42.6 38.8-42.6 67.8 0 41.8 33.9 75.7 75.7 75.7s75.7-33.9 75.7-75.7c0-29-16.3-55-42.5-67.8v-81.1c0.1-18.2-14.9-33.2-33.1-33.2zM519.2 342c-40.4 0-73.2-32.9-73.2-73.2 0-28.3 16.1-53.6 41.9-65.8l0.7-0.4V120c0-17 13.7-30.7 30.7-30.7S550 103.10000000000002 550 120v82.6l0.7 0.4c25.8 12.3 41.9 37.5 41.9 65.8-0.2 40.4-33.1 73.2-73.4 73.2zM207 523.1c-9.1 0-17.6 3.5-23.9 10-6.4 6.4-10 15-10 23.9v2h-0.2l0.2 1.4c0.1 0.5 0.1 0.9 0.2 1.4l0.2 1c0.1 0.6 0.2 1.4 0.4 2 15.3 75.7 57 144.2 117.2 193 29.9 24.2 63.4 43 99.8 56 37.5 13.3 77 20.2 117.5 20.2 61 0 120.8-16.3 173-47.2 50.6-29.9 93-72.8 122.5-123.8 4-5.6 6.1-12.2 6.1-19.2 0-18.3-15-33.3-33.3-33.3-13.2 0-25.1 7.7-30.4 19.8-49.2 84.6-140.4 137.4-238 137.4-128.1 0-238.2-87.1-267.6-211.8v-0.2c-0.7-18.4-15.4-32.6-33.7-32.6z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

Binary file not shown.

View File

@ -144,6 +144,7 @@ layui.define('layer', function(exports){
index = select[0].selectedIndex; //获取最新的 selectedIndex
reElem.addClass(CLASS+'ed');
dds.removeClass(HIDE);
nearElem = null;
//初始选中样式
dds.eq(index).addClass(THIS).siblings().removeClass(THIS);
@ -231,6 +232,22 @@ layui.define('layer', function(exports){
//标注样式
nearDd.addClass(THIS).siblings().removeClass(THIS);
//定位滚动条
var ddThis = dl.children('dd.layui-this')
,posTop = ddThis.position().top
,dlHeight = dl.height()
,ddHeight = ddThis.height();
//若选中元素在滚动条不可见底部
if(posTop > dlHeight){
dl.scrollTop(posTop + dl.scrollTop() - dlHeight + ddHeight - 5);
}
//若选择玄素在滚动条不可见顶部
if(posTop < 0){
dl.scrollTop(posTop + dl.scrollTop());
}
};

View File

@ -377,7 +377,7 @@
,range: false //是否开启范围选择,即双控件
,format: 'yyyy-MM-dd' //默认日期格式
,value: null //默认日期支持传入new Date()或者符合format参数设定的日期格式字符
,isInitValue: false //用于控制是否自动向元素填充初始值(需配合 value 参数使用)
,isInitValue: true //用于控制是否自动向元素填充初始值(需配合 value 参数使用)
,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。
,max: '2099-12-31' //有效最大日期,同上
,trigger: 'focus' //呼出控件的事件

View File

@ -127,11 +127,11 @@ layui.define('layer' , function(exports){
$('#'+ ELEM_IFRAME)[0] || $('body').append(iframe);
//包裹文件域
if(!options.elem.next().hasClass(ELEM_IFRAME)){
if(!options.elem.next().hasClass(ELEM_FORM)){
that.elemFile.wrap(elemForm);
//追加额外的参数
options.elem.next('.'+ ELEM_IFRAME).append(function(){
options.elem.next('.'+ ELEM_FORM).append(function(){
var arr = [];
layui.each(options.data, function(key, value){
value = typeof value === 'function' ? value() : value;
@ -288,14 +288,17 @@ layui.define('layer' , function(exports){
//回调返回的参数
,args = {
//预览
preview: function(callback){
that.preview(callback);
}
//上传
,upload: function(index, file){
var thisFile = {};
thisFile[index] = file;
that.upload(thisFile);
}
//追加文件到队列
,pushFile: function(){
that.files = that.files || {};
layui.each(that.chooseFiles, function(index, item){
@ -303,12 +306,22 @@ layui.define('layer' , function(exports){
});
return that.files;
}
//重置文件
,resetFile: function(index, file, filename){
var newFile = new File([file], filename);
that.files = that.files || {};
that.files[index] = newFile;
}
}
//提交上传
,send = function(){
if(type === 'choose'){
return options.choose && options.choose(args);
,send = function(){
//选择文件的回调
if(type === 'choose' || options.auto){
options.choose && options.choose(args);
if(type === 'choose'){
return;
}
}
//上传前的回调

View File

@ -164,6 +164,13 @@ layui.define('jquery', function(exports){
.replace(/mm/g, hms[1])
.replace(/ss/g, hms[2]);
}
//防 xss 攻击
,escape: function(html){
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&amp;')
.replace(/</g, '&lt;').replace(/>/g, '&gt;')
.replace(/'/g, '&#39;').replace(/"/g, '&quot;');
}
};
exports('util', util);

View File

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