bj-web-components 0.2.28 → 0.2.29
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/index.js +1 -51
- package/dist/index.mjs +49 -49
- package/dist/style.css +1 -3744
- package/dist/web/BasicInput/BInput.js +1 -208
- package/dist/web/BasicInput/BInput.mjs +132 -164
- package/dist/web/BasicInput/utils.js +1 -47
- package/dist/web/BasicInput/utils.mjs +28 -38
- package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -307
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +170 -218
- package/dist/web/CheckBox/BCheckBox.js +1 -116
- package/dist/web/CheckBox/BCheckBox.mjs +70 -86
- package/dist/web/CheckBox/Group.js +1 -73
- package/dist/web/CheckBox/Group.mjs +56 -63
- package/dist/web/CheckBox/context.js +1 -5
- package/dist/web/CheckBox/context.mjs +3 -3
- package/dist/web/CheckBox/index.js +1 -8
- package/dist/web/CheckBox/index.mjs +6 -6
- package/dist/web/Dropdown/BDropdown.js +1 -186
- package/dist/web/Dropdown/BDropdown.mjs +106 -132
- package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -77
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +48 -52
- package/dist/web/FileCard/FileCard.js +1 -157
- package/dist/web/FileCard/FileCard.mjs +82 -112
- package/dist/web/Icon/Icon.js +1 -9
- package/dist/web/Icon/Icon.mjs +6 -6
- package/dist/web/Input/Input.js +1 -181
- package/dist/web/Input/Input.mjs +113 -122
- package/dist/web/InputNumber/BInputNumber.js +1 -311
- package/dist/web/InputNumber/BInputNumber.mjs +167 -275
- package/dist/web/InputNumber/StepHandler.js +1 -69
- package/dist/web/InputNumber/StepHandler.mjs +32 -38
- package/dist/web/InputNumber/hooks/useCursor.js +1 -40
- package/dist/web/InputNumber/hooks/useCursor.mjs +33 -35
- package/dist/web/InputNumber/hooks/useFrame.js +1 -12
- package/dist/web/InputNumber/hooks/useFrame.mjs +6 -9
- package/dist/web/InputNumber/utils/decimal.js +1 -147
- package/dist/web/InputNumber/utils/decimal.mjs +81 -109
- package/dist/web/Modal/Modal.js +1 -84
- package/dist/web/Modal/Modal.mjs +49 -52
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -232
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +125 -206
- package/dist/web/Pagination/Pagination.js +1 -328
- package/dist/web/Pagination/Pagination.mjs +178 -254
- package/dist/web/ProductField/ProductField.js +1 -272
- package/dist/web/ProductField/ProductField.mjs +143 -190
- package/dist/web/ProductField/arrow-up.svg.js +1 -3
- package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-no.svg.js +1 -3
- package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-ok.svg.js +1 -3
- package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
- package/dist/web/ProductField/no_data_light.svg.js +1 -3
- package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
- package/dist/web/ProductField/search.svg.js +1 -3
- package/dist/web/ProductField/search.svg.mjs +2 -2
- package/dist/web/ProductField/sort.svg.js +1 -3
- package/dist/web/ProductField/sort.svg.mjs +2 -2
- package/dist/web/SkuInputCard/SkuInputCard.js +1 -276
- package/dist/web/SkuInputCard/SkuInputCard.mjs +149 -188
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -3
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
- package/dist/web/Switch/Switch.js +1 -70
- package/dist/web/Switch/Switch.mjs +37 -47
- package/dist/web/Table/BTable.js +1 -950
- package/dist/web/Table/BTable.mjs +521 -767
- package/dist/web/Table/Column.js +1 -5
- package/dist/web/Table/Column.mjs +2 -2
- package/dist/web/Table/ColumnGroup.js +1 -5
- package/dist/web/Table/ColumnGroup.mjs +2 -2
- package/dist/web/Table/utils/columns.js +1 -48
- package/dist/web/Table/utils/columns.mjs +30 -35
- package/dist/web/Table/utils/sortFilter.js +1 -84
- package/dist/web/Table/utils/sortFilter.mjs +52 -73
- package/dist/web/Tabs/BTabs.js +1 -150
- package/dist/web/Tabs/BTabs.mjs +98 -118
- package/dist/web/Tabs/TabPane.js +1 -8
- package/dist/web/Tabs/TabPane.mjs +4 -4
- package/dist/web/Tooltip/ConfirmTooltip.js +1 -26
- package/dist/web/Tooltip/ConfirmTooltip.mjs +19 -20
- package/dist/web/Tooltip/ContentTooltip.js +1 -94
- package/dist/web/Tooltip/ContentTooltip.mjs +62 -72
- package/dist/web/Tooltip/ProgressTooltip.js +1 -36
- package/dist/web/Tooltip/ProgressTooltip.mjs +20 -22
- package/dist/web/Tooltip/TooltipWrapper.js +1 -12
- package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
- package/dist/web/Tooltip/useAutoPlacement.js +1 -41
- package/dist/web/Tooltip/useAutoPlacement.mjs +25 -34
- package/dist/web.js +1 -51
- package/dist/web.mjs +49 -49
- package/package.json +1 -1
|
@@ -1,301 +1,253 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useCallback, useLayoutEffect
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
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
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
text,
|
|
10
|
-
spanClassName,
|
|
11
|
-
wrapperStyle,
|
|
12
|
-
placement = "top",
|
|
13
|
-
getPopupContainer,
|
|
14
|
-
trailing
|
|
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
15
|
}) {
|
|
16
|
-
const [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _a;
|
|
22
|
-
const el = spanRef.current;
|
|
23
|
-
if (el && el.scrollWidth > el.offsetWidth) {
|
|
24
|
-
setAnchorRect(((_a = wrapperRef.current) == null ? void 0 : _a.getBoundingClientRect()) ?? null);
|
|
25
|
-
setVisible(true);
|
|
26
|
-
}
|
|
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));
|
|
27
21
|
}
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ T(Y, { ref: N, style: d, children: [
|
|
23
|
+
/* @__PURE__ */ r(
|
|
30
24
|
"span",
|
|
31
25
|
{
|
|
32
|
-
ref:
|
|
33
|
-
className:
|
|
34
|
-
onMouseEnter:
|
|
35
|
-
onMouseLeave: () =>
|
|
36
|
-
children:
|
|
26
|
+
ref: x,
|
|
27
|
+
className: p,
|
|
28
|
+
onMouseEnter: b,
|
|
29
|
+
onMouseLeave: () => m(!1),
|
|
30
|
+
children: a
|
|
37
31
|
}
|
|
38
32
|
),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */
|
|
33
|
+
u,
|
|
34
|
+
i && o && Z(
|
|
35
|
+
/* @__PURE__ */ r(
|
|
42
36
|
"span",
|
|
43
37
|
{
|
|
44
38
|
style: {
|
|
45
39
|
position: "fixed",
|
|
46
|
-
top:
|
|
47
|
-
left:
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
40
|
+
top: o.top,
|
|
41
|
+
left: o.left,
|
|
42
|
+
width: o.width,
|
|
43
|
+
height: o.height,
|
|
50
44
|
display: "block",
|
|
51
45
|
pointerEvents: "none",
|
|
52
46
|
zIndex: 9999999999
|
|
53
47
|
},
|
|
54
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ r(X, { content: a, placement: h, className: "bu-category-dropdown__tooltip" })
|
|
55
49
|
}
|
|
56
50
|
),
|
|
57
|
-
(
|
|
51
|
+
(f == null ? void 0 : f()) ?? document.body
|
|
58
52
|
)
|
|
59
53
|
] });
|
|
60
54
|
}
|
|
61
|
-
function
|
|
62
|
-
return /* @__PURE__ */
|
|
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" }) });
|
|
63
57
|
}
|
|
64
|
-
function
|
|
58
|
+
function ee() {
|
|
65
59
|
return (
|
|
66
60
|
// <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
67
61
|
// <path d="M6 3.5L10.5 8L6 12.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
68
62
|
// </svg>
|
|
69
|
-
/* @__PURE__ */
|
|
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" }) })
|
|
70
64
|
);
|
|
71
65
|
}
|
|
72
|
-
function
|
|
73
|
-
var
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
for (let
|
|
77
|
-
const
|
|
78
|
-
if ((
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} else {
|
|
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
|
|
82
75
|
break;
|
|
83
|
-
}
|
|
84
76
|
}
|
|
85
|
-
return
|
|
77
|
+
return d;
|
|
86
78
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
let
|
|
90
|
-
for (const
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
|
|
94
|
-
items = found.children ?? [];
|
|
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 ?? [];
|
|
95
86
|
}
|
|
96
|
-
return
|
|
87
|
+
return d;
|
|
97
88
|
}
|
|
98
|
-
function
|
|
99
|
-
data,
|
|
100
|
-
value = [],
|
|
101
|
-
onChange,
|
|
102
|
-
placeholder = "请选择分类",
|
|
103
|
-
disabled =
|
|
104
|
-
maxVisible = 6,
|
|
105
|
-
className,
|
|
106
|
-
style,
|
|
107
|
-
getPopupContainer,
|
|
108
|
-
dropdownStyle:
|
|
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
|
|
109
100
|
}) {
|
|
110
|
-
const [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let maxZ = 0;
|
|
123
|
-
let el = rootRef.current.parentElement;
|
|
124
|
-
while (el && el !== document.documentElement) {
|
|
125
|
-
const selfZ = parseInt(window.getComputedStyle(el).zIndex, 10);
|
|
126
|
-
if (!isNaN(selfZ) && selfZ > maxZ) maxZ = selfZ;
|
|
127
|
-
if (el.parentElement) {
|
|
128
|
-
for (const sibling of el.parentElement.children) {
|
|
129
|
-
if (sibling === el || !(sibling instanceof HTMLElement)) continue;
|
|
130
|
-
const sibZ = parseInt(window.getComputedStyle(sibling).zIndex, 10);
|
|
131
|
-
if (!isNaN(sibZ) && sibZ > maxZ) maxZ = sibZ;
|
|
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);
|
|
132
113
|
}
|
|
133
|
-
|
|
134
|
-
el = el.parentElement;
|
|
114
|
+
t = t.parentElement;
|
|
135
115
|
}
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
const spaceAbove = rect.top;
|
|
139
|
-
const flipToTop = panelHeight > 0 && spaceBelow < panelHeight + 4 && spaceAbove > spaceBelow;
|
|
140
|
-
setDropdownStyle({
|
|
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({
|
|
141
118
|
position: "fixed",
|
|
142
|
-
top:
|
|
143
|
-
left:
|
|
144
|
-
zIndex:
|
|
145
|
-
...
|
|
119
|
+
top: M ? n.top - l - 4 : n.bottom + 4,
|
|
120
|
+
left: n.left,
|
|
121
|
+
zIndex: e > 0 ? e + 10 : 1100,
|
|
122
|
+
...x
|
|
146
123
|
});
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (!open || !panelRef.current) return;
|
|
157
|
-
const cols = panelRef.current.querySelectorAll(".bu-category-dropdown__col");
|
|
158
|
-
cols.forEach((col) => {
|
|
159
|
-
col.style.width = "";
|
|
160
|
-
});
|
|
161
|
-
let max = 0;
|
|
162
|
-
cols.forEach((col) => {
|
|
163
|
-
if (col.offsetWidth > max) max = col.offsetWidth;
|
|
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 = "";
|
|
164
133
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
134
|
+
let t = 0;
|
|
135
|
+
e.forEach((s) => {
|
|
136
|
+
s.offsetWidth > t && (t = s.offsetWidth);
|
|
168
137
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
setOpen(false);
|
|
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);
|
|
180
148
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
149
|
+
function e() {
|
|
150
|
+
w(!1);
|
|
183
151
|
}
|
|
184
|
-
document.addEventListener("mousedown",
|
|
185
|
-
|
|
186
|
-
window.addEventListener("resize", updatePosition);
|
|
187
|
-
return () => {
|
|
188
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
189
|
-
document.removeEventListener("scroll", handleScroll, true);
|
|
190
|
-
window.removeEventListener("resize", updatePosition);
|
|
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);
|
|
191
154
|
};
|
|
192
|
-
}, [
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
newNavValue[colIndex] = item.value;
|
|
202
|
-
setNavValue(newNavValue);
|
|
203
|
-
if (!((_a = item.children) == null ? void 0 : _a.length)) {
|
|
204
|
-
const newPath = buildPath(data, newNavValue);
|
|
205
|
-
onChange == null ? void 0 : onChange(newNavValue, newPath);
|
|
206
|
-
setOpen(false);
|
|
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);
|
|
207
164
|
}
|
|
208
165
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
setOpen(true);
|
|
166
|
+
function J() {
|
|
167
|
+
y(p), w(!0);
|
|
212
168
|
}
|
|
213
|
-
const
|
|
169
|
+
const K = [
|
|
214
170
|
"bu-category-dropdown__trigger",
|
|
215
|
-
|
|
216
|
-
|
|
171
|
+
o ? "bu-category-dropdown__trigger--open" : "",
|
|
172
|
+
W ? "bu-category-dropdown__trigger--has-value" : ""
|
|
217
173
|
].filter(Boolean).join(" ");
|
|
218
|
-
return /* @__PURE__ */
|
|
174
|
+
return /* @__PURE__ */ T(
|
|
219
175
|
"div",
|
|
220
176
|
{
|
|
221
|
-
ref:
|
|
222
|
-
className: `bu-category-dropdown${
|
|
223
|
-
style,
|
|
177
|
+
ref: g,
|
|
178
|
+
className: `bu-category-dropdown${i ? ` ${i}` : ""}`,
|
|
179
|
+
style: m,
|
|
224
180
|
children: [
|
|
225
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ r(
|
|
226
182
|
"button",
|
|
227
183
|
{
|
|
228
184
|
type: "button",
|
|
229
|
-
className:
|
|
230
|
-
disabled,
|
|
231
|
-
onClick: () =>
|
|
232
|
-
children: /* @__PURE__ */
|
|
233
|
-
|
|
185
|
+
className: K,
|
|
186
|
+
disabled: f,
|
|
187
|
+
onClick: () => o ? w(!1) : J(),
|
|
188
|
+
children: /* @__PURE__ */ r(
|
|
189
|
+
A,
|
|
234
190
|
{
|
|
235
|
-
text:
|
|
236
|
-
spanClassName: `bu-category-dropdown__trigger-label${
|
|
191
|
+
text: G ?? h,
|
|
192
|
+
spanClassName: `bu-category-dropdown__trigger-label${W ? "" : " bu-category-dropdown__trigger-label--placeholder"}`,
|
|
237
193
|
wrapperStyle: { flex: 1, minWidth: 0, display: "flex", alignItems: "center", gap: 8 },
|
|
238
|
-
getPopupContainer,
|
|
239
|
-
trailing: /* @__PURE__ */
|
|
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, {}) })
|
|
240
196
|
}
|
|
241
197
|
)
|
|
242
198
|
}
|
|
243
199
|
),
|
|
244
|
-
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
const
|
|
247
|
-
const isLast = colIndex === columns.length - 1;
|
|
248
|
-
const colClass = [
|
|
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 = [
|
|
249
203
|
"bu-category-dropdown__col",
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
204
|
+
e > 0 ? "bu-category-dropdown__col--indent" : "",
|
|
205
|
+
t ? "bu-category-dropdown__col--scrollable" : "",
|
|
206
|
+
l && e > 0 ? "bu-category-dropdown__col--last" : ""
|
|
253
207
|
].filter(Boolean).join(" ");
|
|
254
|
-
return /* @__PURE__ */
|
|
255
|
-
|
|
256
|
-
/* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ T("div", { style: { display: "contents" }, children: [
|
|
209
|
+
e > 0 && /* @__PURE__ */ r("div", { className: "bu-category-dropdown__divider" }),
|
|
210
|
+
/* @__PURE__ */ r(
|
|
257
211
|
"div",
|
|
258
212
|
{
|
|
259
|
-
className:
|
|
260
|
-
style:
|
|
261
|
-
onMouseEnter:
|
|
262
|
-
onMouseLeave:
|
|
263
|
-
children:
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
const hasBranch = !!((_a = item.children) == null ? void 0 : _a.length);
|
|
267
|
-
const itemClass = [
|
|
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 = [
|
|
268
220
|
"bu-category-dropdown__item",
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
221
|
+
M && _ ? "bu-category-dropdown__item--selected-branch" : "",
|
|
222
|
+
M && !_ ? "bu-category-dropdown__item--selected-leaf" : "",
|
|
223
|
+
c.disabled ? "bu-category-dropdown__item--disabled" : ""
|
|
272
224
|
].filter(Boolean).join(" ");
|
|
273
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ T(
|
|
274
226
|
"button",
|
|
275
227
|
{
|
|
276
228
|
type: "button",
|
|
277
|
-
className:
|
|
278
|
-
disabled:
|
|
279
|
-
onClick: () =>
|
|
229
|
+
className: R,
|
|
230
|
+
disabled: c.disabled,
|
|
231
|
+
onClick: () => I(e, c),
|
|
280
232
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
|
|
233
|
+
/* @__PURE__ */ r(
|
|
234
|
+
A,
|
|
283
235
|
{
|
|
284
|
-
text:
|
|
236
|
+
text: c.label,
|
|
285
237
|
spanClassName: "bu-category-dropdown__item-label",
|
|
286
238
|
wrapperStyle: { flex: 1, minWidth: 0, display: "block" },
|
|
287
|
-
getPopupContainer
|
|
239
|
+
getPopupContainer: N
|
|
288
240
|
}
|
|
289
241
|
),
|
|
290
|
-
|
|
242
|
+
_ && /* @__PURE__ */ r("span", { className: "bu-category-dropdown__item-arrow", children: /* @__PURE__ */ r(ee, {}) })
|
|
291
243
|
]
|
|
292
244
|
},
|
|
293
|
-
|
|
245
|
+
c.value
|
|
294
246
|
);
|
|
295
247
|
})
|
|
296
248
|
}
|
|
297
249
|
)
|
|
298
|
-
] },
|
|
250
|
+
] }, e);
|
|
299
251
|
}) }) }),
|
|
300
252
|
document.body
|
|
301
253
|
)
|
|
@@ -304,5 +256,5 @@ function BuCategoryDropdown({
|
|
|
304
256
|
);
|
|
305
257
|
}
|
|
306
258
|
export {
|
|
307
|
-
|
|
259
|
+
ae as default
|
|
308
260
|
};
|
|
@@ -1,116 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const Icon = require("../Icon/Icon.js");
|
|
5
|
-
const context = require("./context.js");
|
|
6
|
-
;/* empty css */
|
|
7
|
-
function classNames(...values) {
|
|
8
|
-
return values.filter(Boolean).join(" ");
|
|
9
|
-
}
|
|
10
|
-
const BCheckBox = react.forwardRef((props, forwardedRef) => {
|
|
11
|
-
const {
|
|
12
|
-
checked: controlledChecked,
|
|
13
|
-
defaultChecked = false,
|
|
14
|
-
disabled,
|
|
15
|
-
indeterminate = false,
|
|
16
|
-
children,
|
|
17
|
-
className,
|
|
18
|
-
style,
|
|
19
|
-
onChange,
|
|
20
|
-
onMouseEnter,
|
|
21
|
-
onMouseLeave,
|
|
22
|
-
value,
|
|
23
|
-
skipGroup = false,
|
|
24
|
-
direction = "ltr",
|
|
25
|
-
name,
|
|
26
|
-
variant = "dark",
|
|
27
|
-
...inputProps
|
|
28
|
-
} = props;
|
|
29
|
-
const group = react.useContext(context.CheckBoxGroupContext);
|
|
30
|
-
const [internalChecked, setInternalChecked] = react.useState(defaultChecked);
|
|
31
|
-
const previousValue = react.useRef(value);
|
|
32
|
-
const inGroup = Boolean(group && !skipGroup);
|
|
33
|
-
const mergedChecked = inGroup ? group.value.includes(value) : controlledChecked ?? internalChecked;
|
|
34
|
-
const mergedDisabled = (group == null ? void 0 : group.disabled) || disabled;
|
|
35
|
-
const mergedName = inGroup ? group == null ? void 0 : group.name : name;
|
|
36
|
-
const mergedVariant = inGroup ? (group == null ? void 0 : group.variant) ?? variant : variant;
|
|
37
|
-
react.useEffect(() => {
|
|
38
|
-
if (!inGroup || value === void 0) return;
|
|
39
|
-
group == null ? void 0 : group.registerValue(value);
|
|
40
|
-
return () => group == null ? void 0 : group.cancelValue(value);
|
|
41
|
-
}, [group, inGroup, value]);
|
|
42
|
-
react.useEffect(() => {
|
|
43
|
-
if (!inGroup || previousValue.current === value) return;
|
|
44
|
-
if (previousValue.current !== void 0) group == null ? void 0 : group.cancelValue(previousValue.current);
|
|
45
|
-
if (value !== void 0) group == null ? void 0 : group.registerValue(value);
|
|
46
|
-
previousValue.current = value;
|
|
47
|
-
}, [group, inGroup, value]);
|
|
48
|
-
const handleChange = (event) => {
|
|
49
|
-
if (mergedDisabled) return;
|
|
50
|
-
const nextChecked = event.target.checked;
|
|
51
|
-
if (!inGroup && controlledChecked === void 0) setInternalChecked(nextChecked);
|
|
52
|
-
const changeEvent = {
|
|
53
|
-
target: { ...props, checked: nextChecked },
|
|
54
|
-
stopPropagation: () => event.stopPropagation(),
|
|
55
|
-
preventDefault: () => event.preventDefault(),
|
|
56
|
-
nativeEvent: event.nativeEvent
|
|
57
|
-
};
|
|
58
|
-
onChange == null ? void 0 : onChange(changeEvent);
|
|
59
|
-
if (inGroup && value !== void 0) {
|
|
60
|
-
group == null ? void 0 : group.toggleOption({ label: children, value, disabled: mergedDisabled, onChange });
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
64
|
-
"label",
|
|
65
|
-
{
|
|
66
|
-
className: classNames(
|
|
67
|
-
"bj-checkbox-wrapper",
|
|
68
|
-
mergedChecked && "bj-checkbox-wrapper--checked",
|
|
69
|
-
mergedDisabled && "bj-checkbox-wrapper--disabled",
|
|
70
|
-
direction === "rtl" && "bj-checkbox-wrapper--rtl",
|
|
71
|
-
className
|
|
72
|
-
),
|
|
73
|
-
onMouseEnter,
|
|
74
|
-
onMouseLeave,
|
|
75
|
-
style,
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
78
|
-
"span",
|
|
79
|
-
{
|
|
80
|
-
className: classNames(
|
|
81
|
-
"bj-checkbox",
|
|
82
|
-
mergedChecked && "bj-checkbox--checked",
|
|
83
|
-
mergedDisabled && "bj-checkbox--disabled",
|
|
84
|
-
indeterminate && "bj-checkbox--indeterminate",
|
|
85
|
-
`bj-checkbox--${mergedVariant}`
|
|
86
|
-
),
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
-
"input",
|
|
90
|
-
{
|
|
91
|
-
...inputProps,
|
|
92
|
-
"aria-checked": indeterminate ? "mixed" : mergedChecked,
|
|
93
|
-
checked: mergedChecked,
|
|
94
|
-
className: "bj-checkbox__input",
|
|
95
|
-
disabled: mergedDisabled,
|
|
96
|
-
name: mergedName,
|
|
97
|
-
onChange: handleChange,
|
|
98
|
-
ref: forwardedRef,
|
|
99
|
-
type: "checkbox",
|
|
100
|
-
value: typeof value === "boolean" ? String(value) : value
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "bj-checkbox__inner", children: [
|
|
104
|
-
mergedChecked && !indeterminate && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "bj-checkbox__check-icon", type: "icon-a-dagouxi" }),
|
|
105
|
-
indeterminate && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bj-checkbox__indeterminate-mark" })
|
|
106
|
-
] })
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
children !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bj-checkbox__label", children })
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
BCheckBox.displayName = "BCheckBox";
|
|
116
|
-
module.exports = BCheckBox;
|
|
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;
|