v-datepicker-lite 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,69 +1,69 @@
1
- import { defineComponent as q, computed as Y, createElementBlock as D, openBlock as v, createElementVNode as p, Fragment as C, renderList as H, unref as o, toDisplayString as x, normalizeClass as I, ref as N, watch as O, nextTick as B, onMounted as R, createBlock as z, createCommentVNode as G, normalizeStyle as Q, createVNode as X } from "vue";
2
- const U = (t, r = "YYYY-MM-DD") => {
3
- const e = t.getFullYear(), u = String(t.getMonth() + 1).padStart(2, "0"), s = String(t.getDate()).padStart(2, "0"), d = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0"), a = String(t.getSeconds()).padStart(2, "0"), n = String(t.getMilliseconds()).padStart(3, "0");
4
- return r.replace("YYYY", e.toString()).replace("MM", u).replace("DD", s).replace("HH", d).replace("mm", i).replace("ss", a).replace("sss", n);
5
- }, W = (t) => {
6
- if (!t) return null;
7
- const r = new Date(t);
8
- return isNaN(r.getTime()) ? null : r;
9
- }, L = (t, r) => t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate(), ee = (t) => {
10
- const r = new Date(t.getFullYear(), 0, 1), e = (t.getTime() - r.getTime()) / 864e5;
11
- return Math.ceil((e + r.getDay() + 1) / 7);
12
- }, Z = (t, r) => {
13
- const e = new Date(t, r, 1), s = new Date(t, r + 1, 0).getDate(), d = e.getDay(), i = [], a = /* @__PURE__ */ new Date(), n = r === 0 ? 11 : r - 1, m = r === 0 ? t - 1 : t, g = new Date(m, n + 1, 0).getDate();
14
- for (let f = d - 1; f >= 0; f--) {
15
- const c = new Date(m, n, g - f);
1
+ import { defineComponent as N, computed as $, createElementBlock as f, openBlock as p, createElementVNode as g, Fragment as P, renderList as x, unref as v, toDisplayString as F, normalizeClass as I, ref as Y, watch as G, nextTick as B, onMounted as R, createBlock as q, createCommentVNode as V, normalizeStyle as X, createVNode as U, onUnmounted as ee } from "vue";
2
+ const Z = (n, c = "YYYY-MM-DD") => {
3
+ const e = n.getFullYear(), h = String(n.getMonth() + 1).padStart(2, "0"), s = String(n.getDate()).padStart(2, "0"), o = String(n.getHours()).padStart(2, "0"), i = String(n.getMinutes()).padStart(2, "0"), t = String(n.getSeconds()).padStart(2, "0"), a = String(n.getMilliseconds()).padStart(3, "0");
4
+ return c.replace("YYYY", e.toString()).replace("MM", h).replace("DD", s).replace("HH", o).replace("mm", i).replace("ss", t).replace("sss", a);
5
+ }, z = (n) => {
6
+ if (!n) return null;
7
+ const c = new Date(n);
8
+ return isNaN(c.getTime()) ? null : c;
9
+ }, O = (n, c) => n.getFullYear() === c.getFullYear() && n.getMonth() === c.getMonth() && n.getDate() === c.getDate(), te = (n) => {
10
+ const c = new Date(n.getFullYear(), 0, 1), e = (n.getTime() - c.getTime()) / 864e5;
11
+ return Math.ceil((e + c.getDay() + 1) / 7);
12
+ }, E = (n, c) => {
13
+ const e = new Date(n, c, 1), s = new Date(n, c + 1, 0).getDate(), o = e.getDay(), i = [], t = /* @__PURE__ */ new Date(), a = c === 0 ? 11 : c - 1, m = c === 0 ? n - 1 : n, y = new Date(m, a + 1, 0).getDate();
14
+ for (let M = o - 1; M >= 0; M--) {
15
+ const u = new Date(m, a, y - M);
16
16
  i.push({
17
- date: c,
18
- day: g - f,
19
- month: n,
17
+ date: u,
18
+ day: y - M,
19
+ month: a,
20
20
  year: m,
21
21
  isCurrentMonth: !1,
22
- isToday: L(c, a),
22
+ isToday: O(u, t),
23
23
  isSelected: !1,
24
24
  isDisabled: !1
25
25
  });
26
26
  }
27
- for (let f = 1; f <= s; f++) {
28
- const c = new Date(t, r, f);
27
+ for (let M = 1; M <= s; M++) {
28
+ const u = new Date(n, c, M);
29
29
  i.push({
30
- date: c,
31
- day: f,
32
- month: r,
33
- year: t,
30
+ date: u,
31
+ day: M,
32
+ month: c,
33
+ year: n,
34
34
  isCurrentMonth: !0,
35
- isToday: L(c, a),
35
+ isToday: O(u, t),
36
36
  isSelected: !1,
37
37
  isDisabled: !1
38
38
  });
39
39
  }
40
- const l = 42 - i.length, b = r === 11 ? 0 : r + 1, k = r === 11 ? t + 1 : t;
41
- for (let f = 1; f <= l; f++) {
42
- const c = new Date(k, b, f);
40
+ const r = 42 - i.length, S = c === 11 ? 0 : c + 1, _ = c === 11 ? n + 1 : n;
41
+ for (let M = 1; M <= r; M++) {
42
+ const u = new Date(_, S, M);
43
43
  i.push({
44
- date: c,
45
- day: f,
46
- month: b,
47
- year: k,
44
+ date: u,
45
+ day: M,
46
+ month: S,
47
+ year: _,
48
48
  isCurrentMonth: !1,
49
- isToday: L(c, a),
49
+ isToday: O(u, t),
50
50
  isSelected: !1,
51
51
  isDisabled: !1
52
52
  });
53
53
  }
54
54
  return i;
55
- }, te = (t, r) => {
56
- const e = Z(t, r), u = [];
55
+ }, ne = (n, c) => {
56
+ const e = E(n, c), h = [];
57
57
  for (let s = 0; s < e.length; s += 7) {
58
- const d = e.slice(s, s + 7), i = ee(d[0].date);
59
- u.push({
58
+ const o = e.slice(s, s + 7), i = te(o[0].date);
59
+ h.push({
60
60
  weekNumber: i,
61
- days: d,
61
+ days: o,
62
62
  isSelected: !1
63
63
  });
64
64
  }
65
- return u;
66
- }, E = (t) => [
65
+ return h;
66
+ }, j = (n) => [
67
67
  "January",
68
68
  "February",
69
69
  "March",
@@ -76,16 +76,16 @@ const U = (t, r = "YYYY-MM-DD") => {
76
76
  "October",
77
77
  "November",
78
78
  "December"
79
- ].map((e, u) => ({
80
- month: u,
81
- year: t,
79
+ ].map((e, h) => ({
80
+ month: h,
81
+ year: n,
82
82
  name: e,
83
83
  isSelected: !1,
84
84
  isDisabled: !1
85
- })), ae = (t, r, e, u) => {
86
- const s = U(t, "YYYY-MM-DD");
87
- return r && s < r || e && s > e ? !0 : u ? u.some((d) => d.end ? s >= d.start && s <= d.end : s === d.start) : !1;
88
- }, A = [
85
+ })), se = (n, c, e, h) => {
86
+ const s = Z(n, "YYYY-MM-DD");
87
+ return c && s < c || e && s > e ? !0 : h ? h.some((o) => o.end ? s >= o.start && s <= o.end : s === o.start) : !1;
88
+ }, W = [
89
89
  "January",
90
90
  "February",
91
91
  "March",
@@ -98,7 +98,7 @@ const U = (t, r = "YYYY-MM-DD") => {
98
98
  "October",
99
99
  "November",
100
100
  "December"
101
- ], j = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ne = { class: "date-picker-content" }, se = { class: "date-picker-table" }, le = { class: "date-picker-weekdays-row" }, re = { class: "date-picker-days-body" }, oe = ["onClick", "disabled"], ce = /* @__PURE__ */ q({
101
+ ], K = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ae = { class: "date-picker-content" }, le = { class: "date-picker-table" }, oe = { class: "date-picker-weekdays-row" }, re = { class: "date-picker-days-body" }, ce = ["onClick", "disabled"], ie = /* @__PURE__ */ N({
102
102
  __name: "DateView",
103
103
  props: {
104
104
  currentDate: {},
@@ -108,104 +108,104 @@ const U = (t, r = "YYYY-MM-DD") => {
108
108
  disabledDates: {}
109
109
  },
110
110
  emits: ["select"],
111
- setup(t, { emit: r }) {
112
- const e = t, u = r, s = Y(() => Z(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((n) => ({
113
- ...n,
114
- isSelected: e.selectedDate ? L(n.date, e.selectedDate) : !1,
115
- isDisabled: ae(n.date, e.minDate, e.maxDate, e.disabledDates)
116
- }))), d = Y(() => {
117
- const a = [];
118
- for (let n = 0; n < s.value.length; n += 7)
119
- a.push(s.value.slice(n, n + 7));
120
- return a;
121
- }), i = (a) => {
122
- a.isDisabled || u("select", a.date);
111
+ setup(n, { emit: c }) {
112
+ const e = n, h = c, s = $(() => E(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((a) => ({
113
+ ...a,
114
+ isSelected: e.selectedDate ? O(a.date, e.selectedDate) : !1,
115
+ isDisabled: se(a.date, e.minDate, e.maxDate, e.disabledDates)
116
+ }))), o = $(() => {
117
+ const t = [];
118
+ for (let a = 0; a < s.value.length; a += 7)
119
+ t.push(s.value.slice(a, a + 7));
120
+ return t;
121
+ }), i = (t) => {
122
+ t.isDisabled || h("select", t.date);
123
123
  };
124
- return (a, n) => (v(), D("div", ne, [
125
- p("table", se, [
126
- p("thead", null, [
127
- p("tr", le, [
128
- (v(!0), D(C, null, H(o(j), (m) => (v(), D("th", { key: m }, x(m), 1))), 128))
124
+ return (t, a) => (p(), f("div", ae, [
125
+ g("table", le, [
126
+ g("thead", null, [
127
+ g("tr", oe, [
128
+ (p(!0), f(P, null, x(v(K), (m) => (p(), f("th", { key: m }, F(m), 1))), 128))
129
129
  ])
130
130
  ]),
131
- p("tbody", re, [
132
- (v(!0), D(C, null, H(d.value, (m, g) => (v(), D("tr", {
133
- key: g,
131
+ g("tbody", re, [
132
+ (p(!0), f(P, null, x(o.value, (m, y) => (p(), f("tr", {
133
+ key: y,
134
134
  class: "date-picker-week-row"
135
135
  }, [
136
- (v(!0), D(C, null, H(m, (l) => (v(), D("td", {
137
- key: `${l.year}-${l.month}-${l.day}`,
136
+ (p(!0), f(P, null, x(m, (r) => (p(), f("td", {
137
+ key: `${r.year}-${r.month}-${r.day}`,
138
138
  class: "date-picker-day-cell"
139
139
  }, [
140
- p("button", {
140
+ g("button", {
141
141
  class: I([
142
142
  "date-picker-day",
143
143
  {
144
- "other-month": !l.isCurrentMonth,
145
- today: l.isToday,
146
- selected: l.isSelected,
147
- disabled: l.isDisabled
144
+ "other-month": !r.isCurrentMonth,
145
+ today: r.isToday,
146
+ selected: r.isSelected,
147
+ disabled: r.isDisabled
148
148
  }
149
149
  ]),
150
- onClick: (b) => i(l),
151
- disabled: l.isDisabled
152
- }, x(l.day), 11, oe)
150
+ onClick: (S) => i(r),
151
+ disabled: r.isDisabled
152
+ }, F(r.day), 11, ce)
153
153
  ]))), 128))
154
154
  ]))), 128))
155
155
  ])
156
156
  ])
157
157
  ]));
158
158
  }
159
- }), ie = { class: "date-picker-content" }, ue = {
159
+ }), ue = { class: "date-picker-content" }, de = {
160
160
  class: "date-picker-table date-picker-week-table",
161
161
  cellpadding: "0",
162
162
  cellspacing: "0"
163
- }, de = { class: "date-picker-weekdays-row" }, me = { class: "date-picker-weeks-body" }, ve = ["onClick"], he = { class: "date-picker-week-number-cell" }, pe = { class: "date-picker-week-number" }, De = /* @__PURE__ */ q({
163
+ }, me = { class: "date-picker-weekdays-row" }, ve = { class: "date-picker-weeks-body" }, pe = ["onClick"], he = { class: "date-picker-week-number-cell" }, ke = { class: "date-picker-week-number" }, ge = /* @__PURE__ */ N({
164
164
  __name: "WeekView",
165
165
  props: {
166
166
  currentDate: {},
167
167
  selectedDate: {}
168
168
  },
169
169
  emits: ["select"],
170
- setup(t, { emit: r }) {
171
- const e = t, u = r, s = Y(() => te(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((a) => {
172
- const n = e.selectedDate ? a.days.some((m) => L(m.date, e.selectedDate)) : !1;
170
+ setup(n, { emit: c }) {
171
+ const e = n, h = c, s = $(() => ne(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((t) => {
172
+ const a = e.selectedDate ? t.days.some((m) => O(m.date, e.selectedDate)) : !1;
173
173
  return {
174
- ...a,
175
- isSelected: n
174
+ ...t,
175
+ isSelected: a
176
176
  };
177
- })), d = (i) => {
178
- var n;
179
- const a = ((n = i.days.find((m) => m.isCurrentMonth)) == null ? void 0 : n.date) || i.days[0].date;
180
- u("select", a);
177
+ })), o = (i) => {
178
+ var a;
179
+ const t = ((a = i.days.find((m) => m.isCurrentMonth)) == null ? void 0 : a.date) || i.days[0].date;
180
+ h("select", t);
181
181
  };
182
- return (i, a) => (v(), D("div", ie, [
183
- p("table", ue, [
184
- p("thead", null, [
185
- p("tr", de, [
186
- a[0] || (a[0] = p("th", { class: "date-picker-weekday date-picker-week-header" }, "Wk", -1)),
187
- (v(!0), D(C, null, H(o(j), (n) => (v(), D("th", { key: n }, x(n), 1))), 128))
182
+ return (i, t) => (p(), f("div", ue, [
183
+ g("table", de, [
184
+ g("thead", null, [
185
+ g("tr", me, [
186
+ t[0] || (t[0] = g("th", { class: "date-picker-weekday date-picker-week-header" }, "Wk", -1)),
187
+ (p(!0), f(P, null, x(v(K), (a) => (p(), f("th", { key: a }, F(a), 1))), 128))
188
188
  ])
189
189
  ]),
190
- p("tbody", me, [
191
- (v(!0), D(C, null, H(s.value, (n) => (v(), D("tr", {
192
- key: n.weekNumber,
190
+ g("tbody", ve, [
191
+ (p(!0), f(P, null, x(s.value, (a) => (p(), f("tr", {
192
+ key: a.weekNumber,
193
193
  class: I([
194
194
  "date-picker-week-row",
195
195
  {
196
- selected: n.isSelected
196
+ selected: a.isSelected
197
197
  }
198
198
  ]),
199
- onClick: (m) => d(n)
199
+ onClick: (m) => o(a)
200
200
  }, [
201
- p("td", he, [
202
- p("div", pe, x(n.weekNumber), 1)
201
+ g("td", he, [
202
+ g("div", ke, F(a.weekNumber), 1)
203
203
  ]),
204
- (v(!0), D(C, null, H(n.days, (m) => (v(), D("td", {
204
+ (p(!0), f(P, null, x(a.days, (m) => (p(), f("td", {
205
205
  key: `${m.year}-${m.month}-${m.day}`,
206
206
  class: "date-picker-day-cell"
207
207
  }, [
208
- p("button", {
208
+ g("button", {
209
209
  class: I([
210
210
  "date-picker-day",
211
211
  {
@@ -213,87 +213,87 @@ const U = (t, r = "YYYY-MM-DD") => {
213
213
  today: m.isToday
214
214
  }
215
215
  ])
216
- }, x(m.day), 3)
216
+ }, F(m.day), 3)
217
217
  ]))), 128))
218
- ], 10, ve))), 128))
218
+ ], 10, pe))), 128))
219
219
  ])
220
220
  ])
221
221
  ]));
222
222
  }
223
223
  });
224
- function ge(t, r = "24h", e = 15, u) {
225
- const s = N(0), d = N(0), i = N([]), a = Y(() => r === "12h"), n = () => {
226
- if (t)
227
- s.value = t.getHours(), d.value = t.getMinutes();
224
+ function fe(n, c = "24h", e = 15, h) {
225
+ const s = Y(0), o = Y(0), i = Y([]), t = $(() => c === "12h"), a = () => {
226
+ if (n)
227
+ s.value = n.getHours(), o.value = n.getMinutes();
228
228
  else {
229
- const c = /* @__PURE__ */ new Date();
230
- s.value = c.getHours(), d.value = c.getMinutes();
229
+ const u = /* @__PURE__ */ new Date();
230
+ s.value = u.getHours(), o.value = u.getMinutes();
231
231
  }
232
- g();
233
- }, m = (c) => {
234
- c && (s.value = c.getHours(), d.value = c.getMinutes());
235
- }, g = () => {
236
- const c = [], y = a.value ? 1 : 0;
237
- for (let M = 0; M < (a.value ? 2 : 1); M++) {
238
- const P = a.value ? M === 0 ? " AM" : " PM" : "";
239
- for (let w = y; w <= (a.value ? 12 : 23); w++)
240
- for (let T = 0; T < 60; T += e) {
241
- const F = (a.value, w), h = a.value ? w === 12 ? M === 0 ? 0 : 12 : w + M * 12 : w, $ = `${String(F).padStart(2, "0")}:${String(T).padStart(2, "0")}` + P;
242
- c.push({
243
- display: $,
244
- value: `${String(h).padStart(2, "0")}:${String(T).padStart(2, "0")}`,
245
- hour: h,
246
- minute: T
232
+ y();
233
+ }, m = (u) => {
234
+ u && (s.value = u.getHours(), o.value = u.getMinutes());
235
+ }, y = () => {
236
+ const u = [], d = t.value ? 1 : 0;
237
+ for (let l = 0; l < (t.value ? 2 : 1); l++) {
238
+ const k = t.value ? l === 0 ? " AM" : " PM" : "";
239
+ for (let b = d; b <= (t.value ? 12 : 23); b++)
240
+ for (let C = 0; C < 60; C += e) {
241
+ const A = (t.value, b), D = t.value ? b === 12 ? l === 0 ? 0 : 12 : b + l * 12 : b, H = `${String(A).padStart(2, "0")}:${String(C).padStart(2, "0")}` + k;
242
+ u.push({
243
+ display: H,
244
+ value: `${String(D).padStart(2, "0")}:${String(C).padStart(2, "0")}`,
245
+ hour: D,
246
+ minute: C
247
247
  });
248
248
  }
249
249
  }
250
- a.value ? i.value = c.map((M) => M.display) : i.value = c.map((M) => M.value);
251
- }, l = () => {
252
- if (a.value) {
253
- const c = s.value === 0 ? 12 : s.value > 12 ? s.value - 12 : s.value, y = s.value < 12 ? " AM" : " PM";
254
- return `${String(c).padStart(2, "0")}:${String(d.value).padStart(
250
+ t.value ? i.value = u.map((l) => l.display) : i.value = u.map((l) => l.value);
251
+ }, r = () => {
252
+ if (t.value) {
253
+ const u = s.value === 0 ? 12 : s.value > 12 ? s.value - 12 : s.value, d = s.value < 12 ? " AM" : " PM";
254
+ return `${String(u).padStart(2, "0")}:${String(o.value).padStart(
255
255
  2,
256
256
  "0"
257
- )}${y}`;
257
+ )}${d}`;
258
258
  }
259
- return `${String(s.value).padStart(2, "0")}:${String(d.value).padStart(2, "0")}`;
259
+ return `${String(s.value).padStart(2, "0")}:${String(o.value).padStart(2, "0")}`;
260
260
  };
261
261
  return {
262
262
  hours: s,
263
- minutes: d,
263
+ minutes: o,
264
264
  timeOptions: i,
265
- is12HourFormat: a,
266
- initializeTime: n,
265
+ is12HourFormat: t,
266
+ initializeTime: a,
267
267
  updateTime: m,
268
- generateTimeOptions: g,
269
- getCurrentTimeString: l,
270
- selectTime: (c) => {
271
- let y, M;
272
- if (a.value) {
273
- const [w, T] = c.split(" "), [F, h] = w.split(":");
274
- y = parseInt(F), M = parseInt(h), T === "AM" ? y === 12 && (y = 0) : y !== 12 && (y += 12);
268
+ generateTimeOptions: y,
269
+ getCurrentTimeString: r,
270
+ selectTime: (u) => {
271
+ let d, l;
272
+ if (t.value) {
273
+ const [b, C] = u.split(" "), [A, D] = b.split(":");
274
+ d = parseInt(A), l = parseInt(D), C === "AM" ? d === 12 && (d = 0) : d !== 12 && (d += 12);
275
275
  } else {
276
- const [w, T] = c.split(":");
277
- y = parseInt(w), M = parseInt(T);
276
+ const [b, C] = u.split(":");
277
+ d = parseInt(b), l = parseInt(C);
278
278
  }
279
- s.value = y, d.value = M;
280
- const P = t ? new Date(t.getTime()) : /* @__PURE__ */ new Date();
281
- P.setHours(y, M, 0, 0), u("update", P);
279
+ s.value = d, o.value = l;
280
+ const k = n ? new Date(n.getTime()) : /* @__PURE__ */ new Date();
281
+ k.setHours(d, l, 0, 0), h("update", k);
282
282
  },
283
- scrollToSelected: (c) => {
284
- if (!c) return;
285
- const y = i.value.findIndex((M) => M === l());
286
- if (y >= 0) {
287
- const P = c.clientHeight, w = y * 30 - P / 2 + 30 / 2;
288
- c.scrollTop = Math.max(0, w);
283
+ scrollToSelected: (u) => {
284
+ if (!u) return;
285
+ const d = i.value.findIndex((l) => l === r());
286
+ if (d >= 0) {
287
+ const k = u.clientHeight, b = d * 30 - k / 2 + 30 / 2;
288
+ u.scrollTop = Math.max(0, b);
289
289
  }
290
290
  },
291
- onTimeUpdate: (c) => {
292
- s.value = c.getHours(), d.value = c.getMinutes(), u("update", c);
291
+ onTimeUpdate: (u) => {
292
+ s.value = u.getHours(), o.value = u.getMinutes(), h("update", u);
293
293
  }
294
294
  };
295
295
  }
296
- const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"], J = /* @__PURE__ */ q({
296
+ const De = { class: "time-picker-container" }, ye = ["aria-selected", "onClick"], J = /* @__PURE__ */ N({
297
297
  __name: "TimeView",
298
298
  props: {
299
299
  selectedTime: {},
@@ -301,121 +301,121 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
301
301
  timeInterval: { default: 15 }
302
302
  },
303
303
  emits: ["update"],
304
- setup(t, { emit: r }) {
305
- const e = t, u = r, s = N(null), { timeOptions: d, initializeTime: i, updateTime: a, getCurrentTimeString: n, selectTime: m, scrollToSelected: g } = ge(e.selectedTime, e.timeFormat, e.timeInterval, u);
306
- return O(
304
+ setup(n, { emit: c }) {
305
+ const e = n, h = c, s = Y(null), { timeOptions: o, initializeTime: i, updateTime: t, getCurrentTimeString: a, selectTime: m, scrollToSelected: y } = fe(e.selectedTime, e.timeFormat, e.timeInterval, h);
306
+ return G(
307
307
  () => e.selectedTime,
308
- (l) => {
309
- a(l), B(() => {
310
- g(s.value);
308
+ (r) => {
309
+ t(r), B(() => {
310
+ y(s.value);
311
311
  });
312
312
  },
313
313
  { immediate: !0 }
314
- ), O(
314
+ ), G(
315
315
  () => e.timeFormat,
316
316
  () => {
317
317
  i(), B(() => {
318
- g(s.value);
318
+ y(s.value);
319
319
  });
320
320
  }
321
- ), O(
321
+ ), G(
322
322
  () => e.timeInterval,
323
323
  () => {
324
324
  i(), B(() => {
325
- g(s.value);
325
+ y(s.value);
326
326
  });
327
327
  }
328
328
  ), R(() => {
329
329
  i(), B(() => {
330
330
  setTimeout(() => {
331
- g(s.value);
331
+ y(s.value);
332
332
  }, 3);
333
333
  });
334
- }), (l, b) => (v(), D("div", ke, [
335
- p("div", {
334
+ }), (r, S) => (p(), f("div", De, [
335
+ g("div", {
336
336
  ref_key: "timeListRef",
337
337
  ref: s,
338
338
  class: "time-wheel",
339
339
  role: "listbox",
340
340
  "aria-label": "Time Selection"
341
341
  }, [
342
- (v(!0), D(C, null, H(o(d), (k) => (v(), D("div", {
343
- key: k,
342
+ (p(!0), f(P, null, x(v(o), (_) => (p(), f("div", {
343
+ key: _,
344
344
  class: I(["time-option", {
345
- selected: k === o(n)()
345
+ selected: _ === v(a)()
346
346
  }]),
347
347
  role: "option",
348
- "aria-selected": k === o(n)(),
349
- onClick: (f) => o(m)(k)
350
- }, x(k), 11, fe))), 128))
348
+ "aria-selected": _ === v(a)(),
349
+ onClick: (M) => v(m)(_)
350
+ }, F(_), 11, ye))), 128))
351
351
  ], 512)
352
352
  ]));
353
353
  }
354
- }), Me = { class: "year-view-layout" }, ye = { class: "years-section" }, be = { class: "years-list" }, _e = ["onClick"], we = { class: "months-section" }, Se = { class: "date-picker-table date-picker-months-table" }, Ye = { class: "date-picker-months-body" }, $e = ["onClick", "disabled"], Te = /* @__PURE__ */ q({
354
+ }), Me = { class: "year-view-layout" }, be = { class: "years-section" }, _e = { class: "years-list" }, Se = ["onClick"], we = { class: "months-section" }, $e = { class: "date-picker-table date-picker-months-table" }, Te = { class: "date-picker-months-body" }, Ye = ["onClick", "disabled"], Ce = /* @__PURE__ */ N({
355
355
  __name: "YearView",
356
356
  props: {
357
357
  currentDate: {},
358
358
  selectedDate: {}
359
359
  },
360
360
  emits: ["select", "month-select"],
361
- setup(t, { emit: r }) {
362
- const e = t, u = r, s = Y(() => e.currentDate.getFullYear()), d = Y(() => {
363
- var l;
364
- return (l = e.selectedDate) == null ? void 0 : l.getFullYear();
365
- }), i = Y(() => {
366
- const l = Math.floor(s.value / 10) * 10;
367
- return Array.from({ length: 12 }, (b, k) => l + k - 1);
368
- }), a = Y(() => E(s.value).map((l) => ({
369
- ...l,
370
- isSelected: e.selectedDate ? l.month === e.selectedDate.getMonth() && l.year === e.selectedDate.getFullYear() : !1
371
- }))), n = Y(() => {
372
- const l = [];
373
- for (let b = 0; b < a.value.length; b += 3)
374
- l.push(a.value.slice(b, b + 3));
375
- return l;
376
- }), m = (l) => {
377
- u("select", l);
378
- }, g = (l) => {
379
- u("month-select", l.month);
361
+ setup(n, { emit: c }) {
362
+ const e = n, h = c, s = $(() => e.currentDate.getFullYear()), o = $(() => {
363
+ var r;
364
+ return (r = e.selectedDate) == null ? void 0 : r.getFullYear();
365
+ }), i = $(() => {
366
+ const r = Math.floor(s.value / 10) * 10;
367
+ return Array.from({ length: 12 }, (S, _) => r + _ - 1);
368
+ }), t = $(() => j(s.value).map((r) => ({
369
+ ...r,
370
+ isSelected: e.selectedDate ? r.month === e.selectedDate.getMonth() && r.year === e.selectedDate.getFullYear() : !1
371
+ }))), a = $(() => {
372
+ const r = [];
373
+ for (let S = 0; S < t.value.length; S += 3)
374
+ r.push(t.value.slice(S, S + 3));
375
+ return r;
376
+ }), m = (r) => {
377
+ h("select", r);
378
+ }, y = (r) => {
379
+ h("month-select", r.month);
380
380
  };
381
- return (l, b) => (v(), D("div", Me, [
382
- p("div", ye, [
383
- p("div", be, [
384
- (v(!0), D(C, null, H(i.value, (k) => (v(), D("button", {
385
- key: k,
381
+ return (r, S) => (p(), f("div", Me, [
382
+ g("div", be, [
383
+ g("div", _e, [
384
+ (p(!0), f(P, null, x(i.value, (_) => (p(), f("button", {
385
+ key: _,
386
386
  class: I([
387
387
  "year-item",
388
388
  {
389
- selected: k === d.value,
390
- current: k === s.value
389
+ selected: _ === o.value,
390
+ current: _ === s.value
391
391
  }
392
392
  ]),
393
- onClick: (f) => m(k)
394
- }, x(k), 11, _e))), 128))
393
+ onClick: (M) => m(_)
394
+ }, F(_), 11, Se))), 128))
395
395
  ])
396
396
  ]),
397
- p("div", we, [
398
- p("table", Se, [
399
- p("tbody", Ye, [
400
- (v(!0), D(C, null, H(n.value, (k, f) => (v(), D("tr", {
401
- key: f,
397
+ g("div", we, [
398
+ g("table", $e, [
399
+ g("tbody", Te, [
400
+ (p(!0), f(P, null, x(a.value, (_, M) => (p(), f("tr", {
401
+ key: M,
402
402
  class: "date-picker-months-row"
403
403
  }, [
404
- (v(!0), D(C, null, H(k, (c) => (v(), D("td", {
405
- key: c.month,
404
+ (p(!0), f(P, null, x(_, (u) => (p(), f("td", {
405
+ key: u.month,
406
406
  class: "date-picker-month-cell"
407
407
  }, [
408
- p("button", {
408
+ g("button", {
409
409
  class: I([
410
410
  "date-picker-month",
411
411
  {
412
- selected: c.isSelected,
413
- disabled: c.isDisabled
412
+ selected: u.isSelected,
413
+ disabled: u.isDisabled
414
414
  }
415
415
  ]),
416
- onClick: (y) => g(c),
417
- disabled: c.isDisabled
418
- }, x(c.name.substring(0, 3)), 11, $e)
416
+ onClick: (d) => y(u),
417
+ disabled: u.isDisabled
418
+ }, F(u.name.substring(0, 3)), 11, Ye)
419
419
  ]))), 128))
420
420
  ]))), 128))
421
421
  ])
@@ -423,54 +423,54 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
423
423
  ])
424
424
  ]));
425
425
  }
426
- }), Ce = { class: "date-picker-content" }, He = { class: "date-picker-table date-picker-months-table" }, Fe = { class: "date-picker-months-body" }, Pe = ["onClick", "disabled"], xe = /* @__PURE__ */ q({
426
+ }), He = { class: "date-picker-content" }, Pe = { class: "date-picker-table date-picker-months-table" }, xe = { class: "date-picker-months-body" }, Fe = ["onClick", "disabled"], Ie = /* @__PURE__ */ N({
427
427
  __name: "MonthView",
428
428
  props: {
429
429
  currentDate: {},
430
430
  selectedDate: {}
431
431
  },
432
432
  emits: ["select"],
433
- setup(t, { emit: r }) {
434
- const e = t, u = r, s = Y(() => E(e.currentDate.getFullYear()).map((n) => ({
435
- ...n,
436
- isSelected: e.selectedDate ? n.month === e.selectedDate.getMonth() && n.year === e.selectedDate.getFullYear() : !1
437
- }))), d = Y(() => {
438
- const a = [];
439
- for (let n = 0; n < s.value.length; n += 3)
440
- a.push(s.value.slice(n, n + 3));
441
- return a;
442
- }), i = (a) => {
443
- u("select", a.month);
433
+ setup(n, { emit: c }) {
434
+ const e = n, h = c, s = $(() => j(e.currentDate.getFullYear()).map((a) => ({
435
+ ...a,
436
+ isSelected: e.selectedDate ? a.month === e.selectedDate.getMonth() && a.year === e.selectedDate.getFullYear() : !1
437
+ }))), o = $(() => {
438
+ const t = [];
439
+ for (let a = 0; a < s.value.length; a += 3)
440
+ t.push(s.value.slice(a, a + 3));
441
+ return t;
442
+ }), i = (t) => {
443
+ h("select", t.month);
444
444
  };
445
- return (a, n) => (v(), D("div", Ce, [
446
- p("table", He, [
447
- p("tbody", Fe, [
448
- (v(!0), D(C, null, H(d.value, (m, g) => (v(), D("tr", {
449
- key: g,
445
+ return (t, a) => (p(), f("div", He, [
446
+ g("table", Pe, [
447
+ g("tbody", xe, [
448
+ (p(!0), f(P, null, x(o.value, (m, y) => (p(), f("tr", {
449
+ key: y,
450
450
  class: "date-picker-months-row"
451
451
  }, [
452
- (v(!0), D(C, null, H(m, (l) => (v(), D("td", {
453
- key: l.month,
452
+ (p(!0), f(P, null, x(m, (r) => (p(), f("td", {
453
+ key: r.month,
454
454
  class: "date-picker-month-cell"
455
455
  }, [
456
- p("button", {
456
+ g("button", {
457
457
  class: I([
458
458
  "date-picker-month",
459
459
  {
460
- selected: l.isSelected,
461
- disabled: l.isDisabled
460
+ selected: r.isSelected,
461
+ disabled: r.isDisabled
462
462
  }
463
463
  ]),
464
- onClick: (b) => i(l),
465
- disabled: l.isDisabled
466
- }, x(l.name), 11, Pe)
464
+ onClick: (S) => i(r),
465
+ disabled: r.isDisabled
466
+ }, F(r.name), 11, Fe)
467
467
  ]))), 128))
468
468
  ]))), 128))
469
469
  ])
470
470
  ])
471
471
  ]));
472
472
  }
473
- }), Ne = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>', Ie = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M15.707 11.293a1 1 0 0 1 0 1.414l-5.657 5.657a1 1 0 1 1-1.414-1.414l4.95-4.95l-4.95-4.95a1 1 0 0 1 1.414-1.414z"/></g></svg>', Ve = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 18a6 6 0 1 1 0-12a6 6 0 0 1 0 12m0-1.5a4.5 4.5 0 1 0 0-9a4.5 4.5 0 0 0 0 9"/></svg>', Ge = { class: "date-picker-header" }, qe = ["disabled"], ze = ["innerHTML"], Be = ["innerHTML"], Le = ["disabled"], Oe = ["innerHTML"], We = /* @__PURE__ */ q({
473
+ }), Ae = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>', Ne = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M15.707 11.293a1 1 0 0 1 0 1.414l-5.657 5.657a1 1 0 1 1-1.414-1.414l4.95-4.95l-4.95-4.95a1 1 0 0 1 1.414-1.414z"/></g></svg>', Ve = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 18a6 6 0 1 1 0-12a6 6 0 0 1 0 12m0-1.5a4.5 4.5 0 1 0 0-9a4.5 4.5 0 0 0 0 9"/></svg>', Le = { class: "date-picker-header" }, qe = ["disabled"], Be = ["innerHTML"], Ge = ["innerHTML"], Oe = ["disabled"], ze = ["innerHTML"], Re = /* @__PURE__ */ N({
474
474
  __name: "DatePickerHeader",
475
475
  props: {
476
476
  currentDate: {},
@@ -479,150 +479,150 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
479
479
  canGoNext: { type: Boolean }
480
480
  },
481
481
  emits: ["prev", "next", "header-click", "current-date"],
482
- setup(t, { emit: r }) {
483
- const e = t, u = r, s = Y(() => {
484
- const m = e.currentDate.getFullYear(), g = e.currentDate.getMonth();
482
+ setup(n, { emit: c }) {
483
+ const e = n, h = c, s = $(() => {
484
+ const m = e.currentDate.getFullYear(), y = e.currentDate.getMonth();
485
485
  switch (e.viewMode) {
486
486
  case "date":
487
- return `${A[g]} ${m}`;
487
+ return `${W[y]} ${m}`;
488
488
  case "year":
489
- const l = Math.floor(m / 10) * 10, b = l + 9;
490
- return `${l}–${b}`;
489
+ const r = Math.floor(m / 10) * 10, S = r + 9;
490
+ return `${r}–${S}`;
491
491
  default:
492
- return `${A[g]} ${m}`;
492
+ return `${W[y]} ${m}`;
493
493
  }
494
- }), d = () => {
495
- u("prev");
494
+ }), o = () => {
495
+ h("prev");
496
496
  }, i = () => {
497
- u("next");
497
+ h("next");
498
+ }, t = () => {
499
+ h("header-click");
498
500
  }, a = () => {
499
- u("header-click");
500
- }, n = () => {
501
- u("current-date");
501
+ h("current-date");
502
502
  };
503
- return (m, g) => (v(), D("div", Ge, [
504
- p("button", {
503
+ return (m, y) => (p(), f("div", Le, [
504
+ g("button", {
505
505
  class: "date-picker-title",
506
- onClick: a,
506
+ onClick: t,
507
507
  type: "button"
508
- }, x(s.value), 1),
509
- p("button", {
508
+ }, F(s.value), 1),
509
+ g("button", {
510
510
  class: "date-picker-nav-button ml-auto",
511
511
  disabled: !m.canGoPrev,
512
- onClick: d,
512
+ onClick: o,
513
513
  type: "button",
514
514
  "aria-label": "Previous"
515
515
  }, [
516
- p("span", {
516
+ g("span", {
517
517
  class: "date-picker-nav-icon",
518
- innerHTML: o(Ne)
519
- }, null, 8, ze)
518
+ innerHTML: v(Ae)
519
+ }, null, 8, Be)
520
520
  ], 8, qe),
521
- p("button", {
521
+ g("button", {
522
522
  class: "date-picker-nav-button",
523
- onClick: n,
523
+ onClick: a,
524
524
  type: "button",
525
525
  "aria-label": "Current Date"
526
526
  }, [
527
- p("span", {
527
+ g("span", {
528
528
  class: "date-picker-nav-icon",
529
- innerHTML: o(Ve)
530
- }, null, 8, Be)
529
+ innerHTML: v(Ve)
530
+ }, null, 8, Ge)
531
531
  ]),
532
- p("button", {
532
+ g("button", {
533
533
  class: "date-picker-nav-button",
534
534
  disabled: !m.canGoNext,
535
535
  onClick: i,
536
536
  type: "button",
537
537
  "aria-label": "Next"
538
538
  }, [
539
- p("span", {
539
+ g("span", {
540
540
  class: "date-picker-nav-icon",
541
- innerHTML: o(Ie)
542
- }, null, 8, Oe)
543
- ], 8, Le)
541
+ innerHTML: v(Ne)
542
+ }, null, 8, ze)
543
+ ], 8, Oe)
544
544
  ]));
545
545
  }
546
546
  });
547
- function Ae(t, r) {
548
- const e = N(/* @__PURE__ */ new Date()), u = N("date"), s = Y(() => t.value ? t.value instanceof Date ? t.value : W(t.value) : null), d = Y(() => {
549
- if (!t.minDate) return !0;
550
- const h = W(t.minDate);
551
- if (!h) return !0;
552
- const S = e.value.getFullYear(), $ = e.value.getMonth();
553
- return new Date(S, $, 1) > h;
554
- }), i = Y(() => {
555
- if (!t.maxDate) return !0;
556
- const h = W(t.maxDate);
557
- if (!h) return !0;
558
- const S = e.value.getFullYear(), $ = e.value.getMonth();
559
- return new Date(S, $ + 1, 0) < h;
560
- }), a = () => {
561
- d.value && (e.value = new Date(e.value.getFullYear(), e.value.getMonth() - 1, 1));
562
- }, n = () => {
547
+ function We(n, c) {
548
+ const e = Y(/* @__PURE__ */ new Date()), h = Y("date"), s = $(() => n.value ? n.value instanceof Date ? n.value : z(n.value) : null), o = $(() => {
549
+ if (!n.minDate) return !0;
550
+ const D = z(n.minDate);
551
+ if (!D) return !0;
552
+ const T = e.value.getFullYear(), H = e.value.getMonth();
553
+ return new Date(T, H, 1) > D;
554
+ }), i = $(() => {
555
+ if (!n.maxDate) return !0;
556
+ const D = z(n.maxDate);
557
+ if (!D) return !0;
558
+ const T = e.value.getFullYear(), H = e.value.getMonth();
559
+ return new Date(T, H + 1, 0) < D;
560
+ }), t = () => {
561
+ o.value && (e.value = new Date(e.value.getFullYear(), e.value.getMonth() - 1, 1));
562
+ }, a = () => {
563
563
  i.value && (e.value = new Date(e.value.getFullYear(), e.value.getMonth() + 1, 1));
564
564
  }, m = () => {
565
565
  e.value = new Date(e.value.getFullYear() - 1, e.value.getMonth(), 1);
566
- }, g = () => {
566
+ }, y = () => {
567
567
  e.value = new Date(e.value.getFullYear() + 1, e.value.getMonth(), 1);
568
- }, l = () => {
568
+ }, r = () => {
569
569
  e.value = new Date(e.value.getFullYear() - 10, e.value.getMonth(), 1);
570
- }, b = () => {
570
+ }, S = () => {
571
571
  e.value = new Date(e.value.getFullYear() + 10, e.value.getMonth(), 1);
572
- }, k = () => {
573
- e.value = /* @__PURE__ */ new Date(), u.value = "date";
574
- }, f = () => {
575
- switch (u.value) {
572
+ }, _ = () => {
573
+ e.value = /* @__PURE__ */ new Date(), h.value = "date";
574
+ }, M = () => {
575
+ switch (h.value) {
576
576
  case "date":
577
- u.value = "year";
577
+ h.value = "year";
578
578
  break;
579
579
  case "year":
580
- u.value = "date";
580
+ h.value = "date";
581
581
  break;
582
582
  }
583
- }, c = (h) => {
584
- t.mode === "dateTime" && s.value && h.setHours(s.value.getHours(), s.value.getMinutes()), F(h);
585
- }, y = (h) => {
586
- F(h);
587
- }, M = (h) => {
588
- e.value = new Date(e.value.getFullYear(), h, 1), u.value = "date", t.mode === "month" && F(new Date(e.value.getFullYear(), h, 1));
589
- }, P = (h) => {
590
- e.value = new Date(h, e.value.getMonth(), 1), u.value = "date";
591
- }, w = (h) => {
592
- const S = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/, $ = /^\d{4}-\d{2}-\d{2}$/;
593
- return S.test(h) ? h.includes(".") ? "YYYY-MM-DDTHH:mm:ss.sssZ" : "YYYY-MM-DDTHH:mm:ssZ" : $.test(h) ? "YYYY-MM-DD" : t.format || "YYYY-MM-DD";
594
- }, T = (h, S) => {
595
- const $ = w(S);
596
- return $.includes("T") ? $.includes(".sss") ? h.toISOString() : h.toISOString().replace(/\.\d{3}Z$/, "Z") : U(h, $);
597
- }, F = (h) => {
598
- let S;
599
- typeof t.value == "string" ? S = T(h, t.value) : S = h, r("update:value", S), r("change", S), r("select", S);
583
+ }, u = (D) => {
584
+ n.mode === "dateTime" && s.value && D.setHours(s.value.getHours(), s.value.getMinutes()), A(D);
585
+ }, d = (D) => {
586
+ A(D);
587
+ }, l = (D) => {
588
+ e.value = new Date(e.value.getFullYear(), D, 1), h.value = "date", n.mode === "month" && A(new Date(e.value.getFullYear(), D, 1));
589
+ }, k = (D) => {
590
+ e.value = new Date(D, e.value.getMonth(), 1), h.value = "date";
591
+ }, b = (D) => {
592
+ const T = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/, H = /^\d{4}-\d{2}-\d{2}$/;
593
+ return T.test(D) ? D.includes(".") ? "YYYY-MM-DDTHH:mm:ss.sssZ" : "YYYY-MM-DDTHH:mm:ssZ" : H.test(D) ? "YYYY-MM-DD" : n.format || "YYYY-MM-DD";
594
+ }, C = (D, T) => {
595
+ const H = b(T);
596
+ return H.includes("T") ? H.includes(".sss") ? D.toISOString() : D.toISOString().replace(/\.\d{3}Z$/, "Z") : Z(D, H);
597
+ }, A = (D) => {
598
+ let T;
599
+ typeof n.value == "string" ? T = C(D, n.value) : T = D, c("update:value", T), c("change", T), c("select", T);
600
600
  };
601
601
  return {
602
602
  currentDate: e,
603
- viewMode: u,
603
+ viewMode: h,
604
604
  selectedDate: s,
605
- canGoPrev: d,
605
+ canGoPrev: o,
606
606
  canGoNext: i,
607
- goToPrevMonth: a,
608
- goToNextMonth: n,
607
+ goToPrevMonth: t,
608
+ goToNextMonth: a,
609
609
  goToPrevYear: m,
610
- goToNextYear: g,
611
- goToPrevDecade: l,
612
- goToNextDecade: b,
613
- goToCurrentDate: k,
614
- onHeaderClick: f,
615
- onDateSelect: c,
616
- onWeekSelect: y,
617
- onMonthSelect: M,
618
- onYearSelect: P,
619
- emitValue: F
610
+ goToNextYear: y,
611
+ goToPrevDecade: r,
612
+ goToNextDecade: S,
613
+ goToCurrentDate: _,
614
+ onHeaderClick: M,
615
+ onDateSelect: u,
616
+ onWeekSelect: d,
617
+ onMonthSelect: l,
618
+ onYearSelect: k,
619
+ emitValue: A
620
620
  };
621
621
  }
622
- const Je = { class: "date-picker" }, Re = {
622
+ const Je = { class: "date-picker" }, Ue = {
623
623
  key: 0,
624
624
  class: "date-picker-time-section"
625
- }, Ze = /* @__PURE__ */ q({
625
+ }, lt = /* @__PURE__ */ N({
626
626
  __name: "DatePicker",
627
627
  props: {
628
628
  value: {},
@@ -637,110 +637,306 @@ const Je = { class: "date-picker" }, Re = {
637
637
  timeInterval: { default: 15 }
638
638
  },
639
639
  emits: ["update:value", "change", "select"],
640
- setup(t, { emit: r }) {
641
- const e = t, u = r, s = N(null), d = N(0), {
640
+ setup(n, { emit: c }) {
641
+ const e = n, h = c, s = Y(null), o = Y(0), {
642
642
  currentDate: i,
643
- viewMode: a,
644
- selectedDate: n,
643
+ viewMode: t,
644
+ selectedDate: a,
645
645
  canGoPrev: m,
646
- canGoNext: g,
647
- goToPrevMonth: l,
648
- goToNextMonth: b,
649
- goToPrevYear: k,
650
- goToNextYear: f,
651
- goToPrevDecade: c,
652
- goToNextDecade: y,
653
- goToCurrentDate: M,
654
- onHeaderClick: P,
655
- onDateSelect: w,
656
- onWeekSelect: T,
657
- onMonthSelect: F,
658
- onYearSelect: h,
659
- emitValue: S
660
- } = Ae(e, u), $ = (_) => {
661
- if (e.mode === "dateTime" && n.value) {
662
- const V = new Date(n.value.getTime());
663
- V.setHours(_.getHours(), _.getMinutes(), 0, 0), S(V);
646
+ canGoNext: y,
647
+ goToPrevMonth: r,
648
+ goToNextMonth: S,
649
+ goToPrevYear: _,
650
+ goToNextYear: M,
651
+ goToPrevDecade: u,
652
+ goToNextDecade: d,
653
+ goToCurrentDate: l,
654
+ onHeaderClick: k,
655
+ onDateSelect: b,
656
+ onWeekSelect: C,
657
+ onMonthSelect: A,
658
+ onYearSelect: D,
659
+ emitValue: T
660
+ } = We(e, h), H = (w) => {
661
+ if (e.mode === "dateTime" && a.value) {
662
+ const L = new Date(a.value.getTime());
663
+ L.setHours(w.getHours(), w.getMinutes(), 0, 0), T(L);
664
664
  } else
665
- S(_);
665
+ T(w);
666
666
  };
667
667
  return R(async () => {
668
668
  B(() => {
669
- s.value && (d.value = s.value.clientHeight);
669
+ s.value && (o.value = s.value.clientHeight);
670
670
  });
671
- }), (_, V) => (v(), D("div", Je, [
672
- _.mode !== "time" ? (v(), z(We, {
671
+ }), (w, L) => (p(), f("div", Je, [
672
+ w.mode !== "time" ? (p(), q(Re, {
673
673
  key: 0,
674
- "current-date": o(i),
675
- "view-mode": o(a),
676
- "can-go-prev": o(m),
677
- "can-go-next": o(g),
678
- onPrev: V[0] || (V[0] = (K) => o(a) === "year" ? o(c)() : o(a) === "month" ? o(k)() : o(l)()),
679
- onNext: V[1] || (V[1] = (K) => o(a) === "year" ? o(y)() : o(a) === "month" ? o(f)() : o(b)()),
680
- onHeaderClick: o(P),
681
- onCurrentDate: o(M)
682
- }, null, 8, ["current-date", "view-mode", "can-go-prev", "can-go-next", "onHeaderClick", "onCurrentDate"])) : G("", !0),
683
- p("div", {
674
+ "current-date": v(i),
675
+ "view-mode": v(t),
676
+ "can-go-prev": v(m),
677
+ "can-go-next": v(y),
678
+ onPrev: L[0] || (L[0] = (Q) => v(t) === "year" ? v(u)() : v(t) === "month" ? v(_)() : v(r)()),
679
+ onNext: L[1] || (L[1] = (Q) => v(t) === "year" ? v(d)() : v(t) === "month" ? v(M)() : v(S)()),
680
+ onHeaderClick: v(k),
681
+ onCurrentDate: v(l)
682
+ }, null, 8, ["current-date", "view-mode", "can-go-prev", "can-go-next", "onHeaderClick", "onCurrentDate"])) : V("", !0),
683
+ g("div", {
684
684
  class: I({
685
- "date-picker-datetime-layout": _.mode === "dateTime" && o(a) === "date"
685
+ "date-picker-datetime-layout": w.mode === "dateTime" && v(t) === "date"
686
686
  }),
687
- style: Q({
688
- height: d.value !== 0 ? d.value + "px" : "100%"
687
+ style: X({
688
+ height: o.value !== 0 ? o.value + "px" : "100%"
689
689
  })
690
690
  }, [
691
- p("div", {
691
+ g("div", {
692
692
  class: "date-picker-date-section",
693
693
  ref_key: "datePickerContent",
694
694
  ref: s
695
695
  }, [
696
- o(a) === "date" && (_.mode === "date" || _.mode === "dateTime") ? (v(), z(ce, {
696
+ v(t) === "date" && (w.mode === "date" || w.mode === "dateTime") ? (p(), q(ie, {
697
697
  key: 0,
698
- "current-date": o(i),
699
- "selected-date": o(n),
700
- "min-date": _.minDate,
701
- "max-date": _.maxDate,
702
- "disabled-dates": _.disabledDates,
703
- onSelect: o(w)
704
- }, null, 8, ["current-date", "selected-date", "min-date", "max-date", "disabled-dates", "onSelect"])) : G("", !0),
705
- _.mode === "week" && o(a) === "date" ? (v(), z(De, {
698
+ "current-date": v(i),
699
+ "selected-date": v(a),
700
+ "min-date": w.minDate,
701
+ "max-date": w.maxDate,
702
+ "disabled-dates": w.disabledDates,
703
+ onSelect: v(b)
704
+ }, null, 8, ["current-date", "selected-date", "min-date", "max-date", "disabled-dates", "onSelect"])) : V("", !0),
705
+ w.mode === "week" && v(t) === "date" ? (p(), q(ge, {
706
706
  key: 1,
707
- "current-date": o(i),
708
- "selected-date": o(n),
709
- onSelect: o(T)
710
- }, null, 8, ["current-date", "selected-date", "onSelect"])) : G("", !0),
711
- o(a) !== "year" && (o(a) === "month" || _.mode === "month") ? (v(), z(xe, {
707
+ "current-date": v(i),
708
+ "selected-date": v(a),
709
+ onSelect: v(C)
710
+ }, null, 8, ["current-date", "selected-date", "onSelect"])) : V("", !0),
711
+ v(t) !== "year" && (v(t) === "month" || w.mode === "month") ? (p(), q(Ie, {
712
712
  key: 2,
713
- "current-date": o(i),
714
- "selected-date": o(n),
715
- onSelect: o(F)
716
- }, null, 8, ["current-date", "selected-date", "onSelect"])) : G("", !0),
717
- o(a) === "year" ? (v(), z(Te, {
713
+ "current-date": v(i),
714
+ "selected-date": v(a),
715
+ onSelect: v(A)
716
+ }, null, 8, ["current-date", "selected-date", "onSelect"])) : V("", !0),
717
+ v(t) === "year" ? (p(), q(Ce, {
718
718
  key: 3,
719
- "current-date": o(i),
720
- "selected-date": o(n),
721
- onSelect: o(h),
722
- onMonthSelect: o(F)
723
- }, null, 8, ["current-date", "selected-date", "onSelect", "onMonthSelect"])) : G("", !0)
719
+ "current-date": v(i),
720
+ "selected-date": v(a),
721
+ onSelect: v(D),
722
+ onMonthSelect: v(A)
723
+ }, null, 8, ["current-date", "selected-date", "onSelect", "onMonthSelect"])) : V("", !0)
724
724
  ], 512),
725
- _.mode === "dateTime" && o(a) === "date" ? (v(), D("div", Re, [
726
- X(J, {
727
- "selected-time": o(n),
728
- "time-format": _.timeFormat,
729
- "time-interval": _.timeInterval,
730
- onUpdate: $
725
+ w.mode === "dateTime" && v(t) === "date" ? (p(), f("div", Ue, [
726
+ U(J, {
727
+ "selected-time": v(a),
728
+ "time-format": w.timeFormat,
729
+ "time-interval": w.timeInterval,
730
+ onUpdate: H
731
731
  }, null, 8, ["selected-time", "time-format", "time-interval"])
732
- ])) : G("", !0)
732
+ ])) : V("", !0)
733
733
  ], 6),
734
- _.mode === "time" ? (v(), z(J, {
734
+ w.mode === "time" ? (p(), q(J, {
735
735
  key: 1,
736
- "selected-time": o(n),
737
- "time-format": _.timeFormat,
738
- "time-interval": _.timeInterval,
739
- onUpdate: $
740
- }, null, 8, ["selected-time", "time-format", "time-interval"])) : G("", !0)
736
+ "selected-time": v(a),
737
+ "time-format": w.timeFormat,
738
+ "time-interval": w.timeInterval,
739
+ onUpdate: H
740
+ }, null, 8, ["selected-time", "time-format", "time-interval"])) : V("", !0)
741
+ ]));
742
+ }
743
+ }), Ze = { class: "time-picker-sections" }, Ee = { class: "time-picker-time-section" }, je = ["onClick"], Ke = { class: "time-picker-time-section" }, Qe = ["onClick"], Xe = {
744
+ key: 0,
745
+ class: "time-picker-time-section time-picker-period-section"
746
+ }, et = /* @__PURE__ */ N({
747
+ __name: "TimePickerDropdown",
748
+ props: {
749
+ selectedHour: {},
750
+ selectedMinute: {},
751
+ selectedPeriod: {},
752
+ is12Hour: { type: Boolean }
753
+ },
754
+ emits: ["select-hour", "select-minute", "select-period", "close"],
755
+ setup(n, { expose: c, emit: e }) {
756
+ const h = n, s = e, o = Y(null), i = Y(null), t = Y(null), a = Y(null), m = $(() => h.is12Hour ? Array.from({ length: 12 }, (d, l) => l + 1) : Array.from({ length: 24 }, (d, l) => l)), y = $(() => Array.from({ length: 60 }, (d, l) => l)), r = () => {
757
+ if (i.value) {
758
+ const d = i.value.querySelectorAll(".time-picker-option-button"), l = Array.from(d).findIndex((k) => k.classList.contains("selected"));
759
+ l !== -1 && d[l].scrollIntoView({ block: "center", behavior: "auto" });
760
+ }
761
+ if (t.value) {
762
+ const d = t.value.querySelectorAll(".time-picker-option-button"), l = Array.from(d).findIndex((k) => k.classList.contains("selected"));
763
+ l !== -1 && d[l].scrollIntoView({ block: "center", behavior: "auto" });
764
+ }
765
+ if (h.is12Hour && a.value) {
766
+ const d = a.value.querySelectorAll(".time-picker-option-button"), l = Array.from(d).findIndex((k) => k.classList.contains("selected"));
767
+ l !== -1 && d[l].scrollIntoView({ block: "center", behavior: "auto" });
768
+ }
769
+ }, S = (d) => {
770
+ s("select-hour", d);
771
+ }, _ = (d) => {
772
+ s("select-minute", d);
773
+ }, M = (d) => {
774
+ s("select-period", d);
775
+ }, u = (d) => {
776
+ o.value && !o.value.contains(d.target) && s("close");
777
+ };
778
+ return R(() => {
779
+ document.addEventListener("mousedown", u);
780
+ }), ee(() => {
781
+ document.removeEventListener("mousedown", u);
782
+ }), c({ scrollToSelected: r }), (d, l) => (p(), f("div", {
783
+ ref_key: "dropdownRef",
784
+ ref: o,
785
+ class: "time-picker-dropdown"
786
+ }, [
787
+ g("div", Ze, [
788
+ g("div", Ee, [
789
+ g("div", {
790
+ ref_key: "hourScroll",
791
+ ref: i,
792
+ class: "time-picker-options-scroll"
793
+ }, [
794
+ (p(!0), f(P, null, x(m.value, (k) => (p(), f("button", {
795
+ key: k,
796
+ type: "button",
797
+ class: I(["time-picker-option-button", { selected: k === d.selectedHour }]),
798
+ onClick: (b) => S(k)
799
+ }, F(String(k).padStart(2, "0")), 11, je))), 128))
800
+ ], 512)
801
+ ]),
802
+ g("div", Ke, [
803
+ g("div", {
804
+ ref_key: "minuteScroll",
805
+ ref: t,
806
+ class: "time-picker-options-scroll"
807
+ }, [
808
+ (p(!0), f(P, null, x(y.value, (k) => (p(), f("button", {
809
+ key: k,
810
+ type: "button",
811
+ class: I(["time-picker-option-button", { selected: k === d.selectedMinute }]),
812
+ onClick: (b) => _(k)
813
+ }, F(String(k).padStart(2, "0")), 11, Qe))), 128))
814
+ ], 512)
815
+ ]),
816
+ d.is12Hour ? (p(), f("div", Xe, [
817
+ g("div", {
818
+ ref_key: "periodScroll",
819
+ ref: a,
820
+ class: "time-picker-options-scroll"
821
+ }, [
822
+ g("button", {
823
+ type: "button",
824
+ class: I(["time-picker-option-button", { selected: d.selectedPeriod === "AM" }]),
825
+ onClick: l[0] || (l[0] = (k) => M("AM"))
826
+ }, " AM ", 2),
827
+ g("button", {
828
+ type: "button",
829
+ class: I(["time-picker-option-button", { selected: d.selectedPeriod === "PM" }]),
830
+ onClick: l[1] || (l[1] = (k) => M("PM"))
831
+ }, " PM ", 2)
832
+ ], 512)
833
+ ])) : V("", !0)
834
+ ])
835
+ ], 512));
836
+ }
837
+ }), tt = { class: "time-display" }, nt = /* @__PURE__ */ N({
838
+ __name: "TimePickerInput",
839
+ props: {
840
+ hour: {},
841
+ minute: {},
842
+ period: {},
843
+ is12Hour: { type: Boolean }
844
+ },
845
+ emits: ["toggle"],
846
+ setup(n, { emit: c }) {
847
+ const e = n, h = c, s = $(() => {
848
+ const i = String(e.hour).padStart(2, "0"), t = String(e.minute).padStart(2, "0");
849
+ return `${i}:${t}`;
850
+ }), o = () => {
851
+ h("toggle");
852
+ };
853
+ return (i, t) => (p(), f("button", {
854
+ type: "button",
855
+ class: "time-picker-input",
856
+ onClick: o
857
+ }, [
858
+ g("span", tt, F(s.value), 1),
859
+ t[0] || (t[0] = g("svg", {
860
+ class: "time-picker-clock-icon",
861
+ xmlns: "http://www.w3.org/2000/svg",
862
+ width: "18",
863
+ height: "18",
864
+ viewBox: "0 0 24 24",
865
+ fill: "none",
866
+ stroke: "currentColor",
867
+ "stroke-width": "2",
868
+ "stroke-linecap": "round",
869
+ "stroke-linejoin": "round"
870
+ }, [
871
+ g("circle", {
872
+ cx: "12",
873
+ cy: "12",
874
+ r: "10"
875
+ }),
876
+ g("polyline", { points: "12,6 12,12 16,14" })
877
+ ], -1))
878
+ ]));
879
+ }
880
+ }), st = { class: "v-time-picker" }, ot = /* @__PURE__ */ N({
881
+ __name: "TimePicker",
882
+ props: {
883
+ modelValue: { default: null },
884
+ timeFormat: { default: "12h" }
885
+ },
886
+ emits: ["update:modelValue"],
887
+ setup(n, { emit: c }) {
888
+ const e = n, h = c, s = Y(!1), o = Y(12), i = Y(0), t = Y("AM"), a = Y(null), m = $(() => e.timeFormat === "12h"), y = () => {
889
+ if (e.modelValue) {
890
+ const [l, k] = e.modelValue.split(":"), b = parseInt(l), C = parseInt(k);
891
+ i.value = C, m.value ? b === 0 ? (o.value = 12, t.value = "AM") : b === 12 ? (o.value = 12, t.value = "PM") : b > 12 ? (o.value = b - 12, t.value = "PM") : (o.value = b, t.value = "AM") : o.value = b;
892
+ } else {
893
+ const l = /* @__PURE__ */ new Date(), k = l.getHours(), b = l.getMinutes();
894
+ i.value = b, m.value ? k === 0 ? (o.value = 12, t.value = "AM") : k === 12 ? (o.value = 12, t.value = "PM") : k > 12 ? (o.value = k - 12, t.value = "PM") : (o.value = k, t.value = "AM") : o.value = k;
895
+ }
896
+ }, r = () => {
897
+ let l = o.value;
898
+ m.value && (t.value === "AM" && l === 12 ? l = 0 : t.value === "PM" && l !== 12 && (l += 12));
899
+ const k = `${String(l).padStart(2, "0")}:${String(i.value).padStart(2, "0")}`;
900
+ h("update:modelValue", k);
901
+ }, S = (l) => {
902
+ o.value = l, r();
903
+ }, _ = (l) => {
904
+ i.value = l, r();
905
+ }, M = (l) => {
906
+ t.value = l, r();
907
+ }, u = () => {
908
+ s.value = !s.value;
909
+ }, d = () => {
910
+ s.value = !1;
911
+ };
912
+ return G(s, async (l) => {
913
+ var k;
914
+ l && (await B(), (k = a.value) == null || k.scrollToSelected());
915
+ }), G(() => e.modelValue, y, { immediate: !0 }), G(() => e.timeFormat, y), (l, k) => (p(), f("div", st, [
916
+ U(nt, {
917
+ hour: o.value,
918
+ minute: i.value,
919
+ period: t.value,
920
+ "is12-hour": m.value,
921
+ onToggle: u
922
+ }, null, 8, ["hour", "minute", "period", "is12-hour"]),
923
+ s.value ? (p(), q(et, {
924
+ key: 0,
925
+ ref_key: "dropdownRef",
926
+ ref: a,
927
+ "selected-hour": o.value,
928
+ "selected-minute": i.value,
929
+ "selected-period": t.value,
930
+ "is12-hour": m.value,
931
+ onSelectHour: S,
932
+ onSelectMinute: _,
933
+ onSelectPeriod: M,
934
+ onClose: d
935
+ }, null, 8, ["selected-hour", "selected-minute", "selected-period", "is12-hour"])) : V("", !0)
741
936
  ]));
742
937
  }
743
938
  });
744
939
  export {
745
- Ze as default
940
+ ot as TimePicker,
941
+ lt as default
746
942
  };