mirror of https://github.com/layui/layui
commit
ad2946151e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -62,6 +62,9 @@
|
|||
<div class="layui-inline layui-input-wrap">
|
||||
<input type="text" name="arr[]" value="" required placeholder="请输入" autocomplete="off" class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
<div class="layui-inline layui-input-wrap">
|
||||
<input type="text" name="arr[]" value="禁用或只读状态" disabled placeholder="请输入" autocomplete="off" class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
|
|
@ -55,6 +55,11 @@ body{padding: 50px 100px;}
|
|||
<input type="text" class="layui-input" id="test2">
|
||||
</div>
|
||||
|
||||
开启快捷面板:
|
||||
<div class="layui-inline">
|
||||
<input type="text" class="layui-input" id="test2-1">
|
||||
</div>
|
||||
|
||||
<br><br><hr><br>
|
||||
|
||||
年选择器:
|
||||
|
@ -186,12 +191,13 @@ layui.use('laydate', function(laydate){
|
|||
elem: '#test1-2'
|
||||
,type: 'date'
|
||||
,range: ['#test-startDate-1', '#test-endDate-1']
|
||||
,rangeLinked: true // 是否开启日期范围选择时的区间联动标注模式
|
||||
//,value: ['2022-05-01', '2022-06-01']
|
||||
//,value: '2022-05-01 - 2022-06-01'
|
||||
});
|
||||
|
||||
|
||||
//单控件
|
||||
// 日期选择器(单面板)
|
||||
laydate.render({
|
||||
elem: '#test2'
|
||||
//,format: 'yyyy年MM月dd日'
|
||||
|
@ -214,6 +220,54 @@ layui.use('laydate', function(laydate){
|
|||
console.log(value);
|
||||
}
|
||||
});
|
||||
|
||||
// 开启快捷面板
|
||||
laydate.render({
|
||||
elem: '#test2-1',
|
||||
shortcuts: [
|
||||
{
|
||||
text: "昨天",
|
||||
value: (function () {
|
||||
var now = new Date();
|
||||
now.setDate(now.getDate() - 1);
|
||||
return now;
|
||||
})()
|
||||
},
|
||||
{ text: "今天", value: Date.now() },
|
||||
{
|
||||
text: "明天",
|
||||
value: (function () {
|
||||
var now = new Date();
|
||||
now.setDate(now.getDate() + 1);
|
||||
return now;
|
||||
})()
|
||||
},
|
||||
{
|
||||
text: "上个月",
|
||||
value: (function () {
|
||||
var now = new Date();
|
||||
// now.setDate(now.getDate() - 1);
|
||||
now.setMonth(now.getMonth() - 1);
|
||||
return [now];
|
||||
})()
|
||||
},
|
||||
{
|
||||
text: "上个月的前一天",
|
||||
value: (function () {
|
||||
var now = new Date();
|
||||
now.setMonth(now.getMonth() - 1);
|
||||
now.setDate(now.getDate() - 1);
|
||||
return [now];
|
||||
})()
|
||||
},
|
||||
{
|
||||
text: "某一天",
|
||||
value: "2020-12-12"
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
|
||||
//年选择器
|
||||
laydate.render({
|
||||
|
|
|
@ -124,9 +124,9 @@ exports.layer = () => { // gulp layer
|
|||
// laydate task
|
||||
exports.laydate = () => { // gulp laydate
|
||||
let dest = './release/laydate/'; // 发行目录
|
||||
let comment = [ //注释
|
||||
'\n/*! \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
|
||||
,{title: 'layDate 日期与时间组件(单独版)', license: 'MIT'}
|
||||
let comment = [ // 注释
|
||||
'\n/** \n * <%= title %> \n * <%= license %> Licensed \n */ \n\n'
|
||||
,{title: 'laydate 日期与时间组件(单独版)', license: 'MIT'}
|
||||
];
|
||||
|
||||
// css
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "layui",
|
||||
"version": "2.8.0-rc.2",
|
||||
"version": "2.8.0-rc.3",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"main": "dist/layui.js",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -498,6 +498,8 @@ a cite{font-style: normal; *cursor:pointer;}
|
|||
.layui-col-space28>*{padding: 14px;}
|
||||
.layui-col-space30{margin: -15px;}
|
||||
.layui-col-space30>*{padding: 15px;}
|
||||
.layui-col-space32{margin: -15px;}
|
||||
.layui-col-space32>*{padding: 15px;}
|
||||
|
||||
|
||||
/** 页面元素 **/
|
||||
|
|
|
@ -77,9 +77,9 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
|||
.laydate-footer-btns span{margin: 0 0 0 -1px;}
|
||||
|
||||
/* 快捷栏 */
|
||||
.layui-laydate-shortcut{width: 80px;display: inline-block;vertical-align: top;overflow: auto;max-height: 276px;}
|
||||
.layui-laydate-shortcut{width: 80px; padding: 6px 0; display: inline-block;vertical-align: top;overflow: auto; max-height: 276px;}
|
||||
.layui-laydate-shortcut+.layui-laydate-main{display: inline-block;border-left: 1px solid #e2e2e2;}
|
||||
.layui-laydate-shortcut>li{padding: 6px;cursor: pointer;line-height: 18px;}
|
||||
.layui-laydate-shortcut>li{padding: 5px 8px; cursor: pointer;line-height: 18px;}
|
||||
|
||||
/* 年月列表 */
|
||||
.layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;}
|
||||
|
@ -106,15 +106,19 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
|||
|
||||
|
||||
/* 默认简约主题 */
|
||||
.layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;}
|
||||
.layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #777;}
|
||||
.layui-laydate-header{border-bottom: 1px solid #e2e2e2;}
|
||||
.layui-laydate-header i:hover,
|
||||
.layui-laydate-header span:hover{color: #5FB878;}
|
||||
.layui-laydate-content{border-top: none 0; border-bottom: none 0;}
|
||||
.layui-laydate-content th{color: #333;}
|
||||
.layui-laydate-content td{color: #666;}
|
||||
.layui-laydate-content td{color: #777;}
|
||||
.layui-laydate-content td.laydate-day-now{color: #5FB878;}
|
||||
.layui-laydate-content td.laydate-day-now:after{content: ''; position: absolute; width: 100%; height: 30px; left: 0; top: 0; border: 1px solid #5FB878; box-sizing: border-box;}
|
||||
.layui-laydate-linkage .layui-laydate-content td.laydate-selected>div{background-color: #00F7DE;}
|
||||
.layui-laydate-linkage .laydate-selected:hover>div{background-color: #00F7DE !important;}
|
||||
.layui-laydate-content td:hover:after,
|
||||
.layui-laydate-content td.laydate-selected:after{content: none;}
|
||||
.layui-laydate-content td>div:hover,
|
||||
.layui-laydate-list li:hover,
|
||||
.layui-laydate-shortcut>li:hover{background-color: #eee; color: #333;}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.8.0-rc.2'; // Layui 版本号
|
||||
this.v = '2.8.0-rc.3'; // Layui 版本号
|
||||
}
|
||||
|
||||
//识别预先可能定义的指定全局对象
|
||||
|
|
|
@ -164,14 +164,19 @@ layui.define(['layer', 'util'], function(exports){
|
|||
var affix = othis.attr('lay-affix');
|
||||
var CLASS_SUFFIX = 'layui-input-suffix';
|
||||
var elemNext = othis.next('.'+ CLASS_SUFFIX);
|
||||
var disabled = othis.is('[disabled]') || othis.is('[readonly]');
|
||||
var hideElem = function(elem, value){
|
||||
if(!elem) return;
|
||||
elem[$.trim(value) ? 'removeClass' : 'addClass'](HIDE);
|
||||
};
|
||||
var renderSuffix = function(type){
|
||||
var renderSuffix = function(type, _disabled){
|
||||
elemNext.remove();
|
||||
elemNext = $(['<div class="layui-input-suffix layui-input-affix-event">'
|
||||
,'<i class="layui-icon layui-icon-'+ type +'"></i>'
|
||||
elemNext = $(['<div class="layui-input-suffix layui-input-affix-event"'+ (
|
||||
_disabled ? ' disabled' : ''
|
||||
) +'>'
|
||||
,'<i class="layui-icon layui-icon-'+ type + (
|
||||
_disabled ? ' layui-disabled' : ''
|
||||
) +'"></i>'
|
||||
,'</div>'].join(''));
|
||||
|
||||
othis.after(elemNext);
|
||||
|
@ -186,6 +191,7 @@ layui.define(['layer', 'util'], function(exports){
|
|||
// 点击后缀套件事件
|
||||
elemNext.on('click', function(){
|
||||
var filter = othis.attr('lay-filter');
|
||||
if($(this).is('[disabled]')) return;
|
||||
obj[affix] && obj[affix][1].call(this);
|
||||
|
||||
// 对外事件
|
||||
|
@ -200,7 +206,7 @@ layui.define(['layer', 'util'], function(exports){
|
|||
var obj = {
|
||||
// 清空
|
||||
clear: [function(){ // 渲染
|
||||
renderSuffix('clear');
|
||||
renderSuffix('clear', disabled);
|
||||
}, function(){ // 事件
|
||||
othis.val('').focus();
|
||||
hideElem(elemNext, null);
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
var ELEM_LIST = 'layui-laydate-list';
|
||||
var ELEM_SELECTED = 'laydate-selected';
|
||||
var ELEM_HINT = 'layui-laydate-hint';
|
||||
var ELEM_DAY_NOW = 'laydate-day-now';
|
||||
var ELEM_PREV = 'laydate-day-prev';
|
||||
var ELEM_NEXT = 'laydate-day-next';
|
||||
var ELEM_FOOTER = 'layui-laydate-footer';
|
||||
|
@ -1648,13 +1649,30 @@
|
|||
// if(startTime > endTime) return that.hint(TIPS_OUT);
|
||||
|
||||
lay.each(tds, function(i, item){
|
||||
var ymd = lay(item).attr('lay-ymd').split('-')
|
||||
,thisTime = that.newDate({
|
||||
var ymd = lay(item).attr('lay-ymd').split('-');
|
||||
var thisTime = that.newDate({
|
||||
year: ymd[0]
|
||||
,month: ymd[1] - 1
|
||||
,date: ymd[2]
|
||||
}).getTime();
|
||||
|
||||
// 标记当天
|
||||
if(options.rangeLinked && !that.startDate){
|
||||
if(thisTime === that.newDate(that.systemDate()).getTime()){
|
||||
lay(item).addClass(
|
||||
lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT)
|
||||
? ''
|
||||
: ELEM_DAY_NOW
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 标注区间
|
||||
*/
|
||||
|
||||
lay(item).removeClass(ELEM_SELECTED + ' ' + THIS);
|
||||
|
||||
if(thisTime === startTime || thisTime === endTime){
|
||||
(that.rangeLinked || (!that.rangeLinked && (i < 42 ? thisTime === startTime : thisTime === endTime))) &&
|
||||
lay(item).addClass(
|
||||
|
|
Loading…
Reference in New Issue