text: !function(e,t,a,n){var i=function(t,a){this.$element=t,this.tableDefaults={showCheckbox:!0,showRowIndex:!1,rowIndexStart:1,columns:[],tableData:[],operationWidth:100,operation:null,primaryKey:"id"},this.columnDefaults={name:"columnName",title:"",field:"columnField",width:"100%",minWidth:50,align:"left",valueFilter:function(e){return e}},this.options=e.extend({},this.tableDefaults,a);for(var n=this.options.columns,i=n.length,l=0;i>l;l++){var o=n[l];n[l]=e.extend({},this.columnDefaults,o)}var d=this.options.operationWidth;this.options.operationWidth="number"==typeof d?d+"px":d};i.prototype={init:function(){function a(){var e=s.find("table"),t=r.height(),a=e.height();h.css({height:t-a+"px"})}function n(){var t=s.find("table th"),a=0,n=s.find("table").width();t.each(function(t,n){var i=e(n).data("colOpt"),l=i.width;i.autoWidthClass&&(l=i.minWidth),l=parseInt(l),a+=l}),t.each(a>n?function(t,a){var n=e(a);if(!n.hasClass("auto-width"))return!0;var i=n.data("colOpt"),l=parseInt(i.minWidth)+"px";n.css("width",l),h.find("table tr td:eq("+t+")").css("width",l)}:function(t,a){var n=e(a);if(!n.hasClass("auto-width"))return!0;var i=n.data("colOpt");n.css("width",i.width),h.find("table tr td:eq("+t+")").css("width",i.width)}),t.each(function(t,a){var n=e(a),i=n.data("colOpt"),l=n.width();if(i.autoWidthClass){var o=parseInt(i.minWidth);o>l&&(n.css("width",o),h.find("table tr td:eq("+t+")").css("width",o))}})}var i=this,l=i.options,o=l.columns,d=l.tableData,r=i.$element,c="w-table table table-hover table-bordered table-striped";r.html(e('<div class="top"><table class="'+c+'"></table></div><div class="center"><table class="'+c+'"></table></div>'));var s=(r.find(".center table"),r.find(".top")),h=r.find(".center"),u=e("<thead><tr></tr></thead>");if(l.showRowIndex){var f={isIndex:!0,name:"#",field:"columnField-index",width:40,align:"center"};f=e.extend({},i.columnDefaults,f),o.unshift(f)}if(l.showCheckbox){var w={isCheck:!0,name:'<input type="checkbox" value="main"/>',field:"columnField-check",width:40,align:"center"};w=e.extend({},i.columnDefaults,w),o.unshift(w)}if(l.operation){var p={isOperation:!0,name:"操作",field:"columnField-operation",width:l.operationWidth,align:"center"};p=e.extend({},i.columnDefaults,p),o.push(p)}for(var v=o.length,b=0;v>b;b++){var m=o[b],x=m.width,k="",y="auto-width";null!=x&&(x="number"==typeof x?x+"px":x,m.width=x,k="width:"+x+";",x.indexOf("%")<0&&(y="")),m.widthStr=k,m.autoWidthClass=y;var g=m.title?m.title:e("<div>"+m.name+"</div>").text(),C=e('<th class="'+y+'" style="'+k+'" title="'+g+'">'+m.name+"</th>");C.data("colOpt",m),u.find("tr").append(C)}return s.find("table").html(u),i.load(d),l.showCheckbox&&u.find("tr th input[type=checkbox][value=main]").iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",function(){e("td.w-table-check input[type=checkbox]").iCheck("check")}).on("ifUnchecked",function(){e("td.w-table-check input[type=checkbox]").iCheck("uncheck")}),h.on("scroll",function(){var t=e(this).scrollLeft();s.scrollLeft(t)}),a(),n(),e(t).on("resize",function(){a(),n()}),r},load:function(t,a){var n=this,i=n.$element,l=i.find(".top"),o=n.$element.find(".center table"),d=n.options,r=d.columns;d.rowIndexStart=a?a:d.rowIndexStart;var c=o.find("tbody");c.length<=0?(c=e("<tbody></tbody>"),o.append(c)):c.html("");for(var s=t.length,h=0;s>h;h++){var u=t[h],f=e("<tr></tr>");f.data("rowData",u);for(var w=r.length,p=0;w>p;p++){var v=r[p],b=v.field,m=v.align,x=(v.width,v.valueFilter),k=u[b],y="w-table-cell";if(v.isCheck){y="w-table-check";var g=u[d.primaryKey];k='<input type="checkbox" name="rowIndex" value="'+g+'">'}v.isIndex&&(y="w-table-index",k=h+parseInt(d.rowIndexStart)),v.isOperation&&(y="w-table-operation",k=d.operation(u,t)),k=x(k,u,t);var C=' title="'+e("<div>"+k+"</div>").text()+'" ';"string"==typeof k&&k.indexOf("<img")>=0&&(C="");var R=e('<td class="'+y+" "+v.autoWidthClass+'" style="'+v.widthStr+"text-align:"+m+'" '+C+">"+k+"</td>");R.data("colOpt",v),f.append(R)}c.append(f)}if(d.showCheckbox){var S=l.find("thead tr th input[type=checkbox][value=main]");S.iCheck("uncheck"),e("td.w-table-check input[type=checkbox]").iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",function(){var t=e(this),a=t.val(),n=t.parents("tr").data("rowData"),l=i.data("selectedRows")||{};l[a]=n,i.data("selectedRows",l)}).on("ifUnchecked",function(){var t=i.data("selectedRows")||{},a=e(this),n=a.val();delete t[n]});var D=i.data("selectedRows")||{};for(var I in D)o.find("td.w-table-check input[type=checkbox][value="+I+"]").iCheck("check")}return n.$element},deleteRow:function(e){var t=this,a=t.$element,n=a.data("selectedRows"),i=e.find("td.w-table-check input[type=checkbox]").val();return n&&(delete n[i],a.data("selectedRows",n)),e.remove(),a},deleteSelectedRows:function(){var e=this,t=e.$element,a=t.find(".top"),n=t.find(".center table"),i=t.data("selectedRows")||{};for(var l in i)n.find("td.w-table-check input[type=checkbox][value="+l+"]").parents("tr").remove();var o=a.find("thead tr th input[type=checkbox][value=main]");return o.iCheck("uncheck"),t.data("selectedRows",null),t},getSelectedRowsData:function(){var e=this,t=e.$element;return t.data("selectedRows")||null},rebuildRowsIndex:function(){var t=this,a=t.$element.find(".center table"),n=t.options;a.find("tbody tr").each(function(t,a){var i=e(a).index();e(a).find("td.w-table-index").html(i+n.rowIndexStart)})}},e.fn.wTable=function(t){if(this.length<=0)return this;this.data("_wtObj_")||this.data("_wtObj_",new i(this,t));var a=this.data("_wtObj_");if(t==n||"object"==typeof t&&!e.isFunction(t))return a.init();if("string"==typeof t)switch(t){case"load":var l=arguments[1],o=arguments[2];return a.load(l,o);case"getSelectedRowsCount":var d=0,r=a.getSelectedRowsData();if(r)for(var c in r)d++;return d;case"getSelectedRowsData":var r=a.getSelectedRowsData(),s=!1;for(var h in r){s=!0;break}return s?r:null;case"getSelectedRowsPrimaryKey":var r=a.getSelectedRowsData(),u=null;if(r){u=[];for(var c in r)u.push(c)}return u&&u.length>0?u:null;case"deleteSelectedRows":return a.deleteSelectedRows();case"deleteRow":return a.deleteRow(arguments[1]);default:throw"No such method!"}}}(jQuery,window,document);