mirror of https://github.com/layui/layui
laydate修复一些问题新增快捷选项功能;table新增maxHeight配置
parent
e1222cf891
commit
118cd98c9f
|
@ -76,9 +76,9 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
||||||
.laydate-footer-btns span{margin: 0 0 0 -1px;}
|
.laydate-footer-btns span{margin: 0 0 0 -1px;}
|
||||||
|
|
||||||
/* 快捷栏 */
|
/* 快捷栏 */
|
||||||
.layui-laydate-shortcut{width: 80px;display: inline-block;vertical-align: top;overflow: hidden;max-height: 276px;}
|
.layui-laydate-shortcut{width: 80px;display: inline-block;vertical-align: top;overflow: auto;max-height: 276px;}
|
||||||
.layui-laydate-shortcut+.layui-laydate-main{border-left: 1px solid #e2e2e2;}
|
.layui-laydate-shortcut+.layui-laydate-main{display: inline-block;border-left: 1px solid #e2e2e2;}
|
||||||
.layui-laydate-shortcut>li{padding: 6px;cursor: pointer;}
|
.layui-laydate-shortcut>li{padding: 6px;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;}
|
.layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;}
|
||||||
|
|
|
@ -528,18 +528,33 @@
|
||||||
return html.join('');
|
return html.join('');
|
||||||
}());
|
}());
|
||||||
|
|
||||||
//生成快捷键栏
|
// 生成快捷键栏
|
||||||
elem.appendChild(divShortcut);
|
if (options.shortcuts) {
|
||||||
lay(divShortcut).html(function () {
|
elem.appendChild(divShortcut);
|
||||||
var shortcutBtns = [];
|
lay(divShortcut).html(function () {
|
||||||
lay.each(options.shortcuts, function (i, item) {
|
var shortcutBtns = [];
|
||||||
shortcutBtns.push('<li>'+item.text+'</li>')
|
lay.each(options.shortcuts, function (i, item) {
|
||||||
|
shortcutBtns.push('<li data-index="' + i + '">'+item.text+'</li>')
|
||||||
|
})
|
||||||
|
return shortcutBtns.join('');
|
||||||
|
}()).find('li').on('click', function (event) {
|
||||||
|
var btnSetting = options.shortcuts[this.dataset['index']] || {};
|
||||||
|
var value = btnSetting.value || [];
|
||||||
|
if (!layui.isArray(value)) {
|
||||||
|
value = [value];
|
||||||
|
}
|
||||||
|
lay.each(value, function (i, item) {
|
||||||
|
lay.extend([options.dateTime, that.endDate][i], that.systemDate(layui.type(item) === 'date' ? item : new Date(item)))
|
||||||
|
that.checkDate('limit').calendar(null,i);
|
||||||
|
});
|
||||||
|
that.closeList();
|
||||||
|
var timeBtn = lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED);
|
||||||
|
timeBtn.attr('lay-type') === 'date' && timeBtn.click();
|
||||||
|
that.done(null, 'change');
|
||||||
|
|
||||||
|
lay(this).addClass(THIS);
|
||||||
})
|
})
|
||||||
return shortcutBtns.join('');
|
}
|
||||||
}()).find('li').on('click', function (event) {
|
|
||||||
lay(this.parentElement).find('li.layui-this').removeClass(THIS);
|
|
||||||
lay(this).addClass(THIS);
|
|
||||||
})
|
|
||||||
|
|
||||||
//插入到主区域
|
//插入到主区域
|
||||||
lay.each(elemMain, function(i, main){
|
lay.each(elemMain, function(i, main){
|
||||||
|
@ -1088,6 +1103,9 @@
|
||||||
//同步按钮可点状态
|
//同步按钮可点状态
|
||||||
that.setBtnStatus();
|
that.setBtnStatus();
|
||||||
|
|
||||||
|
// 重置快捷栏选中状态
|
||||||
|
lay(that.shortcut).find('li.' + THIS).removeClass(THIS);
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化索引
|
||||||
|
options.index = that.index;
|
||||||
|
that.key = options.id || options.index;
|
||||||
|
|
||||||
|
//初始化一些其他参数
|
||||||
|
that.setInit();
|
||||||
|
|
||||||
//高度铺满:full-差距值
|
//高度铺满:full-差距值
|
||||||
if(options.height && /^full-\d+$/.test(options.height)){
|
if(options.height && /^full-\d+$/.test(options.height)){
|
||||||
that.fullHeightGap = options.height.split('-')[1];
|
that.fullHeightGap = options.height.split('-')[1];
|
||||||
|
@ -367,13 +374,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
options.height = $(that.parentDiv).height() - that.parentHeightGap;
|
options.height = $(that.parentDiv).height() - that.parentHeightGap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化索引
|
|
||||||
options.index = that.index;
|
|
||||||
that.key = options.id || options.index;
|
|
||||||
|
|
||||||
//初始化一些其他参数
|
|
||||||
that.setInit();
|
|
||||||
|
|
||||||
//开始插入替代元素
|
//开始插入替代元素
|
||||||
var othis = options.elem
|
var othis = options.elem
|
||||||
,hasRender = othis.next('.' + ELEM_VIEW)
|
,hasRender = othis.next('.' + ELEM_VIEW)
|
||||||
|
@ -488,6 +488,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if(type === 'width') return options.clientWidth;
|
if(type === 'width') return options.clientWidth;
|
||||||
|
// 初始化高度配置,如果设置了最高高度,以最高高度形式为准
|
||||||
|
options.height = options.maxHeight || options.height;
|
||||||
|
|
||||||
// 初始化 css 参数
|
// 初始化 css 参数
|
||||||
if(options.css && options.css.indexOf(ELEM_VIEW) === -1){
|
if(options.css && options.css.indexOf(ELEM_VIEW) === -1){
|
||||||
|
@ -1567,7 +1569,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
|
||||||
bodyHeight -= (that.layPage.outerHeight() || 43);
|
bodyHeight -= (that.layPage.outerHeight() || 43);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.adaptiveHeight) {
|
if (options.maxHeight) {
|
||||||
layui.each({elem: height, layMain: bodyHeight}, function (elemName, elemHeight) {
|
layui.each({elem: height, layMain: bodyHeight}, function (elemName, elemHeight) {
|
||||||
that[elemName].css({
|
that[elemName].css({
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
|
|
Loading…
Reference in New Issue