mirror of https://github.com/layui/layui
				
				
				
			
						commit
						8aae232eb8
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
{
 | 
			
		||||
  "name": "layui",
 | 
			
		||||
  "version": "2.8.0-rc.9",
 | 
			
		||||
  "version": "2.8.0-rc.10",
 | 
			
		||||
  "description": "Classic modular Front-End UI library",
 | 
			
		||||
  "main": "dist/layui.js",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -617,8 +617,6 @@ a cite{font-style: normal; *cursor:pointer;}
 | 
			
		|||
.layui-text h4{font-size: 16px;}
 | 
			
		||||
.layui-text h5{font-size: 14px;}
 | 
			
		||||
.layui-text h6{font-size: 13px;}
 | 
			
		||||
.layui-text a:not(.layui-btn){color: #01AAED;}
 | 
			
		||||
.layui-text a:not(.layui-btn):hover{text-decoration: underline;}
 | 
			
		||||
.layui-text ul,
 | 
			
		||||
.layui-text ol{padding-left: 15px;}
 | 
			
		||||
.layui-text ul li{margin-top: 5px; list-style-type: disc;}
 | 
			
		||||
| 
						 | 
				
			
			@ -628,6 +626,8 @@ a cite{font-style: normal; *cursor:pointer;}
 | 
			
		|||
.layui-text p{margin: 15px 0;}
 | 
			
		||||
.layui-text p:first-child{margin-top: 0;}
 | 
			
		||||
.layui-text p:last-child{margin-bottom: 0;}
 | 
			
		||||
.layui-text a:not(.layui-btn){color: #01AAED;}
 | 
			
		||||
.layui-text a:not(.layui-btn):hover{text-decoration: underline;}
 | 
			
		||||
.layui-text blockquote:not(.layui-elem-quote){padding: 5px 15px; border-left: 5px solid #eee;}
 | 
			
		||||
.layui-text pre > code:not(.layui-code){padding: 15px; font-family: Courier New,Lucida Console,Consolas; background-color: #FAFAFA;}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -889,8 +889,9 @@ a cite{font-style: normal; *cursor:pointer;}
 | 
			
		|||
.layui-laypage select{border: 1px solid #eee;}
 | 
			
		||||
.layui-laypage a,
 | 
			
		||||
.layui-laypage span{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; padding: 0 15px; height: 28px; line-height: 28px; margin: 0 -1px 5px 0; background-color: #fff; color: #333; font-size: 12px;}
 | 
			
		||||
.layui-laypage a{color: #333 !important; text-decoration: none !important;}
 | 
			
		||||
.layui-laypage a:hover{color: #009688 !important;}
 | 
			
		||||
.layui-laypage a[data-page]{color: #333;}
 | 
			
		||||
.layui-laypage a{text-decoration: none !important; cursor: pointer;}
 | 
			
		||||
.layui-laypage a:hover{color: #009688;}
 | 
			
		||||
.layui-laypage em{font-style: normal;}
 | 
			
		||||
.layui-laypage .layui-laypage-spr{color:#999; font-weight: 700;}
 | 
			
		||||
.layui-laypage .layui-laypage-curr{position: relative;}
 | 
			
		||||
| 
						 | 
				
			
			@ -1172,17 +1173,17 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
 | 
			
		|||
.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;}
 | 
			
		||||
.layui-nav{position: relative; padding: 0 15px; background-color: #393D49; color: #fff; border-radius: 2px; font-size: 0; box-sizing: border-box;}
 | 
			
		||||
.layui-nav *{font-size: 14px;}
 | 
			
		||||
.layui-nav .layui-nav-item{position: relative; display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; line-height: 60px;}
 | 
			
		||||
.layui-nav .layui-nav-item{position: relative; display: inline-block; *display: inline; *zoom: 1; margin-top: 0; list-style: none; vertical-align: middle; line-height: 60px;}
 | 
			
		||||
.layui-nav .layui-nav-item a{display: block; padding: 0 20px; color: #fff; color: rgba(255,255,255,.7); transition: all .3s; -webkit-transition: all .3s;}
 | 
			
		||||
.layui-nav-bar,
 | 
			
		||||
.layui-nav .layui-this:after{content: ""; position: absolute; left: 0; top: 0; width: 0; height: 5px; background-color: #5FB878; transition: all .2s; -webkit-transition: all .2s; pointer-events: none;}
 | 
			
		||||
.layui-nav-bar{z-index: 1000;}
 | 
			
		||||
.layui-nav[lay-bar="disabled"] .layui-nav-bar{display: none;}
 | 
			
		||||
.layui-nav[lay-bar="disabled"].layui-this:after{}
 | 
			
		||||
.layui-nav .layui-this a
 | 
			
		||||
,.layui-nav .layui-nav-item a:hover{color: #fff;}
 | 
			
		||||
.layui-nav .layui-this a,
 | 
			
		||||
.layui-nav .layui-nav-item a:hover{color: #fff; text-decoration: none;}
 | 
			
		||||
.layui-nav .layui-this:after{top: auto; bottom: 0; width: 100%;}
 | 
			
		||||
.layui-nav-img{width: 30px; height: 30px; margin-right: 10px; border-radius: 50%;}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1200,7 +1201,8 @@ body .layui-table-tips .layui-layer-content{background: none; padding: 0; box-sh
 | 
			
		|||
.layui-nav-child-r{left: auto; right: 0;}
 | 
			
		||||
.layui-nav-child-c{text-align: center;}
 | 
			
		||||
 | 
			
		||||
/* 垂直导航菜单 */.layui-nav-tree{width: 200px; padding: 0;}
 | 
			
		||||
/* 垂直导航菜单 */
 | 
			
		||||
.layui-nav.layui-nav-tree{width: 200px; padding: 0;}
 | 
			
		||||
.layui-nav-tree .layui-nav-item{display: block; width: 100%; line-height: 40px;}
 | 
			
		||||
.layui-nav-tree .layui-nav-item a{position: relative; height: 40px; line-height: 40px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
 | 
			
		||||
.layui-nav-tree .layui-nav-item>a{padding-top: 5px; padding-bottom: 5px;}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,7 +77,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
 | 
			
		|||
.layui-layer-dialog .layui-layer-content .layui-layer-face{position: absolute; top: 18px; left: 16px; color: #959595; font-size: 24px; _left: -40px;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-tips{color: #F39B12;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-ok{color: #5FB878;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-close-fill{color: #FF5722;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-close-fill{top: 19px; font-size: 28px; color: #FF5722;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-password{color: #787878;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-face-cry{color: #FF5722;}
 | 
			
		||||
.layui-layer-dialog .layui-layer-content .layui-icon-face-smile{color: #5FB878;}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  ,Layui = function(){
 | 
			
		||||
    this.v = '2.8.0-rc.9'; // Layui 版本号
 | 
			
		||||
    this.v = '2.8.0-rc.10'; // Layui 版本号
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  //识别预先可能定义的指定全局对象
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,6 +106,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
 | 
			
		|||
        var elemPreviewViewHas = othis.next('.' + CONST.ELEM_ITEM +'-preview');
 | 
			
		||||
 | 
			
		||||
        if(options.id) elemView.attr('id', options.id);
 | 
			
		||||
        elemView.addClass(options.className);
 | 
			
		||||
        elemTabView.attr('lay-filter', FILTER_VALUE);
 | 
			
		||||
 | 
			
		||||
        // 标签头
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,8 +23,13 @@ var isLayui = window.layui && layui.define, $, win, ready = {
 | 
			
		|||
    ,GLOBAL = window.LAYUI_GLOBAL || {};
 | 
			
		||||
    return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
 | 
			
		||||
  }(),
 | 
			
		||||
 | 
			
		||||
  config: {removeFocus: true}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [],
 | 
			
		||||
  config: {
 | 
			
		||||
    removeFocus: true
 | 
			
		||||
  }, 
 | 
			
		||||
  end: {}, 
 | 
			
		||||
  events: {resize: {}}, 
 | 
			
		||||
  minStackIndex: 0,
 | 
			
		||||
  minStackArr: [],
 | 
			
		||||
  btn: ['确定', '取消'],
 | 
			
		||||
 | 
			
		||||
  //五种原始层模式
 | 
			
		||||
| 
						 | 
				
			
			@ -586,12 +591,17 @@ Class.pt.offset = function(){
 | 
			
		|||
    that.offsetLeft += win.scrollLeft();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if(layero.attr('minLeft')){
 | 
			
		||||
  // 最小化窗口时的自适应
 | 
			
		||||
  if(layero.data('maxminStatus') === 'min'){
 | 
			
		||||
    that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
 | 
			
		||||
    that.offsetLeft = layero.css('left');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  layero.css({top: that.offsetTop, left: that.offsetLeft});
 | 
			
		||||
  // 设置坐标
 | 
			
		||||
  layero.css({
 | 
			
		||||
    top: that.offsetTop, 
 | 
			
		||||
    left: that.offsetLeft
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//Tips
 | 
			
		||||
| 
						 | 
				
			
			@ -899,8 +909,9 @@ Class.pt.openLayer = function(){
 | 
			
		|||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//记录宽高坐标,用于还原
 | 
			
		||||
// 记录宽高坐标,用于还原
 | 
			
		||||
ready.record = function(layero){
 | 
			
		||||
  if(!layero[0]) return window.console && console.error('index error');
 | 
			
		||||
  var area = [
 | 
			
		||||
    layero[0].style.width || layero.width(),
 | 
			
		||||
    layero[0].style.height || layero.height(),
 | 
			
		||||
| 
						 | 
				
			
			@ -953,15 +964,16 @@ layer.iframeSrc = function(index, url){
 | 
			
		|||
  $('#'+ doms[0] + index).find('iframe').attr('src', url);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//设定层的样式
 | 
			
		||||
// 设定层的样式
 | 
			
		||||
layer.style = function(index, options, limit){
 | 
			
		||||
  var layero = $('#'+ doms[0] + index)
 | 
			
		||||
  ,contElem = layero.find('.layui-layer-content')
 | 
			
		||||
  ,type = layero.attr('type')
 | 
			
		||||
  ,titHeight = layero.find(doms[1]).outerHeight() || 0
 | 
			
		||||
  ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
 | 
			
		||||
  ,minLeft = layero.attr('minLeft');
 | 
			
		||||
  var layero = $('#'+ doms[0] + index);
 | 
			
		||||
  var contElem = layero.find('.layui-layer-content');
 | 
			
		||||
  var type = layero.attr('type');
 | 
			
		||||
  var titHeight = layero.find(doms[1]).outerHeight() || 0;
 | 
			
		||||
  var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
 | 
			
		||||
  var minLeft = layero.attr('minLeft');
 | 
			
		||||
  
 | 
			
		||||
  // loading 和 tips 层不允许更改
 | 
			
		||||
  if(type === ready.type[3] || type === ready.type[4]){
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -975,7 +987,6 @@ layer.style = function(index, options, limit){
 | 
			
		|||
      options.height = 64 + titHeight + btnHeight;
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  layero.css(options);
 | 
			
		||||
  btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
 | 
			
		||||
  
 | 
			
		||||
| 
						 | 
				
			
			@ -992,46 +1003,54 @@ layer.style = function(index, options, limit){
 | 
			
		|||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//最小化
 | 
			
		||||
// 最小化
 | 
			
		||||
layer.min = function(index, options){
 | 
			
		||||
  options = options || {};
 | 
			
		||||
  var layero = $('#'+ doms[0] + index);
 | 
			
		||||
 | 
			
		||||
  var layero = $('#'+ doms[0] + index);
 | 
			
		||||
  var maxminStatus = layero.data('maxminStatus');
 | 
			
		||||
  // 检查当前的状态是否已经是最小化
 | 
			
		||||
  if (maxminStatus === 'min') {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  // 当前处于最大化的状态 先恢初始状态再执行最小化
 | 
			
		||||
  if (maxminStatus === 'max') {
 | 
			
		||||
    layer.restore(index);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(maxminStatus === 'min') return; // 当前的状态是否已经是最小化
 | 
			
		||||
  if(maxminStatus === 'max') layer.restore(index); // 若当前为最大化,则先还原后再最小化
 | 
			
		||||
 | 
			
		||||
  layero.data('maxminStatus', 'min');
 | 
			
		||||
 | 
			
		||||
  var shadeo = $('#'+ doms.SHADE + index);
 | 
			
		||||
  var titHeight = layero.find(doms[1]).outerHeight() || 0;
 | 
			
		||||
  var left = layero.attr('minLeft') || (181*ready.minIndex)+'px';
 | 
			
		||||
  var position = layero.css('position')
 | 
			
		||||
  var minLeft = layero.attr('minLeft'); // 最小化时的横坐标
 | 
			
		||||
  var hasMinLeft = typeof minLeft === 'string'; // 是否已经赋值过最小化坐标
 | 
			
		||||
  var left = hasMinLeft ? minLeft : (181*ready.minStackIndex)+'px';
 | 
			
		||||
  var position = layero.css('position');
 | 
			
		||||
  var minWidth = 180; // 最小化时的宽度
 | 
			
		||||
  var settings = {
 | 
			
		||||
    width: 180
 | 
			
		||||
    width: minWidth
 | 
			
		||||
    ,height: titHeight
 | 
			
		||||
    ,position: 'fixed'
 | 
			
		||||
    ,overflow: 'hidden'
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  //记录宽高坐标,用于还原
 | 
			
		||||
  ready.record(layero);
 | 
			
		||||
  
 | 
			
		||||
  if(ready.minLeft[0]){
 | 
			
		||||
    left = ready.minLeft[0];
 | 
			
		||||
    ready.minLeft.shift();
 | 
			
		||||
  ready.record(layero);  // 记录当前尺寸、坐标,用于还原
 | 
			
		||||
 | 
			
		||||
  // 简易最小化补位
 | 
			
		||||
  if(ready.minStackArr.length > 0){
 | 
			
		||||
    left = ready.minStackArr[0];
 | 
			
		||||
    ready.minStackArr.shift();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // left 是否超出边界
 | 
			
		||||
  if(parseFloat(left) + minWidth  > win.width()){
 | 
			
		||||
    left = win.width() - minWidth - function(){
 | 
			
		||||
      ready.minStackArr.edgeIndex = ready.minStackArr.edgeIndex || 0;
 | 
			
		||||
      return ready.minStackArr.edgeIndex += 3;
 | 
			
		||||
    }();
 | 
			
		||||
    if(left < 0) left = 0;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  //是否堆叠在左下角
 | 
			
		||||
  // 是否堆叠在左下角
 | 
			
		||||
  if(options.minStack){
 | 
			
		||||
    settings.left = left;
 | 
			
		||||
    settings.top = win.height() - titHeight;
 | 
			
		||||
    layero.attr('minLeft') || ready.minIndex++; //初次执行,最小化操作索引自增
 | 
			
		||||
    hasMinLeft || ready.minStackIndex++; // 若未赋值过最小化坐标,则最小化操作索引自增
 | 
			
		||||
    layero.attr('minLeft', left);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
| 
						 | 
				
			
			@ -1042,21 +1061,20 @@ layer.min = function(index, options){
 | 
			
		|||
  layero.attr('type') === 'page' && layero.find(doms[4]).hide();
 | 
			
		||||
  ready.rescollbar(index);
 | 
			
		||||
 | 
			
		||||
  //隐藏遮罩
 | 
			
		||||
  // 隐藏遮罩
 | 
			
		||||
  shadeo.hide();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//还原
 | 
			
		||||
// 还原
 | 
			
		||||
layer.restore = function(index){
 | 
			
		||||
  var layero = $('#'+ doms[0] + index);
 | 
			
		||||
  // 恢复最大最小状态
 | 
			
		||||
  layero.data('maxminStatus', '');
 | 
			
		||||
 | 
			
		||||
  var shadeo = $('#'+ doms.SHADE + index);
 | 
			
		||||
  var area = layero.attr('area').split(',');
 | 
			
		||||
  var type = layero.attr('type');
 | 
			
		||||
 | 
			
		||||
  layero.removeData('maxminStatus'); // 移除最大最小状态
 | 
			
		||||
  
 | 
			
		||||
  //恢复原来尺寸
 | 
			
		||||
  // 恢复原来尺寸
 | 
			
		||||
  layer.style(index, {
 | 
			
		||||
    width: area[0], // 数值或百分比
 | 
			
		||||
    height: area[1],
 | 
			
		||||
| 
						 | 
				
			
			@ -1068,28 +1086,25 @@ layer.restore = function(index){
 | 
			
		|||
  
 | 
			
		||||
  layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
 | 
			
		||||
  layero.find('.layui-layer-min').show();
 | 
			
		||||
  layero.attr('type') === 'page' && layero.find(doms[4]).show();
 | 
			
		||||
  layero.attr('minLeft', '');
 | 
			
		||||
  type === 'page' && layero.find(doms[4]).show();
 | 
			
		||||
  ready.rescollbar(index);
 | 
			
		||||
  
 | 
			
		||||
  //恢复遮罩
 | 
			
		||||
  // 恢复遮罩
 | 
			
		||||
  shadeo.show();
 | 
			
		||||
  ready.events.resize[index]();
 | 
			
		||||
  // ready.events.resize[index](); // ?
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//全屏
 | 
			
		||||
// 全屏(最大化)
 | 
			
		||||
layer.full = function(index){
 | 
			
		||||
  var layero = $('#'+ doms[0] + index), timer;
 | 
			
		||||
  // 检查当前的状态是否已经是最小化
 | 
			
		||||
  var maxminStatus = layero.data('maxminStatus');
 | 
			
		||||
  if (maxminStatus === 'max') {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (maxminStatus === 'min') {
 | 
			
		||||
    layer.restore(index);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(maxminStatus === 'max') return // 检查当前的状态是否已经是最大化
 | 
			
		||||
  if(maxminStatus === 'min') layer.restore(index); // 若当前为最小化,则先还原后再最大化
 | 
			
		||||
 | 
			
		||||
  layero.data('maxminStatus', 'max');
 | 
			
		||||
  ready.record(layero);
 | 
			
		||||
  ready.record(layero); // 记录当前尺寸、坐标
 | 
			
		||||
 | 
			
		||||
  if(!doms.html.attr('layer-full')){
 | 
			
		||||
    doms.html.css('overflow','hidden').attr('layer-full', index);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -1167,9 +1182,10 @@ layer.close = function(index, callback){
 | 
			
		|||
  layer.ie == 6 && ready.reselect();
 | 
			
		||||
  ready.rescollbar(index); 
 | 
			
		||||
  
 | 
			
		||||
  if(layero.attr('minLeft')){
 | 
			
		||||
    ready.minIndex--;
 | 
			
		||||
    ready.minLeft.push(layero.attr('minLeft'));
 | 
			
		||||
  // 记住被关闭层的最小化堆叠坐标
 | 
			
		||||
  if(typeof layero.attr('minLeft') === 'string'){
 | 
			
		||||
    ready.minStackIndex--;
 | 
			
		||||
    ready.minStackArr.push(layero.attr('minLeft'));
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ layui.define(function(exports){
 | 
			
		|||
      //上一页
 | 
			
		||||
      prev: function(){
 | 
			
		||||
        return config.prev 
 | 
			
		||||
          ? '<a href="javascript:;" class="layui-laypage-prev'+ (config.curr == 1 ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr - 1) +'">'+ config.prev +'</a>'
 | 
			
		||||
          ? '<a class="layui-laypage-prev'+ (config.curr == 1 ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr - 1) +'">'+ config.prev +'</a>'
 | 
			
		||||
        : '';
 | 
			
		||||
      }()
 | 
			
		||||
      
 | 
			
		||||
| 
						 | 
				
			
			@ -99,7 +99,7 @@ layui.define(function(exports){
 | 
			
		|||
        
 | 
			
		||||
        //首页
 | 
			
		||||
        if(index > 1 && config.first !== false && groups !== 0){
 | 
			
		||||
          pager.push('<a href="javascript:;" class="layui-laypage-first" data-page="1"  title="首页">'+ (config.first || 1) +'</a>');
 | 
			
		||||
          pager.push('<a class="layui-laypage-first" data-page="1"  title="首页">'+ (config.first || 1) +'</a>');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //计算当前页码组的起始页
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +126,7 @@ layui.define(function(exports){
 | 
			
		|||
            //当前页
 | 
			
		||||
            pager.push('<span class="layui-laypage-curr"><em class="layui-laypage-em" '+ (/^#/.test(config.theme) ? 'style="background-color:'+ config.theme +';"' : '') +'></em><em>'+ start +'</em></span>');
 | 
			
		||||
          } else {
 | 
			
		||||
            pager.push('<a href="javascript:;" data-page="'+ start +'">'+ start +'</a>');
 | 
			
		||||
            pager.push('<a data-page="'+ start +'">'+ start +'</a>');
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ layui.define(function(exports){
 | 
			
		|||
            pager.push('<span class="layui-laypage-spr">…</span>');
 | 
			
		||||
          }
 | 
			
		||||
          if(groups !== 0){
 | 
			
		||||
            pager.push('<a href="javascript:;" class="layui-laypage-last" title="尾页"  data-page="'+ config.pages +'">'+ (config.last || config.pages) +'</a>');
 | 
			
		||||
            pager.push('<a class="layui-laypage-last" title="尾页"  data-page="'+ config.pages +'">'+ (config.last || config.pages) +'</a>');
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +146,7 @@ layui.define(function(exports){
 | 
			
		|||
      //下一页
 | 
			
		||||
      ,next: function(){
 | 
			
		||||
        return config.next 
 | 
			
		||||
          ? '<a href="javascript:;" class="layui-laypage-next'+ (config.curr == config.pages ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr + 1) +'">'+ config.next +'</a>'
 | 
			
		||||
          ? '<a class="layui-laypage-next'+ (config.curr == config.pages ? (' ' + DISABLED) : '') +'" data-page="'+ (config.curr + 1) +'">'+ config.next +'</a>'
 | 
			
		||||
        : '';
 | 
			
		||||
      }()
 | 
			
		||||
      
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ layui.define(function(exports){
 | 
			
		|||
      }()
 | 
			
		||||
      
 | 
			
		||||
      //刷新当前页
 | 
			
		||||
      ,refresh: ['<a href="javascript:;" data-page="'+ config.curr +'" class="layui-laypage-refresh">'
 | 
			
		||||
      ,refresh: ['<a data-page="'+ config.curr +'" class="layui-laypage-refresh">'
 | 
			
		||||
        ,'<i class="layui-icon layui-icon-refresh"></i>'
 | 
			
		||||
      ,'</a>'].join('')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,8 +20,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
  var table = {
 | 
			
		||||
    config: { // 全局配置项
 | 
			
		||||
      checkName: 'LAY_CHECKED' // 是否选中状态的特定字段名
 | 
			
		||||
      ,indexName: 'LAY_TABLE_INDEX' // 初始下标索引名,用于恢复当前页表格排序
 | 
			
		||||
      ,numbersName: 'LAY_INDEX' // 序号
 | 
			
		||||
      ,indexName: 'LAY_INDEX' // 初始下标索引名,用于恢复当前页表格排序
 | 
			
		||||
      ,numbersName: 'LAY_NUM' // 序号
 | 
			
		||||
      ,disabledName: 'LAY_DISABLED' // 禁用状态的特定字段名
 | 
			
		||||
    }
 | 
			
		||||
    ,cache: {} // 数据缓存
 | 
			
		||||
| 
						 | 
				
			
			@ -343,7 +343,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
    }, options.response);
 | 
			
		||||
    
 | 
			
		||||
    //如果 page 传入 laypage 对象
 | 
			
		||||
    if(typeof options.page === 'object'){
 | 
			
		||||
    if(options.page !== null && typeof options.page === 'object'){
 | 
			
		||||
      options.limit = options.page.limit || options.limit;
 | 
			
		||||
      options.limits = options.page.limits || options.limits;
 | 
			
		||||
      that.page = options.page.curr = options.page.curr || 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -927,8 +927,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
        
 | 
			
		||||
    if(options.url){ // Ajax请求
 | 
			
		||||
      var params = {};
 | 
			
		||||
      params[request.pageName] = curr;
 | 
			
		||||
      params[request.limitName] = options.limit;
 | 
			
		||||
      // 当 page 开启,默认自动传递 page、limit 参数
 | 
			
		||||
      if(options.page){
 | 
			
		||||
        params[request.pageName] = curr;
 | 
			
		||||
        params[request.limitName] = options.limit;
 | 
			
		||||
      }
 | 
			
		||||
      
 | 
			
		||||
      // 参数
 | 
			
		||||
      var data = $.extend(params, options.where);
 | 
			
		||||
| 
						 | 
				
			
			@ -1402,7 +1405,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
  };
 | 
			
		||||
  
 | 
			
		||||
  // 标记行选中状态
 | 
			
		||||
  Class.prototype.setRowChecked = function(opts, onlyStyle){
 | 
			
		||||
  Class.prototype.setRowChecked = function(opts, selectedStyle){
 | 
			
		||||
    var that = this;
 | 
			
		||||
    var options = that.config;
 | 
			
		||||
    var ELEM_CLICK = 'layui-table-click';
 | 
			
		||||
| 
						 | 
				
			
			@ -1416,12 +1419,12 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
    }, opts);
 | 
			
		||||
    
 | 
			
		||||
    // 标注当前行选中样式
 | 
			
		||||
    if(opts.type !== 'checkbox' && !opts.isAll){
 | 
			
		||||
    if(opts.type !== 'checkbox' && opts.index !== 'all'){
 | 
			
		||||
      tr.addClass(ELEM_CLICK).siblings('tr').removeClass(ELEM_CLICK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 仅设置样式状态
 | 
			
		||||
    if(onlyStyle) return;
 | 
			
		||||
    if(opts.selectedStyle || selectedStyle) return;
 | 
			
		||||
 | 
			
		||||
    // 同步数据选中属性值
 | 
			
		||||
    var thisData = table.cache[that.key];
 | 
			
		||||
| 
						 | 
				
			
			@ -2130,6 +2133,8 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
      var checked = radio[0].checked;
 | 
			
		||||
      var index = radio.parents('tr').eq(0).data('index');
 | 
			
		||||
 | 
			
		||||
      if(radio[0].disabled) return;
 | 
			
		||||
 | 
			
		||||
      // 单选框选中状态
 | 
			
		||||
      that.setRowChecked({
 | 
			
		||||
        type: 'radio',
 | 
			
		||||
| 
						 | 
				
			
			@ -2137,9 +2142,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
      });
 | 
			
		||||
 | 
			
		||||
      // 事件
 | 
			
		||||
      layui.event.call(this, MOD_NAME, 'radio('+ filter +')', commonMember.call(this, {
 | 
			
		||||
        checked: checked
 | 
			
		||||
      }));
 | 
			
		||||
      layui.event.call(
 | 
			
		||||
        radio[0], 
 | 
			
		||||
        MOD_NAME, 'radio('+ filter +')', 
 | 
			
		||||
        commonMember.call(radio[0], {
 | 
			
		||||
          checked: checked
 | 
			
		||||
        })
 | 
			
		||||
      );
 | 
			
		||||
    });
 | 
			
		||||
    
 | 
			
		||||
    // 行事件
 | 
			
		||||
| 
						 | 
				
			
			@ -2159,7 +2168,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
 | 
			
		|||
      setRowEvent.call(this, 'rowDouble');
 | 
			
		||||
    }).on('contextmenu', 'tr', function(e){ //菜单
 | 
			
		||||
      if (!options.defaultContextmenu) e.preventDefault();
 | 
			
		||||
      setRowEvent.call(this, 'contextmenu');
 | 
			
		||||
      setRowEvent.call(this, 'rowContextmenu');
 | 
			
		||||
    });;
 | 
			
		||||
    
 | 
			
		||||
    // 创建行单击、双击、菜单事件
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue