@feathery/react 2.32.0 → 2.33.0
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/cjs/elements/basic/TableElement/EditableCell.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/index.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/styles.d.ts +49 -1
- package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -1
- package/cjs/{fthry_FormControl.BtNu9i-u.js → fthry_FormControl.DlQTwIun.js} +1 -1
- package/cjs/{fthry_InlineTooltip.DuFB8p7w.js → fthry_InlineTooltip.Dv3bWtuY.js} +2 -2
- package/cjs/{fthry_Overlay.DqGyzI8W.js → fthry_Overlay.CW-pYrr9.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.D0kI1ZxS.js → fthry_PaymentMethodField.DF99c9Yz.js} +4 -4
- package/cjs/{fthry_Placeholder.WRNgQX3l.js → fthry_Placeholder.BBOPmrWo.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.1seA7I1l.js → fthry_ShowEyeIcon.CAh-w4A6.js} +1 -1
- package/cjs/{fthry_index.WRjuuH9z.js → fthry_index.B9nY4v3g.js} +1 -1
- package/cjs/{fthry_index.CBJimbrX.js → fthry_index.BBTuvxP-.js} +5 -5
- package/cjs/{fthry_index.B96nzeqy.js → fthry_index.BBncgjlH.js} +4 -4
- package/cjs/{fthry_index.CiXHBkVl.js → fthry_index.BM76DWs0.js} +26 -26
- package/cjs/{fthry_index.BhC7LkQw.js → fthry_index.BfpdX9PY.js} +5 -5
- package/cjs/{fthry_index.BI7CrYad.js → fthry_index.BqDR6ZTR.js} +2 -2
- package/cjs/{fthry_index.BvkC5P1Q.js → fthry_index.BxKxr-vu.js} +6 -6
- package/cjs/{fthry_index.BTKf9mxG.js → fthry_index.C-1ZWbCt.js} +1 -1
- package/cjs/{fthry_index.C6CH7RhD.js → fthry_index.CAkN_LTT.js} +8 -8
- package/cjs/{fthry_index.DloMkPdT.js → fthry_index.CsZJ0VxJ.js} +5 -5
- package/cjs/{fthry_index.BccfyVDL.js → fthry_index.CszJDJSc.js} +6 -6
- package/cjs/{fthry_index.KbHjZiIM.js → fthry_index.CyzpvBzo.js} +6 -6
- package/cjs/{fthry_index.D4RrBVB-.js → fthry_index.D534gCiX.js} +1 -1
- package/cjs/{fthry_index.J4GcA3vx.js → fthry_index.DLWQCVEp.js} +1 -1
- package/cjs/{fthry_index.CGQA5QkX.js → fthry_index.DUtB4IeG.js} +3 -3
- package/cjs/{fthry_index.B_-iRvUH.js → fthry_index.DXqNaOBF.js} +4 -4
- package/cjs/{fthry_index.Z6a5kUfj.js → fthry_index.DZ2YmjdV.js} +34 -54
- package/cjs/{fthry_index.CUO7vSY3.js → fthry_index.Ddy1at36.js} +4 -4
- package/cjs/{fthry_index.oVFShAC8.js → fthry_index.DkNrQOM0.js} +2 -2
- package/cjs/{fthry_index.DbijQ61t.js → fthry_index.DvihBGW0.js} +1 -1
- package/cjs/{fthry_index.BEVaTA54.js → fthry_index.DygKMyYF.js} +3 -3
- package/cjs/{fthry_index.BM4ep-AK.js → fthry_index.P2F3E-i6.js} +5 -5
- package/cjs/{fthry_index.TK6Jx-jy.js → fthry_index.kubak4v9.js} +1 -1
- package/cjs/{fthry_index.C7hxyJ9f.js → fthry_index.pQYL0jJ8.js} +1 -1
- package/cjs/{fthry_input.CUTC1cQr.js → fthry_input.BUofERxj.js} +1 -1
- package/cjs/{fthry_script.DRtiXuhL.js → fthry_script.BRUVWUsj.js} +1 -1
- package/cjs/{fthry_styles.MGVgRzzA.js → fthry_styles.ClONUQyi.js} +1 -1
- package/cjs/{fthry_useElementSize.DXcMVgAq.js → fthry_useElementSize.CDdvRTKk.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.C87PZunf.js → fthry_useSalesforceSync.CEk-vrKl.js} +1 -1
- package/cjs/{fthry_webfontloader.CVSP2Jc5.js → fthry_webfontloader.cLPTza9f.js} +1 -1
- package/cjs/index.js +1 -1
- package/dist/elements/basic/TableElement/EditableCell.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/index.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/styles.d.ts +49 -1
- package/dist/elements/basic/TableElement/styles.d.ts.map +1 -1
- package/dist/{fthry_FormControl.C9K2iuFX.js → fthry_FormControl.PVuWlBgz.js} +1 -1
- package/dist/{fthry_InlineTooltip.CQ84q5tx.js → fthry_InlineTooltip.BbRPRDkF.js} +2 -2
- package/dist/{fthry_Overlay.CaTGHPrf.js → fthry_Overlay.xJ2zMPu8.js} +1 -1
- package/dist/{fthry_PaymentMethodField.CLy4llPE.js → fthry_PaymentMethodField.DBnHj0cn.js} +4 -4
- package/dist/{fthry_Placeholder.C8DX1xTT.js → fthry_Placeholder.D2BgfEJ9.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.CLCEl1M3.js → fthry_ShowEyeIcon.y-R1E9to.js} +1 -1
- package/dist/{fthry_index.8KDT5i8T.js → fthry_index.BejmbDod.js} +4 -4
- package/dist/{fthry_index.WnliJHmX.js → fthry_index.BlF_0Ffc.js} +2 -2
- package/dist/{fthry_index.CqNn14xm.js → fthry_index.Bpub9YIO.js} +6 -6
- package/dist/{fthry_index.DQsvec3-.js → fthry_index.BrCePUsU.js} +3 -3
- package/dist/{fthry_index.qJQlILVx.js → fthry_index.BvQ8XEJZ.js} +5 -5
- package/dist/{fthry_index.DKYX71gD.js → fthry_index.CK5OFXMa.js} +4 -4
- package/dist/{fthry_index.B260ADJ4.js → fthry_index.ChdMOr_X.js} +5 -5
- package/dist/{fthry_index.BjpHx4_T.js → fthry_index.CqR05U3I.js} +5 -5
- package/dist/{fthry_index.C1_uGweo.js → fthry_index.Cu5c8aId.js} +1 -1
- package/dist/{fthry_index.DqKZq0Ur.js → fthry_index.Cvy9sCKK.js} +4 -4
- package/dist/{fthry_index.hyYvw_PS.js → fthry_index.D0TWGtN7.js} +1 -1
- package/dist/{fthry_index.CeglQZhs.js → fthry_index.D6Ck5pB3.js} +1 -1
- package/dist/{fthry_index.DmcD0QUi.js → fthry_index.D9yH2Okw.js} +1 -1
- package/dist/{fthry_index.ty8LJs-R.js → fthry_index.DGgHIFlr.js} +2 -2
- package/dist/{fthry_index.B-oOxFi4.js → fthry_index.Dghw4DVd.js} +35 -55
- package/dist/{fthry_index.CLgjzDTi.js → fthry_index.Do4oXiDH.js} +1 -1
- package/dist/{fthry_index.CmpLevaj.js → fthry_index.URxr29cr.js} +6 -6
- package/dist/{fthry_index.C5zUlrOm.js → fthry_index.UVcw7OnE.js} +1 -1
- package/dist/{fthry_index.BZD_DEzj.js → fthry_index.brIY5h5k.js} +1 -1
- package/dist/{fthry_index.9-q7smC3.js → fthry_index.dvByw-2B.js} +3 -3
- package/dist/{fthry_index.DoGwIkbA.js → fthry_index.k6w2ySQR.js} +6 -6
- package/dist/{fthry_index.Ddf14JA6.js → fthry_index.kOfgCMDO.js} +27 -27
- package/dist/{fthry_index.CYyOgKWx.js → fthry_index.o0_GqIs7.js} +8 -8
- package/dist/{fthry_index.kP74GhA8.js → fthry_index.rCNfS1b1.js} +5 -5
- package/dist/{fthry_input.DjzutNam.js → fthry_input.BKW831Tj.js} +1 -1
- package/dist/{fthry_script.DO2CsvZO.js → fthry_script.BgSqcrR6.js} +1 -1
- package/dist/{fthry_styles.Ccd48IiB.js → fthry_styles.DbsjdZwt.js} +1 -1
- package/dist/{fthry_useElementSize.C-0G4BJy.js → fthry_useElementSize.yMElTorV.js} +1 -1
- package/dist/{fthry_useSalesforceSync.B6wBqJLI.js → fthry_useSalesforceSync.Cbl44iOq.js} +1 -1
- package/dist/{fthry_webfontloader.MZhbLTEd.js → fthry_webfontloader.BfAk31Iw.js} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/umd/TableElement.8e41e1015eb1543af90b.js +1 -0
- package/umd/index.js +1 -1
- package/cjs/elements/basic/TableElement/useColumnWidths.d.ts +0 -7
- package/cjs/elements/basic/TableElement/useColumnWidths.d.ts.map +0 -1
- package/dist/elements/basic/TableElement/useColumnWidths.d.ts +0 -7
- package/dist/elements/basic/TableElement/useColumnWidths.d.ts.map +0 -1
- package/umd/TableElement.b9bb3cedf1a75fd2ea01.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[844],{9215:(e,t,r)=>{r.r(t),r.d(t,{default:()=>rt});var n=r(5944),o=r(7294),i=r(426),a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)},l="#ffffff",c="#f9fafb",u="#f3f4f6",s="#e5e7eb",d="#d1d5db",f="#9ca3af",p="#4b5563",h="#111827",g="#1d4ed8",v="#ef4444",y="#dc2626",b={width:"16px",height:"16px",color:"#6b7280"},x={display:"flex",flexDirection:"column",gap:"2px","& svg":{marginInlineStart:"4px",width:"20px",height:"20px"}},m={width:"12px",height:"12px",color:f,opacity:.3,'&[data-active="true"]':{color:g,opacity:1}},w={display:"flex",alignItems:"center",gap:"8px"},C={position:"relative",overflowX:"auto",overflowY:"auto",backgroundColor:l,boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",borderRadius:"8px",border:"1px solid ".concat(s),minWidth:"100%",maxWidth:"100%",height:"100%",boxSizing:"border-box"},k={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"64px 24px",textAlign:"center"},S={color:p,fontSize:"16px",fontWeight:"500",margin:0},Z={position:"relative",flex:1},R={position:"absolute",top:0,bottom:0,left:0,display:"flex",alignItems:"center",paddingLeft:"12px",pointerEvents:"none"},P={display:"block",width:"100%",maxWidth:"384px",paddingLeft:"36px",paddingRight:"12px",paddingTop:"10px",paddingBottom:"10px",backgroundColor:c,border:"1px solid ".concat(s),color:h,fontSize:"14px",borderRadius:"8px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",boxSizing:"border-box"},_={width:"100%",maxWidth:"100%",fontSize:"14px",textAlign:"left",color:p,textIndent:0,borderColor:"inherit",borderCollapse:"collapse"},B={fontSize:"14px",color:p,backgroundColor:c,borderBottom:"1px solid ".concat(s)},I={padding:"12px 24px",fontWeight:"500",userSelect:"none",whiteSpace:"nowrap"},L={backgroundColor:l,borderBottom:"1px solid ".concat(s),transition:"background-color 0.2s"},A={padding:"16px 24px",wordBreak:"break-word",overflowWrap:"anywhere"},E={display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",padding:"16px",gap:"8px"},D={fontSize:"14px",fontWeight:"normal",color:p},M={fontWeight:"600",color:h},j={display:"flex",marginLeft:"-1px",fontSize:"14px",listStyle:"none",padding:0,margin:0},T={display:"flex",alignItems:"center",justifyContent:"center",color:p,backgroundColor:c,boxSizing:"border-box",border:"1px solid ".concat(s),fontWeight:"500",fontSize:"14px",textDecoration:"none",cursor:"pointer",height:"36px",wordBreak:"keep-all",overflowWrap:"normal","&:hover":{backgroundColor:u,color:h},"&:disabled:hover":{color:p,backgroundColor:c,cursor:"auto"}},X=a(a({},T),{borderRadius:"4px",paddingInline:"8px",paddingBlock:"4px",width:"auto",height:"auto",minHeight:"28px",position:"relative"}),O={width:"16px",height:"16px",color:p},W={position:"fixed",backgroundColor:l,border:"1px solid ".concat(d),borderRadius:"4px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",zIndex:9999,minWidth:"120px"},z={display:"block",width:"100%",textAlign:"left",paddingLeft:"12px",paddingRight:"12px",paddingTop:"8px",paddingBottom:"8px",fontSize:"14px",color:"#374151",backgroundColor:"transparent",border:"none",cursor:"pointer",whiteSpace:"nowrap",position:"relative","&:hover":{backgroundColor:u},"&:disabled:hover":{backgroundColor:"transparent",cursor:"auto"},"&:first-of-type":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"&:last-of-type":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"}},V={borderTop:"1px solid ".concat(s),margin:"4px 0"},F=a(a({},z),{color:v,"&:hover":{backgroundColor:u,color:y}}),N=a(a({},X),{aspectRatio:1,paddingLeft:0,paddingRight:0}),Q={display:"flex",gap:"8px",justifyContent:"flex-end"},H=a(a({},T),{width:"36px",borderRightWidth:0}),K=a(a({},H),{borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto"}),Y=a(a({},H),{borderTopRightRadius:"8px",borderBottomRightRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto",borderRightWidth:1}),$=a(a({},H),{color:g,backgroundColor:"#eff6ff",border:"1px solid ".concat(s)}),q={opacity:.8,cursor:"default",color:f,"&:hover":{backgroundColor:c,color:f}},G=a(a({},H),{appearance:"none",WebkitAppearance:"none",cursor:"pointer",paddingLeft:"8px",paddingRight:"8px",width:"36px",textAlign:"center",outline:"none","&:hover":{backgroundColor:u,color:h},"&:focus":{outline:"none"}}),J={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:"1px solid ".concat(s),gap:"12px"},U=a(a({},T),{borderRadius:"8px",paddingLeft:"12px",paddingRight:"12px",whiteSpace:"nowrap"}),ee={color:f,cursor:"pointer",userSelect:"none",fontSize:"14px"},te={display:"block",width:"100%",minWidth:0,maxWidth:"100%",padding:"4px 8px",border:"1px solid ".concat(g),borderRadius:"4px",fontSize:"14px",color:h,outline:"none",boxSizing:"border-box",resize:"none",overflowY:"auto",fontFamily:"inherit",lineHeight:1.5},re={display:"flex",alignItems:"flex-start",gap:"8px"},ne={flex:1,minWidth:0,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",lineHeight:1.5},oe={flex:1,minWidth:0,position:"relative",alignSelf:"stretch"},ie=a(a({},te),{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",visibility:"hidden",pointerEvents:"none"}),ae={position:"absolute",inset:0,height:"100%"},le={display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:f,cursor:"pointer",opacity:0,transition:"opacity 0.15s",flexShrink:0,padding:0,'tr:hover &, &[aria-expanded="true"]':{opacity:1},"&:hover":{backgroundColor:u,color:p}},ce={width:"40px",padding:"0 8px"},ue={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:f,cursor:"pointer",opacity:0,transition:"opacity 0.15s",padding:0,"tr:hover &":{opacity:1},"&:hover":{backgroundColor:u,color:v}},se={position:"fixed",backgroundColor:l,border:"1px solid ".concat(d),borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",zIndex:9999,padding:"12px 16px"},de={margin:"0 0 12px 0",fontSize:"14px",fontWeight:"500",color:h},fe={display:"flex",gap:"8px",justifyContent:"flex-end"},pe=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px"}),he=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px",backgroundColor:v,color:l,border:"1px solid ".concat(v),"&:hover":{backgroundColor:y,color:l}}),ge=function(){return ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ge.apply(this,arguments)};function ve(){return(0,n.tZ)("svg",ge({css:b,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2},{children:(0,n.tZ)("path",{strokeLinecap:"round",d:"M21 21l-3.5-3.5M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"})}))}function ye(e){var t=e.searchQuery,r=e.onSearchChange;return(0,n.BX)("div",ge({css:Z},{children:[(0,n.tZ)("div",ge({css:R},{children:(0,n.tZ)(ve,{})})),(0,n.tZ)("input",{type:"text",css:P,placeholder:"Search",value:t,onChange:function(e){return r(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()}})]}))}var be=function(){return be=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)};function xe(e){var t=e.isSorted,r=e.sortDirection;return(0,n.BX)("svg",be({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},{children:[(0,n.tZ)("path",{css:m,stroke:"currentColor","data-active":t&&"asc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 9 4-4 4 4"}),(0,n.tZ)("path",{css:m,stroke:"currentColor","data-active":t&&"desc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 15 4 4 4-4"})]}))}function me(e){var t=e.columns,r=e.enableSort,o=e.sortColumn,i=e.sortDirection,a=e.onSort,l=e.styles;return(0,n.tZ)(n.HY,{children:t.map((function(e,t){var c=r,u=o===e.name,s=0===t;return(0,n.tZ)("th",be({scope:"col",onClick:function(){return c&&a(e.name)},css:be(be(be(be({},I),s?{}:{paddingLeft:0}),l.getTarget("th")),c?{cursor:"pointer"}:{})},{children:(0,n.BX)("div",be({css:w},{children:[(0,n.tZ)("span",{children:e.name}),c&&(0,n.tZ)("span",be({css:x},{children:(0,n.tZ)(xe,{isSorted:u,sortDirection:i})}))]}))}),t)}))})}var we=function(){return we=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},we.apply(this,arguments)};function Ce(e){var t=e.currentPage,r=e.totalItems,o=e.rowsPerPage;return(0,n.BX)("span",we({css:D},{children:["Showing"," ",(0,n.BX)("span",we({css:M},{children:[t*o+1,"-",Math.min((t+1)*o,r)]}))," ","of ",(0,n.tZ)("span",we({css:M},{children:r}))]}))}function ke(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},K),t?q:{})},{children:"Previous"}))}function Se(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},Y),t?q:{})},{children:"Next"}))}function Ze(e){var t=e.pages,r=e.onPageChange;return(0,n.BX)("select",we({value:"",onChange:function(e){r(Number(e.target.value))},"aria-label":"Go to page",css:G},{children:[(0,n.tZ)("option",we({value:"",disabled:!0,hidden:!0},{children:"..."})),t.map((function(e){return(0,n.tZ)("option",we({value:e},{children:e+1}),e)}))]}))}function Re(e){var t=e.currentPage,r=e.totalPages,o=e.onPageChange,i=new Set;i.add(0),i.add(r-1);for(var a=Math.max(0,t-1);a<=Math.min(r-1,t+1);a++)i.add(a);var l=[],c=Array.from(i).sort((function(e,t){return e-t}));for(a=0;a<c.length;a++){var u=c[a],s=a>0?c[a-1]:-1;if(u-s>1){for(var d=[],f=s+1;f<u;f++)d.push(f);l.push({type:"overflow",pages:d})}l.push({type:"page",page:u})}return(0,n.tZ)(n.HY,{children:l.map((function(e,r){if("overflow"===e.type)return 1===e.pages.length?(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.pages[0])},css:H},{children:e.pages[0]+1}))},"overflow-".concat(r)):(0,n.tZ)("li",{children:(0,n.tZ)(Ze,{pages:e.pages,onPageChange:o})},"overflow-".concat(r));var i=e.page===t;return(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.page)},"aria-current":i?"page":void 0,css:i?$:H},{children:e.page+1}))},e.page)}))})}function Pe(e){var t=e.currentPage,r=e.totalPages,o=e.totalItems,i=e.rowsPerPage,a=e.onPageChange;return r<=1?null:(0,n.BX)("nav",we({css:E,"aria-label":"Table navigation"},{children:[(0,n.tZ)(Ce,{currentPage:t,totalItems:o,rowsPerPage:i}),(0,n.BX)("ul",we({css:j},{children:[(0,n.tZ)("li",{children:(0,n.tZ)(ke,{disabled:0===t,onClick:function(){return a(Math.max(0,t-1))}})}),(0,n.tZ)(Re,{currentPage:t,totalPages:r,onPageChange:a}),(0,n.tZ)("li",{children:(0,n.tZ)(Se,{disabled:t>=r-1,onClick:function(){a(Math.min(r-1,t+1))}})})]}))]}))}var _e=r(3935),Be=r(1142),Ie=r(9479),Le=function(){return Le=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Le.apply(this,arguments)},Ae=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ee(){return(0,n.BX)("svg",Le({css:O,fill:"currentColor",viewBox:"0 0 24 24"},{children:[(0,n.tZ)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"19",r:"2"})]}))}function De(e){var t,r,i,a=e.actions,l=e.rowIndex,c=e.columnData,u=e.fieldValues,s=e.onClick,d=e.forceInlineButtons,f=void 0!==d&&d,p=e.tableId,h=void 0===p?"":p,g=e.buttonLoaders,v=void 0===g?{}:g,y=e.canDeleteRows,b=void 0!==y&&y,x=e.onDeleteRow;if(0===a.length)return null;var m=Ae((0,o.useState)(!1),2),w=m[0],C=m[1],k=Ae((0,o.useState)({top:0,left:0}),2),S=k[0],Z=k[1],R=(0,o.useRef)(null),P=(0,o.useRef)(null),_=(0,o.useRef)(null),B=!f&&a.length>1;(0,o.useEffect)((function(){if(w){var e=function(e){P.current&&!P.current.contains(e.target)&&_.current&&!_.current.contains(e.target)&&C(!1)},t=function(){C(!1)},r=(0,Ie.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[w]);var I=function(e){C(!1);var t=u||Be.u4,r={};c.forEach((function(e){var n=t[e.field_key],o=Array.isArray(n)?n[l]:n;r[e.name]=o})),s({action:e.label,rowIndex:l,rowData:r})},L=null!==(i=null===(r=v["".concat(h,"_").concat(l,"_").concat(null===(t=a.find((function(e){var t,r="".concat(h,"_").concat(l,"_").concat(e.label);return null===(t=v[r])||void 0===t?void 0:t.loader})))||void 0===t?void 0:t.label)])||void 0===r?void 0:r.loader)&&void 0!==i?i:null;return(0,n.tZ)("div",Le({ref:R,css:Q},{children:B?(0,n.BX)(n.HY,{children:[(0,n.tZ)("button",Le({ref:_,type:"button",disabled:L,onClick:function(e){e.stopPropagation(),function(){if(!w&&_.current){var e=_.current.getBoundingClientRect();Z({top:e.bottom+4,left:e.right})}C(!w)}()},css:N},{children:L?(0,n.tZ)("div",Le({style:{height:"16px",width:"16px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:L})):(0,n.tZ)(Ee,{})})),w&&(0,_e.createPortal)((0,n.BX)("div",Le({ref:P,css:Le(Le({},W),{top:"".concat(S.top,"px"),left:"".concat(S.left,"px"),transform:"translateX(-100%)"})},{children:[a.map((function(e,t){var r=Object.keys(v).length>0;return(0,n.tZ)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:z,disabled:r},{children:e.label}),t)})),b&&x&&(0,n.BX)(n.HY,{children:[(0,n.tZ)("div",{css:V}),(0,n.tZ)("button",Le({type:"button",onClick:function(e){e.stopPropagation(),C(!1),x(l)},css:F},{children:"Delete"}))]})]})),(0,Ie.me)().body)]}):a.map((function(e,t){var r,o="".concat(h,"_").concat(l,"_").concat(e.label),i=null===(r=v[o])||void 0===r?void 0:r.loader,a=Object.keys(v).length>0;return(0,n.BX)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:X,disabled:a},{children:[(0,n.tZ)("span",Le({style:{visibility:i?"hidden":"visible"}},{children:e.label})),i&&(0,n.tZ)("div",Le({style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",height:"16px",width:"16px"}},{children:i}))]}),t)}))}))}var Me=function(){return Me=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Me.apply(this,arguments)};function je(e){var t=e.hasSearchQuery;return(0,n.BX)("div",Me({css:k},{children:[t&&(0,n.tZ)("svg",Me({css:{width:"48px",height:"48px",color:"#9ca3af",marginBottom:"16px"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5},{children:(0,n.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})),(0,n.tZ)("p",Me({css:S},{children:t?"No results found":"No data available"})),t&&(0,n.tZ)("p",Me({css:Me(Me({},S),{fontSize:"14px",marginTop:"8px"})},{children:"Try adjusting your search query"}))]}))}var Te=function(){return Te=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Te.apply(this,arguments)};function Xe(e){var t=e.anchorEl,r=e.onConfirm,i=e.onCancel,a=e.message,l=void 0===a?"Delete this row?":a,c=e.confirmLabel,u=void 0===c?"Delete":c,s=(0,o.useRef)(null);if(!t)return null;var d=t.getBoundingClientRect(),f=d.bottom+4,p=d.right;return(0,o.useEffect)((function(){var e=function(e){s.current&&!s.current.contains(e.target)&&t&&!t.contains(e.target)&&i()},r=function(){return i()},n=function(e){"Escape"===e.key&&i()},o=(0,Ie.me)();return o.addEventListener("mousedown",e),o.addEventListener("scroll",r,!0),o.addEventListener("keydown",n),function(){o.removeEventListener("mousedown",e),o.removeEventListener("scroll",r,!0),o.removeEventListener("keydown",n)}}),[i,t]),(0,_e.createPortal)((0,n.BX)("div",Te({ref:s,role:"alertdialog","aria-label":l,css:Te(Te({},se),{top:"".concat(f,"px"),left:"".concat(p,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("p",Te({css:de},{children:l})),(0,n.BX)("div",Te({css:fe},{children:[(0,n.tZ)("button",Te({type:"button",css:pe,onClick:function(e){e.stopPropagation(),i()}},{children:"Cancel"})),(0,n.tZ)("button",Te({type:"button",css:he,onClick:function(e){e.stopPropagation(),r()}},{children:u}))]}))]})),(0,Ie.me)().body)}var Oe=function(){return Oe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Oe.apply(this,arguments)},We=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function ze(){return(0,n.BX)("svg",Oe({width:"16",height:"16",fill:"currentColor",viewBox:"0 0 24 24"},{children:[(0,n.tZ)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"19",r:"2"})]}))}function Ve(e){var t,r=e.value,a=e.fieldKey,l=e.rowIndex,c=e.onEdit,u=e.onClear,s=We((0,o.useState)(!1),2),d=s[0],f=s[1],p=We((0,o.useState)(""),2),h=p[0],g=p[1],v=We((0,o.useState)(!1),2),y=v[0],b=v[1],x=We((0,o.useState)(!1),2),m=x[0],w=x[1],C=We((0,o.useState)({top:0,left:0}),2),k=C[0],S=C[1],Z=(0,o.useRef)(null),R=(0,o.useRef)(null),P=(0,o.useRef)(null),_=(0,o.useRef)(!0),B=(0,o.useCallback)((function(){return w(!1)}),[]),I=null!==(t=(0,i.e7)(r))&&void 0!==t?t:"",L=""===I;(0,o.useEffect)((function(){d&&Z.current&&Z.current.focus()}),[d]),(0,o.useEffect)((function(){if(y){var e=function(e){P.current&&!P.current.contains(e.target)&&R.current&&!R.current.contains(e.target)&&b(!1)},t=function(){return b(!1)},r=(0,Ie.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[y]);var A=function(){g(I),f(!0),b(!1)},E=function(){h!==I&&c(a,l,h),f(!1)};return d?(0,n.BX)("div",Oe({css:oe},{children:[(0,n.tZ)("div",Oe({css:ie},{children:"".concat(h,"")})),(0,n.tZ)("textarea",{ref:Z,value:h,onChange:function(e){return g(e.target.value)},onBlur:function(){_.current&&E(),_.current=!0},onKeyDown:function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_.current=!1,E()):"Escape"===e.key?(e.preventDefault(),_.current=!1,f(!1)):"Tab"===e.key&&(_.current=!1,E())},css:Oe(Oe({},te),ae),onClick:function(e){return e.stopPropagation()}})]})):L?(0,n.tZ)("span",Oe({css:ee,onClick:A},{children:"Click to edit"})):(0,n.BX)("div",Oe({css:re},{children:[(0,n.tZ)("span",Oe({css:ne},{children:I})),(0,n.tZ)("button",Oe({ref:R,type:"button","aria-expanded":y,"aria-haspopup":"menu",css:le,onClick:function(e){if(e.stopPropagation(),!y&&R.current){var t=R.current.getBoundingClientRect();S({top:t.bottom+4,left:t.right})}b(!y)}},{children:(0,n.tZ)(ze,{})})),y&&(0,_e.createPortal)((0,n.BX)("div",Oe({ref:P,role:"menu",css:Oe(Oe({},W),{top:"".concat(k.top,"px"),left:"".concat(k.left,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),A()}},{children:"Edit Value"})),(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),b(!1),w(!0)}},{children:"Clear Field"}))]})),(0,Ie.me)().body),m&&(0,n.tZ)(Xe,{anchorEl:R.current,message:"Clear this field?",confirmLabel:"Clear",onConfirm:function(){B(),u(a,l)},onCancel:B})]}))}var Fe=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ne(e){var t,r=function(e){if(null==e||""===e)return null;var t=String(e).trim().replace(/[$€£¥]/g,"").replace(/[,%]/g,"").replace(/\s/g,""),r=parseFloat(t);return isNaN(r)?null:r}(e),n=function(e){var t,r,n,o;if(null==e||""===e)return null;var i=String(e).trim(),a=new Date(i);if(!isNaN(a.getTime()))return a;try{for(var l=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}([/^(\d{1,2})[/-](\d{1,2})[/-](\d{2,4})$/,/^(\d{4})[/-](\d{1,2})[/-](\d{1,2})$/]),c=l.next();!c.done;c=l.next()){var u=c.value,s=i.match(u);if(s){var d=void 0,f=void 0,p=void 0;4===s[1].length?(d=(n=Fe(s,4))[1],f=n[2],p=n[3]):(f=(o=Fe(s,4))[1],p=o[2],d=o[3]),2===d.length&&(d=parseInt(d)<50?"20".concat(d):"19".concat(d));var h=new Date(parseInt(d),parseInt(f)-1,parseInt(p));if(!isNaN(h.getTime()))return h}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return null}(e);return{original:e,asNumber:r,asDate:n,asString:null!==(t=(0,i.e7)(e))&&void 0!==t?t:""}}function Qe(e,t){return null!==e.asNumber&&null!==t.asNumber?e.asNumber-t.asNumber:null!==e.asDate&&null!==t.asDate?e.asDate.getTime()-t.asDate.getTime():e.asString.localeCompare(t.asString)}var He=function(){return He=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},He.apply(this,arguments)},Ke=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ye=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},$e=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function qe(e){return"".concat("__feathery_table_page_").concat(e)}var Ge=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},Je=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Ue=r(5096),et=function(){return et=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},et.apply(this,arguments)},tt=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};const rt=function(e){var t=e.element,r=e.responsiveStyles,a=e.onClick,l=void 0===a?function(){}:a,c=e.updateFieldValues,u=void 0===c?function(){}:c,s=e.submitCustom,d=void 0===s?function(){}:s,f=e.editMode,p=void 0!==f&&f,h=e.buttonLoaders,g=void 0===h?{}:h,v=(0,o.useMemo)((function(){return function(e){return e.addTargets("table","thead","tbody","th","td","tr"),e}(r)}),[r]),y=tt((0,o.useState)(0),2),b=y[0],m=y[1],k=(0,o.useCallback)((function(){return m((function(e){return e+1}))}),[]),S=function(e){var t,r,n,a,l,c,u,s,d,f,p,h,g,v,y=e.element,b=e.editMode,x=void 0!==b&&b,m=e.dataVersion,w=void 0===m?0:m,C=(null===(t=y.properties)||void 0===t?void 0:t.columns)||[],k=((null===(r=y.properties)||void 0===r?void 0:r.actions)||[]).filter((function(e){return e.label&&""!==e.label.trim()})),S=null!==(a=null===(n=y.properties)||void 0===n?void 0:n.search)&&void 0!==a&&a,Z=null!==(c=null===(l=y.properties)||void 0===l?void 0:l.sort)&&void 0!==c&&c,R=null!==(s=null===(u=y.properties)||void 0===u?void 0:u.transpose)&&void 0!==s&&s,P=null!==(f=null===(d=y.properties)||void 0===d?void 0:d.enable_editing)&&void 0!==f&&f,_=null!==(h=null===(p=y.properties)||void 0===p?void 0:p.add_delete_rows)&&void 0!==h&&h,B=null!==(v=null===(g=y.properties)||void 0===g?void 0:g.pagination)&&void 0!==v?v:0,I="number"==typeof B&&B>0?Math.floor(B):0,L=I>0,A=(0,o.useMemo)((function(){var e=C;return x&&(e=e.map((function(e,t){return He(He({},e),{field_key:"example_column_".concat(t)})}))),e}),[x,C]),E=(0,o.useMemo)((function(){return x?function(e,t){void 0===t&&(t=2);var r={};return e.forEach((function(e){r[e.field_key]=Array(t).fill("Sample")})),r}(A):He({},Be.u4)}),[x,A,w]),D=Ye((0,o.useState)(""),2),M=D[0],j=D[1],T=Ye((0,o.useState)(null),2),X=T[0],O=T[1],W=Ye((0,o.useState)("asc"),2),z=W[0],V=W[1],F=Ye((0,o.useState)((function(){return function(e){var t=qe(e),r=sessionStorage.getItem(t);if(!r)return 0;var n=parseInt(r,10);return Number.isInteger(n)&&n>=0?n:0}(y.id)})),2),N=F[0],Q=F[1],H=(0,o.useMemo)((function(){return A.reduce((function(e,t){var r=E[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[A,E]),K=(0,o.useMemo)((function(){return Array.from({length:H},(function(e,t){return t}))}),[H]),Y=(0,o.useMemo)((function(){return R&&S&&M.trim()?K.filter((function(e){return A.some((function(t){var r,n=E[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):K}),[R,K,A,M,S,E]),$=Ye((0,o.useState)(null),2),q=$[0],G=$[1],J=(0,o.useMemo)((function(){if(!R||!Z||null===q)return Y;var e=A[q];return e?$e([],Ye(Y),!1).sort((function(t,r){var n=E[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):Y}),[R,Y,q,z,A,E,Z]),U=(0,o.useMemo)((function(){if(!R||!L)return J;var e=N*I,t=e+I;return J.slice(e,t)}),[R,J,N,I,L]),ee=(0,o.useMemo)((function(){if(!R||0===H)return{columns:A,activeFieldValues:E,transposedRowIndices:[]};var e=function(e,t,r,n){var o,i,a,l,c,u,s=n||Array.from({length:r},(function(e,t){return t})),d=[{name:"",field_id:"_transpose_field_name",field_type:"text",field_key:"_transpose_field_name"}];try{for(var f=Ke(s),p=f.next();!p.done;p=f.next()){var h=p.value;d.push({name:"",field_id:"_transpose_row_".concat(h),field_type:"text",field_key:"_transpose_row_".concat(h),originalRowIndex:h})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}var g={_transpose_field_name:e.map((function(e){return e.name}))};try{for(var v=Ke(s),y=v.next();!y.done;y=v.next()){h=y.value;var b=[];try{for(var x=(c=void 0,Ke(e)),m=x.next();!m.done;m=x.next()){var w=t[m.value.field_key],C=Array.isArray(w)?w[h]:w;b.push(C)}}catch(e){c={error:e}}finally{try{m&&!m.done&&(u=x.return)&&u.call(x)}finally{if(c)throw c.error}}g["_transpose_row_".concat(h)]=b}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}return{transposedColumns:d,transposedFieldValues:g,includedRowIndices:s}}(A,E,H,U);return{columns:e.transposedColumns,activeFieldValues:e.transposedFieldValues,transposedRowIndices:e.includedRowIndices}}),[R,A,E,H,U]),te=ee.columns,re=ee.activeFieldValues,ne=ee.transposedRowIndices,oe=(0,o.useMemo)((function(){return te.reduce((function(e,t){var r=re[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[te,re]),ie=(0,o.useMemo)((function(){return Array.from({length:oe},(function(e,t){return t}))}),[oe]),ae=(0,o.useMemo)((function(){return R?ie:S&&M.trim()?ie.filter((function(e){return te.some((function(t){var r,n=re[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):ie}),[R,ie,te,M,S,re]),le=(0,o.useMemo)((function(){if(R)return ae;if(!Z||!X)return ae;var e=te.find((function(e){return e.name===X}));return e?$e([],Ye(ae),!1).sort((function(t,r){var n=re[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):ae}),[R,ae,X,z,te,Z,re]),ce=(0,o.useMemo)((function(){if(R)return ie;if(!L)return le;var e=N*I,t=e+I;return le.slice(e,t)}),[R,ie,le,N,I,L]),ue=(0,o.useRef)({initialMount:!0,search:"",sortColumn:"",sortDirection:""});(0,o.useEffect)((function(){var e=ue.current;if(e.initialMount)return e.initialMount=!1,e.search=M,e.sortColumn=X,void(e.sortDirection=z);M===e.search&&X===e.sortColumn&&z===e.sortDirection||(Q(0),e.search=M,e.sortColumn=X,e.sortDirection=z)}),[M,X,z]);var se=R?J.length:le.length,de=L?Math.ceil(se/I):1;(0,o.useEffect)((function(){var e,t,r;y.id&&(e=y.id,t=N,r=qe(e),sessionStorage.setItem(r,t.toString()))}),[y.id,N]),(0,o.useEffect)((function(){de>0&&N>=de&&Q(de-1)}),[de]);var fe=oe>0,pe=R?Y.length>0:ae.length>0;return{enableSearch:S,searchQuery:M,hasSearchResults:pe,setSearchQuery:j,enableSort:Z,sortColumn:X,sortDirection:z,sortedColumnIndex:q,handleSort:function(e){Z&&(X===e?"asc"===z?V("desc"):(O(null),V("asc")):(O(e),V("asc")))},handleTransposedSort:function(e){Z&&R&&(q===e?"asc"===z?V("desc"):(G(null),V("asc")):(G(e),V("asc")))},enablePagination:L,currentPage:N,paginatedRowIndices:ce,rowsPerPage:I,setCurrentPage:Q,columns:te,actions:k,isTransposed:R&&H>0,transposedRowIndices:ne,enableEditing:P,enableAddDeleteRows:_,totalRows:se,totalPages:de,hasData:fe,activeFieldValues:re,baseColumns:A,baseFieldValues:E}}({element:t,editMode:p,dataVersion:b}),Z=S.enableSearch,R=S.searchQuery,P=S.setSearchQuery,E=S.enableSort,D=S.sortColumn,M=S.sortDirection,j=S.sortedColumnIndex,T=S.handleSort,X=S.handleTransposedSort,O=S.enablePagination,W=S.currentPage,z=S.setCurrentPage,V=S.paginatedRowIndices,F=S.rowsPerPage,N=S.enableEditing,Q=S.enableAddDeleteRows,H=S.columns,K=S.actions,Y=S.isTransposed,$=S.transposedRowIndices,q=S.totalRows,G=S.totalPages,ee=S.hasData,te=S.hasSearchResults,re=S.activeFieldValues,ne=S.baseColumns,oe=S.baseFieldValues,ie=function(e){var t=e.columns,r=e.updateFieldValues,n=e.submitCustom,i=e.editMode,a=e.editModeFieldValues,l=e.enablePagination,c=e.setCurrentPage,u=e.setSearchQuery,s=e.searchQuery,d=e.onMutate,f=(0,o.useRef)(a);f.current=a;var p=(0,o.useCallback)((function(e){var t=(i?f.current:Be.u4)[e];return Array.isArray(t)?t:[]}),[i]),h=(0,o.useCallback)((function(){var e={};t.forEach((function(t){var r=p(t.field_key);e[t.field_key]=Je([""],Ge(r),!1)})),s&&u(""),r(e),d(),l&&c(0)}),[t,p,r,d,l,c,u,s]),g=(0,o.useCallback)((function(e){var r={};return t.forEach((function(t){var n=p(t.field_key);r[t.field_key]=n.filter((function(t,r){return r!==e}))})),r}),[t,p]),v=(0,o.useCallback)((function(e){var t=g(e);r(t),i||n(t),d()}),[g,r,n,i,d]),y=(0,o.useCallback)((function(e){var t=g(e);r(t),d()}),[g,r,d]),b=(0,o.useCallback)((function(e,t,o){var a,l=p(e),c=Je([],Ge(l),!1);c[t]=o;var u=((a={})[e]=c,a);r(u),i||n(u),d()}),[p,r,n,i,d]),x=(0,o.useCallback)((function(e,t){b(e,t,"")}),[b]);return{handleAddRow:h,handleDeleteRow:v,handleRemoveRowLocal:y,handleCellEdit:b,handleCellClear:x}}({columns:ne,updateFieldValues:u,submitCustom:d,editMode:p,editModeFieldValues:re,enablePagination:O,setCurrentPage:z,setSearchQuery:P,searchQuery:R,onMutate:k}),ae=ie.handleAddRow,le=ie.handleDeleteRow,se=ie.handleCellEdit,de=ie.handleCellClear,fe=N&&!Y,pe=fe&&Q,he=fe&&Q,ge=K.length>1,ve=he&&!ge,be=tt((0,o.useState)(new Set),2),we=be[0],Ce=be[1],ke=(0,o.useRef)(we);ke.current=we;var Se=(0,o.useCallback)((function(e,t,r){ke.current.has(t)&&Ce((function(e){var r=new Set(e);return r.delete(t),r})),se(e,t,r)}),[se]),Ze=tt((0,o.useState)(null),2),Re=Ze[0],_e=Ze[1],Ie=(0,o.useRef)(W);Ie.current!==W&&(Ie.current=W,_e(null));var Le=(0,o.useCallback)((function(){return _e(null)}),[]),Ae=(0,o.useRef)(new Map),Ee=(0,o.useRef)(new Map),Me=!ee||!te,Te=Z||pe;return(0,n.BX)("div",et({css:et(et({},C),v.getTarget("container"))},{children:[Te&&(0,n.BX)("div",et({css:J},{children:[Z?(0,n.tZ)(ye,{searchQuery:R,onSearchChange:P}):(0,n.tZ)("div",{}),pe&&(0,n.tZ)("button",et({type:"button",css:U,onClick:function(){_e(null),ae(),Ce((function(e){var t=new Set;return t.add(0),e.forEach((function(e){return t.add(e+1)})),t}))}},{children:"+ Add Row"}))]})),Me?(0,n.tZ)(je,{hasSearchQuery:R.trim().length>0}):(0,n.tZ)("div",et({css:{overflowX:"auto"}},{children:(0,n.BX)("table",et({css:et(et({},_),v.getTarget("table"))},{children:[!Y&&(0,n.tZ)("thead",et({css:B},{children:(0,n.BX)("tr",{children:[(0,n.tZ)(me,{columns:H,enableSort:E,sortColumn:D,sortDirection:M,onSort:T,styles:v}),K.length>0&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),{paddingLeft:0}),v.getTarget("th"))}),ve&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),ce),v.getTarget("th"))})]})})),(0,n.BX)("tbody",et({css:v.getTarget("tbody")},{children:[V.map((function(e){var r,o,a={};return Y||H.forEach((function(t){var r=re[t.field_key],n=Array.isArray(r)?r[e]:r;a[t.name]=n})),(0,n.BX)("tr",et({css:et(et({},L),v.getTarget("tr")),onClick:function(){Y||fe||l({rowIndex:e,rowData:a})}},{children:[H.map((function(t,r){var o,a,c=re[t.field_key],u=Array.isArray(c)?c[e]:c,s=Y&&0===r,d=s&&E,f=j===e,p=0===r,h=1===r,g=Y&&!s?t.originalRowIndex:void 0,y=s?et(et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),v.getTarget("th")),d?{cursor:"pointer"}:{}):et(et(et(et({},A),Y?h?{}:{paddingLeft:0}:p?{}:{paddingLeft:0}),Y&&!s?{cursor:"pointer"}:{}),v.getTarget("td")),b=s?"th":"td";return(0,n.tZ)(b,et({css:y,onClick:function(t){if(d)X(e);else if(Y&&void 0!==g){t.stopPropagation();var r={};ne.forEach((function(e){var t=oe[e.field_key],n=Array.isArray(t)?t[g]:t;r[e.name]=n})),l({rowIndex:g,rowData:r})}}},s?{scope:"row"}:{},{children:s&&d?(0,n.BX)("div",et({css:et(et({},w),{justifyContent:"space-between"})},{children:[(0,n.tZ)("span",{children:null!==(o=(0,i.e7)(u))&&void 0!==o?o:""}),(0,n.tZ)("span",et({css:x},{children:(0,n.tZ)(xe,{isSorted:f,sortDirection:M})}))]})):fe?(0,n.tZ)(Ve,{value:u,fieldKey:t.field_key,rowIndex:e,onEdit:Se,onClear:de}):null!==(a=(0,i.e7)(u))&&void 0!==a?a:""}),r)})),!Y&&K.length>0&&(0,n.BX)("td",et({ref:function(t){t?Ee.current.set(e,t):Ee.current.delete(e)},css:et(et(et({},A),{paddingLeft:0}),v.getTarget("td"))},{children:[(0,n.tZ)(De,{actions:K,rowIndex:e,columnData:ne,fieldValues:oe,onClick:l,tableId:t.id,buttonLoaders:g,canDeleteRows:he&&ge,onDeleteRow:function(e){return _e(e)}}),ge&&he&&Re===e&&(0,n.tZ)(Xe,{anchorEl:null!==(r=Ee.current.get(e))&&void 0!==r?r:null,onConfirm:function(){le(e),_e(null)},onCancel:Le})]})),ve&&(0,n.BX)("td",et({css:et(et({},ce),v.getTarget("td"))},{children:[(0,n.tZ)("button",et({type:"button",ref:function(t){t?Ae.current.set(e,t):Ae.current.delete(e)},css:et(et({},ue),Re===e&&{opacity:1}),onClick:function(t){t.stopPropagation(),_e(Re===e?null:e)}},{children:(0,n.tZ)(Ue.XH,{})})),Re===e&&(0,n.tZ)(Xe,{anchorEl:null!==(o=Ae.current.get(e))&&void 0!==o?o:null,onConfirm:function(){le(e),_e(null)},onCancel:Le})]}))]}),e)})),Y&&K.length>0&&(0,n.BX)("tr",et({css:et(et({},L),v.getTarget("tr"))},{children:[(0,n.tZ)("th",{scope:"row",css:et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),v.getTarget("th"))}),$.map((function(e,r){return(0,n.tZ)("td",et({css:et(et(et({},A),0===r?{}:{paddingLeft:0}),v.getTarget("td"))},{children:(0,n.tZ)("div",et({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,n.tZ)(De,{actions:K,rowIndex:e,columnData:ne,fieldValues:oe,onClick:l,forceInlineButtons:!0,tableId:t.id,buttonLoaders:g})}))}),e)}))]}))]}))]}))})),!Me&&O&&(0,n.tZ)(Pe,{currentPage:W,totalPages:G,totalItems:q,rowsPerPage:F,onPageChange:z})]}))}}}]);
|