add table onColumnsWidth 修改宽度之后回调返回cols

This commit is contained in:
Theluyuan 2023-08-01 11:20:58 +08:00
parent 6a0e0fd6b1
commit bc8d400b01
17 changed files with 14 additions and 25166 deletions

1
dist/css/layui.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-view{display:block;position:relative;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#fafafa;color:#333;font-family:Courier New;font-size:13px}.layui-code-h3{position:relative;padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee;font-size:12px}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0c0c0c;border-left-color:#3f3f3f;background-color:#0c0c0c;color:#c2be9e}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3f3f3f;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

554
dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 299 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

24601
dist/layui.js vendored

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -65,8 +65,11 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
that.resize.call(that);
},
getData: function(){
console.log(that)
return that.config.data
},
// 设置列宽调整后的回调
onColumnsWidth: function(fun){
that.config.onColumnsWidth = fun;
}
}
}
@ -1291,7 +1294,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//同步选中值状态
Class.prototype.setCheckData = function(index, checked){
console.log("同步选中值状态",index,checked,this)
var that = this
,options = that.config
,thisData = table.cache[that.key];
@ -1376,16 +1378,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
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);
};
@ -1616,12 +1614,12 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
e.preventDefault();
dict.resizeStart = true; //开始拖拽
dict.offset = [e.clientX, e.clientY]; //记录初始坐标
that.getCssRule(key, function(item){
var width = item.style.width || othis.outerWidth();
dict.rule = item;
dict.ruleWidth = parseFloat(width);
dict.minWidth = othis.data('minwidth') || options.cellMinWidth;
dict.target = othis[0]
});
}
});
@ -1640,6 +1638,15 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
}
}).on('mouseup', function(e){
if(dict.resizeStart){
// 处理宽度
for(let j of that.config.cols){
for(let i of j){
if(i.field == dict.target.dataset.field){
i.width = dict.target.clientWidth
}
}
}
that.config.onColumnsWidth && that.config.onColumnsWidth(that.config.cols)
dict = {};
_BODY.css('cursor', '');
that.scrollPatch();