@jc-times/business-ui 0.3.2 → 0.4.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/AGENTS.md +15 -0
- package/CHANGELOG.md +22 -0
- package/README.md +2 -0
- package/THIRD_PARTY_NOTICES.md +3 -0
- package/bin/business-ui-gate.mjs +2 -2
- package/dist/AntDateWheelView.js +131 -0
- package/dist/AntOptionWheelView.js +76 -0
- package/dist/AsyncDirectoryPicker.js +89 -88
- package/dist/AsyncSearchPicker.js +136 -82
- package/dist/Cascader.js +56 -51
- package/dist/DateInput.js +84 -66
- package/dist/DateWheelPicker.js +58 -0
- package/dist/MobilePickerPanel.js +34 -0
- package/dist/ModalShell.js +84 -72
- package/dist/MultiSelect.js +5 -1
- package/dist/OptionWheelDialog.js +99 -0
- package/dist/Select.js +116 -61
- package/dist/StructuredAddressInput.js +72 -70
- package/dist/TreeSelect.js +265 -217
- package/dist/WheelCascader.js +123 -0
- package/dist/WheelDateInput.js +97 -0
- package/dist/business-ui.js +42 -39
- package/dist/date-wheel-model.js +27 -0
- package/dist/option-wheel-model.js +49 -0
- package/dist/styles.css +1 -1
- package/dist/types/AntDateWheelView.d.ts +9 -0
- package/dist/types/AntOptionWheelView.d.ts +8 -0
- package/dist/types/AsyncDirectoryPicker.d.ts +2 -1
- package/dist/types/AsyncSearchPicker.d.ts +3 -1
- package/dist/types/Cascader.d.ts +2 -0
- package/dist/types/DateInput.d.ts +4 -0
- package/dist/types/DateWheelPicker.d.ts +13 -0
- package/dist/types/MobilePickerPanel.d.ts +11 -0
- package/dist/types/ModalShell.d.ts +3 -1
- package/dist/types/OptionWheelDialog.d.ts +18 -0
- package/dist/types/Select.d.ts +4 -1
- package/dist/types/StructuredAddressInput.d.ts +3 -1
- package/dist/types/TreeSelect.d.ts +2 -1
- package/dist/types/WheelCascader.d.ts +6 -0
- package/dist/types/WheelDateInput.d.ts +11 -0
- package/dist/types/date-wheel-model.d.ts +8 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/option-wheel-model.d.ts +19 -0
- package/dist/types/usePhoneWheel.d.ts +2 -0
- package/dist/types/useSheetViewport.d.ts +3 -0
- package/dist/usePhoneWheel.js +16 -0
- package/dist/useSheetViewport.js +26 -0
- package/docs/agent-guide.md +15 -5
- package/docs/api.md +16 -0
- package/docs/cascader.md +2 -0
- package/docs/component-strategy.md +18 -0
- package/docs/date-wheel.md +25 -0
- package/docs/dependencies.md +2 -0
- package/docs/mobile-controls.md +74 -0
- package/docs/modal-shell-migration.md +25 -0
- package/docs/release.md +8 -1
- package/docs/viewport-qa.md +52 -0
- package/licenses/antd-mobile-MIT.txt +22 -0
- package/package.json +11 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { FormField as e } from "./FormField.js";
|
|
2
|
+
import { enabledWheelOptions as t, resolveWheelPath as n, wheelOptionsKey as r } from "./option-wheel-model.js";
|
|
3
|
+
import { OptionWheelDialog as i } from "./OptionWheelDialog.js";
|
|
4
|
+
import { useCallback as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
//#region src/WheelCascader.tsx
|
|
7
|
+
function f(f) {
|
|
8
|
+
let p = s(), m = f.id ?? f.inputProps?.id ?? p, h = c(null), g = a((e) => {
|
|
9
|
+
h.current = e, typeof f.inputRef == "function" ? f.inputRef(e) : f.inputRef && (f.inputRef.current = e);
|
|
10
|
+
}, [f.inputRef]), [_, v] = l(!1), [y, b] = l();
|
|
11
|
+
o(() => {
|
|
12
|
+
(f.value.length || !f.required) && b(void 0);
|
|
13
|
+
}, [f.value.length, f.required]);
|
|
14
|
+
let x = f.error ?? y, S = JSON.stringify([
|
|
15
|
+
f.value,
|
|
16
|
+
r(f.options),
|
|
17
|
+
!!f.disabled,
|
|
18
|
+
!!f.inputProps?.readOnly
|
|
19
|
+
]), [C, w] = l(S), T = C !== S, E = f.open ?? _, [D, O] = l(!1), k = E && !f.disabled && !f.inputProps?.readOnly && !T && !D;
|
|
20
|
+
function A() {
|
|
21
|
+
v(!1), f.onOpenChange?.(!1);
|
|
22
|
+
}
|
|
23
|
+
o(() => {
|
|
24
|
+
T && (w(S), E && (O(!0), A()));
|
|
25
|
+
}, [
|
|
26
|
+
S,
|
|
27
|
+
T,
|
|
28
|
+
E
|
|
29
|
+
]), o(() => {
|
|
30
|
+
E || O(!1);
|
|
31
|
+
}, [E]);
|
|
32
|
+
function j() {
|
|
33
|
+
f.disabled || f.inputProps?.readOnly || (w(S), O(!1), v(!0), f.onOpenChange?.(!0));
|
|
34
|
+
}
|
|
35
|
+
let M = [], N = f.options;
|
|
36
|
+
for (let e of f.value) {
|
|
37
|
+
let t = N.find((t) => t.value === e);
|
|
38
|
+
if (!t) break;
|
|
39
|
+
M.push(t), N = t.children ?? [];
|
|
40
|
+
}
|
|
41
|
+
let { onClick: P, onKeyDown: F, ...I } = f.inputProps ?? {}, L = [
|
|
42
|
+
I["aria-describedby"],
|
|
43
|
+
f.helpText !== void 0 && `${m}-help`,
|
|
44
|
+
x && `${m}-error`
|
|
45
|
+
].filter(Boolean).join(" ") || void 0;
|
|
46
|
+
function R(e) {
|
|
47
|
+
if (f.disabled || f.inputProps?.readOnly || T) return;
|
|
48
|
+
if (!e.length) {
|
|
49
|
+
if (f.required || f.allowClear === !1) return;
|
|
50
|
+
f.onValueChange([], []), A();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let r = n(t(f.options), e);
|
|
54
|
+
if (JSON.stringify(r.value) !== JSON.stringify(e)) return;
|
|
55
|
+
let i = [], a = f.options;
|
|
56
|
+
for (let t of e) {
|
|
57
|
+
let e = a.find((e) => e.value === t);
|
|
58
|
+
i.push(e), a = e.children ?? [];
|
|
59
|
+
}
|
|
60
|
+
JSON.stringify(f.value) !== JSON.stringify(e) && f.onValueChange(e, i), A();
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ d(e, {
|
|
63
|
+
controlId: m,
|
|
64
|
+
label: f.label,
|
|
65
|
+
helpText: f.helpText,
|
|
66
|
+
error: x,
|
|
67
|
+
required: f.required,
|
|
68
|
+
children: [
|
|
69
|
+
f.required && /* @__PURE__ */ u("input", {
|
|
70
|
+
className: "ui-wheel-validation",
|
|
71
|
+
tabIndex: -1,
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
required: !0,
|
|
74
|
+
disabled: f.disabled,
|
|
75
|
+
value: f.value.length ? "selected" : "",
|
|
76
|
+
onChange: () => {},
|
|
77
|
+
onInvalid: (e) => {
|
|
78
|
+
e.preventDefault(), b("请选择一个选项"), h.current?.focus();
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ u("input", {
|
|
82
|
+
...I,
|
|
83
|
+
id: m,
|
|
84
|
+
ref: g,
|
|
85
|
+
type: "text",
|
|
86
|
+
readOnly: !0,
|
|
87
|
+
inputMode: "none",
|
|
88
|
+
disabled: f.disabled,
|
|
89
|
+
className: `ui-input ui-wheel-cascader ${f.className ?? ""}`,
|
|
90
|
+
value: M.map((e) => e.label).join(" / "),
|
|
91
|
+
placeholder: f.placeholder ?? "请选择",
|
|
92
|
+
"aria-haspopup": "dialog",
|
|
93
|
+
"aria-expanded": k,
|
|
94
|
+
"aria-required": f.required || void 0,
|
|
95
|
+
"aria-invalid": x ? !0 : I["aria-invalid"],
|
|
96
|
+
"aria-describedby": L,
|
|
97
|
+
onClick: (e) => {
|
|
98
|
+
P?.(e), e.defaultPrevented || j();
|
|
99
|
+
},
|
|
100
|
+
onKeyDown: (e) => {
|
|
101
|
+
F?.(e), !e.defaultPrevented && [
|
|
102
|
+
"Enter",
|
|
103
|
+
" ",
|
|
104
|
+
"ArrowDown"
|
|
105
|
+
].includes(e.key) && (e.preventDefault(), j());
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
k && /* @__PURE__ */ u(i, {
|
|
109
|
+
options: f.options,
|
|
110
|
+
value: f.value,
|
|
111
|
+
title: f.label ?? "选择选项",
|
|
112
|
+
returnFocus: h,
|
|
113
|
+
clearLabel: f.clearLabel,
|
|
114
|
+
emptyText: f.emptyText,
|
|
115
|
+
allowClear: !f.required && f.allowClear !== !1,
|
|
116
|
+
onClose: A,
|
|
117
|
+
onConfirm: R
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { f as WheelCascader };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Button as e } from "./Button.js";
|
|
2
|
+
import { useOverlayContainer as t } from "./OverlayContainer.js";
|
|
3
|
+
import { ModalShell as n } from "./ModalShell.js";
|
|
4
|
+
import { initialWheelDate as r, wheelBounds as i, wheelDate as a } from "./date-wheel-model.js";
|
|
5
|
+
import { DateWheelPicker as o } from "./DateWheelPicker.js";
|
|
6
|
+
import { forwardRef as s, useCallback as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal as g } from "react-dom";
|
|
9
|
+
//#region src/WheelDateInput.tsx
|
|
10
|
+
var _ = s(function({ value: s, onValueChange: _, minDate: v, maxDate: y, min: b, max: x, isDateUnavailable: S, inputRef: C, inputClassName: w, className: T = "", disabled: E, readOnly: D, required: O, onValidationError: k, onKeyDown: A, onClick: j, mobileMode: M, ...N }, P) {
|
|
11
|
+
let F = u(), I = d(null), L = t(), [R, z] = f(!1), [B, V] = f(""), [H, U] = f(!1), W = v ?? (b === void 0 ? void 0 : String(b)), G = y ?? (x === void 0 ? void 0 : String(x)), K = i(W, G), q = a(B), J = !K || !q || q.compare(K.min) < 0 || q.compare(K.max) > 0 || !!S?.(B), Y = E || D;
|
|
12
|
+
l(() => {
|
|
13
|
+
z(!1);
|
|
14
|
+
}, [s, Y]);
|
|
15
|
+
let X = c((e) => {
|
|
16
|
+
I.current = e;
|
|
17
|
+
for (let t of [P, C]) typeof t == "function" ? t(e) : t && (t.current = e);
|
|
18
|
+
}, [P, C]);
|
|
19
|
+
function Z() {
|
|
20
|
+
Y || (U(!1), V(r(s, W, G).toString()), z(!0));
|
|
21
|
+
}
|
|
22
|
+
function Q(e) {
|
|
23
|
+
Y || (e ? J || H : O) || (k?.(null), _(e), z(!1));
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ h("span", {
|
|
26
|
+
className: `ui-wheel-date-input ${T}`,
|
|
27
|
+
children: [/* @__PURE__ */ m("input", {
|
|
28
|
+
...N,
|
|
29
|
+
ref: X,
|
|
30
|
+
className: w,
|
|
31
|
+
type: "text",
|
|
32
|
+
readOnly: !0,
|
|
33
|
+
inputMode: "none",
|
|
34
|
+
disabled: E,
|
|
35
|
+
required: O,
|
|
36
|
+
value: s.replaceAll("-", "/"),
|
|
37
|
+
placeholder: N.placeholder ?? "请选择日期",
|
|
38
|
+
"aria-haspopup": "dialog",
|
|
39
|
+
"aria-expanded": R && !Y,
|
|
40
|
+
"aria-controls": R && !Y ? `${F}-panel` : void 0,
|
|
41
|
+
onClick: (e) => {
|
|
42
|
+
j?.(e), e.defaultPrevented || Z();
|
|
43
|
+
},
|
|
44
|
+
onKeyDown: (e) => {
|
|
45
|
+
A?.(e), !e.defaultPrevented && [
|
|
46
|
+
"Enter",
|
|
47
|
+
" ",
|
|
48
|
+
"ArrowDown"
|
|
49
|
+
].includes(e.key) && (e.preventDefault(), Z());
|
|
50
|
+
}
|
|
51
|
+
}), R && !Y && g(/* @__PURE__ */ h(n, {
|
|
52
|
+
titleId: `${F}-title`,
|
|
53
|
+
title: "选择日期",
|
|
54
|
+
closeLabel: "关闭日期选择",
|
|
55
|
+
returnFocus: I,
|
|
56
|
+
onClose: () => z(!1),
|
|
57
|
+
backdropClassName: "ui-date-wheel-backdrop",
|
|
58
|
+
panelClassName: "ui-date-wheel-panel",
|
|
59
|
+
contentClassName: "ui-date-wheel-content",
|
|
60
|
+
contentProps: { id: `${F}-panel` },
|
|
61
|
+
footerClassName: "ui-date-wheel-actions",
|
|
62
|
+
footer: /* @__PURE__ */ h(p, { children: [
|
|
63
|
+
/* @__PURE__ */ m(e, {
|
|
64
|
+
variant: "secondary",
|
|
65
|
+
onClick: () => z(!1),
|
|
66
|
+
children: "取消"
|
|
67
|
+
}),
|
|
68
|
+
!O && /* @__PURE__ */ m(e, {
|
|
69
|
+
variant: "secondary",
|
|
70
|
+
disabled: !s,
|
|
71
|
+
onClick: () => Q(""),
|
|
72
|
+
children: "清除"
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ m(e, {
|
|
75
|
+
variant: "primary",
|
|
76
|
+
disabled: J || H,
|
|
77
|
+
onClick: () => Q(B),
|
|
78
|
+
children: "确定日期"
|
|
79
|
+
})
|
|
80
|
+
] }),
|
|
81
|
+
children: [/* @__PURE__ */ m(o, {
|
|
82
|
+
value: B,
|
|
83
|
+
onValueChange: V,
|
|
84
|
+
minDate: W,
|
|
85
|
+
maxDate: G,
|
|
86
|
+
isDateUnavailable: S,
|
|
87
|
+
onPendingChange: U
|
|
88
|
+
}), /* @__PURE__ */ m("p", {
|
|
89
|
+
className: J ? "ui-form-error" : "ui-date-wheel-summary",
|
|
90
|
+
role: "status",
|
|
91
|
+
children: J ? "当前日期不可选择,请选择其他日期" : B.replaceAll("-", "/")
|
|
92
|
+
})]
|
|
93
|
+
}), L ?? document.body)]
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
//#endregion
|
|
97
|
+
export { _ as WheelDateInput };
|
package/dist/business-ui.js
CHANGED
|
@@ -6,42 +6,45 @@ import { Skeleton as a, SkeletonText as o } from "./Skeleton.js";
|
|
|
6
6
|
import { Popconfirm as s, Popover as c, Tooltip as l } from "./FloatingControls.js";
|
|
7
7
|
import { UserProfilePopover as u } from "./UserProfilePopover.js";
|
|
8
8
|
import { Checkbox as d, FormField as f, SelectInput as p, TextArea as m, TextInput as h } from "./FormField.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
|
|
9
|
+
import { usePhoneWheel as g } from "./usePhoneWheel.js";
|
|
10
|
+
import { Dialog as _, ModalShell as v } from "./ModalShell.js";
|
|
11
|
+
import { AsyncState as y, RecoverableAsyncState as b } from "./RecoverableAsyncState.js";
|
|
12
|
+
import { Select as x } from "./Select.js";
|
|
13
|
+
import { Combobox as S } from "./Combobox.js";
|
|
14
|
+
import { AutoComplete as C, Autocomplete as w } from "./AutoComplete.js";
|
|
15
|
+
import { ToastProvider as T, useToast as E } from "./Toast.js";
|
|
16
|
+
import { DataTableTheme as D } from "./DataTableTheme.js";
|
|
17
|
+
import { DataTableMergedRows as O } from "./DataTableMergedRows.js";
|
|
18
|
+
import { DataTable as k, DataTableView as A, sortRows as j, useDataTable as M } from "./data-table.js";
|
|
19
|
+
import { ExplainableButton as N } from "./ExplainableButton.js";
|
|
20
|
+
import { DateWheelPicker as P } from "./DateWheelPicker.js";
|
|
21
|
+
import { WheelDateInput as F } from "./WheelDateInput.js";
|
|
22
|
+
import { DateInput as I, calendarDays as L, parseDate as R } from "./DateInput.js";
|
|
23
|
+
import { Pagination as z, clampPage as B, pageCount as V, visiblePages as H } from "./Pagination.js";
|
|
24
|
+
import { RovingTabList as U, RovingTabPanel as W, nextRovingTabValue as G } from "./RovingTabs.js";
|
|
25
|
+
import { ToggleSwitch as K } from "./ToggleSwitch.js";
|
|
26
|
+
import { SegmentedControl as q } from "./SegmentedControl.js";
|
|
27
|
+
import { useModalFocusTrap as J } from "./useModalFocusTrap.js";
|
|
28
|
+
import { AsyncSearchPicker as Y } from "./AsyncSearchPicker.js";
|
|
29
|
+
import { AsyncDirectoryPicker as X } from "./AsyncDirectoryPicker.js";
|
|
30
|
+
import { DropdownMenu as Z, Menu as Q } from "./DropdownMenu.js";
|
|
31
|
+
import { ConfirmDialog as $ } from "./ConfirmDialog.js";
|
|
32
|
+
import { useDebouncedValue as ee } from "./useDebouncedValue.js";
|
|
33
|
+
import { Badge as te } from "./Badge.js";
|
|
34
|
+
import { MetricCard as ne } from "./MetricCard.js";
|
|
35
|
+
import { PageHeader as re } from "./PageHeader.js";
|
|
36
|
+
import { SectionCard as ie } from "./SectionCard.js";
|
|
37
|
+
import { useSortableTransferScope as ae } from "./sortable-transfer-scope.js";
|
|
38
|
+
import { SortableList as oe, moveSortableItems as se } from "./SortableList.js";
|
|
39
|
+
import { TreeSelect as ce, buildTreeSelectTree as le, filterTreeSelectTree as ue } from "./TreeSelect.js";
|
|
40
|
+
import { Cascader as de, buildCascaderOptions as fe, indexCascaderPaths as pe } from "./Cascader.js";
|
|
41
|
+
import { StructuredAddressInput as me, findAddressRegionPath as he, flattenAddressRegions as ge, searchAddressRegions as _e } from "./StructuredAddressInput.js";
|
|
42
|
+
import { FileDropzone as ve, acceptsFile as ye } from "./FileDropzone.js";
|
|
43
|
+
import { useFilePreparation as be } from "./useFilePreparation.js";
|
|
44
|
+
import { FilePreparationDialog as xe } from "./FilePreparationDialog.js";
|
|
45
|
+
import { PreparedFileDropzone as Se } from "./PreparedFileDropzone.js";
|
|
46
|
+
import { formatDecimalAmount as Ce, formatScaledMoney as we } from "./amount-format.js";
|
|
47
|
+
import { NumericInput as Te, ScaledNumericInput as Ee } from "./NumericInput.js";
|
|
48
|
+
import { MultiSelect as De } from "./MultiSelect.js";
|
|
49
|
+
import { MultilineAutoComplete as Oe } from "./MultilineAutoComplete.js";
|
|
50
|
+
export { r as Alert, X as AsyncDirectoryPicker, Y as AsyncSearchPicker, y as AsyncState, C as AutoComplete, w as Autocomplete, te as Badge, e as Button, de as Cascader, d as Checkbox, S as Combobox, $ as ConfirmDialog, k as DataTable, O as DataTableMergedRows, D as DataTableTheme, A as DataTableView, I as DateInput, P as DateWheelPicker, _ as Dialog, Z as DropdownMenu, i as EmptyState, N as ExplainableButton, ve as FileDropzone, xe as FilePreparationDialog, f as FormField, t as LinkButton, Q as Menu, ne as MetricCard, v as ModalShell, De as MultiSelect, Oe as MultilineAutoComplete, Te as NumericInput, re as PageHeader, z as Pagination, s as Popconfirm, c as Popover, Se as PreparedFileDropzone, b as RecoverableAsyncState, U as RovingTabList, W as RovingTabPanel, Ee as ScaledNumericInput, ie as SectionCard, q as SegmentedControl, x as Select, p as SelectInput, a as Skeleton, o as SkeletonText, oe as SortableList, me as StructuredAddressInput, m as TextArea, h as TextInput, T as ToastProvider, K as ToggleSwitch, l as Tooltip, ce as TreeSelect, u as UserProfilePopover, F as WheelDateInput, ye as acceptsFile, fe as buildCascaderOptions, le as buildTreeSelectTree, n as buttonClassName, L as calendarDays, B as clampPage, ue as filterTreeSelectTree, he as findAddressRegionPath, ge as flattenAddressRegions, Ce as formatDecimalAmount, we as formatScaledMoney, pe as indexCascaderPaths, se as moveSortableItems, G as nextRovingTabValue, V as pageCount, R as parseDate, _e as searchAddressRegions, j as sortRows, M as useDataTable, ee as useDebouncedValue, be as useFilePreparation, J as useModalFocusTrap, g as usePhoneWheel, ae as useSortableTransferScope, E as useToast, H as visiblePages };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CalendarDate as e, getLocalTimeZone as t, parseDate as n, today as r } from "@internationalized/date";
|
|
2
|
+
//#region src/date-wheel-model.ts
|
|
3
|
+
function i(e) {
|
|
4
|
+
if (!e || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return null;
|
|
5
|
+
try {
|
|
6
|
+
let t = n(e);
|
|
7
|
+
return t.toString() === e ? t : null;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function a(t, n) {
|
|
13
|
+
let r = t === void 0 ? new e(1, 1, 1) : i(t), a = n === void 0 ? new e(9999, 12, 31) : i(n);
|
|
14
|
+
return r && a && r.compare(a) <= 0 ? {
|
|
15
|
+
min: r,
|
|
16
|
+
max: a
|
|
17
|
+
} : null;
|
|
18
|
+
}
|
|
19
|
+
function o(e, t) {
|
|
20
|
+
return e.compare(t.min) < 0 ? t.min : e.compare(t.max) > 0 ? t.max : e;
|
|
21
|
+
}
|
|
22
|
+
function s(e, n, s) {
|
|
23
|
+
let c = a(n, s), l = i(e) ?? r(t());
|
|
24
|
+
return c ? o(l, c) : l;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as clampWheelDate, s as initialWheelDate, a as wheelBounds, i as wheelDate };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/option-wheel-model.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.textValue ?? (typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : e.value);
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
return e.flatMap((e) => {
|
|
7
|
+
if (e.disabled) return [];
|
|
8
|
+
if (e.children?.length) {
|
|
9
|
+
let n = t(e.children);
|
|
10
|
+
return n.length ? [{
|
|
11
|
+
...e,
|
|
12
|
+
children: n
|
|
13
|
+
}] : [];
|
|
14
|
+
}
|
|
15
|
+
return e.isLeaf === !1 ? [] : [{
|
|
16
|
+
...e,
|
|
17
|
+
children: void 0
|
|
18
|
+
}];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function n(e, t) {
|
|
22
|
+
let n = [], r = [], i = e, a = !0;
|
|
23
|
+
for (; i.length;) {
|
|
24
|
+
r.push([...i]);
|
|
25
|
+
let e = a ? i.find((e) => e.value === t[n.length]) : void 0;
|
|
26
|
+
e || (a = !1);
|
|
27
|
+
let o = e ?? i[0];
|
|
28
|
+
n.push(o), i = o.children ?? [];
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
path: n,
|
|
32
|
+
columns: r,
|
|
33
|
+
value: n.map((e) => e.value)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function r(t) {
|
|
37
|
+
function n(t) {
|
|
38
|
+
return t.map((t) => [
|
|
39
|
+
t.value,
|
|
40
|
+
e(t),
|
|
41
|
+
!!t.disabled,
|
|
42
|
+
t.isLeaf,
|
|
43
|
+
t.children ? n(t.children) : null
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify(n(t));
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { t as enabledWheelOptions, n as resolveWheelPath, r as wheelOptionsKey, e as wheelText };
|