Merge pull request #1210 from layui/2.x

release v2.8.0-rc.11
pull/1213/head v2.8.0-rc.11
贤心 2023-03-10 13:38:11 +08:00 committed by GitHub
commit 8d25f5cd04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 36 deletions

2
dist/css/layui.css vendored

File diff suppressed because one or more lines are too long

2
dist/layui.js vendored

File diff suppressed because one or more lines are too long

View File

@ -167,10 +167,11 @@ layui.use('dropdown', function(){
var inst = dropdown.render({
elem: '#demo2'
//,show: true
// ,show: true
,data: [{
title: 'menu item 1'
,href: '#1'
,disabled: true
},{
title: 'menu item 2(点击不关闭)'
,href: '#2'
@ -185,6 +186,9 @@ layui.use('dropdown', function(){
return false;
}
}
,ready: function(){
console.log(arguments);
}
});

View File

@ -1,6 +1,6 @@
{
"name": "layui",
"version": "2.8.0-rc.10",
"version": "2.8.0-rc.11",
"description": "Classic modular Front-End UI library",
"main": "dist/layui.js",
"license": "MIT",

View File

@ -11,8 +11,8 @@ a:active,a:hover{outline:0}
img{display: inline-block; border: none; vertical-align: middle;}
li{list-style:none;}
table{border-collapse: collapse; border-spacing: 0;}
h1,h2,h3{font-weight: 400;}
h4, h5, h6{font-size: 100%; font-weight: 400;}
h1,h2,h3{font-weight: 700;}
h4,h5,h6{font-weight: 500; font-size: 100%;}
button,input,select,textarea{font-size: 100%; }
input,button,textarea,select,optgroup,option{font-family: inherit; font-size: inherit; font-style: inherit; font-weight: inherit; outline: 0;}
pre{white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;}
@ -610,7 +610,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-text h3,
.layui-text h4,
.layui-text h5,
.layui-text h6{font-weight: 500; color: #3A3A3A;}
.layui-text h6{color: #3A3A3A;}
.layui-text h1{font-size: 32px;}
.layui-text h2{font-size: 24px;}
.layui-text h3{font-size: 18px;}
@ -1120,6 +1120,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-menu-body-title a{padding: 5px 15px; color: initial}
.layui-menu li{position: relative; margin: 1px 0; width: calc(100% + 1px); line-height: 26px; color: rgba(0,0,0,.8); font-size: 14px; white-space: nowrap; cursor: pointer; transition: all .3s;}
.layui-menu li:hover{background-color: #f8f8f8; }
.layui-menu li.layui-disabled,
.layui-menu li.layui-disabled *{background: none !important; color: #d2d2d2 !important; cursor: not-allowed !important;}
.layui-menu-item-parent:hover>.layui-menu-body-panel{display: block; animation-name: layui-fadein; animation-duration: 0.3s; animation-fill-mode: both; animation-delay:.2s;}
.layui-menu-item-parent .layui-menu-body-title,
@ -1259,10 +1261,10 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
/** Tab 选项卡 **/
.layui-tab{margin: 10px 0; text-align: left !important;}
.layui-tab[overflow]>.layui-tab-title{overflow: hidden;}
.layui-tab-title{position: relative; left: 0; height: 40px; white-space: nowrap; font-size: 0; border-bottom-width: 1px; border-bottom-style: solid; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab-title li{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; font-size: 14px; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab-title li{position: relative; line-height: 40px; min-width: 65px; padding: 0 15px; text-align: center; cursor: pointer;}
.layui-tab-title li a{display: block; padding: 0 15px; margin: 0 -15px;}
.layui-tab .layui-tab-title{position: relative; left: 0; height: 40px; padding-left: 0; white-space: nowrap; font-size: 0; border-bottom-width: 1px; border-bottom-style: solid; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab .layui-tab-title li{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; font-size: 14px; transition: all .2s; -webkit-transition: all .2s;}
.layui-tab .layui-tab-title li{position: relative; line-height: 40px; min-width: 65px; margin: 0; padding: 0 15px; text-align: center; cursor: pointer;}
.layui-tab .layui-tab-title li a{display: block; padding: 0 15px; margin: 0 -15px;}
.layui-tab-title .layui-this{color: #000;}
.layui-tab-title .layui-this:after{position: absolute; left:0; top: 0; content: ""; width:100%; height: 41px; border-width: 1px; border-style: solid; border-bottom-color: #fff; border-radius: 2px 2px 0 0; box-sizing: border-box; pointer-events: none;}

View File

@ -15,7 +15,7 @@
}
,Layui = function(){
this.v = '2.8.0-rc.10'; // Layui 版本号
this.v = '2.8.0-rc.11'; // Layui 版本号
}
//识别预先可能定义的指定全局对象

View File

@ -179,7 +179,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
if(isChild || type){
return ' class="'+ className[type] +'"';
}
return '';
return item.disabled ? ' class="'+ STR_DISABLED +'"' : '';
}() +'>'
//标题区
@ -273,7 +273,10 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
var data = othis.data('item') || {};
var isChild = data.child && data.child.length > 0;
var isClickAllScope = options.clickScope === 'all'; // 是否所有父子菜单均触发点击事件
if(data.disabled) return; // 菜单项禁用状态
// 普通菜单项点击后的回调及关闭面板
if((!isChild || isClickAllScope) && data.type !== '-'){
var ret = typeof options.click === 'function' && options.click(data, othis);
ret === false || (isChild || that.remove());
@ -301,6 +304,11 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
});
}
// 组件打开完毕的事件
typeof options.ready === 'function' && options.ready(
that.elemView,
options.elem
);
};
//位置定位
@ -361,9 +369,6 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
that.e = e;
that.render();
e.preventDefault();
//组件打开完毕的时间
typeof options.ready === 'function' && options.ready(that.elemView, options.elem, that.e.target);
};
//触发元素事件
@ -468,6 +473,8 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
parent.find('.'+ STR_ITEM_CHECKED2).removeClass(STR_ITEM_CHECKED2); //清除父级菜单选中样式
othis.addClass(STR_ITEM_CHECKED); //添加选中样式
othis.parents('.'+ STR_ITEM_PARENT).addClass(STR_ITEM_CHECKED2); //添加父级菜单选中样式
options.title = options.title || $.trim(othis.children('.'+ STR_MENU_TITLE).text());
//触发事件
layui.event.call(this, MOD_NAME, 'click('+ filter +')', options);

View File

@ -110,17 +110,25 @@ layui.define('jquery', function(exports){
// 基础事件体
var call = {
//Tab 点击
// Tab 点击
tabClick: function(e, index, liElem, options){
options = options || {};
var othis = liElem || $(this)
,index = index || othis.parent().children('li').index(othis)
,parents = options.headerElem ? othis.parent() : othis.parents('.layui-tab').eq(0)
,item = options.bodyElem ? $(options.bodyElem) : parents.children('.layui-tab-content').children('.layui-tab-item')
,elemA = othis.find('a')
,isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank' //是否存在跳转
,unselect = typeof othis.attr('lay-unselect') === 'string' //是否禁用选中
,filter = parents.attr('lay-filter');
var othis = liElem || $(this);
var parents = options.headerElem
? othis.parent()
: othis.parents('.layui-tab').eq(0);
var item = options.bodyElem
? $(options.bodyElem)
: parents.children('.layui-tab-content').children('.layui-tab-item');
var elemA = othis.find('a');
var isJump = elemA.attr('href') !== 'javascript:;' && elemA.attr('target') === '_blank'; //是否存在跳转
var unselect = typeof othis.attr('lay-unselect') === 'string'; //是否禁用选中
var filter = parents.attr('lay-filter');
// 下标
index = index === undefined
? othis.parent().children('li').index(othis)
: index;
//执行切换
if(!(isJump || unselect)){
@ -177,8 +185,8 @@ layui.define('jquery', function(exports){
call.hideTabMore(true)
}
//允许关闭
if(othis.attr('lay-allowClose')){
// 开启关闭图标
if(othis.attr('lay-allowclose')){
title.find('li').each(function(){
var li = $(this);
if(!li.find('.'+CLOSE)[0]){
@ -465,7 +473,7 @@ layui.define('jquery', function(exports){
: percent;
});
if(othis.attr('lay-showPercent')){
if(othis.attr('lay-showpercent')){
setTimeout(function(){
elemBar.html('<span class="'+ ELEM +'-text">'+ percent +'</span>');
},350);

View File

@ -987,10 +987,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
}
});
} else if(layui.type(options.data) === 'array'){ //已知数据
var res = {}
,startLimit = curr*options.limit - options.limit
var res = {};
var startLimit = curr*options.limit - options.limit;
var newData = options.data.concat();
res[response.dataName] = options.data.concat().splice(startLimit, options.limit);
res[response.dataName] = options.page
? newData.splice(startLimit, options.limit)
: newData;
res[response.countName] = options.data.length;
//记录合计行数据
@ -1349,7 +1352,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// td 容器
var td = ['<td data-field="'+ field +'" data-key="'+ item3.key +'" '+ function(){
var attr = [];
if(item3.align) attr.push('align="'+ item3.align +'"'); // 对齐方式
if(item3.minWidth) attr.push('data-minwidth="'+ item3.minWidth +'"'); // 单元格最小宽度
if(item3.maxWidth) attr.push('data-maxwidth="'+ item3.maxWidth +'"'); // 单元格最小宽度
return attr.join(' ');
@ -1365,6 +1367,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
: (key + ' laytable-cell-' + item3.type);
}() +'"'+ function(){
var attr = [];
if(item3.align) attr.push('align="'+ item3.align +'"'); // 对齐方式
if(item3.style) attr.push('style="'+ item3.style +'"'); // 自定义单元格样式
return attr.join(' ');
}() +'>' + function(){
@ -1950,6 +1953,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
var key = th.data('key');
var col = thatTable.col(key);
var filter = thatTable.config.elem.attr('lay-filter');
// 重置过度信息
dict = {};
@ -2083,7 +2087,6 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
// 设置行选中状态
,setRowChecked: function(opts){
that.setRowChecked($.extend({
type: 'radio',
index: index
}, opts));
}

View File

@ -20,8 +20,8 @@ layui.define('jquery', function(exports){
target: 'body', // fixbar 的插入目标选择器
bars: [], // bar 信息
default: true, // 是否显示默认 bar
showHeight: 200, // 出现 top bar 的滚动条高度临界值
duration: 200 // top bar 等动画时长(毫秒)
margin: 160, // 出现 top bar 的滚动条高度临界值
duration: 320 // top bar 等动画时长(毫秒)
}, options);
// 目标元素对象
@ -113,7 +113,7 @@ layui.define('jquery', function(exports){
var lock;
var setTopBar = (function setTopBar(){
var top = $scroll.scrollTop();
if(top >= options.showHeight){
if(top >= options.margin){
lock || (elemTopBar.show(), lock = 1);
} else {
lock && (elemTopBar.hide(), lock = 0);