bj-web-components 0.2.27 → 0.2.28
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 +51 -1
- package/dist/index.mjs +49 -49
- package/dist/style.css +3744 -1
- package/dist/web/BasicInput/BInput.js +208 -1
- package/dist/web/BasicInput/BInput.mjs +164 -132
- package/dist/web/BasicInput/utils.js +47 -1
- package/dist/web/BasicInput/utils.mjs +38 -28
- package/dist/web/CategoryDropdown/CategoryDropdown.js +307 -1
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +218 -170
- package/dist/web/CheckBox/BCheckBox.js +116 -1
- package/dist/web/CheckBox/BCheckBox.mjs +86 -70
- package/dist/web/CheckBox/Group.js +73 -1
- package/dist/web/CheckBox/Group.mjs +63 -56
- package/dist/web/CheckBox/context.js +5 -1
- package/dist/web/CheckBox/context.mjs +3 -3
- package/dist/web/CheckBox/index.js +8 -1
- package/dist/web/CheckBox/index.mjs +6 -6
- package/dist/web/Dropdown/BDropdown.js +186 -1
- package/dist/web/Dropdown/BDropdown.mjs +132 -106
- package/dist/web/EmptyInputBox/EmptyInputBox.js +77 -1
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +52 -48
- package/dist/web/FileCard/FileCard.js +157 -1
- package/dist/web/FileCard/FileCard.mjs +112 -82
- package/dist/web/Icon/Icon.js +9 -1
- package/dist/web/Icon/Icon.mjs +6 -6
- package/dist/web/Input/Input.js +181 -1
- package/dist/web/Input/Input.mjs +122 -113
- package/dist/web/InputNumber/BInputNumber.js +311 -1
- package/dist/web/InputNumber/BInputNumber.mjs +275 -167
- package/dist/web/InputNumber/StepHandler.js +69 -1
- package/dist/web/InputNumber/StepHandler.mjs +38 -32
- package/dist/web/InputNumber/hooks/useCursor.js +40 -1
- package/dist/web/InputNumber/hooks/useCursor.mjs +35 -33
- package/dist/web/InputNumber/hooks/useFrame.js +12 -1
- package/dist/web/InputNumber/hooks/useFrame.mjs +9 -6
- package/dist/web/InputNumber/utils/decimal.js +147 -1
- package/dist/web/InputNumber/utils/decimal.mjs +109 -81
- package/dist/web/Modal/Modal.js +84 -1
- package/dist/web/Modal/Modal.mjs +52 -49
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +232 -1
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +206 -125
- package/dist/web/Pagination/Pagination.js +328 -1
- package/dist/web/Pagination/Pagination.mjs +254 -178
- package/dist/web/ProductField/ProductField.js +272 -1
- package/dist/web/ProductField/ProductField.mjs +190 -143
- package/dist/web/ProductField/arrow-up.svg.js +3 -1
- package/dist/web/ProductField/arrow-up.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-no.svg.js +3 -1
- package/dist/web/ProductField/checkbox-no.svg.mjs +2 -2
- package/dist/web/ProductField/checkbox-ok.svg.js +3 -1
- package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -2
- package/dist/web/ProductField/no_data_light.svg.js +3 -1
- package/dist/web/ProductField/no_data_light.svg.mjs +2 -2
- package/dist/web/ProductField/search.svg.js +3 -1
- package/dist/web/ProductField/search.svg.mjs +2 -2
- package/dist/web/ProductField/sort.svg.js +3 -1
- package/dist/web/ProductField/sort.svg.mjs +2 -2
- package/dist/web/SkuInputCard/SkuInputCard.js +276 -1
- package/dist/web/SkuInputCard/SkuInputCard.mjs +188 -149
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +3 -1
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -2
- package/dist/web/Switch/Switch.js +70 -1
- package/dist/web/Switch/Switch.mjs +47 -37
- package/dist/web/Table/BTable.js +950 -1
- package/dist/web/Table/BTable.mjs +771 -519
- package/dist/web/Table/Column.js +5 -1
- package/dist/web/Table/Column.mjs +2 -2
- package/dist/web/Table/ColumnGroup.js +5 -1
- package/dist/web/Table/ColumnGroup.mjs +2 -2
- package/dist/web/Table/utils/columns.js +48 -1
- package/dist/web/Table/utils/columns.mjs +35 -30
- package/dist/web/Table/utils/sortFilter.js +84 -1
- package/dist/web/Table/utils/sortFilter.mjs +73 -52
- package/dist/web/Tabs/BTabs.js +150 -1
- package/dist/web/Tabs/BTabs.mjs +118 -98
- package/dist/web/Tabs/TabPane.js +8 -1
- package/dist/web/Tabs/TabPane.mjs +4 -4
- package/dist/web/Tooltip/ConfirmTooltip.js +26 -1
- package/dist/web/Tooltip/ConfirmTooltip.mjs +20 -19
- package/dist/web/Tooltip/ContentTooltip.js +94 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +72 -62
- package/dist/web/Tooltip/ProgressTooltip.js +36 -1
- package/dist/web/Tooltip/ProgressTooltip.mjs +22 -20
- package/dist/web/Tooltip/TooltipWrapper.js +12 -1
- package/dist/web/Tooltip/TooltipWrapper.mjs +8 -8
- package/dist/web/Tooltip/useAutoPlacement.js +41 -1
- package/dist/web/Tooltip/useAutoPlacement.mjs +34 -25
- package/dist/web.js +51 -1
- package/dist/web.mjs +49 -49
- package/package.json +1 -1
|
@@ -1,49 +1,56 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { useRef
|
|
3
|
-
import { createPortal
|
|
4
|
-
import
|
|
5
|
-
import { BCheckBox as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import BInput from "../BasicInput/BInput.mjs";
|
|
5
|
+
import { BCheckBox as CompoundBCheckBox } from "../CheckBox/index.mjs";
|
|
6
|
+
import BuIcon from "../Icon/Icon.mjs";
|
|
7
|
+
import BOverlayScrollbar from "../OverlayScrollbar/BOverlayScrollbar.mjs";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import
|
|
9
|
+
import BTooltip from "../Tooltip/ContentTooltip.mjs";
|
|
10
10
|
import "../Tooltip/TooltipWrapper.mjs";
|
|
11
|
-
import
|
|
11
|
+
import defaultEmptyImage from "../ProductField/no_data_light.svg.mjs";
|
|
12
12
|
/* empty css */
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function classNames(...values) {
|
|
14
|
+
return values.filter(Boolean).join(" ");
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return typeof
|
|
16
|
+
function getOptionText(option) {
|
|
17
|
+
return typeof option.label === "string" || typeof option.label === "number" ? String(option.label) : String(option.value);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
function TruncatedOptionLabel({ option }) {
|
|
20
|
+
const labelRef = useRef(null);
|
|
21
|
+
const [visible, setVisible] = useState(false);
|
|
22
|
+
const [anchorRect, setAnchorRect] = useState(null);
|
|
23
|
+
const isTextLabel = typeof option.label === "string" || typeof option.label === "number";
|
|
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
|
+
}
|
|
24
31
|
}
|
|
25
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
26
33
|
"span",
|
|
27
34
|
{
|
|
28
|
-
ref:
|
|
35
|
+
ref: labelRef,
|
|
29
36
|
className: "bj-dropdown__option-label",
|
|
30
|
-
onMouseEnter:
|
|
31
|
-
onMouseLeave: () =>
|
|
37
|
+
onMouseEnter: handleMouseEnter,
|
|
38
|
+
onMouseLeave: () => setVisible(false),
|
|
32
39
|
children: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
40
|
+
label,
|
|
41
|
+
visible && anchorRect && typeof document !== "undefined" && createPortal(
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
36
43
|
"span",
|
|
37
44
|
{
|
|
38
45
|
className: "bj-dropdown__option-tooltip-anchor",
|
|
39
46
|
style: {
|
|
40
47
|
position: "fixed",
|
|
41
|
-
top:
|
|
42
|
-
left:
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
48
|
+
top: anchorRect.top,
|
|
49
|
+
left: anchorRect.left,
|
|
50
|
+
width: anchorRect.width,
|
|
51
|
+
height: anchorRect.height
|
|
45
52
|
},
|
|
46
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ jsx(BTooltip, { className: "bj-dropdown__option-tooltip", content: label, placement: "top" })
|
|
47
54
|
}
|
|
48
55
|
),
|
|
49
56
|
document.body
|
|
@@ -52,109 +59,128 @@ function R({ option: n }) {
|
|
|
52
59
|
}
|
|
53
60
|
);
|
|
54
61
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
function DefaultOptionContent({ option, doubleLine }) {
|
|
63
|
+
if (!doubleLine) return /* @__PURE__ */ jsx(TruncatedOptionLabel, { option });
|
|
64
|
+
return /* @__PURE__ */ jsxs("span", { className: "bj-dropdown__option-content", children: [
|
|
65
|
+
/* @__PURE__ */ jsx(TruncatedOptionLabel, { option }),
|
|
66
|
+
option.description !== void 0 && /* @__PURE__ */ jsx("span", { className: "bj-dropdown__option-description", children: option.description })
|
|
67
|
+
] });
|
|
60
68
|
}
|
|
61
|
-
function
|
|
62
|
-
className
|
|
63
|
-
style
|
|
64
|
-
options
|
|
65
|
-
value
|
|
66
|
-
defaultValue
|
|
67
|
-
multiple
|
|
68
|
-
optionMode
|
|
69
|
-
searchable
|
|
70
|
-
searchValue
|
|
71
|
-
searchPlaceholder
|
|
72
|
-
onSearch
|
|
73
|
-
filterOption
|
|
74
|
-
emptyText
|
|
75
|
-
labels
|
|
76
|
-
t
|
|
77
|
-
optionRender
|
|
78
|
-
onChange
|
|
79
|
-
footer
|
|
80
|
-
showReset
|
|
81
|
-
showConfirm
|
|
82
|
-
resetText
|
|
83
|
-
confirmText
|
|
84
|
-
onReset
|
|
85
|
-
onConfirm
|
|
69
|
+
function BDropdown({
|
|
70
|
+
className,
|
|
71
|
+
style,
|
|
72
|
+
options,
|
|
73
|
+
value,
|
|
74
|
+
defaultValue = [],
|
|
75
|
+
multiple = false,
|
|
76
|
+
optionMode = "single-line",
|
|
77
|
+
searchable = false,
|
|
78
|
+
searchValue,
|
|
79
|
+
searchPlaceholder = "搜索",
|
|
80
|
+
onSearch,
|
|
81
|
+
filterOption = true,
|
|
82
|
+
emptyText,
|
|
83
|
+
labels,
|
|
84
|
+
t = (text) => text,
|
|
85
|
+
optionRender,
|
|
86
|
+
onChange,
|
|
87
|
+
footer = true,
|
|
88
|
+
showReset = true,
|
|
89
|
+
showConfirm = true,
|
|
90
|
+
resetText = t("重置"),
|
|
91
|
+
confirmText = t("确定"),
|
|
92
|
+
onReset,
|
|
93
|
+
onConfirm
|
|
86
94
|
}) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
const dropdownRef = useRef(null);
|
|
96
|
+
const optionsRef = useRef(null);
|
|
97
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
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);
|
|
90
110
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
111
|
+
function handleSearch(nextSearchValue) {
|
|
112
|
+
if (searchValue === void 0) {
|
|
113
|
+
setInternalSearchValue(nextSearchValue);
|
|
114
|
+
}
|
|
115
|
+
onSearch == null ? void 0 : onSearch(nextSearchValue);
|
|
93
116
|
}
|
|
94
|
-
function
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
117
|
+
function handleOptionChange(option) {
|
|
118
|
+
if (option.disabled) return;
|
|
119
|
+
const nextValue = isMultiple ? selectedValue.includes(option.value) ? selectedValue.filter((item) => item !== option.value) : [...selectedValue, option.value] : [option.value];
|
|
120
|
+
updateValue(nextValue, option);
|
|
98
121
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
122
|
+
function handleReset() {
|
|
123
|
+
if (value === void 0) {
|
|
124
|
+
setInternalValue([]);
|
|
125
|
+
}
|
|
126
|
+
onReset == null ? void 0 : onReset();
|
|
101
127
|
}
|
|
102
|
-
return /* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: classNames("bj-dropdown", isDoubleLine && "bj-dropdown--double-line", !isMultiple && "bj-dropdown--single", className), role: "dialog", style, children: [
|
|
129
|
+
searchable && /* @__PURE__ */ jsx("div", { className: "bj-dropdown__search", children: /* @__PURE__ */ jsx(
|
|
130
|
+
BInput,
|
|
105
131
|
{
|
|
106
132
|
"aria-label": "搜索选项",
|
|
107
|
-
allowClear: { clearIcon: /* @__PURE__ */
|
|
108
|
-
onChange: (
|
|
109
|
-
onClear: () =>
|
|
110
|
-
placeholder:
|
|
111
|
-
prefix: /* @__PURE__ */
|
|
133
|
+
allowClear: { clearIcon: /* @__PURE__ */ jsx(BuIcon, { className: "bj-dropdown__search-clear-icon", type: "icon-a-guanbixi" }) },
|
|
134
|
+
onChange: (event) => handleSearch(event.target.value),
|
|
135
|
+
onClear: () => handleSearch(""),
|
|
136
|
+
placeholder: searchPlaceholder,
|
|
137
|
+
prefix: /* @__PURE__ */ jsx(BuIcon, { type: "icon-a-sousuoxi" }),
|
|
112
138
|
inputMode: "search",
|
|
113
139
|
role: "searchbox",
|
|
114
140
|
type: "text",
|
|
115
|
-
value:
|
|
141
|
+
value: currentSearchValue
|
|
116
142
|
}
|
|
117
143
|
) }),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
|
|
144
|
+
/* @__PURE__ */ jsxs("div", { ref: optionsRef, className: classNames("bj-dropdown__options", "bj-overlay-scrollbar-hidden", visibleOptions.length === 0 && "bj-dropdown__options--empty", !isMultiple && "bj-dropdown__options--single"), children: [
|
|
145
|
+
visibleOptions.map((option) => isMultiple ? /* @__PURE__ */ jsx(
|
|
146
|
+
CompoundBCheckBox,
|
|
121
147
|
{
|
|
122
|
-
checked:
|
|
123
|
-
className:
|
|
124
|
-
disabled:
|
|
125
|
-
onChange: () =>
|
|
126
|
-
skipGroup:
|
|
148
|
+
checked: selectedValue.includes(option.value),
|
|
149
|
+
className: classNames("bj-dropdown__option", isDoubleLine && option.description !== void 0 && "bj-dropdown__option--double-line"),
|
|
150
|
+
disabled: option.disabled,
|
|
151
|
+
onChange: () => handleOptionChange(option),
|
|
152
|
+
skipGroup: true,
|
|
127
153
|
variant: "white",
|
|
128
|
-
children:
|
|
154
|
+
children: optionRender ? optionRender(option) : /* @__PURE__ */ jsx(DefaultOptionContent, { doubleLine: isDoubleLine && option.description !== void 0, option })
|
|
129
155
|
},
|
|
130
|
-
String(
|
|
131
|
-
) : /* @__PURE__ */
|
|
156
|
+
String(option.value)
|
|
157
|
+
) : /* @__PURE__ */ jsxs(
|
|
132
158
|
"button",
|
|
133
159
|
{
|
|
134
|
-
"aria-pressed":
|
|
135
|
-
className:
|
|
136
|
-
disabled:
|
|
137
|
-
onClick: () =>
|
|
160
|
+
"aria-pressed": selectedValue.includes(option.value),
|
|
161
|
+
className: classNames("bj-dropdown__option", "bj-dropdown__option--single", isDoubleLine && option.description !== void 0 && "bj-dropdown__option--double-line", selectedValue.includes(option.value) && "bj-dropdown__option--selected"),
|
|
162
|
+
disabled: option.disabled,
|
|
163
|
+
onClick: () => handleOptionChange(option),
|
|
138
164
|
type: "button",
|
|
139
165
|
children: [
|
|
140
|
-
|
|
141
|
-
|
|
166
|
+
optionRender ? /* @__PURE__ */ jsx("span", { className: "bj-dropdown__option-label", children: optionRender(option) }) : /* @__PURE__ */ jsx(DefaultOptionContent, { doubleLine: isDoubleLine && option.description !== void 0, option }),
|
|
167
|
+
selectedValue.includes(option.value) && /* @__PURE__ */ jsx(BuIcon, { className: "bj-dropdown__option-icon", type: "icon-a-dagouxi" })
|
|
142
168
|
]
|
|
143
169
|
},
|
|
144
|
-
String(
|
|
170
|
+
String(option.value)
|
|
145
171
|
)),
|
|
146
|
-
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
172
|
+
visibleOptions.length === 0 && /* @__PURE__ */ jsxs("div", { className: "bj-dropdown__empty", children: [
|
|
173
|
+
/* @__PURE__ */ jsx("img", { alt: "", className: "bj-dropdown__empty-image", src: defaultEmptyImage }),
|
|
174
|
+
/* @__PURE__ */ jsx("span", { className: "bj-dropdown__empty-text", children: resolvedEmptyText })
|
|
149
175
|
] })
|
|
150
176
|
] }),
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
177
|
+
/* @__PURE__ */ jsx(BOverlayScrollbar, { containerRef: dropdownRef, gap: 2, size: 2, targetRef: optionsRef }),
|
|
178
|
+
footer !== false && (footer !== true ? footer : /* @__PURE__ */ jsxs("div", { className: classNames("bj-dropdown__actions", !isMultiple && "bj-dropdown__actions--single"), children: [
|
|
179
|
+
showReset && /* @__PURE__ */ jsx("button", { onClick: handleReset, type: "button", children: resetText }),
|
|
180
|
+
isMultiple && showConfirm && /* @__PURE__ */ jsx("button", { onClick: () => onConfirm == null ? void 0 : onConfirm(selectedValue), type: "button", children: confirmText })
|
|
155
181
|
] }))
|
|
156
182
|
] });
|
|
157
183
|
}
|
|
158
184
|
export {
|
|
159
|
-
|
|
185
|
+
BDropdown
|
|
160
186
|
};
|
|
@@ -1 +1,77 @@
|
|
|
1
|
-
"use strict";
|
|
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,74 +1,78 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { forwardRef
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
4
|
+
function DeleteIcon() {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ 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" }) });
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function({
|
|
9
|
-
mode
|
|
10
|
-
activeLang
|
|
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
|
|
7
|
+
const BuEmptyInputBox = forwardRef(
|
|
8
|
+
function BuEmptyInputBox2({
|
|
9
|
+
mode = "single",
|
|
10
|
+
activeLang = "zh",
|
|
11
|
+
onLangChange,
|
|
12
|
+
value = "",
|
|
13
|
+
onChange,
|
|
14
|
+
placeholder,
|
|
15
|
+
maxLength,
|
|
16
|
+
error = false,
|
|
17
|
+
disabled,
|
|
18
|
+
onDelete,
|
|
19
|
+
labels,
|
|
20
|
+
id,
|
|
21
|
+
className,
|
|
22
|
+
style
|
|
23
|
+
}, ref) {
|
|
24
|
+
const zhLabel = (labels == null ? void 0 : labels.zh) ?? "中文";
|
|
25
|
+
const enLabel = (labels == null ? void 0 : labels.en) ?? "EN";
|
|
26
|
+
const hasBilingual = mode === "bilingual";
|
|
27
|
+
const hasDelete = !!onDelete;
|
|
28
|
+
const boxCls = [
|
|
25
29
|
"bu-eib__box",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
!
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
hasBilingual && hasDelete && "bu-eib__box--actions-both",
|
|
31
|
+
hasBilingual && !hasDelete && "bu-eib__box--actions-toggle",
|
|
32
|
+
!hasBilingual && hasDelete && "bu-eib__box--actions-delete",
|
|
33
|
+
error && "bu-eib__box--error",
|
|
34
|
+
disabled && "bu-eib__box--disabled"
|
|
31
35
|
].filter(Boolean).join(" ");
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: ["bu-eib", className].filter(Boolean).join(" "), style, children: /* @__PURE__ */ jsxs("div", { className: boxCls, children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
34
38
|
"input",
|
|
35
39
|
{
|
|
36
|
-
ref
|
|
37
|
-
id
|
|
40
|
+
ref,
|
|
41
|
+
id,
|
|
38
42
|
className: "bu-eib__field",
|
|
39
|
-
value
|
|
40
|
-
onChange: (
|
|
41
|
-
placeholder
|
|
42
|
-
maxLength
|
|
43
|
-
disabled
|
|
43
|
+
value,
|
|
44
|
+
onChange: (e) => onChange == null ? void 0 : onChange(e.target.value),
|
|
45
|
+
placeholder,
|
|
46
|
+
maxLength,
|
|
47
|
+
disabled
|
|
44
48
|
}
|
|
45
49
|
),
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */
|
|
50
|
+
(hasBilingual || hasDelete) && /* @__PURE__ */ jsxs("div", { className: "bu-eib__actions", children: [
|
|
51
|
+
hasBilingual && /* @__PURE__ */ jsxs("div", { className: "bu-eib__lang-toggle", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
49
53
|
"button",
|
|
50
54
|
{
|
|
51
55
|
type: "button",
|
|
52
|
-
className: `bu-eib__lang-btn${
|
|
53
|
-
onClick: () =>
|
|
54
|
-
children:
|
|
56
|
+
className: `bu-eib__lang-btn${activeLang === "zh" ? " bu-eib__lang-btn--active" : ""}`,
|
|
57
|
+
onClick: () => onLangChange == null ? void 0 : onLangChange("zh"),
|
|
58
|
+
children: zhLabel
|
|
55
59
|
}
|
|
56
60
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
58
62
|
"button",
|
|
59
63
|
{
|
|
60
64
|
type: "button",
|
|
61
|
-
className: `bu-eib__lang-btn${
|
|
62
|
-
onClick: () =>
|
|
63
|
-
children:
|
|
65
|
+
className: `bu-eib__lang-btn${activeLang === "en" ? " bu-eib__lang-btn--active" : ""}`,
|
|
66
|
+
onClick: () => onLangChange == null ? void 0 : onLangChange("en"),
|
|
67
|
+
children: enLabel
|
|
64
68
|
}
|
|
65
69
|
)
|
|
66
70
|
] }),
|
|
67
|
-
|
|
71
|
+
hasDelete && /* @__PURE__ */ jsx("button", { type: "button", className: "bu-eib__delete", onClick: onDelete, children: /* @__PURE__ */ jsx(DeleteIcon, {}) })
|
|
68
72
|
] })
|
|
69
73
|
] }) });
|
|
70
74
|
}
|
|
71
75
|
);
|
|
72
76
|
export {
|
|
73
|
-
|
|
77
|
+
BuEmptyInputBox as default
|
|
74
78
|
};
|