hys-ui 0.5.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 +7 -0
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
- 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/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/popupReferenceBinding.js +41 -0
- 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/useHysToast.js +117 -135
- package/dist/composables/usePopupSurface.js +190 -356
- package/dist/composables/usePopupSurfaceInteractions.js +172 -0
- package/dist/index.js +59 -57
- package/dist/style.css +1 -1
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- 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/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/composables/popupReferenceBinding.d.ts +9 -0
- 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/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/index.d.ts +3 -4
- package/package.json +1 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { computed as d, ref as k, shallowRef as p, watch as F, onBeforeUnmount as q, nextTick as I } from "vue";
|
|
2
|
+
import { layoutOf as K, keyToken as N } from "./model.js";
|
|
3
|
+
const G = (n, u, l, s) => Number.isFinite(n) ? Math.min(s, Math.max(l, n)) : u;
|
|
4
|
+
function H(n, u) {
|
|
5
|
+
let l = 0, s = n.length - 1;
|
|
6
|
+
for (; l < s; ) {
|
|
7
|
+
const m = Math.ceil((l + s) / 2);
|
|
8
|
+
n[m] <= u ? l = m : s = m - 1;
|
|
9
|
+
}
|
|
10
|
+
return Math.min(l, Math.max(0, n.length - 2));
|
|
11
|
+
}
|
|
12
|
+
function J(n, u, l, s, m) {
|
|
13
|
+
const x = d(
|
|
14
|
+
() => typeof n.virtual == "object" ? n.virtual : {}
|
|
15
|
+
), c = d(() => K(n) === "horizontal"), v = k(0), L = k(0), z = k(0), y = k(0), h = /* @__PURE__ */ new Map(), R = p(0), b = d(() => {
|
|
16
|
+
if (K(n) !== "grid" || !n.virtual) return 1;
|
|
17
|
+
const e = x.value.columns;
|
|
18
|
+
return Math.floor(
|
|
19
|
+
G(
|
|
20
|
+
typeof e == "function" ? e(L.value) : e,
|
|
21
|
+
2,
|
|
22
|
+
1,
|
|
23
|
+
100
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
}), w = d(() => {
|
|
27
|
+
if (!n.virtual) return [0];
|
|
28
|
+
R.value;
|
|
29
|
+
const e = [0], t = G(
|
|
30
|
+
x.value.estimateSize,
|
|
31
|
+
c.value ? 160 : 48,
|
|
32
|
+
1,
|
|
33
|
+
2e3
|
|
34
|
+
), a = b.value;
|
|
35
|
+
for (let o = 0; o < u.value.length; o += a) {
|
|
36
|
+
let i = 0;
|
|
37
|
+
for (let r = o; r < Math.min(o + a, u.value.length); r++)
|
|
38
|
+
i = Math.max(
|
|
39
|
+
i,
|
|
40
|
+
h.get(N(m(u.value[r]))) ?? t
|
|
41
|
+
);
|
|
42
|
+
e.push(e[e.length - 1] + i + y.value);
|
|
43
|
+
}
|
|
44
|
+
return e;
|
|
45
|
+
}), W = d(() => {
|
|
46
|
+
if (!n.virtual)
|
|
47
|
+
return { start: 0, end: u.value.length, before: 0, after: 0 };
|
|
48
|
+
const e = w.value, t = e.length - 1, a = Math.floor(G(x.value.overscan, 4, 1, 100)), o = Math.max(0, H(e, v.value) - a), i = Math.min(
|
|
49
|
+
t,
|
|
50
|
+
H(e, v.value + (z.value || 300)) + a + 1
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
start: o * b.value,
|
|
54
|
+
end: Math.min(i * b.value, u.value.length),
|
|
55
|
+
before: Math.max(0, e[o] - y.value),
|
|
56
|
+
after: Math.max(0, e[t] - e[i] - y.value)
|
|
57
|
+
};
|
|
58
|
+
}), P = d(
|
|
59
|
+
() => u.value.slice(W.value.start, W.value.end)
|
|
60
|
+
), O = d(() => {
|
|
61
|
+
if (!n.virtual) return;
|
|
62
|
+
const e = x.value.height ?? (c.value ? "auto" : 320);
|
|
63
|
+
return typeof e == "number" ? `${Math.max(1, e)}px` : e;
|
|
64
|
+
});
|
|
65
|
+
let g, f;
|
|
66
|
+
const M = /* @__PURE__ */ new Set();
|
|
67
|
+
function S() {
|
|
68
|
+
const e = l.value;
|
|
69
|
+
if (!e || !n.virtual) return;
|
|
70
|
+
v.value = c.value ? Math.abs(e.scrollLeft) : e.scrollTop, z.value = c.value ? e.clientWidth : e.clientHeight, L.value = e.clientWidth;
|
|
71
|
+
const t = s.value;
|
|
72
|
+
if (t) {
|
|
73
|
+
const a = getComputedStyle(t);
|
|
74
|
+
y.value = parseFloat(c.value ? a.columnGap : a.rowGap) || 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function T(e) {
|
|
78
|
+
const t = l.value;
|
|
79
|
+
t && (c.value ? t.scrollLeft = getComputedStyle(t).direction === "rtl" ? -e : e : t.scrollTop = e, S());
|
|
80
|
+
}
|
|
81
|
+
function U(e) {
|
|
82
|
+
const t = w.value, a = H(t, v.value);
|
|
83
|
+
let o = !1;
|
|
84
|
+
for (const i of e) {
|
|
85
|
+
const r = i.target, A = r.dataset.sortKey;
|
|
86
|
+
if (A === void 0 || !M.has(r)) continue;
|
|
87
|
+
const C = c.value ? r.offsetWidth : r.offsetHeight;
|
|
88
|
+
!C || h.get(A) === C || (h.set(A, C), o = !0);
|
|
89
|
+
}
|
|
90
|
+
if (o) {
|
|
91
|
+
R.value++;
|
|
92
|
+
const i = (w.value[a] ?? 0) - (t[a] ?? 0);
|
|
93
|
+
if (i && v.value > 0) {
|
|
94
|
+
const r = v.value;
|
|
95
|
+
I(() => {
|
|
96
|
+
v.value === r && T(r + i);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function j() {
|
|
102
|
+
if (!f || !s.value) return;
|
|
103
|
+
const e = new Set(
|
|
104
|
+
Array.from(s.value.children).filter(
|
|
105
|
+
(t) => t.hasAttribute("data-sort-key")
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
for (const t of M)
|
|
109
|
+
e.has(t) || (f.unobserve(t), M.delete(t));
|
|
110
|
+
for (const t of e)
|
|
111
|
+
M.has(t) || (M.add(t), f.observe(t));
|
|
112
|
+
}
|
|
113
|
+
function B() {
|
|
114
|
+
g == null || g.disconnect(), f == null || f.disconnect(), g = f = void 0, M.clear();
|
|
115
|
+
}
|
|
116
|
+
F(
|
|
117
|
+
[l, s, () => !!n.virtual, c],
|
|
118
|
+
() => {
|
|
119
|
+
B(), h.clear(), R.value++, !(!l.value || !n.virtual) && (S(), typeof ResizeObserver < "u" && (g = new ResizeObserver(S), g.observe(l.value), f = new ResizeObserver(U), j()));
|
|
120
|
+
},
|
|
121
|
+
{ flush: "post" }
|
|
122
|
+
), F(P, j, { flush: "post" }), F(u, (e) => {
|
|
123
|
+
if (!h.size) return;
|
|
124
|
+
const t = new Set(e.map((a) => N(m(a))));
|
|
125
|
+
for (const a of h.keys()) t.has(a) || h.delete(a);
|
|
126
|
+
}), q(B);
|
|
127
|
+
async function $(e) {
|
|
128
|
+
if (!n.virtual || e < 0) return;
|
|
129
|
+
const t = Math.floor(e / b.value), a = w.value[t], o = w.value[t + 1] - y.value;
|
|
130
|
+
a < v.value ? T(a) : o > v.value + z.value && T(Math.max(0, o - z.value)), await I();
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
visibleItems: P,
|
|
134
|
+
range: W,
|
|
135
|
+
horizontal: c,
|
|
136
|
+
length: O,
|
|
137
|
+
columns: b,
|
|
138
|
+
reveal: $,
|
|
139
|
+
syncPosition: S
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
J as useSortWindow
|
|
144
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysToast2.vue.js";
|
|
2
|
-
/* empty css
|
|
2
|
+
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f72ab805"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|