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

pull/1226/head
贤心 2 years ago
commit fc9756bccd

@ -21,7 +21,7 @@ const config = {
,{pkg: pkg, js: ';'}
]
//模块
,modules: 'lay,laytpl,laypage,laydate,jquery,layer,util,dropdown,slider,colorpicker,element,upload,form,table,tree,transfer,carousel,rate,flow,code'
,modules: 'lay,laytpl,laypage,laydate,jquery,layer,util,dropdown,slider,colorpicker,element,upload,form,table,treeTable,tree,transfer,carousel,rate,flow,code'
};
// 获取参数

@ -55,7 +55,7 @@ a cite{font-style: normal; *cursor:pointer;}
url('../font/iconfont.ttf?v=280') format('truetype'),
url('../font/iconfont.svg?v=280#layui-icon') format('svg');
}
.layui-icon{
font-family:"layui-icon" !important;
font-size: 16px;
@ -367,7 +367,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-show-md-block{display: block!important;}
.layui-show-md-inline{display: inline!important;}
.layui-show-md-inline-block{display: inline-block!important;}
.layui-col-md1, .layui-col-md2, .layui-col-md3, .layui-col-md4, .layui-col-md5, .layui-col-md6, .layui-col-md7, .layui-col-md8, .layui-col-md9, .layui-col-md10, .layui-col-md11, .layui-col-md12{float: left;}
.layui-col-md1{width: 8.33333333%;}
.layui-col-md2{width: 16.66666667%;}
@ -402,7 +402,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-show-lg-block{display: block!important;}
.layui-show-lg-inline{display: inline!important;}
.layui-show-lg-inline-block{display: inline-block!important;}
.layui-col-lg1, .layui-col-lg2, .layui-col-lg3, .layui-col-lg4, .layui-col-lg5, .layui-col-lg6, .layui-col-lg7, .layui-col-lg8, .layui-col-lg9, .layui-col-lg10, .layui-col-lg11, .layui-col-lg12{float: left;}
.layui-col-lg1{width: 8.33333333%;}
.layui-col-lg2{width: 16.66666667%;}
@ -437,7 +437,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-show-xl-block{display: block!important;}
.layui-show-xl-inline{display: inline!important;}
.layui-show-xl-inline-block{display: inline-block!important;}
.layui-col-xl1, .layui-col-xl2, .layui-col-xl3, .layui-col-xl4, .layui-col-xl5, .layui-col-xl6, .layui-col-xl7, .layui-col-xl8, .layui-col-xl9, .layui-col-xl10, .layui-col-xl11, .layui-col-xl12{float: left;}
.layui-col-xl1{width: 8.33333333%;}
.layui-col-xl2{width: 16.66666667%;}
@ -532,7 +532,7 @@ a cite{font-style: normal; *cursor:pointer;}
/*
*/
@ -566,8 +566,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-scollbar-hide{overflow: hidden !important;}
/*
*
/*
*
*/
@ -583,11 +583,11 @@ a cite{font-style: normal; *cursor:pointer;}
/* 边框 */
.layui-border,
.layui-quote-nm,
.layui-quote-nm,
.layui-elem-field,
.layui-collapse,
.layui-collapse,
.layui-panel,
.layui-colla-item,
.layui-colla-item,
.layui-colla-content,
.layui-badge-rim,
.layui-tab-title,
@ -597,7 +597,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-input, .layui-textarea, .layui-select,
.layui-input-split,
.layui-form-pane .layui-form-label,
.layui-form-pane .layui-form-label,
.layui-form-pane .layui-form-item[pane]{border-color: #eee;}
.layui-border{border-width: 1px; border-style: solid; color: #5F5F5F!important;}
@ -666,8 +666,8 @@ a cite{font-style: normal; *cursor:pointer;}
/*
*/
@ -719,7 +719,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-input:focus, .layui-textarea:focus{border-color: #d2d2d2 !important;}
.layui-textarea{position: relative; min-height: 100px; height: auto; line-height: 20px; padding: 6px 10px; resize: vertical;}
.layui-select{padding: 0 10px;}
.layui-form select,
.layui-form select,
.layui-form input[type=checkbox],
.layui-form input[type=radio]{display: none;}
.layui-form *[lay-ignore]{display: initial;}
@ -834,6 +834,8 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-form-checked.layui-checkbox-disabled[lay-skin="primary"] i{background: #eee!important; border-color: #eee!important;}
.layui-checkbox-disabled[lay-skin="primary"]:hover i{border-color: #d2d2d2;}
.layui-form-item .layui-form-checkbox[lay-skin="primary"]{margin-top: 10px;}
.layui-form-checkbox[lay-skin="primary"] > i.layui-icon-subtraction,
.layui-form-checkbox[lay-skin="primary"]:hover i.layui-icon-subtraction {color: darkgray;}
/* 复选框-开关风格 */.layui-form-switch{position: relative; display: inline-block; vertical-align: middle; height: 22px; line-height: 22px; min-width: 35px; padding: 0 5px; margin-top: 8px; border: 1px solid #d2d2d2; border-radius: 20px; cursor: pointer; background-color: #fff; -webkit-transition: .1s linear; transition: .1s linear;}
.layui-form-switch i{position: absolute; left: 5px; top: 3px; width: 16px; height: 16px; border-radius: 20px; background-color: #d2d2d2; -webkit-transition: .1s linear; transition: .1s linear;}
@ -868,7 +870,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-form-pane .layui-form-text .layui-input-block{margin: 0; left: 0; top: -1px;}
.layui-form-pane .layui-form-text .layui-textarea{min-height: 100px; border-radius: 0 0 2px 2px;}
.layui-form-pane .layui-form-checkbox{margin: 4px 0 4px 10px;}
.layui-form-pane .layui-form-switch,
.layui-form-pane .layui-form-switch,
.layui-form-pane .layui-form-radio{margin-top: 6px; margin-left: 10px; }
.layui-form-pane .layui-form-item[pane]{position: relative; border-width: 1px; border-style: solid;}
.layui-form-pane .layui-form-item[pane] .layui-form-label{position: absolute; left: 0; top: 0; height: 100%; border-width: 0px; border-right-width: 1px;}
@ -894,7 +896,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-laypage>*:last-child{margin-right: 0!important;}
.layui-laypage a,
.layui-laypage span,
.layui-laypage input,
.layui-laypage input,
.layui-laypage button,
.layui-laypage select{border: 1px solid #eee;}
.layui-laypage a,
@ -1108,7 +1110,13 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-table-tips-c:hover{background-color: #777;}
.layui-table-tips-c:before{position: relative; right: -2px;}
/** 文件上传 **/
/** 树表 **/
.layui-table-tree-nodeIcon {width: 20px;}
.layui-table-tree-nodeIcon > * {width: 100%;}
.layui-table-tree-flexIcon,.layui-table-tree-nodeIcon {margin-right: 2px;}
.layui-table-tree-flexIcon {cursor: pointer;}
/** 文件上传 **/
.layui-upload-file{display: none!important; opacity: .01; filter: Alpha(opacity=1);}
.layui-upload-list{margin: 11px 0;}
.layui-upload-choose{max-width: 200px; padding: 0 10px; color: #999; font-size: 14px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
@ -1238,7 +1246,7 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
.layui-nav-tree .layui-nav-child a:hover,
.layui-nav-tree .layui-nav-child{background: none; color: #fff;}
.layui-nav-itemed>.layui-nav-child{display: block; background-color: rgba(0,0,0,.3) !important;}
.layui-nav-itemed>.layui-nav-child{display: block; background-color: rgba(0,0,0,.3) !important;}
.layui-nav-itemed>.layui-nav-child>.layui-this>.layui-nav-child{display: block;}
/* 侧边 */.layui-nav-side{position: fixed; top: 0; bottom: 0; left: 0; overflow-x: hidden; z-index: 999;}
@ -1479,7 +1487,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
.layui-slider-wrap{width: 36px; height: 36px; position: absolute; top: -16px; -webkit-transform: translateX(-50%); transform: translateX(-50%); z-index: 10; text-align: center;}
.layui-slider-wrap-btn{width: 12px; height: 12px; border-radius: 50%; background: #FFF; display: inline-block; vertical-align: middle; cursor: pointer; transition: 0.3s;}
.layui-slider-wrap:after{content: ""; height: 100%; display: inline-block; vertical-align: middle;}
.layui-slider-wrap-btn:hover,
.layui-slider-wrap-btn:hover,
.layui-slider-wrap-btn.layui-slider-hover{transform: scale(1.2);}
.layui-slider-wrap-btn.layui-disabled:hover{transform: scale(1) !important;}
.layui-slider-tips{position: absolute; top: -42px; z-index: 77777777; white-space:nowrap; display: none; -webkit-transform: translateX(-50%); transform: translateX(-50%); color: #FFF; background: #000; border-radius: 3px; height: 25px; line-height: 25px; padding: 0 10px;}
@ -1644,7 +1652,7 @@ body .layui-util-face .layui-layer-content{padding:0; background-color:#fff; co
.layui-anim-fadein{-webkit-animation-name: layui-fadein; animation-name: layui-fadein;}
/* 渐隐 */
@-webkit-keyframes layui-fadeout {
@-webkit-keyframes layui-fadeout {
0% {opacity: 1;}
100% {opacity: 0;}
}

@ -60,6 +60,7 @@
,transfer: 'transfer' //穿梭框
,tree: 'tree' //树结构
,table: 'table' //表格
,treeTable: 'treeTable' //树表
,element: 'element' //常用元素操作
,rate: 'rate' //评分组件
,colorpicker: 'colorpicker' //颜色选择器

@ -48,6 +48,9 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
,reload: function(options){
that.reload.call(that, options);
}
,reloadData: function(options){
dropdown.reloadData(id, options);
}
,close: function () {
that.remove()
}
@ -83,14 +86,14 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
};
//重载实例
Class.prototype.reload = function(options){
Class.prototype.reload = function(options, type){
var that = this;
that.config = $.extend({}, that.config, options);
that.init(true);
that.init(true, type);
};
// 初始化准备
Class.prototype.init = function(rerender){
Class.prototype.init = function(rerender, type){
var that = this;
var options = that.config;
@ -113,7 +116,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
var newThat = thisModule.getThis(elem.data(MOD_INDEX));
if(!newThat) return;
return newThat.reload(options);
return newThat.reload(options, type);
}
options.elem = $(options.elem);
@ -122,13 +125,13 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
options.id = 'id' in options ? options.id : (
elem.attr('id') || that.index
);
if(options.show) that.render(rerender); // 初始即显示
if(options.show || (type === 'reloadData' && that.elemView && $('body').find(that.elemView.get(0)).length)) that.render(rerender, type); //初始即显示或者面板弹出之后执行了刷新数据
that.events(); // 事件
};
//渲染
Class.prototype.render = function(rerender){
Class.prototype.render = function(rerender, type){
var that = this
,options = that.config
,elemBody = $('body')
@ -234,7 +237,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
}
//主模板
,TPL_MAIN = ['<div class="layui-dropdown layui-border-box layui-panel layui-anim layui-anim-downbit">'
,TPL_MAIN = ['<div class="layui-dropdown layui-border-box layui-panel layui-anim layui-anim-downbit" lay-id="' + options.id + '">'
,'</div>'].join('');
//如果是右键事件,则每次触发事件时,将允许重新渲染
@ -244,26 +247,39 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
if(!rerender && options.elem.data(MOD_INDEX +'_opened')) return;
//记录模板对象
that.elemView = $(TPL_MAIN);
that.elemView.append(options.content || getDefaultView());
//初始化某些属性
if(options.className) that.elemView.addClass(options.className);
if(options.style) that.elemView.attr('style', options.style);
//记录当前执行的实例索引
dropdown.thisId = options.id;
//插入视图
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.elemView = $('.' + STR_ELEM + '[lay-id="' + options.id + '"]');
if (type === 'reloadData' && that.elemView.length) {
that.elemView.html(options.content || getDefaultView());
} else {
that.elemView = $(TPL_MAIN);
that.elemView.append(options.content || getDefaultView());
//初始化某些属性
if(options.className) that.elemView.addClass(options.className);
if(options.style) that.elemView.attr('style', options.style);
//记录当前执行的实例索引
dropdown.thisId = options.id;
//插入视图
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);
//如果是鼠标移入事件,则鼠标移出时自动关闭
if(options.trigger === 'mouseenter'){
that.elemView.on('mouseenter', function(){
clearTimeout(thisModule.timer);
}).on('mouseleave', function(){
that.delayRemove();
});
}
}
//坐标定位
that.position();
thisModule.prevElem = that.elemView; //记录当前打开的元素,以便在下次关闭
@ -304,15 +320,6 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
thisModule.spread(elemGroup);
}
});
//如果是鼠标移入事件,则鼠标移出时自动关闭
if(options.trigger === 'mouseenter'){
that.elemView.on('mouseenter', function(){
clearTimeout(thisModule.timer);
}).on('mouseleave', function(){
that.delayRemove();
});
}
// 组件打开完毕的事件
typeof options.ready === 'function' && options.ready(
@ -545,14 +552,34 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
};
// 重载实例
dropdown.reload = function(id, options){
dropdown.reload = function(id, options, type){
var that = thisModule.getThis(id);
if(!that) return this;
that.reload(options);
that.reload(options, type);
return thisModule.call(that);
};
// 仅重载数据
dropdown.reloadData = function(){
var args = $.extend([], arguments);
args[2] = 'reloadData';
// 重载时,与数据相关的参数
var dataParams = new RegExp('^('+ [
'data', 'templet', 'content'
].join('|') + ')$');
// 过滤与数据无关的参数
layui.each(args[1], function (key, value) {
if(!dataParams.test(key)){
delete args[1][key];
}
});
return dropdown.reload.apply(null, args);
};
// 核心入口
dropdown.render = function(options){
var inst = new Class(options);

@ -98,9 +98,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
itemElem[0].checked = value;
} else if(type === 'radio') { // 如果为单选框
itemElem.each(function(){
if(this.value == value ){
this.checked = true
}
this.checked = this.value == value;
});
} else { // 其它类型的表单
itemElem.val(value);
@ -644,7 +642,12 @@ layui.define(['lay', 'layer', 'util'], function(exports){
var title = (check.attr('title')||'').split('|');
if(check[0].disabled) return;
if (check[0].indeterminate) {
check[0].indeterminate = false;
reElem.find('.layui-icon-subtraction').removeClass('layui-icon-subtraction').addClass('layui-icon-ok')
}
check[0].checked ? (
check[0].checked = false
,reElem.removeClass(RE_CLASS[1]).find('em').text(title[1])
@ -688,7 +691,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 复选框
"checkbox": [
(title[0] ? ('<span>'+ util.escape(title[0]) +'</span>') : '')
,'<i class="layui-icon layui-icon-ok"></i>'
,'<i class="layui-icon '+(skin === 'primary' && !check.checked && othis.get(0).indeterminate ? 'layui-icon-subtraction' : 'layui-icon-ok')+'"></i>'
].join(''),
// 开关

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save