META-INF.web.lib.js.jquery.jquery.resizable.columns.js Maven / Gradle / Ivy
var __bind=function(d,c){return function(){return d.apply(c,arguments)}},__slice=[].slice;(function(f,d){var e;e=(function(){a.prototype.defaults={store:d.store,rigidSizing:false};function a(c,h){this.mousedown=__bind(this.mousedown,this);var b=this;this.options=f.extend({},this.defaults,h);this.$table=c;this.tableId=this.$table.data("resizable-columns-id");this.createHandles();this.restoreColumnWidths();this.syncHandleWidths();f(d).on("resize.rc",(function(){return b.syncHandleWidths()}))}a.prototype.destroy=function(){this.$handleContainer.remove();this.$table.removeData("resizableColumns");return f(d).off(".rc")};a.prototype.createHandles=function(){var b=this;this.$table.before((this.$handleContainer=f("")));this.$table.find("tr th").each(function(j,i){var c;if(b.$table.find("tr th").eq(j+1).length===0||(b.$table.find("tr th").eq(j).attr("data-noresize")!=null)||(b.$table.find("tr th").eq(j+1).attr("data-noresize")!=null)){return}c=f("");c.data("th",f(i));return c.appendTo(b.$handleContainer)});return this.$handleContainer.on("mousedown",".rc-handle",this.mousedown)};a.prototype.syncHandleWidths=function(){var b=this;this.$handleContainer.width(this.$table.width());return this.$handleContainer.find(".rc-handle").each(function(h,c){return f(c).css({left:f(c).data("th").outerWidth()+(f(c).data("th").offset().left-b.$handleContainer.offset().left),height:b.$table.find("th").outerHeight()})})};a.prototype.saveColumnWidths=function(){var b=this;return this.$table.find("tr th").each(function(j,i){var c;if(f(i).attr("data-noresize")==null){c=b.tableId+"-"+f(i).data("resizable-column-id");if(b.options.store!=null){return store.set(c,f(i).width())}}})};a.prototype.restoreColumnWidths=function(){var b=this;return this.$table.find("tr th").each(function(l,j){var c,k;c=b.tableId+"-"+f(j).data("resizable-column-id");if((b.options.store!=null)&&(k=store.get(c))){return f(j).width(k)}})};a.prototype.mousedown=function(p){var q,r,c,s,n,o,b=this;p.preventDefault();this.startPosition=p.pageX;q=f(p.currentTarget);r=q.data("th");n=r.width();s=this.$table.find("tr th").index(q.data("th"));c=this.$table.find("tr th").eq(s+1);o=c.width();f(document).on("mousemove.rc",function(h){var g,i,j;g=h.pageX-b.startPosition;j=o-g;i=n+g;if(b.options.rigidSizing&&((parseInt(c[0].style.width)