jquery.dgtable 0.6.13 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jquery.dgtable.cjs.js +2 -14
- package/dist/jquery.dgtable.cjs.js.map +1 -1
- package/dist/jquery.dgtable.cjs.min.js +2 -2
- package/dist/jquery.dgtable.cjs.min.js.map +1 -1
- package/dist/jquery.dgtable.es6.js +2 -14
- package/dist/jquery.dgtable.es6.js.map +1 -1
- package/dist/jquery.dgtable.es6.min.js +2 -2
- package/dist/jquery.dgtable.es6.min.js.map +1 -1
- package/dist/jquery.dgtable.umd.js +3 -15
- package/dist/jquery.dgtable.umd.js.map +1 -1
- package/dist/jquery.dgtable.umd.min.js +2 -2
- package/dist/jquery.dgtable.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/row_collection.js +1 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* jquery.dgtable 0.6.
|
|
2
|
+
* jquery.dgtable 0.6.14
|
|
3
3
|
* git://github.com/danielgindi/jquery.dgtable.git
|
|
4
4
|
*/
|
|
5
|
-
var e,t;e=this,t=function(e,t,l){"use strict";const o=Array.prototype.indexOf,i=function(e,t){for(let l=0,o=e.length;l>=0&&l<o;l+=1)if(t(e[l],l,e))return e[l]},r=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")};function n(){let e=[];return Object.assign(e,n.prototype),e.initialize.apply(e,arguments),e}n.prototype=[],n.prototype.initialize=function(e){e=e||{},this.sortColumn=null==e.sortColumn?[]:e.sortColumn},n.prototype.add=function(e,t){let l,o;if("splice"in e&&"length"in e)if("number"==typeof t)for(l=0,o=e.length;l<o;l++)this.splice(t++,0,e[l]);else for(l=0,o=e.length;l<o;l++)this.push(e[l]);else"number"==typeof t?this.splice(t,0,e):this.push(e)},n.prototype.reset=function(e){this.length=0,e&&this.add(e)},n.prototype.filteredCollection=function(e,t){if(e&&t){let l=new n({sortColumn:this.sortColumn,onComparatorRequired:this.onComparatorRequired,customSortingProvider:this.customSortingProvider});for(let o,i=0,r=this.length;i<r;i++)o=this[i],e(o,t)&&(o.__i=i,l.push(o));return l}return null},n.prototype.onComparatorRequired=null,n.prototype.customSortingProvider=null,n.prototype.onSort=null;let s=n.prototype.sort;function a(e,t){let l=e.column,o=e.comparePath||l;"string"==typeof o&&(o=o.split("."));let i,r=o.length,n=r>1,s=t?1:-1,a=t?-1:1;return function(e,t){let l=e[o[0]],d=t[o[0]];if(n)for(i=1;i<r;i++)l=l&&l[o[i]],d=d&&d[o[i]];return l===d?0:null==l?s:null==d?a:l<d?s:a}}function d(){let e=[];return Object.assign(e,d.prototype),e.initialize.apply(e,arguments),e}n.prototype.sort=function(e){let t;if(this.sortColumn.length){let l=[];for(let e=0;e<this.sortColumn.length;e++){t=null;const o=a(this.sortColumn[e],this.sortColumn[e].descending);this.onComparatorRequired&&(t=this.onComparatorRequired(this.sortColumn[e].column,this.sortColumn[e].descending,o)),t||(t=o),l.push(t.bind(this))}if(1===l.length)t=l[0];else{let e,o=l.length;t=function(t,i){for(let r=0;r<o;r++)if(e=l[r](t,i),0!==e)return e;return e}}const o=e=>s.call(e,t);if(this.customSortingProvider){let e=this.customSortingProvider(this,o);e!==this&&this.splice(0,this.length,...e)}else o(this);e||this.onSort&&this.onSort(t)}return t},d.prototype=[],d.prototype.initialize=function(){},d.prototype.get=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].name===e)return this[t];return null},d.prototype.indexOf=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].name===e)return t;return-1},d.prototype.getByOrder=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].order===e)return this[t];return null},d.prototype.normalizeOrder=function(){let e,t=[];for(e=0;e<this.length;e++)t.push(this[e]);for(t.sort((function(e,t){return e.order<t.order?-1:e.order>t.order?1:0})),e=0;e<t.length;e++)t[e].order=e;return this},d.prototype.getColumns=function(){let e=[];for(let t,l=0;l<this.length;l++)t=this[l],e.push(t);return e.sort(((e,t)=>e.order<t.order?-1:e.order>t.order?1:0)),e},d.prototype.getVisibleColumns=function(){let e=[];for(let t,l=0;l<this.length;l++)t=this[l],t.visible&&e.push(t);return e.sort(((e,t)=>e.order<t.order?-1:e.order>t.order?1:0)),e},d.prototype.getMaxOrder=function(){let e=0;for(let t,l=0;l<this.length;l++)t=this[l],t.order>e&&(e=t.order);return e},d.prototype.moveColumn=function(e,t){if(e&&t){let l,o,i=e.order,r=t.order;if(i<r)for(l=i+1;l<=r;l++)o=this.getByOrder(l),o.order--;else for(l=i-1;l>=r;l--)o=this.getByOrder(l),o.order++;e.order=r}return this};class h{static saveSelection(e){let t=window.getSelection().getRangeAt(0);if(e!==t.commonAncestorContainer&&!function(e,t){for(;(e=e.parentNode)&&e!==t;);return!!e}(t.commonAncestorContainer,e))return null;let l=t.cloneRange();l.selectNodeContents(e),l.setEnd(t.startContainer,t.startOffset);let o=l.toString().length;return{start:o,end:o+t.toString().length}}static restoreSelection(e,t){let l,o=0,i=[e],r=!1,n=!1,s=document.createRange();for(s.setStart(e,0),s.collapse(!0);!n&&(l=i.pop());)if(3===l.nodeType){let e=o+l.length;!r&&t.start>=o&&t.start<=e&&(s.setStart(l,t.start-o),r=!0),r&&t.end>=o&&t.end<=e&&(s.setEnd(l,t.end-o),n=!0),o=e}else{let e=l.childNodes.length;for(;e--;)i.push(l.childNodes[e])}let a=window.getSelection();a.removeAllRanges(),a.addRange(s)}}const u=Object.prototype.hasOwnProperty,c=void 0!==Element.prototype.insertAdjacentElement;function m(e,t,l){t?!1===c||e instanceof DocumentFragment?l.insertBefore(e,t):t.insertAdjacentElement("beforebegin",e):l.appendChild(e)}function p(e,t,l,o){return e.parentNode!==o?(t||(t=document.createDocumentFragment()),t.appendChild(e)):(t&&t.childNodes.length>0&&(m(t,l,o),t=null),e.nextSibling!==l&&m(e,l,o)),t}class g{constructor(e){const t=this._p={list:e.list||null,hookScrollEvent:void 0===e.hookScrollEvent||!!e.hookScrollEvent,count:e.count||0,virtual:void 0===e.virtual||!!e.virtual,userItemsParent:e.itemsParent||null,setVirtualWrapperWidth:e.autoVirtualWrapperWidth??!0,estimatedItemHeight:20,buffer:5,itemHeightEstimatorFn:null,itemElementCreatorFn:v,onItemRender:null,onItemUnrender:null,onScrollHeightChange:null,virtualWrapper:null,currentItemsParent:null,cachedItemHeights:[],cachedItemEstimatedHeights:[],cachedItemPositions:[],itemPositionsNeedsUpdate:0,boundRender:this.render.bind(this),existingEls:[]};t.currentItemsParent=t.userItemsParent||t.list,"boolean"==typeof e.hookScrollEvent?this.setHookScrollEvent(e.hookScrollEvent):this._hookEvents(),"number"==typeof e.count&&this.setCount(e.count),"boolean"==typeof e.virtual&&this.setVirtual(e.virtual),"number"==typeof e.estimatedItemHeight&&this.setEstimatedItemHeight(e.estimatedItemHeight),"number"==typeof e.buffer&&this.setBuffer(e.buffer),"function"==typeof e.itemHeightEstimatorFn&&this.setItemHeightEstimatorFn(e.itemHeightEstimatorFn),"function"==typeof e.itemElementCreatorFn&&this.setItemElementCreatorFn(e.itemElementCreatorFn),"function"==typeof e.onItemRender&&this.setOnItemRender(e.onItemRender),"function"==typeof e.onItemUnrender&&this.setOnItemUnrender(e.onItemUnrender),"function"==typeof e.onScrollHeightChange&&this.setOnScrollHeightChange(e.onScrollHeightChange)}destroy(){this._unhookEvents().invalidate()._destroyElements()}setHookScrollEvent(e){const t=this._p;return e=void 0===e||!!e,t.hookScrollEvent===e||(t.hookScrollEvent=e,this._unhookEvents()._hookEvents()),this}isHookScrollEventEnabled(){return this._p.hookScrollEvent}setCount(e){return this._p.count=e,this.invalidate()}getCount(){return this._p.count}setVirtual(e){const t=this._p;return e=void 0===e||!!e,t.virtual===e||(t.virtual=e,this._hookEvents().invalidate()._destroyElements()),this}isVirtual(){return this._p.virtual}setEstimatedItemHeight(e){return this._p.estimatedItemHeight=Math.abs(("number"==typeof e?e:Number(e))||20),this}getEstimatedItemHeight(){return this._p.estimatedItemHeight}setAutoVirtualWrapperWidth(e){const t=this._p;return t.autoVirtualWrapperWidth=void 0===e||!!e,t.virtualWrapper&&t.autoVirtualWrapperWidth!==t.virtualWrapperWidthWasSet&&(t.virtualWrapper.style.width=t.autoVirtualWrapperWidth?"100%":"",t.virtualWrapperWidthWasSet=t.autoVirtualWrapperWidth),this}isAutoVirtualWrapperWidth(){return this._p.autoVirtualWrapperWidth}setBuffer(e){return this._p.buffer=Math.abs("number"==typeof e?e:Number(e)||5),this}getBuffer(){return this._p.buffer}setItemHeightEstimatorFn(e){return this._p.itemHeightEstimatorFn=e,this}setItemElementCreatorFn(e){return this._p.itemElementCreatorFn=e||v,this}setOnItemRender(e){return this._p.onItemRender=e,this}setOnItemUnrender(e){return this._p.onItemUnrender=e,this}setOnScrollHeightChange(e){return this._p.onScrollHeightChange=e,this}estimateFullHeight(){const e=this._p;if(0===e.count)return 0;if(e.virtual)return this._calculateItemPosition(e.count)||0;{const t=e.existingEls;if(e.count===t.length){let e=t[0].getBoundingClientRect(),l=t[t.length-1].getBoundingClientRect();return l.top-e.top+l.height}return this._calculateItemPosition(e.count)||0}}invalidatePositions(){const e=this._p;return e.itemPositionsNeedsUpdate=0,e.cachedItemHeights=[],e.cachedItemEstimatedHeights=[],e.cachedItemPositions=[],e.cachedItemHeights.length=e.count,e.cachedItemEstimatedHeights.length=e.count,e.cachedItemPositions.length=e.count,this}invalidate(){const e=this._p;return this.invalidatePositions(),e.virtual||this._destroyElements(),this}render(){const e=this._p,t=e.list,l=e.virtual;let o=e.virtualWrapper,i=e.currentItemsParent,r=t.scrollTop,n=r+t.clientHeight,s=e.count,a=e.buffer,d=e.onItemUnrender,h=e.existingEls,c=h.length;if(l){const l=t.clientWidth;o||(o=e.virtualWrapper=e.userItemsParent,o||(o=e.virtualWrapper=document.createElement("div"),t.appendChild(o)),this._resetCurrentItemsParent(),i=e.currentItemsParent,e.autoVirtualWrapperWidth?(o.style.width="100%",e.virtualWrapperWidthWasSet=!0):e.virtualWrapperWidthWasSet=!1);for(let e=0;e<c;e++)h[e][b]=!0;this._calculateItemPosition(e.count-1);let d=this._getExistingElsRange(),g=C(e.cachedItemPositions,r),v=Math.max(0,g-a),w=v,_=this._calculateItemPosition(w),W=a,E=Math.max(w,C(e.cachedItemPositions,n-1)+1+a),I=[],R=null,H=o.childNodes[0];const x=function(e){let t;return-1!==d.firstIndex&&e>=d.firstIndex&&e<=d.lastIndex&&(t=h.find((t=>t[f]===e&&!0===t[b]))),void 0===t&&(t=(d.firstIndex<v||d.firstValidArrayIndex>0?h.find((e=>(e[f]<v||!1===u.call(e,f))&&!0===e[b])):void 0)||y(h,(e=>!0===e[b]))),void 0!==t&&delete t[b],t};for(;w<s&&w<E;w++){let e=x(w);H&&H===e&&(H=H.nextSibling);const t=this._dequeueElementForIndex(e,w,H,!0);I.push([t,w]),R=p(t,R,H,i)}R&&R.childNodes.length>0&&m(R,H,i);for(let t of I){const l=t[1];this._insertItemAndFlow(t[0],l,!1),_=e.cachedItemPositions[l]+e.cachedItemHeights[l]}if(_<n)for(;(_<n||W-- >0)&&w<s;w++){let t=x(w);H&&H===t&&(H=H.nextSibling),this._dequeueElementForIndex(t,w,H,!1),_=e.cachedItemPositions[w]+e.cachedItemHeights[w]}let S=this.estimateFullHeight(),N=S+"px";o.style.height!==N&&(e.virtualWrapper.style.height=N,e.onScrollHeightChange?.(S)),l!==t.clientWidth&&this.render()}else if(s!==h.length){for(let e=0;e<c;e++)h[e][b]=!0;let e=i.childNodes[0],t=null;for(let l=0;l<s;l++){let o=h.find((e=>e[f]===l&&!0===e[b]));void 0!==o&&delete o[b],e&&e===o&&(e=e.nextSibling),t=p(this._dequeueElementForIndex(o,l,e,!0),t,e,i)}t&&t.childNodes.length>0&&m(t,e,i)}c=h.length;for(let e=0;e<c;e++){const t=h[e];if(!0!==t[b])continue;let l=t.parentNode;l&&l.removeChild(t),d&&void 0!==t[f]&&d(t),h.splice(e,1),e--,c--}}addItemsAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if("number"!=typeof e||e<=0)return this;const l=this._p;if((t<0||t>=l.count)&&(t=l.count),l.count+=e,l.virtual)t>=0&&t<l.count&&this._invalidateItemIndexesAt(t,-1);else{let o=l.existingEls;if(o.length!==l.count-e)return this;let i=this._getExistingElsRange();if(-1===i.firstValidArrayIndex)return this;const r=l.currentItemsParent;let n=i.firstValidArrayIndex+t-i.firstIndex;this._pushItemIndexesAt(t,e);let s=o[n-1]?o[n-1].nextSibling:o[0],a=null;for(let l=t,o=t+e;l<o;l++)a=p(this._dequeueElementForIndex(void 0,l,s,!0),a,s,r);a&&a.childNodes.length>0&&m(a,s,r)}return this}removeItemsAt(e,t){const l=this._p;if("number"!=typeof e||"number"!=typeof t||e<=0||t<0||t>=l.count)return this;if(l.count-=Math.min(e,l.count-t),l.virtual)this._invalidateItemIndexesAt(t,-1);else{let o=l.existingEls;if(o.length!==l.count+e)return this;let i=this._getExistingElsRange();if(-1===i.firstValidArrayIndex)return this;this._pushItemIndexesAt(t+e,-e);const r=l.onItemUnrender;let n=i.firstValidArrayIndex+t-i.firstIndex;if(n<o.length){for(let t=0;t<e;t++){let e=o[n+t],l=e.parentNode;l&&l.removeChild(e),r&&void 0!==e[f]&&r(e)}o.splice(n,e)}}return this}refreshItemAt(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return this;if(t.virtual)this._invalidateItemIndexesAt(e,1);else{let l=t.existingEls;if(l.length!==t.count)return this;let o=this._getExistingElsRange();if(e>=o.firstIndex&&e<=o.lastIndex){let t=l[o.firstValidArrayIndex+e-o.firstIndex];delete t[f],this._dequeueElementForIndex(t,e,t.nextSibling,!1)}}return this}isItemRendered(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return!1;let l=this._getExistingElsRange();return e>=l.firstIndex&&e<=l.lastIndex}getItemElementAt(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return;let l=t.existingEls,o=this._getExistingElsRange();return e>=o.firstIndex&&e<=o.lastIndex?l[o.firstValidArrayIndex+e-o.firstIndex]:void 0}getItemPosition(e){const t=this._p;if(!("number"!=typeof e||e<0||e>=t.count)){if(t.virtual)return this._calculateItemPosition(e);{let o=this.getItemElementAt(e);if(void 0===o)return;const i=t.list;return l.getElementOffset(o).top-l.getElementOffset(i).top+i.scrollTop}}}getItemIndexFromElement(e){return e?e[f]:void 0}getItemSize(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return;let l=t.cachedItemHeights[e-1];return void 0===l&&(l=t.itemHeightEstimatorFn?t.itemHeightEstimatorFn(e-1):null,"number"!=typeof l&&(l=t.estimatedItemHeight),t.cachedItemEstimatedHeights[e-1]=l),l}getVisibleItemCount(){const e=this._p,t=e.list;let l,o,i=t.scrollTop,r=t.clientHeight;if(e.virtual)l=C(e.cachedItemPositions,i),o=C(e.cachedItemPositions,i+r,l);else{const t=e=>{let t=this.getItemPosition(e);return void 0===t&&(t=1/0),t};l=w(e.count,t,i),o=w(e.count,t,i+r,l)}return this.getItemPosition(o)===i+r&&o--,o-l+1}createGhostItemElement(e,t,l){const o=this._p;let i=this._dequeueElementForIndex(null,e,!1,!0);try{t&&o.currentItemsParent.appendChild(i),l(i)}finally{if(t){let e=i.parentNode;e&&e.removeChild(i)}o.onItemUnrender&&o.onItemUnrender(i)}}_resetCurrentItemsParent(){const e=this._p;e.currentItemsParent=e.virtualWrapper??e.userItemsParent??e.list}_destroyElements(){const e=this._p,t=e.onItemUnrender,l=e.existingEls;for(let e=0;e<l.length;e++){const o=l[e];let i=o.parentNode;i&&i.removeChild(o),t&&void 0!==o[f]&&t(o)}return l.length=0,e.virtualWrapper&&(e.virtualWrapper!==e.userItemsParent&&e.virtualWrapper.parentNode&&e.virtualWrapper.parentNode.removeChild(e.virtualWrapper),e.virtualWrapper=null,this._resetCurrentItemsParent()),this}_invalidateItemIndexesAt(e,t){const l=this._p;this._setItemPositionsNeedsUpdate(e);let o=l.existingEls,i=o.length,r=this._getExistingElsRange();if(-1!==r.firstValidArrayIndex&&(-1===t&&(t=o.length),e>=r.firstIndex&&e<=r.lastIndex))for(let l=r.firstValidArrayIndex+e-r.firstIndex,n=0;l<i&&n<t;l++,n++)delete o[l][f]}_pushItemIndexesAt(e,t){let l=this._p.existingEls,o=l.length,i=this._getExistingElsRange();if(-1!==i.firstValidArrayIndex&&e>=i.firstIndex&&e<=i.lastIndex)for(let r=i.firstValidArrayIndex+e-i.firstIndex;r<o;r++)l[r][f]+=t}_hookEvents(){const e=this._p;return this._unhookEvents(),e.virtual&&e.hookScrollEvent&&e.list&&e.list.addEventListener("scroll",e.boundRender),this}_unhookEvents(){const e=this._p;return e.list&&e.list.removeEventListener("scroll",e.boundRender),this}_setItemPositionsNeedsUpdate(e){const t=this._p;e<t.itemPositionsNeedsUpdate&&(t.itemPositionsNeedsUpdate=e)}_calculateItemPosition(e){const t=this._p,l=t.cachedItemPositions;if(e>=t.itemPositionsNeedsUpdate){const o=t.count,i=t.cachedItemHeights,r=t.cachedItemEstimatedHeights,n=t.estimatedItemHeight,s=t.itemHeightEstimatorFn;i.length!==o&&(i.length=o,r.length=o,l.length=o);let a=t.itemPositionsNeedsUpdate,d=Math.min(e,o),h=0;a>0&&(h=l[a-1]);for(let e=a;e<=d;e++){if(0===e){l[e]=h;continue}const t=e-1;let o=i[t];void 0===o&&(o=s?s(t):null,"number"!=typeof o&&(o=n),r[t]=o),h+=o,l[e]=h}t.itemPositionsNeedsUpdate=d+1}if(e>0&&e===t.count){let o=t.cachedItemHeights[e-1];return void 0===o&&(o=t.itemHeightEstimatorFn?t.itemHeightEstimatorFn(e-1):null,"number"!=typeof o&&(o=t.estimatedItemHeight),t.cachedItemEstimatedHeights[e-1]=o),l[e-1]+o}return l[e]}_dequeueElementForIndex(e,t,l,o){const i=this._p,r=i.virtualWrapper;i.currentItemsParent;const n=i.existingEls,s=i.onItemRender,a=i.onItemUnrender,d=!e,h=d||t!==e[f];if(e?a&&h&&a(e):(e=i.itemElementCreatorFn(),r&&!1!==l&&(e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.right="0")),h&&(e.innerHTML="",s&&s(e,t)),!1!==l){if(l instanceof Node||(l=null),!d){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}let i=l?n.indexOf(l):-1;-1===i?n.push(e):n.splice(i,0,e),o||this._insertItemAndFlow(e,t,l)}return e[f]=t,e}_insertItemAndFlow(e,t,l){const o=this._p,i=o.virtualWrapper,r=o.currentItemsParent;if(!1!==l&&(l instanceof Node||(l=null),e.parentNode===r&&e.nextSibling===l||m(e,l,r)),i){let l=e.getBoundingClientRect().height,i=o.cachedItemHeights[t];i!==l&&(o.cachedItemHeights[t]=l),(void 0!==i&&l!==i||void 0===i&&l!==o.cachedItemEstimatedHeights[t])&&this._setItemPositionsNeedsUpdate(t+1);let r=this._calculateItemPosition(t);const n=W();!1===n?e.style.top=`${r}px`:e.style[n]=`translateY(${r}px)`}}_getExistingElsRange(){const e=this._p.existingEls;let t=-1,l=-1;for(let l=0,o=e.length;l<o;l++)if(!1!==u.call(e[l],f)){t=l;break}for(let t=e.length-1;t>=0;t--)if(!1!==u.call(e[t],f)){l=t;break}return{firstValidArrayIndex:t,lastValidArrayIndex:l,firstIndex:-1!==t?e[t][f]:-1,lastIndex:-1!==l?e[l][f]:-1}}}const f=Symbol("index"),b=Symbol("reuse"),v=()=>document.createElement("li"),C=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=e.length;if(o<0&&(o+=i),o<=l)return o;for(;l<=o;){let r=Math.floor(l+(o-l)/2),n=e[r];if(n===t||n<=t&&r<i&&e[r+1]>t){for(;r>0&&e[r-1]===n;)r--;return r}n<t?l=r+1:o=r-1}return-1===o?0:i-1},w=function(e,t,l){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;if(i<0&&(i+=e),i<=o)return i;for(;o<=i;){let r=Math.floor(o+(i-o)/2),n=t(r);if(n===l||n<=l&&r<e&&t(r+1)>l){for(;r>0&&t(r-1)===n;)r--;return r}n<l?o=r+1:i=r-1}return-1===i?0:t(e-1)},y=(e,t)=>{for(let l=e.length-1;l>=0;l--)if(t(e[l]))return e[l]};let _=null;const W=()=>{if(null===_){let e=["transform","WebkitTransform","MozTransform","OTransform","msTransform"],t=document.createElement("div");_=!1;for(let l of e)if(t&&void 0!==t.style[l]){_=l;break}}return _};function E(e,t){let l=t.column,o=null==t.keyword?"":t.keyword.toString();if(!o||!l)return!0;let i=e[l];return null!=i&&(i=i.toString(),t.caseSensitive||(i=i.toLowerCase(),o=o.toLowerCase()),-1!==i.indexOf(o))}const I=Array.prototype.indexOf,R=e;let H=navigator.userAgent,x=-1!==H.indexOf("MSIE ")?parseFloat(H.substr(H.indexOf("MSIE ")+5)):null,S=x&&x<10,N=document.createElement.bind(document);const T=Object.prototype.hasOwnProperty,P=Symbol("safe"),F=Symbol("hover_in"),A=Symbol("hover_out"),z=Symbol("row_click");function M(e){var t,l;t=["relative","absolute","fixed"],l=e.css("position"),o.call(t,l)>=0||e.css("position","relative")}const L=e=>/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e.target.tagName);let k=function e(){if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[e].concat(Array.prototype.slice.call(arguments,0))));this.initialize.apply(this,arguments)};k.VERSION="@@VERSION",k.prototype.VERSION=k.VERSION,k.prototype.initialize=function(e){let t=this;e=e||{};let l=t.o={},o=t.p={};o.events={},t.el=e.el&&e.el instanceof Element?e.el:document.createElement("div");let i=t.$el=R(t.el);t.el!==e.el&&i.addClass(e.className||"dgtable-wrapper"),i.data("control",t).data("dgtable",t),i.on("remove",(()=>t.destroy())),o.onMouseMoveResizeAreaBound=this._onMouseMoveResizeArea.bind(this),o.onEndDragColumnHeaderBound=this._onEndDragColumnHeader.bind(this),o.onTableScrolledHorizontallyBound=this._onTableScrolledHorizontally.bind(this),this.$el.on("dragend",o.onEndDragColumnHeaderBound),o.tableSkeletonNeedsRendering=!0,l.virtualTable=void 0===e.virtualTable||!!e.virtualTable,l.estimatedRowHeight=e.estimatedRowHeight||void 0,l.rowsBufferSize=e.rowsBufferSize||3,l.minColumnWidth=Math.max(e.minColumnWidth||35,0),l.resizeAreaWidth=e.resizeAreaWidth||8,l.resizableColumns=void 0===e.resizableColumns||!!e.resizableColumns,l.movableColumns=void 0===e.movableColumns||!!e.movableColumns,l.sortableColumns=void 0===e.sortableColumns?1:parseInt(e.sortableColumns,10)||1,l.adjustColumnWidthForSortArrow=void 0===e.adjustColumnWidthForSortArrow||!!e.adjustColumnWidthForSortArrow,l.convertColumnWidthsToRelative=void 0!==e.convertColumnWidthsToRelative&&!!e.convertColumnWidthsToRelative,l.autoFillTableWidth=void 0!==e.autoFillTableWidth&&!!e.autoFillTableWidth,l.allowCancelSort=void 0===e.allowCancelSort||!!e.allowCancelSort,l.cellClasses=void 0===e.cellClasses?"":e.cellClasses,l.resizerClassName=void 0===e.resizerClassName?"dgtable-resize":e.resizerClassName,l.tableClassName=void 0===e.tableClassName?"dgtable":e.tableClassName,l.allowCellPreview=void 0===e.allowCellPreview||e.allowCellPreview,l.allowHeaderCellPreview=void 0===e.allowHeaderCellPreview||e.allowHeaderCellPreview,l.cellPreviewClassName=void 0===e.cellPreviewClassName?"dgtable-cell-preview":e.cellPreviewClassName,l.cellPreviewAutoBackground=void 0===e.cellPreviewAutoBackground||e.cellPreviewAutoBackground,l.onComparatorRequired=void 0===e.onComparatorRequired?null:e.onComparatorRequired,l.onComparatorRequired||"function"!=typeof e.comparatorCallback||(l.onComparatorRequired=e.comparatorCallback),l.customSortingProvider=void 0===e.customSortingProvider?null:e.customSortingProvider,l.width=void 0===e.width?k.Width.NONE:e.width,l.relativeWidthGrowsToFillWidth=void 0===e.relativeWidthGrowsToFillWidth||!!e.relativeWidthGrowsToFillWidth,l.relativeWidthShrinksToFillWidth=void 0!==e.relativeWidthShrinksToFillWidth&&!!e.relativeWidthShrinksToFillWidth,this.setCellFormatter(e.cellFormatter),this.setHeaderCellFormatter(e.headerCellFormatter),this.setFilter(e.filter),l.height=e.height,t.setColumns(e.columns||[],!1);let r=[];if(e.sortColumn){let t=e.sortColumn;if(t&&!Array.isArray(t)&&(t=[t]),t)for(let e=0,l=t.length;e<l;e++){let l=t[e];"string"==typeof l&&(l={column:l,descending:!1});let i=o.columns.get(l.column);i&&r.push({column:l.column,comparePath:i.comparePath||i.dataPath,descending:l.descending})}}o.rows=new n({sortColumn:r}),o.rows.onComparatorRequired=(e,t,o)=>{if(l.onComparatorRequired)return l.onComparatorRequired(e,t,o)},o.rows.customSortingProvider=(e,t)=>l.customSortingProvider?l.customSortingProvider(e,t):t(e),o.filteredRows=null,o.scrollbarWidth=0,o.lastVirtualScrollHeight=0,this._setupHovers()},k.prototype._setupHovers=function(){const e=this,t=e.p;let l=function(t){let l=t.fromElement||t.relatedTarget;l===this||R.contains(this,l)||this.__previewCell&&(l===this.__previewCell||R.contains(this.__previewCell,l))||e._cellMouseOverEvent.call(e,this)},o=function(t){let l=(t=t||event).toElement||t.relatedTarget;l===this||R.contains(this,l)||this.__previewCell&&(l===this.__previewCell||R.contains(this.__previewCell,l))||e._cellMouseOutEvent.call(e,this)};t._bindCellHoverIn=function(e){e[F]||e.addEventListener("mouseover",e[F]=l.bind(e))},t._unbindCellHoverIn=function(e){e[F]&&(e.removeEventListener("mouseover",e[F]),e[F]=null)},t._bindCellHoverOut=function(e){return e[A]||e.addEventListener("mouseout",e[A]=o.bind(e.__cell||e)),this},t._unbindCellHoverOut=function(e){return e[A]&&(e.removeEventListener("mouseout",e[A]),e[A]=null),this}},k.prototype._setupVirtualTable=function(){const e=this,t=e.p,l=e.o,o=l.tableClassName,i=o+"-row",r=o+"-row-alt",n=o+"-cell";let s=t.visibleColumns,a=s.length;t.notifyRendererOfColumnsConfig=()=>{s=t.visibleColumns,a=s.length;for(let e,t=0;t<a;t++)e=s[t],e._finalWidth=e.actualWidthConsideringScrollbarWidth||e.actualWidth},t.virtualListHelper=new g({list:t.table,itemsParent:t.tbody,autoVirtualWrapperWidth:!1,virtual:l.virtualTable,buffer:l.rowsBufferSize,estimatedItemHeight:l.estimatedRowHeight?l.estimatedRowHeight:t.virtualRowHeight||40,itemElementCreatorFn:()=>N("div"),onItemRender:(o,d)=>{const h=t.filteredRows||t.rows,u=!!t.filteredRows,c=l.allowCellPreview;o.className=i,d%2==1&&(o.className+=" "+r);let m=h[d],p=u?m.__i:d;o.rowIndex=d,o.physicalRowIndex=p;for(let e=0;e<a;e++){let l=s[e],i=N("div");i.columnName=l.name,i.setAttribute("data-column",l.name),i.className=n,i.style.width=l._finalWidth+"px",l.cellClasses&&(i.className+=" "+l.cellClasses),c&&t._bindCellHoverIn(i),i.appendChild(N("div")).innerHTML=this._getHtmlForCell(m,l),o.appendChild(i)}o.addEventListener("click",o[z]=t=>{e.trigger("rowclick",t,d,p,o,m)}),e.trigger("rowcreate",d,p,o,m)},onItemUnrender:t=>{t[z]&&t.removeEventListener("click",t[z]),e._unbindCellEventsForRow(t),e.trigger("rowdestroy",t)},onScrollHeightChange:e=>{e>t._lastVirtualScrollHeight&&!t.scrollbarWidth&&this._updateLastCellWidthFromScrollbar(),t._lastVirtualScrollHeight=e}}),t.virtualListHelper.setCount((t.filteredRows??t.rows).length),t.notifyRendererOfColumnsConfig()},k.prototype.on=function(e,t){let l=this.p.events;return"function"!=typeof t||(T.call(l,e)||(l[e]=[]),l[e].push({cb:t,once:!1})),this},k.prototype.once=function(e,t){let l=this.p.events;return"function"!=typeof t||(T.call(l,e)||(l[e]=[]),l[e].push({cb:t,once:!0})),this},k.prototype.off=function(e,t){let l=this.p.events;if(!T.call(l,e))return this;let o=l[e];for(let e=0;e<o.length;e++){let l=o[e];t&&l.cb!==t||o.splice(e--,1)}return this},k.prototype.trigger=function(e){const t=this.p;if(!t)return;let l=t.events;if(T.call(l,e)){let t=l[e];for(let e=0;e<t.length;e++){let l=t[e];l.once&&t.splice(e--,1),l.cb.apply(this,Array.prototype.slice.call(arguments,1))}}return this},k.prototype._parseColumnWidth=function(e,t){let l=Math.max(0,parseFloat(e)),o=O.AUTO;return l>0&&(e===l+"%"?(o=O.RELATIVE,l/=100):l>0&&l<1?o=O.RELATIVE:(l<t&&(l=t),o=O.ABSOLUTE)),{width:l,mode:o}},k.prototype._initColumnFromData=function(e){let t=this._parseColumnWidth(e.width,e.ignoreMin?0:this.o.minColumnWidth),l={name:e.name,label:void 0===e.label?e.name:e.label,width:t.width,widthMode:t.mode,resizable:void 0===e.resizable||e.resizable,sortable:void 0===e.sortable||e.sortable,movable:void 0===e.movable||e.movable,visible:void 0===e.visible||e.visible,cellClasses:void 0===e.cellClasses?this.o.cellClasses:e.cellClasses,ignoreMin:void 0!==e.ignoreMin&&!!e.ignoreMin};return l.dataPath=void 0===e.dataPath?l.name:e.dataPath,l.comparePath=void 0===e.comparePath?l.dataPath:e.comparePath,"string"==typeof l.dataPath&&(l.dataPath=l.dataPath.split(".")),"string"==typeof l.comparePath&&(l.comparePath=l.comparePath.split(".")),l},k.prototype.close=k.prototype.remove=k.prototype.destroy=function(){let e=this,t=e.p||{},l=e.$el;if(e.__removed)return e;if(t.$resizer&&(t.$resizer.remove(),t.$resizer=null),t.virtualListHelper?.destroy(),t.virtualListHelper=null,this._destroyHeaderCells(),t.$table&&t.$table.empty(),t.$tbody&&t.$tbody.empty(),t.workerListeners){for(let e=0;e<t.workerListeners.length;e++){let l=t.workerListeners[e];l.worker.removeEventListener("message",l.listener,!1)}t.workerListeners.length=0}t.rows.length=t.columns.length=0,t._deferredRender&&clearTimeout(t._deferredRender);for(let t in e)T.call(e,t)&&(e[t]=null);return e.__removed=!0,l&&l.remove(),this},k.prototype._unbindCellEventsForTable=function(){const e=this.p;if(e.headerRow)for(let t=0,l=e.headerRow.childNodes,o=l.length;t<o;t++)for(let o=0,i=l[t].childNodes,r=i.length;o<r;o++)e._unbindCellHoverIn(i[o]);return this},k.prototype._unbindCellEventsForRow=function(e){const t=this.p;for(let l=0,o=e.childNodes,i=o.length;l<i;l++)t._unbindCellHoverIn(o[l]);return this},k.prototype.render=function(){const e=this.o,l=this.p;if(!this.el.offsetParent)return l._deferredRender||(l._deferredRender=setTimeout((()=>{l._deferredRender=null,!this.__removed&&this.el.offsetParent&&this.render()}))),this;if(!0===l.tableSkeletonNeedsRendering){l.tableSkeletonNeedsRendering=!1,e.width===k.Width.AUTO&&this._clearSortArrows();let o=l.table&&l.table.parentNode?l.table.scrollTop:NaN,i=l.table&&l.table.parentNode?t.getScrollHorz(l.table):NaN;this._renderSkeletonBase()._renderSkeletonBody().tableWidthChanged(!0,!1)._renderSkeletonHeaderCells(),l.virtualListHelper.setCount((l.filteredRows??l.rows).length),this._updateVirtualHeight(),this._updateLastCellWidthFromScrollbar(!0),this._updateTableWidth(!0);for(let e=0;e<l.rows.sortColumn.length;e++)this._showSortArrow(l.rows.sortColumn[e].column,l.rows.sortColumn[e].descending);e.adjustColumnWidthForSortArrow&&l.rows.sortColumn.length?this.tableWidthChanged(!0):e.virtualTable||this.tableWidthChanged(),isNaN(o)||(l.table.scrollTop=o),isNaN(i)||(t.setScrollHorz(l.table,i),t.setScrollHorz(l.header,i)),this.trigger("renderskeleton")}return l.virtualListHelper.render(),this.trigger("render"),this},k.prototype.clearAndRender=function(e){let t=this.p;return t.tableSkeletonNeedsRendering=!0,t.notifyRendererOfColumnsConfig?.(),(void 0===e||e)&&this.render(),this},k.prototype._calculateTbodyWidth=function(){const e=this.p;let t,o,i,r=this.o.tableClassName,n=r+"-row",s=r+"-cell",a=e.visibleColumns,d=a.length,h=R("<div>").addClass(n).css("float","left"),u=0;for(o=0;o<d;o++)i=a[o],t=N("div"),t.className=s,t.style.width=i.actualWidth+"px",i.cellClasses&&(t.className+=" "+i.cellClasses),t.appendChild(N("div")),h.append(t),u+=i.actualWidth;let c=R("<div>").addClass(this.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px",float:"left",width:"1px",overflow:"hidden"}).append(R("<div>").addClass(r).append(R("<div>").addClass(r+"-body").css("width",u+1e4).append(h)));c.appendTo(document.body);let m=R('<div style="border:1.5px solid #000;width:0;height:0;position:absolute;left:0;top:-9999px">').appendTo(document.body),p=parseFloat(m.css("border-width")),g=Math.round(p)!==p;m.remove();let f=l.getElementWidth(h[0],!0,!0,!0);return f-=e.scrollbarWidth||0,g&&f++,c.remove(),f},k.prototype.setColumns=function(e,t){const l=this.p;e=e||[];let o=new d;for(let t=0,l=0;t<e.length;t++){let i=e[t],r=this._initColumnFromData(i);void 0!==i.order?(i.order>l&&(l=i.order+1),r.order=i.order):r.order=l++,o.push(r)}return o.normalizeOrder(),l.columns=o,l.visibleColumns=o.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(t),this},k.prototype.addColumn=function(e,t,l){const o=this.p;let i=o.columns;if(e&&!i.get(e.name)){let r=null;void 0!==t&&(r=i.get(t)||i.getByOrder(t));let n=this._initColumnFromData(e);n.order=r?r.order:i.getMaxOrder()+1;for(let e=i.getMaxOrder(),t=n.order;e>=t;e--){let t=i.getByOrder(e);t&&t.order++}i.push(n),i.normalizeOrder(),o.visibleColumns=i.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(l),this.trigger("addcolumn",n.name)}return this},k.prototype.removeColumn=function(e,t){const l=this.p;let o=l.columns,i=o.indexOf(e);return i>-1&&(o.splice(i,1),o.normalizeOrder(),l.visibleColumns=o.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(t),this.trigger("removecolumn",e)),this},k.prototype.setCellFormatter=function(e){return e||((e=e=>"string"==typeof e?r(e):e)[P]=!0),this.o.cellFormatter=e,this},k.prototype.setHeaderCellFormatter=function(e){return this.o.headerCellFormatter=e||function(e){return"string"==typeof e?r(e):e},this},k.prototype.setFilter=function(e){return this.o.filter=e,this},k.prototype.filter=function(e){const t=this.p;let l=this.o.filter||E;"string"==typeof arguments[0]&&"string"==typeof arguments[1]&&(e={column:arguments[0],keyword:arguments[1],caseSensitive:arguments[2]});let o=!!t.filteredRows;return t.filteredRows&&(t.filteredRows=null),t.filterArgs=null==e?null:"object"!=typeof e||Array.isArray(e)?e:R.extend({},e),null!==t.filterArgs?(t.filteredRows=t.rows.filteredCollection(l,t.filterArgs),(o||t.filteredRows)&&(this.clearAndRender(),this.trigger("filter",e))):(t.filterArgs=null,t.filteredRows=null,this.clearAndRender(),this.trigger("filterclear",{})),this},k.prototype.clearFilter=function(){const e=this.p;return e.filteredRows&&(e.filterArgs=null,e.filteredRows=null,this.clearAndRender(),this.trigger("filterclear",{})),this},k.prototype._refilter=function(){const e=this.p;if(e.filteredRows&&e.filterArgs){let t=this.o.filter||E;e.filteredRows=e.rows.filteredCollection(t,e.filterArgs)}return this},k.prototype.setColumnLabel=function(e,t){let l=this.p.columns.get(e);if(l&&(l.label=void 0===t?l.name:t,l.element))for(let e=0;e<l.element[0].firstChild.childNodes.length;e++){let t=l.element[0].firstChild.childNodes[e];if(3===t.nodeType){t.textContent=l.label;break}}return this},k.prototype.moveColumn=function(e,t){let l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=this.o,i=this.p;let r,n,s=i.columns,a=l?i.visibleColumns:s.getColumns();if("string"==typeof e?r=s.get(e):"number"==typeof e&&(r=a[e]),"string"==typeof t?n=s.get(t):"number"==typeof t&&(n=a[t]),r&&n&&e!==t){let e=r.order,t=n.order,l=s.moveColumn(r,n).getVisibleColumns();if(i.visibleColumns.length!==l.length||i.visibleColumns.some(((e,t)=>e!==l[t])))if(i.visibleColumns=l,this._ensureVisibleColumns(),o.virtualTable)this.clearAndRender();else{let l=i.$headerRow.find(">div."+o.tableClassName+"-header-cell"),r=e<t?t+1:t,n=e;l[0].parentNode.insertBefore(l[n],l[r]);let s=i.visibleColumns[e];s=(s.actualWidthConsideringScrollbarWidth||s.actualWidth)+"px";let a=i.visibleColumns[t];a=(a.actualWidthConsideringScrollbarWidth||a.actualWidth)+"px";let d=i.tbody.childNodes;for(let l=0,o=d.length;l<o;l++){let o=d[l];1===o.nodeType&&(o.insertBefore(o.childNodes[n],o.childNodes[r]),o.childNodes[t].firstChild.style.width=a,o.childNodes[e].firstChild.style.width=s)}}this.trigger("movecolumn",r.name,e,t)}return this},k.prototype.sort=function(e,t,l){const o=this.o,i=this.p;let r,n=i.columns.get(e),s=i.rows.sortColumn;if(n){if(l){for(let e=0;e<s.length;e++)if(s[e].column===n.name){e<s.length-1?s.length=0:(t=s[s.length-1].descending,s.splice(s.length-1,1));break}(o.sortableColumns>0&&s.length>=o.sortableColumns||s.length>=i.visibleColumns.length)&&(s.length=0)}else s.length=0;t=void 0!==t&&t,s.push({column:n.name,comparePath:n.comparePath||n.dataPath,descending:!!t})}else s.length=0;this._clearSortArrows();for(let e=0;e<s.length;e++)this._showSortArrow(s[e].column,s[e].descending);o.adjustColumnWidthForSortArrow&&!i.tableSkeletonNeedsRendering&&this.tableWidthChanged(!0),i.rows.sortColumn=s,s.length&&(r=i.rows.sort(!!i.filteredRows),i.filteredRows&&i.filteredRows.sort(!!i.filteredRows)),i.virtualListHelper&&i.virtualListHelper.invalidate().render();let a=[];for(let e=0;e<s.length;e++)a.push({column:s[e].column,descending:s[e].descending});return this.trigger("sort",a,!0,r),this},k.prototype.resort=function(){const e=this.p;let t=e.columns,l=e.rows.sortColumn;if(l.length){for(let e=0;e<l.length;e++)t.get(l[e].column)||l.splice(e--,1);let o;e.rows.sortColumn=l,l.length&&(o=e.rows.sort(!!e.filteredRows),e.filteredRows&&e.filteredRows.sort(!!e.filteredRows));let i=[];for(let e=0;e<l.length;e++)i.push({column:l[e].column,descending:l[e].descending});this.trigger("sort",i,!1,o)}return this},k.prototype._ensureVisibleColumns=function(){const e=this.p;return 0===e.visibleColumns.length&&e.columns.length&&(e.columns[0].visible=!0,e.visibleColumns.push(e.columns[0]),this.trigger("showcolumn",e.columns[0].name)),this},k.prototype.setColumnVisible=function(e,t){const l=this.p;let o=l.columns.get(e);return t=!!t,o&&!!o.visible!==t&&(o.visible=t,l.visibleColumns=l.columns.getVisibleColumns(),this.trigger(t?"showcolumn":"hidecolumn",e),this._ensureVisibleColumns(),this.clearAndRender()),this},k.prototype.isColumnVisible=function(e){let t=this.p.columns.get(e);return!!t&&t.visible},k.prototype.setMinColumnWidth=function(e){let t=this.o;return e=Math.max(e,0),t.minColumnWidth!==e&&(t.minColumnWidth=e,this.tableWidthChanged(!0)),this},k.prototype.getMinColumnWidth=function(){return this.o.minColumnWidth},k.prototype.setSortableColumns=function(e){const t=this.p,l=this.o;if(l.sortableColumns!==e&&(l.sortableColumns=e,t.$table)){let e=t.$headerRow.find(">div."+l.tableClassName+"-header-cell");for(let o=0;o<e.length;o++)R(e[0])[l.sortableColumns>0&&t.visibleColumns[o].sortable?"addClass":"removeClass"]("sortable")}return this},k.prototype.getSortableColumns=function(){return this.o.sortableColumns},k.prototype.setMovableColumns=function(e){let t=this.o;return e=void 0===e||!!e,t.movableColumns!==e&&(t.movableColumns=e),this},k.prototype.getMovableColumns=function(){return this.o.movableColumns},k.prototype.setResizableColumns=function(e){let t=this.o;return e=void 0===e||!!e,t.resizableColumns!==e&&(t.resizableColumns=e),this},k.prototype.getResizableColumns=function(){return this.o.resizableColumns},k.prototype.setOnComparatorRequired=function(e){let t=this.o;return t.onComparatorRequired!==e&&(t.onComparatorRequired=e),this},k.prototype.setComparatorCallback=k.prototype.setOnComparatorRequired,k.prototype.setCustomSortingProvider=function(e){let t=this.o;return t.customSortingProvider!==e&&(t.customSortingProvider=e),this},k.prototype.setColumnWidth=function(e,t){let l=this.p.columns.get(e),o=this._parseColumnWidth(t,l.ignoreMin?0:this.o.minColumnWidth);if(l){let e=this._serializeColumnWidth(l);l.width=o.width,l.widthMode=o.mode;let t=this._serializeColumnWidth(l);e!==t&&this.tableWidthChanged(!0),this.trigger("columnwidth",l.name,e,t)}return this},k.prototype.getColumnWidth=function(e){let t=this.p.columns.get(e);return t?this._serializeColumnWidth(t):null},k.prototype.getColumnConfig=function(e){let t=this.p.columns.get(e);return t?{order:t.order,width:this._serializeColumnWidth(t),visible:t.visible,label:t.label}:null},k.prototype.getColumnsConfig=function(){const e=this.p;let t={};for(let l=0;l<e.columns.length;l++)t[e.columns[l].name]=this.getColumnConfig(e.columns[l].name);return t},k.prototype.getSortedColumns=function(){const e=this.p;let t=[];for(let l=0;l<e.rows.sortColumn.length;l++){let o=e.rows.sortColumn[l];t.push({column:o.column,descending:o.descending})}return t},k.prototype.getHtmlForRowCell=function(e,t){const l=this.p;if(e<0||e>l.rows.length-1)return null;let o=l.columns.get(t);if(!o)return null;let i=l.rows[e];return this._getHtmlForCell(i,o)},k.prototype.getHtmlForRowDataCell=function(e,t){let l=this.p.columns.get(t);return l?this._getHtmlForCell(e,l):null},k.prototype._getHtmlForCell=function(e,t){let l=t.dataPath,o=e[l[0]];for(let e=1;e<l.length&&null!=o;e++)o=o&&o[l[e]];const i=this.o.cellFormatter;let r;if(i[P])r=i(o,t.name,e);else try{r=i(o,t.name,e)}catch(e){r="[ERROR]",console.error("Failed to generate content for cell "+t.name,e)}return null==r&&(r=""),r},k.prototype.getRowYPos=function(e){return this.p.virtualListHelper.getItemPosition(e)||null},k.prototype.getDataForRow=function(e){const t=this.p;return e<0||e>t.rows.length-1?null:t.rows[e]},k.prototype.getRowCount=function(){const e=this.p;return e.rows?e.rows.length:0},k.prototype.getIndexForRow=function(e){return this.p.rows.indexOf(e)},k.prototype.getFilteredRowCount=function(){const e=this.p;return(e.filteredRows||e.rows).length},k.prototype.getIndexForFilteredRow=function(e){const t=this.p;return(t.filteredRows||t.rows).indexOf(e)},k.prototype.getDataForFilteredRow=function(e){const t=this.p;return e<0||e>(t.filteredRows||t.rows).length-1?null:(t.filteredRows||t.rows)[e]},k.prototype.getHeaderRowElement=function(){return this.p.headerRow},k.prototype._horizontalPadding=function(e){return(parseFloat(R.css(e,"padding-left"))||0)+(parseFloat(R.css(e,"padding-right"))||0)},k.prototype._horizontalBorderWidth=function(e){return(parseFloat(R.css(e,"border-left"))||0)+(parseFloat(R.css(e,"border-right"))||0)},k.prototype._calculateWidthAvailableForColumns=function(){const e=this.o,t=this.p;let o,i,r;t.table&&(i=t.table?t.table.scrollTop:0,r=t.table?t.table.scrollLeft:0,e.virtualTable&&(o=t.table.style.display,t.table.style.display="none"));let n=l.getElementWidth(this.$el[0]);t.table&&(e.virtualTable&&(t.table.style.display=o),t.table.scrollTop=i,t.table.scrollLeft=r,t.header.scrollLeft=r);let s=e.tableClassName,a=R("<div>").addClass(this.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px"}),d=R("<div>").addClass(s+"-header").appendTo(a),h=R("<div>").addClass(s+"-header-row").appendTo(d);for(let e=0;e<t.visibleColumns.length;e++){const l=t.visibleColumns[e],o=R("<div><div></div></div>").addClass(s+"-header-cell").addClass(l.cellClasses||"");o[0].columnName=l.name,h.append(o)}a.appendTo(document.body),n-=this._horizontalBorderWidth(h[0]);let u=h.find(">div."+s+"-header-cell");for(let e=0;e<u.length;e++){let l=R(u[e]);if("border-box"!==l.css("boxSizing")){n-=(parseFloat(l.css("border-right-width"))||0)+(parseFloat(l.css("border-left-width"))||0)+this._horizontalPadding(l[0]);const e=l[0].columnName,o=t.columns.get(e);o&&(n-=o.arrowProposedWidth||0)}}return a&&a.remove(),Math.max(0,n)},k.prototype.tableWidthChanged=function(){let e=function(e){let t,o=this.o.tableClassName,i=R("<div>").addClass(this.$el).append(R("<div>").addClass(o+"-header").append(R("<div>").addClass(o+"-header-row").append(t=R("<div>").addClass(o+"-header-cell").append(R("<div>").text(e))))).css({position:"absolute",top:"-9999px",visibility:"hidden"});i.appendTo(document.body);let r=l.getElementWidth(t[0]);return i.remove(),r},t=null;return function(l,o){let i=this.o,r=this.p,n=this._calculateWidthAvailableForColumns(),s=n,a=0;if(!r.$table)return this;o=void 0===o||o;let d=0;if(r.tbody||(o=!1),o&&(d=parseFloat(r.tbody.style.minWidth)||0),s!==t||l){t=n;let l=0,h=[],u=0;for(let e=0;e<r.columns.length;e++)r.columns[e].actualWidthConsideringScrollbarWidth=null;for(let t=0;t<r.visibleColumns.length;t++){let o=r.visibleColumns[t];if(o.widthMode===O.ABSOLUTE){let e=o.width;e+=o.arrowProposedWidth||0,!o.ignoreMin&&e<i.minColumnWidth&&(e=i.minColumnWidth),s-=e,l+=e,e!==o.actualWidth&&(o.actualWidth=e,h.push(t))}else if(o.widthMode===O.AUTO){let r=e.call(this,o.label)+20;r+=o.arrowProposedWidth||0,!o.ignoreMin&&r<i.minColumnWidth&&(r=i.minColumnWidth),s-=r,l+=r,r!==o.actualWidth&&(o.actualWidth=r,i.convertColumnWidthsToRelative||h.push(t))}else o.widthMode===O.RELATIVE&&(u+=o.width,a++)}if(i.convertColumnWidthsToRelative)for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];t.widthMode===O.AUTO&&(t.widthMode=O.RELATIVE,s+=t.actualWidth,t.width=t.actualWidth/l,u+=t.width,a++)}if(a&&(u<1&&i.relativeWidthGrowsToFillWidth||u>1&&i.relativeWidthShrinksToFillWidth))for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];t.widthMode===O.RELATIVE&&(t.width/=u)}let c=Math.max(0,s);0===c&&(c=r.table.clientWidth);let m=i.minColumnWidth/c;if(isNaN(m)&&(m=0),m>0){let e,t=0;for(let e=0;e<r.visibleColumns.length;e++){let l=r.visibleColumns[e];l.widthMode===O.RELATIVE&&!l.ignoreMin&&l.width<m&&(t+=m-l.width,l.width=m)}for(let l=0;l<r.visibleColumns.length;l++){let o=r.visibleColumns[l];o.widthMode===O.RELATIVE&&!o.ignoreMin&&o.width>m&&t>0&&(e=Math.min(t,o.width-m),o.width-=e,t-=e)}}if(i.autoFillTableWidth&&s>0){let e=0,t=s;for(let l=0;l<r.visibleColumns.length;l++){let o=r.visibleColumns[l];o.resizable||o.widthMode!==O.ABSOLUTE||(e+=o.width),o.widthMode===O.RELATIVE&&(t-=Math.round(c*o.width))}let l=(n-e)/(n-t-e)||NaN;for(let e=0;e<r.visibleColumns.length&&t>0;e++){let t=r.visibleColumns[e];if(t.resizable||t.widthMode!==O.ABSOLUTE)if(t.widthMode===O.RELATIVE)t.width*=l;else{let o=t.actualWidth*l;t.actualWidth!==o&&(t.actualWidth=o,-1===h.indexOf(e)&&h.push(e))}}}for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];if(t.widthMode===O.RELATIVE){let l=Math.round(c*t.width);s-=l,a--,0===a&&1===s&&(l++,s--),-1===s&&(l--,s++),l!==t.actualWidth&&(t.actualWidth=l,h.push(e))}}if(r.visibleColumns.length&&(r.visibleColumns[r.visibleColumns.length-1].actualWidthConsideringScrollbarWidth=r.visibleColumns[r.visibleColumns.length-1].actualWidth-(r.scrollbarWidth||0)),r.notifyRendererOfColumnsConfig?.(),o){let e=this._calculateTbodyWidth();d<e&&this._updateTableWidth(!1);for(let e=0;e<h.length;e++)this._resizeColumnElements(h[e]);d>e&&this._updateTableWidth(!1)}}return this}}(),k.prototype.tableHeightChanged=function(){let e=this,t=e.o,o=e.p;if(!o.$table)return e;let i=l.getElementHeight(e.$el[0],!0)-(parseFloat(o.$table.css("border-top-width"))||0)-(parseFloat(o.$table.css("border-bottom-width"))||0);return i!==t.height&&(t.height=i,o.tbody&&(o.tbody.style.height=Math.max(t.height-l.getElementHeight(o.$headerRow[0],!0,!0,!0),1)+"px"),t.virtualTable&&e.clearAndRender()),e},k.prototype.addRows=function(e,t,l,o){let i=this.p;return"boolean"==typeof t&&(o=l,l=t,t=-1),"number"!=typeof t&&(t=-1),(t<0||t>i.rows.length)&&(t=i.rows.length),o=void 0===o||!!o,e&&(i.rows.add(e,t),i.filteredRows||l&&i.rows.sortColumn.length?(l&&i.rows.sortColumn.length?this.resort():this._refilter(),i.tableSkeletonNeedsRendering=!0,o&&this.render()):o&&(i.virtualListHelper.addItemsAt(e.length,t),this.o.virtualTable?this._updateVirtualHeight()._updateLastCellWidthFromScrollbar().render()._updateTableWidth(!1):i.tbody&&this.render()._updateLastCellWidthFromScrollbar()._updateTableWidth(!0)),this.trigger("addrows",e.length,!1)),this},k.prototype.removeRows=function(e,t,l){let o=this.p;return"number"!=typeof t||t<=0||e<0||e>o.rows.length-1||(o.rows.splice(e,t),l=void 0===l||!!l,o.filteredRows?(this._refilter(),o.tableSkeletonNeedsRendering=!0,l&&this.render()):l&&(o.virtualListHelper.removeItemsAt(t,e),this.o.virtualTable?this._updateVirtualHeight()._updateLastCellWidthFromScrollbar().render()._updateTableWidth(!1):this.render()._updateLastCellWidthFromScrollbar()._updateTableWidth(!0))),this},k.prototype.removeRow=function(e,t){return this.removeRows(e,1,t)},k.prototype.refreshRow=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=this.p;if(e<0||e>l.rows.length-1)return this;let o=-1;return l.filteredRows&&-1===(o=l.filteredRows.indexOf(l.rows[e]))||(-1===o&&(o=e),l.virtualListHelper.refreshItemAt(o),t&&l.virtualListHelper.render()),this},k.prototype.getRowElement=function(e){let t=this.p;if(e<0||e>t.rows.length-1)return null;let l=-1;return t.filteredRows&&-1===(l=t.filteredRows.indexOf(t.rows[e]))?this:(-1===l&&(l=e),t.virtualListHelper.getItemElementAt(l)||null)},k.prototype.refreshAllVirtualRows=function(){return this.p.virtualListHelper.invalidate().render(),this},k.prototype.setRows=function(e,t){let l=this.p;return l.rows.reset(e),t&&l.rows.sortColumn.length?this.resort():this._refilter(),this.clearAndRender().trigger("addrows",e.length,!0),this},k.prototype.getUrlForElementContent=function(e){let t,l=document.getElementById(e);if(l){let e=l.textContent;if("function"==typeof Blob)t=new Blob([e]);else{let l=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(!l)return null;let o=new l;o.append(e),t=o.getBlob()}return(window.URL||window.webkitURL).createObjectURL(t)}return null},k.prototype.isWorkerSupported=function(){return window.Worker instanceof Function},k.prototype.createWebWorker=function(e,t,l){if(this.isWorkerSupported()){let o=this,i=o.p,r=new Worker(e),n=function(e){e.data.append?o.addRows(e.data.rows,l):o.setRows(e.data.rows,l)};return r.addEventListener("message",n,!1),i.workerListeners||(i.workerListeners=[]),i.workerListeners.push({worker:r,listener:n}),(t||void 0===t)&&r.postMessage(null),r}return null},k.prototype.unbindWebWorker=function(e){let t=this.p;if(t.workerListeners)for(let l=0;l<t.workerListeners.length;l++)t.workerListeners[l].worker===e&&(e.removeEventListener("message",t.workerListeners[l].listener,!1),t.workerListeners.splice(l,1),l--);return this},k.prototype.abortCellPreview=function(){return this.hideCellPreview(),this},k.prototype.cancelColumnResize=function(){const e=this.p;return e.$resizer&&(e.$resizer.remove(),e.$resizer=null,R(document).off("mousemove.dgtable",e.onMouseMoveResizeAreaBound).off("mouseup.dgtable",e.onEndDragColumnHeaderBound)),this},k.prototype._onTableScrolledHorizontally=function(){const e=this.p;e.header.scrollLeft=e.table.scrollLeft},k.prototype._getColumnByResizePosition=function(e){let t=this.o,o=this._isTableRtl(),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),r=i[0];r.__cell&&(r=r.__cell,i=R(r));let n=i[0].previousSibling;for(;n&&1!==n.nodeType;)n=n.previousSibling;let s=!n,a=((null!=e.pageX?e.pageX:e.originalEvent.pageX)||e.originalEvent.clientX)-i.offset().left;if(o){if(!s&&l.getElementWidth(i[0],!0,!0,!0)-a<=t.resizeAreaWidth/2)return n.columnName;if(a<=t.resizeAreaWidth/2)return r.columnName}else{if(!s&&a<=t.resizeAreaWidth/2)return n.columnName;if(l.getElementWidth(i[0],!0,!0,!0)-a<=t.resizeAreaWidth/2)return r.columnName}return null},k.prototype._onTouchStartColumnHeader=function(e){const t=this.p;if(t.currentTouchId)return;let l=e.originalEvent.changedTouches[0];t.currentTouchId=l.identifier;let o,r=R(e.currentTarget),n={x:l.pageX,y:l.pageY},s=n,a=function(){t.currentTouchId=null,r.off("touchend").off("touchcancel"),clearTimeout(o)},d=function(t){let l=R.Event(t),o=Array.prototype.slice.call(arguments,1);for(let t of["target","clientX","clientY","offsetX","offsetY","screenX","screenY","pageX","pageY","which"]){l[t]=e[t];for(let e=0;e<o.length;e++)null!=o[e][t]&&(l[t]=o[e][t])}return l};r.trigger(d("mousedown",e.originalEvent.changedTouches[0],{which:1,target:e.target})),o=setTimeout((()=>{a(),r.one("touchend",(e=>{L(e)||e.preventDefault(),r.off("touchend").off("touchcancel")})).one("touchcancel",(e=>{r.off("touchend").off("touchcancel")})),Math.sqrt(Math.pow(Math.abs(s.x-n.x),2)+Math.pow(Math.abs(s.y-n.y),2))<9&&(this.cancelColumnResize(),r.trigger(d("mouseup",e.originalEvent.changedTouches[0],{which:3,target:e.target})))}),500),r.on("touchend",(e=>{let l=i(e.originalEvent.changedTouches,(e=>e.identifier===t.currentTouchId));l&&(a(),L(e)||e.preventDefault(),s={x:l.pageX,y:l.pageY},(Math.sqrt(Math.pow(Math.abs(s.x-n.x),2)+Math.pow(Math.abs(s.y-n.y),2))<9||t.$resizer)&&(r.trigger(d("mouseup",l,{which:1,target:e.target})),r.trigger(d("click",l,{which:1,target:e.target}))))})).on("touchcancel",(()=>{a()})).on("touchmove",(e=>{let l=i(e.originalEvent.changedTouches,(e=>e.identifier===t.currentTouchId));l&&(s={x:l.pageX,y:l.pageY},t.$resizer&&(e.preventDefault(),r.trigger(d("mousemove",l,{target:e.target}))))}))},k.prototype._onMouseDownColumnHeader=function(e){if(1!==e.which)return this;let t=this.o,o=this.p,i=this._getColumnByResizePosition(e);if(i){let r=o.columns.get(i);if(!t.resizableColumns||!r||!r.resizable)return!1;let n=this._isTableRtl();o.$resizer&&R(o.$resizer).remove(),o.$resizer=R("<div></div>").addClass(t.resizerClassName).css({position:"absolute",display:"block","z-index":-1,visibility:"hidden",width:"2px",background:"#000",opacity:.7}).appendTo(this.$el);let s=r.element,a=o.$resizer.parent(),d=s.offset(),h=a.offset();8===x&&(d=s.offset()),h.left+=parseFloat(a.css("border-left-width"))||0,h.top+=parseFloat(a.css("border-top-width"))||0,d.left-=h.left,d.top-=h.top,d.top-=parseFloat(s.css("border-top-width"))||0;let u=l.getElementWidth(o.$resizer[0],!0,!0,!0);n?(d.left-=Math.ceil((parseFloat(s.css("border-left-width"))||0)/2),d.left-=Math.ceil(u/2)):(d.left+=l.getElementWidth(s[0],!0,!0,!0),d.left+=Math.ceil((parseFloat(s.css("border-right-width"))||0)/2),d.left-=Math.ceil(u/2)),o.$resizer.css({"z-index":"10",visibility:"visible",left:d.left,top:d.top,height:l.getElementHeight(this.$el[0])})[0].columnName=s[0].columnName;try{o.$resizer[0].style.zIndex=""}catch(e){}R(document).on("mousemove.dgtable",o.onMouseMoveResizeAreaBound),R(document).on("mouseup.dgtable",o.onEndDragColumnHeaderBound),e.preventDefault()}},k.prototype._onMouseMoveColumnHeader=function(e){let t=this.o,l=this.p;if(t.resizableColumns){let o=this._getColumnByResizePosition(e),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName)[0];o&&l.columns.get(o).resizable?i.style.cursor="e-resize":i.style.cursor=""}},k.prototype._onMouseUpColumnHeader=function(e){if(3===e.which){let t=this.o,o=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),i=o.offset();i.width=l.getElementWidth(o[0],!0,!0,!0),i.height=l.getElementHeight(o[0],!0,!0,!0),this.trigger("headercontextmenu",o[0].columnName,e.pageX,e.pageY,i)}return this},k.prototype._onMouseLeaveColumnHeader=function(e){let t=this.o;R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName)[0].style.cursor=""},k.prototype._onClickColumnHeader=function(e){if(!L(e)&&!this._getColumnByResizePosition(e)){let t=this,l=t.o,o=t.p,i=R(e.target).closest("div."+l.tableClassName+"-header-cell,div."+l.cellPreviewClassName)[0];if(l.sortableColumns){let e=o.columns.get(i.columnName),t=o.rows.sortColumn;if(e&&e.sortable){let o=!0,i=t.length?t[t.length-1]:null;i&&i.column===e.name&&(i.descending&&l.allowCancelSort?(o=!1,t.splice(t.length-1,1)):i.descending=!i.descending),o?this.sort(e.name,void 0,!0).render():this.sort()}}}},k.prototype._onStartDragColumnHeader=function(e){let t=this.o,l=this.p;if(t.movableColumns){let o=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),i=l.columns.get(o[0].columnName);i&&i.movable?(o[0].style.opacity=.35,l.dragId=161061273*Math.random(),e.originalEvent.dataTransfer.setData("text",JSON.stringify({dragId:l.dragId,column:i.name}))):e.preventDefault()}else e.preventDefault()},k.prototype._onMouseMoveResizeArea=function(e){let t=this.p,o=t.columns.get(t.$resizer[0].columnName),i=this._isTableRtl(),r=o.element,n=t.$resizer.parent(),s=r.offset(),a=n.offset();a.left+=parseFloat(n.css("border-left-width"))||0,s.left-=a.left;let d=l.getElementWidth(t.$resizer[0],!0,!0,!0),h="border-box"===r.css("box-sizing"),u=e.pageX-a.left,c=s.left;c-=Math.ceil(d/2),i?(c+=l.getElementWidth(r[0],!0,!0,!0),c-=o.ignoreMin?0:this.o.minColumnWidth,h||(c-=Math.ceil((parseFloat(r.css("border-left-width"))||0)/2),c-=this._horizontalPadding(r[0])),u>c&&(u=c)):(c+=o.ignoreMin?0:this.o.minColumnWidth,h||(c+=Math.ceil((parseFloat(r.css("border-right-width"))||0)/2),c+=this._horizontalPadding(r[0])),u<c&&(u=c)),t.$resizer.css("left",u+"px")},k.prototype._onEndDragColumnHeader=function(e){let t=this.o,o=this.p;if(o.$resizer){R(document).off("mousemove.dgtable",o.onMouseMoveResizeAreaBound).off("mouseup.dgtable",o.onEndDragColumnHeaderBound);let i=o.columns.get(o.$resizer[0].columnName),r=this._isTableRtl(),n=i.element,s=n[0].firstChild,a=o.$resizer.parent(),d=n.offset(),h=a.offset();h.left+=parseFloat(a.css("border-left-width"))||0,d.left-=h.left;let u=l.getElementWidth(o.$resizer[0],!0,!0,!0),c="border-box"===n.css("box-sizing"),m=e.pageX-h.left,p=d.left,g=d.left,f=0;if(p-=Math.ceil(u/2),r){if(!c){m+=this._horizontalPadding(n[0]);const e=getComputedStyle(s||n[0]);m+=parseFloat(e.borderLeftWidth)||0,m+=parseFloat(e.borderRightWidth)||0,m+=i.arrowProposedWidth||0}p+=l.getElementWidth(n[0],!0,!0,!0),g=p-(i.ignoreMin?0:this.o.minColumnWidth),m>g&&(m=g),f=p-m}else{if(!c){m-=this._horizontalPadding(n[0]);const e=getComputedStyle(s||n[0]);m-=parseFloat(e.borderLeftWidth)||0,m-=parseFloat(e.borderRightWidth)||0,m-=i.arrowProposedWidth||0}g=p+(i.ignoreMin?0:this.o.minColumnWidth),m<g&&(m=g),f=m-p}o.$resizer.remove(),o.$resizer=null;let b=f;if(i.widthMode===O.RELATIVE){let e=this._calculateWidthAvailableForColumns(),l=0,r=0;for(let t=0;t<o.visibleColumns.length;t++){let n=o.visibleColumns[t];n.name!==i.name&&(n.widthMode===O.RELATIVE?(l+=n.width,r++):e-=n.actualWidth)}if(e=Math.max(1,e),1===e&&(e=o.table.clientWidth),b=f/e,r>0){let e=b/((1-b)/l);l+=b,(l<1&&t.relativeWidthGrowsToFillWidth||l>1&&t.relativeWidthShrinksToFillWidth)&&(b=e)}b*=100,b+="%"}this.setColumnWidth(i.name,b)}else e.target.style.opacity=null},k.prototype._onDragEnterColumnHeader=function(e){let t=this.o,l=this.p;if(t.movableColumns){let o=e.originalEvent.dataTransfer.getData("text");o=o?JSON.parse(o):null;let i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);if(!o||l.dragId===o.dragId&&i.columnName!==o.column){let e=l.columns.get(i[0].columnName);e&&(e.movable||e!==l.visibleColumns[0])&&R(i).addClass("drag-over")}}},k.prototype._onDragOverColumnHeader=function(e){e.preventDefault()},k.prototype._onDragLeaveColumnHeader=function(e){let t=this.o,l=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);R(l[0].firstChild).has(e.originalEvent.relatedTarget).length||l.removeClass("drag-over")},k.prototype._onDropColumnHeader=function(e){e.preventDefault();let t=this.o,l=this.p,o=JSON.parse(e.originalEvent.dataTransfer.getData("text")),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);if(t.movableColumns&&o.dragId===l.dragId){let e=o.column,t=i[0].columnName,r=l.columns.get(e),n=l.columns.get(t);r&&n&&r.movable&&(n.movable||n!==l.visibleColumns[0])&&this.moveColumn(e,t)}R(i).removeClass("drag-over")},k.prototype._clearSortArrows=function(){let e=this.p;if(e.$table){let t=this.o.tableClassName,l=e.$headerRow.find(">div."+t+"-header-cell.sorted"),o=l.find(">div>.sort-arrow");o.each(((t,l)=>{let o=e.columns.get(l.parentNode.parentNode.columnName);o&&(o.arrowProposedWidth=0)})),o.remove(),l.removeClass("sorted").removeClass("desc")}return this},k.prototype._showSortArrow=function(e,t){let l=this.p.columns.get(e);if(!l)return!1;let o=N("span");return o.className="sort-arrow",l.element&&(l.element.addClass(t?"sorted desc":"sorted"),l.element[0].firstChild.insertBefore(o,l.element[0].firstChild.firstChild)),l.widthMode!==O.RELATIVE&&this.o.adjustColumnWidthForSortArrow&&(l.arrowProposedWidth=o.scrollWidth+(parseFloat(R(o).css("margin-right"))||0)+(parseFloat(R(o).css("margin-left"))||0)),this},k.prototype._resizeColumnElements=function(e){let t=this.p,l=t.$headerRow.find("div."+this.o.tableClassName+"-header-cell"),o=t.columns.get(l[e].columnName);if(o){l[e].style.width=(o.actualWidthConsideringScrollbarWidth||o.actualWidth)+"px";let i=(o.actualWidthConsideringScrollbarWidth||o.actualWidth)+"px",r=t.tbody.childNodes;for(let t=0,l=r.length;t<l;t++){let l=r[t];1===l.nodeType&&(l.childNodes[e].style.width=i)}}return this},k.prototype._destroyHeaderCells=function(){let e=this.o,t=this.p;return t.$headerRow&&(this.trigger("headerrowdestroy",t.headerRow),t.$headerRow.find("div."+e.tableClassName+"-header-cell").remove(),t.$headerRow=null,t.headerRow=null),this},k.prototype._renderSkeletonBase=function(){let e=this,t=e.p,o=e.o;t.virtualListHelper?.destroy(),t.virtualListHelper=null,t.$table&&o.virtualTable&&(t.$table.remove(),t.$table=t.table=t.$tbody=t.tbody=null),e._destroyHeaderCells(),t.currentTouchId=null,t.$header&&t.$header.remove();let i=o.tableClassName,r=N("div"),n=R(r),s=N("div"),a=R(s);return r.className=i+"-header",s.className=i+"-header-row",t.$header=n,t.header=r,t.$headerRow=a,t.headerRow=s,a.appendTo(t.$header),n.prependTo(this.$el),M(e.$el),o.width===k.Width.SCROLL?this.el.style.overflow="hidden":this.el.style.overflow="",!o.height&&o.virtualTable&&(o.height=l.getElementHeight(this.$el[0],!0)),this},k.prototype._renderSkeletonHeaderCells=function(){let e,t=this,l=t.p,o=t.o,i=o.allowCellPreview,r=o.allowHeaderCellPreview,n=o.tableClassName+"-header-cell",s=l.headerRow;S&&(e=function(e){return e.preventDefault(),this.dragDrop(),!1});let a=function(e){e.preventDefault()};for(let d=0;d<l.visibleColumns.length;d++){let h=l.visibleColumns[d];if(h.visible){let u=N("div"),c=R(u);u.draggable=!0,u.className=n,u.style.width=h.actualWidth+"px",o.sortableColumns&&h.sortable&&(u.className+=" sortable"),u.columnName=h.name,u.setAttribute("data-column",h.name);let m=N("div");m.innerHTML=o.headerCellFormatter(h.label,h.name),u.appendChild(m),i&&r&&l._bindCellHoverIn(u),s.appendChild(u),l.visibleColumns[d].element=c,c.on("mousedown.dgtable",t._onMouseDownColumnHeader.bind(t)).on("mousemove.dgtable",t._onMouseMoveColumnHeader.bind(t)).on("mouseup.dgtable",t._onMouseUpColumnHeader.bind(t)).on("mouseleave.dgtable",t._onMouseLeaveColumnHeader.bind(t)).on("touchstart.dgtable",t._onTouchStartColumnHeader.bind(t)).on("dragstart.dgtable",t._onStartDragColumnHeader.bind(t)).on("click.dgtable",t._onClickColumnHeader.bind(t)).on("contextmenu.dgtable",a),R(m).on("dragenter.dgtable",t._onDragEnterColumnHeader.bind(t)).on("dragover.dgtable",t._onDragOverColumnHeader.bind(t)).on("dragleave.dgtable",t._onDragLeaveColumnHeader.bind(t)).on("drop.dgtable",t._onDropColumnHeader.bind(t)),S&&c.on("selectstart.dgtable",e.bind(u)),c.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"})}}return this.trigger("headerrowcreate",s),this},k.prototype._renderSkeletonBody=function(){let e=this,t=e.p,o=e.o,i=o.tableClassName;if(o.virtualTable&&!t.virtualRowHeight){let o,r=function(){let e=N("div"),t=e.appendChild(N("div")),l=t.appendChild(N("div"));return e.className=i+"-row",t.className=i+"-cell",l.innerHTML="0",e.style.visibility="hidden",e.style.position="absolute",e},n=R("<div>").addClass(e.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px",width:"1px",overflow:"hidden"}).append(R("<div>").addClass(i).append(o=R("<div>").addClass(i+"-body").css("width",99999)));n.appendTo(document.body);let s=r(),a=r(),d=r();o.append(s,a,d),t.virtualRowHeightFirst=l.getElementHeight(s,!0,!0,!0),t.virtualRowHeight=l.getElementHeight(a,!0,!0,!0),t.virtualRowHeightLast=l.getElementHeight(d,!0,!0,!0),n.remove()}if(!t.$table){let r=document.createDocumentFragment(),n=N("div"),s=R(n);n.className=i,o.virtualTable&&(n.className+=" virtual");let a=o.height-l.getElementHeight(t.$headerRow[0],!0,!0,!0);"border-box"!==s.css("box-sizing")&&(a-=parseFloat(s.css("border-top-width"))||0,a-=parseFloat(s.css("border-bottom-width"))||0,a-=parseFloat(s.css("padding-top"))||0,a-=parseFloat(s.css("padding-bottom"))||0),t.visibleHeight=a,n.style.height=o.height?a+"px":"auto",n.style.display="block",n.style.overflowY="auto",n.style.overflowX=o.width===k.Width.SCROLL?"auto":"hidden",r.appendChild(n);let d=N("div"),h=R(d);d.className=o.tableClassName+"-body",d.style.minHeight="1px",t.table=n,t.tbody=d,t.$table=s,t.$tbody=h,M(h),M(s),n.appendChild(d),e.el.appendChild(r),this._setupVirtualTable()}return this},k.prototype._renderSkeleton=function(){return this},k.prototype._updateVirtualHeight=function(){const e=this.o,t=this.p;if(!t.tbody)return this;if(e.virtualTable){const e=t.virtualListHelper.estimateFullHeight();t.lastVirtualScrollHeight=e,t.tbody.style.height=e+"px"}else t.tbody.style.height="";return this},k.prototype._updateLastCellWidthFromScrollbar=function(e){const t=this.p;let l=t.table.offsetWidth-t.table.clientWidth;if(l!==t.scrollbarWidth||e){t.scrollbarWidth=l;for(let e=0;e<t.columns.length;e++)t.columns[e].actualWidthConsideringScrollbarWidth=null;if(t.scrollbarWidth>0&&t.visibleColumns.length>0){let e=t.visibleColumns.length-1;t.visibleColumns[e].actualWidthConsideringScrollbarWidth=t.visibleColumns[e].actualWidth-t.scrollbarWidth;let l=t.visibleColumns[e].actualWidthConsideringScrollbarWidth+"px",o=t.tbody.childNodes;for(let t=0,i=o.length;t<i;t++){let i=o[t];1===i.nodeType&&(i.childNodes[e].style.width=l)}t.headerRow.childNodes[e].style.width=l}t.notifyRendererOfColumnsConfig?.()}return this},k.prototype._updateTableWidth=function(e){const t=this.o,o=this.p;let i=this._calculateTbodyWidth();if(o.tbody.style.minWidth=i+"px",o.headerRow.style.minWidth=i+(o.scrollbarWidth||0)+"px",o.$table.off("scroll",o.onTableScrolledHorizontallyBound),t.width===k.Width.AUTO)l.setElementWidth(o.$table[0],l.getElementWidth(o.tbody,!0,!0,!0)),l.setElementWidth(this.$el[0],l.getElementWidth(o.$table[0],!0,!0,!0));else if(t.width===k.Width.SCROLL){if(e){let e=o.table?o.table.scrollTop:0,t=o.table?o.table.scrollLeft:0;!function(e){let t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}(this.el),o.table.scrollTop=e,o.table.scrollLeft=t,o.header.scrollLeft=t}o.$table.on("scroll",o.onTableScrolledHorizontallyBound)}return this},k.prototype._isTableRtl=function(){return"rtl"===this.p.$table.css("direction")},k.prototype._serializeColumnWidth=function(e){return e.widthMode===O.AUTO?"auto":e.widthMode===O.RELATIVE?100*e.width+"%":e.width},k.prototype._cellMouseOverEvent=function(e){const t=this.o,o=this.p;let i=e.firstChild;if(i.scrollWidth-i.clientWidth>1||i.scrollHeight-i.clientHeight>1){this.hideCellPreview(),o.abortCellPreview=!1;let r=R(e),n=R(i);const s=e.parentNode;let a=N("div"),d=R(a);a.innerHTML=e.innerHTML,a.className=t.cellPreviewClassName;let u=r.hasClass(t.tableClassName+"-header-cell");u&&(a.className+=" header",r.hasClass("sortable")&&(a.className+=" sortable"),a.draggable=!0,R(a).on("mousedown",this._onMouseDownColumnHeader.bind(this)).on("mousemove",this._onMouseMoveColumnHeader.bind(this)).on("mouseup",this._onMouseUpColumnHeader.bind(this)).on("mouseleave",this._onMouseLeaveColumnHeader.bind(this)).on("touchstart",this._onTouchStartColumnHeader.bind(this)).on("dragstart",this._onStartDragColumnHeader.bind(this)).on("click",this._onClickColumnHeader.bind(this)).on("contextmenu.dgtable",(function(e){e.preventDefault()})),R(a.firstChild).on("dragenter",this._onDragEnterColumnHeader.bind(this)).on("dragover",this._onDragOverColumnHeader.bind(this)).on("dragleave",this._onDragLeaveColumnHeader.bind(this)).on("drop",this._onDropColumnHeader.bind(this)),S&&R(a).on("selectstart",function(e){return e.preventDefault(),this.dragDrop(),!1}.bind(a)));let c=parseFloat(r.css("padding-left"))||0,m=parseFloat(r.css("padding-right"))||0,p=parseFloat(r.css("padding-top"))||0,g=parseFloat(r.css("padding-bottom"))||0,f=i.scrollWidth+(e.clientWidth-i.offsetWidth),b="border-box"===r.css("box-sizing");if(b?d.css("box-sizing","border-box"):(f-=c+m,d.css("margin-top",parseFloat(R(e).css("border-top-width"))||0)),!o.transparentBgColor1){let e=document.createElement("div");e.style.backgroundColor="transparent",o.transparentBgColor1=R(e).css("background-color"),e.style.backgroundColor="rgba(0,0,0,0)",o.transparentBgColor2=R(e).css("background-color")}let v={"box-sizing":b?"border-box":"content-box",width:f,"min-height":l.getElementHeight(r[0]),"padding-left":c,"padding-right":m,"padding-top":p,"padding-bottom":g,overflow:"hidden",position:"absolute","z-index":"-1",left:"0",top:"0",cursor:r.css("cursor")};if(v){let t=R(e).css("background-color");t!==o.transparentBgColor1&&t!==o.transparentBgColor2||(t=R(s).css("background-color")),t!==o.transparentBgColor1&&t!==o.transparentBgColor2||(t="#fff"),v["background-color"]=t}d.css(v),this.el.appendChild(a),R(a.firstChild).css({direction:n.css("direction"),"white-space":n.css("white-space")}),u&&d.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"}),a.rowIndex=s.rowIndex;let C=a.physicalRowIndex=s.physicalRowIndex;a.columnName=o.visibleColumns[I.call(s.childNodes,e)].name;try{let t=h.saveSelection(e);t&&h.restoreSelection(a,t)}catch(e){}if(this.trigger("cellpreview",a.firstChild,null==C?null:C,a.columnName,null==C?null:o.rows[C],e),o.abortCellPreview)return void d.remove();null!=C&&a.addEventListener("click",(e=>{this.trigger("rowclick",e,s.rowIndex,C,s,o.rows[C])}));let w=this.$el,y=w[0]===window?R(document):w,_=r.offset(),W=w.offset(),E="right"===r.css("float"),H=E?"right":"left";if(E){let e=R(window).width();_.right=e-(_.left+l.getElementWidth(r[0],!0,!0,!0)),W.right=e-(W.left+l.getElementWidth(w[0],!0,!0,!0))}_.left-=parseFloat(w.css("border-left-width"))||0,_.right-=parseFloat(w.css("border-right-width"))||0,_.top-=parseFloat(w.css("border-top-width"))||0,_[H]+=parseFloat(R(e).css("border-"+H+"-width"))||0,_.top+=parseFloat(R(e).css("border-top-width"))||parseFloat(R(e).css("border-bottom-width"))||0,_.left-=W.left,_.right-=W.right,_.top-=W.top;let x=0,T=w-l.getElementWidth(d[0],!0,!0,!0);_[H]=_[H]<x?x:_[H]>T?T:_[H];let P=l.getElementHeight(r[0],!0,!0,!0),F=y.scrollTop()+l.getElementHeight(w[0],!0)-P;_.top>F&&(_.top=Math.max(0,F));let A={top:_.top,"z-index":9999};A[H]=_[H],d.css(A),a.__cell=e,o.$cellPreviewCell=d,e.__previewCell=a,o._bindCellHoverOut(e),o._bindCellHoverOut(a),d.on("wheel",(()=>{this.hideCellPreview()}))}},k.prototype._cellMouseOutEvent=function(e){this.hideCellPreview()},k.prototype.hideCellPreview=function(){const e=this.p;if(e.$cellPreviewCell){let t,l=e.$cellPreviewCell[0],o=l.__cell;try{t=h.saveSelection(l)}catch(e){}e.$cellPreviewCell.remove(),e._unbindCellHoverOut(o),e._unbindCellHoverOut(l);try{t&&h.restoreSelection(o,t)}catch(e){}this.trigger("cellpreviewdestroy",l.firstChild,l.physicalRowIndex,l.columnName,o),o.__previewCell=null,l.__cell=null,e.$cellPreviewCell=null,e.abortCellPreview=!1}else e.abortCellPreview=!0;return this};const O={AUTO:0,ABSOLUTE:1,RELATIVE:2};return k.Width={NONE:"none",AUTO:"auto",SCROLL:"scroll"},R.controls||(R.controls={}),R.controls.dgtable=k,k},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery"),require("@danielgindi/dom-utils/lib/ScrollHelper"),require("@danielgindi/dom-utils/lib/Css")):"function"==typeof define&&define.amd?define(["jquery","@danielgindi/dom-utils/lib/ScrollHelper","@danielgindi/dom-utils/lib/Css"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).DGTable=t(e.jQuery,e.domUtilsScrollHelper,e.domUtilsCss);
|
|
5
|
+
var e,t;e=this,t=function(e,t,l){"use strict";const o=Array.prototype.indexOf,i=function(e,t){for(let l=0,o=e.length;l>=0&&l<o;l+=1)if(t(e[l],l,e))return e[l]},r=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")};function n(){let e=[];return Object.assign(e,n.prototype),e.initialize.apply(e,arguments),e}n.prototype=[],n.prototype.initialize=function(e){e=e||{},this.sortColumn=null==e.sortColumn?[]:e.sortColumn},n.prototype.add=function(e,t){let l,o;if("splice"in e&&"length"in e)if("number"==typeof t)for(l=0,o=e.length;l<o;l++)this.splice(t++,0,e[l]);else for(l=0,o=e.length;l<o;l++)this.push(e[l]);else"number"==typeof t?this.splice(t,0,e):this.push(e)},n.prototype.reset=function(e){this.length=0,e&&this.add(e)},n.prototype.filteredCollection=function(e,t){if(e&&t){let l=new n({sortColumn:this.sortColumn,onComparatorRequired:this.onComparatorRequired,customSortingProvider:this.customSortingProvider});for(let o,i=0,r=this.length;i<r;i++)o=this[i],e(o,t)&&(o.__i=i,l.push(o));return l}return null},n.prototype.onComparatorRequired=null,n.prototype.customSortingProvider=null;let s=n.prototype.sort;function a(e,t){let l=e.column,o=e.comparePath||l;"string"==typeof o&&(o=o.split("."));let i,r=o.length,n=r>1,s=t?1:-1,a=t?-1:1;return function(e,t){let l=e[o[0]],d=t[o[0]];if(n)for(i=1;i<r;i++)l=l&&l[o[i]],d=d&&d[o[i]];return l===d?0:null==l?s:null==d?a:l<d?s:a}}function d(){let e=[];return Object.assign(e,d.prototype),e.initialize.apply(e,arguments),e}n.prototype.sort=function(){let e;if(this.sortColumn.length){let t=[];for(let l=0;l<this.sortColumn.length;l++){e=null;const o=a(this.sortColumn[l],this.sortColumn[l].descending);this.onComparatorRequired&&(e=this.onComparatorRequired(this.sortColumn[l].column,this.sortColumn[l].descending,o)),e||(e=o),t.push(e.bind(this))}if(1===t.length)e=t[0];else{let l,o=t.length;e=function(e,i){for(let r=0;r<o;r++)if(l=t[r](e,i),0!==l)return l;return l}}const l=t=>s.call(t,e);if(this.customSortingProvider){let e=this.customSortingProvider(this,l);e!==this&&this.splice(0,this.length,...e)}else l(this)}return e},d.prototype=[],d.prototype.initialize=function(){},d.prototype.get=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].name===e)return this[t];return null},d.prototype.indexOf=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].name===e)return t;return-1},d.prototype.getByOrder=function(e){for(let t=0,l=this.length;t<l;t++)if(this[t].order===e)return this[t];return null},d.prototype.normalizeOrder=function(){let e,t=[];for(e=0;e<this.length;e++)t.push(this[e]);for(t.sort((function(e,t){return e.order<t.order?-1:e.order>t.order?1:0})),e=0;e<t.length;e++)t[e].order=e;return this},d.prototype.getColumns=function(){let e=[];for(let t,l=0;l<this.length;l++)t=this[l],e.push(t);return e.sort(((e,t)=>e.order<t.order?-1:e.order>t.order?1:0)),e},d.prototype.getVisibleColumns=function(){let e=[];for(let t,l=0;l<this.length;l++)t=this[l],t.visible&&e.push(t);return e.sort(((e,t)=>e.order<t.order?-1:e.order>t.order?1:0)),e},d.prototype.getMaxOrder=function(){let e=0;for(let t,l=0;l<this.length;l++)t=this[l],t.order>e&&(e=t.order);return e},d.prototype.moveColumn=function(e,t){if(e&&t){let l,o,i=e.order,r=t.order;if(i<r)for(l=i+1;l<=r;l++)o=this.getByOrder(l),o.order--;else for(l=i-1;l>=r;l--)o=this.getByOrder(l),o.order++;e.order=r}return this};class h{static saveSelection(e){let t=window.getSelection().getRangeAt(0);if(e!==t.commonAncestorContainer&&!function(e,t){for(;(e=e.parentNode)&&e!==t;);return!!e}(t.commonAncestorContainer,e))return null;let l=t.cloneRange();l.selectNodeContents(e),l.setEnd(t.startContainer,t.startOffset);let o=l.toString().length;return{start:o,end:o+t.toString().length}}static restoreSelection(e,t){let l,o=0,i=[e],r=!1,n=!1,s=document.createRange();for(s.setStart(e,0),s.collapse(!0);!n&&(l=i.pop());)if(3===l.nodeType){let e=o+l.length;!r&&t.start>=o&&t.start<=e&&(s.setStart(l,t.start-o),r=!0),r&&t.end>=o&&t.end<=e&&(s.setEnd(l,t.end-o),n=!0),o=e}else{let e=l.childNodes.length;for(;e--;)i.push(l.childNodes[e])}let a=window.getSelection();a.removeAllRanges(),a.addRange(s)}}const u=Object.prototype.hasOwnProperty,c=void 0!==Element.prototype.insertAdjacentElement;function m(e,t,l){t?!1===c||e instanceof DocumentFragment?l.insertBefore(e,t):t.insertAdjacentElement("beforebegin",e):l.appendChild(e)}function p(e,t,l,o){return e.parentNode!==o?(t||(t=document.createDocumentFragment()),t.appendChild(e)):(t&&t.childNodes.length>0&&(m(t,l,o),t=null),e.nextSibling!==l&&m(e,l,o)),t}class g{constructor(e){const t=this._p={list:e.list||null,hookScrollEvent:void 0===e.hookScrollEvent||!!e.hookScrollEvent,count:e.count||0,virtual:void 0===e.virtual||!!e.virtual,userItemsParent:e.itemsParent||null,setVirtualWrapperWidth:e.autoVirtualWrapperWidth??!0,estimatedItemHeight:20,buffer:5,itemHeightEstimatorFn:null,itemElementCreatorFn:v,onItemRender:null,onItemUnrender:null,onScrollHeightChange:null,virtualWrapper:null,currentItemsParent:null,cachedItemHeights:[],cachedItemEstimatedHeights:[],cachedItemPositions:[],itemPositionsNeedsUpdate:0,boundRender:this.render.bind(this),existingEls:[]};t.currentItemsParent=t.userItemsParent||t.list,"boolean"==typeof e.hookScrollEvent?this.setHookScrollEvent(e.hookScrollEvent):this._hookEvents(),"number"==typeof e.count&&this.setCount(e.count),"boolean"==typeof e.virtual&&this.setVirtual(e.virtual),"number"==typeof e.estimatedItemHeight&&this.setEstimatedItemHeight(e.estimatedItemHeight),"number"==typeof e.buffer&&this.setBuffer(e.buffer),"function"==typeof e.itemHeightEstimatorFn&&this.setItemHeightEstimatorFn(e.itemHeightEstimatorFn),"function"==typeof e.itemElementCreatorFn&&this.setItemElementCreatorFn(e.itemElementCreatorFn),"function"==typeof e.onItemRender&&this.setOnItemRender(e.onItemRender),"function"==typeof e.onItemUnrender&&this.setOnItemUnrender(e.onItemUnrender),"function"==typeof e.onScrollHeightChange&&this.setOnScrollHeightChange(e.onScrollHeightChange)}destroy(){this._unhookEvents().invalidate()._destroyElements()}setHookScrollEvent(e){const t=this._p;return e=void 0===e||!!e,t.hookScrollEvent===e||(t.hookScrollEvent=e,this._unhookEvents()._hookEvents()),this}isHookScrollEventEnabled(){return this._p.hookScrollEvent}setCount(e){return this._p.count=e,this.invalidate()}getCount(){return this._p.count}setVirtual(e){const t=this._p;return e=void 0===e||!!e,t.virtual===e||(t.virtual=e,this._hookEvents().invalidate()._destroyElements()),this}isVirtual(){return this._p.virtual}setEstimatedItemHeight(e){return this._p.estimatedItemHeight=Math.abs(("number"==typeof e?e:Number(e))||20),this}getEstimatedItemHeight(){return this._p.estimatedItemHeight}setAutoVirtualWrapperWidth(e){const t=this._p;return t.autoVirtualWrapperWidth=void 0===e||!!e,t.virtualWrapper&&t.autoVirtualWrapperWidth!==t.virtualWrapperWidthWasSet&&(t.virtualWrapper.style.width=t.autoVirtualWrapperWidth?"100%":"",t.virtualWrapperWidthWasSet=t.autoVirtualWrapperWidth),this}isAutoVirtualWrapperWidth(){return this._p.autoVirtualWrapperWidth}setBuffer(e){return this._p.buffer=Math.abs("number"==typeof e?e:Number(e)||5),this}getBuffer(){return this._p.buffer}setItemHeightEstimatorFn(e){return this._p.itemHeightEstimatorFn=e,this}setItemElementCreatorFn(e){return this._p.itemElementCreatorFn=e||v,this}setOnItemRender(e){return this._p.onItemRender=e,this}setOnItemUnrender(e){return this._p.onItemUnrender=e,this}setOnScrollHeightChange(e){return this._p.onScrollHeightChange=e,this}estimateFullHeight(){const e=this._p;if(0===e.count)return 0;if(e.virtual)return this._calculateItemPosition(e.count)||0;{const t=e.existingEls;if(e.count===t.length){let e=t[0].getBoundingClientRect(),l=t[t.length-1].getBoundingClientRect();return l.top-e.top+l.height}return this._calculateItemPosition(e.count)||0}}invalidatePositions(){const e=this._p;return e.itemPositionsNeedsUpdate=0,e.cachedItemHeights=[],e.cachedItemEstimatedHeights=[],e.cachedItemPositions=[],e.cachedItemHeights.length=e.count,e.cachedItemEstimatedHeights.length=e.count,e.cachedItemPositions.length=e.count,this}invalidate(){const e=this._p;return this.invalidatePositions(),e.virtual||this._destroyElements(),this}render(){const e=this._p,t=e.list,l=e.virtual;let o=e.virtualWrapper,i=e.currentItemsParent,r=t.scrollTop,n=r+t.clientHeight,s=e.count,a=e.buffer,d=e.onItemUnrender,h=e.existingEls,c=h.length;if(l){const l=t.clientWidth;o||(o=e.virtualWrapper=e.userItemsParent,o||(o=e.virtualWrapper=document.createElement("div"),t.appendChild(o)),this._resetCurrentItemsParent(),i=e.currentItemsParent,e.autoVirtualWrapperWidth?(o.style.width="100%",e.virtualWrapperWidthWasSet=!0):e.virtualWrapperWidthWasSet=!1);for(let e=0;e<c;e++)h[e][b]=!0;this._calculateItemPosition(e.count-1);let d=this._getExistingElsRange(),g=C(e.cachedItemPositions,r),v=Math.max(0,g-a),w=v,_=this._calculateItemPosition(w),W=a,E=Math.max(w,C(e.cachedItemPositions,n-1)+1+a),I=[],R=null,H=o.childNodes[0];const x=function(e){let t;return-1!==d.firstIndex&&e>=d.firstIndex&&e<=d.lastIndex&&(t=h.find((t=>t[f]===e&&!0===t[b]))),void 0===t&&(t=(d.firstIndex<v||d.firstValidArrayIndex>0?h.find((e=>(e[f]<v||!1===u.call(e,f))&&!0===e[b])):void 0)||y(h,(e=>!0===e[b]))),void 0!==t&&delete t[b],t};for(;w<s&&w<E;w++){let e=x(w);H&&H===e&&(H=H.nextSibling);const t=this._dequeueElementForIndex(e,w,H,!0);I.push([t,w]),R=p(t,R,H,i)}R&&R.childNodes.length>0&&m(R,H,i);for(let t of I){const l=t[1];this._insertItemAndFlow(t[0],l,!1),_=e.cachedItemPositions[l]+e.cachedItemHeights[l]}if(_<n)for(;(_<n||W-- >0)&&w<s;w++){let t=x(w);H&&H===t&&(H=H.nextSibling),this._dequeueElementForIndex(t,w,H,!1),_=e.cachedItemPositions[w]+e.cachedItemHeights[w]}let N=this.estimateFullHeight(),S=N+"px";o.style.height!==S&&(e.virtualWrapper.style.height=S,e.onScrollHeightChange?.(N)),l!==t.clientWidth&&this.render()}else if(s!==h.length){for(let e=0;e<c;e++)h[e][b]=!0;let e=i.childNodes[0],t=null;for(let l=0;l<s;l++){let o=h.find((e=>e[f]===l&&!0===e[b]));void 0!==o&&delete o[b],e&&e===o&&(e=e.nextSibling),t=p(this._dequeueElementForIndex(o,l,e,!0),t,e,i)}t&&t.childNodes.length>0&&m(t,e,i)}c=h.length;for(let e=0;e<c;e++){const t=h[e];if(!0!==t[b])continue;let l=t.parentNode;l&&l.removeChild(t),d&&void 0!==t[f]&&d(t),h.splice(e,1),e--,c--}}addItemsAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if("number"!=typeof e||e<=0)return this;const l=this._p;if((t<0||t>=l.count)&&(t=l.count),l.count+=e,l.virtual)t>=0&&t<l.count&&this._invalidateItemIndexesAt(t,-1);else{let o=l.existingEls;if(o.length!==l.count-e)return this;let i=this._getExistingElsRange();if(-1===i.firstValidArrayIndex)return this;const r=l.currentItemsParent;let n=i.firstValidArrayIndex+t-i.firstIndex;this._pushItemIndexesAt(t,e);let s=o[n-1]?o[n-1].nextSibling:o[0],a=null;for(let l=t,o=t+e;l<o;l++)a=p(this._dequeueElementForIndex(void 0,l,s,!0),a,s,r);a&&a.childNodes.length>0&&m(a,s,r)}return this}removeItemsAt(e,t){const l=this._p;if("number"!=typeof e||"number"!=typeof t||e<=0||t<0||t>=l.count)return this;if(l.count-=Math.min(e,l.count-t),l.virtual)this._invalidateItemIndexesAt(t,-1);else{let o=l.existingEls;if(o.length!==l.count+e)return this;let i=this._getExistingElsRange();if(-1===i.firstValidArrayIndex)return this;this._pushItemIndexesAt(t+e,-e);const r=l.onItemUnrender;let n=i.firstValidArrayIndex+t-i.firstIndex;if(n<o.length){for(let t=0;t<e;t++){let e=o[n+t],l=e.parentNode;l&&l.removeChild(e),r&&void 0!==e[f]&&r(e)}o.splice(n,e)}}return this}refreshItemAt(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return this;if(t.virtual)this._invalidateItemIndexesAt(e,1);else{let l=t.existingEls;if(l.length!==t.count)return this;let o=this._getExistingElsRange();if(e>=o.firstIndex&&e<=o.lastIndex){let t=l[o.firstValidArrayIndex+e-o.firstIndex];delete t[f],this._dequeueElementForIndex(t,e,t.nextSibling,!1)}}return this}isItemRendered(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return!1;let l=this._getExistingElsRange();return e>=l.firstIndex&&e<=l.lastIndex}getItemElementAt(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return;let l=t.existingEls,o=this._getExistingElsRange();return e>=o.firstIndex&&e<=o.lastIndex?l[o.firstValidArrayIndex+e-o.firstIndex]:void 0}getItemPosition(e){const t=this._p;if(!("number"!=typeof e||e<0||e>=t.count)){if(t.virtual)return this._calculateItemPosition(e);{let o=this.getItemElementAt(e);if(void 0===o)return;const i=t.list;return l.getElementOffset(o).top-l.getElementOffset(i).top+i.scrollTop}}}getItemIndexFromElement(e){return e?e[f]:void 0}getItemSize(e){const t=this._p;if("number"!=typeof e||e<0||e>=t.count)return;let l=t.cachedItemHeights[e-1];return void 0===l&&(l=t.itemHeightEstimatorFn?t.itemHeightEstimatorFn(e-1):null,"number"!=typeof l&&(l=t.estimatedItemHeight),t.cachedItemEstimatedHeights[e-1]=l),l}getVisibleItemCount(){const e=this._p,t=e.list;let l,o,i=t.scrollTop,r=t.clientHeight;if(e.virtual)l=C(e.cachedItemPositions,i),o=C(e.cachedItemPositions,i+r,l);else{const t=e=>{let t=this.getItemPosition(e);return void 0===t&&(t=1/0),t};l=w(e.count,t,i),o=w(e.count,t,i+r,l)}return this.getItemPosition(o)===i+r&&o--,o-l+1}createGhostItemElement(e,t,l){const o=this._p;let i=this._dequeueElementForIndex(null,e,!1,!0);try{t&&o.currentItemsParent.appendChild(i),l(i)}finally{if(t){let e=i.parentNode;e&&e.removeChild(i)}o.onItemUnrender&&o.onItemUnrender(i)}}_resetCurrentItemsParent(){const e=this._p;e.currentItemsParent=e.virtualWrapper??e.userItemsParent??e.list}_destroyElements(){const e=this._p,t=e.onItemUnrender,l=e.existingEls;for(let e=0;e<l.length;e++){const o=l[e];let i=o.parentNode;i&&i.removeChild(o),t&&void 0!==o[f]&&t(o)}return l.length=0,e.virtualWrapper&&(e.virtualWrapper!==e.userItemsParent&&e.virtualWrapper.parentNode&&e.virtualWrapper.parentNode.removeChild(e.virtualWrapper),e.virtualWrapper=null,this._resetCurrentItemsParent()),this}_invalidateItemIndexesAt(e,t){const l=this._p;this._setItemPositionsNeedsUpdate(e);let o=l.existingEls,i=o.length,r=this._getExistingElsRange();if(-1!==r.firstValidArrayIndex&&(-1===t&&(t=o.length),e>=r.firstIndex&&e<=r.lastIndex))for(let l=r.firstValidArrayIndex+e-r.firstIndex,n=0;l<i&&n<t;l++,n++)delete o[l][f]}_pushItemIndexesAt(e,t){let l=this._p.existingEls,o=l.length,i=this._getExistingElsRange();if(-1!==i.firstValidArrayIndex&&e>=i.firstIndex&&e<=i.lastIndex)for(let r=i.firstValidArrayIndex+e-i.firstIndex;r<o;r++)l[r][f]+=t}_hookEvents(){const e=this._p;return this._unhookEvents(),e.virtual&&e.hookScrollEvent&&e.list&&e.list.addEventListener("scroll",e.boundRender),this}_unhookEvents(){const e=this._p;return e.list&&e.list.removeEventListener("scroll",e.boundRender),this}_setItemPositionsNeedsUpdate(e){const t=this._p;e<t.itemPositionsNeedsUpdate&&(t.itemPositionsNeedsUpdate=e)}_calculateItemPosition(e){const t=this._p,l=t.cachedItemPositions;if(e>=t.itemPositionsNeedsUpdate){const o=t.count,i=t.cachedItemHeights,r=t.cachedItemEstimatedHeights,n=t.estimatedItemHeight,s=t.itemHeightEstimatorFn;i.length!==o&&(i.length=o,r.length=o,l.length=o);let a=t.itemPositionsNeedsUpdate,d=Math.min(e,o),h=0;a>0&&(h=l[a-1]);for(let e=a;e<=d;e++){if(0===e){l[e]=h;continue}const t=e-1;let o=i[t];void 0===o&&(o=s?s(t):null,"number"!=typeof o&&(o=n),r[t]=o),h+=o,l[e]=h}t.itemPositionsNeedsUpdate=d+1}if(e>0&&e===t.count){let o=t.cachedItemHeights[e-1];return void 0===o&&(o=t.itemHeightEstimatorFn?t.itemHeightEstimatorFn(e-1):null,"number"!=typeof o&&(o=t.estimatedItemHeight),t.cachedItemEstimatedHeights[e-1]=o),l[e-1]+o}return l[e]}_dequeueElementForIndex(e,t,l,o){const i=this._p,r=i.virtualWrapper;i.currentItemsParent;const n=i.existingEls,s=i.onItemRender,a=i.onItemUnrender,d=!e,h=d||t!==e[f];if(e?a&&h&&a(e):(e=i.itemElementCreatorFn(),r&&!1!==l&&(e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.right="0")),h&&(e.innerHTML="",s&&s(e,t)),!1!==l){if(l instanceof Node||(l=null),!d){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}let i=l?n.indexOf(l):-1;-1===i?n.push(e):n.splice(i,0,e),o||this._insertItemAndFlow(e,t,l)}return e[f]=t,e}_insertItemAndFlow(e,t,l){const o=this._p,i=o.virtualWrapper,r=o.currentItemsParent;if(!1!==l&&(l instanceof Node||(l=null),e.parentNode===r&&e.nextSibling===l||m(e,l,r)),i){let l=e.getBoundingClientRect().height,i=o.cachedItemHeights[t];i!==l&&(o.cachedItemHeights[t]=l),(void 0!==i&&l!==i||void 0===i&&l!==o.cachedItemEstimatedHeights[t])&&this._setItemPositionsNeedsUpdate(t+1);let r=this._calculateItemPosition(t);const n=W();!1===n?e.style.top=`${r}px`:e.style[n]=`translateY(${r}px)`}}_getExistingElsRange(){const e=this._p.existingEls;let t=-1,l=-1;for(let l=0,o=e.length;l<o;l++)if(!1!==u.call(e[l],f)){t=l;break}for(let t=e.length-1;t>=0;t--)if(!1!==u.call(e[t],f)){l=t;break}return{firstValidArrayIndex:t,lastValidArrayIndex:l,firstIndex:-1!==t?e[t][f]:-1,lastIndex:-1!==l?e[l][f]:-1}}}const f=Symbol("index"),b=Symbol("reuse"),v=()=>document.createElement("li"),C=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=e.length;if(o<0&&(o+=i),o<=l)return o;for(;l<=o;){let r=Math.floor(l+(o-l)/2),n=e[r];if(n===t||n<=t&&r<i&&e[r+1]>t){for(;r>0&&e[r-1]===n;)r--;return r}n<t?l=r+1:o=r-1}return-1===o?0:i-1},w=function(e,t,l){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;if(i<0&&(i+=e),i<=o)return i;for(;o<=i;){let r=Math.floor(o+(i-o)/2),n=t(r);if(n===l||n<=l&&r<e&&t(r+1)>l){for(;r>0&&t(r-1)===n;)r--;return r}n<l?o=r+1:i=r-1}return-1===i?0:t(e-1)},y=(e,t)=>{for(let l=e.length-1;l>=0;l--)if(t(e[l]))return e[l]};let _=null;const W=()=>{if(null===_){let e=["transform","WebkitTransform","MozTransform","OTransform","msTransform"],t=document.createElement("div");_=!1;for(let l of e)if(t&&void 0!==t.style[l]){_=l;break}}return _};function E(e,t){let l=t.column,o=null==t.keyword?"":t.keyword.toString();if(!o||!l)return!0;let i=e[l];return null!=i&&(i=i.toString(),t.caseSensitive||(i=i.toLowerCase(),o=o.toLowerCase()),-1!==i.indexOf(o))}const I=Array.prototype.indexOf,R=e;let H=navigator.userAgent,x=-1!==H.indexOf("MSIE ")?parseFloat(H.substr(H.indexOf("MSIE ")+5)):null,N=x&&x<10,S=document.createElement.bind(document);const T=Object.prototype.hasOwnProperty,P=Symbol("safe"),F=Symbol("hover_in"),A=Symbol("hover_out"),z=Symbol("row_click");function M(e){var t,l;t=["relative","absolute","fixed"],l=e.css("position"),o.call(t,l)>=0||e.css("position","relative")}const L=e=>/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e.target.tagName);let k=function e(){if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[e].concat(Array.prototype.slice.call(arguments,0))));this.initialize.apply(this,arguments)};k.VERSION="@@VERSION",k.prototype.VERSION=k.VERSION,k.prototype.initialize=function(e){let t=this;e=e||{};let l=t.o={},o=t.p={};o.events={},t.el=e.el&&e.el instanceof Element?e.el:document.createElement("div");let i=t.$el=R(t.el);t.el!==e.el&&i.addClass(e.className||"dgtable-wrapper"),i.data("control",t).data("dgtable",t),i.on("remove",(()=>t.destroy())),o.onMouseMoveResizeAreaBound=this._onMouseMoveResizeArea.bind(this),o.onEndDragColumnHeaderBound=this._onEndDragColumnHeader.bind(this),o.onTableScrolledHorizontallyBound=this._onTableScrolledHorizontally.bind(this),this.$el.on("dragend",o.onEndDragColumnHeaderBound),o.tableSkeletonNeedsRendering=!0,l.virtualTable=void 0===e.virtualTable||!!e.virtualTable,l.estimatedRowHeight=e.estimatedRowHeight||void 0,l.rowsBufferSize=e.rowsBufferSize||3,l.minColumnWidth=Math.max(e.minColumnWidth||35,0),l.resizeAreaWidth=e.resizeAreaWidth||8,l.resizableColumns=void 0===e.resizableColumns||!!e.resizableColumns,l.movableColumns=void 0===e.movableColumns||!!e.movableColumns,l.sortableColumns=void 0===e.sortableColumns?1:parseInt(e.sortableColumns,10)||1,l.adjustColumnWidthForSortArrow=void 0===e.adjustColumnWidthForSortArrow||!!e.adjustColumnWidthForSortArrow,l.convertColumnWidthsToRelative=void 0!==e.convertColumnWidthsToRelative&&!!e.convertColumnWidthsToRelative,l.autoFillTableWidth=void 0!==e.autoFillTableWidth&&!!e.autoFillTableWidth,l.allowCancelSort=void 0===e.allowCancelSort||!!e.allowCancelSort,l.cellClasses=void 0===e.cellClasses?"":e.cellClasses,l.resizerClassName=void 0===e.resizerClassName?"dgtable-resize":e.resizerClassName,l.tableClassName=void 0===e.tableClassName?"dgtable":e.tableClassName,l.allowCellPreview=void 0===e.allowCellPreview||e.allowCellPreview,l.allowHeaderCellPreview=void 0===e.allowHeaderCellPreview||e.allowHeaderCellPreview,l.cellPreviewClassName=void 0===e.cellPreviewClassName?"dgtable-cell-preview":e.cellPreviewClassName,l.cellPreviewAutoBackground=void 0===e.cellPreviewAutoBackground||e.cellPreviewAutoBackground,l.onComparatorRequired=void 0===e.onComparatorRequired?null:e.onComparatorRequired,l.onComparatorRequired||"function"!=typeof e.comparatorCallback||(l.onComparatorRequired=e.comparatorCallback),l.customSortingProvider=void 0===e.customSortingProvider?null:e.customSortingProvider,l.width=void 0===e.width?k.Width.NONE:e.width,l.relativeWidthGrowsToFillWidth=void 0===e.relativeWidthGrowsToFillWidth||!!e.relativeWidthGrowsToFillWidth,l.relativeWidthShrinksToFillWidth=void 0!==e.relativeWidthShrinksToFillWidth&&!!e.relativeWidthShrinksToFillWidth,this.setCellFormatter(e.cellFormatter),this.setHeaderCellFormatter(e.headerCellFormatter),this.setFilter(e.filter),l.height=e.height,t.setColumns(e.columns||[],!1);let r=[];if(e.sortColumn){let t=e.sortColumn;if(t&&!Array.isArray(t)&&(t=[t]),t)for(let e=0,l=t.length;e<l;e++){let l=t[e];"string"==typeof l&&(l={column:l,descending:!1});let i=o.columns.get(l.column);i&&r.push({column:l.column,comparePath:i.comparePath||i.dataPath,descending:l.descending})}}o.rows=new n({sortColumn:r}),o.rows.onComparatorRequired=(e,t,o)=>{if(l.onComparatorRequired)return l.onComparatorRequired(e,t,o)},o.rows.customSortingProvider=(e,t)=>l.customSortingProvider?l.customSortingProvider(e,t):t(e),o.filteredRows=null,o.scrollbarWidth=0,o.lastVirtualScrollHeight=0,this._setupHovers()},k.prototype._setupHovers=function(){const e=this,t=e.p;let l=function(t){let l=t.fromElement||t.relatedTarget;l===this||R.contains(this,l)||this.__previewCell&&(l===this.__previewCell||R.contains(this.__previewCell,l))||e._cellMouseOverEvent.call(e,this)},o=function(t){let l=(t=t||event).toElement||t.relatedTarget;l===this||R.contains(this,l)||this.__previewCell&&(l===this.__previewCell||R.contains(this.__previewCell,l))||e._cellMouseOutEvent.call(e,this)};t._bindCellHoverIn=function(e){e[F]||e.addEventListener("mouseover",e[F]=l.bind(e))},t._unbindCellHoverIn=function(e){e[F]&&(e.removeEventListener("mouseover",e[F]),e[F]=null)},t._bindCellHoverOut=function(e){return e[A]||e.addEventListener("mouseout",e[A]=o.bind(e.__cell||e)),this},t._unbindCellHoverOut=function(e){return e[A]&&(e.removeEventListener("mouseout",e[A]),e[A]=null),this}},k.prototype._setupVirtualTable=function(){const e=this,t=e.p,l=e.o,o=l.tableClassName,i=o+"-row",r=o+"-row-alt",n=o+"-cell";let s=t.visibleColumns,a=s.length;t.notifyRendererOfColumnsConfig=()=>{s=t.visibleColumns,a=s.length;for(let e,t=0;t<a;t++)e=s[t],e._finalWidth=e.actualWidthConsideringScrollbarWidth||e.actualWidth},t.virtualListHelper=new g({list:t.table,itemsParent:t.tbody,autoVirtualWrapperWidth:!1,virtual:l.virtualTable,buffer:l.rowsBufferSize,estimatedItemHeight:l.estimatedRowHeight?l.estimatedRowHeight:t.virtualRowHeight||40,itemElementCreatorFn:()=>S("div"),onItemRender:(o,d)=>{const h=t.filteredRows||t.rows,u=!!t.filteredRows,c=l.allowCellPreview;o.className=i,d%2==1&&(o.className+=" "+r);let m=h[d],p=u?m.__i:d;o.rowIndex=d,o.physicalRowIndex=p;for(let e=0;e<a;e++){let l=s[e],i=S("div");i.columnName=l.name,i.setAttribute("data-column",l.name),i.className=n,i.style.width=l._finalWidth+"px",l.cellClasses&&(i.className+=" "+l.cellClasses),c&&t._bindCellHoverIn(i),i.appendChild(S("div")).innerHTML=this._getHtmlForCell(m,l),o.appendChild(i)}o.addEventListener("click",o[z]=t=>{e.trigger("rowclick",t,d,p,o,m)}),e.trigger("rowcreate",d,p,o,m)},onItemUnrender:t=>{t[z]&&t.removeEventListener("click",t[z]),e._unbindCellEventsForRow(t),e.trigger("rowdestroy",t)},onScrollHeightChange:e=>{e>t._lastVirtualScrollHeight&&!t.scrollbarWidth&&this._updateLastCellWidthFromScrollbar(),t._lastVirtualScrollHeight=e}}),t.virtualListHelper.setCount((t.filteredRows??t.rows).length),t.notifyRendererOfColumnsConfig()},k.prototype.on=function(e,t){let l=this.p.events;return"function"!=typeof t||(T.call(l,e)||(l[e]=[]),l[e].push({cb:t,once:!1})),this},k.prototype.once=function(e,t){let l=this.p.events;return"function"!=typeof t||(T.call(l,e)||(l[e]=[]),l[e].push({cb:t,once:!0})),this},k.prototype.off=function(e,t){let l=this.p.events;if(!T.call(l,e))return this;let o=l[e];for(let e=0;e<o.length;e++){let l=o[e];t&&l.cb!==t||o.splice(e--,1)}return this},k.prototype.trigger=function(e){const t=this.p;if(!t)return;let l=t.events;if(T.call(l,e)){let t=l[e];for(let e=0;e<t.length;e++){let l=t[e];l.once&&t.splice(e--,1),l.cb.apply(this,Array.prototype.slice.call(arguments,1))}}return this},k.prototype._parseColumnWidth=function(e,t){let l=Math.max(0,parseFloat(e)),o=O.AUTO;return l>0&&(e===l+"%"?(o=O.RELATIVE,l/=100):l>0&&l<1?o=O.RELATIVE:(l<t&&(l=t),o=O.ABSOLUTE)),{width:l,mode:o}},k.prototype._initColumnFromData=function(e){let t=this._parseColumnWidth(e.width,e.ignoreMin?0:this.o.minColumnWidth),l={name:e.name,label:void 0===e.label?e.name:e.label,width:t.width,widthMode:t.mode,resizable:void 0===e.resizable||e.resizable,sortable:void 0===e.sortable||e.sortable,movable:void 0===e.movable||e.movable,visible:void 0===e.visible||e.visible,cellClasses:void 0===e.cellClasses?this.o.cellClasses:e.cellClasses,ignoreMin:void 0!==e.ignoreMin&&!!e.ignoreMin};return l.dataPath=void 0===e.dataPath?l.name:e.dataPath,l.comparePath=void 0===e.comparePath?l.dataPath:e.comparePath,"string"==typeof l.dataPath&&(l.dataPath=l.dataPath.split(".")),"string"==typeof l.comparePath&&(l.comparePath=l.comparePath.split(".")),l},k.prototype.close=k.prototype.remove=k.prototype.destroy=function(){let e=this,t=e.p||{},l=e.$el;if(e.__removed)return e;if(t.$resizer&&(t.$resizer.remove(),t.$resizer=null),t.virtualListHelper?.destroy(),t.virtualListHelper=null,this._destroyHeaderCells(),t.$table&&t.$table.empty(),t.$tbody&&t.$tbody.empty(),t.workerListeners){for(let e=0;e<t.workerListeners.length;e++){let l=t.workerListeners[e];l.worker.removeEventListener("message",l.listener,!1)}t.workerListeners.length=0}t.rows.length=t.columns.length=0,t._deferredRender&&clearTimeout(t._deferredRender);for(let t in e)T.call(e,t)&&(e[t]=null);return e.__removed=!0,l&&l.remove(),this},k.prototype._unbindCellEventsForTable=function(){const e=this.p;if(e.headerRow)for(let t=0,l=e.headerRow.childNodes,o=l.length;t<o;t++)for(let o=0,i=l[t].childNodes,r=i.length;o<r;o++)e._unbindCellHoverIn(i[o]);return this},k.prototype._unbindCellEventsForRow=function(e){const t=this.p;for(let l=0,o=e.childNodes,i=o.length;l<i;l++)t._unbindCellHoverIn(o[l]);return this},k.prototype.render=function(){const e=this.o,l=this.p;if(!this.el.offsetParent)return l._deferredRender||(l._deferredRender=setTimeout((()=>{l._deferredRender=null,!this.__removed&&this.el.offsetParent&&this.render()}))),this;if(!0===l.tableSkeletonNeedsRendering){l.tableSkeletonNeedsRendering=!1,e.width===k.Width.AUTO&&this._clearSortArrows();let o=l.table&&l.table.parentNode?l.table.scrollTop:NaN,i=l.table&&l.table.parentNode?t.getScrollHorz(l.table):NaN;this._renderSkeletonBase()._renderSkeletonBody().tableWidthChanged(!0,!1)._renderSkeletonHeaderCells(),l.virtualListHelper.setCount((l.filteredRows??l.rows).length),this._updateVirtualHeight(),this._updateLastCellWidthFromScrollbar(!0),this._updateTableWidth(!0);for(let e=0;e<l.rows.sortColumn.length;e++)this._showSortArrow(l.rows.sortColumn[e].column,l.rows.sortColumn[e].descending);e.adjustColumnWidthForSortArrow&&l.rows.sortColumn.length?this.tableWidthChanged(!0):e.virtualTable||this.tableWidthChanged(),isNaN(o)||(l.table.scrollTop=o),isNaN(i)||(t.setScrollHorz(l.table,i),t.setScrollHorz(l.header,i)),this.trigger("renderskeleton")}return l.virtualListHelper.render(),this.trigger("render"),this},k.prototype.clearAndRender=function(e){let t=this.p;return t.tableSkeletonNeedsRendering=!0,t.notifyRendererOfColumnsConfig?.(),(void 0===e||e)&&this.render(),this},k.prototype._calculateTbodyWidth=function(){const e=this.p;let t,o,i,r=this.o.tableClassName,n=r+"-row",s=r+"-cell",a=e.visibleColumns,d=a.length,h=R("<div>").addClass(n).css("float","left"),u=0;for(o=0;o<d;o++)i=a[o],t=S("div"),t.className=s,t.style.width=i.actualWidth+"px",i.cellClasses&&(t.className+=" "+i.cellClasses),t.appendChild(S("div")),h.append(t),u+=i.actualWidth;let c=R("<div>").addClass(this.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px",float:"left",width:"1px",overflow:"hidden"}).append(R("<div>").addClass(r).append(R("<div>").addClass(r+"-body").css("width",u+1e4).append(h)));c.appendTo(document.body);let m=R('<div style="border:1.5px solid #000;width:0;height:0;position:absolute;left:0;top:-9999px">').appendTo(document.body),p=parseFloat(m.css("border-width")),g=Math.round(p)!==p;m.remove();let f=l.getElementWidth(h[0],!0,!0,!0);return f-=e.scrollbarWidth||0,g&&f++,c.remove(),f},k.prototype.setColumns=function(e,t){const l=this.p;e=e||[];let o=new d;for(let t=0,l=0;t<e.length;t++){let i=e[t],r=this._initColumnFromData(i);void 0!==i.order?(i.order>l&&(l=i.order+1),r.order=i.order):r.order=l++,o.push(r)}return o.normalizeOrder(),l.columns=o,l.visibleColumns=o.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(t),this},k.prototype.addColumn=function(e,t,l){const o=this.p;let i=o.columns;if(e&&!i.get(e.name)){let r=null;void 0!==t&&(r=i.get(t)||i.getByOrder(t));let n=this._initColumnFromData(e);n.order=r?r.order:i.getMaxOrder()+1;for(let e=i.getMaxOrder(),t=n.order;e>=t;e--){let t=i.getByOrder(e);t&&t.order++}i.push(n),i.normalizeOrder(),o.visibleColumns=i.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(l),this.trigger("addcolumn",n.name)}return this},k.prototype.removeColumn=function(e,t){const l=this.p;let o=l.columns,i=o.indexOf(e);return i>-1&&(o.splice(i,1),o.normalizeOrder(),l.visibleColumns=o.getVisibleColumns(),this._ensureVisibleColumns().clearAndRender(t),this.trigger("removecolumn",e)),this},k.prototype.setCellFormatter=function(e){return e||((e=e=>"string"==typeof e?r(e):e)[P]=!0),this.o.cellFormatter=e,this},k.prototype.setHeaderCellFormatter=function(e){return this.o.headerCellFormatter=e||function(e){return"string"==typeof e?r(e):e},this},k.prototype.setFilter=function(e){return this.o.filter=e,this},k.prototype.filter=function(e){const t=this.p;let l=this.o.filter||E;"string"==typeof arguments[0]&&"string"==typeof arguments[1]&&(e={column:arguments[0],keyword:arguments[1],caseSensitive:arguments[2]});let o=!!t.filteredRows;return t.filteredRows&&(t.filteredRows=null),t.filterArgs=null==e?null:"object"!=typeof e||Array.isArray(e)?e:R.extend({},e),null!==t.filterArgs?(t.filteredRows=t.rows.filteredCollection(l,t.filterArgs),(o||t.filteredRows)&&(this.clearAndRender(),this.trigger("filter",e))):(t.filterArgs=null,t.filteredRows=null,this.clearAndRender(),this.trigger("filterclear",{})),this},k.prototype.clearFilter=function(){const e=this.p;return e.filteredRows&&(e.filterArgs=null,e.filteredRows=null,this.clearAndRender(),this.trigger("filterclear",{})),this},k.prototype._refilter=function(){const e=this.p;if(e.filteredRows&&e.filterArgs){let t=this.o.filter||E;e.filteredRows=e.rows.filteredCollection(t,e.filterArgs)}return this},k.prototype.setColumnLabel=function(e,t){let l=this.p.columns.get(e);if(l&&(l.label=void 0===t?l.name:t,l.element))for(let e=0;e<l.element[0].firstChild.childNodes.length;e++){let t=l.element[0].firstChild.childNodes[e];if(3===t.nodeType){t.textContent=l.label;break}}return this},k.prototype.moveColumn=function(e,t){let l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=this.o,i=this.p;let r,n,s=i.columns,a=l?i.visibleColumns:s.getColumns();if("string"==typeof e?r=s.get(e):"number"==typeof e&&(r=a[e]),"string"==typeof t?n=s.get(t):"number"==typeof t&&(n=a[t]),r&&n&&e!==t){let e=r.order,t=n.order,l=s.moveColumn(r,n).getVisibleColumns();if(i.visibleColumns.length!==l.length||i.visibleColumns.some(((e,t)=>e!==l[t])))if(i.visibleColumns=l,this._ensureVisibleColumns(),o.virtualTable)this.clearAndRender();else{let l=i.$headerRow.find(">div."+o.tableClassName+"-header-cell"),r=e<t?t+1:t,n=e;l[0].parentNode.insertBefore(l[n],l[r]);let s=i.visibleColumns[e];s=(s.actualWidthConsideringScrollbarWidth||s.actualWidth)+"px";let a=i.visibleColumns[t];a=(a.actualWidthConsideringScrollbarWidth||a.actualWidth)+"px";let d=i.tbody.childNodes;for(let l=0,o=d.length;l<o;l++){let o=d[l];1===o.nodeType&&(o.insertBefore(o.childNodes[n],o.childNodes[r]),o.childNodes[t].firstChild.style.width=a,o.childNodes[e].firstChild.style.width=s)}}this.trigger("movecolumn",r.name,e,t)}return this},k.prototype.sort=function(e,t,l){const o=this.o,i=this.p;let r,n=i.columns.get(e),s=i.rows.sortColumn;if(n){if(l){for(let e=0;e<s.length;e++)if(s[e].column===n.name){e<s.length-1?s.length=0:(t=s[s.length-1].descending,s.splice(s.length-1,1));break}(o.sortableColumns>0&&s.length>=o.sortableColumns||s.length>=i.visibleColumns.length)&&(s.length=0)}else s.length=0;t=void 0!==t&&t,s.push({column:n.name,comparePath:n.comparePath||n.dataPath,descending:!!t})}else s.length=0;this._clearSortArrows();for(let e=0;e<s.length;e++)this._showSortArrow(s[e].column,s[e].descending);o.adjustColumnWidthForSortArrow&&!i.tableSkeletonNeedsRendering&&this.tableWidthChanged(!0),i.rows.sortColumn=s,s.length&&(r=i.rows.sort(!!i.filteredRows),i.filteredRows&&i.filteredRows.sort(!!i.filteredRows)),i.virtualListHelper&&i.virtualListHelper.invalidate().render();let a=[];for(let e=0;e<s.length;e++)a.push({column:s[e].column,descending:s[e].descending});return this.trigger("sort",a,!0,r),this},k.prototype.resort=function(){const e=this.p;let t=e.columns,l=e.rows.sortColumn;if(l.length){for(let e=0;e<l.length;e++)t.get(l[e].column)||l.splice(e--,1);let o;e.rows.sortColumn=l,l.length&&(o=e.rows.sort(!!e.filteredRows),e.filteredRows&&e.filteredRows.sort(!!e.filteredRows));let i=[];for(let e=0;e<l.length;e++)i.push({column:l[e].column,descending:l[e].descending});this.trigger("sort",i,!1,o)}return this},k.prototype._ensureVisibleColumns=function(){const e=this.p;return 0===e.visibleColumns.length&&e.columns.length&&(e.columns[0].visible=!0,e.visibleColumns.push(e.columns[0]),this.trigger("showcolumn",e.columns[0].name)),this},k.prototype.setColumnVisible=function(e,t){const l=this.p;let o=l.columns.get(e);return t=!!t,o&&!!o.visible!==t&&(o.visible=t,l.visibleColumns=l.columns.getVisibleColumns(),this.trigger(t?"showcolumn":"hidecolumn",e),this._ensureVisibleColumns(),this.clearAndRender()),this},k.prototype.isColumnVisible=function(e){let t=this.p.columns.get(e);return!!t&&t.visible},k.prototype.setMinColumnWidth=function(e){let t=this.o;return e=Math.max(e,0),t.minColumnWidth!==e&&(t.minColumnWidth=e,this.tableWidthChanged(!0)),this},k.prototype.getMinColumnWidth=function(){return this.o.minColumnWidth},k.prototype.setSortableColumns=function(e){const t=this.p,l=this.o;if(l.sortableColumns!==e&&(l.sortableColumns=e,t.$table)){let e=t.$headerRow.find(">div."+l.tableClassName+"-header-cell");for(let o=0;o<e.length;o++)R(e[0])[l.sortableColumns>0&&t.visibleColumns[o].sortable?"addClass":"removeClass"]("sortable")}return this},k.prototype.getSortableColumns=function(){return this.o.sortableColumns},k.prototype.setMovableColumns=function(e){let t=this.o;return e=void 0===e||!!e,t.movableColumns!==e&&(t.movableColumns=e),this},k.prototype.getMovableColumns=function(){return this.o.movableColumns},k.prototype.setResizableColumns=function(e){let t=this.o;return e=void 0===e||!!e,t.resizableColumns!==e&&(t.resizableColumns=e),this},k.prototype.getResizableColumns=function(){return this.o.resizableColumns},k.prototype.setOnComparatorRequired=function(e){let t=this.o;return t.onComparatorRequired!==e&&(t.onComparatorRequired=e),this},k.prototype.setComparatorCallback=k.prototype.setOnComparatorRequired,k.prototype.setCustomSortingProvider=function(e){let t=this.o;return t.customSortingProvider!==e&&(t.customSortingProvider=e),this},k.prototype.setColumnWidth=function(e,t){let l=this.p.columns.get(e),o=this._parseColumnWidth(t,l.ignoreMin?0:this.o.minColumnWidth);if(l){let e=this._serializeColumnWidth(l);l.width=o.width,l.widthMode=o.mode;let t=this._serializeColumnWidth(l);e!==t&&this.tableWidthChanged(!0),this.trigger("columnwidth",l.name,e,t)}return this},k.prototype.getColumnWidth=function(e){let t=this.p.columns.get(e);return t?this._serializeColumnWidth(t):null},k.prototype.getColumnConfig=function(e){let t=this.p.columns.get(e);return t?{order:t.order,width:this._serializeColumnWidth(t),visible:t.visible,label:t.label}:null},k.prototype.getColumnsConfig=function(){const e=this.p;let t={};for(let l=0;l<e.columns.length;l++)t[e.columns[l].name]=this.getColumnConfig(e.columns[l].name);return t},k.prototype.getSortedColumns=function(){const e=this.p;let t=[];for(let l=0;l<e.rows.sortColumn.length;l++){let o=e.rows.sortColumn[l];t.push({column:o.column,descending:o.descending})}return t},k.prototype.getHtmlForRowCell=function(e,t){const l=this.p;if(e<0||e>l.rows.length-1)return null;let o=l.columns.get(t);if(!o)return null;let i=l.rows[e];return this._getHtmlForCell(i,o)},k.prototype.getHtmlForRowDataCell=function(e,t){let l=this.p.columns.get(t);return l?this._getHtmlForCell(e,l):null},k.prototype._getHtmlForCell=function(e,t){let l=t.dataPath,o=e[l[0]];for(let e=1;e<l.length&&null!=o;e++)o=o&&o[l[e]];const i=this.o.cellFormatter;let r;if(i[P])r=i(o,t.name,e);else try{r=i(o,t.name,e)}catch(e){r="[ERROR]",console.error("Failed to generate content for cell "+t.name,e)}return null==r&&(r=""),r},k.prototype.getRowYPos=function(e){return this.p.virtualListHelper.getItemPosition(e)||null},k.prototype.getDataForRow=function(e){const t=this.p;return e<0||e>t.rows.length-1?null:t.rows[e]},k.prototype.getRowCount=function(){const e=this.p;return e.rows?e.rows.length:0},k.prototype.getIndexForRow=function(e){return this.p.rows.indexOf(e)},k.prototype.getFilteredRowCount=function(){const e=this.p;return(e.filteredRows||e.rows).length},k.prototype.getIndexForFilteredRow=function(e){const t=this.p;return(t.filteredRows||t.rows).indexOf(e)},k.prototype.getDataForFilteredRow=function(e){const t=this.p;return e<0||e>(t.filteredRows||t.rows).length-1?null:(t.filteredRows||t.rows)[e]},k.prototype.getHeaderRowElement=function(){return this.p.headerRow},k.prototype._horizontalPadding=function(e){return(parseFloat(R.css(e,"padding-left"))||0)+(parseFloat(R.css(e,"padding-right"))||0)},k.prototype._horizontalBorderWidth=function(e){return(parseFloat(R.css(e,"border-left"))||0)+(parseFloat(R.css(e,"border-right"))||0)},k.prototype._calculateWidthAvailableForColumns=function(){const e=this.o,t=this.p;let o,i,r;t.table&&(i=t.table?t.table.scrollTop:0,r=t.table?t.table.scrollLeft:0,e.virtualTable&&(o=t.table.style.display,t.table.style.display="none"));let n=l.getElementWidth(this.$el[0]);t.table&&(e.virtualTable&&(t.table.style.display=o),t.table.scrollTop=i,t.table.scrollLeft=r,t.header.scrollLeft=r);let s=e.tableClassName,a=R("<div>").addClass(this.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px"}),d=R("<div>").addClass(s+"-header").appendTo(a),h=R("<div>").addClass(s+"-header-row").appendTo(d);for(let e=0;e<t.visibleColumns.length;e++){const l=t.visibleColumns[e],o=R("<div><div></div></div>").addClass(s+"-header-cell").addClass(l.cellClasses||"");o[0].columnName=l.name,h.append(o)}a.appendTo(document.body),n-=this._horizontalBorderWidth(h[0]);let u=h.find(">div."+s+"-header-cell");for(let e=0;e<u.length;e++){let l=R(u[e]);if("border-box"!==l.css("boxSizing")){n-=(parseFloat(l.css("border-right-width"))||0)+(parseFloat(l.css("border-left-width"))||0)+this._horizontalPadding(l[0]);const e=l[0].columnName,o=t.columns.get(e);o&&(n-=o.arrowProposedWidth||0)}}return a&&a.remove(),Math.max(0,n)},k.prototype.tableWidthChanged=function(){let e=function(e){let t,o=this.o.tableClassName,i=R("<div>").addClass(this.$el).append(R("<div>").addClass(o+"-header").append(R("<div>").addClass(o+"-header-row").append(t=R("<div>").addClass(o+"-header-cell").append(R("<div>").text(e))))).css({position:"absolute",top:"-9999px",visibility:"hidden"});i.appendTo(document.body);let r=l.getElementWidth(t[0]);return i.remove(),r},t=null;return function(l,o){let i=this.o,r=this.p,n=this._calculateWidthAvailableForColumns(),s=n,a=0;if(!r.$table)return this;o=void 0===o||o;let d=0;if(r.tbody||(o=!1),o&&(d=parseFloat(r.tbody.style.minWidth)||0),s!==t||l){t=n;let l=0,h=[],u=0;for(let e=0;e<r.columns.length;e++)r.columns[e].actualWidthConsideringScrollbarWidth=null;for(let t=0;t<r.visibleColumns.length;t++){let o=r.visibleColumns[t];if(o.widthMode===O.ABSOLUTE){let e=o.width;e+=o.arrowProposedWidth||0,!o.ignoreMin&&e<i.minColumnWidth&&(e=i.minColumnWidth),s-=e,l+=e,e!==o.actualWidth&&(o.actualWidth=e,h.push(t))}else if(o.widthMode===O.AUTO){let r=e.call(this,o.label)+20;r+=o.arrowProposedWidth||0,!o.ignoreMin&&r<i.minColumnWidth&&(r=i.minColumnWidth),s-=r,l+=r,r!==o.actualWidth&&(o.actualWidth=r,i.convertColumnWidthsToRelative||h.push(t))}else o.widthMode===O.RELATIVE&&(u+=o.width,a++)}if(i.convertColumnWidthsToRelative)for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];t.widthMode===O.AUTO&&(t.widthMode=O.RELATIVE,s+=t.actualWidth,t.width=t.actualWidth/l,u+=t.width,a++)}if(a&&(u<1&&i.relativeWidthGrowsToFillWidth||u>1&&i.relativeWidthShrinksToFillWidth))for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];t.widthMode===O.RELATIVE&&(t.width/=u)}let c=Math.max(0,s);0===c&&(c=r.table.clientWidth);let m=i.minColumnWidth/c;if(isNaN(m)&&(m=0),m>0){let e,t=0;for(let e=0;e<r.visibleColumns.length;e++){let l=r.visibleColumns[e];l.widthMode===O.RELATIVE&&!l.ignoreMin&&l.width<m&&(t+=m-l.width,l.width=m)}for(let l=0;l<r.visibleColumns.length;l++){let o=r.visibleColumns[l];o.widthMode===O.RELATIVE&&!o.ignoreMin&&o.width>m&&t>0&&(e=Math.min(t,o.width-m),o.width-=e,t-=e)}}if(i.autoFillTableWidth&&s>0){let e=0,t=s;for(let l=0;l<r.visibleColumns.length;l++){let o=r.visibleColumns[l];o.resizable||o.widthMode!==O.ABSOLUTE||(e+=o.width),o.widthMode===O.RELATIVE&&(t-=Math.round(c*o.width))}let l=(n-e)/(n-t-e)||NaN;for(let e=0;e<r.visibleColumns.length&&t>0;e++){let t=r.visibleColumns[e];if(t.resizable||t.widthMode!==O.ABSOLUTE)if(t.widthMode===O.RELATIVE)t.width*=l;else{let o=t.actualWidth*l;t.actualWidth!==o&&(t.actualWidth=o,-1===h.indexOf(e)&&h.push(e))}}}for(let e=0;e<r.visibleColumns.length;e++){let t=r.visibleColumns[e];if(t.widthMode===O.RELATIVE){let l=Math.round(c*t.width);s-=l,a--,0===a&&1===s&&(l++,s--),-1===s&&(l--,s++),l!==t.actualWidth&&(t.actualWidth=l,h.push(e))}}if(r.visibleColumns.length&&(r.visibleColumns[r.visibleColumns.length-1].actualWidthConsideringScrollbarWidth=r.visibleColumns[r.visibleColumns.length-1].actualWidth-(r.scrollbarWidth||0)),r.notifyRendererOfColumnsConfig?.(),o){let e=this._calculateTbodyWidth();d<e&&this._updateTableWidth(!1);for(let e=0;e<h.length;e++)this._resizeColumnElements(h[e]);d>e&&this._updateTableWidth(!1)}}return this}}(),k.prototype.tableHeightChanged=function(){let e=this,t=e.o,o=e.p;if(!o.$table)return e;let i=l.getElementHeight(e.$el[0],!0)-(parseFloat(o.$table.css("border-top-width"))||0)-(parseFloat(o.$table.css("border-bottom-width"))||0);return i!==t.height&&(t.height=i,o.tbody&&(o.tbody.style.height=Math.max(t.height-l.getElementHeight(o.$headerRow[0],!0,!0,!0),1)+"px"),t.virtualTable&&e.clearAndRender()),e},k.prototype.addRows=function(e,t,l,o){let i=this.p;return"boolean"==typeof t&&(o=l,l=t,t=-1),"number"!=typeof t&&(t=-1),(t<0||t>i.rows.length)&&(t=i.rows.length),o=void 0===o||!!o,e&&(i.rows.add(e,t),i.filteredRows||l&&i.rows.sortColumn.length?(l&&i.rows.sortColumn.length?this.resort():this._refilter(),i.tableSkeletonNeedsRendering=!0,o&&this.render()):o&&(i.virtualListHelper.addItemsAt(e.length,t),this.o.virtualTable?this._updateVirtualHeight()._updateLastCellWidthFromScrollbar().render()._updateTableWidth(!1):i.tbody&&this.render()._updateLastCellWidthFromScrollbar()._updateTableWidth(!0)),this.trigger("addrows",e.length,!1)),this},k.prototype.removeRows=function(e,t,l){let o=this.p;return"number"!=typeof t||t<=0||e<0||e>o.rows.length-1||(o.rows.splice(e,t),l=void 0===l||!!l,o.filteredRows?(this._refilter(),o.tableSkeletonNeedsRendering=!0,l&&this.render()):l&&(o.virtualListHelper.removeItemsAt(t,e),this.o.virtualTable?this._updateVirtualHeight()._updateLastCellWidthFromScrollbar().render()._updateTableWidth(!1):this.render()._updateLastCellWidthFromScrollbar()._updateTableWidth(!0))),this},k.prototype.removeRow=function(e,t){return this.removeRows(e,1,t)},k.prototype.refreshRow=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=this.p;if(e<0||e>l.rows.length-1)return this;let o=-1;return l.filteredRows&&-1===(o=l.filteredRows.indexOf(l.rows[e]))||(-1===o&&(o=e),l.virtualListHelper.refreshItemAt(o),t&&l.virtualListHelper.render()),this},k.prototype.getRowElement=function(e){let t=this.p;if(e<0||e>t.rows.length-1)return null;let l=-1;return t.filteredRows&&-1===(l=t.filteredRows.indexOf(t.rows[e]))?this:(-1===l&&(l=e),t.virtualListHelper.getItemElementAt(l)||null)},k.prototype.refreshAllVirtualRows=function(){return this.p.virtualListHelper.invalidate().render(),this},k.prototype.setRows=function(e,t){let l=this.p;return l.rows.reset(e),t&&l.rows.sortColumn.length?this.resort():this._refilter(),this.clearAndRender().trigger("addrows",e.length,!0),this},k.prototype.getUrlForElementContent=function(e){let t,l=document.getElementById(e);if(l){let e=l.textContent;if("function"==typeof Blob)t=new Blob([e]);else{let l=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(!l)return null;let o=new l;o.append(e),t=o.getBlob()}return(window.URL||window.webkitURL).createObjectURL(t)}return null},k.prototype.isWorkerSupported=function(){return window.Worker instanceof Function},k.prototype.createWebWorker=function(e,t,l){if(this.isWorkerSupported()){let o=this,i=o.p,r=new Worker(e),n=function(e){e.data.append?o.addRows(e.data.rows,l):o.setRows(e.data.rows,l)};return r.addEventListener("message",n,!1),i.workerListeners||(i.workerListeners=[]),i.workerListeners.push({worker:r,listener:n}),(t||void 0===t)&&r.postMessage(null),r}return null},k.prototype.unbindWebWorker=function(e){let t=this.p;if(t.workerListeners)for(let l=0;l<t.workerListeners.length;l++)t.workerListeners[l].worker===e&&(e.removeEventListener("message",t.workerListeners[l].listener,!1),t.workerListeners.splice(l,1),l--);return this},k.prototype.abortCellPreview=function(){return this.hideCellPreview(),this},k.prototype.cancelColumnResize=function(){const e=this.p;return e.$resizer&&(e.$resizer.remove(),e.$resizer=null,R(document).off("mousemove.dgtable",e.onMouseMoveResizeAreaBound).off("mouseup.dgtable",e.onEndDragColumnHeaderBound)),this},k.prototype._onTableScrolledHorizontally=function(){const e=this.p;e.header.scrollLeft=e.table.scrollLeft},k.prototype._getColumnByResizePosition=function(e){let t=this.o,o=this._isTableRtl(),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),r=i[0];r.__cell&&(r=r.__cell,i=R(r));let n=i[0].previousSibling;for(;n&&1!==n.nodeType;)n=n.previousSibling;let s=!n,a=((null!=e.pageX?e.pageX:e.originalEvent.pageX)||e.originalEvent.clientX)-i.offset().left;if(o){if(!s&&l.getElementWidth(i[0],!0,!0,!0)-a<=t.resizeAreaWidth/2)return n.columnName;if(a<=t.resizeAreaWidth/2)return r.columnName}else{if(!s&&a<=t.resizeAreaWidth/2)return n.columnName;if(l.getElementWidth(i[0],!0,!0,!0)-a<=t.resizeAreaWidth/2)return r.columnName}return null},k.prototype._onTouchStartColumnHeader=function(e){const t=this.p;if(t.currentTouchId)return;let l=e.originalEvent.changedTouches[0];t.currentTouchId=l.identifier;let o,r=R(e.currentTarget),n={x:l.pageX,y:l.pageY},s=n,a=function(){t.currentTouchId=null,r.off("touchend").off("touchcancel"),clearTimeout(o)},d=function(t){let l=R.Event(t),o=Array.prototype.slice.call(arguments,1);for(let t of["target","clientX","clientY","offsetX","offsetY","screenX","screenY","pageX","pageY","which"]){l[t]=e[t];for(let e=0;e<o.length;e++)null!=o[e][t]&&(l[t]=o[e][t])}return l};r.trigger(d("mousedown",e.originalEvent.changedTouches[0],{which:1,target:e.target})),o=setTimeout((()=>{a(),r.one("touchend",(e=>{L(e)||e.preventDefault(),r.off("touchend").off("touchcancel")})).one("touchcancel",(e=>{r.off("touchend").off("touchcancel")})),Math.sqrt(Math.pow(Math.abs(s.x-n.x),2)+Math.pow(Math.abs(s.y-n.y),2))<9&&(this.cancelColumnResize(),r.trigger(d("mouseup",e.originalEvent.changedTouches[0],{which:3,target:e.target})))}),500),r.on("touchend",(e=>{let l=i(e.originalEvent.changedTouches,(e=>e.identifier===t.currentTouchId));l&&(a(),L(e)||e.preventDefault(),s={x:l.pageX,y:l.pageY},(Math.sqrt(Math.pow(Math.abs(s.x-n.x),2)+Math.pow(Math.abs(s.y-n.y),2))<9||t.$resizer)&&(r.trigger(d("mouseup",l,{which:1,target:e.target})),r.trigger(d("click",l,{which:1,target:e.target}))))})).on("touchcancel",(()=>{a()})).on("touchmove",(e=>{let l=i(e.originalEvent.changedTouches,(e=>e.identifier===t.currentTouchId));l&&(s={x:l.pageX,y:l.pageY},t.$resizer&&(e.preventDefault(),r.trigger(d("mousemove",l,{target:e.target}))))}))},k.prototype._onMouseDownColumnHeader=function(e){if(1!==e.which)return this;let t=this.o,o=this.p,i=this._getColumnByResizePosition(e);if(i){let r=o.columns.get(i);if(!t.resizableColumns||!r||!r.resizable)return!1;let n=this._isTableRtl();o.$resizer&&R(o.$resizer).remove(),o.$resizer=R("<div></div>").addClass(t.resizerClassName).css({position:"absolute",display:"block","z-index":-1,visibility:"hidden",width:"2px",background:"#000",opacity:.7}).appendTo(this.$el);let s=r.element,a=o.$resizer.parent(),d=s.offset(),h=a.offset();8===x&&(d=s.offset()),h.left+=parseFloat(a.css("border-left-width"))||0,h.top+=parseFloat(a.css("border-top-width"))||0,d.left-=h.left,d.top-=h.top,d.top-=parseFloat(s.css("border-top-width"))||0;let u=l.getElementWidth(o.$resizer[0],!0,!0,!0);n?(d.left-=Math.ceil((parseFloat(s.css("border-left-width"))||0)/2),d.left-=Math.ceil(u/2)):(d.left+=l.getElementWidth(s[0],!0,!0,!0),d.left+=Math.ceil((parseFloat(s.css("border-right-width"))||0)/2),d.left-=Math.ceil(u/2)),o.$resizer.css({"z-index":"10",visibility:"visible",left:d.left,top:d.top,height:l.getElementHeight(this.$el[0])})[0].columnName=s[0].columnName;try{o.$resizer[0].style.zIndex=""}catch(e){}R(document).on("mousemove.dgtable",o.onMouseMoveResizeAreaBound),R(document).on("mouseup.dgtable",o.onEndDragColumnHeaderBound),e.preventDefault()}},k.prototype._onMouseMoveColumnHeader=function(e){let t=this.o,l=this.p;if(t.resizableColumns){let o=this._getColumnByResizePosition(e),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName)[0];o&&l.columns.get(o).resizable?i.style.cursor="e-resize":i.style.cursor=""}},k.prototype._onMouseUpColumnHeader=function(e){if(3===e.which){let t=this.o,o=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),i=o.offset();i.width=l.getElementWidth(o[0],!0,!0,!0),i.height=l.getElementHeight(o[0],!0,!0,!0),this.trigger("headercontextmenu",o[0].columnName,e.pageX,e.pageY,i)}return this},k.prototype._onMouseLeaveColumnHeader=function(e){let t=this.o;R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName)[0].style.cursor=""},k.prototype._onClickColumnHeader=function(e){if(!L(e)&&!this._getColumnByResizePosition(e)){let t=this,l=t.o,o=t.p,i=R(e.target).closest("div."+l.tableClassName+"-header-cell,div."+l.cellPreviewClassName)[0];if(l.sortableColumns){let e=o.columns.get(i.columnName),t=o.rows.sortColumn;if(e&&e.sortable){let o=!0,i=t.length?t[t.length-1]:null;i&&i.column===e.name&&(i.descending&&l.allowCancelSort?(o=!1,t.splice(t.length-1,1)):i.descending=!i.descending),o?this.sort(e.name,void 0,!0).render():this.sort()}}}},k.prototype._onStartDragColumnHeader=function(e){let t=this.o,l=this.p;if(t.movableColumns){let o=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName),i=l.columns.get(o[0].columnName);i&&i.movable?(o[0].style.opacity=.35,l.dragId=161061273*Math.random(),e.originalEvent.dataTransfer.setData("text",JSON.stringify({dragId:l.dragId,column:i.name}))):e.preventDefault()}else e.preventDefault()},k.prototype._onMouseMoveResizeArea=function(e){let t=this.p,o=t.columns.get(t.$resizer[0].columnName),i=this._isTableRtl(),r=o.element,n=t.$resizer.parent(),s=r.offset(),a=n.offset();a.left+=parseFloat(n.css("border-left-width"))||0,s.left-=a.left;let d=l.getElementWidth(t.$resizer[0],!0,!0,!0),h="border-box"===r.css("box-sizing"),u=e.pageX-a.left,c=s.left;c-=Math.ceil(d/2),i?(c+=l.getElementWidth(r[0],!0,!0,!0),c-=o.ignoreMin?0:this.o.minColumnWidth,h||(c-=Math.ceil((parseFloat(r.css("border-left-width"))||0)/2),c-=this._horizontalPadding(r[0])),u>c&&(u=c)):(c+=o.ignoreMin?0:this.o.minColumnWidth,h||(c+=Math.ceil((parseFloat(r.css("border-right-width"))||0)/2),c+=this._horizontalPadding(r[0])),u<c&&(u=c)),t.$resizer.css("left",u+"px")},k.prototype._onEndDragColumnHeader=function(e){let t=this.o,o=this.p;if(o.$resizer){R(document).off("mousemove.dgtable",o.onMouseMoveResizeAreaBound).off("mouseup.dgtable",o.onEndDragColumnHeaderBound);let i=o.columns.get(o.$resizer[0].columnName),r=this._isTableRtl(),n=i.element,s=n[0].firstChild,a=o.$resizer.parent(),d=n.offset(),h=a.offset();h.left+=parseFloat(a.css("border-left-width"))||0,d.left-=h.left;let u=l.getElementWidth(o.$resizer[0],!0,!0,!0),c="border-box"===n.css("box-sizing"),m=e.pageX-h.left,p=d.left,g=d.left,f=0;if(p-=Math.ceil(u/2),r){if(!c){m+=this._horizontalPadding(n[0]);const e=getComputedStyle(s||n[0]);m+=parseFloat(e.borderLeftWidth)||0,m+=parseFloat(e.borderRightWidth)||0,m+=i.arrowProposedWidth||0}p+=l.getElementWidth(n[0],!0,!0,!0),g=p-(i.ignoreMin?0:this.o.minColumnWidth),m>g&&(m=g),f=p-m}else{if(!c){m-=this._horizontalPadding(n[0]);const e=getComputedStyle(s||n[0]);m-=parseFloat(e.borderLeftWidth)||0,m-=parseFloat(e.borderRightWidth)||0,m-=i.arrowProposedWidth||0}g=p+(i.ignoreMin?0:this.o.minColumnWidth),m<g&&(m=g),f=m-p}o.$resizer.remove(),o.$resizer=null;let b=f;if(i.widthMode===O.RELATIVE){let e=this._calculateWidthAvailableForColumns(),l=0,r=0;for(let t=0;t<o.visibleColumns.length;t++){let n=o.visibleColumns[t];n.name!==i.name&&(n.widthMode===O.RELATIVE?(l+=n.width,r++):e-=n.actualWidth)}if(e=Math.max(1,e),1===e&&(e=o.table.clientWidth),b=f/e,r>0){let e=b/((1-b)/l);l+=b,(l<1&&t.relativeWidthGrowsToFillWidth||l>1&&t.relativeWidthShrinksToFillWidth)&&(b=e)}b*=100,b+="%"}this.setColumnWidth(i.name,b)}else e.target.style.opacity=null},k.prototype._onDragEnterColumnHeader=function(e){let t=this.o,l=this.p;if(t.movableColumns){let o=e.originalEvent.dataTransfer.getData("text");o=o?JSON.parse(o):null;let i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);if(!o||l.dragId===o.dragId&&i.columnName!==o.column){let e=l.columns.get(i[0].columnName);e&&(e.movable||e!==l.visibleColumns[0])&&R(i).addClass("drag-over")}}},k.prototype._onDragOverColumnHeader=function(e){e.preventDefault()},k.prototype._onDragLeaveColumnHeader=function(e){let t=this.o,l=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);R(l[0].firstChild).has(e.originalEvent.relatedTarget).length||l.removeClass("drag-over")},k.prototype._onDropColumnHeader=function(e){e.preventDefault();let t=this.o,l=this.p,o=JSON.parse(e.originalEvent.dataTransfer.getData("text")),i=R(e.target).closest("div."+t.tableClassName+"-header-cell,div."+t.cellPreviewClassName);if(t.movableColumns&&o.dragId===l.dragId){let e=o.column,t=i[0].columnName,r=l.columns.get(e),n=l.columns.get(t);r&&n&&r.movable&&(n.movable||n!==l.visibleColumns[0])&&this.moveColumn(e,t)}R(i).removeClass("drag-over")},k.prototype._clearSortArrows=function(){let e=this.p;if(e.$table){let t=this.o.tableClassName,l=e.$headerRow.find(">div."+t+"-header-cell.sorted"),o=l.find(">div>.sort-arrow");o.each(((t,l)=>{let o=e.columns.get(l.parentNode.parentNode.columnName);o&&(o.arrowProposedWidth=0)})),o.remove(),l.removeClass("sorted").removeClass("desc")}return this},k.prototype._showSortArrow=function(e,t){let l=this.p.columns.get(e);if(!l)return!1;let o=S("span");return o.className="sort-arrow",l.element&&(l.element.addClass(t?"sorted desc":"sorted"),l.element[0].firstChild.insertBefore(o,l.element[0].firstChild.firstChild)),l.widthMode!==O.RELATIVE&&this.o.adjustColumnWidthForSortArrow&&(l.arrowProposedWidth=o.scrollWidth+(parseFloat(R(o).css("margin-right"))||0)+(parseFloat(R(o).css("margin-left"))||0)),this},k.prototype._resizeColumnElements=function(e){let t=this.p,l=t.$headerRow.find("div."+this.o.tableClassName+"-header-cell"),o=t.columns.get(l[e].columnName);if(o){l[e].style.width=(o.actualWidthConsideringScrollbarWidth||o.actualWidth)+"px";let i=(o.actualWidthConsideringScrollbarWidth||o.actualWidth)+"px",r=t.tbody.childNodes;for(let t=0,l=r.length;t<l;t++){let l=r[t];1===l.nodeType&&(l.childNodes[e].style.width=i)}}return this},k.prototype._destroyHeaderCells=function(){let e=this.o,t=this.p;return t.$headerRow&&(this.trigger("headerrowdestroy",t.headerRow),t.$headerRow.find("div."+e.tableClassName+"-header-cell").remove(),t.$headerRow=null,t.headerRow=null),this},k.prototype._renderSkeletonBase=function(){let e=this,t=e.p,o=e.o;t.virtualListHelper?.destroy(),t.virtualListHelper=null,t.$table&&o.virtualTable&&(t.$table.remove(),t.$table=t.table=t.$tbody=t.tbody=null),e._destroyHeaderCells(),t.currentTouchId=null,t.$header&&t.$header.remove();let i=o.tableClassName,r=S("div"),n=R(r),s=S("div"),a=R(s);return r.className=i+"-header",s.className=i+"-header-row",t.$header=n,t.header=r,t.$headerRow=a,t.headerRow=s,a.appendTo(t.$header),n.prependTo(this.$el),M(e.$el),o.width===k.Width.SCROLL?this.el.style.overflow="hidden":this.el.style.overflow="",!o.height&&o.virtualTable&&(o.height=l.getElementHeight(this.$el[0],!0)),this},k.prototype._renderSkeletonHeaderCells=function(){let e,t=this,l=t.p,o=t.o,i=o.allowCellPreview,r=o.allowHeaderCellPreview,n=o.tableClassName+"-header-cell",s=l.headerRow;N&&(e=function(e){return e.preventDefault(),this.dragDrop(),!1});let a=function(e){e.preventDefault()};for(let d=0;d<l.visibleColumns.length;d++){let h=l.visibleColumns[d];if(h.visible){let u=S("div"),c=R(u);u.draggable=!0,u.className=n,u.style.width=h.actualWidth+"px",o.sortableColumns&&h.sortable&&(u.className+=" sortable"),u.columnName=h.name,u.setAttribute("data-column",h.name);let m=S("div");m.innerHTML=o.headerCellFormatter(h.label,h.name),u.appendChild(m),i&&r&&l._bindCellHoverIn(u),s.appendChild(u),l.visibleColumns[d].element=c,c.on("mousedown.dgtable",t._onMouseDownColumnHeader.bind(t)).on("mousemove.dgtable",t._onMouseMoveColumnHeader.bind(t)).on("mouseup.dgtable",t._onMouseUpColumnHeader.bind(t)).on("mouseleave.dgtable",t._onMouseLeaveColumnHeader.bind(t)).on("touchstart.dgtable",t._onTouchStartColumnHeader.bind(t)).on("dragstart.dgtable",t._onStartDragColumnHeader.bind(t)).on("click.dgtable",t._onClickColumnHeader.bind(t)).on("contextmenu.dgtable",a),R(m).on("dragenter.dgtable",t._onDragEnterColumnHeader.bind(t)).on("dragover.dgtable",t._onDragOverColumnHeader.bind(t)).on("dragleave.dgtable",t._onDragLeaveColumnHeader.bind(t)).on("drop.dgtable",t._onDropColumnHeader.bind(t)),N&&c.on("selectstart.dgtable",e.bind(u)),c.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"})}}return this.trigger("headerrowcreate",s),this},k.prototype._renderSkeletonBody=function(){let e=this,t=e.p,o=e.o,i=o.tableClassName;if(o.virtualTable&&!t.virtualRowHeight){let o,r=function(){let e=S("div"),t=e.appendChild(S("div")),l=t.appendChild(S("div"));return e.className=i+"-row",t.className=i+"-cell",l.innerHTML="0",e.style.visibility="hidden",e.style.position="absolute",e},n=R("<div>").addClass(e.el.className).css({"z-index":-1,position:"absolute",left:"0",top:"-9999px",width:"1px",overflow:"hidden"}).append(R("<div>").addClass(i).append(o=R("<div>").addClass(i+"-body").css("width",99999)));n.appendTo(document.body);let s=r(),a=r(),d=r();o.append(s,a,d),t.virtualRowHeightFirst=l.getElementHeight(s,!0,!0,!0),t.virtualRowHeight=l.getElementHeight(a,!0,!0,!0),t.virtualRowHeightLast=l.getElementHeight(d,!0,!0,!0),n.remove()}if(!t.$table){let r=document.createDocumentFragment(),n=S("div"),s=R(n);n.className=i,o.virtualTable&&(n.className+=" virtual");let a=o.height-l.getElementHeight(t.$headerRow[0],!0,!0,!0);"border-box"!==s.css("box-sizing")&&(a-=parseFloat(s.css("border-top-width"))||0,a-=parseFloat(s.css("border-bottom-width"))||0,a-=parseFloat(s.css("padding-top"))||0,a-=parseFloat(s.css("padding-bottom"))||0),t.visibleHeight=a,n.style.height=o.height?a+"px":"auto",n.style.display="block",n.style.overflowY="auto",n.style.overflowX=o.width===k.Width.SCROLL?"auto":"hidden",r.appendChild(n);let d=S("div"),h=R(d);d.className=o.tableClassName+"-body",d.style.minHeight="1px",t.table=n,t.tbody=d,t.$table=s,t.$tbody=h,M(h),M(s),n.appendChild(d),e.el.appendChild(r),this._setupVirtualTable()}return this},k.prototype._renderSkeleton=function(){return this},k.prototype._updateVirtualHeight=function(){const e=this.o,t=this.p;if(!t.tbody)return this;if(e.virtualTable){const e=t.virtualListHelper.estimateFullHeight();t.lastVirtualScrollHeight=e,t.tbody.style.height=e+"px"}else t.tbody.style.height="";return this},k.prototype._updateLastCellWidthFromScrollbar=function(e){const t=this.p;let l=t.table.offsetWidth-t.table.clientWidth;if(l!==t.scrollbarWidth||e){t.scrollbarWidth=l;for(let e=0;e<t.columns.length;e++)t.columns[e].actualWidthConsideringScrollbarWidth=null;if(t.scrollbarWidth>0&&t.visibleColumns.length>0){let e=t.visibleColumns.length-1;t.visibleColumns[e].actualWidthConsideringScrollbarWidth=t.visibleColumns[e].actualWidth-t.scrollbarWidth;let l=t.visibleColumns[e].actualWidthConsideringScrollbarWidth+"px",o=t.tbody.childNodes;for(let t=0,i=o.length;t<i;t++){let i=o[t];1===i.nodeType&&(i.childNodes[e].style.width=l)}t.headerRow.childNodes[e].style.width=l}t.notifyRendererOfColumnsConfig?.()}return this},k.prototype._updateTableWidth=function(e){const t=this.o,o=this.p;let i=this._calculateTbodyWidth();if(o.tbody.style.minWidth=i+"px",o.headerRow.style.minWidth=i+(o.scrollbarWidth||0)+"px",o.$table.off("scroll",o.onTableScrolledHorizontallyBound),t.width===k.Width.AUTO)l.setElementWidth(o.$table[0],l.getElementWidth(o.tbody,!0,!0,!0)),l.setElementWidth(this.$el[0],l.getElementWidth(o.$table[0],!0,!0,!0));else if(t.width===k.Width.SCROLL){if(e){let e=o.table?o.table.scrollTop:0,t=o.table?o.table.scrollLeft:0;!function(e){let t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}(this.el),o.table.scrollTop=e,o.table.scrollLeft=t,o.header.scrollLeft=t}o.$table.on("scroll",o.onTableScrolledHorizontallyBound)}return this},k.prototype._isTableRtl=function(){return"rtl"===this.p.$table.css("direction")},k.prototype._serializeColumnWidth=function(e){return e.widthMode===O.AUTO?"auto":e.widthMode===O.RELATIVE?100*e.width+"%":e.width},k.prototype._cellMouseOverEvent=function(e){const t=this.o,o=this.p;let i=e.firstChild;if(i.scrollWidth-i.clientWidth>1||i.scrollHeight-i.clientHeight>1){this.hideCellPreview(),o.abortCellPreview=!1;let r=R(e),n=R(i);const s=e.parentNode;let a=S("div"),d=R(a);a.innerHTML=e.innerHTML,a.className=t.cellPreviewClassName;let u=r.hasClass(t.tableClassName+"-header-cell");u&&(a.className+=" header",r.hasClass("sortable")&&(a.className+=" sortable"),a.draggable=!0,R(a).on("mousedown",this._onMouseDownColumnHeader.bind(this)).on("mousemove",this._onMouseMoveColumnHeader.bind(this)).on("mouseup",this._onMouseUpColumnHeader.bind(this)).on("mouseleave",this._onMouseLeaveColumnHeader.bind(this)).on("touchstart",this._onTouchStartColumnHeader.bind(this)).on("dragstart",this._onStartDragColumnHeader.bind(this)).on("click",this._onClickColumnHeader.bind(this)).on("contextmenu.dgtable",(function(e){e.preventDefault()})),R(a.firstChild).on("dragenter",this._onDragEnterColumnHeader.bind(this)).on("dragover",this._onDragOverColumnHeader.bind(this)).on("dragleave",this._onDragLeaveColumnHeader.bind(this)).on("drop",this._onDropColumnHeader.bind(this)),N&&R(a).on("selectstart",function(e){return e.preventDefault(),this.dragDrop(),!1}.bind(a)));let c=parseFloat(r.css("padding-left"))||0,m=parseFloat(r.css("padding-right"))||0,p=parseFloat(r.css("padding-top"))||0,g=parseFloat(r.css("padding-bottom"))||0,f=i.scrollWidth+(e.clientWidth-i.offsetWidth),b="border-box"===r.css("box-sizing");if(b?d.css("box-sizing","border-box"):(f-=c+m,d.css("margin-top",parseFloat(R(e).css("border-top-width"))||0)),!o.transparentBgColor1){let e=document.createElement("div");e.style.backgroundColor="transparent",o.transparentBgColor1=R(e).css("background-color"),e.style.backgroundColor="rgba(0,0,0,0)",o.transparentBgColor2=R(e).css("background-color")}let v={"box-sizing":b?"border-box":"content-box",width:f,"min-height":l.getElementHeight(r[0]),"padding-left":c,"padding-right":m,"padding-top":p,"padding-bottom":g,overflow:"hidden",position:"absolute","z-index":"-1",left:"0",top:"0",cursor:r.css("cursor")};if(v){let t=R(e).css("background-color");t!==o.transparentBgColor1&&t!==o.transparentBgColor2||(t=R(s).css("background-color")),t!==o.transparentBgColor1&&t!==o.transparentBgColor2||(t="#fff"),v["background-color"]=t}d.css(v),this.el.appendChild(a),R(a.firstChild).css({direction:n.css("direction"),"white-space":n.css("white-space")}),u&&d.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"}),a.rowIndex=s.rowIndex;let C=a.physicalRowIndex=s.physicalRowIndex;a.columnName=o.visibleColumns[I.call(s.childNodes,e)].name;try{let t=h.saveSelection(e);t&&h.restoreSelection(a,t)}catch(e){}if(this.trigger("cellpreview",a.firstChild,null==C?null:C,a.columnName,null==C?null:o.rows[C],e),o.abortCellPreview)return void d.remove();null!=C&&a.addEventListener("click",(e=>{this.trigger("rowclick",e,s.rowIndex,C,s,o.rows[C])}));let w=this.$el,y=w[0]===window?R(document):w,_=r.offset(),W=w.offset(),E="right"===r.css("float"),H=E?"right":"left";if(E){let e=R(window).width();_.right=e-(_.left+l.getElementWidth(r[0],!0,!0,!0)),W.right=e-(W.left+l.getElementWidth(w[0],!0,!0,!0))}_.left-=parseFloat(w.css("border-left-width"))||0,_.right-=parseFloat(w.css("border-right-width"))||0,_.top-=parseFloat(w.css("border-top-width"))||0,_[H]+=parseFloat(R(e).css("border-"+H+"-width"))||0,_.top+=parseFloat(R(e).css("border-top-width"))||parseFloat(R(e).css("border-bottom-width"))||0,_.left-=W.left,_.right-=W.right,_.top-=W.top;let x=0,T=w-l.getElementWidth(d[0],!0,!0,!0);_[H]=_[H]<x?x:_[H]>T?T:_[H];let P=l.getElementHeight(r[0],!0,!0,!0),F=y.scrollTop()+l.getElementHeight(w[0],!0)-P;_.top>F&&(_.top=Math.max(0,F));let A={top:_.top,"z-index":9999};A[H]=_[H],d.css(A),a.__cell=e,o.$cellPreviewCell=d,e.__previewCell=a,o._bindCellHoverOut(e),o._bindCellHoverOut(a),d.on("wheel",(()=>{this.hideCellPreview()}))}},k.prototype._cellMouseOutEvent=function(e){this.hideCellPreview()},k.prototype.hideCellPreview=function(){const e=this.p;if(e.$cellPreviewCell){let t,l=e.$cellPreviewCell[0],o=l.__cell;try{t=h.saveSelection(l)}catch(e){}e.$cellPreviewCell.remove(),e._unbindCellHoverOut(o),e._unbindCellHoverOut(l);try{t&&h.restoreSelection(o,t)}catch(e){}this.trigger("cellpreviewdestroy",l.firstChild,l.physicalRowIndex,l.columnName,o),o.__previewCell=null,l.__cell=null,e.$cellPreviewCell=null,e.abortCellPreview=!1}else e.abortCellPreview=!0;return this};const O={AUTO:0,ABSOLUTE:1,RELATIVE:2};return k.Width={NONE:"none",AUTO:"auto",SCROLL:"scroll"},R.controls||(R.controls={}),R.controls.dgtable=k,k},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery"),require("@danielgindi/dom-utils/lib/ScrollHelper"),require("@danielgindi/dom-utils/lib/Css")):"function"==typeof define&&define.amd?define(["jquery","@danielgindi/dom-utils/lib/ScrollHelper","@danielgindi/dom-utils/lib/Css"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).DGTable=t(e.jQuery,e.ScrollHelper,e.Css);
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=jquery.dgtable.umd.min.js.map
|