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