@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
|
@@ -1,155 +1,209 @@
|
|
|
1
1
|
import { Button as e } from "./Button.js";
|
|
2
2
|
import { TextInput as t } from "./FormField.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { usePhoneWheel as n } from "./usePhoneWheel.js";
|
|
4
|
+
import { RecoverableAsyncState as r } from "./RecoverableAsyncState.js";
|
|
5
|
+
import { MobilePickerPanel as i } from "./MobilePickerPanel.js";
|
|
6
|
+
import { memo as a, useCallback as o, useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
7
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
8
|
//#region src/AsyncSearchPicker.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, [
|
|
9
|
+
function m({ query: a, onQueryChange: m, onSearch: g, items: _, getKey: v, getText: te, renderItem: y, onSelect: b, status: x = "idle", error: S, label: C, searchLabel: w = "查询", loadingTitle: ne = "正在查询", emptyText: re = "没有匹配项", minimumCharacters: T = 0, minimumCharactersText: ie = (e) => `请至少输入 ${e} 个字符`, busy: E = !1, disabled: D = !1, className: O = "", inputRef: k, inputProps: A, mobileMode: ae = "inline" }) {
|
|
10
|
+
let j = n(ae === "bottom-sheet"), [M, N] = u(!1), P = l(null), F = l(null);
|
|
11
|
+
s(() => {
|
|
12
|
+
(D || !j) && N(!1);
|
|
13
|
+
}, [D, j]);
|
|
14
|
+
let I = `ui-async-picker-${c().replaceAll(":", "")}`, [L, R] = u(-1), [z, B] = u(!1), V = l(/* @__PURE__ */ new Map()), H = l(null), [U, W] = u(320), G = D || E || x === "loading", K = a.trim().length < T, q = !z && x === "success" && !K, J = L >= 0 && L < _.length ? _[L] : void 0;
|
|
15
|
+
s(() => {
|
|
16
|
+
R(-1);
|
|
17
|
+
}, [a, _]), s(() => {
|
|
18
|
+
if (j) return;
|
|
12
19
|
let e = (e) => {
|
|
13
|
-
|
|
20
|
+
H.current?.contains(e.target) || (B(!0), R(-1));
|
|
14
21
|
};
|
|
15
22
|
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
16
|
-
}, []),
|
|
17
|
-
if (!
|
|
23
|
+
}, [j]), s(() => {
|
|
24
|
+
if (j || !q || _.length === 0) return;
|
|
18
25
|
let e = window.visualViewport, t = 0, n = () => {
|
|
19
26
|
t && window.cancelAnimationFrame(t), t = window.requestAnimationFrame(() => {
|
|
20
27
|
t = 0;
|
|
21
|
-
let n =
|
|
28
|
+
let n = H.current?.querySelector(".ui-async-search-control");
|
|
22
29
|
if (!n) return;
|
|
23
30
|
let r = (e?.offsetTop ?? 0) + (e?.height ?? window.innerHeight), i = Math.floor(r - n.getBoundingClientRect().bottom - 12);
|
|
24
|
-
|
|
31
|
+
W(Math.max(96, Math.min(320, i)));
|
|
25
32
|
});
|
|
26
33
|
};
|
|
27
34
|
return n(), e?.addEventListener("resize", n), e?.addEventListener("scroll", n), window.addEventListener("resize", n), () => {
|
|
28
35
|
t && window.cancelAnimationFrame(t), e?.removeEventListener("resize", n), e?.removeEventListener("scroll", n), window.removeEventListener("resize", n);
|
|
29
36
|
};
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
}, [
|
|
38
|
+
_.length,
|
|
39
|
+
q,
|
|
40
|
+
j
|
|
41
|
+
]);
|
|
42
|
+
function Y() {
|
|
43
|
+
!G && !K && (B(!1), g(a));
|
|
33
44
|
}
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
function
|
|
38
|
-
if (!
|
|
39
|
-
let t = (e +
|
|
40
|
-
|
|
41
|
-
let n =
|
|
45
|
+
let X = o((e) => {
|
|
46
|
+
G || (b(e), B(!0), R(-1), N(!1));
|
|
47
|
+
}, [G, b]);
|
|
48
|
+
function Z(e) {
|
|
49
|
+
if (!_.length) return;
|
|
50
|
+
let t = (e + _.length) % _.length;
|
|
51
|
+
R(t);
|
|
52
|
+
let n = V.current.get(v(_[t]));
|
|
42
53
|
typeof n?.scrollIntoView == "function" && n.scrollIntoView({ block: "nearest" });
|
|
43
54
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
55
|
+
function oe(e) {
|
|
56
|
+
A?.onKeyDown?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing) && (e.key === "ArrowDown" && q && _.length ? (e.preventDefault(), Z(L + 1)) : e.key === "ArrowUp" && q && _.length ? (e.preventDefault(), Z(L <= 0 ? _.length - 1 : L - 1)) : e.key === "Enter" ? (e.preventDefault(), J && q ? X(J) : Y()) : (e.key === "Escape" || e.key === "Tab" && !j) && (B(!0), R(-1)));
|
|
46
57
|
}
|
|
47
|
-
|
|
48
|
-
ref:
|
|
49
|
-
className: `ui-async-search-picker ${
|
|
58
|
+
let Q = /* @__PURE__ */ p("div", {
|
|
59
|
+
ref: H,
|
|
60
|
+
className: `ui-async-search-picker ${O}`.trim(),
|
|
50
61
|
onBlur: (e) => {
|
|
51
|
-
e.currentTarget.contains(e.relatedTarget)
|
|
62
|
+
!j && !e.currentTarget.contains(e.relatedTarget) && (B(!0), R(-1));
|
|
52
63
|
},
|
|
53
64
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ p("div", {
|
|
55
66
|
className: "ui-async-search-control",
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
...
|
|
58
|
-
ref: j,
|
|
59
|
-
label:
|
|
60
|
-
value:
|
|
61
|
-
disabled:
|
|
67
|
+
children: [/* @__PURE__ */ f(t, {
|
|
68
|
+
...A,
|
|
69
|
+
ref: j ? F : k,
|
|
70
|
+
label: C,
|
|
71
|
+
value: a,
|
|
72
|
+
disabled: D || E,
|
|
73
|
+
id: j ? `${I}-search` : A?.id,
|
|
74
|
+
name: j ? void 0 : A?.name,
|
|
75
|
+
form: j ? void 0 : A?.form,
|
|
76
|
+
required: !j && A?.required,
|
|
62
77
|
onFocus: (e) => {
|
|
63
|
-
|
|
78
|
+
B(!1), A?.onFocus?.(e);
|
|
64
79
|
},
|
|
65
80
|
onChange: (e) => {
|
|
66
|
-
|
|
81
|
+
B(!1), m(e.target.value);
|
|
67
82
|
},
|
|
68
|
-
onKeyDown:
|
|
83
|
+
onKeyDown: oe,
|
|
69
84
|
role: "combobox",
|
|
70
85
|
"aria-autocomplete": "list",
|
|
71
|
-
"aria-expanded":
|
|
72
|
-
"aria-controls":
|
|
73
|
-
"aria-activedescendant":
|
|
74
|
-
}), /* @__PURE__ */
|
|
86
|
+
"aria-expanded": q && _.length > 0,
|
|
87
|
+
"aria-controls": q && _.length > 0 ? `${I}-list` : void 0,
|
|
88
|
+
"aria-activedescendant": q && J ? `${I}-${h(v(J))}` : void 0
|
|
89
|
+
}), /* @__PURE__ */ f(e, {
|
|
75
90
|
variant: "primary",
|
|
76
|
-
busy:
|
|
77
|
-
disabled:
|
|
78
|
-
onClick:
|
|
79
|
-
children:
|
|
91
|
+
busy: E || x === "loading",
|
|
92
|
+
disabled: D || K,
|
|
93
|
+
onClick: Y,
|
|
94
|
+
children: w
|
|
80
95
|
})]
|
|
81
96
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ p("div", {
|
|
83
98
|
className: "ui-async-search-status",
|
|
84
99
|
"aria-live": "polite",
|
|
85
100
|
children: [
|
|
86
|
-
|
|
87
|
-
!
|
|
101
|
+
K ? ie(T) : null,
|
|
102
|
+
!z && !K && x === "loading" ? /* @__PURE__ */ f(r, {
|
|
88
103
|
compact: !0,
|
|
89
104
|
phase: "loading",
|
|
90
|
-
loadingTitle:
|
|
105
|
+
loadingTitle: ne,
|
|
91
106
|
errorTitle: ""
|
|
92
107
|
}) : null,
|
|
93
|
-
!
|
|
108
|
+
!z && !K && x === "error" ? /* @__PURE__ */ f(r, {
|
|
94
109
|
compact: !0,
|
|
95
110
|
phase: "error",
|
|
96
111
|
loadingTitle: "",
|
|
97
112
|
errorTitle: "查询失败",
|
|
98
|
-
detail:
|
|
99
|
-
onRetry:
|
|
113
|
+
detail: S,
|
|
114
|
+
onRetry: G ? void 0 : Y,
|
|
100
115
|
retryLabel: "重试"
|
|
101
116
|
}) : null,
|
|
102
|
-
|
|
117
|
+
q && _.length === 0 ? /* @__PURE__ */ f("div", {
|
|
103
118
|
className: "ui-async-search-empty",
|
|
104
|
-
children:
|
|
119
|
+
children: re
|
|
105
120
|
}) : null
|
|
106
121
|
]
|
|
107
122
|
}),
|
|
108
|
-
|
|
109
|
-
id: `${
|
|
123
|
+
q && _.length > 0 ? /* @__PURE__ */ f("div", {
|
|
124
|
+
id: `${I}-list`,
|
|
110
125
|
role: "listbox",
|
|
111
126
|
className: "ui-async-search-list",
|
|
112
|
-
style: { maxHeight:
|
|
113
|
-
children:
|
|
114
|
-
let n =
|
|
115
|
-
return /* @__PURE__ */
|
|
127
|
+
style: { maxHeight: U },
|
|
128
|
+
children: _.map((e, t) => {
|
|
129
|
+
let n = v(e);
|
|
130
|
+
return /* @__PURE__ */ f(ee, {
|
|
116
131
|
item: e,
|
|
117
132
|
index: t,
|
|
118
133
|
optionKey: n,
|
|
119
|
-
id: `${
|
|
120
|
-
selected:
|
|
121
|
-
refs:
|
|
122
|
-
activate:
|
|
123
|
-
select:
|
|
124
|
-
getText:
|
|
125
|
-
renderItem:
|
|
134
|
+
id: `${I}-${h(n)}`,
|
|
135
|
+
selected: L === t,
|
|
136
|
+
refs: V.current,
|
|
137
|
+
activate: R,
|
|
138
|
+
select: X,
|
|
139
|
+
getText: te,
|
|
140
|
+
renderItem: y
|
|
126
141
|
}, n);
|
|
127
142
|
})
|
|
128
143
|
}) : null
|
|
129
144
|
]
|
|
130
145
|
});
|
|
146
|
+
if (!j) return Q;
|
|
147
|
+
function se() {
|
|
148
|
+
N(!1), B(!0), R(-1);
|
|
149
|
+
}
|
|
150
|
+
function $() {
|
|
151
|
+
!D && !E && (B(!1), N(!0));
|
|
152
|
+
}
|
|
153
|
+
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(t, {
|
|
154
|
+
...A,
|
|
155
|
+
ref: (e) => {
|
|
156
|
+
P.current = e, typeof k == "function" ? k(e) : k && (k.current = e);
|
|
157
|
+
},
|
|
158
|
+
label: C,
|
|
159
|
+
value: a,
|
|
160
|
+
inputMode: "none",
|
|
161
|
+
disabled: D,
|
|
162
|
+
"aria-disabled": E || D || void 0,
|
|
163
|
+
readOnly: E || A?.readOnly,
|
|
164
|
+
className: `ui-mobile-picker-trigger ${O}`,
|
|
165
|
+
"aria-haspopup": "dialog",
|
|
166
|
+
"aria-expanded": M,
|
|
167
|
+
onFocus: void 0,
|
|
168
|
+
onBlur: void 0,
|
|
169
|
+
onChange: (e) => {
|
|
170
|
+
E || (m(e.target.value), $());
|
|
171
|
+
},
|
|
172
|
+
onClick: (e) => {
|
|
173
|
+
A?.onClick?.(e), e.defaultPrevented || $();
|
|
174
|
+
},
|
|
175
|
+
onKeyDown: (e) => {
|
|
176
|
+
A?.onKeyDown?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.keyCode === 229) && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), $());
|
|
177
|
+
}
|
|
178
|
+
}), M && /* @__PURE__ */ f(i, {
|
|
179
|
+
title: C ?? "搜索选择",
|
|
180
|
+
returnFocus: P,
|
|
181
|
+
initialFocus: F,
|
|
182
|
+
onClose: se,
|
|
183
|
+
children: Q
|
|
184
|
+
})] });
|
|
131
185
|
}
|
|
132
|
-
function
|
|
186
|
+
function h(e) {
|
|
133
187
|
return e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
134
188
|
}
|
|
135
|
-
function
|
|
136
|
-
let
|
|
137
|
-
e ?
|
|
138
|
-
}, [
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
ref:
|
|
189
|
+
function g({ item: e, index: t, optionKey: n, id: r, selected: i, refs: a, activate: s, select: c, getText: l, renderItem: u }) {
|
|
190
|
+
let d = o((e) => {
|
|
191
|
+
e ? a.set(n, e) : a.delete(n);
|
|
192
|
+
}, [a, n]);
|
|
193
|
+
return /* @__PURE__ */ f("button", {
|
|
194
|
+
ref: d,
|
|
141
195
|
id: r,
|
|
142
196
|
type: "button",
|
|
143
197
|
role: "option",
|
|
144
|
-
"aria-selected":
|
|
198
|
+
"aria-selected": i,
|
|
145
199
|
className: "ui-async-search-option",
|
|
146
200
|
tabIndex: -1,
|
|
147
201
|
onMouseEnter: () => s(t),
|
|
148
202
|
onClick: () => c(e),
|
|
149
|
-
"aria-label":
|
|
150
|
-
children:
|
|
203
|
+
"aria-label": l(e),
|
|
204
|
+
children: u(e)
|
|
151
205
|
});
|
|
152
206
|
}
|
|
153
|
-
var
|
|
207
|
+
var ee = a(g);
|
|
154
208
|
//#endregion
|
|
155
|
-
export {
|
|
209
|
+
export { m as AsyncSearchPicker };
|
package/dist/Cascader.js
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
import { useOverlayContainer as e } from "./OverlayContainer.js";
|
|
2
2
|
import { FormField as t } from "./FormField.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
3
|
+
import { usePhoneWheel as n } from "./usePhoneWheel.js";
|
|
4
|
+
import { WheelCascader as r } from "./WheelCascader.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useId as o, useRef as s, useState as c } from "react";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDown as d, ChevronRight as f, LoaderCircle as p, X as m } from "lucide-react";
|
|
8
|
+
import h from "@rc-component/cascader";
|
|
7
9
|
//#region src/Cascader.tsx
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
function g(e) {
|
|
11
|
+
return n(e.mobileMode === "wheel") && !e.multiple && !e.loadData && !e.changeOnSelect ? /* @__PURE__ */ l(r, { ...e }) : /* @__PURE__ */ l(_, { ...e });
|
|
12
|
+
}
|
|
13
|
+
function _(n) {
|
|
14
|
+
let r = o(), [g, _] = c(!1);
|
|
15
|
+
a(() => {
|
|
16
|
+
n.disabled && _(!1);
|
|
17
|
+
}, [n.disabled]);
|
|
18
|
+
let y = !n.disabled && (n.open ?? g), b = n.id ?? n.inputProps?.id ?? r, x = e(), { inputProps: S, inputRef: C, label: w, helpText: T, error: E } = n, D = s(null), O = i((e) => {
|
|
14
19
|
D.current = e, typeof C == "function" ? C(e) : C && (C.current = e);
|
|
15
20
|
}, [C]);
|
|
16
|
-
|
|
17
|
-
D.current?.setCustomValidity(
|
|
18
|
-
}, [
|
|
21
|
+
a(() => {
|
|
22
|
+
D.current?.setCustomValidity(n.required && !n.value.length ? "请选择一个选项" : "");
|
|
23
|
+
}, [n.required, n.value.length]);
|
|
19
24
|
let k = [
|
|
20
25
|
S?.["aria-describedby"],
|
|
21
26
|
T !== void 0 && `${b}-help`,
|
|
22
27
|
E && `${b}-error`
|
|
23
28
|
].filter(Boolean).join(" ") || void 0, A = {
|
|
24
29
|
id: b,
|
|
25
|
-
options:
|
|
30
|
+
options: n.options,
|
|
26
31
|
prefixCls: "ui-cascader",
|
|
27
|
-
className:
|
|
28
|
-
disabled:
|
|
32
|
+
className: n.className,
|
|
33
|
+
disabled: n.disabled,
|
|
29
34
|
open: y,
|
|
30
35
|
onPopupVisibleChange: (e) => {
|
|
31
|
-
|
|
36
|
+
_(e), n.onOpenChange?.(e);
|
|
32
37
|
},
|
|
33
38
|
onInputKeyDown: (e) => {
|
|
34
|
-
e.key === "Escape" && y && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(),
|
|
39
|
+
e.key === "Escape" && y && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), _(!1), n.onOpenChange?.(!1));
|
|
35
40
|
},
|
|
36
41
|
showAction: [],
|
|
37
|
-
placeholder:
|
|
38
|
-
notFoundContent:
|
|
39
|
-
allowClear:
|
|
40
|
-
clearIcon: /* @__PURE__ */
|
|
41
|
-
label:
|
|
42
|
+
placeholder: n.placeholder ?? "请选择或搜索",
|
|
43
|
+
notFoundContent: n.emptyText ?? "没有匹配的选项",
|
|
44
|
+
allowClear: n.allowClear !== !1 && {
|
|
45
|
+
clearIcon: /* @__PURE__ */ l(m, { size: 14 }),
|
|
46
|
+
label: n.clearLabel ?? "清除选择"
|
|
42
47
|
},
|
|
43
|
-
suffix: /* @__PURE__ */
|
|
44
|
-
expandIcon: /* @__PURE__ */
|
|
45
|
-
loadingIcon: /* @__PURE__ */
|
|
46
|
-
changeOnSelect:
|
|
47
|
-
loadData:
|
|
48
|
-
showSearch:
|
|
49
|
-
filter: (e, t) =>
|
|
48
|
+
suffix: /* @__PURE__ */ l(d, { size: 16 }),
|
|
49
|
+
expandIcon: /* @__PURE__ */ l(f, { size: 14 }),
|
|
50
|
+
loadingIcon: /* @__PURE__ */ l(p, { size: 14 }),
|
|
51
|
+
changeOnSelect: n.changeOnSelect,
|
|
52
|
+
loadData: n.loadData,
|
|
53
|
+
showSearch: n.searchable ?? !n.loadData ? {
|
|
54
|
+
filter: (e, t) => v(t.map((e) => e.label).join("/")).includes(v(e)),
|
|
50
55
|
render: (e, t) => t.map((e) => e.label).join(" / "),
|
|
51
56
|
limit: 50
|
|
52
57
|
} : !1,
|
|
@@ -61,19 +66,19 @@ function m(m) {
|
|
|
61
66
|
shiftX: !0
|
|
62
67
|
}
|
|
63
68
|
},
|
|
64
|
-
components: { input: /* @__PURE__ */
|
|
69
|
+
components: { input: /* @__PURE__ */ l("input", {
|
|
65
70
|
...S,
|
|
66
71
|
ref: O,
|
|
67
72
|
id: b,
|
|
68
73
|
placeholder: "",
|
|
69
|
-
required:
|
|
70
|
-
"aria-required":
|
|
74
|
+
required: n.required && !n.value.length,
|
|
75
|
+
"aria-required": n.required || void 0,
|
|
71
76
|
"aria-invalid": E ? !0 : S?.["aria-invalid"],
|
|
72
77
|
"aria-describedby": k
|
|
73
78
|
}) },
|
|
74
|
-
tagRender: ({ label: e, closable: t, onClose: n }) => /* @__PURE__ */
|
|
79
|
+
tagRender: ({ label: e, closable: t, onClose: n }) => /* @__PURE__ */ u("span", {
|
|
75
80
|
className: "ui-cascader-tag",
|
|
76
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ l("span", { children: e }), t && /* @__PURE__ */ l("button", {
|
|
77
82
|
type: "button",
|
|
78
83
|
"aria-label": `移除 ${String(e)}`,
|
|
79
84
|
onMouseDown: (e) => {
|
|
@@ -82,37 +87,37 @@ function m(m) {
|
|
|
82
87
|
onClick: (e) => {
|
|
83
88
|
e.stopPropagation(), n();
|
|
84
89
|
},
|
|
85
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ l(m, { size: 12 })
|
|
86
91
|
})]
|
|
87
92
|
})
|
|
88
93
|
};
|
|
89
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ u(t, {
|
|
90
95
|
controlId: b,
|
|
91
96
|
label: w,
|
|
92
97
|
helpText: T,
|
|
93
98
|
error: E,
|
|
94
|
-
required:
|
|
95
|
-
children: [y && /* @__PURE__ */
|
|
99
|
+
required: n.required,
|
|
100
|
+
children: [y && /* @__PURE__ */ l("span", {
|
|
96
101
|
hidden: !0,
|
|
97
102
|
"data-ui-aria-overlay": ""
|
|
98
|
-
}),
|
|
103
|
+
}), n.multiple ? /* @__PURE__ */ l(h, {
|
|
99
104
|
...A,
|
|
100
105
|
checkable: !0,
|
|
101
|
-
checkStrictly:
|
|
102
|
-
maxTagCount:
|
|
103
|
-
value:
|
|
104
|
-
onChange: (e, t) =>
|
|
105
|
-
}) : /* @__PURE__ */
|
|
106
|
+
checkStrictly: n.checkStrictly ?? !0,
|
|
107
|
+
maxTagCount: n.maxTagCount ?? 3,
|
|
108
|
+
value: n.value,
|
|
109
|
+
onChange: (e, t) => n.onValueChange(e ?? [], t ?? [])
|
|
110
|
+
}) : /* @__PURE__ */ l(h, {
|
|
106
111
|
...A,
|
|
107
|
-
value:
|
|
108
|
-
onChange: (e, t) =>
|
|
112
|
+
value: n.value,
|
|
113
|
+
onChange: (e, t) => n.onValueChange(e ?? [], t ?? [])
|
|
109
114
|
})]
|
|
110
115
|
});
|
|
111
116
|
}
|
|
112
|
-
function
|
|
117
|
+
function v(e) {
|
|
113
118
|
return e.replace(/[\s/]+/gu, "").toLocaleLowerCase();
|
|
114
119
|
}
|
|
115
|
-
function
|
|
120
|
+
function y(e) {
|
|
116
121
|
let t = /* @__PURE__ */ new Map(), n = new Map(e.map((e) => [e.id, e.parentId]));
|
|
117
122
|
for (let n of e) {
|
|
118
123
|
if (!n.id || t.has(n.id)) throw Error("Cascader IDs must be nonempty and unique");
|
|
@@ -134,7 +139,7 @@ function g(e) {
|
|
|
134
139
|
}
|
|
135
140
|
return r;
|
|
136
141
|
}
|
|
137
|
-
function
|
|
142
|
+
function b(e) {
|
|
138
143
|
let t = /* @__PURE__ */ new Map();
|
|
139
144
|
function n(e, r) {
|
|
140
145
|
for (let i of e) {
|
|
@@ -146,4 +151,4 @@ function _(e) {
|
|
|
146
151
|
return n(e, []), t;
|
|
147
152
|
}
|
|
148
153
|
//#endregion
|
|
149
|
-
export {
|
|
154
|
+
export { g as Cascader, y as buildCascaderOptions, b as indexCascaderPaths };
|