2.0.2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
|
||||
@Name : layDate 5.0.1 日期时间控件
|
||||
@Name : layDate 5.0.2 日期时间控件
|
||||
@Author: 贤心
|
||||
@Site:http://www.layui.com/laydate/
|
||||
@License:MIT
|
||||
@@ -55,7 +55,7 @@
|
||||
}
|
||||
|
||||
,laydate = {
|
||||
v: '5.0.1'
|
||||
v: '5.0.2'
|
||||
,config: {} //全局配置项
|
||||
,index: (window.laydate && window.laydate.v) ? 100000 : 0
|
||||
,path: ready.getPath
|
||||
@@ -874,6 +874,12 @@
|
||||
if(typeof value === 'string'){
|
||||
value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, '');
|
||||
}
|
||||
|
||||
//如果点击了开始,单未选择结束就关闭,则重新选择开始
|
||||
if(that.startState && !that.endState){
|
||||
delete that.startState;
|
||||
that.endState = true;
|
||||
};
|
||||
|
||||
if(typeof value === 'string' && value){
|
||||
if(that.EXP_IF.test(value)){ //校验日期格式
|
||||
@@ -894,7 +900,7 @@
|
||||
) + '<br>已为你重置');
|
||||
error = true;
|
||||
}
|
||||
} else if(typeof value === 'object'){
|
||||
} else if(value && value.constructor === Date){ //如果值为日期对象时
|
||||
options.dateTime = that.systemDate(value);
|
||||
} else {
|
||||
options.dateTime = that.systemDate();
|
||||
@@ -1587,7 +1593,9 @@
|
||||
,confirm: function(){
|
||||
if(options.range){
|
||||
if(!that.endDate) return that.hint('请先选择日期范围');
|
||||
if(lay(btn).hasClass(DISABLED)) return;
|
||||
if(lay(btn).hasClass(DISABLED)) return that.hint(
|
||||
options.type === 'time' ? TIPS_OUT.replace(/日期/g, '时间') : TIPS_OUT
|
||||
);
|
||||
} else {
|
||||
if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内');
|
||||
}
|
||||
@@ -1763,8 +1771,8 @@
|
||||
that.remove();
|
||||
}).on('keydown', function(e){
|
||||
if(e.keyCode === 13){
|
||||
e.preventDefault();
|
||||
if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){
|
||||
e.preventDefault();
|
||||
lay(that.footer).find(ELEM_CONFIRM)[0].click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ layui.define(['layer', 'form'], function(exports){
|
||||
var that = this;
|
||||
layui.use('upload', function(upload){
|
||||
var uploadImage = set.uploadImage || {};
|
||||
toolActive.haveUpload || upload.render({
|
||||
upload.render({
|
||||
url: uploadImage.url
|
||||
,method: uploadImage.type
|
||||
,elem: $(that).find('input')[0]
|
||||
@@ -403,7 +403,6 @@ layui.define(['layer', 'form'], function(exports){
|
||||
}
|
||||
}
|
||||
});
|
||||
toolActive.haveUpload = true;
|
||||
});
|
||||
}
|
||||
//插入代码
|
||||
|
||||
@@ -76,6 +76,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
}()
|
||||
,'{{# if(item2.checkbox){ }}'
|
||||
,'<th data-field="{{ item2.field||i2 }}" data-type="checkbox" unresize="true"><div class="layui-table-cell laytable-cell-checkbox"><input type="checkbox" name="layTableCheckbox" lay-skin="primary" lay-filter="layTableAllChoose" {{# if(item2[d.data.checkName]){ }}checked{{# }; }}></div></th>'
|
||||
,'{{# } else if(item2.space){ }}'
|
||||
,'<th data-field="{{ item2.field||i2 }}" unresize="true"><div class="layui-table-cell laytable-cell-space"></div></th>'
|
||||
,'{{# } else { }}'
|
||||
,'<th data-field="{{ item2.field||i2 }}" {{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}} {{# if(item2.unresize){ }}unresize="true"{{# } }}>'
|
||||
,'{{# if(item2.colspan > 1){ }}'
|
||||
@@ -205,6 +207,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
that.layFixRight = reElem.find(ELEM_FIXR);
|
||||
that.layTool = reElem.find(ELEM_TOOL);
|
||||
|
||||
//设置body区域高度
|
||||
if(options.height){
|
||||
var bodyHeight = parseFloat(options.height) - parseFloat(that.layHeader.height()) - 1;
|
||||
if(options.page){
|
||||
bodyHeight = bodyHeight - parseFloat(that.layTool.outerHeight() + 1);
|
||||
}
|
||||
that.layBody.css('height', bodyHeight);
|
||||
}
|
||||
|
||||
that.pullData(1);
|
||||
that.events();
|
||||
};
|
||||
@@ -285,25 +296,23 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
var tds = [], tds_fixed = [], tds_fixed_r = [];
|
||||
that.eachCols(function(i3, item3){
|
||||
var content = item1[item3.field||i3];
|
||||
if(content === undefined || content === null){
|
||||
content = (i3 === 0 ? i1+1 : '');
|
||||
}
|
||||
if(content === undefined || content === null) content = '';
|
||||
|
||||
if(item3.colspan > 1) return;
|
||||
|
||||
var td = ['<td data-field="'+ (item3.field||i3) +'"'+ function(){
|
||||
var attr = [];
|
||||
if(item3.edit) attr.push(' data-edit="true"'); //是否允许单元格编辑
|
||||
if(item3.align) attr.push(' data-off="click" align="'+ item3.align +'"'); //对齐方式
|
||||
if(item3.align) attr.push(' align="'+ item3.align +'"'); //对齐方式
|
||||
if(item3.templet) attr.push(' data-content="'+ content +'"'); //自定义模板
|
||||
if(item3.toolbar) attr.push(' data-off="true"'); //自定义模板
|
||||
if(item3.event) attr.push(' lay-event="'+ item3.event +'"'); //自定义事件
|
||||
if(item3.style) attr.push(' style="'+ item3.style +'"'); //自定义样式
|
||||
return attr.join('');
|
||||
}() +'>'
|
||||
,'<div class="layui-table-cell laytable-cell-'+ function(){
|
||||
if(item3.checkbox){
|
||||
return 'checkbox';
|
||||
}
|
||||
if(item3.checkbox) return 'checkbox';
|
||||
if(item3.space) return 'space'; //间距
|
||||
return options.index + '-' + (item3.field||i3);
|
||||
}() +'">' + function(){
|
||||
if(item3.checkbox){
|
||||
@@ -316,8 +325,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
return item1[checkName] ? 'checked' : '';
|
||||
}() +'>';
|
||||
}
|
||||
if(item3.fixed === 'right' && item3.toolbar){
|
||||
return $(item3.toolbar).html();
|
||||
if(item3.toolbar){
|
||||
return laytpl($(item3.toolbar).html()).render(item1);
|
||||
}
|
||||
return item3.templet ? laytpl($(item3.templet).html() || String(content)).render(item1) : content;
|
||||
}()
|
||||
@@ -355,15 +364,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
that.cacheData = data;
|
||||
}
|
||||
|
||||
//设置body区域高度
|
||||
if(options.height){
|
||||
var bodyHeight = parseFloat(options.height) - parseFloat(that.layHeader.height()) - 1;
|
||||
if(options.page){
|
||||
bodyHeight = bodyHeight - parseFloat(that.layTool.outerHeight() + 2);
|
||||
}
|
||||
that.layBody.css('height', bodyHeight);
|
||||
}
|
||||
|
||||
if(data.length === 0){
|
||||
return that.layMain.html('<div class="layui-none">无数据</div>');
|
||||
}
|
||||
@@ -555,7 +555,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form'], function(exports){
|
||||
,th = that.layHeader.find('th')
|
||||
,resizing
|
||||
,ELEM_CELL = '.layui-table-cell'
|
||||
,filter = config.id || config.elem.attr('lay-filter');
|
||||
,filter = config.elem.attr('lay-filter');
|
||||
|
||||
//拖拽调整宽度
|
||||
th.on('mousemove', function(e){
|
||||
|
||||
@@ -417,7 +417,7 @@ layui.define('layer' , function(exports){
|
||||
}
|
||||
|
||||
//文件选择
|
||||
that.elemFile.on('change', function(){
|
||||
that.elemFile.off('upload.change').on('upload.change', function(){
|
||||
var files = this.files || [];
|
||||
setChooseFile(files);
|
||||
options.auto ? that.upload() : setChooseText(files); //是否自动触发上传
|
||||
@@ -431,6 +431,10 @@ layui.define('layer' , function(exports){
|
||||
//防止事件重复绑定
|
||||
if(options.elem.data('haveEvents')) return;
|
||||
|
||||
that.elemFile.on('change', function(){
|
||||
$(this).trigger('upload.change');
|
||||
});
|
||||
|
||||
options.elem.on('click', function(){
|
||||
if(that.isFile()) return;
|
||||
$(this).trigger('upload.start');
|
||||
|
||||
Reference in New Issue
Block a user