bj-web-components 0.2.26 → 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/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 +51 -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 +3744 -0
- package/dist/vercel.svg +1 -0
- package/dist/web/BasicInput/BInput.js +208 -0
- package/dist/web/BasicInput/BInput.mjs +209 -0
- package/dist/web/BasicInput/utils.js +47 -0
- package/dist/web/BasicInput/utils.mjs +47 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.js +307 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +308 -0
- package/dist/web/CheckBox/BCheckBox.js +116 -0
- package/dist/web/CheckBox/BCheckBox.mjs +117 -0
- package/dist/web/CheckBox/Group.js +73 -0
- package/dist/web/CheckBox/Group.mjs +74 -0
- package/dist/web/CheckBox/context.js +5 -0
- package/dist/web/CheckBox/context.mjs +5 -0
- package/dist/web/CheckBox/index.js +8 -0
- package/dist/web/CheckBox/index.mjs +8 -0
- package/dist/web/Dropdown/BDropdown.js +186 -0
- package/dist/web/Dropdown/BDropdown.mjs +186 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.js +77 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +78 -0
- package/dist/web/FileCard/FileCard.js +157 -0
- package/dist/web/FileCard/FileCard.mjs +158 -0
- package/dist/web/Icon/Icon.js +9 -0
- package/dist/web/Icon/Icon.mjs +10 -0
- package/dist/web/Input/Input.js +181 -0
- package/dist/web/Input/Input.mjs +182 -0
- package/dist/web/InputNumber/BInputNumber.js +311 -0
- package/dist/web/InputNumber/BInputNumber.mjs +312 -0
- package/dist/web/InputNumber/StepHandler.js +69 -0
- package/dist/web/InputNumber/StepHandler.mjs +70 -0
- package/dist/web/InputNumber/hooks/useCursor.js +40 -0
- package/dist/web/InputNumber/hooks/useCursor.mjs +41 -0
- package/dist/web/InputNumber/hooks/useFrame.js +12 -0
- package/dist/web/InputNumber/hooks/useFrame.mjs +13 -0
- package/dist/web/InputNumber/utils/decimal.js +147 -0
- package/dist/web/InputNumber/utils/decimal.mjs +147 -0
- package/dist/web/Modal/Modal.js +84 -0
- package/dist/web/Modal/Modal.mjs +85 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +232 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +233 -0
- package/dist/web/Pagination/Pagination.js +328 -0
- package/dist/web/Pagination/Pagination.mjs +329 -0
- package/dist/web/ProductField/ProductField.js +272 -0
- package/dist/web/ProductField/ProductField.mjs +273 -0
- package/dist/web/ProductField/arrow-up.svg.js +3 -0
- package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-no.svg.js +3 -0
- package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-ok.svg.js +3 -0
- package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
- package/dist/web/ProductField/no_data_light.svg.js +3 -0
- package/dist/web/ProductField/no_data_light.svg.mjs +4 -0
- package/dist/web/ProductField/search.svg.js +3 -0
- package/dist/web/ProductField/search.svg.mjs +4 -0
- package/dist/web/ProductField/sort.svg.js +3 -0
- package/dist/web/ProductField/sort.svg.mjs +4 -0
- package/dist/web/SkuInputCard/SkuInputCard.js +276 -0
- package/dist/web/SkuInputCard/SkuInputCard.mjs +277 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +3 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
- package/dist/web/Switch/Switch.js +70 -0
- package/dist/web/Switch/Switch.mjs +71 -0
- package/dist/web/Table/BTable.js +950 -0
- package/dist/web/Table/BTable.mjs +950 -0
- package/dist/web/Table/Column.js +5 -0
- package/dist/web/Table/Column.mjs +6 -0
- package/dist/web/Table/ColumnGroup.js +5 -0
- package/dist/web/Table/ColumnGroup.mjs +6 -0
- package/dist/web/Table/utils/columns.js +48 -0
- package/dist/web/Table/utils/columns.mjs +48 -0
- package/dist/web/Table/utils/sortFilter.js +84 -0
- package/dist/web/Table/utils/sortFilter.mjs +84 -0
- package/dist/web/Tabs/BTabs.js +150 -0
- package/dist/web/Tabs/BTabs.mjs +150 -0
- package/dist/web/Tabs/TabPane.js +8 -0
- package/dist/web/Tabs/TabPane.mjs +8 -0
- package/dist/web/Tooltip/ConfirmTooltip.js +26 -0
- package/dist/web/Tooltip/ConfirmTooltip.mjs +27 -0
- package/dist/web/Tooltip/ContentTooltip.js +94 -0
- package/dist/web/Tooltip/ContentTooltip.mjs +95 -0
- package/dist/web/Tooltip/ProgressTooltip.js +36 -0
- package/dist/web/Tooltip/ProgressTooltip.mjs +37 -0
- package/dist/web/Tooltip/TooltipWrapper.js +12 -0
- package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
- package/dist/web/Tooltip/useAutoPlacement.js +41 -0
- package/dist/web/Tooltip/useAutoPlacement.mjs +41 -0
- package/dist/web.d.ts +1141 -0
- package/dist/web.js +51 -0
- package/dist/web.mjs +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const reactDom = require("react-dom");
|
|
5
|
+
;/* empty css */
|
|
6
|
+
function defaultResolvePopupPlacement({
|
|
7
|
+
triggerRect,
|
|
8
|
+
dropdownHeight,
|
|
9
|
+
viewportHeight
|
|
10
|
+
}) {
|
|
11
|
+
const spaceBelow = viewportHeight - triggerRect.bottom;
|
|
12
|
+
const spaceAbove = triggerRect.top;
|
|
13
|
+
return spaceBelow < dropdownHeight && spaceAbove >= dropdownHeight ? "top" : "bottom";
|
|
14
|
+
}
|
|
15
|
+
const Pagination = (props) => {
|
|
16
|
+
const {
|
|
17
|
+
current: controlledCurrent,
|
|
18
|
+
defaultCurrent = 1,
|
|
19
|
+
pageSize: controlledPageSize,
|
|
20
|
+
defaultPageSize = 10,
|
|
21
|
+
total = 0,
|
|
22
|
+
onChange,
|
|
23
|
+
onShowSizeChange,
|
|
24
|
+
showSizeChanger = false,
|
|
25
|
+
showQuickJumper = false,
|
|
26
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
27
|
+
disabled = false,
|
|
28
|
+
hideOnSinglePage = false,
|
|
29
|
+
showTotal,
|
|
30
|
+
size = "medium",
|
|
31
|
+
align = "start",
|
|
32
|
+
simple = false,
|
|
33
|
+
popupPlacement,
|
|
34
|
+
resolvePopupPlacement,
|
|
35
|
+
dropdownClassName,
|
|
36
|
+
t = (text) => text,
|
|
37
|
+
className,
|
|
38
|
+
style
|
|
39
|
+
} = props;
|
|
40
|
+
const [internalCurrent, setInternalCurrent] = react.useState(defaultCurrent);
|
|
41
|
+
const [internalPageSize, setInternalPageSize] = react.useState(defaultPageSize);
|
|
42
|
+
const [isSizeDropdownOpen, setIsSizeDropdownOpen] = react.useState(false);
|
|
43
|
+
const [dropdownPlacement, setDropdownPlacement] = react.useState("bottom");
|
|
44
|
+
const [dropdownAnchor, setDropdownAnchor] = react.useState(null);
|
|
45
|
+
const sizeDropdownRef = react.useRef(null);
|
|
46
|
+
const dropdownPortalRef = react.useRef(null);
|
|
47
|
+
const current = controlledCurrent ?? internalCurrent;
|
|
48
|
+
const pageSize = controlledPageSize ?? internalPageSize;
|
|
49
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
50
|
+
if (hideOnSinglePage && totalPages <= 1) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const handlePageChange = (page) => {
|
|
54
|
+
if (disabled || page < 1 || page > totalPages || page === current) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (controlledCurrent === void 0) {
|
|
58
|
+
setInternalCurrent(page);
|
|
59
|
+
}
|
|
60
|
+
onChange == null ? void 0 : onChange(page, pageSize);
|
|
61
|
+
};
|
|
62
|
+
const handlePageSizeChange = (newPageSize) => {
|
|
63
|
+
const newTotalPages = Math.ceil(total / newPageSize);
|
|
64
|
+
const newCurrent = Math.min(current, newTotalPages) || 1;
|
|
65
|
+
if (controlledPageSize === void 0) {
|
|
66
|
+
setInternalPageSize(newPageSize);
|
|
67
|
+
if (controlledCurrent === void 0) {
|
|
68
|
+
setInternalCurrent(newCurrent);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
onShowSizeChange == null ? void 0 : onShowSizeChange(newCurrent, newPageSize);
|
|
72
|
+
onChange == null ? void 0 : onChange(newCurrent, newPageSize);
|
|
73
|
+
};
|
|
74
|
+
const updateDropdownPosition = (placement) => {
|
|
75
|
+
if (!sizeDropdownRef.current) return;
|
|
76
|
+
const triggerRect = sizeDropdownRef.current.getBoundingClientRect();
|
|
77
|
+
setDropdownAnchor({
|
|
78
|
+
left: triggerRect.left + triggerRect.width / 2,
|
|
79
|
+
top: placement === "bottom" ? triggerRect.bottom + 4 : triggerRect.top - 4
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const toggleSizeDropdown = () => {
|
|
83
|
+
if (disabled) return;
|
|
84
|
+
if (isSizeDropdownOpen) {
|
|
85
|
+
setIsSizeDropdownOpen(false);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
let placement = dropdownPlacement;
|
|
89
|
+
if (popupPlacement === void 0 && sizeDropdownRef.current) {
|
|
90
|
+
const triggerRect = sizeDropdownRef.current.getBoundingClientRect();
|
|
91
|
+
const dropdownHeight = pageSizeOptions.length * 40 + 8;
|
|
92
|
+
const viewportHeight = window.innerHeight;
|
|
93
|
+
placement = (resolvePopupPlacement == null ? void 0 : resolvePopupPlacement({ triggerRect, dropdownHeight, viewportHeight })) ?? defaultResolvePopupPlacement({ triggerRect, dropdownHeight, viewportHeight });
|
|
94
|
+
setDropdownPlacement(placement);
|
|
95
|
+
}
|
|
96
|
+
updateDropdownPosition(popupPlacement ?? placement);
|
|
97
|
+
setIsSizeDropdownOpen(true);
|
|
98
|
+
};
|
|
99
|
+
const handleSizeOptionClick = (newPageSize) => {
|
|
100
|
+
handlePageSizeChange(newPageSize);
|
|
101
|
+
setIsSizeDropdownOpen(false);
|
|
102
|
+
};
|
|
103
|
+
react.useEffect(() => {
|
|
104
|
+
const handleClickOutside = (event) => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
const target = event.target;
|
|
107
|
+
if (((_a = sizeDropdownRef.current) == null ? void 0 : _a.contains(target)) || ((_b = dropdownPortalRef.current) == null ? void 0 : _b.contains(target))) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
setIsSizeDropdownOpen(false);
|
|
111
|
+
};
|
|
112
|
+
const handleScroll = () => setIsSizeDropdownOpen(false);
|
|
113
|
+
const handleResize = () => updateDropdownPosition(popupPlacement ?? dropdownPlacement);
|
|
114
|
+
if (isSizeDropdownOpen) {
|
|
115
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
116
|
+
document.addEventListener("scroll", handleScroll, true);
|
|
117
|
+
window.addEventListener("resize", handleResize);
|
|
118
|
+
return () => {
|
|
119
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
120
|
+
document.removeEventListener("scroll", handleScroll, true);
|
|
121
|
+
window.removeEventListener("resize", handleResize);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}, [isSizeDropdownOpen, popupPlacement, dropdownPlacement]);
|
|
125
|
+
const handleQuickJump = (e) => {
|
|
126
|
+
const value = parseInt(e.target.value);
|
|
127
|
+
if (!isNaN(value) && value >= 1 && value <= totalPages) {
|
|
128
|
+
handlePageChange(value);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const pageNumbers = react.useMemo(() => {
|
|
132
|
+
const pages = [];
|
|
133
|
+
const showEllipsisThreshold = 7;
|
|
134
|
+
if (totalPages <= showEllipsisThreshold) {
|
|
135
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
136
|
+
pages.push(i);
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
if (current <= 4) {
|
|
140
|
+
for (let i = 1; i <= 5; i++) {
|
|
141
|
+
pages.push(i);
|
|
142
|
+
}
|
|
143
|
+
pages.push("...");
|
|
144
|
+
pages.push(totalPages);
|
|
145
|
+
} else if (current >= totalPages - 3) {
|
|
146
|
+
pages.push(1);
|
|
147
|
+
pages.push("...");
|
|
148
|
+
for (let i = totalPages - 4; i <= totalPages; i++) {
|
|
149
|
+
pages.push(i);
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
pages.push(1);
|
|
153
|
+
pages.push("...");
|
|
154
|
+
for (let i = current - 1; i <= current + 1; i++) {
|
|
155
|
+
pages.push(i);
|
|
156
|
+
}
|
|
157
|
+
pages.push("...");
|
|
158
|
+
pages.push(totalPages);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return pages;
|
|
162
|
+
}, [current, totalPages]);
|
|
163
|
+
const rangeStart = (current - 1) * pageSize + 1;
|
|
164
|
+
const rangeEnd = Math.min(current * pageSize, total);
|
|
165
|
+
const sizeClass = `pagination-${size}`;
|
|
166
|
+
const alignClass = `pagination-${align}`;
|
|
167
|
+
const disabledClass = disabled ? "pagination-disabled" : "";
|
|
168
|
+
const renderPageItem = (page, index) => {
|
|
169
|
+
if (page === "...") {
|
|
170
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pagination-item pagination-ellipsis", children: "..." }, `ellipsis-${index}`);
|
|
171
|
+
}
|
|
172
|
+
const isActive = page === current;
|
|
173
|
+
const activeClass = isActive ? "pagination-item-active" : "";
|
|
174
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
className: `pagination-item ${activeClass}`,
|
|
179
|
+
onClick: () => handlePageChange(page),
|
|
180
|
+
disabled,
|
|
181
|
+
children: page
|
|
182
|
+
},
|
|
183
|
+
page
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
if (simple) {
|
|
187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: `pagination pagination-simple ${disabledClass} ${className || ""}`,
|
|
191
|
+
style,
|
|
192
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pagination-simple-list", children: [
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
className: "pagination-simple-item pagination-simple-prev",
|
|
198
|
+
onClick: () => handlePageChange(current - 1),
|
|
199
|
+
disabled: disabled || current === 1,
|
|
200
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 2L4 6L8 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pagination-simple-text", children: [
|
|
204
|
+
current,
|
|
205
|
+
" / ",
|
|
206
|
+
totalPages || 0
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
209
|
+
"button",
|
|
210
|
+
{
|
|
211
|
+
type: "button",
|
|
212
|
+
className: "pagination-simple-item pagination-simple-next",
|
|
213
|
+
onClick: () => handlePageChange(current + 1),
|
|
214
|
+
disabled: disabled || current === totalPages,
|
|
215
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 2L8 6L4 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] })
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: `pagination ${sizeClass} ${alignClass} ${disabledClass} ${className || ""}`,
|
|
226
|
+
style,
|
|
227
|
+
children: [
|
|
228
|
+
showTotal && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pagination-total", children: showTotal(total, [rangeStart, rangeEnd]) }),
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pagination-list", children: [
|
|
230
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
type: "button",
|
|
234
|
+
className: "pagination-item pagination-prev",
|
|
235
|
+
onClick: () => handlePageChange(current - 1),
|
|
236
|
+
disabled: disabled || current === 1,
|
|
237
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z", fill: "#333333" }),
|
|
239
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z", fill: "black", fillOpacity: "0.2" })
|
|
240
|
+
] })
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
pageNumbers.map((page, index) => renderPageItem(page, index)),
|
|
244
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
className: "pagination-item pagination-next",
|
|
249
|
+
onClick: () => handlePageChange(current + 1),
|
|
250
|
+
disabled: disabled || current === totalPages,
|
|
251
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
252
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "#333333" }),
|
|
253
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "black", "fill-opacity": "0.2" })
|
|
254
|
+
] })
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
showSizeChanger && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pagination-sizer", ref: sizeDropdownRef, children: [
|
|
259
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
260
|
+
"button",
|
|
261
|
+
{
|
|
262
|
+
type: "button",
|
|
263
|
+
className: "pagination-sizer-select",
|
|
264
|
+
onClick: toggleSizeDropdown,
|
|
265
|
+
disabled,
|
|
266
|
+
children: [
|
|
267
|
+
pageSize,
|
|
268
|
+
t("条/页"),
|
|
269
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { className: `pagination-sizer-icon${isSizeDropdownOpen ? " pagination-sizer-icon-open" : ""}`, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
270
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z", fill: "#333333" }),
|
|
271
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z", fill: "black", fillOpacity: "0.2" })
|
|
272
|
+
] })
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
isSizeDropdownOpen && dropdownAnchor && reactDom.createPortal(
|
|
277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
ref: dropdownPortalRef,
|
|
281
|
+
className: `pagination-sizer-dropdown pagination-sizer-dropdown-${popupPlacement ?? dropdownPlacement}${dropdownClassName ? ` ${dropdownClassName}` : ""}`,
|
|
282
|
+
style: {
|
|
283
|
+
position: "fixed",
|
|
284
|
+
left: dropdownAnchor.left,
|
|
285
|
+
top: dropdownAnchor.top,
|
|
286
|
+
zIndex: 99999,
|
|
287
|
+
transform: (popupPlacement ?? dropdownPlacement) === "bottom" ? "translate(-50%, 0)" : "translate(-50%, -100%)"
|
|
288
|
+
},
|
|
289
|
+
children: pageSizeOptions.map((size2) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
290
|
+
"button",
|
|
291
|
+
{
|
|
292
|
+
type: "button",
|
|
293
|
+
className: "pagination-sizer-option",
|
|
294
|
+
onClick: () => handleSizeOptionClick(size2),
|
|
295
|
+
"data-selected": size2 === pageSize,
|
|
296
|
+
children: [
|
|
297
|
+
size2,
|
|
298
|
+
t("条/页")
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
size2
|
|
302
|
+
))
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
document.body
|
|
306
|
+
)
|
|
307
|
+
] }),
|
|
308
|
+
showQuickJumper && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pagination-jumper", children: [
|
|
309
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("跳至") }),
|
|
310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
311
|
+
"input",
|
|
312
|
+
{
|
|
313
|
+
type: "number",
|
|
314
|
+
className: "pagination-jumper-input",
|
|
315
|
+
min: 1,
|
|
316
|
+
max: totalPages,
|
|
317
|
+
onChange: handleQuickJump,
|
|
318
|
+
disabled,
|
|
319
|
+
placeholder: ""
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t("页") })
|
|
323
|
+
] })
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
};
|
|
328
|
+
module.exports = Pagination;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect, useMemo } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function defaultResolvePopupPlacement({
|
|
6
|
+
triggerRect,
|
|
7
|
+
dropdownHeight,
|
|
8
|
+
viewportHeight
|
|
9
|
+
}) {
|
|
10
|
+
const spaceBelow = viewportHeight - triggerRect.bottom;
|
|
11
|
+
const spaceAbove = triggerRect.top;
|
|
12
|
+
return spaceBelow < dropdownHeight && spaceAbove >= dropdownHeight ? "top" : "bottom";
|
|
13
|
+
}
|
|
14
|
+
const Pagination = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
current: controlledCurrent,
|
|
17
|
+
defaultCurrent = 1,
|
|
18
|
+
pageSize: controlledPageSize,
|
|
19
|
+
defaultPageSize = 10,
|
|
20
|
+
total = 0,
|
|
21
|
+
onChange,
|
|
22
|
+
onShowSizeChange,
|
|
23
|
+
showSizeChanger = false,
|
|
24
|
+
showQuickJumper = false,
|
|
25
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
26
|
+
disabled = false,
|
|
27
|
+
hideOnSinglePage = false,
|
|
28
|
+
showTotal,
|
|
29
|
+
size = "medium",
|
|
30
|
+
align = "start",
|
|
31
|
+
simple = false,
|
|
32
|
+
popupPlacement,
|
|
33
|
+
resolvePopupPlacement,
|
|
34
|
+
dropdownClassName,
|
|
35
|
+
t = (text) => text,
|
|
36
|
+
className,
|
|
37
|
+
style
|
|
38
|
+
} = props;
|
|
39
|
+
const [internalCurrent, setInternalCurrent] = useState(defaultCurrent);
|
|
40
|
+
const [internalPageSize, setInternalPageSize] = useState(defaultPageSize);
|
|
41
|
+
const [isSizeDropdownOpen, setIsSizeDropdownOpen] = useState(false);
|
|
42
|
+
const [dropdownPlacement, setDropdownPlacement] = useState("bottom");
|
|
43
|
+
const [dropdownAnchor, setDropdownAnchor] = useState(null);
|
|
44
|
+
const sizeDropdownRef = useRef(null);
|
|
45
|
+
const dropdownPortalRef = useRef(null);
|
|
46
|
+
const current = controlledCurrent ?? internalCurrent;
|
|
47
|
+
const pageSize = controlledPageSize ?? internalPageSize;
|
|
48
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
49
|
+
if (hideOnSinglePage && totalPages <= 1) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const handlePageChange = (page) => {
|
|
53
|
+
if (disabled || page < 1 || page > totalPages || page === current) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (controlledCurrent === void 0) {
|
|
57
|
+
setInternalCurrent(page);
|
|
58
|
+
}
|
|
59
|
+
onChange == null ? void 0 : onChange(page, pageSize);
|
|
60
|
+
};
|
|
61
|
+
const handlePageSizeChange = (newPageSize) => {
|
|
62
|
+
const newTotalPages = Math.ceil(total / newPageSize);
|
|
63
|
+
const newCurrent = Math.min(current, newTotalPages) || 1;
|
|
64
|
+
if (controlledPageSize === void 0) {
|
|
65
|
+
setInternalPageSize(newPageSize);
|
|
66
|
+
if (controlledCurrent === void 0) {
|
|
67
|
+
setInternalCurrent(newCurrent);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
onShowSizeChange == null ? void 0 : onShowSizeChange(newCurrent, newPageSize);
|
|
71
|
+
onChange == null ? void 0 : onChange(newCurrent, newPageSize);
|
|
72
|
+
};
|
|
73
|
+
const updateDropdownPosition = (placement) => {
|
|
74
|
+
if (!sizeDropdownRef.current) return;
|
|
75
|
+
const triggerRect = sizeDropdownRef.current.getBoundingClientRect();
|
|
76
|
+
setDropdownAnchor({
|
|
77
|
+
left: triggerRect.left + triggerRect.width / 2,
|
|
78
|
+
top: placement === "bottom" ? triggerRect.bottom + 4 : triggerRect.top - 4
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const toggleSizeDropdown = () => {
|
|
82
|
+
if (disabled) return;
|
|
83
|
+
if (isSizeDropdownOpen) {
|
|
84
|
+
setIsSizeDropdownOpen(false);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let placement = dropdownPlacement;
|
|
88
|
+
if (popupPlacement === void 0 && sizeDropdownRef.current) {
|
|
89
|
+
const triggerRect = sizeDropdownRef.current.getBoundingClientRect();
|
|
90
|
+
const dropdownHeight = pageSizeOptions.length * 40 + 8;
|
|
91
|
+
const viewportHeight = window.innerHeight;
|
|
92
|
+
placement = (resolvePopupPlacement == null ? void 0 : resolvePopupPlacement({ triggerRect, dropdownHeight, viewportHeight })) ?? defaultResolvePopupPlacement({ triggerRect, dropdownHeight, viewportHeight });
|
|
93
|
+
setDropdownPlacement(placement);
|
|
94
|
+
}
|
|
95
|
+
updateDropdownPosition(popupPlacement ?? placement);
|
|
96
|
+
setIsSizeDropdownOpen(true);
|
|
97
|
+
};
|
|
98
|
+
const handleSizeOptionClick = (newPageSize) => {
|
|
99
|
+
handlePageSizeChange(newPageSize);
|
|
100
|
+
setIsSizeDropdownOpen(false);
|
|
101
|
+
};
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const handleClickOutside = (event) => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
const target = event.target;
|
|
106
|
+
if (((_a = sizeDropdownRef.current) == null ? void 0 : _a.contains(target)) || ((_b = dropdownPortalRef.current) == null ? void 0 : _b.contains(target))) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
setIsSizeDropdownOpen(false);
|
|
110
|
+
};
|
|
111
|
+
const handleScroll = () => setIsSizeDropdownOpen(false);
|
|
112
|
+
const handleResize = () => updateDropdownPosition(popupPlacement ?? dropdownPlacement);
|
|
113
|
+
if (isSizeDropdownOpen) {
|
|
114
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
115
|
+
document.addEventListener("scroll", handleScroll, true);
|
|
116
|
+
window.addEventListener("resize", handleResize);
|
|
117
|
+
return () => {
|
|
118
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
119
|
+
document.removeEventListener("scroll", handleScroll, true);
|
|
120
|
+
window.removeEventListener("resize", handleResize);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}, [isSizeDropdownOpen, popupPlacement, dropdownPlacement]);
|
|
124
|
+
const handleQuickJump = (e) => {
|
|
125
|
+
const value = parseInt(e.target.value);
|
|
126
|
+
if (!isNaN(value) && value >= 1 && value <= totalPages) {
|
|
127
|
+
handlePageChange(value);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const pageNumbers = useMemo(() => {
|
|
131
|
+
const pages = [];
|
|
132
|
+
const showEllipsisThreshold = 7;
|
|
133
|
+
if (totalPages <= showEllipsisThreshold) {
|
|
134
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
135
|
+
pages.push(i);
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
if (current <= 4) {
|
|
139
|
+
for (let i = 1; i <= 5; i++) {
|
|
140
|
+
pages.push(i);
|
|
141
|
+
}
|
|
142
|
+
pages.push("...");
|
|
143
|
+
pages.push(totalPages);
|
|
144
|
+
} else if (current >= totalPages - 3) {
|
|
145
|
+
pages.push(1);
|
|
146
|
+
pages.push("...");
|
|
147
|
+
for (let i = totalPages - 4; i <= totalPages; i++) {
|
|
148
|
+
pages.push(i);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
pages.push(1);
|
|
152
|
+
pages.push("...");
|
|
153
|
+
for (let i = current - 1; i <= current + 1; i++) {
|
|
154
|
+
pages.push(i);
|
|
155
|
+
}
|
|
156
|
+
pages.push("...");
|
|
157
|
+
pages.push(totalPages);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return pages;
|
|
161
|
+
}, [current, totalPages]);
|
|
162
|
+
const rangeStart = (current - 1) * pageSize + 1;
|
|
163
|
+
const rangeEnd = Math.min(current * pageSize, total);
|
|
164
|
+
const sizeClass = `pagination-${size}`;
|
|
165
|
+
const alignClass = `pagination-${align}`;
|
|
166
|
+
const disabledClass = disabled ? "pagination-disabled" : "";
|
|
167
|
+
const renderPageItem = (page, index) => {
|
|
168
|
+
if (page === "...") {
|
|
169
|
+
return /* @__PURE__ */ jsx("span", { className: "pagination-item pagination-ellipsis", children: "..." }, `ellipsis-${index}`);
|
|
170
|
+
}
|
|
171
|
+
const isActive = page === current;
|
|
172
|
+
const activeClass = isActive ? "pagination-item-active" : "";
|
|
173
|
+
return /* @__PURE__ */ jsx(
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
type: "button",
|
|
177
|
+
className: `pagination-item ${activeClass}`,
|
|
178
|
+
onClick: () => handlePageChange(page),
|
|
179
|
+
disabled,
|
|
180
|
+
children: page
|
|
181
|
+
},
|
|
182
|
+
page
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
if (simple) {
|
|
186
|
+
return /* @__PURE__ */ jsx(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
className: `pagination pagination-simple ${disabledClass} ${className || ""}`,
|
|
190
|
+
style,
|
|
191
|
+
children: /* @__PURE__ */ jsxs("div", { className: "pagination-simple-list", children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
type: "button",
|
|
196
|
+
className: "pagination-simple-item pagination-simple-prev",
|
|
197
|
+
onClick: () => handlePageChange(current - 1),
|
|
198
|
+
disabled: disabled || current === 1,
|
|
199
|
+
children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M8 2L4 6L8 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsxs("span", { className: "pagination-simple-text", children: [
|
|
203
|
+
current,
|
|
204
|
+
" / ",
|
|
205
|
+
totalPages || 0
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ jsx(
|
|
208
|
+
"button",
|
|
209
|
+
{
|
|
210
|
+
type: "button",
|
|
211
|
+
className: "pagination-simple-item pagination-simple-next",
|
|
212
|
+
onClick: () => handlePageChange(current + 1),
|
|
213
|
+
disabled: disabled || current === totalPages,
|
|
214
|
+
children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M4 2L8 6L4 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] })
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ jsxs(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
className: `pagination ${sizeClass} ${alignClass} ${disabledClass} ${className || ""}`,
|
|
225
|
+
style,
|
|
226
|
+
children: [
|
|
227
|
+
showTotal && /* @__PURE__ */ jsx("div", { className: "pagination-total", children: showTotal(total, [rangeStart, rangeEnd]) }),
|
|
228
|
+
/* @__PURE__ */ jsxs("div", { className: "pagination-list", children: [
|
|
229
|
+
/* @__PURE__ */ jsx(
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
type: "button",
|
|
233
|
+
className: "pagination-item pagination-prev",
|
|
234
|
+
onClick: () => handlePageChange(current - 1),
|
|
235
|
+
disabled: disabled || current === 1,
|
|
236
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
237
|
+
/* @__PURE__ */ jsx("path", { d: "M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z", fill: "#333333" }),
|
|
238
|
+
/* @__PURE__ */ jsx("path", { d: "M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z", fill: "black", fillOpacity: "0.2" })
|
|
239
|
+
] })
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
pageNumbers.map((page, index) => renderPageItem(page, index)),
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
"button",
|
|
245
|
+
{
|
|
246
|
+
type: "button",
|
|
247
|
+
className: "pagination-item pagination-next",
|
|
248
|
+
onClick: () => handlePageChange(current + 1),
|
|
249
|
+
disabled: disabled || current === totalPages,
|
|
250
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
251
|
+
/* @__PURE__ */ jsx("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "#333333" }),
|
|
252
|
+
/* @__PURE__ */ jsx("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "black", "fill-opacity": "0.2" })
|
|
253
|
+
] })
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] }),
|
|
257
|
+
showSizeChanger && /* @__PURE__ */ jsxs("div", { className: "pagination-sizer", ref: sizeDropdownRef, children: [
|
|
258
|
+
/* @__PURE__ */ jsxs(
|
|
259
|
+
"button",
|
|
260
|
+
{
|
|
261
|
+
type: "button",
|
|
262
|
+
className: "pagination-sizer-select",
|
|
263
|
+
onClick: toggleSizeDropdown,
|
|
264
|
+
disabled,
|
|
265
|
+
children: [
|
|
266
|
+
pageSize,
|
|
267
|
+
t("条/页"),
|
|
268
|
+
/* @__PURE__ */ jsxs("svg", { className: `pagination-sizer-icon${isSizeDropdownOpen ? " pagination-sizer-icon-open" : ""}`, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
269
|
+
/* @__PURE__ */ jsx("path", { d: "M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z", fill: "#333333" }),
|
|
270
|
+
/* @__PURE__ */ jsx("path", { d: "M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z", fill: "black", fillOpacity: "0.2" })
|
|
271
|
+
] })
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
isSizeDropdownOpen && dropdownAnchor && createPortal(
|
|
276
|
+
/* @__PURE__ */ jsx(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
ref: dropdownPortalRef,
|
|
280
|
+
className: `pagination-sizer-dropdown pagination-sizer-dropdown-${popupPlacement ?? dropdownPlacement}${dropdownClassName ? ` ${dropdownClassName}` : ""}`,
|
|
281
|
+
style: {
|
|
282
|
+
position: "fixed",
|
|
283
|
+
left: dropdownAnchor.left,
|
|
284
|
+
top: dropdownAnchor.top,
|
|
285
|
+
zIndex: 99999,
|
|
286
|
+
transform: (popupPlacement ?? dropdownPlacement) === "bottom" ? "translate(-50%, 0)" : "translate(-50%, -100%)"
|
|
287
|
+
},
|
|
288
|
+
children: pageSizeOptions.map((size2) => /* @__PURE__ */ jsxs(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
type: "button",
|
|
292
|
+
className: "pagination-sizer-option",
|
|
293
|
+
onClick: () => handleSizeOptionClick(size2),
|
|
294
|
+
"data-selected": size2 === pageSize,
|
|
295
|
+
children: [
|
|
296
|
+
size2,
|
|
297
|
+
t("条/页")
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
size2
|
|
301
|
+
))
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
document.body
|
|
305
|
+
)
|
|
306
|
+
] }),
|
|
307
|
+
showQuickJumper && /* @__PURE__ */ jsxs("div", { className: "pagination-jumper", children: [
|
|
308
|
+
/* @__PURE__ */ jsx("span", { children: t("跳至") }),
|
|
309
|
+
/* @__PURE__ */ jsx(
|
|
310
|
+
"input",
|
|
311
|
+
{
|
|
312
|
+
type: "number",
|
|
313
|
+
className: "pagination-jumper-input",
|
|
314
|
+
min: 1,
|
|
315
|
+
max: totalPages,
|
|
316
|
+
onChange: handleQuickJump,
|
|
317
|
+
disabled,
|
|
318
|
+
placeholder: ""
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ jsx("span", { children: t("页") })
|
|
322
|
+
] })
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
Pagination as default
|
|
329
|
+
};
|