@guiexpert/solid-table 1.0.22 → 1.0.23

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.
Files changed (3) hide show
  1. package/index.cjs +8 -8
  2. package/index.js +48 -34
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=(r,e)=>r===e,te=Symbol("solid-proxy"),ue={equals:ke};let ye=we;const L=1,N=2,ve={owned:null,cleanups:null,context:null,owner:null};var R=null;let Z=null,pe=null,w=null,M=null,I=null,q=0;function Oe(r,e){const t=w,s=R,o=r.length===0,i=e===void 0?s:e,l=o?ve:{owned:null,cleanups:null,context:i?i.context:null,owner:i},n=o?r:()=>r(()=>H(()=>J(l)));R=l,w=null;try{return G(n,!0)}finally{w=t,R=s}}function se(r,e,t){const s=le(r,e,!1,L);W(s)}function Fe(r,e,t){ye=We;const s=le(r,e,!1,L);(!t||!t.render)&&(s.user=!0),I?I.push(s):W(s)}function Ie(r,e,t){t=t?Object.assign({},ue,t):ue;const s=le(r,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,W(s),$e.bind(s)}function H(r){if(!pe&&w===null)return r();const e=w;w=null;try{return r()}finally{w=e}}function Le(r){Fe(()=>H(r))}function $e(){if(this.sources&&this.state)if(this.state===L)W(this);else{const r=M;M=null,G(()=>j(this),!1),M=r}if(w){const r=this.observers?this.observers.length:0;w.sources?(w.sources.push(this),w.sourceSlots.push(r)):(w.sources=[this],w.sourceSlots=[r]),this.observers?(this.observers.push(w),this.observerSlots.push(w.sources.length-1)):(this.observers=[w],this.observerSlots=[w.sources.length-1])}return this.value}function Be(r,e,t){let s=r.value;return(!r.comparator||!r.comparator(s,e))&&(r.value=e,r.observers&&r.observers.length&&G(()=>{for(let o=0;o<r.observers.length;o+=1){const i=r.observers[o],l=Z&&Z.running;l&&Z.disposed.has(i),(l?!i.tState:!i.state)&&(i.pure?M.push(i):I.push(i),i.observers&&Ce(i)),l||(i.state=L)}if(M.length>1e6)throw M=[],new Error},!1)),e}function W(r){if(!r.fn)return;J(r);const e=q;Pe(r,r.value,e)}function Pe(r,e,t){let s;const o=R,i=w;w=R=r;try{s=r.fn(e)}catch(l){return r.pure&&(r.state=L,r.owned&&r.owned.forEach(J),r.owned=null),r.updatedAt=t+1,xe(l)}finally{w=i,R=o}(!r.updatedAt||r.updatedAt<=t)&&(r.updatedAt!=null&&"observers"in r?Be(r,s):r.value=s,r.updatedAt=t)}function le(r,e,t,s=L,o){const i={fn:r,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:R,context:R?R.context:null,pure:t};return R===null||R!==ve&&(R.owned?R.owned.push(i):R.owned=[i]),i}function z(r){if(r.state===0)return;if(r.state===N)return j(r);if(r.suspense&&H(r.suspense.inFallback))return r.suspense.effects.push(r);const e=[r];for(;(r=r.owner)&&(!r.updatedAt||r.updatedAt<q);)r.state&&e.push(r);for(let t=e.length-1;t>=0;t--)if(r=e[t],r.state===L)W(r);else if(r.state===N){const s=M;M=null,G(()=>j(r,e[0]),!1),M=s}}function G(r,e){if(M)return r();let t=!1;e||(M=[]),I?t=!0:I=[],q++;try{const s=r();return He(t),s}catch(s){t||(I=null),M=null,xe(s)}}function He(r){if(M&&(we(M),M=null),r)return;const e=I;I=null,e.length&&G(()=>ye(e),!1)}function we(r){for(let e=0;e<r.length;e++)z(r[e])}function We(r){let e,t=0;for(e=0;e<r.length;e++){const s=r[e];s.user?r[t++]=s:z(s)}for(e=0;e<t;e++)z(r[e])}function j(r,e){r.state=0;for(let t=0;t<r.sources.length;t+=1){const s=r.sources[t];if(s.sources){const o=s.state;o===L?s!==e&&(!s.updatedAt||s.updatedAt<q)&&z(s):o===N&&j(s,e)}}}function Ce(r){for(let e=0;e<r.observers.length;e+=1){const t=r.observers[e];t.state||(t.state=N,t.pure?M.push(t):I.push(t),t.observers&&Ce(t))}}function J(r){let e;if(r.sources)for(;r.sources.length;){const t=r.sources.pop(),s=r.sourceSlots.pop(),o=t.observers;if(o&&o.length){const i=o.pop(),l=t.observerSlots.pop();s<o.length&&(i.sourceSlots[l]=s,o[s]=i,t.observerSlots[s]=l)}}if(r.owned){for(e=r.owned.length-1;e>=0;e--)J(r.owned[e]);r.owned=null}if(r.cleanups){for(e=r.cleanups.length-1;e>=0;e--)r.cleanups[e]();r.cleanups=null}r.state=0}function Ge(r){return r instanceof Error?r:new Error(typeof r=="string"?r:"Unknown error",{cause:r})}function xe(r,e=R){throw Ge(r)}function V(){return!0}const _e={get(r,e,t){return e===te?t:r.get(e)},has(r,e){return e===te?!0:r.has(e)},set:V,deleteProperty:V,getOwnPropertyDescriptor(r,e){return{configurable:!0,enumerable:!0,get(){return r.get(e)},set:V,deleteProperty:V}},ownKeys(r){return r.keys()}};function ee(r){return(r=typeof r=="function"?r():r)?r:{}}function Ve(){for(let r=0,e=this.length;r<e;++r){const t=this[r]();if(t!==void 0)return t}}function Ee(...r){let e=!1;for(let l=0;l<r.length;l++){const n=r[l];e=e||!!n&&te in n,r[l]=typeof n=="function"?(e=!0,Ie(n)):n}if(e)return new Proxy({get(l){for(let n=r.length-1;n>=0;n--){const a=ee(r[n])[l];if(a!==void 0)return a}},has(l){for(let n=r.length-1;n>=0;n--)if(l in ee(r[n]))return!0;return!1},keys(){const l=[];for(let n=0;n<r.length;n++)l.push(...Object.keys(ee(r[n])));return[...new Set(l)]}},_e);const t={},s=Object.create(null);for(let l=r.length-1;l>=0;l--){const n=r[l];if(!n)continue;const a=Object.getOwnPropertyNames(n);for(let c=a.length-1;c>=0;c--){const d=a[c];if(d==="__proto__"||d==="constructor")continue;const h=Object.getOwnPropertyDescriptor(n,d);if(!s[d])s[d]=h.get?{enumerable:!0,configurable:!0,get:Ve.bind(t[d]=[h.get.bind(n)])}:h.value!==void 0?h:void 0;else{const g=t[d];g&&(h.get?g.push(h.get.bind(n)):h.value!==void 0&&g.push(()=>h.value))}}}const o={},i=Object.keys(s);for(let l=i.length-1;l>=0;l--){const n=i[l],a=s[n];a&&a.get?Object.defineProperty(o,n,a):o[n]=a?a.value:void 0}return o}function Ne(r,e,t){let s=t.length,o=e.length,i=s,l=0,n=0,a=e[o-1].nextSibling,c=null;for(;l<o||n<i;){if(e[l]===t[n]){l++,n++;continue}for(;e[o-1]===t[i-1];)o--,i--;if(o===l){const d=i<s?n?t[n-1].nextSibling:t[i-n]:a;for(;n<i;)r.insertBefore(t[n++],d)}else if(i===n)for(;l<o;)(!c||!c.has(e[l]))&&e[l].remove(),l++;else if(e[l]===t[i-1]&&t[n]===e[o-1]){const d=e[--o].nextSibling;r.insertBefore(t[n++],e[l++].nextSibling),r.insertBefore(t[--i],d),e[o]=t[i]}else{if(!c){c=new Map;let h=n;for(;h<i;)c.set(t[h],h++)}const d=c.get(e[l]);if(d!=null)if(n<d&&d<i){let h=l,g=1,S;for(;++h<o&&h<i&&!((S=c.get(e[h]))==null||S!==d+g);)g++;if(g>d-n){const b=e[l];for(;n<d;)r.insertBefore(t[n++],b)}else r.replaceChild(t[n++],e[l++])}else l++;else e[l++].remove()}}}function ze(r,e,t,s={}){let o;return Oe(i=>{o=i,e===document?r():Ke(e,r(),e.firstChild?null:void 0,t)},s.owner),()=>{o(),e.textContent=""}}function je(r,e,t){let s;const o=()=>{const l=document.createElement("template");return l.innerHTML=r,t?l.content.firstChild.firstChild:l.content.firstChild},i=e?()=>H(()=>document.importNode(s||(s=o()),!0)):()=>(s||(s=o())).cloneNode(!0);return i.cloneNode=i,i}function Xe(r,e,t){return H(()=>r(e,t))}function Ke(r,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return X(r,e,s,t);se(o=>X(r,e(),o,t),s)}function X(r,e,t,s,o){for(;typeof t=="function";)t=t();if(e===t)return t;const i=typeof e,l=s!==void 0;if(r=l&&t[0]&&t[0].parentNode||r,i==="string"||i==="number")if(i==="number"&&(e=e.toString()),l){let n=t[0];n&&n.nodeType===3?n.data!==e&&(n.data=e):n=document.createTextNode(e),t=B(r,t,s,n)}else t!==""&&typeof t=="string"?t=r.firstChild.data=e:t=r.textContent=e;else if(e==null||i==="boolean")t=B(r,t,s);else{if(i==="function")return se(()=>{let n=e();for(;typeof n=="function";)n=n();t=X(r,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(oe(n,e,t,o))return se(()=>t=X(r,n,t,s,!0)),()=>t;if(n.length===0){if(t=B(r,t,s),l)return t}else a?t.length===0?be(r,n,s):Ne(r,t,n):(t&&B(r),be(r,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(l)return t=B(r,t,s,e);B(r,t,null,e)}else t==null||t===""||!r.firstChild?r.appendChild(e):r.replaceChild(e,r.firstChild);t=e}}return t}function oe(r,e,t,s){let o=!1;for(let i=0,l=e.length;i<l;i++){let n=e[i],a=t&&t[i],c;if(!(n==null||n===!0||n===!1))if((c=typeof n)=="object"&&n.nodeType)r.push(n);else if(Array.isArray(n))o=oe(r,n,a)||o;else if(c==="function")if(s){for(;typeof n=="function";)n=n();o=oe(r,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||o}else r.push(n),o=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?r.push(a):r.push(document.createTextNode(d))}}return o}function be(r,e,t=null){for(let s=0,o=e.length;s<o;s++)r.insertBefore(e[s],t)}function B(r,e,t,s){if(t===void 0)return r.textContent="";const o=s||document.createTextNode("");if(e.length){let i=!1;for(let l=e.length-1;l>=0;l--){const n=e[l];if(o!==n){const a=n.parentNode===r;!i&&!l?a?r.replaceChild(o,n):r.insertBefore(o,t):a&&n.remove()}else i=!0}}else r.insertBefore(o,t);return[o]}class Ye{constructor(e){this.code=e}render(e,t,s,o,i,l,n){const a=Ee({rowIndex:t,columnIndex:s,areaIdent:o,areaModel:i,cellValue:l});ze(()=>this.code(a),e)}}const Ue=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class ${constructor(){this.alreadySet=!1}static getInstance(){return $.instance||($.instance=new $),$.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function ie(r){return r&&r.type==="TreeRow"}function re(r){return r&&r.type==="AreaModelTree"}class ne{constructor(e=-1,t=-1,s=-1,o=-1,i,l,n,a=0,c=0,d=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=l,this.originalEvent=n,this.clickCount=a,this.draggingX=c,this.draggingY=d,this.action=h}clone(){return new ne(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class F{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Ae{constructor(e=new F(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new F(">","",["ge-table-tree-arrow-collapsed"]),s=new F(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new F("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Me{constructor(e=new F("↑","",["ge-header-sorted-asc"]),t=new F("↓","",["ge-header-sorted-desc"]),s=new F("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class qe{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,s,o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,l=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const c=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${c}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${o}`),l){const c=this.domService.createText(l);this.domService.appendChild(a,c)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:l,sideIdent:n,text:a="",treeArrow:c,tableOptions:d,checkedType:h=void 0,sortState:g}=e,S=d==null?void 0:d.treeOptions,b=d==null?void 0:d.showCheckboxWihoutExtraColumn,f=this.domService.createElement("div");this.domService.addClass(f,"ge-table-col-div"),b&&this.domService.addClass(f,"ge-with-checkbox"),this.domService.addClass(f,`ge-table-col-div-${s.index}`),this.domService.setAttribute(f,"data-col-index",`${s.index}`),this.domService.setAttribute(f,"data-row-index",`${o}`),this.domService.setAttribute(f,"data-area",`${l}`);const p=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(l==="body"&&n==="center"&&this.domService.addClass(f,`ge-table-column-${p}`),this.domService.setStyle(f,"display","clip"),this.domService.setStyle(f,"position","absolute"),this.domService.setStyle(f,"left",`${s.left}px`),this.domService.setStyle(f,"top",`${s.top}px`),this.domService.setStyle(f,"width",`${s.width}px`),this.domService.setStyle(f,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(f,"ge-table-col-tree"),this.addArrowDiv(f,c,S,o,i,l)),b&&i===0&&h&&this.addCheckboxToDiv(f,h,l,o),a){const u=c!=="none"&&i===0;this.addLabelDiv(f,a,u,o,i,l)}return g&&this.addSortedIcon(f,g,d==null?void 0:d.sortedOptions,i),this.domService.appendChild(t,f),f}addCheckboxToDiv(e,t,s,o){const i=this.domService.createElement("div"),l=t==="full"?"checked":"";return i.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=(l,e)=>l===e,te=Symbol("solid-proxy"),ue={equals:ke};let ye=we;const L=1,N=2,ve={owned:null,cleanups:null,context:null,owner:null};var R=null;let Z=null,pe=null,w=null,M=null,F=null,q=0;function Oe(l,e){const t=w,s=R,o=l.length===0,i=e===void 0?s:e,r=o?ve:{owned:null,cleanups:null,context:i?i.context:null,owner:i},n=o?l:()=>l(()=>W(()=>J(r)));R=r,w=null;try{return G(n,!0)}finally{w=t,R=s}}function se(l,e,t){const s=re(l,e,!1,L);H(s)}function Ie(l,e,t){ye=He;const s=re(l,e,!1,L);(!t||!t.render)&&(s.user=!0),F?F.push(s):H(s)}function Fe(l,e,t){t=t?Object.assign({},ue,t):ue;const s=re(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,H(s),$e.bind(s)}function W(l){if(!pe&&w===null)return l();const e=w;w=null;try{return l()}finally{w=e}}function Le(l){Ie(()=>W(l))}function $e(){if(this.sources&&this.state)if(this.state===L)H(this);else{const l=M;M=null,G(()=>j(this),!1),M=l}if(w){const l=this.observers?this.observers.length:0;w.sources?(w.sources.push(this),w.sourceSlots.push(l)):(w.sources=[this],w.sourceSlots=[l]),this.observers?(this.observers.push(w),this.observerSlots.push(w.sources.length-1)):(this.observers=[w],this.observerSlots=[w.sources.length-1])}return this.value}function Be(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&G(()=>{for(let o=0;o<l.observers.length;o+=1){const i=l.observers[o],r=Z&&Z.running;r&&Z.disposed.has(i),(r?!i.tState:!i.state)&&(i.pure?M.push(i):F.push(i),i.observers&&Ce(i)),r||(i.state=L)}if(M.length>1e6)throw M=[],new Error},!1)),e}function H(l){if(!l.fn)return;J(l);const e=q;Pe(l,l.value,e)}function Pe(l,e,t){let s;const o=R,i=w;w=R=l;try{s=l.fn(e)}catch(r){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(J),l.owned=null),l.updatedAt=t+1,xe(r)}finally{w=i,R=o}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Be(l,s):l.value=s,l.updatedAt=t)}function re(l,e,t,s=L,o){const i={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:R,context:R?R.context:null,pure:t};return R===null||R!==ve&&(R.owned?R.owned.push(i):R.owned=[i]),i}function z(l){if(l.state===0)return;if(l.state===N)return j(l);if(l.suspense&&W(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<q);)l.state&&e.push(l);for(let t=e.length-1;t>=0;t--)if(l=e[t],l.state===L)H(l);else if(l.state===N){const s=M;M=null,G(()=>j(l,e[0]),!1),M=s}}function G(l,e){if(M)return l();let t=!1;e||(M=[]),F?t=!0:F=[],q++;try{const s=l();return We(t),s}catch(s){t||(F=null),M=null,xe(s)}}function We(l){if(M&&(we(M),M=null),l)return;const e=F;F=null,e.length&&G(()=>ye(e),!1)}function we(l){for(let e=0;e<l.length;e++)z(l[e])}function He(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:z(s)}for(e=0;e<t;e++)z(l[e])}function j(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const o=s.state;o===L?s!==e&&(!s.updatedAt||s.updatedAt<q)&&z(s):o===N&&j(s,e)}}}function Ce(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=N,t.pure?M.push(t):F.push(t),t.observers&&Ce(t))}}function J(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),o=t.observers;if(o&&o.length){const i=o.pop(),r=t.observerSlots.pop();s<o.length&&(i.sourceSlots[r]=s,o[s]=i,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)J(l.owned[e]);l.owned=null}if(l.cleanups){for(e=l.cleanups.length-1;e>=0;e--)l.cleanups[e]();l.cleanups=null}l.state=0}function Ge(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function xe(l,e=R){throw Ge(l)}function V(){return!0}const _e={get(l,e,t){return e===te?t:l.get(e)},has(l,e){return e===te?!0:l.has(e)},set:V,deleteProperty:V,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:V,deleteProperty:V}},ownKeys(l){return l.keys()}};function ee(l){return(l=typeof l=="function"?l():l)?l:{}}function Ve(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function Ee(...l){let e=!1;for(let r=0;r<l.length;r++){const n=l[r];e=e||!!n&&te in n,l[r]=typeof n=="function"?(e=!0,Fe(n)):n}if(e)return new Proxy({get(r){for(let n=l.length-1;n>=0;n--){const a=ee(l[n])[r];if(a!==void 0)return a}},has(r){for(let n=l.length-1;n>=0;n--)if(r in ee(l[n]))return!0;return!1},keys(){const r=[];for(let n=0;n<l.length;n++)r.push(...Object.keys(ee(l[n])));return[...new Set(r)]}},_e);const t={},s=Object.create(null);for(let r=l.length-1;r>=0;r--){const n=l[r];if(!n)continue;const a=Object.getOwnPropertyNames(n);for(let c=a.length-1;c>=0;c--){const d=a[c];if(d==="__proto__"||d==="constructor")continue;const h=Object.getOwnPropertyDescriptor(n,d);if(!s[d])s[d]=h.get?{enumerable:!0,configurable:!0,get:Ve.bind(t[d]=[h.get.bind(n)])}:h.value!==void 0?h:void 0;else{const g=t[d];g&&(h.get?g.push(h.get.bind(n)):h.value!==void 0&&g.push(()=>h.value))}}}const o={},i=Object.keys(s);for(let r=i.length-1;r>=0;r--){const n=i[r],a=s[n];a&&a.get?Object.defineProperty(o,n,a):o[n]=a?a.value:void 0}return o}function Ne(l,e,t){let s=t.length,o=e.length,i=s,r=0,n=0,a=e[o-1].nextSibling,c=null;for(;r<o||n<i;){if(e[r]===t[n]){r++,n++;continue}for(;e[o-1]===t[i-1];)o--,i--;if(o===r){const d=i<s?n?t[n-1].nextSibling:t[i-n]:a;for(;n<i;)l.insertBefore(t[n++],d)}else if(i===n)for(;r<o;)(!c||!c.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[i-1]&&t[n]===e[o-1]){const d=e[--o].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--i],d),e[o]=t[i]}else{if(!c){c=new Map;let h=n;for(;h<i;)c.set(t[h],h++)}const d=c.get(e[r]);if(d!=null)if(n<d&&d<i){let h=r,g=1,S;for(;++h<o&&h<i&&!((S=c.get(e[h]))==null||S!==d+g);)g++;if(g>d-n){const b=e[r];for(;n<d;)l.insertBefore(t[n++],b)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function ze(l,e,t,s={}){let o;return Oe(i=>{o=i,e===document?l():Ke(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{o(),e.textContent=""}}function je(l,e,t){let s;const o=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},i=e?()=>W(()=>document.importNode(s||(s=o()),!0)):()=>(s||(s=o())).cloneNode(!0);return i.cloneNode=i,i}function Xe(l,e,t){return W(()=>l(e,t))}function Ke(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return X(l,e,s,t);se(o=>X(l,e(),o,t),s)}function X(l,e,t,s,o){for(;typeof t=="function";)t=t();if(e===t)return t;const i=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,i==="string"||i==="number")if(i==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?n.data!==e&&(n.data=e):n=document.createTextNode(e),t=B(l,t,s,n)}else t!==""&&typeof t=="string"?t=l.firstChild.data=e:t=l.textContent=e;else if(e==null||i==="boolean")t=B(l,t,s);else{if(i==="function")return se(()=>{let n=e();for(;typeof n=="function";)n=n();t=X(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(oe(n,e,t,o))return se(()=>t=X(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=B(l,t,s),r)return t}else a?t.length===0?be(l,n,s):Ne(l,t,n):(t&&B(l),be(l,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(r)return t=B(l,t,s,e);B(l,t,null,e)}else t==null||t===""||!l.firstChild?l.appendChild(e):l.replaceChild(e,l.firstChild);t=e}}return t}function oe(l,e,t,s){let o=!1;for(let i=0,r=e.length;i<r;i++){let n=e[i],a=t&&t[i],c;if(!(n==null||n===!0||n===!1))if((c=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))o=oe(l,n,a)||o;else if(c==="function")if(s){for(;typeof n=="function";)n=n();o=oe(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||o}else l.push(n),o=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return o}function be(l,e,t=null){for(let s=0,o=e.length;s<o;s++)l.insertBefore(e[s],t)}function B(l,e,t,s){if(t===void 0)return l.textContent="";const o=s||document.createTextNode("");if(e.length){let i=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(o!==n){const a=n.parentNode===l;!i&&!r?a?l.replaceChild(o,n):l.insertBefore(o,t):a&&n.remove()}else i=!0}}else l.insertBefore(o,t);return[o]}class Ye{constructor(e){this.code=e}render(e,t,s,o,i,r,n){const a=Ee({rowIndex:t,columnIndex:s,areaIdent:o,areaModel:i,cellValue:r});ze(()=>this.code(a),e)}}const Ue=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class ${constructor(){this.alreadySet=!1}static getInstance(){return $.instance||($.instance=new $),$.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function ie(l){return l&&l.type==="TreeRow"}function le(l){return l&&l.type==="AreaModelTree"}class ne{constructor(e=-1,t=-1,s=-1,o=-1,i,r,n,a=0,c=0,d=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=c,this.draggingY=d,this.action=h}clone(){return new ne(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class I{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Ae{constructor(e=new I(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new I(">","",["ge-table-tree-arrow-collapsed"]),s=new I(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new I("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Me{constructor(e=new I("↑","",["ge-header-sorted-asc"]),t=new I("↓","",["ge-header-sorted-desc"]),s=new I("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class qe{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,s,o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,r=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const c=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${c}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${o}`),r){const c=this.domService.createText(r);this.domService.appendChild(a,c)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:r,sideIdent:n,text:a="",treeArrow:c,tableOptions:d,checkedType:h=void 0,sortState:g}=e,S=d==null?void 0:d.treeOptions,b=d==null?void 0:d.showCheckboxWihoutExtraColumn,f=this.domService.createElement("div");this.domService.addClass(f,"ge-table-col-div"),b&&this.domService.addClass(f,"ge-with-checkbox"),this.domService.addClass(f,`ge-table-col-div-${s.index}`),this.domService.setAttribute(f,"data-col-index",`${s.index}`),this.domService.setAttribute(f,"data-row-index",`${o}`),this.domService.setAttribute(f,"data-area",`${r}`);const p=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(r==="body"&&n==="center"&&this.domService.addClass(f,`ge-table-column-${p}`),this.domService.setStyle(f,"display","clip"),this.domService.setStyle(f,"position","absolute"),this.domService.setStyle(f,"left",`${s.left}px`),this.domService.setStyle(f,"top",`${s.top}px`),this.domService.setStyle(f,"width",`${s.width}px`),this.domService.setStyle(f,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(f,"ge-table-col-tree"),this.addArrowDiv(f,c,S,o,i,r)),b&&i===0&&h&&this.addCheckboxToDiv(f,h,r,o),a){const u=c!=="none"&&i===0;this.addLabelDiv(f,a,u,o,i,r)}return g&&this.addSortedIcon(f,g,d==null?void 0:d.sortedOptions,i),this.domService.appendChild(t,f),f}addCheckboxToDiv(e,t,s,o){const i=this.domService.createElement("div"),r=t==="full"?"checked":"";return i.innerHTML=`
2
2
  <input
3
3
  type="checkbox"
4
4
  data-area="${s}"
5
5
  data-row-index="${o}"
6
6
  data-input-type="checkbox"
7
- ${l}
8
- class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${o}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",s=!1,o=-1,i=-1,l="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${l}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(n,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(n,a);const c=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,c),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${l}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Me,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let l;t==="asc"?l=s.iconAsc:t==="desc"?l=s.iconDesc:l=s.iconPlaceholder;const n=l.content,a=this.domService.createText(n);this.domService.appendChild(i,a),l.style&&this.applyStyleString(i,l.style);for(const c of l.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Ae,o=-1,i=-1,l="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${l}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const c=a.content,d=this.domService.createText(c);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const h of a.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const l=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,l)}if(e.horizontalBorderVisible){const l=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,l)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};let o=this.domService.createElement("div");return this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left+t.width-1}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top+t.height-1}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,l]=o.split(":");this.domService.setStyle(e,i.trim(),l.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const ae=r=>r==="header"?"header":r==="footer"?"footer":"body";class Je{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=ae(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class Qe{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const s=new Je(e.target,this.tableScope);if(s.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(s.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(s),e.preventDefault(),e.stopPropagation();else if(s.inputType==="checkbox"&&s.areaIdent)this.tableScope.toggleRowCheckbox(s.rowIdx,s.colIdx,s.areaIdent),e.preventDefault(),e.stopPropagation();else if(ie(s.row)&&s.areaModel){const o=s.colIdx===this.getArrowColumnIndex()&&e.altKey,i=s.className.includes("ge-table-tree-arrow-div");if(o||i){e.preventDefault(),e.stopPropagation();const l=s.row;l.expanded=!l.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(l)}}if(s.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const o=this.tableScope.tableOptions.getFocusModel();o==null||o.clear(),o==null||o.setFocus(s.rowIdx,s.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),o=ae(s),i=Number(t.getAttribute("data-row-index")),l=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(l)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,l));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(i);if(s&&o==="body"&&n.isEditable(i,l)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,l)),ie(a)&&l===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const c=a;c.expanded=!c.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(c)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var s,o,i,l,n;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const a=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,c=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,h=t(e.data);c?(l=this.tableScope.storeStateCollapsedExpandService)==null||l.collapsedStateIdsPush(h):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Ze{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class de{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const o of[...s]){const[i,l]=o;t[i]=l}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const l=this.autoConvertMapToObject(t);this.persistItem(i,l)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class et extends de{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class tt{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class st extends de{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new tt,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class ot extends de{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class O{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}class it{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class A{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class rt{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),l=this.areaModel.getRowspanAt(s,o);if(i>1||l>1){i===0&&(i=1),l===0&&(l=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(s,o,s+l-1,o+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class lt{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class nt extends it{constructor(e,t,s,o){var l,n;super(e,t,s,o),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new lt,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(l=this.tableOptions)!=null&&l.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),re(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var c;this.colAndRowspanModels[a]=new rt(t,t.getAreaModel(a)),(c=this.colAndRowspanModels[a])==null||c.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const l=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(n);if(a){let c;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s?this.editorRenderer:l.getCellRenderer(t,s);if(a.innerText="",this.applyCssClasses(a,i),h)c=h.render(a,t,s,e,l,o,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const b=`${o}`;this.dom.addLabelDiv(a,b,!1,t,s,e)}const g=l.getCustomClassesAt(t,s);g.length&&this.dom.addClasses(g,a);const S=l.getCustomStyleAt(t,s);if(S)for(const b in S)this.dom.setStyle(a,b,S[b])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var p;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),l=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),h=d.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let g=t;const S=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<h;u++){const v=g,C=u===h-1,E=this.tableModel.getRowHeight(e,u);if(v+E>0){this.firstVisibleRowIndex=u;let y={left:n,width:a,height:E,top:v,index:u},m=this.dom.addRowDiv(o,y,u,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:k,columnIndexEnd:S-b-1,verticalFixed:!1,lastRowOfModel:C}),c.left>0&&(y={left:n,width:this.areaBodyWestGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(s,y,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:C})),c.right>0&&(y={left:n,width:this.areaBodyEastGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(i,y,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:S-b,columnIndexEnd:S-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&u===h-1){const T=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),D=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(D){const _=this.dom.domService.createText(D.content);this.dom.domService.appendChild(T,_),D.style&&this.dom.applyStyleString(T,D.style)}}}if(g=g+E,g>l)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((p=this.colAndRowspanModels[e])==null?void 0:p.getRanges())??[];if(u.length)for(const v of u){let C=0,E=o.child,y="center";if(v.c1<f)E=s.child,y="west";else if(b>0&&v.c1>=S-b)E=i.child,y="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*m-this.areaBodyWestGeo.width,y="center"}this.drawBigCell(v,C,t,d,E,y)}}}drawBigCell(e,t,s,o,i,l){const n=s+this.getRowHeights(0,e.r1-1,o).reduce((p,u)=>p+u,0),a=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let d=0;c>0&&e.c1>=a-c&&(d=a-c);const h=t+this.getColumnWidths(d,e.c1-1).reduce((p,u)=>p+u,0),g=this.getRowHeights(e.r1,e.r2,o).reduce((p,u)=>p+u,0),S=this.getColumnWidths(e.c1,e.c2).reduce((p,u)=>p+u,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:l,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:S,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:l,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:S,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:S,cellHeight:g,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const l=e.getRowspanAt(i,s);if(l>1&&i+l+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:l,columnIndexStart:n,columnIndexEnd:a,verticalFixed:c=!1,lastRowOfModel:d=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!c){const p=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*p}const g=0,S=!!(e==="body"&&t);let b=h;for(let p=n;p<=a;p++){const u=b,v=this.tableModel.getColumnWidth(p);if(v>0&&u+v>0){let C=o.height;const E=s.getRowspanAt(l,p),y=s.getColspanAt(l,p);E>1&&(C=this.getRowHeights(l,l+E-1,s).reduce((T,D)=>T+D,0));let m=v;y>1&&(m=this.getColumnWidths(p,p+y-1).reduce((T,D)=>T+D,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(l,p)&&(k=!0),this.draggingTargetColumnIndex===p&&e!=="header"){this.renderDragTargetDiv(i,u,g,m,C);const T={left:u,top:g,width:m,height:C};this.dom.addColumnBorderDivs(this.tableOptions,i,T,e,t)}else{const T=this.renderSelectedBackgroundDiv(k,S,t,s,l,p,i,u,g,m,C);"gammaCells"in s&&s.getValueAt(l,p)&&(k=!1),k||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:l,columnIndex:p,left:u,top:g,width:m,height:C,parent:i,cellSelected:T,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:l,columnIndex:p,cellLeft:u,cellTop:g,cellWidth:m,cellHeight:C,parent:i})}}if(b=b+v,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(b-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:l,width:n,height:a,top:c,parent:d,lastRowOfModel:h}){var ge;const S=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),b={left:l,width:n,height:a,top:c,index:i},f=e.getRowByIndex(o);let p="none";if(i===this.getTreeArrowColumnIndex()&&ie(f)){const x=f;(ge=x.children)!=null&&ge.length?x.expanded?p="expanded":p="collapsed":p="hidden"}let v;if(t==="header"){const x=this.tableModel.getColumnDef(i);(!(x!=null&&x.sortIconVisible)||x!=null&&x.sortIconVisible())&&(v=x==null?void 0:x.sortState)}const C=e.getValueAt(o,i),E=S?"":`${C}`,y=e.isRowChecked(o),m=this.dom.addColumnDiv({parent:d,geo:b,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:E,treeArrow:p,tableOptions:this.tableOptions,checkedType:y,sortState:v}),k=e.getTooltipAt(o,i);k&&this.dom.setAttribute(m,"title",k);const T=this.tableModel.getColumnDef(i);T&&T.classes[t]&&this.dom.addClasses(T.classes[t],m);let D;S&&(D=S.render(m,o,i,t,e,C,this.dom.domService));const _=e.getCustomClassesAt(o,i);if(_.length&&this.dom.addClasses(_,m),this.dom.addColumnBorderDivs(this.tableOptions,d,b,t,s),h&&this.dom.addHorizontalBorder({left:l,width:n,height:a,top:c+a},d),this.getFocusModel&&t==="body"){const x=this.getFocusModel();x!=null&&x.hasFocus(o,i)&&this.dom.addFocusBorderDivs(d,b,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const Q=e.getCustomStyleAt(o,i);if(Q)for(const x in Q)this.dom.setStyle(m,x,Q[x]);return[m,D]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:o+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-o;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const l=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((o=e.originalEvent)!=null&&o.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:l,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),s&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,s=0){const o="center",i=this.tableModel.getAreaModel(t),l=i==null?void 0:i.getRowCount();if(l){const n=e.index??0,a=this.draggingColumn;for(let c=0;c<l;c++){const d=s,h=i.getRowHeight(c),g={left:0,width:e.width,height:h,top:d,index:c},S=i.getValueAt(c,n),b=i.getCellRenderer(c,n),f=b?"":`${S}`,p={parent:a,geo:g,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:o,text:f},u=this.dom.addColumnDiv(p);let v;b&&(v=b.render(u,c,n,t,i,S,this.dom.domService),v&&this.cleanupFunctions[t].push(v));const C=i.getCustomClassesAt(c,n);C.length&&this.dom.addClasses(C,u);const E=this.tableModel.getColumnDef(n);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],u),this.dom.addColumnBorderDivs(this.tableOptions,a,g,t,o);const y=i.getCustomStyleAt(c,n);if(y)for(const m in y)this.dom.setStyle(u,m,y[m]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const l=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(l,"left",`${t}px`),this.dom.setStyle(l,"top",`${s}px`),this.dom.setStyle(l,"width",`${o}px`),this.dom.setStyle(l,"height",`${i}px`),l}renderSelectedBackgroundDiv(e,t,s,o,i,l,n,a,c,d,h){let g=!1;if(!e&&t&&o.isSelectable(i,l)&&this.getSelectionModel){const S=this.getSelectionModel();if(S){const b=S.getSelectionCount(i,l);g=b>0;for(let f=0;f<b;f++){const p=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(p,"left",`${a}px`),this.dom.setStyle(p,"top",`${c}px`),this.dom.setStyle(p,"width",`${d}px`),this.dom.setStyle(p,"height",`${h}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:l,top:n,width:a,height:c,parent:d,cellSelected:h,lastRowOfModel:g}){const[S,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:l,width:a,height:c,top:n,parent:d,lastRowOfModel:g});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,S),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:l,parent:n}){const a=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,d=a.createElement("div");a.setAttribute(d,"data-col-index",`${t}`),a.setAttribute(d,"data-row-index",`${e}`),a.setAttribute(d,"data-area","header"),a.setAttribute(d,"data-ge-action","resize-column"),a.addClass(d,"ge-table-column-resize-handle"),a.setStyle(d,"display","clip"),a.setStyle(d,"position","absolute"),a.setStyle(d,"cursor","col-resize"),a.setStyle(d,"left",`${s+i-c}px`),a.setStyle(d,"top",`${o}px`),a.setStyle(d,"width",`${c}px`),a.setStyle(d,"height",`${l}px`),a.appendChild(n,d)}}class at{constructor(e,t){this.columnIndex=e,this.sortState=t}}class dt{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const l=ae(s),n=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(l,n,a,t.value)}}}}class ct{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class ce{constructor(e){this.cells=e}static createSingle(e,t){return new ce([new ct(e,t)])}}class ht{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,l,n,a,c,d,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),S=this.getFocusModel();g&&S&&(S.hasFocus(e.rowIndex,e.columnIndex)||(S.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(S),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||g.hasSelection()&&(g.clear(),s=!0),(l=e.originalEvent)!=null&&l.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(n=e.originalEvent)!=null&&n.altKey&&((a=e.originalEvent)!=null&&a.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(g.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(g.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(g.firstClick(e.rowIndex,e.columnIndex),s=!0),this.tableScope.onSelectionChanged(g))}return o?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[o,i]=s.getFocus();return t.togglePoint(o,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),l=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:l})}}class gt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ut{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class pt{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ut().get()):Object.assign(this.shortcutActionIdMapping,new gt().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const s in this.shortcutActionIdMapping){const o=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,o))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class fe{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Re{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class bt{render(e,t,s,o,i,l,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=i.getValueAt(t,s);e.innerHTML=`
7
+ ${r}
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${o}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",s=!1,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(n,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(n,a);const c=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,c),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Me,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const n=r.content,a=this.domService.createText(n);this.domService.appendChild(i,a),r.style&&this.applyStyleString(i,r.style);for(const c of r.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Ae,o=-1,i=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const c=a.content,d=this.domService.createText(c);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const h of a.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const r=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};let o=this.domService.createElement("div");return this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left+t.width-1}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top+t.height-1}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,r]=o.split(":");this.domService.setStyle(e,i.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const ae=l=>l==="header"?"header":l==="footer"?"footer":"body";class Je{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=ae(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class Qe{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const s=new Je(e.target,this.tableScope);if(s.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(s.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(s),e.preventDefault(),e.stopPropagation();else if(s.inputType==="checkbox"&&s.areaIdent)this.tableScope.toggleRowCheckbox(s.rowIdx,s.colIdx,s.areaIdent),e.preventDefault(),e.stopPropagation();else if(ie(s.row)&&s.areaModel){const o=s.colIdx===this.getArrowColumnIndex()&&e.altKey,i=s.className.includes("ge-table-tree-arrow-div");if(o||i){e.preventDefault(),e.stopPropagation();const r=s.row;r.expanded=!r.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(r)}}if(s.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const o=this.tableScope.tableOptions.getFocusModel();o==null||o.clear(),o==null||o.setFocus(s.rowIdx,s.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),o=ae(s),i=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,r));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(i);if(s&&o==="body"&&n.isEditable(i,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,r)),ie(a)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const c=a;c.expanded=!c.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(c)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var s,o,i,r,n;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const a=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,c=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,h=t(e.data);c?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(h):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Ze{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}recalcColumnWidths(e){this.tableScope.recalcColumnWidths(e)}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class de{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const o of[...s]){const[i,r]=o;t[i]=r}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(i,r)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class et extends de{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class tt{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class st extends de{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new tt,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class ot extends de{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class O{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}class it{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class A{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class lt{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),r=this.areaModel.getRowspanAt(s,o);if(i>1||r>1){i===0&&(i=1),r===0&&(r=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(s,o,s+r-1,o+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class rt{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class nt extends it{constructor(e,t,s,o){var r,n;super(e,t,s,o),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new rt,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),le(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var c;this.colAndRowspanModels[a]=new lt(t,t.getAreaModel(a)),(c=this.colAndRowspanModels[a])==null||c.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}recalcColumnWidths(e){let t=e||this.scrollViewport.clientWidth;this.tableModel.setParentWidth(t),this.tableModel.init(),this.repaintHard()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(n);if(a){let c;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s?this.editorRenderer:r.getCellRenderer(t,s);if(a.innerText="",this.applyCssClasses(a,i),h)c=h.render(a,t,s,e,r,o,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const b=`${o}`;this.dom.addLabelDiv(a,b,!1,t,s,e)}const g=r.getCustomClassesAt(t,s);g.length&&this.dom.addClasses(g,a);const S=r.getCustomStyleAt(t,s);if(S)for(const b in S)this.dom.setStyle(a,b,S[b])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var p;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),r=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),h=d.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let g=t;const S=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),f=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<h;u++){const v=g,C=u===h-1,E=this.tableModel.getRowHeight(e,u);if(v+E>0){this.firstVisibleRowIndex=u;let y={left:n,width:a,height:E,top:v,index:u},m=this.dom.addRowDiv(o,y,u,e,"center");const k=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:k,columnIndexEnd:S-b-1,verticalFixed:!1,lastRowOfModel:C}),c.left>0&&(y={left:n,width:this.areaBodyWestGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(s,y,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:C})),c.right>0&&(y={left:n,width:this.areaBodyEastGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(i,y,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:S-b,columnIndexEnd:S-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&u===h-1){const T=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),D=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(D){const _=this.dom.domService.createText(D.content);this.dom.domService.appendChild(T,_),D.style&&this.dom.applyStyleString(T,D.style)}}}if(g=g+E,g>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((p=this.colAndRowspanModels[e])==null?void 0:p.getRanges())??[];if(u.length)for(const v of u){let C=0,E=o.child,y="center";if(v.c1<f)E=s.child,y="west";else if(b>0&&v.c1>=S-b)E=i.child,y="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*m-this.areaBodyWestGeo.width,y="center"}this.drawBigCell(v,C,t,d,E,y)}}}drawBigCell(e,t,s,o,i,r){const n=s+this.getRowHeights(0,e.r1-1,o).reduce((p,u)=>p+u,0),a=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let d=0;c>0&&e.c1>=a-c&&(d=a-c);const h=t+this.getColumnWidths(d,e.c1-1).reduce((p,u)=>p+u,0),g=this.getRowHeights(e.r1,e.r2,o).reduce((p,u)=>p+u,0),S=this.getColumnWidths(e.c1,e.c2).reduce((p,u)=>p+u,0);let b=!1;const f=this.getSelectionModel?this.getSelectionModel():void 0;f&&(b=f.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:S,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:S,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:S,cellHeight:g,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const r=e.getRowspanAt(i,s);if(r>1&&i+r+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:r,columnIndexStart:n,columnIndexEnd:a,verticalFixed:c=!1,lastRowOfModel:d=!1}){var f;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!c){const p=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*p}const g=0,S=!!(e==="body"&&t);let b=h;for(let p=n;p<=a;p++){const u=b,v=this.tableModel.getColumnWidth(p);if(v>0&&u+v>0){let C=o.height;const E=s.getRowspanAt(r,p),y=s.getColspanAt(r,p);E>1&&(C=this.getRowHeights(r,r+E-1,s).reduce((T,D)=>T+D,0));let m=v;y>1&&(m=this.getColumnWidths(p,p+y-1).reduce((T,D)=>T+D,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,p)&&(k=!0),this.draggingTargetColumnIndex===p&&e!=="header"){this.renderDragTargetDiv(i,u,g,m,C);const T={left:u,top:g,width:m,height:C};this.dom.addColumnBorderDivs(this.tableOptions,i,T,e,t)}else{const T=this.renderSelectedBackgroundDiv(k,S,t,s,r,p,i,u,g,m,C);"gammaCells"in s&&s.getValueAt(r,p)&&(k=!1),k||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:p,left:u,top:g,width:m,height:C,parent:i,cellSelected:T,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:p,cellLeft:u,cellTop:g,cellWidth:m,cellHeight:C,parent:i})}}if(b=b+v,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(b-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:n,height:a,top:c,parent:d,lastRowOfModel:h}){var ge;const S=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),b={left:r,width:n,height:a,top:c,index:i},f=e.getRowByIndex(o);let p="none";if(i===this.getTreeArrowColumnIndex()&&ie(f)){const x=f;(ge=x.children)!=null&&ge.length?x.expanded?p="expanded":p="collapsed":p="hidden"}let v;if(t==="header"){const x=this.tableModel.getColumnDef(i);(!(x!=null&&x.sortIconVisible)||x!=null&&x.sortIconVisible())&&(v=x==null?void 0:x.sortState)}const C=e.getValueAt(o,i),E=S?"":`${C}`,y=e.isRowChecked(o),m=this.dom.addColumnDiv({parent:d,geo:b,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:E,treeArrow:p,tableOptions:this.tableOptions,checkedType:y,sortState:v}),k=e.getTooltipAt(o,i);k&&this.dom.setAttribute(m,"title",k);const T=this.tableModel.getColumnDef(i);T&&T.classes[t]&&this.dom.addClasses(T.classes[t],m);let D;S&&(D=S.render(m,o,i,t,e,C,this.dom.domService));const _=e.getCustomClassesAt(o,i);if(_.length&&this.dom.addClasses(_,m),this.dom.addColumnBorderDivs(this.tableOptions,d,b,t,s),h&&this.dom.addHorizontalBorder({left:r,width:n,height:a,top:c+a},d),this.getFocusModel&&t==="body"){const x=this.getFocusModel();x!=null&&x.hasFocus(o,i)&&this.dom.addFocusBorderDivs(d,b,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const Q=e.getCustomStyleAt(o,i);if(Q)for(const x in Q)this.dom.setStyle(m,x,Q[x]);return[m,D]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:o+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-o;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const r=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((o=e.originalEvent)!=null&&o.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:r,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),s&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,s=0){const o="center",i=this.tableModel.getAreaModel(t),r=i==null?void 0:i.getRowCount();if(r){const n=e.index??0,a=this.draggingColumn;for(let c=0;c<r;c++){const d=s,h=i.getRowHeight(c),g={left:0,width:e.width,height:h,top:d,index:c},S=i.getValueAt(c,n),b=i.getCellRenderer(c,n),f=b?"":`${S}`,p={parent:a,geo:g,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:o,text:f},u=this.dom.addColumnDiv(p);let v;b&&(v=b.render(u,c,n,t,i,S,this.dom.domService),v&&this.cleanupFunctions[t].push(v));const C=i.getCustomClassesAt(c,n);C.length&&this.dom.addClasses(C,u);const E=this.tableModel.getColumnDef(n);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],u),this.dom.addColumnBorderDivs(this.tableOptions,a,g,t,o);const y=i.getCustomStyleAt(c,n);if(y)for(const m in y)this.dom.setStyle(u,m,y[m]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${o}px`),this.dom.setStyle(r,"height",`${i}px`),r}renderSelectedBackgroundDiv(e,t,s,o,i,r,n,a,c,d,h){let g=!1;if(!e&&t&&o.isSelectable(i,r)&&this.getSelectionModel){const S=this.getSelectionModel();if(S){const b=S.getSelectionCount(i,r);g=b>0;for(let f=0;f<b;f++){const p=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(p,"left",`${a}px`),this.dom.setStyle(p,"top",`${c}px`),this.dom.setStyle(p,"width",`${d}px`),this.dom.setStyle(p,"height",`${h}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:r,top:n,width:a,height:c,parent:d,cellSelected:h,lastRowOfModel:g}){const[S,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:r,width:a,height:c,top:n,parent:d,lastRowOfModel:g});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,S),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:r,parent:n}){const a=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,d=a.createElement("div");a.setAttribute(d,"data-col-index",`${t}`),a.setAttribute(d,"data-row-index",`${e}`),a.setAttribute(d,"data-area","header"),a.setAttribute(d,"data-ge-action","resize-column"),a.addClass(d,"ge-table-column-resize-handle"),a.setStyle(d,"display","clip"),a.setStyle(d,"position","absolute"),a.setStyle(d,"cursor","col-resize"),a.setStyle(d,"left",`${s+i-c}px`),a.setStyle(d,"top",`${o}px`),a.setStyle(d,"width",`${c}px`),a.setStyle(d,"height",`${r}px`),a.appendChild(n,d)}}class at{constructor(e,t){this.columnIndex=e,this.sortState=t}}class dt{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const r=ae(s),n=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(r,n,a,t.value)}}}}class ct{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class ce{constructor(e){this.cells=e}static createSingle(e,t){return new ce([new ct(e,t)])}}class ht{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,r,n,a,c,d,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),S=this.getFocusModel();g&&S&&(S.hasFocus(e.rowIndex,e.columnIndex)||(S.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(S),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||g.hasSelection()&&(g.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(n=e.originalEvent)!=null&&n.altKey&&((a=e.originalEvent)!=null&&a.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(g.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(g.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(g.firstClick(e.rowIndex,e.columnIndex),s=!0),this.tableScope.onSelectionChanged(g))}return o?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[o,i]=s.getFocus();return t.togglePoint(o,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:r})}}class gt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ut{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class pt{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new ut().get()):Object.assign(this.shortcutActionIdMapping,new gt().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const s in this.shortcutActionIdMapping){const o=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,o))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class fe{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Re{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class bt{render(e,t,s,o,i,r,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=i.getValueAt(t,s);e.innerHTML=`
9
9
  <input
10
10
  type="text"
11
11
  value="${a}"
@@ -17,8 +17,8 @@
17
17
  data-col-index="${s}"
18
18
  data-input-type="text"
19
19
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
20
- class="ge-table-cell-editor-input">`}}}class ft{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(A.singleRow(e)):this.selectionType==="column"&&this.addRange(A.singleColumn(t))}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(){const e=new Set;for(const t of this.ranges)for(let s=t.r1;s<=t.r2;s++)!e.has(s)&&!this.isInNegativeRange(s,0)&&e.add(s);return Array.from(e)}selectAll(){this.allSelected=!0,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=A.singleRow(e.r1):this.selectionType==="column"&&(t=A.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.addSelection(A.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e),this.fireChangeEvent())}}class St{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class Te{constructor(e=new F("❯","",["gt-table-icon-expanded"]),t=new F("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const mt=new ft,yt=new St("cell");class De{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Ae,this.headerGroupOptions=new Te,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Me,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new bt,this.getSelectionModel=()=>mt,this.getFocusModel=()=>yt}}const P=class P{createContent(e,t,s){return new Promise((o,i)=>{if(t!=null&&t.hasSelection()){const l=this.mergeRanges(t.getRanges());if(l){l.c2=Math.min(l.c2,e.getColumnCount()-1),l.r2=Math.min(l.r2,e.getBodyModel().getRowCount()-1);const n=[];for(let a=l.r1;a<=l.r2;a++){const c=[];for(let d=l.c1;d<=l.c2;d++){const h=t.isSelected(a,d)?e.getBodyModel().getTextValueAt(a,d):"";c.push(h)}n.push(c.join(P.columnSeparatorChar))}return o(n.join(P.rowSeparatorChar))}}if(s){const[l,n]=s.getFocus(),a=e.getBodyModel().getTextValueAt(l,n);return o(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(l=>{l&&this.copyContent(l).then(n=>{o(l)}).catch(n=>{i()})}).catch(l=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new A(s.r1,s.c1,s.r2,s.c2);return t}};P.columnSeparatorChar=" ",P.rowSeparatorChar=`
21
- `;let K=P;class he extends nt{constructor(e,t,s,o,i,l=new K){var c;if(super(e,t,new qe(s),o),this.eventListener=i,this.copyService=l,this.licenseManager=$.getInstance(),this.selectionService=new ht(this),this.api=new Ze(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,i||(this.eventListener=new fe),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const d=this.tableOptions.autoRestoreOptions,h=d.getStorageKeyFn;h&&(d.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new et(h)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new st(h)),d.autoRestoreSortingState&&(this.storeSortingService=new ot(h)))}this.mouseHandler=new Qe(this),this.inputHandler=new dt(this),this.shortcutService=new pt(this),this.shortcutService.addListener(this.selectionService);const n=this.getSelectionModel?this.getSelectionModel():void 0;n&&n.addEventSelectionChangedListener(this);const a=this.getFocusModel?this.getFocusModel():void 0;a&&a.addEventFocusChangedListener(this)}static create(e,t,s=new De,o=new fe,i=new Re,l=new K){return new he(e,t,i,s,o,l)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[s,o]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,o)&&(this.clearSelection(),this.initRenderEditor(s,o))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,s=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,s).then(o=>this.copyService.copyContent(o))}return!1}updateModelValueAfterEdit(e,t,s,o){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(ce.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new ne;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const o=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,o)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();re(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),l=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,l),this.repaint();const n=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,s){var i,l;const o=this.tableModel.getColumnDef(s);if(o!=null&&o.sortable&&o.sortable()){e.preventDefault(),e.stopPropagation();const n=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,a=o.sortState??"",c=n[(n.indexOf(a)+1)%n.length],d=new at(s,c);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(g=>g.sortState=""),o.sortState=c),this.repaint(),(l=this.storeSortingService)==null||l.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,o)}setSelectionModel(e,t=!1){const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[o,i]=s.getFocus();return s.setFocus(o+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,o=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&o){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),l=this.tableModel.getAreaModel("body");if(re(l)){const n=l,a=l.getRowCount();for(let c=0;c<a;c++){const d=l.getRowByIndex(c);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const h=o(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}}const Y=class Y{};Y.themes=["light","combat","paper","blackboard"],Y.vars={light:`html[data-theme="light"] {
20
+ class="ge-table-cell-editor-input">`}}}class ft{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.silent=!1,this.listenerArr=[]}getEventSelectionChangedListeners(){return this.listenerArr}addEventSelectionChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventSelectionChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.silent||this.listenerArr.forEach(e=>e.onSelectionChanged(this))}firstClick(e,t){this.selectionType==="row"?this.addRange(A.singleRow(e)):this.selectionType==="column"&&this.addRange(A.singleColumn(t))}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1,this.fireChangeEvent()}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(){const e=new Set;for(const t of this.ranges)for(let s=t.r1;s<=t.r2;s++)!e.has(s)&&!this.isInNegativeRange(s,0)&&e.add(s);return Array.from(e)}selectAll(){this.allSelected=!0,this.fireChangeEvent()}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e),this.fireChangeEvent()}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=A.singleRow(e.r1):this.selectionType==="column"&&(t=A.singleColumn(e.c1)),this.negativeRanges.push(t),this.fireChangeEvent()}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.addSelection(A.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e),this.fireChangeEvent())}}class St{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1,this.listenerArr=[]}getEventFocusChangedListeners(){return this.listenerArr}addEventFocusChangedListener(e){this.listenerArr.includes(e)||this.listenerArr.push(e)}removeEventFocusChangedListener(e){const t=this.listenerArr.indexOf(e,0);t>-1&&this.listenerArr.splice(t,1)}fireChangeEvent(){this.listenerArr.forEach(e=>e.onFocusChanged(this))}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1,this.fireChangeEvent()}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0,this.fireChangeEvent())}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class Te{constructor(e=new I("❯","",["gt-table-icon-expanded"]),t=new I("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const mt=new ft,yt=new St("cell");class De{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Ae,this.headerGroupOptions=new Te,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Me,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new bt,this.getSelectionModel=()=>mt,this.getFocusModel=()=>yt}}const P=class P{createContent(e,t,s){return new Promise((o,i)=>{if(t!=null&&t.hasSelection()){const r=this.mergeRanges(t.getRanges());if(r){r.c2=Math.min(r.c2,e.getColumnCount()-1),r.r2=Math.min(r.r2,e.getBodyModel().getRowCount()-1);const n=[];for(let a=r.r1;a<=r.r2;a++){const c=[];for(let d=r.c1;d<=r.c2;d++){const h=t.isSelected(a,d)?e.getBodyModel().getTextValueAt(a,d):"";c.push(h)}n.push(c.join(P.columnSeparatorChar))}return o(n.join(P.rowSeparatorChar))}}if(s){const[r,n]=s.getFocus(),a=e.getBodyModel().getTextValueAt(r,n);return o(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(r=>{r&&this.copyContent(r).then(n=>{o(r)}).catch(n=>{i()})}).catch(r=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new A(s.r1,s.c1,s.r2,s.c2);return t}};P.columnSeparatorChar=" ",P.rowSeparatorChar=`
21
+ `;let K=P;class he extends nt{constructor(e,t,s,o,i,r=new K){var c;if(super(e,t,new qe(s),o),this.eventListener=i,this.copyService=r,this.licenseManager=$.getInstance(),this.selectionService=new ht(this),this.api=new Ze(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,i||(this.eventListener=new fe),(c=this.tableOptions)!=null&&c.autoRestoreOptions){const d=this.tableOptions.autoRestoreOptions,h=d.getStorageKeyFn;h&&(d.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new et(h)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new st(h)),d.autoRestoreSortingState&&(this.storeSortingService=new ot(h)))}this.mouseHandler=new Qe(this),this.inputHandler=new dt(this),this.shortcutService=new pt(this),this.shortcutService.addListener(this.selectionService);const n=this.getSelectionModel?this.getSelectionModel():void 0;n&&n.addEventSelectionChangedListener(this);const a=this.getFocusModel?this.getFocusModel():void 0;a&&a.addEventFocusChangedListener(this)}static create(e,t,s=new De,o=new fe,i=new Re,r=new K){return new he(e,t,i,s,o,r)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[s,o]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,o)&&(this.clearSelection(),this.initRenderEditor(s,o))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,s=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,s).then(o=>this.copyService.copyContent(o))}return!1}updateModelValueAfterEdit(e,t,s,o){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(ce.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new ne;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const o=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,o)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();le(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),r=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,r),this.repaint();const n=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,s){var i,r;const o=this.tableModel.getColumnDef(s);if(o!=null&&o.sortable&&o.sortable()){e.preventDefault(),e.stopPropagation();const n=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,a=o.sortState??"",c=n[(n.indexOf(a)+1)%n.length],d=new at(s,c);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(g=>g.sortState=""),o.sortState=c),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,o)}setSelectionModel(e,t=!1){const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[o,i]=s.getFocus();return s.setFocus(o+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,o=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&o){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(le(r)){const n=r,a=r.getRowCount();for(let c=0;c<a;c++){const d=r.getRowByIndex(c);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const h=o(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}}const Y=class Y{};Y.themes=["light","combat","paper","blackboard"],Y.vars={light:`html[data-theme="light"] {
22
22
  --ge-table-bg: rgba(255,255,255, 0.5);
23
23
  --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
24
24
  --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
@@ -246,9 +246,9 @@
246
246
  --ge-table-column-resize-handle-border: oklch(0% 0 0);
247
247
  --ge-table-dragged-col-div-bg: #2c2e33;
248
248
  --ge-table-drop-zone-bg: #758129;
249
- }`};let Se=Y;const U=class U{constructor(e=new Te){this.headerGroupOptions=e}render(e,t,s,o,i,l,n){const a=l!=null&&l.data?l.data:"";if(l){const{toggle:c,visibility:d,closed:h}=l,g=c?U.toggleHeaderGroup:"";this.addText(e,o,t,s,a,g),c&&d!=="always"&&this.addArrowDiv(n,e,!h,t,s,o,g)}else this.addText(e,o,t,s,a,"")}addText(e,t,s,o,i,l){e.innerHTML=`<span
250
- data-ge-action="${l}"
249
+ }`};let Se=Y;const U=class U{constructor(e=new Te){this.headerGroupOptions=e}render(e,t,s,o,i,r,n){const a=r!=null&&r.data?r.data:"";if(r){const{toggle:c,visibility:d,closed:h}=r,g=c?U.toggleHeaderGroup:"";this.addText(e,o,t,s,a,g),c&&d!=="always"&&this.addArrowDiv(n,e,!h,t,s,o,g)}else this.addText(e,o,t,s,a,"")}addText(e,t,s,o,i,r){e.innerHTML=`<span
250
+ data-ge-action="${r}"
251
251
  data-area="${t}"
252
252
  data-row-index="${s}"
253
253
  data-col-index="${o}"
254
- >${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,l="header",n){const a=e.createElement("div");e.addClass(a,"ge-table-toggle-icon-div"),e.setStyle(a,"display","inline-block"),e.setStyle(a,"position",""),e.setStyle(a,"width","20px"),e.setStyle(a,"background","transparent"),e.setStyle(a,"cursor","pointer"),e.setAttribute(a,"data-row-index",`${o}`),e.setAttribute(a,"data-col-index",`${i}`),e.setAttribute(a,"data-area",`${l}`),e.setAttribute(a,"data-ge-action",`${n}`);let c;s?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const d=c.content,h=e.createText(d);e.appendChild(a,h),c.style&&this.applyStyleString(e,a,c.style);for(const g of c.classes)e.addClass(a,g);return e.appendChild(t,a),a}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[l,n]=i.split(":");e.setStyle(t,l.trim(),n.trim())}}};U.toggleHeaderGroup="toggleHeaderGroup";let me=U;var vt=je("<div>");const wt=r=>{let e;const t=Ee({tableModel:null,tableOptions:new De},r);return Le(()=>{const s={onSelectionChanged(l){const n=new CustomEvent("selectionChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onFocusChanged(l){const n=new CustomEvent("focusChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onCheckboxChanged:l=>{const n=new CustomEvent("checkboxChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onContextmenu:l=>{const n=new CustomEvent("contextmenu",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onModelChanged:l=>{const n=new CustomEvent("modelChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseClicked:l=>{const n=new CustomEvent("mouseClicked",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDragging:l=>{const n=new CustomEvent("mouseDragging",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDraggingEnd:l=>{const n=new CustomEvent("mouseDraggingEnd",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseMoved:l=>{const n=new CustomEvent("mouseMoved",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)}},o=new he(e,t.tableModel,new Re,t.tableOptions,s);o.firstInit();const i=new CustomEvent("tableReady",{detail:o.getApi(),bubbles:!0});e&&e.dispatchEvent(i),t.licenseKey&&$.getInstance().setLicenseKey(t.licenseKey)}),(()=>{var s=vt(),o=e;return typeof o=="function"?Xe(o,s):e=s,s})()};exports.ComponentRendererWrapper=Ye;exports.GuiexpertTable=wt;exports.GuiexpertTableProps=Ue;
254
+ >${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,r="header",n){const a=e.createElement("div");e.addClass(a,"ge-table-toggle-icon-div"),e.setStyle(a,"display","inline-block"),e.setStyle(a,"position",""),e.setStyle(a,"width","20px"),e.setStyle(a,"background","transparent"),e.setStyle(a,"cursor","pointer"),e.setAttribute(a,"data-row-index",`${o}`),e.setAttribute(a,"data-col-index",`${i}`),e.setAttribute(a,"data-area",`${r}`),e.setAttribute(a,"data-ge-action",`${n}`);let c;s?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const d=c.content,h=e.createText(d);e.appendChild(a,h),c.style&&this.applyStyleString(e,a,c.style);for(const g of c.classes)e.addClass(a,g);return e.appendChild(t,a),a}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[r,n]=i.split(":");e.setStyle(t,r.trim(),n.trim())}}};U.toggleHeaderGroup="toggleHeaderGroup";let me=U;var vt=je("<div>");const wt=l=>{let e;const t=Ee({tableModel:null,tableOptions:new De},l);return Le(()=>{const s={onSelectionChanged(r){const n=new CustomEvent("selectionChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onFocusChanged(r){const n=new CustomEvent("focusChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onCheckboxChanged:r=>{const n=new CustomEvent("checkboxChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onContextmenu:r=>{const n=new CustomEvent("contextmenu",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onModelChanged:r=>{const n=new CustomEvent("modelChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseClicked:r=>{const n=new CustomEvent("mouseClicked",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDragging:r=>{const n=new CustomEvent("mouseDragging",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDraggingEnd:r=>{const n=new CustomEvent("mouseDraggingEnd",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseMoved:r=>{const n=new CustomEvent("mouseMoved",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)}},o=new he(e,t.tableModel,new Re,t.tableOptions,s);o.firstInit();const i=new CustomEvent("tableReady",{detail:o.getApi(),bubbles:!0});e&&e.dispatchEvent(i),t.licenseKey&&$.getInstance().setLicenseKey(t.licenseKey)}),(()=>{var s=vt(),o=e;return typeof o=="function"?Xe(o,s):e=s,s})()};exports.ComponentRendererWrapper=Ye;exports.GuiexpertTable=wt;exports.GuiexpertTableProps=Ue;
package/index.js CHANGED
@@ -9,14 +9,14 @@ const L = 1, N = 2, ve = {
9
9
  owner: null
10
10
  };
11
11
  var R = null;
12
- let Z = null, pe = null, w = null, M = null, I = null, q = 0;
12
+ let Z = null, pe = null, w = null, M = null, F = null, q = 0;
13
13
  function Oe(l, e) {
14
14
  const t = w, s = R, o = l.length === 0, i = e === void 0 ? s : e, r = o ? ve : {
15
15
  owned: null,
16
16
  cleanups: null,
17
17
  context: i ? i.context : null,
18
18
  owner: i
19
- }, n = o ? l : () => l(() => H(() => J(r)));
19
+ }, n = o ? l : () => l(() => W(() => J(r)));
20
20
  R = r, w = null;
21
21
  try {
22
22
  return G(n, !0);
@@ -26,19 +26,19 @@ function Oe(l, e) {
26
26
  }
27
27
  function se(l, e, t) {
28
28
  const s = re(l, e, !1, L);
29
- W(s);
29
+ H(s);
30
30
  }
31
- function Fe(l, e, t) {
32
- ye = We;
31
+ function Ie(l, e, t) {
32
+ ye = He;
33
33
  const s = re(l, e, !1, L);
34
- (!t || !t.render) && (s.user = !0), I ? I.push(s) : W(s);
34
+ (!t || !t.render) && (s.user = !0), F ? F.push(s) : H(s);
35
35
  }
36
- function Ie(l, e, t) {
36
+ function Fe(l, e, t) {
37
37
  t = t ? Object.assign({}, ue, t) : ue;
38
38
  const s = re(l, e, !0, 0);
39
- return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0, W(s), $e.bind(s);
39
+ return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0, H(s), $e.bind(s);
40
40
  }
41
- function H(l) {
41
+ function W(l) {
42
42
  if (!pe && w === null)
43
43
  return l();
44
44
  const e = w;
@@ -50,12 +50,12 @@ function H(l) {
50
50
  }
51
51
  }
52
52
  function Le(l) {
53
- Fe(() => H(l));
53
+ Ie(() => W(l));
54
54
  }
55
55
  function $e() {
56
56
  if (this.sources && this.state)
57
57
  if (this.state === L)
58
- W(this);
58
+ H(this);
59
59
  else {
60
60
  const l = M;
61
61
  M = null, G(() => j(this), !1), M = l;
@@ -71,13 +71,13 @@ function Be(l, e, t) {
71
71
  return (!l.comparator || !l.comparator(s, e)) && (l.value = e, l.observers && l.observers.length && G(() => {
72
72
  for (let o = 0; o < l.observers.length; o += 1) {
73
73
  const i = l.observers[o], r = Z && Z.running;
74
- r && Z.disposed.has(i), (r ? !i.tState : !i.state) && (i.pure ? M.push(i) : I.push(i), i.observers && Ce(i)), r || (i.state = L);
74
+ r && Z.disposed.has(i), (r ? !i.tState : !i.state) && (i.pure ? M.push(i) : F.push(i), i.observers && Ce(i)), r || (i.state = L);
75
75
  }
76
76
  if (M.length > 1e6)
77
77
  throw M = [], new Error();
78
78
  }, !1)), e;
79
79
  }
80
- function W(l) {
80
+ function H(l) {
81
81
  if (!l.fn)
82
82
  return;
83
83
  J(l);
@@ -118,14 +118,14 @@ function z(l) {
118
118
  return;
119
119
  if (l.state === N)
120
120
  return j(l);
121
- if (l.suspense && H(l.suspense.inFallback))
121
+ if (l.suspense && W(l.suspense.inFallback))
122
122
  return l.suspense.effects.push(l);
123
123
  const e = [l];
124
124
  for (; (l = l.owner) && (!l.updatedAt || l.updatedAt < q); )
125
125
  l.state && e.push(l);
126
126
  for (let t = e.length - 1; t >= 0; t--)
127
127
  if (l = e[t], l.state === L)
128
- W(l);
128
+ H(l);
129
129
  else if (l.state === N) {
130
130
  const s = M;
131
131
  M = null, G(() => j(l, e[0]), !1), M = s;
@@ -135,25 +135,25 @@ function G(l, e) {
135
135
  if (M)
136
136
  return l();
137
137
  let t = !1;
138
- e || (M = []), I ? t = !0 : I = [], q++;
138
+ e || (M = []), F ? t = !0 : F = [], q++;
139
139
  try {
140
140
  const s = l();
141
- return He(t), s;
141
+ return We(t), s;
142
142
  } catch (s) {
143
- t || (I = null), M = null, xe(s);
143
+ t || (F = null), M = null, xe(s);
144
144
  }
145
145
  }
146
- function He(l) {
146
+ function We(l) {
147
147
  if (M && (we(M), M = null), l)
148
148
  return;
149
- const e = I;
150
- I = null, e.length && G(() => ye(e), !1);
149
+ const e = F;
150
+ F = null, e.length && G(() => ye(e), !1);
151
151
  }
152
152
  function we(l) {
153
153
  for (let e = 0; e < l.length; e++)
154
154
  z(l[e]);
155
155
  }
156
- function We(l) {
156
+ function He(l) {
157
157
  let e, t = 0;
158
158
  for (e = 0; e < l.length; e++) {
159
159
  const s = l[e];
@@ -175,7 +175,7 @@ function j(l, e) {
175
175
  function Ce(l) {
176
176
  for (let e = 0; e < l.observers.length; e += 1) {
177
177
  const t = l.observers[e];
178
- t.state || (t.state = N, t.pure ? M.push(t) : I.push(t), t.observers && Ce(t));
178
+ t.state || (t.state = N, t.pure ? M.push(t) : F.push(t), t.observers && Ce(t));
179
179
  }
180
180
  }
181
181
  function J(l) {
@@ -249,7 +249,7 @@ function Ee(...l) {
249
249
  let e = !1;
250
250
  for (let r = 0; r < l.length; r++) {
251
251
  const n = l[r];
252
- e = e || !!n && te in n, l[r] = typeof n == "function" ? (e = !0, Ie(n)) : n;
252
+ e = e || !!n && te in n, l[r] = typeof n == "function" ? (e = !0, Fe(n)) : n;
253
253
  }
254
254
  if (e)
255
255
  return new Proxy({
@@ -361,11 +361,11 @@ function je(l, e, t) {
361
361
  const o = () => {
362
362
  const r = document.createElement("template");
363
363
  return r.innerHTML = l, t ? r.content.firstChild.firstChild : r.content.firstChild;
364
- }, i = e ? () => H(() => document.importNode(s || (s = o()), !0)) : () => (s || (s = o())).cloneNode(!0);
364
+ }, i = e ? () => W(() => document.importNode(s || (s = o()), !0)) : () => (s || (s = o())).cloneNode(!0);
365
365
  return i.cloneNode = i, i;
366
366
  }
367
367
  function Xe(l, e, t) {
368
- return H(() => l(e, t));
368
+ return W(() => l(e, t));
369
369
  }
370
370
  function Ke(l, e, t, s) {
371
371
  if (t !== void 0 && !s && (s = []), typeof e != "function")
@@ -533,25 +533,25 @@ class ne {
533
533
  );
534
534
  }
535
535
  }
536
- class F {
536
+ class I {
537
537
  constructor(e = ">", t = "", s = []) {
538
538
  this.content = e, this.style = t, this.classes = s;
539
539
  }
540
540
  }
541
541
  class Ae {
542
- constructor(e = new F(
542
+ constructor(e = new I(
543
543
  ">",
544
544
  "transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",
545
545
  ["gt-table-tree-arrow-expanded"]
546
- ), t = new F(
546
+ ), t = new I(
547
547
  ">",
548
548
  "",
549
549
  ["ge-table-tree-arrow-collapsed"]
550
- ), s = new F(
550
+ ), s = new I(
551
551
  ">",
552
552
  "color:transparent;",
553
553
  ["gt-table-tree-arrow-hidden"]
554
- ), o = new F(
554
+ ), o = new I(
555
555
  "↕",
556
556
  "",
557
557
  ["gt-table-tree-arrow-expanded-all"]
@@ -560,7 +560,7 @@ class Ae {
560
560
  }
561
561
  }
562
562
  class Me {
563
- constructor(e = new F("↑", "", ["ge-header-sorted-asc"]), t = new F("↓", "", ["ge-header-sorted-desc"]), s = new F("↑", "color:transparent;", [])) {
563
+ constructor(e = new I("↑", "", ["ge-header-sorted-asc"]), t = new I("↓", "", ["ge-header-sorted-desc"]), s = new I("↑", "color:transparent;", [])) {
564
564
  this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
565
565
  }
566
566
  }
@@ -1008,6 +1008,9 @@ class Je {
1008
1008
  repaintHard() {
1009
1009
  this.tableScope.repaintHard();
1010
1010
  }
1011
+ recalcColumnWidths(e) {
1012
+ this.tableScope.recalcColumnWidths(e);
1013
+ }
1011
1014
  /**
1012
1015
  * Clears the current selection of the table.
1013
1016
  * The table will be rendered automatically.
@@ -1558,6 +1561,17 @@ class lt extends st {
1558
1561
  repaintHard() {
1559
1562
  this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows(), this.adjustAfterScrolling();
1560
1563
  }
1564
+ /**
1565
+ * Recalculates the column widths of the table.
1566
+ *
1567
+ * @param {number} [clientWidth] - The client width of the table. If not provided, the client width of the scroll viewport will be used.
1568
+ *
1569
+ * @return {undefined}
1570
+ */
1571
+ recalcColumnWidths(e) {
1572
+ let t = e || this.scrollViewport.clientWidth;
1573
+ this.tableModel.setParentWidth(t), this.tableModel.init(), this.repaintHard();
1574
+ }
1561
1575
  /**
1562
1576
  * Adjusts the table after scrolling. This method performs various adjustments
1563
1577
  * to the table's appearance and behavior after a scroll event occurs.
@@ -2744,11 +2758,11 @@ class bt {
2744
2758
  }
2745
2759
  }
2746
2760
  class Te {
2747
- constructor(e = new F(
2761
+ constructor(e = new I(
2748
2762
  "❯",
2749
2763
  "",
2750
2764
  ["gt-table-icon-expanded"]
2751
- ), t = new F(
2765
+ ), t = new I(
2752
2766
  "❯",
2753
2767
  "transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",
2754
2768
  ["ge-table-icon-collapsed"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/solid-table",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "tslib": "^2.3.0",
21
- "@guiexpert/table": "^1.1.27"
21
+ "@guiexpert/table": "^1.1.28"
22
22
  },
23
23
  "devDependencies": {
24
24
  "solid-jest": "^0.2.0",