@ninebone/table 0.1.34 → 0.1.36
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/css/nine-table-sheet.css +600 -0
- package/dist/nine-table.js +1237 -1842
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +32 -639
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`,"<br>");let s=document.body.querySelector("canvas#_nine_measure_canvas_");s||(s=document.createElement("canvas"),s.id="_nine_measure_canvas_",s.style.cssText="position: absolute; visibility: hidden; pointer-events: none; left: -9999px;",document.body.appendChild(s));const i=s.getContext("2d");i.font=r;let n=0,o=0;for(let l of Nt.split("<br>")){const a=e(l),c=i.measureText(a);n=Math.max(n,c.width);const u=c.fontBoundingBoxAscent||10,p=c.fontBoundingBoxDescent||3;o+=u+p}return{width:n,height:o}};const lo=class lo extends H.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(lo,"Trace");let de=lo;const v=new de,Dt={META:{INDEX:{ROWID:0,FILTER:1,GROUP:2}},ROW_STATE:{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"},EVENT:{LOAD:"load",CELL_BUTTON_CLICK:"cell-button-click"}},ao=class ao{constructor(r){d(this,zs);d(this,Fs,-1);E(this,"count",h(()=>t(this,zs).rawRecords.length,"count"));g(this,zs,r)}get at(){return t(this,Fs)}set at(r){g(this,Fs,parseInt(r,10))}};zs=new WeakMap,Fs=new WeakMap,h(ao,"ngRow");let vr=ao;const at=class at{constructor(r,e){d(this,At);d(this,G);d(this,Ws,0);d(this,pe,[]);d(this,Qt,h(()=>(t(this,G).rawRecords||[]).filter(e=>{var s;return!((s=e.__ng)!=null&&s.deleted)}),"#getValidRecords"));E(this,"count",h(()=>this.length,"count"));E(this,"getArray",h((r,e)=>{const s=t(this,Qt).call(this);if(r==null)return s;if(r<0||r>=s.length)return null;const i=s[r];if(e!=null){const o=this.getHostFields().indexOf(e);return o>=0?i.v[o]:null}return i},"getArray"));E(this,"setArray",h((r,e,s)=>{const n=t(this,Qt).call(this)[r];n.v[e]!==s&&n.__ng.rowState!==at.ROW_STATE.INSERT&&(n.__ng.rowState=at.ROW_STATE.UPDATE),n.v[e]=s},"setArray"));E(this,"get",h((r,e)=>{const s=t(this,Qt).call(this);if(r==null)return t(this,ds).call(this,s);if(r<0||r>=s.length)return null;const i=s[r],n=this.getHostFields();if(e!=null){const o=n.indexOf(e);return o>=0?i.v[o]:null}return t(this,ds).call(this,i)},"get"));E(this,"getAll",h(()=>t(this,G).rawRecords||[],"getAll"));E(this,"getHostFields",h(()=>{var r;return typeof((r=t(this,At).fields)==null?void 0:r.get)=="function"?t(this,At).fields.get():[]},"getHostFields"));d(this,Gi,h(()=>{g(this,pe,[]);const r=t(this,At).template||[];Array.from(r).forEach(e=>{var s;t(this,pe).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,G).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,Os).call(this)),e.__ng.height=t(this,pe).slice()})},"#initialize"));d(this,ge,h(()=>{var e;const r=t(this,At).shadowRoot.querySelector("nine-table-sheets");r==null||r.classList.toggle("nodata",this.length===0),t(this,At).shadowRoot.querySelectorAll("nine-table-sheet").forEach(s=>{s.invalidate()}),(e=t(this,At).shadowRoot.querySelector("nine-table-sheets-footer"))==null||e.refresh()},"#invalidate"));E(this,"set",h(r=>{const e=h(()=>{this.clear(),this.add(r,!1),t(this,ge).call(this)},"loadData");t(this,At).loaded?e():t(this,At).addEventListener(Dt.EVENT.LOAD,s=>{e()},{once:!0})},"set"));d(this,Os,h((r=0)=>({rowState:at.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,pe).slice(),o:{},c:{},__:[0,0,0,0,at.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,pe).slice(),-1,{},{}],_:[r,[]]}),"#getDefaultMeta"));E(this,"reset",h(()=>{t(this,G).rawRecords=[],t(this,ge).call(this)},"reset"));E(this,"clear",h(()=>{var r;t(this,G).rawRecords=[],(r=t(this,G).viewRecords)!=null&&r.reset&&t(this,G).viewRecords.reset(),g(this,Ws,0),t(this,ge).call(this)},"clear"));d(this,Ui,h(r=>{Array.isArray(r)||(r=[r]);const e=this.getHostFields().length>0?this.getHostFields():Object.keys(r[0]||{}),s=[];return r.forEach(i=>{const n={v:[]};e.forEach(o=>{n.v.push(i[o]!==void 0&&i[o]!==null?i[o]:"")}),s.push(n)}),s},"#json2Array"));d(this,ji,h(r=>(Array.isArray(r)||(r=[r]),r.forEach(e=>{const s=this.nextId;e.m=t(this,Os).call(this,s),e.__ng=e.m,e.__ng.rowid=s,e.__ng.rowState=at.ROW_STATE.INSERT,e.__ng._[0]=s}),r),"#defaultInsert"));E(this,"add",h((r,e=!0)=>{r===void 0&&(r={});const s=t(this,Ui).call(this,r);t(this,G).rawRecords=t(this,G).rawRecords.concat(t(this,ji).call(this,s));const i=this.count()-1;return e||s.forEach((n,o)=>{const l=t(this,G).rawRecords[t(this,G).rawRecords.length-1-o];l&&(l.__ng.rowState=at.ROW_STATE.EMPTY)}),t(this,ge).call(this),i},"add"));E(this,"delete",h(r=>{let e=[];Array.isArray(r)?e=r:typeof r>"u"?e=[t(this,G).host.row.at]:e=[parseInt(r,10)];const s=t(this,Qt).call(this);e.sort((i,n)=>n-i).forEach(i=>{if(s[i]){const n=s[i].__ng.rowid;s[i].__ng.rowState===at.ROW_STATE.INSERT?t(this,G).rawRecords=t(this,G).rawRecords.filter(o=>o.__ng.rowid!==n):t(this,G).rawRecords.forEach(o=>{o.__ng.rowid===n&&(o.__ng.deleted=!0,o.__ng.rowState=at.ROW_STATE.DELETE)})}}),t(this,ge).call(this)},"delete"));E(this,"setValue",h((r,e,s)=>{r=parseInt(r,10);const n=this.getHostFields().indexOf(e);if(n<0)return;const l=t(this,Qt).call(this)[r];if(!l)return;const a=l.v[n];a!==s&&l.__ng.rowState!==at.ROW_STATE.INSERT&&(l.__ng.o.hasOwnProperty(e)||(l.__ng.o[e]=a),l.__ng.rowState=at.ROW_STATE.UPDATE),l.v[n]=s},"setValue"));d(this,ds,h(r=>{if(!r)return r;const e=!Array.isArray(r),s=e?[r]:r,i=this.getHostFields(),n=s.filter(o=>{var l;return!((l=o.__ng)!=null&&l.deleted)}).map(o=>{const l={};return i.forEach((a,c)=>{l[a]=o.v?o.v[c]:o[a]}),l.__ng=o.__ng,l});return e?n[0]:n},"#conv"));g(this,At,r),g(this,G,e),t(this,Gi).call(this)}get count(){return this.length}get source(){return t(this,ds).call(this,t(this,G).rawRecords)}set source(r){this.set(r)}get nextId(){return Al(this,Ws)._++}get length(){return t(this,Qt).call(this).length}get count(){return this.length}getRowCount(){return this.length}};At=new WeakMap,G=new WeakMap,Ws=new WeakMap,pe=new WeakMap,Qt=new WeakMap,Gi=new WeakMap,ge=new WeakMap,Os=new WeakMap,Ui=new WeakMap,ji=new WeakMap,ds=new WeakMap,h(at,"ngData"),E(at,"META_INDEX",{FILTER:0}),E(at,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Sr=at;const co=class co{constructor(r){d(this,Ie);g(this,Ie,r),this.row=new vr(this),this.data=new Sr(t(this,Ie),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,Ie).view)!=null&&e.redraw&&t(this,Ie).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var i,n;const s=parseInt(e,10);if(!(s>=this.data.count()))return(n=(i=this.data.getValidData()[s])==null?void 0:i.__ng)==null?void 0:n.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,i)=>{e=parseInt(e,10),this.data.setValue(e,s,i)},this.setDataSource([])}};Ie=new WeakMap,h(co,"ngDataManager");let Ar=co;const ho=class ho{constructor(r){d(this,us);d(this,Z,[]);E(this,"add",h((r,e="string")=>{r.forEach(s=>{t(this,Z).some(i=>i.name===s)||t(this,Z).push({name:s,type:e})}),t(this,Bs).call(this)},"add"));d(this,Bs,h(()=>{const r=new Map;t(this,Z).forEach(e=>{r.set(e.name,e.type)}),g(this,Z,Array.from(r,([e,s])=>({name:e,type:s}))),g(this,Z,t(this,Z).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,Z).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,Ki,h(()=>{g(this,Z,[]),v.log(t(this,us).querySelectorAll("table"));const r=Array.from(t(this,us).querySelectorAll("table"));if(!(!r||r.length===0)){for(const e of r)v.log(e),e.querySelectorAll("[data-bind]").forEach(i=>{const n=i.dataset.bind,o=i.getAttribute("data-type")||"string";n&&t(this,Z).push({name:n,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(i=>{e.querySelectorAll(`[${i}]`).forEach(n=>{let o=n.getAttribute(i);if(o){if(o.indexOf("data.")<0){const l=o.search(/[(]/g);if(l>0)try{o=String(window[o.substring(0,l).trim()])}catch{o=""}}o.split("data.").forEach(l=>{if(l.trim()!=""){const a=l.search(/[^_A-Za-z0-9]/g);let c="";a>=0?c=l.substring(0,a):o.startsWith("data.")&&(c=l.replace("data.","")),c&&t(this,Z).push({name:c,type:"string"})}})}})});t(this,Bs).call(this)}},"#init"));g(this,us,r),t(this,Ki).call(this)}get(){return t(this,Z).map(r=>r.name)}getFields(){return t(this,Z)}getType(r){const e=t(this,Z).find(s=>s.name===r);return e?e.type:"string"}indexOf(r){return t(this,Z).findIndex(e=>e.name===r)}includes(r){return t(this,Z).some(e=>e.name===r)}};us=new WeakMap,Z=new WeakMap,Bs=new WeakMap,Ki=new WeakMap,h(ho,"fields");let Er=ho;const uo=class uo extends HTMLElement{constructor(){super();d(this,Yi,h(()=>{},"#init"))}connectedCallback(){t(this,Yi).call(this)}};Yi=new WeakMap,h(uo,"NineTableSheets");let Lr=uo;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",Lr);const fo=class fo extends HTMLElement{constructor(){super();d(this,Ji);d(this,Pt);E(this,"refresh",h(()=>{this.querySelector("#row-count").innerHTML=t(this,Pt).data.count().toLocaleString()},"refresh"));d(this,Zi,h(()=>{var e;g(this,Pt,this.getRootNode().host),A(this,Ji,El).call(this),(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{const i=s.ctrlKey||s.metaKey||s.shiftKey,n=s.target.closest("nt-sheets-tab-item");if(!n)return;const o=parseInt(n.dataset.index,10);t(this,Vs).call(this,o,i)}),t(this,Vs).call(this,0,!1)},"#init"));d(this,Vs,h((e,s=!1)=>{const i=h(()=>{const u=Array.from(t(this,Pt).shadowRoot.querySelectorAll("nine-table-sheet"));Array.from(t(this,Pt).shadowRoot.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const f=u.map((b,m)=>({sheet:b,idx:m})).filter(({sheet:b})=>b.classList.contains("active"));if(!(f.length<2))for(let b=0;b<f.length-1;b++){const m=f[b].idx,y=t(this,Pt).shadowRoot.querySelector(`nine-splitter[data-split-index="${m}"]`);y&&y.style.setProperty("display","")}},"updateSplitters"),n=this.querySelector(".nine-tab-bar"),o=t(this,Pt).shadowRoot.querySelector("nine-table-sheets-body"),l=n.querySelectorAll("nt-sheets-tab-item"),a=o.querySelectorAll("nine-table-sheet");if(!l[e])return;if(!s)l.forEach((u,p)=>{u.setActive(p===e)}),a.forEach((u,p)=>{const f=p===e;u.classList.toggle("active",f),u.style.flex=f?"1 1 100%":""});else{const u=l[e],p=n.querySelectorAll("nt-sheets-tab-item.active");if(u.classList.contains("active")&&p.length<=1)return;u.classList.toggle("active");const f=o.querySelector(`nine-table-sheet[data-index="${e}"]`);f&&(f.classList.toggle("active"),f.classList.contains("active")||(f.style.flex=""))}const c=o.querySelectorAll("nine-table-sheet.active");c==null||c.forEach(u=>{var p;u.style.flex=c.length>1?"1 1 0%":"1 1 100%",typeof u.refreshLayout=="function"?u.refreshLayout():(p=u.invalidate)==null||p.call(u)}),i()},"#switchSheet"))}connectedCallback(){t(this,Zi).call(this)}};Pt=new WeakMap,Zi=new WeakMap,Vs=new WeakMap,Ji=new WeakSet,El=h(function(){const i=Array.from(t(this,Pt).children).filter(n=>n.tagName.toUpperCase()==="TABLE").map((n,o)=>{const l=o===0?"active":"",a=n.getAttribute("caption")||`Sheet ${o+1}`;return`<nt-sheets-tab-item class="${l}" data-index="${o}">${a}</nt-sheets-tab-item>`}).join("");this.innerHTML=`
|
|
1
|
+
(function(k,H){typeof exports=="object"&&typeof module<"u"?H(exports,require("@ninebone/util")):typeof define=="function"&&define.amd?define(["exports","@ninebone/util"],H):(k=typeof globalThis<"u"?globalThis:k||self,H(k.NineTable={},k.nine))})(this,function(k,H){"use strict";var vl=Object.defineProperty;var Sl=k=>{throw TypeError(k)};var ia=(k,H,B)=>H in k?vl(k,H,{enumerable:!0,configurable:!0,writable:!0,value:B}):k[H]=B;var h=(k,H)=>vl(k,"name",{value:H,configurable:!0});var E=(k,H,B)=>ia(k,typeof H!="symbol"?H+"":H,B),nl=(k,H,B)=>H.has(k)||Sl("Cannot "+B);var t=(k,H,B)=>(nl(k,H,"read from private field"),B?B.call(k):H.get(k)),d=(k,H,B)=>H.has(k)?Sl("Cannot add the same private member more than once"):H instanceof WeakSet?H.add(k):H.set(k,B),p=(k,H,B,de)=>(nl(k,H,"write to private field"),de?de.call(k,B):H.set(k,B),B),A=(k,H,B)=>(nl(k,H,"access private method"),B);var Al=(k,H,B,de)=>({set _(v){p(k,H,v,B)},get _(){return t(k,H,de)}});var Fs,Ws,At,U,Os,ge,Qt,Ui,pe,zs,Gi,ji,ds,Ie,us,Z,Bs,Ki,Yi,Vt,Zi,Ps,Ji,El,Et,fs,be,Ll,Rl,Cl,Lt,qe,N,Me,He,Ne,Qi,De,tr,er,M,$e,F,Vs,mo,Xs,Fe,sr,ir,$t,_s,We,Oe,ze,ft,ol,ll,al,cl,rr,Us,L,Be,Gs,te,G,me,ee,gs,ps,Pe,Ve,nr,or,js,Ks,Ys,bs,lr,ar,cr,Zs,hl,J,Js,se,zi,Tl,$,Qs,ye,Xt,So,Ao,pt,cs,dl,ti,ei,si,ii,ri,ms,ni,kl,X,Xe,Ct,_e,_t,Tt,Ut,Gt,ys,jt,xe,oi,li,kt,yn,ul,ai,ci,fl,hi,hr,di,K,P,et,we,ie,re,Ft,ui,Ue,st,Il,ql,xn,Ml,fi,Hl,gi,gl,dr,ve,Wt,ne,bt,oe,Kt,ur,fr,gr,pr,Nl,br,mr,yr,To,Ge,je,pi,It,Se,Ke,xr,Yt,wr,vr,bi,pl,ct,mi,ht,Ot,Dl,$l,Fl,bl,Ye,yt,Ae,Ho,yi,le,xi,Sr,O,Wl,Ol,zl,Bl,Pl,Vl,Xl,_l,Ul,Gl,jl,Kl,wi,ae,zt,vi,Si,Ee,xs,Ai,Ar,Ei,ws,Ze,qt,Je,Er,Yl,Lr,Rr,Qe,Li,Cr,Tr,kr,Ir,Ri,qr,it,Mr,Ti,Hr,ki,vs,Ii,qi,Le,Mi,Ss,Nr,Dr,Zl,I,Ni,dt,q,ts,es,$r,Fr,Mt,Wr,Or,zr,xt,As,Br,Es,Pr,wt,ce,Vr,Ls,Xr,he,Rs,ss,Cs,Ts,_r,Ur,Gr,is,Bt,rs,ks,_o,Uo,Go,jo,jr,Di,Kr,Yr,ot,Zr,Jr,Is,Qr,tn,en,sn,rn,nn,on,qs,Pt,Re,ns,os,Ce,Ht,$i,ln,Fi,an,cn,hn,Ms,dn,ls,Wi,un,Hs,Ns,fn,gn,ut,Y,Ds,Q,vt,pn,j,wn,ml,Jl,yl,Ql,ta,ea,Oi,Zt,as,xl,sa;Array.prototype.nineBinarySearch=function(Nt){let n=0,e=this.length-1,s;for(;n<=e;){if(s=parseInt((n+e)/2),Nt===this[s])return s;Nt<this[s]?e=s-1:n=s+1}return-1};const B=new WeakMap;HTMLElement.prototype.addDebounseEventListener=function(Nt,n,e,s,i=500){const r=this;B.has(r)||B.set(r,{timer:null,cancelFn:null});const o=B.get(r);r.addEventListener(e,l=>{l.actualTarget=l.target,o.timer&&(clearTimeout(o.timer),o.timer=null),o.timer=setTimeout(()=>{o.timer=null,o.cancelFn=s.call(r,l)},i)}),r.addEventListener(Nt,l=>{o.timer&&(clearTimeout(o.timer),o.timer=null),o.cancelFn&&(o.cancelFn(),o.cancelFn=null),n.call(r,l)})},nine.measureTextSize=(Nt,n="12px sans-serif")=>{if(typeof Nt=="number"&&(Nt=Nt+""),!Nt)return{width:null,height:null};const e=h(l=>{const a=document.createElement("DIV");return a.innerHTML=l,a.textContent||a.innerText||""},"stripHtml");Nt=Nt.replaceAll(`
|
|
2
|
+
`,"<br>");let s=document.body.querySelector("canvas#_nine_measure_canvas_");s||(s=document.createElement("canvas"),s.id="_nine_measure_canvas_",s.style.cssText="position: absolute; visibility: hidden; pointer-events: none; left: -9999px;",document.body.appendChild(s));const i=s.getContext("2d");i.font=n;let r=0,o=0;for(let l of Nt.split("<br>")){const a=e(l),c=i.measureText(a);r=Math.max(r,c.width);const u=c.fontBoundingBoxAscent||10,g=c.fontBoundingBoxDescent||3;o+=u+g}return{width:r,height:o}};const lo=class lo extends H.trace.constructor{constructor(){super(),this.init("nine-table","green")}};h(lo,"Trace");let de=lo;const v=new de,Dt={META:{INDEX:{ROWID:0,FILTER:1,GROUP:2}},ROW_STATE:{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"},EVENT:{LOAD:"load",CELL_BUTTON_CLICK:"cell-button-click"}},ao=class ao{constructor(n){d(this,Fs);d(this,Ws,-1);E(this,"count",h(()=>t(this,Fs).rawRecords.length,"count"));p(this,Fs,n)}get at(){return t(this,Ws)}set at(n){p(this,Ws,parseInt(n,10))}};Fs=new WeakMap,Ws=new WeakMap,h(ao,"ngRow");let vn=ao;const at=class at{constructor(n,e){d(this,At);d(this,U);d(this,Os,0);d(this,ge,[]);d(this,Qt,h(()=>(t(this,U).rawRecords||[]).filter(e=>{var s;return!((s=e.__ng)!=null&&s.deleted)}),"#getValidRecords"));E(this,"count",h(()=>this.length,"count"));E(this,"getArray",h((n,e)=>{const s=t(this,Qt).call(this);if(n==null)return s;if(n<0||n>=s.length)return null;const i=s[n];if(e!=null){const o=this.getHostFields().indexOf(e);return o>=0?i.v[o]:null}return i},"getArray"));E(this,"setArray",h((n,e,s)=>{const r=t(this,Qt).call(this)[n];r.v[e]!==s&&r.__ng.rowState!==at.ROW_STATE.INSERT&&(r.__ng.rowState=at.ROW_STATE.UPDATE),r.v[e]=s},"setArray"));E(this,"get",h((n,e)=>{const s=t(this,Qt).call(this);if(n==null)return t(this,ds).call(this,s);if(n<0||n>=s.length)return null;const i=s[n],r=this.getHostFields();if(e!=null){const o=r.indexOf(e);return o>=0?i.v[o]:null}return t(this,ds).call(this,i)},"get"));E(this,"getAll",h(()=>t(this,U).rawRecords||[],"getAll"));E(this,"getHostFields",h(()=>{var n;return typeof((n=t(this,At).fields)==null?void 0:n.get)=="function"?t(this,At).fields.get():[]},"getHostFields"));d(this,Ui,h(()=>{p(this,ge,[]);const n=t(this,At).template||[];Array.from(n).forEach(e=>{var s;t(this,ge).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,U).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,zs).call(this)),e.__ng.height=t(this,ge).slice()})},"#initialize"));d(this,pe,h(()=>{var e;const n=t(this,At).shadowRoot.querySelector("nine-table-sheets");n==null||n.classList.toggle("nodata",this.length===0),t(this,At).shadowRoot.querySelectorAll("nine-table-sheet").forEach(s=>{s.invalidate()}),(e=t(this,At).shadowRoot.querySelector("nine-table-sheets-footer"))==null||e.refresh()},"#invalidate"));E(this,"set",h(n=>{const e=h(()=>{this.clear(),this.add(n,!1),t(this,pe).call(this)},"loadData");t(this,At).loaded?e():t(this,At).addEventListener(Dt.EVENT.LOAD,s=>{e()},{once:!0})},"set"));d(this,zs,h((n=0)=>({rowState:at.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,ge).slice(),o:{},c:{},__:[0,0,0,0,at.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,ge).slice(),-1,{},{}],_:[n,[]]}),"#getDefaultMeta"));E(this,"reset",h(()=>{t(this,U).rawRecords=[],t(this,pe).call(this)},"reset"));E(this,"clear",h(()=>{var n;t(this,U).rawRecords=[],(n=t(this,U).viewRecords)!=null&&n.reset&&t(this,U).viewRecords.reset(),p(this,Os,0),t(this,pe).call(this)},"clear"));d(this,Gi,h(n=>{Array.isArray(n)||(n=[n]);const e=this.getHostFields().length>0?this.getHostFields():Object.keys(n[0]||{}),s=[];return n.forEach(i=>{const r={v:[]};e.forEach(o=>{r.v.push(i[o]!==void 0&&i[o]!==null?i[o]:"")}),s.push(r)}),s},"#json2Array"));d(this,ji,h(n=>(Array.isArray(n)||(n=[n]),n.forEach(e=>{const s=this.nextId;e.m=t(this,zs).call(this,s),e.__ng=e.m,e.__ng.rowid=s,e.__ng.rowState=at.ROW_STATE.INSERT,e.__ng._[0]=s}),n),"#defaultInsert"));E(this,"add",h((n,e=!0)=>{n===void 0&&(n={});const s=t(this,Gi).call(this,n);t(this,U).rawRecords=t(this,U).rawRecords.concat(t(this,ji).call(this,s));const i=this.count()-1;return e||s.forEach((r,o)=>{const l=t(this,U).rawRecords[t(this,U).rawRecords.length-1-o];l&&(l.__ng.rowState=at.ROW_STATE.EMPTY)}),t(this,pe).call(this),i},"add"));E(this,"delete",h(n=>{let e=[];Array.isArray(n)?e=n:typeof n>"u"?e=[t(this,U).host.row.at]:e=[parseInt(n,10)];const s=t(this,Qt).call(this);e.sort((i,r)=>r-i).forEach(i=>{if(s[i]){const r=s[i].__ng.rowid;s[i].__ng.rowState===at.ROW_STATE.INSERT?t(this,U).rawRecords=t(this,U).rawRecords.filter(o=>o.__ng.rowid!==r):t(this,U).rawRecords.forEach(o=>{o.__ng.rowid===r&&(o.__ng.deleted=!0,o.__ng.rowState=at.ROW_STATE.DELETE)})}}),t(this,pe).call(this)},"delete"));E(this,"setValue",h((n,e,s)=>{n=parseInt(n,10);const r=this.getHostFields().indexOf(e);if(r<0)return;const l=t(this,Qt).call(this)[n];if(!l)return;const a=l.v[r];a!==s&&l.__ng.rowState!==at.ROW_STATE.INSERT&&(l.__ng.o.hasOwnProperty(e)||(l.__ng.o[e]=a),l.__ng.rowState=at.ROW_STATE.UPDATE),l.v[r]=s},"setValue"));d(this,ds,h(n=>{if(!n)return n;const e=!Array.isArray(n),s=e?[n]:n,i=this.getHostFields(),r=s.filter(o=>{var l;return!((l=o.__ng)!=null&&l.deleted)}).map(o=>{const l={};return i.forEach((a,c)=>{l[a]=o.v?o.v[c]:o[a]}),l.__ng=o.__ng,l});return e?r[0]:r},"#conv"));p(this,At,n),p(this,U,e),t(this,Ui).call(this)}get count(){return this.length}get source(){return t(this,ds).call(this,t(this,U).rawRecords)}set source(n){this.set(n)}get nextId(){return Al(this,Os)._++}get length(){return t(this,Qt).call(this).length}get count(){return this.length}getRowCount(){return this.length}};At=new WeakMap,U=new WeakMap,Os=new WeakMap,ge=new WeakMap,Qt=new WeakMap,Ui=new WeakMap,pe=new WeakMap,zs=new WeakMap,Gi=new WeakMap,ji=new WeakMap,ds=new WeakMap,h(at,"ngData"),E(at,"META_INDEX",{FILTER:0}),E(at,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Sn=at;const co=class co{constructor(n){d(this,Ie);p(this,Ie,n),this.row=new vn(this),this.data=new Sn(t(this,Ie),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,Ie).view)!=null&&e.redraw&&t(this,Ie).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var i,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(i=this.data.getValidData()[s])==null?void 0:i.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,i)=>{e=parseInt(e,10),this.data.setValue(e,s,i)},this.setDataSource([])}};Ie=new WeakMap,h(co,"ngDataManager");let An=co;const ho=class ho{constructor(n){d(this,us);d(this,Z,[]);E(this,"add",h((n,e="string")=>{n.forEach(s=>{t(this,Z).some(i=>i.name===s)||t(this,Z).push({name:s,type:e})}),t(this,Bs).call(this)},"add"));d(this,Bs,h(()=>{const n=new Map;t(this,Z).forEach(e=>{n.set(e.name,e.type)}),p(this,Z,Array.from(n,([e,s])=>({name:e,type:s}))),p(this,Z,t(this,Z).filter(e=>e.name!==""&&e.name!=="__ng")),t(this,Z).sort((e,s)=>e.name.length<s.name.length?1:-1)},"#adjust"));d(this,Ki,h(()=>{p(this,Z,[]),v.log(t(this,us).querySelectorAll("table"));const n=Array.from(t(this,us).querySelectorAll("table"));if(!(!n||n.length===0)){for(const e of n)v.log(e),e.querySelectorAll("[data-bind]").forEach(i=>{const r=i.dataset.bind,o=i.getAttribute("data-type")||"string";r&&t(this,Z).push({name:r,type:o})}),["data-expr","background-color","color","tooltip","visible","readonly","enable-button","enable-check","class-expr","icon-color","icon-src"].forEach(i=>{e.querySelectorAll(`[${i}]`).forEach(r=>{let o=r.getAttribute(i);if(o){if(o.indexOf("data.")<0){const l=o.search(/[(]/g);if(l>0)try{o=String(window[o.substring(0,l).trim()])}catch{o=""}}o.split("data.").forEach(l=>{if(l.trim()!=""){const a=l.search(/[^_A-Za-z0-9]/g);let c="";a>=0?c=l.substring(0,a):o.startsWith("data.")&&(c=l.replace("data.","")),c&&t(this,Z).push({name:c,type:"string"})}})}})});t(this,Bs).call(this)}},"#init"));p(this,us,n),t(this,Ki).call(this)}get(){return t(this,Z).map(n=>n.name)}getFields(){return t(this,Z)}getType(n){const e=t(this,Z).find(s=>s.name===n);return e?e.type:"string"}indexOf(n){return t(this,Z).findIndex(e=>e.name===n)}includes(n){return t(this,Z).some(e=>e.name===n)}};us=new WeakMap,Z=new WeakMap,Bs=new WeakMap,Ki=new WeakMap,h(ho,"fields");let En=ho;const uo=class uo extends HTMLElement{constructor(){super();d(this,Yi,h(()=>{},"#init"))}connectedCallback(){t(this,Yi).call(this)}};Yi=new WeakMap,h(uo,"NineTableSheets");let Ln=uo;customElements.get("nine-table-sheets")||customElements.define("nine-table-sheets",Ln);const fo=class fo extends HTMLElement{constructor(){super();d(this,Ji);d(this,Vt);E(this,"refresh",h(()=>{this.querySelector("#row-count").innerHTML=t(this,Vt).data.count().toLocaleString()},"refresh"));d(this,Zi,h(()=>{var e;p(this,Vt,this.getRootNode().host),A(this,Ji,El).call(this),(e=this.querySelector(".nine-tab-bar"))==null||e.addEventListener("click",s=>{const i=s.ctrlKey||s.metaKey||s.shiftKey,r=s.target.closest("nt-sheets-tab-item");if(!r)return;const o=parseInt(r.dataset.index,10);t(this,Ps).call(this,o,i)}),t(this,Ps).call(this,0,!1)},"#init"));d(this,Ps,h((e,s=!1)=>{const i=h(()=>{const u=Array.from(t(this,Vt).shadowRoot.querySelectorAll("nine-table-sheet"));Array.from(t(this,Vt).shadowRoot.querySelectorAll("nine-splitter")).forEach(b=>b.style.setProperty("display","none"));const f=u.map((b,m)=>({sheet:b,idx:m})).filter(({sheet:b})=>b.classList.contains("active"));if(!(f.length<2))for(let b=0;b<f.length-1;b++){const m=f[b].idx,y=t(this,Vt).shadowRoot.querySelector(`nine-splitter[data-split-index="${m}"]`);y&&y.style.setProperty("display","")}},"updateSplitters"),r=this.querySelector(".nine-tab-bar"),o=t(this,Vt).shadowRoot.querySelector("nine-table-sheets-body"),l=r.querySelectorAll("nt-sheets-tab-item"),a=o.querySelectorAll("nine-table-sheet");if(!l[e])return;if(!s)l.forEach((u,g)=>{u.setActive(g===e)}),a.forEach((u,g)=>{const f=g===e;u.classList.toggle("active",f),u.style.flex=f?"1 1 100%":""});else{const u=l[e],g=r.querySelectorAll("nt-sheets-tab-item.active");if(u.classList.contains("active")&&g.length<=1)return;u.classList.toggle("active");const f=o.querySelector(`nine-table-sheet[data-index="${e}"]`);f&&(f.classList.toggle("active"),f.classList.contains("active")||(f.style.flex=""))}const c=o.querySelectorAll("nine-table-sheet.active");c==null||c.forEach(u=>{var g;u.style.flex=c.length>1?"1 1 0%":"1 1 100%",typeof u.refreshLayout=="function"?u.refreshLayout():(g=u.invalidate)==null||g.call(u)}),i()},"#switchSheet"))}connectedCallback(){t(this,Zi).call(this)}};Vt=new WeakMap,Zi=new WeakMap,Ps=new WeakMap,Ji=new WeakSet,El=h(function(){const i=Array.from(t(this,Vt).children).filter(r=>r.tagName.toUpperCase()==="TABLE").map((r,o)=>{const l=o===0?"active":"",a=r.getAttribute("caption")||`Sheet ${o+1}`;return`<nt-sheets-tab-item class="${l}" data-index="${o}">${a}</nt-sheets-tab-item>`}).join("");this.innerHTML=`
|
|
3
3
|
<div class="nine-tab-bar">${i}</div>
|
|
4
4
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
5
|
-
`},"#render"),h(fo,"NineTableSheetsFooter");let
|
|
5
|
+
`},"#render"),h(fo,"NineTableSheetsFooter");let Rn=fo;const go=class go extends HTMLElement{constructor(){super()}connectedCallback(){}setActive(n){this.classList.toggle("active",n)}};h(go,"SheetTabItem");let Cn=go;customElements.get("nt-sheets-tab-item")||customElements.define("nt-sheets-tab-item",Cn),customElements.get("nine-table-sheets-footer")||customElements.define("nine-table-sheets-footer",Rn);const po=class po extends HTMLElement{constructor(){super(...arguments);d(this,be);d(this,Et);d(this,fs)}connectedCallback(){p(this,Et,this.getRootNode().host),A(this,be,Ll).call(this),A(this,be,Cl).call(this)}addCustomElement(e){t(this,fs)&&t(this,fs).append(e)}updateCaption(e){const s=this.querySelector(".ng-toolbar-title");s&&(s.textContent=e)}};Et=new WeakMap,fs=new WeakMap,be=new WeakSet,Ll=h(function(){this.innerHTML=`
|
|
6
6
|
<div class="ng-toolbar-left">
|
|
7
7
|
<button type="button" class="ng-toolbar-menu-btn" title="Menu">
|
|
8
8
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#374151" stroke-width="2">
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
<div class="ng-toolbar-custom" id="custom-container"></div>
|
|
18
|
-
`,
|
|
18
|
+
`,p(this,fs,this.querySelector("#custom-container")),A(this,be,Rl).call(this)},"#render"),Rl=h(function(){const e=t(this,Et).getAttribute("theme")==="simple"||t(this,Et).classList.contains("simple"),s=t(this,Et).getAttribute("show-toolbar")!=="false",i=t(this,Et).getAttribute("show-menu")!=="false",r=t(this,Et).getAttribute("caption")||"";e||!s?this.setAttribute("hidden",""):this.removeAttribute("hidden"),this.setAttribute("show-menu",i?"true":"false"),this.updateCaption(r)},"#syncStateFromHost"),Cl=h(function(){const e=this.querySelector(".ng-toolbar-title");e&&e.addEventListener("dblclick",()=>{const i='<font color="green">https://www.ninegrid.net</font>',r=t(this,Et).getAttribute("caption")||"";e.innerHTML=e.innerHTML===i?r:i});const s=this.querySelector(".ng-toolbar-menu-btn");s&&s.addEventListener("click",()=>{t(this,Et).dispatchEvent(new CustomEvent("toolbar-menu-click",{bubbles:!0,composed:!0,detail:{targetTable:t(this,Et)}}))})},"#bindEvents"),h(po,"Toolbar");let Tn=po;customElements.get("nine-table-toolbar")||customElements.define("nine-table-toolbar",Tn);const bo=class bo extends HTMLElement{constructor(){super();d(this,Lt);d(this,qe,!1);d(this,N);d(this,Me);d(this,He);d(this,Ne);d(this,Qi,h(()=>{if(!t(this,Lt))return;const e=t(this,Lt).querySelector(".ng-sheet-body .ng-container-body");e&&(p(this,Ne,new ResizeObserver(()=>{this.refresh()})),t(this,Ne).observe(e))},"#observeResize"));E(this,"refresh",h(()=>{if(!t(this,Lt)||!t(this,N)||t(this,qe))return;const e=t(this,N).container,s=e.querySelector("table");if(!s)return;const i=t(this,N).track,r=t(this,N).thumb,o=e.clientWidth,l=s.scrollWidth,a=o!==0&&l>o;if(t(this,Lt).classList.toggle("hscroll-visible",a),!a)return;const c=i.clientWidth;if(c<=0)return;const u=Math.max(Math.min(c*(o/l),c),20);r.style.width=`${u}px`;const g=e.scrollLeft,f=l-o;let b=0;f>0&&(b=parseInt(g/f*(c-u),10)),b<0&&(b=0);const m=c-u;b>m&&(b=m),r.style.left=`${b}px`,t(this,N).left.disabled=b===0,t(this,N).right.disabled=b>=m-1},"refresh"));d(this,De,h(e=>{if(!t(this,N))return!1;const s=t(this,N).container,i=s.querySelector("table");if(!i)return!1;const r=t(this,N).track.getBoundingClientRect(),o=t(this,N).thumb.clientWidth;let l=e;l<0&&(l=0);const a=r.width-o;l>a&&(l=a),l=parseInt(l,10),t(this,N).thumb.style.left=`${l}px`,t(this,N).left.disabled=l===0,t(this,N).right.disabled=l>=a-1;const c=s.clientWidth,g=i.scrollWidth-c;if(a>0&&g>0){const f=l/a*g;s.scrollLeft=f;const b=t(this,Lt).querySelector(".ng-sheet-header .ng-container-body"),m=t(this,Lt).querySelector(".ng-sheet-footer .ng-container-body");b&&(b.scrollLeft=f),m&&(m.scrollLeft=f)}return l>0&&l<a-1},"#thumbMoveTo"));d(this,tr,h(()=>{const e=h(i=>{clearInterval(t(this,Me)),clearInterval(t(this,He));const r=parseInt(t(this,N).thumb.style.left||0,10);t(this,De).call(this,r+i),p(this,Me,setInterval(()=>{clearInterval(t(this,Me)),p(this,He,setInterval(()=>{const o=parseInt(t(this,N).thumb.style.left||0,10);t(this,De).call(this,o+i)||clearInterval(t(this,He))},50))},500))},"delayScroll"),s=h(()=>{clearInterval(t(this,Me)),clearInterval(t(this,He))},"clearTimer");["mouseup","mouseleave","touchend"].forEach(i=>{t(this,N).left.addEventListener(i,s),t(this,N).right.addEventListener(i,s),t(this,N).track.addEventListener(i,s)}),t(this,N).left.addEventListener("mousedown",i=>{i.button===0&&e(-20)}),t(this,N).right.addEventListener("mousedown",i=>{i.button===0&&e(20)}),t(this,N).left.addEventListener("touchstart",()=>e(-20)),t(this,N).right.addEventListener("touchstart",()=>e(20)),t(this,N).track.addEventListener("mousedown",i=>{if(i.button!==0)return;i.preventDefault();const r=t(this,N).track.getBoundingClientRect(),o=t(this,N).thumb.clientWidth;t(this,De).call(this,i.clientX-r.left-o/2)}),t(this,N).thumb.addEventListener("mousedown",i=>{if(i.button!==0)return;i.stopPropagation(),i.preventDefault(),p(this,qe,!0),this.shiftX=i.clientX-t(this,N).thumb.getBoundingClientRect().left;const r=h(l=>{if(!t(this,qe))return;const a=t(this,N).track.getBoundingClientRect();t(this,De).call(this,l.clientX-a.left-this.shiftX)},"onMouseMove"),o=h(()=>{p(this,qe,!1),s(),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",o),this.refresh()},"onMouseUp");document.addEventListener("mousemove",r),document.addEventListener("mouseup",o)})},"#init"))}connectedCallback(){if(p(this,Lt,this.closest("nine-table-sheet")||this.getRootNode().host),!t(this,Lt))return;this.innerHTML=`
|
|
19
19
|
<style>
|
|
20
20
|
nine-table-hscrollbar {
|
|
21
21
|
display: flex;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
<button class='ng-scroll-left' disabled><div class='ng-scroll-icon'></div></button>
|
|
78
78
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
79
79
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
80
|
-
`;const e=h(()=>{const s=t(this,Lt).querySelector(".ng-sheet-body .ng-container-body");if(!s){setTimeout(e,10);return}
|
|
80
|
+
`;const e=h(()=>{const s=t(this,Lt).querySelector(".ng-sheet-body .ng-container-body");if(!s){setTimeout(e,10);return}p(this,N,{container:s,track:this.querySelector(".ng-scroll-track"),thumb:this.querySelector(".ng-scroll-thumb"),left:this.querySelector(".ng-scroll-left"),right:this.querySelector(".ng-scroll-right")}),t(this,tr).call(this),t(this,Qi).call(this),this.refresh()},"initWhenReady");e()}disconnectedCallback(){t(this,Ne)&&t(this,Ne).disconnect()}};Lt=new WeakMap,qe=new WeakMap,N=new WeakMap,Me=new WeakMap,He=new WeakMap,Ne=new WeakMap,Qi=new WeakMap,De=new WeakMap,tr=new WeakMap,h(bo,"NineTableHScrollBar");let kn=bo;customElements.get("nine-table-hscrollbar")||customElements.define("nine-table-hscrollbar",kn);const yo=class yo extends HTMLElement{constructor(){super();d(this,er);d(this,M);d(this,$e,!1);d(this,F);d(this,Vs,0);d(this,mo,0);d(this,Xs,0);d(this,Fe,h(()=>{var u,g;const e=t(this,M).view.getArray(),s=e?e.length:0,i=(u=t(this,M).elements)==null?void 0:u.scrollHolder;let r=i&&parseFloat(i.style.height)||0;if(!r||r<=0)if(!!((g=t(this,M).sourceTable)!=null&&g.querySelector("tbody tr[grouping='true']"))&&t(this,M).rowManager)r=body.scrollHeight>body.clientHeight?body.scrollHeight:s*30;else{const b=t(this,M).getRowHeight()||1;r=s*b}const o=15e6,l=r>o;let a=1,c=r;return l&&(a=o/r,c=o),{rawContentHeight:r,contentHeight:c,scaleFactor:a,useScaling:l,totalCount:s}},"#getScaleInfo"));d(this,sr,h(()=>{var l,a,c,u,g,f,b,m,y,x;const e=t(this,F).container;if(!e)return 0;const s=((c=(a=(l=t(this,M).elements)==null?void 0:l.body)==null?void 0:a.thead)==null?void 0:c.offsetHeight)||0,i=((f=(g=(u=t(this,M).elements)==null?void 0:u.body)==null?void 0:g.tfoot)==null?void 0:f.offsetHeight)||0,r=((x=(y=(m=(b=t(this,M).elements)==null?void 0:b.body)==null?void 0:m.tbody)==null?void 0:y.head)==null?void 0:x.offsetHeight)||0,o=s+i+r;return e.clientHeight-o},"#getViewHeight"));E(this,"refresh",h(()=>{if(v.log("=================","vscrollbar.refresh"),t(this,$e)||!t(this,M)||!t(this,M).elements||!t(this,F))return;const e=t(this,F).container,s=t(this,F).track,i=t(this,F).thumb,r=t(this,sr).call(this),{rawContentHeight:o,contentHeight:l}=t(this,Fe).call(this),a=o>r&&o>0&&r>0;if(t(this,M).classList.toggle("vscroll-visible",a),!a)return;const c=s.clientHeight;if(c<=0)return;const u=Math.max(Math.min(c*(r/l),c),20);i.style.height=`${u}px`;const g=e.scrollTop,f=Math.max(l-t(this,M).rowManager.getRowHeight(),1);let b=0;f>0&&(b=g/f*(c-u));const m=c-u;b<0&&(b=0),b>m&&(b=m),i.style.top=`${b}px`,t(this,F).top.disabled=g<=0,t(this,F).bottom.disabled=g>=f-1},"refresh"));d(this,ir,h(()=>{v.log("nine-table-vscrollbar.#init");const e=t(this,F).container;t(this,F).thumb.addEventListener("mousedown",s=>{if(s.button!==0)return;s.stopPropagation(),s.preventDefault(),p(this,$e,!0),p(this,Vs,s.clientY),p(this,Xs,parseFloat(t(this,F).thumb.style.top)||0);const r=t(this,F).track.getBoundingClientRect().height,o=t(this,F).thumb.clientHeight,l=r-o,a=h(u=>{var D,_;if(!t(this,$e)||l<=0)return;const g=u.clientY-t(this,Vs);let f=t(this,Xs)+g;f<0&&(f=0),f>l&&(f=l),t(this,F).thumb.style.top=`${f}px`;const b=f/l,m=t(this,M).getRowHeight(),y=(t(this,M).querySelector(".ng-sheet-body").offsetHeight||0)-(((D=t(this,M).elements.body.thead)==null?void 0:D.offsetHeight)||0)-(((_=t(this,M).elements.body.tfoot)==null?void 0:_.offsetHeight)||0)-(t(this,M).elements.body.tbody.head.offsetHeight||0),x=Math.floor(y/m),{totalCount:w}=t(this,Fe).call(this),S=Math.floor(b*(w-x+1));t(this,M).rowManager.scrollToDataRow(S);const{rawContentHeight:R,contentHeight:C}=t(this,Fe).call(this),W=t(this,F).container.scrollTop,T=Math.max(C-t(this,M).rowManager.getRowHeight(),0);t(this,F).top.disabled=W<=0,t(this,F).bottom.disabled=W>=T-1},"onMouseMove"),c=h(()=>{p(this,$e,!1),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)},"onMouseUp");document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)}),t(this,F).track.addEventListener("mousedown",s=>{if(s.button!==0||s.target===t(this,F).thumb)return;const i=t(this,F).track.getBoundingClientRect(),r=t(this,F).thumb.clientHeight,l=t(this,F).track.clientHeight-r;if(l>0){const a=s.clientY-i.top-r/2,c=Math.max(0,Math.min(1,a/l)),{totalCount:u}=t(this,Fe).call(this),g=Math.max(0,Math.min(Math.floor(c*(u-1)),u-1));v.log("🎯 [VScroll Track Click]",{ratio:c,clickY:a,totalCount:u,targetRow:g}),g>=0&&t(this,M).rowManager&&typeof t(this,M).rowManager.scrollToDataRow=="function"&&t(this,M).rowManager.scrollToDataRow(g,"top")}this.refresh()}),t(this,F).top.addEventListener("click",()=>{const s=Math.floor(e.scrollTop/t(this,M).getRowHeight()),i=Math.max(0,s-1);t(this,M).rowManager&&typeof t(this,M).rowManager.scrollToDataRow=="function"&&t(this,M).rowManager.scrollToDataRow(i,"top")}),t(this,F).bottom.addEventListener("click",()=>{const i=Math.floor(e.scrollTop/t(this,M).getRowHeight())+1;t(this,M).rowManager&&typeof t(this,M).rowManager.scrollToDataRow=="function"&&t(this,M).rowManager.scrollToDataRow(i,"top")})},"#init"))}connectedCallback(){p(this,er,this.getRootNode().host),p(this,M,this.closest("nine-table-sheet")),this.innerHTML=`
|
|
81
81
|
<style>
|
|
82
82
|
nine-table-vscrollbar {
|
|
83
83
|
display: flex;
|
|
@@ -140,13 +140,13 @@
|
|
|
140
140
|
<button class='ng-scroll-top' disabled><div class='ng-scroll-icon'></div></button>
|
|
141
141
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
142
142
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
143
|
-
`;const e=h(()=>{const s=t(this,M).querySelector(".ng-sheet-body");if(!s){setTimeout(e,10);return}g(this,z,{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,nn).call(this),this.refresh()},"initWhenReady");e()}};en=new WeakMap,M=new WeakMap,$e=new WeakMap,z=new WeakMap,Ps=new WeakMap,mo=new WeakMap,Xs=new WeakMap,ze=new WeakMap,sn=new WeakMap,nn=new WeakMap,h(yo,"NineTableVScrollBar");let Ir=yo;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",Ir);const ue={ID:0,DEPTH:1,NAME:2,CHILDREN:3},xo=class xo{constructor(r){d(this,$t);d(this,_s);d(this,Fe,[]);d(this,We,new Map);d(this,Oe,!1);E(this,"initialize",h(()=>{let r=[];const e=t(this,$t).sourceTable;e&&e.querySelectorAll('tbody tr[grouping="true"]').forEach(s=>{const i=s.querySelector('[cell-type="tree"]');i&&i.dataset.bind&&r.push(i.dataset.bind)}),g(this,Fe,r)},"initialize"));g(this,$t,r),g(this,_s,t(this,$t).getRootNode().host)}get columns(){return t(this,Fe)}get groupMap(){return t(this,We)}apply(){if(v.log("==================","Grouping.Apply"),t(this,Oe))return;g(this,Oe,!0);let r=[];const e=t(this,$t).sourceTable;e&&e.querySelectorAll('tbody tr[grouping="true"]').forEach(s=>{const i=s.querySelector('[cell-type="tree"]');i&&i.dataset.bind&&r.push(i.dataset.bind)}),g(this,Fe,r),g(this,Oe,!1),t(this,$t).scrollToY(0),t(this,$t).view.refresh()}clear(){g(this,Fe,[]),t(this,We).clear(),g(this,Oe,!1),t(this,$t).scrollToY(0),t(this,$t).view.refresh()}setGroupMap(r){g(this,We,r)}getChildrenRowIds(r){return t(this,We).get(r)||[]}getChildrenRecords(r){const e=this.getChildrenRowIds(r),s=t(this,_s).data;return e.map(i=>s.getArray(i)).filter(Boolean)}};$t=new WeakMap,_s=new WeakMap,Fe=new WeakMap,We=new WeakMap,Oe=new WeakMap,h(xo,"GroupingManager");let qr=xo;const Rt=class Rt{static apply(r,e=[],s=[]){var c,u;if(!e||e.length===0)return{headers:[],renderItems:[],groupMap:new Map};const i=r.filter(p=>{var f;return!((f=p.__ng)!=null&&f.deleted)}),n=new Map,o=A(c=Rt,ft,ll).call(c,i,e,s),l=[],a=[];return A(u=Rt,ft,ol).call(u,o,0,e,l,a,n,""),{headers:l,renderItems:a,groupMap:n}}};ft=new WeakSet,ol=h(function(r,e,s,i,n,o,l){var u,p,f;let a=0;const c=e===s.length-1;for(let[b,m]of r.entries()){const y=l?`${l}_${a++}`:`g_${a++}`,x=A(u=Rt,ft,al).call(u,m);o.set(y,x);const w=[];w[ue.ID]=y,w[ue.DEPTH]=e,w[ue.NAME]=b,w[ue.CHILDREN]=x,w.__isGroupHeader=!0,w.__groupId=y,i.push(w),n.push({type:"group",record:w,groupId:y}),!c&&m instanceof Map?A(p=Rt,ft,ol).call(p,m,e+1,s,i,n,o,y):A(f=Rt,ft,cl).call(f,m).forEach(R=>{R.__isGroupHeader=!1,R.__groupId=y,i.push(R),n.push({type:"data",record:R,groupId:y})})}},"#flattenTree"),ll=h(function(r,e,s){var l;const i=s.indexOf(e[0]),n=e.slice(1),o=new Map;if(r.forEach(a=>{const c=i>=0?a.v[i]:"(Unknown)";o.has(c)||o.set(c,[]),o.get(c).push(a)}),n.length>0){const a=new Map;for(let[c,u]of o.entries())a.set(c,A(l=Rt,ft,ll).call(l,u,n,s));return a}return o},"#buildNestedMap"),al=h(function(r){var s;let e=[];if(r instanceof Map)for(let i of r.values())e=e.concat(A(s=Rt,ft,al).call(s,i));else Array.isArray(r)&&(e=e.concat(r.map(i=>{var n,o,l;return((n=i.__ng)==null?void 0:n.rowid)??((l=(o=i.m)==null?void 0:o._)==null?void 0:l[0])})));return e},"#collectLeafRowIds"),cl=h(function(r){var s;let e=[];if(r instanceof Map)for(let i of r.values())e=e.concat(A(s=Rt,ft,cl).call(s,i));else Array.isArray(r)&&(e=e.concat(r));return e},"#collectLeafRecords"),d(Rt,ft),h(Rt,"Grouping");let Mr=Rt;const wo=class wo{constructor(r){d(this,rn,3);d(this,Gs);d(this,L);d(this,Be);d(this,Us,new Map);d(this,te,[]);d(this,U,null);d(this,me,null);d(this,ee,0);d(this,ps);d(this,gs,!1);d(this,Ve,!1);E(this,"refresh",h((r=!1)=>{var i;if(!t(this,L).classList.contains("active"))return;const e=t(this,L).querySelector(".ng-sheet-body");if(!e)return;(!t(this,U)||t(this,U)<=0)&&(t(this,Ks).call(this),t(this,U)&&t(this,U)>0&&t(this,bs).call(this)),t(this,Pe).call(this,e.scrollTop,r),(i=t(this,L).querySelector("nine-table-vscrollbar"))==null||i.refresh()},"refresh"));d(this,Pe,h((r,e=!1)=>{var F,k;if(t(this,Ve)){t(this,on).call(this,r,e);return}const s=t(this,U);if(!s||s<=0)return;const i=t(this,L).view.getArray(),n=i.length;if(n===0){t(this,L).elements.scrollHolder.style.height="0px";return}const o=t(this,L).templateLength,l=(((F=t(this,L).elements.body.thead)==null?void 0:F.offsetHeight)||0)+(((k=t(this,L).elements.body.tfoot)==null?void 0:k.offsetHeight)||0)+t(this,L).elements.body.tbody.head.offsetHeight,a=t(this,L).querySelector(".ng-sheet-body").offsetHeight||0,c=Math.max(n*s+s*2+l-a,0),u=15e6,p=c>u;let f=1,b=c;p&&(f=u/c,b=u),t(this,L).elements.scrollHolder.style.height=`${b}px`;const m=p?r/f:r,y=Math.max(0,n-1),x=Math.min(m,c),w=Math.max(0,Math.min(Math.floor(x/s)-1,y)),S=x%s;t(this,L).elements.left.tbody.body.style.top=t(this,L).elements.body.tbody.body.style.top=t(this,L).elements.right.tbody.body.style.top=`-${S}px`;const R=t(this,Be).firstTr,C=R&&R.dataset.row!==void 0?parseInt(R.dataset.row,10):-1;!e&&C===w||([t(this,L).elements.left.tbody.body,t(this,L).elements.body.tbody.body,t(this,L).elements.right.tbody.body].forEach((D,_)=>{if(!D)return;D.querySelectorAll("tbody.body tr").forEach((lt,O)=>{const tt=w+Math.floor(O/o);if(tt>=n){lt.style.display="none",lt.dataset.matrixRow=null,lt.dataset.row=null;return}const St=i[tt];if(!St){lt.style.display="none";return}const P=St.m._[Dt.META.INDEX.ROWID];lt.style.display="",t(this,js).call(this,lt,St,P,tt)})}),t(this,L).selection.refresh())},"#handleScroll"));d(this,on,h((r,e=!1)=>{var F;v.log("handleGroupdScroll() start");const s=t(this,L).view.getArray()||[],i=s.length;if(i===0){t(this,L).elements.scrollHolder.style.height="0px";return}const n=t(this,L).querySelector(".ng-sheet-body .ng-sheet-body-content"),o=t(this,L).templateLength||1,l=h(k=>{if(k.type==="group"){const D=k.record[ue.DEPTH]||0;return t(this,te)[D]||t(this,U)/o}else{let D=0;const _=t(this,L).templateLength||1;let nt=0;for(let lt=0;lt<_-1;lt++)nt+=t(this,te)[lt]||0;return D=t(this,U)-nt,D>0?D:t(this,U)}},"getItemHeight");let a=0;const c=new Array(i);for(let k=0;k<i;k++){const D=l(s[k]);c[k]=D,a+=D}t(this,L).elements.scrollHolder.style.height=`${a}px`,v.log("*************",a);const u=t(this,L).clientHeight;let p=0,f=0;for(let k=0;k<i;k++){const D=c[k];if(p+D>r){f=k;break}p+=D,f=k}const b=r-p;n&&n.querySelectorAll("tbody").forEach(k=>{k.style.top=`-${Math.max(0,b)}px`});const m=t(this,Be).firstTr,y=m&&m.dataset.virtualIndex!==void 0?parseInt(m.dataset.virtualIndex,10):-1;if(!e&&y===f)return;const x=Math.ceil(u/(t(this,U)/o)),w=(((F=t(this,L).grouping.columns)==null?void 0:F.length)||1)*15,S=f,R=Math.min(i,f+x+w),C=s.slice(S,R);[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(k=>{const D=t(this,L).querySelector(`.ng-sheet-body ${k}`);if(!D)return;const _=Array.from(D.querySelectorAll("tbody.body tr"));for(let nt=0;nt<_.length;nt+=o){const lt=Math.floor(nt/o),O=C[lt],tt=_.slice(nt,nt+o);if(!O||lt>=C.length){tt.forEach(P=>{P.dataset.matrixRow=null,P.dataset.row=null,P.style.display="none"});continue}const St=f+lt;tt.forEach((P,$s)=>{var mr;const br=f+lt;P.dataset.virtualIndex=br,P.dataset.row=O.type==="data"?St:"";const ke=P.getAttribute("grouping")==="true";if(O.type==="group")if(ke){const Te=O.record[ue.DEPTH];$s===Te?(P.style.display="",t(this,ln).call(this,P,s,O.record,br)):P.style.display="none"}else P.style.display="none";else if(ke)P.style.display="none";else{P.style.display="";const Te=((mr=O.record.m)==null?void 0:mr.rowid)??0;t(this,js).call(this,P,O.record,Te,br)}})}}),t(this,L).selection.refresh(),v.log("handleGroupdScroll() end")},"#handleGroupedScroll"));d(this,ln,h((r,e,s,i)=>{const n=t(this,L).templateLength||1,o=parseInt(r.dataset.subrow,10)||0,l=i*n+o,a=s[ue.CHILDREN],c=t(this,Gs).data.getArray(),u=a?a.map(p=>c[p]).filter(Boolean):[];r.dataset.virtualIndex=i,r.dataset.row="",r.dataset.matrixRow=l,r.data=u,r.dataset.groupId=s[ue.ID],Array.from(r.cells).forEach(p=>{p.dataset.row=i;const f=Array.from(p.children).find(b=>b.tagName.toLowerCase().startsWith("cell-")||typeof b.refresh=="function");f!==void 0&&typeof f.refresh=="function"&&(f==null||f.refresh())})},"#bindGroupRowData"));d(this,js,h((r,e,s,i)=>{const n=t(this,L).templateLength||1,o=parseInt(r.dataset.subrow,10)||0,l=i*n+o;r.dataset.index=i,r.dataset.row=s,r.dataset.matrixRow=l,r.data=e,Array.from(r.cells).forEach(a=>{a.dataset.index=i,a.dataset.row=s;const c=Array.from(a.children).find(u=>u.tagName.toLowerCase().startsWith("cell-")&&typeof u.refresh=="function");c==null||c.refresh()})},"#bindRowData"));E(this,"initialize",h(()=>{g(this,Ve,!!t(this,L).sourceTable.querySelector("tbody tr[grouping='true']")),g(this,U,null),t(this,Us).clear(),g(this,Be,{scrollTables:t(this,L).querySelectorAll(".ng-sheet-body table"),firstTr:t(this,L).querySelector(".ng-sheet-body .ng-container-body tbody.body tr")}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{const s=t(this,L).querySelector(`.ng-sheet-body ${e}`);if(!s)return;const i=s.querySelector("table");if(!i)return;const n=i.querySelector("tbody.body");if(!n)return;const l=Array.from(n.querySelectorAll("tr")).map(a=>a.cloneNode(!0));t(this,Us).set(e,l)});const r=t(this,L).querySelector(".ng-sheet-body");r&&(g(this,ee,r.clientHeight),t(this,Ks).call(this),t(this,bs).call(this),t(this,Pe).call(this,r.scrollTop,!0),r.addEventListener("scroll",()=>{var n;if(t(this,gs))return;const e=t(this,U)||0;(((n=t(this,L).view.getArray())==null?void 0:n.length)||0)*e<=r.clientHeight||(t(this,Pe).call(this,r.scrollTop),t(this,L).querySelector("nine-table-vscrollbar").refresh())},{passive:!0}))},"initialize"));E(this,"destroy",h(()=>{t(this,me)&&(t(this,me).disconnect(),g(this,me,null))},"destroy"));d(this,Ks,h(()=>{var n;if(!t(this,L).classList.contains("active")||!t(this,L).sourceTable)return;const r=(n=t(this,L).sourceTable)==null?void 0:n.querySelectorAll("tbody.body tr"),e=t(this,L).querySelector(".ng-sheet-body .ng-container-body tbody.body");e.querySelectorAll("tr").forEach(o=>o.remove());const s=document.createDocumentFragment();r.forEach(o=>s.appendChild(o.cloneNode(!0))),e.appendChild(s);const i=e.querySelectorAll("tr");g(this,te,[]),i.forEach(o=>{t(this,te).push(o.offsetHeight)}),i.forEach(o=>o.remove()),g(this,U,t(this,te).reduce((o,l)=>o+l,0)),t(this,Ys).call(this)},"#measureAndCacheHeight"));d(this,Ys,h(()=>{var r;if(v.log("[DEBUG #updateRowCount] sheetHeight:",t(this,ee),"cachedTemplateHeight:",t(this,U)),t(this,ee)>0&&t(this,U)>0){const e=Math.ceil(t(this,ee)/t(this,U));let s=t(this,rn);if(t(this,Ve)&&t(this,L).grouping){const i=((r=t(this,L).grouping.columns)==null?void 0:r.length)||1;s+=i*15}g(this,ps,e+s),v.log("[DEBUG #updateRowCount] calculated cachedRowCount:",t(this,ps))}},"#updateRowCount"));d(this,bs,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(r=>{const e=t(this,L).querySelector(`.ng-sheet-body ${r}`);e&&e.querySelector("tbody")&&t(this,an).call(this,e)}),t(this,cn).call(this)},"#renderAllContainers"));d(this,an,h(r=>{let e=null;r.classList.contains("ng-container-left")?e="left":r.classList.contains("ng-container-right")&&(e="right");const s=Array.from(t(this,L).sourceTable.querySelectorAll("tbody.body tr")).map(o=>{const l=o.cloneNode(!0);return e==="left"?l.querySelectorAll("th,td").forEach(a=>{a.getAttribute("fixed")!=="left"&&a.remove()}):e==="right"?l.querySelectorAll("th,td").forEach(a=>{a.getAttribute("fixed")!=="right"&&a.remove()}):l.querySelectorAll("[fixed=left], [fixed=right]").forEach(a=>{a.remove()}),l});if(s.length===0)return;const i=r.querySelector("tbody.body");if(!i)return;i.querySelectorAll("tr").forEach(o=>o.remove());const n=document.createDocumentFragment();for(let o=0;o<t(this,ps);o++)s.forEach(l=>n.appendChild(l.cloneNode(!0)));i.appendChild(n),r.classList.contains("ng-container-body")&&(t(this,Be).firstTr=i.querySelector("tr"))},"#renderRows"));d(this,cn,h(()=>{var i,n,o;const r=t(this,L).querySelector(".ng-sheet-body .ng-container-left table"),e=t(this,L).querySelector(".ng-sheet-body .ng-container-body table"),s=t(this,L).querySelector(".ng-sheet-body .ng-container-right table");if(e){const l=r?Array.from(r.querySelectorAll("tbody tr")):[],a=Array.from(e.querySelectorAll("tbody tr")),c=s?Array.from(s.querySelectorAll("tbody tr")):[],u=Math.max(l.length,a.length,c.length);for(let p=0;p<u;p++){const f=[((i=l[p])==null?void 0:i.getBoundingClientRect().height)||0,((n=a[p])==null?void 0:n.getBoundingClientRect().height)||0,((o=c[p])==null?void 0:o.getBoundingClientRect().height)||0],b=Math.max(...f);b>0&&(l[p]&&(l[p].style.height=`${b}px`),a[p]&&(a[p].style.height=`${b}px`),c[p]&&(c[p].style.height=`${b}px`))}}},"#syncRowHeights"));d(this,hn,h(()=>{!t(this,L)||!(t(this,L)instanceof HTMLElement)||(g(this,me,new ResizeObserver(r=>{for(const e of r){if(!e.target.classList.contains("active"))continue;const i=e.contentRect.height;e.contentRect.width>0&&t(this,L).isAutoFitCol&&t(this,L).autoFit(!0),i>0&&t(this,ee)!==i&&(g(this,ee,i),t(this,Ys).call(this),t(this,U)!==null&&(t(this,bs).call(this),this.refresh()))}})),t(this,me).observe(t(this,L)))},"#initResizeObserver"));g(this,Gs,r.getRootNode().host),g(this,L,r),t(this,hn).call(this)}getRowHeight(){return t(this,te).reduce((r,e)=>r+e,0)}scrollToDataRow(r,e="top",s){var c,u;const i=t(this,L).querySelector(".ng-sheet-body");if(!i){typeof s=="function"&&s();return}const n=t(this,L).view.getArray(),o=(n==null?void 0:n.length)||0;if(o===0){typeof s=="function"&&s();return}const l=Math.max(0,Math.min(r,o-1));let a=0;if(t(this,Ve)){const p=Math.max(i.scrollHeight-i.clientHeight,1);a=l/Math.max(o-1,1)*p}else{const p=t(this,U);if(!p||p<=0){typeof s=="function"&&s();return}let f=l*p;t(this,L).templateLength;const b=(((c=t(this,L).elements.body.thead)==null?void 0:c.offsetHeight)||0)+(((u=t(this,L).elements.body.tfoot)==null?void 0:u.offsetHeight)||0)+t(this,L).elements.body.tbody.head.offsetHeight,m=t(this,L).querySelector(".ng-sheet-body").offsetHeight||0,y=Math.max(o*p+p*2+b-m,0),x=15e6,w=y>x;let S=1;w&&(S=x/y),a=f*S}g(this,gs,!0),i.scrollTop=a,t(this,Pe).call(this,a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g(this,gs,!1),typeof s=="function"&&s()})})}};rn=new WeakMap,Gs=new WeakMap,L=new WeakMap,Be=new WeakMap,Us=new WeakMap,te=new WeakMap,U=new WeakMap,me=new WeakMap,ee=new WeakMap,ps=new WeakMap,gs=new WeakMap,Ve=new WeakMap,Pe=new WeakMap,on=new WeakMap,ln=new WeakMap,js=new WeakMap,Ks=new WeakMap,Ys=new WeakMap,bs=new WeakMap,an=new WeakMap,cn=new WeakMap,hn=new WeakMap,h(wo,"RowManager");let Hr=wo;const mt=16,pt=class pt{static compile(r){var s;const e=r.cloneNode(!0);return pt.resetColIndex(e,e.querySelectorAll("thead tr")),pt.resetColIndex(e,e.querySelectorAll('tbody.body tr[grouping="true"]')),pt.resetColIndex(e,e.querySelectorAll('tbody.body tr:not([grouping="true"])')),pt.resetColIndex(e,e.querySelectorAll("tfoot tr")),A(s=pt,Zs,hl).call(s,e),e}static recompile(r){var e;return pt.resetColIndex(r,r.querySelectorAll("thead tr")),pt.resetColIndex(r,r.querySelectorAll('tbody.body tr[grouping="true"]')),pt.resetColIndex(r,r.querySelectorAll('tbody.body tr:not([grouping="true"])')),pt.resetColIndex(r,r.querySelectorAll("tfoot tr")),A(e=pt,Zs,hl).call(e,r),r}static resetColIndex(r,e){const s=r.querySelectorAll("colgroup col"),i=Array.from({length:e.length},()=>Array(s.length).fill(null));e.forEach((n,o)=>{n.dataset.subrow=o;let l=0;n.querySelectorAll("th, td").forEach(a=>{for(;l<s.length&&i[o][l]!==null;)l++;a.dataset.col=l;const c=a.rowSpan||1,u=a.colSpan||1;for(let p=0;p<c;p++)for(let f=0;f<u;f++)o+p<e.length&&l+f<s.length&&(i[o+p][l+f]=a);l+=u})})}};Zs=new WeakSet,hl=h(function(r){r.querySelectorAll("colgroup col").forEach((e,s)=>{e.setAttribute("data-col",s);const i=e.getAttribute("fixed");r.querySelectorAll(`[data-col="${s}"]`).forEach(n=>{i?n.setAttribute("fixed",i):n.removeAttribute("fixed")})})},"#syncColAttributes"),d(pt,Zs),h(pt,"TableCompiler");let fe=pt;const vo=class vo{constructor(r){d(this,se);d(this,J);d(this,Js,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});E(this,"refresh",h(()=>{this.render()},"refresh"));E(this,"render",h(()=>{var l;const{startRow:r,startCol:e,endRow:s,endCol:i}=t(this,Js),n=t(this,J).querySelectorAll(".ng-sheet-body-content .ng-container-left, .ng-sheet-body-content .ng-container-body, .ng-sheet-body-content .ng-container-right");if(n.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right, .selected-start").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right","selected-start")}),a.querySelectorAll("tr.selected-start").forEach(c=>{c.classList.remove("selected-start")})}),r<0||e<0)return;n.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{const{matrixRow:u}=A(this,se,Oi).call(this,c);u<0||c.querySelectorAll("td, th").forEach(p=>{const f=parseInt(p.dataset.col,10);if(isNaN(f))return;const b=parseInt(p.rowSpan||1,10),m=parseInt(p.colSpan||1,10),y=u+b-1,x=f+m-1;y>=r&&u<=s&&x>=e&&f<=i&&(p.classList.add("selected"),u<=r&&p.classList.add("selected-top"),y>=s&&p.classList.add("selected-bottom"),f<=e&&p.classList.add("selected-left"),x>=i&&p.classList.add("selected-right"))})})});const o=t(this,J).querySelector(`.ng-sheet-body-content tr[data-matrix-row="${r}"] td[data-col="${e}"]`);o&&(o.classList.add("selected-start"),(l=o.closest("tr"))==null||l.classList.add("selected-start"))},"render"));g(this,J,r),A(this,se,kl).call(this),v.log("🎯 [CellSelection] Initialized (New Structure Compatible)")}setFocus(r,e){var i;t(this,J).querySelectorAll("tr.selected-start").forEach(n=>{n.classList.remove("selected-start"),n.querySelectorAll("td.selected-start").forEach(o=>{o.classList.remove("selected-start")})});const s=t(this,J).querySelector(`.ng-sheet-body-content tr[data-matrix-row="${r}"] td[data-col="${e}"]`);s&&(s.classList.add("selected-start"),(i=s.closest("tr"))==null||i.classList.add("selected-start"))}setRange(r,e,s,i){let n=Math.min(r,s),o=Math.max(r,s),l=Math.min(e,i),a=Math.max(e,i);const c=t(this,J).querySelectorAll(".ng-sheet-body-content .ng-container-left, .ng-sheet-body-content .ng-container-body, .ng-sheet-body-content .ng-container-right");let u=!0,p=0;for(;u&&p<5;)u=!1,p++,c.forEach(f=>{f.querySelectorAll("tbody tr").forEach(b=>{if(b.classList.contains("nodata"))return;const{matrixRow:m}=A(this,se,Oi).call(this,b);m<0||b.querySelectorAll("td, th").forEach(y=>{const x=parseInt(y.dataset.col,10);if(isNaN(x))return;const w=parseInt(y.rowSpan||1,10),S=parseInt(y.colSpan||1,10),R=m+w-1,C=x+S-1;if(R>=n&&m<=o&&C>=l&&x<=a){const k=Math.min(n,m),D=Math.max(o,R),_=Math.min(l,x),nt=Math.max(a,C);(k!==n||D!==o||_!==l||nt!==a)&&(n=k,o=D,l=_,a=nt,u=!0)}})})});g(this,Js,{startRow:n,startCol:l,endRow:o,endCol:a}),this.render()}};J=new WeakMap,Js=new WeakMap,se=new WeakSet,Oi=h(function(r){if(!r)return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const e=parseInt(r.dataset.row,10);if(isNaN(e))return{dataRow:-1,subRowIndex:-1,matrixRow:-1};const s=r.closest("tbody"),n=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(c=>parseInt(c.dataset.row,10)===e),o=n.indexOf(r),l=n.length>0?n.length:1,a=e*l+(o>=0?o:r.sectionRowIndex%l);return{dataRow:e,subRowIndex:o,matrixRow:a}},"#getMatrixRow"),kl=h(function(){const r=t(this,J).querySelector(".ng-sheet-body");if(!r){v.log("❌ [CellSelection] .ng-sheet-body not found!");return}r.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;t(this,J).style.userSelect="none",t(this,J).style.webkitUserSelect="none";const i=s.closest("tr"),{matrixRow:n}=A(this,se,Oi).call(this,i),o=parseInt(s.dataset.col,10);if(n<0){t(this,J).style.userSelect="",t(this,J).style.webkitUserSelect="";return}this.setFocus(n,o),this.setRange(n,o,n,o);let l=n,a=o;const c=h(p=>{const f=document.elementFromPoint(p.clientX,p.clientY);let b=f==null?void 0:f.closest("td, th");if(!b||!t(this,J).contains(b)){const w=t(this,J).querySelectorAll(".ng-sheet-body-content tbody tr:not(.nodata) td, .ng-sheet-body-content tbody tr:not(.nodata) th");for(const S of w){const R=S.getBoundingClientRect();if(p.clientX>=R.left&&p.clientX<=R.right&&p.clientY>=R.top&&p.clientY<=R.bottom){b=S;break}}}if(!b||b.dataset.row===void 0||b.dataset.col===void 0||b.closest("tr").classList.contains("nodata"))return;const m=b.closest("tr"),{matrixRow:y}=A(this,se,Oi).call(this,m),x=parseInt(b.dataset.col,10);y<0||l===y&&a===x||(l=y,a=x,this.setRange(n,o,y,x))},"onMouseMove"),u=h(()=>{t(this,J).style.userSelect="",t(this,J).style.webkitUserSelect="",document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)},"onMouseUp");document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)})},"#initEvents"),h(vo,"CellSelection");let Nr=vo;const Eo=class Eo{constructor(r){d(this,gt);d(this,$);d(this,Qs);d(this,ye,null);d(this,Xt,null);d(this,So,-1);d(this,Ao,-1);d(this,ti,h(r=>{const e=t(this,$).querySelectorAll(`.ng-sheet-body td[data-row="${r}"]`);if(!e||e.length===0)return 0;let s=1/0;return e.forEach(i=>{const n=parseInt(i.dataset.col,10);!isNaN(n)&&window.getComputedStyle(i).display!=="none"&&(s=Math.min(s,n))}),s===1/0?0:s},"#getMinCol"));d(this,ei,h(r=>{const e=t(this,$).querySelectorAll(`.ng-sheet-body td[data-row="${r}"]`);if(!e||e.length===0)return 0;let s=0;return e.forEach(i=>{const n=parseInt(i.dataset.col,10);!isNaN(n)&&window.getComputedStyle(i).display!=="none"&&(s=Math.max(s,n))}),s},"#getMaxCol"));d(this,si,h(r=>{const e=[];return r.forEach(s=>e.push(...Array.from(s.querySelectorAll("td")))),e.length===0?null:(e.sort((s,i)=>parseInt(s.dataset.col,10)-parseInt(i.dataset.col,10)),e[e.length-1])},"#getMaxColCell"));d(this,ii,h((r,e)=>{const s=t(this,$).querySelector(`.ng-sheet-body tr[data-matrix-row="${r}"] td[data-col="${e}"]`)||t(this,$).querySelector(`.ng-sheet-body td[data-col="${e}"]`),i=(s==null?void 0:s.colSpan)||1,n=e+i;return v.log(`🔍 [#getNextCol] current col: ${e}, found td colSpan: ${i}, calculated next col: ${n}`),n},"#getNextCol"));d(this,ni,h((r,e)=>{if(e<=0)return 0;const s=t(this,Xt)?Array.from(t(this,Xt).querySelectorAll("td, th")):[],i=new Set;s.forEach(o=>{const l=parseInt(o.dataset.col,10);!isNaN(l)&&window.getComputedStyle(o).display!=="none"&&i.add(l)}),i.size===0&&t(this,ms).call(this,r).forEach(l=>{Array.from(l.querySelectorAll("td, th")).forEach(a=>{const c=parseInt(a.dataset.col,10);!isNaN(c)&&window.getComputedStyle(a).display!=="none"&&i.add(c)})});const n=Array.from(i).filter(o=>o<e);return n.length===0?Math.max(0,e-1):Math.max(...n)},"#getPreviousCol"));d(this,ms,h(r=>{const e=t(this,$).querySelectorAll(".ng-sheet-body .ng-container-left, .ng-sheet-body .ng-container-body, .ng-sheet-body .ng-container-right"),s=[];return e.forEach(i=>{const n=Array.from(i.querySelectorAll("tbody tr"));for(const o of n){const l=A(this,gt,cs).call(this,o);if(l===r){s.push(o);break}const a=Array.from(o.querySelectorAll("td"));let c=!1;for(const u of a){const p=parseInt(u.rowSpan||1,10);if(p>1&&r>=l&&r<l+p){s.push(o),c=!0;break}}if(c)break}}),s},"#findTargetTrsByMatrix"));d(this,ri,h((r,e,s,i)=>{const n=i!==void 0?i:r*(t(this,$).templateLength||1)+e,o=t(this,$).templateLength||1,l=t(this,$).querySelectorAll(".ng-sheet-body, .ng-container-left, .ng-container-body, .ng-container-right, .ng-part-body"),a=new Set;l.forEach(c=>{c.querySelectorAll("tbody tr").forEach(u=>a.add(u))});for(const c of Array.from(a)){const u=parseInt(c.dataset.row,10);if(isNaN(u))continue;const p=c.closest("tbody"),b=(p?Array.from(p.querySelectorAll(`tr[data-row="${u}"]`)):[c]).indexOf(c);for(const m of Array.from(c.querySelectorAll("td"))){const y=parseInt(m.dataset.col,10),x=parseInt(m.colSpan||1,10),w=parseInt(m.rowSpan||1,10);if(isNaN(y)||window.getComputedStyle(m).display==="none")continue;const S=u,R=b,C=S*o+R,F=C+w-1;if(n>=C&&n<=F&&s>=y&&s<y+x)return m}}return null},"#getNearElement"));g(this,$,r),g(this,Qs,r.getRootNode().host),A(this,gt,Tl).call(this),v.log("🎯 [CellNavigation] Initialized (Diagnostic Logging Restored)")}get currentCell(){return t(this,ye)}set currentCell(r){var s;if(!r)return;g(this,ye,r),r.focus({preventScroll:!0}),g(this,Xt,r.closest("tr"));const e=A(this,gt,cs).call(this,t(this,Xt));v.log(`📌 [setCurCell] Active set -> dataRow: ${r.dataset.row}, subrow: ${(s=r.closest("tr"))==null?void 0:s.dataset.subrow}, matrixRow: ${e}, col: ${r.dataset.col}`),t(this,$).selection.setFocus(e,t(this,ye).dataset.col)}moveCell(r){var m;if(!["TH","TD"].includes(r.target.tagName))return;if(!t(this,ye)||!t(this,Xt)){v.log("⚠️ [moveCell] currentCell or currentTr is missing!");return}const e=t(this,ye),s=parseInt(e.dataset.row,10),i=parseInt(e.dataset.col,10),n=t(this,$).templateLength||1,o=A(this,gt,cs).call(this,t(this,Xt));let l=o,a=i;switch(r.code){case"ArrowDown":r.preventDefault(),l=o+(e.rowSpan||1);break;case"ArrowUp":r.preventDefault(),l=Math.max(0,o-(e.rowSpan||1));break;case"ArrowRight":a=t(this,ii).call(this,o,i);break;case"ArrowLeft":a=t(this,ni).call(this,o,i);break;case"Tab":if(r.preventDefault(),r.shiftKey){if(a=t(this,ni).call(this,o,i),a<0&&o>0){l=o-1;const y=t(this,ms).call(this,l),x=t(this,si).call(this,y);a=x?parseInt(x.dataset.col,10):0}}else{a=t(this,ii).call(this,o,i);const y=t(this,ms).call(this,o),x=t(this,si).call(this,y),w=x?parseInt(x.dataset.col,10)+parseInt(x.colSpan||1,10):0;a>=w&&(l=o+1,a=0)}break}switch(r.code){case"ArrowDown":const x=t(this,Qs).data.length*n-1;if(o+(e.rowSpan||1)>x)return;break;case"ArrowUp":if(o<=0)return;break;case"ArrowRight":if(i===a||a>t(this,ei).call(this,s,i))return;break;case"ArrowLeft":if(i===a||a<t(this,ti).call(this,s,i))return;break;case"Tab":if(r.shiftKey){if(i===a||a<t(this,ti).call(this,s,i))return}else if(i===a||a>t(this,ei).call(this,s,i))return;break}v.log("========");const u=(((m=t(this,$).view.getArray())==null?void 0:m.length)||0)*n-1;l=Math.max(0,Math.min(l,u)),v.log(`⌨️ [Key: ${r.code}] Current matrixRow: ${o} -> Target nextMatrixRow: ${l}, nextCol: ${a}`);const p=Math.floor(l/n),f=l%n;h((y=0)=>{let x=t(this,ri).call(this,p,f,a,l);if(x){v.log(`✅ [Found Cell] Attempt ${y} -> dataRow: ${x.dataset.row}, col: ${x.dataset.col}`),this.currentCell=x;const w=A(this,gt,cs).call(this,t(this,Xt));t(this,$).selection.setRange(w,x.dataset.col,w,x.dataset.col),A(this,gt,dl).call(this,x)}else v.log(`📜 [Scroll Trigger] Cell not found in DOM, invoking rowManager.scrollToDataRow(${p})`),t(this,$).rowManager.scrollToDataRow(p,"bottom",()=>{v.log("nextDataRow",p),h(()=>{let S=t(this,ri).call(this,p,f,a,l);if(S){v.log(`✅ [Found After Scroll] RetryLoop success -> dataRow: ${S.dataset.row}`),this.currentCell=S;const R=S.closest("tr"),C=A(this,gt,cs).call(this,R);t(this,$).selection.setRange(C,S.dataset.col,C,S.dataset.col),A(this,gt,dl).call(this,S)}},"retryLoop")()})},"attemptFindAndMove")()}};$=new WeakMap,Qs=new WeakMap,ye=new WeakMap,Xt=new WeakMap,So=new WeakMap,Ao=new WeakMap,gt=new WeakSet,cs=h(function(r){if(!r)return 0;const e=parseInt(r.dataset.row,10)||0,s=t(this,$).templateLength||1,i=parseInt(r.dataset.matrixRow,10);if(!isNaN(i))return i;const n=r.closest("tbody");if(n){const a=Array.from(n.querySelectorAll(`tr[data-row="${e}"]`)).indexOf(r);if(a>=0)return e*s+a}const o=parseInt(r.dataset.subrow,10)||0;return e*s+o},"#getMatrixRowFromTr"),dl=h(function(r){const e=t(this,$).querySelector(".ng-sheet-body"),s=t(this,$).querySelector(".ng-sheet-body .ng-container-body"),i=t(this,$).querySelector(".ng-sheet-header .ng-container-body");if(!e||!s)return;const n=r.getBoundingClientRect(),o=e.getBoundingClientRect(),l=s.getBoundingClientRect(),a=i?i.getBoundingClientRect():null;v.log(`📐 [DIAGNOSTIC VISIBILITY]
|
|
144
|
-
- cell.dataset.col: ${
|
|
145
|
-
- cellRect (left: ${
|
|
143
|
+
`;const e=h(()=>{const s=t(this,M).querySelector(".ng-sheet-body");if(!s){setTimeout(e,10);return}p(this,F,{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,ir).call(this),this.refresh()},"initWhenReady");e()}};er=new WeakMap,M=new WeakMap,$e=new WeakMap,F=new WeakMap,Vs=new WeakMap,mo=new WeakMap,Xs=new WeakMap,Fe=new WeakMap,sr=new WeakMap,ir=new WeakMap,h(yo,"NineTableVScrollBar");let In=yo;customElements.get("nine-table-vscrollbar")||customElements.define("nine-table-vscrollbar",In);const ue={ID:0,DEPTH:1,NAME:2,CHILDREN:3},xo=class xo{constructor(n){d(this,$t);d(this,_s);d(this,We,[]);d(this,Oe,new Map);d(this,ze,!1);E(this,"initialize",h(()=>{let n=[];const e=t(this,$t).sourceTable;e&&e.querySelectorAll('tbody tr[grouping="true"]').forEach(s=>{const i=s.querySelector('[cell-type="tree"]');i&&i.dataset.bind&&n.push(i.dataset.bind)}),p(this,We,n)},"initialize"));p(this,$t,n),p(this,_s,t(this,$t).getRootNode().host)}get columns(){return t(this,We)}get groupMap(){return t(this,Oe)}apply(){if(v.log("==================","Grouping.Apply"),t(this,ze))return;p(this,ze,!0);let n=[];const e=t(this,$t).sourceTable;e&&e.querySelectorAll('tbody tr[grouping="true"]').forEach(s=>{const i=s.querySelector('[cell-type="tree"]');i&&i.dataset.bind&&n.push(i.dataset.bind)}),p(this,We,n),p(this,ze,!1),t(this,$t).scrollToY(0),t(this,$t).view.refresh()}clear(){p(this,We,[]),t(this,Oe).clear(),p(this,ze,!1),t(this,$t).scrollToY(0),t(this,$t).view.refresh()}setGroupMap(n){p(this,Oe,n)}getChildrenRowIds(n){return t(this,Oe).get(n)||[]}getChildrenRecords(n){const e=this.getChildrenRowIds(n),s=t(this,_s).data;return e.map(i=>s.getArray(i)).filter(Boolean)}};$t=new WeakMap,_s=new WeakMap,We=new WeakMap,Oe=new WeakMap,ze=new WeakMap,h(xo,"GroupingManager");let qn=xo;const Rt=class Rt{static apply(n,e=[],s=[]){var c,u;if(!e||e.length===0)return{headers:[],renderItems:[],groupMap:new Map};const i=n.filter(g=>{var f;return!((f=g.__ng)!=null&&f.deleted)}),r=new Map,o=A(c=Rt,ft,ll).call(c,i,e,s),l=[],a=[];return A(u=Rt,ft,ol).call(u,o,0,e,l,a,r,""),{headers:l,renderItems:a,groupMap:r}}};ft=new WeakSet,ol=h(function(n,e,s,i,r,o,l){var u,g,f;let a=0;const c=e===s.length-1;for(let[b,m]of n.entries()){const y=l?`${l}_${a++}`:`g_${a++}`,x=A(u=Rt,ft,al).call(u,m);o.set(y,x);const w=[];w[ue.ID]=y,w[ue.DEPTH]=e,w[ue.NAME]=b,w[ue.CHILDREN]=x,w.__isGroupHeader=!0,w.__groupId=y,i.push(w),r.push({type:"group",record:w,groupId:y}),!c&&m instanceof Map?A(g=Rt,ft,ol).call(g,m,e+1,s,i,r,o,y):A(f=Rt,ft,cl).call(f,m).forEach(R=>{R.__isGroupHeader=!1,R.__groupId=y,i.push(R),r.push({type:"data",record:R,groupId:y})})}},"#flattenTree"),ll=h(function(n,e,s){var l;const i=s.indexOf(e[0]),r=e.slice(1),o=new Map;if(n.forEach(a=>{const c=i>=0?a.v[i]:"(Unknown)";o.has(c)||o.set(c,[]),o.get(c).push(a)}),r.length>0){const a=new Map;for(let[c,u]of o.entries())a.set(c,A(l=Rt,ft,ll).call(l,u,r,s));return a}return o},"#buildNestedMap"),al=h(function(n){var s;let e=[];if(n instanceof Map)for(let i of n.values())e=e.concat(A(s=Rt,ft,al).call(s,i));else Array.isArray(n)&&(e=e.concat(n.map(i=>{var r,o,l;return((r=i.__ng)==null?void 0:r.rowid)??((l=(o=i.m)==null?void 0:o._)==null?void 0:l[0])})));return e},"#collectLeafRowIds"),cl=h(function(n){var s;let e=[];if(n instanceof Map)for(let i of n.values())e=e.concat(A(s=Rt,ft,cl).call(s,i));else Array.isArray(n)&&(e=e.concat(n));return e},"#collectLeafRecords"),d(Rt,ft),h(Rt,"Grouping");let Mn=Rt;const wo=class wo{constructor(n){d(this,rr,3);d(this,Us);d(this,L);d(this,Be);d(this,Gs,new Map);d(this,te,[]);d(this,G,null);d(this,me,null);d(this,ee,0);d(this,gs);d(this,ps,!1);d(this,Pe,!1);E(this,"refresh",h((n=!1)=>{var i;if(!t(this,L).classList.contains("active"))return;const e=t(this,L).querySelector(".ng-sheet-body");if(!e)return;(!t(this,G)||t(this,G)<=0)&&(t(this,Ks).call(this),t(this,G)&&t(this,G)>0&&t(this,bs).call(this)),t(this,Ve).call(this,e.scrollTop,n),(i=t(this,L).querySelector("nine-table-vscrollbar"))==null||i.refresh()},"refresh"));d(this,Ve,h((n,e=!1)=>{var W,T;if(t(this,Pe)){t(this,nr).call(this,n,e);return}const s=t(this,G);if(!s||s<=0)return;const i=t(this,L).view.getArray(),r=i.length;if(r===0){t(this,L).elements.scrollHolder.style.height="0px";return}const o=t(this,L).templateLength,l=(((W=t(this,L).elements.body.thead)==null?void 0:W.offsetHeight)||0)+(((T=t(this,L).elements.body.tfoot)==null?void 0:T.offsetHeight)||0)+t(this,L).elements.body.tbody.head.offsetHeight,a=t(this,L).querySelector(".ng-sheet-body").offsetHeight||0,c=Math.max(r*s+s*2+l-a,0),u=15e6,g=c>u;let f=1,b=c;g&&(f=u/c,b=u),t(this,L).elements.scrollHolder.style.height=`${b}px`;const m=g?n/f:n,y=Math.max(0,r-1),x=Math.min(m,c),w=Math.max(0,Math.min(Math.floor(x/s)-1,y)),S=x%s;t(this,L).elements.left.tbody.body.style.top=t(this,L).elements.body.tbody.body.style.top=t(this,L).elements.right.tbody.body.style.top=`-${S}px`;const R=t(this,Be).firstTr,C=R&&R.dataset.row!==void 0?parseInt(R.dataset.row,10):-1;!e&&C===w||([t(this,L).elements.left.tbody.body,t(this,L).elements.body.tbody.body,t(this,L).elements.right.tbody.body].forEach((D,_)=>{if(!D)return;D.querySelectorAll("tbody.body tr").forEach((lt,z)=>{const tt=w+Math.floor(z/o);if(tt>=r){lt.style.display="none",lt.dataset.matrixRow=null,lt.dataset.row=null;return}const St=i[tt];if(!St){lt.style.display="none";return}const V=St.m._[Dt.META.INDEX.ROWID];lt.style.display="",t(this,js).call(this,lt,St,V,tt)})}),t(this,L).selection.refresh())},"#handleScroll"));d(this,nr,h((n,e=!1)=>{var W;v.log("handleGroupdScroll() start");const s=t(this,L).view.getArray()||[],i=s.length;if(i===0){t(this,L).elements.scrollHolder.style.height="0px";return}const r=t(this,L).querySelector(".ng-sheet-body .ng-sheet-body-content"),o=t(this,L).templateLength||1,l=h(T=>{if(T.type==="group"){const D=T.record[ue.DEPTH]||0;return t(this,te)[D]||t(this,G)/o}else{let D=0;const _=t(this,L).templateLength||1;let rt=0;for(let lt=0;lt<_-1;lt++)rt+=t(this,te)[lt]||0;return D=t(this,G)-rt,D>0?D:t(this,G)}},"getItemHeight");let a=0;const c=new Array(i);for(let T=0;T<i;T++){const D=l(s[T]);c[T]=D,a+=D}t(this,L).elements.scrollHolder.style.height=`${a}px`,v.log("*************",a);const u=t(this,L).clientHeight;let g=0,f=0;for(let T=0;T<i;T++){const D=c[T];if(g+D>n){f=T;break}g+=D,f=T}const b=n-g;r&&r.querySelectorAll("tbody").forEach(T=>{T.style.top=`-${Math.max(0,b)}px`});const m=t(this,Be).firstTr,y=m&&m.dataset.virtualIndex!==void 0?parseInt(m.dataset.virtualIndex,10):-1;if(!e&&y===f)return;const x=Math.ceil(u/(t(this,G)/o)),w=(((W=t(this,L).grouping.columns)==null?void 0:W.length)||1)*15,S=f,R=Math.min(i,f+x+w),C=s.slice(S,R);[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(T=>{const D=t(this,L).querySelector(`.ng-sheet-body ${T}`);if(!D)return;const _=Array.from(D.querySelectorAll("tbody.body tr"));for(let rt=0;rt<_.length;rt+=o){const lt=Math.floor(rt/o),z=C[lt],tt=_.slice(rt,rt+o);if(!z||lt>=C.length){tt.forEach(V=>{V.dataset.matrixRow=null,V.dataset.row=null,V.style.display="none"});continue}const St=f+lt;tt.forEach((V,$s)=>{var mn;const bn=f+lt;V.dataset.virtualIndex=bn,V.dataset.row=z.type==="data"?St:"";const Te=V.getAttribute("grouping")==="true";if(z.type==="group")if(Te){const ke=z.record[ue.DEPTH];$s===ke?(V.style.display="",t(this,or).call(this,V,s,z.record,bn)):V.style.display="none"}else V.style.display="none";else if(Te)V.style.display="none";else{V.style.display="";const ke=((mn=z.record.m)==null?void 0:mn.rowid)??0;t(this,js).call(this,V,z.record,ke,bn)}})}}),t(this,L).selection.refresh(),v.log("handleGroupdScroll() end")},"#handleGroupedScroll"));d(this,or,h((n,e,s,i)=>{const r=t(this,L).templateLength||1,o=parseInt(n.dataset.subrow,10)||0,l=i*r+o,a=s[ue.CHILDREN],c=t(this,Us).data.getArray(),u=a?a.map(g=>c[g]).filter(Boolean):[];n.dataset.virtualIndex=i,n.dataset.row="",n.dataset.matrixRow=l,n.data=u,n.dataset.groupId=s[ue.ID],Array.from(n.cells).forEach(g=>{g.dataset.row=i;const f=Array.from(g.children).find(b=>b.tagName.toLowerCase().startsWith("cell-")||typeof b.refresh=="function");f!==void 0&&typeof f.refresh=="function"&&(f==null||f.refresh())})},"#bindGroupRowData"));d(this,js,h((n,e,s,i)=>{const r=t(this,L).templateLength||1,o=parseInt(n.dataset.subrow,10)||0,l=i*r+o;n.dataset.index=i,n.dataset.row=s,n.dataset.matrixRow=l,n.data=e,Array.from(n.cells).forEach(a=>{a.dataset.index=i,a.dataset.row=s;const c=Array.from(a.children).find(u=>u.tagName.toLowerCase().startsWith("cell-")&&typeof u.refresh=="function");c==null||c.refresh()})},"#bindRowData"));E(this,"initialize",h(()=>{p(this,Pe,!!t(this,L).sourceTable.querySelector("tbody tr[grouping='true']")),p(this,G,null),t(this,Gs).clear(),p(this,Be,{scrollTables:t(this,L).querySelectorAll(".ng-sheet-body table"),firstTr:t(this,L).querySelector(".ng-sheet-body .ng-container-body tbody.body tr")}),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(e=>{const s=t(this,L).querySelector(`.ng-sheet-body ${e}`);if(!s)return;const i=s.querySelector("table");if(!i)return;const r=i.querySelector("tbody.body");if(!r)return;const l=Array.from(r.querySelectorAll("tr")).map(a=>a.cloneNode(!0));t(this,Gs).set(e,l)});const n=t(this,L).querySelector(".ng-sheet-body");n&&(p(this,ee,n.clientHeight),t(this,Ks).call(this),t(this,bs).call(this),t(this,Ve).call(this,n.scrollTop,!0),n.addEventListener("scroll",()=>{var r;if(t(this,ps))return;const e=t(this,G)||0;(((r=t(this,L).view.getArray())==null?void 0:r.length)||0)*e<=n.clientHeight||(t(this,Ve).call(this,n.scrollTop),t(this,L).querySelector("nine-table-vscrollbar").refresh())},{passive:!0}))},"initialize"));E(this,"destroy",h(()=>{t(this,me)&&(t(this,me).disconnect(),p(this,me,null))},"destroy"));d(this,Ks,h(()=>{var r;if(!t(this,L).classList.contains("active")||!t(this,L).sourceTable)return;const n=(r=t(this,L).sourceTable)==null?void 0:r.querySelectorAll("tbody.body tr"),e=t(this,L).querySelector(".ng-sheet-body .ng-container-body tbody.body");e.querySelectorAll("tr").forEach(o=>o.remove());const s=document.createDocumentFragment();n.forEach(o=>s.appendChild(o.cloneNode(!0))),e.appendChild(s);const i=e.querySelectorAll("tr");p(this,te,[]),i.forEach(o=>{t(this,te).push(o.offsetHeight)}),i.forEach(o=>o.remove()),p(this,G,t(this,te).reduce((o,l)=>o+l,0)),t(this,Ys).call(this)},"#measureAndCacheHeight"));d(this,Ys,h(()=>{var n;if(v.log("[DEBUG #updateRowCount] sheetHeight:",t(this,ee),"cachedTemplateHeight:",t(this,G)),t(this,ee)>0&&t(this,G)>0){const e=Math.ceil(t(this,ee)/t(this,G));let s=t(this,rr);if(t(this,Pe)&&t(this,L).grouping){const i=((n=t(this,L).grouping.columns)==null?void 0:n.length)||1;s+=i*15}p(this,gs,e+s),v.log("[DEBUG #updateRowCount] calculated cachedRowCount:",t(this,gs))}},"#updateRowCount"));d(this,bs,h(()=>{v.log("rowManager.#renderAllContainers"),[".ng-container-body",".ng-container-left",".ng-container-right"].forEach(n=>{const e=t(this,L).querySelector(`.ng-sheet-body ${n}`);e&&e.querySelector("tbody")&&t(this,lr).call(this,e)}),t(this,ar).call(this)},"#renderAllContainers"));d(this,lr,h(n=>{let e=null;n.classList.contains("ng-container-left")?e="left":n.classList.contains("ng-container-right")&&(e="right");const s=Array.from(t(this,L).sourceTable.querySelectorAll("tbody.body tr")).map(o=>{const l=o.cloneNode(!0);return e==="left"?l.querySelectorAll("th,td").forEach(a=>{a.getAttribute("fixed")!=="left"&&a.remove()}):e==="right"?l.querySelectorAll("th,td").forEach(a=>{a.getAttribute("fixed")!=="right"&&a.remove()}):l.querySelectorAll("[fixed=left], [fixed=right]").forEach(a=>{a.remove()}),l});if(s.length===0)return;const i=n.querySelector("tbody.body");if(!i)return;i.querySelectorAll("tr").forEach(o=>o.remove());const r=document.createDocumentFragment();for(let o=0;o<t(this,gs);o++)s.forEach(l=>r.appendChild(l.cloneNode(!0)));i.appendChild(r),n.classList.contains("ng-container-body")&&(t(this,Be).firstTr=i.querySelector("tr"))},"#renderRows"));d(this,ar,h(()=>{var i,r,o;const n=t(this,L).querySelector(".ng-sheet-body .ng-container-left table"),e=t(this,L).querySelector(".ng-sheet-body .ng-container-body table"),s=t(this,L).querySelector(".ng-sheet-body .ng-container-right table");if(e){const l=n?Array.from(n.querySelectorAll("tbody tr")):[],a=Array.from(e.querySelectorAll("tbody tr")),c=s?Array.from(s.querySelectorAll("tbody tr")):[],u=Math.max(l.length,a.length,c.length);for(let g=0;g<u;g++){const f=[((i=l[g])==null?void 0:i.getBoundingClientRect().height)||0,((r=a[g])==null?void 0:r.getBoundingClientRect().height)||0,((o=c[g])==null?void 0:o.getBoundingClientRect().height)||0],b=Math.max(...f);b>0&&(l[g]&&(l[g].style.height=`${b}px`),a[g]&&(a[g].style.height=`${b}px`),c[g]&&(c[g].style.height=`${b}px`))}}},"#syncRowHeights"));d(this,cr,h(()=>{!t(this,L)||!(t(this,L)instanceof HTMLElement)||(p(this,me,new ResizeObserver(n=>{for(const e of n){if(!e.target.classList.contains("active"))continue;const i=e.contentRect.height;e.contentRect.width>0&&t(this,L).isAutoFitCol&&t(this,L).autoFit(!0),i>0&&t(this,ee)!==i&&(p(this,ee,i),t(this,Ys).call(this),t(this,G)!==null&&(t(this,bs).call(this),this.refresh()))}})),t(this,me).observe(t(this,L)))},"#initResizeObserver"));p(this,Us,n.getRootNode().host),p(this,L,n),t(this,cr).call(this)}getRowHeight(){return t(this,te).reduce((n,e)=>n+e,0)}scrollToDataRow(n,e="top",s){var c,u;const i=t(this,L).querySelector(".ng-sheet-body");if(!i){typeof s=="function"&&s();return}const r=t(this,L).view.getArray(),o=(r==null?void 0:r.length)||0;if(o===0){typeof s=="function"&&s();return}const l=Math.max(0,Math.min(n,o-1));let a=0;if(t(this,Pe)){const g=Math.max(i.scrollHeight-i.clientHeight,1);a=l/Math.max(o-1,1)*g}else{const g=t(this,G);if(!g||g<=0){typeof s=="function"&&s();return}let f=l*g;t(this,L).templateLength;const b=(((c=t(this,L).elements.body.thead)==null?void 0:c.offsetHeight)||0)+(((u=t(this,L).elements.body.tfoot)==null?void 0:u.offsetHeight)||0)+t(this,L).elements.body.tbody.head.offsetHeight,m=t(this,L).querySelector(".ng-sheet-body").offsetHeight||0,y=Math.max(o*g+g*2+b-m,0),x=15e6,w=y>x;let S=1;w&&(S=x/y),a=f*S}p(this,ps,!0),i.scrollTop=a,t(this,Ve).call(this,a),requestAnimationFrame(()=>{requestAnimationFrame(()=>{p(this,ps,!1),typeof s=="function"&&s()})})}};rr=new WeakMap,Us=new WeakMap,L=new WeakMap,Be=new WeakMap,Gs=new WeakMap,te=new WeakMap,G=new WeakMap,me=new WeakMap,ee=new WeakMap,gs=new WeakMap,ps=new WeakMap,Pe=new WeakMap,Ve=new WeakMap,nr=new WeakMap,or=new WeakMap,js=new WeakMap,Ks=new WeakMap,Ys=new WeakMap,bs=new WeakMap,lr=new WeakMap,ar=new WeakMap,cr=new WeakMap,h(wo,"RowManager");let Hn=wo;const mt=16,gt=class gt{static compile(n){var s;const e=n.cloneNode(!0);return gt.resetColIndex(e,e.querySelectorAll("thead tr")),gt.resetColIndex(e,e.querySelectorAll('tbody.body tr[grouping="true"]')),gt.resetColIndex(e,e.querySelectorAll('tbody.body tr:not([grouping="true"])')),gt.resetColIndex(e,e.querySelectorAll("tfoot tr")),A(s=gt,Zs,hl).call(s,e),e}static recompile(n){var e;return gt.resetColIndex(n,n.querySelectorAll("thead tr")),gt.resetColIndex(n,n.querySelectorAll('tbody.body tr[grouping="true"]')),gt.resetColIndex(n,n.querySelectorAll('tbody.body tr:not([grouping="true"])')),gt.resetColIndex(n,n.querySelectorAll("tfoot tr")),A(e=gt,Zs,hl).call(e,n),n}static resetColIndex(n,e){const s=n.querySelectorAll("colgroup col"),i=Array.from({length:e.length},()=>Array(s.length).fill(null));e.forEach((r,o)=>{r.dataset.subrow=o;let l=0;r.querySelectorAll("th, td").forEach(a=>{for(;l<s.length&&i[o][l]!==null;)l++;a.dataset.col=l;const c=a.rowSpan||1,u=a.colSpan||1;for(let g=0;g<c;g++)for(let f=0;f<u;f++)o+g<e.length&&l+f<s.length&&(i[o+g][l+f]=a);l+=u})})}};Zs=new WeakSet,hl=h(function(n){n.querySelectorAll("colgroup col").forEach((e,s)=>{e.setAttribute("data-col",s);const i=e.getAttribute("fixed");n.querySelectorAll(`[data-col="${s}"]`).forEach(r=>{i?r.setAttribute("fixed",i):r.removeAttribute("fixed")})})},"#syncColAttributes"),d(gt,Zs),h(gt,"TableCompiler");let fe=gt;const vo=class vo{constructor(n){d(this,se);d(this,J);d(this,Js,{startRow:-1,startCol:-1,endRow:-1,endCol:-1});E(this,"refresh",h(()=>{this.render()},"refresh"));E(this,"render",h(()=>{var l;const{startRow:n,startCol:e,endRow:s,endCol:i}=t(this,Js),r=t(this,J).querySelectorAll(".ng-sheet-body-content .ng-container-left, .ng-sheet-body-content .ng-container-body, .ng-sheet-body-content .ng-container-right");if(r.forEach(a=>{a.querySelectorAll(".selected, .selected-top, .selected-bottom, .selected-left, .selected-right, .selected-start").forEach(c=>{c.classList.remove("selected","selected-top","selected-bottom","selected-left","selected-right","selected-start")}),a.querySelectorAll("tr.selected-start").forEach(c=>{c.classList.remove("selected-start")})}),n<0||e<0)return;r.forEach(a=>{a.querySelectorAll("tbody tr").forEach(c=>{const{matrixRow:u}=A(this,se,zi).call(this,c);u<0||c.querySelectorAll("td, th").forEach(g=>{const f=parseInt(g.dataset.col,10);if(isNaN(f))return;const b=parseInt(g.rowSpan||1,10),m=parseInt(g.colSpan||1,10),y=u+b-1,x=f+m-1;y>=n&&u<=s&&x>=e&&f<=i&&(g.classList.add("selected"),u<=n&&g.classList.add("selected-top"),y>=s&&g.classList.add("selected-bottom"),f<=e&&g.classList.add("selected-left"),x>=i&&g.classList.add("selected-right"))})})});const o=t(this,J).querySelector(`.ng-sheet-body-content tr[data-matrix-row="${n}"] td[data-col="${e}"]`);o&&(o.classList.add("selected-start"),(l=o.closest("tr"))==null||l.classList.add("selected-start"))},"render"));p(this,J,n),A(this,se,Tl).call(this),v.log("🎯 [CellSelection] Initialized (New Structure Compatible)")}setFocus(n,e){var i;t(this,J).querySelectorAll("tr.selected-start").forEach(r=>{r.classList.remove("selected-start"),r.querySelectorAll("td.selected-start").forEach(o=>{o.classList.remove("selected-start")})});const s=t(this,J).querySelector(`.ng-sheet-body-content tr[data-matrix-row="${n}"] td[data-col="${e}"]`);s&&(s.classList.add("selected-start"),(i=s.closest("tr"))==null||i.classList.add("selected-start"))}setRange(n,e,s,i){let r=Math.min(n,s),o=Math.max(n,s),l=Math.min(e,i),a=Math.max(e,i);const c=t(this,J).querySelectorAll(".ng-sheet-body-content .ng-container-left, .ng-sheet-body-content .ng-container-body, .ng-sheet-body-content .ng-container-right");let u=!0,g=0;for(;u&&g<5;)u=!1,g++,c.forEach(f=>{f.querySelectorAll("tbody tr").forEach(b=>{if(b.classList.contains("nodata"))return;const{matrixRow:m}=A(this,se,zi).call(this,b);m<0||b.querySelectorAll("td, th").forEach(y=>{const x=parseInt(y.dataset.col,10);if(isNaN(x))return;const w=parseInt(y.rowSpan||1,10),S=parseInt(y.colSpan||1,10),R=m+w-1,C=x+S-1;if(R>=r&&m<=o&&C>=l&&x<=a){const T=Math.min(r,m),D=Math.max(o,R),_=Math.min(l,x),rt=Math.max(a,C);(T!==r||D!==o||_!==l||rt!==a)&&(r=T,o=D,l=_,a=rt,u=!0)}})})});p(this,Js,{startRow:r,startCol:l,endRow:o,endCol:a}),this.render()}};J=new WeakMap,Js=new WeakMap,se=new WeakSet,zi=h(function(n){if(!n)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"),r=Array.from(s.querySelectorAll("tr:not(.nodata)")).filter(c=>parseInt(c.dataset.row,10)===e),o=r.indexOf(n),l=r.length>0?r.length:1,a=e*l+(o>=0?o:n.sectionRowIndex%l);return{dataRow:e,subRowIndex:o,matrixRow:a}},"#getMatrixRow"),Tl=h(function(){const n=t(this,J).querySelector(".ng-sheet-body");if(!n){v.log("❌ [CellSelection] .ng-sheet-body 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;t(this,J).style.userSelect="none",t(this,J).style.webkitUserSelect="none";const i=s.closest("tr"),{matrixRow:r}=A(this,se,zi).call(this,i),o=parseInt(s.dataset.col,10);if(r<0){t(this,J).style.userSelect="",t(this,J).style.webkitUserSelect="";return}this.setFocus(r,o),this.setRange(r,o,r,o);let l=r,a=o;const c=h(g=>{const f=document.elementFromPoint(g.clientX,g.clientY);let b=f==null?void 0:f.closest("td, th");if(!b||!t(this,J).contains(b)){const w=t(this,J).querySelectorAll(".ng-sheet-body-content tbody tr:not(.nodata) td, .ng-sheet-body-content tbody tr:not(.nodata) th");for(const S of w){const R=S.getBoundingClientRect();if(g.clientX>=R.left&&g.clientX<=R.right&&g.clientY>=R.top&&g.clientY<=R.bottom){b=S;break}}}if(!b||b.dataset.row===void 0||b.dataset.col===void 0||b.closest("tr").classList.contains("nodata"))return;const m=b.closest("tr"),{matrixRow:y}=A(this,se,zi).call(this,m),x=parseInt(b.dataset.col,10);y<0||l===y&&a===x||(l=y,a=x,this.setRange(r,o,y,x))},"onMouseMove"),u=h(()=>{t(this,J).style.userSelect="",t(this,J).style.webkitUserSelect="",document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u)},"onMouseUp");document.addEventListener("mousemove",c),document.addEventListener("mouseup",u)})},"#initEvents"),h(vo,"CellSelection");let Nn=vo;const Eo=class Eo{constructor(n){d(this,pt);d(this,$);d(this,Qs);d(this,ye,null);d(this,Xt,null);d(this,So,-1);d(this,Ao,-1);d(this,ti,h(n=>{const e=t(this,$).querySelectorAll(`.ng-sheet-body td[data-row="${n}"]`);if(!e||e.length===0)return 0;let s=1/0;return e.forEach(i=>{const r=parseInt(i.dataset.col,10);!isNaN(r)&&window.getComputedStyle(i).display!=="none"&&(s=Math.min(s,r))}),s===1/0?0:s},"#getMinCol"));d(this,ei,h(n=>{const e=t(this,$).querySelectorAll(`.ng-sheet-body td[data-row="${n}"]`);if(!e||e.length===0)return 0;let s=0;return e.forEach(i=>{const r=parseInt(i.dataset.col,10);!isNaN(r)&&window.getComputedStyle(i).display!=="none"&&(s=Math.max(s,r))}),s},"#getMaxCol"));d(this,si,h(n=>{const e=[];return n.forEach(s=>e.push(...Array.from(s.querySelectorAll("td")))),e.length===0?null:(e.sort((s,i)=>parseInt(s.dataset.col,10)-parseInt(i.dataset.col,10)),e[e.length-1])},"#getMaxColCell"));d(this,ii,h((n,e)=>{const s=t(this,$).querySelector(`.ng-sheet-body tr[data-matrix-row="${n}"] td[data-col="${e}"]`)||t(this,$).querySelector(`.ng-sheet-body td[data-col="${e}"]`),i=(s==null?void 0:s.colSpan)||1,r=e+i;return v.log(`🔍 [#getNextCol] current col: ${e}, found td colSpan: ${i}, calculated next col: ${r}`),r},"#getNextCol"));d(this,ri,h((n,e)=>{if(e<=0)return 0;const s=t(this,Xt)?Array.from(t(this,Xt).querySelectorAll("td, th")):[],i=new Set;s.forEach(o=>{const l=parseInt(o.dataset.col,10);!isNaN(l)&&window.getComputedStyle(o).display!=="none"&&i.add(l)}),i.size===0&&t(this,ms).call(this,n).forEach(l=>{Array.from(l.querySelectorAll("td, th")).forEach(a=>{const c=parseInt(a.dataset.col,10);!isNaN(c)&&window.getComputedStyle(a).display!=="none"&&i.add(c)})});const r=Array.from(i).filter(o=>o<e);return r.length===0?Math.max(0,e-1):Math.max(...r)},"#getPreviousCol"));d(this,ms,h(n=>{const e=t(this,$).querySelectorAll(".ng-sheet-body .ng-container-left, .ng-sheet-body .ng-container-body, .ng-sheet-body .ng-container-right"),s=[];return e.forEach(i=>{const r=Array.from(i.querySelectorAll("tbody tr"));for(const o of r){const l=A(this,pt,cs).call(this,o);if(l===n){s.push(o);break}const a=Array.from(o.querySelectorAll("td"));let c=!1;for(const u of a){const g=parseInt(u.rowSpan||1,10);if(g>1&&n>=l&&n<l+g){s.push(o),c=!0;break}}if(c)break}}),s},"#findTargetTrsByMatrix"));d(this,ni,h((n,e,s,i)=>{const r=i!==void 0?i:n*(t(this,$).templateLength||1)+e,o=t(this,$).templateLength||1,l=t(this,$).querySelectorAll(".ng-sheet-body, .ng-container-left, .ng-container-body, .ng-container-right, .ng-part-body"),a=new Set;l.forEach(c=>{c.querySelectorAll("tbody tr").forEach(u=>a.add(u))});for(const c of Array.from(a)){const u=parseInt(c.dataset.row,10);if(isNaN(u))continue;const g=c.closest("tbody"),b=(g?Array.from(g.querySelectorAll(`tr[data-row="${u}"]`)):[c]).indexOf(c);for(const m of Array.from(c.querySelectorAll("td"))){const y=parseInt(m.dataset.col,10),x=parseInt(m.colSpan||1,10),w=parseInt(m.rowSpan||1,10);if(isNaN(y)||window.getComputedStyle(m).display==="none")continue;const S=u,R=b,C=S*o+R,W=C+w-1;if(r>=C&&r<=W&&s>=y&&s<y+x)return m}}return null},"#getNearElement"));p(this,$,n),p(this,Qs,n.getRootNode().host),A(this,pt,kl).call(this),v.log("🎯 [CellNavigation] Initialized (Diagnostic Logging Restored)")}get currentCell(){return t(this,ye)}set currentCell(n){var s;if(!n)return;p(this,ye,n),n.focus({preventScroll:!0}),p(this,Xt,n.closest("tr"));const e=A(this,pt,cs).call(this,t(this,Xt));v.log(`📌 [setCurCell] Active set -> dataRow: ${n.dataset.row}, subrow: ${(s=n.closest("tr"))==null?void 0:s.dataset.subrow}, matrixRow: ${e}, col: ${n.dataset.col}`),t(this,$).selection.setFocus(e,t(this,ye).dataset.col)}moveCell(n){var m;if(!["TH","TD"].includes(n.target.tagName))return;if(!t(this,ye)||!t(this,Xt)){v.log("⚠️ [moveCell] currentCell or currentTr is missing!");return}const e=t(this,ye),s=parseInt(e.dataset.row,10),i=parseInt(e.dataset.col,10),r=t(this,$).templateLength||1,o=A(this,pt,cs).call(this,t(this,Xt));let l=o,a=i;switch(n.code){case"ArrowDown":n.preventDefault(),l=o+(e.rowSpan||1);break;case"ArrowUp":n.preventDefault(),l=Math.max(0,o-(e.rowSpan||1));break;case"ArrowRight":a=t(this,ii).call(this,o,i);break;case"ArrowLeft":a=t(this,ri).call(this,o,i);break;case"Tab":if(n.preventDefault(),n.shiftKey){if(a=t(this,ri).call(this,o,i),a<0&&o>0){l=o-1;const y=t(this,ms).call(this,l),x=t(this,si).call(this,y);a=x?parseInt(x.dataset.col,10):0}}else{a=t(this,ii).call(this,o,i);const y=t(this,ms).call(this,o),x=t(this,si).call(this,y),w=x?parseInt(x.dataset.col,10)+parseInt(x.colSpan||1,10):0;a>=w&&(l=o+1,a=0)}break}switch(n.code){case"ArrowDown":const x=t(this,Qs).data.length*r-1;if(o+(e.rowSpan||1)>x)return;break;case"ArrowUp":if(o<=0)return;break;case"ArrowRight":if(i===a||a>t(this,ei).call(this,s,i))return;break;case"ArrowLeft":if(i===a||a<t(this,ti).call(this,s,i))return;break;case"Tab":if(n.shiftKey){if(i===a||a<t(this,ti).call(this,s,i))return}else if(i===a||a>t(this,ei).call(this,s,i))return;break}v.log("========");const u=(((m=t(this,$).view.getArray())==null?void 0:m.length)||0)*r-1;l=Math.max(0,Math.min(l,u)),v.log(`⌨️ [Key: ${n.code}] Current matrixRow: ${o} -> Target nextMatrixRow: ${l}, nextCol: ${a}`);const g=Math.floor(l/r),f=l%r;h((y=0)=>{let x=t(this,ni).call(this,g,f,a,l);if(x){v.log(`✅ [Found Cell] Attempt ${y} -> dataRow: ${x.dataset.row}, col: ${x.dataset.col}`),this.currentCell=x;const w=A(this,pt,cs).call(this,t(this,Xt));t(this,$).selection.setRange(w,x.dataset.col,w,x.dataset.col),A(this,pt,dl).call(this,x)}else v.log(`📜 [Scroll Trigger] Cell not found in DOM, invoking rowManager.scrollToDataRow(${g})`),t(this,$).rowManager.scrollToDataRow(g,"bottom",()=>{v.log("nextDataRow",g),h(()=>{let S=t(this,ni).call(this,g,f,a,l);if(S){v.log(`✅ [Found After Scroll] RetryLoop success -> dataRow: ${S.dataset.row}`),this.currentCell=S;const R=S.closest("tr"),C=A(this,pt,cs).call(this,R);t(this,$).selection.setRange(C,S.dataset.col,C,S.dataset.col),A(this,pt,dl).call(this,S)}},"retryLoop")()})},"attemptFindAndMove")()}};$=new WeakMap,Qs=new WeakMap,ye=new WeakMap,Xt=new WeakMap,So=new WeakMap,Ao=new WeakMap,pt=new WeakSet,cs=h(function(n){if(!n)return 0;const e=parseInt(n.dataset.row,10)||0,s=t(this,$).templateLength||1,i=parseInt(n.dataset.matrixRow,10);if(!isNaN(i))return i;const r=n.closest("tbody");if(r){const a=Array.from(r.querySelectorAll(`tr[data-row="${e}"]`)).indexOf(n);if(a>=0)return e*s+a}const o=parseInt(n.dataset.subrow,10)||0;return e*s+o},"#getMatrixRowFromTr"),dl=h(function(n){const e=t(this,$).querySelector(".ng-sheet-body"),s=t(this,$).querySelector(".ng-sheet-body .ng-container-body"),i=t(this,$).querySelector(".ng-sheet-header .ng-container-body");if(!e||!s)return;const r=n.getBoundingClientRect(),o=e.getBoundingClientRect(),l=s.getBoundingClientRect(),a=i?i.getBoundingClientRect():null;v.log(`📐 [DIAGNOSTIC VISIBILITY]
|
|
144
|
+
- cell.dataset.col: ${n.dataset.col}
|
|
145
|
+
- cellRect (left: ${r.left}, right: ${r.right})
|
|
146
146
|
- containerRect (left: ${l.left}, right: ${l.right}, width: ${l.width}, scrollLeft: ${s.scrollLeft}, scrollWidth: ${s.scrollWidth}, clientWidth: ${s.clientWidth})
|
|
147
147
|
- viewportRect (width: ${o.width})
|
|
148
148
|
- headerBody (scrollLeft: ${i==null?void 0:i.scrollLeft}, width: ${a==null?void 0:a.width})
|
|
149
|
-
`);const c=n.top<o.top,u=n.bottom>o.bottom;if(c||u){const p=parseInt(r.dataset.row,10),f=r.dataset.col,b=r.closest("tr"),m=(b==null?void 0:b.dataset.subrow)||0;!isNaN(p)&&t(this,$).rowManager&&(v.log("11111111111"),t(this,$).rowManager.scrollToDataRow(p,"top",()=>{const y=t(this,$).querySelector(`.ng-sheet-body tr[data-row="${p}"][data-subrow="${m}"] td[data-col="${f}"]`);if(y){this.currentCell=y;const x=y.closest("tr"),w=A(this,gt,cs).call(this,x);t(this,$).selection.setRange(w,f,w,f)}}))}n.left<l.left?(v.log("↔️ [Scroll X Left] cell out of left bound"),s.scrollLeft-=l.left-n.left+10,t(this,$).scrollToX(s.scrollLeft)):n.right>l.right&&(v.log(`↔️ [Scroll X Right] cell out of right bound. cellRect.right: ${n.right} > containerRect.right: ${l.right}`),s.scrollLeft+=n.right-l.right+10,t(this,$).scrollToX(s.scrollLeft))},"#ensureCellVisible"),ti=new WeakMap,ei=new WeakMap,si=new WeakMap,ii=new WeakMap,ni=new WeakMap,ms=new WeakMap,ri=new WeakMap,Tl=h(function(){t(this,$).addEventListener("mousedown",r=>{if(r.button!==0)return;const e=r.target.closest("td, th");e&&(e.dataset.row===void 0||e.dataset.col===void 0||(this.currentCell=e))}),t(this,$).addEventListener("keydown",r=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r.code)&&this.moveCell(r)})},"#initEvents"),h(Eo,"CellNavigation");let Dr=Eo;const Bi=2,Lo=class Lo{constructor(r){d(this,Tt);d(this,X);d(this,Xe);d(this,Ct);d(this,_e);d(this,_t,null);d(this,kt,null);d(this,Gt,null);d(this,Ut,null);d(this,ys,0);d(this,jt,0);d(this,xe,0);d(this,oi,0);d(this,li,0);d(this,ai,h(r=>{const e=r.target.closest("thead");if(!e)return;const s=r.target.closest("th, td");if(e.querySelectorAll(".resizable-edge").forEach(a=>{a!==s&&a.classList.remove("resizable-edge")}),!s||s.dataset.col===void 0||s.getAttribute("collapsed")==="true")return;const i=s.getBoundingClientRect(),n=r.clientX-i.left,o=n<=Bi,l=i.width-n<=Bi;if(o){const a=s.previousElementSibling;if(!a||a.getAttribute("collapsed")==="true"){s.classList.remove("resizable-edge");return}}o||l?s.classList.add("resizable-edge"):s.classList.remove("resizable-edge")},"#onPointerMove"));d(this,ci,h(r=>{if(v.log(r.actualTarget,r.target),!r.actualTarget.closest("thead"))return;const s=r.actualTarget.closest("th, td");if(v.log(s,r.actualTarget),!s||!s.classList.contains("resizable-edge"))return;r.preventDefault();const i=s.getBoundingClientRect(),n=r.clientX-i.left;let o=s;if(n<=Bi){const y=s.previousElementSibling;if(y&&y.dataset.col!==void 0&&y.getAttribute("collapsed")!=="true")o=y;else if(!s.previousElementSibling)return}g(this,Ut,o),g(this,Gt,A(this,Tt,ul).call(this,o));const l=t(this,X).querySelector(`.ng-container-${t(this,Gt)}`);if(!l)return;const a=parseInt(o.dataset.col,10),c=o.colSpan||1;if(g(this,_t,a+c-1),A(this,Tt,yr).call(this,o)){g(this,kt,t(this,_t)+1);const y=l.querySelector(`col[data-col="${t(this,kt)}"]`);y?g(this,xe,parseInt(y.getAttribute("width"),10)||100):g(this,kt,null)}else g(this,kt,null);const p=o.getBoundingClientRect(),f=t(this,X).getBoundingClientRect();g(this,oi,p.width),g(this,li,p.left-f.left);const b=l.querySelector(`col[data-col="${t(this,_t)}"]`),m=b==null?void 0:b.getAttribute("width");g(this,jt,m&&!isNaN(parseInt(m,10))?parseInt(m,10):p.width/c),g(this,ys,r.clientX),t(this,Ct)&&(t(this,Ct).classList.add("active"),A(this,Tt,fl).call(this,r.clientX)),window.addEventListener("pointermove",t(this,hi)),window.addEventListener("pointerup",t(this,dn),{once:!0})},"#onPointerDown"));d(this,hi,h(r=>{v.log(r),A(this,Tt,fl).call(this,r.clientX)},"#onDragMove"));d(this,dn,h(r=>{var n;window.removeEventListener("pointermove",t(this,hi));const e=r.clientX-t(this,ys),s=A(this,Tt,yr).call(this,t(this,Ut));let i=0;if(s&&t(this,kt)!==null){let o=Math.max(mt,t(this,jt)+e),l=t(this,jt)+t(this,xe)-o;l<mt&&(l=mt,o=t(this,jt)+t(this,xe)-mt),this.setColumnWidth(t(this,_t),o,t(this,Gt)),this.setColumnWidth(t(this,kt),l,t(this,Gt)),i=o}else{const o=Math.max(mt,t(this,jt)+e);t(this,_t)!==null&&t(this,Gt)&&(this.setColumnWidth(t(this,_t),o,t(this,Gt)),i=o)}if(t(this,Ut)){const o=t(this,Ut);o.getAttribute("collapsed")!=="true"&&i>20&&(o.dataset.expandWidth=String(i))}t(this,Ct)&&((n=t(this,_e))==null||n.classList.add("fade-out"),setTimeout(()=>{var o;t(this,Ct).classList.remove("active"),(o=t(this,_e))==null||o.classList.remove("fade-out")},150)),g(this,_t,null),g(this,kt,null),g(this,Gt,null),g(this,Ut,null)},"#onDragEnd"));d(this,di,h(r=>{let s=r.target.closest("th, td");if(!s||!s.classList.contains("resizable-edge"))return;const i=s.getBoundingClientRect();r.clientX-i.left<=Bi&&(s=s.previousElementSibling);const o=parseInt(s.dataset.col,10),l=t(this,X).querySelector(`tbody.body [data-col="${o}"]`);if(!l||!l.dataset.bind||l.classList.contains("CELL-RADIO"))return;let a=0;Array.from(l.firstElementChild.children).forEach(y=>{switch(y.tagName){case"SPAN":a+=8;break;case"DIV":a+=8;break;case"BUTTON":a+=32;break;case"SELECT":a+=32;break;case"INPUT":switch((y.type||"text").toLowerCase()){case"checkbox":case"radio":a+=12;break;case"button":case"submit":case"reset":case"image":a+=16;break;case"color":case"file":case"range":a+=24;break;case"hidden":a+=0;break;case"text":case"search":case"tel":case"url":case"email":case"password":case"number":case"date":case"time":case"datetime-local":case"month":case"week":default:a+=16;break}break}}),v.log(a);const c=t(this,Xe).fields.get().indexOf(l.dataset.bind),p=window.getComputedStyle(l).font||"12px sans-serif",f=s.innerText||"";let m=(nine.measureTextSize(f,p).width||0)+16;t(this,Xe).execute(()=>{t(this,X).view.getArray().forEach((x,w)=>{const S=String(l.dataset.expr?t(this,Xe).exprEngine.evaluate(l.dataset.expr,x,w):x.v[c]??"").trim(),R=nine.measureTextSize(S,p);R.width&&R.width>m&&(m=R.width)});const y=Math.max(32,Math.min(400,Math.ceil(m)+a));this.setColumnWidth(l.dataset.col,y,A(this,Tt,ul).call(this,s))})},"#onDblClick"));var e;g(this,X,r),g(this,Xe,r.getRootNode().host),g(this,Ct,t(this,X).querySelector(".ng-col-resizer-panel")),g(this,_e,(e=t(this,Ct))==null?void 0:e.querySelector(".resizer-overlay")),this.bindEvents()}destroy(){t(this,X).removeEventListener("pointermove",t(this,ai)),t(this,X).removeEventListener("pointerdown",t(this,ci)),t(this,X).removeEventListener("dblclick",t(this,di))}refreshLayout(r="body"){var n,o;const e=Array.from(t(this,X).querySelectorAll(`.ng-container-${r}`));if(e.length===0)return;if(!(r==="left"||r==="right")&&(t(this,X).isAutoFitCol||((n=e[0].querySelector("table"))==null?void 0:n.getAttribute("auto-fit-col"))==="true"))e.forEach(l=>{l.querySelectorAll("table").forEach(c=>{})});else{const l=e[0].querySelector("table colgroup");if(!l)return;let a=0;const c={};Array.from(l.querySelectorAll("col")).forEach(u=>{const p=u.getAttribute("data-col"),f=parseInt(u.getAttribute("width"),10);isNaN(f)||(c[p]=f,a+=f)}),e.forEach(u=>{const p=u.querySelectorAll("table");v.log("====================",e,r),r==="body"?p.forEach(f=>{f.style.width=`${a}px`}):(u.style.flex=`0 0 ${a}px`,u.style.width=`${a}px`,u.style.minWidth=`${a}px`,u.style.maxWidth=`${a}px`,p.forEach(f=>{f.style.width=`${a}px`,f.style.minWidth=`${a}px`,f.style.maxWidth=`${a}px`,Object.entries(c).forEach(([b,m])=>{f.querySelectorAll(`th[data-col="${b}"], td[data-col="${b}"]`).forEach(y=>{y.style.width=`${m}px`,y.style.minWidth=`${m}px`,y.style.maxWidth=`${m}px`})})}))})}(o=t(this,X).querySelector("nine-table-hscrollbar"))==null||o.refresh()}setColumnWidth(r,e,s=null){var a,c;v.log("setColumnWidth");let i=[];if(i=Array.from(t(this,X).querySelectorAll(`table colgroup col[data-col="${r}"]`)),i.length===0)return;const n=i[0].closest(".ng-container-left, .ng-container-body, .ng-container-right"),o=s||(n!=null&&n.classList.contains("ng-container-left")?"left":n!=null&&n.classList.contains("ng-container-right")?"right":"body");i.forEach(u=>{u.setAttribute("width",e),u.style.width=`${e}px`,v.log(u,e)});const l=(a=t(this,X).sourceTable)==null?void 0:a.querySelector(`colgroup col[data-col="${r}"]`);l&&(l.setAttribute("width",e),l.style.width=`${e}px`),this.refreshLayout(o),(o==="left"||o==="right")&&this.refreshLayout("body"),(c=t(this,X).rowManager)==null||c.refresh()}bindEvents(){t(this,X).addEventListener("pointermove",t(this,ai)),t(this,X).addDebounseEventListener("dblclick",t(this,di),"pointerdown",t(this,ci))}};X=new WeakMap,Xe=new WeakMap,Ct=new WeakMap,_e=new WeakMap,_t=new WeakMap,kt=new WeakMap,Gt=new WeakMap,Ut=new WeakMap,ys=new WeakMap,jt=new WeakMap,xe=new WeakMap,oi=new WeakMap,li=new WeakMap,Tt=new WeakSet,yr=h(function(r){if(t(this,X).isAutoFitCol)return!0;const e=r==null?void 0:r.closest("table");return!!(e&&e.getAttribute("auto-fit-col")==="true")},"#checkIsAutoFit"),ul=h(function(r){const e=r.closest(".ng-container-left, .ng-container-body, .ng-container-right");return e?e.classList.contains("ng-container-left")?"left":e.classList.contains("ng-container-right")?"right":"body":null},"#getContainerType"),ai=new WeakMap,ci=new WeakMap,fl=h(function(r){var c;let e=r-t(this,ys);const s=A(this,Tt,yr).call(this,t(this,Ut));if(s&&t(this,kt)!==null){const u=t(this,xe)-mt,p=-(t(this,jt)-mt);e=Math.max(p,Math.min(e,u))}const i=Math.max(mt,t(this,jt)+e),n=t(this,Ut).getBoundingClientRect();let o=r-n.left;if(s&&t(this,kt)!==null){const u=t(this,oi)+(t(this,xe)-mt);o=Math.min(o,u)}const l=Math.max(mt,o);t(this,Ct)&&(t(this,Ct).style.setProperty("--tooltip-left",`${t(this,li)}px`),t(this,Ct).style.setProperty("--tooltip-width",`${l}px`));const a=(c=t(this,_e))==null?void 0:c.querySelector(".size-badge");a&&(a.textContent=`${Math.round(i)}px`)},"#updatePositions"),hi=new WeakMap,dn=new WeakMap,di=new WeakMap,h(Lo,"ColResizer");let $r=Lo;const Ro=class Ro{constructor(r){d(this,st);d(this,K);d(this,V);d(this,et);d(this,we,!1);d(this,ie,null);d(this,ne,null);d(this,zt,null);d(this,ui,0);d(this,Ge,null);d(this,fi,h(r=>{if(!A(this,st,Il).call(this)||!r.target.closest(".ng-sheet-header"))return;const s=r.target.closest("th, td");if(!s||s.classList.contains("resizable-edge")||["INPUT","BUTTON"].includes(r.target.tagName)||s.dataset.col===void 0)return;r.preventDefault();const i=r.clientX,n=r.clientY,o=h(()=>{t(this,Ge)&&(clearTimeout(t(this,Ge)),g(this,Ge,null)),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o)},"cancelTimer"),l=h(a=>{Math.hypot(a.clientX-i,a.clientY-n)>5&&o()},"onPointerMovePending");g(this,Ge,setTimeout(()=>{o(),A(this,st,Hl).call(this,r,s)},500)),window.addEventListener("pointermove",l),window.addEventListener("pointerup",o,{once:!0}),window.addEventListener("pointercancel",o,{once:!0})},"#onPointerDown"));d(this,pi,h(r=>{var i,n;if(!t(this,we))return;A(this,st,pl).call(this,r.clientX),t(this,V)&&(t(this,V).style.pointerEvents="none"),t(this,et)&&(t(this,et).style.pointerEvents="none");const e=A(this,st,ql).call(this,r.clientX,r.clientY),s=e==null?void 0:e.closest(".ng-sheet-header th, .ng-sheet-header td");if(s&&s.dataset.col!==void 0){const o=parseInt(s.dataset.col,10),l=t(this,K).getBoundingClientRect(),a=s.closest("table");let c=1/0,u=-1/0;if(a&&a.querySelectorAll("thead th, thead td").forEach(O=>{if(O.dataset.col===void 0)return;const tt=parseInt(O.dataset.col,10),St=O.colSpan||1,P=tt+St-1;if(tt<=o&&P>=o){const $s=O.getBoundingClientRect();c=Math.min(c,$s.left),u=Math.max(u,$s.right)}}),c===1/0){const O=s.getBoundingClientRect();c=O.left,u=O.right}const p=c+(u-c)/2;let f=0,b=0;if(r.clientX<p)f=o,b=c-l.left;else{const O=s.colSpan||1;f=o+O,b=u-l.left}const m=A(this,st,xr).call(this,t(this,ie)),y=m.colSpan,x=m.rowIndex,w=t(this,ie).rowSpan||1,S=x+w-1,R=((i=s.closest("tr"))==null?void 0:i.sectionRowIndex)??0,C=s.rowSpan||1,F=R+C-1,k=!(S<R||x>F);let D=!1;if(m.parentGroupRange){const{startCol:O,endCol:tt}=m.parentGroupRange;(f<O||f+y-1>tt)&&(D=!0)}let _=!1;if(a){const O=a.querySelectorAll("thead th[colspan], thead td[colspan]");for(const tt of O){if(tt===t(this,ie))continue;const St=((n=tt.closest("tr"))==null?void 0:n.sectionRowIndex)??0,P=tt.rowSpan||1,$s=St+P-1;if(!!(S<St||x>$s))continue;const ke=parseInt(tt.dataset.col,10),mr=tt.colSpan||1,Te=ke+mr-1;if(f>ke&&f<Te+1){_=!0;break}const nl=f+y-1;if(f>ke&&f<=Te&&nl>Te||f<ke&&nl>=ke&&nl<Te){_=!0;break}}}const nt=f>=m.startCol&&f<=m.endCol+1;if(!k||nt||D||_||!m.isValidGroup)g(this,zt,null),t(this,et)&&(t(this,et).style.display="none"),t(this,V)&&t(this,V).classList.add("invalid");else if(g(this,zt,f),t(this,V)&&t(this,V).classList.remove("invalid"),t(this,et)){const St=s.closest(".ng-sheet-header").getBoundingClientRect().top-l.top,P=l.height-St;t(this,et).style.top=`${St}px`,t(this,et).style.height=`${P}px`,t(this,et).style.left=`${b-1}px`,t(this,et).style.display="block"}}else t(this,et)&&(t(this,et).style.display="none"),t(this,V)&&t(this,V).classList.add("invalid"),g(this,zt,null)},"#onPointerMove"));d(this,un,h(r=>{t(this,we)&&(window.removeEventListener("pointermove",t(this,pi)),document.body.style.cursor="",t(this,V)&&(t(this,V).style.display="none",t(this,V).replaceChildren()),t(this,et)&&(t(this,et).style.display="none"),t(this,zt)!==null&&t(this,ne)!==null&&t(this,zt)!==t(this,ne)&&t(this,zt)!==t(this,ne)+1&&this.moveColumn(t(this,ne),t(this,zt)),g(this,we,!1),g(this,ie,null),g(this,ne,null),g(this,zt,null))},"#onPointerUp"));g(this,K,r),g(this,V,t(this,K).querySelector(".ng-col-mover-grip")),g(this,et,t(this,K).querySelector(".ng-col-mover-indi")),this.bindEvents()}bindEvents(){t(this,K).addEventListener("pointerdown",t(this,fi))}moveColumn(r,e){v.log(t(this,K).sourceTable.cloneNode(!0));const s=t(this,K).sourceTable.querySelector("colgroup"),i=s.querySelector(`col[data-col="${e}"]`),n=A(this,st,xr).call(this,t(this,ie));if(!n||!n.isValidGroup)return;const o=n.colSpan,l=h(u=>u>=r&&u<r+o,"isInRange"),a=t(this,K).querySelector(`.ng-sheet-body-content col[data-col="${e}"]`),c=a!=null&&a.closest(".ng-container-left")?"left":a!=null&&a.closest(".ng-container-right")?"right":null;s.querySelectorAll("col").forEach(u=>{l(parseInt(u.getAttribute("data-col"),10))&&(c?u.setAttribute("fixed",c):u.removeAttribute("fixed"),s.insertBefore(u,i))}),["thead","tbody","tfoot"].forEach(u=>{t(this,K).sourceTable.querySelectorAll(`${u} tr`).forEach(p=>{const f=Array.from(p.children),b=f.find(m=>parseInt(m.dataset.col,10)>=e);f.forEach(m=>{l(parseInt(m.dataset.col,10))&&p.insertBefore(m,b||null)})})}),t(this,K).recompileAndRefresh()}destroy(){t(this,K).removeEventListener("pointerdown",t(this,fi))}};K=new WeakMap,V=new WeakMap,et=new WeakMap,we=new WeakMap,ie=new WeakMap,ne=new WeakMap,zt=new WeakMap,ui=new WeakMap,Ge=new WeakMap,st=new WeakSet,Il=h(function(){var e;const r=(e=t(this,K).getRootNode())==null?void 0:e.host;return t(this,K).getAttribute("col-movable")==="true"||(r==null?void 0:r.getAttribute("col-movable"))==="true"},"#checkIsMovable"),ql=h(function(r,e){const s=t(this,K).getRootNode();let i=s.elementFromPoint?s.elementFromPoint(r,e):document.elementFromPoint(r,e);for(;i&&i.shadowRoot&&i.shadowRoot.elementFromPoint;){const n=i.shadowRoot.elementFromPoint(r,e);if(!n||n===i)break;i=n}return i},"#getDeepElementFromPoint"),xr=h(function(r){var f,b;if(!r||r.dataset.col===void 0)return null;const e=parseInt(r.dataset.col,10),s=r.colSpan||1,i=e+s-1,n=((f=r.closest("tr"))==null?void 0:f.sectionRowIndex)??0,o=r.closest("table");if(!o)return{startCol:e,colSpan:s,endCol:i,rowIndex:n,isGroup:!1,parentGroupRange:null,isValidGroup:!0};const l=o.querySelectorAll("thead th, thead td");let a=!1,c=!0,u=null;for(const m of l){if(m===r||m.dataset.col===void 0)continue;const y=parseInt(m.dataset.col,10),x=m.colSpan||1,w=y+x-1;(((b=m.closest("tr"))==null?void 0:b.sectionRowIndex)??0)<n&&y<=e&&w>=i&&x>s&&(u?(u.startCol=Math.max(u.startCol,y),u.endCol=Math.min(u.endCol,w)):u={startCol:y,endCol:w}),!(w<e||y>i)&&(y>=e&&w<=i?x<s&&(a=!0):(y<e||w>i)&&(y<=e&&w>=i||(c=!1)))}const p=a&&c;return{startCol:e,colSpan:p?s:1,endCol:p?i:e,rowIndex:n,isGroup:p,parentGroupRange:u,isValidGroup:c}},"#getColGroupRange"),Ml=h(function(r){const e=A(this,st,xr).call(this,r);if(!e)return null;const{startCol:s,endCol:i,isGroup:n}=e,o=r.closest("table");if(!o)return null;let l=1/0,a=-1/0,c=1/0,u=-1/0;const p=[];if(o.querySelectorAll("thead th, thead td").forEach(y=>{if(y.dataset.col===void 0)return;const x=parseInt(y.dataset.col,10),w=y.colSpan||1,S=x+w-1;if(n?x>=s&&S<=i:y===r){const C=y.getBoundingClientRect();l=Math.min(l,C.left),a=Math.max(a,C.right),c=Math.min(c,C.top),u=Math.max(u,C.bottom);const F=window.getComputedStyle(y);p.push({el:y,rect:C,style:F})}}),p.length===0)return null;const f=a-l,b=u-c,m=document.createElement("div");return m.className="grip-header-content",m.style.position="relative",m.style.width=`${f}px`,m.style.height=`${b}px`,p.forEach(({el:y,rect:x,style:w})=>{const S=y.cloneNode(!0);S.style.position="absolute",S.style.left=`${x.left-l}px`,S.style.top=`${x.top-c}px`,S.style.width=`${x.width}px`,S.style.minWidth=`${x.width}px`,S.style.maxWidth="none",S.style.height=`${x.height}px`,S.style.boxSizing="border-box",S.style.margin="0",S.style.backgroundColor=w.backgroundColor!=="transparent"&&w.backgroundColor!=="rgba(0, 0, 0, 0)"?w.backgroundColor:"#f9fafb",S.style.color=w.color,S.style.font=w.font,S.style.fontWeight=w.fontWeight,S.style.fontSize=w.fontSize,S.style.textAlign=w.textAlign,S.style.padding=w.padding,S.style.border=w.border,S.style.borderRight=w.borderRight,S.style.borderBottom=w.borderBottom,S.style.display="flex",S.style.alignItems="center",S.style.justifyContent=w.textAlign==="center"?"center":w.textAlign==="right"?"flex-end":"flex-start",m.appendChild(S)}),{element:m,bounds:{left:l,right:a,top:c,bottom:u,width:f,height:b}}},"#createGroupHeaderPreview"),fi=new WeakMap,Hl=h(function(r,e){if(t(this,we))return;const s=A(this,st,Ml).call(this,e);if(!s)return;g(this,we,!0),g(this,ie,e),g(this,ne,parseInt(e.dataset.col,10));const i=t(this,K).getBoundingClientRect(),{bounds:n,element:o}=s;if(g(this,ui,r.clientX-n.left),t(this,V)){t(this,V).replaceChildren(o);const l=n.top-i.top,a=i.height-l;t(this,V).style.width=`${n.width}px`,t(this,V).style.height=`${a}px`,t(this,V).style.top=`${l}px`,t(this,V).style.display="block",A(this,st,pl).call(this,r.clientX)}document.body.style.cursor="move",window.addEventListener("pointermove",t(this,pi)),window.addEventListener("pointerup",t(this,un),{once:!0})},"#startDrag"),pi=new WeakMap,pl=h(function(r){if(!t(this,V))return;const e=t(this,K).getBoundingClientRect(),s=r-e.left-t(this,ui);t(this,V).style.left=`${s}px`},"#updateGripPosition"),un=new WeakMap,h(Ro,"ColMover");let zr=Ro;const Co=class Co{constructor(r){d(this,ve);g(this,ve,r)}getFixState(r,e){if(!r||!e)return"none";const s=r.closest(".ng-container-left, .ng-container-right, .ng-container-body");if(s!=null&&s.classList.contains("ng-container-left"))return"left";if(s!=null&&s.classList.contains("ng-container-right"))return"right";const i=parseInt(r.dataset.col,10);if(!isNaN(i)){const n=e.querySelector(`colgroup col[data-col="${i}"]`),o=n==null?void 0:n.getAttribute("fixed");if(o)return o}return"none"}canFixColumn(r,e){if(!r||r.tagName!=="TH"||!e)return!1;const s=parseInt(r.dataset.col,10),i=r.colSpan||1;if(isNaN(s))return!1;const n=s+i-1,o=Array.from(e.querySelectorAll("thead tr"));if(o.length<=1)return!0;for(const l of o){const a=Array.from(l.querySelectorAll("th, td"));let c=!1;for(const u of a){const p=parseInt(u.dataset.col,10),f=u.colSpan||1,b=p+f-1;if(p<=n&&n<b)return!1;if(b===n){c=!0;break}}if(!c)return!1}return!0}executeFixToggle(r,e,s="left"){var u,p;if(!t(this,ve)||!e)return;const i=t(this,ve).sourceTable;if(!i)return;const n=parseInt(e.dataset.col,10),o=e.colSpan||1,l=n+o-1;if(isNaN(l))return;const a=i.querySelector("colgroup");if(!a)return;const c=Array.from(a.querySelectorAll("col"));if(r==="fix-column")c.forEach(f=>{parseInt(f.getAttribute("data-col"),10)<=l&&f.setAttribute("fixed",s)}),["thead","tbody","tfoot"].forEach(f=>{i.querySelectorAll(`${f} tr`).forEach(b=>{Array.from(b.children).forEach(m=>{const y=parseInt(m.dataset.col,10);!isNaN(y)&&y<=l&&m.setAttribute("fixed",s)})})});else if(r==="unfix-column"){let f=n;["thead","tbody","tfoot"].forEach(m=>{i.querySelectorAll(`${m} tr`).forEach((y,x)=>{Array.from(y.children).forEach(w=>{const S=parseInt(w.dataset.col,10),R=w.colSpan||1,C=S+R-1,F=w.rowSpan||1,k=y.sectionRowIndex??x;k+F-1<w.closest("tr").sectionRowIndex||k>w.closest("tr").sectionRowIndex+F-1,!(C<n||S>l)&&(f=Math.min(f,S))})})}),c.forEach(m=>{parseInt(m.getAttribute("data-col"),10)>=f&&m.removeAttribute("fixed")});let b=!1;c.forEach(m=>{b?m.removeAttribute("fixed"):m.getAttribute("fixed")||(b=!0)}),["thead","tbody","tfoot"].forEach(m=>{i.querySelectorAll(`${m} tr`).forEach(y=>{Array.from(y.children).forEach(x=>{const w=parseInt(x.dataset.col,10);if(isNaN(w))return;const S=c.find(C=>parseInt(C.getAttribute("data-col"),10)===w),R=S==null?void 0:S.getAttribute("fixed");R?x.setAttribute("fixed",R):x.removeAttribute("fixed")})})})}v.log(t(this,ve).sourceTable),(p=(u=t(this,ve)).recompileAndRefresh)==null||p.call(u)}};ve=new WeakMap,h(Co,"ColFixManager");let Vi=Co;const To=class To extends HTMLElement{constructor(){super(...arguments);d(this,bn);d(this,Ft);d(this,re);d(this,bt);d(this,oe);d(this,Kt);E(this,"currentCol",null);d(this,fn,h(()=>{t(this,pn).call(this),g(this,Ft,this.closest("nine-table-sheet")),g(this,re,this.getRootNode().host),g(this,bt,this.querySelector("nine-table-simple")),v.log("1***********************",t(this,bt)),setTimeout(()=>{g(this,oe,t(this,bt).shadowRoot.querySelector("nine-table-sheet")),v.log("2***********************",t(this,oe))}),this.querySelector(".search-box").addEventListener("focusin",e=>{e.stopPropagation()}),this.querySelector(".search-box").addEventListener("input",t(this,yn)),this.querySelector("#chkSelectAll").addEventListener("change",t(this,xn)),this.querySelector("#btnOk").addEventListener("click",t(this,mn))},"#init"));d(this,pn,h(()=>{this.innerHTML=`
|
|
149
|
+
`);const c=r.top<o.top,u=r.bottom>o.bottom;if(c||u){const g=parseInt(n.dataset.row,10),f=n.dataset.col,b=n.closest("tr"),m=(b==null?void 0:b.dataset.subrow)||0;!isNaN(g)&&t(this,$).rowManager&&(v.log("11111111111"),t(this,$).rowManager.scrollToDataRow(g,"top",()=>{const y=t(this,$).querySelector(`.ng-sheet-body tr[data-row="${g}"][data-subrow="${m}"] td[data-col="${f}"]`);if(y){this.currentCell=y;const x=y.closest("tr"),w=A(this,pt,cs).call(this,x);t(this,$).selection.setRange(w,f,w,f)}}))}r.left<l.left?(v.log("↔️ [Scroll X Left] cell out of left bound"),s.scrollLeft-=l.left-r.left+10,t(this,$).scrollToX(s.scrollLeft)):r.right>l.right&&(v.log(`↔️ [Scroll X Right] cell out of right bound. cellRect.right: ${r.right} > containerRect.right: ${l.right}`),s.scrollLeft+=r.right-l.right+10,t(this,$).scrollToX(s.scrollLeft))},"#ensureCellVisible"),ti=new WeakMap,ei=new WeakMap,si=new WeakMap,ii=new WeakMap,ri=new WeakMap,ms=new WeakMap,ni=new WeakMap,kl=h(function(){t(this,$).addEventListener("mousedown",n=>{if(n.button!==0)return;const e=n.target.closest("td, th");e&&(e.dataset.row===void 0||e.dataset.col===void 0||(this.currentCell=e))}),t(this,$).addEventListener("keydown",n=>{["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n.code)&&this.moveCell(n)})},"#initEvents"),h(Eo,"CellNavigation");let Dn=Eo;const Bi=2,Lo=class Lo{constructor(n){d(this,kt);d(this,X);d(this,Xe);d(this,Ct);d(this,_e);d(this,_t,null);d(this,Tt,null);d(this,Ut,null);d(this,Gt,null);d(this,ys,0);d(this,jt,0);d(this,xe,0);d(this,oi,0);d(this,li,0);d(this,ai,h(n=>{const e=n.target.closest("thead");if(!e)return;const s=n.target.closest("th, td");if(e.querySelectorAll(".resizable-edge").forEach(a=>{a!==s&&a.classList.remove("resizable-edge")}),!s||s.dataset.col===void 0||s.getAttribute("collapsed")==="true")return;const i=s.getBoundingClientRect(),r=n.clientX-i.left,o=r<=Bi,l=i.width-r<=Bi;if(o){const a=s.previousElementSibling;if(!a||a.getAttribute("collapsed")==="true"){s.classList.remove("resizable-edge");return}}o||l?s.classList.add("resizable-edge"):s.classList.remove("resizable-edge")},"#onPointerMove"));d(this,ci,h(n=>{if(v.log(n.actualTarget,n.target),!n.actualTarget.closest("thead"))return;const s=n.actualTarget.closest("th, td");if(v.log(s,n.actualTarget),!s||!s.classList.contains("resizable-edge"))return;n.preventDefault();const i=s.getBoundingClientRect(),r=n.clientX-i.left;let o=s;if(r<=Bi){const y=s.previousElementSibling;if(y&&y.dataset.col!==void 0&&y.getAttribute("collapsed")!=="true")o=y;else if(!s.previousElementSibling)return}p(this,Gt,o),p(this,Ut,A(this,kt,ul).call(this,o));const l=t(this,X).querySelector(`.ng-container-${t(this,Ut)}`);if(!l)return;const a=parseInt(o.dataset.col,10),c=o.colSpan||1;if(p(this,_t,a+c-1),A(this,kt,yn).call(this,o)){p(this,Tt,t(this,_t)+1);const y=l.querySelector(`col[data-col="${t(this,Tt)}"]`);y?p(this,xe,parseInt(y.getAttribute("width"),10)||100):p(this,Tt,null)}else p(this,Tt,null);const g=o.getBoundingClientRect(),f=t(this,X).getBoundingClientRect();p(this,oi,g.width),p(this,li,g.left-f.left);const b=l.querySelector(`col[data-col="${t(this,_t)}"]`),m=b==null?void 0:b.getAttribute("width");p(this,jt,m&&!isNaN(parseInt(m,10))?parseInt(m,10):g.width/c),p(this,ys,n.clientX),t(this,Ct)&&(t(this,Ct).classList.add("active"),A(this,kt,fl).call(this,n.clientX)),window.addEventListener("pointermove",t(this,hi)),window.addEventListener("pointerup",t(this,hr),{once:!0})},"#onPointerDown"));d(this,hi,h(n=>{v.log(n),A(this,kt,fl).call(this,n.clientX)},"#onDragMove"));d(this,hr,h(n=>{var r;window.removeEventListener("pointermove",t(this,hi));const e=n.clientX-t(this,ys),s=A(this,kt,yn).call(this,t(this,Gt));let i=0;if(s&&t(this,Tt)!==null){let o=Math.max(mt,t(this,jt)+e),l=t(this,jt)+t(this,xe)-o;l<mt&&(l=mt,o=t(this,jt)+t(this,xe)-mt),this.setColumnWidth(t(this,_t),o,t(this,Ut)),this.setColumnWidth(t(this,Tt),l,t(this,Ut)),i=o}else{const o=Math.max(mt,t(this,jt)+e);t(this,_t)!==null&&t(this,Ut)&&(this.setColumnWidth(t(this,_t),o,t(this,Ut)),i=o)}if(t(this,Gt)){const o=t(this,Gt);o.getAttribute("collapsed")!=="true"&&i>20&&(o.dataset.expandWidth=String(i))}t(this,Ct)&&((r=t(this,_e))==null||r.classList.add("fade-out"),setTimeout(()=>{var o;t(this,Ct).classList.remove("active"),(o=t(this,_e))==null||o.classList.remove("fade-out")},150)),p(this,_t,null),p(this,Tt,null),p(this,Ut,null),p(this,Gt,null)},"#onDragEnd"));d(this,di,h(n=>{let s=n.target.closest("th, td");if(!s||!s.classList.contains("resizable-edge"))return;const i=s.getBoundingClientRect();n.clientX-i.left<=Bi&&(s=s.previousElementSibling);const o=parseInt(s.dataset.col,10),l=t(this,X).querySelector(`tbody.body [data-col="${o}"]`);if(!l||!l.dataset.bind||l.classList.contains("CELL-RADIO"))return;let a=0;Array.from(l.firstElementChild.children).forEach(y=>{switch(y.tagName){case"SPAN":a+=8;break;case"DIV":a+=8;break;case"BUTTON":a+=32;break;case"SELECT":a+=32;break;case"INPUT":switch((y.type||"text").toLowerCase()){case"checkbox":case"radio":a+=12;break;case"button":case"submit":case"reset":case"image":a+=16;break;case"color":case"file":case"range":a+=24;break;case"hidden":a+=0;break;case"text":case"search":case"tel":case"url":case"email":case"password":case"number":case"date":case"time":case"datetime-local":case"month":case"week":default:a+=16;break}break}}),v.log(a);const c=t(this,Xe).fields.get().indexOf(l.dataset.bind),g=window.getComputedStyle(l).font||"12px sans-serif",f=s.innerText||"";let m=(nine.measureTextSize(f,g).width||0)+16;t(this,Xe).execute(()=>{t(this,X).view.getArray().forEach((x,w)=>{const S=String(l.dataset.expr?t(this,Xe).exprEngine.evaluate(l.dataset.expr,x,w):x.v[c]??"").trim(),R=nine.measureTextSize(S,g);R.width&&R.width>m&&(m=R.width)});const y=Math.max(32,Math.min(400,Math.ceil(m)+a));this.setColumnWidth(l.dataset.col,y,A(this,kt,ul).call(this,s))})},"#onDblClick"));var e;p(this,X,n),p(this,Xe,n.getRootNode().host),p(this,Ct,t(this,X).querySelector(".ng-col-resizer-panel")),p(this,_e,(e=t(this,Ct))==null?void 0:e.querySelector(".resizer-overlay")),this.bindEvents()}destroy(){t(this,X).removeEventListener("pointermove",t(this,ai)),t(this,X).removeEventListener("pointerdown",t(this,ci)),t(this,X).removeEventListener("dblclick",t(this,di))}refreshLayout(n="body"){var r,o;const e=Array.from(t(this,X).querySelectorAll(`.ng-container-${n}`));if(e.length===0)return;if(!(n==="left"||n==="right")&&(t(this,X).isAutoFitCol||((r=e[0].querySelector("table"))==null?void 0:r.getAttribute("auto-fit-col"))==="true"))e.forEach(l=>{l.querySelectorAll("table").forEach(c=>{})});else{const l=e[0].querySelector("table colgroup");if(!l)return;let a=0;const c={};Array.from(l.querySelectorAll("col")).forEach(u=>{const g=u.getAttribute("data-col"),f=parseInt(u.getAttribute("width"),10);isNaN(f)||(c[g]=f,a+=f)}),e.forEach(u=>{const g=u.querySelectorAll("table");v.log("====================",e,n),n==="body"?g.forEach(f=>{f.style.width=`${a}px`}):(u.style.flex=`0 0 ${a}px`,u.style.width=`${a}px`,u.style.minWidth=`${a}px`,u.style.maxWidth=`${a}px`,g.forEach(f=>{f.style.width=`${a}px`,f.style.minWidth=`${a}px`,f.style.maxWidth=`${a}px`,Object.entries(c).forEach(([b,m])=>{f.querySelectorAll(`th[data-col="${b}"], td[data-col="${b}"]`).forEach(y=>{y.style.width=`${m}px`,y.style.minWidth=`${m}px`,y.style.maxWidth=`${m}px`})})}))})}(o=t(this,X).querySelector("nine-table-hscrollbar"))==null||o.refresh()}setColumnWidth(n,e,s=null){var a,c;v.log("setColumnWidth");let i=[];if(i=Array.from(t(this,X).querySelectorAll(`table colgroup col[data-col="${n}"]`)),i.length===0)return;const r=i[0].closest(".ng-container-left, .ng-container-body, .ng-container-right"),o=s||(r!=null&&r.classList.contains("ng-container-left")?"left":r!=null&&r.classList.contains("ng-container-right")?"right":"body");i.forEach(u=>{u.setAttribute("width",e),u.style.width=`${e}px`,v.log(u,e)});const l=(a=t(this,X).sourceTable)==null?void 0:a.querySelector(`colgroup col[data-col="${n}"]`);l&&(l.setAttribute("width",e),l.style.width=`${e}px`),this.refreshLayout(o),(o==="left"||o==="right")&&this.refreshLayout("body"),(c=t(this,X).rowManager)==null||c.refresh()}bindEvents(){t(this,X).addEventListener("pointermove",t(this,ai)),t(this,X).addDebounseEventListener("dblclick",t(this,di),"pointerdown",t(this,ci))}};X=new WeakMap,Xe=new WeakMap,Ct=new WeakMap,_e=new WeakMap,_t=new WeakMap,Tt=new WeakMap,Ut=new WeakMap,Gt=new WeakMap,ys=new WeakMap,jt=new WeakMap,xe=new WeakMap,oi=new WeakMap,li=new WeakMap,kt=new WeakSet,yn=h(function(n){if(t(this,X).isAutoFitCol)return!0;const e=n==null?void 0:n.closest("table");return!!(e&&e.getAttribute("auto-fit-col")==="true")},"#checkIsAutoFit"),ul=h(function(n){const e=n.closest(".ng-container-left, .ng-container-body, .ng-container-right");return e?e.classList.contains("ng-container-left")?"left":e.classList.contains("ng-container-right")?"right":"body":null},"#getContainerType"),ai=new WeakMap,ci=new WeakMap,fl=h(function(n){var c;let e=n-t(this,ys);const s=A(this,kt,yn).call(this,t(this,Gt));if(s&&t(this,Tt)!==null){const u=t(this,xe)-mt,g=-(t(this,jt)-mt);e=Math.max(g,Math.min(e,u))}const i=Math.max(mt,t(this,jt)+e),r=t(this,Gt).getBoundingClientRect();let o=n-r.left;if(s&&t(this,Tt)!==null){const u=t(this,oi)+(t(this,xe)-mt);o=Math.min(o,u)}const l=Math.max(mt,o);t(this,Ct)&&(t(this,Ct).style.setProperty("--tooltip-left",`${t(this,li)}px`),t(this,Ct).style.setProperty("--tooltip-width",`${l}px`));const a=(c=t(this,_e))==null?void 0:c.querySelector(".size-badge");a&&(a.textContent=`${Math.round(i)}px`)},"#updatePositions"),hi=new WeakMap,hr=new WeakMap,di=new WeakMap,h(Lo,"ColResizer");let $n=Lo;const Ro=class Ro{constructor(n){d(this,st);d(this,K);d(this,P);d(this,et);d(this,we,!1);d(this,ie,null);d(this,re,null);d(this,Ft,null);d(this,ui,0);d(this,Ue,null);d(this,fi,h(n=>{if(!A(this,st,Il).call(this)||!n.target.closest(".ng-sheet-header"))return;const s=n.target.closest("th, td");if(!s||s.classList.contains("resizable-edge")||["INPUT","BUTTON"].includes(n.target.tagName)||s.dataset.col===void 0)return;n.preventDefault();const i=n.clientX,r=n.clientY,o=h(()=>{t(this,Ue)&&(clearTimeout(t(this,Ue)),p(this,Ue,null)),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o)},"cancelTimer"),l=h(a=>{Math.hypot(a.clientX-i,a.clientY-r)>5&&o()},"onPointerMovePending");p(this,Ue,setTimeout(()=>{o(),A(this,st,Hl).call(this,n,s)},500)),window.addEventListener("pointermove",l),window.addEventListener("pointerup",o,{once:!0}),window.addEventListener("pointercancel",o,{once:!0})},"#onPointerDown"));d(this,gi,h(n=>{var i,r;if(!t(this,we))return;A(this,st,gl).call(this,n.clientX),t(this,P)&&(t(this,P).style.pointerEvents="none"),t(this,et)&&(t(this,et).style.pointerEvents="none");const e=A(this,st,ql).call(this,n.clientX,n.clientY),s=e==null?void 0:e.closest(".ng-sheet-header th, .ng-sheet-header td");if(s&&s.dataset.col!==void 0){const o=parseInt(s.dataset.col,10),l=t(this,K).getBoundingClientRect(),a=s.closest("table");let c=1/0,u=-1/0;if(a&&a.querySelectorAll("thead th, thead td").forEach(z=>{if(z.dataset.col===void 0)return;const tt=parseInt(z.dataset.col,10),St=z.colSpan||1,V=tt+St-1;if(tt<=o&&V>=o){const $s=z.getBoundingClientRect();c=Math.min(c,$s.left),u=Math.max(u,$s.right)}}),c===1/0){const z=s.getBoundingClientRect();c=z.left,u=z.right}const g=c+(u-c)/2;let f=0,b=0;if(n.clientX<g)f=o,b=c-l.left;else{const z=s.colSpan||1;f=o+z,b=u-l.left}const m=A(this,st,xn).call(this,t(this,ie)),y=m.colSpan,x=m.rowIndex,w=t(this,ie).rowSpan||1,S=x+w-1,R=((i=s.closest("tr"))==null?void 0:i.sectionRowIndex)??0,C=s.rowSpan||1,W=R+C-1,T=!(S<R||x>W);let D=!1;if(m.parentGroupRange){const{startCol:z,endCol:tt}=m.parentGroupRange;(f<z||f+y-1>tt)&&(D=!0)}let _=!1;if(a){const z=a.querySelectorAll("thead th[colspan], thead td[colspan]");for(const tt of z){if(tt===t(this,ie))continue;const St=((r=tt.closest("tr"))==null?void 0:r.sectionRowIndex)??0,V=tt.rowSpan||1,$s=St+V-1;if(!!(S<St||x>$s))continue;const Te=parseInt(tt.dataset.col,10),mn=tt.colSpan||1,ke=Te+mn-1;if(f>Te&&f<ke+1){_=!0;break}const rl=f+y-1;if(f>Te&&f<=ke&&rl>ke||f<Te&&rl>=Te&&rl<ke){_=!0;break}}}const rt=f>=m.startCol&&f<=m.endCol+1;if(!T||rt||D||_||!m.isValidGroup)p(this,Ft,null),t(this,et)&&(t(this,et).style.display="none"),t(this,P)&&t(this,P).classList.add("invalid");else if(p(this,Ft,f),t(this,P)&&t(this,P).classList.remove("invalid"),t(this,et)){const St=s.closest(".ng-sheet-header").getBoundingClientRect().top-l.top,V=l.height-St;t(this,et).style.top=`${St}px`,t(this,et).style.height=`${V}px`,t(this,et).style.left=`${b-1}px`,t(this,et).style.display="block"}}else t(this,et)&&(t(this,et).style.display="none"),t(this,P)&&t(this,P).classList.add("invalid"),p(this,Ft,null)},"#onPointerMove"));d(this,dr,h(n=>{t(this,we)&&(window.removeEventListener("pointermove",t(this,gi)),document.body.style.cursor="",t(this,P)&&(t(this,P).style.display="none",t(this,P).replaceChildren()),t(this,et)&&(t(this,et).style.display="none"),t(this,Ft)!==null&&t(this,re)!==null&&t(this,Ft)!==t(this,re)&&t(this,Ft)!==t(this,re)+1&&this.moveColumn(t(this,re),t(this,Ft)),p(this,we,!1),p(this,ie,null),p(this,re,null),p(this,Ft,null))},"#onPointerUp"));p(this,K,n),p(this,P,t(this,K).querySelector(".ng-col-mover-grip")),p(this,et,t(this,K).querySelector(".ng-col-mover-indi")),this.bindEvents()}bindEvents(){t(this,K).addEventListener("pointerdown",t(this,fi))}moveColumn(n,e){v.log(t(this,K).sourceTable.cloneNode(!0));const s=t(this,K).sourceTable.querySelector("colgroup"),i=s.querySelector(`col[data-col="${e}"]`),r=A(this,st,xn).call(this,t(this,ie));if(!r||!r.isValidGroup)return;const o=r.colSpan,l=h(u=>u>=n&&u<n+o,"isInRange"),a=t(this,K).querySelector(`.ng-sheet-body-content col[data-col="${e}"]`),c=a!=null&&a.closest(".ng-container-left")?"left":a!=null&&a.closest(".ng-container-right")?"right":null;s.querySelectorAll("col").forEach(u=>{l(parseInt(u.getAttribute("data-col"),10))&&(c?u.setAttribute("fixed",c):u.removeAttribute("fixed"),s.insertBefore(u,i))}),["thead","tbody","tfoot"].forEach(u=>{t(this,K).sourceTable.querySelectorAll(`${u} tr`).forEach(g=>{const f=Array.from(g.children),b=f.find(m=>parseInt(m.dataset.col,10)>=e);f.forEach(m=>{l(parseInt(m.dataset.col,10))&&g.insertBefore(m,b||null)})})}),t(this,K).recompileAndRefresh()}destroy(){t(this,K).removeEventListener("pointerdown",t(this,fi))}};K=new WeakMap,P=new WeakMap,et=new WeakMap,we=new WeakMap,ie=new WeakMap,re=new WeakMap,Ft=new WeakMap,ui=new WeakMap,Ue=new WeakMap,st=new WeakSet,Il=h(function(){var e;const n=(e=t(this,K).getRootNode())==null?void 0:e.host;return t(this,K).getAttribute("col-movable")==="true"||(n==null?void 0:n.getAttribute("col-movable"))==="true"},"#checkIsMovable"),ql=h(function(n,e){const s=t(this,K).getRootNode();let i=s.elementFromPoint?s.elementFromPoint(n,e):document.elementFromPoint(n,e);for(;i&&i.shadowRoot&&i.shadowRoot.elementFromPoint;){const r=i.shadowRoot.elementFromPoint(n,e);if(!r||r===i)break;i=r}return i},"#getDeepElementFromPoint"),xn=h(function(n){var f,b;if(!n||n.dataset.col===void 0)return null;const e=parseInt(n.dataset.col,10),s=n.colSpan||1,i=e+s-1,r=((f=n.closest("tr"))==null?void 0:f.sectionRowIndex)??0,o=n.closest("table");if(!o)return{startCol:e,colSpan:s,endCol:i,rowIndex:r,isGroup:!1,parentGroupRange:null,isValidGroup:!0};const l=o.querySelectorAll("thead th, thead td");let a=!1,c=!0,u=null;for(const m of l){if(m===n||m.dataset.col===void 0)continue;const y=parseInt(m.dataset.col,10),x=m.colSpan||1,w=y+x-1;(((b=m.closest("tr"))==null?void 0:b.sectionRowIndex)??0)<r&&y<=e&&w>=i&&x>s&&(u?(u.startCol=Math.max(u.startCol,y),u.endCol=Math.min(u.endCol,w)):u={startCol:y,endCol:w}),!(w<e||y>i)&&(y>=e&&w<=i?x<s&&(a=!0):(y<e||w>i)&&(y<=e&&w>=i||(c=!1)))}const g=a&&c;return{startCol:e,colSpan:g?s:1,endCol:g?i:e,rowIndex:r,isGroup:g,parentGroupRange:u,isValidGroup:c}},"#getColGroupRange"),Ml=h(function(n){const e=A(this,st,xn).call(this,n);if(!e)return null;const{startCol:s,endCol:i,isGroup:r}=e,o=n.closest("table");if(!o)return null;let l=1/0,a=-1/0,c=1/0,u=-1/0;const g=[];if(o.querySelectorAll("thead th, thead td").forEach(y=>{if(y.dataset.col===void 0)return;const x=parseInt(y.dataset.col,10),w=y.colSpan||1,S=x+w-1;if(r?x>=s&&S<=i:y===n){const C=y.getBoundingClientRect();l=Math.min(l,C.left),a=Math.max(a,C.right),c=Math.min(c,C.top),u=Math.max(u,C.bottom);const W=window.getComputedStyle(y);g.push({el:y,rect:C,style:W})}}),g.length===0)return null;const f=a-l,b=u-c,m=document.createElement("div");return m.className="grip-header-content",m.style.position="relative",m.style.width=`${f}px`,m.style.height=`${b}px`,g.forEach(({el:y,rect:x,style:w})=>{const S=y.cloneNode(!0);S.style.position="absolute",S.style.left=`${x.left-l}px`,S.style.top=`${x.top-c}px`,S.style.width=`${x.width}px`,S.style.minWidth=`${x.width}px`,S.style.maxWidth="none",S.style.height=`${x.height}px`,S.style.boxSizing="border-box",S.style.margin="0",S.style.backgroundColor=w.backgroundColor!=="transparent"&&w.backgroundColor!=="rgba(0, 0, 0, 0)"?w.backgroundColor:"#f9fafb",S.style.color=w.color,S.style.font=w.font,S.style.fontWeight=w.fontWeight,S.style.fontSize=w.fontSize,S.style.textAlign=w.textAlign,S.style.padding=w.padding,S.style.border=w.border,S.style.borderRight=w.borderRight,S.style.borderBottom=w.borderBottom,S.style.display="flex",S.style.alignItems="center",S.style.justifyContent=w.textAlign==="center"?"center":w.textAlign==="right"?"flex-end":"flex-start",m.appendChild(S)}),{element:m,bounds:{left:l,right:a,top:c,bottom:u,width:f,height:b}}},"#createGroupHeaderPreview"),fi=new WeakMap,Hl=h(function(n,e){if(t(this,we))return;const s=A(this,st,Ml).call(this,e);if(!s)return;p(this,we,!0),p(this,ie,e),p(this,re,parseInt(e.dataset.col,10));const i=t(this,K).getBoundingClientRect(),{bounds:r,element:o}=s;if(p(this,ui,n.clientX-r.left),t(this,P)){t(this,P).replaceChildren(o);const l=r.top-i.top,a=i.height-l;t(this,P).style.width=`${r.width}px`,t(this,P).style.height=`${a}px`,t(this,P).style.top=`${l}px`,t(this,P).style.display="block",A(this,st,gl).call(this,n.clientX)}document.body.style.cursor="move",window.addEventListener("pointermove",t(this,gi)),window.addEventListener("pointerup",t(this,dr),{once:!0})},"#startDrag"),gi=new WeakMap,gl=h(function(n){if(!t(this,P))return;const e=t(this,K).getBoundingClientRect(),s=n-e.left-t(this,ui);t(this,P).style.left=`${s}px`},"#updateGripPosition"),dr=new WeakMap,h(Ro,"ColMover");let Fn=Ro;const Co=class Co{constructor(n){d(this,ve);p(this,ve,n)}getFixState(n,e){if(!n||!e)return"none";const s=n.closest(".ng-container-left, .ng-container-right, .ng-container-body");if(s!=null&&s.classList.contains("ng-container-left"))return"left";if(s!=null&&s.classList.contains("ng-container-right"))return"right";const i=parseInt(n.dataset.col,10);if(!isNaN(i)){const r=e.querySelector(`colgroup col[data-col="${i}"]`),o=r==null?void 0:r.getAttribute("fixed");if(o)return o}return"none"}canFixColumn(n,e){if(!n||n.tagName!=="TH"||!e)return!1;const s=parseInt(n.dataset.col,10),i=n.colSpan||1;if(isNaN(s))return!1;const r=s+i-1,o=Array.from(e.querySelectorAll("thead tr"));if(o.length<=1)return!0;for(const l of o){const a=Array.from(l.querySelectorAll("th, td"));let c=!1;for(const u of a){const g=parseInt(u.dataset.col,10),f=u.colSpan||1,b=g+f-1;if(g<=r&&r<b)return!1;if(b===r){c=!0;break}}if(!c)return!1}return!0}executeFixToggle(n,e,s="left"){var u,g;if(!t(this,ve)||!e)return;const i=t(this,ve).sourceTable;if(!i)return;const r=parseInt(e.dataset.col,10),o=e.colSpan||1,l=r+o-1;if(isNaN(l))return;const a=i.querySelector("colgroup");if(!a)return;const c=Array.from(a.querySelectorAll("col"));if(n==="fix-column")c.forEach(f=>{parseInt(f.getAttribute("data-col"),10)<=l&&f.setAttribute("fixed",s)}),["thead","tbody","tfoot"].forEach(f=>{i.querySelectorAll(`${f} tr`).forEach(b=>{Array.from(b.children).forEach(m=>{const y=parseInt(m.dataset.col,10);!isNaN(y)&&y<=l&&m.setAttribute("fixed",s)})})});else if(n==="unfix-column"){let f=r;["thead","tbody","tfoot"].forEach(m=>{i.querySelectorAll(`${m} tr`).forEach((y,x)=>{Array.from(y.children).forEach(w=>{const S=parseInt(w.dataset.col,10),R=w.colSpan||1,C=S+R-1,W=w.rowSpan||1,T=y.sectionRowIndex??x;T+W-1<w.closest("tr").sectionRowIndex||T>w.closest("tr").sectionRowIndex+W-1,!(C<r||S>l)&&(f=Math.min(f,S))})})}),c.forEach(m=>{parseInt(m.getAttribute("data-col"),10)>=f&&m.removeAttribute("fixed")});let b=!1;c.forEach(m=>{b?m.removeAttribute("fixed"):m.getAttribute("fixed")||(b=!0)}),["thead","tbody","tfoot"].forEach(m=>{i.querySelectorAll(`${m} tr`).forEach(y=>{Array.from(y.children).forEach(x=>{const w=parseInt(x.dataset.col,10);if(isNaN(w))return;const S=c.find(C=>parseInt(C.getAttribute("data-col"),10)===w),R=S==null?void 0:S.getAttribute("fixed");R?x.setAttribute("fixed",R):x.removeAttribute("fixed")})})})}v.log(t(this,ve).sourceTable),(g=(u=t(this,ve)).recompileAndRefresh)==null||g.call(u)}};ve=new WeakMap,h(Co,"ColFixManager");let Pi=Co;const ko=class ko extends HTMLElement{constructor(){super(...arguments);d(this,pr);d(this,Wt);d(this,ne);d(this,bt);d(this,oe);d(this,Kt);E(this,"currentCol",null);d(this,ur,h(()=>{t(this,fr).call(this),p(this,Wt,this.closest("nine-table-sheet")),p(this,ne,this.getRootNode().host),p(this,bt,this.querySelector("nine-table-simple")),v.log("1***********************",t(this,bt)),setTimeout(()=>{p(this,oe,t(this,bt).shadowRoot.querySelector("nine-table-sheet")),v.log("2***********************",t(this,oe))}),this.querySelector(".search-box").addEventListener("focusin",e=>{e.stopPropagation()}),this.querySelector(".search-box").addEventListener("input",t(this,mr)),this.querySelector("#chkSelectAll").addEventListener("change",t(this,yr)),this.querySelector("#btnOk").addEventListener("click",t(this,br))},"#init"));d(this,fr,h(()=>{this.innerHTML=`
|
|
150
150
|
<style>
|
|
151
151
|
nine-table-filter-panel nine-table-simple {
|
|
152
152
|
width: 100%;
|
|
@@ -243,614 +243,7 @@
|
|
|
243
243
|
</div>
|
|
244
244
|
</div>
|
|
245
245
|
</div>
|
|
246
|
-
`},"#renderer"));d(this,gn,h(e=>{const s=e.composedPath?e.composedPath():[];s.includes(this)||t(this,Kt)&&s.includes(t(this,Kt))||this.close()},"#closeHandler"));d(this,mn,h(()=>{var l;t(this,re).loading=!0;const e=t(this,oe).view.getArray(),s=t(this,bt).data.getHostFields(),i=e.filter(a=>{const c=a.v[s.indexOf("CHK")];return c==="Y"||c===!0}),n={...((l=t(this,Ft).filtering)==null?void 0:l.filters)||{}};t(this,Kt).columns.forEach(a=>{const c=a.expr||a.bind,u=a.expr?s.indexOf("DATA2"):s.indexOf("DATA"),p=i.map(f=>f.v[u]);p.length>0?n[c]=p:delete n[c]});const o=t(this,bt).data.count();setTimeout(()=>{try{o===i.length?t(this,Kt).columns.forEach(a=>{const c=a.expr||a.bind;c&&t(this,Ft).filtering.clear(c)}):t(this,Ft).filtering.set(n),t(this,Ft).querySelectorAll("nine-table-filter-button").forEach(a=>{a.updateFilteredState()}),t(this,Ft).invalidate(),this.close()}finally{t(this,re).loading=!1}})},"#onOk"));d(this,yn,h(e=>{const s=e.target.value.toLowerCase().trim();if(!s)t(this,oe).filtering.clear();else{const i=t(this,bt).data.getArray(),o=t(this,bt).data.getHostFields().indexOf("DATA2"),l=[];i.forEach(a=>{const c=o>=0&&a.v?a.v[o]:"";String(c).replace(/<[^>]*>?/gm,"").toLowerCase().includes(s)&&l.push(c)}),v.log(l),t(this,oe).filtering.set({DATA2:[...new Set(l)]})}},"#onInput"));d(this,xn,h(e=>{var l,a;const s=e.target.checked,i=((a=(l=t(this,bt))==null?void 0:l.data)==null?void 0:a.getArray())||[],o=t(this,bt).data.getHostFields().indexOf("CHK");o>=0&&i.forEach(c=>{c.v[o]=s?"Y":"N"}),t(this,bt).refresh()},"#onSelectAll"));d(this,ko,h(()=>{this.close()},"#onCancel"))}connectedCallback(){t(this,fn).call(this),document.addEventListener("mousedown",t(this,gn))}open(e){g(this,Kt,e);const s=e.closest("th, td");this.currentCol=s==null?void 0:s.dataset.col;const i=s.getBoundingClientRect(),n=t(this,Ft).getBoundingClientRect(),o=this.offsetWidth||240;let l=i.right-n.left-o,a=i.bottom-n.top;l<0&&(l=Math.max(0,i.left-n.left)),this.style.left=`${l}px`,this.style.top=`${a}px`;const c=this.querySelector(".search-box");c.value="",this.classList.add("active"),this.classList.add("loading"),setTimeout(()=>{try{A(this,bn,Nl).call(this),t(this,oe).rowManager.scrollToDataRow(0)}finally{this.classList.remove("loading")}})}close(){this.currentCol=null,this.classList.remove("active"),g(this,Kt,null)}};Ft=new WeakMap,re=new WeakMap,bt=new WeakMap,oe=new WeakMap,Kt=new WeakMap,fn=new WeakMap,pn=new WeakMap,gn=new WeakMap,bn=new WeakSet,Nl=h(function(){var c,u;const e=t(this,re).data.getArray(),s=((c=t(this,Kt))==null?void 0:c.columns)||[],i=t(this,re).fields.get()||[],n=((u=t(this,Ft).filtering)==null?void 0:u.filters)||{},o=t(this,re).exprEngine,l=s.flatMap(p=>{const f=p.bind,b=p.expr,m=f||b,y=f?i.indexOf(f):-1,x=n[m]||[],w=new Map;for(let R=0;R<e.length;R++){const C=e[R];if(!C)continue;let F;y>=0&&C.v?F=C.v[y]:f&&f.includes("data.")?F=o?o.evaluate(f,C,R):void 0:b&&o&&(F=o.evaluate(b,C,R));let k=F;b&&o&&(k=o.evaluate(b,C,R)),k!=null&&!w.has(k)&&w.set(k,{v:F,v2:k})}const S=[...w.values()];return S.sort((R,C)=>String(R.v2||"").localeCompare(String(C.v2||""))),x.sort((R,C)=>R>C?1:-1),S.map(R=>({LVL:2,DATA:R.v,DATA2:R.v2===""||R.v2===null||R.v2===void 0?'<span class="empty-value">(empty)</span>':R.v2,COLNM:m,CHK:x.length===0||x.nineBinarySearch(R.v||"")>=0?"Y":"N"}))});t(this,bt).data.set(l);const a=this.querySelector("#chkSelectAll");a&&(a.checked=l.length>0&&l.every(p=>p.CHK==="Y"))},"#loadVirtualFilterItems"),mn=new WeakMap,yn=new WeakMap,xn=new WeakMap,ko=new WeakMap,h(To,"NineTableFilterPanel");let Fr=To;const Io=class Io extends HTMLElement{constructor(){super(...arguments);d(this,Ue);d(this,je,null);E(this,"updateFilteredState",h(()=>{var i;const e=((i=t(this,Ue).filtering)==null?void 0:i.filters)||{},s=this.columns.some(n=>{const o=n.expr||n.bind;return o&&e[o]&&e[o].length>0});this.classList.toggle("filtered",s)},"updateFilteredState"));d(this,gi,h(e=>{e.preventDefault(),e.stopPropagation();const s=t(this,Ue).querySelector("nine-table-filter-panel"),i=this.closest("th, td"),n=i==null?void 0:i.dataset.col;s&&s.currentCol===n&&s.classList.contains("active")?s.close():s&&s.open(this)},"#onClick"))}connectedCallback(){g(this,Ue,this.closest("nine-table-sheet")||this.getRootNode().host),this.removeEventListener("click",t(this,gi)),this.addEventListener("click",t(this,gi))}get columns(){if(t(this,je))return t(this,je);const e=this.closest("th, td"),s=e==null?void 0:e.dataset.col,i=t(this,Ue).sourceTable,n=[],o=new Set;return i&&s!==void 0&&i.querySelectorAll(`tbody [data-col="${s}"]`).forEach(l=>{const a=l.dataset.bind,c=l.dataset.expr;if(a||c){const u=`${a||""}_${c||""}`;o.has(u)||(o.add(u),n.push({bind:a,expr:c}))}}),g(this,je,n),t(this,je)}};Ue=new WeakMap,je=new WeakMap,gi=new WeakMap,h(Io,"NineTableFilterButton");let Wr=Io;const qo=class qo{constructor(r){d(this,bi);d(this,It);d(this,Se);d(this,Ke,!1);d(this,wn,null);d(this,Yt,{});d(this,vn,h(()=>{t(this,Sn).call(this)},"#init"));d(this,Sn,h(()=>{if(t(this,Se).tagName.toLowerCase()==="nine-table-simple")return;let r=t(this,It).querySelector("nine-table-filter-panel");r||(r=document.createElement("nine-table-filter-panel"),t(this,It).appendChild(r)),g(this,wn,r)},"#initFilterPanel"));E(this,"clear",h(r=>{r?delete t(this,Yt)[r]:g(this,Yt,{}),g(this,Ke,Object.keys(t(this,Yt)).length>0),A(this,bi,gl).call(this),t(this,It).querySelectorAll("nine-table-filter-button").forEach(e=>{e.updateFilteredState()}),v.log(`🔄 [NineTableFiltering] Filter cleared for ${r||"all"}`)},"clear"));E(this,"set",h(r=>{v.log(r);let e=Array.isArray(r)?Object.fromEntries(Object.keys(r[0]).map(s=>[s,[...new Set(r.map(i=>i[s]))]])):r;g(this,Yt,e),g(this,Ke,Object.keys(e).length>0),t(this,It).toggleAttribute("filtering",t(this,Ke)),A(this,bi,gl).call(this)},"set"));g(this,It,r),g(this,Se,t(this,It).getRootNode().host),t(this,vn).call(this)}get filters(){return t(this,Yt)}isFiltering(){return t(this,Ke)}};It=new WeakMap,Se=new WeakMap,Ke=new WeakMap,wn=new WeakMap,Yt=new WeakMap,vn=new WeakMap,Sn=new WeakMap,bi=new WeakSet,gl=h(function(){const e=t(this,Se).data.getArray(),s=t(this,Se).data.getHostFields(),i=t(this,It).index,n=t(this,Se).exprEngine;if(!(Object.keys(t(this,Yt)).length>0)){e.forEach(a=>{var c,u;(u=(c=a==null?void 0:a.m)==null?void 0:c._)!=null&&u[Dt.META.INDEX.FILTER]&&(a.m._[Dt.META.INDEX.FILTER][i]=!0)}),t(this,It).invalidate();return}const l=Object.entries(t(this,Yt)).map(([a,c])=>{const u=a.includes("data.")||a.includes("host.")||a.includes("rowItem.v");return{targetKey:a,isExpr:u,fieldIdx:u?-1:s.indexOf(a),allowedSet:new Set(c)}});e.forEach((a,c)=>{if(!a)return;a.m._[Dt.META.INDEX.FILTER]||(a.m._[Dt.META.INDEX.FILTER]=[]);let u=!0;for(let p=0;p<l.length;p++){const{targetKey:f,isExpr:b,fieldIdx:m,allowedSet:y}=l[p];let x;if(b&&n?x=n.evaluate(f,a,c):m>=0&&a.v&&(x=a.v[m]),!y.has(x)){u=!1;break}}a.m._[Dt.META.INDEX.FILTER][i]=u}),t(this,It).invalidate()},"#applyFiltering"),h(qo,"Filtering");let Or=qo;customElements.get("nine-table-filter-panel")||customElements.define("nine-table-filter-panel",Fr),customElements.get("nine-table-filter-button")||customElements.define("nine-table-filter-button",Wr);const Mo=class Mo{constructor(r){d(this,Wt);d(this,ct);d(this,mi);d(this,ht,[]);g(this,ct,r),g(this,mi,r.getRootNode().host),setTimeout(()=>{A(this,Wt,Dl).call(this)},300)}restore(){var r;g(this,ht,[]),t(this,ct).view&&t(this,ct).view.resetSorting(),A(this,Wt,bl).call(this),(r=t(this,ct).rowManager)==null||r.refresh(!0)}};ct=new WeakMap,mi=new WeakMap,ht=new WeakMap,Wt=new WeakSet,Dl=h(function(){t(this,ct).querySelectorAll("thead").forEach(r=>{r.addEventListener("dblclick",e=>{const s=e.target.closest("th, td");if(!s||s.classList.contains("resizable-edge")||["INPUT","CELL-CHECKBOX"].includes(e.target.tagName)||e.offsetX<=2||e.offsetX>=s.offsetWidth-2)return;const i=t(this,ct).getRootNode().host;i.loading=!0,setTimeout(()=>{try{A(this,Wt,$l).call(this,e,s)}finally{i.loading=!1}})})}),v.log("🎯 [NineTableSorting] Initialized")},"#initEvents"),$l=h(function(r,e){const s=e.dataset.col,i=e.closest("tr"),n=i?i.dataset.subrow||String(i.sectionRowIndex):"0";if(s===void 0)return;const o=t(this,ct).sourceTable;if(!o)return;let l=null,a=null;if(o.querySelectorAll(`tbody [data-col="${s}"]`).forEach(b=>{b.dataset.bind&&(l=b.dataset.bind),b.dataset.expr&&(a=b.dataset.expr)}),!l&&!a)return;const c=e.classList.contains("asc"),u=e.classList.contains("desc");!r.ctrlKey&&!r.shiftKey&&g(this,ht,[]);const p=t(this,ht).findIndex(b=>b.colIndex===s&&b.subRowIndex===n||b.colName===l),f={colIndex:s,subRowIndex:n,colname:l||a,colName:l||a,expr:a,asc:!0,"expr-func":a?(b,m)=>t(this,mi).exprEngine(a,b,m):null};!c&&!u?p>=0?t(this,ht)[p].asc=!0:t(this,ht).push({...f,asc:!0}):c?p>=0?t(this,ht)[p].asc=!1:t(this,ht).push({...f,asc:!1}):g(this,ht,t(this,ht).filter(b=>!(b.colIndex===s&&b.subRowIndex===n||b.colName===l))),A(this,Wt,zl).call(this)},"#handleSort"),zl=h(function(){if(!t(this,ct).view){console.warn("⚠️ [NineTableSorting] Sheet view (SheetView) is not initialized.");return}t(this,ct).view.setSorting(t(this,ht)),A(this,Wt,bl).call(this),t(this,ct).invalidate(),v.log("🔄 [NineTableSorting] Sorting applied via RowManager.refresh(true)")},"#applySorting"),bl=h(function(){t(this,ct).querySelectorAll("thead th, thead td").forEach(r=>{r.classList.remove("asc","desc")}),t(this,ht).length!==0&&t(this,ht).forEach(r=>{const{colIndex:e,subRowIndex:s,asc:i}=r;if(e!==void 0){let n=`thead [data-col="${e}"]`;s!==void 0&&(n=`thead tr[data-subrow="${s}"] [data-col="${e}"]`),t(this,ct).querySelectorAll(n).forEach(l=>{l.classList.add(i?"asc":"desc")})}})},"#syncHeaderUI"),h(Mo,"Sorting");let Br=Mo;const No=class No{constructor(r){d(this,Ye);d(this,yt);d(this,Ae,[]);d(this,Ho,[]);d(this,yi,[]);d(this,le,null);E(this,"getArray",h((r,e)=>{if(!t(this,le)){const n=t(this,yt).data.getArray();g(this,le,t(this,yi).map(o=>n[o]))}const s=t(this,le);if(r==null)return s;if(r<0||r>=s.length)return null;const i=s[r];if(e!=null){const o=t(this,yt).data.getHostFields().indexOf(e);return o>=0&&i.v?i.v[o]:null}return i},"getArray"));E(this,"get",h((r,e)=>{var o,l;const s=this.getArray(),i=((l=(o=t(this,yt).data).getHostFields)==null?void 0:l.call(o))||[];if(r==null)return s.map(a=>t(this,xi).call(this,a,i));if(r<0||r>=s.length)return null;const n=s[r];if(!n)return null;if(e!=null){const a=i.indexOf(e);return a>=0&&n.v?n.v[a]:null}return t(this,xi).call(this,n,i)},"get"));d(this,xi,h((r,e)=>{if(!r)return null;const s={};return e.forEach((i,n)=>{s[i]=r.v?r.v[n]:r[i]}),r.m&&(s.m=r.m),r._&&(s._=r._),s},"#convSingle"));E(this,"refresh",h(()=>{var n;g(this,le,null);const r=t(this,yt).data.getArray();let e=[];r.forEach((o,l)=>{var c,u;if(!o)return;const a=(u=(c=o.m)==null?void 0:c._)==null?void 0:u[Dt.META.INDEX.FILTER];a&&a[t(this,Ye).index]===!1||e.push(l)}),v.log(e),t(this,Ae).length>0&&(e=t(this,An).call(this,e,r)),g(this,yi,e);const s=e.map(o=>r[o]),i=((n=t(this,Ye).grouping)==null?void 0:n.columns)||[];if(i.length>0){const o=Mr.apply(s,i,t(this,yt).data.getHostFields());g(this,le,o.renderItems),t(this,Ye).grouping.setGroupMap(o.groupMap)}else g(this,le,s)},"refresh"));E(this,"setSorting",h(r=>{g(this,Ae,r||[]),this.refresh()},"setSorting"));E(this,"getSorting",h(()=>t(this,Ae),"getSorting"));E(this,"resetSorting",h(()=>{g(this,Ae,[]),this.refresh()},"resetSorting"));d(this,An,h((r,e)=>{v.log(new Date);const s=typeof t(this,yt).data.getHostFields=="function"?t(this,yt).data.getHostFields():[],i=t(this,Ae).map(n=>({...n,colIndex:s.indexOf(n.colname||n.colName)}));return r.sort((n,o)=>{const l=e[n],a=e[o];for(const c of i){const u=c.asc,p=c.expr;let f,b;p?(f=t(this,yt).exprEngine.evaluate(p,l,n),b=t(this,yt).exprEngine.evaluate(p,a,o)):c.colIndex>=0&&l.v&&a.v&&(f=l.v[c.colIndex],b=a.v[c.colIndex]);const m=f==null||f==="",y=b==null||b==="";if(!(m&&y)){if(m)return 1;if(y)return-1;if(f!==b){let x=0;if(typeof f=="number"&&typeof b=="number")x=f-b;else{const w=String(f),S=String(b);x=w>S?1:w<S?-1:0}if(x!==0)return u?x:-x}}}return n-o})},"#applySorting"));g(this,Ye,r),g(this,yt,r.getRootNode().host),this.refresh()}};Ye=new WeakMap,yt=new WeakMap,Ae=new WeakMap,Ho=new WeakMap,yi=new WeakMap,le=new WeakMap,xi=new WeakMap,An=new WeakMap,h(No,"SheetView");let Pi=No;const Vr=16,rt=class rt{static initializeTable(r,e){var s,i,n,o,l,a,c,u,p,f,b;return!r||!e?null:(A(s=rt,W,Bl).call(s,e),A(i=rt,W,Pl).call(i,e),A(n=rt,W,Ol).call(n,e),A(o=rt,W,jl).call(o,e),A(l=rt,W,Vl).call(l,e),fe.resetColIndex(e,e.querySelectorAll("thead tr")),fe.resetColIndex(e,e.querySelectorAll('tbody.body tr[grouping="true"]')),fe.resetColIndex(e,e.querySelectorAll('tbody.body tr:not([grouping="true"])')),fe.resetColIndex(e,e.querySelectorAll("tfoot tr")),A(a=rt,W,Fl).call(a,e),A(c=rt,W,Xl).call(c,e),A(u=rt,W,_l).call(u,r,e),A(p=rt,W,Ul).call(p,e),A(f=rt,W,Gl).call(f,r,e),A(b=rt,W,Kl).call(b,e),e)}};W=new WeakSet,Fl=h(function(r){const e=r.querySelector("thead");if(!e||e.querySelector(".col-indicator-rowgroup"))return;const s='<th data-col="@col" class="col-indicator" scope="col"></th>',i=e.insertRow(0);i.setAttribute("role","row"),i.classList.add("col-indicator-rowgroup"),i.classList.add("collapse");const n=r.querySelector("tbody tr");if(!n)return;let o=0;n.querySelectorAll("th, td").forEach(a=>{var c;if(!a.classList.contains("dummy")){const u=a.colSpan||1;for(let p=0;p<u;p++){const f=s.replace("@col",o).replace("@text",A(c=rt,W,Wl).call(c,o++));i.insertAdjacentHTML("beforeend",f)}}});const l=Array.from(r.querySelectorAll("colgroup col"));i.querySelectorAll(".col-indicator").forEach((a,c)=>{const u=l[c].getAttribute("background");u&&(a.style.background=u)})},"#createColIndicator"),Wl=h(function(r){let e="";for(let s=r;s>=0;s=Math.floor(s/26)-1)e=String.fromCharCode(65+s%26)+e;return e},"#numToExcelCol"),Ol=h(function(r){let e=r.querySelector("tbody:not(.head):not(.foot)");if(e){if(e.classList.add("body"),!r.querySelector("tbody.head")){const s=document.createElement("tbody");s.classList.add("head"),e.before(s)}if(!r.querySelector("tbody.foot")){const s=document.createElement("tbody");s.classList.add("foot"),e.after(s)}}},"#ensureSectionTbodys"),Bl=h(function(r){let e=r.querySelector("colgroup");if(e||(e=document.createElement("colgroup"),r.prepend(e)),e.querySelectorAll("col").length===0){const s=r.querySelector("tbody tr");let i=1;s&&(i=Array.from(s.querySelectorAll("th, td")).reduce((n,o)=>n+(parseInt(o.getAttribute("colspan")||o.colSpan,10)||1),0)),i=Math.max(i,1);for(let n=0;n<i;n++){const o=document.createElement("col");e.appendChild(o)}}},"#ensureColgroup"),Vl=h(function(r){const e=Array.from(r.querySelectorAll("colgroup col"));if(e.length===0)return;const s=r.clientWidth||0,i=Math.max(Math.floor(s/e.length),100);e.forEach((n,o)=>{n.hasAttribute("data-col")||n.setAttribute("data-col",o);const l=n.getAttribute("width")||parseInt(n.style.width,10)||i;n.setAttribute("width",l);const a=String(l).includes("px")?l:`${l}px`;n.style.width=a})},"#normalizeColAttributes"),Pl=h(function(r){if(r.querySelector("thead"))return;const e=document.createElement("thead"),s=r.querySelector("colgroup");s?s.after(e):r.prepend(e)},"#ensureThead"),Xl=h(function(r){r.querySelectorAll("thead th, thead td").forEach(s=>{s.getAttribute("collapsed")==="true"&&s.getAttribute("collapsible")!=="true"&&s.setAttribute("collapsible","true")})},"#normalizeCollapsibleAttributes"),_l=h(function(r,e){const s=["data-bind","data-expr","type"];let i=0;e.querySelectorAll("tbody th, tbody td").forEach(n=>{const l=`cell-${n.getAttribute("cell-type")||"renderer"}`,a=n.querySelector("datalist");if(a){let p=[];a.querySelectorAll("option").forEach(b=>{p.push({k:b.getAttribute("k"),v:b.getAttribute("v")})});const f=`__ds_${Date.now()}_${++i}`;r&&(r[f]=()=>p),n.setAttribute("data-source",`host.${f}()`),a.remove()}const c=n.dataset.expr;c&&n.setAttribute("data-expr",r.exprEngine.precompile(c)),Array.from(n.attributes).forEach(p=>{["data-bind","data-expr","cell-type"].includes(p.name)||(p.value.includes("data.")||p.value.includes("host."))&&n.setAttribute(p.name,r.exprEngine.precompile(p.value))});const u=s.filter(p=>n.hasAttribute(p)).map(p=>`${p}="${n.getAttribute(p)}"`);n.innerHTML=`<${l} ${u.join(" ")}></${l}>`,n.setAttribute("tabindex","0")}),e.querySelectorAll("thead th, thead td, tfoot th, tfoot td").forEach(n=>{const o=n.getAttribute("cell-type");if(o){const l=n.innerHTML,a=`cell-${o}`,c=s.filter(u=>n.hasAttribute(u)).map(u=>`${u}="${n.getAttribute(u)}"`);n.innerHTML=`<${a} ${c.join(" ")} content="${l}"></${a}>`}})},"#generateCell"),Gl=h(function(r,e){const s=r.getAttribute("filtering")==="true",i=e.getAttribute("filtering")==="true";e.querySelectorAll("thead tr:not(.col-indicator-rowgroup) th, thead tr:not(.col-indicator-rowgroup) td").forEach(n=>{const o=n.getAttribute("filtering")==="true"||i||s;n.setAttribute("filtering",o?"true":"false"),o&&n.appendChild(document.createElement("nine-table-filter-button"))})},"#initFilterButtons"),Ul=h(function(r){r.querySelectorAll("thead th, thead td").forEach(e=>{if(!(e.getAttribute("collapsible")==="true"||e.getAttribute("expandable")==="true"))return;v.log("11.*******************************",e.dataset.col);const i=parseInt(e.dataset.col,10),n=e.colSpan||1,o=r.querySelector(`colgroup col[data-col="${i}"]`);v.log("11.*******************************",o);const l=o&&parseInt(o.getAttribute("width"),10)||100;(!e.dataset.expandWidth||parseInt(e.dataset.expandWidth,10)<=Vr)&&(e.dataset.expandWidth=String(l>Vr?l:100));let a=e.querySelector("nine-table-col-expand");if(a||(a=document.createElement("nine-table-col-expand"),e.insertBefore(a,e.firstChild)),e.getAttribute("collapsed")==="true"){a.classList.add("collapsed"),a.classList.remove("expand"),a.setAttribute("collapsed","true"),e.style.color="transparent";const u=Math.max(10,Math.floor(Vr/n));if(!isNaN(i))for(let p=0;p<n;p++){const f=r.querySelector(`colgroup col[data-col="${i+p}"]`);f&&(f.setAttribute("width",u),f.style.width=`${u}px`)}}else a.classList.remove("collapsed"),a.classList.add("expand"),a.setAttribute("collapsed","false"),e.style.color=""})},"#initColExpanders"),jl=h(function(r,e){const s=r.getAttribute("row-indicator")==="true"?48:0,i=r.querySelector("colgroup"),n=document.createElement("col");n.setAttribute("fixed","left"),n.setAttribute("width",s),n.style.width=`${s}px`,i.prepend(n),r.querySelectorAll("thead, tbody, tfoot").forEach(o=>{const l=Array.from(o.querySelectorAll("tr"));if(l.length===0)return;const a=l[0],c=document.createElement("th");c.className="row-indicator",c.setAttribute("cell-type","row-indicator"),l.length>1&&(c.rowSpan=l.length),a.insertBefore(c,a.firstElementChild)})},"#ensureRowIndicator"),Kl=h(function(r){r.querySelectorAll("th[data-col], td[data-col]").forEach(e=>{v.log(e);const s=parseInt(e.getAttribute("data-col"),10);if(isNaN(s))return;const i=parseInt(e.getAttribute("colspan")||e.colSpan,10)||1;let n=0;for(let o=0;o<i;o++){const l=s+o,a=r.querySelector(`colgroup col[data-col="${l}"]`);a&&(n+=parseInt(a.getAttribute("width"),10)||100)}if(n>0){const o=`${n}px`;e.style.width=o,e.style.minWidth=o,e.style.maxWidth=o}})},"#applyInitialCellWidths"),d(rt,W),h(rt,"PreCompiler");let Pr=rt;const Ci=class Ci extends HTMLElement{constructor(){super();d(this,Ln);d(this,wi);d(this,ae);d(this,Ot);d(this,vi);d(this,Si);d(this,Ee);d(this,xs);d(this,Ai);d(this,En);d(this,Ei);d(this,ws);d(this,Ze);d(this,qt,{table:null});d(this,Je);d(this,Rn,h(()=>{const e=this.querySelector(".ng-container-body thead"),s=this.querySelector(".ng-nodata-overlay");s.style.top=`${e.offsetHeight}px`},"#adjustOverlay"));E(this,"invalidate",h(()=>{this.view.refresh(),t(this,Ot).refresh(!0),this.isAutoFitCol&&this.autoFit(!0)},"invalidate"));E(this,"autoFit",h((e=!0)=>{requestAnimationFrame(()=>{var s;(s=t(this,Cn))==null||s.call(this,e)})},"autoFit"));d(this,Cn,h((e=!0)=>{var n;v.log("autoFit",this);const s=this.querySelector(".ng-sheet-body .ng-container-body");if(!s)return;s.querySelectorAll("table");const i=this.querySelector(".ng-sheet-header .ng-container-body table colgroup");if(i){if(e){this.setAttribute("auto-fit-col","true");const o=s.clientWidth;if(o<=0)return;let l=0;const a=[];i.querySelectorAll("col").forEach(p=>{const f=p.getAttribute("data-col"),b=this.querySelector(`.ng-sheet-header th[data-col="${f}"]`);if((b==null?void 0:b.getAttribute("collapsed"))==="true")a.unshift({globalColIndex:f,width:16,isCollapsed:!0}),v.log(`[AutoFit Col] Index ${f}: COLLAPSED (forced 16px)`);else{const y=parseInt(p.getAttribute("width"),10)||100;a.push({globalColIndex:f,width:y,isCollapsed:!1}),l+=y,v.log(`[AutoFit Col] Index ${f}: NORMAL (original width: ${y}px)`)}}),v.log(`[AutoFit] Total Original Width of Normal Cols: ${l}px`);const c=a.filter(p=>p.isCollapsed).reduce((p,f)=>p+f.width,0),u=Math.max(0,o-c);if(v.log(`[AutoFit] Collapsed Total Width: ${c}px | Available Width for Normal Cols: ${u}px`),l>0&&a.length>0){let p=0;const f=a.map(x=>{if(x.isCollapsed)return{globalColIndex:x.globalColIndex,remainder:0,width:16};const w=x.width*u/l,S=Math.max(30,Math.floor(w));return p+=S,{globalColIndex:x.globalColIndex,remainder:w-Math.floor(w),width:S}});let b=u-p;v.log(`[AutoFit] Initial Allocated Total: ${p}px | Remainder Pixels to distribute: ${b}`);const m=f.filter(x=>{var w;return!((w=a.find(S=>S.globalColIndex===x.globalColIndex))!=null&&w.isCollapsed)});if(b>0&&m.length>0){m.sort((x,w)=>w.remainder-x.remainder);for(let x=0;x<b;x++)m[x%m.length].width+=1}else if(b<0&&m.length>0){m.sort((x,w)=>x.remainder-w.remainder);for(let x=0;x<Math.abs(b);x++){const w=m[x%m.length];w.width>30&&(w.width-=1)}}const y=f.reduce((x,w)=>x+w.width,0);v.log(`[AutoFit Verification] Target Container Width: ${o}px | Sum of All Calculated Cols: ${y}px`),o!==y?v.log(`⚠️ [AutoFit Mismatch Warning!] 오차 발생: ${o-y}px 차이가 납니다.`):v.log("✅ [AutoFit Success] 완벽하게 일치합니다!"),f.forEach(({globalColIndex:x,width:w})=>{var S;v.log(`[AutoFit Apply] Col Index ${x} -> ${w}px`),(S=t(this,Ee))==null||S.setColumnWidth(x,w,"body")})}}else this.removeAttribute("auto-fit-col");(n=this.querySelector("nine-table-hscrollbar"))==null||n.refresh()}},"#autoFit"));E(this,"generate",h((e,s)=>{g(this,wi,s),Pr.initializeTable(t(this,ae),e),v.log("=======",e),g(this,qt,{table:fe.compile(e),tbody:{tr:e.querySelectorAll("tbody tr")}}),t(this,Li).call(this),t(this,Qe).call(this),t(this,qn).call(this),t(this,Mn).call(this),["left","body","right"].forEach(i=>{const n=`.ng-container-${i}`;t(this,Je)[i]={thead:this.querySelector(`${n} thead`),tbody:{head:this.querySelector(`${n} tbody.head`),body:this.querySelector(`${n} tbody.body`),foot:this.querySelector(`${n} tbody.foot`)},tfoot:this.querySelector(`${n} tfoot`)}}),t(this,Ot).initialize(),this.isAutoFitCol?this.autoFit(!0):this.querySelector("nine-table-hscrollbar").refresh(),t(this,ws).initialize(),this.loaded=!0},"generate"));d(this,Qe,h(()=>{this.isAutoFitCol,["left","right","body"].forEach(e=>{const s=this.querySelectorAll(`.ng-container-${e}`);if(s.length===0)return;const i=s[0].querySelector("table");if(!i)return;let n=0;i.querySelectorAll("col").forEach(o=>{const l=parseInt(o.getAttribute("width"),10);isNaN(l)||(n+=l)}),s.forEach(o=>{const l=o.querySelectorAll("table");e==="body"?(o.style.flex="1",l.forEach(a=>{})):(o.style.flex=`0 0 ${n}px`,o.style.width=`${n}px`,o.style.minWidth=`${n}px`,o.style.maxWidth=`${n}px`,l.forEach(a=>{}))})})},"#updateContainerWidths"));d(this,Li,h(()=>{[{selector:".ng-container-left",type:"left"},{selector:".ng-container-body",type:null},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:i})=>{this.querySelector(`.ng-sheet-body ${s}`).appendChild(t(this,kn).call(this,i))})},"#renderSplitContainers"));d(this,kn,h(e=>{const s=t(this,qt).table.cloneNode(!0);return e==="left"?s.querySelectorAll("col, th, td").forEach(i=>{i.getAttribute("fixed")!=="left"&&i.remove()}):e==="right"?s.querySelectorAll("col, th, td").forEach(i=>{i.getAttribute("fixed")!=="right"&&i.remove()}):s.querySelectorAll("[fixed=left], [fixed=right]").forEach(i=>{i.remove()}),s},"#createSplitTable"));E(this,"getRowHeight",h(()=>t(this,Ot).getRowHeight(),"getRowHeight"));E(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-sheet-body .ng-container-body");s&&(s.scrollLeft=e)},"scrollToX"));E(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-sheet-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Tn,h(()=>{v.log("11111*****************"),t(this,In).call(this),g(this,vi,new Nr(this)),g(this,Si,new Dr(this)),g(this,Ee,new $r(this)),g(this,xs,new zr(this)),g(this,Ai,new Vi(this)),g(this,Ze,new Pi(this)),g(this,Ei,new Or(this)),g(this,ws,new qr(this)),t(this,Ln,Yl)||g(this,En,new Br(this)),t(this,Je).mainBody.addEventListener("scroll",()=>{this.querySelector("nine-table-hscrollbar").refresh()})},"#init"));d(this,In,h(()=>{v.log("11111*****************");const e=Ci.SCROLLBAR_SIZE;v.log("2222*****************"),this.innerHTML=`
|
|
247
|
-
<style>
|
|
248
|
-
nine-table-sheet {
|
|
249
|
-
display: none;
|
|
250
|
-
grid-template-columns: 1fr 0px;
|
|
251
|
-
grid-template-rows: 1fr 0px;
|
|
252
|
-
width: 100%;
|
|
253
|
-
height: 100%;
|
|
254
|
-
position: relative;
|
|
255
|
-
box-sizing: border-box;
|
|
256
|
-
background: #ffffff;
|
|
257
|
-
overflow: hidden;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
nine-table-sheet .ng-sheet-body thead {
|
|
262
|
-
display: table-header-group;
|
|
263
|
-
position: sticky;
|
|
264
|
-
top: 0;
|
|
265
|
-
z-index: 10;
|
|
266
|
-
}
|
|
267
|
-
nine-table-sheet .ng-sheet-body tfoot {
|
|
268
|
-
display: table-footer-group;
|
|
269
|
-
position: sticky;
|
|
270
|
-
bottom: 0;
|
|
271
|
-
z-index: 10;
|
|
272
|
-
background: red;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
nine-table-sheet.active {
|
|
276
|
-
display: grid;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/* --- 세로 스크롤바가 활성화되었을 때만 CSS로 2열 너비 확장 및 요소 표시 --- */
|
|
280
|
-
nine-table-sheet.vscroll-visible {
|
|
281
|
-
grid-template-columns: 1fr ${e}px;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
nine-table-sheet.vscroll-visible nine-table-vscrollbar {
|
|
285
|
-
display: flex;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
nine-table-vscrollbar {
|
|
289
|
-
display: none; /* 평소에는 기본 숨김 */
|
|
290
|
-
border-top: 2px solid #333;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/* --- 가로 스크롤바가 활성화되었을 때만 CSS로 행 높이 확장 및 요소 표시 --- */
|
|
294
|
-
nine-table-sheet.hscroll-visible {
|
|
295
|
-
grid-template-rows: 1fr ${e}px;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
nine-table-sheet.hscroll-visible nine-table-hscrollbar,
|
|
299
|
-
nine-table-sheet.hscroll-visible .ng-scroll-edge {
|
|
300
|
-
display: flex;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
nine-table-hscrollbar,
|
|
304
|
-
nine-table-sheet .ng-scroll-edge {
|
|
305
|
-
display: none; /* 평소에는 기본 숨김 */
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
nine-table-sheet .ng-main-content-wrapper {
|
|
309
|
-
grid-row: 1;
|
|
310
|
-
grid-column: 1;
|
|
311
|
-
display: flex;
|
|
312
|
-
flex-direction: column;
|
|
313
|
-
width: 100%;
|
|
314
|
-
height: 100%;
|
|
315
|
-
overflow: hidden;
|
|
316
|
-
position: relative;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
nine-table-sheet .ng-sheet-header,
|
|
320
|
-
nine-table-sheet .ng-sheet-footer {
|
|
321
|
-
display: flex;
|
|
322
|
-
flex-direction: row;
|
|
323
|
-
flex-shrink: 0;
|
|
324
|
-
width: 100%;
|
|
325
|
-
background: #f9fafb;
|
|
326
|
-
z-index: 3;
|
|
327
|
-
overflow: hidden;
|
|
328
|
-
box-sizing: border-box;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
nine-table-sheet .ng-virtual-height-holder {
|
|
332
|
-
width: 100%;
|
|
333
|
-
pointer-events: none;
|
|
334
|
-
visibility: hidden;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
nine-table-sheet .ng-sheet-body {
|
|
338
|
-
display: block;
|
|
339
|
-
flex: 1 1 auto;
|
|
340
|
-
width: 100%;
|
|
341
|
-
height: 100%;
|
|
342
|
-
overflow-y: auto;
|
|
343
|
-
overflow-x: hidden;
|
|
344
|
-
position: relative;
|
|
345
|
-
scrollbar-width: none;
|
|
346
|
-
&::-webkit-scrollbar { display: none; height: 0px; width: 0px; }
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
nine-table-sheet tbody {
|
|
350
|
-
position: relative;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
nine-table-sheet .ng-sheet-body-content {
|
|
354
|
-
display: flex;
|
|
355
|
-
flex-direction: row;
|
|
356
|
-
width: 100%;
|
|
357
|
-
height: 100%;
|
|
358
|
-
left: 0;
|
|
359
|
-
top: 0;
|
|
360
|
-
position: sticky;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
nine-table-sheet .ng-container-left,
|
|
364
|
-
nine-table-sheet .ng-container-body,
|
|
365
|
-
nine-table-sheet .ng-container-right {
|
|
366
|
-
display: flex;
|
|
367
|
-
flex-direction: column;
|
|
368
|
-
position: relative;
|
|
369
|
-
background: #ffffff;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/* 3. 좌우 고정 영역 구분선 제거 */
|
|
373
|
-
.ng-container-left,
|
|
374
|
-
.ng-container-right {
|
|
375
|
-
border: none;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.ng-container-left, .ng-container-body, .ng-container-right {
|
|
379
|
-
--border-right: none;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
nine-table-sheet tbody.foot {
|
|
383
|
-
height: 100vh;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
nine-table-sheet .ng-container-left {
|
|
387
|
-
--border-right: 1px solid #e5e7eb;
|
|
388
|
-
flex-shrink: 0;
|
|
389
|
-
overflow: hidden !important;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
nine-table-sheet .ng-container-body {
|
|
393
|
-
flex: 1;
|
|
394
|
-
overflow-x: auto;
|
|
395
|
-
overflow-y: hidden;
|
|
396
|
-
scrollbar-width: none;
|
|
397
|
-
&::-webkit-scrollbar { display: none; height: 0px; width: 0px; }
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
nine-table-sheet .ng-container-right {
|
|
401
|
-
flex-shrink: 0;
|
|
402
|
-
overflow: hidden;
|
|
403
|
-
}
|
|
404
|
-
nine-table-sheet .ng-container-left, nine-table-sheet .ng-container-right {
|
|
405
|
-
filter: brightness(99%);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
/* --- 세로 스크롤바 (Grid Row 1, Col 2) --- */
|
|
411
|
-
nine-table-vscrollbar {
|
|
412
|
-
grid-row: 1;
|
|
413
|
-
grid-column: 2;
|
|
414
|
-
width: ${e}px;
|
|
415
|
-
height: 100%;
|
|
416
|
-
z-index: 50;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/* --- 가로 스크롤바 (Grid Row 2, Col 1 직속 안착) --- */
|
|
420
|
-
nine-table-hscrollbar {
|
|
421
|
-
grid-row: 2;
|
|
422
|
-
grid-column: 1;
|
|
423
|
-
flex-direction: row;
|
|
424
|
-
height: ${e}px;
|
|
425
|
-
min-height: ${e}px;
|
|
426
|
-
background: #f9fafb;
|
|
427
|
-
border-top: 1px solid #e5e7eb;
|
|
428
|
-
z-index: 10;
|
|
429
|
-
overflow: hidden;
|
|
430
|
-
width: 100%;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/* --- 우하단 엣지 (Grid Row 2, Col 2) --- */
|
|
434
|
-
nine-table-sheet .ng-scroll-edge {
|
|
435
|
-
grid-row: 2;
|
|
436
|
-
grid-column: 2;
|
|
437
|
-
width: ${e}px;
|
|
438
|
-
height: ${e}px;
|
|
439
|
-
background: #f3f4f6;
|
|
440
|
-
border-top: 1px solid #e5e7eb;
|
|
441
|
-
z-index: 10;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
nine-table-sheet col {
|
|
445
|
-
width: attr(width px); /* 브라우저가 지원하는 경우 또는 아래 처럼 고정 셀렉터 활용 */
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
nine-table-sheet table {
|
|
449
|
-
border-collapse: separate;
|
|
450
|
-
border-spacing: 0;
|
|
451
|
-
width: auto;
|
|
452
|
-
min-width: 100%;
|
|
453
|
-
table-layout: fixed;
|
|
454
|
-
box-sizing: border-box;
|
|
455
|
-
}
|
|
456
|
-
nine-table-sheet[auto-fit-col="true"] table {
|
|
457
|
-
width: 100%;
|
|
458
|
-
min-width: 100%;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
nine-table-sheet th, nine-table-sheet td {
|
|
462
|
-
box-sizing: border-box;
|
|
463
|
-
overflow: hidden;
|
|
464
|
-
white-space: nowrap;
|
|
465
|
-
text-overflow: ellipsis;
|
|
466
|
-
padding: 0px 4px;
|
|
467
|
-
/* 💡 상하좌우 테두리 공간을 1px 고정으로 4방향 모두 잡아줍니다 */
|
|
468
|
-
border-top: 1px solid transparent;
|
|
469
|
-
border-left: 1px solid transparent;
|
|
470
|
-
border-right: 1px solid #e5e7eb;
|
|
471
|
-
border-bottom: 1px solid #e5e7eb;
|
|
472
|
-
font-size: 12px;
|
|
473
|
-
color: #111827;
|
|
474
|
-
position: relative;
|
|
475
|
-
outline: none;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
nine-table-sheet th {
|
|
479
|
-
background-color: #f9fafb;
|
|
480
|
-
font-weight: 600;
|
|
481
|
-
text-align: left;
|
|
482
|
-
user-select: none;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
/* 🎯 셀 선택 영역 스타일 (selected 및 테두리선들) */
|
|
488
|
-
/* --- 🎯 셀 선택 및 포커스(시작점) 관련 스타일 (필수 추가) --- */
|
|
489
|
-
nine-table-sheet td.selected,
|
|
490
|
-
nine-table-sheet th.selected {
|
|
491
|
-
background-color: rgba(37, 99, 235, 0.08);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
nine-table-sheet td.selected-start,
|
|
495
|
-
nine-table-sheet th.selected-start {
|
|
496
|
-
background-color: transparent;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
nine-table-sheet tr td.selected-top { border-top: 2px solid #2563eb; }
|
|
500
|
-
nine-table-sheet tr td.selected-bottom { border-bottom: 2px solid #2563eb; }
|
|
501
|
-
nine-table-sheet tr td.selected-left { border-left: 2px solid #2563eb; }
|
|
502
|
-
nine-table-sheet tr td.selected-right { border-right: 2px solid #2563eb; }
|
|
503
|
-
|
|
504
|
-
/* 🎯 [복원] 컬럼 접기/펼치기 아이콘 컴포넌트 스타일 */
|
|
505
|
-
nine-table-col-expand {
|
|
506
|
-
position: absolute;
|
|
507
|
-
--top: 50%;
|
|
508
|
-
right: 2px;
|
|
509
|
-
top: 2px;
|
|
510
|
-
--transform: translateY(-50%);
|
|
511
|
-
width: 12px;
|
|
512
|
-
height: 12px;
|
|
513
|
-
cursor: pointer;
|
|
514
|
-
background-repeat: no-repeat;
|
|
515
|
-
background-position: center;
|
|
516
|
-
background-size: contain;
|
|
517
|
-
z-index: 2;
|
|
518
|
-
pointer-events: auto;
|
|
519
|
-
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="%234b5563" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6 8a.5.5 0 0 0 .5.5h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L12.293 7.5H6.5A.5.5 0 0 0 6 8m-2.5 7a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5"/></svg>');
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
nine-table-col-expand.expand {
|
|
523
|
-
right: 2px;
|
|
524
|
-
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="%234b5563" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5M10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5"/></svg>');
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
nine-table-col-expand.collapsed {
|
|
528
|
-
left: 50%;
|
|
529
|
-
right: auto;
|
|
530
|
-
transform: translate(-50%, 0);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
nine-table-sheet th:has(nine-table-col-expand),
|
|
534
|
-
nine-table-sheet td:has(nine-table-col-expand) {
|
|
535
|
-
position: relative;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/* 정렬 아이콘 여백 */
|
|
539
|
-
nine-table-sheet thead th.asc::after,
|
|
540
|
-
nine-table-sheet thead td.asc::after,
|
|
541
|
-
nine-table-sheet thead th.desc::after,
|
|
542
|
-
nine-table-sheet thead td.desc::after {
|
|
543
|
-
content: "";
|
|
544
|
-
display: inline-block;
|
|
545
|
-
width: 0;
|
|
546
|
-
height: 0;
|
|
547
|
-
flex-shrink: 0;
|
|
548
|
-
margin-left: 4px;
|
|
549
|
-
vertical-align: middle;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
nine-table-sheet thead th.asc::after,
|
|
553
|
-
nine-table-sheet thead td.asc::after {
|
|
554
|
-
border-left: 4px solid transparent;
|
|
555
|
-
border-right: 4px solid transparent;
|
|
556
|
-
border-bottom: 6px solid #2563eb;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
nine-table-sheet thead th.desc::after,
|
|
560
|
-
nine-table-sheet thead td.desc::after {
|
|
561
|
-
border-left: 4px solid transparent;
|
|
562
|
-
border-right: 4px solid transparent;
|
|
563
|
-
border-top: 6px solid #dc2626;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
nine-table-sheet[filtering="true"] .ng-sheet-header th,
|
|
567
|
-
nine-table-sheet[filtering="true"] .ng-sheet-header td {
|
|
568
|
-
padding-right: 22px !important;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/* 필터 버튼 아이콘 */
|
|
572
|
-
nine-table-filter-button {
|
|
573
|
-
position: absolute;
|
|
574
|
-
bottom: 2px;
|
|
575
|
-
right: 2px;
|
|
576
|
-
width: 12px;
|
|
577
|
-
height: 12px;
|
|
578
|
-
cursor: pointer;
|
|
579
|
-
z-index: 2;
|
|
580
|
-
background-repeat: no-repeat;
|
|
581
|
-
background-position: center;
|
|
582
|
-
background-size: contain;
|
|
583
|
-
display: inline-block;
|
|
584
|
-
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 16 16"><path fill="%239ca3af" d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 7 8.5v5.306l2-.666V8.5a.5.5 0 0 1 .128-.334L13.5 3.308V2z"/></svg>');
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
nine-table-filter-button.filtered {
|
|
588
|
-
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 16 16"><path fill="%232563eb" d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5z"/></svg>');
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
nine-table-sheet .ng-nodata-overlay {
|
|
592
|
-
display: none;
|
|
593
|
-
position: absolute;
|
|
594
|
-
top: 0; /* 👈 상단부터 */
|
|
595
|
-
left: 0; /* 👈 좌측부터 */
|
|
596
|
-
right: 0; /* 👈 우측까지 꽉 채움 */
|
|
597
|
-
bottom: 0; /* 👈 하단까지 꽉 채움 (absolute로 전체 영역 커버) */
|
|
598
|
-
background: #ffffff;
|
|
599
|
-
z-index: 20;
|
|
600
|
-
align-items: center;
|
|
601
|
-
justify-content: center;
|
|
602
|
-
font-size: 12px;
|
|
603
|
-
color: #9ca3af;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
nine-table-sheet .ng-col-mover-indi {
|
|
609
|
-
position: absolute;
|
|
610
|
-
width: 2px;
|
|
611
|
-
background-color: #2563eb;
|
|
612
|
-
display: none;
|
|
613
|
-
pointer-events: none;
|
|
614
|
-
z-index: 10020;
|
|
615
|
-
box-sizing: border-box;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
nine-table-sheet .ng-col-mover-indi::before {
|
|
619
|
-
content: '';
|
|
620
|
-
position: absolute;
|
|
621
|
-
top: -6px;
|
|
622
|
-
left: -4px;
|
|
623
|
-
width: 0;
|
|
624
|
-
height: 0;
|
|
625
|
-
border-top: 6px solid #2563eb;
|
|
626
|
-
border-left: 5px solid transparent;
|
|
627
|
-
border-right: 5px solid transparent;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
nine-table-sheet .ng-col-mover-indi::after {
|
|
631
|
-
content: '';
|
|
632
|
-
position: absolute;
|
|
633
|
-
bottom: -6px;
|
|
634
|
-
left: -4px;
|
|
635
|
-
width: 0;
|
|
636
|
-
height: 0;
|
|
637
|
-
border-bottom: 6px solid #2563eb;
|
|
638
|
-
border-left: 5px solid transparent;
|
|
639
|
-
border-right: 5px solid transparent;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
nine-table-sheet .ng-col-mover-grip {
|
|
643
|
-
position: absolute;
|
|
644
|
-
box-sizing: border-box;
|
|
645
|
-
display: none;
|
|
646
|
-
pointer-events: none;
|
|
647
|
-
z-index: 10010;
|
|
648
|
-
background-color: rgba(37, 99, 235, 0.12);
|
|
649
|
-
border: none;
|
|
650
|
-
box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
|
|
651
|
-
overflow: hidden;
|
|
652
|
-
backdrop-filter: blur(1px);
|
|
653
|
-
transition: background-color 0.15s ease, border-color 0.15s ease;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
nine-table-sheet .ng-col-mover-grip .grip-header-content {
|
|
657
|
-
position: absolute;
|
|
658
|
-
top: 0;
|
|
659
|
-
left: 0;
|
|
660
|
-
width: 100%;
|
|
661
|
-
box-sizing: border-box;
|
|
662
|
-
z-index: 2;
|
|
663
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
nine-table-sheet .ng-col-mover-grip.invalid {
|
|
667
|
-
background-color: rgba(239, 68, 68, 0.12);
|
|
668
|
-
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
nine-table-sheet .ng-col-mover-grip.invalid .grip-header-content {
|
|
672
|
-
border-bottom: 2px solid #ef4444;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
nine-table-sheet .ng-col-mover-grip th,
|
|
676
|
-
nine-table-sheet .ng-col-mover-grip td {
|
|
677
|
-
box-sizing: border-box;
|
|
678
|
-
user-select: none;
|
|
679
|
-
pointer-events: none;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
/* 🎯 정렬 아이콘 공통 (가상 요소 - 헤더 및 드래그 그립 패널 공통 적용) */
|
|
683
|
-
nine-table-sheet .ng-sheet-header th.asc::after,
|
|
684
|
-
nine-table-sheet .ng-sheet-header td.asc::after,
|
|
685
|
-
nine-table-sheet .ng-sheet-header th.desc::after,
|
|
686
|
-
nine-table-sheet .ng-sheet-header td.desc::after,
|
|
687
|
-
nine-table-sheet .ng-col-mover-grip th.asc::after, /* 👈 그립 패널 타겟 추가 */
|
|
688
|
-
nine-table-sheet .ng-col-mover-grip td.asc::after,
|
|
689
|
-
nine-table-sheet .ng-col-mover-grip th.desc::after, /* 👈 그립 패널 타겟 추가 */
|
|
690
|
-
nine-table-sheet .ng-col-mover-grip td.desc::after {
|
|
691
|
-
content: "";
|
|
692
|
-
display: inline-block;
|
|
693
|
-
width: 0;
|
|
694
|
-
height: 0;
|
|
695
|
-
flex-shrink: 0;
|
|
696
|
-
margin-left: 4px;
|
|
697
|
-
vertical-align: middle;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/* 오름차순 (▲): 위쪽을 가리키는 삼각형 */
|
|
701
|
-
nine-table-sheet .ng-sheet-header th.asc::after,
|
|
702
|
-
nine-table-sheet .ng-sheet-header td.asc::after,
|
|
703
|
-
nine-table-sheet .ng-col-mover-grip th.asc::after, /* 👈 추가 */
|
|
704
|
-
nine-table-sheet .ng-col-mover-grip td.asc::after {
|
|
705
|
-
border-left: 4px solid transparent;
|
|
706
|
-
border-right: 4px solid transparent;
|
|
707
|
-
border-bottom: 6px solid #2563eb; /* 블루 포인트 */
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
/* 내림차순 (▼): 아래쪽을 가리키는 삼각형 */
|
|
711
|
-
nine-table-sheet .ng-sheet-header th.desc::after,
|
|
712
|
-
nine-table-sheet .ng-sheet-header td.desc::after,
|
|
713
|
-
nine-table-sheet .ng-col-mover-grip th.desc::after, /* 👈 추가 */
|
|
714
|
-
nine-table-sheet .ng-col-mover-grip td.desc::after {
|
|
715
|
-
border-left: 4px solid transparent;
|
|
716
|
-
border-right: 4px solid transparent;
|
|
717
|
-
border-top: 6px solid #dc2626; /* 레드 포인트 */
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
nine-table-sheet th.resizable-edge,
|
|
721
|
-
nine-table-sheet td.resizable-edge {
|
|
722
|
-
cursor: col-resize;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
nine-table-sheet .ng-col-resizer-panel {
|
|
726
|
-
position: absolute;
|
|
727
|
-
top: 0;
|
|
728
|
-
left: 0;
|
|
729
|
-
width: 100%;
|
|
730
|
-
height: 100%;
|
|
731
|
-
pointer-events: none;
|
|
732
|
-
display: none;
|
|
733
|
-
z-index: 9999;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
nine-table-sheet .ng-col-resizer-panel.active {
|
|
737
|
-
display: block;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
nine-table-sheet .ng-col-resizer-panel .grip {
|
|
741
|
-
position: absolute;
|
|
742
|
-
top: 0;
|
|
743
|
-
width: 1px;
|
|
744
|
-
height: 100%;
|
|
745
|
-
background-color: #2563eb;
|
|
746
|
-
left: var(--resizer-left, 0px);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
nine-table-sheet .ng-col-resizer-panel .tooltip {
|
|
750
|
-
position: absolute;
|
|
751
|
-
top: 0px;
|
|
752
|
-
left: var(--tooltip-left, 0px);
|
|
753
|
-
width: var(--tooltip-width, 0px);
|
|
754
|
-
height: 24px;
|
|
755
|
-
display: flex;
|
|
756
|
-
flex-direction: column;
|
|
757
|
-
align-items: center;
|
|
758
|
-
pointer-events: none;
|
|
759
|
-
z-index: 10000;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
nine-table-sheet .ng-col-resizer-panel .tooltip .line-wrapper {
|
|
763
|
-
width: 100%;
|
|
764
|
-
height: 1px;
|
|
765
|
-
background-color: #2563eb;
|
|
766
|
-
position: relative;
|
|
767
|
-
display: flex;
|
|
768
|
-
align-items: center;
|
|
769
|
-
justify-content: space-between;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
nine-table-sheet .ng-col-resizer-panel .resizer-overlay {
|
|
773
|
-
position: absolute;
|
|
774
|
-
top: 0;
|
|
775
|
-
left: var(--tooltip-left, 0px);
|
|
776
|
-
width: var(--tooltip-width, 0px);
|
|
777
|
-
height: 100%;
|
|
778
|
-
background-color: rgba(37, 99, 235, 0.12);
|
|
779
|
-
border-left: 1px dashed #2563eb;
|
|
780
|
-
border-right: 2px solid #2563eb;
|
|
781
|
-
box-sizing: border-box;
|
|
782
|
-
display: flex;
|
|
783
|
-
align-items: flex-start;
|
|
784
|
-
justify-content: center;
|
|
785
|
-
padding-top: 8px;
|
|
786
|
-
pointer-events: none;
|
|
787
|
-
opacity: 1;
|
|
788
|
-
transition: opacity 0.15s ease-out;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
nine-table-sheet .ng-col-resizer-panel .resizer-overlay.fade-out {
|
|
792
|
-
opacity: 0;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
nine-table-sheet th.resize-flash {
|
|
796
|
-
transition: background-color 0.3s ease;
|
|
797
|
-
background-color: rgba(37, 99, 235, 0.15);
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
nine-table-sheet .ng-col-resizer-panel .resizer-overlay .size-badge {
|
|
801
|
-
padding: 2px 8px;
|
|
802
|
-
font-size: 11px;
|
|
803
|
-
font-weight: 700;
|
|
804
|
-
color: #ffffff;
|
|
805
|
-
background-color: #1e40af;
|
|
806
|
-
border-radius: 4px;
|
|
807
|
-
line-height: 14px;
|
|
808
|
-
white-space: nowrap;
|
|
809
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
nine-table-sheet tr.ng-sticky-header {
|
|
813
|
-
background-color: #f3f4f6 !important; /* 일반 행보다 살짝 진한 배경색 */
|
|
814
|
-
font-weight: 600;
|
|
815
|
-
z-index: 5; /* 다른 행들보다 위에 보이도록 설정 */
|
|
816
|
-
position: relative;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
/* 스크롤되면서 밀려 내려갈 때 입체감을 주는 하단 그림자 효과 */
|
|
820
|
-
nine-table-sheet tr.ng-sticky-header td {
|
|
821
|
-
border-bottom: 2px solid #d1d5db !important;
|
|
822
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
td.invalid::after {
|
|
827
|
-
content: "";
|
|
828
|
-
position: absolute;
|
|
829
|
-
top: 0;
|
|
830
|
-
right: 0;
|
|
831
|
-
width: 0;
|
|
832
|
-
height: 0;
|
|
833
|
-
border-top: 2px solid red;
|
|
834
|
-
border-right: 2px solid red;
|
|
835
|
-
border-bottom: 2px solid transparent; /* 아래쪽은 투명하게 하여 삼각형 완성 */
|
|
836
|
-
border-left: 2px solid transparent; /* 왼쪽은 투명하게 하여 삼각형 완성 */
|
|
837
|
-
z-index: 1;
|
|
838
|
-
pointer-events: none;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
nine-table-sheet td[disabled="true"] {
|
|
842
|
-
input,button {
|
|
843
|
-
background: #f0f0f0;
|
|
844
|
-
opacity: 0.5;
|
|
845
|
-
pointer-events: none;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
</style>
|
|
851
|
-
|
|
852
|
-
<!-- [Grid Row 1, Col 1] 메인 콘텐츠 래퍼 -->
|
|
853
|
-
|
|
246
|
+
`},"#renderer"));d(this,gr,h(e=>{const s=e.composedPath?e.composedPath():[];s.includes(this)||t(this,Kt)&&s.includes(t(this,Kt))||this.close()},"#closeHandler"));d(this,br,h(()=>{var l;t(this,ne).loading=!0;const e=t(this,oe).view.getArray(),s=t(this,bt).data.getHostFields(),i=e.filter(a=>{const c=a.v[s.indexOf("CHK")];return c==="Y"||c===!0}),r={...((l=t(this,Wt).filtering)==null?void 0:l.filters)||{}};t(this,Kt).columns.forEach(a=>{const c=a.expr||a.bind,u=a.expr?s.indexOf("DATA2"):s.indexOf("DATA"),g=i.map(f=>f.v[u]);g.length>0?r[c]=g:delete r[c]});const o=t(this,bt).data.count();setTimeout(()=>{try{o===i.length?t(this,Kt).columns.forEach(a=>{const c=a.expr||a.bind;c&&t(this,Wt).filtering.clear(c)}):t(this,Wt).filtering.set(r),t(this,Wt).querySelectorAll("nine-table-filter-button").forEach(a=>{a.updateFilteredState()}),t(this,Wt).invalidate(),this.close()}finally{t(this,ne).loading=!1}})},"#onOk"));d(this,mr,h(e=>{const s=e.target.value.toLowerCase().trim();if(!s)t(this,oe).filtering.clear();else{const i=t(this,bt).data.getArray(),o=t(this,bt).data.getHostFields().indexOf("DATA2"),l=[];i.forEach(a=>{const c=o>=0&&a.v?a.v[o]:"";String(c).replace(/<[^>]*>?/gm,"").toLowerCase().includes(s)&&l.push(c)}),v.log(l),t(this,oe).filtering.set({DATA2:[...new Set(l)]})}},"#onInput"));d(this,yr,h(e=>{var l,a;const s=e.target.checked,i=((a=(l=t(this,bt))==null?void 0:l.data)==null?void 0:a.getArray())||[],o=t(this,bt).data.getHostFields().indexOf("CHK");o>=0&&i.forEach(c=>{c.v[o]=s?"Y":"N"}),t(this,bt).refresh()},"#onSelectAll"));d(this,To,h(()=>{this.close()},"#onCancel"))}connectedCallback(){t(this,ur).call(this),document.addEventListener("mousedown",t(this,gr))}open(e){p(this,Kt,e);const s=e.closest("th, td");this.currentCol=s==null?void 0:s.dataset.col;const i=s.getBoundingClientRect(),r=t(this,Wt).getBoundingClientRect(),o=this.offsetWidth||240;let l=i.right-r.left-o,a=i.bottom-r.top;l<0&&(l=Math.max(0,i.left-r.left)),this.style.left=`${l}px`,this.style.top=`${a}px`;const c=this.querySelector(".search-box");c.value="",this.classList.add("active"),this.classList.add("loading"),setTimeout(()=>{try{A(this,pr,Nl).call(this),t(this,oe).rowManager.scrollToDataRow(0)}finally{this.classList.remove("loading")}})}close(){this.currentCol=null,this.classList.remove("active"),p(this,Kt,null)}};Wt=new WeakMap,ne=new WeakMap,bt=new WeakMap,oe=new WeakMap,Kt=new WeakMap,ur=new WeakMap,fr=new WeakMap,gr=new WeakMap,pr=new WeakSet,Nl=h(function(){var c,u;const e=t(this,ne).data.getArray(),s=((c=t(this,Kt))==null?void 0:c.columns)||[],i=t(this,ne).fields.get()||[],r=((u=t(this,Wt).filtering)==null?void 0:u.filters)||{},o=t(this,ne).exprEngine,l=s.flatMap(g=>{const f=g.bind,b=g.expr,m=f||b,y=f?i.indexOf(f):-1,x=r[m]||[],w=new Map;for(let R=0;R<e.length;R++){const C=e[R];if(!C)continue;let W;y>=0&&C.v?W=C.v[y]:f&&f.includes("data.")?W=o?o.evaluate(f,C,R):void 0:b&&o&&(W=o.evaluate(b,C,R));let T=W;b&&o&&(T=o.evaluate(b,C,R)),T!=null&&!w.has(T)&&w.set(T,{v:W,v2:T})}const S=[...w.values()];return S.sort((R,C)=>String(R.v2||"").localeCompare(String(C.v2||""))),x.sort((R,C)=>R>C?1:-1),S.map(R=>({LVL:2,DATA:R.v,DATA2:R.v2===""||R.v2===null||R.v2===void 0?'<span class="empty-value">(empty)</span>':R.v2,COLNM:m,CHK:x.length===0||x.nineBinarySearch(R.v||"")>=0?"Y":"N"}))});t(this,bt).data.set(l);const a=this.querySelector("#chkSelectAll");a&&(a.checked=l.length>0&&l.every(g=>g.CHK==="Y"))},"#loadVirtualFilterItems"),br=new WeakMap,mr=new WeakMap,yr=new WeakMap,To=new WeakMap,h(ko,"NineTableFilterPanel");let Wn=ko;const Io=class Io extends HTMLElement{constructor(){super(...arguments);d(this,Ge);d(this,je,null);E(this,"updateFilteredState",h(()=>{var i;const e=((i=t(this,Ge).filtering)==null?void 0:i.filters)||{},s=this.columns.some(r=>{const o=r.expr||r.bind;return o&&e[o]&&e[o].length>0});this.classList.toggle("filtered",s)},"updateFilteredState"));d(this,pi,h(e=>{e.preventDefault(),e.stopPropagation();const s=t(this,Ge).querySelector("nine-table-filter-panel"),i=this.closest("th, td"),r=i==null?void 0:i.dataset.col;s&&s.currentCol===r&&s.classList.contains("active")?s.close():s&&s.open(this)},"#onClick"))}connectedCallback(){p(this,Ge,this.closest("nine-table-sheet")||this.getRootNode().host),this.removeEventListener("click",t(this,pi)),this.addEventListener("click",t(this,pi))}get columns(){if(t(this,je))return t(this,je);const e=this.closest("th, td"),s=e==null?void 0:e.dataset.col,i=t(this,Ge).sourceTable,r=[],o=new Set;return i&&s!==void 0&&i.querySelectorAll(`tbody [data-col="${s}"]`).forEach(l=>{const a=l.dataset.bind,c=l.dataset.expr;if(a||c){const u=`${a||""}_${c||""}`;o.has(u)||(o.add(u),r.push({bind:a,expr:c}))}}),p(this,je,r),t(this,je)}};Ge=new WeakMap,je=new WeakMap,pi=new WeakMap,h(Io,"NineTableFilterButton");let On=Io;const qo=class qo{constructor(n){d(this,bi);d(this,It);d(this,Se);d(this,Ke,!1);d(this,xr,null);d(this,Yt,{});d(this,wr,h(()=>{t(this,vr).call(this)},"#init"));d(this,vr,h(()=>{if(t(this,Se).tagName.toLowerCase()==="nine-table-simple")return;let n=t(this,It).querySelector("nine-table-filter-panel");n||(n=document.createElement("nine-table-filter-panel"),t(this,It).appendChild(n)),p(this,xr,n)},"#initFilterPanel"));E(this,"clear",h(n=>{n?delete t(this,Yt)[n]:p(this,Yt,{}),p(this,Ke,Object.keys(t(this,Yt)).length>0),A(this,bi,pl).call(this),t(this,It).querySelectorAll("nine-table-filter-button").forEach(e=>{e.updateFilteredState()}),v.log(`🔄 [NineTableFiltering] Filter cleared for ${n||"all"}`)},"clear"));E(this,"set",h(n=>{v.log(n);let e=Array.isArray(n)?Object.fromEntries(Object.keys(n[0]).map(s=>[s,[...new Set(n.map(i=>i[s]))]])):n;p(this,Yt,e),p(this,Ke,Object.keys(e).length>0),t(this,It).toggleAttribute("filtering",t(this,Ke)),A(this,bi,pl).call(this)},"set"));p(this,It,n),p(this,Se,t(this,It).getRootNode().host),t(this,wr).call(this)}get filters(){return t(this,Yt)}isFiltering(){return t(this,Ke)}};It=new WeakMap,Se=new WeakMap,Ke=new WeakMap,xr=new WeakMap,Yt=new WeakMap,wr=new WeakMap,vr=new WeakMap,bi=new WeakSet,pl=h(function(){const e=t(this,Se).data.getArray(),s=t(this,Se).data.getHostFields(),i=t(this,It).index,r=t(this,Se).exprEngine;if(!(Object.keys(t(this,Yt)).length>0)){e.forEach(a=>{var c,u;(u=(c=a==null?void 0:a.m)==null?void 0:c._)!=null&&u[Dt.META.INDEX.FILTER]&&(a.m._[Dt.META.INDEX.FILTER][i]=!0)}),t(this,It).invalidate();return}const l=Object.entries(t(this,Yt)).map(([a,c])=>{const u=a.includes("data.")||a.includes("host.")||a.includes("rowItem.v");return{targetKey:a,isExpr:u,fieldIdx:u?-1:s.indexOf(a),allowedSet:new Set(c)}});e.forEach((a,c)=>{if(!a)return;a.m._[Dt.META.INDEX.FILTER]||(a.m._[Dt.META.INDEX.FILTER]=[]);let u=!0;for(let g=0;g<l.length;g++){const{targetKey:f,isExpr:b,fieldIdx:m,allowedSet:y}=l[g];let x;if(b&&r?x=r.evaluate(f,a,c):m>=0&&a.v&&(x=a.v[m]),!y.has(x)){u=!1;break}}a.m._[Dt.META.INDEX.FILTER][i]=u}),t(this,It).invalidate()},"#applyFiltering"),h(qo,"Filtering");let zn=qo;customElements.get("nine-table-filter-panel")||customElements.define("nine-table-filter-panel",Wn),customElements.get("nine-table-filter-button")||customElements.define("nine-table-filter-button",On);const Mo=class Mo{constructor(n){d(this,Ot);d(this,ct);d(this,mi);d(this,ht,[]);p(this,ct,n),p(this,mi,n.getRootNode().host),setTimeout(()=>{A(this,Ot,Dl).call(this)},300)}restore(){var n;p(this,ht,[]),t(this,ct).view&&t(this,ct).view.resetSorting(),A(this,Ot,bl).call(this),(n=t(this,ct).rowManager)==null||n.refresh(!0)}};ct=new WeakMap,mi=new WeakMap,ht=new WeakMap,Ot=new WeakSet,Dl=h(function(){t(this,ct).querySelectorAll("thead").forEach(n=>{n.addEventListener("dblclick",e=>{const s=e.target.closest("th, td");if(!s||s.classList.contains("resizable-edge")||["INPUT","CELL-CHECKBOX"].includes(e.target.tagName)||e.offsetX<=2||e.offsetX>=s.offsetWidth-2)return;const i=t(this,ct).getRootNode().host;i.loading=!0,setTimeout(()=>{try{A(this,Ot,$l).call(this,e,s)}finally{i.loading=!1}})})}),v.log("🎯 [NineTableSorting] Initialized")},"#initEvents"),$l=h(function(n,e){const s=e.dataset.col,i=e.closest("tr"),r=i?i.dataset.subrow||String(i.sectionRowIndex):"0";if(s===void 0)return;const o=t(this,ct).sourceTable;if(!o)return;let l=null,a=null;if(o.querySelectorAll(`tbody [data-col="${s}"]`).forEach(b=>{b.dataset.bind&&(l=b.dataset.bind),b.dataset.expr&&(a=b.dataset.expr)}),!l&&!a)return;const c=e.classList.contains("asc"),u=e.classList.contains("desc");!n.ctrlKey&&!n.shiftKey&&p(this,ht,[]);const g=t(this,ht).findIndex(b=>b.colIndex===s&&b.subRowIndex===r||b.colName===l),f={colIndex:s,subRowIndex:r,colname:l||a,colName:l||a,expr:a,asc:!0,"expr-func":a?(b,m)=>t(this,mi).exprEngine(a,b,m):null};!c&&!u?g>=0?t(this,ht)[g].asc=!0:t(this,ht).push({...f,asc:!0}):c?g>=0?t(this,ht)[g].asc=!1:t(this,ht).push({...f,asc:!1}):p(this,ht,t(this,ht).filter(b=>!(b.colIndex===s&&b.subRowIndex===r||b.colName===l))),A(this,Ot,Fl).call(this)},"#handleSort"),Fl=h(function(){if(!t(this,ct).view){console.warn("⚠️ [NineTableSorting] Sheet view (SheetView) is not initialized.");return}t(this,ct).view.setSorting(t(this,ht)),A(this,Ot,bl).call(this),t(this,ct).invalidate(),v.log("🔄 [NineTableSorting] Sorting applied via RowManager.refresh(true)")},"#applySorting"),bl=h(function(){t(this,ct).querySelectorAll("thead th, thead td").forEach(n=>{n.classList.remove("asc","desc")}),t(this,ht).length!==0&&t(this,ht).forEach(n=>{const{colIndex:e,subRowIndex:s,asc:i}=n;if(e!==void 0){let r=`thead [data-col="${e}"]`;s!==void 0&&(r=`thead tr[data-subrow="${s}"] [data-col="${e}"]`),t(this,ct).querySelectorAll(r).forEach(l=>{l.classList.add(i?"asc":"desc")})}})},"#syncHeaderUI"),h(Mo,"Sorting");let Bn=Mo;const No=class No{constructor(n){d(this,Ye);d(this,yt);d(this,Ae,[]);d(this,Ho,[]);d(this,yi,[]);d(this,le,null);E(this,"getArray",h((n,e)=>{if(!t(this,le)){const r=t(this,yt).data.getArray();p(this,le,t(this,yi).map(o=>r[o]))}const s=t(this,le);if(n==null)return s;if(n<0||n>=s.length)return null;const i=s[n];if(e!=null){const o=t(this,yt).data.getHostFields().indexOf(e);return o>=0&&i.v?i.v[o]:null}return i},"getArray"));E(this,"get",h((n,e)=>{var o,l;const s=this.getArray(),i=((l=(o=t(this,yt).data).getHostFields)==null?void 0:l.call(o))||[];if(n==null)return s.map(a=>t(this,xi).call(this,a,i));if(n<0||n>=s.length)return null;const r=s[n];if(!r)return null;if(e!=null){const a=i.indexOf(e);return a>=0&&r.v?r.v[a]:null}return t(this,xi).call(this,r,i)},"get"));d(this,xi,h((n,e)=>{if(!n)return null;const s={};return e.forEach((i,r)=>{s[i]=n.v?n.v[r]:n[i]}),n.m&&(s.m=n.m),n._&&(s._=n._),s},"#convSingle"));E(this,"refresh",h(()=>{var r;p(this,le,null);const n=t(this,yt).data.getArray();let e=[];n.forEach((o,l)=>{var c,u;if(!o)return;const a=(u=(c=o.m)==null?void 0:c._)==null?void 0:u[Dt.META.INDEX.FILTER];a&&a[t(this,Ye).index]===!1||e.push(l)}),v.log(e),t(this,Ae).length>0&&(e=t(this,Sr).call(this,e,n)),p(this,yi,e);const s=e.map(o=>n[o]),i=((r=t(this,Ye).grouping)==null?void 0:r.columns)||[];if(i.length>0){const o=Mn.apply(s,i,t(this,yt).data.getHostFields());p(this,le,o.renderItems),t(this,Ye).grouping.setGroupMap(o.groupMap)}else p(this,le,s)},"refresh"));E(this,"setSorting",h(n=>{p(this,Ae,n||[]),this.refresh()},"setSorting"));E(this,"getSorting",h(()=>t(this,Ae),"getSorting"));E(this,"resetSorting",h(()=>{p(this,Ae,[]),this.refresh()},"resetSorting"));d(this,Sr,h((n,e)=>{v.log(new Date);const s=typeof t(this,yt).data.getHostFields=="function"?t(this,yt).data.getHostFields():[],i=t(this,Ae).map(r=>({...r,colIndex:s.indexOf(r.colname||r.colName)}));return n.sort((r,o)=>{const l=e[r],a=e[o];for(const c of i){const u=c.asc,g=c.expr;let f,b;g?(f=t(this,yt).exprEngine.evaluate(g,l,r),b=t(this,yt).exprEngine.evaluate(g,a,o)):c.colIndex>=0&&l.v&&a.v&&(f=l.v[c.colIndex],b=a.v[c.colIndex]);const m=f==null||f==="",y=b==null||b==="";if(!(m&&y)){if(m)return 1;if(y)return-1;if(f!==b){let x=0;if(typeof f=="number"&&typeof b=="number")x=f-b;else{const w=String(f),S=String(b);x=w>S?1:w<S?-1:0}if(x!==0)return u?x:-x}}}return r-o})},"#applySorting"));p(this,Ye,n),p(this,yt,n.getRootNode().host),this.refresh()}};Ye=new WeakMap,yt=new WeakMap,Ae=new WeakMap,Ho=new WeakMap,yi=new WeakMap,le=new WeakMap,xi=new WeakMap,Sr=new WeakMap,h(No,"SheetView");let Vi=No;const Pn=16,nt=class nt{static initializeTable(n,e){var s,i,r,o,l,a,c,u,g,f,b;return!n||!e?null:(A(s=nt,O,Bl).call(s,e),A(i=nt,O,Vl).call(i,e),A(r=nt,O,zl).call(r,e),A(o=nt,O,jl).call(o,e),A(l=nt,O,Pl).call(l,e),fe.resetColIndex(e,e.querySelectorAll("thead tr")),fe.resetColIndex(e,e.querySelectorAll('tbody.body tr[grouping="true"]')),fe.resetColIndex(e,e.querySelectorAll('tbody.body tr:not([grouping="true"])')),fe.resetColIndex(e,e.querySelectorAll("tfoot tr")),A(a=nt,O,Wl).call(a,e),A(c=nt,O,Xl).call(c,e),A(u=nt,O,_l).call(u,n,e),A(g=nt,O,Gl).call(g,e),A(f=nt,O,Ul).call(f,n,e),A(b=nt,O,Kl).call(b,e),e)}};O=new WeakSet,Wl=h(function(n){const e=n.querySelector("thead");if(!e||e.querySelector(".col-indicator-rowgroup"))return;const s='<th data-col="@col" class="col-indicator" scope="col"></th>',i=e.insertRow(0);i.setAttribute("role","row"),i.classList.add("col-indicator-rowgroup"),i.classList.add("collapse");const r=n.querySelector("tbody tr");if(!r)return;let o=0;r.querySelectorAll("th, td").forEach(a=>{var c;if(!a.classList.contains("dummy")){const u=a.colSpan||1;for(let g=0;g<u;g++){const f=s.replace("@col",o).replace("@text",A(c=nt,O,Ol).call(c,o++));i.insertAdjacentHTML("beforeend",f)}}});const l=Array.from(n.querySelectorAll("colgroup col"));i.querySelectorAll(".col-indicator").forEach((a,c)=>{const u=l[c].getAttribute("background");u&&(a.style.background=u)})},"#createColIndicator"),Ol=h(function(n){let e="";for(let s=n;s>=0;s=Math.floor(s/26)-1)e=String.fromCharCode(65+s%26)+e;return e},"#numToExcelCol"),zl=h(function(n){let e=n.querySelector("tbody:not(.head):not(.foot)");if(e){if(e.classList.add("body"),!n.querySelector("tbody.head")){const s=document.createElement("tbody");s.classList.add("head"),e.before(s)}if(!n.querySelector("tbody.foot")){const s=document.createElement("tbody");s.classList.add("foot"),e.after(s)}}},"#ensureSectionTbodys"),Bl=h(function(n){let e=n.querySelector("colgroup");if(e||(e=document.createElement("colgroup"),n.prepend(e)),e.querySelectorAll("col").length===0){const s=n.querySelector("tbody tr");let i=1;s&&(i=Array.from(s.querySelectorAll("th, td")).reduce((r,o)=>r+(parseInt(o.getAttribute("colspan")||o.colSpan,10)||1),0)),i=Math.max(i,1);for(let r=0;r<i;r++){const o=document.createElement("col");e.appendChild(o)}}},"#ensureColgroup"),Pl=h(function(n){const e=Array.from(n.querySelectorAll("colgroup col"));if(e.length===0)return;const s=n.clientWidth||0,i=Math.max(Math.floor(s/e.length),100);e.forEach((r,o)=>{r.hasAttribute("data-col")||r.setAttribute("data-col",o);const l=r.getAttribute("width")||parseInt(r.style.width,10)||i;r.setAttribute("width",l);const a=String(l).includes("px")?l:`${l}px`;r.style.width=a})},"#normalizeColAttributes"),Vl=h(function(n){if(n.querySelector("thead"))return;const e=document.createElement("thead"),s=n.querySelector("colgroup");s?s.after(e):n.prepend(e)},"#ensureThead"),Xl=h(function(n){n.querySelectorAll("thead th, thead td").forEach(s=>{s.getAttribute("collapsed")==="true"&&s.getAttribute("collapsible")!=="true"&&s.setAttribute("collapsible","true")})},"#normalizeCollapsibleAttributes"),_l=h(function(n,e){const s=["data-bind","data-expr","type"];let i=0;e.querySelectorAll("tbody th, tbody td").forEach(r=>{const l=`cell-${r.getAttribute("cell-type")||"renderer"}`,a=r.querySelector("datalist");if(a){let g=[];a.querySelectorAll("option").forEach(b=>{g.push({k:b.getAttribute("k"),v:b.getAttribute("v")})});const f=`__ds_${Date.now()}_${++i}`;n&&(n[f]=()=>g),r.setAttribute("data-source",`host.${f}()`),a.remove()}const c=r.dataset.expr;c&&r.setAttribute("data-expr",n.exprEngine.precompile(c)),Array.from(r.attributes).forEach(g=>{["data-bind","data-expr","cell-type"].includes(g.name)||(g.value.includes("data.")||g.value.includes("host."))&&r.setAttribute(g.name,n.exprEngine.precompile(g.value))});const u=s.filter(g=>r.hasAttribute(g)).map(g=>`${g}="${r.getAttribute(g)}"`);r.innerHTML=`<${l} ${u.join(" ")}></${l}>`,r.setAttribute("tabindex","0")}),e.querySelectorAll("thead th, thead td, tfoot th, tfoot td").forEach(r=>{const o=r.getAttribute("cell-type");if(o){const l=r.innerHTML,a=`cell-${o}`,c=s.filter(u=>r.hasAttribute(u)).map(u=>`${u}="${r.getAttribute(u)}"`);r.innerHTML=`<${a} ${c.join(" ")} content="${l}"></${a}>`}})},"#generateCell"),Ul=h(function(n,e){const s=n.getAttribute("filtering")==="true",i=e.getAttribute("filtering")==="true";e.querySelectorAll("thead tr:not(.col-indicator-rowgroup) th, thead tr:not(.col-indicator-rowgroup) td").forEach(r=>{const o=r.getAttribute("filtering")==="true"||i||s;r.setAttribute("filtering",o?"true":"false"),o&&r.appendChild(document.createElement("nine-table-filter-button"))})},"#initFilterButtons"),Gl=h(function(n){n.querySelectorAll("thead th, thead td").forEach(e=>{if(!(e.getAttribute("collapsible")==="true"||e.getAttribute("expandable")==="true"))return;v.log("11.*******************************",e.dataset.col);const i=parseInt(e.dataset.col,10),r=e.colSpan||1,o=n.querySelector(`colgroup col[data-col="${i}"]`);v.log("11.*******************************",o);const l=o&&parseInt(o.getAttribute("width"),10)||100;(!e.dataset.expandWidth||parseInt(e.dataset.expandWidth,10)<=Pn)&&(e.dataset.expandWidth=String(l>Pn?l:100));let a=e.querySelector("nine-table-col-expand");if(a||(a=document.createElement("nine-table-col-expand"),e.insertBefore(a,e.firstChild)),e.getAttribute("collapsed")==="true"){a.classList.add("collapsed"),a.classList.remove("expand"),a.setAttribute("collapsed","true"),e.style.color="transparent";const u=Math.max(10,Math.floor(Pn/r));if(!isNaN(i))for(let g=0;g<r;g++){const f=n.querySelector(`colgroup col[data-col="${i+g}"]`);f&&(f.setAttribute("width",u),f.style.width=`${u}px`)}}else a.classList.remove("collapsed"),a.classList.add("expand"),a.setAttribute("collapsed","false"),e.style.color=""})},"#initColExpanders"),jl=h(function(n,e){const s=n.getAttribute("row-indicator")==="true"?48:0,i=n.querySelector("colgroup"),r=document.createElement("col");r.setAttribute("fixed","left"),r.setAttribute("width",s),r.style.width=`${s}px`,i.prepend(r),n.querySelectorAll("thead, tbody, tfoot").forEach(o=>{const l=Array.from(o.querySelectorAll("tr"));if(l.length===0)return;const a=l[0],c=document.createElement("th");c.className="row-indicator",c.setAttribute("cell-type","row-indicator"),l.length>1&&(c.rowSpan=l.length),a.insertBefore(c,a.firstElementChild)})},"#ensureRowIndicator"),Kl=h(function(n){n.querySelectorAll("th[data-col], td[data-col]").forEach(e=>{v.log(e);const s=parseInt(e.getAttribute("data-col"),10);if(isNaN(s))return;const i=parseInt(e.getAttribute("colspan")||e.colSpan,10)||1;let r=0;for(let o=0;o<i;o++){const l=s+o,a=n.querySelector(`colgroup col[data-col="${l}"]`);a&&(r+=parseInt(a.getAttribute("width"),10)||100)}if(r>0){const o=`${r}px`;e.style.width=o,e.style.minWidth=o,e.style.maxWidth=o}})},"#applyInitialCellWidths"),d(nt,O),h(nt,"PreCompiler");let Vn=nt;const Ci=class Ci extends HTMLElement{constructor(){super();d(this,Er);d(this,wi);d(this,ae);d(this,zt);d(this,vi);d(this,Si);d(this,Ee);d(this,xs);d(this,Ai);d(this,Ar);d(this,Ei);d(this,ws);d(this,Ze);d(this,qt,{table:null});d(this,Je);d(this,Lr,h(()=>{const e=this.querySelector(".ng-container-body thead"),s=this.querySelector(".ng-nodata-overlay");s.style.top=`${e.offsetHeight}px`},"#adjustOverlay"));E(this,"invalidate",h(()=>{this.view.refresh(),t(this,zt).refresh(!0),this.isAutoFitCol&&this.autoFit(!0)},"invalidate"));E(this,"autoFit",h((e=!0)=>{requestAnimationFrame(()=>{var s;(s=t(this,Rr))==null||s.call(this,e)})},"autoFit"));d(this,Rr,h((e=!0)=>{var r;v.log("autoFit",this);const s=this.querySelector(".ng-sheet-body .ng-container-body");if(!s)return;s.querySelectorAll("table");const i=this.querySelector(".ng-sheet-header .ng-container-body table colgroup");if(i){if(e){this.setAttribute("auto-fit-col","true");const o=s.clientWidth;if(o<=0)return;let l=0;const a=[];i.querySelectorAll("col").forEach(g=>{const f=g.getAttribute("data-col"),b=this.querySelector(`.ng-sheet-header th[data-col="${f}"]`);if((b==null?void 0:b.getAttribute("collapsed"))==="true")a.unshift({globalColIndex:f,width:16,isCollapsed:!0}),v.log(`[AutoFit Col] Index ${f}: COLLAPSED (forced 16px)`);else{const y=parseInt(g.getAttribute("width"),10)||100;a.push({globalColIndex:f,width:y,isCollapsed:!1}),l+=y,v.log(`[AutoFit Col] Index ${f}: NORMAL (original width: ${y}px)`)}}),v.log(`[AutoFit] Total Original Width of Normal Cols: ${l}px`);const c=a.filter(g=>g.isCollapsed).reduce((g,f)=>g+f.width,0),u=Math.max(0,o-c);if(v.log(`[AutoFit] Collapsed Total Width: ${c}px | Available Width for Normal Cols: ${u}px`),l>0&&a.length>0){let g=0;const f=a.map(x=>{if(x.isCollapsed)return{globalColIndex:x.globalColIndex,remainder:0,width:16};const w=x.width*u/l,S=Math.max(30,Math.floor(w));return g+=S,{globalColIndex:x.globalColIndex,remainder:w-Math.floor(w),width:S}});let b=u-g;v.log(`[AutoFit] Initial Allocated Total: ${g}px | Remainder Pixels to distribute: ${b}`);const m=f.filter(x=>{var w;return!((w=a.find(S=>S.globalColIndex===x.globalColIndex))!=null&&w.isCollapsed)});if(b>0&&m.length>0){m.sort((x,w)=>w.remainder-x.remainder);for(let x=0;x<b;x++)m[x%m.length].width+=1}else if(b<0&&m.length>0){m.sort((x,w)=>x.remainder-w.remainder);for(let x=0;x<Math.abs(b);x++){const w=m[x%m.length];w.width>30&&(w.width-=1)}}const y=f.reduce((x,w)=>x+w.width,0);v.log(`[AutoFit Verification] Target Container Width: ${o}px | Sum of All Calculated Cols: ${y}px`),o!==y?v.log(`⚠️ [AutoFit Mismatch Warning!] 오차 발생: ${o-y}px 차이가 납니다.`):v.log("✅ [AutoFit Success] 완벽하게 일치합니다!"),f.forEach(({globalColIndex:x,width:w})=>{var S;v.log(`[AutoFit Apply] Col Index ${x} -> ${w}px`),(S=t(this,Ee))==null||S.setColumnWidth(x,w,"body")})}}else this.removeAttribute("auto-fit-col");(r=this.querySelector("nine-table-hscrollbar"))==null||r.refresh()}},"#autoFit"));E(this,"generate",h((e,s)=>{p(this,wi,s),Vn.initializeTable(t(this,ae),e),v.log("=======",e),p(this,qt,{table:fe.compile(e),tbody:{tr:e.querySelectorAll("tbody tr")}}),t(this,Li).call(this),t(this,Qe).call(this),t(this,Ir).call(this),t(this,qr).call(this),["left","body","right"].forEach(i=>{const r=`.ng-container-${i}`;t(this,Je)[i]={thead:this.querySelector(`${r} thead`),tbody:{head:this.querySelector(`${r} tbody.head`),body:this.querySelector(`${r} tbody.body`),foot:this.querySelector(`${r} tbody.foot`)},tfoot:this.querySelector(`${r} tfoot`)}}),t(this,zt).initialize(),this.isAutoFitCol?this.autoFit(!0):this.querySelector("nine-table-hscrollbar").refresh(),t(this,ws).initialize(),this.loaded=!0},"generate"));d(this,Qe,h(()=>{this.isAutoFitCol,["left","right","body"].forEach(e=>{const s=this.querySelectorAll(`.ng-container-${e}`);if(s.length===0)return;const i=s[0].querySelector("table");if(!i)return;let r=0;i.querySelectorAll("col").forEach(o=>{const l=parseInt(o.getAttribute("width"),10);isNaN(l)||(r+=l)}),s.forEach(o=>{const l=o.querySelectorAll("table");e==="body"?(o.style.flex="1",l.forEach(a=>{})):(o.style.flex=`0 0 ${r}px`,o.style.width=`${r}px`,o.style.minWidth=`${r}px`,o.style.maxWidth=`${r}px`,l.forEach(a=>{}))})})},"#updateContainerWidths"));d(this,Li,h(()=>{[{selector:".ng-container-left",type:"left"},{selector:".ng-container-body",type:null},{selector:".ng-container-right",type:"right"}].forEach(({selector:s,type:i})=>{this.querySelector(`.ng-sheet-body ${s}`).appendChild(t(this,Cr).call(this,i))})},"#renderSplitContainers"));d(this,Cr,h(e=>{const s=t(this,qt).table.cloneNode(!0);return e==="left"?s.querySelectorAll("col, th, td").forEach(i=>{i.getAttribute("fixed")!=="left"&&i.remove()}):e==="right"?s.querySelectorAll("col, th, td").forEach(i=>{i.getAttribute("fixed")!=="right"&&i.remove()}):s.querySelectorAll("[fixed=left], [fixed=right]").forEach(i=>{i.remove()}),s},"#createSplitTable"));E(this,"getRowHeight",h(()=>t(this,zt).getRowHeight(),"getRowHeight"));E(this,"scrollToX",h(e=>{const s=this.querySelector(".ng-sheet-body .ng-container-body");s&&(s.scrollLeft=e)},"scrollToX"));E(this,"scrollToY",h(e=>{const s=this.querySelector(".ng-sheet-body");s&&(s.scrollTop=e)},"scrollToY"));d(this,Tr,h(()=>{v.log("11111*****************"),t(this,kr).call(this),p(this,vi,new Nn(this)),p(this,Si,new Dn(this)),p(this,Ee,new $n(this)),p(this,xs,new Fn(this)),p(this,Ai,new Pi(this)),p(this,Ze,new Vi(this)),p(this,Ei,new zn(this)),p(this,ws,new qn(this)),t(this,Er,Yl)||p(this,Ar,new Bn(this)),t(this,Je).mainBody.addEventListener("scroll",()=>{this.querySelector("nine-table-hscrollbar").refresh()})},"#init"));d(this,kr,h(()=>{v.log("11111*****************"),Ci.SCROLLBAR_SIZE,v.log("2222*****************"),this.innerHTML=`
|
|
854
247
|
<div class="ng-sheet-body">
|
|
855
248
|
<div class="ng-sheet-body-content">
|
|
856
249
|
<div class="ng-container-left"></div>
|
|
@@ -880,10 +273,10 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
880
273
|
|
|
881
274
|
<div class="ng-col-mover-grip"></div>
|
|
882
275
|
<div class="ng-col-mover-indi"></div>
|
|
883
|
-
`,v.log("3333*****************"),
|
|
276
|
+
`,v.log("3333*****************"),p(this,Je,{mainBody:this.querySelector(".ng-sheet-body .ng-container-body"),hscrollbar:this.querySelector("nine-table-hscrollbar"),vscrollbar:this.querySelector("nine-table-vscrollbar"),content:this.querySelector(".ng-sheet-body .ng-sheet-body-content"),scrollHolder:this.querySelector(".ng-sheet-body .ng-virtual-height-holder")}),v.log("444*****************")},"#render"));d(this,Ir,h(()=>{v.log("**********************","#syncHeaderAndFooterHeights");const e=this.querySelector(".ng-container-left table"),s=this.querySelector(".ng-container-body table"),i=this.querySelector(".ng-container-right table"),r=Array.from(e.querySelectorAll("thead tr:not(.col-indicator-rowgroup)")),o=Array.from(s.querySelectorAll("thead tr:not(.col-indicator-rowgroup)")),l=Array.from(i.querySelectorAll("thead tr:not(.col-indicator-rowgroup)"));t(this,Ri).call(this,r,o,l);const a=Array.from(e.querySelectorAll("tfoot tr")),c=Array.from(s.querySelectorAll("tfoot tr")),u=Array.from(i.querySelectorAll("tfoot tr"));t(this,Ri).call(this,a,c,u)},"#syncHeaderAndFooterHeights"));d(this,Ri,h((e,s,i)=>{var o,l,a;const r=Math.max(e.length,s.length,i.length);for(let c=0;c<r;c++){const u=[((o=e[c])==null?void 0:o.getBoundingClientRect().height)||0,((l=s[c])==null?void 0:l.getBoundingClientRect().height)||0,((a=i[c])==null?void 0:a.getBoundingClientRect().height)||0],g=Math.max(...u);g>0&&(e[c]&&(e[c].style.height=`${g}px`),s[c]&&(s[c].style.height=`${g}px`),i[c]&&(i[c].style.height=`${g}px`))}},"#applyMaxHeights"));d(this,qr,h(()=>{const e=this.querySelector(".ng-sheet-body");if(!e)return;let s=null;e.addEventListener("mouseover",i=>{const r=i.target.closest("tr");if(!r||!r.dataset.row&&r.dataset.row!=="0")return;const o=r.dataset.row;s!==o&&(s=o,e.querySelectorAll(`tr[data-row="${o}"]`).forEach(l=>{l.classList.add("hover")}))}),e.addEventListener("mouseout",i=>{const r=i.target.closest("tr");if(!r)return;const o=i.relatedTarget;r.contains(o)||(e.querySelectorAll("tr.hover").forEach(l=>{l.classList.remove("hover")}),s=null)})},"#initRowHoverEvent"));v.log("11111"),p(this,zt,new Hn(this)),v.log("222"),p(this,ae,this.getRootNode().host),v.log("333")}connectedCallback(){t(this,Tr).call(this)}get index(){return t(this,wi)}get colResizer(){return t(this,Ee)}get filtering(){return t(this,Ei)}get grouping(){return t(this,ws)}get colMover(){return t(this,xs)}get colFix(){return t(this,Ai)}get rowManager(){return t(this,zt)}get selection(){return t(this,vi)}get navigation(){return t(this,Si)}get templateLength(){return t(this,qt).tbody.tr.length||0}get elements(){return t(this,Je)}get isAutoFitCol(){var i,r;const e=this.getAttribute("auto-fit-col")==="true"||((i=t(this,ae))==null?void 0:i.getAttribute("auto-fit-col"))==="true",s=((r=t(this,qt).table)==null?void 0:r.getAttribute("auto-fit-col"))==="true";return e||s}get sourceTable(){return t(this,qt).table}get source(){return t(this,qt)}recompileAndRefresh(){var e;t(this,qt).table&&(fe.recompile(t(this,qt).table),["left","right","body"].forEach(s=>{["header","body","footer"].forEach(i=>{const r=this.querySelector(`.ng-sheet-${i} .ng-container-${s}`);r&&r.querySelectorAll("table").forEach(o=>o.remove())})}),t(this,Li).call(this),t(this,Qe).call(this),t(this,zt).initialize(),this.isAutoFitCol?this.autoFit(!0):(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),requestAnimationFrame(()=>{var s;t(this,Qe).call(this),(s=t(this,zt))==null||s.refresh()}))}refreshLayout(){!this.classList.contains("active")||!t(this,qt).table||requestAnimationFrame(()=>{var e,s,i;t(this,Qe).call(this),this.isAutoFitCol?this.autoFit(!0):(e=this.querySelector("nine-table-hscrollbar"))==null||e.refresh(),t(this,Lr).call(this),(s=t(this,Ee))==null||s.refreshLayout(),(i=t(this,zt))==null||i.refresh()})}get view(){var e;return!t(this,Ze)&&((e=t(this,ae))!=null&&e.data)&&p(this,Ze,new Vi(this)),t(this,Ze)}disconnectedCallback(){var e,s;(e=t(this,Ee))==null||e.destroy(),(s=t(this,xs))==null||s.destroy(),this.innerHTML=""}};wi=new WeakMap,ae=new WeakMap,zt=new WeakMap,vi=new WeakMap,Si=new WeakMap,Ee=new WeakMap,xs=new WeakMap,Ai=new WeakMap,Ar=new WeakMap,Ei=new WeakMap,ws=new WeakMap,Ze=new WeakMap,qt=new WeakMap,Je=new WeakMap,Er=new WeakSet,Yl=h(function(){return t(this,ae).hasAttribute("simple")||t(this,ae).getAttribute("theme")==="simple"},"#isSimple"),Lr=new WeakMap,Rr=new WeakMap,Qe=new WeakMap,Li=new WeakMap,Cr=new WeakMap,Tr=new WeakMap,kr=new WeakMap,Ir=new WeakMap,Ri=new WeakMap,qr=new WeakMap,h(Ci,"NineTableSheet"),E(Ci,"SCROLLBAR_SIZE",16);let Xi=Ci;customElements.get("nine-table-sheet")||customElements.define("nine-table-sheet",Xi);const Do=class Do{constructor(n){d(this,it);d(this,Mr,h(()=>{t(this,Hr).call(this),new ResizeObserver(n=>{for(let e of n)t(this,it).getAttribute("auto-height")==="true"&&t(this,Ti).call(this)}).observe(t(this,it))},"#init"));d(this,Ti,h(()=>{const n=Array.from(t(this,it).shadowRoot.querySelectorAll("nine-table-sheet.active"));if(n.length===0)return;const e=parseInt(t(this,it).getAttribute("max-display-row"),10)||10,s=Math.max(...n.map(u=>u.getRowHeight())),i=t(this,it).shadowRoot.querySelector("nine-table-toolbar"),r=t(this,it).shadowRoot.querySelector("nine-table-sheets-footer"),o=i?i.getBoundingClientRect().height:0,l=r?r.getBoundingClientRect().height:0,a=Xi.SCROLLBAR_SIZE,c=e*s+o+l+a;t(this,it).style.height=`${c}px`},"#applyAutoHeight"));d(this,Hr,h(()=>{const e=Array.from(t(this,it).children).filter(c=>c.tagName.toUpperCase()==="TABLE"),s=t(this,it).getAttribute("auto-height")==="true",i=e.length,r=e.map((c,u)=>{const g=u===0?"active":"",f=c.id||`sheet${u+1}`,b=`<nine-table-sheet class="${g}" data-index="${u}" data-sheet-id="${f}" id="${f}"></nine-table-sheet>`,m=u<i-1?`<nine-splitter class="h" data-split-index="${u}"></nine-splitter>`:"";return b+m}).join(""),o=["layout.css","nine-table-sheet.css"],l=o.map(c=>`@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.36/dist/css/${c}";`),a=[];nine.cssPath&&o.forEach(c=>{a.push(`@import "${nine.cssPath}/${c}";`)}),t(this,it).shadowRoot.innerHTML=`
|
|
884
277
|
<style>
|
|
885
|
-
|
|
886
|
-
|
|
278
|
+
${[...l,...a].join(`
|
|
279
|
+
`)}
|
|
887
280
|
</style>
|
|
888
281
|
|
|
889
282
|
<nine-table-toolbar></nine-table-toolbar>
|
|
@@ -893,18 +286,18 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
893
286
|
<div class="ng-loading-bar"></div>
|
|
894
287
|
<nine-table-sheets>
|
|
895
288
|
<nine-table-sheets-body>
|
|
896
|
-
${
|
|
289
|
+
${r}
|
|
897
290
|
</nine-table-sheets-body>
|
|
898
291
|
<nine-table-sheets-footer></nine-table-sheets-footer>
|
|
899
292
|
</nine-table-sheets>
|
|
900
293
|
<nine-table-analysis></nine-table-analysis>
|
|
901
294
|
</nine-table-body>
|
|
902
295
|
<nine-table-footer></nine-table-footer>
|
|
903
|
-
`,t(this,it).shadowRoot.querySelectorAll("nine-table-sheet").forEach((
|
|
296
|
+
`,t(this,it).shadowRoot.querySelectorAll("nine-table-sheet").forEach((c,u)=>{e[u]&&setTimeout(()=>{c.generate(e[u],u),s&&t(this,Ti).call(this)})})},"#render"));p(this,it,n),t(this,Mr).call(this)}set loading(n){n?t(this,it).classList.add("loading"):t(this,it).classList.remove("loading")}};it=new WeakMap,Mr=new WeakMap,Ti=new WeakMap,Hr=new WeakMap,h(Do,"LayoutManager");let Xn=Do;const $o=class $o{constructor(n){d(this,ki);d(this,vs);d(this,Ii,new Map);p(this,ki,n),p(this,vs,n.fields.get())}rewriteExpr(n){return!n||!t(this,vs).length?n:n.replace(/data\.([a-zA-Z_$][\w$]*)/g,(e,s)=>{const i=t(this,vs).indexOf(s);return i>=0?`rowItem.v[${i}]`:e})}precompile(n){return n&&this.rewriteExpr(n)}evaluate(n,e,s=0){if(n==null)return"";try{const i=String(n).trim(),r=this.rewriteExpr(i);if(r.includes("data.")||r.includes("rowItem.v")||r.includes("host.")||r.includes("(")){let o=t(this,Ii).get(r);return o||(o=new Function("rowItem","row","host",`
|
|
904
297
|
const data = rowItem;
|
|
905
298
|
if (!data && !host) return "";
|
|
906
|
-
return ${
|
|
907
|
-
`),t(this,Ii).set(
|
|
299
|
+
return ${r};
|
|
300
|
+
`),t(this,Ii).set(r,o)),o(e,s,t(this,ki))}return r}catch{return n}}};ki=new WeakMap,vs=new WeakMap,Ii=new WeakMap,h($o,"ExprEngine");let _n=$o;const Fo=class Fo extends HTMLElement{constructor(){super();d(this,Dr);d(this,qi);d(this,Le);d(this,Mi);d(this,Ss,0);d(this,Nr,h(()=>{let e=0;const s=50,i=setInterval(()=>{e++;const r=this.shadow.querySelectorAll("nine-table-sheet");if(e>=s&&clearInterval(i),r.length>=t(this,Ss)){let o=0;r.forEach(l=>{l.loaded&&o++}),o>=t(this,Ss)&&(clearInterval(i),this.loaded=!0,this.dispatchEvent(new CustomEvent(Dt.EVENT.LOAD,{bubbles:!0,detail:{target:this}})))}},100)},"#dispatchLoad"));E(this,"sheet",h(e=>{if(e===null||e<0)return this.activeSheet;const s=Array.from(this.shadow.querySelectorAll("nine-table-sheet"));return typeof e=="number"?s[e]||null:typeof e=="string"?this.shadow.querySelector(`nine-table-sheet#${e}, nine-table-sheet[data-sheet-id="${e}"]`)||null:s[0]||null},"sheet"));E(this,"execute",h(e=>{this.loading=!0,setTimeout(()=>{try{e.call(this)}finally{this.loading=!1}})},"execute"));p(this,qi,this.attachShadow({mode:"open"})),p(this,Le,new An(this))}connectedCallback(){setTimeout(()=>{var e;p(this,Ss,(e=this.querySelectorAll("table"))==null?void 0:e.length),this.fields=new En(this),this.exprEngine=new _n(this),A(this,Dr,Zl).call(this),p(this,Mi,new Xn(this)),t(this,Nr).call(this)})}disconnectedCallback(){v.log("NineTable disconnected.")}get shadow(){return t(this,qi)}get dataManager(){return t(this,Le)}get data(){return t(this,Le).data}get row(){return t(this,Le).row}setData(e){t(this,Le).data.set(e),this.refresh()}refresh(){var e;(e=this.activeSheet)==null||e.invalidate()}set loading(e){t(this,Mi).loading=e}rerenderer(){var e;(e=this.activeSheet)==null||e.querySelectorAll("tbody.body th,tbody.body td").forEach(s=>{const i=Array.from(s.children).find(r=>r.tagName.toLowerCase().startsWith("cell-")&&typeof r.rerenderer=="function");i==null||i.rerenderer()})}get sheets(){return Array.from(this.shadow.querySelectorAll("nine-table-sheet"))}get activeSheet(){return this.shadow.querySelector("nine-table-sheet.active")||null}};qi=new WeakMap,Le=new WeakMap,Mi=new WeakMap,Ss=new WeakMap,Nr=new WeakMap,Dr=new WeakSet,Zl=h(function(){const e=new Set;this.querySelectorAll("[data-source]").forEach(s=>{const i=s.getAttribute("data-source");if(!i)return;const r=i.matchAll(/(?:host\.)?([a-zA-Z0-9_$]+)\s*\(/g);for(const o of r){const l=o[1];l&&l!=="host"&&e.add(l)}}),e.forEach(s=>{let i=null;Object.defineProperty(this,s,{set:h(r=>{i=r,this.rerenderer()},"set"),get:h(()=>i,"get"),configurable:!0,enumerable:!0})})},"#bindDynamicSetters"),h(Fo,"NineTable");let _i=Fo;customElements.get("nine-table")||customElements.define("nine-table",_i),customElements.get("nine-table-simple")||customElements.define("nine-table-simple",class extends _i{connectedCallback(){this.setAttribute("theme","simple"),super.connectedCallback()}});const Hi=class Hi extends HTMLElement{constructor(){super()}applyBaseStyle(){this.constructor.name}connectedCallback(){}};h(Hi,"BasicCellElement"),E(Hi,"_styleCache",new Map),E(Hi,"_customStyleCache",new Map);let Un=Hi;const wl=new Map,Wo=class Wo extends Un{constructor(){super();d(this,I);d(this,Ni);d(this,dt);d(this,q);d(this,ts);E(this,"getDisplayText",h((e="")=>{if(v.log("================================="),!t(this,q)||!t(this,q).closest("tbody"))return e;const s=t(this,dt).data;if(v.log("==============================",s),!s)return e;const i=t(this,q).dataset.expr,r=t(this,q).dataset.bind,o=parseInt(t(this,q).dataset.row,10);if(i)try{return t(this,dt).getAttribute("grouping")==="true"?this.getGroupExprValue(i,t(this,dt).data,o,t(this,q)):t(this,I).exprEngine.evaluate(i,t(this,dt).data,o)}catch(l){return console.trace(l),e}if(v.log("==============================",r,this.value),r){const l=this.value;return l??e}return e},"getDisplayText"));E(this,"getGroupExprValue",h((e,s,i,r)=>{var o,l,a,c,u,g;if(!e)return"";try{i=parseInt(i,10);const f=e.replace("()","").trim();if(t(this,I)&&typeof t(this,I)[f]=="function")return t(this,I)[f].call(this,s,i,r);const b=f.match(/^(\w+)\s*\(\s*([\w\-]*)\s*\)/);if(b){const m=s[GROUP_IDX.CHILDREN],y=(l=(o=t(this,I))==null?void 0:o.data)!=null&&l.getArray?t(this,I).data.getArray():[],x=m?m.map(C=>y[C]).filter(Boolean):[],[,w,S]=b,R=t(this,I);switch(w.toLowerCase()){case"count":return x.length;case"sum":{const C=((c=(a=R==null?void 0:R.fields)==null?void 0:a.indexOf)==null?void 0:c.call(a,S))??-1;return x.reduce((W,T)=>{var _;const D=C>=0?(_=T.v)==null?void 0:_[C]:T[S];return W+(Number(D)||0)},0)}case"avg":{if(x.length===0)return 0;const C=((g=(u=R==null?void 0:R.fields)==null?void 0:u.indexOf)==null?void 0:g.call(u,S))??-1;return x.reduce((T,D)=>{var rt;const _=C>=0?(rt=D.v)==null?void 0:rt[C]:D[S];return T+(Number(_)||0)},0)/x.length}}}if(t(this,I)&&typeof t(this,I).exprFunction=="function")return t(this,I).exprFunction(e).call(this,s,i,t(this,I).data);if(e.includes("data.")||e.includes("childRecords")||e.includes("groupRecord")){let m=wl.get("grp_"+e);return m||(m=new Function("groupRecord","row","cell","host",`
|
|
908
301
|
const indices = groupRecord[3]; // GROUP_IDX.CHILDREN = 3
|
|
909
302
|
const allRecords = host?.data?.getArray ? host.data.getArray() : [];
|
|
910
303
|
|
|
@@ -928,7 +321,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
928
321
|
|
|
929
322
|
const data = childRecords; // data.length 등을 쓸 수 있도록 호환
|
|
930
323
|
return ${e};
|
|
931
|
-
`),wl.set("grp_"+e,m)),m(s,i,
|
|
324
|
+
`),wl.set("grp_"+e,m)),m(s,i,r,t(this,I))}return e}catch(f){return console.error("Group expr evaluation error:",e,f),e}},"getGroupExprValue"))}get host(){return t(this,I)}get sheet(){return t(this,Ni)}get cell(){return t(this,q)}get tr(){return t(this,dt)}get attr(){return t(this,ts)}connectedCallback(){super.connectedCallback(),p(this,I,this.getRootNode().host),p(this,q,this.closest("th,td")),p(this,dt,t(this,q).closest("tr")),p(this,Ni,t(this,dt).closest("nine-table-sheet")),t(this,q).classList.add(this.tagName),p(this,ts,{});for(let i=0;i<t(this,q).attributes.length;i++){const r=t(this,q).attributes[i].name;["text-align","class","cell-type","data-bind","data-expr","data-col","tabindex"].includes(r)||(t(this,ts)[r]=t(this,q).attributes[i].value)}if(!t(this,q))return;const e=this.shadowRoot||this;e.querySelectorAll("button, ng-expand-button").forEach(i=>{i.addEventListener("click",()=>{var a,c;let r=this.getAttribute("onbuttonclick")||this.getAttribute("onButtonClick")||((a=t(this,q))==null?void 0:a.getAttribute("onbuttonclick"))||((c=t(this,q))==null?void 0:c.getAttribute("onButtonClick"));const o=this.data,l=parseInt(t(this,q).dataset.row,10);if(r&&t(this,I)){r=r.replace("()","");const u=r.match(/^(\w+)\s*\(/),g=(u==null?void 0:u[1])||r;typeof t(this,I)[g]=="function"?t(this,I)[g].call(t(this,I),o,l,t(this,q)):typeof t(this,I).exprFunction=="function"&&t(this,I).exprFunction(r).call(this,o,l)}})});const s=e.querySelector(".renderer");s&&this.getAttribute("link")==="true"&&(s.classList.add("link"),s.addEventListener("click",()=>{var l;let i=this.getAttribute("onlinkclick")||this.getAttribute("onLinkClick");const r=this.data,o=parseInt(t(this,q).dataset.row,10);if(i&&t(this,I)){i=i.replace("()","");const a=i.match(/^(\w+)\s*\(/),c=(a==null?void 0:a[1])||i;typeof t(this,I)[c]=="function"?t(this,I)[c].call(t(this,I),r,o,t(this,q)):typeof t(this,I).exprFunction=="function"&&t(this,I).exprFunction(i).call(this,r,o)}(l=t(this,I))==null||l.dispatchEvent(new CustomEvent(ninegrid.EVENT.LINK_CLICK,{detail:{target:t(this,q),data:r,currow:o},bubbles:!0,composed:!0}))}))}get data(){var i;const e=(i=t(this,dt))==null?void 0:i.data;if(!e)return null;if(!e.v)return e;const s=t(this,I);return new Proxy(e,{get(r,o){var a,c;if(o==="__ng")return r.__ng;if(o==="v")return r.v;const l=((c=(a=s==null?void 0:s.fields)==null?void 0:a.indexOf)==null?void 0:c.call(a,o))??-1;return l>=0?r.v[l]:r[o]}})}get value(){var i,r;if(!t(this,q)||!((i=t(this,dt))!=null&&i.data))return"";const e=(r=t(this,q).dataset)==null?void 0:r.bind;if(!e)return"";const s=t(this,dt).data;if(s.v&&Array.isArray(s.v)){const o=t(this,I).fields.get().indexOf(e)??-1;return o>=0?s.v[o]??"":""}return s[e]??""}set value(e){var o;if(!t(this,q)||!((o=t(this,I))!=null&&o.data))return;const s=parseInt(t(this,q).dataset.row,10),i=t(this,q).dataset.bind;if(isNaN(s)||!i)return;const r=this.getAttribute("update-row-state")!=="false";t(this,I).data.setValue(s,i,e,r)}get row(){var e,s;return parseInt((s=(e=t(this,q))==null?void 0:e.dataset)==null?void 0:s.row,10)}get index(){var e,s;return parseInt((s=(e=t(this,q))==null?void 0:e.dataset)==null?void 0:s.index,10)}refresh(){if(!t(this,q)||!t(this,dt))return;const e=this.value;return["color","background","background-color","class","visible","enable"].forEach(s=>{const i=t(this,ts)[s];if(i){const r=t(this,I).exprEngine.evaluate(i,t(this,dt).data,parseInt(t(this,q).dataset.row,10));s==="visible"?this.style.display=r?"":"none":s==="enable"?(this.querySelectorAll("input, button, textarea, select").forEach(o=>{o.disabled=!r}),r?t(this,q).removeAttribute("disabled"):t(this,q).setAttribute("disabled","true")):t(this,q).style[s]=r}}),e}getExprValue(e,s,i){return t(this,I).exprEngine.evaluate(e,s,i)}};I=new WeakMap,Ni=new WeakMap,dt=new WeakMap,q=new WeakMap,ts=new WeakMap,h(Wo,"CellElement");let hs=Wo;const Oo=class Oo extends hs{constructor(){super();E(this,"getExprValue",h((e,s,i,r)=>super.getExprValue(e,s,i,r),"getExprValue"))}get host(){return super.host}get sheet(){return super.sheet}get cell(){return super.cell}get tr(){return super.tr}get attr(){return super.attr}getExprValue(e,s,i,r){return super.getExprValue(e,s,i,r)}connectedCallback(){super.connectedCallback()}refresh(){return super.refresh()}};h(Oo,"EditableCellElement");let Jt=Oo;const zo=class zo extends Jt{constructor(){super();d(this,es);E(this,"refresh",h(()=>{super.refresh(),t(this,es).value=this.value},"refresh"));d(this,$r,h(()=>{t(this,es).addEventListener("input",e=>{const s=this.cell.getAttribute("maxbyte")||this.cell.getAttribute("max-byte");if(s){const i=Number(s);nine.getByteLength(e.target.value)>i&&(e.target.value=nine.cut(e.target.value,i),this.value=e.target.value)}}),t(this,es).addEventListener("change",e=>{this.value=e.target.value,super.sheet.rowManager.refresh(!0)})},"#initEvent"));d(this,Fr,h(()=>{this.innerHTML=`
|
|
932
325
|
<style>
|
|
933
326
|
cell-input {
|
|
934
327
|
input {
|
|
@@ -957,7 +350,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
957
350
|
</style>
|
|
958
351
|
|
|
959
352
|
<input type="text" ondragstart="return false;">
|
|
960
|
-
`},"#renderer"))}connectedCallback(){super.connectedCallback(),t(this,
|
|
353
|
+
`},"#renderer"))}connectedCallback(){super.connectedCallback(),t(this,Fr).call(this),p(this,es,this.querySelector("input")),t(this,$r).call(this)}};es=new WeakMap,$r=new WeakMap,Fr=new WeakMap,h(zo,"CellInputText");let Gn=zo;customElements.get("cell-input")||customElements.define("cell-input",Gn);const Bo=class Bo extends Jt{constructor(){super();d(this,Mt);d(this,Wr,h(()=>{for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name);this.innerHTML=`
|
|
961
354
|
<style>
|
|
962
355
|
cell-input-number {
|
|
963
356
|
input[type=text].border-left-none {
|
|
@@ -998,7 +391,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
998
391
|
</style>
|
|
999
392
|
|
|
1000
393
|
<input type="text" ${e.join(" ")} ondragstart="return false;">
|
|
1001
|
-
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();return t(this,Mt)&&(t(this,Mt).value=e??"",t(this,
|
|
394
|
+
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();return t(this,Mt)&&(t(this,Mt).value=e??"",t(this,Or).call(this,t(this,Mt).value)),e},"refresh"));d(this,Or,h(e=>{if(t(this,Mt)&&(super.cell.classList.remove("invalid"),e!==""&&e!==null&&e!==void 0)){const s=Number(e);if(isNaN(s)||super.attr.max!==null&&super.attr.max!==void 0&&s>Number(super.attr.max)||super.attr.min!==null&&super.attr.min!==void 0&&s<Number(super.attr.min))super.cell.classList.add("invalid");else if(super.attr.scale!==null&&super.attr.scale!==void 0){const i=String(e),r=i.indexOf(".");r>=0&&i.substring(r+1).length>Number(super.attr.scale)&&super.cell.classList.add("invalid")}}},"#validateInput"));d(this,zr,h(e=>{if(["Escape","Enter","Tab","Home","End","ArrowLeft","ArrowRight","PageUp","PageDown","Backspace","Delete"].includes(e.code))return;const s=e.target,i=s.value,r=s.selectionStart;s.selectionEnd;const o=e.key;if(o==="-"&&(i.includes("-")||r!==0)){e.preventDefault();return}if(o==="."){const c=Number(super.attr.scale);if(isNaN(c)||c<=0||i.includes(".")){e.preventDefault();return}}let l=[];super.attr.scale!==null&&super.attr.scale!==void 0&&Number(super.attr.scale)>0&&l.push("."),(super.attr.min===null||super.attr.min===void 0||Number(super.attr.min)>0)&&l.push("-");const a=e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105;if(!a&&!l.includes(e.key)){e.preventDefault();return}if(super.attr.scale!==null&&super.attr.scale!==void 0&&a&&e.target.selectionStart==e.target.selectionEnd){const c=e.target.value,u=c.indexOf(".");u>=0&&e.target.selectionStart>u&&c.substr(u+1).length>=Number(super.attr.scale)&&e.preventDefault()}super.attr.maxbyte&&nine.getByteLength(e.target.value)>=Number(super.attr.maxbyte)&&e.target.selectionStart==e.target.selectionEnd&&e.preventDefault()},"#onKeyDown"));this.applyBaseStyle()}connectedCallback(){t(this,Wr).call(this),super.connectedCallback(),p(this,Mt,this.querySelector("input")),t(this,Mt)&&(t(this,Mt).addEventListener("keydown",t(this,zr)),t(this,Mt).addEventListener("input",e=>{this.value=e.target.value,super.sheet.rowManager.refresh(!0)}),t(this,Mt).addEventListener("change",e=>{this.value=e.target.value,super.sheet.rowManager.refresh(!0)}))}};Mt=new WeakMap,Wr=new WeakMap,Or=new WeakMap,zr=new WeakMap,h(Bo,"CellInputNumber");let jn=Bo;customElements.get("cell-input-number")||customElements.define("cell-input-number",jn);const Po=class Po extends Jt{constructor(){super();d(this,xt);d(this,As);d(this,Br,h(()=>{for(var e=[],s=0;s<this.attributes.length;s++)["type","maxlength","maxbyte","min","max","step","scale","text-align"].includes(this.attributes[s].name);this.innerHTML=`
|
|
1002
395
|
<style>
|
|
1003
396
|
cell-input-color {
|
|
1004
397
|
--position: relative;
|
|
@@ -1085,7 +478,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1085
478
|
|
|
1086
479
|
<input type="color" ${e.join(" ")} ondragstart="return false;">
|
|
1087
480
|
<button tabindex="-1" type="button"></button>
|
|
1088
|
-
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(t(this,xt)){const s=e!=null&&e!==""?e:"#ffffff";t(this,xt).value=s,t(this,Es).call(this,s)}return e},"refresh"));d(this,Es,h(e=>{!t(this,xt)||!super.cell||(super.cell.classList.remove("invalid"),this.classList.remove("invalid"),e!==""&&e!==null&&e!==void 0&&(t(this,
|
|
481
|
+
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(t(this,xt)){const s=e!=null&&e!==""?e:"#ffffff";t(this,xt).value=s,t(this,Es).call(this,s)}return e},"refresh"));d(this,Es,h(e=>{!t(this,xt)||!super.cell||(super.cell.classList.remove("invalid"),this.classList.remove("invalid"),e!==""&&e!==null&&e!==void 0&&(t(this,Pr).call(this,e)||(super.cell.classList.add("invalid"),this.classList.add("invalid"))))},"#validateInput"));d(this,Pr,h(e=>{if(typeof e!="string"||e.length!=7||!e.startsWith("#"))return!1;var s=parseInt(e.substr(1,2),16),i=parseInt(e.substr(3,2),16),r=parseInt(e.substr(5,2),16);return!(isNaN(s)||isNaN(i)||isNaN(r)||s<0||s>255||i<0||i>255||r<0||r>255)},"#isValidColor"));this.applyBaseStyle()}connectedCallback(){t(this,Br).call(this),super.connectedCallback(),p(this,xt,this.querySelector("input[type=color]")),p(this,As,this.querySelector("button")),t(this,xt)&&(t(this,As)&&t(this,As).addEventListener("click",()=>{t(this,xt).click()}),t(this,xt).addEventListener("input",e=>{const s=e.target.value;this.value=s,t(this,Es).call(this,s),super.sheet.rowManager.refresh(!0)}),t(this,xt).addEventListener("change",e=>{const s=e.target.value;this.value=s,t(this,Es).call(this,s),super.sheet.rowManager.refresh(!0)}),t(this,xt).addEventListener("keydown",e=>{["Enter"].includes(e.code)?t(this,xt).click():["Escape"].includes(e.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(e))}))}};xt=new WeakMap,As=new WeakMap,Br=new WeakMap,Es=new WeakMap,Pr=new WeakMap,h(Po,"CellInputColor");let Kn=Po;customElements.get("cell-input-color")||customElements.define("cell-input-color",Kn);const Vo=class Vo extends Jt{constructor(){super();d(this,wt);d(this,ce);d(this,Vr,h(()=>{var r;const e=this.closest("th,td");parseInt(((r=this.closest("tr"))==null?void 0:r.style.height)||"26",10)-1;let s=[];for(var i=0;i<e.attributes.length;i++)["value","max","min","step"].includes(e.attributes[i].name)&&s.push(`${e.attributes[i].name}="${e.attributes[i].value}"`);this.innerHTML=`
|
|
1089
482
|
<style>
|
|
1090
483
|
cell-input-date {
|
|
1091
484
|
height: 100%;
|
|
@@ -1169,7 +562,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1169
562
|
${s.join(" ")}
|
|
1170
563
|
required
|
|
1171
564
|
/>
|
|
1172
|
-
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(!t(this,wt))return e;let s=e;if(s)switch(t(this,ce)){case"date":s=s.substr(0,10);break;case"datetime-local":s=s.substr(0,16);break;case"time":var i=new Date(e);i!="Invalid Date"&&!isNaN(i)&&(s=("00"+i.getHours()).slice(-2)+":"+("00"+i.getMinutes()).slice(-2));break;case"month":var i=new Date(e);i!="Invalid Date"&&!isNaN(i)&&(s=("0000"+i.getFullYear()).slice(-4)+"-"+("00"+(i.getMonth()+1)).slice(-2));break}return t(this,wt).value=s||"",t(this,wt).classList.toggle("has-value",!!s),t(this,Ls).call(this,s),e},"refresh"));d(this,Ls,h(e=>{if(!t(this,wt)||!super.cell)return;const s=this.closest("th,td"),i=s==null?void 0:s.getAttribute("min"),
|
|
565
|
+
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(!t(this,wt))return e;let s=e;if(s)switch(t(this,ce)){case"date":s=s.substr(0,10);break;case"datetime-local":s=s.substr(0,16);break;case"time":var i=new Date(e);i!="Invalid Date"&&!isNaN(i)&&(s=("00"+i.getHours()).slice(-2)+":"+("00"+i.getMinutes()).slice(-2));break;case"month":var i=new Date(e);i!="Invalid Date"&&!isNaN(i)&&(s=("0000"+i.getFullYear()).slice(-4)+"-"+("00"+(i.getMonth()+1)).slice(-2));break}return t(this,wt).value=s||"",t(this,wt).classList.toggle("has-value",!!s),t(this,Ls).call(this,s),e},"refresh"));d(this,Ls,h(e=>{if(!t(this,wt)||!super.cell)return;const s=this.closest("th,td"),i=s==null?void 0:s.getAttribute("min"),r=s==null?void 0:s.getAttribute("max");if(super.cell.classList.remove("invalid"),e!==""&&e!==null&&e!==void 0){let o=t(this,Xr).call(this,e);o&&(i&&e<i&&(o=!1),r&&e>r&&(o=!1)),o||super.cell.classList.add("invalid")}},"#validateInput"));d(this,Xr,h(e=>{if(typeof e!="string")return!1;let s=!0;switch(t(this,ce)){case"date":case"datetime-local":const g=Number(e.substr(0,4)),f=Number(e.substr(5,2)),b=Number(e.substr(8,2));if(isNaN(g)||isNaN(f)||isNaN(b))s=!1;else if(f<1||f>12||b<1||b>31)s=!1;else if([4,6,9,11].includes(f)&&b==31)s=!1;else if(f==2){let m=g%4==0&&(g%100!=0||g%400==0);(b>29||b==29&&!m)&&(s=!1)}break}if(s)switch(t(this,ce)){case"datetime-local":var i=e.substr(10,1),r=Number(e.substr(11,2)),o=Number(e.substr(14,2));(i!="T"||isNaN(r)||isNaN(o)||r<0||r>23||o<0||o>59)&&(s=!1);break;case"month":var a=Number(e.substr(0,4)),l=Number(e.substr(5,2));(isNaN(a)||isNaN(l)||l<1||l>12)&&(s=!1);break;case"week":var a=Number(e.substr(0,4)),c=e.substr(5,1),u=Number(e.substr(6,2));(c!="W"||isNaN(a)||isNaN(u)||u<=0||u>53)&&(s=!1);break}return s},"#isValidDate"));this.applyBaseStyle()}connectedCallback(){if(t(this,Vr).call(this),super.connectedCallback(),p(this,ce,super.attr["date-type"]||"date"),!["date","datetime-local","time","week","month"].includes(t(this,ce)))throw`invalid type : ${t(this,ce)}`;p(this,wt,this.querySelector("input")),t(this,wt)&&(t(this,wt).addEventListener("input",e=>{const s=e.target.value;this.value=s,t(this,wt).classList.toggle("has-value",!!s),t(this,Ls).call(this,s),super.sheet.rowManager.refresh(!0)}),t(this,wt).addEventListener("change",e=>{const s=e.target.value;this.value=s,t(this,Ls).call(this,s),super.sheet.rowManager.refresh(!0)}),t(this,wt).addEventListener("keydown",e=>{["Enter"].includes(e.code)||(["Escape"].includes(e.code)?this.owner.cell.currentCell=this.cell:["Tab","PageUp","PageDown","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)&&(this.owner.cell.currentCell=this.cell,this.owner.cell.moveCell(e)))}))}};wt=new WeakMap,ce=new WeakMap,Vr=new WeakMap,Ls=new WeakMap,Xr=new WeakMap,h(Vo,"CellInputDate");let Yn=Vo;customElements.get("cell-input-date")||customElements.define("cell-input-date",Yn);const Xo=class Xo extends Jt{constructor(){super();d(this,he);d(this,Rs);d(this,ss);d(this,Cs);d(this,Ts);d(this,_r,h(()=>{var e;p(this,he,this.querySelector("input")),p(this,Rs,this.querySelector("span")),p(this,Cs,super.attr["true-text"]||""),p(this,Ts,super.attr["false-text"]||""),this.closest("thead")&&t(this,he).addEventListener("change",s=>{var i;(i=super.sheet.querySelector(`tbody.body [data-col="${super.cell.dataset.col}"] cell-checkbox`))==null||i.selectAll(s.target.checked)}),(e=this.cell)==null||e.addEventListener("keydown",s=>{if(s.preventDefault(),s.code==="Space"||this.closest("thead")||this.cell.hasAttribute("readonly")||this.cell.classList.contains("readonly")||this.cell.getAttribute("disabled")==="true")return;const i=this.value===this.trueValue?this.falseValue:this.trueValue;t(this,ss)&&this.selectAll(!1),this.value=i,super.sheet.invalidate()}),t(this,he).addEventListener("change",s=>{this.closest("tbody")&&(t(this,ss)?(this.selectAll(!1),this.value=this.trueValue):this.value=s.target.checked?this.trueValue:this.falseValue,super.sheet.rowManager.refresh(!0))})},"#init"));d(this,Ur,h(()=>{const e=this.closest("th,td");p(this,ss,(e==null?void 0:e.getAttribute("is-radio"))||!1);const s=(e==null?void 0:e.getAttribute("true-value"))||!1,i=(e==null?void 0:e.getAttribute("content"))||"",r=t(this,ss)?`<input type="radio" value="${s}" />`:`<label><input type="checkbox" /><span>${i}</span></label>`;this.innerHTML=`
|
|
1173
566
|
<style>
|
|
1174
567
|
.CELL-CHECKBOX {
|
|
1175
568
|
cell-checkbox {
|
|
@@ -1251,8 +644,8 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1251
644
|
}
|
|
1252
645
|
|
|
1253
646
|
</style>
|
|
1254
|
-
${
|
|
1255
|
-
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(!this.closest("tbody")&&!this.closest("thead"))return e;if(t(this,he)&&(t(this,he).checked=e===this.trueValue,t(this,
|
|
647
|
+
${r}
|
|
648
|
+
`},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();if(!this.closest("tbody")&&!this.closest("thead"))return e;if(t(this,he)&&(t(this,he).checked=e===this.trueValue,t(this,Gr).call(this,e)),t(this,Rs)){const s=e===this.trueValue?t(this,Cs):e===this.falseValue?t(this,Ts):e;t(this,Rs).textContent=s}return e},"refresh"));d(this,Gr,h(e=>{t(this,he)&&(super.cell.classList.remove("invalid"),e!==""&&e!==null&&e!==void 0&&e!==this.trueValue&&e!==this.falseValue&&super.cell.classList.add("invalid"))},"#validateInput"));E(this,"selectAll",h(e=>{if(this.closest("thead"))return;const s=super.host.data.getArray(),i=super.host.fields.indexOf(super.cell.dataset.bind);if(!(i<0)){for(let r=0;r<s.length;r++)super.attr.enable&&super.getExprValue(super.attr.enable,s[r],r,super.cell)===!1||super.attr.readonly&&super.getExprValue(super.attr.readonly,s[r],r,super.cell)===!0||super.attr.visible&&super.getExprValue(super.attr.visible,s[r],r,super.cell)===!1||(s[r].v[i]=e?this.trueValue:this.falseValue);super.sheet.invalidate()}},"selectAll"))}connectedCallback(){t(this,Ur).call(this),super.connectedCallback(),t(this,_r).call(this)}get trueValue(){return super.attr["true-value"]||"Y"}get falseValue(){return super.attr["false-value"]||"N"}get dataSource(){return[{value:this.trueValue,text:t(this,Cs)},{value:this.falseValue,text:t(this,Ts)}]}};he=new WeakMap,Rs=new WeakMap,ss=new WeakMap,Cs=new WeakMap,Ts=new WeakMap,_r=new WeakMap,Ur=new WeakMap,Gr=new WeakMap,h(Xo,"CellCheckbox");let Zn=Xo;customElements.get("cell-checkbox")||customElements.define("cell-checkbox",Zn);const Ko=class Ko extends Jt{constructor(){super();d(this,is);d(this,Bt,[]);d(this,rs);d(this,ks);d(this,_o);d(this,Uo);d(this,Go);d(this,jo);d(this,jr,h(()=>{super.cell.addEventListener("keydown",e=>{if(e.preventDefault(),e.code!=="Space"||this.cell.hasAttribute("readonly")||this.cell.classList.contains("readonly")||this.cell.getAttribute("disabled")==="true")return;let s=-1;const i=Array.from(this.querySelectorAll("input"));i.forEach((r,o)=>{if(this.value===r.getAttribute("value"))return s=o,!1}),s=s===i.length-1?0:s>=0?s+1:0,this.value=i[s].getAttribute("value"),super.sheet.rowManager.refresh(!0)})},"#initEvent"));d(this,Di,h(()=>{var s;if(!super.sheet||!super.cell)return;const e=(s=super.cell)==null?void 0:s.getAttribute("data-source");if(e&&(p(this,Bt,super.getExprValue(e,super.tr.data,super.tr.dataset.row)),v.log("=============================================="),v.log(this.sheet,t(this,Bt)),setTimeout(()=>{v.log("1111")},300),t(this,is).replaceChildren(),t(this,Bt)&&Array.isArray(t(this,Bt)))){const i=document.createDocumentFragment();t(this,Bt).forEach(r=>{const o=r[t(this,rs)]!==void 0?r[t(this,rs)]:"",l=r[t(this,ks)]!==void 0?r[t(this,ks)]:"",a=document.createElement("label"),c=document.createElement("input");c.type="radio",c.value=o;const u=document.createElement("span");u.textContent=l,a.appendChild(c),a.appendChild(u),i.appendChild(a)}),t(this,is).appendChild(i),this.querySelectorAll("input").forEach(r=>{r.addEventListener("change",o=>{this.value=o.target.value,super.sheet.rowManager.refresh(!0)})})}},"#rendererRadio"));d(this,Kr,h(()=>{this.innerHTML=`
|
|
1256
649
|
<style>
|
|
1257
650
|
.CELL-RADIO {
|
|
1258
651
|
input[type="radio"] {
|
|
@@ -1368,7 +761,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1368
761
|
</style>
|
|
1369
762
|
|
|
1370
763
|
<div></div>
|
|
1371
|
-
`,
|
|
764
|
+
`,p(this,is,this.querySelector("div"))},"#renderer"));E(this,"rerenderer",h(()=>{t(this,Di).call(this),this.refresh()},"rerenderer"));E(this,"refresh",h(()=>{const e=super.refresh();return t(this,is)&&(this.querySelectorAll("input").forEach(s=>{s.checked=this.value==s.getAttribute("value")}),t(this,Yr).call(this)),e},"refresh"));d(this,Yr,h(()=>{if(!super.cell||(super.cell.classList.remove("invalid"),this.value===null||this.value===void 0||this.value===""||!Array.isArray(t(this,Bt))))return;t(this,Bt).findIndex(s=>this.value===s[t(this,rs)])<0&&super.cell.classList.add("invalid")},"#validateInput"));this.applyBaseStyle()}connectedCallback(){p(this,rs,this.closest("th,td").getAttribute("key-name")||"k"),p(this,ks,this.closest("th,td").getAttribute("value-name")||"v"),t(this,Kr).call(this),super.connectedCallback(),t(this,Di).call(this),t(this,jr).call(this)}get dataSource(){return t(this,Bt)}};is=new WeakMap,Bt=new WeakMap,rs=new WeakMap,ks=new WeakMap,_o=new WeakMap,Uo=new WeakMap,Go=new WeakMap,jo=new WeakMap,jr=new WeakMap,Di=new WeakMap,Kr=new WeakMap,Yr=new WeakMap,h(Ko,"CellRadio");let Jn=Ko;customElements.get("cell-radio")||customElements.define("cell-radio",Jn);const Yo=class Yo extends HTMLElement{constructor(){super();d(this,ot);d(this,Zr);d(this,Jr);d(this,Is,!1);d(this,Qr,h((e,s,i,r,o)=>{const l=this.querySelector("nine-table-simple");if(!l||!e||e.length===0)return;const a=t(this,ot).getAttribute("items");let c=[];a?c=a.split(",").map(f=>f.trim()):c=[i].filter(Boolean);const u=c.length;l.shadowRoot.querySelector(".ng-container-left").style.display=r?"":"none",l.shadowRoot.querySelectorAll("table colgroup col, tbody td").forEach((f,b)=>{v.log(f);const m=parseInt(f.dataset.col,10);m>=2&&(f.style.display=m-2>=u?"none":"")});const g=e.map(f=>{const b={CHK:"N",k:s&&f[s]!==void 0?f[s]:f[0]!==void 0?f[0]:""};return c.forEach((m,y)=>{b[`tmp${y+1}`]=f[m]!==void 0?f[m]:f[y]!==void 0?f[y]:""}),b});if(l.data.set(g),r&&t(this,ot).value){const f=String(t(this,ot).value).split(o||",");l.data.getValidData().forEach(b=>{f.includes(String(b.v[1]))&&(b.v[0]="Y")}),l.refreshData()}},"#initData"));E(this,"open",h((e,s,i,r,o,l)=>{p(this,ot,e),p(this,Zr,i),p(this,Jr,r),p(this,Is,!0),v.log(new Date),this.classList.add("active");const a=this.querySelector("nine-table-simple");if(!a||!s)return;this.querySelector(".search-input").value="",this.querySelector("#chkAll").checked=!0,s.length>10?this.classList.add("expand"):this.classList.remove("expand"),o?this.classList.add("multi"):this.classList.remove("multi");const c=e.closest("nine-table-sheet"),u=e.querySelector(".btn1");if(!u||!c)return;const g=u.getBoundingClientRect(),f=c.getBoundingClientRect();let b=g.left-f.left,m=g.bottom-f.top+2;const y=this.offsetWidth||250,x=this.offsetHeight||250;if(b+y>f.width&&(b=Math.max(0,f.width-y-5)),b<0&&(b=5),m+x>f.height){const w=g.top-f.top-x-2;w>=0?m=w:m=Math.max(0,f.height-x-5)}this.style.left=`${b}px`,this.style.top=`${m}px`,v.log(new Date),setTimeout(()=>{v.log(new Date),t(this,Qr).call(this,s,i,r,o,l),v.log(new Date);const w=a.shadowRoot.querySelector(".ng-container-body table tbody.body");w.__hasClickEvent||(w.addEventListener("mousedown",S=>{v.log("==========================================",S.target),S.target.closest("tr")&&(v.log("==========================================",o),o||t(this,tn).call(this,S))}),w.__hasClickEvent=!0),v.log(new Date)},100)},"open"));E(this,"close",h(()=>{this.classList.remove("active"),p(this,Is,!1),t(this,ot)&&t(this,ot).cell&&t(this,ot).cell.focus()},"close"));d(this,tn,h(e=>{const s=e.target.closest("nine-table-sheet"),i=e.target.closest("tr"),r=parseInt(i.dataset.row,10),o=s.view.get(r);t(this,ot).value=o.k,t(this,ot).sheet.rowManager.refresh(!0),this.close()},"#onClickRow"));d(this,en,h(()=>{const s=this.querySelector("nine-table-simple").data.getValidData(),i=[];s.forEach(r=>{r.v[0]==="Y"&&i.push(r.v[1])}),t(this,ot).value=i.join(t(this,ot).getAttribute("multi-separator")||","),t(this,ot).sheet.rowManager.refresh(!0),this.close()},"#onOk"));d(this,sn,h(e=>{const s=this.querySelector("nine-table-simple"),i=e.target.checked?"Y":"N";s.data.getValidData().forEach(r=>{r.v[0]=i}),s.refreshData()},"#onSelectAll"));d(this,rn,h(e=>{const s=e.target.value.toLowerCase(),i=this.querySelector("nine-table-simple");i.data.getValidDataNF().forEach(r=>{const o=Object.values(r.v).some(l=>l!=null&&String(l).toLowerCase().includes(s));r.__ng.filtered=!o}),i.data.resetRecords(),i.dataManager.viewRecords.reset()},"#onInput"));d(this,nn,h(()=>{this.querySelector(".search-input").addEventListener("input",t(this,rn)),this.querySelector("#btnOk").addEventListener("click",t(this,en)),this.querySelector("#chkAll").addEventListener("change",t(this,sn)),document.addEventListener("mousedown",e=>{(e.composedPath?e.composedPath():[]).includes(this)||this.close()})},"#initEvents"));d(this,on,h(()=>{this.innerHTML=`
|
|
1372
765
|
<style>
|
|
1373
766
|
|
|
1374
767
|
cell-combo-panel.active {
|
|
@@ -1477,7 +870,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1477
870
|
</div>
|
|
1478
871
|
<button id="btnOk">OK</button>
|
|
1479
872
|
</div>
|
|
1480
|
-
`},"#renderer"))}connectedCallback(){t(this,
|
|
873
|
+
`},"#renderer"))}connectedCallback(){t(this,on).call(this),t(this,nn).call(this)}get isOpen(){return t(this,Is)}get targetCell(){return t(this,ot)}};ot=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,Is=new WeakMap,Qr=new WeakMap,tn=new WeakMap,en=new WeakMap,sn=new WeakMap,rn=new WeakMap,nn=new WeakMap,on=new WeakMap,h(Yo,"CellComboPanel");let Qn=Yo;customElements.get("cell-combo-panel")||customElements.define("cell-combo-panel",Qn);const Zo=class Zo extends Jt{constructor(){super();d(this,qs);d(this,Pt,[]);d(this,Re);d(this,ns);d(this,os);d(this,Ce);d(this,Ht);E(this,"rerenderer",h(()=>{v.log("rerenderer"),t(this,$i).call(this),this.refresh()},"rerenderer"));d(this,$i,h(()=>{var s;if(!super.sheet||!super.cell)return;const e=(s=super.cell)==null?void 0:s.getAttribute("data-source");e&&p(this,Pt,super.getExprValue(e,super.tr.data,super.tr.dataset.row))},"#initData"));d(this,ln,h(()=>{this.addEventListener("keydown",e=>{e.code==="Enter"&&(e.preventDefault(),t(this,Fi).call(this))}),this.querySelectorAll("button").forEach(e=>{e.addEventListener("click",s=>{s.stopPropagation(),t(this,Fi).call(this)})})},"#initEvent"));d(this,Fi,h(()=>{v.log(new Date),t(this,Ht)||(p(this,Ht,super.sheet.querySelector("cell-combo-panel")),t(this,Ht)||(p(this,Ht,document.createElement("cell-combo-panel")),super.sheet.appendChild(t(this,Ht)))),v.log(new Date),t(this,Ht).isOpen&&t(this,Ht).targetCell===this?t(this,Ht).close():t(this,Ht).open(this,t(this,Pt),t(this,Re),t(this,ns),t(this,os),t(this,Ce)),v.log(new Date)},"#togglePanel"));d(this,an,h(()=>{this.innerHTML=`
|
|
1481
874
|
<style>
|
|
1482
875
|
cell-combo {
|
|
1483
876
|
height: 100%;
|
|
@@ -1541,9 +934,9 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1541
934
|
</style>
|
|
1542
935
|
<button class="btn1" type="button" tabindex="-1">Select</button>
|
|
1543
936
|
<button class="btn2" type="button" tabindex="-1"></button>
|
|
1544
|
-
`,
|
|
937
|
+
`,p(this,qs,this.querySelector(".btn1"))},"#renderer"));E(this,"refresh",h(()=>{const e=super.refresh();return t(this,qs)&&(t(this,qs).textContent=t(this,cn).call(this)||"Select",t(this,hn).call(this)),e},"refresh"));d(this,cn,h(()=>{if(!this.value||!Array.isArray(t(this,Pt)))return"";if(t(this,os)){const e=String(this.value).split(t(this,Ce));return t(this,Pt).filter(s=>e.includes(String(s[t(this,Re)]))).map(s=>s[t(this,ns)]).join(t(this,Ce))}else{const e=t(this,Pt).find(s=>String(s[t(this,Re)])===String(this.value));return e?e[t(this,ns)]:this.value}},"#getDisplayText"));d(this,hn,h(()=>{if(!super.cell||(super.cell.classList.remove("invalid"),this.value===null||this.value===void 0||this.value===""||!Array.isArray(t(this,Pt))))return;const e=t(this,os)?String(this.value).split(t(this,Ce)):[this.value];for(const s of e)if(t(this,Pt).findIndex(r=>String(s)===String(r[t(this,Re)]))<0){super.cell.classList.add("invalid");break}},"#validateInput"));this.applyBaseStyle()}connectedCallback(){t(this,an).call(this),super.connectedCallback(),p(this,Re,super.cell.getAttribute("key-name")||"k"),p(this,ns,super.cell.getAttribute("value-name")||"v"),p(this,os,super.cell.getAttribute("multi")==="true"),p(this,Ce,super.cell.getAttribute("multi-separator")||","),t(this,$i).call(this),t(this,ln).call(this)}get dataSource(){return t(this,Pt)}};qs=new WeakMap,Pt=new WeakMap,Re=new WeakMap,ns=new WeakMap,os=new WeakMap,Ce=new WeakMap,Ht=new WeakMap,$i=new WeakMap,ln=new WeakMap,Fi=new WeakMap,an=new WeakMap,cn=new WeakMap,hn=new WeakMap,h(Zo,"CellCombo");let to=Zo;customElements.get("cell-combo")||customElements.define("cell-combo",to);const Jo=class Jo extends hs{constructor(){super();d(this,Ms);E(this,"refresh",h(()=>{super.refresh(),this.cell.getAttribute("html")==="true"?t(this,Ms).innerHTML=this.getDisplayText():t(this,Ms).textContent=this.getDisplayText()},"refresh"));d(this,dn,h(()=>{this.innerHTML=`
|
|
1545
938
|
<span></span>
|
|
1546
|
-
`},"#renderer"))}connectedCallback(){super.connectedCallback(),t(this,
|
|
939
|
+
`},"#renderer"))}connectedCallback(){super.connectedCallback(),t(this,dn).call(this),p(this,Ms,this.querySelector("span"))}};Ms=new WeakMap,dn=new WeakMap,h(Jo,"CellRenderer");let eo=Jo;customElements.get("cell-renderer")||customElements.define("cell-renderer",eo);const Qo=class Qo extends hs{constructor(){super();d(this,ls);d(this,Wi,h(e=>{e.stopPropagation();const s=parseInt(this.cell.dataset.row,10),i=new CustomEvent(Dt.EVENT.CELL_BUTTON_CLICK,{bubbles:!0,composed:!0,detail:{originalEvent:e,cell:this.cell,row:s,col:parseInt(this.cell.dataset.col,10),bind:this.dataset.bind,data:this.host.data.get(s),value:this.value}});this.dispatchEvent(i)},"#cellButtonClick"));E(this,"refresh",h(()=>{const e=super.refresh?super.refresh():this.value;t(this,ls).innerHTML=this.getDisplayText(e)},"refresh"));d(this,un,h(()=>{const e=this.closest("th,td"),s="...",i=(parseInt(e.offsetHeight,10)||32)-8;this.innerHTML=`
|
|
1547
940
|
<style>
|
|
1548
941
|
/* 셀(td, th) 내부 패딩 제거 및 꽉 채우기 설정 */
|
|
1549
942
|
cell-button {
|
|
@@ -1582,7 +975,7 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1582
975
|
}
|
|
1583
976
|
</style>
|
|
1584
977
|
<button class="button">${s}</button>
|
|
1585
|
-
`},"#renderer"))}connectedCallback(){t(this,
|
|
978
|
+
`},"#renderer"))}connectedCallback(){t(this,un).call(this),super.connectedCallback(),p(this,ls,this.querySelector("button")),t(this,ls).removeEventListener("click",t(this,Wi)),t(this,ls).addEventListener("click",t(this,Wi))}};ls=new WeakMap,Wi=new WeakMap,un=new WeakMap,h(Qo,"CellButton");let so=Qo;customElements.get("cell-button")||customElements.define("cell-button",so);const tl=class tl extends hs{constructor(){super();d(this,Hs);d(this,Ns);d(this,fn);d(this,gn,h(()=>{this.innerHTML=`
|
|
1586
979
|
<style>
|
|
1587
980
|
cell-row-indicator {
|
|
1588
981
|
display: block;
|
|
@@ -1638,10 +1031,10 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1638
1031
|
<span class="ng-row-main"></span>
|
|
1639
1032
|
<span class="ng-row-sub"></span>
|
|
1640
1033
|
<span class="ng-row-status"></span>
|
|
1641
|
-
`},"#renderer"));E(this,"refresh",h(()=>{if(!this.cell||!this.tr)return;const e=this.row;if(isNaN(e))return;const s=this.tr.data;s&&s.__ng&&s.__ng.rowState;const i=this.index+1,
|
|
1034
|
+
`},"#renderer"));E(this,"refresh",h(()=>{if(!this.cell||!this.tr)return;const e=this.row;if(isNaN(e))return;const s=this.tr.data;s&&s.__ng&&s.__ng.rowState;const i=this.index+1,r=i.toLocaleString();if(i>=1e4){const a=r.length-4,c=r.substring(0,a+1),u=r.substring(a+1);t(this,Hs).innerHTML=`
|
|
1642
1035
|
<span class="ng-row-prefix">${c}</span>
|
|
1643
1036
|
<span class="ng-row-suffix">${u}</span>
|
|
1644
|
-
`}else t(this,Hs).innerHTML=`${
|
|
1037
|
+
`}else t(this,Hs).innerHTML=`${r}`;const o=!!this.sheet.querySelector("thead .asc,thead .desc"),l=!!this.sheet.querySelector("thead nine-table-filter-button.filtered");t(this,Ns).innerHTML=e,t(this,Ns).style.display=o||l?"":"none"},"refresh"));this.applyBaseStyle()}connectedCallback(){var e;t(this,gn).call(this),(e=super.connectedCallback)==null||e.call(this),this.cell&&(this.cell.removeAttribute("tabindex"),this.cell.dataset.bind="rowState",this.cell.dataset.expr||(this.cell.dataset.expr="data.__ng._[ninegrid.ROW.ORDER]"),this.cell.setAttribute("text-align","center")),p(this,Hs,this.querySelector(".ng-row-main")),p(this,Ns,this.querySelector(".ng-row-sub")),p(this,fn,this.querySelector(".ng-row-status"))}};Hs=new WeakMap,Ns=new WeakMap,fn=new WeakMap,gn=new WeakMap,h(tl,"CellRowIndicator");let io=tl;customElements.get("cell-row-indicator")||customElements.define("cell-row-indicator",io);const el=class el extends HTMLElement{constructor(){super();d(this,ut);d(this,Y);d(this,Ds,h(e=>{e.preventDefault(),e.stopPropagation(),this.classList.contains("expand")?this.collapse():this.expand()},"#onClick"));E(this,"expand",h(()=>{var r;if(!((r=t(this,ut))!=null&&r.colResizer)||!t(this,Y))return;const e=parseInt(t(this,Y).dataset.col,10),s=t(this,Y).colSpan||1;this.classList.remove("collapsed"),this.classList.add("expand"),t(this,Y).setAttribute("collapsed","false"),t(this,Y).style.color="";const i=parseInt(t(this,Y).dataset.expandWidth,10)||100;if(s===1)t(this,ut).colResizer.setColumnWidth(e,i);else{const o=Math.max(30,Math.floor(i/s));for(let l=0;l<s;l++)t(this,ut).colResizer.setColumnWidth(e+l,o)}requestAnimationFrame(()=>{typeof t(this,ut).refreshLayout=="function"&&t(this,ut).refreshLayout()})},"expand"));E(this,"collapse",h((e=!1)=>{var r;if(!((r=t(this,ut))!=null&&r.colResizer)||!t(this,Y))return;const s=parseInt(t(this,Y).dataset.col,10),i=t(this,Y).colSpan||1;if(this.classList.contains("expand")){const o=t(this,ut).querySelector(`colgroup col[data-col="${s}"]`),l=o?parseInt(o.getAttribute("width"),10):0;l>mt&&(t(this,Y).dataset.expandWidth=String(l*i))}if(this.classList.remove("expand"),this.classList.add("collapsed"),t(this,Y).setAttribute("collapsed","true"),t(this,Y).style.color="transparent",i===1)t(this,ut).colResizer.setColumnWidth(s,mt);else{const o=Math.max(10,Math.floor(mt/i));for(let l=0;l<i;l++)t(this,ut).colResizer.setColumnWidth(s+l,o)}requestAnimationFrame(()=>{typeof t(this,ut).refreshLayout=="function"&&t(this,ut).refreshLayout()})},"collapse"))}connectedCallback(){var s;p(this,Y,this.closest("th, td")),p(this,ut,this.closest("nine-table-sheet")),t(this,Y)&&(t(this,Y).style.position="relative"),this.getAttribute("collapsed")==="true"||((s=t(this,Y))==null?void 0:s.getAttribute("collapsed"))==="true"?requestAnimationFrame(()=>{this.collapse(!0)}):(this.classList.remove("collapsed"),this.classList.add("expand")),this.removeEventListener("click",t(this,Ds)),this.addEventListener("click",t(this,Ds))}disconnectedCallback(){this.removeEventListener("click",t(this,Ds))}};ut=new WeakMap,Y=new WeakMap,Ds=new WeakMap,h(el,"ColExpand");let ro=el;customElements.get("nine-table-col-expand")||customElements.define("nine-table-col-expand",ro);const sl=class sl extends HTMLElement{constructor(){super(...arguments);d(this,j);d(this,Q);d(this,vt);d(this,pn,h(e=>{const s=e.composedPath?e.composedPath():[],i=s.find(o=>o.tagName==="TH"||o.tagName==="TD");if(!i)return;const r=s.find(o=>o.tagName==="TABLE")||i.closest("table");e.preventDefault(),e.stopPropagation(),this.openMenu(e.clientX,e.clientY,i,r)},"#onContextMenu"))}connectedCallback(){var s,i;const e=this.getRootNode();p(this,Q,e instanceof ShadowRoot?e.host:this.closest("nine-table")||e.host),t(this,Q)||p(this,Q,((s=this.parentElement)==null?void 0:s.closest("nine-table"))||((i=this.assignedSlot)==null?void 0:i.closest("nine-table"))),t(this,Q)}openMenu(e,s,i,r){const o=t(this,Q).shadowRoot||t(this,Q);t(this,vt)||(p(this,vt,document.createElement("nine-table-menu-panel")),o.appendChild(t(this,vt)));const l=!!i.closest("thead"),a=A(this,j,Ql).call(this,r,l,i);t(this,vt).render(a,u=>A(this,j,ea).call(this,u,i,r));const c=A(this,j,wn).call(this,i);A(this,j,ta).call(this,c),t(this,vt).openAt(e,s)}disconnectedCallback(){var e;(e=t(this,Q))==null||e.removeEventListener("contextmenu",t(this,pn))}};Q=new WeakMap,vt=new WeakMap,pn=new WeakMap,j=new WeakSet,wn=h(function(e){return(e==null?void 0:e.closest("nine-table-sheet"))||t(this,Q).activeSheet||t(this,Q)},"#getTargetSheet"),ml=h(function(e){const s=A(this,j,wn).call(this,e);return s?(s.colFix||(s.colFix=new Pi(s)),s.colFix):null},"#getFixManager"),Jl=h(function(e,s){const i=[],r=s==null?void 0:s.id;return Array.from(e.querySelectorAll(":scope > ul")).forEach(l=>{const a=l.getAttribute("target-table");if(!a||r&&a===r){const c=A(this,j,yl).call(this,l);i.push(...c)}}),i},"#parseCustomMenuItems"),yl=h(function(e){const s=[];return Array.from(e.children).forEach(i=>{const r=i.tagName.toLowerCase();if(r==="hr"||i.classList.contains("separator")){s.push({type:"separator"});return}if(r==="li"){let o="";const l=i.querySelector(":scope > span");l?o=l.textContent.trim():o=Array.from(i.childNodes).filter(u=>u.nodeType===Node.TEXT_NODE).map(u=>u.textContent.trim()).join("");const a=i.querySelector(":scope > ul"),c={menuId:i.id||o,name:o,className:i.className||"",disabled:i.hasAttribute("disabled")||i.getAttribute("disabled")==="true",isCustom:!0};a&&(c.items=A(this,j,yl).call(this,a)),s.push(c)}}),s},"#traverseUl"),Ql=h(function(e,s,i){const r=this.getAttribute("use-default-menu")!=="false";let o=[];const l=A(this,j,Jl).call(this,this,e);l.length>0&&o.push(...l);const a=A(this,j,ml).call(this,i),c=(a==null?void 0:a.getFixState(i,e))??"none",u=s&&((a==null?void 0:a.canFixColumn(i,e))??!1);let g=null;c==="left"||c==="right"?g={menuId:"unfix-column",name:"Unfix Column",className:"ng-menu-unfix-col",disabled:!s}:g={menuId:"fix-column",name:"Fix Column",className:"ng-menu-fix-col",disabled:!u},r&&o.push({type:"separator"},{menuId:"sort",name:"Sort",className:"ng-menu-sort",disabled:!s},g,{type:"separator"},{menuId:"filtering",name:"Filtering",className:"ng-menu-filtering"},{menuId:"maximize",name:"Maximize",className:"maximize"},{menuId:"export",name:"Export",className:"export",items:[{menuId:"export-excel",name:"Excel",className:"export-excel"},{menuId:"export-pdf",name:"PDF",className:"export-pdf",disabled:!0}]},{menuId:"properties",name:"Options",className:"options",items:[{menuId:"show-title-bar",name:"Title Bar Show/Hide",className:"show-title-bar"},{menuId:"show-status-bar",name:"Status Bar Show/Hide",className:"show-status-bar"},{menuId:"auto-fit-col",name:"Auto Fit Columns",className:"auto-fit-col"}]});const f=[];return o.forEach(b=>{b.type==="separator"&&(f.length===0||f[f.length-1].type==="separator")||f.push(b)}),f.length>0&&f[f.length-1].type==="separator"&&f.pop(),f},"#buildMenuItems"),ta=h(function(e){var o,l;if(!t(this,vt)||!e)return;const s=((l=(o=e.filtering)==null?void 0:o.isFiltering)==null?void 0:l.call(o))||!1;t(this,vt).toggleItemState("filtering","on",s);const i=t(this,Q).getAttribute("auto-fit-col")==="true";t(this,vt).toggleItemState("auto-fit-col","on",i);const r=t(this,Q).getAttribute("show-title-bar")==="true";t(this,vt).toggleItemState("show-title-bar","on",r)},"#syncMenuStates"),ea=h(function(e,s,i){var c,u,g;const r=e.menuId,o=new CustomEvent("menu-click",{detail:{menuId:r,targetCell:s,targetTable:i,originalEvent:e},bubbles:!0,composed:!0});this.dispatchEvent(o);const l=parseInt(s.dataset.col,10),a=A(this,j,wn).call(this,s);switch(r){case"fix-column":case"unfix-column":const f=A(this,j,ml).call(this,s);f==null||f.executeFixToggle(r,s);break;case"sort":isNaN(l)||(u=(c=a.sorting)==null?void 0:c.handleSortFromMenu)==null||u.call(c,l,s);break;case"filtering":(g=a==null?void 0:a.filtering)==null||g.toggle();break;case"auto-fit-col":t(this,Q).setAttribute("auto-fit-col",t(this,Q).getAttribute("auto-fit-col")==="true"?"false":"true");break;case"show-title-bar":t(this,Q).setAttribute("show-title-bar",t(this,Q).getAttribute("show-title-bar")==="true"?"false":"true");break}t(this,vt).close()},"#handleMenuClick"),h(sl,"ContextMenu");let no=sl;customElements.get("nine-table-menu")||customElements.define("nine-table-menu",no);const il=class il extends HTMLElement{constructor(){super();d(this,as);d(this,Oi);d(this,Zt,null)}connectedCallback(){this.style.position="fixed",this.style.display="none",this.style.zIndex="99999",this.innerHTML=`
|
|
1645
1038
|
<style>
|
|
1646
1039
|
|
|
1647
1040
|
nine-table-menu-panel .menu-wrapper {
|
|
@@ -1716,5 +1109,5 @@ nine-table-sheet tr.ng-sticky-header td {
|
|
|
1716
1109
|
<div class="menu-wrapper">
|
|
1717
1110
|
<ul class="menu-container"></ul>
|
|
1718
1111
|
</div>
|
|
1719
|
-
`}render(e,s){
|
|
1112
|
+
`}render(e,s){p(this,Oi,s);const i=this.querySelector(".menu-container");i&&(i.innerHTML="",A(this,as,xl).call(this,i,e),A(this,as,sa).call(this))}openAt(e,s,i=null){if(this.style.display="block",i){const r=i.getBoundingClientRect(),o=r.right;requestAnimationFrame(()=>{const l=this.querySelector(".menu-wrapper");if(!l)return;const a=l.getBoundingClientRect().width;let c=o-a;c<0&&(c=r.left);const u=l.getBoundingClientRect().height;let g=s;s+u>window.innerHeight&&(g=s-u),this.style.left=`${c}px`,this.style.top=`${g}px`})}else this.style.left=`${e}px`,this.style.top=`${s}px`,requestAnimationFrame(()=>{const r=this.querySelector(".menu-wrapper");if(!r)return;const o=r.getBoundingClientRect();e+o.width>window.innerWidth&&(this.style.left=`${e-o.width}px`),s+o.height>window.innerHeight&&(this.style.top=`${s-o.height}px`)});t(this,Zt)&&window.removeEventListener("pointerdown",t(this,Zt)),p(this,Zt,r=>{!(r.composedPath?r.composedPath():[]).includes(this)&&!this.contains(r.target)&&this.close()}),setTimeout(()=>{window.addEventListener("pointerdown",t(this,Zt))},0)}close(){this.style.display="none",t(this,Zt)&&(window.removeEventListener("pointerdown",t(this,Zt)),p(this,Zt,null))}toggleItemState(e,s,i){const r=this.querySelector(`li[menu-id="${e}"]`);r&&(i?r.classList.add(s):r.classList.remove(s))}disconnectedCallback(){this.close()}};Oi=new WeakMap,Zt=new WeakMap,as=new WeakSet,xl=h(function(e,s){s.forEach(i=>{if(i.type==="separator"){const l=document.createElement("li");l.className="ng-menu-separator",e.appendChild(l);return}const r=document.createElement("li");r.setAttribute("menu-id",i.menuId),r.className=`${i.className||""} ${i.items?"submenu":""} ${i.disabled?"disabled":""}`.trim();const o=document.createElement("span");if(o.textContent=i.name,r.appendChild(o),i.items&&i.items.length>0){const l=document.createElement("ul");l.className="ng-menu-sublist",A(this,as,xl).call(this,l,i.items),r.appendChild(l)}e.appendChild(r)})},"#appendItems"),sa=h(function(){this.querySelectorAll("li[menu-id]").forEach(e=>{e.addEventListener("click",s=>{var r;if(s.stopPropagation(),e.classList.contains("disabled"))return;const i=e.getAttribute("menu-id");(r=t(this,Oi))==null||r.call(this,{menuId:i,target:e}),this.close()})})},"#bindClickEvents"),h(il,"MenuPanel");let oo=il;customElements.get("nine-table-menu-panel")||customElements.define("nine-table-menu-panel",oo),k.NINE_TABLE=Dt,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
|
1720
1113
|
//# sourceMappingURL=nine-table.umd.js.map
|