Merge pull request #1152 from layui/main

同步主干修改到 2.x
pull/1153/head
贤心 2022-10-18 08:39:43 +08:00 committed by GitHub
commit 97b859d7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 13 deletions

View File

@ -42,6 +42,7 @@ layui.use('dropdown', function(){
dropdown.render({
elem: '#demo1'
,shade: [0.1, '#ddd']
//,align: 'right'
,data: [{
title: 'menu item 1'

View File

@ -152,6 +152,7 @@ layui.use('laydate', function(laydate){
laydate.render({
elem: '#test-first',
min: 0,
shade: [0.1, '#ddd']
//max: '2016-12-30'
});

View File

@ -1146,7 +1146,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
/* 下拉菜单 */
.layui-dropdown{position: absolute; left: -999999px; top: -999999px; z-index: 77777777; margin: 5px 0; min-width: 100px;}
.layui-dropdown:before{content:""; position: absolute; width: 100%; height: 6px; left: 0; top: -6px;}
.layui-dropdown-shade{top: 0; left: 0; width: 100%; height: 100%; _height: expression(document.body.offsetHeight+"px"); position: fixed; _position: absolute; pointer-events: auto;}
/** 导航菜单 **/
.layui-nav{position: relative; padding: 0 20px; background-color: #393D49; color: #fff; border-radius: 2px; font-size: 0; box-sizing: border-box;}

View File

@ -17,6 +17,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-header *,
.layui-laydate-content td,
.layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;}
.layui-laydate-shade{top: 0; left: 0; width: 100%; height: 100%; _height: expression(document.body.offsetHeight+"px"); position: fixed; _position: absolute; pointer-events: auto;}
/* 微微往下滑入 */
@keyframes laydate-downbit {

View File

@ -56,7 +56,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
//字符常量
,STR_ELEM = 'layui-dropdown', STR_HIDE = 'layui-hide', STR_DISABLED = 'layui-disabled', STR_NONE = 'layui-none'
,STR_ITEM_UP = 'layui-menu-item-up', STR_ITEM_DOWN = 'layui-menu-item-down', STR_MENU_TITLE = 'layui-menu-body-title', STR_ITEM_GROUP = 'layui-menu-item-group', STR_ITEM_PARENT = 'layui-menu-item-parent', STR_ITEM_DIV = 'layui-menu-item-divider', STR_ITEM_CHECKED = 'layui-menu-item-checked', STR_ITEM_CHECKED2 = 'layui-menu-item-checked2', STR_MENU_PANEL = 'layui-menu-body-panel', STR_MENU_PANEL_L = 'layui-menu-body-panel-left'
,STR_ITEM_UP = 'layui-menu-item-up', STR_ITEM_DOWN = 'layui-menu-item-down', STR_MENU_TITLE = 'layui-menu-body-title', STR_ITEM_GROUP = 'layui-menu-item-group', STR_ITEM_PARENT = 'layui-menu-item-parent', STR_ITEM_DIV = 'layui-menu-item-divider', STR_ITEM_CHECKED = 'layui-menu-item-checked', STR_ITEM_CHECKED2 = 'layui-menu-item-checked2', STR_MENU_PANEL = 'layui-menu-body-panel', STR_MENU_PANEL_L = 'layui-menu-body-panel-left', STR_ELEM_SHADE = 'layui-dropdown-shade'
,STR_GROUP_TITLE = '.'+ STR_ITEM_GROUP + '>.'+ STR_MENU_TITLE
@ -79,6 +79,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
,isSpreadItem: true //是否初始展开子菜单
,data: [] //菜单数据结构
,delay: 300 //延迟关闭的毫秒数,若 trigger 为 hover 时才生效
,shade: 0 // 遮罩
};
//重载实例
@ -251,6 +252,10 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
that.remove(); //移除非当前绑定元素的面板
elemBody.append(that.elemView);
options.elem.data(MOD_INDEX +'_opened', true);
//遮罩
var shade = options.shade ? ('<div class="'+ STR_ELEM_SHADE +'" style="'+ ('z-index:'+ (that.elemView.css('z-index')-1) +'; background-color: ' + (options.shade[1] || '#000') + '; opacity: ' + (options.shade[0] || options.shade)) +'"></div>') : '';
that.elemView.before(shade);
//坐标定位
that.position();
@ -324,6 +329,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
);
elemPrev.remove();
}
lay('.' + STR_ELEM_SHADE).remove();
};
//延迟删除视图

View File

@ -94,6 +94,7 @@
var ELEM_TIME_BTN = 'laydate-btns-time';
var ELEM_PREVIEW = 'layui-laydate-preview';
var ELEM_MAIN = 'layui-laydate-main';
var ELEM_SHADE = 'layui-laydate-shade';
// 组件构造器
var Class = function(options){
@ -163,6 +164,7 @@
,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发
,change: null //日期时间改变后的回调
,autoConfirm: true //是否自动确认(日期|年份|月份选择器非range下是否自动确认
,shade: 0
};
//多语言
@ -641,6 +643,9 @@
,that.position() //定位
);
var shade = options.shade ? ('<div class="'+ ELEM_SHADE +'" style="'+ ('z-index:'+ (elem.style.zIndex-1) +'; background-color: ' + (options.shade[1] || '#000') + '; opacity: ' + (options.shade[0] || options.shade)) +'"></div>') : '';
elem.insertAdjacentHTML('beforebegin', shade);
that.checkDate().calendar(null, 0, 'init'); //初始校验
that.changeEvent(); //日期切换
@ -670,6 +675,7 @@
typeof options.close === 'function' && options.close(that);
});
}
lay('.' + ELEM_SHADE).remove();
return that;
};
@ -1409,7 +1415,7 @@
setTimeStatus();
scroll();
(that.endDate || options.type === 'time') && that.done(null, 'change');
(that.endDate || options.type === 'time' || (options.type === 'datetime' && options.fullPanel)) && that.done(null, 'change');
//同步按钮可点状态
that.setBtnStatus();

View File

@ -902,8 +902,8 @@ Class.pt.openLayer = function(){
//记录宽高坐标,用于还原
ready.record = function(layero){
var area = [
layero.width(),
layero.height(),
layero[0].style.width || layero.width(),
layero[0].style.height || layero.height(),
layero.position().top,
layero.position().left + parseFloat(layero.css('margin-left'))
];
@ -981,11 +981,11 @@ layer.style = function(index, options, limit){
if(type === ready.type[2]){
layero.find('iframe').css({
height: parseFloat(options.height) - titHeight - btnHeight
height: (typeof options.height === 'number' ? options.height : layero.height()) - titHeight - btnHeight
});
} else {
contElem.css({
height: parseFloat(options.height) - titHeight - btnHeight
height: (typeof options.height === 'number' ? options.height : layero.height()) - titHeight - btnHeight
- parseFloat(contElem.css('padding-top'))
- parseFloat(contElem.css('padding-bottom'))
})
@ -1058,9 +1058,9 @@ layer.restore = function(index){
//恢复原来尺寸
layer.style(index, {
width: parseFloat(area[0]),
height: parseFloat(area[1]),
top: parseFloat(area[2]),
width: area[0], // 数值或百分比
height: area[1],
top: parseFloat(area[2]),
left: parseFloat(area[3]),
position: layero.attr('position'),
overflow: 'visible'

View File

@ -1363,7 +1363,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
tds.push(td);
});
that.layTotal.find('tbody').html('<tr>' + tds.join('') + '</tr>');
var patchElem = that.layTotal.find('.layui-table-patch'); // 可能存在滚动条补丁
that.layTotal.find('tbody').html('<tr>' + tds.join('') + (patchElem.length ? patchElem.get(0).outerHTML : '') + '</tr>');
};
//找到对应的列元素

View File

@ -194,14 +194,15 @@ layui.define('layer' , function(exports){
layui.each(items, function(index, file){
var formData = new FormData();
formData.append(options.field, file);
//追加额外的参数
layui.each(options.data, function(key, value){
value = typeof value === 'function' ? value() : value;
formData.append(key, value);
});
//最后添加 file 到表单域
formData.append(options.field, file);
//提交文件
var opts = {
url: options.url