@ninebone/table 0.1.38 → 0.1.40

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.
@@ -0,0 +1,3 @@
1
+ nine-table-hscrollbar {
2
+ display: none; /* 평소에는 기본 숨김 */
3
+ }
@@ -8,21 +8,47 @@ nine-table-sheet {
8
8
  box-sizing: border-box;
9
9
  background: #ffffff;
10
10
  overflow: hidden;
11
- }
12
11
 
12
+ .ng-sheet-body {
13
+ display: block;
14
+ flex: 1 1 auto;
15
+ width: 100%;
16
+ height: 100%;
17
+ overflow-y: auto;
18
+ overflow-x: hidden;
19
+ position: relative;
20
+ scrollbar-width: none;
21
+ &::-webkit-scrollbar { display: none; height: 0px; width: 0px; }
22
+ }
13
23
 
14
- nine-table-sheet .ng-sheet-body thead {
15
- display: table-header-group;
16
- position: sticky;
17
- top: 0;
18
- z-index: 10;
19
- }
20
- nine-table-sheet .ng-sheet-body tfoot {
21
- display: table-footer-group;
22
- position: sticky;
23
- bottom: 0;
24
- z-index: 10;
25
- background: red;
24
+ .ng-sheet-body-content {
25
+ display: flex;
26
+ flex-direction: row;
27
+ width: 100%;
28
+ height: 100%;
29
+ left: 0;
30
+ top: 0;
31
+ position: sticky;
32
+ }
33
+
34
+
35
+
36
+ .ng-container-left, .ng-container-body, .ng-container-right {
37
+ flex-direction: column;
38
+ position: relative;
39
+ background: #ffffff;
40
+ }
41
+ .ng-container-body {
42
+ display: flex;
43
+ }
44
+
45
+ .ng-container-left, .ng-container-right {
46
+ border: none;
47
+ }
48
+
49
+ .ng-scroll-edge {
50
+ display: none; /* 평소에는 기본 숨김 */
51
+ }
26
52
  }
27
53
 
28
54
  nine-table-sheet.active {
@@ -32,109 +58,23 @@ nine-table-sheet.active {
32
58
  /* --- 세로 스크롤바가 활성화되었을 때만 CSS로 2열 너비 확장 및 요소 표시 --- */
33
59
  nine-table-sheet.vscroll-visible {
34
60
  grid-template-columns: 1fr var(--scrollbar-size);
35
- }
36
61
 
37
- nine-table-sheet.vscroll-visible nine-table-vscrollbar {
38
- display: flex;
39
- }
40
-
41
- nine-table-vscrollbar {
42
- display: none; /* 평소에는 기본 숨김 */
43
- border-top: 2px solid #333;
62
+ nine-table-vscrollbar {
63
+ display: flex;
64
+ }
44
65
  }
45
66
 
46
67
  /* --- 가로 스크롤바가 활성화되었을 때만 CSS로 행 높이 확장 및 요소 표시 --- */
47
68
  nine-table-sheet.hscroll-visible {
48
69
  grid-template-rows: 1fr var(--scrollbar-size);
49
- }
50
-
51
- nine-table-sheet.hscroll-visible nine-table-hscrollbar,
52
- nine-table-sheet.hscroll-visible .ng-scroll-edge {
53
- display: flex;
54
- }
55
-
56
- nine-table-hscrollbar,
57
- nine-table-sheet .ng-scroll-edge {
58
- display: none; /* 평소에는 기본 숨김 */
59
- }
60
-
61
- nine-table-sheet .ng-main-content-wrapper {
62
- grid-row: 1;
63
- grid-column: 1;
64
- display: flex;
65
- flex-direction: column;
66
- width: 100%;
67
- height: 100%;
68
- overflow: hidden;
69
- position: relative;
70
- }
71
70
 
72
- nine-table-sheet .ng-sheet-header,
73
- nine-table-sheet .ng-sheet-footer {
74
- display: flex;
75
- flex-direction: row;
76
- flex-shrink: 0;
77
- width: 100%;
78
- background: #f9fafb;
79
- z-index: 3;
80
- overflow: hidden;
81
- box-sizing: border-box;
82
- }
83
-
84
- nine-table-sheet .ng-virtual-height-holder {
85
- width: 100%;
86
- pointer-events: none;
87
- visibility: hidden;
88
- }
89
-
90
- nine-table-sheet .ng-sheet-body {
91
- display: block;
92
- flex: 1 1 auto;
93
- width: 100%;
94
- height: 100%;
95
- overflow-y: auto;
96
- overflow-x: hidden;
97
- position: relative;
98
- scrollbar-width: none;
99
- &::-webkit-scrollbar { display: none; height: 0px; width: 0px; }
100
- }
101
-
102
- nine-table-sheet tbody {
103
- position: relative;
104
- }
105
-
106
- nine-table-sheet .ng-sheet-body-content {
107
- display: flex;
108
- flex-direction: row;
109
- width: 100%;
110
- height: 100%;
111
- left: 0;
112
- top: 0;
113
- position: sticky;
114
- }
115
-
116
- nine-table-sheet .ng-container-left,
117
- nine-table-sheet .ng-container-body,
118
- nine-table-sheet .ng-container-right {
119
- display: flex;
120
- flex-direction: column;
121
- position: relative;
122
- background: #ffffff;
71
+ nine-table-hscrollbar, ng-scroll-edge {
72
+ display: flex;
73
+ }
123
74
  }
124
75
 
125
- /* 3. 좌우 고정 영역 구분선 제거 */
126
- .ng-container-left,
127
- .ng-container-right {
128
- border: none;
129
- }
130
76
 
131
- .ng-container-left, .ng-container-body, .ng-container-right {
132
- --border-right: none;
133
- }
134
77
 
135
- nine-table-sheet tbody.foot {
136
- height: 100vh;
137
- }
138
78
 
139
79
  nine-table-sheet .ng-container-left {
140
80
  --border-right: 1px solid #e5e7eb;
@@ -0,0 +1,4 @@
1
+ nine-table-vscrollbar {
2
+ display: none; /* 평소에는 기본 숨김 */
3
+ border-top: 2px solid #333;
4
+ }
@@ -0,0 +1,22 @@
1
+ thead {
2
+ display: table-header-group;
3
+ position: sticky;
4
+ top: 0;
5
+ z-index: 10;
6
+ }
7
+
8
+ tfoot {
9
+ display: table-footer-group;
10
+ position: sticky;
11
+ bottom: 0;
12
+ z-index: 10;
13
+ background: red;
14
+ }
15
+
16
+ tbody {
17
+ position: relative;
18
+ }
19
+
20
+ tbody.foot {
21
+ height: 100vh;
22
+ }
@@ -3350,7 +3350,7 @@ const Qo = class Qo {
3350
3350
  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>` : "";
3351
3351
  return b + m;
3352
3352
  }).join(""), o = ["layout.css", "nine-table-sheet.css", "nine-table-vscrollbar", "nine-table-hscrollbar", "table"], l = o.map(
3353
- (c) => `@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.38/dist/css/${c}";`
3353
+ (c) => `@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.40/dist/css/${c}";`
3354
3354
  ), a = [];
3355
3355
  nine.cssPath && o.forEach((c) => {
3356
3356
  a.push(`@import "${nine.cssPath}/${c}";`);
@@ -273,7 +273,7 @@
273
273
 
274
274
  <div class="ng-col-mover-grip"></div>
275
275
  <div class="ng-col-mover-indi"></div>
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","nine-table-vscrollbar","nine-table-hscrollbar","table"],l=o.map(c=>`@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.38/dist/css/${c}";`),a=[];nine.cssPath&&o.forEach(c=>{a.push(`@import "${nine.cssPath}/${c}";`)}),t(this,it).shadowRoot.innerHTML=`
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","nine-table-vscrollbar","nine-table-hscrollbar","table"],l=o.map(c=>`@import "https://cdn.jsdelivr.net/npm/@ninebone/table@0.1.40/dist/css/${c}";`),a=[];nine.cssPath&&o.forEach(c=>{a.push(`@import "${nine.cssPath}/${c}";`)}),t(this,it).shadowRoot.innerHTML=`
277
277
  <style>
278
278
  ${[...l,...a].join(`
279
279
  `)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninebone/table",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "Grid component for real-time collaboration (Vanilla JS based)",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-table.umd.js",