ninegrid2 6.727.0 → 6.728.0

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.
@@ -120664,203 +120664,6 @@ class nxSpan extends HTMLElement
120664
120664
 
120665
120665
  customElements.define("nx-span", nxSpan);
120666
120666
 
120667
- class nxTab extends HTMLElement {
120668
- constructor() {
120669
- super();
120670
- this.attachShadow({ mode: 'open' });
120671
-
120672
- this.shadowRoot.innerHTML = `
120673
- <style>
120674
- :host(.theme-1) {
120675
- .tabs {
120676
- --border-bottom: 1px solid #eee;
120677
- gap: 3px;
120678
- }
120679
- .tab-button {
120680
- color: #666;
120681
- font-weight: 500;
120682
- transform: translateY(1px);
120683
- z-index: 1;
120684
- --border-bottom: 1px solid #ccc;
120685
- }
120686
- .tab-button.active {
120687
- color: #666;
120688
- font-weight: 700;
120689
- border-bottom: 1px solid white;
120690
- }
120691
- .tab-pages {
120692
- border: 1px solid #ccc;
120693
- }
120694
- }
120695
-
120696
- :host(.theme-2) {
120697
- .tabs {
120698
- border-bottom: 1px solid #eee;
120699
- gap: 40px;
120700
- }
120701
- .tab-button {
120702
- color: #666;
120703
- font-weight: 500;
120704
- border: none;
120705
- }
120706
- .tab-button.active {
120707
- color: green;
120708
- font-weight: 700;
120709
- border-bottom: 3px solid green;
120710
- }
120711
- }
120712
-
120713
- .tabs {
120714
- display: flex;
120715
- cursor: pointer;
120716
-
120717
- }
120718
- .tab-button {
120719
- padding: 8px;
120720
- border: 1px solid #ccc;
120721
- text-align: center;
120722
- outline: 0;
120723
- }
120724
- .tab-button:hover {
120725
- --filter: brightness(80%);
120726
- }
120727
- .tab-pages {
120728
- position: relative;
120729
- width: 100%;
120730
- overflow: hidden;
120731
- transition: height 0.5s ease-in-out;
120732
- }
120733
- .tab-page {
120734
- position: absolute;
120735
- width: 100%;
120736
- top: 0;
120737
- transition: left 0.5s ease-in-out;
120738
- padding: 20px;
120739
- box-sizing: border-box;
120740
- white-space: nowrap;
120741
- overflow: hidden;
120742
- text-overflow: ellipsis;
120743
- text-align: left;
120744
- }
120745
- .tab-page.active {
120746
- left: 0;
120747
- }
120748
- .tab-page.exit-left {
120749
- left: -100%;
120750
- }
120751
- .tab-page.exit-right {
120752
- left: 100%;
120753
- }
120754
- </style>
120755
- <div class="tabs"></div>
120756
- <div class="tab-pages"></div>
120757
- `;
120758
-
120759
- //console.log(this.shadowRoot.querySelector('.tab-page'));
120760
- //this.shadowRoot.querySelector('.tab-pages').style.height = this.shadowRoot.querySelector('.tab-page').style.height;
120761
-
120762
- this.switchTabHandler = this.#switchTab.bind(this);
120763
- }
120764
-
120765
- connectedCallback() {
120766
- this.classList.add(this.getAttribute("theme") || "theme-1");
120767
- this.#renderTabs();
120768
- this.shadowRoot.querySelectorAll('.tab-button').forEach(tab => {
120769
- tab.addEventListener('click', this.switchTabHandler);
120770
- });
120771
-
120772
- const firstTab = this.shadowRoot.querySelector('.tab-button');
120773
- const firstContent = this.shadowRoot.querySelector('.tab-page');
120774
- if (firstTab && firstContent) {
120775
- firstTab.classList.add('active');
120776
- firstContent.classList.add('active');
120777
- setTimeout(() => {
120778
- this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120779
- }, 100);
120780
- //this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120781
-
120782
- console.log(firstContent.style.height, firstContent.scrollHeight);
120783
- }
120784
-
120785
- this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120786
- }
120787
-
120788
- #renderTabs() {
120789
- const tabs = this.shadowRoot.querySelector('.tabs');
120790
- const contents = this.shadowRoot.querySelector('.tab-pages');
120791
- const tabItems = this.querySelectorAll('nx-tab-page');
120792
-
120793
- tabItems.forEach((item, index) => {
120794
- const tab = document.createElement('div');
120795
- tab.classList.add('tab-button');
120796
- tab.textContent = item.getAttribute('caption');
120797
- tab.setAttribute('data-target', `content${index}`);
120798
- tabs.appendChild(tab);
120799
-
120800
- const content = document.createElement('div');
120801
- content.id = `content${index}`;
120802
- content.classList.add('tab-page');
120803
- content.innerHTML = item.innerHTML;
120804
- contents.appendChild(content);
120805
- });
120806
-
120807
- tabItems.forEach((item) => {
120808
- item.remove();
120809
- });
120810
- }
120811
-
120812
- #switchTab(event) {
120813
- const target = event.target;
120814
- if (!target.classList.contains('tab-button')) return;
120815
-
120816
- const targetId = target.getAttribute('data-target');
120817
- const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120818
- const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120819
- const newContent = this.shadowRoot.getElementById(targetId);
120820
-
120821
- if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120822
-
120823
- if (activeTab && activeContent) {
120824
- activeTab.classList.remove('active');
120825
- activeContent.classList.remove('active','exit-left','exit-right');
120826
- //newContent.classList.remove('exit-left','exit-right');
120827
- activeContent.style.left = '';
120828
-
120829
- if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120830
- activeContent.classList.add('exit-left');
120831
- } else {
120832
- activeContent.classList.add('exit-right');
120833
- }
120834
- //console.log(index);
120835
- //if (index == 1) return;
120836
-
120837
- newContent.classList.add('active');
120838
- newContent.style.left = '';
120839
-
120840
- newContent.classList.remove('exit-left','exit-right');
120841
- }
120842
-
120843
- target.classList.add('active');
120844
- //newContent.classList.add('active');
120845
- this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120846
-
120847
- //console.log(newContent.style.height, newContent.scrollHeight);
120848
- }
120849
- }
120850
-
120851
- class nxTabPage extends HTMLElement {
120852
- constructor() {
120853
- super();
120854
- }
120855
-
120856
- connectedCallback() {
120857
- this.caption = this.getAttribute('caption');
120858
- }
120859
- }
120860
-
120861
- customElements.define('nx-tab', nxTab);
120862
- customElements.define('nx-tab-page', nxTabPage);
120863
-
120864
120667
  class nxTest1 extends HTMLElement
120865
120668
  {
120866
120669
  constructor() {
@@ -121045,6 +120848,126 @@ Array.prototype.nineBinarySearch = function(target)
121045
120848
  return -1;
121046
120849
  };
121047
120850
 
120851
+ class nxTab extends HTMLElement {
120852
+ constructor() {
120853
+ super();
120854
+ this.attachShadow({ mode: 'open' });
120855
+
120856
+ this.shadowRoot.innerHTML = `
120857
+ <style>
120858
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTab.css";
120859
+ ${ninegrid.getCustomPath(this,"nxTab.css")}
120860
+ </style>
120861
+
120862
+ <div class="tabs"></div>
120863
+ <div class="tab-pages"></div>
120864
+ `;
120865
+
120866
+ //console.log(this.shadowRoot.querySelector('.tab-page'));
120867
+ //this.shadowRoot.querySelector('.tab-pages').style.height = this.shadowRoot.querySelector('.tab-page').style.height;
120868
+
120869
+ this.switchTabHandler = this.#switchTab.bind(this);
120870
+ }
120871
+
120872
+ connectedCallback() {
120873
+ this.classList.add(this.getAttribute("theme") || "theme-1");
120874
+ this.#renderTabs();
120875
+ this.shadowRoot.querySelectorAll('.tab-button').forEach(tab => {
120876
+ tab.addEventListener('click', this.switchTabHandler);
120877
+ });
120878
+
120879
+ const firstTab = this.shadowRoot.querySelector('.tab-button');
120880
+ const firstContent = this.shadowRoot.querySelector('.tab-page');
120881
+ if (firstTab && firstContent) {
120882
+ firstTab.classList.add('active');
120883
+ firstContent.classList.add('active');
120884
+ setTimeout(() => {
120885
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120886
+ }, 100);
120887
+ //this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120888
+
120889
+ console.log(firstContent.style.height, firstContent.scrollHeight);
120890
+ }
120891
+
120892
+ this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120893
+ }
120894
+
120895
+ #renderTabs() {
120896
+ const tabs = this.shadowRoot.querySelector('.tabs');
120897
+ const contents = this.shadowRoot.querySelector('.tab-pages');
120898
+ const tabItems = this.querySelectorAll('nx-tab-page');
120899
+
120900
+ tabItems.forEach((item, index) => {
120901
+ const tab = document.createElement('div');
120902
+ tab.classList.add('tab-button');
120903
+ tab.textContent = item.getAttribute('caption');
120904
+ tab.setAttribute('data-target', `content${index}`);
120905
+ tabs.appendChild(tab);
120906
+
120907
+ const content = document.createElement('div');
120908
+ content.id = `content${index}`;
120909
+ content.classList.add('tab-page');
120910
+ content.innerHTML = item.innerHTML;
120911
+ contents.appendChild(content);
120912
+ });
120913
+
120914
+ tabItems.forEach((item) => {
120915
+ item.remove();
120916
+ });
120917
+ }
120918
+
120919
+ #switchTab(event) {
120920
+ const target = event.target;
120921
+ if (!target.classList.contains('tab-button')) return;
120922
+
120923
+ const targetId = target.getAttribute('data-target');
120924
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120925
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120926
+ const newContent = this.shadowRoot.getElementById(targetId);
120927
+
120928
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120929
+
120930
+ if (activeTab && activeContent) {
120931
+ activeTab.classList.remove('active');
120932
+ activeContent.classList.remove('active','exit-left','exit-right');
120933
+ //newContent.classList.remove('exit-left','exit-right');
120934
+ activeContent.style.left = '';
120935
+
120936
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120937
+ activeContent.classList.add('exit-left');
120938
+ } else {
120939
+ activeContent.classList.add('exit-right');
120940
+ }
120941
+ //console.log(index);
120942
+ //if (index == 1) return;
120943
+
120944
+ newContent.classList.add('active');
120945
+ newContent.style.left = '';
120946
+
120947
+ newContent.classList.remove('exit-left','exit-right');
120948
+ }
120949
+
120950
+ target.classList.add('active');
120951
+ //newContent.classList.add('active');
120952
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120953
+
120954
+ //console.log(newContent.style.height, newContent.scrollHeight);
120955
+ }
120956
+ }
120957
+
120958
+ class nxTabPage extends HTMLElement {
120959
+ constructor() {
120960
+ super();
120961
+ }
120962
+
120963
+ connectedCallback() {
120964
+ this.caption = this.getAttribute('caption');
120965
+ }
120966
+ }
120967
+
120968
+ customElements.define('nx-tab', nxTab);
120969
+ customElements.define('nx-tab-page', nxTabPage);
120970
+
121048
120971
  class nxSplitter extends HTMLElement {
121049
120972
  #mode;
121050
120973
 
@@ -121210,7 +121133,6 @@ class nxSplitter extends HTMLElement {
121210
121133
 
121211
121134
  // grip 이벤트 바인딩
121212
121135
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
121213
- console.log(el);
121214
121136
  el.addEventListener("mousedown", e => this.#startDrag(e));
121215
121137
  });
121216
121138
 
@@ -121258,6 +121180,40 @@ class nxSplitter extends HTMLElement {
121258
121180
 
121259
121181
  customElements.define("nx-splitter", nxSplitter);
121260
121182
 
121183
+ class nxForm extends HTMLElement {
121184
+ #mode;
121185
+
121186
+ constructor() {
121187
+ super();
121188
+ this.attachShadow({ mode: "open" });
121189
+ }
121190
+
121191
+ connectedCallback() {
121192
+ this.#init();
121193
+ }
121194
+
121195
+ #init = () => {
121196
+
121197
+ const contents = this.innerHTML.trim();
121198
+
121199
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121200
+ const htmlTmpl = document.createElement("template");
121201
+ htmlTmpl.innerHTML = `
121202
+ <style>
121203
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
121204
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
121205
+ </style>
121206
+
121207
+ ${contents}
121208
+ `;
121209
+
121210
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121211
+ };
121212
+
121213
+ }
121214
+
121215
+ customElements.define("nx-form", nxForm);
121216
+
121261
121217
  class aiSettings extends HTMLElement
121262
121218
  {
121263
121219
  constructor() {
@@ -120660,203 +120660,6 @@ class nxSpan extends HTMLElement
120660
120660
 
120661
120661
  customElements.define("nx-span", nxSpan);
120662
120662
 
120663
- class nxTab extends HTMLElement {
120664
- constructor() {
120665
- super();
120666
- this.attachShadow({ mode: 'open' });
120667
-
120668
- this.shadowRoot.innerHTML = `
120669
- <style>
120670
- :host(.theme-1) {
120671
- .tabs {
120672
- --border-bottom: 1px solid #eee;
120673
- gap: 3px;
120674
- }
120675
- .tab-button {
120676
- color: #666;
120677
- font-weight: 500;
120678
- transform: translateY(1px);
120679
- z-index: 1;
120680
- --border-bottom: 1px solid #ccc;
120681
- }
120682
- .tab-button.active {
120683
- color: #666;
120684
- font-weight: 700;
120685
- border-bottom: 1px solid white;
120686
- }
120687
- .tab-pages {
120688
- border: 1px solid #ccc;
120689
- }
120690
- }
120691
-
120692
- :host(.theme-2) {
120693
- .tabs {
120694
- border-bottom: 1px solid #eee;
120695
- gap: 40px;
120696
- }
120697
- .tab-button {
120698
- color: #666;
120699
- font-weight: 500;
120700
- border: none;
120701
- }
120702
- .tab-button.active {
120703
- color: green;
120704
- font-weight: 700;
120705
- border-bottom: 3px solid green;
120706
- }
120707
- }
120708
-
120709
- .tabs {
120710
- display: flex;
120711
- cursor: pointer;
120712
-
120713
- }
120714
- .tab-button {
120715
- padding: 8px;
120716
- border: 1px solid #ccc;
120717
- text-align: center;
120718
- outline: 0;
120719
- }
120720
- .tab-button:hover {
120721
- --filter: brightness(80%);
120722
- }
120723
- .tab-pages {
120724
- position: relative;
120725
- width: 100%;
120726
- overflow: hidden;
120727
- transition: height 0.5s ease-in-out;
120728
- }
120729
- .tab-page {
120730
- position: absolute;
120731
- width: 100%;
120732
- top: 0;
120733
- transition: left 0.5s ease-in-out;
120734
- padding: 20px;
120735
- box-sizing: border-box;
120736
- white-space: nowrap;
120737
- overflow: hidden;
120738
- text-overflow: ellipsis;
120739
- text-align: left;
120740
- }
120741
- .tab-page.active {
120742
- left: 0;
120743
- }
120744
- .tab-page.exit-left {
120745
- left: -100%;
120746
- }
120747
- .tab-page.exit-right {
120748
- left: 100%;
120749
- }
120750
- </style>
120751
- <div class="tabs"></div>
120752
- <div class="tab-pages"></div>
120753
- `;
120754
-
120755
- //console.log(this.shadowRoot.querySelector('.tab-page'));
120756
- //this.shadowRoot.querySelector('.tab-pages').style.height = this.shadowRoot.querySelector('.tab-page').style.height;
120757
-
120758
- this.switchTabHandler = this.#switchTab.bind(this);
120759
- }
120760
-
120761
- connectedCallback() {
120762
- this.classList.add(this.getAttribute("theme") || "theme-1");
120763
- this.#renderTabs();
120764
- this.shadowRoot.querySelectorAll('.tab-button').forEach(tab => {
120765
- tab.addEventListener('click', this.switchTabHandler);
120766
- });
120767
-
120768
- const firstTab = this.shadowRoot.querySelector('.tab-button');
120769
- const firstContent = this.shadowRoot.querySelector('.tab-page');
120770
- if (firstTab && firstContent) {
120771
- firstTab.classList.add('active');
120772
- firstContent.classList.add('active');
120773
- setTimeout(() => {
120774
- this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120775
- }, 100);
120776
- //this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120777
-
120778
- console.log(firstContent.style.height, firstContent.scrollHeight);
120779
- }
120780
-
120781
- this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120782
- }
120783
-
120784
- #renderTabs() {
120785
- const tabs = this.shadowRoot.querySelector('.tabs');
120786
- const contents = this.shadowRoot.querySelector('.tab-pages');
120787
- const tabItems = this.querySelectorAll('nx-tab-page');
120788
-
120789
- tabItems.forEach((item, index) => {
120790
- const tab = document.createElement('div');
120791
- tab.classList.add('tab-button');
120792
- tab.textContent = item.getAttribute('caption');
120793
- tab.setAttribute('data-target', `content${index}`);
120794
- tabs.appendChild(tab);
120795
-
120796
- const content = document.createElement('div');
120797
- content.id = `content${index}`;
120798
- content.classList.add('tab-page');
120799
- content.innerHTML = item.innerHTML;
120800
- contents.appendChild(content);
120801
- });
120802
-
120803
- tabItems.forEach((item) => {
120804
- item.remove();
120805
- });
120806
- }
120807
-
120808
- #switchTab(event) {
120809
- const target = event.target;
120810
- if (!target.classList.contains('tab-button')) return;
120811
-
120812
- const targetId = target.getAttribute('data-target');
120813
- const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120814
- const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120815
- const newContent = this.shadowRoot.getElementById(targetId);
120816
-
120817
- if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120818
-
120819
- if (activeTab && activeContent) {
120820
- activeTab.classList.remove('active');
120821
- activeContent.classList.remove('active','exit-left','exit-right');
120822
- //newContent.classList.remove('exit-left','exit-right');
120823
- activeContent.style.left = '';
120824
-
120825
- if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120826
- activeContent.classList.add('exit-left');
120827
- } else {
120828
- activeContent.classList.add('exit-right');
120829
- }
120830
- //console.log(index);
120831
- //if (index == 1) return;
120832
-
120833
- newContent.classList.add('active');
120834
- newContent.style.left = '';
120835
-
120836
- newContent.classList.remove('exit-left','exit-right');
120837
- }
120838
-
120839
- target.classList.add('active');
120840
- //newContent.classList.add('active');
120841
- this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120842
-
120843
- //console.log(newContent.style.height, newContent.scrollHeight);
120844
- }
120845
- }
120846
-
120847
- class nxTabPage extends HTMLElement {
120848
- constructor() {
120849
- super();
120850
- }
120851
-
120852
- connectedCallback() {
120853
- this.caption = this.getAttribute('caption');
120854
- }
120855
- }
120856
-
120857
- customElements.define('nx-tab', nxTab);
120858
- customElements.define('nx-tab-page', nxTabPage);
120859
-
120860
120663
  class nxTest1 extends HTMLElement
120861
120664
  {
120862
120665
  constructor() {
@@ -121041,6 +120844,126 @@ Array.prototype.nineBinarySearch = function(target)
121041
120844
  return -1;
121042
120845
  };
121043
120846
 
120847
+ class nxTab extends HTMLElement {
120848
+ constructor() {
120849
+ super();
120850
+ this.attachShadow({ mode: 'open' });
120851
+
120852
+ this.shadowRoot.innerHTML = `
120853
+ <style>
120854
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTab.css";
120855
+ ${ninegrid.getCustomPath(this,"nxTab.css")}
120856
+ </style>
120857
+
120858
+ <div class="tabs"></div>
120859
+ <div class="tab-pages"></div>
120860
+ `;
120861
+
120862
+ //console.log(this.shadowRoot.querySelector('.tab-page'));
120863
+ //this.shadowRoot.querySelector('.tab-pages').style.height = this.shadowRoot.querySelector('.tab-page').style.height;
120864
+
120865
+ this.switchTabHandler = this.#switchTab.bind(this);
120866
+ }
120867
+
120868
+ connectedCallback() {
120869
+ this.classList.add(this.getAttribute("theme") || "theme-1");
120870
+ this.#renderTabs();
120871
+ this.shadowRoot.querySelectorAll('.tab-button').forEach(tab => {
120872
+ tab.addEventListener('click', this.switchTabHandler);
120873
+ });
120874
+
120875
+ const firstTab = this.shadowRoot.querySelector('.tab-button');
120876
+ const firstContent = this.shadowRoot.querySelector('.tab-page');
120877
+ if (firstTab && firstContent) {
120878
+ firstTab.classList.add('active');
120879
+ firstContent.classList.add('active');
120880
+ setTimeout(() => {
120881
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120882
+ }, 100);
120883
+ //this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
120884
+
120885
+ console.log(firstContent.style.height, firstContent.scrollHeight);
120886
+ }
120887
+
120888
+ this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right'); });
120889
+ }
120890
+
120891
+ #renderTabs() {
120892
+ const tabs = this.shadowRoot.querySelector('.tabs');
120893
+ const contents = this.shadowRoot.querySelector('.tab-pages');
120894
+ const tabItems = this.querySelectorAll('nx-tab-page');
120895
+
120896
+ tabItems.forEach((item, index) => {
120897
+ const tab = document.createElement('div');
120898
+ tab.classList.add('tab-button');
120899
+ tab.textContent = item.getAttribute('caption');
120900
+ tab.setAttribute('data-target', `content${index}`);
120901
+ tabs.appendChild(tab);
120902
+
120903
+ const content = document.createElement('div');
120904
+ content.id = `content${index}`;
120905
+ content.classList.add('tab-page');
120906
+ content.innerHTML = item.innerHTML;
120907
+ contents.appendChild(content);
120908
+ });
120909
+
120910
+ tabItems.forEach((item) => {
120911
+ item.remove();
120912
+ });
120913
+ }
120914
+
120915
+ #switchTab(event) {
120916
+ const target = event.target;
120917
+ if (!target.classList.contains('tab-button')) return;
120918
+
120919
+ const targetId = target.getAttribute('data-target');
120920
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120921
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120922
+ const newContent = this.shadowRoot.getElementById(targetId);
120923
+
120924
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120925
+
120926
+ if (activeTab && activeContent) {
120927
+ activeTab.classList.remove('active');
120928
+ activeContent.classList.remove('active','exit-left','exit-right');
120929
+ //newContent.classList.remove('exit-left','exit-right');
120930
+ activeContent.style.left = '';
120931
+
120932
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120933
+ activeContent.classList.add('exit-left');
120934
+ } else {
120935
+ activeContent.classList.add('exit-right');
120936
+ }
120937
+ //console.log(index);
120938
+ //if (index == 1) return;
120939
+
120940
+ newContent.classList.add('active');
120941
+ newContent.style.left = '';
120942
+
120943
+ newContent.classList.remove('exit-left','exit-right');
120944
+ }
120945
+
120946
+ target.classList.add('active');
120947
+ //newContent.classList.add('active');
120948
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120949
+
120950
+ //console.log(newContent.style.height, newContent.scrollHeight);
120951
+ }
120952
+ }
120953
+
120954
+ class nxTabPage extends HTMLElement {
120955
+ constructor() {
120956
+ super();
120957
+ }
120958
+
120959
+ connectedCallback() {
120960
+ this.caption = this.getAttribute('caption');
120961
+ }
120962
+ }
120963
+
120964
+ customElements.define('nx-tab', nxTab);
120965
+ customElements.define('nx-tab-page', nxTabPage);
120966
+
121044
120967
  class nxSplitter extends HTMLElement {
121045
120968
  #mode;
121046
120969
 
@@ -121206,7 +121129,6 @@ class nxSplitter extends HTMLElement {
121206
121129
 
121207
121130
  // grip 이벤트 바인딩
121208
121131
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
121209
- console.log(el);
121210
121132
  el.addEventListener("mousedown", e => this.#startDrag(e));
121211
121133
  });
121212
121134
 
@@ -121254,6 +121176,40 @@ class nxSplitter extends HTMLElement {
121254
121176
 
121255
121177
  customElements.define("nx-splitter", nxSplitter);
121256
121178
 
121179
+ class nxForm extends HTMLElement {
121180
+ #mode;
121181
+
121182
+ constructor() {
121183
+ super();
121184
+ this.attachShadow({ mode: "open" });
121185
+ }
121186
+
121187
+ connectedCallback() {
121188
+ this.#init();
121189
+ }
121190
+
121191
+ #init = () => {
121192
+
121193
+ const contents = this.innerHTML.trim();
121194
+
121195
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121196
+ const htmlTmpl = document.createElement("template");
121197
+ htmlTmpl.innerHTML = `
121198
+ <style>
121199
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
121200
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
121201
+ </style>
121202
+
121203
+ ${contents}
121204
+ `;
121205
+
121206
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121207
+ };
121208
+
121209
+ }
121210
+
121211
+ customElements.define("nx-form", nxForm);
121212
+
121257
121213
  class aiSettings extends HTMLElement
121258
121214
  {
121259
121215
  constructor() {
package/dist/index.js CHANGED
@@ -93,7 +93,6 @@ import "./etc/nxI18nExt.js";
93
93
  import "./etc/nxSidebar.js";
94
94
  import "./etc/nxSideMenu.js";
95
95
  import "./etc/nxSpan.js";
96
- import "./etc/nxTab.js";
97
96
  import "./etc/nxTest.js";
98
97
  import "./etc/nxTopMenu.js";
99
98
  //import "./etc/object-observe.js";
@@ -101,8 +100,9 @@ import "./etc/nxTopMenu.js";
101
100
  import "./utils/ngFiltering.js";
102
101
  import "./utils/ngPrototype.js";
103
102
 
103
+ import "./nx/nxTab.js";
104
104
  import "./nx/nxSplitter.js";
105
-
105
+ import "./nx/nxForm.js";
106
106
 
107
107
  import "./ai/aiSettings.js";
108
108
  import "./ai/aiMessage.js";
@@ -0,0 +1,35 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxForm extends HTMLElement {
4
+ #mode;
5
+
6
+ constructor() {
7
+ super();
8
+ this.attachShadow({ mode: "open" });
9
+ }
10
+
11
+ connectedCallback() {
12
+ this.#init();
13
+ }
14
+
15
+ #init = () => {
16
+
17
+ const contents = this.innerHTML.trim();
18
+
19
+ this.innerHTML = ""; // 기존 내부 HTML 제거
20
+ const htmlTmpl = document.createElement("template");
21
+ htmlTmpl.innerHTML = `
22
+ <style>
23
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
24
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
25
+ </style>
26
+
27
+ ${contents}
28
+ `;
29
+
30
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
31
+ };
32
+
33
+ }
34
+
35
+ customElements.define("nx-form", nxForm);
@@ -165,7 +165,6 @@ class nxSplitter extends HTMLElement {
165
165
 
166
166
  // grip 이벤트 바인딩
167
167
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
168
- console.log(el);
169
168
  el.addEventListener("mousedown", e => this.#startDrag(e));
170
169
  });
171
170
 
@@ -7,87 +7,10 @@ class nxTab extends HTMLElement {
7
7
 
8
8
  this.shadowRoot.innerHTML = `
9
9
  <style>
10
- :host(.theme-1) {
11
- .tabs {
12
- --border-bottom: 1px solid #eee;
13
- gap: 3px;
14
- }
15
- .tab-button {
16
- color: #666;
17
- font-weight: 500;
18
- transform: translateY(1px);
19
- z-index: 1;
20
- --border-bottom: 1px solid #ccc;
21
- }
22
- .tab-button.active {
23
- color: #666;
24
- font-weight: 700;
25
- border-bottom: 1px solid white;
26
- }
27
- .tab-pages {
28
- border: 1px solid #ccc;
29
- }
30
- }
31
-
32
- :host(.theme-2) {
33
- .tabs {
34
- border-bottom: 1px solid #eee;
35
- gap: 40px;
36
- }
37
- .tab-button {
38
- color: #666;
39
- font-weight: 500;
40
- border: none;
41
- }
42
- .tab-button.active {
43
- color: green;
44
- font-weight: 700;
45
- border-bottom: 3px solid green;
46
- }
47
- }
48
-
49
- .tabs {
50
- display: flex;
51
- cursor: pointer;
52
-
53
- }
54
- .tab-button {
55
- padding: 8px;
56
- border: 1px solid #ccc;
57
- text-align: center;
58
- outline: 0;
59
- }
60
- .tab-button:hover {
61
- --filter: brightness(80%);
62
- }
63
- .tab-pages {
64
- position: relative;
65
- width: 100%;
66
- overflow: hidden;
67
- transition: height 0.5s ease-in-out;
68
- }
69
- .tab-page {
70
- position: absolute;
71
- width: 100%;
72
- top: 0;
73
- transition: left 0.5s ease-in-out;
74
- padding: 20px;
75
- box-sizing: border-box;
76
- white-space: nowrap;
77
- overflow: hidden;
78
- text-overflow: ellipsis;
79
- text-align: left;
80
- }
81
- .tab-page.active {
82
- left: 0;
83
- }
84
- .tab-page.exit-left {
85
- left: -100%;
86
- }
87
- .tab-page.exit-right {
88
- left: 100%;
89
- }
90
- </style>
10
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTab.css";
11
+ ${ninegrid.getCustomPath(this,"nxTab.css")}
12
+ </style>
13
+
91
14
  <div class="tabs"></div>
92
15
  <div class="tab-pages"></div>
93
16
  `;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.727.0",
4
+ "version": "6.728.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
package/src/index.js CHANGED
@@ -93,7 +93,6 @@ import "./etc/nxI18nExt.js";
93
93
  import "./etc/nxSidebar.js";
94
94
  import "./etc/nxSideMenu.js";
95
95
  import "./etc/nxSpan.js";
96
- import "./etc/nxTab.js";
97
96
  import "./etc/nxTest.js";
98
97
  import "./etc/nxTopMenu.js";
99
98
  //import "./etc/object-observe.js";
@@ -101,8 +100,9 @@ import "./etc/nxTopMenu.js";
101
100
  import "./utils/ngFiltering.js";
102
101
  import "./utils/ngPrototype.js";
103
102
 
103
+ import "./nx/nxTab.js";
104
104
  import "./nx/nxSplitter.js";
105
-
105
+ import "./nx/nxForm.js";
106
106
 
107
107
  import "./ai/aiSettings.js";
108
108
  import "./ai/aiMessage.js";
@@ -0,0 +1,35 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxForm extends HTMLElement {
4
+ #mode;
5
+
6
+ constructor() {
7
+ super();
8
+ this.attachShadow({ mode: "open" });
9
+ }
10
+
11
+ connectedCallback() {
12
+ this.#init();
13
+ }
14
+
15
+ #init = () => {
16
+
17
+ const contents = this.innerHTML.trim();
18
+
19
+ this.innerHTML = ""; // 기존 내부 HTML 제거
20
+ const htmlTmpl = document.createElement("template");
21
+ htmlTmpl.innerHTML = `
22
+ <style>
23
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
24
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
25
+ </style>
26
+
27
+ ${contents}
28
+ `;
29
+
30
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
31
+ };
32
+
33
+ }
34
+
35
+ customElements.define("nx-form", nxForm);
@@ -165,7 +165,6 @@ class nxSplitter extends HTMLElement {
165
165
 
166
166
  // grip 이벤트 바인딩
167
167
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
168
- console.log(el);
169
168
  el.addEventListener("mousedown", e => this.#startDrag(e));
170
169
  });
171
170
 
@@ -0,0 +1,121 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxTab extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.attachShadow({ mode: 'open' });
7
+
8
+ this.shadowRoot.innerHTML = `
9
+ <style>
10
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxTab.css";
11
+ ${ninegrid.getCustomPath(this,"nxTab.css")}
12
+ </style>
13
+
14
+ <div class="tabs"></div>
15
+ <div class="tab-pages"></div>
16
+ `;
17
+
18
+ //console.log(this.shadowRoot.querySelector('.tab-page'));
19
+ //this.shadowRoot.querySelector('.tab-pages').style.height = this.shadowRoot.querySelector('.tab-page').style.height;
20
+
21
+ this.switchTabHandler = this.#switchTab.bind(this);
22
+ }
23
+
24
+ connectedCallback() {
25
+ this.classList.add(this.getAttribute("theme") || "theme-1");
26
+ this.#renderTabs();
27
+ this.shadowRoot.querySelectorAll('.tab-button').forEach(tab => {
28
+ tab.addEventListener('click', this.switchTabHandler);
29
+ });
30
+
31
+ const firstTab = this.shadowRoot.querySelector('.tab-button');
32
+ const firstContent = this.shadowRoot.querySelector('.tab-page');
33
+ if (firstTab && firstContent) {
34
+ firstTab.classList.add('active');
35
+ firstContent.classList.add('active');
36
+ setTimeout(() => {
37
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
38
+ }, 100);
39
+ //this.shadowRoot.querySelector('.tab-pages').style.height = `${firstContent.scrollHeight}px`;
40
+
41
+ console.log(firstContent.style.height, firstContent.scrollHeight);
42
+ }
43
+
44
+ this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right') });
45
+ }
46
+
47
+ #renderTabs() {
48
+ const tabs = this.shadowRoot.querySelector('.tabs');
49
+ const contents = this.shadowRoot.querySelector('.tab-pages');
50
+ const tabItems = this.querySelectorAll('nx-tab-page');
51
+
52
+ tabItems.forEach((item, index) => {
53
+ const tab = document.createElement('div');
54
+ tab.classList.add('tab-button');
55
+ tab.textContent = item.getAttribute('caption');
56
+ tab.setAttribute('data-target', `content${index}`);
57
+ tabs.appendChild(tab);
58
+
59
+ const content = document.createElement('div');
60
+ content.id = `content${index}`;
61
+ content.classList.add('tab-page');
62
+ content.innerHTML = item.innerHTML;
63
+ contents.appendChild(content);
64
+ });
65
+
66
+ tabItems.forEach((item) => {
67
+ item.remove();
68
+ });
69
+ }
70
+
71
+ #switchTab(event) {
72
+ const target = event.target;
73
+ if (!target.classList.contains('tab-button')) return;
74
+
75
+ const targetId = target.getAttribute('data-target');
76
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
77
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
78
+ const newContent = this.shadowRoot.getElementById(targetId);
79
+
80
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
81
+
82
+ if (activeTab && activeContent) {
83
+ activeTab.classList.remove('active');
84
+ activeContent.classList.remove('active','exit-left','exit-right');
85
+ //newContent.classList.remove('exit-left','exit-right');
86
+ activeContent.style.left = '';
87
+
88
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
89
+ activeContent.classList.add('exit-left');
90
+ } else {
91
+ activeContent.classList.add('exit-right');
92
+ }
93
+ //console.log(index);
94
+ //if (index == 1) return;
95
+
96
+ newContent.classList.add('active');
97
+ newContent.style.left = '';
98
+
99
+ newContent.classList.remove('exit-left','exit-right');
100
+ }
101
+
102
+ target.classList.add('active');
103
+ //newContent.classList.add('active');
104
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
105
+
106
+ //console.log(newContent.style.height, newContent.scrollHeight);
107
+ }
108
+ }
109
+
110
+ class nxTabPage extends HTMLElement {
111
+ constructor() {
112
+ super();
113
+ }
114
+
115
+ connectedCallback() {
116
+ this.caption = this.getAttribute('caption');
117
+ }
118
+ }
119
+
120
+ customElements.define('nx-tab', nxTab);
121
+ customElements.define('nx-tab-page', nxTabPage);