bj-web-components 0.2.34 → 0.2.35

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 +234 -134
  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 +97 -95
@@ -1 +1,443 @@
1
- "use strict";const t=require("react/jsx-runtime"),c=require("react"),ne=require("react-dom");;/* empty css */const ce=require("./no_data_light.svg.js"),B=require("./arrow-up.svg.js"),oe=require("./sort.svg.js"),ie=require("./search.svg.js"),ae=require("./checkbox-no.svg.js"),ue=require("./checkbox-ok.svg.js");function Z({size:u=20}){return t.jsx("svg",{width:u,height:u,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.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"})})}function le({options:u=[],value:a=[],onChange:o,placeholder:R="请选择",emptyText:D="暂无产品数据",onManageField:I,multiple:d=!0,showSearch:E=!0,showSort:q=!0,addButtonText:y,onAdd:U,labels:s,className:H,style:G,getPopupContainer:x}){const J=(s==null?void 0:s.searchPlaceholder)??"搜索",K=(s==null?void 0:s.sortDefault)??"默认顺序",Q=(s==null?void 0:s.sortAsc)??"名称A-Z",V=(s==null?void 0:s.sortDesc)??"名称Z-A",O=(s==null?void 0:s.noMatchText)??"暂无选项",W=(s==null?void 0:s.manageFieldPre)??"请前往",Y=(s==null?void 0:s.manageFieldLink)??"管理字段",ee=(s==null?void 0:s.manageFieldPost)??"添加",[f,C]=c.useState(!1),[j,M]=c.useState(""),[p,F]=c.useState("none"),[w,N]=c.useState(!1),m=c.useRef(null),b=c.useRef(null),P=c.useRef(null),[v,te]=c.useState({top:0,left:0,width:0}),l=c.useCallback(()=>{if(!m.current)return;const e=m.current.getBoundingClientRect();te({top:e.bottom+4,left:e.left,width:e.width})},[]);c.useLayoutEffect(()=>{f&&l()},[f,l]),c.useEffect(()=>{if(!f)return;const e=r=>{var i,g;const n=r.target;(i=P.current)!=null&&i.contains(n)||(g=m.current)!=null&&g.contains(n)||L()};return document.addEventListener("mousedown",e),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[f,l]),c.useEffect(()=>{if(!w)return;const e=r=>{b.current&&!b.current.contains(r.target)&&N(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]);const S=c.useRef(null),$=c.useRef(null),h=c.useRef({dragging:!1,startX:0,scrollLeft:0,target:null}),T=c.useCallback(e=>({onMouseDown:r=>{const n=e.current;n&&(h.current={dragging:!0,startX:r.clientX,scrollLeft:n.scrollLeft,target:n})},onMouseMove:r=>{const{dragging:n,startX:i,scrollLeft:g,target:A}=h.current;!n||!A||(r.preventDefault(),A.scrollLeft=g-(r.clientX-i))},onMouseUp:()=>{h.current.dragging=!1},onMouseLeave:()=>{h.current.dragging=!1}}),[]);function se(e){if(!d){o==null||o(a.includes(e)?[]:[e]),a.includes(e)||L();return}const r=a.includes(e)?a.filter(n=>n!==e):[...a,e];o==null||o(r)}function X(e){o==null||o(a.filter(r=>r!==e))}function L(){C(!1),M(""),F("none")}function re(e){F(e),N(!1)}const z=c.useMemo(()=>{let e=u.filter(n=>(n.searchText??(typeof n.label=="string"?n.label:"")).toLowerCase().includes(j.toLowerCase()));const r=n=>n.searchText??(typeof n.label=="string"?n.label:"");return p==="asc"&&(e=[...e].sort((n,i)=>r(n).localeCompare(r(i)))),p==="desc"&&(e=[...e].sort((n,i)=>r(i).localeCompare(r(n)))),e},[u,j,p]),_=u.filter(e=>a.includes(e.value)),k=u.length>0;return t.jsxs("div",{ref:m,className:["bu-pf",H].filter(Boolean).join(" "),style:G,children:[!f&&t.jsxs("div",{className:`bu-pf__trigger${_.length>0?" bu-pf__trigger--selected":""}`,onClick:()=>C(!0),children:[_.length>0?t.jsx("div",{className:"bu-pf__trigger-tags",ref:$,...T($),children:_.map(e=>t.jsxs("span",{className:`bu-pf__tag${d?"":" bu-pf__tag--single"}`,children:[t.jsx("span",{className:"bu-pf__tag-text",children:e.label}),t.jsx("button",{type:"button",className:"bu-pf__tag-close",onClick:r=>{r.stopPropagation(),X(e.value)},children:t.jsx(Z,{size:12})})]},e.value))}):t.jsx("span",{className:"bu-pf__placeholder",children:R}),t.jsx("span",{className:"bu-pf__arrow",children:t.jsx("img",{src:B,width:24,height:24,alt:""})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bu-pf__panel",children:t.jsxs("div",{className:"bu-pf__header",children:[t.jsx("div",{className:"bu-pf__tags",ref:S,...T(S),children:_.length>0?_.map(e=>t.jsxs("span",{className:`bu-pf__tag${d?"":" bu-pf__tag--single"}`,children:[t.jsx("span",{className:"bu-pf__tag-text",children:e.label}),t.jsx("button",{type:"button",className:"bu-pf__tag-close",onClick:()=>X(e.value),children:t.jsx(Z,{size:12})})]},e.value)):t.jsx("span",{className:"bu-pf__placeholder-inline",children:R})}),t.jsx("button",{type:"button",className:"bu-pf__close",onClick:L,children:t.jsx("img",{src:B,width:24,height:24,alt:""})})]})}),ne.createPortal(t.jsx("div",{ref:P,className:"bu-pf__portal",style:{position:"fixed",top:v.top,left:v.left,width:v.width,zIndex:1050},children:t.jsxs("div",{className:"bu-pf__dropdown",children:[(E||q)&&t.jsxs("div",{className:"bu-pf__toolbar",children:[E&&t.jsxs("div",{className:"bu-pf__search",children:[t.jsx("span",{className:"bu-pf__search-icon",children:t.jsx("img",{src:ie,width:20,height:20,alt:""})}),t.jsx("input",{className:"bu-pf__search-input",placeholder:J,value:j,onChange:e=>M(e.target.value)})]}),q&&t.jsxs("div",{ref:b,className:"bu-pf__sort-wrap",children:[t.jsx("button",{type:"button",className:`bu-pf__sort-btn${p!=="none"?" bu-pf__sort-btn--active":""}`,onClick:()=>N(e=>!e),children:t.jsx("img",{src:oe,width:24,height:24,alt:""})}),w&&t.jsx("div",{className:"bu-pf__sort-dropdown",children:[{key:"none",label:K},{key:"asc",label:Q},{key:"desc",label:V}].map(({key:e,label:r})=>t.jsx("div",{className:`bu-pf__sort-option${p===e?" bu-pf__sort-option--active":""}`,onClick:()=>re(e),children:r},e))})]})]}),t.jsx("div",{className:"bu-pf__list",children:k&&z.length>0?z.map(e=>{const r=a.includes(e.value);return t.jsxs("div",{className:`bu-pf__option${d?" bu-pf__option--multiple":""}${r&&!d?" bu-pf__option--selected":""}`,onClick:()=>se(e.value),children:[d&&t.jsx("img",{className:"bu-pf__checkbox-img",src:r?ue:ae,alt:""}),t.jsx("span",{className:"bu-pf__option-label",children:e.label})]},e.value)}):t.jsxs("div",{className:"bu-pf__no-match",children:[t.jsx("img",{className:"bu-pf__no-match-img",src:ce,alt:k?O:D}),t.jsx("p",{className:"bu-pf__no-match-text",children:k?O:D}),t.jsxs("p",{className:"bu-pf__no-match-hint",children:[W,t.jsx("button",{type:"button",className:"bu-pf__manage-btn",onClick:I,children:Y}),ee]})]})}),y&&t.jsx("div",{className:"bu-pf__add-row",onClick:U,children:y})]})}),(x==null?void 0:x())??document.body)]})]})}module.exports=le;
1
+ "use strict";
2
+
3
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ 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; } } }; }
12
+ 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; } }
13
+ 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; }
14
+ var t = require("react/jsx-runtime"),
15
+ c = require("react"),
16
+ me = require("react-dom");
17
+ ; /* empty css */
18
+ var be = require("./no_data_light.svg.js"),
19
+ Q = require("./arrow-up.svg.js"),
20
+ ve = require("./sort.svg.js"),
21
+ xe = require("./search.svg.js"),
22
+ je = require("./checkbox-no.svg.js"),
23
+ we = require("./checkbox-ok.svg.js");
24
+ var Ne = Object.defineProperty,
25
+ Le = Object.defineProperties,
26
+ Pe = Object.getOwnPropertyDescriptors,
27
+ W = Object.getOwnPropertySymbols,
28
+ Oe = Object.prototype.hasOwnProperty,
29
+ Ce = Object.prototype.propertyIsEnumerable,
30
+ Y = function Y(o, n, l) {
31
+ return n in o ? Ne(o, n, {
32
+ enumerable: !0,
33
+ configurable: !0,
34
+ writable: !0,
35
+ value: l
36
+ }) : o[n] = l;
37
+ },
38
+ ee = function ee(o, n) {
39
+ for (var l in n || (n = {})) Oe.call(n, l) && Y(o, l, n[l]);
40
+ if (W) {
41
+ var _iterator = _createForOfIteratorHelper(W(n)),
42
+ _step;
43
+ try {
44
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
45
+ var l = _step.value;
46
+ Ce.call(n, l) && Y(o, l, n[l]);
47
+ }
48
+ } catch (err) {
49
+ _iterator.e(err);
50
+ } finally {
51
+ _iterator.f();
52
+ }
53
+ }
54
+ return o;
55
+ },
56
+ te = function te(o, n) {
57
+ return Le(o, Pe(n));
58
+ };
59
+ function se(_ref) {
60
+ var _ref$size = _ref.size,
61
+ o = _ref$size === void 0 ? 20 : _ref$size;
62
+ return t.jsx("svg", {
63
+ width: o,
64
+ height: o,
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ children: t.jsx("path", {
69
+ 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",
70
+ fill: "currentColor"
71
+ })
72
+ });
73
+ }
74
+ function ke(_ref2) {
75
+ var _ref2$options = _ref2.options,
76
+ o = _ref2$options === void 0 ? [] : _ref2$options,
77
+ _ref2$value = _ref2.value,
78
+ n = _ref2$value === void 0 ? [] : _ref2$value,
79
+ l = _ref2.onChange,
80
+ _ref2$placeholder = _ref2.placeholder,
81
+ P = _ref2$placeholder === void 0 ? "请选择" : _ref2$placeholder,
82
+ _ref2$emptyText = _ref2.emptyText,
83
+ O = _ref2$emptyText === void 0 ? "暂无产品数据" : _ref2$emptyText,
84
+ ne = _ref2.onManageField,
85
+ _ref2$multiple = _ref2.multiple,
86
+ d = _ref2$multiple === void 0 ? !0 : _ref2$multiple,
87
+ _ref2$showSearch = _ref2.showSearch,
88
+ C = _ref2$showSearch === void 0 ? !0 : _ref2$showSearch,
89
+ _ref2$showSort = _ref2.showSort,
90
+ k = _ref2$showSort === void 0 ? !0 : _ref2$showSort,
91
+ y = _ref2.addButtonText,
92
+ re = _ref2.onAdd,
93
+ a = _ref2.labels,
94
+ oe = _ref2.className,
95
+ le = _ref2.style,
96
+ D = _ref2.getPopupContainer;
97
+ var E, R, q, S, M, F, $, T, X;
98
+ var ce = (E = a == null ? void 0 : a.searchPlaceholder) != null ? E : "搜索",
99
+ ae = (R = a == null ? void 0 : a.sortDefault) != null ? R : "默认顺序",
100
+ ie = (q = a == null ? void 0 : a.sortAsc) != null ? q : "名称A-Z",
101
+ ue = (S = a == null ? void 0 : a.sortDesc) != null ? S : "名称Z-A",
102
+ z = (M = a == null ? void 0 : a.noMatchText) != null ? M : "暂无选项",
103
+ de = (F = a == null ? void 0 : a.manageFieldPre) != null ? F : "请前往",
104
+ fe = ($ = a == null ? void 0 : a.manageFieldLink) != null ? $ : "管理字段",
105
+ _e = (T = a == null ? void 0 : a.manageFieldPost) != null ? T : "添加",
106
+ _c$useState = c.useState(!1),
107
+ _c$useState2 = _slicedToArray(_c$useState, 2),
108
+ f = _c$useState2[0],
109
+ A = _c$useState2[1],
110
+ _c$useState3 = c.useState(""),
111
+ _c$useState4 = _slicedToArray(_c$useState3, 2),
112
+ b = _c$useState4[0],
113
+ B = _c$useState4[1],
114
+ _c$useState5 = c.useState("none"),
115
+ _c$useState6 = _slicedToArray(_c$useState5, 2),
116
+ _ = _c$useState6[0],
117
+ I = _c$useState6[1],
118
+ _c$useState7 = c.useState(!1),
119
+ _c$useState8 = _slicedToArray(_c$useState7, 2),
120
+ v = _c$useState8[0],
121
+ x = _c$useState8[1],
122
+ g = c.useRef(null),
123
+ j = c.useRef(null),
124
+ Z = c.useRef(null),
125
+ _c$useState9 = c.useState({
126
+ top: 0,
127
+ left: 0,
128
+ width: 0
129
+ }),
130
+ _c$useState0 = _slicedToArray(_c$useState9, 2),
131
+ w = _c$useState0[0],
132
+ pe = _c$useState0[1],
133
+ u = c.useCallback(function () {
134
+ if (!g.current) return;
135
+ var e = g.current.getBoundingClientRect();
136
+ pe({
137
+ top: e.bottom + 4,
138
+ left: e.left,
139
+ width: e.width
140
+ });
141
+ }, []);
142
+ c.useLayoutEffect(function () {
143
+ f && u();
144
+ }, [f, u]), c.useEffect(function () {
145
+ if (!f) return;
146
+ var e = function e(s) {
147
+ var r, i;
148
+ var h = s.target;
149
+ (r = Z.current) != null && r.contains(h) || (i = g.current) != null && i.contains(h) || N();
150
+ };
151
+ return document.addEventListener("mousedown", e), window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), function () {
152
+ document.removeEventListener("mousedown", e), window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
153
+ };
154
+ }, [f, u]), c.useEffect(function () {
155
+ if (!v) return;
156
+ var e = function e(s) {
157
+ j.current && !j.current.contains(s.target) && x(!1);
158
+ };
159
+ return document.addEventListener("mousedown", e), function () {
160
+ return document.removeEventListener("mousedown", e);
161
+ };
162
+ }, [v]);
163
+ var U = c.useRef(null),
164
+ H = c.useRef(null),
165
+ m = c.useRef({
166
+ dragging: !1,
167
+ startX: 0,
168
+ scrollLeft: 0,
169
+ target: null
170
+ }),
171
+ V = c.useCallback(function (e) {
172
+ return {
173
+ onMouseDown: function onMouseDown(s) {
174
+ var r = e.current;
175
+ r && (m.current = {
176
+ dragging: !0,
177
+ startX: s.clientX,
178
+ scrollLeft: r.scrollLeft,
179
+ target: r
180
+ });
181
+ },
182
+ onMouseMove: function onMouseMove(s) {
183
+ var _m$current = m.current,
184
+ r = _m$current.dragging,
185
+ i = _m$current.startX,
186
+ h = _m$current.scrollLeft,
187
+ K = _m$current.target;
188
+ !r || !K || (s.preventDefault(), K.scrollLeft = h - (s.clientX - i));
189
+ },
190
+ onMouseUp: function onMouseUp() {
191
+ m.current.dragging = !1;
192
+ },
193
+ onMouseLeave: function onMouseLeave() {
194
+ m.current.dragging = !1;
195
+ }
196
+ };
197
+ }, []);
198
+ function he(e) {
199
+ if (!d) {
200
+ l == null || l(n.includes(e) ? [] : [e]), n.includes(e) || N();
201
+ return;
202
+ }
203
+ var s = n.includes(e) ? n.filter(function (r) {
204
+ return r !== e;
205
+ }) : [].concat(_toConsumableArray(n), [e]);
206
+ l == null || l(s);
207
+ }
208
+ function G(e) {
209
+ l == null || l(n.filter(function (s) {
210
+ return s !== e;
211
+ }));
212
+ }
213
+ function N() {
214
+ A(!1), B(""), I("none");
215
+ }
216
+ function ge(e) {
217
+ I(e), x(!1);
218
+ }
219
+ var J = c.useMemo(function () {
220
+ var e = o.filter(function (r) {
221
+ var i;
222
+ return ((i = r.searchText) != null ? i : typeof r.label == "string" ? r.label : "").toLowerCase().includes(b.toLowerCase());
223
+ });
224
+ var s = function s(r) {
225
+ var i;
226
+ return (i = r.searchText) != null ? i : typeof r.label == "string" ? r.label : "";
227
+ };
228
+ return _ === "asc" && (e = _toConsumableArray(e).sort(function (r, i) {
229
+ return s(r).localeCompare(s(i));
230
+ })), _ === "desc" && (e = _toConsumableArray(e).sort(function (r, i) {
231
+ return s(i).localeCompare(s(r));
232
+ })), e;
233
+ }, [o, b, _]),
234
+ p = o.filter(function (e) {
235
+ return n.includes(e.value);
236
+ }),
237
+ L = o.length > 0;
238
+ return t.jsxs("div", {
239
+ ref: g,
240
+ className: ["bu-pf", oe].filter(Boolean).join(" "),
241
+ style: le,
242
+ children: [!f && t.jsxs("div", {
243
+ className: "bu-pf__trigger".concat(p.length > 0 ? " bu-pf__trigger--selected" : ""),
244
+ onClick: function onClick() {
245
+ return A(!0);
246
+ },
247
+ children: [p.length > 0 ? t.jsx("div", te(ee({
248
+ className: "bu-pf__trigger-tags",
249
+ ref: H
250
+ }, V(H)), {
251
+ children: p.map(function (e) {
252
+ return t.jsxs("span", {
253
+ className: "bu-pf__tag".concat(d ? "" : " bu-pf__tag--single"),
254
+ children: [t.jsx("span", {
255
+ className: "bu-pf__tag-text",
256
+ children: e.label
257
+ }), t.jsx("button", {
258
+ type: "button",
259
+ className: "bu-pf__tag-close",
260
+ onClick: function onClick(s) {
261
+ s.stopPropagation(), G(e.value);
262
+ },
263
+ children: t.jsx(se, {
264
+ size: 12
265
+ })
266
+ })]
267
+ }, e.value);
268
+ })
269
+ })) : t.jsx("span", {
270
+ className: "bu-pf__placeholder",
271
+ children: P
272
+ }), t.jsx("span", {
273
+ className: "bu-pf__arrow",
274
+ children: t.jsx("img", {
275
+ src: Q,
276
+ width: 24,
277
+ height: 24,
278
+ alt: ""
279
+ })
280
+ })]
281
+ }), f && t.jsxs(t.Fragment, {
282
+ children: [t.jsx("div", {
283
+ className: "bu-pf__panel",
284
+ children: t.jsxs("div", {
285
+ className: "bu-pf__header",
286
+ children: [t.jsx("div", te(ee({
287
+ className: "bu-pf__tags",
288
+ ref: U
289
+ }, V(U)), {
290
+ children: p.length > 0 ? p.map(function (e) {
291
+ return t.jsxs("span", {
292
+ className: "bu-pf__tag".concat(d ? "" : " bu-pf__tag--single"),
293
+ children: [t.jsx("span", {
294
+ className: "bu-pf__tag-text",
295
+ children: e.label
296
+ }), t.jsx("button", {
297
+ type: "button",
298
+ className: "bu-pf__tag-close",
299
+ onClick: function onClick() {
300
+ return G(e.value);
301
+ },
302
+ children: t.jsx(se, {
303
+ size: 12
304
+ })
305
+ })]
306
+ }, e.value);
307
+ }) : t.jsx("span", {
308
+ className: "bu-pf__placeholder-inline",
309
+ children: P
310
+ })
311
+ })), t.jsx("button", {
312
+ type: "button",
313
+ className: "bu-pf__close",
314
+ onClick: N,
315
+ children: t.jsx("img", {
316
+ src: Q,
317
+ width: 24,
318
+ height: 24,
319
+ alt: ""
320
+ })
321
+ })]
322
+ })
323
+ }), me.createPortal(t.jsx("div", {
324
+ ref: Z,
325
+ className: "bu-pf__portal",
326
+ style: {
327
+ position: "fixed",
328
+ top: w.top,
329
+ left: w.left,
330
+ width: w.width,
331
+ zIndex: 1050
332
+ },
333
+ children: t.jsxs("div", {
334
+ className: "bu-pf__dropdown",
335
+ children: [(C || k) && t.jsxs("div", {
336
+ className: "bu-pf__toolbar",
337
+ children: [C && t.jsxs("div", {
338
+ className: "bu-pf__search",
339
+ children: [t.jsx("span", {
340
+ className: "bu-pf__search-icon",
341
+ children: t.jsx("img", {
342
+ src: xe,
343
+ width: 20,
344
+ height: 20,
345
+ alt: ""
346
+ })
347
+ }), t.jsx("input", {
348
+ className: "bu-pf__search-input",
349
+ placeholder: ce,
350
+ value: b,
351
+ onChange: function onChange(e) {
352
+ return B(e.target.value);
353
+ }
354
+ })]
355
+ }), k && t.jsxs("div", {
356
+ ref: j,
357
+ className: "bu-pf__sort-wrap",
358
+ children: [t.jsx("button", {
359
+ type: "button",
360
+ className: "bu-pf__sort-btn".concat(_ !== "none" ? " bu-pf__sort-btn--active" : ""),
361
+ onClick: function onClick() {
362
+ return x(function (e) {
363
+ return !e;
364
+ });
365
+ },
366
+ children: t.jsx("img", {
367
+ src: ve,
368
+ width: 24,
369
+ height: 24,
370
+ alt: ""
371
+ })
372
+ }), v && t.jsx("div", {
373
+ className: "bu-pf__sort-dropdown",
374
+ children: [{
375
+ key: "none",
376
+ label: ae
377
+ }, {
378
+ key: "asc",
379
+ label: ie
380
+ }, {
381
+ key: "desc",
382
+ label: ue
383
+ }].map(function (_ref3) {
384
+ var e = _ref3.key,
385
+ s = _ref3.label;
386
+ return t.jsx("div", {
387
+ className: "bu-pf__sort-option".concat(_ === e ? " bu-pf__sort-option--active" : ""),
388
+ onClick: function onClick() {
389
+ return ge(e);
390
+ },
391
+ children: s
392
+ }, e);
393
+ })
394
+ })]
395
+ })]
396
+ }), t.jsx("div", {
397
+ className: "bu-pf__list",
398
+ children: L && J.length > 0 ? J.map(function (e) {
399
+ var s = n.includes(e.value);
400
+ return t.jsxs("div", {
401
+ className: "bu-pf__option".concat(d ? " bu-pf__option--multiple" : "").concat(s && !d ? " bu-pf__option--selected" : ""),
402
+ onClick: function onClick() {
403
+ return he(e.value);
404
+ },
405
+ children: [d && t.jsx("img", {
406
+ className: "bu-pf__checkbox-img",
407
+ src: s ? we : je,
408
+ alt: ""
409
+ }), t.jsx("span", {
410
+ className: "bu-pf__option-label",
411
+ children: e.label
412
+ })]
413
+ }, e.value);
414
+ }) : t.jsxs("div", {
415
+ className: "bu-pf__no-match",
416
+ children: [t.jsx("img", {
417
+ className: "bu-pf__no-match-img",
418
+ src: be,
419
+ alt: L ? z : O
420
+ }), t.jsx("p", {
421
+ className: "bu-pf__no-match-text",
422
+ children: L ? z : O
423
+ }), t.jsxs("p", {
424
+ className: "bu-pf__no-match-hint",
425
+ children: [de, t.jsx("button", {
426
+ type: "button",
427
+ className: "bu-pf__manage-btn",
428
+ onClick: ne,
429
+ children: fe
430
+ }), _e]
431
+ })]
432
+ })
433
+ }), y && t.jsx("div", {
434
+ className: "bu-pf__add-row",
435
+ onClick: re,
436
+ children: y
437
+ })]
438
+ })
439
+ }), (X = D == null ? void 0 : D()) != null ? X : document.body)]
440
+ })]
441
+ });
442
+ }
443
+ module.exports = ke;