@guiexpert/solid-table 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GuiexpertTable.d.ts +3 -20
- package/GuiexpertTableProps.d.ts +17 -0
- package/README.md +3 -3
- package/index.cjs +3 -3
- package/index.d.ts +3 -2
- package/index.js +17 -16
- package/package.json +2 -2
package/GuiexpertTable.d.ts
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export type GeCheckboxEventFn = (evt: any[]) => {};
|
|
5
|
-
export type GeTableReadyEventFn = (evt: TableApi) => {};
|
|
6
|
-
export type GeModelChangeEventFn = (evt: GeModelChangeEvent) => {};
|
|
7
|
-
export interface GuiexpertTableProps {
|
|
8
|
-
tableModel: TableModelIf;
|
|
9
|
-
tableOptions?: TableOptions;
|
|
10
|
-
mouseMoved?: GeMouseEventFn;
|
|
11
|
-
contextmenu?: GeMouseEventFn;
|
|
12
|
-
mouseClicked?: GeMouseEventFn;
|
|
13
|
-
mouseDragging?: GeMouseEventFn;
|
|
14
|
-
mouseDraggingEnd?: GeMouseEventFn;
|
|
15
|
-
checkboxChanged?: GeCheckboxEventFn;
|
|
16
|
-
modelChanged?: GeModelChangeEventFn;
|
|
17
|
-
tableReady?: GeTableReadyEventFn;
|
|
18
|
-
}
|
|
19
|
-
declare const GuiexpertTable: Component<GuiexpertTableProps>;
|
|
20
|
-
export default GuiexpertTable;
|
|
1
|
+
import { GuiexpertTableProps } from "./GuiexpertTableProps";
|
|
2
|
+
declare const _default: (props: GuiexpertTableProps) => import("solid-js").JSX.Element;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GeModelChangeEvent, GeMouseEvent, TableApi, TableModelIf, TableOptions } from '../../table/src/index.ts';
|
|
2
|
+
export type GeMouseEventFn = (evt: GeMouseEvent) => {};
|
|
3
|
+
export type GeCheckboxEventFn = (evt: any[]) => {};
|
|
4
|
+
export type GeTableReadyEventFn = (evt: TableApi) => {};
|
|
5
|
+
export type GeModelChangeEventFn = (evt: GeModelChangeEvent) => {};
|
|
6
|
+
export interface GuiexpertTableProps {
|
|
7
|
+
tableModel: TableModelIf;
|
|
8
|
+
tableOptions?: TableOptions;
|
|
9
|
+
mouseMoved?: GeMouseEventFn;
|
|
10
|
+
contextmenu?: GeMouseEventFn;
|
|
11
|
+
mouseClicked?: GeMouseEventFn;
|
|
12
|
+
mouseDragging?: GeMouseEventFn;
|
|
13
|
+
mouseDraggingEnd?: GeMouseEventFn;
|
|
14
|
+
checkboxChanged?: GeCheckboxEventFn;
|
|
15
|
+
modelChanged?: GeModelChangeEventFn;
|
|
16
|
+
tableReady?: GeTableReadyEventFn;
|
|
17
|
+
}
|
package/README.md
CHANGED
|
@@ -53,11 +53,11 @@ npm install --save @guiexpert/table @guiexpert/solid-table
|
|
|
53
53
|
|
|
54
54
|
Import the following classes in your component:
|
|
55
55
|
```
|
|
56
|
-
import {
|
|
56
|
+
import { GuiexpertTable } from "@guiexpert/solid-table";
|
|
57
57
|
import {
|
|
58
58
|
GeMouseEvent,
|
|
59
59
|
TableApi
|
|
60
|
-
|
|
60
|
+
TableFactory,
|
|
61
61
|
TableModelIf,
|
|
62
62
|
TableOptions,
|
|
63
63
|
TableOptionsIf
|
|
@@ -79,7 +79,7 @@ function App() {
|
|
|
79
79
|
|
|
80
80
|
return (
|
|
81
81
|
<div ref={ref}>
|
|
82
|
-
<
|
|
82
|
+
<GuiexpertTable
|
|
83
83
|
tableModel={tableModel}
|
|
84
84
|
tableOptions={tableOptions} />
|
|
85
85
|
</div>
|
package/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=(l,e)=>l===e,q=Symbol("solid-proxy"),ne={equals:me};let de=ce;const L=1,k=2,he={owned:null,cleanups:null,context:null,owner:null};var A=null;let Y=null,b=null,E=null,O=null,z=0;function be(l,e){const t=b,s=A,i=l.length===0,o=e===void 0?s:e,r=i?he:{owned:null,cleanups:null,context:o?o.context:null,owner:o},n=i?l:()=>l(()=>$(()=>X(r)));A=r,b=null;try{return V(n,!0)}finally{b=t,A=s}}function J(l,e,t){const s=te(l,e,!1,L);H(s)}function ye(l,e,t){de=Re;const s=te(l,e,!1,L);(!t||!t.render)&&(s.user=!0),O?O.push(s):H(s)}function we(l,e,t){t=t?Object.assign({},ne,t):ne;const s=te(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,H(s),xe.bind(s)}function $(l){if(b===null)return l();const e=b;b=null;try{return l()}finally{b=e}}function ve(l){ye(()=>$(l))}function xe(){if(this.sources&&this.state)if(this.state===L)H(this);else{const l=E;E=null,V(()=>N(this),!1),E=l}if(b){const l=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(l)):(b.sources=[this],b.sourceSlots=[l]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Ce(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&V(()=>{for(let i=0;i<l.observers.length;i+=1){const o=l.observers[i],r=Y&&Y.running;r&&Y.disposed.has(o),(r?!o.tState:!o.state)&&(o.pure?E.push(o):O.push(o),o.observers&&ue(o)),r||(o.state=L)}if(E.length>1e6)throw E=[],new Error},!1)),e}function H(l){if(!l.fn)return;X(l);const e=A,t=b,s=z;b=A=l,Ee(l,l.value,s),b=t,A=e}function Ee(l,e,t){let s;try{s=l.fn(e)}catch(i){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(X),l.owned=null),l.updatedAt=t+1,pe(i)}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Ce(l,s):l.value=s,l.updatedAt=t)}function te(l,e,t,s=L,i){const o={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:A,context:A?A.context:null,pure:t};return A===null||A!==he&&(A.owned?A.owned.push(o):A.owned=[o]),o}function G(l){if(l.state===0)return;if(l.state===k)return N(l);if(l.suspense&&$(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<z);)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===k){const s=E;E=null,V(()=>N(l,e[0]),!1),E=s}}function V(l,e){if(E)return l();let t=!1;e||(E=[]),O?t=!0:O=[],z++;try{const s=l();return Ae(t),s}catch(s){t||(O=null),E=null,pe(s)}}function Ae(l){if(E&&(ce(E),E=null),l)return;const e=O;O=null,e.length&&V(()=>de(e),!1)}function ce(l){for(let e=0;e<l.length;e++)G(l[e])}function Re(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:G(s)}for(e=0;e<t;e++)G(l[e])}function N(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const i=s.state;i===L?s!==e&&(!s.updatedAt||s.updatedAt<z)&&G(s):i===k&&N(s,e)}}}function ue(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=k,t.pure?E.push(t):O.push(t),t.observers&&ue(t))}}function X(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),i=t.observers;if(i&&i.length){const o=i.pop(),r=t.observerSlots.pop();s<i.length&&(o.sourceSlots[r]=s,i[s]=o,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)X(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 Me(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function pe(l,e=A){throw Me(l)}function W(){return!0}const Te={get(l,e,t){return e===q?t:l.get(e)},has(l,e){return e===q?!0:l.has(e)},set:W,deleteProperty:W,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:W,deleteProperty:W}},ownKeys(l){return l.keys()}};function U(l){return(l=typeof l=="function"?l():l)?l:{}}function De(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function fe(...l){let e=!1;for(let o=0;o<l.length;o++){const r=l[o];e=e||!!r&&q in r,l[o]=typeof r=="function"?(e=!0,we(r)):r}if(e)return new Proxy({get(o){for(let r=l.length-1;r>=0;r--){const n=U(l[r])[o];if(n!==void 0)return n}},has(o){for(let r=l.length-1;r>=0;r--)if(o in U(l[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<l.length;r++)o.push(...Object.keys(U(l[r])));return[...new Set(o)]}},Te);const t={},s={},i=new Set;for(let o=l.length-1;o>=0;o--){const r=l[o];if(!r)continue;const n=Object.getOwnPropertyNames(r);for(let a=0,h=n.length;a<h;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(r,d);if(!i.has(d))c.get?(i.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:De.bind(s[d]=[c.get.bind(r)])})):(c.value!==void 0&&i.add(d),t[d]=c.value);else{const p=s[d];p?c.get?p.push(c.get.bind(r)):c.value!==void 0&&p.push(()=>c.value):t[d]===void 0&&(t[d]=c.value)}}}return t}function Ie(l,e,t){let s=t.length,i=e.length,o=s,r=0,n=0,a=e[i-1].nextSibling,h=null;for(;r<i||n<o;){if(e[r]===t[n]){r++,n++;continue}for(;e[i-1]===t[o-1];)i--,o--;if(i===r){const d=o<s?n?t[n-1].nextSibling:t[o-n]:a;for(;n<o;)l.insertBefore(t[n++],d)}else if(o===n)for(;r<i;)(!h||!h.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[o-1]&&t[n]===e[i-1]){const d=e[--i].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--o],d),e[i]=t[o]}else{if(!h){h=new Map;let c=n;for(;c<o;)h.set(t[c],c++)}const d=h.get(e[r]);if(d!=null)if(n<d&&d<o){let c=r,p=1,S;for(;++c<i&&c<o&&!((S=h.get(e[c]))==null||S!==d+p);)p++;if(p>d-n){const u=e[r];for(;n<d;)l.insertBefore(t[n++],u)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function Fe(l,e,t,s={}){let i;return be(o=>{i=o,e===document?l():Be(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{i(),e.textContent=""}}function Oe(l,e,t){let s;const i=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},o=e?()=>$(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return o.cloneNode=o,o}function Le(l,e,t){return $(()=>l(e,t))}function Be(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return j(l,e,s,t);J(i=>j(l,e(),i,t),s)}function j(l,e,t,s,i){for(;typeof t=="function";)t=t();if(e===t)return t;const o=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,o==="string"||o==="number")if(o==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?n.data=e:n=document.createTextNode(e),t=P(l,t,s,n)}else t!==""&&typeof t=="string"?t=l.firstChild.data=e:t=l.textContent=e;else if(e==null||o==="boolean")t=P(l,t,s);else{if(o==="function")return J(()=>{let n=e();for(;typeof n=="function";)n=n();t=j(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(Q(n,e,t,i))return J(()=>t=j(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=P(l,t,s),r)return t}else a?t.length===0?ae(l,n,s):Ie(l,t,n):(t&&P(l),ae(l,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(r)return t=P(l,t,s,e);P(l,t,null,e)}else t==null||t===""||!l.firstChild?l.appendChild(e):l.replaceChild(e,l.firstChild);t=e}}return t}function Q(l,e,t,s){let i=!1;for(let o=0,r=e.length;o<r;o++){let n=e[o],a=t&&t[o],h;if(!(n==null||n===!0||n===!1))if((h=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))i=Q(l,n,a)||i;else if(h==="function")if(s){for(;typeof n=="function";)n=n();i=Q(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||i}else l.push(n),i=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return i}function ae(l,e,t=null){for(let s=0,i=e.length;s<i;s++)l.insertBefore(e[s],t)}function P(l,e,t,s){if(t===void 0)return l.textContent="";const i=s||document.createTextNode("");if(e.length){let o=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(i!==n){const a=n.parentNode===l;!o&&!r?a?l.replaceChild(i,n):l.insertBefore(i,t):a&&n.remove()}else o=!0}}else l.insertBefore(i,t);return[i]}class Pe{constructor(e){this.code=e}render(e,t,s,i,o,r,n){const a=fe({rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r});Fe(()=>this.code(a),e)}}class se{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,a=0,h=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=h,this.draggingY=d,this.action=c}clone(){return new se(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class B{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class ge{constructor(e=new B(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new B(">","",["ge-table-tree-arrow-collapsed"]),s=new B(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new B("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class Se{constructor(e=new B("↑","",["ge-header-sorted-asc"]),t=new B("↓","",["ge-header-sorted-desc"]),s=new B("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class $e{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,i])=>this.domService.setStyle(e,s,i+"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}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,i){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",s),this.domService.setAttribute(o,"data-side",i),this.domService.appendChild(t,o),o}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,i,o,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}`),i==="body"&&o==="center"){const h=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${h}`)}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",`${i}`),r){const h=this.domService.createText(r);this.domService.appendChild(a,h)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",a,h,d=void 0,c){const p=h==null?void 0:h.treeOptions,S=h==null?void 0:h.showCheckboxWihoutExtraColumn,u=this.domService.createElement("div");this.domService.addClass(u,"ge-table-col-div"),this.domService.addClass(u,`ge-table-col-div-${t.index}`),this.domService.setAttribute(u,"data-col-index",`${t.index}`),this.domService.setAttribute(u,"data-row-index",`${s}`),this.domService.setAttribute(u,"data-area",`${o}`);const y=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(u,`ge-table-column-${y}`),this.domService.setStyle(u,"display","clip"),this.domService.setStyle(u,"position","absolute"),this.domService.setStyle(u,"left",`${t.left}px`),this.domService.setStyle(u,"top",`${t.top}px`),this.domService.setStyle(u,"width",`${t.width}px`),this.domService.setStyle(u,"height",`${t.height}px`),a&&a!=="none"&&(this.domService.addClass(u,"ge-table-col-tree"),this.addArrowDiv(u,a,p,s,i,o)),S&&i===0&&d&&this.addCheckboxToDiv(u,d,o,s),n){const f=a!=="none"&&i===0;this.addLabelDiv(u,n,f,s,i,o)}return c&&this.addSortedIcon(u,c,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(e,u),u}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=(l,e)=>l===e,q=Symbol("solid-proxy"),ne={equals:me};let de=ce;const L=1,k=2,he={owned:null,cleanups:null,context:null,owner:null};var A=null;let Y=null,b=null,E=null,O=null,z=0;function be(l,e){const t=b,s=A,i=l.length===0,o=e===void 0?s:e,r=i?he:{owned:null,cleanups:null,context:o?o.context:null,owner:o},n=i?l:()=>l(()=>$(()=>X(r)));A=r,b=null;try{return V(n,!0)}finally{b=t,A=s}}function J(l,e,t){const s=te(l,e,!1,L);H(s)}function ye(l,e,t){de=Re;const s=te(l,e,!1,L);(!t||!t.render)&&(s.user=!0),O?O.push(s):H(s)}function we(l,e,t){t=t?Object.assign({},ne,t):ne;const s=te(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,H(s),xe.bind(s)}function $(l){if(b===null)return l();const e=b;b=null;try{return l()}finally{b=e}}function ve(l){ye(()=>$(l))}function xe(){if(this.sources&&this.state)if(this.state===L)H(this);else{const l=E;E=null,V(()=>N(this),!1),E=l}if(b){const l=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(l)):(b.sources=[this],b.sourceSlots=[l]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Ce(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&V(()=>{for(let i=0;i<l.observers.length;i+=1){const o=l.observers[i],r=Y&&Y.running;r&&Y.disposed.has(o),(r?!o.tState:!o.state)&&(o.pure?E.push(o):O.push(o),o.observers&&ue(o)),r||(o.state=L)}if(E.length>1e6)throw E=[],new Error},!1)),e}function H(l){if(!l.fn)return;X(l);const e=A,t=b,s=z;b=A=l,Ee(l,l.value,s),b=t,A=e}function Ee(l,e,t){let s;try{s=l.fn(e)}catch(i){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(X),l.owned=null),l.updatedAt=t+1,pe(i)}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Ce(l,s):l.value=s,l.updatedAt=t)}function te(l,e,t,s=L,i){const o={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:A,context:A?A.context:null,pure:t};return A===null||A!==he&&(A.owned?A.owned.push(o):A.owned=[o]),o}function G(l){if(l.state===0)return;if(l.state===k)return N(l);if(l.suspense&&$(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<z);)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===k){const s=E;E=null,V(()=>N(l,e[0]),!1),E=s}}function V(l,e){if(E)return l();let t=!1;e||(E=[]),O?t=!0:O=[],z++;try{const s=l();return Ae(t),s}catch(s){t||(O=null),E=null,pe(s)}}function Ae(l){if(E&&(ce(E),E=null),l)return;const e=O;O=null,e.length&&V(()=>de(e),!1)}function ce(l){for(let e=0;e<l.length;e++)G(l[e])}function Re(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:G(s)}for(e=0;e<t;e++)G(l[e])}function N(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const i=s.state;i===L?s!==e&&(!s.updatedAt||s.updatedAt<z)&&G(s):i===k&&N(s,e)}}}function ue(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=k,t.pure?E.push(t):O.push(t),t.observers&&ue(t))}}function X(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),i=t.observers;if(i&&i.length){const o=i.pop(),r=t.observerSlots.pop();s<i.length&&(o.sourceSlots[r]=s,i[s]=o,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)X(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 Me(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function pe(l,e=A){throw Me(l)}function W(){return!0}const Te={get(l,e,t){return e===q?t:l.get(e)},has(l,e){return e===q?!0:l.has(e)},set:W,deleteProperty:W,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:W,deleteProperty:W}},ownKeys(l){return l.keys()}};function U(l){return(l=typeof l=="function"?l():l)?l:{}}function De(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function fe(...l){let e=!1;for(let o=0;o<l.length;o++){const r=l[o];e=e||!!r&&q in r,l[o]=typeof r=="function"?(e=!0,we(r)):r}if(e)return new Proxy({get(o){for(let r=l.length-1;r>=0;r--){const n=U(l[r])[o];if(n!==void 0)return n}},has(o){for(let r=l.length-1;r>=0;r--)if(o in U(l[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<l.length;r++)o.push(...Object.keys(U(l[r])));return[...new Set(o)]}},Te);const t={},s={},i=new Set;for(let o=l.length-1;o>=0;o--){const r=l[o];if(!r)continue;const n=Object.getOwnPropertyNames(r);for(let a=0,h=n.length;a<h;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(r,d);if(!i.has(d))c.get?(i.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:De.bind(s[d]=[c.get.bind(r)])})):(c.value!==void 0&&i.add(d),t[d]=c.value);else{const p=s[d];p?c.get?p.push(c.get.bind(r)):c.value!==void 0&&p.push(()=>c.value):t[d]===void 0&&(t[d]=c.value)}}}return t}function Ie(l,e,t){let s=t.length,i=e.length,o=s,r=0,n=0,a=e[i-1].nextSibling,h=null;for(;r<i||n<o;){if(e[r]===t[n]){r++,n++;continue}for(;e[i-1]===t[o-1];)i--,o--;if(i===r){const d=o<s?n?t[n-1].nextSibling:t[o-n]:a;for(;n<o;)l.insertBefore(t[n++],d)}else if(o===n)for(;r<i;)(!h||!h.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[o-1]&&t[n]===e[i-1]){const d=e[--i].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--o],d),e[i]=t[o]}else{if(!h){h=new Map;let c=n;for(;c<o;)h.set(t[c],c++)}const d=h.get(e[r]);if(d!=null)if(n<d&&d<o){let c=r,p=1,S;for(;++c<i&&c<o&&!((S=h.get(e[c]))==null||S!==d+p);)p++;if(p>d-n){const u=e[r];for(;n<d;)l.insertBefore(t[n++],u)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function Fe(l,e,t,s={}){let i;return be(o=>{i=o,e===document?l():Pe(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{i(),e.textContent=""}}function Oe(l,e,t){let s;const i=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},o=e?()=>$(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return o.cloneNode=o,o}function Le(l,e,t){return $(()=>l(e,t))}function Pe(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return j(l,e,s,t);J(i=>j(l,e(),i,t),s)}function j(l,e,t,s,i){for(;typeof t=="function";)t=t();if(e===t)return t;const o=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,o==="string"||o==="number")if(o==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?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||o==="boolean")t=B(l,t,s);else{if(o==="function")return J(()=>{let n=e();for(;typeof n=="function";)n=n();t=j(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(Q(n,e,t,i))return J(()=>t=j(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=B(l,t,s),r)return t}else a?t.length===0?ae(l,n,s):Ie(l,t,n):(t&&B(l),ae(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 Q(l,e,t,s){let i=!1;for(let o=0,r=e.length;o<r;o++){let n=e[o],a=t&&t[o],h;if(!(n==null||n===!0||n===!1))if((h=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))i=Q(l,n,a)||i;else if(h==="function")if(s){for(;typeof n=="function";)n=n();i=Q(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||i}else l.push(n),i=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return i}function ae(l,e,t=null){for(let s=0,i=e.length;s<i;s++)l.insertBefore(e[s],t)}function B(l,e,t,s){if(t===void 0)return l.textContent="";const i=s||document.createTextNode("");if(e.length){let o=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(i!==n){const a=n.parentNode===l;!o&&!r?a?l.replaceChild(i,n):l.insertBefore(i,t):a&&n.remove()}else o=!0}}else l.insertBefore(i,t);return[i]}class Be{constructor(e){this.code=e}render(e,t,s,i,o,r,n){const a=fe({rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r});Fe(()=>this.code(a),e)}}const $e=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class se{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,a=0,h=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=h,this.draggingY=d,this.action=c}clone(){return new se(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class P{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class ge{constructor(e=new P(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new P(">","",["ge-table-tree-arrow-collapsed"]),s=new P(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new P("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class Se{constructor(e=new P("↑","",["ge-header-sorted-asc"]),t=new P("↓","",["ge-header-sorted-desc"]),s=new P("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class He{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,i])=>this.domService.setStyle(e,s,i+"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}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,i){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",s),this.domService.setAttribute(o,"data-side",i),this.domService.appendChild(t,o),o}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,i,o,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}`),i==="body"&&o==="center"){const h=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${h}`)}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",`${i}`),r){const h=this.domService.createText(r);this.domService.appendChild(a,h)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",a,h,d=void 0,c){const p=h==null?void 0:h.treeOptions,S=h==null?void 0:h.showCheckboxWihoutExtraColumn,u=this.domService.createElement("div");this.domService.addClass(u,"ge-table-col-div"),this.domService.addClass(u,`ge-table-col-div-${t.index}`),this.domService.setAttribute(u,"data-col-index",`${t.index}`),this.domService.setAttribute(u,"data-row-index",`${s}`),this.domService.setAttribute(u,"data-area",`${o}`);const y=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(u,`ge-table-column-${y}`),this.domService.setStyle(u,"display","clip"),this.domService.setStyle(u,"position","absolute"),this.domService.setStyle(u,"left",`${t.left}px`),this.domService.setStyle(u,"top",`${t.top}px`),this.domService.setStyle(u,"width",`${t.width}px`),this.domService.setStyle(u,"height",`${t.height}px`),a&&a!=="none"&&(this.domService.addClass(u,"ge-table-col-tree"),this.addArrowDiv(u,a,p,s,i,o)),S&&i===0&&d&&this.addCheckboxToDiv(u,d,o,s),n){const f=a!=="none"&&i===0;this.addLabelDiv(u,n,f,s,i,o)}return c&&this.addSortedIcon(u,c,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(e,u),u}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
|
|
2
2
|
<input
|
|
3
3
|
type="checkbox"
|
|
4
4
|
data-area="${s}"
|
|
5
5
|
data-row-index="${i}"
|
|
6
6
|
data-input-type="checkbox"
|
|
7
7
|
${r}
|
|
8
|
-
class="ge-table-row-checkbox"> `,this.domService.setStyle(o,"display","inline"),this.domService.setStyle(o,"width","inherit"),this.domService.setAttribute(o,"data-row-index",`${i}`),this.domService.appendChild(e,o),o}addLabelDiv(e,t="",s=!1,i=-1,o=-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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),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 h=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,h),this.domService.setAttribute(a,"data-row-index",`${i}`),this.domService.setAttribute(a,"data-col-index",`${o}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Se,i=-1){const o=this.domService.createElement("div");this.domService.addClass(o,"ge-table-sorted-icon-div"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"top","0"),this.domService.setStyle(o,"right","0"),this.domService.setStyle(o,"width","20px"),this.domService.setStyle(o,"background","transparent"),this.domService.setStyle(o,"cursor","pointer"),this.domService.setAttribute(o,"data-col-index",`${i}`),this.domService.setAttribute(o,"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(o,a),r.style&&this.applyStyleString(o,r.style);for(const h of r.classes)this.domService.addClass(o,h);return this.domService.appendChild(e,o),o}addArrowDiv(e,t="none",s=new ge,i=-1,o=-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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const h=a.content,d=this.domService.createText(h);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const c of a.classes)this.domService.addClass(n,c);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,i,o){if(e.verticalBorderVisible){const r=`ge-table-${i}-${o}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${o}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width",`${e.width}px`),this.domService.setStyle(i,"height","1px"),this.domService.appendChild(t,i),i}addFocusBorderDivs(e,t,s){let i=this.domService.createElement("div");return this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left+t.width-1}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top+t.height-1}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${e.height}px`),this.domService.appendChild(t,i),i}addDiv(e,t,s=""){const i=this.domService.createElement("div");return s&&this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height",`${t.height}px`),this.domService.appendChild(e,i),i}applyStyleString(e,t){const s=t.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[o,r]=i.split(":");this.domService.setStyle(e,o.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)}}class Z{constructor(e,t=!0,s,i,o=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=i,this.deep=o,this.checked=r,this.keep=n}}const ie=l=>l==="header"?"header":l==="footer"?"footer":"body";class He{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=ie(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.value}}}}class Ve{constructor(e){this.tableScope=e,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,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=new He(e.target,this.tableScope);if(t.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(t.inputType==="checkbox"&&t.areaIdent)this.tableScope.toggleRowCheckbox(t.rowIdx,t.colIdx,t.areaIdent),e.preventDefault(),e.stopPropagation();else if(t.row instanceof Z&&t.areaModel){const s=t.colIdx===this.getArrowColumnIndex()&&e.altKey,i=t.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const o=t.row;o.expanded=!o.expanded,"recalcVisibleTreeRows"in t.areaModel&&t.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(o)}}if(t.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),i=ie(s),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(i);if(s&&i==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,o,r));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(o);if(s&&i==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),a instanceof Z&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const h=a;h.expanded=!h.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(h)}}}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)}updateCollapsedExpandedState(e){var s,i,o,r,n;const t=(i=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:i.getRowId;if(t){const a=(o=this.tableScope.storeStateCollapsedExpandService)==null?void 0:o.collapsedExpandedStateGet().mode,h=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,c=t(e.data);h?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(c):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(c))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){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=!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}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)}}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 _e{constructor(e){this.tableScope=e}updateCells(e){this.tableScope.updateCells(e)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){}scrollToIndex(e=0,t=0){}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}}class We{flattenTree(e,t=[]){var s;for(const i of e)this.isVisible(i)&&t.push(i),(s=i.children)!=null&&s.length&&this.flattenTree(i.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class ke{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(i=>i.rendererMap[e])}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){return this.columnDefs&&t<this.columnDefs.length&&this.columnDefs[t].editable?this.columnDefs[t].editable():!1}setValue(e,t,s){var n;const i=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;i&&(s=i(s,e,t));const o=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(o,r.split("."),s):(o[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const i=t.shift();if(i){let o=e[i];return o&&t.length?this.setPropertyValue(o,t,s):(e[i]=s,!0)}return!1}arrayMove(e,t,s){const i=e.splice(t,1)[0];return e.splice(s,0,i),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class Ge{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const i=e,o=t;if(i.length&&o.length)return this.genericSortComparator(i[0],o[0],s)}return s*(""+e).localeCompare(""+t)}}class ee extends ke{constructor(e,t,s,i=[]){super(e,i,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=i,this.sorterService=new Ge,this.service=new We,this.properties=i.map(o=>o.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const i=this.properties[t];if(i)return i.includes(".")?this.getPropertyValue(s.data,i.split(".")):s.data[i]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:s}=e[e.length-1],i=s==="asc"?1:s==="desc"?-1:0,o=this.properties[t];return this.treeSort(this.rows,o,i),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,s){var r;const i=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;i&&(s=i(s,e,t));const o=this.getRowByIndex(e);if(o){const n=o.data,a=this.columnDefs[t].property;return a.includes(".")?this.setPropertyValue(n,a.split("."),s):(n[a]=s,!0)}return!1}genericTreeTableSortComparator(e,t){return(s,i)=>{const o=this.getValueByT(s.data,e),r=this.getValueByT(i.data,e);return this.sorterService.genericSortComparator(o,r,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(s=>{e=Math.max(e,s.deep)});const t=this.flattenRows.filter((s,i,o)=>this.lastPredictFn(s,i,o));this.flattenRows.forEach(s=>s.keep=!1),this.flattenRows.forEach(s=>{t.includes(s)&&(s.keep=!0,this.setAllParentsOk(s))}),this.filteredFlattenRows=this.flattenRows.filter((s,i,o)=>s.keep)}}getPropertyValue(e,t){const s=t.shift();let i=e[s];return i&&t.length?this.getPropertyValue(i,t):i}treeSort(e,t,s){e.sort(this.genericTreeTableSortComparator(t,s));for(const i of e)i.children&&this.treeSort(i.children,t,s)}}class oe{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const i of[...s]){const[o,r]=i;t[o]=r}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const i=s();if(i){const o=i+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(o,r)}else this.persistItem(o,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 Ne extends oe{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 i=this.loadFromLocalStorage(s);this.scrollOffset=i||[0,0]}}}}class je{constructor(e="collapsed",t=[],s=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=i}}class ze extends oe{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new je,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,i=this.loadFromLocalStorage(s);i&&(this.collapsedExpandedState=i)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Xe extends oe{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;let i=this.loadFromLocalStorage(s);this.sortItems=i||[]}}}}class F{constructor(e=0,t=0,s=0,i=0,o){this.left=e,this.width=t,this.height=s,this.top=i,this.index=o}}class Ke{constructor(e,t,s,i){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=i,this.scrollTop=0,this.areaBodyWestGeo=new F,this.areaBodyCenterGeo=new F,this.areaBodyEastGeo=new F;const o=this.hostElement;o.innerText="",this.dom.setAttribute(o,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",o),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",o)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",o)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",o,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",o,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",o,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",o,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",o,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",o,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",o,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",o,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",o,"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",o)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",o)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",o)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",o))}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 T{constructor(e,t,s,i,o=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=i,this.gammaRange=o}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new T(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new T(e,t,e,t)}static singleRow(e){return new T(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new T(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Ye{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 i=0;i<t;i++){let o=this.areaModel.getColspanAt(s,i),r=this.areaModel.getRowspanAt(s,i);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new T(s,i,s+r-1,i+o-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 Ue{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class qe extends Ke{constructor(e,t,s,i){var r,n;super(e,t,s,i),this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new Ue,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.editing=!1,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),t.getAreaModel("body")instanceof ee&&(this.tree=!0),["header","body","footer"].forEach(a=>{var h;this.colAndRowspanModels[a]=new Ye(t,t.getAreaModel(a)),(h=this.colAndRowspanModels[a])==null||h.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(){if(this.getSelectionModel){const e=this.getSelectionModel();e==null||e.clear()}}initRenderEditor(e,t){var i;let s=(i=this.tableModel.getColumnDef(t))==null?void 0:i.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 o=document.querySelector("input.ge-table-cell-editor-input");o&&o.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(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 F(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 F(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){e.forEach(t=>this.tableModel.getAreaModel(t.area).setValue(t.rowIndex,t.columnIndex,t.value)),this.repaint()}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 i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var f;const s=this.getArea(e,"west"),i=this.getArea(e,"center"),o=this.getArea(e,"east"),r=i.child.clientHeight;s.child.innerText="",i.child.innerText="",o.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,h=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),c=d.getRowCount();for(;this.cleanupFunctions[e].length;){const g=this.cleanupFunctions[e].shift();g&&g()}let p=t;const S=this.tableModel.getColumnCount(),u=this.tableModel.getFixedRightColumnCount(),y=this.tableModel.getFixedLeftColumnCount();for(let g=0;g<c;g++){const x=p,C=g===c-1,R=this.tableModel.getRowHeight(e,g);if(x+R>0){this.firstVisibleRowIndex=g;let v={left:n,width:a,height:R,top:x,index:g},m=this.dom.addRowDiv(i,v,g,e,"center");const I=y;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:I,columnIndexEnd:S-u-1,verticalFixed:!1,lastRowOfModel:C}),h.left>0&&(v={left:n,width:this.areaBodyWestGeo.width,height:R,top:x,index:g},m=this.dom.addRowDiv(s,v,g,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:0,columnIndexEnd:I-1,verticalFixed:!0,lastRowOfModel:C})),h.right>0&&(v={left:n,width:this.areaBodyEastGeo.width,height:R,top:x,index:g},m=this.dom.addRowDiv(o,v,g,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:S-u,columnIndexEnd:S-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&g===c-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new F(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(M,_),D.style&&this.dom.applyStyleString(M,D.style)}}}if(p=p+R,p>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const g=((f=this.colAndRowspanModels[e])==null?void 0:f.getRanges())??[];if(g.length)for(const x of g){let C=0,R=i.child,v="center";if(x.c1<y)R=s.child,v="west";else if(u>0&&x.c1>=S-u)R=o.child,v="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*m-this.areaBodyWestGeo.width,v="center"}this.drawBigCell(x,C,t,d,R,v)}}}drawBigCell(e,t,s,i,o,r){const n=s+this.getRowHeights(0,e.r1-1,i).reduce((f,g)=>f+g,0),a=this.tableModel.getColumnCount(),h=this.tableModel.getFixedRightColumnCount();let d=0;h>0&&e.c1>=a-h&&(d=a-h);const c=t+this.getColumnWidths(d,e.c1-1).reduce((f,g)=>f+g,0),p=this.getRowHeights(e.r1,e.r2,i).reduce((f,g)=>f+g,0),S=this.getColumnWidths(e.c1,e.c2).reduce((f,g)=>f+g,0);let u=!1;const y=this.getSelectionModel?this.getSelectionModel():void 0;y&&(u=y.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:S,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:S,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:c,cellTop:n,cellWidth:S,cellHeight:p,parent:o})}findRowOfImportantRowspanCell(e,t,s){const i=e.getMaxRowspan();for(let o=t-1;o>-1;o--){const r=e.getRowspanAt(o,s);if(r>1&&o+r+1>=t)return o;if(t-o>i)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:i,parent:o,rowIndex:r,columnIndexStart:n,columnIndexEnd:a,verticalFixed:h=!1,lastRowOfModel:d=!1}){var y;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let c=0;if(!h){const f=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();c=this.scrollFactorX*f}const p=0,S=!!(e==="body"&&t);let u=c;for(let f=n;f<=a;f++){const g=u,x=this.tableModel.getColumnWidth(f);if(x>0&&g+x>0){let C=i.height;const R=s.getRowspanAt(r,f),v=s.getColspanAt(r,f);R>1&&(C=this.getRowHeights(r,r+R-1,s).reduce((M,D)=>M+D,0));let m=x;v>1&&(m=this.getColumnWidths(f,f+v-1).reduce((M,D)=>M+D,0));let I=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(y=this.colAndRowspanModels[e])!=null&&y.isInRange(r,f)&&(I=!0),this.draggingTargetColumnIndex===f&&e!=="header"){this.renderDragTargetDiv(o,g,p,m,C);const M={left:g,top:p,width:m,height:C};this.dom.addColumnBorderDivs(this.tableOptions,o,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(I,S,t,s,r,f,o,g,p,m,C);I||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:f,left:g,top:p,width:m,height:C,parent:o,cellSelected:M,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:f,cellLeft:g,cellTop:p,cellWidth:m,cellHeight:C,parent:o})}}if(u=u+x,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new F(u-1,1,i.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:n,height:a,top:h,parent:d,lastRowOfModel:c}){var re;const S=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(i,o),u={left:r,width:n,height:a,top:h,index:o},y=e.getRowByIndex(i);let f="none";if(o===this.getTreeArrowColumnIndex()&&y instanceof Z){const w=y;(re=w.children)!=null&&re.length?w.expanded?f="expanded":f="collapsed":f="hidden"}let x;if(t==="header"){const w=this.tableModel.getColumnDef(o);(!(w!=null&&w.sortIconVisible)||w!=null&&w.sortIconVisible())&&(x=w==null?void 0:w.sortState)}const C=e.getValueAt(i,o),R=S?"":`${C}`,v=e.isRowChecked(i),m=this.dom.addColumnDiv(d,u,i,o,t,s,R,f,this.tableOptions,v,x),I=e.getTooltipAt(i,o);I&&this.dom.setAttribute(m,"title",I);const M=this.tableModel.getColumnDef(o);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],m);let D;S&&(D=S.render(m,i,o,t,e,C,this.dom.domService));const _=e.getCustomClassesAt(i,o);if(_.length&&this.dom.addClasses(_,m),this.dom.addColumnBorderDivs(this.tableOptions,d,u,t,s),c&&this.dom.addHorizontalBorder({left:r,width:n,height:a,top:h+a},d),this.getFocusModel&&t==="body"){const w=this.getFocusModel();w!=null&&w.hasFocus(i,o)&&this.dom.addFocusBorderDivs(d,u,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const K=e.getCustomStyleAt(i,o);if(K)for(const w in K)this.dom.setStyle(m,w,K[w]);return[m,D]}getColumnWidths(e,t){const s=[];for(let i=e;i<=t;i++)s.push(this.tableModel.getColumnWidth(i));return s}getRowHeights(e,t,s){const i=[];for(let o=e;o<=t;o++)i.push(s.getRowHeight(o));return i}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"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),i=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:o+"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)}renderDragTargetDiv(e,t,s,i,o){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",`${i}px`),this.dom.setStyle(r,"height",`${o}px`),r}renderSelectedBackgroundDiv(e,t,s,i,o,r,n,a,h,d,c){let p=!1;if(!e&&t&&i.isSelectable(o,r)&&this.getSelectionModel){const S=this.getSelectionModel();if(S){const u=S.getSelectionCount(o,r);p=u>0;for(let y=0;y<u;y++){const f=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(f,"left",`${a}px`),this.dom.setStyle(f,"top",`${h}px`),this.dom.setStyle(f,"width",`${d}px`),this.dom.setStyle(f,"height",`${c}px`)}}}return p}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,columnIndex:o,left:r,top:n,width:a,height:h,parent:d,cellSelected:c,lastRowOfModel:p,gammaRange:S}){const[u,y]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:a,height:h,top:n,parent:d,lastRowOfModel:p,gammaRange:S});c&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,u),y&&this.cleanupFunctions[t].push(y)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:i,cellWidth:o,cellHeight:r,parent:n}){const a=this.dom.domService,h=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+o-h}px`),a.setStyle(d,"top",`${i}px`),a.setStyle(d,"width",`${h}px`),a.setStyle(d,"height",`${r}px`),a.appendChild(n,d)}}class Je{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Qe{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"),i=t.getAttribute("data-row-index"),o=t.getAttribute("data-col-index");if(s&&i&&o){const r=ie(s),n=Number(i),a=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,a,t.value)}}}}class Ze{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class le{constructor(e){this.cells=e}static createSingle(e,t){return new le([new Ze(e,t)])}}class et{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 o,r,n,a,h,d,c;let s=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const p=this.getSelectionModel(),S=this.getFocusModel();p&&S&&(S.hasFocus(e.rowIndex,e.columnIndex)||(S.setFocus(e.rowIndex,e.columnIndex),s=!0),(o=e.originalEvent)!=null&&o.shiftKey||p.hasSelection()&&(p.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(p.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,s=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey?(p.addSelection(T.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0):(h=e.originalEvent)!=null&&h.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)&&(p.removeSelection(T.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0))}return i?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[i,o]=s.getFocus();return t.togglePoint(i,o),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return T.create({rowIndex1:s,columnIndex1:o,rowIndex2:i,columnIndex2:r})}}class tt{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","cmd -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class st{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","cmd+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","cmd+x":"DESELECT_ALL","cmd+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"}}}class it{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.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new st().get()):Object.assign(this.shortcutActionIdMapping,new tt().get()),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}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.findEnty(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}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);for(const s in this.shortcutActionIdMapping){const i=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[\+ ]/g).sort();if(this.areTokensEquals(t,i))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()}}class ot{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class lt extends qe{constructor(e,t,s,i,o){var r;if(super(e,t,new $e(s),i),this.eventListener=o,this.selectionService=new et(this),this.api=new _e(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new ot),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,a=n.getStorageKeyFn;a&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ne(a)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new ze(a)),n.autoRestoreSortingState&&(this.storeSortingService=new Xe(a)))}this.mouseHandler=new Ve(this),this.inputHandler=new Qe(this),this.shortcutService=new it(this),this.shortcutService.addListener(this.selectionService)}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,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,i)&&(this.clearSelection(),this.initRenderEditor(s,i))}return!0}return!1}updateModelValueAfterEdit(e,t,s,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(le.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition()}createGeMouseEvent(e){const t=new se;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 i=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=i.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const i=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,o=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(o,i)}}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.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e){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.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&this.repaint(),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,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();t instanceof ee&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const i=this.tableModel.getAreaModel(s),o=i.isRowChecked(e),r=o===void 0||o==="semi"||o==="none";i.setRowChecked(e,r),this.repaint();const n=(a=i.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){const i=this.getFocusModel();i&&(s=i.hasChanged(),i.clearChanged(),s&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),s&&this.debounce(this.repaint.bind(this),10)}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 o,r;const i=this.tableModel.getColumnDef(s);if(i!=null&&i.sortable&&i.sortable()){e.preventDefault(),e.stopPropagation();const n=i.sortStatesOrder?i.sortStatesOrder:this.tableOptions.sortOrder,a=i.sortState??"",h=n[(n.indexOf(a)+1)%n.length],d=new Je(s,h);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(p=>p.sortState=""),i.sortState=h),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[i,o]=s.getFocus();return s.setFocus(i+t,o+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,i=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&i){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(r instanceof ee){const n=r,a=r.getRowCount();for(let h=0;h<a;h++){const d=r.getRowByIndex(h);if(d)if(o.allExpanded)d.expanded=!0;else if(o.allCollapsed)d.expanded=!1;else{const c=i(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c))}}n.recalcVisibleTreeRows()}}}}}class rt{render(e,t,s,i,o,r,n){if(o.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=o.getValueAt(t,s);e.innerHTML=`
|
|
8
|
+
class="ge-table-row-checkbox"> `,this.domService.setStyle(o,"display","inline"),this.domService.setStyle(o,"width","inherit"),this.domService.setAttribute(o,"data-row-index",`${i}`),this.domService.appendChild(e,o),o}addLabelDiv(e,t="",s=!1,i=-1,o=-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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),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 h=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,h),this.domService.setAttribute(a,"data-row-index",`${i}`),this.domService.setAttribute(a,"data-col-index",`${o}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Se,i=-1){const o=this.domService.createElement("div");this.domService.addClass(o,"ge-table-sorted-icon-div"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"top","0"),this.domService.setStyle(o,"right","0"),this.domService.setStyle(o,"width","20px"),this.domService.setStyle(o,"background","transparent"),this.domService.setStyle(o,"cursor","pointer"),this.domService.setAttribute(o,"data-col-index",`${i}`),this.domService.setAttribute(o,"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(o,a),r.style&&this.applyStyleString(o,r.style);for(const h of r.classes)this.domService.addClass(o,h);return this.domService.appendChild(e,o),o}addArrowDiv(e,t="none",s=new ge,i=-1,o=-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",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const h=a.content,d=this.domService.createText(h);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const c of a.classes)this.domService.addClass(n,c);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,i,o){if(e.verticalBorderVisible){const r=`ge-table-${i}-${o}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${o}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width",`${e.width}px`),this.domService.setStyle(i,"height","1px"),this.domService.appendChild(t,i),i}addFocusBorderDivs(e,t,s){let i=this.domService.createElement("div");return this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left+t.width-1}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top+t.height-1}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${e.height}px`),this.domService.appendChild(t,i),i}addDiv(e,t,s=""){const i=this.domService.createElement("div");return s&&this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height",`${t.height}px`),this.domService.appendChild(e,i),i}applyStyleString(e,t){const s=t.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[o,r]=i.split(":");this.domService.setStyle(e,o.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)}}class Z{constructor(e,t=!0,s,i,o=0,r=!1,n=!1){this.data=e,this.expanded=t,this.children=s,this.parent=i,this.deep=o,this.checked=r,this.keep=n}}const ie=l=>l==="header"?"header":l==="footer"?"footer":"body";class Ve{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=ie(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.value}}}}class _e{constructor(e){this.tableScope=e,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,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=new Ve(e.target,this.tableScope);if(t.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(t.inputType==="checkbox"&&t.areaIdent)this.tableScope.toggleRowCheckbox(t.rowIdx,t.colIdx,t.areaIdent),e.preventDefault(),e.stopPropagation();else if(t.row instanceof Z&&t.areaModel){const s=t.colIdx===this.getArrowColumnIndex()&&e.altKey,i=t.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const o=t.row;o.expanded=!o.expanded,"recalcVisibleTreeRows"in t.areaModel&&t.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(o)}}if(t.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),i=ie(s),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(i);if(s&&i==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,o,r));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(o);if(s&&i==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),a instanceof Z&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const h=a;h.expanded=!h.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(h)}}}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)}updateCollapsedExpandedState(e){var s,i,o,r,n;const t=(i=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:i.getRowId;if(t){const a=(o=this.tableScope.storeStateCollapsedExpandService)==null?void 0:o.collapsedExpandedStateGet().mode,h=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,c=t(e.data);h?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(c):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(c))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){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=!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}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)}}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 We{constructor(e){this.tableScope=e}updateCells(e){this.tableScope.updateCells(e)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){}scrollToIndex(e=0,t=0){}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}}class ke{flattenTree(e,t=[]){var s;for(const i of e)this.isVisible(i)&&t.push(i),(s=i.children)!=null&&s.length&&this.flattenTree(i.children,t);return t}isVisible(e){return e.parent?e.parent.expanded?this.isVisible(e.parent):!1:!0}}class Ge{constructor(e,t=[],s=-1){this.areaIdent=e,this.columnDefs=t,this.defaultRowHeight=s,this.rowSelectionModel=void 0,this.yPositions=[],this.cellRenderers=t.map(i=>i.rendererMap[e])}getTooltipAt(e,t){return""}getCellRenderer(e,t){if(t<this.cellRenderers.length)return this.cellRenderers[t]}getColspanAt(e,t){return 0}getCustomClassesAt(e,t){return[]}getCustomStyleAt(e,t){}getRowspanAt(e,t){return 0}getRowByIndex(e){}isRowCheckable(e){return!0}isRowChecked(e){var s;const t=this.getRowByIndex(e);return(s=this.rowSelectionModel)==null?void 0:s.isRowChecked(t)}setRowChecked(e,t){if(this.rowSelectionModel){const s=this.getRowByIndex(e);this.rowSelectionModel.checkRow(s,t)}}getMaxColspan(){return 31}getMaxRowspan(){return 31}getYPosByRowIndex(e){return this.defaultRowHeight>0?this.defaultRowHeight*e:this.yPositions[e]}init(){!this.yPositions.length&&this.getRowCount()!==void 0&&this.defaultRowHeight===-1&&this.calcYPositions()}isFilterable(){return this.areaIdent==="body"}doSort(e){return!1}isEditable(e,t){return this.columnDefs&&t<this.columnDefs.length&&this.columnDefs[t].editable?this.columnDefs[t].editable():!1}setValue(e,t,s){var n;const i=(n=this.columnDefs[t])==null?void 0:n.editInputPipe;i&&(s=i(s,e,t));const o=this.getRowByIndex(e),r=this.columnDefs[t].property;return r.includes(".")?this.setPropertyValue(o,r.split("."),s):(o[r]=s,!0)}isSelectable(e,t){return!0}changeColumnOrder(e,t){this.arrayMove(this.cellRenderers,e,t)}setPropertyValue(e,t,s){const i=t.shift();if(i){let o=e[i];return o&&t.length?this.setPropertyValue(o,t,s):(e[i]=s,!0)}return!1}arrayMove(e,t,s){const i=e.splice(t,1)[0];return e.splice(s,0,i),e}calcYPositions(){const e=this.getRowCount();this.yPositions=new Array(e+1),this.yPositions[0]=0;for(let t=0;t<e;t++)this.yPositions[t+1]=this.getRowHeight(t)+this.yPositions[t]}}class Ne{genericSortComparator(e,t,s){if(typeof e=="number"&&typeof t=="number")return s*(e-t);if(typeof e=="string"&&typeof t=="string")return s*e.localeCompare(t);if(typeof e=="boolean"&&typeof t=="boolean")return s*((e?-1:1)-(t?-1:1));if(e instanceof Date&&t instanceof Date)return s*(e.getTime()-t.getTime());if(e instanceof Array&&t instanceof Array){const i=e,o=t;if(i.length&&o.length)return this.genericSortComparator(i[0],o[0],s)}return s*(""+e).localeCompare(""+t)}}class ee extends Ge{constructor(e,t,s,i=[]){super(e,i,s),this.areaIdent=e,this.rows=t,this.defaultRowHeight=s,this.columnDefs=i,this.sorterService=new Ne,this.service=new ke,this.properties=i.map(o=>o.property),this.flattenRows=this.service.flattenTree(t),this.filteredFlattenRows=[...this.flattenRows]}changeColumnOrder(e,t){this.arrayMove(this.properties,e,t),super.changeColumnOrder(e,t)}recalcVisibleTreeRows(){this.filteredFlattenRows=this.service.flattenTree(this.rows)}getFilteredFlattenRows(){return this.filteredFlattenRows}getRowCount(){let e=0;for(const t of this.filteredFlattenRows)this.service.isVisible(t)&&e++;return e}getValueAt(e,t){const s=this.getRowByIndex(e);if(s){const i=this.properties[t];if(i)return i.includes(".")?this.getPropertyValue(s.data,i.split(".")):s.data[i]}return""}getRowHeight(e){return this.defaultRowHeight}getCustomClassesAt(e,t){return["ge-table-tree-cell","ge-table-tree-deep-"+this.filteredFlattenRows[e].deep]}getRowByIndex(e){return this.filteredFlattenRows[e]}getValueByT(e,t){return t.includes(".")?this.getPropertyValue(e,t.split(".")):e[t]}externalFilterChanged(e){this.lastPredictFn=e,this.doFiltering()}doSort(e){const{columnIndex:t,sortState:s}=e[e.length-1],i=s==="asc"?1:s==="desc"?-1:0,o=this.properties[t];return this.treeSort(this.rows,o,i),this.flattenRows=this.service.flattenTree(this.rows),this.filteredFlattenRows=[...this.flattenRows],!0}toggleExpandCollapseAll(e){this.expandAllRecursive(this.rows,e),this.flattenRows=this.service.flattenTree(this.rows),this.doFiltering()}setAllParentsOk(e){return e.parent&&(e.parent.keep=!0,this.setAllParentsOk(e.parent)),!1}setValue(e,t,s){var r;const i=(r=this.columnDefs[t])==null?void 0:r.editInputPipe;i&&(s=i(s,e,t));const o=this.getRowByIndex(e);if(o){const n=o.data,a=this.columnDefs[t].property;return a.includes(".")?this.setPropertyValue(n,a.split("."),s):(n[a]=s,!0)}return!1}genericTreeTableSortComparator(e,t){return(s,i)=>{const o=this.getValueByT(s.data,e),r=this.getValueByT(i.data,e);return this.sorterService.genericSortComparator(o,r,t)}}expandAllRecursive(e,t){for(const s of e)s.expanded=t,s.children&&this.expandAllRecursive(s.children,t)}doFiltering(){if(!this.lastPredictFn)this.filteredFlattenRows=[...this.flattenRows?this.flattenRows:[]];else{this.flattenRows||(this.flattenRows=[]);let e=0;this.flattenRows.forEach(s=>{e=Math.max(e,s.deep)});const t=this.flattenRows.filter((s,i,o)=>this.lastPredictFn(s,i,o));this.flattenRows.forEach(s=>s.keep=!1),this.flattenRows.forEach(s=>{t.includes(s)&&(s.keep=!0,this.setAllParentsOk(s))}),this.filteredFlattenRows=this.flattenRows.filter((s,i,o)=>s.keep)}}getPropertyValue(e,t){const s=t.shift();let i=e[s];return i&&t.length?this.getPropertyValue(i,t):i}treeSort(e,t,s){e.sort(this.genericTreeTableSortComparator(t,s));for(const i of e)i.children&&this.treeSort(i.children,t,s)}}class oe{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const i of[...s]){const[o,r]=i;t[o]=r}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const i=s();if(i){const o=i+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(o,r)}else this.persistItem(o,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 je extends oe{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 i=this.loadFromLocalStorage(s);this.scrollOffset=i||[0,0]}}}}class ze{constructor(e="collapsed",t=[],s=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=i}}class Xe extends oe{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ze,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,i=this.loadFromLocalStorage(s);i&&(this.collapsedExpandedState=i)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Ke extends oe{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;let i=this.loadFromLocalStorage(s);this.sortItems=i||[]}}}}class F{constructor(e=0,t=0,s=0,i=0,o){this.left=e,this.width=t,this.height=s,this.top=i,this.index=o}}class Ye{constructor(e,t,s,i){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=i,this.scrollTop=0,this.areaBodyWestGeo=new F,this.areaBodyCenterGeo=new F,this.areaBodyEastGeo=new F;const o=this.hostElement;o.innerText="",this.dom.setAttribute(o,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",o),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",o)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",o)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",o,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",o,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",o,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",o,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",o,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",o,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",o,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",o,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",o,"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",o)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",o)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",o)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",o))}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 T{constructor(e,t,s,i,o=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=i,this.gammaRange=o}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new T(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new T(e,t,e,t)}static singleRow(e){return new T(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new T(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Ue{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 i=0;i<t;i++){let o=this.areaModel.getColspanAt(s,i),r=this.areaModel.getRowspanAt(s,i);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new T(s,i,s+r-1,i+o-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 qe{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class Je extends Ye{constructor(e,t,s,i){var r,n;super(e,t,s,i),this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new qe,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.editing=!1,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),t.getAreaModel("body")instanceof ee&&(this.tree=!0),["header","body","footer"].forEach(a=>{var h;this.colAndRowspanModels[a]=new Ue(t,t.getAreaModel(a)),(h=this.colAndRowspanModels[a])==null||h.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(){if(this.getSelectionModel){const e=this.getSelectionModel();e==null||e.clear()}}initRenderEditor(e,t){var i;let s=(i=this.tableModel.getColumnDef(t))==null?void 0:i.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 o=document.querySelector("input.ge-table-cell-editor-input");o&&o.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new F(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 F(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 F(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){e.forEach(t=>this.tableModel.getAreaModel(t.area).setValue(t.rowIndex,t.columnIndex,t.value)),this.repaint()}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 i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var f;const s=this.getArea(e,"west"),i=this.getArea(e,"center"),o=this.getArea(e,"east"),r=i.child.clientHeight;s.child.innerText="",i.child.innerText="",o.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,h=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),c=d.getRowCount();for(;this.cleanupFunctions[e].length;){const g=this.cleanupFunctions[e].shift();g&&g()}let p=t;const S=this.tableModel.getColumnCount(),u=this.tableModel.getFixedRightColumnCount(),y=this.tableModel.getFixedLeftColumnCount();for(let g=0;g<c;g++){const x=p,C=g===c-1,R=this.tableModel.getRowHeight(e,g);if(x+R>0){this.firstVisibleRowIndex=g;let v={left:n,width:a,height:R,top:x,index:g},m=this.dom.addRowDiv(i,v,g,e,"center");const I=y;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:I,columnIndexEnd:S-u-1,verticalFixed:!1,lastRowOfModel:C}),h.left>0&&(v={left:n,width:this.areaBodyWestGeo.width,height:R,top:x,index:g},m=this.dom.addRowDiv(s,v,g,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:0,columnIndexEnd:I-1,verticalFixed:!0,lastRowOfModel:C})),h.right>0&&(v={left:n,width:this.areaBodyEastGeo.width,height:R,top:x,index:g},m=this.dom.addRowDiv(o,v,g,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:v,parent:m,rowIndex:g,columnIndexStart:S-u,columnIndexEnd:S-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&g===c-1){const M=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new F(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(M,_),D.style&&this.dom.applyStyleString(M,D.style)}}}if(p=p+R,p>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const g=((f=this.colAndRowspanModels[e])==null?void 0:f.getRanges())??[];if(g.length)for(const x of g){let C=0,R=i.child,v="center";if(x.c1<y)R=s.child,v="west";else if(u>0&&x.c1>=S-u)R=o.child,v="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*m-this.areaBodyWestGeo.width,v="center"}this.drawBigCell(x,C,t,d,R,v)}}}drawBigCell(e,t,s,i,o,r){const n=s+this.getRowHeights(0,e.r1-1,i).reduce((f,g)=>f+g,0),a=this.tableModel.getColumnCount(),h=this.tableModel.getFixedRightColumnCount();let d=0;h>0&&e.c1>=a-h&&(d=a-h);const c=t+this.getColumnWidths(d,e.c1-1).reduce((f,g)=>f+g,0),p=this.getRowHeights(e.r1,e.r2,i).reduce((f,g)=>f+g,0),S=this.getColumnWidths(e.c1,e.c2).reduce((f,g)=>f+g,0);let u=!1;const y=this.getSelectionModel?this.getSelectionModel():void 0;y&&(u=y.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:S,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:S,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:c,cellTop:n,cellWidth:S,cellHeight:p,parent:o})}findRowOfImportantRowspanCell(e,t,s){const i=e.getMaxRowspan();for(let o=t-1;o>-1;o--){const r=e.getRowspanAt(o,s);if(r>1&&o+r+1>=t)return o;if(t-o>i)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:i,parent:o,rowIndex:r,columnIndexStart:n,columnIndexEnd:a,verticalFixed:h=!1,lastRowOfModel:d=!1}){var y;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let c=0;if(!h){const f=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();c=this.scrollFactorX*f}const p=0,S=!!(e==="body"&&t);let u=c;for(let f=n;f<=a;f++){const g=u,x=this.tableModel.getColumnWidth(f);if(x>0&&g+x>0){let C=i.height;const R=s.getRowspanAt(r,f),v=s.getColspanAt(r,f);R>1&&(C=this.getRowHeights(r,r+R-1,s).reduce((M,D)=>M+D,0));let m=x;v>1&&(m=this.getColumnWidths(f,f+v-1).reduce((M,D)=>M+D,0));let I=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(y=this.colAndRowspanModels[e])!=null&&y.isInRange(r,f)&&(I=!0),this.draggingTargetColumnIndex===f&&e!=="header"){this.renderDragTargetDiv(o,g,p,m,C);const M={left:g,top:p,width:m,height:C};this.dom.addColumnBorderDivs(this.tableOptions,o,M,e,t)}else{const M=this.renderSelectedBackgroundDiv(I,S,t,s,r,f,o,g,p,m,C);I||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:f,left:g,top:p,width:m,height:C,parent:o,cellSelected:M,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:f,cellLeft:g,cellTop:p,cellWidth:m,cellHeight:C,parent:o})}}if(u=u+x,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new F(u-1,1,i.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:n,height:a,top:h,parent:d,lastRowOfModel:c}){var re;const S=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(i,o),u={left:r,width:n,height:a,top:h,index:o},y=e.getRowByIndex(i);let f="none";if(o===this.getTreeArrowColumnIndex()&&y instanceof Z){const w=y;(re=w.children)!=null&&re.length?w.expanded?f="expanded":f="collapsed":f="hidden"}let x;if(t==="header"){const w=this.tableModel.getColumnDef(o);(!(w!=null&&w.sortIconVisible)||w!=null&&w.sortIconVisible())&&(x=w==null?void 0:w.sortState)}const C=e.getValueAt(i,o),R=S?"":`${C}`,v=e.isRowChecked(i),m=this.dom.addColumnDiv(d,u,i,o,t,s,R,f,this.tableOptions,v,x),I=e.getTooltipAt(i,o);I&&this.dom.setAttribute(m,"title",I);const M=this.tableModel.getColumnDef(o);M&&M.classes[t]&&this.dom.addClasses(M.classes[t],m);let D;S&&(D=S.render(m,i,o,t,e,C,this.dom.domService));const _=e.getCustomClassesAt(i,o);if(_.length&&this.dom.addClasses(_,m),this.dom.addColumnBorderDivs(this.tableOptions,d,u,t,s),c&&this.dom.addHorizontalBorder({left:r,width:n,height:a,top:h+a},d),this.getFocusModel&&t==="body"){const w=this.getFocusModel();w!=null&&w.hasFocus(i,o)&&this.dom.addFocusBorderDivs(d,u,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const K=e.getCustomStyleAt(i,o);if(K)for(const w in K)this.dom.setStyle(m,w,K[w]);return[m,D]}getColumnWidths(e,t){const s=[];for(let i=e;i<=t;i++)s.push(this.tableModel.getColumnWidth(i));return s}getRowHeights(e,t,s){const i=[];for(let o=e;o<=t;o++)i.push(s.getRowHeight(o));return i}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"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),i=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:o+"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)}renderDragTargetDiv(e,t,s,i,o){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",`${i}px`),this.dom.setStyle(r,"height",`${o}px`),r}renderSelectedBackgroundDiv(e,t,s,i,o,r,n,a,h,d,c){let p=!1;if(!e&&t&&i.isSelectable(o,r)&&this.getSelectionModel){const S=this.getSelectionModel();if(S){const u=S.getSelectionCount(o,r);p=u>0;for(let y=0;y<u;y++){const f=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(f,"left",`${a}px`),this.dom.setStyle(f,"top",`${h}px`),this.dom.setStyle(f,"width",`${d}px`),this.dom.setStyle(f,"height",`${c}px`)}}}return p}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,columnIndex:o,left:r,top:n,width:a,height:h,parent:d,cellSelected:c,lastRowOfModel:p,gammaRange:S}){const[u,y]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:a,height:h,top:n,parent:d,lastRowOfModel:p,gammaRange:S});c&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,u),y&&this.cleanupFunctions[t].push(y)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:i,cellWidth:o,cellHeight:r,parent:n}){const a=this.dom.domService,h=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+o-h}px`),a.setStyle(d,"top",`${i}px`),a.setStyle(d,"width",`${h}px`),a.setStyle(d,"height",`${r}px`),a.appendChild(n,d)}}class Qe{constructor(e,t){this.columnIndex=e,this.sortState=t}}class Ze{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"),i=t.getAttribute("data-row-index"),o=t.getAttribute("data-col-index");if(s&&i&&o){const r=ie(s),n=Number(i),a=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,a,t.value)}}}}class et{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class le{constructor(e){this.cells=e}static createSingle(e,t){return new le([new et(e,t)])}}class tt{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 o,r,n,a,h,d,c;let s=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const p=this.getSelectionModel(),S=this.getFocusModel();p&&S&&(S.hasFocus(e.rowIndex,e.columnIndex)||(S.setFocus(e.rowIndex,e.columnIndex),s=!0),(o=e.originalEvent)!=null&&o.shiftKey||p.hasSelection()&&(p.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(p.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,s=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey?(p.addSelection(T.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0):(h=e.originalEvent)!=null&&h.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)&&(p.removeSelection(T.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0))}return i?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[i,o]=s.getFocus();return t.togglePoint(i,o),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return T.create({rowIndex1:s,columnIndex1:o,rowIndex2:i,columnIndex2:r})}}class st{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","cmd -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class it{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","cmd+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","cmd+x":"DESELECT_ALL","cmd+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"}}}class ot{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.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new it().get()):Object.assign(this.shortcutActionIdMapping,new st().get()),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}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.findEnty(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}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);for(const s in this.shortcutActionIdMapping){const i=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[\+ ]/g).sort();if(this.areTokensEquals(t,i))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()}}class lt{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class rt extends Je{constructor(e,t,s,i,o){var r;if(super(e,t,new He(s),i),this.eventListener=o,this.selectionService=new tt(this),this.api=new We(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new lt),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,a=n.getStorageKeyFn;a&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new je(a)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Xe(a)),n.autoRestoreSortingState&&(this.storeSortingService=new Ke(a)))}this.mouseHandler=new _e(this),this.inputHandler=new Ze(this),this.shortcutService=new ot(this),this.shortcutService.addListener(this.selectionService)}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,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,i)&&(this.clearSelection(),this.initRenderEditor(s,i))}return!0}return!1}updateModelValueAfterEdit(e,t,s,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(le.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition()}createGeMouseEvent(e){const t=new se;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 i=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=i.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const i=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,o=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(o,i)}}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.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e){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.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&this.repaint(),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,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();t instanceof ee&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const i=this.tableModel.getAreaModel(s),o=i.isRowChecked(e),r=o===void 0||o==="semi"||o==="none";i.setRowChecked(e,r),this.repaint();const n=(a=i.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){const i=this.getFocusModel();i&&(s=i.hasChanged(),i.clearChanged(),s&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),s&&this.debounce(this.repaint.bind(this),10)}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 o,r;const i=this.tableModel.getColumnDef(s);if(i!=null&&i.sortable&&i.sortable()){e.preventDefault(),e.stopPropagation();const n=i.sortStatesOrder?i.sortStatesOrder:this.tableOptions.sortOrder,a=i.sortState??"",h=n[(n.indexOf(a)+1)%n.length],d=new Qe(s,h);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(p=>p.sortState=""),i.sortState=h),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[i,o]=s.getFocus();return s.setFocus(i+t,o+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,i=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&i){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(r instanceof ee){const n=r,a=r.getRowCount();for(let h=0;h<a;h++){const d=r.getRowByIndex(h);if(d)if(o.allExpanded)d.expanded=!0;else if(o.allCollapsed)d.expanded=!1;else{const c=i(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c))}}n.recalcVisibleTreeRows()}}}}}class nt{render(e,t,s,i,o,r,n){if(o.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=o.getValueAt(t,s);e.innerHTML=`
|
|
9
9
|
<input
|
|
10
10
|
type="text"
|
|
11
11
|
value="${a}"
|
|
@@ -17,4 +17,4 @@
|
|
|
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
|
|
20
|
+
class="ge-table-cell-editor-input">`}}}class at{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}getSelectionCount(e,t){let s=0;for(const i of this.ranges)i.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}hasSelection(){return!!this.ranges.length}selectAll(){this.allSelected=!0}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=T.singleRow(e.r1):this.selectionType==="column"&&(t=T.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(T.singleCell(e,t)):this.addSelection(T.singleCell(e,t))}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))}}class dt{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0)}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}const ht=new at,ct=new dt("cell");class ut{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 ge,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Se,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new nt,this.getSelectionModel=()=>ht,this.getFocusModel=()=>ct}}class pt{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}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)}}const ft=Oe("<div>"),gt=l=>{let e;const t=fe({tableModel:null,tableOptions:new ut},l);return ve(()=>{const s={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)}},i=new rt(e,t.tableModel,new pt,t.tableOptions,s);i.firstInit();const o=new CustomEvent("tableReady",{detail:i.getApi(),bubbles:!0});e&&e.dispatchEvent(o)}),(()=>{const s=ft(),i=e;return typeof i=="function"?Le(i,s):e=s,s})()};exports.ComponentRendererWrapper=Be;exports.GuiexpertTable=gt;exports.GuiexpertTableProps=$e;
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ComponentRendererWrapper } from "./ComponentRendererWrapper";
|
|
2
|
-
import * as
|
|
3
|
-
|
|
2
|
+
import * as GuiexpertTableProps from "./GuiexpertTableProps";
|
|
3
|
+
import GuiexpertTable from "./GuiexpertTable";
|
|
4
|
+
export { GuiexpertTable, GuiexpertTableProps, ComponentRendererWrapper };
|
package/index.js
CHANGED
|
@@ -452,7 +452,7 @@ function P(l, e, t, s) {
|
|
|
452
452
|
l.insertBefore(i, t);
|
|
453
453
|
return [i];
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class pt {
|
|
456
456
|
constructor(e) {
|
|
457
457
|
this.code = e;
|
|
458
458
|
}
|
|
@@ -470,6 +470,9 @@ class ft {
|
|
|
470
470
|
);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
474
|
+
__proto__: null
|
|
475
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
473
476
|
class se {
|
|
474
477
|
constructor(e = -1, t = -1, s = -1, i = -1, o, r, n, a = 0, h = 0, d = 0, c = "") {
|
|
475
478
|
this.rowIndex = e, this.rowTop = t, this.columnIndex = s, this.columnLeft = i, this.areaIdent = o, this.sideIdent = r, this.originalEvent = n, this.clickCount = a, this.draggingX = h, this.draggingY = d, this.action = c;
|
|
@@ -2421,7 +2424,7 @@ class ct {
|
|
|
2421
2424
|
e.setAttribute(t, s);
|
|
2422
2425
|
}
|
|
2423
2426
|
}
|
|
2424
|
-
const ut = /* @__PURE__ */ Oe("<div>"),
|
|
2427
|
+
const ut = /* @__PURE__ */ Oe("<div>"), gt = (l) => {
|
|
2425
2428
|
let e;
|
|
2426
2429
|
const t = fe({
|
|
2427
2430
|
tableModel: null,
|
|
@@ -2434,49 +2437,49 @@ const ut = /* @__PURE__ */ Oe("<div>"), pt = (l) => {
|
|
|
2434
2437
|
detail: r,
|
|
2435
2438
|
bubbles: !0
|
|
2436
2439
|
});
|
|
2437
|
-
e.dispatchEvent(n);
|
|
2440
|
+
e && e.dispatchEvent(n);
|
|
2438
2441
|
},
|
|
2439
2442
|
onContextmenu: (r) => {
|
|
2440
2443
|
const n = new CustomEvent("contextmenu", {
|
|
2441
2444
|
detail: r,
|
|
2442
2445
|
bubbles: !0
|
|
2443
2446
|
});
|
|
2444
|
-
e.dispatchEvent(n);
|
|
2447
|
+
e && e.dispatchEvent(n);
|
|
2445
2448
|
},
|
|
2446
2449
|
onModelChanged: (r) => {
|
|
2447
2450
|
const n = new CustomEvent("modelChanged", {
|
|
2448
2451
|
detail: r,
|
|
2449
2452
|
bubbles: !0
|
|
2450
2453
|
});
|
|
2451
|
-
e.dispatchEvent(n);
|
|
2454
|
+
e && e.dispatchEvent(n);
|
|
2452
2455
|
},
|
|
2453
2456
|
onMouseClicked: (r) => {
|
|
2454
2457
|
const n = new CustomEvent("mouseClicked", {
|
|
2455
2458
|
detail: r,
|
|
2456
2459
|
bubbles: !0
|
|
2457
2460
|
});
|
|
2458
|
-
e.dispatchEvent(n);
|
|
2461
|
+
e && e.dispatchEvent(n);
|
|
2459
2462
|
},
|
|
2460
2463
|
onMouseDragging: (r) => {
|
|
2461
2464
|
const n = new CustomEvent("mouseDragging", {
|
|
2462
2465
|
detail: r,
|
|
2463
2466
|
bubbles: !0
|
|
2464
2467
|
});
|
|
2465
|
-
e.dispatchEvent(n);
|
|
2468
|
+
e && e.dispatchEvent(n);
|
|
2466
2469
|
},
|
|
2467
2470
|
onMouseDraggingEnd: (r) => {
|
|
2468
2471
|
const n = new CustomEvent("mouseDraggingEnd", {
|
|
2469
2472
|
detail: r,
|
|
2470
2473
|
bubbles: !0
|
|
2471
2474
|
});
|
|
2472
|
-
e.dispatchEvent(n);
|
|
2475
|
+
e && e.dispatchEvent(n);
|
|
2473
2476
|
},
|
|
2474
2477
|
onMouseMoved: (r) => {
|
|
2475
2478
|
const n = new CustomEvent("mouseMoved", {
|
|
2476
2479
|
detail: r,
|
|
2477
2480
|
bubbles: !0
|
|
2478
2481
|
});
|
|
2479
|
-
e.dispatchEvent(n);
|
|
2482
|
+
e && e.dispatchEvent(n);
|
|
2480
2483
|
}
|
|
2481
2484
|
}, i = new ot(e, t.tableModel, new ct(), t.tableOptions, s);
|
|
2482
2485
|
i.firstInit();
|
|
@@ -2484,16 +2487,14 @@ const ut = /* @__PURE__ */ Oe("<div>"), pt = (l) => {
|
|
|
2484
2487
|
detail: i.getApi(),
|
|
2485
2488
|
bubbles: !0
|
|
2486
2489
|
});
|
|
2487
|
-
e.dispatchEvent(o);
|
|
2490
|
+
e && e.dispatchEvent(o);
|
|
2488
2491
|
}), (() => {
|
|
2489
2492
|
const s = ut(), i = e;
|
|
2490
2493
|
return typeof i == "function" ? Le(i, s) : e = s, s;
|
|
2491
2494
|
})();
|
|
2492
|
-
}
|
|
2493
|
-
__proto__: null,
|
|
2494
|
-
default: pt
|
|
2495
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2495
|
+
};
|
|
2496
2496
|
export {
|
|
2497
|
-
|
|
2498
|
-
gt as GuiexpertTable
|
|
2497
|
+
pt as ComponentRendererWrapper,
|
|
2498
|
+
gt as GuiexpertTable,
|
|
2499
|
+
ft as GuiexpertTableProps
|
|
2499
2500
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/solid-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"entryFile": "src/index.ts"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"npm-pub:
|
|
11
|
+
"npm-pub:solid-table": "npm publish --access public"
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|