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