hys-ui 0.4.0 → 0.6.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 +13 -0
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +3 -3
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +440 -119
- 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/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
- 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/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +38 -38
- package/dist/components/HysSearch/HysSearch.vue.js +2 -2
- package/dist/components/HysSortableList/HysSortableList.vue.js +2 -2
- package/dist/components/HysSortableList/HysSortableList2.vue.js +498 -129
- package/dist/components/HysSortableList/SortableGhost/SortableGhost.vue.js +7 -0
- package/dist/components/HysSortableList/SortableGhost/SortableGhost2.vue.js +43 -0
- package/dist/components/HysSortableList/SortableGhost/useSortGhost.js +54 -0
- package/dist/components/HysSortableList/geometry.js +230 -0
- package/dist/components/HysSortableList/model.js +254 -0
- package/dist/components/HysSortableList/transactions.js +281 -0
- package/dist/components/HysSortableList/useSortDrag.js +270 -0
- package/dist/components/HysSortableList/useSortKeyboard.js +72 -0
- package/dist/components/HysSortableList/useSortWindow.js +144 -0
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysToast/HysToast.vue.js +3 -3
- package/dist/components/HysToast/HysToast2.vue.js +379 -107
- package/dist/components/HysToast/ToastViewport/ToastViewport.vue.js +7 -0
- package/dist/components/HysToast/ToastViewport/ToastViewport2.vue.js +211 -0
- package/dist/components/HysToast/ToastViewport/useToastStackDisclosure.js +71 -0
- package/dist/components/HysToast/toastPresentation.js +98 -0
- package/dist/components/HysToast/useToastActions.js +62 -0
- package/dist/components/HysToast/useToastSwipe.js +48 -0
- package/dist/components/HysToast/useToastTimer.js +90 -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/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/popupReferenceBinding.js +41 -0
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/toastEscape.js +18 -10
- package/dist/composables/toastQueue.js +276 -0
- package/dist/composables/toastQueueModel.js +86 -0
- package/dist/composables/toastTasks.js +58 -0
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useHysToast.js +117 -135
- package/dist/composables/usePopupSurface.js +190 -356
- package/dist/composables/usePopupSurfaceInteractions.js +172 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/index.js +125 -111
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +88 -49
- 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 +11 -2
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- 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 +2 -2
- package/dist/types/components/HysColorPicker/HysColorPicker.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 +5 -5
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- 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/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +1 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +48 -25
- package/dist/types/components/HysSortableList/SortableGhost/SortableGhost.vue.d.ts +31 -0
- package/dist/types/components/HysSortableList/SortableGhost/useSortGhost.d.ts +23 -0
- package/dist/types/components/HysSortableList/geometry.d.ts +35 -0
- package/dist/types/components/HysSortableList/model.d.ts +61 -0
- package/dist/types/components/HysSortableList/sortableList.d.ts +151 -0
- package/dist/types/components/HysSortableList/transactions.d.ts +10 -0
- package/dist/types/components/HysSortableList/useSortDrag.d.ts +25 -0
- package/dist/types/components/HysSortableList/useSortKeyboard.d.ts +17 -0
- package/dist/types/components/HysSortableList/useSortWindow.d.ts +16 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- 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 +44 -46
- package/dist/types/components/HysToast/ToastViewport/ToastViewport.vue.d.ts +25 -0
- package/dist/types/components/HysToast/ToastViewport/useToastStackDisclosure.d.ts +16 -0
- package/dist/types/components/HysToast/toastPresentation.d.ts +8 -0
- package/dist/types/components/HysToast/toastTypes.d.ts +212 -0
- package/dist/types/components/HysToast/useToastActions.d.ts +18 -0
- package/dist/types/components/HysToast/useToastSwipe.d.ts +11 -0
- package/dist/types/components/HysToast/useToastTimer.d.ts +22 -0
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +1 -1
- 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/drawer.d.ts +1 -1
- 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/popupReferenceBinding.d.ts +9 -0
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/toastEscape.d.ts +1 -1
- package/dist/types/composables/toastQueue.d.ts +121 -0
- package/dist/types/composables/toastQueueModel.d.ts +116 -0
- package/dist/types/composables/toastTasks.d.ts +2 -0
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useHysToast.d.ts +4 -48
- package/dist/types/composables/usePopupSurface.d.ts +20 -20
- package/dist/types/composables/usePopupSurfaceInteractions.d.ts +33 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/index.d.ts +15 -6
- package/package.json +1 -1
|
@@ -1,145 +1,514 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { defineComponent as _e, useId as Fe, useTemplateRef as X, shallowRef as O, computed as n, onMounted as Ue, onActivated as We, onDeactivated as qe, onBeforeUnmount as Je, watch as Se, openBlock as r, createElementBlock as T, mergeProps as P, unref as o, createElementVNode as V, normalizeStyle as Y, normalizeClass as R, createBlock as d, resolveDynamicComponent as v, withCtx as f, renderSlot as $, createCommentVNode as y, createVNode as Z, TransitionGroup as Qe, Fragment as Ce, renderList as Xe, withModifiers as De, createTextVNode as j, toDisplayString as L, Teleport as Ye, normalizeProps as Ze, guardReactiveProps as et, nextTick as tt } from "vue";
|
|
2
|
+
import { GripVertical as at, ChevronLeft as lt, ChevronUp as ot, ChevronRight as st, ChevronDown as nt } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as rt } from "../../config.js";
|
|
4
|
+
import { useMotion as it } from "../../motion/useMotion.js";
|
|
5
|
+
import { wholeRowDrag as ut, candidateAt as dt } from "./geometry.js";
|
|
6
|
+
import { buildSortIndex as ct, keyToken as ee, sortPorts as vt, registerSortPort as ft, feedback as yt } from "./model.js";
|
|
7
|
+
import { restoreStoredSort as ht, discardSortHistory as mt, resetSort as bt, navigateHistory as xe, keysArray as gt } from "./transactions.js";
|
|
8
|
+
import { useSortDrag as pt } from "./useSortDrag.js";
|
|
9
|
+
import { useSortWindow as kt } from "./useSortWindow.js";
|
|
10
|
+
import St from "./SortableGhost/SortableGhost.vue.js";
|
|
11
|
+
const Ct = ["data-drop-state", "aria-busy"], Dt = ["colspan"], xt = ["checked", "disabled", "aria-label", "onClick"], Bt = ["disabled", "aria-label"], Kt = { class: "hys-sort-actions" }, Tt = ["disabled", "aria-label", "onClick"], $t = ["disabled", "aria-label", "onClick"], wt = ["colspan"], zt = {
|
|
12
|
+
class: "hys-sort-sr",
|
|
6
13
|
role: "status"
|
|
7
|
-
},
|
|
14
|
+
}, Rt = /* @__PURE__ */ _e({
|
|
8
15
|
__name: "HysSortableList",
|
|
9
16
|
props: {
|
|
10
17
|
modelValue: {},
|
|
11
|
-
|
|
18
|
+
defaultItems: {},
|
|
19
|
+
itemKey: {},
|
|
20
|
+
itemLabel: {},
|
|
21
|
+
listId: {},
|
|
22
|
+
ariaLabel: { default: "可排序列表" },
|
|
23
|
+
layout: { default: "vertical" },
|
|
24
|
+
mode: { default: "insert" },
|
|
25
|
+
disabled: { type: Boolean },
|
|
26
|
+
itemDisabled: {},
|
|
27
|
+
fixed: {},
|
|
28
|
+
handle: { type: [Boolean, String], default: !0 },
|
|
29
|
+
showButtons: { type: Boolean, default: !0 },
|
|
30
|
+
keyboard: { type: Boolean, default: !0 },
|
|
31
|
+
dragDelay: { default: 0 },
|
|
32
|
+
touchDelay: { default: 180 },
|
|
33
|
+
dragThreshold: { default: 5 },
|
|
34
|
+
axis: { default: "both" },
|
|
35
|
+
bounds: {},
|
|
36
|
+
snap: { type: Boolean },
|
|
37
|
+
livePreview: { type: Boolean, default: !0 },
|
|
38
|
+
group: {},
|
|
39
|
+
maxItems: {},
|
|
40
|
+
selectable: { type: Boolean },
|
|
41
|
+
selectedKeys: {},
|
|
42
|
+
defaultSelectedKeys: {},
|
|
43
|
+
clone: {},
|
|
44
|
+
canDrag: {},
|
|
45
|
+
canDrop: {},
|
|
46
|
+
resolveIndex: {},
|
|
47
|
+
beforeDrop: {},
|
|
48
|
+
save: {},
|
|
49
|
+
history: { type: [Boolean, Number], default: !0 },
|
|
50
|
+
storageKey: {},
|
|
51
|
+
autoScroll: { type: [Boolean, Object], default: !0 },
|
|
52
|
+
virtual: { type: [Boolean, Object] },
|
|
53
|
+
listTag: { default: "div" },
|
|
54
|
+
tableColumns: {},
|
|
55
|
+
motion: { type: Boolean, default: !0 },
|
|
56
|
+
animationDuration: { default: 180 },
|
|
57
|
+
animationEasing: { default: "ease" },
|
|
58
|
+
moveClass: {},
|
|
59
|
+
ghostClass: {},
|
|
60
|
+
ghostStyle: { type: [Boolean, null, String, Object, Array] },
|
|
61
|
+
showHandle: { type: Boolean, default: !0 }
|
|
12
62
|
},
|
|
13
|
-
emits: ["update:modelValue"],
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
emits: ["update:modelValue", "update:selectedKeys", "start", "preview", "change", "cancel", "invalid", "conflict", "save-error"],
|
|
64
|
+
setup(c, { expose: Be, emit: Ke }) {
|
|
65
|
+
const l = c, k = Ke, te = rt(), { effectiveMotion: Te } = it(), ae = Fe(), le = `${ae}-sort-help`, D = X("root"), oe = X("viewport"), A = X("surface"), G = O(
|
|
66
|
+
l.modelValue ?? l.defaultItems ?? []
|
|
67
|
+
), $e = G.value.slice(), se = O(
|
|
68
|
+
l.defaultSelectedKeys ?? []
|
|
69
|
+
), x = O(!1), _ = O(""), B = n(() => l.modelValue ?? G.value), M = n(() => l.motion && Te.value !== "off"), i = n(() => l.listTag === "table"), H = n(
|
|
70
|
+
() => i.value ? "tr" : l.listTag === "ul" || l.listTag === "ol" ? "li" : "div"
|
|
71
|
+
), I = n(() => i.value ? "td" : "div"), ne = n(() => l.showHandle !== !1), re = n(() => ne.value || l.selectable), F = n(
|
|
72
|
+
() => l.tableColumns ?? 1 + Number(re.value) + Number(l.showButtons)
|
|
73
|
+
), K = n(
|
|
74
|
+
() => l.layout === "horizontal" && !i.value
|
|
75
|
+
), U = n(() => l.layout === "grid" && !i.value);
|
|
76
|
+
function S(e) {
|
|
77
|
+
return typeof l.itemKey == "function" ? l.itemKey(e) : e[l.itemKey ?? "id"];
|
|
78
|
+
}
|
|
79
|
+
function C(e) {
|
|
80
|
+
const a = typeof l.itemLabel == "function" ? l.itemLabel(e) : e[l.itemLabel ?? "label"];
|
|
81
|
+
return String(a ?? S(e) ?? "");
|
|
82
|
+
}
|
|
83
|
+
const m = n(() => ct(B.value, S, l.fixed)), ie = n(
|
|
84
|
+
() => new Map(m.value.fixed.map((e) => [e.key, e.placement]))
|
|
85
|
+
), we = n(
|
|
86
|
+
() => new Set(typeof l.itemDisabled == "function" ? [] : l.itemDisabled)
|
|
87
|
+
), N = n(
|
|
88
|
+
() => new Set(
|
|
89
|
+
(l.selectedKeys ?? se.value).filter(
|
|
90
|
+
(e) => m.value.keys.has(e)
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
let W;
|
|
95
|
+
function ze(e) {
|
|
96
|
+
l.modelValue === void 0 && (G.value = e), k("update:modelValue", e);
|
|
97
|
+
}
|
|
98
|
+
function ue(e) {
|
|
99
|
+
if (!l.selectable) return;
|
|
100
|
+
const a = Array.from(new Set(e)).filter(
|
|
101
|
+
(t) => m.value.keys.has(t)
|
|
102
|
+
);
|
|
103
|
+
l.selectedKeys === void 0 && (se.value = a), k("update:selectedKeys", a);
|
|
52
104
|
}
|
|
53
|
-
function
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
105
|
+
function Ve(e, a) {
|
|
106
|
+
if (!l.selectable || l.disabled || x.value) return;
|
|
107
|
+
const t = new Set(N.value), s = W === void 0 ? void 0 : m.value.keys.get(W), u = m.value.keys.get(e);
|
|
108
|
+
if (a != null && a.shiftKey && s !== void 0 && u !== void 0)
|
|
109
|
+
for (let p = Math.min(s, u); p <= Math.max(s, u); p++) {
|
|
110
|
+
const h = B.value[p];
|
|
111
|
+
me(h, p) || t.add(S(h));
|
|
58
112
|
}
|
|
59
|
-
|
|
113
|
+
else
|
|
114
|
+
t.has(e) ? t.delete(e) : t.add(e), W = e;
|
|
115
|
+
ue([...t]);
|
|
116
|
+
}
|
|
117
|
+
function q(e) {
|
|
118
|
+
var t;
|
|
119
|
+
const a = ee(e);
|
|
120
|
+
return Array.from(((t = A.value) == null ? void 0 : t.children) ?? []).find(
|
|
121
|
+
(s) => s instanceof HTMLElement && s.dataset.sortKey === a
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function de(e) {
|
|
125
|
+
_.value = e.message, e.reason === "cancelled" ? k("cancel", e) : e.reason === "save" ? k("save-error", e) : e.reason === "conflict" ? k("conflict", e) : k("invalid", e);
|
|
126
|
+
}
|
|
127
|
+
const b = {
|
|
128
|
+
id: () => l.listId ?? ae,
|
|
129
|
+
props: l,
|
|
130
|
+
key: S,
|
|
131
|
+
label: C,
|
|
132
|
+
row: q,
|
|
133
|
+
apply: ze,
|
|
134
|
+
focus: be,
|
|
135
|
+
scroll: Q,
|
|
136
|
+
reject: de,
|
|
137
|
+
root: () => D.value ?? void 0,
|
|
138
|
+
surface: () => A.value ?? void 0,
|
|
139
|
+
data: () => m.value,
|
|
140
|
+
lock: (e) => {
|
|
141
|
+
x.value = e;
|
|
142
|
+
},
|
|
143
|
+
start: (e) => k("start", e),
|
|
144
|
+
preview: (e) => k("preview", e),
|
|
145
|
+
change: (e) => k("change", e),
|
|
146
|
+
announce: (e) => {
|
|
147
|
+
_.value = e;
|
|
60
148
|
}
|
|
149
|
+
}, g = pt(
|
|
150
|
+
b,
|
|
151
|
+
(e) => N.value.has(e) ? [...N.value] : [e],
|
|
152
|
+
() => M.value
|
|
153
|
+
), { own: E, over: Ie, ghost: ce, anchorForDisplay: Pe } = g, J = n(() => {
|
|
154
|
+
const e = E.value, a = e == null ? void 0 : e.result;
|
|
155
|
+
return l.livePreview && !(l.virtual && (e == null ? void 0 : e.drag.source) === "keyboard") && a && !("reason" in a) && a.target === b ? a.changes[0].next : B.value;
|
|
156
|
+
}), { visibleItems: Le, range: w, length: Ae, columns: ve, reveal: Me, syncPosition: fe } = kt(l, J, oe, A, S), He = n(() => {
|
|
157
|
+
var e;
|
|
158
|
+
return new Set(((e = E.value) == null ? void 0 : e.drag.keys) ?? []);
|
|
159
|
+
}), ye = n(() => {
|
|
160
|
+
var a;
|
|
161
|
+
const e = (a = Ie.value) == null ? void 0 : a.result;
|
|
162
|
+
return e ? "reason" in e ? e.reason === "noop" ? void 0 : "invalid" : "allowed" : void 0;
|
|
163
|
+
}), he = n(
|
|
164
|
+
() => ye.value === "allowed" ? Pe.value : void 0
|
|
165
|
+
), Ne = n(() => ({
|
|
166
|
+
"--hys-sort-duration": `${Math.max(0, l.animationDuration)}ms`,
|
|
167
|
+
"--hys-sort-easing": l.animationEasing,
|
|
168
|
+
"--hys-sort-virtual-columns": ve.value
|
|
169
|
+
})), Ee = n(() => {
|
|
170
|
+
if (l.disabled) return "排序已禁用。";
|
|
171
|
+
if (!l.keyboard) return "拖动项目调整顺序。";
|
|
172
|
+
const e = K.value ? "左右方向键" : U.value ? "方向键" : "上下方向键";
|
|
173
|
+
return `按空格拾起或放置,用${e}移动,Escape 取消。也可按 Alt 加${e}直接排序。${l.group ? "拾起后按 Ctrl 加方向键切换列表。" : ""}`;
|
|
174
|
+
});
|
|
175
|
+
function me(e, a) {
|
|
176
|
+
var s;
|
|
177
|
+
if (l.disabled || !m.value.valid || ie.value.has(S(e)) || (typeof l.itemDisabled == "function" ? l.itemDisabled(e, a) : we.value.has(S(e))))
|
|
178
|
+
return !0;
|
|
179
|
+
const t = (s = l.canDrag) == null ? void 0 : s.call(l, e, a);
|
|
180
|
+
return t === !1 || typeof t == "string";
|
|
181
|
+
}
|
|
182
|
+
const Oe = n(
|
|
183
|
+
() => Le.value.map((e, a) => {
|
|
184
|
+
const t = S(e), s = m.value.keys.get(t) ?? a + w.value.start;
|
|
185
|
+
return {
|
|
186
|
+
item: e,
|
|
187
|
+
key: t,
|
|
188
|
+
index: s,
|
|
189
|
+
selected: N.value.has(t),
|
|
190
|
+
dragging: He.value.has(t),
|
|
191
|
+
disabled: me(e, s),
|
|
192
|
+
fixed: ie.value.get(t) ?? !1,
|
|
193
|
+
toggle: (u) => Ve(t, u),
|
|
194
|
+
move: (u) => g.relative(t, u, "button")
|
|
195
|
+
};
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
async function Q(e) {
|
|
199
|
+
var s;
|
|
200
|
+
const a = J.value === B.value ? m.value.keys.get(e) : J.value.findIndex((u) => S(u) === e);
|
|
201
|
+
if (a === void 0 || a < 0) return !1;
|
|
202
|
+
await Me(a), await tt();
|
|
203
|
+
const t = q(e);
|
|
204
|
+
return (s = t == null ? void 0 : t.scrollIntoView) == null || s.call(t, { block: "nearest", inline: "nearest" }), !!t;
|
|
61
205
|
}
|
|
62
|
-
|
|
206
|
+
async function be(e) {
|
|
207
|
+
if (!await Q(e)) return !1;
|
|
208
|
+
const a = q(e);
|
|
209
|
+
return a == null || a.focus({ preventScroll: !0 }), !!a;
|
|
210
|
+
}
|
|
211
|
+
function Re(e, a) {
|
|
212
|
+
const t = a.to === void 0 || a.to === b.id() ? b : vt().find(
|
|
213
|
+
(s) => {
|
|
214
|
+
var u, p;
|
|
215
|
+
return s.id() === a.to && ((u = s.root()) == null ? void 0 : u.ownerDocument) === ((p = D.value) == null ? void 0 : p.ownerDocument);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
return t ? g.move(
|
|
219
|
+
gt(e),
|
|
220
|
+
{
|
|
221
|
+
...dt(b, t, a.index),
|
|
222
|
+
operation: a.operation
|
|
223
|
+
},
|
|
224
|
+
"api"
|
|
225
|
+
) : (de(yt("outside")), Promise.resolve(!1));
|
|
226
|
+
}
|
|
227
|
+
function je(e, a) {
|
|
228
|
+
if (a.disabled || !(e.ctrlKey || e.metaKey || e.shiftKey))
|
|
229
|
+
return;
|
|
230
|
+
const t = e.target;
|
|
231
|
+
t instanceof Element && t.closest("[data-sort-root]") === D.value && !t.closest(
|
|
232
|
+
"button,input,select,textarea,a[href],label,[contenteditable],[data-sort-ignore]"
|
|
233
|
+
) && a.toggle(e);
|
|
234
|
+
}
|
|
235
|
+
function Ge(e) {
|
|
236
|
+
var a, t;
|
|
237
|
+
((a = E.value) == null ? void 0 : a.drag.source) === "keyboard" && e.relatedTarget instanceof Node && !((t = D.value) != null && t.contains(e.relatedTarget)) && g.cancel();
|
|
238
|
+
}
|
|
239
|
+
function ge(e) {
|
|
240
|
+
return K.value ? { inlineSize: `${e}px` } : { blockSize: `${e}px` };
|
|
241
|
+
}
|
|
242
|
+
let z;
|
|
243
|
+
function pe() {
|
|
244
|
+
!z && D.value && (z = ft(D.value, b));
|
|
245
|
+
}
|
|
246
|
+
function ke() {
|
|
247
|
+
z == null || z(), z = void 0, g.detach();
|
|
248
|
+
}
|
|
249
|
+
return Ue(() => {
|
|
250
|
+
pe(), ht(b);
|
|
251
|
+
}), We(pe), qe(ke), Je(() => {
|
|
252
|
+
ke(), mt(b);
|
|
253
|
+
}), Se(m, () => g.dataChanged(), { flush: "post" }), Se(
|
|
254
|
+
() => l.disabled,
|
|
255
|
+
(e) => {
|
|
256
|
+
e && g.cancel();
|
|
257
|
+
}
|
|
258
|
+
), Be({
|
|
259
|
+
move: Re,
|
|
260
|
+
select: ue,
|
|
261
|
+
scrollTo: Q,
|
|
262
|
+
focus: be,
|
|
263
|
+
undo: () => xe(b, "undo"),
|
|
264
|
+
redo: () => xe(b, "redo"),
|
|
265
|
+
reset: () => bt(b, $e),
|
|
266
|
+
cancel: () => g.cancel()
|
|
267
|
+
}), (e, a) => (r(), T("div", P({
|
|
63
268
|
ref_key: "root",
|
|
64
|
-
ref:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
269
|
+
ref: D
|
|
270
|
+
}, o(te), {
|
|
271
|
+
"data-sort-root": "",
|
|
272
|
+
class: ["hys-sort", { "hys-sort-moving": !!o(E), "hys-sort-no-motion": !M.value }],
|
|
273
|
+
"data-drop-state": ye.value,
|
|
274
|
+
"aria-busy": x.value || void 0,
|
|
275
|
+
style: Ne.value,
|
|
276
|
+
onFocusout: Ge
|
|
68
277
|
}), [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class: "hys-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class: "hys-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
278
|
+
V("div", {
|
|
279
|
+
ref_key: "viewport",
|
|
280
|
+
ref: oe,
|
|
281
|
+
class: R(["hys-sort-viewport", { "hys-sort-virtual": c.virtual }]),
|
|
282
|
+
style: Y({ maxBlockSize: o(Ae) }),
|
|
283
|
+
onScrollPassive: a[1] || (a[1] = //@ts-ignore
|
|
284
|
+
(...t) => o(fe) && o(fe)(...t))
|
|
285
|
+
}, [
|
|
286
|
+
(r(), d(v(i.value ? "table" : "div"), {
|
|
287
|
+
class: R(i.value ? "hys-sort-table" : void 0),
|
|
288
|
+
"aria-label": i.value ? c.ariaLabel : void 0
|
|
289
|
+
}, {
|
|
290
|
+
default: f(() => [
|
|
291
|
+
i.value ? $(e.$slots, "header", {}, void 0, !0, 0) : y("", !0),
|
|
292
|
+
(r(), d(v(i.value ? "tbody" : c.listTag), {
|
|
293
|
+
ref_key: "surface",
|
|
294
|
+
ref: A,
|
|
295
|
+
"data-sort-surface": "",
|
|
296
|
+
class: R(["hys-sort-list", {
|
|
297
|
+
"hys-sort-horizontal": K.value,
|
|
298
|
+
"hys-sort-grid": U.value
|
|
299
|
+
}]),
|
|
300
|
+
role: i.value ? void 0 : "list",
|
|
301
|
+
"aria-label": i.value ? void 0 : c.ariaLabel,
|
|
302
|
+
"aria-describedby": le,
|
|
303
|
+
"data-sort-columns": U.value && c.virtual ? o(ve) : void 0
|
|
304
|
+
}, {
|
|
305
|
+
default: f(() => [
|
|
306
|
+
Z(Qe, {
|
|
307
|
+
name: "hys-sort-motion",
|
|
308
|
+
css: !1,
|
|
309
|
+
"move-class": M.value && !c.virtual ? c.moveClass : "hys-sort-static-move"
|
|
310
|
+
}, {
|
|
311
|
+
default: f(() => [
|
|
312
|
+
o(w).before ? (r(), d(v(H.value), {
|
|
313
|
+
key: "before-spacer",
|
|
314
|
+
class: "hys-sort-spacer",
|
|
315
|
+
style: Y(ge(o(w).before)),
|
|
316
|
+
"aria-hidden": "true"
|
|
317
|
+
}, {
|
|
318
|
+
default: f(() => [
|
|
319
|
+
i.value ? (r(), T("td", {
|
|
320
|
+
key: 0,
|
|
321
|
+
colspan: F.value
|
|
322
|
+
}, null, 8, Dt)) : y("", !0)
|
|
323
|
+
]),
|
|
324
|
+
_: 1
|
|
325
|
+
}, 8, ["style"])) : y("", !0),
|
|
326
|
+
(r(!0), T(Ce, null, Xe(Oe.value, (t, s) => {
|
|
327
|
+
var u, p;
|
|
328
|
+
return r(), d(v(H.value), {
|
|
329
|
+
key: m.value.valid ? "row:" + o(ee)(t.key) : "invalid:" + s,
|
|
330
|
+
class: R(["hys-sort-row", {
|
|
331
|
+
"hys-sort-picked": t.dragging,
|
|
332
|
+
"hys-sort-selected": t.selected,
|
|
333
|
+
"hys-sort-whole": o(ut)(l) && !t.disabled
|
|
334
|
+
}]),
|
|
335
|
+
role: i.value ? void 0 : "listitem",
|
|
336
|
+
tabindex: c.keyboard ? 0 : void 0,
|
|
337
|
+
"data-sort-id": t.key,
|
|
338
|
+
"data-sort-key": o(ee)(t.key),
|
|
339
|
+
"data-sort-index": o(w).start + s,
|
|
340
|
+
"data-drop-position": ((u = he.value) == null ? void 0 : u.key) === t.key ? (p = he.value) == null ? void 0 : p.position : void 0,
|
|
341
|
+
"aria-posinset": i.value ? void 0 : t.index + 1,
|
|
342
|
+
"aria-setsize": i.value ? void 0 : B.value.length,
|
|
343
|
+
"aria-label": C(t.item),
|
|
344
|
+
"aria-disabled": t.disabled || void 0,
|
|
345
|
+
onPointerdown: (h) => o(g).pointerDown(h, t.key, t.disabled),
|
|
346
|
+
onKeydown: (h) => o(g).keyboard(h, t.key, t.disabled),
|
|
347
|
+
onClick: (h) => je(h, t),
|
|
348
|
+
onDragstart: a[0] || (a[0] = De(() => {
|
|
349
|
+
}, ["prevent"]))
|
|
350
|
+
}, {
|
|
351
|
+
default: f(() => [
|
|
352
|
+
re.value ? (r(), d(v(I.value), {
|
|
353
|
+
key: 0,
|
|
354
|
+
class: "hys-sort-grip-cell"
|
|
355
|
+
}, {
|
|
356
|
+
default: f(() => [
|
|
357
|
+
c.selectable ? (r(), T("input", {
|
|
358
|
+
key: 0,
|
|
359
|
+
type: "checkbox",
|
|
360
|
+
checked: t.selected,
|
|
361
|
+
disabled: t.disabled || x.value,
|
|
362
|
+
"aria-label": "选择" + C(t.item),
|
|
363
|
+
onClick: De((h) => t.toggle(h), ["prevent"])
|
|
364
|
+
}, null, 8, xt)) : y("", !0),
|
|
365
|
+
ne.value ? (r(), T("button", {
|
|
366
|
+
key: 1,
|
|
367
|
+
type: "button",
|
|
368
|
+
"data-sort-handle": "",
|
|
369
|
+
class: "hys-sort-handle",
|
|
370
|
+
disabled: t.disabled || x.value,
|
|
371
|
+
"aria-label": "拖动排序" + C(t.item)
|
|
372
|
+
}, [
|
|
373
|
+
$(e.$slots, "handle", P({ ref_for: !0 }, t), () => [
|
|
374
|
+
Z(o(at), {
|
|
375
|
+
size: 16,
|
|
376
|
+
"aria-hidden": "true"
|
|
377
|
+
})
|
|
378
|
+
], !0)
|
|
379
|
+
], 8, Bt)) : y("", !0)
|
|
380
|
+
]),
|
|
381
|
+
_: 2
|
|
382
|
+
}, 1024)) : y("", !0),
|
|
383
|
+
i.value && e.$slots.cells ? $(e.$slots, "cells", P({ ref_for: !0 }, t), void 0, !0, 1) : (r(), d(v(I.value), {
|
|
384
|
+
key: 2,
|
|
385
|
+
class: "hys-sort-content"
|
|
386
|
+
}, {
|
|
387
|
+
default: f(() => [
|
|
388
|
+
$(e.$slots, "item", P({ ref_for: !0 }, t), () => [
|
|
389
|
+
j(L(C(t.item)), 1)
|
|
390
|
+
], !0)
|
|
391
|
+
]),
|
|
392
|
+
_: 2
|
|
393
|
+
}, 1024)),
|
|
394
|
+
c.showButtons ? (r(), d(v(I.value), {
|
|
395
|
+
key: 3,
|
|
396
|
+
class: "hys-sort-actions-cell"
|
|
397
|
+
}, {
|
|
398
|
+
default: f(() => [
|
|
399
|
+
V("div", Kt, [
|
|
400
|
+
V("button", {
|
|
401
|
+
type: "button",
|
|
402
|
+
disabled: t.disabled || x.value || t.index === 0,
|
|
403
|
+
"aria-label": (K.value ? "前移" : "上移") + C(t.item),
|
|
404
|
+
onClick: (h) => t.move(-1)
|
|
405
|
+
}, [
|
|
406
|
+
(r(), d(v(K.value ? o(lt) : o(ot)), {
|
|
407
|
+
size: 15,
|
|
408
|
+
"aria-hidden": "true"
|
|
409
|
+
}))
|
|
410
|
+
], 8, Tt),
|
|
411
|
+
V("button", {
|
|
412
|
+
type: "button",
|
|
413
|
+
disabled: t.disabled || x.value || t.index === B.value.length - 1,
|
|
414
|
+
"aria-label": (K.value ? "后移" : "下移") + C(t.item),
|
|
415
|
+
onClick: (h) => t.move(1)
|
|
416
|
+
}, [
|
|
417
|
+
(r(), d(v(K.value ? o(st) : o(nt)), {
|
|
418
|
+
size: 15,
|
|
419
|
+
"aria-hidden": "true"
|
|
420
|
+
}))
|
|
421
|
+
], 8, $t)
|
|
422
|
+
])
|
|
423
|
+
]),
|
|
424
|
+
_: 2
|
|
425
|
+
}, 1024)) : y("", !0),
|
|
426
|
+
t.dragging && e.$slots.placeholder ? (r(), d(v(I.value), {
|
|
427
|
+
key: 4,
|
|
428
|
+
class: "hys-sort-placeholder",
|
|
429
|
+
"aria-hidden": "true"
|
|
430
|
+
}, {
|
|
431
|
+
default: f(() => [
|
|
432
|
+
$(e.$slots, "placeholder", P({ ref_for: !0 }, t), void 0, !0)
|
|
433
|
+
]),
|
|
434
|
+
_: 2
|
|
435
|
+
}, 1024)) : y("", !0)
|
|
436
|
+
]),
|
|
437
|
+
_: 2
|
|
438
|
+
}, 1064, ["class", "role", "tabindex", "data-sort-id", "data-sort-key", "data-sort-index", "data-drop-position", "aria-posinset", "aria-setsize", "aria-label", "aria-disabled", "onPointerdown", "onKeydown", "onClick"]);
|
|
439
|
+
}), 128)),
|
|
440
|
+
o(w).after ? (r(), d(v(H.value), {
|
|
441
|
+
key: "after-spacer",
|
|
442
|
+
class: "hys-sort-spacer",
|
|
443
|
+
style: Y(ge(o(w).after)),
|
|
444
|
+
"aria-hidden": "true"
|
|
445
|
+
}, {
|
|
446
|
+
default: f(() => [
|
|
447
|
+
i.value ? (r(), T("td", {
|
|
448
|
+
key: 0,
|
|
449
|
+
colspan: F.value
|
|
450
|
+
}, null, 8, wt)) : y("", !0)
|
|
451
|
+
]),
|
|
452
|
+
_: 1
|
|
453
|
+
}, 8, ["style"])) : y("", !0)
|
|
454
|
+
]),
|
|
455
|
+
_: 3
|
|
456
|
+
}, 8, ["move-class"]),
|
|
457
|
+
B.value.length ? y("", !0) : (r(), d(v(H.value), {
|
|
458
|
+
key: 0,
|
|
459
|
+
class: "hys-sort-empty"
|
|
460
|
+
}, {
|
|
461
|
+
default: f(() => [
|
|
462
|
+
(r(), d(v(I.value), {
|
|
463
|
+
colspan: i.value ? F.value : void 0
|
|
464
|
+
}, {
|
|
465
|
+
default: f(() => [
|
|
466
|
+
$(e.$slots, "empty", {}, () => [
|
|
467
|
+
a[2] || (a[2] = j("暂无项目", -1))
|
|
468
|
+
], !0)
|
|
469
|
+
]),
|
|
470
|
+
_: 3
|
|
471
|
+
}, 8, ["colspan"]))
|
|
472
|
+
]),
|
|
473
|
+
_: 3
|
|
474
|
+
}))
|
|
109
475
|
]),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
476
|
+
_: 3
|
|
477
|
+
}, 8, ["class", "role", "aria-label", "data-sort-columns"]))
|
|
478
|
+
]),
|
|
479
|
+
_: 3
|
|
480
|
+
}, 8, ["class", "aria-label"]))
|
|
481
|
+
], 38),
|
|
482
|
+
V("span", {
|
|
483
|
+
id: le,
|
|
484
|
+
class: "hys-sort-sr"
|
|
485
|
+
}, L(Ee.value), 1),
|
|
486
|
+
V("span", zt, L(_.value), 1),
|
|
487
|
+
o(ce) ? (r(), d(Ye, {
|
|
488
|
+
key: 0,
|
|
489
|
+
to: "body"
|
|
490
|
+
}, [
|
|
491
|
+
Z(St, {
|
|
492
|
+
track: o(ce),
|
|
493
|
+
appearance: o(te),
|
|
494
|
+
"ghost-class": c.ghostClass,
|
|
495
|
+
"ghost-style": c.ghostStyle,
|
|
496
|
+
motion: M.value
|
|
497
|
+
}, {
|
|
498
|
+
default: f((t) => [
|
|
499
|
+
$(e.$slots, "preview", Ze(et(t)), () => [
|
|
500
|
+
j(L(C(t.drag.items[0])), 1),
|
|
501
|
+
t.drag.items.length > 1 ? (r(), T(Ce, { key: 0 }, [
|
|
502
|
+
j(" 等 " + L(t.drag.items.length) + " 项", 1)
|
|
503
|
+
], 64)) : y("", !0)
|
|
504
|
+
], !0)
|
|
505
|
+
]),
|
|
506
|
+
_: 3
|
|
507
|
+
}, 8, ["track", "appearance", "ghost-class", "ghost-style", "motion"])
|
|
508
|
+
])) : y("", !0)
|
|
509
|
+
], 16, Ct));
|
|
141
510
|
}
|
|
142
511
|
});
|
|
143
512
|
export {
|
|
144
|
-
|
|
513
|
+
Rt as default
|
|
145
514
|
};
|