ninegrid2 6.765.0 → 6.767.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.
@@ -119422,76 +119422,6 @@ class nxDialog extends HTMLElement
119422
119422
 
119423
119423
  customElements.define("nx-dialog", nxDialog);
119424
119424
 
119425
- class nxDiv extends HTMLElement {
119426
- constructor() {
119427
- super();
119428
- this.attachShadow({ mode: "open" });
119429
- this.isCollapsed = false; // 검색 박스 상태 (true: 축소됨, false: 확장됨)
119430
- }
119431
-
119432
- connectedCallback() {
119433
- this.#init();
119434
- }
119435
-
119436
- getJsonData = () => {
119437
- const parent = this.shadowRoot.querySelector(".search-content");
119438
- const elements = parent.querySelectorAll("[id]");
119439
- const jsonData = {};
119440
-
119441
- elements.forEach(element => {
119442
- if (element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT") {
119443
- jsonData[element.id] = element.value;
119444
- } else {
119445
- jsonData[element.id] = element.textContent.trim();
119446
- }
119447
- });
119448
-
119449
- return jsonData;
119450
- };
119451
-
119452
- getSearchOptions = () => {
119453
-
119454
- };
119455
-
119456
- #init = () => {
119457
- const contents = this.innerHTML.trim();
119458
- this.innerHTML = ""; // 기존 내부 HTML 제거
119459
-
119460
- const htmlTmpl = document.createElement("template");
119461
- htmlTmpl.innerHTML = `
119462
- <style>
119463
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
119464
- ${ninegrid.getCustomPath(this,"nxDiv.css")}
119465
-
119466
- :host {
119467
- }
119468
- </style>
119469
-
119470
- <div class="search-container">
119471
- <span class="toggle-icon"></span>
119472
- <div class="search-content">${contents}</div>
119473
- </div>
119474
- `;
119475
-
119476
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
119477
-
119478
- this.#setupToggle();
119479
- }
119480
-
119481
- #setupToggle = () => {
119482
- const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
119483
- const searchContainer = this.shadowRoot.querySelector(".search-container");
119484
-
119485
- toggleIcon.addEventListener("click", () => {
119486
- this.isCollapsed = !this.isCollapsed;
119487
- //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
119488
- searchContainer.classList.toggle("collapse", this.isCollapsed);
119489
- });
119490
- }
119491
- }
119492
-
119493
- customElements.define("nx-div", nxDiv);
119494
-
119495
119425
  class nxI18nExt extends HTMLElement
119496
119426
  {
119497
119427
  #enableHtml;
@@ -120848,6 +120778,141 @@ Array.prototype.nineBinarySearch = function(target)
120848
120778
  return -1;
120849
120779
  };
120850
120780
 
120781
+ class nxDiv extends HTMLElement {
120782
+ constructor() {
120783
+ super();
120784
+ this.attachShadow({ mode: "open" });
120785
+ this.isCollapsed = false; // 검색 박스 상태 (true: 축소됨, false: 확장됨)
120786
+ }
120787
+
120788
+ connectedCallback() {
120789
+ this.#init();
120790
+ }
120791
+
120792
+ getJsonData = () => {
120793
+ const parent = this.shadowRoot.querySelector(".search-content");
120794
+ const elements = parent.querySelectorAll("[id]");
120795
+ const jsonData = {};
120796
+
120797
+ elements.forEach(element => {
120798
+ if (element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT") {
120799
+ jsonData[element.id] = element.value;
120800
+ } else {
120801
+ jsonData[element.id] = element.textContent.trim();
120802
+ }
120803
+ });
120804
+
120805
+ return jsonData;
120806
+ };
120807
+
120808
+ getSearchOptions = () => {
120809
+
120810
+ };
120811
+
120812
+ #init = () => {
120813
+ const contents = this.innerHTML.trim();
120814
+ this.innerHTML = ""; // 기존 내부 HTML 제거
120815
+
120816
+ const htmlTmpl = document.createElement("template");
120817
+ htmlTmpl.innerHTML = `
120818
+ <style>
120819
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
120820
+ ${ninegrid.getCustomPath(this,"nxDiv.css")}
120821
+ </style>
120822
+
120823
+ <div class="search-container">
120824
+ <span class="toggle-icon"></span>
120825
+ <div class="search-content">${contents}</div>
120826
+ </div>
120827
+ `;
120828
+
120829
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
120830
+
120831
+ this.#setupToggle();
120832
+ }
120833
+
120834
+ #setupToggle = () => {
120835
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
120836
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
120837
+
120838
+ toggleIcon.addEventListener("click", () => {
120839
+ this.isCollapsed = !this.isCollapsed;
120840
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
120841
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
120842
+ });
120843
+ }
120844
+ }
120845
+
120846
+ customElements.define("nx-div", nxDiv);
120847
+
120848
+ class nxCollapse extends HTMLElement {
120849
+ #target;
120850
+
120851
+ constructor() {
120852
+ super();
120853
+ this.attachShadow({ mode: "open" });
120854
+ }
120855
+
120856
+ connectedCallback() {
120857
+ const targetSelector = this.getAttribute("target");
120858
+ this.#target = ninegrid.querySelector(targetSelector);
120859
+ //if (!this.#target) return;
120860
+
120861
+ this.#init();
120862
+ }
120863
+
120864
+ #init = () => {
120865
+ this.innerHTML.trim();
120866
+ this.innerHTML = ""; // 기존 내부 HTML 제거
120867
+
120868
+ const htmlTmpl = document.createElement("template");
120869
+ htmlTmpl.innerHTML = `
120870
+ <style>
120871
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxCollapse.css";
120872
+ ${ninegrid.getCustomPath(this,"nxCollapse.css")}
120873
+ </style>
120874
+
120875
+ <div class="button">🔽 펼치기</div>
120876
+ `;
120877
+
120878
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
120879
+
120880
+ if (this.#target && this.#target) {
120881
+ const collapseBtn = document.createElement("button");
120882
+ collapseBtn.textContent = "📥 접기";
120883
+ collapseBtn.className = "collapse-toggle";
120884
+ collapseBtn.style.marginBottom = "8px";
120885
+
120886
+ this.#target.insertBefore(collapseBtn, this.#target.firstChild);
120887
+
120888
+ // collapse 시 target 숨기고 복원 버튼 등장
120889
+ collapseBtn.addEventListener("click", () => {
120890
+ this.#target.style.display = "none";
120891
+ this.style.display = "inline-block";
120892
+ });
120893
+ }
120894
+
120895
+ // 복원 시 target 보이고 복원 버튼 사라짐
120896
+ this.addEventListener("click", () => {
120897
+ this.#target.style.display = "";
120898
+ this.style.display = "none";
120899
+ });
120900
+ }
120901
+
120902
+ #setupToggle = () => {
120903
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
120904
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
120905
+
120906
+ toggleIcon.addEventListener("click", () => {
120907
+ this.isCollapsed = !this.isCollapsed;
120908
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
120909
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
120910
+ });
120911
+ }
120912
+ }
120913
+
120914
+ customElements.define("nx-collapse", nxCollapse);
120915
+
120851
120916
  class nxTab extends HTMLElement {
120852
120917
  constructor() {
120853
120918
  super();
@@ -120859,9 +120924,7 @@ class nxTab extends HTMLElement {
120859
120924
  ${ninegrid.getCustomPath(this,"nxTab.css")}
120860
120925
  </style>
120861
120926
 
120862
- <div class="tabs">
120863
- <button></button>
120864
- </div>
120927
+ <div class="tabs"></div>
120865
120928
  <div class="tab-pages"></div>
120866
120929
  `;
120867
120930
 
@@ -121181,57 +121244,34 @@ class nxSplitter extends HTMLElement {
121181
121244
 
121182
121245
  #prepareLayout = () => {
121183
121246
 
121184
-
121185
-
121186
121247
  const isHorizontal = this.#mode === "h";
121187
- isHorizontal ? this.offsetWidth : this.offsetHeight;
121188
121248
  const prev = this.previousElementSibling;
121189
121249
  const next = this.nextElementSibling;
121190
121250
  const parent = this.parentElement;
121191
121251
  if (!prev || !next || !parent) return;
121192
121252
 
121193
121253
  const currentTotal = this.#getSiblingSizeSum();
121194
-
121195
-
121196
- const parentSize = isHorizontal
121254
+ const nextTotal = isHorizontal
121197
121255
  ? parent.getBoundingClientRect().width
121198
121256
  : parent.getBoundingClientRect().height;
121199
121257
 
121200
-
121201
- console.log(currentTotal, parentSize);
121202
-
121203
121258
  // 현재 패널 크기 측정
121204
121259
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121205
121260
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121206
- //const totalPanelSize = siblingSize;
121207
121261
 
121208
121262
  // 현재 비율 계산
121209
- const prevRatio = currentTotal ? prevSize / currentTotal : 0.5;
121210
- //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
121211
- //const nextRatio = 1 - prevRatio;
121212
-
121213
- // currentTotal : parentSize = prevSize : x
121214
- // 새로운 available 크기
121215
- //const available = parentSize - splitterSize;
121216
-
121217
- const newPrevSize = parentSize * prevSize / currentTotal;
121218
- //const newNextSize = (prevSize + nextSize) - newPrevSize;
121219
- const newNextSize = parentSize * nextSize / currentTotal;
121220
-
121221
-
121263
+ const newPrevSize = nextTotal * prevSize / currentTotal;
121264
+ const newNextSize = nextTotal * nextSize / currentTotal;
121222
121265
 
121223
- console.log(newPrevSize, newNextSize, prevRatio);
121224
121266
 
121225
121267
  if (isHorizontal) {
121226
121268
  prev.style.width = `${newPrevSize}px`;
121227
- //this.style.width = `${splitterSize}px`;
121228
121269
 
121229
121270
  if (this.#isLastSplitter()) {
121230
121271
  next.style.width = `${newNextSize}px`;
121231
121272
  }
121232
121273
  } else {
121233
121274
  prev.style.height = `${newPrevSize}px`;
121234
- //this.style.height = `${splitterSize}px`;
121235
121275
 
121236
121276
  if (this.#isLastSplitter()) {
121237
121277
  next.style.height = `${newNextSize}px`;
@@ -119418,76 +119418,6 @@ class nxDialog extends HTMLElement
119418
119418
 
119419
119419
  customElements.define("nx-dialog", nxDialog);
119420
119420
 
119421
- class nxDiv extends HTMLElement {
119422
- constructor() {
119423
- super();
119424
- this.attachShadow({ mode: "open" });
119425
- this.isCollapsed = false; // 검색 박스 상태 (true: 축소됨, false: 확장됨)
119426
- }
119427
-
119428
- connectedCallback() {
119429
- this.#init();
119430
- }
119431
-
119432
- getJsonData = () => {
119433
- const parent = this.shadowRoot.querySelector(".search-content");
119434
- const elements = parent.querySelectorAll("[id]");
119435
- const jsonData = {};
119436
-
119437
- elements.forEach(element => {
119438
- if (element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT") {
119439
- jsonData[element.id] = element.value;
119440
- } else {
119441
- jsonData[element.id] = element.textContent.trim();
119442
- }
119443
- });
119444
-
119445
- return jsonData;
119446
- };
119447
-
119448
- getSearchOptions = () => {
119449
-
119450
- };
119451
-
119452
- #init = () => {
119453
- const contents = this.innerHTML.trim();
119454
- this.innerHTML = ""; // 기존 내부 HTML 제거
119455
-
119456
- const htmlTmpl = document.createElement("template");
119457
- htmlTmpl.innerHTML = `
119458
- <style>
119459
- @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
119460
- ${ninegrid.getCustomPath(this,"nxDiv.css")}
119461
-
119462
- :host {
119463
- }
119464
- </style>
119465
-
119466
- <div class="search-container">
119467
- <span class="toggle-icon"></span>
119468
- <div class="search-content">${contents}</div>
119469
- </div>
119470
- `;
119471
-
119472
- this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
119473
-
119474
- this.#setupToggle();
119475
- }
119476
-
119477
- #setupToggle = () => {
119478
- const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
119479
- const searchContainer = this.shadowRoot.querySelector(".search-container");
119480
-
119481
- toggleIcon.addEventListener("click", () => {
119482
- this.isCollapsed = !this.isCollapsed;
119483
- //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
119484
- searchContainer.classList.toggle("collapse", this.isCollapsed);
119485
- });
119486
- }
119487
- }
119488
-
119489
- customElements.define("nx-div", nxDiv);
119490
-
119491
119421
  class nxI18nExt extends HTMLElement
119492
119422
  {
119493
119423
  #enableHtml;
@@ -120844,6 +120774,141 @@ Array.prototype.nineBinarySearch = function(target)
120844
120774
  return -1;
120845
120775
  };
120846
120776
 
120777
+ class nxDiv extends HTMLElement {
120778
+ constructor() {
120779
+ super();
120780
+ this.attachShadow({ mode: "open" });
120781
+ this.isCollapsed = false; // 검색 박스 상태 (true: 축소됨, false: 확장됨)
120782
+ }
120783
+
120784
+ connectedCallback() {
120785
+ this.#init();
120786
+ }
120787
+
120788
+ getJsonData = () => {
120789
+ const parent = this.shadowRoot.querySelector(".search-content");
120790
+ const elements = parent.querySelectorAll("[id]");
120791
+ const jsonData = {};
120792
+
120793
+ elements.forEach(element => {
120794
+ if (element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT") {
120795
+ jsonData[element.id] = element.value;
120796
+ } else {
120797
+ jsonData[element.id] = element.textContent.trim();
120798
+ }
120799
+ });
120800
+
120801
+ return jsonData;
120802
+ };
120803
+
120804
+ getSearchOptions = () => {
120805
+
120806
+ };
120807
+
120808
+ #init = () => {
120809
+ const contents = this.innerHTML.trim();
120810
+ this.innerHTML = ""; // 기존 내부 HTML 제거
120811
+
120812
+ const htmlTmpl = document.createElement("template");
120813
+ htmlTmpl.innerHTML = `
120814
+ <style>
120815
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
120816
+ ${ninegrid.getCustomPath(this,"nxDiv.css")}
120817
+ </style>
120818
+
120819
+ <div class="search-container">
120820
+ <span class="toggle-icon"></span>
120821
+ <div class="search-content">${contents}</div>
120822
+ </div>
120823
+ `;
120824
+
120825
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
120826
+
120827
+ this.#setupToggle();
120828
+ }
120829
+
120830
+ #setupToggle = () => {
120831
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
120832
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
120833
+
120834
+ toggleIcon.addEventListener("click", () => {
120835
+ this.isCollapsed = !this.isCollapsed;
120836
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
120837
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
120838
+ });
120839
+ }
120840
+ }
120841
+
120842
+ customElements.define("nx-div", nxDiv);
120843
+
120844
+ class nxCollapse extends HTMLElement {
120845
+ #target;
120846
+
120847
+ constructor() {
120848
+ super();
120849
+ this.attachShadow({ mode: "open" });
120850
+ }
120851
+
120852
+ connectedCallback() {
120853
+ const targetSelector = this.getAttribute("target");
120854
+ this.#target = ninegrid.querySelector(targetSelector);
120855
+ //if (!this.#target) return;
120856
+
120857
+ this.#init();
120858
+ }
120859
+
120860
+ #init = () => {
120861
+ this.innerHTML.trim();
120862
+ this.innerHTML = ""; // 기존 내부 HTML 제거
120863
+
120864
+ const htmlTmpl = document.createElement("template");
120865
+ htmlTmpl.innerHTML = `
120866
+ <style>
120867
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxCollapse.css";
120868
+ ${ninegrid.getCustomPath(this,"nxCollapse.css")}
120869
+ </style>
120870
+
120871
+ <div class="button">🔽 펼치기</div>
120872
+ `;
120873
+
120874
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
120875
+
120876
+ if (this.#target && this.#target) {
120877
+ const collapseBtn = document.createElement("button");
120878
+ collapseBtn.textContent = "📥 접기";
120879
+ collapseBtn.className = "collapse-toggle";
120880
+ collapseBtn.style.marginBottom = "8px";
120881
+
120882
+ this.#target.insertBefore(collapseBtn, this.#target.firstChild);
120883
+
120884
+ // collapse 시 target 숨기고 복원 버튼 등장
120885
+ collapseBtn.addEventListener("click", () => {
120886
+ this.#target.style.display = "none";
120887
+ this.style.display = "inline-block";
120888
+ });
120889
+ }
120890
+
120891
+ // 복원 시 target 보이고 복원 버튼 사라짐
120892
+ this.addEventListener("click", () => {
120893
+ this.#target.style.display = "";
120894
+ this.style.display = "none";
120895
+ });
120896
+ }
120897
+
120898
+ #setupToggle = () => {
120899
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
120900
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
120901
+
120902
+ toggleIcon.addEventListener("click", () => {
120903
+ this.isCollapsed = !this.isCollapsed;
120904
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
120905
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
120906
+ });
120907
+ }
120908
+ }
120909
+
120910
+ customElements.define("nx-collapse", nxCollapse);
120911
+
120847
120912
  class nxTab extends HTMLElement {
120848
120913
  constructor() {
120849
120914
  super();
@@ -120855,9 +120920,7 @@ class nxTab extends HTMLElement {
120855
120920
  ${ninegrid.getCustomPath(this,"nxTab.css")}
120856
120921
  </style>
120857
120922
 
120858
- <div class="tabs">
120859
- <button></button>
120860
- </div>
120923
+ <div class="tabs"></div>
120861
120924
  <div class="tab-pages"></div>
120862
120925
  `;
120863
120926
 
@@ -121177,57 +121240,34 @@ class nxSplitter extends HTMLElement {
121177
121240
 
121178
121241
  #prepareLayout = () => {
121179
121242
 
121180
-
121181
-
121182
121243
  const isHorizontal = this.#mode === "h";
121183
- isHorizontal ? this.offsetWidth : this.offsetHeight;
121184
121244
  const prev = this.previousElementSibling;
121185
121245
  const next = this.nextElementSibling;
121186
121246
  const parent = this.parentElement;
121187
121247
  if (!prev || !next || !parent) return;
121188
121248
 
121189
121249
  const currentTotal = this.#getSiblingSizeSum();
121190
-
121191
-
121192
- const parentSize = isHorizontal
121250
+ const nextTotal = isHorizontal
121193
121251
  ? parent.getBoundingClientRect().width
121194
121252
  : parent.getBoundingClientRect().height;
121195
121253
 
121196
-
121197
- console.log(currentTotal, parentSize);
121198
-
121199
121254
  // 현재 패널 크기 측정
121200
121255
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
121201
121256
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
121202
- //const totalPanelSize = siblingSize;
121203
121257
 
121204
121258
  // 현재 비율 계산
121205
- const prevRatio = currentTotal ? prevSize / currentTotal : 0.5;
121206
- //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
121207
- //const nextRatio = 1 - prevRatio;
121208
-
121209
- // currentTotal : parentSize = prevSize : x
121210
- // 새로운 available 크기
121211
- //const available = parentSize - splitterSize;
121212
-
121213
- const newPrevSize = parentSize * prevSize / currentTotal;
121214
- //const newNextSize = (prevSize + nextSize) - newPrevSize;
121215
- const newNextSize = parentSize * nextSize / currentTotal;
121216
-
121217
-
121259
+ const newPrevSize = nextTotal * prevSize / currentTotal;
121260
+ const newNextSize = nextTotal * nextSize / currentTotal;
121218
121261
 
121219
- console.log(newPrevSize, newNextSize, prevRatio);
121220
121262
 
121221
121263
  if (isHorizontal) {
121222
121264
  prev.style.width = `${newPrevSize}px`;
121223
- //this.style.width = `${splitterSize}px`;
121224
121265
 
121225
121266
  if (this.#isLastSplitter()) {
121226
121267
  next.style.width = `${newNextSize}px`;
121227
121268
  }
121228
121269
  } else {
121229
121270
  prev.style.height = `${newPrevSize}px`;
121230
- //this.style.height = `${splitterSize}px`;
121231
121271
 
121232
121272
  if (this.#isLastSplitter()) {
121233
121273
  next.style.height = `${newNextSize}px`;
package/dist/index.js CHANGED
@@ -88,7 +88,6 @@ import "./etc/ngView.js";
88
88
  import { NineGridContainer } from "./etc/ninegridContainer.js";
89
89
  import "./etc/nxConfirm.js";
90
90
  import "./etc/nxDialog.js";
91
- import "./etc/nxDiv.js";
92
91
  import "./etc/nxI18nExt.js";
93
92
  import "./etc/nxSidebar.js";
94
93
  import "./etc/nxSideMenu.js";
@@ -100,6 +99,8 @@ import "./etc/nxTopMenu.js";
100
99
  import "./utils/ngFiltering.js";
101
100
  import "./utils/ngPrototype.js";
102
101
 
102
+ import "./nx/nxDiv.js";
103
+ import "./nx/nxCollapse.js";
103
104
  import "./nx/nxTab.js";
104
105
  import "./nx/nxSplitter.js";
105
106
  import "./nx/nxForm.js";
@@ -0,0 +1,69 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxCollapse extends HTMLElement {
4
+ #target;
5
+
6
+ constructor() {
7
+ super();
8
+ this.attachShadow({ mode: "open" });
9
+ }
10
+
11
+ connectedCallback() {
12
+ const targetSelector = this.getAttribute("target");
13
+ this.#target = ninegrid.querySelector(targetSelector);
14
+ //if (!this.#target) return;
15
+
16
+ this.#init();
17
+ }
18
+
19
+ #init = () => {
20
+ const contents = this.innerHTML.trim();
21
+ this.innerHTML = ""; // 기존 내부 HTML 제거
22
+
23
+ const htmlTmpl = document.createElement("template");
24
+ htmlTmpl.innerHTML = `
25
+ <style>
26
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxCollapse.css";
27
+ ${ninegrid.getCustomPath(this,"nxCollapse.css")}
28
+ </style>
29
+
30
+ <div class="button">🔽 펼치기</div>
31
+ `;
32
+
33
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
34
+
35
+ if (this.#target && this.#target) {
36
+ const collapseBtn = document.createElement("button");
37
+ collapseBtn.textContent = "📥 접기";
38
+ collapseBtn.className = "collapse-toggle";
39
+ collapseBtn.style.marginBottom = "8px";
40
+
41
+ this.#target.insertBefore(collapseBtn, this.#target.firstChild);
42
+
43
+ // collapse 시 target 숨기고 복원 버튼 등장
44
+ collapseBtn.addEventListener("click", () => {
45
+ this.#target.style.display = "none";
46
+ this.style.display = "inline-block";
47
+ });
48
+ }
49
+
50
+ // 복원 시 target 보이고 복원 버튼 사라짐
51
+ this.addEventListener("click", () => {
52
+ this.#target.style.display = "";
53
+ this.style.display = "none";
54
+ });
55
+ }
56
+
57
+ #setupToggle = () => {
58
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
59
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
60
+
61
+ toggleIcon.addEventListener("click", () => {
62
+ this.isCollapsed = !this.isCollapsed;
63
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
64
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
65
+ });
66
+ }
67
+ }
68
+
69
+ customElements.define("nx-collapse", nxCollapse);
@@ -40,9 +40,6 @@ class nxDiv extends HTMLElement {
40
40
  <style>
41
41
  @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
42
42
  ${ninegrid.getCustomPath(this,"nxDiv.css")}
43
-
44
- :host {
45
- }
46
43
  </style>
47
44
 
48
45
  <div class="search-container">
@@ -194,57 +194,34 @@ class nxSplitter extends HTMLElement {
194
194
 
195
195
  #prepareLayout = () => {
196
196
 
197
-
198
-
199
197
  const isHorizontal = this.#mode === "h";
200
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
201
198
  const prev = this.previousElementSibling;
202
199
  const next = this.nextElementSibling;
203
200
  const parent = this.parentElement;
204
201
  if (!prev || !next || !parent) return;
205
202
 
206
203
  const currentTotal = this.#getSiblingSizeSum();
207
-
208
-
209
- const parentSize = isHorizontal
204
+ const nextTotal = isHorizontal
210
205
  ? parent.getBoundingClientRect().width
211
206
  : parent.getBoundingClientRect().height;
212
207
 
213
-
214
- console.log(currentTotal, parentSize);
215
-
216
208
  // 현재 패널 크기 측정
217
209
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
218
210
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
219
- //const totalPanelSize = siblingSize;
220
211
 
221
212
  // 현재 비율 계산
222
- const prevRatio = currentTotal ? prevSize / currentTotal : 0.5;
223
- //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
224
- //const nextRatio = 1 - prevRatio;
225
-
226
- // currentTotal : parentSize = prevSize : x
227
- // 새로운 available 크기
228
- //const available = parentSize - splitterSize;
229
-
230
- const newPrevSize = parentSize * prevSize / currentTotal;
231
- //const newNextSize = (prevSize + nextSize) - newPrevSize;
232
- const newNextSize = parentSize * nextSize / currentTotal;
233
-
234
-
213
+ const newPrevSize = nextTotal * prevSize / currentTotal;
214
+ const newNextSize = nextTotal * nextSize / currentTotal;
235
215
 
236
- console.log(newPrevSize, newNextSize, prevRatio);
237
216
 
238
217
  if (isHorizontal) {
239
218
  prev.style.width = `${newPrevSize}px`;
240
- //this.style.width = `${splitterSize}px`;
241
219
 
242
220
  if (this.#isLastSplitter()) {
243
221
  next.style.width = `${newNextSize}px`;
244
222
  }
245
223
  } else {
246
224
  prev.style.height = `${newPrevSize}px`;
247
- //this.style.height = `${splitterSize}px`;
248
225
 
249
226
  if (this.#isLastSplitter()) {
250
227
  next.style.height = `${newNextSize}px`;
package/dist/nx/nxTab.js CHANGED
@@ -11,9 +11,7 @@ class nxTab extends HTMLElement {
11
11
  ${ninegrid.getCustomPath(this,"nxTab.css")}
12
12
  </style>
13
13
 
14
- <div class="tabs">
15
- <button></button>
16
- </div>
14
+ <div class="tabs"></div>
17
15
  <div class="tab-pages"></div>
18
16
  `;
19
17
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.765.0",
4
+ "version": "6.767.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
package/src/index.js CHANGED
@@ -88,7 +88,6 @@ import "./etc/ngView.js";
88
88
  import { NineGridContainer } from "./etc/ninegridContainer.js";
89
89
  import "./etc/nxConfirm.js";
90
90
  import "./etc/nxDialog.js";
91
- import "./etc/nxDiv.js";
92
91
  import "./etc/nxI18nExt.js";
93
92
  import "./etc/nxSidebar.js";
94
93
  import "./etc/nxSideMenu.js";
@@ -100,6 +99,8 @@ import "./etc/nxTopMenu.js";
100
99
  import "./utils/ngFiltering.js";
101
100
  import "./utils/ngPrototype.js";
102
101
 
102
+ import "./nx/nxDiv.js";
103
+ import "./nx/nxCollapse.js";
103
104
  import "./nx/nxTab.js";
104
105
  import "./nx/nxSplitter.js";
105
106
  import "./nx/nxForm.js";
@@ -0,0 +1,69 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxCollapse extends HTMLElement {
4
+ #target;
5
+
6
+ constructor() {
7
+ super();
8
+ this.attachShadow({ mode: "open" });
9
+ }
10
+
11
+ connectedCallback() {
12
+ const targetSelector = this.getAttribute("target");
13
+ this.#target = ninegrid.querySelector(targetSelector);
14
+ //if (!this.#target) return;
15
+
16
+ this.#init();
17
+ }
18
+
19
+ #init = () => {
20
+ const contents = this.innerHTML.trim();
21
+ this.innerHTML = ""; // 기존 내부 HTML 제거
22
+
23
+ const htmlTmpl = document.createElement("template");
24
+ htmlTmpl.innerHTML = `
25
+ <style>
26
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxCollapse.css";
27
+ ${ninegrid.getCustomPath(this,"nxCollapse.css")}
28
+ </style>
29
+
30
+ <div class="button">🔽 펼치기</div>
31
+ `;
32
+
33
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
34
+
35
+ if (this.#target && this.#target) {
36
+ const collapseBtn = document.createElement("button");
37
+ collapseBtn.textContent = "📥 접기";
38
+ collapseBtn.className = "collapse-toggle";
39
+ collapseBtn.style.marginBottom = "8px";
40
+
41
+ this.#target.insertBefore(collapseBtn, this.#target.firstChild);
42
+
43
+ // collapse 시 target 숨기고 복원 버튼 등장
44
+ collapseBtn.addEventListener("click", () => {
45
+ this.#target.style.display = "none";
46
+ this.style.display = "inline-block";
47
+ });
48
+ }
49
+
50
+ // 복원 시 target 보이고 복원 버튼 사라짐
51
+ this.addEventListener("click", () => {
52
+ this.#target.style.display = "";
53
+ this.style.display = "none";
54
+ });
55
+ }
56
+
57
+ #setupToggle = () => {
58
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
59
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
60
+
61
+ toggleIcon.addEventListener("click", () => {
62
+ this.isCollapsed = !this.isCollapsed;
63
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
64
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
65
+ });
66
+ }
67
+ }
68
+
69
+ customElements.define("nx-collapse", nxCollapse);
@@ -0,0 +1,68 @@
1
+ import ninegrid from "../index.js";
2
+
3
+ class nxDiv extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.attachShadow({ mode: "open" });
7
+ this.isCollapsed = false; // 검색 박스 상태 (true: 축소됨, false: 확장됨)
8
+ }
9
+
10
+ connectedCallback() {
11
+ this.#init();
12
+ }
13
+
14
+ getJsonData = () => {
15
+ const parent = this.shadowRoot.querySelector(".search-content");
16
+ const elements = parent.querySelectorAll("[id]");
17
+ const jsonData = {};
18
+
19
+ elements.forEach(element => {
20
+ if (element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT") {
21
+ jsonData[element.id] = element.value;
22
+ } else {
23
+ jsonData[element.id] = element.textContent.trim();
24
+ }
25
+ });
26
+
27
+ return jsonData;
28
+ };
29
+
30
+ getSearchOptions = () => {
31
+
32
+ };
33
+
34
+ #init = () => {
35
+ const contents = this.innerHTML.trim();
36
+ this.innerHTML = ""; // 기존 내부 HTML 제거
37
+
38
+ const htmlTmpl = document.createElement("template");
39
+ htmlTmpl.innerHTML = `
40
+ <style>
41
+ @import "https://cdn.jsdelivr.net/npm/ninegrid@${ninegrid.version}/dist/css/nxDiv.css";
42
+ ${ninegrid.getCustomPath(this,"nxDiv.css")}
43
+ </style>
44
+
45
+ <div class="search-container">
46
+ <span class="toggle-icon"></span>
47
+ <div class="search-content">${contents}</div>
48
+ </div>
49
+ `;
50
+
51
+ this.shadowRoot.appendChild(htmlTmpl.content.cloneNode(true));
52
+
53
+ this.#setupToggle();
54
+ }
55
+
56
+ #setupToggle = () => {
57
+ const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
58
+ const searchContainer = this.shadowRoot.querySelector(".search-container");
59
+
60
+ toggleIcon.addEventListener("click", () => {
61
+ this.isCollapsed = !this.isCollapsed;
62
+ //toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
63
+ searchContainer.classList.toggle("collapse", this.isCollapsed);
64
+ });
65
+ }
66
+ }
67
+
68
+ customElements.define("nx-div", nxDiv);
@@ -194,57 +194,34 @@ class nxSplitter extends HTMLElement {
194
194
 
195
195
  #prepareLayout = () => {
196
196
 
197
-
198
-
199
197
  const isHorizontal = this.#mode === "h";
200
- const splitterSize = isHorizontal ? this.offsetWidth : this.offsetHeight;
201
198
  const prev = this.previousElementSibling;
202
199
  const next = this.nextElementSibling;
203
200
  const parent = this.parentElement;
204
201
  if (!prev || !next || !parent) return;
205
202
 
206
203
  const currentTotal = this.#getSiblingSizeSum();
207
-
208
-
209
- const parentSize = isHorizontal
204
+ const nextTotal = isHorizontal
210
205
  ? parent.getBoundingClientRect().width
211
206
  : parent.getBoundingClientRect().height;
212
207
 
213
-
214
- console.log(currentTotal, parentSize);
215
-
216
208
  // 현재 패널 크기 측정
217
209
  const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
218
210
  const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
219
- //const totalPanelSize = siblingSize;
220
211
 
221
212
  // 현재 비율 계산
222
- const prevRatio = currentTotal ? prevSize / currentTotal : 0.5;
223
- //const prevRatio = parentSize ? prevSize / parentSize : 0.5;
224
- //const nextRatio = 1 - prevRatio;
225
-
226
- // currentTotal : parentSize = prevSize : x
227
- // 새로운 available 크기
228
- //const available = parentSize - splitterSize;
229
-
230
- const newPrevSize = parentSize * prevSize / currentTotal;
231
- //const newNextSize = (prevSize + nextSize) - newPrevSize;
232
- const newNextSize = parentSize * nextSize / currentTotal;
233
-
234
-
213
+ const newPrevSize = nextTotal * prevSize / currentTotal;
214
+ const newNextSize = nextTotal * nextSize / currentTotal;
235
215
 
236
- console.log(newPrevSize, newNextSize, prevRatio);
237
216
 
238
217
  if (isHorizontal) {
239
218
  prev.style.width = `${newPrevSize}px`;
240
- //this.style.width = `${splitterSize}px`;
241
219
 
242
220
  if (this.#isLastSplitter()) {
243
221
  next.style.width = `${newNextSize}px`;
244
222
  }
245
223
  } else {
246
224
  prev.style.height = `${newPrevSize}px`;
247
- //this.style.height = `${splitterSize}px`;
248
225
 
249
226
  if (this.#isLastSplitter()) {
250
227
  next.style.height = `${newNextSize}px`;
package/src/nx/nxTab.js CHANGED
@@ -11,9 +11,7 @@ class nxTab extends HTMLElement {
11
11
  ${ninegrid.getCustomPath(this,"nxTab.css")}
12
12
  </style>
13
13
 
14
- <div class="tabs">
15
- <button></button>
16
- </div>
14
+ <div class="tabs"></div>
17
15
  <div class="tab-pages"></div>
18
16
  `;
19
17