@ninebone/util 0.9.185 โ 0.9.188
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/css/nine-util.css +12 -0
- package/dist/nine-util.js +105 -3
- 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/css/nine-util.css
CHANGED
|
@@ -49,3 +49,15 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
:host(nine-popup) {
|
|
53
|
+
display: none; position: fixed; top:0; left:0; width:100vw; height:100vh; z-index: 9999;
|
|
54
|
+
&.open {
|
|
55
|
+
display: block;
|
|
56
|
+
}
|
|
57
|
+
.popup-dimmed { position:absolute; width:100%; height:100%; background: rgba(0,0,0,0.5); display:flex; justify-content:center; align-items:center; }
|
|
58
|
+
.popup-content { background: #fff; border-radius: 8px; min-width: 400px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); display: flex; flex-direction: column; }
|
|
59
|
+
.popup-header { padding: 15px; border-bottom: 1px solid #eee; font-weight: bold; }
|
|
60
|
+
.popup-body { padding: 20px; min-height: 150px; }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
package/dist/nine-util.js
CHANGED
|
@@ -9,7 +9,9 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout;
|
|
12
|
+
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout, _onCloseCallback, _isInitialized, _NinePopup_instances, renderStructure_fn;
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { createRoot } from "react-dom/client";
|
|
13
15
|
const listeners = /* @__PURE__ */ new Set();
|
|
14
16
|
const _initialConfig = {
|
|
15
17
|
ux: { nativeOverride: false, theme: "light" },
|
|
@@ -1185,12 +1187,13 @@ class UxSplitter extends HTMLElement {
|
|
|
1185
1187
|
this.classList.add(__privateGet(this, _mode));
|
|
1186
1188
|
const contents = this.innerHTML.trim();
|
|
1187
1189
|
const gripTmpl = contents === "" ? `<div class="grip"></div>` : `<div class="grip"></div><div class="inner-container">${contents}</div><div class="grip"></div>`;
|
|
1190
|
+
const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-util.css";` : "";
|
|
1188
1191
|
this.innerHTML = "";
|
|
1189
1192
|
const htmlTmpl = document.createElement("template");
|
|
1190
1193
|
htmlTmpl.innerHTML = `
|
|
1191
1194
|
<style>
|
|
1192
|
-
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.
|
|
1193
|
-
${
|
|
1195
|
+
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.188"}/dist/css/nine-util.css";
|
|
1196
|
+
${customImport}
|
|
1194
1197
|
</style>
|
|
1195
1198
|
${gripTmpl}
|
|
1196
1199
|
`;
|
|
@@ -1530,6 +1533,29 @@ class NineUtil {
|
|
|
1530
1533
|
__publicField(this, "formatDate", (v, fmt) => {
|
|
1531
1534
|
return dayjs(v).format(fmt);
|
|
1532
1535
|
});
|
|
1536
|
+
/**
|
|
1537
|
+
* ๐ฎ 2. ํจ์ ํธ์ถํ ๋ง๋ฅ ๋์ ํ์
์์ง
|
|
1538
|
+
* @param {React.Component} ContentComponent - ํ์
๋ด๋ถ์ ๋์ธ ๋ฆฌ์กํธ ์ปดํฌ๋ํธ ์๋งน์ด
|
|
1539
|
+
* @param {Object} props - ํ์
์๋งน์ด์ ๋๊ฒจ์ค Props ๋ฐ์ดํฐ (์ ํ)
|
|
1540
|
+
* @param {Function} onCloseCallback - ํ์
์ด ๋ซํ ๋ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์๋จน์ ์ฝ๋ฐฑ ํจ์ (์ ํ)
|
|
1541
|
+
*/
|
|
1542
|
+
__publicField(this, "popup", (ContentComponent, props = {}, onCloseCallback = null) => {
|
|
1543
|
+
const $popupWrapper = document.createElement("nine-popup");
|
|
1544
|
+
document.body.appendChild($popupWrapper);
|
|
1545
|
+
const $bodySpace = $popupWrapper.popupBody || $popupWrapper;
|
|
1546
|
+
const root = createRoot($bodySpace);
|
|
1547
|
+
$popupWrapper.onclose = (resultData) => {
|
|
1548
|
+
if (typeof onCloseCallback === "function") {
|
|
1549
|
+
onCloseCallback(resultData);
|
|
1550
|
+
}
|
|
1551
|
+
setTimeout(() => {
|
|
1552
|
+
root.unmount();
|
|
1553
|
+
$popupWrapper.remove();
|
|
1554
|
+
}, 300);
|
|
1555
|
+
};
|
|
1556
|
+
root.render(React.createElement(ContentComponent, props));
|
|
1557
|
+
setTimeout(() => $popupWrapper.open(), 0);
|
|
1558
|
+
});
|
|
1533
1559
|
/**
|
|
1534
1560
|
* ๐ฏ 2. Shadow DOM ๊ฒฝ๊ณ๋ฅผ ๋ฌด๋ ฅํํ๊ณ ๊น์ด ์๊ด์์ด ๋ชจ๋ ์์๋ฅผ ์์งํ๋ ๋ง๋ฅ ์ฟผ๋ฆฌ
|
|
1535
1561
|
* @param {string} selector - ์ฐพ๊ณ ์ ํ๋ CSS ์ ํ์ (์: 'input[name]')
|
|
@@ -1582,6 +1608,82 @@ class NineUtil {
|
|
|
1582
1608
|
}
|
|
1583
1609
|
}
|
|
1584
1610
|
Object.assign(nine$1, new NineUtil());
|
|
1611
|
+
class NinePopup extends HTMLElement {
|
|
1612
|
+
constructor() {
|
|
1613
|
+
super();
|
|
1614
|
+
__privateAdd(this, _NinePopup_instances);
|
|
1615
|
+
__privateAdd(this, _onCloseCallback, null);
|
|
1616
|
+
__privateAdd(this, _isInitialized, false);
|
|
1617
|
+
}
|
|
1618
|
+
get _onCloseCallback() {
|
|
1619
|
+
return __privateGet(this, _onCloseCallback);
|
|
1620
|
+
}
|
|
1621
|
+
set onclose(callbackFunc) {
|
|
1622
|
+
if (typeof callbackFunc === "function") __privateSet(this, _onCloseCallback, callbackFunc);
|
|
1623
|
+
}
|
|
1624
|
+
connectedCallback() {
|
|
1625
|
+
if (__privateGet(this, _isInitialized)) return;
|
|
1626
|
+
if (!this.shadowRoot) {
|
|
1627
|
+
this.attachShadow({ mode: "open" });
|
|
1628
|
+
}
|
|
1629
|
+
__privateMethod(this, _NinePopup_instances, renderStructure_fn).call(this);
|
|
1630
|
+
__privateSet(this, _isInitialized, true);
|
|
1631
|
+
}
|
|
1632
|
+
open() {
|
|
1633
|
+
this.classList.add("open");
|
|
1634
|
+
}
|
|
1635
|
+
close(callbackData = null) {
|
|
1636
|
+
this.classList.remove("open");
|
|
1637
|
+
if (typeof __privateGet(this, _onCloseCallback) === "function") {
|
|
1638
|
+
__privateGet(this, _onCloseCallback).call(this, callbackData);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
// ๐ ๋ง๋ฅ ๋์ ํ์
์์ง(NineUtil) ์ ์ฉ ์
๊ตฌ ๊ฐ๋ฐฉ
|
|
1642
|
+
get popupBody() {
|
|
1643
|
+
var _a2;
|
|
1644
|
+
return ((_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".popup-body")) || null;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
_onCloseCallback = new WeakMap();
|
|
1648
|
+
_isInitialized = new WeakMap();
|
|
1649
|
+
_NinePopup_instances = new WeakSet();
|
|
1650
|
+
renderStructure_fn = function() {
|
|
1651
|
+
if (this.shadowRoot.querySelector(".popup-dimmed")) return;
|
|
1652
|
+
const customImport = nine.cssPath ? `@import "${nine.cssPath}/nine-util.css";` : "";
|
|
1653
|
+
const $styleTmpl = document.createElement("template");
|
|
1654
|
+
$styleTmpl.innerHTML = `
|
|
1655
|
+
<style>
|
|
1656
|
+
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"0.9.188"}/dist/css/nine-util.css";
|
|
1657
|
+
${customImport}
|
|
1658
|
+
|
|
1659
|
+
:host { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; }
|
|
1660
|
+
:host(.open) { display: block; }
|
|
1661
|
+
.popup-dimmed { position: absolute; top:0; left:0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; }
|
|
1662
|
+
.popup-content { background: #fff; border-radius: 8px; min-width: 500px; max-width: 90%; box-shadow: 0 4px 15px rgba(0,0,0,0.25); display: flex; flex-direction: column; overflow: hidden; }
|
|
1663
|
+
.popup-header { padding: 15px 20px; border-bottom: 1px solid #eee; font-weight: bold; background: #f9f9f9; }
|
|
1664
|
+
.popup-body { padding: 20px; min-height: 150px; overflow-y: auto; }
|
|
1665
|
+
</style>
|
|
1666
|
+
`;
|
|
1667
|
+
this.shadowRoot.appendChild($styleTmpl.content.cloneNode(true));
|
|
1668
|
+
const $dimmed = document.createElement("div");
|
|
1669
|
+
$dimmed.className = "popup-dimmed";
|
|
1670
|
+
$dimmed.addEventListener("click", (e) => {
|
|
1671
|
+
if (e.target === $dimmed) this.close();
|
|
1672
|
+
});
|
|
1673
|
+
const $content = document.createElement("div");
|
|
1674
|
+
$content.className = "popup-content";
|
|
1675
|
+
$content.innerHTML = `
|
|
1676
|
+
<div class="popup-header"></div>
|
|
1677
|
+
<div class="popup-body"></div>
|
|
1678
|
+
`;
|
|
1679
|
+
const $bodySpace = $content.querySelector(".popup-body");
|
|
1680
|
+
while (this.firstChild) {
|
|
1681
|
+
$bodySpace.appendChild(this.firstChild);
|
|
1682
|
+
}
|
|
1683
|
+
$dimmed.appendChild($content);
|
|
1684
|
+
this.shadowRoot.appendChild($dimmed);
|
|
1685
|
+
};
|
|
1686
|
+
if (!customElements.get("nine-popup")) customElements.define("nine-popup", NinePopup);
|
|
1585
1687
|
nine$1.safe = safe;
|
|
1586
1688
|
nine$1.api = api;
|
|
1587
1689
|
nine$1.trace = trace$2;
|