pull/62/head
sentsin 2017-08-22 10:58:11 +08:00
parent 51ce00a7d4
commit 8245d17a4d
5 changed files with 24 additions and 32 deletions

View File

@ -1,18 +1,3 @@
 
# v5.0.0 # [更新日志](http://www.layui.com/laydate/changelog.html)
* 全新重写
* 支持单独显示年选择器、年月选择器、日期选择器、时间选择器、日期时间选择器
* 支持双控件,用于选择年/年月/日期/时间/日期时间五种类型选择器的范围(可顺时、逆时)
* 支持日期格式的自定义
* 支持日期是否合法的自动校验
* 支持有效日期范围的设定
* 支持内置事件(可自定义)、外部事件、直接显示等多种调用方式
* 支持中文版和国际版的语言设定
* 支持开启公历节日和标记重要日期
* 支持直接嵌套在页面的某个容器中
* 支持底部按钮的任意顺序排版
* 支持智能显示在最佳可视坐标
* 支持回车快捷键选择
* 支持多种内置主题的设定,支持自定义主题色,且可单独定制主题

4
dist/laydate.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "layui-laydate", "name": "layui-laydate",
"version": "5.0.0", "version": "5.0.1",
"alias": "laydate", "alias": "laydate",
"description": "日期与时间组件", "description": "日期与时间组件",
"main": "src/laydate.js", "main": "src/laydate.js",

View File

@ -1,6 +1,6 @@
/** /**
@Name : layDate 5.0 日期时间控件 @Name : layDate 5.0.1 日期时间控件
@Author: 贤心 @Author: 贤心
@Sitehttp://www.layui.com/laydate/ @Sitehttp://www.layui.com/laydate/
@LicenseMIT @LicenseMIT
@ -55,7 +55,7 @@
} }
,laydate = { ,laydate = {
v: '5.0' v: '5.0.1'
,config: {} //全局配置项 ,config: {} //全局配置项
,index: (window.laydate && window.laydate.v) ? 100000 : 0 ,index: (window.laydate && window.laydate.v) ? 100000 : 0
,path: ready.getPath ,path: ready.getPath
@ -705,7 +705,9 @@
Class.thisElem = that.elemID; Class.thisElem = that.elemID;
typeof options.ready === 'function' && options.ready(options.dateTime); typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, {
month: options.dateTime.month + 1
}));
}; };
//控件移除 //控件移除
@ -866,6 +868,8 @@
checkValid(dateTime) checkValid(dateTime)
}; };
if(fn === 'limit') return checkValid(dateTime), that;
value = value || options.value; value = value || options.value;
if(typeof value === 'string'){ if(typeof value === 'string'){
value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, '');
@ -1212,7 +1216,7 @@
that.list('month', index); that.list('month', index);
} }
} else { } else {
that.calendar(); that.checkDate('limit').calendar();
that.closeList(); that.closeList();
} }
@ -1516,12 +1520,15 @@
that.startState = true; that.startState = true;
} }
lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED); lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED);
} else if(!(options.type === 'datatime' || options.position === 'static')){ } else if(options.position === 'static'){ //直接嵌套的选中
setDateTime(true);
that.setValue(that.parse()).remove().done();
} else {
setDateTime(true); setDateTime(true);
that.calendar().done().done(null, 'change'); that.calendar().done().done(null, 'change');
} else if(options.type === 'date'){
setDateTime(true);
that.setValue(that.parse()).remove().done();
} else if(options.type === 'datetime'){
setDateTime(true);
that.calendar().done(null, 'change');
} }
}; };
@ -1634,7 +1641,7 @@
prevYear: function(){ prevYear: function(){
if(addSubYeay('sub')) return; if(addSubYeay('sub')) return;
dateTime.year--; dateTime.year--;
that.calendar(); that.checkDate('limit').calendar();
options.range || that.done(null, 'change'); options.range || that.done(null, 'change');
} }
,prevMonth: function(){ ,prevMonth: function(){
@ -1643,7 +1650,7 @@
year: YM[0] year: YM[0]
,month: YM[1] ,month: YM[1]
}); });
that.calendar(); that.checkDate('limit').calendar();
options.range || that.done(null, 'change'); options.range || that.done(null, 'change');
} }
,nextMonth: function(){ ,nextMonth: function(){
@ -1652,13 +1659,13 @@
year: YM[0] year: YM[0]
,month: YM[1] ,month: YM[1]
}); });
that.calendar(); that.checkDate('limit').calendar();
options.range || that.done(null, 'change'); options.range || that.done(null, 'change');
} }
,nextYear: function(){ ,nextYear: function(){
if(addSubYeay()) return; if(addSubYeay()) return;
dateTime.year++ dateTime.year++
that.calendar(); that.checkDate('limit').calendar();
options.range || that.done(null, 'change'); options.range || that.done(null, 'change');
} }
}; };