bj-web-components 0.2.12 → 0.2.14

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 (45) hide show
  1. package/README.md +38 -0
  2. package/dist/index.d.ts +585 -4
  3. package/dist/index.js +1 -1
  4. package/dist/index.mjs +45 -26
  5. package/dist/style.css +1 -1
  6. package/dist/web/BasicInput/BInput.js +1 -0
  7. package/dist/web/BasicInput/BInput.mjs +177 -0
  8. package/dist/web/BasicInput/utils.js +1 -0
  9. package/dist/web/BasicInput/utils.mjs +37 -0
  10. package/dist/web/CheckBox/BCheckBox.js +1 -0
  11. package/dist/web/CheckBox/BCheckBox.mjs +101 -0
  12. package/dist/web/CheckBox/Group.js +1 -0
  13. package/dist/web/CheckBox/Group.mjs +67 -0
  14. package/dist/web/CheckBox/context.js +1 -0
  15. package/dist/web/CheckBox/context.mjs +5 -0
  16. package/dist/web/CheckBox/index.js +1 -0
  17. package/dist/web/CheckBox/index.mjs +8 -0
  18. package/dist/web/Dropdown/BDropdown.js +1 -0
  19. package/dist/web/Dropdown/BDropdown.mjs +160 -0
  20. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
  21. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
  22. package/dist/web/Pagination/Pagination.js +1 -1
  23. package/dist/web/Pagination/Pagination.mjs +1 -1
  24. package/dist/web/ProductField/ProductField.mjs +12 -12
  25. package/dist/web/SkuInputCard/SkuInputCard.mjs +26 -26
  26. package/dist/web/Table/BTable.js +1 -0
  27. package/dist/web/Table/BTable.mjs +612 -0
  28. package/dist/web/Table/Column.js +1 -0
  29. package/dist/web/Table/Column.mjs +6 -0
  30. package/dist/web/Table/ColumnGroup.js +1 -0
  31. package/dist/web/Table/ColumnGroup.mjs +6 -0
  32. package/dist/web/Table/utils/columns.js +1 -0
  33. package/dist/web/Table/utils/columns.mjs +43 -0
  34. package/dist/web/Table/utils/sortFilter.js +1 -0
  35. package/dist/web/Table/utils/sortFilter.mjs +63 -0
  36. package/dist/web/Tabs/BTabs.js +1 -0
  37. package/dist/web/Tabs/BTabs.mjs +130 -0
  38. package/dist/web/Tabs/TabPane.js +1 -0
  39. package/dist/web/Tabs/TabPane.mjs +7 -0
  40. package/dist/web/Tooltip/ContentTooltip.js +1 -1
  41. package/dist/web/Tooltip/ContentTooltip.mjs +56 -20
  42. package/dist/web.d.ts +585 -4
  43. package/dist/web.js +1 -1
  44. package/dist/web.mjs +45 -26
  45. package/package.json +3 -3
@@ -0,0 +1,101 @@
1
+ import { jsxs as h, jsx as d } from "react/jsx-runtime";
2
+ import { forwardRef as S, useContext as g, useState as L, useRef as O, useEffect as x } from "react";
3
+ import $ from "../Icon/Icon.mjs";
4
+ import { CheckBoxGroupContext as q } from "./context.mjs";
5
+ /* empty css */
6
+ function u(...r) {
7
+ return r.filter(Boolean).join(" ");
8
+ }
9
+ const z = S((r, p) => {
10
+ const {
11
+ checked: k,
12
+ defaultChecked: j = !1,
13
+ disabled: v,
14
+ indeterminate: o = !1,
15
+ children: b,
16
+ className: C,
17
+ style: N,
18
+ onChange: i,
19
+ onMouseEnter: _,
20
+ onMouseLeave: B,
21
+ value: c,
22
+ skipGroup: V = !1,
23
+ direction: w = "ltr",
24
+ name: y,
25
+ variant: m = "dark",
26
+ ...E
27
+ } = r, e = g(q), [D, G] = L(j), s = O(c), a = !!(e && !V), t = a ? e.value.includes(c) : k ?? D, n = (e == null ? void 0 : e.disabled) || v, P = a ? e == null ? void 0 : e.name : y, I = a ? (e == null ? void 0 : e.variant) ?? m : m;
28
+ x(() => {
29
+ if (!(!a || c === void 0))
30
+ return e == null || e.registerValue(c), () => e == null ? void 0 : e.cancelValue(c);
31
+ }, [e, a, c]), x(() => {
32
+ !a || s.current === c || (s.current !== void 0 && (e == null || e.cancelValue(s.current)), c !== void 0 && (e == null || e.registerValue(c)), s.current = c);
33
+ }, [e, a, c]);
34
+ const M = (l) => {
35
+ if (n) return;
36
+ const f = l.target.checked;
37
+ !a && k === void 0 && G(f);
38
+ const R = {
39
+ target: { ...r, checked: f },
40
+ stopPropagation: () => l.stopPropagation(),
41
+ preventDefault: () => l.preventDefault(),
42
+ nativeEvent: l.nativeEvent
43
+ };
44
+ i == null || i(R), a && c !== void 0 && (e == null || e.toggleOption({ label: b, value: c, disabled: n, onChange: i }));
45
+ };
46
+ return /* @__PURE__ */ h(
47
+ "label",
48
+ {
49
+ className: u(
50
+ "bj-checkbox-wrapper",
51
+ t && "bj-checkbox-wrapper--checked",
52
+ n && "bj-checkbox-wrapper--disabled",
53
+ w === "rtl" && "bj-checkbox-wrapper--rtl",
54
+ C
55
+ ),
56
+ onMouseEnter: _,
57
+ onMouseLeave: B,
58
+ style: N,
59
+ children: [
60
+ /* @__PURE__ */ h(
61
+ "span",
62
+ {
63
+ className: u(
64
+ "bj-checkbox",
65
+ t && "bj-checkbox--checked",
66
+ n && "bj-checkbox--disabled",
67
+ o && "bj-checkbox--indeterminate",
68
+ `bj-checkbox--${I}`
69
+ ),
70
+ children: [
71
+ /* @__PURE__ */ d(
72
+ "input",
73
+ {
74
+ ...E,
75
+ "aria-checked": o ? "mixed" : t,
76
+ checked: t,
77
+ className: "bj-checkbox__input",
78
+ disabled: n,
79
+ name: P,
80
+ onChange: M,
81
+ ref: p,
82
+ type: "checkbox",
83
+ value: typeof c == "boolean" ? String(c) : c
84
+ }
85
+ ),
86
+ /* @__PURE__ */ h("span", { className: "bj-checkbox__inner", children: [
87
+ t && !o && /* @__PURE__ */ d($, { className: "bj-checkbox__check-icon", type: "icon-a-dagouxi" }),
88
+ o && /* @__PURE__ */ d("span", { className: "bj-checkbox__indeterminate-mark" })
89
+ ] })
90
+ ]
91
+ }
92
+ ),
93
+ b !== void 0 && /* @__PURE__ */ d("span", { className: "bj-checkbox__label", children: b })
94
+ ]
95
+ }
96
+ );
97
+ });
98
+ z.displayName = "BCheckBox";
99
+ export {
100
+ z as default
101
+ };
@@ -0,0 +1 @@
1
+ "use strict";const d=require("react/jsx-runtime"),c=require("react"),z=require("./BCheckBox.js"),C=require("./context.js");function M(n){return(n??[]).map(t=>typeof t=="string"||typeof t=="number"?{label:t,value:t}:t)}const h=c.forwardRef(({defaultValue:n=[],value:t,onChange:i,options:f,children:j,disabled:o,name:m,className:k,style:B,direction:O="ltr",variant:v="dark"},y)=>{const[p,g]=c.useState(n),[x,b]=c.useState([]),u=t??p,l=c.useMemo(()=>M(f),[f]);c.useEffect(()=>{t!==void 0&&g(t)},[t]);const q=e=>{b(r=>r.includes(e)?r:[...r,e])},V=e=>{b(r=>r.filter(a=>a!==e))},G=e=>{const r=u.includes(e.value)?u.filter(s=>s!==e.value):[...u,e.value];t===void 0&&g(r);const a=l.length>0?l.map(s=>s.value):x;i==null||i(r.filter(s=>x.includes(s)).sort((s,S)=>a.indexOf(s)-a.indexOf(S)))},N=c.useMemo(()=>({name:m,value:u,disabled:o,variant:v,registerValue:q,cancelValue:V,toggleOption:G}),[o,u,m,x,v]),R=l.length>0?l.map(e=>d.jsx(z,{className:"bj-checkbox-group__item",disabled:e.disabled??o,onChange:e.onChange,style:e.style,value:e.value,children:e.label},String(e.value))):j;return d.jsx("div",{className:["bj-checkbox-group",O==="rtl"?"bj-checkbox-group--rtl":"",k].filter(Boolean).join(" "),ref:y,style:B,children:d.jsx(C.CheckBoxGroupContext.Provider,{value:N,children:R})})});h.displayName="BCheckBox.Group";module.exports=h;
@@ -0,0 +1,67 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as S, useState as b, useMemo as h, useEffect as _ } from "react";
3
+ import w from "./BCheckBox.mjs";
4
+ import { CheckBoxGroupContext as E } from "./context.mjs";
5
+ function I(u) {
6
+ return (u ?? []).map((r) => typeof r == "string" || typeof r == "number" ? { label: r, value: r } : r);
7
+ }
8
+ const M = S(({
9
+ defaultValue: u = [],
10
+ value: r,
11
+ onChange: i,
12
+ options: m,
13
+ children: p,
14
+ disabled: n,
15
+ name: d,
16
+ className: k,
17
+ style: B,
18
+ direction: O = "ltr",
19
+ variant: x = "dark"
20
+ }, j) => {
21
+ const [y, v] = b(u), [f, g] = b([]), s = r ?? y, c = h(() => I(m), [m]);
22
+ _(() => {
23
+ r !== void 0 && v(r);
24
+ }, [r]);
25
+ const V = (e) => {
26
+ g((t) => t.includes(e) ? t : [...t, e]);
27
+ }, G = (e) => {
28
+ g((t) => t.filter((a) => a !== e));
29
+ }, N = (e) => {
30
+ const t = s.includes(e.value) ? s.filter((l) => l !== e.value) : [...s, e.value];
31
+ r === void 0 && v(t);
32
+ const a = c.length > 0 ? c.map((l) => l.value) : f;
33
+ i == null || i(t.filter((l) => f.includes(l)).sort((l, R) => a.indexOf(l) - a.indexOf(R)));
34
+ }, z = h(() => ({
35
+ name: d,
36
+ value: s,
37
+ disabled: n,
38
+ variant: x,
39
+ registerValue: V,
40
+ cancelValue: G,
41
+ toggleOption: N
42
+ }), [n, s, d, f, x]), C = c.length > 0 ? c.map((e) => /* @__PURE__ */ o(
43
+ w,
44
+ {
45
+ className: "bj-checkbox-group__item",
46
+ disabled: e.disabled ?? n,
47
+ onChange: e.onChange,
48
+ style: e.style,
49
+ value: e.value,
50
+ children: e.label
51
+ },
52
+ String(e.value)
53
+ )) : p;
54
+ return /* @__PURE__ */ o(
55
+ "div",
56
+ {
57
+ className: ["bj-checkbox-group", O === "rtl" ? "bj-checkbox-group--rtl" : "", k].filter(Boolean).join(" "),
58
+ ref: j,
59
+ style: B,
60
+ children: /* @__PURE__ */ o(E.Provider, { value: z, children: C })
61
+ }
62
+ );
63
+ });
64
+ M.displayName = "BCheckBox.Group";
65
+ export {
66
+ M as default
67
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=e.createContext(null);exports.CheckBoxGroupContext=t;
@@ -0,0 +1,5 @@
1
+ import { createContext as o } from "react";
2
+ const e = o(null);
3
+ export {
4
+ e as CheckBoxGroupContext
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./BCheckBox.js"),r=require("./Group.js"),e=o;e.Group=r;e.__ANT_CHECKBOX=!0;exports.BCheckBox=e;
@@ -0,0 +1,8 @@
1
+ import r from "./BCheckBox.mjs";
2
+ import B from "./Group.mjs";
3
+ const o = r;
4
+ o.Group = B;
5
+ o.__ANT_CHECKBOX = !0;
6
+ export {
7
+ o as BCheckBox
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),U=require("react-dom"),X=require("../BasicInput/BInput.js"),Y=require("../CheckBox/index.js"),T=require("../Icon/Icon.js"),Z=require("../OverlayScrollbar/BOverlayScrollbar.js");;/* empty css */const $=require("../Tooltip/ContentTooltip.js");require("../Tooltip/TooltipWrapper.js");const ee=require("../ProductField/no_data_light.png.js");;/* empty css */function u(...t){return t.filter(Boolean).join(" ")}function ne(t){return typeof t.label=="string"||typeof t.label=="number"?String(t.label):String(t.value)}function V({option:t}){const i=r.useRef(null),[b,o]=r.useState(!1),[l,m]=r.useState(null),p=typeof t.label=="string"||typeof t.label=="number",j=p?String(t.label):t.label;function _(){const a=i.current;p&&a&&a.scrollWidth>a.clientWidth&&(m(a.getBoundingClientRect()),o(!0))}return n.jsxs("span",{ref:i,className:"bj-dropdown__option-label",onMouseEnter:_,onMouseLeave:()=>o(!1),children:[j,b&&l&&typeof document<"u"&&U.createPortal(n.jsx("span",{className:"bj-dropdown__option-tooltip-anchor",style:{position:"fixed",top:l.top,left:l.left,width:l.width,height:l.height},children:n.jsx($,{className:"bj-dropdown__option-tooltip",content:j,placement:"top"})}),document.body)]})}function D({option:t,doubleLine:i}){return i?n.jsxs("span",{className:"bj-dropdown__option-content",children:[n.jsx(V,{option:t}),t.description!==void 0&&n.jsx("span",{className:"bj-dropdown__option-description",children:t.description})]}):n.jsx(V,{option:t})}function te({className:t,style:i,options:b,value:o,defaultValue:l=[],multiple:m=!1,optionMode:p="single-line",searchable:j=!1,searchValue:_,searchPlaceholder:a="搜索",onSearch:f,filterOption:v=!0,emptyText:I,labels:g,t:O=h=>h,optionRender:x,onChange:y,footer:N=!0,showReset:E=!0,showConfirm:P=!0,resetText:W="重置",confirmText:z="确定",onReset:q,onConfirm:L}){const h=r.useRef(null),k=r.useRef(null),[A,C]=r.useState(l),[G,F]=r.useState(""),s=o??A,d=m===!0,c=p==="double-line",w=_??G,H=I??(g==null?void 0:g.emptyText)??O("暂无结果"),S=!f&&v!==!1&&w?b.filter(e=>typeof v=="function"?v(w,e):ne(e).toLocaleLowerCase().includes(w.toLocaleLowerCase())):b;function J(e,B){o===void 0&&C(e),y==null||y(e,B)}function M(e){_===void 0&&F(e),f==null||f(e)}function R(e){if(e.disabled)return;const B=d?s.includes(e.value)?s.filter(Q=>Q!==e.value):[...s,e.value]:[e.value];J(B,e)}function K(){o===void 0&&C([]),q==null||q()}return n.jsxs("div",{ref:h,className:u("bj-dropdown",c&&"bj-dropdown--double-line",!d&&"bj-dropdown--single",t),role:"dialog",style:i,children:[j&&n.jsx("div",{className:"bj-dropdown__search",children:n.jsx(X,{"aria-label":"搜索选项",allowClear:{clearIcon:n.jsx(T,{className:"bj-dropdown__search-clear-icon",type:"icon-a-guanbixi"})},onChange:e=>M(e.target.value),onClear:()=>M(""),placeholder:a,prefix:n.jsx(T,{type:"icon-a-sousuoxi"}),inputMode:"search",role:"searchbox",type:"text",value:w})}),n.jsxs("div",{ref:k,className:u("bj-dropdown__options","bj-overlay-scrollbar-hidden",S.length===0&&"bj-dropdown__options--empty",!d&&"bj-dropdown__options--single"),children:[S.map(e=>d?n.jsx(Y.BCheckBox,{checked:s.includes(e.value),className:u("bj-dropdown__option",c&&e.description!==void 0&&"bj-dropdown__option--double-line"),disabled:e.disabled,onChange:()=>R(e),skipGroup:!0,variant:"white",children:x?x(e):n.jsx(D,{doubleLine:c&&e.description!==void 0,option:e})},String(e.value)):n.jsxs("button",{"aria-pressed":s.includes(e.value),className:u("bj-dropdown__option","bj-dropdown__option--single",c&&e.description!==void 0&&"bj-dropdown__option--double-line",s.includes(e.value)&&"bj-dropdown__option--selected"),disabled:e.disabled,onClick:()=>R(e),type:"button",children:[x?n.jsx("span",{className:"bj-dropdown__option-label",children:x(e)}):n.jsx(D,{doubleLine:c&&e.description!==void 0,option:e}),s.includes(e.value)&&n.jsx(T,{className:"bj-dropdown__option-icon",type:"icon-a-dagouxi"})]},String(e.value))),S.length===0&&n.jsxs("div",{className:"bj-dropdown__empty",children:[n.jsx("img",{alt:"",className:"bj-dropdown__empty-image",src:ee}),n.jsx("span",{className:"bj-dropdown__empty-text",children:H})]})]}),n.jsx(Z,{containerRef:h,gap:2,size:2,targetRef:k}),N!==!1&&(N!==!0?N:n.jsxs("div",{className:u("bj-dropdown__actions",!d&&"bj-dropdown__actions--single"),children:[E&&n.jsx("button",{onClick:K,type:"button",children:W}),d&&P&&n.jsx("button",{onClick:()=>L==null?void 0:L(s),type:"button",children:z})]}))]})}exports.BDropdown=te;
@@ -0,0 +1,160 @@
1
+ import { jsxs as r, jsx as l } from "react/jsx-runtime";
2
+ import { useRef as V, 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 T from "../Icon/Icon.mjs";
7
+ import ee from "../OverlayScrollbar/BOverlayScrollbar.mjs";
8
+ /* empty css */
9
+ import le from "../Tooltip/ContentTooltip.mjs";
10
+ import "../Tooltip/TooltipWrapper.mjs";
11
+ import ne from "../ProductField/no_data_light.png.mjs";
12
+ /* empty css */
13
+ function u(...n) {
14
+ return n.filter(Boolean).join(" ");
15
+ }
16
+ function te(n) {
17
+ return typeof n.label == "string" || typeof n.label == "number" ? String(n.label) : String(n.value);
18
+ }
19
+ function D({ option: n }) {
20
+ const d = V(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));
24
+ }
25
+ return /* @__PURE__ */ r(
26
+ "span",
27
+ {
28
+ ref: d,
29
+ className: "bj-dropdown__option-label",
30
+ onMouseEnter: f,
31
+ onMouseLeave: () => i(!1),
32
+ children: [
33
+ m,
34
+ p && o && typeof document < "u" && Y(
35
+ /* @__PURE__ */ l(
36
+ "span",
37
+ {
38
+ className: "bj-dropdown__option-tooltip-anchor",
39
+ style: {
40
+ position: "fixed",
41
+ top: o.top,
42
+ left: o.left,
43
+ width: o.width,
44
+ height: o.height
45
+ },
46
+ children: /* @__PURE__ */ l(le, { className: "bj-dropdown__option-tooltip", content: m, placement: "top" })
47
+ }
48
+ ),
49
+ document.body
50
+ )
51
+ ]
52
+ }
53
+ );
54
+ }
55
+ function R({ option: n, doubleLine: d }) {
56
+ return d ? /* @__PURE__ */ r("span", { className: "bj-dropdown__option-content", children: [
57
+ /* @__PURE__ */ l(D, { option: n }),
58
+ n.description !== void 0 && /* @__PURE__ */ l("span", { className: "bj-dropdown__option-description", children: n.description })
59
+ ] }) : /* @__PURE__ */ l(D, { option: n });
60
+ }
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: W,
75
+ labels: N,
76
+ t: z = (w) => w,
77
+ optionRender: h,
78
+ onChange: x,
79
+ footer: B = !0,
80
+ showReset: A = !0,
81
+ showConfirm: G = !0,
82
+ resetText: P = "重置",
83
+ confirmText: q = "确定",
84
+ onReset: L,
85
+ onConfirm: k
86
+ }) {
87
+ const w = V(null), M = V(null), [F, S] = j(o), [H, J] = j(""), t = i ?? F, s = g === !0, c = b === "double-line", v = f ?? H, K = W ?? (N == null ? void 0 : N.emptyText) ?? z("暂无结果"), C = !_ && y !== !1 && v ? p.filter((e) => typeof y == "function" ? y(v, e) : te(e).toLocaleLowerCase().includes(v.toLocaleLowerCase())) : p;
88
+ function Q(e, I) {
89
+ i === void 0 && S(e), x == null || x(e, I);
90
+ }
91
+ function E(e) {
92
+ f === void 0 && J(e), _ == null || _(e);
93
+ }
94
+ function O(e) {
95
+ if (e.disabled) return;
96
+ const I = s ? t.includes(e.value) ? t.filter((X) => X !== e.value) : [...t, e.value] : [e.value];
97
+ Q(I, e);
98
+ }
99
+ function U() {
100
+ i === void 0 && S([]), L == null || L();
101
+ }
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,
105
+ {
106
+ "aria-label": "搜索选项",
107
+ allowClear: { clearIcon: /* @__PURE__ */ l(T, { className: "bj-dropdown__search-clear-icon", type: "icon-a-guanbixi" }) },
108
+ onChange: (e) => E(e.target.value),
109
+ onClear: () => E(""),
110
+ placeholder: a,
111
+ prefix: /* @__PURE__ */ l(T, { type: "icon-a-sousuoxi" }),
112
+ inputMode: "search",
113
+ role: "searchbox",
114
+ type: "text",
115
+ value: v
116
+ }
117
+ ) }),
118
+ /* @__PURE__ */ r("div", { ref: M, className: u("bj-dropdown__options", "bj-overlay-scrollbar-hidden", C.length === 0 && "bj-dropdown__options--empty", !s && "bj-dropdown__options--single"), children: [
119
+ C.map((e) => s ? /* @__PURE__ */ l(
120
+ $,
121
+ {
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: () => O(e),
126
+ skipGroup: !0,
127
+ variant: "white",
128
+ children: h ? h(e) : /* @__PURE__ */ l(R, { doubleLine: c && e.description !== void 0, option: e })
129
+ },
130
+ String(e.value)
131
+ ) : /* @__PURE__ */ r(
132
+ "button",
133
+ {
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: () => O(e),
138
+ type: "button",
139
+ children: [
140
+ h ? /* @__PURE__ */ l("span", { className: "bj-dropdown__option-label", children: h(e) }) : /* @__PURE__ */ l(R, { doubleLine: c && e.description !== void 0, option: e }),
141
+ t.includes(e.value) && /* @__PURE__ */ l(T, { className: "bj-dropdown__option-icon", type: "icon-a-dagouxi" })
142
+ ]
143
+ },
144
+ String(e.value)
145
+ )),
146
+ C.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 })
149
+ ] })
150
+ ] }),
151
+ /* @__PURE__ */ l(ee, { containerRef: w, gap: 2, size: 2, targetRef: M }),
152
+ B !== !1 && (B !== !0 ? B : /* @__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: () => k == null ? void 0 : k(t), type: "button", children: q })
155
+ ] }))
156
+ ] });
157
+ }
158
+ export {
159
+ _e as BDropdown
160
+ };
@@ -0,0 +1 @@
1
+ "use strict";const Y=require("react/jsx-runtime"),s=require("react");;/* empty css */const $=24,re=800,H={visible:!1,offset:0,length:0,cross:0};function se({containerRef:_,targetRef:j,selector:U,direction:S="vertical",size:E=4,gap:w=0,background:F,showOnHover:l=!0,showOnScroll:Z=!0,hoverSelector:A,horizontalInsetStart:p=0,horizontalInsetEnd:D=0,horizontalThumbLength:R,className:te=""}){const P=S==="vertical"||S==="both",V=S==="horizontal"||S==="both",m=s.useRef(null),f=s.useRef(null),y=s.useRef(null),L=s.useRef(!1),M=s.useRef(!1),[k,G]=s.useState(H),[B,J]=s.useState(H),[ne,v]=s.useState(!l);s.useEffect(()=>{l||v(!0)},[l]);const g=s.useCallback(()=>{const e=m.current,n=_.current;if(!e||!n)return;const{scrollTop:t,scrollHeight:o,clientHeight:c,scrollLeft:d,scrollWidth:u,clientWidth:i}=e,h=e.getBoundingClientRect(),r=n.getBoundingClientRect(),b=h.top-r.top,x=h.left-r.left;if(P){const C=o-c;if(C<=1)G(a=>a.visible?H:a);else{const a=Math.max(c/o*c,$);G({visible:!0,offset:b+t/C*(c-a),length:a,cross:x+i-E-w})}}if(V){const C=u-i,a=Math.max(i-p-D,0);if(C<=1||a<=0)J(W=>W.visible?H:W);else{const W=i/u*a,ee=Math.min(a,Math.max(R??W,$));J({visible:!0,offset:x+p+d/C*(a-ee),length:ee,cross:b+c-E-w})}}},[_,w,D,p,R,V,P,E]),q=s.useCallback(()=>{if(!l)return;const e=L.current||M.current||f.current;if(!Z&&!e){v(!1);return}v(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{!f.current&&!L.current&&!M.current&&v(!1)},re)},[l,Z]),X=s.useCallback(()=>{g(),q()},[g,q]);s.useEffect(()=>{const e=_.current;if(!e)return;window.getComputedStyle(e).position==="static"&&(e.style.position="relative");let n,t=null;const o=()=>{const r=(j==null?void 0:j.current)??(U?e.querySelector(U):e.firstElementChild);if(!r||r===m.current)return;n==null||n(),m.current=r,r.addEventListener("scroll",X,{passive:!0});const b=new ResizeObserver(g);b.observe(r),r.firstElementChild&&b.observe(r.firstElementChild),n=()=>{r.removeEventListener("scroll",X),b.disconnect()},g()},c=()=>{L.current=!0,l&&v(!0)},d=()=>{L.current=!1,l&&!M.current&&!f.current&&v(!1)},u=()=>{t==null||t.removeEventListener("mouseenter",c),t==null||t.removeEventListener("mouseleave",d),t=null,L.current=!1},i=()=>{const r=A?e.querySelector(A):e;!r||r===t||(u(),t=r,t.addEventListener("mouseenter",c),t.addEventListener("mouseleave",d))};o(),i();const h=new MutationObserver(()=>{(!m.current||!e.contains(m.current))&&o(),t&&!e.contains(t)&&u(),t||i(),g()});return h.observe(e,{childList:!0,subtree:!0}),()=>{h.disconnect(),n==null||n(),u(),m.current=null,y.current&&clearTimeout(y.current)}},[_,A,X,U,l,g,j]);const T=s.useCallback(e=>{const n=m.current,t=f.current;if(!n||!t)return;const o=t.axis==="vertical",c=o?n.clientHeight:n.clientWidth,d=o?n.scrollHeight:n.scrollWidth,u=o?c:Math.max(c-p-D,0),i=c/d*u,h=Math.min(u,Math.max(o?i:R??i,$)),r=u-h;if(r<=0)return;const b=(o?e.clientY:e.clientX)-t.client,x=t.scroll+b*((d-c)/r);o?n.scrollTop=x:n.scrollLeft=x},[D,p,R]),N=s.useCallback(()=>{const e=!!f.current;f.current=null,document.body.style.userSelect="",document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",N),e&&q()},[T,q]),K=e=>n=>{const t=m.current;t&&(n.preventDefault(),n.stopPropagation(),f.current={axis:e,client:e==="vertical"?n.clientY:n.clientX,scroll:e==="vertical"?t.scrollTop:t.scrollLeft},document.body.style.userSelect="none",document.addEventListener("mousemove",T),document.addEventListener("mouseup",N))};s.useEffect(()=>()=>{f.current=null,document.body.style.userSelect="",document.removeEventListener("mousemove",T),document.removeEventListener("mouseup",N)},[N,T]);const Q=["bj-overlay-scrollbar__thumb",ne&&"bj-overlay-scrollbar__thumb--active",te].filter(Boolean).join(" "),I=F?{"--bj-overlay-scrollbar-bg":F}:void 0,z=()=>{M.current=!0,l&&v(!0)},O=()=>{M.current=!1,l&&!L.current&&!f.current&&v(!1)};return Y.jsxs(Y.Fragment,{children:[P&&k.visible&&Y.jsx("div",{className:`${Q} bj-overlay-scrollbar__thumb--vertical`,onMouseDown:K("vertical"),onMouseEnter:z,onMouseLeave:O,style:{...I,top:k.offset,left:k.cross,height:k.length,width:E}}),V&&B.visible&&Y.jsx("div",{className:`${Q} bj-overlay-scrollbar__thumb--horizontal`,onMouseDown:K("horizontal"),onMouseEnter:z,onMouseLeave:O,style:{...I,left:B.offset,top:B.cross,width:B.length,height:E}})]})}module.exports=se;
@@ -0,0 +1,152 @@
1
+ import { jsxs as se, Fragment as le, jsx as re } from "react/jsx-runtime";
2
+ import { useRef as x, useState as $, useEffect as F, useCallback as D } from "react";
3
+ /* empty css */
4
+ const Z = 24, ie = 800, U = { visible: !1, offset: 0, length: 0, cross: 0 };
5
+ function fe({
6
+ containerRef: j,
7
+ targetRef: C,
8
+ selector: q,
9
+ direction: S = "vertical",
10
+ size: g = 4,
11
+ gap: w = 0,
12
+ background: G,
13
+ showOnHover: s = !0,
14
+ showOnScroll: J = !0,
15
+ hoverSelector: A,
16
+ horizontalInsetStart: p = 0,
17
+ horizontalInsetEnd: B = 0,
18
+ horizontalThumbLength: k,
19
+ className: ce = ""
20
+ }) {
21
+ const P = S === "vertical" || S === "both", V = S === "horizontal" || S === "both", m = x(null), a = x(null), y = x(null), h = x(!1), E = x(!1), [N, K] = $(U), [R, Q] = $(U), [oe, f] = $(!s);
22
+ F(() => {
23
+ s || f(!0);
24
+ }, [s]);
25
+ const L = D(() => {
26
+ const e = m.current, n = j.current;
27
+ if (!e || !n) return;
28
+ const { scrollTop: t, scrollHeight: o, clientHeight: c, scrollLeft: b, scrollWidth: l, clientWidth: i } = e, d = e.getBoundingClientRect(), r = n.getBoundingClientRect(), v = d.top - r.top, T = d.left - r.left;
29
+ if (P) {
30
+ const _ = o - c;
31
+ if (_ <= 1)
32
+ K((u) => u.visible ? U : u);
33
+ else {
34
+ const u = Math.max(c / o * c, Z);
35
+ K({
36
+ visible: !0,
37
+ offset: v + t / _ * (c - u),
38
+ length: u,
39
+ cross: T + i - g - w
40
+ });
41
+ }
42
+ }
43
+ if (V) {
44
+ const _ = l - i, u = Math.max(i - p - B, 0);
45
+ if (_ <= 1 || u <= 0)
46
+ Q((H) => H.visible ? U : H);
47
+ else {
48
+ const H = i / l * u, ne = Math.min(u, Math.max(k ?? H, Z));
49
+ Q({
50
+ visible: !0,
51
+ offset: T + p + b / _ * (u - ne),
52
+ length: ne,
53
+ cross: v + c - g - w
54
+ });
55
+ }
56
+ }
57
+ }, [j, w, B, p, k, V, P, g]), W = D(() => {
58
+ if (!s) return;
59
+ const e = h.current || E.current || a.current;
60
+ if (!J && !e) {
61
+ f(!1);
62
+ return;
63
+ }
64
+ f(!0), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
65
+ !a.current && !h.current && !E.current && f(!1);
66
+ }, ie);
67
+ }, [s, J]), X = D(() => {
68
+ L(), W();
69
+ }, [L, W]);
70
+ F(() => {
71
+ const e = j.current;
72
+ if (!e) return;
73
+ window.getComputedStyle(e).position === "static" && (e.style.position = "relative");
74
+ let n, t = null;
75
+ const o = () => {
76
+ const r = (C == null ? void 0 : C.current) ?? (q ? e.querySelector(q) : e.firstElementChild);
77
+ if (!r || r === m.current) return;
78
+ n == null || n(), m.current = r, r.addEventListener("scroll", X, { passive: !0 });
79
+ const v = new ResizeObserver(L);
80
+ v.observe(r), r.firstElementChild && v.observe(r.firstElementChild), n = () => {
81
+ r.removeEventListener("scroll", X), v.disconnect();
82
+ }, L();
83
+ }, c = () => {
84
+ h.current = !0, s && f(!0);
85
+ }, b = () => {
86
+ h.current = !1, s && !E.current && !a.current && f(!1);
87
+ }, l = () => {
88
+ t == null || t.removeEventListener("mouseenter", c), t == null || t.removeEventListener("mouseleave", b), t = null, h.current = !1;
89
+ }, i = () => {
90
+ const r = A ? e.querySelector(A) : e;
91
+ !r || r === t || (l(), t = r, t.addEventListener("mouseenter", c), t.addEventListener("mouseleave", b));
92
+ };
93
+ o(), i();
94
+ const d = new MutationObserver(() => {
95
+ (!m.current || !e.contains(m.current)) && o(), t && !e.contains(t) && l(), t || i(), L();
96
+ });
97
+ return d.observe(e, { childList: !0, subtree: !0 }), () => {
98
+ d.disconnect(), n == null || n(), l(), m.current = null, y.current && clearTimeout(y.current);
99
+ };
100
+ }, [j, A, X, q, s, L, C]);
101
+ const M = D((e) => {
102
+ const n = m.current, t = a.current;
103
+ if (!n || !t) return;
104
+ const o = t.axis === "vertical", c = o ? n.clientHeight : n.clientWidth, b = o ? n.scrollHeight : n.scrollWidth, l = o ? c : Math.max(c - p - B, 0), i = c / b * l, d = Math.min(l, Math.max(o ? i : k ?? i, Z)), r = l - d;
105
+ if (r <= 0) return;
106
+ const v = (o ? e.clientY : e.clientX) - t.client, T = t.scroll + v * ((b - c) / r);
107
+ o ? n.scrollTop = T : n.scrollLeft = T;
108
+ }, [B, p, k]), Y = D(() => {
109
+ const e = !!a.current;
110
+ a.current = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", Y), e && W();
111
+ }, [M, W]), I = (e) => (n) => {
112
+ const t = m.current;
113
+ t && (n.preventDefault(), n.stopPropagation(), a.current = {
114
+ axis: e,
115
+ client: e === "vertical" ? n.clientY : n.clientX,
116
+ scroll: e === "vertical" ? t.scrollTop : t.scrollLeft
117
+ }, document.body.style.userSelect = "none", document.addEventListener("mousemove", M), document.addEventListener("mouseup", Y));
118
+ };
119
+ F(() => () => {
120
+ a.current = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", Y);
121
+ }, [Y, M]);
122
+ const z = ["bj-overlay-scrollbar__thumb", oe && "bj-overlay-scrollbar__thumb--active", ce].filter(Boolean).join(" "), O = G ? { "--bj-overlay-scrollbar-bg": G } : void 0, ee = () => {
123
+ E.current = !0, s && f(!0);
124
+ }, te = () => {
125
+ E.current = !1, s && !h.current && !a.current && f(!1);
126
+ };
127
+ return /* @__PURE__ */ se(le, { children: [
128
+ P && N.visible && /* @__PURE__ */ re(
129
+ "div",
130
+ {
131
+ className: `${z} bj-overlay-scrollbar__thumb--vertical`,
132
+ onMouseDown: I("vertical"),
133
+ onMouseEnter: ee,
134
+ onMouseLeave: te,
135
+ style: { ...O, top: N.offset, left: N.cross, height: N.length, width: g }
136
+ }
137
+ ),
138
+ V && R.visible && /* @__PURE__ */ re(
139
+ "div",
140
+ {
141
+ className: `${z} bj-overlay-scrollbar__thumb--horizontal`,
142
+ onMouseDown: I("horizontal"),
143
+ onMouseEnter: ee,
144
+ onMouseLeave: te,
145
+ style: { ...O, left: R.offset, top: R.cross, width: R.length, height: g }
146
+ }
147
+ )
148
+ ] });
149
+ }
150
+ export {
151
+ fe as default
152
+ };
@@ -1 +1 @@
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)},B=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)}B(d??e),f(!0)},Y=e=>{V(e),f(!1)};l.useEffect(()=>{const e=m=>{var I,Z;const O=m.target;(I=p.current)!=null&&I.contains(O)||(Z=R.current)!=null&&Z.contains(O)||f(!1)},i=()=>f(!1),n=()=>B(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}`,D=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 ${D} ${$||""}`,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} ${D} ${$||""}`,style:M,children:[y&&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","fill-opacity":"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";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)},B=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)}B(d??e),f(!0)},Y=e=>{V(e),f(!1)};l.useEffect(()=>{const e=m=>{var I,Z;const O=m.target;(I=p.current)!=null&&I.contains(O)||(Z=R.current)!=null&&Z.contains(O)||f(!1)},i=()=>f(!1),n=()=>B(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}`,D=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 ${D} ${$||""}`,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} ${D} ${$||""}`,style:M,children:[y&&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","fill-opacity":"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;
@@ -188,7 +188,7 @@ const ft = (v) => {
188
188
  disabled: l,
189
189
  children: [
190
190
  u,
191
- N("条每页"),
191
+ N("条/页"),
192
192
  /* @__PURE__ */ a("svg", { className: `pagination-sizer-icon${m ? " pagination-sizer-icon-open" : ""}`, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
193
193
  /* @__PURE__ */ i("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" }),
194
194
  /* @__PURE__ */ i("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" })