bj-web-components 0.2.19 → 0.2.21
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/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +5 -5
- package/dist/style.css +1 -1
- package/dist/web/Dropdown/BDropdown.mjs +16 -16
- package/dist/web/ProductField/ProductField.mjs +12 -12
- 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/Table/BTable.js +1 -1
- package/dist/web/Table/BTable.mjs +255 -253
- package/dist/web/Tabs/BTabs.js +1 -1
- package/dist/web/Tabs/BTabs.mjs +1 -1
- package/dist/web/Tabs/TabPane.js +1 -1
- package/dist/web/Tabs/TabPane.mjs +1 -0
- package/dist/web/Tooltip/ContentTooltip.js +1 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +61 -43
- package/dist/web.d.ts +2 -1
- package/dist/web.js +1 -1
- package/dist/web.mjs +5 -5
- package/package.json +2 -1
package/dist/web/Tabs/BTabs.js
CHANGED
|
@@ -1 +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
|
|
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;
|
package/dist/web/Tabs/BTabs.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as g, jsx as b } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as E, useState as A, useEffect as L, useMemo as T, Children as P, isValidElement as F } from "react";
|
|
3
|
-
import G from "./TabPane.mjs";
|
|
3
|
+
import { TabPane as G } from "./TabPane.mjs";
|
|
4
4
|
/* empty css */
|
|
5
5
|
function I(...n) {
|
|
6
6
|
return n.filter(Boolean).join(" ");
|
package/dist/web/Tabs/TabPane.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function a
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),y=require("react"),R=require("react-dom"),B=require("antd");;/* empty css */const $=require("./useAutoPlacement.js");function P({children:j,placement:i="top",content:a="这里是提示内容,可以包含更多详细信息。",variant:c="default",className:w,style:h,getPopupContainer:e,getAnchorElement:s,color:o,fontColor:r}){const[v,N]=$.useAutoPlacement(i),n=y.useRef(null),[b,q]=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,S=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(B.Tooltip,{title:S,placement:i==="auto"?"top":i,arrowPointAtCenter:!0,getPopupContainer:e,overlayClassName:"bu-content-tooltip",children:j});const _=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();q({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&&R.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 _}module.exports=P;
|
|
@@ -1,65 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsx as t, jsxs as i, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as $, useState as k, useLayoutEffect as C } from "react";
|
|
3
|
+
import { createPortal as P } from "react-dom";
|
|
4
|
+
import { Tooltip as T } from "antd";
|
|
4
5
|
/* empty css */
|
|
5
|
-
import { useAutoPlacement as
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { useAutoPlacement as F } from "./useAutoPlacement.mjs";
|
|
7
|
+
function I({
|
|
8
|
+
children: N,
|
|
9
|
+
placement: a = "top",
|
|
10
|
+
content: p = "这里是提示内容,可以包含更多详细信息。",
|
|
11
|
+
variant: n = "default",
|
|
12
|
+
className: h,
|
|
11
13
|
style: S,
|
|
12
|
-
getPopupContainer:
|
|
13
|
-
getAnchorElement:
|
|
14
|
-
color:
|
|
15
|
-
fontColor:
|
|
14
|
+
getPopupContainer: o,
|
|
15
|
+
getAnchorElement: l,
|
|
16
|
+
color: e,
|
|
17
|
+
fontColor: r
|
|
16
18
|
}) {
|
|
17
|
-
const [
|
|
19
|
+
const [b, x] = F(a), c = $(null), [w, _] = k(), u = [
|
|
18
20
|
"tooltip-popup",
|
|
19
21
|
"tooltip-popup--content",
|
|
20
|
-
`tooltip-popup--${
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
].filter(Boolean).join(" "),
|
|
22
|
+
`tooltip-popup--${b}`,
|
|
23
|
+
n !== "default" ? `tooltip-popup--${n}` : "",
|
|
24
|
+
h
|
|
25
|
+
].filter(Boolean).join(" "), d = [
|
|
24
26
|
"tooltip-arrow",
|
|
25
|
-
`tooltip-arrow--${
|
|
26
|
-
|
|
27
|
-
].filter(Boolean).join(" "),
|
|
27
|
+
`tooltip-arrow--${b}`,
|
|
28
|
+
n === "tinted" ? "tooltip-arrow--tinted-bg" : ""
|
|
29
|
+
].filter(Boolean).join(" "), f = {
|
|
28
30
|
...S,
|
|
29
|
-
...
|
|
30
|
-
...
|
|
31
|
-
},
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
31
|
+
...e ? { backgroundColor: e } : {},
|
|
32
|
+
...r ? { color: r } : {}
|
|
33
|
+
}, m = e ? { backgroundColor: e, borderColor: e } : void 0, y = r ? { color: r } : void 0, j = /* @__PURE__ */ i("div", { className: `${u} tooltip-popup--antd`, style: f, children: [
|
|
34
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
35
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
34
36
|
] });
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
if (N)
|
|
38
|
+
return /* @__PURE__ */ t(
|
|
39
|
+
T,
|
|
40
|
+
{
|
|
41
|
+
title: j,
|
|
42
|
+
placement: a === "auto" ? "top" : a,
|
|
43
|
+
arrowPointAtCenter: !0,
|
|
44
|
+
getPopupContainer: o,
|
|
45
|
+
overlayClassName: "bu-content-tooltip",
|
|
46
|
+
children: N
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const B = /* @__PURE__ */ i("div", { ref: x, className: u, style: f, children: [
|
|
50
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
51
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
52
|
+
] });
|
|
53
|
+
if (C(() => {
|
|
54
|
+
if (!o || !c.current) return;
|
|
55
|
+
const s = (l == null ? void 0 : l()) ?? c.current.parentElement;
|
|
38
56
|
if (!s) return;
|
|
39
|
-
const
|
|
40
|
-
|
|
57
|
+
const v = s.getBoundingClientRect();
|
|
58
|
+
_({
|
|
41
59
|
position: "fixed",
|
|
42
|
-
left:
|
|
43
|
-
top:
|
|
60
|
+
left: v.left + v.width / 2,
|
|
61
|
+
top: v.top,
|
|
44
62
|
right: "auto",
|
|
45
63
|
bottom: "auto",
|
|
46
64
|
transform: "translate(-50%, calc(-100% - 16px))"
|
|
47
65
|
});
|
|
48
|
-
}, [
|
|
49
|
-
const s =
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
66
|
+
}, [l, o]), o && typeof document < "u") {
|
|
67
|
+
const s = o();
|
|
68
|
+
return /* @__PURE__ */ i(R, { children: [
|
|
69
|
+
/* @__PURE__ */ t("span", { ref: c, className: "tooltip-portal-anchor" }),
|
|
70
|
+
w && P(
|
|
71
|
+
/* @__PURE__ */ i("div", { ref: x, className: u, style: { ...f, ...w }, children: [
|
|
72
|
+
/* @__PURE__ */ t("div", { className: d, style: m }),
|
|
73
|
+
/* @__PURE__ */ t("div", { className: "bu-tooltip-content__text", style: y, children: p })
|
|
56
74
|
] }),
|
|
57
75
|
s
|
|
58
76
|
)
|
|
59
77
|
] });
|
|
60
78
|
}
|
|
61
|
-
return
|
|
79
|
+
return B;
|
|
62
80
|
}
|
|
63
81
|
export {
|
|
64
|
-
|
|
82
|
+
I as default
|
|
65
83
|
};
|
package/dist/web.d.ts
CHANGED
|
@@ -290,7 +290,7 @@ export declare interface BTabsTabPaneProps extends Omit<BTabsItem, 'key' | 'labe
|
|
|
290
290
|
|
|
291
291
|
export declare type BTabsType = 'line' | 'card';
|
|
292
292
|
|
|
293
|
-
declare function BTooltip({ placement, content, variant, className, style, getPopupContainer, getAnchorElement, color, fontColor, }: ContentTooltipProps): JSX.Element;
|
|
293
|
+
declare function BTooltip({ children, placement, content, variant, className, style, getPopupContainer, getAnchorElement, color, fontColor, }: ContentTooltipProps): JSX.Element;
|
|
294
294
|
export { BTooltip }
|
|
295
295
|
export { BTooltip as ContentTooltip }
|
|
296
296
|
|
|
@@ -695,6 +695,7 @@ export declare interface ConfirmTooltipProps extends BaseTooltipProps {
|
|
|
695
695
|
}
|
|
696
696
|
|
|
697
697
|
declare interface ContentTooltipProps extends BaseTooltipProps {
|
|
698
|
+
children?: React.ReactElement;
|
|
698
699
|
content?: ReactNode;
|
|
699
700
|
variant?: TooltipVariant;
|
|
700
701
|
/** Tooltip background color, including the arrow. */
|
package/dist/web.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./web/Icon/Icon.js"),e=require("./web/Tooltip/ConfirmTooltip.js"),t=require("./web/Tooltip/ProgressTooltip.js"),r=require("./web/Tooltip/ContentTooltip.js"),n=require("./web/Tooltip/TooltipWrapper.js"),u=require("./web/SkuInputCard/SkuInputCard.js"),i=require("./web/Input/Input.js"),c=require("./web/BasicInput/BInput.js"),p=require("./web/Tabs/BTabs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./web/Icon/Icon.js"),e=require("./web/Tooltip/ConfirmTooltip.js"),t=require("./web/Tooltip/ProgressTooltip.js"),r=require("./web/Tooltip/ContentTooltip.js"),n=require("./web/Tooltip/TooltipWrapper.js"),u=require("./web/SkuInputCard/SkuInputCard.js"),i=require("./web/Input/Input.js"),c=require("./web/BasicInput/BInput.js"),p=require("./web/Tabs/BTabs.js"),a=require("./web/Tabs/TabPane.js"),l=require("./web/EmptyInputBox/EmptyInputBox.js"),s=require("./web/Modal/Modal.js"),B=require("./web/ProductField/ProductField.js"),q=require("./web/CategoryDropdown/CategoryDropdown.js"),d=require("./web/Pagination/Pagination.js"),T=require("./web/FileCard/FileCard.js"),C=require("./web/Switch/Switch.js"),b=require("./web/InputNumber/BInputNumber.js"),I=require("./web/Table/BTable.js"),m=require("./web/Table/Column.js"),P=require("./web/Table/ColumnGroup.js"),g=require("./web/CheckBox/index.js"),y=require("./web/OverlayScrollbar/BOverlayScrollbar.js"),S=require("./web/Dropdown/BDropdown.js");exports.BuIcon=o;exports.ConfirmTooltip=e;exports.ProgressTooltip=t;exports.BTooltip=r;exports.ContentTooltip=r;exports.TooltipWrapper=n;exports.SkuInputCard=u;exports.BuInput=i;exports.BInput=c;exports.BTabs=p.default;exports.TabPane=a.TabPane;exports.BuEmptyInputBox=l;exports.BuModal=s;exports.BuProductField=B;exports.BuCategoryDropdown=q;exports.Pagination=d;exports.FileCard=T;exports.BuSwitch=C;exports.BInputNumber=b;exports.BTable=I.BTable;exports.Column=m;exports.ColumnGroup=P;exports.BCheckBox=g.BCheckBox;exports.BOverlayScrollbar=y;exports.BDropdown=S.BDropdown;
|
package/dist/web.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { default as t } from "./web/Icon/Icon.mjs";
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as a } from "./web/Tooltip/ConfirmTooltip.mjs";
|
|
3
3
|
import { default as p } from "./web/Tooltip/ProgressTooltip.mjs";
|
|
4
|
-
import { default as l, default as
|
|
4
|
+
import { default as l, default as m } from "./web/Tooltip/ContentTooltip.mjs";
|
|
5
5
|
import { default as x } from "./web/Tooltip/TooltipWrapper.mjs";
|
|
6
6
|
import { default as B } from "./web/SkuInputCard/SkuInputCard.mjs";
|
|
7
7
|
import { default as i } from "./web/Input/Input.mjs";
|
|
8
8
|
import { default as T } from "./web/BasicInput/BInput.mjs";
|
|
9
9
|
import { default as b } from "./web/Tabs/BTabs.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { TabPane as P } from "./web/Tabs/TabPane.mjs";
|
|
11
11
|
import { default as w } from "./web/EmptyInputBox/EmptyInputBox.mjs";
|
|
12
12
|
import { default as S } from "./web/Modal/Modal.mjs";
|
|
13
13
|
import { default as k } from "./web/ProductField/ProductField.mjs";
|
|
@@ -40,8 +40,8 @@ export {
|
|
|
40
40
|
O as BuSwitch,
|
|
41
41
|
H as Column,
|
|
42
42
|
K as ColumnGroup,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
a as ConfirmTooltip,
|
|
44
|
+
m as ContentTooltip,
|
|
45
45
|
M as FileCard,
|
|
46
46
|
E as Pagination,
|
|
47
47
|
p as ProgressTooltip,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bj-web-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "Enterprise UI component library for Web, Mobile, and Mini-app platforms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"build:lib:watch": "vite build --mode lib --watch"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
+
"antd": ">=4.19.3 <5",
|
|
71
72
|
"react": ">=17.0.2",
|
|
72
73
|
"react-dom": ">=17.0.2"
|
|
73
74
|
},
|