Merge branch '2.x' of github.com:layui/layui into 2.x

pull/1145/head
贤心 2022-10-10 09:23:14 +08:00
commit 80f2099944
2 changed files with 14 additions and 8 deletions

View File

@ -59,7 +59,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
.layui-layer-setwin .layui-layer-maxmin:after{z-index: 0; margin: -5px 0 0 -1px;} .layui-layer-setwin .layui-layer-maxmin:after{z-index: 0; margin: -5px 0 0 -1px;}
.layui-layer-setwin .layui-layer-close{cursor: pointer;} .layui-layer-setwin .layui-layer-close{cursor: pointer;}
.layui-layer-setwin .layui-layer-close:hover{opacity:0.7;} .layui-layer-setwin .layui-layer-close:hover{opacity:0.7;}
.layui-layer-setwin .layui-layer-close2{position:absolute; right: -13px; top: -13px; padding: 3px; margin-left:0; color: #777; *right:-18px; _display:none;} .layui-layer-setwin .layui-layer-close2{position:absolute; right: -28px; top: -28px; color: #fff; background-color: #787878; padding: 3px; border: 3px solid; width: 18px; height: 18px; font-size: 18px; font-weight: bolder; border-radius: 50%; margin-left: 0; *right:-18px; _display:none;}
.layui-layer-setwin .layui-layer-close2:hover{opacity: unset; background-color: #3888f6;}
/* 按钮栏 */ /* 按钮栏 */
.layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;} .layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;}

View File

@ -24,7 +24,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}(), }(),
config: {}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [], config: {removeFocus: true}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [],
btn: ['确定', '取消'], btn: ['确定', '取消'],
//五种原始层模式 //五种原始层模式
@ -173,7 +173,8 @@ var layer = {
closeBtn: false, closeBtn: false,
btn: false, btn: false,
resize: false, resize: false,
end: end end: end,
removeFocus: false
}, (type && !ready.config.skin) ? { }, (type && !ready.config.skin) ? {
skin: skin + ' layui-layer-hui', skin: skin + ' layui-layer-hui',
anim: anim anim: anim
@ -191,7 +192,8 @@ var layer = {
type: 3, type: 3,
icon: icon || 0, icon: icon || 0,
resize: false, resize: false,
shade: 0.01 shade: 0.01,
removeFocus: false
}, options)); }, options));
}, },
@ -204,7 +206,8 @@ var layer = {
shade: false, shade: false,
resize: false, resize: false,
fixed: false, fixed: false,
maxWidth: 260 maxWidth: 260,
removeFocus: false
}, options)); }, options));
} }
}; };
@ -367,6 +370,9 @@ Class.pt.creat = function(){
,body = $('body'); ,body = $('body');
if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]) return; if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]) return;
if(config.removeFocus) {
document.activeElement.blur(); // 将原始的聚焦节点失焦
}
if(typeof config.area === 'string'){ if(typeof config.area === 'string'){
config.area = config.area === 'auto' ? ['', ''] : [config.area, '']; config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
@ -668,6 +674,7 @@ Class.pt.move = function(){
//按下拖动元素 //按下拖动元素
moveElem.on('mousedown', function(e){ moveElem.on('mousedown', function(e){
if (e.button) {return;} // 不是左键不处理
var othis = $(this) var othis = $(this)
,dict = {}; ,dict = {};
@ -1236,9 +1243,7 @@ layer.prompt = function(options, yes){
,resize: false ,resize: false
,yes: function(index){ ,yes: function(index){
var value = prompt.val(); var value = prompt.val();
if(value === ''){ if(value.length > (options.maxlength||500)) {
prompt.focus();
} else if(value.length > (options.maxlength||500)) {
layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1}); layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1});
} else { } else {
yes && yes(value, index, prompt); yes && yes(value, index, prompt);