ninegrid2 6.727.0 → 6.729.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,144 @@ 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
+ this.#init();
120895
+ }
120896
+
120897
+ #renderTabs() {
120898
+ const tabs = this.shadowRoot.querySelector('.tabs');
120899
+ const contents = this.shadowRoot.querySelector('.tab-pages');
120900
+ const tabItems = this.querySelectorAll('nx-tab-page');
120901
+
120902
+ tabItems.forEach((item, index) => {
120903
+ const tab = document.createElement('div');
120904
+ tab.classList.add('tab-button');
120905
+ tab.textContent = item.getAttribute('caption');
120906
+ tab.setAttribute('data-target', `content${index}`);
120907
+ tabs.appendChild(tab);
120908
+
120909
+ const content = document.createElement('div');
120910
+ content.id = `content${index}`;
120911
+ content.classList.add('tab-page');
120912
+ content.innerHTML = item.innerHTML;
120913
+ contents.appendChild(content);
120914
+ });
120915
+
120916
+ tabItems.forEach((item) => {
120917
+ item.remove();
120918
+ });
120919
+ }
120920
+
120921
+ #switchTab(event) {
120922
+ const target = event.target;
120923
+ if (!target.classList.contains('tab-button')) return;
120924
+
120925
+ const targetId = target.getAttribute('data-target');
120926
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120927
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120928
+ const newContent = this.shadowRoot.getElementById(targetId);
120929
+
120930
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120931
+
120932
+ if (activeTab && activeContent) {
120933
+ activeTab.classList.remove('active');
120934
+ activeContent.classList.remove('active','exit-left','exit-right');
120935
+ //newContent.classList.remove('exit-left','exit-right');
120936
+ activeContent.style.left = '';
120937
+
120938
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120939
+ activeContent.classList.add('exit-left');
120940
+ } else {
120941
+ activeContent.classList.add('exit-right');
120942
+ }
120943
+ //console.log(index);
120944
+ //if (index == 1) return;
120945
+
120946
+ newContent.classList.add('active');
120947
+ newContent.style.left = '';
120948
+
120949
+ newContent.classList.remove('exit-left','exit-right');
120950
+ }
120951
+
120952
+ target.classList.add('active');
120953
+ //newContent.classList.add('active');
120954
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120955
+
120956
+ //console.log(newContent.style.height, newContent.scrollHeight);
120957
+ };
120958
+
120959
+ #init = () => {
120960
+ const observer = new MutationObserver(() => {
120961
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120962
+ if (activeContent) {
120963
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
120964
+ }
120965
+ });
120966
+
120967
+ const tabPages = this.shadowRoot.querySelector('.tab-pages');
120968
+ observer.observe(tabPages, {
120969
+ childList: true,
120970
+ subtree: true,
120971
+ characterData: true
120972
+ });
120973
+ };
120974
+ }
120975
+
120976
+ class nxTabPage extends HTMLElement {
120977
+ constructor() {
120978
+ super();
120979
+ }
120980
+
120981
+ connectedCallback() {
120982
+ this.caption = this.getAttribute('caption');
120983
+ }
120984
+ }
120985
+
120986
+ customElements.define('nx-tab', nxTab);
120987
+ customElements.define('nx-tab-page', nxTabPage);
120988
+
121048
120989
  class nxSplitter extends HTMLElement {
121049
120990
  #mode;
121050
120991
 
@@ -121210,7 +121151,6 @@ class nxSplitter extends HTMLElement {
121210
121151
 
121211
121152
  // grip 이벤트 바인딩
121212
121153
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
121213
- console.log(el);
121214
121154
  el.addEventListener("mousedown", e => this.#startDrag(e));
121215
121155
  });
121216
121156
 
@@ -121258,6 +121198,40 @@ class nxSplitter extends HTMLElement {
121258
121198
 
121259
121199
  customElements.define("nx-splitter", nxSplitter);
121260
121200
 
121201
+ class nxForm extends HTMLElement {
121202
+ #mode;
121203
+
121204
+ constructor() {
121205
+ super();
121206
+ this.attachShadow({ mode: "open" });
121207
+ }
121208
+
121209
+ connectedCallback() {
121210
+ this.#init();
121211
+ }
121212
+
121213
+ #init = () => {
121214
+
121215
+ const contents = this.innerHTML.trim();
121216
+
121217
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121218
+ const htmlTmpl = document.createElement("template");
121219
+ htmlTmpl.innerHTML = `
121220
+ <style>
121221
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
121222
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
121223
+ </style>
121224
+
121225
+ ${contents}
121226
+ `;
121227
+
121228
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121229
+ };
121230
+
121231
+ }
121232
+
121233
+ customElements.define("nx-form", nxForm);
121234
+
121261
121235
  class aiSettings extends HTMLElement
121262
121236
  {
121263
121237
  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,144 @@ 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
+ this.#init();
120891
+ }
120892
+
120893
+ #renderTabs() {
120894
+ const tabs = this.shadowRoot.querySelector('.tabs');
120895
+ const contents = this.shadowRoot.querySelector('.tab-pages');
120896
+ const tabItems = this.querySelectorAll('nx-tab-page');
120897
+
120898
+ tabItems.forEach((item, index) => {
120899
+ const tab = document.createElement('div');
120900
+ tab.classList.add('tab-button');
120901
+ tab.textContent = item.getAttribute('caption');
120902
+ tab.setAttribute('data-target', `content${index}`);
120903
+ tabs.appendChild(tab);
120904
+
120905
+ const content = document.createElement('div');
120906
+ content.id = `content${index}`;
120907
+ content.classList.add('tab-page');
120908
+ content.innerHTML = item.innerHTML;
120909
+ contents.appendChild(content);
120910
+ });
120911
+
120912
+ tabItems.forEach((item) => {
120913
+ item.remove();
120914
+ });
120915
+ }
120916
+
120917
+ #switchTab(event) {
120918
+ const target = event.target;
120919
+ if (!target.classList.contains('tab-button')) return;
120920
+
120921
+ const targetId = target.getAttribute('data-target');
120922
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
120923
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120924
+ const newContent = this.shadowRoot.getElementById(targetId);
120925
+
120926
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
120927
+
120928
+ if (activeTab && activeContent) {
120929
+ activeTab.classList.remove('active');
120930
+ activeContent.classList.remove('active','exit-left','exit-right');
120931
+ //newContent.classList.remove('exit-left','exit-right');
120932
+ activeContent.style.left = '';
120933
+
120934
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
120935
+ activeContent.classList.add('exit-left');
120936
+ } else {
120937
+ activeContent.classList.add('exit-right');
120938
+ }
120939
+ //console.log(index);
120940
+ //if (index == 1) return;
120941
+
120942
+ newContent.classList.add('active');
120943
+ newContent.style.left = '';
120944
+
120945
+ newContent.classList.remove('exit-left','exit-right');
120946
+ }
120947
+
120948
+ target.classList.add('active');
120949
+ //newContent.classList.add('active');
120950
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
120951
+
120952
+ //console.log(newContent.style.height, newContent.scrollHeight);
120953
+ };
120954
+
120955
+ #init = () => {
120956
+ const observer = new MutationObserver(() => {
120957
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
120958
+ if (activeContent) {
120959
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
120960
+ }
120961
+ });
120962
+
120963
+ const tabPages = this.shadowRoot.querySelector('.tab-pages');
120964
+ observer.observe(tabPages, {
120965
+ childList: true,
120966
+ subtree: true,
120967
+ characterData: true
120968
+ });
120969
+ };
120970
+ }
120971
+
120972
+ class nxTabPage extends HTMLElement {
120973
+ constructor() {
120974
+ super();
120975
+ }
120976
+
120977
+ connectedCallback() {
120978
+ this.caption = this.getAttribute('caption');
120979
+ }
120980
+ }
120981
+
120982
+ customElements.define('nx-tab', nxTab);
120983
+ customElements.define('nx-tab-page', nxTabPage);
120984
+
121044
120985
  class nxSplitter extends HTMLElement {
121045
120986
  #mode;
121046
120987
 
@@ -121206,7 +121147,6 @@ class nxSplitter extends HTMLElement {
121206
121147
 
121207
121148
  // grip 이벤트 바인딩
121208
121149
  this.shadowRoot.querySelectorAll(".grip-h,.grip-v").forEach(el => {
121209
- console.log(el);
121210
121150
  el.addEventListener("mousedown", e => this.#startDrag(e));
121211
121151
  });
121212
121152
 
@@ -121254,6 +121194,40 @@ class nxSplitter extends HTMLElement {
121254
121194
 
121255
121195
  customElements.define("nx-splitter", nxSplitter);
121256
121196
 
121197
+ class nxForm extends HTMLElement {
121198
+ #mode;
121199
+
121200
+ constructor() {
121201
+ super();
121202
+ this.attachShadow({ mode: "open" });
121203
+ }
121204
+
121205
+ connectedCallback() {
121206
+ this.#init();
121207
+ }
121208
+
121209
+ #init = () => {
121210
+
121211
+ const contents = this.innerHTML.trim();
121212
+
121213
+ this.innerHTML = ""; // 기존 내부 HTML 제거
121214
+ const htmlTmpl = document.createElement("template");
121215
+ htmlTmpl.innerHTML = `
121216
+ <style>
121217
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxForm.css";
121218
+ ${ninegrid.getCustomPath(this,"nxForm.css")}
121219
+ </style>
121220
+
121221
+ ${contents}
121222
+ `;
121223
+
121224
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
121225
+ };
121226
+
121227
+ }
121228
+
121229
+ customElements.define("nx-form", nxForm);
121230
+
121257
121231
  class aiSettings extends HTMLElement
121258
121232
  {
121259
121233
  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
  `;
@@ -119,6 +42,8 @@ class nxTab extends HTMLElement {
119
42
  }
120
43
 
121
44
  this.shadowRoot.querySelectorAll('.tab-page:not(.active)').forEach(el => { el.classList.add('exit-right') });
45
+
46
+ this.#init();
122
47
  }
123
48
 
124
49
  #renderTabs() {
@@ -181,7 +106,23 @@ class nxTab extends HTMLElement {
181
106
  this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
182
107
 
183
108
  //console.log(newContent.style.height, newContent.scrollHeight);
184
- }
109
+ };
110
+
111
+ #init = () => {
112
+ const observer = new MutationObserver(() => {
113
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
114
+ if (activeContent) {
115
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
116
+ }
117
+ });
118
+
119
+ const tabPages = this.shadowRoot.querySelector('.tab-pages');
120
+ observer.observe(tabPages, {
121
+ childList: true,
122
+ subtree: true,
123
+ characterData: true
124
+ });
125
+ };
185
126
  }
186
127
 
187
128
  class nxTabPage extends HTMLElement {
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.729.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,139 @@
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
+ this.#init();
47
+ }
48
+
49
+ #renderTabs() {
50
+ const tabs = this.shadowRoot.querySelector('.tabs');
51
+ const contents = this.shadowRoot.querySelector('.tab-pages');
52
+ const tabItems = this.querySelectorAll('nx-tab-page');
53
+
54
+ tabItems.forEach((item, index) => {
55
+ const tab = document.createElement('div');
56
+ tab.classList.add('tab-button');
57
+ tab.textContent = item.getAttribute('caption');
58
+ tab.setAttribute('data-target', `content${index}`);
59
+ tabs.appendChild(tab);
60
+
61
+ const content = document.createElement('div');
62
+ content.id = `content${index}`;
63
+ content.classList.add('tab-page');
64
+ content.innerHTML = item.innerHTML;
65
+ contents.appendChild(content);
66
+ });
67
+
68
+ tabItems.forEach((item) => {
69
+ item.remove();
70
+ });
71
+ }
72
+
73
+ #switchTab(event) {
74
+ const target = event.target;
75
+ if (!target.classList.contains('tab-button')) return;
76
+
77
+ const targetId = target.getAttribute('data-target');
78
+ const activeTab = this.shadowRoot.querySelector('.tab-button.active');
79
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
80
+ const newContent = this.shadowRoot.getElementById(targetId);
81
+
82
+ if (activeTab === target) return; // 현재 탭을 클릭했을 때 아무런 변화가 없도록 함
83
+
84
+ if (activeTab && activeContent) {
85
+ activeTab.classList.remove('active');
86
+ activeContent.classList.remove('active','exit-left','exit-right');
87
+ //newContent.classList.remove('exit-left','exit-right');
88
+ activeContent.style.left = '';
89
+
90
+ if (activeTab.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) {
91
+ activeContent.classList.add('exit-left');
92
+ } else {
93
+ activeContent.classList.add('exit-right');
94
+ }
95
+ //console.log(index);
96
+ //if (index == 1) return;
97
+
98
+ newContent.classList.add('active');
99
+ newContent.style.left = '';
100
+
101
+ newContent.classList.remove('exit-left','exit-right');
102
+ }
103
+
104
+ target.classList.add('active');
105
+ //newContent.classList.add('active');
106
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${newContent.scrollHeight}px`;
107
+
108
+ //console.log(newContent.style.height, newContent.scrollHeight);
109
+ };
110
+
111
+ #init = () => {
112
+ const observer = new MutationObserver(() => {
113
+ const activeContent = this.shadowRoot.querySelector('.tab-page.active');
114
+ if (activeContent) {
115
+ this.shadowRoot.querySelector('.tab-pages').style.height = `${activeContent.scrollHeight}px`;
116
+ }
117
+ });
118
+
119
+ const tabPages = this.shadowRoot.querySelector('.tab-pages');
120
+ observer.observe(tabPages, {
121
+ childList: true,
122
+ subtree: true,
123
+ characterData: true
124
+ });
125
+ };
126
+ }
127
+
128
+ class nxTabPage extends HTMLElement {
129
+ constructor() {
130
+ super();
131
+ }
132
+
133
+ connectedCallback() {
134
+ this.caption = this.getAttribute('caption');
135
+ }
136
+ }
137
+
138
+ customElements.define('nx-tab', nxTab);
139
+ customElements.define('nx-tab-page', nxTabPage);