vue3-time-duration 0.4.0 → 0.4.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.icon-x-mark[data-v-7f1f4e49]{display:flex}.ui-widget-time[data-v-
|
|
1
|
+
.icon-x-mark[data-v-7f1f4e49]{display:flex}.ui-widget-time[data-v-38fa3aae]{position:relative}.ui-widget-time__w[data-v-38fa3aae]{display:flex;align-items:center;justify-content:space-between;border:1px solid var(--color-border);border-radius:12px;padding:8px 8px 8px 2px;background-color:var(--bg-element);height:24px}.ui-widget-time__w_error[data-v-38fa3aae]{border:1px solid var(--color-border-error);background-color:var(--bg-element-error)}.ui-widget-time__w-input[data-v-38fa3aae]{background-color:var(--bg-element);border:1px solid var(--bg-element);color:var(--color-font);font-size:var(--size-font);margin-left:3px;width:100%}.ui-widget-time__w-input_error[data-v-38fa3aae]{background-color:var(--bg-element-error);border:1px solid var(--bg-element-error)}.ui-widget-time__w-input[data-v-38fa3aae]:focus{outline:0 solid transparent}.ui-widget-time__w-icon[data-v-38fa3aae]{cursor:pointer}.ui-widget-time__dropdown[data-v-38fa3aae]{position:absolute;left:0;right:0;max-height:150px;margin:4px;padding:6px;background:var(--bg-element);z-index:1;border:1px solid var(--bg-element);border-radius:6px;box-shadow:0 0 8px 4px #0000000a;overflow-y:auto}.ui-widget-time__dropdown-item[data-v-38fa3aae]{padding:6px 4px;cursor:pointer;font-size:var(--size-font);color:var(--color-font)}.ui-widget-time__dropdown-item_selected[data-v-38fa3aae]{background:var(--bg-selected);border-radius:6px}body{margin:0;padding:0;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.vue3-time-duration{--bg-element: var(--v-bg-element);--bg-selected: var(--v-bg-selected);--color-border: var(--v-color-border);--bg-element-error: #ffe9e9;--color-border-error: rgb(236, 157, 157);--color-font: var(--v-neutral-n900-color);--size-font: 14px}.vue3-time-duration__t{display:flex;align-items:center}.vue3-time-duration__t-mdash{font-size:12px}.vue3-time-duration__t-left{margin-right:6px}.vue3-time-duration__t-right{margin-left:6px}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
for (const [
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
function
|
|
9
|
-
return
|
|
10
|
-
|
|
1
|
+
import { openBlock as S, createElementBlock as I, createStaticVNode as Y, defineComponent as R, ref as u, computed as L, watch as H, onMounted as U, onUnmounted as X, createElementVNode as B, normalizeClass as z, withDirectives as P, vModelText as Z, createVNode as V, Fragment as j, renderList as q, toDisplayString as $, createCommentVNode as W, normalizeStyle as G, vShow as J } from "vue";
|
|
2
|
+
const A = (w, f) => {
|
|
3
|
+
const t = w.__vccOpts || w;
|
|
4
|
+
for (const [C, v] of f)
|
|
5
|
+
t[C] = v;
|
|
6
|
+
return t;
|
|
7
|
+
}, K = {}, Q = { class: "icon-x-mark" };
|
|
8
|
+
function ee(w, f) {
|
|
9
|
+
return S(), I("div", Q, f[0] || (f[0] = [
|
|
10
|
+
Y('<svg width="20.000000" height="20.000000" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-v-7f1f4e49><desc data-v-7f1f4e49>Created with Pixso.</desc><defs data-v-7f1f4e49><clipPath id="clip131_5974" data-v-7f1f4e49><rect id="user-time" width="20.000000" height="20.000000" fill="white" fill-opacity="0" data-v-7f1f4e49></rect></clipPath></defs><g clip-path="url(#clip131_5974)" data-v-7f1f4e49><path id="path (Border)" d="M3.72 3.72C3.47 3.97 3.47 4.36 3.72 4.6L9.11 10L3.72 15.39C3.47 15.63 3.47 16.02 3.72 16.27C3.97 16.52 4.36 16.52 4.6 16.27L10 10.88L15.39 16.27C15.63 16.52 16.02 16.52 16.27 16.27C16.52 16.02 16.52 15.63 16.27 15.39L10.88 10L16.27 4.6C16.39 4.48 16.45 4.33 16.45 4.16C16.45 3.99 16.39 3.84 16.27 3.72C16.15 3.6 16 3.54 15.83 3.54C15.66 3.54 15.51 3.6 15.39 3.72L10 9.11L4.6 3.72C4.36 3.47 3.97 3.47 3.72 3.72Z" fill="#77797C" fill-opacity="1.000000" fill-rule="evenodd" data-v-7f1f4e49></path></g></svg>', 1)
|
|
11
11
|
]));
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const te = /* @__PURE__ */ A(K, [["render", ee], ["__scopeId", "data-v-7f1f4e49"]]), ie = { class: "ui-widget-time" }, le = ["readonly"], oe = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "ui-widget-time__dropdown"
|
|
16
|
-
},
|
|
16
|
+
}, ne = ["onClick"], se = /* @__PURE__ */ R({
|
|
17
17
|
__name: "UiWidgetTime",
|
|
18
18
|
props: {
|
|
19
19
|
timeListId: { type: Number, default: 0 },
|
|
@@ -22,103 +22,104 @@ const ee = /* @__PURE__ */ W(J, [["render", Q], ["__scopeId", "data-v-7f1f4e49"]
|
|
|
22
22
|
isMobile: { type: Boolean, default: !1 }
|
|
23
23
|
},
|
|
24
24
|
emits: ["selectedId"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
25
|
+
setup(w, { emit: f }) {
|
|
26
|
+
const t = w, C = f, v = u([]), r = u(!1), l = u(0), d = u(void 0), y = u(), p = u(!1), T = u(), x = u(0), k = u(0), _ = u(!1);
|
|
27
27
|
u(null);
|
|
28
|
-
const
|
|
28
|
+
const b = L(() => v.value.length > 0 ? v.value : t.timeList), M = L(() => t.timeListId), h = L({
|
|
29
29
|
get() {
|
|
30
|
-
var
|
|
31
|
-
return d.value === void 0 ? (
|
|
30
|
+
var i;
|
|
31
|
+
return d.value === void 0 ? (i = t.timeList.find((s) => s.id === M.value)) == null ? void 0 : i.time : d.value;
|
|
32
32
|
},
|
|
33
|
-
set(
|
|
34
|
-
d.value =
|
|
33
|
+
set(i) {
|
|
34
|
+
d.value = i;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
37
|
+
H(M, (i) => {
|
|
38
|
+
var s;
|
|
39
|
+
l.value = i, h.value = (s = t.timeList.find((a) => a.id === i)) == null ? void 0 : s.time;
|
|
40
40
|
});
|
|
41
|
-
const
|
|
42
|
-
_.value || (
|
|
41
|
+
const g = () => {
|
|
42
|
+
_.value || (k.value = window.scrollY, _.value = !0, document.body.style.position = "fixed", document.body.style.top = `-${k.value}px`, document.body.style.width = "100%", document.body.style.overflow = "hidden");
|
|
43
|
+
}, e = () => {
|
|
44
|
+
_.value && (document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", document.body.style.overflow = "", window.scrollTo(0, k.value), _.value = !1);
|
|
45
|
+
}, o = (i) => {
|
|
46
|
+
var s;
|
|
47
|
+
l.value = i, h.value = (s = b.value.find((a) => a.id === l.value)) == null ? void 0 : s.time, r.value = !1, C("selectedId", l.value);
|
|
43
48
|
}, n = () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, c = () => {
|
|
49
|
-
s.value = !0, e(), setTimeout(() => {
|
|
50
|
-
var l;
|
|
51
|
-
const t = B.value;
|
|
52
|
-
t !== null && (x.value = g.value.findIndex((a) => Number(a.id) === i.value), (l = t[x.value]) == null || l.scrollIntoView());
|
|
49
|
+
r.value = !0, g(), setTimeout(() => {
|
|
50
|
+
var s;
|
|
51
|
+
const i = T.value;
|
|
52
|
+
i !== null && (x.value = b.value.findIndex((a) => Number(a.id) === l.value), (s = i[x.value]) == null || s.scrollIntoView());
|
|
53
53
|
}, 250);
|
|
54
|
-
},
|
|
54
|
+
}, c = () => {
|
|
55
55
|
setTimeout(() => {
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
}, 200),
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
v.value =
|
|
63
|
-
}, D = (
|
|
56
|
+
var i, s;
|
|
57
|
+
p.value || (h.value = (i = b.value.find((a) => a.id === l.value)) == null ? void 0 : i.time, C("selectedId", (s = b.value.find((a) => a.id === l.value)) == null ? void 0 : s.id), r.value = !1, e());
|
|
58
|
+
}, 200), p.value = !1;
|
|
59
|
+
}, m = () => {
|
|
60
|
+
l.value = 0, v.value = [], h.value = "", y.value.focus(), p.value = !0, r.value = !0, g(), n();
|
|
61
|
+
}, N = () => {
|
|
62
|
+
v.value = t.timeList.filter((i) => i.time.startsWith(d.value));
|
|
63
|
+
}, D = (i) => {
|
|
64
64
|
if (!_.value) return;
|
|
65
|
-
const
|
|
65
|
+
const s = i.target, a = s == null ? void 0 : s.closest(".ui-widget-time__dropdown");
|
|
66
66
|
if (a) {
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
67
|
+
const E = a;
|
|
68
|
+
if (E.scrollHeight > E.clientHeight)
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
i.preventDefault();
|
|
72
72
|
};
|
|
73
|
-
return
|
|
73
|
+
return U(() => {
|
|
74
74
|
document.addEventListener("wheel", D, { passive: !1 }), document.addEventListener("touchmove", D, { passive: !1 });
|
|
75
75
|
}), X(() => {
|
|
76
|
-
|
|
77
|
-
}), (
|
|
78
|
-
|
|
79
|
-
class:
|
|
76
|
+
e(), document.removeEventListener("wheel", D), document.removeEventListener("touchmove", D);
|
|
77
|
+
}), (i, s) => (S(), I("div", ie, [
|
|
78
|
+
B("div", {
|
|
79
|
+
class: z({ "ui-widget-time__w": !0, "ui-widget-time__w_error": t.isError })
|
|
80
80
|
}, [
|
|
81
|
-
|
|
81
|
+
P(B("input", {
|
|
82
82
|
ref_key: "inputRef",
|
|
83
|
-
ref:
|
|
84
|
-
"onUpdate:modelValue":
|
|
83
|
+
ref: y,
|
|
84
|
+
"onUpdate:modelValue": s[0] || (s[0] = (a) => h.value = a),
|
|
85
85
|
type: "text",
|
|
86
|
-
class:
|
|
87
|
-
onClick:
|
|
88
|
-
onFocus:
|
|
89
|
-
onFocusout:
|
|
90
|
-
onInput:
|
|
91
|
-
readonly:
|
|
92
|
-
}, null, 42,
|
|
93
|
-
[Z,
|
|
86
|
+
class: z({ "ui-widget-time__w-input": !0, "ui-widget-time__w-input_error": t.isError }),
|
|
87
|
+
onClick: n,
|
|
88
|
+
onFocus: g,
|
|
89
|
+
onFocusout: c,
|
|
90
|
+
onInput: N,
|
|
91
|
+
readonly: t.isMobile
|
|
92
|
+
}, null, 42, le), [
|
|
93
|
+
[Z, h.value]
|
|
94
94
|
]),
|
|
95
|
-
|
|
95
|
+
V(te, {
|
|
96
96
|
class: "ui-widget-time__w-icon",
|
|
97
|
-
onClick:
|
|
97
|
+
onClick: m
|
|
98
98
|
})
|
|
99
99
|
], 2),
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
|
|
100
|
+
r.value ? (S(), I("div", oe, [
|
|
101
|
+
(S(!0), I(j, null, q(b.value, (a, E) => (S(), I("div", { key: E }, [
|
|
102
|
+
B("div", {
|
|
103
103
|
ref_for: !0,
|
|
104
104
|
ref_key: "refItemList",
|
|
105
|
-
ref:
|
|
106
|
-
class:
|
|
105
|
+
ref: T,
|
|
106
|
+
class: z({
|
|
107
107
|
"ui-widget-time__dropdown-item": !0,
|
|
108
|
-
"ui-widget-time__dropdown-item_selected": x.value ===
|
|
108
|
+
"ui-widget-time__dropdown-item_selected": x.value === E
|
|
109
109
|
}),
|
|
110
|
-
onClick: (
|
|
111
|
-
},
|
|
110
|
+
onClick: (O) => o(a.id)
|
|
111
|
+
}, $(a.time), 11, ne)
|
|
112
112
|
]))), 128))
|
|
113
|
-
])) :
|
|
113
|
+
])) : W("", !0)
|
|
114
114
|
]));
|
|
115
115
|
}
|
|
116
|
-
}),
|
|
116
|
+
}), F = /* @__PURE__ */ A(se, [["__scopeId", "data-v-38fa3aae"]]), re = { class: "vue3-time-duration__t" }, ae = {
|
|
117
117
|
key: 0,
|
|
118
118
|
class: "vue3-time-duration__t-mdash"
|
|
119
|
-
},
|
|
119
|
+
}, de = /* @__PURE__ */ R({
|
|
120
120
|
__name: "App",
|
|
121
121
|
props: {
|
|
122
|
+
pTheme: { default: () => "izziBot" },
|
|
122
123
|
initStart: { default: () => "00:00" },
|
|
123
124
|
initEnd: { default: () => "00:05" },
|
|
124
125
|
isDash: { type: Boolean, default: () => !1 },
|
|
@@ -126,62 +127,90 @@ const ee = /* @__PURE__ */ W(J, [["render", Q], ["__scopeId", "data-v-7f1f4e49"]
|
|
|
126
127
|
isMobile: { type: Boolean, default: () => !1 }
|
|
127
128
|
},
|
|
128
129
|
emits: ["duration"],
|
|
129
|
-
setup(
|
|
130
|
-
const
|
|
130
|
+
setup(w, { emit: f }) {
|
|
131
|
+
const t = w, C = f, v = u(0), r = u([]), l = u(), d = u(), y = u(), p = u(), T = L(() => {
|
|
131
132
|
var e;
|
|
132
|
-
return
|
|
133
|
-
}), x =
|
|
133
|
+
return l.value = _(t.initStart), y.value = (e = r.value.find((o) => o.id === l.value)) == null ? void 0 : e.time, t.initStart;
|
|
134
|
+
}), x = L(() => {
|
|
134
135
|
var e;
|
|
135
|
-
return d.value = _(
|
|
136
|
+
return d.value = _(t.initEnd), p.value = (e = r.value.find((o) => o.id === d.value)) == null ? void 0 : e.time, t.initEnd;
|
|
136
137
|
});
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
U(() => {
|
|
139
|
+
b(), v.value = r.value.length - 1;
|
|
139
140
|
});
|
|
140
|
-
const
|
|
141
|
-
() => ({ start:
|
|
141
|
+
const k = L(
|
|
142
|
+
() => ({ start: y.value, end: p.value })
|
|
142
143
|
);
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
H(k, (e) => {
|
|
145
|
+
C("duration", { start: e.start, end: e.end });
|
|
145
146
|
});
|
|
146
147
|
const _ = (e) => {
|
|
147
|
-
var
|
|
148
|
-
return (
|
|
149
|
-
},
|
|
150
|
-
let e = -1,
|
|
151
|
-
for (let
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
var
|
|
158
|
-
d.value = e,
|
|
148
|
+
var o;
|
|
149
|
+
return (o = r.value.find((n) => n.time === e)) == null ? void 0 : o.id;
|
|
150
|
+
}, b = () => {
|
|
151
|
+
let e = -1, o = "", n = 0, c = "";
|
|
152
|
+
for (let m = 0; m < 288; m++)
|
|
153
|
+
n >= 60 && (n = 0), m % 12 === 0 && (e += 1), o = e.toString().length === 1 ? "0" + e.toString() : e.toString(), c = n.toString().length === 1 ? "0" + n.toString() : n.toString(), r.value.push({ id: m, time: o + ":" + c }), n += 5;
|
|
154
|
+
}, M = (e) => {
|
|
155
|
+
var o, n;
|
|
156
|
+
l.value = e, d.value = e >= d.value ? e + 1 : d.value, d.value > v.value && (d.value = 0), y.value = (o = r.value.find((c) => c.id === l.value)) == null ? void 0 : o.time, p.value = (n = r.value.find((c) => c.id === d.value)) == null ? void 0 : n.time;
|
|
157
|
+
}, h = (e) => {
|
|
158
|
+
var o, n;
|
|
159
|
+
d.value = e, l.value = e <= l.value ? e - 1 : l.value, l.value < 0 && (l.value = v.value), y.value = (o = r.value.find((c) => c.id === l.value)) == null ? void 0 : o.time, p.value = (n = r.value.find((c) => c.id === d.value)) == null ? void 0 : n.time;
|
|
160
|
+
}, g = L(() => {
|
|
161
|
+
const e = {
|
|
162
|
+
default: {
|
|
163
|
+
bgElement: "#ffffff",
|
|
164
|
+
neutralN900Color: "rgb(49, 49, 50)",
|
|
165
|
+
bgSelected: "#f3f3f3",
|
|
166
|
+
colorBorder: "rgb(223, 230, 238)"
|
|
167
|
+
},
|
|
168
|
+
izziBot: {
|
|
169
|
+
bgElement: "rgba(17, 17, 17, 1)",
|
|
170
|
+
neutralN900Color: "#ffffff",
|
|
171
|
+
bgSelected: "rgba(36, 36, 36, 1)",
|
|
172
|
+
colorBorder: "rgba(17, 17, 17, 1)"
|
|
173
|
+
}
|
|
174
|
+
}, o = t.pTheme;
|
|
175
|
+
return e[o];
|
|
176
|
+
});
|
|
177
|
+
return (e, o) => {
|
|
178
|
+
var n, c, m, N;
|
|
179
|
+
return S(), I("div", {
|
|
180
|
+
class: "vue3-time-duration",
|
|
181
|
+
style: G({
|
|
182
|
+
"--v-bg-element": (n = g.value) == null ? void 0 : n.bgElement,
|
|
183
|
+
"--v-neutral-n900-color": (c = g.value) == null ? void 0 : c.neutralN900Color,
|
|
184
|
+
"--v-bg-selected": (m = g.value) == null ? void 0 : m.bgSelected,
|
|
185
|
+
"--v-color-border": (N = g.value) == null ? void 0 : N.colorBorder
|
|
186
|
+
})
|
|
187
|
+
}, [
|
|
188
|
+
P(B("div", null, $(k.value) + " " + $(T.value) + " " + $(x.value), 513), [
|
|
189
|
+
[J, !1]
|
|
190
|
+
]),
|
|
191
|
+
B("div", re, [
|
|
192
|
+
V(F, {
|
|
193
|
+
class: "vue3-time-duration__t-left",
|
|
194
|
+
"time-list": r.value,
|
|
195
|
+
"time-list-id": l.value,
|
|
196
|
+
"is-error": t.isError,
|
|
197
|
+
"is-mobile": t.isMobile,
|
|
198
|
+
onSelectedId: M
|
|
199
|
+
}, null, 8, ["time-list", "time-list-id", "is-error", "is-mobile"]),
|
|
200
|
+
e.isDash ? (S(), I("div", ae, "—")) : W("", !0),
|
|
201
|
+
V(F, {
|
|
202
|
+
class: "vue3-time-duration__t-right",
|
|
203
|
+
"time-list": r.value,
|
|
204
|
+
"time-list-id": d.value,
|
|
205
|
+
"is-error": t.isError,
|
|
206
|
+
"is-mobile": t.isMobile,
|
|
207
|
+
onSelectedId: h
|
|
208
|
+
}, null, 8, ["time-list", "time-list-id", "is-error", "is-mobile"])
|
|
209
|
+
])
|
|
210
|
+
], 4);
|
|
159
211
|
};
|
|
160
|
-
return (e, n) => (y(), I("div", se, [
|
|
161
|
-
U(E("div", null, M(S.value) + " " + M(B.value) + " " + M(x.value), 513), [
|
|
162
|
-
[G, !1]
|
|
163
|
-
]),
|
|
164
|
-
E("div", ae, [
|
|
165
|
-
N(V, {
|
|
166
|
-
class: "vue3-time-duration__t-left",
|
|
167
|
-
"time-list": s.value,
|
|
168
|
-
"time-list-id": i.value,
|
|
169
|
-
"is-error": o.isError,
|
|
170
|
-
"is-mobile": o.isMobile,
|
|
171
|
-
onSelectedId: T
|
|
172
|
-
}, null, 8, ["time-list", "time-list-id", "is-error", "is-mobile"]),
|
|
173
|
-
e.isDash ? (y(), I("div", ue, "—")) : P("", !0),
|
|
174
|
-
N(V, {
|
|
175
|
-
class: "vue3-time-duration__t-right",
|
|
176
|
-
"time-list": s.value,
|
|
177
|
-
"time-list-id": d.value,
|
|
178
|
-
"is-error": o.isError,
|
|
179
|
-
onSelectedId: p
|
|
180
|
-
}, null, 8, ["time-list", "time-list-id", "is-error"])
|
|
181
|
-
])
|
|
182
|
-
]));
|
|
183
212
|
}
|
|
184
213
|
});
|
|
185
214
|
export {
|
|
186
|
-
|
|
215
|
+
de as default
|
|
187
216
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,S){typeof exports=="object"&&typeof module<"u"?module.exports=S(require("vue")):typeof define=="function"&&define.amd?define(["vue"],S):(e=typeof globalThis<"u"?globalThis:e||self,e["vue3-time-duration"]=S(e.Vue))})(this,function(e){"use strict";const S=(w,p)=>{const i=w.__vccOpts||w;for(const[k,f]of p)i[k]=f;return i},V={},D={class:"icon-x-mark"};function M(w,p){return e.openBlock(),e.createElementBlock("div",D,p[0]||(p[0]=[e.createStaticVNode('<svg width="20.000000" height="20.000000" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-v-7f1f4e49><desc data-v-7f1f4e49>Created with Pixso.</desc><defs data-v-7f1f4e49><clipPath id="clip131_5974" data-v-7f1f4e49><rect id="user-time" width="20.000000" height="20.000000" fill="white" fill-opacity="0" data-v-7f1f4e49></rect></clipPath></defs><g clip-path="url(#clip131_5974)" data-v-7f1f4e49><path id="path (Border)" d="M3.72 3.72C3.47 3.97 3.47 4.36 3.72 4.6L9.11 10L3.72 15.39C3.47 15.63 3.47 16.02 3.72 16.27C3.97 16.52 4.36 16.52 4.6 16.27L10 10.88L15.39 16.27C15.63 16.52 16.02 16.52 16.27 16.27C16.52 16.02 16.52 15.63 16.27 15.39L10.88 10L16.27 4.6C16.39 4.48 16.45 4.33 16.45 4.16C16.45 3.99 16.39 3.84 16.27 3.72C16.15 3.6 16 3.54 15.83 3.54C15.66 3.54 15.51 3.6 15.39 3.72L10 9.11L4.6 3.72C4.36 3.47 3.97 3.47 3.72 3.72Z" fill="#77797C" fill-opacity="1.000000" fill-rule="evenodd" data-v-7f1f4e49></path></g></svg>',1)]))}const z=S(V,[["render",M],["__scopeId","data-v-7f1f4e49"]]),$={class:"ui-widget-time"},F=["readonly"],R={key:0,class:"ui-widget-time__dropdown"},H=["onClick"],T=S(e.defineComponent({__name:"UiWidgetTime",props:{timeListId:{type:Number,default:0},timeList:{type:Array,default:[]},isError:{type:Boolean,default:!1},isMobile:{type:Boolean,default:!1}},emits:["selectedId"],setup(w,{emit:p}){const i=w,k=p,f=e.ref([]),a=e.ref(!1),o=e.ref(0),c=e.ref(void 0),y=e.ref(),v=e.ref(!1),L=e.ref(),B=e.ref(0),E=e.ref(0),_=e.ref(!1);e.ref(null);const b=e.computed(()=>f.value.length>0?f.value:i.timeList),C=e.computed(()=>i.timeListId),h=e.computed({get(){var l;return c.value===void 0?(l=i.timeList.find(s=>s.id===C.value))==null?void 0:l.time:c.value},set(l){c.value=l}});e.watch(C,l=>{var s;o.value=l,h.value=(s=i.timeList.find(d=>d.id===l))==null?void 0:s.time});const g=()=>{_.value||(E.value=window.scrollY,_.value=!0,document.body.style.position="fixed",document.body.style.top=`-${E.value}px`,document.body.style.width="100%",document.body.style.overflow="hidden")},t=()=>{_.value&&(document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,E.value),_.value=!1)},n=l=>{var s;o.value=l,h.value=(s=b.value.find(d=>d.id===o.value))==null?void 0:s.time,a.value=!1,k("selectedId",o.value)},r=()=>{a.value=!0,g(),setTimeout(()=>{var s;const l=L.value;l!==null&&(B.value=b.value.findIndex(d=>Number(d.id)===o.value),(s=l[B.value])==null||s.scrollIntoView())},250)},u=()=>{setTimeout(()=>{var l,s;v.value||(h.value=(l=b.value.find(d=>d.id===o.value))==null?void 0:l.time,k("selectedId",(s=b.value.find(d=>d.id===o.value))==null?void 0:s.id),a.value=!1,t())},200),v.value=!1},m=()=>{o.value=0,f.value=[],h.value="",y.value.focus(),v.value=!0,a.value=!0,g(),r()},x=()=>{f.value=i.timeList.filter(l=>l.time.startsWith(c.value))},N=l=>{if(!_.value)return;const s=l.target,d=s==null?void 0:s.closest(".ui-widget-time__dropdown");if(d){const I=d;if(I.scrollHeight>I.clientHeight)return}l.preventDefault()};return e.onMounted(()=>{document.addEventListener("wheel",N,{passive:!1}),document.addEventListener("touchmove",N,{passive:!1})}),e.onUnmounted(()=>{t(),document.removeEventListener("wheel",N),document.removeEventListener("touchmove",N)}),(l,s)=>(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("div",{class:e.normalizeClass({"ui-widget-time__w":!0,"ui-widget-time__w_error":i.isError})},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:y,"onUpdate:modelValue":s[0]||(s[0]=d=>h.value=d),type:"text",class:e.normalizeClass({"ui-widget-time__w-input":!0,"ui-widget-time__w-input_error":i.isError}),onClick:r,onFocus:g,onFocusout:u,onInput:x,readonly:i.isMobile},null,42,F),[[e.vModelText,h.value]]),e.createVNode(z,{class:"ui-widget-time__w-icon",onClick:m})],2),a.value?(e.openBlock(),e.createElementBlock("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(d,I)=>(e.openBlock(),e.createElementBlock("div",{key:I},[e.createElementVNode("div",{ref_for:!0,ref_key:"refItemList",ref:L,class:e.normalizeClass({"ui-widget-time__dropdown-item":!0,"ui-widget-time__dropdown-item_selected":B.value===I}),onClick:W=>n(d.id)},e.toDisplayString(d.time),11,H)]))),128))])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-38fa3aae"]]),U={class:"vue3-time-duration__t"},P={key:0,class:"vue3-time-duration__t-mdash"};return e.defineComponent({__name:"App",props:{pTheme:{default:()=>"izziBot"},initStart:{default:()=>"00:00"},initEnd:{default:()=>"00:05"},isDash:{type:Boolean,default:()=>!1},isError:{type:Boolean,default:()=>!1},isMobile:{type:Boolean,default:()=>!1}},emits:["duration"],setup(w,{emit:p}){const i=w,k=p,f=e.ref(0),a=e.ref([]),o=e.ref(),c=e.ref(),y=e.ref(),v=e.ref(),L=e.computed(()=>{var t;return o.value=_(i.initStart),y.value=(t=a.value.find(n=>n.id===o.value))==null?void 0:t.time,i.initStart}),B=e.computed(()=>{var t;return c.value=_(i.initEnd),v.value=(t=a.value.find(n=>n.id===c.value))==null?void 0:t.time,i.initEnd});e.onMounted(()=>{b(),f.value=a.value.length-1});const E=e.computed(()=>({start:y.value,end:v.value}));e.watch(E,t=>{k("duration",{start:t.start,end:t.end})});const _=t=>{var n;return(n=a.value.find(r=>r.time===t))==null?void 0:n.id},b=()=>{let t=-1,n="",r=0,u="";for(let m=0;m<288;m++)r>=60&&(r=0),m%12===0&&(t+=1),n=t.toString().length===1?"0"+t.toString():t.toString(),u=r.toString().length===1?"0"+r.toString():r.toString(),a.value.push({id:m,time:n+":"+u}),r+=5},C=t=>{var n,r;o.value=t,c.value=t>=c.value?t+1:c.value,c.value>f.value&&(c.value=0),y.value=(n=a.value.find(u=>u.id===o.value))==null?void 0:n.time,v.value=(r=a.value.find(u=>u.id===c.value))==null?void 0:r.time},h=t=>{var n,r;c.value=t,o.value=t<=o.value?t-1:o.value,o.value<0&&(o.value=f.value),y.value=(n=a.value.find(u=>u.id===o.value))==null?void 0:n.time,v.value=(r=a.value.find(u=>u.id===c.value))==null?void 0:r.time},g=e.computed(()=>{const t={default:{bgElement:"#ffffff",neutralN900Color:"rgb(49, 49, 50)",bgSelected:"#f3f3f3",colorBorder:"rgb(223, 230, 238)"},izziBot:{bgElement:"rgba(17, 17, 17, 1)",neutralN900Color:"#ffffff",bgSelected:"rgba(36, 36, 36, 1)",colorBorder:"rgba(17, 17, 17, 1)"}},n=i.pTheme;return t[n]});return(t,n)=>{var r,u,m,x;return e.openBlock(),e.createElementBlock("div",{class:"vue3-time-duration",style:e.normalizeStyle({"--v-bg-element":(r=g.value)==null?void 0:r.bgElement,"--v-neutral-n900-color":(u=g.value)==null?void 0:u.neutralN900Color,"--v-bg-selected":(m=g.value)==null?void 0:m.bgSelected,"--v-color-border":(x=g.value)==null?void 0:x.colorBorder})},[e.withDirectives(e.createElementVNode("div",null,e.toDisplayString(E.value)+" "+e.toDisplayString(L.value)+" "+e.toDisplayString(B.value),513),[[e.vShow,!1]]),e.createElementVNode("div",U,[e.createVNode(T,{class:"vue3-time-duration__t-left","time-list":a.value,"time-list-id":o.value,"is-error":i.isError,"is-mobile":i.isMobile,onSelectedId:C},null,8,["time-list","time-list-id","is-error","is-mobile"]),t.isDash?(e.openBlock(),e.createElementBlock("div",P,"—")):e.createCommentVNode("",!0),e.createVNode(T,{class:"vue3-time-duration__t-right","time-list":a.value,"time-list-id":c.value,"is-error":i.isError,"is-mobile":i.isMobile,onSelectedId:h},null,8,["time-list","time-list-id","is-error","is-mobile"])])],4)}}})});
|