2.2.3
This commit is contained in:
@@ -426,7 +426,7 @@ layui.define('layer', function(exports){
|
||||
errorText = errorText || verify[thisVer][1];
|
||||
|
||||
//如果是必填项或者非空命中校验,则阻止提交,弹出提示
|
||||
if((isTrue && thisVer === 'required') || (isTrue && value)){
|
||||
if(isTrue){
|
||||
//提示层风格
|
||||
if(verType === 'tips'){
|
||||
layer.tips(errorText, othis, {tips: 1});
|
||||
|
||||
@@ -12,8 +12,18 @@
|
||||
|
||||
var isLayui = window.layui && layui.define, ready = {
|
||||
getPath: function(){
|
||||
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
|
||||
if(script.getAttribute('merge')) return;
|
||||
var jsPath = document.currentScript ? document.currentScript.src : function(){
|
||||
var js = document.scripts
|
||||
,last = js.length - 1
|
||||
,src;
|
||||
for(var i = last; i > 0; i--){
|
||||
if(js[i].readyState === 'interactive'){
|
||||
src = js[i].src;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return src || js[last].src;
|
||||
}();
|
||||
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
|
||||
}()
|
||||
|
||||
@@ -63,7 +73,7 @@
|
||||
//设置全局项
|
||||
,set: function(options){
|
||||
var that = this;
|
||||
that.config = ready.extend({}, that.config, options);
|
||||
that.config = lay.extend({}, that.config, options);
|
||||
return that;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,19 @@
|
||||
|
||||
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);
|
||||
var jsPath = document.currentScript ? document.currentScript.src : function(){
|
||||
var js = document.scripts
|
||||
,last = js.length - 1
|
||||
,src;
|
||||
for(var i = last; i > 0; i--){
|
||||
if(js[i].readyState === 'interactive'){
|
||||
src = js[i].src;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return src || js[last].src;
|
||||
}();
|
||||
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
|
||||
}(),
|
||||
|
||||
config: {}, end: {}, minIndex: 0, minLeft: [],
|
||||
|
||||
@@ -560,12 +560,14 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
trs_fixed_r.push('<tr data-index="'+ i1 +'">'+ tds_fixed_r.join('') + '</tr>');
|
||||
});
|
||||
|
||||
//if(data.length === 0) return;
|
||||
|
||||
that.layBody.scrollTop(0);
|
||||
that.layMain.find('.'+ NONE).remove();
|
||||
that.layMain.find('tbody').html(trs.join(''));
|
||||
that.layFixLeft.find('tbody').html(trs_fixed.join(''));
|
||||
that.layFixRight.find('tbody').html(trs_fixed_r.join(''));
|
||||
|
||||
|
||||
that.renderForm();
|
||||
that.syncCheckAll();
|
||||
that.haveInit ? that.scrollPatch() : setTimeout(function(){
|
||||
@@ -689,7 +691,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
|
||||
res[options.response.dataName] = thisData;
|
||||
that.renderData(res, that.page, that.count, true);
|
||||
layer.close(that.tipsIndex);
|
||||
|
||||
if(formEvent){
|
||||
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
|
||||
@@ -740,7 +741,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
return checked;
|
||||
};
|
||||
|
||||
if(!checkAllElem[0]) return
|
||||
if(!checkAllElem[0]) return;
|
||||
|
||||
if(table.checkStatus(that.key).isAll){
|
||||
if(!checkAllElem[0].checked){
|
||||
@@ -761,7 +762,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
Class.prototype.getCssRule = function(field, callback){
|
||||
var that = this
|
||||
,style = that.elem.find('style')[0]
|
||||
,sheet = style.sheet || style.styleSheet
|
||||
,sheet = style.sheet || style.styleSheet || {}
|
||||
,rules = sheet.cssRules || sheet.rules;
|
||||
layui.each(rules, function(i, item){
|
||||
if(item.selectorText === ('.laytable-cell-'+ that.index +'-'+ field)){
|
||||
@@ -976,7 +977,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
}
|
||||
layui.event.call(this, MOD_NAME, 'checkbox('+ filter +')', {
|
||||
checked: checked
|
||||
,data: table.cache[that.key][index]
|
||||
,data: table.cache[that.key] ? (table.cache[that.key][index] || {}) : {}
|
||||
,type: isAll ? 'all' : 'one'
|
||||
});
|
||||
});
|
||||
@@ -1219,8 +1220,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
var nums = 0
|
||||
,invalidNum = 0
|
||||
,arr = []
|
||||
,data = table.cache[id];
|
||||
if(!data) return {};
|
||||
,data = table.cache[id] || [];
|
||||
//计算全选个数
|
||||
layui.each(data, function(i, item){
|
||||
if(item.constructor === Array){
|
||||
@@ -1234,7 +1234,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
});
|
||||
return {
|
||||
data: arr //选中的数据
|
||||
,isAll: nums === (data.length - invalidNum) //是否全选
|
||||
,isAll: data.length ? (nums === (data.length - invalidNum)) : false //是否全选
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ layui.define('layer' , function(exports){
|
||||
,data: {} //请求上传的额外参数
|
||||
,drag: true //是否允许拖拽上传
|
||||
,size: 0 //文件限制大小,默认不限制
|
||||
,number: 0 //允许同时上传的文件数,默认不限制
|
||||
,multiple: false //是否允许多文件上传,不支持ie8-9
|
||||
};
|
||||
|
||||
@@ -355,9 +356,12 @@ layui.define('layer' , function(exports){
|
||||
break;
|
||||
}
|
||||
|
||||
//检验文件大小
|
||||
//检验文件数量和大小
|
||||
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;
|
||||
|
||||
@@ -130,7 +130,7 @@ layui.define('jquery', function(exports){
|
||||
}
|
||||
|
||||
//数字前置补零
|
||||
,digit: function(num, length, end){
|
||||
,digit: function(num, length){
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
@@ -139,6 +139,31 @@ layui.define('jquery', function(exports){
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num|0) : num;
|
||||
}
|
||||
|
||||
//转化为日期格式字符
|
||||
,toDateString: function(time, format){
|
||||
var that = this
|
||||
,date = new Date(time || new Date())
|
||||
,ymd = [
|
||||
that.digit(date.getFullYear(), 4)
|
||||
,that.digit(date.getMonth() + 1)
|
||||
,that.digit(date.getDate())
|
||||
]
|
||||
,hms = [
|
||||
that.digit(date.getHours())
|
||||
,that.digit(date.getMinutes())
|
||||
,that.digit(date.getSeconds())
|
||||
];
|
||||
|
||||
format = format || 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
return format.replace(/yyyy/g, ymd[0])
|
||||
.replace(/MM/g, ymd[1])
|
||||
.replace(/dd/g, ymd[2])
|
||||
.replace(/HH/g, hms[0])
|
||||
.replace(/mm/g, hms[1])
|
||||
.replace(/ss/g, hms[2]);
|
||||
}
|
||||
};
|
||||
|
||||
exports('util', util);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.2.2'; //版本号
|
||||
this.v = '2.2.3'; //版本号
|
||||
}
|
||||
|
||||
//获取layui所在目录
|
||||
@@ -425,7 +425,7 @@
|
||||
//将数组中的对象按其某个成员排序
|
||||
Layui.prototype.sort = function(obj, key, desc){
|
||||
var clone = JSON.parse(
|
||||
JSON.stringify(obj)
|
||||
JSON.stringify(obj || [])
|
||||
);
|
||||
|
||||
if(!key) return clone;
|
||||
|
||||
Reference in New Issue
Block a user