layui.define([],function(t){var o=layui.$,i={},u=o("body");t("mstable",{render:function(t){i[t.id]=t;var e=this;layui.each(i,function(){!function(d,l){var t=o(l.elem),e=t.next().children(".layui-table-box").children(".layui-table-header").children("table").children("thead").children("tr").children("th"),i=t.next().children(".layui-table-box").children(".layui-table-fixed").children(".layui-table-header").children("table").children("thead").children("tr").children("th"),r=t.next().children(".layui-table-box").children(".layui-table-body").children("table").children("tbody").children("tr"),c=t.next().children(".layui-table-total").find("tr");String.prototype.width=function(t){var e=t||u.css("font"),t=o("<div>"+this+"</div>").css({position:"absolute",float:"left","white-space":"nowrap",visibility:"hidden",font:e}).appendTo(u),e=t.width();return t.remove(),e},e.add(i).on("dblclick",function(t){var e=o(this),i=t.clientX-e.offset().left,t=e.attr("data-key").split("-"),t=l.cols[t[1]][t[2]];s(0,e,0<e.parents(".layui-table-fixed-r").length?i<=10:e.width()-i<=10,t),h(l,e,0<e.parents(".layui-table-fixed-r").length?i<=10:e.width()-i<=10,t)});var a=0,n=0;e.add(i).each(function(t,e){var i=o(this).attr("data-key").split("-"),i=l.cols[i[1]][i[2]];!0===i.withAuto&&(s(0,o(this),!0,i),"widthAutoSize"in i&&"widthAutoOld"in i&&(a+=i.widthAutoOld,a-=i.widthAutoSize,n++))}),0<a&&0<n&&e.add(i).each(function(t,e){var i=o(this).attr("data-key").split("-"),i=l.cols[i[1]][i[2]];!0===i.withAuto&&(i.width=i.widthAutoSize+a/n)});function h(t,e,i,l){var a=e.data("key"),n=a.split("-");3===n.length&&(n[1],n[2]);1<e.attr("colspan")||e.data("unresize")||i&&d.getCssRule(t,a,function(t){t.style.width=l.width+"px"})}function s(t,e,i,l){var a,n,d=e.data("key"),h=d.split("-");3===h.length&&(h[1],h[2]);1<e.attr("colspan")||e.data("unresize")||i&&(l.widthAutoOld=e.width(),a=e.text().width(e.css("font"))+21,n=e.css("font"),r.children('td[data-key="'+d+'"]').each(function(t,e){var i=0;o(this).children().children()&&0<o(this).children().children().length?i+=o(this).children().html().width(n):i=o(this).text().width(n),a<i&&(a=i)}),0<c.length&&(d=c.children('td[data-key="'+d+'"]').text().width(n),a<d&&(a=d)),a+=32,a=Math.min(a,500),l.width=a,l.widthAutoSize=a)}e.add(i).each(function(t,e){var i=o(this).attr("data-key").split("-"),i=l.cols[i[1]][i[2]];!0===i.withAuto&&h(l,o(this),!0,i)})}(e,this)})},getCssRule:function(t,i,l){t=t.elem.next().find("style")[0],t=t.sheet||t.styleSheet||{},t=t.cssRules||t.rules;layui.each(t,function(t,e){if(e.selectorText===".laytable-cell-"+i)return l(e),!0})}})});