bj-web-components 0.2.26 → 0.2.27
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/favicon.ico +0 -0
- package/dist/file.svg +1 -0
- package/dist/globe.svg +1 -0
- package/dist/index.d.ts +1141 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +51 -0
- package/dist/miniapp.d.ts +1 -0
- package/dist/miniapp.js +1 -0
- package/dist/miniapp.mjs +1 -0
- package/dist/mobile.d.ts +1 -0
- package/dist/mobile.js +1 -0
- package/dist/mobile.mjs +1 -0
- package/dist/next.svg +1 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +1 -0
- package/dist/react.mjs +1 -0
- package/dist/shared.d.ts +1 -0
- package/dist/shared.js +1 -0
- package/dist/shared.mjs +1 -0
- package/dist/style.css +1 -0
- package/dist/vercel.svg +1 -0
- package/dist/web/BasicInput/BInput.js +1 -0
- package/dist/web/BasicInput/BInput.mjs +177 -0
- package/dist/web/BasicInput/utils.js +1 -0
- package/dist/web/BasicInput/utils.mjs +37 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +260 -0
- package/dist/web/CheckBox/BCheckBox.js +1 -0
- package/dist/web/CheckBox/BCheckBox.mjs +101 -0
- package/dist/web/CheckBox/Group.js +1 -0
- package/dist/web/CheckBox/Group.mjs +67 -0
- package/dist/web/CheckBox/context.js +1 -0
- package/dist/web/CheckBox/context.mjs +5 -0
- package/dist/web/CheckBox/index.js +1 -0
- package/dist/web/CheckBox/index.mjs +8 -0
- package/dist/web/Dropdown/BDropdown.js +1 -0
- package/dist/web/Dropdown/BDropdown.mjs +160 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +74 -0
- package/dist/web/FileCard/FileCard.js +1 -0
- package/dist/web/FileCard/FileCard.mjs +128 -0
- package/dist/web/Icon/Icon.js +1 -0
- package/dist/web/Icon/Icon.mjs +10 -0
- package/dist/web/Input/Input.js +1 -0
- package/dist/web/Input/Input.mjs +173 -0
- package/dist/web/InputNumber/BInputNumber.js +1 -0
- package/dist/web/InputNumber/BInputNumber.mjs +204 -0
- package/dist/web/InputNumber/StepHandler.js +1 -0
- package/dist/web/InputNumber/StepHandler.mjs +64 -0
- package/dist/web/InputNumber/hooks/useCursor.js +1 -0
- package/dist/web/InputNumber/hooks/useCursor.mjs +39 -0
- package/dist/web/InputNumber/hooks/useFrame.js +1 -0
- package/dist/web/InputNumber/hooks/useFrame.mjs +10 -0
- package/dist/web/InputNumber/utils/decimal.js +1 -0
- package/dist/web/InputNumber/utils/decimal.mjs +119 -0
- package/dist/web/Modal/Modal.js +1 -0
- package/dist/web/Modal/Modal.mjs +82 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
- package/dist/web/Pagination/Pagination.js +1 -0
- package/dist/web/Pagination/Pagination.mjs +253 -0
- package/dist/web/ProductField/ProductField.js +1 -0
- package/dist/web/ProductField/ProductField.mjs +226 -0
- package/dist/web/ProductField/arrow-up.svg.js +1 -0
- package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-no.svg.js +1 -0
- package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-ok.svg.js +1 -0
- package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
- package/dist/web/ProductField/no_data_light.svg.js +1 -0
- package/dist/web/ProductField/no_data_light.svg.mjs +4 -0
- package/dist/web/ProductField/search.svg.js +1 -0
- package/dist/web/ProductField/search.svg.mjs +4 -0
- package/dist/web/ProductField/sort.svg.js +1 -0
- package/dist/web/ProductField/sort.svg.mjs +4 -0
- package/dist/web/SkuInputCard/SkuInputCard.js +1 -0
- package/dist/web/SkuInputCard/SkuInputCard.mjs +238 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
- package/dist/web/Switch/Switch.js +1 -0
- package/dist/web/Switch/Switch.mjs +61 -0
- package/dist/web/Table/BTable.js +1 -0
- package/dist/web/Table/BTable.mjs +698 -0
- package/dist/web/Table/Column.js +1 -0
- package/dist/web/Table/Column.mjs +6 -0
- package/dist/web/Table/ColumnGroup.js +1 -0
- package/dist/web/Table/ColumnGroup.mjs +6 -0
- package/dist/web/Table/utils/columns.js +1 -0
- package/dist/web/Table/utils/columns.mjs +43 -0
- package/dist/web/Table/utils/sortFilter.js +1 -0
- package/dist/web/Table/utils/sortFilter.mjs +63 -0
- package/dist/web/Tabs/BTabs.js +1 -0
- package/dist/web/Tabs/BTabs.mjs +130 -0
- package/dist/web/Tabs/TabPane.js +1 -0
- package/dist/web/Tabs/TabPane.mjs +8 -0
- package/dist/web/Tooltip/ConfirmTooltip.js +1 -0
- package/dist/web/Tooltip/ConfirmTooltip.mjs +26 -0
- package/dist/web/Tooltip/ContentTooltip.js +1 -0
- package/dist/web/Tooltip/ContentTooltip.mjs +85 -0
- package/dist/web/Tooltip/ProgressTooltip.js +1 -0
- package/dist/web/Tooltip/ProgressTooltip.mjs +35 -0
- package/dist/web/Tooltip/TooltipWrapper.js +1 -0
- package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
- package/dist/web/Tooltip/useAutoPlacement.js +1 -0
- package/dist/web/Tooltip/useAutoPlacement.mjs +32 -0
- package/dist/web.d.ts +1141 -0
- package/dist/web.js +1 -0
- package/dist/web.mjs +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { jsxs as T, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useRef as L, useCallback as Q, useLayoutEffect as $, useEffect as U } from "react";
|
|
3
|
+
import { createPortal as Z } from "react-dom";
|
|
4
|
+
/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
import X from "../Tooltip/ContentTooltip.mjs";
|
|
7
|
+
import Y from "../Tooltip/TooltipWrapper.mjs";
|
|
8
|
+
function A({
|
|
9
|
+
text: a,
|
|
10
|
+
spanClassName: p,
|
|
11
|
+
wrapperStyle: d,
|
|
12
|
+
placement: h = "top",
|
|
13
|
+
getPopupContainer: f,
|
|
14
|
+
trailing: u
|
|
15
|
+
}) {
|
|
16
|
+
const [i, m] = E(!1), N = L(null), x = L(null), [o, w] = E(null);
|
|
17
|
+
function b() {
|
|
18
|
+
var g;
|
|
19
|
+
const y = x.current;
|
|
20
|
+
y && y.scrollWidth > y.offsetWidth && (w(((g = N.current) == null ? void 0 : g.getBoundingClientRect()) ?? null), m(!0));
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ T(Y, { ref: N, style: d, children: [
|
|
23
|
+
/* @__PURE__ */ r(
|
|
24
|
+
"span",
|
|
25
|
+
{
|
|
26
|
+
ref: x,
|
|
27
|
+
className: p,
|
|
28
|
+
onMouseEnter: b,
|
|
29
|
+
onMouseLeave: () => m(!1),
|
|
30
|
+
children: a
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
u,
|
|
34
|
+
i && o && Z(
|
|
35
|
+
/* @__PURE__ */ r(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
style: {
|
|
39
|
+
position: "fixed",
|
|
40
|
+
top: o.top,
|
|
41
|
+
left: o.left,
|
|
42
|
+
width: o.width,
|
|
43
|
+
height: o.height,
|
|
44
|
+
display: "block",
|
|
45
|
+
pointerEvents: "none",
|
|
46
|
+
zIndex: 9999999999
|
|
47
|
+
},
|
|
48
|
+
children: /* @__PURE__ */ r(X, { content: a, placement: h, className: "bu-category-dropdown__tooltip" })
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
(f == null ? void 0 : f()) ?? document.body
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
function P() {
|
|
56
|
+
return /* @__PURE__ */ r("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ r("path", { d: "M5.57345 8.828C5.41074 8.66528 5.41074 8.40152 5.57345 8.2388C5.73617 8.07608 5.99993 8.07608 6.16265 8.2388L10.0323 12.1084L13.8349 8.24124C13.9963 8.0772 14.26 8.07503 14.4241 8.23636C14.5881 8.39771 14.5903 8.66149 14.429 8.82555L10.5282 12.7924C10.2576 13.0675 9.81477 13.0694 9.54196 12.7966L5.57345 8.828Z", fill: "#333333" }) });
|
|
57
|
+
}
|
|
58
|
+
function ee() {
|
|
59
|
+
return (
|
|
60
|
+
// <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
61
|
+
// <path d="M6 3.5L10.5 8L6 12.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
62
|
+
// </svg>
|
|
63
|
+
/* @__PURE__ */ r("svg", { class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "55697", children: /* @__PURE__ */ r("path", { d: "M451.854222 285.361778A21.333333 21.333333 0 1 0 421.688889 315.52l198.115555 198.122667-197.994666 194.702222a21.333333 21.333333 0 0 0 29.916444 30.414222l203.107556-199.722667a35.555556 35.555556 0 0 0 0.213333-50.488888L451.854222 285.354667z", "p-id": "55698" }) })
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function te(a, p) {
|
|
67
|
+
var f;
|
|
68
|
+
const d = [a];
|
|
69
|
+
let h = a;
|
|
70
|
+
for (let u = 0; u < p.length; u++) {
|
|
71
|
+
const i = h.find((m) => m.value === p[u]);
|
|
72
|
+
if ((f = i == null ? void 0 : i.children) != null && f.length)
|
|
73
|
+
d.push(i.children), h = i.children;
|
|
74
|
+
else
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return d;
|
|
78
|
+
}
|
|
79
|
+
function H(a, p) {
|
|
80
|
+
const d = [];
|
|
81
|
+
let h = a;
|
|
82
|
+
for (const f of p) {
|
|
83
|
+
const u = h.find((i) => i.value === f);
|
|
84
|
+
if (!u) break;
|
|
85
|
+
d.push(u), h = u.children ?? [];
|
|
86
|
+
}
|
|
87
|
+
return d;
|
|
88
|
+
}
|
|
89
|
+
function ae({
|
|
90
|
+
data: a,
|
|
91
|
+
value: p = [],
|
|
92
|
+
onChange: d,
|
|
93
|
+
placeholder: h = "请选择分类",
|
|
94
|
+
disabled: f = !1,
|
|
95
|
+
maxVisible: u = 6,
|
|
96
|
+
className: i,
|
|
97
|
+
style: m,
|
|
98
|
+
getPopupContainer: N,
|
|
99
|
+
dropdownStyle: x
|
|
100
|
+
}) {
|
|
101
|
+
const [o, w] = E(!1), [b, y] = E(p), g = L(null), j = L(null), S = L(null), z = L(!1), [D, q] = E({}), [B, F] = E(), C = Q(() => {
|
|
102
|
+
var _;
|
|
103
|
+
if (!g.current) return;
|
|
104
|
+
const n = g.current.getBoundingClientRect();
|
|
105
|
+
let e = 0, t = g.current.parentElement;
|
|
106
|
+
for (; t && t !== document.documentElement; ) {
|
|
107
|
+
const R = parseInt(window.getComputedStyle(t).zIndex, 10);
|
|
108
|
+
if (!isNaN(R) && R > e && (e = R), t.parentElement)
|
|
109
|
+
for (const v of t.parentElement.children) {
|
|
110
|
+
if (v === t || !(v instanceof HTMLElement)) continue;
|
|
111
|
+
const k = parseInt(window.getComputedStyle(v).zIndex, 10);
|
|
112
|
+
!isNaN(k) && k > e && (e = k);
|
|
113
|
+
}
|
|
114
|
+
t = t.parentElement;
|
|
115
|
+
}
|
|
116
|
+
const l = ((_ = S.current) == null ? void 0 : _.offsetHeight) ?? 0, s = window.innerHeight - n.bottom, c = n.top, M = l > 0 && s < l + 4 && c > s;
|
|
117
|
+
q({
|
|
118
|
+
position: "fixed",
|
|
119
|
+
top: M ? n.top - l - 4 : n.bottom + 4,
|
|
120
|
+
left: n.left,
|
|
121
|
+
zIndex: e > 0 ? e + 10 : 1100,
|
|
122
|
+
...x
|
|
123
|
+
});
|
|
124
|
+
}, [x]);
|
|
125
|
+
$(() => {
|
|
126
|
+
o && C();
|
|
127
|
+
}, [o, b, C]), $(() => {
|
|
128
|
+
const n = o && !z.current;
|
|
129
|
+
if (z.current = o, !o || !S.current) return;
|
|
130
|
+
const e = S.current.querySelectorAll(".bu-category-dropdown__col");
|
|
131
|
+
e.forEach((s) => {
|
|
132
|
+
s.style.width = "";
|
|
133
|
+
});
|
|
134
|
+
let t = 0;
|
|
135
|
+
e.forEach((s) => {
|
|
136
|
+
s.offsetWidth > t && (t = s.offsetWidth);
|
|
137
|
+
});
|
|
138
|
+
const l = n ? t : Math.max(B ?? 0, t);
|
|
139
|
+
e.forEach((s) => {
|
|
140
|
+
s.style.width = l ? `${l}px` : "";
|
|
141
|
+
}), l !== B && F(l || void 0);
|
|
142
|
+
}, [o, b]), U(() => {
|
|
143
|
+
if (!o) return;
|
|
144
|
+
function n(t) {
|
|
145
|
+
var s, c;
|
|
146
|
+
const l = t.target;
|
|
147
|
+
(s = g.current) != null && s.contains(l) || (c = j.current) != null && c.contains(l) || w(!1);
|
|
148
|
+
}
|
|
149
|
+
function e() {
|
|
150
|
+
w(!1);
|
|
151
|
+
}
|
|
152
|
+
return document.addEventListener("mousedown", n), document.addEventListener("scroll", e, !0), window.addEventListener("resize", C), () => {
|
|
153
|
+
document.removeEventListener("mousedown", n), document.removeEventListener("scroll", e, !0), window.removeEventListener("resize", C);
|
|
154
|
+
};
|
|
155
|
+
}, [o, C]);
|
|
156
|
+
const O = H(a, p), W = O.length > 0, G = W ? O.map((n) => n.label).join(" / ") : null, V = te(a, b);
|
|
157
|
+
function I(n, e) {
|
|
158
|
+
var l;
|
|
159
|
+
if (e.disabled) return;
|
|
160
|
+
const t = b.slice(0, n + 1);
|
|
161
|
+
if (t[n] = e.value, y(t), !((l = e.children) != null && l.length)) {
|
|
162
|
+
const s = H(a, t);
|
|
163
|
+
d == null || d(t, s), w(!1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function J() {
|
|
167
|
+
y(p), w(!0);
|
|
168
|
+
}
|
|
169
|
+
const K = [
|
|
170
|
+
"bu-category-dropdown__trigger",
|
|
171
|
+
o ? "bu-category-dropdown__trigger--open" : "",
|
|
172
|
+
W ? "bu-category-dropdown__trigger--has-value" : ""
|
|
173
|
+
].filter(Boolean).join(" ");
|
|
174
|
+
return /* @__PURE__ */ T(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref: g,
|
|
178
|
+
className: `bu-category-dropdown${i ? ` ${i}` : ""}`,
|
|
179
|
+
style: m,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ r(
|
|
182
|
+
"button",
|
|
183
|
+
{
|
|
184
|
+
type: "button",
|
|
185
|
+
className: K,
|
|
186
|
+
disabled: f,
|
|
187
|
+
onClick: () => o ? w(!1) : J(),
|
|
188
|
+
children: /* @__PURE__ */ r(
|
|
189
|
+
A,
|
|
190
|
+
{
|
|
191
|
+
text: G ?? h,
|
|
192
|
+
spanClassName: `bu-category-dropdown__trigger-label${W ? "" : " bu-category-dropdown__trigger-label--placeholder"}`,
|
|
193
|
+
wrapperStyle: { flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: 8 },
|
|
194
|
+
getPopupContainer: N,
|
|
195
|
+
trailing: /* @__PURE__ */ r("span", { className: `bu-category-dropdown__trigger-chevron${o ? " bu-category-dropdown__trigger-chevron--open" : ""}`, children: /* @__PURE__ */ r(P, {}) })
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
o && Z(
|
|
201
|
+
/* @__PURE__ */ r("div", { ref: j, style: D, className: "bu-category-dropdown__portal", children: /* @__PURE__ */ r("div", { className: "bu-category-dropdown__panel", ref: S, children: V.map((n, e) => {
|
|
202
|
+
const t = n.length > u, l = e === V.length - 1, s = [
|
|
203
|
+
"bu-category-dropdown__col",
|
|
204
|
+
e > 0 ? "bu-category-dropdown__col--indent" : "",
|
|
205
|
+
t ? "bu-category-dropdown__col--scrollable" : "",
|
|
206
|
+
l && e > 0 ? "bu-category-dropdown__col--last" : ""
|
|
207
|
+
].filter(Boolean).join(" ");
|
|
208
|
+
return /* @__PURE__ */ T("div", { style: { display: "contents" }, children: [
|
|
209
|
+
e > 0 && /* @__PURE__ */ r("div", { className: "bu-category-dropdown__divider" }),
|
|
210
|
+
/* @__PURE__ */ r(
|
|
211
|
+
"div",
|
|
212
|
+
{
|
|
213
|
+
className: s,
|
|
214
|
+
style: B ? { width: B } : void 0,
|
|
215
|
+
onMouseEnter: t ? (c) => c.currentTarget.classList.add("bu-category-dropdown__col--scrollbar-visible") : void 0,
|
|
216
|
+
onMouseLeave: t ? (c) => c.currentTarget.classList.remove("bu-category-dropdown__col--scrollbar-visible") : void 0,
|
|
217
|
+
children: n.map((c) => {
|
|
218
|
+
var v;
|
|
219
|
+
const M = b[e] === c.value, _ = !!((v = c.children) != null && v.length), R = [
|
|
220
|
+
"bu-category-dropdown__item",
|
|
221
|
+
M && _ ? "bu-category-dropdown__item--selected-branch" : "",
|
|
222
|
+
M && !_ ? "bu-category-dropdown__item--selected-leaf" : "",
|
|
223
|
+
c.disabled ? "bu-category-dropdown__item--disabled" : ""
|
|
224
|
+
].filter(Boolean).join(" ");
|
|
225
|
+
return /* @__PURE__ */ T(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
type: "button",
|
|
229
|
+
className: R,
|
|
230
|
+
disabled: c.disabled,
|
|
231
|
+
onClick: () => I(e, c),
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ r(
|
|
234
|
+
A,
|
|
235
|
+
{
|
|
236
|
+
text: c.label,
|
|
237
|
+
spanClassName: "bu-category-dropdown__item-label",
|
|
238
|
+
wrapperStyle: { flex: 1, minWidth: 0, display: "block" },
|
|
239
|
+
getPopupContainer: N
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
_ && /* @__PURE__ */ r("span", { className: "bu-category-dropdown__item-arrow", children: /* @__PURE__ */ r(ee, {}) })
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
c.value
|
|
246
|
+
);
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] }, e);
|
|
251
|
+
}) }) }),
|
|
252
|
+
document.body
|
|
253
|
+
)
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
export {
|
|
259
|
+
ae as default
|
|
260
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),t=require("react"),M=require("../Icon/Icon.js"),S=require("./context.js");;/* empty css */function f(...i){return i.filter(Boolean).join(" ")}const m=t.forwardRef((i,j)=>{const{checked:k,defaultChecked:v=!1,disabled:p,indeterminate:o=!1,children:h,className:C,style:N,onChange:l,onMouseEnter:_,onMouseLeave:B,value:c,skipGroup:E=!1,direction:V="ltr",name:q,variant:x="dark",...w}=i,e=t.useContext(S.CheckBoxGroupContext),[y,D]=t.useState(v),d=t.useRef(c),a=!!(e&&!E),s=a?e.value.includes(c):k??y,r=(e==null?void 0:e.disabled)||p,G=a?e==null?void 0:e.name:q,P=a?(e==null?void 0:e.variant)??x:x;t.useEffect(()=>{if(!(!a||c===void 0))return e==null||e.registerValue(c),()=>e==null?void 0:e.cancelValue(c)},[e,a,c]),t.useEffect(()=>{!a||d.current===c||(d.current!==void 0&&(e==null||e.cancelValue(d.current)),c!==void 0&&(e==null||e.registerValue(c)),d.current=c)},[e,a,c]);const R=b=>{if(r)return;const u=b.target.checked;!a&&k===void 0&&D(u);const I={target:{...i,checked:u},stopPropagation:()=>b.stopPropagation(),preventDefault:()=>b.preventDefault(),nativeEvent:b.nativeEvent};l==null||l(I),a&&c!==void 0&&(e==null||e.toggleOption({label:h,value:c,disabled:r,onChange:l}))};return n.jsxs("label",{className:f("bj-checkbox-wrapper",s&&"bj-checkbox-wrapper--checked",r&&"bj-checkbox-wrapper--disabled",V==="rtl"&&"bj-checkbox-wrapper--rtl",C),onMouseEnter:_,onMouseLeave:B,style:N,children:[n.jsxs("span",{className:f("bj-checkbox",s&&"bj-checkbox--checked",r&&"bj-checkbox--disabled",o&&"bj-checkbox--indeterminate",`bj-checkbox--${P}`),children:[n.jsx("input",{...w,"aria-checked":o?"mixed":s,checked:s,className:"bj-checkbox__input",disabled:r,name:G,onChange:R,ref:j,type:"checkbox",value:typeof c=="boolean"?String(c):c}),n.jsxs("span",{className:"bj-checkbox__inner",children:[s&&!o&&n.jsx(M,{className:"bj-checkbox__check-icon",type:"icon-a-dagouxi"}),o&&n.jsx("span",{className:"bj-checkbox__indeterminate-mark"})]})]}),h!==void 0&&n.jsx("span",{className:"bj-checkbox__label",children:h})]})});m.displayName="BCheckBox";module.exports=m;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxs as h, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useContext as g, useState as L, useRef as O, useEffect as x } from "react";
|
|
3
|
+
import $ from "../Icon/Icon.mjs";
|
|
4
|
+
import { CheckBoxGroupContext as q } from "./context.mjs";
|
|
5
|
+
/* empty css */
|
|
6
|
+
function u(...r) {
|
|
7
|
+
return r.filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
const z = S((r, p) => {
|
|
10
|
+
const {
|
|
11
|
+
checked: k,
|
|
12
|
+
defaultChecked: j = !1,
|
|
13
|
+
disabled: v,
|
|
14
|
+
indeterminate: o = !1,
|
|
15
|
+
children: b,
|
|
16
|
+
className: C,
|
|
17
|
+
style: N,
|
|
18
|
+
onChange: i,
|
|
19
|
+
onMouseEnter: _,
|
|
20
|
+
onMouseLeave: B,
|
|
21
|
+
value: c,
|
|
22
|
+
skipGroup: V = !1,
|
|
23
|
+
direction: w = "ltr",
|
|
24
|
+
name: y,
|
|
25
|
+
variant: m = "dark",
|
|
26
|
+
...E
|
|
27
|
+
} = r, e = g(q), [D, G] = L(j), s = O(c), a = !!(e && !V), t = a ? e.value.includes(c) : k ?? D, n = (e == null ? void 0 : e.disabled) || v, P = a ? e == null ? void 0 : e.name : y, I = a ? (e == null ? void 0 : e.variant) ?? m : m;
|
|
28
|
+
x(() => {
|
|
29
|
+
if (!(!a || c === void 0))
|
|
30
|
+
return e == null || e.registerValue(c), () => e == null ? void 0 : e.cancelValue(c);
|
|
31
|
+
}, [e, a, c]), x(() => {
|
|
32
|
+
!a || s.current === c || (s.current !== void 0 && (e == null || e.cancelValue(s.current)), c !== void 0 && (e == null || e.registerValue(c)), s.current = c);
|
|
33
|
+
}, [e, a, c]);
|
|
34
|
+
const M = (l) => {
|
|
35
|
+
if (n) return;
|
|
36
|
+
const f = l.target.checked;
|
|
37
|
+
!a && k === void 0 && G(f);
|
|
38
|
+
const R = {
|
|
39
|
+
target: { ...r, checked: f },
|
|
40
|
+
stopPropagation: () => l.stopPropagation(),
|
|
41
|
+
preventDefault: () => l.preventDefault(),
|
|
42
|
+
nativeEvent: l.nativeEvent
|
|
43
|
+
};
|
|
44
|
+
i == null || i(R), a && c !== void 0 && (e == null || e.toggleOption({ label: b, value: c, disabled: n, onChange: i }));
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ h(
|
|
47
|
+
"label",
|
|
48
|
+
{
|
|
49
|
+
className: u(
|
|
50
|
+
"bj-checkbox-wrapper",
|
|
51
|
+
t && "bj-checkbox-wrapper--checked",
|
|
52
|
+
n && "bj-checkbox-wrapper--disabled",
|
|
53
|
+
w === "rtl" && "bj-checkbox-wrapper--rtl",
|
|
54
|
+
C
|
|
55
|
+
),
|
|
56
|
+
onMouseEnter: _,
|
|
57
|
+
onMouseLeave: B,
|
|
58
|
+
style: N,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ h(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: u(
|
|
64
|
+
"bj-checkbox",
|
|
65
|
+
t && "bj-checkbox--checked",
|
|
66
|
+
n && "bj-checkbox--disabled",
|
|
67
|
+
o && "bj-checkbox--indeterminate",
|
|
68
|
+
`bj-checkbox--${I}`
|
|
69
|
+
),
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ d(
|
|
72
|
+
"input",
|
|
73
|
+
{
|
|
74
|
+
...E,
|
|
75
|
+
"aria-checked": o ? "mixed" : t,
|
|
76
|
+
checked: t,
|
|
77
|
+
className: "bj-checkbox__input",
|
|
78
|
+
disabled: n,
|
|
79
|
+
name: P,
|
|
80
|
+
onChange: M,
|
|
81
|
+
ref: p,
|
|
82
|
+
type: "checkbox",
|
|
83
|
+
value: typeof c == "boolean" ? String(c) : c
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ h("span", { className: "bj-checkbox__inner", children: [
|
|
87
|
+
t && !o && /* @__PURE__ */ d($, { className: "bj-checkbox__check-icon", type: "icon-a-dagouxi" }),
|
|
88
|
+
o && /* @__PURE__ */ d("span", { className: "bj-checkbox__indeterminate-mark" })
|
|
89
|
+
] })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
b !== void 0 && /* @__PURE__ */ d("span", { className: "bj-checkbox__label", children: b })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
z.displayName = "BCheckBox";
|
|
99
|
+
export {
|
|
100
|
+
z as default
|
|
101
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),c=require("react"),z=require("./BCheckBox.js"),C=require("./context.js");function M(n){return(n??[]).map(t=>typeof t=="string"||typeof t=="number"?{label:t,value:t}:t)}const h=c.forwardRef(({defaultValue:n=[],value:t,onChange:i,options:f,children:j,disabled:o,name:m,className:k,style:B,direction:O="ltr",variant:v="dark"},y)=>{const[p,g]=c.useState(n),[x,b]=c.useState([]),u=t??p,l=c.useMemo(()=>M(f),[f]);c.useEffect(()=>{t!==void 0&&g(t)},[t]);const q=e=>{b(r=>r.includes(e)?r:[...r,e])},V=e=>{b(r=>r.filter(a=>a!==e))},G=e=>{const r=u.includes(e.value)?u.filter(s=>s!==e.value):[...u,e.value];t===void 0&&g(r);const a=l.length>0?l.map(s=>s.value):x;i==null||i(r.filter(s=>x.includes(s)).sort((s,S)=>a.indexOf(s)-a.indexOf(S)))},N=c.useMemo(()=>({name:m,value:u,disabled:o,variant:v,registerValue:q,cancelValue:V,toggleOption:G}),[o,u,m,x,v]),R=l.length>0?l.map(e=>d.jsx(z,{className:"bj-checkbox-group__item",disabled:e.disabled??o,onChange:e.onChange,style:e.style,value:e.value,children:e.label},String(e.value))):j;return d.jsx("div",{className:["bj-checkbox-group",O==="rtl"?"bj-checkbox-group--rtl":"",k].filter(Boolean).join(" "),ref:y,style:B,children:d.jsx(C.CheckBoxGroupContext.Provider,{value:N,children:R})})});h.displayName="BCheckBox.Group";module.exports=h;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useState as b, useMemo as h, useEffect as _ } from "react";
|
|
3
|
+
import w from "./BCheckBox.mjs";
|
|
4
|
+
import { CheckBoxGroupContext as E } from "./context.mjs";
|
|
5
|
+
function I(u) {
|
|
6
|
+
return (u ?? []).map((r) => typeof r == "string" || typeof r == "number" ? { label: r, value: r } : r);
|
|
7
|
+
}
|
|
8
|
+
const M = S(({
|
|
9
|
+
defaultValue: u = [],
|
|
10
|
+
value: r,
|
|
11
|
+
onChange: i,
|
|
12
|
+
options: m,
|
|
13
|
+
children: p,
|
|
14
|
+
disabled: n,
|
|
15
|
+
name: d,
|
|
16
|
+
className: k,
|
|
17
|
+
style: B,
|
|
18
|
+
direction: O = "ltr",
|
|
19
|
+
variant: x = "dark"
|
|
20
|
+
}, j) => {
|
|
21
|
+
const [y, v] = b(u), [f, g] = b([]), s = r ?? y, c = h(() => I(m), [m]);
|
|
22
|
+
_(() => {
|
|
23
|
+
r !== void 0 && v(r);
|
|
24
|
+
}, [r]);
|
|
25
|
+
const V = (e) => {
|
|
26
|
+
g((t) => t.includes(e) ? t : [...t, e]);
|
|
27
|
+
}, G = (e) => {
|
|
28
|
+
g((t) => t.filter((a) => a !== e));
|
|
29
|
+
}, N = (e) => {
|
|
30
|
+
const t = s.includes(e.value) ? s.filter((l) => l !== e.value) : [...s, e.value];
|
|
31
|
+
r === void 0 && v(t);
|
|
32
|
+
const a = c.length > 0 ? c.map((l) => l.value) : f;
|
|
33
|
+
i == null || i(t.filter((l) => f.includes(l)).sort((l, R) => a.indexOf(l) - a.indexOf(R)));
|
|
34
|
+
}, z = h(() => ({
|
|
35
|
+
name: d,
|
|
36
|
+
value: s,
|
|
37
|
+
disabled: n,
|
|
38
|
+
variant: x,
|
|
39
|
+
registerValue: V,
|
|
40
|
+
cancelValue: G,
|
|
41
|
+
toggleOption: N
|
|
42
|
+
}), [n, s, d, f, x]), C = c.length > 0 ? c.map((e) => /* @__PURE__ */ o(
|
|
43
|
+
w,
|
|
44
|
+
{
|
|
45
|
+
className: "bj-checkbox-group__item",
|
|
46
|
+
disabled: e.disabled ?? n,
|
|
47
|
+
onChange: e.onChange,
|
|
48
|
+
style: e.style,
|
|
49
|
+
value: e.value,
|
|
50
|
+
children: e.label
|
|
51
|
+
},
|
|
52
|
+
String(e.value)
|
|
53
|
+
)) : p;
|
|
54
|
+
return /* @__PURE__ */ o(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: ["bj-checkbox-group", O === "rtl" ? "bj-checkbox-group--rtl" : "", k].filter(Boolean).join(" "),
|
|
58
|
+
ref: j,
|
|
59
|
+
style: B,
|
|
60
|
+
children: /* @__PURE__ */ o(E.Provider, { value: z, children: C })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
M.displayName = "BCheckBox.Group";
|
|
65
|
+
export {
|
|
66
|
+
M as default
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.createContext(null);exports.CheckBoxGroupContext=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./BCheckBox.js"),r=require("./Group.js"),e=o;e.Group=r;e.__ANT_CHECKBOX=!0;exports.BCheckBox=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),U=require("react-dom"),X=require("../BasicInput/BInput.js"),Y=require("../CheckBox/index.js"),k=require("../Icon/Icon.js"),Z=require("../OverlayScrollbar/BOverlayScrollbar.js");;/* empty css */const $=require("../Tooltip/ContentTooltip.js");require("../Tooltip/TooltipWrapper.js");const ee=require("../ProductField/no_data_light.svg.js");;/* empty css */function u(...s){return s.filter(Boolean).join(" ")}function ne(s){return typeof s.label=="string"||typeof s.label=="number"?String(s.label):String(s.value)}function D({option:s}){const i=r.useRef(null),[b,o]=r.useState(!1),[l,m]=r.useState(null),p=typeof s.label=="string"||typeof s.label=="number",j=p?String(s.label):s.label;function _(){const a=i.current;p&&a&&a.scrollWidth>a.clientWidth&&(m(a.getBoundingClientRect()),o(!0))}return n.jsxs("span",{ref:i,className:"bj-dropdown__option-label",onMouseEnter:_,onMouseLeave:()=>o(!1),children:[j,b&&l&&typeof document<"u"&&U.createPortal(n.jsx("span",{className:"bj-dropdown__option-tooltip-anchor",style:{position:"fixed",top:l.top,left:l.left,width:l.width,height:l.height},children:n.jsx($,{className:"bj-dropdown__option-tooltip",content:j,placement:"top"})}),document.body)]})}function I({option:s,doubleLine:i}){return i?n.jsxs("span",{className:"bj-dropdown__option-content",children:[n.jsx(D,{option:s}),s.description!==void 0&&n.jsx("span",{className:"bj-dropdown__option-description",children:s.description})]}):n.jsx(D,{option:s})}function se({className:s,style:i,options:b,value:o,defaultValue:l=[],multiple:m=!1,optionMode:p="single-line",searchable:j=!1,searchValue:_,searchPlaceholder:a="搜索",onSearch:f,filterOption:v=!0,emptyText:O,labels:g,t:y=h=>h,optionRender:x,onChange:N,footer:q=!0,showReset:E=!0,showConfirm:P=!0,resetText:W=y("重置"),confirmText:z=y("确定"),onReset:L,onConfirm:S}){const h=r.useRef(null),C=r.useRef(null),[A,M]=r.useState(l),[G,F]=r.useState(""),t=o??A,d=m===!0,c=p==="double-line",w=_??G,H=O??(g==null?void 0:g.emptyText)??y("暂无结果"),B=!f&&v!==!1&&w?b.filter(e=>typeof v=="function"?v(w,e):ne(e).toLocaleLowerCase().includes(w.toLocaleLowerCase())):b;function J(e,T){o===void 0&&M(e),N==null||N(e,T)}function R(e){_===void 0&&F(e),f==null||f(e)}function V(e){if(e.disabled)return;const T=d?t.includes(e.value)?t.filter(Q=>Q!==e.value):[...t,e.value]:[e.value];J(T,e)}function K(){o===void 0&&M([]),L==null||L()}return n.jsxs("div",{ref:h,className:u("bj-dropdown",c&&"bj-dropdown--double-line",!d&&"bj-dropdown--single",s),role:"dialog",style:i,children:[j&&n.jsx("div",{className:"bj-dropdown__search",children:n.jsx(X,{"aria-label":"搜索选项",allowClear:{clearIcon:n.jsx(k,{className:"bj-dropdown__search-clear-icon",type:"icon-a-guanbixi"})},onChange:e=>R(e.target.value),onClear:()=>R(""),placeholder:a,prefix:n.jsx(k,{type:"icon-a-sousuoxi"}),inputMode:"search",role:"searchbox",type:"text",value:w})}),n.jsxs("div",{ref:C,className:u("bj-dropdown__options","bj-overlay-scrollbar-hidden",B.length===0&&"bj-dropdown__options--empty",!d&&"bj-dropdown__options--single"),children:[B.map(e=>d?n.jsx(Y.BCheckBox,{checked:t.includes(e.value),className:u("bj-dropdown__option",c&&e.description!==void 0&&"bj-dropdown__option--double-line"),disabled:e.disabled,onChange:()=>V(e),skipGroup:!0,variant:"white",children:x?x(e):n.jsx(I,{doubleLine:c&&e.description!==void 0,option:e})},String(e.value)):n.jsxs("button",{"aria-pressed":t.includes(e.value),className:u("bj-dropdown__option","bj-dropdown__option--single",c&&e.description!==void 0&&"bj-dropdown__option--double-line",t.includes(e.value)&&"bj-dropdown__option--selected"),disabled:e.disabled,onClick:()=>V(e),type:"button",children:[x?n.jsx("span",{className:"bj-dropdown__option-label",children:x(e)}):n.jsx(I,{doubleLine:c&&e.description!==void 0,option:e}),t.includes(e.value)&&n.jsx(k,{className:"bj-dropdown__option-icon",type:"icon-a-dagouxi"})]},String(e.value))),B.length===0&&n.jsxs("div",{className:"bj-dropdown__empty",children:[n.jsx("img",{alt:"",className:"bj-dropdown__empty-image",src:ee}),n.jsx("span",{className:"bj-dropdown__empty-text",children:H})]})]}),n.jsx(Z,{containerRef:h,gap:2,size:2,targetRef:C}),q!==!1&&(q!==!0?q:n.jsxs("div",{className:u("bj-dropdown__actions",!d&&"bj-dropdown__actions--single"),children:[E&&n.jsx("button",{onClick:K,type:"button",children:W}),d&&P&&n.jsx("button",{onClick:()=>S==null?void 0:S(t),type:"button",children:z})]}))]})}exports.BDropdown=se;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsxs as r, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useState as j } from "react";
|
|
3
|
+
import { createPortal as Y } from "react-dom";
|
|
4
|
+
import Z from "../BasicInput/BInput.mjs";
|
|
5
|
+
import { BCheckBox as $ } from "../CheckBox/index.mjs";
|
|
6
|
+
import V from "../Icon/Icon.mjs";
|
|
7
|
+
import ee from "../OverlayScrollbar/BOverlayScrollbar.mjs";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import le from "../Tooltip/ContentTooltip.mjs";
|
|
10
|
+
import "../Tooltip/TooltipWrapper.mjs";
|
|
11
|
+
import ne from "../ProductField/no_data_light.svg.mjs";
|
|
12
|
+
/* empty css */
|
|
13
|
+
function u(...n) {
|
|
14
|
+
return n.filter(Boolean).join(" ");
|
|
15
|
+
}
|
|
16
|
+
function te(n) {
|
|
17
|
+
return typeof n.label == "string" || typeof n.label == "number" ? String(n.label) : String(n.value);
|
|
18
|
+
}
|
|
19
|
+
function R({ option: n }) {
|
|
20
|
+
const d = M(null), [p, i] = j(!1), [o, g] = j(null), b = typeof n.label == "string" || typeof n.label == "number", m = b ? String(n.label) : n.label;
|
|
21
|
+
function f() {
|
|
22
|
+
const a = d.current;
|
|
23
|
+
b && a && a.scrollWidth > a.clientWidth && (g(a.getBoundingClientRect()), i(!0));
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
ref: d,
|
|
29
|
+
className: "bj-dropdown__option-label",
|
|
30
|
+
onMouseEnter: f,
|
|
31
|
+
onMouseLeave: () => i(!1),
|
|
32
|
+
children: [
|
|
33
|
+
m,
|
|
34
|
+
p && o && typeof document < "u" && Y(
|
|
35
|
+
/* @__PURE__ */ l(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
className: "bj-dropdown__option-tooltip-anchor",
|
|
39
|
+
style: {
|
|
40
|
+
position: "fixed",
|
|
41
|
+
top: o.top,
|
|
42
|
+
left: o.left,
|
|
43
|
+
width: o.width,
|
|
44
|
+
height: o.height
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ l(le, { className: "bj-dropdown__option-tooltip", content: m, placement: "top" })
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
document.body
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function W({ option: n, doubleLine: d }) {
|
|
56
|
+
return d ? /* @__PURE__ */ r("span", { className: "bj-dropdown__option-content", children: [
|
|
57
|
+
/* @__PURE__ */ l(R, { option: n }),
|
|
58
|
+
n.description !== void 0 && /* @__PURE__ */ l("span", { className: "bj-dropdown__option-description", children: n.description })
|
|
59
|
+
] }) : /* @__PURE__ */ l(R, { option: n });
|
|
60
|
+
}
|
|
61
|
+
function _e({
|
|
62
|
+
className: n,
|
|
63
|
+
style: d,
|
|
64
|
+
options: p,
|
|
65
|
+
value: i,
|
|
66
|
+
defaultValue: o = [],
|
|
67
|
+
multiple: g = !1,
|
|
68
|
+
optionMode: b = "single-line",
|
|
69
|
+
searchable: m = !1,
|
|
70
|
+
searchValue: f,
|
|
71
|
+
searchPlaceholder: a = "搜索",
|
|
72
|
+
onSearch: _,
|
|
73
|
+
filterOption: y = !0,
|
|
74
|
+
emptyText: z,
|
|
75
|
+
labels: N,
|
|
76
|
+
t: x = (w) => w,
|
|
77
|
+
optionRender: h,
|
|
78
|
+
onChange: B,
|
|
79
|
+
footer: L = !0,
|
|
80
|
+
showReset: A = !0,
|
|
81
|
+
showConfirm: G = !0,
|
|
82
|
+
resetText: P = x("重置"),
|
|
83
|
+
confirmText: q = x("确定"),
|
|
84
|
+
onReset: k,
|
|
85
|
+
onConfirm: C
|
|
86
|
+
}) {
|
|
87
|
+
const w = M(null), S = M(null), [F, E] = j(o), [H, J] = j(""), t = i ?? F, s = g === !0, c = b === "double-line", v = f ?? H, K = z ?? (N == null ? void 0 : N.emptyText) ?? x("暂无结果"), I = !_ && y !== !1 && v ? p.filter((e) => typeof y == "function" ? y(v, e) : te(e).toLocaleLowerCase().includes(v.toLocaleLowerCase())) : p;
|
|
88
|
+
function Q(e, T) {
|
|
89
|
+
i === void 0 && E(e), B == null || B(e, T);
|
|
90
|
+
}
|
|
91
|
+
function O(e) {
|
|
92
|
+
f === void 0 && J(e), _ == null || _(e);
|
|
93
|
+
}
|
|
94
|
+
function D(e) {
|
|
95
|
+
if (e.disabled) return;
|
|
96
|
+
const T = s ? t.includes(e.value) ? t.filter((X) => X !== e.value) : [...t, e.value] : [e.value];
|
|
97
|
+
Q(T, e);
|
|
98
|
+
}
|
|
99
|
+
function U() {
|
|
100
|
+
i === void 0 && E([]), k == null || k();
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ r("div", { ref: w, className: u("bj-dropdown", c && "bj-dropdown--double-line", !s && "bj-dropdown--single", n), role: "dialog", style: d, children: [
|
|
103
|
+
m && /* @__PURE__ */ l("div", { className: "bj-dropdown__search", children: /* @__PURE__ */ l(
|
|
104
|
+
Z,
|
|
105
|
+
{
|
|
106
|
+
"aria-label": "搜索选项",
|
|
107
|
+
allowClear: { clearIcon: /* @__PURE__ */ l(V, { className: "bj-dropdown__search-clear-icon", type: "icon-a-guanbixi" }) },
|
|
108
|
+
onChange: (e) => O(e.target.value),
|
|
109
|
+
onClear: () => O(""),
|
|
110
|
+
placeholder: a,
|
|
111
|
+
prefix: /* @__PURE__ */ l(V, { type: "icon-a-sousuoxi" }),
|
|
112
|
+
inputMode: "search",
|
|
113
|
+
role: "searchbox",
|
|
114
|
+
type: "text",
|
|
115
|
+
value: v
|
|
116
|
+
}
|
|
117
|
+
) }),
|
|
118
|
+
/* @__PURE__ */ r("div", { ref: S, className: u("bj-dropdown__options", "bj-overlay-scrollbar-hidden", I.length === 0 && "bj-dropdown__options--empty", !s && "bj-dropdown__options--single"), children: [
|
|
119
|
+
I.map((e) => s ? /* @__PURE__ */ l(
|
|
120
|
+
$,
|
|
121
|
+
{
|
|
122
|
+
checked: t.includes(e.value),
|
|
123
|
+
className: u("bj-dropdown__option", c && e.description !== void 0 && "bj-dropdown__option--double-line"),
|
|
124
|
+
disabled: e.disabled,
|
|
125
|
+
onChange: () => D(e),
|
|
126
|
+
skipGroup: !0,
|
|
127
|
+
variant: "white",
|
|
128
|
+
children: h ? h(e) : /* @__PURE__ */ l(W, { doubleLine: c && e.description !== void 0, option: e })
|
|
129
|
+
},
|
|
130
|
+
String(e.value)
|
|
131
|
+
) : /* @__PURE__ */ r(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
"aria-pressed": t.includes(e.value),
|
|
135
|
+
className: u("bj-dropdown__option", "bj-dropdown__option--single", c && e.description !== void 0 && "bj-dropdown__option--double-line", t.includes(e.value) && "bj-dropdown__option--selected"),
|
|
136
|
+
disabled: e.disabled,
|
|
137
|
+
onClick: () => D(e),
|
|
138
|
+
type: "button",
|
|
139
|
+
children: [
|
|
140
|
+
h ? /* @__PURE__ */ l("span", { className: "bj-dropdown__option-label", children: h(e) }) : /* @__PURE__ */ l(W, { doubleLine: c && e.description !== void 0, option: e }),
|
|
141
|
+
t.includes(e.value) && /* @__PURE__ */ l(V, { className: "bj-dropdown__option-icon", type: "icon-a-dagouxi" })
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
String(e.value)
|
|
145
|
+
)),
|
|
146
|
+
I.length === 0 && /* @__PURE__ */ r("div", { className: "bj-dropdown__empty", children: [
|
|
147
|
+
/* @__PURE__ */ l("img", { alt: "", className: "bj-dropdown__empty-image", src: ne }),
|
|
148
|
+
/* @__PURE__ */ l("span", { className: "bj-dropdown__empty-text", children: K })
|
|
149
|
+
] })
|
|
150
|
+
] }),
|
|
151
|
+
/* @__PURE__ */ l(ee, { containerRef: w, gap: 2, size: 2, targetRef: S }),
|
|
152
|
+
L !== !1 && (L !== !0 ? L : /* @__PURE__ */ r("div", { className: u("bj-dropdown__actions", !s && "bj-dropdown__actions--single"), children: [
|
|
153
|
+
A && /* @__PURE__ */ l("button", { onClick: U, type: "button", children: P }),
|
|
154
|
+
s && G && /* @__PURE__ */ l("button", { onClick: () => C == null ? void 0 : C(t), type: "button", children: q })
|
|
155
|
+
] }))
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
_e as BDropdown
|
|
160
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),h=require("react");;/* empty css */function v(){return t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M14.1667 5.3335C15.1792 5.3335 16 6.15431 16 7.16683V8.00016H19C19.2761 8.00016 19.5 8.22402 19.5 8.50016C19.5 8.7763 19.2761 9.00016 19 9.00016H17.3333V16.8335C17.3333 17.846 16.5125 18.6668 15.5 18.6668H8.5C7.48748 18.6668 6.66667 17.846 6.66667 16.8335V9.00016H5C4.72386 9.00016 4.5 8.7763 4.5 8.50016C4.5 8.22402 4.72386 8.00016 5 8.00016H8V7.16683C8 6.15431 8.82081 5.3335 9.83333 5.3335H14.1667ZM7.66667 16.8335C7.66667 17.2937 8.03976 17.6668 8.5 17.6668H15.5C15.9602 17.6668 16.3333 17.2937 16.3333 16.8335V9.00016H7.66667V16.8335ZM10.5 11.3335C10.7761 11.3335 11 11.5574 11 11.8335V15.0002C11 15.2763 10.7761 15.5002 10.5 15.5002C10.2239 15.5002 10 15.2763 10 15.0002V11.8335C10 11.5574 10.2239 11.3335 10.5 11.3335ZM13.5 11.3335C13.7761 11.3335 14 11.5574 14 11.8335V15.0002C14 15.2763 13.7761 15.5002 13.5 15.5002C13.2239 15.5002 13 15.2763 13 15.0002V11.8335C13 11.5574 13.2239 11.3335 13.5 11.3335ZM9.83333 6.3335C9.3731 6.3335 9 6.70659 9 7.16683V8.00016H15V7.16683C15 6.70659 14.6269 6.3335 14.1667 6.3335H9.83333Z",fill:"currentColor"})})}const N=h.forwardRef(function({mode:l="single",activeLang:c="zh",onLangChange:e,value:n="",onChange:u,placeholder:_,maxLength:x,error:d=!1,disabled:o,onDelete:r,labels:i,id:j,className:C,style:m},V){const p=(i==null?void 0:i.zh)??"中文",f=(i==null?void 0:i.en)??"EN",s=l==="bilingual",b=!!r,H=["bu-eib__box",s&&b&&"bu-eib__box--actions-both",s&&!b&&"bu-eib__box--actions-toggle",!s&&b&&"bu-eib__box--actions-delete",d&&"bu-eib__box--error",o&&"bu-eib__box--disabled"].filter(Boolean).join(" ");return t.jsx("div",{className:["bu-eib",C].filter(Boolean).join(" "),style:m,children:t.jsxs("div",{className:H,children:[t.jsx("input",{ref:V,id:j,className:"bu-eib__field",value:n,onChange:a=>u==null?void 0:u(a.target.value),placeholder:_,maxLength:x,disabled:o}),(s||b)&&t.jsxs("div",{className:"bu-eib__actions",children:[s&&t.jsxs("div",{className:"bu-eib__lang-toggle",children:[t.jsx("button",{type:"button",className:`bu-eib__lang-btn${c==="zh"?" bu-eib__lang-btn--active":""}`,onClick:()=>e==null?void 0:e("zh"),children:p}),t.jsx("button",{type:"button",className:`bu-eib__lang-btn${c==="en"?" bu-eib__lang-btn--active":""}`,onClick:()=>e==null?void 0:e("en"),children:f})]}),b&&t.jsx("button",{type:"button",className:"bu-eib__delete",onClick:r,children:t.jsx(v,{})})]})]})})});module.exports=N;
|