hys-ui 0.3.0 → 0.5.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 +27 -0
- package/README.md +68 -73
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
- package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
- package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
- package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
- package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
- package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
- package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
- package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
- package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
- package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
- package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
- package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
- package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +327 -274
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -154
- package/dist/components/HysModal/HysModal.vue.js +3 -3
- package/dist/components/HysModal/HysModal2.vue.js +81 -80
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysTour/HysTour.vue.js +291 -67
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/composables/animatedNumberDigits.js +106 -0
- package/dist/composables/animatedNumberFormat.js +222 -0
- package/dist/composables/animatedNumberTiming.js +66 -0
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/useDialog.js +50 -50
- package/dist/composables/useFloating.js +107 -103
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/config.js +11 -11
- package/dist/index.js +183 -152
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
- package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
- package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
- package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
- package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
- package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
- package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
- package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
- package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
- package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
- package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
- package/dist/types/composables/animatedNumber.d.ts +220 -0
- package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
- package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
- package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/drawer.d.ts +1 -1
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/modal.d.ts +2 -0
- package/dist/types/composables/numberAnimation.d.ts +29 -0
- package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
- package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
- package/dist/types/composables/selectOptions.d.ts +5 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +116 -6
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +46 -1
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { defineComponent as $e, useId as De, ref as D, computed as p, watch as H, onMounted as Oe, onActivated as Be, onDeactivated as Ie, onBeforeUnmount as Le, openBlock as b, createElementBlock as w, mergeProps as x, unref as ee, Fragment as F, renderList as ve, createElementVNode as T, normalizeStyle as Ke, renderSlot as te, createTextVNode as He, toDisplayString as Ne, normalizeClass as je, createBlock as Ve, resolveDynamicComponent as We, createCommentVNode as ae, nextTick as J } from "vue";
|
|
2
|
+
import { ChevronUp as _e, ChevronRight as fe, ChevronLeft as de, ChevronDown as qe } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as Ue } from "../config.js";
|
|
4
|
+
import { paneRatio as N, fitPaneSizes as Fe, paneEpsilon as d } from "../composables/splitPaneSizes.js";
|
|
5
|
+
import { useSplitPaneDrag as Te } from "../composables/useSplitPaneDrag.js";
|
|
6
|
+
import { useSplitPaneStorage as Je, readStoredPaneSizes as Ge } from "../composables/useSplitPaneStorage.js";
|
|
7
|
+
const Qe = ["id", "data-hys-pane", "inert"], Xe = ["data-hys-separator"], Ye = ["tabindex", "aria-label", "aria-controls", "aria-disabled", "aria-orientation", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-keyshortcuts", "data-resizing", "onPointerdown", "onKeydown", "onDblclick"], Ze = {
|
|
8
|
+
class: "hys-ui-splitter-grip",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
}, xe = ["aria-label", "aria-controls", "aria-expanded", "data-collapsed", "disabled", "onClick"], et = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "hys-ui-splitter-preview",
|
|
13
|
+
"aria-hidden": "true"
|
|
14
|
+
}, nt = /* @__PURE__ */ $e({
|
|
15
|
+
__name: "MultiSplitPane",
|
|
16
|
+
props: {
|
|
17
|
+
panels: {},
|
|
18
|
+
sizes: {},
|
|
19
|
+
vertical: { type: Boolean },
|
|
20
|
+
disabled: { type: Boolean },
|
|
21
|
+
lazy: { type: Boolean },
|
|
22
|
+
step: {},
|
|
23
|
+
ariaLabel: {},
|
|
24
|
+
storageKey: {},
|
|
25
|
+
dividerSize: {},
|
|
26
|
+
doubleClickAction: {}
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:sizes", "panelResizeStart", "panelResize", "panelResizeEnd", "panelCollapse"],
|
|
29
|
+
setup(S, { expose: me, emit: pe }) {
|
|
30
|
+
const n = S, k = pe, he = Ue(), ye = De(), O = D(), v = D(0), C = D(!1), j = D(), V = D();
|
|
31
|
+
Je(
|
|
32
|
+
() => n.sizes === void 0 && n.storageKey ? n.storageKey + ":panels" : void 0,
|
|
33
|
+
j,
|
|
34
|
+
Ge
|
|
35
|
+
);
|
|
36
|
+
const B = D(), u = p(() => {
|
|
37
|
+
const e = /* @__PURE__ */ new Set();
|
|
38
|
+
return n.panels.filter((t) => e.has(t.id) ? !1 : (e.add(t.id), !0));
|
|
39
|
+
}), f = p(() => u.value.map((e) => e.id)), I = (e) => `${ye}-${e}`, P = p(() => Math.max(0, u.value.length - 1)), W = p(() => {
|
|
40
|
+
const e = n.sizes ?? j.value;
|
|
41
|
+
return u.value.map((t) => e && Object.hasOwn(e, t.id) ? e[t.id] : t.size);
|
|
42
|
+
}), g = p(() => u.value.map((e) => {
|
|
43
|
+
const t = Math.min(100, N(e.min, v.value) ?? 0);
|
|
44
|
+
return { min: t, max: Math.max(t, Math.min(100, N(e.max, v.value) ?? 100)) };
|
|
45
|
+
})), r = p(() => Fe(u.value.map((e, t) => {
|
|
46
|
+
const a = W.value[t], i = N(a, v.value);
|
|
47
|
+
return i === 0 && e.collapsible ? { preferred: i, min: 0, max: 0 } : { ...g.value[t], preferred: i, relative: typeof a == "string" && a.endsWith("%") };
|
|
48
|
+
}))), be = p(() => u.value.filter((e, t) => e.collapsible && r.value[t] <= d).map((e) => e.id)), _ = (e) => e * v.value / 100, G = (e, t) => typeof t == "number" ? _(e) : t != null && t.endsWith("px") ? `${_(e)}px` : `${e}%`, q = /* @__PURE__ */ new Map();
|
|
49
|
+
H(
|
|
50
|
+
() => f.value.map((e, t) => ({ key: e, ratio: r.value[t], length: W.value[t] })),
|
|
51
|
+
(e) => {
|
|
52
|
+
for (const t of e)
|
|
53
|
+
t.ratio > d && q.set(t.key, v.value > 0 ? G(t.ratio, t.length) : t.length ?? G(t.ratio, void 0));
|
|
54
|
+
for (const t of q.keys())
|
|
55
|
+
f.value.includes(t) || q.delete(t);
|
|
56
|
+
},
|
|
57
|
+
{ immediate: !0 }
|
|
58
|
+
), H(be, (e, t) => {
|
|
59
|
+
for (const a of t) !e.includes(a) && f.value.includes(a) && k("panelCollapse", a, !1);
|
|
60
|
+
for (const a of e) t.includes(a) || k("panelCollapse", a, !0);
|
|
61
|
+
});
|
|
62
|
+
function Q(e, t) {
|
|
63
|
+
return e.length === t.length && e.every((a, i) => Math.abs(a - t[i]) <= d);
|
|
64
|
+
}
|
|
65
|
+
function L(e) {
|
|
66
|
+
if (Q(e, r.value)) return;
|
|
67
|
+
const t = Object.fromEntries(f.value.map((a, i) => [a, G(e[i], W.value[i])]));
|
|
68
|
+
n.sizes === void 0 && (j.value = t), k("update:sizes", t);
|
|
69
|
+
}
|
|
70
|
+
function le(e = r.value) {
|
|
71
|
+
return Object.fromEntries(f.value.map((t, a) => [t, _(e[a])]));
|
|
72
|
+
}
|
|
73
|
+
function X(e, t, a, i = r.value) {
|
|
74
|
+
return { separator: e, before: t, after: a, sizes: le(i) };
|
|
75
|
+
}
|
|
76
|
+
function K(e, t, a) {
|
|
77
|
+
const i = [...e];
|
|
78
|
+
return i[t + 1] = Math.max(0, e[t] + e[t + 1] - a), i[t] = a, i;
|
|
79
|
+
}
|
|
80
|
+
function R(e) {
|
|
81
|
+
const t = r.value[e], a = t + r.value[e + 1], i = g.value[e], s = g.value[e + 1], l = Math.max(i.min, a - s.max), o = Math.min(i.max, a - s.min);
|
|
82
|
+
return l > o ? { min: t, max: t } : { min: l, max: o };
|
|
83
|
+
}
|
|
84
|
+
function A(e) {
|
|
85
|
+
var i, s;
|
|
86
|
+
if (n.disabled || ((i = u.value[e]) == null ? void 0 : i.resizable) === !1 || ((s = u.value[e + 1]) == null ? void 0 : s.resizable) === !1) return !1;
|
|
87
|
+
const { min: t, max: a } = R(e);
|
|
88
|
+
return a - t > d;
|
|
89
|
+
}
|
|
90
|
+
function Y(e, t) {
|
|
91
|
+
var z;
|
|
92
|
+
if (n.disabled || !((z = u.value[e]) != null && z.collapsible) || t < 0 || t >= P.value || t !== e && t !== e - 1) return;
|
|
93
|
+
const a = t === e ? e + 1 : e - 1, i = r.value[e], s = i + r.value[a];
|
|
94
|
+
if (i > d) return s <= g.value[a].max + d ? 0 : void 0;
|
|
95
|
+
const l = Math.max(g.value[e].min, s - g.value[a].max), o = Math.min(g.value[e].max, s - g.value[a].min);
|
|
96
|
+
if (o < l || o <= d) return;
|
|
97
|
+
const c = N(q.get(f.value[e]) ?? u.value[e].size, v.value) || s / 2;
|
|
98
|
+
return Math.min(o, Math.max(l, c));
|
|
99
|
+
}
|
|
100
|
+
async function E(e, t) {
|
|
101
|
+
if (v.value <= 0) return !1;
|
|
102
|
+
const a = f.value.indexOf(e), i = t === void 0 ? [a, a - 1] : [t];
|
|
103
|
+
for (const s of i) {
|
|
104
|
+
const l = Y(a, s);
|
|
105
|
+
if (l === void 0) continue;
|
|
106
|
+
const o = r.value[a] <= d, c = r.value[s] + r.value[s + 1];
|
|
107
|
+
m.finish(!0), L(K(r.value, s, a === s ? l : c - l)), await J();
|
|
108
|
+
const z = f.value.indexOf(e);
|
|
109
|
+
return z >= 0 && o !== r.value[z] <= d;
|
|
110
|
+
}
|
|
111
|
+
return !1;
|
|
112
|
+
}
|
|
113
|
+
async function ie() {
|
|
114
|
+
return n.disabled ? !1 : (m.finish(!0), n.sizes === void 0 && (j.value = void 0), k("update:sizes", {}), await J(), u.value.every((e, t) => e.size === W.value[t]));
|
|
115
|
+
}
|
|
116
|
+
async function ge(e, t, a) {
|
|
117
|
+
if (v.value <= 0) return !1;
|
|
118
|
+
const i = f.value.indexOf(e), s = N(t, v.value);
|
|
119
|
+
if (i < 0 || s === void 0) return !1;
|
|
120
|
+
const l = r.value[i];
|
|
121
|
+
if (s === 0 && u.value[i].collapsible)
|
|
122
|
+
return l > d ? E(e, a) : !1;
|
|
123
|
+
const o = a === void 0 ? [i, i - 1] : [a];
|
|
124
|
+
let c;
|
|
125
|
+
for (const y of o) {
|
|
126
|
+
if (y < 0 || y >= P.value || y !== i && y !== i - 1 || !A(y)) continue;
|
|
127
|
+
const Re = r.value[y] + r.value[y + 1], re = y === i ? s : Re - s, { min: Ae, max: Ee } = R(y), ue = Math.min(Ee, Math.max(Ae, re)), ce = Math.abs(ue - re);
|
|
128
|
+
(!c || ce < c.distance) && (c = { bar: y, first: ue, distance: ce });
|
|
129
|
+
}
|
|
130
|
+
if (!c) return !1;
|
|
131
|
+
m.finish(!0), L(K(r.value, c.bar, c.first)), await J();
|
|
132
|
+
const z = f.value.indexOf(e);
|
|
133
|
+
return z >= 0 && Math.abs(r.value[z] - l) > d;
|
|
134
|
+
}
|
|
135
|
+
function Z(e) {
|
|
136
|
+
const t = [e, e + 1].filter((a) => Y(a, e) !== void 0);
|
|
137
|
+
return t.find((a) => r.value[a] <= d) ?? t[0];
|
|
138
|
+
}
|
|
139
|
+
function oe(e) {
|
|
140
|
+
const t = Z(e);
|
|
141
|
+
if (t !== void 0) return E(f.value[t], e);
|
|
142
|
+
}
|
|
143
|
+
function ze(e) {
|
|
144
|
+
n.doubleClickAction === "reset" ? ie() : n.doubleClickAction === "collapse" && oe(e);
|
|
145
|
+
}
|
|
146
|
+
function we(e) {
|
|
147
|
+
var a;
|
|
148
|
+
const t = f.value.indexOf(e);
|
|
149
|
+
return t >= 0 ? ((a = O.value) == null ? void 0 : a.ownerDocument.getElementById(I(t))) ?? void 0 : void 0;
|
|
150
|
+
}
|
|
151
|
+
const $ = p(() => u.value.map((e, t) => ({
|
|
152
|
+
panel: e,
|
|
153
|
+
index: t,
|
|
154
|
+
size: _(r.value[t]),
|
|
155
|
+
collapsed: r.value[t] <= d,
|
|
156
|
+
toggle: () => E(e.id)
|
|
157
|
+
})));
|
|
158
|
+
let M;
|
|
159
|
+
function U() {
|
|
160
|
+
const e = O.value;
|
|
161
|
+
if (!e) return;
|
|
162
|
+
const t = e.getBoundingClientRect(), a = e.querySelector(":scope > .hys-ui-splitter-bar"), i = n.vertical ? e.clientHeight || t.height : e.clientWidth || t.width, s = (n.vertical ? a == null ? void 0 : a.offsetHeight : a == null ? void 0 : a.offsetWidth) || n.dividerSize;
|
|
163
|
+
v.value = Math.max(0, i - s * P.value), C.value = getComputedStyle(e).direction === "rtl";
|
|
164
|
+
}
|
|
165
|
+
function se() {
|
|
166
|
+
M || !O.value || (U(), typeof ResizeObserver == "function" && (M = new ResizeObserver(U), M.observe(O.value)));
|
|
167
|
+
}
|
|
168
|
+
function ne() {
|
|
169
|
+
m.finish(!0, !1), M == null || M.disconnect(), M = void 0;
|
|
170
|
+
}
|
|
171
|
+
const ke = p(() => n.vertical ? _e : C.value ? fe : de), Me = p(() => n.vertical ? qe : C.value ? de : fe);
|
|
172
|
+
let h;
|
|
173
|
+
const m = Te(
|
|
174
|
+
(e) => {
|
|
175
|
+
if (!h) return;
|
|
176
|
+
const { separator: t, before: a, after: i, initial: s } = h, l = K(s, t, e);
|
|
177
|
+
n.lazy ? B.value = { separator: t, ratio: l.slice(0, t + 1).reduce((o, c) => o + c, 0) } : (h.requested = l, L(l)), k("panelResize", X(t, a, i, l));
|
|
178
|
+
},
|
|
179
|
+
(e, t, a) => {
|
|
180
|
+
if (!h) return;
|
|
181
|
+
const { separator: i, before: s, after: l, initial: o } = h;
|
|
182
|
+
h = void 0, V.value = void 0, B.value = void 0, !t && n.lazy && L(K(o, i, e)), a && J(() => k("panelResizeEnd", { ...X(i, s, l), cancelled: t }));
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
function Se(e, t) {
|
|
186
|
+
if (m.active() || e.button !== 0 || (U(), !A(t))) return;
|
|
187
|
+
const a = r.value, { min: i, max: s } = R(t);
|
|
188
|
+
if (!m.start(e, {
|
|
189
|
+
vertical: n.vertical,
|
|
190
|
+
available: v.value,
|
|
191
|
+
direction: !n.vertical && C.value ? -1 : 1,
|
|
192
|
+
initial: a[t],
|
|
193
|
+
constrain: (c) => Math.min(s, Math.max(i, c))
|
|
194
|
+
})) return;
|
|
195
|
+
const [l, o] = f.value.slice(t, t + 2);
|
|
196
|
+
h = { separator: t, before: l, after: o, initial: a }, V.value = t, k("panelResizeStart", X(t, l, o));
|
|
197
|
+
}
|
|
198
|
+
function Ce(e, t) {
|
|
199
|
+
if (e.key === "Enter" && !m.active() && Z(t) !== void 0) {
|
|
200
|
+
e.preventDefault(), oe(t);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (m.active() || !A(t) || v.value <= 0 || !["ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "Home", "End"].includes(e.key)) return;
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
const { min: a, max: i } = R(t), s = (Number.isFinite(n.step) && n.step > 0 ? n.step : 2) * (e.shiftKey ? 5 : 1), l = e.key === "ArrowDown" || e.key === (C.value && !n.vertical ? "ArrowLeft" : "ArrowRight"), o = e.key === "Home" ? a : e.key === "End" ? i : Math.min(i, Math.max(a, r.value[t] + (l ? s : -s)));
|
|
206
|
+
L(K(r.value, t, o));
|
|
207
|
+
}
|
|
208
|
+
const Pe = p(() => JSON.stringify(u.value.map((e) => [e.id, e.min, e.max, e.resizable, e.collapsible])));
|
|
209
|
+
return H([Pe, v, C, () => n.disabled, () => n.lazy, () => n.vertical], () => m.finish(!0), { flush: "sync" }), H(r, (e, t) => {
|
|
210
|
+
h && !Q(e, t) && !Q(e, h.requested ?? h.initial) && m.finish(!0);
|
|
211
|
+
}, { flush: "post" }), H([P, () => n.vertical, () => n.dividerSize], U, { flush: "post" }), Oe(se), Be(se), Ie(ne), Le(ne), me({ togglePane: E, getPanelSizes: le, getPaneElement: we, resizePane: ge, resetSizes: ie }), (e, t) => {
|
|
212
|
+
var a, i;
|
|
213
|
+
return b(), w("div", x({
|
|
214
|
+
ref_key: "host",
|
|
215
|
+
ref: O
|
|
216
|
+
}, ee(he), {
|
|
217
|
+
class: ["hys-ui-ent-split hys-ui-multi-split", { "hys-ui-vertical": S.vertical }],
|
|
218
|
+
style: {
|
|
219
|
+
"--hys-ui-splitter-size": S.dividerSize + "px",
|
|
220
|
+
"--hys-ui-divider-count": P.value,
|
|
221
|
+
"--hys-ui-split-preview": (((a = B.value) == null ? void 0 : a.ratio) ?? 0) / 100,
|
|
222
|
+
"--hys-ui-preview-bar": (((i = B.value) == null ? void 0 : i.separator) ?? 0) + 0.5
|
|
223
|
+
}
|
|
224
|
+
}), [
|
|
225
|
+
(b(!0), w(F, null, ve($.value, (s, l) => (b(), w(F, {
|
|
226
|
+
key: s.panel.id
|
|
227
|
+
}, [
|
|
228
|
+
T("div", {
|
|
229
|
+
id: I(l),
|
|
230
|
+
class: "hys-ui-splitter-pane",
|
|
231
|
+
"data-hys-pane": s.panel.id,
|
|
232
|
+
inert: s.collapsed,
|
|
233
|
+
style: Ke({ "--hys-ui-split-ratio": r.value[l] / 100 })
|
|
234
|
+
}, [
|
|
235
|
+
te(e.$slots, "panel", x({ ref_for: !0 }, s), () => [
|
|
236
|
+
He(Ne(s.panel.label), 1)
|
|
237
|
+
])
|
|
238
|
+
], 12, Qe),
|
|
239
|
+
l < P.value ? (b(), w("div", {
|
|
240
|
+
key: 0,
|
|
241
|
+
class: "hys-ui-splitter-bar",
|
|
242
|
+
"data-hys-separator": l
|
|
243
|
+
}, [
|
|
244
|
+
T("div", {
|
|
245
|
+
class: "hys-ui-ent-split-handle",
|
|
246
|
+
role: "separator",
|
|
247
|
+
tabindex: A(l) ? 0 : -1,
|
|
248
|
+
"aria-label": `${S.ariaLabel} ${l + 1}`,
|
|
249
|
+
"aria-controls": `${I(l)} ${I(l + 1)}`,
|
|
250
|
+
"aria-disabled": !A(l) || void 0,
|
|
251
|
+
"aria-orientation": S.vertical ? "horizontal" : "vertical",
|
|
252
|
+
"aria-valuenow": r.value[l],
|
|
253
|
+
"aria-valuemin": Math.min(r.value[l], R(l).min),
|
|
254
|
+
"aria-valuemax": Math.max(r.value[l], R(l).max),
|
|
255
|
+
"aria-keyshortcuts": Z(l) === void 0 ? void 0 : "Enter",
|
|
256
|
+
"data-resizing": V.value === l || void 0,
|
|
257
|
+
onPointerdown: (o) => Se(o, l),
|
|
258
|
+
onLostpointercapture: t[0] || (t[0] = //@ts-ignore
|
|
259
|
+
(...o) => ee(m).cancel && ee(m).cancel(...o)),
|
|
260
|
+
onKeydown: (o) => Ce(o, l),
|
|
261
|
+
onDblclick: (o) => ze(l)
|
|
262
|
+
}, [
|
|
263
|
+
T("span", Ze, [
|
|
264
|
+
te(e.$slots, "handle", {
|
|
265
|
+
separator: l,
|
|
266
|
+
before: s.panel.id,
|
|
267
|
+
after: u.value[l + 1].id,
|
|
268
|
+
vertical: S.vertical,
|
|
269
|
+
disabled: !A(l),
|
|
270
|
+
resizing: V.value === l
|
|
271
|
+
}, () => [
|
|
272
|
+
t[1] || (t[1] = T("span", { class: "hys-ui-splitter-dots" }, null, -1))
|
|
273
|
+
])
|
|
274
|
+
])
|
|
275
|
+
], 40, Ye),
|
|
276
|
+
(b(!0), w(F, null, ve([l, l + 1], (o) => (b(), w(F, { key: o }, [
|
|
277
|
+
u.value[o].collapsible ? (b(), w("button", {
|
|
278
|
+
key: 0,
|
|
279
|
+
class: je(["hys-ui-splitter-toggle", o === l ? "hys-ui-splitter-toggle-first" : "hys-ui-splitter-toggle-second"]),
|
|
280
|
+
type: "button",
|
|
281
|
+
"aria-label": ($.value[o].collapsed ? "展开" : "折叠") + (u.value[o].label ?? u.value[o].id),
|
|
282
|
+
"aria-controls": I(o),
|
|
283
|
+
"aria-expanded": !$.value[o].collapsed,
|
|
284
|
+
"data-collapsed": $.value[o].collapsed || void 0,
|
|
285
|
+
disabled: Y(o, l) === void 0,
|
|
286
|
+
onClick: (c) => E(u.value[o].id, l)
|
|
287
|
+
}, [
|
|
288
|
+
te(e.$slots, "panel-collapse", x({ ref_for: !0 }, $.value[o], {
|
|
289
|
+
side: o === l ? "start" : "end",
|
|
290
|
+
toggle: () => E(u.value[o].id, l)
|
|
291
|
+
}), () => [
|
|
292
|
+
(b(), Ve(We(o === l !== $.value[o].collapsed ? ke.value : Me.value), { size: 13 }))
|
|
293
|
+
])
|
|
294
|
+
], 10, xe)) : ae("", !0)
|
|
295
|
+
], 64))), 128))
|
|
296
|
+
], 8, Xe)) : ae("", !0)
|
|
297
|
+
], 64))), 128)),
|
|
298
|
+
B.value ? (b(), w("div", et)) : ae("", !0)
|
|
299
|
+
], 16);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
export {
|
|
304
|
+
nt as default
|
|
305
|
+
};
|