geekin-devtoys 0.3.4 → 0.3.6
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/lib/{AnimatePresence-CXPNzIHs.js → AnimatePresence-26Wy0TGN.js} +1 -1
- package/lib/{AnimatePresence-DkTyYbzH.mjs → AnimatePresence-nl0c23TZ.mjs} +1 -1
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +2 -2
- package/lib/GDialog/style2.css +1 -0
- package/lib/GDialogPro/index.js +1 -0
- package/lib/GDialogPro/index.mjs +529 -0
- package/lib/GDialogPro.d.ts +1 -0
- package/lib/GInputTreeTag/index.js +1 -1
- package/lib/GInputTreeTag/index.mjs +2 -2
- package/lib/GScroller/index.js +1 -1
- package/lib/GScroller/index.mjs +1 -1
- package/lib/GShinyText/index.js +1 -0
- package/lib/GShinyText/index.mjs +164 -0
- package/lib/GShinyText.d.ts +1 -0
- package/lib/components/GDialogPro/GButton.d.ts +42 -0
- package/lib/components/GDialogPro/GDialogMinimizedIcon.d.ts +17 -0
- package/lib/components/GDialogPro/const.d.ts +55 -0
- package/lib/components/GDialogPro/icons.d.ts +9 -0
- package/lib/components/GDialogPro/index.d.ts +147 -0
- package/lib/components/GDialogPro/useDialogManager.d.ts +58 -0
- package/lib/components/GShinyText/index.d.ts +37 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +50 -44
- package/lib/index-B8Ap0044.js +1 -0
- package/lib/{index-CVPHcKaV.mjs → index-Bbr5fWvI.mjs} +1492 -1486
- package/lib/index.d.ts +3 -1
- package/package.json +17 -1
- package/lib/index-xqOURU1q.js +0 -1
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { inject as pe, reactive as ie, computed as d, h as f, defineComponent as x, ref as k, watch as N, onUnmounted as oe, createBlock as _, openBlock as r, Teleport as ne, createVNode as R, unref as I, normalizeStyle as ge, normalizeClass as ae, withCtx as T, createElementVNode as c, toDisplayString as M, createElementBlock as b, createCommentVNode as w, resolveDynamicComponent as ve, renderSlot as P, useId as J, onMounted as ye, Transition as he, withModifiers as ke, mergeProps as _e, Fragment as Q, renderList as we, createTextVNode as F } from "vue";
|
|
2
|
+
import { A as be } from "../AnimatePresence-nl0c23TZ.mjs";
|
|
3
|
+
import { m as ze } from "../index-Bbr5fWvI.mjs";
|
|
4
|
+
import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
|
+
const Ce = /* @__PURE__ */ Symbol("GDialogProManager"), ee = {
|
|
6
|
+
small: "380px",
|
|
7
|
+
medium: "480px",
|
|
8
|
+
large: "580px"
|
|
9
|
+
}, W = {
|
|
10
|
+
ICON_WIDTH: 92,
|
|
11
|
+
ICON_HEIGHT: 34,
|
|
12
|
+
GAP: 8,
|
|
13
|
+
BOTTOM_OFFSET: 18,
|
|
14
|
+
RIGHT_OFFSET: 18,
|
|
15
|
+
MAX_PER_ROW: 8
|
|
16
|
+
};
|
|
17
|
+
function Te(l) {
|
|
18
|
+
const m = /* @__PURE__ */ new Map(), { ICON_WIDTH: a, ICON_HEIGHT: s, GAP: p, BOTTOM_OFFSET: e, RIGHT_OFFSET: i, MAX_PER_ROW: u } = W;
|
|
19
|
+
return l.forEach((g, v) => {
|
|
20
|
+
const o = Math.floor(v / u), n = v % u;
|
|
21
|
+
m.set(g, {
|
|
22
|
+
right: i + n * (a + p),
|
|
23
|
+
bottom: e + o * (s + p)
|
|
24
|
+
});
|
|
25
|
+
}), m;
|
|
26
|
+
}
|
|
27
|
+
function Je() {
|
|
28
|
+
const l = ie(/* @__PURE__ */ new Map()), m = d(() => {
|
|
29
|
+
const o = [];
|
|
30
|
+
return l.forEach((n) => {
|
|
31
|
+
n.isMinimized && o.push(n.id);
|
|
32
|
+
}), o;
|
|
33
|
+
}), a = d(() => Te(m.value));
|
|
34
|
+
function s(o) {
|
|
35
|
+
l.set(o.id, { attentionTick: 0, ...o });
|
|
36
|
+
}
|
|
37
|
+
function p(o) {
|
|
38
|
+
l.delete(o);
|
|
39
|
+
}
|
|
40
|
+
function e(o) {
|
|
41
|
+
const n = l.get(o);
|
|
42
|
+
if (n) {
|
|
43
|
+
if (n.isMinimized) {
|
|
44
|
+
n.attentionTick = (n.attentionTick ?? 0) + 1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
n.isMinimized = !0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function i(o) {
|
|
51
|
+
const n = l.get(o);
|
|
52
|
+
n?.isMinimized && (n.attentionTick = (n.attentionTick ?? 0) + 1);
|
|
53
|
+
}
|
|
54
|
+
function u(o) {
|
|
55
|
+
const n = l.get(o);
|
|
56
|
+
n && (n.isMinimized = !1);
|
|
57
|
+
}
|
|
58
|
+
function g(o) {
|
|
59
|
+
return d(
|
|
60
|
+
() => a.value.get(o) ?? {
|
|
61
|
+
right: W.RIGHT_OFFSET,
|
|
62
|
+
bottom: W.BOTTOM_OFFSET
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const v = d(() => m.value.map((o) => l.get(o)).filter(Boolean));
|
|
67
|
+
return {
|
|
68
|
+
dialogs: l,
|
|
69
|
+
register: s,
|
|
70
|
+
unregister: p,
|
|
71
|
+
minimize: e,
|
|
72
|
+
remindMinimized: i,
|
|
73
|
+
restore: u,
|
|
74
|
+
getPosition: g,
|
|
75
|
+
minimizedList: v
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function Me() {
|
|
79
|
+
return pe(Ce, null);
|
|
80
|
+
}
|
|
81
|
+
const L = {
|
|
82
|
+
viewBox: "0 0 16 16",
|
|
83
|
+
fill: "none",
|
|
84
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
85
|
+
"aria-hidden": "true"
|
|
86
|
+
}, Ie = () => f("svg", L, [
|
|
87
|
+
f("path", {
|
|
88
|
+
d: "M3.5 8h9",
|
|
89
|
+
stroke: "currentColor",
|
|
90
|
+
"stroke-width": 1.6,
|
|
91
|
+
"stroke-linecap": "round"
|
|
92
|
+
})
|
|
93
|
+
]), Oe = () => f("svg", L, [
|
|
94
|
+
f("path", {
|
|
95
|
+
d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9",
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
"stroke-width": 1.6,
|
|
98
|
+
"stroke-linecap": "round"
|
|
99
|
+
}),
|
|
100
|
+
f("path", {
|
|
101
|
+
d: "M13.5 2v3.5H10",
|
|
102
|
+
stroke: "currentColor",
|
|
103
|
+
"stroke-width": 1.6,
|
|
104
|
+
"stroke-linecap": "round",
|
|
105
|
+
"stroke-linejoin": "round"
|
|
106
|
+
})
|
|
107
|
+
]), Be = () => f("svg", L, [
|
|
108
|
+
f("circle", {
|
|
109
|
+
cx: 8,
|
|
110
|
+
cy: 8,
|
|
111
|
+
r: 6,
|
|
112
|
+
stroke: "currentColor",
|
|
113
|
+
"stroke-width": 1.6
|
|
114
|
+
}),
|
|
115
|
+
f("path", {
|
|
116
|
+
d: "M5.3 8.2l1.9 1.9 3.5-4",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
"stroke-width": 1.6,
|
|
119
|
+
"stroke-linecap": "round",
|
|
120
|
+
"stroke-linejoin": "round"
|
|
121
|
+
})
|
|
122
|
+
]), Ee = () => f("svg", L, [
|
|
123
|
+
f("path", {
|
|
124
|
+
d: "M2.5 4.5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4.5a2 2 0 0 1-2 2H7.2L4.8 13.6V11a2 2 0 0 1-2-2V4.5z",
|
|
125
|
+
stroke: "currentColor",
|
|
126
|
+
"stroke-width": 1.4,
|
|
127
|
+
"stroke-linejoin": "round"
|
|
128
|
+
}),
|
|
129
|
+
f("circle", { cx: 5.8, cy: 6.7, r: 0.7, fill: "currentColor" }),
|
|
130
|
+
f("circle", { cx: 8, cy: 6.7, r: 0.7, fill: "currentColor" }),
|
|
131
|
+
f("circle", { cx: 10.2, cy: 6.7, r: 0.7, fill: "currentColor" })
|
|
132
|
+
]), $e = {
|
|
133
|
+
class: "g-dialog-pro-minimized-icon__icon",
|
|
134
|
+
"aria-hidden": "true"
|
|
135
|
+
}, De = { class: "g-dialog-pro-minimized-icon__title" }, Se = /* @__PURE__ */ x({
|
|
136
|
+
name: "GDialogMinimizedIcon",
|
|
137
|
+
__name: "GDialogMinimizedIcon",
|
|
138
|
+
props: {
|
|
139
|
+
title: {},
|
|
140
|
+
position: {},
|
|
141
|
+
attentionTick: { default: 0 }
|
|
142
|
+
},
|
|
143
|
+
emits: ["restore"],
|
|
144
|
+
setup(l, { emit: m }) {
|
|
145
|
+
const a = l, s = m, p = d(() => a.title || "弹窗"), e = d(() => `恢复 ${p.value}`), i = { opacity: 0, scale: 0.8, x: -24, y: 12 }, u = { opacity: 1, scale: 1, x: 0, y: 0 }, g = { opacity: 0, scale: 0.8, x: -24, y: 12 }, v = { duration: 0.28, ease: [0.2, 0.8, 0.2, 1] }, o = { scale: 1.04, y: -2 }, n = { scale: 0.98 }, B = d(() => ({
|
|
146
|
+
position: "fixed",
|
|
147
|
+
right: `${a.position.right}px`,
|
|
148
|
+
bottom: `${a.position.bottom}px`
|
|
149
|
+
})), z = k(!1);
|
|
150
|
+
let E;
|
|
151
|
+
N(() => a.attentionTick, (A, y) => {
|
|
152
|
+
y === void 0 || A === y || (z.value = !1, window.clearTimeout(E), window.requestAnimationFrame(() => {
|
|
153
|
+
z.value = !0, E = window.setTimeout(() => {
|
|
154
|
+
z.value = !1;
|
|
155
|
+
}, 580);
|
|
156
|
+
}));
|
|
157
|
+
}), oe(() => {
|
|
158
|
+
window.clearTimeout(E);
|
|
159
|
+
});
|
|
160
|
+
function S() {
|
|
161
|
+
s("restore");
|
|
162
|
+
}
|
|
163
|
+
return (A, y) => (r(), _(ne, { to: "body" }, [
|
|
164
|
+
R(I(ze).div, {
|
|
165
|
+
class: ae(["g-dialog-pro-minimized-icon", { "is-attention": z.value }]),
|
|
166
|
+
type: "button",
|
|
167
|
+
style: ge(B.value),
|
|
168
|
+
title: e.value,
|
|
169
|
+
"aria-label": e.value,
|
|
170
|
+
initial: i,
|
|
171
|
+
animate: u,
|
|
172
|
+
exit: g,
|
|
173
|
+
transition: v,
|
|
174
|
+
"while-hover": o,
|
|
175
|
+
"while-press": n,
|
|
176
|
+
onClick: S
|
|
177
|
+
}, {
|
|
178
|
+
default: T(() => [
|
|
179
|
+
y[0] || (y[0] = c("span", {
|
|
180
|
+
class: "g-dialog-pro-minimized-icon__glow",
|
|
181
|
+
"aria-hidden": "true"
|
|
182
|
+
}, null, -1)),
|
|
183
|
+
y[1] || (y[1] = c("span", {
|
|
184
|
+
class: "g-dialog-pro-minimized-icon__wave",
|
|
185
|
+
"aria-hidden": "true"
|
|
186
|
+
}, null, -1)),
|
|
187
|
+
c("span", $e, [
|
|
188
|
+
R(I(Ee))
|
|
189
|
+
]),
|
|
190
|
+
c("span", De, M(p.value), 1)
|
|
191
|
+
]),
|
|
192
|
+
_: 1,
|
|
193
|
+
__: [0, 1]
|
|
194
|
+
}, 8, ["class", "style", "title", "aria-label"])
|
|
195
|
+
]));
|
|
196
|
+
}
|
|
197
|
+
}), j = /* @__PURE__ */ K(Se, [["__scopeId", "data-v-e312df81"]]), Ae = ["disabled"], Ge = {
|
|
198
|
+
key: 0,
|
|
199
|
+
class: "g-btn__icon g-btn__loading",
|
|
200
|
+
"aria-hidden": "true"
|
|
201
|
+
}, Fe = {
|
|
202
|
+
key: 1,
|
|
203
|
+
class: "g-btn__icon",
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
}, Pe = {
|
|
206
|
+
key: 2,
|
|
207
|
+
class: "g-btn__text"
|
|
208
|
+
}, Re = /* @__PURE__ */ x({
|
|
209
|
+
name: "GButton",
|
|
210
|
+
__name: "GButton",
|
|
211
|
+
props: {
|
|
212
|
+
type: { default: "default" },
|
|
213
|
+
icon: {},
|
|
214
|
+
loading: { type: Boolean, default: !1 },
|
|
215
|
+
disabled: { type: Boolean, default: !1 },
|
|
216
|
+
plain: { type: Boolean, default: !1 },
|
|
217
|
+
size: { default: "default" }
|
|
218
|
+
},
|
|
219
|
+
emits: ["click"],
|
|
220
|
+
setup(l, { emit: m }) {
|
|
221
|
+
const a = l, s = m;
|
|
222
|
+
function p(e) {
|
|
223
|
+
a.disabled || a.loading || s("click", e);
|
|
224
|
+
}
|
|
225
|
+
return (e, i) => (r(), b("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
class: ae(["g-btn", [
|
|
228
|
+
`g-btn--${e.type}`,
|
|
229
|
+
`g-btn--size-${e.size}`,
|
|
230
|
+
{
|
|
231
|
+
"is-plain": e.plain,
|
|
232
|
+
"is-disabled": e.disabled,
|
|
233
|
+
"is-loading": e.loading
|
|
234
|
+
}
|
|
235
|
+
]]),
|
|
236
|
+
disabled: e.disabled || e.loading,
|
|
237
|
+
onClick: p
|
|
238
|
+
}, [
|
|
239
|
+
e.loading ? (r(), b("span", Ge, i[0] || (i[0] = [
|
|
240
|
+
c("svg", {
|
|
241
|
+
viewBox: "0 0 16 16",
|
|
242
|
+
fill: "none",
|
|
243
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
244
|
+
}, [
|
|
245
|
+
c("circle", {
|
|
246
|
+
cx: "8",
|
|
247
|
+
cy: "8",
|
|
248
|
+
r: "6",
|
|
249
|
+
stroke: "currentColor",
|
|
250
|
+
"stroke-width": "1.6",
|
|
251
|
+
"stroke-opacity": "0.25"
|
|
252
|
+
}),
|
|
253
|
+
c("path", {
|
|
254
|
+
d: "M14 8a6 6 0 0 0-6-6",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
"stroke-width": "1.6",
|
|
257
|
+
"stroke-linecap": "round"
|
|
258
|
+
})
|
|
259
|
+
], -1)
|
|
260
|
+
]))) : e.icon ? (r(), b("span", Fe, [
|
|
261
|
+
(r(), _(ve(e.icon)))
|
|
262
|
+
])) : w("", !0),
|
|
263
|
+
e.$slots.default ? (r(), b("span", Pe, [
|
|
264
|
+
P(e.$slots, "default", {}, void 0, !0)
|
|
265
|
+
])) : w("", !0)
|
|
266
|
+
], 10, Ae));
|
|
267
|
+
}
|
|
268
|
+
}), O = /* @__PURE__ */ K(Re, [["__scopeId", "data-v-25d59287"]]), Le = { class: "g-dialog-pro-header" }, Ve = { class: "g-dialog-pro-title" }, He = {
|
|
269
|
+
class: "g-dialog-pro-operation-container",
|
|
270
|
+
"aria-label": "弹窗操作"
|
|
271
|
+
}, Ne = ["aria-label", "title"], We = { class: "g-dialog-pro-body" }, je = {
|
|
272
|
+
key: 0,
|
|
273
|
+
class: "g-dialog-pro-footer"
|
|
274
|
+
}, xe = { class: "g-dialog-pro-actions" }, te = "关闭", Ke = /* @__PURE__ */ x({
|
|
275
|
+
name: "GDialogPro",
|
|
276
|
+
inheritAttrs: !1,
|
|
277
|
+
__name: "index",
|
|
278
|
+
props: {
|
|
279
|
+
title: { default: "" },
|
|
280
|
+
size: { default: "medium" },
|
|
281
|
+
modelValue: { type: Boolean },
|
|
282
|
+
hideFooter: { type: Boolean, default: !1 },
|
|
283
|
+
actions: {},
|
|
284
|
+
showCancel: { type: Boolean, default: !0 },
|
|
285
|
+
showReset: { type: Boolean, default: !0 },
|
|
286
|
+
showSave: { type: Boolean, default: !0 },
|
|
287
|
+
cancelText: { default: "取消" },
|
|
288
|
+
resetText: { default: "重置" },
|
|
289
|
+
saveText: { default: "保存" },
|
|
290
|
+
saveLoading: { type: Boolean, default: !1 },
|
|
291
|
+
saveDisabled: { type: Boolean, default: !1 },
|
|
292
|
+
beforeClose: {}
|
|
293
|
+
},
|
|
294
|
+
emits: ["cancel", "reset", "save", "minimize", "action", "update:modelValue"],
|
|
295
|
+
setup(l, { emit: m }) {
|
|
296
|
+
const a = l, s = m, p = d(() => a.modelValue), e = J ? J() : `g-dialog-pro-${Date.now()}-${Math.random().toString(36).slice(2)}`, i = Me(), u = k(!1), g = k(!0), v = k(0), o = k(!1), n = k(!1), B = k(!1), z = d(() => i ? i.dialogs.get(e)?.isMinimized ?? !1 : u.value), E = d(() => i ? i.dialogs.get(e)?.attentionTick ?? 0 : v.value), S = d(() => i ? !n.value : g.value), A = d(() => i ? i.getPosition(e).value : { right: 20, bottom: 20 });
|
|
297
|
+
ye(() => {
|
|
298
|
+
i?.register({
|
|
299
|
+
id: e,
|
|
300
|
+
title: a.title,
|
|
301
|
+
isMinimized: !1
|
|
302
|
+
}), document.addEventListener("keydown", U);
|
|
303
|
+
}), oe(() => {
|
|
304
|
+
i?.unregister(e), document.removeEventListener("keydown", U);
|
|
305
|
+
}), N(
|
|
306
|
+
() => a.title,
|
|
307
|
+
(t) => {
|
|
308
|
+
if (i) {
|
|
309
|
+
const C = i.dialogs.get(e);
|
|
310
|
+
C && (C.title = t);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
), N(
|
|
314
|
+
() => a.modelValue,
|
|
315
|
+
(t) => {
|
|
316
|
+
if (t === !1) {
|
|
317
|
+
if (o.value) return;
|
|
318
|
+
i ? (i.restore(e), n.value = !1) : (g.value = !0, u.value = !1);
|
|
319
|
+
}
|
|
320
|
+
t === !0 && (i?.dialogs.get(e)?.isMinimized ? i.remindMinimized(e) : u.value && (v.value += 1));
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
const y = d(() => Object.prototype.hasOwnProperty.call(ee, a.size) ? ee[a.size] : a.size), le = d(() => D.value ? {} : { width: y.value });
|
|
324
|
+
async function $(t) {
|
|
325
|
+
if (!a.beforeClose) return !0;
|
|
326
|
+
try {
|
|
327
|
+
return await a.beforeClose(t) !== !1;
|
|
328
|
+
} catch {
|
|
329
|
+
return !1;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function G() {
|
|
333
|
+
await $("close") && s("update:modelValue", !1);
|
|
334
|
+
}
|
|
335
|
+
function se() {
|
|
336
|
+
G();
|
|
337
|
+
}
|
|
338
|
+
function U(t) {
|
|
339
|
+
t.key === "Escape" && (!a.modelValue || !S.value || z.value || (t.stopPropagation(), G()));
|
|
340
|
+
}
|
|
341
|
+
async function X() {
|
|
342
|
+
await $("cancel") && s("cancel");
|
|
343
|
+
}
|
|
344
|
+
function Y() {
|
|
345
|
+
s("reset");
|
|
346
|
+
}
|
|
347
|
+
async function Z() {
|
|
348
|
+
await $("save") && s("save");
|
|
349
|
+
}
|
|
350
|
+
const V = ie({});
|
|
351
|
+
async function re(t) {
|
|
352
|
+
if (await $("action") && (s("action", t.key), !!t.onClick))
|
|
353
|
+
try {
|
|
354
|
+
const C = t.onClick();
|
|
355
|
+
C instanceof Promise && (V[t.key] = !0, await C);
|
|
356
|
+
} finally {
|
|
357
|
+
V[t.key] = !1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const D = k(!1), ce = () => {
|
|
361
|
+
D.value = !D.value;
|
|
362
|
+
}, q = d(() => D.value ? "退出全屏" : "全屏"), de = async () => {
|
|
363
|
+
if (!await $("minimize")) return;
|
|
364
|
+
if (i ? i.dialogs.get(e)?.isMinimized ?? !1 : u.value) {
|
|
365
|
+
i ? i.minimize(e) : v.value += 1, s("minimize", { id: e });
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
o.value = !0, i ? i.minimize(e) : u.value = !0, s("update:modelValue", !1), s("minimize", { id: e });
|
|
369
|
+
}, ue = () => {
|
|
370
|
+
B.value = !0, o.value = !1, i ? (n.value = !1, i.restore(e)) : (g.value = !0, u.value = !1), s("update:modelValue", !0);
|
|
371
|
+
}, fe = () => {
|
|
372
|
+
o.value && (i ? n.value = !0 : g.value = !1, o.value = !1);
|
|
373
|
+
}, me = () => {
|
|
374
|
+
B.value = !1;
|
|
375
|
+
};
|
|
376
|
+
return (t, C) => (r(), _(ne, { to: "body" }, [
|
|
377
|
+
R(he, {
|
|
378
|
+
name: "g-dialog-pro-fade",
|
|
379
|
+
onAfterEnter: me,
|
|
380
|
+
onAfterLeave: fe
|
|
381
|
+
}, {
|
|
382
|
+
default: T(() => [
|
|
383
|
+
S.value && p.value ? (r(), b("div", {
|
|
384
|
+
key: 0,
|
|
385
|
+
class: "g-dialog-pro-overlay",
|
|
386
|
+
onClick: ke(se, ["self"])
|
|
387
|
+
}, [
|
|
388
|
+
c("div", _e(t.$attrs, {
|
|
389
|
+
class: ["g-dialog-pro", {
|
|
390
|
+
"is-fullscreen": D.value,
|
|
391
|
+
"is-leave-to-minimize": o.value,
|
|
392
|
+
"is-enter-from-minimize": B.value
|
|
393
|
+
}],
|
|
394
|
+
style: le.value,
|
|
395
|
+
role: "dialog",
|
|
396
|
+
"aria-modal": "true"
|
|
397
|
+
}), [
|
|
398
|
+
c("header", Le, [
|
|
399
|
+
c("p", Ve, M(t.title), 1),
|
|
400
|
+
c("div", He, [
|
|
401
|
+
c("button", {
|
|
402
|
+
type: "button",
|
|
403
|
+
class: "g-dialog-pro-control g-dialog-pro-control--minimize",
|
|
404
|
+
"aria-label": "最小化",
|
|
405
|
+
title: "最小化",
|
|
406
|
+
onClick: de
|
|
407
|
+
}),
|
|
408
|
+
c("button", {
|
|
409
|
+
type: "button",
|
|
410
|
+
class: "g-dialog-pro-control g-dialog-pro-control--fullscreen",
|
|
411
|
+
"aria-label": q.value,
|
|
412
|
+
title: q.value,
|
|
413
|
+
onClick: ce
|
|
414
|
+
}, null, 8, Ne),
|
|
415
|
+
c("button", {
|
|
416
|
+
type: "button",
|
|
417
|
+
class: "g-dialog-pro-control g-dialog-pro-control--close",
|
|
418
|
+
"aria-label": te,
|
|
419
|
+
title: te,
|
|
420
|
+
onClick: G
|
|
421
|
+
})
|
|
422
|
+
])
|
|
423
|
+
]),
|
|
424
|
+
c("div", We, [
|
|
425
|
+
P(t.$slots, "default", {}, void 0, !0)
|
|
426
|
+
]),
|
|
427
|
+
t.hideFooter ? w("", !0) : (r(), b("footer", je, [
|
|
428
|
+
P(t.$slots, "footer", {
|
|
429
|
+
cancel: X,
|
|
430
|
+
reset: Y,
|
|
431
|
+
save: Z,
|
|
432
|
+
close: G,
|
|
433
|
+
loading: t.saveLoading
|
|
434
|
+
}, () => [
|
|
435
|
+
c("div", xe, [
|
|
436
|
+
t.actions && t.actions.length ? (r(!0), b(Q, { key: 0 }, we(t.actions, (h) => (r(), _(O, {
|
|
437
|
+
key: h.key,
|
|
438
|
+
type: h.type,
|
|
439
|
+
icon: h.icon,
|
|
440
|
+
loading: h.loading || V[h.key],
|
|
441
|
+
disabled: h.disabled,
|
|
442
|
+
plain: h.plain,
|
|
443
|
+
size: "small",
|
|
444
|
+
onClick: (Ue) => re(h)
|
|
445
|
+
}, {
|
|
446
|
+
default: T(() => [
|
|
447
|
+
F(M(h.label), 1)
|
|
448
|
+
]),
|
|
449
|
+
_: 2
|
|
450
|
+
}, 1032, ["type", "icon", "loading", "disabled", "plain", "onClick"]))), 128)) : (r(), b(Q, { key: 1 }, [
|
|
451
|
+
t.showCancel ? (r(), _(O, {
|
|
452
|
+
key: 0,
|
|
453
|
+
icon: I(Ie),
|
|
454
|
+
size: "small",
|
|
455
|
+
onClick: X
|
|
456
|
+
}, {
|
|
457
|
+
default: T(() => [
|
|
458
|
+
F(M(t.cancelText), 1)
|
|
459
|
+
]),
|
|
460
|
+
_: 1
|
|
461
|
+
}, 8, ["icon"])) : w("", !0),
|
|
462
|
+
t.showReset ? (r(), _(O, {
|
|
463
|
+
key: 1,
|
|
464
|
+
icon: I(Oe),
|
|
465
|
+
size: "small",
|
|
466
|
+
onClick: Y
|
|
467
|
+
}, {
|
|
468
|
+
default: T(() => [
|
|
469
|
+
F(M(t.resetText), 1)
|
|
470
|
+
]),
|
|
471
|
+
_: 1
|
|
472
|
+
}, 8, ["icon"])) : w("", !0),
|
|
473
|
+
t.showSave ? (r(), _(O, {
|
|
474
|
+
key: 2,
|
|
475
|
+
type: "primary",
|
|
476
|
+
icon: I(Be),
|
|
477
|
+
loading: t.saveLoading,
|
|
478
|
+
disabled: t.saveDisabled,
|
|
479
|
+
size: "small",
|
|
480
|
+
onClick: Z
|
|
481
|
+
}, {
|
|
482
|
+
default: T(() => [
|
|
483
|
+
F(M(t.saveText), 1)
|
|
484
|
+
]),
|
|
485
|
+
_: 1
|
|
486
|
+
}, 8, ["icon", "loading", "disabled"])) : w("", !0)
|
|
487
|
+
], 64)),
|
|
488
|
+
P(t.$slots, "moreOperations", {}, void 0, !0)
|
|
489
|
+
])
|
|
490
|
+
], !0)
|
|
491
|
+
]))
|
|
492
|
+
], 16)
|
|
493
|
+
])) : w("", !0)
|
|
494
|
+
]),
|
|
495
|
+
_: 3
|
|
496
|
+
}),
|
|
497
|
+
R(I(be), null, {
|
|
498
|
+
default: T(() => [
|
|
499
|
+
z.value ? (r(), _(j, {
|
|
500
|
+
key: 0,
|
|
501
|
+
title: t.title,
|
|
502
|
+
position: A.value,
|
|
503
|
+
"attention-tick": E.value,
|
|
504
|
+
onRestore: ue
|
|
505
|
+
}, null, 8, ["title", "position", "attention-tick"])) : w("", !0)
|
|
506
|
+
]),
|
|
507
|
+
_: 1
|
|
508
|
+
})
|
|
509
|
+
]));
|
|
510
|
+
}
|
|
511
|
+
}), H = /* @__PURE__ */ K(Ke, [["__scopeId", "data-v-cac8c7e5"]]);
|
|
512
|
+
H.install = (l) => {
|
|
513
|
+
l.component(H.name, H), l.component(j.name, j), l.component(O.name, O);
|
|
514
|
+
};
|
|
515
|
+
export {
|
|
516
|
+
Ee as ChatDotRound,
|
|
517
|
+
Be as CircleCheck,
|
|
518
|
+
Ce as DIALOG_MANAGER_KEY,
|
|
519
|
+
ee as DIALOG_SIZES,
|
|
520
|
+
O as GButton,
|
|
521
|
+
j as GDialogMinimizedIcon,
|
|
522
|
+
H as GDialogPro,
|
|
523
|
+
W as MINIMIZED_LAYOUT,
|
|
524
|
+
Oe as Refresh,
|
|
525
|
+
Ie as Remove,
|
|
526
|
+
Je as createDialogManager,
|
|
527
|
+
H as default,
|
|
528
|
+
Me as useDialogManager
|
|
529
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),h=require("element-plus"),R=require("../index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),h=require("element-plus"),R=require("../index-B8Ap0044.js"),H=require("../AnimatePresence-26Wy0TGN.js"),me=require("../_plugin-vue_export-helper-BHFhmbuH.js"),ge={key:0,class:"g-input-tree-tag__tags"},be=t.defineComponent({__name:"index",props:{modelValue:{default:()=>[]},data:{default:()=>[]},props:{default:()=>({})},echoProps:{},nodeKey:{default:"id"},placeholder:{default:"请输入关键字搜索"},width:{default:320},popperMaxHeight:{default:320},popperZIndex:{default:2e3},popperOffset:{default:4},defaultExpandAll:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},closable:{type:Boolean,default:!0},tagType:{default:"info"},tagEffect:{default:"light"},clearInputAfterSelect:{type:Boolean,default:!0},enterToAdd:{type:Boolean,default:!0},valueFormat:{default:"value"},selectable:{},filterMethod:{},duplicateMessage:{default:"该项已添加"},notFoundMessage:{default:"未找到匹配项"}},emits:["update:modelValue","change","add","remove","node-click","duplicate","not-found"],setup(B,{expose:$,emit:q}){const o=B,r=q,P=t.computed(()=>({label:o.props.label||"label",children:o.props.children||"children",disabled:o.props.disabled})),j=t.computed(()=>o.props.value||o.nodeKey||"id"),K=t.computed(()=>o.props.label||"label"),U=t.computed(()=>o.props.children||"children"),_=t.computed(()=>o.props.isLeaf),D=t.computed(()=>o.echoProps?.value||"value"),G=t.computed(()=>o.echoProps?.label||"label"),v=e=>e?e[j.value]:void 0,d=e=>e?e[K.value]:"",F=e=>e?e[U.value]:void 0,Z=e=>e?.[D.value]??e?.value,W=e=>e?.[G.value]??e?.label,c=e=>{if(!e)return!1;if(typeof o.selectable=="function")return o.selectable(e);if(_.value&&e[_.value]!==void 0)return!!e[_.value];const a=F(e);return!a||!a.length},S=t.computed(()=>{const e=new Map,a=(l=[])=>{l.forEach(n=>{c(n)&&e.set(v(n),n);const s=F(n);s?.length&&a(s)})};return a(o.data||[]),e}),u=t.computed(()=>(o.modelValue||[]).map(a=>{const l=o.valueFormat==="object"?Z(a):a,n=S.value.get(l),s=o.valueFormat==="object"?W(a):void 0;return{value:l,label:n?d(n):s??String(l??""),raw:n??(o.valueFormat==="object"?a:void 0)}})),w=e=>u.value.some(a=>a.value===e),k=t.ref(""),i=t.ref(!1),T=t.ref(null),I=t.ref(null),N=t.ref(null),p=t.ref(null),J=e=>{if(!e){p.value=null;return}p.value=e.$el??(e instanceof HTMLElement?e:null)},L=t.ref({}),m=t.ref("bottom"),Q=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),X={opacity:1,scale:1,y:0},Y=t.computed(()=>({opacity:0,scale:.95,y:m.value==="bottom"?-8:8})),ee={duration:.2,ease:"easeOut"},te=t.computed(()=>({...L.value,transformOrigin:m.value==="bottom"?"top center":"bottom center"})),ae={opacity:0,scale:.8},le={opacity:1,scale:1},oe={opacity:0,scale:.8},ne={duration:.2,ease:"easeOut"},re=t.computed(()=>typeof o.width=="number"?`${o.width}px`:o.width),C=()=>{o.disabled||(i.value=!0)},E=()=>{if(!i.value)return;const e=N.value,a=p.value;if(!e||!a)return;const l=e.getBoundingClientRect(),n=a.offsetHeight||o.popperMaxHeight,x=window.innerHeight-l.bottom-o.popperOffset,fe=l.top-o.popperOffset,O=x>=n||x>=fe?"bottom":"top";m.value=O;const ve=O==="bottom"?l.bottom+o.popperOffset:l.top-n-o.popperOffset;L.value={position:"fixed",top:`${ve}px`,left:`${l.left}px`,width:`${l.width}px`,zIndex:String(o.popperZIndex)}};let f=null;const g=()=>{i.value&&(f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=null,E()}))};let b=null;const ue=()=>{typeof ResizeObserver>"u"||!p.value||(b?.disconnect(),b=new ResizeObserver(()=>g()),b.observe(p.value))},A=()=>{b?.disconnect(),b=null};t.watch(i,async e=>{if(!e){A();return}await t.nextTick(),E(),requestAnimationFrame(E),ue()});const z=e=>{if(!i.value)return;const a=e.target;I.value?.contains(a)||p.value?.contains(a)||(i.value=!1)};t.onMounted(()=>{document.addEventListener("mousedown",z,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g)}),t.onBeforeUnmount(()=>{document.removeEventListener("mousedown",z,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),f&&cancelAnimationFrame(f),A()});const ie=e=>{i.value=!0,T.value?.filter(e),t.nextTick(E)},se=(e,a)=>e?typeof o.filterMethod=="function"?o.filterMethod(e,a):String(d(a)??"").toLowerCase().includes(String(e).toLowerCase()):!0,de=(e,a)=>{if(r("node-click",e),!c(e)){a&&(a.expanded=!a.expanded);return}M(e),i.value=!1},ce=e=>o.valueFormat==="object"?{value:e.value,label:e.label,raw:e.raw}:e.value,M=e=>{const a=v(e);if(a==null||a==="")return;if(w(a)){const s={value:a,label:d(e),raw:e};r("duplicate",s),o.duplicateMessage&&h.ElMessage.warning(o.duplicateMessage);return}const l={value:a,label:d(e),raw:e},n=[...o.modelValue||[],ce(l)];r("update:modelValue",n),r("add",l),r("change",n,[...u.value,l]),o.clearInputAfterSelect&&(k.value="")},pe=()=>{if(!o.enterToAdd)return;const e=(k.value||"").trim();if(!e)return;let a=null;for(const l of S.value.values())if(d(l)===e){a=l;break}if(!a){r("not-found",e),o.notFoundMessage&&h.ElMessage.warning(o.notFoundMessage);return}M(a)},V=e=>{if(e<0||e>=u.value.length)return;const a=u.value[e],l=[...o.modelValue||[]];l.splice(e,1),r("update:modelValue",l),a&&r("remove",a,e);const n=u.value.filter((s,x)=>x!==e);r("change",l,n)};return $({open:C,close:()=>i.value=!1,clear:()=>{r("update:modelValue",[]),r("change",[],[])},addByValue:e=>{const a=S.value.get(e);a&&M(a)},removeByIndex:e=>{V(e)},removeByValue:e=>{const a=u.value.findIndex(l=>l.value===e);a>-1&&V(a)},getSelectedItems:()=>u.value}),(e,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["g-input-tree-tag",{"is-disabled":e.disabled}])},[t.createElementVNode("div",{class:"g-input-tree-tag__wrap",ref_key:"wrapRef",ref:I},[t.createElementVNode("div",{class:"g-input-tree-tag__input-box",ref_key:"inputBoxRef",ref:N,style:t.normalizeStyle({width:re.value})},[t.createVNode(t.unref(h.ElInput),{modelValue:k.value,"onUpdate:modelValue":a[0]||(a[0]=l=>k.value=l),placeholder:e.placeholder,clearable:e.clearable,disabled:e.disabled,class:"g-input-tree-tag__input",onFocus:C,onClick:C,onInput:ie,onKeyup:t.withKeys(pe,["enter"])},null,8,["modelValue","placeholder","clearable","disabled"])],4),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[t.createVNode(t.unref(H.AnimatePresence_default),null,{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createBlock(t.unref(R.motion).div,{key:0,ref:J,class:t.normalizeClass(["g-input-tree-tag__popover",`is-${m.value}`]),style:t.normalizeStyle(te.value),initial:Q.value,animate:X,exit:Y.value,transition:ee,onMousedown:a[1]||(a[1]=t.withModifiers(()=>{},["prevent"]))},{default:t.withCtx(()=>[t.createElementVNode("div",{class:"g-input-tree-tag__tree-wrap",style:t.normalizeStyle({maxHeight:e.popperMaxHeight+"px"})},[t.createVNode(t.unref(h.ElTree),{ref_key:"treeRef",ref:T,data:e.data,props:P.value,"node-key":e.nodeKey,"filter-node-method":se,"expand-on-click-node":!1,"default-expand-all":e.defaultExpandAll,onNodeClick:de},{default:t.withCtx(l=>[t.renderSlot(e.$slots,"tree-node",{data:l?.data,node:l?.node,selectable:c(l?.data),selected:w(v(l?.data))},()=>[l?.data?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["g-input-tree-tag__node",{"is-selectable":c(l.data),"is-selected":c(l.data)&&w(v(l.data))}])},[t.renderSlot(e.$slots,"leaf-icon",{data:l.data,selectable:c(l.data),selected:w(v(l.data))},void 0,!0),t.createTextVNode(" "+t.toDisplayString(d(l.data)),1)],2)):t.createCommentVNode("",!0)],!0)]),_:3},8,["data","props","node-key","default-expand-all"])],4)]),_:3},8,["class","style","initial","exit"])):t.createCommentVNode("",!0)]),_:3})])),u.value.length?(t.openBlock(),t.createElementBlock("div",ge,[t.renderSlot(e.$slots,"tags",{items:u.value,remove:V},()=>[t.createVNode(t.unref(H.AnimatePresence_default),{mode:"popLayout"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,(l,n)=>(t.openBlock(),t.createBlock(t.unref(R.motion).div,{key:l.value,layout:!0,class:"g-input-tree-tag__tag-motion",initial:ae,animate:le,exit:oe,transition:ne},{default:t.withCtx(()=>[t.createVNode(t.unref(h.ElTag),{class:"g-input-tree-tag__tag",type:e.tagType,effect:e.tagEffect,closable:e.closable&&!e.disabled,onClose:s=>V(n)},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"tag",{item:l,index:n},()=>[t.createTextVNode(t.toDisplayString(l.label),1)],!0)]),_:2},1032,["type","effect","closable","onClose"])]),_:2},1024))),128))]),_:3})],!0)])):t.createCommentVNode("",!0)],512)],2))}}),y=me._export_sfc(be,[["__scopeId","data-v-b74dd5d2"]]);y.install=B=>{B.component(y.name,y)};exports.GInputTreeTag=y;exports.default=y;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as Le, computed as n, ref as d, watch as Se, nextTick as W, onMounted as Te, onBeforeUnmount as Ae, createElementBlock as M, openBlock as c, normalizeClass as O, createElementVNode as R, createBlock as $, createCommentVNode as z, normalizeStyle as H, createVNode as k, unref as p, withKeys as Ce, Teleport as Oe, withCtx as b, withModifiers as Re, renderSlot as B, createTextVNode as J, toDisplayString as Q, Fragment as $e, renderList as ze } from "vue";
|
|
2
2
|
import { ElInput as He, ElTree as Ne, ElTag as Ke, ElMessage as X } from "element-plus";
|
|
3
|
-
import { m as Y } from "../index-
|
|
4
|
-
import { A as ee } from "../AnimatePresence-
|
|
3
|
+
import { m as Y } from "../index-Bbr5fWvI.mjs";
|
|
4
|
+
import { A as ee } from "../AnimatePresence-nl0c23TZ.mjs";
|
|
5
5
|
import { _ as je } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
6
6
|
const Ue = {
|
|
7
7
|
key: 0,
|
package/lib/GScroller/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("@vueuse/core"),Y=require("../index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("@vueuse/core"),Y=require("../index-B8Ap0044.js"),ee=require("../_plugin-vue_export-helper-BHFhmbuH.js");function le(p,M){const f=e.ref(!1);return e.watchEffect(t=>{const h=e.unref(M)||{},{once:S}=h,k=x.unrefElement(p);if(!k||S&&f.value)return;const B=()=>(f.value=!0,S?void 0:()=>{f.value=!1}),d=Y.inView(k,B,{...h,root:e.unref(h.root)});t(()=>{d()})},{flush:"post"}),f}const te=["onMouseenter","onClick"],se={class:"g-scroller__item-text"},ae={class:"g-scroller__item-text"},P=80,ne=10,oe=e.defineComponent({__name:"index",props:{items:{default:()=>[]},showGradients:{type:Boolean,default:!0},className:{default:""},itemClassName:{default:""},displayScrollbar:{type:Boolean,default:!0},initialSelectedIndex:{default:-1},height:{},stagger:{default:.05},loading:{type:Boolean,default:!1},skeletonCount:{default:5},seamless:{type:Boolean,default:!1},seamlessSpeed:{default:40},seamlessDirection:{default:"up"},seamlessPauseOnHover:{type:Boolean,default:!0}},emits:["itemSelected"],setup(p,{emit:M}){const f=e.defineComponent({name:"AnimatedItem",props:{index:{type:Number,required:!0},stagger:{type:Number,default:.05},instant:{type:Boolean,default:!1}},emits:["mouseenter","click"],setup(l,{slots:n,emit:s}){const a=e.ref(null),i=le(a,{amount:.5,once:!1});return()=>e.h(Y.motion.div,{ref:a,"data-index":l.index,style:{marginBottom:"1rem",cursor:"pointer"},initial:{x:-24,opacity:0},animate:i.value?{x:0,opacity:1}:{x:-24,opacity:0},transition:l.instant?{duration:0}:{duration:.3,delay:Math.min(l.index*l.stagger,.3),ease:"easeOut"},onMouseenter:m=>s("mouseenter",m),onClick:m=>s("click",m)},n.default?.())}}),t=p,h=M,S=e.useSlots(),k=e.computed(()=>!!S.default),B=e.ref(null),d=e.ref(t.initialSelectedIndex),O=e.ref(0),$=e.ref(1),F=e.ref(0),_=e.ref(0),E=e.ref(!1);let c=null;const T=e.ref(!1);let z=0,N=0,u=null;const L=e.ref(null),D=e.ref(null),W=e.computed(()=>t.seamless&&t.items.length>0?[...t.items,...t.items]:t.items),o=e.ref(0),C=e.ref(!1),r=e.ref(0),V=e.ref(!1);let v=null,g=0;const U=e.computed(()=>{const l={};return t.height!=null&&t.height!==""&&(l.height=typeof t.height=="number"?`${t.height}px`:String(t.height)),l}),j=e.computed(()=>({transform:`translateY(${o.value}px)`}));function K(l,n,s){return Math.min(Math.max(l,n),s)}const R=l=>{d.value=l},q=(l,n)=>{d.value=n,h("itemSelected",l,n)},X=l=>{const n=l.target,{scrollTop:s,scrollHeight:a,clientHeight:i}=n,m=performance.now();N>0&&Math.abs(s-z)/(m-N)>ne&&(T.value=!0),z=s,N=m,u&&clearTimeout(u),u=setTimeout(()=>{T.value=!1},150),O.value=Math.min(s/50,1);const I=a-(s+i);$.value=a<=i?0:Math.min(I/50,1)};function J(l){const n=B.value;if(!n)return;const{scrollTop:s,scrollHeight:a,clientHeight:i}=n;if(a<=i)return;const m=s<=0,I=s+i>=a-1;if(m&&l.deltaY<0||I&&l.deltaY>0){const G=K(_.value-l.deltaY*.3,-P,P);_.value=G,E.value=!0,c&&clearTimeout(c),c=setTimeout(()=>{_.value=0,E.value=!1},150)}}function w(){const l=D.value;if(!l||t.items.length===0){r.value=0,V.value=!1;return}const n=t.items.length,s=l.children[n];r.value=s?s.offsetTop:l.scrollHeight/2;const a=L.value;V.value=a?r.value>a.clientHeight:!0}function A(l){g===0&&(g=l);const n=l-g;if(g=l,!C.value&&r.value>0&&t.items.length>0){const s=t.seamlessSpeed*n/1e3;t.seamlessDirection==="down"?(o.value+=s,o.value>=0&&(o.value-=r.value)):(o.value-=s,o.value<=-r.value&&(o.value+=r.value))}v=requestAnimationFrame(A)}function b(){v==null&&(g=0,v=requestAnimationFrame(A))}function H(){v!=null&&(cancelAnimationFrame(v),v=null),g=0}function Q(){t.seamlessPauseOnHover&&(C.value=!0)}function Z(){t.seamlessPauseOnHover&&(C.value=!1)}return e.onMounted(()=>{t.seamless&&!t.loading&&(w(),o.value=t.seamlessDirection==="down"?-r.value:0,b())}),e.onUnmounted(()=>{H(),c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null)}),e.watch(()=>t.items,()=>{t.seamless&&e.nextTick(()=>{w(),o.value=t.seamlessDirection==="down"?-r.value:0}),F.value++,d.value=-1}),e.watch(()=>t.seamless,l=>{l&&!t.loading?e.nextTick(()=>{w(),o.value=t.seamlessDirection==="down"?-r.value:0,b()}):(H(),o.value=0,C.value=!1)}),e.watch(()=>t.loading,l=>{l?(_.value=0,E.value=!1,T.value=!1,H(),c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null)):t.seamless&&e.nextTick(()=>{w(),o.value=t.seamlessDirection==="down"?-r.value:0,b()})}),(l,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["g-scroller",l.className]),style:e.normalizeStyle(U.value)},[l.seamless&&!l.loading?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"seamlessWrapRef",ref:L,class:"g-scroller__seamless",onMouseenter:Q,onMouseleave:Z},[e.createElementVNode("div",{ref_key:"seamlessTrackRef",ref:D,class:"g-scroller__seamless-track",style:e.normalizeStyle(j.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(W.value,(s,a)=>(e.openBlock(),e.createElementBlock("div",{key:`seamless-${a}`,class:e.normalizeClass(["g-scroller__item","g-scroller__item--seamless",!k.value&&"g-scroller__item--default",d.value===a%l.items.length&&"g-scroller__item--active",l.itemClassName]),onMouseenter:i=>R(a%l.items.length),onClick:i=>q(s,a%l.items.length)},[e.renderSlot(l.$slots,"default",{item:s,index:a%l.items.length},()=>[e.createElementVNode("p",se,e.toDisplayString(s),1)],!0)],42,te))),128))],4),l.showGradients&&V.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n[0]||(n[0]=e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--top"},null,-1)),n[1]||(n[1]=e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--bottom"},null,-1))],64)):e.createCommentVNode("",!0)],544)):l.loading?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["g-scroller__list",!l.displayScrollbar&&"g-scroller__list--hidden-scrollbar"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.skeletonCount,s=>(e.openBlock(),e.createElementBlock("div",{key:`skeleton-${s}`,class:"g-scroller__skeleton"},n[2]||(n[2]=[e.createElementVNode("div",{class:"g-scroller__skeleton-line"},null,-1)])))),128))],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",{ref_key:"listRef",ref:B,class:e.normalizeClass(["g-scroller__list",!l.displayScrollbar&&"g-scroller__list--hidden-scrollbar"]),onScroll:X,onWheel:J},[e.createElementVNode("div",{class:e.normalizeClass(["g-scroller__content",{"g-scroller__content--pulling":E.value}]),style:e.normalizeStyle({transform:`translateY(${_.value}px)`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,(s,a)=>(e.openBlock(),e.createBlock(e.unref(f),{key:`${F.value}-${a}`,index:a,stagger:l.stagger,instant:T.value,onMouseenter:i=>R(a),onClick:i=>q(s,a)},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["g-scroller__item",!k.value&&"g-scroller__item--default",d.value===a&&"g-scroller__item--active",l.itemClassName])},[e.renderSlot(l.$slots,"default",{item:s,index:a},()=>[e.createElementVNode("p",ae,e.toDisplayString(s),1)],!0)],2)]),_:2},1032,["index","stagger","instant","onMouseenter","onClick"]))),128))],6)],34),l.showGradients?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--top",style:e.normalizeStyle({opacity:O.value})},null,4),e.createElementVNode("div",{class:"g-scroller__gradient g-scroller__gradient--bottom",style:e.normalizeStyle({opacity:$.value})},null,4)],64)):e.createCommentVNode("",!0)],64))],6))}}),y=ee._export_sfc(oe,[["__scopeId","data-v-972060e6"]]);y.install=p=>{p.component(y.name,y)};exports.GScroller=y;exports.default=y;
|
package/lib/GScroller/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref as n, watchEffect as de, unref as W, defineComponent as ee, h as ve, useSlots as ge, computed as B, onMounted as pe, onUnmounted as he, watch as G, nextTick as P, createElementBlock as c, openBlock as r, normalizeStyle as C, normalizeClass as y, createElementVNode as m, createCommentVNode as le, Fragment as k, renderList as V, renderSlot as te, toDisplayString as se, createBlock as _e, withCtx as ye } from "vue";
|
|
2
2
|
import { unrefElement as ke } from "@vueuse/core";
|
|
3
|
-
import { i as Se, m as Te } from "../index-
|
|
3
|
+
import { i as Se, m as Te } from "../index-Bbr5fWvI.mjs";
|
|
4
4
|
import { _ as we } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
5
|
function Me(S, E) {
|
|
6
6
|
const p = n(!1);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),u=require("../index-B8Ap0044.js");function A(...t){const e=!Array.isArray(t[0]),l=e?0:-1,n=t[0+l],s=t[1+l],r=t[2+l],c=t[3+l],o=u.interpolate(s,r,c);return e?o(n):o}function S(t){let e=0;const l=({timestamp:s,delta:r})=>{e||(e=s),t(s-e,r)},n=()=>u.cancelFrame(l);a.onBeforeUpdate(()=>{n(),u.frame.update(l,!0)}),a.onUnmounted(()=>n()),u.frame.update(l,!0)}function k(t){const e=u.motionValue(t()),l=()=>e.set(t()),n=()=>u.frame.preRender(l,!1,!0);let s;const r=o=>{s=o.map(i=>i.on("change",n))},c=()=>{s.forEach(o=>o()),u.cancelFrame(l)};return a.getCurrentInstance()&&a.onUnmounted(()=>{c()}),{subscribe:r,unsubscribe:c,value:e,updateValue:l}}function T(t){u.collectMotionValues.current=[];const{value:e,subscribe:l,unsubscribe:n,updateValue:s}=k(t);return l(u.collectMotionValues.current),u.collectMotionValues.current=void 0,a.watchEffect(()=>{n(),u.collectMotionValues.current=[],s(),l(u.collectMotionValues.current),u.collectMotionValues.current=void 0}),e}function B(t,e,l,n){if(typeof t=="function")return T(t);let s,r;if(typeof e=="function")r=e,s=Array.isArray(t)?t:[t];else if(a.isRef(e)){const o=u.motionValue(0);let i=A(e.value,l,n);a.watch(e,v=>{i=A(v,l,n),o.set(o.get()+1)},{flush:"sync"}),r=v=>Array.isArray(v)?i(v[0]):i(v),s=Array.isArray(t)?[...t,o]:[t,o]}else r=A(e,l,n),s=Array.isArray(t)?t:[t];const c=Array.isArray(t)?M(s,r):M(s,o=>r(o[0]));if(!Array.isArray(t)){const o=t.accelerate;if(o&&!o.isTransformed&&typeof e!="function"&&Array.isArray(l)&&n?.clamp!==!1){const i=a.isRef(e)?e.value:e;c.accelerate={...o,times:i,keyframes:l,isTransformed:!0}}}return c}function M(t,e){const l=[],n=()=>{l.length=0;const c=t.length;for(let o=0;o<c;o++)l[o]=t[o].get();return e(l)},{value:s,subscribe:r}=k(n);return r(t),s}const m=a.defineComponent({__name:"index",props:{text:{},disabled:{type:Boolean,default:!1},speed:{default:2},className:{default:""},color:{default:"#b5b5b5"},shineColor:{default:"#ffffff"},spread:{default:120},yoyo:{type:Boolean,default:!1},pauseOnHover:{type:Boolean,default:!1},direction:{default:"left"},delay:{default:0}},setup(t){const e=t,l=a.ref(!1),n=u.motionValue(0),s=a.ref(0),r=a.ref(null),c=a.ref(e.direction==="left"?1:-1),o=a.computed(()=>e.speed*1e3),i=a.computed(()=>e.delay*1e3);S(f=>{if(e.disabled||l.value){r.value=null;return}if(r.value===null){r.value=f;return}const V=f-r.value;if(r.value=f,s.value+=V,e.yoyo){const y=o.value+i.value,b=y*2,d=s.value%b;if(d<o.value){const p=d/o.value*100;n.set(c.value===1?p:100-p)}else if(d<y)n.set(c.value===1?100:0);else if(d<y+o.value){const h=100-(d-y)/o.value*100;n.set(c.value===1?h:100-h)}else n.set(c.value===1?0:100)}else{const y=o.value+i.value,b=s.value%y;if(b<o.value){const d=b/o.value*100;n.set(c.value===1?d:100-d)}else n.set(c.value===1?100:0)}}),a.watch(()=>e.direction,()=>{c.value=e.direction==="left"?1:-1,s.value=0,n.set(0)},{immediate:!0});const v=B(n,f=>`${150-f*2}% center`),C=()=>{e.pauseOnHover&&(l.value=!0)},g=()=>{e.pauseOnHover&&(l.value=!1)},x=a.computed(()=>({backgroundImage:`linear-gradient(${e.spread}deg, ${e.color} 0%, ${e.color} 35%, ${e.shineColor} 50%, ${e.color} 65%, ${e.color} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"}));return(f,V)=>(a.openBlock(),a.createBlock(a.unref(u.Motion),{tag:"span",class:a.normalizeClass(["inline-block",f.className]),style:a.normalizeStyle({...x.value,backgroundPosition:a.unref(v)}),onMouseenter:C,onMouseleave:g},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(f.text),1)]),_:1},8,["class","style"]))}});m.install=t=>{t.component(m.name,m)};exports.GShinyText=m;exports.default=m;
|