@jc-times/business-ui 0.2.55 → 0.3.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 +6 -6
- package/CHANGELOG.md +315 -307
- package/README.md +48 -48
- package/THIRD_PARTY_NOTICES.md +18 -18
- package/bin/business-ui-gate.mjs +171 -171
- package/dist/Alert.js +5 -1
- package/dist/Button.js +1 -1
- package/dist/Cascader.js +19 -19
- package/dist/Combobox.js +38 -38
- package/dist/DataTableIcons.js +25 -25
- package/dist/DateInput.js +67 -67
- package/dist/DropdownMenu.js +35 -35
- package/dist/EmptyState.js +8 -8
- package/dist/ExplainableButton.js +11 -11
- package/dist/FloatingControls.js +31 -31
- package/dist/ModalShell.js +32 -32
- package/dist/MultiSelect.js +37 -37
- package/dist/Pagination.js +27 -27
- package/dist/RecoverableAsyncState.js +8 -8
- package/dist/Select.js +17 -17
- package/dist/SortableList.js +18 -18
- package/dist/Toast.js +30 -30
- package/dist/TreeSelect.js +107 -107
- package/dist/data-table.js +71 -71
- package/dist/document-viewer/PdfToolbar.js +12 -12
- package/dist/document-viewer/PdfWorkspace.js +15 -15
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +6 -6
- package/dist/form-controls.js +4 -0
- package/dist/types/form-controls.d.ts +8 -0
- package/dist/vendor/embedpdf-zoom-react.js +3 -186
- package/dist/vendor/embedpdf-zoom-react10.js +6 -0
- package/dist/vendor/embedpdf-zoom-react11.js +30 -0
- package/dist/vendor/embedpdf-zoom-react12.js +16 -0
- package/dist/vendor/embedpdf-zoom-react13.js +15 -0
- package/dist/vendor/embedpdf-zoom-react14.js +33 -0
- package/dist/vendor/embedpdf-zoom-react15.js +20 -0
- package/dist/vendor/embedpdf-zoom-react16.js +26 -0
- package/dist/vendor/embedpdf-zoom-react17.js +25 -0
- package/dist/vendor/embedpdf-zoom-react18.js +17 -0
- package/dist/vendor/embedpdf-zoom-react19.js +187 -0
- package/dist/vendor/embedpdf-zoom-react2.js +13 -0
- package/dist/vendor/embedpdf-zoom-react3.js +14 -0
- package/dist/vendor/embedpdf-zoom-react4.js +8 -0
- package/dist/vendor/embedpdf-zoom-react5.js +4 -0
- package/dist/vendor/embedpdf-zoom-react6.js +14 -0
- package/dist/vendor/embedpdf-zoom-react7.js +40 -0
- package/dist/vendor/embedpdf-zoom-react8.js +17 -0
- package/dist/vendor/embedpdf-zoom-react9.js +7 -0
- package/docs/agent-guide.md +170 -168
- package/docs/api.md +252 -248
- package/docs/cascader.md +58 -58
- package/docs/component-strategy.md +93 -93
- package/docs/data-table.md +127 -127
- package/docs/document-viewer-v2.md +265 -265
- package/docs/modal-shell-migration.md +43 -43
- package/docs/mrt-poc.md +1 -1
- package/docs/sortable-list.md +42 -42
- package/docs/user-profile.md +17 -17
- package/docs/viewport-qa.md +126 -126
- package/licenses/rc-cascader-MIT.txt +21 -21
- package/package.json +5 -1
package/dist/Combobox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useContext as t, useEffect as n, useId as r, useMemo as i, useRef as a } from "react";
|
|
3
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
import { Check as l, ChevronDown as u, LoaderCircle as d } from "lucide-react";
|
|
5
5
|
import { Button as f, Collection as p, ComboBox as m, ComboBoxStateContext as h, Header as g, Input as _, Label as v, ListBox as y, ListBoxItem as b, ListBoxSection as x, Popover as S, Text as C } from "react-aria-components";
|
|
6
6
|
import { ListLayout as w, Virtualizer as T } from "react-aria-components/Virtualizer";
|
|
7
7
|
//#region src/Combobox.tsx
|
|
@@ -10,8 +10,8 @@ var E = {
|
|
|
10
10
|
gap: 2,
|
|
11
11
|
padding: 4
|
|
12
12
|
};
|
|
13
|
-
function D({ items:
|
|
14
|
-
let K = `ui-combobox-${
|
|
13
|
+
function D({ items: t, label: n, placeholder: a = "搜索或选择", inputValue: h, defaultInputValue: D, selectedKey: k, defaultSelectedKey: A, onInputChange: j, onSelectionChange: M, loading: N = !1, disabled: P = !1, required: F = !1, allowsCustomValue: I = !1, emptyText: L = "没有匹配项", helpText: R, error: z, virtualized: B = t.length > 100, className: V = "", inputRef: H, inputProps: U, placement: W = "bottom start", portalContainer: G }) {
|
|
14
|
+
let K = `ui-combobox-${r().replaceAll(":", "")}`, q = e(G), J = i(() => Array.from(t), [t]), Y = i(() => {
|
|
15
15
|
let e = /* @__PURE__ */ new Map();
|
|
16
16
|
for (let t of J) {
|
|
17
17
|
let n = t.group ?? "";
|
|
@@ -22,42 +22,42 @@ function D({ items: i, label: a, placeholder: c = "搜索或选择", inputValue:
|
|
|
22
22
|
}), e.get(n).items.push(t);
|
|
23
23
|
}
|
|
24
24
|
return Array.from(e.values());
|
|
25
|
-
}, [J]), X = J.some((e) => e.group !== void 0), Z = (e) => /* @__PURE__ */
|
|
25
|
+
}, [J]), X = J.some((e) => e.group !== void 0), Z = (e) => /* @__PURE__ */ s(b, {
|
|
26
26
|
id: e.id,
|
|
27
27
|
textValue: e.label,
|
|
28
28
|
isDisabled: e.disabled,
|
|
29
29
|
className: "ui-combobox-item",
|
|
30
|
-
children: ({ isSelected:
|
|
30
|
+
children: ({ isSelected: t }) => /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c("span", { children: [/* @__PURE__ */ s("strong", { children: e.label }), e.description && /* @__PURE__ */ s("small", { children: e.description })] }), t && /* @__PURE__ */ s(l, {
|
|
31
31
|
size: 15,
|
|
32
32
|
"aria-hidden": "true"
|
|
33
33
|
})] })
|
|
34
|
-
}), Q = () => /* @__PURE__ */
|
|
34
|
+
}), Q = () => /* @__PURE__ */ s("div", {
|
|
35
35
|
className: "ui-combobox-empty",
|
|
36
36
|
children: N ? "正在加载…" : L
|
|
37
|
-
}), $ = X ? /* @__PURE__ */
|
|
37
|
+
}), $ = X ? /* @__PURE__ */ s(y, {
|
|
38
38
|
className: "ui-combobox-list",
|
|
39
39
|
items: Y,
|
|
40
40
|
layout: "stack",
|
|
41
41
|
renderEmptyState: Q,
|
|
42
|
-
children: (e) => /* @__PURE__ */
|
|
42
|
+
children: (e) => /* @__PURE__ */ c(x, {
|
|
43
43
|
id: e.id,
|
|
44
44
|
"aria-label": e.label || "选项",
|
|
45
|
-
children: [e.label && /* @__PURE__ */
|
|
45
|
+
children: [e.label && /* @__PURE__ */ s(g, {
|
|
46
46
|
className: "ui-combobox-group-heading",
|
|
47
47
|
children: e.label
|
|
48
|
-
}), /* @__PURE__ */
|
|
48
|
+
}), /* @__PURE__ */ s(p, {
|
|
49
49
|
items: e.items,
|
|
50
50
|
children: Z
|
|
51
51
|
})]
|
|
52
52
|
})
|
|
53
|
-
}) : /* @__PURE__ */
|
|
53
|
+
}) : /* @__PURE__ */ s(y, {
|
|
54
54
|
className: "ui-combobox-list",
|
|
55
55
|
items: J,
|
|
56
56
|
layout: B ? "grid" : "stack",
|
|
57
57
|
renderEmptyState: Q,
|
|
58
58
|
children: Z
|
|
59
59
|
});
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ c(m, {
|
|
61
61
|
items: J,
|
|
62
62
|
className: `ui-combobox ${V}`.trim(),
|
|
63
63
|
inputValue: h,
|
|
@@ -70,62 +70,62 @@ function D({ items: i, label: a, placeholder: c = "搜索或选择", inputValue:
|
|
|
70
70
|
isRequired: F,
|
|
71
71
|
allowsCustomValue: I,
|
|
72
72
|
menuTrigger: "focus",
|
|
73
|
-
"aria-label":
|
|
74
|
-
"aria-labelledby":
|
|
73
|
+
"aria-label": n === void 0 ? U?.["aria-label"] : void 0,
|
|
74
|
+
"aria-labelledby": n === void 0 ? U?.["aria-labelledby"] : void 0,
|
|
75
75
|
children: [
|
|
76
|
-
|
|
76
|
+
n === void 0 ? null : /* @__PURE__ */ c(v, {
|
|
77
77
|
className: "ui-form-label",
|
|
78
|
-
children: [
|
|
78
|
+
children: [n, F && /* @__PURE__ */ s("span", {
|
|
79
79
|
className: "ui-form-required",
|
|
80
80
|
"aria-hidden": "true",
|
|
81
81
|
children: "*"
|
|
82
82
|
})]
|
|
83
83
|
}),
|
|
84
|
-
I && /* @__PURE__ */
|
|
84
|
+
I && /* @__PURE__ */ s(O, {
|
|
85
85
|
count: J.length,
|
|
86
86
|
loading: N
|
|
87
87
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ c("div", {
|
|
89
89
|
className: "ui-combobox-control",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
90
|
+
children: [/* @__PURE__ */ s(_, {
|
|
91
91
|
...U,
|
|
92
92
|
ref: H,
|
|
93
93
|
id: K,
|
|
94
94
|
className: "ui-input",
|
|
95
|
-
placeholder:
|
|
95
|
+
placeholder: a,
|
|
96
96
|
"aria-invalid": z ? !0 : U?.["aria-invalid"]
|
|
97
|
-
}), /* @__PURE__ */
|
|
97
|
+
}), /* @__PURE__ */ s(f, {
|
|
98
98
|
className: "ui-combobox-trigger",
|
|
99
99
|
"aria-label": "展开选项",
|
|
100
|
-
children: N ? /* @__PURE__ */
|
|
100
|
+
children: N ? /* @__PURE__ */ s(d, {
|
|
101
101
|
className: "spin",
|
|
102
102
|
size: 16
|
|
103
|
-
}) : /* @__PURE__ */ u
|
|
103
|
+
}) : /* @__PURE__ */ s(u, { size: 16 })
|
|
104
104
|
})]
|
|
105
105
|
}),
|
|
106
|
-
R === void 0 ? null : /* @__PURE__ */
|
|
106
|
+
R === void 0 ? null : /* @__PURE__ */ s(C, {
|
|
107
107
|
slot: "description",
|
|
108
108
|
className: "ui-form-help",
|
|
109
109
|
children: R
|
|
110
110
|
}),
|
|
111
|
-
z === void 0 || z === "" ? null : /* @__PURE__ */
|
|
111
|
+
z === void 0 || z === "" ? null : /* @__PURE__ */ s(C, {
|
|
112
112
|
slot: "errorMessage",
|
|
113
113
|
className: "ui-form-error",
|
|
114
114
|
children: z
|
|
115
115
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ c(S, {
|
|
117
117
|
className: "ui-combobox-popover",
|
|
118
118
|
"data-ui-aria-overlay": "",
|
|
119
119
|
maxHeight: 320,
|
|
120
120
|
placement: W,
|
|
121
121
|
UNSTABLE_portalContainer: q,
|
|
122
|
-
children: [N && /* @__PURE__ */
|
|
122
|
+
children: [N && /* @__PURE__ */ c("div", {
|
|
123
123
|
className: "ui-combobox-loading",
|
|
124
|
-
children: [/* @__PURE__ */
|
|
124
|
+
children: [/* @__PURE__ */ s(d, {
|
|
125
125
|
className: "spin",
|
|
126
126
|
size: 15
|
|
127
127
|
}), "正在加载"]
|
|
128
|
-
}), B ? /* @__PURE__ */
|
|
128
|
+
}), B ? /* @__PURE__ */ s(T, {
|
|
129
129
|
layout: w,
|
|
130
130
|
layoutOptions: E,
|
|
131
131
|
children: $
|
|
@@ -134,15 +134,15 @@ function D({ items: i, label: a, placeholder: c = "搜索或选择", inputValue:
|
|
|
134
134
|
]
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
function O({ count: e, loading:
|
|
138
|
-
let
|
|
139
|
-
return
|
|
140
|
-
let
|
|
141
|
-
e && !
|
|
137
|
+
function O({ count: e, loading: r }) {
|
|
138
|
+
let i = t(h), o = a(i);
|
|
139
|
+
return o.current = i, n(() => {
|
|
140
|
+
let t = o.current;
|
|
141
|
+
e && !r && t?.isFocused && !t.isOpen && t.open(null, "manual");
|
|
142
142
|
}, [
|
|
143
143
|
e,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
r,
|
|
145
|
+
i?.collection.size
|
|
146
146
|
]), null;
|
|
147
147
|
}
|
|
148
148
|
//#endregion
|
package/dist/DataTableIcons.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowDown as n, ArrowLeftRight as r, ChevronDown as i, ChevronRight as a, Columns3 as o, EllipsisVertical as s, EyeOff as c, Filter as l, FilterX as u, GripHorizontal as d, Pin as f, RotateCcw as p, Search as m, X as h } from "lucide-react";
|
|
4
4
|
import g from "@mui/material/SvgIcon";
|
|
5
5
|
//#region src/DataTableIcons.tsx
|
|
6
|
-
function _(
|
|
7
|
-
return
|
|
8
|
-
...
|
|
9
|
-
ref:
|
|
10
|
-
component:
|
|
6
|
+
function _(n) {
|
|
7
|
+
return e((e, r) => /* @__PURE__ */ t(g, {
|
|
8
|
+
...e,
|
|
9
|
+
ref: r,
|
|
10
|
+
component: n,
|
|
11
11
|
inheritViewBox: !0,
|
|
12
12
|
sx: [{
|
|
13
13
|
fontSize: 18,
|
|
14
14
|
fill: "none"
|
|
15
|
-
}, ...Array.isArray(
|
|
15
|
+
}, ...Array.isArray(e.sx) ? e.sx : [e.sx ?? {}]]
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
18
|
var v = {
|
|
19
|
-
SearchIcon: _(
|
|
20
|
-
CloseIcon: _(
|
|
21
|
-
CancelIcon: _(
|
|
22
|
-
ArrowDownwardIcon: _(
|
|
23
|
-
ExpandMoreIcon: _(
|
|
24
|
-
ArrowRightIcon: _(
|
|
25
|
-
SyncAltIcon: _(
|
|
26
|
-
MoreVertIcon: _(
|
|
27
|
-
ViewColumnIcon: _(
|
|
28
|
-
FilterListIcon: _(
|
|
29
|
-
FilterAltIcon: _(
|
|
30
|
-
FilterListOffIcon: _(
|
|
31
|
-
PushPinIcon: _(
|
|
32
|
-
DragHandleIcon: _(
|
|
33
|
-
RestartAltIcon: _(
|
|
34
|
-
VisibilityOffIcon: _(
|
|
19
|
+
SearchIcon: _(m),
|
|
20
|
+
CloseIcon: _(h),
|
|
21
|
+
CancelIcon: _(h),
|
|
22
|
+
ArrowDownwardIcon: _(n),
|
|
23
|
+
ExpandMoreIcon: _(i),
|
|
24
|
+
ArrowRightIcon: _(a),
|
|
25
|
+
SyncAltIcon: _(r),
|
|
26
|
+
MoreVertIcon: _(s),
|
|
27
|
+
ViewColumnIcon: _(o),
|
|
28
|
+
FilterListIcon: _(l),
|
|
29
|
+
FilterAltIcon: _(l),
|
|
30
|
+
FilterListOffIcon: _(u),
|
|
31
|
+
PushPinIcon: _(f),
|
|
32
|
+
DragHandleIcon: _(d),
|
|
33
|
+
RestartAltIcon: _(p),
|
|
34
|
+
VisibilityOffIcon: _(c)
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
37
|
export { v as icons };
|
package/dist/DateInput.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import * as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { CalendarDate as
|
|
2
|
+
import { forwardRef as t, useCallback as n, useEffect as r, useId as ee, useRef as i, useState as a } from "react";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import { CalendarDays as te, ChevronLeft as ne, ChevronRight as re, X as c } from "lucide-react";
|
|
5
|
+
import * as l from "@radix-ui/react-popover";
|
|
6
|
+
import { Button as u, Calendar as ie, CalendarCell as ae, CalendarGrid as oe, CalendarGridBody as se, CalendarGridHeader as ce, CalendarHeaderCell as le, Heading as ue, I18nProvider as de } from "react-aria-components";
|
|
7
|
+
import { CalendarDate as fe, getLocalTimeZone as d, parseDate as f, today as p } from "@internationalized/date";
|
|
8
8
|
//#region src/DateInput.tsx
|
|
9
|
-
var
|
|
10
|
-
let j = `ui-date-calendar-${
|
|
11
|
-
M.current = e,
|
|
12
|
-
}, [
|
|
13
|
-
|
|
14
|
-
z(
|
|
15
|
-
}, [
|
|
9
|
+
var m = "jc-business-ui-date-input-open", h = t(function({ value: t, onValueChange: f, inputRef: h, inputClassName: y, className: x = "", disabled: S, readOnly: C, required: w, inputMode: pe = "numeric", autoComplete: me = "off", onFocus: T, onBlur: he, onKeyDown: ge, min: E, max: D, minDate: _e, maxDate: ve, isDateUnavailable: O, onValidationError: ye, ...k }, A) {
|
|
10
|
+
let j = `ui-date-calendar-${ee().replaceAll(":", "")}`, be = e(), M = i(null), N = i(!1), P = i(!1), F = i(!1), [I, L] = a(!1), [R, z] = a(() => g(t)), [B, V] = a(""), H = _(t), U = _(_e ?? (E === void 0 ? "" : String(E))), W = _(ve ?? (D === void 0 ? "" : String(D))), [G, K] = a(() => H ?? p(d())), q = !!(S || C), xe = n((e) => {
|
|
11
|
+
M.current = e, b(h, e), b(A, e);
|
|
12
|
+
}, [h, A]);
|
|
13
|
+
r(() => {
|
|
14
|
+
z(g(t)), V(""), M.current?.setCustomValidity("");
|
|
15
|
+
}, [t]), r(() => {
|
|
16
16
|
q && L(!1);
|
|
17
|
-
}, [q]),
|
|
17
|
+
}, [q]), r(() => {
|
|
18
18
|
let e = (e) => {
|
|
19
19
|
e.detail !== j && L(!1);
|
|
20
20
|
};
|
|
21
|
-
return document.addEventListener(
|
|
21
|
+
return document.addEventListener(m, e), () => document.removeEventListener(m, e);
|
|
22
22
|
}, [j]);
|
|
23
23
|
function J(e) {
|
|
24
24
|
if (!(e && q)) {
|
|
25
25
|
if (e && !I) {
|
|
26
|
-
document.dispatchEvent(new CustomEvent(
|
|
27
|
-
let e = H ??
|
|
26
|
+
document.dispatchEvent(new CustomEvent(m, { detail: j }));
|
|
27
|
+
let e = H ?? p(d());
|
|
28
28
|
U && e.compare(U) < 0 && (e = U), W && e.compare(W) > 0 && (e = W), K(e);
|
|
29
29
|
}
|
|
30
30
|
L(e);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function Y(e) {
|
|
34
|
-
if (!e) return
|
|
35
|
-
let t =
|
|
34
|
+
if (!e) return w ? "请选择日期" : "";
|
|
35
|
+
let t = _(e);
|
|
36
36
|
return t ? U && t.compare(U) < 0 ? `日期不能早于 ${U}` : W && t.compare(W) > 0 ? `日期不能晚于 ${W}` : O?.(t.toString()) ? "该日期不可选择" : "" : "请输入有效日期(YYYY/MM/DD)";
|
|
37
37
|
}
|
|
38
38
|
function X(e) {
|
|
@@ -40,33 +40,33 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
40
40
|
}
|
|
41
41
|
function Z() {
|
|
42
42
|
if (q) return;
|
|
43
|
-
let e = R.trim() ?
|
|
44
|
-
X(
|
|
43
|
+
let e = R.trim() ? v(R) : "", n = e === null ? "请输入有效日期(YYYY/MM/DD)" : Y(e);
|
|
44
|
+
X(n), !n && e !== null && (z(g(e)), e !== t && f(e));
|
|
45
45
|
}
|
|
46
46
|
function Q(e) {
|
|
47
47
|
if (q) return;
|
|
48
48
|
let t = Y(e);
|
|
49
|
-
X(t), !t && (F.current = !0,
|
|
49
|
+
X(t), !t && (F.current = !0, f(e), z(g(e)), L(!1));
|
|
50
50
|
}
|
|
51
|
-
let $ =
|
|
52
|
-
return /* @__PURE__ */ l
|
|
51
|
+
let $ = p(d()).toString();
|
|
52
|
+
return /* @__PURE__ */ s(l.Root, {
|
|
53
53
|
open: I && !q,
|
|
54
54
|
onOpenChange: J,
|
|
55
55
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ o(l.Anchor, {
|
|
57
57
|
asChild: !0,
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
className: `ui-date-input${I ? " open" : ""}${
|
|
60
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ s("span", {
|
|
59
|
+
className: `ui-date-input${I ? " open" : ""}${x ? ` ${x}` : ""}`,
|
|
60
|
+
children: [/* @__PURE__ */ o("input", {
|
|
61
61
|
...k,
|
|
62
62
|
ref: xe,
|
|
63
|
-
className:
|
|
63
|
+
className: y,
|
|
64
64
|
type: "text",
|
|
65
|
-
inputMode:
|
|
66
|
-
autoComplete:
|
|
67
|
-
disabled:
|
|
68
|
-
readOnly:
|
|
69
|
-
required:
|
|
65
|
+
inputMode: pe,
|
|
66
|
+
autoComplete: me,
|
|
67
|
+
disabled: S,
|
|
68
|
+
readOnly: C,
|
|
69
|
+
required: w,
|
|
70
70
|
value: R,
|
|
71
71
|
placeholder: k.placeholder ?? "YYYY/MM/DD",
|
|
72
72
|
"aria-haspopup": "dialog",
|
|
@@ -75,7 +75,7 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
75
75
|
"aria-invalid": B ? !0 : k["aria-invalid"],
|
|
76
76
|
"aria-describedby": [k["aria-describedby"], B ? `${j}-error` : ""].filter(Boolean).join(" ") || void 0,
|
|
77
77
|
onFocus: (e) => {
|
|
78
|
-
|
|
78
|
+
T?.(e), !e.defaultPrevented && !N.current && J(!0);
|
|
79
79
|
},
|
|
80
80
|
onChange: (e) => {
|
|
81
81
|
z(e.target.value), B && X("");
|
|
@@ -86,7 +86,7 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
86
86
|
onKeyDown: (e) => {
|
|
87
87
|
ge?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.keyCode === 229 || q) && (e.key === "ArrowDown" && (e.preventDefault(), P.current = !0, J(!0), I && document.getElementById(j)?.querySelector("[role=\"gridcell\"] [tabindex=\"0\"]")?.focus()), e.key === "Enter" && (e.preventDefault(), Z()));
|
|
88
88
|
}
|
|
89
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ o("button", {
|
|
90
90
|
type: "button",
|
|
91
91
|
className: "ui-date-trigger",
|
|
92
92
|
disabled: q,
|
|
@@ -96,22 +96,22 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
96
96
|
onClick: () => {
|
|
97
97
|
P.current = !0, J(!I);
|
|
98
98
|
},
|
|
99
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ o(te, {
|
|
100
100
|
size: 17,
|
|
101
101
|
"aria-hidden": "true"
|
|
102
102
|
})
|
|
103
103
|
})]
|
|
104
104
|
})
|
|
105
105
|
}),
|
|
106
|
-
B && /* @__PURE__ */
|
|
106
|
+
B && /* @__PURE__ */ o("span", {
|
|
107
107
|
id: `${j}-error`,
|
|
108
108
|
className: "ui-form-error",
|
|
109
109
|
role: "alert",
|
|
110
110
|
children: B
|
|
111
111
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ o(l.Portal, {
|
|
113
113
|
container: be,
|
|
114
|
-
children: /* @__PURE__ */ l
|
|
114
|
+
children: /* @__PURE__ */ s(l.Content, {
|
|
115
115
|
id: j,
|
|
116
116
|
className: "ui-date-calendar",
|
|
117
117
|
"aria-label": "选择日期",
|
|
@@ -129,9 +129,9 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
129
129
|
onInteractOutside: (e) => {
|
|
130
130
|
M.current?.parentElement?.contains(e.target) && e.preventDefault();
|
|
131
131
|
},
|
|
132
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ o(de, {
|
|
133
133
|
locale: "zh-CN",
|
|
134
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ s(ie, {
|
|
135
135
|
"aria-label": "选择日期",
|
|
136
136
|
value: H,
|
|
137
137
|
onChange: (e) => Q(e.toString()),
|
|
@@ -139,51 +139,51 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
139
139
|
maxValue: W ?? void 0,
|
|
140
140
|
isDateUnavailable: (e) => O?.(e.toString()) ?? !1,
|
|
141
141
|
focusedValue: G,
|
|
142
|
-
onFocusChange: (e) => K(new
|
|
142
|
+
onFocusChange: (e) => K(new fe(e.year, e.month, e.day)),
|
|
143
143
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ s("header", { children: [
|
|
145
|
+
/* @__PURE__ */ o(u, {
|
|
146
146
|
slot: "previous",
|
|
147
147
|
"aria-label": "上个月",
|
|
148
|
-
children: /* @__PURE__ */
|
|
148
|
+
children: /* @__PURE__ */ o(ne, { size: 18 })
|
|
149
149
|
}),
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ o(ue, {}),
|
|
151
|
+
/* @__PURE__ */ o(u, {
|
|
152
152
|
slot: "next",
|
|
153
153
|
"aria-label": "下个月",
|
|
154
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ o(re, { size: 18 })
|
|
155
155
|
})
|
|
156
156
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ s("label", {
|
|
158
158
|
className: "ui-date-month-jump",
|
|
159
|
-
children: ["跳转年月", /* @__PURE__ */
|
|
159
|
+
children: ["跳转年月", /* @__PURE__ */ o("input", {
|
|
160
160
|
type: "month",
|
|
161
161
|
"aria-label": "跳转年月",
|
|
162
162
|
value: `${G.year.toString().padStart(4, "0")}-${String(G.month).padStart(2, "0")}`,
|
|
163
163
|
min: U?.toString().slice(0, 7),
|
|
164
164
|
max: W?.toString().slice(0, 7),
|
|
165
165
|
onChange: (e) => {
|
|
166
|
-
let t =
|
|
166
|
+
let t = _(`${e.target.value}-01`);
|
|
167
167
|
t && K(U && t.compare(U) < 0 ? U : W && t.compare(W) > 0 ? W : t);
|
|
168
168
|
}
|
|
169
169
|
})]
|
|
170
170
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ s(oe, {
|
|
172
172
|
className: "ui-aria-calendar-grid",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ o(ce, { children: (e) => /* @__PURE__ */ o(le, { children: e }) }), /* @__PURE__ */ o(se, { children: (e) => /* @__PURE__ */ o(ae, {
|
|
174
174
|
date: e,
|
|
175
175
|
"data-date": e.toString()
|
|
176
176
|
}) })]
|
|
177
177
|
})
|
|
178
178
|
]
|
|
179
179
|
})
|
|
180
|
-
}), /* @__PURE__ */
|
|
180
|
+
}), /* @__PURE__ */ s("footer", { children: [/* @__PURE__ */ s("button", {
|
|
181
181
|
type: "button",
|
|
182
182
|
className: "ui-date-clear",
|
|
183
|
-
disabled: !
|
|
183
|
+
disabled: !t || w,
|
|
184
184
|
onClick: () => Q(""),
|
|
185
|
-
children: [/* @__PURE__ */ c
|
|
186
|
-
}), /* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ o(c, { size: 14 }), "清除"]
|
|
186
|
+
}), /* @__PURE__ */ o("button", {
|
|
187
187
|
type: "button",
|
|
188
188
|
className: "ui-date-today",
|
|
189
189
|
disabled: !!Y($),
|
|
@@ -195,29 +195,29 @@ var h = "jc-business-ui-date-input-open", g = i(function({ value: i, onValueChan
|
|
|
195
195
|
]
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
|
-
function
|
|
198
|
+
function g(e) {
|
|
199
199
|
return /^\d{4}-\d{2}-\d{2}$/.test(e) ? e.replaceAll("-", "/") : e;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
203
|
-
return t ?
|
|
201
|
+
function _(e) {
|
|
202
|
+
let t = v(e);
|
|
203
|
+
return t ? f(t) : null;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function v(e) {
|
|
206
206
|
let t = e.trim().match(/^(\d{4})[/.\-](\d{1,2})[/.\-](\d{1,2})$/);
|
|
207
207
|
if (!t || Number(t[1]) < 1) return null;
|
|
208
208
|
let n = `${t[1]}-${t[2].padStart(2, "0")}-${t[3].padStart(2, "0")}`;
|
|
209
209
|
try {
|
|
210
|
-
return
|
|
210
|
+
return f(n).toString();
|
|
211
211
|
} catch {
|
|
212
212
|
return null;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function y(e, t) {
|
|
216
216
|
let n = new Date(e, t, 1), r = new Date(e, t, 1 - n.getDay());
|
|
217
217
|
return Array.from({ length: 42 }, (e, t) => ({ date: new Date(r.getFullYear(), r.getMonth(), r.getDate() + t) }));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function b(e, t) {
|
|
220
220
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
221
221
|
}
|
|
222
222
|
//#endregion
|
|
223
|
-
export {
|
|
223
|
+
export { h as DateInput, y as calendarDays, v as parseDate };
|