升级版本

This commit is contained in:
sentsin
2017-12-07 15:48:45 +08:00
parent eac5a39c1b
commit a32378122e
33 changed files with 124 additions and 59 deletions

View File

@@ -571,7 +571,11 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
.layui-table-header,
.layui-table-tool,
.layui-table-patch,
.layui-table-mend{background-color: #f8f8f8;}
.layui-table-mend,
.layui-table[lay-even] tr:nth-child(even),
.layui-table tbody tr:hover,
.layui-table-hover,
.layui-table-click{background-color: #f2f2f2;}
.layui-table th,
.layui-table td,
@@ -582,13 +586,9 @@ hr, .layui-timeline-item:before{background-color: #e6e6e6;}
.layui-table-tool,
.layui-table-page,
.layui-table-fixed-r,
.layui-table-tips-main{border-width: 1px; border-style: solid; border-color: #eee;}
.layui-table-tips-main{border-width: 1px; border-style: solid; border-color: #e6e6e6;}
.layui-table th, .layui-table td{position: relative; padding: 9px 15px; min-height: 20px; line-height: 20px; font-size: 14px;}
.layui-table[lay-even] tr:nth-child(even){background-color: #f8f8f8;}
.layui-table tbody tr:hover,
.layui-table-hover{background-color: #f8f8f8;}
.layui-table-click{background-color: #f8f8f8;}
.layui-table[lay-skin="line"] th, .layui-table[lay-skin="line"] td{border-width: 0; border-bottom-width: 1px;}
.layui-table[lay-skin="row"] th, .layui-table[lay-skin="row"] td{border-width: 0;border-right-width: 1px;}

View File

@@ -405,8 +405,9 @@ layui.define('layer', function(exports){
,verifyElem = elem.find('*[lay-verify]') //获取需要校验的元素
,formElem = button.parents('form')[0] //获取当前所在的form元素如果存在的话
,fieldElem = elem.find('input,select,textarea') //获取所有表单域
,filter = button.attr('lay-filter'); //获取过滤器
,filter = button.attr('lay-filter') //获取过滤器
,nameIndex = 0; //数组 name 索引
//开始校验
layui.each(verifyElem, function(_, item){
var othis = $(this)
@@ -429,7 +430,14 @@ layui.define('layer', function(exports){
if(isTrue){
//提示层风格
if(verType === 'tips'){
layer.tips(errorText, othis, {tips: 1});
layer.tips(errorText, function(){
if(typeof othis.attr('lay-ignore') !== 'string'){
if(item.tagName.toLowerCase() === 'select' || /^checkbox|radio$/.test(item.type)){
return othis.next();
}
}
return othis;
}(), {tips: 1});
} else if(verType === 'alert') {
layer.alert(errorText, {title: '提示', shadeClose: true});
} else {
@@ -445,10 +453,18 @@ layui.define('layer', function(exports){
});
if(stop) return false;
layui.each(fieldElem, function(_, item){
item.name = (item.name || '').replace(/^\s*|\s*&/, '');
if(!item.name) return;
if(/^checkbox|radio$/.test(item.type) && !item.checked) return;
//用于支持数组 name
if(/^.*\[\]$/.test(item.name)){
item.name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex++) +']');
}
field[item.name] = item.value;
});

View File

@@ -1,6 +1,6 @@
/**
@Namelayer v3.1.0 Web弹层组件
@Namelayer v3.1.1 Web弹层组件
@Author贤心
@Sitehttp://layer.layui.com
@LicenseMIT
@@ -72,7 +72,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//默认内置方法。
var layer = {
v: '3.1.0',
v: '3.1.1',
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (

View File

@@ -310,7 +310,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
var width, isNone;
parent = parent || options.elem.parent()
width = parent.width();
isNone = parent.css('display') === 'none';
try {
isNone = parent.css('display') === 'none';
} catch(e){}
if(parent[0] && (!width || isNone)) return getWidth(parent.parent());
return width;
};
@@ -379,7 +381,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
//表格重载
Class.prototype.reload = function(options){
var that = this;
var that = this
,options = that.config;
if(options.data && options.data.constructor === Array) delete that.config.data;
that.config = $.extend({}, that.config, options);
that.render();
};
@@ -711,6 +715,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
that.elem.offset().top + that.elem.height()/2 - 35 - _WIN.scrollTop() + 'px'
,that.elem.offset().left + that.elem.width()/2 - 90 - _WIN.scrollLeft() + 'px'
]
,time: -1
,anim: -1
,fixed: false
});
@@ -1243,6 +1248,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
table.reload = function(id, options){
var config = thisTable.config[id];
if(!config) return hint.error('The ID option was not found in the table instance');
if(options.data && options.data.constructor === Array) delete config.data;
return table.render($.extend(true, {}, config, options));
};

View File

@@ -324,6 +324,8 @@ layui.define('layer' , function(exports){
? ((elemFile.value.match(/[^\/\\]+\..+/g)||[]) || '')
: value;
if(value.length === 0) return;
switch(options.accept){
case 'file': //一般文件
if(exts && !RegExp('\\w\\.('+ exts +')$', 'i').test(escape(value))){
@@ -356,12 +358,23 @@ layui.define('layer' , function(exports){
break;
}
//检验文件数量和大小
//检验文件数量
that.fileLength = function(){
var length = 0
,items = files || that.files || that.chooseFiles || elemFile.files;
layui.each(items, function(){
length++;
});
return length;
}();
if(options.number && that.fileLength > options.number){
return that.msg('同时最多只能上传的数量为:'+ options.number);
}
//检验文件大小
if(options.size > 0 && !(device.ie && device.ie < 10)){
var limitSize;
if(options.number && that.fileLength > options.number){
return that.msg('同时最多只能上传 '+ that.fileLength + ' 个');
}
layui.each(that.chooseFiles, function(index, file){
if(file.size > 1024*options.size){
var size = options.size/1024;
@@ -451,7 +464,6 @@ layui.define('layer' , function(exports){
//文件选择
that.elemFile.off('upload.change').on('upload.change', function(){
var files = this.files || [];
that.fileLength = files.length;
setChooseFile(files);
options.auto ? that.upload() : setChooseText(files); //是否自动触发上传
});

View File

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