ninegrid2 6.765.0 → 6.766.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.
- package/dist/bundle.cjs.js +137 -99
- package/dist/bundle.esm.js +137 -99
- package/dist/index.js +2 -1
- package/dist/nx/nxCollapse.js +67 -0
- package/{src/etc → dist/nx}/nxDiv.js +0 -3
- package/dist/nx/nxSplitter.js +3 -26
- package/dist/nx/nxTab.js +1 -3
- package/package.json +1 -1
- package/src/index.js +2 -1
- package/src/nx/nxCollapse.js +67 -0
- package/src/nx/nxDiv.js +68 -0
- package/src/nx/nxSplitter.js +3 -26
- package/src/nx/nxTab.js +1 -3
package/dist/bundle.cjs.js
CHANGED
|
@@ -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,139 @@ 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
|
+
if (this.#target && this.#target) {
|
|
120879
|
+
const collapseBtn = document.createElement("button");
|
|
120880
|
+
collapseBtn.textContent = "📥 접기";
|
|
120881
|
+
collapseBtn.className = "collapse-toggle";
|
|
120882
|
+
collapseBtn.style.marginBottom = "8px";
|
|
120883
|
+
|
|
120884
|
+
this.#target.insertBefore(collapseBtn, this.#target.firstChild);
|
|
120885
|
+
|
|
120886
|
+
// collapse 시 target 숨기고 복원 버튼 등장
|
|
120887
|
+
collapseBtn.addEventListener("click", () => {
|
|
120888
|
+
this.#target.style.display = "none";
|
|
120889
|
+
this.style.display = "inline-block";
|
|
120890
|
+
});
|
|
120891
|
+
}
|
|
120892
|
+
|
|
120893
|
+
// 복원 시 target 보이고 복원 버튼 사라짐
|
|
120894
|
+
this.addEventListener("click", () => {
|
|
120895
|
+
this.#target.style.display = "";
|
|
120896
|
+
this.style.display = "none";
|
|
120897
|
+
});
|
|
120898
|
+
}
|
|
120899
|
+
|
|
120900
|
+
#setupToggle = () => {
|
|
120901
|
+
const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
|
|
120902
|
+
const searchContainer = this.shadowRoot.querySelector(".search-container");
|
|
120903
|
+
|
|
120904
|
+
toggleIcon.addEventListener("click", () => {
|
|
120905
|
+
this.isCollapsed = !this.isCollapsed;
|
|
120906
|
+
//toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
|
|
120907
|
+
searchContainer.classList.toggle("collapse", this.isCollapsed);
|
|
120908
|
+
});
|
|
120909
|
+
}
|
|
120910
|
+
}
|
|
120911
|
+
|
|
120912
|
+
customElements.define("nx-collapse", nxCollapse);
|
|
120913
|
+
|
|
120851
120914
|
class nxTab extends HTMLElement {
|
|
120852
120915
|
constructor() {
|
|
120853
120916
|
super();
|
|
@@ -120859,9 +120922,7 @@ class nxTab extends HTMLElement {
|
|
|
120859
120922
|
${ninegrid.getCustomPath(this,"nxTab.css")}
|
|
120860
120923
|
</style>
|
|
120861
120924
|
|
|
120862
|
-
<div class="tabs">
|
|
120863
|
-
<button></button>
|
|
120864
|
-
</div>
|
|
120925
|
+
<div class="tabs"></div>
|
|
120865
120926
|
<div class="tab-pages"></div>
|
|
120866
120927
|
`;
|
|
120867
120928
|
|
|
@@ -121181,57 +121242,34 @@ class nxSplitter extends HTMLElement {
|
|
|
121181
121242
|
|
|
121182
121243
|
#prepareLayout = () => {
|
|
121183
121244
|
|
|
121184
|
-
|
|
121185
|
-
|
|
121186
121245
|
const isHorizontal = this.#mode === "h";
|
|
121187
|
-
isHorizontal ? this.offsetWidth : this.offsetHeight;
|
|
121188
121246
|
const prev = this.previousElementSibling;
|
|
121189
121247
|
const next = this.nextElementSibling;
|
|
121190
121248
|
const parent = this.parentElement;
|
|
121191
121249
|
if (!prev || !next || !parent) return;
|
|
121192
121250
|
|
|
121193
121251
|
const currentTotal = this.#getSiblingSizeSum();
|
|
121194
|
-
|
|
121195
|
-
|
|
121196
|
-
const parentSize = isHorizontal
|
|
121252
|
+
const nextTotal = isHorizontal
|
|
121197
121253
|
? parent.getBoundingClientRect().width
|
|
121198
121254
|
: parent.getBoundingClientRect().height;
|
|
121199
121255
|
|
|
121200
|
-
|
|
121201
|
-
console.log(currentTotal, parentSize);
|
|
121202
|
-
|
|
121203
121256
|
// 현재 패널 크기 측정
|
|
121204
121257
|
const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
|
|
121205
121258
|
const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
|
|
121206
|
-
//const totalPanelSize = siblingSize;
|
|
121207
121259
|
|
|
121208
121260
|
// 현재 비율 계산
|
|
121209
|
-
const
|
|
121210
|
-
|
|
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
|
-
|
|
121261
|
+
const newPrevSize = nextTotal * prevSize / currentTotal;
|
|
121262
|
+
const newNextSize = nextTotal * nextSize / currentTotal;
|
|
121222
121263
|
|
|
121223
|
-
console.log(newPrevSize, newNextSize, prevRatio);
|
|
121224
121264
|
|
|
121225
121265
|
if (isHorizontal) {
|
|
121226
121266
|
prev.style.width = `${newPrevSize}px`;
|
|
121227
|
-
//this.style.width = `${splitterSize}px`;
|
|
121228
121267
|
|
|
121229
121268
|
if (this.#isLastSplitter()) {
|
|
121230
121269
|
next.style.width = `${newNextSize}px`;
|
|
121231
121270
|
}
|
|
121232
121271
|
} else {
|
|
121233
121272
|
prev.style.height = `${newPrevSize}px`;
|
|
121234
|
-
//this.style.height = `${splitterSize}px`;
|
|
121235
121273
|
|
|
121236
121274
|
if (this.#isLastSplitter()) {
|
|
121237
121275
|
next.style.height = `${newNextSize}px`;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -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,139 @@ 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
|
+
if (this.#target && this.#target) {
|
|
120875
|
+
const collapseBtn = document.createElement("button");
|
|
120876
|
+
collapseBtn.textContent = "📥 접기";
|
|
120877
|
+
collapseBtn.className = "collapse-toggle";
|
|
120878
|
+
collapseBtn.style.marginBottom = "8px";
|
|
120879
|
+
|
|
120880
|
+
this.#target.insertBefore(collapseBtn, this.#target.firstChild);
|
|
120881
|
+
|
|
120882
|
+
// collapse 시 target 숨기고 복원 버튼 등장
|
|
120883
|
+
collapseBtn.addEventListener("click", () => {
|
|
120884
|
+
this.#target.style.display = "none";
|
|
120885
|
+
this.style.display = "inline-block";
|
|
120886
|
+
});
|
|
120887
|
+
}
|
|
120888
|
+
|
|
120889
|
+
// 복원 시 target 보이고 복원 버튼 사라짐
|
|
120890
|
+
this.addEventListener("click", () => {
|
|
120891
|
+
this.#target.style.display = "";
|
|
120892
|
+
this.style.display = "none";
|
|
120893
|
+
});
|
|
120894
|
+
}
|
|
120895
|
+
|
|
120896
|
+
#setupToggle = () => {
|
|
120897
|
+
const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
|
|
120898
|
+
const searchContainer = this.shadowRoot.querySelector(".search-container");
|
|
120899
|
+
|
|
120900
|
+
toggleIcon.addEventListener("click", () => {
|
|
120901
|
+
this.isCollapsed = !this.isCollapsed;
|
|
120902
|
+
//toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
|
|
120903
|
+
searchContainer.classList.toggle("collapse", this.isCollapsed);
|
|
120904
|
+
});
|
|
120905
|
+
}
|
|
120906
|
+
}
|
|
120907
|
+
|
|
120908
|
+
customElements.define("nx-collapse", nxCollapse);
|
|
120909
|
+
|
|
120847
120910
|
class nxTab extends HTMLElement {
|
|
120848
120911
|
constructor() {
|
|
120849
120912
|
super();
|
|
@@ -120855,9 +120918,7 @@ class nxTab extends HTMLElement {
|
|
|
120855
120918
|
${ninegrid.getCustomPath(this,"nxTab.css")}
|
|
120856
120919
|
</style>
|
|
120857
120920
|
|
|
120858
|
-
<div class="tabs">
|
|
120859
|
-
<button></button>
|
|
120860
|
-
</div>
|
|
120921
|
+
<div class="tabs"></div>
|
|
120861
120922
|
<div class="tab-pages"></div>
|
|
120862
120923
|
`;
|
|
120863
120924
|
|
|
@@ -121177,57 +121238,34 @@ class nxSplitter extends HTMLElement {
|
|
|
121177
121238
|
|
|
121178
121239
|
#prepareLayout = () => {
|
|
121179
121240
|
|
|
121180
|
-
|
|
121181
|
-
|
|
121182
121241
|
const isHorizontal = this.#mode === "h";
|
|
121183
|
-
isHorizontal ? this.offsetWidth : this.offsetHeight;
|
|
121184
121242
|
const prev = this.previousElementSibling;
|
|
121185
121243
|
const next = this.nextElementSibling;
|
|
121186
121244
|
const parent = this.parentElement;
|
|
121187
121245
|
if (!prev || !next || !parent) return;
|
|
121188
121246
|
|
|
121189
121247
|
const currentTotal = this.#getSiblingSizeSum();
|
|
121190
|
-
|
|
121191
|
-
|
|
121192
|
-
const parentSize = isHorizontal
|
|
121248
|
+
const nextTotal = isHorizontal
|
|
121193
121249
|
? parent.getBoundingClientRect().width
|
|
121194
121250
|
: parent.getBoundingClientRect().height;
|
|
121195
121251
|
|
|
121196
|
-
|
|
121197
|
-
console.log(currentTotal, parentSize);
|
|
121198
|
-
|
|
121199
121252
|
// 현재 패널 크기 측정
|
|
121200
121253
|
const prevSize = isHorizontal ? prev.offsetWidth : prev.offsetHeight;
|
|
121201
121254
|
const nextSize = isHorizontal ? next.offsetWidth : next.offsetHeight;
|
|
121202
|
-
//const totalPanelSize = siblingSize;
|
|
121203
121255
|
|
|
121204
121256
|
// 현재 비율 계산
|
|
121205
|
-
const
|
|
121206
|
-
|
|
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
|
-
|
|
121257
|
+
const newPrevSize = nextTotal * prevSize / currentTotal;
|
|
121258
|
+
const newNextSize = nextTotal * nextSize / currentTotal;
|
|
121218
121259
|
|
|
121219
|
-
console.log(newPrevSize, newNextSize, prevRatio);
|
|
121220
121260
|
|
|
121221
121261
|
if (isHorizontal) {
|
|
121222
121262
|
prev.style.width = `${newPrevSize}px`;
|
|
121223
|
-
//this.style.width = `${splitterSize}px`;
|
|
121224
121263
|
|
|
121225
121264
|
if (this.#isLastSplitter()) {
|
|
121226
121265
|
next.style.width = `${newNextSize}px`;
|
|
121227
121266
|
}
|
|
121228
121267
|
} else {
|
|
121229
121268
|
prev.style.height = `${newPrevSize}px`;
|
|
121230
|
-
//this.style.height = `${splitterSize}px`;
|
|
121231
121269
|
|
|
121232
121270
|
if (this.#isLastSplitter()) {
|
|
121233
121271
|
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,67 @@
|
|
|
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
|
+
if (this.#target && this.#target) {
|
|
34
|
+
const collapseBtn = document.createElement("button");
|
|
35
|
+
collapseBtn.textContent = "📥 접기";
|
|
36
|
+
collapseBtn.className = "collapse-toggle";
|
|
37
|
+
collapseBtn.style.marginBottom = "8px";
|
|
38
|
+
|
|
39
|
+
this.#target.insertBefore(collapseBtn, this.#target.firstChild);
|
|
40
|
+
|
|
41
|
+
// collapse 시 target 숨기고 복원 버튼 등장
|
|
42
|
+
collapseBtn.addEventListener("click", () => {
|
|
43
|
+
this.#target.style.display = "none";
|
|
44
|
+
this.style.display = "inline-block";
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 복원 시 target 보이고 복원 버튼 사라짐
|
|
49
|
+
this.addEventListener("click", () => {
|
|
50
|
+
this.#target.style.display = "";
|
|
51
|
+
this.style.display = "none";
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#setupToggle = () => {
|
|
56
|
+
const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
|
|
57
|
+
const searchContainer = this.shadowRoot.querySelector(".search-container");
|
|
58
|
+
|
|
59
|
+
toggleIcon.addEventListener("click", () => {
|
|
60
|
+
this.isCollapsed = !this.isCollapsed;
|
|
61
|
+
//toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
|
|
62
|
+
searchContainer.classList.toggle("collapse", this.isCollapsed);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
customElements.define("nx-collapse", nxCollapse);
|
package/dist/nx/nxSplitter.js
CHANGED
|
@@ -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
|
|
223
|
-
|
|
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
package/package.json
CHANGED
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,67 @@
|
|
|
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
|
+
if (this.#target && this.#target) {
|
|
34
|
+
const collapseBtn = document.createElement("button");
|
|
35
|
+
collapseBtn.textContent = "📥 접기";
|
|
36
|
+
collapseBtn.className = "collapse-toggle";
|
|
37
|
+
collapseBtn.style.marginBottom = "8px";
|
|
38
|
+
|
|
39
|
+
this.#target.insertBefore(collapseBtn, this.#target.firstChild);
|
|
40
|
+
|
|
41
|
+
// collapse 시 target 숨기고 복원 버튼 등장
|
|
42
|
+
collapseBtn.addEventListener("click", () => {
|
|
43
|
+
this.#target.style.display = "none";
|
|
44
|
+
this.style.display = "inline-block";
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 복원 시 target 보이고 복원 버튼 사라짐
|
|
49
|
+
this.addEventListener("click", () => {
|
|
50
|
+
this.#target.style.display = "";
|
|
51
|
+
this.style.display = "none";
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#setupToggle = () => {
|
|
56
|
+
const toggleIcon = this.shadowRoot.querySelector(".toggle-icon");
|
|
57
|
+
const searchContainer = this.shadowRoot.querySelector(".search-container");
|
|
58
|
+
|
|
59
|
+
toggleIcon.addEventListener("click", () => {
|
|
60
|
+
this.isCollapsed = !this.isCollapsed;
|
|
61
|
+
//toggleIcon.innerHTML = this.isCollapsed ? "" : "X";
|
|
62
|
+
searchContainer.classList.toggle("collapse", this.isCollapsed);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
customElements.define("nx-collapse", nxCollapse);
|
package/src/nx/nxDiv.js
ADDED
|
@@ -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);
|
package/src/nx/nxSplitter.js
CHANGED
|
@@ -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
|
|
223
|
-
|
|
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`;
|