@guiexpert/solid-table 1.0.23 → 1.0.24

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 +5 -5
  2. package/index.js +110 -93
  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=(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=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=(l,e)=>l===e,te=Symbol("solid-proxy"),ue={equals:Oe};let ye=we;const L=1,z=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 ke(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 N(l){if(l.state===0)return;if(l.state===z)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===z){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++)N(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:N(s)}for(e=0;e<t;e++)N(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)&&N(s):o===z&&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=z,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 ze(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 Ne(l,e,t,s={}){let o;return ke(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):ze(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});Ne(()=>this.code(a),e)}}const Ue=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function qe(l,e=500){let t=null;return function(...s){t&&window.clearTimeout(t),t=window.setTimeout(()=>{l.apply(this,s),t=null},e)}}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 Je{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
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=`
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 Qe{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 Ze{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 Qe(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 et{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 tt 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 st{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class ot extends de{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new st,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 it 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 k{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 lt{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new k,this.areaBodyCenterGeo=new k,this.areaBodyEastGeo=new k;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),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 nt{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class at extends lt{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 nt,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 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()}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 k(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new k(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 k(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 k(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 O=f;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:O,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:O-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 k(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 O=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(f=this.colAndRowspanModels[e])!=null&&f.isInRange(r,p)&&(O=!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(O,S,t,s,r,p,i,u,g,m,C);"gammaCells"in s&&s.getValueAt(r,p)&&(O=!1),O||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 k(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}),O=e.getTooltipAt(o,i);O&&this.dom.setAttribute(m,"title",O);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 dt{constructor(e,t){this.columnIndex=e,this.sortState=t}}class ct{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 ht{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 ht(e,t)])}}class gt{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 ut{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 pt{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 bt{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 pt().get()):Object.assign(this.shortcutActionIdMapping,new ut().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 ft{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 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"] {
20
+ class="ge-table-cell-editor-input">`}}}class St{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 mt{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 yt=new St,vt=new mt("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 ft,this.getSelectionModel=()=>yt,this.getFocusModel=()=>vt}}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 wt{constructor(e){this.tableScope=e,new ResizeObserver(qe(this.handleResize.bind(this),500)).observe(this.tableScope.hostElement)}handleResize(e){const t=e[0],{width:s}=t.contentRect;this.tableScope.recalcColumnWidths(s)}}class he extends at{constructor(e,t,s,o,i,r=new K){var c;if(super(e,t,new Je(s),o),this.eventListener=i,this.copyService=r,this.licenseManager=$.getInstance(),this.selectionService=new gt(this),this.api=new et(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 tt(h)),d.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ot(h)),d.autoRestoreSortingState&&(this.storeSortingService=new it(h)))}this.mouseHandler=new Ze(this),this.inputHandler=new ct(this),this.resizeHandler=new wt(this),this.shortcutService=new bt(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 dt(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);
@@ -251,4 +251,4 @@
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,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;
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 Ct=je("<div>");const xt=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=Ct(),o=e;return typeof o=="function"?Xe(o,s):e=s,s})()};exports.ComponentRendererWrapper=Ye;exports.GuiexpertTable=xt;exports.GuiexpertTableProps=Ue;
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- const ke = (l, e) => l === e, te = Symbol("solid-proxy"), ue = {
2
- equals: ke
1
+ const Oe = (l, e) => l === e, te = Symbol("solid-proxy"), ue = {
2
+ equals: Oe
3
3
  };
4
4
  let ye = we;
5
- const L = 1, N = 2, ve = {
5
+ const L = 1, z = 2, ve = {
6
6
  owned: null,
7
7
  cleanups: null,
8
8
  context: null,
@@ -10,13 +10,13 @@ const L = 1, N = 2, ve = {
10
10
  };
11
11
  var R = null;
12
12
  let Z = null, pe = null, w = null, M = null, F = null, q = 0;
13
- function Oe(l, e) {
13
+ function ke(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(() => W(() => J(r)));
19
+ }, n = o ? l : () => l(() => H(() => 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
- H(s);
29
+ W(s);
30
30
  }
31
31
  function Ie(l, e, t) {
32
- ye = He;
32
+ ye = We;
33
33
  const s = re(l, e, !1, L);
34
- (!t || !t.render) && (s.user = !0), F ? F.push(s) : H(s);
34
+ (!t || !t.render) && (s.user = !0), F ? F.push(s) : W(s);
35
35
  }
36
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, H(s), $e.bind(s);
39
+ return s.observers = null, s.observerSlots = null, s.comparator = t.equals || void 0, W(s), $e.bind(s);
40
40
  }
41
- function W(l) {
41
+ function H(l) {
42
42
  if (!pe && w === null)
43
43
  return l();
44
44
  const e = w;
@@ -50,12 +50,12 @@ function W(l) {
50
50
  }
51
51
  }
52
52
  function Le(l) {
53
- Ie(() => W(l));
53
+ Ie(() => H(l));
54
54
  }
55
55
  function $e() {
56
56
  if (this.sources && this.state)
57
57
  if (this.state === L)
58
- H(this);
58
+ W(this);
59
59
  else {
60
60
  const l = M;
61
61
  M = null, G(() => j(this), !1), M = l;
@@ -77,7 +77,7 @@ function Be(l, e, t) {
77
77
  throw M = [], new Error();
78
78
  }, !1)), e;
79
79
  }
80
- function H(l) {
80
+ function W(l) {
81
81
  if (!l.fn)
82
82
  return;
83
83
  J(l);
@@ -113,20 +113,20 @@ function re(l, e, t, s = L, o) {
113
113
  };
114
114
  return R === null || R !== ve && (R.owned ? R.owned.push(i) : R.owned = [i]), i;
115
115
  }
116
- function z(l) {
116
+ function N(l) {
117
117
  if (l.state === 0)
118
118
  return;
119
- if (l.state === N)
119
+ if (l.state === z)
120
120
  return j(l);
121
- if (l.suspense && W(l.suspense.inFallback))
121
+ if (l.suspense && H(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
- H(l);
129
- else if (l.state === N) {
128
+ W(l);
129
+ else if (l.state === z) {
130
130
  const s = M;
131
131
  M = null, G(() => j(l, e[0]), !1), M = s;
132
132
  }
@@ -138,12 +138,12 @@ function G(l, e) {
138
138
  e || (M = []), F ? t = !0 : F = [], q++;
139
139
  try {
140
140
  const s = l();
141
- return We(t), s;
141
+ return He(t), s;
142
142
  } catch (s) {
143
143
  t || (F = null), M = null, xe(s);
144
144
  }
145
145
  }
146
- function We(l) {
146
+ function He(l) {
147
147
  if (M && (we(M), M = null), l)
148
148
  return;
149
149
  const e = F;
@@ -151,16 +151,16 @@ function We(l) {
151
151
  }
152
152
  function we(l) {
153
153
  for (let e = 0; e < l.length; e++)
154
- z(l[e]);
154
+ N(l[e]);
155
155
  }
156
- function He(l) {
156
+ function We(l) {
157
157
  let e, t = 0;
158
158
  for (e = 0; e < l.length; e++) {
159
159
  const s = l[e];
160
- s.user ? l[t++] = s : z(s);
160
+ s.user ? l[t++] = s : N(s);
161
161
  }
162
162
  for (e = 0; e < t; e++)
163
- z(l[e]);
163
+ N(l[e]);
164
164
  }
165
165
  function j(l, e) {
166
166
  l.state = 0;
@@ -168,14 +168,14 @@ function j(l, e) {
168
168
  const s = l.sources[t];
169
169
  if (s.sources) {
170
170
  const o = s.state;
171
- o === L ? s !== e && (!s.updatedAt || s.updatedAt < q) && z(s) : o === N && j(s, e);
171
+ o === L ? s !== e && (!s.updatedAt || s.updatedAt < q) && N(s) : o === z && j(s, e);
172
172
  }
173
173
  }
174
174
  }
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) : F.push(t), t.observers && Ce(t));
178
+ t.state || (t.state = z, t.pure ? M.push(t) : F.push(t), t.observers && Ce(t));
179
179
  }
180
180
  }
181
181
  function J(l) {
@@ -303,7 +303,7 @@ function Ee(...l) {
303
303
  }
304
304
  return o;
305
305
  }
306
- function Ne(l, e, t) {
306
+ function ze(l, e, t) {
307
307
  let s = t.length, o = e.length, i = s, r = 0, n = 0, a = e[o - 1].nextSibling, c = null;
308
308
  for (; r < o || n < i; ) {
309
309
  if (e[r] === t[n]) {
@@ -348,9 +348,9 @@ function Ne(l, e, t) {
348
348
  }
349
349
  }
350
350
  }
351
- function ze(l, e, t, s = {}) {
351
+ function Ne(l, e, t, s = {}) {
352
352
  let o;
353
- return Oe((i) => {
353
+ return ke((i) => {
354
354
  o = i, e === document ? l() : Ke(e, l(), e.firstChild ? null : void 0, t);
355
355
  }, s.owner), () => {
356
356
  o(), e.textContent = "";
@@ -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 ? () => W(() => document.importNode(s || (s = o()), !0)) : () => (s || (s = o())).cloneNode(!0);
364
+ }, i = e ? () => H(() => 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 W(() => l(e, t));
368
+ return H(() => l(e, t));
369
369
  }
370
370
  function Ke(l, e, t, s) {
371
371
  if (t !== void 0 && !s && (s = []), typeof e != "function")
@@ -402,7 +402,7 @@ function X(l, e, t, s, o) {
402
402
  if (t = B(l, t, s), r)
403
403
  return t;
404
404
  } else
405
- a ? t.length === 0 ? be(l, n, s) : Ne(l, t, n) : (t && B(l), be(l, n));
405
+ a ? t.length === 0 ? be(l, n, s) : ze(l, t, n) : (t && B(l), be(l, n));
406
406
  t = n;
407
407
  } else if (e.nodeType) {
408
408
  if (Array.isArray(t)) {
@@ -461,7 +461,7 @@ function B(l, e, t, s) {
461
461
  l.insertBefore(o, t);
462
462
  return [o];
463
463
  }
464
- class yt {
464
+ class wt {
465
465
  constructor(e) {
466
466
  this.code = e;
467
467
  }
@@ -473,15 +473,23 @@ class yt {
473
473
  areaModel: i,
474
474
  cellValue: r
475
475
  });
476
- ze(
476
+ Ne(
477
477
  () => this.code(a),
478
478
  e
479
479
  );
480
480
  }
481
481
  }
482
- const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
482
+ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
483
483
  __proto__: null
484
484
  }, Symbol.toStringTag, { value: "Module" }));
485
+ function Ye(l, e = 500) {
486
+ let t = null;
487
+ return function(...s) {
488
+ t && window.clearTimeout(t), t = window.setTimeout(() => {
489
+ l.apply(this, s), t = null;
490
+ }, e);
491
+ };
492
+ }
485
493
  class $ {
486
494
  // The constructor is private to prevent direct construction calls
487
495
  // with the `new` operator
@@ -564,7 +572,7 @@ class Me {
564
572
  this.iconAsc = e, this.iconDesc = t, this.iconPlaceholder = s;
565
573
  }
566
574
  }
567
- class Ye {
575
+ class Ue {
568
576
  constructor(e) {
569
577
  this.domService = e;
570
578
  }
@@ -747,7 +755,7 @@ class Ye {
747
755
  }
748
756
  }
749
757
  const ae = (l) => l === "header" ? "header" : l === "footer" ? "footer" : "body";
750
- class Ue {
758
+ class qe {
751
759
  constructor(e, t) {
752
760
  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)) {
753
761
  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"));
@@ -759,7 +767,7 @@ class Ue {
759
767
  }
760
768
  }
761
769
  }
762
- class qe {
770
+ class Je {
763
771
  constructor(e) {
764
772
  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(
765
773
  (t) => t.addEventListener("resize", this.tableScope.adjustContainersAndRows.bind(this.tableScope))
@@ -789,7 +797,7 @@ class qe {
789
797
  if (t - this.lastClicked < this.doubleClickDelay)
790
798
  return;
791
799
  this.lastClicked = t;
792
- const s = new Ue(e.target, this.tableScope);
800
+ const s = new qe(e.target, this.tableScope);
793
801
  if (s.action === "toggleExpandCollapseAll")
794
802
  this.expandedAll = !this.expandedAll, this.tableScope.toggleExpandCollapseAll(this.expandedAll), e.preventDefault(), e.stopPropagation();
795
803
  else if (s.action === "toggleHeaderGroup")
@@ -891,7 +899,7 @@ class qe {
891
899
  }
892
900
  }
893
901
  }
894
- class Je {
902
+ class Qe {
895
903
  constructor(e) {
896
904
  this.tableScope = e;
897
905
  }
@@ -1154,7 +1162,7 @@ class de {
1154
1162
  // }
1155
1163
  // }
1156
1164
  }
1157
- class Qe extends de {
1165
+ class Ze extends de {
1158
1166
  constructor(e) {
1159
1167
  super(e), this.SCROLL_STATE = "scrollState", this.scrollOffset = [0, 0], this.load();
1160
1168
  }
@@ -1176,14 +1184,14 @@ class Qe extends de {
1176
1184
  }
1177
1185
  }
1178
1186
  }
1179
- class Ze {
1187
+ class et {
1180
1188
  constructor(e = "collapsed", t = [], s = !1, o = !1) {
1181
1189
  this.mode = e, this.rowIds = t, this.allCollapsed = s, this.allExpanded = o;
1182
1190
  }
1183
1191
  }
1184
- class et extends de {
1192
+ class tt extends de {
1185
1193
  constructor(e) {
1186
- super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new Ze(), this.load();
1194
+ super(e), this.COLLAPSED_EXPANDED_STATE = "collapsedExpandedState", this.collapsedExpandedState = new et(), this.load();
1187
1195
  }
1188
1196
  collapsedExpandedStateGet() {
1189
1197
  return this.collapsedExpandedState;
@@ -1215,7 +1223,7 @@ class et extends de {
1215
1223
  this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE, this.collapsedExpandedState);
1216
1224
  }
1217
1225
  }
1218
- class tt extends de {
1226
+ class st extends de {
1219
1227
  constructor(e) {
1220
1228
  super(e), this.SORTING_STATE = "sortingState", this.sortItems = [], this.load();
1221
1229
  }
@@ -1236,14 +1244,14 @@ class tt extends de {
1236
1244
  }
1237
1245
  }
1238
1246
  }
1239
- class O {
1247
+ class k {
1240
1248
  constructor(e = 0, t = 0, s = 0, o = 0, i) {
1241
1249
  this.left = e, this.width = t, this.height = s, this.top = o, this.index = i;
1242
1250
  }
1243
1251
  }
1244
- class st {
1252
+ class ot {
1245
1253
  constructor(e, t, s, o) {
1246
- 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();
1254
+ this.hostElement = e, this.tableModel = t, this.dom = s, this.tableOptions = o, this.scrollTop = 0, this.areaBodyWestGeo = new k(), this.areaBodyCenterGeo = new k(), this.areaBodyEastGeo = new k();
1247
1255
  const i = this.hostElement;
1248
1256
  i.innerText = "", this.dom.setAttribute(i, "tabindex", "0"), this.dom.setStyle(
1249
1257
  this.dom.addClass("ge-table", i),
@@ -1447,7 +1455,7 @@ class A {
1447
1455
  return e >= this.r1 && e <= this.r2 && t >= this.c1 && t <= this.c2;
1448
1456
  }
1449
1457
  }
1450
- class ot {
1458
+ class it {
1451
1459
  constructor(e, t) {
1452
1460
  this.tableModel = e, this.areaModel = t, this.colAndRowspanRanges = void 0;
1453
1461
  }
@@ -1480,22 +1488,22 @@ class ot {
1480
1488
  return !1;
1481
1489
  }
1482
1490
  }
1483
- class it {
1491
+ class lt {
1484
1492
  constructor(e, t, s) {
1485
1493
  this.header = e, this.body = t, this.footer = s;
1486
1494
  }
1487
1495
  }
1488
- class lt extends st {
1496
+ class rt extends ot {
1489
1497
  constructor(e, t, s, o) {
1490
1498
  var r, n;
1491
1499
  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 = {
1492
1500
  header: [],
1493
1501
  body: [],
1494
1502
  footer: []
1495
- }, this.tree = !1, this.colAndRowspanModels = new it(), 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(
1503
+ }, this.tree = !1, this.colAndRowspanModels = new lt(), 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(
1496
1504
  (a) => {
1497
1505
  var c;
1498
- this.colAndRowspanModels[a] = new ot(t, t.getAreaModel(a)), (c = this.colAndRowspanModels[a]) == null || c.init();
1506
+ this.colAndRowspanModels[a] = new it(t, t.getAreaModel(a)), (c = this.colAndRowspanModels[a]) == null || c.init();
1499
1507
  }
1500
1508
  );
1501
1509
  }
@@ -1581,19 +1589,19 @@ class lt extends st {
1581
1589
  for (const t of this.removables)
1582
1590
  t.remove();
1583
1591
  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(
1584
- new O(0, this.hostElement.clientWidth, 1, 0),
1592
+ new k(0, this.hostElement.clientWidth, 1, 0),
1585
1593
  this.hostElement,
1586
1594
  "ge-table-border"
1587
1595
  )), this.tableOptions.tableBottomBorderVisible && this.removables.push(this.dom.addHorizontalBorder(
1588
- new O(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
1596
+ new k(0, this.hostElement.clientWidth, 1, this.hostElement.clientHeight - 1),
1589
1597
  this.hostElement,
1590
1598
  "ge-table-border"
1591
1599
  )), this.tableModel.getFixedLeftColumnCount() > 0 && this.removables.push(this.dom.addVerticalBorder(
1592
- new O(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
1600
+ new k(this.areaBodyWest.child.clientWidth, 1, this.hostElement.clientHeight, 0),
1593
1601
  this.hostElement,
1594
1602
  "ge-table-body-west-vertical-border"
1595
1603
  )), ((e = this.tableModel.getAreaModel("header")) == null ? void 0 : e.getRowCount()) > 0 && this.removables.push(this.dom.addHorizontalBorder(
1596
- new O(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
1604
+ new k(0, this.hostElement.clientWidth, 1, this.areaHeaderCenter.child.clientHeight),
1597
1605
  this.hostElement,
1598
1606
  "ge-table-body-west-vertical-border"
1599
1607
  ));
@@ -1771,7 +1779,7 @@ class lt extends st {
1771
1779
  if (v + E > 0) {
1772
1780
  this.firstVisibleRowIndex = u;
1773
1781
  let y = { left: n, width: a, height: E, top: v, index: u }, m = this.dom.addRowDiv(o, y, u, e, "center");
1774
- const k = f;
1782
+ const O = f;
1775
1783
  if (this.adjustColumnsToRowParent({
1776
1784
  areaIdent: e,
1777
1785
  sideIdent: "center",
@@ -1779,7 +1787,7 @@ class lt extends st {
1779
1787
  geo: y,
1780
1788
  parent: m,
1781
1789
  rowIndex: u,
1782
- columnIndexStart: k,
1790
+ columnIndexStart: O,
1783
1791
  columnIndexEnd: S - b - 1,
1784
1792
  verticalFixed: !1,
1785
1793
  lastRowOfModel: C
@@ -1791,7 +1799,7 @@ class lt extends st {
1791
1799
  parent: m,
1792
1800
  rowIndex: u,
1793
1801
  columnIndexStart: 0,
1794
- columnIndexEnd: k - 1,
1802
+ columnIndexEnd: O - 1,
1795
1803
  verticalFixed: !0,
1796
1804
  lastRowOfModel: C
1797
1805
  })), 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({
@@ -1808,7 +1816,7 @@ class lt extends st {
1808
1816
  })), e === "header" && this.tree && u === h - 1) {
1809
1817
  const T = this.dom.applyStyle(
1810
1818
  this.dom.setAttribute(
1811
- this.dom.addDiv(m, new O(16, 20, 20, 8)),
1819
+ this.dom.addDiv(m, new k(16, 20, 20, 8)),
1812
1820
  "data-ge-action",
1813
1821
  "toggleExpandCollapseAll"
1814
1822
  ),
@@ -1951,14 +1959,14 @@ class lt extends st {
1951
1959
  E > 1 && (C = this.getRowHeights(r, r + E - 1, s).reduce((T, D) => T + D, 0));
1952
1960
  let m = v;
1953
1961
  y > 1 && (m = this.getColumnWidths(p, p + y - 1).reduce((T, D) => T + D, 0));
1954
- let k = !1;
1955
- if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (f = this.colAndRowspanModels[e]) != null && f.isInRange(r, p) && (k = !0), this.draggingTargetColumnIndex === p && e !== "header") {
1962
+ let O = !1;
1963
+ if (this.colAndRowspanModels && this.colAndRowspanModels[e] && (f = this.colAndRowspanModels[e]) != null && f.isInRange(r, p) && (O = !0), this.draggingTargetColumnIndex === p && e !== "header") {
1956
1964
  this.renderDragTargetDiv(i, u, g, m, C);
1957
1965
  const T = { left: u, top: g, width: m, height: C };
1958
1966
  this.dom.addColumnBorderDivs(this.tableOptions, i, T, e, t);
1959
1967
  } else {
1960
- const T = this.renderSelectedBackgroundDiv(k, S, t, s, r, p, i, u, g, m, C);
1961
- "gammaCells" in s && s.getValueAt(r, p) && (k = !1), k || this.renderCell({
1968
+ const T = this.renderSelectedBackgroundDiv(O, S, t, s, r, p, i, u, g, m, C);
1969
+ "gammaCells" in s && s.getValueAt(r, p) && (O = !1), O || this.renderCell({
1962
1970
  areaModel: s,
1963
1971
  areaIdent: e,
1964
1972
  sideIdent: t,
@@ -1986,7 +1994,7 @@ class lt extends st {
1986
1994
  if (b = b + v, b > this.areaBodyCenterGeo.width)
1987
1995
  break;
1988
1996
  }
1989
- this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new O(b - 1, 1, o.height, 0), i);
1997
+ this.tableOptions.verticalBorderVisible && this.dom.addVerticalBorder(new k(b - 1, 1, o.height, 0), i);
1990
1998
  }
1991
1999
  /**
1992
2000
  * Retrieves the column index of the tree arrow column in the table.
@@ -2039,8 +2047,8 @@ class lt extends st {
2039
2047
  checkedType: y,
2040
2048
  sortState: v
2041
2049
  }
2042
- ), k = e.getTooltipAt(o, i);
2043
- k && this.dom.setAttribute(m, "title", k);
2050
+ ), O = e.getTooltipAt(o, i);
2051
+ O && this.dom.setAttribute(m, "title", O);
2044
2052
  const T = this.tableModel.getColumnDef(i);
2045
2053
  T && T.classes[t] && this.dom.addClasses(T.classes[t], m);
2046
2054
  let D;
@@ -2374,12 +2382,12 @@ class lt extends st {
2374
2382
  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);
2375
2383
  }
2376
2384
  }
2377
- class rt {
2385
+ class nt {
2378
2386
  constructor(e, t) {
2379
2387
  this.columnIndex = e, this.sortState = t;
2380
2388
  }
2381
2389
  }
2382
- class nt {
2390
+ class at {
2383
2391
  constructor(e) {
2384
2392
  this.tableScope = e, this.tableScope.hostElement.addEventListener("change", this.onHostElementChanged.bind(this));
2385
2393
  }
@@ -2401,7 +2409,7 @@ class nt {
2401
2409
  }
2402
2410
  }
2403
2411
  }
2404
- class at {
2412
+ class dt {
2405
2413
  constructor(e = -1, t = -1) {
2406
2414
  this.rowIndex = e, this.columnIndex = t;
2407
2415
  }
@@ -2411,10 +2419,10 @@ class ce {
2411
2419
  this.cells = e;
2412
2420
  }
2413
2421
  static createSingle(e, t) {
2414
- return new ce([new at(e, t)]);
2422
+ return new ce([new dt(e, t)]);
2415
2423
  }
2416
2424
  }
2417
- class dt {
2425
+ class ct {
2418
2426
  constructor(e) {
2419
2427
  var t, s;
2420
2428
  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);
@@ -2455,7 +2463,7 @@ class dt {
2455
2463
  });
2456
2464
  }
2457
2465
  }
2458
- class ct {
2466
+ class ht {
2459
2467
  get() {
2460
2468
  return {
2461
2469
  f2: "START_EDITING",
@@ -2475,7 +2483,7 @@ class ct {
2475
2483
  };
2476
2484
  }
2477
2485
  }
2478
- class ht {
2486
+ class gt {
2479
2487
  get() {
2480
2488
  return {
2481
2489
  f2: "START_EDITING",
@@ -2497,7 +2505,7 @@ class ht {
2497
2505
  };
2498
2506
  }
2499
2507
  }
2500
- class gt {
2508
+ class ut {
2501
2509
  constructor(e) {
2502
2510
  this.tableScope = e, this.shortcutActionIdMapping = {}, this.listener = [], this.listener.push(e), this.init();
2503
2511
  }
@@ -2518,7 +2526,7 @@ class gt {
2518
2526
  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));
2519
2527
  }
2520
2528
  assignPredefinedSystemShortcutMappings() {
2521
- this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new ht().get()) : Object.assign(this.shortcutActionIdMapping, new ct().get());
2529
+ this.isMacintosh() ? Object.assign(this.shortcutActionIdMapping, new gt().get()) : Object.assign(this.shortcutActionIdMapping, new ht().get());
2522
2530
  }
2523
2531
  isMacintosh() {
2524
2532
  return navigator.platform.indexOf("Mac") > -1;
@@ -2617,7 +2625,7 @@ class Re {
2617
2625
  e.setAttribute(t, s);
2618
2626
  }
2619
2627
  }
2620
- class ut {
2628
+ class pt {
2621
2629
  render(e, t, s, o, i, r, n) {
2622
2630
  if (i.isEditable(t, s)) {
2623
2631
  n.addClass(e, "ge-table-row-input-div");
@@ -2638,7 +2646,7 @@ class ut {
2638
2646
  }
2639
2647
  }
2640
2648
  }
2641
- class pt {
2649
+ class bt {
2642
2650
  constructor(e = "none", t = "single") {
2643
2651
  this.selectionType = e, this.selectionMode = t, this.ranges = [], this.negativeRanges = [], this.allSelected = !1, this.silent = !1, this.listenerArr = [];
2644
2652
  }
@@ -2720,7 +2728,7 @@ class pt {
2720
2728
  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());
2721
2729
  }
2722
2730
  }
2723
- class bt {
2731
+ class ft {
2724
2732
  constructor(e = "none") {
2725
2733
  this.selectionType = e, this.rowIndex = -1, this.columnIndex = -1, this.changed = !1, this.listenerArr = [];
2726
2734
  }
@@ -2771,14 +2779,14 @@ class Te {
2771
2779
  }
2772
2780
  // `⊖ `, `⊕ `;
2773
2781
  }
2774
- const ft = new pt(), St = new bt("cell");
2782
+ const St = new bt(), mt = new ft("cell");
2775
2783
  class De {
2776
2784
  constructor() {
2777
2785
  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 = {
2778
2786
  header: 34,
2779
2787
  body: 34,
2780
2788
  footer: 34
2781
- }, 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 ut(), this.getSelectionModel = () => ft, this.getFocusModel = () => St;
2789
+ }, 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 pt(), this.getSelectionModel = () => St, this.getFocusModel = () => mt;
2782
2790
  }
2783
2791
  }
2784
2792
  const P = class P {
@@ -2866,14 +2874,23 @@ const P = class P {
2866
2874
  P.columnSeparatorChar = " ", P.rowSeparatorChar = `
2867
2875
  `;
2868
2876
  let K = P;
2869
- class he extends lt {
2877
+ class yt {
2878
+ constructor(e) {
2879
+ this.tableScope = e, new ResizeObserver(Ye(this.handleResize.bind(this), 500)).observe(this.tableScope.hostElement);
2880
+ }
2881
+ handleResize(e) {
2882
+ const t = e[0], { width: s } = t.contentRect;
2883
+ this.tableScope.recalcColumnWidths(s);
2884
+ }
2885
+ }
2886
+ class he extends rt {
2870
2887
  constructor(e, t, s, o, i, r = new K()) {
2871
2888
  var c;
2872
- if (super(e, t, new Ye(s), o), this.eventListener = i, this.copyService = r, this.licenseManager = $.getInstance(), this.selectionService = new dt(this), this.api = new Je(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) {
2889
+ if (super(e, t, new Ue(s), o), this.eventListener = i, this.copyService = r, this.licenseManager = $.getInstance(), this.selectionService = new ct(this), this.api = new Qe(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) {
2873
2890
  const d = this.tableOptions.autoRestoreOptions, h = d.getStorageKeyFn;
2874
- h && (d.autoRestoreScrollPosition && (this.storeScrollPosStateService = new Qe(h)), d.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new et(h)), d.autoRestoreSortingState && (this.storeSortingService = new tt(h)));
2891
+ h && (d.autoRestoreScrollPosition && (this.storeScrollPosStateService = new Ze(h)), d.autoRestoreCollapsedExpandedState && (this.storeStateCollapsedExpandService = new tt(h)), d.autoRestoreSortingState && (this.storeSortingService = new st(h)));
2875
2892
  }
2876
- this.mouseHandler = new qe(this), this.inputHandler = new nt(this), this.shortcutService = new gt(this), this.shortcutService.addListener(this.selectionService);
2893
+ this.mouseHandler = new Je(this), this.inputHandler = new at(this), this.resizeHandler = new yt(this), this.shortcutService = new ut(this), this.shortcutService.addListener(this.selectionService);
2877
2894
  const n = this.getSelectionModel ? this.getSelectionModel() : void 0;
2878
2895
  n && n.addEventSelectionChangedListener(this);
2879
2896
  const a = this.getFocusModel ? this.getFocusModel() : void 0;
@@ -3089,7 +3106,7 @@ class he extends lt {
3089
3106
  const o = this.tableModel.getColumnDef(s);
3090
3107
  if (o != null && o.sortable && o.sortable()) {
3091
3108
  e.preventDefault(), e.stopPropagation();
3092
- const n = o.sortStatesOrder ? o.sortStatesOrder : this.tableOptions.sortOrder, a = o.sortState ?? "", c = n[(n.indexOf(a) + 1) % n.length], d = new rt(s, c);
3109
+ const n = o.sortStatesOrder ? o.sortStatesOrder : this.tableOptions.sortOrder, a = o.sortState ?? "", c = n[(n.indexOf(a) + 1) % n.length], d = new nt(s, c);
3093
3110
  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]);
3094
3111
  }
3095
3112
  }
@@ -3533,8 +3550,8 @@ const U = class U {
3533
3550
  };
3534
3551
  U.toggleHeaderGroup = "toggleHeaderGroup";
3535
3552
  let me = U;
3536
- var mt = /* @__PURE__ */ je("<div>");
3537
- const wt = (l) => {
3553
+ var vt = /* @__PURE__ */ je("<div>");
3554
+ const xt = (l) => {
3538
3555
  let e;
3539
3556
  const t = Ee({
3540
3557
  tableModel: null,
@@ -3613,12 +3630,12 @@ const wt = (l) => {
3613
3630
  });
3614
3631
  e && e.dispatchEvent(i), t.licenseKey && $.getInstance().setLicenseKey(t.licenseKey);
3615
3632
  }), (() => {
3616
- var s = mt(), o = e;
3633
+ var s = vt(), o = e;
3617
3634
  return typeof o == "function" ? Xe(o, s) : e = s, s;
3618
3635
  })();
3619
3636
  };
3620
3637
  export {
3621
- yt as ComponentRendererWrapper,
3622
- wt as GuiexpertTable,
3623
- vt as GuiexpertTableProps
3638
+ wt as ComponentRendererWrapper,
3639
+ xt as GuiexpertTable,
3640
+ Ct as GuiexpertTableProps
3624
3641
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/solid-table",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
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.28"
21
+ "@guiexpert/table": "^1.1.29"
22
22
  },
23
23
  "devDependencies": {
24
24
  "solid-jest": "^0.2.0",