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,56 +1,49 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import
|
|
5
|
-
import { BCheckBox as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
8
|
/* empty css */
|
|
9
|
-
import
|
|
9
|
+
import le from "../Tooltip/ContentTooltip.mjs";
|
|
10
10
|
import "../Tooltip/TooltipWrapper.mjs";
|
|
11
|
-
import
|
|
11
|
+
import ne from "../ProductField/no_data_light.svg.mjs";
|
|
12
12
|
/* empty css */
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function u(...n) {
|
|
14
|
+
return n.filter(Boolean).join(" ");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return typeof
|
|
16
|
+
function te(n) {
|
|
17
|
+
return typeof n.label == "string" || typeof n.label == "number" ? String(n.label) : String(n.value);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const label = isTextLabel ? String(option.label) : option.label;
|
|
25
|
-
function handleMouseEnter() {
|
|
26
|
-
const element = labelRef.current;
|
|
27
|
-
if (isTextLabel && element && element.scrollWidth > element.clientWidth) {
|
|
28
|
-
setAnchorRect(element.getBoundingClientRect());
|
|
29
|
-
setVisible(true);
|
|
30
|
-
}
|
|
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));
|
|
31
24
|
}
|
|
32
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
33
26
|
"span",
|
|
34
27
|
{
|
|
35
|
-
ref:
|
|
28
|
+
ref: d,
|
|
36
29
|
className: "bj-dropdown__option-label",
|
|
37
|
-
onMouseEnter:
|
|
38
|
-
onMouseLeave: () =>
|
|
30
|
+
onMouseEnter: f,
|
|
31
|
+
onMouseLeave: () => i(!1),
|
|
39
32
|
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
33
|
+
m,
|
|
34
|
+
p && o && typeof document < "u" && Y(
|
|
35
|
+
/* @__PURE__ */ l(
|
|
43
36
|
"span",
|
|
44
37
|
{
|
|
45
38
|
className: "bj-dropdown__option-tooltip-anchor",
|
|
46
39
|
style: {
|
|
47
40
|
position: "fixed",
|
|
48
|
-
top:
|
|
49
|
-
left:
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
41
|
+
top: o.top,
|
|
42
|
+
left: o.left,
|
|
43
|
+
width: o.width,
|
|
44
|
+
height: o.height
|
|
52
45
|
},
|
|
53
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ l(le, { className: "bj-dropdown__option-tooltip", content: m, placement: "top" })
|
|
54
47
|
}
|
|
55
48
|
),
|
|
56
49
|
document.body
|
|
@@ -59,128 +52,109 @@ function TruncatedOptionLabel({ option }) {
|
|
|
59
52
|
}
|
|
60
53
|
);
|
|
61
54
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
] });
|
|
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 });
|
|
68
60
|
}
|
|
69
|
-
function
|
|
70
|
-
className,
|
|
71
|
-
style,
|
|
72
|
-
options,
|
|
73
|
-
value,
|
|
74
|
-
defaultValue = [],
|
|
75
|
-
multiple =
|
|
76
|
-
optionMode = "single-line",
|
|
77
|
-
searchable =
|
|
78
|
-
searchValue,
|
|
79
|
-
searchPlaceholder = "搜索",
|
|
80
|
-
onSearch,
|
|
81
|
-
filterOption =
|
|
82
|
-
emptyText,
|
|
83
|
-
labels,
|
|
84
|
-
t = (
|
|
85
|
-
optionRender,
|
|
86
|
-
onChange,
|
|
87
|
-
footer =
|
|
88
|
-
showReset =
|
|
89
|
-
showConfirm =
|
|
90
|
-
resetText =
|
|
91
|
-
confirmText =
|
|
92
|
-
onReset,
|
|
93
|
-
onConfirm
|
|
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
|
|
94
86
|
}) {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const [internalSearchValue, setInternalSearchValue] = useState("");
|
|
99
|
-
const selectedValue = value ?? internalValue;
|
|
100
|
-
const isMultiple = multiple === true;
|
|
101
|
-
const isDoubleLine = optionMode === "double-line";
|
|
102
|
-
const currentSearchValue = searchValue ?? internalSearchValue;
|
|
103
|
-
const resolvedEmptyText = emptyText ?? (labels == null ? void 0 : labels.emptyText) ?? t("暂无结果");
|
|
104
|
-
const visibleOptions = !onSearch && filterOption !== false && currentSearchValue ? options.filter((option) => typeof filterOption === "function" ? filterOption(currentSearchValue, option) : getOptionText(option).toLocaleLowerCase().includes(currentSearchValue.toLocaleLowerCase())) : options;
|
|
105
|
-
function updateValue(nextValue, option) {
|
|
106
|
-
if (value === void 0) {
|
|
107
|
-
setInternalValue(nextValue);
|
|
108
|
-
}
|
|
109
|
-
onChange == null ? void 0 : onChange(nextValue, option);
|
|
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);
|
|
110
90
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
setInternalSearchValue(nextSearchValue);
|
|
114
|
-
}
|
|
115
|
-
onSearch == null ? void 0 : onSearch(nextSearchValue);
|
|
91
|
+
function O(e) {
|
|
92
|
+
f === void 0 && J(e), _ == null || _(e);
|
|
116
93
|
}
|
|
117
|
-
function
|
|
118
|
-
if (
|
|
119
|
-
const
|
|
120
|
-
|
|
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);
|
|
121
98
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
124
|
-
setInternalValue([]);
|
|
125
|
-
}
|
|
126
|
-
onReset == null ? void 0 : onReset();
|
|
99
|
+
function U() {
|
|
100
|
+
i === void 0 && E([]), k == null || k();
|
|
127
101
|
}
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
|
|
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,
|
|
131
105
|
{
|
|
132
106
|
"aria-label": "搜索选项",
|
|
133
|
-
allowClear: { clearIcon: /* @__PURE__ */
|
|
134
|
-
onChange: (
|
|
135
|
-
onClear: () =>
|
|
136
|
-
placeholder:
|
|
137
|
-
prefix: /* @__PURE__ */
|
|
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" }),
|
|
138
112
|
inputMode: "search",
|
|
139
113
|
role: "searchbox",
|
|
140
114
|
type: "text",
|
|
141
|
-
value:
|
|
115
|
+
value: v
|
|
142
116
|
}
|
|
143
117
|
) }),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
146
|
-
|
|
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
|
+
$,
|
|
147
121
|
{
|
|
148
|
-
checked:
|
|
149
|
-
className:
|
|
150
|
-
disabled:
|
|
151
|
-
onChange: () =>
|
|
152
|
-
skipGroup:
|
|
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,
|
|
153
127
|
variant: "white",
|
|
154
|
-
children:
|
|
128
|
+
children: h ? h(e) : /* @__PURE__ */ l(W, { doubleLine: c && e.description !== void 0, option: e })
|
|
155
129
|
},
|
|
156
|
-
String(
|
|
157
|
-
) : /* @__PURE__ */
|
|
130
|
+
String(e.value)
|
|
131
|
+
) : /* @__PURE__ */ r(
|
|
158
132
|
"button",
|
|
159
133
|
{
|
|
160
|
-
"aria-pressed":
|
|
161
|
-
className:
|
|
162
|
-
disabled:
|
|
163
|
-
onClick: () =>
|
|
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),
|
|
164
138
|
type: "button",
|
|
165
139
|
children: [
|
|
166
|
-
|
|
167
|
-
|
|
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" })
|
|
168
142
|
]
|
|
169
143
|
},
|
|
170
|
-
String(
|
|
144
|
+
String(e.value)
|
|
171
145
|
)),
|
|
172
|
-
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
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 })
|
|
175
149
|
] })
|
|
176
150
|
] }),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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 })
|
|
181
155
|
] }))
|
|
182
156
|
] });
|
|
183
157
|
}
|
|
184
158
|
export {
|
|
185
|
-
BDropdown
|
|
159
|
+
_e as BDropdown
|
|
186
160
|
};
|
|
@@ -1,77 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
|
-
;/* empty css */
|
|
5
|
-
function DeleteIcon() {
|
|
6
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.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" }) });
|
|
7
|
-
}
|
|
8
|
-
const BuEmptyInputBox = react.forwardRef(
|
|
9
|
-
function BuEmptyInputBox2({
|
|
10
|
-
mode = "single",
|
|
11
|
-
activeLang = "zh",
|
|
12
|
-
onLangChange,
|
|
13
|
-
value = "",
|
|
14
|
-
onChange,
|
|
15
|
-
placeholder,
|
|
16
|
-
maxLength,
|
|
17
|
-
error = false,
|
|
18
|
-
disabled,
|
|
19
|
-
onDelete,
|
|
20
|
-
labels,
|
|
21
|
-
id,
|
|
22
|
-
className,
|
|
23
|
-
style
|
|
24
|
-
}, ref) {
|
|
25
|
-
const zhLabel = (labels == null ? void 0 : labels.zh) ?? "中文";
|
|
26
|
-
const enLabel = (labels == null ? void 0 : labels.en) ?? "EN";
|
|
27
|
-
const hasBilingual = mode === "bilingual";
|
|
28
|
-
const hasDelete = !!onDelete;
|
|
29
|
-
const boxCls = [
|
|
30
|
-
"bu-eib__box",
|
|
31
|
-
hasBilingual && hasDelete && "bu-eib__box--actions-both",
|
|
32
|
-
hasBilingual && !hasDelete && "bu-eib__box--actions-toggle",
|
|
33
|
-
!hasBilingual && hasDelete && "bu-eib__box--actions-delete",
|
|
34
|
-
error && "bu-eib__box--error",
|
|
35
|
-
disabled && "bu-eib__box--disabled"
|
|
36
|
-
].filter(Boolean).join(" ");
|
|
37
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ["bu-eib", className].filter(Boolean).join(" "), style, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: boxCls, children: [
|
|
38
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
-
"input",
|
|
40
|
-
{
|
|
41
|
-
ref,
|
|
42
|
-
id,
|
|
43
|
-
className: "bu-eib__field",
|
|
44
|
-
value,
|
|
45
|
-
onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
|
|
46
|
-
placeholder,
|
|
47
|
-
maxLength,
|
|
48
|
-
disabled
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
(hasBilingual || hasDelete) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bu-eib__actions", children: [
|
|
52
|
-
hasBilingual && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bu-eib__lang-toggle", children: [
|
|
53
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
"button",
|
|
55
|
-
{
|
|
56
|
-
type: "button",
|
|
57
|
-
className: `bu-eib__lang-btn${activeLang === "zh" ? " bu-eib__lang-btn--active" : ""}`,
|
|
58
|
-
onClick: () => onLangChange == null ? void 0 : onLangChange("zh"),
|
|
59
|
-
children: zhLabel
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
-
"button",
|
|
64
|
-
{
|
|
65
|
-
type: "button",
|
|
66
|
-
className: `bu-eib__lang-btn${activeLang === "en" ? " bu-eib__lang-btn--active" : ""}`,
|
|
67
|
-
onClick: () => onLangChange == null ? void 0 : onLangChange("en"),
|
|
68
|
-
children: enLabel
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }),
|
|
72
|
-
hasDelete && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "bu-eib__delete", onClick: onDelete, children: /* @__PURE__ */ jsxRuntime.jsx(DeleteIcon, {}) })
|
|
73
|
-
] })
|
|
74
|
-
] }) });
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
module.exports = BuEmptyInputBox;
|
|
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;
|
|
@@ -1,78 +1,74 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
1
|
+
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N } from "react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
4
|
+
function B() {
|
|
5
|
+
return /* @__PURE__ */ t("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("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" }) });
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
mode = "single",
|
|
10
|
-
activeLang = "zh",
|
|
11
|
-
onLangChange,
|
|
12
|
-
value = "",
|
|
13
|
-
onChange,
|
|
14
|
-
placeholder,
|
|
15
|
-
maxLength,
|
|
16
|
-
error =
|
|
17
|
-
disabled,
|
|
18
|
-
onDelete,
|
|
19
|
-
labels,
|
|
20
|
-
id,
|
|
21
|
-
className,
|
|
22
|
-
style
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
const enLabel = (labels == null ? void 0 : labels.en) ?? "EN";
|
|
26
|
-
const hasBilingual = mode === "bilingual";
|
|
27
|
-
const hasDelete = !!onDelete;
|
|
28
|
-
const boxCls = [
|
|
7
|
+
const Z = N(
|
|
8
|
+
function({
|
|
9
|
+
mode: _ = "single",
|
|
10
|
+
activeLang: l = "zh",
|
|
11
|
+
onLangChange: i,
|
|
12
|
+
value: n = "",
|
|
13
|
+
onChange: u,
|
|
14
|
+
placeholder: d,
|
|
15
|
+
maxLength: m,
|
|
16
|
+
error: p = !1,
|
|
17
|
+
disabled: r,
|
|
18
|
+
onDelete: s,
|
|
19
|
+
labels: e,
|
|
20
|
+
id: x,
|
|
21
|
+
className: f,
|
|
22
|
+
style: C
|
|
23
|
+
}, V) {
|
|
24
|
+
const a = (e == null ? void 0 : e.zh) ?? "中文", H = (e == null ? void 0 : e.en) ?? "EN", b = _ === "bilingual", o = !!s, h = [
|
|
29
25
|
"bu-eib__box",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
!
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
b && o && "bu-eib__box--actions-both",
|
|
27
|
+
b && !o && "bu-eib__box--actions-toggle",
|
|
28
|
+
!b && o && "bu-eib__box--actions-delete",
|
|
29
|
+
p && "bu-eib__box--error",
|
|
30
|
+
r && "bu-eib__box--disabled"
|
|
35
31
|
].filter(Boolean).join(" ");
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ t("div", { className: ["bu-eib", f].filter(Boolean).join(" "), style: C, children: /* @__PURE__ */ c("div", { className: h, children: [
|
|
33
|
+
/* @__PURE__ */ t(
|
|
38
34
|
"input",
|
|
39
35
|
{
|
|
40
|
-
ref,
|
|
41
|
-
id,
|
|
36
|
+
ref: V,
|
|
37
|
+
id: x,
|
|
42
38
|
className: "bu-eib__field",
|
|
43
|
-
value,
|
|
44
|
-
onChange: (
|
|
45
|
-
placeholder,
|
|
46
|
-
maxLength,
|
|
47
|
-
disabled
|
|
39
|
+
value: n,
|
|
40
|
+
onChange: (v) => u == null ? void 0 : u(v.target.value),
|
|
41
|
+
placeholder: d,
|
|
42
|
+
maxLength: m,
|
|
43
|
+
disabled: r
|
|
48
44
|
}
|
|
49
45
|
),
|
|
50
|
-
(
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */
|
|
46
|
+
(b || o) && /* @__PURE__ */ c("div", { className: "bu-eib__actions", children: [
|
|
47
|
+
b && /* @__PURE__ */ c("div", { className: "bu-eib__lang-toggle", children: [
|
|
48
|
+
/* @__PURE__ */ t(
|
|
53
49
|
"button",
|
|
54
50
|
{
|
|
55
51
|
type: "button",
|
|
56
|
-
className: `bu-eib__lang-btn${
|
|
57
|
-
onClick: () =>
|
|
58
|
-
children:
|
|
52
|
+
className: `bu-eib__lang-btn${l === "zh" ? " bu-eib__lang-btn--active" : ""}`,
|
|
53
|
+
onClick: () => i == null ? void 0 : i("zh"),
|
|
54
|
+
children: a
|
|
59
55
|
}
|
|
60
56
|
),
|
|
61
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ t(
|
|
62
58
|
"button",
|
|
63
59
|
{
|
|
64
60
|
type: "button",
|
|
65
|
-
className: `bu-eib__lang-btn${
|
|
66
|
-
onClick: () =>
|
|
67
|
-
children:
|
|
61
|
+
className: `bu-eib__lang-btn${l === "en" ? " bu-eib__lang-btn--active" : ""}`,
|
|
62
|
+
onClick: () => i == null ? void 0 : i("en"),
|
|
63
|
+
children: H
|
|
68
64
|
}
|
|
69
65
|
)
|
|
70
66
|
] }),
|
|
71
|
-
|
|
67
|
+
o && /* @__PURE__ */ t("button", { type: "button", className: "bu-eib__delete", onClick: s, children: /* @__PURE__ */ t(B, {}) })
|
|
72
68
|
] })
|
|
73
69
|
] }) });
|
|
74
70
|
}
|
|
75
71
|
);
|
|
76
72
|
export {
|
|
77
|
-
|
|
73
|
+
Z as default
|
|
78
74
|
};
|