bj-web-components 0.2.34 → 0.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +10 -1
  2. package/dist/index.js +58 -1
  3. package/dist/index.mjs +1 -29
  4. package/dist/miniapp.js +1 -1
  5. package/dist/miniapp.mjs +0 -1
  6. package/dist/mobile.js +1 -1
  7. package/dist/mobile.mjs +0 -1
  8. package/dist/react.js +1 -1
  9. package/dist/react.mjs +0 -1
  10. package/dist/shared.js +1 -1
  11. package/dist/shared.mjs +0 -1
  12. package/dist/style.css +1 -1
  13. package/dist/web/BasicInput/BInput.js +278 -1
  14. package/dist/web/BasicInput/BInput.mjs +263 -164
  15. package/dist/web/BasicInput/utils.js +47 -1
  16. package/dist/web/BasicInput/utils.mjs +22 -20
  17. package/dist/web/CategoryDropdown/CategoryDropdown.js +376 -1
  18. package/dist/web/CategoryDropdown/CategoryDropdown.mjs +355 -235
  19. package/dist/web/CheckBox/BCheckBox.js +176 -1
  20. package/dist/web/CheckBox/BCheckBox.mjs +169 -98
  21. package/dist/web/CheckBox/Group.js +111 -1
  22. package/dist/web/CheckBox/Group.mjs +104 -64
  23. package/dist/web/CheckBox/context.js +8 -1
  24. package/dist/web/CheckBox/context.mjs +2 -4
  25. package/dist/web/CheckBox/index.js +11 -1
  26. package/dist/web/CheckBox/index.mjs +2 -4
  27. package/dist/web/Dropdown/BDropdown.js +265 -1
  28. package/dist/web/Dropdown/BDropdown.mjs +233 -133
  29. package/dist/web/EmptyInputBox/EmptyInputBox.js +89 -1
  30. package/dist/web/EmptyInputBox/EmptyInputBox.mjs +85 -72
  31. package/dist/web/FileCard/FileCard.js +414 -1
  32. package/dist/web/FileCard/FileCard.mjs +400 -116
  33. package/dist/web/Icon/Icon.js +82 -1
  34. package/dist/web/Icon/Icon.mjs +78 -8
  35. package/dist/web/Input/Input.js +230 -1
  36. package/dist/web/Input/Input.mjs +219 -164
  37. package/dist/web/InputNumber/BInputNumber.js +271 -1
  38. package/dist/web/InputNumber/BInputNumber.mjs +254 -189
  39. package/dist/web/InputNumber/StepHandler.js +112 -1
  40. package/dist/web/InputNumber/StepHandler.mjs +102 -50
  41. package/dist/web/InputNumber/hooks/useCursor.js +38 -1
  42. package/dist/web/InputNumber/hooks/useCursor.mjs +31 -34
  43. package/dist/web/InputNumber/hooks/useFrame.js +15 -1
  44. package/dist/web/InputNumber/hooks/useFrame.mjs +8 -5
  45. package/dist/web/InputNumber/utils/decimal.js +163 -1
  46. package/dist/web/InputNumber/utils/decimal.mjs +114 -79
  47. package/dist/web/MobileDrawer/BMobileDrawer.js +238 -1
  48. package/dist/web/MobileDrawer/BMobileDrawer.mjs +221 -139
  49. package/dist/web/Modal/Modal.js +148 -1
  50. package/dist/web/Modal/Modal.mjs +143 -79
  51. package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +273 -1
  52. package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +262 -143
  53. package/dist/web/Pagination/Pagination.js +352 -1
  54. package/dist/web/Pagination/Pagination.mjs +342 -247
  55. package/dist/web/ProductField/ProductField.js +443 -1
  56. package/dist/web/ProductField/ProductField.mjs +423 -208
  57. package/dist/web/ProductField/arrow-up.svg.js +4 -1
  58. package/dist/web/ProductField/arrow-up.svg.mjs +2 -4
  59. package/dist/web/ProductField/checkbox-no.svg.js +4 -1
  60. package/dist/web/ProductField/checkbox-no.svg.mjs +2 -4
  61. package/dist/web/ProductField/checkbox-ok.svg.js +4 -1
  62. package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -4
  63. package/dist/web/ProductField/no_data_light.svg.js +4 -1
  64. package/dist/web/ProductField/no_data_light.svg.mjs +2 -4
  65. package/dist/web/ProductField/search.svg.js +4 -1
  66. package/dist/web/ProductField/search.svg.mjs +2 -4
  67. package/dist/web/ProductField/sort.svg.js +4 -1
  68. package/dist/web/ProductField/sort.svg.mjs +2 -4
  69. package/dist/web/Radio/BRadio.js +151 -1
  70. package/dist/web/Radio/BRadio.mjs +147 -75
  71. package/dist/web/Radio/Button.js +54 -1
  72. package/dist/web/Radio/Button.mjs +51 -8
  73. package/dist/web/Radio/Group.js +97 -1
  74. package/dist/web/Radio/Group.mjs +92 -76
  75. package/dist/web/Radio/context.js +10 -1
  76. package/dist/web/Radio/context.mjs +3 -5
  77. package/dist/web/Radio/index.js +13 -1
  78. package/dist/web/Radio/index.mjs +2 -4
  79. package/dist/web/SkuInputCard/SkuInputCard.js +427 -1
  80. package/dist/web/SkuInputCard/SkuInputCard.mjs +414 -219
  81. package/dist/web/SkuInputCard/spin_loading_red.gif.js +4 -1
  82. package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -4
  83. package/dist/web/Switch/Switch.js +114 -1
  84. package/dist/web/Switch/Switch.mjs +109 -58
  85. package/dist/web/Table/BTable.js +1049 -1
  86. package/dist/web/Table/BTable.mjs +1011 -667
  87. package/dist/web/Table/Column.js +6 -1
  88. package/dist/web/Table/Column.mjs +1 -3
  89. package/dist/web/Table/ColumnGroup.js +6 -1
  90. package/dist/web/Table/ColumnGroup.mjs +1 -3
  91. package/dist/web/Table/utils/columns.js +116 -1
  92. package/dist/web/Table/utils/columns.mjs +103 -37
  93. package/dist/web/Table/utils/sortFilter.js +145 -1
  94. package/dist/web/Table/utils/sortFilter.mjs +129 -57
  95. package/dist/web/Tabs/BTabs.js +260 -1
  96. package/dist/web/Tabs/BTabs.mjs +239 -122
  97. package/dist/web/Tabs/TabPane.js +19 -1
  98. package/dist/web/Tabs/TabPane.mjs +1 -4
  99. package/dist/web/Tooltip/ConfirmTooltip.js +53 -1
  100. package/dist/web/Tooltip/ConfirmTooltip.mjs +47 -22
  101. package/dist/web/Tooltip/ContentTooltip.js +156 -1
  102. package/dist/web/Tooltip/ContentTooltip.mjs +145 -76
  103. package/dist/web/Tooltip/ProgressTooltip.js +56 -1
  104. package/dist/web/Tooltip/ProgressTooltip.mjs +50 -31
  105. package/dist/web/Tooltip/TooltipWrapper.js +19 -1
  106. package/dist/web/Tooltip/TooltipWrapper.mjs +13 -9
  107. package/dist/web/Tooltip/useAutoPlacement.js +65 -1
  108. package/dist/web/Tooltip/useAutoPlacement.mjs +52 -24
  109. package/dist/web.js +58 -1
  110. package/dist/web.mjs +1 -29
  111. package/package.json +3 -1
@@ -2,7 +2,4 @@ function a(e) {
2
2
  return null;
3
3
  }
4
4
  a.displayName = "BTabs.TabPane";
5
- export {
6
- a as TabPane,
7
- a as default
8
- };
5
+ export { a as TabPane, a as default };
@@ -1 +1,53 @@
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;
1
+ "use strict";
2
+
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ var o = require("react/jsx-runtime");
10
+ ; /* empty css */
11
+ var m = require("./useAutoPlacement.js");
12
+ function f(_ref) {
13
+ var _ref$placement = _ref.placement,
14
+ e = _ref$placement === void 0 ? "top" : _ref$placement,
15
+ _ref$title = _ref.title,
16
+ i = _ref$title === void 0 ? "是否使用当前自动翻译的英文?" : _ref$title,
17
+ _ref$okText = _ref.okText,
18
+ s = _ref$okText === void 0 ? "使用" : _ref$okText,
19
+ _ref$cancelText = _ref.cancelText,
20
+ c = _ref$cancelText === void 0 ? "我去改改" : _ref$cancelText,
21
+ l = _ref.onOk,
22
+ n = _ref.onCancel,
23
+ r = _ref.className,
24
+ p = _ref.style;
25
+ var _m$useAutoPlacement = m.useAutoPlacement(e),
26
+ _m$useAutoPlacement2 = _slicedToArray(_m$useAutoPlacement, 2),
27
+ t = _m$useAutoPlacement2[0],
28
+ a = _m$useAutoPlacement2[1],
29
+ u = ["tooltip-popup", "tooltip-popup--".concat(t), r].filter(Boolean).join(" ");
30
+ return o.jsxs("div", {
31
+ ref: a,
32
+ className: u,
33
+ style: p,
34
+ children: [o.jsx("div", {
35
+ className: "tooltip-arrow tooltip-arrow--".concat(t)
36
+ }), o.jsx("p", {
37
+ className: "tooltip-confirm__title",
38
+ children: i
39
+ }), o.jsxs("div", {
40
+ className: "tooltip-confirm__actions",
41
+ children: [o.jsx("button", {
42
+ className: "tooltip-confirm__cancel",
43
+ onClick: n,
44
+ children: c
45
+ }), o.jsx("button", {
46
+ className: "tooltip-confirm__ok",
47
+ onClick: l,
48
+ children: s
49
+ })]
50
+ })]
51
+ });
52
+ }
53
+ module.exports = f;
@@ -1,26 +1,51 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
8
  /* empty css */
3
9
  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
- ] });
10
+ function h(_ref) {
11
+ var _ref$placement = _ref.placement,
12
+ l = _ref$placement === void 0 ? "top" : _ref$placement,
13
+ _ref$title = _ref.title,
14
+ p = _ref$title === void 0 ? "是否使用当前自动翻译的英文?" : _ref$title,
15
+ _ref$okText = _ref.okText,
16
+ c = _ref$okText === void 0 ? "使用" : _ref$okText,
17
+ _ref$cancelText = _ref.cancelText,
18
+ e = _ref$cancelText === void 0 ? "我去改改" : _ref$cancelText,
19
+ n = _ref.onOk,
20
+ r = _ref.onCancel,
21
+ a = _ref.className,
22
+ s = _ref.style;
23
+ var _u = u(l),
24
+ _u2 = _slicedToArray(_u, 2),
25
+ t = _u2[0],
26
+ m = _u2[1],
27
+ f = ["tooltip-popup", "tooltip-popup--".concat(t), a].filter(Boolean).join(" ");
28
+ return /* @__PURE__ */i("div", {
29
+ ref: m,
30
+ className: f,
31
+ style: s,
32
+ children: [/* @__PURE__ */o("div", {
33
+ className: "tooltip-arrow tooltip-arrow--".concat(t)
34
+ }), /* @__PURE__ */o("p", {
35
+ className: "tooltip-confirm__title",
36
+ children: p
37
+ }), /* @__PURE__ */i("div", {
38
+ className: "tooltip-confirm__actions",
39
+ children: [/* @__PURE__ */o("button", {
40
+ className: "tooltip-confirm__cancel",
41
+ onClick: r,
42
+ children: e
43
+ }), /* @__PURE__ */o("button", {
44
+ className: "tooltip-confirm__ok",
45
+ onClick: n,
46
+ children: c
47
+ })]
48
+ })]
49
+ });
23
50
  }
24
- export {
25
- h as default
26
- };
51
+ export { h as default };
@@ -1 +1,156 @@
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;
1
+ "use strict";
2
+
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ var o = require("react/jsx-runtime"),
11
+ _ = require("react"),
12
+ $ = require("react-dom"),
13
+ C = require("antd");
14
+ ; /* empty css */
15
+ var E = require("./useAutoPlacement.js");
16
+ var I = Object.defineProperty,
17
+ h = Object.getOwnPropertySymbols,
18
+ T = Object.prototype.hasOwnProperty,
19
+ A = Object.prototype.propertyIsEnumerable,
20
+ P = function P(r, t, e) {
21
+ return t in r ? I(r, t, {
22
+ enumerable: !0,
23
+ configurable: !0,
24
+ writable: !0,
25
+ value: e
26
+ }) : r[t] = e;
27
+ },
28
+ n = function n(r, t) {
29
+ for (var e in t || (t = {})) T.call(t, e) && P(r, e, t[e]);
30
+ if (h) {
31
+ var _iterator = _createForOfIteratorHelper(h(t)),
32
+ _step;
33
+ try {
34
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
35
+ var e = _step.value;
36
+ A.call(t, e) && P(r, e, t[e]);
37
+ }
38
+ } catch (err) {
39
+ _iterator.e(err);
40
+ } finally {
41
+ _iterator.f();
42
+ }
43
+ }
44
+ return r;
45
+ };
46
+ function D(_ref) {
47
+ var r = _ref.children,
48
+ _ref$placement = _ref.placement,
49
+ t = _ref$placement === void 0 ? "top" : _ref$placement,
50
+ _ref$content = _ref.content,
51
+ e = _ref$content === void 0 ? "这里是提示内容,可以包含更多详细信息。" : _ref$content,
52
+ _ref$variant = _ref.variant,
53
+ c = _ref$variant === void 0 ? "default" : _ref$variant,
54
+ O = _ref.className,
55
+ S = _ref.style,
56
+ s = _ref.getPopupContainer,
57
+ p = _ref.getAnchorElement,
58
+ l = _ref.color,
59
+ a = _ref.fontColor,
60
+ _ref$autoAdjustOverfl = _ref.autoAdjustOverflow,
61
+ q = _ref$autoAdjustOverfl === void 0 ? !0 : _ref$autoAdjustOverfl;
62
+ var _E$useAutoPlacement = E.useAutoPlacement(t),
63
+ _E$useAutoPlacement2 = _slicedToArray(_E$useAutoPlacement, 2),
64
+ j = _E$useAutoPlacement2[0],
65
+ w = _E$useAutoPlacement2[1],
66
+ u = _.useRef(null),
67
+ _$useState = _.useState(),
68
+ _$useState2 = _slicedToArray(_$useState, 2),
69
+ N = _$useState2[0],
70
+ g = _$useState2[1],
71
+ d = ["tooltip-popup", "tooltip-popup--content", "tooltip-popup--".concat(j), c !== "default" ? "tooltip-popup--".concat(c) : "", O].filter(Boolean).join(" "),
72
+ f = ["tooltip-arrow", "tooltip-arrow--".concat(j), c === "tinted" ? "tooltip-arrow--tinted-bg" : ""].filter(Boolean).join(" "),
73
+ m = n(n(n({}, S), l ? {
74
+ backgroundColor: l
75
+ } : {}), a ? {
76
+ color: a
77
+ } : {}),
78
+ y = l ? {
79
+ backgroundColor: l,
80
+ borderColor: l
81
+ } : void 0,
82
+ v = a ? {
83
+ color: a
84
+ } : void 0,
85
+ R = o.jsxs("div", {
86
+ className: "".concat(d, " tooltip-popup--antd"),
87
+ style: m,
88
+ children: [o.jsx("div", {
89
+ className: f,
90
+ style: y
91
+ }), o.jsx("div", {
92
+ className: "bu-tooltip-content__text",
93
+ style: v,
94
+ children: e
95
+ })]
96
+ });
97
+ if (r) return o.jsx(C.Tooltip, {
98
+ title: R,
99
+ placement: t === "auto" ? "top" : t,
100
+ arrowPointAtCenter: !0,
101
+ autoAdjustOverflow: q,
102
+ getPopupContainer: s,
103
+ overlayClassName: "bu-content-tooltip",
104
+ children: r
105
+ });
106
+ var B = o.jsxs("div", {
107
+ ref: w,
108
+ className: d,
109
+ style: m,
110
+ children: [o.jsx("div", {
111
+ className: f,
112
+ style: y
113
+ }), o.jsx("div", {
114
+ className: "bu-tooltip-content__text",
115
+ style: v,
116
+ children: e
117
+ })]
118
+ });
119
+ if (_.useLayoutEffect(function () {
120
+ var i;
121
+ if (!s || !u.current) return;
122
+ var b = (i = p == null ? void 0 : p()) != null ? i : u.current.parentElement;
123
+ if (!b) return;
124
+ var x = b.getBoundingClientRect();
125
+ g({
126
+ position: "fixed",
127
+ left: x.left + x.width / 2,
128
+ top: x.top,
129
+ right: "auto",
130
+ bottom: "auto",
131
+ transform: "translate(-50%, calc(-100% - 16px))"
132
+ });
133
+ }, [p, s]), s && typeof document != "undefined") {
134
+ var i = s();
135
+ return o.jsxs(o.Fragment, {
136
+ children: [o.jsx("span", {
137
+ ref: u,
138
+ className: "tooltip-portal-anchor"
139
+ }), N && $.createPortal(o.jsxs("div", {
140
+ ref: w,
141
+ className: d,
142
+ style: n(n({}, m), N),
143
+ children: [o.jsx("div", {
144
+ className: f,
145
+ style: y
146
+ }), o.jsx("div", {
147
+ className: "bu-tooltip-content__text",
148
+ style: v,
149
+ children: e
150
+ })]
151
+ }), i)]
152
+ });
153
+ }
154
+ return B;
155
+ }
156
+ module.exports = D;
@@ -1,85 +1,154 @@
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";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
5
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
6
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
+ import { jsx as r, jsxs as p, Fragment as C } from "react/jsx-runtime";
9
+ import { useRef as E, useState as I, useLayoutEffect as T } from "react";
10
+ import { createPortal as F } from "react-dom";
11
+ import { Tooltip as L } from "antd";
5
12
  /* 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
13
+ import { useAutoPlacement as V } from "./useAutoPlacement.mjs";
14
+ var k = Object.defineProperty,
15
+ x = Object.getOwnPropertySymbols,
16
+ q = Object.prototype.hasOwnProperty,
17
+ z = Object.prototype.propertyIsEnumerable,
18
+ O = function O(e, t, o) {
19
+ return t in e ? k(e, t, {
20
+ enumerable: !0,
21
+ configurable: !0,
22
+ writable: !0,
23
+ value: o
24
+ }) : e[t] = o;
25
+ },
26
+ s = function s(e, t) {
27
+ for (var o in t || (t = {})) q.call(t, o) && O(e, o, t[o]);
28
+ if (x) {
29
+ var _iterator = _createForOfIteratorHelper(x(t)),
30
+ _step;
31
+ try {
32
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
33
+ var o = _step.value;
34
+ z.call(t, o) && O(e, o, t[o]);
35
+ }
36
+ } catch (err) {
37
+ _iterator.e(err);
38
+ } finally {
39
+ _iterator.f();
49
40
  }
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({
41
+ }
42
+ return e;
43
+ };
44
+ function M(_ref) {
45
+ var e = _ref.children,
46
+ _ref$placement = _ref.placement,
47
+ t = _ref$placement === void 0 ? "top" : _ref$placement,
48
+ _ref$content = _ref.content,
49
+ o = _ref$content === void 0 ? "这里是提示内容,可以包含更多详细信息。" : _ref$content,
50
+ _ref$variant = _ref.variant,
51
+ c = _ref$variant === void 0 ? "default" : _ref$variant,
52
+ S = _ref.className,
53
+ j = _ref.style,
54
+ l = _ref.getPopupContainer,
55
+ u = _ref.getAnchorElement,
56
+ a = _ref.color,
57
+ n = _ref.fontColor,
58
+ _ref$autoAdjustOverfl = _ref.autoAdjustOverflow,
59
+ g = _ref$autoAdjustOverfl === void 0 ? !0 : _ref$autoAdjustOverfl;
60
+ var _V = V(t),
61
+ _V2 = _slicedToArray(_V, 2),
62
+ N = _V2[0],
63
+ b = _V2[1],
64
+ d = E(null),
65
+ _I = I(),
66
+ _I2 = _slicedToArray(_I, 2),
67
+ h = _I2[0],
68
+ B = _I2[1],
69
+ f = ["tooltip-popup", "tooltip-popup--content", "tooltip-popup--".concat(N), c !== "default" ? "tooltip-popup--".concat(c) : "", S].filter(Boolean).join(" "),
70
+ m = ["tooltip-arrow", "tooltip-arrow--".concat(N), c === "tinted" ? "tooltip-arrow--tinted-bg" : ""].filter(Boolean).join(" "),
71
+ y = s(s(s({}, j), a ? {
72
+ backgroundColor: a
73
+ } : {}), n ? {
74
+ color: n
75
+ } : {}),
76
+ v = a ? {
77
+ backgroundColor: a,
78
+ borderColor: a
79
+ } : void 0,
80
+ _ = n ? {
81
+ color: n
82
+ } : void 0,
83
+ R = /* @__PURE__ */p("div", {
84
+ className: "".concat(f, " tooltip-popup--antd"),
85
+ style: y,
86
+ children: [/* @__PURE__ */r("div", {
87
+ className: m,
88
+ style: v
89
+ }), /* @__PURE__ */r("div", {
90
+ className: "bu-tooltip-content__text",
91
+ style: _,
92
+ children: o
93
+ })]
94
+ });
95
+ if (e) return /* @__PURE__ */r(L, {
96
+ title: R,
97
+ placement: t === "auto" ? "top" : t,
98
+ arrowPointAtCenter: !0,
99
+ autoAdjustOverflow: g,
100
+ getPopupContainer: l,
101
+ overlayClassName: "bu-content-tooltip",
102
+ children: e
103
+ });
104
+ var $ = /* @__PURE__ */p("div", {
105
+ ref: b,
106
+ className: f,
107
+ style: y,
108
+ children: [/* @__PURE__ */r("div", {
109
+ className: m,
110
+ style: v
111
+ }), /* @__PURE__ */r("div", {
112
+ className: "bu-tooltip-content__text",
113
+ style: _,
114
+ children: o
115
+ })]
116
+ });
117
+ if (T(function () {
118
+ var i;
119
+ if (!l || !d.current) return;
120
+ var P = (i = u == null ? void 0 : u()) != null ? i : d.current.parentElement;
121
+ if (!P) return;
122
+ var w = P.getBoundingClientRect();
123
+ B({
61
124
  position: "fixed",
62
- left: v.left + v.width / 2,
63
- top: v.top,
125
+ left: w.left + w.width / 2,
126
+ top: w.top,
64
127
  right: "auto",
65
128
  bottom: "auto",
66
129
  transform: "translate(-50%, calc(-100% - 16px))"
67
130
  });
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
- ] });
131
+ }, [u, l]), l && typeof document != "undefined") {
132
+ var i = l();
133
+ return /* @__PURE__ */p(C, {
134
+ children: [/* @__PURE__ */r("span", {
135
+ ref: d,
136
+ className: "tooltip-portal-anchor"
137
+ }), h && F(/* @__PURE__ */p("div", {
138
+ ref: b,
139
+ className: f,
140
+ style: s(s({}, y), h),
141
+ children: [/* @__PURE__ */r("div", {
142
+ className: m,
143
+ style: v
144
+ }), /* @__PURE__ */r("div", {
145
+ className: "bu-tooltip-content__text",
146
+ style: _,
147
+ children: o
148
+ })]
149
+ }), i)]
150
+ });
80
151
  }
81
- return R;
152
+ return $;
82
153
  }
83
- export {
84
- J as default
85
- };
154
+ export { M as default };
@@ -1 +1,56 @@
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;
1
+ "use strict";
2
+
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ var s = require("react/jsx-runtime");
10
+ ; /* empty css */
11
+ var n = require("./useAutoPlacement.js");
12
+ function u(_ref) {
13
+ var _ref$placement = _ref.placement,
14
+ t = _ref$placement === void 0 ? "top" : _ref$placement,
15
+ _ref$title = _ref.title,
16
+ r = _ref$title === void 0 ? "正在翻译私域数据..." : _ref$title,
17
+ _ref$progress = _ref.progress,
18
+ p = _ref$progress === void 0 ? 0 : _ref$progress,
19
+ i = _ref.className,
20
+ l = _ref.style;
21
+ var _n$useAutoPlacement = n.useAutoPlacement(t),
22
+ _n$useAutoPlacement2 = _slicedToArray(_n$useAutoPlacement, 2),
23
+ o = _n$useAutoPlacement2[0],
24
+ a = _n$useAutoPlacement2[1],
25
+ e = Math.min(100, Math.max(0, Math.round(p))),
26
+ c = ["tooltip-popup", "tooltip-popup--".concat(o), i].filter(Boolean).join(" ");
27
+ return s.jsxs("div", {
28
+ ref: a,
29
+ className: c,
30
+ style: l,
31
+ children: [s.jsx("div", {
32
+ className: "tooltip-arrow tooltip-arrow--".concat(o)
33
+ }), s.jsxs("div", {
34
+ className: "tooltip-progress",
35
+ children: [s.jsxs("div", {
36
+ className: "tooltip-progress__header",
37
+ children: [s.jsx("span", {
38
+ className: "tooltip-progress__title",
39
+ children: r
40
+ }), s.jsxs("span", {
41
+ className: "tooltip-progress__percent",
42
+ children: [e, "%"]
43
+ })]
44
+ }), s.jsx("div", {
45
+ className: "tooltip-progress__track",
46
+ style: {
47
+ "--tooltip-progress": "".concat(e, "%")
48
+ },
49
+ children: s.jsx("div", {
50
+ className: "tooltip-progress__fill"
51
+ })
52
+ })]
53
+ })]
54
+ });
55
+ }
56
+ module.exports = u;