hys-ui 0.6.0 → 0.7.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/CHANGELOG.md +9 -0
- package/LICENSE +19 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1055 -753
- package/dist/components/HysDataGrid/gridColumnLayout.js +46 -0
- package/dist/components/HysDataGrid/gridPresentation.js +17 -0
- package/dist/components/HysDataGrid/useGridContextMenu.js +33 -0
- package/dist/components/HysDescriptions/HysDescriptions.vue.js +7 -0
- package/dist/components/HysDescriptions/HysDescriptions2.vue.js +146 -0
- package/dist/components/HysForm/HysForm2.vue.js +9 -8
- package/dist/components/HysIcon/HysIcon.vue.js +373 -0
- package/dist/components/HysIcon/HysIcon2.vue.js +5 -0
- package/dist/components/HysIcon/IconGraphic/IconGraphic.vue.js +147 -0
- package/dist/components/HysIcon/IconGraphic/IconGraphic2.vue.js +4 -0
- package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.js +7 -0
- package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel2.vue.js +440 -0
- package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.js +29 -0
- package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic2.vue.js +4 -0
- package/dist/components/HysIcon/IconTooltip/IconTooltip.vue.js +19 -0
- package/dist/components/HysIcon/IconTooltip/IconTooltip2.vue.js +4 -0
- package/dist/components/HysIcon/builtins/access.js +180 -0
- package/dist/components/HysIcon/builtins/actions.js +327 -0
- package/dist/components/HysIcon/builtins/business.js +364 -0
- package/dist/components/HysIcon/builtins/catalog/access-1.json.js +51 -0
- package/dist/components/HysIcon/builtins/catalog/access-2.json.js +35 -0
- package/dist/components/HysIcon/builtins/catalog/accessibility.json.js +26 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-1.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-2.json.js +46 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-3.json.js +42 -0
- package/dist/components/HysIcon/builtins/catalog/charts-1.json.js +50 -0
- package/dist/components/HysIcon/builtins/catalog/charts-2.json.js +13 -0
- package/dist/components/HysIcon/builtins/catalog/commerce.json.js +43 -0
- package/dist/components/HysIcon/builtins/catalog/communication-1.json.js +49 -0
- package/dist/components/HysIcon/builtins/catalog/communication-2.json.js +37 -0
- package/dist/components/HysIcon/builtins/catalog/design-1.json.js +61 -0
- package/dist/components/HysIcon/builtins/catalog/design-2.json.js +27 -0
- package/dist/components/HysIcon/builtins/catalog/development-1.json.js +58 -0
- package/dist/components/HysIcon/builtins/catalog/development-2.json.js +60 -0
- package/dist/components/HysIcon/builtins/catalog/development-3.json.js +25 -0
- package/dist/components/HysIcon/builtins/catalog/devices-1.json.js +52 -0
- package/dist/components/HysIcon/builtins/catalog/devices-2.json.js +55 -0
- package/dist/components/HysIcon/builtins/catalog/devices-3.json.js +23 -0
- package/dist/components/HysIcon/builtins/catalog/education.json.js +34 -0
- package/dist/components/HysIcon/builtins/catalog/emoji.json.js +24 -0
- package/dist/components/HysIcon/builtins/catalog/files-1.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/files-2.json.js +47 -0
- package/dist/components/HysIcon/builtins/catalog/files-3.json.js +8 -0
- package/dist/components/HysIcon/builtins/catalog/food-1.json.js +67 -0
- package/dist/components/HysIcon/builtins/catalog/food-2.json.js +40 -0
- package/dist/components/HysIcon/builtins/catalog/home.json.js +36 -0
- package/dist/components/HysIcon/builtins/catalog/layout-1.json.js +46 -0
- package/dist/components/HysIcon/builtins/catalog/layout-2.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/manifest.json.js +4 -0
- package/dist/components/HysIcon/builtins/catalog/maps-1.json.js +61 -0
- package/dist/components/HysIcon/builtins/catalog/maps-2.json.js +24 -0
- package/dist/components/HysIcon/builtins/catalog/media-1.json.js +57 -0
- package/dist/components/HysIcon/builtins/catalog/media-2.json.js +13 -0
- package/dist/components/HysIcon/builtins/catalog/medical.json.js +30 -0
- package/dist/components/HysIcon/builtins/catalog/nature.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/recreation.json.js +51 -0
- package/dist/components/HysIcon/builtins/catalog/shapes.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/text-1.json.js +52 -0
- package/dist/components/HysIcon/builtins/catalog/text-2.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/text-3.json.js +58 -0
- package/dist/components/HysIcon/builtins/catalog/text-4.json.js +41 -0
- package/dist/components/HysIcon/builtins/catalog/time.json.js +39 -0
- package/dist/components/HysIcon/builtins/catalog/transport-1.json.js +57 -0
- package/dist/components/HysIcon/builtins/catalog/transport-2.json.js +7 -0
- package/dist/components/HysIcon/builtins/catalog/weather.json.js +46 -0
- package/dist/components/HysIcon/builtins/communication.js +314 -0
- package/dist/components/HysIcon/builtins/documents.js +315 -0
- package/dist/components/HysIcon/builtins/extendedCatalog.js +75 -0
- package/dist/components/HysIcon/builtins/iconInCategory.js +11 -0
- package/dist/components/HysIcon/builtins/media.js +255 -0
- package/dist/components/HysIcon/builtins/navigation.js +276 -0
- package/dist/components/HysIcon/builtins/technology.js +189 -0
- package/dist/components/HysIcon/iconBuiltins.js +228 -0
- package/dist/components/HysIcon/iconConfig.js +30 -0
- package/dist/components/HysIcon/iconRegistry.js +183 -0
- package/dist/components/HysIcon/iconSafety.js +191 -0
- package/dist/components/HysIcon/iconStyle.js +70 -0
- package/dist/components/HysIcon/useIconResource.js +75 -0
- package/dist/components/HysPopconfirm/HysPopconfirm.vue.js +7 -0
- package/dist/components/HysPopconfirm/HysPopconfirm2.vue.js +346 -0
- package/dist/components/HysPopconfirm/usePopconfirmAction.js +32 -0
- package/dist/components/HysResult/HysResult.vue.js +7 -0
- package/dist/components/HysResult/HysResult2.vue.js +124 -0
- package/dist/components/HysSpace/HysSpace.vue.js +7 -0
- package/dist/components/HysSpace/HysSpace2.vue.js +79 -0
- package/dist/components/HysSpace/spaceItems.js +17 -0
- package/dist/components/HysSpin/HysSpin.vue.js +7 -0
- package/dist/components/HysSpin/HysSpin2.vue.js +427 -0
- package/dist/components/HysSpin/SpinGlyph/SpinGlyph.vue.js +334 -0
- package/dist/components/HysSpin/SpinGlyph/SpinGlyph2.vue.js +5 -0
- package/dist/components/HysSpin/SpinPortal/SpinPortal.vue.js +7 -0
- package/dist/components/HysSpin/SpinPortal/SpinPortal2.vue.js +66 -0
- package/dist/components/HysSpin/SpinPortal/spinTarget.js +57 -0
- package/dist/components/HysSpin/spinCatalog.js +35 -0
- package/dist/components/HysSpin/spinConfig.js +32 -0
- package/dist/components/HysSpin/spinService.js +160 -0
- package/dist/components/HysSpin/spinStyle.js +39 -0
- package/dist/components/HysSpin/useHysSpinTask.js +92 -0
- package/dist/components/HysSpin/useSpinFullscreen.js +60 -0
- package/dist/components/HysSpin/useSpinVisibility.js +59 -0
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +285 -204
- package/dist/components/HysSplitPane/splitPaneResize.js +75 -0
- package/dist/components/HysTabPane/HysTabPane.vue.js +49 -0
- package/dist/components/HysTabPane/HysTabPane2.vue.js +4 -0
- package/dist/components/HysTable/HysTable.vue.js +3 -3
- package/dist/components/HysTable/HysTable2.vue.js +412 -383
- package/dist/components/HysTable/tableSearch.js +24 -0
- package/dist/components/HysTabs/HysTabs.vue.js +172 -5
- package/dist/components/HysTabs/HysTabs2.vue.js +2 -275
- package/dist/components/HysTabs/TabsMore/TabsMore.vue.js +7 -0
- package/dist/components/HysTabs/TabsMore/TabsMore2.vue.js +133 -0
- package/dist/components/HysTabs/TabsPanels/TabsPanels.vue.js +161 -0
- package/dist/components/HysTabs/TabsPanels/TabsPanels2.vue.js +4 -0
- package/dist/components/HysTabs/TabsPrompts/TabsPrompts.vue.js +4 -0
- package/dist/components/HysTabs/TabsPrompts/TabsPrompts2.vue.js +88 -0
- package/dist/components/HysTabs/TabsSlot/TabsSlot.js +13 -0
- package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.js +7 -0
- package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench2.vue.js +687 -0
- package/dist/components/HysTabs/tabsConfig.js +35 -0
- package/dist/components/HysTabs/tabsItems.js +79 -0
- package/dist/components/HysTabs/tabsPersistence.js +118 -0
- package/dist/components/HysTabs/useHysRouteTabs.js +77 -0
- package/dist/components/HysTabs/useTabsDragGhost.js +47 -0
- package/dist/components/HysTabs/useTabsNav.js +127 -0
- package/dist/components/HysTabs/useTabsOverlays.js +52 -0
- package/dist/components/HysTabs/useTabsPanels.js +101 -0
- package/dist/components/HysTabs/useTabsPointer.js +131 -0
- package/dist/components/HysTabs/useTabsState.js +263 -0
- package/dist/composables/formLayout.js +20 -42
- package/dist/composables/popupSurfaceStyle.js +30 -0
- package/dist/composables/useContainerWidth.js +24 -0
- package/dist/composables/useFloating.js +28 -28
- package/dist/composables/usePageVisibility.js +19 -0
- package/dist/composables/usePopupSurface.js +153 -162
- package/dist/composables/usePopupSurfaceInteractions.js +91 -90
- package/dist/composables/useSplitPaneDrag.js +29 -26
- package/dist/composables/useSvgInstanceId.js +15 -0
- package/dist/composables/useTable.js +321 -306
- package/dist/composables/useTabularRowNavigation.js +46 -0
- package/dist/index.js +229 -185
- package/dist/internal/MultiSplitPane.vue.js +246 -205
- package/dist/internal/PopupSurfacePanel.vue.js +2 -2
- package/dist/internal/PopupSurfacePanel2.vue.js +35 -30
- package/dist/style.css +1 -1
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +40 -2
- package/dist/types/components/HysDataGrid/gridColumnLayout.d.ts +22 -0
- package/dist/types/components/HysDataGrid/gridPresentation.d.ts +47 -0
- package/dist/types/components/HysDataGrid/useGridContextMenu.d.ts +14 -0
- package/dist/types/components/HysDescriptions/HysDescriptions.vue.d.ts +20 -0
- package/dist/types/components/HysDescriptions/descriptionsTypes.d.ts +54 -0
- package/dist/types/components/HysForm/HysForm.vue.d.ts +1 -1
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysIcon/HysIcon.vue.d.ts +76 -0
- package/dist/types/components/HysIcon/IconGraphic/IconGraphic.vue.d.ts +43 -0
- package/dist/types/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.d.ts +17 -0
- package/dist/types/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.d.ts +10 -0
- package/dist/types/components/HysIcon/IconTooltip/IconTooltip.vue.d.ts +11 -0
- package/dist/types/components/HysIcon/builtins/access.d.ts +15 -0
- package/dist/types/components/HysIcon/builtins/actions.d.ts +30 -0
- package/dist/types/components/HysIcon/builtins/business.d.ts +31 -0
- package/dist/types/components/HysIcon/builtins/communication.d.ts +27 -0
- package/dist/types/components/HysIcon/builtins/documents.d.ts +29 -0
- package/dist/types/components/HysIcon/builtins/extendedCatalog.d.ts +2 -0
- package/dist/types/components/HysIcon/builtins/iconInCategory.d.ts +2 -0
- package/dist/types/components/HysIcon/builtins/media.d.ts +24 -0
- package/dist/types/components/HysIcon/builtins/navigation.d.ts +30 -0
- package/dist/types/components/HysIcon/builtins/technology.d.ts +18 -0
- package/dist/types/components/HysIcon/iconBuiltins.d.ts +2 -0
- package/dist/types/components/HysIcon/iconConfig.d.ts +10 -0
- package/dist/types/components/HysIcon/iconRegistry.d.ts +5 -0
- package/dist/types/components/HysIcon/iconSafety.d.ts +8 -0
- package/dist/types/components/HysIcon/iconStyle.d.ts +6 -0
- package/dist/types/components/HysIcon/iconTypes.d.ts +192 -0
- package/dist/types/components/HysIcon/useIconResource.d.ts +14 -0
- package/dist/types/components/HysPopconfirm/HysPopconfirm.vue.d.ts +85 -0
- package/dist/types/components/HysPopconfirm/popconfirmTypes.d.ts +72 -0
- package/dist/types/components/HysPopconfirm/usePopconfirmAction.d.ts +6 -0
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
- package/dist/types/components/HysResult/HysResult.vue.d.ts +22 -0
- package/dist/types/components/HysResult/resultTypes.d.ts +32 -0
- package/dist/types/components/HysSpace/HysSpace.vue.d.ts +15 -0
- package/dist/types/components/HysSpace/spaceItems.d.ts +9 -0
- package/dist/types/components/HysSpace/spaceTypes.d.ts +20 -0
- package/dist/types/components/HysSpin/HysSpin.vue.d.ts +84 -0
- package/dist/types/components/HysSpin/SpinGlyph/SpinGlyph.vue.d.ts +16 -0
- package/dist/types/components/HysSpin/SpinPortal/SpinPortal.vue.d.ts +21 -0
- package/dist/types/components/HysSpin/SpinPortal/spinTarget.d.ts +3 -0
- package/dist/types/components/HysSpin/spinCatalog.d.ts +122 -0
- package/dist/types/components/HysSpin/spinConfig.d.ts +10 -0
- package/dist/types/components/HysSpin/spinService.d.ts +7 -0
- package/dist/types/components/HysSpin/spinStyle.d.ts +5 -0
- package/dist/types/components/HysSpin/spinTypes.d.ts +133 -0
- package/dist/types/components/HysSpin/useHysSpinTask.d.ts +4 -0
- package/dist/types/components/HysSpin/useSpinFullscreen.d.ts +17 -0
- package/dist/types/components/HysSpin/useSpinVisibility.d.ts +10 -0
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +25 -2
- package/dist/types/components/HysSplitPane/splitPaneResize.d.ts +17 -0
- package/dist/types/components/HysTabPane/HysTabPane.vue.d.ts +11 -0
- package/dist/types/components/HysTable/HysTable.vue.d.ts +16 -10
- package/dist/types/components/HysTable/tableSearch.d.ts +2 -0
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +83 -74
- package/dist/types/components/HysTabs/TabsMore/TabsMore.vue.d.ts +14 -0
- package/dist/types/components/HysTabs/TabsPanels/TabsPanels.vue.d.ts +17 -0
- package/dist/types/components/HysTabs/TabsPrompts/TabsPrompts.vue.d.ts +7 -0
- package/dist/types/components/HysTabs/TabsSlot/TabsSlot.d.ts +9 -0
- package/dist/types/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.d.ts +32 -0
- package/dist/types/components/HysTabs/tabsConfig.d.ts +4 -0
- package/dist/types/components/HysTabs/tabsItems.d.ts +14 -0
- package/dist/types/components/HysTabs/tabsPersistence.d.ts +6 -0
- package/dist/types/components/HysTabs/tabsTypes.d.ts +236 -0
- package/dist/types/components/HysTabs/useHysRouteTabs.d.ts +22 -0
- package/dist/types/components/HysTabs/useTabsDragGhost.d.ts +22 -0
- package/dist/types/components/HysTabs/useTabsNav.d.ts +20 -0
- package/dist/types/components/HysTabs/useTabsOverlays.d.ts +54 -0
- package/dist/types/components/HysTabs/useTabsPanels.d.ts +14 -0
- package/dist/types/components/HysTabs/useTabsPointer.d.ts +30 -0
- package/dist/types/components/HysTabs/useTabsState.d.ts +32 -0
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +2 -2
- package/dist/types/components/HysToast/toastPresentation.d.ts +1 -1
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +2 -2
- package/dist/types/composables/dataGrid.d.ts +34 -0
- package/dist/types/composables/formLayout.d.ts +1 -2
- package/dist/types/composables/popupSurfaceStyle.d.ts +7 -0
- package/dist/types/composables/table.d.ts +10 -1
- package/dist/types/composables/toastQueue.d.ts +4 -4
- package/dist/types/composables/toastQueueModel.d.ts +2 -2
- package/dist/types/composables/useColorPicker.d.ts +1 -1
- package/dist/types/composables/useContainerWidth.d.ts +2 -0
- package/dist/types/composables/useContextMenu.d.ts +1 -1
- package/dist/types/composables/useFloating.d.ts +2 -2
- package/dist/types/composables/usePageVisibility.d.ts +1 -0
- package/dist/types/composables/usePopupSurface.d.ts +9 -3
- package/dist/types/composables/usePopupSurfaceInteractions.d.ts +4 -2
- package/dist/types/composables/useSplitPaneDrag.d.ts +2 -2
- package/dist/types/composables/useSvgInstanceId.d.ts +1 -0
- package/dist/types/composables/useTable.d.ts +2 -0
- package/dist/types/composables/useTabularRowNavigation.d.ts +18 -0
- package/dist/types/index.d.ts +30 -2
- package/dist/types/internal/MultiSplitPane.vue.d.ts +10 -1
- package/dist/types/internal/PopupSurfacePanel.vue.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ref as F, onDeactivated as Z, onBeforeUnmount as _ } from "vue";
|
|
2
|
+
import { bounded as H, tabToken as $ } from "./tabsItems.js";
|
|
3
|
+
import { useTabsDragGhost as V } from "./useTabsDragGhost.js";
|
|
4
|
+
function ot(l, c, k, M, L, D, j, q, z) {
|
|
5
|
+
const m = V(), h = F(), f = F();
|
|
6
|
+
let s, y, P, X, v = !1, p = !1;
|
|
7
|
+
function w() {
|
|
8
|
+
clearTimeout(P), P = void 0;
|
|
9
|
+
}
|
|
10
|
+
function T() {
|
|
11
|
+
clearTimeout(X), v = !1;
|
|
12
|
+
}
|
|
13
|
+
function Y() {
|
|
14
|
+
T(), v = !0, X = setTimeout(() => {
|
|
15
|
+
v = !1;
|
|
16
|
+
}, 450);
|
|
17
|
+
}
|
|
18
|
+
function A(t) {
|
|
19
|
+
v && (t.preventDefault(), t.stopImmediatePropagation(), T());
|
|
20
|
+
}
|
|
21
|
+
function J(t) {
|
|
22
|
+
if (l().disabled || !t.isPrimary || t.button !== 0) return;
|
|
23
|
+
T();
|
|
24
|
+
const e = t.target, i = e.closest(".hys-ui-tab-item");
|
|
25
|
+
if (e.closest(".hys-ui-tab-close")) return;
|
|
26
|
+
const o = i != null && i.dataset.tabGroup ? k(i.dataset.tabGroup) : void 0, n = !!(o && l().draggable && M(o) && (!l().dragHandle || e.closest(".hys-tab-drag-handle"))), a = !!l().dragScroll && t.pointerType !== "touch";
|
|
27
|
+
s = {
|
|
28
|
+
id: t.pointerId,
|
|
29
|
+
x: t.clientX,
|
|
30
|
+
y: t.clientY,
|
|
31
|
+
last: D() ? t.clientY : t.clientX,
|
|
32
|
+
item: o,
|
|
33
|
+
reorder: n,
|
|
34
|
+
scroll: a
|
|
35
|
+
};
|
|
36
|
+
const r = H(
|
|
37
|
+
l().longPress,
|
|
38
|
+
l().workbench || l().contextMenu ? 550 : 0,
|
|
39
|
+
5e3
|
|
40
|
+
);
|
|
41
|
+
o && r && t.pointerType !== "mouse" && !e.closest(".hys-tab-drag-handle") && (P = setTimeout(() => {
|
|
42
|
+
(s == null ? void 0 : s.id) === t.pointerId && (s = void 0, Y(), j(o, t));
|
|
43
|
+
}, r));
|
|
44
|
+
}
|
|
45
|
+
function K(t) {
|
|
46
|
+
var B, R, S, U, E;
|
|
47
|
+
const e = s, i = c.nav.value;
|
|
48
|
+
if (!e || e.id !== t.pointerId || !i) return;
|
|
49
|
+
const o = t.clientX, n = t.clientY, a = D(), r = a ? n : o;
|
|
50
|
+
if (h.value === void 0 && !p) {
|
|
51
|
+
if (Math.hypot(o - e.x, n - e.y) < 7 || (w(), !e.reorder && !e.scroll)) return;
|
|
52
|
+
if ((B = i.setPointerCapture) == null || B.call(i, t.pointerId), e.reorder) {
|
|
53
|
+
const d = e.item;
|
|
54
|
+
h.value = d.value;
|
|
55
|
+
const b = (S = (R = c.button(d.value)) == null ? void 0 : R.closest(".hys-ui-tab-item")) == null ? void 0 : S.getBoundingClientRect();
|
|
56
|
+
b && m.show(d, b, { x: e.x, y: e.y });
|
|
57
|
+
} else p = !0;
|
|
58
|
+
}
|
|
59
|
+
if (t.preventDefault(), p) {
|
|
60
|
+
c.scrollPixels(e.last - r), e.last = r;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
m.move(o, n);
|
|
64
|
+
const u = i.getBoundingClientRect();
|
|
65
|
+
if (o < u.left - 12 || o > u.right + 12 || n < u.top - 12 || n > u.bottom + 12) {
|
|
66
|
+
f.value = void 0;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const g = (U = document.elementFromPoint(o, n)) == null ? void 0 : U.closest(".hys-ui-tab-item"), C = g == null ? void 0 : g.dataset.tabGroup, x = C ? k(C) : void 0;
|
|
70
|
+
if (g && i.contains(g) && x && M(x) && x.value !== e.item.value) {
|
|
71
|
+
const d = g.getBoundingClientRect(), b = a ? (d.top + d.bottom) / 2 : (d.left + d.right) / 2;
|
|
72
|
+
(((E = f.value) == null ? void 0 : E.value) !== x.value || Math.abs(r - b) > 4) && (f.value = {
|
|
73
|
+
value: x.value,
|
|
74
|
+
after: a || !c.rtl() ? r > b : r < b
|
|
75
|
+
});
|
|
76
|
+
} else C !== $(e.item.value) && (f.value = void 0);
|
|
77
|
+
const Q = a ? u.top : u.left, W = a ? u.bottom : u.right;
|
|
78
|
+
r < Q + 16 ? c.scrollPixels(-8) : r > W - 16 && c.scrollPixels(8);
|
|
79
|
+
}
|
|
80
|
+
function I(t, e = !1) {
|
|
81
|
+
if (!s || t && s.id !== t.pointerId) return;
|
|
82
|
+
w();
|
|
83
|
+
const i = h.value, o = f.value;
|
|
84
|
+
if ((i !== void 0 || p) && Y(), s = void 0, h.value = void 0, f.value = void 0, p = !1, i !== void 0) {
|
|
85
|
+
const n = !e && o ? L(i, o.value, o.after) : void 0;
|
|
86
|
+
m.land(
|
|
87
|
+
n,
|
|
88
|
+
() => {
|
|
89
|
+
var a;
|
|
90
|
+
return (a = c.button(i)) == null ? void 0 : a.closest(".hys-ui-tab-item");
|
|
91
|
+
},
|
|
92
|
+
z() ? H(l().duration, 160, 5e3) : 0,
|
|
93
|
+
l().easing ?? "ease-out"
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function N(t) {
|
|
98
|
+
l().swipe && !l().disabled && t.pointerType === "touch" && t.isPrimary && !t.target.closest(
|
|
99
|
+
"button,input,a,select,textarea,[contenteditable]"
|
|
100
|
+
) && (y = { id: t.pointerId, x: t.clientX, y: t.clientY });
|
|
101
|
+
}
|
|
102
|
+
function O(t) {
|
|
103
|
+
const e = y;
|
|
104
|
+
if (y = void 0, !e || t.pointerId !== e.id || !l().swipe || l().disabled)
|
|
105
|
+
return;
|
|
106
|
+
const i = t.clientX - e.x, o = t.clientY - e.y;
|
|
107
|
+
Math.abs(i) >= 45 && Math.abs(i) > Math.abs(o) * 1.35 && q(Math.sign(i) * (c.rtl() ? 1 : -1));
|
|
108
|
+
}
|
|
109
|
+
function G() {
|
|
110
|
+
I(void 0, !0), w(), T(), y = void 0, m.clear();
|
|
111
|
+
}
|
|
112
|
+
return Z(G), _(G), {
|
|
113
|
+
dragging: h,
|
|
114
|
+
drop: f,
|
|
115
|
+
ghost: m.ghost,
|
|
116
|
+
ghostElement: m.element,
|
|
117
|
+
down: J,
|
|
118
|
+
motion: K,
|
|
119
|
+
finish: I,
|
|
120
|
+
cancel: (t) => I(t, !0),
|
|
121
|
+
clickCapture: A,
|
|
122
|
+
swipeDown: N,
|
|
123
|
+
swipeUp: O,
|
|
124
|
+
cancelSwipe: () => {
|
|
125
|
+
y = void 0;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
ot as useTabsPointer
|
|
131
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { shallowRef as z, ref as Z, computed as I, reactive as oe, watch as H, onActivated as fe, onDeactivated as se, onBeforeUnmount as ce, nextTick as k } from "vue";
|
|
2
|
+
import { orderedTabs as T, usable as b, bounded as ve, neighbor as de } from "./tabsItems.js";
|
|
3
|
+
function _(l, A) {
|
|
4
|
+
return new Promise((w, o) => {
|
|
5
|
+
const S = () => w(!1);
|
|
6
|
+
A.aborted ? S() : A.addEventListener("abort", S, { once: !0 }), Promise.resolve(l).then((J) => w(J !== !1), o).finally(() => A.removeEventListener("abort", S));
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function he(l, A, w, o, S) {
|
|
10
|
+
const J = z([...l().defaultItems ?? []]), j = Z(l().defaultValue), d = I(
|
|
11
|
+
() => T(l().items ?? (w() ? A() : J.value))
|
|
12
|
+
), g = I(() => d.value.filter((e) => !e.hidden)), u = I(
|
|
13
|
+
() => new Map(d.value.map((e) => [e.value, e]))
|
|
14
|
+
), $ = I(
|
|
15
|
+
() => l().disabled ? [] : g.value.filter(b)
|
|
16
|
+
), h = I(() => {
|
|
17
|
+
var a;
|
|
18
|
+
if (l().modelValue !== void 0) return l().modelValue;
|
|
19
|
+
const e = j.value === void 0 ? void 0 : u.value.get(j.value);
|
|
20
|
+
return e && b(e) ? e.value : ((a = g.value.find(b)) == null ? void 0 : a.value) ?? "";
|
|
21
|
+
}), R = Z(!1), B = oe(/* @__PURE__ */ new Set()), F = z([]), C = z([]), Q = I(() => ve(l().historyLimit, 20, 200));
|
|
22
|
+
let y, s = !0, D = 0, G = !1;
|
|
23
|
+
const x = /* @__PURE__ */ new Map();
|
|
24
|
+
function N() {
|
|
25
|
+
y == null || y.abort(), y = void 0, R.value = !1;
|
|
26
|
+
}
|
|
27
|
+
function K() {
|
|
28
|
+
N();
|
|
29
|
+
for (const e of x.values()) e.abort();
|
|
30
|
+
x.clear(), B.clear();
|
|
31
|
+
}
|
|
32
|
+
function W(e, a, t) {
|
|
33
|
+
j.value = e, o("update:modelValue", e), o("change", e), o("selectionChange", { value: e, previous: a, source: t });
|
|
34
|
+
}
|
|
35
|
+
async function U(e, a = "api") {
|
|
36
|
+
N();
|
|
37
|
+
const t = u.value.get(e), r = h.value;
|
|
38
|
+
if (!s || l().disabled || !t || !b(t)) return !1;
|
|
39
|
+
if (e === r) return !0;
|
|
40
|
+
const n = new AbortController();
|
|
41
|
+
y = n;
|
|
42
|
+
try {
|
|
43
|
+
const c = l().beforeLeave;
|
|
44
|
+
if (c && (R.value = !0, !await _(
|
|
45
|
+
c(e, r, { item: t, source: a, signal: n.signal }),
|
|
46
|
+
n.signal
|
|
47
|
+
)))
|
|
48
|
+
return s && h.value === e;
|
|
49
|
+
const v = u.value.get(e);
|
|
50
|
+
return y !== n || h.value !== r || !v || !b(v) ? s && !!v && b(v) && h.value === e : (W(e, r, a), await k(), s && h.value === e);
|
|
51
|
+
} catch (c) {
|
|
52
|
+
return y === n && o("guardError", c), !1;
|
|
53
|
+
} finally {
|
|
54
|
+
y === n && N();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const p = I(
|
|
58
|
+
() => JSON.stringify(g.value.map((e) => [e.value, !!e.disabled]))
|
|
59
|
+
);
|
|
60
|
+
let X = g.value.map((e) => ({ ...e }));
|
|
61
|
+
H(
|
|
62
|
+
p,
|
|
63
|
+
() => {
|
|
64
|
+
var t;
|
|
65
|
+
const e = X;
|
|
66
|
+
X = g.value.map((r) => ({ ...r }));
|
|
67
|
+
for (const [r, n] of x)
|
|
68
|
+
V(u.value.get(r)) || n.abort();
|
|
69
|
+
const a = l().modelValue ?? j.value;
|
|
70
|
+
if (a !== void 0 && e.some((r) => r.value === a && b(r)) && !g.value.some((r) => r.value === a && b(r))) {
|
|
71
|
+
if (l().autoActivate === !1) return;
|
|
72
|
+
const r = ((t = de(g.value, e, a)) == null ? void 0 : t.value) ?? "";
|
|
73
|
+
r !== a && W(r, a, "fallback");
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{ flush: "post" }
|
|
77
|
+
), H(
|
|
78
|
+
h,
|
|
79
|
+
(e) => {
|
|
80
|
+
N();
|
|
81
|
+
const a = u.value.get(e);
|
|
82
|
+
a && b(a) && (F.value = [
|
|
83
|
+
e,
|
|
84
|
+
...F.value.filter((t) => t !== e)
|
|
85
|
+
].slice(0, Q.value));
|
|
86
|
+
},
|
|
87
|
+
{ immediate: !0, flush: "sync" }
|
|
88
|
+
), H(
|
|
89
|
+
() => l().disabled,
|
|
90
|
+
(e) => {
|
|
91
|
+
e && K();
|
|
92
|
+
},
|
|
93
|
+
{ flush: "sync" }
|
|
94
|
+
), fe(() => {
|
|
95
|
+
s = !0;
|
|
96
|
+
}), se(() => {
|
|
97
|
+
s = !1, K();
|
|
98
|
+
}), ce(() => {
|
|
99
|
+
s = !1, K();
|
|
100
|
+
});
|
|
101
|
+
function E() {
|
|
102
|
+
return s && !l().disabled && !l().readonly && !w();
|
|
103
|
+
}
|
|
104
|
+
function M(e) {
|
|
105
|
+
w() || (l().items === void 0 && (J.value = e), o("update:items", e));
|
|
106
|
+
}
|
|
107
|
+
function V(e) {
|
|
108
|
+
const a = l();
|
|
109
|
+
return !!(e && !a.disabled && !a.readonly && !e.disabled && !e.readonly && !e.pinned && (e.closable ?? (a.closable || a.editable || a.workbench)));
|
|
110
|
+
}
|
|
111
|
+
function O(e) {
|
|
112
|
+
return !!(e && E() && b(e) && !e.readonly && !e.pinned && e.movable !== !1);
|
|
113
|
+
}
|
|
114
|
+
async function ee(e) {
|
|
115
|
+
if (!s || l().disabled || l().readonly || G) return !1;
|
|
116
|
+
G = !0;
|
|
117
|
+
try {
|
|
118
|
+
if (o("add"), o("edit", void 0, "add"), !E()) return !0;
|
|
119
|
+
const a = l().createTab;
|
|
120
|
+
let t = e ?? (a ? await a(d.value) : void 0);
|
|
121
|
+
if (!t && !a && l().workbench) {
|
|
122
|
+
do
|
|
123
|
+
D++;
|
|
124
|
+
while (u.value.has("tab-" + D));
|
|
125
|
+
t = { value: "tab-" + D, label: "新建页签 " + D };
|
|
126
|
+
}
|
|
127
|
+
return t ? !E() || u.value.has(t.value) || !T([t]).length || (M(T([...d.value, t])), await k(), !s || !u.value.has(t.value)) ? !1 : (l().autoActivate !== !1 && await U(t.value), !0) : !a;
|
|
128
|
+
} catch (a) {
|
|
129
|
+
return s && o("guardError", a), !1;
|
|
130
|
+
} finally {
|
|
131
|
+
G = !1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function ae(e, a) {
|
|
135
|
+
if (typeof e != "string") return [...new Set(e)];
|
|
136
|
+
const t = g.value, r = t.findIndex((n) => n.value === a);
|
|
137
|
+
return e === "current" ? [a] : e === "all" ? d.value.map((n) => n.value) : r < 0 ? [] : (e === "left" ? t.slice(0, r) : e === "right" ? t.slice(r + 1) : t.filter((n) => n.value !== a)).map((n) => n.value);
|
|
138
|
+
}
|
|
139
|
+
async function Y(e, a = h.value) {
|
|
140
|
+
const t = ae(e, a).map((n) => u.value.get(n)).filter(
|
|
141
|
+
(n) => !!n && V(n) && !x.has(n.value)
|
|
142
|
+
);
|
|
143
|
+
if (!s || !t.length) return [];
|
|
144
|
+
const r = new AbortController();
|
|
145
|
+
for (const n of t)
|
|
146
|
+
B.add(n.value), x.set(n.value, r);
|
|
147
|
+
try {
|
|
148
|
+
const n = t.filter((i) => i.dirty);
|
|
149
|
+
if (l().confirmDirty !== !1 && n.length && !await S(n, r.signal))
|
|
150
|
+
return [];
|
|
151
|
+
const c = [];
|
|
152
|
+
for (const i of t) {
|
|
153
|
+
const f = l().beforeClose;
|
|
154
|
+
if (r.signal.aborted) return [];
|
|
155
|
+
if (V(u.value.get(i.value)))
|
|
156
|
+
try {
|
|
157
|
+
(!f || await _(
|
|
158
|
+
f(i.value, { item: i, signal: r.signal, source: "api" }),
|
|
159
|
+
r.signal
|
|
160
|
+
)) && c.push(i.value);
|
|
161
|
+
} catch (ie) {
|
|
162
|
+
r.signal.aborted || o("guardError", ie);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (!s || r.signal.aborted) return [];
|
|
166
|
+
const v = c.filter((i) => V(u.value.get(i)));
|
|
167
|
+
if (!v.length) return [];
|
|
168
|
+
const m = new Set(v), L = d.value, P = L.flatMap(
|
|
169
|
+
(i, f) => m.has(i.value) ? [{ item: i, index: f }] : []
|
|
170
|
+
);
|
|
171
|
+
!w() && (l().workbench || l().defaultItems !== void 0) && M(L.filter((i) => !m.has(i.value)));
|
|
172
|
+
for (const i of v)
|
|
173
|
+
o("close", i), o("edit", i, "remove");
|
|
174
|
+
return o("closeBatch", v), await k(), s && (C.value = [
|
|
175
|
+
...P.filter((i) => !u.value.has(i.item.value)).reverse(),
|
|
176
|
+
...C.value
|
|
177
|
+
].slice(0, Q.value)), v;
|
|
178
|
+
} finally {
|
|
179
|
+
for (const n of t)
|
|
180
|
+
x.get(n.value) === r && (x.delete(n.value), B.delete(n.value));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async function q(e, a) {
|
|
184
|
+
const t = u.value.get(e);
|
|
185
|
+
if (!E() || !t || t.disabled || t.readonly) return !1;
|
|
186
|
+
M(
|
|
187
|
+
T(
|
|
188
|
+
d.value.map(
|
|
189
|
+
(n) => n.value === e ? { ...n, ...a } : n
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
), await k();
|
|
193
|
+
const r = u.value.get(e);
|
|
194
|
+
return !!r && Object.entries(a).every(
|
|
195
|
+
([n, c]) => r[n] === c
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
async function te(e, a) {
|
|
199
|
+
const t = a.trim();
|
|
200
|
+
return !t || !await q(e, { label: t }) ? !1 : (o("rename", e, t), !0);
|
|
201
|
+
}
|
|
202
|
+
async function ne(e, a = !((t) => (t = u.value.get(e)) == null ? void 0 : t.pinned)()) {
|
|
203
|
+
return await q(e, { pinned: a }) ? (o("pinChange", e, a), !0) : !1;
|
|
204
|
+
}
|
|
205
|
+
async function re(e, a = !((t) => (t = u.value.get(e)) == null ? void 0 : t.favorite)()) {
|
|
206
|
+
return await q(e, { favorite: a }) ? (o("favoriteChange", e, a), !0) : !1;
|
|
207
|
+
}
|
|
208
|
+
async function le(e, a, t = !1) {
|
|
209
|
+
var P, i;
|
|
210
|
+
if (e === a || !O(u.value.get(e)) || !O(u.value.get(a)))
|
|
211
|
+
return !1;
|
|
212
|
+
const r = [...d.value], n = r.findIndex((f) => f.value === e), c = r.findIndex((f) => f.value === a);
|
|
213
|
+
if (r.slice(Math.min(n, c), Math.max(n, c) + 1).some((f) => !f.hidden && !O(f)))
|
|
214
|
+
return !1;
|
|
215
|
+
const [v] = r.splice(n, 1), m = r.findIndex((f) => f.value === a) + Number(t);
|
|
216
|
+
if (n === m) return !1;
|
|
217
|
+
r.splice(m, 0, v);
|
|
218
|
+
const L = { value: e, from: n, to: m, items: r };
|
|
219
|
+
try {
|
|
220
|
+
if (((i = (P = l()).beforeReorder) == null ? void 0 : i.call(P, L)) === !1) return !1;
|
|
221
|
+
} catch (f) {
|
|
222
|
+
return o("guardError", f), !1;
|
|
223
|
+
}
|
|
224
|
+
return M(r), o("reorder", L), await k(), d.value.findIndex((f) => f.value === e) === m;
|
|
225
|
+
}
|
|
226
|
+
async function ue() {
|
|
227
|
+
if (!E()) return !1;
|
|
228
|
+
const e = C.value.find(
|
|
229
|
+
(t) => !u.value.has(t.item.value)
|
|
230
|
+
);
|
|
231
|
+
if (!e) return !1;
|
|
232
|
+
const a = [...d.value];
|
|
233
|
+
return a.splice(e.index, 0, e.item), M(T(a)), await k(), !s || !u.value.has(e.item.value) ? !1 : (C.value = C.value.filter((t) => t !== e), o("restore", e.item), l().autoActivate !== !1 && await U(e.item.value, "restore"), !0);
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
all: d,
|
|
237
|
+
visible: g,
|
|
238
|
+
byKey: u,
|
|
239
|
+
enabled: $,
|
|
240
|
+
active: h,
|
|
241
|
+
current: j,
|
|
242
|
+
pending: R,
|
|
243
|
+
closing: B,
|
|
244
|
+
recent: F,
|
|
245
|
+
closed: C,
|
|
246
|
+
select: U,
|
|
247
|
+
add: ee,
|
|
248
|
+
write: M,
|
|
249
|
+
canClose: V,
|
|
250
|
+
canMove: O,
|
|
251
|
+
canEdit: E,
|
|
252
|
+
rename: te,
|
|
253
|
+
pin: ne,
|
|
254
|
+
favorite: re,
|
|
255
|
+
move: le,
|
|
256
|
+
restore: ue,
|
|
257
|
+
closeMany: Y,
|
|
258
|
+
close: async (e = h.value) => (await Y([e])).length > 0
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
he as useTabsState
|
|
263
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const s = [
|
|
1
|
+
const e = [
|
|
3
2
|
["xs", 0],
|
|
4
3
|
["sm", 576],
|
|
5
4
|
["md", 768],
|
|
@@ -7,51 +6,30 @@ const s = [
|
|
|
7
6
|
["xl", 1200],
|
|
8
7
|
["xxl", 1600]
|
|
9
8
|
];
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
if (
|
|
13
|
-
for (const [
|
|
14
|
-
|
|
15
|
-
return Math.max(1, Math.min(24, Math.floor(Number(
|
|
9
|
+
function m(o, s, t = 1) {
|
|
10
|
+
let n = typeof o == "number" ? o : t;
|
|
11
|
+
if (o && typeof o == "object")
|
|
12
|
+
for (const [r, f] of e)
|
|
13
|
+
s >= f && o[r] !== void 0 && (n = o[r]);
|
|
14
|
+
return Math.max(1, Math.min(24, Math.floor(Number(n) || t)));
|
|
16
15
|
}
|
|
17
|
-
function
|
|
18
|
-
if (!
|
|
19
|
-
let
|
|
20
|
-
for (const [
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
...
|
|
25
|
-
...typeof
|
|
16
|
+
function i(o, s) {
|
|
17
|
+
if (!o) return;
|
|
18
|
+
let t = { span: o.span, offset: o.offset };
|
|
19
|
+
for (const [n, r] of e)
|
|
20
|
+
if (s >= r && o[n] !== void 0) {
|
|
21
|
+
const f = o[n];
|
|
22
|
+
t = {
|
|
23
|
+
...t,
|
|
24
|
+
...typeof f == "number" ? { span: f } : f
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
return {
|
|
29
|
-
span: Math.max(0, Math.min(24, Math.floor(
|
|
30
|
-
offset: Math.max(0, Math.min(23, Math.floor(
|
|
28
|
+
span: Math.max(0, Math.min(24, Math.floor(t.span ?? 24))),
|
|
29
|
+
offset: Math.max(0, Math.min(23, Math.floor(t.offset ?? 0)))
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
function M(t) {
|
|
34
|
-
const r = d(0);
|
|
35
|
-
let e, o = !0;
|
|
36
|
-
const n = () => {
|
|
37
|
-
t.value && (r.value = t.value.clientWidth || t.value.getBoundingClientRect().width);
|
|
38
|
-
};
|
|
39
|
-
function i() {
|
|
40
|
-
f(), !(!o || !t.value) && (n(), typeof ResizeObserver < "u" ? (e = new ResizeObserver(n), e.observe(t.value)) : typeof window < "u" && window.addEventListener("resize", n));
|
|
41
|
-
}
|
|
42
|
-
function f() {
|
|
43
|
-
e == null || e.disconnect(), e = void 0, typeof window < "u" && window.removeEventListener("resize", n);
|
|
44
|
-
}
|
|
45
|
-
return a(t, i), u(i), c(() => {
|
|
46
|
-
o = !0, i();
|
|
47
|
-
}), m(() => {
|
|
48
|
-
o = !1, f();
|
|
49
|
-
}), p(() => {
|
|
50
|
-
o = !1, f();
|
|
51
|
-
}), h(() => r.value);
|
|
52
|
-
}
|
|
53
32
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
M as useFormWidth
|
|
33
|
+
i as resolveFormCol,
|
|
34
|
+
m as resolveFormGrid
|
|
57
35
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { computed as o } from "vue";
|
|
2
|
+
function r(t) {
|
|
3
|
+
return typeof t != "number" ? t : Number.isFinite(t) ? Math.max(0, t) + "px" : void 0;
|
|
4
|
+
}
|
|
5
|
+
function c(t, e) {
|
|
6
|
+
return r(t.maxWidth) ?? (e === "tooltip" ? "320px" : "360px");
|
|
7
|
+
}
|
|
8
|
+
function m(t, e, u) {
|
|
9
|
+
const h = o(() => {
|
|
10
|
+
const i = (t.effect ?? (e === "tooltip" ? "dark" : "light")) === "dark";
|
|
11
|
+
return {
|
|
12
|
+
...t.overlayStyle,
|
|
13
|
+
...u.value,
|
|
14
|
+
"--hys-ui-popup-surface": t.color || (i ? "#172744" : "var(--hys-ui-surface,var(--hys-ui-theme-surface))"),
|
|
15
|
+
"--hys-ui-popup-color": t.textColor || (i ? "#fff" : "var(--hys-ui-text,var(--hys-ui-theme-text))"),
|
|
16
|
+
"--hys-ui-popup-border": t.color || (i ? "#172744" : "var(--hys-ui-border,var(--hys-ui-theme-border))"),
|
|
17
|
+
overflow: "visible",
|
|
18
|
+
maxWidth: `min(${c(t, e)},calc(100vw - 20px))`,
|
|
19
|
+
minWidth: t.width !== void 0 ? "0" : void 0
|
|
20
|
+
};
|
|
21
|
+
}), a = o(() => ({
|
|
22
|
+
...t.contentStyle,
|
|
23
|
+
maxHeight: t.maxHeight !== void 0 ? `min(${r(t.maxHeight)},calc(100vh - 20px))` : "calc(100vh - 20px)"
|
|
24
|
+
}));
|
|
25
|
+
return { style: h, contentStyle: a };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
c as popupMaximumWidth,
|
|
29
|
+
m as usePopupSurfaceStyle
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ref as r, watch as f, onMounted as a, onActivated as s, onDeactivated as v, onBeforeUnmount as c, computed as w } from "vue";
|
|
2
|
+
function p(e) {
|
|
3
|
+
const u = r(0);
|
|
4
|
+
let t, i = !0;
|
|
5
|
+
const n = () => {
|
|
6
|
+
e.value && (u.value = e.value.clientWidth || e.value.getBoundingClientRect().width);
|
|
7
|
+
};
|
|
8
|
+
function o() {
|
|
9
|
+
t == null || t.disconnect(), t = void 0, typeof window < "u" && window.removeEventListener("resize", n);
|
|
10
|
+
}
|
|
11
|
+
function d() {
|
|
12
|
+
o(), !(!i || !e.value) && (n(), typeof ResizeObserver < "u" ? (t = new ResizeObserver(n), t.observe(e.value)) : typeof window < "u" && window.addEventListener("resize", n));
|
|
13
|
+
}
|
|
14
|
+
return f(e, d), a(d), s(() => {
|
|
15
|
+
i = !0, d();
|
|
16
|
+
}), v(() => {
|
|
17
|
+
i = !1, o();
|
|
18
|
+
}), c(() => {
|
|
19
|
+
i = !1, o();
|
|
20
|
+
}), w(() => u.value);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
p as useContainerWidth
|
|
24
|
+
};
|
|
@@ -4,7 +4,7 @@ import { popupSize as Q } from "../motion/popup.js";
|
|
|
4
4
|
import { positionFloating as Z } from "./floatingPosition.js";
|
|
5
5
|
import { overlayOwnerKey as _, registerOverlay as ee } from "./overlayManager.js";
|
|
6
6
|
function re(v, n, e = {}) {
|
|
7
|
-
const { disabled: k } = J({}), m = T(_, void 0),
|
|
7
|
+
const { disabled: k } = J({}), m = T(_, void 0), s = E(!1), W = Y(), p = E(!1), L = E({
|
|
8
8
|
position: "fixed",
|
|
9
9
|
top: "0px",
|
|
10
10
|
left: "0px",
|
|
@@ -17,18 +17,18 @@ function re(v, n, e = {}) {
|
|
|
17
17
|
let $ = 0, w, r, y = 0;
|
|
18
18
|
function F() {
|
|
19
19
|
var R, S, H;
|
|
20
|
-
if (!
|
|
20
|
+
if (!s.value || !v.value || !n.value) return;
|
|
21
21
|
const t = v.value.getBoundingClientRect();
|
|
22
22
|
if (!t.width && !t.height) {
|
|
23
|
-
u();
|
|
23
|
+
u(!1, !1, "anchor");
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth,
|
|
27
|
-
x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = P) : g === !0 && (n.value.style.width = `${
|
|
26
|
+
const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth, d = document.documentElement.clientHeight, c = Math.min(t.width, Math.max(0, l - 2 * i)), g = typeof e.matchWidth == "function" ? e.matchWidth() : e.matchWidth, h = (R = e.maxWidth) == null ? void 0 : R.call(e), P = h !== void 0 && (typeof h != "number" || Number.isFinite(h)) ? `min(${typeof h == "number" ? Math.max(0, h) + "px" : h},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, b = (S = e.width) == null ? void 0 : S.call(e), x = typeof b == "number" ? Number.isFinite(b) ? Math.max(0, b) + "px" : void 0 : b;
|
|
27
|
+
x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = P) : g === !0 && (n.value.style.width = `${c}px`, n.value.style.minWidth = "0", n.value.style.maxWidth = `${c}px`), x === void 0 && g === "min" && (n.value.style.width = "max-content", n.value.style.minWidth = `${c}px`, n.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
|
|
28
28
|
const z = Z(
|
|
29
29
|
t,
|
|
30
30
|
Q(n.value),
|
|
31
|
-
{ width: l, height:
|
|
31
|
+
{ width: l, height: d },
|
|
32
32
|
A(),
|
|
33
33
|
a,
|
|
34
34
|
i,
|
|
@@ -45,7 +45,7 @@ function re(v, n, e = {}) {
|
|
|
45
45
|
O += window.scrollX, M += window.scrollY;
|
|
46
46
|
}
|
|
47
47
|
L.value = {
|
|
48
|
-
...x !== void 0 ? { width: x, minWidth: "0" } : g === !0 ? { width: `${
|
|
48
|
+
...x !== void 0 ? { width: x, minWidth: "0" } : g === !0 ? { width: `${c}px`, minWidth: "0" } : g === "min" ? { width: "max-content", minWidth: `${c}px` } : {},
|
|
49
49
|
position: e.strategy ?? "fixed",
|
|
50
50
|
left: `${Math.round(O)}px`,
|
|
51
51
|
top: `${Math.round(M)}px`,
|
|
@@ -57,18 +57,18 @@ function re(v, n, e = {}) {
|
|
|
57
57
|
overscrollBehavior: "contain"
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function o() {
|
|
61
61
|
cancelAnimationFrame($), $ = requestAnimationFrame(F);
|
|
62
62
|
}
|
|
63
63
|
function I(t) {
|
|
64
64
|
var a, i;
|
|
65
|
-
!(r != null && r()) || e.closeOnOutside === !1 || !((a = v.value) != null && a.contains(t.target)) && !((i = n.value) != null && i.contains(t.target)) && u();
|
|
65
|
+
!(r != null && r()) || e.closeOnOutside === !1 || !((a = v.value) != null && a.contains(t.target)) && !((i = n.value) != null && i.contains(t.target)) && u(!1, !1, "outside");
|
|
66
66
|
}
|
|
67
67
|
function q(t) {
|
|
68
68
|
var a, i;
|
|
69
|
-
if (!(!
|
|
69
|
+
if (!(!s.value || !(r != null && r()))) {
|
|
70
70
|
if (t.key === "Escape" && e.closeOnEscape !== !1)
|
|
71
|
-
t.preventDefault(), t.stopImmediatePropagation(), u(!0);
|
|
71
|
+
t.preventDefault(), t.stopImmediatePropagation(), u(!0, !1, "escape");
|
|
72
72
|
else if (t.key === "Tab" && e.closeOnTab !== !1) {
|
|
73
73
|
const l = document.activeElement;
|
|
74
74
|
if ((a = v.value) != null && a.contains(l)) {
|
|
@@ -76,25 +76,25 @@ function re(v, n, e = {}) {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if ((i = n.value) != null && i.contains(l)) {
|
|
79
|
-
const
|
|
79
|
+
const d = Array.from(
|
|
80
80
|
n.value.querySelectorAll(
|
|
81
81
|
'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])'
|
|
82
82
|
)
|
|
83
83
|
).filter(
|
|
84
|
-
(
|
|
84
|
+
(c) => c.getClientRects().length && !c.closest("[inert]")
|
|
85
85
|
);
|
|
86
|
-
(!
|
|
86
|
+
(!d.length || l === (t.shiftKey ? d[0] : d.at(-1))) && u(!0);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
function B() {
|
|
92
92
|
var t, a;
|
|
93
|
-
document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", q, !0), window.removeEventListener("resize",
|
|
93
|
+
document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", q, !0), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", o), (a = window.visualViewport) == null || a.removeEventListener("scroll", o), cancelAnimationFrame($), w == null || w(), w = void 0, W.value = void 0, r = void 0;
|
|
94
94
|
}
|
|
95
|
-
function u(t = !1, a = !1) {
|
|
96
|
-
var
|
|
97
|
-
if (!(!a &&
|
|
95
|
+
function u(t = !1, a = !1, i) {
|
|
96
|
+
var l, d;
|
|
97
|
+
if (!(!a && s.value && ((l = e.requestOpen) == null ? void 0 : l.call(e, !1, t, i)) === !1) && (y++, !!s.value && (s.value = !1, B(), t && ((d = v.value) != null && d.isConnected)))) {
|
|
98
98
|
p.value = !0;
|
|
99
99
|
try {
|
|
100
100
|
v.value.focus();
|
|
@@ -104,29 +104,29 @@ function re(v, n, e = {}) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async function N(t = !1) {
|
|
107
|
-
var l,
|
|
107
|
+
var l, d, c;
|
|
108
108
|
if (k.value || (m == null ? void 0 : m.value) === !1) return;
|
|
109
|
-
if (
|
|
110
|
-
|
|
109
|
+
if (s.value) {
|
|
110
|
+
o();
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
if (!t && ((l = e.requestOpen) == null ? void 0 : l.call(e, !0)) === !1) return;
|
|
114
114
|
const a = ++y;
|
|
115
|
-
if (
|
|
115
|
+
if (s.value = !0, L.value = {
|
|
116
116
|
position: "fixed",
|
|
117
117
|
top: "0px",
|
|
118
118
|
left: "0px",
|
|
119
119
|
visibility: "hidden"
|
|
120
|
-
}, await G(), a !== y || !
|
|
120
|
+
}, await G(), a !== y || !s.value) return;
|
|
121
121
|
const i = ee(
|
|
122
122
|
"floating",
|
|
123
|
-
() => u(!0),
|
|
123
|
+
() => u(!0, !1, "escape"),
|
|
124
124
|
e.zIndex
|
|
125
125
|
);
|
|
126
|
-
W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", q, !0), window.addEventListener("resize",
|
|
126
|
+
W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", q, !0), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), (d = window.visualViewport) == null || d.addEventListener("resize", o), (c = window.visualViewport) == null || c.addEventListener("scroll", o);
|
|
127
127
|
}
|
|
128
128
|
function K() {
|
|
129
|
-
return
|
|
129
|
+
return s.value ? u() : N();
|
|
130
130
|
}
|
|
131
131
|
return D(
|
|
132
132
|
k,
|
|
@@ -143,7 +143,7 @@ function re(v, n, e = {}) {
|
|
|
143
143
|
), V(() => {
|
|
144
144
|
y++, B();
|
|
145
145
|
}), {
|
|
146
|
-
open:
|
|
146
|
+
open: s,
|
|
147
147
|
style: X(() => {
|
|
148
148
|
var t;
|
|
149
149
|
return {
|
|
@@ -157,7 +157,7 @@ function re(v, n, e = {}) {
|
|
|
157
157
|
close: u,
|
|
158
158
|
toggle: K,
|
|
159
159
|
restoringFocus: p,
|
|
160
|
-
schedule:
|
|
160
|
+
schedule: o,
|
|
161
161
|
isTop: () => (r == null ? void 0 : r()) ?? !1
|
|
162
162
|
};
|
|
163
163
|
}
|