All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.KeycloakDataTable-jyvvxdb8.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsxs as k,Fragment as re,jsx as s}from"react/jsx-runtime";import{useState as b,useRef as ae,useId as Re,useMemo as we,useEffect as Ae,isValidElement as Te}from"react";import{n as Ee,cI as Ie,cJ as xe,cK as Le,cL as De,cM as Pe,cN as je,cO as Oe,cj as Fe,a as le,cP as Ne,v as Ve,a2 as ie,h as _e,B as Me,a3 as ve,cQ as B,bD as ze}from"./index-C1LIsRX7.js";import{P as Be,L as Ke}from"./PaginatingTableToolbar-CpMLQtqt.js";import{U as Ge,a2 as $e,V as He,W as K,X as Q,Y as oe,Z as j,a4 as Ue,$ as Ye}from"./Td-BwjBKSkH.js";import{b as Ze,a as Je}from"./_baseFlatten-BHAcGTxk.js";const Qe={name:"SyncAltIcon",height:512,width:512,svgPath:"M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z",yOffset:0,xOffset:0},We=Ee(Qe);function W(o){return Ie(o)&&xe(o)}var Xe=200;function qe(o,t,c,y){var L=-1,R=je,w=!0,f=o.length,S=[],m=t.length;if(!f)return S;c&&(t=Le(t,De(c))),t.length>=Xe&&(R=Oe,w=!1,t=new Pe(t));e:for(;++L{const t=c=>!!c&&c.title!==void 0;return o.cells.map((c,y)=>s(j,{children:t(c)?c.title:c},`cell-${y}`))};function nt({columns:o,rows:t,actions:c,actionResolver:y,ariaLabelKey:L,onSelect:R,onCollapse:w,canSelectAll:f,isNotCompact:S,isRadio:m,...d}){const{t:h}=le(),[g,G]=b([]),[P,$]=b([]),N=(a,n)=>{const u=[...a===-1?Array(t.length).fill(n):g];u[a]=n,G(u)};return Ae(()=>{if(f){const a=document.getElementsByName("check-all").item(0);if(a){const n=a,u=g.filter(p=>p===!0);n.indeterminate=u.length0}}},[g]),k(Ge,{...d,variant:S?void 0:$e.compact,"aria-label":h(L),children:[s(He,{children:k(K,{children:[w&&s(Q,{}),f&&s(Q,{select:m?void 0:{onSelect:(a,n,u)=>{R(n,u),N(-1,n)},isSelected:g.filter(a=>a===!0).length===t.length}}),o.map(a=>s(Q,{"aria-label":h(L),className:a.transforms?.[0]().className,children:h(a.displayKey||a.name)},a.displayKey))]})}),w?t.map((a,n)=>s(oe,{children:n%2===0?k(K,{children:[s(j,{expand:{isExpanded:!!P[n],rowIndex:n,expandId:`${n}`,onToggle:(u,p,A)=>{w(A,p);const V=[...P];V[n]=A,$(V)}}}),s(X,{row:a})]}):k(K,{isExpanded:!!P[n-1],children:[s(j,{}),s(j,{colSpan:o.length,children:s(Ye,{children:s(X,{row:a})})})]})},n)):s(oe,{children:t.map((a,n)=>k(K,{isExpanded:P[n],children:[R&&s(j,{select:{rowIndex:n,onSelect:(u,p,A)=>{R(p,A),N(A,p)},isSelected:g[n],variant:m?"radio":"checkbox"}}),s(X,{row:a}),(c||y)&&s(j,{isActionCell:!0,children:s(Ue,{items:c||y?.(a,{}),extraData:{rowIndex:n}})})]},n))})]})}function lt({ariaLabelKey:o,searchPlaceholderKey:t,isPaginated:c=!1,onSelect:y,canSelectAll:L=!1,isNotCompact:R,isRadio:w,detailColumns:f,isRowDisabled:S,loader:m,columns:d,actions:h,actionResolver:g,searchTypeComponent:G,toolbarItem:P,subToolbar:$,emptyState:N,icon:a,isSearching:n=!1,...u}){const{t:p}=le(),[A,V]=b([]),[_,M]=b(),[H,fe]=b(),[O,q]=b(!1),[de,he]=Ne(localStorage,"pageSize",10),[T,pe]=b(de),[C,F]=b(0),[E,U]=b(""),ee=ae(),[v,ue]=b(0),te=ae(),ne=()=>ue(v+1),me=Re(),se=(e,i)=>e.map(r=>{if("cellFormatters"in r){const I=B(i,r.name);return r.cellFormatters?.reduce((x,l)=>l(x),I)}if(r.cellRenderer){const I=r.cellRenderer;return{title:s(I,{...i})}}return B(i,r.name)}),ce=e=>{const i=r=>f?.[0]?.enabled?.(r);return e.map((r,I)=>{const x=S?S(r):!1,l=[{data:r,disableSelection:x,disableActions:x,selected:!!A.find(ke=>B(ke,"id")===B(r,"id")),isOpen:i(r)?!1:void 0,cells:se(d,r)}];return f&&l.push({parent:I*2,cells:i(r)?se(f,r):[]}),l}).flat()},Y=e=>["string","number"].includes(typeof e)?e.toString():e instanceof Array?e.map(Y).join(""):typeof e=="object"?Y(Te(e.title)?e.title.props:Object.values(e)):"",Z=we(()=>E===""||c?void 0:ce(H||[]).filter(e=>e.cells.some(i=>i&&Y(i).toLowerCase().includes(E.toLowerCase()))).slice(C,C+T+1),[E,C,T]);Ve(async()=>{q(!0);const e=ee.current===""&&E!=="";return e&&F(0),ee.current=E,typeof m=="function"?v===te.current&&H?H:await m(e?0:C,T+1,E):m},e=>{te.current=v,c||(fe(e),e.length>C?e=e.slice(C,C+T+1):F(0));const i=ce(e);M(i),q(!1)},[v,C,T,E,typeof m!="function"?m:void 0]);const ge=()=>h&&ze(h).map((e,i)=>(delete e.onRowClick,e.onClick=async(r,I)=>{await h[i].onRowClick((Z||_)[I].data)&&(c||U(""),ne())},e)),be=(e,i)=>{const r=Z||_;i===-1?M(r.map(l=>(l.selected=e,l))):(r[i].selected=e,M([..._]));const x=[...tt(A,r.map(l=>l.data),"id"),...r.filter(l=>l.selected).map(l=>l.data)];V(x),y(x)},ye=(e,i)=>{D[i].isOpen=e,M([...D])},D=Z||_,z=!D||D.length===0,J=E!==""||n,Se=f?T*2:T,Ce=f?(D?.length||0)/2:D?.length||0;return k(re,{children:[(O||!z||J)&&k(Be,{id:me,count:Ce,first:C,max:T,onNextClick:F,onPreviousClick:F,onPerPageSelect:(e,i)=>{F(e),pe(i),he(i)},inputGroupName:t?`${o}input`:void 0,inputGroupOnEnter:U,inputGroupPlaceholder:p(t||""),searchTypeComponent:G,toolbarItem:k(re,{children:[P," ",s(ie,{variant:"separator"})," ",s(ie,{children:k(_e,{variant:"link",onClick:ne,children:[s(We,{})," ",p("refresh")]})})]}),subToolbar:$,children:[!O&&!z&&s(nt,{...u,canSelectAll:L,onSelect:y?be:void 0,onCollapse:f?ye:void 0,actions:ge(),actionResolver:g,rows:D.slice(0,Se),columns:d,isNotCompact:R,isRadio:w,ariaLabelKey:o}),!O&&z&&J&&s(Ke,{hasIcon:!0,icon:a,isSearchVariant:!0,message:p("noSearchResults"),instructions:p("noSearchResultsInstructions"),secondaryActions:n?[]:[{text:p("clearAllFilters"),onClick:()=>U(""),type:Me.link}]}),O&&s(ve,{})]}),!O&&z&&!J&&N]})}export{lt as K,tt as d,W as i,et as l};
//# sourceMappingURL=KeycloakDataTable-jyvvxdb8.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy