miao-design 1.0.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/README.md +76 -0
- package/dist/alert/Alert.vue.d.ts +27 -0
- package/dist/alert/index.d.ts +2 -0
- package/dist/alert/types.d.ts +20 -0
- package/dist/avatar/Avatar.vue.d.ts +18 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/types.d.ts +19 -0
- package/dist/button/Button.vue.d.ts +26 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/types.d.ts +21 -0
- package/dist/button-group/ButtonGroup.vue.d.ts +17 -0
- package/dist/button-group/context.d.ts +14 -0
- package/dist/button-group/index.d.ts +2 -0
- package/dist/button-group/types.d.ts +16 -0
- package/dist/checkbox/Checkbox.vue.d.ts +23 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +23 -0
- package/dist/checkbox/context.d.ts +15 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/types.d.ts +35 -0
- package/dist/date-picker/DatePicker.vue.d.ts +21 -0
- package/dist/date-picker/TimeSpinner.vue.d.ts +18 -0
- package/dist/date-picker/date-utils.d.ts +15 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/types.d.ts +31 -0
- package/dist/date-range-picker/DateRangePicker.vue.d.ts +22 -0
- package/dist/date-range-picker/index.d.ts +2 -0
- package/dist/date-range-picker/types.d.ts +35 -0
- package/dist/dialog/Dialog.vue.d.ts +36 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/types.d.ts +30 -0
- package/dist/directives/ripple.d.ts +58 -0
- package/dist/drawer/Drawer.vue.d.ts +35 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/types.d.ts +26 -0
- package/dist/dropdown/Dropdown.vue.d.ts +32 -0
- package/dist/dropdown/DropdownItem.vue.d.ts +21 -0
- package/dist/dropdown/context.d.ts +13 -0
- package/dist/dropdown/index.d.ts +3 -0
- package/dist/dropdown/types.d.ts +45 -0
- package/dist/fab/Fab.vue.d.ts +26 -0
- package/dist/fab/index.d.ts +2 -0
- package/dist/fab/types.d.ts +21 -0
- package/dist/index.d.ts +27 -0
- package/dist/input/Input.vue.d.ts +34 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/types.d.ts +24 -0
- package/dist/input-number/InputNumber.vue.d.ts +23 -0
- package/dist/input-number/index.d.ts +2 -0
- package/dist/input-number/types.d.ts +29 -0
- package/dist/miao-design.css +2 -0
- package/dist/miao-design.js +4103 -0
- package/dist/miao-design.umd.cjs +1 -0
- package/dist/radio/Radio.vue.d.ts +22 -0
- package/dist/radio/RadioGroup.vue.d.ts +23 -0
- package/dist/radio/context.d.ts +17 -0
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/types.d.ts +34 -0
- package/dist/select/Select.vue.d.ts +16 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/types.d.ts +27 -0
- package/dist/slider/Slider.vue.d.ts +18 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/types.d.ts +23 -0
- package/dist/switch/Switch.vue.d.ts +25 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/types.d.ts +20 -0
- package/dist/tabs/TabPane.vue.d.ts +16 -0
- package/dist/tabs/Tabs.vue.d.ts +30 -0
- package/dist/tabs/context.d.ts +33 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/types.d.ts +39 -0
- package/dist/toast/MToast.vue.d.ts +26 -0
- package/dist/toast/ToastCard.vue.d.ts +11 -0
- package/dist/toast/ToastContainer.vue.d.ts +3 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/service.d.ts +15 -0
- package/dist/toast/state.d.ts +6 -0
- package/dist/toast/types.d.ts +46 -0
- package/dist/tooltip/Tooltip.vue.d.ts +32 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/types.d.ts +30 -0
- package/dist/utils/scroll-lock.d.ts +2 -0
- package/dist/utils/throttle.d.ts +2 -0
- package/package.json +35 -0
|
@@ -0,0 +1,4103 @@
|
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, TransitionGroup as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, inject as f, mergeDefaults as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, openBlock as v, provide as y, reactive as b, ref as x, render as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, vShow as D, watch as O, watchEffect as k, withCtx as A, withDirectives as j, withModifiers as M } from "vue";
|
|
2
|
+
//#region packages/miao-ui/src/alert/types.ts
|
|
3
|
+
var N = {
|
|
4
|
+
severity: "info",
|
|
5
|
+
variant: "standard",
|
|
6
|
+
closable: !1,
|
|
7
|
+
showIcon: !0
|
|
8
|
+
}, P = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "m-alert__icon",
|
|
11
|
+
"aria-hidden": "true"
|
|
12
|
+
}, F = {
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
fill: "currentColor"
|
|
15
|
+
}, I = ["d"], L = { class: "m-alert__content" }, ee = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "m-alert__title"
|
|
18
|
+
}, R = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "m-alert__message"
|
|
21
|
+
}, z = /* @__PURE__ */ d({
|
|
22
|
+
__name: "Alert",
|
|
23
|
+
props: /*@__PURE__*/ p({
|
|
24
|
+
severity: {},
|
|
25
|
+
variant: {},
|
|
26
|
+
closable: { type: Boolean },
|
|
27
|
+
showIcon: { type: Boolean },
|
|
28
|
+
title: {}
|
|
29
|
+
}, N),
|
|
30
|
+
emits: ["close"],
|
|
31
|
+
setup(e, { emit: t }) {
|
|
32
|
+
let r = e, u = t, d = x(!1), f = i(() => [
|
|
33
|
+
"m-alert",
|
|
34
|
+
`m-alert--${r.severity}`,
|
|
35
|
+
`m-alert--${r.variant}`,
|
|
36
|
+
d.value && "is-closed"
|
|
37
|
+
]), p = {
|
|
38
|
+
success: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm4.3 7.3L10 15.6l-2.3-2.3a1 1 0 1 0-1.4 1.4l3 3a1 1 0 0 0 1.4 0l7-7a1 1 0 1 0-1.4-1.4z",
|
|
39
|
+
info: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0-4a1.25 1.25 0 1 0 0 2.5A1.25 1.25 0 0 0 12 7z",
|
|
40
|
+
warning: "M11.5 2.6a1.4 1.4 0 0 1 2.4 0l8.5 14.6a1.4 1.4 0 0 1-1.2 2.1H4.8a1.4 1.4 0 0 1-1.2-2.1L11.5 2.6zM12 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 7.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z",
|
|
41
|
+
error: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 6.5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z"
|
|
42
|
+
};
|
|
43
|
+
function m() {
|
|
44
|
+
d.value = !0, u("close");
|
|
45
|
+
}
|
|
46
|
+
return (t, r) => (v(), a(n, { name: "m-alert" }, {
|
|
47
|
+
default: A(() => [d.value ? o("", !0) : (v(), s("div", {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: h(f.value),
|
|
50
|
+
role: "alert"
|
|
51
|
+
}, [
|
|
52
|
+
e.showIcon && !t.$slots.icon ? (v(), s("span", P, [(v(), s("svg", F, [c("path", { d: p[e.severity] }, null, 8, I)]))])) : o("", !0),
|
|
53
|
+
w(t.$slots, "icon"),
|
|
54
|
+
c("div", L, [e.title || t.$slots.title ? (v(), s("div", ee, [w(t.$slots, "title", {}, () => [l(T(e.title), 1)])])) : o("", !0), t.$slots.default ? (v(), s("div", R, [w(t.$slots, "default")])) : o("", !0)]),
|
|
55
|
+
e.closable ? (v(), s("button", {
|
|
56
|
+
key: 1,
|
|
57
|
+
type: "button",
|
|
58
|
+
class: "m-alert__close",
|
|
59
|
+
"aria-label": "关闭提示",
|
|
60
|
+
onClick: m
|
|
61
|
+
}, [...r[0] ||= [c("svg", {
|
|
62
|
+
viewBox: "0 0 24 24",
|
|
63
|
+
width: "16",
|
|
64
|
+
height: "16",
|
|
65
|
+
fill: "none",
|
|
66
|
+
stroke: "currentColor",
|
|
67
|
+
"stroke-width": "2.4",
|
|
68
|
+
"stroke-linecap": "round",
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])) : o("", !0)
|
|
71
|
+
], 2))]),
|
|
72
|
+
_: 3
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}), B = {
|
|
76
|
+
size: 40,
|
|
77
|
+
shape: "circle",
|
|
78
|
+
color: "primary"
|
|
79
|
+
}, V = ["src", "alt"], te = {
|
|
80
|
+
key: 1,
|
|
81
|
+
class: "m-avatar__content"
|
|
82
|
+
}, H = {
|
|
83
|
+
key: 2,
|
|
84
|
+
class: "m-avatar__text"
|
|
85
|
+
}, U = {
|
|
86
|
+
key: 3,
|
|
87
|
+
class: "m-avatar__fallback",
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
"stroke-width": "1.6",
|
|
92
|
+
"stroke-linecap": "round",
|
|
93
|
+
"stroke-linejoin": "round",
|
|
94
|
+
"aria-hidden": "true"
|
|
95
|
+
}, W = /* @__PURE__ */ d({
|
|
96
|
+
__name: "Avatar",
|
|
97
|
+
props: /*@__PURE__*/ p({
|
|
98
|
+
src: {},
|
|
99
|
+
alt: {},
|
|
100
|
+
size: {},
|
|
101
|
+
shape: {},
|
|
102
|
+
color: {}
|
|
103
|
+
}, B),
|
|
104
|
+
setup(e) {
|
|
105
|
+
let t = e, n = x(!1);
|
|
106
|
+
O(() => t.src, () => n.value = !1);
|
|
107
|
+
let r = i(() => typeof t.size == "string" ? `m-avatar--${t.size}` : ""), a = i(() => typeof t.size == "number" ? `${t.size}px` : void 0), o = i(() => [
|
|
108
|
+
"m-avatar",
|
|
109
|
+
`m-avatar--${t.shape}`,
|
|
110
|
+
`m-avatar--${t.color}`,
|
|
111
|
+
r.value
|
|
112
|
+
]), l = i(() => !!t.src && !n.value), u = i(() => (t.alt ?? "").trim().slice(0, 1).toUpperCase());
|
|
113
|
+
return (t, r) => (v(), s("div", {
|
|
114
|
+
class: h(o.value),
|
|
115
|
+
style: g(a.value ? {
|
|
116
|
+
width: a.value,
|
|
117
|
+
height: a.value,
|
|
118
|
+
fontSize: `calc(${a.value} * 0.42)`
|
|
119
|
+
} : void 0)
|
|
120
|
+
}, [l.value ? (v(), s("img", {
|
|
121
|
+
key: 0,
|
|
122
|
+
class: "m-avatar__img",
|
|
123
|
+
src: e.src,
|
|
124
|
+
alt: e.alt,
|
|
125
|
+
onError: r[0] ||= (e) => n.value = !0
|
|
126
|
+
}, null, 40, V)) : t.$slots.default ? (v(), s("span", te, [w(t.$slots, "default")])) : u.value ? (v(), s("span", H, T(u.value), 1)) : (v(), s("svg", U, [...r[1] ||= [c("circle", {
|
|
127
|
+
cx: "12",
|
|
128
|
+
cy: "8",
|
|
129
|
+
r: "4"
|
|
130
|
+
}, null, -1), c("path", { d: "M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5" }, null, -1)]]))], 6));
|
|
131
|
+
}
|
|
132
|
+
}), ne = {
|
|
133
|
+
type: "button",
|
|
134
|
+
disabled: !1,
|
|
135
|
+
loading: !1,
|
|
136
|
+
size: "default",
|
|
137
|
+
variant: "text",
|
|
138
|
+
throttle: 200,
|
|
139
|
+
shape: ""
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region packages/miao-ui/src/utils/throttle.ts
|
|
143
|
+
function G(e, t) {
|
|
144
|
+
let n = 0;
|
|
145
|
+
return function(...r) {
|
|
146
|
+
let i = Date.now();
|
|
147
|
+
i - n >= t && (e.apply(this, r), n = i);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region packages/miao-ui/src/directives/ripple.ts
|
|
152
|
+
var K = 550, q = 80, J = "keyboard";
|
|
153
|
+
function re(e, t) {
|
|
154
|
+
return t === !1 || t && typeof t == "object" && t.disabled ? !0 : e.disabled || e.getAttribute("aria-disabled") === "true";
|
|
155
|
+
}
|
|
156
|
+
function ie(e) {
|
|
157
|
+
try {
|
|
158
|
+
return e.matches(":focus-visible");
|
|
159
|
+
} catch {
|
|
160
|
+
return !1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function Y(e, t, n, r) {
|
|
164
|
+
let i = e.getBoundingClientRect();
|
|
165
|
+
if (r) {
|
|
166
|
+
let e = Math.round(i.width / 2), t = Math.round(i.height / 2), n = Math.sqrt((2 * i.width ** 2 + i.height ** 2) / 3);
|
|
167
|
+
return n % 2 == 0 && (n += 1), {
|
|
168
|
+
rippleX: e,
|
|
169
|
+
rippleY: t,
|
|
170
|
+
rippleSize: n
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
let a = Math.round(t), o = Math.round(n), s = Math.max(Math.abs(e.clientWidth - a), a) * 2 + 2, c = Math.max(Math.abs(e.clientHeight - o), o) * 2 + 2;
|
|
174
|
+
return {
|
|
175
|
+
rippleX: a,
|
|
176
|
+
rippleY: o,
|
|
177
|
+
rippleSize: Math.sqrt(s ** 2 + c ** 2)
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function X(e, t) {
|
|
181
|
+
let n = e.__rippleContainer, r = e.__rippleState, i = t.pending;
|
|
182
|
+
if (!n || !i || t.wave || t.leaving) return;
|
|
183
|
+
t.pending = void 0;
|
|
184
|
+
let { rippleX: a, rippleY: o, rippleSize: s } = Y(e, i.x, i.y, i.center), c = r?.value && typeof r.value == "object" ? r.value : void 0, l = c?.color, u = c?.duration, d = c?.initialScale, f = document.createElement("span");
|
|
185
|
+
f.className = i.pulsate ? "m-ripple-wave m-ripple-wave--pulsate" : "m-ripple-wave m-ripple-wave--active", f.style.width = `${s}px`, f.style.height = `${s}px`, f.style.left = `${a - s / 2}px`, f.style.top = `${o - s / 2}px`, u && f.style.setProperty("--m-ripple-duration", `${u}ms`), t.duration = u, d != null && f.style.setProperty("--m-ripple-initial-scale", `${d}`);
|
|
186
|
+
let p = document.createElement("span");
|
|
187
|
+
p.className = i.pulsate ? "m-ripple-child m-ripple-child--pulsate" : "m-ripple-child", l && (f.style.backgroundColor = l, p.style.backgroundColor = l), f.appendChild(p), n.appendChild(f), t.wave = f, t.child = p;
|
|
188
|
+
}
|
|
189
|
+
function ae(e) {
|
|
190
|
+
!e.wave || e.leaving || (e.leaving = !0, e.child?.classList.add("m-ripple-child--leaving"), window.setTimeout(() => e.wave?.remove(), (e.duration ?? K) + 50));
|
|
191
|
+
}
|
|
192
|
+
function Z(e, t) {
|
|
193
|
+
let n = e.__rippleWaves?.get(t);
|
|
194
|
+
n && (n.timer !== void 0 && window.clearTimeout(n.timer), e.__rippleWaves?.delete(t), ae(n));
|
|
195
|
+
}
|
|
196
|
+
function oe(e, t) {
|
|
197
|
+
if (re(e, e.__rippleState?.value) || t.pointerType === "mouse" && t.button !== 0 || e.__rippleWaves?.has(t.pointerId)) return;
|
|
198
|
+
let n = e.getBoundingClientRect(), r = {
|
|
199
|
+
x: t.clientX - n.left,
|
|
200
|
+
y: t.clientY - n.top,
|
|
201
|
+
center: !!(e.__rippleState?.value && typeof e.__rippleState.value == "object" ? e.__rippleState.value : void 0)?.center,
|
|
202
|
+
pulsate: !1
|
|
203
|
+
};
|
|
204
|
+
if (t.pointerType === "mouse") {
|
|
205
|
+
let n = {
|
|
206
|
+
leaving: !1,
|
|
207
|
+
pending: r
|
|
208
|
+
};
|
|
209
|
+
e.__rippleWaves.set(t.pointerId, n), X(e, n);
|
|
210
|
+
} else {
|
|
211
|
+
let n = {
|
|
212
|
+
leaving: !1,
|
|
213
|
+
pending: r
|
|
214
|
+
};
|
|
215
|
+
e.__rippleWaves.set(t.pointerId, n), n.timer = window.setTimeout(() => {
|
|
216
|
+
n.timer = void 0, n.pending && X(e, n);
|
|
217
|
+
}, q);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function se(e, t) {
|
|
221
|
+
if (t.pointerType === "mouse") return;
|
|
222
|
+
let n = e.__rippleWaves?.get(t.pointerId);
|
|
223
|
+
n && (n.timer === void 0 ? n.wave && Z(e, t.pointerId) : (window.clearTimeout(n.timer), n.timer = void 0, e.__rippleWaves?.delete(t.pointerId)));
|
|
224
|
+
}
|
|
225
|
+
function ce(e, t) {
|
|
226
|
+
let n = e.__rippleWaves?.get(t.pointerId);
|
|
227
|
+
if (n) {
|
|
228
|
+
if (n.timer !== void 0 && (window.clearTimeout(n.timer), n.timer = void 0, n.pending)) {
|
|
229
|
+
e.__rippleWaves?.delete(t.pointerId), X(e, n), ae(n);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
Z(e, t.pointerId);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function le(e, t) {
|
|
236
|
+
Z(e, t.pointerId);
|
|
237
|
+
}
|
|
238
|
+
function ue(e, t) {
|
|
239
|
+
t.pointerType === "mouse" && Z(e, t.pointerId);
|
|
240
|
+
}
|
|
241
|
+
function de(e) {
|
|
242
|
+
if (!ie(e) || e.__rippleWaves?.has(J) || re(e, e.__rippleState?.value)) return;
|
|
243
|
+
let t = {
|
|
244
|
+
leaving: !1,
|
|
245
|
+
pending: {
|
|
246
|
+
x: 0,
|
|
247
|
+
y: 0,
|
|
248
|
+
center: !0,
|
|
249
|
+
pulsate: !0
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
e.__rippleWaves.set(J, t), X(e, t);
|
|
253
|
+
}
|
|
254
|
+
function fe(e, t) {
|
|
255
|
+
if (!re(e, e.__rippleState?.value) && (t.key === "Enter" || t.key === " ") && !t.repeat && !e.__rippleWaves?.has(J)) {
|
|
256
|
+
let t = {
|
|
257
|
+
leaving: !1,
|
|
258
|
+
pending: {
|
|
259
|
+
x: 0,
|
|
260
|
+
y: 0,
|
|
261
|
+
center: !0,
|
|
262
|
+
pulsate: !0
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
e.__rippleWaves.set(J, t), X(e, t);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function pe(e) {
|
|
269
|
+
Z(e, J);
|
|
270
|
+
}
|
|
271
|
+
var Q = {
|
|
272
|
+
mounted(e, t) {
|
|
273
|
+
getComputedStyle(e).position === "static" && (e.style.position = "relative");
|
|
274
|
+
let n = document.createElement("span");
|
|
275
|
+
n.className = "m-ripple", e.appendChild(n), e.__rippleContainer = n, e.__rippleWaves = /* @__PURE__ */ new Map(), e.__rippleState = { value: t.value };
|
|
276
|
+
let r = [
|
|
277
|
+
["pointerdown", (t) => oe(e, t)],
|
|
278
|
+
["pointermove", (t) => se(e, t)],
|
|
279
|
+
["pointerup", (t) => ce(e, t)],
|
|
280
|
+
["pointercancel", (t) => le(e, t)],
|
|
281
|
+
["pointerleave", (t) => ue(e, t)],
|
|
282
|
+
["focus", () => de(e)],
|
|
283
|
+
["keydown", (t) => fe(e, t)],
|
|
284
|
+
["blur", () => pe(e)]
|
|
285
|
+
];
|
|
286
|
+
for (let [t, n] of r) e.addEventListener(t, n);
|
|
287
|
+
e.__rippleHandlers = r;
|
|
288
|
+
},
|
|
289
|
+
updated(e, t) {
|
|
290
|
+
e.__rippleState && (e.__rippleState.value = t.value);
|
|
291
|
+
},
|
|
292
|
+
beforeUnmount(e) {
|
|
293
|
+
e.__rippleHandlers?.forEach(([t, n]) => {
|
|
294
|
+
e.removeEventListener(t, n);
|
|
295
|
+
}), e.__rippleWaves?.forEach((e) => {
|
|
296
|
+
e.timer !== void 0 && window.clearTimeout(e.timer), e.wave?.remove();
|
|
297
|
+
}), e.__rippleContainer?.remove(), e.__rippleContainer = void 0, e.__rippleWaves = void 0, e.__rippleHandlers = void 0, e.__rippleState = void 0;
|
|
298
|
+
}
|
|
299
|
+
}, me = Symbol("m-button-group-context"), he = ["type", "disabled"], ge = {
|
|
300
|
+
key: 0,
|
|
301
|
+
class: "m-button__spinner",
|
|
302
|
+
viewBox: "0 0 24 24",
|
|
303
|
+
fill: "none",
|
|
304
|
+
"aria-hidden": "true"
|
|
305
|
+
}, _e = { class: "m-button__content" }, ve = /* @__PURE__ */ d({
|
|
306
|
+
__name: "Button",
|
|
307
|
+
props: /*@__PURE__*/ p({
|
|
308
|
+
color: {},
|
|
309
|
+
disabled: { type: Boolean },
|
|
310
|
+
variant: {},
|
|
311
|
+
loading: { type: Boolean },
|
|
312
|
+
type: {},
|
|
313
|
+
size: {},
|
|
314
|
+
throttle: {},
|
|
315
|
+
shape: {}
|
|
316
|
+
}, ne),
|
|
317
|
+
emits: ["click"],
|
|
318
|
+
setup(e, { emit: t }) {
|
|
319
|
+
let n = e, r = t, a = f(me, null), l = i(() => n.color ?? a?.color), u = i(() => a?.variant ?? n.variant), d = i(() => a?.size ?? n.size), p = i(() => n.disabled || !!a?.disabled), m = i(() => [
|
|
320
|
+
"m-button",
|
|
321
|
+
l.value && `m-button--${l.value}`,
|
|
322
|
+
p.value && "is-disabled",
|
|
323
|
+
n.loading && "is-loading",
|
|
324
|
+
d.value && `m-button--${d.value}`,
|
|
325
|
+
u.value && `m-button--${u.value}`,
|
|
326
|
+
n.shape && `m-button--${n.shape}`,
|
|
327
|
+
a && "m-button--in-group"
|
|
328
|
+
].filter(Boolean)), g = G((e) => {
|
|
329
|
+
r("click", e);
|
|
330
|
+
}, n.throttle || 0);
|
|
331
|
+
function _(e) {
|
|
332
|
+
p.value || g(e);
|
|
333
|
+
}
|
|
334
|
+
return (t, n) => j((v(), s("button", {
|
|
335
|
+
type: e.type,
|
|
336
|
+
"aria-role": "button",
|
|
337
|
+
class: h(m.value),
|
|
338
|
+
disabled: p.value || e.loading,
|
|
339
|
+
onClick: _
|
|
340
|
+
}, [e.loading ? (v(), s("svg", ge, [...n[0] ||= [c("circle", {
|
|
341
|
+
class: "m-button__spinner-track",
|
|
342
|
+
cx: "12",
|
|
343
|
+
cy: "12",
|
|
344
|
+
r: "10"
|
|
345
|
+
}, null, -1), c("circle", {
|
|
346
|
+
class: "m-button__spinner-indicator",
|
|
347
|
+
cx: "12",
|
|
348
|
+
cy: "12",
|
|
349
|
+
r: "10"
|
|
350
|
+
}, null, -1)]])) : o("", !0), c("span", _e, [w(t.$slots, "default")])], 10, he)), [[E(Q)]]);
|
|
351
|
+
}
|
|
352
|
+
}), ye = /* @__PURE__ */ d({
|
|
353
|
+
__name: "ButtonGroup",
|
|
354
|
+
props: /*@__PURE__*/ p({
|
|
355
|
+
variant: {},
|
|
356
|
+
color: {},
|
|
357
|
+
size: {},
|
|
358
|
+
disabled: { type: Boolean }
|
|
359
|
+
}, {
|
|
360
|
+
variant: "outlined",
|
|
361
|
+
disabled: !1
|
|
362
|
+
}),
|
|
363
|
+
setup(e) {
|
|
364
|
+
let t = e, n = {
|
|
365
|
+
color: t.color,
|
|
366
|
+
variant: t.variant,
|
|
367
|
+
size: t.size ?? "default",
|
|
368
|
+
disabled: t.disabled
|
|
369
|
+
};
|
|
370
|
+
y(me, n);
|
|
371
|
+
let r = i(() => [
|
|
372
|
+
"m-button-group",
|
|
373
|
+
`m-button-group--${t.variant}`,
|
|
374
|
+
t.disabled && "is-disabled"
|
|
375
|
+
]);
|
|
376
|
+
return (e, t) => (v(), s("div", {
|
|
377
|
+
class: h(r.value),
|
|
378
|
+
role: "group",
|
|
379
|
+
"aria-label": "按钮组"
|
|
380
|
+
}, [w(e.$slots, "default")], 2));
|
|
381
|
+
}
|
|
382
|
+
}), be = {
|
|
383
|
+
disabled: !1,
|
|
384
|
+
indeterminate: !1
|
|
385
|
+
}, xe = {
|
|
386
|
+
disabled: !1,
|
|
387
|
+
vertical: !1
|
|
388
|
+
}, Se = Symbol("m-checkbox-group-context"), Ce = [
|
|
389
|
+
"name",
|
|
390
|
+
"value",
|
|
391
|
+
"checked",
|
|
392
|
+
"disabled"
|
|
393
|
+
], we = {
|
|
394
|
+
class: "m-checkbox__hit",
|
|
395
|
+
"aria-hidden": "true"
|
|
396
|
+
}, Te = { class: "m-checkbox__label" }, Ee = /* @__PURE__ */ d({
|
|
397
|
+
__name: "Checkbox",
|
|
398
|
+
props: /*@__PURE__*/ p({
|
|
399
|
+
value: { type: [
|
|
400
|
+
String,
|
|
401
|
+
Number,
|
|
402
|
+
Boolean
|
|
403
|
+
] },
|
|
404
|
+
modelValue: { type: Boolean },
|
|
405
|
+
indeterminate: { type: Boolean },
|
|
406
|
+
name: {},
|
|
407
|
+
disabled: { type: Boolean },
|
|
408
|
+
color: {},
|
|
409
|
+
size: {}
|
|
410
|
+
}, be),
|
|
411
|
+
emits: ["update:modelValue", "change"],
|
|
412
|
+
setup(e, { emit: t }) {
|
|
413
|
+
let n = e, r = t, a = f(Se, null), o = i(() => n.color ?? a?.color ?? "primary"), l = i(() => n.size ?? a?.size ?? "default"), u = i(() => n.disabled || !!a?.disabled), d = i(() => a ? a.modelValue.value.includes(n.value) : !!n.modelValue), p = i(() => [
|
|
414
|
+
"m-checkbox",
|
|
415
|
+
`m-checkbox--${l.value}`,
|
|
416
|
+
`m-checkbox--${o.value}`,
|
|
417
|
+
d.value && "is-checked",
|
|
418
|
+
n.indeterminate && "is-indeterminate",
|
|
419
|
+
u.value && "is-disabled"
|
|
420
|
+
]);
|
|
421
|
+
function m(e) {
|
|
422
|
+
if (u.value) return;
|
|
423
|
+
let t = e.target;
|
|
424
|
+
a ? a.toggleValue(n.value, t.checked) : (r("update:modelValue", t.checked), r("change", t.checked));
|
|
425
|
+
}
|
|
426
|
+
return (t, n) => (v(), s("label", { class: h(p.value) }, [
|
|
427
|
+
c("input", {
|
|
428
|
+
type: "checkbox",
|
|
429
|
+
class: "m-checkbox__input",
|
|
430
|
+
name: e.name,
|
|
431
|
+
value: e.value,
|
|
432
|
+
checked: d.value,
|
|
433
|
+
disabled: u.value,
|
|
434
|
+
onChange: m
|
|
435
|
+
}, null, 40, Ce),
|
|
436
|
+
j((v(), s("span", we, [...n[0] ||= [c("span", { class: "m-checkbox__box" }, [c("svg", {
|
|
437
|
+
class: "m-checkbox__check",
|
|
438
|
+
viewBox: "0 0 24 24",
|
|
439
|
+
fill: "none",
|
|
440
|
+
stroke: "currentColor",
|
|
441
|
+
"stroke-width": "3",
|
|
442
|
+
"stroke-linecap": "round",
|
|
443
|
+
"stroke-linejoin": "round"
|
|
444
|
+
}, [c("path", { d: "M5 13l4 4L19 7" })]), c("span", { class: "m-checkbox__minus" })], -1)]])), [[E(Q), {
|
|
445
|
+
center: !0,
|
|
446
|
+
disabled: u.value
|
|
447
|
+
}]]),
|
|
448
|
+
c("span", Te, [w(t.$slots, "default")])
|
|
449
|
+
], 2));
|
|
450
|
+
}
|
|
451
|
+
}), De = /* @__PURE__ */ d({
|
|
452
|
+
__name: "CheckboxGroup",
|
|
453
|
+
props: /*@__PURE__*/ p({
|
|
454
|
+
modelValue: {},
|
|
455
|
+
disabled: { type: Boolean },
|
|
456
|
+
color: {},
|
|
457
|
+
size: {},
|
|
458
|
+
vertical: { type: Boolean }
|
|
459
|
+
}, xe),
|
|
460
|
+
emits: ["update:modelValue", "change"],
|
|
461
|
+
setup(e, { emit: t }) {
|
|
462
|
+
let n = e, r = t, a = i(() => n.modelValue ?? []), o = {
|
|
463
|
+
modelValue: a,
|
|
464
|
+
color: n.color ?? "primary",
|
|
465
|
+
size: n.size ?? "default",
|
|
466
|
+
disabled: n.disabled,
|
|
467
|
+
toggleValue(e, t) {
|
|
468
|
+
if (n.disabled) return;
|
|
469
|
+
let i = [...a.value], o = i.indexOf(e);
|
|
470
|
+
t && o < 0 && i.push(e), !t && o >= 0 && i.splice(o, 1), r("update:modelValue", i), r("change", i);
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
y(Se, o);
|
|
474
|
+
let c = i(() => [
|
|
475
|
+
"m-checkbox-group",
|
|
476
|
+
n.vertical && "is-vertical",
|
|
477
|
+
n.disabled && "is-disabled"
|
|
478
|
+
]);
|
|
479
|
+
return (e, t) => (v(), s("div", {
|
|
480
|
+
class: h(c.value),
|
|
481
|
+
role: "group",
|
|
482
|
+
"aria-label": "复选组"
|
|
483
|
+
}, [w(e.$slots, "default")], 2));
|
|
484
|
+
}
|
|
485
|
+
}), Oe = {
|
|
486
|
+
format: "YYYY-MM-DD",
|
|
487
|
+
disabled: !1,
|
|
488
|
+
clearable: !1,
|
|
489
|
+
size: "default",
|
|
490
|
+
appendToBody: !0,
|
|
491
|
+
popupPlacement: "bottom"
|
|
492
|
+
};
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region packages/miao-ui/src/date-picker/date-utils.ts
|
|
495
|
+
function ke(e) {
|
|
496
|
+
return e < 10 ? `0${e}` : String(e);
|
|
497
|
+
}
|
|
498
|
+
function Ae(e, t) {
|
|
499
|
+
let n = {
|
|
500
|
+
YYYY: String(e.getFullYear()),
|
|
501
|
+
MM: ke(e.getMonth() + 1),
|
|
502
|
+
DD: ke(e.getDate()),
|
|
503
|
+
HH: ke(e.getHours()),
|
|
504
|
+
mm: ke(e.getMinutes()),
|
|
505
|
+
ss: ke(e.getSeconds())
|
|
506
|
+
};
|
|
507
|
+
return t.replace(/YYYY|MM|DD|HH|mm|ss/g, (e) => n[e] ?? e);
|
|
508
|
+
}
|
|
509
|
+
function $(e) {
|
|
510
|
+
if (!e) return null;
|
|
511
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : new Date(e);
|
|
512
|
+
let t = /^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?/.exec(e);
|
|
513
|
+
if (t) {
|
|
514
|
+
let e = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]), Number(t[4] ?? 0), Number(t[5] ?? 0), Number(t[6] ?? 0));
|
|
515
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
516
|
+
}
|
|
517
|
+
let n = new Date(e);
|
|
518
|
+
return Number.isNaN(n.getTime()) ? null : n;
|
|
519
|
+
}
|
|
520
|
+
function je(e) {
|
|
521
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
522
|
+
}
|
|
523
|
+
function Me(e, t) {
|
|
524
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
525
|
+
}
|
|
526
|
+
function Ne(e, t) {
|
|
527
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
|
|
528
|
+
}
|
|
529
|
+
function Pe(e) {
|
|
530
|
+
let t = e.getFullYear(), n = e.getMonth(), r = new Date(t, n, 1).getDay(), i = new Date(t, n, 1 - r);
|
|
531
|
+
return Array.from({ length: 42 }, (e, t) => new Date(i.getFullYear(), i.getMonth(), i.getDate() + t));
|
|
532
|
+
}
|
|
533
|
+
var Fe = [
|
|
534
|
+
"日",
|
|
535
|
+
"一",
|
|
536
|
+
"二",
|
|
537
|
+
"三",
|
|
538
|
+
"四",
|
|
539
|
+
"五",
|
|
540
|
+
"六"
|
|
541
|
+
], Ie = {
|
|
542
|
+
key: 0,
|
|
543
|
+
class: "m-time-spinner__sep",
|
|
544
|
+
"aria-hidden": "true"
|
|
545
|
+
}, Le = { class: "m-time-spinner__unit" }, Re = [
|
|
546
|
+
"value",
|
|
547
|
+
"disabled",
|
|
548
|
+
"aria-label",
|
|
549
|
+
"onKeydown",
|
|
550
|
+
"onBlur"
|
|
551
|
+
], ze = { class: "m-time-spinner__arrows" }, Be = ["disabled", "onClick"], Ve = ["disabled", "onClick"], He = /* @__PURE__ */ d({
|
|
552
|
+
__name: "TimeSpinner",
|
|
553
|
+
props: {
|
|
554
|
+
hour: {},
|
|
555
|
+
minute: {},
|
|
556
|
+
second: {},
|
|
557
|
+
disabled: { type: Boolean }
|
|
558
|
+
},
|
|
559
|
+
emits: [
|
|
560
|
+
"update:hour",
|
|
561
|
+
"update:minute",
|
|
562
|
+
"update:second"
|
|
563
|
+
],
|
|
564
|
+
setup(t, { emit: n }) {
|
|
565
|
+
let r = t, i = n, a = [
|
|
566
|
+
{
|
|
567
|
+
key: "hour",
|
|
568
|
+
max: 23
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
key: "minute",
|
|
572
|
+
max: 59
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
key: "second",
|
|
576
|
+
max: 59
|
|
577
|
+
}
|
|
578
|
+
];
|
|
579
|
+
function l(e) {
|
|
580
|
+
return e === "hour" ? r.hour : e === "minute" ? r.minute : r.second;
|
|
581
|
+
}
|
|
582
|
+
function u(e, t) {
|
|
583
|
+
i(e === "hour" ? "update:hour" : e === "minute" ? "update:minute" : "update:second", t);
|
|
584
|
+
}
|
|
585
|
+
function d(e, t) {
|
|
586
|
+
if (r.disabled) return;
|
|
587
|
+
let n = e === "hour" ? 23 : 59;
|
|
588
|
+
u(e, (l(e) + t + n + 1) % (n + 1));
|
|
589
|
+
}
|
|
590
|
+
function f(e, t) {
|
|
591
|
+
r.disabled || (t.key === "ArrowUp" ? (t.preventDefault(), d(e, 1)) : t.key === "ArrowDown" && (t.preventDefault(), d(e, -1)));
|
|
592
|
+
}
|
|
593
|
+
function p(e, t) {
|
|
594
|
+
let n = e === "hour" ? 23 : 59, r = t.target.value.trim(), i = parseInt(r, 10);
|
|
595
|
+
u(e, Number.isNaN(i) ? 0 : Math.min(n, Math.max(0, i)));
|
|
596
|
+
}
|
|
597
|
+
return (n, r) => (v(), s("div", { class: h(["m-time-spinner", { "is-disabled": t.disabled }]) }, [(v(), s(e, null, C(a, (n, i) => (v(), s(e, { key: n.key }, [i > 0 ? (v(), s("span", Ie, ":")) : o("", !0), c("span", Le, [c("input", {
|
|
598
|
+
class: "m-time-spinner__input",
|
|
599
|
+
type: "text",
|
|
600
|
+
inputmode: "numeric",
|
|
601
|
+
value: E(ke)(l(n.key)),
|
|
602
|
+
disabled: t.disabled,
|
|
603
|
+
"aria-label": n.key,
|
|
604
|
+
onKeydown: (e) => f(n.key, e),
|
|
605
|
+
onBlur: (e) => p(n.key, e)
|
|
606
|
+
}, null, 40, Re), c("span", ze, [c("button", {
|
|
607
|
+
type: "button",
|
|
608
|
+
class: "m-time-spinner__step",
|
|
609
|
+
disabled: t.disabled,
|
|
610
|
+
"aria-label": "增加",
|
|
611
|
+
onClick: (e) => d(n.key, 1)
|
|
612
|
+
}, [...r[0] ||= [c("svg", {
|
|
613
|
+
viewBox: "0 0 24 24",
|
|
614
|
+
width: "11",
|
|
615
|
+
height: "11",
|
|
616
|
+
fill: "none",
|
|
617
|
+
stroke: "currentColor",
|
|
618
|
+
"stroke-width": "3.4",
|
|
619
|
+
"stroke-linecap": "round",
|
|
620
|
+
"stroke-linejoin": "round",
|
|
621
|
+
"aria-hidden": "true"
|
|
622
|
+
}, [c("path", { d: "M6 14l6-6 6 6" })], -1)]], 8, Be), c("button", {
|
|
623
|
+
type: "button",
|
|
624
|
+
class: "m-time-spinner__step",
|
|
625
|
+
disabled: t.disabled,
|
|
626
|
+
"aria-label": "减少",
|
|
627
|
+
onClick: (e) => d(n.key, -1)
|
|
628
|
+
}, [...r[1] ||= [c("svg", {
|
|
629
|
+
viewBox: "0 0 24 24",
|
|
630
|
+
width: "11",
|
|
631
|
+
height: "11",
|
|
632
|
+
fill: "none",
|
|
633
|
+
stroke: "currentColor",
|
|
634
|
+
"stroke-width": "3.4",
|
|
635
|
+
"stroke-linecap": "round",
|
|
636
|
+
"stroke-linejoin": "round",
|
|
637
|
+
"aria-hidden": "true"
|
|
638
|
+
}, [c("path", { d: "M6 10l6 6 6-6" })], -1)]], 8, Ve)])])], 64))), 64))], 2));
|
|
639
|
+
}
|
|
640
|
+
}), Ue = 0, We = "";
|
|
641
|
+
function Ge() {
|
|
642
|
+
Ue === 0 && (We = document.body.style.overflow, document.body.style.overflow = "hidden"), Ue++;
|
|
643
|
+
}
|
|
644
|
+
function Ke() {
|
|
645
|
+
Ue = Math.max(0, Ue - 1), Ue === 0 && document.body.style.overflow === "hidden" && (document.body.style.overflow = We);
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region packages/miao-ui/src/date-picker/DatePicker.vue?vue&type=script&setup=true&lang.ts
|
|
649
|
+
var qe = [
|
|
650
|
+
"value",
|
|
651
|
+
"placeholder",
|
|
652
|
+
"disabled",
|
|
653
|
+
"name"
|
|
654
|
+
], Je = { class: "m-datepicker-popup__content" }, Ye = { class: "m-datepicker-popup__header" }, Xe = ["disabled"], Ze = { class: "m-datepicker-popup__label" }, Qe = ["disabled"], $e = {
|
|
655
|
+
key: 0,
|
|
656
|
+
class: "m-datepicker-popup__ym"
|
|
657
|
+
}, et = { class: "m-datepicker-popup__ym-head" }, tt = { class: "m-datepicker-popup__ym-title" }, nt = { class: "m-datepicker-popup__ym-grid" }, rt = ["disabled", "onClick"], it = {
|
|
658
|
+
key: 1,
|
|
659
|
+
class: "m-datepicker-popup__ym"
|
|
660
|
+
}, at = { class: "m-datepicker-popup__ym-head" }, ot = { class: "m-datepicker-popup__ym-title" }, st = { class: "m-datepicker-popup__ym-grid" }, ct = ["disabled", "onClick"], lt = { class: "m-datepicker-popup__calendar" }, ut = { class: "m-datepicker-popup__weekdays" }, dt = { class: "m-datepicker-popup__grid" }, ft = ["disabled", "onClick"], pt = { class: "m-datepicker-popup__time-panel" }, mt = { class: "m-datepicker-popup__time-head" }, ht = { class: "m-datepicker-popup__time-body" }, gt = { class: "m-datepicker-popup__time-foot" }, _t = { class: "m-datepicker-popup__footer" }, vt = ["disabled"], yt = {
|
|
661
|
+
key: 3,
|
|
662
|
+
class: "m-datepicker-popup__grow"
|
|
663
|
+
}, bt = ["disabled"], xt = 4, St = /* @__PURE__ */ d({
|
|
664
|
+
__name: "DatePicker",
|
|
665
|
+
props: /*@__PURE__*/ p({
|
|
666
|
+
modelValue: {},
|
|
667
|
+
placeholder: {},
|
|
668
|
+
format: {},
|
|
669
|
+
disabled: { type: Boolean },
|
|
670
|
+
clearable: { type: Boolean },
|
|
671
|
+
size: {},
|
|
672
|
+
min: {},
|
|
673
|
+
max: {},
|
|
674
|
+
appendToBody: { type: Boolean },
|
|
675
|
+
popupPlacement: {},
|
|
676
|
+
width: {},
|
|
677
|
+
name: {}
|
|
678
|
+
}, Oe),
|
|
679
|
+
emits: [
|
|
680
|
+
"update:modelValue",
|
|
681
|
+
"change",
|
|
682
|
+
"open",
|
|
683
|
+
"close"
|
|
684
|
+
],
|
|
685
|
+
setup(r, { emit: d }) {
|
|
686
|
+
let f = r, p = d, y = x(null), b = x(null), S = x(!1), w = x(!1), D = x(null), k = i(() => /H|mm|ss/.test(f.format)), j = x({
|
|
687
|
+
hour: 0,
|
|
688
|
+
minute: 0,
|
|
689
|
+
second: 0
|
|
690
|
+
}), N = x(!1);
|
|
691
|
+
function P(e) {
|
|
692
|
+
return e ? {
|
|
693
|
+
hour: e.getHours(),
|
|
694
|
+
minute: e.getMinutes(),
|
|
695
|
+
second: e.getSeconds()
|
|
696
|
+
} : {
|
|
697
|
+
hour: 0,
|
|
698
|
+
minute: 0,
|
|
699
|
+
second: 0
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function F(e) {
|
|
703
|
+
return new Date(e.getFullYear(), e.getMonth(), 1);
|
|
704
|
+
}
|
|
705
|
+
let I = x(F(/* @__PURE__ */ new Date())), L = x({
|
|
706
|
+
top: 0,
|
|
707
|
+
left: 0,
|
|
708
|
+
side: "bottom"
|
|
709
|
+
}), ee = i(() => {
|
|
710
|
+
if (!f.modelValue) return "";
|
|
711
|
+
let e = $(f.modelValue);
|
|
712
|
+
return e ? Ae(e, f.format) : "";
|
|
713
|
+
}), R = i(() => !!f.modelValue), z = i(() => f.clearable && !f.disabled && R.value);
|
|
714
|
+
O(() => f.modelValue, (e) => {
|
|
715
|
+
D.value = $(e);
|
|
716
|
+
}, { immediate: !0 }), O(D, (e) => {
|
|
717
|
+
j.value = P(e);
|
|
718
|
+
}, { immediate: !0 });
|
|
719
|
+
let B = i(() => Pe(I.value)), V = i(() => I.value.getFullYear()), te = i(() => I.value.getMonth() + 1), H = je(/* @__PURE__ */ new Date()), U = x("date"), W = x(0), ne = i(() => Array.from({ length: 12 }, (e, t) => W.value + t));
|
|
720
|
+
function G() {
|
|
721
|
+
W.value = Math.floor(I.value.getFullYear() / 12) * 12, U.value = "year", N.value = !1;
|
|
722
|
+
}
|
|
723
|
+
function K() {
|
|
724
|
+
U.value = "month", N.value = !1;
|
|
725
|
+
}
|
|
726
|
+
function q(e) {
|
|
727
|
+
W.value += e * 12;
|
|
728
|
+
}
|
|
729
|
+
function J(e) {
|
|
730
|
+
let t = $(f.min), n = $(f.max), r = new Date(e, 0, 1), i = new Date(e, 11, 1);
|
|
731
|
+
return !!(t && i < F(t) || n && r > F(n));
|
|
732
|
+
}
|
|
733
|
+
function re(e) {
|
|
734
|
+
I.value = new Date(e, I.value.getMonth(), 1), U.value = "month";
|
|
735
|
+
}
|
|
736
|
+
function ie(e) {
|
|
737
|
+
let t = new Date(I.value.getFullYear(), e - 1, 1), n = $(f.min), r = $(f.max);
|
|
738
|
+
return !!(n && t < F(n) || r && t > F(r));
|
|
739
|
+
}
|
|
740
|
+
function Y(e) {
|
|
741
|
+
I.value = new Date(I.value.getFullYear(), e - 1, 1), U.value = "date";
|
|
742
|
+
}
|
|
743
|
+
function X(e) {
|
|
744
|
+
let t = $(f.min), n = $(f.max);
|
|
745
|
+
return !!(t && e < je(t) || n && e > je(n));
|
|
746
|
+
}
|
|
747
|
+
function ae(e) {
|
|
748
|
+
return {
|
|
749
|
+
"is-outside": !Ne(e, I.value),
|
|
750
|
+
"is-today": Me(e, H),
|
|
751
|
+
"is-selected": !!D.value && Me(e, D.value)
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function Z() {
|
|
755
|
+
I.value = new Date(I.value.getFullYear(), I.value.getMonth() - 1, 1);
|
|
756
|
+
}
|
|
757
|
+
function oe() {
|
|
758
|
+
I.value = new Date(I.value.getFullYear(), I.value.getMonth() + 1, 1);
|
|
759
|
+
}
|
|
760
|
+
function se(e) {
|
|
761
|
+
let t = F(new Date(I.value.getFullYear(), I.value.getMonth() + e, 1)), n = $(f.min), r = $(f.max);
|
|
762
|
+
if (n) {
|
|
763
|
+
let e = F(n);
|
|
764
|
+
if (t.getTime() < e.getTime()) return !0;
|
|
765
|
+
}
|
|
766
|
+
if (r) {
|
|
767
|
+
let e = F(r);
|
|
768
|
+
if (t.getTime() > e.getTime()) return !0;
|
|
769
|
+
}
|
|
770
|
+
return !1;
|
|
771
|
+
}
|
|
772
|
+
function ce(e) {
|
|
773
|
+
D.value = e;
|
|
774
|
+
let t = Ae(e, f.format);
|
|
775
|
+
p("update:modelValue", t), p("change", t);
|
|
776
|
+
}
|
|
777
|
+
function le(e) {
|
|
778
|
+
X(e) || (ce(new Date(e.getFullYear(), e.getMonth(), e.getDate(), j.value.hour, j.value.minute, j.value.second)), k.value || me());
|
|
779
|
+
}
|
|
780
|
+
function ue() {
|
|
781
|
+
let e = je(/* @__PURE__ */ new Date());
|
|
782
|
+
I.value = new Date(e.getFullYear(), e.getMonth(), 1), le(e);
|
|
783
|
+
}
|
|
784
|
+
function de() {
|
|
785
|
+
let e = /* @__PURE__ */ new Date();
|
|
786
|
+
j.value = P(e), I.value = new Date(e.getFullYear(), e.getMonth(), 1), ce(e);
|
|
787
|
+
}
|
|
788
|
+
function fe() {
|
|
789
|
+
let e = D.value;
|
|
790
|
+
e && ce(new Date(e.getFullYear(), e.getMonth(), e.getDate(), j.value.hour, j.value.minute, j.value.second));
|
|
791
|
+
}
|
|
792
|
+
function pe() {
|
|
793
|
+
D.value && me();
|
|
794
|
+
}
|
|
795
|
+
function Q() {
|
|
796
|
+
if (f.disabled || S.value) return;
|
|
797
|
+
let e = D.value ?? /* @__PURE__ */ new Date();
|
|
798
|
+
I.value = new Date(e.getFullYear(), e.getMonth(), 1), U.value = "date", S.value = !0, p("open"), Ge(), document.addEventListener("pointerdown", ye), window.addEventListener("scroll", Ce, !0), window.addEventListener("resize", Ce), m(() => {
|
|
799
|
+
he(), b.value?.focus({ preventScroll: !0 });
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
function me() {
|
|
803
|
+
S.value && (S.value = !1, p("close"), Se(), Ke(), document.removeEventListener("pointerdown", ye), window.removeEventListener("scroll", Ce, !0), window.removeEventListener("resize", Ce));
|
|
804
|
+
}
|
|
805
|
+
function he() {
|
|
806
|
+
let e = y.value, t = b.value;
|
|
807
|
+
if (!e || !t) return;
|
|
808
|
+
let n = e.getBoundingClientRect(), r = t.offsetWidth, i = t.offsetHeight, a = window.innerWidth, o = window.innerHeight, s = Math.min(Math.max(0, n.left), Math.max(0, a - r - 8));
|
|
809
|
+
s + r > a - 8 && (s = a - r - 8), s = Math.max(0, s);
|
|
810
|
+
let c = Math.max(0, n.top - xt), l = Math.max(0, o - n.bottom - xt), u = f.popupPlacement === "top", d = u ? c : l, p = u ? l : c, m;
|
|
811
|
+
m = d >= i ? u : p >= i || p > d ? !u : u;
|
|
812
|
+
let h = m ? Math.max(0, n.top - xt - i) : n.bottom + xt;
|
|
813
|
+
L.value = {
|
|
814
|
+
top: h,
|
|
815
|
+
left: s,
|
|
816
|
+
side: m ? "top" : "bottom"
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function ge() {
|
|
820
|
+
f.disabled || (S.value ? me() : Q());
|
|
821
|
+
}
|
|
822
|
+
function _e() {
|
|
823
|
+
ge(), (y.value?.querySelector("input"))?.focus();
|
|
824
|
+
}
|
|
825
|
+
function ve(e) {
|
|
826
|
+
f.disabled || (e.key === "Enter" || e.key === " " ? (e.preventDefault(), S.value || Q()) : e.key === "Escape" && S.value && (e.preventDefault(), me()));
|
|
827
|
+
}
|
|
828
|
+
function ye(e) {
|
|
829
|
+
let t = e.target;
|
|
830
|
+
!y.value?.contains(t) && !b.value?.contains(t) && me();
|
|
831
|
+
}
|
|
832
|
+
function be() {
|
|
833
|
+
p("update:modelValue", ""), p("change", ""), D.value = null;
|
|
834
|
+
}
|
|
835
|
+
let xe = null;
|
|
836
|
+
function Se() {
|
|
837
|
+
xe !== null && (cancelAnimationFrame(xe), xe = null);
|
|
838
|
+
}
|
|
839
|
+
function Ce(e) {
|
|
840
|
+
let t = e.target;
|
|
841
|
+
t instanceof Node && b.value?.contains(t) || xe === null && (xe = requestAnimationFrame(() => {
|
|
842
|
+
if (xe = null, !S.value) return;
|
|
843
|
+
let e = y.value?.getBoundingClientRect();
|
|
844
|
+
e && (e.bottom > 0 && e.top < window.innerHeight && e.right > 0 && e.left < window.innerWidth ? he() : me());
|
|
845
|
+
}));
|
|
846
|
+
}
|
|
847
|
+
function we(e, t) {
|
|
848
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim(), r = parseFloat(n);
|
|
849
|
+
return Number.isFinite(r) ? r : t;
|
|
850
|
+
}
|
|
851
|
+
function Te(e, t, n) {
|
|
852
|
+
let r = e.getBoundingClientRect();
|
|
853
|
+
if (t) {
|
|
854
|
+
let e = t.getBoundingClientRect(), i = n === "top" ? e.top - r.top : e.bottom - r.top;
|
|
855
|
+
return `${e.left - r.left}px ${i}px`;
|
|
856
|
+
}
|
|
857
|
+
return "center";
|
|
858
|
+
}
|
|
859
|
+
function Ee(e, t) {
|
|
860
|
+
for (let t of e) t && (t.style.transition = "", t.style.opacity = "", t.style.transform = "", t.style.transformOrigin = "");
|
|
861
|
+
t();
|
|
862
|
+
}
|
|
863
|
+
let De = 0;
|
|
864
|
+
function Oe(e, t, n) {
|
|
865
|
+
let r = e[0];
|
|
866
|
+
if (!r) return;
|
|
867
|
+
let i = ++De, a = !1, o = e.filter((e) => !!e && e !== r), s = /* @__PURE__ */ new Set(), c = () => {
|
|
868
|
+
a || (a = !0, window.clearTimeout(u), r.removeEventListener("transitionend", l), i === De ? Ee(e, n) : n());
|
|
869
|
+
}, l = (e) => {
|
|
870
|
+
let t = e.target;
|
|
871
|
+
!t || !o.includes(t) || (s.add(t), s.size >= o.length && c());
|
|
872
|
+
}, u = window.setTimeout(c, t + 80);
|
|
873
|
+
o.length > 0 ? r.addEventListener("transitionend", l) : c();
|
|
874
|
+
}
|
|
875
|
+
function ke(e, t) {
|
|
876
|
+
let n = e, r = n.querySelector(".m-datepicker-popup__surface"), i = n.querySelector(".m-datepicker-popup__content"), a = we("--m-dur-entering", 225), o = "var(--m-ease-in-out, ease)";
|
|
877
|
+
he(), m(() => {
|
|
878
|
+
r && (r.style.transformOrigin = Te(r, y.value, L.value.side), r.style.transform = "scale(1, 0)"), i && (i.style.opacity = "0"), n.offsetWidth, requestAnimationFrame(() => {
|
|
879
|
+
let e = Math.round(a * 1.4), s = e;
|
|
880
|
+
if (r && (r.style.transition = `transform ${e}ms ${o}`, r.style.transform = ""), i) {
|
|
881
|
+
let t = Math.round(a * .7), n = Math.round(e * .85);
|
|
882
|
+
i.style.transition = `opacity ${t}ms ${o} ${n}ms`, i.style.opacity = "1", s = Math.max(s, n + t);
|
|
883
|
+
}
|
|
884
|
+
Oe([
|
|
885
|
+
n,
|
|
886
|
+
r,
|
|
887
|
+
i
|
|
888
|
+
], s, t);
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function Ie(e, t) {
|
|
893
|
+
let n = e, r = n.querySelector(".m-datepicker-popup__surface"), i = n.querySelector(".m-datepicker-popup__content"), a = we("--m-dur-leaving", 195), o = "var(--m-ease-in-out, ease)", s = Math.round(a * 1), c = s;
|
|
894
|
+
if (r && (r.style.transformOrigin = Te(r, y.value, L.value.side), r.style.transition = `opacity ${s}ms ${o}, transform ${s}ms ${o}`, r.style.transform = "scale(0.96)", r.style.opacity = "0"), i) {
|
|
895
|
+
let e = Math.round(a * .6);
|
|
896
|
+
i.style.transition = `opacity ${e}ms ${o}`, i.style.opacity = "0", c = Math.max(c, e);
|
|
897
|
+
}
|
|
898
|
+
Oe([
|
|
899
|
+
n,
|
|
900
|
+
r,
|
|
901
|
+
i
|
|
902
|
+
], c, t);
|
|
903
|
+
}
|
|
904
|
+
return _(() => {
|
|
905
|
+
Ke(), Se(), document.removeEventListener("pointerdown", ye), window.removeEventListener("scroll", Ce, !0), window.removeEventListener("resize", Ce);
|
|
906
|
+
}), (i, d) => (v(), s(e, null, [c("div", {
|
|
907
|
+
ref_key: "triggerRef",
|
|
908
|
+
ref: y,
|
|
909
|
+
class: h(["m-datepicker", [
|
|
910
|
+
`m-datepicker--${r.size}`,
|
|
911
|
+
w.value && "is-focused",
|
|
912
|
+
r.disabled && "is-disabled",
|
|
913
|
+
S.value && "is-open"
|
|
914
|
+
]]),
|
|
915
|
+
style: g(r.width ? { width: r.width } : void 0)
|
|
916
|
+
}, [
|
|
917
|
+
c("span", {
|
|
918
|
+
class: "m-datepicker__icon",
|
|
919
|
+
"aria-hidden": "true",
|
|
920
|
+
onClick: _e
|
|
921
|
+
}, [...d[14] ||= [c("svg", {
|
|
922
|
+
viewBox: "0 0 24 24",
|
|
923
|
+
width: "18",
|
|
924
|
+
height: "18",
|
|
925
|
+
fill: "none",
|
|
926
|
+
stroke: "currentColor",
|
|
927
|
+
"stroke-width": "1.8",
|
|
928
|
+
"stroke-linecap": "round",
|
|
929
|
+
"stroke-linejoin": "round"
|
|
930
|
+
}, [c("rect", {
|
|
931
|
+
x: "3",
|
|
932
|
+
y: "5",
|
|
933
|
+
width: "18",
|
|
934
|
+
height: "16",
|
|
935
|
+
rx: "2"
|
|
936
|
+
}), c("path", { d: "M3 9h18M8 3v4m8-4v4" })], -1)]]),
|
|
937
|
+
c("input", {
|
|
938
|
+
class: "m-datepicker__input",
|
|
939
|
+
type: "text",
|
|
940
|
+
readonly: "",
|
|
941
|
+
value: ee.value,
|
|
942
|
+
placeholder: r.placeholder,
|
|
943
|
+
disabled: r.disabled,
|
|
944
|
+
name: r.name,
|
|
945
|
+
onClick: ge,
|
|
946
|
+
onFocus: d[0] ||= (e) => w.value = !0,
|
|
947
|
+
onBlur: d[1] ||= (e) => w.value = !1,
|
|
948
|
+
onKeydown: ve
|
|
949
|
+
}, null, 40, qe),
|
|
950
|
+
z.value ? (v(), s("button", {
|
|
951
|
+
key: 0,
|
|
952
|
+
type: "button",
|
|
953
|
+
class: "m-datepicker__clear",
|
|
954
|
+
tabindex: "-1",
|
|
955
|
+
"aria-label": "清除日期",
|
|
956
|
+
onMousedown: d[2] ||= M(() => {}, ["prevent"]),
|
|
957
|
+
onClick: be
|
|
958
|
+
}, [...d[15] ||= [c("svg", {
|
|
959
|
+
viewBox: "0 0 24 24",
|
|
960
|
+
width: "13",
|
|
961
|
+
height: "13",
|
|
962
|
+
fill: "none",
|
|
963
|
+
stroke: "currentColor",
|
|
964
|
+
"stroke-width": "2.4",
|
|
965
|
+
"stroke-linecap": "round",
|
|
966
|
+
"aria-hidden": "true"
|
|
967
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 32)) : o("", !0)
|
|
968
|
+
], 6), (v(), a(t, {
|
|
969
|
+
to: "body",
|
|
970
|
+
disabled: !r.appendToBody
|
|
971
|
+
}, [u(n, {
|
|
972
|
+
css: !1,
|
|
973
|
+
onEnter: ke,
|
|
974
|
+
onLeave: Ie
|
|
975
|
+
}, {
|
|
976
|
+
default: A(() => [S.value ? (v(), s("div", {
|
|
977
|
+
key: 0,
|
|
978
|
+
ref_key: "panelRef",
|
|
979
|
+
ref: b,
|
|
980
|
+
class: "m-datepicker-popup",
|
|
981
|
+
tabindex: "-1",
|
|
982
|
+
style: g({
|
|
983
|
+
top: L.value.top + "px",
|
|
984
|
+
left: L.value.left + "px"
|
|
985
|
+
})
|
|
986
|
+
}, [d[26] ||= c("div", {
|
|
987
|
+
class: "m-datepicker-popup__surface",
|
|
988
|
+
"aria-hidden": "true"
|
|
989
|
+
}, null, -1), c("div", Je, [c("div", Ye, [
|
|
990
|
+
U.value === "date" ? (v(), s("button", {
|
|
991
|
+
key: 0,
|
|
992
|
+
type: "button",
|
|
993
|
+
class: "m-datepicker-popup__nav",
|
|
994
|
+
"aria-label": "上个月",
|
|
995
|
+
disabled: se(-1),
|
|
996
|
+
onClick: Z
|
|
997
|
+
}, [...d[16] ||= [c("svg", {
|
|
998
|
+
viewBox: "0 0 24 24",
|
|
999
|
+
width: "18",
|
|
1000
|
+
height: "18",
|
|
1001
|
+
fill: "none",
|
|
1002
|
+
stroke: "currentColor",
|
|
1003
|
+
"stroke-width": "2.2",
|
|
1004
|
+
"stroke-linecap": "round",
|
|
1005
|
+
"stroke-linejoin": "round",
|
|
1006
|
+
"aria-hidden": "true"
|
|
1007
|
+
}, [c("path", { d: "M15 6l-6 6 6 6" })], -1)]], 8, Xe)) : o("", !0),
|
|
1008
|
+
c("div", Ze, [c("button", {
|
|
1009
|
+
type: "button",
|
|
1010
|
+
class: "m-datepicker-popup__label-btn",
|
|
1011
|
+
onClick: G
|
|
1012
|
+
}, T(V.value) + " 年 ", 1), c("button", {
|
|
1013
|
+
type: "button",
|
|
1014
|
+
class: "m-datepicker-popup__label-btn",
|
|
1015
|
+
onClick: K
|
|
1016
|
+
}, T(te.value) + " 月 ", 1)]),
|
|
1017
|
+
U.value === "date" ? (v(), s("button", {
|
|
1018
|
+
key: 1,
|
|
1019
|
+
type: "button",
|
|
1020
|
+
class: "m-datepicker-popup__nav",
|
|
1021
|
+
"aria-label": "下个月",
|
|
1022
|
+
disabled: se(1),
|
|
1023
|
+
onClick: oe
|
|
1024
|
+
}, [...d[17] ||= [c("svg", {
|
|
1025
|
+
viewBox: "0 0 24 24",
|
|
1026
|
+
width: "18",
|
|
1027
|
+
height: "18",
|
|
1028
|
+
fill: "none",
|
|
1029
|
+
stroke: "currentColor",
|
|
1030
|
+
"stroke-width": "2.2",
|
|
1031
|
+
"stroke-linecap": "round",
|
|
1032
|
+
"stroke-linejoin": "round",
|
|
1033
|
+
"aria-hidden": "true"
|
|
1034
|
+
}, [c("path", { d: "M9 6l6 6-6 6" })], -1)]], 8, Qe)) : o("", !0)
|
|
1035
|
+
]), U.value === "year" ? (v(), s("div", $e, [c("div", et, [
|
|
1036
|
+
c("button", {
|
|
1037
|
+
type: "button",
|
|
1038
|
+
class: "m-datepicker-popup__ym-nav",
|
|
1039
|
+
"aria-label": "返回日期视图",
|
|
1040
|
+
onClick: d[3] ||= (e) => U.value = "date"
|
|
1041
|
+
}, [...d[18] ||= [c("svg", {
|
|
1042
|
+
viewBox: "0 0 24 24",
|
|
1043
|
+
width: "16",
|
|
1044
|
+
height: "16",
|
|
1045
|
+
fill: "none",
|
|
1046
|
+
stroke: "currentColor",
|
|
1047
|
+
"stroke-width": "2.2",
|
|
1048
|
+
"stroke-linecap": "round",
|
|
1049
|
+
"stroke-linejoin": "round",
|
|
1050
|
+
"aria-hidden": "true"
|
|
1051
|
+
}, [c("path", { d: "M15 6l-6 6 6 6" })], -1)]]),
|
|
1052
|
+
c("button", {
|
|
1053
|
+
type: "button",
|
|
1054
|
+
class: "m-datepicker-popup__ym-nav",
|
|
1055
|
+
"aria-label": "前 12 年",
|
|
1056
|
+
onClick: d[4] ||= (e) => q(-1)
|
|
1057
|
+
}, [...d[19] ||= [c("svg", {
|
|
1058
|
+
viewBox: "0 0 24 24",
|
|
1059
|
+
width: "16",
|
|
1060
|
+
height: "16",
|
|
1061
|
+
fill: "none",
|
|
1062
|
+
stroke: "currentColor",
|
|
1063
|
+
"stroke-width": "2.2",
|
|
1064
|
+
"stroke-linecap": "round",
|
|
1065
|
+
"stroke-linejoin": "round",
|
|
1066
|
+
"aria-hidden": "true"
|
|
1067
|
+
}, [c("path", { d: "M11 6l-6 6 6 6M19 6l-6 6 6 6" })], -1)]]),
|
|
1068
|
+
c("span", tt, T(W.value) + " – " + T(W.value + 11), 1),
|
|
1069
|
+
c("button", {
|
|
1070
|
+
type: "button",
|
|
1071
|
+
class: "m-datepicker-popup__ym-nav",
|
|
1072
|
+
"aria-label": "后 12 年",
|
|
1073
|
+
onClick: d[5] ||= (e) => q(1)
|
|
1074
|
+
}, [...d[20] ||= [c("svg", {
|
|
1075
|
+
viewBox: "0 0 24 24",
|
|
1076
|
+
width: "16",
|
|
1077
|
+
height: "16",
|
|
1078
|
+
fill: "none",
|
|
1079
|
+
stroke: "currentColor",
|
|
1080
|
+
"stroke-width": "2.2",
|
|
1081
|
+
"stroke-linecap": "round",
|
|
1082
|
+
"stroke-linejoin": "round",
|
|
1083
|
+
"aria-hidden": "true"
|
|
1084
|
+
}, [c("path", { d: "M13 6l6 6-6 6M5 6l6 6-6 6" })], -1)]])
|
|
1085
|
+
]), c("div", nt, [(v(!0), s(e, null, C(ne.value, (e) => (v(), s("button", {
|
|
1086
|
+
key: e,
|
|
1087
|
+
type: "button",
|
|
1088
|
+
class: h(["m-datepicker-popup__ym-cell", { "is-active": e === V.value }]),
|
|
1089
|
+
disabled: J(e),
|
|
1090
|
+
onClick: (t) => re(e)
|
|
1091
|
+
}, T(e), 11, rt))), 128))])])) : U.value === "month" ? (v(), s("div", it, [c("div", at, [
|
|
1092
|
+
c("button", {
|
|
1093
|
+
type: "button",
|
|
1094
|
+
class: "m-datepicker-popup__ym-nav",
|
|
1095
|
+
"aria-label": "返回日期视图",
|
|
1096
|
+
onClick: d[6] ||= (e) => U.value = "date"
|
|
1097
|
+
}, [...d[21] ||= [c("svg", {
|
|
1098
|
+
viewBox: "0 0 24 24",
|
|
1099
|
+
width: "16",
|
|
1100
|
+
height: "16",
|
|
1101
|
+
fill: "none",
|
|
1102
|
+
stroke: "currentColor",
|
|
1103
|
+
"stroke-width": "2.2",
|
|
1104
|
+
"stroke-linecap": "round",
|
|
1105
|
+
"stroke-linejoin": "round",
|
|
1106
|
+
"aria-hidden": "true"
|
|
1107
|
+
}, [c("path", { d: "M15 6l-6 6 6 6" })], -1)]]),
|
|
1108
|
+
c("span", ot, T(V.value) + " 年", 1),
|
|
1109
|
+
d[22] ||= c("span", { class: "m-datepicker-popup__ym-head-spacer" }, null, -1)
|
|
1110
|
+
]), c("div", st, [(v(), s(e, null, C(12, (e) => c("button", {
|
|
1111
|
+
key: e,
|
|
1112
|
+
type: "button",
|
|
1113
|
+
class: h(["m-datepicker-popup__ym-cell", { "is-active": e === te.value }]),
|
|
1114
|
+
disabled: ie(e),
|
|
1115
|
+
onClick: (t) => Y(e)
|
|
1116
|
+
}, T(e) + " 月 ", 11, ct)), 64))])])) : (v(), s(e, { key: 2 }, [c("div", lt, [
|
|
1117
|
+
c("div", ut, [(v(!0), s(e, null, C(E(Fe), (e) => (v(), s("span", {
|
|
1118
|
+
key: e,
|
|
1119
|
+
class: "m-datepicker-popup__weekday"
|
|
1120
|
+
}, T(e), 1))), 128))]),
|
|
1121
|
+
c("div", dt, [(v(!0), s(e, null, C(B.value, (e) => (v(), s("button", {
|
|
1122
|
+
key: e.getTime(),
|
|
1123
|
+
type: "button",
|
|
1124
|
+
class: h(["m-datepicker-popup__day", ae(e)]),
|
|
1125
|
+
disabled: X(e),
|
|
1126
|
+
onClick: (t) => le(e)
|
|
1127
|
+
}, T(e.getDate()), 11, ft))), 128))]),
|
|
1128
|
+
u(n, { name: "m-datepicker-time" }, {
|
|
1129
|
+
default: A(() => [N.value ? (v(), s("div", {
|
|
1130
|
+
key: 0,
|
|
1131
|
+
class: "m-datepicker-popup__time",
|
|
1132
|
+
onClick: d[12] ||= M((e) => N.value = !1, ["self"])
|
|
1133
|
+
}, [c("div", pt, [
|
|
1134
|
+
c("div", mt, [d[24] ||= c("span", { class: "m-datepicker-popup__time-title" }, [c("svg", {
|
|
1135
|
+
viewBox: "0 0 24 24",
|
|
1136
|
+
width: "13",
|
|
1137
|
+
height: "13",
|
|
1138
|
+
fill: "none",
|
|
1139
|
+
stroke: "currentColor",
|
|
1140
|
+
"stroke-width": "2",
|
|
1141
|
+
"stroke-linecap": "round",
|
|
1142
|
+
"stroke-linejoin": "round",
|
|
1143
|
+
"aria-hidden": "true"
|
|
1144
|
+
}, [c("circle", {
|
|
1145
|
+
cx: "12",
|
|
1146
|
+
cy: "12",
|
|
1147
|
+
r: "9"
|
|
1148
|
+
}), c("path", { d: "M12 7v5l3 2" })]), l(" 选择时间 ")], -1), c("button", {
|
|
1149
|
+
type: "button",
|
|
1150
|
+
class: "m-datepicker-popup__time-close",
|
|
1151
|
+
"aria-label": "收起时间选择",
|
|
1152
|
+
onClick: d[7] ||= (e) => N.value = !1
|
|
1153
|
+
}, [...d[23] ||= [c("svg", {
|
|
1154
|
+
viewBox: "0 0 24 24",
|
|
1155
|
+
width: "12",
|
|
1156
|
+
height: "12",
|
|
1157
|
+
fill: "none",
|
|
1158
|
+
stroke: "currentColor",
|
|
1159
|
+
"stroke-width": "2.6",
|
|
1160
|
+
"stroke-linecap": "round",
|
|
1161
|
+
"aria-hidden": "true"
|
|
1162
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])]),
|
|
1163
|
+
c("div", ht, [u(He, {
|
|
1164
|
+
hour: j.value.hour,
|
|
1165
|
+
"onUpdate:hour": [d[8] ||= (e) => j.value.hour = e, fe],
|
|
1166
|
+
minute: j.value.minute,
|
|
1167
|
+
"onUpdate:minute": [d[9] ||= (e) => j.value.minute = e, fe],
|
|
1168
|
+
second: j.value.second,
|
|
1169
|
+
"onUpdate:second": [d[10] ||= (e) => j.value.second = e, fe]
|
|
1170
|
+
}, null, 8, [
|
|
1171
|
+
"hour",
|
|
1172
|
+
"minute",
|
|
1173
|
+
"second"
|
|
1174
|
+
])]),
|
|
1175
|
+
c("div", gt, [c("button", {
|
|
1176
|
+
type: "button",
|
|
1177
|
+
class: "m-datepicker-popup__time-done",
|
|
1178
|
+
onClick: d[11] ||= (e) => N.value = !1
|
|
1179
|
+
}, " 完成 ")])
|
|
1180
|
+
])])) : o("", !0)]),
|
|
1181
|
+
_: 1
|
|
1182
|
+
})
|
|
1183
|
+
]), c("div", _t, [
|
|
1184
|
+
k.value ? (v(), s("button", {
|
|
1185
|
+
key: 0,
|
|
1186
|
+
type: "button",
|
|
1187
|
+
class: h(["m-datepicker-popup__clock", { "is-active": N.value }]),
|
|
1188
|
+
"aria-label": "选择时间",
|
|
1189
|
+
onClick: d[13] ||= (e) => N.value = !N.value
|
|
1190
|
+
}, [...d[25] ||= [c("svg", {
|
|
1191
|
+
viewBox: "0 0 24 24",
|
|
1192
|
+
width: "15",
|
|
1193
|
+
height: "15",
|
|
1194
|
+
fill: "none",
|
|
1195
|
+
stroke: "currentColor",
|
|
1196
|
+
"stroke-width": "2",
|
|
1197
|
+
"stroke-linecap": "round",
|
|
1198
|
+
"stroke-linejoin": "round",
|
|
1199
|
+
"aria-hidden": "true"
|
|
1200
|
+
}, [c("circle", {
|
|
1201
|
+
cx: "12",
|
|
1202
|
+
cy: "12",
|
|
1203
|
+
r: "9"
|
|
1204
|
+
}), c("path", { d: "M12 7v5l3 2" })], -1)]], 2)) : o("", !0),
|
|
1205
|
+
k.value ? (v(), s("button", {
|
|
1206
|
+
key: 1,
|
|
1207
|
+
type: "button",
|
|
1208
|
+
class: "m-datepicker-popup__today",
|
|
1209
|
+
onClick: de
|
|
1210
|
+
}, " 此刻 ")) : (v(), s("button", {
|
|
1211
|
+
key: 2,
|
|
1212
|
+
type: "button",
|
|
1213
|
+
class: "m-datepicker-popup__today",
|
|
1214
|
+
disabled: X(E(H)),
|
|
1215
|
+
onClick: ue
|
|
1216
|
+
}, " 今天 ", 8, vt)),
|
|
1217
|
+
k.value ? (v(), s("span", yt)) : o("", !0),
|
|
1218
|
+
k.value ? (v(), s("button", {
|
|
1219
|
+
key: 4,
|
|
1220
|
+
type: "button",
|
|
1221
|
+
class: "m-datepicker-popup__confirm",
|
|
1222
|
+
disabled: !D.value,
|
|
1223
|
+
onClick: pe
|
|
1224
|
+
}, " 确定 ", 8, bt)) : o("", !0)
|
|
1225
|
+
])], 64))])], 4)) : o("", !0)]),
|
|
1226
|
+
_: 1
|
|
1227
|
+
})], 8, ["disabled"]))], 64));
|
|
1228
|
+
}
|
|
1229
|
+
}), Ct = {
|
|
1230
|
+
placeholder: "开始日期 ~ 结束日期",
|
|
1231
|
+
format: "YYYY-MM-DD",
|
|
1232
|
+
disabled: !1,
|
|
1233
|
+
clearable: !1,
|
|
1234
|
+
size: "default",
|
|
1235
|
+
appendToBody: !0,
|
|
1236
|
+
popupPlacement: "bottom"
|
|
1237
|
+
}, wt = [
|
|
1238
|
+
"value",
|
|
1239
|
+
"placeholder",
|
|
1240
|
+
"disabled",
|
|
1241
|
+
"name"
|
|
1242
|
+
], Tt = { class: "m-daterangepicker-popup__content" }, Et = {
|
|
1243
|
+
key: 0,
|
|
1244
|
+
class: "m-drp__ym"
|
|
1245
|
+
}, Dt = { class: "m-drp__ym-head" }, Ot = { class: "m-drp__ym-title" }, kt = {
|
|
1246
|
+
key: 2,
|
|
1247
|
+
class: "m-drp__ym-head-spacer"
|
|
1248
|
+
}, At = { class: "m-drp__ym-grid" }, jt = ["disabled", "onClick"], Mt = ["disabled", "onClick"], Nt = {
|
|
1249
|
+
key: 1,
|
|
1250
|
+
class: "m-drp__calendar m-drp__months"
|
|
1251
|
+
}, Pt = { class: "m-drp__header" }, Ft = ["disabled"], It = { class: "m-drp__label" }, Lt = ["disabled"], Rt = { class: "m-drp__weekdays" }, zt = { class: "m-drp__grid" }, Bt = [
|
|
1252
|
+
"disabled",
|
|
1253
|
+
"onClick",
|
|
1254
|
+
"onMouseenter"
|
|
1255
|
+
], Vt = { class: "m-drp__day-circle" }, Ht = { class: "m-drp__time-panel" }, Ut = { class: "m-drp__time-head" }, Wt = { class: "m-drp__time-body" }, Gt = { class: "m-drp__time-item" }, Kt = { class: "m-drp__time-item" }, qt = { class: "m-drp__time-foot" }, Jt = { class: "m-drp__footer" }, Yt = ["disabled"], Xt = 4, Zt = /* @__PURE__ */ d({
|
|
1256
|
+
__name: "DateRangePicker",
|
|
1257
|
+
props: /*@__PURE__*/ p({
|
|
1258
|
+
modelValue: {},
|
|
1259
|
+
placeholder: {},
|
|
1260
|
+
format: {},
|
|
1261
|
+
disabled: { type: Boolean },
|
|
1262
|
+
clearable: { type: Boolean },
|
|
1263
|
+
size: {},
|
|
1264
|
+
min: {},
|
|
1265
|
+
max: {},
|
|
1266
|
+
appendToBody: { type: Boolean },
|
|
1267
|
+
popupPlacement: {},
|
|
1268
|
+
width: {},
|
|
1269
|
+
name: {}
|
|
1270
|
+
}, Ct),
|
|
1271
|
+
emits: [
|
|
1272
|
+
"update:modelValue",
|
|
1273
|
+
"change",
|
|
1274
|
+
"open",
|
|
1275
|
+
"close"
|
|
1276
|
+
],
|
|
1277
|
+
setup(r, { emit: d }) {
|
|
1278
|
+
let f = r, p = d, y = x(null), b = x(null), S = x(!1), w = x(!1), D = x(null), k = x([null, null]), j = i(() => /H|mm|ss/.test(f.format)), N = x({
|
|
1279
|
+
hour: 0,
|
|
1280
|
+
minute: 0,
|
|
1281
|
+
second: 0
|
|
1282
|
+
}), P = x({
|
|
1283
|
+
hour: 0,
|
|
1284
|
+
minute: 0,
|
|
1285
|
+
second: 0
|
|
1286
|
+
}), F = x(!1);
|
|
1287
|
+
function I(e) {
|
|
1288
|
+
return e ? {
|
|
1289
|
+
hour: e.getHours(),
|
|
1290
|
+
minute: e.getMinutes(),
|
|
1291
|
+
second: e.getSeconds()
|
|
1292
|
+
} : {
|
|
1293
|
+
hour: 0,
|
|
1294
|
+
minute: 0,
|
|
1295
|
+
second: 0
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
let L = x({
|
|
1299
|
+
top: 0,
|
|
1300
|
+
left: 0,
|
|
1301
|
+
side: "bottom"
|
|
1302
|
+
}), ee = je(/* @__PURE__ */ new Date());
|
|
1303
|
+
function R(e) {
|
|
1304
|
+
return new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1305
|
+
}
|
|
1306
|
+
function z(e, t) {
|
|
1307
|
+
return new Date(e.getFullYear(), e.getMonth() + t, 1);
|
|
1308
|
+
}
|
|
1309
|
+
let B = x(R(/* @__PURE__ */ new Date())), V = i(() => z(B.value, 1)), te = i(() => [B.value, V.value]), H = x("date"), U = x(0), W = i(() => Array.from({ length: 12 }, (e, t) => U.value + t));
|
|
1310
|
+
function ne() {
|
|
1311
|
+
U.value = Math.floor(B.value.getFullYear() / 12) * 12, H.value = "year", F.value = !1;
|
|
1312
|
+
}
|
|
1313
|
+
function G() {
|
|
1314
|
+
H.value = "month", F.value = !1;
|
|
1315
|
+
}
|
|
1316
|
+
function K(e) {
|
|
1317
|
+
U.value += e * 12;
|
|
1318
|
+
}
|
|
1319
|
+
function q(e) {
|
|
1320
|
+
let t = $(f.min), n = $(f.max), r = new Date(e, 0, 1), i = new Date(e, 11, 1);
|
|
1321
|
+
return !!(t && i < R(t) || n && r > R(n));
|
|
1322
|
+
}
|
|
1323
|
+
function J(e) {
|
|
1324
|
+
B.value = new Date(e, B.value.getMonth(), 1), H.value = "month";
|
|
1325
|
+
}
|
|
1326
|
+
function re(e) {
|
|
1327
|
+
let t = new Date(B.value.getFullYear(), e - 1, 1), n = $(f.min), r = $(f.max);
|
|
1328
|
+
return !!(n && t < R(n) || r && t > R(r));
|
|
1329
|
+
}
|
|
1330
|
+
function ie(e) {
|
|
1331
|
+
B.value = new Date(B.value.getFullYear(), e - 1, 1), H.value = "date";
|
|
1332
|
+
}
|
|
1333
|
+
let Y = i(() => k.value[0]), X = i(() => k.value[1]), ae = i(() => !!Y.value && !!X.value), Z = i(() => f.clearable && !f.disabled && ae.value), oe = i(() => {
|
|
1334
|
+
let e = (e) => e ? Ae(e, f.format) : "", t = Y.value, n = X.value;
|
|
1335
|
+
return t && n ? `${e(t)} ~ ${e(n)}` : t ? e(t) : "";
|
|
1336
|
+
}), se = i(() => Array.isArray(f.placeholder) ? f.placeholder[0] : f.placeholder), ce = i(() => Array.isArray(f.placeholder) ? f.placeholder[1] : f.placeholder), le = i(() => Y.value ? ce.value : se.value);
|
|
1337
|
+
O(() => f.modelValue, (e) => {
|
|
1338
|
+
k.value = [$(e?.[0] ?? null), $(e?.[1] ?? null)];
|
|
1339
|
+
}, { immediate: !0 }), O(k, (e) => {
|
|
1340
|
+
N.value = I(e[0]), P.value = I(e[1]);
|
|
1341
|
+
}, { immediate: !0 });
|
|
1342
|
+
function ue(e) {
|
|
1343
|
+
let t = $(f.min), n = $(f.max);
|
|
1344
|
+
return !!(t && e < je(t) || n && e > je(n));
|
|
1345
|
+
}
|
|
1346
|
+
function de(e) {
|
|
1347
|
+
let t = R(B.value);
|
|
1348
|
+
if (e < t) {
|
|
1349
|
+
B.value = R(e);
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
e >= z(t, 1) && (B.value = R(e));
|
|
1353
|
+
}
|
|
1354
|
+
function fe(e) {
|
|
1355
|
+
if (ue(e)) return;
|
|
1356
|
+
de(e);
|
|
1357
|
+
let t = Y.value, n = X.value;
|
|
1358
|
+
!t || t && n ? k.value = [e, null] : e < t ? k.value = [e, t] : k.value = [t, e], pe();
|
|
1359
|
+
}
|
|
1360
|
+
function pe() {
|
|
1361
|
+
let e = (e) => e ? Ae(e, f.format) : null, t = [e(Y.value), e(X.value)];
|
|
1362
|
+
p("update:modelValue", t), p("change", t);
|
|
1363
|
+
}
|
|
1364
|
+
function Q() {
|
|
1365
|
+
k.value = [null, null], D.value = null, p("update:modelValue", null), p("change", null);
|
|
1366
|
+
}
|
|
1367
|
+
function me() {
|
|
1368
|
+
ae.value && we();
|
|
1369
|
+
}
|
|
1370
|
+
function he(e) {
|
|
1371
|
+
let t = e === "start" ? 0 : 1, n = k.value[t], r = e === "start" ? N.value : P.value;
|
|
1372
|
+
if (!n) return;
|
|
1373
|
+
let i = [k.value[0], k.value[1]];
|
|
1374
|
+
i[t] = new Date(n.getFullYear(), n.getMonth(), n.getDate(), r.hour, r.minute, r.second), k.value = i, pe();
|
|
1375
|
+
}
|
|
1376
|
+
function ge(e) {
|
|
1377
|
+
let t = Y.value, n = X.value, r = D.value, i = Ne(e, B.value) || Ne(e, V.value), a = !!(t && n && e >= t && e <= n), o = !!(t && !n && r && (e >= t && e <= r || e <= t && e >= r));
|
|
1378
|
+
return {
|
|
1379
|
+
"is-outside": !i,
|
|
1380
|
+
"is-today": Me(e, ee),
|
|
1381
|
+
"is-in-range": a,
|
|
1382
|
+
"is-hover-range": o,
|
|
1383
|
+
"is-start": !!t && Me(e, t),
|
|
1384
|
+
"is-end": !!n && Me(e, n),
|
|
1385
|
+
"is-hover-end": !!o && Me(e, r)
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
function _e(e) {
|
|
1389
|
+
D.value = e;
|
|
1390
|
+
}
|
|
1391
|
+
function ve() {
|
|
1392
|
+
D.value = null;
|
|
1393
|
+
}
|
|
1394
|
+
function ye() {
|
|
1395
|
+
let e = z(B.value, -1), t = $(f.min);
|
|
1396
|
+
return !t || e.getTime() >= R(t).getTime();
|
|
1397
|
+
}
|
|
1398
|
+
function be() {
|
|
1399
|
+
let e = z(V.value, 1), t = $(f.max);
|
|
1400
|
+
return !t || e.getTime() <= R(t).getTime();
|
|
1401
|
+
}
|
|
1402
|
+
function xe() {
|
|
1403
|
+
ye() && (B.value = z(B.value, -1));
|
|
1404
|
+
}
|
|
1405
|
+
function Se() {
|
|
1406
|
+
be() && (B.value = z(B.value, 1));
|
|
1407
|
+
}
|
|
1408
|
+
function Ce() {
|
|
1409
|
+
if (f.disabled || S.value) return;
|
|
1410
|
+
let e = Y.value ?? /* @__PURE__ */ new Date();
|
|
1411
|
+
B.value = R(e), H.value = "date", F.value = !1, S.value = !0, p("open"), Ge(), document.addEventListener("pointerdown", ke), window.addEventListener("scroll", Re, !0), window.addEventListener("resize", Re), m(() => {
|
|
1412
|
+
Te(), b.value?.focus({ preventScroll: !0 });
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
function we() {
|
|
1416
|
+
S.value && (S.value = !1, p("close"), Le(), Ke(), document.removeEventListener("pointerdown", ke), window.removeEventListener("scroll", Re, !0), window.removeEventListener("resize", Re));
|
|
1417
|
+
}
|
|
1418
|
+
function Te() {
|
|
1419
|
+
let e = y.value, t = b.value;
|
|
1420
|
+
if (!e || !t) return;
|
|
1421
|
+
let n = e.getBoundingClientRect(), r = t.offsetWidth, i = t.offsetHeight, a = window.innerWidth, o = window.innerHeight, s = Math.min(Math.max(0, n.left), Math.max(0, a - r - 8));
|
|
1422
|
+
s + r > a - 8 && (s = a - r - 8), s = Math.max(0, s);
|
|
1423
|
+
let c = Math.max(0, n.top - Xt), l = Math.max(0, o - n.bottom - Xt), u = f.popupPlacement === "top", d = u ? c : l, p = u ? l : c, m;
|
|
1424
|
+
m = d >= i ? u : p >= i || p > d ? !u : u;
|
|
1425
|
+
let h = m ? Math.max(0, n.top - Xt - i) : n.bottom + Xt;
|
|
1426
|
+
L.value = {
|
|
1427
|
+
top: h,
|
|
1428
|
+
left: s,
|
|
1429
|
+
side: m ? "top" : "bottom"
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
function Ee() {
|
|
1433
|
+
f.disabled || (S.value ? we() : Ce());
|
|
1434
|
+
}
|
|
1435
|
+
function De() {
|
|
1436
|
+
Ee(), (y.value?.querySelector("input"))?.focus();
|
|
1437
|
+
}
|
|
1438
|
+
function Oe(e) {
|
|
1439
|
+
f.disabled || (e.key === "Enter" || e.key === " " ? (e.preventDefault(), S.value || Ce()) : e.key === "Escape" && S.value && (e.preventDefault(), we()));
|
|
1440
|
+
}
|
|
1441
|
+
function ke(e) {
|
|
1442
|
+
let t = e.target;
|
|
1443
|
+
!y.value?.contains(t) && !b.value?.contains(t) && we();
|
|
1444
|
+
}
|
|
1445
|
+
let Ie = null;
|
|
1446
|
+
function Le() {
|
|
1447
|
+
Ie !== null && (cancelAnimationFrame(Ie), Ie = null);
|
|
1448
|
+
}
|
|
1449
|
+
function Re(e) {
|
|
1450
|
+
let t = e.target;
|
|
1451
|
+
t instanceof Node && b.value?.contains(t) || Ie === null && (Ie = requestAnimationFrame(() => {
|
|
1452
|
+
if (Ie = null, !S.value) return;
|
|
1453
|
+
let e = y.value?.getBoundingClientRect();
|
|
1454
|
+
e && (e.bottom > 0 && e.top < window.innerHeight && e.right > 0 && e.left < window.innerWidth ? Te() : we());
|
|
1455
|
+
}));
|
|
1456
|
+
}
|
|
1457
|
+
function ze(e, t) {
|
|
1458
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim(), r = parseFloat(n);
|
|
1459
|
+
return Number.isFinite(r) ? r : t;
|
|
1460
|
+
}
|
|
1461
|
+
function Be(e, t, n) {
|
|
1462
|
+
let r = e.getBoundingClientRect();
|
|
1463
|
+
if (t) {
|
|
1464
|
+
let e = t.getBoundingClientRect(), i = n === "top" ? e.top - r.top : e.bottom - r.top;
|
|
1465
|
+
return `${e.left - r.left}px ${i}px`;
|
|
1466
|
+
}
|
|
1467
|
+
return "center";
|
|
1468
|
+
}
|
|
1469
|
+
function Ve(e, t) {
|
|
1470
|
+
for (let t of e) t && (t.style.transition = "", t.style.opacity = "", t.style.transform = "", t.style.transformOrigin = "");
|
|
1471
|
+
t();
|
|
1472
|
+
}
|
|
1473
|
+
let Ue = 0;
|
|
1474
|
+
function We(e, t, n) {
|
|
1475
|
+
let r = e[0];
|
|
1476
|
+
if (!r) return;
|
|
1477
|
+
let i = ++Ue, a = !1, o = e.filter((e) => !!e && e !== r), s = /* @__PURE__ */ new Set(), c = () => {
|
|
1478
|
+
a || (a = !0, window.clearTimeout(u), r.removeEventListener("transitionend", l), i === Ue ? Ve(e, n) : n());
|
|
1479
|
+
}, l = (e) => {
|
|
1480
|
+
let t = e.target;
|
|
1481
|
+
!t || !o.includes(t) || (s.add(t), s.size >= o.length && c());
|
|
1482
|
+
}, u = window.setTimeout(c, t + 80);
|
|
1483
|
+
o.length > 0 ? r.addEventListener("transitionend", l) : c();
|
|
1484
|
+
}
|
|
1485
|
+
function qe(e, t) {
|
|
1486
|
+
let n = e, r = n.querySelector(".m-daterangepicker-popup__surface"), i = n.querySelector(".m-daterangepicker-popup__content"), a = ze("--m-dur-entering", 225), o = "var(--m-ease-in-out, ease)";
|
|
1487
|
+
Te(), m(() => {
|
|
1488
|
+
r && (r.style.transformOrigin = Be(r, y.value, L.value.side), r.style.transform = "scale(1, 0)"), i && (i.style.opacity = "0"), n.offsetWidth, requestAnimationFrame(() => {
|
|
1489
|
+
let e = Math.round(a * 1.4), s = e;
|
|
1490
|
+
if (r && (r.style.transition = `transform ${e}ms ${o}`, r.style.transform = ""), i) {
|
|
1491
|
+
let t = Math.round(a * .7), n = Math.round(e * .85);
|
|
1492
|
+
i.style.transition = `opacity ${t}ms ${o} ${n}ms`, i.style.opacity = "1", s = Math.max(s, n + t);
|
|
1493
|
+
}
|
|
1494
|
+
We([
|
|
1495
|
+
n,
|
|
1496
|
+
r,
|
|
1497
|
+
i
|
|
1498
|
+
], s, t);
|
|
1499
|
+
});
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
function Je(e, t) {
|
|
1503
|
+
let n = e, r = n.querySelector(".m-daterangepicker-popup__surface"), i = n.querySelector(".m-daterangepicker-popup__content"), a = ze("--m-dur-leaving", 195), o = "var(--m-ease-in-out, ease)", s = Math.round(a * 1), c = s;
|
|
1504
|
+
if (r && (r.style.transformOrigin = Be(r, y.value, L.value.side), r.style.transition = `opacity ${s}ms ${o}, transform ${s}ms ${o}`, r.style.transform = "scale(0.96)", r.style.opacity = "0"), i) {
|
|
1505
|
+
let e = Math.round(a * .6);
|
|
1506
|
+
i.style.transition = `opacity ${e}ms ${o}`, i.style.opacity = "0", c = Math.max(c, e);
|
|
1507
|
+
}
|
|
1508
|
+
We([
|
|
1509
|
+
n,
|
|
1510
|
+
r,
|
|
1511
|
+
i
|
|
1512
|
+
], c, t);
|
|
1513
|
+
}
|
|
1514
|
+
return _(() => {
|
|
1515
|
+
Ke(), Le(), document.removeEventListener("pointerdown", ke), window.removeEventListener("scroll", Re, !0), window.removeEventListener("resize", Re);
|
|
1516
|
+
}), (i, d) => (v(), s(e, null, [c("div", {
|
|
1517
|
+
ref_key: "triggerRef",
|
|
1518
|
+
ref: y,
|
|
1519
|
+
class: h(["m-daterangepicker", [
|
|
1520
|
+
`m-daterangepicker--${r.size}`,
|
|
1521
|
+
w.value && "is-focused",
|
|
1522
|
+
r.disabled && "is-disabled",
|
|
1523
|
+
S.value && "is-open"
|
|
1524
|
+
]]),
|
|
1525
|
+
style: g(r.width ? { width: r.width } : void 0)
|
|
1526
|
+
}, [
|
|
1527
|
+
c("span", {
|
|
1528
|
+
class: "m-daterangepicker__icon",
|
|
1529
|
+
"aria-hidden": "true",
|
|
1530
|
+
onClick: De
|
|
1531
|
+
}, [...d[22] ||= [c("svg", {
|
|
1532
|
+
viewBox: "0 0 24 24",
|
|
1533
|
+
width: "18",
|
|
1534
|
+
height: "18",
|
|
1535
|
+
fill: "none",
|
|
1536
|
+
stroke: "currentColor",
|
|
1537
|
+
"stroke-width": "1.8",
|
|
1538
|
+
"stroke-linecap": "round",
|
|
1539
|
+
"stroke-linejoin": "round"
|
|
1540
|
+
}, [c("rect", {
|
|
1541
|
+
x: "3",
|
|
1542
|
+
y: "5",
|
|
1543
|
+
width: "18",
|
|
1544
|
+
height: "16",
|
|
1545
|
+
rx: "2"
|
|
1546
|
+
}), c("path", { d: "M3 9h18M8 3v4m8-4v4" })], -1)]]),
|
|
1547
|
+
c("input", {
|
|
1548
|
+
class: "m-daterangepicker__input",
|
|
1549
|
+
type: "text",
|
|
1550
|
+
readonly: "",
|
|
1551
|
+
value: oe.value,
|
|
1552
|
+
placeholder: le.value,
|
|
1553
|
+
disabled: r.disabled,
|
|
1554
|
+
name: r.name,
|
|
1555
|
+
onClick: Ee,
|
|
1556
|
+
onFocus: d[0] ||= (e) => w.value = !0,
|
|
1557
|
+
onBlur: d[1] ||= (e) => w.value = !1,
|
|
1558
|
+
onKeydown: Oe
|
|
1559
|
+
}, null, 40, wt),
|
|
1560
|
+
Z.value ? (v(), s("button", {
|
|
1561
|
+
key: 0,
|
|
1562
|
+
type: "button",
|
|
1563
|
+
class: "m-daterangepicker__clear",
|
|
1564
|
+
tabindex: "-1",
|
|
1565
|
+
"aria-label": "清除日期范围",
|
|
1566
|
+
onMousedown: d[2] ||= M(() => {}, ["prevent"]),
|
|
1567
|
+
onClick: Q
|
|
1568
|
+
}, [...d[23] ||= [c("svg", {
|
|
1569
|
+
viewBox: "0 0 24 24",
|
|
1570
|
+
width: "13",
|
|
1571
|
+
height: "13",
|
|
1572
|
+
fill: "none",
|
|
1573
|
+
stroke: "currentColor",
|
|
1574
|
+
"stroke-width": "2.4",
|
|
1575
|
+
"stroke-linecap": "round",
|
|
1576
|
+
"aria-hidden": "true"
|
|
1577
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 32)) : o("", !0)
|
|
1578
|
+
], 6), (v(), a(t, {
|
|
1579
|
+
to: "body",
|
|
1580
|
+
disabled: !r.appendToBody
|
|
1581
|
+
}, [u(n, {
|
|
1582
|
+
css: !1,
|
|
1583
|
+
onEnter: qe,
|
|
1584
|
+
onLeave: Je
|
|
1585
|
+
}, {
|
|
1586
|
+
default: A(() => [S.value ? (v(), s("div", {
|
|
1587
|
+
key: 0,
|
|
1588
|
+
ref_key: "panelRef",
|
|
1589
|
+
ref: b,
|
|
1590
|
+
class: "m-daterangepicker-popup",
|
|
1591
|
+
tabindex: "-1",
|
|
1592
|
+
style: g({
|
|
1593
|
+
top: L.value.top + "px",
|
|
1594
|
+
left: L.value.left + "px"
|
|
1595
|
+
})
|
|
1596
|
+
}, [d[35] ||= c("div", {
|
|
1597
|
+
class: "m-daterangepicker-popup__surface",
|
|
1598
|
+
"aria-hidden": "true"
|
|
1599
|
+
}, null, -1), c("div", Tt, [H.value === "date" ? (v(), s("div", Nt, [(v(!0), s(e, null, C(te.value, (t, n) => (v(), s("section", {
|
|
1600
|
+
key: t.getTime(),
|
|
1601
|
+
class: "m-drp__month"
|
|
1602
|
+
}, [
|
|
1603
|
+
c("div", Pt, [
|
|
1604
|
+
n === 0 ? (v(), s("button", {
|
|
1605
|
+
key: 0,
|
|
1606
|
+
type: "button",
|
|
1607
|
+
class: "m-drp__nav",
|
|
1608
|
+
"aria-label": "上一个月",
|
|
1609
|
+
disabled: !ye(),
|
|
1610
|
+
onClick: xe
|
|
1611
|
+
}, [...d[27] ||= [c("svg", {
|
|
1612
|
+
viewBox: "0 0 24 24",
|
|
1613
|
+
width: "18",
|
|
1614
|
+
height: "18",
|
|
1615
|
+
fill: "none",
|
|
1616
|
+
stroke: "currentColor",
|
|
1617
|
+
"stroke-width": "2.2",
|
|
1618
|
+
"stroke-linecap": "round",
|
|
1619
|
+
"stroke-linejoin": "round",
|
|
1620
|
+
"aria-hidden": "true"
|
|
1621
|
+
}, [c("path", { d: "M15 6l-6 6 6 6" })], -1)]], 8, Ft)) : o("", !0),
|
|
1622
|
+
c("div", It, [c("button", {
|
|
1623
|
+
type: "button",
|
|
1624
|
+
class: "m-drp__label-btn",
|
|
1625
|
+
onClick: ne
|
|
1626
|
+
}, T(t.getFullYear()) + " 年 ", 1), c("button", {
|
|
1627
|
+
type: "button",
|
|
1628
|
+
class: "m-drp__label-btn",
|
|
1629
|
+
onClick: G
|
|
1630
|
+
}, T(t.getMonth() + 1) + " 月 ", 1)]),
|
|
1631
|
+
n === 1 ? (v(), s("button", {
|
|
1632
|
+
key: 1,
|
|
1633
|
+
type: "button",
|
|
1634
|
+
class: "m-drp__nav",
|
|
1635
|
+
"aria-label": "下一个月",
|
|
1636
|
+
disabled: !be(),
|
|
1637
|
+
onClick: Se
|
|
1638
|
+
}, [...d[28] ||= [c("svg", {
|
|
1639
|
+
viewBox: "0 0 24 24",
|
|
1640
|
+
width: "18",
|
|
1641
|
+
height: "18",
|
|
1642
|
+
fill: "none",
|
|
1643
|
+
stroke: "currentColor",
|
|
1644
|
+
"stroke-width": "2.2",
|
|
1645
|
+
"stroke-linecap": "round",
|
|
1646
|
+
"stroke-linejoin": "round",
|
|
1647
|
+
"aria-hidden": "true"
|
|
1648
|
+
}, [c("path", { d: "M9 6l6 6-6 6" })], -1)]], 8, Lt)) : o("", !0)
|
|
1649
|
+
]),
|
|
1650
|
+
c("div", Rt, [(v(!0), s(e, null, C(E(Fe), (e) => (v(), s("span", {
|
|
1651
|
+
key: e,
|
|
1652
|
+
class: "m-drp__weekday"
|
|
1653
|
+
}, T(e), 1))), 128))]),
|
|
1654
|
+
c("div", zt, [(v(!0), s(e, null, C(E(Pe)(t), (e) => (v(), s("button", {
|
|
1655
|
+
key: e.getTime(),
|
|
1656
|
+
type: "button",
|
|
1657
|
+
class: h(["m-drp__day", ge(e)]),
|
|
1658
|
+
disabled: ue(e),
|
|
1659
|
+
onClick: (t) => fe(e),
|
|
1660
|
+
onMouseenter: (t) => _e(e),
|
|
1661
|
+
onMouseleave: ve
|
|
1662
|
+
}, [c("span", Vt, T(e.getDate()), 1)], 42, Bt))), 128))])
|
|
1663
|
+
]))), 128)), u(n, { name: "m-datepicker-time" }, {
|
|
1664
|
+
default: A(() => [F.value ? (v(), s("div", {
|
|
1665
|
+
key: 0,
|
|
1666
|
+
class: "m-drp__time",
|
|
1667
|
+
onClick: d[20] ||= M((e) => F.value = !1, ["self"])
|
|
1668
|
+
}, [c("div", Ht, [
|
|
1669
|
+
c("div", Ut, [d[30] ||= c("span", { class: "m-drp__time-title" }, [c("svg", {
|
|
1670
|
+
viewBox: "0 0 24 24",
|
|
1671
|
+
width: "13",
|
|
1672
|
+
height: "13",
|
|
1673
|
+
fill: "none",
|
|
1674
|
+
stroke: "currentColor",
|
|
1675
|
+
"stroke-width": "2",
|
|
1676
|
+
"stroke-linecap": "round",
|
|
1677
|
+
"stroke-linejoin": "round",
|
|
1678
|
+
"aria-hidden": "true"
|
|
1679
|
+
}, [c("circle", {
|
|
1680
|
+
cx: "12",
|
|
1681
|
+
cy: "12",
|
|
1682
|
+
r: "9"
|
|
1683
|
+
}), c("path", { d: "M12 7v5l3 2" })]), l(" 选择时间 ")], -1), c("button", {
|
|
1684
|
+
type: "button",
|
|
1685
|
+
class: "m-drp__time-close",
|
|
1686
|
+
"aria-label": "收起时间选择",
|
|
1687
|
+
onClick: d[6] ||= (e) => F.value = !1
|
|
1688
|
+
}, [...d[29] ||= [c("svg", {
|
|
1689
|
+
viewBox: "0 0 24 24",
|
|
1690
|
+
width: "12",
|
|
1691
|
+
height: "12",
|
|
1692
|
+
fill: "none",
|
|
1693
|
+
stroke: "currentColor",
|
|
1694
|
+
"stroke-width": "2.6",
|
|
1695
|
+
"stroke-linecap": "round",
|
|
1696
|
+
"aria-hidden": "true"
|
|
1697
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])]),
|
|
1698
|
+
c("div", Wt, [c("div", Gt, [d[31] ||= c("span", { class: "m-drp__time-label" }, "开始", -1), u(He, {
|
|
1699
|
+
disabled: !Y.value,
|
|
1700
|
+
hour: N.value.hour,
|
|
1701
|
+
"onUpdate:hour": [d[7] ||= (e) => N.value.hour = e, d[10] ||= (e) => he("start")],
|
|
1702
|
+
minute: N.value.minute,
|
|
1703
|
+
"onUpdate:minute": [d[8] ||= (e) => N.value.minute = e, d[11] ||= (e) => he("start")],
|
|
1704
|
+
second: N.value.second,
|
|
1705
|
+
"onUpdate:second": [d[9] ||= (e) => N.value.second = e, d[12] ||= (e) => he("start")]
|
|
1706
|
+
}, null, 8, [
|
|
1707
|
+
"disabled",
|
|
1708
|
+
"hour",
|
|
1709
|
+
"minute",
|
|
1710
|
+
"second"
|
|
1711
|
+
])]), c("div", Kt, [d[32] ||= c("span", { class: "m-drp__time-label" }, "结束", -1), u(He, {
|
|
1712
|
+
disabled: !X.value,
|
|
1713
|
+
hour: P.value.hour,
|
|
1714
|
+
"onUpdate:hour": [d[13] ||= (e) => P.value.hour = e, d[16] ||= (e) => he("end")],
|
|
1715
|
+
minute: P.value.minute,
|
|
1716
|
+
"onUpdate:minute": [d[14] ||= (e) => P.value.minute = e, d[17] ||= (e) => he("end")],
|
|
1717
|
+
second: P.value.second,
|
|
1718
|
+
"onUpdate:second": [d[15] ||= (e) => P.value.second = e, d[18] ||= (e) => he("end")]
|
|
1719
|
+
}, null, 8, [
|
|
1720
|
+
"disabled",
|
|
1721
|
+
"hour",
|
|
1722
|
+
"minute",
|
|
1723
|
+
"second"
|
|
1724
|
+
])])]),
|
|
1725
|
+
c("div", qt, [c("button", {
|
|
1726
|
+
type: "button",
|
|
1727
|
+
class: "m-drp__time-done",
|
|
1728
|
+
onClick: d[19] ||= (e) => F.value = !1
|
|
1729
|
+
}, " 完成 ")])
|
|
1730
|
+
])])) : o("", !0)]),
|
|
1731
|
+
_: 1
|
|
1732
|
+
})])) : (v(), s("div", Et, [c("div", Dt, [
|
|
1733
|
+
c("button", {
|
|
1734
|
+
type: "button",
|
|
1735
|
+
class: "m-drp__ym-nav",
|
|
1736
|
+
"aria-label": "返回日期视图",
|
|
1737
|
+
onClick: d[3] ||= (e) => H.value = "date"
|
|
1738
|
+
}, [...d[24] ||= [c("svg", {
|
|
1739
|
+
viewBox: "0 0 24 24",
|
|
1740
|
+
width: "16",
|
|
1741
|
+
height: "16",
|
|
1742
|
+
fill: "none",
|
|
1743
|
+
stroke: "currentColor",
|
|
1744
|
+
"stroke-width": "2.2",
|
|
1745
|
+
"stroke-linecap": "round",
|
|
1746
|
+
"stroke-linejoin": "round",
|
|
1747
|
+
"aria-hidden": "true"
|
|
1748
|
+
}, [c("path", { d: "M15 6l-6 6 6 6" })], -1)]]),
|
|
1749
|
+
H.value === "year" ? (v(), s("button", {
|
|
1750
|
+
key: 0,
|
|
1751
|
+
type: "button",
|
|
1752
|
+
class: "m-drp__ym-nav",
|
|
1753
|
+
"aria-label": "前 12 年",
|
|
1754
|
+
onClick: d[4] ||= (e) => K(-1)
|
|
1755
|
+
}, [...d[25] ||= [c("svg", {
|
|
1756
|
+
viewBox: "0 0 24 24",
|
|
1757
|
+
width: "16",
|
|
1758
|
+
height: "16",
|
|
1759
|
+
fill: "none",
|
|
1760
|
+
stroke: "currentColor",
|
|
1761
|
+
"stroke-width": "2.2",
|
|
1762
|
+
"stroke-linecap": "round",
|
|
1763
|
+
"stroke-linejoin": "round",
|
|
1764
|
+
"aria-hidden": "true"
|
|
1765
|
+
}, [c("path", { d: "M11 6l-6 6 6 6M19 6l-6 6 6 6" })], -1)]])) : o("", !0),
|
|
1766
|
+
c("span", Ot, T(H.value === "year" ? `${U.value} – ${U.value + 11}` : `${B.value.getFullYear()} 年`), 1),
|
|
1767
|
+
H.value === "year" ? (v(), s("button", {
|
|
1768
|
+
key: 1,
|
|
1769
|
+
type: "button",
|
|
1770
|
+
class: "m-drp__ym-nav",
|
|
1771
|
+
"aria-label": "后 12 年",
|
|
1772
|
+
onClick: d[5] ||= (e) => K(1)
|
|
1773
|
+
}, [...d[26] ||= [c("svg", {
|
|
1774
|
+
viewBox: "0 0 24 24",
|
|
1775
|
+
width: "16",
|
|
1776
|
+
height: "16",
|
|
1777
|
+
fill: "none",
|
|
1778
|
+
stroke: "currentColor",
|
|
1779
|
+
"stroke-width": "2.2",
|
|
1780
|
+
"stroke-linecap": "round",
|
|
1781
|
+
"stroke-linejoin": "round",
|
|
1782
|
+
"aria-hidden": "true"
|
|
1783
|
+
}, [c("path", { d: "M13 6l6 6-6 6M5 6l6 6-6 6" })], -1)]])) : (v(), s("span", kt))
|
|
1784
|
+
]), c("div", At, [H.value === "year" ? (v(!0), s(e, { key: 0 }, C(W.value, (e) => (v(), s("button", {
|
|
1785
|
+
key: e,
|
|
1786
|
+
type: "button",
|
|
1787
|
+
class: h(["m-drp__ym-cell", { "is-active": e === B.value.getFullYear() }]),
|
|
1788
|
+
disabled: q(e),
|
|
1789
|
+
onClick: (t) => J(e)
|
|
1790
|
+
}, T(e), 11, jt))), 128)) : (v(), s(e, { key: 1 }, C(12, (e) => c("button", {
|
|
1791
|
+
key: e,
|
|
1792
|
+
type: "button",
|
|
1793
|
+
class: h(["m-drp__ym-cell", { "is-active": e === B.value.getMonth() + 1 }]),
|
|
1794
|
+
disabled: re(e),
|
|
1795
|
+
onClick: (t) => ie(e)
|
|
1796
|
+
}, T(e) + " 月 ", 11, Mt)), 64))])])), c("div", Jt, [
|
|
1797
|
+
j.value ? (v(), s("button", {
|
|
1798
|
+
key: 0,
|
|
1799
|
+
type: "button",
|
|
1800
|
+
class: h(["m-drp__clock", { "is-active": F.value }]),
|
|
1801
|
+
"aria-label": "选择时间",
|
|
1802
|
+
onClick: d[21] ||= (e) => F.value = !F.value
|
|
1803
|
+
}, [...d[33] ||= [c("svg", {
|
|
1804
|
+
viewBox: "0 0 24 24",
|
|
1805
|
+
width: "15",
|
|
1806
|
+
height: "15",
|
|
1807
|
+
fill: "none",
|
|
1808
|
+
stroke: "currentColor",
|
|
1809
|
+
"stroke-width": "2",
|
|
1810
|
+
"stroke-linecap": "round",
|
|
1811
|
+
"stroke-linejoin": "round",
|
|
1812
|
+
"aria-hidden": "true"
|
|
1813
|
+
}, [c("circle", {
|
|
1814
|
+
cx: "12",
|
|
1815
|
+
cy: "12",
|
|
1816
|
+
r: "9"
|
|
1817
|
+
}), c("path", { d: "M12 7v5l3 2" })], -1)]], 2)) : o("", !0),
|
|
1818
|
+
ae.value ? (v(), s("button", {
|
|
1819
|
+
key: 1,
|
|
1820
|
+
type: "button",
|
|
1821
|
+
class: "m-drp__clear-all",
|
|
1822
|
+
onClick: Q
|
|
1823
|
+
}, " 清除 ")) : o("", !0),
|
|
1824
|
+
d[34] ||= c("span", { class: "m-drp__footer-grow" }, null, -1),
|
|
1825
|
+
c("button", {
|
|
1826
|
+
type: "button",
|
|
1827
|
+
class: "m-drp__confirm",
|
|
1828
|
+
disabled: !ae.value,
|
|
1829
|
+
onClick: me
|
|
1830
|
+
}, " 确定 ", 8, Yt)
|
|
1831
|
+
])])], 4)) : o("", !0)]),
|
|
1832
|
+
_: 1
|
|
1833
|
+
})], 8, ["disabled"]))], 64));
|
|
1834
|
+
}
|
|
1835
|
+
}), Qt = {
|
|
1836
|
+
closeOnClickOverlay: !0,
|
|
1837
|
+
closeOnPressEscape: !0,
|
|
1838
|
+
appendToBody: !0,
|
|
1839
|
+
showClose: !0,
|
|
1840
|
+
width: 420,
|
|
1841
|
+
fullscreen: !1,
|
|
1842
|
+
anchor: null
|
|
1843
|
+
}, $t = { class: "m-dialog__content" }, en = {
|
|
1844
|
+
key: 0,
|
|
1845
|
+
class: "m-dialog__header"
|
|
1846
|
+
}, tn = {
|
|
1847
|
+
key: 0,
|
|
1848
|
+
class: "m-dialog__title"
|
|
1849
|
+
}, nn = { class: "m-dialog__body" }, rn = {
|
|
1850
|
+
key: 1,
|
|
1851
|
+
class: "m-dialog__footer"
|
|
1852
|
+
}, an = /* @__PURE__ */ d({
|
|
1853
|
+
__name: "Dialog",
|
|
1854
|
+
props: /*@__PURE__*/ p({
|
|
1855
|
+
modelValue: { type: Boolean },
|
|
1856
|
+
title: {},
|
|
1857
|
+
width: {},
|
|
1858
|
+
closeOnClickOverlay: { type: Boolean },
|
|
1859
|
+
closeOnPressEscape: { type: Boolean },
|
|
1860
|
+
appendToBody: { type: Boolean },
|
|
1861
|
+
showClose: { type: Boolean },
|
|
1862
|
+
fullscreen: { type: Boolean },
|
|
1863
|
+
anchor: {}
|
|
1864
|
+
}, Qt),
|
|
1865
|
+
emits: [
|
|
1866
|
+
"update:modelValue",
|
|
1867
|
+
"open",
|
|
1868
|
+
"close"
|
|
1869
|
+
],
|
|
1870
|
+
setup(r, { emit: d }) {
|
|
1871
|
+
let f = r, p = d, m = x(!!f.modelValue), y = x(null), b = i(() => f.anchor ?? y.value);
|
|
1872
|
+
function S(e) {
|
|
1873
|
+
y.value = e.currentTarget, p("update:modelValue", !0);
|
|
1874
|
+
}
|
|
1875
|
+
let C = i(() => {
|
|
1876
|
+
if (f.fullscreen) return;
|
|
1877
|
+
let e = f.width, t;
|
|
1878
|
+
return t = typeof e == "number" || typeof e == "string" && /^\d+(\.\d+)?$/.test(e) ? `${e}px` : e || void 0, t ? `width: ${t};` : void 0;
|
|
1879
|
+
});
|
|
1880
|
+
function E(e, t) {
|
|
1881
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim(), r = parseFloat(n);
|
|
1882
|
+
return Number.isFinite(r) ? r : t;
|
|
1883
|
+
}
|
|
1884
|
+
function D(e, t) {
|
|
1885
|
+
let n = e.getBoundingClientRect();
|
|
1886
|
+
if (t) {
|
|
1887
|
+
let e = t.getBoundingClientRect();
|
|
1888
|
+
return `${e.left + e.width / 2 - n.left}px ${e.top + e.height / 2 - n.top}px`;
|
|
1889
|
+
}
|
|
1890
|
+
return "center";
|
|
1891
|
+
}
|
|
1892
|
+
function k(e, t) {
|
|
1893
|
+
for (let t of e) t && (t.style.transition = "", t.style.opacity = "", t.style.transform = "", t.style.transformOrigin = "");
|
|
1894
|
+
t();
|
|
1895
|
+
}
|
|
1896
|
+
let j = 0;
|
|
1897
|
+
function M(e, t, n) {
|
|
1898
|
+
let r = e[0];
|
|
1899
|
+
if (!r) return;
|
|
1900
|
+
let i = ++j, a = !1, o = () => {
|
|
1901
|
+
a || (a = !0, window.clearTimeout(s), r.removeEventListener("transitionend", o), i === j ? k(e, n) : n());
|
|
1902
|
+
}, s = window.setTimeout(o, t + 80);
|
|
1903
|
+
r.addEventListener("transitionend", o);
|
|
1904
|
+
}
|
|
1905
|
+
function N(e, t) {
|
|
1906
|
+
let n = e, r = n.querySelector(".m-dialog__surface"), i = n.querySelector(".m-dialog__content"), a = n.querySelector(".m-dialog"), o = E("--m-dur-entering", 225), s = "var(--m-ease-in-out, ease)";
|
|
1907
|
+
if (f.fullscreen) {
|
|
1908
|
+
n.style.opacity = "0", a && (a.style.transform = "translateY(100%)"), n.offsetWidth, requestAnimationFrame(() => {
|
|
1909
|
+
n.style.transition = `opacity ${o}ms ${s}`, n.style.opacity = "1", a && (a.style.transition = `transform ${o}ms ${s}`, a.style.transform = ""), M([n, a], o, t);
|
|
1910
|
+
});
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
n.style.opacity = "0", r && (r.style.transformOrigin = D(r, b.value), r.style.transform = "scale(0)"), i && (i.style.opacity = "0"), n.offsetWidth, requestAnimationFrame(() => {
|
|
1914
|
+
let e = Math.round(o * 1.4);
|
|
1915
|
+
n.style.transition = `opacity ${e}ms ${s}`, n.style.opacity = "1";
|
|
1916
|
+
let a = e;
|
|
1917
|
+
if (r && (r.style.transition = `transform ${e}ms ${s}`, r.style.transform = ""), i) {
|
|
1918
|
+
let t = Math.round(o * .7), n = Math.round(e * .85);
|
|
1919
|
+
i.style.transition = `opacity ${t}ms ${s} ${n}ms`, i.style.opacity = "1", a = Math.max(a, n + t);
|
|
1920
|
+
}
|
|
1921
|
+
M([
|
|
1922
|
+
n,
|
|
1923
|
+
r,
|
|
1924
|
+
i
|
|
1925
|
+
], a, t);
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
function P(e, t) {
|
|
1929
|
+
let n = e, r = n.querySelector(".m-dialog__surface"), i = n.querySelector(".m-dialog__content"), a = n.querySelector(".m-dialog"), o = E("--m-dur-leaving", 195), s = "var(--m-ease-in-out, ease)";
|
|
1930
|
+
if (f.fullscreen) {
|
|
1931
|
+
n.style.transition = `opacity ${o}ms ${s}`, n.style.opacity = "0", a && (a.style.transition = `transform ${o}ms ${s}`, a.style.transform = "translateY(100%)"), M([n, a], o, t);
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
let c = Math.round(o * 1);
|
|
1935
|
+
n.style.transition = `opacity ${c}ms ${s}`, n.style.opacity = "0";
|
|
1936
|
+
let l = c;
|
|
1937
|
+
if (r && (r.style.transformOrigin = D(r, b.value), r.style.transition = `transform ${c}ms ${s}`, r.style.transform = "scale(0)"), i) {
|
|
1938
|
+
let e = Math.round(o * .6);
|
|
1939
|
+
i.style.transition = `opacity ${e}ms ${s}`, i.style.opacity = "0", l = Math.max(l, e);
|
|
1940
|
+
}
|
|
1941
|
+
M([
|
|
1942
|
+
n,
|
|
1943
|
+
r,
|
|
1944
|
+
i
|
|
1945
|
+
], l, t);
|
|
1946
|
+
}
|
|
1947
|
+
O(() => f.modelValue, (e) => {
|
|
1948
|
+
m.value = !!e, e ? (p("open"), document.body.style.overflow = "hidden", document.addEventListener("keydown", F)) : (p("close"), document.body.style.overflow = "", document.removeEventListener("keydown", F));
|
|
1949
|
+
});
|
|
1950
|
+
function F(e) {
|
|
1951
|
+
e.key === "Escape" && f.closeOnPressEscape && L();
|
|
1952
|
+
}
|
|
1953
|
+
function I() {
|
|
1954
|
+
f.closeOnClickOverlay && L();
|
|
1955
|
+
}
|
|
1956
|
+
function L() {
|
|
1957
|
+
p("update:modelValue", !1);
|
|
1958
|
+
}
|
|
1959
|
+
return _(() => {
|
|
1960
|
+
document.removeEventListener("keydown", F), document.body.style.overflow = "";
|
|
1961
|
+
}), (i, d) => (v(), s(e, null, [i.$slots.trigger ? (v(), s("span", {
|
|
1962
|
+
key: 0,
|
|
1963
|
+
class: "m-dialog__trigger",
|
|
1964
|
+
onClick: S
|
|
1965
|
+
}, [w(i.$slots, "trigger")])) : o("", !0), (v(), a(t, {
|
|
1966
|
+
to: "body",
|
|
1967
|
+
disabled: !r.appendToBody
|
|
1968
|
+
}, [u(n, {
|
|
1969
|
+
css: !1,
|
|
1970
|
+
onEnter: N,
|
|
1971
|
+
onLeave: P
|
|
1972
|
+
}, {
|
|
1973
|
+
default: A(() => [m.value ? (v(), s("div", {
|
|
1974
|
+
key: 0,
|
|
1975
|
+
class: h(["m-dialog-overlay", { "m-dialog-overlay--fullscreen": r.fullscreen }])
|
|
1976
|
+
}, [c("div", {
|
|
1977
|
+
class: "m-dialog-overlay__backdrop",
|
|
1978
|
+
onClick: I
|
|
1979
|
+
}), c("div", {
|
|
1980
|
+
class: h(["m-dialog", { "m-dialog--fullscreen": r.fullscreen }]),
|
|
1981
|
+
role: "dialog",
|
|
1982
|
+
"aria-modal": "true",
|
|
1983
|
+
style: g(C.value)
|
|
1984
|
+
}, [d[1] ||= c("div", {
|
|
1985
|
+
class: "m-dialog__surface",
|
|
1986
|
+
"aria-hidden": "true"
|
|
1987
|
+
}, null, -1), c("div", $t, [
|
|
1988
|
+
r.showClose || r.title || i.$slots.title ? (v(), s("header", en, [r.title || i.$slots.title ? (v(), s("h3", tn, [w(i.$slots, "title", {}, () => [l(T(r.title), 1)])])) : o("", !0), r.showClose ? (v(), s("button", {
|
|
1989
|
+
key: 1,
|
|
1990
|
+
type: "button",
|
|
1991
|
+
class: "m-dialog__close",
|
|
1992
|
+
"aria-label": "关闭对话框",
|
|
1993
|
+
onClick: L
|
|
1994
|
+
}, [...d[0] ||= [c("svg", {
|
|
1995
|
+
viewBox: "0 0 24 24",
|
|
1996
|
+
width: "16",
|
|
1997
|
+
height: "16",
|
|
1998
|
+
fill: "none",
|
|
1999
|
+
stroke: "currentColor",
|
|
2000
|
+
"stroke-width": "2.2",
|
|
2001
|
+
"stroke-linecap": "round",
|
|
2002
|
+
"aria-hidden": "true"
|
|
2003
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])) : o("", !0)])) : o("", !0),
|
|
2004
|
+
c("div", nn, [w(i.$slots, "default")]),
|
|
2005
|
+
i.$slots.footer ? (v(), s("footer", rn, [w(i.$slots, "footer")])) : o("", !0)
|
|
2006
|
+
])], 6)], 2)) : o("", !0)]),
|
|
2007
|
+
_: 3
|
|
2008
|
+
})], 8, ["disabled"]))], 64));
|
|
2009
|
+
}
|
|
2010
|
+
}), on = {
|
|
2011
|
+
placement: "right",
|
|
2012
|
+
size: 320,
|
|
2013
|
+
showClose: !0,
|
|
2014
|
+
closeOnClickOverlay: !0,
|
|
2015
|
+
closeOnPressEscape: !0,
|
|
2016
|
+
appendToBody: !0
|
|
2017
|
+
}, sn = {
|
|
2018
|
+
key: 0,
|
|
2019
|
+
class: "m-drawer__header"
|
|
2020
|
+
}, cn = {
|
|
2021
|
+
key: 0,
|
|
2022
|
+
class: "m-drawer__title"
|
|
2023
|
+
}, ln = { class: "m-drawer__body" }, un = {
|
|
2024
|
+
key: 1,
|
|
2025
|
+
class: "m-drawer__footer"
|
|
2026
|
+
}, dn = /* @__PURE__ */ d({
|
|
2027
|
+
__name: "Drawer",
|
|
2028
|
+
props: /*@__PURE__*/ p({
|
|
2029
|
+
modelValue: { type: Boolean },
|
|
2030
|
+
placement: {},
|
|
2031
|
+
size: {},
|
|
2032
|
+
title: {},
|
|
2033
|
+
showClose: { type: Boolean },
|
|
2034
|
+
closeOnClickOverlay: { type: Boolean },
|
|
2035
|
+
closeOnPressEscape: { type: Boolean },
|
|
2036
|
+
appendToBody: { type: Boolean }
|
|
2037
|
+
}, on),
|
|
2038
|
+
emits: [
|
|
2039
|
+
"update:modelValue",
|
|
2040
|
+
"open",
|
|
2041
|
+
"close"
|
|
2042
|
+
],
|
|
2043
|
+
setup(r, { emit: d }) {
|
|
2044
|
+
let f = r, p = d, m = x(!!f.modelValue), y = i(() => {
|
|
2045
|
+
let e = f.size;
|
|
2046
|
+
return (typeof e == "number" || typeof e == "string" && /^\d+(\.\d+)?$/.test(e)) && (e = `${e}px`), f.placement === "left" || f.placement === "right" ? `width: ${e};` : `height: ${e};`;
|
|
2047
|
+
});
|
|
2048
|
+
function b(e) {
|
|
2049
|
+
e.key === "Escape" && f.closeOnPressEscape && C();
|
|
2050
|
+
}
|
|
2051
|
+
function S() {
|
|
2052
|
+
f.closeOnClickOverlay && C();
|
|
2053
|
+
}
|
|
2054
|
+
function C() {
|
|
2055
|
+
p("update:modelValue", !1);
|
|
2056
|
+
}
|
|
2057
|
+
return O(() => f.modelValue, (e) => {
|
|
2058
|
+
m.value = !!e, e ? (p("open"), Ge(), document.addEventListener("keydown", b)) : (p("close"), Ke(), document.removeEventListener("keydown", b));
|
|
2059
|
+
}, { immediate: !0 }), _(() => {
|
|
2060
|
+
document.removeEventListener("keydown", b), Ke();
|
|
2061
|
+
}), (i, d) => (v(), s(e, null, [i.$slots.trigger ? (v(), s("span", {
|
|
2062
|
+
key: 0,
|
|
2063
|
+
class: "m-drawer__trigger",
|
|
2064
|
+
onClick: d[0] ||= (e) => p("update:modelValue", !0)
|
|
2065
|
+
}, [w(i.$slots, "trigger")])) : o("", !0), (v(), a(t, {
|
|
2066
|
+
to: "body",
|
|
2067
|
+
disabled: !r.appendToBody
|
|
2068
|
+
}, [u(n, { name: "m-drawer" }, {
|
|
2069
|
+
default: A(() => [m.value ? (v(), s("div", {
|
|
2070
|
+
key: 0,
|
|
2071
|
+
class: h(["m-drawer-overlay", `m-drawer-overlay--${r.placement}`]),
|
|
2072
|
+
role: "presentation"
|
|
2073
|
+
}, [c("div", {
|
|
2074
|
+
class: "m-drawer-overlay__backdrop",
|
|
2075
|
+
onClick: S
|
|
2076
|
+
}), c("div", {
|
|
2077
|
+
class: h(["m-drawer", `m-drawer--${r.placement}`]),
|
|
2078
|
+
role: "dialog",
|
|
2079
|
+
"aria-modal": "true",
|
|
2080
|
+
style: g(y.value)
|
|
2081
|
+
}, [
|
|
2082
|
+
r.showClose || r.title || i.$slots.title ? (v(), s("header", sn, [r.title || i.$slots.title ? (v(), s("h3", cn, [w(i.$slots, "title", {}, () => [l(T(r.title), 1)])])) : o("", !0), r.showClose ? (v(), s("button", {
|
|
2083
|
+
key: 1,
|
|
2084
|
+
type: "button",
|
|
2085
|
+
class: "m-drawer__close",
|
|
2086
|
+
"aria-label": "关闭抽屉",
|
|
2087
|
+
onClick: C
|
|
2088
|
+
}, [...d[1] ||= [c("svg", {
|
|
2089
|
+
viewBox: "0 0 24 24",
|
|
2090
|
+
width: "16",
|
|
2091
|
+
height: "16",
|
|
2092
|
+
fill: "none",
|
|
2093
|
+
stroke: "currentColor",
|
|
2094
|
+
"stroke-width": "2.2",
|
|
2095
|
+
"stroke-linecap": "round",
|
|
2096
|
+
"aria-hidden": "true"
|
|
2097
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])) : o("", !0)])) : o("", !0),
|
|
2098
|
+
c("div", ln, [w(i.$slots, "default")]),
|
|
2099
|
+
i.$slots.footer ? (v(), s("footer", un, [w(i.$slots, "footer")])) : o("", !0)
|
|
2100
|
+
], 6)], 2)) : o("", !0)]),
|
|
2101
|
+
_: 3
|
|
2102
|
+
})], 8, ["disabled"]))], 64));
|
|
2103
|
+
}
|
|
2104
|
+
}), fn = {
|
|
2105
|
+
placement: "bottom-start",
|
|
2106
|
+
trigger: "click",
|
|
2107
|
+
disabled: !1,
|
|
2108
|
+
offset: 4,
|
|
2109
|
+
appendToBody: !0
|
|
2110
|
+
}, pn = {
|
|
2111
|
+
disabled: !1,
|
|
2112
|
+
divider: !1
|
|
2113
|
+
}, mn = Symbol("m-dropdown-context"), hn = ["aria-expanded", "aria-disabled"], gn = 320, _n = 150, vn = /* @__PURE__ */ d({
|
|
2114
|
+
__name: "Dropdown",
|
|
2115
|
+
props: /*@__PURE__*/ p({
|
|
2116
|
+
placement: {},
|
|
2117
|
+
trigger: {},
|
|
2118
|
+
disabled: { type: Boolean },
|
|
2119
|
+
width: {},
|
|
2120
|
+
offset: {},
|
|
2121
|
+
appendToBody: { type: Boolean }
|
|
2122
|
+
}, fn),
|
|
2123
|
+
emits: [
|
|
2124
|
+
"open",
|
|
2125
|
+
"close",
|
|
2126
|
+
"command"
|
|
2127
|
+
],
|
|
2128
|
+
setup(e, { emit: r }) {
|
|
2129
|
+
let l = e, d = r, f = x(null), p = x(null), b = x(null), S = x(null), C = x(!1), T = x(!1), E = x(null), D = x(-1), k = i(() => [
|
|
2130
|
+
"m-dropdown",
|
|
2131
|
+
C.value && "is-open",
|
|
2132
|
+
T.value && "is-focused",
|
|
2133
|
+
l.disabled && "is-disabled"
|
|
2134
|
+
]);
|
|
2135
|
+
function j(e) {
|
|
2136
|
+
return e.startsWith("top") ? "top" : "bottom";
|
|
2137
|
+
}
|
|
2138
|
+
function M(e) {
|
|
2139
|
+
return e.split("-")[1] ?? "start";
|
|
2140
|
+
}
|
|
2141
|
+
function N(e, t) {
|
|
2142
|
+
let n = M(l.placement), r = window.innerWidth, i;
|
|
2143
|
+
return i = n === "start" ? e.left : n === "center" ? e.left + e.width / 2 - t / 2 : e.left + e.width - t, Math.min(Math.max(0, i), Math.max(0, r - t));
|
|
2144
|
+
}
|
|
2145
|
+
function P() {
|
|
2146
|
+
let e = b.value, t = S.value;
|
|
2147
|
+
if (!e || !t) return;
|
|
2148
|
+
let n = f.value.getBoundingClientRect(), r = E.value?.width ?? n.width, i = Math.min(e.getBoundingClientRect().width, window.innerWidth - 8), a = t.scrollHeight, o = window.innerHeight, s = l.offset, c = N(n, i), u = Math.max(0, n.top - s), d = Math.max(0, o - n.bottom - s - 4), p = Math.min(a, gn), m = j(l.placement) === "top", h = m ? u : d, g = m ? d : u, _;
|
|
2149
|
+
_ = h >= p ? m : g >= p || g > h ? !m : m;
|
|
2150
|
+
let v, y;
|
|
2151
|
+
if (_) y = Math.max(1, Math.min(a, gn, u)), v = Math.max(0, n.top - s - y);
|
|
2152
|
+
else {
|
|
2153
|
+
y = Math.max(1, Math.min(a, gn, d));
|
|
2154
|
+
let e = n.bottom + s;
|
|
2155
|
+
v = Math.min(e, Math.max(0, o - y - 4));
|
|
2156
|
+
}
|
|
2157
|
+
E.value = {
|
|
2158
|
+
top: v,
|
|
2159
|
+
left: c,
|
|
2160
|
+
width: r,
|
|
2161
|
+
maxHeight: y,
|
|
2162
|
+
side: _ ? "top" : "bottom"
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
function F() {
|
|
2166
|
+
if (l.disabled || C.value) return;
|
|
2167
|
+
let e = f.value.getBoundingClientRect(), t = j(l.placement);
|
|
2168
|
+
E.value = {
|
|
2169
|
+
top: t === "top" ? Math.max(0, e.top - l.offset - gn) : e.bottom + l.offset,
|
|
2170
|
+
left: N(e, e.width),
|
|
2171
|
+
width: e.width,
|
|
2172
|
+
maxHeight: Math.max(1, t === "top" ? Math.max(0, e.top - l.offset) : Math.max(0, window.innerHeight - e.bottom - l.offset)),
|
|
2173
|
+
side: t
|
|
2174
|
+
}, C.value = !0, D.value = -1, d("open"), m(() => {
|
|
2175
|
+
P(), b.value?.focus({ preventScroll: !0 });
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2178
|
+
function I(e = !1) {
|
|
2179
|
+
C.value && (C.value = !1, D.value = -1, d("close"), e && p.value?.focus({ preventScroll: !0 }));
|
|
2180
|
+
}
|
|
2181
|
+
function L() {
|
|
2182
|
+
C.value ? I(!0) : F();
|
|
2183
|
+
}
|
|
2184
|
+
function ee() {
|
|
2185
|
+
l.disabled || l.trigger !== "click" || L();
|
|
2186
|
+
}
|
|
2187
|
+
function R() {
|
|
2188
|
+
T.value = !0, l.trigger === "hover" && !l.disabled && !C.value && F();
|
|
2189
|
+
}
|
|
2190
|
+
function z() {
|
|
2191
|
+
T.value = !1, l.trigger === "hover" && te();
|
|
2192
|
+
}
|
|
2193
|
+
let B = null;
|
|
2194
|
+
function V() {
|
|
2195
|
+
B !== null && (window.clearTimeout(B), B = null);
|
|
2196
|
+
}
|
|
2197
|
+
function te() {
|
|
2198
|
+
V(), B = window.setTimeout(() => I(!1), _n);
|
|
2199
|
+
}
|
|
2200
|
+
function H() {
|
|
2201
|
+
l.trigger !== "hover" || l.disabled || (V(), C.value || F());
|
|
2202
|
+
}
|
|
2203
|
+
function U() {
|
|
2204
|
+
l.trigger === "hover" && te();
|
|
2205
|
+
}
|
|
2206
|
+
function W() {
|
|
2207
|
+
let e = S.value;
|
|
2208
|
+
return e ? Array.from(e.querySelectorAll(".m-dropdown__item:not(.is-disabled)")) : [];
|
|
2209
|
+
}
|
|
2210
|
+
function ne() {
|
|
2211
|
+
S.value?.querySelector(".m-dropdown__item.is-active")?.classList.remove("is-active");
|
|
2212
|
+
}
|
|
2213
|
+
function G(e) {
|
|
2214
|
+
let t = S.value;
|
|
2215
|
+
if (!t) return;
|
|
2216
|
+
let n = e.offsetTop, r = n + e.offsetHeight, i = t.scrollTop, a = i + t.clientHeight;
|
|
2217
|
+
n < i ? t.scrollTop = n : r > a && (t.scrollTop = r - t.clientHeight);
|
|
2218
|
+
}
|
|
2219
|
+
function K(e) {
|
|
2220
|
+
let t = W();
|
|
2221
|
+
if (t.length === 0) return;
|
|
2222
|
+
let n = (e % t.length + t.length) % t.length;
|
|
2223
|
+
ne();
|
|
2224
|
+
let r = t[n];
|
|
2225
|
+
r.classList.add("is-active"), D.value = n, G(r);
|
|
2226
|
+
}
|
|
2227
|
+
function q(e) {
|
|
2228
|
+
let t = W();
|
|
2229
|
+
t.length !== 0 && K(D.value < 0 ? e > 0 ? 0 : t.length - 1 : (D.value + e + t.length) % t.length);
|
|
2230
|
+
}
|
|
2231
|
+
function J(e) {
|
|
2232
|
+
let t = e.target.closest(".m-dropdown__item");
|
|
2233
|
+
if (!t || t.classList.contains("is-disabled")) return;
|
|
2234
|
+
let n = W().indexOf(t);
|
|
2235
|
+
n !== D.value && (ne(), t.classList.add("is-active"), D.value = n);
|
|
2236
|
+
}
|
|
2237
|
+
function re(e) {
|
|
2238
|
+
if (!l.disabled && !C.value) {
|
|
2239
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), F());
|
|
2240
|
+
return;
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
function ie(e) {
|
|
2244
|
+
let t = W();
|
|
2245
|
+
switch (e.key) {
|
|
2246
|
+
case "ArrowDown":
|
|
2247
|
+
e.preventDefault(), q(1);
|
|
2248
|
+
break;
|
|
2249
|
+
case "ArrowUp":
|
|
2250
|
+
e.preventDefault(), q(-1);
|
|
2251
|
+
break;
|
|
2252
|
+
case "Home":
|
|
2253
|
+
e.preventDefault(), K(0);
|
|
2254
|
+
break;
|
|
2255
|
+
case "End":
|
|
2256
|
+
e.preventDefault(), K(t.length - 1);
|
|
2257
|
+
break;
|
|
2258
|
+
case "Enter":
|
|
2259
|
+
case " ":
|
|
2260
|
+
e.preventDefault(), t[D.value]?.click();
|
|
2261
|
+
break;
|
|
2262
|
+
case "Escape":
|
|
2263
|
+
e.preventDefault(), I(!0);
|
|
2264
|
+
break;
|
|
2265
|
+
case "Tab": I(!1);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
function Y(e) {
|
|
2269
|
+
let t = e.target;
|
|
2270
|
+
!f.value?.contains(t) && !b.value?.contains(t) && I(!1);
|
|
2271
|
+
}
|
|
2272
|
+
let X = null;
|
|
2273
|
+
function ae() {
|
|
2274
|
+
X !== null && (cancelAnimationFrame(X), X = null);
|
|
2275
|
+
}
|
|
2276
|
+
function Z(e) {
|
|
2277
|
+
let t = e.target;
|
|
2278
|
+
t instanceof Node && b.value?.contains(t) || X === null && (X = requestAnimationFrame(() => {
|
|
2279
|
+
if (X = null, !C.value) return;
|
|
2280
|
+
let e = f.value?.getBoundingClientRect();
|
|
2281
|
+
e && (e.bottom > 0 && e.top < window.innerHeight && e.right > 0 && e.left < window.innerWidth ? P() : I(!1));
|
|
2282
|
+
}));
|
|
2283
|
+
}
|
|
2284
|
+
y(mn, {
|
|
2285
|
+
onItemClick: (e) => d("command", e),
|
|
2286
|
+
close: () => I(!1)
|
|
2287
|
+
});
|
|
2288
|
+
function oe(e, t) {
|
|
2289
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim(), r = parseFloat(n);
|
|
2290
|
+
return Number.isFinite(r) ? r : t;
|
|
2291
|
+
}
|
|
2292
|
+
function se(e, t, n, r) {
|
|
2293
|
+
let i = e.getBoundingClientRect();
|
|
2294
|
+
if (t) {
|
|
2295
|
+
let e = t.getBoundingClientRect(), a = n === "top" ? e.top - i.top : e.top + e.height - i.top, o = M(r), s;
|
|
2296
|
+
return s = o === "start" ? e.left - i.left : o === "center" ? e.left + e.width / 2 - i.left : e.left + e.width - i.left, `${s}px ${a}px`;
|
|
2297
|
+
}
|
|
2298
|
+
return "center";
|
|
2299
|
+
}
|
|
2300
|
+
function ce(e, t) {
|
|
2301
|
+
for (let t of e) t && (t.style.transition = "", t.style.opacity = "", t.style.transform = "", t.style.transformOrigin = "");
|
|
2302
|
+
t();
|
|
2303
|
+
}
|
|
2304
|
+
let le = 0;
|
|
2305
|
+
function ue(e, t, n) {
|
|
2306
|
+
let r = e[0];
|
|
2307
|
+
if (!r) return;
|
|
2308
|
+
let i = ++le, a = !1, o = e.filter((e) => !!e && e !== r), s = /* @__PURE__ */ new Set(), c = () => {
|
|
2309
|
+
a || (a = !0, window.clearTimeout(u), r.removeEventListener("transitionend", l), i === le ? ce(e, n) : n());
|
|
2310
|
+
}, l = (e) => {
|
|
2311
|
+
let t = e.target;
|
|
2312
|
+
!t || !o.includes(t) || (s.add(t), s.size >= o.length && c());
|
|
2313
|
+
}, u = window.setTimeout(c, t + 80);
|
|
2314
|
+
o.length > 0 ? r.addEventListener("transitionend", l) : c();
|
|
2315
|
+
}
|
|
2316
|
+
function de(e, t) {
|
|
2317
|
+
let n = e, r = n.querySelector(".m-dropdown__panel-surface"), i = n.querySelector(".m-dropdown__panel-content"), a = oe("--m-dur-entering", 225), o = "var(--m-ease-in-out, ease)";
|
|
2318
|
+
P(), m(() => {
|
|
2319
|
+
let e = E.value?.side ?? j(l.placement);
|
|
2320
|
+
r && (r.style.transformOrigin = se(r, p.value, e, l.placement), r.style.transform = "scale(1, 0)"), i && (i.style.opacity = "0"), n.offsetWidth, requestAnimationFrame(() => {
|
|
2321
|
+
let e = Math.round(a * 1.4), s = e;
|
|
2322
|
+
if (r && (r.style.transition = `transform ${e}ms ${o}`, r.style.transform = ""), i) {
|
|
2323
|
+
let t = Math.round(a * .7), n = Math.round(e * .85);
|
|
2324
|
+
i.style.transition = `opacity ${t}ms ${o} ${n}ms`, i.style.opacity = "1", s = Math.max(s, n + t);
|
|
2325
|
+
}
|
|
2326
|
+
ue([
|
|
2327
|
+
n,
|
|
2328
|
+
r,
|
|
2329
|
+
i
|
|
2330
|
+
], s, t);
|
|
2331
|
+
});
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
function fe(e, t) {
|
|
2335
|
+
let n = e, r = n.querySelector(".m-dropdown__panel-surface"), i = n.querySelector(".m-dropdown__panel-content"), a = oe("--m-dur-leaving", 195), o = "var(--m-ease-in-out, ease)", s = Math.round(a * 1), c = s;
|
|
2336
|
+
if (r) {
|
|
2337
|
+
let e = E.value?.side ?? j(l.placement);
|
|
2338
|
+
r.style.transformOrigin = se(r, p.value, e, l.placement), r.style.transition = `opacity ${s}ms ${o}, transform ${s}ms ${o}`, r.style.transform = "scale(0.96)", r.style.opacity = "0";
|
|
2339
|
+
}
|
|
2340
|
+
if (i) {
|
|
2341
|
+
let e = Math.round(a * .6);
|
|
2342
|
+
i.style.transition = `opacity ${e}ms ${o}`, i.style.opacity = "0", c = Math.max(c, e);
|
|
2343
|
+
}
|
|
2344
|
+
ue([
|
|
2345
|
+
n,
|
|
2346
|
+
r,
|
|
2347
|
+
i
|
|
2348
|
+
], c, t);
|
|
2349
|
+
}
|
|
2350
|
+
return O(C, (e) => {
|
|
2351
|
+
e ? (Ge(), document.addEventListener("pointerdown", Y, !0), window.addEventListener("scroll", Z, !0), window.addEventListener("resize", Z)) : (Ke(), ae(), V(), document.removeEventListener("pointerdown", Y, !0), window.removeEventListener("scroll", Z, !0), window.removeEventListener("resize", Z));
|
|
2352
|
+
}), _(() => {
|
|
2353
|
+
Ke(), ae(), V(), document.removeEventListener("pointerdown", Y, !0), window.removeEventListener("scroll", Z, !0), window.removeEventListener("resize", Z);
|
|
2354
|
+
}), (r, i) => (v(), s("span", {
|
|
2355
|
+
ref_key: "rootRef",
|
|
2356
|
+
ref: f,
|
|
2357
|
+
class: h(k.value),
|
|
2358
|
+
onMouseenter: H,
|
|
2359
|
+
onMouseleave: U
|
|
2360
|
+
}, [c("span", {
|
|
2361
|
+
ref_key: "triggerRef",
|
|
2362
|
+
ref: p,
|
|
2363
|
+
class: "m-dropdown__trigger",
|
|
2364
|
+
role: "button",
|
|
2365
|
+
"aria-haspopup": "menu",
|
|
2366
|
+
"aria-expanded": C.value,
|
|
2367
|
+
"aria-disabled": e.disabled || void 0,
|
|
2368
|
+
tabindex: "0",
|
|
2369
|
+
onClick: ee,
|
|
2370
|
+
onFocus: R,
|
|
2371
|
+
onBlur: z,
|
|
2372
|
+
onKeydown: re
|
|
2373
|
+
}, [w(r.$slots, "trigger", {}, () => [w(r.$slots, "default")])], 40, hn), (v(), a(t, {
|
|
2374
|
+
to: "body",
|
|
2375
|
+
disabled: !e.appendToBody
|
|
2376
|
+
}, [u(n, {
|
|
2377
|
+
css: !1,
|
|
2378
|
+
onEnter: de,
|
|
2379
|
+
onLeave: fe
|
|
2380
|
+
}, {
|
|
2381
|
+
default: A(() => [C.value ? (v(), s("div", {
|
|
2382
|
+
key: 0,
|
|
2383
|
+
ref_key: "panelRef",
|
|
2384
|
+
ref: b,
|
|
2385
|
+
class: "m-dropdown__panel",
|
|
2386
|
+
role: "menu",
|
|
2387
|
+
tabindex: "-1",
|
|
2388
|
+
style: g(E.value ? {
|
|
2389
|
+
top: E.value.top + "px",
|
|
2390
|
+
left: E.value.left + "px",
|
|
2391
|
+
width: e.width || "max-content",
|
|
2392
|
+
minWidth: e.width ? void 0 : E.value.width + "px",
|
|
2393
|
+
maxWidth: "calc(100vw - 8px)"
|
|
2394
|
+
} : void 0),
|
|
2395
|
+
onKeydown: ie,
|
|
2396
|
+
onMouseenter: H,
|
|
2397
|
+
onMouseleave: U
|
|
2398
|
+
}, [i[0] ||= c("div", {
|
|
2399
|
+
class: "m-dropdown__panel-surface",
|
|
2400
|
+
"aria-hidden": "true"
|
|
2401
|
+
}, null, -1), c("div", {
|
|
2402
|
+
ref_key: "contentRef",
|
|
2403
|
+
ref: S,
|
|
2404
|
+
class: "m-dropdown__panel-content",
|
|
2405
|
+
style: g(E.value ? { maxHeight: E.value.maxHeight + "px" } : void 0),
|
|
2406
|
+
onMouseover: J
|
|
2407
|
+
}, [w(r.$slots, "menu")], 36)], 36)) : o("", !0)]),
|
|
2408
|
+
_: 3
|
|
2409
|
+
})], 8, ["disabled"]))], 34));
|
|
2410
|
+
}
|
|
2411
|
+
}), yn = {
|
|
2412
|
+
key: 0,
|
|
2413
|
+
class: "m-dropdown__divider",
|
|
2414
|
+
role: "separator",
|
|
2415
|
+
"aria-orientation": "horizontal"
|
|
2416
|
+
}, bn = ["aria-disabled"], xn = { class: "m-dropdown__item-content" }, Sn = /* @__PURE__ */ d({
|
|
2417
|
+
__name: "DropdownItem",
|
|
2418
|
+
props: /*@__PURE__*/ p({
|
|
2419
|
+
command: {},
|
|
2420
|
+
disabled: { type: Boolean },
|
|
2421
|
+
divider: { type: Boolean }
|
|
2422
|
+
}, pn),
|
|
2423
|
+
emits: ["command"],
|
|
2424
|
+
setup(e, { emit: t }) {
|
|
2425
|
+
let n = e, r = t, i = f(mn, null);
|
|
2426
|
+
function a() {
|
|
2427
|
+
n.disabled || (r("command", n.command), i?.onItemClick(n.command), i?.close());
|
|
2428
|
+
}
|
|
2429
|
+
return (t, n) => e.divider ? (v(), s("div", yn)) : j((v(), s("div", {
|
|
2430
|
+
key: 1,
|
|
2431
|
+
class: h(["m-dropdown__item", { "is-disabled": e.disabled }]),
|
|
2432
|
+
role: "menuitem",
|
|
2433
|
+
"aria-disabled": e.disabled || void 0,
|
|
2434
|
+
tabindex: "-1",
|
|
2435
|
+
onClick: a
|
|
2436
|
+
}, [c("span", xn, [w(t.$slots, "default")])], 10, bn)), [[E(Q), {
|
|
2437
|
+
duration: 200,
|
|
2438
|
+
initialScale: .7
|
|
2439
|
+
}]]);
|
|
2440
|
+
}
|
|
2441
|
+
}), Cn = {
|
|
2442
|
+
color: "primary",
|
|
2443
|
+
size: "medium",
|
|
2444
|
+
position: "",
|
|
2445
|
+
extended: !1,
|
|
2446
|
+
disabled: !1
|
|
2447
|
+
}, wn = ["aria-label", "disabled"], Tn = {
|
|
2448
|
+
class: "m-fab__icon",
|
|
2449
|
+
"aria-hidden": "true"
|
|
2450
|
+
}, En = {
|
|
2451
|
+
key: 0,
|
|
2452
|
+
class: "m-fab__label"
|
|
2453
|
+
}, Dn = /* @__PURE__ */ d({
|
|
2454
|
+
__name: "Fab",
|
|
2455
|
+
props: /*@__PURE__*/ p({
|
|
2456
|
+
color: {},
|
|
2457
|
+
size: {},
|
|
2458
|
+
position: {},
|
|
2459
|
+
extended: { type: Boolean },
|
|
2460
|
+
disabled: { type: Boolean },
|
|
2461
|
+
ariaLabel: {}
|
|
2462
|
+
}, Cn),
|
|
2463
|
+
emits: ["click"],
|
|
2464
|
+
setup(e, { emit: t }) {
|
|
2465
|
+
let n = e, r = t, a = i(() => [
|
|
2466
|
+
"m-fab",
|
|
2467
|
+
`m-fab--${n.size}`,
|
|
2468
|
+
`m-fab--${n.color}`,
|
|
2469
|
+
n.extended && "m-fab--extended",
|
|
2470
|
+
n.position && `m-fab--pos-${n.position}`,
|
|
2471
|
+
n.disabled && "is-disabled"
|
|
2472
|
+
]);
|
|
2473
|
+
function l(e) {
|
|
2474
|
+
n.disabled || r("click", e);
|
|
2475
|
+
}
|
|
2476
|
+
return (t, n) => j((v(), s("button", {
|
|
2477
|
+
type: "button",
|
|
2478
|
+
class: h(a.value),
|
|
2479
|
+
"aria-label": e.ariaLabel,
|
|
2480
|
+
disabled: e.disabled,
|
|
2481
|
+
onClick: l
|
|
2482
|
+
}, [c("span", Tn, [w(t.$slots, "icon", {}, () => [n[0] ||= c("svg", {
|
|
2483
|
+
viewBox: "0 0 24 24",
|
|
2484
|
+
width: "24",
|
|
2485
|
+
height: "24",
|
|
2486
|
+
fill: "none",
|
|
2487
|
+
stroke: "currentColor",
|
|
2488
|
+
"stroke-width": "2.4",
|
|
2489
|
+
"stroke-linecap": "round",
|
|
2490
|
+
"aria-hidden": "true"
|
|
2491
|
+
}, [c("path", { d: "M12 5v14M5 12h14" })], -1)])]), e.extended || t.$slots.default ? (v(), s("span", En, [w(t.$slots, "default")])) : o("", !0)], 10, wn)), [[E(Q)]]);
|
|
2492
|
+
}
|
|
2493
|
+
}), On = {
|
|
2494
|
+
type: "text",
|
|
2495
|
+
disabled: !1,
|
|
2496
|
+
readonly: !1,
|
|
2497
|
+
clearable: !1,
|
|
2498
|
+
size: "default"
|
|
2499
|
+
}, kn = {
|
|
2500
|
+
key: 0,
|
|
2501
|
+
class: "m-input__affix m-input__affix--prefix"
|
|
2502
|
+
}, An = [
|
|
2503
|
+
"type",
|
|
2504
|
+
"value",
|
|
2505
|
+
"placeholder",
|
|
2506
|
+
"disabled",
|
|
2507
|
+
"readonly",
|
|
2508
|
+
"maxlength",
|
|
2509
|
+
"name",
|
|
2510
|
+
"autofocus"
|
|
2511
|
+
], jn = {
|
|
2512
|
+
key: 2,
|
|
2513
|
+
class: "m-input__affix m-input__affix--suffix"
|
|
2514
|
+
}, Mn = /* @__PURE__ */ d({
|
|
2515
|
+
__name: "Input",
|
|
2516
|
+
props: /*@__PURE__*/ p({
|
|
2517
|
+
modelValue: {},
|
|
2518
|
+
type: {},
|
|
2519
|
+
placeholder: {},
|
|
2520
|
+
disabled: { type: Boolean },
|
|
2521
|
+
readonly: { type: Boolean },
|
|
2522
|
+
clearable: { type: Boolean },
|
|
2523
|
+
size: {},
|
|
2524
|
+
maxlength: {},
|
|
2525
|
+
name: {},
|
|
2526
|
+
autofocus: { type: Boolean },
|
|
2527
|
+
width: {}
|
|
2528
|
+
}, On),
|
|
2529
|
+
emits: [
|
|
2530
|
+
"update:modelValue",
|
|
2531
|
+
"focus",
|
|
2532
|
+
"blur",
|
|
2533
|
+
"change",
|
|
2534
|
+
"clear"
|
|
2535
|
+
],
|
|
2536
|
+
setup(e, { emit: t }) {
|
|
2537
|
+
let n = e, r = t, a = x(null), l = x(!1), u = i(() => String(n.modelValue ?? "")), d = i(() => [
|
|
2538
|
+
"m-input",
|
|
2539
|
+
`m-input--${n.size}`,
|
|
2540
|
+
l.value && "is-focused",
|
|
2541
|
+
n.disabled && "is-disabled",
|
|
2542
|
+
n.readonly && "is-readonly"
|
|
2543
|
+
]), f = i(() => n.clearable && !n.disabled && !n.readonly && u.value.length > 0);
|
|
2544
|
+
function p(e) {
|
|
2545
|
+
r("update:modelValue", e.target.value);
|
|
2546
|
+
}
|
|
2547
|
+
function m(e) {
|
|
2548
|
+
l.value = !0, r("focus", e);
|
|
2549
|
+
}
|
|
2550
|
+
function _(e) {
|
|
2551
|
+
l.value = !1, r("blur", e), r("change", u.value);
|
|
2552
|
+
}
|
|
2553
|
+
function y() {
|
|
2554
|
+
r("update:modelValue", ""), r("clear"), a.value?.focus();
|
|
2555
|
+
}
|
|
2556
|
+
return (t, n) => (v(), s("div", {
|
|
2557
|
+
class: h(d.value),
|
|
2558
|
+
style: g(e.width ? { width: e.width } : void 0)
|
|
2559
|
+
}, [
|
|
2560
|
+
t.$slots.prefix ? (v(), s("span", kn, [w(t.$slots, "prefix")])) : o("", !0),
|
|
2561
|
+
c("input", {
|
|
2562
|
+
ref_key: "controlRef",
|
|
2563
|
+
ref: a,
|
|
2564
|
+
class: "m-input__control",
|
|
2565
|
+
type: e.type,
|
|
2566
|
+
value: u.value,
|
|
2567
|
+
placeholder: e.placeholder,
|
|
2568
|
+
disabled: e.disabled,
|
|
2569
|
+
readonly: e.readonly,
|
|
2570
|
+
maxlength: e.maxlength,
|
|
2571
|
+
name: e.name,
|
|
2572
|
+
autofocus: e.autofocus,
|
|
2573
|
+
onInput: p,
|
|
2574
|
+
onFocus: m,
|
|
2575
|
+
onBlur: _
|
|
2576
|
+
}, null, 40, An),
|
|
2577
|
+
f.value ? (v(), s("button", {
|
|
2578
|
+
key: 1,
|
|
2579
|
+
type: "button",
|
|
2580
|
+
class: "m-input__clear",
|
|
2581
|
+
tabindex: "-1",
|
|
2582
|
+
"aria-label": "清除内容",
|
|
2583
|
+
onMousedown: n[0] ||= M(() => {}, ["prevent"]),
|
|
2584
|
+
onClick: y
|
|
2585
|
+
}, [...n[1] ||= [c("svg", {
|
|
2586
|
+
viewBox: "0 0 24 24",
|
|
2587
|
+
width: "12",
|
|
2588
|
+
height: "12",
|
|
2589
|
+
fill: "none",
|
|
2590
|
+
stroke: "currentColor",
|
|
2591
|
+
"stroke-width": "2.4",
|
|
2592
|
+
"stroke-linecap": "round",
|
|
2593
|
+
"aria-hidden": "true"
|
|
2594
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 32)) : o("", !0),
|
|
2595
|
+
t.$slots.suffix ? (v(), s("span", jn, [w(t.$slots, "suffix")])) : o("", !0)
|
|
2596
|
+
], 6));
|
|
2597
|
+
}
|
|
2598
|
+
}), Nn = {
|
|
2599
|
+
disabled: !1,
|
|
2600
|
+
readonly: !1,
|
|
2601
|
+
clearable: !1,
|
|
2602
|
+
size: "default",
|
|
2603
|
+
controls: "right",
|
|
2604
|
+
step: 1
|
|
2605
|
+
}, Pn = ["disabled"], Fn = [
|
|
2606
|
+
"value",
|
|
2607
|
+
"placeholder",
|
|
2608
|
+
"disabled",
|
|
2609
|
+
"readonly"
|
|
2610
|
+
], In = ["disabled"], Ln = {
|
|
2611
|
+
key: 3,
|
|
2612
|
+
class: "m-input-number__stepper"
|
|
2613
|
+
}, Rn = ["disabled"], zn = ["disabled"], Bn = /* @__PURE__ */ d({
|
|
2614
|
+
__name: "InputNumber",
|
|
2615
|
+
props: /*@__PURE__*/ p({
|
|
2616
|
+
modelValue: {},
|
|
2617
|
+
placeholder: {},
|
|
2618
|
+
disabled: { type: Boolean },
|
|
2619
|
+
readonly: { type: Boolean },
|
|
2620
|
+
clearable: { type: Boolean },
|
|
2621
|
+
size: {},
|
|
2622
|
+
controls: {},
|
|
2623
|
+
min: {},
|
|
2624
|
+
max: {},
|
|
2625
|
+
step: {},
|
|
2626
|
+
precision: {},
|
|
2627
|
+
width: {}
|
|
2628
|
+
}, Nn),
|
|
2629
|
+
emits: [
|
|
2630
|
+
"update:modelValue",
|
|
2631
|
+
"focus",
|
|
2632
|
+
"blur",
|
|
2633
|
+
"change",
|
|
2634
|
+
"clear"
|
|
2635
|
+
],
|
|
2636
|
+
setup(e, { emit: t }) {
|
|
2637
|
+
let n = e, r = t, a = x(null), l = x(!1), u = x("");
|
|
2638
|
+
O(() => n.modelValue, (e) => {
|
|
2639
|
+
l.value || (u.value = e == null ? "" : String(e));
|
|
2640
|
+
}, { immediate: !0 });
|
|
2641
|
+
let d = i(() => n.min ?? -Infinity), f = i(() => n.max ?? Infinity), p = i(() => !n.disabled && !n.readonly), m = i(() => p.value && (n.modelValue ?? 0) > d.value), _ = i(() => p.value && (n.modelValue ?? 0) < f.value), y = i(() => [
|
|
2642
|
+
"m-input-number",
|
|
2643
|
+
`m-input-number--${n.size}`,
|
|
2644
|
+
n.controls === "right" ? "m-input-number--controls-right" : "m-input-number--controls-both",
|
|
2645
|
+
l.value && "is-focused",
|
|
2646
|
+
n.disabled && "is-disabled",
|
|
2647
|
+
n.readonly && "is-readonly"
|
|
2648
|
+
]);
|
|
2649
|
+
function b(e) {
|
|
2650
|
+
if (e.trim() === "") return null;
|
|
2651
|
+
let t = Number(e);
|
|
2652
|
+
return Number.isNaN(t) ? null : t;
|
|
2653
|
+
}
|
|
2654
|
+
function S(e) {
|
|
2655
|
+
return e < d.value ? d.value : e > f.value ? f.value : e;
|
|
2656
|
+
}
|
|
2657
|
+
function C(e) {
|
|
2658
|
+
if (e === null) return null;
|
|
2659
|
+
let t = S(e);
|
|
2660
|
+
return n.precision == null ? t : Number(t.toFixed(n.precision));
|
|
2661
|
+
}
|
|
2662
|
+
function w(e) {
|
|
2663
|
+
let t = C(e);
|
|
2664
|
+
t !== n.modelValue && (r("update:modelValue", t), r("change", t)), u.value = t == null ? "" : String(t);
|
|
2665
|
+
}
|
|
2666
|
+
function T(e) {
|
|
2667
|
+
p.value && w((n.modelValue ?? 0) + n.step * e);
|
|
2668
|
+
}
|
|
2669
|
+
function E(e) {
|
|
2670
|
+
u.value = e.target.value;
|
|
2671
|
+
}
|
|
2672
|
+
function D(e) {
|
|
2673
|
+
l.value = !0, r("focus", e);
|
|
2674
|
+
}
|
|
2675
|
+
function k(e) {
|
|
2676
|
+
l.value = !1, r("blur", e), w(b(u.value));
|
|
2677
|
+
}
|
|
2678
|
+
function A(e) {
|
|
2679
|
+
p.value && (e.key === "ArrowUp" ? (e.preventDefault(), T(1)) : e.key === "ArrowDown" && (e.preventDefault(), T(-1)));
|
|
2680
|
+
}
|
|
2681
|
+
function j() {
|
|
2682
|
+
w(null), r("clear"), a.value?.focus();
|
|
2683
|
+
}
|
|
2684
|
+
return (t, n) => (v(), s("div", {
|
|
2685
|
+
class: h(y.value),
|
|
2686
|
+
style: g(e.width ? { width: e.width } : void 0)
|
|
2687
|
+
}, [
|
|
2688
|
+
e.controls === "both" ? (v(), s("button", {
|
|
2689
|
+
key: 0,
|
|
2690
|
+
type: "button",
|
|
2691
|
+
class: "m-input-number__btn m-input-number__btn--dec",
|
|
2692
|
+
tabindex: "-1",
|
|
2693
|
+
"aria-label": "减少",
|
|
2694
|
+
disabled: !m.value,
|
|
2695
|
+
onClick: n[0] ||= (e) => T(-1)
|
|
2696
|
+
}, [...n[5] ||= [c("svg", {
|
|
2697
|
+
viewBox: "0 0 24 24",
|
|
2698
|
+
width: "1em",
|
|
2699
|
+
height: "1em",
|
|
2700
|
+
fill: "none",
|
|
2701
|
+
stroke: "currentColor",
|
|
2702
|
+
"stroke-width": "2.2",
|
|
2703
|
+
"stroke-linecap": "round",
|
|
2704
|
+
"aria-hidden": "true"
|
|
2705
|
+
}, [c("path", { d: "M6 12h12" })], -1)]], 8, Pn)) : o("", !0),
|
|
2706
|
+
c("input", {
|
|
2707
|
+
ref_key: "controlRef",
|
|
2708
|
+
ref: a,
|
|
2709
|
+
class: "m-input-number__control",
|
|
2710
|
+
type: "text",
|
|
2711
|
+
inputmode: "decimal",
|
|
2712
|
+
value: u.value,
|
|
2713
|
+
placeholder: e.placeholder,
|
|
2714
|
+
disabled: e.disabled,
|
|
2715
|
+
readonly: e.readonly,
|
|
2716
|
+
onInput: E,
|
|
2717
|
+
onFocus: D,
|
|
2718
|
+
onBlur: k,
|
|
2719
|
+
onKeydown: A
|
|
2720
|
+
}, null, 40, Fn),
|
|
2721
|
+
e.clearable && p.value && u.value !== "" ? (v(), s("button", {
|
|
2722
|
+
key: 1,
|
|
2723
|
+
type: "button",
|
|
2724
|
+
class: "m-input-number__clear",
|
|
2725
|
+
tabindex: "-1",
|
|
2726
|
+
"aria-label": "清除内容",
|
|
2727
|
+
onMousedown: n[1] ||= M(() => {}, ["prevent"]),
|
|
2728
|
+
onClick: j
|
|
2729
|
+
}, [...n[6] ||= [c("svg", {
|
|
2730
|
+
viewBox: "0 0 24 24",
|
|
2731
|
+
width: "12",
|
|
2732
|
+
height: "12",
|
|
2733
|
+
fill: "none",
|
|
2734
|
+
stroke: "currentColor",
|
|
2735
|
+
"stroke-width": "2.4",
|
|
2736
|
+
"stroke-linecap": "round",
|
|
2737
|
+
"aria-hidden": "true"
|
|
2738
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 32)) : o("", !0),
|
|
2739
|
+
e.controls === "both" ? (v(), s("button", {
|
|
2740
|
+
key: 2,
|
|
2741
|
+
type: "button",
|
|
2742
|
+
class: "m-input-number__btn m-input-number__btn--inc",
|
|
2743
|
+
tabindex: "-1",
|
|
2744
|
+
"aria-label": "增加",
|
|
2745
|
+
disabled: !_.value,
|
|
2746
|
+
onClick: n[2] ||= (e) => T(1)
|
|
2747
|
+
}, [...n[7] ||= [c("svg", {
|
|
2748
|
+
viewBox: "0 0 24 24",
|
|
2749
|
+
width: "1em",
|
|
2750
|
+
height: "1em",
|
|
2751
|
+
fill: "none",
|
|
2752
|
+
stroke: "currentColor",
|
|
2753
|
+
"stroke-width": "2.2",
|
|
2754
|
+
"stroke-linecap": "round",
|
|
2755
|
+
"aria-hidden": "true"
|
|
2756
|
+
}, [c("path", { d: "M12 6v12M6 12h12" })], -1)]], 8, In)) : (v(), s("span", Ln, [c("button", {
|
|
2757
|
+
type: "button",
|
|
2758
|
+
class: "m-input-number__btn m-input-number__btn--dec",
|
|
2759
|
+
tabindex: "-1",
|
|
2760
|
+
"aria-label": "减少",
|
|
2761
|
+
disabled: !m.value,
|
|
2762
|
+
onClick: n[3] ||= (e) => T(-1)
|
|
2763
|
+
}, [...n[8] ||= [c("svg", {
|
|
2764
|
+
viewBox: "0 0 24 24",
|
|
2765
|
+
width: "1em",
|
|
2766
|
+
height: "1em",
|
|
2767
|
+
fill: "none",
|
|
2768
|
+
stroke: "currentColor",
|
|
2769
|
+
"stroke-width": "2.2",
|
|
2770
|
+
"stroke-linecap": "round",
|
|
2771
|
+
"aria-hidden": "true"
|
|
2772
|
+
}, [c("path", { d: "M6 9l6 6 6-6" })], -1)]], 8, Rn), c("button", {
|
|
2773
|
+
type: "button",
|
|
2774
|
+
class: "m-input-number__btn m-input-number__btn--inc",
|
|
2775
|
+
tabindex: "-1",
|
|
2776
|
+
"aria-label": "增加",
|
|
2777
|
+
disabled: !_.value,
|
|
2778
|
+
onClick: n[4] ||= (e) => T(1)
|
|
2779
|
+
}, [...n[9] ||= [c("svg", {
|
|
2780
|
+
viewBox: "0 0 24 24",
|
|
2781
|
+
width: "1em",
|
|
2782
|
+
height: "1em",
|
|
2783
|
+
fill: "none",
|
|
2784
|
+
stroke: "currentColor",
|
|
2785
|
+
"stroke-width": "2.2",
|
|
2786
|
+
"stroke-linecap": "round",
|
|
2787
|
+
"aria-hidden": "true"
|
|
2788
|
+
}, [c("path", { d: "M6 15l6-6 6 6" })], -1)]], 8, zn)]))
|
|
2789
|
+
], 6));
|
|
2790
|
+
}
|
|
2791
|
+
}), Vn = { disabled: !1 }, Hn = {
|
|
2792
|
+
disabled: !1,
|
|
2793
|
+
vertical: !1
|
|
2794
|
+
}, Un = Symbol("m-radio-group-context"), Wn = [
|
|
2795
|
+
"name",
|
|
2796
|
+
"value",
|
|
2797
|
+
"checked",
|
|
2798
|
+
"disabled"
|
|
2799
|
+
], Gn = {
|
|
2800
|
+
class: "m-radio__hit",
|
|
2801
|
+
"aria-hidden": "true"
|
|
2802
|
+
}, Kn = { class: "m-radio__label" }, qn = /* @__PURE__ */ d({
|
|
2803
|
+
__name: "Radio",
|
|
2804
|
+
props: /*@__PURE__*/ p({
|
|
2805
|
+
value: { type: [
|
|
2806
|
+
String,
|
|
2807
|
+
Number,
|
|
2808
|
+
Boolean
|
|
2809
|
+
] },
|
|
2810
|
+
modelValue: { type: Boolean },
|
|
2811
|
+
name: {},
|
|
2812
|
+
disabled: { type: Boolean },
|
|
2813
|
+
color: {},
|
|
2814
|
+
size: {}
|
|
2815
|
+
}, Vn),
|
|
2816
|
+
emits: ["update:modelValue", "change"],
|
|
2817
|
+
setup(e, { emit: t }) {
|
|
2818
|
+
let n = e, r = t, a = f(Un, null), o = i(() => n.color ?? a?.color ?? "primary"), l = i(() => n.size ?? a?.size ?? "default"), u = i(() => n.disabled || !!a?.disabled), d = i(() => n.name ?? a?.name), p = i(() => a ? a.modelValue.value === n.value : !!n.modelValue), m = i(() => [
|
|
2819
|
+
"m-radio",
|
|
2820
|
+
`m-radio--${l.value}`,
|
|
2821
|
+
`m-radio--${o.value}`,
|
|
2822
|
+
p.value && "is-checked",
|
|
2823
|
+
u.value && "is-disabled"
|
|
2824
|
+
]);
|
|
2825
|
+
function g(e) {
|
|
2826
|
+
u.value || e.target.checked && (a ? a.updateValue(n.value) : (r("update:modelValue", !0), r("change", !0)));
|
|
2827
|
+
}
|
|
2828
|
+
return (t, n) => (v(), s("label", { class: h(m.value) }, [
|
|
2829
|
+
c("input", {
|
|
2830
|
+
type: "radio",
|
|
2831
|
+
class: "m-radio__input",
|
|
2832
|
+
name: d.value,
|
|
2833
|
+
value: e.value,
|
|
2834
|
+
checked: p.value,
|
|
2835
|
+
disabled: u.value,
|
|
2836
|
+
onChange: g
|
|
2837
|
+
}, null, 40, Wn),
|
|
2838
|
+
j((v(), s("span", Gn, [...n[0] ||= [c("span", { class: "m-radio__control" }, [c("span", { class: "m-radio__dot" })], -1)]])), [[E(Q), {
|
|
2839
|
+
center: !0,
|
|
2840
|
+
disabled: u.value
|
|
2841
|
+
}]]),
|
|
2842
|
+
c("span", Kn, [w(t.$slots, "default")])
|
|
2843
|
+
], 2));
|
|
2844
|
+
}
|
|
2845
|
+
}), Jn = /* @__PURE__ */ d({
|
|
2846
|
+
__name: "RadioGroup",
|
|
2847
|
+
props: /*@__PURE__*/ p({
|
|
2848
|
+
modelValue: { type: [
|
|
2849
|
+
String,
|
|
2850
|
+
Number,
|
|
2851
|
+
Boolean
|
|
2852
|
+
] },
|
|
2853
|
+
name: {},
|
|
2854
|
+
disabled: { type: Boolean },
|
|
2855
|
+
color: {},
|
|
2856
|
+
size: {},
|
|
2857
|
+
vertical: { type: Boolean }
|
|
2858
|
+
}, Hn),
|
|
2859
|
+
emits: ["update:modelValue", "change"],
|
|
2860
|
+
setup(e, { emit: t }) {
|
|
2861
|
+
let n = e, r = t, a = {
|
|
2862
|
+
modelValue: i(() => n.modelValue),
|
|
2863
|
+
color: n.color ?? "primary",
|
|
2864
|
+
size: n.size ?? "default",
|
|
2865
|
+
disabled: n.disabled,
|
|
2866
|
+
name: n.name,
|
|
2867
|
+
updateValue(e) {
|
|
2868
|
+
n.disabled || e === n.modelValue || (r("update:modelValue", e), r("change", e));
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
y(Un, a);
|
|
2872
|
+
let o = i(() => [
|
|
2873
|
+
"m-radio-group",
|
|
2874
|
+
n.vertical && "is-vertical",
|
|
2875
|
+
n.disabled && "is-disabled"
|
|
2876
|
+
]);
|
|
2877
|
+
return (e, t) => (v(), s("div", {
|
|
2878
|
+
class: h(o.value),
|
|
2879
|
+
role: "radiogroup"
|
|
2880
|
+
}, [w(e.$slots, "default")], 2));
|
|
2881
|
+
}
|
|
2882
|
+
}), Yn = {
|
|
2883
|
+
options: () => [],
|
|
2884
|
+
disabled: !1,
|
|
2885
|
+
clearable: !1,
|
|
2886
|
+
multiple: !1,
|
|
2887
|
+
size: "default"
|
|
2888
|
+
}, Xn = ["aria-expanded", "aria-disabled"], Zn = {
|
|
2889
|
+
key: 0,
|
|
2890
|
+
class: "m-select__empty"
|
|
2891
|
+
}, Qn = [
|
|
2892
|
+
"aria-selected",
|
|
2893
|
+
"onMouseenter",
|
|
2894
|
+
"onClick"
|
|
2895
|
+
], $n = { class: "m-select__option-label" }, er = {
|
|
2896
|
+
key: 0,
|
|
2897
|
+
class: "m-select__check",
|
|
2898
|
+
viewBox: "0 0 24 24",
|
|
2899
|
+
width: "16",
|
|
2900
|
+
height: "16",
|
|
2901
|
+
fill: "none",
|
|
2902
|
+
stroke: "currentColor",
|
|
2903
|
+
"stroke-width": "2.2",
|
|
2904
|
+
"stroke-linecap": "round",
|
|
2905
|
+
"stroke-linejoin": "round",
|
|
2906
|
+
"aria-hidden": "true"
|
|
2907
|
+
}, tr = 4, nr = 280, rr = /* @__PURE__ */ d({
|
|
2908
|
+
__name: "Select",
|
|
2909
|
+
props: /*@__PURE__*/ p({
|
|
2910
|
+
modelValue: {},
|
|
2911
|
+
options: {},
|
|
2912
|
+
placeholder: {},
|
|
2913
|
+
disabled: { type: Boolean },
|
|
2914
|
+
clearable: { type: Boolean },
|
|
2915
|
+
multiple: { type: Boolean },
|
|
2916
|
+
size: {},
|
|
2917
|
+
width: {}
|
|
2918
|
+
}, Yn),
|
|
2919
|
+
emits: ["update:modelValue", "change"],
|
|
2920
|
+
setup(r, { emit: l }) {
|
|
2921
|
+
let d = r, f = l, p = x(null), y = x(null), b = x(null), S = x(null), w = x(!1), D = x(!1), k = x(null), N = x(-1), P = i(() => d.multiple ? Array.isArray(d.modelValue) ? [...d.modelValue] : [] : d.modelValue == null ? [] : [d.modelValue]), F = i(() => d.options.filter((e) => P.value.includes(e.value)).map((e) => e.label).join(", ")), I = (e) => P.value.includes(e.value), L = i(() => d.clearable && !d.disabled && P.value.length > 0), ee = i(() => [
|
|
2922
|
+
"m-select",
|
|
2923
|
+
`m-select--${d.size}`,
|
|
2924
|
+
w.value && "is-open",
|
|
2925
|
+
D.value && "is-focused",
|
|
2926
|
+
d.disabled && "is-disabled",
|
|
2927
|
+
!F.value && "is-empty"
|
|
2928
|
+
]);
|
|
2929
|
+
function R() {
|
|
2930
|
+
if (d.disabled || w.value) return;
|
|
2931
|
+
let e = p.value.getBoundingClientRect(), t = window.innerHeight - e.bottom - tr;
|
|
2932
|
+
k.value = {
|
|
2933
|
+
top: e.bottom + tr,
|
|
2934
|
+
left: e.left,
|
|
2935
|
+
width: e.width,
|
|
2936
|
+
maxHeight: Math.max(1, Math.min(nr, t)),
|
|
2937
|
+
placement: "bottom"
|
|
2938
|
+
}, w.value = !0;
|
|
2939
|
+
let n = d.options.findIndex((e) => !e.disabled && P.value.includes(e.value));
|
|
2940
|
+
N.value = n >= 0 ? n : d.options.findIndex((e) => !e.disabled), m(() => {
|
|
2941
|
+
z(), U(), b.value?.focus({ preventScroll: !0 });
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
function z() {
|
|
2945
|
+
let e = S.value, t = k.value;
|
|
2946
|
+
if (!e || !t) return;
|
|
2947
|
+
let n = window.innerHeight, r = window.innerWidth, i = p.value.getBoundingClientRect(), a = tr, o = n - i.bottom - a, s = i.top - a, c = e.scrollHeight, l = Math.min(c, nr), u = b.value?.getBoundingClientRect().width ?? t.width, d = r - i.left - 4, f = u > d ? Math.max(t.width, d) : void 0;
|
|
2948
|
+
if (o >= l) {
|
|
2949
|
+
let e = Math.max(0, i.bottom + a);
|
|
2950
|
+
k.value = {
|
|
2951
|
+
...t,
|
|
2952
|
+
top: e,
|
|
2953
|
+
maxHeight: Math.min(l, n - e),
|
|
2954
|
+
placement: "bottom",
|
|
2955
|
+
forcedWidth: f
|
|
2956
|
+
};
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
if (s >= l) {
|
|
2960
|
+
let e = Math.max(0, Math.min(i.top - a - l, n - l));
|
|
2961
|
+
k.value = {
|
|
2962
|
+
...t,
|
|
2963
|
+
top: e,
|
|
2964
|
+
maxHeight: l,
|
|
2965
|
+
placement: "top",
|
|
2966
|
+
forcedWidth: f
|
|
2967
|
+
};
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2970
|
+
if (o >= s) {
|
|
2971
|
+
let e = Math.max(0, i.bottom + a), r = Math.max(1, Math.min(n - e, o));
|
|
2972
|
+
k.value = {
|
|
2973
|
+
...t,
|
|
2974
|
+
top: e,
|
|
2975
|
+
maxHeight: r,
|
|
2976
|
+
placement: "bottom",
|
|
2977
|
+
forcedWidth: f
|
|
2978
|
+
};
|
|
2979
|
+
} else {
|
|
2980
|
+
let e = Math.max(1, Math.min(n, s)), r = Math.max(0, Math.min(i.top - a - e, n - e));
|
|
2981
|
+
k.value = {
|
|
2982
|
+
...t,
|
|
2983
|
+
top: r,
|
|
2984
|
+
maxHeight: e,
|
|
2985
|
+
placement: "top",
|
|
2986
|
+
forcedWidth: f
|
|
2987
|
+
};
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
function B(e = !1) {
|
|
2991
|
+
w.value = !1, e && y.value?.focus();
|
|
2992
|
+
}
|
|
2993
|
+
function V() {
|
|
2994
|
+
w.value ? B(!0) : R();
|
|
2995
|
+
}
|
|
2996
|
+
function te(e) {
|
|
2997
|
+
if (!e.disabled) {
|
|
2998
|
+
if (d.multiple) {
|
|
2999
|
+
let t = P.value.slice(), n = t.indexOf(e.value);
|
|
3000
|
+
n >= 0 ? t.splice(n, 1) : t.push(e.value);
|
|
3001
|
+
let r = t;
|
|
3002
|
+
f("update:modelValue", r), f("change", r), N.value = d.options.indexOf(e);
|
|
3003
|
+
} else f("update:modelValue", e.value), f("change", e.value), B(!0);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
function H() {
|
|
3007
|
+
let e = d.multiple ? [] : void 0;
|
|
3008
|
+
f("update:modelValue", e), f("change", e);
|
|
3009
|
+
}
|
|
3010
|
+
function U() {
|
|
3011
|
+
m(() => {
|
|
3012
|
+
let e = S.value, t = e?.querySelector(".is-active");
|
|
3013
|
+
if (!e || !t) return;
|
|
3014
|
+
let n = t.offsetTop, r = n + t.offsetHeight, i = e.scrollTop, a = i + e.clientHeight;
|
|
3015
|
+
n < i ? e.scrollTop = n : r > a && (e.scrollTop = r - e.clientHeight);
|
|
3016
|
+
});
|
|
3017
|
+
}
|
|
3018
|
+
function W(e) {
|
|
3019
|
+
let t = d.options;
|
|
3020
|
+
if (t.length === 0) return;
|
|
3021
|
+
let n = N.value;
|
|
3022
|
+
for (let r = 0; r < t.length && (n = (n + e + t.length) % t.length, t[n].disabled); r++);
|
|
3023
|
+
n !== N.value && (N.value = n, U());
|
|
3024
|
+
}
|
|
3025
|
+
function ne(e) {
|
|
3026
|
+
e && (N.value = d.options.indexOf(e), U());
|
|
3027
|
+
}
|
|
3028
|
+
function G(e) {
|
|
3029
|
+
if (!d.disabled) {
|
|
3030
|
+
if (!w.value) {
|
|
3031
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), R());
|
|
3032
|
+
return;
|
|
3033
|
+
}
|
|
3034
|
+
switch (e.key) {
|
|
3035
|
+
case "ArrowDown":
|
|
3036
|
+
e.preventDefault(), W(1);
|
|
3037
|
+
break;
|
|
3038
|
+
case "ArrowUp":
|
|
3039
|
+
e.preventDefault(), W(-1);
|
|
3040
|
+
break;
|
|
3041
|
+
case "Home":
|
|
3042
|
+
e.preventDefault(), ne(d.options.find((e) => !e.disabled));
|
|
3043
|
+
break;
|
|
3044
|
+
case "End": {
|
|
3045
|
+
e.preventDefault();
|
|
3046
|
+
let t;
|
|
3047
|
+
for (let e = d.options.length - 1; e >= 0; e--) if (!d.options[e].disabled) {
|
|
3048
|
+
t = d.options[e];
|
|
3049
|
+
break;
|
|
3050
|
+
}
|
|
3051
|
+
ne(t);
|
|
3052
|
+
break;
|
|
3053
|
+
}
|
|
3054
|
+
case "Enter": {
|
|
3055
|
+
let e = d.options[N.value];
|
|
3056
|
+
e && te(e);
|
|
3057
|
+
break;
|
|
3058
|
+
}
|
|
3059
|
+
case "Escape":
|
|
3060
|
+
e.preventDefault(), B(!0);
|
|
3061
|
+
break;
|
|
3062
|
+
case "Tab": B(!1);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
function K(e) {
|
|
3067
|
+
let t = e.target;
|
|
3068
|
+
!p.value?.contains(t) && !b.value?.contains(t) && B(!1);
|
|
3069
|
+
}
|
|
3070
|
+
function q(e) {
|
|
3071
|
+
let t = e.target;
|
|
3072
|
+
t instanceof Node && b.value?.contains(t) || B(!1);
|
|
3073
|
+
}
|
|
3074
|
+
function J(e, t) {
|
|
3075
|
+
let n = getComputedStyle(document.documentElement).getPropertyValue(e).trim(), r = parseFloat(n);
|
|
3076
|
+
return Number.isFinite(r) ? r : t;
|
|
3077
|
+
}
|
|
3078
|
+
function re(e, t, n) {
|
|
3079
|
+
let r = e.getBoundingClientRect();
|
|
3080
|
+
if (t) {
|
|
3081
|
+
let e = t.getBoundingClientRect(), i = n === "top" ? e.top - r.top : e.top + e.height - r.top;
|
|
3082
|
+
return `${e.left + e.width / 2 - r.left}px ${i}px`;
|
|
3083
|
+
}
|
|
3084
|
+
return "center";
|
|
3085
|
+
}
|
|
3086
|
+
function ie(e, t) {
|
|
3087
|
+
for (let t of e) t && (t.style.transition = "", t.style.opacity = "", t.style.transform = "", t.style.transformOrigin = "");
|
|
3088
|
+
t();
|
|
3089
|
+
}
|
|
3090
|
+
let Y = 0;
|
|
3091
|
+
function X(e, t, n) {
|
|
3092
|
+
let r = e[0];
|
|
3093
|
+
if (!r) return;
|
|
3094
|
+
let i = ++Y, a = !1, o = e.filter((e) => !!e && e !== r), s = /* @__PURE__ */ new Set(), c = () => {
|
|
3095
|
+
a || (a = !0, window.clearTimeout(u), r.removeEventListener("transitionend", l), i === Y ? ie(e, n) : n());
|
|
3096
|
+
}, l = (e) => {
|
|
3097
|
+
let t = e.target;
|
|
3098
|
+
!t || !o.includes(t) || (s.add(t), s.size >= o.length && c());
|
|
3099
|
+
}, u = window.setTimeout(c, t + 80);
|
|
3100
|
+
o.length > 0 ? r.addEventListener("transitionend", l) : c();
|
|
3101
|
+
}
|
|
3102
|
+
function ae(e, t) {
|
|
3103
|
+
let n = e, r = n.querySelector(".m-select__panel-surface"), i = n.querySelector(".m-select__panel-content"), a = J("--m-dur-entering", 225), o = "var(--m-ease-in-out, ease)";
|
|
3104
|
+
z(), m(() => {
|
|
3105
|
+
r && (r.style.transformOrigin = re(r, y.value, k.value?.placement ?? "bottom"), r.style.transform = "scale(1, 0)"), i && (i.style.opacity = "0"), n.offsetWidth, requestAnimationFrame(() => {
|
|
3106
|
+
let e = Math.round(a * 1.4), s = e;
|
|
3107
|
+
if (r && (r.style.transition = `transform ${e}ms ${o}`, r.style.transform = ""), i) {
|
|
3108
|
+
let t = Math.round(a * .7), n = Math.round(e * .85);
|
|
3109
|
+
i.style.transition = `opacity ${t}ms ${o} ${n}ms`, i.style.opacity = "1", s = Math.max(s, n + t);
|
|
3110
|
+
}
|
|
3111
|
+
X([
|
|
3112
|
+
n,
|
|
3113
|
+
r,
|
|
3114
|
+
i
|
|
3115
|
+
], s, t);
|
|
3116
|
+
});
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
function Z(e, t) {
|
|
3120
|
+
let n = e, r = n.querySelector(".m-select__panel-surface"), i = n.querySelector(".m-select__panel-content"), a = J("--m-dur-leaving", 195), o = "var(--m-ease-in-out, ease)", s = Math.round(a * 1), c = s;
|
|
3121
|
+
if (r && (r.style.transformOrigin = re(r, y.value, k.value?.placement ?? "bottom"), r.style.transition = `opacity ${s}ms ${o}, transform ${s}ms ${o}`, r.style.transform = "scale(0.96)", r.style.opacity = "0"), i) {
|
|
3122
|
+
let e = Math.round(a * .6);
|
|
3123
|
+
i.style.transition = `opacity ${e}ms ${o}`, i.style.opacity = "0", c = Math.max(c, e);
|
|
3124
|
+
}
|
|
3125
|
+
X([
|
|
3126
|
+
n,
|
|
3127
|
+
r,
|
|
3128
|
+
i
|
|
3129
|
+
], c, t);
|
|
3130
|
+
}
|
|
3131
|
+
return O(w, (e) => {
|
|
3132
|
+
e ? (Ge(), document.addEventListener("pointerdown", K, !0), window.addEventListener("scroll", q, !0), window.addEventListener("resize", q)) : (Ke(), document.removeEventListener("pointerdown", K, !0), window.removeEventListener("scroll", q, !0), window.removeEventListener("resize", q));
|
|
3133
|
+
}), _(() => {
|
|
3134
|
+
Ke(), document.removeEventListener("pointerdown", K, !0), window.removeEventListener("scroll", q, !0), window.removeEventListener("resize", q);
|
|
3135
|
+
}), (i, l) => (v(), s("div", {
|
|
3136
|
+
ref_key: "rootRef",
|
|
3137
|
+
ref: p,
|
|
3138
|
+
class: h(ee.value),
|
|
3139
|
+
style: g(r.width ? { width: r.width } : void 0)
|
|
3140
|
+
}, [c("div", {
|
|
3141
|
+
ref_key: "triggerRef",
|
|
3142
|
+
ref: y,
|
|
3143
|
+
class: "m-select__trigger",
|
|
3144
|
+
role: "combobox",
|
|
3145
|
+
"aria-haspopup": "listbox",
|
|
3146
|
+
"aria-expanded": w.value,
|
|
3147
|
+
"aria-disabled": r.disabled || void 0,
|
|
3148
|
+
tabindex: "0",
|
|
3149
|
+
onClick: V,
|
|
3150
|
+
onFocus: l[1] ||= (e) => D.value = !0,
|
|
3151
|
+
onBlur: l[2] ||= (e) => D.value = !1,
|
|
3152
|
+
onKeydown: G
|
|
3153
|
+
}, [
|
|
3154
|
+
c("span", { class: h(["m-select__value", { "is-placeholder": !F.value }]) }, T(F.value || r.placeholder), 3),
|
|
3155
|
+
L.value ? (v(), s("button", {
|
|
3156
|
+
key: 0,
|
|
3157
|
+
type: "button",
|
|
3158
|
+
class: "m-select__clear",
|
|
3159
|
+
tabindex: "-1",
|
|
3160
|
+
"aria-label": "清除选择",
|
|
3161
|
+
onMousedown: l[0] ||= M(() => {}, ["prevent"]),
|
|
3162
|
+
onClick: M(H, ["stop"])
|
|
3163
|
+
}, [...l[3] ||= [c("svg", {
|
|
3164
|
+
viewBox: "0 0 24 24",
|
|
3165
|
+
width: "12",
|
|
3166
|
+
height: "12",
|
|
3167
|
+
fill: "none",
|
|
3168
|
+
stroke: "currentColor",
|
|
3169
|
+
"stroke-width": "2.4",
|
|
3170
|
+
"stroke-linecap": "round",
|
|
3171
|
+
"aria-hidden": "true"
|
|
3172
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 32)) : o("", !0),
|
|
3173
|
+
l[4] ||= c("span", {
|
|
3174
|
+
class: "m-select__arrow",
|
|
3175
|
+
"aria-hidden": "true"
|
|
3176
|
+
}, [c("svg", {
|
|
3177
|
+
viewBox: "0 0 24 24",
|
|
3178
|
+
width: "16",
|
|
3179
|
+
height: "16",
|
|
3180
|
+
fill: "none",
|
|
3181
|
+
stroke: "currentColor",
|
|
3182
|
+
"stroke-width": "2",
|
|
3183
|
+
"stroke-linecap": "round",
|
|
3184
|
+
"stroke-linejoin": "round"
|
|
3185
|
+
}, [c("path", { d: "m6 9 6 6 6-6" })])], -1)
|
|
3186
|
+
], 40, Xn), (v(), a(t, { to: "body" }, [u(n, {
|
|
3187
|
+
css: !1,
|
|
3188
|
+
onEnter: ae,
|
|
3189
|
+
onLeave: Z
|
|
3190
|
+
}, {
|
|
3191
|
+
default: A(() => [w.value ? (v(), s("div", {
|
|
3192
|
+
key: 0,
|
|
3193
|
+
ref_key: "panelRef",
|
|
3194
|
+
ref: b,
|
|
3195
|
+
class: "m-select__panel",
|
|
3196
|
+
role: "listbox",
|
|
3197
|
+
tabindex: "-1",
|
|
3198
|
+
style: g(k.value ? {
|
|
3199
|
+
top: k.value.top + "px",
|
|
3200
|
+
left: k.value.left + "px",
|
|
3201
|
+
width: k.value.forcedWidth ? k.value.forcedWidth + "px" : "max-content",
|
|
3202
|
+
minWidth: k.value.width + "px",
|
|
3203
|
+
maxWidth: "calc(100vw - 8px)"
|
|
3204
|
+
} : void 0),
|
|
3205
|
+
onKeydown: G
|
|
3206
|
+
}, [l[6] ||= c("div", {
|
|
3207
|
+
class: "m-select__panel-surface",
|
|
3208
|
+
"aria-hidden": "true"
|
|
3209
|
+
}, null, -1), c("div", {
|
|
3210
|
+
ref_key: "contentRef",
|
|
3211
|
+
ref: S,
|
|
3212
|
+
class: "m-select__panel-content",
|
|
3213
|
+
style: g(k.value ? { maxHeight: k.value.maxHeight + "px" } : void 0)
|
|
3214
|
+
}, [r.options.length === 0 ? (v(), s("div", Zn, "无匹配选项")) : o("", !0), (v(!0), s(e, null, C(r.options, (e, t) => j((v(), s("div", {
|
|
3215
|
+
key: e.value,
|
|
3216
|
+
class: h(["m-select__option", {
|
|
3217
|
+
"is-selected": I(e),
|
|
3218
|
+
"is-disabled": e.disabled,
|
|
3219
|
+
"is-active": N.value === t
|
|
3220
|
+
}]),
|
|
3221
|
+
role: "option",
|
|
3222
|
+
"aria-selected": I(e),
|
|
3223
|
+
onMouseenter: (e) => N.value = t,
|
|
3224
|
+
onClick: (t) => te(e)
|
|
3225
|
+
}, [c("span", $n, T(e.label), 1), I(e) ? (v(), s("svg", er, [...l[5] ||= [c("path", { d: "M5 13l4 4L19 7" }, null, -1)]])) : o("", !0)], 42, Qn)), [[E(Q), {
|
|
3226
|
+
duration: 200,
|
|
3227
|
+
initialScale: .7
|
|
3228
|
+
}]])), 128))], 4)], 36)) : o("", !0)]),
|
|
3229
|
+
_: 1
|
|
3230
|
+
})]))], 6));
|
|
3231
|
+
}
|
|
3232
|
+
}), ir = {
|
|
3233
|
+
min: 0,
|
|
3234
|
+
max: 100,
|
|
3235
|
+
step: 1,
|
|
3236
|
+
disabled: !1,
|
|
3237
|
+
showLabel: !0,
|
|
3238
|
+
vertical: !1,
|
|
3239
|
+
color: "primary"
|
|
3240
|
+
}, ar = {
|
|
3241
|
+
key: 0,
|
|
3242
|
+
class: "m-slider__tooltip"
|
|
3243
|
+
}, or = [
|
|
3244
|
+
"aria-orientation",
|
|
3245
|
+
"aria-valuemin",
|
|
3246
|
+
"aria-valuemax",
|
|
3247
|
+
"aria-valuenow",
|
|
3248
|
+
"aria-disabled"
|
|
3249
|
+
], sr = /* @__PURE__ */ d({
|
|
3250
|
+
__name: "Slider",
|
|
3251
|
+
props: /*@__PURE__*/ p({
|
|
3252
|
+
modelValue: {},
|
|
3253
|
+
min: {},
|
|
3254
|
+
max: {},
|
|
3255
|
+
step: {},
|
|
3256
|
+
disabled: { type: Boolean },
|
|
3257
|
+
showLabel: { type: Boolean },
|
|
3258
|
+
vertical: { type: Boolean },
|
|
3259
|
+
color: {}
|
|
3260
|
+
}, ir),
|
|
3261
|
+
emits: ["update:modelValue", "change"],
|
|
3262
|
+
setup(e, { emit: t }) {
|
|
3263
|
+
let r = e, a = t, l = x(null), d = x(null), f = x(!1), p = x(!1), m = x(0), y = x({
|
|
3264
|
+
x: 0,
|
|
3265
|
+
y: 0,
|
|
3266
|
+
value: 0
|
|
3267
|
+
}), b = x(!1), S, C = i(() => r.min), w = i(() => r.max), E = i(() => w.value - C.value), D = i(() => r.step), O = i(() => {
|
|
3268
|
+
let e = N(k.value);
|
|
3269
|
+
return E.value <= 0 ? 0 : (e - C.value) / E.value * 100;
|
|
3270
|
+
}), k = i(() => r.modelValue ?? C.value), j = i(() => r.vertical ? { height: `${O.value}%` } : { width: `${O.value}%` }), M = i(() => r.vertical ? { bottom: `${O.value}%` } : { left: `${O.value}%` });
|
|
3271
|
+
function N(e) {
|
|
3272
|
+
return e < C.value ? C.value : e > w.value ? w.value : e;
|
|
3273
|
+
}
|
|
3274
|
+
function P(e) {
|
|
3275
|
+
let t = N(e);
|
|
3276
|
+
return Math.round((t - C.value) / D.value) * D.value + C.value;
|
|
3277
|
+
}
|
|
3278
|
+
function F(e, t) {
|
|
3279
|
+
let n = l.value?.getBoundingClientRect();
|
|
3280
|
+
if (!n) return k.value;
|
|
3281
|
+
if (r.vertical) {
|
|
3282
|
+
if (n.height <= 0) return k.value;
|
|
3283
|
+
let e = (n.bottom - t) / n.height;
|
|
3284
|
+
return P(C.value + e * E.value);
|
|
3285
|
+
}
|
|
3286
|
+
if (n.width <= 0) return k.value;
|
|
3287
|
+
let i = (e - n.left) / n.width;
|
|
3288
|
+
return P(C.value + i * E.value);
|
|
3289
|
+
}
|
|
3290
|
+
function I(e) {
|
|
3291
|
+
let t = d.value;
|
|
3292
|
+
if (!t) return !1;
|
|
3293
|
+
let n = t.getBoundingClientRect();
|
|
3294
|
+
return e.clientX >= n.left - 8 && e.clientX <= n.right + 8 && e.clientY >= n.top - 8 && e.clientY <= n.bottom + 8;
|
|
3295
|
+
}
|
|
3296
|
+
function L() {
|
|
3297
|
+
window.addEventListener("pointermove", z), window.addEventListener("pointerup", V);
|
|
3298
|
+
}
|
|
3299
|
+
function ee(e) {
|
|
3300
|
+
f.value = !0, y.value = {
|
|
3301
|
+
x: e.clientX,
|
|
3302
|
+
y: e.clientY,
|
|
3303
|
+
value: k.value
|
|
3304
|
+
}, r.showLabel && (p.value = !0, m.value = k.value), L();
|
|
3305
|
+
}
|
|
3306
|
+
function R(e) {
|
|
3307
|
+
if (r.disabled || e.button !== 0) return;
|
|
3308
|
+
if (e.preventDefault(), I(e)) {
|
|
3309
|
+
d.value?.focus(), ee(e);
|
|
3310
|
+
return;
|
|
3311
|
+
}
|
|
3312
|
+
let t = F(e.clientX, e.clientY);
|
|
3313
|
+
m.value = t, r.showLabel && (p.value = !0), a("update:modelValue", t), b.value = !0, L();
|
|
3314
|
+
}
|
|
3315
|
+
function z(e) {
|
|
3316
|
+
if (b.value) {
|
|
3317
|
+
b.value = !1, f.value = !0, y.value = {
|
|
3318
|
+
x: e.clientX,
|
|
3319
|
+
y: e.clientY,
|
|
3320
|
+
value: k.value
|
|
3321
|
+
}, r.showLabel && (m.value = k.value);
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
if (!f.value) return;
|
|
3325
|
+
let t = l.value?.getBoundingClientRect();
|
|
3326
|
+
if (!t) return;
|
|
3327
|
+
let n = e.clientX - y.value.x, i = y.value.y - e.clientY, o = 0;
|
|
3328
|
+
o = r.vertical ? t.height > 0 ? i / t.height : 0 : t.width > 0 ? n / t.width : 0;
|
|
3329
|
+
let s = P(y.value.value + o * E.value);
|
|
3330
|
+
m.value = s, a("update:modelValue", s);
|
|
3331
|
+
}
|
|
3332
|
+
function B() {
|
|
3333
|
+
f.value = !1, b.value = !1, p.value = !1, window.removeEventListener("pointermove", z), window.removeEventListener("pointerup", V), a("change", k.value);
|
|
3334
|
+
}
|
|
3335
|
+
function V() {
|
|
3336
|
+
!f.value && !b.value || B();
|
|
3337
|
+
}
|
|
3338
|
+
function te(e) {
|
|
3339
|
+
if (r.disabled) return;
|
|
3340
|
+
let t;
|
|
3341
|
+
switch (e.key) {
|
|
3342
|
+
case "ArrowRight":
|
|
3343
|
+
case "ArrowUp":
|
|
3344
|
+
t = P(k.value + D.value);
|
|
3345
|
+
break;
|
|
3346
|
+
case "ArrowLeft":
|
|
3347
|
+
case "ArrowDown":
|
|
3348
|
+
t = P(k.value - D.value);
|
|
3349
|
+
break;
|
|
3350
|
+
case "Home":
|
|
3351
|
+
t = C.value;
|
|
3352
|
+
break;
|
|
3353
|
+
case "End":
|
|
3354
|
+
t = w.value;
|
|
3355
|
+
break;
|
|
3356
|
+
default: return;
|
|
3357
|
+
}
|
|
3358
|
+
e.preventDefault(), r.showLabel && (p.value = !0, m.value = t, window.clearTimeout(S), S = window.setTimeout(() => p.value = !1, 1200)), a("update:modelValue", t), a("change", t);
|
|
3359
|
+
}
|
|
3360
|
+
return _(() => {
|
|
3361
|
+
window.clearTimeout(S), window.removeEventListener("pointermove", z), window.removeEventListener("pointerup", V);
|
|
3362
|
+
}), (t, r) => (v(), s("div", { class: h(["m-slider", [`m-slider--${e.color}`, {
|
|
3363
|
+
"is-disabled": e.disabled,
|
|
3364
|
+
"is-vertical": e.vertical,
|
|
3365
|
+
"is-dragging": f.value
|
|
3366
|
+
}]]) }, [c("div", {
|
|
3367
|
+
ref_key: "trackRef",
|
|
3368
|
+
ref: l,
|
|
3369
|
+
class: "m-slider__track",
|
|
3370
|
+
onPointerdown: R
|
|
3371
|
+
}, [
|
|
3372
|
+
r[0] ||= c("div", { class: "m-slider__rail" }, null, -1),
|
|
3373
|
+
c("div", {
|
|
3374
|
+
class: "m-slider__fill",
|
|
3375
|
+
style: g(j.value)
|
|
3376
|
+
}, null, 4),
|
|
3377
|
+
c("div", {
|
|
3378
|
+
class: "m-slider__thumb-wrap",
|
|
3379
|
+
style: g(M.value)
|
|
3380
|
+
}, [u(n, { name: "m-slider-tip" }, {
|
|
3381
|
+
default: A(() => [p.value ? (v(), s("span", ar, T(m.value), 1)) : o("", !0)]),
|
|
3382
|
+
_: 1
|
|
3383
|
+
}), c("div", {
|
|
3384
|
+
ref_key: "thumbEl",
|
|
3385
|
+
ref: d,
|
|
3386
|
+
class: h(["m-slider__thumb", { "is-dragging": f.value }]),
|
|
3387
|
+
role: "slider",
|
|
3388
|
+
tabindex: "0",
|
|
3389
|
+
"aria-orientation": e.vertical ? "vertical" : "horizontal",
|
|
3390
|
+
"aria-valuemin": C.value,
|
|
3391
|
+
"aria-valuemax": w.value,
|
|
3392
|
+
"aria-valuenow": k.value,
|
|
3393
|
+
"aria-disabled": e.disabled || void 0,
|
|
3394
|
+
onKeydown: te
|
|
3395
|
+
}, null, 42, or)], 4)
|
|
3396
|
+
], 544)], 2));
|
|
3397
|
+
}
|
|
3398
|
+
}), cr = {
|
|
3399
|
+
disabled: !1,
|
|
3400
|
+
loading: !1,
|
|
3401
|
+
size: "default",
|
|
3402
|
+
color: "primary"
|
|
3403
|
+
}, lr = [
|
|
3404
|
+
"name",
|
|
3405
|
+
"checked",
|
|
3406
|
+
"disabled"
|
|
3407
|
+
], ur = { class: "m-switch__track" }, dr = { class: "m-switch__thumb" }, fr = {
|
|
3408
|
+
key: 0,
|
|
3409
|
+
class: "m-switch__spinner",
|
|
3410
|
+
"aria-hidden": "true"
|
|
3411
|
+
}, pr = {
|
|
3412
|
+
key: 0,
|
|
3413
|
+
class: "m-switch__label"
|
|
3414
|
+
}, mr = /* @__PURE__ */ d({
|
|
3415
|
+
__name: "Switch",
|
|
3416
|
+
props: /*@__PURE__*/ p({
|
|
3417
|
+
modelValue: { type: Boolean },
|
|
3418
|
+
color: {},
|
|
3419
|
+
size: {},
|
|
3420
|
+
disabled: { type: Boolean },
|
|
3421
|
+
loading: { type: Boolean },
|
|
3422
|
+
name: {}
|
|
3423
|
+
}, cr),
|
|
3424
|
+
emits: ["update:modelValue", "change"],
|
|
3425
|
+
setup(e, { emit: t }) {
|
|
3426
|
+
let n = e, r = t, a = i(() => !!n.modelValue), l = i(() => [
|
|
3427
|
+
"m-switch",
|
|
3428
|
+
`m-switch--${n.size}`,
|
|
3429
|
+
`m-switch--${n.color}`,
|
|
3430
|
+
a.value && "is-checked",
|
|
3431
|
+
n.disabled && "is-disabled",
|
|
3432
|
+
n.loading && "is-loading"
|
|
3433
|
+
]);
|
|
3434
|
+
function u(e) {
|
|
3435
|
+
if (n.disabled || n.loading) return;
|
|
3436
|
+
let t = e.target.checked;
|
|
3437
|
+
r("update:modelValue", t), r("change", t);
|
|
3438
|
+
}
|
|
3439
|
+
return (t, n) => (v(), s("label", { class: h(l.value) }, [
|
|
3440
|
+
c("input", {
|
|
3441
|
+
type: "checkbox",
|
|
3442
|
+
class: "m-switch__input",
|
|
3443
|
+
name: e.name,
|
|
3444
|
+
checked: a.value,
|
|
3445
|
+
disabled: e.disabled || e.loading,
|
|
3446
|
+
onChange: u
|
|
3447
|
+
}, null, 40, lr),
|
|
3448
|
+
j((v(), s("span", ur, [c("span", dr, [e.loading ? (v(), s("span", fr)) : o("", !0)])])), [[E(Q), {
|
|
3449
|
+
center: !0,
|
|
3450
|
+
disabled: e.disabled || e.loading
|
|
3451
|
+
}]]),
|
|
3452
|
+
t.$slots.default ? (v(), s("span", pr, [w(t.$slots, "default")])) : o("", !0)
|
|
3453
|
+
], 2));
|
|
3454
|
+
}
|
|
3455
|
+
}), hr = {
|
|
3456
|
+
type: "line",
|
|
3457
|
+
size: "default",
|
|
3458
|
+
disabled: !1,
|
|
3459
|
+
closable: !1,
|
|
3460
|
+
addable: !1
|
|
3461
|
+
}, gr = { disabled: !1 }, _r = Symbol("m-tabs-context"), vr = { class: "m-tabs__tab-row" }, yr = [
|
|
3462
|
+
"data-name",
|
|
3463
|
+
"aria-selected",
|
|
3464
|
+
"aria-disabled",
|
|
3465
|
+
"tabindex",
|
|
3466
|
+
"onClick"
|
|
3467
|
+
], br = { class: "m-tabs__tab-label" }, xr = ["aria-label", "onClick"], Sr = { class: "m-tabs__panes" }, Cr = /* @__PURE__ */ d({
|
|
3468
|
+
__name: "Tabs",
|
|
3469
|
+
props: /*@__PURE__*/ p({
|
|
3470
|
+
modelValue: {},
|
|
3471
|
+
type: {},
|
|
3472
|
+
color: {},
|
|
3473
|
+
size: {},
|
|
3474
|
+
disabled: { type: Boolean },
|
|
3475
|
+
closable: { type: Boolean },
|
|
3476
|
+
addable: { type: Boolean }
|
|
3477
|
+
}, hr),
|
|
3478
|
+
emits: [
|
|
3479
|
+
"update:modelValue",
|
|
3480
|
+
"change",
|
|
3481
|
+
"close",
|
|
3482
|
+
"add"
|
|
3483
|
+
],
|
|
3484
|
+
setup(t, { emit: n }) {
|
|
3485
|
+
let r = t, a = n, l = x(null), u = x(null), d = x(null), f = x(0), p = b([]), g = i(() => p.filter((e) => !e.disabled)), S = i(() => r.modelValue != null && g.value.some((e) => e.name === r.modelValue) ? r.modelValue : g.value[0]?.name);
|
|
3486
|
+
k(() => {
|
|
3487
|
+
r.modelValue != null && S.value !== r.modelValue && p.length > 0 && g.value.length > 0 && (f.value = 0, a("update:modelValue", S.value));
|
|
3488
|
+
});
|
|
3489
|
+
let D = (e) => S.value === e, A = {
|
|
3490
|
+
activeName: S,
|
|
3491
|
+
switchDirection: f,
|
|
3492
|
+
registerPane(e) {
|
|
3493
|
+
let t = e.name ?? `pane-${p.length}`;
|
|
3494
|
+
return p.push({
|
|
3495
|
+
...e,
|
|
3496
|
+
name: t
|
|
3497
|
+
}), t;
|
|
3498
|
+
},
|
|
3499
|
+
unregisterPane(e) {
|
|
3500
|
+
let t = p.findIndex((t) => t.name === e);
|
|
3501
|
+
if (t >= 0 && p.splice(t, 1), r.modelValue === e) {
|
|
3502
|
+
let e = g.value[t] ?? g.value[t - 1];
|
|
3503
|
+
e && a("update:modelValue", e.name);
|
|
3504
|
+
}
|
|
3505
|
+
},
|
|
3506
|
+
setActive(e) {
|
|
3507
|
+
let t = p.find((t) => t.name === e);
|
|
3508
|
+
if (!t || t.disabled || r.disabled || e === S.value) return;
|
|
3509
|
+
let n = p.findIndex((e) => e.name === S.value), i = p.findIndex((t) => t.name === e);
|
|
3510
|
+
f.value = i >= n ? 1 : -1, a("update:modelValue", e), a("change", e);
|
|
3511
|
+
},
|
|
3512
|
+
closePane(e) {
|
|
3513
|
+
a("close", e);
|
|
3514
|
+
},
|
|
3515
|
+
emitAdd() {
|
|
3516
|
+
r.disabled || a("add");
|
|
3517
|
+
}
|
|
3518
|
+
};
|
|
3519
|
+
y(_r, A);
|
|
3520
|
+
let N = (e) => e.closable || r.closable;
|
|
3521
|
+
async function P() {
|
|
3522
|
+
if (r.type !== "line" || !d.value || !u.value) return;
|
|
3523
|
+
await m();
|
|
3524
|
+
let e = l.value;
|
|
3525
|
+
if (!e) return;
|
|
3526
|
+
let t = e.querySelector(".m-tabs__tab.is-active"), n = u.value;
|
|
3527
|
+
if (!t) {
|
|
3528
|
+
d.value.style.opacity = "0";
|
|
3529
|
+
return;
|
|
3530
|
+
}
|
|
3531
|
+
d.value.style.opacity = "1", d.value.style.left = `${t.offsetLeft}px`, d.value.style.width = `${t.offsetWidth}px`;
|
|
3532
|
+
let i = t.offsetLeft, a = i + t.offsetWidth, o = n.scrollLeft, s = o + n.clientWidth;
|
|
3533
|
+
i < o ? n.scrollLeft = i : a > s && (n.scrollLeft = a - n.clientWidth);
|
|
3534
|
+
}
|
|
3535
|
+
O([S, () => p.length], () => P(), { flush: "post" }), _(() => p.splice(0));
|
|
3536
|
+
function F(e, t) {
|
|
3537
|
+
t.stopPropagation(), A.closePane(e.name), p.splice(p.indexOf(e), 1);
|
|
3538
|
+
}
|
|
3539
|
+
function I(e) {
|
|
3540
|
+
let t = l.value;
|
|
3541
|
+
t && t.querySelector(`.m-tabs__tab[data-name="${e}"]`)?.focus();
|
|
3542
|
+
}
|
|
3543
|
+
function L(e) {
|
|
3544
|
+
if (r.disabled || p.length === 0) return;
|
|
3545
|
+
let t = g.value;
|
|
3546
|
+
if (t.length === 0) return;
|
|
3547
|
+
let n = t.findIndex((e) => e.name === S.value), i = -1;
|
|
3548
|
+
switch (e.key) {
|
|
3549
|
+
case "ArrowRight":
|
|
3550
|
+
i = (n + 1) % t.length;
|
|
3551
|
+
break;
|
|
3552
|
+
case "ArrowLeft":
|
|
3553
|
+
i = (n - 1 + t.length) % t.length;
|
|
3554
|
+
break;
|
|
3555
|
+
case "Home":
|
|
3556
|
+
i = 0;
|
|
3557
|
+
break;
|
|
3558
|
+
case "End":
|
|
3559
|
+
i = t.length - 1;
|
|
3560
|
+
break;
|
|
3561
|
+
case "Enter":
|
|
3562
|
+
case " ":
|
|
3563
|
+
n >= 0 && (e.preventDefault(), A.setActive(t[n].name));
|
|
3564
|
+
return;
|
|
3565
|
+
default: return;
|
|
3566
|
+
}
|
|
3567
|
+
e.preventDefault();
|
|
3568
|
+
let a = t[i];
|
|
3569
|
+
A.setActive(a.name), I(a.name);
|
|
3570
|
+
}
|
|
3571
|
+
return (n, r) => (v(), s("div", { class: h(["m-tabs", [
|
|
3572
|
+
`m-tabs--${t.type}`,
|
|
3573
|
+
t.color && `m-tabs--${t.color}`,
|
|
3574
|
+
`m-tabs--${t.size}`,
|
|
3575
|
+
{ "is-disabled": t.disabled }
|
|
3576
|
+
]]) }, [c("div", {
|
|
3577
|
+
ref_key: "barRef",
|
|
3578
|
+
ref: l,
|
|
3579
|
+
class: "m-tabs__bar",
|
|
3580
|
+
role: "tablist",
|
|
3581
|
+
onKeydown: L
|
|
3582
|
+
}, [c("div", {
|
|
3583
|
+
ref_key: "scrollRef",
|
|
3584
|
+
ref: u,
|
|
3585
|
+
class: "m-tabs__scroll"
|
|
3586
|
+
}, [c("div", vr, [(v(!0), s(e, null, C(p, (e) => j((v(), s("div", {
|
|
3587
|
+
key: e.name,
|
|
3588
|
+
class: h(["m-tabs__tab", {
|
|
3589
|
+
"is-active": D(e.name),
|
|
3590
|
+
"is-disabled": e.disabled || t.disabled
|
|
3591
|
+
}]),
|
|
3592
|
+
role: "tab",
|
|
3593
|
+
"data-name": e.name,
|
|
3594
|
+
"aria-selected": D(e.name),
|
|
3595
|
+
"aria-disabled": e.disabled || t.disabled || void 0,
|
|
3596
|
+
tabindex: D(e.name) && !e.disabled && !t.disabled ? 0 : -1,
|
|
3597
|
+
onClick: (t) => A.setActive(e.name)
|
|
3598
|
+
}, [c("span", br, T(e.label), 1), N(e) ? j((v(), s("button", {
|
|
3599
|
+
key: 0,
|
|
3600
|
+
type: "button",
|
|
3601
|
+
class: "m-tabs__close",
|
|
3602
|
+
"aria-label": `关闭标签:${e.label}`,
|
|
3603
|
+
tabindex: "-1",
|
|
3604
|
+
onPointerdown: r[0] ||= M(() => {}, ["stop"]),
|
|
3605
|
+
onClick: (t) => F(e, t)
|
|
3606
|
+
}, [...r[2] ||= [c("svg", {
|
|
3607
|
+
viewBox: "0 0 24 24",
|
|
3608
|
+
width: "12",
|
|
3609
|
+
height: "12",
|
|
3610
|
+
fill: "none",
|
|
3611
|
+
stroke: "currentColor",
|
|
3612
|
+
"stroke-width": "2.4",
|
|
3613
|
+
"stroke-linecap": "round",
|
|
3614
|
+
"aria-hidden": "true"
|
|
3615
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]], 40, xr)), [[E(Q), { duration: 300 }]]) : o("", !0)], 10, yr)), [[E(Q)]])), 128)), t.type === "line" ? (v(), s("span", {
|
|
3616
|
+
key: 0,
|
|
3617
|
+
ref_key: "indicatorRef",
|
|
3618
|
+
ref: d,
|
|
3619
|
+
class: "m-tabs__indicator",
|
|
3620
|
+
"aria-hidden": "true"
|
|
3621
|
+
}, null, 512)) : o("", !0)])], 512), t.addable && !t.disabled ? j((v(), s("button", {
|
|
3622
|
+
key: 0,
|
|
3623
|
+
type: "button",
|
|
3624
|
+
class: "m-tabs__add",
|
|
3625
|
+
"aria-label": "新增标签",
|
|
3626
|
+
onClick: r[1] ||= (...e) => A.emitAdd && A.emitAdd(...e)
|
|
3627
|
+
}, [...r[3] ||= [c("svg", {
|
|
3628
|
+
viewBox: "0 0 24 24",
|
|
3629
|
+
width: "16",
|
|
3630
|
+
height: "16",
|
|
3631
|
+
fill: "none",
|
|
3632
|
+
stroke: "currentColor",
|
|
3633
|
+
"stroke-width": "2",
|
|
3634
|
+
"stroke-linecap": "round",
|
|
3635
|
+
"aria-hidden": "true"
|
|
3636
|
+
}, [c("path", { d: "M12 5v14M5 12h14" })], -1)]])), [[E(Q), { duration: 400 }]]) : o("", !0)], 544), c("div", Sr, [w(n.$slots, "default")])], 2));
|
|
3637
|
+
}
|
|
3638
|
+
}), wr = {
|
|
3639
|
+
class: "m-tab-pane",
|
|
3640
|
+
role: "tabpanel"
|
|
3641
|
+
}, Tr = /* @__PURE__ */ d({
|
|
3642
|
+
__name: "TabPane",
|
|
3643
|
+
props: /*@__PURE__*/ p({
|
|
3644
|
+
name: {},
|
|
3645
|
+
label: {},
|
|
3646
|
+
disabled: { type: Boolean },
|
|
3647
|
+
closable: { type: Boolean }
|
|
3648
|
+
}, gr),
|
|
3649
|
+
setup(e) {
|
|
3650
|
+
let t = e, r = f(_r, null), o = r ? r.registerPane({
|
|
3651
|
+
name: t.name,
|
|
3652
|
+
label: t.label,
|
|
3653
|
+
disabled: t.disabled,
|
|
3654
|
+
closable: t.closable
|
|
3655
|
+
}) : t.name ?? 0, s = i(() => !r || r.activeName.value === o), l = i(() => {
|
|
3656
|
+
let e = r?.switchDirection.value;
|
|
3657
|
+
return e == null || e === 0 ? "up" : e === 1 ? "right" : "left";
|
|
3658
|
+
});
|
|
3659
|
+
return _(() => {
|
|
3660
|
+
r?.unregisterPane(o);
|
|
3661
|
+
}), (e, t) => (v(), a(n, { name: `m-tab-pane-${l.value}` }, {
|
|
3662
|
+
default: A(() => [j(c("div", wr, [w(e.$slots, "default")], 512), [[D, s.value]])]),
|
|
3663
|
+
_: 3
|
|
3664
|
+
}, 8, ["name"]));
|
|
3665
|
+
}
|
|
3666
|
+
}), Er = {
|
|
3667
|
+
type: "default",
|
|
3668
|
+
duration: 3e3,
|
|
3669
|
+
closable: !1,
|
|
3670
|
+
position: "top-right",
|
|
3671
|
+
offset: 16
|
|
3672
|
+
}, Dr = ["aria-live"], Or = {
|
|
3673
|
+
key: 0,
|
|
3674
|
+
class: "m-toast-card__icon",
|
|
3675
|
+
"aria-hidden": "true"
|
|
3676
|
+
}, kr = {
|
|
3677
|
+
viewBox: "0 0 24 24",
|
|
3678
|
+
fill: "currentColor"
|
|
3679
|
+
}, Ar = ["d"], jr = { class: "m-toast-card__body" }, Mr = {
|
|
3680
|
+
key: 0,
|
|
3681
|
+
class: "m-toast-card__title"
|
|
3682
|
+
}, Nr = { class: "m-toast-card__message" }, Pr = /* @__PURE__ */ d({
|
|
3683
|
+
__name: "MToast",
|
|
3684
|
+
props: /*@__PURE__*/ p({
|
|
3685
|
+
modelValue: { type: Boolean },
|
|
3686
|
+
message: {},
|
|
3687
|
+
title: {},
|
|
3688
|
+
type: {},
|
|
3689
|
+
duration: {},
|
|
3690
|
+
closable: { type: Boolean },
|
|
3691
|
+
position: {},
|
|
3692
|
+
offset: {}
|
|
3693
|
+
}, Er),
|
|
3694
|
+
emits: ["update:modelValue", "close"],
|
|
3695
|
+
setup(e, { emit: r }) {
|
|
3696
|
+
let d = e, f = r, p = x(!!d.modelValue), m = null;
|
|
3697
|
+
function y() {
|
|
3698
|
+
m !== null && (window.clearTimeout(m), m = null);
|
|
3699
|
+
}
|
|
3700
|
+
function b() {
|
|
3701
|
+
y(), d.duration > 0 && (m = window.setTimeout(S, d.duration));
|
|
3702
|
+
}
|
|
3703
|
+
function S() {
|
|
3704
|
+
y(), p.value && (p.value = !1, f("update:modelValue", !1), f("close"));
|
|
3705
|
+
}
|
|
3706
|
+
O(p, (e) => {
|
|
3707
|
+
e ? b() : y();
|
|
3708
|
+
}), O(() => d.modelValue, (e) => {
|
|
3709
|
+
p.value = !!e;
|
|
3710
|
+
}), _(y);
|
|
3711
|
+
let C = i(() => {
|
|
3712
|
+
let e = `${d.offset}px`, t = {};
|
|
3713
|
+
return d.position.startsWith("top") ? t.top = e : t.bottom = e, d.position.endsWith("left") ? t.left = e : d.position.endsWith("right") ? t.right = e : (t.left = "50%", t.transform = "translateX(-50%)"), t;
|
|
3714
|
+
}), E = {
|
|
3715
|
+
success: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm4.3 7.3L10 15.6l-2.3-2.3a1 1 0 1 0-1.4 1.4l3 3a1 1 0 0 0 1.4 0l7-7a1 1 0 1 0-1.4-1.4z",
|
|
3716
|
+
info: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0-4a1.25 1.25 0 1 0 0 2.5A1.25 1.25 0 0 0 12 7z",
|
|
3717
|
+
warning: "M11.5 2.6a1.4 1.4 0 0 1 2.4 0l8.5 14.6a1.4 1.4 0 0 1-1.2 2.1H4.8a1.4 1.4 0 0 1-1.2-2.1L11.5 2.6zM12 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 7.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z",
|
|
3718
|
+
error: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 6.5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z"
|
|
3719
|
+
};
|
|
3720
|
+
return (r, i) => (v(), a(t, { to: "body" }, [u(n, { name: "m-toast" }, {
|
|
3721
|
+
default: A(() => [p.value ? (v(), s("div", {
|
|
3722
|
+
key: 0,
|
|
3723
|
+
class: h(["m-toast-card", `m-toast-card--${e.type}`]),
|
|
3724
|
+
role: "status",
|
|
3725
|
+
style: g(C.value),
|
|
3726
|
+
"aria-live": e.type === "error" ? "assertive" : "polite"
|
|
3727
|
+
}, [
|
|
3728
|
+
e.type === "default" ? o("", !0) : (v(), s("span", Or, [(v(), s("svg", kr, [c("path", { d: E[e.type] }, null, 8, Ar)]))])),
|
|
3729
|
+
c("div", jr, [e.title ? (v(), s("div", Mr, T(e.title), 1)) : o("", !0), c("div", Nr, [w(r.$slots, "default", {}, () => [l(T(e.message), 1)])])]),
|
|
3730
|
+
e.closable ? (v(), s("button", {
|
|
3731
|
+
key: 1,
|
|
3732
|
+
type: "button",
|
|
3733
|
+
class: "m-toast-card__close",
|
|
3734
|
+
"aria-label": "关闭提示",
|
|
3735
|
+
onClick: S
|
|
3736
|
+
}, [...i[0] ||= [c("svg", {
|
|
3737
|
+
viewBox: "0 0 24 24",
|
|
3738
|
+
width: "14",
|
|
3739
|
+
height: "14",
|
|
3740
|
+
fill: "none",
|
|
3741
|
+
stroke: "currentColor",
|
|
3742
|
+
"stroke-width": "2.4",
|
|
3743
|
+
"stroke-linecap": "round",
|
|
3744
|
+
"aria-hidden": "true"
|
|
3745
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])) : o("", !0)
|
|
3746
|
+
], 14, Dr)) : o("", !0)]),
|
|
3747
|
+
_: 3
|
|
3748
|
+
})]));
|
|
3749
|
+
}
|
|
3750
|
+
}), Fr = b([]), Ir = 0;
|
|
3751
|
+
function Lr(e) {
|
|
3752
|
+
let t = ++Ir;
|
|
3753
|
+
return Fr.push({
|
|
3754
|
+
...e,
|
|
3755
|
+
id: t
|
|
3756
|
+
}), t;
|
|
3757
|
+
}
|
|
3758
|
+
function Rr(e) {
|
|
3759
|
+
let t = Fr.findIndex((t) => t.id === e);
|
|
3760
|
+
t !== -1 && Fr.splice(t, 1);
|
|
3761
|
+
}
|
|
3762
|
+
function zr() {
|
|
3763
|
+
Fr.splice(0, Fr.length);
|
|
3764
|
+
}
|
|
3765
|
+
//#endregion
|
|
3766
|
+
//#region packages/miao-ui/src/toast/ToastCard.vue?vue&type=script&setup=true&lang.ts
|
|
3767
|
+
var Br = ["aria-live"], Vr = {
|
|
3768
|
+
key: 0,
|
|
3769
|
+
class: "m-toast-card__icon",
|
|
3770
|
+
"aria-hidden": "true"
|
|
3771
|
+
}, Hr = {
|
|
3772
|
+
viewBox: "0 0 24 24",
|
|
3773
|
+
fill: "currentColor"
|
|
3774
|
+
}, Ur = ["d"], Wr = { class: "m-toast-card__body" }, Gr = {
|
|
3775
|
+
key: 0,
|
|
3776
|
+
class: "m-toast-card__title"
|
|
3777
|
+
}, Kr = { class: "m-toast-card__message" }, qr = /* @__PURE__ */ d({
|
|
3778
|
+
__name: "ToastCard",
|
|
3779
|
+
props: { item: {} },
|
|
3780
|
+
emits: ["close"],
|
|
3781
|
+
setup(e, { emit: t }) {
|
|
3782
|
+
let n = e, r = t, i = null;
|
|
3783
|
+
n.item.duration > 0 && (i = window.setTimeout(a, n.item.duration));
|
|
3784
|
+
function a() {
|
|
3785
|
+
i !== null && (window.clearTimeout(i), i = null), r("close");
|
|
3786
|
+
}
|
|
3787
|
+
_(() => {
|
|
3788
|
+
i !== null && window.clearTimeout(i);
|
|
3789
|
+
});
|
|
3790
|
+
let l = {
|
|
3791
|
+
success: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm4.3 7.3L10 15.6l-2.3-2.3a1 1 0 1 0-1.4 1.4l3 3a1 1 0 0 0 1.4 0l7-7a1 1 0 1 0-1.4-1.4z",
|
|
3792
|
+
info: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0-4a1.25 1.25 0 1 0 0 2.5A1.25 1.25 0 0 0 12 7z",
|
|
3793
|
+
warning: "M11.5 2.6a1.4 1.4 0 0 1 2.4 0l8.5 14.6a1.4 1.4 0 0 1-1.2 2.1H4.8a1.4 1.4 0 0 1-1.2-2.1L11.5 2.6zM12 9a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 7.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z",
|
|
3794
|
+
error: "M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 6.5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0v-4a1 1 0 0 0-1-1zm0 6.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5z"
|
|
3795
|
+
};
|
|
3796
|
+
return (t, n) => (v(), s("div", {
|
|
3797
|
+
class: h(["m-toast-card", `m-toast-card--${e.item.type}`]),
|
|
3798
|
+
role: "status",
|
|
3799
|
+
"aria-live": e.item.type === "error" ? "assertive" : "polite"
|
|
3800
|
+
}, [
|
|
3801
|
+
e.item.type === "default" ? o("", !0) : (v(), s("span", Vr, [(v(), s("svg", Hr, [c("path", { d: l[e.item.type] }, null, 8, Ur)]))])),
|
|
3802
|
+
c("div", Wr, [e.item.title ? (v(), s("div", Gr, T(e.item.title), 1)) : o("", !0), c("div", Kr, T(e.item.message), 1)]),
|
|
3803
|
+
e.item.closable ? (v(), s("button", {
|
|
3804
|
+
key: 1,
|
|
3805
|
+
type: "button",
|
|
3806
|
+
class: "m-toast-card__close",
|
|
3807
|
+
"aria-label": "关闭提示",
|
|
3808
|
+
onClick: a
|
|
3809
|
+
}, [...n[0] ||= [c("svg", {
|
|
3810
|
+
viewBox: "0 0 24 24",
|
|
3811
|
+
width: "14",
|
|
3812
|
+
height: "14",
|
|
3813
|
+
fill: "none",
|
|
3814
|
+
stroke: "currentColor",
|
|
3815
|
+
"stroke-width": "2.4",
|
|
3816
|
+
"stroke-linecap": "round",
|
|
3817
|
+
"aria-hidden": "true"
|
|
3818
|
+
}, [c("path", { d: "M6 6l12 12M18 6L6 18" })], -1)]])) : o("", !0)
|
|
3819
|
+
], 10, Br));
|
|
3820
|
+
}
|
|
3821
|
+
}), Jr = { class: "m-toast-host" }, Yr = /* @__PURE__ */ d({
|
|
3822
|
+
__name: "ToastContainer",
|
|
3823
|
+
setup(t) {
|
|
3824
|
+
let n = [
|
|
3825
|
+
"top-left",
|
|
3826
|
+
"top-center",
|
|
3827
|
+
"top-right",
|
|
3828
|
+
"bottom-left",
|
|
3829
|
+
"bottom-center",
|
|
3830
|
+
"bottom-right"
|
|
3831
|
+
], o = i(() => {
|
|
3832
|
+
let e = /* @__PURE__ */ new Set();
|
|
3833
|
+
for (let t of Fr) e.add(t.position);
|
|
3834
|
+
return n.filter((t) => e.has(t));
|
|
3835
|
+
});
|
|
3836
|
+
function c(e) {
|
|
3837
|
+
return Fr.filter((t) => t.position === e);
|
|
3838
|
+
}
|
|
3839
|
+
function l(e) {
|
|
3840
|
+
let t = c(e);
|
|
3841
|
+
return { "--m-toast-offset": `${t.length ? t[0].offset : 16}px` };
|
|
3842
|
+
}
|
|
3843
|
+
return (t, n) => (v(), s("div", Jr, [(v(!0), s(e, null, C(o.value, (t) => (v(), s("div", {
|
|
3844
|
+
key: t,
|
|
3845
|
+
class: h(["m-toast-stack", `m-toast-stack--${t}`]),
|
|
3846
|
+
style: g(l(t))
|
|
3847
|
+
}, [u(r, { name: "m-toast" }, {
|
|
3848
|
+
default: A(() => [(v(!0), s(e, null, C(c(t), (e) => (v(), a(qr, {
|
|
3849
|
+
key: e.id,
|
|
3850
|
+
item: e,
|
|
3851
|
+
onClose: (t) => E(Rr)(e.id)
|
|
3852
|
+
}, null, 8, ["item", "onClose"]))), 128))]),
|
|
3853
|
+
_: 2
|
|
3854
|
+
}, 1024)], 6))), 128))]));
|
|
3855
|
+
}
|
|
3856
|
+
}), Xr = null, Zr = null;
|
|
3857
|
+
function Qr() {
|
|
3858
|
+
Xr && Zr || (Xr = document.createElement("div"), Xr.className = "m-toast-host-root", document.body.appendChild(Xr), Zr = u(Yr), S(Zr, Xr));
|
|
3859
|
+
}
|
|
3860
|
+
function $r(e, t = {}) {
|
|
3861
|
+
Qr(), Lr({
|
|
3862
|
+
message: e,
|
|
3863
|
+
title: t.title,
|
|
3864
|
+
type: t.type ?? "default",
|
|
3865
|
+
position: t.position ?? "top-right",
|
|
3866
|
+
duration: t.duration ?? 3e3,
|
|
3867
|
+
closable: t.closable ?? !1,
|
|
3868
|
+
offset: t.offset ?? 16
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
var ei = {
|
|
3872
|
+
show: $r,
|
|
3873
|
+
success: (e, t) => $r(e, {
|
|
3874
|
+
...t,
|
|
3875
|
+
type: "success"
|
|
3876
|
+
}),
|
|
3877
|
+
error: (e, t) => $r(e, {
|
|
3878
|
+
...t,
|
|
3879
|
+
type: "error"
|
|
3880
|
+
}),
|
|
3881
|
+
warning: (e, t) => $r(e, {
|
|
3882
|
+
...t,
|
|
3883
|
+
type: "warning"
|
|
3884
|
+
}),
|
|
3885
|
+
info: (e, t) => $r(e, {
|
|
3886
|
+
...t,
|
|
3887
|
+
type: "info"
|
|
3888
|
+
}),
|
|
3889
|
+
close: Rr,
|
|
3890
|
+
clearAll: zr
|
|
3891
|
+
}, ti = {
|
|
3892
|
+
placement: "top",
|
|
3893
|
+
trigger: "hover",
|
|
3894
|
+
disabled: !1,
|
|
3895
|
+
openDelay: 0,
|
|
3896
|
+
closeDelay: 0,
|
|
3897
|
+
arrow: !0,
|
|
3898
|
+
appendToBody: !0
|
|
3899
|
+
}, ni = 8, ri = /* @__PURE__ */ d({
|
|
3900
|
+
__name: "Tooltip",
|
|
3901
|
+
props: /*@__PURE__*/ p({
|
|
3902
|
+
content: {},
|
|
3903
|
+
placement: {},
|
|
3904
|
+
trigger: {},
|
|
3905
|
+
disabled: { type: Boolean },
|
|
3906
|
+
openDelay: {},
|
|
3907
|
+
closeDelay: {},
|
|
3908
|
+
arrow: { type: Boolean },
|
|
3909
|
+
modelValue: { type: Boolean },
|
|
3910
|
+
appendToBody: { type: Boolean }
|
|
3911
|
+
}, ti),
|
|
3912
|
+
emits: [
|
|
3913
|
+
"update:modelValue",
|
|
3914
|
+
"open",
|
|
3915
|
+
"close"
|
|
3916
|
+
],
|
|
3917
|
+
setup(r, { emit: d }) {
|
|
3918
|
+
let f = r, p = d, y = x(null), b = x(null), S = x(!!f.modelValue), C = x({
|
|
3919
|
+
top: 0,
|
|
3920
|
+
left: 0
|
|
3921
|
+
}), E = x("top");
|
|
3922
|
+
function D(e) {
|
|
3923
|
+
return e.split("-")[0];
|
|
3924
|
+
}
|
|
3925
|
+
function k(e) {
|
|
3926
|
+
return e.split("-")[1] ?? "center";
|
|
3927
|
+
}
|
|
3928
|
+
function j() {
|
|
3929
|
+
let e = y.value, t = b.value;
|
|
3930
|
+
if (!e || !t) return {
|
|
3931
|
+
top: 0,
|
|
3932
|
+
left: 0,
|
|
3933
|
+
side: "top"
|
|
3934
|
+
};
|
|
3935
|
+
let n = e.getBoundingClientRect(), r = t.offsetWidth, i = t.offsetHeight, a = window.innerWidth, o = window.innerHeight, s = D(f.placement), c = k(f.placement), l = 0, u = 0, d = s;
|
|
3936
|
+
return s === "top" ? l = n.top - i - ni : s === "bottom" ? l = n.bottom + ni : u = s === "left" ? n.left - r - ni : n.right + ni, s === "top" || s === "bottom" ? u = c === "start" ? n.left : c === "end" ? n.right - r : n.left + n.width / 2 - r / 2 : l = c === "start" ? n.top : c === "end" ? n.bottom - i : n.top + n.height / 2 - i / 2, s === "top" && l < 0 ? (l = n.bottom + ni, d = "bottom") : s === "bottom" && n.bottom + ni + i > o && (l = n.top - i - ni, d = "top"), s === "left" && u < 0 ? (u = n.right + ni, d = "right") : s === "right" && n.right + ni + r > a && (u = n.left - r - ni, d = "left"), u = Math.min(Math.max(0, u), Math.max(0, a - r)), l = Math.min(Math.max(0, l), Math.max(0, o - i)), {
|
|
3937
|
+
top: l,
|
|
3938
|
+
left: u,
|
|
3939
|
+
side: d
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3942
|
+
function M() {
|
|
3943
|
+
let e = j();
|
|
3944
|
+
C.value = {
|
|
3945
|
+
top: e.top,
|
|
3946
|
+
left: e.left
|
|
3947
|
+
}, E.value = e.side;
|
|
3948
|
+
}
|
|
3949
|
+
let N = null, P = null;
|
|
3950
|
+
function F() {
|
|
3951
|
+
N !== null && window.clearTimeout(N), P !== null && window.clearTimeout(P), N = null, P = null;
|
|
3952
|
+
}
|
|
3953
|
+
function I() {
|
|
3954
|
+
f.disabled || (F(), S.value ||= !0);
|
|
3955
|
+
}
|
|
3956
|
+
function L() {
|
|
3957
|
+
F(), S.value &&= !1;
|
|
3958
|
+
}
|
|
3959
|
+
function ee() {
|
|
3960
|
+
f.disabled || S.value || (f.openDelay > 0 ? N = window.setTimeout(I, f.openDelay) : I());
|
|
3961
|
+
}
|
|
3962
|
+
function R() {
|
|
3963
|
+
S.value && (f.closeDelay > 0 ? P = window.setTimeout(L, f.closeDelay) : L());
|
|
3964
|
+
}
|
|
3965
|
+
function z() {
|
|
3966
|
+
f.trigger === "hover" && ee();
|
|
3967
|
+
}
|
|
3968
|
+
function B() {
|
|
3969
|
+
f.trigger === "hover" && R();
|
|
3970
|
+
}
|
|
3971
|
+
function V() {
|
|
3972
|
+
f.trigger === "hover" && F();
|
|
3973
|
+
}
|
|
3974
|
+
function te() {
|
|
3975
|
+
f.trigger === "hover" && R();
|
|
3976
|
+
}
|
|
3977
|
+
function H() {
|
|
3978
|
+
f.trigger === "click" && (S.value ? L() : I());
|
|
3979
|
+
}
|
|
3980
|
+
function U() {
|
|
3981
|
+
f.trigger === "focus" && I();
|
|
3982
|
+
}
|
|
3983
|
+
function W() {
|
|
3984
|
+
f.trigger === "focus" && L();
|
|
3985
|
+
}
|
|
3986
|
+
function ne(e) {
|
|
3987
|
+
if (f.trigger !== "click") return;
|
|
3988
|
+
let t = e.target;
|
|
3989
|
+
!y.value?.contains(t) && !b.value?.contains(t) && L();
|
|
3990
|
+
}
|
|
3991
|
+
let G = null;
|
|
3992
|
+
function K() {
|
|
3993
|
+
G !== null && (cancelAnimationFrame(G), G = null);
|
|
3994
|
+
}
|
|
3995
|
+
function q() {
|
|
3996
|
+
G === null && (G = requestAnimationFrame(() => {
|
|
3997
|
+
if (G = null, !S.value) return;
|
|
3998
|
+
let e = y.value;
|
|
3999
|
+
if (!e) return;
|
|
4000
|
+
let t = e.getBoundingClientRect();
|
|
4001
|
+
t.bottom > 0 && t.top < window.innerHeight && t.right > 0 && t.left < window.innerWidth ? M() : L();
|
|
4002
|
+
}));
|
|
4003
|
+
}
|
|
4004
|
+
O(S, async (e) => {
|
|
4005
|
+
e ? (p("open"), document.addEventListener("pointerdown", ne), window.addEventListener("scroll", q, !0), window.addEventListener("resize", q), await m(), M()) : (p("close"), F(), K(), document.removeEventListener("pointerdown", ne), window.removeEventListener("scroll", q, !0), window.removeEventListener("resize", q));
|
|
4006
|
+
}), O(() => f.modelValue, (e) => {
|
|
4007
|
+
e && !S.value ? I() : !e && S.value && L();
|
|
4008
|
+
}), O(() => f.disabled, (e) => {
|
|
4009
|
+
e && S.value && L();
|
|
4010
|
+
}), O(() => f.placement, () => {
|
|
4011
|
+
S.value && m(M);
|
|
4012
|
+
}), _(() => {
|
|
4013
|
+
F(), K(), document.removeEventListener("pointerdown", ne), window.removeEventListener("scroll", q, !0), window.removeEventListener("resize", q);
|
|
4014
|
+
});
|
|
4015
|
+
let J = i(() => {
|
|
4016
|
+
switch (E.value) {
|
|
4017
|
+
case "top": return "50% 100%";
|
|
4018
|
+
case "bottom": return "50% 0%";
|
|
4019
|
+
case "left": return "100% 50%";
|
|
4020
|
+
case "right": return "0% 50%";
|
|
4021
|
+
}
|
|
4022
|
+
}), re = i(() => {
|
|
4023
|
+
switch (E.value) {
|
|
4024
|
+
case "top": return {
|
|
4025
|
+
"--m-tooltip-dx": "0px",
|
|
4026
|
+
"--m-tooltip-dy": "6px"
|
|
4027
|
+
};
|
|
4028
|
+
case "bottom": return {
|
|
4029
|
+
"--m-tooltip-dx": "0px",
|
|
4030
|
+
"--m-tooltip-dy": "-6px"
|
|
4031
|
+
};
|
|
4032
|
+
case "left": return {
|
|
4033
|
+
"--m-tooltip-dx": "6px",
|
|
4034
|
+
"--m-tooltip-dy": "0px"
|
|
4035
|
+
};
|
|
4036
|
+
case "right": return {
|
|
4037
|
+
"--m-tooltip-dx": "-6px",
|
|
4038
|
+
"--m-tooltip-dy": "0px"
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
return (i, d) => (v(), s(e, null, [c("span", {
|
|
4043
|
+
ref_key: "triggerRef",
|
|
4044
|
+
ref: y,
|
|
4045
|
+
class: "m-tooltip__trigger",
|
|
4046
|
+
onMouseenter: z,
|
|
4047
|
+
onMouseleave: B,
|
|
4048
|
+
onClick: H,
|
|
4049
|
+
onFocusin: U,
|
|
4050
|
+
onFocusout: W
|
|
4051
|
+
}, [w(i.$slots, "default")], 544), (v(), a(t, {
|
|
4052
|
+
to: "body",
|
|
4053
|
+
disabled: !r.appendToBody
|
|
4054
|
+
}, [u(n, { name: "m-tooltip" }, {
|
|
4055
|
+
default: A(() => [S.value ? (v(), s("div", {
|
|
4056
|
+
key: 0,
|
|
4057
|
+
ref_key: "tooltipRef",
|
|
4058
|
+
ref: b,
|
|
4059
|
+
class: h(["m-tooltip", [`m-tooltip--${E.value}`, r.arrow && "m-tooltip--arrow"]]),
|
|
4060
|
+
style: g({
|
|
4061
|
+
top: C.value.top + "px",
|
|
4062
|
+
left: C.value.left + "px",
|
|
4063
|
+
transformOrigin: J.value,
|
|
4064
|
+
...re.value
|
|
4065
|
+
}),
|
|
4066
|
+
role: "tooltip",
|
|
4067
|
+
onMouseenter: V,
|
|
4068
|
+
onMouseleave: te
|
|
4069
|
+
}, [w(i.$slots, "content", {}, () => [l(T(r.content), 1)])], 38)) : o("", !0)]),
|
|
4070
|
+
_: 3
|
|
4071
|
+
})], 8, ["disabled"]))], 64));
|
|
4072
|
+
}
|
|
4073
|
+
}), ii = {
|
|
4074
|
+
MAlert: z,
|
|
4075
|
+
MAvatar: W,
|
|
4076
|
+
MButton: ve,
|
|
4077
|
+
MButtonGroup: ye,
|
|
4078
|
+
MCheckbox: Ee,
|
|
4079
|
+
MCheckboxGroup: De,
|
|
4080
|
+
MDatePicker: St,
|
|
4081
|
+
MDateRangePicker: Zt,
|
|
4082
|
+
MDialog: an,
|
|
4083
|
+
MDrawer: dn,
|
|
4084
|
+
MDropdown: vn,
|
|
4085
|
+
MDropdownItem: Sn,
|
|
4086
|
+
MFab: Dn,
|
|
4087
|
+
MInput: Mn,
|
|
4088
|
+
MInputNumber: Bn,
|
|
4089
|
+
MRadio: qn,
|
|
4090
|
+
MRadioGroup: Jn,
|
|
4091
|
+
MSelect: rr,
|
|
4092
|
+
MSlider: sr,
|
|
4093
|
+
MSwitch: mr,
|
|
4094
|
+
MTabs: Cr,
|
|
4095
|
+
MTabPane: Tr,
|
|
4096
|
+
MToast: Pr,
|
|
4097
|
+
MTooltip: ri
|
|
4098
|
+
}, ai = { install(e) {
|
|
4099
|
+
for (let [t, n] of Object.entries(ii)) e.component(t, n);
|
|
4100
|
+
e.directive("ripple", Q);
|
|
4101
|
+
} };
|
|
4102
|
+
//#endregion
|
|
4103
|
+
export { z as MAlert, W as MAvatar, ve as MButton, ye as MButtonGroup, Ee as MCheckbox, De as MCheckboxGroup, St as MDatePicker, Zt as MDateRangePicker, an as MDialog, dn as MDrawer, vn as MDropdown, Sn as MDropdownItem, Dn as MFab, Mn as MInput, Bn as MInputNumber, qn as MRadio, Jn as MRadioGroup, rr as MSelect, sr as MSlider, mr as MSwitch, Tr as MTabPane, Cr as MTabs, Pr as MToast, ri as MTooltip, ai as MiaoUI, ai as default, Ae as formatDate, $ as parseDate, $r as showToast, ei as toast, Fr as toastItems, Q as vRipple };
|