aha-components 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Table.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=function(){return t=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function i(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(t[i[o]]=e[i[o]])}return t}function o(e,n,t){if(t||2===arguments.length)for(var i,o=0,r=n.length;o<r;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return e.concat(i||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={primaryColor:"#FB6011"},l=n.createContext(r),a=function(){var e=n.useContext(l);return e||r},d={small:{height:"32px",paddingLeft:"12px",paddingRight:"12px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},mediumSmall:{height:"36px",paddingLeft:"14px",paddingRight:"14px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},medium:{height:"40px",paddingLeft:"16px",paddingRight:"16px",fontSize:"14px",lineHeight:"20px",iconSize:"18px",gap:"8px"},large:{height:"48px",paddingLeft:"20px",paddingRight:"20px",fontSize:"16px",lineHeight:"24px",iconSize:"20px",gap:"8px"}},s=function(n){var t=n.size,i=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes aha-button-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",style:{animation:"aha-button-spin 1s linear infinite"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"24",opacity:"0.3"}),e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"16"})]})]})},c=function(o){var r,l=o.children,c=o.type,u=void 0===c?"default":c,p=o.size,x=void 0===p?"medium":p,f=o.disabled,h=void 0!==f&&f,g=o.loading,m=void 0!==g&&g,v=o.onClick,y=o.htmlType,b=void 0===y?"button":y,w=o.className,j=void 0===w?"":w,k=o.style,C=o.icon,S=o.iconPosition,F=void 0===S?"left":S,A=i(o,["children","type","size","disabled","loading","onClick","htmlType","className","style","icon","iconPosition"]),E=a().primaryColor,z=void 0===E?"#FB6011":E,W=n.useState(!1),L=W[0],I=W[1],M=n.useState(!1),N=M[0],R=M[1],D=d[x],B=h||m,H=function(){if(m){var n="primary"===u?"#FFFFFF":"#101828",t=parseInt(D.iconSize.replace("px",""));return e.jsx(s,{size:t,color:n})}return C?e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:D.iconSize,height:D.iconSize,flexShrink:0},children:C}):null},P=(r=t({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:D.gap,height:D.height,paddingLeft:D.paddingLeft,paddingRight:D.paddingRight,fontSize:D.fontSize,lineHeight:D.lineHeight,fontWeight:500,fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"none",cursor:B?"not-allowed":"pointer",outline:"none",transition:"all 0.2s",userSelect:"none",WebkitTapHighlightColor:"transparent"},k),"primary"===u?(r.color="#FFFFFF",r.backgroundColor=z,h?(r.opacity=.4,r.cursor="not-allowed"):m?r.backgroundColor=z:N?r.backgroundColor="#EC470A":L&&(r.backgroundColor="#FD843A")):h?(r.backgroundColor="#FAFAF9",r.color="#D6D3D1",r.border="1px solid #E7E5E4"):m?(r.backgroundColor="#FFFFFF",r.color="#101828",r.border="1px solid #E7E5E4",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):N?(r.backgroundColor="#F5F5F4",r.color="#101828",r.border="1px solid #D7D3D0",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):L?(r.backgroundColor="#FAFAF9",r.color="#101828",r.border="1px solid #D7D3D0",r.boxShadow="0px 2px 4px 0px rgba(12, 10, 9, 0.08)"):(r.backgroundColor="#FFFFFF",r.color="#101828",r.border="1px solid #E7E5E4",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"),r);return e.jsxs("button",t({type:b,className:"aha-button aha-button--".concat(u," aha-button--").concat(x," ").concat(B?"aha-button--disabled":""," ").concat(m?"aha-button--loading":""," ").concat(j),disabled:B,onClick:function(e){B?e.preventDefault():null==v||v(e)},onMouseEnter:function(){return!B&&I(!0)},onMouseLeave:function(){I(!1),R(!1)},onMouseDown:function(){return!B&&R(!0)},onMouseUp:function(){return R(!1)},style:P},A,{children:[m&&H(),!m&&"left"===F&&H(),l&&e.jsx("span",{style:{display:"inline-block"},children:l}),!m&&"right"===F&&H()]}))};c.displayName="Button";var u=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},p=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M3.5 7H10.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},x=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},f=function(n){var t=n.className,i=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:[e.jsx("path",{d:"M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},h=function(n){var t=n.className,i=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:[e.jsx("path",{d:"M8.5 7.5L6 10L3.5 7.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8.5 4.5L6 2L3.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},g=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},m=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},v=function(i){var o=i.current,r=i.defaultCurrent,l=void 0===r?1:r,d=i.total,s=void 0===d?0:d,u=i.pageSize,p=i.defaultPageSize,x=void 0===p?10:p,f=i.showSizeChanger,h=void 0!==f&&f,v=i.pageSizeOptions,y=void 0===v?["10","20","50","100"]:v,b=i.showQuickJumper,w=void 0!==b&&b,j=i.showTotal,k=i.onChange,C=i.onShowSizeChange,S=i.simple,F=void 0!==S&&S,A=i.disabled,E=void 0!==A&&A,z=i.hideOnSinglePage,W=void 0!==z&&z,L=i.className,I=void 0===L?"":L,M=i.style,N=i.size,R=void 0===N?"default":N,D=i.responsive,B=void 0!==D&&D;i.showLessItems;var H=i.itemRender,P=a().primaryColor,O=void 0===P?"#FB6011":P,T=n.useState(l),K=T[0],J=T[1],Q=n.useState(x),_=Q[0],q=Q[1],U=n.useState(""),X=U[0],Y=U[1],G=null!=o?o:K,V=null!=u?u:_,Z=n.useMemo(function(){return Math.ceil(s/V)},[s,V]);n.useEffect(function(){void 0!==o&&J(o)},[o]),n.useEffect(function(){void 0!==u&&q(u)},[u]);var $=function(e){e<1||e>Z||e===G||E||(void 0===o&&J(e),null==k||k(e,V))},ee=function(){var e=parseInt(X,10);e>=1&&e<=Z&&($(e),Y(""))};if(W&&Z<=1)return null;if(F)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(I),style:M,children:[e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"上一页"}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[G," / ",Z]}),e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"下一页"})]});var ne=(G-1)*V+1,te=Math.min(G*V,s);return e.jsxs("div",{className:"aha-pagination w-full ".concat(I),style:t({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:B?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},M),children:[j&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:j(s,[ne,te])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[H?H(G-1,"prev",e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{})," ",e.jsx("span",{children:"Previous"})]})})):e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{})," ",e.jsx("span",{children:"Previous"})]})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:0},children:function(){if(Z<=7)return Array.from({length:Z},function(e,n){return n+1});var e=[];if(G<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(Z)}else if(G>=Z-3){e.push(1),e.push("jump-prev");for(n=Z-4;n<=Z;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=G-1;n<=G+1;n++)e.push(n);e.push("jump-next"),e.push(Z)}return e}().map(function(n,t){return function(n){if("number"==typeof n){var t=n===G,i=e.jsx(c,{onClick:function(){return $(n)},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,fontWeight:t?500:400,border:"none",background:t?"#FAFAF9":"white",backgroundColor:t?"#FAFAF9":"white",color:t?O:"#79716B",boxShadow:"none",borderRadius:"8px"},children:n},n);return H?H(n,"page",i):i}if("jump-prev"===n)return i=e.jsx(c,{onClick:function(){return $(Math.max(1,G-5))},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),H?H(G-5,"jump-prev",i):i;if("jump-next"===n)return i=e.jsx(c,{onClick:function(){return $(Math.min(Z,G+5))},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),H?H(G+5,"jump-next",i):i;return null}(n)})}),H?H(G+1,"next",e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Next"})," ",e.jsx(m,{})]})})):e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Next"})," ",e.jsx(m,{})]})}),h&&e.jsx("select",{value:V,onChange:function(e){return n=Number(e.target.value),t=Math.ceil(s/n),i=G>t?t:G,void 0===u&&q(n),void 0===o&&J(i),null==C||C(i,n),void(null==k||k(i,n));var n,t,i},disabled:E,style:{padding:"small"===R?"6px 12px":"8px 12px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"small"===R?"12px":"14px",lineHeight:"small"===R?"18px":"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",cursor:E?"not-allowed":"pointer",backgroundColor:"white",outline:"none",transition:"all 0.2s"},onMouseEnter:function(e){E||(e.currentTarget.style.borderColor=O)},onMouseLeave:function(e){e.currentTarget.style.borderColor="#EAECF0"},children:y.map(function(n){return e.jsxs("option",{value:n,children:[n," 条/页"]},n)})}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"跳至"}),e.jsx("input",{type:"number",min:"1",value:X,onChange:function(e){return Y(e.target.value)},onKeyPress:function(e){return"Enter"===e.key&&ee()},disabled:E,style:{width:"56px",height:"small"===R?"28px":"36px",padding:"0 8px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",outline:"none",transition:"all 0.2s"},onFocus:function(e){e.currentTarget.style.borderColor=O},onBlur:function(e){e.currentTarget.style.borderColor="#EAECF0"}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"页"}),"object"==typeof w&&w.goButton?e.jsx(c,{onClick:ee,disabled:E,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:w.goButton}):e.jsx(c,{onClick:ee,disabled:E,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"确定"})]})]})]})},y=function(n){var i=n.checked,o=void 0!==i&&i,r=n.indeterminate,l=void 0!==r&&r,d=n.disabled,s=void 0!==d&&d,c=n.onChange,x=n.className,f=void 0===x?"":x,h=n.style,g=n.children,m=a().primaryColor,v=o||l,y=s?"#FAFAF9":v?m:"white",b=s?"#FAFAF9":v?m:"#D7D3D0";return e.jsxs("div",{className:"aha-checkbox ".concat(f),style:t({display:"inline-flex",alignItems:"center",gap:"8px",cursor:s?"not-allowed":"pointer"},h),onClick:function(e){s||(null==c||c({target:{checked:!o},currentTarget:{checked:!o}}))},children:[e.jsx("div",{style:{position:"relative",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",borderRadius:"4px",border:"1px solid ".concat(b),backgroundColor:y,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",flexShrink:0,boxSizing:"border-box"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",opacity:v?1:0,transition:"opacity 0.2s",pointerEvents:"none"},children:l?e.jsx(p,{style:{width:"14px",height:"14px",display:"block"}}):e.jsx(u,{style:{width:"14px",height:"14px",display:"block"}})})}),g&&e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:s?"#98A2B3":"#101828",fontFamily:"DM Sans, sans-serif"},children:g}),e.jsx("input",{type:"checkbox",checked:o,ref:function(e){e&&(e.indeterminate=l)},onChange:c,disabled:s,style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"},"aria-hidden":"true"})]})};y.displayName="Checkbox";var b=function(e,n){return"string"==typeof n?null==e?void 0:e[n]:n.reduce(function(e,n){return null==e?void 0:e[n]},e)},w=function(e,n){var t,i;return"function"==typeof n?n(e):"string"==typeof n?null!==(t=b(e,n))&&void 0!==t?t:"":null!==(i=e.key)&&void 0!==i?i:""},j=function(n){var t=n.order,i=a().primaryColor;return"ascend"===t?e.jsx(h,{style:{color:i}}):"descend"===t?e.jsx(f,{style:{color:i}}):e.jsx(x,{})};exports.default=function(r){var l,a,d,s,c=r.columns,u=void 0===c?[]:c,p=r.dataSource,x=void 0===p?[]:p,f=r.rowKey,h=void 0===f?"key":f,g=r.rowSelection,m=r.pagination,k=void 0!==m&&m,C=r.size,S=void 0===C?"middle":C,F=r.bordered,A=void 0!==F&&F;r.loading;var E=r.locale,z=r.showHeader,W=void 0===z||z,L=r.title,I=r.footer,M=r.summary,N=r.scroll,R=r.tableLayout,D=void 0===R?"auto":R,B=r.onChange,H=r.onSorterChange,P=r.onPaginationChange,O=r.onRow,T=r.className,K=void 0===T?"":T,J=r.style,Q=r.expandable,_=r.rowClassName,q=r.onHeaderRow;r.sticky;var U=i(r,["columns","dataSource","rowKey","rowSelection","pagination","size","bordered","loading","locale","showHeader","title","footer","summary","scroll","tableLayout","onChange","onSorterChange","onPaginationChange","onRow","className","style","expandable","rowClassName","onHeaderRow","sticky"]),X=n.useState((null==g?void 0:g.selectedRowKeys)||(null==g?void 0:g.defaultSelectedRowKeys)||[]),Y=X[0],G=X[1];n.useEffect(function(){void 0!==(null==g?void 0:g.selectedRowKeys)&&G(g.selectedRowKeys)},[null==g?void 0:g.selectedRowKeys]);var V=n.useState(new Map),Z=V[0],$=V[1],ee=n.useState((null==Q?void 0:Q.defaultExpandedRowKeys)||[]),ne=ee[0],te=ee[1],ie=n.useState(k&&"object"==typeof k&&(k.current||k.defaultCurrent)||1),oe=ie[0],re=ie[1],le=n.useState(k&&"object"==typeof k&&(k.pageSize||k.defaultPageSize)||10),ae=le[0],de=le[1];n.useEffect(function(){k&&"object"==typeof k&&(void 0!==k.current&&re(k.current),void 0!==k.pageSize&&de(k.pageSize))},[k]);var se=n.useState(null),ce=se[0],ue=se[1],pe=n.useState(null),xe=pe[0],fe=pe[1],he=n.useState(!1),ge=he[0],me=he[1],ve=n.useRef(null),ye=n.useRef(null);n.useEffect(function(){var e=function(){me(window.innerWidth<768)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var be=n.useCallback(function(e,n){var t,i,r,l=null===(t=null==g?void 0:g.getCheckboxProps)||void 0===t?void 0:t.call(g,e);if(!(null==l?void 0:l.disabled)){var a,d=w(e,h);a="radio"===(null==g?void 0:g.type)?n?[d]:[]:n?o(o([],Y,!0),[d],!1):Y.filter(function(e){return e!==d}),G(a);var s=x.filter(function(e){return a.includes(w(e,h))});null===(i=null==g?void 0:g.onChange)||void 0===i||i.call(g,a,s),null===(r=null==g?void 0:g.onSelect)||void 0===r||r.call(g,e,n,s,new Event("select"))}},[Y,h,g,x]),we=n.useCallback(function(e,n){var t,i,o=n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}).map(function(e){return w(e,h)}),r=e?o:[];G(r);var l=x.filter(function(e){return r.includes(w(e,h))}),a=e?n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}):[];null===(t=null==g?void 0:g.onChange)||void 0===t||t.call(g,r,l),null===(i=null==g?void 0:g.onSelectAll)||void 0===i||i.call(g,e,l,a)},[h,g,x]),je=n.useCallback(function(e,n){var t=e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex);if(t){var i=new Map(Z);null===n?i.delete(t):i.set(t,n),$(i);var o=Array.from(i.entries()).map(function(n){var t=n[0],i=n[1];return{column:u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t})||e,order:i,field:t,columnKey:t}}),r={column:e,order:n,field:t,columnKey:t};e.onSorterChange&&e.onSorterChange(r),H&&H(1===o.length?o[0]:o),B&&B({current:oe,pageSize:ae},{},1===o.length?o[0]:o,{currentDataSource:x,action:"sort"})}},[Z,B,H,oe,ae,x,u]);n.useCallback(function(e,n){var t,i,r,l=w(e,h);r=n?o(o([],ne,!0),[l],!1):ne.filter(function(e){return e!==l}),te(r),null===(t=null==Q?void 0:Q.onExpand)||void 0===t||t.call(Q,n,e),null===(i=null==Q?void 0:Q.onExpandedRowsChange)||void 0===i||i.call(Q,r)},[ne,h,Q]);var ke=n.useCallback(function(){var e=o([],x,!0);return Z.size>0&&e.sort(function(e,n){for(var t=function(t,i){var o=u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t});if(!o)return"continue";var r=0;if("function"==typeof o.sorter)r=o.sorter(e,n);else if(!0===o.sorter){var l=b(e,o.dataIndex||t),a=b(n,o.dataIndex||t);l<a?r=-1:l>a&&(r=1)}return 0!==r?{value:"ascend"===i?r:-r}:void 0},i=0,o=Array.from(Z.entries());i<o.length;i++){var r=o[i],l=t(r[0],r[1]);if("object"==typeof l)return l.value}return 0}),e},[x,Z,u]),Ce=ke(),Se=n.useMemo(function(){if(!1===k||!k)return Ce;var e=(oe-1)*ae,n=e+ae;return Ce.slice(e,n)},[Ce,oe,ae,k]),Fe=n.useCallback(function(e,n){var t,i,o=null!=n?n:ae;if(re(e),n&&de(n),P&&P(e,o),k&&"object"==typeof k&&(null===(t=k.onChange)||void 0===t||t.call(k,e,n),n&&(null===(i=k.onShowSizeChange)||void 0===i||i.call(k,e,n))),B){var r=Array.from(Z.entries()).map(function(e){var n=e[0],t=e[1];return{column:u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===n}),order:t,field:n,columnKey:n}});B({current:e,pageSize:o},{},1===r.length?r[0]:r,{currentDataSource:Ce,action:"paginate"})}},[k,P,B,ae,Z,u,Ce]),Ae=n.useCallback(function(e,n,t){var i=b(n,e.dataIndex||"");return e.render?e.render(i,n,t):i},[]),Ee=n.useCallback(function(e,n,t){if(n){var i=!0===n?"left":n,o=0;if("left"===i){if(g&&("left"===g.fixed||!0===g.fixed))o+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;for(var r=0;r<e;r++){if("left"===(l=u[r]).fixed||!0===l.fixed)o+=l.width?"number"==typeof l.width?l.width:parseInt(l.width)||0:150}return o}if("right"===i){for(r=e+1;r<u.length;r++){var l;if("right"===(l=u[r]).fixed)o+=l.width?"number"==typeof l.width?l.width:parseInt(l.width)||0:150}if(g&&"right"===g.fixed)o+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;return o}}},[u,g]),ze=n.useCallback(function(){if(!W)return null;var n,i,o,r,l=u.map(function(n,i){var o,r=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||i,l=Z.get(r)||null,a=Ee(i,n.fixed,!0),d=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("th",t({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:{width:d,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:d||void 0,maxWidth:d,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==a?"".concat(a,"px"):"0":void 0,right:"right"===n.fixed?void 0!==a?"".concat(a,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:(n.fixed,"#F9FAFB"),boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"12px 16px",textAlign:n.align||"left",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif"}},(null===(o=n.onHeaderCell)||void 0===o?void 0:o.call(n,n))||{},{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",justifyContent:"right"===n.align?"flex-end":"center"===n.align?"center":"flex-start"},children:[e.jsx("span",{style:{fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467"},children:"function"==typeof n.title?n.title({sortOrder:l,sortColumn:n}):n.title}),n.sorter&&e.jsx("button",{onClick:function(){je(n,null===l?"ascend":"ascend"===l?"descend":null)},style:{border:"none",background:"none",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px",color:l?"#475467":"#98A2B3"},children:e.jsx(j,{order:l||void 0})})]})}),r)});if(g){var a="number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",d=e.jsx("th",{style:{width:a,position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"#F9FAFB",padding:"12px 16px",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[!g.hideSelectAll&&"radio"!==g.type&&(n=Se.filter(function(e){var n;return!(null===(n=g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}),i=n.map(function(e){return w(e,h)}),o=n.length>0&&i.every(function(e){return Y.includes(e)}),r=i.some(function(e){return Y.includes(e)}),e.jsx(y,{checked:o,indeterminate:r&&!o,onChange:function(e){return we(e.target.checked,Se)}})),g.columnTitle&&e.jsx("span",{style:{marginLeft:g.hideSelectAll?0:"8px"},children:g.columnTitle})]})},"selection");l.unshift(d)}var s=null==q?void 0:q(u,0);return e.jsx("thead",{ref:ye,children:e.jsx("tr",t({},s||{},{children:l}))})},[u,W,Z,g,Y,Se,h,je,we,E,q,Ee]),We=n.useCallback(function(e){ue(e)},[]),Le=n.useCallback(function(e,n){e.preventDefault(),fe(n)},[]),Ie=n.useCallback(function(e,n){if(e.preventDefault(),null===ce||ce===n)return ue(null),void fe(null);var t=o([],Se,!0),i=t[ce];t.splice(ce,1),t.splice(n,0,i),ue(null),fe(null)},[ce,Se]),Me=n.useCallback(function(){ue(null),fe(null)},[]),Ne=n.useCallback(function(){return Se.map(function(i,o){var r,l=w(i,h),a=Y.includes(l),d=ne.includes(l),s=(null==O?void 0:O(i,o))||{},c=o===Se.length-1;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",t({className:"".concat("function"==typeof _?_(i,o):_||""," ").concat(ce===o?"dragging":""," ").concat(xe===o?"drag-over":""),draggable:!0,onDragStart:function(){return We(o)},onDragOver:function(e){return Le(e,o)},onDrop:function(e){return Ie(e,o)},onDragEnd:Me,style:t({cursor:"move",opacity:ce===o?.5:1,backgroundColor:xe===o?"#F9FAFB":"white",transition:"background-color 0.2s"},s.style),onMouseEnter:function(e){ce!==o&&xe!==o&&(e.currentTarget.style.backgroundColor="#F9FAFB")},onMouseLeave:function(e){ce!==o&&xe!==o&&(e.currentTarget.style.backgroundColor="white")}},s,{children:[g&&e.jsx("td",{style:{width:"number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"white",padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",textAlign:"center"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y,{checked:a,onChange:function(e){return be(i,e.target.checked)},disabled:null===(r=g.getCheckboxProps)||void 0===r?void 0:r.call(g,i).disabled})})}),u.map(function(n,r){var l,a=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||r,d=(null===(l=n.onCell)||void 0===l?void 0:l.call(n,i,o))||{},s=Ee(r,n.fixed,!1),u=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("td",t({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:t({width:u,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:u||void 0,maxWidth:u,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,right:"right"===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:"white",boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",textAlign:n.align||"left"},d.style),colSpan:n.colSpan,rowSpan:n.rowSpan},d,{children:Ae(n,i,o)}),a)})]})),(null==Q?void 0:Q.expandedRowRender)&&d&&e.jsx("tr",{children:e.jsx("td",{colSpan:u.length+(g?1:0),children:Q.expandedRowRender(i,o,0,!0)})})]},l)})},[Se,h,Y,ne,g,u,O,_,be,Ae,Q,ce,xe,We,Le,Ie,Me,Ee]),Re=function(){var n;if(!1===k||!k)return null;var t=null!==(n=k.total)&&void 0!==n?n:Ce.length,i=k.position||"bottomRight";return e.jsx("div",{style:{marginTop:"16px",display:"flex",justifyContent:i.includes("Right")?"flex-end":i.includes("Left")?"flex-start":"center"},children:e.jsx(v,{current:oe,total:t,pageSize:ae,showSizeChanger:k.showSizeChanger,pageSizeOptions:k.pageSizeOptions,showQuickJumper:k.showQuickJumper,showTotal:k.showTotal,onChange:Fe,onShowSizeChange:Fe,simple:k.simple,responsive:k.responsive,size:"small"===S?"small":"default"})})},De=n.useMemo(function(){return u.some(function(e){return e.fixed})||g&&g.fixed},[u,g]),Be=n.useMemo(function(){return u.every(function(e){return e.width})&&(!g||g.columnWidth)},[u,g]),He=n.useMemo(function(){if(null==N?void 0:N.x){if("number"==typeof N.x)return N.x;if(!0===N.x)return u.reduce(function(e,n){return e+(n.width?"number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0:150)},0)+(g?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth||"60").replace("px",""))||60:0)}if(De)return u.reduce(function(e,n){return n.fixed&&n.width?e+("number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0):e},0)+(g&&g.fixed&&g.columnWidth?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth).replace("px",""))||60:0)},[u,null==N?void 0:N.x,g,De]),Pe=n.useMemo(function(){return"fixed"===D||De||Be||u.some(function(e){return e.width})?"fixed":D},[D,De,Be,u]),Oe={width:"100%",minWidth:He?"".concat(He,"px"):"100%",borderCollapse:"separate",borderSpacing:0,tableLayout:Pe,backgroundColor:"white",borderRadius:"8px",border:"1px solid #EAECF0"},Te=t({position:"relative",width:"100%",maxWidth:"100%",maxHeight:"number"==typeof(null==N?void 0:N.y)?"".concat(N.y,"px"):void 0,borderRadius:"8px"},J);if(ge)return e.jsxs("div",t({ref:ve,className:"aha-table aha-table-mobile-wrapper ".concat(K),style:Te},U,{children:[L&&e.jsx("div",{style:{marginBottom:"16px"},children:L(Ce)}),k&&"object"==typeof k&&(null===(l=k.position)||void 0===l?void 0:l.startsWith("top"))&&Re(),e.jsx("div",{className:"aha-table-mobile",children:Se.map(function(n,t){var i,o=w(n,h),r=Y.includes(o);return e.jsxs("div",{className:"aha-table-mobile-row ".concat(r?"selected":""),style:{border:"1px solid #e8e8e8",borderRadius:"4px",padding:"12px",marginBottom:"12px",backgroundColor:r?"#e6f7ff":"white"},children:[g&&e.jsx("div",{style:{marginBottom:"8px"},children:e.jsx(y,{checked:r,onChange:function(e){return be(n,e.target.checked)},disabled:null===(i=g.getCheckboxProps)||void 0===i?void 0:i.call(g,n).disabled})}),u.map(function(i){var o=i.key||(Array.isArray(i.dataIndex)?i.dataIndex.join("."):i.dataIndex),r=b(n,i.dataIndex||""),l=i.render?i.render(r,n,t):r;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("span",{style:{fontWeight:"bold",color:"#666"},children:["function"==typeof i.title?i.title({}):i.title,":"]}),e.jsx("span",{style:{flex:1,textAlign:"right"},children:l})]},o)})]},o)})}),I&&e.jsx("div",{style:{marginTop:"16px"},children:I(Ce)}),k&&("object"!=typeof k||!(null===(a=k.position)||void 0===a?void 0:a.startsWith("top")))&&Re()]}));var Ke={position:"relative",overflowX:(null==N?void 0:N.x)||De?"auto":"visible",overflowY:(null==N?void 0:N.y)?"auto":"visible",width:"100%",maxWidth:!0===(null==N?void 0:N.x)?"100%":"number"==typeof(null==N?void 0:N.x)?"".concat(N.x,"px"):void 0,maxHeight:"number"==typeof(null==N?void 0:N.y)?"".concat(N.y,"px"):void 0,borderRadius:"8px"};return e.jsxs("div",t({ref:ve,className:"aha-table ".concat(K),style:Te},U,{children:[L&&e.jsx("div",{style:{marginBottom:"16px"},children:L(Ce)}),k&&"object"==typeof k&&(null===(d=k.position)||void 0===d?void 0:d.startsWith("top"))&&Re(),e.jsx("div",{style:Ke,children:e.jsx("div",{style:{width:"100%",minWidth:He?"".concat(He,"px"):"100%",display:"block"},children:e.jsxs("table",{style:Oe,className:A?"bordered":"",children:[ze(),e.jsx("tbody",{children:Ne()}),M&&e.jsx("tfoot",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:u.length+(g?1:0),children:M(Ce)})})})]})})}),I&&e.jsx("div",{style:{marginTop:"16px"},children:I(Ce)}),k&&("object"!=typeof k||!(null===(s=k.position)||void 0===s?void 0:s.startsWith("top")))&&Re()]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=function(){return t=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},t.apply(this,arguments)};function i(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(t[i[o]]=e[i[o]])}return t}function o(e,n,t){if(t||2===arguments.length)for(var i,o=0,r=n.length;o<r;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return e.concat(i||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var r={primaryColor:"#FB6011"},l=n.createContext(r),a=function(){var e=n.useContext(l);return e||r},d={small:{height:"32px",paddingLeft:"12px",paddingRight:"12px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},mediumSmall:{height:"36px",paddingLeft:"14px",paddingRight:"14px",fontSize:"14px",lineHeight:"20px",iconSize:"16px",gap:"6px"},medium:{height:"40px",paddingLeft:"16px",paddingRight:"16px",fontSize:"14px",lineHeight:"20px",iconSize:"18px",gap:"8px"},large:{height:"48px",paddingLeft:"20px",paddingRight:"20px",fontSize:"16px",lineHeight:"24px",iconSize:"20px",gap:"8px"}},s=function(n){var t=n.size,i=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes aha-button-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",style:{animation:"aha-button-spin 1s linear infinite"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"24",opacity:"0.3"}),e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"16"})]})]})},c=function(o){var r,l=o.children,c=o.type,u=void 0===c?"default":c,p=o.size,x=void 0===p?"medium":p,f=o.disabled,h=void 0!==f&&f,g=o.loading,m=void 0!==g&&g,v=o.onClick,y=o.htmlType,b=void 0===y?"button":y,w=o.className,j=void 0===w?"":w,k=o.style,C=o.icon,S=o.iconPosition,F=void 0===S?"left":S,A=i(o,["children","type","size","disabled","loading","onClick","htmlType","className","style","icon","iconPosition"]),E=a().primaryColor,z=void 0===E?"#FB6011":E,W=n.useState(!1),L=W[0],I=W[1],N=n.useState(!1),M=N[0],R=N[1],D=d[x],B=h||m,H=function(){if(m){var n="primary"===u?"#FFFFFF":"#101828",t=parseInt(D.iconSize.replace("px",""));return e.jsx(s,{size:t,color:n})}return C?e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:D.iconSize,height:D.iconSize,flexShrink:0},children:C}):null},P=(r=t({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:D.gap,height:D.height,paddingLeft:D.paddingLeft,paddingRight:D.paddingRight,fontSize:D.fontSize,lineHeight:D.lineHeight,fontWeight:500,fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"none",cursor:B?"not-allowed":"pointer",outline:"none",transition:"all 0.2s",userSelect:"none",WebkitTapHighlightColor:"transparent"},k),"primary"===u?(r.color="#FFFFFF",r.backgroundColor=z,h?(r.opacity=.4,r.cursor="not-allowed"):m?r.backgroundColor=z:M?r.backgroundColor="#EC470A":L&&(r.backgroundColor="#FD843A")):h?(r.backgroundColor="#FAFAF9",r.color="#D6D3D1",r.border="1px solid #E7E5E4"):m?(r.backgroundColor="#FFFFFF",r.color="#101828",r.border="1px solid #E7E5E4",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):M?(r.backgroundColor="#F5F5F4",r.color="#101828",r.border="1px solid #D7D3D0",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"):L?(r.backgroundColor="#FAFAF9",r.color="#101828",r.border="1px solid #D7D3D0",r.boxShadow="0px 2px 4px 0px rgba(12, 10, 9, 0.08)"):(r.backgroundColor="#FFFFFF",r.color="#101828",r.border="1px solid #E7E5E4",r.boxShadow="0px 1px 2px 0px rgba(12, 10, 9, 0.05)"),r);return e.jsxs("button",t({type:b,className:"aha-button aha-button--".concat(u," aha-button--").concat(x," ").concat(B?"aha-button--disabled":""," ").concat(m?"aha-button--loading":""," ").concat(j),disabled:B,onClick:function(e){B?e.preventDefault():null==v||v(e)},onMouseEnter:function(){return!B&&I(!0)},onMouseLeave:function(){I(!1),R(!1)},onMouseDown:function(){return!B&&R(!0)},onMouseUp:function(){return R(!1)},style:P},A,{children:[m&&H(),!m&&"left"===F&&H(),l&&e.jsx("span",{style:{display:"inline-block"},children:l}),!m&&"right"===F&&H()]}))};c.displayName="Button";var u=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},p=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M3.5 7H10.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},x=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},f=function(n){var t=n.className,i=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:[e.jsx("path",{d:"M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},h=function(n){var t=n.className,i=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:[e.jsx("path",{d:"M8.5 7.5L6 10L3.5 7.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8.5 4.5L6 2L3.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},g=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},m=function(n){var t=n.className,i=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:i,children:e.jsx("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},v=function(i){var o=i.current,r=i.defaultCurrent,l=void 0===r?1:r,d=i.total,s=void 0===d?0:d,u=i.pageSize,p=i.defaultPageSize,x=void 0===p?10:p,f=i.showSizeChanger,h=void 0!==f&&f,v=i.pageSizeOptions,y=void 0===v?["10","20","50","100"]:v,b=i.showQuickJumper,w=void 0!==b&&b,j=i.showTotal,k=i.onChange,C=i.onShowSizeChange,S=i.simple,F=void 0!==S&&S,A=i.disabled,E=void 0!==A&&A,z=i.hideOnSinglePage,W=void 0!==z&&z,L=i.className,I=void 0===L?"":L,N=i.style,M=i.size,R=void 0===M?"default":M,D=i.responsive,B=void 0!==D&&D;i.showLessItems;var H=i.itemRender,P=a().primaryColor,O=void 0===P?"#FB6011":P,T=n.useState(l),K=T[0],J=T[1],Q=n.useState(x),_=Q[0],q=Q[1],U=n.useState(""),X=U[0],Y=U[1],G=null!=o?o:K,V=null!=u?u:_,Z=n.useMemo(function(){return Math.ceil(s/V)},[s,V]);n.useEffect(function(){void 0!==o&&J(o)},[o]),n.useEffect(function(){void 0!==u&&q(u)},[u]);var $=function(e){e<1||e>Z||e===G||E||(void 0===o&&J(e),null==k||k(e,V))},ee=function(){var e=parseInt(X,10);e>=1&&e<=Z&&($(e),Y(""))};if(W&&Z<=1)return null;if(F)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(I),style:N,children:[e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"上一页"}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[G," / ",Z]}),e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"下一页"})]});var ne=(G-1)*V+1,te=Math.min(G*V,s);return e.jsxs("div",{className:"aha-pagination w-full ".concat(I),style:t({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:B?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},N),children:[j&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:j(s,[ne,te])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[H?H(G-1,"prev",e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{})," ",e.jsx("span",{children:"Previous"})]})})):e.jsx(c,{onClick:function(){return $(G-1)},disabled:E||1===G,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{})," ",e.jsx("span",{children:"Previous"})]})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:0},children:function(){if(Z<=7)return Array.from({length:Z},function(e,n){return n+1});var e=[];if(G<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(Z)}else if(G>=Z-3){e.push(1),e.push("jump-prev");for(n=Z-4;n<=Z;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=G-1;n<=G+1;n++)e.push(n);e.push("jump-next"),e.push(Z)}return e}().map(function(n,t){return function(n){if("number"==typeof n){var t=n===G,i=e.jsx(c,{onClick:function(){return $(n)},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,fontWeight:t?500:400,border:"none",background:t?"#FAFAF9":"white",backgroundColor:t?"#FAFAF9":"white",color:t?O:"#79716B",boxShadow:"none",borderRadius:"8px"},children:n},n);return H?H(n,"page",i):i}if("jump-prev"===n)return i=e.jsx(c,{onClick:function(){return $(Math.max(1,G-5))},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),H?H(G-5,"jump-prev",i):i;if("jump-next"===n)return i=e.jsx(c,{onClick:function(){return $(Math.min(Z,G+5))},disabled:E,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),H?H(G+5,"jump-next",i):i;return null}(n)})}),H?H(G+1,"next",e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Next"})," ",e.jsx(m,{})]})})):e.jsx(c,{onClick:function(){return $(G+1)},disabled:E||G===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"Next"})," ",e.jsx(m,{})]})}),h&&e.jsx("select",{value:V,onChange:function(e){return n=Number(e.target.value),t=Math.ceil(s/n),i=G>t?t:G,void 0===u&&q(n),void 0===o&&J(i),null==C||C(i,n),void(null==k||k(i,n));var n,t,i},disabled:E,style:{padding:"small"===R?"6px 12px":"8px 12px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"small"===R?"12px":"14px",lineHeight:"small"===R?"18px":"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",cursor:E?"not-allowed":"pointer",backgroundColor:"white",outline:"none",transition:"all 0.2s"},onMouseEnter:function(e){E||(e.currentTarget.style.borderColor=O)},onMouseLeave:function(e){e.currentTarget.style.borderColor="#EAECF0"},children:y.map(function(n){return e.jsxs("option",{value:n,children:[n," 条/页"]},n)})}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"跳至"}),e.jsx("input",{type:"number",min:"1",value:X,onChange:function(e){return Y(e.target.value)},onKeyPress:function(e){return"Enter"===e.key&&ee()},disabled:E,style:{width:"56px",height:"small"===R?"28px":"36px",padding:"0 8px",border:"1px solid #EAECF0",borderRadius:"8px",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",outline:"none",transition:"all 0.2s"},onFocus:function(e){e.currentTarget.style.borderColor=O},onBlur:function(e){e.currentTarget.style.borderColor="#EAECF0"}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"页"}),"object"==typeof w&&w.goButton?e.jsx(c,{onClick:ee,disabled:E,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:w.goButton}):e.jsx(c,{onClick:ee,disabled:E,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"确定"})]})]})]})},y=function(n){var i=n.checked,o=void 0!==i&&i,r=n.indeterminate,l=void 0!==r&&r,d=n.disabled,s=void 0!==d&&d,c=n.onChange,x=n.className,f=void 0===x?"":x,h=n.style,g=n.children,m=a().primaryColor,v=o||l,y=s?"#FAFAF9":v?m:"white",b=s?"#FAFAF9":v?m:"#D7D3D0";return e.jsxs("div",{className:"aha-checkbox ".concat(f),style:t({display:"inline-flex",alignItems:"center",gap:"8px",cursor:s?"not-allowed":"pointer"},h),onClick:function(e){s||(null==c||c({target:{checked:!o},currentTarget:{checked:!o}}))},children:[e.jsx("div",{style:{position:"relative",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",borderRadius:"4px",border:"1px solid ".concat(b),backgroundColor:y,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",flexShrink:0,boxSizing:"border-box"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",opacity:v?1:0,transition:"opacity 0.2s",pointerEvents:"none"},children:l?e.jsx(p,{style:{width:"14px",height:"14px",display:"block"}}):e.jsx(u,{style:{width:"14px",height:"14px",display:"block"}})})}),g&&e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:s?"#98A2B3":"#101828",fontFamily:"DM Sans, sans-serif"},children:g}),e.jsx("input",{type:"checkbox",checked:o,ref:function(e){e&&(e.indeterminate=l)},onChange:c,disabled:s,style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"},"aria-hidden":"true"})]})};y.displayName="Checkbox";var b=function(e,n){return"string"==typeof n?null==e?void 0:e[n]:n.reduce(function(e,n){return null==e?void 0:e[n]},e)},w=function(e,n){var t,i;return"function"==typeof n?n(e):"string"==typeof n?null!==(t=b(e,n))&&void 0!==t?t:"":null!==(i=e.key)&&void 0!==i?i:""},j=function(n){var t=n.order,i=a().primaryColor;return"ascend"===t?e.jsx(h,{style:{color:i}}):"descend"===t?e.jsx(f,{style:{color:i}}):e.jsx(x,{})};exports.default=function(r){var l,a,d,s,c=r.columns,u=void 0===c?[]:c,p=r.dataSource,x=void 0===p?[]:p,f=r.rowKey,h=void 0===f?"key":f,g=r.rowSelection,m=r.pagination,k=void 0!==m&&m,C=r.size,S=void 0===C?"middle":C,F=r.bordered,A=void 0!==F&&F;r.loading;var E=r.locale,z=r.showHeader,W=void 0===z||z,L=r.title,I=r.footer,N=r.summary,M=r.scroll,R=r.tableLayout,D=void 0===R?"auto":R,B=r.onChange,H=r.onSorterChange,P=r.onPaginationChange,O=r.onRow,T=r.className,K=void 0===T?"":T,J=r.innerClassName,Q=void 0===J?"":J,_=r.style,q=r.expandable,U=r.rowClassName,X=r.onHeaderRow;r.sticky;var Y=i(r,["columns","dataSource","rowKey","rowSelection","pagination","size","bordered","loading","locale","showHeader","title","footer","summary","scroll","tableLayout","onChange","onSorterChange","onPaginationChange","onRow","className","innerClassName","style","expandable","rowClassName","onHeaderRow","sticky"]),G=n.useState((null==g?void 0:g.selectedRowKeys)||(null==g?void 0:g.defaultSelectedRowKeys)||[]),V=G[0],Z=G[1];n.useEffect(function(){void 0!==(null==g?void 0:g.selectedRowKeys)&&Z(g.selectedRowKeys)},[null==g?void 0:g.selectedRowKeys]);var $=n.useState(new Map),ee=$[0],ne=$[1],te=n.useState((null==q?void 0:q.defaultExpandedRowKeys)||[]),ie=te[0],oe=te[1],re=n.useState(k&&"object"==typeof k&&(k.current||k.defaultCurrent)||1),le=re[0],ae=re[1],de=n.useState(k&&"object"==typeof k&&(k.pageSize||k.defaultPageSize)||10),se=de[0],ce=de[1];n.useEffect(function(){k&&"object"==typeof k&&(void 0!==k.current&&ae(k.current),void 0!==k.pageSize&&ce(k.pageSize))},[k]);var ue=n.useState(null),pe=ue[0],xe=ue[1],fe=n.useState(null),he=fe[0],ge=fe[1],me=n.useState(!1),ve=me[0],ye=me[1],be=n.useRef(null),we=n.useRef(null);n.useEffect(function(){var e=function(){ye(window.innerWidth<768)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var je=n.useCallback(function(e,n){var t,i,r,l=null===(t=null==g?void 0:g.getCheckboxProps)||void 0===t?void 0:t.call(g,e);if(!(null==l?void 0:l.disabled)){var a,d=w(e,h);a="radio"===(null==g?void 0:g.type)?n?[d]:[]:n?o(o([],V,!0),[d],!1):V.filter(function(e){return e!==d}),Z(a);var s=x.filter(function(e){return a.includes(w(e,h))});null===(i=null==g?void 0:g.onChange)||void 0===i||i.call(g,a,s),null===(r=null==g?void 0:g.onSelect)||void 0===r||r.call(g,e,n,s,new Event("select"))}},[V,h,g,x]),ke=n.useCallback(function(e,n){var t,i,o=n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}).map(function(e){return w(e,h)}),r=e?o:[];Z(r);var l=x.filter(function(e){return r.includes(w(e,h))}),a=e?n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}):[];null===(t=null==g?void 0:g.onChange)||void 0===t||t.call(g,r,l),null===(i=null==g?void 0:g.onSelectAll)||void 0===i||i.call(g,e,l,a)},[h,g,x]),Ce=n.useCallback(function(e,n){var t=e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex);if(t){var i=new Map(ee);null===n?i.delete(t):i.set(t,n),ne(i);var o=Array.from(i.entries()).map(function(n){var t=n[0],i=n[1];return{column:u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t})||e,order:i,field:t,columnKey:t}}),r={column:e,order:n,field:t,columnKey:t};e.onSorterChange&&e.onSorterChange(r),H&&H(1===o.length?o[0]:o),B&&B({current:le,pageSize:se},{},1===o.length?o[0]:o,{currentDataSource:x,action:"sort"})}},[ee,B,H,le,se,x,u]);n.useCallback(function(e,n){var t,i,r,l=w(e,h);r=n?o(o([],ie,!0),[l],!1):ie.filter(function(e){return e!==l}),oe(r),null===(t=null==q?void 0:q.onExpand)||void 0===t||t.call(q,n,e),null===(i=null==q?void 0:q.onExpandedRowsChange)||void 0===i||i.call(q,r)},[ie,h,q]);var Se=n.useCallback(function(){var e=o([],x,!0);return ee.size>0&&e.sort(function(e,n){for(var t=function(t,i){var o=u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t});if(!o)return"continue";var r=0;if("function"==typeof o.sorter)r=o.sorter(e,n);else if(!0===o.sorter){var l=b(e,o.dataIndex||t),a=b(n,o.dataIndex||t);l<a?r=-1:l>a&&(r=1)}return 0!==r?{value:"ascend"===i?r:-r}:void 0},i=0,o=Array.from(ee.entries());i<o.length;i++){var r=o[i],l=t(r[0],r[1]);if("object"==typeof l)return l.value}return 0}),e},[x,ee,u]),Fe=Se(),Ae=n.useMemo(function(){if(!1===k||!k)return Fe;var e=(le-1)*se,n=e+se;return Fe.slice(e,n)},[Fe,le,se,k]),Ee=n.useCallback(function(e,n){var t,i,o=null!=n?n:se;if(ae(e),n&&ce(n),P&&P(e,o),k&&"object"==typeof k&&(null===(t=k.onChange)||void 0===t||t.call(k,e,n),n&&(null===(i=k.onShowSizeChange)||void 0===i||i.call(k,e,n))),B){var r=Array.from(ee.entries()).map(function(e){var n=e[0],t=e[1];return{column:u.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===n}),order:t,field:n,columnKey:n}});B({current:e,pageSize:o},{},1===r.length?r[0]:r,{currentDataSource:Fe,action:"paginate"})}},[k,P,B,se,ee,u,Fe]),ze=n.useCallback(function(e,n,t){var i=b(n,e.dataIndex||"");return e.render?e.render(i,n,t):i},[]),We=n.useCallback(function(e,n,t){if(n){var i=!0===n?"left":n,o=0;if("left"===i){if(g&&("left"===g.fixed||!0===g.fixed))o+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;for(var r=0;r<e;r++){if("left"===(l=u[r]).fixed||!0===l.fixed)o+=l.width?"number"==typeof l.width?l.width:parseInt(l.width)||0:150}return o}if("right"===i){for(r=e+1;r<u.length;r++){var l;if("right"===(l=u[r]).fixed)o+=l.width?"number"==typeof l.width?l.width:parseInt(l.width)||0:150}if(g&&"right"===g.fixed)o+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;return o}}},[u,g]),Le=n.useCallback(function(){if(!W)return null;var n,i,o,r,l=u.map(function(n,i){var o,r=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||i,l=ee.get(r)||null,a=We(i,n.fixed,!0),d=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("th",t({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:{width:d,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:d||void 0,maxWidth:d,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==a?"".concat(a,"px"):"0":void 0,right:"right"===n.fixed?void 0!==a?"".concat(a,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:(n.fixed,"#F9FAFB"),boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"12px 16px",textAlign:n.align||"left",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif"}},(null===(o=n.onHeaderCell)||void 0===o?void 0:o.call(n,n))||{},{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",justifyContent:"right"===n.align?"flex-end":"center"===n.align?"center":"flex-start"},children:[e.jsx("span",{style:{fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467"},children:"function"==typeof n.title?n.title({sortOrder:l,sortColumn:n}):n.title}),n.sorter&&e.jsx("button",{onClick:function(){Ce(n,null===l?"ascend":"ascend"===l?"descend":null)},style:{border:"none",background:"none",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px",color:l?"#475467":"#98A2B3"},children:e.jsx(j,{order:l||void 0})})]})}),r)});if(g){var a="number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",d=e.jsx("th",{style:{width:a,position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"#F9FAFB",padding:"12px 16px",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[!g.hideSelectAll&&"radio"!==g.type&&(n=Ae.filter(function(e){var n;return!(null===(n=g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}),i=n.map(function(e){return w(e,h)}),o=n.length>0&&i.every(function(e){return V.includes(e)}),r=i.some(function(e){return V.includes(e)}),e.jsx(y,{checked:o,indeterminate:r&&!o,onChange:function(e){return ke(e.target.checked,Ae)}})),g.columnTitle&&e.jsx("span",{style:{marginLeft:g.hideSelectAll?0:"8px"},children:g.columnTitle})]})},"selection");l.unshift(d)}var s=null==X?void 0:X(u,0);return e.jsx("thead",{ref:we,children:e.jsx("tr",t({},s||{},{children:l}))})},[u,W,ee,g,V,Ae,h,Ce,ke,E,X,We]),Ie=n.useCallback(function(e){xe(e)},[]),Ne=n.useCallback(function(e,n){e.preventDefault(),ge(n)},[]),Me=n.useCallback(function(e,n){if(e.preventDefault(),null===pe||pe===n)return xe(null),void ge(null);var t=o([],Ae,!0),i=t[pe];t.splice(pe,1),t.splice(n,0,i),xe(null),ge(null)},[pe,Ae]),Re=n.useCallback(function(){xe(null),ge(null)},[]),De=n.useCallback(function(){return Ae.map(function(i,o){var r,l=w(i,h),a=V.includes(l),d=ie.includes(l),s=(null==O?void 0:O(i,o))||{},c=o===Ae.length-1;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",t({className:"".concat("function"==typeof U?U(i,o):U||""," ").concat(pe===o?"dragging":""," ").concat(he===o?"drag-over":""),draggable:!0,onDragStart:function(){return Ie(o)},onDragOver:function(e){return Ne(e,o)},onDrop:function(e){return Me(e,o)},onDragEnd:Re,style:t({cursor:"move",opacity:pe===o?.5:1,backgroundColor:he===o?"#F9FAFB":"white",transition:"background-color 0.2s"},s.style),onMouseEnter:function(e){pe!==o&&he!==o&&(e.currentTarget.style.backgroundColor="#F9FAFB")},onMouseLeave:function(e){pe!==o&&he!==o&&(e.currentTarget.style.backgroundColor="white")}},s,{children:[g&&e.jsx("td",{style:{width:"number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"white",padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",textAlign:"center"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(y,{checked:a,onChange:function(e){return je(i,e.target.checked)},disabled:null===(r=g.getCheckboxProps)||void 0===r?void 0:r.call(g,i).disabled})})}),u.map(function(n,r){var l,a=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||r,d=(null===(l=n.onCell)||void 0===l?void 0:l.call(n,i,o))||{},s=We(r,n.fixed,!1),u=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("td",t({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:t({width:u,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:u||void 0,maxWidth:u,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,right:"right"===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:"white",boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",textAlign:n.align||"left"},d.style),colSpan:n.colSpan,rowSpan:n.rowSpan},d,{children:ze(n,i,o)}),a)})]})),(null==q?void 0:q.expandedRowRender)&&d&&e.jsx("tr",{children:e.jsx("td",{colSpan:u.length+(g?1:0),children:q.expandedRowRender(i,o,0,!0)})})]},l)})},[Ae,h,V,ie,g,u,O,U,je,ze,q,pe,he,Ie,Ne,Me,Re,We]),Be=function(){var n;if(!1===k||!k)return null;var t=null!==(n=k.total)&&void 0!==n?n:Fe.length,i=k.position||"bottomRight";return e.jsx("div",{style:{marginTop:"16px",display:"flex",justifyContent:i.includes("Right")?"flex-end":i.includes("Left")?"flex-start":"center"},children:e.jsx(v,{current:le,total:t,pageSize:se,showSizeChanger:k.showSizeChanger,pageSizeOptions:k.pageSizeOptions,showQuickJumper:k.showQuickJumper,showTotal:k.showTotal,onChange:Ee,onShowSizeChange:Ee,simple:k.simple,responsive:k.responsive,size:"small"===S?"small":"default"})})},He=n.useMemo(function(){return u.some(function(e){return e.fixed})||g&&g.fixed},[u,g]),Pe=n.useMemo(function(){return u.every(function(e){return e.width})&&(!g||g.columnWidth)},[u,g]),Oe=n.useMemo(function(){if(null==M?void 0:M.x){if("number"==typeof M.x)return M.x;if(!0===M.x)return u.reduce(function(e,n){return e+(n.width?"number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0:150)},0)+(g?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth||"60").replace("px",""))||60:0)}if(He)return u.reduce(function(e,n){return n.fixed&&n.width?e+("number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0):e},0)+(g&&g.fixed&&g.columnWidth?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth).replace("px",""))||60:0)},[u,null==M?void 0:M.x,g,He]),Te=n.useMemo(function(){return"fixed"===D||He||Pe||u.some(function(e){return e.width})?"fixed":D},[D,He,Pe,u]),Ke=t(t({width:"100%",minWidth:Oe?"".concat(Oe,"px"):"100%",borderCollapse:"separate",borderSpacing:0,tableLayout:Te,backgroundColor:"white"},A&&{borderRadius:"8px",border:"1px solid #EAECF0"}),{overflow:"hidden"}),Je=t({position:"relative",width:"100%",maxWidth:"100%",maxHeight:"number"==typeof(null==M?void 0:M.y)?"".concat(M.y,"px"):void 0,borderRadius:"8px"},_);if(ve)return e.jsxs("div",t({ref:be,className:"aha-table aha-table-mobile-wrapper ".concat(K),style:Je},Y,{children:[L&&e.jsx("div",{style:{marginBottom:"16px"},children:L(Fe)}),k&&"object"==typeof k&&(null===(l=k.position)||void 0===l?void 0:l.startsWith("top"))&&Be(),e.jsx("div",{className:"aha-table-mobile",children:Ae.map(function(n,t){var i,o=w(n,h),r=V.includes(o);return e.jsxs("div",{className:"aha-table-mobile-row ".concat(r?"selected":""),style:{border:"1px solid #e8e8e8",borderRadius:"4px",padding:"12px",marginBottom:"12px",backgroundColor:r?"#e6f7ff":"white"},children:[g&&e.jsx("div",{style:{marginBottom:"8px"},children:e.jsx(y,{checked:r,onChange:function(e){return je(n,e.target.checked)},disabled:null===(i=g.getCheckboxProps)||void 0===i?void 0:i.call(g,n).disabled})}),u.map(function(i){var o=i.key||(Array.isArray(i.dataIndex)?i.dataIndex.join("."):i.dataIndex),r=b(n,i.dataIndex||""),l=i.render?i.render(r,n,t):r;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("span",{style:{fontWeight:"bold",color:"#666"},children:["function"==typeof i.title?i.title({}):i.title,":"]}),e.jsx("span",{style:{flex:1,textAlign:"right"},children:l})]},o)})]},o)})}),I&&e.jsx("div",{style:{marginTop:"16px"},children:I(Fe)}),k&&("object"!=typeof k||!(null===(a=k.position)||void 0===a?void 0:a.startsWith("top")))&&Be()]}));var Qe={position:"relative",overflowX:(null==M?void 0:M.x)||He?"auto":"visible",overflowY:(null==M?void 0:M.y)?"auto":"visible",width:"100%",maxWidth:!0===(null==M?void 0:M.x)?"100%":"number"==typeof(null==M?void 0:M.x)?"".concat(M.x,"px"):void 0,maxHeight:"number"==typeof(null==M?void 0:M.y)?"".concat(M.y,"px"):void 0,borderRadius:"8px"};return e.jsxs("div",t({ref:be,className:"aha-table ".concat(K),style:Je},Y,{children:[L&&e.jsx("div",{style:{marginBottom:"16px"},children:L(Fe)}),k&&"object"==typeof k&&(null===(d=k.position)||void 0===d?void 0:d.startsWith("top"))&&Be(),e.jsx("div",{style:Qe,children:e.jsx("div",{style:{width:"100%",minWidth:Oe?"".concat(Oe,"px"):"100%",display:"block"},children:e.jsxs("table",{style:Ke,className:Q,children:[Le(),e.jsx("tbody",{children:De()}),N&&e.jsx("tfoot",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:u.length+(g?1:0),children:N(Fe)})})})]})})}),I&&e.jsx("div",{style:{marginTop:"16px"},children:I(Fe)}),k&&("object"!=typeof k||!(null===(s=k.position)||void 0===s?void 0:s.startsWith("top")))&&Be()]}))};
2
2
  //# sourceMappingURL=Table.js.map