bj-web-components 0.2.26 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/favicon.ico +0 -0
- package/dist/file.svg +1 -0
- package/dist/globe.svg +1 -0
- package/dist/index.d.ts +1141 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +51 -0
- package/dist/miniapp.d.ts +1 -0
- package/dist/miniapp.js +1 -0
- package/dist/miniapp.mjs +1 -0
- package/dist/mobile.d.ts +1 -0
- package/dist/mobile.js +1 -0
- package/dist/mobile.mjs +1 -0
- package/dist/next.svg +1 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +1 -0
- package/dist/react.mjs +1 -0
- package/dist/shared.d.ts +1 -0
- package/dist/shared.js +1 -0
- package/dist/shared.mjs +1 -0
- package/dist/style.css +1 -0
- package/dist/vercel.svg +1 -0
- package/dist/web/BasicInput/BInput.js +1 -0
- package/dist/web/BasicInput/BInput.mjs +177 -0
- package/dist/web/BasicInput/utils.js +1 -0
- package/dist/web/BasicInput/utils.mjs +37 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.js +1 -0
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +260 -0
- package/dist/web/CheckBox/BCheckBox.js +1 -0
- package/dist/web/CheckBox/BCheckBox.mjs +101 -0
- package/dist/web/CheckBox/Group.js +1 -0
- package/dist/web/CheckBox/Group.mjs +67 -0
- package/dist/web/CheckBox/context.js +1 -0
- package/dist/web/CheckBox/context.mjs +5 -0
- package/dist/web/CheckBox/index.js +1 -0
- package/dist/web/CheckBox/index.mjs +8 -0
- package/dist/web/Dropdown/BDropdown.js +1 -0
- package/dist/web/Dropdown/BDropdown.mjs +160 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.js +1 -0
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +74 -0
- package/dist/web/FileCard/FileCard.js +1 -0
- package/dist/web/FileCard/FileCard.mjs +128 -0
- package/dist/web/Icon/Icon.js +1 -0
- package/dist/web/Icon/Icon.mjs +10 -0
- package/dist/web/Input/Input.js +1 -0
- package/dist/web/Input/Input.mjs +173 -0
- package/dist/web/InputNumber/BInputNumber.js +1 -0
- package/dist/web/InputNumber/BInputNumber.mjs +204 -0
- package/dist/web/InputNumber/StepHandler.js +1 -0
- package/dist/web/InputNumber/StepHandler.mjs +64 -0
- package/dist/web/InputNumber/hooks/useCursor.js +1 -0
- package/dist/web/InputNumber/hooks/useCursor.mjs +39 -0
- package/dist/web/InputNumber/hooks/useFrame.js +1 -0
- package/dist/web/InputNumber/hooks/useFrame.mjs +10 -0
- package/dist/web/InputNumber/utils/decimal.js +1 -0
- package/dist/web/InputNumber/utils/decimal.mjs +119 -0
- package/dist/web/Modal/Modal.js +1 -0
- package/dist/web/Modal/Modal.mjs +82 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
- package/dist/web/Pagination/Pagination.js +1 -0
- package/dist/web/Pagination/Pagination.mjs +253 -0
- package/dist/web/ProductField/ProductField.js +1 -0
- package/dist/web/ProductField/ProductField.mjs +226 -0
- package/dist/web/ProductField/arrow-up.svg.js +1 -0
- package/dist/web/ProductField/arrow-up.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-no.svg.js +1 -0
- package/dist/web/ProductField/checkbox-no.svg.mjs +4 -0
- package/dist/web/ProductField/checkbox-ok.svg.js +1 -0
- package/dist/web/ProductField/checkbox-ok.svg.mjs +4 -0
- package/dist/web/ProductField/no_data_light.svg.js +1 -0
- package/dist/web/ProductField/no_data_light.svg.mjs +4 -0
- package/dist/web/ProductField/search.svg.js +1 -0
- package/dist/web/ProductField/search.svg.mjs +4 -0
- package/dist/web/ProductField/sort.svg.js +1 -0
- package/dist/web/ProductField/sort.svg.mjs +4 -0
- package/dist/web/SkuInputCard/SkuInputCard.js +1 -0
- package/dist/web/SkuInputCard/SkuInputCard.mjs +238 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +1 -0
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +4 -0
- package/dist/web/Switch/Switch.js +1 -0
- package/dist/web/Switch/Switch.mjs +61 -0
- package/dist/web/Table/BTable.js +1 -0
- package/dist/web/Table/BTable.mjs +698 -0
- package/dist/web/Table/Column.js +1 -0
- package/dist/web/Table/Column.mjs +6 -0
- package/dist/web/Table/ColumnGroup.js +1 -0
- package/dist/web/Table/ColumnGroup.mjs +6 -0
- package/dist/web/Table/utils/columns.js +1 -0
- package/dist/web/Table/utils/columns.mjs +43 -0
- package/dist/web/Table/utils/sortFilter.js +1 -0
- package/dist/web/Table/utils/sortFilter.mjs +63 -0
- package/dist/web/Tabs/BTabs.js +1 -0
- package/dist/web/Tabs/BTabs.mjs +130 -0
- package/dist/web/Tabs/TabPane.js +1 -0
- package/dist/web/Tabs/TabPane.mjs +8 -0
- package/dist/web/Tooltip/ConfirmTooltip.js +1 -0
- package/dist/web/Tooltip/ConfirmTooltip.mjs +26 -0
- package/dist/web/Tooltip/ContentTooltip.js +1 -0
- package/dist/web/Tooltip/ContentTooltip.mjs +85 -0
- package/dist/web/Tooltip/ProgressTooltip.js +1 -0
- package/dist/web/Tooltip/ProgressTooltip.mjs +35 -0
- package/dist/web/Tooltip/TooltipWrapper.js +1 -0
- package/dist/web/Tooltip/TooltipWrapper.mjs +13 -0
- package/dist/web/Tooltip/useAutoPlacement.js +1 -0
- package/dist/web/Tooltip/useAutoPlacement.mjs +32 -0
- package/dist/web.d.ts +1141 -0
- package/dist/web.js +1 -0
- package/dist/web.mjs +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function n(t){return null}module.exports=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function u(n){return null}module.exports=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");function c(r){return s.Children.toArray(r).flatMap((e,n)=>{if(!s.isValidElement(e))return[];const o=e.props,{children:l,...t}=o;return[{...t,key:e.key??t.key??n,...l?{children:c(l)}:{}}]})}function d(r){return r.flatMap(e=>"children"in e?d(e.children):[e])}function h(r){return r.reduce((e,n)=>Math.max(e,"children"in n?1+h(n.children):1),1)}function u(r){return"children"in r?r.children.reduce((e,n)=>e+u(n),0):1}function f(r){const e=h(r),n=Array.from({length:e},()=>[]),o=(l,t)=>{l.forEach(i=>{const a="children"in i&&i.children.length>0;n[t].push({column:i,colSpan:i.colSpan??(a?u(i):1),rowSpan:a?1:e-t,depth:t}),a&&o(i.children,t+1)})};return o(r,0),n}exports.buildHeaderRows=f;exports.convertChildrenToColumns=c;exports.flattenColumns=d;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Children as d, isValidElement as l } from "react";
|
|
2
|
+
function f(n) {
|
|
3
|
+
return d.toArray(n).flatMap((r, e) => {
|
|
4
|
+
if (!l(r)) return [];
|
|
5
|
+
const o = r.props, { children: a, ...t } = o;
|
|
6
|
+
return [{
|
|
7
|
+
...t,
|
|
8
|
+
key: r.key ?? t.key ?? e,
|
|
9
|
+
...a ? { children: f(a) } : {}
|
|
10
|
+
}];
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function p(n) {
|
|
14
|
+
return n.flatMap((r) => "children" in r ? p(r.children) : [r]);
|
|
15
|
+
}
|
|
16
|
+
function c(n) {
|
|
17
|
+
return n.reduce((r, e) => Math.max(
|
|
18
|
+
r,
|
|
19
|
+
"children" in e ? 1 + c(e.children) : 1
|
|
20
|
+
), 1);
|
|
21
|
+
}
|
|
22
|
+
function s(n) {
|
|
23
|
+
return "children" in n ? n.children.reduce((r, e) => r + s(e), 0) : 1;
|
|
24
|
+
}
|
|
25
|
+
function C(n) {
|
|
26
|
+
const r = c(n), e = Array.from({ length: r }, () => []), o = (a, t) => {
|
|
27
|
+
a.forEach((i) => {
|
|
28
|
+
const h = "children" in i && i.children.length > 0;
|
|
29
|
+
e[t].push({
|
|
30
|
+
column: i,
|
|
31
|
+
colSpan: i.colSpan ?? (h ? s(i) : 1),
|
|
32
|
+
rowSpan: h ? 1 : r - t,
|
|
33
|
+
depth: t
|
|
34
|
+
}), h && o(i.children, t + 1);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return o(n, 0), e;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
C as buildHeaderRows,
|
|
41
|
+
f as convertChildrenToColumns,
|
|
42
|
+
p as flattenColumns
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t,n){return t.key!==void 0&&t.key!==null?t.key:t.dataIndex!==void 0?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:n}function x(t,n){return typeof t=="function"?t(n):t}function S(t,n=["ascend","descend",null]){const o=n.indexOf(t),i=n[o+1];return i===void 0?n[0]??null:i}function l(t){if(typeof t.sorter=="function")return t.sorter;if(t.sorter&&typeof t.sorter=="object")return t.sorter.compare}function g(t){return t.sorter&&typeof t.sorter=="object"?t.sorter.multiple??0:0}function p(t,n,o,i="children"){const f=n.map((e,r)=>({column:e,key:a(e,r)})).filter(({column:e,key:r})=>!("children"in e)&&l(e)&&o.get(r)).sort((e,r)=>g(r.column)-g(e.column));return f.length===0?[...t]:[...t].sort((e,r)=>{for(const{column:s,key:c}of f){const u=o.get(c),d=l(s);if(u&&d){const y=d(e,r,u);if(y!==0)return u==="ascend"?y:-y}}return 0}).map(e=>{const r=e[i];return Array.isArray(r)?{...e,[i]:p(r,n,o,i)}:e})}function k(t,n,o){return n.reduce((i,f,e)=>{const r=f,s=o.get(a(r,e));return!r.onFilter||!(s!=null&&s.length)?i:i.filter(c=>s.some(u=>{var d;return(d=r.onFilter)==null?void 0:d.call(r,u,c)}))},[...t])}function v(t,n){const o=t.flatMap((i,f)=>{const e=i,r=a(e,f),s=n.get(r);return s?[{column:e,order:s,field:e.dataIndex,columnKey:r}]:[]});return o.length<=1?o[0]??{}:o}exports.filterRecords=k;exports.getColumnKey=a;exports.getNextSortOrder=S;exports.getSorterResult=v;exports.renderColumnTitle=x;exports.sortRecords=p;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function y(t, n) {
|
|
2
|
+
return t.key !== void 0 && t.key !== null ? t.key : t.dataIndex !== void 0 ? Array.isArray(t.dataIndex) ? t.dataIndex.join(".") : t.dataIndex : n;
|
|
3
|
+
}
|
|
4
|
+
function x(t, n) {
|
|
5
|
+
return typeof t == "function" ? t(n) : t;
|
|
6
|
+
}
|
|
7
|
+
function k(t, n = ["ascend", "descend", null]) {
|
|
8
|
+
const o = n.indexOf(t), i = n[o + 1];
|
|
9
|
+
return i === void 0 ? n[0] ?? null : i;
|
|
10
|
+
}
|
|
11
|
+
function p(t) {
|
|
12
|
+
if (typeof t.sorter == "function")
|
|
13
|
+
return t.sorter;
|
|
14
|
+
if (t.sorter && typeof t.sorter == "object")
|
|
15
|
+
return t.sorter.compare;
|
|
16
|
+
}
|
|
17
|
+
function g(t) {
|
|
18
|
+
return t.sorter && typeof t.sorter == "object" ? t.sorter.multiple ?? 0 : 0;
|
|
19
|
+
}
|
|
20
|
+
function l(t, n, o, i = "children") {
|
|
21
|
+
const s = n.map((r, e) => ({
|
|
22
|
+
column: r,
|
|
23
|
+
key: y(r, e)
|
|
24
|
+
})).filter(({ column: r, key: e }) => !("children" in r) && p(r) && o.get(e)).sort((r, e) => g(e.column) - g(r.column));
|
|
25
|
+
return s.length === 0 ? [...t] : [...t].sort((r, e) => {
|
|
26
|
+
for (const { column: f, key: d } of s) {
|
|
27
|
+
const u = o.get(d), a = p(f);
|
|
28
|
+
if (u && a) {
|
|
29
|
+
const c = a(r, e, u);
|
|
30
|
+
if (c !== 0)
|
|
31
|
+
return u === "ascend" ? c : -c;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 0;
|
|
35
|
+
}).map((r) => {
|
|
36
|
+
const e = r[i];
|
|
37
|
+
return Array.isArray(e) ? { ...r, [i]: l(e, n, o, i) } : r;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function I(t, n, o) {
|
|
41
|
+
return n.reduce((i, s, r) => {
|
|
42
|
+
const e = s, f = o.get(y(e, r));
|
|
43
|
+
return !e.onFilter || !(f != null && f.length) ? i : i.filter((d) => f.some((u) => {
|
|
44
|
+
var a;
|
|
45
|
+
return (a = e.onFilter) == null ? void 0 : a.call(e, u, d);
|
|
46
|
+
}));
|
|
47
|
+
}, [...t]);
|
|
48
|
+
}
|
|
49
|
+
function v(t, n) {
|
|
50
|
+
const o = t.flatMap((i, s) => {
|
|
51
|
+
const r = i, e = y(r, s), f = n.get(e);
|
|
52
|
+
return f ? [{ column: r, order: f, field: r.dataIndex, columnKey: e }] : [];
|
|
53
|
+
});
|
|
54
|
+
return o.length <= 1 ? o[0] ?? {} : o;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
I as filterRecords,
|
|
58
|
+
y as getColumnKey,
|
|
59
|
+
k as getNextSortOrder,
|
|
60
|
+
v as getSorterResult,
|
|
61
|
+
x as renderColumnTitle,
|
|
62
|
+
l as sortRecords
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),c=require("react"),M=require("./TabPane.js");;/* empty css */function I(...s){return s.filter(Boolean).join(" ")}function q(s,n){const[t,a]=c.useState(s);return[n===void 0?t:n,a]}function D(s,n){return c.useMemo(()=>s?s.filter(t=>!!(t&&typeof t=="object"&&"key"in t)):c.Children.toArray(n).flatMap(t=>{if(!c.isValidElement(t))return[];const{tab:a,tabKey:b,...y}=t.props,i=b??t.key;return i===null?[]:[{...y,key:String(i),label:a}]}),[n,s])}function E({active:s,id:n,item:t,onClick:a,onKeyDown:b,tabCount:y,tabIndex:i}){return r.jsxs("button",{"aria-controls":`${n}-panel-${t.key}`,"aria-disabled":t.disabled,"aria-selected":s,className:I("bj-tabs__tab",s&&"bj-tabs__tab--active",t.disabled&&"bj-tabs__tab--disabled"),disabled:t.disabled,id:`${n}-tab-${t.key}`,onClick:a,onKeyDown:b,role:"tab",tabIndex:t.disabled?-1:s?0:-1,type:"button",children:[r.jsx("span",{className:"bj-tabs__tab-btn",children:t.label}),r.jsx("span",{className:"bj-tabs__sr-only",children:`Tab ${i+1} of ${y}`})]})}function L({activeKey:s,id:n,items:t}){return r.jsx("div",{className:"bj-tabs__content-holder",children:r.jsx("div",{className:"bj-tabs__content",children:t.map(a=>{const b=a.key===s;return!b&&!a.forceRender?null:r.jsx("div",{"aria-hidden":!b,"aria-labelledby":`${n}-tab-${a.key}`,className:I("bj-tabs__tabpane",b&&"bj-tabs__tabpane--active",a.className),id:`${n}-panel-${a.key}`,role:"tabpanel",style:a.style,tabIndex:b?0:-1,children:a.children},a.key)})})})}function m({activeKey:s,children:n,centered:t,className:a,defaultActiveKey:b,id:y,items:i,onChange:f,onTabClick:_,style:w,tabBarGutter:F,tabBarStyle:S,tabPosition:x="top",type:T="line"}){const l=D(i,n),K=c.useRef(`bj-tabs-${Math.random().toString(36).slice(2,10)}`),p=y??K.current,[o,v]=q(()=>{var e;return b??((e=l[0])==null?void 0:e.key)},s),[$,P]=c.useState(()=>l.findIndex(e=>e.key===o));c.useEffect(()=>{var d;let e=l.findIndex(u=>u.key===o);e===-1&&(e=Math.max(0,Math.min($,l.length-1)),v((d=l[e])==null?void 0:d.key)),P(e)},[$,o,v,l]);const B=(e,d)=>{_==null||_(e,d),e!==o&&(v(e),f==null||f(e))},R=(e,d)=>{var N;const g=x==="left"||x==="right"?e.key==="ArrowDown"?1:e.key==="ArrowUp"?-1:0:e.key==="ArrowRight"?1:e.key==="ArrowLeft"?-1:0;if(!g)return;e.preventDefault();const j=l.filter(h=>!h.disabled),V=j.findIndex(h=>{var A;return h.key===((A=l[d])==null?void 0:A.key)}),k=j[(V+g+j.length)%j.length];(N=document.getElementById(`${p}-tab-${k==null?void 0:k.key}`))==null||N.focus()};return r.jsxs("div",{className:I("bj-tabs",`bj-tabs--${x}`,`bj-tabs--${T}`,t&&"bj-tabs--centered",a),style:w,children:[r.jsx("div",{className:"bj-tabs__nav",role:"tablist",style:S,children:r.jsx("div",{className:"bj-tabs__nav-wrap",children:r.jsx("div",{className:"bj-tabs__nav-list",children:l.map((e,d)=>r.jsx(E,{active:e.key===o,id:p,item:e,onClick:u=>B(e.key,u),onKeyDown:u=>R(u,d),tabCount:l.length,tabIndex:d},e.key))})})}),r.jsx(L,{activeKey:o,id:p,items:l})]})}m.TabPane=M.TabPane;exports.TabPane=M.TabPane;exports.default=m;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsxs as g, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as E, useState as A, useEffect as L, useMemo as T, Children as P, isValidElement as F } from "react";
|
|
3
|
+
import { TabPane as G } from "./TabPane.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function I(...n) {
|
|
6
|
+
return n.filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
function U(n, s) {
|
|
9
|
+
const [t, a] = A(n);
|
|
10
|
+
return [s === void 0 ? t : s, a];
|
|
11
|
+
}
|
|
12
|
+
function q(n, s) {
|
|
13
|
+
return T(() => n ? n.filter((t) => !!(t && typeof t == "object" && "key" in t)) : P.toArray(s).flatMap((t) => {
|
|
14
|
+
if (!F(t)) return [];
|
|
15
|
+
const { tab: a, tabKey: l, ...u } = t.props, c = l ?? t.key;
|
|
16
|
+
return c === null ? [] : [{ ...u, key: String(c), label: a }];
|
|
17
|
+
}), [s, n]);
|
|
18
|
+
}
|
|
19
|
+
function z({
|
|
20
|
+
active: n,
|
|
21
|
+
id: s,
|
|
22
|
+
item: t,
|
|
23
|
+
onClick: a,
|
|
24
|
+
onKeyDown: l,
|
|
25
|
+
tabCount: u,
|
|
26
|
+
tabIndex: c
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ g(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
"aria-controls": `${s}-panel-${t.key}`,
|
|
32
|
+
"aria-disabled": t.disabled,
|
|
33
|
+
"aria-selected": n,
|
|
34
|
+
className: I("bj-tabs__tab", n && "bj-tabs__tab--active", t.disabled && "bj-tabs__tab--disabled"),
|
|
35
|
+
disabled: t.disabled,
|
|
36
|
+
id: `${s}-tab-${t.key}`,
|
|
37
|
+
onClick: a,
|
|
38
|
+
onKeyDown: l,
|
|
39
|
+
role: "tab",
|
|
40
|
+
tabIndex: t.disabled ? -1 : n ? 0 : -1,
|
|
41
|
+
type: "button",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ b("span", { className: "bj-tabs__tab-btn", children: t.label }),
|
|
44
|
+
/* @__PURE__ */ b("span", { className: "bj-tabs__sr-only", children: `Tab ${c + 1} of ${u}` })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function H({ activeKey: n, id: s, items: t }) {
|
|
50
|
+
return /* @__PURE__ */ b("div", { className: "bj-tabs__content-holder", children: /* @__PURE__ */ b("div", { className: "bj-tabs__content", children: t.map((a) => {
|
|
51
|
+
const l = a.key === n;
|
|
52
|
+
return !l && !a.forceRender ? null : /* @__PURE__ */ b(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"aria-hidden": !l,
|
|
56
|
+
"aria-labelledby": `${s}-tab-${a.key}`,
|
|
57
|
+
className: I("bj-tabs__tabpane", l && "bj-tabs__tabpane--active", a.className),
|
|
58
|
+
id: `${s}-panel-${a.key}`,
|
|
59
|
+
role: "tabpanel",
|
|
60
|
+
style: a.style,
|
|
61
|
+
tabIndex: l ? 0 : -1,
|
|
62
|
+
children: a.children
|
|
63
|
+
},
|
|
64
|
+
a.key
|
|
65
|
+
);
|
|
66
|
+
}) }) });
|
|
67
|
+
}
|
|
68
|
+
function J({
|
|
69
|
+
activeKey: n,
|
|
70
|
+
children: s,
|
|
71
|
+
centered: t,
|
|
72
|
+
className: a,
|
|
73
|
+
defaultActiveKey: l,
|
|
74
|
+
id: u,
|
|
75
|
+
items: c,
|
|
76
|
+
onChange: f,
|
|
77
|
+
onTabClick: p,
|
|
78
|
+
style: w,
|
|
79
|
+
tabBarGutter: O,
|
|
80
|
+
tabBarStyle: M,
|
|
81
|
+
tabPosition: _ = "top",
|
|
82
|
+
type: K = "line"
|
|
83
|
+
}) {
|
|
84
|
+
const r = q(c, s), B = E(`bj-tabs-${Math.random().toString(36).slice(2, 10)}`), j = u ?? B.current, [o, k] = U(
|
|
85
|
+
() => {
|
|
86
|
+
var e;
|
|
87
|
+
return l ?? ((e = r[0]) == null ? void 0 : e.key);
|
|
88
|
+
},
|
|
89
|
+
n
|
|
90
|
+
), [$, V] = A(() => r.findIndex((e) => e.key === o));
|
|
91
|
+
L(() => {
|
|
92
|
+
var d;
|
|
93
|
+
let e = r.findIndex((i) => i.key === o);
|
|
94
|
+
e === -1 && (e = Math.max(0, Math.min($, r.length - 1)), k((d = r[e]) == null ? void 0 : d.key)), V(e);
|
|
95
|
+
}, [$, o, k, r]);
|
|
96
|
+
const R = (e, d) => {
|
|
97
|
+
p == null || p(e, d), e !== o && (k(e), f == null || f(e));
|
|
98
|
+
}, S = (e, d) => {
|
|
99
|
+
var m;
|
|
100
|
+
const x = _ === "left" || _ === "right" ? e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0 : e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
101
|
+
if (!x) return;
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
const y = r.filter((h) => !h.disabled), D = y.findIndex((h) => {
|
|
104
|
+
var N;
|
|
105
|
+
return h.key === ((N = r[d]) == null ? void 0 : N.key);
|
|
106
|
+
}), v = y[(D + x + y.length) % y.length];
|
|
107
|
+
(m = document.getElementById(`${j}-tab-${v == null ? void 0 : v.key}`)) == null || m.focus();
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ g("div", { className: I("bj-tabs", `bj-tabs--${_}`, `bj-tabs--${K}`, t && "bj-tabs--centered", a), style: w, children: [
|
|
110
|
+
/* @__PURE__ */ b("div", { className: "bj-tabs__nav", role: "tablist", style: M, children: /* @__PURE__ */ b("div", { className: "bj-tabs__nav-wrap", children: /* @__PURE__ */ b("div", { className: "bj-tabs__nav-list", children: r.map((e, d) => /* @__PURE__ */ b(
|
|
111
|
+
z,
|
|
112
|
+
{
|
|
113
|
+
active: e.key === o,
|
|
114
|
+
id: j,
|
|
115
|
+
item: e,
|
|
116
|
+
onClick: (i) => R(e.key, i),
|
|
117
|
+
onKeyDown: (i) => S(i, d),
|
|
118
|
+
tabCount: r.length,
|
|
119
|
+
tabIndex: d
|
|
120
|
+
},
|
|
121
|
+
e.key
|
|
122
|
+
)) }) }) }),
|
|
123
|
+
/* @__PURE__ */ b(H, { activeKey: o, id: j, items: r })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
J.TabPane = G;
|
|
127
|
+
export {
|
|
128
|
+
G as TabPane,
|
|
129
|
+
J as default
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(a){return null}e.displayName="BTabs.TabPane";exports.TabPane=e;exports.default=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime");;/* empty css */const m=require("./useAutoPlacement.js");function f({placement:e="top",title:i="是否使用当前自动翻译的英文?",okText:s="使用",cancelText:c="我去改改",onOk:l,onCancel:n,className:r,style:p}){const[t,a]=m.useAutoPlacement(e),u=["tooltip-popup",`tooltip-popup--${t}`,r].filter(Boolean).join(" ");return o.jsxs("div",{ref:a,className:u,style:p,children:[o.jsx("div",{className:`tooltip-arrow tooltip-arrow--${t}`}),o.jsx("p",{className:"tooltip-confirm__title",children:i}),o.jsxs("div",{className:"tooltip-confirm__actions",children:[o.jsx("button",{className:"tooltip-confirm__cancel",onClick:n,children:c}),o.jsx("button",{className:"tooltip-confirm__ok",onClick:l,children:s})]})]})}module.exports=f;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { useAutoPlacement as u } from "./useAutoPlacement.mjs";
|
|
4
|
+
function h({
|
|
5
|
+
placement: l = "top",
|
|
6
|
+
title: p = "是否使用当前自动翻译的英文?",
|
|
7
|
+
okText: c = "使用",
|
|
8
|
+
cancelText: e = "我去改改",
|
|
9
|
+
onOk: n,
|
|
10
|
+
onCancel: r,
|
|
11
|
+
className: a,
|
|
12
|
+
style: s
|
|
13
|
+
}) {
|
|
14
|
+
const [t, m] = u(l), f = ["tooltip-popup", `tooltip-popup--${t}`, a].filter(Boolean).join(" ");
|
|
15
|
+
return /* @__PURE__ */ i("div", { ref: m, className: f, style: s, children: [
|
|
16
|
+
/* @__PURE__ */ o("div", { className: `tooltip-arrow tooltip-arrow--${t}` }),
|
|
17
|
+
/* @__PURE__ */ o("p", { className: "tooltip-confirm__title", children: p }),
|
|
18
|
+
/* @__PURE__ */ i("div", { className: "tooltip-confirm__actions", children: [
|
|
19
|
+
/* @__PURE__ */ o("button", { className: "tooltip-confirm__cancel", onClick: r, children: e }),
|
|
20
|
+
/* @__PURE__ */ o("button", { className: "tooltip-confirm__ok", onClick: n, children: c })
|
|
21
|
+
] })
|
|
22
|
+
] });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
h as default
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),y=require("react"),B=require("react-dom"),$=require("antd");;/* empty css */const P=require("./useAutoPlacement.js");function k({children:j,placement:i="top",content:a="这里是提示内容,可以包含更多详细信息。",variant:c="default",className:w,style:h,getPopupContainer:e,getAnchorElement:s,color:o,fontColor:r,autoAdjustOverflow:q=!0}){const[v,N]=P.useAutoPlacement(i),n=y.useRef(null),[b,S]=y.useState(),u=["tooltip-popup","tooltip-popup--content",`tooltip-popup--${v}`,c!=="default"?`tooltip-popup--${c}`:"",w].filter(Boolean).join(" "),p=["tooltip-arrow",`tooltip-arrow--${v}`,c==="tinted"?"tooltip-arrow--tinted-bg":""].filter(Boolean).join(" "),d={...h,...o?{backgroundColor:o}:{},...r?{color:r}:{}},f=o?{backgroundColor:o,borderColor:o}:void 0,x=r?{color:r}:void 0,_=t.jsxs("div",{className:`${u} tooltip-popup--antd`,style:d,children:[t.jsx("div",{className:p,style:f}),t.jsx("div",{className:"bu-tooltip-content__text",style:x,children:a})]});if(j)return t.jsx($.Tooltip,{title:_,placement:i==="auto"?"top":i,arrowPointAtCenter:!0,autoAdjustOverflow:q,getPopupContainer:e,overlayClassName:"bu-content-tooltip",children:j});const R=t.jsxs("div",{ref:N,className:u,style:d,children:[t.jsx("div",{className:p,style:f}),t.jsx("div",{className:"bu-tooltip-content__text",style:x,children:a})]});if(y.useLayoutEffect(()=>{if(!e||!n.current)return;const l=(s==null?void 0:s())??n.current.parentElement;if(!l)return;const m=l.getBoundingClientRect();S({position:"fixed",left:m.left+m.width/2,top:m.top,right:"auto",bottom:"auto",transform:"translate(-50%, calc(-100% - 16px))"})},[s,e]),e&&typeof document<"u"){const l=e();return t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:n,className:"tooltip-portal-anchor"}),b&&B.createPortal(t.jsxs("div",{ref:N,className:u,style:{...d,...b},children:[t.jsx("div",{className:p,style:f}),t.jsx("div",{className:"bu-tooltip-content__text",style:x,children:a})]}),l)]})}return R}module.exports=k;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as t, jsxs as i, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as k, useState as C, useLayoutEffect as P } from "react";
|
|
3
|
+
import { createPortal as T } from "react-dom";
|
|
4
|
+
import { Tooltip as F } from "antd";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { useAutoPlacement as L } from "./useAutoPlacement.mjs";
|
|
7
|
+
function J({
|
|
8
|
+
children: N,
|
|
9
|
+
placement: a = "top",
|
|
10
|
+
content: p = "这里是提示内容,可以包含更多详细信息。",
|
|
11
|
+
variant: n = "default",
|
|
12
|
+
className: h,
|
|
13
|
+
style: S,
|
|
14
|
+
getPopupContainer: o,
|
|
15
|
+
getAnchorElement: l,
|
|
16
|
+
color: e,
|
|
17
|
+
fontColor: r,
|
|
18
|
+
autoAdjustOverflow: _ = !0
|
|
19
|
+
}) {
|
|
20
|
+
const [b, x] = L(a), c = k(null), [w, j] = C(), u = [
|
|
21
|
+
"tooltip-popup",
|
|
22
|
+
"tooltip-popup--content",
|
|
23
|
+
`tooltip-popup--${b}`,
|
|
24
|
+
n !== "default" ? `tooltip-popup--${n}` : "",
|
|
25
|
+
h
|
|
26
|
+
].filter(Boolean).join(" "), d = [
|
|
27
|
+
"tooltip-arrow",
|
|
28
|
+
`tooltip-arrow--${b}`,
|
|
29
|
+
n === "tinted" ? "tooltip-arrow--tinted-bg" : ""
|
|
30
|
+
].filter(Boolean).join(" "), f = {
|
|
31
|
+
...S,
|
|
32
|
+
...e ? { backgroundColor: e } : {},
|
|
33
|
+
...r ? { color: r } : {}
|
|
34
|
+
}, m = e ? { backgroundColor: e, borderColor: e } : void 0, y = r ? { color: r } : void 0, B = /* @__PURE__ */ i("div", { className: `${u} tooltip-popup--antd`, style: f, children: [
|
|
35
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
36
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
37
|
+
] });
|
|
38
|
+
if (N)
|
|
39
|
+
return /* @__PURE__ */ t(
|
|
40
|
+
F,
|
|
41
|
+
{
|
|
42
|
+
title: B,
|
|
43
|
+
placement: a === "auto" ? "top" : a,
|
|
44
|
+
arrowPointAtCenter: !0,
|
|
45
|
+
autoAdjustOverflow: _,
|
|
46
|
+
getPopupContainer: o,
|
|
47
|
+
overlayClassName: "bu-content-tooltip",
|
|
48
|
+
children: N
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
const R = /* @__PURE__ */ i("div", { ref: x, className: u, style: f, children: [
|
|
52
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
54
|
+
] });
|
|
55
|
+
if (P(() => {
|
|
56
|
+
if (!o || !c.current) return;
|
|
57
|
+
const s = (l == null ? void 0 : l()) ?? c.current.parentElement;
|
|
58
|
+
if (!s) return;
|
|
59
|
+
const v = s.getBoundingClientRect();
|
|
60
|
+
j({
|
|
61
|
+
position: "fixed",
|
|
62
|
+
left: v.left + v.width / 2,
|
|
63
|
+
top: v.top,
|
|
64
|
+
right: "auto",
|
|
65
|
+
bottom: "auto",
|
|
66
|
+
transform: "translate(-50%, calc(-100% - 16px))"
|
|
67
|
+
});
|
|
68
|
+
}, [l, o]), o && typeof document < "u") {
|
|
69
|
+
const s = o();
|
|
70
|
+
return /* @__PURE__ */ i($, { children: [
|
|
71
|
+
/* @__PURE__ */ t("span", { ref: c, className: "tooltip-portal-anchor" }),
|
|
72
|
+
w && T(
|
|
73
|
+
/* @__PURE__ */ i("div", { ref: x, className: u, style: { ...f, ...w }, children: [
|
|
74
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
75
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
76
|
+
] }),
|
|
77
|
+
s
|
|
78
|
+
)
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
return R;
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
J as default
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime");;/* empty css */const n=require("./useAutoPlacement.js");function u({placement:t="top",title:r="正在翻译私域数据...",progress:p=0,className:i,style:l}){const[o,a]=n.useAutoPlacement(t),e=Math.min(100,Math.max(0,Math.round(p))),c=["tooltip-popup",`tooltip-popup--${o}`,i].filter(Boolean).join(" ");return s.jsxs("div",{ref:a,className:c,style:l,children:[s.jsx("div",{className:`tooltip-arrow tooltip-arrow--${o}`}),s.jsxs("div",{className:"tooltip-progress",children:[s.jsxs("div",{className:"tooltip-progress__header",children:[s.jsx("span",{className:"tooltip-progress__title",children:r}),s.jsxs("span",{className:"tooltip-progress__percent",children:[e,"%"]})]}),s.jsx("div",{className:"tooltip-progress__track",style:{"--tooltip-progress":`${e}%`},children:s.jsx("div",{className:"tooltip-progress__fill"})})]})]})}module.exports=u;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { useAutoPlacement as m } from "./useAutoPlacement.mjs";
|
|
4
|
+
function _({
|
|
5
|
+
placement: p = "top",
|
|
6
|
+
title: r = "正在翻译私域数据...",
|
|
7
|
+
progress: l = 0,
|
|
8
|
+
className: i,
|
|
9
|
+
style: a
|
|
10
|
+
}) {
|
|
11
|
+
const [s, c] = m(p), e = Math.min(100, Math.max(0, Math.round(l))), n = ["tooltip-popup", `tooltip-popup--${s}`, i].filter(Boolean).join(" ");
|
|
12
|
+
return /* @__PURE__ */ o("div", { ref: c, className: n, style: a, children: [
|
|
13
|
+
/* @__PURE__ */ t("div", { className: `tooltip-arrow tooltip-arrow--${s}` }),
|
|
14
|
+
/* @__PURE__ */ o("div", { className: "tooltip-progress", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: "tooltip-progress__header", children: [
|
|
16
|
+
/* @__PURE__ */ t("span", { className: "tooltip-progress__title", children: r }),
|
|
17
|
+
/* @__PURE__ */ o("span", { className: "tooltip-progress__percent", children: [
|
|
18
|
+
e,
|
|
19
|
+
"%"
|
|
20
|
+
] })
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ t(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: "tooltip-progress__track",
|
|
26
|
+
style: { "--tooltip-progress": `${e}%` },
|
|
27
|
+
children: /* @__PURE__ */ t("div", { className: "tooltip-progress__fill" })
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] })
|
|
31
|
+
] });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
_ as default
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("react/jsx-runtime"),a=require("react");;/* empty css */const r=a.forwardRef(({children:e,style:o,className:t},s)=>{const i=["tooltip-wrapper",t].filter(Boolean).join(" ");return p.jsx("div",{ref:s,className:i,style:o,children:e})});r.displayName="TooltipWrapper";module.exports=r;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
const l = i(
|
|
5
|
+
({ children: o, style: r, className: p }, t) => {
|
|
6
|
+
const a = ["tooltip-wrapper", p].filter(Boolean).join(" ");
|
|
7
|
+
return /* @__PURE__ */ e("div", { ref: t, className: a, style: r, children: o });
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
l.displayName = "TooltipWrapper";
|
|
11
|
+
export {
|
|
12
|
+
l as default
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),h=["top","right","bottom","left"];function b(o){const[f,i]=s.useState("top"),[t,l]=s.useState(null),a=s.useCallback(e=>{l(e)},[]);return s.useLayoutEffect(()=>{if(o!=="auto"||!t)return;const e=t.parentElement;if(!e)return;const n=e.getBoundingClientRect(),c=t.offsetWidth,p=t.offsetHeight,r=12,d={top:n.top,right:window.innerWidth-n.right,bottom:window.innerHeight-n.bottom,left:n.left},g={top:p+r,right:c+r,bottom:p+r,left:c+r};for(const u of h)if(d[u]>=g[u]){i(u);return}i("top")},[o,t]),[o==="auto"?f:o,a]}exports.useAutoPlacement=b;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState as f, useCallback as a, useLayoutEffect as b } from "react";
|
|
2
|
+
const m = ["top", "right", "bottom", "left"];
|
|
3
|
+
function E(o) {
|
|
4
|
+
const [c, i] = f("top"), [t, l] = f(null), d = a((e) => {
|
|
5
|
+
l(e);
|
|
6
|
+
}, []);
|
|
7
|
+
return b(() => {
|
|
8
|
+
if (o !== "auto" || !t) return;
|
|
9
|
+
const e = t.parentElement;
|
|
10
|
+
if (!e) return;
|
|
11
|
+
const n = e.getBoundingClientRect(), p = t.offsetWidth, u = t.offsetHeight, r = 12, g = {
|
|
12
|
+
top: n.top,
|
|
13
|
+
right: window.innerWidth - n.right,
|
|
14
|
+
bottom: window.innerHeight - n.bottom,
|
|
15
|
+
left: n.left
|
|
16
|
+
}, h = {
|
|
17
|
+
top: u + r,
|
|
18
|
+
right: p + r,
|
|
19
|
+
bottom: u + r,
|
|
20
|
+
left: p + r
|
|
21
|
+
};
|
|
22
|
+
for (const s of m)
|
|
23
|
+
if (g[s] >= h[s]) {
|
|
24
|
+
i(s);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
i("top");
|
|
28
|
+
}, [o, t]), [o === "auto" ? c : o, d];
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
E as useAutoPlacement
|
|
32
|
+
};
|