@component-hook/picker 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,115 +1,115 @@
1
1
  import "./index.css";
2
- import { defineComponent as B, watch as ce, openBlock as Y, createBlock as L, Teleport as me, createVNode as Z, Transition as j, withCtx as X, withDirectives as q, createElementVNode as I, vShow as J, renderSlot as R, ref as O, readonly as Q, isRef as W, toRef as de, createElementBlock as F, unref as M, normalizeStyle as ee, Fragment as z, renderList as ae, toDisplayString as A, computed as C, watchEffect as fe, withModifiers as pe, nextTick as ve } from "vue";
3
- const he = Array.isArray;
4
- function Te(e, r) {
5
- if (re(e)) return "multiple";
2
+ import { defineComponent as B, watch as ie, createBlock as E, openBlock as I, Teleport as ce, createVNode as Z, Transition as j, withCtx as X, withDirectives as q, createElementVNode as Y, vShow as J, renderSlot as R, ref as C, readonly as Q, isRef as W, toRef as me, createElementBlock as F, unref as g, normalizeStyle as ee, Fragment as z, renderList as ue, toDisplayString as A, computed as O, watchEffect as de, withModifiers as fe, nextTick as pe } from "vue";
3
+ const ve = Array.isArray;
4
+ function he(e, s) {
5
+ if (se(e)) return "multiple";
6
6
  const [n] = e;
7
- return n != null && n[r.children] ? "cascade" : "single";
7
+ return n != null && n[s.children] ? "cascade" : "single";
8
8
  }
9
- function ge(e) {
9
+ function Te(e) {
10
10
  return {
11
11
  children: (e == null ? void 0 : e.children) || "children",
12
12
  label: (e == null ? void 0 : e.label) || "label",
13
13
  value: (e == null ? void 0 : e.value) || "value"
14
14
  };
15
15
  }
16
- function ke(e, r, n) {
16
+ function ge(e, s, n) {
17
17
  var d;
18
- if (re(e)) return [];
18
+ if (se(e)) return [];
19
19
  const l = [];
20
- let o = e, a = 0;
20
+ let o = e, r = 0;
21
21
  for (; o; ) {
22
- const f = r[a];
23
- let h = se(o, f, n);
24
- h === -1 && (h = 0), l.push(o), a += 1, o = (d = o[h]) == null ? void 0 : d[n.children];
22
+ const p = s[r];
23
+ let f = ae(o, p, n);
24
+ f === -1 && (f = 0), l.push(o), r += 1, o = (d = o[f]) == null ? void 0 : d[n.children];
25
25
  }
26
26
  return l;
27
27
  }
28
- function Me(e, r, n, l) {
28
+ function ke(e, s, n, l) {
29
29
  const o = [...n];
30
- let a = e, d = r + 1;
31
- for (; a != null && a[l.children]; ) {
32
- const f = a[l.children][0];
33
- o[d] = f.value, a = f, d += 1;
30
+ let r = e, d = s + 1;
31
+ for (; r != null && r[l.children]; ) {
32
+ const p = r[l.children][0];
33
+ o[d] = p.value, r = p, d += 1;
34
34
  }
35
35
  return o;
36
36
  }
37
- function se(e, r, n) {
38
- return e.findIndex((l) => (l == null ? void 0 : l[n.value]) === r);
37
+ function ae(e, s, n) {
38
+ return e.findIndex((l) => (l == null ? void 0 : l[n.value]) === s);
39
39
  }
40
- function re(e) {
41
- const [r] = e;
42
- return he(r);
40
+ function se(e) {
41
+ const [s] = e;
42
+ return ve(s);
43
43
  }
44
- function Ve(e, r) {
45
- return e > r ? "horizontal" : r > e ? "vertical" : "";
44
+ function Me(e, s) {
45
+ return e > s ? "horizontal" : s > e ? "vertical" : "";
46
46
  }
47
- function E(e, r, n) {
47
+ function L(e, s, n) {
48
48
  const l = [];
49
- for (let o = e; o <= r; o++) {
50
- const a = n(`${o}`);
51
- l.push({ label: a, value: o });
49
+ for (let o = e; o <= s; o++) {
50
+ const r = n(`${o}`);
51
+ l.push({ label: r, value: o });
52
52
  }
53
53
  return l;
54
54
  }
55
- function te(e, r) {
56
- return e === r.getFullYear();
55
+ function te(e, s) {
56
+ return e === s.getFullYear();
57
57
  }
58
- function ne(e, r) {
59
- return e === r.getFullYear();
58
+ function ne(e, s) {
59
+ return e === s.getFullYear();
60
60
  }
61
- function ye(e, r) {
62
- return e === r.getMonth() + 1;
61
+ function Ve(e, s) {
62
+ return e === s.getMonth() + 1;
63
63
  }
64
- function we(e, r) {
65
- return e === r.getMonth() + 1;
64
+ function ye(e, s) {
65
+ return e === s.getMonth() + 1;
66
66
  }
67
- function xe(e, r) {
68
- return new Date(e, r, 0).getDate();
67
+ function we(e, s) {
68
+ return new Date(e, s, 0).getDate();
69
69
  }
70
- function De(e, r, n) {
71
- const l = /* @__PURE__ */ new Date(), o = Date.now(), a = e.getTime(), d = r.getTime(), f = o >= a && o <= d;
72
- return n === "year" ? f ? l.getFullYear() : e.getFullYear() : n === "month" ? f ? l.getMonth() + 1 : e.getMonth() + 1 : f ? l.getDate() : e.getDate();
70
+ function xe(e, s, n) {
71
+ const l = /* @__PURE__ */ new Date(), o = Date.now(), r = e.getTime(), d = s.getTime(), p = o >= r && o <= d;
72
+ return n === "year" ? p ? l.getFullYear() : e.getFullYear() : n === "month" ? p ? l.getMonth() + 1 : e.getMonth() + 1 : p ? l.getDate() : e.getDate();
73
73
  }
74
74
  function $(e) {
75
75
  return e;
76
76
  }
77
- function Se(e) {
77
+ function De(e) {
78
78
  return /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e);
79
79
  }
80
80
  function oe(e) {
81
- if (!Se(e)) return null;
82
- const [r, n, l] = e.split(":");
83
- return { hour: Number(r), minute: Number(n), second: Number(l) };
81
+ if (!De(e)) return null;
82
+ const [s, n, l] = e.split(":");
83
+ return { hour: Number(s), minute: Number(n), second: Number(l) };
84
84
  }
85
85
  function H(e) {
86
86
  return e.padStart(2, "0");
87
87
  }
88
- function be(e, r, n) {
89
- const l = Date.now(), { hour: o, minute: a, second: d } = e, { hour: f, minute: h, second: c } = r, g = (/* @__PURE__ */ new Date()).setHours(o, a, d), T = (/* @__PURE__ */ new Date()).setHours(f, h, c), x = l >= g && l <= T;
90
- return n === "hour" ? x ? (/* @__PURE__ */ new Date()).getHours() : o : n === "minute" ? x ? (/* @__PURE__ */ new Date()).getMinutes() : a : x ? (/* @__PURE__ */ new Date()).getSeconds() : d;
88
+ function Se(e, s, n) {
89
+ const l = Date.now(), { hour: o, minute: r, second: d } = e, { hour: p, minute: f, second: m } = s, V = (/* @__PURE__ */ new Date()).setHours(o, r, d), M = (/* @__PURE__ */ new Date()).setHours(p, f, m), x = l >= V && l <= M;
90
+ return n === "hour" ? x ? (/* @__PURE__ */ new Date()).getHours() : o : n === "minute" ? x ? (/* @__PURE__ */ new Date()).getMinutes() : r : x ? (/* @__PURE__ */ new Date()).getSeconds() : d;
91
91
  }
92
- const Ye = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ B({
92
+ const be = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ B({
93
93
  __name: "Popup",
94
94
  props: {
95
95
  teleport: { default: "body" },
96
96
  modelValue: { type: Boolean }
97
97
  },
98
98
  emits: ["update:modelValue", "open", "close", "closed"],
99
- setup(e, { emit: r }) {
100
- const n = e, l = r;
101
- return ce(
99
+ setup(e, { emit: s }) {
100
+ const n = e, l = s;
101
+ return ie(
102
102
  () => n.modelValue,
103
103
  (o) => {
104
104
  o ? (document.body.style.overflow = "hidden", l("open")) : (document.body.style.overflow = "", l("close"));
105
105
  },
106
106
  { immediate: !0 }
107
- ), (o, a) => (Y(), L(me, { to: o.teleport }, [
107
+ ), (o, r) => (I(), E(ce, { to: o.teleport }, [
108
108
  Z(j, { name: "chook-picker-fade" }, {
109
109
  default: X(() => [
110
- q(I("div", {
110
+ q(Y("div", {
111
111
  class: "chook-picker-mask",
112
- onClick: a[0] || (a[0] = (d) => o.$emit("update:modelValue", !1))
112
+ onClick: r[0] || (r[0] = (d) => o.$emit("update:modelValue", !1))
113
113
  }, null, 512), [
114
114
  [J, o.modelValue]
115
115
  ])
@@ -118,10 +118,10 @@ const Ye = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ B({
118
118
  }),
119
119
  Z(j, {
120
120
  name: "chook-picker-slide",
121
- onAfterLeave: a[1] || (a[1] = (d) => o.$emit("closed"))
121
+ onAfterLeave: r[1] || (r[1] = (d) => o.$emit("closed"))
122
122
  }, {
123
123
  default: X(() => [
124
- q(I("div", Ye, [
124
+ q(Y("div", be, [
125
125
  R(o.$slots, "default")
126
126
  ], 512), [
127
127
  [J, o.modelValue]
@@ -131,8 +131,8 @@ const Ye = { class: "chook-picker-container" }, Ie = /* @__PURE__ */ B({
131
131
  })
132
132
  ], 8, ["to"]));
133
133
  }
134
- }), Oe = 16, _ = 48, Ce = 0.52, le = 150, U = 300, Pe = 15, Fe = 8e-3, ue = 5, Ee = "Select Date", Le = ["year", "month", "day"], Be = "Select Time", Ae = ["hour", "minute", "second"];
135
- function Ne() {
134
+ }), Ye = 16, _ = 48, Ce = 0.52, le = 150, U = 300, Oe = 15, Pe = 8e-3, Fe = "Select Date", Le = ["year", "month", "day"], Ee = "Select Time", Be = ["hour", "minute", "second"];
135
+ function Ae() {
136
136
  const e = {
137
137
  startX: 0,
138
138
  startY: 0,
@@ -141,88 +141,88 @@ function Ne() {
141
141
  offsetX: 0,
142
142
  offsetY: 0
143
143
  };
144
- let r = "", n = !0;
145
- const l = () => r === "vertical", o = () => r === "horizontal";
146
- function a() {
147
- e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, r = "", n = !0;
144
+ let s = "";
145
+ const n = () => s === "vertical", l = () => s === "horizontal";
146
+ function o() {
147
+ e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, s = "";
148
148
  }
149
- function d(c) {
150
- const g = "touches" in c ? c.touches[0] : c;
151
- a(), e.startX = g.clientX, e.startY = g.clientY;
149
+ function r(f) {
150
+ const m = "touches" in f ? f.touches[0] : f;
151
+ o(), e.startX = m.clientX, e.startY = m.clientY;
152
152
  }
153
- function f(c) {
153
+ function d(f) {
154
154
  if (!e.startX || !e.startY) return !0;
155
- const g = "touches" in c ? c.touches[0] : c;
156
- e.deltaX = Math.max(g.clientX, 0) - e.startX, e.deltaY = g.clientY - e.startY, e.offsetX = Math.abs(e.deltaX), e.offsetY = Math.abs(e.deltaY);
157
- const T = 10;
158
- (!r || e.offsetX < T && e.offsetY < T) && (r = Ve(e.offsetX, e.offsetY)), n && (e.offsetX > ue || e.offsetY > ue) && (n = !1);
155
+ const m = "touches" in f ? f.touches[0] : f;
156
+ e.deltaX = Math.max(m.clientX, 0) - e.startX, e.deltaY = m.clientY - e.startY, e.offsetX = Math.abs(e.deltaX), e.offsetY = Math.abs(e.deltaY);
157
+ const V = 10;
158
+ (!s || e.offsetX < V && e.offsetY < V) && (s = Me(e.offsetX, e.offsetY));
159
159
  }
160
- function h() {
160
+ function p() {
161
161
  e.startX = 0, e.startY = 0;
162
162
  }
163
163
  return {
164
164
  pointer: e,
165
- move: f,
166
- start: d,
167
- stop: h,
168
- reset: a,
169
- isVertical: l,
170
- isHorizontal: o
165
+ move: d,
166
+ start: r,
167
+ stop: p,
168
+ reset: o,
169
+ isVertical: n,
170
+ isHorizontal: l
171
171
  };
172
172
  }
173
- function $e({ column: e, onChange: r }) {
174
- const l = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Oe, o = O(0), a = O(0), { pointer: d, start: f, move: h, stop: c } = Ne();
175
- let g = 0, T = 0, x = 0, y = !1, D = null;
176
- function w(v) {
177
- f(v), y = !0, a.value = 0, T = Date.now(), g = o.value, x = g, D = null;
173
+ function Ne({ column: e, onChange: s }) {
174
+ const l = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) / Ye, o = C(0), r = C(0), { pointer: d, start: p, move: f, stop: m } = Ae();
175
+ let V = 0, M = 0, x = 0, y = !1, D = null;
176
+ function w(h) {
177
+ p(h), y = !0, r.value = 0, M = Date.now(), V = o.value, x = V, D = null;
178
178
  }
179
- function s(v) {
180
- if (h(v)) return;
181
- const b = W(e) ? e.value.length : e.length, P = g + d.deltaY, N = p((b - 1) * -48), G = Math.min(Math.max(P, N), 0), K = Date.now();
182
- o.value = G, !(K - T <= U) && (T = K, x = G);
179
+ function a(h) {
180
+ if (f(h)) return;
181
+ const b = W(e) ? e.value.length : e.length, P = V + d.deltaY, N = v((b - 1) * -48), G = Math.min(Math.max(P, N), 0), K = Date.now();
182
+ o.value = G, !(K - M <= U) && (M = K, x = G);
183
183
  }
184
184
  function i() {
185
- c();
186
- const v = o.value - x, k = Date.now() - T;
187
- if (k < U && Math.abs(v) > Pe) {
188
- t(v, k);
185
+ m();
186
+ const h = o.value - x, T = Date.now() - M;
187
+ if (T < U && Math.abs(h) > Oe) {
188
+ t(h, T);
189
189
  return;
190
190
  }
191
- const b = V(o.value);
192
- a.value = le, m(b), y = !1;
191
+ const b = k(o.value);
192
+ r.value = le, c(b), y = !1;
193
193
  }
194
- function t(v, k) {
195
- const b = Math.abs(v / k), P = o.value + b / Fe * (v < 0 ? -1 : 1), N = V(P);
196
- a.value = U, m(N);
194
+ function t(h, T) {
195
+ const b = Math.abs(h / T), P = o.value + b / Pe * (h < 0 ? -1 : 1), N = k(P);
196
+ r.value = U, c(N);
197
197
  }
198
198
  function u() {
199
- a.value = 0, y = !1, D && (D(), D = null);
199
+ r.value = 0, y = !1, D && (D(), D = null);
200
200
  }
201
- function m(v) {
202
- const k = -v * p(_), b = () => r == null ? void 0 : r(v);
203
- y && k !== o.value ? D = b : b(), o.value = k;
201
+ function c(h) {
202
+ const T = -h * v(_), b = () => s == null ? void 0 : s(h);
203
+ y && T !== o.value ? D = b : b(), o.value = T;
204
204
  }
205
- function V(v) {
206
- const k = W(e) ? e.value.length : e.length, b = Math.round(-v / p(_));
207
- return b < 0 ? 0 : b >= k ? k - 1 : b;
205
+ function k(h) {
206
+ const T = W(e) ? e.value.length : e.length, b = Math.round(-h / v(_));
207
+ return b < 0 ? 0 : b >= T ? T - 1 : b;
208
208
  }
209
- function p(v) {
210
- return v * l;
209
+ function v(h) {
210
+ return h * l;
211
211
  }
212
- function S(v, k = "auto") {
213
- y && k === "smooth" || (D = null, y = k === "smooth", a.value = k === "smooth" ? le : 0, m(v));
212
+ function S(h, T = "auto") {
213
+ y && T === "smooth" || (D = null, y = T === "smooth", r.value = T === "smooth" ? le : 0, c(h));
214
214
  }
215
215
  return {
216
216
  offsetY: Q(o),
217
- transitionDuration: Q(a),
217
+ transitionDuration: Q(r),
218
218
  onPointerDown: w,
219
- onPointerMove: s,
219
+ onPointerMove: a,
220
220
  onPointerUp: i,
221
221
  stopInertialSliding: u,
222
222
  scrollToIndex: S
223
223
  };
224
224
  }
225
- const He = ["onClick"], Ue = /* @__PURE__ */ B({
225
+ const $e = ["onClick"], He = /* @__PURE__ */ B({
226
226
  __name: "PickerColumn",
227
227
  props: {
228
228
  column: {},
@@ -230,68 +230,68 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
230
230
  selectedIndex: { default: 0 }
231
231
  },
232
232
  emits: ["change"],
233
- setup(e, { expose: r, emit: n }) {
234
- const l = e, o = n, { offsetY: a, transitionDuration: d, onPointerDown: f, onPointerMove: h, onPointerUp: c, stopInertialSliding: g, scrollToIndex: T } = $e({
235
- column: de(l, "column"),
233
+ setup(e, { expose: s, emit: n }) {
234
+ const l = e, o = n, { offsetY: r, transitionDuration: d, onPointerDown: p, onPointerMove: f, onPointerUp: m, stopInertialSliding: V, scrollToIndex: M } = Ne({
235
+ column: me(l, "column"),
236
236
  onChange: x
237
237
  });
238
238
  function x(w) {
239
239
  w !== l.selectedIndex && o("change", w);
240
240
  }
241
- function y(w = l.selectedIndex, s) {
242
- T(w, s);
241
+ function y(w = l.selectedIndex, a) {
242
+ M(w, a);
243
243
  }
244
244
  function D(w) {
245
245
  w !== l.selectedIndex && y(w, "smooth");
246
246
  }
247
- return r({ scrollToSelected: y }), (w, s) => (Y(), F("div", {
247
+ return s({ scrollToSelected: y }), (w, a) => (I(), F("div", {
248
248
  class: "chook-picker-column",
249
- onTouchstartPassive: s[1] || (s[1] = //@ts-ignore
250
- (...i) => M(f) && M(f)(...i)),
251
- onTouchmovePassive: s[2] || (s[2] = //@ts-ignore
252
- (...i) => M(h) && M(h)(...i)),
253
- onTouchendPassive: s[3] || (s[3] = //@ts-ignore
254
- (...i) => M(c) && M(c)(...i)),
255
- onTouchcancel: s[4] || (s[4] = //@ts-ignore
256
- (...i) => M(c) && M(c)(...i)),
257
- onMousedownPassive: s[5] || (s[5] = //@ts-ignore
258
- (...i) => M(f) && M(f)(...i)),
259
- onMousemovePassive: s[6] || (s[6] = //@ts-ignore
260
- (...i) => M(h) && M(h)(...i)),
261
- onMouseupPassive: s[7] || (s[7] = //@ts-ignore
262
- (...i) => M(c) && M(c)(...i))
249
+ onTouchstartPassive: a[1] || (a[1] = //@ts-ignore
250
+ (...i) => g(p) && g(p)(...i)),
251
+ onTouchmovePassive: a[2] || (a[2] = //@ts-ignore
252
+ (...i) => g(f) && g(f)(...i)),
253
+ onTouchendPassive: a[3] || (a[3] = //@ts-ignore
254
+ (...i) => g(m) && g(m)(...i)),
255
+ onTouchcancel: a[4] || (a[4] = //@ts-ignore
256
+ (...i) => g(m) && g(m)(...i)),
257
+ onMousedownPassive: a[5] || (a[5] = //@ts-ignore
258
+ (...i) => g(p) && g(p)(...i)),
259
+ onMousemovePassive: a[6] || (a[6] = //@ts-ignore
260
+ (...i) => g(f) && g(f)(...i)),
261
+ onMouseupPassive: a[7] || (a[7] = //@ts-ignore
262
+ (...i) => g(m) && g(m)(...i))
263
263
  }, [
264
- I("ul", {
264
+ Y("ul", {
265
265
  style: ee({
266
266
  overflowY: "hidden",
267
- transform: `translate3d(0, ${M(a)}px, 0)`,
268
- transitionDuration: `${M(d)}ms`,
269
- transitionProperty: M(d) ? "all" : "none"
267
+ transform: `translate3d(0, ${g(r)}px, 0)`,
268
+ transitionDuration: `${g(d)}ms`,
269
+ transitionProperty: g(d) ? "all" : "none"
270
270
  }),
271
- onTransitionend: s[0] || (s[0] = //@ts-ignore
272
- (...i) => M(g) && M(g)(...i))
271
+ onTransitionend: a[0] || (a[0] = //@ts-ignore
272
+ (...i) => g(V) && g(V)(...i))
273
273
  }, [
274
- (Y(!0), F(z, null, ae(w.column, (i, t) => (Y(), F("li", {
274
+ (I(!0), F(z, null, ue(w.column, (i, t) => (I(), F("li", {
275
275
  key: i == null ? void 0 : i[w.fields.value],
276
276
  class: "chook-picker-column-item",
277
277
  role: "button",
278
278
  tabindex: "0",
279
279
  onClick: (u) => D(t)
280
280
  }, [
281
- I("p", {
281
+ Y("p", {
282
282
  class: "chook-picker-column-label",
283
283
  style: ee({
284
- transform: `rotate3d(1, 0, 0, ${(t * M(_) + M(a)) * M(Ce)}deg)`
284
+ transform: `rotate3d(1, 0, 0, ${(t * g(_) + g(r)) * g(Ce)}deg)`
285
285
  })
286
286
  }, A(i == null ? void 0 : i[w.fields.label]), 5)
287
- ], 8, He))), 128))
287
+ ], 8, $e))), 128))
288
288
  ], 36)
289
289
  ], 32));
290
290
  }
291
- }), Xe = { class: "chook-picker-header" }, Re = { class: "chook-picker-title" }, ze = { class: "chook-picker-loading" }, _e = {
291
+ }), Ue = { class: "chook-picker-header" }, Xe = { class: "chook-picker-title" }, Re = { class: "chook-picker-loading" }, ze = {
292
292
  key: 1,
293
293
  class: "chook-picker-columns"
294
- }, ie = /* @__PURE__ */ B({
294
+ }, re = /* @__PURE__ */ B({
295
295
  __name: "Picker",
296
296
  props: {
297
297
  show: { type: Boolean },
@@ -306,108 +306,108 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
306
306
  columnsFieldNames: {}
307
307
  },
308
308
  emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
309
- setup(e, { emit: r }) {
310
- const n = e, l = r, o = O([]), a = O([]), d = O([]), f = O(null), h = C({
309
+ setup(e, { emit: s }) {
310
+ const n = e, l = s, o = C([]), r = C([]), d = C([]), p = C(null), f = O({
311
311
  get: () => n.show,
312
312
  set: (t) => l("update:show", t)
313
- }), c = C(() => ge(n.columnsFieldNames)), g = C(() => Te(n.columns, c.value)), T = C(() => {
313
+ }), m = O(() => Te(n.columnsFieldNames)), V = O(() => he(n.columns, m.value)), M = O(() => {
314
314
  const { columns: t } = n;
315
- return g.value === "single" ? [t] : g.value === "multiple" ? t : ke(t, a.value, c.value);
315
+ return V.value === "single" ? [t] : V.value === "multiple" ? t : ge(t, r.value, m.value);
316
316
  });
317
317
  function x(t, u) {
318
- var v;
319
- const m = T.value[t], V = (v = m[u]) == null ? void 0 : v[c.value.value], p = a.value[t];
320
- if (V === p) return;
321
- const S = [...a.value];
322
- if (S[t] = V, g.value === "cascade") {
323
- const k = m[u];
324
- a.value = Me(k, t, S, c.value);
318
+ var h;
319
+ const c = M.value[t], k = (h = c[u]) == null ? void 0 : h[m.value.value], v = r.value[t];
320
+ if (k === v) return;
321
+ const S = [...r.value];
322
+ if (S[t] = k, V.value === "cascade") {
323
+ const T = c[u];
324
+ r.value = ke(T, t, S, m.value);
325
325
  } else
326
- a.value = S;
326
+ r.value = S;
327
327
  n.linkage && y();
328
328
  }
329
329
  function y() {
330
- l("update:modelValue", a.value), o.value = a.value;
330
+ l("update:modelValue", r.value), o.value = r.value;
331
331
  }
332
332
  function D() {
333
333
  l("update:show", !1);
334
334
  }
335
335
  async function w() {
336
- l("open"), await ve(), a.value = n.modelValue ? [...n.modelValue] : [...o.value];
336
+ l("open"), await pe(), r.value = n.modelValue ? [...n.modelValue] : [...o.value];
337
337
  }
338
- function s() {
339
- n.linkage || y(), D(), l("confirm", a.value);
338
+ function a() {
339
+ n.linkage || y(), D(), l("confirm", r.value);
340
340
  }
341
341
  function i() {
342
342
  D(), l("cancel");
343
343
  }
344
- return fe(() => {
345
- var m, V;
346
- const t = T.value.length, u = [];
347
- for (let p = 0; p < t; p++) {
348
- const S = T.value[p], v = a.value[p], k = se(S, v, c.value);
349
- if (k === -1) {
350
- const P = (d.value[p] ?? 0) >= S.length ? Math.max(S.length - 1, 0) : 0;
351
- a.value[p] = (m = S[P]) == null ? void 0 : m[c.value.value], u[p] = P;
344
+ return de(() => {
345
+ var c, k;
346
+ const t = M.value.length, u = [];
347
+ for (let v = 0; v < t; v++) {
348
+ const S = M.value[v], h = r.value[v], T = ae(S, h, m.value);
349
+ if (T === -1) {
350
+ const P = (d.value[v] ?? 0) >= S.length ? Math.max(S.length - 1, 0) : 0;
351
+ r.value[v] = (c = S[P]) == null ? void 0 : c[m.value.value], u[v] = P;
352
352
  } else
353
- u[p] = k;
354
- u[p] !== d.value[p] && ((V = f.value) == null || V[p].scrollToSelected(u[p]));
353
+ u[v] = T;
354
+ u[v] !== d.value[v] && ((k = p.value) == null || k[v].scrollToSelected(u[v]));
355
355
  }
356
356
  d.value = u;
357
- }), (t, u) => (Y(), L(Ie, {
358
- modelValue: h.value,
359
- "onUpdate:modelValue": u[1] || (u[1] = (m) => h.value = m),
357
+ }), (t, u) => (I(), E(Ie, {
358
+ modelValue: f.value,
359
+ "onUpdate:modelValue": u[1] || (u[1] = (c) => f.value = c),
360
360
  teleport: t.teleport,
361
361
  onOpen: w,
362
- onClosed: u[2] || (u[2] = (m) => t.$emit("closed"))
362
+ onClosed: u[2] || (u[2] = (c) => t.$emit("closed"))
363
363
  }, {
364
364
  default: X(() => [
365
- I("div", Xe, [
366
- I("button", {
365
+ Y("div", Ue, [
366
+ Y("button", {
367
367
  class: "chook-picker-cancel",
368
368
  onClick: i
369
369
  }, A(t.cancelButtonText), 1),
370
- I("p", Re, A(t.title), 1),
371
- I("button", {
370
+ Y("p", Xe, A(t.title), 1),
371
+ Y("button", {
372
372
  class: "chook-picker-confirm",
373
- onClick: s
373
+ onClick: a
374
374
  }, A(t.confirmButtonText), 1)
375
375
  ]),
376
- t.loading ? (Y(), F(z, { key: 0 }, [
377
- I("div", ze, [
376
+ t.loading ? (I(), F(z, { key: 0 }, [
377
+ Y("div", Re, [
378
378
  R(t.$slots, "loading")
379
379
  ]),
380
- u[3] || (u[3] = I("div", { class: "chook-picker-columns" }, null, -1))
381
- ], 64)) : t.columns.length ? (Y(), F("div", {
380
+ u[3] || (u[3] = Y("div", { class: "chook-picker-columns" }, null, -1))
381
+ ], 64)) : t.columns.length ? (I(), F("div", {
382
382
  key: 2,
383
383
  class: "chook-picker-columns chook-picker-columns-backdrop",
384
- onTouchmove: u[0] || (u[0] = pe(() => {
384
+ onTouchmove: u[0] || (u[0] = fe(() => {
385
385
  }, ["stop"]))
386
386
  }, [
387
- (Y(!0), F(z, null, ae(T.value, (m, V) => (Y(), L(Ue, {
388
- key: V,
387
+ (I(!0), F(z, null, ue(M.value, (c, k) => (I(), E(He, {
388
+ key: k,
389
389
  ref_for: !0,
390
390
  ref_key: "columnsRef",
391
- ref: f,
392
- column: m,
393
- fields: c.value,
394
- "selected-index": d.value[V],
395
- onChange: (p) => x(V, p)
391
+ ref: p,
392
+ column: c,
393
+ fields: m.value,
394
+ "selected-index": d.value[k],
395
+ onChange: (v) => x(k, v)
396
396
  }, null, 8, ["column", "fields", "selected-index", "onChange"]))), 128)),
397
- u[4] || (u[4] = I("div", { class: "chook-picker-mask-backdrop" }, null, -1))
398
- ], 32)) : (Y(), F("div", _e, [
397
+ u[4] || (u[4] = Y("div", { class: "chook-picker-mask-backdrop" }, null, -1))
398
+ ], 32)) : (I(), F("div", ze, [
399
399
  R(t.$slots, "empty")
400
400
  ]))
401
401
  ]),
402
402
  _: 3
403
403
  }, 8, ["modelValue", "teleport"]));
404
404
  }
405
- }), Ke = /* @__PURE__ */ B({
405
+ }), Ge = /* @__PURE__ */ B({
406
406
  __name: "DatePicker",
407
407
  props: {
408
408
  show: { type: Boolean },
409
409
  modelValue: {},
410
- title: { default: Ee },
410
+ title: { default: Fe },
411
411
  columnsType: { default: () => Le },
412
412
  minDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1) },
413
413
  maxDate: { default: () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31) },
@@ -419,36 +419,36 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
419
419
  formatDayLabel: { type: Function, default: $ }
420
420
  },
421
421
  emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
422
- setup(e, { emit: r }) {
423
- const n = e, l = r, o = O([]), a = O([]), d = C({
422
+ setup(e, { emit: s }) {
423
+ const n = e, l = s, o = C([]), r = C([]), d = O({
424
424
  get: () => n.show,
425
- set: (s) => l("update:show", s)
426
- }), f = C(() => {
427
- const { columnsType: s, minDate: i, maxDate: t } = n, u = {
428
- year: h,
429
- month: c,
430
- day: g
425
+ set: (a) => l("update:show", a)
426
+ }), p = O(() => {
427
+ const { columnsType: a, minDate: i, maxDate: t } = n, u = {
428
+ year: f,
429
+ month: m,
430
+ day: V
431
431
  };
432
- return s.map((m) => u[m](i, t));
432
+ return a.map((c) => u[c](i, t));
433
433
  });
434
- function h(s, i) {
435
- const t = s.getFullYear(), u = i.getFullYear();
436
- return E(t, u, n.formatYearLabel);
434
+ function f(a, i) {
435
+ const t = a.getFullYear(), u = i.getFullYear();
436
+ return L(t, u, n.formatYearLabel);
437
437
  }
438
- function c(s, i) {
439
- const t = T("year"), u = te(t, s) ? s.getMonth() + 1 : 1, m = ne(t, i) ? i.getMonth() + 1 : 12;
440
- return E(u, m, n.formatMonthLabel);
438
+ function m(a, i) {
439
+ const t = M("year"), u = te(t, a) ? a.getMonth() + 1 : 1, c = ne(t, i) ? i.getMonth() + 1 : 12;
440
+ return L(u, c, n.formatMonthLabel);
441
441
  }
442
- function g(s, i) {
443
- const t = T("year"), u = T("month"), m = te(t, s) && ye(u, s), V = ne(t, i) && we(u, i), p = m ? s.getDate() : 1, S = V ? i.getDate() : xe(t, u);
444
- return E(p, S, n.formatDayLabel);
442
+ function V(a, i) {
443
+ const t = M("year"), u = M("month"), c = te(t, a) && Ve(u, a), k = ne(t, i) && ye(u, i), v = c ? a.getDate() : 1, S = k ? i.getDate() : we(t, u);
444
+ return L(v, S, n.formatDayLabel);
445
445
  }
446
- function T(s) {
447
- const { columnsType: i } = n, t = i.indexOf(s), u = o.value[t];
448
- return u ? Number(u) : De(n.minDate, n.maxDate, s);
446
+ function M(a) {
447
+ const { columnsType: i } = n, t = i.indexOf(a), u = o.value[t];
448
+ return u ? Number(u) : xe(n.minDate, n.maxDate, a);
449
449
  }
450
- function x(s) {
451
- l("update:modelValue", s), a.value = s, l("confirm", s);
450
+ function x(a) {
451
+ l("update:modelValue", a), r.value = a, l("confirm", a);
452
452
  }
453
453
  function y() {
454
454
  l("cancel");
@@ -458,22 +458,22 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
458
458
  o.value = [...n.modelValue];
459
459
  return;
460
460
  }
461
- const { columnsType: s } = n;
462
- o.value = s.map((i) => T(i));
461
+ const { columnsType: a } = n;
462
+ o.value = a.map((i) => M(i));
463
463
  }
464
464
  function w() {
465
- o.value = n.modelValue ? [...n.modelValue] : [...a.value], l("closed");
465
+ o.value = n.modelValue ? [...n.modelValue] : [...r.value], l("closed");
466
466
  }
467
- return (s, i) => (Y(), L(ie, {
467
+ return (a, i) => (I(), E(re, {
468
468
  modelValue: o.value,
469
469
  "onUpdate:modelValue": i[0] || (i[0] = (t) => o.value = t),
470
470
  show: d.value,
471
471
  "onUpdate:show": i[1] || (i[1] = (t) => d.value = t),
472
- title: s.title,
473
- columns: f.value,
474
- teleport: s.teleport,
475
- "confirm-button-text": s.confirmButtonText,
476
- "cancel-button-text": s.cancelButtonText,
472
+ title: a.title,
473
+ columns: p.value,
474
+ teleport: a.teleport,
475
+ "confirm-button-text": a.confirmButtonText,
476
+ "cancel-button-text": a.cancelButtonText,
477
477
  linkage: "",
478
478
  onConfirm: x,
479
479
  onCancel: y,
@@ -481,13 +481,13 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
481
481
  onClosed: w
482
482
  }, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
483
483
  }
484
- }), Ze = /* @__PURE__ */ B({
484
+ }), Ke = /* @__PURE__ */ B({
485
485
  __name: "TimePicker",
486
486
  props: {
487
487
  show: { type: Boolean },
488
488
  modelValue: {},
489
- title: { default: Be },
490
- columnsType: { default: () => Ae },
489
+ title: { default: Ee },
490
+ columnsType: { default: () => Be },
491
491
  minTime: {},
492
492
  maxTime: {},
493
493
  teleport: {},
@@ -498,41 +498,41 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
498
498
  formatSecondLabel: { type: Function, default: H }
499
499
  },
500
500
  emits: ["update:show", "update:modelValue", "confirm", "cancel", "open", "closed"],
501
- setup(e, { emit: r }) {
502
- const n = e, l = r, o = O([]), a = O([]), d = C({
501
+ setup(e, { emit: s }) {
502
+ const n = e, l = s, o = C([]), r = C([]), d = O({
503
503
  get: () => n.show,
504
504
  set: (t) => l("update:show", t)
505
- }), f = C(() => {
505
+ }), p = O(() => {
506
506
  const { columnsType: t } = n, u = {
507
- hour: g,
508
- minute: T,
507
+ hour: V,
508
+ minute: M,
509
509
  second: x
510
510
  };
511
- return t.map((m) => u[m]());
512
- }), h = C(() => oe(n.minTime ?? "") ?? { hour: 0, minute: 0, second: 0 }), c = C(() => oe(n.maxTime ?? "") ?? { hour: 23, minute: 59, second: 59 });
513
- function g() {
514
- const t = h.value.hour, u = c.value.hour;
515
- return E(t, u, n.formatHourLabel);
511
+ return t.map((c) => u[c]());
512
+ }), f = O(() => oe(n.minTime ?? "") ?? { hour: 0, minute: 0, second: 0 }), m = O(() => oe(n.maxTime ?? "") ?? { hour: 23, minute: 59, second: 59 });
513
+ function V() {
514
+ const t = f.value.hour, u = m.value.hour;
515
+ return L(t, u, n.formatHourLabel);
516
516
  }
517
- function T() {
518
- const t = y("hour"), { hour: u, minute: m } = h.value, { hour: V, minute: p } = c.value;
519
- return E(t === u ? m : 0, t === V ? p : 59, n.formatMinuteLabel);
517
+ function M() {
518
+ const t = y("hour"), { hour: u, minute: c } = f.value, { hour: k, minute: v } = m.value;
519
+ return L(t === u ? c : 0, t === k ? v : 59, n.formatMinuteLabel);
520
520
  }
521
521
  function x() {
522
- const t = y("hour"), u = y("minute"), { hour: m, minute: V, second: p } = h.value, { hour: S, minute: v, second: k } = c.value;
523
- return E(t === m && u === V ? p : 0, t === S && u === v ? k : 59, n.formatSecondLabel);
522
+ const t = y("hour"), u = y("minute"), { hour: c, minute: k, second: v } = f.value, { hour: S, minute: h, second: T } = m.value;
523
+ return L(t === c && u === k ? v : 0, t === S && u === h ? T : 59, n.formatSecondLabel);
524
524
  }
525
525
  function y(t) {
526
- const { columnsType: u } = n, m = u.indexOf(t), V = o.value[m];
527
- return V !== void 0 ? Number(V) : be(h.value, c.value, t);
526
+ const { columnsType: u } = n, c = u.indexOf(t), k = o.value[c];
527
+ return k !== void 0 ? Number(k) : Se(f.value, m.value, t);
528
528
  }
529
529
  function D(t) {
530
- l("update:modelValue", t), a.value = t, l("confirm", t);
530
+ l("update:modelValue", t), r.value = t, l("confirm", t);
531
531
  }
532
532
  function w() {
533
533
  l("cancel");
534
534
  }
535
- function s() {
535
+ function a() {
536
536
  if (l("open"), n.modelValue && n.modelValue.length) {
537
537
  o.value = [...n.modelValue];
538
538
  return;
@@ -541,28 +541,28 @@ const He = ["onClick"], Ue = /* @__PURE__ */ B({
541
541
  o.value = t.map((u) => y(u));
542
542
  }
543
543
  function i() {
544
- o.value = n.modelValue ? [...n.modelValue] : [...a.value], l("closed");
544
+ o.value = n.modelValue ? [...n.modelValue] : [...r.value], l("closed");
545
545
  }
546
- return (t, u) => (Y(), L(ie, {
546
+ return (t, u) => (I(), E(re, {
547
547
  modelValue: o.value,
548
- "onUpdate:modelValue": u[0] || (u[0] = (m) => o.value = m),
548
+ "onUpdate:modelValue": u[0] || (u[0] = (c) => o.value = c),
549
549
  show: d.value,
550
- "onUpdate:show": u[1] || (u[1] = (m) => d.value = m),
550
+ "onUpdate:show": u[1] || (u[1] = (c) => d.value = c),
551
551
  title: t.title,
552
- columns: f.value,
552
+ columns: p.value,
553
553
  teleport: t.teleport,
554
554
  "confirm-button-text": t.confirmButtonText,
555
555
  "cancel-button-text": t.cancelButtonText,
556
556
  linkage: "",
557
557
  onConfirm: D,
558
558
  onCancel: w,
559
- onOpen: s,
559
+ onOpen: a,
560
560
  onClosed: i
561
561
  }, null, 8, ["modelValue", "show", "title", "columns", "teleport", "confirm-button-text", "cancel-button-text"]));
562
562
  }
563
563
  });
564
564
  export {
565
- Ke as DatePicker,
566
- ie as Picker,
567
- Ze as TimePicker
565
+ Ge as DatePicker,
566
+ re as Picker,
567
+ Ke as TimePicker
568
568
  };