Compare commits
13 Commits
37443a5c45
...
2458e523ba
Author | SHA1 | Date | |
---|---|---|---|
2458e523ba | |||
cae4bc1af0 | |||
2ae835ecfe | |||
ee757f7f07 | |||
12eabbf7d5 | |||
|
f1140fa78f | ||
|
ab940e5df3 | ||
|
9dc31fa032 | ||
|
5822042a80 | ||
|
8cf6798137 | ||
|
42738cebf2 | ||
|
16e02f99ea | ||
|
146adba3fe |
2
dist/css/layui.css
vendored
2
dist/css/layui.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/modules/layer/default/layer.css
vendored
2
dist/css/modules/layer/default/layer.css
vendored
File diff suppressed because one or more lines are too long
1
dist/layui.js
vendored
1
dist/layui.js
vendored
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
,"msg": ""
|
||||
,"count": 3000000
|
||||
,"totalRow": {
|
||||
"experience": "777"
|
||||
"checkin": "777"
|
||||
}
|
||||
,"data": [{
|
||||
"id": "10001"
|
||||
@ -11,11 +11,12 @@
|
||||
,"email": "test1@email.com"
|
||||
,"sex": "<strong>男</strong>"
|
||||
,"city": "浙江杭州"
|
||||
,"sign": "鼠标移动到此处,可以通过点击单元格右侧的下拉图标,查看到被隐藏的全部内容。"
|
||||
,"sign": "舍南舍北皆春水,但见群鸥日日来。花径不曾缘客扫,蓬门今始为君开。盘飧市远无兼味,樽酒家贫只旧醅。肯与邻翁相对饮,隔篱呼取尽余杯。"
|
||||
,"experience": 7
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": 0
|
||||
,"checkin": 0
|
||||
,"joinTime": "2016-10-14"
|
||||
,"LAY_DISABLED": true
|
||||
}, {
|
||||
"id": "10002"
|
||||
,"username": "李白"
|
||||
@ -25,7 +26,7 @@
|
||||
,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
|
||||
,"experience": 9
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
,"LAY_CHECKED": true
|
||||
}, {
|
||||
@ -34,10 +35,10 @@
|
||||
,"email": "test3@email.com"
|
||||
,"sex": "男"
|
||||
,"city": "浙江杭州"
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"sign": "大江东去,浪淘尽,千古风流人物。故垒西边,人道是,三国周郎赤壁。乱石穿空,惊涛拍岸,卷起千堆雪。江山如画,一时多少豪杰。遥想公瑾当年,小乔初嫁了,雄姿英发。羽扇纶巾,谈笑间,樯橹灰飞烟灭。故国神游,多情应笑我,早生华发。人生如梦,一尊还酹江月。"
|
||||
,"experience": 8
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": null
|
||||
,"checkin": null
|
||||
,"joinTime": "2016-10-14"
|
||||
}, {
|
||||
"id": "10004"
|
||||
@ -48,7 +49,7 @@
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"experience": 6
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}, {
|
||||
"id": "10005"
|
||||
@ -59,7 +60,7 @@
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"experience": 64
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}, {
|
||||
"id": "10006"
|
||||
@ -70,7 +71,7 @@
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"experience": 65
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}, {
|
||||
"id": "10007"
|
||||
@ -81,7 +82,7 @@
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"experience": 49
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}, {
|
||||
"id": "10008"
|
||||
@ -92,7 +93,7 @@
|
||||
,"sign": "人生恰似一场修行"
|
||||
,"experience": 5
|
||||
,"ip": "192.168.0.8"
|
||||
,"logins": "106"
|
||||
,"checkin": "106"
|
||||
,"joinTime": "2016-10-14"
|
||||
}]
|
||||
}
|
@ -21,7 +21,6 @@
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="isAll">是否全选</button>
|
||||
|
||||
@ -85,7 +84,21 @@ layui.use(['table', 'dropdown'], function(){
|
||||
var laytpl = layui.laytpl;
|
||||
var dropdown = layui.dropdown;
|
||||
var form = layui.form;
|
||||
|
||||
|
||||
|
||||
// 仅用于各类测试的表头
|
||||
var test_cols = [[
|
||||
{type: 'checkbox', fixed: 'left'}
|
||||
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
|
||||
,{field:'username', title:'用户名', width:120, edit: 'text'}
|
||||
,{field:'email', title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, width:150, edit: 'text'}
|
||||
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
||||
,{field:'city', title:'城市', width: 120}
|
||||
,{field:'sign', title:'签名'}
|
||||
,{field: 'experience', title: '积分', width:80, sort: true, align:'center', totalRow: '{{ d.TOTAL_NUMS }} 😊'}
|
||||
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
|
||||
]];
|
||||
|
||||
// 全局设定某参数
|
||||
table.set({
|
||||
where: {
|
||||
@ -97,9 +110,6 @@ layui.use(['table', 'dropdown'], function(){
|
||||
//,height: 300
|
||||
});
|
||||
|
||||
$('#appendtest').append($('#TPL_appendtest').html())
|
||||
table.init('appendtest');
|
||||
|
||||
//渲染
|
||||
window.ins1 = table.render({
|
||||
elem: '#test'
|
||||
@ -109,7 +119,7 @@ layui.use(['table', 'dropdown'], function(){
|
||||
,url: 'json/table/demo1.json'
|
||||
|
||||
,pagebar: '#pagebarDemo' // 分页栏模板
|
||||
,lineStyle: 'height: 100px;' // 行样式
|
||||
,lineStyle: 'height: 95px;' // 行样式
|
||||
,css: [ // 自定义样式
|
||||
'.layui-table-page{text-align: right;}'
|
||||
,'.layui-table-pagebar{float: left;}'
|
||||
@ -120,7 +130,9 @@ layui.use(['table', 'dropdown'], function(){
|
||||
//,autoSort: false //是否自动排序。如果否,则由服务端排序
|
||||
//,loading: false
|
||||
,totalRow: true
|
||||
,page: true
|
||||
,page: {
|
||||
// curr: layui.data('tableCache').curr || 1 // 读取记录中的页码,赋值给起始页
|
||||
}
|
||||
,limit: 30
|
||||
,toolbar: '#toolbarDemo'
|
||||
,defaultToolbar: ['filter', 'exports', 'print', {
|
||||
@ -129,17 +141,7 @@ layui.use(['table', 'dropdown'], function(){
|
||||
,icon: 'layui-icon-tips'
|
||||
}]
|
||||
//,escape: false
|
||||
,cols: !1 ? [[ //仅用于测试
|
||||
{type: 'checkbox', fixed: 'left'}
|
||||
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
|
||||
,{field:'username', title:'用户名', width:120, edit: 'text'}
|
||||
,{field:'email', title:'邮箱 <i class="layui-icon layui-icon-email"></i>', hide: 0, width:150, edit: 'text'}
|
||||
,{field:'sex', title:'性别', width:80, edit: 'text', sort: true}
|
||||
,{field:'city', title:'城市', width:120}
|
||||
,{field:'sign', title:'签名'}
|
||||
,{field: 'experience', title: '积分', width:80, sort: true, align:'center', totalRow: '{{ d.TOTAL_NUMS }} 😊'}
|
||||
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
|
||||
]] : [[
|
||||
,cols: !1 ? test_cols : [[
|
||||
{type: 'checkbox', fixed: 'left'}
|
||||
,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计:'}
|
||||
,{field:'username', title:'用户名', width:120, edit: 'text', templet: '#usernameTpl'}
|
||||
@ -152,15 +154,16 @@ layui.use(['table', 'dropdown'], function(){
|
||||
var td = obj.td(this.field); //获取当前 td
|
||||
return td.find('select').val();
|
||||
}}
|
||||
,{field:'sign', title:'签名', edit: 'textarea'}
|
||||
,{field: 'experience', title: '积分', width:80, sort: true, align:'center', totalRow: '{{ d.TOTAL_NUMS }} 😊', templet: '<div>{{ d.experience }} 分</div>'}
|
||||
,{field:'ip', title:'IP', width: 120}
|
||||
,{field:'logins', title:'登入次数', width: 100, sort: true, totalRow: '{{ parseInt(d.TOTAL_NUMS) }} 次'}
|
||||
,{field:'sign', title:'签名', minWidth: 200, style:'color: #5FB878', edit: 'textarea'}
|
||||
,{field: 'experience', title: '积分', width: 100, sort: true, align:'center', totalRow: !1 || '{{= d.TOTAL_NUMS }} 分 😊', templet: '<div><a href="" class="layui-table-link">{{ d.experience }}</a> 分</div>'}
|
||||
,{field:'ip', title:'IP', width: 120, align: 'right'}
|
||||
,{field:'checkin', title:'打卡', width: 100, sort: true, totalRow: '{{= parseInt(d.TOTAL_NUMS) }} 次'}
|
||||
,{field:'joinTime', title:'加入时间', width: 120}
|
||||
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width: 180}
|
||||
]]
|
||||
|
||||
,initSort1: {
|
||||
//,autoSort: false // 禁用前端自动排序
|
||||
,initSort11111: { // 初始排序状态
|
||||
field: 'experience' //排序字段,对应 cols 设定的各字段名
|
||||
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序
|
||||
}
|
||||
@ -172,9 +175,17 @@ layui.use(['table', 'dropdown'], function(){
|
||||
,key: 'experience'
|
||||
,order: 'asc'
|
||||
}
|
||||
,done: function(){
|
||||
,done: function(res, curr, count){
|
||||
var id = this.id;
|
||||
|
||||
// 记录当前页码
|
||||
/*
|
||||
layui.data('tableCache', {
|
||||
key: 'curr',
|
||||
value: curr
|
||||
});
|
||||
*/
|
||||
|
||||
// 重载测试
|
||||
dropdown.render({
|
||||
elem: '#reloadTest' //可绑定在任意元素中,此处以上述按钮为例
|
||||
@ -326,19 +337,20 @@ layui.use(['table', 'dropdown'], function(){
|
||||
|
||||
//排序事件
|
||||
table.on('sort(test)', function(obj){
|
||||
console.log(obj);
|
||||
//console.log(obj);
|
||||
|
||||
return;
|
||||
//return;
|
||||
layer.msg('服务端排序。order by '+ obj.field + ' ' + obj.type);
|
||||
|
||||
//服务端排序
|
||||
table.reload('test', {
|
||||
initSort: obj
|
||||
//,page: {curr: 1} //重新从第一页开始
|
||||
,where: { //重新请求服务端
|
||||
key: obj.field //排序字段
|
||||
,order: obj.type //排序方式
|
||||
table.reloadData('test', {
|
||||
//initSort: obj,
|
||||
//page: {curr: 1}, //重新从第一页开始
|
||||
where: { // 向服务端传入排序参数
|
||||
key: obj.field, //排序字段
|
||||
order: obj.type //排序方式
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
});
|
||||
|
||||
// 工具栏事件
|
||||
@ -351,10 +363,6 @@ layui.use(['table', 'dropdown'], function(){
|
||||
var data = checkStatus.data;
|
||||
layer.alert(layui.util.escape(JSON.stringify(data)));
|
||||
break;
|
||||
case 'getCheckLength':
|
||||
var data = checkStatus.data;
|
||||
layer.msg('选中了:'+ data.length + ' 个');
|
||||
break;
|
||||
case 'getData':
|
||||
var getData = table.getData(id);
|
||||
console.log(getData);
|
||||
|
@ -201,6 +201,7 @@ layui.use('table', function(){
|
||||
//,height: 300
|
||||
,cellMinWidth: 80
|
||||
//,skin: 'line'
|
||||
//,size: 'lg'
|
||||
,toolbar: true
|
||||
,cols: [[
|
||||
{field: 'id', hide: true}
|
||||
@ -236,7 +237,7 @@ layui.use('table', function(){
|
||||
,{field: 'sex', title: '性别', width: 80}
|
||||
,{field: 'city', title: '城市', width: 100}
|
||||
// ,{field: 'experience', title: '积分', width: 80, sort: true}
|
||||
,{field: 'experience', title: '积分', width: 80, sort: true, totalRow: true, totalRowDecimals: 3}
|
||||
,{field: 'experience', title: '积分', width: 80, sort: true, totalRow: '{{= parseInt(d.TOTAL_NUMS) }}'}
|
||||
]]
|
||||
,data: [{
|
||||
"id": "10001"
|
||||
|
@ -49,12 +49,7 @@ const js = () => {
|
||||
let src = [
|
||||
'./src/**/{layui,layui.all,'+ config.modules +'}.js'
|
||||
];
|
||||
return gulp.src(src).pipe(uglify({
|
||||
output: {
|
||||
ascii_only: true //escape Unicode characters in strings and regexps
|
||||
},
|
||||
ie: true
|
||||
})).pipe(concat('layui.js', {newLine: ''}))
|
||||
return gulp.src(src).pipe(concat('layui.js', {newLine: ''}))
|
||||
.pipe(header.apply(null, config.comment))
|
||||
.pipe(gulp.dest(dest));
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "layui",
|
||||
"realname": "layui",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.1",
|
||||
"description": "Classic modular Front-End UI library",
|
||||
"main": "dist/layui.js",
|
||||
"license": "MIT",
|
||||
|
@ -723,6 +723,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-form-checkbox[lay-skin="primary"]:hover i{border-color: #5FB878; color: #fff;}
|
||||
.layui-form-checked[lay-skin="primary"] i{border-color: #5FB878 !important; background-color: #5FB878; color: #fff;}
|
||||
.layui-checkbox-disabled[lay-skin="primary"] span{background: none!important; color: #c2c2c2!important;}
|
||||
.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;}
|
||||
|
||||
@ -950,6 +951,8 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-table-cell{height: 38px; line-height: 28px; padding: 6px 15px; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box;}
|
||||
.layui-table-cell .layui-form-checkbox[lay-skin="primary"]{top: -1px; padding: 0;}
|
||||
.layui-table-cell .layui-table-link{color: #01AAED;}
|
||||
.layui-table-cell[align="center"]{-webkit-box-pack: center;}
|
||||
.layui-table-cell[align="right"]{-webkit-box-pack: end;}
|
||||
|
||||
.laytable-cell-checkbox,
|
||||
.laytable-cell-radio,
|
||||
@ -991,7 +994,7 @@ a cite{font-style: normal; *cursor:pointer;}
|
||||
.layui-table-view select[lay-ignore]{display: inline-block;}
|
||||
.layui-table-patch .layui-table-cell{padding: 0; width: 30px;}
|
||||
|
||||
.layui-table-edit{position: absolute; left: 0; top: 0; z-index: 900; min-width: 100%; min-height: 100%; padding: 0 14px 1px; border-radius: 0; box-shadow: 1px 1px 20px rgba(0,0,0,.15); background-color: #fff;}
|
||||
.layui-table-edit{position: absolute; left: 0; top: 0; z-index: 900; min-width: 100%; min-height: 100%; padding: 5px 14px; border-radius: 0; box-shadow: 1px 1px 20px rgba(0,0,0,.15); background-color: #fff;}
|
||||
.layui-table-edit:focus{border-color: #5FB878!important;}
|
||||
select.layui-table-edit{padding: 0 0 0 10px; border-color: #d2d2d2;}
|
||||
.layui-table-view .layui-form-switch,
|
||||
|
@ -177,3 +177,49 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;}
|
||||
}
|
||||
|
||||
|
||||
/* 下面是添加的新的加载动画 */
|
||||
.loading {
|
||||
width: 83px;
|
||||
height: 83px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
-webkit-filter: url("#goo");
|
||||
filter: url("#goo");
|
||||
}
|
||||
.loading span {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: linear-gradient(to right, #92fe9d 0%, #00c9ff 100%);
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
font-size: 15px;
|
||||
letter-spacing: 1px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
top: 46%;
|
||||
}
|
||||
.loading:before, .loading:after {
|
||||
content: '';
|
||||
border-radius: 50%;
|
||||
background-color: rgb(22, 120, 160);
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
left: 72px;
|
||||
top: 8px;
|
||||
animation: rotate 6s linear;
|
||||
animation-iteration-count: infinite;
|
||||
transform-origin: 12px 76px;
|
||||
}
|
||||
.loading:before {
|
||||
box-shadow: 45px 19px 0px 0px rgb(22, 120, 160), 62px 63px 0px 0px rgb(22, 120, 160), 45px 107px 0px 0px rgb(22, 120, 160), 0px 126px 0px 0px rgb(22, 120, 160), -46px 107px 0px 0px rgb(22, 120, 160), -63px 63px 0px 0px rgb(22, 120, 160), -46px 19px 0px 0px rgb(22, 120, 160);
|
||||
}
|
||||
.loading:after {
|
||||
animation-direction: reverse;
|
||||
}
|
||||
@keyframes rotate {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(-360deg); }
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
,Layui = function(){
|
||||
this.v = '2.7.0'; // layui 版本号
|
||||
this.v = '2.7.1'; // layui 版本号
|
||||
}
|
||||
|
||||
//识别预先可能定义的指定全局对象
|
||||
|
@ -253,7 +253,13 @@ Class.pt.vessel = function(conType, callback){
|
||||
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
|
||||
+ (titype ? config.title[0] : config.title)
|
||||
+ '</div>' : '');
|
||||
|
||||
var lodingf = function (){
|
||||
if(config.type != 3){
|
||||
return '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
|
||||
}else{
|
||||
return `<div id="${config.id||''}" style="scale: 0.5"><div class="loading"> </div> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <filter id="goo"> <feGaussianBlur in="SourceGraphic" stdDeviation="6.3" result="blur" /> <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 14 -4" result="goo" /> <feBlend in="SourceGraphic" in2="goo" /> </filter> </defs> </svg>`
|
||||
}
|
||||
}
|
||||
config.zIndex = zIndex;
|
||||
callback([
|
||||
//遮罩
|
||||
@ -262,7 +268,7 @@ Class.pt.vessel = function(conType, callback){
|
||||
//主体
|
||||
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + ';position:'+ (config.fixed ? 'fixed;' : 'absolute;') +'">'
|
||||
+ (conType && config.type != 2 ? '' : titleHTML)
|
||||
+ '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
|
||||
+ lodingf() // 这行是中间加载
|
||||
+ (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
|
||||
+ (config.type == 1 && conType ? '' : (config.content||''))
|
||||
+ '</div>'
|
||||
|
@ -20,6 +20,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
config: {
|
||||
checkName: 'LAY_CHECKED' //是否选中状态的字段名
|
||||
,indexName: 'LAY_TABLE_INDEX' //初始下标索引名,用于恢复排序
|
||||
,disabledName: 'LAY_DISABLED'
|
||||
} //全局配置项
|
||||
,cache: {} //数据缓存
|
||||
,index: layui.table ? (layui.table.index + 10000) : 0
|
||||
@ -233,11 +234,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,' }'
|
||||
,'{{# });'
|
||||
,'}); }}'
|
||||
,'{{# if(d.data.lineStyle){ }}'
|
||||
,'.layui-table-view-{{= d.index }} .layui-table-body .layui-table .layui-table-cell{'
|
||||
,' display: -webkit-box; -webkit-box-align: center; display: -moz-box; -moz-box-align: center; white-space: normal; {{- d.data.lineStyle }} '
|
||||
,'{{# if(d.data.lineStyle){'
|
||||
,'var cellClassName = ".layui-table-view-"+ d.index +" .layui-table-body .layui-table .layui-table-cell";'
|
||||
,'}}'
|
||||
,'{{= cellClassName }}{'
|
||||
,'display: -webkit-box; -webkit-box-align: center; white-space: normal; {{- d.data.lineStyle }} '
|
||||
,'}'
|
||||
,'.layui-table-view-{{= d.index }} .layui-table-body .layui-table .layui-table-cell:hover{overflow: auto;}'
|
||||
,'{{= cellClassName }}:hover{overflow: auto;}'
|
||||
,'{{# } }}'
|
||||
,'{{# if(d.data.css){ }}'
|
||||
,'{{- d.data.css }}'
|
||||
@ -353,7 +356,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
othis.after(reElem);
|
||||
|
||||
//各级容器
|
||||
|
||||
that.layTool = reElem.find(ELEM_TOOL);
|
||||
that.layBorderBox = reElem;
|
||||
that.layBox = reElem.find(ELEM_BOX);
|
||||
that.layHeader = reElem.find(ELEM_HEADER);
|
||||
that.layMain = reElem.find(ELEM_MAIN);
|
||||
@ -429,7 +434,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
if(type === 'width') return options.clientWidth;
|
||||
|
||||
// 初始化 css 参数
|
||||
if(options.css){
|
||||
if(options.css && options.css.indexOf(ELEM_VIEW) === -1){
|
||||
var css = options.css.split('}');
|
||||
layui.each(css, function(index, value){
|
||||
if(value){
|
||||
@ -756,13 +761,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
that.layMain.append(that.layNone = layNone);
|
||||
|
||||
// 异常情况下对page和total的内容处理
|
||||
that.layPage && that.layPage.addClass(HIDE).find('>div').html('');
|
||||
that.layTotal && that.layTotal.addClass(HIDE).find('tbody').html('');
|
||||
that.layPage && that.layPage.addClass(HIDE_V).find('>div').html('');
|
||||
that.layTotal && that.layTotal.addClass(HIDE_V).find('tbody').html('');
|
||||
|
||||
table.cache[that.key] = []; //格式化缓存数据
|
||||
};
|
||||
|
||||
//页码
|
||||
// 初始页码
|
||||
Class.prototype.page = 1;
|
||||
|
||||
//获得数据
|
||||
@ -896,7 +901,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
if(item3.templet) attr.push('data-content="'+ content +'"'); //自定义模板
|
||||
if(item3.toolbar) attr.push('data-off="true"'); //行工具列关闭单元格事件
|
||||
if(item3.event) attr.push('lay-event="'+ item3.event +'"'); //自定义事件
|
||||
if(item3.style) attr.push('style="'+ item3.style +'"'); //自定义样式
|
||||
if(item3.minWidth) attr.push('data-minwidth="'+ item3.minWidth +'"'); //单元格最小宽度
|
||||
return attr.join(' ');
|
||||
}() +' class="'+ function(){ //追加样式
|
||||
@ -908,31 +912,52 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,'<div class="layui-table-cell laytable-cell-'+ function(){ //返回对应的CSS类标识
|
||||
return item3.type === 'normal' ? key
|
||||
: (key + ' laytable-cell-' + item3.type);
|
||||
}() +'"'+ (item3.align ? ' align="'+ item3.align +'"' : '') +'>' + function(){
|
||||
}() +'"'
|
||||
+ (item3.align ? ' align="'+ item3.align +'"' : '')
|
||||
+ function(){
|
||||
var attr = [];
|
||||
if(item3.style) attr.push('style="'+ item3.style +'"'); //自定义单元格样式
|
||||
return attr.join(' ');
|
||||
}() +'>'
|
||||
+ function(){
|
||||
var tplData = $.extend(true, {
|
||||
LAY_INDEX: numbers
|
||||
,LAY_COL: item3
|
||||
}, item1)
|
||||
,checkName = table.config.checkName;
|
||||
,checkName = table.config.checkName
|
||||
,disabledName = table.config.disabledName;
|
||||
|
||||
//渲染不同风格的列
|
||||
switch(item3.type){
|
||||
case 'checkbox':
|
||||
case 'checkbox': // 复选
|
||||
return '<input type="checkbox" name="layTableCheckbox" lay-skin="primary" '+ function(){
|
||||
// 其他属性
|
||||
var arr = [];
|
||||
|
||||
//如果是全选
|
||||
if(item3[checkName]){
|
||||
item1[checkName] = item3[checkName];
|
||||
return item3[checkName] ? 'checked' : '';
|
||||
if(item3[checkName]) arr[0] = 'checked';
|
||||
}
|
||||
return tplData[checkName] ? 'checked' : '';
|
||||
if(tplData[checkName]) arr[0] = 'checked';
|
||||
|
||||
// 禁选
|
||||
if(tplData[disabledName]) arr.push('disabled');
|
||||
|
||||
return arr.join(' ');
|
||||
}() +'>';
|
||||
break;
|
||||
case 'radio':
|
||||
case 'radio': // 单选
|
||||
if(tplData[checkName]){
|
||||
thisCheckedRowIndex = i1;
|
||||
}
|
||||
return '<input type="radio" name="layTableRadio_'+ options.index +'" '
|
||||
+ (tplData[checkName] ? 'checked' : '') +' lay-type="layTableRadio">';
|
||||
+ function(){
|
||||
var arr = [];
|
||||
if(tplData[checkName]) arr[0] = 'checked';
|
||||
if(tplData[disabledName]) arr.push('disabled');
|
||||
return arr.join(' ');
|
||||
}() +' lay-type="layTableRadio">';
|
||||
break;
|
||||
case 'numbers':
|
||||
return numbers;
|
||||
@ -961,7 +986,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
trs_fixed_r.push('<tr data-index="'+ i1 +'">'+ tds_fixed_r.join('') + '</tr>');
|
||||
});
|
||||
|
||||
// 容器的滚动条位置复位
|
||||
that.layBody.scrollTop(0);
|
||||
if(options.resetScrollbar){
|
||||
that.layBody.scrollLeft(0);
|
||||
}
|
||||
|
||||
that.layMain.find('.'+ NONE).remove();
|
||||
that.layMain.find('tbody').html(trs.join(''));
|
||||
that.layFixLeft.find('tbody').html(trs_fixed.join(''));
|
||||
@ -990,8 +1020,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
//that.layPage[(count == 0 || (data.length === 0 && curr == 1)) ? 'addClass' : 'removeClass'](HIDE);
|
||||
|
||||
//显示隐藏合计栏
|
||||
that.layTotal[data.length == 0 ? 'addClass' : 'removeClass'](HIDE_V);;
|
||||
|
||||
that.layTotal[data.length == 0 ? 'addClass' : 'removeClass'](HIDE_V);
|
||||
|
||||
//显示隐藏分页栏
|
||||
if(!options.pagebar){
|
||||
that.layPage[
|
||||
@ -1016,7 +1046,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
|
||||
//正常初始化数据渲染
|
||||
render(); //渲染数据
|
||||
that.renderTotal(data, totalRowData); //数据合计
|
||||
// 传data 合计当前页 传 全部data 合计全部页
|
||||
that.renderTotal(that.config.data, totalRowData); //数据合计
|
||||
that.layTotal && that.layTotal.removeClass(HIDE);
|
||||
|
||||
//同步分页状态
|
||||
@ -1077,7 +1108,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
//td 内容
|
||||
var content = function(){
|
||||
var text = item3.totalRowText || ''
|
||||
,decimals = item3.totalRowDecimals || 2
|
||||
,decimals = 'totalRowDecimals' in item3 ? item3.totalRowDecimals : 2
|
||||
,thisTotalNum = parseFloat(totalNums[field]).toFixed(decimals)
|
||||
,tplData = {}
|
||||
,getContent;
|
||||
@ -1097,7 +1128,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,td = ['<td data-field="'+ field +'" data-key="'+ options.index + '-'+ item3.key +'" '+ function(){
|
||||
var attr = [];
|
||||
if(item3.align) attr.push('align="'+ item3.align +'"'); //对齐方式
|
||||
if(item3.style) attr.push('style="'+ item3.style +'"'); //自定义样式
|
||||
if(item3.minWidth) attr.push('data-minwidth="'+ item3.minWidth +'"'); //单元格最小宽度
|
||||
return attr.join(' ');
|
||||
}() +' class="'+ function(){ //追加样式
|
||||
@ -1110,13 +1140,18 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
var str = (options.index + '-' + item3.key);
|
||||
return item3.type === 'normal' ? str
|
||||
: (str + ' laytable-cell-' + item3.type);
|
||||
}() +'">' + function(){
|
||||
}() +'"'+ function(){
|
||||
var attr = [];
|
||||
if(item3.style) attr.push('style="'+ item3.style +'"'); //自定义单元格样式
|
||||
return attr.join(' ');
|
||||
}() +'>' + function(){
|
||||
var totalRow = item3.totalRow || options.totalRow;
|
||||
|
||||
//如果 totalRow 参数为字符类型,则解析为自定义模版
|
||||
if(typeof totalRow === 'string'){
|
||||
return laytpl(totalRow).render($.extend({
|
||||
TOTAL_NUMS: content
|
||||
}, item3))
|
||||
TOTAL_NUMS: totalNums[field]
|
||||
}, item3));
|
||||
}
|
||||
return content;
|
||||
}()
|
||||
@ -1218,10 +1253,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
that.renderData(res, that.page, that.count, true);
|
||||
|
||||
if(formEvent){
|
||||
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', {
|
||||
options.initSort = {
|
||||
field: field
|
||||
,type: type
|
||||
});
|
||||
};
|
||||
layui.event.call(th, MOD_NAME, 'sort('+ filter +')', options.initSort);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1253,7 +1289,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
thisData[index][options.checkName] = checked;
|
||||
};
|
||||
|
||||
//同步全选按钮状态
|
||||
// 同步全选按钮状态
|
||||
Class.prototype.syncCheckAll = function(){
|
||||
var that = this
|
||||
,options = that.config
|
||||
@ -1303,7 +1339,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,options = that.config
|
||||
,height = options.height
|
||||
,bodyHeight;
|
||||
|
||||
if(that.fullHeightGap){
|
||||
height = _WIN.height() - that.fullHeightGap;
|
||||
if(height < 135) height = 135;
|
||||
@ -1329,6 +1364,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
if(options.page){
|
||||
bodyHeight -= (that.layPage.outerHeight() || 41);
|
||||
}
|
||||
// 减去筛选插件高度
|
||||
// console.log(this.layBorderBox.find(".soul-bottom-contion"))
|
||||
if(this.layBorderBox.find(".soul-bottom-contion")[0]){
|
||||
bodyHeight -= (this.layBorderBox.find(".soul-bottom-contion")[0].offsetHeight || 31);
|
||||
}
|
||||
console.log(bodyHeight,"bodyHeight")
|
||||
let h = bodyHeight - 2 - parseFloat(that.layMain.css('height'));
|
||||
// console.log(h)
|
||||
// that.layBody.css("height", parseFloat(that.layBody.css("height")) + h);
|
||||
// that.layBorderBox.css("height", parseFloat(that.layBorderBox.css("height")) + h);
|
||||
console.log(this.config)
|
||||
|
||||
that.layMain.css('height', bodyHeight - 2);
|
||||
};
|
||||
@ -1683,6 +1729,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,checked = checkbox[0].checked
|
||||
,isAll = checkbox.attr('lay-filter') === 'layTableAllChoose';
|
||||
|
||||
if(checkbox[0].disabled) return;
|
||||
|
||||
//全选
|
||||
if(isAll){
|
||||
childs.each(function(i, item){
|
||||
@ -1696,10 +1744,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
that.syncCheckAll();
|
||||
}
|
||||
|
||||
layui.event.call(checkbox[0], MOD_NAME, 'checkbox('+ filter +')', commonMember.call(checkbox[0], {
|
||||
checked: checked
|
||||
,type: isAll ? 'all' : 'one'
|
||||
}));
|
||||
// 事件
|
||||
layui.event.call(
|
||||
checkbox[0],
|
||||
MOD_NAME, 'checkbox('+ filter +')',
|
||||
commonMember.call(checkbox[0], {
|
||||
checked: checked,
|
||||
type: isAll ? 'all' : 'one'
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
//单选框选择
|
||||
@ -2067,6 +2120,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
,invalidNum = 0
|
||||
,arr = []
|
||||
,data = table.cache[id] || [];
|
||||
|
||||
//计算全选个数
|
||||
layui.each(data, function(i, item){
|
||||
if(layui.type(item) === 'array'){
|
||||
@ -2075,7 +2129,9 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
}
|
||||
if(item[table.config.checkName]){
|
||||
nums++;
|
||||
arr.push(table.clearCacheKey(item));
|
||||
if(!item[table.config.disabledName]){
|
||||
arr.push(table.clearCacheKey(item));
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
@ -2212,16 +2268,17 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
args[3] = 'reloadData';
|
||||
|
||||
// 过滤与数据无关的参数
|
||||
var dataParams = [
|
||||
var dataParams = new RegExp('^('+ [
|
||||
'data', 'url', 'where', 'page', 'limit',
|
||||
'request', 'response', 'parseData'
|
||||
];
|
||||
].join('|') + ')$');
|
||||
|
||||
layui.each(args[1], function (key, value) {
|
||||
if(dataParams.indexOf(key) === -1){
|
||||
if(!dataParams.test(key)){
|
||||
delete args[1][key];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return table.reload.apply(null, args);
|
||||
};
|
||||
|
||||
@ -2236,6 +2293,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
|
||||
data = $.extend({}, data);
|
||||
delete data[table.config.checkName];
|
||||
delete data[table.config.indexName];
|
||||
delete data[table.config.disabledName];
|
||||
return data;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user