bj-web-components 0.2.25 → 0.2.26
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/package.json +1 -1
- package/dist/favicon.ico +0 -0
- package/dist/file.svg +0 -1
- package/dist/globe.svg +0 -1
- package/dist/index.d.ts +0 -1139
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -51
- package/dist/miniapp.d.ts +0 -1
- package/dist/miniapp.js +0 -1
- package/dist/miniapp.mjs +0 -1
- package/dist/mobile.d.ts +0 -1
- package/dist/mobile.js +0 -1
- package/dist/mobile.mjs +0 -1
- package/dist/next.svg +0 -1
- package/dist/react.d.ts +0 -1
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/shared.d.ts +0 -1
- package/dist/shared.js +0 -1
- package/dist/shared.mjs +0 -1
- package/dist/style.css +0 -1
- package/dist/vercel.svg +0 -1
- package/dist/web/BasicInput/BInput.js +0 -1
- package/dist/web/BasicInput/BInput.mjs +0 -177
- package/dist/web/BasicInput/utils.js +0 -1
- package/dist/web/BasicInput/utils.mjs +0 -37
- package/dist/web/CategoryDropdown/CategoryDropdown.js +0 -1
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +0 -260
- package/dist/web/CheckBox/BCheckBox.js +0 -1
- package/dist/web/CheckBox/BCheckBox.mjs +0 -101
- package/dist/web/CheckBox/Group.js +0 -1
- package/dist/web/CheckBox/Group.mjs +0 -67
- package/dist/web/CheckBox/context.js +0 -1
- package/dist/web/CheckBox/context.mjs +0 -5
- package/dist/web/CheckBox/index.js +0 -1
- package/dist/web/CheckBox/index.mjs +0 -8
- package/dist/web/Dropdown/BDropdown.js +0 -1
- package/dist/web/Dropdown/BDropdown.mjs +0 -160
- package/dist/web/EmptyInputBox/EmptyInputBox.js +0 -1
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +0 -74
- package/dist/web/FileCard/FileCard.js +0 -1
- package/dist/web/FileCard/FileCard.mjs +0 -128
- package/dist/web/Icon/Icon.js +0 -1
- package/dist/web/Icon/Icon.mjs +0 -10
- package/dist/web/Input/Input.js +0 -1
- package/dist/web/Input/Input.mjs +0 -173
- package/dist/web/InputNumber/BInputNumber.js +0 -1
- package/dist/web/InputNumber/BInputNumber.mjs +0 -204
- package/dist/web/InputNumber/StepHandler.js +0 -1
- package/dist/web/InputNumber/StepHandler.mjs +0 -64
- package/dist/web/InputNumber/hooks/useCursor.js +0 -1
- package/dist/web/InputNumber/hooks/useCursor.mjs +0 -39
- package/dist/web/InputNumber/hooks/useFrame.js +0 -1
- package/dist/web/InputNumber/hooks/useFrame.mjs +0 -10
- package/dist/web/InputNumber/utils/decimal.js +0 -1
- package/dist/web/InputNumber/utils/decimal.mjs +0 -119
- package/dist/web/Modal/Modal.js +0 -1
- package/dist/web/Modal/Modal.mjs +0 -82
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +0 -1
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +0 -152
- package/dist/web/Pagination/Pagination.js +0 -1
- package/dist/web/Pagination/Pagination.mjs +0 -253
- package/dist/web/ProductField/ProductField.js +0 -1
- package/dist/web/ProductField/ProductField.mjs +0 -226
- package/dist/web/ProductField/arrow-up.svg.js +0 -1
- package/dist/web/ProductField/arrow-up.svg.mjs +0 -4
- package/dist/web/ProductField/checkbox-no.svg.js +0 -1
- package/dist/web/ProductField/checkbox-no.svg.mjs +0 -4
- package/dist/web/ProductField/checkbox-ok.svg.js +0 -1
- package/dist/web/ProductField/checkbox-ok.svg.mjs +0 -4
- package/dist/web/ProductField/no_data_light.svg.js +0 -1
- package/dist/web/ProductField/no_data_light.svg.mjs +0 -4
- package/dist/web/ProductField/search.svg.js +0 -1
- package/dist/web/ProductField/search.svg.mjs +0 -4
- package/dist/web/ProductField/sort.svg.js +0 -1
- package/dist/web/ProductField/sort.svg.mjs +0 -4
- package/dist/web/SkuInputCard/SkuInputCard.js +0 -1
- package/dist/web/SkuInputCard/SkuInputCard.mjs +0 -238
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +0 -1
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +0 -4
- package/dist/web/Switch/Switch.js +0 -1
- package/dist/web/Switch/Switch.mjs +0 -61
- package/dist/web/Table/BTable.js +0 -1
- package/dist/web/Table/BTable.mjs +0 -698
- package/dist/web/Table/Column.js +0 -1
- package/dist/web/Table/Column.mjs +0 -6
- package/dist/web/Table/ColumnGroup.js +0 -1
- package/dist/web/Table/ColumnGroup.mjs +0 -6
- package/dist/web/Table/utils/columns.js +0 -1
- package/dist/web/Table/utils/columns.mjs +0 -43
- package/dist/web/Table/utils/sortFilter.js +0 -1
- package/dist/web/Table/utils/sortFilter.mjs +0 -63
- package/dist/web/Tabs/BTabs.js +0 -1
- package/dist/web/Tabs/BTabs.mjs +0 -130
- package/dist/web/Tabs/TabPane.js +0 -1
- package/dist/web/Tabs/TabPane.mjs +0 -8
- package/dist/web/Tooltip/ConfirmTooltip.js +0 -1
- package/dist/web/Tooltip/ConfirmTooltip.mjs +0 -26
- package/dist/web/Tooltip/ContentTooltip.js +0 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +0 -83
- package/dist/web/Tooltip/ProgressTooltip.js +0 -1
- package/dist/web/Tooltip/ProgressTooltip.mjs +0 -35
- package/dist/web/Tooltip/TooltipWrapper.js +0 -1
- package/dist/web/Tooltip/TooltipWrapper.mjs +0 -13
- package/dist/web/Tooltip/useAutoPlacement.js +0 -1
- package/dist/web/Tooltip/useAutoPlacement.mjs +0 -32
- package/dist/web.d.ts +0 -1139
- package/dist/web.js +0 -1
- package/dist/web.mjs +0 -51
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsxs as d, jsx as e, Fragment as h } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as _, useEffect as j } from "react";
|
|
3
|
-
const f = 600, w = 200;
|
|
4
|
-
function m({ className: t }) {
|
|
5
|
-
return /* @__PURE__ */ e("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: t, children: /* @__PURE__ */ e(
|
|
6
|
-
"path",
|
|
7
|
-
{
|
|
8
|
-
d: "M15.4573 13.6501C15.9047 13.6504 16.129 14.192 15.8128 14.5085L12.3352 17.9851C12.139 18.1811 11.8214 18.1811 11.6253 17.9851L8.14772 14.5085C7.83144 14.192 8.0558 13.6504 8.50319 13.6501H15.4573ZM11.6643 5.98311C11.8606 5.78688 12.179 5.78688 12.3753 5.98311L15.8518 9.45967C16.1683 9.77623 15.944 10.3171 15.4964 10.3171H8.54323C8.09567 10.3171 7.87154 9.77625 8.18776 9.45967L11.6643 5.98311Z",
|
|
9
|
-
fill: "currentColor"
|
|
10
|
-
}
|
|
11
|
-
) });
|
|
12
|
-
}
|
|
13
|
-
function C({ icon: t, upDisabled: o, downDisabled: l, onStep: i }) {
|
|
14
|
-
const u = _(void 0), a = _(i);
|
|
15
|
-
a.current = i;
|
|
16
|
-
const r = () => clearTimeout(u.current), s = (n, c) => {
|
|
17
|
-
n.preventDefault(), r(), a.current(c);
|
|
18
|
-
function p() {
|
|
19
|
-
a.current(c), u.current = setTimeout(p, w);
|
|
20
|
-
}
|
|
21
|
-
u.current = setTimeout(p, f);
|
|
22
|
-
};
|
|
23
|
-
j(() => r, []);
|
|
24
|
-
const b = {
|
|
25
|
-
unselectable: "on",
|
|
26
|
-
role: "button",
|
|
27
|
-
onMouseUp: r,
|
|
28
|
-
onMouseLeave: r
|
|
29
|
-
};
|
|
30
|
-
return (
|
|
31
|
-
// Click zones come before the icon(s) in DOM order so the icon halves
|
|
32
|
-
// can be dimmed via a `:hover ~`/`:active ~` sibling selector in CSS —
|
|
33
|
-
// the icon itself stays `pointer-events: none` and purely visual.
|
|
34
|
-
/* @__PURE__ */ d("div", { className: "bj-input-number__handler-wrap", children: [
|
|
35
|
-
/* @__PURE__ */ e(
|
|
36
|
-
"span",
|
|
37
|
-
{
|
|
38
|
-
...b,
|
|
39
|
-
"aria-label": "Increase Value",
|
|
40
|
-
"aria-disabled": o,
|
|
41
|
-
className: o ? "bj-input-number__handler bj-input-number__handler--up bj-input-number__handler--disabled" : "bj-input-number__handler bj-input-number__handler--up",
|
|
42
|
-
onMouseDown: (n) => s(n, !0)
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
/* @__PURE__ */ e(
|
|
46
|
-
"span",
|
|
47
|
-
{
|
|
48
|
-
...b,
|
|
49
|
-
"aria-label": "Decrease Value",
|
|
50
|
-
"aria-disabled": l,
|
|
51
|
-
className: l ? "bj-input-number__handler bj-input-number__handler--down bj-input-number__handler--disabled" : "bj-input-number__handler bj-input-number__handler--down",
|
|
52
|
-
onMouseDown: (n) => s(n, !1)
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
t || /* @__PURE__ */ d(h, { children: [
|
|
56
|
-
/* @__PURE__ */ e(m, { className: "bj-input-number__handler-icon bj-input-number__handler-icon--up" }),
|
|
57
|
-
/* @__PURE__ */ e(m, { className: "bj-input-number__handler-icon bj-input-number__handler-icon--down" })
|
|
58
|
-
] })
|
|
59
|
-
] })
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
export {
|
|
63
|
-
C as default
|
|
64
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const h=require("react");function d(s,a){const c=h.useRef(null);function f(){if(s)try{const{selectionStart:t,selectionEnd:e,value:r}=s;c.current={start:t??0,end:e??0,value:r,beforeTxt:r.substring(0,t??0),afterTxt:r.substring(e??0)}}catch{}}function i(){if(!(!s||!c.current||!a))try{const{value:t}=s,{beforeTxt:e,afterTxt:r,start:o}=c.current;let n=t.length;if(t.startsWith(e))n=e.length;else if(t.endsWith(r))n=t.length-r.length;else{const l=e[o-1],u=t.indexOf(l,o-1);u!==-1&&(n=u+1)}s.setSelectionRange(n,n)}catch{}}return[f,i]}module.exports=d;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useRef as h } from "react";
|
|
2
|
-
function g(n, a) {
|
|
3
|
-
const o = h(null);
|
|
4
|
-
function l() {
|
|
5
|
-
if (n)
|
|
6
|
-
try {
|
|
7
|
-
const { selectionStart: t, selectionEnd: e, value: r } = n;
|
|
8
|
-
o.current = {
|
|
9
|
-
start: t ?? 0,
|
|
10
|
-
end: e ?? 0,
|
|
11
|
-
value: r,
|
|
12
|
-
beforeTxt: r.substring(0, t ?? 0),
|
|
13
|
-
afterTxt: r.substring(e ?? 0)
|
|
14
|
-
};
|
|
15
|
-
} catch {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function u() {
|
|
19
|
-
if (!(!n || !o.current || !a))
|
|
20
|
-
try {
|
|
21
|
-
const { value: t } = n, { beforeTxt: e, afterTxt: r, start: c } = o.current;
|
|
22
|
-
let s = t.length;
|
|
23
|
-
if (t.startsWith(e))
|
|
24
|
-
s = e.length;
|
|
25
|
-
else if (t.endsWith(r))
|
|
26
|
-
s = t.length - r.length;
|
|
27
|
-
else {
|
|
28
|
-
const i = e[c - 1], f = t.indexOf(i, c - 1);
|
|
29
|
-
f !== -1 && (s = f + 1);
|
|
30
|
-
}
|
|
31
|
-
n.setSelectionRange(s, s);
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return [l, u];
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
g as default
|
|
39
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("react");function c(){const e=t.useRef(0),r=()=>cancelAnimationFrame(e.current);return t.useEffect(()=>r,[]),n=>{r(),e.current=requestAnimationFrame(n)}}module.exports=c;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function d(r){return!r&&r!==0&&!Number.isNaN(r)||!String(r).trim()}function N(r){let t=r.trim(),e=t.startsWith("-");e&&(t=t.slice(1)),t=t.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),t.startsWith(".")&&(t=`0${t}`);const i=t||"0",u=i.split("."),m=u[0]||"0",s=u[1]||"0";m==="0"&&s==="0"&&(e=!1);const o=e?"-":"";return{negative:e,negativeStr:o,trimStr:i,integerStr:m,decimalStr:s,fullStr:`${o}${i}`}}function S(r){const t=String(r);return!Number.isNaN(Number(t))&&t.includes("e")}function a(r){const t=String(r);if(S(r)){const[,e="0"]=t.toLowerCase().split("e");return Math.max(0,-Number(e))}return t.includes(".")&&b(t)?t.length-t.indexOf(".")-1:0}function f(r){const t=String(r);return S(r)?r>Number.MAX_SAFE_INTEGER?String(Number.MAX_SAFE_INTEGER):r<Number.MIN_SAFE_INTEGER?String(Number.MIN_SAFE_INTEGER):N(r.toFixed(a(r))).fullStr:N(t).fullStr}function b(r){if(typeof r=="number")return!Number.isNaN(r);if(!r)return!1;const t=String(r);return/^\s*-?\d+(\.\d+)?\s*$/.test(t)||/^\s*-?\d+\.\s*$/.test(t)||/^\s*-?\.\d+\s*$/.test(t)}class n{constructor(t){if(this.origin="",d(t)){this.empty=!0;return}this.origin=String(t),this.number=Number(t)}negate(){return new n(-this.toNumber())}add(t){if(this.isInvalidate())return new n(t);const e=Number(t);if(Number.isNaN(e))return this;const i=this.number+e;if(i>Number.MAX_SAFE_INTEGER)return new n(Number.MAX_SAFE_INTEGER);if(i<Number.MIN_SAFE_INTEGER)return new n(Number.MIN_SAFE_INTEGER);const u=Math.max(a(this.number),a(e));return new n(i.toFixed(u))}isEmpty(){return!!this.empty}isNaN(){return Number.isNaN(this.number)}isInvalidate(){return this.isEmpty()||this.isNaN()}equals(t){return this.toNumber()===(t==null?void 0:t.toNumber())}lessEquals(t){return this.add(t.negate().toString()).toNumber()<=0}toNumber(){return this.number}toString(t=!0){return t?this.isInvalidate()?"":f(this.number):this.origin}}function E(r){return new n(r)}function g(r,t,e,i=!1){if(r==="")return"";const{negativeStr:u,integerStr:m,decimalStr:s}=N(r),o=`${t}${s}`,c=`${u}${m}`;if(e!==void 0&&e>=0){const l=Number(s[e]);if(l>=5&&!i){const h=E(r).add(`${u}0.${"0".repeat(e)}${10-l}`);return g(h.toString(),t,e,i)}return e===0?c:`${c}${t}${s.padEnd(e,"0").slice(0,e)}`}return o===".0"?c:`${c}${o}`}function $(r){const t=typeof r=="number"?f(r):N(String(r)).fullStr;return t.includes(".")?N(t.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:`${r}0`}exports.Decimal=n;exports.getDecimal=E;exports.getDecupleSteps=$;exports.getNumberPrecision=a;exports.isEmptyValue=d;exports.num2str=f;exports.toFixed=g;exports.trimNumber=N;exports.validateNumber=b;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
function b(r) {
|
|
2
|
-
return !r && r !== 0 && !Number.isNaN(r) || !String(r).trim();
|
|
3
|
-
}
|
|
4
|
-
function o(r) {
|
|
5
|
-
let t = r.trim(), e = t.startsWith("-");
|
|
6
|
-
e && (t = t.slice(1)), t = t.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, ""), t.startsWith(".") && (t = `0${t}`);
|
|
7
|
-
const n = t || "0", i = n.split("."), m = i[0] || "0", s = i[1] || "0";
|
|
8
|
-
m === "0" && s === "0" && (e = !1);
|
|
9
|
-
const N = e ? "-" : "";
|
|
10
|
-
return {
|
|
11
|
-
negative: e,
|
|
12
|
-
negativeStr: N,
|
|
13
|
-
trimStr: n,
|
|
14
|
-
integerStr: m,
|
|
15
|
-
decimalStr: s,
|
|
16
|
-
fullStr: `${N}${n}`
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function S(r) {
|
|
20
|
-
const t = String(r);
|
|
21
|
-
return !Number.isNaN(Number(t)) && t.includes("e");
|
|
22
|
-
}
|
|
23
|
-
function f(r) {
|
|
24
|
-
const t = String(r);
|
|
25
|
-
if (S(r)) {
|
|
26
|
-
const [, e = "0"] = t.toLowerCase().split("e");
|
|
27
|
-
return Math.max(0, -Number(e));
|
|
28
|
-
}
|
|
29
|
-
return t.includes(".") && E(t) ? t.length - t.indexOf(".") - 1 : 0;
|
|
30
|
-
}
|
|
31
|
-
function d(r) {
|
|
32
|
-
const t = String(r);
|
|
33
|
-
return S(r) ? r > Number.MAX_SAFE_INTEGER ? String(Number.MAX_SAFE_INTEGER) : r < Number.MIN_SAFE_INTEGER ? String(Number.MIN_SAFE_INTEGER) : o(r.toFixed(f(r))).fullStr : o(t).fullStr;
|
|
34
|
-
}
|
|
35
|
-
function E(r) {
|
|
36
|
-
if (typeof r == "number")
|
|
37
|
-
return !Number.isNaN(r);
|
|
38
|
-
if (!r) return !1;
|
|
39
|
-
const t = String(r);
|
|
40
|
-
return /^\s*-?\d+(\.\d+)?\s*$/.test(t) || // 11.28
|
|
41
|
-
/^\s*-?\d+\.\s*$/.test(t) || // 1.
|
|
42
|
-
/^\s*-?\.\d+\s*$/.test(t);
|
|
43
|
-
}
|
|
44
|
-
class u {
|
|
45
|
-
constructor(t) {
|
|
46
|
-
if (this.origin = "", b(t)) {
|
|
47
|
-
this.empty = !0;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this.origin = String(t), this.number = Number(t);
|
|
51
|
-
}
|
|
52
|
-
negate() {
|
|
53
|
-
return new u(-this.toNumber());
|
|
54
|
-
}
|
|
55
|
-
add(t) {
|
|
56
|
-
if (this.isInvalidate()) return new u(t);
|
|
57
|
-
const e = Number(t);
|
|
58
|
-
if (Number.isNaN(e)) return this;
|
|
59
|
-
const n = this.number + e;
|
|
60
|
-
if (n > Number.MAX_SAFE_INTEGER) return new u(Number.MAX_SAFE_INTEGER);
|
|
61
|
-
if (n < Number.MIN_SAFE_INTEGER) return new u(Number.MIN_SAFE_INTEGER);
|
|
62
|
-
const i = Math.max(f(this.number), f(e));
|
|
63
|
-
return new u(n.toFixed(i));
|
|
64
|
-
}
|
|
65
|
-
isEmpty() {
|
|
66
|
-
return !!this.empty;
|
|
67
|
-
}
|
|
68
|
-
isNaN() {
|
|
69
|
-
return Number.isNaN(this.number);
|
|
70
|
-
}
|
|
71
|
-
isInvalidate() {
|
|
72
|
-
return this.isEmpty() || this.isNaN();
|
|
73
|
-
}
|
|
74
|
-
equals(t) {
|
|
75
|
-
return this.toNumber() === (t == null ? void 0 : t.toNumber());
|
|
76
|
-
}
|
|
77
|
-
lessEquals(t) {
|
|
78
|
-
return this.add(t.negate().toString()).toNumber() <= 0;
|
|
79
|
-
}
|
|
80
|
-
toNumber() {
|
|
81
|
-
return this.number;
|
|
82
|
-
}
|
|
83
|
-
toString(t = !0) {
|
|
84
|
-
return t ? this.isInvalidate() ? "" : d(this.number) : this.origin;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function h(r) {
|
|
88
|
-
return new u(r);
|
|
89
|
-
}
|
|
90
|
-
function g(r, t, e, n = !1) {
|
|
91
|
-
if (r === "") return "";
|
|
92
|
-
const { negativeStr: i, integerStr: m, decimalStr: s } = o(r), N = `${t}${s}`, c = `${i}${m}`;
|
|
93
|
-
if (e !== void 0 && e >= 0) {
|
|
94
|
-
const a = Number(s[e]);
|
|
95
|
-
if (a >= 5 && !n) {
|
|
96
|
-
const l = h(r).add(
|
|
97
|
-
`${i}0.${"0".repeat(e)}${10 - a}`
|
|
98
|
-
);
|
|
99
|
-
return g(l.toString(), t, e, n);
|
|
100
|
-
}
|
|
101
|
-
return e === 0 ? c : `${c}${t}${s.padEnd(e, "0").slice(0, e)}`;
|
|
102
|
-
}
|
|
103
|
-
return N === ".0" ? c : `${c}${N}`;
|
|
104
|
-
}
|
|
105
|
-
function $(r) {
|
|
106
|
-
const t = typeof r == "number" ? d(r) : o(String(r)).fullStr;
|
|
107
|
-
return t.includes(".") ? o(t.replace(/(\d)\.(\d)/g, "$1$2.")).fullStr : `${r}0`;
|
|
108
|
-
}
|
|
109
|
-
export {
|
|
110
|
-
u as Decimal,
|
|
111
|
-
h as getDecimal,
|
|
112
|
-
$ as getDecupleSteps,
|
|
113
|
-
f as getNumberPrecision,
|
|
114
|
-
b as isEmptyValue,
|
|
115
|
-
d as num2str,
|
|
116
|
-
g as toFixed,
|
|
117
|
-
o as trimNumber,
|
|
118
|
-
E as validateNumber
|
|
119
|
-
};
|
package/dist/web/Modal/Modal.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime");;/* empty css */function w({open:u=!1,title:r="标题",mode:o="standard",children:_,okText:b="确认",cancelText:m="取消",onOk:x,onCancel:j,onClose:i,activeLang:n="zh",onLangChange:s,labels:t,hint:c,confirmLoading:e=!1,width:a,className:N,style:d}){const h=(t==null?void 0:t.zh)??"中文",p=(t==null?void 0:t.en)??"EN";if(!u)return null;const v=o==="bilingual",k=o==="single",y=a!=null?{width:a,...d}:d;return l.jsx("div",{className:["bu-modal__overlay",N].filter(Boolean).join(" "),onClick:i,children:l.jsxs("div",{className:"bu-modal__container",style:y,onClick:f=>f.stopPropagation(),children:[l.jsxs("div",{className:"bu-modal__header",children:[l.jsx("p",{className:"bu-modal__title",children:r}),v&&l.jsxs("div",{className:"bu-modal__lang-toggle",children:[l.jsx("button",{type:"button",className:`bu-modal__lang-btn${n==="zh"?" bu-modal__lang-btn--active":""}`,onClick:()=>s==null?void 0:s("zh"),children:h}),l.jsx("button",{type:"button",className:`bu-modal__lang-btn${n==="en"?" bu-modal__lang-btn--active":""}`,onClick:()=>s==null?void 0:s("en"),children:p})]}),l.jsx("button",{type:"button",className:"bu-modal__close",onClick:i,children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M16.5613 6.73027C16.7558 6.53571 17.0723 6.53442 17.2684 6.72736C17.4644 6.92032 17.4657 7.23444 17.2713 7.42901L12.7036 12.0002L17.2713 16.5714C17.4657 16.766 17.4644 17.0801 17.2684 17.273C17.0723 17.4659 16.7558 17.4646 16.5613 17.2701L11.9996 12.7047L7.43794 17.2701C7.24352 17.4647 6.92699 17.4659 6.73091 17.273C6.53485 17.0801 6.53355 16.7659 6.72798 16.5714L11.2955 12.0002L6.72798 7.42901C6.53355 7.23442 6.53485 6.92032 6.73091 6.72736C6.92698 6.53442 7.2435 6.53571 7.43794 6.73027L11.9996 11.2955L16.5613 6.73027Z",fill:"currentColor"})})})]}),l.jsx("div",{className:"bu-modal__body",children:_}),l.jsxs("div",{className:"bu-modal__footer",children:[c&&l.jsx("p",{className:"bu-modal__hint",children:c}),l.jsxs("div",{className:"bu-modal__btn-row",children:[!k&&l.jsx("button",{type:"button",className:"bu-modal__btn-cancel",onClick:j??i,children:m}),l.jsxs("button",{type:"button",className:["bu-modal__btn-ok",e?"bu-modal__btn-ok--loading":""].filter(Boolean).join(" "),disabled:e,onClick:e?void 0:x,children:[e&&l.jsx("span",{className:"bu-modal__btn-ok-spinner"}),b]})]})]})]})})}module.exports=w;
|
package/dist/web/Modal/Modal.mjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { jsx as l, jsxs as i } from "react/jsx-runtime";
|
|
2
|
-
/* empty css */
|
|
3
|
-
function j({
|
|
4
|
-
open: _ = !1,
|
|
5
|
-
title: r = "标题",
|
|
6
|
-
mode: n = "standard",
|
|
7
|
-
children: b,
|
|
8
|
-
okText: m = "确认",
|
|
9
|
-
cancelText: p = "取消",
|
|
10
|
-
onOk: N,
|
|
11
|
-
onCancel: h,
|
|
12
|
-
onClose: a,
|
|
13
|
-
activeLang: c = "zh",
|
|
14
|
-
onLangChange: t,
|
|
15
|
-
labels: o,
|
|
16
|
-
hint: d,
|
|
17
|
-
confirmLoading: e = !1,
|
|
18
|
-
width: s,
|
|
19
|
-
className: v,
|
|
20
|
-
style: u
|
|
21
|
-
}) {
|
|
22
|
-
const k = (o == null ? void 0 : o.zh) ?? "中文", f = (o == null ? void 0 : o.en) ?? "EN";
|
|
23
|
-
if (!_) return null;
|
|
24
|
-
const y = n === "bilingual", w = n === "single", x = s != null ? { width: s, ...u } : u;
|
|
25
|
-
return /* @__PURE__ */ l("div", { className: ["bu-modal__overlay", v].filter(Boolean).join(" "), onClick: a, children: /* @__PURE__ */ i(
|
|
26
|
-
"div",
|
|
27
|
-
{
|
|
28
|
-
className: "bu-modal__container",
|
|
29
|
-
style: x,
|
|
30
|
-
onClick: (z) => z.stopPropagation(),
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ i("div", { className: "bu-modal__header", children: [
|
|
33
|
-
/* @__PURE__ */ l("p", { className: "bu-modal__title", children: r }),
|
|
34
|
-
y && /* @__PURE__ */ i("div", { className: "bu-modal__lang-toggle", children: [
|
|
35
|
-
/* @__PURE__ */ l(
|
|
36
|
-
"button",
|
|
37
|
-
{
|
|
38
|
-
type: "button",
|
|
39
|
-
className: `bu-modal__lang-btn${c === "zh" ? " bu-modal__lang-btn--active" : ""}`,
|
|
40
|
-
onClick: () => t == null ? void 0 : t("zh"),
|
|
41
|
-
children: k
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ l(
|
|
45
|
-
"button",
|
|
46
|
-
{
|
|
47
|
-
type: "button",
|
|
48
|
-
className: `bu-modal__lang-btn${c === "en" ? " bu-modal__lang-btn--active" : ""}`,
|
|
49
|
-
onClick: () => t == null ? void 0 : t("en"),
|
|
50
|
-
children: f
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ l("button", { type: "button", className: "bu-modal__close", onClick: a, children: /* @__PURE__ */ l("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ l("path", { d: "M16.5613 6.73027C16.7558 6.53571 17.0723 6.53442 17.2684 6.72736C17.4644 6.92032 17.4657 7.23444 17.2713 7.42901L12.7036 12.0002L17.2713 16.5714C17.4657 16.766 17.4644 17.0801 17.2684 17.273C17.0723 17.4659 16.7558 17.4646 16.5613 17.2701L11.9996 12.7047L7.43794 17.2701C7.24352 17.4647 6.92699 17.4659 6.73091 17.273C6.53485 17.0801 6.53355 16.7659 6.72798 16.5714L11.2955 12.0002L6.72798 7.42901C6.53355 7.23442 6.53485 6.92032 6.73091 6.72736C6.92698 6.53442 7.2435 6.53571 7.43794 6.73027L11.9996 11.2955L16.5613 6.73027Z", fill: "currentColor" }) }) })
|
|
55
|
-
] }),
|
|
56
|
-
/* @__PURE__ */ l("div", { className: "bu-modal__body", children: b }),
|
|
57
|
-
/* @__PURE__ */ i("div", { className: "bu-modal__footer", children: [
|
|
58
|
-
d && /* @__PURE__ */ l("p", { className: "bu-modal__hint", children: d }),
|
|
59
|
-
/* @__PURE__ */ i("div", { className: "bu-modal__btn-row", children: [
|
|
60
|
-
!w && /* @__PURE__ */ l("button", { type: "button", className: "bu-modal__btn-cancel", onClick: h ?? a, children: p }),
|
|
61
|
-
/* @__PURE__ */ i(
|
|
62
|
-
"button",
|
|
63
|
-
{
|
|
64
|
-
type: "button",
|
|
65
|
-
className: ["bu-modal__btn-ok", e ? "bu-modal__btn-ok--loading" : ""].filter(Boolean).join(" "),
|
|
66
|
-
disabled: e,
|
|
67
|
-
onClick: e ? void 0 : N,
|
|
68
|
-
children: [
|
|
69
|
-
e && /* @__PURE__ */ l("span", { className: "bu-modal__btn-ok-spinner" }),
|
|
70
|
-
m
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
] })
|
|
75
|
-
] })
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
) });
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
j as default
|
|
82
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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;
|
|
@@ -1,152 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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;
|