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

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

import{jsxs as S,Fragment as ce,jsx as r}from"react/jsx-runtime";import*as ke from"react";import{useState as b,useRef as ae,useId as Ee,useMemo as Ae,useEffect as Te,isValidElement as xe}from"react";import{o as Ie,cI as Le,cJ as De,cK as je,cL as Ne,cM as Oe,cN as Pe,cO as _e,cj as Fe,_ as Ve,m as ve,a as le,cP as Ke,w as Me,a2 as ie,i as ze,B as Be,a3 as Ge,cQ as z,bD as $e}from"./main-C7ps2lmX.js";import{P as He,L as Ue}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{$ as Ye,U as Ze,a1 as Je,V as Qe,W as B,X as Q,Y as oe,Z as N,a2 as We}from"./Td-D2hVFK0Z.js";import{b as Xe,a as qe}from"./_baseFlatten-eIEJR-AJ.js";const et={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},tt=Ie(et);function W(c){return Le(c)&&De(c)}var nt=200;function st(c,t,n,y){var D=-1,w=Pe,k=!0,f=c.length,C=[],m=t.length;if(!f)return C;n&&(t=je(t,Ne(n))),t.length>=nt&&(w=_e,k=!1,t=new Oe(t));e:for(;++D{var{children:t=null}=c,n=Ve(c,["children"]);return ke.createElement("div",Object.assign({},n,{className:ve(Ye.tableExpandableRowContent)}),t)};fe.displayName="ExpandableRowContent";const X=({row:c})=>{const t=n=>!!n&&n.title!==void 0;return c.cells.map((n,y)=>r(N,{children:t(n)?n.title:n},`cell-${y}`))};function at({columns:c,rows:t,actions:n,actionResolver:y,ariaLabelKey:D,onSelect:w,onCollapse:k,canSelectAll:f,isNotCompact:C,isRadio:m,...d}){const{t:p}=le(),[g,G]=b([]),[j,$]=b([]),_=(i,s)=>{const u=[...i===-1?Array(t.length).fill(s):g];u[i]=s,G(u)};return Te(()=>{if(f){const i=document.getElementsByName("check-all").item(0);if(i){const s=i,u=g.filter(h=>h===!0);s.indeterminate=u.length0}}},[g]),S(Ze,{...d,variant:C?void 0:Je.compact,"aria-label":p(D),children:[r(Qe,{children:S(B,{children:[k&&r(Q,{}),f&&r(Q,{select:m?void 0:{onSelect:(i,s,u)=>{w(s,u),_(-1,s)},isSelected:g.filter(i=>i===!0).length===t.length}}),c.map(i=>r(Q,{className:i.transforms?.[0]().className,children:p(i.displayKey||i.name)},i.displayKey))]})}),k?t.map((i,s)=>r(oe,{children:s%2===0?S(B,{children:[r(N,{expand:{isExpanded:!!j[s],rowIndex:s,expandId:`${s}`,onToggle:(u,h,E)=>{k(E,h);const F=[...j];F[s]=E,$(F)}}}),r(X,{row:i})]}):S(B,{isExpanded:!!j[s-1],children:[r(N,{}),r(N,{colSpan:c.length,children:r(fe,{children:r(X,{row:i})})})]})},s)):r(oe,{children:t.map((i,s)=>S(B,{isExpanded:j[s],children:[w&&r(N,{select:{rowIndex:s,onSelect:(u,h,E)=>{w(h,E),_(E,h)},isSelected:g[s],variant:m?"radio":"checkbox"}}),r(X,{row:i}),(n||y)&&r(N,{isActionCell:!0,children:r(We,{items:n||y?.(i,{}),extraData:{rowIndex:s}})})]},s))})]})}function pt({ariaLabelKey:c,searchPlaceholderKey:t,isPaginated:n=!1,onSelect:y,canSelectAll:D=!1,isNotCompact:w,isRadio:k,detailColumns:f,isRowDisabled:C,loader:m,columns:d,actions:p,actionResolver:g,searchTypeComponent:G,toolbarItem:j,subToolbar:$,emptyState:_,icon:i,isSearching:s=!1,...u}){const{t:h}=le(),[E,F]=b([]),[V,v]=b(),[H,de]=b(),[O,q]=b(!1),[he,pe]=Ke(localStorage,"pageSize",10),[A,ue]=b(he),[R,P]=b(0),[T,U]=b(""),ee=ae(),[K,me]=b(0),te=ae(),ne=()=>me(K+1),ge=Ee(),se=(e,o)=>e.map(a=>{if("cellFormatters"in a){const x=z(o,a.name);return a.cellFormatters?.reduce((I,l)=>l(I),x)}if(a.cellRenderer){const x=a.cellRenderer;return{title:r(x,{...o})}}return z(o,a.name)}),re=e=>{const o=a=>f?.[0]?.enabled?.(a);return e.map((a,x)=>{const I=C?C(a):!1,l=[{data:a,disableSelection:I,disableActions:I,selected:!!E.find(we=>z(we,"id")===z(a,"id")),isOpen:o(a)?!1:void 0,cells:se(d,a)}];return f&&l.push({parent:x*2,cells:o(a)?se(f,a):[]}),l}).flat()},Y=e=>["string","number"].includes(typeof e)?e.toString():e instanceof Array?e.map(Y).join(""):typeof e=="object"?Y(xe(e.title)?e.title.props:Object.values(e)):"",Z=Ae(()=>T===""||n?void 0:re(H||[]).filter(e=>e.cells.some(o=>o&&Y(o).toLowerCase().includes(T.toLowerCase()))).slice(R,R+A+1),[T,R,A]);Me(async()=>{q(!0);const e=ee.current===""&&T!=="";return e&&P(0),ee.current=T,typeof m=="function"?K===te.current&&H?H:await m(e?0:R,A+1,T):m},e=>{te.current=K,n||(de(e),e.length>R?e=e.slice(R,R+A+1):P(0));const o=re(e);v(o),q(!1)},[K,R,A,T,typeof m!="function"?m:void 0]);const be=()=>p&&$e(p).map((e,o)=>(delete e.onRowClick,e.onClick=async(a,x)=>{await p[o].onRowClick((Z||V)[x].data)&&(n||U(""),ne())},e)),ye=(e,o)=>{const a=Z||V;o===-1?v(a.map(l=>(l.selected=e,l))):(a[o].selected=e,v([...V]));const I=[...ct(E,a.map(l=>l.data),"id"),...a.filter(l=>l.selected).map(l=>l.data)];F(I),y(I)},Ce=(e,o)=>{L[o].isOpen=e,v([...L])},L=Z||V,M=!L||L.length===0,J=T!==""||s,Re=f?A*2:A,Se=f?(L?.length||0)/2:L?.length||0;return S(ce,{children:[(O||!M||J)&&S(He,{id:ge,count:Se,first:R,max:A,onNextClick:P,onPreviousClick:P,onPerPageSelect:(e,o)=>{P(e),ue(o),pe(o)},inputGroupName:t?`${c}input`:void 0,inputGroupOnEnter:U,inputGroupPlaceholder:h(t||""),searchTypeComponent:G,toolbarItem:S(ce,{children:[j," ",r(ie,{variant:"separator"})," ",r(ie,{children:S(ze,{variant:"link",onClick:ne,children:[r(tt,{})," ",h("refresh")]})})]}),subToolbar:$,children:[!O&&!M&&r(at,{...u,canSelectAll:D,onSelect:y?ye:void 0,onCollapse:f?Ce:void 0,actions:be(),actionResolver:g,rows:L.slice(0,Re),columns:d,isNotCompact:w,isRadio:k,ariaLabelKey:c}),!O&&M&&J&&r(Ue,{hasIcon:!0,icon:i,isSearchVariant:!0,message:h("noSearchResults"),instructions:h("noSearchResultsInstructions"),secondaryActions:s?[]:[{text:h("clearAllFilters"),onClick:()=>U(""),type:Be.link}]}),O&&r(Ge,{})]}),!O&&M&&!J&&_]})}export{fe as E,pt as K,ct as d,W as i,rt as l};
//# sourceMappingURL=KeycloakDataTable-DbY4la1D.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy