@ninebone/table 0.0.712 → 0.0.714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nine-table.umd.js
CHANGED
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
124
124
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
125
125
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
126
|
-
`;const e=h(()=>{const s=t(this,st).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,k,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,Vt).call(this),this.refresh()},"initWhenReady");e()}};et=new WeakMap,st=new WeakMap,ft=new WeakMap,k=new WeakMap,Et=new WeakMap,At=new WeakMap,Vt=new WeakMap,h(He,"NineTableVScrollBar");let Rt=He;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Rt);const _e=class _e{constructor(n){d(this,F);d(this,A);d(this,nt);d(this,P,new Map);d(this,_,null);d(this,X,null);d(this,rt,0);d(this,qt,40);d(this,Ie,!1);d(this,Me,!1);d(this,Ut,3);T(this,"refresh",h(()=>{var e;y.log("rowManager.refresh");const n=t(this,A).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Tt).call(this),t(this,Ct).call(this),t(this,ut).call(this,n.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",h(()=>{y.log("rowManager.initialize"),p(this,nt,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,A).querySelector(i);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(i,u)});const n=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),r=t(this,A).querySelector(".ng-container-body .ng-part-header"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Tt).call(this),t(this,Lt).call(this),t(this,Ct).call(this),t(this,ut).call(this,n.scrollTop);let i=!1;const a=h(c=>{var u;if(i)return;i=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),o&&o.scrollLeft!==f&&(o.scrollLeft=f),t(this,ut).call(this,l),(u=t(this,A).querySelector("nine-table-vscrollbar"))==null||u.refresh(),i=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Xt,h((n,e)=>{y.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const r=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const o=r.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,qt);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):r.appendChild(i),e===".ng-container-body"&&(t(this,nt).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Tt,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const n=t(this,A).querySelector(".ng-container-body .ng-part-body");y.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(y.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),o=document.createDocumentFragment();e.forEach(b=>{o.appendChild(b.cloneNode(!0))}),r?r.before(o):s.appendChild(o);const i=t(this,A),a=i.style.display,c=i.style.visibility,l=i.style.position;(a==="none"||window.getComputedStyle(i).display==="none")&&(i.style.display="block",i.style.visibility="hidden",i.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,f<=0?-1:(p(this,_,f),t(this,kt).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Ct,h(()=>{y.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,F).data.get()||[]).length,s=t(this,_),r=e*s;y.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const i=t(this,A).querySelector(o);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,kt,h(()=>{if(t(this,rt)>0&&t(this,_)>0){const n=Math.ceil(t(this,rt)/t(this,_));p(this,qt,n+t(this,Ut))}},"#updateRowCount"));d(this,Kt,h(()=>{var a,c,l,f,u,b;const n=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(g.length,m.length,w.length);for(let x=0;x<S;x++){const z=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[x])==null?void 0:l.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(o){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(o.querySelectorAll("tfoot tr")),w=i?Array.from(i.querySelectorAll("tfoot tr")):[],S=Math.max(g.length,m.length,w.length);for(let x=0;x<S;x++){const z=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}},"#syncRowHeights"));d(this,Zt,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,X,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let o=0;const i=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");i&&(o+=i.offsetHeight),a&&(o+=a.offsetHeight);const c=Math.max(r-o,100);t(this,rt)!==c&&(p(this,rt,c),t(this,kt).call(this),t(this,_)!==null&&(t(this,Lt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,A)))},"#initResizeObserver"));d(this,Lt,h(()=>{y.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,A).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Xt).call(this,e,n)}),t(this,Gt).call(this),t(this,Kt).call(this)},"#renderAllContainers"));d(this,$e,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const o=Array.from(r.querySelectorAll("tr:not(.nodata)")),i=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,F).data.get()||[]).length;o.forEach((f,u)=>{const b=n+Math.floor(u/i);if(b>=c){f.style.visibility="hidden";return}const g=t(this,F).data.get(b);f.style.display="",t(this,Ht).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ut,h(n=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,F).data.length;if(s===0)return;const r=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,o=t(this,A).querySelector(".ng-container-body .ng-part-body");y.log("bodyContainer.clientHeight",o.clientHeight);const i=Math.max(0,s-Math.floor(o.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);y.log(`📜 [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`),a===i&&y.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,nt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,nt))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(y.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,A).querySelector(g);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((x,z)=>{const C=a+Math.floor(z/r);if(C>=s){x.style.display="none";return}const O=t(this,F).data.get(C);x.style.display="",t(this,Ht).call(this,x,O,C)})}))},"#handleScroll"));d(this,Ht,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,o)=>{r.dataset.row=s;const i=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");i&&typeof i.refresh=="function"&&i.refresh()})},"#bindRowData"));d(this,Gt,h(()=>{var c,l,f;y.log("rowManager.#syncHeaderHeights");const n=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=n?Array.from(n.querySelectorAll("tr")):[],o=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,o.length,i.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=i[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,X)&&(t(this,X).disconnect(),p(this,X,null))},"destroy"));p(this,F,n.getRootNode().host),p(this,A,n),t(this,Zt).call(this)}getRowHeight(){return t(this,_)}templateLength(n=".ng-container-body"){var e;return((e=t(this,P).get(n))==null?void 0:e.length)||1}};F=new WeakMap,A=new WeakMap,nt=new WeakMap,P=new WeakMap,_=new WeakMap,X=new WeakMap,rt=new WeakMap,qt=new WeakMap,Ie=new WeakMap,Me=new WeakMap,Ut=new WeakMap,Xt=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,Lt=new WeakMap,$e=new WeakMap,ut=new WeakMap,Ht=new WeakMap,Gt=new WeakMap,h(_e,"RowManager");let be=_e;const Jt=class Jt{static compileAll(n){return Array.isArray(n)?n.map(e=>Jt.compile(e)):[]}static compile(n){if(!n)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),g&&S.push(`data-expr="${g}"`),m&&S.push(`maxbyte="${m}"`),w&&S.push(`type="${w}"`),l.innerHTML=`<${u} ${S.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),r=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let S=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let O=0;O<g[w].length;O++)if(g[w][O]===null){S=O;break}const z=x.rowSpan||1,C=x.colSpan||1;for(let O=0;O<z;O++)for(let wt=0;wt<C;wt++)w+O<u&&S+wt<b&&(g[w+O][S+wt]=O===0&&wt===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(S=>{for(let x=0;x<g[w].length;x++)if(g[w][x]==="1"){S.dataset.col=x,g[w][x]="0";break}})})},"resetColIndex"),o=n.cloneNode(!0);return s(o),e(o),r(o,"thead"),r(o,"tbody"),r(o,"tfoot"),Array.from(o.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),o}};h(Jt,"TableCompiler");let pe=Jt;const Ne=class Ne{constructor(n){d(this,Y);d(this,j);d(this,ot,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});T(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,ot);y.log("🎨 [CellSelection.render] Rendering range ->",t(this,ot));const o=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(o.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){y.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;o.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{if(c.classList.contains("nodata"))return;const{matrixRow:l}=St(this,Y,Pt).call(this,c);l<0||c.querySelectorAll("td, th").forEach(f=>{const u=parseInt(f.dataset.col,10);if(isNaN(u))return;const b=parseInt(f.rowSpan||1,10),g=parseInt(f.colSpan||1,10),m=l+b-1,w=u+g-1;m>=n&&l<=s&&w>=e&&u<=r&&(i++,f.classList.add("selected"),l===n&&f.classList.add("selected-top"),m===s&&f.classList.add("selected-bottom"),u===e&&f.classList.add("selected-left"),w===r&&f.classList.add("selected-right"))})})}),y.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`)},"render"));p(this,j,n),St(this,Y,is).call(this),y.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,r){y.log(`🔍 [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${r}`);let o=Math.min(n,s),i=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let f=!0,u=0;for(;f&&u<5;)f=!1,u++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(g=>{if(g.classList.contains("nodata"))return;const{matrixRow:m}=St(this,Y,Pt).call(this,g);m<0||g.querySelectorAll("td, th").forEach(w=>{const S=parseInt(w.dataset.col,10);if(isNaN(S))return;const x=parseInt(w.rowSpan||1,10),z=parseInt(w.colSpan||1,10),C=m+x-1,O=S+z-1;if(C>=o&&m<=i&&O>=a&&S<=c){const Qe=Math.min(o,m),ts=Math.max(i,C),es=Math.min(a,S),ss=Math.max(c,O);(Qe!==o||ts!==i||es!==a||ss!==c)&&(o=Qe,i=ts,a=es,c=ss,f=!0)}})})});p(this,ot,{startRow:o,startCol:a,endRow:i,endCol:c}),y.log("📦 [CellSelection.setRange] Final Range ->",t(this,ot)),this.render()}};j=new WeakMap,ot=new WeakMap,Y=new WeakSet,Pt=h(function(n){if(!n||n.classList.contains("nodata"))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(n.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=n.closest("tbody"),o=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),i=o.indexOf(n),a=o.length>0?o.length:1,c=e*a+(i>=0?i:n.sectionRowIndex%a);return{dataRow:e,subRowIndex:i,matrixRow:c}},"#getMatrixRow"),is=h(function(){const n=t(this,j).querySelector(".ng-container-top");if(!n){y.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;const s=e.target.closest("td, th");if(!s||s.dataset.row===void 0||s.dataset.col===void 0||s.closest("tr").classList.contains("nodata"))return;const r=s.closest("tr"),{matrixRow:o}=St(this,Y,Pt).call(this,r),i=parseInt(s.dataset.col,10);if(o<0)return;y.log(`🖱️ [MouseDown Success] startRow: ${o}, startCol: ${i}`),this.setRange(o,i,o,i);const a=h(l=>{const f=document.elementFromPoint(l.clientX,l.clientY);let u=f==null?void 0:f.closest("td, th");if(!u||!t(this,j).contains(u)){const w=t(this,j).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const S of w){const x=S.getBoundingClientRect();if(l.clientX>=x.left&&l.clientX<=x.right&&l.clientY>=x.top&&l.clientY<=x.bottom){u=S;break}}}if(!u||u.dataset.row===void 0||u.dataset.col===void 0||u.closest("tr").classList.contains("nodata"))return;const b=u.closest("tr"),{matrixRow:g}=St(this,Y,Pt).call(this,b),m=parseInt(u.dataset.col,10);g<0||this.setRange(o,i,g,m)},"onMouseMove"),c=h(()=>{y.log("🖱️ [MouseUp] Drag ended."),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)},"onMouseUp");document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)})},"#initEvents"),h(Ne,"CellSelection");let ye=Ne;const Mt=class Mt extends HTMLElement{constructor(){super();d(this,Qt);d(this,it,null);d(this,at);d(this,It);T(this,"invalidate",h(()=>{y.log("sheet.invalidate()"),t(this,at).refresh()},"invalidate"));T(this,"generate",h(e=>{if(y.log("sheet.generate()"),!e)return;p(this,it,pe.compile(e)),t(this,te).call(this),t(this,ee).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),o=this.querySelector(".ng-nodata-overlay");s&&o&&(o.style.top=`${s.offsetHeight}px`),r&&o&&(o.style.bottom=`${r.offsetHeight}px`),t(this,at).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,te,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var o,i,a;(o=this.querySelector(`${s} .ng-part-header`))==null||o.appendChild(t(this,gt).call(this,t(this,it),r,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,gt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,gt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,ee,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let o=0;r[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(o)||(o+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${o}px`,s.style.width=`${o}px`)})},"#updateContainerWidths"));d(this,gt,h((e,s,r)=>{const o=e.cloneNode(!0),i=o.querySelector("thead"),a=o.querySelector("tbody"),c=o.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",o.appendChild(f)}}else r==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(i&&i.remove(),a&&a.remove());return s==="left"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):o.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),o},"#createSplitTable"));T(this,"getRowHeight",h(()=>t(this,at).getRowHeight(),"getRowHeight"));T(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,se,h(()=>{t(this,ne).call(this),p(this,It,new ye(this))},"#init"));d(this,ne,h(()=>{const e=Mt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
126
|
+
`;const e=h(()=>{const s=t(this,st).querySelector(".ng-container-body .ng-part-body");if(!s){setTimeout(e,10);return}p(this,k,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),top:this.querySelector(".ng-scroll-top"),bottom:this.querySelector(".ng-scroll-bottom")}),t(this,Vt).call(this),this.refresh()},"initWhenReady");e()}};et=new WeakMap,st=new WeakMap,ft=new WeakMap,k=new WeakMap,Et=new WeakMap,At=new WeakMap,Vt=new WeakMap,h(He,"NineTableVScrollBar");let Rt=He;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Rt);const _e=class _e{constructor(n){d(this,F);d(this,A);d(this,nt);d(this,P,new Map);d(this,_,null);d(this,X,null);d(this,rt,0);d(this,qt,40);d(this,Ie,!1);d(this,Me,!1);d(this,Ut,3);T(this,"refresh",h(()=>{var e;y.log("rowManager.refresh");const n=t(this,A).querySelector(".ng-container-body .ng-part-body");n&&(t(this,Tt).call(this),t(this,Ct).call(this),t(this,ut).call(this,n.scrollTop),(e=t(this,A).querySelector("nine-table-vscrollbar"))==null||e.refresh())},"refresh"));T(this,"initialize",h(()=>{y.log("rowManager.initialize"),p(this,nt,{scrollTables:t(this,A).querySelectorAll(".ng-part-body table"),firstTr:t(this,A).querySelector(".ng-container-body .ng-part-body tbody.bindable-tbody tr:not(.nodata)")}),p(this,_,null),t(this,P).clear(),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(i=>{const a=t(this,A).querySelector(i);if(!a)return;const c=a.querySelector(".ng-part-body table");if(!c)return;const l=c.querySelector("tbody.bindable-tbody");if(!l)return;const u=Array.from(l.querySelectorAll("tr")).map(b=>b.cloneNode(!0));t(this,P).set(i,u)});const n=t(this,A).querySelector(".ng-container-body .ng-part-body"),e=t(this,A).querySelector(".ng-container-left .ng-part-body"),s=t(this,A).querySelector(".ng-container-right .ng-part-body"),r=t(this,A).querySelector(".ng-container-body .ng-part-header"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer");if(n){t(this,Tt).call(this),t(this,Lt).call(this),t(this,Ct).call(this),t(this,ut).call(this,n.scrollTop);let i=!1;const a=h(c=>{var u;if(i)return;i=!0;const l=c.scrollTop,f=c.scrollLeft;n&&n.scrollTop!==l&&(n.scrollTop=l),e&&e.scrollTop!==l&&(e.scrollTop=l),s&&s.scrollTop!==l&&(s.scrollTop=l),r&&r.scrollLeft!==f&&(r.scrollLeft=f),o&&o.scrollLeft!==f&&(o.scrollLeft=f),t(this,ut).call(this,l),(u=t(this,A).querySelector("nine-table-vscrollbar"))==null||u.refresh(),i=!1},"handleContainerScroll");[n,e,s].forEach(c=>{c==null||c.addEventListener("scroll",()=>{a(c)})})}},"initialize"));d(this,Xt,h((n,e)=>{y.log("rowManager.#renderRows");const s=t(this,P).get(e);if(!s||s.length===0)return;const r=n.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;r.querySelectorAll("tr:not(.nodata)").forEach(a=>a.remove());const o=r.querySelector("tr.nodata"),i=document.createDocumentFragment();for(let a=0;a<t(this,qt);a++)s.forEach(c=>{i.appendChild(c.cloneNode(!0))});o?o.before(i):r.appendChild(i),e===".ng-container-body"&&(t(this,nt).firstTr=r.querySelector("tr:not(.nodata)"))},"#renderRows"));d(this,Tt,h(()=>{if(t(this,_)!==null&&t(this,_)>0)return t(this,_);const n=t(this,A).querySelector(".ng-container-body .ng-part-body");y.log("rowManager.#measureAndCacheHeight");const e=t(this,P).get(".ng-container-body");if(!e||e.length===0)throw new Error("invalid dom");const s=n.querySelector("tbody.bindable-tbody");if(y.log(s),!s)throw new Error("invalid dom");s.querySelectorAll("tr:not(.nodata)").forEach(b=>b.remove());const r=s.querySelector("tr.nodata"),o=document.createDocumentFragment();e.forEach(b=>{o.appendChild(b.cloneNode(!0))}),r?r.before(o):s.appendChild(o);const i=t(this,A),a=i.style.display,c=i.style.visibility,l=i.style.position;(a==="none"||window.getComputedStyle(i).display==="none")&&(i.style.display="block",i.style.visibility="hidden",i.style.position="absolute");let f=0;const u=s.querySelectorAll("tr");return u.forEach(b=>{let g=b.offsetHeight||b.getBoundingClientRect().height;if(g===0){const m=window.getComputedStyle(b);g=parseFloat(m.height)||parseFloat(m.minHeight)||0}f+=g}),u.forEach(b=>b.remove()),i.style.display=a,i.style.visibility=c,i.style.position=l,f<=0?-1:(p(this,_,f),t(this,kt).call(this),t(this,_))},"#measureAndCacheHeight"));d(this,Ct,h(()=>{y.log("rowManager.#updateVirtualScrollHeight");const e=(t(this,F).data.get()||[]).length,s=t(this,_),r=e*s;y.log("🔍 [VirtualHeight]",{totalCount:e,rowHeight:s,totalVirtualHeight:r}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(o=>{const i=t(this,A).querySelector(o);if(!i)return;const a=i.querySelector(".ng-part-body .ng-virtual-spacer");a&&(a.style.height=`${r}px`)})},"#updateVirtualScrollHeight"));d(this,kt,h(()=>{if(t(this,rt)>0&&t(this,_)>0){const n=Math.ceil(t(this,rt)/t(this,_));p(this,qt,n+t(this,Ut))}},"#updateRowCount"));d(this,Kt,h(()=>{var a,c,l,f,u,b;const n=t(this,A).querySelector(".ng-container-left .ng-part-body table"),e=t(this,A).querySelector(".ng-container-body .ng-part-body table"),s=t(this,A).querySelector(".ng-container-right .ng-part-body table");if(e){const g=n?Array.from(n.querySelectorAll("tbody tr")):[],m=Array.from(e.querySelectorAll("tbody tr")),w=s?Array.from(s.querySelectorAll("tbody tr")):[],S=Math.max(g.length,m.length,w.length);for(let x=0;x<S;x++){const z=[((a=g[x])==null?void 0:a.getBoundingClientRect().height)||0,((c=m[x])==null?void 0:c.getBoundingClientRect().height)||0,((l=w[x])==null?void 0:l.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}const r=t(this,A).querySelector(".ng-container-left .ng-part-footer table"),o=t(this,A).querySelector(".ng-container-body .ng-part-footer table"),i=t(this,A).querySelector(".ng-container-right .ng-part-footer table");if(o){const g=r?Array.from(r.querySelectorAll("tfoot tr")):[],m=Array.from(o.querySelectorAll("tfoot tr")),w=i?Array.from(i.querySelectorAll("tfoot tr")):[],S=Math.max(g.length,m.length,w.length);for(let x=0;x<S;x++){const z=[((f=g[x])==null?void 0:f.getBoundingClientRect().height)||0,((u=m[x])==null?void 0:u.getBoundingClientRect().height)||0,((b=w[x])==null?void 0:b.getBoundingClientRect().height)||0],C=Math.max(...z);C>0&&(g[x]&&(g[x].style.height=`${C}px`),m[x]&&(m[x].style.height=`${C}px`),w[x]&&(w[x].style.height=`${C}px`))}}},"#syncRowHeights"));d(this,Zt,h(()=>{!t(this,A)||!(t(this,A)instanceof HTMLElement)||(p(this,X,new ResizeObserver(n=>{for(const e of n){const s=e.target;if(!s.classList.contains("active"))continue;const r=e.contentRect.height;if(r>0){let o=0;const i=s.querySelector(".ng-part-header"),a=s.querySelector(".ng-part-footer");i&&(o+=i.offsetHeight),a&&(o+=a.offsetHeight);const c=Math.max(r-o,100);t(this,rt)!==c&&(p(this,rt,c),t(this,kt).call(this),t(this,_)!==null&&(t(this,Lt).call(this),this.refresh()))}}})),t(this,X).observe(t(this,A)))},"#initResizeObserver"));d(this,Lt,h(()=>{y.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,A).querySelector(n);e&&e.querySelector(".ng-part-body tbody.bindable-tbody")&&t(this,Xt).call(this,e,n)}),t(this,Gt).call(this),t(this,Kt).call(this)},"#renderAllContainers"));d(this,$e,h(n=>{[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{var l;const s=t(this,A).querySelector(e);if(!s)return;const r=s.querySelector(".ng-part-body tbody.bindable-tbody");if(!r)return;const o=Array.from(r.querySelectorAll("tr:not(.nodata)")),i=((l=t(this,P).get(e))==null?void 0:l.length)||1,c=(t(this,F).data.get()||[]).length;o.forEach((f,u)=>{const b=n+Math.floor(u/i);if(b>=c){f.style.visibility="hidden";return}const g=t(this,F).data.get(b);f.style.display="",t(this,Ht).call(this,f,g,b)})})},"#adjustBufferRows"));d(this,ut,h(n=>{var u,b;const e=t(this,_);if(!e||e<=0)return;const s=t(this,F).data.length;if(s===0)return;const r=((u=t(this,P).get(".ng-container-body"))==null?void 0:u.length)||1,o=t(this,A).querySelector(".ng-container-body .ng-part-body");y.log("bodyContainer.clientHeight",o.clientHeight);const i=Math.max(0,s-Math.floor(o.clientHeight/e)),a=Math.min(i,Math.max(0,Math.floor(n/e)));let c=Math.floor(a*e);y.log(`📜 [Scroll Calc] maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`),a===i&&y.log(`📜 [Scroll Inspect] scrollTop: ${n}, rowHeight: ${e}, maxStartIndex: ${i}, startIndex: ${a}, offsetY: ${c}`);const l=t(this,nt).firstTr,f=l&&l.dataset.row!==void 0?parseInt(l.dataset.row,10):-1;(b=t(this,nt))==null||b.scrollTables.forEach(g=>{g.style.transform=`translate3d(0, ${c}px, 0)`}),f!==a&&(y.log(`🔄 [Row Bind Trigger] currentStartIndex(${f}) !== startIndex(${a})`),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(g=>{const m=t(this,A).querySelector(g);if(!m)return;const w=m.querySelector(".ng-part-body tbody.bindable-tbody");if(!w)return;Array.from(w.querySelectorAll("tr:not(.nodata)")).forEach((x,z)=>{const C=a+Math.floor(z/r);if(C>=s){x.style.display="none";return}const O=t(this,F).data.get(C);x.style.display="",t(this,Ht).call(this,x,O,C)})}))},"#handleScroll"));d(this,Ht,h((n,e,s)=>{n.dataset.row=s,n.data=e,Array.from(n.cells).forEach((r,o)=>{r.dataset.row=s;const i=Array.from(r.children).find(a=>a.tagName.toLowerCase().startsWith("cell-")||typeof a.refresh=="function");i&&typeof i.refresh=="function"&&i.refresh()})},"#bindRowData"));d(this,Gt,h(()=>{var c,l,f;y.log("rowManager.#syncHeaderHeights");const n=t(this,A).querySelector(".ng-container-left .ng-part-header table"),e=t(this,A).querySelector(".ng-container-body .ng-part-header table"),s=t(this,A).querySelector(".ng-container-right .ng-part-header table");if(!e)return;const r=n?Array.from(n.querySelectorAll("tr")):[],o=Array.from(e.querySelectorAll("tr")),i=s?Array.from(s.querySelectorAll("tr")):[],a=Math.max(r.length,o.length,i.length);for(let u=0;u<a;u++){const b=[((c=r[u])==null?void 0:c.getBoundingClientRect().height)||0,((l=o[u])==null?void 0:l.getBoundingClientRect().height)||0,((f=i[u])==null?void 0:f.getBoundingClientRect().height)||0],g=Math.max(...b);g>0&&(r[u]&&(r[u].style.height=`${g}px`),o[u]&&(o[u].style.height=`${g}px`),i[u]&&(i[u].style.height=`${g}px`))}},"#syncHeaderHeights"));T(this,"destroy",h(()=>{t(this,X)&&(t(this,X).disconnect(),p(this,X,null))},"destroy"));p(this,F,n.getRootNode().host),p(this,A,n),t(this,Zt).call(this)}getRowHeight(){return t(this,_)}templateLength(n=".ng-container-body"){var e;return((e=t(this,P).get(n))==null?void 0:e.length)||1}};F=new WeakMap,A=new WeakMap,nt=new WeakMap,P=new WeakMap,_=new WeakMap,X=new WeakMap,rt=new WeakMap,qt=new WeakMap,Ie=new WeakMap,Me=new WeakMap,Ut=new WeakMap,Xt=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,Lt=new WeakMap,$e=new WeakMap,ut=new WeakMap,Ht=new WeakMap,Gt=new WeakMap,h(_e,"RowManager");let be=_e;const Jt=class Jt{static compileAll(n){return Array.isArray(n)?n.map(e=>Jt.compile(e)):[]}static compile(n){if(!n)return null;const e=h(a=>{a.querySelectorAll("tbody td, tbody th, tfoot td, tfoot th").forEach(l=>{const f=l.getAttribute("cell-type")||"renderer";if(l.children.length>0&&l.firstElementChild.tagName.includes("-"))return;let u=`cell-${f}`;const b=l.getAttribute("data-bind"),g=l.getAttribute("data-expr"),m=l.getAttribute("maxbyte"),w=l.getAttribute("type");let S=[];b&&S.push(`data-bind="${b}"`),g&&S.push(`data-expr="${g}"`),m&&S.push(`maxbyte="${m}"`),w&&S.push(`type="${w}"`),l.innerHTML=`<${u} ${S.join(" ")}></${u}>`})},"processCellTypes"),s=h(a=>{if(!a.querySelector("colgroup")){const c=a.querySelector("tbody tr")||a.querySelector("tr"),l=c?c.querySelectorAll("th, td").length:1,f=document.createElement("colgroup"),u=Math.max(Math.floor(a.clientWidth/l),100);for(let b=0;b<l;b++){const g=document.createElement("col");g.setAttribute("width",u),f.appendChild(g)}a.prepend(f)}if(!a.querySelector("thead")){const c=document.createElement("thead"),l=a.querySelector("colgroup");l?l.after(c):a.prepend(c)}a.classList.add("nine-table-element")},"ensureTableStructure"),r=h((a,c)=>{const l=Array.from(a.querySelectorAll(c+" tr")),f=Array.from(a.querySelectorAll(c+" th,"+c+" td")),u=l.length;if(u===0||f.length===0)return;let b=0;f.forEach(m=>{b+=m.colSpan||1});const g=Array.from(Array(u),()=>Array(b).fill(null));l.forEach(m=>{const w=m.sectionRowIndex;let S=0;Array.from(m.querySelectorAll("th,td")).forEach(x=>{for(let O=0;O<g[w].length;O++)if(g[w][O]===null){S=O;break}const z=x.rowSpan||1,C=x.colSpan||1;for(let O=0;O<z;O++)for(let wt=0;wt<C;wt++)w+O<u&&S+wt<b&&(g[w+O][S+wt]=O===0&&wt===0?"1":"0")})}),l.forEach(m=>{const w=m.sectionRowIndex;Array.from(m.querySelectorAll("th,td")).forEach(S=>{for(let x=0;x<g[w].length;x++)if(g[w][x]==="1"){S.dataset.col=x,g[w][x]="0";break}})})},"resetColIndex"),o=n.cloneNode(!0);return s(o),e(o),r(o,"thead"),r(o,"tbody"),r(o,"tfoot"),Array.from(o.querySelectorAll("colgroup col")).forEach((a,c)=>{const l=a.getAttribute("fixed");l&&o.querySelectorAll(`thead [data-col="${c}"], tbody [data-col="${c}"], tfoot [data-col="${c}"]`).forEach(f=>{f.setAttribute("fixed",l)})}),o}};h(Jt,"TableCompiler");let pe=Jt;const Ne=class Ne{constructor(n){d(this,Y);d(this,j);d(this,ot,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});T(this,"render",h(()=>{const{startRow:n,startCol:e,endRow:s,endCol:r}=t(this,ot);y.log("🎨 [CellSelection.render] Rendering range ->",t(this,ot));const o=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");if(o.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right")})}),n<0||e<0){y.log("⚠️ [CellSelection.render] Range is invalid (< 0), skipping render.");return}let i=0;o.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{if(c.classList.contains("nodata"))return;const{matrixRow:l}=St(this,Y,Pt).call(this,c);l<0||c.querySelectorAll("td, th").forEach(f=>{const u=parseInt(f.dataset.col,10);if(isNaN(u))return;const b=parseInt(f.rowSpan||1,10),g=parseInt(f.colSpan||1,10),m=l+b-1,w=u+g-1;m>=n&&l<=s&&w>=e&&u<=r&&(i++,f.classList.add("selected"),l===n&&f.classList.add("selected-top"),m===s&&f.classList.add("selected-bottom"),u===e&&f.classList.add("selected-left"),w===r&&f.classList.add("selected-right"))})})}),y.log(`✨ [CellSelection.render] Total rendered cells marked: ${i}`)},"render"));p(this,j,n),St(this,Y,is).call(this),y.log("🎯 [CellSelection] Initialized")}setRange(n,e,s,r){y.log(`🔍 [CellSelection.setRange] Input -> startRow: ${n}, startCol: ${e}, endRow: ${s}, endCol: ${r}`);let o=Math.min(n,s),i=Math.max(n,s),a=Math.min(e,r),c=Math.max(e,r);const l=t(this,j).querySelectorAll(".ng-container-left .ng-part-body, .ng-container-body .ng-part-body, .ng-container-right .ng-part-body");let f=!0,u=0;for(;f&&u<5;)f=!1,u++,l.forEach(b=>{b.querySelectorAll("tbody tr").forEach(g=>{if(g.classList.contains("nodata"))return;const{matrixRow:m}=St(this,Y,Pt).call(this,g);m<0||g.querySelectorAll("td, th").forEach(w=>{const S=parseInt(w.dataset.col,10);if(isNaN(S))return;const x=parseInt(w.rowSpan||1,10),z=parseInt(w.colSpan||1,10),C=m+x-1,O=S+z-1;if(C>=o&&m<=i&&O>=a&&S<=c){const Qe=Math.min(o,m),ts=Math.max(i,C),es=Math.min(a,S),ss=Math.max(c,O);(Qe!==o||ts!==i||es!==a||ss!==c)&&(o=Qe,i=ts,a=es,c=ss,f=!0)}})})});p(this,ot,{startRow:o,startCol:a,endRow:i,endCol:c}),y.log("📦 [CellSelection.setRange] Final Range ->",t(this,ot)),this.render()}};j=new WeakMap,ot=new WeakMap,Y=new WeakSet,Pt=h(function(n){if(!n||n.classList.contains("nodata"))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(n.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=n.closest("tbody"),o=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(l=>parseInt(l.dataset.row,10)===e),i=o.indexOf(n),a=o.length>0?o.length:1,c=e*a+(i>=0?i:n.sectionRowIndex%a);return{dataRow:e,subRowIndex:i,matrixRow:c}},"#getMatrixRow"),is=h(function(){const n=t(this,j).querySelector(".ng-container-top");if(!n){y.log("❌ [CellSelection] .ng-container-top not found!");return}n.addEventListener("mousedown",e=>{if(e.button!==0)return;const s=e.target.closest("td, th");if(!s||s.dataset.row===void 0||s.dataset.col===void 0||s.closest("tr").classList.contains("nodata"))return;const r=s.closest("tr"),{matrixRow:o}=St(this,Y,Pt).call(this,r),i=parseInt(s.dataset.col,10);if(o<0)return;y.log(`🖱️ [MouseDown Success] startRow: ${o}, startCol: ${i}`),this.setRange(o,i,o,i);const a=h(l=>{l.preventDefault();const f=document.elementFromPoint(l.clientX,l.clientY);let u=f==null?void 0:f.closest("td, th");if(!u||!t(this,j).contains(u)){const w=t(this,j).querySelectorAll(".ng-part-body tbody tr:not(.nodata) td, .ng-part-body tbody tr:not(.nodata) th");for(const S of w){const x=S.getBoundingClientRect();if(l.clientX>=x.left&&l.clientX<=x.right&&l.clientY>=x.top&&l.clientY<=x.bottom){u=S;break}}}if(!u||u.dataset.row===void 0||u.dataset.col===void 0||u.closest("tr").classList.contains("nodata"))return;const b=u.closest("tr"),{matrixRow:g}=St(this,Y,Pt).call(this,b),m=parseInt(u.dataset.col,10);g<0||this.setRange(o,i,g,m)},"onMouseMove"),c=h(()=>{y.log("🖱️ [MouseUp] Drag ended."),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)},"onMouseUp");document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)})},"#initEvents"),h(Ne,"CellSelection");let ye=Ne;const Mt=class Mt extends HTMLElement{constructor(){super();d(this,Qt);d(this,it,null);d(this,at);d(this,It);T(this,"invalidate",h(()=>{y.log("sheet.invalidate()"),t(this,at).refresh()},"invalidate"));T(this,"generate",h(e=>{if(y.log("sheet.generate()"),!e)return;p(this,it,pe.compile(e)),t(this,te).call(this),t(this,ee).call(this);const s=this.querySelector(".ng-container-body .ng-part-header"),r=this.querySelector(".ng-container-body .ng-part-footer"),o=this.querySelector(".ng-nodata-overlay");s&&o&&(o.style.top=`${s.offsetHeight}px`),r&&o&&(o.style.bottom=`${r.offsetHeight}px`),t(this,at).initialize(),setTimeout(()=>{var i;(i=this.querySelector("nine-table-hscrollbar"))==null||i.refresh()},0)},"generate"));d(this,te,h(()=>{[{selector:".ng-container-body",type:null},{selector:".ng-container-left",type:"left"},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:r})=>{var o,i,a;(o=this.querySelector(`${s} .ng-part-header`))==null||o.appendChild(t(this,gt).call(this,t(this,it),r,"header")),(i=this.querySelector(`${s} .ng-virtual-spacer`))==null||i.before(t(this,gt).call(this,t(this,it),r,"body")),(a=this.querySelector(`${s} .ng-part-footer`))==null||a.appendChild(t(this,gt).call(this,t(this,it),r,"footer"))})},"#renderSplitContainers"));d(this,ee,h(()=>{["left","right","body"].forEach(e=>{const s=this.querySelector(`.ng-container-${e}`),r=s==null?void 0:s.querySelectorAll("table");if(!s||!r||r.length===0)return;let o=0;r[0].querySelectorAll("col").forEach(i=>{const a=parseInt(i.getAttribute("width"),10);isNaN(o)||(o+=a)}),e==="body"?s.style.flex="1":(s.style.flex=`0 0 ${o}px`,s.style.width=`${o}px`)})},"#updateContainerWidths"));d(this,gt,h((e,s,r)=>{const o=e.cloneNode(!0),i=o.querySelector("thead"),a=o.querySelector("tbody"),c=o.querySelector("tfoot");if(r==="header"){if(a&&a.remove(),c&&c.remove(),e.querySelector("tbody")){const f=document.createElement("tbody");f.className="fixed-tbody",o.appendChild(f)}}else r==="body"?(i&&i.remove(),c&&c.remove(),a&&(a.className="bindable-tbody")):r==="footer"&&(i&&i.remove(),a&&a.remove());return s==="left"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="left"&&l.remove()}):s==="right"?o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach(l=>{l.getAttribute("fixed")!=="right"&&l.remove()}):o.querySelectorAll("[fixed=left], [fixed=right]").forEach(l=>{l.remove()}),o},"#createSplitTable"));T(this,"getRowHeight",h(()=>t(this,at).getRowHeight(),"getRowHeight"));T(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollLeft=e)},"scrollToX"));T(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-container-body .ng-part-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,se,h(()=>{t(this,ne).call(this),p(this,It,new ye(this))},"#init"));d(this,ne,h(()=>{const e=Mt.SCROLLBAR_SIZE;this.innerHTML=`
|
|
127
127
|
<style>
|
|
128
128
|
nine-table-sheet {
|
|
129
129
|
display: none;
|