@component-hook/picker 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.css +1 -1
- package/dist/react/picker.es.d.ts +10286 -0
- package/dist/react/picker.es.js +600 -720
- package/dist/react/picker.umd.js +3 -3
- package/dist/vue/index.css +1 -1
- package/dist/vue/picker.es.d.ts +10356 -59
- package/dist/vue/picker.es.js +428 -424
- package/dist/vue/picker.umd.js +2 -2
- package/package.json +7 -6
package/dist/react/picker.es.js
CHANGED
|
@@ -1,749 +1,629 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return H.Fragment = n, H.jsx = r, H.jsxs = r, H;
|
|
2
|
+
import { forwardRef as e, useEffect as t, useImperativeHandle as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
5
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
6
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
7
|
+
}), c = .52, l = .008, u = [
|
|
8
|
+
"year",
|
|
9
|
+
"month",
|
|
10
|
+
"day"
|
|
11
|
+
], d = [
|
|
12
|
+
"hour",
|
|
13
|
+
"minute",
|
|
14
|
+
"second"
|
|
15
|
+
], f = Array.isArray;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/shared/utils/common.ts
|
|
18
|
+
function p(e, t) {
|
|
19
|
+
if (v(e)) return "multiple";
|
|
20
|
+
let [n] = e;
|
|
21
|
+
return n?.[t.children] ? "cascade" : "single";
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (typeof t == "function")
|
|
33
|
-
return t.$$typeof === E ? null : t.displayName || t.name || null;
|
|
34
|
-
if (typeof t == "string") return t;
|
|
35
|
-
switch (t) {
|
|
36
|
-
case M:
|
|
37
|
-
return "Fragment";
|
|
38
|
-
case O:
|
|
39
|
-
return "Profiler";
|
|
40
|
-
case v:
|
|
41
|
-
return "StrictMode";
|
|
42
|
-
case m:
|
|
43
|
-
return "Suspense";
|
|
44
|
-
case w:
|
|
45
|
-
return "SuspenseList";
|
|
46
|
-
case I:
|
|
47
|
-
return "Activity";
|
|
48
|
-
}
|
|
49
|
-
if (typeof t == "object")
|
|
50
|
-
switch (typeof t.tag == "number" && console.error(
|
|
51
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
|
-
), t.$$typeof) {
|
|
53
|
-
case x:
|
|
54
|
-
return "Portal";
|
|
55
|
-
case T:
|
|
56
|
-
return t.displayName || "Context";
|
|
57
|
-
case l:
|
|
58
|
-
return (t._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case g:
|
|
60
|
-
var i = t.render;
|
|
61
|
-
return t = t.displayName, t || (t = i.displayName || i.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
62
|
-
case A:
|
|
63
|
-
return i = t.displayName || null, i !== null ? i : e(t.type) || "Memo";
|
|
64
|
-
case Y:
|
|
65
|
-
i = t._payload, t = t._init;
|
|
66
|
-
try {
|
|
67
|
-
return e(t(i));
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
function n(t) {
|
|
74
|
-
return "" + t;
|
|
75
|
-
}
|
|
76
|
-
function r(t) {
|
|
77
|
-
try {
|
|
78
|
-
n(t);
|
|
79
|
-
var i = !1;
|
|
80
|
-
} catch {
|
|
81
|
-
i = !0;
|
|
82
|
-
}
|
|
83
|
-
if (i) {
|
|
84
|
-
i = console;
|
|
85
|
-
var R = i.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
86
|
-
return R.call(
|
|
87
|
-
i,
|
|
88
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
y
|
|
90
|
-
), n(t);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function o(t) {
|
|
94
|
-
if (t === M) return "<>";
|
|
95
|
-
if (typeof t == "object" && t !== null && t.$$typeof === Y)
|
|
96
|
-
return "<...>";
|
|
97
|
-
try {
|
|
98
|
-
var i = e(t);
|
|
99
|
-
return i ? "<" + i + ">" : "<...>";
|
|
100
|
-
} catch {
|
|
101
|
-
return "<...>";
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function s() {
|
|
105
|
-
var t = k.A;
|
|
106
|
-
return t === null ? null : t.getOwner();
|
|
107
|
-
}
|
|
108
|
-
function a() {
|
|
109
|
-
return Error("react-stack-top-frame");
|
|
110
|
-
}
|
|
111
|
-
function f(t) {
|
|
112
|
-
if (P.call(t, "key")) {
|
|
113
|
-
var i = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
114
|
-
if (i && i.isReactWarning) return !1;
|
|
115
|
-
}
|
|
116
|
-
return t.key !== void 0;
|
|
117
|
-
}
|
|
118
|
-
function c(t, i) {
|
|
119
|
-
function R() {
|
|
120
|
-
U || (U = !0, console.error(
|
|
121
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
-
i
|
|
123
|
-
));
|
|
124
|
-
}
|
|
125
|
-
R.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
126
|
-
get: R,
|
|
127
|
-
configurable: !0
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
function S() {
|
|
131
|
-
var t = e(this.type);
|
|
132
|
-
return L[t] || (L[t] = !0, console.error(
|
|
133
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
|
-
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
135
|
-
}
|
|
136
|
-
function d(t, i, R, y, B, K) {
|
|
137
|
-
var C = R.ref;
|
|
138
|
-
return t = {
|
|
139
|
-
$$typeof: b,
|
|
140
|
-
type: t,
|
|
141
|
-
key: i,
|
|
142
|
-
props: R,
|
|
143
|
-
_owner: y
|
|
144
|
-
}, (C !== void 0 ? C : null) !== null ? Object.defineProperty(t, "ref", {
|
|
145
|
-
enumerable: !1,
|
|
146
|
-
get: S
|
|
147
|
-
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
148
|
-
configurable: !1,
|
|
149
|
-
enumerable: !1,
|
|
150
|
-
writable: !0,
|
|
151
|
-
value: 0
|
|
152
|
-
}), Object.defineProperty(t, "_debugInfo", {
|
|
153
|
-
configurable: !1,
|
|
154
|
-
enumerable: !1,
|
|
155
|
-
writable: !0,
|
|
156
|
-
value: null
|
|
157
|
-
}), Object.defineProperty(t, "_debugStack", {
|
|
158
|
-
configurable: !1,
|
|
159
|
-
enumerable: !1,
|
|
160
|
-
writable: !0,
|
|
161
|
-
value: B
|
|
162
|
-
}), Object.defineProperty(t, "_debugTask", {
|
|
163
|
-
configurable: !1,
|
|
164
|
-
enumerable: !1,
|
|
165
|
-
writable: !0,
|
|
166
|
-
value: K
|
|
167
|
-
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
168
|
-
}
|
|
169
|
-
function _(t, i, R, y, B, K) {
|
|
170
|
-
var C = i.children;
|
|
171
|
-
if (C !== void 0)
|
|
172
|
-
if (y)
|
|
173
|
-
if (V(C)) {
|
|
174
|
-
for (y = 0; y < C.length; y++)
|
|
175
|
-
p(C[y]);
|
|
176
|
-
Object.freeze && Object.freeze(C);
|
|
177
|
-
} else
|
|
178
|
-
console.error(
|
|
179
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
|
-
);
|
|
181
|
-
else p(C);
|
|
182
|
-
if (P.call(i, "key")) {
|
|
183
|
-
C = e(t);
|
|
184
|
-
var $ = Object.keys(i).filter(function(ke) {
|
|
185
|
-
return ke !== "key";
|
|
186
|
-
});
|
|
187
|
-
y = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", ce[C + y] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
189
|
-
let props = %s;
|
|
190
|
-
<%s {...props} />
|
|
191
|
-
React keys must be passed directly to JSX without using spread:
|
|
192
|
-
let props = %s;
|
|
193
|
-
<%s key={someKey} {...props} />`,
|
|
194
|
-
y,
|
|
195
|
-
C,
|
|
196
|
-
$,
|
|
197
|
-
C
|
|
198
|
-
), ce[C + y] = !0);
|
|
199
|
-
}
|
|
200
|
-
if (C = null, R !== void 0 && (r(R), C = "" + R), f(i) && (r(i.key), C = "" + i.key), "key" in i) {
|
|
201
|
-
R = {};
|
|
202
|
-
for (var ee in i)
|
|
203
|
-
ee !== "key" && (R[ee] = i[ee]);
|
|
204
|
-
} else R = i;
|
|
205
|
-
return C && c(
|
|
206
|
-
R,
|
|
207
|
-
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
208
|
-
), d(
|
|
209
|
-
t,
|
|
210
|
-
C,
|
|
211
|
-
R,
|
|
212
|
-
s(),
|
|
213
|
-
B,
|
|
214
|
-
K
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
function p(t) {
|
|
218
|
-
u(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === Y && (t._payload.status === "fulfilled" ? u(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
219
|
-
}
|
|
220
|
-
function u(t) {
|
|
221
|
-
return typeof t == "object" && t !== null && t.$$typeof === b;
|
|
222
|
-
}
|
|
223
|
-
var h = Re, b = /* @__PURE__ */ Symbol.for("react.transitional.element"), x = /* @__PURE__ */ Symbol.for("react.portal"), M = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), O = /* @__PURE__ */ Symbol.for("react.profiler"), l = /* @__PURE__ */ Symbol.for("react.consumer"), T = /* @__PURE__ */ Symbol.for("react.context"), g = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), w = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), I = /* @__PURE__ */ Symbol.for("react.activity"), E = /* @__PURE__ */ Symbol.for("react.client.reference"), k = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, P = Object.prototype.hasOwnProperty, V = Array.isArray, D = console.createTask ? console.createTask : function() {
|
|
224
|
-
return null;
|
|
225
|
-
};
|
|
226
|
-
h = {
|
|
227
|
-
react_stack_bottom_frame: function(t) {
|
|
228
|
-
return t();
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
var U, L = {}, oe = h.react_stack_bottom_frame.bind(
|
|
232
|
-
h,
|
|
233
|
-
a
|
|
234
|
-
)(), se = D(o(a)), ce = {};
|
|
235
|
-
z.Fragment = M, z.jsx = function(t, i, R) {
|
|
236
|
-
var y = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
237
|
-
return _(
|
|
238
|
-
t,
|
|
239
|
-
i,
|
|
240
|
-
R,
|
|
241
|
-
!1,
|
|
242
|
-
y ? Error("react-stack-top-frame") : oe,
|
|
243
|
-
y ? D(o(t)) : se
|
|
244
|
-
);
|
|
245
|
-
}, z.jsxs = function(t, i, R) {
|
|
246
|
-
var y = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
247
|
-
return _(
|
|
248
|
-
t,
|
|
249
|
-
i,
|
|
250
|
-
R,
|
|
251
|
-
!0,
|
|
252
|
-
y ? Error("react-stack-top-frame") : oe,
|
|
253
|
-
y ? D(o(t)) : se
|
|
254
|
-
);
|
|
255
|
-
};
|
|
256
|
-
})()), z;
|
|
23
|
+
function m(e) {
|
|
24
|
+
return {
|
|
25
|
+
children: e?.children || "children",
|
|
26
|
+
label: e?.label || "label",
|
|
27
|
+
value: e?.value || "value"
|
|
28
|
+
};
|
|
257
29
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
30
|
+
function h(e, t, n) {
|
|
31
|
+
if (v(e)) return [];
|
|
32
|
+
let r = [], i = e, a = 0;
|
|
33
|
+
for (; i;) {
|
|
34
|
+
let e = t[a], o = _(i, e, n);
|
|
35
|
+
o === -1 && (o = 0), r.push(i), a += 1, i = i[o]?.[n.children];
|
|
36
|
+
}
|
|
37
|
+
return r;
|
|
261
38
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
39
|
+
function g(e, t, n, r) {
|
|
40
|
+
let i = [...n], a = e, o = t + 1;
|
|
41
|
+
for (; a?.[r.children];) {
|
|
42
|
+
let e = a[r.children][0];
|
|
43
|
+
i[o] = e.value, a = e, o += 1;
|
|
44
|
+
}
|
|
45
|
+
return i;
|
|
268
46
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
271
|
-
children: e?.children || "children",
|
|
272
|
-
label: e?.label || "label",
|
|
273
|
-
value: e?.value || "value"
|
|
274
|
-
};
|
|
47
|
+
function _(e, t, n) {
|
|
48
|
+
return e.findIndex((e) => e?.[n.value] === t);
|
|
275
49
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
let s = e, a = 0;
|
|
280
|
-
for (; s; ) {
|
|
281
|
-
const f = n[a];
|
|
282
|
-
let c = Te(s, f, r);
|
|
283
|
-
c === -1 && (c = 0), o.push(s), a += 1, s = s[c]?.[r.children];
|
|
284
|
-
}
|
|
285
|
-
return o;
|
|
50
|
+
function v(e) {
|
|
51
|
+
let [t] = e;
|
|
52
|
+
return f(t);
|
|
286
53
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
let a = e, f = n + 1;
|
|
290
|
-
for (; a?.[o.children]; ) {
|
|
291
|
-
const c = a[o.children][0];
|
|
292
|
-
s[f] = c.value, a = c, f += 1;
|
|
293
|
-
}
|
|
294
|
-
return s;
|
|
54
|
+
function y(e, t) {
|
|
55
|
+
return e > t ? "horizontal" : t > e ? "vertical" : "";
|
|
295
56
|
}
|
|
296
|
-
function
|
|
297
|
-
|
|
57
|
+
function b() {
|
|
58
|
+
let { fontSize: e } = getComputedStyle(document.documentElement);
|
|
59
|
+
return Number(e.replace("px", "")) || 16;
|
|
298
60
|
}
|
|
299
|
-
function
|
|
300
|
-
|
|
301
|
-
|
|
61
|
+
function x(e, t, n) {
|
|
62
|
+
let r = [];
|
|
63
|
+
for (let i = e; i <= t; i++) {
|
|
64
|
+
let e = n(String(i));
|
|
65
|
+
r.push({
|
|
66
|
+
label: e,
|
|
67
|
+
value: i
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return r;
|
|
302
71
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
72
|
+
function S(e, t) {
|
|
73
|
+
return e === t.getFullYear();
|
|
305
74
|
}
|
|
306
|
-
function
|
|
307
|
-
|
|
308
|
-
for (let s = e; s <= n; s++) {
|
|
309
|
-
const a = r(`${s}`);
|
|
310
|
-
o.push({ label: a, value: s });
|
|
311
|
-
}
|
|
312
|
-
return o;
|
|
75
|
+
function C(e, t) {
|
|
76
|
+
return e === t.getFullYear();
|
|
313
77
|
}
|
|
314
|
-
function
|
|
315
|
-
|
|
78
|
+
function w(e, t) {
|
|
79
|
+
return e === t.getMonth() + 1;
|
|
316
80
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
81
|
+
function T(e, t) {
|
|
82
|
+
return e === t.getMonth() + 1;
|
|
319
83
|
}
|
|
320
|
-
function
|
|
321
|
-
|
|
84
|
+
function E(e, t) {
|
|
85
|
+
return new Date(e, t, 0).getDate();
|
|
322
86
|
}
|
|
323
|
-
function
|
|
324
|
-
|
|
87
|
+
function D(e, t, n) {
|
|
88
|
+
let r = /* @__PURE__ */ new Date(), i = Date.now(), a = e.getTime(), o = t.getTime(), s = i >= a && i <= o;
|
|
89
|
+
return n === "year" ? s ? r.getFullYear() : e.getFullYear() : n === "month" ? (s ? r.getMonth() : e.getMonth()) + 1 : s ? r.getDate() : e.getDate();
|
|
325
90
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
91
|
+
function O(e) {
|
|
92
|
+
return e;
|
|
328
93
|
}
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
return r === "year" ? c ? o.getFullYear() : e.getFullYear() : r === "month" ? c ? o.getMonth() + 1 : e.getMonth() + 1 : c ? o.getDate() : e.getDate();
|
|
94
|
+
function k(e) {
|
|
95
|
+
return /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(e);
|
|
332
96
|
}
|
|
333
|
-
function
|
|
334
|
-
|
|
97
|
+
function A(e) {
|
|
98
|
+
if (!k(e)) return null;
|
|
99
|
+
let [t, n, r] = e.split(":");
|
|
100
|
+
return {
|
|
101
|
+
hour: Number(t),
|
|
102
|
+
minute: Number(n),
|
|
103
|
+
second: Number(r)
|
|
104
|
+
};
|
|
335
105
|
}
|
|
336
|
-
function
|
|
337
|
-
|
|
106
|
+
function j(e) {
|
|
107
|
+
return e.padStart(2, "0");
|
|
338
108
|
}
|
|
339
|
-
function
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return { hour: Number(n), minute: Number(r), second: Number(o) };
|
|
109
|
+
function M(e, t, n) {
|
|
110
|
+
let r = Date.now(), { hour: i, minute: a, second: o } = e, { hour: s, minute: c, second: l } = t, u = (/* @__PURE__ */ new Date()).setHours(i, a, o), d = (/* @__PURE__ */ new Date()).setHours(s, c, l), f = r >= u && r <= d;
|
|
111
|
+
return n === "hour" ? f ? (/* @__PURE__ */ new Date()).getHours() : i : n === "minute" ? f ? (/* @__PURE__ */ new Date()).getMinutes() : a : f ? (/* @__PURE__ */ new Date()).getSeconds() : o;
|
|
343
112
|
}
|
|
344
|
-
|
|
345
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/react/hooks/fixed-forward-ref.ts
|
|
115
|
+
function N(t) {
|
|
116
|
+
return e(t);
|
|
346
117
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/shared/utils/pointer.ts
|
|
120
|
+
function P() {
|
|
121
|
+
let e = {
|
|
122
|
+
startX: 0,
|
|
123
|
+
startY: 0,
|
|
124
|
+
deltaX: 0,
|
|
125
|
+
deltaY: 0,
|
|
126
|
+
offsetX: 0,
|
|
127
|
+
offsetY: 0
|
|
128
|
+
}, t = "", n = !0, r = () => t === "vertical", i = () => t === "horizontal";
|
|
129
|
+
function a() {
|
|
130
|
+
e.deltaX = 0, e.deltaY = 0, e.offsetX = 0, e.offsetY = 0, t = "", n = !0;
|
|
131
|
+
}
|
|
132
|
+
function o(t) {
|
|
133
|
+
let n = "touches" in t ? t.touches[0] : t;
|
|
134
|
+
a(), e.startX = n.clientX, e.startY = n.clientY;
|
|
135
|
+
}
|
|
136
|
+
function s(r) {
|
|
137
|
+
if (!e.startX || !e.startY) return !0;
|
|
138
|
+
let i = "touches" in r ? r.touches[0] : r;
|
|
139
|
+
e.deltaX = Math.max(i.clientX, 0) - e.startX, e.deltaY = i.clientY - e.startY, e.offsetX = Math.abs(e.deltaX), e.offsetY = Math.abs(e.deltaY), (!t || e.offsetX < 10 && e.offsetY < 10) && (t = y(e.offsetX, e.offsetY)), n && (e.offsetX > 5 || e.offsetY > 5) && (n = !1);
|
|
140
|
+
}
|
|
141
|
+
function c() {
|
|
142
|
+
e.startX = 0, e.startY = 0;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
pointer: e,
|
|
146
|
+
move: s,
|
|
147
|
+
start: o,
|
|
148
|
+
stop: c,
|
|
149
|
+
reset: a,
|
|
150
|
+
isVertical: r,
|
|
151
|
+
isHorizontal: i
|
|
152
|
+
};
|
|
350
153
|
}
|
|
351
|
-
|
|
352
|
-
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/react/hooks/use-scroll-snap.ts
|
|
156
|
+
function F({ column: e, onChange: t }) {
|
|
157
|
+
let n = b() / 16, [o, s] = a(0), c = i(null), u = i(0), d = i(0), f = i(0), p = i(0), m = i(!1), h = i(null), { pointer: g, start: _, move: v, stop: y } = r(() => P(), []);
|
|
158
|
+
function x(e) {
|
|
159
|
+
return e * n;
|
|
160
|
+
}
|
|
161
|
+
function S(t) {
|
|
162
|
+
let n = e.length, r = Math.round(-t / x(48));
|
|
163
|
+
return r < 0 ? 0 : r >= n ? n - 1 : r;
|
|
164
|
+
}
|
|
165
|
+
function C(e) {
|
|
166
|
+
let n = -e * x(48), r = () => t?.(e);
|
|
167
|
+
m.current && n !== u.current ? h.current = r : r(), E(n);
|
|
168
|
+
}
|
|
169
|
+
function w(e) {
|
|
170
|
+
_(e), m.current = !0, s(0), f.current = Date.now(), d.current = u.current, p.current = d.current, h.current = null;
|
|
171
|
+
}
|
|
172
|
+
function T(t) {
|
|
173
|
+
if (v(t)) return;
|
|
174
|
+
let n = e.length, r = d.current + g.deltaY, i = x((n - 1) * -48), a = Math.min(Math.max(r, i), 0), o = Date.now();
|
|
175
|
+
E(a), !(o - f.current <= 300) && (f.current = o, p.current = a);
|
|
176
|
+
}
|
|
177
|
+
function E(e) {
|
|
178
|
+
u.current = e, c.current && c.current.style.setProperty("--offset-y", String(e));
|
|
179
|
+
}
|
|
180
|
+
function D() {
|
|
181
|
+
y();
|
|
182
|
+
let e = u.current - p.current, t = Date.now() - f.current;
|
|
183
|
+
if (t < 300 && Math.abs(e) > 15) {
|
|
184
|
+
O(e, t);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
let n = S(u.current);
|
|
188
|
+
s(150), C(n), m.current = !1;
|
|
189
|
+
}
|
|
190
|
+
function O(e, t) {
|
|
191
|
+
let n = Math.abs(e / t), r = S(u.current + n / l * (e < 0 ? -1 : 1));
|
|
192
|
+
s(300), C(r);
|
|
193
|
+
}
|
|
194
|
+
function k() {
|
|
195
|
+
s(0), m.current = !1, h.current &&= (h.current(), null);
|
|
196
|
+
}
|
|
197
|
+
function A(e, t = "auto") {
|
|
198
|
+
m.current && t === "smooth" || (h.current = null, m.current = t === "smooth", s(t === "smooth" ? 150 : 0), C(e));
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
columnRef: c,
|
|
202
|
+
transitionDuration: o,
|
|
203
|
+
onPointerDown: w,
|
|
204
|
+
onPointerMove: T,
|
|
205
|
+
onPointerUp: D,
|
|
206
|
+
stopInertialSliding: k,
|
|
207
|
+
scrollToIndex: A
|
|
208
|
+
};
|
|
353
209
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region ../../node_modules/.pnpm/react@19.2.7/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
212
|
+
var I = /* @__PURE__ */ o(((e) => {
|
|
213
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
214
|
+
function r(e, n, r) {
|
|
215
|
+
var i = null;
|
|
216
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
217
|
+
else r = n;
|
|
218
|
+
return n = r.ref, {
|
|
219
|
+
$$typeof: t,
|
|
220
|
+
type: e,
|
|
221
|
+
key: i,
|
|
222
|
+
ref: n === void 0 ? null : n,
|
|
223
|
+
props: r
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
227
|
+
})), L = /* @__PURE__ */ o(((e) => {
|
|
228
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
229
|
+
function t(e) {
|
|
230
|
+
if (e == null) return null;
|
|
231
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
232
|
+
if (typeof e == "string") return e;
|
|
233
|
+
switch (e) {
|
|
234
|
+
case v: return "Fragment";
|
|
235
|
+
case b: return "Profiler";
|
|
236
|
+
case y: return "StrictMode";
|
|
237
|
+
case w: return "Suspense";
|
|
238
|
+
case T: return "SuspenseList";
|
|
239
|
+
case O: return "Activity";
|
|
240
|
+
}
|
|
241
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
242
|
+
case _: return "Portal";
|
|
243
|
+
case S: return e.displayName || "Context";
|
|
244
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
245
|
+
case C:
|
|
246
|
+
var n = e.render;
|
|
247
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
248
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
249
|
+
case D:
|
|
250
|
+
n = e._payload, e = e._init;
|
|
251
|
+
try {
|
|
252
|
+
return t(e(n));
|
|
253
|
+
} catch {}
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
function n(e) {
|
|
258
|
+
return "" + e;
|
|
259
|
+
}
|
|
260
|
+
function r(e) {
|
|
261
|
+
try {
|
|
262
|
+
n(e);
|
|
263
|
+
var t = !1;
|
|
264
|
+
} catch {
|
|
265
|
+
t = !0;
|
|
266
|
+
}
|
|
267
|
+
if (t) {
|
|
268
|
+
t = console;
|
|
269
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
270
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function i(e) {
|
|
274
|
+
if (e === v) return "<>";
|
|
275
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
276
|
+
try {
|
|
277
|
+
var n = t(e);
|
|
278
|
+
return n ? "<" + n + ">" : "<...>";
|
|
279
|
+
} catch {
|
|
280
|
+
return "<...>";
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function a() {
|
|
284
|
+
var e = A.A;
|
|
285
|
+
return e === null ? null : e.getOwner();
|
|
286
|
+
}
|
|
287
|
+
function o() {
|
|
288
|
+
return Error("react-stack-top-frame");
|
|
289
|
+
}
|
|
290
|
+
function c(e) {
|
|
291
|
+
if (j.call(e, "key")) {
|
|
292
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
293
|
+
if (t && t.isReactWarning) return !1;
|
|
294
|
+
}
|
|
295
|
+
return e.key !== void 0;
|
|
296
|
+
}
|
|
297
|
+
function l(e, t) {
|
|
298
|
+
function n() {
|
|
299
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
300
|
+
}
|
|
301
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
302
|
+
get: n,
|
|
303
|
+
configurable: !0
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function u() {
|
|
307
|
+
var e = t(this.type);
|
|
308
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
309
|
+
}
|
|
310
|
+
function d(e, t, n, r, i, a) {
|
|
311
|
+
var o = n.ref;
|
|
312
|
+
return e = {
|
|
313
|
+
$$typeof: g,
|
|
314
|
+
type: e,
|
|
315
|
+
key: t,
|
|
316
|
+
props: n,
|
|
317
|
+
_owner: r
|
|
318
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
319
|
+
enumerable: !1,
|
|
320
|
+
value: null
|
|
321
|
+
}) : Object.defineProperty(e, "ref", {
|
|
322
|
+
enumerable: !1,
|
|
323
|
+
get: u
|
|
324
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
325
|
+
configurable: !1,
|
|
326
|
+
enumerable: !1,
|
|
327
|
+
writable: !0,
|
|
328
|
+
value: 0
|
|
329
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
330
|
+
configurable: !1,
|
|
331
|
+
enumerable: !1,
|
|
332
|
+
writable: !0,
|
|
333
|
+
value: null
|
|
334
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
335
|
+
configurable: !1,
|
|
336
|
+
enumerable: !1,
|
|
337
|
+
writable: !0,
|
|
338
|
+
value: i
|
|
339
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
340
|
+
configurable: !1,
|
|
341
|
+
enumerable: !1,
|
|
342
|
+
writable: !0,
|
|
343
|
+
value: a
|
|
344
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
345
|
+
}
|
|
346
|
+
function f(e, n, i, o, s, u) {
|
|
347
|
+
var f = n.children;
|
|
348
|
+
if (f !== void 0) if (o) if (M(f)) {
|
|
349
|
+
for (o = 0; o < f.length; o++) p(f[o]);
|
|
350
|
+
Object.freeze && Object.freeze(f);
|
|
351
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
352
|
+
else p(f);
|
|
353
|
+
if (j.call(n, "key")) {
|
|
354
|
+
f = t(e);
|
|
355
|
+
var m = Object.keys(n).filter(function(e) {
|
|
356
|
+
return e !== "key";
|
|
357
|
+
});
|
|
358
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
359
|
+
}
|
|
360
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
361
|
+
else i = n;
|
|
362
|
+
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), s, u);
|
|
363
|
+
}
|
|
364
|
+
function p(e) {
|
|
365
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
366
|
+
}
|
|
367
|
+
function m(e) {
|
|
368
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
369
|
+
}
|
|
370
|
+
var h = s("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
371
|
+
return null;
|
|
372
|
+
};
|
|
373
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
374
|
+
return e();
|
|
375
|
+
} };
|
|
376
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
|
|
377
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
378
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
379
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
380
|
+
}, e.jsxs = function(e, t, n) {
|
|
381
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
382
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
383
|
+
};
|
|
384
|
+
})();
|
|
385
|
+
})), R = (/* @__PURE__ */ o(((e, t) => {
|
|
386
|
+
process.env.NODE_ENV === "production" ? t.exports = I() : t.exports = L();
|
|
387
|
+
})))();
|
|
388
|
+
function z({ column: e, fields: t, selectedIndex: r = 0, onChange: i }, a) {
|
|
389
|
+
let { columnRef: o, transitionDuration: s, onPointerDown: l, onPointerMove: u, onPointerUp: d, stopInertialSliding: f, scrollToIndex: p } = F({
|
|
390
|
+
column: e,
|
|
391
|
+
onChange: m
|
|
392
|
+
});
|
|
393
|
+
function m(e) {
|
|
394
|
+
e !== r && i(e);
|
|
395
|
+
}
|
|
396
|
+
function h(e = r, t) {
|
|
397
|
+
p(e, t);
|
|
398
|
+
}
|
|
399
|
+
function g(e) {
|
|
400
|
+
e !== r && h(e, "smooth");
|
|
401
|
+
}
|
|
402
|
+
return n(a, () => ({ scrollToSelected: h })), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
403
|
+
role: "presentation",
|
|
404
|
+
"aria-label": "Picker column",
|
|
405
|
+
className: "chook-picker-column",
|
|
406
|
+
onTouchStart: l,
|
|
407
|
+
onTouchMove: u,
|
|
408
|
+
onTouchEnd: d,
|
|
409
|
+
onTouchCancel: d,
|
|
410
|
+
onMouseDown: l,
|
|
411
|
+
onMouseMove: u,
|
|
412
|
+
onMouseUp: d,
|
|
413
|
+
onMouseLeave: d,
|
|
414
|
+
style: {
|
|
415
|
+
overflowY: "hidden",
|
|
416
|
+
touchAction: "none"
|
|
417
|
+
},
|
|
418
|
+
children: /* @__PURE__ */ (0, R.jsx)("ul", {
|
|
419
|
+
ref: o,
|
|
420
|
+
style: {
|
|
421
|
+
overflowY: "hidden",
|
|
422
|
+
transform: "translate3d(0, calc(var(--offset-y) * 1px), 0)",
|
|
423
|
+
transitionDuration: `${s}ms`,
|
|
424
|
+
transitionProperty: s ? "all" : "none",
|
|
425
|
+
touchAction: "none"
|
|
426
|
+
},
|
|
427
|
+
onTransitionEnd: f,
|
|
428
|
+
children: e.map((e, n) => /* @__PURE__ */ (0, R.jsx)("div", {
|
|
429
|
+
tabIndex: 0,
|
|
430
|
+
role: "button",
|
|
431
|
+
"aria-label": "Select option",
|
|
432
|
+
className: "chook-picker-column-item",
|
|
433
|
+
onClick: () => g(n),
|
|
434
|
+
onKeyDown: (e) => {
|
|
435
|
+
(e.key === "Enter" || e.key === " ") && g(n);
|
|
436
|
+
},
|
|
437
|
+
children: /* @__PURE__ */ (0, R.jsx)("p", {
|
|
438
|
+
className: "chook-picker-column-label",
|
|
439
|
+
style: { transform: `rotate3d(1, 0, 0, calc((${n * 48} + var(--offset-y)) * ${c}deg)` },
|
|
440
|
+
children: e?.[t.label]
|
|
441
|
+
})
|
|
442
|
+
}, e?.[t.value]))
|
|
443
|
+
})
|
|
444
|
+
});
|
|
392
445
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
A(E, k);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
const P = O(c.current);
|
|
425
|
-
a(pe), l(P), p.current = !1;
|
|
426
|
-
}
|
|
427
|
-
function A(E, k) {
|
|
428
|
-
const P = Math.abs(E / k), V = c.current + P / Xe * (E < 0 ? -1 : 1), D = O(V);
|
|
429
|
-
a(re), l(D);
|
|
430
|
-
}
|
|
431
|
-
function Y() {
|
|
432
|
-
a(0), p.current = !1, u.current && (u.current(), u.current = null);
|
|
433
|
-
}
|
|
434
|
-
function I(E, k = "auto") {
|
|
435
|
-
p.current && k === "smooth" || (u.current = null, p.current = k === "smooth", a(k === "smooth" ? pe : 0), l(E));
|
|
436
|
-
}
|
|
437
|
-
return {
|
|
438
|
-
columnRef: f,
|
|
439
|
-
transitionDuration: s,
|
|
440
|
-
onPointerDown: T,
|
|
441
|
-
onPointerMove: g,
|
|
442
|
-
onPointerUp: w,
|
|
443
|
-
stopInertialSliding: Y,
|
|
444
|
-
scrollToIndex: I
|
|
445
|
-
};
|
|
446
|
+
var B = N(z);
|
|
447
|
+
B.displayName = "Column";
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/react/components/picker-columns.tsx
|
|
450
|
+
function V(e, t) {
|
|
451
|
+
let { loading: r, loadingSlot: a, columns: o, emptySlot: s, currentColumns: c, fields: l, selectedIndices: u, updateSelectedValueByIndex: d } = e, f = i([]);
|
|
452
|
+
function p(e, t) {
|
|
453
|
+
f.current[e]?.scrollToSelected(t);
|
|
454
|
+
}
|
|
455
|
+
return n(t, () => ({ scrollColumnToSelected: p })), r ? /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)("div", {
|
|
456
|
+
className: "chook-picker-loading",
|
|
457
|
+
children: a
|
|
458
|
+
}), /* @__PURE__ */ (0, R.jsx)("div", { className: "chook-picker-columns" })] }) : o.length ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
459
|
+
className: "chook-picker-columns chook-picker-columns-backdrop",
|
|
460
|
+
onTouchMove: (e) => e.stopPropagation(),
|
|
461
|
+
children: [c.map((e, t) => /* @__PURE__ */ (0, R.jsx)(B, {
|
|
462
|
+
ref: (e) => {
|
|
463
|
+
f.current[t] = e;
|
|
464
|
+
},
|
|
465
|
+
column: e,
|
|
466
|
+
fields: l,
|
|
467
|
+
selectedIndex: u[t],
|
|
468
|
+
onChange: (e) => d(t, e)
|
|
469
|
+
}, t)), /* @__PURE__ */ (0, R.jsx)("div", { className: "chook-picker-mask-backdrop" })]
|
|
470
|
+
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
471
|
+
className: "chook-picker-columns",
|
|
472
|
+
children: s
|
|
473
|
+
});
|
|
446
474
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
"div",
|
|
503
|
-
{
|
|
504
|
-
tabIndex: 0,
|
|
505
|
-
role: "button",
|
|
506
|
-
"aria-label": "Select option",
|
|
507
|
-
className: "chook-picker-column-item",
|
|
508
|
-
onClick: () => b(M),
|
|
509
|
-
onKeyDown: (v) => {
|
|
510
|
-
(v.key === "Enter" || v.key === " ") && b(M);
|
|
511
|
-
},
|
|
512
|
-
children: /* @__PURE__ */ N.jsx(
|
|
513
|
-
"p",
|
|
514
|
-
{
|
|
515
|
-
className: "chook-picker-column-label",
|
|
516
|
-
style: {
|
|
517
|
-
transform: `rotate3d(1, 0, 0, calc((${M * J} + var(--offset-y)) * ${Ve}deg)`
|
|
518
|
-
},
|
|
519
|
-
children: x?.[n.label]
|
|
520
|
-
}
|
|
521
|
-
)
|
|
522
|
-
},
|
|
523
|
-
x?.[n.value]
|
|
524
|
-
))
|
|
525
|
-
}
|
|
526
|
-
)
|
|
527
|
-
}
|
|
528
|
-
);
|
|
475
|
+
var H = N(V);
|
|
476
|
+
H.displayName = "Columns";
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/react/components/picker.tsx
|
|
479
|
+
function U({ values: e, columns: n, loading: o = !1, loadingSlot: s, emptySlot: c, columnsFieldNames: l, onChange: u }) {
|
|
480
|
+
let [d, f] = a(e ?? []), [v, y] = a([]), b = i(null), x = m(l), S = p(n, x), C = r(() => S === "single" ? [n] : S === "multiple" ? n : h(n, d, x), [
|
|
481
|
+
n,
|
|
482
|
+
S,
|
|
483
|
+
d,
|
|
484
|
+
x
|
|
485
|
+
]);
|
|
486
|
+
function w(e, t) {
|
|
487
|
+
let n = C[e], r = n[t]?.[x.value];
|
|
488
|
+
if (r === d[e]) return;
|
|
489
|
+
let i = [...d];
|
|
490
|
+
if (i[e] = r, S === "cascade") {
|
|
491
|
+
let r = n[t], a = g(r, e, i, x);
|
|
492
|
+
f(a), u?.(a);
|
|
493
|
+
} else f(i), u?.(i);
|
|
494
|
+
}
|
|
495
|
+
function T(e) {
|
|
496
|
+
return e.some((e, t) => e !== d[t]);
|
|
497
|
+
}
|
|
498
|
+
return t(() => {
|
|
499
|
+
!e || !T(e) || f([...e]);
|
|
500
|
+
}, [e]), t(() => {
|
|
501
|
+
let e = C.length, t = [], n = [...d], r = !1;
|
|
502
|
+
for (let i = 0; i < e; i++) {
|
|
503
|
+
let e = C[i], a = d[i], o = _(e, a, x);
|
|
504
|
+
if (o === -1) {
|
|
505
|
+
let r = (v[i] ?? 0) >= e.length ? Math.max(e.length - 1, 0) : 0;
|
|
506
|
+
n[i] = e[r]?.[x.value], t[i] = r;
|
|
507
|
+
} else t[i] = o;
|
|
508
|
+
t[i] !== v[i] && (b.current?.scrollColumnToSelected(i, t[i]), r = !0);
|
|
509
|
+
}
|
|
510
|
+
r && (f(n), y(t));
|
|
511
|
+
}, [
|
|
512
|
+
d,
|
|
513
|
+
C,
|
|
514
|
+
x
|
|
515
|
+
]), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
516
|
+
className: "chook-picker-container",
|
|
517
|
+
"aria-label": "Picker",
|
|
518
|
+
children: /* @__PURE__ */ (0, R.jsx)(H, {
|
|
519
|
+
ref: b,
|
|
520
|
+
loading: o,
|
|
521
|
+
loadingSlot: s,
|
|
522
|
+
columns: n,
|
|
523
|
+
emptySlot: c,
|
|
524
|
+
currentColumns: C,
|
|
525
|
+
fields: x,
|
|
526
|
+
selectedIndices: v,
|
|
527
|
+
updateSelectedValueByIndex: w
|
|
528
|
+
})
|
|
529
|
+
});
|
|
529
530
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
function
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/react/components/date-picker.tsx
|
|
533
|
+
function W({ values: e, columnsType: i = u, minDate: o = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1), maxDate: s = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31), formatYearLabel: c = O, formatMonthLabel: l = O, formatDayLabel: d = O, onChange: f }, p) {
|
|
534
|
+
let [m, h] = a([]), g = r(() => e ?? m, [e, m]), _ = r(() => {
|
|
535
|
+
let e = {
|
|
536
|
+
year: v,
|
|
537
|
+
month: y,
|
|
538
|
+
day: b
|
|
539
|
+
};
|
|
540
|
+
return i.map((t) => e[t]());
|
|
541
|
+
}, [
|
|
542
|
+
i,
|
|
543
|
+
o,
|
|
544
|
+
s,
|
|
545
|
+
g,
|
|
546
|
+
c,
|
|
547
|
+
l,
|
|
548
|
+
d
|
|
549
|
+
]);
|
|
550
|
+
function v() {
|
|
551
|
+
return x(o.getFullYear(), s.getFullYear(), c);
|
|
552
|
+
}
|
|
553
|
+
function y() {
|
|
554
|
+
let e = k("year");
|
|
555
|
+
return x(S(e, o) ? o.getMonth() + 1 : 1, C(e, s) ? s.getMonth() + 1 : 12, l);
|
|
556
|
+
}
|
|
557
|
+
function b() {
|
|
558
|
+
let e = k("year"), t = k("month"), n = S(e, o) && w(t, o), r = C(e, s) && T(t, s);
|
|
559
|
+
return x(n ? o.getDate() : 1, r ? s.getDate() : E(e, t), d);
|
|
560
|
+
}
|
|
561
|
+
function k(e) {
|
|
562
|
+
let t = i.indexOf(e), n = g?.[t];
|
|
563
|
+
return n ? Number(n) : D(o, s, e);
|
|
564
|
+
}
|
|
565
|
+
function A(t) {
|
|
566
|
+
e || h(t), f?.(t);
|
|
567
|
+
}
|
|
568
|
+
function j() {
|
|
569
|
+
A(i.map((e) => D(o, s, e)));
|
|
570
|
+
}
|
|
571
|
+
return t(() => {
|
|
572
|
+
(!e || !e.length) && j();
|
|
573
|
+
}, []), n(p, () => ({ setCurrentDate: j })), /* @__PURE__ */ (0, R.jsx)(U, {
|
|
574
|
+
values: g,
|
|
575
|
+
columns: _,
|
|
576
|
+
onChange: A
|
|
577
|
+
});
|
|
574
578
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
Se,
|
|
622
|
-
{
|
|
623
|
-
ref: p,
|
|
624
|
-
loading: r,
|
|
625
|
-
loadingSlot: o,
|
|
626
|
-
columns: n,
|
|
627
|
-
emptySlot: s,
|
|
628
|
-
currentColumns: b,
|
|
629
|
-
fields: u,
|
|
630
|
-
selectedIndices: d,
|
|
631
|
-
updateSelectedValueByIndex: x
|
|
632
|
-
}
|
|
633
|
-
)
|
|
634
|
-
}
|
|
635
|
-
);
|
|
579
|
+
var G = N(W);
|
|
580
|
+
G.displayName = "DatePicker";
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/react/components/time-picker.tsx
|
|
583
|
+
function K({ values: e, columnsType: i = d, minTime: o, maxTime: s, formatHourLabel: c = j, formatMinuteLabel: l = j, formatSecondLabel: u = j, onChange: f }, p) {
|
|
584
|
+
let [m, h] = a([]), g = r(() => e ?? m, [e, m]), _ = r(() => A(o ?? "") ?? {
|
|
585
|
+
hour: 0,
|
|
586
|
+
minute: 0,
|
|
587
|
+
second: 0
|
|
588
|
+
}, [o]), v = r(() => A(s ?? "") ?? {
|
|
589
|
+
hour: 23,
|
|
590
|
+
minute: 59,
|
|
591
|
+
second: 59
|
|
592
|
+
}, [s]), y = {
|
|
593
|
+
hour: S,
|
|
594
|
+
minute: C,
|
|
595
|
+
second: w
|
|
596
|
+
}, b = i.map((e) => y[e]());
|
|
597
|
+
function S() {
|
|
598
|
+
return x(_.hour, v.hour, c);
|
|
599
|
+
}
|
|
600
|
+
function C() {
|
|
601
|
+
let e = T("hour"), { hour: t, minute: n } = _, { hour: r, minute: i } = v;
|
|
602
|
+
return x(e === t ? n : 0, e === r ? i : 59, l);
|
|
603
|
+
}
|
|
604
|
+
function w() {
|
|
605
|
+
let e = T("hour"), t = T("minute"), { hour: n, minute: r, second: i } = _, { hour: a, minute: o, second: s } = v;
|
|
606
|
+
return x(e === n && t === r ? i : 0, e === a && t === o ? s : 59, u);
|
|
607
|
+
}
|
|
608
|
+
function T(e) {
|
|
609
|
+
let t = i.indexOf(e), n = g?.[t];
|
|
610
|
+
return n === void 0 ? M(_, v, e) : Number(n);
|
|
611
|
+
}
|
|
612
|
+
function E(t) {
|
|
613
|
+
e || h(t), f?.(t);
|
|
614
|
+
}
|
|
615
|
+
function D() {
|
|
616
|
+
E(i.map((e) => M(_, v, e)));
|
|
617
|
+
}
|
|
618
|
+
return t(() => {
|
|
619
|
+
(!e || !e.length) && D();
|
|
620
|
+
}, []), n(p, () => ({ setCurrentTime: D })), /* @__PURE__ */ (0, R.jsx)(U, {
|
|
621
|
+
values: g,
|
|
622
|
+
columns: b,
|
|
623
|
+
onChange: E
|
|
624
|
+
});
|
|
636
625
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
maxDate: o = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31),
|
|
642
|
-
formatYearLabel: s = te,
|
|
643
|
-
formatMonthLabel: a = te,
|
|
644
|
-
formatDayLabel: f = te,
|
|
645
|
-
onChange: c
|
|
646
|
-
}, S) {
|
|
647
|
-
const [d, _] = W([]), p = F(() => e ?? d, [e, d]), u = F(() => {
|
|
648
|
-
const l = {
|
|
649
|
-
year: h,
|
|
650
|
-
month: b,
|
|
651
|
-
day: x
|
|
652
|
-
};
|
|
653
|
-
return n.map((T) => l[T]());
|
|
654
|
-
}, [n, r, o, p, s, a, f]);
|
|
655
|
-
function h() {
|
|
656
|
-
const l = r.getFullYear(), T = o.getFullYear();
|
|
657
|
-
return X(l, T, s);
|
|
658
|
-
}
|
|
659
|
-
function b() {
|
|
660
|
-
const l = M("year"), T = le(l, r) ? r.getMonth() + 1 : 1, g = fe(l, o) ? o.getMonth() + 1 : 12;
|
|
661
|
-
return X(T, g, a);
|
|
662
|
-
}
|
|
663
|
-
function x() {
|
|
664
|
-
const l = M("year"), T = M("month"), g = le(l, r) && Ye(T, r), m = fe(l, o) && Ie(T, o), w = g ? r.getDate() : 1, A = m ? o.getDate() : je(l, T);
|
|
665
|
-
return X(w, A, f);
|
|
666
|
-
}
|
|
667
|
-
function M(l) {
|
|
668
|
-
const T = n.indexOf(l), g = p?.[T];
|
|
669
|
-
return g ? Number(g) : de(r, o, l);
|
|
670
|
-
}
|
|
671
|
-
function v(l) {
|
|
672
|
-
e || _(l), c?.(l);
|
|
673
|
-
}
|
|
674
|
-
function O() {
|
|
675
|
-
const l = n.map((T) => de(r, o, T));
|
|
676
|
-
v(l);
|
|
677
|
-
}
|
|
678
|
-
return G(() => {
|
|
679
|
-
(!e || !e.length) && O();
|
|
680
|
-
}, []), Z(S, () => ({
|
|
681
|
-
setCurrentDate: O
|
|
682
|
-
})), /* @__PURE__ */ N.jsx(
|
|
683
|
-
ve,
|
|
684
|
-
{
|
|
685
|
-
values: p,
|
|
686
|
-
columns: u,
|
|
687
|
-
onChange: v
|
|
688
|
-
}
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
const Je = Q(qe);
|
|
692
|
-
Je.displayName = "DatePicker";
|
|
693
|
-
function Ge({
|
|
694
|
-
values: e,
|
|
695
|
-
columnsType: n = Le,
|
|
696
|
-
minTime: r,
|
|
697
|
-
maxTime: o,
|
|
698
|
-
formatHourLabel: s = ne,
|
|
699
|
-
formatMinuteLabel: a = ne,
|
|
700
|
-
formatSecondLabel: f = ne,
|
|
701
|
-
onChange: c
|
|
702
|
-
}, S) {
|
|
703
|
-
const [d, _] = W([]), p = F(() => e ?? d, [e, d]), u = F(() => me(r ?? "") ?? { hour: 0, minute: 0, second: 0 }, [r]), h = F(() => me(o ?? "") ?? { hour: 23, minute: 59, second: 59 }, [o]), b = {
|
|
704
|
-
hour: M,
|
|
705
|
-
minute: v,
|
|
706
|
-
second: O
|
|
707
|
-
}, x = n.map((m) => b[m]());
|
|
708
|
-
function M() {
|
|
709
|
-
return X(u.hour, h.hour, s);
|
|
710
|
-
}
|
|
711
|
-
function v() {
|
|
712
|
-
const m = l("hour"), { hour: w, minute: A } = u, { hour: Y, minute: I } = h;
|
|
713
|
-
return X(m === w ? A : 0, m === Y ? I : 59, a);
|
|
714
|
-
}
|
|
715
|
-
function O() {
|
|
716
|
-
const m = l("hour"), w = l("minute"), { hour: A, minute: Y, second: I } = u, { hour: E, minute: k, second: P } = h;
|
|
717
|
-
return X(m === A && w === Y ? I : 0, m === E && w === k ? P : 59, f);
|
|
718
|
-
}
|
|
719
|
-
function l(m) {
|
|
720
|
-
const w = n.indexOf(m), A = p?.[w];
|
|
721
|
-
return A !== void 0 ? Number(A) : he(u, h, m);
|
|
722
|
-
}
|
|
723
|
-
function T(m) {
|
|
724
|
-
e || _(m), c?.(m);
|
|
725
|
-
}
|
|
726
|
-
function g() {
|
|
727
|
-
const m = n.map((w) => he(u, h, w));
|
|
728
|
-
T(m);
|
|
729
|
-
}
|
|
730
|
-
return G(() => {
|
|
731
|
-
(!e || !e.length) && g();
|
|
732
|
-
}, []), Z(S, () => ({
|
|
733
|
-
setCurrentTime: g
|
|
734
|
-
})), /* @__PURE__ */ N.jsx(
|
|
735
|
-
ve,
|
|
736
|
-
{
|
|
737
|
-
values: p,
|
|
738
|
-
columns: x,
|
|
739
|
-
onChange: T
|
|
740
|
-
}
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
const Ze = Q(Ge);
|
|
744
|
-
Ze.displayName = "TimePicker";
|
|
745
|
-
export {
|
|
746
|
-
Je as DatePicker,
|
|
747
|
-
ve as Picker,
|
|
748
|
-
Ze as TimePicker
|
|
749
|
-
};
|
|
626
|
+
var q = N(K);
|
|
627
|
+
q.displayName = "TimePicker";
|
|
628
|
+
//#endregion
|
|
629
|
+
export { G as DatePicker, U as Picker, q as TimePicker };
|