2024-03-26 15:56:31 +08:00

2 lines
47 KiB
JavaScript

!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 n=i[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.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;r<t;r++)i[r-3]=arguments[r];var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;clearTimeout(e.tiid),e.tiid=setTimeout(function(){return e.apply(s,i)},n)},throttle:function(e){for(var t=arguments.length,i=Array(t>3?t-3:0),r=3;r<t;r++)i[r-3]=arguments[r];var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;clearTimeout(e.tiid);var l=new Date;void 0===e.tdate||l-e.tdate>n?(e.apply(s,i),e.tdate=l):e.tiid=setTimeout(function(){return e.apply(s,i)},n)}}}},24:function(e,t,i){function r(e){this.columns=[],this._source=[],this.source=this._source,this.lang={all:"( All )",ok:"OK",reset:"Reset",sort:"Sort",addLevel:"Add Level",deleteLevel:"Delete Level",copyLevel:"Copy Level",column:"Column",order:"Order",asc:"Asc",desc:"Desc",cancel:"Cancel",duplicatePrompt:"{column} is being sorted more than once. Delete the duplicate sort criteria and try again.",requirePrompt:"All sort criteria must have a column specified. Check the selected sort criteria and try again."},this.virtualCount=Y,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.sortArray=null,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 n(e){return Array.prototype.slice.call(e.parentNode.children).indexOf(e)}function s(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<this.length;r+=1){var n=this[r],s=n.Values||n,l=null==e?s:s[e],a=o(l,t);null==i[a]&&(i[a]=l)}return null==Object.values&&(Object.values=function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(e[i]);return t}),Object.values(i)}function d(e){return null==e?String(null):String(e).toLowerCase()}function h(e,t){return function(i){if(null!=i){var r=j(i.target);r.data("item").__checked=r.prop("checked")}for(var n=e.find(".data-filter-items-item input"),s=0;s<n.length;s+=1)if(!j(n[s]).prop("checked"))return void t.prop("checked",!1);t.prop("checked",!0)}}function c(e,t,i){for(var r=h(e,i),n=0;n<t.length;n+=1){var s=t[n],o=j('<div class="data-filter-items-item"></div>'),a=j("<label></label>"),d=j('<input type="checkbox"></input>').data("item",s),c=void 0;if(this.filterCustom||"function"!=typeof this.filter)c=l(s,"DisplayValue");else{var u={};u[this.key]=s,c=this.filter(u)}d.data("text",c).prop("checked",s.__checked).on("change",r),a.append(d),a.append(j('<layer class="check-box-inner"><svg><use xlink:href="#gridview-check"></use></svg></layer>'));var f=j("<span></span>").text(c);a.append(f),o.append(a),e.append(o)}}function u(e,t,i,r){t.children(".data-filter-items-sizeholder").remove(),t.children(".data-filter-items-contentholder").remove();var n=e.filterRowHeight,s=i.length*n;this.__filterHeight=s;var l=j('<div class="data-filter-items-sizeholder"></div>').css("height",s);t.append(l);var a=j('<div class="data-filter-items-contentholder"></div>').css("top",n);t.data("items",i);for(var d=0;d<i.length;d+=1){var h=i[d];h.__checked=null==this.filterValues||this.filterValues.indexOf(o(h,"Value"))>=0}var u=void 0;u=i.length>12?i.slice(0,12):i,c.call(this,a,u,r),t.append(a)}function f(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 n=t/i;this.__filterStartIndex=n;var s=this.__itemHolder.data("items");s=n+12<s.length?s.slice(n,n+12):s.slice(-12);var l=this.__itemHolder.children(".data-filter-items-contentholder");l.empty(),c.call(this,l,s,this.__checkboxAll),l[0].style.top=t+i+"px"}}function p(e){var t=this,i=e.data,r=j((i.$window||window).document.body),n=function(e){if(null==e||"data-column-header-filter"!==e.target.className&&!e.target.classList.contains("arrow")&&"use"!==e.target.tagName.toLowerCase()){var i=t.__itemHolder.data("items");if(null!=i)for(var n=0;n<i.length;n+=1)delete i[n].__checked;r.children(".data-column-header-filter-panel").removeClass("active"),setTimeout(function(){return r.children(".data-column-header-filter-panel").remove()},120)}};r.children(".data-column-header-filter-panel").remove(),j(document).off(".filterpanel").on("mousedown.filterpanel",n).on("touchstart.filterpanel",n);var s=j('<div class="data-column-header-filter-panel"></div>').on("mousedown",function(e){return e.stopPropagation()}).on("touchstart",function(e){return e.stopPropagation()}),c=j(e.currentTarget).parent(),p=c.offset(),g=c.width();s.css({top:p.top+c.height(),left:p.left+(g>200?g-200:0)});var v=j('<div class="data-filter-items-holder"></div>');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=j('<div class="data-filter-search-holder"></div>');b.append(m),s.append(b),y=!0}}y?v.css("height",250):v.css("height",280),s.append(v),this.onFillItems(v,s)}else{var w=null;if(!1!==this.allowSearch){var x=j('<div class="data-filter-search-holder"></div>');w=j('<input type="text" class="data-filter-search-box"/>');var _=function(e){return e.data.focus()},$=j('<svg class="data-filter-search-icon"><use xlink:href="#search"></use></svg>').on("mouseup",w,_).on("touchend",w,_);x.append(w,$),s.append(x)}v[0].addEventListener("scroll",function(e){M.throttle(f,X,t,i,e.target.scrollTop)},{passive:!0});var C=j('<div class="data-filter-items-item"></div>'),k=j("<label></label>"),I=j('<input type="checkbox"></input>');this.__checkboxAll=I,k.append(I),k.append(j('<layer class="check-box-inner"><svg><use xlink:href="#gridview-check"></use></svg></layer>')),k.append(j("<span></span>").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:e<t?-1:0});var H=T;if(T.length>0&&T[0]!==Object(T[0])){H=[];for(var O=0;O<T.length;O+=1){var S=T[O];H.push({Value:S,DisplayValue:null==S?"":S})}}u.call(this,i,v,H,I);h(v.children(".data-filter-items-contentholder"),I)(),s.append(v),null!=w?w.on("input propertychange",{column:this,grid:i},function(e){var t=d(e.currentTarget.value),i=0===t.length?H:H.filter(function(i){var r=void 0;if(e.data.filterCustom||"function"!=typeof e.data.filter)r=l(i,"DisplayValue");else{var n={};n[e.data.key]=i,r=e.data.filter(n)}return d(r).indexOf(t)>=0});u.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=j(e.target).prop("checked"),r=void 0;for(r=0;r<t.length;r+=1){j(t[r]).prop("checked",i)}var n=v.data("items");for(r=0;r<n.length;r+=1)n[r].__checked=i})}if(!1!==this.filterFunctions){var N=j('<div class="data-filter-items-function"></div>'),V=j('<input type="button"></input>').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)),n(),j(e.currentTarget).removeClass("filtered").addClass("no-filter")});N.append(V);var A=j('<input type="button"></input>').val(i.lang.ok).on("click",function(){var r=v.data("items").filter(function(e){return!1!==e.__checked});if("function"==typeof t.onFilterOK)t.onFilterOK(r,e);else{var s=r.map(function(e){var t=l(e,"Value");return Array.isArray(t)?t.join(","):t});t.filterValues=s,i.refreshGrid(),"function"==typeof t.afterFilter&&t.afterFilter(i)}j(e.currentTarget).removeClass("no-filter").addClass("filtered"),n()});N.append(A),s.append(N)}r.append(s),setTimeout(function(){return s.addClass("active")},1)}function g(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=P.getClientX(e),r=n(e.currentTarget),l=function(n){var s=P.getClientX(n),l=s-i,o=t._isdragging;!o&&(l>Q||l<-Q)&&(o=!0,t._isdragging=!0),o&&l!==t._offset&&(b.call(e.data,r,l,s),t._offset=l)},o=function(i){j(e.data.$window||window).off(".dragging"),t._isdragging?(delete t._isdragging,delete t._offset,w.call(e.data,r)):i.originalEvent&&i.originalEvent.touches&&s.call(t,i)},a=M.throttle.bind(this,l,X,null);j(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=P.getClientX(e),r=this.width,s=n(e.currentTarget.parentNode);if(this.isfixed){for(var l=0,o=0;o<e.data.fixedColumns.length;o+=1)s!==o&&!1!==e.data.fixedColumns[o].visible&&(l+=e.data.fixedColumns[o].width+1);e.data._baseWidth=l}var a=function(n){var l=P.getClientX(n),o=r+(l-i);o<ee||(t._innerwidth=o,m.call(e.data,s,o))},d=function(){j(e.data.$window||window).off(".resizing"),delete e.data._baseWidth;var i=t._innerwidth;null!=i&&(t.autoResize=!1,delete t._innerwidth,x.call(e.data,s,i))},h=M.throttle.bind(this,a,X,null);j(e.data.$window||window).on("mousemove.resizing",h).on("mouseup.resizing",d).on("touchmove.resizing",h).on("touchend.resizing",d)}function y(e,t){var i=this.columns[e].isfixed,r=this.columns[e].width,n=t+"px";this.columns[e].width=t,this.columns[e].style.width=t,this.columns[e].style["max-width"]=t,this.columns[e].style["min-width"]=t;var s=this.$refs.header[0].children[e];s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n,i&&(s=this.$refs.header_fixed[0].children[e],s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n,this._baseWidth>=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;o<l.length;o+=1)null!=(s=l[o].children[e])&&(s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n);else t=this.$refs.gridbodyContainer[0].offsetWidth-r+t,this.$refs.gridbodyContainer[0].style.width=t+"px";if(i)if(l=this.$elems.gridbodyContent_fixed.children,l.length>0)for(var a=0;a<l.length;a+=1)null!=(s=l[a].children[e])&&(s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n);else t=this.$refs.gridbodyContainer_fixed[0].offsetWidth-r+t,this.$refs.gridbodyContainer_fixed[0].style.width=t+"px";null!=this.$refs.total&&(s=this.$refs.gridtotalbody[0].children[e].children[0],s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n,null!=this.$refs.gridtotalbody_fixed&&null!=this.$refs.gridtotalbody_fixed[0].children[e]&&(s=this.$refs.gridtotalbody_fixed[0].children[e].children[0],s.style.width=n,s.style.maxWidth=n,s.style.minWidth=n))}function m(e,t){y.call(this,e,t),this.resize(),"function"==typeof this.columnchanging&&this.columnchanging(G.RESIZE,e,t)}function b(e,t,i){var r=this.$refs.header[0].children,n=r[e];this.$refs.dragger.css({left:n.offsetLeft+t,width:n.style.width}).show(),this.$refs.draggerCursor.show(),t=i-P.getOffsetLeft(n);var s=void 0;if(t<0){t=-t;for(var l=e-1;l>=0&&t>=0&&((n=r[l])&&!((" "+n.className+" ").indexOf(" data-column-header ")<0));l-=1){if(t<n.offsetWidth){s=t>n.offsetWidth/2?l:l+1;break}t-=n.offsetWidth}null==s&&(s=0),null!=this.fixedColumns&&s<this.fixedColumns.length&&(s=this.fixedColumns.length)}else{for(var o=r.length,a=e;a<o-1&&t>=0;a+=1){if(!(n=r[a])||(" "+n.className+" ").indexOf(" data-column-header ")<0){s=a;break}if(t<n.offsetWidth){s=t>n.offsetWidth/2?a+1:a;break}t-=n.offsetWidth}null==s&&(s=o-1)}if(s!==this._orderIndex){if(this._orderIndex=s,!(n=r[s]))return;this.$refs.draggerCursor.css("left",n.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,n=this.$refs.total&&this.$refs.gridtotalbody[0].children;if(t>1){t=this._orderIndex-1;for(var s=e;s<t;s+=1){var l=this.columns[s];this.columns[s]=this.columns[s+1],this.columns[s+1]=l}j(i[e]).insertAfter(i[t]);for(var o=0;o<r.length;o+=1)j(r[o].children[e]).insertAfter(r[o].children[t]);null!=n&&j(n[e]).insertAfter(n[t])}else{t=this._orderIndex;for(var a=e;a>t;a-=1){var d=this.columns[a];this.columns[a]=this.columns[a-1],this.columns[a-1]=d}j(i[e]).insertBefore(i[t]);for(var h=0;h<r.length;h+=1)j(r[h].children[e]).insertBefore(r[h].children[t]);null!=n&&j(n[e]).insertBefore(n[t])}if(null==this.sortArray||0===this.sortArray.length)for(var c=0;c<i.length;c+=1){var u=i[c].children[1];if(null==u)break;if("arrow"!==u.className){this.sortIndex=c;break}}"function"==typeof this.columnchanged&&this.columnchanged(G.REORDER,e,t)}}function x(e,t){for(var i=0;i<this.innerSource.length;i+=1){var r=i<<U|e;null!=this._overflows[r]&&delete this._overflows[r]}"function"==typeof this.columnchanged&&this.columnchanged(G.RESIZE,e,t)}function _(e,t){return null==e.sortFilter?function(i,r){if(!0!==e.allowHtml&&"function"==typeof e.filter?(i=e.filter(i.Values),r=e.filter(r.Values)):(i=i.Values[e.key],r=r.Values[e.key]),null!=i&&void 0!==i.Value&&(i=i.Value),null!=r&&void 0!==r.Value&&(r=r.Value),null==i&&"number"==typeof r)i=0;else if("number"==typeof i&&null==r)r=0;else{if(null!=i&&null==r)return t;"string"==typeof i&&"string"==typeof r&&(i=i.toLowerCase(),r=r.toLowerCase())}return i===r?0:(i>r?1:-1)*t}:function(i,r){return e.sortFilter(i,r)*t}}function $(e,t,i){var r=this.columns.indexOf(e);if(!i){this.sortIndex=r,this.sortArray=null;for(var n=this.$refs.header[0].children,s=this.$refs.header_fixed&&this.$refs.header_fixed[0].children,l=0;l<n.length;l+=1){var o=n[l].children[1],a=s&&l<s.length&&s[l].children[1];if(null==o)break;l===r?(t||"arrow"===o.className||(this.sortDirection*=-1),o.className="arrow "+(this.sortDirection>0?"asc":"desc"),a&&(a.className="arrow "+(this.sortDirection>0?"asc":"desc"))):"arrow"!==o.className&&(o.className="arrow",a&&(a.className="arrow"))}}this.source.sort(_(e,this.sortDirection)),this.refresh(),i||t||"function"!=typeof this.columnchanged||this.columnchanged(G.SORT,r,this.sortDirection)}function C(e,t){if(null!=this.source){var i=e.key,r="string"==typeof e.enabled,n=e.onchanged;if(null!=e.checkall)e.checkall.call(this,e,t);else for(var s=0;s<this.source.length;s+=1){var l=this.source[s].Values;if(null!=l){var o=r?l[e.enabled]:e.enabled;!1!==o&&(l[i]=t,l.__internal_changed=!0,null!=n&&n.call(this,l,t))}}this.refresh()}}function k(e,t,i){if(null!=this.source){var r=this.source[this.startIndex+t].Values;if(null!=r){!1!==("string"==typeof i.enabled?r[i.enabled]:i.enabled)&&(r[i.key]=e.target.checked,r.__internal_changed=!0,null!=i.onchanged&&i.onchanged.call(this,r,e.target.checked))}}}function I(e,t){var i=this.rowHeight;if((e-=e%(2*i)+J*i)<0)e=0;else{var r=this._containerHeight-(t?0:this._bodyRowCount*i);r<0&&(r=0),e>r&&(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 T(e){if(typeof this.scrolling==="function"&&this.scrolling(e),this.resetScroll(e.target),this.virtual){var t=e.target.scrollTop;I.call(this,t)}}function H(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),n=0;n<r;n+=1)if(e===i.children[n])return n;return-1}function O(e,t,i){var r=this.startIndex,n=t+r;if("function"!=typeof this.willselect||this.willselect(n,i)){var s=!1,l=this.selectedIndexes;if(this.canMultiSelect)if(e.ctrlKey){var o=l.indexOf(n);o<0?(l.push(n),s=!0):(l.splice(o,1),s=!0)}else if(e.shiftKey&&l.length>0){if(l.length>1||l[0]!==n){var a=l[l.length-1],d=void 0;a>n?(d=a,a=n):d=n,l.splice(0);for(var h=a;h<=d;h+=1)l.push(h);s=!0}}else 1===l.length&&l[0]===n||(l.splice(0,l.length,n),s=!0);else 1===l.length&&l[0]===n||(l.splice(0,l.length,n),s=!0);if(s){if(this.isEditable){for(var c=this.$elems.gridbodyContent.children.length,u=0;u<c;u+=1){var f=this.source[u+r];l.indexOf(u+r)>=0?f.__selected=!0:delete f.__selected;var p=f.Values.__changed;if(null!=p)for(var g=0;g<this.columns.length;g+=1){var v=this.columns[g];Object.prototype.hasOwnProperty.call(p,v.key)&&("function"==typeof v.onchanged&&v.onchanged.call(this,f.Values),delete p[v.key])}}this.refresh()}else for(var y=this.$elems.gridbodyContent.children,m=this.$elems.gridbodyContent_fixed&&this.$elems.gridbodyContent_fixed.children,b=0;b<y.length;b+=1)l.indexOf(b+r)>=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(n)}var w=null!=i?i:H(e.target);this.selectedColumnIndex=w,(this.allowFullrowClick||w>=0)&&(1===e.buttons||e.originalEvent instanceof TouchEvent)&&"function"==typeof this.cellclick&&this.cellclick(n,w)&&(e.stopPropagation(),e.preventDefault())}}function S(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?H(j(e.target).parents(".data-grid-total-row")[0],t):this.selectedColumnIndex;this.celldblclick(i,r)}}}function N(e,t){var i=this;if(null!=this._bodyRowCount){t=t||this.columns;var r=this._bodyRowCount;(!this.virtual||this.source.length<r)&&(r=this.source.length);var n=j(e),s=e.children.length-n.find("tr.data-grid-row-total-holder").length,l=r-s;if(l>0){for(var o=[],a=function(e){return S.call(i,e,!1)},d=0;d<l;d+=1)!function(e){for(var r=function(t){return O.call(i,t,s+e)},n=j('<tr class="data-grid-row"></tr>').on("mousedown",r).on("touchstart",r).on("dblclick",a),l=0;l<t.length;l+=1)!function(r){var l=t[r],o=j("<td></td>");if(!1===l.visible)o.hide();else if(o[0].keyid=s+e<<U|r,null!=l.style&&o.css(l.style),l.istotal&&o.addClass("data-grid-column-total"),null!=l.css&&o.css(l.css),l.isurl)o.append('<a target="_blank"></a>');else if(l.type===q.checkbox){var a=function(t){return k.call(i,t,s+e,l)},d=j("<label></label>"),h=j('<input type="checkbox" />').on("change",a),c=j('<layer class="check-box-inner"><svg><use xlink:href="#gridview-check"></use></svg></layer>');d.append(h,c),o.append(d)}else o.append("<span></span>");n.append(o)}(l);n.append("<td><span></span></td>"),o.push(n)}(d);var h=n.find("tr").last();h.hasClass("data-grid-row-total-holder")&&h.remove(),n.append(o),null!=this.total&&n.append('<tr class="data-grid-row-total-holder"></tr>')}else if(l<0){l=-l;for(var d=1;d<=l;d+=1)j(e.children[s-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,n=e.data;if(null==i||null==r)return n.nowKeyid=null,void("none"!==n.style.display&&(n.style.display="none"));var s=n.nowKeyid;if((r+=this.startIndex<<U)!==s){var l=this._overflows[r],o=t;if(t.children.length>0&&(o=t.children[0]),null==l&&(l=o.scrollWidth>o.offsetWidth,this._overflows[r]=l),l){if(""!==n.style.display&&(n.style.display=""),s!==r){n.nowKeyid=r,n.innerText=o.innerText;var a=this.$refs.gridbodyContent[0].offsetTop+t.offsetTop,d=t.offsetLeft,h=n.offsetWidth;h>this._bodyClientWidth&&(h=this._bodyClientWidth);var c=this._bodyClientWidth+this._scrollLeft-h;d>c&&(d=c);var u=o.offsetHeight;n.style.cssText="top: "+a+"px; left: "+d+"px; max-width: "+this._bodyClientWidth+"px; height: "+(u-2)+"px"}}else null!=s&&(n.nowKeyid=null),"none"!==n.style.display&&(n.style.display="none")}}}function A(){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 z(e){var t=this,i=null==e?"":"_fixed";e=e||this.columns;var r=j('<table class="data-grid-table-header"></table>'),n=j('<tr class="data-grid-header"></tr>');r.on("mouseenter",function(){return A.call(t)}),r.append(n);for(var l=this.$elems.sizeHolder,o=0;o<e.length;o+=1){(function(i){var r=e[i];if(!1===r.visible){if(!0===r.sortable){var o=function(e){return s.call(r,e,!0)};n.append(j('<th class="data-column-header"><div></div><span></span></th>').hide().attr("data-key",r.key).on("mouseup",t,o))}else n.append(j('<th class="data-column-header"><div></div><span></span></th>').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;a<ee&&(a=ee),r.width=a}null==r.align&&(r.align="left"),r.istotal?r.sortable=!1:!1!==r.sortable&&null!=r.caption&&String(r.caption).length>0&&(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 s.call(r,e)},h=function(e){return g.call(r,e)},c=function(e){return v.call(r,e)},u=function(e){return C.call(t,r,j(e.target).prop("checked"))},f=j('<th class="data-column-header"></th>').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&&f.addClass("data-grid-column-header-total"),!1!==r.enabled&&r.allcheck&&r.type===q.checkbox){var y=j("<label></label>"),m=j('<input type="checkbox" />').on("change",u),b=j('<layer class="check-box-inner"><svg><use xlink:href="#gridview-check"></use></svg></layer>');y.append(m,b),null!=r.caption&&0!==r.caption.length||(r.sortable=!1),f.append(j('<div class="data-column-header-text"></div>').css(r.textStyle||{}).append(j("<span></span>").append(y,j("<span></span>").text(r.caption).attr("title",!1!==t.headerTitle?r.caption:""))))}else"function"==typeof r.caption?f.append(j('<div class="data-column-header-text"></div>').css(r.textStyle||{}).append(r.caption())):f.append(j('<div class="data-column-header-text"></div>').css(r.textStyle||{}).append(j("<span></span>").text(r.caption).attr("title",!1!==t.headerTitle?r.caption:"")));if(f.append(j('<span class="arrow"></span>')),r.allowFilter){var w=function(e){return p.call(r,e)},x=j('<div class="data-column-header-filter no-filter"><svg class="arrow no-filter"><use xlink:href="#ellipsis-h"></use></svg><svg class="arrow filtered"><use xlink:href="#filter"></use></svg></div>').on("mousedown",t,w).on("touchstart",t,w);r.isFiltered&&x.removeClass("no-filter").addClass("filtered"),f.addClass("data-column-header-has-filter").append(x)}var _=j('<span class="data-column-header-split"><div></div></span>').on("mousedown",t,c).on("touchstart",t,c);if(!1===r.resizable&&_.css("display","none"),null!=r.tooltip){var $=r.tooltip;"function"==typeof $&&($=$(r)),f.attr("title",$)}f.append(_),n.append(f)})(o)}n.append('<th class="data-column-header-holder">&nbsp;</th>');var a=j('<div class="data-column-header-dragger"></div>').hide(),d=j('<div class="data-column-header-dragger-cursor"></div>').hide();return n.append(j("<th></th>").append(a,d)),l.empty(),this.$refs["headerTable"+i]=r,this.$refs["header"+i]=n,this.$refs["dragger"+i]=a,this.$refs["draggerCursor"+i]=d,r}function R(e,t){var i=this,r=null==t?"":"_fixed",n=j('<div class="data-grid-body"></div>');this.oddStyle?n.addClass("data-grid-odd-style"):n.addClass("data-grid-even-style"),null==t?n[0].addEventListener("scroll",function(e){null!=i.$refs.gridbody_fixed&&(i.$refs.gridbody_fixed[0].scrollTop=e.target.scrollTop),M.throttle(T,X,i,e)},{passive:!0}):n.on("mousewheel DOMMouseScroll",function(e){var t=-e.originalEvent.wheelDelta||40*e.originalEvent.detail,r={target:i.$refs.gridbody[0]};r.target.scrollTop+=t,T.call(i,r)}),t=t||this.columns,this._containerHeight=this.source.length*this.rowHeight;var s=void 0;if(0===this._containerHeight){this._containerHeight=1,s=0;for(var l=0;l<t.length;l+=1)!1===t[l].visible||isNaN(t[l].width)||(s+=t[l].width+1);s+=1}else s=null;var o=j("<div></div>").css({position:"relative","min-width":"100%","min-height":1,height:this._containerHeight,width:s});n.append(o);var a=j('<table class="data-grid-body-content"><tbody></tbody></table>'),d=a.children("tbody")[0];o.append(a),N.call(this,d,t);var h=function(e){var t=e.currentTarget.nowKeyid;if(null!=t)return O.call(i,e,(t>>>U)-i.startIndex,t&Z)},c=function(e){return S.call(i,e,!1)};if(!this.noHoverHolder){var u=j('<div class="data-grid-hover-holder"></div>').hide().on("mousedown",h).on("touchstart",h).on("dblclick",c);o.append(u),n.on("mousemove",u[0],function(e){return M.throttle(V,X,i,e)})}return this.$refs["gridbody"+r]=n,this.$refs["gridbodyContainer"+r]=o,this.$refs["gridbodyContent"+r]=a,this.$elems["gridbodyContent"+r]=d,e&&this.refresh(),n}function W(e){var t=this;if(null==this.total)return null;var i=null==e?"":"_fixed",r=j('<div class="data-grid-total"></div>'),n=j('<table class="data-grid-table-total"></table>');r.append(n);var s=function(e){return S.call(t,e,!0)},l=j('<tr class="data-grid-total-body"></tr>').on("dblclick",s);n.append(l);var o=this.$elems.sizeHolder;e=e||this.columns;for(var a=0;a<e.length;a+=1){var d=e[a],h=j('<th class="data-grid-total-row"></th>');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 u=o.width()+10;if(u>d.width){var f=u+"px";this.$refs.header[0].children[a].style.width=f,this.$refs.header[0].children[a].style.minWidth=f,this.$refs.header[0].children[a].style.maxWidth=f,d.width=u,d.style.width=u,d.style["max-width"]=u,d.style["min-width"]=u}}h.append(j("<div></div>").css(d.style).html(c))}l.append(h)}return o.empty(),this.$refs["gridtotal"+i]=n,this.$refs["gridtotalbody"+i]=l,this.$refs["total"+i]=r,r}function L(e,t,i,r,n){for(var s=this.startIndex,l=this.selectedIndexes,o=0;o<e.length;o+=1){var a=this.source[this.startIndex+o];if(a){var d=e[o];if(!(d.children.length<=0))if(a.__hidden)d.style.display="none";else{if(r)if(0===o){var h=getComputedStyle(n[0]);h=parseFloat(h.height)+1,isNaN(h)&&(h=n[0].offsetHeight),d.style.height=h+"px"}else d.style.height=n[o].offsetHeight+"px";var c=a.Values,u=d.className;l.indexOf(o+s)>=0?"data-grid-row data-grid-row-selected"!==u&&(d.className="data-grid-row data-grid-row-selected"):"data-grid-row"!==u&&(d.className="data-grid-row");for(var f=0;f<t.length;f+=1){var p=t[f];if(!1!==p.visible&&(!r||p.isfixed)){var g=void 0;null!=p.text?g=p.text:a.__selected&&"function"==typeof p.editFilter?g=p.editFilter(c):"function"==typeof p.filter?g=p.filter(c):null!=(g=c[p.key])&&null!=g.DisplayValue&&(g=g.DisplayValue),null==g&&(g="");var v=d.children[f],y=v.children[0];if(p.type===q.checkbox){var m=y.querySelector("input"),b=p.enabled;"string"==typeof b?b=c[b]:"function"==typeof b&&(b=b(c)),b=!1===b,m.disabled!==b&&(m.disabled=b),m.checked!==g&&(m.checked=g)}else this.allowHtml||p.allowHtml?g instanceof j?j(y).empty().append(g):y.innerHTML=g:y.innerText=g;if(this._needAutoResize&&p.autoResize){var w=v.scrollWidth;w>0&&null!=i&&(null==i[f]||i[f]<w)&&(i[f]=w,i.flag=!0)}if(p.isurl){var x=c[p.href];x=null!=x?x.Value||x:"",""===x&&""!==y.href?y.removeAttribute("href"):x!==y.href&&(y.href=x)}if(null!=p.classFilter){var _=p.classFilter(c)||"";_!==y.className&&(y.className=_)}if(null!=p.styleFilter){var $=p.styleFilter(c);y.style.length>0&&(y.style.cssText="");for(var C in $)Object.prototype.hasOwnProperty.call($,C)&&(y.style[C]=$[C])}if(null!=p.bgFilter){var k=p.bgFilter(c);v.style.backgroundColor=k||""}if(null!=p.events)for(var I in p.events)Object.prototype.hasOwnProperty.call(p.events,I)&&(y[I]=p.events[I].bind(c));if(null!=p.attrs){var T=p.attrs;"function"==typeof T&&(T=T(c));for(var H in T)Object.prototype.hasOwnProperty.call(T,H)&&y.setAttribute(H,T[H])}}}}}}}var F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j=i(4),D=i(2),E=D.math,P=D.ui,M=D.func,K=i(11);i(5);var B=window._network,G={REORDER:"reorder",RESIZE:"resize",SORT:"sort"},q={common:0,input:1,dropdown:2,checkbox:3},X=!K.isMobile()&&K.isChrome()?0:32,U=10,Z=1023,Y=100,J=4,Q=4,ee=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=q,r.prototype.init=function(e){var t=this;if(delete this.$elems.sizeHolder,delete this.$el,this.$refs={},this.$elems={},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=j(e)),null==e)throw new Error("no specified parent.");this.$parent=e;var i=j('<div class="data-grid" tabindex="0"></div>');i.append('<svg xmlns="http://www.w3.org/2000/svg" style="display: none"><symbol id="gridview-check" viewBox="0 0 512 512"><path d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></symbol><symbol id="spinner-third" viewBox="0 0 512 512"><path d="M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z"></path></symbol><symbol id="ellipsis-h" viewBox="0 0 320 512"><path d="M192 256c0 17.7-14.3 32-32 32s-32-14.3-32-32 14.3-32 32-32 32 14.3 32 32zm88-32c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-240 0c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32z"></path></symbol><symbol id="filter" viewBox="0 0 512 512"><path d="M479.968 0H32.038C3.613 0-10.729 34.487 9.41 54.627L192 237.255V424a31.996 31.996 0 0 0 10.928 24.082l64 55.983c20.438 17.883 53.072 3.68 53.072-24.082V237.255L502.595 54.627C522.695 34.528 508.45 0 479.968 0zM288 224v256l-64-56V224L32 32h448L288 224z"></path></symbol><symbol id="search" viewBox="0 0 512 512"><path d="M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395 312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5 0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208 32s176 78.7 176 176-78.7 176-176 176z"></path></symbol></svg>');var r=j('<span class="data-grid-size-holder"></span>');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 n=t.source&&t.source.length||0;i<n-1&&(delete t.source[i].__selected,i+=1)}return!r||(t.selectedIndexes=[i],t.scrollToIndex(i),t.source[i].__selected=!0,t.refresh(),"function"==typeof t.selectedrowchanged&&t.selectedrowchanged(i),!1)}),i.append(r),this.$elems.sizeHolder=r,e.empty().append(i);var n=z.call(this),s=W.call(this);i.append(n),null!=s&&i.append(s);for(var l=0,o=0;o<this.columns.length&&this.columns[o].isfixed;o+=1)l+=1;if(R.call(this,0===l).insertAfter(n),l>0){var a=this.columns.slice(0,l);this.fixedColumns=a;var d=j('<div class="data-grid data-grid-fixed"></div>');e.append(d);var h=z.call(this,!1),c=W.call(this,!1),u=0;a.forEach(function(e){return u+=!1===e.visible?0:e.width+1}),d.css("width",u),d.append(h),null!=c&&d.append(c),R.call(this,!0,!1).insertAfter(h),this.$el_fixed=d}r.remove();var f=j('<div class="data-grid-loading"><div><svg class="fa-spin fa-loading"><use xlink:href="#spinner-third"></use></svg></div></div>');this.$elems.loading=f,i.append(f),this.$el=i,delete this._rendering,this.sortIndex>=0?$.call(this,this.columns[this.sortIndex],!0):null!=this.sortArray&&this.sortArray.length>0?this.sort():this.resize()},r.prototype.sort=function(){var e=this;if(null!=this.sortArray&&0!==this.sortArray.length){this.source.sort(function(t,i){for(var r=0;r<e.sortArray.length;r+=1){var n=function(r){var n=e.sortArray[r],s=e.columns.filter(function(e){return e.key===n.column&&!1!==e.visible})[0];if(null!=s){var l=_(s,"desc"===n.order?-1:1)(t,i);if(0!==l)return{v:l}}}(r);if("object"===(void 0===n?"undefined":F(n)))return n.v}return 0}),this.refresh();for(var t=this.$refs.header[0].children,i=this.$refs.header_fixed&&this.$refs.header_fixed[0].children,r=0;r<t.length;r+=1){if("break"===function(r){var n=t[r].children[1],s=i&&r<i.length&&i[r].children[1];if(null==n)return"break";var l=e.columns[r],o=e.sortArray.filter(function(e){return e.column===l.key})[0];null!=o?(n.className="arrow "+o.order,s&&(s.className="arrow "+o.order)):"arrow"!==n.className&&(n.className="arrow",s&&(s.className="arrow"))}(r))break}}},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(L.call(this,e,this.columns,t),null!=this.$elems.gridbodyContent_fixed&&L.call(this,this.$elems.gridbodyContent_fixed.children,this.columns,void 0,!0,e),this._needAutoResize&&t.flag){delete this._needAutoResize;for(var i=0;i<this.columns.length;i+=1)if(this.columns[i].autoResize){var r=t[i];r>0&&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;i<this.columns.length;i+=1){var r=this.columns[i];if(null!=r.filterValues&&r.filterValues.length>0){var n=this.$refs.header.children().eq(i);n.find(".data-column-header-filter").removeClass("no-filter").addClass("filtered"),t&&(n=this.$refs.header_fixed.children().eq(i),n.length>0&&n.find(".data-column-header-filter").removeClass("no-filter").addClass("filtered"))}}this.source=this.innerSource.filter(function(t){for(var i=0;i<e.columns.length;i+=1){var r=e.columns[i],n=o((t.Values||t)[r.key],"Value");if(null!=r.filterValues&&r.filterValues.indexOf(n)<0)return!1}return!0}),this.sortIndex>=0?$.call(this,this.columns[this.sortIndex],null,!0):null!=this.sortArray&&this.sortArray.length>0&&this.sort(),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,n=this.$refs.header.height()+2,s=t[0].offsetTop;s!==n&&(t.css("top",n),null!=i&&i.css("top",n),null!=r&&r.css("height",n),s=n),n=this.height,null==n?n=this.$el.height()-s:0===n&&(n=this.$refs.gridbodyContent.height(),this.$el.css("height",s+n)),t.css("height",n);var l=n;if(null!=i){l-=t[0].offsetHeight-t[0].clientHeight,i.css("height",l),null!=this.$el_fixed&&this.$el_fixed.css("height",s+l)}var o=E.trunc((n-1)/this.rowHeight)+2*J+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 u=this.$refs.gridtotalbody.height();if(u>0&&c.height()!==u&&(c.css("height",u),null!=this.$refs.gridtotal_fixed&&this.$refs.gridtotal_fixed.css("height",u),null!=this.$refs.gridtotalbody_fixed&&(this.$refs.gridtotalbody_fixed.css("height",u),this.$refs.gridtotalbody_fixed.children("th:first-child").css("height",u))),this.$refs.gridbodyContent.find("tr.data-grid-row-total-holder").css("height",u),u+=this._containerHeight,this.$refs.gridbodyContainer.height()!==u&&(this.$refs.gridbodyContainer.css("height",u),null!=this.$refs.gridbodyContainer_fixed&&this.$refs.gridbodyContainer_fixed.css("height",u)),0!==d){var f=t[0].offsetWidth-d,p=h[0].style.right;f>0&&""===p?h[0].style.right=f+"px":0===f&&""!==p&&(h[0].style.right="");var g=t[0].offsetHeight-t[0].clientHeight;p=h[0].style.bottom,g>0&&""===p?h[0].style.bottom=g+"px":0===g&&""!==p&&(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;r<i.length;r+=1)!function(e){var r=j(i[e]),n=r.attr("data-key");if(null!=n){var s=t.columns.filter(function(e){return e.key===n})[0];null!=s&&"function"==typeof s.caption&&r.children(".data-column-header-text").empty().append(s.caption())}}(r);this.columns.filter(function(e){return null!=e.filterValues}).length>0?this.refreshGrid():(this.resize(),this.sortIndex>=0?$.call(this,this.columns[this.sortIndex],!0):null!=this.sortArray&&this.sortArray.length>0&&this.sort())},r.prototype.clearHeaderCheckbox=function(){this.$refs.header.find('label>input[type="checkbox"]').each(function(e,t){t.checked=!1})},r.prototype.resetFilter=function(){this.source=this.innerSource;for(var e=0;e<this.columns.length;e+=1)delete this.columns[e].filterValues;"function"==typeof this.afterResetFilter&&this.afterResetFilter(),this.$refs.header.find(".data-column-header-filter.filtered").removeClass("filtered").addClass("no-filter")},r.prototype.scrollToIndex=function(e){var t=I.call(this,e*this.rowHeight,!0);this.$refs.gridbody.prop("scrollTop",t),null!=this.$refs.gridbody_fixed&&this.$refs.gridbody_fixed.prop("scrollTop",t)},r.prototype.scrollTop=function(e){var t=this;if(null==e||isNaN(e))return this.$refs.gridbody.prop("scrollTop");this.$refs.gridbody.prop("scrollTop",e),null!=this.$refs.gridbody_fixed&&this.$refs.gridbody_fixed.prop("scrollTop",e),this.reload(),setTimeout(function(){t.$refs.gridbody.prop("scrollTop",e),null!=t.$refs.gridbody_fixed&&t.$refs.gridbody_fixed.prop("scrollTop",e)},1)},r.prototype.reload=function(){this._containerHeight=this.source.length*this.rowHeight,N.call(this,this.$elems.gridbodyContent),null!=this.$elems.gridbodyContent_fixed&&N.call(this,this.$elems.gridbodyContent_fixed),this.refresh()},r.prototype.reset=function(){var e=this.$refs.gridbody.scrollTop();if(this.resize(!0),this.virtual){var t=e-(e%(2*this.rowHeight)+J*this.rowHeight);if(t<0)t=0;else{var i=this._containerHeight-this.$refs.gridbody.height();t>i&&(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(){j((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.prototype.showSortPanel=function(){var e=this,t=window["lib-ui"].createIcon,i=j('<div style="height: 100%; display: flex; flex-direction: column"></div>'),n=j('<div class="sort-button" style="flex: 0 0 auto; white-space: nowrap; overflow: hidden"></div>'),s=new r;s.rowHeight=33,s.lang=this.lang;var l=function(e){n.children(".button-delete").prop("disabled",e<0),n.children(".button-copy").prop("disabled",e<0),n.children(".button-move-up").prop("disabled",e<1),n.children(".button-move-down").prop("disabled",e>=s.source.length-1)};s.selectedrowchanged=l;var o=function(e){s.selectedIndexes=[e],s._containerHeight=s.source.length*s.rowHeight,N.call(s,s.$elems.gridbodyContent),s.refresh(),s.$refs.gridbody.prop("scrollTop",e*s.rowHeight),l(e)};n.append(j("<button></button>").append(t("fa-light","plus"),j("<span></span>").text(this.lang.addLevel)).on("click",function(){var e=s.selectedIndex,t={Values:{column:"",order:"asc"}};e>=0?(e+=1,s.source.splice(e,0,t)):(s.source.push(t),e=s.source.length-1),o(e)}),j('<button class="button-delete"></button>').append(t("fa-light","times"),j("<span></span>").text(this.lang.deleteLevel)).on("click",function(){var e=s.selectedIndex;e<0||(s.source.splice(e,1),e>=s.source.length&&(e=s.source.length-1),o(e))}),j('<button class="button-copy"></button>').append(t("fa-light","copy"),j("<span></span>").text(this.lang.copyLevel)).on("click",function(){var e=s.selectedIndex;if(!(e<0)){var t=s.source[e];null!=t&&(s.source.splice(e+1,0,{Values:Object.assign({},t.Values)}),o(e+1))}}),j('<button class="button-move-up"></button>').append(t("fa-light","chevron-up")).on("click",function(){var e=s.selectedIndex;if(!(e<1)){if(null!=s.source[e]){var t=s.source.splice(e,1)[0];s.source.splice(e-1,0,t),o(e-1)}}}),j('<button class="button-move-down"></button>').append(t("fa-light","chevron-down")).on("click",function(){var e=s.selectedIndex;if(!(e>=s.source.length-1)){if(null!=s.source[e]){var t=s.source.splice(e,1)[0];s.source.splice(e+1,0,t),o(e+1)}}}));var a=j('<div class="sort-grid" style="flex: 1 1 auto"></div>');i.append(n,a);var d=[{key:"asc",text:this.lang.asc},{key:"desc",text:this.lang.desc}],h=this.columns.filter(function(e){return!1!==e.sortable&&!1!==e.visible}).map(function(e){return{key:e.key,caption:"function"==typeof e.caption?e.caption():e.caption}});s.columns=[{key:"column",caption:this.lang.column,width:270,allowHtml:!0,filter:function(e){var t=j('<div class="dropdown"></div>');return t.dropdown(h,{search:!1,textKey:"caption",valueKey:"key",selected:e.column}).on("select",function(t,i){null!=i&&i.key!==e.column&&(e.column=i.key)}),t},sortable:!1,orderable:!1},{key:"order",caption:this.lang.order,width:150,allowHtml:!0,filter:function(e){var t=j('<div class="dropdown"></div>');return t.dropdown(d,{search:!1,textKey:"text",valueKey:"key",selected:e.order}).on("select",function(t,i){null!=i&&i.key!==e.order&&(e.order=i.key)}),t},sortable:!1,orderable:!1}];var c=new window["lib-ui"].Popup({title:this.lang.sort,content:i[0],resizable:!0,buttons:[{text:this.lang.ok,trigger:function(){var t=s.source;if(null==t||0===t.length)e.sortArray=null;else{for(var i=window["lib-ui"].showAlert,r={},n=0;n<t.length;n+=1){var l=function(n){var l=t[n].Values;if(null==l.column||""===l.column)return s.selectedIndexes=[n],s.refresh(),i(e.lang.sort,e.lang.requirePrompt,"warn"),{v:!1};if(Object.prototype.hasOwnProperty.call(r,l.column)){s.selectedIndexes=[n],s.refresh();var o=h.filter(function(e){return e.key===l.column})[0];return o=null==o?l.column:o.caption,i(e.lang.sort,e.lang.duplicatePrompt.replace("{column}",o),"warn"),{v:!1}}r[l.column]=!0}(n);if("object"===(void 0===l?"undefined":F(l)))return l.v}e.sortArray=t.map(function(e){return e.Values}),e.sortIndex=-1,e.sortDirection=1,e.sort()}return"function"==typeof e.onsorts&&e.onsorts(e.sortArray),!0}},{text:this.lang.cancel}],onResizeEnded:function(){return s.resize()}}),u=this.sortArray||[{column:"",order:"asc"}];c.show(this.$el[0]).then(function(){c.container.style.cssText+="width: 520px; height: 400px",s.init(a),s.setData(u.filter(function(e){return""===e.column||h.filter(function(t){return t.key===e.column}).length>0}).map(function(e){return{Values:e}})),s.selectedIndexes=[0],s.refresh(),l(0)})},r.clearGridWidth=function(e,t){B.query("DeleteManagementGridWidth",[e],t,function(){})},r.applyGridWidth=function(e,t,i,r,n){B.management("GetManagementChartGridLayout",[e],function(e){var s=t;if(e.Result&&e.Result.length>0){"function"==typeof n&&n(e.Result),s=[];for(var l=0;l<e.Result.length;l+=1){for(var o=e.Result[l],a=void 0,d=0;d<t.length;d+=1)if(t[d].name===o.ColumnKey){t[d].width=o.Width;var h=o.Sort;h>0&&(i.sortIndex=s.length,i.sortDirection=2===h?-1:1),a=t[d];break}null!=a&&s.push(a)}}i.columns=s,i.init(),r&&r()},function(){i.columns=t,i.init(),r&&r()})},r.saveColumnInfo=function(e){return function(){for(var t=[],i=0;i<this.columns.length;i+=1){var r=void 0;r=this.sortIndex===i?-1===this.sortDirection?2:1:0;var n=this.columns[i],s={$type:"FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth, FICIntf",ColumnKey:n.name,Width:n.autoResize?-1:n.width,OrderIndex:i,Sort:r};t.push(s)}B.query("SaveManagementGridLayout",[{$type:"FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth[], FICintf",$values:t},e],function(){})}},e.exports=r},4:function(t,i){t.exports=e},5:function(e,t){}})});