bj-web-components 0.2.34 → 0.2.35

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.
Files changed (111) hide show
  1. package/README.md +10 -1
  2. package/dist/index.js +58 -1
  3. package/dist/index.mjs +1 -29
  4. package/dist/miniapp.js +1 -1
  5. package/dist/miniapp.mjs +0 -1
  6. package/dist/mobile.js +1 -1
  7. package/dist/mobile.mjs +0 -1
  8. package/dist/react.js +1 -1
  9. package/dist/react.mjs +0 -1
  10. package/dist/shared.js +1 -1
  11. package/dist/shared.mjs +0 -1
  12. package/dist/style.css +1 -1
  13. package/dist/web/BasicInput/BInput.js +278 -1
  14. package/dist/web/BasicInput/BInput.mjs +263 -164
  15. package/dist/web/BasicInput/utils.js +47 -1
  16. package/dist/web/BasicInput/utils.mjs +22 -20
  17. package/dist/web/CategoryDropdown/CategoryDropdown.js +376 -1
  18. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +355 -235
  19. package/dist/web/CheckBox/BCheckBox.js +176 -1
  20. package/dist/web/CheckBox/BCheckBox.mjs +169 -98
  21. package/dist/web/CheckBox/Group.js +111 -1
  22. package/dist/web/CheckBox/Group.mjs +104 -64
  23. package/dist/web/CheckBox/context.js +8 -1
  24. package/dist/web/CheckBox/context.mjs +2 -4
  25. package/dist/web/CheckBox/index.js +11 -1
  26. package/dist/web/CheckBox/index.mjs +2 -4
  27. package/dist/web/Dropdown/BDropdown.js +265 -1
  28. package/dist/web/Dropdown/BDropdown.mjs +234 -134
  29. package/dist/web/EmptyInputBox/EmptyInputBox.js +89 -1
  30. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +85 -72
  31. package/dist/web/FileCard/FileCard.js +414 -1
  32. package/dist/web/FileCard/FileCard.mjs +400 -116
  33. package/dist/web/Icon/Icon.js +82 -1
  34. package/dist/web/Icon/Icon.mjs +78 -8
  35. package/dist/web/Input/Input.js +230 -1
  36. package/dist/web/Input/Input.mjs +219 -164
  37. package/dist/web/InputNumber/BInputNumber.js +271 -1
  38. package/dist/web/InputNumber/BInputNumber.mjs +254 -189
  39. package/dist/web/InputNumber/StepHandler.js +112 -1
  40. package/dist/web/InputNumber/StepHandler.mjs +102 -50
  41. package/dist/web/InputNumber/hooks/useCursor.js +38 -1
  42. package/dist/web/InputNumber/hooks/useCursor.mjs +31 -34
  43. package/dist/web/InputNumber/hooks/useFrame.js +15 -1
  44. package/dist/web/InputNumber/hooks/useFrame.mjs +8 -5
  45. package/dist/web/InputNumber/utils/decimal.js +163 -1
  46. package/dist/web/InputNumber/utils/decimal.mjs +114 -79
  47. package/dist/web/MobileDrawer/BMobileDrawer.js +238 -1
  48. package/dist/web/MobileDrawer/BMobileDrawer.mjs +221 -139
  49. package/dist/web/Modal/Modal.js +148 -1
  50. package/dist/web/Modal/Modal.mjs +143 -79
  51. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +273 -1
  52. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +262 -143
  53. package/dist/web/Pagination/Pagination.js +352 -1
  54. package/dist/web/Pagination/Pagination.mjs +342 -247
  55. package/dist/web/ProductField/ProductField.js +443 -1
  56. package/dist/web/ProductField/ProductField.mjs +423 -208
  57. package/dist/web/ProductField/arrow-up.svg.js +4 -1
  58. package/dist/web/ProductField/arrow-up.svg.mjs +2 -4
  59. package/dist/web/ProductField/checkbox-no.svg.js +4 -1
  60. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -4
  61. package/dist/web/ProductField/checkbox-ok.svg.js +4 -1
  62. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -4
  63. package/dist/web/ProductField/no_data_light.svg.js +4 -1
  64. package/dist/web/ProductField/no_data_light.svg.mjs +2 -4
  65. package/dist/web/ProductField/search.svg.js +4 -1
  66. package/dist/web/ProductField/search.svg.mjs +2 -4
  67. package/dist/web/ProductField/sort.svg.js +4 -1
  68. package/dist/web/ProductField/sort.svg.mjs +2 -4
  69. package/dist/web/Radio/BRadio.js +151 -1
  70. package/dist/web/Radio/BRadio.mjs +147 -75
  71. package/dist/web/Radio/Button.js +54 -1
  72. package/dist/web/Radio/Button.mjs +51 -8
  73. package/dist/web/Radio/Group.js +97 -1
  74. package/dist/web/Radio/Group.mjs +92 -76
  75. package/dist/web/Radio/context.js +10 -1
  76. package/dist/web/Radio/context.mjs +3 -5
  77. package/dist/web/Radio/index.js +13 -1
  78. package/dist/web/Radio/index.mjs +2 -4
  79. package/dist/web/SkuInputCard/SkuInputCard.js +427 -1
  80. package/dist/web/SkuInputCard/SkuInputCard.mjs +414 -219
  81. package/dist/web/SkuInputCard/spin_loading_red.gif.js +4 -1
  82. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -4
  83. package/dist/web/Switch/Switch.js +114 -1
  84. package/dist/web/Switch/Switch.mjs +109 -58
  85. package/dist/web/Table/BTable.js +1049 -1
  86. package/dist/web/Table/BTable.mjs +1011 -667
  87. package/dist/web/Table/Column.js +6 -1
  88. package/dist/web/Table/Column.mjs +1 -3
  89. package/dist/web/Table/ColumnGroup.js +6 -1
  90. package/dist/web/Table/ColumnGroup.mjs +1 -3
  91. package/dist/web/Table/utils/columns.js +116 -1
  92. package/dist/web/Table/utils/columns.mjs +103 -37
  93. package/dist/web/Table/utils/sortFilter.js +145 -1
  94. package/dist/web/Table/utils/sortFilter.mjs +129 -57
  95. package/dist/web/Tabs/BTabs.js +260 -1
  96. package/dist/web/Tabs/BTabs.mjs +239 -122
  97. package/dist/web/Tabs/TabPane.js +19 -1
  98. package/dist/web/Tabs/TabPane.mjs +1 -4
  99. package/dist/web/Tooltip/ConfirmTooltip.js +53 -1
  100. package/dist/web/Tooltip/ConfirmTooltip.mjs +47 -22
  101. package/dist/web/Tooltip/ContentTooltip.js +156 -1
  102. package/dist/web/Tooltip/ContentTooltip.mjs +145 -76
  103. package/dist/web/Tooltip/ProgressTooltip.js +56 -1
  104. package/dist/web/Tooltip/ProgressTooltip.mjs +50 -31
  105. package/dist/web/Tooltip/TooltipWrapper.js +19 -1
  106. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -9
  107. package/dist/web/Tooltip/useAutoPlacement.js +65 -1
  108. package/dist/web/Tooltip/useAutoPlacement.mjs +52 -24
  109. package/dist/web.js +58 -1
  110. package/dist/web.mjs +1 -29
  111. package/package.json +97 -95
@@ -1 +1,352 @@
1
- "use strict";const t=require("react/jsx-runtime"),l=require("react"),ae=require("react-dom");;/* empty css */function le({triggerRect:w,dropdownHeight:r,viewportHeight:L}){const x=L-w.bottom,b=w.top;return x<r&&b>=r?"top":"bottom"}const re=w=>{const{current:r,defaultCurrent:L=1,pageSize:x,defaultPageSize:b=10,total:v=0,onChange:c,onShowSizeChange:N,showSizeChanger:A=!1,showQuickJumper:q=!1,pageSizeOptions:S=[10,20,50,100],disabled:a=!1,hideOnSinglePage:T=!1,showTotal:y,size:H="medium",align:J="start",simple:Q=!1,popupPlacement:d,resolvePopupPlacement:k,dropdownClassName:P,t:j=e=>e,className:$,style:M}=w,[W,E]=l.useState(L),[F,G]=l.useState(b),[g,f]=l.useState(!1),[C,K]=l.useState("bottom"),[z,U]=l.useState(null),p=l.useRef(null),R=l.useRef(null),s=r??W,u=x??F,o=Math.ceil(v/u);if(T&&o<=1)return null;const h=e=>{a||e<1||e>o||e===s||(r===void 0&&E(e),c==null||c(e,u))},V=e=>{const i=Math.ceil(v/e),n=Math.min(s,i)||1;x===void 0&&(G(e),r===void 0&&E(n)),N==null||N(n,e),c==null||c(n,e)},O=e=>{if(!p.current)return;const i=p.current.getBoundingClientRect();U({left:i.left+i.width/2,top:e==="bottom"?i.bottom+4:i.top-4})},X=()=>{if(a)return;if(g){f(!1);return}let e=C;if(d===void 0&&p.current){const i=p.current.getBoundingClientRect(),n=S.length*40+8,m=window.innerHeight;e=(k==null?void 0:k({triggerRect:i,dropdownHeight:n,viewportHeight:m}))??le({triggerRect:i,dropdownHeight:n,viewportHeight:m}),K(e)}O(d??e),f(!0)},Y=e=>{V(e),f(!1)};l.useEffect(()=>{const e=m=>{var I,Z;const D=m.target;(I=p.current)!=null&&I.contains(D)||(Z=R.current)!=null&&Z.contains(D)||f(!1)},i=()=>f(!1),n=()=>O(d??C);if(g)return document.addEventListener("mousedown",e),document.addEventListener("scroll",i,!0),window.addEventListener("resize",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("scroll",i,!0),window.removeEventListener("resize",n)}},[g,d,C]);const _=e=>{const i=parseInt(e.target.value);!isNaN(i)&&i>=1&&i<=o&&h(i)},ee=l.useMemo(()=>{const e=[];if(o<=7)for(let n=1;n<=o;n++)e.push(n);else if(s<=4){for(let n=1;n<=5;n++)e.push(n);e.push("..."),e.push(o)}else if(s>=o-3){e.push(1),e.push("...");for(let n=o-4;n<=o;n++)e.push(n)}else{e.push(1),e.push("...");for(let n=s-1;n<=s+1;n++)e.push(n);e.push("..."),e.push(o)}return e},[s,o]),te=(s-1)*u+1,ne=Math.min(s*u,v),ie=`pagination-${H}`,se=`pagination-${J}`,B=a?"pagination-disabled":"",oe=(e,i)=>{if(e==="...")return t.jsx("span",{className:"pagination-item pagination-ellipsis",children:"..."},`ellipsis-${i}`);const m=e===s?"pagination-item-active":"";return t.jsx("button",{type:"button",className:`pagination-item ${m}`,onClick:()=>h(e),disabled:a,children:e},e)};return Q?t.jsx("div",{className:`pagination pagination-simple ${B} ${$||""}`,style:M,children:t.jsxs("div",{className:"pagination-simple-list",children:[t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M8 2L4 6L8 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsxs("span",{className:"pagination-simple-text",children:[s," / ",o||0]}),t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}):t.jsxs("div",{className:`pagination ${ie} ${se} ${B} ${$||""}`,style:M,children:[typeof y=="function"&&t.jsx("div",{className:"pagination-total",children:y(v,[te,ne])}),t.jsxs("div",{className:"pagination-list",children:[t.jsx("button",{type:"button",className:"pagination-item pagination-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.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"}),t.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"})]})}),ee.map((e,i)=>oe(e,i)),t.jsx("button",{type:"button",className:"pagination-item pagination-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.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"}),t.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",fillOpacity:"0.2"})]})})]}),A&&t.jsxs("div",{className:"pagination-sizer",ref:p,children:[t.jsxs("button",{type:"button",className:"pagination-sizer-select",onClick:X,disabled:a,children:[u,j("条/页"),t.jsxs("svg",{className:`pagination-sizer-icon${g?" pagination-sizer-icon-open":""}`,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.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"}),t.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"})]})]}),g&&z&&ae.createPortal(t.jsx("div",{ref:R,className:`pagination-sizer-dropdown pagination-sizer-dropdown-${d??C}${P?` ${P}`:""}`,style:{position:"fixed",left:z.left,top:z.top,zIndex:99999,transform:(d??C)==="bottom"?"translate(-50%, 0)":"translate(-50%, -100%)"},children:S.map(e=>t.jsxs("button",{type:"button",className:"pagination-sizer-option",onClick:()=>Y(e),"data-selected":e===u,children:[e,j("条/页")]},e))}),document.body)]}),q&&t.jsxs("div",{className:"pagination-jumper",children:[t.jsx("span",{children:j("跳至")}),t.jsx("input",{type:"number",className:"pagination-jumper-input",min:1,max:o,onChange:_,disabled:a,placeholder:""}),t.jsx("span",{children:j("页")})]})]})};module.exports=re;
1
+ "use strict";
2
+
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ var t = require("react/jsx-runtime"),
10
+ r = require("react"),
11
+ le = require("react-dom");
12
+ ; /* empty css */
13
+ function ae(_ref) {
14
+ var w = _ref.triggerRect,
15
+ c = _ref.dropdownHeight,
16
+ b = _ref.viewportHeight;
17
+ var m = b - w.bottom,
18
+ N = w.top;
19
+ return m < c && N >= c ? "top" : "bottom";
20
+ }
21
+ var re = function re(w) {
22
+ var c = w.current,
23
+ _w$defaultCurrent = w.defaultCurrent,
24
+ b = _w$defaultCurrent === void 0 ? 1 : _w$defaultCurrent,
25
+ m = w.pageSize,
26
+ _w$defaultPageSize = w.defaultPageSize,
27
+ N = _w$defaultPageSize === void 0 ? 10 : _w$defaultPageSize,
28
+ _w$total = w.total,
29
+ x = _w$total === void 0 ? 0 : _w$total,
30
+ j = w.onChange,
31
+ z = w.onShowSizeChange,
32
+ _w$showSizeChanger = w.showSizeChanger,
33
+ A = _w$showSizeChanger === void 0 ? !1 : _w$showSizeChanger,
34
+ _w$showQuickJumper = w.showQuickJumper,
35
+ q = _w$showQuickJumper === void 0 ? !1 : _w$showQuickJumper,
36
+ _w$pageSizeOptions = w.pageSizeOptions,
37
+ S = _w$pageSizeOptions === void 0 ? [10, 20, 50, 100] : _w$pageSizeOptions,
38
+ _w$disabled = w.disabled,
39
+ l = _w$disabled === void 0 ? !1 : _w$disabled,
40
+ _w$hideOnSinglePage = w.hideOnSinglePage,
41
+ T = _w$hideOnSinglePage === void 0 ? !1 : _w$hideOnSinglePage,
42
+ P = w.showTotal,
43
+ _w$size = w.size,
44
+ _ = _w$size === void 0 ? "medium" : _w$size,
45
+ _w$align = w.align,
46
+ H = _w$align === void 0 ? "start" : _w$align,
47
+ _w$simple = w.simple,
48
+ J = _w$simple === void 0 ? !1 : _w$simple,
49
+ a = w.popupPlacement,
50
+ y = w.resolvePopupPlacement,
51
+ $ = w.dropdownClassName,
52
+ _w$t = w.t,
53
+ L = _w$t === void 0 ? function (e) {
54
+ return e;
55
+ } : _w$t,
56
+ M = w.className,
57
+ E = w.style,
58
+ _r$useState = r.useState(b),
59
+ _r$useState2 = _slicedToArray(_r$useState, 2),
60
+ Q = _r$useState2[0],
61
+ R = _r$useState2[1],
62
+ _r$useState3 = r.useState(N),
63
+ _r$useState4 = _slicedToArray(_r$useState3, 2),
64
+ W = _r$useState4[0],
65
+ F = _r$useState4[1],
66
+ _r$useState5 = r.useState(!1),
67
+ _r$useState6 = _slicedToArray(_r$useState5, 2),
68
+ g = _r$useState6[0],
69
+ f = _r$useState6[1],
70
+ _r$useState7 = r.useState("bottom"),
71
+ _r$useState8 = _slicedToArray(_r$useState7, 2),
72
+ C = _r$useState8[0],
73
+ G = _r$useState8[1],
74
+ _r$useState9 = r.useState(null),
75
+ _r$useState0 = _slicedToArray(_r$useState9, 2),
76
+ k = _r$useState0[0],
77
+ K = _r$useState0[1],
78
+ d = r.useRef(null),
79
+ O = r.useRef(null),
80
+ s = c != null ? c : Q,
81
+ p = m != null ? m : W,
82
+ o = Math.ceil(x / p);
83
+ if (T && o <= 1) return null;
84
+ var u = function u(e) {
85
+ l || e < 1 || e > o || e === s || (c === void 0 && R(e), j == null || j(e, p));
86
+ },
87
+ U = function U(e) {
88
+ var i = Math.ceil(x / e),
89
+ n = Math.min(s, i) || 1;
90
+ m === void 0 && (F(e), c === void 0 && R(n)), z == null || z(n, e), j == null || j(n, e);
91
+ },
92
+ B = function B(e) {
93
+ if (!d.current) return;
94
+ var i = d.current.getBoundingClientRect();
95
+ K({
96
+ left: i.left + i.width / 2,
97
+ top: e === "bottom" ? i.bottom + 4 : i.top - 4
98
+ });
99
+ },
100
+ V = function V() {
101
+ var e;
102
+ if (l) return;
103
+ if (g) {
104
+ f(!1);
105
+ return;
106
+ }
107
+ var i = C;
108
+ if (a === void 0 && d.current) {
109
+ var n = d.current.getBoundingClientRect(),
110
+ h = S.length * 40 + 8,
111
+ v = window.innerHeight;
112
+ i = (e = y == null ? void 0 : y({
113
+ triggerRect: n,
114
+ dropdownHeight: h,
115
+ viewportHeight: v
116
+ })) != null ? e : ae({
117
+ triggerRect: n,
118
+ dropdownHeight: h,
119
+ viewportHeight: v
120
+ }), G(i);
121
+ }
122
+ B(a != null ? a : i), f(!0);
123
+ },
124
+ X = function X(e) {
125
+ U(e), f(!1);
126
+ };
127
+ r.useEffect(function () {
128
+ var e = function e(h) {
129
+ var v, I;
130
+ var Z = h.target;
131
+ (v = d.current) != null && v.contains(Z) || (I = O.current) != null && I.contains(Z) || f(!1);
132
+ },
133
+ i = function i() {
134
+ return f(!1);
135
+ },
136
+ n = function n() {
137
+ return B(a != null ? a : C);
138
+ };
139
+ if (g) return document.addEventListener("mousedown", e), document.addEventListener("scroll", i, !0), window.addEventListener("resize", n), function () {
140
+ document.removeEventListener("mousedown", e), document.removeEventListener("scroll", i, !0), window.removeEventListener("resize", n);
141
+ };
142
+ }, [g, a, C]);
143
+ var Y = function Y(e) {
144
+ var i = parseInt(e.target.value);
145
+ !isNaN(i) && i >= 1 && i <= o && u(i);
146
+ },
147
+ ee = r.useMemo(function () {
148
+ var e = [];
149
+ if (o <= 7) for (var n = 1; n <= o; n++) e.push(n);else if (s <= 4) {
150
+ for (var _n = 1; _n <= 5; _n++) e.push(_n);
151
+ e.push("..."), e.push(o);
152
+ } else if (s >= o - 3) {
153
+ e.push(1), e.push("...");
154
+ for (var _n2 = o - 4; _n2 <= o; _n2++) e.push(_n2);
155
+ } else {
156
+ e.push(1), e.push("...");
157
+ for (var _n3 = s - 1; _n3 <= s + 1; _n3++) e.push(_n3);
158
+ e.push("..."), e.push(o);
159
+ }
160
+ return e;
161
+ }, [s, o]),
162
+ te = (s - 1) * p + 1,
163
+ ne = Math.min(s * p, x),
164
+ ie = "pagination-".concat(_),
165
+ se = "pagination-".concat(H),
166
+ D = l ? "pagination-disabled" : "",
167
+ oe = function oe(e, i) {
168
+ if (e === "...") return t.jsx("span", {
169
+ className: "pagination-item pagination-ellipsis",
170
+ children: "..."
171
+ }, "ellipsis-".concat(i));
172
+ var h = e === s ? "pagination-item-active" : "";
173
+ return t.jsx("button", {
174
+ type: "button",
175
+ className: "pagination-item ".concat(h),
176
+ onClick: function onClick() {
177
+ return u(e);
178
+ },
179
+ disabled: l,
180
+ children: e
181
+ }, e);
182
+ };
183
+ return J ? t.jsx("div", {
184
+ className: "pagination pagination-simple ".concat(D, " ").concat(M || ""),
185
+ style: E,
186
+ children: t.jsxs("div", {
187
+ className: "pagination-simple-list",
188
+ children: [t.jsx("button", {
189
+ type: "button",
190
+ className: "pagination-simple-item pagination-simple-prev",
191
+ onClick: function onClick() {
192
+ return u(s - 1);
193
+ },
194
+ disabled: l || s === 1,
195
+ children: t.jsx("svg", {
196
+ width: "12",
197
+ height: "12",
198
+ viewBox: "0 0 12 12",
199
+ fill: "none",
200
+ children: t.jsx("path", {
201
+ d: "M8 2L4 6L8 10",
202
+ stroke: "currentColor",
203
+ strokeWidth: "1.5",
204
+ strokeLinecap: "round",
205
+ strokeLinejoin: "round"
206
+ })
207
+ })
208
+ }), t.jsxs("span", {
209
+ className: "pagination-simple-text",
210
+ children: [s, " / ", o || 0]
211
+ }), t.jsx("button", {
212
+ type: "button",
213
+ className: "pagination-simple-item pagination-simple-next",
214
+ onClick: function onClick() {
215
+ return u(s + 1);
216
+ },
217
+ disabled: l || s === o,
218
+ children: t.jsx("svg", {
219
+ width: "12",
220
+ height: "12",
221
+ viewBox: "0 0 12 12",
222
+ fill: "none",
223
+ children: t.jsx("path", {
224
+ d: "M4 2L8 6L4 10",
225
+ stroke: "currentColor",
226
+ strokeWidth: "1.5",
227
+ strokeLinecap: "round",
228
+ strokeLinejoin: "round"
229
+ })
230
+ })
231
+ })]
232
+ })
233
+ }) : t.jsxs("div", {
234
+ className: "pagination ".concat(ie, " ").concat(se, " ").concat(D, " ").concat(M || ""),
235
+ style: E,
236
+ children: [typeof P == "function" && t.jsx("div", {
237
+ className: "pagination-total",
238
+ children: P(x, [te, ne])
239
+ }), t.jsxs("div", {
240
+ className: "pagination-list",
241
+ children: [t.jsx("button", {
242
+ type: "button",
243
+ className: "pagination-item pagination-prev",
244
+ onClick: function onClick() {
245
+ return u(s - 1);
246
+ },
247
+ disabled: l || s === 1,
248
+ children: t.jsxs("svg", {
249
+ width: "20",
250
+ height: "20",
251
+ viewBox: "0 0 20 20",
252
+ fill: "none",
253
+ xmlns: "http://www.w3.org/2000/svg",
254
+ children: [t.jsx("path", {
255
+ 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",
256
+ fill: "#333333"
257
+ }), t.jsx("path", {
258
+ 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",
259
+ fill: "black",
260
+ fillOpacity: "0.2"
261
+ })]
262
+ })
263
+ }), ee.map(function (e, i) {
264
+ return oe(e, i);
265
+ }), t.jsx("button", {
266
+ type: "button",
267
+ className: "pagination-item pagination-next",
268
+ onClick: function onClick() {
269
+ return u(s + 1);
270
+ },
271
+ disabled: l || s === o,
272
+ children: t.jsxs("svg", {
273
+ width: "20",
274
+ height: "20",
275
+ viewBox: "0 0 20 20",
276
+ fill: "none",
277
+ xmlns: "http://www.w3.org/2000/svg",
278
+ children: [t.jsx("path", {
279
+ 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",
280
+ fill: "#333333"
281
+ }), t.jsx("path", {
282
+ 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",
283
+ fill: "black",
284
+ fillOpacity: "0.2"
285
+ })]
286
+ })
287
+ })]
288
+ }), A && t.jsxs("div", {
289
+ className: "pagination-sizer",
290
+ ref: d,
291
+ children: [t.jsxs("button", {
292
+ type: "button",
293
+ className: "pagination-sizer-select",
294
+ onClick: V,
295
+ disabled: l,
296
+ children: [p, L("条/页"), t.jsxs("svg", {
297
+ className: "pagination-sizer-icon".concat(g ? " pagination-sizer-icon-open" : ""),
298
+ width: "20",
299
+ height: "20",
300
+ viewBox: "0 0 20 20",
301
+ fill: "none",
302
+ xmlns: "http://www.w3.org/2000/svg",
303
+ children: [t.jsx("path", {
304
+ 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",
305
+ fill: "#333333"
306
+ }), t.jsx("path", {
307
+ 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",
308
+ fill: "black",
309
+ fillOpacity: "0.2"
310
+ })]
311
+ })]
312
+ }), g && k && le.createPortal(t.jsx("div", {
313
+ ref: O,
314
+ className: "pagination-sizer-dropdown pagination-sizer-dropdown-".concat(a != null ? a : C).concat($ ? " ".concat($) : ""),
315
+ style: {
316
+ position: "fixed",
317
+ left: k.left,
318
+ top: k.top,
319
+ zIndex: 99999,
320
+ transform: (a != null ? a : C) === "bottom" ? "translate(-50%, 0)" : "translate(-50%, -100%)"
321
+ },
322
+ children: S.map(function (e) {
323
+ return t.jsxs("button", {
324
+ type: "button",
325
+ className: "pagination-sizer-option",
326
+ onClick: function onClick() {
327
+ return X(e);
328
+ },
329
+ "data-selected": e === p,
330
+ children: [e, L("条/页")]
331
+ }, e);
332
+ })
333
+ }), document.body)]
334
+ }), q && t.jsxs("div", {
335
+ className: "pagination-jumper",
336
+ children: [t.jsx("span", {
337
+ children: L("跳至")
338
+ }), t.jsx("input", {
339
+ type: "number",
340
+ className: "pagination-jumper-input",
341
+ min: 1,
342
+ max: o,
343
+ onChange: Y,
344
+ disabled: l,
345
+ placeholder: ""
346
+ }), t.jsx("span", {
347
+ children: L("页")
348
+ })]
349
+ })]
350
+ });
351
+ };
352
+ module.exports = re;