@sellmate/design-system 1.19.0 → 1.20.1
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/cjs/design-system.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sd-badge.cjs.entry.js +1 -1
- package/dist/cjs/sd-barcode-input.cjs.entry.js +1 -1
- package/dist/cjs/sd-button_2.cjs.entry.js +1 -1
- package/dist/cjs/sd-calendar_2.cjs.entry.js +5 -5
- package/dist/cjs/sd-callout.cjs.entry.js +1 -1
- package/dist/cjs/sd-card.cjs.entry.js +1 -1
- package/dist/cjs/sd-chip-input.cjs.entry.js +2 -2
- package/dist/cjs/sd-chip.cjs.entry.js +1 -1
- package/dist/cjs/sd-circle-progress.cjs.entry.js +1 -1
- package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +3 -3
- package/dist/cjs/sd-date-picker_7.cjs.entry.js +9 -9
- package/dist/cjs/sd-date-range-picker-calendar.cjs.entry.js +1 -1
- package/dist/cjs/sd-divider.cjs.entry.js +1 -1
- package/dist/cjs/sd-field_3.cjs.entry.js +8 -8
- package/dist/cjs/{sd-ghost-button_2.cjs.entry.js → sd-ghost-button_3.cjs.entry.js} +264 -10
- package/dist/cjs/sd-key-value-table.cjs.entry.js +4 -4
- package/dist/cjs/sd-linear-progress.cjs.entry.js +1 -1
- package/dist/cjs/sd-loading-container.cjs.entry.js +2 -2
- package/dist/cjs/sd-modal-container.cjs.entry.js +49 -1
- package/dist/cjs/sd-pagination_4.cjs.entry.js +8 -8
- package/dist/cjs/sd-popup.cjs.entry.js +1 -1
- package/dist/cjs/sd-select-list-item_2.cjs.entry.js +6 -6
- package/dist/cjs/sd-select_3.cjs.entry.js +8 -8
- package/dist/cjs/sd-switch.cjs.entry.js +1 -1
- package/dist/cjs/sd-table.cjs.entry.js +8 -8
- package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
- package/dist/cjs/sd-td.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/sd-toast.cjs.entry.js +2 -2
- package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
- package/dist/collection/components/assets/Close.js +1 -1
- package/dist/collection/components/sd-badge/sd-badge.js +1 -1
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.js +1 -1
- package/dist/collection/components/sd-calendar/sd-calendar.js +3 -3
- package/dist/collection/components/sd-callout/sd-callout.js +1 -1
- package/dist/collection/components/sd-card/sd-card.js +1 -1
- package/dist/collection/components/sd-chip/sd-chip.js +1 -1
- package/dist/collection/components/sd-chip-input/sd-chip-input.js +2 -2
- package/dist/collection/components/sd-circle-progress/sd-circle-progress.js +1 -1
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +2 -2
- package/dist/collection/components/sd-date-picker/sd-date-picker-trigger/sd-date-picker-trigger.js +2 -2
- package/dist/collection/components/sd-date-picker/sd-date-picker.js +2 -2
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker-calendar/sd-date-range-picker-calendar.js +1 -1
- package/dist/collection/components/sd-divider/sd-divider.js +1 -1
- package/dist/collection/components/sd-field/sd-field.js +5 -5
- package/dist/collection/components/sd-floating-portal/sd-floating-portal.js +1 -1
- package/dist/collection/components/sd-ghost-button/sd-ghost-button.css +2 -17
- package/dist/collection/components/sd-ghost-button/sd-ghost-button.js +21 -12
- package/dist/collection/components/sd-input/sd-input.js +2 -2
- package/dist/collection/components/sd-key-value-table/sd-key-value-table.css +2 -2
- package/dist/collection/components/sd-key-value-table/sd-key-value-table.js +6 -6
- package/dist/collection/components/sd-linear-progress/sd-linear-progress.js +1 -1
- package/dist/collection/components/sd-loading-container/sd-loading-container.js +2 -2
- package/dist/collection/components/sd-loading-modal/sd-loading-modal.js +1 -1
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +49 -1
- package/dist/collection/components/sd-number-input/sd-number-input.js +4 -4
- package/dist/collection/components/sd-pagination/sd-pagination.js +3 -3
- package/dist/collection/components/sd-popup/sd-popup.js +1 -1
- package/dist/collection/components/sd-portal/sd-portal.js +34 -3
- package/dist/collection/components/sd-select/sd-select-list-item/sd-select-list-item.js +2 -2
- package/dist/collection/components/sd-select/sd-select-list-item-search/sd-select-list-item-search.js +4 -4
- package/dist/collection/components/sd-select/sd-select-listbox/sd-select-listbox.js +2 -2
- package/dist/collection/components/sd-select/sd-select-trigger/sd-select-trigger.js +2 -2
- package/dist/collection/components/sd-select/sd-select.js +4 -4
- package/dist/collection/components/sd-switch/sd-switch.js +1 -1
- package/dist/collection/components/sd-table/sd-table.css +1 -1
- package/dist/collection/components/sd-table/sd-table.js +9 -9
- package/dist/collection/components/sd-table/sd-tbody/sd-tbody.js +2 -2
- package/dist/collection/components/sd-table/sd-td/sd-td.js +1 -1
- package/dist/collection/components/sd-table/sd-thead/sd-thead.js +3 -3
- package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
- package/dist/collection/components/sd-tag/sd-tag.js +2 -2
- package/dist/collection/components/sd-textarea/sd-textarea.js +1 -1
- package/dist/collection/components/sd-toast/sd-toast.js +2 -2
- package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
- package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
- package/dist/components/p-5imde6N9.js +1 -0
- package/dist/components/p-B5bya7Gp.js +1 -0
- package/dist/components/p-B7PHGGFH.js +1 -0
- package/dist/components/p-BZfVV3gu.js +1 -0
- package/dist/components/p-BiBLp9_a.js +1 -0
- package/dist/components/{p-DMS9mQsg.js → p-BjcGzaFR.js} +1 -1
- package/dist/components/{p-BD8OoYud.js → p-Bz93hWXV.js} +1 -1
- package/dist/components/p-CB2A3pJ5.js +1 -0
- package/dist/components/{p-B_5uwji5.js → p-CJ69QmR3.js} +1 -1
- package/dist/components/p-CLlAhEDc.js +1 -0
- package/dist/components/{p-4HPAPKne.js → p-CQozoo2-.js} +1 -1
- package/dist/components/p-CRwvv7YM.js +1 -0
- package/dist/components/p-CTPImLDQ.js +1 -0
- package/dist/components/{p-CQWZv8vY.js → p-CUR9smP5.js} +1 -1
- package/dist/components/{p-DbLQoVx6.js → p-CXeOxSQ-.js} +1 -1
- package/dist/components/p-CZfsknba.js +1 -0
- package/dist/components/{p-CtWfOIxb.js → p-CoqA9KgU.js} +1 -1
- package/dist/components/{p-hzCGj0On.js → p-CrT06Uwc.js} +1 -1
- package/dist/components/p-CvSqieCH.js +1 -0
- package/dist/components/p-D99vy8Ip.js +1 -0
- package/dist/components/{p-B3SKaQId.js → p-DDAA-zcg.js} +1 -1
- package/dist/components/p-DIlNesBH.js +1 -0
- package/dist/components/p-DNnI3Nru.js +1 -0
- package/dist/components/p-DZTxHJlP.js +1 -0
- package/dist/components/{p-CH6cVc2a.js → p-DertIGhs.js} +1 -1
- package/dist/components/{p-CzCu_NDl.js → p-Dl89_4C3.js} +1 -1
- package/dist/components/{p-C_r3z9VA.js → p-FTvXz0-a.js} +1 -1
- package/dist/components/{p-BLNc_TL-.js → p-P2jWtk8J.js} +1 -1
- package/dist/components/{p-DrSHJYop.js → p-Rwc_ltPn.js} +1 -1
- package/dist/components/p-ZvI5A-_t.js +1 -0
- package/dist/components/{p-79DExV92.js → p-gOIeNT-Z.js} +1 -1
- package/dist/components/{p-BMIgVp9-.js → p-uSEbiD29.js} +1 -1
- package/dist/components/{p-DDR0VcRU.js → p-xkRWGISE.js} +1 -1
- package/dist/components/sd-action-modal.js +1 -1
- package/dist/components/sd-badge.js +1 -1
- package/dist/components/sd-barcode-input.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-calendar.js +1 -1
- package/dist/components/sd-callout.js +1 -1
- package/dist/components/sd-card.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/sd-chip-input.js +1 -1
- package/dist/components/sd-chip.js +1 -1
- package/dist/components/sd-circle-progress.js +1 -1
- package/dist/components/sd-confirm-modal.js +1 -1
- package/dist/components/sd-date-picker-trigger.js +1 -1
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker-calendar.js +1 -1
- package/dist/components/sd-date-range-picker.js +1 -1
- package/dist/components/sd-divider.js +1 -1
- package/dist/components/sd-dropdown-button.js +1 -1
- package/dist/components/sd-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-floating-portal.js +1 -1
- package/dist/components/sd-ghost-button.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-icon.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/sd-key-value-table.js +1 -1
- package/dist/components/sd-linear-progress.js +1 -1
- package/dist/components/sd-loading-container.js +1 -1
- package/dist/components/sd-loading-modal.js +1 -1
- package/dist/components/sd-modal-container.js +1 -1
- package/dist/components/sd-number-input.js +1 -1
- package/dist/components/sd-pagination.js +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-popup.js +1 -1
- package/dist/components/sd-portal.js +1 -1
- package/dist/components/sd-select-list-item-search.js +1 -1
- package/dist/components/sd-select-list-item.js +1 -1
- package/dist/components/sd-select-listbox.js +1 -1
- package/dist/components/sd-select-trigger.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-switch.js +1 -1
- package/dist/components/sd-table.js +1 -1
- package/dist/components/sd-tabs.js +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-tbody.js +1 -1
- package/dist/components/sd-td.js +1 -1
- package/dist/components/sd-text-link.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-thead.js +1 -1
- package/dist/components/sd-toast-container.js +1 -1
- package/dist/components/sd-toast.js +1 -1
- package/dist/components/sd-toggle.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/components/sd-tr.js +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/{p-80bde621.entry.js → p-08343698.entry.js} +1 -1
- package/dist/design-system/p-17dcf0e4.entry.js +1 -0
- package/dist/design-system/{p-bbbc4b27.entry.js → p-2151e081.entry.js} +1 -1
- package/dist/design-system/p-316b8a08.entry.js +1 -0
- package/dist/design-system/{p-f5190934.entry.js → p-4acfc5f9.entry.js} +1 -1
- package/dist/design-system/{p-22484d65.entry.js → p-5039241c.entry.js} +1 -1
- package/dist/design-system/p-52f551a1.entry.js +1 -0
- package/dist/design-system/{p-d726d8e7.entry.js → p-54853a2b.entry.js} +1 -1
- package/dist/design-system/p-5eaa12af.entry.js +1 -0
- package/dist/design-system/{p-827f067b.entry.js → p-646a7830.entry.js} +1 -1
- package/dist/design-system/{p-9d35b674.entry.js → p-717eba5f.entry.js} +1 -1
- package/dist/design-system/p-7ed8c8f1.entry.js +1 -0
- package/dist/design-system/{p-8f90620b.entry.js → p-9289eb14.entry.js} +1 -1
- package/dist/design-system/{p-b4b20a86.entry.js → p-98e0b332.entry.js} +1 -1
- package/dist/design-system/{p-9124a1af.entry.js → p-9c38ee79.entry.js} +1 -1
- package/dist/design-system/{p-c318b762.entry.js → p-a4331364.entry.js} +1 -1
- package/dist/design-system/{p-683c3b91.entry.js → p-a5a586da.entry.js} +1 -1
- package/dist/design-system/{p-1602a5fa.entry.js → p-aa1c6202.entry.js} +1 -1
- package/dist/design-system/{p-8a84a4fe.entry.js → p-ae344950.entry.js} +1 -1
- package/dist/design-system/{p-4b15247b.entry.js → p-b291baab.entry.js} +1 -1
- package/dist/design-system/{p-e93dda25.entry.js → p-b63b8df9.entry.js} +1 -1
- package/dist/design-system/{p-3caf2c5b.entry.js → p-bdb7492c.entry.js} +1 -1
- package/dist/design-system/{p-cc5f5bff.entry.js → p-c47198fc.entry.js} +1 -1
- package/dist/design-system/{p-4b626171.entry.js → p-c995e6c3.entry.js} +1 -1
- package/dist/design-system/{p-9095aab6.entry.js → p-cb80327c.entry.js} +1 -1
- package/dist/design-system/{p-7ed5aed5.entry.js → p-ccf1a3fc.entry.js} +1 -1
- package/dist/design-system/{p-4e1d76b8.entry.js → p-df7c721d.entry.js} +1 -1
- package/dist/design-system/p-e3990243.entry.js +1 -0
- package/dist/design-system/{p-81aa23d1.entry.js → p-e9d1dbb5.entry.js} +1 -1
- package/dist/design-system/p-faf7b64c.entry.js +1 -0
- package/dist/esm/design-system.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sd-badge.entry.js +1 -1
- package/dist/esm/sd-barcode-input.entry.js +1 -1
- package/dist/esm/sd-button_2.entry.js +1 -1
- package/dist/esm/sd-calendar_2.entry.js +5 -5
- package/dist/esm/sd-callout.entry.js +1 -1
- package/dist/esm/sd-card.entry.js +1 -1
- package/dist/esm/sd-chip-input.entry.js +2 -2
- package/dist/esm/sd-chip.entry.js +1 -1
- package/dist/esm/sd-circle-progress.entry.js +1 -1
- package/dist/esm/sd-confirm-modal_2.entry.js +3 -3
- package/dist/esm/sd-date-picker_7.entry.js +9 -9
- package/dist/esm/sd-date-range-picker-calendar.entry.js +1 -1
- package/dist/esm/sd-divider.entry.js +1 -1
- package/dist/esm/sd-field_3.entry.js +8 -8
- package/dist/esm/{sd-ghost-button_2.entry.js → sd-ghost-button_3.entry.js} +265 -12
- package/dist/esm/sd-key-value-table.entry.js +4 -4
- package/dist/esm/sd-linear-progress.entry.js +1 -1
- package/dist/esm/sd-loading-container.entry.js +2 -2
- package/dist/esm/sd-modal-container.entry.js +49 -1
- package/dist/esm/sd-pagination_4.entry.js +8 -8
- package/dist/esm/sd-popup.entry.js +1 -1
- package/dist/esm/sd-select-list-item_2.entry.js +6 -6
- package/dist/esm/sd-select_3.entry.js +8 -8
- package/dist/esm/sd-switch.entry.js +1 -1
- package/dist/esm/sd-table.entry.js +8 -8
- package/dist/esm/sd-tabs.entry.js +1 -1
- package/dist/esm/sd-td.entry.js +1 -1
- package/dist/esm/sd-toast-container.entry.js +1 -1
- package/dist/esm/sd-toast.entry.js +2 -2
- package/dist/esm/sd-toggle.entry.js +1 -1
- package/dist/types/components/sd-ghost-button/sd-ghost-button.d.ts +7 -1
- package/dist/types/components/sd-key-value-table/sd-key-value-table.d.ts +2 -2
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +9 -0
- package/dist/types/components/sd-portal/sd-portal.d.ts +1 -0
- package/dist/types/components/sd-table/sd-table.d.ts +1 -1
- package/dist/types/components.d.ts +20 -17
- package/hydrate/index.js +163 -98
- package/hydrate/index.mjs +163 -98
- package/package.json +1 -1
- package/dist/cjs/sd-portal.cjs.entry.js +0 -243
- package/dist/components/p-AI4YlQmL.js +0 -1
- package/dist/components/p-B-4ulKJj.js +0 -1
- package/dist/components/p-BX5uKVOt.js +0 -1
- package/dist/components/p-BYTrIk62.js +0 -1
- package/dist/components/p-Bzo51vnP.js +0 -1
- package/dist/components/p-C0tkFuhj.js +0 -1
- package/dist/components/p-C3wv8gVC.js +0 -1
- package/dist/components/p-CXRFEcE_.js +0 -1
- package/dist/components/p-Cl5io5TH.js +0 -1
- package/dist/components/p-ClKABgST.js +0 -1
- package/dist/components/p-DAOeioSV.js +0 -1
- package/dist/components/p-DTFXzlvq.js +0 -1
- package/dist/components/p-Dr5Q2ZKB.js +0 -1
- package/dist/components/p-DyVh4pNL.js +0 -1
- package/dist/components/p-Ng3JMPxb.js +0 -1
- package/dist/components/p-qJeUUOyB.js +0 -1
- package/dist/design-system/p-12306783.entry.js +0 -1
- package/dist/design-system/p-3f7349ae.entry.js +0 -1
- package/dist/design-system/p-43529bba.entry.js +0 -1
- package/dist/design-system/p-46da89f2.entry.js +0 -1
- package/dist/design-system/p-8a025f91.entry.js +0 -1
- package/dist/design-system/p-a263af1b.entry.js +0 -1
- package/dist/design-system/p-a532d998.entry.js +0 -1
- package/dist/design-system/p-aa312937.entry.js +0 -1
- package/dist/esm/sd-portal.entry.js +0 -241
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, a as getElement, h } from './index-CAxodB5I.js';
|
|
2
|
-
|
|
3
|
-
const SdPortal = class {
|
|
4
|
-
constructor(hostRef) {
|
|
5
|
-
registerInstance(this, hostRef);
|
|
6
|
-
this.close = createEvent(this, "sdClose", 3);
|
|
7
|
-
}
|
|
8
|
-
get hostEl() { return getElement(this); }
|
|
9
|
-
to = 'body';
|
|
10
|
-
parentRef = null;
|
|
11
|
-
offset = [0, 4];
|
|
12
|
-
viewportPadding = 0;
|
|
13
|
-
zIndex = 998;
|
|
14
|
-
open = false;
|
|
15
|
-
close;
|
|
16
|
-
container;
|
|
17
|
-
wrapper;
|
|
18
|
-
rafId;
|
|
19
|
-
isInsideClick = false;
|
|
20
|
-
closeTransitionTimer;
|
|
21
|
-
handleObservedScroll = () => this.updatePosition();
|
|
22
|
-
resizeObserver;
|
|
23
|
-
mutationObserver;
|
|
24
|
-
scrollParents = [];
|
|
25
|
-
isObserved = false;
|
|
26
|
-
handleOpenChange() {
|
|
27
|
-
this.syncPortalState();
|
|
28
|
-
}
|
|
29
|
-
componentDidLoad() {
|
|
30
|
-
this.container = this.resolveContainer();
|
|
31
|
-
this.syncPortalState();
|
|
32
|
-
}
|
|
33
|
-
componentDidRender() {
|
|
34
|
-
this.syncPortalState();
|
|
35
|
-
}
|
|
36
|
-
disconnectedCallback() {
|
|
37
|
-
if (this.closeTransitionTimer)
|
|
38
|
-
clearTimeout(this.closeTransitionTimer);
|
|
39
|
-
this.unobserveParent();
|
|
40
|
-
if (this.wrapper?.parentNode) {
|
|
41
|
-
try {
|
|
42
|
-
this.wrapper.parentNode.removeChild(this.wrapper);
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
// Stencil spec mock DOM can already detach the wrapper before this callback runs.
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
resolveContainer() {
|
|
50
|
-
const el = typeof this.to === 'string' ? document.querySelector(this.to) : this.to;
|
|
51
|
-
return el instanceof HTMLElement ? el : document.body;
|
|
52
|
-
}
|
|
53
|
-
createWrapper() {
|
|
54
|
-
this.wrapper = document.createElement('div');
|
|
55
|
-
Object.assign(this.wrapper.style, {
|
|
56
|
-
position: 'fixed',
|
|
57
|
-
top: '0',
|
|
58
|
-
left: '0',
|
|
59
|
-
zIndex: (this.zIndex ?? 998).toString(),
|
|
60
|
-
opacity: '0',
|
|
61
|
-
transition: 'opacity 0.15s ease-out',
|
|
62
|
-
boxSizing: 'border-box',
|
|
63
|
-
visibility: 'hidden',
|
|
64
|
-
});
|
|
65
|
-
this.container.appendChild(this.wrapper);
|
|
66
|
-
}
|
|
67
|
-
ensureWrapper() {
|
|
68
|
-
if (this.wrapper)
|
|
69
|
-
return;
|
|
70
|
-
this.container ||= this.resolveContainer();
|
|
71
|
-
this.createWrapper();
|
|
72
|
-
this.moveSlotContent();
|
|
73
|
-
}
|
|
74
|
-
syncPortalState() {
|
|
75
|
-
if (!this.open) {
|
|
76
|
-
if (this.wrapper) {
|
|
77
|
-
this.wrapper.style.transition = 'opacity 0.15s ease-out';
|
|
78
|
-
this.wrapper.style.opacity = '0';
|
|
79
|
-
this.wrapper.style.pointerEvents = 'none';
|
|
80
|
-
if (this.closeTransitionTimer)
|
|
81
|
-
clearTimeout(this.closeTransitionTimer);
|
|
82
|
-
this.closeTransitionTimer = setTimeout(() => {
|
|
83
|
-
if (this.wrapper && !this.open) {
|
|
84
|
-
this.wrapper.style.display = 'none';
|
|
85
|
-
}
|
|
86
|
-
}, 150);
|
|
87
|
-
}
|
|
88
|
-
this.unobserveParent();
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (this.closeTransitionTimer)
|
|
92
|
-
clearTimeout(this.closeTransitionTimer);
|
|
93
|
-
this.ensureWrapper();
|
|
94
|
-
if (!this.wrapper)
|
|
95
|
-
return;
|
|
96
|
-
this.wrapper.style.display = 'block';
|
|
97
|
-
this.wrapper.style.transition = 'opacity 0.25s ease-out';
|
|
98
|
-
this.wrapper.style.opacity = '0';
|
|
99
|
-
this.wrapper.style.pointerEvents = '';
|
|
100
|
-
this.observeParent();
|
|
101
|
-
this.updatePosition();
|
|
102
|
-
}
|
|
103
|
-
moveSlotContent() {
|
|
104
|
-
if (!this.wrapper)
|
|
105
|
-
return;
|
|
106
|
-
const nodes = Array.from(this.hostEl.childNodes).filter(n => n.nodeType !== Node.COMMENT_NODE);
|
|
107
|
-
nodes.forEach(n => this.wrapper.appendChild(n));
|
|
108
|
-
}
|
|
109
|
-
// 위치 갱신 (scroll / resize)
|
|
110
|
-
updatePosition() {
|
|
111
|
-
if (this.rafId !== undefined)
|
|
112
|
-
cancelAnimationFrame(this.rafId);
|
|
113
|
-
this.rafId = requestAnimationFrame(() => {
|
|
114
|
-
if (!this.parentRef || !this.wrapper)
|
|
115
|
-
return;
|
|
116
|
-
const parentRect = this.parentRef.getBoundingClientRect();
|
|
117
|
-
const viewport = {
|
|
118
|
-
width: window.innerWidth,
|
|
119
|
-
height: window.innerHeight,
|
|
120
|
-
};
|
|
121
|
-
const offset = this.offset ?? [0, 4];
|
|
122
|
-
const viewportPadding = Math.max(0, this.viewportPadding ?? 0);
|
|
123
|
-
const maxWidth = Math.max(viewport.width - viewportPadding * 2, 0);
|
|
124
|
-
const maxHeight = Math.max(viewport.height - viewportPadding * 2, 0);
|
|
125
|
-
this.wrapper.style.maxWidth = `${maxWidth}px`;
|
|
126
|
-
this.wrapper.style.maxHeight = `${maxHeight}px`;
|
|
127
|
-
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
128
|
-
const availableBelow = viewport.height - parentRect.bottom - offset[1] - viewportPadding;
|
|
129
|
-
const availableAbove = parentRect.top - offset[1] - viewportPadding;
|
|
130
|
-
let top = parentRect.bottom + offset[1];
|
|
131
|
-
let left = parentRect.left + offset[0];
|
|
132
|
-
if (availableBelow < wrapperRect.height && availableAbove > availableBelow) {
|
|
133
|
-
top = parentRect.top - wrapperRect.height - offset[1];
|
|
134
|
-
}
|
|
135
|
-
const minTop = viewportPadding;
|
|
136
|
-
const maxTop = viewport.height - viewportPadding - wrapperRect.height;
|
|
137
|
-
if (maxTop < minTop) {
|
|
138
|
-
top = minTop;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
top = Math.min(Math.max(top, minTop), maxTop);
|
|
142
|
-
}
|
|
143
|
-
if (parentRect.left + wrapperRect.width + offset[0] > viewport.width - viewportPadding) {
|
|
144
|
-
left = parentRect.right - wrapperRect.width - offset[0];
|
|
145
|
-
}
|
|
146
|
-
const minLeft = viewportPadding;
|
|
147
|
-
const maxLeft = viewport.width - viewportPadding - wrapperRect.width;
|
|
148
|
-
if (maxLeft < minLeft) {
|
|
149
|
-
left = minLeft;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
left = Math.min(Math.max(left, minLeft), maxLeft);
|
|
153
|
-
}
|
|
154
|
-
this.wrapper.style.top = `${top}px`;
|
|
155
|
-
this.wrapper.style.left = `${left}px`;
|
|
156
|
-
this.wrapper.style.visibility = 'visible';
|
|
157
|
-
this.wrapper.style.opacity = '1';
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
// parentRef의 이동 / 크기변경 감지
|
|
161
|
-
observeParent() {
|
|
162
|
-
if (!this.parentRef || this.isObserved)
|
|
163
|
-
return;
|
|
164
|
-
this.observeScrollParents(this.parentRef);
|
|
165
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
166
|
-
this.resizeObserver = new ResizeObserver(() => this.updatePosition());
|
|
167
|
-
this.resizeObserver.observe(this.parentRef);
|
|
168
|
-
}
|
|
169
|
-
if (typeof MutationObserver !== 'undefined') {
|
|
170
|
-
this.mutationObserver = new MutationObserver(() => this.updatePosition());
|
|
171
|
-
this.mutationObserver.observe(document.body, {
|
|
172
|
-
childList: true,
|
|
173
|
-
subtree: true,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
this.isObserved = true;
|
|
177
|
-
}
|
|
178
|
-
unobserveParent() {
|
|
179
|
-
if (!this.isObserved)
|
|
180
|
-
return;
|
|
181
|
-
this.unobserveScrollParents();
|
|
182
|
-
this.resizeObserver?.disconnect();
|
|
183
|
-
this.resizeObserver = undefined;
|
|
184
|
-
this.mutationObserver?.disconnect();
|
|
185
|
-
this.mutationObserver = undefined;
|
|
186
|
-
this.isObserved = false;
|
|
187
|
-
}
|
|
188
|
-
observeScrollParents(element) {
|
|
189
|
-
const nextScrollParents = this.getScrollParents(element);
|
|
190
|
-
nextScrollParents.forEach(parent => {
|
|
191
|
-
parent.addEventListener('scroll', this.handleObservedScroll, { passive: true });
|
|
192
|
-
});
|
|
193
|
-
this.scrollParents = nextScrollParents;
|
|
194
|
-
}
|
|
195
|
-
unobserveScrollParents() {
|
|
196
|
-
this.scrollParents.forEach(parent => {
|
|
197
|
-
parent.removeEventListener('scroll', this.handleObservedScroll);
|
|
198
|
-
});
|
|
199
|
-
this.scrollParents = [];
|
|
200
|
-
}
|
|
201
|
-
getScrollParents(element) {
|
|
202
|
-
const scrollParents = [];
|
|
203
|
-
let currentElement = element.parentElement;
|
|
204
|
-
while (currentElement) {
|
|
205
|
-
const { overflow, overflowX, overflowY } = getComputedStyle(currentElement);
|
|
206
|
-
const isScrollable = [overflow, overflowX, overflowY].some(value => /(auto|scroll|overlay)/.test(value));
|
|
207
|
-
if (isScrollable) {
|
|
208
|
-
scrollParents.push(currentElement);
|
|
209
|
-
}
|
|
210
|
-
currentElement = currentElement.parentElement;
|
|
211
|
-
}
|
|
212
|
-
return scrollParents;
|
|
213
|
-
}
|
|
214
|
-
isInsideTarget(target) {
|
|
215
|
-
return !!((this.wrapper?.contains(target)) ||
|
|
216
|
-
(this.parentRef?.contains(target)));
|
|
217
|
-
}
|
|
218
|
-
// 외부 클릭 감지
|
|
219
|
-
handleMouseDown(e) {
|
|
220
|
-
this.isInsideClick = this.isInsideTarget(e.target);
|
|
221
|
-
}
|
|
222
|
-
handleWindowClick(e) {
|
|
223
|
-
if (this.isInsideClick) {
|
|
224
|
-
this.isInsideClick = false;
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (this.isInsideTarget(e.target))
|
|
228
|
-
return;
|
|
229
|
-
this.close.emit();
|
|
230
|
-
}
|
|
231
|
-
render() {
|
|
232
|
-
return h("slot", { key: '22e09896836d017f33a9c6b92772a00fc85f8997' });
|
|
233
|
-
}
|
|
234
|
-
static get watchers() { return {
|
|
235
|
-
"open": [{
|
|
236
|
-
"handleOpenChange": 0
|
|
237
|
-
}]
|
|
238
|
-
}; }
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
export { SdPortal as sd_portal };
|