@manik02/vue3-timepicker 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -19
- package/dist/TimePicker/TimePicker.vue.d.ts +64 -0
- package/dist/TimePicker/types.d.ts +29 -0
- package/dist/stories/TimePicker.stories.d.ts +350 -0
- package/dist/vue-timepicker.js +696 -619
- package/dist/vue-timepicker.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/vue-timepicker.js
CHANGED
|
@@ -1,128 +1,125 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as Ae, ref as $, onMounted as ye, onBeforeUnmount as ke, createElementBlock as X, openBlock as G, normalizeClass as oe, createElementVNode as ae, Fragment as Ee, renderList as Re, toDisplayString as Ce, nextTick as Ie, computed as c, watch as F, createCommentVNode as te, createVNode as Te, createBlock as Se, normalizeStyle as de, unref as O } from "vue";
|
|
2
|
+
const Fe = ["tabindex", "onClick", "onMousemove"], ce = /* @__PURE__ */ Ae({
|
|
3
3
|
__name: "TimeColumn",
|
|
4
4
|
props: {
|
|
5
5
|
items: {},
|
|
6
6
|
activeIndex: {}
|
|
7
7
|
},
|
|
8
8
|
emits: ["update:activeIndex", "select"],
|
|
9
|
-
setup(
|
|
10
|
-
const s =
|
|
11
|
-
let
|
|
12
|
-
function D(
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
for (let
|
|
18
|
-
const
|
|
19
|
-
u <
|
|
9
|
+
setup(e, { emit: n }) {
|
|
10
|
+
const s = e, t = n, v = $(null), y = $(!1);
|
|
11
|
+
let d = null;
|
|
12
|
+
function D(p) {
|
|
13
|
+
const S = Array.from(p.querySelectorAll(".timepicker-option"));
|
|
14
|
+
if (!S.length) return 0;
|
|
15
|
+
const A = p.scrollTop + p.clientHeight / 2;
|
|
16
|
+
let M = 0, B = Number.POSITIVE_INFINITY;
|
|
17
|
+
for (let P = 0; P < S.length; P++) {
|
|
18
|
+
const U = S[P], r = U.offsetTop + U.offsetHeight / 2, u = Math.abs(r - A);
|
|
19
|
+
u < B && (B = u, M = P);
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return M;
|
|
22
22
|
}
|
|
23
|
-
function E(
|
|
23
|
+
function E(p) {
|
|
24
24
|
if (!s.items.length) return 0;
|
|
25
|
-
if (!s.items[
|
|
26
|
-
for (let
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
25
|
+
if (!s.items[p]?.disabled) return p;
|
|
26
|
+
for (let S = 1; S < s.items.length; S++) {
|
|
27
|
+
const A = p - S, M = p + S;
|
|
28
|
+
if (A >= 0 && !s.items[A]?.disabled) return A;
|
|
29
|
+
if (M < s.items.length && !s.items[M]?.disabled) return M;
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return p;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const
|
|
33
|
+
function w() {
|
|
34
|
+
Ie(() => {
|
|
35
|
+
const p = v.value;
|
|
36
|
+
if (!p) return;
|
|
37
|
+
const S = p.querySelector(
|
|
38
38
|
".timepicker-option--active"
|
|
39
39
|
);
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (S) {
|
|
41
|
+
const A = p.clientHeight, M = S.offsetTop, B = S.offsetHeight, P = M - A / 2 + B / 2;
|
|
42
|
+
y.value = !0, p.scrollTo({ top: P, behavior: "auto" }), d && clearTimeout(d), d = setTimeout(() => {
|
|
43
|
+
y.value = !1;
|
|
44
44
|
}, 70);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
51
|
-
const
|
|
52
|
-
s.items[
|
|
48
|
+
function _() {
|
|
49
|
+
const p = v.value;
|
|
50
|
+
if (!p || y.value) return;
|
|
51
|
+
const S = D(p), A = E(S);
|
|
52
|
+
s.items[A]?.disabled || (N.value = A);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
ye(w), ke(() => {
|
|
55
|
+
d && clearTimeout(d);
|
|
56
56
|
});
|
|
57
|
-
function
|
|
58
|
-
|
|
57
|
+
function T(p) {
|
|
58
|
+
t("update:activeIndex", p), t("select", s.items[p]?.value);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
60
|
+
function I(p) {
|
|
61
|
+
T(p);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
return (
|
|
65
|
-
class:
|
|
66
|
-
"timepicker-dropdown--short":
|
|
63
|
+
const N = $(s.activeIndex ?? 0);
|
|
64
|
+
return (p, S) => (G(), X("div", {
|
|
65
|
+
class: oe(["timepicker-dropdown", {
|
|
66
|
+
"timepicker-dropdown--short": p.items.length <= 3
|
|
67
67
|
}])
|
|
68
68
|
}, [
|
|
69
|
-
|
|
69
|
+
ae("div", {
|
|
70
70
|
ref_key: "menu",
|
|
71
|
-
ref:
|
|
71
|
+
ref: v,
|
|
72
72
|
class: "timepicker-dropdown__panel",
|
|
73
73
|
role: "listbox",
|
|
74
74
|
tabindex: "-1",
|
|
75
|
-
onScroll:
|
|
75
|
+
onScroll: _
|
|
76
76
|
}, [
|
|
77
|
-
(
|
|
78
|
-
key:
|
|
79
|
-
class:
|
|
80
|
-
"timepicker-option--active":
|
|
81
|
-
"timepicker-option--disabled":
|
|
82
|
-
"timepicker-option--focused":
|
|
77
|
+
(G(!0), X(Ee, null, Re(p.items, (A, M) => (G(), X("div", {
|
|
78
|
+
key: A.key,
|
|
79
|
+
class: oe(["timepicker-option", {
|
|
80
|
+
"timepicker-option--active": M === p.activeIndex,
|
|
81
|
+
"timepicker-option--disabled": A.disabled,
|
|
82
|
+
"timepicker-option--focused": M === N.value
|
|
83
83
|
}]),
|
|
84
84
|
role: "option",
|
|
85
|
-
tabindex:
|
|
86
|
-
onClick: (
|
|
87
|
-
onMousemove: (
|
|
88
|
-
},
|
|
85
|
+
tabindex: A.disabled ? -1 : 0,
|
|
86
|
+
onClick: (B) => !A.disabled && I(M),
|
|
87
|
+
onMousemove: (B) => !A.disabled && (N.value = M)
|
|
88
|
+
}, Ce(A.text), 43, Fe))), 128))
|
|
89
89
|
], 544)
|
|
90
90
|
], 2));
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
function
|
|
94
|
-
return
|
|
93
|
+
function Me(e) {
|
|
94
|
+
return e.h * 3600 + e.m * 60 + e.s;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return /(a|A|p|P)/.test(
|
|
96
|
+
function Ne(e) {
|
|
97
|
+
return /(a|A|p|P)/.test(e);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return /
|
|
99
|
+
function xe(e) {
|
|
100
|
+
return /k{1,2}/.test(e);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
102
|
+
function Y(e, n) {
|
|
103
|
+
if (!e || typeof e != "string") return { h: 0, m: 0, s: 0 };
|
|
104
|
+
const s = e.match(/\d+/g) || [];
|
|
105
|
+
let t = s[0] !== void 0 ? +s[0] : 0;
|
|
106
|
+
const v = +s[1] || 0, y = +s[2] || 0;
|
|
107
|
+
return { h: t, m: v, s: y };
|
|
104
108
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
let n = s[0] !== void 0 ? +s[0] : 0;
|
|
109
|
-
const h = +s[1] || 0, b = +s[2] || 0;
|
|
110
|
-
return { h: n, m: h, s: b };
|
|
109
|
+
function Be(e) {
|
|
110
|
+
const n = e % 12;
|
|
111
|
+
return n === 0 ? 12 : n;
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
return o === 0 ? 12 : o;
|
|
113
|
+
function Ve(e, n) {
|
|
114
|
+
return n ? e % 12 + 12 : e % 12;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
116
|
+
function _e(e) {
|
|
117
|
+
return /(s|ss)/.test(e);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
let { h: s, m: n, s: h } = o;
|
|
124
|
-
const b = Me(t), l = s >= 12 ? "PM" : "AM";
|
|
125
|
-
b && (s = Ne(s));
|
|
119
|
+
function me(e, n) {
|
|
120
|
+
let { h: s, m: t, s: v } = n;
|
|
121
|
+
const y = Ne(e), d = s >= 12 ? "PM" : "AM";
|
|
122
|
+
y && (s = Be(s));
|
|
126
123
|
const D = s === 0 ? 24 : s, E = {
|
|
127
124
|
HH: String(s).padStart(2, "0"),
|
|
128
125
|
H: String(s),
|
|
@@ -130,30 +127,30 @@ function se(t, o) {
|
|
|
130
127
|
h: String(s),
|
|
131
128
|
kk: String(D).padStart(2, "0"),
|
|
132
129
|
k: String(D),
|
|
133
|
-
mm: String(
|
|
134
|
-
m: String(
|
|
135
|
-
ss: String(
|
|
136
|
-
s: String(
|
|
137
|
-
A:
|
|
138
|
-
a:
|
|
139
|
-
P:
|
|
140
|
-
p:
|
|
130
|
+
mm: String(t).padStart(2, "0"),
|
|
131
|
+
m: String(t),
|
|
132
|
+
ss: String(v).padStart(2, "0"),
|
|
133
|
+
s: String(v),
|
|
134
|
+
A: d,
|
|
135
|
+
a: d.toLowerCase(),
|
|
136
|
+
P: d,
|
|
137
|
+
p: d.toLowerCase()
|
|
141
138
|
};
|
|
142
|
-
return
|
|
139
|
+
return e.replace(/HH|hh|kk|mm|ss|H|h|k|m|s|A|a|P|p/g, (w) => E[w] ?? w);
|
|
143
140
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
141
|
+
function j(e, n) {
|
|
142
|
+
return Me(e) - Me(n);
|
|
146
143
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
144
|
+
function We(e, n, s) {
|
|
145
|
+
return n && j(e, n) < 0 ? { ...n } : s && j(e, s) > 0 ? { ...s } : { ...e };
|
|
149
146
|
}
|
|
150
|
-
function
|
|
151
|
-
return !(
|
|
147
|
+
function $e(e, n, s) {
|
|
148
|
+
return !(n && j(e, n) < 0 || s && j(e, s) > 0);
|
|
152
149
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
150
|
+
function He(e, n) {
|
|
151
|
+
return n.some(([s, t]) => j(e, s) >= 0 && j(e, t) <= 0);
|
|
155
152
|
}
|
|
156
|
-
const
|
|
153
|
+
const we = /* @__PURE__ */ Ae({
|
|
157
154
|
__name: "TimeSelection",
|
|
158
155
|
props: {
|
|
159
156
|
open: { type: Boolean },
|
|
@@ -168,235 +165,242 @@ const Te = /* @__PURE__ */ be({
|
|
|
168
165
|
secondStep: {}
|
|
169
166
|
},
|
|
170
167
|
emits: ["update:initTime", "open", "close", "update:open"],
|
|
171
|
-
setup(
|
|
168
|
+
setup(e, { emit: n }) {
|
|
172
169
|
function s(a) {
|
|
173
170
|
return Math.max(1, a ?? 1);
|
|
174
171
|
}
|
|
175
|
-
const
|
|
176
|
-
get: () =>
|
|
172
|
+
const t = c(() => Ne(d.format)), v = c(() => _e(d.format)), y = c(() => xe(d.format)), d = e, D = n, E = c({
|
|
173
|
+
get: () => d.open ?? !1,
|
|
177
174
|
set: (a) => {
|
|
178
|
-
const
|
|
179
|
-
a !==
|
|
175
|
+
const l = d.open ?? !1;
|
|
176
|
+
a !== l && (D("update:open", a), D(a ? "open" : "close"));
|
|
180
177
|
}
|
|
181
|
-
}),
|
|
182
|
-
function
|
|
178
|
+
}), w = $(null);
|
|
179
|
+
function _(a) {
|
|
183
180
|
if (!E.value) return;
|
|
184
|
-
const
|
|
185
|
-
|
|
181
|
+
const l = a.target;
|
|
182
|
+
w.value && !w.value.contains(l) && (E.value = !1);
|
|
186
183
|
}
|
|
187
|
-
|
|
188
|
-
() => document.removeEventListener("mousedown",
|
|
184
|
+
ye(() => document.addEventListener("mousedown", _)), ke(
|
|
185
|
+
() => document.removeEventListener("mousedown", _)
|
|
189
186
|
);
|
|
190
|
-
function
|
|
187
|
+
function T(a) {
|
|
191
188
|
a.key === "Escape" && E.value && (E.value = !1);
|
|
192
189
|
}
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
()
|
|
190
|
+
ye(() => document.addEventListener("keydown", T)), ke(() => document.removeEventListener("keydown", T));
|
|
191
|
+
const I = $(0), N = $(0), p = $(0), S = $(0);
|
|
192
|
+
function A(a) {
|
|
193
|
+
const l = s(d.hourStep), g = s(d.minuteStep), k = s(d.secondStep);
|
|
194
|
+
let V = a.h;
|
|
195
|
+
t.value ? (S.value = a.h >= 12 ? 1 : 0, V = a.h % 12) : y.value && a.h === 0 && (V = 24), I.value = Math.floor(V / l), N.value = Math.floor(a.m / g), p.value = Math.floor(a.s / k);
|
|
196
|
+
}
|
|
197
|
+
F(
|
|
198
|
+
() => d.initTime,
|
|
197
199
|
(a) => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
200
|
+
A(a);
|
|
201
|
+
},
|
|
202
|
+
{ immediate: !0 }
|
|
202
203
|
);
|
|
203
|
-
function
|
|
204
|
-
const
|
|
205
|
-
for (let
|
|
206
|
-
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
for (let
|
|
212
|
-
const
|
|
213
|
-
|
|
204
|
+
function M(a, l) {
|
|
205
|
+
const g = [];
|
|
206
|
+
for (let k = 0; k < a; k += s(l))
|
|
207
|
+
g.push({ key: k, value: k, text: String(k).padStart(2, "0") });
|
|
208
|
+
return g;
|
|
209
|
+
}
|
|
210
|
+
function B(a, l) {
|
|
211
|
+
const g = s(l), k = [];
|
|
212
|
+
for (let V = 0; V < 12; V += g) {
|
|
213
|
+
const ie = V === 0 ? 12 : V, J = a ? V === 0 ? 12 : V + 12 : V;
|
|
214
|
+
k.push({ key: J, value: J, text: String(ie).padStart(2, "0") });
|
|
214
215
|
}
|
|
215
|
-
return
|
|
216
|
+
return k;
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
for (let
|
|
220
|
-
const
|
|
221
|
-
|
|
218
|
+
function P(a) {
|
|
219
|
+
const l = s(a), g = [];
|
|
220
|
+
for (let k = 0; k < 24; k += l) {
|
|
221
|
+
const V = k === 0 ? 24 : k;
|
|
222
|
+
g.push({ key: k, value: k, text: String(V).padStart(2, "0") });
|
|
222
223
|
}
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
return
|
|
228
|
-
const a =
|
|
229
|
-
return
|
|
230
|
-
}),
|
|
231
|
-
const a =
|
|
224
|
+
return g;
|
|
225
|
+
}
|
|
226
|
+
const U = c(() => {
|
|
227
|
+
if (!t.value)
|
|
228
|
+
return y.value ? P(d.hourStep) : M(24, d.hourStep);
|
|
229
|
+
const a = S.value === 1;
|
|
230
|
+
return B(a, d.hourStep);
|
|
231
|
+
}), r = c(() => M(60, d.minuteStep)), u = c(() => M(60, d.secondStep)), m = c(() => /\s[ap]$/.test(d.format)), b = c(() => {
|
|
232
|
+
const a = m.value ? "am" : "AM", l = m.value ? "pm" : "PM";
|
|
232
233
|
return [
|
|
233
234
|
{ key: "AM", value: "AM", text: a },
|
|
234
|
-
{ key: "PM", value: "PM", text:
|
|
235
|
+
{ key: "PM", value: "PM", text: l }
|
|
235
236
|
];
|
|
236
|
-
}),
|
|
237
|
-
() =>
|
|
238
|
-
),
|
|
239
|
-
function
|
|
237
|
+
}), h = c(
|
|
238
|
+
() => r.value.map((a) => Number(a.value ?? 0))
|
|
239
|
+
), x = c(() => v.value ? u.value.map((a) => Number(a.value ?? 0)) : [0]);
|
|
240
|
+
function z(a) {
|
|
240
241
|
return Number(a.value ?? 0);
|
|
241
242
|
}
|
|
242
|
-
function
|
|
243
|
-
const
|
|
244
|
-
return
|
|
243
|
+
function pe(a) {
|
|
244
|
+
const l = a.findIndex((g) => !g.disabled);
|
|
245
|
+
return l >= 0 ? l : 0;
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
-
return !(
|
|
247
|
+
function K(a) {
|
|
248
|
+
return !(!$e(a, d.minTime, d.maxTime) || He(a, d.disabledRanges ?? []) || d.isTimeDisabled?.(a));
|
|
248
249
|
}
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
(
|
|
252
|
-
(
|
|
250
|
+
const Z = c(() => U.value.map((a) => {
|
|
251
|
+
const l = z(a), g = h.value.some(
|
|
252
|
+
(k) => x.value.some(
|
|
253
|
+
(V) => K({ h: l, m: k, s: V })
|
|
253
254
|
)
|
|
254
255
|
);
|
|
255
256
|
return {
|
|
256
257
|
...a,
|
|
257
|
-
disabled: !
|
|
258
|
+
disabled: !g
|
|
258
259
|
};
|
|
259
|
-
})),
|
|
260
|
-
const a = Number(
|
|
261
|
-
return
|
|
262
|
-
const
|
|
263
|
-
(
|
|
260
|
+
})), re = c(() => {
|
|
261
|
+
const a = Number(U.value[I.value]?.value ?? 0);
|
|
262
|
+
return r.value.map((l) => {
|
|
263
|
+
const g = Number(l.value ?? 0), k = x.value.some(
|
|
264
|
+
(V) => K({ h: a, m: g, s: V })
|
|
264
265
|
);
|
|
265
266
|
return {
|
|
266
|
-
...
|
|
267
|
-
disabled: !
|
|
267
|
+
...l,
|
|
268
|
+
disabled: !k
|
|
268
269
|
};
|
|
269
270
|
});
|
|
270
|
-
}),
|
|
271
|
-
const a = Number(
|
|
272
|
-
|
|
271
|
+
}), se = c(() => {
|
|
272
|
+
const a = Number(U.value[I.value]?.value ?? 0), l = Number(
|
|
273
|
+
r.value[N.value]?.value ?? 0
|
|
273
274
|
);
|
|
274
|
-
return
|
|
275
|
-
const
|
|
275
|
+
return u.value.map((g) => {
|
|
276
|
+
const k = Number(g.value ?? 0);
|
|
276
277
|
return {
|
|
277
|
-
...
|
|
278
|
-
disabled: !
|
|
278
|
+
...g,
|
|
279
|
+
disabled: !K({
|
|
279
280
|
h: a,
|
|
280
|
-
m:
|
|
281
|
-
s:
|
|
281
|
+
m: l,
|
|
282
|
+
s: k
|
|
282
283
|
})
|
|
283
284
|
};
|
|
284
285
|
});
|
|
285
|
-
}),
|
|
286
|
-
if (!
|
|
287
|
-
const a = Number(
|
|
288
|
-
return
|
|
289
|
-
const
|
|
290
|
-
(
|
|
291
|
-
h: Number(
|
|
286
|
+
}), ue = c(() => {
|
|
287
|
+
if (!t.value) return b.value;
|
|
288
|
+
const a = Number(r.value[N.value]?.value ?? 0), l = v.value ? Number(u.value[p.value]?.value ?? 0) : 0;
|
|
289
|
+
return b.value.map((g) => {
|
|
290
|
+
const k = g.value === "PM", V = B(k, d.hourStep).some(
|
|
291
|
+
(ie) => K({
|
|
292
|
+
h: Number(ie.value ?? 0),
|
|
292
293
|
m: a,
|
|
293
|
-
s:
|
|
294
|
+
s: l
|
|
294
295
|
})
|
|
295
296
|
);
|
|
296
297
|
return {
|
|
297
|
-
...
|
|
298
|
-
disabled: !
|
|
298
|
+
...g,
|
|
299
|
+
disabled: !V
|
|
299
300
|
};
|
|
300
301
|
});
|
|
301
|
-
}),
|
|
302
|
-
const a = Number(
|
|
303
|
-
return
|
|
304
|
-
}),
|
|
305
|
-
() => Number(
|
|
306
|
-
),
|
|
307
|
-
() => Number(
|
|
302
|
+
}), ve = c(() => S.value === 1 ? "PM" : "AM"), ee = c(() => {
|
|
303
|
+
const a = Number(U.value[I.value]?.value ?? 0);
|
|
304
|
+
return t.value ? ve.value === "PM" ? Ve(a, !0) : Ve(a, !1) : y.value && a === 24 ? 0 : a;
|
|
305
|
+
}), he = c(
|
|
306
|
+
() => Number(r.value[N.value]?.value ?? 0)
|
|
307
|
+
), ge = c(
|
|
308
|
+
() => Number(u.value[p.value]?.value ?? 0)
|
|
308
309
|
);
|
|
309
|
-
function
|
|
310
|
-
a.length && (!a[
|
|
310
|
+
function q(a, l, g) {
|
|
311
|
+
a.length && (!a[l] || a[l].disabled) && g(pe(a));
|
|
311
312
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
F(Z, (a) => {
|
|
314
|
+
q(a, I.value, (l) => {
|
|
315
|
+
I.value = l;
|
|
315
316
|
});
|
|
316
|
-
}),
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
}), F(re, (a) => {
|
|
318
|
+
q(a, N.value, (l) => {
|
|
319
|
+
N.value = l;
|
|
319
320
|
});
|
|
320
|
-
}),
|
|
321
|
-
!
|
|
322
|
-
|
|
321
|
+
}), F(se, (a) => {
|
|
322
|
+
!v.value || !a.length || q(a, p.value, (l) => {
|
|
323
|
+
p.value = l;
|
|
323
324
|
});
|
|
324
|
-
}),
|
|
325
|
-
!
|
|
326
|
-
|
|
325
|
+
}), F(ue, (a) => {
|
|
326
|
+
!t.value || !a.length || q(a, S.value, (l) => {
|
|
327
|
+
S.value = l;
|
|
327
328
|
});
|
|
328
329
|
});
|
|
329
|
-
function
|
|
330
|
-
!
|
|
330
|
+
function R(a) {
|
|
331
|
+
!v.value && !t.value && ne();
|
|
331
332
|
}
|
|
332
|
-
function
|
|
333
|
-
|
|
333
|
+
function be(a) {
|
|
334
|
+
t.value || ne();
|
|
334
335
|
}
|
|
335
|
-
function
|
|
336
|
-
|
|
336
|
+
function W(a) {
|
|
337
|
+
ne();
|
|
337
338
|
}
|
|
338
|
-
function
|
|
339
|
+
function ne() {
|
|
339
340
|
E.value = !1;
|
|
340
341
|
}
|
|
341
|
-
return
|
|
342
|
-
[
|
|
343
|
-
([a,
|
|
344
|
-
D("update:initTime", { h: a, m:
|
|
342
|
+
return F(
|
|
343
|
+
[ee, he, ge],
|
|
344
|
+
([a, l, g]) => {
|
|
345
|
+
D("update:initTime", { h: a, m: l, s: g });
|
|
345
346
|
},
|
|
346
347
|
{ immediate: !0 }
|
|
347
|
-
), (a,
|
|
348
|
+
), (a, l) => E.value ? (G(), X("div", {
|
|
348
349
|
key: 0,
|
|
349
350
|
class: "vtp-cols",
|
|
350
351
|
ref_key: "root",
|
|
351
|
-
ref:
|
|
352
|
+
ref: w
|
|
352
353
|
}, [
|
|
353
|
-
|
|
354
|
-
activeIndex:
|
|
355
|
-
"onUpdate:activeIndex":
|
|
356
|
-
items:
|
|
354
|
+
Te(ce, {
|
|
355
|
+
activeIndex: I.value,
|
|
356
|
+
"onUpdate:activeIndex": l[0] || (l[0] = (g) => I.value = g),
|
|
357
|
+
items: Z.value,
|
|
357
358
|
label: "Hours"
|
|
358
359
|
}, null, 8, ["activeIndex", "items"]),
|
|
359
|
-
|
|
360
|
-
activeIndex:
|
|
361
|
-
"onUpdate:activeIndex":
|
|
362
|
-
items:
|
|
360
|
+
Te(ce, {
|
|
361
|
+
activeIndex: N.value,
|
|
362
|
+
"onUpdate:activeIndex": l[1] || (l[1] = (g) => N.value = g),
|
|
363
|
+
items: re.value,
|
|
363
364
|
label: "Minutes",
|
|
364
|
-
onSelect:
|
|
365
|
+
onSelect: R
|
|
365
366
|
}, null, 8, ["activeIndex", "items"]),
|
|
366
|
-
|
|
367
|
+
v.value ? (G(), Se(ce, {
|
|
367
368
|
key: 0,
|
|
368
|
-
activeIndex:
|
|
369
|
-
"onUpdate:activeIndex":
|
|
370
|
-
items:
|
|
369
|
+
activeIndex: p.value,
|
|
370
|
+
"onUpdate:activeIndex": l[2] || (l[2] = (g) => p.value = g),
|
|
371
|
+
items: se.value,
|
|
371
372
|
label: "Seconds",
|
|
372
|
-
onSelect:
|
|
373
|
+
onSelect: be
|
|
373
374
|
}, null, 8, ["activeIndex", "items"])) : te("", !0),
|
|
374
|
-
|
|
375
|
+
t.value ? (G(), Se(ce, {
|
|
375
376
|
key: 1,
|
|
376
|
-
activeIndex:
|
|
377
|
-
"onUpdate:activeIndex":
|
|
378
|
-
items:
|
|
377
|
+
activeIndex: S.value,
|
|
378
|
+
"onUpdate:activeIndex": l[3] || (l[3] = (g) => S.value = g),
|
|
379
|
+
items: ue.value,
|
|
379
380
|
label: "AM/PM",
|
|
380
|
-
onSelect:
|
|
381
|
+
onSelect: W
|
|
381
382
|
}, null, 8, ["activeIndex", "items"])) : te("", !0)
|
|
382
383
|
], 512)) : te("", !0);
|
|
383
384
|
}
|
|
384
385
|
});
|
|
385
|
-
function
|
|
386
|
-
return typeof
|
|
386
|
+
function Ke(e) {
|
|
387
|
+
return typeof e == "string" ? Q.test(e) : Array.isArray(e) ? e.length === 2 && Q.test(e[0] ?? "") && Q.test(e[1] ?? "") : !1;
|
|
387
388
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
389
|
+
function fe(e) {
|
|
390
|
+
return e == null || typeof e == "string" || typeof e == "number";
|
|
390
391
|
}
|
|
391
|
-
|
|
392
|
+
function Ue(e) {
|
|
393
|
+
return e == null || typeof e == "string" || Array.isArray(e) || typeof e == "object" && e !== null;
|
|
394
|
+
}
|
|
395
|
+
const Le = /^(HH|H|hh|h|kk|k):(mm|m)(?::(ss|s))?(?:\s*(A|a|P|p))?$/, Q = /^([01]\d|2[0-3]):([0-5]\d)(:([0-5]\d))?$/, C = typeof __DEV__ < "u" ? __DEV__ : typeof process < "u" && process.env && process.env.NODE_ENV !== "production", Oe = {
|
|
392
396
|
modelValue: {
|
|
393
397
|
type: [String, Array],
|
|
394
398
|
default: void 0,
|
|
395
|
-
validator: (
|
|
396
|
-
let
|
|
397
|
-
return Array.isArray(
|
|
398
|
-
`[VueTimepicker] \`modelValue\` is wrong. Received: ${
|
|
399
|
-
),
|
|
399
|
+
validator: (e) => {
|
|
400
|
+
let n;
|
|
401
|
+
return Array.isArray(e) ? n = e.length === 2 && e.every((s) => Q.test(s)) : n = e == null || Q.test(e), !n && C && console.error(
|
|
402
|
+
`[VueTimepicker] \`modelValue\` is wrong. Received: ${e}`
|
|
403
|
+
), n;
|
|
400
404
|
}
|
|
401
405
|
},
|
|
402
406
|
range: {
|
|
@@ -407,33 +411,37 @@ const we = /^(HH|H|hh|h|kk|k):(mm|m)(?::(ss|s))?(?:\s*(A|a|P|p))?$/, J = /^([01]
|
|
|
407
411
|
type: Boolean,
|
|
408
412
|
default: !1
|
|
409
413
|
},
|
|
414
|
+
hideDropdown: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
default: !1
|
|
417
|
+
},
|
|
410
418
|
hourStep: { type: Number, default: 1 },
|
|
411
419
|
minuteStep: { type: Number, default: 1 },
|
|
412
420
|
secondStep: { type: Number, default: 1 },
|
|
413
421
|
minTime: {
|
|
414
422
|
type: String,
|
|
415
423
|
default: void 0,
|
|
416
|
-
validator: (
|
|
417
|
-
const
|
|
418
|
-
return !
|
|
424
|
+
validator: (e) => {
|
|
425
|
+
const n = e == null || Q.test(e);
|
|
426
|
+
return !n && C && console.error(`[VueTimepicker] \`minTime\` is wrong. Received: ${e}`), n;
|
|
419
427
|
}
|
|
420
428
|
},
|
|
421
429
|
maxTime: {
|
|
422
430
|
type: String,
|
|
423
431
|
default: void 0,
|
|
424
|
-
validator: (
|
|
425
|
-
const
|
|
426
|
-
return !
|
|
432
|
+
validator: (e) => {
|
|
433
|
+
const n = e == null || Q.test(e);
|
|
434
|
+
return !n && C && console.error(`[VueTimepicker] \`maxTime\` is wrong. Received: ${e}`), n;
|
|
427
435
|
}
|
|
428
436
|
},
|
|
429
437
|
disabledTimes: {
|
|
430
438
|
type: Array,
|
|
431
439
|
default: void 0,
|
|
432
|
-
validator: (
|
|
433
|
-
const
|
|
434
|
-
return !
|
|
435
|
-
`[VueTimepicker] \`disabledTimes\` is wrong. Received: ${JSON.stringify(
|
|
436
|
-
),
|
|
440
|
+
validator: (e) => {
|
|
441
|
+
const n = e == null || e.every(Ke);
|
|
442
|
+
return !n && C && console.error(
|
|
443
|
+
`[VueTimepicker] \`disabledTimes\` is wrong. Received: ${JSON.stringify(e)}`
|
|
444
|
+
), n;
|
|
437
445
|
}
|
|
438
446
|
},
|
|
439
447
|
isTimeDisabled: {
|
|
@@ -443,535 +451,604 @@ const we = /^(HH|H|hh|h|kk|k):(mm|m)(?::(ss|s))?(?:\s*(A|a|P|p))?$/, J = /^([01]
|
|
|
443
451
|
format: {
|
|
444
452
|
type: String,
|
|
445
453
|
default: "HH:mm",
|
|
446
|
-
validator: (
|
|
447
|
-
const
|
|
448
|
-
return !
|
|
449
|
-
`[VueTimepicker] \`format\` format is wrong. Received: ${
|
|
450
|
-
),
|
|
454
|
+
validator: (e) => {
|
|
455
|
+
const n = Le.test(e);
|
|
456
|
+
return !n && C && console.error(
|
|
457
|
+
`[VueTimepicker] \`format\` format is wrong. Received: ${e}`
|
|
458
|
+
), n;
|
|
451
459
|
}
|
|
452
460
|
},
|
|
453
461
|
placeholder: {
|
|
454
462
|
type: String,
|
|
455
463
|
default: "Select time"
|
|
456
464
|
},
|
|
465
|
+
id: {
|
|
466
|
+
type: String,
|
|
467
|
+
default: void 0,
|
|
468
|
+
validator: (e) => {
|
|
469
|
+
const n = e == null || typeof e == "string";
|
|
470
|
+
return !n && C && console.error(
|
|
471
|
+
`[VueTimepicker] \`id\` must be a string. Received: ${e}`
|
|
472
|
+
), n;
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
name: {
|
|
476
|
+
type: String,
|
|
477
|
+
default: void 0,
|
|
478
|
+
validator: (e) => {
|
|
479
|
+
const n = e == null || typeof e == "string";
|
|
480
|
+
return !n && C && console.error(
|
|
481
|
+
`[VueTimepicker] \`name\` must be a string. Received: ${e}`
|
|
482
|
+
), n;
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
tabindex: {
|
|
486
|
+
type: Number,
|
|
487
|
+
default: 0,
|
|
488
|
+
validator: (e) => {
|
|
489
|
+
const n = Number.isInteger(e);
|
|
490
|
+
return !n && C && console.error(
|
|
491
|
+
`[VueTimepicker] \`tabindex\` must be an integer. Received: ${e}`
|
|
492
|
+
), n;
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
autocomplete: {
|
|
496
|
+
type: String,
|
|
497
|
+
default: "off",
|
|
498
|
+
validator: (e) => {
|
|
499
|
+
const n = typeof e == "string";
|
|
500
|
+
return !n && C && console.error(
|
|
501
|
+
`[VueTimepicker] \`autocomplete\` must be a string. Received: ${e}`
|
|
502
|
+
), n;
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
inputClass: {
|
|
506
|
+
type: [String, Array, Object],
|
|
507
|
+
default: void 0,
|
|
508
|
+
validator: (e) => {
|
|
509
|
+
const n = Ue(e);
|
|
510
|
+
return !n && C && console.error(
|
|
511
|
+
`[VueTimepicker] \`inputClass\` must be a string, array, or object. Received: ${e}`
|
|
512
|
+
), n;
|
|
513
|
+
}
|
|
514
|
+
},
|
|
457
515
|
inputWidth: {
|
|
458
516
|
type: [String, Number],
|
|
459
517
|
default: void 0,
|
|
460
|
-
validator: (
|
|
461
|
-
const
|
|
462
|
-
return !
|
|
463
|
-
`[VueTimepicker] \`inputWidth\` must be a string or number. Received: ${
|
|
464
|
-
),
|
|
518
|
+
validator: (e) => {
|
|
519
|
+
const n = fe(e);
|
|
520
|
+
return !n && C && console.error(
|
|
521
|
+
`[VueTimepicker] \`inputWidth\` must be a string or number. Received: ${e}`
|
|
522
|
+
), n;
|
|
465
523
|
}
|
|
466
524
|
},
|
|
467
525
|
componentWidth: {
|
|
468
526
|
type: [String, Number],
|
|
469
527
|
default: void 0,
|
|
470
|
-
validator: (
|
|
471
|
-
const
|
|
472
|
-
return !
|
|
473
|
-
`[VueTimepicker] \`componentWidth\` must be a string or number. Received: ${
|
|
474
|
-
),
|
|
528
|
+
validator: (e) => {
|
|
529
|
+
const n = fe(e);
|
|
530
|
+
return !n && C && console.error(
|
|
531
|
+
`[VueTimepicker] \`componentWidth\` must be a string or number. Received: ${e}`
|
|
532
|
+
), n;
|
|
475
533
|
}
|
|
476
534
|
},
|
|
477
535
|
minInputWidth: {
|
|
478
536
|
type: [String, Number],
|
|
479
537
|
default: void 0,
|
|
480
|
-
validator: (
|
|
481
|
-
const
|
|
482
|
-
return !
|
|
483
|
-
`[VueTimepicker] \`minInputWidth\` must be a string or number. Received: ${
|
|
484
|
-
),
|
|
538
|
+
validator: (e) => {
|
|
539
|
+
const n = fe(e);
|
|
540
|
+
return !n && C && console.error(
|
|
541
|
+
`[VueTimepicker] \`minInputWidth\` must be a string or number. Received: ${e}`
|
|
542
|
+
), n;
|
|
485
543
|
}
|
|
486
544
|
},
|
|
487
545
|
maxInputWidth: {
|
|
488
546
|
type: [String, Number],
|
|
489
547
|
default: void 0,
|
|
490
|
-
validator: (
|
|
491
|
-
const
|
|
492
|
-
return !
|
|
493
|
-
`[VueTimepicker] \`maxInputWidth\` must be a string or number. Received: ${
|
|
494
|
-
),
|
|
548
|
+
validator: (e) => {
|
|
549
|
+
const n = fe(e);
|
|
550
|
+
return !n && C && console.error(
|
|
551
|
+
`[VueTimepicker] \`maxInputWidth\` must be a string or number. Received: ${e}`
|
|
552
|
+
), n;
|
|
495
553
|
}
|
|
496
554
|
},
|
|
497
555
|
size: {
|
|
498
556
|
type: String,
|
|
499
557
|
default: "md",
|
|
500
|
-
validator: (
|
|
501
|
-
const
|
|
502
|
-
return !
|
|
558
|
+
validator: (e) => {
|
|
559
|
+
const n = e === "xs" || e === "sm" || e === "md" || e === "lg" || e === "xl";
|
|
560
|
+
return !n && C && console.error(`[VueTimepicker] \`size\` is wrong. Received: ${e}`), n;
|
|
503
561
|
}
|
|
504
562
|
}
|
|
505
563
|
};
|
|
506
|
-
function
|
|
507
|
-
const
|
|
508
|
-
if (!
|
|
509
|
-
const [, s,
|
|
510
|
-
let
|
|
511
|
-
return D ? (
|
|
512
|
-
digitGroups:
|
|
513
|
-
hasAmPm: !!
|
|
514
|
-
ampmLowercase:
|
|
564
|
+
function Pe(e) {
|
|
565
|
+
const n = Le.exec(e);
|
|
566
|
+
if (!n) throw new Error(`[useTimeMask] Invalid format: ${e}`);
|
|
567
|
+
const [, s, t, v, y] = n, d = [], D = !!y, E = /^k{1,2}$/.test(s);
|
|
568
|
+
let w = 0, _ = 23;
|
|
569
|
+
return D ? (w = 1, _ = 12) : E && (w = 1, _ = 24), d.push({ token: s, min: w, max: _ }), d.push({ token: t, min: 0, max: 59 }), v && d.push({ token: v, min: 0, max: 59 }), {
|
|
570
|
+
digitGroups: d,
|
|
571
|
+
hasAmPm: !!y,
|
|
572
|
+
ampmLowercase: y === "a" || y === "p"
|
|
515
573
|
};
|
|
516
574
|
}
|
|
517
|
-
function
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
575
|
+
function Ge(e) {
|
|
576
|
+
try {
|
|
577
|
+
return Pe(e);
|
|
578
|
+
} catch {
|
|
579
|
+
return Pe("HH:mm");
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function De(e) {
|
|
583
|
+
const n = c(() => Ge(e.value)), s = c(() => n.value.digitGroups.length * 2), t = $([]), v = $("AM"), y = $("");
|
|
584
|
+
function d() {
|
|
585
|
+
const { digitGroups: r, hasAmPm: u } = n.value;
|
|
586
|
+
let m = "", b = 0;
|
|
587
|
+
for (let h = 0; h < r.length; h++) {
|
|
588
|
+
for (let x = 0; x < 2; x++)
|
|
589
|
+
b < t.value.length && (m += String(t.value[b]), b++);
|
|
590
|
+
b === (h + 1) * 2 && h < r.length - 1 && (m += ":");
|
|
591
|
+
}
|
|
592
|
+
if (u && b >= s.value) {
|
|
593
|
+
const h = n.value.ampmLowercase ? v.value.toLowerCase() : v.value;
|
|
594
|
+
m += " " + h;
|
|
595
|
+
}
|
|
596
|
+
return m;
|
|
532
597
|
}
|
|
533
598
|
function D(r) {
|
|
534
599
|
const u = r * 2;
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
|
|
600
|
+
if (t.value.length < u + 2) return;
|
|
601
|
+
const m = t.value[u] * 10 + t.value[u + 1], { min: b, max: h } = n.value.digitGroups[r], x = Math.max(b, Math.min(h, m));
|
|
602
|
+
x !== m && (t.value[u] = Math.floor(x / 10), t.value[u + 1] = x % 10);
|
|
538
603
|
}
|
|
539
604
|
function E() {
|
|
540
|
-
for (let r = 0; r <
|
|
605
|
+
for (let r = 0; r < n.value.digitGroups.length; r++)
|
|
541
606
|
D(r);
|
|
542
607
|
}
|
|
543
|
-
function
|
|
544
|
-
const u =
|
|
545
|
-
let
|
|
546
|
-
for (let
|
|
547
|
-
/\d/.test(u[
|
|
548
|
-
return
|
|
608
|
+
function w(r) {
|
|
609
|
+
const u = d();
|
|
610
|
+
let m = 0;
|
|
611
|
+
for (let b = 0; b < Math.min(r, u.length); b++)
|
|
612
|
+
/\d/.test(u[b]) && m++;
|
|
613
|
+
return m;
|
|
549
614
|
}
|
|
550
|
-
function
|
|
615
|
+
function _(r) {
|
|
551
616
|
return r + Math.floor(r / 2);
|
|
552
617
|
}
|
|
553
|
-
function
|
|
618
|
+
function T(r, u) {
|
|
554
619
|
if (r >= s.value) return s.value;
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
return D(
|
|
620
|
+
const m = [...t.value];
|
|
621
|
+
m[r] = u, t.value = m;
|
|
622
|
+
const b = Math.floor(r / 2);
|
|
623
|
+
return D(b), Math.min(r + 1, s.value);
|
|
559
624
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
r.selectionStart = r.selectionEnd =
|
|
565
|
-
document.activeElement === r && (r.selectionStart = r.selectionEnd =
|
|
625
|
+
function I(r, u) {
|
|
626
|
+
const m = d();
|
|
627
|
+
y.value = m, r.value = m;
|
|
628
|
+
const b = u !== void 0 ? Math.min(_(u), m.length) : m.length;
|
|
629
|
+
r.selectionStart = r.selectionEnd = b, Ie(() => {
|
|
630
|
+
document.activeElement === r && (r.selectionStart = r.selectionEnd = b);
|
|
566
631
|
});
|
|
567
632
|
}
|
|
568
|
-
function
|
|
569
|
-
const u = r.key,
|
|
633
|
+
function N(r) {
|
|
634
|
+
const u = r.key, m = r.target;
|
|
570
635
|
if (["Tab", "Escape", "ArrowLeft", "ArrowRight", "Home", "End"].includes(
|
|
571
636
|
u
|
|
572
637
|
) || r.metaKey || r.ctrlKey)
|
|
573
638
|
return;
|
|
574
639
|
r.preventDefault();
|
|
575
|
-
const
|
|
640
|
+
const b = m.selectionStart ?? 0, h = w(b);
|
|
576
641
|
if (u === "Backspace") {
|
|
577
|
-
|
|
642
|
+
h > 0 && I(m, h - 1);
|
|
578
643
|
return;
|
|
579
644
|
}
|
|
580
645
|
if (u !== "Delete") {
|
|
581
|
-
if (
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
584
|
-
|
|
646
|
+
if (n.value.hasAmPm) {
|
|
647
|
+
const x = u.toLowerCase();
|
|
648
|
+
if (x === "a") {
|
|
649
|
+
v.value = "AM", I(m, h);
|
|
585
650
|
return;
|
|
586
651
|
}
|
|
587
|
-
if (
|
|
588
|
-
|
|
652
|
+
if (x === "p") {
|
|
653
|
+
v.value = "PM", I(m, h);
|
|
589
654
|
return;
|
|
590
655
|
}
|
|
591
656
|
}
|
|
592
657
|
if (/^\d$/.test(u)) {
|
|
593
|
-
const
|
|
594
|
-
|
|
658
|
+
const x = T(h, +u);
|
|
659
|
+
I(m, x);
|
|
595
660
|
return;
|
|
596
661
|
}
|
|
597
662
|
}
|
|
598
663
|
}
|
|
599
|
-
function
|
|
600
|
-
const u = r.target,
|
|
601
|
-
|
|
664
|
+
function p(r) {
|
|
665
|
+
const u = r.target, m = u.value.replace(/\D/g, "").split("").map(Number).slice(0, s.value);
|
|
666
|
+
t.value = m, E(), n.value.hasAmPm && (/p/i.test(u.value) ? v.value = "PM" : /a/i.test(u.value) && (v.value = "AM")), I(u);
|
|
602
667
|
}
|
|
603
|
-
function
|
|
668
|
+
function S(r) {
|
|
604
669
|
r.preventDefault();
|
|
605
|
-
const u = r.clipboardData?.getData("text") ?? "",
|
|
606
|
-
let
|
|
607
|
-
for (const
|
|
608
|
-
if (
|
|
609
|
-
|
|
670
|
+
const u = r.clipboardData?.getData("text") ?? "", m = r.target, b = m.selectionStart ?? 0, h = u.replace(/\D/g, "").split("").map(Number);
|
|
671
|
+
let x = w(b);
|
|
672
|
+
for (const z of h) {
|
|
673
|
+
if (x >= s.value) break;
|
|
674
|
+
x = T(x, z);
|
|
610
675
|
}
|
|
611
|
-
|
|
676
|
+
n.value.hasAmPm && (/p\.?m\.?/i.test(u) ? v.value = "PM" : /a\.?m\.?/i.test(u) && (v.value = "AM")), I(m, x);
|
|
612
677
|
}
|
|
613
|
-
function
|
|
614
|
-
const { digitGroups: u, hasAmPm:
|
|
615
|
-
let
|
|
616
|
-
|
|
678
|
+
function A(r) {
|
|
679
|
+
const { digitGroups: u, hasAmPm: m } = n.value, b = [];
|
|
680
|
+
let h = r.h;
|
|
681
|
+
m ? (v.value = r.h >= 12 ? "PM" : "AM", h = r.h % 12, h === 0 && (h = 12)) : xe(e.value) && (h = r.h === 0 ? 24 : r.h), b.push(Math.floor(h / 10), h % 10), b.push(Math.floor(r.m / 10), r.m % 10), u.length > 2 && b.push(Math.floor(r.s / 10), r.s % 10), t.value = b, y.value = d();
|
|
617
682
|
}
|
|
618
|
-
function
|
|
619
|
-
|
|
683
|
+
function M() {
|
|
684
|
+
t.value = [], y.value = "", v.value = "AM";
|
|
620
685
|
}
|
|
621
|
-
function
|
|
622
|
-
if (
|
|
686
|
+
function B() {
|
|
687
|
+
if (t.value.length < s.value) return null;
|
|
623
688
|
const r = [];
|
|
624
|
-
for (let
|
|
625
|
-
const
|
|
626
|
-
r.push(
|
|
689
|
+
for (let h = 0; h < n.value.digitGroups.length; h++) {
|
|
690
|
+
const x = h * 2;
|
|
691
|
+
r.push(t.value[x] * 10 + t.value[x + 1]);
|
|
627
692
|
}
|
|
628
693
|
let u = r[0];
|
|
629
|
-
const
|
|
630
|
-
return
|
|
694
|
+
const m = r[1], b = r[2] ?? 0;
|
|
695
|
+
return n.value.hasAmPm && (u = v.value === "PM" ? u === 12 ? 12 : u + 12 : u === 12 ? 0 : u), xe(e.value) && u === 24 && (u = 0), { h: u, m, s: b };
|
|
631
696
|
}
|
|
632
|
-
const
|
|
633
|
-
() =>
|
|
634
|
-
),
|
|
697
|
+
const P = c(
|
|
698
|
+
() => t.value.length >= s.value
|
|
699
|
+
), U = c(() => n.value.ampmLowercase);
|
|
635
700
|
return {
|
|
636
|
-
inputValue:
|
|
637
|
-
handleKeydown:
|
|
638
|
-
handleInput:
|
|
639
|
-
handlePaste:
|
|
640
|
-
setFromTime:
|
|
641
|
-
clear:
|
|
642
|
-
getParsedTime:
|
|
643
|
-
isComplete:
|
|
701
|
+
inputValue: y,
|
|
702
|
+
handleKeydown: N,
|
|
703
|
+
handleInput: p,
|
|
704
|
+
handlePaste: S,
|
|
705
|
+
setFromTime: A,
|
|
706
|
+
clear: M,
|
|
707
|
+
getParsedTime: B,
|
|
708
|
+
isComplete: P,
|
|
644
709
|
totalDigits: s,
|
|
645
|
-
displayPosToDigitIndex:
|
|
646
|
-
ampm:
|
|
647
|
-
ampmLowercase:
|
|
710
|
+
displayPosToDigitIndex: w,
|
|
711
|
+
ampm: v,
|
|
712
|
+
ampmLowercase: U
|
|
648
713
|
};
|
|
649
714
|
}
|
|
650
|
-
const
|
|
715
|
+
const ze = ["data-size", "data-validation", "data-disabled"], je = ["id", "name", "tabindex", "autocomplete", "value", "placeholder", "disabled"], qe = ["id", "name", "tabindex", "autocomplete", "value", "placeholder", "disabled"], Ye = /* @__PURE__ */ Ae({
|
|
651
716
|
__name: "TimePicker",
|
|
652
|
-
props:
|
|
717
|
+
props: Oe,
|
|
653
718
|
emits: ["update:modelValue", "update:validationState", "validate", "open", "close", "error"],
|
|
654
|
-
setup(
|
|
655
|
-
const s =
|
|
656
|
-
function
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
function
|
|
660
|
-
if (
|
|
661
|
-
|
|
719
|
+
setup(e, { emit: n }) {
|
|
720
|
+
const s = $(null), t = e, v = n, y = $(!1), d = $(!1), D = $("valid"), E = $("valid");
|
|
721
|
+
function w() {
|
|
722
|
+
y.value = !1, d.value = !1;
|
|
723
|
+
}
|
|
724
|
+
function _(i, o) {
|
|
725
|
+
if (t.disabled && o) {
|
|
726
|
+
w();
|
|
662
727
|
return;
|
|
663
728
|
}
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}),
|
|
669
|
-
|
|
670
|
-
}),
|
|
671
|
-
() =>
|
|
672
|
-
(
|
|
673
|
-
|
|
729
|
+
o && (i === "first" ? d.value = !1 : y.value = !1);
|
|
730
|
+
}
|
|
731
|
+
F(y, (i) => {
|
|
732
|
+
_("first", i);
|
|
733
|
+
}), F(d, (i) => {
|
|
734
|
+
_("second", i);
|
|
735
|
+
}), F(
|
|
736
|
+
() => t.disabled,
|
|
737
|
+
(i) => {
|
|
738
|
+
i && w();
|
|
739
|
+
}
|
|
740
|
+
), F(
|
|
741
|
+
() => t.hideDropdown,
|
|
742
|
+
(i) => {
|
|
743
|
+
i && w();
|
|
674
744
|
}
|
|
675
745
|
);
|
|
676
|
-
const
|
|
746
|
+
const T = c({
|
|
677
747
|
get() {
|
|
678
|
-
if (Array.isArray(
|
|
679
|
-
const [
|
|
680
|
-
return [
|
|
748
|
+
if (Array.isArray(t.modelValue)) {
|
|
749
|
+
const [i, o] = t.modelValue;
|
|
750
|
+
return [Y(i, t.format), Y(o, t.format)];
|
|
681
751
|
} else
|
|
682
|
-
return
|
|
752
|
+
return Y(t.modelValue, t.format);
|
|
683
753
|
},
|
|
684
|
-
set(
|
|
685
|
-
Array.isArray(
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
]) :
|
|
754
|
+
set(i) {
|
|
755
|
+
Array.isArray(i) ? v("update:modelValue", [
|
|
756
|
+
me("HH:mm:ss", i[0]),
|
|
757
|
+
me("HH:mm:ss", i[1])
|
|
758
|
+
]) : v("update:modelValue", me("HH:mm:ss", i));
|
|
689
759
|
}
|
|
690
|
-
}),
|
|
691
|
-
() =>
|
|
692
|
-
),
|
|
693
|
-
() =>
|
|
694
|
-
),
|
|
695
|
-
const
|
|
696
|
-
return
|
|
760
|
+
}), I = c(
|
|
761
|
+
() => t.minTime ? Y(t.minTime) : null
|
|
762
|
+
), N = c(
|
|
763
|
+
() => t.maxTime ? Y(t.maxTime) : null
|
|
764
|
+
), p = c(() => !I.value || !N.value ? !0 : j(I.value, N.value) <= 0), S = c(() => D.value === "out-of-range" || t.range && E.value === "out-of-range" ? "out-of-range" : D.value === "invalid" || t.range && E.value === "invalid" ? "invalid" : "valid"), A = c(() => (t.disabledTimes ?? []).map((o) => {
|
|
765
|
+
const f = Array.isArray(o) ? o : [o, o], H = Y(f[0]), L = Y(f[1]);
|
|
766
|
+
return j(H, L) <= 0 ? [H, L] : [L, H];
|
|
697
767
|
}));
|
|
698
|
-
function
|
|
699
|
-
return !!(
|
|
768
|
+
function M(i) {
|
|
769
|
+
return !!(He(i, A.value) || t.isTimeDisabled?.(i));
|
|
700
770
|
}
|
|
701
|
-
function
|
|
702
|
-
return
|
|
771
|
+
function B(i) {
|
|
772
|
+
return i === "first" ? Array.isArray(T.value) ? T.value[0] : T.value : Array.isArray(T.value) ? T.value[1] : T.value;
|
|
703
773
|
}
|
|
704
|
-
function
|
|
705
|
-
const
|
|
706
|
-
return Array.isArray(
|
|
774
|
+
function P(i) {
|
|
775
|
+
const o = t.modelValue;
|
|
776
|
+
return Array.isArray(o) ? i === "first" ? !!o[0] : !!o[1] : i === "second" ? !1 : typeof o == "string" && o.length > 0;
|
|
707
777
|
}
|
|
708
|
-
function
|
|
709
|
-
if (
|
|
710
|
-
Array.isArray(
|
|
778
|
+
function U(i, o) {
|
|
779
|
+
if (i === "first") {
|
|
780
|
+
Array.isArray(T.value) ? T.value = [o, T.value[1]] : T.value = o;
|
|
711
781
|
return;
|
|
712
782
|
}
|
|
713
|
-
Array.isArray(
|
|
714
|
-
}
|
|
715
|
-
function r(
|
|
716
|
-
if (
|
|
717
|
-
target:
|
|
718
|
-
state:
|
|
719
|
-
reason:
|
|
720
|
-
value:
|
|
721
|
-
}),
|
|
783
|
+
Array.isArray(T.value) && (T.value = [T.value[0], o]);
|
|
784
|
+
}
|
|
785
|
+
function r(i, o, f, H) {
|
|
786
|
+
if (i === "first" ? D.value = o : E.value = o, v("validate", {
|
|
787
|
+
target: i,
|
|
788
|
+
state: o,
|
|
789
|
+
reason: f,
|
|
790
|
+
value: H ? me("HH:mm:ss", H) : null
|
|
791
|
+
}), o === "valid") {
|
|
722
792
|
s.value = null;
|
|
723
793
|
return;
|
|
724
794
|
}
|
|
725
|
-
if (
|
|
726
|
-
s.value = "OUT_OF_RANGE",
|
|
795
|
+
if (o === "out-of-range") {
|
|
796
|
+
s.value = "OUT_OF_RANGE", v("error", {
|
|
727
797
|
code: "OUT_OF_RANGE",
|
|
728
798
|
message: "Time is outside min/max bounds and was clamped."
|
|
729
799
|
});
|
|
730
800
|
return;
|
|
731
801
|
}
|
|
732
|
-
s.value =
|
|
733
|
-
code:
|
|
734
|
-
message:
|
|
802
|
+
s.value = f ?? "BAD_TIME", v("error", {
|
|
803
|
+
code: f ?? "BAD_TIME",
|
|
804
|
+
message: f === "DISABLED" ? "Time is disabled by disabledTimes or isTimeDisabled." : "Time is invalid."
|
|
735
805
|
});
|
|
736
806
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
(
|
|
740
|
-
|
|
807
|
+
F(
|
|
808
|
+
S,
|
|
809
|
+
(i) => {
|
|
810
|
+
v("update:validationState", i);
|
|
741
811
|
},
|
|
742
812
|
{ immediate: !0 }
|
|
743
813
|
);
|
|
744
|
-
const u =
|
|
745
|
-
() =>
|
|
746
|
-
),
|
|
747
|
-
() =>
|
|
814
|
+
const u = c(
|
|
815
|
+
() => p.value ? I.value : null
|
|
816
|
+
), m = c(
|
|
817
|
+
() => p.value ? N.value : null
|
|
748
818
|
);
|
|
749
|
-
function
|
|
750
|
-
return
|
|
751
|
-
|
|
819
|
+
function b(i) {
|
|
820
|
+
return We(
|
|
821
|
+
i,
|
|
752
822
|
u.value,
|
|
753
|
-
|
|
823
|
+
m.value
|
|
754
824
|
);
|
|
755
825
|
}
|
|
756
|
-
function
|
|
757
|
-
const
|
|
758
|
-
|
|
826
|
+
function h(i, o, f) {
|
|
827
|
+
const H = !$e(
|
|
828
|
+
o,
|
|
759
829
|
u.value,
|
|
760
|
-
|
|
761
|
-
),
|
|
762
|
-
return
|
|
830
|
+
m.value
|
|
831
|
+
), L = b(o);
|
|
832
|
+
return M(L) ? (f.emitValidation && r(i, "invalid", "DISABLED", L), !1) : (U(i, L), f.emitValidation && (H ? r(i, "out-of-range", "OUT_OF_RANGE", L) : r(i, "valid", void 0, L)), !0);
|
|
763
833
|
}
|
|
764
|
-
const
|
|
834
|
+
const x = c({
|
|
765
835
|
get() {
|
|
766
|
-
return Array.isArray(
|
|
836
|
+
return Array.isArray(T.value) ? T.value[0] : T.value;
|
|
767
837
|
},
|
|
768
|
-
set(
|
|
769
|
-
!
|
|
838
|
+
set(i) {
|
|
839
|
+
!P("first") && !y.value || h("first", i, { emitValidation: !0 });
|
|
770
840
|
}
|
|
771
|
-
}),
|
|
841
|
+
}), z = c({
|
|
772
842
|
get() {
|
|
773
|
-
return Array.isArray(
|
|
843
|
+
return Array.isArray(T.value) ? T.value[1] : T.value;
|
|
774
844
|
},
|
|
775
|
-
set(
|
|
776
|
-
!
|
|
845
|
+
set(i) {
|
|
846
|
+
!P("second") && !d.value || Array.isArray(T.value) && h("second", i, { emitValidation: !0 });
|
|
777
847
|
}
|
|
778
848
|
});
|
|
779
|
-
|
|
780
|
-
() =>
|
|
781
|
-
(
|
|
782
|
-
if (
|
|
783
|
-
if (
|
|
849
|
+
F(
|
|
850
|
+
() => t.range,
|
|
851
|
+
(i) => {
|
|
852
|
+
if (i) {
|
|
853
|
+
if (t.modelValue != null && !Array.isArray(t.modelValue))
|
|
784
854
|
throw new RangeError(
|
|
785
|
-
`Model value must be an array for range selection: ${
|
|
855
|
+
`Model value must be an array for range selection: ${t.modelValue}`
|
|
786
856
|
);
|
|
787
|
-
} else if (Array.isArray(
|
|
857
|
+
} else if (Array.isArray(t.modelValue))
|
|
788
858
|
throw new RangeError(
|
|
789
|
-
`Model value must be a single string for single time selection: ${
|
|
859
|
+
`Model value must be a single string for single time selection: ${t.modelValue}`
|
|
790
860
|
);
|
|
791
861
|
},
|
|
792
862
|
{ immediate: !0 }
|
|
793
863
|
);
|
|
794
|
-
function
|
|
795
|
-
|
|
864
|
+
function pe() {
|
|
865
|
+
P("first") && h("first", B("first"), {
|
|
796
866
|
emitValidation: !0
|
|
797
|
-
}),
|
|
867
|
+
}), t.range && P("second") && h("second", B("second"), {
|
|
798
868
|
emitValidation: !0
|
|
799
869
|
});
|
|
800
870
|
}
|
|
801
|
-
|
|
802
|
-
() => [
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
871
|
+
F(
|
|
872
|
+
() => [
|
|
873
|
+
u.value,
|
|
874
|
+
m.value,
|
|
875
|
+
A.value,
|
|
876
|
+
t.isTimeDisabled,
|
|
877
|
+
t.range
|
|
878
|
+
],
|
|
879
|
+
pe,
|
|
808
880
|
{ immediate: !0 }
|
|
809
881
|
);
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
882
|
+
const K = c(() => t.format ?? "HH:mm:ss"), Z = c(() => t.placeholder ?? "Select time"), re = c(() => t.id), se = c(
|
|
883
|
+
() => t.range && t.id ? `${t.id}-end` : void 0
|
|
884
|
+
), ue = c(() => t.name), ve = c(
|
|
885
|
+
() => t.range && t.name ? `${t.name}-end` : void 0
|
|
886
|
+
);
|
|
887
|
+
function ee(i) {
|
|
888
|
+
if (i == null) return;
|
|
889
|
+
if (typeof i == "number") return `${i}px`;
|
|
890
|
+
const o = i.trim();
|
|
891
|
+
return o.length > 0 ? o : void 0;
|
|
892
|
+
}
|
|
893
|
+
const he = c(() => {
|
|
894
|
+
let i = Math.max(
|
|
895
|
+
K.value.length,
|
|
896
|
+
Z.value.length
|
|
821
897
|
);
|
|
822
|
-
return /[AaPp]$/.test(
|
|
823
|
-
}),
|
|
824
|
-
const
|
|
825
|
-
return
|
|
826
|
-
}),
|
|
827
|
-
width: `var(--vtp-input-width, ${
|
|
898
|
+
return /[AaPp]$/.test(K.value) && (i = Math.max(i, K.value.length + 1)), `${Math.min(20, Math.max(6, i))}ch`;
|
|
899
|
+
}), ge = c(() => {
|
|
900
|
+
const i = {}, o = ee(t.componentWidth), f = ee(t.inputWidth), H = ee(t.minInputWidth), L = ee(t.maxInputWidth);
|
|
901
|
+
return o && (i["--vtp-component-width"] = o), f && (i["--vtp-input-width"] = f), H && (i["--vtp-input-min-width"] = H), L && (i["--vtp-input-max-width"] = L), i;
|
|
902
|
+
}), q = c(() => ({
|
|
903
|
+
width: `var(--vtp-input-width, ${he.value})`,
|
|
828
904
|
minWidth: "var(--vtp-input-min-width, 0)",
|
|
829
905
|
maxWidth: "var(--vtp-input-max-width, none)"
|
|
830
|
-
})),
|
|
831
|
-
left: `${(
|
|
906
|
+
})), R = De(K), be = R.inputValue, W = De(K), ne = W.inputValue, a = $(null), l = $(null), g = c(() => ({
|
|
907
|
+
left: `${(t.range && d.value ? l.value : a.value)?.offsetLeft ?? 0}px`
|
|
832
908
|
}));
|
|
833
|
-
|
|
834
|
-
() => [
|
|
835
|
-
([
|
|
836
|
-
if (!
|
|
837
|
-
|
|
909
|
+
F(
|
|
910
|
+
() => [x.value, K.value],
|
|
911
|
+
([i]) => {
|
|
912
|
+
if (!P("first")) {
|
|
913
|
+
R.clear();
|
|
838
914
|
return;
|
|
839
915
|
}
|
|
840
|
-
|
|
916
|
+
R.setFromTime(i);
|
|
841
917
|
},
|
|
842
918
|
{ immediate: !0 }
|
|
843
|
-
),
|
|
844
|
-
() => [
|
|
845
|
-
([
|
|
846
|
-
if (!
|
|
847
|
-
|
|
919
|
+
), F(
|
|
920
|
+
() => [z.value, K.value, t.range],
|
|
921
|
+
([i, , o]) => {
|
|
922
|
+
if (!o || !P("second")) {
|
|
923
|
+
W.clear();
|
|
848
924
|
return;
|
|
849
925
|
}
|
|
850
|
-
|
|
926
|
+
W.setFromTime(i);
|
|
851
927
|
},
|
|
852
928
|
{ immediate: !0 }
|
|
853
929
|
);
|
|
854
|
-
function
|
|
855
|
-
if (
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (L.handleKeydown(e), /^\d$/.test(e.key)) {
|
|
863
|
-
const I = L.getParsedTime();
|
|
864
|
-
I && g("first", I, { emitValidation: !1 });
|
|
930
|
+
function k(i, o, f) {
|
|
931
|
+
if (t.disabled) return !1;
|
|
932
|
+
if (o.key === "Enter")
|
|
933
|
+
return o.preventDefault(), J(i), !1;
|
|
934
|
+
const H = /^\d$/.test(o.key);
|
|
935
|
+
if (H && (y.value = !1, d.value = !1), f.handleKeydown(o), H) {
|
|
936
|
+
const L = f.getParsedTime();
|
|
937
|
+
L && h(i, L, { emitValidation: !1 });
|
|
865
938
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
939
|
+
return H;
|
|
940
|
+
}
|
|
941
|
+
function V(i) {
|
|
942
|
+
const o = i.target, f = R.displayPosToDigitIndex(o.selectionStart ?? 0), H = /^\d$/.test(i.key) && f >= R.totalDigits.value - 1;
|
|
943
|
+
k("first", i, R) && t.range && H && l.value && (J("first"), Ie(() => {
|
|
944
|
+
const le = l.value;
|
|
945
|
+
le && (le.focus(), le.selectionStart = le.selectionEnd = 0);
|
|
869
946
|
}));
|
|
870
947
|
}
|
|
871
|
-
function
|
|
872
|
-
|
|
873
|
-
if (e.key === "Enter") {
|
|
874
|
-
e.preventDefault(), v("second");
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
if (/^\d$/.test(e.key) && (b.value = !1, l.value = !1), $.handleKeydown(e), /^\d$/.test(e.key)) {
|
|
878
|
-
const i = $.getParsedTime();
|
|
879
|
-
i && g("second", i, { emitValidation: !1 });
|
|
880
|
-
}
|
|
881
|
-
}
|
|
948
|
+
function ie(i) {
|
|
949
|
+
k("second", i, W);
|
|
882
950
|
}
|
|
883
|
-
function
|
|
884
|
-
const
|
|
885
|
-
|
|
951
|
+
function J(i) {
|
|
952
|
+
const o = i === "first" ? R : W, f = o.getParsedTime();
|
|
953
|
+
f ? h(i, f, { emitValidation: !0 }) : o.inputValue.value.trim() ? r(i, "invalid", "BAD_TIME") : !t.range && i === "first" && (v("update:modelValue", null), r("first", "valid")), i === "first" ? P("first") ? R.setFromTime(x.value) : R.clear() : t.range && (P("second") ? W.setFromTime(z.value) : W.clear());
|
|
886
954
|
}
|
|
887
|
-
return (
|
|
955
|
+
return (i, o) => (G(), X("div", {
|
|
888
956
|
class: "timepicker-shell",
|
|
889
|
-
"data-size":
|
|
890
|
-
"data-validation":
|
|
891
|
-
"data-disabled":
|
|
892
|
-
style:
|
|
957
|
+
"data-size": t.size,
|
|
958
|
+
"data-validation": S.value,
|
|
959
|
+
"data-disabled": t.disabled ? "true" : "false",
|
|
960
|
+
style: de(ge.value)
|
|
893
961
|
}, [
|
|
894
|
-
|
|
895
|
-
class:
|
|
962
|
+
ae("div", {
|
|
963
|
+
class: oe(["timepicker-shell__input", {
|
|
896
964
|
"timepicker-shell__input--error": s.value,
|
|
897
|
-
"timepicker-shell__input--disabled":
|
|
965
|
+
"timepicker-shell__input--disabled": t.disabled
|
|
898
966
|
}])
|
|
899
967
|
}, [
|
|
900
|
-
|
|
968
|
+
ae("input", {
|
|
901
969
|
ref_key: "firstInputRef",
|
|
902
|
-
ref:
|
|
970
|
+
ref: a,
|
|
903
971
|
type: "text",
|
|
904
|
-
class: "timepicker-field",
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
972
|
+
class: oe(["timepicker-field", t.inputClass]),
|
|
973
|
+
id: re.value,
|
|
974
|
+
name: ue.value,
|
|
975
|
+
tabindex: t.tabindex,
|
|
976
|
+
autocomplete: t.autocomplete,
|
|
977
|
+
value: O(be),
|
|
978
|
+
placeholder: Z.value,
|
|
979
|
+
style: de(q.value),
|
|
980
|
+
disabled: t.disabled,
|
|
981
|
+
onFocus: o[0] || (o[0] = (f) => !t.disabled && !t.hideDropdown && (y.value = !0)),
|
|
982
|
+
onKeydown: V,
|
|
983
|
+
onInput: o[1] || (o[1] = //@ts-ignore
|
|
984
|
+
(...f) => O(R).handleInput && O(R).handleInput(...f)),
|
|
985
|
+
onPaste: o[2] || (o[2] = //@ts-ignore
|
|
986
|
+
(...f) => O(R).handlePaste && O(R).handlePaste(...f)),
|
|
987
|
+
onBlur: o[3] || (o[3] = (f) => !t.disabled && J("first"))
|
|
988
|
+
}, null, 46, je),
|
|
989
|
+
t.range ? (G(), X(Ee, { key: 0 }, [
|
|
990
|
+
o[12] || (o[12] = ae("span", { class: "timepicker-separator" }, "–", -1)),
|
|
991
|
+
ae("input", {
|
|
920
992
|
ref_key: "secondInputRef",
|
|
921
|
-
ref:
|
|
993
|
+
ref: l,
|
|
922
994
|
type: "text",
|
|
923
|
-
class: "timepicker-field",
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
995
|
+
class: oe(["timepicker-field", t.inputClass]),
|
|
996
|
+
id: se.value,
|
|
997
|
+
name: ve.value,
|
|
998
|
+
tabindex: t.tabindex,
|
|
999
|
+
autocomplete: t.autocomplete,
|
|
1000
|
+
value: O(ne),
|
|
1001
|
+
placeholder: Z.value,
|
|
1002
|
+
style: de(q.value),
|
|
1003
|
+
disabled: t.disabled,
|
|
1004
|
+
onFocus: o[4] || (o[4] = (f) => !t.disabled && !t.hideDropdown && (d.value = !0)),
|
|
1005
|
+
onKeydown: ie,
|
|
1006
|
+
onInput: o[5] || (o[5] = //@ts-ignore
|
|
1007
|
+
(...f) => O(W).handleInput && O(W).handleInput(...f)),
|
|
1008
|
+
onPaste: o[6] || (o[6] = //@ts-ignore
|
|
1009
|
+
(...f) => O(W).handlePaste && O(W).handlePaste(...f)),
|
|
1010
|
+
onBlur: o[7] || (o[7] = (f) => !t.disabled && J("second"))
|
|
1011
|
+
}, null, 46, qe)
|
|
936
1012
|
], 64)) : te("", !0)
|
|
937
1013
|
], 2),
|
|
938
|
-
X("div", {
|
|
1014
|
+
t.hideDropdown ? te("", !0) : (G(), X("div", {
|
|
1015
|
+
key: 0,
|
|
939
1016
|
class: "timepicker-popovers",
|
|
940
|
-
style:
|
|
1017
|
+
style: de(g.value)
|
|
941
1018
|
}, [
|
|
942
|
-
|
|
943
|
-
open:
|
|
944
|
-
"onUpdate:open":
|
|
945
|
-
initTime:
|
|
946
|
-
"onUpdate:initTime":
|
|
947
|
-
format:
|
|
948
|
-
"hour-step":
|
|
949
|
-
"minute-step":
|
|
950
|
-
"second-step":
|
|
1019
|
+
Te(we, {
|
|
1020
|
+
open: y.value,
|
|
1021
|
+
"onUpdate:open": o[8] || (o[8] = (f) => y.value = f),
|
|
1022
|
+
initTime: x.value,
|
|
1023
|
+
"onUpdate:initTime": o[9] || (o[9] = (f) => x.value = f),
|
|
1024
|
+
format: t.format,
|
|
1025
|
+
"hour-step": t.hourStep,
|
|
1026
|
+
"minute-step": t.minuteStep,
|
|
1027
|
+
"second-step": t.secondStep,
|
|
951
1028
|
"min-time": u.value,
|
|
952
|
-
"max-time":
|
|
953
|
-
"disabled-ranges":
|
|
954
|
-
"is-time-disabled":
|
|
1029
|
+
"max-time": m.value,
|
|
1030
|
+
"disabled-ranges": A.value,
|
|
1031
|
+
"is-time-disabled": t.isTimeDisabled
|
|
955
1032
|
}, null, 8, ["open", "initTime", "format", "hour-step", "minute-step", "second-step", "min-time", "max-time", "disabled-ranges", "is-time-disabled"]),
|
|
956
|
-
|
|
1033
|
+
t.range ? (G(), Se(we, {
|
|
957
1034
|
key: 0,
|
|
958
|
-
open:
|
|
959
|
-
"onUpdate:open":
|
|
960
|
-
initTime:
|
|
961
|
-
"onUpdate:initTime":
|
|
962
|
-
format:
|
|
963
|
-
"hour-step":
|
|
964
|
-
"minute-step":
|
|
965
|
-
"second-step":
|
|
1035
|
+
open: d.value,
|
|
1036
|
+
"onUpdate:open": o[10] || (o[10] = (f) => d.value = f),
|
|
1037
|
+
initTime: z.value,
|
|
1038
|
+
"onUpdate:initTime": o[11] || (o[11] = (f) => z.value = f),
|
|
1039
|
+
format: t.format,
|
|
1040
|
+
"hour-step": t.hourStep,
|
|
1041
|
+
"minute-step": t.minuteStep,
|
|
1042
|
+
"second-step": t.secondStep,
|
|
966
1043
|
"min-time": u.value,
|
|
967
|
-
"max-time":
|
|
968
|
-
"disabled-ranges":
|
|
969
|
-
"is-time-disabled":
|
|
1044
|
+
"max-time": m.value,
|
|
1045
|
+
"disabled-ranges": A.value,
|
|
1046
|
+
"is-time-disabled": t.isTimeDisabled
|
|
970
1047
|
}, null, 8, ["open", "initTime", "format", "hour-step", "minute-step", "second-step", "min-time", "max-time", "disabled-ranges", "is-time-disabled"])) : te("", !0)
|
|
971
|
-
], 4)
|
|
972
|
-
], 12,
|
|
1048
|
+
], 4))
|
|
1049
|
+
], 12, ze));
|
|
973
1050
|
}
|
|
974
1051
|
});
|
|
975
1052
|
export {
|
|
976
|
-
|
|
1053
|
+
Ye as TimePicker
|
|
977
1054
|
};
|