@mcistudio/unoui-vue 1.1.0 → 1.2.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/dist/button/index.js +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/chunks/{ImageEditor-CahA7Ut7.js → ImageEditor-DRoD50TJ.js} +2 -2
- package/dist/chunks/{ImageEditor-CahA7Ut7.js.map → ImageEditor-DRoD50TJ.js.map} +1 -1
- package/dist/chunks/{Table-DhXmuKQd.js → Table-QvmJFoxl.js} +3 -3
- package/dist/chunks/{Table-DhXmuKQd.js.map → Table-QvmJFoxl.js.map} +1 -1
- package/dist/chunks/{button-pDObrN_X.js → button-BBFPr3FH.js} +34 -33
- package/dist/chunks/{button-pDObrN_X.js.map → button-BBFPr3FH.js.map} +1 -1
- package/dist/chunks/{checkbox-9_0oR4kg.js → checkbox-wJpQHCeN.js} +2 -2
- package/dist/chunks/{checkbox-9_0oR4kg.js.map → checkbox-wJpQHCeN.js.map} +1 -1
- package/dist/chunks/{colorpicker-CcizUCQv.js → colorpicker-B-kSQ2Gh.js} +154 -158
- package/dist/chunks/colorpicker-B-kSQ2Gh.js.map +1 -0
- package/dist/chunks/control-BIl2ynWn.js +10 -0
- package/dist/chunks/control-BIl2ynWn.js.map +1 -0
- package/dist/chunks/datepicker-XNgIvgTe.js +1411 -0
- package/dist/chunks/datepicker-XNgIvgTe.js.map +1 -0
- package/dist/chunks/{dropdown-0l967g7D.js → dropdown-B4XuqfaI.js} +4 -4
- package/dist/chunks/dropdown-B4XuqfaI.js.map +1 -0
- package/dist/chunks/{form-Qeqkd-HH.js → form-CVJ4YMWA.js} +7 -7
- package/dist/chunks/{form-Qeqkd-HH.js.map → form-CVJ4YMWA.js.map} +1 -1
- package/dist/chunks/input-hIYHtcTj.js +1272 -0
- package/dist/chunks/input-hIYHtcTj.js.map +1 -0
- package/dist/chunks/{pagination-Bc583AQX.js → pagination-xntyuczw.js} +38 -56
- package/dist/chunks/pagination-xntyuczw.js.map +1 -0
- package/dist/chunks/{popconfirm-D6lUfSxG.js → popconfirm-DWmeebIf.js} +2 -2
- package/dist/chunks/{popconfirm-D6lUfSxG.js.map → popconfirm-DWmeebIf.js.map} +1 -1
- package/dist/chunks/{radio-DnYm59xH.js → radio-DGt8o-UL.js} +12 -12
- package/dist/chunks/{radio-DnYm59xH.js.map → radio-DGt8o-UL.js.map} +1 -1
- package/dist/chunks/select-eZ9h_f58.js +462 -0
- package/dist/chunks/select-eZ9h_f58.js.map +1 -0
- package/dist/chunks/{switch-BULGbODP.js → switch-C6a6ga2G.js} +2 -2
- package/dist/chunks/{switch-BULGbODP.js.map → switch-C6a6ga2G.js.map} +1 -1
- package/dist/chunks/{timepicker-DsGIdcf8.js → timepicker-BU9TRvFI.js} +326 -329
- package/dist/chunks/{timepicker-DsGIdcf8.js.map → timepicker-BU9TRvFI.js.map} +1 -1
- package/dist/colorpicker/index.d.ts +4 -0
- package/dist/colorpicker/index.js +2 -2
- package/dist/control.d.ts +6 -0
- package/dist/datepicker/index.js +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/form/index.js +1 -1
- package/dist/imageeditor/index.js +1 -1
- package/dist/index.js +31 -31
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +2 -2
- package/dist/modal/Modal.vue.d.ts +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/popconfirm/index.js +1 -1
- package/dist/radio/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/table/index.js +1 -1
- package/dist/timepicker/index.js +1 -1
- package/dist/uno.js +1 -0
- package/dist/uno.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/colorpicker-CcizUCQv.js.map +0 -1
- package/dist/chunks/datepicker-Cy808x7X.js +0 -1414
- package/dist/chunks/datepicker-Cy808x7X.js.map +0 -1
- package/dist/chunks/dropdown-0l967g7D.js.map +0 -1
- package/dist/chunks/input-BDOXVCrK.js +0 -1281
- package/dist/chunks/input-BDOXVCrK.js.map +0 -1
- package/dist/chunks/pagination-Bc583AQX.js.map +0 -1
- package/dist/chunks/select-ChTfQM5u.js +0 -417
- package/dist/chunks/select-ChTfQM5u.js.map +0 -1
|
@@ -0,0 +1,1411 @@
|
|
|
1
|
+
import { t as e } from "./control-BIl2ynWn.js";
|
|
2
|
+
import { r as t } from "./button-BBFPr3FH.js";
|
|
3
|
+
import { getUiExposeAttrs as n } from "../attrs.js";
|
|
4
|
+
import { t as r } from "./dropdown-B4XuqfaI.js";
|
|
5
|
+
import { cva as i } from "class-variance-authority";
|
|
6
|
+
import { Fragment as a, computed as o, createBlock as ee, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as te, createVNode as ne, defineComponent as u, mergeProps as re, nextTick as ie, normalizeClass as d, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, useAttrs as ae, watch as _, withCtx as oe, withModifiers as se } from "vue";
|
|
7
|
+
import { clsx as ce } from "clsx";
|
|
8
|
+
import v from "dayjs";
|
|
9
|
+
import le from "dayjs/plugin/customParseFormat";
|
|
10
|
+
//#region src/datepicker/DatePicker.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var y = ["tabindex", "aria-expanded"], b = ["title"], ue = ["name", "value"], x = { class: "flex shrink-0 items-center gap-1 pr-2 text-tertiary" }, de = { class: "select-none bg-primary text-primary" }, S = { class: "min-w-0" }, C = { class: "flex h-11 items-center justify-between gap-2 border-b border-medium px-2" }, w = { class: "flex items-center" }, T = { class: "min-w-0 truncate text-sm font-bold text-primary" }, E = { key: 2 }, D = { class: "flex items-center" }, O = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "grid grid-cols-7 gap-1 px-3 pb-2 pt-3"
|
|
14
|
+
}, fe = ["disabled", "onClick"], pe = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
17
|
+
}, me = ["disabled", "onClick"], he = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
20
|
+
}, ge = ["disabled", "onClick"], k = { class: "min-w-0 border-r border-medium" }, _e = { class: "max-h-[254px] overflow-y-auto p-1" }, A = ["disabled", "onClick"], j = { class: "max-h-[254px] overflow-y-auto p-1" }, ve = ["disabled", "onClick"], ye = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "min-w-0"
|
|
23
|
+
}, be = { class: "max-h-[254px] overflow-y-auto p-1" }, M = ["disabled", "onClick"], xe = { class: "flex min-h-11 items-center justify-between gap-3 border-t border-medium px-3 py-2" }, Se = ["disabled"], Ce = { class: "flex min-w-0 items-center justify-end gap-2" }, we = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "min-w-0 truncate font-mono text-xs text-tertiary"
|
|
26
|
+
}, N = "YYYY-MM-DD", Te = "YYYY-MM", Ee = "YYYY", De = "HH:mm:ss", P = "flex size-7 items-center justify-center rounded text-tertiary transition-colors hover:bg-secondary hover:text-primary", F = /* @__PURE__ */ u({
|
|
27
|
+
inheritAttrs: !1,
|
|
28
|
+
__name: "DatePicker",
|
|
29
|
+
props: {
|
|
30
|
+
modelValue: { default: void 0 },
|
|
31
|
+
picker: { default: "date" },
|
|
32
|
+
format: { default: void 0 },
|
|
33
|
+
valueFormat: { default: void 0 },
|
|
34
|
+
placeholder: { default: void 0 },
|
|
35
|
+
size: { default: "md" },
|
|
36
|
+
disabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
clearable: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
showTime: {
|
|
45
|
+
type: [Boolean, Object],
|
|
46
|
+
default: !1
|
|
47
|
+
},
|
|
48
|
+
disabledDate: {
|
|
49
|
+
type: Function,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
minDate: { default: void 0 },
|
|
53
|
+
maxDate: { default: void 0 },
|
|
54
|
+
suffixIcon: { default: "i-lucide:calendar-days" },
|
|
55
|
+
clearIcon: { default: "i-lucide:x" },
|
|
56
|
+
teleportedWidth: { default: void 0 },
|
|
57
|
+
name: { default: void 0 }
|
|
58
|
+
},
|
|
59
|
+
emits: [
|
|
60
|
+
"update:modelValue",
|
|
61
|
+
"change",
|
|
62
|
+
"clear",
|
|
63
|
+
"ok",
|
|
64
|
+
"visible-change",
|
|
65
|
+
"panel-change",
|
|
66
|
+
"focus",
|
|
67
|
+
"blur"
|
|
68
|
+
],
|
|
69
|
+
setup(e, { expose: i, emit: ne }) {
|
|
70
|
+
v.extend(le);
|
|
71
|
+
let u = e, F = ne, Oe = ae(), I = p(!1), ke = p(!1), L = p(null), R = p(v().startOf("month")), z = p("date"), Ae = p(null), je = [
|
|
72
|
+
"一",
|
|
73
|
+
"二",
|
|
74
|
+
"三",
|
|
75
|
+
"四",
|
|
76
|
+
"五",
|
|
77
|
+
"六",
|
|
78
|
+
"日"
|
|
79
|
+
], Me = o(() => !!u.showTime), B = o(() => typeof u.showTime == "object" ? u.showTime : {}), Ne = o(() => B.value.format || De), V = o(() => u.picker || "date"), Pe = o(() => V.value === "year" ? Ee : V.value === "month" ? Te : N), H = o(() => V.value === "date" && Me.value), U = o(() => u.format || (H.value ? `${N} ${Ne.value}` : Pe.value)), Fe = o(() => u.placeholder ? u.placeholder : H.value ? "请选择日期时间" : V.value === "year" ? "请选择年份" : V.value === "month" ? "请选择月份" : "请选择日期"), Ie = o(() => B.value.showSecond ?? Ne.value.includes("ss")), Le = o(() => u.teleportedWidth || (H.value ? "456px" : "320px")), W = o(() => rt(u.modelValue)), Re = o(() => W.value?.format(U.value) || ""), ze = o(() => W.value?.format(u.valueFormat || U.value) || ""), Be = o(() => !!W.value), Ve = o(() => u.clearable && Be.value && !u.disabled), He = o(() => L.value || W.value), G = o(() => nt(u.minDate)), K = o(() => nt(u.maxDate)), q = o(() => L.value || W.value || v()), Ue = o(() => mt(v())), We = o(() => {
|
|
80
|
+
if (z.value === "year") {
|
|
81
|
+
let e = ot(R.value);
|
|
82
|
+
return `${e} - ${e + 11}`;
|
|
83
|
+
}
|
|
84
|
+
return z.value === "month" ? R.value.format("YYYY年") : R.value.format("YYYY年M月");
|
|
85
|
+
}), Ge = o(() => R.value.format("YYYY年")), Ke = o(() => R.value.format("M月")), qe = o(() => ce(Oe.class, lt({
|
|
86
|
+
size: u.size,
|
|
87
|
+
focused: I.value || ke.value,
|
|
88
|
+
disabled: u.disabled
|
|
89
|
+
}))), Je = o(() => {
|
|
90
|
+
let e = at(R.value.startOf("month")), t = He.value;
|
|
91
|
+
return Array.from({ length: 42 }, (n, r) => {
|
|
92
|
+
let i = e.add(r, "day");
|
|
93
|
+
return {
|
|
94
|
+
date: i,
|
|
95
|
+
key: i.format("YYYY-MM-DD"),
|
|
96
|
+
inMonth: i.month() === R.value.month(),
|
|
97
|
+
selected: !!t?.isSame(i, "day"),
|
|
98
|
+
today: i.isSame(v(), "day"),
|
|
99
|
+
disabled: J(i)
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}), Ye = o(() => {
|
|
103
|
+
let e = He.value, t = v();
|
|
104
|
+
return Array.from({ length: 12 }, (n, r) => {
|
|
105
|
+
let i = R.value.month(r).startOf("month");
|
|
106
|
+
return {
|
|
107
|
+
date: i,
|
|
108
|
+
key: i.format("YYYY-MM"),
|
|
109
|
+
label: `${r + 1}月`,
|
|
110
|
+
selected: !!e?.isSame(i, "month"),
|
|
111
|
+
current: t.isSame(i, "month"),
|
|
112
|
+
disabled: Y(i)
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}), Xe = o(() => {
|
|
116
|
+
let e = He.value, t = v(), n = ot(R.value);
|
|
117
|
+
return Array.from({ length: 12 }, (r, i) => {
|
|
118
|
+
let a = R.value.year(n + i).startOf("year");
|
|
119
|
+
return {
|
|
120
|
+
date: a,
|
|
121
|
+
key: a.format("YYYY"),
|
|
122
|
+
label: a.format("YYYY"),
|
|
123
|
+
selected: !!e?.isSame(a, "year"),
|
|
124
|
+
current: t.isSame(a, "year"),
|
|
125
|
+
disabled: ft(a)
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}), Ze = o(() => ct(st(B.value.hourStep, 23), q.value.hour(), 23)), Qe = o(() => ct(st(B.value.minuteStep, 59), q.value.minute(), 59)), $e = o(() => ct(st(B.value.secondStep, 59), q.value.second(), 59));
|
|
129
|
+
_(() => u.modelValue, () => {
|
|
130
|
+
let e = W.value;
|
|
131
|
+
I.value || (L.value = e, R.value = (e || R.value || v()).startOf("month"));
|
|
132
|
+
}, { immediate: !0 }), _(I, (e) => {
|
|
133
|
+
F("visible-change", e), e && (L.value = W.value, R.value = (W.value || L.value || v()).startOf("month"), z.value = V.value);
|
|
134
|
+
});
|
|
135
|
+
function et(e, t) {
|
|
136
|
+
for (let n of t) {
|
|
137
|
+
let t = v(e, n, !0);
|
|
138
|
+
if (t.isValid()) return t;
|
|
139
|
+
}
|
|
140
|
+
let n = v(e);
|
|
141
|
+
return n.isValid() ? n : null;
|
|
142
|
+
}
|
|
143
|
+
function tt() {
|
|
144
|
+
return Array.from(new Set([
|
|
145
|
+
u.valueFormat,
|
|
146
|
+
U.value,
|
|
147
|
+
u.format,
|
|
148
|
+
`${N} ${De}`,
|
|
149
|
+
`${N} HH:mm`,
|
|
150
|
+
N,
|
|
151
|
+
Te,
|
|
152
|
+
Ee,
|
|
153
|
+
"YYYY/MM/DD HH:mm:ss",
|
|
154
|
+
"YYYY/MM/DD",
|
|
155
|
+
"YYYY/MM"
|
|
156
|
+
].filter(Boolean)));
|
|
157
|
+
}
|
|
158
|
+
function nt(e) {
|
|
159
|
+
if (e == null || e === "") return null;
|
|
160
|
+
if (v.isDayjs(e)) return e.isValid() ? e.millisecond(0) : null;
|
|
161
|
+
if (e instanceof Date || typeof e == "number") {
|
|
162
|
+
let t = v(e);
|
|
163
|
+
return t.isValid() ? t.millisecond(0) : null;
|
|
164
|
+
}
|
|
165
|
+
return typeof e == "string" ? et(e, tt())?.millisecond(0) ?? null : null;
|
|
166
|
+
}
|
|
167
|
+
function rt(e) {
|
|
168
|
+
return nt(e);
|
|
169
|
+
}
|
|
170
|
+
function it(e) {
|
|
171
|
+
let t = e.millisecond(0);
|
|
172
|
+
return u.valueFormat ? t.format(u.valueFormat) : v.isDayjs(u.modelValue) ? t : u.modelValue instanceof Date ? t.toDate() : typeof u.modelValue == "number" ? t.valueOf() : t.format(U.value);
|
|
173
|
+
}
|
|
174
|
+
function at(e) {
|
|
175
|
+
let t = e.day(), n = t === 0 ? 6 : t - 1;
|
|
176
|
+
return e.subtract(n, "day").startOf("day");
|
|
177
|
+
}
|
|
178
|
+
function ot(e) {
|
|
179
|
+
return Math.floor(e.year() / 12) * 12;
|
|
180
|
+
}
|
|
181
|
+
function st(e, t) {
|
|
182
|
+
let n = Number.isFinite(e) && e && e > 0 ? Math.floor(e) : 1, r = [];
|
|
183
|
+
for (let e = 0; e <= t; e += n) r.push(e);
|
|
184
|
+
return r;
|
|
185
|
+
}
|
|
186
|
+
function ct(e, t, n) {
|
|
187
|
+
let r = Math.min(n, Math.max(0, t));
|
|
188
|
+
return e.includes(r) ? e : [...e, r].sort((e, t) => e - t);
|
|
189
|
+
}
|
|
190
|
+
function J(e) {
|
|
191
|
+
return !!(u.disabledDate?.(e) || G.value && e.isBefore(G.value, "day") || K.value && e.isAfter(K.value, "day"));
|
|
192
|
+
}
|
|
193
|
+
function Y(e) {
|
|
194
|
+
let t = e.startOf("month"), n = e.endOf("month");
|
|
195
|
+
return G.value && n.isBefore(G.value, "day") || K.value && t.isAfter(K.value, "day") ? !0 : !!(u.disabledDate?.(t) && u.disabledDate?.(n));
|
|
196
|
+
}
|
|
197
|
+
function ft(e) {
|
|
198
|
+
let t = e.startOf("year"), n = e.endOf("year");
|
|
199
|
+
return G.value && n.isBefore(G.value, "day") || K.value && t.isAfter(K.value, "day") ? !0 : !!(u.disabledDate?.(t) && u.disabledDate?.(n));
|
|
200
|
+
}
|
|
201
|
+
function mt(e) {
|
|
202
|
+
return V.value === "year" ? ft(e) : V.value === "month" ? Y(e) : J(e);
|
|
203
|
+
}
|
|
204
|
+
function Z(e, t) {
|
|
205
|
+
if (!H.value) return !1;
|
|
206
|
+
let n = q.value, r = n;
|
|
207
|
+
return e === "hour" && (r = n.hour(t)), e === "minute" && (r = n.minute(t)), e === "second" && (r = n.second(t)), !!(G.value && r.isBefore(G.value) || K.value && r.isAfter(K.value));
|
|
208
|
+
}
|
|
209
|
+
function ht(e) {
|
|
210
|
+
if (V.value === "year" && ft(e) || V.value === "month" && Y(e) || V.value === "date" && J(e)) return null;
|
|
211
|
+
let t = e;
|
|
212
|
+
return V.value === "year" ? t = e.startOf("year") : V.value === "month" ? t = e.startOf("month") : H.value || (t = e.startOf("day")), H.value && (G.value && t.isBefore(G.value) && (t = G.value), K.value && t.isAfter(K.value) && (t = K.value)), t.millisecond(0);
|
|
213
|
+
}
|
|
214
|
+
function Q(e, t, n = !1) {
|
|
215
|
+
let r = ht(e);
|
|
216
|
+
if (!r) return;
|
|
217
|
+
let i = it(r), a = r.format(U.value);
|
|
218
|
+
L.value = r, R.value = r.startOf("month"), F("update:modelValue", i), F("change", i, a), n && F("ok", i, a), t && (I.value = !1);
|
|
219
|
+
}
|
|
220
|
+
function gt(e) {
|
|
221
|
+
e?.stopPropagation(), Ve.value && (L.value = null, F("update:modelValue", null), F("change", null, ""), F("clear"));
|
|
222
|
+
}
|
|
223
|
+
function _t(e) {
|
|
224
|
+
u.disabled || (I.value = e);
|
|
225
|
+
}
|
|
226
|
+
function vt() {
|
|
227
|
+
_t(!0);
|
|
228
|
+
}
|
|
229
|
+
function yt(e) {
|
|
230
|
+
u.disabled || (e.key === "Enter" || e.key === " " ? (e.preventDefault(), _t(!I.value)) : e.key === "Escape" ? I.value = !1 : e.key === "ArrowDown" && (e.preventDefault(), _t(!0)));
|
|
231
|
+
}
|
|
232
|
+
function bt(e) {
|
|
233
|
+
ke.value = !0, F("focus", e);
|
|
234
|
+
}
|
|
235
|
+
function xt(e) {
|
|
236
|
+
ke.value = !1, F("blur", e);
|
|
237
|
+
}
|
|
238
|
+
function St(e) {
|
|
239
|
+
z.value === "date" && (R.value = R.value.add(e, "month"), F("panel-change", R.value));
|
|
240
|
+
}
|
|
241
|
+
function Ct(e) {
|
|
242
|
+
R.value = R.value.add(z.value === "year" ? e * 12 : e, "year"), F("panel-change", R.value);
|
|
243
|
+
}
|
|
244
|
+
function wt(e) {
|
|
245
|
+
e !== z.value && (z.value = e);
|
|
246
|
+
}
|
|
247
|
+
function Tt(e) {
|
|
248
|
+
if (J(e)) return;
|
|
249
|
+
let t = q.value, n = e.hour(t.hour()).minute(t.minute()).second(Ie.value ? t.second() : 0).millisecond(0);
|
|
250
|
+
if (H.value) {
|
|
251
|
+
L.value = ht(n);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
Q(n, !0);
|
|
255
|
+
}
|
|
256
|
+
function Et(e) {
|
|
257
|
+
if (!Y(e)) {
|
|
258
|
+
if (V.value === "date") {
|
|
259
|
+
R.value = R.value.year(e.year()).month(e.month()).startOf("month"), z.value = "date", F("panel-change", R.value);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
Q(e, !0);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function Dt(e) {
|
|
266
|
+
if (!ft(e)) {
|
|
267
|
+
if (V.value !== "year") {
|
|
268
|
+
R.value = R.value.year(e.year()).startOf("month"), z.value = "month", F("panel-change", R.value);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
Q(e, !0);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function Ot(e, t) {
|
|
275
|
+
if (Z(e, t)) return;
|
|
276
|
+
let n = L.value || W.value || v(), r = n;
|
|
277
|
+
e === "hour" && (r = n.hour(t)), e === "minute" && (r = n.minute(t)), e === "second" && (r = n.second(t)), L.value = ht(r) || r;
|
|
278
|
+
}
|
|
279
|
+
function kt() {
|
|
280
|
+
let e = v().millisecond(0);
|
|
281
|
+
if (H.value) {
|
|
282
|
+
L.value = ht(e), R.value = e.startOf("month");
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
Q(e, !0);
|
|
286
|
+
}
|
|
287
|
+
function At() {
|
|
288
|
+
Q(L.value || W.value || v(), !0, !0);
|
|
289
|
+
}
|
|
290
|
+
function jt(e, t) {
|
|
291
|
+
let n = q.value;
|
|
292
|
+
return e === "hour" ? n.hour() === t : e === "minute" ? n.minute() === t : n.second() === t;
|
|
293
|
+
}
|
|
294
|
+
function Mt(e) {
|
|
295
|
+
return X({
|
|
296
|
+
inMonth: e.inMonth,
|
|
297
|
+
selected: e.selected,
|
|
298
|
+
today: e.today,
|
|
299
|
+
disabled: e.disabled
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function Nt(e) {
|
|
303
|
+
return dt({
|
|
304
|
+
selected: e.selected,
|
|
305
|
+
current: e.current,
|
|
306
|
+
disabled: e.disabled,
|
|
307
|
+
muted: e.muted
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function Pt() {
|
|
311
|
+
Ae.value?.focus();
|
|
312
|
+
}
|
|
313
|
+
function Ft() {
|
|
314
|
+
Ae.value?.blur();
|
|
315
|
+
}
|
|
316
|
+
return _(() => [H.value, Ne.value], () => {
|
|
317
|
+
ie(() => {
|
|
318
|
+
!H.value && L.value && (L.value = ht(L.value));
|
|
319
|
+
});
|
|
320
|
+
}), i({
|
|
321
|
+
blur: Ft,
|
|
322
|
+
clear: gt,
|
|
323
|
+
focus: Pt
|
|
324
|
+
}), (i, o) => (f(), ee(g(r), {
|
|
325
|
+
open: I.value,
|
|
326
|
+
"onUpdate:open": o[7] ||= (e) => I.value = e,
|
|
327
|
+
width: Le.value,
|
|
328
|
+
"min-width": Le.value,
|
|
329
|
+
"focus-on-open": !1,
|
|
330
|
+
"content-class": "ui-datepicker-dropdown"
|
|
331
|
+
}, {
|
|
332
|
+
trigger: oe(() => [l("div", re({
|
|
333
|
+
ref_key: "triggerRef",
|
|
334
|
+
ref: Ae
|
|
335
|
+
}, g(n)(g(Oe)), {
|
|
336
|
+
class: qe.value,
|
|
337
|
+
style: g(Oe).style,
|
|
338
|
+
"data-ui-datepicker": "true",
|
|
339
|
+
tabindex: e.disabled ? void 0 : 0,
|
|
340
|
+
role: "combobox",
|
|
341
|
+
"aria-expanded": I.value,
|
|
342
|
+
"aria-haspopup": "dialog",
|
|
343
|
+
onClick: se(vt, ["stop"]),
|
|
344
|
+
onKeydown: yt,
|
|
345
|
+
onFocus: bt,
|
|
346
|
+
onBlur: xt
|
|
347
|
+
}), [
|
|
348
|
+
l("span", {
|
|
349
|
+
class: d(g(ut)({ size: e.size })),
|
|
350
|
+
title: Re.value
|
|
351
|
+
}, [l("span", { class: d(Re.value ? "text-primary" : "text-tertiary/60") }, h(Re.value || Fe.value), 3)], 10, b),
|
|
352
|
+
e.name ? (f(), c("input", {
|
|
353
|
+
key: 0,
|
|
354
|
+
type: "hidden",
|
|
355
|
+
name: e.name,
|
|
356
|
+
value: ze.value
|
|
357
|
+
}, null, 8, ue)) : s("", !0),
|
|
358
|
+
l("span", x, [Ve.value ? (f(), c("button", {
|
|
359
|
+
key: 0,
|
|
360
|
+
type: "button",
|
|
361
|
+
"aria-label": "清空",
|
|
362
|
+
class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-datepicker:opacity-100 group-focus-within/ui-datepicker:opacity-100",
|
|
363
|
+
onClick: gt
|
|
364
|
+
}, [l("span", { class: d([e.clearIcon, "size-3"]) }, null, 2)])) : s("", !0), l("span", { class: d([e.suffixIcon, "size-4"]) }, null, 2)])
|
|
365
|
+
], 16, y)]),
|
|
366
|
+
default: oe(() => [l("div", de, [l("div", { class: d(["grid", H.value ? "grid-cols-[minmax(0,1fr)_136px]" : "grid-cols-1"]) }, [l("div", S, [l("div", C, [
|
|
367
|
+
l("div", w, [l("button", {
|
|
368
|
+
type: "button",
|
|
369
|
+
class: d(P),
|
|
370
|
+
"aria-label": "上一年",
|
|
371
|
+
onClick: o[0] ||= (e) => Ct(-1)
|
|
372
|
+
}, [...o[8] ||= [l("span", { class: "i-lucide:chevrons-left size-4" }, null, -1)]]), z.value === "date" ? (f(), c("button", {
|
|
373
|
+
key: 0,
|
|
374
|
+
type: "button",
|
|
375
|
+
class: d(P),
|
|
376
|
+
"aria-label": "上一月",
|
|
377
|
+
onClick: o[1] ||= (e) => St(-1)
|
|
378
|
+
}, [...o[9] ||= [l("span", { class: "i-lucide:chevron-left size-4" }, null, -1)]])) : s("", !0)]),
|
|
379
|
+
l("div", T, [z.value === "date" ? (f(), c(a, { key: 0 }, [l("button", {
|
|
380
|
+
type: "button",
|
|
381
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
382
|
+
onClick: o[2] ||= (e) => wt("year")
|
|
383
|
+
}, h(Ge.value), 1), l("button", {
|
|
384
|
+
type: "button",
|
|
385
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
386
|
+
onClick: o[3] ||= (e) => wt("month")
|
|
387
|
+
}, h(Ke.value), 1)], 64)) : z.value === "month" ? (f(), c("button", {
|
|
388
|
+
key: 1,
|
|
389
|
+
type: "button",
|
|
390
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
391
|
+
onClick: o[4] ||= (e) => wt("year")
|
|
392
|
+
}, h(We.value), 1)) : (f(), c("span", E, h(We.value), 1))]),
|
|
393
|
+
l("div", D, [z.value === "date" ? (f(), c("button", {
|
|
394
|
+
key: 0,
|
|
395
|
+
type: "button",
|
|
396
|
+
class: d(P),
|
|
397
|
+
"aria-label": "下一月",
|
|
398
|
+
onClick: o[5] ||= (e) => St(1)
|
|
399
|
+
}, [...o[10] ||= [l("span", { class: "i-lucide:chevron-right size-4" }, null, -1)]])) : s("", !0), l("button", {
|
|
400
|
+
type: "button",
|
|
401
|
+
class: d(P),
|
|
402
|
+
"aria-label": "下一年",
|
|
403
|
+
onClick: o[6] ||= (e) => Ct(1)
|
|
404
|
+
}, [...o[11] ||= [l("span", { class: "i-lucide:chevrons-right size-4" }, null, -1)]])])
|
|
405
|
+
]), z.value === "date" ? (f(), c("div", O, [(f(), c(a, null, m(je, (e) => l("div", {
|
|
406
|
+
key: e,
|
|
407
|
+
class: "flex h-6 items-center justify-center text-xs font-medium text-tertiary"
|
|
408
|
+
}, h(e), 1)), 64)), (f(!0), c(a, null, m(Je.value, (e) => (f(), c("button", {
|
|
409
|
+
key: e.key,
|
|
410
|
+
type: "button",
|
|
411
|
+
class: d(Mt(e)),
|
|
412
|
+
disabled: e.disabled,
|
|
413
|
+
onClick: (t) => Tt(e.date)
|
|
414
|
+
}, h(e.date.date()), 11, fe))), 128))])) : z.value === "month" ? (f(), c("div", pe, [(f(!0), c(a, null, m(Ye.value, (e) => (f(), c("button", {
|
|
415
|
+
key: e.key,
|
|
416
|
+
type: "button",
|
|
417
|
+
class: d(Nt(e)),
|
|
418
|
+
disabled: e.disabled,
|
|
419
|
+
onClick: (t) => Et(e.date)
|
|
420
|
+
}, h(e.label), 11, me))), 128))])) : (f(), c("div", he, [(f(!0), c(a, null, m(Xe.value, (e) => (f(), c("button", {
|
|
421
|
+
key: e.key,
|
|
422
|
+
type: "button",
|
|
423
|
+
class: d(Nt(e)),
|
|
424
|
+
disabled: e.disabled,
|
|
425
|
+
onClick: (t) => Dt(e.date)
|
|
426
|
+
}, h(e.label), 11, ge))), 128))]))]), H.value ? (f(), c("div", {
|
|
427
|
+
key: 0,
|
|
428
|
+
class: d(["grid min-w-0 border-l border-medium", Ie.value ? "grid-cols-3" : "grid-cols-2"])
|
|
429
|
+
}, [
|
|
430
|
+
l("div", k, [o[12] ||= l("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "时", -1), l("div", _e, [(f(!0), c(a, null, m(Ze.value, (e) => (f(), c("button", {
|
|
431
|
+
key: e,
|
|
432
|
+
type: "button",
|
|
433
|
+
class: d(g(pt)({
|
|
434
|
+
selected: jt("hour", e),
|
|
435
|
+
disabled: Z("hour", e)
|
|
436
|
+
})),
|
|
437
|
+
disabled: Z("hour", e),
|
|
438
|
+
onClick: (t) => Ot("hour", e)
|
|
439
|
+
}, h(String(e).padStart(2, "0")), 11, A))), 128))])]),
|
|
440
|
+
l("div", { class: d(["min-w-0", Ie.value ? "border-r border-medium" : ""]) }, [o[13] ||= l("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "分", -1), l("div", j, [(f(!0), c(a, null, m(Qe.value, (e) => (f(), c("button", {
|
|
441
|
+
key: e,
|
|
442
|
+
type: "button",
|
|
443
|
+
class: d(g(pt)({
|
|
444
|
+
selected: jt("minute", e),
|
|
445
|
+
disabled: Z("minute", e)
|
|
446
|
+
})),
|
|
447
|
+
disabled: Z("minute", e),
|
|
448
|
+
onClick: (t) => Ot("minute", e)
|
|
449
|
+
}, h(String(e).padStart(2, "0")), 11, ve))), 128))])], 2),
|
|
450
|
+
Ie.value ? (f(), c("div", ye, [o[14] ||= l("div", { class: "h-8 border-b border-medium text-center text-xs/8 text-tertiary" }, "秒", -1), l("div", be, [(f(!0), c(a, null, m($e.value, (e) => (f(), c("button", {
|
|
451
|
+
key: e,
|
|
452
|
+
type: "button",
|
|
453
|
+
class: d(g(pt)({
|
|
454
|
+
selected: jt("second", e),
|
|
455
|
+
disabled: Z("second", e)
|
|
456
|
+
})),
|
|
457
|
+
disabled: Z("second", e),
|
|
458
|
+
onClick: (t) => Ot("second", e)
|
|
459
|
+
}, h(String(e).padStart(2, "0")), 11, M))), 128))])])) : s("", !0)
|
|
460
|
+
], 2)) : s("", !0)], 2), l("div", xe, [l("button", {
|
|
461
|
+
type: "button",
|
|
462
|
+
class: "text-xs text-brand-500 transition-colors hover:text-brand-600 disabled:pointer-events-none disabled:opacity-40",
|
|
463
|
+
disabled: Ue.value,
|
|
464
|
+
onClick: kt
|
|
465
|
+
}, h(H.value ? "此刻" : V.value === "year" ? "今年" : V.value === "month" ? "本月" : "今天"), 9, Se), l("div", Ce, [H.value ? (f(), c("span", we, h((L.value || W.value || g(v)()).format(U.value)), 1)) : s("", !0), H.value ? (f(), ee(g(t), {
|
|
466
|
+
key: 1,
|
|
467
|
+
size: "sm",
|
|
468
|
+
onClick: At
|
|
469
|
+
}, {
|
|
470
|
+
default: oe(() => [...o[15] ||= [te("确定", -1)]]),
|
|
471
|
+
_: 1
|
|
472
|
+
})) : s("", !0)])])])]),
|
|
473
|
+
_: 1
|
|
474
|
+
}, 8, [
|
|
475
|
+
"open",
|
|
476
|
+
"width",
|
|
477
|
+
"min-width"
|
|
478
|
+
]));
|
|
479
|
+
}
|
|
480
|
+
}), Oe = ["tabindex", "aria-expanded"], I = ["title"], ke = ["data-ui-range-picker-side-active"], L = ["data-ui-range-picker-side-active"], R = ["name", "value"], z = { class: "flex shrink-0 items-center gap-1 pr-2 text-tertiary" }, Ae = { class: "select-none bg-primary text-primary" }, je = {
|
|
481
|
+
key: 0,
|
|
482
|
+
class: "grid grid-cols-1 gap-0 sm:grid-cols-[minmax(0,1fr)_216px]"
|
|
483
|
+
}, Me = {
|
|
484
|
+
class: "min-w-0",
|
|
485
|
+
"data-ui-range-picker-panel": "active"
|
|
486
|
+
}, B = { class: "flex h-11 items-center justify-between gap-2 border-b border-medium px-2" }, Ne = { class: "min-w-0 truncate text-sm font-bold text-primary" }, V = {
|
|
487
|
+
key: 0,
|
|
488
|
+
class: "grid grid-cols-7 gap-1 px-3 pb-3 pt-3"
|
|
489
|
+
}, Pe = [
|
|
490
|
+
"disabled",
|
|
491
|
+
"data-ui-range-picker-date-cell",
|
|
492
|
+
"data-ui-range-picker-date-selected",
|
|
493
|
+
"data-ui-range-picker-date-in-range",
|
|
494
|
+
"onClick"
|
|
495
|
+
], H = {
|
|
496
|
+
key: 1,
|
|
497
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
498
|
+
}, U = ["disabled", "onClick"], Fe = {
|
|
499
|
+
key: 2,
|
|
500
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
501
|
+
}, Ie = ["disabled", "onClick"], Le = { class: "flex h-11 items-center justify-center border-b border-medium text-xs font-medium text-tertiary" }, W = ["data-ui-range-picker-time-column", "data-ui-range-picker-time-side"], Re = [
|
|
502
|
+
"disabled",
|
|
503
|
+
"data-ui-range-picker-time-option",
|
|
504
|
+
"data-ui-range-picker-time-value",
|
|
505
|
+
"data-ui-range-picker-time-side",
|
|
506
|
+
"data-ui-range-picker-time-selected",
|
|
507
|
+
"onClick"
|
|
508
|
+
], ze = {
|
|
509
|
+
key: 1,
|
|
510
|
+
class: "grid grid-cols-2 gap-0"
|
|
511
|
+
}, Be = {
|
|
512
|
+
class: "min-w-0 border-r border-medium",
|
|
513
|
+
"data-ui-range-picker-panel": "left"
|
|
514
|
+
}, Ve = { class: "flex h-11 items-center justify-between gap-2 border-b border-medium px-2" }, He = { class: "min-w-0 truncate text-sm font-bold text-primary" }, G = { key: 2 }, K = {
|
|
515
|
+
key: 0,
|
|
516
|
+
class: "grid grid-cols-7 gap-1 px-3 pb-2 pt-3"
|
|
517
|
+
}, q = [
|
|
518
|
+
"disabled",
|
|
519
|
+
"data-ui-range-picker-date-cell",
|
|
520
|
+
"data-ui-range-picker-date-selected",
|
|
521
|
+
"data-ui-range-picker-date-in-range",
|
|
522
|
+
"onClick"
|
|
523
|
+
], Ue = {
|
|
524
|
+
key: 1,
|
|
525
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
526
|
+
}, We = ["disabled", "onClick"], Ge = {
|
|
527
|
+
key: 2,
|
|
528
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
529
|
+
}, Ke = ["disabled", "onClick"], qe = {
|
|
530
|
+
class: "min-w-0",
|
|
531
|
+
"data-ui-range-picker-panel": "right"
|
|
532
|
+
}, Je = { class: "flex h-11 items-center justify-between gap-2 border-b border-medium px-2" }, Ye = { class: "min-w-0 truncate text-sm font-bold text-primary" }, Xe = { key: 2 }, Ze = {
|
|
533
|
+
key: 0,
|
|
534
|
+
class: "grid grid-cols-7 gap-1 px-3 pb-2 pt-3"
|
|
535
|
+
}, Qe = [
|
|
536
|
+
"disabled",
|
|
537
|
+
"data-ui-range-picker-date-cell",
|
|
538
|
+
"data-ui-range-picker-date-selected",
|
|
539
|
+
"data-ui-range-picker-date-in-range",
|
|
540
|
+
"onClick"
|
|
541
|
+
], $e = {
|
|
542
|
+
key: 1,
|
|
543
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
544
|
+
}, et = ["disabled", "onClick"], tt = {
|
|
545
|
+
key: 2,
|
|
546
|
+
class: "grid grid-cols-3 gap-2 p-3"
|
|
547
|
+
}, nt = ["disabled", "onClick"], rt = {
|
|
548
|
+
key: 2,
|
|
549
|
+
class: "border-t border-medium"
|
|
550
|
+
}, it = { class: "flex min-h-12 items-center justify-end border-t border-medium px-3 py-2" }, at = "YYYY-MM-DD", ot = "YYYY-MM", st = "YYYY", ct = "HH:mm:ss", J = "flex size-7 items-center justify-center rounded text-tertiary transition-colors hover:bg-secondary hover:text-primary", Y = /* @__PURE__ */ u({
|
|
551
|
+
inheritAttrs: !1,
|
|
552
|
+
__name: "RangePicker",
|
|
553
|
+
props: {
|
|
554
|
+
modelValue: { default: void 0 },
|
|
555
|
+
picker: { default: "date" },
|
|
556
|
+
format: { default: void 0 },
|
|
557
|
+
valueFormat: { default: void 0 },
|
|
558
|
+
placeholder: { default: void 0 },
|
|
559
|
+
separatorIcon: { default: "i-ant-design:swap-right-outlined" },
|
|
560
|
+
size: { default: "md" },
|
|
561
|
+
disabled: {
|
|
562
|
+
type: Boolean,
|
|
563
|
+
default: !1
|
|
564
|
+
},
|
|
565
|
+
clearable: {
|
|
566
|
+
type: Boolean,
|
|
567
|
+
default: !1
|
|
568
|
+
},
|
|
569
|
+
showTime: {
|
|
570
|
+
type: [Boolean, Object],
|
|
571
|
+
default: !1
|
|
572
|
+
},
|
|
573
|
+
disabledDate: {
|
|
574
|
+
type: Function,
|
|
575
|
+
default: void 0
|
|
576
|
+
},
|
|
577
|
+
minDate: { default: void 0 },
|
|
578
|
+
maxDate: { default: void 0 },
|
|
579
|
+
suffixIcon: { default: "i-lucide:calendar-range" },
|
|
580
|
+
clearIcon: { default: "i-lucide:x" },
|
|
581
|
+
teleportedWidth: { default: void 0 },
|
|
582
|
+
name: { default: void 0 }
|
|
583
|
+
},
|
|
584
|
+
emits: [
|
|
585
|
+
"update:modelValue",
|
|
586
|
+
"change",
|
|
587
|
+
"clear",
|
|
588
|
+
"ok",
|
|
589
|
+
"visible-change",
|
|
590
|
+
"calendar-change",
|
|
591
|
+
"panel-change",
|
|
592
|
+
"focus",
|
|
593
|
+
"blur"
|
|
594
|
+
],
|
|
595
|
+
setup(e, { expose: i, emit: u }) {
|
|
596
|
+
v.extend(le);
|
|
597
|
+
let y = e, b = u, ue = ae(), x = p(!1), de = p(!1), S = p("start"), C = p(null), w = p([null, null]), T = p(v().startOf("month")), E = p(v().add(1, "month").startOf("month")), D = p("date"), O = p("date"), fe = p(null), pe = [
|
|
598
|
+
"一",
|
|
599
|
+
"二",
|
|
600
|
+
"三",
|
|
601
|
+
"四",
|
|
602
|
+
"五",
|
|
603
|
+
"六",
|
|
604
|
+
"日"
|
|
605
|
+
], me = o(() => !!y.showTime), he = o(() => typeof y.showTime == "object" ? y.showTime : {}), ge = o(() => he.value.format || ct), k = o(() => y.picker || "date"), _e = o(() => k.value === "year" ? st : k.value === "month" ? ot : at), A = o(() => k.value === "date" && me.value), j = o(() => y.format || (A.value ? `${at} ${ge.value}` : _e.value)), ve = o(() => A.value ? ["开始日期时间", "结束日期时间"] : k.value === "year" ? ["开始年份", "结束年份"] : k.value === "month" ? ["开始月份", "结束月份"] : ["开始日期", "结束日期"]), ye = o(() => y.placeholder || ve.value), be = o(() => y.teleportedWidth || (k.value === "date" ? "min(640px, calc(100vw - 24px))" : "min(520px, calc(100vw - 24px))")), M = o(() => Nt(y.modelValue)), xe = o(() => w.value), Se = o(() => Pt(xe.value)), Ce = o(() => x.value ? w.value : M.value), we = o(() => !!(M.value[0] || M.value[1])), N = o(() => Ce.value[0]?.format(j.value) || ""), Te = o(() => Ce.value[1]?.format(j.value) || ""), Ee = o(() => [N.value, Te.value].filter(Boolean).join(",")), De = o(() => y.clearable && we.value && !y.disabled), P = o(() => he.value.showSecond ?? ge.value.includes("ss")), F = o(() => P.value ? [
|
|
606
|
+
"hour",
|
|
607
|
+
"minute",
|
|
608
|
+
"second"
|
|
609
|
+
] : ["hour", "minute"]), Y = o(() => Mt(y.minDate)), X = o(() => Mt(y.maxDate)), mt = o(() => !w.value[Wt(S.value)]), Z = o(() => {
|
|
610
|
+
let [e, t] = w.value;
|
|
611
|
+
return S.value === "start" ? !!e : !!(e && t);
|
|
612
|
+
}), ht = o(() => ce(ue.class, lt({
|
|
613
|
+
size: y.size,
|
|
614
|
+
focused: x.value || de.value,
|
|
615
|
+
disabled: y.disabled
|
|
616
|
+
}))), Q = o(() => y.size === "sm" ? "py-1 text-sm/5" : y.size === "lg" ? "py-1.5 text-base/6" : "py-1.5 text-sm/5"), gt = o(() => [T.value, E.value]), _t = o(() => Bt(T.value, D.value)), vt = o(() => Bt(E.value, O.value)), yt = o(() => T.value.format("YYYY年")), bt = o(() => E.value.format("YYYY年")), xt = o(() => T.value.format("M月")), St = o(() => E.value.format("M月")), Ct = o(() => rn(T.value)), wt = o(() => rn(E.value)), Tt = o(() => an(T.value)), Et = o(() => an(E.value)), Dt = o(() => on(T.value)), Ot = o(() => on(E.value));
|
|
617
|
+
_(() => y.modelValue, () => {
|
|
618
|
+
let e = M.value;
|
|
619
|
+
x.value || (w.value = e, ln(e));
|
|
620
|
+
}, { immediate: !0 }), _(x, (e) => {
|
|
621
|
+
b("visible-change", e), e && (w.value = M.value, S.value = C.value || (M.value[0] && !M.value[1] ? "end" : "start"), C.value = null, ln(M.value), D.value = k.value, O.value = k.value, un(), kt());
|
|
622
|
+
}), _(S, () => {
|
|
623
|
+
x.value && (un(), A.value && kt());
|
|
624
|
+
});
|
|
625
|
+
function kt() {
|
|
626
|
+
ie(() => {
|
|
627
|
+
document.querySelectorAll(".ui-datepicker-dropdown [data-ui-range-picker-time-column]").forEach((e) => {
|
|
628
|
+
let t = e.querySelector("[data-ui-range-picker-time-selected=\"true\"]");
|
|
629
|
+
t && (e.scrollTop = Math.max(0, t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2));
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
function At(e, t) {
|
|
634
|
+
for (let n of t) {
|
|
635
|
+
let t = v(e, n, !0);
|
|
636
|
+
if (t.isValid()) return t;
|
|
637
|
+
}
|
|
638
|
+
let n = v(e);
|
|
639
|
+
return n.isValid() ? n : null;
|
|
640
|
+
}
|
|
641
|
+
function jt() {
|
|
642
|
+
return Array.from(new Set([
|
|
643
|
+
y.valueFormat,
|
|
644
|
+
j.value,
|
|
645
|
+
y.format,
|
|
646
|
+
`${at} ${ct}`,
|
|
647
|
+
`${at} HH:mm`,
|
|
648
|
+
at,
|
|
649
|
+
ot,
|
|
650
|
+
st,
|
|
651
|
+
"YYYY/MM/DD HH:mm:ss",
|
|
652
|
+
"YYYY/MM/DD",
|
|
653
|
+
"YYYY/MM"
|
|
654
|
+
].filter(Boolean)));
|
|
655
|
+
}
|
|
656
|
+
function Mt(e) {
|
|
657
|
+
if (e == null || e === "") return null;
|
|
658
|
+
if (v.isDayjs(e)) return e.isValid() ? e.millisecond(0) : null;
|
|
659
|
+
if (e instanceof Date || typeof e == "number") {
|
|
660
|
+
let t = v(e);
|
|
661
|
+
return t.isValid() ? t.millisecond(0) : null;
|
|
662
|
+
}
|
|
663
|
+
return typeof e == "string" ? At(e, jt())?.millisecond(0) ?? null : null;
|
|
664
|
+
}
|
|
665
|
+
function Nt(e) {
|
|
666
|
+
return Array.isArray(e) ? Pt([Mt(e[0]), Mt(e[1])]) : [null, null];
|
|
667
|
+
}
|
|
668
|
+
function Pt(e) {
|
|
669
|
+
let [t, n] = e;
|
|
670
|
+
return t && n && t.isAfter(n) ? [n, t] : [t, n];
|
|
671
|
+
}
|
|
672
|
+
function Ft(e, t) {
|
|
673
|
+
let n = Vt(e);
|
|
674
|
+
return n ? y.valueFormat ? n.format(y.valueFormat) : v.isDayjs(t) ? n : t instanceof Date ? n.toDate() : typeof t == "number" ? n.valueOf() : n.format(j.value) : null;
|
|
675
|
+
}
|
|
676
|
+
function It(e) {
|
|
677
|
+
return Array.isArray(y.modelValue) ? y.modelValue[e] : void 0;
|
|
678
|
+
}
|
|
679
|
+
function Lt(e) {
|
|
680
|
+
let t = e.day(), n = t === 0 ? 6 : t - 1;
|
|
681
|
+
return e.subtract(n, "day").startOf("day");
|
|
682
|
+
}
|
|
683
|
+
function Rt(e) {
|
|
684
|
+
return Math.floor(e.year() / 12) * 12;
|
|
685
|
+
}
|
|
686
|
+
function zt() {
|
|
687
|
+
return k.value === "year" ? "year" : k.value === "month" ? "month" : "day";
|
|
688
|
+
}
|
|
689
|
+
function Bt(e, t) {
|
|
690
|
+
if (t === "year") {
|
|
691
|
+
let t = Rt(e);
|
|
692
|
+
return `${t} - ${t + 11}`;
|
|
693
|
+
}
|
|
694
|
+
return t === "month" ? e.format("YYYY年") : e.format("YYYY年M月");
|
|
695
|
+
}
|
|
696
|
+
function Vt(e) {
|
|
697
|
+
if (k.value === "year") return e.startOf("year").millisecond(0);
|
|
698
|
+
if (k.value === "month") return e.startOf("month").millisecond(0);
|
|
699
|
+
if (!A.value) return e.startOf("day").millisecond(0);
|
|
700
|
+
let t = e;
|
|
701
|
+
return Y.value && t.isBefore(Y.value) && (t = Y.value), X.value && t.isAfter(X.value) && (t = X.value), t.millisecond(0);
|
|
702
|
+
}
|
|
703
|
+
function Ht(e, t) {
|
|
704
|
+
let n = Number.isFinite(e) && e && e > 0 ? Math.floor(e) : 1, r = [];
|
|
705
|
+
for (let e = 0; e <= t; e += n) r.push(e);
|
|
706
|
+
return r;
|
|
707
|
+
}
|
|
708
|
+
function Ut(e, t, n) {
|
|
709
|
+
let r = Math.min(n, Math.max(0, t));
|
|
710
|
+
return e.includes(r) ? e : [...e, r].sort((e, t) => e - t);
|
|
711
|
+
}
|
|
712
|
+
function Wt(e) {
|
|
713
|
+
return e === "start" ? 0 : 1;
|
|
714
|
+
}
|
|
715
|
+
function Gt(e) {
|
|
716
|
+
let t = Wt(e);
|
|
717
|
+
return w.value[t] || M.value[t] || v();
|
|
718
|
+
}
|
|
719
|
+
function Kt(e, t) {
|
|
720
|
+
let n = Gt(t);
|
|
721
|
+
return Vt(e.hour(n.hour()).minute(n.minute()).second(P.value ? n.second() : 0).millisecond(0));
|
|
722
|
+
}
|
|
723
|
+
function qt(e, t) {
|
|
724
|
+
let n = Gt(e);
|
|
725
|
+
return t === "hour" ? n.hour() : t === "minute" ? n.minute() : n.second();
|
|
726
|
+
}
|
|
727
|
+
function Jt(e, t) {
|
|
728
|
+
let n = Gt(e);
|
|
729
|
+
return t === "hour" ? Ut(Ht(he.value.hourStep, 23), n.hour(), 23) : t === "minute" ? Ut(Ht(he.value.minuteStep, 59), n.minute(), 59) : Ut(Ht(he.value.secondStep, 59), n.second(), 59);
|
|
730
|
+
}
|
|
731
|
+
function Yt(e, t, n) {
|
|
732
|
+
let r = w.value[Wt(e)];
|
|
733
|
+
return r ? t === "hour" ? r.hour(n) : t === "minute" ? r.minute(n) : r.second(n) : null;
|
|
734
|
+
}
|
|
735
|
+
function Xt(e, t, n) {
|
|
736
|
+
return qt(e, t) === n;
|
|
737
|
+
}
|
|
738
|
+
function Zt(e, t, n) {
|
|
739
|
+
let r = Yt(e, t, n);
|
|
740
|
+
if (!r || Y.value && r.isBefore(Y.value) || X.value && r.isAfter(X.value)) return !0;
|
|
741
|
+
let [i, a] = w.value;
|
|
742
|
+
return !!(e === "start" && a && r.isAfter(a) || e === "end" && i && r.isBefore(i));
|
|
743
|
+
}
|
|
744
|
+
function Qt(e) {
|
|
745
|
+
return !!(y.disabledDate?.(e) || Y.value && e.isBefore(Y.value, "day") || X.value && e.isAfter(X.value, "day"));
|
|
746
|
+
}
|
|
747
|
+
function $t(e) {
|
|
748
|
+
let t = e.startOf("month"), n = e.endOf("month");
|
|
749
|
+
return Y.value && n.isBefore(Y.value, "day") || X.value && t.isAfter(X.value, "day") ? !0 : !!(y.disabledDate?.(t) && y.disabledDate?.(n));
|
|
750
|
+
}
|
|
751
|
+
function en(e) {
|
|
752
|
+
let t = e.startOf("year"), n = e.endOf("year");
|
|
753
|
+
return Y.value && n.isBefore(Y.value, "day") || X.value && t.isAfter(X.value, "day") ? !0 : !!(y.disabledDate?.(t) && y.disabledDate?.(n));
|
|
754
|
+
}
|
|
755
|
+
function tn(e) {
|
|
756
|
+
if (k.value === "year" && en(e) || k.value === "month" && $t(e) || k.value === "date" && Qt(e)) return !0;
|
|
757
|
+
let t = w.value[0];
|
|
758
|
+
return !!(S.value === "end" && t && e.isBefore(t, zt()));
|
|
759
|
+
}
|
|
760
|
+
function nn(e) {
|
|
761
|
+
let t = zt();
|
|
762
|
+
if (A.value) {
|
|
763
|
+
let n = !!xe.value[Wt(S.value)]?.isSame(e, t);
|
|
764
|
+
return {
|
|
765
|
+
selected: n,
|
|
766
|
+
inRange: !1,
|
|
767
|
+
rangeStart: !1,
|
|
768
|
+
rangeEnd: !1,
|
|
769
|
+
standalone: n
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
let [n, r] = Se.value, i = !!n?.isSame(e, t), a = !!r?.isSame(e, t), o = i || a;
|
|
773
|
+
return {
|
|
774
|
+
selected: o,
|
|
775
|
+
inRange: !!(n && r && e.isAfter(n, t) && e.isBefore(r, t)),
|
|
776
|
+
rangeStart: i,
|
|
777
|
+
rangeEnd: a,
|
|
778
|
+
standalone: o && (!n || !r || n.isSame(r, t))
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function rn(e) {
|
|
782
|
+
let t = Lt(e.startOf("month"));
|
|
783
|
+
return Array.from({ length: 42 }, (n, r) => {
|
|
784
|
+
let i = t.add(r, "day"), a = i.isSame(e, "month"), o = a ? nn(i) : {
|
|
785
|
+
selected: !1,
|
|
786
|
+
inRange: !1,
|
|
787
|
+
rangeStart: !1,
|
|
788
|
+
rangeEnd: !1,
|
|
789
|
+
standalone: !1
|
|
790
|
+
};
|
|
791
|
+
return {
|
|
792
|
+
date: i,
|
|
793
|
+
key: i.format("YYYY-MM-DD"),
|
|
794
|
+
inMonth: a,
|
|
795
|
+
today: i.isSame(v(), "day"),
|
|
796
|
+
disabled: tn(i),
|
|
797
|
+
...o
|
|
798
|
+
};
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
function an(e) {
|
|
802
|
+
let t = v();
|
|
803
|
+
return Array.from({ length: 12 }, (n, r) => {
|
|
804
|
+
let i = e.month(r).startOf("month"), a = nn(i);
|
|
805
|
+
return {
|
|
806
|
+
date: i,
|
|
807
|
+
key: i.format("YYYY-MM"),
|
|
808
|
+
label: `${r + 1}月`,
|
|
809
|
+
current: t.isSame(i, "month"),
|
|
810
|
+
disabled: k.value === "month" ? tn(i) : $t(i),
|
|
811
|
+
...a
|
|
812
|
+
};
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
function on(e) {
|
|
816
|
+
let t = v(), n = Rt(e);
|
|
817
|
+
return Array.from({ length: 12 }, (r, i) => {
|
|
818
|
+
let a = e.year(n + i).startOf("year"), o = nn(a);
|
|
819
|
+
return {
|
|
820
|
+
date: a,
|
|
821
|
+
key: a.format("YYYY"),
|
|
822
|
+
label: a.format("YYYY"),
|
|
823
|
+
current: t.isSame(a, "year"),
|
|
824
|
+
disabled: k.value === "year" ? tn(a) : en(a),
|
|
825
|
+
...o
|
|
826
|
+
};
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
function sn(e) {
|
|
830
|
+
return ce(ft({
|
|
831
|
+
inMonth: e.inMonth,
|
|
832
|
+
selected: e.selected,
|
|
833
|
+
inRange: e.inRange,
|
|
834
|
+
rangeStart: e.rangeStart,
|
|
835
|
+
rangeEnd: e.rangeEnd,
|
|
836
|
+
standalone: e.standalone,
|
|
837
|
+
today: e.today,
|
|
838
|
+
disabled: e.disabled
|
|
839
|
+
}), A.value ? "h-10 text-sm" : "");
|
|
840
|
+
}
|
|
841
|
+
function cn(e) {
|
|
842
|
+
return ce(dt({
|
|
843
|
+
selected: e.selected,
|
|
844
|
+
current: e.current,
|
|
845
|
+
disabled: e.disabled,
|
|
846
|
+
muted: !1
|
|
847
|
+
}), e.inRange && !e.selected ? "bg-brand-500/10 text-brand-500" : "", e.rangeStart ? "rounded-r-sm" : "", e.rangeEnd ? "rounded-l-sm" : "");
|
|
848
|
+
}
|
|
849
|
+
function ln(e) {
|
|
850
|
+
let t = e[0] || v(), n = e[1];
|
|
851
|
+
if (k.value === "year") {
|
|
852
|
+
T.value = t.startOf("year");
|
|
853
|
+
let e = Math.max(Rt(t) + 12, Rt(n || t.add(12, "year")));
|
|
854
|
+
E.value = t.year(e).startOf("year");
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
if (k.value === "month") {
|
|
858
|
+
T.value = t.startOf("year"), E.value = (n || t.add(1, "year")).startOf("year"), E.value.isAfter(T.value, "year") || (E.value = T.value.add(1, "year"));
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
T.value = t.startOf("month"), E.value = (n || t.add(1, "month")).startOf("month"), E.value.isAfter(T.value, "month") || (E.value = T.value.add(1, "month"));
|
|
862
|
+
}
|
|
863
|
+
function un() {
|
|
864
|
+
if (!A.value) return;
|
|
865
|
+
let e = w.value[Wt(S.value)] || w.value[0] || w.value[1];
|
|
866
|
+
e && (T.value = e.startOf("month"));
|
|
867
|
+
}
|
|
868
|
+
function dn(e) {
|
|
869
|
+
return [e[0]?.format(j.value) || "", e[1]?.format(j.value) || ""];
|
|
870
|
+
}
|
|
871
|
+
function fn(e) {
|
|
872
|
+
let t = Pt(e);
|
|
873
|
+
w.value = t, b("calendar-change", pn(t), dn(t));
|
|
874
|
+
}
|
|
875
|
+
function pn(e) {
|
|
876
|
+
let [t, n] = Pt(e);
|
|
877
|
+
return !t && !n ? null : [t ? Ft(t, It(0)) : null, n ? Ft(n, It(1)) : null];
|
|
878
|
+
}
|
|
879
|
+
function mn(e, t = !1) {
|
|
880
|
+
let n = Pt(e), r = pn(n);
|
|
881
|
+
w.value = n, b("update:modelValue", r), b("change", r, dn(n)), t && b("ok", r, dn(n)), x.value = !1;
|
|
882
|
+
}
|
|
883
|
+
function hn(e) {
|
|
884
|
+
return e === "left" ? D.value : O.value;
|
|
885
|
+
}
|
|
886
|
+
function $(e, t) {
|
|
887
|
+
e === "left" ? D.value = t : O.value = t;
|
|
888
|
+
}
|
|
889
|
+
function gn(e) {
|
|
890
|
+
if (tn(e)) return;
|
|
891
|
+
let [t, n] = w.value;
|
|
892
|
+
if (A.value) {
|
|
893
|
+
let r = Kt(e, S.value);
|
|
894
|
+
if (!r) return;
|
|
895
|
+
if (S.value === "start") {
|
|
896
|
+
fn([r, n && !r.isAfter(n) ? n : null]);
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
fn([t, t && r.isBefore(t) && r.isSame(t, "day") ? t : r]);
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
let r = Vt(e);
|
|
903
|
+
if (S.value === "start") {
|
|
904
|
+
fn([r, null]), S.value = "end";
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
if (!t) {
|
|
908
|
+
fn([r, null]);
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
let i = [t, r];
|
|
912
|
+
fn(i), mn(i), S.value = "start";
|
|
913
|
+
}
|
|
914
|
+
function _n(e, t, n) {
|
|
915
|
+
let r = Yt(e, t, n);
|
|
916
|
+
if (!r || Zt(e, t, n)) return;
|
|
917
|
+
let i = [...w.value];
|
|
918
|
+
i[Wt(e)] = r.millisecond(0), fn(i);
|
|
919
|
+
}
|
|
920
|
+
function vn() {
|
|
921
|
+
if (Z.value) {
|
|
922
|
+
if (S.value === "start") {
|
|
923
|
+
S.value = "end";
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
mn(w.value, !0);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
function yn(e, t) {
|
|
930
|
+
if (!$t(t)) {
|
|
931
|
+
if (k.value === "date") {
|
|
932
|
+
e === "left" ? T.value = T.value.year(t.year()).month(t.month()).startOf("month") : E.value = E.value.year(t.year()).month(t.month()).startOf("month"), $(e, "date"), b("panel-change", gt.value);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
gn(t);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function bn(e, t) {
|
|
939
|
+
if (!en(t)) {
|
|
940
|
+
if (k.value !== "year") {
|
|
941
|
+
e === "left" ? T.value = T.value.year(t.year()).startOf("year") : E.value = E.value.year(t.year()).startOf("year"), $(e, "month"), b("panel-change", gt.value);
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
gn(t);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
function xn(e, t) {
|
|
948
|
+
let n = hn(e), r = n === "date" ? "month" : "year", i = n === "year" ? t * 12 : t;
|
|
949
|
+
e === "left" ? (T.value = T.value.add(i, r), E.value.isAfter(T.value, r) || (E.value = T.value.add(r === "month" ? 1 : k.value === "year" ? 12 : 1, r))) : (E.value = E.value.add(i, r), E.value.isAfter(T.value, r) || (T.value = E.value.subtract(r === "month" ? 1 : k.value === "year" ? 12 : 1, r))), b("panel-change", gt.value);
|
|
950
|
+
}
|
|
951
|
+
function Sn(e) {
|
|
952
|
+
e?.stopPropagation(), De.value && (w.value = [null, null], b("update:modelValue", null), b("change", null, ["", ""]), b("clear"));
|
|
953
|
+
}
|
|
954
|
+
function Cn(e) {
|
|
955
|
+
y.disabled || (e || (C.value = null), x.value = e);
|
|
956
|
+
}
|
|
957
|
+
function wn() {
|
|
958
|
+
x.value || (C.value = null), Cn(!0);
|
|
959
|
+
}
|
|
960
|
+
function Tn(e) {
|
|
961
|
+
if (!y.disabled) {
|
|
962
|
+
if (x.value) {
|
|
963
|
+
S.value = e;
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
C.value = e, Cn(!0);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
function En(e) {
|
|
970
|
+
y.disabled || (e.key === "Enter" || e.key === " " ? (e.preventDefault(), Cn(!x.value)) : e.key === "Escape" ? x.value = !1 : e.key === "ArrowDown" && (e.preventDefault(), Cn(!0)));
|
|
971
|
+
}
|
|
972
|
+
function Dn(e) {
|
|
973
|
+
de.value = !0, b("focus", e);
|
|
974
|
+
}
|
|
975
|
+
function On(e) {
|
|
976
|
+
de.value = !1, b("blur", e);
|
|
977
|
+
}
|
|
978
|
+
function kn() {
|
|
979
|
+
fe.value?.focus();
|
|
980
|
+
}
|
|
981
|
+
function An() {
|
|
982
|
+
fe.value?.blur();
|
|
983
|
+
}
|
|
984
|
+
return i({
|
|
985
|
+
blur: An,
|
|
986
|
+
clear: Sn,
|
|
987
|
+
focus: kn
|
|
988
|
+
}), (i, o) => (f(), ee(g(r), {
|
|
989
|
+
open: x.value,
|
|
990
|
+
"onUpdate:open": o[16] ||= (e) => x.value = e,
|
|
991
|
+
width: be.value,
|
|
992
|
+
"min-width": be.value,
|
|
993
|
+
"focus-on-open": !1,
|
|
994
|
+
"content-class": "ui-datepicker-dropdown"
|
|
995
|
+
}, {
|
|
996
|
+
trigger: oe(() => [l("div", re({
|
|
997
|
+
ref_key: "triggerRef",
|
|
998
|
+
ref: fe
|
|
999
|
+
}, g(n)(g(ue)), {
|
|
1000
|
+
class: ht.value,
|
|
1001
|
+
style: g(ue).style,
|
|
1002
|
+
"data-ui-range-picker": "true",
|
|
1003
|
+
tabindex: e.disabled ? void 0 : 0,
|
|
1004
|
+
role: "combobox",
|
|
1005
|
+
"aria-expanded": x.value,
|
|
1006
|
+
"aria-haspopup": "dialog",
|
|
1007
|
+
onClick: se(wn, ["stop"]),
|
|
1008
|
+
onKeydown: En,
|
|
1009
|
+
onFocus: Dn,
|
|
1010
|
+
onBlur: On
|
|
1011
|
+
}), [
|
|
1012
|
+
l("span", {
|
|
1013
|
+
class: d([[g(ut)({ size: e.size }), A.value ? "py-0!" : ""], "flex items-center gap-2"]),
|
|
1014
|
+
title: [N.value, Te.value].filter(Boolean).join(" - ")
|
|
1015
|
+
}, [
|
|
1016
|
+
l("span", {
|
|
1017
|
+
class: d(["min-w-0 flex-1 cursor-pointer truncate transition-colors", [
|
|
1018
|
+
N.value ? "text-primary" : "text-tertiary/60",
|
|
1019
|
+
A.value ? `relative ${Q.value} after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:content-empty` : "",
|
|
1020
|
+
A.value ? S.value === "start" ? "after:bg-brand" : "after:bg-transparent" : x.value && S.value === "start" ? "text-brand" : ""
|
|
1021
|
+
]]),
|
|
1022
|
+
"data-ui-range-picker-side": "start",
|
|
1023
|
+
"data-ui-range-picker-side-active": S.value === "start" ? "true" : void 0,
|
|
1024
|
+
onClick: o[0] ||= se((e) => Tn("start"), ["stop"])
|
|
1025
|
+
}, h(N.value || ye.value[0]), 11, ke),
|
|
1026
|
+
l("span", { class: d([e.separatorIcon, "size-4 shrink-0 text-tertiary"]) }, null, 2),
|
|
1027
|
+
l("span", {
|
|
1028
|
+
class: d(["min-w-0 flex-1 cursor-pointer truncate transition-colors", [
|
|
1029
|
+
Te.value ? "text-primary" : "text-tertiary/60",
|
|
1030
|
+
A.value ? `relative ${Q.value} after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:content-empty` : "",
|
|
1031
|
+
A.value ? S.value === "end" ? "after:bg-brand" : "after:bg-transparent" : x.value && S.value === "end" ? "text-brand" : ""
|
|
1032
|
+
]]),
|
|
1033
|
+
"data-ui-range-picker-side": "end",
|
|
1034
|
+
"data-ui-range-picker-side-active": S.value === "end" ? "true" : void 0,
|
|
1035
|
+
onClick: o[1] ||= se((e) => Tn("end"), ["stop"])
|
|
1036
|
+
}, h(Te.value || ye.value[1]), 11, L)
|
|
1037
|
+
], 10, I),
|
|
1038
|
+
e.name ? (f(), c("input", {
|
|
1039
|
+
key: 0,
|
|
1040
|
+
type: "hidden",
|
|
1041
|
+
name: e.name,
|
|
1042
|
+
value: Ee.value
|
|
1043
|
+
}, null, 8, R)) : s("", !0),
|
|
1044
|
+
l("span", z, [De.value ? (f(), c("button", {
|
|
1045
|
+
key: 0,
|
|
1046
|
+
type: "button",
|
|
1047
|
+
"aria-label": "清空",
|
|
1048
|
+
class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-datepicker:opacity-100 group-focus-within/ui-datepicker:opacity-100",
|
|
1049
|
+
onClick: Sn
|
|
1050
|
+
}, [l("span", { class: d([e.clearIcon, "size-3"]) }, null, 2)])) : s("", !0), l("span", { class: d([e.suffixIcon, "size-4"]) }, null, 2)])
|
|
1051
|
+
], 16, Oe)]),
|
|
1052
|
+
default: oe(() => [l("div", Ae, [A.value ? (f(), c("div", je, [l("div", Me, [l("div", B, [
|
|
1053
|
+
l("button", {
|
|
1054
|
+
type: "button",
|
|
1055
|
+
class: d(J),
|
|
1056
|
+
"aria-label": "上一面板",
|
|
1057
|
+
onClick: o[2] ||= (e) => xn("left", -1)
|
|
1058
|
+
}, [...o[17] ||= [l("span", { class: "i-lucide:chevron-left size-4" }, null, -1)]]),
|
|
1059
|
+
l("div", Ne, [l("button", {
|
|
1060
|
+
type: "button",
|
|
1061
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1062
|
+
onClick: o[3] ||= (e) => $("left", "year")
|
|
1063
|
+
}, h(yt.value), 1), l("button", {
|
|
1064
|
+
type: "button",
|
|
1065
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1066
|
+
onClick: o[4] ||= (e) => $("left", "month")
|
|
1067
|
+
}, h(xt.value), 1)]),
|
|
1068
|
+
l("button", {
|
|
1069
|
+
type: "button",
|
|
1070
|
+
class: d(J),
|
|
1071
|
+
"aria-label": "下一面板",
|
|
1072
|
+
onClick: o[5] ||= (e) => xn("left", 1)
|
|
1073
|
+
}, [...o[18] ||= [l("span", { class: "i-lucide:chevron-right size-4" }, null, -1)]])
|
|
1074
|
+
]), D.value === "date" ? (f(), c("div", V, [(f(), c(a, null, m(pe, (e) => l("div", {
|
|
1075
|
+
key: e,
|
|
1076
|
+
class: "flex h-7 items-center justify-center text-xs font-medium text-tertiary"
|
|
1077
|
+
}, h(e), 1)), 64)), (f(!0), c(a, null, m(Ct.value, (e) => (f(), c("button", {
|
|
1078
|
+
key: e.key,
|
|
1079
|
+
type: "button",
|
|
1080
|
+
class: d(sn(e)),
|
|
1081
|
+
disabled: e.disabled,
|
|
1082
|
+
"data-ui-range-picker-date-cell": e.key,
|
|
1083
|
+
"data-ui-range-picker-date-selected": e.selected ? "true" : void 0,
|
|
1084
|
+
"data-ui-range-picker-date-in-range": e.inRange ? "true" : void 0,
|
|
1085
|
+
onClick: (t) => gn(e.date)
|
|
1086
|
+
}, h(e.date.date()), 11, Pe))), 128))])) : D.value === "month" ? (f(), c("div", H, [(f(!0), c(a, null, m(Tt.value, (e) => (f(), c("button", {
|
|
1087
|
+
key: e.key,
|
|
1088
|
+
type: "button",
|
|
1089
|
+
class: d(cn(e)),
|
|
1090
|
+
disabled: e.disabled,
|
|
1091
|
+
onClick: (t) => yn("left", e.date)
|
|
1092
|
+
}, h(e.label), 11, U))), 128))])) : (f(), c("div", Fe, [(f(!0), c(a, null, m(Dt.value, (e) => (f(), c("button", {
|
|
1093
|
+
key: e.key,
|
|
1094
|
+
type: "button",
|
|
1095
|
+
class: d(cn(e)),
|
|
1096
|
+
disabled: e.disabled,
|
|
1097
|
+
onClick: (t) => bn("left", e.date)
|
|
1098
|
+
}, h(e.label), 11, Ie))), 128))]))]), l("div", { class: d(["grid min-w-0 border-t border-medium sm:border-l sm:border-t-0", P.value ? "grid-cols-3" : "grid-cols-2"]) }, [(f(!0), c(a, null, m(F.value, (e) => (f(), c("div", {
|
|
1099
|
+
key: e,
|
|
1100
|
+
class: "min-w-0 border-r border-medium last:border-r-0"
|
|
1101
|
+
}, [l("div", Le, h(e === "hour" ? "时" : e === "minute" ? "分" : "秒"), 1), l("div", {
|
|
1102
|
+
class: "max-h-64 overflow-y-auto p-2",
|
|
1103
|
+
"data-ui-range-picker-time-column": e,
|
|
1104
|
+
"data-ui-range-picker-time-side": S.value
|
|
1105
|
+
}, [(f(!0), c(a, null, m(Jt(S.value, e), (t) => (f(), c("button", {
|
|
1106
|
+
key: t,
|
|
1107
|
+
type: "button",
|
|
1108
|
+
class: d(g(pt)({
|
|
1109
|
+
selected: Xt(S.value, e, t),
|
|
1110
|
+
disabled: Zt(S.value, e, t)
|
|
1111
|
+
})),
|
|
1112
|
+
disabled: mt.value || Zt(S.value, e, t),
|
|
1113
|
+
"data-ui-range-picker-time-option": e,
|
|
1114
|
+
"data-ui-range-picker-time-value": t,
|
|
1115
|
+
"data-ui-range-picker-time-side": S.value,
|
|
1116
|
+
"data-ui-range-picker-time-selected": Xt(S.value, e, t) ? "true" : void 0,
|
|
1117
|
+
onClick: (n) => _n(S.value, e, t)
|
|
1118
|
+
}, h(String(t).padStart(2, "0")), 11, Re))), 128))], 8, W)]))), 128))], 2)])) : (f(), c("div", ze, [l("div", Be, [l("div", Ve, [
|
|
1119
|
+
l("button", {
|
|
1120
|
+
type: "button",
|
|
1121
|
+
class: d(J),
|
|
1122
|
+
"aria-label": "上一面板",
|
|
1123
|
+
onClick: o[6] ||= (e) => xn("left", -1)
|
|
1124
|
+
}, [...o[19] ||= [l("span", { class: "i-lucide:chevron-left size-4" }, null, -1)]]),
|
|
1125
|
+
l("div", He, [D.value === "date" ? (f(), c(a, { key: 0 }, [l("button", {
|
|
1126
|
+
type: "button",
|
|
1127
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1128
|
+
onClick: o[7] ||= (e) => $("left", "year")
|
|
1129
|
+
}, h(yt.value), 1), l("button", {
|
|
1130
|
+
type: "button",
|
|
1131
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1132
|
+
onClick: o[8] ||= (e) => $("left", "month")
|
|
1133
|
+
}, h(xt.value), 1)], 64)) : D.value === "month" ? (f(), c("button", {
|
|
1134
|
+
key: 1,
|
|
1135
|
+
type: "button",
|
|
1136
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1137
|
+
onClick: o[9] ||= (e) => $("left", "year")
|
|
1138
|
+
}, h(_t.value), 1)) : (f(), c("span", G, h(_t.value), 1))]),
|
|
1139
|
+
l("button", {
|
|
1140
|
+
type: "button",
|
|
1141
|
+
class: d(J),
|
|
1142
|
+
"aria-label": "下一面板",
|
|
1143
|
+
onClick: o[10] ||= (e) => xn("left", 1)
|
|
1144
|
+
}, [...o[20] ||= [l("span", { class: "i-lucide:chevron-right size-4" }, null, -1)]])
|
|
1145
|
+
]), D.value === "date" ? (f(), c("div", K, [(f(), c(a, null, m(pe, (e) => l("div", {
|
|
1146
|
+
key: e,
|
|
1147
|
+
class: "flex h-6 items-center justify-center text-xs font-medium text-tertiary"
|
|
1148
|
+
}, h(e), 1)), 64)), (f(!0), c(a, null, m(Ct.value, (e) => (f(), c("button", {
|
|
1149
|
+
key: e.key,
|
|
1150
|
+
type: "button",
|
|
1151
|
+
class: d(sn(e)),
|
|
1152
|
+
disabled: e.disabled,
|
|
1153
|
+
"data-ui-range-picker-date-cell": e.key,
|
|
1154
|
+
"data-ui-range-picker-date-selected": e.selected ? "true" : void 0,
|
|
1155
|
+
"data-ui-range-picker-date-in-range": e.inRange ? "true" : void 0,
|
|
1156
|
+
onClick: (t) => gn(e.date)
|
|
1157
|
+
}, h(e.date.date()), 11, q))), 128))])) : D.value === "month" ? (f(), c("div", Ue, [(f(!0), c(a, null, m(Tt.value, (e) => (f(), c("button", {
|
|
1158
|
+
key: e.key,
|
|
1159
|
+
type: "button",
|
|
1160
|
+
class: d(cn(e)),
|
|
1161
|
+
disabled: e.disabled,
|
|
1162
|
+
onClick: (t) => yn("left", e.date)
|
|
1163
|
+
}, h(e.label), 11, We))), 128))])) : (f(), c("div", Ge, [(f(!0), c(a, null, m(Dt.value, (e) => (f(), c("button", {
|
|
1164
|
+
key: e.key,
|
|
1165
|
+
type: "button",
|
|
1166
|
+
class: d(cn(e)),
|
|
1167
|
+
disabled: e.disabled,
|
|
1168
|
+
onClick: (t) => bn("left", e.date)
|
|
1169
|
+
}, h(e.label), 11, Ke))), 128))]))]), l("div", qe, [l("div", Je, [
|
|
1170
|
+
l("button", {
|
|
1171
|
+
type: "button",
|
|
1172
|
+
class: d(J),
|
|
1173
|
+
"aria-label": "上一面板",
|
|
1174
|
+
onClick: o[11] ||= (e) => xn("right", -1)
|
|
1175
|
+
}, [...o[21] ||= [l("span", { class: "i-lucide:chevron-left size-4" }, null, -1)]]),
|
|
1176
|
+
l("div", Ye, [O.value === "date" ? (f(), c(a, { key: 0 }, [l("button", {
|
|
1177
|
+
type: "button",
|
|
1178
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1179
|
+
onClick: o[12] ||= (e) => $("right", "year")
|
|
1180
|
+
}, h(bt.value), 1), l("button", {
|
|
1181
|
+
type: "button",
|
|
1182
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1183
|
+
onClick: o[13] ||= (e) => $("right", "month")
|
|
1184
|
+
}, h(St.value), 1)], 64)) : O.value === "month" ? (f(), c("button", {
|
|
1185
|
+
key: 1,
|
|
1186
|
+
type: "button",
|
|
1187
|
+
class: "rounded px-1 transition-colors hover:bg-secondary hover:text-brand",
|
|
1188
|
+
onClick: o[14] ||= (e) => $("right", "year")
|
|
1189
|
+
}, h(vt.value), 1)) : (f(), c("span", Xe, h(vt.value), 1))]),
|
|
1190
|
+
l("button", {
|
|
1191
|
+
type: "button",
|
|
1192
|
+
class: d(J),
|
|
1193
|
+
"aria-label": "下一面板",
|
|
1194
|
+
onClick: o[15] ||= (e) => xn("right", 1)
|
|
1195
|
+
}, [...o[22] ||= [l("span", { class: "i-lucide:chevron-right size-4" }, null, -1)]])
|
|
1196
|
+
]), O.value === "date" ? (f(), c("div", Ze, [(f(), c(a, null, m(pe, (e) => l("div", {
|
|
1197
|
+
key: e,
|
|
1198
|
+
class: "flex h-6 items-center justify-center text-xs font-medium text-tertiary"
|
|
1199
|
+
}, h(e), 1)), 64)), (f(!0), c(a, null, m(wt.value, (e) => (f(), c("button", {
|
|
1200
|
+
key: e.key,
|
|
1201
|
+
type: "button",
|
|
1202
|
+
class: d(sn(e)),
|
|
1203
|
+
disabled: e.disabled,
|
|
1204
|
+
"data-ui-range-picker-date-cell": e.key,
|
|
1205
|
+
"data-ui-range-picker-date-selected": e.selected ? "true" : void 0,
|
|
1206
|
+
"data-ui-range-picker-date-in-range": e.inRange ? "true" : void 0,
|
|
1207
|
+
onClick: (t) => gn(e.date)
|
|
1208
|
+
}, h(e.date.date()), 11, Qe))), 128))])) : O.value === "month" ? (f(), c("div", $e, [(f(!0), c(a, null, m(Et.value, (e) => (f(), c("button", {
|
|
1209
|
+
key: e.key,
|
|
1210
|
+
type: "button",
|
|
1211
|
+
class: d(cn(e)),
|
|
1212
|
+
disabled: e.disabled,
|
|
1213
|
+
onClick: (t) => yn("right", e.date)
|
|
1214
|
+
}, h(e.label), 11, et))), 128))])) : (f(), c("div", tt, [(f(!0), c(a, null, m(Ot.value, (e) => (f(), c("button", {
|
|
1215
|
+
key: e.key,
|
|
1216
|
+
type: "button",
|
|
1217
|
+
class: d(cn(e)),
|
|
1218
|
+
disabled: e.disabled,
|
|
1219
|
+
onClick: (t) => bn("right", e.date)
|
|
1220
|
+
}, h(e.label), 11, nt))), 128))]))])])), A.value ? (f(), c("div", rt, [l("div", it, [ne(g(t), {
|
|
1221
|
+
size: "sm",
|
|
1222
|
+
disabled: !Z.value,
|
|
1223
|
+
onClick: vn
|
|
1224
|
+
}, {
|
|
1225
|
+
default: oe(() => [...o[23] ||= [te("确定", -1)]]),
|
|
1226
|
+
_: 1
|
|
1227
|
+
}, 8, ["disabled"])])])) : s("", !0)])]),
|
|
1228
|
+
_: 1
|
|
1229
|
+
}, 8, [
|
|
1230
|
+
"open",
|
|
1231
|
+
"width",
|
|
1232
|
+
"min-width"
|
|
1233
|
+
]));
|
|
1234
|
+
}
|
|
1235
|
+
}), lt = i("group/ui-datepicker relative flex w-full min-w-0 items-center overflow-hidden border bg-primary text-primary transition-colors duration-150", {
|
|
1236
|
+
variants: {
|
|
1237
|
+
size: {
|
|
1238
|
+
sm: "rounded-md text-sm/5",
|
|
1239
|
+
md: "rounded-md text-base/4",
|
|
1240
|
+
lg: "rounded-md text-lg/5"
|
|
1241
|
+
},
|
|
1242
|
+
focused: {
|
|
1243
|
+
true: "border-brand ring-2 ring-brand/15",
|
|
1244
|
+
false: "border-control hover:border-brand/40"
|
|
1245
|
+
},
|
|
1246
|
+
disabled: {
|
|
1247
|
+
true: "cursor-not-allowed bg-tertiary/20 text-tertiary opacity-70 hover:border-control",
|
|
1248
|
+
false: "cursor-pointer"
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
defaultVariants: {
|
|
1252
|
+
size: "md",
|
|
1253
|
+
focused: !1,
|
|
1254
|
+
disabled: !1
|
|
1255
|
+
}
|
|
1256
|
+
}), ut = i("min-w-0 flex-1 truncate", {
|
|
1257
|
+
variants: { size: {
|
|
1258
|
+
sm: `px-2 ${e.sm}`,
|
|
1259
|
+
md: `px-3 ${e.md}`,
|
|
1260
|
+
lg: `px-4 ${e.lg}`
|
|
1261
|
+
} },
|
|
1262
|
+
defaultVariants: { size: "md" }
|
|
1263
|
+
}), X = i("relative flex h-8 min-w-0 items-center justify-center rounded-md border border-transparent text-sm outline-none transition-colors duration-150", {
|
|
1264
|
+
variants: {
|
|
1265
|
+
inMonth: {
|
|
1266
|
+
true: "text-primary",
|
|
1267
|
+
false: "text-tertiary/50"
|
|
1268
|
+
},
|
|
1269
|
+
selected: {
|
|
1270
|
+
true: "border-brand-500 bg-brand-500 text-brand-50 hover:bg-brand-500",
|
|
1271
|
+
false: "hover:border-brand-400 hover:bg-brand-500/10 hover:text-brand-500"
|
|
1272
|
+
},
|
|
1273
|
+
today: {
|
|
1274
|
+
true: "",
|
|
1275
|
+
false: ""
|
|
1276
|
+
},
|
|
1277
|
+
disabled: {
|
|
1278
|
+
true: "pointer-events-none cursor-not-allowed opacity-35",
|
|
1279
|
+
false: "cursor-pointer"
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
compoundVariants: [{
|
|
1283
|
+
today: !0,
|
|
1284
|
+
selected: !1,
|
|
1285
|
+
disabled: !1,
|
|
1286
|
+
class: "border-brand-400/70 text-brand-500"
|
|
1287
|
+
}, {
|
|
1288
|
+
today: !0,
|
|
1289
|
+
selected: !1,
|
|
1290
|
+
disabled: !0,
|
|
1291
|
+
class: "border-brand-400/30"
|
|
1292
|
+
}],
|
|
1293
|
+
defaultVariants: {
|
|
1294
|
+
inMonth: !0,
|
|
1295
|
+
selected: !1,
|
|
1296
|
+
today: !1,
|
|
1297
|
+
disabled: !1
|
|
1298
|
+
}
|
|
1299
|
+
}), dt = i("relative flex h-10 min-w-0 items-center justify-center rounded-md border border-transparent px-2 text-sm outline-none transition-colors duration-150", {
|
|
1300
|
+
variants: {
|
|
1301
|
+
selected: {
|
|
1302
|
+
true: "border-brand-500 bg-brand-500 text-brand-50 hover:bg-brand-500",
|
|
1303
|
+
false: "text-primary hover:border-brand-400 hover:bg-brand-500/10 hover:text-brand-500"
|
|
1304
|
+
},
|
|
1305
|
+
current: {
|
|
1306
|
+
true: "",
|
|
1307
|
+
false: ""
|
|
1308
|
+
},
|
|
1309
|
+
disabled: {
|
|
1310
|
+
true: "pointer-events-none cursor-not-allowed opacity-35",
|
|
1311
|
+
false: "cursor-pointer"
|
|
1312
|
+
},
|
|
1313
|
+
muted: {
|
|
1314
|
+
true: "text-tertiary/50",
|
|
1315
|
+
false: ""
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
compoundVariants: [{
|
|
1319
|
+
current: !0,
|
|
1320
|
+
selected: !1,
|
|
1321
|
+
disabled: !1,
|
|
1322
|
+
class: "border-brand-400/70 text-brand-500"
|
|
1323
|
+
}, {
|
|
1324
|
+
current: !0,
|
|
1325
|
+
selected: !1,
|
|
1326
|
+
disabled: !0,
|
|
1327
|
+
class: "border-brand-400/30"
|
|
1328
|
+
}],
|
|
1329
|
+
defaultVariants: {
|
|
1330
|
+
selected: !1,
|
|
1331
|
+
current: !1,
|
|
1332
|
+
disabled: !1,
|
|
1333
|
+
muted: !1
|
|
1334
|
+
}
|
|
1335
|
+
}), ft = i("relative flex h-8 min-w-0 items-center justify-center rounded-md border border-transparent text-sm outline-none transition-colors duration-150", {
|
|
1336
|
+
variants: {
|
|
1337
|
+
inMonth: {
|
|
1338
|
+
true: "text-primary",
|
|
1339
|
+
false: "text-tertiary/50"
|
|
1340
|
+
},
|
|
1341
|
+
selected: {
|
|
1342
|
+
true: "bg-brand-500 text-brand-50 hover:bg-brand-500",
|
|
1343
|
+
false: "hover:bg-brand-500/10 hover:text-brand-500"
|
|
1344
|
+
},
|
|
1345
|
+
inRange: {
|
|
1346
|
+
true: "rounded-none bg-brand-500/10 text-brand-500",
|
|
1347
|
+
false: ""
|
|
1348
|
+
},
|
|
1349
|
+
rangeStart: {
|
|
1350
|
+
true: "rounded-l-md rounded-r-none border-brand-500",
|
|
1351
|
+
false: ""
|
|
1352
|
+
},
|
|
1353
|
+
rangeEnd: {
|
|
1354
|
+
true: "rounded-l-none rounded-r-md border-brand-500",
|
|
1355
|
+
false: ""
|
|
1356
|
+
},
|
|
1357
|
+
standalone: {
|
|
1358
|
+
true: "rounded-md",
|
|
1359
|
+
false: ""
|
|
1360
|
+
},
|
|
1361
|
+
today: {
|
|
1362
|
+
true: "",
|
|
1363
|
+
false: ""
|
|
1364
|
+
},
|
|
1365
|
+
disabled: {
|
|
1366
|
+
true: "pointer-events-none cursor-not-allowed opacity-35",
|
|
1367
|
+
false: "cursor-pointer"
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
compoundVariants: [{
|
|
1371
|
+
today: !0,
|
|
1372
|
+
selected: !1,
|
|
1373
|
+
inRange: !1,
|
|
1374
|
+
disabled: !1,
|
|
1375
|
+
class: "border-brand-400/70 text-brand-500"
|
|
1376
|
+
}, {
|
|
1377
|
+
today: !0,
|
|
1378
|
+
selected: !1,
|
|
1379
|
+
disabled: !0,
|
|
1380
|
+
class: "border-brand-400/30"
|
|
1381
|
+
}],
|
|
1382
|
+
defaultVariants: {
|
|
1383
|
+
inMonth: !0,
|
|
1384
|
+
selected: !1,
|
|
1385
|
+
inRange: !1,
|
|
1386
|
+
rangeStart: !1,
|
|
1387
|
+
rangeEnd: !1,
|
|
1388
|
+
standalone: !0,
|
|
1389
|
+
today: !1,
|
|
1390
|
+
disabled: !1
|
|
1391
|
+
}
|
|
1392
|
+
}), pt = i("flex h-7 w-full items-center justify-center rounded text-xs font-mono transition-colors duration-150", {
|
|
1393
|
+
variants: {
|
|
1394
|
+
selected: {
|
|
1395
|
+
true: "bg-brand-500 text-brand-50",
|
|
1396
|
+
false: "text-secondary hover:bg-brand-500/10 hover:text-brand-500"
|
|
1397
|
+
},
|
|
1398
|
+
disabled: {
|
|
1399
|
+
true: "pointer-events-none cursor-not-allowed opacity-35",
|
|
1400
|
+
false: "cursor-pointer"
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
defaultVariants: {
|
|
1404
|
+
selected: !1,
|
|
1405
|
+
disabled: !1
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
//#endregion
|
|
1409
|
+
export { ut as a, F as c, pt as i, dt as n, lt as o, ft as r, Y as s, X as t };
|
|
1410
|
+
|
|
1411
|
+
//# sourceMappingURL=datepicker-XNgIvgTe.js.map
|