@component-hook/picker 0.2.4 → 1.0.0-alpha.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.
@@ -1,1868 +1,556 @@
1
1
  import "./index.css";
2
- import { ref as L, computed as b, watch as ht, nextTick as ne, defineComponent as se, openBlock as W, createElementBlock as z, createVNode as Pt, Transition as Et, withCtx as Ct, withDirectives as Dt, createElementVNode as S, unref as D, vShow as Bt, normalizeClass as ct, normalizeStyle as ut, toDisplayString as j, Fragment as xt, renderList as At } from "vue";
3
- /*!
4
- * better-scroll / core
5
- * (c) 2016-2023 ustbhuangyi
6
- * Released under the MIT License.
7
- */
8
- /*! *****************************************************************************
9
- Copyright (c) Microsoft Corporation.
10
-
11
- Permission to use, copy, modify, and/or distribute this software for any
12
- purpose with or without fee is hereby granted.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- PERFORMANCE OF THIS SOFTWARE.
21
- ***************************************************************************** */
22
- var yt = function(o, t) {
23
- return yt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
24
- e.__proto__ = r;
25
- } || function(e, r) {
26
- for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
27
- }, yt(o, t);
28
- };
29
- function rt(o, t) {
30
- yt(o, t);
31
- function e() {
32
- this.constructor = o;
33
- }
34
- o.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
35
- }
36
- var N = function() {
37
- return N = Object.assign || function(t) {
38
- for (var e, r = 1, i = arguments.length; r < i; r++) {
39
- e = arguments[r];
40
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
41
- }
42
- return t;
43
- }, N.apply(this, arguments);
44
- };
45
- function Kt() {
46
- for (var o = 0, t = 0, e = arguments.length; t < e; t++) o += arguments[t].length;
47
- for (var r = Array(o), i = 0, t = 0; t < e; t++)
48
- for (var n = arguments[t], s = 0, l = n.length; s < l; s++, i++)
49
- r[i] = n[s];
50
- return r;
2
+ import { defineComponent as L, watch as ce, openBlock as I, createBlock as E, Teleport as me, createVNode as Z, Transition as j, withCtx as H, withDirectives as q, createElementVNode as Y, vShow as J, renderSlot as R, ref as C, readonly as Q, isRef as W, toRef as de, createElementBlock as P, unref as v, normalizeStyle as ee, Fragment as z, renderList as ae, toDisplayString as A, computed as O, watchEffect as fe, withModifiers as pe, createCommentVNode as ve, nextTick as he } from "vue";
3
+ const Te = Array.isArray;
4
+ function ge(e, a) {
5
+ if (re(e)) return "multiple";
6
+ const [n] = e;
7
+ return n[a.children] ? "cascade" : "single";
8
+ }
9
+ function ke(e) {
10
+ return {
11
+ children: (e == null ? void 0 : e.children) || "children",
12
+ label: (e == null ? void 0 : e.label) || "label",
13
+ value: (e == null ? void 0 : e.value) || "value"
14
+ };
51
15
  }
52
- var ae = [
53
- {
54
- sourceKey: "scroller.scrollBehaviorX.currentPos",
55
- key: "x"
56
- },
57
- {
58
- sourceKey: "scroller.scrollBehaviorY.currentPos",
59
- key: "y"
60
- },
61
- {
62
- sourceKey: "scroller.scrollBehaviorX.hasScroll",
63
- key: "hasHorizontalScroll"
64
- },
65
- {
66
- sourceKey: "scroller.scrollBehaviorY.hasScroll",
67
- key: "hasVerticalScroll"
68
- },
69
- {
70
- sourceKey: "scroller.scrollBehaviorX.contentSize",
71
- key: "scrollerWidth"
72
- },
73
- {
74
- sourceKey: "scroller.scrollBehaviorY.contentSize",
75
- key: "scrollerHeight"
76
- },
77
- {
78
- sourceKey: "scroller.scrollBehaviorX.maxScrollPos",
79
- key: "maxScrollX"
80
- },
81
- {
82
- sourceKey: "scroller.scrollBehaviorY.maxScrollPos",
83
- key: "maxScrollY"
84
- },
85
- {
86
- sourceKey: "scroller.scrollBehaviorX.minScrollPos",
87
- key: "minScrollX"
88
- },
89
- {
90
- sourceKey: "scroller.scrollBehaviorY.minScrollPos",
91
- key: "minScrollY"
92
- },
93
- {
94
- sourceKey: "scroller.scrollBehaviorX.movingDirection",
95
- key: "movingDirectionX"
96
- },
97
- {
98
- sourceKey: "scroller.scrollBehaviorY.movingDirection",
99
- key: "movingDirectionY"
100
- },
101
- {
102
- sourceKey: "scroller.scrollBehaviorX.direction",
103
- key: "directionX"
104
- },
105
- {
106
- sourceKey: "scroller.scrollBehaviorY.direction",
107
- key: "directionY"
108
- },
109
- {
110
- sourceKey: "scroller.actions.enabled",
111
- key: "enabled"
112
- },
113
- {
114
- sourceKey: "scroller.animater.pending",
115
- key: "pending"
116
- },
117
- {
118
- sourceKey: "scroller.animater.stop",
119
- key: "stop"
120
- },
121
- {
122
- sourceKey: "scroller.scrollTo",
123
- key: "scrollTo"
124
- },
125
- {
126
- sourceKey: "scroller.scrollBy",
127
- key: "scrollBy"
128
- },
129
- {
130
- sourceKey: "scroller.scrollToElement",
131
- key: "scrollToElement"
132
- },
133
- {
134
- sourceKey: "scroller.resetPosition",
135
- key: "resetPosition"
16
+ function Me(e, a, n) {
17
+ var p;
18
+ if (re(e)) return [];
19
+ const r = [];
20
+ let o = e, s = 0;
21
+ for (; o; ) {
22
+ const g = a[s];
23
+ let h = se(o, g, n);
24
+ h === -1 && (h = 0), r.push(o), s += 1, o = (p = o[h]) == null ? void 0 : p[n.children];
136
25
  }
137
- ];
138
- function Q(o) {
139
- console.error("[BScroll warn]: " + o);
26
+ return r;
140
27
  }
141
- var w = typeof window < "u", F = w && navigator.userAgent.toLowerCase(), le = !!(F && /wechatdevtools/.test(F)), he = F && F.indexOf("android") > 0, ce = function() {
142
- if (typeof F == "string") {
143
- var o = /os (\d\d?_\d(_\d)?)/, t = o.exec(F);
144
- if (!t)
145
- return !1;
146
- var e = t[1].split("_").map(function(r) {
147
- return parseInt(r, 10);
148
- });
149
- return e[0] === 13 && e[1] >= 4;
150
- }
151
- return !1;
152
- }(), Rt = !1;
153
- if (w) {
154
- var ue = "test-passive";
155
- try {
156
- var Yt = {};
157
- Object.defineProperty(Yt, "passive", {
158
- get: function() {
159
- Rt = !0;
160
- }
161
- }), window.addEventListener(ue, function() {
162
- }, Yt);
163
- } catch {
28
+ function Ve(e, a, n, r) {
29
+ const o = [...n];
30
+ let s = e, p = a + 1;
31
+ for (; s != null && s[r.children]; ) {
32
+ const g = s[r.children][0];
33
+ o[p] = g.value, s = g, p += 1;
164
34
  }
35
+ return o;
165
36
  }
166
- function X() {
167
- return window.performance && window.performance.now && window.performance.timing ? window.performance.now() + window.performance.timing.navigationStart : +/* @__PURE__ */ new Date();
37
+ function se(e, a, n) {
38
+ return e.findIndex((r) => r[n.value] === a);
168
39
  }
169
- var gt = function(o, t) {
170
- for (var e in t)
171
- o[e] = t[e];
172
- return o;
173
- };
174
- function kt(o) {
175
- return o == null;
40
+ function re(e) {
41
+ const [a] = e;
42
+ return Te(a);
176
43
  }
177
- function Mt(o, t, e) {
178
- return o < t ? t : o > e ? e : o;
44
+ function ye(e, a) {
45
+ return e > a ? "horizontal" : a > e ? "vertical" : "";
179
46
  }
180
- var St = w && document.createElement("div").style, I = function() {
181
- if (!w)
182
- return !1;
183
- for (var o = [
184
- {
185
- key: "standard",
186
- value: "transform"
187
- },
188
- {
189
- key: "webkit",
190
- value: "webkitTransform"
191
- },
192
- {
193
- key: "Moz",
194
- value: "MozTransform"
195
- },
196
- {
197
- key: "O",
198
- value: "OTransform"
199
- },
200
- {
201
- key: "ms",
202
- value: "msTransform"
203
- }
204
- ], t = 0, e = o; t < e.length; t++) {
205
- var r = e[t];
206
- if (St[r.value] !== void 0)
207
- return r.key;
47
+ function F(e, a, n) {
48
+ const r = [];
49
+ for (let o = e; o <= a; o++) {
50
+ const s = n(`${o}`);
51
+ r.push({ label: s, value: o });
208
52
  }
209
- return !1;
210
- }();
211
- function E(o) {
212
- return I === !1 ? o : I === "standard" ? o === "transitionEnd" ? "transitionend" : o : I + o.charAt(0).toUpperCase() + o.substr(1);
53
+ return r;
213
54
  }
214
- function Vt(o) {
215
- return typeof o == "string" ? document.querySelector(o) : o;
55
+ function te(e, a) {
56
+ return e === a.getFullYear();
216
57
  }
217
- function pe(o, t, e, r) {
218
- var i = Rt ? {
219
- passive: !1,
220
- capture: !!r
221
- } : !!r;
222
- o.addEventListener(t, e, i);
58
+ function ne(e, a) {
59
+ return e === a.getFullYear();
223
60
  }
224
- function fe(o, t, e, r) {
225
- o.removeEventListener(t, e, {
226
- capture: !!r
227
- });
61
+ function we(e, a) {
62
+ return e === a.getMonth() + 1;
228
63
  }
229
- function $t(o) {
230
- o.cancelable && o.preventDefault();
64
+ function Se(e, a) {
65
+ return e === a.getMonth() + 1;
231
66
  }
232
- function Xt(o) {
233
- for (var t = 0, e = 0; o; )
234
- t -= o.offsetLeft, e -= o.offsetTop, o = o.offsetParent;
235
- return {
236
- left: t,
237
- top: e
238
- };
67
+ function De(e, a) {
68
+ return new Date(e, a, 0).getDate();
239
69
  }
240
- I && I !== "standard" && "" + I.toLowerCase();
241
- var ve = E("transform"), jt = E("transition"), de = w && E("perspective") in St, Ot = w && ("ontouchstart" in window || le), me = w && jt in St, M = {
242
- transform: ve,
243
- transition: jt,
244
- transitionTimingFunction: E("transitionTimingFunction"),
245
- transitionDuration: E("transitionDuration"),
246
- transitionDelay: E("transitionDelay"),
247
- transformOrigin: E("transformOrigin"),
248
- transitionEnd: E("transitionEnd"),
249
- transitionProperty: E("transitionProperty")
250
- }, pt = {
251
- touchstart: 1,
252
- touchmove: 1,
253
- touchend: 1,
254
- touchcancel: 1,
255
- mousedown: 2,
256
- mousemove: 2,
257
- mouseup: 2
258
- };
259
- function _t(o) {
260
- if (o instanceof window.SVGElement) {
261
- var t = o.getBoundingClientRect();
262
- return {
263
- top: t.top,
264
- left: t.left,
265
- width: t.width,
266
- height: t.height
267
- };
268
- } else
269
- return {
270
- top: o.offsetTop,
271
- left: o.offsetLeft,
272
- width: o.offsetWidth,
273
- height: o.offsetHeight
274
- };
70
+ function $(e) {
71
+ return e;
72
+ }
73
+ function xe(e) {
74
+ return /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e);
275
75
  }
276
- function K(o, t) {
277
- for (var e in t)
278
- if (t[e].test(o[e]))
279
- return !0;
280
- return !1;
76
+ function oe(e) {
77
+ if (!xe(e)) return null;
78
+ const [a, n, r] = e.split(":");
79
+ return { hour: Number(a), minute: Number(n), second: Number(r) };
281
80
  }
282
- var ye = K;
283
- function ge(o, t) {
284
- var e = document.createEvent("Event");
285
- e.initEvent(t, !0, !0), e.pageX = o.pageX, e.pageY = o.pageY, o.target.dispatchEvent(e);
81
+ function U(e) {
82
+ return e.padStart(2, "0");
286
83
  }
287
- function Ut(o, t) {
288
- t === void 0 && (t = "click");
289
- var e;
290
- o.type === "mouseup" ? e = o : (o.type === "touchend" || o.type === "touchcancel") && (e = o.changedTouches[0]);
291
- var r = {};
292
- e && (r.screenX = e.screenX || 0, r.screenY = e.screenY || 0, r.clientX = e.clientX || 0, r.clientY = e.clientY || 0);
293
- var i, n = !0, s = !0, l = o.ctrlKey, h = o.shiftKey, a = o.altKey, c = o.metaKey, u = {
294
- ctrlKey: l,
295
- shiftKey: h,
296
- altKey: a,
297
- metaKey: c
84
+ const be = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ L({
85
+ __name: "Popup",
86
+ props: {
87
+ teleport: { default: "body" },
88
+ modelValue: { type: Boolean }
89
+ },
90
+ emits: ["update:modelValue", "open", "close", "closed"],
91
+ setup(e, { emit: a }) {
92
+ const n = e, r = a;
93
+ return ce(
94
+ () => n.modelValue,
95
+ (o) => {
96
+ o ? (document.body.style.overflow = "hidden", r("open")) : (document.body.style.overflow = "", r("close"));
97
+ },
98
+ { immediate: !0 }
99
+ ), (o, s) => (I(), E(me, { to: o.teleport }, [
100
+ Z(j, { name: "chook-picker-fade" }, {
101
+ default: H(() => [
102
+ q(Y("div", {
103
+ class: "chook-picker-mask",
104
+ onClick: s[0] || (s[0] = (p) => o.$emit("update:modelValue", !1))
105
+ }, null, 512), [
106
+ [J, o.modelValue]
107
+ ])
108
+ ]),
109
+ _: 1
110
+ }),
111
+ Z(j, {
112
+ name: "chook-picker-slide",
113
+ onAfterLeave: s[1] || (s[1] = (p) => o.$emit("closed"))
114
+ }, {
115
+ default: H(() => [
116
+ q(Y("div", be, [
117
+ R(o.$slots, "default")
118
+ ], 512), [
119
+ [J, o.modelValue]
120
+ ])
121
+ ]),
122
+ _: 3
123
+ })
124
+ ], 8, ["to"]));
125
+ }
126
+ }), Ye = 16, _ = 48, Ce = 0.52, le = 150, X = 300, Oe = 15, Pe = 8e-3, ue = 5, Fe = "Select Date", Ee = ["year", "month", "day"], Le = "Select Time", Be = ["hour", "minute", "second"];
127
+ function Ae() {
128
+ const e = {
129
+ startX: 0,
130
+ startY: 0,
131
+ deltaX: 0,
132
+ deltaY: 0,
133
+ offsetX: 0,
134
+ offsetY: 0
298
135
  };
299
- if (typeof MouseEvent < "u")
300
- try {
301
- i = new MouseEvent(t, gt(N({
302
- bubbles: n,
303
- cancelable: s
304
- }, u), r));
305
- } catch {
306
- v();
307
- }
308
- else
309
- v();
310
- function v() {
311
- i = document.createEvent("Event"), i.initEvent(t, n, s), gt(i, r);
136
+ let a = "", n = !0;
137
+ const r = () => a === "vertical", o = () => a === "horizontal";
138
+ function s() {
139
+ e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, a = "", n = !0;
312
140
  }
313
- i.forwardedTouchEvent = !0, i._constructed = !0, o.target.dispatchEvent(i);
314
- }
315
- function ke(o) {
316
- Ut(o, "dblclick");
141
+ function p(d) {
142
+ const k = "touches" in d ? d.touches[0] : d;
143
+ s(), e.startX = k.clientX, e.startY = k.clientY;
144
+ }
145
+ function g(d) {
146
+ if (!e.startX || !e.startY) return !0;
147
+ const k = "touches" in d ? d.touches[0] : d;
148
+ e.deltaX = Math.max(k.clientX, 0) - e.startX, e.deltaY = k.clientY - e.startY, e.offsetX = Math.abs(e.deltaX), e.offsetY = Math.abs(e.deltaY);
149
+ const T = 10;
150
+ (!a || e.offsetX < T && e.offsetY < T) && (a = ye(e.offsetX, e.offsetY)), n && (e.offsetX > ue || e.offsetY > ue) && (n = !1);
151
+ }
152
+ function h() {
153
+ e.startX = 0, e.startY = 0;
154
+ }
155
+ return {
156
+ pointer: e,
157
+ move: g,
158
+ start: p,
159
+ stop: h,
160
+ reset: s,
161
+ isVertical: r,
162
+ isHorizontal: o
163
+ };
317
164
  }
318
- var Y = {
319
- // easeOutQuint
320
- swipe: {
321
- style: "cubic-bezier(0.23, 1, 0.32, 1)",
322
- fn: function(o) {
323
- return 1 + --o * o * o * o * o;
165
+ function Ne({ column: e, onChange: a }) {
166
+ const r = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Ye, o = C(0), s = C(0), { pointer: p, start: g, move: h, stop: d } = Ae();
167
+ let k = 0, T = 0, b = 0, M = !1, D = null;
168
+ function V(f) {
169
+ g(f), M = !0, s.value = 0, T = Date.now(), k = o.value, b = k, D = null;
170
+ }
171
+ function l(f) {
172
+ if (h(f)) return;
173
+ const S = W(e) ? e.value.length : e.length, B = k + p.deltaY, N = y((S - 1) * -48), G = Math.min(Math.max(B, N), 0), K = Date.now();
174
+ o.value = G, !(K - T <= X) && (T = K, b = G);
175
+ }
176
+ function i() {
177
+ d();
178
+ const f = o.value - b, w = Date.now() - T;
179
+ if (w < X && Math.abs(f) > Oe) {
180
+ t(f, w);
181
+ return;
324
182
  }
183
+ const S = m(o.value);
184
+ s.value = le, c(S), M = !1;
185
+ }
186
+ function t(f, w) {
187
+ const S = Math.abs(f / w), B = o.value + S / Pe * (f < 0 ? -1 : 1), N = m(B);
188
+ s.value = X, c(N);
189
+ }
190
+ function u() {
191
+ s.value = 0, M = !1, D && (D(), D = null);
192
+ }
193
+ function c(f) {
194
+ const w = -f * y(_), S = () => a == null ? void 0 : a(f);
195
+ M && w !== o.value ? D = S : S(), o.value = w;
196
+ }
197
+ function m(f) {
198
+ const w = W(e) ? e.value.length : e.length, S = Math.round(-f / y(_));
199
+ return S < 0 ? 0 : S >= w ? w - 1 : S;
200
+ }
201
+ function y(f) {
202
+ return f * r;
203
+ }
204
+ function x(f, w = "auto") {
205
+ M && w === "smooth" || (D = null, M = w === "smooth", s.value = w === "smooth" ? le : 0, c(f));
206
+ }
207
+ return {
208
+ offsetY: Q(o),
209
+ transitionDuration: Q(s),
210
+ onPointerDown: V,
211
+ onPointerMove: l,
212
+ onPointerUp: i,
213
+ stopInertialSliding: u,
214
+ scrollToIndex: x
215
+ };
216
+ }
217
+ const $e = ["onClick"], Ue = /* @__PURE__ */ L({
218
+ __name: "PickerColumn",
219
+ props: {
220
+ column: {},
221
+ fields: {},
222
+ selectedIndex: { default: 0 }
325
223
  },
326
- // easeOutQuard
327
- swipeBounce: {
328
- style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
329
- fn: function(o) {
330
- return o * (2 - o);
224
+ emits: ["change"],
225
+ setup(e, { expose: a, emit: n }) {
226
+ const r = e, o = n, { offsetY: s, transitionDuration: p, onPointerDown: g, onPointerMove: h, onPointerUp: d, stopInertialSliding: k, scrollToIndex: T } = Ne({
227
+ column: de(r, "column"),
228
+ onChange: b
229
+ });
230
+ function b(V) {
231
+ V !== r.selectedIndex && o("change", V);
331
232
  }
332
- },
333
- // easeOutQuart
334
- bounce: {
335
- style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
336
- fn: function(o) {
337
- return 1 - --o * o * o * o;
233
+ function M(V = r.selectedIndex, l) {
234
+ T(V, l);
338
235
  }
236
+ function D(V) {
237
+ V !== r.selectedIndex && M(V, "smooth");
238
+ }
239
+ return a({ scrollToSelected: M }), (V, l) => (I(), P("div", {
240
+ class: "chook-picker-column",
241
+ onTouchstartPassive: l[1] || (l[1] = //@ts-ignore
242
+ (...i) => v(g) && v(g)(...i)),
243
+ onTouchmovePassive: l[2] || (l[2] = //@ts-ignore
244
+ (...i) => v(h) && v(h)(...i)),
245
+ onTouchendPassive: l[3] || (l[3] = //@ts-ignore
246
+ (...i) => v(d) && v(d)(...i)),
247
+ onTouchcancel: l[4] || (l[4] = //@ts-ignore
248
+ (...i) => v(d) && v(d)(...i)),
249
+ onMousedownPassive: l[5] || (l[5] = //@ts-ignore
250
+ (...i) => v(g) && v(g)(...i)),
251
+ onMousemovePassive: l[6] || (l[6] = //@ts-ignore
252
+ (...i) => v(h) && v(h)(...i)),
253
+ onMouseupPassive: l[7] || (l[7] = //@ts-ignore
254
+ (...i) => v(d) && v(d)(...i))
255
+ }, [
256
+ Y("ul", {
257
+ style: ee({
258
+ overflowY: "hidden",
259
+ transform: `translate3d(0, ${v(s)}px, 0)`,
260
+ transitionDuration: `${v(p)}ms`,
261
+ transitionProperty: v(p) ? "all" : "none"
262
+ }),
263
+ onTransitionend: l[0] || (l[0] = //@ts-ignore
264
+ (...i) => v(k) && v(k)(...i))
265
+ }, [
266
+ (I(!0), P(z, null, ae(V.column, (i, t) => (I(), P("li", {
267
+ key: i[V.fields.value],
268
+ class: "chook-picker-column-item",
269
+ role: "button",
270
+ tabindex: "0",
271
+ onClick: (u) => D(t)
272
+ }, [
273
+ Y("p", {
274
+ class: "chook-picker-column-label",
275
+ style: ee({
276
+ transform: `rotate3d(1, 0, 0, ${(t * v(_) + v(s)) * v(Ce)}deg)`
277
+ })
278
+ }, A(i[V.fields.label]), 5)
279
+ ], 8, $e))), 128))
280
+ ], 36)
281
+ ], 32));
339
282
  }
340
- }, Te = 1e3 / 60, B = w && window;
341
- function qt() {
342
- }
343
- var Gt = function() {
344
- return w ? B.requestAnimationFrame || B.webkitRequestAnimationFrame || B.mozRequestAnimationFrame || B.oRequestAnimationFrame || // if all else fails, use setTimeout
345
- function(o) {
346
- return window.setTimeout(o, o.interval || Te);
347
- } : qt;
348
- }(), O = function() {
349
- return w ? B.cancelAnimationFrame || B.webkitCancelAnimationFrame || B.mozCancelAnimationFrame || B.oCancelAnimationFrame || function(o) {
350
- window.clearTimeout(o);
351
- } : qt;
352
- }(), Lt = function(o) {
353
- }, ft = {
354
- enumerable: !0,
355
- configurable: !0,
356
- get: Lt,
357
- set: Lt
358
- }, Se = function(o, t) {
359
- for (var e = t.split("."), r = 0; r < e.length - 1; r++)
360
- if (o = o[e[r]], typeof o != "object" || !o)
361
- return;
362
- var i = e.pop();
363
- return typeof o[i] == "function" ? function() {
364
- return o[i].apply(o, arguments);
365
- } : o[i];
366
- }, be = function(o, t, e) {
367
- for (var r = t.split("."), i, n = 0; n < r.length - 1; n++)
368
- i = r[n], o[i] || (o[i] = {}), o = o[i];
369
- o[r.pop()] = e;
370
- };
371
- function we(o, t, e) {
372
- ft.get = function() {
373
- return Se(this, t);
374
- }, ft.set = function(i) {
375
- be(this, t, i);
376
- }, Object.defineProperty(o, e, ft);
377
- }
378
- var x = (
379
- /** @class */
380
- function() {
381
- function o(t) {
382
- this.events = {}, this.eventTypes = {}, this.registerType(t);
283
+ }), Xe = { class: "chook-picker-header" }, He = { class: "chook-picker-title" }, Re = {
284
+ key: 0,
285
+ class: "chook-picker-loading"
286
+ }, ie = /* @__PURE__ */ L({
287
+ __name: "Picker",
288
+ props: {
289
+ show: { type: Boolean },
290
+ modelValue: {},
291
+ title: {},
292
+ columns: {},
293
+ linkage: { type: Boolean },
294
+ loading: { type: Boolean },
295
+ teleport: {},
296
+ confirmButtonText: { default: "Confirm" },
297
+ cancelButtonText: { default: "Cancel" },
298
+ columnsFieldNames: {}
299
+ },
300
+ emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
301
+ setup(e, { emit: a }) {
302
+ const n = e, r = a, o = C([]), s = C([]), p = C([]), g = C(null), h = O({
303
+ get: () => n.show,
304
+ set: (t) => r("update:show", t)
305
+ }), d = O(() => ke(n.columnsFieldNames)), k = O(() => ge(n.columns, d.value)), T = O(() => {
306
+ const { columns: t } = n;
307
+ return k.value === "single" ? [t] : k.value === "multiple" ? t : Me(t, s.value, d.value);
308
+ });
309
+ function b(t, u) {
310
+ const c = T.value[t], m = c[u][d.value.value], y = s.value[t];
311
+ if (m === y) return;
312
+ const x = [...s.value];
313
+ if (x[t] = m, k.value === "cascade") {
314
+ const f = c[u];
315
+ s.value = Ve(f, t, x, d.value);
316
+ } else
317
+ s.value = x;
318
+ n.linkage && M();
383
319
  }
384
- return o.prototype.on = function(t, e, r) {
385
- return r === void 0 && (r = this), this.hasType(t), this.events[t] || (this.events[t] = []), this.events[t].push([e, r]), this;
386
- }, o.prototype.once = function(t, e, r) {
387
- var i = this;
388
- r === void 0 && (r = this), this.hasType(t);
389
- var n = function() {
390
- for (var s = [], l = 0; l < arguments.length; l++)
391
- s[l] = arguments[l];
392
- i.off(t, n);
393
- var h = e.apply(r, s);
394
- if (h === !0)
395
- return h;
396
- };
397
- return n.fn = e, this.on(t, n), this;
398
- }, o.prototype.off = function(t, e) {
399
- if (!t && !e)
400
- return this.events = {}, this;
401
- if (t) {
402
- if (this.hasType(t), !e)
403
- return this.events[t] = [], this;
404
- var r = this.events[t];
405
- if (!r)
406
- return this;
407
- for (var i = r.length; i--; )
408
- (r[i][0] === e || r[i][0] && r[i][0].fn === e) && r.splice(i, 1);
409
- return this;
410
- }
411
- }, o.prototype.trigger = function(t) {
412
- for (var e = [], r = 1; r < arguments.length; r++)
413
- e[r - 1] = arguments[r];
414
- this.hasType(t);
415
- var i = this.events[t];
416
- if (i)
417
- for (var n = i.length, s = Kt(i), l, h = 0; h < n; h++) {
418
- var a = s[h], c = a[0], u = a[1];
419
- if (c && (l = c.apply(u, e), l === !0))
420
- return l;
421
- }
422
- }, o.prototype.registerType = function(t) {
423
- var e = this;
424
- t.forEach(function(r) {
425
- e.eventTypes[r] = r;
426
- });
427
- }, o.prototype.destroy = function() {
428
- this.events = {}, this.eventTypes = {};
429
- }, o.prototype.hasType = function(t) {
430
- var e = this.eventTypes, r = e[t] === t;
431
- r || Q('EventEmitter has used unknown event type: "' + t + '", should be oneof [' + ("" + Object.keys(e).map(function(i) {
432
- return JSON.stringify(i);
433
- })) + "]");
434
- }, o;
435
- }()
436
- ), tt = (
437
- /** @class */
438
- function() {
439
- function o(t, e) {
440
- this.wrapper = t, this.events = e, this.addDOMEvents();
320
+ function M() {
321
+ r("update:modelValue", s.value), o.value = s.value;
441
322
  }
442
- return o.prototype.destroy = function() {
443
- this.removeDOMEvents(), this.events = [];
444
- }, o.prototype.addDOMEvents = function() {
445
- this.handleDOMEvents(pe);
446
- }, o.prototype.removeDOMEvents = function() {
447
- this.handleDOMEvents(fe);
448
- }, o.prototype.handleDOMEvents = function(t) {
449
- var e = this, r = this.wrapper;
450
- this.events.forEach(function(i) {
451
- t(r, i.name, e, !!i.capture);
452
- });
453
- }, o.prototype.handleEvent = function(t) {
454
- var e = t.type;
455
- this.events.some(function(r) {
456
- return r.name === e ? (r.handler(t), !0) : !1;
457
- });
458
- }, o;
459
- }()
460
- ), Pe = (
461
- /** @class */
462
- /* @__PURE__ */ function() {
463
- function o() {
323
+ function D() {
324
+ r("update:show", !1);
464
325
  }
465
- return o;
466
- }()
467
- ), Ee = (
468
- /** @class */
469
- function(o) {
470
- rt(t, o);
471
- function t() {
472
- var e = o.call(this) || this;
473
- return e.startX = 0, e.startY = 0, e.scrollX = !1, e.scrollY = !0, e.freeScroll = !1, e.directionLockThreshold = 0, e.eventPassthrough = "", e.click = !1, e.dblclick = !1, e.tap = "", e.bounce = {
474
- top: !0,
475
- bottom: !0,
476
- left: !0,
477
- right: !0
478
- }, e.bounceTime = 800, e.momentum = !0, e.momentumLimitTime = 300, e.momentumLimitDistance = 15, e.swipeTime = 2500, e.swipeBounceTime = 500, e.deceleration = 15e-4, e.flickLimitTime = 200, e.flickLimitDistance = 100, e.resizePolling = 60, e.probeType = 0, e.stopPropagation = !1, e.preventDefault = !0, e.preventDefaultException = {
479
- tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/
480
- }, e.tagException = {
481
- tagName: /^TEXTAREA$/
482
- }, e.HWCompositing = !0, e.useTransition = !0, e.bindToWrapper = !1, e.bindToTarget = !1, e.disableMouse = Ot, e.disableTouch = !Ot, e.autoBlur = !0, e.autoEndDistance = 5, e.outOfBoundaryDampingFactor = 1 / 3, e.specifiedIndexAsContent = 0, e.quadrant = 1, e;
326
+ async function V() {
327
+ r("open"), await he(), s.value = n.modelValue ? [...n.modelValue] : [...o.value];
483
328
  }
484
- return t.prototype.merge = function(e) {
485
- if (!e)
486
- return this;
487
- for (var r in e) {
488
- if (r === "bounce") {
489
- this.bounce = this.resolveBounce(e[r]);
490
- continue;
491
- }
492
- this[r] = e[r];
493
- }
494
- return this;
495
- }, t.prototype.process = function() {
496
- return this.translateZ = this.HWCompositing && de ? " translateZ(1px)" : "", this.useTransition = this.useTransition && me, this.preventDefault = !this.eventPassthrough && this.preventDefault, this.scrollX = this.eventPassthrough === "horizontal" ? !1 : this.scrollX, this.scrollY = this.eventPassthrough === "vertical" ? !1 : this.scrollY, this.freeScroll = this.freeScroll && !this.eventPassthrough, this.scrollX = this.freeScroll ? !0 : this.scrollX, this.scrollY = this.freeScroll ? !0 : this.scrollY, this.directionLockThreshold = this.eventPassthrough ? 0 : this.directionLockThreshold, this;
497
- }, t.prototype.resolveBounce = function(e) {
498
- var r = {
499
- top: !0,
500
- right: !0,
501
- bottom: !0,
502
- left: !0
503
- }, i = {
504
- top: !1,
505
- right: !1,
506
- bottom: !1,
507
- left: !1
508
- }, n;
509
- return typeof e == "object" ? n = gt(r, e) : n = e ? r : i, n;
510
- }, t;
511
- }(Pe)
512
- ), Ce = (
513
- /** @class */
514
- function() {
515
- function o(t, e) {
516
- this.wrapper = t, this.options = e, this.hooks = new x([
517
- "beforeStart",
518
- "start",
519
- "move",
520
- "end",
521
- "click"
522
- ]), this.handleDOMEvents();
329
+ function l() {
330
+ n.linkage || M(), D(), r("confirm", s.value);
523
331
  }
524
- return o.prototype.handleDOMEvents = function() {
525
- var t = this.options, e = t.bindToWrapper, r = t.disableMouse, i = t.disableTouch, n = t.click, s = this.wrapper, l = e ? s : window, h = [], a = [], c = !i, u = !r;
526
- n && h.push({
527
- name: "click",
528
- handler: this.click.bind(this),
529
- capture: !0
530
- }), c && (h.push({
531
- name: "touchstart",
532
- handler: this.start.bind(this)
533
- }), a.push({
534
- name: "touchmove",
535
- handler: this.move.bind(this)
536
- }, {
537
- name: "touchend",
538
- handler: this.end.bind(this)
539
- }, {
540
- name: "touchcancel",
541
- handler: this.end.bind(this)
542
- })), u && (h.push({
543
- name: "mousedown",
544
- handler: this.start.bind(this)
545
- }), a.push({
546
- name: "mousemove",
547
- handler: this.move.bind(this)
548
- }, {
549
- name: "mouseup",
550
- handler: this.end.bind(this)
551
- })), this.wrapperEventRegister = new tt(s, h), this.targetEventRegister = new tt(l, a);
552
- }, o.prototype.beforeHandler = function(t, e) {
553
- var r = this.options, i = r.preventDefault, n = r.stopPropagation, s = r.preventDefaultException, l = {
554
- start: function() {
555
- return i && !K(t.target, s);
556
- },
557
- end: function() {
558
- return i && !K(t.target, s);
559
- },
560
- move: function() {
561
- return i;
562
- }
563
- };
564
- l[e]() && t.preventDefault(), n && t.stopPropagation();
565
- }, o.prototype.setInitiated = function(t) {
566
- t === void 0 && (t = 0), this.initiated = t;
567
- }, o.prototype.start = function(t) {
568
- var e = pt[t.type];
569
- if (!(this.initiated && this.initiated !== e)) {
570
- if (this.setInitiated(e), ye(t.target, this.options.tagException)) {
571
- this.setInitiated();
572
- return;
573
- }
574
- if (!(e === 2 && t.button !== 0) && !this.hooks.trigger(this.hooks.eventTypes.beforeStart, t)) {
575
- this.beforeHandler(t, "start");
576
- var r = t.touches ? t.touches[0] : t;
577
- this.pointX = r.pageX, this.pointY = r.pageY, this.hooks.trigger(this.hooks.eventTypes.start, t);
578
- }
579
- }
580
- }, o.prototype.move = function(t) {
581
- if (pt[t.type] === this.initiated) {
582
- this.beforeHandler(t, "move");
583
- var e = t.touches ? t.touches[0] : t, r = e.pageX - this.pointX, i = e.pageY - this.pointY;
584
- if (this.pointX = e.pageX, this.pointY = e.pageY, !this.hooks.trigger(this.hooks.eventTypes.move, {
585
- deltaX: r,
586
- deltaY: i,
587
- e: t
588
- })) {
589
- var n = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft, s = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop, l = this.pointX - n, h = this.pointY - s, a = this.options.autoEndDistance;
590
- (l > document.documentElement.clientWidth - a || h > document.documentElement.clientHeight - a || l < a || h < a) && this.end(t);
591
- }
592
- }
593
- }, o.prototype.end = function(t) {
594
- pt[t.type] === this.initiated && (this.setInitiated(), this.beforeHandler(t, "end"), this.hooks.trigger(this.hooks.eventTypes.end, t));
595
- }, o.prototype.click = function(t) {
596
- this.hooks.trigger(this.hooks.eventTypes.click, t);
597
- }, o.prototype.setContent = function(t) {
598
- t !== this.wrapper && (this.wrapper = t, this.rebindDOMEvents());
599
- }, o.prototype.rebindDOMEvents = function() {
600
- this.wrapperEventRegister.destroy(), this.targetEventRegister.destroy(), this.handleDOMEvents();
601
- }, o.prototype.destroy = function() {
602
- this.wrapperEventRegister.destroy(), this.targetEventRegister.destroy(), this.hooks.destroy();
603
- }, o;
604
- }()
605
- ), vt = {
606
- x: ["translateX", "px"],
607
- y: ["translateY", "px"]
608
- }, De = (
609
- /** @class */
610
- function() {
611
- function o(t) {
612
- this.setContent(t), this.hooks = new x(["beforeTranslate", "translate"]);
332
+ function i() {
333
+ D(), r("cancel");
613
334
  }
614
- return o.prototype.getComputedPosition = function() {
615
- var t = window.getComputedStyle(this.content, null), e = t[M.transform].split(")")[0].split(", "), r = +(e[12] || e[4]) || 0, i = +(e[13] || e[5]) || 0;
616
- return {
617
- x: r,
618
- y: i
335
+ return fe(() => {
336
+ var c;
337
+ const t = T.value.length, u = [];
338
+ for (let m = 0; m < t; m++) {
339
+ const y = T.value[m], x = s.value[m], f = se(y, x, d.value);
340
+ if (f === -1) {
341
+ const S = (p.value[m] ?? 0) >= y.length ? y.length - 1 : 0;
342
+ s.value[m] = y[S][d.value.value], u[m] = S;
343
+ } else
344
+ u[m] = f;
345
+ u[m] !== p.value[m] && ((c = g.value) == null || c[m].scrollToSelected(u[m]));
346
+ }
347
+ p.value = u;
348
+ }), (t, u) => (I(), E(Ie, {
349
+ modelValue: h.value,
350
+ "onUpdate:modelValue": u[1] || (u[1] = (c) => h.value = c),
351
+ teleport: t.teleport,
352
+ onOpen: V,
353
+ onClosed: u[2] || (u[2] = (c) => t.$emit("closed"))
354
+ }, {
355
+ default: H(() => [
356
+ Y("div", Xe, [
357
+ Y("button", {
358
+ class: "chook-picker-cancel",
359
+ onClick: i
360
+ }, A(t.cancelButtonText), 1),
361
+ Y("p", He, A(t.title), 1),
362
+ Y("button", {
363
+ class: "chook-picker-confirm",
364
+ onClick: l
365
+ }, A(t.confirmButtonText), 1)
366
+ ]),
367
+ Y("div", {
368
+ class: "chook-picker-columns chook-picker-columns-backdrop",
369
+ onTouchmove: u[0] || (u[0] = pe(() => {
370
+ }, ["stop"]))
371
+ }, [
372
+ !t.loading && !t.columns.length ? R(t.$slots, "empty", { key: 0 }) : (I(), P(z, { key: 1 }, [
373
+ (I(!0), P(z, null, ae(T.value, (c, m) => (I(), E(Ue, {
374
+ key: m,
375
+ ref_for: !0,
376
+ ref_key: "columnsRef",
377
+ ref: g,
378
+ column: c,
379
+ fields: d.value,
380
+ "selected-index": p.value[m],
381
+ onChange: (y) => b(m, y)
382
+ }, null, 8, ["column", "fields", "selected-index", "onChange"]))), 128)),
383
+ u[3] || (u[3] = Y("div", { class: "chook-picker-mask-backdrop" }, null, -1))
384
+ ], 64))
385
+ ], 32),
386
+ t.loading ? (I(), P("div", Re, [
387
+ R(t.$slots, "loading")
388
+ ])) : ve("", !0)
389
+ ]),
390
+ _: 3
391
+ }, 8, ["modelValue", "teleport"]));
392
+ }
393
+ }), _e = /* @__PURE__ */ L({
394
+ __name: "DatePicker",
395
+ props: {
396
+ show: { type: Boolean },
397
+ modelValue: {},
398
+ title: { default: Fe },
399
+ columnsType: { default: () => Ee },
400
+ minDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1) },
401
+ maxDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31) },
402
+ teleport: {},
403
+ confirmButtonText: {},
404
+ cancelButtonText: {},
405
+ formatYearLabel: { type: Function, default: $ },
406
+ formatMonthLabel: { type: Function, default: $ },
407
+ formatDayLabel: { type: Function, default: $ }
408
+ },
409
+ emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
410
+ setup(e, { emit: a }) {
411
+ const n = e, r = a, o = C([]), s = C([]), p = O({
412
+ get: () => n.show,
413
+ set: (l) => r("update:show", l)
414
+ }), g = O(() => {
415
+ const { columnsType: l, minDate: i, maxDate: t } = n, u = {
416
+ year: h,
417
+ month: d,
418
+ day: k
619
419
  };
620
- }, o.prototype.translate = function(t) {
621
- var e = [];
622
- Object.keys(t).forEach(function(r) {
623
- if (vt[r]) {
624
- var i = vt[r][0];
625
- if (i) {
626
- var n = vt[r][1], s = t[r];
627
- e.push(i + "(" + s + n + ")");
628
- }
629
- }
630
- }), this.hooks.trigger(this.hooks.eventTypes.beforeTranslate, e, t), this.style[M.transform] = e.join(" "), this.hooks.trigger(this.hooks.eventTypes.translate, t);
631
- }, o.prototype.setContent = function(t) {
632
- this.content !== t && (this.content = t, this.style = t.style);
633
- }, o.prototype.destroy = function() {
634
- this.hooks.destroy();
635
- }, o;
636
- }()
637
- ), Zt = (
638
- /** @class */
639
- function() {
640
- function o(t, e, r) {
641
- this.translater = e, this.options = r, this.timer = 0, this.hooks = new x([
642
- "move",
643
- "end",
644
- "beforeForceStop",
645
- "forceStop",
646
- "callStop",
647
- "time",
648
- "timeFunction"
649
- ]), this.setContent(t);
420
+ return l.map((c) => u[c](i, t));
421
+ });
422
+ function h(l, i) {
423
+ const t = l.getFullYear(), u = i.getFullYear();
424
+ return F(t, u, n.formatYearLabel);
650
425
  }
651
- return o.prototype.translate = function(t) {
652
- this.translater.translate(t);
653
- }, o.prototype.setPending = function(t) {
654
- this.pending = t;
655
- }, o.prototype.setForceStopped = function(t) {
656
- this.forceStopped = t;
657
- }, o.prototype.setCallStop = function(t) {
658
- this.callStopWhenPending = t;
659
- }, o.prototype.setContent = function(t) {
660
- this.content !== t && (this.content = t, this.style = t.style, this.stop());
661
- }, o.prototype.clearTimer = function() {
662
- this.timer && (O(this.timer), this.timer = 0);
663
- }, o.prototype.destroy = function() {
664
- this.hooks.destroy(), O(this.timer);
665
- }, o;
666
- }()
667
- ), Be = function(o, t, e, r) {
668
- var i = function(a, c) {
669
- var u = a - c, v = u > 0 ? -1 : u < 0 ? 1 : 0;
670
- return v;
671
- }, n = i(t.x, o.x), s = i(t.y, o.y), l = e.x - r.x, h = e.y - r.y;
672
- return n * l <= 0 && s * h <= 0;
673
- }, xe = (
674
- /** @class */
675
- function(o) {
676
- rt(t, o);
677
- function t() {
678
- return o !== null && o.apply(this, arguments) || this;
426
+ function d(l, i) {
427
+ const t = T("year"), u = te(t, l) ? l.getMonth() + 1 : 1, c = ne(t, i) ? i.getMonth() + 1 : 12;
428
+ return F(u, c, n.formatMonthLabel);
679
429
  }
680
- return t.prototype.startProbe = function(e, r) {
681
- var i = this, n = e, s = function() {
682
- var l = i.translater.getComputedPosition();
683
- Be(e, r, l, n) && i.hooks.trigger(i.hooks.eventTypes.move, l), i.pending || (i.callStopWhenPending ? i.callStopWhenPending = !1 : i.hooks.trigger(i.hooks.eventTypes.end, l)), n = l, i.pending && (i.timer = Gt(s));
684
- };
685
- this.callStopWhenPending && this.setCallStop(!1), O(this.timer), s();
686
- }, t.prototype.transitionTime = function(e) {
687
- e === void 0 && (e = 0), this.style[M.transitionDuration] = e + "ms", this.hooks.trigger(this.hooks.eventTypes.time, e);
688
- }, t.prototype.transitionTimingFunction = function(e) {
689
- this.style[M.transitionTimingFunction] = e, this.hooks.trigger(this.hooks.eventTypes.timeFunction, e);
690
- }, t.prototype.transitionProperty = function() {
691
- this.style[M.transitionProperty] = M.transform;
692
- }, t.prototype.move = function(e, r, i, n) {
693
- this.setPending(i > 0), this.transitionTimingFunction(n), this.transitionProperty(), this.transitionTime(i), this.translate(r);
694
- var s = this.options.probeType === 3;
695
- i && s && this.startProbe(e, r), i || (this._reflow = this.content.offsetHeight, s && this.hooks.trigger(this.hooks.eventTypes.move, r), this.hooks.trigger(this.hooks.eventTypes.end, r));
696
- }, t.prototype.doStop = function() {
697
- var e = this.pending;
698
- if (this.setForceStopped(!1), this.setCallStop(!1), e) {
699
- this.setPending(!1), O(this.timer);
700
- var r = this.translater.getComputedPosition(), i = r.x, n = r.y;
701
- this.transitionTime(), this.translate({ x: i, y: n }), this.setForceStopped(!0), this.setCallStop(!0), this.hooks.trigger(this.hooks.eventTypes.forceStop, { x: i, y: n });
702
- }
703
- return e;
704
- }, t.prototype.stop = function() {
705
- var e = this.doStop();
706
- e && this.hooks.trigger(this.hooks.eventTypes.callStop);
707
- }, t;
708
- }(Zt)
709
- ), Ae = (
710
- /** @class */
711
- function(o) {
712
- rt(t, o);
713
- function t() {
714
- return o !== null && o.apply(this, arguments) || this;
430
+ function k(l, i) {
431
+ const t = T("year"), u = T("month"), c = te(t, l) && we(u, l), m = ne(t, i) && Se(u, i), y = c ? l.getDate() : 1, x = m ? i.getDate() : De(t, u);
432
+ return F(y, x, n.formatDayLabel);
715
433
  }
716
- return t.prototype.move = function(e, r, i, n) {
717
- if (!i) {
718
- this.translate(r), this.options.probeType === 3 && this.hooks.trigger(this.hooks.eventTypes.move, r), this.hooks.trigger(this.hooks.eventTypes.end, r);
719
- return;
720
- }
721
- this.animate(e, r, i, n);
722
- }, t.prototype.animate = function(e, r, i, n) {
723
- var s = this, l = X(), h = l + i, a = this.options.probeType === 3, c = function() {
724
- var u = X();
725
- if (u >= h) {
726
- s.translate(r), a && s.hooks.trigger(s.hooks.eventTypes.move, r), s.hooks.trigger(s.hooks.eventTypes.end, r);
727
- return;
728
- }
729
- u = (u - l) / i;
730
- var v = n(u), g = {};
731
- Object.keys(r).forEach(function(f) {
732
- var d = e[f], y = r[f];
733
- g[f] = (y - d) * v + d;
734
- }), s.translate(g), a && s.hooks.trigger(s.hooks.eventTypes.move, g), s.pending && (s.timer = Gt(c)), s.pending || (s.callStopWhenPending ? s.callStopWhenPending = !1 : s.hooks.trigger(s.hooks.eventTypes.end, r));
735
- };
736
- this.setPending(!0), this.callStopWhenPending && this.setCallStop(!1), O(this.timer), c();
737
- }, t.prototype.doStop = function() {
738
- var e = this.pending;
739
- if (this.setForceStopped(!1), this.setCallStop(!1), e) {
740
- this.setPending(!1), O(this.timer);
741
- var r = this.translater.getComputedPosition();
742
- this.setForceStopped(!0), this.setCallStop(!0), this.hooks.trigger(this.hooks.eventTypes.forceStop, r);
743
- }
744
- return e;
745
- }, t.prototype.stop = function() {
746
- var e = this.doStop();
747
- e && this.hooks.trigger(this.hooks.eventTypes.callStop);
748
- }, t;
749
- }(Zt)
750
- );
751
- function Ye(o, t, e) {
752
- var r = e.useTransition, i = {};
753
- return Object.defineProperty(i, "probeType", {
754
- enumerable: !0,
755
- configurable: !1,
756
- get: function() {
757
- return e.probeType;
434
+ function T(l) {
435
+ const { columnsType: i } = n, t = i.indexOf(l), u = o.value[t];
436
+ return u ? Number(u) : l === "year" ? (/* @__PURE__ */ new Date()).getFullYear() : l === "month" ? (/* @__PURE__ */ new Date()).getMonth() + 1 : (/* @__PURE__ */ new Date()).getDate();
758
437
  }
759
- }), r ? new xe(o, t, i) : new Ae(o, t, i);
760
- }
761
- var It = (
762
- /** @class */
763
- function() {
764
- function o(t, e, r) {
765
- this.wrapper = t, this.options = r, this.hooks = new x([
766
- "beforeComputeBoundary",
767
- "computeBoundary",
768
- "momentum",
769
- "end",
770
- "ignoreHasScroll"
771
- ]), this.refresh(e);
438
+ function b(l) {
439
+ r("update:modelValue", l), s.value = l, r("confirm", l);
772
440
  }
773
- return o.prototype.start = function() {
774
- this.dist = 0, this.setMovingDirection(
775
- 0
776
- /* Default */
777
- ), this.setDirection(
778
- 0
779
- /* Default */
780
- );
781
- }, o.prototype.move = function(t) {
782
- return t = this.hasScroll ? t : 0, this.setMovingDirection(t), this.performDampingAlgorithm(t, this.options.outOfBoundaryDampingFactor);
783
- }, o.prototype.setMovingDirection = function(t) {
784
- this.movingDirection = t > 0 ? -1 : t < 0 ? 1 : 0;
785
- }, o.prototype.setDirection = function(t) {
786
- this.direction = t > 0 ? -1 : t < 0 ? 1 : 0;
787
- }, o.prototype.performDampingAlgorithm = function(t, e) {
788
- var r = this.currentPos + t;
789
- return (r > this.minScrollPos || r < this.maxScrollPos) && (r > this.minScrollPos && this.options.bounces[0] || r < this.maxScrollPos && this.options.bounces[1] ? r = this.currentPos + t * e : r = r > this.minScrollPos ? this.minScrollPos : this.maxScrollPos), r;
790
- }, o.prototype.end = function(t) {
791
- var e = {
792
- duration: 0
793
- }, r = Math.abs(this.currentPos - this.startPos);
794
- if (this.options.momentum && t < this.options.momentumLimitTime && r > this.options.momentumLimitDistance) {
795
- var i = this.direction === -1 && this.options.bounces[0] || this.direction === 1 && this.options.bounces[1] ? this.wrapperSize : 0;
796
- e = this.hasScroll ? this.momentum(this.currentPos, this.startPos, t, this.maxScrollPos, this.minScrollPos, i, this.options) : { destination: this.currentPos, duration: 0 };
797
- } else
798
- this.hooks.trigger(this.hooks.eventTypes.end, e);
799
- return e;
800
- }, o.prototype.momentum = function(t, e, r, i, n, s, l) {
801
- l === void 0 && (l = this.options);
802
- var h = t - e, a = Math.abs(h) / r, c = l.deceleration, u = l.swipeBounceTime, v = l.swipeTime, g = Math.min(v, a * 2 / c), f = {
803
- destination: t + a * a / c * (h < 0 ? -1 : 1),
804
- duration: g,
805
- rate: 15
806
- };
807
- return this.hooks.trigger(this.hooks.eventTypes.momentum, f, h), f.destination < i ? (f.destination = s ? Math.max(i - s / 4, i - s / f.rate * a) : i, f.duration = u) : f.destination > n && (f.destination = s ? Math.min(n + s / 4, n + s / f.rate * a) : n, f.duration = u), f.destination = Math.round(f.destination), f;
808
- }, o.prototype.updateDirection = function() {
809
- var t = this.currentPos - this.absStartPos;
810
- this.setDirection(t);
811
- }, o.prototype.refresh = function(t) {
812
- var e = this.options.rect, r = e.size, i = e.position, n = window.getComputedStyle(this.wrapper, null).position === "static", s = _t(this.wrapper);
813
- this.wrapperSize = this.wrapper[r === "width" ? "clientWidth" : "clientHeight"], this.setContent(t);
814
- var l = _t(this.content);
815
- this.contentSize = l[r], this.relativeOffset = l[i], n && (this.relativeOffset -= s[i]), this.computeBoundary(), this.setDirection(
816
- 0
817
- /* Default */
818
- );
819
- }, o.prototype.setContent = function(t) {
820
- t !== this.content && (this.content = t, this.resetState());
821
- }, o.prototype.resetState = function() {
822
- this.currentPos = 0, this.startPos = 0, this.dist = 0, this.setDirection(
823
- 0
824
- /* Default */
825
- ), this.setMovingDirection(
826
- 0
827
- /* Default */
828
- ), this.resetStartPos();
829
- }, o.prototype.computeBoundary = function() {
830
- this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);
831
- var t = {
832
- minScrollPos: 0,
833
- maxScrollPos: this.wrapperSize - this.contentSize
834
- };
835
- t.maxScrollPos < 0 && (t.maxScrollPos -= this.relativeOffset, this.options.specifiedIndexAsContent === 0 && (t.minScrollPos = -this.relativeOffset)), this.hooks.trigger(this.hooks.eventTypes.computeBoundary, t), this.minScrollPos = t.minScrollPos, this.maxScrollPos = t.maxScrollPos, this.hasScroll = this.options.scrollable && this.maxScrollPos < this.minScrollPos, !this.hasScroll && this.minScrollPos < this.maxScrollPos && (this.maxScrollPos = this.minScrollPos, this.contentSize = this.wrapperSize);
836
- }, o.prototype.updatePosition = function(t) {
837
- this.currentPos = t;
838
- }, o.prototype.getCurrentPos = function() {
839
- return this.currentPos;
840
- }, o.prototype.checkInBoundary = function() {
841
- var t = this.adjustPosition(this.currentPos), e = t === this.getCurrentPos();
842
- return {
843
- position: t,
844
- inBoundary: e
845
- };
846
- }, o.prototype.adjustPosition = function(t) {
847
- return !this.hasScroll && !this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll) ? t = this.minScrollPos : t > this.minScrollPos ? t = this.minScrollPos : t < this.maxScrollPos && (t = this.maxScrollPos), t;
848
- }, o.prototype.updateStartPos = function() {
849
- this.startPos = this.currentPos;
850
- }, o.prototype.updateAbsStartPos = function() {
851
- this.absStartPos = this.currentPos;
852
- }, o.prototype.resetStartPos = function() {
853
- this.updateStartPos(), this.updateAbsStartPos();
854
- }, o.prototype.getAbsDist = function(t) {
855
- return this.dist += t, Math.abs(this.dist);
856
- }, o.prototype.destroy = function() {
857
- this.hooks.destroy();
858
- }, o;
859
- }()
860
- ), U, q, G, Z, Ht = (U = {}, U.yes = function(o) {
861
- return !0;
862
- }, U.no = function(o) {
863
- return $t(o), !1;
864
- }, U), Me = (q = {}, q.horizontal = (G = {}, G.yes = "horizontal", G.no = "vertical", G), q.vertical = (Z = {}, Z.yes = "vertical", Z.no = "horizontal", Z), q), Xe = (
865
- /** @class */
866
- function() {
867
- function o(t, e, r) {
868
- this.directionLockThreshold = t, this.freeScroll = e, this.eventPassthrough = r, this.reset();
441
+ function M() {
442
+ r("cancel");
869
443
  }
870
- return o.prototype.reset = function() {
871
- this.directionLocked = "";
872
- }, o.prototype.checkMovingDirection = function(t, e, r) {
873
- return this.computeDirectionLock(t, e), this.handleEventPassthrough(r);
874
- }, o.prototype.adjustDelta = function(t, e) {
875
- return this.directionLocked === "horizontal" ? e = 0 : this.directionLocked === "vertical" && (t = 0), {
876
- deltaX: t,
877
- deltaY: e
878
- };
879
- }, o.prototype.computeDirectionLock = function(t, e) {
880
- this.directionLocked === "" && !this.freeScroll && (t > e + this.directionLockThreshold ? this.directionLocked = "horizontal" : e >= t + this.directionLockThreshold ? this.directionLocked = "vertical" : this.directionLocked = "none");
881
- }, o.prototype.handleEventPassthrough = function(t) {
882
- var e = Me[this.directionLocked];
883
- if (e) {
884
- if (this.eventPassthrough === e.yes)
885
- return Ht.yes(t);
886
- if (this.eventPassthrough === e.no)
887
- return Ht.no(t);
444
+ function D() {
445
+ if (r("open"), n.modelValue && n.modelValue.length) {
446
+ o.value = [...n.modelValue];
447
+ return;
888
448
  }
889
- return !1;
890
- }, o;
891
- }()
892
- ), Oe = function(o, t, e) {
893
- return e === 2 ? [t, -o] : e === 3 ? [-o, -t] : e === 4 ? [-t, o] : [o, t];
894
- }, _e = (
895
- /** @class */
896
- function() {
897
- function o(t, e, r, i, n) {
898
- this.hooks = new x([
899
- "start",
900
- "beforeMove",
901
- "scrollStart",
902
- "scroll",
903
- "beforeEnd",
904
- "end",
905
- "scrollEnd",
906
- "contentNotMoved",
907
- "detectMovingDirection",
908
- "coordinateTransformation"
909
- ]), this.scrollBehaviorX = t, this.scrollBehaviorY = e, this.actionsHandler = r, this.animater = i, this.options = n, this.directionLockAction = new Xe(n.directionLockThreshold, n.freeScroll, n.eventPassthrough), this.enabled = !0, this.bindActionsHandler();
449
+ const { columnsType: l } = n;
450
+ o.value = l.map((i) => T(i));
910
451
  }
911
- return o.prototype.bindActionsHandler = function() {
912
- var t = this;
913
- this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start, function(e) {
914
- return t.enabled ? t.handleStart(e) : !0;
915
- }), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move, function(e) {
916
- var r = e.deltaX, i = e.deltaY, n = e.e;
917
- if (!t.enabled)
918
- return !0;
919
- var s = Oe(r, i, t.options.quadrant), l = s[0], h = s[1], a = {
920
- deltaX: l,
921
- deltaY: h
922
- };
923
- return t.hooks.trigger(t.hooks.eventTypes.coordinateTransformation, a), t.handleMove(a.deltaX, a.deltaY, n);
924
- }), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end, function(e) {
925
- return t.enabled ? t.handleEnd(e) : !0;
926
- }), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click, function(e) {
927
- t.enabled && !e._constructed && t.handleClick(e);
928
- });
929
- }, o.prototype.handleStart = function(t) {
930
- var e = X();
931
- this.fingerMoved = !1, this.contentMoved = !1, this.startTime = e, this.directionLockAction.reset(), this.scrollBehaviorX.start(), this.scrollBehaviorY.start(), this.animater.doStop(), this.scrollBehaviorX.resetStartPos(), this.scrollBehaviorY.resetStartPos(), this.hooks.trigger(this.hooks.eventTypes.start, t);
932
- }, o.prototype.handleMove = function(t, e, r) {
933
- if (!this.hooks.trigger(this.hooks.eventTypes.beforeMove, r)) {
934
- var i = this.scrollBehaviorX.getAbsDist(t), n = this.scrollBehaviorY.getAbsDist(e), s = X();
935
- if (this.checkMomentum(i, n, s))
936
- return !0;
937
- if (this.directionLockAction.checkMovingDirection(i, n, r))
938
- return this.actionsHandler.setInitiated(), !0;
939
- var l = this.directionLockAction.adjustDelta(t, e), h = this.scrollBehaviorX.getCurrentPos(), a = this.scrollBehaviorX.move(l.deltaX), c = this.scrollBehaviorY.getCurrentPos(), u = this.scrollBehaviorY.move(l.deltaY);
940
- if (!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)) {
941
- this.fingerMoved || (this.fingerMoved = !0);
942
- var v = a !== h || u !== c;
943
- !this.contentMoved && !v && this.hooks.trigger(this.hooks.eventTypes.contentNotMoved), !this.contentMoved && v && (this.contentMoved = !0, this.hooks.trigger(this.hooks.eventTypes.scrollStart)), this.contentMoved && v && (this.animater.translate({
944
- x: a,
945
- y: u
946
- }), this.dispatchScroll(s));
947
- }
948
- }
949
- }, o.prototype.dispatchScroll = function(t) {
950
- t - this.startTime > this.options.momentumLimitTime && (this.startTime = t, this.scrollBehaviorX.updateStartPos(), this.scrollBehaviorY.updateStartPos(), this.options.probeType === 1 && this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos())), this.options.probeType > 1 && this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos());
951
- }, o.prototype.checkMomentum = function(t, e, r) {
952
- return r - this.endTime > this.options.momentumLimitTime && e < this.options.momentumLimitDistance && t < this.options.momentumLimitDistance;
953
- }, o.prototype.handleEnd = function(t) {
954
- if (!this.hooks.trigger(this.hooks.eventTypes.beforeEnd, t)) {
955
- var e = this.getCurrentPos();
956
- if (this.scrollBehaviorX.updateDirection(), this.scrollBehaviorY.updateDirection(), this.hooks.trigger(this.hooks.eventTypes.end, t, e))
957
- return !0;
958
- e = this.ensureIntegerPos(e), this.animater.translate(e), this.endTime = X();
959
- var r = this.endTime - this.startTime;
960
- this.hooks.trigger(this.hooks.eventTypes.scrollEnd, e, r);
961
- }
962
- }, o.prototype.ensureIntegerPos = function(t) {
963
- this.ensuringInteger = !0;
964
- var e = t.x, r = t.y, i = this.scrollBehaviorX, n = i.minScrollPos, s = i.maxScrollPos, l = this.scrollBehaviorY, h = l.minScrollPos, a = l.maxScrollPos;
965
- return e = e > 0 ? Math.ceil(e) : Math.floor(e), r = r > 0 ? Math.ceil(r) : Math.floor(r), e = Mt(e, s, n), r = Mt(r, a, h), { x: e, y: r };
966
- }, o.prototype.handleClick = function(t) {
967
- K(t.target, this.options.preventDefaultException) || ($t(t), t.stopPropagation());
968
- }, o.prototype.getCurrentPos = function() {
969
- return {
970
- x: this.scrollBehaviorX.getCurrentPos(),
971
- y: this.scrollBehaviorY.getCurrentPos()
972
- };
973
- }, o.prototype.refresh = function() {
974
- this.endTime = 0;
975
- }, o.prototype.destroy = function() {
976
- this.hooks.destroy();
977
- }, o;
978
- }()
979
- );
980
- function Le(o) {
981
- var t = [
982
- "click",
983
- "bindToWrapper",
984
- "disableMouse",
985
- "disableTouch",
986
- "preventDefault",
987
- "stopPropagation",
988
- "tagException",
989
- "preventDefaultException",
990
- "autoEndDistance"
991
- ].reduce(function(e, r) {
992
- return e[r] = o[r], e;
993
- }, {});
994
- return t;
995
- }
996
- function Ft(o, t, e, r) {
997
- var i = [
998
- "momentum",
999
- "momentumLimitTime",
1000
- "momentumLimitDistance",
1001
- "deceleration",
1002
- "swipeBounceTime",
1003
- "swipeTime",
1004
- "outOfBoundaryDampingFactor",
1005
- "specifiedIndexAsContent"
1006
- ].reduce(function(n, s) {
1007
- return n[s] = o[s], n;
1008
- }, {});
1009
- return i.scrollable = !!o[t], i.bounces = e, i.rect = r, i;
1010
- }
1011
- function Tt(o, t, e) {
1012
- e.forEach(function(r) {
1013
- var i, n;
1014
- typeof r == "string" ? i = n = r : (i = r.source, n = r.target), o.on(i, function() {
1015
- for (var s = [], l = 0; l < arguments.length; l++)
1016
- s[l] = arguments[l];
1017
- return t.trigger.apply(t, Kt([n], s));
1018
- });
1019
- });
1020
- }
1021
- function Ie(o, t) {
1022
- for (var e = Object.keys(o), r = 0, i = e; r < i.length; r++) {
1023
- var n = i[r];
1024
- if (o[n] !== t[n])
1025
- return !1;
1026
- }
1027
- return !0;
1028
- }
1029
- var Wt = 1, He = (
1030
- /** @class */
1031
- function() {
1032
- function o(t, e, r) {
1033
- this.wrapper = t, this.content = e, this.resizeTimeout = 0, this.hooks = new x([
1034
- "beforeStart",
1035
- "beforeMove",
1036
- "beforeScrollStart",
1037
- "scrollStart",
1038
- "scroll",
1039
- "beforeEnd",
1040
- "scrollEnd",
1041
- "resize",
1042
- "touchEnd",
1043
- "end",
1044
- "flick",
1045
- "scrollCancel",
1046
- "momentum",
1047
- "scrollTo",
1048
- "minDistanceScroll",
1049
- "scrollToElement",
1050
- "beforeRefresh"
1051
- ]), this.options = r;
1052
- var i = this.options.bounce, n = i.left, s = i.right, l = i.top, h = i.bottom;
1053
- this.scrollBehaviorX = new It(t, e, Ft(r, "scrollX", [n, s], {
1054
- size: "width",
1055
- position: "left"
1056
- })), this.scrollBehaviorY = new It(t, e, Ft(r, "scrollY", [l, h], {
1057
- size: "height",
1058
- position: "top"
1059
- })), this.translater = new De(this.content), this.animater = Ye(this.content, this.translater, this.options), this.actionsHandler = new Ce(this.options.bindToTarget ? this.content : t, Le(this.options)), this.actions = new _e(this.scrollBehaviorX, this.scrollBehaviorY, this.actionsHandler, this.animater, this.options);
1060
- var a = this.resize.bind(this);
1061
- this.resizeRegister = new tt(window, [
1062
- {
1063
- name: "orientationchange",
1064
- handler: a
1065
- },
1066
- {
1067
- name: "resize",
1068
- handler: a
1069
- }
1070
- ]), this.registerTransitionEnd(), this.init();
452
+ function V() {
453
+ o.value = n.modelValue ? [...n.modelValue] : [...s.value], r("closed");
1071
454
  }
1072
- return o.prototype.init = function() {
1073
- var t = this;
1074
- this.bindTranslater(), this.bindAnimater(), this.bindActions(), this.hooks.on(this.hooks.eventTypes.scrollEnd, function() {
1075
- t.togglePointerEvents(!0);
1076
- });
1077
- }, o.prototype.registerTransitionEnd = function() {
1078
- this.transitionEndRegister = new tt(this.content, [
1079
- {
1080
- name: M.transitionEnd,
1081
- handler: this.transitionEnd.bind(this)
1082
- }
1083
- ]);
1084
- }, o.prototype.bindTranslater = function() {
1085
- var t = this, e = this.translater.hooks;
1086
- e.on(e.eventTypes.beforeTranslate, function(r) {
1087
- t.options.translateZ && r.push(t.options.translateZ);
1088
- }), e.on(e.eventTypes.translate, function(r) {
1089
- var i = t.getCurrentPos();
1090
- if (t.updatePositions(r), t.actions.ensuringInteger === !0) {
1091
- t.actions.ensuringInteger = !1;
1092
- return;
1093
- }
1094
- (r.x !== i.x || r.y !== i.y) && t.togglePointerEvents(!1);
1095
- });
1096
- }, o.prototype.bindAnimater = function() {
1097
- var t = this;
1098
- this.animater.hooks.on(this.animater.hooks.eventTypes.end, function(e) {
1099
- t.resetPosition(t.options.bounceTime) || (t.animater.setPending(!1), t.hooks.trigger(t.hooks.eventTypes.scrollEnd, e));
1100
- }), Tt(this.animater.hooks, this.hooks, [
1101
- {
1102
- source: this.animater.hooks.eventTypes.move,
1103
- target: this.hooks.eventTypes.scroll
1104
- },
1105
- {
1106
- source: this.animater.hooks.eventTypes.forceStop,
1107
- target: this.hooks.eventTypes.scrollEnd
1108
- }
1109
- ]);
1110
- }, o.prototype.bindActions = function() {
1111
- var t = this, e = this.actions;
1112
- Tt(e.hooks, this.hooks, [
1113
- {
1114
- source: e.hooks.eventTypes.start,
1115
- target: this.hooks.eventTypes.beforeStart
1116
- },
1117
- {
1118
- source: e.hooks.eventTypes.start,
1119
- target: this.hooks.eventTypes.beforeScrollStart
1120
- },
1121
- {
1122
- source: e.hooks.eventTypes.beforeMove,
1123
- target: this.hooks.eventTypes.beforeMove
1124
- },
1125
- {
1126
- source: e.hooks.eventTypes.scrollStart,
1127
- target: this.hooks.eventTypes.scrollStart
1128
- },
1129
- {
1130
- source: e.hooks.eventTypes.scroll,
1131
- target: this.hooks.eventTypes.scroll
1132
- },
1133
- {
1134
- source: e.hooks.eventTypes.beforeEnd,
1135
- target: this.hooks.eventTypes.beforeEnd
1136
- }
1137
- ]), e.hooks.on(e.hooks.eventTypes.end, function(r, i) {
1138
- if (t.hooks.trigger(t.hooks.eventTypes.touchEnd, i), t.hooks.trigger(t.hooks.eventTypes.end, i) || !e.fingerMoved && (t.hooks.trigger(t.hooks.eventTypes.scrollCancel), t.checkClick(r)))
1139
- return !0;
1140
- if (t.resetPosition(t.options.bounceTime, Y.bounce))
1141
- return t.animater.setForceStopped(!1), !0;
1142
- }), e.hooks.on(e.hooks.eventTypes.scrollEnd, function(r, i) {
1143
- var n = Math.abs(r.x - t.scrollBehaviorX.startPos), s = Math.abs(r.y - t.scrollBehaviorY.startPos);
1144
- if (t.checkFlick(i, n, s)) {
1145
- t.animater.setForceStopped(!1), t.hooks.trigger(t.hooks.eventTypes.flick);
1146
- return;
1147
- }
1148
- if (t.momentum(r, i)) {
1149
- t.animater.setForceStopped(!1);
1150
- return;
1151
- }
1152
- e.contentMoved && t.hooks.trigger(t.hooks.eventTypes.scrollEnd, r), t.animater.forceStopped && t.animater.setForceStopped(!1);
1153
- });
1154
- }, o.prototype.checkFlick = function(t, e, r) {
1155
- var i = 1;
1156
- if (this.hooks.events.flick.length > 1 && t < this.options.flickLimitTime && e < this.options.flickLimitDistance && r < this.options.flickLimitDistance && (r > i || e > i))
1157
- return !0;
1158
- }, o.prototype.momentum = function(t, e) {
1159
- var r = {
1160
- time: 0,
1161
- easing: Y.swiper,
1162
- newX: t.x,
1163
- newY: t.y
1164
- }, i = this.scrollBehaviorX.end(e), n = this.scrollBehaviorY.end(e);
1165
- if (r.newX = kt(i.destination) ? r.newX : i.destination, r.newY = kt(n.destination) ? r.newY : n.destination, r.time = Math.max(i.duration, n.duration), this.hooks.trigger(this.hooks.eventTypes.momentum, r, this), r.newX !== t.x || r.newY !== t.y)
1166
- return (r.newX > this.scrollBehaviorX.minScrollPos || r.newX < this.scrollBehaviorX.maxScrollPos || r.newY > this.scrollBehaviorY.minScrollPos || r.newY < this.scrollBehaviorY.maxScrollPos) && (r.easing = Y.swipeBounce), this.scrollTo(r.newX, r.newY, r.time, r.easing), !0;
1167
- }, o.prototype.checkClick = function(t) {
1168
- var e = {
1169
- preventClick: this.animater.forceStopped
1170
- };
1171
- if (this.hooks.trigger(this.hooks.eventTypes.checkClick))
1172
- return this.animater.setForceStopped(!1), !0;
1173
- if (!e.preventClick) {
1174
- var r = this.options.dblclick, i = !1;
1175
- if (r && this.lastClickTime) {
1176
- var n = r.delay, s = n === void 0 ? 300 : n;
1177
- X() - this.lastClickTime < s && (i = !0, ke(t));
1178
- }
1179
- return this.options.tap && ge(t, this.options.tap), this.options.click && !K(t.target, this.options.preventDefaultException) && Ut(t), this.lastClickTime = i ? null : X(), !0;
1180
- }
1181
- return !1;
1182
- }, o.prototype.resize = function() {
1183
- var t = this;
1184
- this.actions.enabled && (he && (this.wrapper.scrollTop = 0), clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(function() {
1185
- t.hooks.trigger(t.hooks.eventTypes.resize);
1186
- }, this.options.resizePolling));
1187
- }, o.prototype.transitionEnd = function(t) {
1188
- if (!(t.target !== this.content || !this.animater.pending)) {
1189
- var e = this.animater;
1190
- e.transitionTime(), this.resetPosition(this.options.bounceTime, Y.bounce) || (this.animater.setPending(!1), this.options.probeType !== 3 && this.hooks.trigger(this.hooks.eventTypes.scrollEnd, this.getCurrentPos()));
1191
- }
1192
- }, o.prototype.togglePointerEvents = function(t) {
1193
- t === void 0 && (t = !0);
1194
- for (var e = this.content.children.length ? this.content.children : [this.content], r = t ? "auto" : "none", i = 0; i < e.length; i++) {
1195
- var n = e[i];
1196
- n.isBScrollContainer || (n.style.pointerEvents = r);
1197
- }
1198
- }, o.prototype.refresh = function(t) {
1199
- var e = this.setContent(t);
1200
- this.hooks.trigger(this.hooks.eventTypes.beforeRefresh), this.scrollBehaviorX.refresh(t), this.scrollBehaviorY.refresh(t), e && (this.translater.setContent(t), this.animater.setContent(t), this.transitionEndRegister.destroy(), this.registerTransitionEnd(), this.options.bindToTarget && this.actionsHandler.setContent(t)), this.actions.refresh(), this.wrapperOffset = Xt(this.wrapper);
1201
- }, o.prototype.setContent = function(t) {
1202
- var e = t !== this.content;
1203
- return e && (this.content = t), e;
1204
- }, o.prototype.scrollBy = function(t, e, r, i) {
1205
- r === void 0 && (r = 0);
1206
- var n = this.getCurrentPos(), s = n.x, l = n.y;
1207
- i = i || Y.bounce, t += s, e += l, this.scrollTo(t, e, r, i);
1208
- }, o.prototype.scrollTo = function(t, e, r, i, n) {
1209
- r === void 0 && (r = 0), i === void 0 && (i = Y.bounce), n === void 0 && (n = {
1210
- start: {},
1211
- end: {}
1212
- });
1213
- var s = this.options.useTransition ? i.style : i.fn, l = this.getCurrentPos(), h = N({ x: l.x, y: l.y }, n.start), a = N({
1214
- x: t,
1215
- y: e
1216
- }, n.end);
1217
- if (this.hooks.trigger(this.hooks.eventTypes.scrollTo, a), !Ie(h, a)) {
1218
- var c = Math.abs(a.x - h.x), u = Math.abs(a.y - h.y);
1219
- c < Wt && u < Wt && (r = 0, this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)), this.animater.move(h, a, r, s);
1220
- }
1221
- }, o.prototype.scrollToElement = function(t, e, r, i, n) {
1222
- var s = Vt(t), l = Xt(s), h = function(c, u, v) {
1223
- return typeof c == "number" ? c : c ? Math.round(u / 2 - v / 2) : 0;
1224
- };
1225
- r = h(r, s.offsetWidth, this.wrapper.offsetWidth), i = h(i, s.offsetHeight, this.wrapper.offsetHeight);
1226
- var a = function(c, u, v, g) {
1227
- return c -= u, c = g.adjustPosition(c - v), c;
455
+ return (l, i) => (I(), E(ie, {
456
+ modelValue: o.value,
457
+ "onUpdate:modelValue": i[0] || (i[0] = (t) => o.value = t),
458
+ show: p.value,
459
+ "onUpdate:show": i[1] || (i[1] = (t) => p.value = t),
460
+ title: l.title,
461
+ columns: g.value,
462
+ teleport: l.teleport,
463
+ "confirm-button-text": l.confirmButtonText,
464
+ "cancel-button-text": l.cancelButtonText,
465
+ linkage: "",
466
+ onConfirm: b,
467
+ onCancel: M,
468
+ onOpen: D,
469
+ onClosed: V
470
+ }, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
471
+ }
472
+ }), Ge = /* @__PURE__ */ L({
473
+ __name: "TimePicker",
474
+ props: {
475
+ show: { type: Boolean },
476
+ modelValue: {},
477
+ title: { default: Le },
478
+ columnsType: { default: () => Be },
479
+ minTime: {},
480
+ maxTime: {},
481
+ teleport: {},
482
+ confirmButtonText: {},
483
+ cancelButtonText: {},
484
+ formatHourLabel: { type: Function, default: U },
485
+ formatMinuteLabel: { type: Function, default: U },
486
+ formatSecondLabel: { type: Function, default: U }
487
+ },
488
+ emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
489
+ setup(e, { emit: a }) {
490
+ const n = e, r = a, o = C([]), s = C([]), p = O({
491
+ get: () => n.show,
492
+ set: (t) => r("update:show", t)
493
+ }), g = O(() => {
494
+ const { columnsType: t } = n, u = {
495
+ hour: k,
496
+ minute: T,
497
+ second: b
1228
498
  };
1229
- l.left = a(l.left, this.wrapperOffset.left, r, this.scrollBehaviorX), l.top = a(l.top, this.wrapperOffset.top, i, this.scrollBehaviorY), !this.hooks.trigger(this.hooks.eventTypes.scrollToElement, s, l) && this.scrollTo(l.left, l.top, e, n);
1230
- }, o.prototype.resetPosition = function(t, e) {
1231
- t === void 0 && (t = 0), e === void 0 && (e = Y.bounce);
1232
- var r = this.scrollBehaviorX.checkInBoundary(), i = r.position, n = r.inBoundary, s = this.scrollBehaviorY.checkInBoundary(), l = s.position, h = s.inBoundary;
1233
- return n && h ? !1 : (ce && this.reflow(), this.scrollTo(i, l, t, e), !0);
1234
- }, o.prototype.reflow = function() {
1235
- this._reflow = this.content.offsetHeight;
1236
- }, o.prototype.updatePositions = function(t) {
1237
- this.scrollBehaviorX.updatePosition(t.x), this.scrollBehaviorY.updatePosition(t.y);
1238
- }, o.prototype.getCurrentPos = function() {
1239
- return this.actions.getCurrentPos();
1240
- }, o.prototype.enable = function() {
1241
- this.actions.enabled = !0;
1242
- }, o.prototype.disable = function() {
1243
- O(this.animater.timer), this.actions.enabled = !1;
1244
- }, o.prototype.destroy = function() {
1245
- var t = this, e = [
1246
- "resizeRegister",
1247
- "transitionEndRegister",
1248
- "actionsHandler",
1249
- "actions",
1250
- "hooks",
1251
- "animater",
1252
- "translater",
1253
- "scrollBehaviorX",
1254
- "scrollBehaviorY"
1255
- ];
1256
- e.forEach(function(r) {
1257
- return t[r].destroy();
1258
- });
1259
- }, o;
1260
- }()
1261
- ), it = (
1262
- /** @class */
1263
- function(o) {
1264
- rt(t, o);
1265
- function t(e, r) {
1266
- var i = o.call(this, [
1267
- "refresh",
1268
- "contentChanged",
1269
- "enable",
1270
- "disable",
1271
- "beforeScrollStart",
1272
- "scrollStart",
1273
- "scroll",
1274
- "scrollEnd",
1275
- "scrollCancel",
1276
- "touchEnd",
1277
- "flick",
1278
- "destroy"
1279
- ]) || this, n = Vt(e);
1280
- return n ? (i.plugins = {}, i.options = new Ee().merge(r).process(), i.setContent(n).valid && (i.hooks = new x([
1281
- "refresh",
1282
- "enable",
1283
- "disable",
1284
- "destroy",
1285
- "beforeInitialScrollTo",
1286
- "contentChanged"
1287
- ]), i.init(n)), i) : (Q("Can not resolve the wrapper DOM."), i);
499
+ return t.map((c) => u[c]());
500
+ }), h = O(() => oe(n.minTime ?? "") ?? { hour: 0, minute: 0, second: 0 }), d = O(() => oe(n.maxTime ?? "") ?? { hour: 23, minute: 59, second: 59 });
501
+ function k() {
502
+ const t = h.value.hour, u = d.value.hour;
503
+ return F(t, u, n.formatHourLabel);
1288
504
  }
1289
- return t.use = function(e) {
1290
- var r = e.pluginName, i = t.plugins.some(function(n) {
1291
- return e === n.ctor;
1292
- });
1293
- return i ? t : kt(r) ? (Q("Plugin Class must specify plugin's name in static property by 'pluginName' field."), t) : (t.pluginsMap[r] = !0, t.plugins.push({
1294
- name: r,
1295
- applyOrder: e.applyOrder,
1296
- ctor: e
1297
- }), t);
1298
- }, t.prototype.setContent = function(e) {
1299
- var r = !1, i = !0, n = e.children[this.options.specifiedIndexAsContent];
1300
- return n ? (r = this.content !== n, r && (this.content = n)) : (Q("The wrapper need at least one child element to be content element to scroll."), i = !1), {
1301
- valid: i,
1302
- contentChanged: r
1303
- };
1304
- }, t.prototype.init = function(e) {
1305
- var r = this;
1306
- this.wrapper = e, e.isBScrollContainer = !0, this.scroller = new He(e, this.content, this.options), this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize, function() {
1307
- r.refresh();
1308
- }), this.eventBubbling(), this.handleAutoBlur(), this.enable(), this.proxy(ae), this.applyPlugins(), this.refreshWithoutReset(this.content);
1309
- var i = this.options, n = i.startX, s = i.startY, l = {
1310
- x: n,
1311
- y: s
1312
- };
1313
- this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo, l) || this.scroller.scrollTo(l.x, l.y);
1314
- }, t.prototype.applyPlugins = function() {
1315
- var e = this, r = this.options;
1316
- t.plugins.sort(function(i, n) {
1317
- var s, l = (s = {}, s.pre = -1, s.post = 1, s), h = i.applyOrder ? l[i.applyOrder] : 0, a = n.applyOrder ? l[n.applyOrder] : 0;
1318
- return h - a;
1319
- }).forEach(function(i) {
1320
- var n = i.ctor;
1321
- r[i.name] && typeof n == "function" && (e.plugins[i.name] = new n(e));
1322
- });
1323
- }, t.prototype.handleAutoBlur = function() {
1324
- this.options.autoBlur && this.on(this.eventTypes.beforeScrollStart, function() {
1325
- var e = document.activeElement;
1326
- e && (e.tagName === "INPUT" || e.tagName === "TEXTAREA") && e.blur();
1327
- });
1328
- }, t.prototype.eventBubbling = function() {
1329
- Tt(this.scroller.hooks, this, [
1330
- this.eventTypes.beforeScrollStart,
1331
- this.eventTypes.scrollStart,
1332
- this.eventTypes.scroll,
1333
- this.eventTypes.scrollEnd,
1334
- this.eventTypes.scrollCancel,
1335
- this.eventTypes.touchEnd,
1336
- this.eventTypes.flick
1337
- ]);
1338
- }, t.prototype.refreshWithoutReset = function(e) {
1339
- this.scroller.refresh(e), this.hooks.trigger(this.hooks.eventTypes.refresh, e), this.trigger(this.eventTypes.refresh, e);
1340
- }, t.prototype.proxy = function(e) {
1341
- var r = this;
1342
- e.forEach(function(i) {
1343
- var n = i.key, s = i.sourceKey;
1344
- we(r, s, n);
1345
- });
1346
- }, t.prototype.refresh = function() {
1347
- var e = this.setContent(this.wrapper), r = e.contentChanged, i = e.valid;
1348
- if (i) {
1349
- var n = this.content;
1350
- this.refreshWithoutReset(n), r && (this.hooks.trigger(this.hooks.eventTypes.contentChanged, n), this.trigger(this.eventTypes.contentChanged, n)), this.scroller.resetPosition();
1351
- }
1352
- }, t.prototype.enable = function() {
1353
- this.scroller.enable(), this.hooks.trigger(this.hooks.eventTypes.enable), this.trigger(this.eventTypes.enable);
1354
- }, t.prototype.disable = function() {
1355
- this.scroller.disable(), this.hooks.trigger(this.hooks.eventTypes.disable), this.trigger(this.eventTypes.disable);
1356
- }, t.prototype.destroy = function() {
1357
- this.hooks.trigger(this.hooks.eventTypes.destroy), this.trigger(this.eventTypes.destroy), this.scroller.destroy();
1358
- }, t.prototype.eventRegister = function(e) {
1359
- this.registerType(e);
1360
- }, t.plugins = [], t.pluginsMap = {}, t;
1361
- }(x)
1362
- );
1363
- function R(o, t) {
1364
- var e = new it(o, t);
1365
- return e;
1366
- }
1367
- R.use = it.use;
1368
- R.plugins = it.plugins;
1369
- R.pluginsMap = it.pluginsMap;
1370
- var Fe = R;
1371
- /*!
1372
- * better-scroll / wheel
1373
- * (c) 2016-2023 ustbhuangyi
1374
- * Released under the MIT License.
1375
- */
1376
- var V = typeof window < "u", et = V && navigator.userAgent.toLowerCase();
1377
- et && et.indexOf("android") > 0;
1378
- (function() {
1379
- if (typeof et == "string") {
1380
- var o = /os (\d\d?_\d(_\d)?)/, t = o.exec(et);
1381
- if (!t)
1382
- return !1;
1383
- var e = t[1].split("_").map(function(r) {
1384
- return parseInt(r, 10);
1385
- });
1386
- return e[0] === 13 && e[1] >= 4;
1387
- }
1388
- return !1;
1389
- })();
1390
- var We = !1;
1391
- if (V) {
1392
- var ze = "test-passive";
1393
- try {
1394
- var zt = {};
1395
- Object.defineProperty(zt, "passive", {
1396
- get: function() {
1397
- We = !0;
1398
- }
1399
- }), window.addEventListener(ze, function() {
1400
- }, zt);
1401
- } catch {
1402
- }
1403
- }
1404
- var Ne = function(o, t) {
1405
- for (var e in t)
1406
- o[e] = t[e];
1407
- return o;
1408
- }, Jt = V && document.createElement("div").style, H = function() {
1409
- if (!V)
1410
- return !1;
1411
- for (var o = [
1412
- {
1413
- key: "standard",
1414
- value: "transform"
1415
- },
1416
- {
1417
- key: "webkit",
1418
- value: "webkitTransform"
1419
- },
1420
- {
1421
- key: "Moz",
1422
- value: "MozTransform"
1423
- },
1424
- {
1425
- key: "O",
1426
- value: "OTransform"
1427
- },
1428
- {
1429
- key: "ms",
1430
- value: "msTransform"
505
+ function T() {
506
+ const t = M("hour"), { hour: u, minute: c } = h.value, { hour: m, minute: y } = d.value;
507
+ return F(t === u ? c : 0, t === m ? y : 59, n.formatMinuteLabel);
1431
508
  }
1432
- ], t = 0, e = o; t < e.length; t++) {
1433
- var r = e[t];
1434
- if (Jt[r.value] !== void 0)
1435
- return r.key;
1436
- }
1437
- return !1;
1438
- }();
1439
- function C(o) {
1440
- return H === !1 ? o : H === "standard" ? o === "transitionEnd" ? "transitionend" : o : H + o.charAt(0).toUpperCase() + o.substr(1);
1441
- }
1442
- H && H !== "standard" && "" + H.toLowerCase();
1443
- var Ke = C("transform"), Re = C("transition");
1444
- V && C("perspective") in Jt;
1445
- var dt = {
1446
- transform: Ke,
1447
- transition: Re,
1448
- transitionTimingFunction: C("transitionTimingFunction"),
1449
- transitionDuration: C("transitionDuration"),
1450
- transitionDelay: C("transitionDelay"),
1451
- transformOrigin: C("transformOrigin"),
1452
- transitionEnd: C("transitionEnd"),
1453
- transitionProperty: C("transitionProperty")
1454
- };
1455
- function J(o, t) {
1456
- var e = new RegExp("(^|\\s)" + t + "(\\s|$)");
1457
- return e.test(o.className);
1458
- }
1459
- function Ve(o) {
1460
- return Array.prototype.slice.call(o, 0);
1461
- }
1462
- var $e = {
1463
- // easeOutQuint
1464
- swipe: {
1465
- style: "cubic-bezier(0.23, 1, 0.32, 1)",
1466
- fn: function(o) {
1467
- return 1 + --o * o * o * o * o;
509
+ function b() {
510
+ const t = M("hour"), u = M("minute"), { hour: c, minute: m, second: y } = h.value, { hour: x, minute: f, second: w } = d.value;
511
+ return F(t === c && u === m ? y : 0, t === x && u === f ? w : 59, n.formatSecondLabel);
1468
512
  }
1469
- },
1470
- // easeOutQuard
1471
- swipeBounce: {
1472
- style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
1473
- fn: function(o) {
1474
- return o * (2 - o);
513
+ function M(t) {
514
+ const { columnsType: u } = n, c = u.indexOf(t), m = o.value[c];
515
+ return m !== void 0 ? Number(m) : t === "hour" ? (/* @__PURE__ */ new Date()).getHours() : t === "minute" ? (/* @__PURE__ */ new Date()).getMinutes() : (/* @__PURE__ */ new Date()).getSeconds();
1475
516
  }
1476
- },
1477
- // easeOutQuart
1478
- bounce: {
1479
- style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
1480
- fn: function(o) {
1481
- return 1 - --o * o * o * o;
517
+ function D(t) {
518
+ r("update:modelValue", t), s.value = t, r("confirm", t);
1482
519
  }
1483
- }
1484
- }, je = "plugins.wheel", Ue = [
1485
- {
1486
- key: "wheelTo",
1487
- name: "wheelTo"
1488
- },
1489
- {
1490
- key: "getSelectedIndex",
1491
- name: "getSelectedIndex"
1492
- },
1493
- {
1494
- key: "restorePosition",
1495
- name: "restorePosition"
1496
- }
1497
- ], qe = Ue.map(function(o) {
1498
- return {
1499
- key: o.key,
1500
- sourceKey: je + "." + o.name
1501
- };
1502
- }), Nt = "wheelIndexChanged", Ge = {
1503
- rate: 4
1504
- }, Ze = (
1505
- /** @class */
1506
- function() {
1507
- function o(t) {
1508
- this.scroll = t, this.init();
520
+ function V() {
521
+ r("cancel");
1509
522
  }
1510
- return o.prototype.init = function() {
1511
- this.handleBScroll(), this.handleOptions(), this.handleHooks(), this.refreshBoundary(), this.setSelectedIndex(this.options.selectedIndex);
1512
- }, o.prototype.handleBScroll = function() {
1513
- this.scroll.proxy(qe), this.scroll.registerType([Nt]);
1514
- }, o.prototype.handleOptions = function() {
1515
- var t = this.scroll.options.wheel === !0 ? {} : this.scroll.options.wheel, e = {
1516
- wheelWrapperClass: "wheel-scroll",
1517
- wheelItemClass: "wheel-item",
1518
- rotate: 25,
1519
- adjustTime: 400,
1520
- selectedIndex: 0,
1521
- wheelDisabledItemClass: "wheel-disabled-item"
1522
- };
1523
- this.options = Ne(e, t);
1524
- }, o.prototype.handleHooks = function() {
1525
- var t = this, e = this.scroll, r = this.scroll.scroller, i = r.actionsHandler, n = r.scrollBehaviorX, s = r.scrollBehaviorY, l = r.animater, h = r.content;
1526
- e.on(e.eventTypes.scrollEnd, function(a) {
1527
- var c = t.findNearestValidWheel(a.y).index;
1528
- if (r.animater.forceStopped && !t.isAdjustingPosition)
1529
- return t.target = t.items[c], !0;
1530
- t.setSelectedIndex(c), t.isAdjustingPosition && (t.isAdjustingPosition = !1);
1531
- }), this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh, function(a) {
1532
- a !== h && (h = a, t.setSelectedIndex(t.options.selectedIndex, !0)), t.rotateX(t.scroll.y), t.wheelTo(t.selectedIndex, 0);
1533
- }), this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo, function(a) {
1534
- a.x = 0, a.y = -(t.selectedIndex * t.itemHeight);
1535
- }), r.hooks.on(r.hooks.eventTypes.checkClick, function() {
1536
- var a = Ve(t.items).indexOf(t.target);
1537
- return a === -1 || t.wheelTo(a, t.options.adjustTime, $e.swipe), !0;
1538
- }), r.hooks.on(r.hooks.eventTypes.scrollTo, function(a) {
1539
- a.y = t.findNearestValidWheel(a.y).y;
1540
- }), r.hooks.on(r.hooks.eventTypes.minDistanceScroll, function() {
1541
- var a = r.animater;
1542
- a.forceStopped === !0 && (a.forceStopped = !1);
1543
- }), r.hooks.on(r.hooks.eventTypes.scrollToElement, function(a, c) {
1544
- if (J(a, t.options.wheelItemClass))
1545
- c.top = t.findNearestValidWheel(c.top).y;
1546
- else
1547
- return !0;
1548
- }), i.hooks.on(i.hooks.eventTypes.beforeStart, function(a) {
1549
- t.target = a.target;
1550
- }), n.hooks.on(n.hooks.eventTypes.computeBoundary, function(a) {
1551
- a.maxScrollPos = 0, a.minScrollPos = 0;
1552
- }), s.hooks.on(s.hooks.eventTypes.computeBoundary, function(a) {
1553
- t.items = t.scroll.scroller.content.children, t.checkWheelAllDisabled(), t.itemHeight = t.items.length > 0 ? s.contentSize / t.items.length : 0, a.maxScrollPos = -t.itemHeight * (t.items.length - 1), a.minScrollPos = 0;
1554
- }), s.hooks.on(s.hooks.eventTypes.momentum, function(a) {
1555
- a.rate = Ge.rate, a.destination = t.findNearestValidWheel(a.destination).y;
1556
- }), s.hooks.on(s.hooks.eventTypes.end, function(a) {
1557
- var c = t.findNearestValidWheel(s.currentPos);
1558
- a.destination = c.y, a.duration = t.options.adjustTime;
1559
- }), l.hooks.on(l.hooks.eventTypes.time, function(a) {
1560
- t.transitionDuration(a);
1561
- }), l.hooks.on(l.hooks.eventTypes.timeFunction, function(a) {
1562
- t.timeFunction(a);
1563
- }), l.hooks.on(l.hooks.eventTypes.callStop, function() {
1564
- var a = t.findNearestValidWheel(t.scroll.y).index;
1565
- t.isAdjustingPosition = !0, t.wheelTo(a, 0);
1566
- }), l.translater.hooks.on(l.translater.hooks.eventTypes.translate, function(a) {
1567
- t.rotateX(a.y);
1568
- });
1569
- }, o.prototype.refreshBoundary = function() {
1570
- var t = this.scroll.scroller, e = t.scrollBehaviorX, r = t.scrollBehaviorY, i = t.content;
1571
- e.refresh(i), r.refresh(i);
1572
- }, o.prototype.setSelectedIndex = function(t, e) {
1573
- e === void 0 && (e = !1);
1574
- var r = this.selectedIndex;
1575
- this.selectedIndex = t, r !== t && !e && this.scroll.trigger(Nt, t);
1576
- }, o.prototype.getSelectedIndex = function() {
1577
- return this.selectedIndex;
1578
- }, o.prototype.wheelTo = function(t, e, r) {
1579
- t === void 0 && (t = 0), e === void 0 && (e = 0);
1580
- var i = -t * this.itemHeight;
1581
- this.scroll.scrollTo(0, i, e, r);
1582
- }, o.prototype.restorePosition = function() {
1583
- var t = this.scroll.pending;
1584
- if (t) {
1585
- var e = this.getSelectedIndex();
1586
- this.scroll.scroller.animater.clearTimer(), this.wheelTo(e, 0);
1587
- }
1588
- }, o.prototype.transitionDuration = function(t) {
1589
- for (var e = 0; e < this.items.length; e++)
1590
- this.items[e].style[dt.transitionDuration] = t + "ms";
1591
- }, o.prototype.timeFunction = function(t) {
1592
- for (var e = 0; e < this.items.length; e++)
1593
- this.items[e].style[dt.transitionTimingFunction] = t;
1594
- }, o.prototype.rotateX = function(t) {
1595
- for (var e = this.options.rotate, r = e === void 0 ? 25 : e, i = 0; i < this.items.length; i++) {
1596
- var n = r * (t / this.itemHeight + i), s = n.toFixed(3);
1597
- this.items[i].style[dt.transform] = "rotateX(" + s + "deg)";
523
+ function l() {
524
+ if (r("open"), n.modelValue && n.modelValue.length) {
525
+ o.value = [...n.modelValue];
526
+ return;
1598
527
  }
1599
- }, o.prototype.findNearestValidWheel = function(t) {
1600
- t = t > 0 ? 0 : t < this.scroll.maxScrollY ? this.scroll.maxScrollY : t;
1601
- for (var e = Math.abs(Math.round(-t / this.itemHeight)), r = e, i = this.items, n = this.options.wheelDisabledItemClass; e >= 0 && J(i[e], n); )
1602
- e--;
1603
- if (e < 0)
1604
- for (e = r; e <= i.length - 1 && J(i[e], n); )
1605
- e++;
1606
- return e === i.length && (e = r), {
1607
- index: this.wheelItemsAllDisabled ? -1 : e,
1608
- y: -e * this.itemHeight
1609
- };
1610
- }, o.prototype.checkWheelAllDisabled = function() {
1611
- var t = this.options.wheelDisabledItemClass, e = this.items;
1612
- this.wheelItemsAllDisabled = !0;
1613
- for (var r = 0; r < e.length; r++)
1614
- if (!J(e[r], t)) {
1615
- this.wheelItemsAllDisabled = !1;
1616
- break;
1617
- }
1618
- }, o.pluginName = "wheel", o;
1619
- }()
1620
- );
1621
- Fe.use(Ze);
1622
- const ot = Array.isArray, Je = (o) => typeof o == "object" && o !== null;
1623
- function bt(o) {
1624
- return ot(o) && o.length === 3;
1625
- }
1626
- function Qe(o) {
1627
- return o % 4 === 0 && (o % 100 !== 0 || o % 400 === 0);
1628
- }
1629
- function _(o, t) {
1630
- const e = [];
1631
- for (let r = o; r <= t; r++)
1632
- e.push(r);
1633
- return e;
1634
- }
1635
- function mt(o, t) {
1636
- const e = [];
1637
- for (let r = o; r <= t; r++)
1638
- e.push(`${r}`.padStart(2, "0"));
1639
- return e;
1640
- }
1641
- function to() {
1642
- const o = mt(0, 23), t = mt(0, 59), e = mt(0, 59), r = L([]);
1643
- i();
1644
- function i() {
1645
- const s = /* @__PURE__ */ new Date(), l = s.getHours(), h = s.getMinutes(), a = s.getSeconds();
1646
- r.value = [l, h, a];
1647
- }
1648
- function n(s) {
1649
- return (bt(s) ? s : r.value).map((h) => +h);
1650
- }
1651
- return {
1652
- timeList: [o, t, e],
1653
- updateDefaultTime: i,
1654
- getTimeAnchors: n
1655
- };
1656
- }
1657
- function eo() {
1658
- const e = /* @__PURE__ */ new Date(), r = e.getFullYear(), i = e.getMonth() + 1, n = e.getDate(), s = L(r), l = L(i), h = _(1900, 2100), a = _(1, 12), c = b(() => {
1659
- const f = [4, 6, 9, 11], d = [1, 3, 5, 7, 8, 10, 12];
1660
- return f.includes(l.value) ? _(1, 30) : d.includes(l.value) ? _(1, 31) : Qe(s.value) ? _(1, 29) : _(1, 28);
1661
- }), u = b(() => [h, a, c.value]);
1662
- function v(f) {
1663
- return (bt(f) ? f : [r, i, n]).map((y, A) => {
1664
- const P = u.value[A].indexOf(y);
1665
- return P !== -1 ? P : 0;
1666
- });
1667
- }
1668
- function g(f) {
1669
- const [d, y] = f;
1670
- s.value = u.value[0][d], l.value = u.value[1][y];
1671
- }
1672
- return {
1673
- selectYear: s,
1674
- selectMonth: l,
1675
- dateList: u,
1676
- updateDateSelect: g,
1677
- getDateAnchors: v
1678
- };
1679
- }
1680
- function oo(o, t) {
1681
- const e = L([]), r = L(), i = L([]), n = b(() => o.type === "date"), s = b(() => o.type === "time"), { selectYear: l, selectMonth: h, dateList: a, updateDateSelect: c, getDateAnchors: u } = eo(), { timeList: v, updateDefaultTime: g, getTimeAnchors: f } = to(), d = b(() => n.value ? u(o.anchor) : s.value ? f(o.anchor) : ot(o.anchor) ? o.anchor : [o.anchor]);
1682
- async function y(p = !1) {
1683
- p ? A() : P(), await ne(), e.value.forEach((k, m) => nt(m)), p || Qt(), te();
1684
- }
1685
- function A() {
1686
- const p = {
1687
- date: a == null ? void 0 : a.value,
1688
- time: v
1689
- }, k = o.type, T = ot(o.data[0]) ? [...o.data] : [o.data];
1690
- e.value = p[k] ?? T;
1691
- }
1692
- function P() {
1693
- !n.value && !s.value || (n.value && c(d.value), s.value && !bt(o.anchor) && g());
1694
- }
1695
- function nt(p) {
1696
- var T;
1697
- const k = (T = r.value) == null ? void 0 : T.children[p];
1698
- if (!k) return;
1699
- let m = i.value[p];
1700
- if (m)
1701
- m.refresh();
1702
- else {
1703
- const at = R(k, {
1704
- wheel: {
1705
- selectedIndex: 0,
1706
- rotate: 25
1707
- },
1708
- swipeTime: o.swipeTime ?? 500
1709
- });
1710
- m = i.value[p] = at, m.on("scrollEnd", () => $(p));
528
+ const { columnsType: t } = n;
529
+ o.value = t.map((u) => M(u));
1711
530
  }
1712
- return m;
1713
- }
1714
- function $(p) {
1715
- if (!n.value || p === 2) return;
1716
- const k = i.value[p].getSelectedIndex(), m = a.value[p][k];
1717
- p === 0 && (l.value = m), p === 1 && (h.value = m), y(!0);
1718
- }
1719
- function Qt() {
1720
- i.value.forEach((p, k) => {
1721
- var T;
1722
- const m = (T = d.value) == null ? void 0 : T[k];
1723
- p.wheelTo(m ?? 0);
1724
- });
1725
- }
1726
- function te() {
1727
- const p = e.value.length;
1728
- if (i.value.length <= p) return;
1729
- i.value.splice(p).forEach((m) => m.destroy());
1730
- }
1731
- function ee() {
1732
- t("cancel"), st();
1733
- }
1734
- function oe() {
1735
- i.value.some((T) => T.isInTransition) && re();
1736
- const { item: k, anchor: m } = ie();
1737
- t("confirm", k), t("update:anchor", m), st();
1738
- }
1739
- function st() {
1740
- t("update:isShowPicker", !1);
1741
- }
1742
- function re() {
1743
- i.value.forEach((p) => p.stop());
1744
- }
1745
- function ie() {
1746
- const { item: p, anchor: k } = i.value.reduce(
1747
- (m, T, at) => {
1748
- const wt = T.getSelectedIndex(), lt = e.value[at][wt];
1749
- return m.item.push(s.value ? +lt : lt), m.anchor.push(n.value ? lt : wt), m;
1750
- },
1751
- { item: [], anchor: [] }
1752
- );
1753
- return p.length > 1 ? { item: p, anchor: k } : { item: p[0], anchor: k[0] };
1754
- }
1755
- return ht(
1756
- () => o.data,
1757
- () => y(!0),
1758
- { immediate: !0 }
1759
- ), ht(
1760
- () => o.isShowPicker,
1761
- (p) => p && y()
1762
- ), ht(
1763
- () => o.type,
1764
- () => {
1765
- P(), y(!0);
531
+ function i() {
532
+ o.value = n.modelValue ? [...n.modelValue] : [...s.value], r("closed");
1766
533
  }
1767
- ), {
1768
- pickerData: e,
1769
- wheelWrapper: r,
1770
- cancel: ee,
1771
- confirm: oe,
1772
- closePicker: st
1773
- };
1774
- }
1775
- const ro = {
1776
- cancelClass: "",
1777
- confirmClass: "",
1778
- titleClass: "",
1779
- cancelColor: "#999",
1780
- confirmColor: "#42b983",
1781
- titleColor: "",
1782
- cancelText: "Cancel",
1783
- confirmText: "Confirm",
1784
- titleText: ""
1785
- }, io = { class: "component-hook-picker" }, no = { class: "component-hook-picker_title" }, so = { class: "component-hook-picker_panel" }, ao = { class: "component-hook-picker_wheel_scroll" }, ho = /* @__PURE__ */ se({
1786
- __name: "Picker",
1787
- props: {
1788
- data: { default: () => [] },
1789
- isShowPicker: { type: Boolean },
1790
- options: { default: () => ({}) },
1791
- anchor: {},
1792
- showKey: { default: "" },
1793
- swipeTime: { default: 500 },
1794
- type: { default: "" }
1795
- },
1796
- emits: ["update:isShowPicker", "update:anchor", "cancel", "confirm"],
1797
- setup(o, { emit: t }) {
1798
- const e = o, r = t, i = b(() => ({ ...ro, ...e.options })), n = b(() => i.value.cancelColor), s = b(() => i.value.confirmColor), l = b(() => i.value.titleColor), h = b(() => ot(e.showKey) ? e.showKey : [e.showKey]), { pickerData: a, wheelWrapper: c, cancel: u, confirm: v, closePicker: g } = oo(e, r);
1799
- return (f, d) => (W(), z("div", null, [
1800
- Pt(Et, { name: "component-hook-picker-fade" }, {
1801
- default: Ct(() => [
1802
- Dt(S("div", {
1803
- class: "component-hook-picker-mask",
1804
- onClick: d[0] || (d[0] = //@ts-ignore
1805
- (...y) => D(g) && D(g)(...y))
1806
- }, null, 512), [
1807
- [Bt, f.isShowPicker]
1808
- ])
1809
- ]),
1810
- _: 1
1811
- }),
1812
- Pt(Et, { name: "component-hook-picker-slide" }, {
1813
- default: Ct(() => [
1814
- Dt(S("div", io, [
1815
- S("div", no, [
1816
- S("button", {
1817
- class: ct(["component-hook-picker_cancel", i.value.cancelClass]),
1818
- style: ut({ color: n.value }),
1819
- onClick: d[1] || (d[1] = //@ts-ignore
1820
- (...y) => D(u) && D(u)(...y))
1821
- }, j(i.value.cancelText), 7),
1822
- S("button", {
1823
- class: ct(["component-hook-picker_confirm", i.value.confirmClass]),
1824
- style: ut({ color: s.value }),
1825
- onClick: d[2] || (d[2] = //@ts-ignore
1826
- (...y) => D(v) && D(v)(...y))
1827
- }, j(i.value.confirmText), 7),
1828
- S("h4", {
1829
- class: ct([i.value.titleClass]),
1830
- style: ut({ color: l.value })
1831
- }, j(i.value.titleText), 7)
1832
- ]),
1833
- S("div", so, [
1834
- d[3] || (d[3] = S("div", { class: "component-hook-picker_mask_top" }, null, -1)),
1835
- d[4] || (d[4] = S("div", { class: "component-hook-picker_mask_bottom" }, null, -1)),
1836
- S("div", {
1837
- ref_key: "wheelWrapper",
1838
- ref: c,
1839
- class: "component-hook-picker_wheel_wrapper"
1840
- }, [
1841
- (W(!0), z(xt, null, At(D(a), (y, A) => (W(), z("div", {
1842
- key: A,
1843
- class: "component-hook-picker_wheel"
1844
- }, [
1845
- S("ul", ao, [
1846
- (W(!0), z(xt, null, At(y, (P, nt) => {
1847
- var $;
1848
- return W(), z("li", {
1849
- key: nt,
1850
- class: "component-hook-picker_wheel_item"
1851
- }, j(($ = h.value) != null && $[A] && D(Je)(P) ? P[h.value[A]] : P), 1);
1852
- }), 128))
1853
- ])
1854
- ]))), 128))
1855
- ], 512)
1856
- ])
1857
- ], 512), [
1858
- [Bt, f.isShowPicker]
1859
- ])
1860
- ]),
1861
- _: 1
1862
- })
1863
- ]));
534
+ return (t, u) => (I(), E(ie, {
535
+ modelValue: o.value,
536
+ "onUpdate:modelValue": u[0] || (u[0] = (c) => o.value = c),
537
+ show: p.value,
538
+ "onUpdate:show": u[1] || (u[1] = (c) => p.value = c),
539
+ title: t.title,
540
+ columns: g.value,
541
+ teleport: t.teleport,
542
+ "confirm-button-text": t.confirmButtonText,
543
+ "cancel-button-text": t.cancelButtonText,
544
+ linkage: "",
545
+ onConfirm: D,
546
+ onCancel: V,
547
+ onOpen: l,
548
+ onClosed: i
549
+ }, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
1864
550
  }
1865
551
  });
1866
552
  export {
1867
- ho as default
553
+ _e as DatePicker,
554
+ ie as Picker,
555
+ Ge as TimePicker
1868
556
  };