v-datepicker-lite 0.1.8 → 0.1.9
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/index.js +454 -450
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { defineComponent as x, computed as $, createElementBlock as k, openBlock as
|
|
1
|
+
import { defineComponent as x, computed as $, createElementBlock as k, openBlock as h, createElementVNode as p, Fragment as F, renderList as I, unref as g, toDisplayString as A, normalizeClass as C, ref as P, watch as q, nextTick as R, onMounted as ne, createCommentVNode as B, createBlock as W, createVNode as G, renderSlot as K, normalizeProps as Q, guardReactiveProps as X, withCtx as J } from "vue";
|
|
2
2
|
import se from "v-tooltip-lite";
|
|
3
|
-
const Z = (
|
|
4
|
-
const
|
|
5
|
-
return
|
|
6
|
-
}, U = (
|
|
7
|
-
if (!
|
|
8
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(
|
|
9
|
-
const [
|
|
10
|
-
return new Date(
|
|
3
|
+
const Z = (e, o = "YYYY-MM-DD") => {
|
|
4
|
+
const l = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), t = String(e.getDate()).padStart(2, "0"), u = String(e.getHours()).padStart(2, "0"), i = String(e.getMinutes()).padStart(2, "0"), c = String(e.getSeconds()).padStart(2, "0"), s = String(e.getMilliseconds()).padStart(3, "0");
|
|
5
|
+
return o.replace("YYYY", l.toString()).replace("MM", a).replace("DD", t).replace("HH", u).replace("mm", i).replace("ss", c).replace("sss", s);
|
|
6
|
+
}, U = (e) => {
|
|
7
|
+
if (!e) return null;
|
|
8
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(e)) {
|
|
9
|
+
const [l, a, t] = e.split("-").map(Number);
|
|
10
|
+
return new Date(l, a - 1, t);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
return isNaN(
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
return Math.ceil((
|
|
17
|
-
}, ee = (
|
|
18
|
-
const
|
|
19
|
-
for (let d =
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
date:
|
|
23
|
-
day:
|
|
24
|
-
month:
|
|
25
|
-
year:
|
|
12
|
+
const o = new Date(e);
|
|
13
|
+
return isNaN(o.getTime()) ? null : o;
|
|
14
|
+
}, L = (e, o) => e.getFullYear() === o.getFullYear() && e.getMonth() === o.getMonth() && e.getDate() === o.getDate(), oe = (e, o) => e.getFullYear() === o.getFullYear() && e.getMonth() === o.getMonth(), re = (e) => {
|
|
15
|
+
const o = new Date(e.getFullYear(), 0, 1), l = (e.getTime() - o.getTime()) / 864e5;
|
|
16
|
+
return Math.ceil((l + o.getDay() + 1) / 7);
|
|
17
|
+
}, ee = (e, o) => {
|
|
18
|
+
const l = new Date(e, o, 1), t = new Date(e, o + 1, 0).getDate(), u = l.getDay(), i = [], c = /* @__PURE__ */ new Date(), s = o === 0 ? 11 : o - 1, f = o === 0 ? e - 1 : e, M = new Date(f, s + 1, 0).getDate();
|
|
19
|
+
for (let d = u - 1; d >= 0; d--) {
|
|
20
|
+
const n = new Date(f, s, M - d);
|
|
21
|
+
i.push({
|
|
22
|
+
date: n,
|
|
23
|
+
day: M - d,
|
|
24
|
+
month: s,
|
|
25
|
+
year: f,
|
|
26
26
|
isCurrentMonth: !1,
|
|
27
|
-
isToday:
|
|
27
|
+
isToday: L(n, c),
|
|
28
28
|
isSelected: !1,
|
|
29
29
|
isDisabled: !1
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
for (let d = 1; d <= t; d++) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
date:
|
|
33
|
+
const n = new Date(e, o, d);
|
|
34
|
+
i.push({
|
|
35
|
+
date: n,
|
|
36
36
|
day: d,
|
|
37
|
-
month:
|
|
38
|
-
year:
|
|
37
|
+
month: o,
|
|
38
|
+
year: e,
|
|
39
39
|
isCurrentMonth: !0,
|
|
40
|
-
isToday:
|
|
40
|
+
isToday: L(n, c),
|
|
41
41
|
isSelected: !1,
|
|
42
42
|
isDisabled: !1
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
const m = 42 -
|
|
45
|
+
const m = 42 - i.length, S = o === 11 ? 0 : o + 1, y = o === 11 ? e + 1 : e;
|
|
46
46
|
for (let d = 1; d <= m; d++) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
date:
|
|
47
|
+
const n = new Date(y, S, d);
|
|
48
|
+
i.push({
|
|
49
|
+
date: n,
|
|
50
50
|
day: d,
|
|
51
51
|
month: S,
|
|
52
52
|
year: y,
|
|
53
53
|
isCurrentMonth: !1,
|
|
54
|
-
isToday:
|
|
54
|
+
isToday: L(n, c),
|
|
55
55
|
isSelected: !1,
|
|
56
56
|
isDisabled: !1
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
return
|
|
60
|
-
}, ie = (
|
|
61
|
-
const
|
|
62
|
-
for (let t = 0; t <
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
weekNumber:
|
|
66
|
-
days:
|
|
59
|
+
return i;
|
|
60
|
+
}, ie = (e, o) => {
|
|
61
|
+
const l = ee(e, o), a = [];
|
|
62
|
+
for (let t = 0; t < l.length; t += 7) {
|
|
63
|
+
const u = l.slice(t, t + 7), i = re(u[0].date);
|
|
64
|
+
a.push({
|
|
65
|
+
weekNumber: i,
|
|
66
|
+
days: u,
|
|
67
67
|
isSelected: !1
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
return
|
|
71
|
-
}, te = (
|
|
70
|
+
return a;
|
|
71
|
+
}, te = (e) => [
|
|
72
72
|
"January",
|
|
73
73
|
"February",
|
|
74
74
|
"March",
|
|
@@ -81,15 +81,15 @@ const Z = (l, s = "YYYY-MM-DD") => {
|
|
|
81
81
|
"October",
|
|
82
82
|
"November",
|
|
83
83
|
"December"
|
|
84
|
-
].map((
|
|
85
|
-
month:
|
|
86
|
-
year:
|
|
87
|
-
name:
|
|
84
|
+
].map((l, a) => ({
|
|
85
|
+
month: a,
|
|
86
|
+
year: e,
|
|
87
|
+
name: l,
|
|
88
88
|
isSelected: !1,
|
|
89
89
|
isDisabled: !1
|
|
90
|
-
})), le = (
|
|
91
|
-
const t = Z(
|
|
92
|
-
return
|
|
90
|
+
})), le = (e, o, l, a) => {
|
|
91
|
+
const t = Z(e, "YYYY-MM-DD");
|
|
92
|
+
return o && t < o || l && t > l ? !0 : a ? a.some((u) => u.end ? t >= u.start && t <= u.end : t === u.start) : !1;
|
|
93
93
|
}, E = [
|
|
94
94
|
"January",
|
|
95
95
|
"February",
|
|
@@ -113,36 +113,36 @@ const Z = (l, s = "YYYY-MM-DD") => {
|
|
|
113
113
|
disabledDates: {}
|
|
114
114
|
},
|
|
115
115
|
emits: ["select"],
|
|
116
|
-
setup(
|
|
117
|
-
const
|
|
118
|
-
...
|
|
119
|
-
isSelected:
|
|
120
|
-
isDisabled: le(
|
|
121
|
-
}))),
|
|
122
|
-
const
|
|
123
|
-
for (let
|
|
124
|
-
|
|
125
|
-
return
|
|
126
|
-
}),
|
|
127
|
-
|
|
116
|
+
setup(e, { emit: o }) {
|
|
117
|
+
const l = e, a = o, t = $(() => ee(l.currentDate.getFullYear(), l.currentDate.getMonth()).map((s) => ({
|
|
118
|
+
...s,
|
|
119
|
+
isSelected: l.selectedDate ? L(s.date, l.selectedDate) : !1,
|
|
120
|
+
isDisabled: le(s.date, l.minDate, l.maxDate, l.disabledDates)
|
|
121
|
+
}))), u = $(() => {
|
|
122
|
+
const c = [];
|
|
123
|
+
for (let s = 0; s < t.value.length; s += 7)
|
|
124
|
+
c.push(t.value.slice(s, s + 7));
|
|
125
|
+
return c.filter((s) => s.some((f) => f.isCurrentMonth));
|
|
126
|
+
}), i = (c) => {
|
|
127
|
+
c.isDisabled || a("select", c.date);
|
|
128
128
|
};
|
|
129
|
-
return (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(
|
|
129
|
+
return (c, s) => (h(), k("div", ce, [
|
|
130
|
+
p("table", ue, [
|
|
131
|
+
p("thead", null, [
|
|
132
|
+
p("tr", de, [
|
|
133
|
+
(h(!0), k(F, null, I(g(ae), (f) => (h(), k("th", { key: f }, A(f), 1))), 128))
|
|
134
134
|
])
|
|
135
135
|
]),
|
|
136
|
-
|
|
137
|
-
(
|
|
138
|
-
key:
|
|
136
|
+
p("tbody", me, [
|
|
137
|
+
(h(!0), k(F, null, I(u.value, (f, M) => (h(), k("tr", {
|
|
138
|
+
key: M,
|
|
139
139
|
class: "date-picker-week-row"
|
|
140
140
|
}, [
|
|
141
|
-
(
|
|
141
|
+
(h(!0), k(F, null, I(f, (m) => (h(), k("td", {
|
|
142
142
|
key: `${m.year}-${m.month}-${m.day}`,
|
|
143
143
|
class: "date-picker-day-cell"
|
|
144
144
|
}, [
|
|
145
|
-
|
|
145
|
+
p("button", {
|
|
146
146
|
class: C([
|
|
147
147
|
"date-picker-day",
|
|
148
148
|
{
|
|
@@ -152,7 +152,7 @@ const Z = (l, s = "YYYY-MM-DD") => {
|
|
|
152
152
|
disabled: m.isDisabled
|
|
153
153
|
}
|
|
154
154
|
]),
|
|
155
|
-
onClick: (S) =>
|
|
155
|
+
onClick: (S) => i(m),
|
|
156
156
|
disabled: m.isDisabled
|
|
157
157
|
}, A(m.day), 11, ve)
|
|
158
158
|
]))), 128))
|
|
@@ -165,60 +165,60 @@ const Z = (l, s = "YYYY-MM-DD") => {
|
|
|
165
165
|
class: "date-picker-table date-picker-week-table",
|
|
166
166
|
cellpadding: "0",
|
|
167
167
|
cellspacing: "0"
|
|
168
|
-
}, ge = { class: "date-picker-weekdays-row" }, ke = { class: "date-picker-weeks-body" }, De = ["onClick"], ye = { class: "date-picker-week-number-cell" },
|
|
168
|
+
}, ge = { class: "date-picker-weekdays-row" }, ke = { class: "date-picker-weeks-body" }, De = ["onClick"], ye = { class: "date-picker-week-number-cell" }, Me = { class: "date-picker-week-number" }, be = /* @__PURE__ */ x({
|
|
169
169
|
__name: "WeekView",
|
|
170
170
|
props: {
|
|
171
171
|
currentDate: {},
|
|
172
172
|
selectedDate: {}
|
|
173
173
|
},
|
|
174
174
|
emits: ["select"],
|
|
175
|
-
setup(
|
|
176
|
-
const
|
|
177
|
-
const
|
|
175
|
+
setup(e, { emit: o }) {
|
|
176
|
+
const l = e, a = o, t = $(() => ie(l.currentDate.getFullYear(), l.currentDate.getMonth()).map((c) => {
|
|
177
|
+
const s = l.selectedDate ? c.days.some((f) => L(f.date, l.selectedDate)) : !1;
|
|
178
178
|
return {
|
|
179
|
-
...
|
|
180
|
-
isSelected:
|
|
179
|
+
...c,
|
|
180
|
+
isSelected: s
|
|
181
181
|
};
|
|
182
|
-
})),
|
|
183
|
-
var
|
|
184
|
-
const
|
|
185
|
-
|
|
182
|
+
})), u = (i) => {
|
|
183
|
+
var s;
|
|
184
|
+
const c = ((s = i.days.find((f) => f.isCurrentMonth)) == null ? void 0 : s.date) || i.days[0].date;
|
|
185
|
+
a("select", c);
|
|
186
186
|
};
|
|
187
|
-
return (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
(
|
|
187
|
+
return (i, c) => (h(), k("div", he, [
|
|
188
|
+
p("table", fe, [
|
|
189
|
+
p("thead", null, [
|
|
190
|
+
p("tr", ge, [
|
|
191
|
+
c[0] || (c[0] = p("th", { class: "date-picker-weekday date-picker-week-header" }, "Wk", -1)),
|
|
192
|
+
(h(!0), k(F, null, I(g(ae), (s) => (h(), k("th", { key: s }, A(s), 1))), 128))
|
|
193
193
|
])
|
|
194
194
|
]),
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
key:
|
|
195
|
+
p("tbody", ke, [
|
|
196
|
+
(h(!0), k(F, null, I(t.value, (s) => (h(), k("tr", {
|
|
197
|
+
key: s.weekNumber,
|
|
198
198
|
class: C([
|
|
199
199
|
"date-picker-week-row",
|
|
200
200
|
{
|
|
201
|
-
selected:
|
|
201
|
+
selected: s.isSelected
|
|
202
202
|
}
|
|
203
203
|
]),
|
|
204
|
-
onClick: (
|
|
204
|
+
onClick: (f) => u(s)
|
|
205
205
|
}, [
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
p("td", ye, [
|
|
207
|
+
p("div", Me, A(s.weekNumber), 1)
|
|
208
208
|
]),
|
|
209
|
-
(
|
|
210
|
-
key: `${
|
|
209
|
+
(h(!0), k(F, null, I(s.days, (f) => (h(), k("td", {
|
|
210
|
+
key: `${f.year}-${f.month}-${f.day}`,
|
|
211
211
|
class: "date-picker-day-cell"
|
|
212
212
|
}, [
|
|
213
|
-
|
|
213
|
+
p("button", {
|
|
214
214
|
class: C([
|
|
215
215
|
"date-picker-day",
|
|
216
216
|
{
|
|
217
|
-
"other-month": !
|
|
218
|
-
today:
|
|
217
|
+
"other-month": !f.isCurrentMonth,
|
|
218
|
+
today: f.isToday
|
|
219
219
|
}
|
|
220
220
|
])
|
|
221
|
-
}, A(
|
|
221
|
+
}, A(f.day), 3)
|
|
222
222
|
]))), 128))
|
|
223
223
|
], 10, De))), 128))
|
|
224
224
|
])
|
|
@@ -226,25 +226,25 @@ const Z = (l, s = "YYYY-MM-DD") => {
|
|
|
226
226
|
]));
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
function Se(
|
|
230
|
-
const t = P(0),
|
|
231
|
-
if (
|
|
232
|
-
t.value =
|
|
229
|
+
function Se(e, o = "24h", l = 1, a) {
|
|
230
|
+
const t = P(0), u = P(0), i = P([]), c = P(!1), s = $(() => o === "12h"), f = () => {
|
|
231
|
+
if (e)
|
|
232
|
+
t.value = e.getHours(), u.value = e.getMinutes(), c.value = !0;
|
|
233
233
|
else {
|
|
234
|
-
const
|
|
235
|
-
t.value =
|
|
234
|
+
const r = /* @__PURE__ */ new Date();
|
|
235
|
+
t.value = r.getHours(), u.value = r.getMinutes(), c.value = !1;
|
|
236
236
|
}
|
|
237
237
|
m();
|
|
238
|
-
},
|
|
239
|
-
|
|
238
|
+
}, M = (r) => {
|
|
239
|
+
r ? (t.value = r.getHours(), u.value = r.getMinutes(), c.value = !0) : c.value = !1;
|
|
240
240
|
}, m = () => {
|
|
241
|
-
const
|
|
242
|
-
for (let
|
|
243
|
-
const V =
|
|
244
|
-
for (let Y = D; Y <= (
|
|
245
|
-
for (let T = 0; T < 60; T +=
|
|
246
|
-
const
|
|
247
|
-
|
|
241
|
+
const r = [], D = s.value ? 1 : 0;
|
|
242
|
+
for (let b = 0; b < (s.value ? 2 : 1); b++) {
|
|
243
|
+
const V = s.value ? b === 0 ? " AM" : " PM" : "";
|
|
244
|
+
for (let Y = D; Y <= (s.value ? 12 : 23); Y++)
|
|
245
|
+
for (let T = 0; T < 60; T += l) {
|
|
246
|
+
const v = (s.value, Y), w = s.value ? Y === 12 ? b === 0 ? 0 : 12 : Y + b * 12 : Y, z = `${String(v).padStart(2, "0")}:${String(T).padStart(2, "0")}` + V;
|
|
247
|
+
r.push({
|
|
248
248
|
display: z,
|
|
249
249
|
value: `${String(w).padStart(2, "0")}:${String(T).padStart(2, "0")}`,
|
|
250
250
|
hour: w,
|
|
@@ -252,54 +252,54 @@ function Se(l, s = "24h", e = 1, u) {
|
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
s.value ? i.value = r.map((b) => b.display) : i.value = r.map((b) => b.value);
|
|
256
256
|
}, S = () => {
|
|
257
|
-
if (!
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
return `${String(
|
|
257
|
+
if (!c.value) return "";
|
|
258
|
+
if (s.value) {
|
|
259
|
+
const r = t.value === 0 ? 12 : t.value > 12 ? t.value - 12 : t.value, D = t.value < 12 ? " AM" : " PM";
|
|
260
|
+
return `${String(r).padStart(2, "0")}:${String(u.value).padStart(
|
|
261
261
|
2,
|
|
262
262
|
"0"
|
|
263
263
|
)}${D}`;
|
|
264
264
|
}
|
|
265
|
-
return `${String(t.value).padStart(2, "0")}:${String(
|
|
265
|
+
return `${String(t.value).padStart(2, "0")}:${String(u.value).padStart(2, "0")}`;
|
|
266
266
|
};
|
|
267
267
|
return {
|
|
268
268
|
hours: t,
|
|
269
|
-
minutes:
|
|
270
|
-
timeOptions:
|
|
271
|
-
is12HourFormat:
|
|
272
|
-
initializeTime:
|
|
273
|
-
updateTime:
|
|
269
|
+
minutes: u,
|
|
270
|
+
timeOptions: i,
|
|
271
|
+
is12HourFormat: s,
|
|
272
|
+
initializeTime: f,
|
|
273
|
+
updateTime: M,
|
|
274
274
|
generateTimeOptions: m,
|
|
275
275
|
getCurrentTimeString: S,
|
|
276
|
-
selectTime: (
|
|
277
|
-
let D,
|
|
278
|
-
if (
|
|
279
|
-
const [Y, T] =
|
|
280
|
-
D = parseInt(
|
|
276
|
+
selectTime: (r) => {
|
|
277
|
+
let D, b;
|
|
278
|
+
if (s.value) {
|
|
279
|
+
const [Y, T] = r.split(" "), [v, w] = Y.split(":");
|
|
280
|
+
D = parseInt(v), b = parseInt(w), T === "AM" ? D === 12 && (D = 0) : D !== 12 && (D += 12);
|
|
281
281
|
} else {
|
|
282
|
-
const [Y, T] =
|
|
283
|
-
D = parseInt(Y),
|
|
282
|
+
const [Y, T] = r.split(":");
|
|
283
|
+
D = parseInt(Y), b = parseInt(T);
|
|
284
284
|
}
|
|
285
|
-
if (
|
|
286
|
-
|
|
285
|
+
if (c.value && t.value === D && u.value === b) {
|
|
286
|
+
c.value = !1, a("update", null);
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
t.value = D,
|
|
290
|
-
const V =
|
|
291
|
-
V.setHours(D,
|
|
289
|
+
t.value = D, u.value = b, c.value = !0;
|
|
290
|
+
const V = e ? new Date(e.getTime()) : /* @__PURE__ */ new Date();
|
|
291
|
+
V.setHours(D, b, 0, 0), a("update", V);
|
|
292
292
|
},
|
|
293
|
-
scrollToSelected: (
|
|
294
|
-
if (!
|
|
295
|
-
const D =
|
|
293
|
+
scrollToSelected: (r) => {
|
|
294
|
+
if (!r || !c.value) return;
|
|
295
|
+
const D = i.value.findIndex((b) => b === S());
|
|
296
296
|
if (D >= 0) {
|
|
297
|
-
const V =
|
|
298
|
-
|
|
297
|
+
const V = r.clientHeight, Y = D * 30 - V / 2 + 30 / 2;
|
|
298
|
+
r.scrollTop = Math.max(0, Y);
|
|
299
299
|
}
|
|
300
300
|
},
|
|
301
|
-
onTimeUpdate: (
|
|
302
|
-
t.value =
|
|
301
|
+
onTimeUpdate: (r) => {
|
|
302
|
+
t.value = r.getHours(), u.value = r.getMinutes(), c.value = !0, a("update", r);
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
}
|
|
@@ -311,52 +311,52 @@ const _e = { class: "time-picker-container" }, we = ["aria-selected", "onClick"]
|
|
|
311
311
|
minuteInterval: { default: 1 }
|
|
312
312
|
},
|
|
313
313
|
emits: ["update"],
|
|
314
|
-
setup(
|
|
315
|
-
const
|
|
316
|
-
return
|
|
317
|
-
() =>
|
|
314
|
+
setup(e, { emit: o }) {
|
|
315
|
+
const l = e, a = o, t = P(null), { timeOptions: u, initializeTime: i, updateTime: c, getCurrentTimeString: s, selectTime: f, scrollToSelected: M } = Se(l.selectedTime, l.timeFormat, l.minuteInterval, a);
|
|
316
|
+
return q(
|
|
317
|
+
() => l.selectedTime,
|
|
318
318
|
(m) => {
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
c(m), R(() => {
|
|
320
|
+
M(t.value);
|
|
321
321
|
});
|
|
322
322
|
},
|
|
323
323
|
{ immediate: !0 }
|
|
324
|
-
),
|
|
325
|
-
() =>
|
|
324
|
+
), q(
|
|
325
|
+
() => l.timeFormat,
|
|
326
326
|
() => {
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
i(), R(() => {
|
|
328
|
+
M(t.value);
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
),
|
|
332
|
-
() =>
|
|
331
|
+
), q(
|
|
332
|
+
() => l.minuteInterval,
|
|
333
333
|
() => {
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
i(), R(() => {
|
|
335
|
+
M(t.value);
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
), ne(() => {
|
|
339
|
-
|
|
339
|
+
i(), R(() => {
|
|
340
340
|
setTimeout(() => {
|
|
341
|
-
|
|
341
|
+
M(t.value);
|
|
342
342
|
}, 3);
|
|
343
343
|
});
|
|
344
|
-
}), (m, S) => (
|
|
345
|
-
|
|
344
|
+
}), (m, S) => (h(), k("div", _e, [
|
|
345
|
+
p("div", {
|
|
346
346
|
ref_key: "timeListRef",
|
|
347
347
|
ref: t,
|
|
348
348
|
class: "time-wheel",
|
|
349
349
|
role: "listbox",
|
|
350
350
|
"aria-label": "Time Selection"
|
|
351
351
|
}, [
|
|
352
|
-
(
|
|
352
|
+
(h(!0), k(F, null, I(g(u), (y) => (h(), k("div", {
|
|
353
353
|
key: y,
|
|
354
354
|
class: C(["time-option", {
|
|
355
|
-
selected: y === g(
|
|
355
|
+
selected: y === g(s)()
|
|
356
356
|
}]),
|
|
357
357
|
role: "option",
|
|
358
|
-
"aria-selected": y === g(
|
|
359
|
-
onClick: (d) => g(
|
|
358
|
+
"aria-selected": y === g(s)(),
|
|
359
|
+
onClick: (d) => g(f)(y)
|
|
360
360
|
}, A(y), 11, we))), 128))
|
|
361
361
|
], 512)
|
|
362
362
|
]));
|
|
@@ -368,64 +368,64 @@ const _e = { class: "time-picker-container" }, we = ["aria-selected", "onClick"]
|
|
|
368
368
|
selectedDate: {}
|
|
369
369
|
},
|
|
370
370
|
emits: ["select", "month-select"],
|
|
371
|
-
setup(
|
|
372
|
-
const
|
|
371
|
+
setup(e, { emit: o }) {
|
|
372
|
+
const l = e, a = o, t = $(() => l.currentDate.getFullYear()), u = $(() => {
|
|
373
373
|
var m;
|
|
374
|
-
return (m =
|
|
375
|
-
}),
|
|
374
|
+
return (m = l.selectedDate) == null ? void 0 : m.getFullYear();
|
|
375
|
+
}), i = $(() => {
|
|
376
376
|
const m = Math.floor(t.value / 10) * 10;
|
|
377
377
|
return Array.from({ length: 12 }, (S, y) => m + y - 1);
|
|
378
|
-
}),
|
|
378
|
+
}), c = $(() => te(t.value).map((m) => ({
|
|
379
379
|
...m,
|
|
380
|
-
isSelected:
|
|
381
|
-
}))),
|
|
380
|
+
isSelected: l.selectedDate ? m.month === l.selectedDate.getMonth() && m.year === l.selectedDate.getFullYear() : !1
|
|
381
|
+
}))), s = $(() => {
|
|
382
382
|
const m = [];
|
|
383
|
-
for (let S = 0; S <
|
|
384
|
-
m.push(
|
|
383
|
+
for (let S = 0; S < c.value.length; S += 3)
|
|
384
|
+
m.push(c.value.slice(S, S + 3));
|
|
385
385
|
return m;
|
|
386
|
-
}),
|
|
387
|
-
|
|
388
|
-
},
|
|
389
|
-
|
|
386
|
+
}), f = (m) => {
|
|
387
|
+
a("select", m);
|
|
388
|
+
}, M = (m) => {
|
|
389
|
+
a("month-select", m.month);
|
|
390
390
|
};
|
|
391
|
-
return (m, S) => (
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
(
|
|
391
|
+
return (m, S) => (h(), k("div", $e, [
|
|
392
|
+
p("div", Ye, [
|
|
393
|
+
p("div", Te, [
|
|
394
|
+
(h(!0), k(F, null, I(i.value, (y) => (h(), k("button", {
|
|
395
395
|
key: y,
|
|
396
396
|
class: C([
|
|
397
397
|
"year-item",
|
|
398
398
|
{
|
|
399
|
-
selected: y ===
|
|
399
|
+
selected: y === u.value,
|
|
400
400
|
current: y === t.value
|
|
401
401
|
}
|
|
402
402
|
]),
|
|
403
|
-
onClick: (d) =>
|
|
403
|
+
onClick: (d) => f(y)
|
|
404
404
|
}, A(y), 11, He))), 128))
|
|
405
405
|
])
|
|
406
406
|
]),
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
(
|
|
407
|
+
p("div", Ce, [
|
|
408
|
+
p("table", Pe, [
|
|
409
|
+
p("tbody", Fe, [
|
|
410
|
+
(h(!0), k(F, null, I(s.value, (y, d) => (h(), k("tr", {
|
|
411
411
|
key: d,
|
|
412
412
|
class: "date-picker-months-row"
|
|
413
413
|
}, [
|
|
414
|
-
(
|
|
415
|
-
key:
|
|
414
|
+
(h(!0), k(F, null, I(y, (n) => (h(), k("td", {
|
|
415
|
+
key: n.month,
|
|
416
416
|
class: "date-picker-month-cell"
|
|
417
417
|
}, [
|
|
418
|
-
|
|
418
|
+
p("button", {
|
|
419
419
|
class: C([
|
|
420
420
|
"date-picker-month",
|
|
421
421
|
{
|
|
422
|
-
selected:
|
|
423
|
-
disabled:
|
|
422
|
+
selected: n.isSelected,
|
|
423
|
+
disabled: n.isDisabled
|
|
424
424
|
}
|
|
425
425
|
]),
|
|
426
|
-
onClick: (
|
|
427
|
-
disabled:
|
|
428
|
-
}, A(
|
|
426
|
+
onClick: (r) => M(n),
|
|
427
|
+
disabled: n.isDisabled
|
|
428
|
+
}, A(n.name.substring(0, 3)), 11, Ie)
|
|
429
429
|
]))), 128))
|
|
430
430
|
]))), 128))
|
|
431
431
|
])
|
|
@@ -440,30 +440,30 @@ const _e = { class: "time-picker-container" }, we = ["aria-selected", "onClick"]
|
|
|
440
440
|
selectedDate: {}
|
|
441
441
|
},
|
|
442
442
|
emits: ["select"],
|
|
443
|
-
setup(
|
|
444
|
-
const
|
|
445
|
-
...
|
|
446
|
-
isSelected:
|
|
447
|
-
}))),
|
|
448
|
-
const
|
|
449
|
-
for (let
|
|
450
|
-
|
|
451
|
-
return
|
|
452
|
-
}),
|
|
453
|
-
|
|
443
|
+
setup(e, { emit: o }) {
|
|
444
|
+
const l = e, a = o, t = $(() => te(l.currentDate.getFullYear()).map((s) => ({
|
|
445
|
+
...s,
|
|
446
|
+
isSelected: l.selectedDate ? s.month === l.selectedDate.getMonth() && s.year === l.selectedDate.getFullYear() : !1
|
|
447
|
+
}))), u = $(() => {
|
|
448
|
+
const c = [];
|
|
449
|
+
for (let s = 0; s < t.value.length; s += 3)
|
|
450
|
+
c.push(t.value.slice(s, s + 3));
|
|
451
|
+
return c;
|
|
452
|
+
}), i = (c) => {
|
|
453
|
+
a("select", c.month);
|
|
454
454
|
};
|
|
455
|
-
return (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
(
|
|
459
|
-
key:
|
|
455
|
+
return (c, s) => (h(), k("div", Ve, [
|
|
456
|
+
p("table", Ne, [
|
|
457
|
+
p("tbody", xe, [
|
|
458
|
+
(h(!0), k(F, null, I(u.value, (f, M) => (h(), k("tr", {
|
|
459
|
+
key: M,
|
|
460
460
|
class: "date-picker-months-row"
|
|
461
461
|
}, [
|
|
462
|
-
(
|
|
462
|
+
(h(!0), k(F, null, I(f, (m) => (h(), k("td", {
|
|
463
463
|
key: m.month,
|
|
464
464
|
class: "date-picker-month-cell"
|
|
465
465
|
}, [
|
|
466
|
-
|
|
466
|
+
p("button", {
|
|
467
467
|
class: C([
|
|
468
468
|
"date-picker-month",
|
|
469
469
|
{
|
|
@@ -471,7 +471,7 @@ const _e = { class: "time-picker-container" }, we = ["aria-selected", "onClick"]
|
|
|
471
471
|
disabled: m.isDisabled
|
|
472
472
|
}
|
|
473
473
|
]),
|
|
474
|
-
onClick: (S) =>
|
|
474
|
+
onClick: (S) => i(m),
|
|
475
475
|
disabled: m.isDisabled
|
|
476
476
|
}, A(m.name), 11, Be)
|
|
477
477
|
]))), 128))
|
|
@@ -487,129 +487,133 @@ const _e = { class: "time-picker-container" }, we = ["aria-selected", "onClick"]
|
|
|
487
487
|
viewMode: {}
|
|
488
488
|
},
|
|
489
489
|
emits: ["header-click"],
|
|
490
|
-
setup(
|
|
491
|
-
const
|
|
492
|
-
const
|
|
493
|
-
switch (
|
|
490
|
+
setup(e, { emit: o }) {
|
|
491
|
+
const l = e, a = o, t = $(() => {
|
|
492
|
+
const i = l.currentDate.getFullYear(), c = l.currentDate.getMonth();
|
|
493
|
+
switch (l.viewMode) {
|
|
494
494
|
case "date":
|
|
495
|
-
return `${E[
|
|
495
|
+
return `${E[c]} ${i}`;
|
|
496
496
|
case "year":
|
|
497
|
-
const
|
|
498
|
-
return `${
|
|
497
|
+
const s = Math.floor(i / 10) * 10, f = s + 9;
|
|
498
|
+
return `${s}–${f}`;
|
|
499
499
|
default:
|
|
500
|
-
return `${E[
|
|
500
|
+
return `${E[c]} ${i}`;
|
|
501
501
|
}
|
|
502
|
-
}),
|
|
503
|
-
|
|
502
|
+
}), u = () => {
|
|
503
|
+
a("header-click");
|
|
504
504
|
};
|
|
505
|
-
return (
|
|
505
|
+
return (i, c) => (h(), k("button", {
|
|
506
506
|
class: "date-picker-title",
|
|
507
|
-
onClick:
|
|
507
|
+
onClick: u,
|
|
508
508
|
type: "button"
|
|
509
509
|
}, A(t.value), 1));
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
|
-
function ze(
|
|
513
|
-
const
|
|
512
|
+
function ze(e, o) {
|
|
513
|
+
const l = $(() => e.value ? e.value instanceof Date ? e.value : U(e.value) : null), a = P(l.value ? new Date(l.value) : /* @__PURE__ */ new Date()), t = P("date");
|
|
514
|
+
q(l, (v) => {
|
|
515
|
+
v && (a.value.getFullYear() !== v.getFullYear() || a.value.getMonth() !== v.getMonth()) && (a.value = new Date(v));
|
|
516
|
+
});
|
|
517
|
+
const u = (v) => {
|
|
514
518
|
const w = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/, H = /^\d{4}-\d{2}-\d{2}$/;
|
|
515
|
-
return w.test(
|
|
516
|
-
},
|
|
517
|
-
if (!
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
return
|
|
521
|
-
}),
|
|
522
|
-
if (!
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
525
|
-
const w =
|
|
526
|
-
return new Date(w, H, 1) >
|
|
527
|
-
}),
|
|
528
|
-
if (!
|
|
529
|
-
const
|
|
530
|
-
if (!
|
|
531
|
-
const w =
|
|
532
|
-
return new Date(w, H + 1, 0) <
|
|
533
|
-
}),
|
|
534
|
-
|
|
535
|
-
},
|
|
536
|
-
|
|
519
|
+
return w.test(v) ? v.includes(".") ? "YYYY-MM-DDTHH:mm:ss.sssZ" : "YYYY-MM-DDTHH:mm:ssZ" : H.test(v) ? "YYYY-MM-DD" : e.format || "YYYY-MM-DD";
|
|
520
|
+
}, i = $(() => {
|
|
521
|
+
if (!e.value) return !1;
|
|
522
|
+
if (e.value instanceof Date) return !0;
|
|
523
|
+
const v = u(e.value);
|
|
524
|
+
return v.includes("H") || v.includes("h") || v.includes("m") || v.includes("T");
|
|
525
|
+
}), c = $(() => {
|
|
526
|
+
if (!e.minDate) return !0;
|
|
527
|
+
const v = U(e.minDate);
|
|
528
|
+
if (!v) return !0;
|
|
529
|
+
const w = a.value.getFullYear(), H = a.value.getMonth();
|
|
530
|
+
return new Date(w, H, 1) > v;
|
|
531
|
+
}), s = $(() => {
|
|
532
|
+
if (!e.maxDate) return !0;
|
|
533
|
+
const v = U(e.maxDate);
|
|
534
|
+
if (!v) return !0;
|
|
535
|
+
const w = a.value.getFullYear(), H = a.value.getMonth();
|
|
536
|
+
return new Date(w, H + 1, 0) < v;
|
|
537
|
+
}), f = () => {
|
|
538
|
+
c.value && (a.value = new Date(a.value.getFullYear(), a.value.getMonth() - 1, 1));
|
|
539
|
+
}, M = () => {
|
|
540
|
+
s.value && (a.value = new Date(a.value.getFullYear(), a.value.getMonth() + 1, 1));
|
|
537
541
|
}, m = () => {
|
|
538
|
-
|
|
542
|
+
a.value = new Date(a.value.getFullYear() - 1, a.value.getMonth(), 1);
|
|
539
543
|
}, S = () => {
|
|
540
|
-
|
|
544
|
+
a.value = new Date(a.value.getFullYear() + 1, a.value.getMonth(), 1);
|
|
541
545
|
}, y = () => {
|
|
542
|
-
|
|
546
|
+
a.value = new Date(a.value.getFullYear() - 10, a.value.getMonth(), 1);
|
|
543
547
|
}, d = () => {
|
|
544
|
-
|
|
545
|
-
},
|
|
546
|
-
|
|
547
|
-
},
|
|
548
|
-
switch (
|
|
548
|
+
a.value = new Date(a.value.getFullYear() + 10, a.value.getMonth(), 1);
|
|
549
|
+
}, n = () => {
|
|
550
|
+
a.value = /* @__PURE__ */ new Date(), t.value = "date";
|
|
551
|
+
}, r = () => {
|
|
552
|
+
switch (t.value) {
|
|
549
553
|
case "date":
|
|
550
|
-
|
|
554
|
+
t.value = "year";
|
|
551
555
|
break;
|
|
552
556
|
case "year":
|
|
553
|
-
|
|
557
|
+
t.value = "date";
|
|
554
558
|
break;
|
|
555
559
|
}
|
|
556
|
-
}, D = (
|
|
557
|
-
if (!le(
|
|
558
|
-
if (
|
|
559
|
-
|
|
560
|
+
}, D = (v) => {
|
|
561
|
+
if (!le(v, e.minDate, e.maxDate, e.disabledDates)) {
|
|
562
|
+
if (l.value && L(l.value, v)) {
|
|
563
|
+
o("update:value", null), o("change", null), o("select", null);
|
|
560
564
|
return;
|
|
561
565
|
}
|
|
562
|
-
|
|
566
|
+
e.mode === "dateTime" && l.value && v.setHours(l.value.getHours(), l.value.getMinutes()), T(v);
|
|
563
567
|
}
|
|
564
|
-
},
|
|
565
|
-
if (
|
|
566
|
-
|
|
568
|
+
}, b = (v) => {
|
|
569
|
+
if (l.value && L(l.value, v)) {
|
|
570
|
+
o("update:value", null), o("change", null), o("select", null);
|
|
567
571
|
return;
|
|
568
572
|
}
|
|
569
|
-
T(
|
|
570
|
-
}, V = (
|
|
571
|
-
const w = new Date(
|
|
572
|
-
if (
|
|
573
|
-
if (
|
|
574
|
-
|
|
573
|
+
T(v);
|
|
574
|
+
}, V = (v) => {
|
|
575
|
+
const w = new Date(a.value.getFullYear(), v, 1);
|
|
576
|
+
if (a.value = w, t.value = "date", e.mode === "month") {
|
|
577
|
+
if (l.value && oe(l.value, w)) {
|
|
578
|
+
o("update:value", null), o("change", null), o("select", null);
|
|
575
579
|
return;
|
|
576
580
|
}
|
|
577
581
|
T(w);
|
|
578
582
|
}
|
|
579
|
-
}, Y = (
|
|
580
|
-
|
|
581
|
-
}, T = (
|
|
583
|
+
}, Y = (v) => {
|
|
584
|
+
a.value = new Date(v, a.value.getMonth(), 1), t.value = "date";
|
|
585
|
+
}, T = (v, w = !1) => {
|
|
582
586
|
let H;
|
|
583
|
-
if (typeof
|
|
584
|
-
if (
|
|
585
|
-
H = Z(
|
|
586
|
-
else if (
|
|
587
|
-
H =
|
|
587
|
+
if (typeof e.value == "string" || e.value === null || e.value === void 0)
|
|
588
|
+
if (e.format && e.format !== "YYYY-MM-DD" && !w && e.mode !== "dateTime" && e.mode !== "time")
|
|
589
|
+
H = Z(v, e.format);
|
|
590
|
+
else if (e.mode === "dateTime" || e.mode === "time" || w)
|
|
591
|
+
H = v.toISOString();
|
|
588
592
|
else {
|
|
589
|
-
const z =
|
|
593
|
+
const z = v.getFullYear(), _ = String(v.getMonth() + 1).padStart(2, "0"), N = String(v.getDate()).padStart(2, "0");
|
|
590
594
|
H = `${z}-${_}-${N}`;
|
|
591
595
|
}
|
|
592
596
|
else
|
|
593
|
-
H =
|
|
594
|
-
|
|
597
|
+
H = v;
|
|
598
|
+
o("update:value", H), o("change", H), o("select", H);
|
|
595
599
|
};
|
|
596
600
|
return {
|
|
597
|
-
currentDate:
|
|
598
|
-
viewMode:
|
|
599
|
-
selectedDate:
|
|
600
|
-
canGoPrev:
|
|
601
|
-
canGoNext:
|
|
602
|
-
hasTime:
|
|
603
|
-
goToPrevMonth:
|
|
604
|
-
goToNextMonth:
|
|
601
|
+
currentDate: a,
|
|
602
|
+
viewMode: t,
|
|
603
|
+
selectedDate: l,
|
|
604
|
+
canGoPrev: c,
|
|
605
|
+
canGoNext: s,
|
|
606
|
+
hasTime: i,
|
|
607
|
+
goToPrevMonth: f,
|
|
608
|
+
goToNextMonth: M,
|
|
605
609
|
goToPrevYear: m,
|
|
606
610
|
goToNextYear: S,
|
|
607
611
|
goToPrevDecade: y,
|
|
608
612
|
goToNextDecade: d,
|
|
609
|
-
goToCurrentDate:
|
|
610
|
-
onHeaderClick:
|
|
613
|
+
goToCurrentDate: n,
|
|
614
|
+
onHeaderClick: r,
|
|
611
615
|
onDateSelect: D,
|
|
612
|
-
onWeekSelect:
|
|
616
|
+
onWeekSelect: b,
|
|
613
617
|
onMonthSelect: V,
|
|
614
618
|
onYearSelect: Y,
|
|
615
619
|
emitValue: T
|
|
@@ -636,142 +640,142 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
636
640
|
minuteInterval: { default: 1 }
|
|
637
641
|
},
|
|
638
642
|
emits: ["update:value", "change", "select"],
|
|
639
|
-
setup(
|
|
640
|
-
const
|
|
643
|
+
setup(e, { emit: o }) {
|
|
644
|
+
const l = e, a = o, {
|
|
641
645
|
currentDate: t,
|
|
642
|
-
viewMode:
|
|
643
|
-
selectedDate:
|
|
644
|
-
canGoPrev:
|
|
645
|
-
canGoNext:
|
|
646
|
-
hasTime:
|
|
647
|
-
goToPrevMonth:
|
|
646
|
+
viewMode: u,
|
|
647
|
+
selectedDate: i,
|
|
648
|
+
canGoPrev: c,
|
|
649
|
+
canGoNext: s,
|
|
650
|
+
hasTime: f,
|
|
651
|
+
goToPrevMonth: M,
|
|
648
652
|
goToNextMonth: m,
|
|
649
653
|
goToPrevYear: S,
|
|
650
654
|
goToNextYear: y,
|
|
651
655
|
goToPrevDecade: d,
|
|
652
|
-
goToNextDecade:
|
|
653
|
-
goToCurrentDate:
|
|
656
|
+
goToNextDecade: n,
|
|
657
|
+
goToCurrentDate: r,
|
|
654
658
|
onHeaderClick: D,
|
|
655
|
-
onDateSelect:
|
|
659
|
+
onDateSelect: b,
|
|
656
660
|
onWeekSelect: V,
|
|
657
661
|
onMonthSelect: Y,
|
|
658
662
|
onYearSelect: T,
|
|
659
|
-
emitValue:
|
|
660
|
-
} = ze(
|
|
663
|
+
emitValue: v
|
|
664
|
+
} = ze(l, a), w = (_) => {
|
|
661
665
|
if (_ === null) {
|
|
662
|
-
if (
|
|
663
|
-
const N = new Date(
|
|
666
|
+
if (i.value) {
|
|
667
|
+
const N = new Date(i.value);
|
|
664
668
|
N.setHours(0, 0, 0, 0);
|
|
665
669
|
const O = Z(N, "YYYY-MM-DD");
|
|
666
|
-
|
|
670
|
+
a("update:value", O), a("change", O), a("select", O);
|
|
667
671
|
}
|
|
668
672
|
return;
|
|
669
673
|
}
|
|
670
|
-
if (
|
|
671
|
-
const N = new Date(
|
|
672
|
-
N.setHours(_.getHours(), _.getMinutes(), 0, 0),
|
|
674
|
+
if (l.mode === "dateTime" && i.value) {
|
|
675
|
+
const N = new Date(i.value.getTime());
|
|
676
|
+
N.setHours(_.getHours(), _.getMinutes(), 0, 0), v(N, !0);
|
|
673
677
|
} else
|
|
674
|
-
|
|
678
|
+
v(_, !0);
|
|
675
679
|
}, H = () => {
|
|
676
|
-
|
|
680
|
+
u.value === "year" ? d() : u.value === "month" ? S() : M();
|
|
677
681
|
}, z = () => {
|
|
678
|
-
|
|
682
|
+
u.value === "year" ? n() : u.value === "month" ? y() : m();
|
|
679
683
|
};
|
|
680
|
-
return (_, N) => (
|
|
684
|
+
return (_, N) => (h(), k("div", {
|
|
681
685
|
class: C(["date-picker", _.mode == "dateTime" && "date-picker-container-wide"])
|
|
682
686
|
}, [
|
|
683
|
-
_.mode !== "time" ? (
|
|
687
|
+
_.mode !== "time" ? (h(), k("div", Re, [
|
|
684
688
|
G(Le, {
|
|
685
689
|
"current-date": g(t),
|
|
686
|
-
"view-mode": g(
|
|
690
|
+
"view-mode": g(u),
|
|
687
691
|
onHeaderClick: g(D)
|
|
688
692
|
}, null, 8, ["current-date", "view-mode", "onHeaderClick"]),
|
|
689
|
-
|
|
690
|
-
|
|
693
|
+
p("div", Je, [
|
|
694
|
+
p("button", {
|
|
691
695
|
class: "date-picker-nav-button",
|
|
692
|
-
disabled: !g(
|
|
696
|
+
disabled: !g(c),
|
|
693
697
|
onClick: H,
|
|
694
698
|
type: "button",
|
|
695
699
|
"aria-label": "Previous"
|
|
696
700
|
}, [
|
|
697
|
-
|
|
701
|
+
p("span", {
|
|
698
702
|
class: "date-picker-nav-icon",
|
|
699
703
|
innerHTML: g(Oe)
|
|
700
704
|
}, null, 8, Ze)
|
|
701
705
|
], 8, Ue),
|
|
702
|
-
|
|
706
|
+
p("button", {
|
|
703
707
|
class: "date-picker-nav-button",
|
|
704
708
|
onClick: N[0] || (N[0] = //@ts-ignore
|
|
705
|
-
(...O) => g(
|
|
709
|
+
(...O) => g(r) && g(r)(...O)),
|
|
706
710
|
type: "button",
|
|
707
711
|
"aria-label": "Current Date"
|
|
708
712
|
}, [
|
|
709
|
-
|
|
713
|
+
p("span", {
|
|
710
714
|
class: "date-picker-nav-icon",
|
|
711
715
|
innerHTML: g(Ge)
|
|
712
716
|
}, null, 8, Ee)
|
|
713
717
|
]),
|
|
714
|
-
|
|
718
|
+
p("button", {
|
|
715
719
|
class: "date-picker-nav-button",
|
|
716
|
-
disabled: !g(
|
|
720
|
+
disabled: !g(s),
|
|
717
721
|
onClick: z,
|
|
718
722
|
type: "button",
|
|
719
723
|
"aria-label": "Next"
|
|
720
724
|
}, [
|
|
721
|
-
|
|
725
|
+
p("span", {
|
|
722
726
|
class: "date-picker-nav-icon",
|
|
723
727
|
innerHTML: g(We)
|
|
724
728
|
}, null, 8, Ke)
|
|
725
729
|
], 8, je)
|
|
726
730
|
])
|
|
727
731
|
])) : B("", !0),
|
|
728
|
-
|
|
732
|
+
p("div", {
|
|
729
733
|
class: C({
|
|
730
|
-
"date-picker-datetime-layout": _.mode === "dateTime" && g(
|
|
734
|
+
"date-picker-datetime-layout": _.mode === "dateTime" && g(u) === "date"
|
|
731
735
|
})
|
|
732
736
|
}, [
|
|
733
|
-
|
|
734
|
-
g(
|
|
737
|
+
p("div", Qe, [
|
|
738
|
+
g(u) === "date" && (_.mode === "date" || _.mode === "dateTime") ? (h(), W(pe, {
|
|
735
739
|
key: 0,
|
|
736
740
|
"current-date": g(t),
|
|
737
|
-
"selected-date": g(
|
|
741
|
+
"selected-date": g(i),
|
|
738
742
|
"min-date": _.minDate,
|
|
739
743
|
"max-date": _.maxDate,
|
|
740
744
|
"disabled-dates": _.disabledDates,
|
|
741
|
-
onSelect: g(
|
|
745
|
+
onSelect: g(b)
|
|
742
746
|
}, null, 8, ["current-date", "selected-date", "min-date", "max-date", "disabled-dates", "onSelect"])) : B("", !0),
|
|
743
|
-
_.mode === "week" && g(
|
|
747
|
+
_.mode === "week" && g(u) === "date" ? (h(), W(be, {
|
|
744
748
|
key: 1,
|
|
745
749
|
"current-date": g(t),
|
|
746
|
-
"selected-date": g(
|
|
750
|
+
"selected-date": g(i),
|
|
747
751
|
onSelect: g(V)
|
|
748
752
|
}, null, 8, ["current-date", "selected-date", "onSelect"])) : B("", !0),
|
|
749
|
-
g(
|
|
753
|
+
g(u) !== "year" && (g(u) === "month" || _.mode === "month") ? (h(), W(qe, {
|
|
750
754
|
key: 2,
|
|
751
755
|
"current-date": g(t),
|
|
752
|
-
"selected-date": g(
|
|
756
|
+
"selected-date": g(i),
|
|
753
757
|
onSelect: g(Y)
|
|
754
758
|
}, null, 8, ["current-date", "selected-date", "onSelect"])) : B("", !0),
|
|
755
|
-
g(
|
|
759
|
+
g(u) === "year" ? (h(), W(Ae, {
|
|
756
760
|
key: 3,
|
|
757
761
|
"current-date": g(t),
|
|
758
|
-
"selected-date": g(
|
|
762
|
+
"selected-date": g(i),
|
|
759
763
|
onSelect: g(T),
|
|
760
764
|
onMonthSelect: g(Y)
|
|
761
765
|
}, null, 8, ["current-date", "selected-date", "onSelect", "onMonthSelect"])) : B("", !0)
|
|
762
766
|
]),
|
|
763
|
-
_.mode === "dateTime" && g(
|
|
767
|
+
_.mode === "dateTime" && g(u) === "date" ? (h(), k("div", Xe, [
|
|
764
768
|
G(j, {
|
|
765
|
-
"selected-time": g(
|
|
769
|
+
"selected-time": g(f) ? g(i) : null,
|
|
766
770
|
"time-format": _.timeFormat,
|
|
767
771
|
"minute-interval": _.minuteInterval,
|
|
768
772
|
onUpdate: w
|
|
769
773
|
}, null, 8, ["selected-time", "time-format", "minute-interval"])
|
|
770
774
|
])) : B("", !0)
|
|
771
775
|
], 2),
|
|
772
|
-
_.mode === "time" ? (
|
|
776
|
+
_.mode === "time" ? (h(), W(j, {
|
|
773
777
|
key: 1,
|
|
774
|
-
"selected-time": g(
|
|
778
|
+
"selected-time": g(i),
|
|
775
779
|
"time-format": _.timeFormat,
|
|
776
780
|
"minute-interval": _.minuteInterval,
|
|
777
781
|
onUpdate: w
|
|
@@ -794,22 +798,22 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
794
798
|
minuteInterval: { default: 1 }
|
|
795
799
|
},
|
|
796
800
|
emits: ["select-hour", "select-minute", "select-period", "close"],
|
|
797
|
-
setup(
|
|
798
|
-
const
|
|
799
|
-
const d =
|
|
800
|
-
return Array.from({ length:
|
|
801
|
-
}),
|
|
802
|
-
if (
|
|
803
|
-
const d =
|
|
804
|
-
|
|
801
|
+
setup(e, { expose: o, emit: l }) {
|
|
802
|
+
const a = e, t = l, u = P(null), i = P(null), c = P(null), s = $(() => a.is12Hour ? Array.from({ length: 12 }, (d, n) => n + 1) : Array.from({ length: 24 }, (d, n) => n)), f = $(() => {
|
|
803
|
+
const d = a.minuteInterval, n = Math.floor(60 / d);
|
|
804
|
+
return Array.from({ length: n }, (r, D) => D * d);
|
|
805
|
+
}), M = () => {
|
|
806
|
+
if (u.value) {
|
|
807
|
+
const d = u.value.querySelectorAll(".time-picker-option-button"), n = Array.from(d).findIndex((r) => r.classList.contains("selected"));
|
|
808
|
+
n !== -1 && d[n].scrollIntoView({ block: "center", behavior: "auto" });
|
|
805
809
|
}
|
|
806
|
-
if (
|
|
807
|
-
const d =
|
|
808
|
-
|
|
810
|
+
if (i.value) {
|
|
811
|
+
const d = i.value.querySelectorAll(".time-picker-option-button"), n = Array.from(d).findIndex((r) => r.classList.contains("selected"));
|
|
812
|
+
n !== -1 && d[n].scrollIntoView({ block: "center", behavior: "auto" });
|
|
809
813
|
}
|
|
810
|
-
if (
|
|
811
|
-
const d =
|
|
812
|
-
|
|
814
|
+
if (a.is12Hour && c.value) {
|
|
815
|
+
const d = c.value.querySelectorAll(".time-picker-option-button"), n = Array.from(d).findIndex((r) => r.classList.contains("selected"));
|
|
816
|
+
n !== -1 && d[n].scrollIntoView({ block: "center", behavior: "auto" });
|
|
813
817
|
}
|
|
814
818
|
}, m = (d) => {
|
|
815
819
|
t("select-hour", d);
|
|
@@ -818,51 +822,51 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
818
822
|
}, y = (d) => {
|
|
819
823
|
t("select-period", d);
|
|
820
824
|
};
|
|
821
|
-
return
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
+
return o({ scrollToSelected: M }), (d, n) => (h(), k("div", et, [
|
|
826
|
+
p("div", tt, [
|
|
827
|
+
p("div", lt, [
|
|
828
|
+
p("div", {
|
|
825
829
|
ref_key: "hourScroll",
|
|
826
|
-
ref:
|
|
830
|
+
ref: u,
|
|
827
831
|
class: "time-picker-options-scroll"
|
|
828
832
|
}, [
|
|
829
|
-
(
|
|
830
|
-
key:
|
|
833
|
+
(h(!0), k(F, null, I(s.value, (r) => (h(), k("button", {
|
|
834
|
+
key: r,
|
|
831
835
|
type: "button",
|
|
832
|
-
class: C(["time-picker-option-button", { selected:
|
|
833
|
-
onClick: (D) => m(
|
|
834
|
-
}, A(String(
|
|
836
|
+
class: C(["time-picker-option-button", { selected: r === d.selectedHour }]),
|
|
837
|
+
onClick: (D) => m(r)
|
|
838
|
+
}, A(String(r).padStart(2, "0")), 11, at))), 128))
|
|
835
839
|
], 512)
|
|
836
840
|
]),
|
|
837
|
-
|
|
838
|
-
|
|
841
|
+
p("div", nt, [
|
|
842
|
+
p("div", {
|
|
839
843
|
ref_key: "minuteScroll",
|
|
840
|
-
ref:
|
|
844
|
+
ref: i,
|
|
841
845
|
class: "time-picker-options-scroll"
|
|
842
846
|
}, [
|
|
843
|
-
(
|
|
844
|
-
key:
|
|
847
|
+
(h(!0), k(F, null, I(f.value, (r) => (h(), k("button", {
|
|
848
|
+
key: r,
|
|
845
849
|
type: "button",
|
|
846
|
-
class: C(["time-picker-option-button", { selected:
|
|
847
|
-
onClick: (D) => S(
|
|
848
|
-
}, A(String(
|
|
850
|
+
class: C(["time-picker-option-button", { selected: r === d.selectedMinute }]),
|
|
851
|
+
onClick: (D) => S(r)
|
|
852
|
+
}, A(String(r).padStart(2, "0")), 11, st))), 128))
|
|
849
853
|
], 512)
|
|
850
854
|
]),
|
|
851
|
-
d.is12Hour ? (
|
|
852
|
-
|
|
855
|
+
d.is12Hour ? (h(), k("div", ot, [
|
|
856
|
+
p("div", {
|
|
853
857
|
ref_key: "periodScroll",
|
|
854
|
-
ref:
|
|
858
|
+
ref: c,
|
|
855
859
|
class: "time-picker-options-scroll"
|
|
856
860
|
}, [
|
|
857
|
-
|
|
861
|
+
p("button", {
|
|
858
862
|
type: "button",
|
|
859
863
|
class: C(["time-picker-option-button", { selected: d.selectedPeriod === "AM" }]),
|
|
860
|
-
onClick:
|
|
864
|
+
onClick: n[0] || (n[0] = (r) => y("AM"))
|
|
861
865
|
}, " AM ", 2),
|
|
862
|
-
|
|
866
|
+
p("button", {
|
|
863
867
|
type: "button",
|
|
864
868
|
class: C(["time-picker-option-button", { selected: d.selectedPeriod === "PM" }]),
|
|
865
|
-
onClick:
|
|
869
|
+
onClick: n[1] || (n[1] = (r) => y("PM"))
|
|
866
870
|
}, " PM ", 2)
|
|
867
871
|
], 512)
|
|
868
872
|
])) : B("", !0)
|
|
@@ -880,23 +884,23 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
880
884
|
disabled: { type: Boolean },
|
|
881
885
|
readonly: { type: Boolean }
|
|
882
886
|
},
|
|
883
|
-
setup(
|
|
884
|
-
const
|
|
885
|
-
const
|
|
886
|
-
if (
|
|
887
|
-
let t =
|
|
888
|
-
return t === 0 && (t = 12), `${String(t).padStart(2, "0")}:${
|
|
887
|
+
setup(e) {
|
|
888
|
+
const o = e, l = $(() => {
|
|
889
|
+
const a = String(o.minute).padStart(2, "0");
|
|
890
|
+
if (o.is12Hour) {
|
|
891
|
+
let t = o.hour % 12;
|
|
892
|
+
return t === 0 && (t = 12), `${String(t).padStart(2, "0")}:${a} ${o.period}`;
|
|
889
893
|
} else
|
|
890
|
-
return `${String(
|
|
894
|
+
return `${String(o.hour).padStart(2, "0")}:${a}`;
|
|
891
895
|
});
|
|
892
|
-
return (
|
|
893
|
-
|
|
896
|
+
return (a, t) => K(a.$slots, "default", Q(X({ displayTime: l.value })), () => [
|
|
897
|
+
p("button", {
|
|
894
898
|
type: "button",
|
|
895
|
-
class: C(["time-picker-input", [
|
|
896
|
-
disabled:
|
|
899
|
+
class: C(["time-picker-input", [a.triggerClass, { "is-disabled": a.disabled, "is-readonly": a.readonly }]]),
|
|
900
|
+
disabled: a.disabled || a.readonly
|
|
897
901
|
}, [
|
|
898
|
-
|
|
899
|
-
t[0] || (t[0] =
|
|
902
|
+
p("span", ct, A(l.value), 1),
|
|
903
|
+
t[0] || (t[0] = p("svg", {
|
|
900
904
|
class: "time-picker-clock-icon",
|
|
901
905
|
xmlns: "http://www.w3.org/2000/svg",
|
|
902
906
|
width: "18",
|
|
@@ -908,12 +912,12 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
908
912
|
"stroke-linecap": "round",
|
|
909
913
|
"stroke-linejoin": "round"
|
|
910
914
|
}, [
|
|
911
|
-
|
|
915
|
+
p("circle", {
|
|
912
916
|
cx: "12",
|
|
913
917
|
cy: "12",
|
|
914
918
|
r: "10"
|
|
915
919
|
}),
|
|
916
|
-
|
|
920
|
+
p("polyline", { points: "12,6 12,12 16,14" })
|
|
917
921
|
], -1))
|
|
918
922
|
], 10, it)
|
|
919
923
|
]);
|
|
@@ -934,50 +938,50 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
934
938
|
readonly: { type: Boolean, default: !1 }
|
|
935
939
|
},
|
|
936
940
|
emits: ["update:modelValue"],
|
|
937
|
-
setup(
|
|
938
|
-
const
|
|
939
|
-
if (
|
|
940
|
-
let
|
|
941
|
-
if (
|
|
942
|
-
|
|
943
|
-
else if (typeof
|
|
944
|
-
const [D,
|
|
945
|
-
|
|
941
|
+
setup(e, { emit: o }) {
|
|
942
|
+
const l = e, a = o, t = P(12), u = P(0), i = P("AM"), c = P(null), s = $(() => l.timeFormat === "12h"), f = () => {
|
|
943
|
+
if (l.modelValue) {
|
|
944
|
+
let n = 0, r = 0;
|
|
945
|
+
if (l.modelValue instanceof Date)
|
|
946
|
+
n = l.modelValue.getHours(), r = l.modelValue.getMinutes();
|
|
947
|
+
else if (typeof l.modelValue == "string") {
|
|
948
|
+
const [D, b] = l.modelValue.split(":");
|
|
949
|
+
n = parseInt(D), r = parseInt(b);
|
|
946
950
|
} else {
|
|
947
951
|
const D = /* @__PURE__ */ new Date();
|
|
948
|
-
|
|
952
|
+
n = D.getHours(), r = D.getMinutes();
|
|
949
953
|
}
|
|
950
|
-
|
|
954
|
+
u.value = r, s.value ? n === 0 ? (t.value = 12, i.value = "AM") : n === 12 ? (t.value = 12, i.value = "PM") : n > 12 ? (t.value = n - 12, i.value = "PM") : (t.value = n, i.value = "AM") : t.value = n;
|
|
951
955
|
} else {
|
|
952
|
-
const
|
|
953
|
-
|
|
956
|
+
const n = /* @__PURE__ */ new Date(), r = n.getHours(), D = n.getMinutes();
|
|
957
|
+
u.value = D, s.value ? r === 0 ? (t.value = 12, i.value = "AM") : r === 12 ? (t.value = 12, i.value = "PM") : r > 12 ? (t.value = r - 12, i.value = "PM") : (t.value = r, i.value = "AM") : t.value = r;
|
|
954
958
|
}
|
|
955
|
-
},
|
|
956
|
-
let
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
}, m = (
|
|
961
|
-
t.value =
|
|
962
|
-
}, S = (
|
|
963
|
-
|
|
964
|
-
}, y = (
|
|
965
|
-
|
|
959
|
+
}, M = () => {
|
|
960
|
+
let n = t.value;
|
|
961
|
+
s.value && (i.value === "AM" && n === 12 ? n = 0 : i.value === "PM" && n !== 12 && (n += 12));
|
|
962
|
+
const r = `${String(n).padStart(2, "0")}:${String(u.value).padStart(2, "0")}`;
|
|
963
|
+
a("update:modelValue", r);
|
|
964
|
+
}, m = (n) => {
|
|
965
|
+
t.value = n, M();
|
|
966
|
+
}, S = (n) => {
|
|
967
|
+
u.value = n, M();
|
|
968
|
+
}, y = (n) => {
|
|
969
|
+
i.value = n, M();
|
|
966
970
|
}, d = () => {
|
|
967
|
-
var
|
|
968
|
-
(
|
|
971
|
+
var n;
|
|
972
|
+
(n = c == null ? void 0 : c.value) == null || n.scrollToSelected();
|
|
969
973
|
};
|
|
970
|
-
return
|
|
974
|
+
return q(() => l.modelValue, f, { immediate: !0 }), q(() => l.timeFormat, f), q(() => l.minuteInterval, f), (n, r) => (h(), k("div", dt, [
|
|
971
975
|
G(g(se), {
|
|
972
976
|
trigger: "click",
|
|
973
977
|
placement: "bottom-start",
|
|
974
978
|
onOnShow: d,
|
|
975
979
|
teleport: "",
|
|
976
980
|
arrow: !1,
|
|
977
|
-
offset:
|
|
981
|
+
offset: n.offset,
|
|
978
982
|
triggerClass: "w-full",
|
|
979
|
-
"class-name": `v-time-picker ${
|
|
980
|
-
styles:
|
|
983
|
+
"class-name": `v-time-picker ${n.className}`,
|
|
984
|
+
styles: n.style,
|
|
981
985
|
style: {
|
|
982
986
|
width: "100%"
|
|
983
987
|
}
|
|
@@ -985,15 +989,15 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
985
989
|
trigger: J(() => [
|
|
986
990
|
G(ut, {
|
|
987
991
|
hour: t.value,
|
|
988
|
-
minute:
|
|
989
|
-
period:
|
|
990
|
-
"is12-hour":
|
|
991
|
-
"trigger-class":
|
|
992
|
-
disabled:
|
|
993
|
-
readonly:
|
|
992
|
+
minute: u.value,
|
|
993
|
+
period: i.value,
|
|
994
|
+
"is12-hour": s.value,
|
|
995
|
+
"trigger-class": n.triggerClass,
|
|
996
|
+
disabled: n.disabled,
|
|
997
|
+
readonly: n.readonly
|
|
994
998
|
}, {
|
|
995
999
|
default: J(({ displayTime: D }) => [
|
|
996
|
-
K(
|
|
1000
|
+
K(n.$slots, "default", Q(X({ displayTime: D })))
|
|
997
1001
|
]),
|
|
998
1002
|
_: 3
|
|
999
1003
|
}, 8, ["hour", "minute", "period", "is12-hour", "trigger-class", "disabled", "readonly"])
|
|
@@ -1001,12 +1005,12 @@ const Oe = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewB
|
|
|
1001
1005
|
default: J(() => [
|
|
1002
1006
|
G(rt, {
|
|
1003
1007
|
ref_key: "dropdownRef",
|
|
1004
|
-
ref:
|
|
1008
|
+
ref: c,
|
|
1005
1009
|
"selected-hour": t.value,
|
|
1006
|
-
"selected-minute":
|
|
1007
|
-
"selected-period":
|
|
1008
|
-
"is12-hour":
|
|
1009
|
-
"minute-interval":
|
|
1010
|
+
"selected-minute": u.value,
|
|
1011
|
+
"selected-period": i.value,
|
|
1012
|
+
"is12-hour": s.value,
|
|
1013
|
+
"minute-interval": n.minuteInterval,
|
|
1010
1014
|
onSelectHour: m,
|
|
1011
1015
|
onSelectMinute: S,
|
|
1012
1016
|
onSelectPeriod: y
|