@ninebone/util 1.0.35 β 1.0.36
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/nine-util.js +63 -1
- package/dist/nine-util.js.map +1 -1
- package/dist/nine-util.umd.js +1 -1
- package/dist/nine-util.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-util.js
CHANGED
|
@@ -1313,7 +1313,7 @@ class UxSplitter extends HTMLElement {
|
|
|
1313
1313
|
const htmlTmpl = document.createElement("template");
|
|
1314
1314
|
htmlTmpl.innerHTML = `
|
|
1315
1315
|
<style>
|
|
1316
|
-
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.
|
|
1316
|
+
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.36"}/dist/css/nine-util.css";
|
|
1317
1317
|
${customImport}
|
|
1318
1318
|
</style>
|
|
1319
1319
|
${gripTmpl}
|
|
@@ -1732,6 +1732,44 @@ const TreeUtil = {
|
|
|
1732
1732
|
return result;
|
|
1733
1733
|
}
|
|
1734
1734
|
};
|
|
1735
|
+
class NineSimplePopup extends HTMLElement {
|
|
1736
|
+
static get tagName() {
|
|
1737
|
+
return "nine-simple-popup";
|
|
1738
|
+
}
|
|
1739
|
+
constructor() {
|
|
1740
|
+
super();
|
|
1741
|
+
}
|
|
1742
|
+
connectedCallback() {
|
|
1743
|
+
const titleText = this.getAttribute("subject") || "Details";
|
|
1744
|
+
this.innerHTML = `
|
|
1745
|
+
<div class="ns-popup-overlay">
|
|
1746
|
+
<div class="ns-popup-dialog">
|
|
1747
|
+
<div class="ns-popup-header">
|
|
1748
|
+
<span class="ns-popup-title">${titleText}</span>
|
|
1749
|
+
<button class="ns-popup-close-btn">×</button>
|
|
1750
|
+
</div>
|
|
1751
|
+
<div class="ns-popup-body"></div>
|
|
1752
|
+
</div>
|
|
1753
|
+
</div>
|
|
1754
|
+
`;
|
|
1755
|
+
this.querySelector(".ns-popup-close-btn").onclick = () => this.close(null);
|
|
1756
|
+
this.querySelector(".ns-popup-overlay").onclick = (e) => {
|
|
1757
|
+
if (e.target.classList.contains("ns-popup-overlay")) {
|
|
1758
|
+
this.close(null);
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
close(returnValue = null) {
|
|
1763
|
+
this.dispatchEvent(new CustomEvent("closed", { detail: returnValue }));
|
|
1764
|
+
this.remove();
|
|
1765
|
+
}
|
|
1766
|
+
get popupBody() {
|
|
1767
|
+
return this.querySelector(".ns-popup-body") || null;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
if (!customElements.get("nine-simple-popup")) {
|
|
1771
|
+
customElements.define("nine-simple-popup", NineSimplePopup);
|
|
1772
|
+
}
|
|
1735
1773
|
class NineUtil {
|
|
1736
1774
|
constructor() {
|
|
1737
1775
|
// π
1. λ μ§ ν¬λ§· ν¬νΌ (μΈμ€ν΄μ€ λ©μλ)
|
|
@@ -1767,6 +1805,30 @@ class NineUtil {
|
|
|
1767
1805
|
}, 0);
|
|
1768
1806
|
});
|
|
1769
1807
|
});
|
|
1808
|
+
/**
|
|
1809
|
+
* π― Non-Shadow DOM κΈ°λ°μ μμ λ‘μ΄ νμ
μ€ν λ©μλ
|
|
1810
|
+
*/
|
|
1811
|
+
__publicField(this, "simplePopup", (ContentComponent, param = {}, title = "Details") => {
|
|
1812
|
+
document.querySelectorAll(NineSimplePopup.tagName).forEach((el) => el.remove());
|
|
1813
|
+
const $popupWrapper = document.createElement(NineSimplePopup.tagName);
|
|
1814
|
+
if (title) $popupWrapper.setAttribute("subject", title);
|
|
1815
|
+
document.body.appendChild($popupWrapper);
|
|
1816
|
+
return new Promise((resolve) => {
|
|
1817
|
+
const $bodySpace = $popupWrapper.popupBody;
|
|
1818
|
+
const root = createRoot($bodySpace);
|
|
1819
|
+
$popupWrapper.addEventListener("closed", (e) => {
|
|
1820
|
+
resolve(e.detail);
|
|
1821
|
+
setTimeout(() => {
|
|
1822
|
+
root.unmount();
|
|
1823
|
+
$popupWrapper.remove();
|
|
1824
|
+
}, 0);
|
|
1825
|
+
});
|
|
1826
|
+
root.render(React.createElement(ContentComponent, {
|
|
1827
|
+
data: param,
|
|
1828
|
+
onClose: (result) => $popupWrapper.close(result)
|
|
1829
|
+
}));
|
|
1830
|
+
});
|
|
1831
|
+
});
|
|
1770
1832
|
/**
|
|
1771
1833
|
* π― 2. Shadow DOM κ²½κ³λ₯Ό 무λ ₯ννκ³ κΉμ΄ μκ΄μμ΄ λͺ¨λ μμλ₯Ό μμ§νλ λ§λ₯ 쿼리
|
|
1772
1834
|
* @param {string} selector - μ°Ύκ³ μ νλ CSS μ νμ (μ: 'input[name]')
|