@ninebone/table 0.1.45 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nine-table.js +123 -131
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +1 -1
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.umd.js
CHANGED
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
|
|
273
273
|
<div class="ng-col-mover-grip"></div>
|
|
274
274
|
<div class="ng-col-mover-indi"></div>
|
|
275
|
-
`,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,Li).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,Li).call(this,a,c,u)},"#syncHeaderAndFooterHeights"));d(this,Li,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],f=Math.max(...u);f>0&&(e[c]&&(e[c].style.height=`${f}px`),s[c]&&(s[c].style.height=`${f}px`),i[c]&&(i[c].style.height=`${f}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,Ot,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,Ot)}get selection(){return t(this,vi)}get navigation(){return t(this,Si)}get templateLength(){return t(this,It).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,It).table)==null?void 0:r.getAttribute("auto-fit-col"))==="true";return e||s}get sourceTable(){return t(this,It).table}get source(){return t(this,It)}recompileAndRefresh(){var e;t(this,It).table&&(fe.recompile(t(this,It).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,Ri).call(this),t(this,Qe).call(this),t(this,Ot).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,Ot))==null||s.refresh()}))}refreshLayout(){!this.classList.contains("active")||!t(this,It).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,Rr).call(this),(s=t(this,Ee))==null||s.refreshLayout(),(i=t(this,Ot))==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,Ot=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,It=new WeakMap,Je=new WeakMap,Er=new WeakSet,Yl=h(function(){return t(this,ae).hasAttribute("simple")||t(this,ae).getAttribute("theme")==="simple"},"#isSimple"),Rr=new WeakMap,Lr=new WeakMap,Qe=new WeakMap,Ri=new WeakMap,Cr=new WeakMap,Tr=new WeakMap,kr=new WeakMap,Ir=new WeakMap,Li=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 f=u===0?"active":"",g=c.id||`sheet${u+1}`,b=`<nine-table-sheet class="${f}" data-index="${u}" data-sheet-id="${g}" id="${g}"></nine-table-sheet>`,m=u<i-1?`<nine-splitter class="h" data-split-index="${u}"></nine-splitter>`:"";return b+m}).join("")
|
|
275
|
+
`,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,Li).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,Li).call(this,a,c,u)},"#syncHeaderAndFooterHeights"));d(this,Li,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],f=Math.max(...u);f>0&&(e[c]&&(e[c].style.height=`${f}px`),s[c]&&(s[c].style.height=`${f}px`),i[c]&&(i[c].style.height=`${f}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,Ot,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,Ot)}get selection(){return t(this,vi)}get navigation(){return t(this,Si)}get templateLength(){return t(this,It).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,It).table)==null?void 0:r.getAttribute("auto-fit-col"))==="true";return e||s}get sourceTable(){return t(this,It).table}get source(){return t(this,It)}recompileAndRefresh(){var e;t(this,It).table&&(fe.recompile(t(this,It).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,Ri).call(this),t(this,Qe).call(this),t(this,Ot).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,Ot))==null||s.refresh()}))}refreshLayout(){!this.classList.contains("active")||!t(this,It).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,Rr).call(this),(s=t(this,Ee))==null||s.refreshLayout(),(i=t(this,Ot))==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,Ot=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,It=new WeakMap,Je=new WeakMap,Er=new WeakSet,Yl=h(function(){return t(this,ae).hasAttribute("simple")||t(this,ae).getAttribute("theme")==="simple"},"#isSimple"),Rr=new WeakMap,Lr=new WeakMap,Qe=new WeakMap,Ri=new WeakMap,Cr=new WeakMap,Tr=new WeakMap,kr=new WeakMap,Ir=new WeakMap,Li=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 f=u===0?"active":"",g=c.id||`sheet${u+1}`,b=`<nine-table-sheet class="${f}" data-index="${u}" data-sheet-id="${g}" id="${g}"></nine-table-sheet>`,m=u<i-1?`<nine-splitter class="h" data-split-index="${u}"></nine-splitter>`:"";return b+m}).join("");v.log("Welcome nine-table","0.1.47");const o=["_nine-table"],l=['@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.47/dist/css/nine-table.css";'],a=[];nine.cssPath&&o.forEach(c=>{a.push(`@import "${nine.cssPath}/${c}.css";`)}),t(this,it).shadowRoot.innerHTML=`
|
|
276
276
|
<style>
|
|
277
277
|
${[...l,...a].join(`
|
|
278
278
|
`)}
|