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.
- package/README.md +10 -1
- package/dist/index.js +58 -1
- package/dist/index.mjs +1 -29
- package/dist/miniapp.js +1 -1
- package/dist/miniapp.mjs +0 -1
- package/dist/mobile.js +1 -1
- package/dist/mobile.mjs +0 -1
- package/dist/react.js +1 -1
- package/dist/react.mjs +0 -1
- package/dist/shared.js +1 -1
- package/dist/shared.mjs +0 -1
- package/dist/style.css +1 -1
- package/dist/web/BasicInput/BInput.js +278 -1
- package/dist/web/BasicInput/BInput.mjs +263 -164
- package/dist/web/BasicInput/utils.js +47 -1
- package/dist/web/BasicInput/utils.mjs +22 -20
- package/dist/web/CategoryDropdown/CategoryDropdown.js +376 -1
- package/dist/web/CategoryDropdown/CategoryDropdown.mjs +355 -235
- package/dist/web/CheckBox/BCheckBox.js +176 -1
- package/dist/web/CheckBox/BCheckBox.mjs +169 -98
- package/dist/web/CheckBox/Group.js +111 -1
- package/dist/web/CheckBox/Group.mjs +104 -64
- package/dist/web/CheckBox/context.js +8 -1
- package/dist/web/CheckBox/context.mjs +2 -4
- package/dist/web/CheckBox/index.js +11 -1
- package/dist/web/CheckBox/index.mjs +2 -4
- package/dist/web/Dropdown/BDropdown.js +265 -1
- package/dist/web/Dropdown/BDropdown.mjs +233 -133
- package/dist/web/EmptyInputBox/EmptyInputBox.js +89 -1
- package/dist/web/EmptyInputBox/EmptyInputBox.mjs +85 -72
- package/dist/web/FileCard/FileCard.js +414 -1
- package/dist/web/FileCard/FileCard.mjs +400 -116
- package/dist/web/Icon/Icon.js +82 -1
- package/dist/web/Icon/Icon.mjs +78 -8
- package/dist/web/Input/Input.js +230 -1
- package/dist/web/Input/Input.mjs +219 -164
- package/dist/web/InputNumber/BInputNumber.js +271 -1
- package/dist/web/InputNumber/BInputNumber.mjs +254 -189
- package/dist/web/InputNumber/StepHandler.js +112 -1
- package/dist/web/InputNumber/StepHandler.mjs +102 -50
- package/dist/web/InputNumber/hooks/useCursor.js +38 -1
- package/dist/web/InputNumber/hooks/useCursor.mjs +31 -34
- package/dist/web/InputNumber/hooks/useFrame.js +15 -1
- package/dist/web/InputNumber/hooks/useFrame.mjs +8 -5
- package/dist/web/InputNumber/utils/decimal.js +163 -1
- package/dist/web/InputNumber/utils/decimal.mjs +114 -79
- package/dist/web/MobileDrawer/BMobileDrawer.js +238 -1
- package/dist/web/MobileDrawer/BMobileDrawer.mjs +221 -139
- package/dist/web/Modal/Modal.js +148 -1
- package/dist/web/Modal/Modal.mjs +143 -79
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +273 -1
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +262 -143
- package/dist/web/Pagination/Pagination.js +352 -1
- package/dist/web/Pagination/Pagination.mjs +342 -247
- package/dist/web/ProductField/ProductField.js +443 -1
- package/dist/web/ProductField/ProductField.mjs +423 -208
- package/dist/web/ProductField/arrow-up.svg.js +4 -1
- package/dist/web/ProductField/arrow-up.svg.mjs +2 -4
- package/dist/web/ProductField/checkbox-no.svg.js +4 -1
- package/dist/web/ProductField/checkbox-no.svg.mjs +2 -4
- package/dist/web/ProductField/checkbox-ok.svg.js +4 -1
- package/dist/web/ProductField/checkbox-ok.svg.mjs +2 -4
- package/dist/web/ProductField/no_data_light.svg.js +4 -1
- package/dist/web/ProductField/no_data_light.svg.mjs +2 -4
- package/dist/web/ProductField/search.svg.js +4 -1
- package/dist/web/ProductField/search.svg.mjs +2 -4
- package/dist/web/ProductField/sort.svg.js +4 -1
- package/dist/web/ProductField/sort.svg.mjs +2 -4
- package/dist/web/Radio/BRadio.js +151 -1
- package/dist/web/Radio/BRadio.mjs +147 -75
- package/dist/web/Radio/Button.js +54 -1
- package/dist/web/Radio/Button.mjs +51 -8
- package/dist/web/Radio/Group.js +97 -1
- package/dist/web/Radio/Group.mjs +92 -76
- package/dist/web/Radio/context.js +10 -1
- package/dist/web/Radio/context.mjs +3 -5
- package/dist/web/Radio/index.js +13 -1
- package/dist/web/Radio/index.mjs +2 -4
- package/dist/web/SkuInputCard/SkuInputCard.js +427 -1
- package/dist/web/SkuInputCard/SkuInputCard.mjs +414 -219
- package/dist/web/SkuInputCard/spin_loading_red.gif.js +4 -1
- package/dist/web/SkuInputCard/spin_loading_red.gif.mjs +2 -4
- package/dist/web/Switch/Switch.js +114 -1
- package/dist/web/Switch/Switch.mjs +109 -58
- package/dist/web/Table/BTable.js +1049 -1
- package/dist/web/Table/BTable.mjs +1011 -667
- package/dist/web/Table/Column.js +6 -1
- package/dist/web/Table/Column.mjs +1 -3
- package/dist/web/Table/ColumnGroup.js +6 -1
- package/dist/web/Table/ColumnGroup.mjs +1 -3
- package/dist/web/Table/utils/columns.js +116 -1
- package/dist/web/Table/utils/columns.mjs +103 -37
- package/dist/web/Table/utils/sortFilter.js +145 -1
- package/dist/web/Table/utils/sortFilter.mjs +129 -57
- package/dist/web/Tabs/BTabs.js +260 -1
- package/dist/web/Tabs/BTabs.mjs +239 -122
- package/dist/web/Tabs/TabPane.js +19 -1
- package/dist/web/Tabs/TabPane.mjs +1 -4
- package/dist/web/Tooltip/ConfirmTooltip.js +53 -1
- package/dist/web/Tooltip/ConfirmTooltip.mjs +47 -22
- package/dist/web/Tooltip/ContentTooltip.js +156 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +145 -76
- package/dist/web/Tooltip/ProgressTooltip.js +56 -1
- package/dist/web/Tooltip/ProgressTooltip.mjs +50 -31
- package/dist/web/Tooltip/TooltipWrapper.js +19 -1
- package/dist/web/Tooltip/TooltipWrapper.mjs +13 -9
- package/dist/web/Tooltip/useAutoPlacement.js +65 -1
- package/dist/web/Tooltip/useAutoPlacement.mjs +52 -24
- package/dist/web.js +58 -1
- package/dist/web.mjs +1 -29
- package/package.json +3 -1
package/dist/web/Table/BTable.js
CHANGED
|
@@ -1 +1,1049 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),o=require("react"),Zt=require("react-dom"),Xt=require("../Pagination/Pagination.js"),Be=require("../Icon/Icon.js");;/* empty css */const Yt=require("../Tooltip/ContentTooltip.js"),es=require("../Tooltip/TooltipWrapper.js"),ts=require("../CheckBox/index.js"),ss=require("../Dropdown/BDropdown.js"),ns=require("../OverlayScrollbar/BOverlayScrollbar.js"),rs=require("../SkuInputCard/spin_loading_red.gif.js"),as=require("../ProductField/no_data_light.svg.js"),is=require("./Column.js"),ls=require("./ColumnGroup.js"),m=require("./utils/sortFilter.js"),Oe=require("./utils/columns.js");;/* empty css */const ds=300,ke=1;function z(...g){return g.filter(Boolean).join(" ")}function cs(g,x){return x===void 0?void 0:(Array.isArray(x)?x:[x]).reduce((F,c)=>{if(!(F==null||typeof F!="object"))return F[c]},g)}function V(g,x,v){if(typeof v=="function")return v(g,x);if(v){const F=g[String(v)];if(typeof F=="string"||typeof F=="number")return F}return x}function fs(g,x){return Math.max(1,Math.ceil(g/x))}function bs(g){return!!(g&&typeof g=="object"&&!o.isValidElement(g)&&"props"in g)}function os(g,x){return(typeof x.text=="string"||typeof x.text=="number"?String(x.text):String(x.value)).toLocaleLowerCase().includes(g.toLocaleLowerCase())}function ut({checked:g,disabled:x,label:v,name:F,onChange:c,type:G="checkbox"}){return G==="checkbox"?d.jsx(ts.BCheckBox,{"aria-label":v,checked:g,className:"bj-table__selection-checkbox",disabled:x,name:F,onChange:c,skipGroup:!0}):d.jsxs("label",{className:z("bj-table__selection-control",g&&"bj-table__selection-control--checked",x&&"bj-table__selection-control--disabled"),children:[d.jsx("input",{"aria-label":v,checked:g,className:"bj-table__selection-input",disabled:x,name:F,onChange:c,type:G}),d.jsx("span",{"aria-hidden":"true",className:"bj-table__selection-box",children:g&&d.jsx(Be,{className:"bj-table__selection-check-icon",type:"icon-a-dagouxi"})})]})}function us({columns:g,dataSource:x=[],rowKey:v,preserveSelectedRowKeys:F=!1,rowSelection:c,pagination:G=!1,loading:oe=!1,bordered:ht=!0,size:_t="middle",showHeader:qe=!0,emptyText:ue,emptyImage:he=as,emptyHeight:jt,t:Q=ae=>ae,className:yt,style:xt,rowClassName:_e,sortDirections:gt=["ascend","descend",null],onChange:je,children:ze,title:Te,footer:Le,summary:Ie,tableLayout:ye,components:E,onRow:xe,onHeaderRow:ge,id:vt,scroll:f,locale:Z,groupCollapse:u}){var ct,ft,bt;const ae=o.useRef(null),ve=o.useRef(null),ie=o.useMemo(()=>g??Oe.convertChildrenToColumns(ze),[ze,g]),Y=o.useMemo(()=>Oe.flattenColumns(ie),[ie]),we=o.useMemo(()=>Oe.buildHeaderRows(ie),[ie]),[mt,Ve]=o.useState((c==null?void 0:c.defaultSelectedRowKeys)??[]),[me,le]=o.useState(G?G.defaultCurrent??1:1),[pt,Nt]=o.useState(G?G.defaultPageSize??10:10),[Rt,Et]=o.useState(()=>new Map(Y.flatMap((e,t)=>e.defaultSortOrder?[[m.getColumnKey(e,t),e.defaultSortOrder]]:[]))),[St,Ft]=o.useState(()=>new Map(Y.flatMap((e,t)=>e.defaultFilteredValue===void 0?[]:[[m.getColumnKey(e,t),e.defaultFilteredValue]]))),[Kt,Dt]=o.useState(u!=null&&u.defaultExpandedKeys?[...u.defaultExpandedKeys]:[]),[T,$]=o.useState(null),[Ge,ee]=o.useState(new Map),[Pt,de]=o.useState(null),Ot=o.useRef(`btable-${Math.random().toString(36).slice(2,10)}`).current,[U,pe]=o.useState(null),[Ne,Ae]=o.useState(null),[Re,We]=o.useState(""),[te,He]=o.useState(""),[kt,Ee]=o.useState(),Se=o.useRef(0),Fe=o.useRef(!1),[$e,Ue]=o.useState({start:0,end:0}),[Ce,Je]=o.useState({start:!1,end:!1}),a=G||void 0,A=(a==null?void 0:a.pageSize)??pt,P=(c==null?void 0:c.selectedRowKeys)??mt,y=Y,Bt=`${y.map(e=>`${String(e.fixed??"")}:${String(e.width??"")}`).join("|")}|${c?String(c.columnWidth??""):"-"}|${String((f==null?void 0:f.x)??"")}|${String(ye??"")}`,W=e=>!!(e&&(e.fixed==="left"||e.fixed===!0)),X=e=>!!(e&&e.fixed==="right"),K=new Map(Rt),O=new Map(St);y.forEach((e,t)=>{if("children"in e)return;const s=m.getColumnKey(e,t);e.sortOrder!==void 0&&K.set(s,e.sortOrder),e.filteredValue!==void 0&&O.set(s,e.filteredValue)});const Qe=o.useMemo(()=>m.filterRecords(x,y,O),[y,O,x]),k=o.useMemo(()=>m.sortRecords(Qe,y,K),[y,Qe,K]),Ze=(a==null?void 0:a.total)??k.length,Xe=fs(Ze,A),H=Math.min((a==null?void 0:a.current)??me,Xe),C=(u==null?void 0:u.expandedKeys)??Kt,se=(e,t)=>u!=null&&u.isGroupRow?u.isGroupRow(e,t):!!e.isGroup,ce=(e,t)=>u!=null&&u.groupKey?u.groupKey(e,t):e.groupId,Ye=(e,t)=>u!=null&&u.childrenKeys?u.childrenKeys(e,t):e.childrenIds??[],Mt=(e,t)=>{var r;const s=ce(e,t),i=C.includes(s),l=i?C.filter(n=>n!==s):[...C,s];(u==null?void 0:u.expandedKeys)===void 0&&Dt(l),(r=u==null?void 0:u.onExpandedKeysChange)==null||r.call(u,l,e,!i)};o.useEffect(()=>{H!==me&&(a==null?void 0:a.current)===void 0&&le(H)},[H,a==null?void 0:a.current,me]),o.useEffect(()=>{if(!U||T===null){Ae(null);return}const e=()=>{const t=U.getBoundingClientRect();Ae({left:t.left,top:t.bottom+4})};return e(),document.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{document.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[U,T]),o.useEffect(()=>{if(T===null)return;const e=t=>{const s=t.target;U!=null&&U.contains(s)||s.closest(".bj-table__filter-dropdown")||($(null),pe(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[U,T]),o.useEffect(()=>{const e=window.setTimeout(()=>He(Re.trim()),ds);return()=>window.clearTimeout(e)},[Re]),o.useEffect(()=>{if(T===null)return;const e=Y.find((s,i)=>m.getColumnKey(s,i)===T);if(!e||"children"in e||!e.filterRequest)return;const t=++Se.current;Promise.resolve().then(()=>e.filterRequest(te)).then(s=>{Se.current===t&&Ee(s)},()=>{Se.current===t&&Ee([])})},[te,Y,T]);const L=o.useMemo(()=>{if(!a||a.serverPagination)return k.map((t,s)=>({record:t,index:s})).filter(({record:t,index:s})=>{if(!u||se(t,s))return!0;const i=V(t,s,v);return k.some((l,r)=>se(l,r)&&C.includes(ce(l,r))&&Ye(l,r).includes(i))});const e=(H-1)*A;return k.slice(e,e+A).map((t,s)=>({record:t,index:e+s})).filter(({record:t,index:s})=>{if(!u||se(t,s))return!0;const i=V(t,s,v);return k.some((l,r)=>se(l,r)&&C.includes(ce(l,r))&&Ye(l,r).includes(i))})},[H,C,u,A,a,k,v]),et=o.useMemo(()=>L.map(({record:e,index:t})=>V(e,t,v)),[v,L]),qt=P.map(String).join("|"),zt=et.map(String).join("|");o.useEffect(()=>{var l;if(!c||F||P.length===0)return;const e=new Set(et),t=P.filter(r=>e.has(r));if(t.length===P.length)return;c.selectedRowKeys===void 0&&Ve(t);const s=new Set(t),i=L.filter(({record:r,index:n})=>s.has(V(r,n,v))).map(({record:r})=>r);(l=c.onChange)==null||l.call(c,t,i,{type:"multiple"})},[F,c,v,qt,zt,L]),o.useEffect(()=>{const e=ve.current;if(!e||!(f!=null&&f.x)){Ue(r=>r.start===0&&r.end===0?r:{start:0,end:0}),Je(r=>r.start||r.end?{start:!1,end:!1}:r);return}const t=()=>{const r=e.querySelector(".bj-table__header .bj-table__header-row")??e.querySelector(".bj-table__body .bj-table__row");let n=0,_=0;if(r){Array.from(r.children).forEach(p=>{const j=p.getBoundingClientRect().width;p.classList.contains("bj-table__cell--fixed-right")?_+=j:(p.classList.contains("bj-table__cell--fixed-left")||p.classList.contains("bj-table__selection-cell--fixed"))&&(n+=j)});const h=e.clientLeft;n>0&&(n+=h),_>0&&(_=Math.max(_-h,0))}Ue(h=>h.start===n&&h.end===_?h:{start:n,end:_})},s=()=>{const r=e.scrollWidth-e.clientWidth,n=r>ke,_={start:n&&e.scrollLeft>ke,end:n&&e.scrollLeft<r-ke};Je(h=>h.start===_.start&&h.end===_.end?h:_)},i=()=>{t(),s()};i(),e.addEventListener("scroll",s,{passive:!0});const l=new ResizeObserver(i);return l.observe(e),e.firstElementChild&&l.observe(e.firstElementChild),()=>{e.removeEventListener("scroll",s),l.disconnect()}},[Bt,f==null?void 0:f.x,qe,L.length]);const fe=(e,t=K,s=O,i=H,l=A)=>{const r=Object.fromEntries(s),n=m.filterRecords(x,y,s),_=m.sortRecords(n,y,t);je==null||je({...a,current:i,pageSize:l,total:(a==null?void 0:a.total)??_.length},r,m.getSorterResult(y,t),{action:e,currentDataSource:_})},Tt=(e,t)=>{if(!e.sorter)return;const s=m.getColumnKey(e,t),i=m.getNextSortOrder(K.get(s)??null,e.sortDirections??gt),l=new Map;l.set(s,i),e.sortOrder===void 0&&Et(l),fe("sort",l)},Ke=(e,t,s)=>{const i=m.getColumnKey(e,t),l=new Map(O);l.set(i,s),e.filteredValue===void 0&&Ft(l),$(null),(a==null?void 0:a.current)===void 0&&le(1),fe("filter",K,l,1)},Lt=(e,t)=>{const s=m.getColumnKey(e,t),i=e.filterResetToDefaultFilteredValue?e.defaultFilteredValue??[]:[];ee(l=>new Map(l).set(s,i))},be=(e,t,s)=>{var l,r,n,_;const i=m.getColumnKey(e,t);if(T===i){$(null),pe(null),(l=e.onFilterDropdownOpenChange)==null||l.call(e,!1),(r=e.onFilterDropdownVisibleChange)==null||r.call(e,!1);return}We(""),He(""),Ee(void 0),ee(h=>new Map(h).set(i,O.get(i)??[])),$(i),s&&pe(s),(n=e.onFilterDropdownOpenChange)==null||n.call(e,!0),(_=e.onFilterDropdownVisibleChange)==null||_.call(e,!0)},It=(e,t)=>{var S,M;const s=m.getColumnKey(e,t),i=`bj-table-badge-${Ot}-${String(s).replace(/[^a-zA-Z0-9_-]/g,"-")}`,l=K.get(s)??null,r=O.get(s)??[],n=Ge.get(s)??r,_=e.filterDropdownOpen??e.filterDropdownVisible??T===s,h=e.filtered||r.length>0,p=l==="ascend"?"icon-a-zhengxumian":l==="descend"?"icon-a-daoxumian":"icon-a-weipaixumian",j=m.renderColumnTitle(e.title,{sortOrder:l,sortColumn:l?e:void 0,sortColumns:l?[{column:e,order:l}]:[],filters:Object.fromEntries(O)}),J=typeof e.filterDropdown=="function"?e.filterDropdown({prefixCls:"bj-table",selectedKeys:n.filter(b=>typeof b!="boolean"),setSelectedKeys:b=>ee(R=>new Map(R).set(s,b)),confirm:b=>{Ke(e,t,Ge.get(s)??n),(b==null?void 0:b.closeDropdown)===!1&&$(s)},clearFilters:b=>{const R=e.filterResetToDefaultFilteredValue?e.defaultFilteredValue??[]:[];ee(D=>new Map(D).set(s,R)),(b==null?void 0:b.confirm)===!0&&Ke(e,t,R),((b==null?void 0:b.closeDropdown)===!1||(b==null?void 0:b.confirm)!==!0)&&$(s)},filters:e.filters,close:()=>$(null),visible:_}):e.filterDropdown,w=e.filterRequest?kt??[]:e.filters??[],q=te&&!e.filterRequest?w.filter(b=>typeof e.filterSearch=="function"?e.filterSearch(te,b):os(te,b)):w,N=!!(e.filterSearch||e.filterRequest),B=d.jsxs("div",{className:z("bj-table__column-header",e.sorter&&"bj-table__column-header--sortable"),children:[e.badge!==void 0&&d.jsx("span",{"aria-label":"表头提示",className:"bj-table__column-badge-trigger",id:i,onBlur:()=>de(null),onClick:b=>b.stopPropagation(),onFocus:()=>de(s),onKeyDown:b=>b.stopPropagation(),onMouseEnter:()=>de(s),onMouseLeave:()=>de(null),role:"button",tabIndex:0,children:d.jsx("span",{"aria-hidden":"true",className:"bj-table__column-badge-shape"})}),d.jsxs("div",{className:"bj-table__column-title",children:[d.jsx("span",{className:"bj-table__column-title-content",children:j}),e.sorter&&d.jsx("span",{"aria-hidden":"true",className:"bj-table__column-sorter",children:d.jsx(Be,{className:"bj-table__column-sorter-icon",type:p})})]}),(e.filters||e.filterDropdown)&&d.jsxs("div",{className:"bj-table__filter",children:[d.jsx("button",{"aria-expanded":_,"aria-label":"筛选",className:z("bj-table__filter-trigger",h&&"bj-table__filter-trigger--active"),onClick:b=>{b.stopPropagation(),be(e,t)},type:"button",children:typeof e.filterIcon=="function"?e.filterIcon(h):e.filterIcon??d.jsx(Be,{className:"bj-table__filter-icon",type:h?"icon-shaixuan-daidian":"icon-a-shaixuanxi"})}),_&&Ne&&typeof document<"u"&&Zt.createPortal(d.jsx("div",{className:"bj-table__filter-dropdown",onClick:b=>b.stopPropagation(),role:"dialog",style:{left:Ne.left,top:Ne.top},children:J??d.jsx(ss.BDropdown,{...e.filterDropdownProps,emptyText:(Z==null?void 0:Z.filterEmptyText)??Q("暂无结果"),multiple:e.filterMultiple!==!1,onChange:(b,R)=>{var D,ot;ee(Qt=>new Map(Qt).set(s,b)),(ot=(D=e.filterDropdownProps)==null?void 0:D.onChange)==null||ot.call(D,b,R)},onConfirm:b=>{var R,D;Ke(e,t,b),(D=(R=e.filterDropdownProps)==null?void 0:R.onConfirm)==null||D.call(R,b)},onReset:()=>{var b,R;Lt(e,t),(R=(b=e.filterDropdownProps)==null?void 0:b.onReset)==null||R.call(b)},onSearch:b=>{var R,D;We(b),(D=(R=e.filterDropdownProps)==null?void 0:R.onSearch)==null||D.call(R,b)},options:q.map(b=>({label:b.text,description:b.description,value:b.value})),searchable:((S=e.filterDropdownProps)==null?void 0:S.searchable)??N,searchPlaceholder:((M=e.filterDropdownProps)==null?void 0:M.searchPlaceholder)??(e.filterRequest?Q("请输入搜索内容"):(Z==null?void 0:Z.filterSearchPlaceholder)??Q("搜索")),searchValue:Re,t:Q,value:n})}),document.body)]})]});return e.badge!==void 0?d.jsxs(es,{className:"bj-table__column-tooltip-wrapper",children:[d.jsx("div",{className:"bj-table__column-tooltip-trigger",children:B}),Pt===s&&d.jsx(Yt,{className:"bj-table__column-tooltip",content:e.badge,getAnchorElement:()=>document.getElementById(i),getPopupContainer:()=>document.body,placement:"top"})]}):B},tt=(e,t,s)=>{var r,n;t.selectedRowKeys===void 0&&Ve(e);const i=new Set(e),l=x.filter((_,h)=>i.has(V(_,h,v)));(r=t.onChange)==null||r.call(t,e,l),s&&((n=t.onSelect)==null||n.call(t,s,i.has(V(s,x.indexOf(s),v)),l))},wt=(e,t)=>{if(!c)return;const s=V(e,t,v),i=P.includes(s),l=c.type==="radio"?i?[]:[s]:i?P.filter(r=>r!==s):[...P,s];tt(l,c,e)},st=L.filter(({record:e})=>{var t;return!((t=c==null?void 0:c.getCheckboxProps)!=null&&t.call(c,e).disabled)}),ne=st.map(({record:e,index:t})=>V(e,t,v)),De=ne.length>0&&ne.every(e=>P.includes(e)),Vt=()=>{var s;if(!c||c.type==="radio")return;const e=new Set(ne),t=De?P.filter(i=>!e.has(i)):Array.from(new Set([...P,...ne]));tt(t,c),new Set(t),(s=c.onSelectAll)==null||s.call(c,!De,st.map(({record:i})=>i))},Gt=e=>{var t;!a||e<1||e>Xe||e===H||(a.current===void 0&&le(e),(t=a.onChange)==null||t.call(a,e,A),fe("paginate",K,O,e))},At=e=>{var s,i;if(!a||e===A)return;const t=1;Fe.current=!0,a.pageSize===void 0&&Nt(e),a.current===void 0&&le(t),(s=a.onShowSizeChange)==null||s.call(a,t,e),(i=a.onChange)==null||i.call(a,t,e),fe("paginate",K,O,t,e)},nt=y.length+(c?1:0),re=(c==null?void 0:c.columnWidth)??48,rt=e=>typeof e.width=="number"?e.width:0,at=(e,t)=>{const s=e.fixed===!0?"left":e.fixed;return s==="left"?{position:"sticky",left:y.slice(0,t).reduce((l,r)=>l+rt(r),c&&typeof re=="number"?re:0),zIndex:2}:s==="right"?{position:"sticky",right:y.slice(t+1).reduce((l,r)=>l+rt(r),0),zIndex:2}:{}},Wt=f!=null&&f.x?{width:f.x===!0?"max-content":f.x,minWidth:"100%",tableLayout:ye??"fixed"}:{tableLayout:ye},Ht=(E==null?void 0:E.table)??"table",$t=((ct=E==null?void 0:E.header)==null?void 0:ct.wrapper)??"thead",Ut=((ft=E==null?void 0:E.header)==null?void 0:ft.row)??"tr",it=((bt=E==null?void 0:E.header)==null?void 0:bt.cell)??"th",I=typeof(E==null?void 0:E.body)=="object"?E.body:void 0,Ct=(I==null?void 0:I.wrapper)??"tbody",lt=(I==null?void 0:I.row)??"tr",Pe=(I==null?void 0:I.cell)??"td",Jt=typeof ue=="function"?ue():ue??Q("暂无数据"),dt=typeof he=="string"?d.jsx("img",{alt:"",className:"bj-table__empty-image",src:he}):he;return d.jsxs("div",{id:vt,ref:ae,className:z("bj-table",ht&&"bj-table--bordered",`bj-table--${_t}`,oe&&"bj-table--loading",k.length===0&&"bj-table--empty",Ce.start&&"bj-table--ping-left",Ce.end&&"bj-table--ping-right",yt),style:xt,children:[Te&&d.jsx("div",{className:"bj-table__title",children:Te(k)}),d.jsxs("div",{className:"bj-table__viewport",children:[d.jsx("div",{className:z("bj-table__scroll",!!(f!=null&&f.x||f!=null&&f.y)&&"bj-overlay-scrollbar-hidden"),ref:ve,style:{maxHeight:f==null?void 0:f.y},children:d.jsxs(Ht,{className:"bj-table__native-table",style:Wt,children:[y.some(e=>e.width)&&d.jsxs("colgroup",{children:[c&&d.jsx("col",{className:"bj-table__selection-col",style:{width:re}}),y.map((e,t)=>d.jsx("col",{style:{width:e.width}},e.key??t))]}),qe&&d.jsx($t,{className:"bj-table__header",children:we.map((e,t)=>d.jsxs(Ut,{className:"bj-table__header-row",...ge==null?void 0:ge(y,t),children:[c&&t===0&&d.jsxs(it,{className:z("bj-table__header-cell","bj-table__selection-cell",!!(f!=null&&f.x)&&"bj-table__selection-cell--fixed",!!(f!=null&&f.x)&&!W(y[0])&&"bj-table__cell--fixed-left-last"),rowSpan:we.length,scope:"col",style:{width:re},children:[c.type!=="radio"&&d.jsx(ut,{checked:De,disabled:ne.length===0,onChange:Vt,label:"选择当前页所有行"}),c.columnTitle]}),e.map(({column:s,colSpan:i,rowSpan:l},r)=>{var w,q;const n=s,_=y.indexOf(n),h=_>=0?_:r,p=!("children"in s)&&!!(n.filters||n.filterDropdown),j=!("children"in s)&&!!n.sorter,J=()=>{p?be(n,h):j&&Tt(n,h)};return o.createElement(it,{...(w=n.onHeaderCell)==null?void 0:w.call(n,s,r),"aria-label":typeof n.title=="string"?n.title:void 0,"aria-sort":j?K.get(m.getColumnKey(n,h))==="ascend"?"ascending":K.get(m.getColumnKey(n,h))==="descend"?"descending":"none":void 0,className:z("bj-table__header-cell",((q=y[h+1])==null?void 0:q.fixed)==="right"&&"bj-table__cell--before-fixed-right",n.fixed&&"bj-table__cell--fixed",W(n)&&"bj-table__cell--fixed-left",W(n)&&!W(y[h+1])&&"bj-table__cell--fixed-left-last",X(n)&&"bj-table__cell--fixed-right",X(n)&&!X(y[h-1])&&"bj-table__cell--fixed-right-first",n.sorter&&"bj-table__header-cell--sortable",p&&"bj-table__header-cell--filterable",K.get(m.getColumnKey(n,h))&&"bj-table__header-cell--sorted",n.className),colSpan:i,key:n.key??String(n.dataIndex??r),onClick:N=>{var B,S,M;(M=(S=(B=n.onHeaderCell)==null?void 0:B.call(n,s,r))==null?void 0:S.onClick)==null||M.call(S,N),!N.target.closest(".bj-table__filter-dropdown")&&(p?be(n,h,N.currentTarget):J())},onKeyDown:N=>{var B,S,M;(M=(S=(B=n.onHeaderCell)==null?void 0:B.call(n,s,r))==null?void 0:S.onKeyDown)==null||M.call(S,N),!N.target.closest(".bj-table__filter-dropdown")&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),p?be(n,h,N.currentTarget):J())},rowSpan:l,scope:"col",style:{textAlign:n.align,...at(n,h)},tabIndex:p||j?0:void 0},"children"in s?m.renderColumnTitle(s.title,{filters:Object.fromEntries(O)}):It(n,h))})]},t))}),d.jsx(Ct,{className:"bj-table__body",children:L.length>0?L.map(({record:e,index:t})=>{var _;const s=V(e,t,v),i=se(e,t),l=((_=c==null?void 0:c.getCheckboxProps)==null?void 0:_.call(c,e).disabled)??!1,r=P.includes(s),n=typeof _e=="function"?_e(e,t,0):_e;return o.createElement(lt,{...xe==null?void 0:xe(e,t),className:z("bj-table__row",i&&"bj-table__row--group",r&&"bj-table__row--selected",n),key:s},c&&!i&&d.jsx(Pe,{className:z("bj-table__cell","bj-table__selection-cell",!!(f!=null&&f.x)&&"bj-table__selection-cell--fixed",!!(f!=null&&f.x)&&!W(y[0])&&"bj-table__cell--fixed-left-last"),style:{width:re},children:d.jsx(ut,{checked:r,disabled:l,label:`选择第 ${t+1} 行`,name:c.type==="radio"?"bj-table-row-selection":void 0,onChange:()=>wt(e,t),type:c.type??"checkbox"})}),y.map((h,p)=>{var S,M,b;if(i&&p>0)return null;const j=h,J=cs(e,j.dataIndex),w=j.render?j.render(J,e,t):J,q=bs(w)?w:void 0,N={...(S=j.onCell)==null?void 0:S.call(j,e,t),...q==null?void 0:q.props},B=q?q.children:w;return N.colSpan===0||N.rowSpan===0?null:o.createElement(Pe,{...N,className:z("bj-table__cell",((M=y[p+1])==null?void 0:M.fixed)==="right"&&"bj-table__cell--before-fixed-right",i&&"bj-table__cell--group",j.fixed&&"bj-table__cell--fixed",W(j)&&"bj-table__cell--fixed-left",W(j)&&!W(y[p+1])&&"bj-table__cell--fixed-left-last",X(j)&&"bj-table__cell--fixed-right",X(j)&&!X(y[p-1])&&"bj-table__cell--fixed-right-first",j.ellipsis&&"bj-table__cell--ellipsis",j.className,N.className),key:j.key??String(j.dataIndex??p),colSpan:i?nt:N.colSpan,style:{textAlign:j.align,...at(j,p),...N.style}},i?((b=u==null?void 0:u.render)==null?void 0:b.call(u,{record:e,expanded:C.includes(ce(e,t)),onToggle:()=>Mt(e,t)}))??B??"":d.jsx("div",{className:"bj-table__cell-content",children:B??""}))}))}):d.jsx(lt,{className:"bj-table__empty-row",children:d.jsx(Pe,{className:"bj-table__empty-cell",colSpan:Math.max(nt,1),style:{height:jt}})})}),Ie&&d.jsx("tfoot",{className:"bj-table__summary",children:Ie(k)})]})}),L.length===0&&d.jsx("div",{className:"bj-table__empty-overlay",children:d.jsxs("div",{className:"bj-table__empty-content",children:[dt&&d.jsx("div",{className:"bj-table__empty-image-wrap",children:dt}),d.jsx("div",{className:"bj-table__empty-text",children:Jt})]})})]}),((f==null?void 0:f.x)||(f==null?void 0:f.y))&&d.jsx(ns,{containerRef:ae,direction:f!=null&&f.x&&(f!=null&&f.y)?"both":f!=null&&f.x?"horizontal":"vertical",gap:2,horizontalInsetEnd:$e.end,horizontalInsetStart:$e.start,size:4,targetRef:ve}),Le&&d.jsx("div",{className:"bj-table__footer",children:Le(k)}),oe&&d.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"bj-table__loading",role:"status",children:[d.jsx("img",{alt:"",className:"bj-table__loading-indicator",src:rs}),d.jsx("span",{className:"bj-table__loading-text",children:"加载中..."})]}),a&&k.length>0&&d.jsx("div",{className:"bj-table__pagination",children:d.jsx(Xt,{align:"end",disabled:!!oe||a.disabled,current:H,defaultCurrent:a.defaultCurrent,defaultPageSize:a.defaultPageSize,dropdownClassName:a.dropdownClassName,hideOnSinglePage:a.hideOnSinglePage,onChange:e=>{if(Fe.current){Fe.current=!1;return}Gt(e)},onShowSizeChange:(e,t)=>At(t),pageSize:A,pageSizeOptions:a.pageSizeOptions,popupPlacement:a.popupPlacement,resolvePopupPlacement:a.resolvePopupPlacement,showQuickJumper:a.showQuickJumper,showSizeChanger:a.showSizeChanger,showTotal:a.showTotal,simple:a.simple,size:a.size,t:a.t??Q,total:Ze})})]})}const Me=us;Me.Column=is;Me.ColumnGroup=ls;exports.BTable=Me;
|
|
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 _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
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; } } }; }
|
|
13
|
+
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; } }
|
|
14
|
+
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; }
|
|
15
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
16
|
+
value: "Module"
|
|
17
|
+
});
|
|
18
|
+
var i = require("react/jsx-runtime"),
|
|
19
|
+
u = require("react"),
|
|
20
|
+
Dl = require("react-dom"),
|
|
21
|
+
Fl = require("../Pagination/Pagination.js"),
|
|
22
|
+
Le = require("../Icon/Icon.js");
|
|
23
|
+
; /* empty css */
|
|
24
|
+
var Kl = require("../Tooltip/ContentTooltip.js"),
|
|
25
|
+
kl = require("../Tooltip/TooltipWrapper.js"),
|
|
26
|
+
Bl = require("../CheckBox/index.js"),
|
|
27
|
+
Ml = require("../Dropdown/BDropdown.js"),
|
|
28
|
+
ql = require("../OverlayScrollbar/BOverlayScrollbar.js"),
|
|
29
|
+
zl = require("../SkuInputCard/spin_loading_red.gif.js"),
|
|
30
|
+
Tl = require("../ProductField/no_data_light.svg.js"),
|
|
31
|
+
Ll = require("./Column.js"),
|
|
32
|
+
Il = require("./ColumnGroup.js"),
|
|
33
|
+
C = require("./utils/sortFilter.js"),
|
|
34
|
+
ze = require("./utils/columns.js");
|
|
35
|
+
; /* empty css */
|
|
36
|
+
var Vl = Object.defineProperty,
|
|
37
|
+
Al = Object.defineProperties,
|
|
38
|
+
Gl = Object.getOwnPropertyDescriptors,
|
|
39
|
+
Gt = Object.getOwnPropertySymbols,
|
|
40
|
+
Hl = Object.prototype.hasOwnProperty,
|
|
41
|
+
Wl = Object.prototype.propertyIsEnumerable,
|
|
42
|
+
Ht = function Ht(b, f, v) {
|
|
43
|
+
return f in b ? Vl(b, f, {
|
|
44
|
+
enumerable: !0,
|
|
45
|
+
configurable: !0,
|
|
46
|
+
writable: !0,
|
|
47
|
+
value: v
|
|
48
|
+
}) : b[f] = v;
|
|
49
|
+
},
|
|
50
|
+
T = function T(b, f) {
|
|
51
|
+
for (var v in f || (f = {})) Hl.call(f, v) && Ht(b, v, f[v]);
|
|
52
|
+
if (Gt) {
|
|
53
|
+
var _iterator = _createForOfIteratorHelper(Gt(f)),
|
|
54
|
+
_step;
|
|
55
|
+
try {
|
|
56
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
57
|
+
var v = _step.value;
|
|
58
|
+
Wl.call(f, v) && Ht(b, v, f[v]);
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
_iterator.e(err);
|
|
62
|
+
} finally {
|
|
63
|
+
_iterator.f();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return b;
|
|
67
|
+
},
|
|
68
|
+
se = function se(b, f) {
|
|
69
|
+
return Al(b, Gl(f));
|
|
70
|
+
};
|
|
71
|
+
var $l = 300,
|
|
72
|
+
Te = 1;
|
|
73
|
+
function L() {
|
|
74
|
+
for (var _len = arguments.length, b = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
|
+
b[_key] = arguments[_key];
|
|
76
|
+
}
|
|
77
|
+
return b.filter(Boolean).join(" ");
|
|
78
|
+
}
|
|
79
|
+
function Ul(b, f) {
|
|
80
|
+
return f === void 0 ? void 0 : (Array.isArray(f) ? f : [f]).reduce(function (O, o) {
|
|
81
|
+
if (!(O == null || _typeof(O) != "object")) return O[o];
|
|
82
|
+
}, b);
|
|
83
|
+
}
|
|
84
|
+
function G(b, f, v) {
|
|
85
|
+
if (typeof v == "function") return v(b, f);
|
|
86
|
+
if (v) {
|
|
87
|
+
var O = b[String(v)];
|
|
88
|
+
if (typeof O == "string" || typeof O == "number") return O;
|
|
89
|
+
}
|
|
90
|
+
return f;
|
|
91
|
+
}
|
|
92
|
+
function Jl(b, f) {
|
|
93
|
+
return Math.max(1, Math.ceil(b / f));
|
|
94
|
+
}
|
|
95
|
+
function Ql(b) {
|
|
96
|
+
return !!(b && _typeof(b) == "object" && !u.isValidElement(b) && "props" in b);
|
|
97
|
+
}
|
|
98
|
+
function Zl(b, f) {
|
|
99
|
+
return (typeof f.text == "string" || typeof f.text == "number" ? String(f.text) : String(f.value)).toLocaleLowerCase().includes(b.toLocaleLowerCase());
|
|
100
|
+
}
|
|
101
|
+
function Wt(_ref) {
|
|
102
|
+
var b = _ref.checked,
|
|
103
|
+
f = _ref.disabled,
|
|
104
|
+
v = _ref.label,
|
|
105
|
+
O = _ref.name,
|
|
106
|
+
o = _ref.onChange,
|
|
107
|
+
_ref$type = _ref.type,
|
|
108
|
+
H = _ref$type === void 0 ? "checkbox" : _ref$type;
|
|
109
|
+
return H === "checkbox" ? i.jsx(Bl.BCheckBox, {
|
|
110
|
+
"aria-label": v,
|
|
111
|
+
checked: b,
|
|
112
|
+
className: "bj-table__selection-checkbox",
|
|
113
|
+
disabled: f,
|
|
114
|
+
name: O,
|
|
115
|
+
onChange: o,
|
|
116
|
+
skipGroup: !0
|
|
117
|
+
}) : i.jsxs("label", {
|
|
118
|
+
className: L("bj-table__selection-control", b && "bj-table__selection-control--checked", f && "bj-table__selection-control--disabled"),
|
|
119
|
+
children: [i.jsx("input", {
|
|
120
|
+
"aria-label": v,
|
|
121
|
+
checked: b,
|
|
122
|
+
className: "bj-table__selection-input",
|
|
123
|
+
disabled: f,
|
|
124
|
+
name: O,
|
|
125
|
+
onChange: o,
|
|
126
|
+
type: H
|
|
127
|
+
}), i.jsx("span", {
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
className: "bj-table__selection-box",
|
|
130
|
+
children: b && i.jsx(Le, {
|
|
131
|
+
className: "bj-table__selection-check-icon",
|
|
132
|
+
type: "icon-a-dagouxi"
|
|
133
|
+
})
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function Xl(_ref2) {
|
|
138
|
+
var b = _ref2.columns,
|
|
139
|
+
_ref2$dataSource = _ref2.dataSource,
|
|
140
|
+
f = _ref2$dataSource === void 0 ? [] : _ref2$dataSource,
|
|
141
|
+
v = _ref2.rowKey,
|
|
142
|
+
_ref2$preserveSelecte = _ref2.preserveSelectedRowKeys,
|
|
143
|
+
O = _ref2$preserveSelecte === void 0 ? !1 : _ref2$preserveSelecte,
|
|
144
|
+
o = _ref2.rowSelection,
|
|
145
|
+
_ref2$pagination = _ref2.pagination,
|
|
146
|
+
H = _ref2$pagination === void 0 ? !1 : _ref2$pagination,
|
|
147
|
+
_ref2$loading = _ref2.loading,
|
|
148
|
+
Ce = _ref2$loading === void 0 ? !1 : _ref2$loading,
|
|
149
|
+
_ref2$bordered = _ref2.bordered,
|
|
150
|
+
$t = _ref2$bordered === void 0 ? !0 : _ref2$bordered,
|
|
151
|
+
_ref2$size = _ref2.size,
|
|
152
|
+
Ut = _ref2$size === void 0 ? "middle" : _ref2$size,
|
|
153
|
+
_ref2$showHeader = _ref2.showHeader,
|
|
154
|
+
Ve = _ref2$showHeader === void 0 ? !0 : _ref2$showHeader,
|
|
155
|
+
_e = _ref2.emptyText,
|
|
156
|
+
_ref2$emptyImage = _ref2.emptyImage,
|
|
157
|
+
we = _ref2$emptyImage === void 0 ? Tl : _ref2$emptyImage,
|
|
158
|
+
Jt = _ref2.emptyHeight,
|
|
159
|
+
_ref2$t = _ref2.t,
|
|
160
|
+
Y = _ref2$t === void 0 ? function (ve) {
|
|
161
|
+
return ve;
|
|
162
|
+
} : _ref2$t,
|
|
163
|
+
Qt = _ref2.className,
|
|
164
|
+
Zt = _ref2.style,
|
|
165
|
+
Ne = _ref2.rowClassName,
|
|
166
|
+
_ref2$sortDirections = _ref2.sortDirections,
|
|
167
|
+
Xt = _ref2$sortDirections === void 0 ? ["ascend", "descend", null] : _ref2$sortDirections,
|
|
168
|
+
Ae = _ref2.onChange,
|
|
169
|
+
Ge = _ref2.children,
|
|
170
|
+
He = _ref2.title,
|
|
171
|
+
We = _ref2.footer,
|
|
172
|
+
$e = _ref2.summary,
|
|
173
|
+
ae = _ref2.tableLayout,
|
|
174
|
+
k = _ref2.components,
|
|
175
|
+
Ue = _ref2.onRow,
|
|
176
|
+
Je = _ref2.onHeaderRow,
|
|
177
|
+
Yt = _ref2.id,
|
|
178
|
+
_ = _ref2.scroll,
|
|
179
|
+
he = _ref2.locale,
|
|
180
|
+
y = _ref2.groupCollapse;
|
|
181
|
+
var ve, Qe, Ze, Xe, Ye, et, tt, lt, nt, rt, it, st, at, ot, dt, ct, ut, ft, bt, _t, ht, vt;
|
|
182
|
+
var pt = u.useRef(null),
|
|
183
|
+
Re = u.useRef(null),
|
|
184
|
+
pe = u.useMemo(function () {
|
|
185
|
+
return b != null ? b : ze.convertChildrenToColumns(Ge);
|
|
186
|
+
}, [Ge, b]),
|
|
187
|
+
oe = u.useMemo(function () {
|
|
188
|
+
return ze.flattenColumns(pe);
|
|
189
|
+
}, [pe]),
|
|
190
|
+
gt = u.useMemo(function () {
|
|
191
|
+
return ze.buildHeaderRows(pe);
|
|
192
|
+
}, [pe]),
|
|
193
|
+
_u$useState = u.useState((ve = o == null ? void 0 : o.defaultSelectedRowKeys) != null ? ve : []),
|
|
194
|
+
_u$useState2 = _slicedToArray(_u$useState, 2),
|
|
195
|
+
el = _u$useState2[0],
|
|
196
|
+
jt = _u$useState2[1],
|
|
197
|
+
_u$useState3 = u.useState(H && (Qe = H.defaultCurrent) != null ? Qe : 1),
|
|
198
|
+
_u$useState4 = _slicedToArray(_u$useState3, 2),
|
|
199
|
+
Pe = _u$useState4[0],
|
|
200
|
+
ge = _u$useState4[1],
|
|
201
|
+
_u$useState5 = u.useState(H && (Ze = H.defaultPageSize) != null ? Ze : 10),
|
|
202
|
+
_u$useState6 = _slicedToArray(_u$useState5, 2),
|
|
203
|
+
tl = _u$useState6[0],
|
|
204
|
+
ll = _u$useState6[1],
|
|
205
|
+
_u$useState7 = u.useState(function () {
|
|
206
|
+
return new Map(oe.flatMap(function (e, t) {
|
|
207
|
+
return e.defaultSortOrder ? [[C.getColumnKey(e, t), e.defaultSortOrder]] : [];
|
|
208
|
+
}));
|
|
209
|
+
}),
|
|
210
|
+
_u$useState8 = _slicedToArray(_u$useState7, 2),
|
|
211
|
+
nl = _u$useState8[0],
|
|
212
|
+
rl = _u$useState8[1],
|
|
213
|
+
_u$useState9 = u.useState(function () {
|
|
214
|
+
return new Map(oe.flatMap(function (e, t) {
|
|
215
|
+
return e.defaultFilteredValue === void 0 ? [] : [[C.getColumnKey(e, t), e.defaultFilteredValue]];
|
|
216
|
+
}));
|
|
217
|
+
}),
|
|
218
|
+
_u$useState0 = _slicedToArray(_u$useState9, 2),
|
|
219
|
+
il = _u$useState0[0],
|
|
220
|
+
sl = _u$useState0[1],
|
|
221
|
+
_u$useState1 = u.useState(y != null && y.defaultExpandedKeys ? _toConsumableArray(y.defaultExpandedKeys) : []),
|
|
222
|
+
_u$useState10 = _slicedToArray(_u$useState1, 2),
|
|
223
|
+
al = _u$useState10[0],
|
|
224
|
+
ol = _u$useState10[1],
|
|
225
|
+
_u$useState11 = u.useState(null),
|
|
226
|
+
_u$useState12 = _slicedToArray(_u$useState11, 2),
|
|
227
|
+
I = _u$useState12[0],
|
|
228
|
+
Q = _u$useState12[1],
|
|
229
|
+
_u$useState13 = u.useState(new Map()),
|
|
230
|
+
_u$useState14 = _slicedToArray(_u$useState13, 2),
|
|
231
|
+
yt = _u$useState14[0],
|
|
232
|
+
de = _u$useState14[1],
|
|
233
|
+
_u$useState15 = u.useState(null),
|
|
234
|
+
_u$useState16 = _slicedToArray(_u$useState15, 2),
|
|
235
|
+
dl = _u$useState16[0],
|
|
236
|
+
je = _u$useState16[1],
|
|
237
|
+
cl = u.useRef("btable-".concat(Math.random().toString(36).slice(2, 10))).current,
|
|
238
|
+
_u$useState17 = u.useState(null),
|
|
239
|
+
_u$useState18 = _slicedToArray(_u$useState17, 2),
|
|
240
|
+
ee = _u$useState18[0],
|
|
241
|
+
Ee = _u$useState18[1],
|
|
242
|
+
_u$useState19 = u.useState(null),
|
|
243
|
+
_u$useState20 = _slicedToArray(_u$useState19, 2),
|
|
244
|
+
Oe = _u$useState20[0],
|
|
245
|
+
mt = _u$useState20[1],
|
|
246
|
+
_u$useState21 = u.useState(""),
|
|
247
|
+
_u$useState22 = _slicedToArray(_u$useState21, 2),
|
|
248
|
+
De = _u$useState22[0],
|
|
249
|
+
xt = _u$useState22[1],
|
|
250
|
+
_u$useState23 = u.useState(""),
|
|
251
|
+
_u$useState24 = _slicedToArray(_u$useState23, 2),
|
|
252
|
+
ce = _u$useState24[0],
|
|
253
|
+
St = _u$useState24[1],
|
|
254
|
+
_u$useState25 = u.useState(),
|
|
255
|
+
_u$useState26 = _slicedToArray(_u$useState25, 2),
|
|
256
|
+
Ct = _u$useState26[0],
|
|
257
|
+
Fe = _u$useState26[1],
|
|
258
|
+
Ke = u.useRef(0),
|
|
259
|
+
ke = u.useRef(!1),
|
|
260
|
+
_u$useState27 = u.useState({
|
|
261
|
+
start: 0,
|
|
262
|
+
end: 0
|
|
263
|
+
}),
|
|
264
|
+
_u$useState28 = _slicedToArray(_u$useState27, 2),
|
|
265
|
+
wt = _u$useState28[0],
|
|
266
|
+
Nt = _u$useState28[1],
|
|
267
|
+
_u$useState29 = u.useState({
|
|
268
|
+
start: !1,
|
|
269
|
+
end: !1
|
|
270
|
+
}),
|
|
271
|
+
_u$useState30 = _slicedToArray(_u$useState29, 2),
|
|
272
|
+
Rt = _u$useState30[0],
|
|
273
|
+
Pt = _u$useState30[1],
|
|
274
|
+
a = H || void 0,
|
|
275
|
+
W = (Xe = a == null ? void 0 : a.pageSize) != null ? Xe : tl,
|
|
276
|
+
B = (Ye = o == null ? void 0 : o.selectedRowKeys) != null ? Ye : el,
|
|
277
|
+
m = oe,
|
|
278
|
+
ul = "".concat(m.map(function (e) {
|
|
279
|
+
var t, l;
|
|
280
|
+
return "".concat(String((t = e.fixed) != null ? t : ""), ":").concat(String((l = e.width) != null ? l : ""));
|
|
281
|
+
}).join("|"), "|").concat(o ? String((et = o.columnWidth) != null ? et : "") : "-", "|").concat(String((tt = _ == null ? void 0 : _.x) != null ? tt : ""), "|").concat(String(ae != null ? ae : "")),
|
|
282
|
+
$ = function $(e) {
|
|
283
|
+
return !!(e && (e.fixed === "left" || e.fixed === !0));
|
|
284
|
+
},
|
|
285
|
+
te = function te(e) {
|
|
286
|
+
return !!(e && e.fixed === "right");
|
|
287
|
+
},
|
|
288
|
+
F = new Map(nl),
|
|
289
|
+
M = new Map(il);
|
|
290
|
+
m.forEach(function (e, t) {
|
|
291
|
+
if ("children" in e) return;
|
|
292
|
+
var l = C.getColumnKey(e, t);
|
|
293
|
+
e.sortOrder !== void 0 && F.set(l, e.sortOrder), e.filteredValue !== void 0 && M.set(l, e.filteredValue);
|
|
294
|
+
});
|
|
295
|
+
var Et = u.useMemo(function () {
|
|
296
|
+
return C.filterRecords(f, m, M);
|
|
297
|
+
}, [m, M, f]),
|
|
298
|
+
q = u.useMemo(function () {
|
|
299
|
+
return C.sortRecords(Et, m, F);
|
|
300
|
+
}, [m, Et, F]),
|
|
301
|
+
Ot = (lt = a == null ? void 0 : a.total) != null ? lt : q.length,
|
|
302
|
+
Dt = Jl(Ot, W),
|
|
303
|
+
U = Math.min((nt = a == null ? void 0 : a.current) != null ? nt : Pe, Dt),
|
|
304
|
+
Z = (rt = y == null ? void 0 : y.expandedKeys) != null ? rt : al,
|
|
305
|
+
ue = function ue(e, t) {
|
|
306
|
+
return y != null && y.isGroupRow ? y.isGroupRow(e, t) : !!e.isGroup;
|
|
307
|
+
},
|
|
308
|
+
ye = function ye(e, t) {
|
|
309
|
+
return y != null && y.groupKey ? y.groupKey(e, t) : e.groupId;
|
|
310
|
+
},
|
|
311
|
+
Ft = function Ft(e, t) {
|
|
312
|
+
var l;
|
|
313
|
+
return y != null && y.childrenKeys ? y.childrenKeys(e, t) : (l = e.childrenIds) != null ? l : [];
|
|
314
|
+
},
|
|
315
|
+
fl = function fl(e, t) {
|
|
316
|
+
var l;
|
|
317
|
+
var r = ye(e, t),
|
|
318
|
+
s = Z.includes(r),
|
|
319
|
+
n = s ? Z.filter(function (h) {
|
|
320
|
+
return h !== r;
|
|
321
|
+
}) : [].concat(_toConsumableArray(Z), [r]);
|
|
322
|
+
(y == null ? void 0 : y.expandedKeys) === void 0 && ol(n), (l = y == null ? void 0 : y.onExpandedKeysChange) == null || l.call(y, n, e, !s);
|
|
323
|
+
};
|
|
324
|
+
u.useEffect(function () {
|
|
325
|
+
U !== Pe && (a == null ? void 0 : a.current) === void 0 && ge(U);
|
|
326
|
+
}, [U, a == null ? void 0 : a.current, Pe]), u.useEffect(function () {
|
|
327
|
+
if (!ee || I === null) {
|
|
328
|
+
mt(null);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
var e = function e() {
|
|
332
|
+
var t = ee.getBoundingClientRect();
|
|
333
|
+
mt({
|
|
334
|
+
left: t.left,
|
|
335
|
+
top: t.bottom + 4
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
return e(), document.addEventListener("scroll", e, !0), window.addEventListener("resize", e), function () {
|
|
339
|
+
document.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
340
|
+
};
|
|
341
|
+
}, [ee, I]), u.useEffect(function () {
|
|
342
|
+
if (I === null) return;
|
|
343
|
+
var e = function e(t) {
|
|
344
|
+
var l = t.target;
|
|
345
|
+
ee != null && ee.contains(l) || l.closest(".bj-table__filter-dropdown") || (Q(null), Ee(null));
|
|
346
|
+
};
|
|
347
|
+
return document.addEventListener("mousedown", e), function () {
|
|
348
|
+
return document.removeEventListener("mousedown", e);
|
|
349
|
+
};
|
|
350
|
+
}, [ee, I]), u.useEffect(function () {
|
|
351
|
+
var e = window.setTimeout(function () {
|
|
352
|
+
return St(De.trim());
|
|
353
|
+
}, $l);
|
|
354
|
+
return function () {
|
|
355
|
+
return window.clearTimeout(e);
|
|
356
|
+
};
|
|
357
|
+
}, [De]), u.useEffect(function () {
|
|
358
|
+
if (I === null) return;
|
|
359
|
+
var e = oe.find(function (l, r) {
|
|
360
|
+
return C.getColumnKey(l, r) === I;
|
|
361
|
+
});
|
|
362
|
+
if (!e || "children" in e || !e.filterRequest) return;
|
|
363
|
+
var t = ++Ke.current;
|
|
364
|
+
Promise.resolve().then(function () {
|
|
365
|
+
return e.filterRequest(ce);
|
|
366
|
+
}).then(function (l) {
|
|
367
|
+
Ke.current === t && Fe(l);
|
|
368
|
+
}, function () {
|
|
369
|
+
Ke.current === t && Fe([]);
|
|
370
|
+
});
|
|
371
|
+
}, [ce, oe, I]);
|
|
372
|
+
var V = u.useMemo(function () {
|
|
373
|
+
if (!a || a.serverPagination) return q.map(function (t, l) {
|
|
374
|
+
return {
|
|
375
|
+
record: t,
|
|
376
|
+
index: l
|
|
377
|
+
};
|
|
378
|
+
}).filter(function (_ref3) {
|
|
379
|
+
var t = _ref3.record,
|
|
380
|
+
l = _ref3.index;
|
|
381
|
+
if (!y || ue(t, l)) return !0;
|
|
382
|
+
var r = G(t, l, v);
|
|
383
|
+
return q.some(function (s, n) {
|
|
384
|
+
return ue(s, n) && Z.includes(ye(s, n)) && Ft(s, n).includes(r);
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
var e = (U - 1) * W;
|
|
388
|
+
return q.slice(e, e + W).map(function (t, l) {
|
|
389
|
+
return {
|
|
390
|
+
record: t,
|
|
391
|
+
index: e + l
|
|
392
|
+
};
|
|
393
|
+
}).filter(function (_ref4) {
|
|
394
|
+
var t = _ref4.record,
|
|
395
|
+
l = _ref4.index;
|
|
396
|
+
if (!y || ue(t, l)) return !0;
|
|
397
|
+
var r = G(t, l, v);
|
|
398
|
+
return q.some(function (s, n) {
|
|
399
|
+
return ue(s, n) && Z.includes(ye(s, n)) && Ft(s, n).includes(r);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}, [U, Z, y, W, a, q, v]),
|
|
403
|
+
Kt = u.useMemo(function () {
|
|
404
|
+
return V.map(function (_ref5) {
|
|
405
|
+
var e = _ref5.record,
|
|
406
|
+
t = _ref5.index;
|
|
407
|
+
return G(e, t, v);
|
|
408
|
+
});
|
|
409
|
+
}, [v, V]),
|
|
410
|
+
bl = B.map(String).join("|"),
|
|
411
|
+
_l = Kt.map(String).join("|");
|
|
412
|
+
u.useEffect(function () {
|
|
413
|
+
var e;
|
|
414
|
+
if (!o || O || B.length === 0) return;
|
|
415
|
+
var t = new Set(Kt),
|
|
416
|
+
l = B.filter(function (n) {
|
|
417
|
+
return t.has(n);
|
|
418
|
+
});
|
|
419
|
+
if (l.length === B.length) return;
|
|
420
|
+
o.selectedRowKeys === void 0 && jt(l);
|
|
421
|
+
var r = new Set(l),
|
|
422
|
+
s = V.filter(function (_ref6) {
|
|
423
|
+
var n = _ref6.record,
|
|
424
|
+
h = _ref6.index;
|
|
425
|
+
return r.has(G(n, h, v));
|
|
426
|
+
}).map(function (_ref7) {
|
|
427
|
+
var n = _ref7.record;
|
|
428
|
+
return n;
|
|
429
|
+
});
|
|
430
|
+
(e = o.onChange) == null || e.call(o, l, s, {
|
|
431
|
+
type: "multiple"
|
|
432
|
+
});
|
|
433
|
+
}, [O, o, v, bl, _l, V]), u.useEffect(function () {
|
|
434
|
+
var e = Re.current;
|
|
435
|
+
if (!e || !(_ != null && _.x)) {
|
|
436
|
+
Nt(function (n) {
|
|
437
|
+
return n.start === 0 && n.end === 0 ? n : {
|
|
438
|
+
start: 0,
|
|
439
|
+
end: 0
|
|
440
|
+
};
|
|
441
|
+
}), Pt(function (n) {
|
|
442
|
+
return n.start || n.end ? {
|
|
443
|
+
start: !1,
|
|
444
|
+
end: !1
|
|
445
|
+
} : n;
|
|
446
|
+
});
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
var t = function t() {
|
|
450
|
+
var n;
|
|
451
|
+
var h = (n = e.querySelector(".bj-table__header .bj-table__header-row")) != null ? n : e.querySelector(".bj-table__body .bj-table__row");
|
|
452
|
+
var p = 0,
|
|
453
|
+
g = 0;
|
|
454
|
+
if (h) {
|
|
455
|
+
Array.from(h.children).forEach(function (d) {
|
|
456
|
+
var P = d.getBoundingClientRect().width;
|
|
457
|
+
d.classList.contains("bj-table__cell--fixed-right") ? g += P : (d.classList.contains("bj-table__cell--fixed-left") || d.classList.contains("bj-table__selection-cell--fixed")) && (p += P);
|
|
458
|
+
});
|
|
459
|
+
var N = e.clientLeft;
|
|
460
|
+
p > 0 && (p += N), g > 0 && (g = Math.max(g - N, 0));
|
|
461
|
+
}
|
|
462
|
+
Nt(function (N) {
|
|
463
|
+
return N.start === p && N.end === g ? N : {
|
|
464
|
+
start: p,
|
|
465
|
+
end: g
|
|
466
|
+
};
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
l = function l() {
|
|
470
|
+
var n = e.scrollWidth - e.clientWidth,
|
|
471
|
+
h = n > Te,
|
|
472
|
+
p = {
|
|
473
|
+
start: h && e.scrollLeft > Te,
|
|
474
|
+
end: h && e.scrollLeft < n - Te
|
|
475
|
+
};
|
|
476
|
+
Pt(function (g) {
|
|
477
|
+
return g.start === p.start && g.end === p.end ? g : p;
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
r = function r() {
|
|
481
|
+
t(), l();
|
|
482
|
+
};
|
|
483
|
+
r(), e.addEventListener("scroll", l, {
|
|
484
|
+
passive: !0
|
|
485
|
+
});
|
|
486
|
+
var s = new ResizeObserver(r);
|
|
487
|
+
return s.observe(e), e.firstElementChild && s.observe(e.firstElementChild), function () {
|
|
488
|
+
e.removeEventListener("scroll", l), s.disconnect();
|
|
489
|
+
};
|
|
490
|
+
}, [ul, _ == null ? void 0 : _.x, Ve, V.length]);
|
|
491
|
+
var me = function me(e) {
|
|
492
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : F;
|
|
493
|
+
var l = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : M;
|
|
494
|
+
var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : U;
|
|
495
|
+
var s = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : W;
|
|
496
|
+
var n;
|
|
497
|
+
var h = Object.fromEntries(l),
|
|
498
|
+
p = C.filterRecords(f, m, l),
|
|
499
|
+
g = C.sortRecords(p, m, t);
|
|
500
|
+
Ae == null || Ae(se(T({}, a), {
|
|
501
|
+
current: r,
|
|
502
|
+
pageSize: s,
|
|
503
|
+
total: (n = a == null ? void 0 : a.total) != null ? n : g.length
|
|
504
|
+
}), h, C.getSorterResult(m, t), {
|
|
505
|
+
action: e,
|
|
506
|
+
currentDataSource: g
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
hl = function hl(e, t) {
|
|
510
|
+
var l, r;
|
|
511
|
+
if (!e.sorter) return;
|
|
512
|
+
var s = C.getColumnKey(e, t),
|
|
513
|
+
n = C.getNextSortOrder((l = F.get(s)) != null ? l : null, (r = e.sortDirections) != null ? r : Xt),
|
|
514
|
+
h = new Map();
|
|
515
|
+
h.set(s, n), e.sortOrder === void 0 && rl(h), me("sort", h);
|
|
516
|
+
},
|
|
517
|
+
Be = function Be(e, t, l) {
|
|
518
|
+
var r = C.getColumnKey(e, t),
|
|
519
|
+
s = new Map(M);
|
|
520
|
+
s.set(r, l), e.filteredValue === void 0 && sl(s), Q(null), (a == null ? void 0 : a.current) === void 0 && ge(1), me("filter", F, s, 1);
|
|
521
|
+
},
|
|
522
|
+
vl = function vl(e, t) {
|
|
523
|
+
var l;
|
|
524
|
+
var r = C.getColumnKey(e, t),
|
|
525
|
+
s = e.filterResetToDefaultFilteredValue ? (l = e.defaultFilteredValue) != null ? l : [] : [];
|
|
526
|
+
de(function (n) {
|
|
527
|
+
return new Map(n).set(r, s);
|
|
528
|
+
});
|
|
529
|
+
},
|
|
530
|
+
xe = function xe(e, t, l) {
|
|
531
|
+
var r, s, n, h;
|
|
532
|
+
var p = C.getColumnKey(e, t);
|
|
533
|
+
if (I === p) {
|
|
534
|
+
Q(null), Ee(null), (r = e.onFilterDropdownOpenChange) == null || r.call(e, !1), (s = e.onFilterDropdownVisibleChange) == null || s.call(e, !1);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
xt(""), St(""), Fe(void 0), de(function (g) {
|
|
538
|
+
var N;
|
|
539
|
+
return new Map(g).set(p, (N = M.get(p)) != null ? N : []);
|
|
540
|
+
}), Q(p), l && Ee(l), (n = e.onFilterDropdownOpenChange) == null || n.call(e, !0), (h = e.onFilterDropdownVisibleChange) == null || h.call(e, !0);
|
|
541
|
+
},
|
|
542
|
+
pl = function pl(e, t) {
|
|
543
|
+
var l, r, s, n, h, p, g, N, d, P, w, z, A;
|
|
544
|
+
var x = C.getColumnKey(e, t),
|
|
545
|
+
R = "bj-table-badge-".concat(cl, "-").concat(String(x).replace(/[^a-zA-Z0-9_-]/g, "-")),
|
|
546
|
+
E = (l = F.get(x)) != null ? l : null,
|
|
547
|
+
D = (r = M.get(x)) != null ? r : [],
|
|
548
|
+
j = (s = yt.get(x)) != null ? s : D,
|
|
549
|
+
ne = (h = (n = e.filterDropdownOpen) != null ? n : e.filterDropdownVisible) != null ? h : I === x,
|
|
550
|
+
X = e.filtered || D.length > 0,
|
|
551
|
+
re = E === "ascend" ? "icon-a-zhengxumian" : E === "descend" ? "icon-a-daoxumian" : "icon-a-weipaixumian",
|
|
552
|
+
J = C.renderColumnTitle(e.title, {
|
|
553
|
+
sortOrder: E,
|
|
554
|
+
sortColumn: E ? e : void 0,
|
|
555
|
+
sortColumns: E ? [{
|
|
556
|
+
column: e,
|
|
557
|
+
order: E
|
|
558
|
+
}] : [],
|
|
559
|
+
filters: Object.fromEntries(M)
|
|
560
|
+
}),
|
|
561
|
+
ie = typeof e.filterDropdown == "function" ? e.filterDropdown({
|
|
562
|
+
prefixCls: "bj-table",
|
|
563
|
+
selectedKeys: j.filter(function (c) {
|
|
564
|
+
return typeof c != "boolean";
|
|
565
|
+
}),
|
|
566
|
+
setSelectedKeys: function setSelectedKeys(c) {
|
|
567
|
+
return de(function (S) {
|
|
568
|
+
return new Map(S).set(x, c);
|
|
569
|
+
});
|
|
570
|
+
},
|
|
571
|
+
confirm: function confirm(c) {
|
|
572
|
+
var S;
|
|
573
|
+
Be(e, t, (S = yt.get(x)) != null ? S : j), (c == null ? void 0 : c.closeDropdown) === !1 && Q(x);
|
|
574
|
+
},
|
|
575
|
+
clearFilters: function clearFilters(c) {
|
|
576
|
+
var S;
|
|
577
|
+
var K = e.filterResetToDefaultFilteredValue ? (S = e.defaultFilteredValue) != null ? S : [] : [];
|
|
578
|
+
de(function (Se) {
|
|
579
|
+
return new Map(Se).set(x, K);
|
|
580
|
+
}), (c == null ? void 0 : c.confirm) === !0 && Be(e, t, K), ((c == null ? void 0 : c.closeDropdown) === !1 || (c == null ? void 0 : c.confirm) !== !0) && Q(x);
|
|
581
|
+
},
|
|
582
|
+
filters: e.filters,
|
|
583
|
+
close: function close() {
|
|
584
|
+
return Q(null);
|
|
585
|
+
},
|
|
586
|
+
visible: ne
|
|
587
|
+
}) : e.filterDropdown,
|
|
588
|
+
Vt = e.filterRequest ? Ct != null ? Ct : [] : (p = e.filters) != null ? p : [],
|
|
589
|
+
Pl = ce && !e.filterRequest ? Vt.filter(function (c) {
|
|
590
|
+
return typeof e.filterSearch == "function" ? e.filterSearch(ce, c) : Zl(ce, c);
|
|
591
|
+
}) : Vt,
|
|
592
|
+
El = !!(e.filterSearch || e.filterRequest),
|
|
593
|
+
At = i.jsxs("div", {
|
|
594
|
+
className: L("bj-table__column-header", e.sorter && "bj-table__column-header--sortable"),
|
|
595
|
+
children: [e.badge !== void 0 && i.jsx("span", {
|
|
596
|
+
"aria-label": "表头提示",
|
|
597
|
+
className: "bj-table__column-badge-trigger",
|
|
598
|
+
id: R,
|
|
599
|
+
onBlur: function onBlur() {
|
|
600
|
+
return je(null);
|
|
601
|
+
},
|
|
602
|
+
onClick: function onClick(c) {
|
|
603
|
+
return c.stopPropagation();
|
|
604
|
+
},
|
|
605
|
+
onFocus: function onFocus() {
|
|
606
|
+
return je(x);
|
|
607
|
+
},
|
|
608
|
+
onKeyDown: function onKeyDown(c) {
|
|
609
|
+
return c.stopPropagation();
|
|
610
|
+
},
|
|
611
|
+
onMouseEnter: function onMouseEnter() {
|
|
612
|
+
return je(x);
|
|
613
|
+
},
|
|
614
|
+
onMouseLeave: function onMouseLeave() {
|
|
615
|
+
return je(null);
|
|
616
|
+
},
|
|
617
|
+
role: "button",
|
|
618
|
+
tabIndex: 0,
|
|
619
|
+
children: i.jsx("span", {
|
|
620
|
+
"aria-hidden": "true",
|
|
621
|
+
className: "bj-table__column-badge-shape"
|
|
622
|
+
})
|
|
623
|
+
}), i.jsxs("div", {
|
|
624
|
+
className: "bj-table__column-title",
|
|
625
|
+
children: [i.jsx("span", {
|
|
626
|
+
className: "bj-table__column-title-content",
|
|
627
|
+
children: J
|
|
628
|
+
}), e.sorter && i.jsx("span", {
|
|
629
|
+
"aria-hidden": "true",
|
|
630
|
+
className: "bj-table__column-sorter",
|
|
631
|
+
children: i.jsx(Le, {
|
|
632
|
+
className: "bj-table__column-sorter-icon",
|
|
633
|
+
type: re
|
|
634
|
+
})
|
|
635
|
+
})]
|
|
636
|
+
}), (e.filters || e.filterDropdown) && i.jsxs("div", {
|
|
637
|
+
className: "bj-table__filter",
|
|
638
|
+
children: [i.jsx("button", {
|
|
639
|
+
"aria-expanded": ne,
|
|
640
|
+
"aria-label": "筛选",
|
|
641
|
+
className: L("bj-table__filter-trigger", X && "bj-table__filter-trigger--active"),
|
|
642
|
+
onClick: function onClick(c) {
|
|
643
|
+
c.stopPropagation(), xe(e, t);
|
|
644
|
+
},
|
|
645
|
+
type: "button",
|
|
646
|
+
children: typeof e.filterIcon == "function" ? e.filterIcon(X) : (g = e.filterIcon) != null ? g : i.jsx(Le, {
|
|
647
|
+
className: "bj-table__filter-icon",
|
|
648
|
+
type: X ? "icon-shaixuan-daidian" : "icon-a-shaixuanxi"
|
|
649
|
+
})
|
|
650
|
+
}), ne && Oe && typeof document != "undefined" && Dl.createPortal(i.jsx("div", {
|
|
651
|
+
className: "bj-table__filter-dropdown",
|
|
652
|
+
onClick: function onClick(c) {
|
|
653
|
+
return c.stopPropagation();
|
|
654
|
+
},
|
|
655
|
+
role: "dialog",
|
|
656
|
+
style: {
|
|
657
|
+
left: Oe.left,
|
|
658
|
+
top: Oe.top
|
|
659
|
+
},
|
|
660
|
+
children: ie != null ? ie : i.jsx(Ml.BDropdown, se(T({}, e.filterDropdownProps), {
|
|
661
|
+
emptyText: (N = he == null ? void 0 : he.filterEmptyText) != null ? N : Y("暂无结果"),
|
|
662
|
+
multiple: e.filterMultiple !== !1,
|
|
663
|
+
onChange: function onChange(c, S) {
|
|
664
|
+
var K, Se;
|
|
665
|
+
de(function (Ol) {
|
|
666
|
+
return new Map(Ol).set(x, c);
|
|
667
|
+
}), (Se = (K = e.filterDropdownProps) == null ? void 0 : K.onChange) == null || Se.call(K, c, S);
|
|
668
|
+
},
|
|
669
|
+
onConfirm: function onConfirm(c) {
|
|
670
|
+
var S, K;
|
|
671
|
+
Be(e, t, c), (K = (S = e.filterDropdownProps) == null ? void 0 : S.onConfirm) == null || K.call(S, c);
|
|
672
|
+
},
|
|
673
|
+
onReset: function onReset() {
|
|
674
|
+
var c, S;
|
|
675
|
+
vl(e, t), (S = (c = e.filterDropdownProps) == null ? void 0 : c.onReset) == null || S.call(c);
|
|
676
|
+
},
|
|
677
|
+
onSearch: function onSearch(c) {
|
|
678
|
+
var S, K;
|
|
679
|
+
xt(c), (K = (S = e.filterDropdownProps) == null ? void 0 : S.onSearch) == null || K.call(S, c);
|
|
680
|
+
},
|
|
681
|
+
options: Pl.map(function (c) {
|
|
682
|
+
return {
|
|
683
|
+
label: c.text,
|
|
684
|
+
description: c.description,
|
|
685
|
+
value: c.value
|
|
686
|
+
};
|
|
687
|
+
}),
|
|
688
|
+
searchable: (P = (d = e.filterDropdownProps) == null ? void 0 : d.searchable) != null ? P : El,
|
|
689
|
+
searchPlaceholder: (A = (w = e.filterDropdownProps) == null ? void 0 : w.searchPlaceholder) != null ? A : e.filterRequest ? Y("请输入搜索内容") : (z = he == null ? void 0 : he.filterSearchPlaceholder) != null ? z : Y("搜索"),
|
|
690
|
+
searchValue: De,
|
|
691
|
+
t: Y,
|
|
692
|
+
value: j
|
|
693
|
+
}))
|
|
694
|
+
}), document.body)]
|
|
695
|
+
})]
|
|
696
|
+
});
|
|
697
|
+
return e.badge !== void 0 ? i.jsxs(kl, {
|
|
698
|
+
className: "bj-table__column-tooltip-wrapper",
|
|
699
|
+
children: [i.jsx("div", {
|
|
700
|
+
className: "bj-table__column-tooltip-trigger",
|
|
701
|
+
children: At
|
|
702
|
+
}), dl === x && i.jsx(Kl, {
|
|
703
|
+
className: "bj-table__column-tooltip",
|
|
704
|
+
content: e.badge,
|
|
705
|
+
getAnchorElement: function getAnchorElement() {
|
|
706
|
+
return document.getElementById(R);
|
|
707
|
+
},
|
|
708
|
+
getPopupContainer: function getPopupContainer() {
|
|
709
|
+
return document.body;
|
|
710
|
+
},
|
|
711
|
+
placement: "top"
|
|
712
|
+
})]
|
|
713
|
+
}) : At;
|
|
714
|
+
},
|
|
715
|
+
kt = function kt(e, t, l) {
|
|
716
|
+
var r, s;
|
|
717
|
+
t.selectedRowKeys === void 0 && jt(e);
|
|
718
|
+
var n = new Set(e),
|
|
719
|
+
h = f.filter(function (p, g) {
|
|
720
|
+
return n.has(G(p, g, v));
|
|
721
|
+
});
|
|
722
|
+
(r = t.onChange) == null || r.call(t, e, h), l && ((s = t.onSelect) == null || s.call(t, l, n.has(G(l, f.indexOf(l), v)), h));
|
|
723
|
+
},
|
|
724
|
+
gl = function gl(e, t) {
|
|
725
|
+
if (!o) return;
|
|
726
|
+
var l = G(e, t, v),
|
|
727
|
+
r = B.includes(l),
|
|
728
|
+
s = o.type === "radio" ? r ? [] : [l] : r ? B.filter(function (n) {
|
|
729
|
+
return n !== l;
|
|
730
|
+
}) : [].concat(_toConsumableArray(B), [l]);
|
|
731
|
+
kt(s, o, e);
|
|
732
|
+
},
|
|
733
|
+
Bt = V.filter(function (_ref8) {
|
|
734
|
+
var e = _ref8.record;
|
|
735
|
+
var t;
|
|
736
|
+
return !((t = o == null ? void 0 : o.getCheckboxProps) != null && t.call(o, e).disabled);
|
|
737
|
+
}),
|
|
738
|
+
fe = Bt.map(function (_ref9) {
|
|
739
|
+
var e = _ref9.record,
|
|
740
|
+
t = _ref9.index;
|
|
741
|
+
return G(e, t, v);
|
|
742
|
+
}),
|
|
743
|
+
Me = fe.length > 0 && fe.every(function (e) {
|
|
744
|
+
return B.includes(e);
|
|
745
|
+
}),
|
|
746
|
+
jl = function jl() {
|
|
747
|
+
var e;
|
|
748
|
+
if (!o || o.type === "radio") return;
|
|
749
|
+
var t = new Set(fe),
|
|
750
|
+
l = Me ? B.filter(function (r) {
|
|
751
|
+
return !t.has(r);
|
|
752
|
+
}) : Array.from(new Set([].concat(_toConsumableArray(B), _toConsumableArray(fe))));
|
|
753
|
+
kt(l, o), new Set(l), (e = o.onSelectAll) == null || e.call(o, !Me, Bt.map(function (_ref0) {
|
|
754
|
+
var r = _ref0.record;
|
|
755
|
+
return r;
|
|
756
|
+
}));
|
|
757
|
+
},
|
|
758
|
+
yl = function yl(e) {
|
|
759
|
+
var t;
|
|
760
|
+
!a || e < 1 || e > Dt || e === U || (a.current === void 0 && ge(e), (t = a.onChange) == null || t.call(a, e, W), me("paginate", F, M, e));
|
|
761
|
+
},
|
|
762
|
+
ml = function ml(e) {
|
|
763
|
+
var t, l;
|
|
764
|
+
if (!a || e === W) return;
|
|
765
|
+
var r = 1;
|
|
766
|
+
ke.current = !0, a.pageSize === void 0 && ll(e), a.current === void 0 && ge(r), (t = a.onShowSizeChange) == null || t.call(a, r, e), (l = a.onChange) == null || l.call(a, r, e), me("paginate", F, M, r, e);
|
|
767
|
+
},
|
|
768
|
+
Mt = m.length + (o ? 1 : 0),
|
|
769
|
+
be = (it = o == null ? void 0 : o.columnWidth) != null ? it : 48,
|
|
770
|
+
qt = function qt(e) {
|
|
771
|
+
return typeof e.width == "number" ? e.width : 0;
|
|
772
|
+
},
|
|
773
|
+
zt = function zt(e, t) {
|
|
774
|
+
var l = e.fixed === !0 ? "left" : e.fixed;
|
|
775
|
+
return l === "left" ? {
|
|
776
|
+
position: "sticky",
|
|
777
|
+
left: m.slice(0, t).reduce(function (s, n) {
|
|
778
|
+
return s + qt(n);
|
|
779
|
+
}, o && typeof be == "number" ? be : 0),
|
|
780
|
+
zIndex: 2
|
|
781
|
+
} : l === "right" ? {
|
|
782
|
+
position: "sticky",
|
|
783
|
+
right: m.slice(t + 1).reduce(function (s, n) {
|
|
784
|
+
return s + qt(n);
|
|
785
|
+
}, 0),
|
|
786
|
+
zIndex: 2
|
|
787
|
+
} : {};
|
|
788
|
+
},
|
|
789
|
+
xl = _ != null && _.x ? {
|
|
790
|
+
width: _.x === !0 ? "max-content" : _.x,
|
|
791
|
+
minWidth: "100%",
|
|
792
|
+
tableLayout: ae != null ? ae : "fixed"
|
|
793
|
+
} : {
|
|
794
|
+
tableLayout: ae
|
|
795
|
+
},
|
|
796
|
+
Sl = (st = k == null ? void 0 : k.table) != null ? st : "table",
|
|
797
|
+
Cl = (ot = (at = k == null ? void 0 : k.header) == null ? void 0 : at.wrapper) != null ? ot : "thead",
|
|
798
|
+
wl = (ct = (dt = k == null ? void 0 : k.header) == null ? void 0 : dt.row) != null ? ct : "tr",
|
|
799
|
+
Tt = (ft = (ut = k == null ? void 0 : k.header) == null ? void 0 : ut.cell) != null ? ft : "th",
|
|
800
|
+
le = _typeof(k == null ? void 0 : k.body) == "object" ? k.body : void 0,
|
|
801
|
+
Nl = (bt = le == null ? void 0 : le.wrapper) != null ? bt : "tbody",
|
|
802
|
+
Lt = (_t = le == null ? void 0 : le.row) != null ? _t : "tr",
|
|
803
|
+
qe = (ht = le == null ? void 0 : le.cell) != null ? ht : "td",
|
|
804
|
+
Rl = typeof _e == "function" ? _e() : _e != null ? _e : Y("暂无数据"),
|
|
805
|
+
It = typeof we == "string" ? i.jsx("img", {
|
|
806
|
+
alt: "",
|
|
807
|
+
className: "bj-table__empty-image",
|
|
808
|
+
src: we
|
|
809
|
+
}) : we;
|
|
810
|
+
return i.jsxs("div", {
|
|
811
|
+
id: Yt,
|
|
812
|
+
ref: pt,
|
|
813
|
+
className: L("bj-table", $t && "bj-table--bordered", "bj-table--".concat(Ut), Ce && "bj-table--loading", q.length === 0 && "bj-table--empty", Rt.start && "bj-table--ping-left", Rt.end && "bj-table--ping-right", Qt),
|
|
814
|
+
style: Zt,
|
|
815
|
+
children: [He && i.jsx("div", {
|
|
816
|
+
className: "bj-table__title",
|
|
817
|
+
children: He(q)
|
|
818
|
+
}), i.jsxs("div", {
|
|
819
|
+
className: "bj-table__viewport",
|
|
820
|
+
children: [i.jsx("div", {
|
|
821
|
+
className: L("bj-table__scroll", !!(_ != null && _.x || _ != null && _.y) && "bj-overlay-scrollbar-hidden"),
|
|
822
|
+
ref: Re,
|
|
823
|
+
style: {
|
|
824
|
+
maxHeight: _ == null ? void 0 : _.y
|
|
825
|
+
},
|
|
826
|
+
children: i.jsxs(Sl, {
|
|
827
|
+
className: "bj-table__native-table",
|
|
828
|
+
style: xl,
|
|
829
|
+
children: [m.some(function (e) {
|
|
830
|
+
return e.width;
|
|
831
|
+
}) && i.jsxs("colgroup", {
|
|
832
|
+
children: [o && i.jsx("col", {
|
|
833
|
+
className: "bj-table__selection-col",
|
|
834
|
+
style: {
|
|
835
|
+
width: be
|
|
836
|
+
}
|
|
837
|
+
}), m.map(function (e, t) {
|
|
838
|
+
var l;
|
|
839
|
+
return i.jsx("col", {
|
|
840
|
+
style: {
|
|
841
|
+
width: e.width
|
|
842
|
+
}
|
|
843
|
+
}, (l = e.key) != null ? l : t);
|
|
844
|
+
})]
|
|
845
|
+
}), Ve && i.jsx(Cl, {
|
|
846
|
+
className: "bj-table__header",
|
|
847
|
+
children: gt.map(function (e, t) {
|
|
848
|
+
return i.jsxs(wl, se(T({
|
|
849
|
+
className: "bj-table__header-row"
|
|
850
|
+
}, Je == null ? void 0 : Je(m, t)), {
|
|
851
|
+
children: [o && t === 0 && i.jsxs(Tt, {
|
|
852
|
+
className: L("bj-table__header-cell", "bj-table__selection-cell", !!(_ != null && _.x) && "bj-table__selection-cell--fixed", !!(_ != null && _.x) && !$(m[0]) && "bj-table__cell--fixed-left-last"),
|
|
853
|
+
rowSpan: gt.length,
|
|
854
|
+
scope: "col",
|
|
855
|
+
style: {
|
|
856
|
+
width: be
|
|
857
|
+
},
|
|
858
|
+
children: [o.type !== "radio" && i.jsx(Wt, {
|
|
859
|
+
checked: Me,
|
|
860
|
+
disabled: fe.length === 0,
|
|
861
|
+
onChange: jl,
|
|
862
|
+
label: "选择当前页所有行"
|
|
863
|
+
}), o.columnTitle]
|
|
864
|
+
}), e.map(function (_ref1, n) {
|
|
865
|
+
var l = _ref1.column,
|
|
866
|
+
r = _ref1.colSpan,
|
|
867
|
+
s = _ref1.rowSpan;
|
|
868
|
+
var h, p, g, N;
|
|
869
|
+
var d = l,
|
|
870
|
+
P = m.indexOf(d),
|
|
871
|
+
w = P >= 0 ? P : n,
|
|
872
|
+
z = !("children" in l) && !!(d.filters || d.filterDropdown),
|
|
873
|
+
A = !("children" in l) && !!d.sorter,
|
|
874
|
+
x = function x() {
|
|
875
|
+
z ? xe(d, w) : A && hl(d, w);
|
|
876
|
+
};
|
|
877
|
+
return u.createElement(Tt, se(T({}, (h = d.onHeaderCell) == null ? void 0 : h.call(d, l, n)), {
|
|
878
|
+
"aria-label": typeof d.title == "string" ? d.title : void 0,
|
|
879
|
+
"aria-sort": A ? F.get(C.getColumnKey(d, w)) === "ascend" ? "ascending" : F.get(C.getColumnKey(d, w)) === "descend" ? "descending" : "none" : void 0,
|
|
880
|
+
className: L("bj-table__header-cell", ((p = m[w + 1]) == null ? void 0 : p.fixed) === "right" && "bj-table__cell--before-fixed-right", d.fixed && "bj-table__cell--fixed", $(d) && "bj-table__cell--fixed-left", $(d) && !$(m[w + 1]) && "bj-table__cell--fixed-left-last", te(d) && "bj-table__cell--fixed-right", te(d) && !te(m[w - 1]) && "bj-table__cell--fixed-right-first", d.sorter && "bj-table__header-cell--sortable", z && "bj-table__header-cell--filterable", F.get(C.getColumnKey(d, w)) && "bj-table__header-cell--sorted", d.className),
|
|
881
|
+
colSpan: r,
|
|
882
|
+
key: (N = d.key) != null ? N : String((g = d.dataIndex) != null ? g : n),
|
|
883
|
+
onClick: function onClick(R) {
|
|
884
|
+
var E, D, j;
|
|
885
|
+
(j = (D = (E = d.onHeaderCell) == null ? void 0 : E.call(d, l, n)) == null ? void 0 : D.onClick) == null || j.call(D, R), !R.target.closest(".bj-table__filter-dropdown") && (z ? xe(d, w, R.currentTarget) : x());
|
|
886
|
+
},
|
|
887
|
+
onKeyDown: function onKeyDown(R) {
|
|
888
|
+
var E, D, j;
|
|
889
|
+
(j = (D = (E = d.onHeaderCell) == null ? void 0 : E.call(d, l, n)) == null ? void 0 : D.onKeyDown) == null || j.call(D, R), !R.target.closest(".bj-table__filter-dropdown") && (R.key === "Enter" || R.key === " ") && (R.preventDefault(), z ? xe(d, w, R.currentTarget) : x());
|
|
890
|
+
},
|
|
891
|
+
rowSpan: s,
|
|
892
|
+
scope: "col",
|
|
893
|
+
style: T({
|
|
894
|
+
textAlign: d.align
|
|
895
|
+
}, zt(d, w)),
|
|
896
|
+
tabIndex: z || A ? 0 : void 0
|
|
897
|
+
}), "children" in l ? C.renderColumnTitle(l.title, {
|
|
898
|
+
filters: Object.fromEntries(M)
|
|
899
|
+
}) : pl(d, w));
|
|
900
|
+
})]
|
|
901
|
+
}), t);
|
|
902
|
+
})
|
|
903
|
+
}), i.jsx(Nl, {
|
|
904
|
+
className: "bj-table__body",
|
|
905
|
+
children: V.length > 0 ? V.map(function (_ref10) {
|
|
906
|
+
var e = _ref10.record,
|
|
907
|
+
t = _ref10.index;
|
|
908
|
+
var l, r, s;
|
|
909
|
+
var n = G(e, t, v),
|
|
910
|
+
h = ue(e, t),
|
|
911
|
+
p = (r = (l = o == null ? void 0 : o.getCheckboxProps) == null ? void 0 : l.call(o, e).disabled) != null ? r : !1,
|
|
912
|
+
g = B.includes(n),
|
|
913
|
+
N = typeof Ne == "function" ? Ne(e, t, 0) : Ne;
|
|
914
|
+
return u.createElement(Lt, se(T({}, Ue == null ? void 0 : Ue(e, t)), {
|
|
915
|
+
className: L("bj-table__row", h && "bj-table__row--group", g && "bj-table__row--selected", N),
|
|
916
|
+
key: n
|
|
917
|
+
}), o && !h && i.jsx(qe, {
|
|
918
|
+
className: L("bj-table__cell", "bj-table__selection-cell", !!(_ != null && _.x) && "bj-table__selection-cell--fixed", !!(_ != null && _.x) && !$(m[0]) && "bj-table__cell--fixed-left-last"),
|
|
919
|
+
style: {
|
|
920
|
+
width: be
|
|
921
|
+
},
|
|
922
|
+
children: i.jsx(Wt, {
|
|
923
|
+
checked: g,
|
|
924
|
+
disabled: p,
|
|
925
|
+
label: "\u9009\u62E9\u7B2C ".concat(t + 1, " \u884C"),
|
|
926
|
+
name: o.type === "radio" ? "bj-table-row-selection" : void 0,
|
|
927
|
+
onChange: function onChange() {
|
|
928
|
+
return gl(e, t);
|
|
929
|
+
},
|
|
930
|
+
type: (s = o.type) != null ? s : "checkbox"
|
|
931
|
+
})
|
|
932
|
+
}), m.map(function (d, P) {
|
|
933
|
+
var w, z, A, x, R, E, D;
|
|
934
|
+
if (h && P > 0) return null;
|
|
935
|
+
var j = d,
|
|
936
|
+
ne = Ul(e, j.dataIndex),
|
|
937
|
+
X = j.render ? j.render(ne, e, t) : ne,
|
|
938
|
+
re = Ql(X) ? X : void 0,
|
|
939
|
+
J = T(T({}, (w = j.onCell) == null ? void 0 : w.call(j, e, t)), re == null ? void 0 : re.props),
|
|
940
|
+
ie = re ? re.children : X;
|
|
941
|
+
return J.colSpan === 0 || J.rowSpan === 0 ? null : u.createElement(qe, se(T({}, J), {
|
|
942
|
+
className: L("bj-table__cell", ((z = m[P + 1]) == null ? void 0 : z.fixed) === "right" && "bj-table__cell--before-fixed-right", h && "bj-table__cell--group", j.fixed && "bj-table__cell--fixed", $(j) && "bj-table__cell--fixed-left", $(j) && !$(m[P + 1]) && "bj-table__cell--fixed-left-last", te(j) && "bj-table__cell--fixed-right", te(j) && !te(m[P - 1]) && "bj-table__cell--fixed-right-first", j.ellipsis && "bj-table__cell--ellipsis", j.className, J.className),
|
|
943
|
+
key: (x = j.key) != null ? x : String((A = j.dataIndex) != null ? A : P),
|
|
944
|
+
colSpan: h ? Mt : J.colSpan,
|
|
945
|
+
style: T(T({
|
|
946
|
+
textAlign: j.align
|
|
947
|
+
}, zt(j, P)), J.style)
|
|
948
|
+
}), h ? (D = (E = (R = y == null ? void 0 : y.render) == null ? void 0 : R.call(y, {
|
|
949
|
+
record: e,
|
|
950
|
+
expanded: Z.includes(ye(e, t)),
|
|
951
|
+
onToggle: function onToggle() {
|
|
952
|
+
return fl(e, t);
|
|
953
|
+
}
|
|
954
|
+
})) != null ? E : ie) != null ? D : "" : i.jsx("div", {
|
|
955
|
+
className: "bj-table__cell-content",
|
|
956
|
+
children: ie != null ? ie : ""
|
|
957
|
+
}));
|
|
958
|
+
}));
|
|
959
|
+
}) : i.jsx(Lt, {
|
|
960
|
+
className: "bj-table__empty-row",
|
|
961
|
+
children: i.jsx(qe, {
|
|
962
|
+
className: "bj-table__empty-cell",
|
|
963
|
+
colSpan: Math.max(Mt, 1),
|
|
964
|
+
style: {
|
|
965
|
+
height: Jt
|
|
966
|
+
}
|
|
967
|
+
})
|
|
968
|
+
})
|
|
969
|
+
}), $e && i.jsx("tfoot", {
|
|
970
|
+
className: "bj-table__summary",
|
|
971
|
+
children: $e(q)
|
|
972
|
+
})]
|
|
973
|
+
})
|
|
974
|
+
}), V.length === 0 && i.jsx("div", {
|
|
975
|
+
className: "bj-table__empty-overlay",
|
|
976
|
+
children: i.jsxs("div", {
|
|
977
|
+
className: "bj-table__empty-content",
|
|
978
|
+
children: [It && i.jsx("div", {
|
|
979
|
+
className: "bj-table__empty-image-wrap",
|
|
980
|
+
children: It
|
|
981
|
+
}), i.jsx("div", {
|
|
982
|
+
className: "bj-table__empty-text",
|
|
983
|
+
children: Rl
|
|
984
|
+
})]
|
|
985
|
+
})
|
|
986
|
+
})]
|
|
987
|
+
}), ((_ == null ? void 0 : _.x) || (_ == null ? void 0 : _.y)) && i.jsx(ql, {
|
|
988
|
+
containerRef: pt,
|
|
989
|
+
direction: _ != null && _.x && _ != null && _.y ? "both" : _ != null && _.x ? "horizontal" : "vertical",
|
|
990
|
+
gap: 2,
|
|
991
|
+
horizontalInsetEnd: wt.end,
|
|
992
|
+
horizontalInsetStart: wt.start,
|
|
993
|
+
size: 4,
|
|
994
|
+
targetRef: Re
|
|
995
|
+
}), We && i.jsx("div", {
|
|
996
|
+
className: "bj-table__footer",
|
|
997
|
+
children: We(q)
|
|
998
|
+
}), Ce && i.jsxs("div", {
|
|
999
|
+
"aria-live": "polite",
|
|
1000
|
+
"aria-busy": "true",
|
|
1001
|
+
className: "bj-table__loading",
|
|
1002
|
+
role: "status",
|
|
1003
|
+
children: [i.jsx("img", {
|
|
1004
|
+
alt: "",
|
|
1005
|
+
className: "bj-table__loading-indicator",
|
|
1006
|
+
src: zl
|
|
1007
|
+
}), i.jsx("span", {
|
|
1008
|
+
className: "bj-table__loading-text",
|
|
1009
|
+
children: "加载中..."
|
|
1010
|
+
})]
|
|
1011
|
+
}), a && q.length > 0 && i.jsx("div", {
|
|
1012
|
+
className: "bj-table__pagination",
|
|
1013
|
+
children: i.jsx(Fl, {
|
|
1014
|
+
align: "end",
|
|
1015
|
+
disabled: !!Ce || a.disabled,
|
|
1016
|
+
current: U,
|
|
1017
|
+
defaultCurrent: a.defaultCurrent,
|
|
1018
|
+
defaultPageSize: a.defaultPageSize,
|
|
1019
|
+
dropdownClassName: a.dropdownClassName,
|
|
1020
|
+
hideOnSinglePage: a.hideOnSinglePage,
|
|
1021
|
+
onChange: function onChange(e) {
|
|
1022
|
+
if (ke.current) {
|
|
1023
|
+
ke.current = !1;
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
yl(e);
|
|
1027
|
+
},
|
|
1028
|
+
onShowSizeChange: function onShowSizeChange(e, t) {
|
|
1029
|
+
return ml(t);
|
|
1030
|
+
},
|
|
1031
|
+
pageSize: W,
|
|
1032
|
+
pageSizeOptions: a.pageSizeOptions,
|
|
1033
|
+
popupPlacement: a.popupPlacement,
|
|
1034
|
+
resolvePopupPlacement: a.resolvePopupPlacement,
|
|
1035
|
+
showQuickJumper: a.showQuickJumper,
|
|
1036
|
+
showSizeChanger: a.showSizeChanger,
|
|
1037
|
+
showTotal: a.showTotal,
|
|
1038
|
+
simple: a.simple,
|
|
1039
|
+
size: a.size,
|
|
1040
|
+
t: (vt = a.t) != null ? vt : Y,
|
|
1041
|
+
total: Ot
|
|
1042
|
+
})
|
|
1043
|
+
})]
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
var Ie = Xl;
|
|
1047
|
+
Ie.Column = Ll;
|
|
1048
|
+
Ie.ColumnGroup = Il;
|
|
1049
|
+
exports.BTable = Ie;
|