@component-hook/picker 0.2.5 → 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -163
- package/dist/react/index.css +1 -1
- package/dist/react/picker.es.d.ts +78 -40
- package/dist/react/picker.es.js +1601 -2949
- package/dist/react/picker.umd.js +15 -36
- package/dist/vue/index.css +1 -1
- package/dist/vue/picker.es.d.ts +188 -55
- package/dist/vue/picker.es.js +499 -1812
- package/dist/vue/picker.umd.js +2 -23
- package/package.json +7 -7
package/dist/vue/picker.es.js
CHANGED
|
@@ -1,1868 +1,555 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
1
|
+
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";
|
|
2
|
+
const Te = Array.isArray;
|
|
3
|
+
function ge(e, a) {
|
|
4
|
+
if (re(e)) return "multiple";
|
|
5
|
+
const [n] = e;
|
|
6
|
+
return n[a.children] ? "cascade" : "single";
|
|
7
|
+
}
|
|
8
|
+
function ke(e) {
|
|
9
|
+
return {
|
|
10
|
+
children: (e == null ? void 0 : e.children) || "children",
|
|
11
|
+
label: (e == null ? void 0 : e.label) || "label",
|
|
12
|
+
value: (e == null ? void 0 : e.value) || "value"
|
|
13
|
+
};
|
|
51
14
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
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"
|
|
15
|
+
function Me(e, a, n) {
|
|
16
|
+
var p;
|
|
17
|
+
if (re(e)) return [];
|
|
18
|
+
const r = [];
|
|
19
|
+
let o = e, s = 0;
|
|
20
|
+
for (; o; ) {
|
|
21
|
+
const g = a[s];
|
|
22
|
+
let h = se(o, g, n);
|
|
23
|
+
h === -1 && (h = 0), r.push(o), s += 1, o = (p = o[h]) == null ? void 0 : p[n.children];
|
|
136
24
|
}
|
|
137
|
-
|
|
138
|
-
function Q(o) {
|
|
139
|
-
console.error("[BScroll warn]: " + o);
|
|
25
|
+
return r;
|
|
140
26
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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 {
|
|
27
|
+
function Ve(e, a, n, r) {
|
|
28
|
+
const o = [...n];
|
|
29
|
+
let s = e, p = a + 1;
|
|
30
|
+
for (; s != null && s[r.children]; ) {
|
|
31
|
+
const g = s[r.children][0];
|
|
32
|
+
o[p] = g.value, s = g, p += 1;
|
|
164
33
|
}
|
|
34
|
+
return o;
|
|
165
35
|
}
|
|
166
|
-
function
|
|
167
|
-
return
|
|
36
|
+
function se(e, a, n) {
|
|
37
|
+
return e.findIndex((r) => r[n.value] === a);
|
|
168
38
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return o;
|
|
173
|
-
};
|
|
174
|
-
function kt(o) {
|
|
175
|
-
return o == null;
|
|
39
|
+
function re(e) {
|
|
40
|
+
const [a] = e;
|
|
41
|
+
return Te(a);
|
|
176
42
|
}
|
|
177
|
-
function
|
|
178
|
-
return
|
|
43
|
+
function ye(e, a) {
|
|
44
|
+
return e > a ? "horizontal" : a > e ? "vertical" : "";
|
|
179
45
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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;
|
|
46
|
+
function F(e, a, n) {
|
|
47
|
+
const r = [];
|
|
48
|
+
for (let o = e; o <= a; o++) {
|
|
49
|
+
const s = n(`${o}`);
|
|
50
|
+
r.push({ label: s, value: o });
|
|
208
51
|
}
|
|
209
|
-
return
|
|
210
|
-
}();
|
|
211
|
-
function E(o) {
|
|
212
|
-
return I === !1 ? o : I === "standard" ? o === "transitionEnd" ? "transitionend" : o : I + o.charAt(0).toUpperCase() + o.substr(1);
|
|
52
|
+
return r;
|
|
213
53
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
54
|
+
function te(e, a) {
|
|
55
|
+
return e === a.getFullYear();
|
|
216
56
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
passive: !1,
|
|
220
|
-
capture: !!r
|
|
221
|
-
} : !!r;
|
|
222
|
-
o.addEventListener(t, e, i);
|
|
57
|
+
function ne(e, a) {
|
|
58
|
+
return e === a.getFullYear();
|
|
223
59
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
-
capture: !!r
|
|
227
|
-
});
|
|
60
|
+
function we(e, a) {
|
|
61
|
+
return e === a.getMonth() + 1;
|
|
228
62
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
63
|
+
function Se(e, a) {
|
|
64
|
+
return e === a.getMonth() + 1;
|
|
231
65
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
234
|
-
t -= o.offsetLeft, e -= o.offsetTop, o = o.offsetParent;
|
|
235
|
-
return {
|
|
236
|
-
left: t,
|
|
237
|
-
top: e
|
|
238
|
-
};
|
|
66
|
+
function De(e, a) {
|
|
67
|
+
return new Date(e, a, 0).getDate();
|
|
239
68
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
};
|
|
69
|
+
function $(e) {
|
|
70
|
+
return e;
|
|
71
|
+
}
|
|
72
|
+
function xe(e) {
|
|
73
|
+
return /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e);
|
|
275
74
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return !1;
|
|
75
|
+
function oe(e) {
|
|
76
|
+
if (!xe(e)) return null;
|
|
77
|
+
const [a, n, r] = e.split(":");
|
|
78
|
+
return { hour: Number(a), minute: Number(n), second: Number(r) };
|
|
281
79
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
var e = document.createEvent("Event");
|
|
285
|
-
e.initEvent(t, !0, !0), e.pageX = o.pageX, e.pageY = o.pageY, o.target.dispatchEvent(e);
|
|
80
|
+
function U(e) {
|
|
81
|
+
return e.padStart(2, "0");
|
|
286
82
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
83
|
+
const be = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ L({
|
|
84
|
+
__name: "Popup",
|
|
85
|
+
props: {
|
|
86
|
+
teleport: { default: "body" },
|
|
87
|
+
modelValue: { type: Boolean }
|
|
88
|
+
},
|
|
89
|
+
emits: ["update:modelValue", "open", "close", "closed"],
|
|
90
|
+
setup(e, { emit: a }) {
|
|
91
|
+
const n = e, r = a;
|
|
92
|
+
return ce(
|
|
93
|
+
() => n.modelValue,
|
|
94
|
+
(o) => {
|
|
95
|
+
o ? (document.body.style.overflow = "hidden", r("open")) : (document.body.style.overflow = "", r("close"));
|
|
96
|
+
},
|
|
97
|
+
{ immediate: !0 }
|
|
98
|
+
), (o, s) => (I(), E(me, { to: o.teleport }, [
|
|
99
|
+
Z(j, { name: "chook-picker-fade" }, {
|
|
100
|
+
default: H(() => [
|
|
101
|
+
q(Y("div", {
|
|
102
|
+
class: "chook-picker-mask",
|
|
103
|
+
onClick: s[0] || (s[0] = (p) => o.$emit("update:modelValue", !1))
|
|
104
|
+
}, null, 512), [
|
|
105
|
+
[J, o.modelValue]
|
|
106
|
+
])
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}),
|
|
110
|
+
Z(j, {
|
|
111
|
+
name: "chook-picker-slide",
|
|
112
|
+
onAfterLeave: s[1] || (s[1] = (p) => o.$emit("closed"))
|
|
113
|
+
}, {
|
|
114
|
+
default: H(() => [
|
|
115
|
+
q(Y("div", be, [
|
|
116
|
+
R(o.$slots, "default")
|
|
117
|
+
], 512), [
|
|
118
|
+
[J, o.modelValue]
|
|
119
|
+
])
|
|
120
|
+
]),
|
|
121
|
+
_: 3
|
|
122
|
+
})
|
|
123
|
+
], 8, ["to"]));
|
|
124
|
+
}
|
|
125
|
+
}), 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"];
|
|
126
|
+
function Ae() {
|
|
127
|
+
const e = {
|
|
128
|
+
startX: 0,
|
|
129
|
+
startY: 0,
|
|
130
|
+
deltaX: 0,
|
|
131
|
+
deltaY: 0,
|
|
132
|
+
offsetX: 0,
|
|
133
|
+
offsetY: 0
|
|
298
134
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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);
|
|
135
|
+
let a = "", n = !0;
|
|
136
|
+
const r = () => a === "vertical", o = () => a === "horizontal";
|
|
137
|
+
function s() {
|
|
138
|
+
e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, a = "", n = !0;
|
|
312
139
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
140
|
+
function p(d) {
|
|
141
|
+
const k = "touches" in d ? d.touches[0] : d;
|
|
142
|
+
s(), e.startX = k.clientX, e.startY = k.clientY;
|
|
143
|
+
}
|
|
144
|
+
function g(d) {
|
|
145
|
+
if (!e.startX || !e.startY) return !0;
|
|
146
|
+
const k = "touches" in d ? d.touches[0] : d;
|
|
147
|
+
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);
|
|
148
|
+
const T = 10;
|
|
149
|
+
(!a || e.offsetX < T && e.offsetY < T) && (a = ye(e.offsetX, e.offsetY)), n && (e.offsetX > ue || e.offsetY > ue) && (n = !1);
|
|
150
|
+
}
|
|
151
|
+
function h() {
|
|
152
|
+
e.startX = 0, e.startY = 0;
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
pointer: e,
|
|
156
|
+
move: g,
|
|
157
|
+
start: p,
|
|
158
|
+
stop: h,
|
|
159
|
+
reset: s,
|
|
160
|
+
isVertical: r,
|
|
161
|
+
isHorizontal: o
|
|
162
|
+
};
|
|
317
163
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
164
|
+
function Ne({ column: e, onChange: a }) {
|
|
165
|
+
const r = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Ye, o = C(0), s = C(0), { pointer: p, start: g, move: h, stop: d } = Ae();
|
|
166
|
+
let k = 0, T = 0, b = 0, M = !1, D = null;
|
|
167
|
+
function V(f) {
|
|
168
|
+
g(f), M = !0, s.value = 0, T = Date.now(), k = o.value, b = k, D = null;
|
|
169
|
+
}
|
|
170
|
+
function l(f) {
|
|
171
|
+
if (h(f)) return;
|
|
172
|
+
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();
|
|
173
|
+
o.value = G, !(K - T <= X) && (T = K, b = G);
|
|
174
|
+
}
|
|
175
|
+
function i() {
|
|
176
|
+
d();
|
|
177
|
+
const f = o.value - b, w = Date.now() - T;
|
|
178
|
+
if (w < X && Math.abs(f) > Oe) {
|
|
179
|
+
t(f, w);
|
|
180
|
+
return;
|
|
324
181
|
}
|
|
182
|
+
const S = m(o.value);
|
|
183
|
+
s.value = le, c(S), M = !1;
|
|
184
|
+
}
|
|
185
|
+
function t(f, w) {
|
|
186
|
+
const S = Math.abs(f / w), B = o.value + S / Pe * (f < 0 ? -1 : 1), N = m(B);
|
|
187
|
+
s.value = X, c(N);
|
|
188
|
+
}
|
|
189
|
+
function u() {
|
|
190
|
+
s.value = 0, M = !1, D && (D(), D = null);
|
|
191
|
+
}
|
|
192
|
+
function c(f) {
|
|
193
|
+
const w = -f * y(_), S = () => a == null ? void 0 : a(f);
|
|
194
|
+
M && w !== o.value ? D = S : S(), o.value = w;
|
|
195
|
+
}
|
|
196
|
+
function m(f) {
|
|
197
|
+
const w = W(e) ? e.value.length : e.length, S = Math.round(-f / y(_));
|
|
198
|
+
return S < 0 ? 0 : S >= w ? w - 1 : S;
|
|
199
|
+
}
|
|
200
|
+
function y(f) {
|
|
201
|
+
return f * r;
|
|
202
|
+
}
|
|
203
|
+
function x(f, w = "auto") {
|
|
204
|
+
M && w === "smooth" || (D = null, M = w === "smooth", s.value = w === "smooth" ? le : 0, c(f));
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
offsetY: Q(o),
|
|
208
|
+
transitionDuration: Q(s),
|
|
209
|
+
onPointerDown: V,
|
|
210
|
+
onPointerMove: l,
|
|
211
|
+
onPointerUp: i,
|
|
212
|
+
stopInertialSliding: u,
|
|
213
|
+
scrollToIndex: x
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const $e = ["onClick"], Ue = /* @__PURE__ */ L({
|
|
217
|
+
__name: "PickerColumn",
|
|
218
|
+
props: {
|
|
219
|
+
column: {},
|
|
220
|
+
fields: {},
|
|
221
|
+
selectedIndex: { default: 0 }
|
|
325
222
|
},
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
223
|
+
emits: ["change"],
|
|
224
|
+
setup(e, { expose: a, emit: n }) {
|
|
225
|
+
const r = e, o = n, { offsetY: s, transitionDuration: p, onPointerDown: g, onPointerMove: h, onPointerUp: d, stopInertialSliding: k, scrollToIndex: T } = Ne({
|
|
226
|
+
column: de(r, "column"),
|
|
227
|
+
onChange: b
|
|
228
|
+
});
|
|
229
|
+
function b(V) {
|
|
230
|
+
V !== r.selectedIndex && o("change", V);
|
|
331
231
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
bounce: {
|
|
335
|
-
style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
336
|
-
fn: function(o) {
|
|
337
|
-
return 1 - --o * o * o * o;
|
|
232
|
+
function M(V = r.selectedIndex, l) {
|
|
233
|
+
T(V, l);
|
|
338
234
|
}
|
|
235
|
+
function D(V) {
|
|
236
|
+
V !== r.selectedIndex && M(V, "smooth");
|
|
237
|
+
}
|
|
238
|
+
return a({ scrollToSelected: M }), (V, l) => (I(), P("div", {
|
|
239
|
+
class: "chook-picker-column",
|
|
240
|
+
onTouchstartPassive: l[1] || (l[1] = //@ts-ignore
|
|
241
|
+
(...i) => v(g) && v(g)(...i)),
|
|
242
|
+
onTouchmovePassive: l[2] || (l[2] = //@ts-ignore
|
|
243
|
+
(...i) => v(h) && v(h)(...i)),
|
|
244
|
+
onTouchendPassive: l[3] || (l[3] = //@ts-ignore
|
|
245
|
+
(...i) => v(d) && v(d)(...i)),
|
|
246
|
+
onTouchcancel: l[4] || (l[4] = //@ts-ignore
|
|
247
|
+
(...i) => v(d) && v(d)(...i)),
|
|
248
|
+
onMousedownPassive: l[5] || (l[5] = //@ts-ignore
|
|
249
|
+
(...i) => v(g) && v(g)(...i)),
|
|
250
|
+
onMousemovePassive: l[6] || (l[6] = //@ts-ignore
|
|
251
|
+
(...i) => v(h) && v(h)(...i)),
|
|
252
|
+
onMouseupPassive: l[7] || (l[7] = //@ts-ignore
|
|
253
|
+
(...i) => v(d) && v(d)(...i))
|
|
254
|
+
}, [
|
|
255
|
+
Y("ul", {
|
|
256
|
+
style: ee({
|
|
257
|
+
overflowY: "hidden",
|
|
258
|
+
transform: `translate3d(0, ${v(s)}px, 0)`,
|
|
259
|
+
transitionDuration: `${v(p)}ms`,
|
|
260
|
+
transitionProperty: v(p) ? "all" : "none"
|
|
261
|
+
}),
|
|
262
|
+
onTransitionend: l[0] || (l[0] = //@ts-ignore
|
|
263
|
+
(...i) => v(k) && v(k)(...i))
|
|
264
|
+
}, [
|
|
265
|
+
(I(!0), P(z, null, ae(V.column, (i, t) => (I(), P("li", {
|
|
266
|
+
key: i[V.fields.value],
|
|
267
|
+
class: "chook-picker-column-item",
|
|
268
|
+
role: "button",
|
|
269
|
+
tabindex: "0",
|
|
270
|
+
onClick: (u) => D(t)
|
|
271
|
+
}, [
|
|
272
|
+
Y("p", {
|
|
273
|
+
class: "chook-picker-column-label",
|
|
274
|
+
style: ee({
|
|
275
|
+
transform: `rotate3d(1, 0, 0, ${(t * v(_) + v(s)) * v(Ce)}deg)`
|
|
276
|
+
})
|
|
277
|
+
}, A(i[V.fields.label]), 5)
|
|
278
|
+
], 8, $e))), 128))
|
|
279
|
+
], 36)
|
|
280
|
+
], 32));
|
|
339
281
|
}
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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);
|
|
282
|
+
}), Xe = { class: "chook-picker-header" }, He = { class: "chook-picker-title" }, Re = {
|
|
283
|
+
key: 0,
|
|
284
|
+
class: "chook-picker-loading"
|
|
285
|
+
}, ie = /* @__PURE__ */ L({
|
|
286
|
+
__name: "Picker",
|
|
287
|
+
props: {
|
|
288
|
+
show: { type: Boolean },
|
|
289
|
+
modelValue: {},
|
|
290
|
+
title: {},
|
|
291
|
+
columns: {},
|
|
292
|
+
linkage: { type: Boolean },
|
|
293
|
+
loading: { type: Boolean },
|
|
294
|
+
teleport: {},
|
|
295
|
+
confirmButtonText: { default: "Confirm" },
|
|
296
|
+
cancelButtonText: { default: "Cancel" },
|
|
297
|
+
columnsFieldNames: {}
|
|
298
|
+
},
|
|
299
|
+
emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
|
|
300
|
+
setup(e, { emit: a }) {
|
|
301
|
+
const n = e, r = a, o = C([]), s = C([]), p = C([]), g = C(null), h = O({
|
|
302
|
+
get: () => n.show,
|
|
303
|
+
set: (t) => r("update:show", t)
|
|
304
|
+
}), d = O(() => ke(n.columnsFieldNames)), k = O(() => ge(n.columns, d.value)), T = O(() => {
|
|
305
|
+
const { columns: t } = n;
|
|
306
|
+
return k.value === "single" ? [t] : k.value === "multiple" ? t : Me(t, s.value, d.value);
|
|
307
|
+
});
|
|
308
|
+
function b(t, u) {
|
|
309
|
+
const c = T.value[t], m = c[u][d.value.value], y = s.value[t];
|
|
310
|
+
if (m === y) return;
|
|
311
|
+
const x = [...s.value];
|
|
312
|
+
if (x[t] = m, k.value === "cascade") {
|
|
313
|
+
const f = c[u];
|
|
314
|
+
s.value = Ve(f, t, x, d.value);
|
|
315
|
+
} else
|
|
316
|
+
s.value = x;
|
|
317
|
+
n.linkage && M();
|
|
383
318
|
}
|
|
384
|
-
|
|
385
|
-
|
|
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();
|
|
319
|
+
function M() {
|
|
320
|
+
r("update:modelValue", s.value), o.value = s.value;
|
|
441
321
|
}
|
|
442
|
-
|
|
443
|
-
|
|
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() {
|
|
322
|
+
function D() {
|
|
323
|
+
r("update:show", !1);
|
|
464
324
|
}
|
|
465
|
-
|
|
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;
|
|
325
|
+
async function V() {
|
|
326
|
+
r("open"), await he(), s.value = n.modelValue ? [...n.modelValue] : [...o.value];
|
|
483
327
|
}
|
|
484
|
-
|
|
485
|
-
|
|
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();
|
|
328
|
+
function l() {
|
|
329
|
+
n.linkage || M(), D(), r("confirm", s.value);
|
|
523
330
|
}
|
|
524
|
-
|
|
525
|
-
|
|
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"]);
|
|
331
|
+
function i() {
|
|
332
|
+
D(), r("cancel");
|
|
613
333
|
}
|
|
614
|
-
return
|
|
615
|
-
var
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
y
|
|
334
|
+
return fe(() => {
|
|
335
|
+
var c;
|
|
336
|
+
const t = T.value.length, u = [];
|
|
337
|
+
for (let m = 0; m < t; m++) {
|
|
338
|
+
const y = T.value[m], x = s.value[m], f = se(y, x, d.value);
|
|
339
|
+
if (f === -1) {
|
|
340
|
+
const S = (p.value[m] ?? 0) >= y.length ? y.length - 1 : 0;
|
|
341
|
+
s.value[m] = y[S][d.value.value], u[m] = S;
|
|
342
|
+
} else
|
|
343
|
+
u[m] = f;
|
|
344
|
+
u[m] !== p.value[m] && ((c = g.value) == null || c[m].scrollToSelected(u[m]));
|
|
345
|
+
}
|
|
346
|
+
p.value = u;
|
|
347
|
+
}), (t, u) => (I(), E(Ie, {
|
|
348
|
+
modelValue: h.value,
|
|
349
|
+
"onUpdate:modelValue": u[1] || (u[1] = (c) => h.value = c),
|
|
350
|
+
teleport: t.teleport,
|
|
351
|
+
onOpen: V,
|
|
352
|
+
onClosed: u[2] || (u[2] = (c) => t.$emit("closed"))
|
|
353
|
+
}, {
|
|
354
|
+
default: H(() => [
|
|
355
|
+
Y("div", Xe, [
|
|
356
|
+
Y("button", {
|
|
357
|
+
class: "chook-picker-cancel",
|
|
358
|
+
onClick: i
|
|
359
|
+
}, A(t.cancelButtonText), 1),
|
|
360
|
+
Y("p", He, A(t.title), 1),
|
|
361
|
+
Y("button", {
|
|
362
|
+
class: "chook-picker-confirm",
|
|
363
|
+
onClick: l
|
|
364
|
+
}, A(t.confirmButtonText), 1)
|
|
365
|
+
]),
|
|
366
|
+
Y("div", {
|
|
367
|
+
class: "chook-picker-columns chook-picker-columns-backdrop",
|
|
368
|
+
onTouchmove: u[0] || (u[0] = pe(() => {
|
|
369
|
+
}, ["stop"]))
|
|
370
|
+
}, [
|
|
371
|
+
!t.loading && !t.columns.length ? R(t.$slots, "empty", { key: 0 }) : (I(), P(z, { key: 1 }, [
|
|
372
|
+
(I(!0), P(z, null, ae(T.value, (c, m) => (I(), E(Ue, {
|
|
373
|
+
key: m,
|
|
374
|
+
ref_for: !0,
|
|
375
|
+
ref_key: "columnsRef",
|
|
376
|
+
ref: g,
|
|
377
|
+
column: c,
|
|
378
|
+
fields: d.value,
|
|
379
|
+
"selected-index": p.value[m],
|
|
380
|
+
onChange: (y) => b(m, y)
|
|
381
|
+
}, null, 8, ["column", "fields", "selected-index", "onChange"]))), 128)),
|
|
382
|
+
u[3] || (u[3] = Y("div", { class: "chook-picker-mask-backdrop" }, null, -1))
|
|
383
|
+
], 64))
|
|
384
|
+
], 32),
|
|
385
|
+
t.loading ? (I(), P("div", Re, [
|
|
386
|
+
R(t.$slots, "loading")
|
|
387
|
+
])) : ve("", !0)
|
|
388
|
+
]),
|
|
389
|
+
_: 3
|
|
390
|
+
}, 8, ["modelValue", "teleport"]));
|
|
391
|
+
}
|
|
392
|
+
}), _e = /* @__PURE__ */ L({
|
|
393
|
+
__name: "DatePicker",
|
|
394
|
+
props: {
|
|
395
|
+
show: { type: Boolean },
|
|
396
|
+
modelValue: {},
|
|
397
|
+
title: { default: Fe },
|
|
398
|
+
columnsType: { default: () => Ee },
|
|
399
|
+
minDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1) },
|
|
400
|
+
maxDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31) },
|
|
401
|
+
teleport: {},
|
|
402
|
+
confirmButtonText: {},
|
|
403
|
+
cancelButtonText: {},
|
|
404
|
+
formatYearLabel: { type: Function, default: $ },
|
|
405
|
+
formatMonthLabel: { type: Function, default: $ },
|
|
406
|
+
formatDayLabel: { type: Function, default: $ }
|
|
407
|
+
},
|
|
408
|
+
emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
|
|
409
|
+
setup(e, { emit: a }) {
|
|
410
|
+
const n = e, r = a, o = C([]), s = C([]), p = O({
|
|
411
|
+
get: () => n.show,
|
|
412
|
+
set: (l) => r("update:show", l)
|
|
413
|
+
}), g = O(() => {
|
|
414
|
+
const { columnsType: l, minDate: i, maxDate: t } = n, u = {
|
|
415
|
+
year: h,
|
|
416
|
+
month: d,
|
|
417
|
+
day: k
|
|
619
418
|
};
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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);
|
|
419
|
+
return l.map((c) => u[c](i, t));
|
|
420
|
+
});
|
|
421
|
+
function h(l, i) {
|
|
422
|
+
const t = l.getFullYear(), u = i.getFullYear();
|
|
423
|
+
return F(t, u, n.formatYearLabel);
|
|
650
424
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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;
|
|
425
|
+
function d(l, i) {
|
|
426
|
+
const t = T("year"), u = te(t, l) ? l.getMonth() + 1 : 1, c = ne(t, i) ? i.getMonth() + 1 : 12;
|
|
427
|
+
return F(u, c, n.formatMonthLabel);
|
|
679
428
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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;
|
|
429
|
+
function k(l, i) {
|
|
430
|
+
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);
|
|
431
|
+
return F(y, x, n.formatDayLabel);
|
|
715
432
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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;
|
|
433
|
+
function T(l) {
|
|
434
|
+
const { columnsType: i } = n, t = i.indexOf(l), u = o.value[t];
|
|
435
|
+
return u ? Number(u) : l === "year" ? (/* @__PURE__ */ new Date()).getFullYear() : l === "month" ? (/* @__PURE__ */ new Date()).getMonth() + 1 : (/* @__PURE__ */ new Date()).getDate();
|
|
758
436
|
}
|
|
759
|
-
|
|
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);
|
|
437
|
+
function b(l) {
|
|
438
|
+
r("update:modelValue", l), s.value = l, r("confirm", l);
|
|
772
439
|
}
|
|
773
|
-
|
|
774
|
-
|
|
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();
|
|
440
|
+
function M() {
|
|
441
|
+
r("cancel");
|
|
869
442
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
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);
|
|
443
|
+
function D() {
|
|
444
|
+
if (r("open"), n.modelValue && n.modelValue.length) {
|
|
445
|
+
o.value = [...n.modelValue];
|
|
446
|
+
return;
|
|
888
447
|
}
|
|
889
|
-
|
|
890
|
-
|
|
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();
|
|
448
|
+
const { columnsType: l } = n;
|
|
449
|
+
o.value = l.map((i) => T(i));
|
|
910
450
|
}
|
|
911
|
-
|
|
912
|
-
|
|
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();
|
|
451
|
+
function V() {
|
|
452
|
+
o.value = n.modelValue ? [...n.modelValue] : [...s.value], r("closed");
|
|
1071
453
|
}
|
|
1072
|
-
return
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
},
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
},
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
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;
|
|
454
|
+
return (l, i) => (I(), E(ie, {
|
|
455
|
+
modelValue: o.value,
|
|
456
|
+
"onUpdate:modelValue": i[0] || (i[0] = (t) => o.value = t),
|
|
457
|
+
show: p.value,
|
|
458
|
+
"onUpdate:show": i[1] || (i[1] = (t) => p.value = t),
|
|
459
|
+
title: l.title,
|
|
460
|
+
columns: g.value,
|
|
461
|
+
teleport: l.teleport,
|
|
462
|
+
"confirm-button-text": l.confirmButtonText,
|
|
463
|
+
"cancel-button-text": l.cancelButtonText,
|
|
464
|
+
linkage: "",
|
|
465
|
+
onConfirm: b,
|
|
466
|
+
onCancel: M,
|
|
467
|
+
onOpen: D,
|
|
468
|
+
onClosed: V
|
|
469
|
+
}, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
|
|
470
|
+
}
|
|
471
|
+
}), Ge = /* @__PURE__ */ L({
|
|
472
|
+
__name: "TimePicker",
|
|
473
|
+
props: {
|
|
474
|
+
show: { type: Boolean },
|
|
475
|
+
modelValue: {},
|
|
476
|
+
title: { default: Le },
|
|
477
|
+
columnsType: { default: () => Be },
|
|
478
|
+
minTime: {},
|
|
479
|
+
maxTime: {},
|
|
480
|
+
teleport: {},
|
|
481
|
+
confirmButtonText: {},
|
|
482
|
+
cancelButtonText: {},
|
|
483
|
+
formatHourLabel: { type: Function, default: U },
|
|
484
|
+
formatMinuteLabel: { type: Function, default: U },
|
|
485
|
+
formatSecondLabel: { type: Function, default: U }
|
|
486
|
+
},
|
|
487
|
+
emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
|
|
488
|
+
setup(e, { emit: a }) {
|
|
489
|
+
const n = e, r = a, o = C([]), s = C([]), p = O({
|
|
490
|
+
get: () => n.show,
|
|
491
|
+
set: (t) => r("update:show", t)
|
|
492
|
+
}), g = O(() => {
|
|
493
|
+
const { columnsType: t } = n, u = {
|
|
494
|
+
hour: k,
|
|
495
|
+
minute: T,
|
|
496
|
+
second: b
|
|
1228
497
|
};
|
|
1229
|
-
|
|
1230
|
-
},
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
return
|
|
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);
|
|
498
|
+
return t.map((c) => u[c]());
|
|
499
|
+
}), h = O(() => oe(n.minTime ?? "") ?? { hour: 0, minute: 0, second: 0 }), d = O(() => oe(n.maxTime ?? "") ?? { hour: 23, minute: 59, second: 59 });
|
|
500
|
+
function k() {
|
|
501
|
+
const t = h.value.hour, u = d.value.hour;
|
|
502
|
+
return F(t, u, n.formatHourLabel);
|
|
1288
503
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
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"
|
|
504
|
+
function T() {
|
|
505
|
+
const t = M("hour"), { hour: u, minute: c } = h.value, { hour: m, minute: y } = d.value;
|
|
506
|
+
return F(t === u ? c : 0, t === m ? y : 59, n.formatMinuteLabel);
|
|
1431
507
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
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;
|
|
508
|
+
function b() {
|
|
509
|
+
const t = M("hour"), u = M("minute"), { hour: c, minute: m, second: y } = h.value, { hour: x, minute: f, second: w } = d.value;
|
|
510
|
+
return F(t === c && u === m ? y : 0, t === x && u === f ? w : 59, n.formatSecondLabel);
|
|
1468
511
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
|
|
1473
|
-
fn: function(o) {
|
|
1474
|
-
return o * (2 - o);
|
|
512
|
+
function M(t) {
|
|
513
|
+
const { columnsType: u } = n, c = u.indexOf(t), m = o.value[c];
|
|
514
|
+
return m !== void 0 ? Number(m) : t === "hour" ? (/* @__PURE__ */ new Date()).getHours() : t === "minute" ? (/* @__PURE__ */ new Date()).getMinutes() : (/* @__PURE__ */ new Date()).getSeconds();
|
|
1475
515
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
bounce: {
|
|
1479
|
-
style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
1480
|
-
fn: function(o) {
|
|
1481
|
-
return 1 - --o * o * o * o;
|
|
516
|
+
function D(t) {
|
|
517
|
+
r("update:modelValue", t), s.value = t, r("confirm", t);
|
|
1482
518
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
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();
|
|
519
|
+
function V() {
|
|
520
|
+
r("cancel");
|
|
1509
521
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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)";
|
|
522
|
+
function l() {
|
|
523
|
+
if (r("open"), n.modelValue && n.modelValue.length) {
|
|
524
|
+
o.value = [...n.modelValue];
|
|
525
|
+
return;
|
|
1598
526
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
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));
|
|
527
|
+
const { columnsType: t } = n;
|
|
528
|
+
o.value = t.map((u) => M(u));
|
|
1711
529
|
}
|
|
1712
|
-
|
|
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);
|
|
530
|
+
function i() {
|
|
531
|
+
o.value = n.modelValue ? [...n.modelValue] : [...s.value], r("closed");
|
|
1766
532
|
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
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
|
-
]));
|
|
533
|
+
return (t, u) => (I(), E(ie, {
|
|
534
|
+
modelValue: o.value,
|
|
535
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => o.value = c),
|
|
536
|
+
show: p.value,
|
|
537
|
+
"onUpdate:show": u[1] || (u[1] = (c) => p.value = c),
|
|
538
|
+
title: t.title,
|
|
539
|
+
columns: g.value,
|
|
540
|
+
teleport: t.teleport,
|
|
541
|
+
"confirm-button-text": t.confirmButtonText,
|
|
542
|
+
"cancel-button-text": t.cancelButtonText,
|
|
543
|
+
linkage: "",
|
|
544
|
+
onConfirm: D,
|
|
545
|
+
onCancel: V,
|
|
546
|
+
onOpen: l,
|
|
547
|
+
onClosed: i
|
|
548
|
+
}, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
|
|
1864
549
|
}
|
|
1865
550
|
});
|
|
1866
551
|
export {
|
|
1867
|
-
|
|
552
|
+
_e as DatePicker,
|
|
553
|
+
ie as Picker,
|
|
554
|
+
Ge as TimePicker
|
|
1868
555
|
};
|