!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("$")):"function"==typeof define&&define.amd?define(["$"],t):"object"==typeof exports?exports["g5-gridview"]=t(require("$")):e["g5-gridview"]=t(e.$)}(this,function(e){return function(e){function t(r){if(i[r])return i[r].exports;var s=i[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,i,r){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=24)}({11:function(e,t){e.exports={userAgent:navigator.userAgent.toLowerCase(),isMobile:function(){return/mobile/.test(this.userAgent)},isChrome:function(){return/chrom(e|ium)/.test(this.userAgent)}}},2:function(e,t){e.exports={math:{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}},ui:{getClientX:function(e){if(null==e)return null;null!=e.originalEvent&&(e=e.originalEvent);var t=e.touches&&e.touches[0]&&e.touches[0].clientX;return void 0===t?e.clientX:t},getOffsetLeft:function(e){for(var t=0;e;)t+=e.offsetLeft,e=e.offsetParent;return t}},func:{debounce:function(e){for(var t=arguments.length,i=Array(t>3?t-3:0),r=3;r1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;clearTimeout(e.tiid),e.tiid=setTimeout(function(){return e.apply(n,i)},s)},throttle:function(e){for(var t=arguments.length,i=Array(t>3?t-3:0),r=3;r1&&void 0!==arguments[1]?arguments[1]:100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;clearTimeout(e.tiid);var l=new Date;void 0===e.tdate||l-e.tdate>s?(e.apply(n,i),e.tdate=l):e.tiid=setTimeout(function(){return e.apply(n,i)},s)}}}},24:function(e,t,i){function r(e){this.columns=[],this._source=[],this.source=this._source,this.lang={all:"( All )",ok:"OK",reset:"Reset"},this.virtualCount=U,this.rowHeight=27,this.filterRowHeight=26,this.total=null,this.height=null,this.virtual=!1,this.startIndex=0,this.sortIndex=-1,this.sortDirection=1,this.selectedColumnIndex=-1,this.selectedIndexes=[],this.canMultiSelect=!1,this.allowHtml=!1,this.oddStyle=!1,this.$parent=e,this.$el=null,this.$refs={},this.$elems={},this.$window=window,this.willselect=null,this.selectedrowchanged=null,this.celldblclick=null,this.cellclick=null,this.rowdblclick=null,this.columnchanged=null}function s(e){return Array.prototype.slice.call(e.parentNode.children).indexOf(e)}function n(e,t){(t||!this._innerwidth&&!this._isdragging&&this._istouchdown)&&(delete this._istouchdown,this.sortable&&"INPUT"!==e.target.tagName&&"data-column-header-filter"!==e.target.className&&!e.target.classList.contains("arrow")&&"use"!==e.target.tagName.toLowerCase()&&_.call(e.data,this))}function l(e,t){if(null==e)return"";var i=e[t];return void 0===i&&(i=e),i}function o(e,t){var i=l(e,t);return Array.isArray(i)?i.join(","):i}function a(e,t){for(var i={},r=0;r'),a=L(""),d=L('').data("item",n),c=void 0;if(this.filterCustom||"function"!=typeof this.filter)c=l(n,"DisplayValue");else{var f={};f[this.key]=n,c=this.filter(f)}d.data("text",c).prop("checked",n.__checked).on("change",r),a.append(d),a.append(L(''));var u=L("").text(c);a.append(u),o.append(a),e.append(o)}}function f(e,t,i,r){t.children(".data-filter-items-sizeholder").remove(),t.children(".data-filter-items-contentholder").remove();var s=e.filterRowHeight,n=i.length*s;this.__filterHeight=n;var l=L('
').css("height",n);t.append(l);var a=L('
').css("top",s);t.data("items",i);for(var d=0;d=0}var f=void 0;f=i.length>12?i.slice(0,12):i,c.call(this,a,f,r),t.append(a)}function u(e,t){var i=e.filterRowHeight;if((t-=t%(2*i)+i)<0)t=0;else{var r=this.__filterHeight-12*i;r<0&&(r=0),t>r&&(t=r)}if(this.__filterTop!==t){this.__filterTop=t;var s=t/i;this.__filterStartIndex=s;var n=this.__itemHolder.data("items");n=s+12').on("mousedown",function(e){return e.stopPropagation()}).on("touchstart",function(e){return e.stopPropagation()}),c=L(e.currentTarget).parent(),g=c.offset(),p=c.width();n.css({top:g.top+c.height(),left:g.left+(p>200?p-200:0)});var v=L('
');if(this.__itemHolder=v,"function"==typeof this.onFillItems){v.css("overflow-y","hidden");var y=!1;if("function"==typeof this.onFillSearch){var m=this.onFillSearch();if(null!=m){var b=L('
');b.append(m),n.append(b),y=!0}}y?v.css("height",250):v.css("height",280),n.append(v),this.onFillItems(v,n)}else{var w=null;if(!1!==this.allowSearch){var x=L('
');w=L('');var _=function(e){return e.data.focus()},$=L('').on("mouseup",w,_).on("touchend",w,_);x.append(w,$),n.append(x)}v[0].addEventListener("scroll",function(e){A.throttle(u,G,t,i,e.target.scrollTop)},{passive:!0});var C=L('
'),k=L(""),I=L('');this.__checkboxAll=I,k.append(I),k.append(L('')),k.append(L("").text(i.lang.all)),C.append(k),v.append(C);var T=void 0;T=null!=this.filterSource?"function"==typeof this.filterSource?this.filterSource.call(i,this):this.filterSource:a.call(i.innerSource,this.key,"Value").sort(function(e,t){return e=o(e,"Value"),t=o(t,"Value"),e>t?1:e0&&T[0]!==Object(T[0])){O=[];for(var H=0;H=0});f.call(e.data.column,e.data.grid,v,i,I)}):v.css("height",255),I.on("change",function(e){var t=v.children(".data-filter-items-contentholder").find(".data-filter-items-item input"),i=L(e.target).prop("checked"),r=void 0;for(r=0;r'),N=L('').val(i.lang.reset).on("click",function(){delete t.filterValues,"function"==typeof t.onFilterReset?t.onFilterReset(e):(i.refreshGrid(),"function"==typeof t.afterFilter&&t.afterFilter(i)),s(),L(e.currentTarget).removeClass("filtered").addClass("no-filter")});V.append(N);var W=L('').val(i.lang.ok).on("click",function(){if("function"==typeof t.onFilterOK)t.onFilterOK(e);else{var r=v.data("items").filter(function(e){return!1!==e.__checked}),n=r.map(function(e){var t=l(e,"Value");return Array.isArray(t)?t.join(","):t});t.filterValues=n,i.refreshGrid(),"function"==typeof t.afterFilter&&t.afterFilter(i),L(e.currentTarget).removeClass("no-filter").addClass("filtered")}s()});V.append(W),n.append(V)}r.append(n),setTimeout(function(){return n.addClass("active")},1)}function p(e){var t=this;if(this._istouchdown=!0,!1!==this.orderable&&!this.isfixed&&"INPUT"!==e.target.tagName&&"data-column-header-filter"!==e.target.className&&!e.target.classList.contains("arrow")&&"use"!==e.target.tagName.toLowerCase()){var i=E.getClientX(e),r=s(e.currentTarget),l=function(s){var n=E.getClientX(s),l=n-i,o=t._isdragging;!o&&(l>Y||l<-Y)&&(o=!0,t._isdragging=!0),o&&l!==t._offset&&(b.call(e.data,r,l,n),t._offset=l)},o=function(i){L(e.data.$window||window).off(".dragging"),t._isdragging?(delete t._isdragging,delete t._offset,w.call(e.data,r)):i.originalEvent&&i.originalEvent.touches&&n.call(t,i)},a=A.throttle.bind(this,l,G,null);L(e.data.$window||window).on("mousemove.dragging",a).on("mouseup.dragging",o).on("touchmove.dragging",a).on("touchend.dragging",o)}}function v(e){var t=this;e.stopPropagation(),e.preventDefault();var i=E.getClientX(e),r=this.width,n=s(e.currentTarget.parentNode);if(this.isfixed){for(var l=0,o=0;o=0&&(this.$el_fixed[0].style.width=this._baseWidth+t+1+"px"));var l=this.$elems.gridbodyContent.children;if(l.length>0)for(var o=0;o0)for(var a=0;a=0&&t>=0&&((s=r[l])&&!((" "+s.className+" ").indexOf(" data-column-header ")<0));l-=1){if(ts.offsetWidth/2?l:l+1;break}t-=s.offsetWidth}null==n&&(n=0),null!=this.fixedColumns&&n=0;a+=1){if(!(s=r[a])||(" "+s.className+" ").indexOf(" data-column-header ")<0){n=a;break}if(ts.offsetWidth/2?a+1:a;break}t-=s.offsetWidth}null==n&&(n=o-1)}if(n!==this._orderIndex){if(this._orderIndex=n,!(s=r[n]))return;this.$refs.draggerCursor.css("left",s.offsetLeft)}}function w(e){if(this.$refs.dragger.hide(),this.$refs.draggerCursor.hide(),this._orderIndex>=0&&this._orderIndex!==e){var t=this._orderIndex-e;if(t>=0&&t<=1)return;var i=this.$refs.header[0].children,r=this.$elems.gridbodyContent.children,s=this.$refs.total&&this.$refs.gridtotalbody[0].children;if(t>1){t=this._orderIndex-1;for(var n=e;nt;a-=1){var d=this.columns[a];this.columns[a]=this.columns[a-1],this.columns[a-1]=d}L(i[e]).insertBefore(i[t]);for(var h=0;h0?"asc":"desc"),d&&(d.className="arrow "+(this.sortDirection>0?"asc":"desc"))):"arrow"!==a.className&&(a.className="arrow",d&&(d.className="arrow"))}}var h=void 0;h=null==e.sortFilter?function(t,i){var s=t.Values[e.key],n=i.Values[e.key];if(void 0!==s&&void 0!==n||!e.filter?(t=s,i=n):(t=e.filter(t.Values),i=e.filter(i.Values)),null!=t&&void 0!==t.Value&&(t=t.Value),null!=i&&void 0!==i.Value&&(i=i.Value),null==t&&"number"==typeof i)t=0;else if("number"==typeof t&&null==i)i=0;else{if(null!=t&&null==i)return r.sortDirection;"string"==typeof t&&"string"==typeof i&&(t=t.toLowerCase(),i=i.toLowerCase())}return t===i?0:(t>i?1:-1)*r.sortDirection}:function(t,i){return e.sortFilter(t,i)*r.sortDirection},this.source.sort(h),this.refresh(),i||t||"function"!=typeof this.columnchanged||this.columnchanged(K.SORT,s,this.sortDirection)}function $(e,t){if(null!=this.source){var i=e.key,r="string"==typeof e.enabled,s=e.onchanged;if(null!=e.checkall)e.checkall.call(this,e,t);else for(var n=0;nr&&(e=r)}return this._scrollTop!==e?(this._scrollTop=e,this.virtual&&(this.startIndex=e/i),this.refresh(),this.virtual&&(this.$refs.gridbodyContent[0].style.top=e+"px",null!=this.$refs.gridbodyContent_fixed&&(this.$refs.gridbodyContent_fixed[0].style.top=e+"px"))):t&&this.refresh(),e}function I(e){if(this.resetScroll(e.target),this.virtual){var t=e.target.scrollTop;k.call(this,t)}}function T(e,t){if(null==e)return-1;for(var i=void 0;null!=(i=e.parentNode)&&(" "+i.className+" ").indexOf(" data-grid-row ")<0&&(" "+i.className+" ").indexOf(" data-grid-total-body ")<0;)e=i;if(null==i)return-1;for(var r=i.children.length-(t?0:1),s=0;s0){if(l.length>1||l[0]!==s){var a=l[l.length-1],d=void 0;a>s?(d=a,a=s):d=s,l.splice(0);for(var h=a;h<=d;h+=1)l.push(h);n=!0}}else 1===l.length&&l[0]===s||(l.splice(0,l.length,s),n=!0);else 1===l.length&&l[0]===s||(l.splice(0,l.length,s),n=!0);if(n){if(this.isEditable){for(var c=this.$elems.gridbodyContent.children.length,f=0;f=0?u.__selected=!0:delete u.__selected;var g=u.Values.__changed;if(null!=g)for(var p=0;p=0?(y[b].className="data-grid-row data-grid-row-selected",null!=m&&(m[b].className="data-grid-row data-grid-row-selected")):"data-grid-row"!==y[b].className&&(y[b].className="data-grid-row",null!=m&&(m[b].className="data-grid-row"));"function"==typeof this.selectedrowchanged&&this.selectedrowchanged(s)}var w=null!=i?i:T(e.target);this.selectedColumnIndex=w,(this.allowFullrowClick||w>=0)&&(1===e.buttons||e.originalEvent instanceof TouchEvent)&&"function"==typeof this.cellclick&&this.cellclick(s,w)&&(e.stopPropagation(),e.preventDefault())}}function H(e,t){if("INPUT"!==e.target.tagName){var i=t?-1:this.selectedIndex;if("function"==typeof this.rowdblclick&&this.rowdblclick(i),"function"==typeof this.celldblclick){var r=t?T(L(e.target).parents(".data-grid-total-row")[0],t):this.selectedColumnIndex;this.celldblclick(i,r)}}}function S(e,t){var i=this;if(null!=this._bodyRowCount){t=t||this.columns;var r=this._bodyRowCount;(!this.virtual||this.source.length0){for(var o=[],a=function(e){return H.call(i,e,!1)},d=0;d').on("mousedown",r).on("touchstart",r).on("dblclick",a),l=0;l");if(!1===l.visible)o.hide();else if(o[0].keyid=n+e<');else if(l.type===B.checkbox){var a=function(t){return C.call(i,t,n+e,l)},d=L(""),h=L('').on("change",a),c=L('');d.append(h,c),o.append(d)}else o.append("");s.append(o)}(l);s.append(""),o.push(s)}(d);var h=s.find("tr").last();h.hasClass("data-grid-row-total-holder")&&h.remove(),s.append(o),null!=this.total&&s.append('')}else if(l<0){l=-l;for(var d=1;d<=l;d+=1)L(e.children[n-d]).remove()}}}function V(e){var t=e.target;if("data-grid-hover-holder"!==t.className){for(var i=void 0;null!=(i=t.parentNode)&&(" "+i.className+" ").indexOf(" data-grid-row ")<0;)t=i;var r=t.keyid,s=e.data;if(null==i||null==r)return s.nowKeyid=null,void("none"!==s.style.display&&(s.style.display="none"));var n=s.nowKeyid;if((r+=this.startIndex<0&&(o=t.children[0]),null==l&&(l=o.scrollWidth>o.offsetWidth,this._overflows[r]=l),l){if(""!==s.style.display&&(s.style.display=""),n!==r){s.nowKeyid=r,s.innerText=o.innerText;var a=this.$refs.gridbodyContent[0].offsetTop+t.offsetTop,d=t.offsetLeft,h=s.offsetWidth;h>this._bodyClientWidth&&(h=this._bodyClientWidth);var c=this._bodyClientWidth+this._scrollLeft-h;d>c&&(d=c);var f=o.offsetHeight;s.style.cssText="top: "+a+"px; left: "+d+"px; max-width: "+this._bodyClientWidth+"px; height: "+(f-2)+"px"}}else null!=n&&(s.nowKeyid=null),"none"!==s.style.display&&(s.style.display="none")}}}function N(){var e=this.$refs.gridbody.find(".data-grid-hover-holder")[0];null!=e&&(null!=e.nowKeyid&&(e.nowKeyid=null),"none"!==e.style.display&&(e.style.display="none")),null!=this.$refs.gridbody_fixed&&null!=(e=this.$refs.gridbody_fixed.find(".data-grid-hover-holder")[0])&&(null!=e.nowKeyid&&(e.nowKeyid=null),"none"!==e.style.display&&(e.style.display="none"))}function W(e){var t=this,i=null==e?"":"_fixed";e=e||this.columns;var r=L('
'),s=L('');r.on("mouseenter",function(){return N.call(t)}),r.append(s);for(var l=this.$elems.sizeHolder,o=0;o
').hide().attr("data-key",r.key).on("mouseup",t,o))}else s.append(L('
').hide());return"continue"}if(r.width>0||r.isShrink)r.autoResize=!1;else{r.autoResize=!0,t._needAutoResize=!0,l.text(r.caption);var a=l.width()+20;a0&&(r.sortable=!0),r.isShrink?r.style={"text-align":r.align}:r.style={width:r.width,"max-width":r.width,"min-width":r.width,"text-align":r.align};var d=function(e){return n.call(r,e)},h=function(e){return p.call(r,e)},c=function(e){return v.call(r,e)},f=function(e){return $.call(t,r,L(e.target).prop("checked"))},u=L('').attr("data-key",r.key).css(r.style).css("cursor",r.sortable?"pointer":"auto").on("mouseup",t,d).on("touchend",t,d).on("mousedown",t,h).on("touchstart",t,h);if(r.istotal&&u.addClass("data-grid-column-header-total"),!1!==r.enabled&&r.allcheck&&r.type===B.checkbox){var y=L(""),m=L('').on("change",f),b=L('');y.append(m,b),null!=r.caption&&0!==r.caption.length||(r.sortable=!1),u.append(L('
').css(r.textStyle||{}).append(L("").append(y,L("").text(r.caption).attr("title",!1!==t.headerTitle?r.caption:""))))}else"function"==typeof r.caption?u.append(L('
').css(r.textStyle||{}).append(r.caption())):u.append(L('
').css(r.textStyle||{}).append(L("").text(r.caption).attr("title",!1!==t.headerTitle?r.caption:"")));if(u.append(L('')),r.allowFilter){var w=function(e){return g.call(r,e)},x=L('
').on("mousedown",t,w).on("touchstart",t,w);r.isFiltered&&x.removeClass("no-filter").addClass("filtered"),u.addClass("data-column-header-has-filter").append(x)}var _=L('
').on("mousedown",t,c).on("touchstart",t,c);if(!1===r.resizable&&_.css("display","none"),null!=r.tooltip){var C=r.tooltip;"function"==typeof C&&(C=C(r)),u.attr("title",C)}u.append(_),s.append(u)})(o)}s.append(' ');var a=L('
').hide(),d=L('
').hide();return s.append(L("").append(a,d)),l.empty(),this.$refs["headerTable"+i]=r,this.$refs["header"+i]=s,this.$refs["dragger"+i]=a,this.$refs["draggerCursor"+i]=d,r}function R(e){var t=this,i=null==e?"":"_fixed",r=L('
');this.oddStyle?r.addClass("data-grid-odd-style"):r.addClass("data-grid-even-style"),null==e?r[0].addEventListener("scroll",function(e){null!=t.$refs.gridbody_fixed&&(t.$refs.gridbody_fixed[0].scrollTop=e.target.scrollTop),A.throttle(I,G,t,e)},{passive:!0}):r.on("mousewheel DOMMouseScroll",function(e){var i=-e.originalEvent.wheelDelta||40*e.originalEvent.detail,r={target:t.$refs.gridbody[0]};r.target.scrollTop+=i,I.call(t,r)}),e=e||this.columns,this._containerHeight=this.source.length*this.rowHeight;var s=void 0;if(0===this._containerHeight){this._containerHeight=1,s=0;for(var n=0;n").css({position:"relative","min-width":"100%","min-height":1,height:this._containerHeight,width:s});r.append(l);var o=L('
'),a=o.children("tbody")[0];l.append(o),S.call(this,a,e);var d=function(e){var i=e.currentTarget.nowKeyid;if(null!=i)return O.call(t,e,(i>>>q)-t.startIndex,i&X)},h=function(e){return H.call(t,e,!1)};if(!this.noHoverHolder){var c=L('
').hide().on("mousedown",d).on("touchstart",d).on("dblclick",h);l.append(c),r.on("mousemove",c[0],function(e){return A.throttle(V,G,t,e)})}return this.$refs["gridbody"+i]=r,this.$refs["gridbodyContainer"+i]=l,this.$refs["gridbodyContent"+i]=o,this.$elems["gridbodyContent"+i]=a,this.refresh(),r}function z(e){var t=this;if(null==this.total)return null;var i=null==e?"":"_fixed",r=L('
'),s=L('
');r.append(s);var n=function(e){return H.call(t,e,!0)},l=L('').on("dblclick",n);s.append(l);var o=this.$elems.sizeHolder;e=e||this.columns;for(var a=0;a');if(!1===d.visible)h.hide();else{var c=void 0;if(d.istotal?c=null:null!=(c=this.total[d.key])&&null!=c.DisplayValue&&(c=c.DisplayValue),null==c&&(c=""),d.autoResize){o.html(c);var f=o.width()+10;if(f>d.width){var u=f+"px";this.$refs.header[0].children[a].style.width=u,this.$refs.header[0].children[a].style.minWidth=u,this.$refs.header[0].children[a].style.maxWidth=u,d.width=f,d.style.width=f,d.style["max-width"]=f,d.style["min-width"]=f}}h.append(L("
").css(d.style).html(c))}l.append(h)}return o.empty(),this.$refs["gridtotal"+i]=s,this.$refs["gridtotalbody"+i]=l,this.$refs["total"+i]=r,r}function F(e,t,i){for(var r=this.startIndex,s=this.selectedIndexes,n=0;n=0?"data-grid-row data-grid-row-selected"!==d&&(a.className="data-grid-row data-grid-row-selected"):"data-grid-row"!==d&&(a.className="data-grid-row");for(var h=0;h0&&null!=i&&(null==i[h]||i[h]0&&(g.style.cssText="");for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(g.style[x]=w[x])}if(null!=c.bgFilter){var _=c.bgFilter(o);u.style.backgroundColor=_||""}if(null!=c.events)for(var $ in c.events)Object.prototype.hasOwnProperty.call(c.events,$)&&(g[$]=c.events[$].bind(o));if(null!=c.attrs){var C=c.attrs;"function"==typeof C&&(C=C(o));for(var k in C)Object.prototype.hasOwnProperty.call(C,k)&&g.setAttribute(k,C[k])}}}}}}}var L=i(4),D=i(2),j=D.math,E=D.ui,A=D.func,M=i(11);i(5);var P=window._network,K={REORDER:"reorder",RESIZE:"resize",SORT:"sort"},B={common:0,input:1,dropdown:2,checkbox:3},G=!M.isMobile()&&M.isChrome()?0:32,q=10,X=1023,U=100,Z=4,Y=4,J=50;r.prototype={get sortKey(){var e=this.columns&&this.columns[this.sortIndex];return e&&e.key},get selectedIndex(){return null!=this.selectedIndexes&&this.selectedIndexes.length>0?this.selectedIndexes[0]:-1},get innerSource(){return this._source},set innerSource(e){this._source=e,this.source=e}},r.COLUMN_TYPE=B,r.prototype.init=function(e){var t=this;if(delete this.$elems.sizeHolder,delete this.$el,this.$refs={},this._rendering=!0,this._overflows={},this._scrollLeft=0,this.innerSource=this.source,this.virtual=this.source&&this.source.length>this.virtualCount,e=e||this.$parent,"string"==typeof e&&(e=L(e)),null==e)throw new Error("no specified parent.");this.$parent=e;var i=L('
');i.append('');var r=L('');i.on("keydown",function(e){var i=t.selectedIndex,r=!1;if("ArrowUp"===e.key)r=!0,i>1?(delete t.source[i].__selected,i-=1):i=0;else if("ArrowDown"===e.key){r=!0;var s=t.source&&t.source.length||0;i0){var a=this.columns.slice(0,l);this.fixedColumns=a;var d=L('
');e.append(d);var h=W.call(this,!1),c=z.call(this,!1),f=0;a.forEach(function(e){return f+=!1===e.visible?0:e.width+1}),d.css("width",f),d.append(h),null!=c&&d.append(c);R.call(this,!1).insertAfter(h),this.$el_fixed=d}r.remove();var u=L('
');this.$elems.loading=u,i.append(u),this.$el=i,delete this._rendering,this.sortIndex>=0?_.call(this,this.columns[this.sortIndex],!0):this.resize()},r.prototype.refresh=function(){if(null==this.$refs.gridbodyContent)throw new Error("the body has not been created.");var e=this.$elems.gridbodyContent.children,t={};if(F.call(this,e,this.columns,t),null!=this.$elems.gridbodyContent_fixed&&F.call(this,this.$elems.gridbodyContent_fixed.children,this.columns),this._needAutoResize&&t.flag){delete this._needAutoResize;for(var i=0;i0&&y.call(this,i,r)}}},r.prototype.refreshGrid=function(){var e=this;this.$refs.header.find(".data-column-header-filter").removeClass("filtered").addClass("no-filter");var t=null!=this.$refs.header_fixed;t&&this.$refs.header_fixed.find(".data-column-header-filter").removeClass("filtered").addClass("no-filter");for(var i=0;i0){var s=this.$refs.header.children().eq(i);s.find(".data-column-header-filter").removeClass("no-filter").addClass("filtered"),t&&(s=this.$refs.header_fixed.children().eq(i),s.length>0&&s.find(".data-column-header-filter").removeClass("no-filter").addClass("filtered"))}}this.source=this.innerSource.filter(function(t){for(var i=0;i=0&&_.call(this,this.columns[this.sortIndex],null,!0),this.reset()},r.prototype.resetScroll=function(e){if(null==this.$el)throw new Error("grid view has not been initialized.");null==e&&(e=this.$refs.gridbody[0]);var t=e.scrollLeft;if(this._scrollLeft!==t){this._scrollLeft=t;var i=-t+"px";this.$refs.headerTable[0].style.marginLeft=i,null!=this.$refs.gridtotal&&(this.$refs.gridtotal[0].style.marginLeft=i),"function"==typeof this.hscrolling&&this.hscrolling(-t)}},r.prototype.resize=function(e){if(!this._rendering&&null!=this.$el){var t=this.$refs.gridbody,i=this.$refs.gridbody_fixed,r=this.$refs.headerTable_fixed,s=this.$refs.header.height()+2,n=t[0].offsetTop;n!==s&&(t.css("top",s),null!=i&&i.css("top",s),null!=r&&r.css("height",s),n=s),s=this.height,null==s?s=this.$el.height()-n:0===s&&(s=this.$refs.gridbodyContent.height(),this.$el.css("height",n+s)),t.css("height",s);var l=s;if(null!=i){l-=t[0].offsetHeight-t[0].clientHeight,i.css("height",l),null!=this.$el_fixed&&this.$el_fixed.css("height",n+l)}var o=j.trunc((s-1)/this.rowHeight)+2*Z+1;(e||o!==this._bodyRowCount)&&(this._bodyRowCount=o,this.reload());var a=this.$refs.gridbodyContent.width(),d=t[0].clientWidth;this._bodyClientWidth=d;var h=this.$refs.total;if(null==h)return void(this.$refs.gridbodyContainer.height()!==this._containerHeight&&(this.$refs.gridbodyContainer.css("height",this._containerHeight),null!=this.$refs.gridbodyContainer_fixed&&this.$refs.gridbodyContainer_fixed.css("height",this._containerHeight)));var c=this.$refs.gridtotal;c.width()!==a&&c.css("width",a);var f=this.$refs.gridtotalbody.height();if(f>0&&c.height()!==f&&(c.css("height",f),null!=this.$refs.gridtotal_fixed&&this.$refs.gridtotal_fixed.css("height",f),null!=this.$refs.gridtotalbody_fixed&&(this.$refs.gridtotalbody_fixed.css("height",f),this.$refs.gridtotalbody_fixed.children("th:first-child").css("height",f))),this.$refs.gridbodyContent.find("tr.data-grid-row-total-holder").css("height",f),f+=this._containerHeight,this.$refs.gridbodyContainer.height()!==f&&(this.$refs.gridbodyContainer.css("height",f),null!=this.$refs.gridbodyContainer_fixed&&this.$refs.gridbodyContainer_fixed.css("height",f)),0!==d){var u=t[0].offsetWidth-d,g=h[0].style.right;u>0&&""===g?h[0].style.right=u+"px":0===u&&""!==g&&(h[0].style.right="");var p=t[0].offsetHeight-t[0].clientHeight;g=h[0].style.bottom,p>0&&""===g?h[0].style.bottom=p+"px":0===p&&""!==g&&(h[0].style.bottom="")}}},r.prototype.setData=function(e){var t=this;if(null==this.$el)throw new Error("grid view has not been initialized.");this._containerHeight=e.length*this.rowHeight,this._overflows={},this.selectedColumnIndex=-1,this.selectedIndexes=[],this.startIndex=0,this._scrollTop=0,this.$refs.gridbody[0].scrollTop=0,null!=this.$refs.gridbody_fixed&&(this.$refs.gridbody_fixed[0].scrollTop=0),this.$refs.gridbodyContent.css("top",0),null!=this.$refs.gridbodyContent_fixed&&this.$refs.gridbodyContent_fixed.css("top",0),this.$refs.gridbodyContainer.css("height",this._containerHeight),null!=this.$refs.gridbodyContainer_fixed&&this.$refs.gridbodyContainer_fixed.css("height",this._containerHeight),this.virtual=e.length>this.virtualCount,this.innerSource=e,delete this._bodyRowCount;for(var i=this.$refs.header.children(".data-column-header"),r=0;r0?this.refreshGrid():(this.resize(),this.sortIndex>=0&&_.call(this,this.columns[this.sortIndex],!0))},r.prototype.resetFilter=function(){this.source=this.innerSource;for(var e=0;ei&&(t=i)}this._scrollTop=t;var r=t+"px";this.$refs.gridbodyContent[0].style.top=r,null!=this.$refs.gridbodyContent_fixed&&(this.$refs.gridbodyContent_fixed[0].style.top=r)}this.$refs.gridbody.prop("scrollTop",e),null!=this.$refs.gridbody_fixed&&this.$refs.gridbody_fixed.prop("scrollTop",e)},r.prototype.deleteRow=function(e){if(null==this.$el)throw new Error("grid view has not been initialized.");this.innerSource.splice(e,1),this.reload()},r.prototype.moveRow=function(e,t){var i=this.innerSource[e];if(null!=i&&0!==t){var r=e+t;t>0?r>=this.innerSource.length&&(r=this.innerSource.length-1):r<0&&(r=0),this.innerSource.splice(e,1),this.innerSource.splice(r,0,i),this.refresh()}},r.prototype.closeFilterPanel=function(){L((this.$window||window).document.body).children(".data-column-header-filter-panel").remove()},r.prototype.loading=function(e){!1===e?this.$elems.loading.css({visibility:"hidden",opacity:0}):this.$elems.loading.css({visibility:"visible",opacity:1})},r.clearGridWidth=function(e,t){P.query("DeleteManagementGridWidth",[e],t,function(){})},r.applyGridWidth=function(e,t,i,r,s){P.management("GetManagementChartGridLayout",[e],function(e){var n=t;if(e.Result&&e.Result.length>0){"function"==typeof s&&s(e.Result),n=[];for(var l=0;l0&&(i.sortIndex=n.length,i.sortDirection=2===h?-1:1),a=t[d];break}null!=a&&n.push(a)}}i.columns=n,i.init(),r&&r()},function(){i.columns=t,i.init(),r&&r()})},r.saveColumnInfo=function(e){return function(){for(var t=[],i=0;i