@vavt/react-ui 1.0.0 → 1.0.2
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 +50 -2
- package/dist/Card-BkZhLXQ5.cjs +1 -0
- package/dist/{Card-DlztNV-6.js → Card-DCLfLn1x.js} +13 -12
- package/dist/Cron-3D9GmlYf.cjs +1 -0
- package/dist/{Cron-Di7k2FTL.js → Cron-Go4yIqrd.js} +361 -353
- package/dist/{DatePicker-M-MwejjV.js → DatePicker-B-F5q_s_.js} +1 -1
- package/dist/{DatePicker-DAxv2h-d.cjs → DatePicker-CoHW85qm.cjs} +1 -1
- package/dist/{DateTimePicker-BcT3FtN-.js → DateTimePicker-BSBZZ7xV.js} +1 -1
- package/dist/{DateTimePicker-B3C3v99L.cjs → DateTimePicker-CAkdoY--.cjs} +1 -1
- package/dist/Divider-BXNZyvHY.js +48 -0
- package/dist/Divider-BnmUNmy2.cjs +1 -0
- package/dist/Drawer-C0toQ-fQ.js +112 -0
- package/dist/Drawer-D45miZ27.cjs +1 -0
- package/dist/Dropdown-BsXYVdt6.cjs +1 -0
- package/dist/Dropdown-DljKFnvO.js +319 -0
- package/dist/Empty-Dny96c3p.cjs +1 -0
- package/dist/Empty-MmxZitR8.js +40 -0
- package/dist/{MessageBox-CrIifoig.js → MessageBox-B4Qo1vs2.js} +1 -1
- package/dist/{MessageBox-Ddn-R2MS.cjs → MessageBox-CTJfdU29.cjs} +1 -1
- package/dist/Modal-i_Do8GsG.cjs +1 -0
- package/dist/Modal-otJ_9ldu.js +210 -0
- package/dist/{Pagination-B7a9v6BU.js → Pagination-CSI5IzQB.js} +32 -33
- package/dist/Pagination-ODU-i3gn.cjs +1 -0
- package/dist/Select-BRKxpX-_.cjs +1 -0
- package/dist/Select-QedbJ4pD.js +468 -0
- package/dist/{Table-C8cSyts5.js → Table-B9NTkptC.js} +1 -1
- package/dist/{Table-JoJ9vpu-.cjs → Table-Bqjey5fw.cjs} +1 -1
- package/dist/TimePicker-CHZsr_jj.js +207 -0
- package/dist/TimePicker-Cpmvn8tx.cjs +1 -0
- package/dist/Tooltip-Buk5F9f_.js +205 -0
- package/dist/Tooltip-CP8rpNYG.cjs +1 -0
- package/dist/Upload-DZC_bt6G.js +183 -0
- package/dist/Upload-bxJz2avf.cjs +1 -0
- package/dist/base.css +1 -1
- package/dist/cjs/Card.cjs +1 -1
- package/dist/cjs/Cron.cjs +1 -1
- package/dist/cjs/DatePicker.cjs +1 -1
- package/dist/cjs/DateTimePicker.cjs +1 -1
- package/dist/cjs/Divider.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Empty.cjs +1 -0
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Table.cjs +1 -1
- package/dist/cjs/TimePicker.cjs +1 -1
- package/dist/cjs/Tooltip.cjs +1 -1
- package/dist/cjs/Upload.cjs +1 -0
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/content-DCGQZQp8.cjs +1 -0
- package/dist/content-Dllrr-7G.js +11 -0
- package/dist/css/Button.css +1 -1
- package/dist/css/DateTimePicker.css +1 -1
- package/dist/css/Empty.css +1 -0
- package/dist/css/Pagination.css +1 -1
- package/dist/css/Upload.css +1 -0
- package/dist/date-picker-BsiNrLZC.js +592 -0
- package/dist/date-picker-DNN0BiRA.cjs +1 -0
- package/dist/es/Card.mjs +1 -1
- package/dist/es/Cron.mjs +1 -1
- package/dist/es/DatePicker.mjs +1 -1
- package/dist/es/DateTimePicker.mjs +1 -1
- package/dist/es/Divider.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Empty.mjs +3 -0
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Select.mjs +1 -1
- package/dist/es/Table.mjs +1 -1
- package/dist/es/TimePicker.mjs +1 -1
- package/dist/es/Tooltip.mjs +1 -1
- package/dist/es/Upload.mjs +3 -0
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +31 -29
- package/dist/es/register.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/layer-BgiUZy_t.cjs +1 -0
- package/dist/layer-DDm97-sb.js +53 -0
- package/dist/registry-BGNWNSiC.cjs +1 -0
- package/dist/registry-q6UdMOyj.js +83 -0
- package/dist/style/Empty.cjs +7 -0
- package/dist/style/Empty.mjs +7 -0
- package/dist/style/Pagination.cjs +1 -0
- package/dist/style/Pagination.mjs +1 -0
- package/dist/style/Upload.cjs +7 -0
- package/dist/style/Upload.mjs +7 -0
- package/dist/types/Cron/type.d.cts +2 -0
- package/dist/types/Cron/type.d.ts +2 -0
- package/dist/types/DatePicker/type.d.cts +2 -0
- package/dist/types/DatePicker/type.d.ts +2 -0
- package/dist/types/Dropdown/type.d.cts +2 -0
- package/dist/types/Dropdown/type.d.ts +2 -0
- package/dist/types/Empty/Empty.d.cts +3 -0
- package/dist/types/Empty/Empty.d.ts +3 -0
- package/dist/types/Empty/index.d.cts +5 -0
- package/dist/types/Empty/index.d.ts +5 -0
- package/dist/types/Empty/type.d.cts +24 -0
- package/dist/types/Empty/type.d.ts +24 -0
- package/dist/types/Select/type.d.cts +2 -0
- package/dist/types/Select/type.d.ts +2 -0
- package/dist/types/TimePicker/type.d.cts +2 -0
- package/dist/types/TimePicker/type.d.ts +2 -0
- package/dist/types/Tooltip/type.d.cts +2 -0
- package/dist/types/Tooltip/type.d.ts +2 -0
- package/dist/types/Upload/Upload.d.cts +3 -0
- package/dist/types/Upload/Upload.d.ts +3 -0
- package/dist/types/Upload/index.d.cts +5 -0
- package/dist/types/Upload/index.d.ts +5 -0
- package/dist/types/Upload/type.d.cts +62 -0
- package/dist/types/Upload/type.d.ts +62 -0
- package/dist/types/_shared/content.d.cts +13 -0
- package/dist/types/_shared/content.d.ts +13 -0
- package/dist/types/_shared/layer.d.cts +63 -0
- package/dist/types/_shared/layer.d.ts +63 -0
- package/dist/types/global.d.cts +4 -0
- package/dist/types/global.d.ts +4 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/registry.d.cts +2 -0
- package/dist/types/registry.d.ts +2 -0
- package/package.json +2 -4
- package/dist/Card-nILlh9c_.cjs +0 -1
- package/dist/Cron-CoO2Vnnm.cjs +0 -1
- package/dist/Divider-BfvQ6BVP.cjs +0 -1
- package/dist/Divider-vyftxh3F.js +0 -47
- package/dist/Drawer-D28QbyA3.js +0 -103
- package/dist/Drawer-OmMfdgKN.cjs +0 -1
- package/dist/Dropdown-CYx6RxVv.js +0 -311
- package/dist/Dropdown-swfND4yK.cjs +0 -1
- package/dist/Modal-B_VqN16m.js +0 -201
- package/dist/Modal-Dm48HmGu.cjs +0 -1
- package/dist/Pagination-mj-pO6ql.cjs +0 -1
- package/dist/Select-DQLup8Y-.cjs +0 -1
- package/dist/Select-DccM9YpB.js +0 -458
- package/dist/TimePicker-ClQCHa6M.js +0 -199
- package/dist/TimePicker-DNBo2Rn5.cjs +0 -1
- package/dist/Tooltip-CbPYYr6R.cjs +0 -1
- package/dist/Tooltip-Ds4Odm7K.js +0 -197
- package/dist/date-picker-DkRwNu2m.js +0 -584
- package/dist/date-picker-DyGLrw5H.cjs +0 -1
- package/dist/registry-CkiH1x-J.js +0 -79
- package/dist/registry-YCz7D-2R.cjs +0 -1
|
@@ -1,584 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./effect-nifYL_rH.js";
|
|
2
|
-
import { n as t, t as n } from "./state-oH-YwB7_.js";
|
|
3
|
-
import { t as r } from "./client-pj_wzx28.js";
|
|
4
|
-
import { n as i } from "./refs-D5IYOBaf.js";
|
|
5
|
-
import { r as ee, t as a } from "./floating-DBAmeQIq.js";
|
|
6
|
-
import { t as o } from "./id-CHixuHb7.js";
|
|
7
|
-
import { t as te } from "./Transition-DiO4GsP3.js";
|
|
8
|
-
import { t as ne } from "./Input-CIB_TY2n.js";
|
|
9
|
-
import { _ as re, a as ie, b as ae, c as s, d as c, f as oe, g as l, h as se, i as ce, l as u, m as d, n as le, p as f, r as ue, s as p, t as de, u as m, y as fe } from "./time-wheel-BtvYZI6H.js";
|
|
10
|
-
import { t as pe } from "./Dropdown-CYx6RxVv.js";
|
|
11
|
-
import { CalendarDays as me, ChevronLeft as he, ChevronRight as ge, ChevronsLeft as _e, ChevronsRight as ve, Clock3 as ye, X as be } from "lucide-react";
|
|
12
|
-
import { forwardRef as xe, useCallback as h, useEffect as Se, useMemo as Ce, useRef as we, useState as g } from "react";
|
|
13
|
-
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
|
-
import { createPortal as Te } from "react-dom";
|
|
15
|
-
//#region components/_shared/date-picker.tsx
|
|
16
|
-
var y = "data-vl-date-picker-popup-owner", Ee = [
|
|
17
|
-
"日",
|
|
18
|
-
"一",
|
|
19
|
-
"二",
|
|
20
|
-
"三",
|
|
21
|
-
"四",
|
|
22
|
-
"五",
|
|
23
|
-
"六"
|
|
24
|
-
], b = [
|
|
25
|
-
"一月",
|
|
26
|
-
"二月",
|
|
27
|
-
"三月",
|
|
28
|
-
"四月",
|
|
29
|
-
"五月",
|
|
30
|
-
"六月",
|
|
31
|
-
"七月",
|
|
32
|
-
"八月",
|
|
33
|
-
"九月",
|
|
34
|
-
"十月",
|
|
35
|
-
"十一月",
|
|
36
|
-
"十二月"
|
|
37
|
-
], x = (e) => Array.isArray(e) && e.length === 2, S = (e, t) => ae(e, t), De = (e, t) => {
|
|
38
|
-
if (x(e)) {
|
|
39
|
-
let n = S(e[0], t), r = S(e[1], t);
|
|
40
|
-
return n && r ? `${c(n, t)} ~ ${c(r, t)}` : "";
|
|
41
|
-
}
|
|
42
|
-
let n = S(e, t);
|
|
43
|
-
return n ? c(n, t) : "";
|
|
44
|
-
}, Oe = (e) => [e[0] ? u(e[0]) : null, e[1] ? u(e[1]) : null], ke = (e) => `${e.getFullYear()}年 ${b[e.getMonth()]}`, Ae = (e, t) => t ? u(e) : l(e), je = (e, t, n) => {
|
|
45
|
-
let r = (e) => {
|
|
46
|
-
let t = S(e, n);
|
|
47
|
-
return t ? t.getTime() : null;
|
|
48
|
-
};
|
|
49
|
-
return x(e) || x(t) ? !x(e) || !x(t) ? !1 : r(e[0]) === r(t[0]) && r(e[1]) === r(t[1]) : r(e) === r(t);
|
|
50
|
-
}, C = xe((ae, xe) => {
|
|
51
|
-
let { componentName: b, withTime: C = !1, value: Me, defaultValue: Ne, valueType: Pe = "date", format: w = C ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD", range: T = !1, shortcuts: Fe = [], minDate: Ie, maxDate: Le, disabledDate: Re, minTime: ze, maxTime: Be, disabledTime: Ve, placeholder: He = T ? "请选择日期范围" : C ? "请选择日期时间" : "请选择日期", disabled: E = !1, clearable: Ue = !1, size: We = "md", placement: D = "bottom-start", offset: Ge = 8, className: Ke, style: qe, id: Je, "aria-label": Ye, "aria-labelledby": Xe, "aria-describedby": Ze, onChange: Qe, onClear: $e, onOpen: et, onClose: tt, ...nt } = ae, O = Qe, rt = we(null), k = we(null), A = we(null), it = we(null), at = r(), ot = n(ae, "value"), [j, M] = t({
|
|
52
|
-
value: Me ?? null,
|
|
53
|
-
defaultValue: Ne ?? null,
|
|
54
|
-
controlled: ot
|
|
55
|
-
}), [N, st] = g(!1), [ct, P] = g(() => {
|
|
56
|
-
let e = x(j) ? S(j[0], w) : S(j, w);
|
|
57
|
-
return re(e ?? /* @__PURE__ */ new Date());
|
|
58
|
-
}), [F, lt] = g(null), [I, L] = g([null, null]), [R, z] = g("start"), [ut, dt] = g(!1), [B, ft] = g(null), [pt, mt] = g({}), [ht, gt] = g(D), [_t, vt] = g(!1), [yt, V] = g(null), bt = o(`vl-${b}-control`, Je), H = o(`vl-${b}-panel`), xt = Ce(() => i(rt, xe), [xe]), U = h(() => {
|
|
59
|
-
dt(!1), ft(null);
|
|
60
|
-
}, []), St = Ce(() => T ? x(j) ? [S(j[0], w), S(j[1], w)] : [null, null] : Array.isArray(j) ? null : S(j, w), [
|
|
61
|
-
w,
|
|
62
|
-
T,
|
|
63
|
-
j
|
|
64
|
-
]), Ct = T ? St : null, W = T ? null : St, wt = De(j, w), Tt = ct, Et = s(ct, 1), G = S(Ie, w), K = S(Le, w), Dt = ze ? fe(ze) : null, Ot = Be ? fe(Be) : null, kt = Ce(() => ({
|
|
65
|
-
minSeconds: Dt,
|
|
66
|
-
maxSeconds: Ot,
|
|
67
|
-
disabledTime: Ve
|
|
68
|
-
}), [
|
|
69
|
-
Ve,
|
|
70
|
-
Ot,
|
|
71
|
-
Dt
|
|
72
|
-
]), q = h((e) => {
|
|
73
|
-
let t = l(e);
|
|
74
|
-
return !!(G && m(t, l(G)) < 0 || K && m(t, l(K)) > 0 || Re?.(t));
|
|
75
|
-
}, [
|
|
76
|
-
Re,
|
|
77
|
-
K,
|
|
78
|
-
G
|
|
79
|
-
]), J = h((e) => ce(e, kt), [kt]), At = h((e, t, n) => le(e, t, n, kt), [kt]), jt = h((e) => C && J(c(e, "HH:mm:ss")), [J, C]), Y = h((e) => {
|
|
80
|
-
if (!(e && (E || N)) && !(!e && !N)) {
|
|
81
|
-
if (e) {
|
|
82
|
-
let e = (T ? Ct?.[0] : W) ?? /* @__PURE__ */ new Date();
|
|
83
|
-
P(re(e)), T ? L(Oe(Ct ?? [null, null])) : lt(W ? u(W) : null), z("start"), vt(!1), mt({}), gt(D), V(null), U(), st(!0), et?.();
|
|
84
|
-
} else V(null), U(), st(!1), tt?.();
|
|
85
|
-
}
|
|
86
|
-
}, [
|
|
87
|
-
E,
|
|
88
|
-
tt,
|
|
89
|
-
et,
|
|
90
|
-
N,
|
|
91
|
-
D,
|
|
92
|
-
T,
|
|
93
|
-
U,
|
|
94
|
-
W,
|
|
95
|
-
Ct
|
|
96
|
-
]), Mt = h(() => {
|
|
97
|
-
if (!N || !k.current || !A.current) return;
|
|
98
|
-
let e = k.current.getBoundingClientRect(), t = a({
|
|
99
|
-
anchorRect: e,
|
|
100
|
-
floatingRect: A.current.getBoundingClientRect(),
|
|
101
|
-
placement: D,
|
|
102
|
-
offset: Ge
|
|
103
|
-
});
|
|
104
|
-
gt(t.placement), mt({
|
|
105
|
-
left: `${Math.round(t.x)}px`,
|
|
106
|
-
top: `${Math.round(t.y)}px`
|
|
107
|
-
}), vt(!0);
|
|
108
|
-
}, [
|
|
109
|
-
Ge,
|
|
110
|
-
N,
|
|
111
|
-
D
|
|
112
|
-
]);
|
|
113
|
-
e(() => {
|
|
114
|
-
if (!N || !at) return;
|
|
115
|
-
Mt();
|
|
116
|
-
let e = window.requestAnimationFrame(Mt);
|
|
117
|
-
return () => window.cancelAnimationFrame(e);
|
|
118
|
-
}, [
|
|
119
|
-
at,
|
|
120
|
-
N,
|
|
121
|
-
Mt
|
|
122
|
-
]), e(() => {
|
|
123
|
-
if (!N || !yt) return;
|
|
124
|
-
let e = A.current?.querySelector(`[data-time="${yt.getTime()}"]:not(:disabled)`);
|
|
125
|
-
e && (e.focus(), V(null));
|
|
126
|
-
}, [
|
|
127
|
-
ct,
|
|
128
|
-
yt,
|
|
129
|
-
N
|
|
130
|
-
]);
|
|
131
|
-
let Nt = h((e) => e.some((e) => e instanceof HTMLElement && (e.getAttribute(y) === H || e.classList.contains("vl-dropdown__panel") && e.querySelector(`[${y}]`)?.getAttribute(y) === H)), [H]), Pt = h(() => Y(!1), [Y]), Ft = h(() => {
|
|
132
|
-
ut || (Y(!1), k.current?.focus());
|
|
133
|
-
}, [Y, ut]);
|
|
134
|
-
ee({
|
|
135
|
-
active: N,
|
|
136
|
-
rootRef: rt,
|
|
137
|
-
floatingRef: A,
|
|
138
|
-
isOwnedPopup: Nt,
|
|
139
|
-
onOutsideClick: Pt,
|
|
140
|
-
onEscape: Ft,
|
|
141
|
-
onViewportChange: Mt
|
|
142
|
-
}), Se(() => {
|
|
143
|
-
E && N && Y(!1);
|
|
144
|
-
}, [
|
|
145
|
-
E,
|
|
146
|
-
N,
|
|
147
|
-
Y
|
|
148
|
-
]);
|
|
149
|
-
let X = h((e) => Pe === "string" ? c(e, w) : u(e), [w, Pe]), It = h((e) => {
|
|
150
|
-
let t = Ae(e, C);
|
|
151
|
-
if (q(t) || C && J(c(t, "HH:mm:ss"))) return;
|
|
152
|
-
let n = X(t);
|
|
153
|
-
je(j, n, w) || (M(n), O?.(n)), Y(!1), k.current?.focus();
|
|
154
|
-
}, [
|
|
155
|
-
O,
|
|
156
|
-
w,
|
|
157
|
-
q,
|
|
158
|
-
J,
|
|
159
|
-
X,
|
|
160
|
-
j,
|
|
161
|
-
Y,
|
|
162
|
-
M,
|
|
163
|
-
C
|
|
164
|
-
]), Lt = h((e) => {
|
|
165
|
-
if (!e[0] || !e[1]) return;
|
|
166
|
-
let t = m(e[0], e[1]) <= 0 ? e : [e[1], e[0]], n = Ae(t[0], C), r = Ae(t[1], C);
|
|
167
|
-
if (q(n) || q(r) || C && (J(c(n, "HH:mm:ss")) || J(c(r, "HH:mm:ss")))) return;
|
|
168
|
-
let i = [X(n), X(r)];
|
|
169
|
-
je(j, i, w) || (M(i), O?.(i)), Y(!1), k.current?.focus();
|
|
170
|
-
}, [
|
|
171
|
-
O,
|
|
172
|
-
w,
|
|
173
|
-
q,
|
|
174
|
-
J,
|
|
175
|
-
X,
|
|
176
|
-
j,
|
|
177
|
-
Y,
|
|
178
|
-
M,
|
|
179
|
-
C
|
|
180
|
-
]), Rt = (e) => {
|
|
181
|
-
if (q(e)) return;
|
|
182
|
-
let t = T ? I[R === "start" ? 0 : 1] : F, n = l(e);
|
|
183
|
-
if (C) {
|
|
184
|
-
if (t) n = se(e, t.getHours(), t.getMinutes(), t.getSeconds());
|
|
185
|
-
else {
|
|
186
|
-
let t = At(0, 86399, 0);
|
|
187
|
-
n = t === null ? u(e) : se(e, Math.floor(t / 3600), Math.floor(t % 3600 / 60), t % 60);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (!T) {
|
|
191
|
-
lt(n), C || It(n);
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
let [r, i] = I;
|
|
195
|
-
if (!r || i) {
|
|
196
|
-
L([n, null]), z("start");
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
m(n, r) < 0 ? (L([n, r]), z("end")) : (L([r, n]), z("end"));
|
|
200
|
-
}, Z = h((e, t = !1) => {
|
|
201
|
-
if (e && B) {
|
|
202
|
-
if (T) {
|
|
203
|
-
let e = Oe(I);
|
|
204
|
-
e[R === "start" ? 0 : 1] = u(B), L(e);
|
|
205
|
-
} else lt(u(B));
|
|
206
|
-
}
|
|
207
|
-
U(), t && window.requestAnimationFrame(() => it.current?.focus());
|
|
208
|
-
}, [
|
|
209
|
-
R,
|
|
210
|
-
I,
|
|
211
|
-
T,
|
|
212
|
-
U,
|
|
213
|
-
B
|
|
214
|
-
]), zt = (e, t) => {
|
|
215
|
-
let n = B ? u(B) : /* @__PURE__ */ new Date(), r = {
|
|
216
|
-
hours: n.getHours(),
|
|
217
|
-
minutes: n.getMinutes(),
|
|
218
|
-
seconds: n.getSeconds()
|
|
219
|
-
}, { start: i, end: ee, preferred: a } = ue(e, t, r), o = At(i, ee, a);
|
|
220
|
-
if (o === null) return;
|
|
221
|
-
let te = se(n, Math.floor(o / 3600), Math.floor(o % 3600 / 60), o % 60);
|
|
222
|
-
ft(te);
|
|
223
|
-
}, Bt = (e) => {
|
|
224
|
-
let t = e.getValue(/* @__PURE__ */ new Date());
|
|
225
|
-
if (t === null) return;
|
|
226
|
-
if (T) {
|
|
227
|
-
if (!x(t)) return;
|
|
228
|
-
let e = S(t[0], w), n = S(t[1], w);
|
|
229
|
-
if (!e || !n || q(e) || q(n) || jt(e) || jt(n)) return;
|
|
230
|
-
L(m(e, n) <= 0 ? [e, n] : [n, e]), z("end");
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (x(t)) return;
|
|
234
|
-
let n = S(t, w);
|
|
235
|
-
!n || q(n) || jt(n) || It(n);
|
|
236
|
-
}, Vt = (e) => {
|
|
237
|
-
e?.stopPropagation(), !E && (M(null), O?.(null), $e?.(), lt(null), L([null, null]));
|
|
238
|
-
}, Q = (e, t, n = !1) => {
|
|
239
|
-
let r = n ? l(e) : p(l(e), t);
|
|
240
|
-
for (let e = 0; e < 3660; e += 1) {
|
|
241
|
-
if (t < 0 && G && m(r, l(G)) < 0 || t > 0 && K && m(r, l(K)) > 0) return null;
|
|
242
|
-
if (!q(r)) return r;
|
|
243
|
-
r = p(r, t);
|
|
244
|
-
}
|
|
245
|
-
return null;
|
|
246
|
-
}, Ht = (e) => {
|
|
247
|
-
if (!E) {
|
|
248
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
249
|
-
if (e.preventDefault(), N) Y(!1);
|
|
250
|
-
else {
|
|
251
|
-
let e = (T ? Ct?.[0] : W) ?? /* @__PURE__ */ new Date(), t = Q(e, 1, !0) ?? Q(e, -1, !0) ?? null;
|
|
252
|
-
Y(!0), t && V(t);
|
|
253
|
-
}
|
|
254
|
-
} else e.key === "Escape" && N && (e.preventDefault(), Y(!1));
|
|
255
|
-
}
|
|
256
|
-
}, Ut = (e) => {
|
|
257
|
-
!d(e, Tt) && !(T && d(e, Et)) && P(re(e)), V(l(e));
|
|
258
|
-
}, Wt = (e, t) => {
|
|
259
|
-
let n = null;
|
|
260
|
-
if (e.key === "ArrowLeft") n = Q(t, -1);
|
|
261
|
-
else if (e.key === "ArrowRight") n = Q(t, 1);
|
|
262
|
-
else if (e.key === "ArrowUp") n = Q(t, -7);
|
|
263
|
-
else if (e.key === "ArrowDown") n = Q(t, 7);
|
|
264
|
-
else if (e.key === "Home" || e.key === "End") {
|
|
265
|
-
let r = e.key === "Home" ? p(t, -t.getDay()) : p(t, 6 - t.getDay()), i = e.key === "Home" ? 1 : -1;
|
|
266
|
-
for (let e = 0; e < 7; e += 1) {
|
|
267
|
-
let t = p(r, e * i);
|
|
268
|
-
if (!q(t)) {
|
|
269
|
-
n = t;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
n && (e.preventDefault(), Ut(n));
|
|
275
|
-
}, $ = T ? I[R === "start" ? 0 : 1] : F, Gt = h((e) => {
|
|
276
|
-
if (e) {
|
|
277
|
-
if (!$) return;
|
|
278
|
-
ft(u($)), dt(!0);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
Z(!1);
|
|
282
|
-
}, [$, Z]), Kt = B ?? $ ?? /* @__PURE__ */ new Date(), qt = Kt.getHours(), Jt = Kt.getMinutes(), Yt = Kt.getSeconds(), Xt = $ ? c(Kt, "HH:mm:ss") : "", Zt = T ? R === "start" ? "开始时间" : "结束时间" : "时间", Qt = h((e, t) => ie(e, t, {
|
|
283
|
-
hours: qt,
|
|
284
|
-
minutes: Jt,
|
|
285
|
-
seconds: Yt
|
|
286
|
-
}, At), [
|
|
287
|
-
At,
|
|
288
|
-
qt,
|
|
289
|
-
Jt,
|
|
290
|
-
Yt
|
|
291
|
-
]), $t = T ? !!(I[0] && I[1] && !q(I[0]) && !q(I[1]) && (!C || !J(c(I[0], "HH:mm:ss")) && !J(c(I[1], "HH:mm:ss")))) : !!(F && !q(F) && (!C || !J(c(F, "HH:mm:ss")))), en = !!wt, tn = [
|
|
292
|
-
`vl-${b}`,
|
|
293
|
-
`size-${We}`,
|
|
294
|
-
N ? "is-open" : "",
|
|
295
|
-
E ? "is-disabled" : "",
|
|
296
|
-
T ? "is-range" : "",
|
|
297
|
-
C ? "has-time" : "",
|
|
298
|
-
Ke || ""
|
|
299
|
-
].filter(Boolean).join(" "), nn = (e) => {
|
|
300
|
-
let t = oe(e), n = T ? I[0] : null, r = T ? I[1] : null, i = T ? null : F ?? W, ee = (T ? [I[0], I[1]] : [i]).find((t) => t && d(t, e) && !q(t)) ?? t.find((t) => d(t, e) && !q(t));
|
|
301
|
-
return /* @__PURE__ */ v("section", {
|
|
302
|
-
className: `vl-${b}__calendar`,
|
|
303
|
-
"aria-label": ke(e),
|
|
304
|
-
children: [
|
|
305
|
-
T ? /* @__PURE__ */ _("div", {
|
|
306
|
-
className: `vl-${b}__month-title`,
|
|
307
|
-
children: ke(e)
|
|
308
|
-
}) : null,
|
|
309
|
-
/* @__PURE__ */ _("div", {
|
|
310
|
-
className: `vl-${b}__weekdays`,
|
|
311
|
-
role: "row",
|
|
312
|
-
children: Ee.map((e) => /* @__PURE__ */ _("span", {
|
|
313
|
-
role: "columnheader",
|
|
314
|
-
children: e
|
|
315
|
-
}, e))
|
|
316
|
-
}),
|
|
317
|
-
/* @__PURE__ */ _("div", {
|
|
318
|
-
className: `vl-${b}__grid`,
|
|
319
|
-
role: "grid",
|
|
320
|
-
children: t.map((t) => {
|
|
321
|
-
let a = !d(t, e), o = a || q(t), te = !!(n && r && m(t, l(n)) >= 0 && m(t, l(r)) <= 0), ne = [
|
|
322
|
-
`vl-${b}__day`,
|
|
323
|
-
a ? "is-other-month" : "",
|
|
324
|
-
f(t, /* @__PURE__ */ new Date()) ? "is-today" : "",
|
|
325
|
-
T && n && f(t, n) ? "is-range-start is-selected" : "",
|
|
326
|
-
T && r && f(t, r) ? "is-range-end is-selected" : "",
|
|
327
|
-
i && f(t, i) ? "is-selected" : "",
|
|
328
|
-
te ? "is-in-range" : "",
|
|
329
|
-
o ? "is-disabled" : ""
|
|
330
|
-
].filter(Boolean).join(" ");
|
|
331
|
-
return /* @__PURE__ */ _("button", {
|
|
332
|
-
type: "button",
|
|
333
|
-
className: ne,
|
|
334
|
-
role: "gridcell",
|
|
335
|
-
"data-time": t.getTime(),
|
|
336
|
-
"aria-label": `${t.getFullYear()}年${t.getMonth() + 1}月${t.getDate()}日`,
|
|
337
|
-
"aria-selected": T ? te : !!(i && f(t, i)),
|
|
338
|
-
"aria-current": f(t, /* @__PURE__ */ new Date()) ? "date" : void 0,
|
|
339
|
-
"aria-hidden": a || void 0,
|
|
340
|
-
"aria-disabled": o || void 0,
|
|
341
|
-
disabled: o,
|
|
342
|
-
tabIndex: !o && ee && f(t, ee) ? 0 : -1,
|
|
343
|
-
onClick: () => Rt(t),
|
|
344
|
-
onKeyDown: (e) => Wt(e, t),
|
|
345
|
-
children: t.getDate()
|
|
346
|
-
}, t.toISOString());
|
|
347
|
-
})
|
|
348
|
-
})
|
|
349
|
-
]
|
|
350
|
-
});
|
|
351
|
-
}, rn = /* @__PURE__ */ _(te, {
|
|
352
|
-
show: N,
|
|
353
|
-
name: `vl-${b}`,
|
|
354
|
-
deferEffects: !at,
|
|
355
|
-
children: /* @__PURE__ */ v("div", {
|
|
356
|
-
ref: A,
|
|
357
|
-
id: H,
|
|
358
|
-
className: `vl-${b}__panel is-${ht}${_t ? " is-positioned" : ""}`,
|
|
359
|
-
style: {
|
|
360
|
-
...pt,
|
|
361
|
-
visibility: _t ? "visible" : "hidden"
|
|
362
|
-
},
|
|
363
|
-
role: "dialog",
|
|
364
|
-
"aria-label": T ? "日期范围选择" : C ? "日期时间选择" : "日期选择",
|
|
365
|
-
children: [
|
|
366
|
-
/* @__PURE__ */ v("div", {
|
|
367
|
-
className: `vl-${b}__header`,
|
|
368
|
-
children: [
|
|
369
|
-
/* @__PURE__ */ v("div", {
|
|
370
|
-
className: `vl-${b}__header-actions`,
|
|
371
|
-
children: [/* @__PURE__ */ _("button", {
|
|
372
|
-
type: "button",
|
|
373
|
-
"aria-label": "上一年",
|
|
374
|
-
onClick: () => P((e) => s(e, -12)),
|
|
375
|
-
children: /* @__PURE__ */ _(_e, {
|
|
376
|
-
size: 16,
|
|
377
|
-
"aria-hidden": "true"
|
|
378
|
-
})
|
|
379
|
-
}), /* @__PURE__ */ _("button", {
|
|
380
|
-
type: "button",
|
|
381
|
-
"aria-label": "上一个月",
|
|
382
|
-
onClick: () => P((e) => s(e, -1)),
|
|
383
|
-
children: /* @__PURE__ */ _(he, {
|
|
384
|
-
size: 16,
|
|
385
|
-
"aria-hidden": "true"
|
|
386
|
-
})
|
|
387
|
-
})]
|
|
388
|
-
}),
|
|
389
|
-
T ? null : /* @__PURE__ */ _("span", { children: ke(Tt) }),
|
|
390
|
-
/* @__PURE__ */ v("div", {
|
|
391
|
-
className: `vl-${b}__header-actions`,
|
|
392
|
-
children: [/* @__PURE__ */ _("button", {
|
|
393
|
-
type: "button",
|
|
394
|
-
"aria-label": "下一个月",
|
|
395
|
-
onClick: () => P((e) => s(e, 1)),
|
|
396
|
-
children: /* @__PURE__ */ _(ge, {
|
|
397
|
-
size: 16,
|
|
398
|
-
"aria-hidden": "true"
|
|
399
|
-
})
|
|
400
|
-
}), /* @__PURE__ */ _("button", {
|
|
401
|
-
type: "button",
|
|
402
|
-
"aria-label": "下一年",
|
|
403
|
-
onClick: () => P((e) => s(e, 12)),
|
|
404
|
-
children: /* @__PURE__ */ _(ve, {
|
|
405
|
-
size: 16,
|
|
406
|
-
"aria-hidden": "true"
|
|
407
|
-
})
|
|
408
|
-
})]
|
|
409
|
-
})
|
|
410
|
-
]
|
|
411
|
-
}),
|
|
412
|
-
/* @__PURE__ */ v("div", {
|
|
413
|
-
className: `vl-${b}__calendars`,
|
|
414
|
-
children: [nn(Tt), T ? nn(Et) : null]
|
|
415
|
-
}),
|
|
416
|
-
C ? /* @__PURE__ */ _("div", {
|
|
417
|
-
className: `vl-${b}__time`,
|
|
418
|
-
children: /* @__PURE__ */ v("div", {
|
|
419
|
-
className: `vl-${b}__time-toolbar`,
|
|
420
|
-
children: [
|
|
421
|
-
/* @__PURE__ */ _("span", {
|
|
422
|
-
className: `vl-${b}__time-title`,
|
|
423
|
-
children: "时间"
|
|
424
|
-
}),
|
|
425
|
-
T ? /* @__PURE__ */ v("div", {
|
|
426
|
-
className: `vl-${b}__time-range`,
|
|
427
|
-
children: [/* @__PURE__ */ _("button", {
|
|
428
|
-
type: "button",
|
|
429
|
-
className: R === "start" ? "is-active" : "",
|
|
430
|
-
"aria-pressed": R === "start",
|
|
431
|
-
disabled: !I[0],
|
|
432
|
-
onClick: () => {
|
|
433
|
-
Z(!1), z("start");
|
|
434
|
-
},
|
|
435
|
-
children: "开始时间"
|
|
436
|
-
}), /* @__PURE__ */ _("button", {
|
|
437
|
-
type: "button",
|
|
438
|
-
className: R === "end" ? "is-active" : "",
|
|
439
|
-
"aria-pressed": R === "end",
|
|
440
|
-
disabled: !I[1],
|
|
441
|
-
onClick: () => {
|
|
442
|
-
Z(!1), z("end");
|
|
443
|
-
},
|
|
444
|
-
children: "结束时间"
|
|
445
|
-
})]
|
|
446
|
-
}) : null,
|
|
447
|
-
/* @__PURE__ */ _(pe, {
|
|
448
|
-
className: `vl-${b}__time-dropdown`,
|
|
449
|
-
open: ut,
|
|
450
|
-
disabled: !$,
|
|
451
|
-
trigger: "click",
|
|
452
|
-
placement: "bottom-end",
|
|
453
|
-
offset: 4,
|
|
454
|
-
closeOnContentClick: !1,
|
|
455
|
-
"aria-label": Zt,
|
|
456
|
-
menuLabel: `${Zt}选择器`,
|
|
457
|
-
triggerContent: /* @__PURE__ */ _(ne, {
|
|
458
|
-
ref: it,
|
|
459
|
-
className: `vl-${b}__time-input`,
|
|
460
|
-
value: Xt,
|
|
461
|
-
placeholder: "请先选择日期",
|
|
462
|
-
size: "sm",
|
|
463
|
-
suffixIcon: ye,
|
|
464
|
-
readOnly: !0,
|
|
465
|
-
disabled: !$
|
|
466
|
-
}),
|
|
467
|
-
onChange: Gt,
|
|
468
|
-
children: /* @__PURE__ */ v("div", {
|
|
469
|
-
className: `vl-${b}__time-popover`,
|
|
470
|
-
[y]: H,
|
|
471
|
-
children: [/* @__PURE__ */ _(de, {
|
|
472
|
-
value: {
|
|
473
|
-
hours: qt,
|
|
474
|
-
minutes: Jt,
|
|
475
|
-
seconds: Yt
|
|
476
|
-
},
|
|
477
|
-
disabled: !$,
|
|
478
|
-
ariaLabel: Zt,
|
|
479
|
-
visibleItemCount: 3,
|
|
480
|
-
itemHeight: 30,
|
|
481
|
-
isOptionDisabled: Qt,
|
|
482
|
-
onChange: zt
|
|
483
|
-
}), /* @__PURE__ */ v("div", {
|
|
484
|
-
className: `vl-${b}__footer`,
|
|
485
|
-
children: [/* @__PURE__ */ _("button", {
|
|
486
|
-
type: "button",
|
|
487
|
-
className: "is-cancel",
|
|
488
|
-
"aria-label": "取消时间",
|
|
489
|
-
onClick: () => Z(!1, !0),
|
|
490
|
-
children: "取消"
|
|
491
|
-
}), /* @__PURE__ */ _("button", {
|
|
492
|
-
type: "button",
|
|
493
|
-
className: "is-confirm",
|
|
494
|
-
"aria-label": "确定时间",
|
|
495
|
-
disabled: !B,
|
|
496
|
-
onClick: () => Z(!0, !0),
|
|
497
|
-
children: "确定"
|
|
498
|
-
})]
|
|
499
|
-
})]
|
|
500
|
-
})
|
|
501
|
-
})
|
|
502
|
-
]
|
|
503
|
-
})
|
|
504
|
-
}) : null,
|
|
505
|
-
Fe.length ? /* @__PURE__ */ _("div", {
|
|
506
|
-
className: `vl-${b}__shortcuts`,
|
|
507
|
-
role: "group",
|
|
508
|
-
"aria-label": "快捷选择",
|
|
509
|
-
children: Fe.map((e) => /* @__PURE__ */ _("button", {
|
|
510
|
-
type: "button",
|
|
511
|
-
onClick: () => Bt(e),
|
|
512
|
-
children: e.label
|
|
513
|
-
}, e.label))
|
|
514
|
-
}) : null,
|
|
515
|
-
T || C ? /* @__PURE__ */ v("div", {
|
|
516
|
-
className: `vl-${b}__footer`,
|
|
517
|
-
children: [/* @__PURE__ */ _("button", {
|
|
518
|
-
type: "button",
|
|
519
|
-
className: "is-cancel",
|
|
520
|
-
onClick: () => {
|
|
521
|
-
Y(!1), k.current?.focus();
|
|
522
|
-
},
|
|
523
|
-
children: "取消"
|
|
524
|
-
}), /* @__PURE__ */ _("button", {
|
|
525
|
-
type: "button",
|
|
526
|
-
className: "is-confirm",
|
|
527
|
-
disabled: !$t,
|
|
528
|
-
onClick: () => {
|
|
529
|
-
T ? Lt(I) : F && It(F);
|
|
530
|
-
},
|
|
531
|
-
children: "确定"
|
|
532
|
-
})]
|
|
533
|
-
}) : null
|
|
534
|
-
]
|
|
535
|
-
})
|
|
536
|
-
});
|
|
537
|
-
return /* @__PURE__ */ v("div", {
|
|
538
|
-
ref: xt,
|
|
539
|
-
className: `vl-${b}-wrapper`,
|
|
540
|
-
style: qe,
|
|
541
|
-
...nt,
|
|
542
|
-
children: [/* @__PURE__ */ v("div", {
|
|
543
|
-
ref: k,
|
|
544
|
-
id: bt,
|
|
545
|
-
className: tn,
|
|
546
|
-
role: "combobox",
|
|
547
|
-
"aria-expanded": N,
|
|
548
|
-
"aria-controls": H,
|
|
549
|
-
"aria-haspopup": "dialog",
|
|
550
|
-
"aria-disabled": E || void 0,
|
|
551
|
-
"aria-label": Ye ?? (Xe ? void 0 : He),
|
|
552
|
-
"aria-labelledby": Xe,
|
|
553
|
-
"aria-describedby": Ze,
|
|
554
|
-
tabIndex: E ? -1 : 0,
|
|
555
|
-
onClick: () => Y(!N),
|
|
556
|
-
onKeyDown: Ht,
|
|
557
|
-
children: [
|
|
558
|
-
/* @__PURE__ */ _("span", {
|
|
559
|
-
className: `vl-${b}__icon`,
|
|
560
|
-
"aria-hidden": "true",
|
|
561
|
-
children: /* @__PURE__ */ _(me, { size: 16 })
|
|
562
|
-
}),
|
|
563
|
-
/* @__PURE__ */ _("span", {
|
|
564
|
-
className: `vl-${b}__value${wt ? "" : " is-placeholder"}`,
|
|
565
|
-
children: wt || He
|
|
566
|
-
}),
|
|
567
|
-
Ue && en && !E ? /* @__PURE__ */ _("button", {
|
|
568
|
-
type: "button",
|
|
569
|
-
className: `vl-${b}__clear`,
|
|
570
|
-
"aria-label": "清除已选",
|
|
571
|
-
onClick: Vt,
|
|
572
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
573
|
-
children: /* @__PURE__ */ _(be, {
|
|
574
|
-
size: 16,
|
|
575
|
-
"aria-hidden": "true"
|
|
576
|
-
})
|
|
577
|
-
}) : null
|
|
578
|
-
]
|
|
579
|
-
}), at ? Te(rn, document.body) : rn]
|
|
580
|
-
});
|
|
581
|
-
});
|
|
582
|
-
C.displayName = "VlDatePickerCore";
|
|
583
|
-
//#endregion
|
|
584
|
-
export { C as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./effect-BpNxm_06.cjs"),t=require("./state-ZBA75xZ_.cjs"),n=require("./client-BkoqeUs3.cjs"),r=require("./refs-DCqd87V8.cjs"),i=require("./floating-DXRnx48N.cjs"),a=require("./id-CF0zOP1G.cjs"),o=require("./Transition-X_89ga-e.cjs"),s=require("./Input-CoDZggqc.cjs"),c=require("./time-wheel-BaCcA9nk.cjs"),l=require("./Dropdown-swfND4yK.cjs");let u=require("lucide-react"),d=require("react"),f=require("react/jsx-runtime"),ee=require("react-dom");var p=`data-vl-date-picker-popup-owner`,te=[`日`,`一`,`二`,`三`,`四`,`五`,`六`],ne=[`一月`,`二月`,`三月`,`四月`,`五月`,`六月`,`七月`,`八月`,`九月`,`十月`,`十一月`,`十二月`],m=e=>Array.isArray(e)&&e.length===2,h=(e,t)=>c.b(e,t),re=(e,t)=>{if(m(e)){let n=h(e[0],t),r=h(e[1],t);return n&&r?`${c.d(n,t)} ~ ${c.d(r,t)}`:``}let n=h(e,t);return n?c.d(n,t):``},ie=e=>[e[0]?c.l(e[0]):null,e[1]?c.l(e[1]):null],ae=e=>`${e.getFullYear()}年 ${ne[e.getMonth()]}`,oe=(e,t)=>t?c.l(e):c.g(e),se=(e,t,n)=>{let r=e=>{let t=h(e,n);return t?t.getTime():null};return m(e)||m(t)?!m(e)||!m(t)?!1:r(e[0])===r(t[0])&&r(e[1])===r(t[1]):r(e)===r(t)},ce=(0,d.forwardRef)((ne,ce)=>{let{componentName:g,withTime:_=!1,value:le,defaultValue:ue,valueType:de=`date`,format:v=_?`YYYY-MM-DD HH:mm:ss`:`YYYY-MM-DD`,range:y=!1,shortcuts:fe=[],minDate:pe,maxDate:me,disabledDate:he,minTime:ge,maxTime:_e,disabledTime:ve,placeholder:ye=y?`请选择日期范围`:_?`请选择日期时间`:`请选择日期`,disabled:b=!1,clearable:be=!1,size:xe=`md`,placement:x=`bottom-start`,offset:Se=8,className:Ce,style:we,id:Te,"aria-label":Ee,"aria-labelledby":De,"aria-describedby":Oe,onChange:ke,onClear:Ae,onOpen:je,onClose:Me,...Ne}=ne,S=ke,Pe=(0,d.useRef)(null),C=(0,d.useRef)(null),w=(0,d.useRef)(null),Fe=(0,d.useRef)(null),T=n.t(),Ie=t.t(ne,`value`),[E,D]=t.n({value:le??null,defaultValue:ue??null,controlled:Ie}),[O,Le]=(0,d.useState)(!1),[Re,k]=(0,d.useState)(()=>{let e=m(E)?h(E[0],v):h(E,v);return c._(e??new Date)}),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)([null,null]),[P,F]=(0,d.useState)(`start`),[ze,Be]=(0,d.useState)(!1),[I,Ve]=(0,d.useState)(null),[He,Ue]=(0,d.useState)({}),[We,Ge]=(0,d.useState)(x),[Ke,qe]=(0,d.useState)(!1),[Je,L]=(0,d.useState)(null),Ye=a.t(`vl-${g}-control`,Te),R=a.t(`vl-${g}-panel`),Xe=(0,d.useMemo)(()=>r.n(Pe,ce),[ce]),z=(0,d.useCallback)(()=>{Be(!1),Ve(null)},[]),Ze=(0,d.useMemo)(()=>y?m(E)?[h(E[0],v),h(E[1],v)]:[null,null]:Array.isArray(E)?null:h(E,v),[v,y,E]),B=y?Ze:null,V=y?null:Ze,Qe=re(E,v),$e=Re,et=c.c(Re,1),H=h(pe,v),U=h(me,v),tt=ge?c.y(ge):null,nt=_e?c.y(_e):null,W=(0,d.useMemo)(()=>({minSeconds:tt,maxSeconds:nt,disabledTime:ve}),[ve,nt,tt]),G=(0,d.useCallback)(e=>{let t=c.g(e);return!!(H&&c.u(t,c.g(H))<0||U&&c.u(t,c.g(U))>0||he?.(t))},[he,U,H]),K=(0,d.useCallback)(e=>c.i(e,W),[W]),q=(0,d.useCallback)((e,t,n)=>c.n(e,t,n,W),[W]),rt=(0,d.useCallback)(e=>_&&K(c.d(e,`HH:mm:ss`)),[K,_]),J=(0,d.useCallback)(e=>{if(!(e&&(b||O))&&!(!e&&!O)){if(e){let e=(y?B?.[0]:V)??new Date;k(c._(e)),y?N(ie(B??[null,null])):j(V?c.l(V):null),F(`start`),qe(!1),Ue({}),Ge(x),L(null),z(),Le(!0),je?.()}else L(null),z(),Le(!1),Me?.()}},[b,Me,je,O,x,y,z,V,B]),Y=(0,d.useCallback)(()=>{if(!O||!C.current||!w.current)return;let e=C.current.getBoundingClientRect(),t=i.t({anchorRect:e,floatingRect:w.current.getBoundingClientRect(),placement:x,offset:Se});Ge(t.placement),Ue({left:`${Math.round(t.x)}px`,top:`${Math.round(t.y)}px`}),qe(!0)},[Se,O,x]);e.t(()=>{if(!O||!T)return;Y();let e=window.requestAnimationFrame(Y);return()=>window.cancelAnimationFrame(e)},[T,O,Y]),e.t(()=>{if(!O||!Je)return;let e=w.current?.querySelector(`[data-time="${Je.getTime()}"]:not(:disabled)`);e&&(e.focus(),L(null))},[Re,Je,O]);let it=(0,d.useCallback)(e=>e.some(e=>e instanceof HTMLElement&&(e.getAttribute(p)===R||e.classList.contains(`vl-dropdown__panel`)&&e.querySelector(`[${p}]`)?.getAttribute(p)===R)),[R]),at=(0,d.useCallback)(()=>J(!1),[J]),ot=(0,d.useCallback)(()=>{ze||(J(!1),C.current?.focus())},[J,ze]);i.r({active:O,rootRef:Pe,floatingRef:w,isOwnedPopup:it,onOutsideClick:at,onEscape:ot,onViewportChange:Y}),(0,d.useEffect)(()=>{b&&O&&J(!1)},[b,O,J]);let X=(0,d.useCallback)(e=>de===`string`?c.d(e,v):c.l(e),[v,de]),st=(0,d.useCallback)(e=>{let t=oe(e,_);if(G(t)||_&&K(c.d(t,`HH:mm:ss`)))return;let n=X(t);se(E,n,v)||(D(n),S?.(n)),J(!1),C.current?.focus()},[S,v,G,K,X,E,J,D,_]),ct=(0,d.useCallback)(e=>{if(!e[0]||!e[1])return;let t=c.u(e[0],e[1])<=0?e:[e[1],e[0]],n=oe(t[0],_),r=oe(t[1],_);if(G(n)||G(r)||_&&(K(c.d(n,`HH:mm:ss`))||K(c.d(r,`HH:mm:ss`))))return;let i=[X(n),X(r)];se(E,i,v)||(D(i),S?.(i)),J(!1),C.current?.focus()},[S,v,G,K,X,E,J,D,_]),lt=e=>{if(G(e))return;let t=y?M[P===`start`?0:1]:A,n=c.g(e);if(_){if(t)n=c.h(e,t.getHours(),t.getMinutes(),t.getSeconds());else{let t=q(0,86399,0);n=t===null?c.l(e):c.h(e,Math.floor(t/3600),Math.floor(t%3600/60),t%60)}}if(!y){j(n),_||st(n);return}let[r,i]=M;if(!r||i){N([n,null]),F(`start`);return}c.u(n,r)<0?(N([n,r]),F(`end`)):(N([r,n]),F(`end`))},Z=(0,d.useCallback)((e,t=!1)=>{if(e&&I){if(y){let e=ie(M);e[P===`start`?0:1]=c.l(I),N(e)}else j(c.l(I))}z(),t&&window.requestAnimationFrame(()=>Fe.current?.focus())},[P,M,y,z,I]),ut=(e,t)=>{let n=I?c.l(I):new Date,r={hours:n.getHours(),minutes:n.getMinutes(),seconds:n.getSeconds()},{start:i,end:a,preferred:o}=c.r(e,t,r),s=q(i,a,o);if(s===null)return;let l=c.h(n,Math.floor(s/3600),Math.floor(s%3600/60),s%60);Ve(l)},dt=e=>{let t=e.getValue(new Date);if(t===null)return;if(y){if(!m(t))return;let e=h(t[0],v),n=h(t[1],v);if(!e||!n||G(e)||G(n)||rt(e)||rt(n))return;N(c.u(e,n)<=0?[e,n]:[n,e]),F(`end`);return}if(m(t))return;let n=h(t,v);!n||G(n)||rt(n)||st(n)},ft=e=>{e?.stopPropagation(),!b&&(D(null),S?.(null),Ae?.(),j(null),N([null,null]))},Q=(e,t,n=!1)=>{let r=n?c.g(e):c.s(c.g(e),t);for(let e=0;e<3660;e+=1){if(t<0&&H&&c.u(r,c.g(H))<0||t>0&&U&&c.u(r,c.g(U))>0)return null;if(!G(r))return r;r=c.s(r,t)}return null},pt=e=>{if(!b){if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),O)J(!1);else{let e=(y?B?.[0]:V)??new Date,t=Q(e,1,!0)??Q(e,-1,!0)??null;J(!0),t&&L(t)}}else e.key===`Escape`&&O&&(e.preventDefault(),J(!1))}},mt=e=>{!c.m(e,$e)&&!(y&&c.m(e,et))&&k(c._(e)),L(c.g(e))},ht=(e,t)=>{let n=null;if(e.key===`ArrowLeft`)n=Q(t,-1);else if(e.key===`ArrowRight`)n=Q(t,1);else if(e.key===`ArrowUp`)n=Q(t,-7);else if(e.key===`ArrowDown`)n=Q(t,7);else if(e.key===`Home`||e.key===`End`){let r=e.key===`Home`?c.s(t,-t.getDay()):c.s(t,6-t.getDay()),i=e.key===`Home`?1:-1;for(let e=0;e<7;e+=1){let t=c.s(r,e*i);if(!G(t)){n=t;break}}}n&&(e.preventDefault(),mt(n))},$=y?M[P===`start`?0:1]:A,gt=(0,d.useCallback)(e=>{if(e){if(!$)return;Ve(c.l($)),Be(!0);return}Z(!1)},[$,Z]),_t=I??$??new Date,vt=_t.getHours(),yt=_t.getMinutes(),bt=_t.getSeconds(),xt=$?c.d(_t,`HH:mm:ss`):``,St=y?P===`start`?`开始时间`:`结束时间`:`时间`,Ct=(0,d.useCallback)((e,t)=>c.a(e,t,{hours:vt,minutes:yt,seconds:bt},q),[q,vt,yt,bt]),wt=y?!!(M[0]&&M[1]&&!G(M[0])&&!G(M[1])&&(!_||!K(c.d(M[0],`HH:mm:ss`))&&!K(c.d(M[1],`HH:mm:ss`)))):!!(A&&!G(A)&&(!_||!K(c.d(A,`HH:mm:ss`)))),Tt=!!Qe,Et=[`vl-${g}`,`size-${xe}`,O?`is-open`:``,b?`is-disabled`:``,y?`is-range`:``,_?`has-time`:``,Ce||``].filter(Boolean).join(` `),Dt=e=>{let t=c.f(e),n=y?M[0]:null,r=y?M[1]:null,i=y?null:A??V,a=(y?[M[0],M[1]]:[i]).find(t=>t&&c.m(t,e)&&!G(t))??t.find(t=>c.m(t,e)&&!G(t));return(0,f.jsxs)(`section`,{className:`vl-${g}__calendar`,"aria-label":ae(e),children:[y?(0,f.jsx)(`div`,{className:`vl-${g}__month-title`,children:ae(e)}):null,(0,f.jsx)(`div`,{className:`vl-${g}__weekdays`,role:`row`,children:te.map(e=>(0,f.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,f.jsx)(`div`,{className:`vl-${g}__grid`,role:`grid`,children:t.map(t=>{let o=!c.m(t,e),s=o||G(t),l=!!(n&&r&&c.u(t,c.g(n))>=0&&c.u(t,c.g(r))<=0),u=[`vl-${g}__day`,o?`is-other-month`:``,c.p(t,new Date)?`is-today`:``,y&&n&&c.p(t,n)?`is-range-start is-selected`:``,y&&r&&c.p(t,r)?`is-range-end is-selected`:``,i&&c.p(t,i)?`is-selected`:``,l?`is-in-range`:``,s?`is-disabled`:``].filter(Boolean).join(` `);return(0,f.jsx)(`button`,{type:`button`,className:u,role:`gridcell`,"data-time":t.getTime(),"aria-label":`${t.getFullYear()}年${t.getMonth()+1}月${t.getDate()}日`,"aria-selected":y?l:!!(i&&c.p(t,i)),"aria-current":c.p(t,new Date)?`date`:void 0,"aria-hidden":o||void 0,"aria-disabled":s||void 0,disabled:s,tabIndex:!s&&a&&c.p(t,a)?0:-1,onClick:()=>lt(t),onKeyDown:e=>ht(e,t),children:t.getDate()},t.toISOString())})})]})},Ot=(0,f.jsx)(o.t,{show:O,name:`vl-${g}`,deferEffects:!T,children:(0,f.jsxs)(`div`,{ref:w,id:R,className:`vl-${g}__panel is-${We}${Ke?` is-positioned`:``}`,style:{...He,visibility:Ke?`visible`:`hidden`},role:`dialog`,"aria-label":y?`日期范围选择`:_?`日期时间选择`:`日期选择`,children:[(0,f.jsxs)(`div`,{className:`vl-${g}__header`,children:[(0,f.jsxs)(`div`,{className:`vl-${g}__header-actions`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`上一年`,onClick:()=>k(e=>c.c(e,-12)),children:(0,f.jsx)(u.ChevronsLeft,{size:16,"aria-hidden":`true`})}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`上一个月`,onClick:()=>k(e=>c.c(e,-1)),children:(0,f.jsx)(u.ChevronLeft,{size:16,"aria-hidden":`true`})})]}),y?null:(0,f.jsx)(`span`,{children:ae($e)}),(0,f.jsxs)(`div`,{className:`vl-${g}__header-actions`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`下一个月`,onClick:()=>k(e=>c.c(e,1)),children:(0,f.jsx)(u.ChevronRight,{size:16,"aria-hidden":`true`})}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`下一年`,onClick:()=>k(e=>c.c(e,12)),children:(0,f.jsx)(u.ChevronsRight,{size:16,"aria-hidden":`true`})})]})]}),(0,f.jsxs)(`div`,{className:`vl-${g}__calendars`,children:[Dt($e),y?Dt(et):null]}),_?(0,f.jsx)(`div`,{className:`vl-${g}__time`,children:(0,f.jsxs)(`div`,{className:`vl-${g}__time-toolbar`,children:[(0,f.jsx)(`span`,{className:`vl-${g}__time-title`,children:`时间`}),y?(0,f.jsxs)(`div`,{className:`vl-${g}__time-range`,children:[(0,f.jsx)(`button`,{type:`button`,className:P===`start`?`is-active`:``,"aria-pressed":P===`start`,disabled:!M[0],onClick:()=>{Z(!1),F(`start`)},children:`开始时间`}),(0,f.jsx)(`button`,{type:`button`,className:P===`end`?`is-active`:``,"aria-pressed":P===`end`,disabled:!M[1],onClick:()=>{Z(!1),F(`end`)},children:`结束时间`})]}):null,(0,f.jsx)(l.t,{className:`vl-${g}__time-dropdown`,open:ze,disabled:!$,trigger:`click`,placement:`bottom-end`,offset:4,closeOnContentClick:!1,"aria-label":St,menuLabel:`${St}选择器`,triggerContent:(0,f.jsx)(s.t,{ref:Fe,className:`vl-${g}__time-input`,value:xt,placeholder:`请先选择日期`,size:`sm`,suffixIcon:u.Clock3,readOnly:!0,disabled:!$}),onChange:gt,children:(0,f.jsxs)(`div`,{className:`vl-${g}__time-popover`,[p]:R,children:[(0,f.jsx)(c.t,{value:{hours:vt,minutes:yt,seconds:bt},disabled:!$,ariaLabel:St,visibleItemCount:3,itemHeight:30,isOptionDisabled:Ct,onChange:ut}),(0,f.jsxs)(`div`,{className:`vl-${g}__footer`,children:[(0,f.jsx)(`button`,{type:`button`,className:`is-cancel`,"aria-label":`取消时间`,onClick:()=>Z(!1,!0),children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`is-confirm`,"aria-label":`确定时间`,disabled:!I,onClick:()=>Z(!0,!0),children:`确定`})]})]})})]})}):null,fe.length?(0,f.jsx)(`div`,{className:`vl-${g}__shortcuts`,role:`group`,"aria-label":`快捷选择`,children:fe.map(e=>(0,f.jsx)(`button`,{type:`button`,onClick:()=>dt(e),children:e.label},e.label))}):null,y||_?(0,f.jsxs)(`div`,{className:`vl-${g}__footer`,children:[(0,f.jsx)(`button`,{type:`button`,className:`is-cancel`,onClick:()=>{J(!1),C.current?.focus()},children:`取消`}),(0,f.jsx)(`button`,{type:`button`,className:`is-confirm`,disabled:!wt,onClick:()=>{y?ct(M):A&&st(A)},children:`确定`})]}):null]})});return(0,f.jsxs)(`div`,{ref:Xe,className:`vl-${g}-wrapper`,style:we,...Ne,children:[(0,f.jsxs)(`div`,{ref:C,id:Ye,className:Et,role:`combobox`,"aria-expanded":O,"aria-controls":R,"aria-haspopup":`dialog`,"aria-disabled":b||void 0,"aria-label":Ee??(De?void 0:ye),"aria-labelledby":De,"aria-describedby":Oe,tabIndex:b?-1:0,onClick:()=>J(!O),onKeyDown:pt,children:[(0,f.jsx)(`span`,{className:`vl-${g}__icon`,"aria-hidden":`true`,children:(0,f.jsx)(u.CalendarDays,{size:16})}),(0,f.jsx)(`span`,{className:`vl-${g}__value${Qe?``:` is-placeholder`}`,children:Qe||ye}),be&&Tt&&!b?(0,f.jsx)(`button`,{type:`button`,className:`vl-${g}__clear`,"aria-label":`清除已选`,onClick:ft,onMouseDown:e=>e.preventDefault(),children:(0,f.jsx)(u.X,{size:16,"aria-hidden":`true`})}):null]}),T?(0,ee.createPortal)(Ot,document.body):Ot]})});ce.displayName=`VlDatePickerCore`,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ce}});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./Alert-BGyLKuv0.js";
|
|
2
|
-
import { n as t } from "./Anchor-QZROepM_.js";
|
|
3
|
-
import { n } from "./Announcement-D_NccvTm.js";
|
|
4
|
-
import { n as r } from "./Button-CwkWSWau.js";
|
|
5
|
-
import { n as i } from "./Card-DlztNV-6.js";
|
|
6
|
-
import { n as a } from "./Checkbox-CQeqLO0S.js";
|
|
7
|
-
import { n as o } from "./Col-CZjR94ac.js";
|
|
8
|
-
import { n as s } from "./Transition-DiO4GsP3.js";
|
|
9
|
-
import { n as c } from "./Input-CIB_TY2n.js";
|
|
10
|
-
import { n as l } from "./Tabs-VT6nQ63W.js";
|
|
11
|
-
import { n as u } from "./NumberInput-C_vLULbX.js";
|
|
12
|
-
import { n as d } from "./Cron-Di7k2FTL.js";
|
|
13
|
-
import { n as f } from "./Dropdown-CYx6RxVv.js";
|
|
14
|
-
import { n as p } from "./DatePicker-M-MwejjV.js";
|
|
15
|
-
import { n as m } from "./DateTimePicker-BcT3FtN-.js";
|
|
16
|
-
import { n as h } from "./Divider-vyftxh3F.js";
|
|
17
|
-
import { n as g } from "./Drawer-D28QbyA3.js";
|
|
18
|
-
import { t as _ } from "./Form-CwgaAZWr.js";
|
|
19
|
-
import { n as v } from "./Loading-CL0wUgYK.js";
|
|
20
|
-
import { n as y } from "./Modal-B_VqN16m.js";
|
|
21
|
-
import { t as b } from "./MessageBox-CrIifoig.js";
|
|
22
|
-
import { n as x } from "./Pagination-B7a9v6BU.js";
|
|
23
|
-
import { n as S } from "./Progress-D2C6LCml.js";
|
|
24
|
-
import { VlRadio as C } from "./es/Radio.mjs";
|
|
25
|
-
import { VlRow as w } from "./es/Row.mjs";
|
|
26
|
-
import { n as T } from "./Scrollbar-BdMGZrYi.js";
|
|
27
|
-
import { n as E } from "./Select-DccM9YpB.js";
|
|
28
|
-
import { n as D } from "./Sidebar-u980T-QB.js";
|
|
29
|
-
import { n as O } from "./Slider-BzlZc0p4.js";
|
|
30
|
-
import { n as k } from "./Space-gnVH7rEt.js";
|
|
31
|
-
import { n as A } from "./Switch-DOO2tiYR.js";
|
|
32
|
-
import { n as j } from "./Tooltip-Ds4Odm7K.js";
|
|
33
|
-
import { n as M } from "./Table-C8cSyts5.js";
|
|
34
|
-
import { n as N } from "./Tag-CkfqoSwA.js";
|
|
35
|
-
import { n as P } from "./Textarea-BEd7ToXv.js";
|
|
36
|
-
import { n as F } from "./Timeline-euWvUS4e.js";
|
|
37
|
-
import { n as I } from "./TimePicker-ClQCHa6M.js";
|
|
38
|
-
//#region components/registry.ts
|
|
39
|
-
var L = {
|
|
40
|
-
VlAlert: e,
|
|
41
|
-
VlAnchor: t,
|
|
42
|
-
VlAnnouncement: n,
|
|
43
|
-
VlButton: r,
|
|
44
|
-
VlCard: i,
|
|
45
|
-
VlCheckbox: a,
|
|
46
|
-
VlCol: o,
|
|
47
|
-
VlCron: d,
|
|
48
|
-
VlDatePicker: p,
|
|
49
|
-
VlDateTimePicker: m,
|
|
50
|
-
VlDivider: h,
|
|
51
|
-
VlDrawer: g,
|
|
52
|
-
VlDropdown: f,
|
|
53
|
-
VlForm: _,
|
|
54
|
-
VlInput: c,
|
|
55
|
-
VlLoading: v,
|
|
56
|
-
VlMessageBox: b,
|
|
57
|
-
VlModal: y,
|
|
58
|
-
VlNumberInput: u,
|
|
59
|
-
VlPagination: x,
|
|
60
|
-
VlProgress: S,
|
|
61
|
-
VlRadio: C,
|
|
62
|
-
VlRow: w,
|
|
63
|
-
VlScrollbar: T,
|
|
64
|
-
VlSelect: E,
|
|
65
|
-
VlSidebar: D,
|
|
66
|
-
VlSlider: O,
|
|
67
|
-
VlSpace: k,
|
|
68
|
-
VlSwitch: A,
|
|
69
|
-
VlTable: M,
|
|
70
|
-
VlTabs: l,
|
|
71
|
-
VlTag: N,
|
|
72
|
-
VlTextarea: P,
|
|
73
|
-
VlTimeline: F,
|
|
74
|
-
VlTimePicker: I,
|
|
75
|
-
VlTooltip: j,
|
|
76
|
-
VlTransition: s
|
|
77
|
-
}, R = (e = globalThis) => (Object.assign(e, L), L);
|
|
78
|
-
//#endregion
|
|
79
|
-
export { R as n, L as t };
|