@ansible/ansible-ui-framework 2.4.1306 → 2.4.1307
Sign up to get free protection for your applications and to get access to all the features.
- package/framework/components/useManagedItems.d.ts +1 -0
- package/index.js +2 -2
- package/index.umd.cjs +1 -1
- package/package.json +1 -1
@@ -16,6 +16,7 @@ export interface ManageItemsProps<ItemT extends object> {
|
|
16
16
|
saveFn?: (items: ItemT) => unknown;
|
17
17
|
loadFn?: (items: ItemT, data: unknown) => void;
|
18
18
|
hideSelection?: boolean;
|
19
|
+
onSubmit?: (items: ItemT[]) => void;
|
19
20
|
}
|
20
21
|
export declare function useManageItems<ItemT extends object>(options: ManageItemsProps<ItemT>): {
|
21
22
|
openManageItems: () => void;
|
package/index.js
CHANGED
@@ -38581,9 +38581,9 @@ function Awe(e) {
|
|
38581
38581
|
enabled: h.includes(g),
|
38582
38582
|
state: i ? i(g) : void 0
|
38583
38583
|
}));
|
38584
|
-
s(p), localStorage.setItem(e.id, JSON.stringify(p));
|
38584
|
+
s(p), localStorage.setItem(e.id, JSON.stringify(p)), e.onSubmit && e.onSubmit(d);
|
38585
38585
|
},
|
38586
|
-
[r, e
|
38586
|
+
[r, e, i]
|
38587
38587
|
);
|
38588
38588
|
return { openManageItems: () => n(
|
38589
38589
|
/* @__PURE__ */ m.jsx(
|
package/index.umd.cjs
CHANGED
@@ -453,7 +453,7 @@ ${o}${v}`}else p=`${g}${l}${h.join(" ")}${l}${v}`}return e&&(p+=bo(p,o,c(e)),a&&
|
|
453
453
|
row-gap: 16px;
|
454
454
|
justify-content: end;
|
455
455
|
}
|
456
|
-
`;function x6(e){const{itemCount:t,page:n,perPage:r,setPage:i,setPerPage:a,toolbarFilters:o,selectedItems:s,filterState:l,setFilterState:c,openColumnModal:u,sort:f,setSort:d,sortDirection:h,setSortDirection:p,sortOptions:g,clearAllFilters:v,perPageOptions:y}=e,b=x.useCallback(()=>{v?v():c&&c({})},[c,v]),_=on("md"),S=on("xxl"),{viewType:w,setViewType:O}=e;let{toolbarActions:E}=e;E=E??[];const[T,$]=x.useState(""),M=x.useCallback((W,F)=>i?i(F):null,[i]),A=x.useCallback((W,F)=>a?a(F):null,[a]),j=o!==void 0,P=E!==void 0&&E.length>0,D=e.showSelect===!0||s!==void 0&&E&&E.find(W=>"selection"in W&&W.selection===vt.Multiple);return D||j||P?t===void 0?m.jsx(k.Toolbar,{className:"page-table-toolbar border-bottom",style:{paddingBottom:_?void 0:8,paddingTop:_?void 0:8},children:m.jsx(b6,{children:m.jsx(k.ToolbarItem,{style:{width:"100%"},children:m.jsx(k.Skeleton,{height:"36px"})})})}):m.jsx(p6.Provider,{value:{activeGroup:T,setActiveGroup:$},children:m.jsx(k.Toolbar,{ouiaId:"page-toolbar",clearAllFilters:b,className:"page-table-toolbar border-bottom",style:{paddingBottom:_?void 0:8,paddingTop:_?void 0:8},inset:{default:"insetMd",sm:"insetMd",md:"insetMd",lg:"insetMd",xl:"insetLg","2xl":"insetLg"},children:m.jsxs(b6,{style:{paddingRight:S?12:4},children:[D&&m.jsx(k.ToolbarGroup,{children:m.jsx(k.ToolbarItem,{variant:"bulk-select",children:m.jsx(o6,{...e})})}),l&&c&&m.jsx(v6,{toolbarFilters:o,filterState:l,setFilterState:c,limitFiltersToOneOrOperation:e.limitFiltersToOneOrOperation}),e.toolbarContent,m.jsx(k.ToolbarGroup,{variant:"button-group",children:m.jsx(zo,{actions:E,selectedItems:s,wrapper:k.ToolbarItem})}),m.jsxs(rbe,{children:[m.jsx(Qye,{sort:f,setSort:d,sortDirection:h,setSortDirection:p,sortOptions:g}),w&&O&&m.jsx(nbe,{disableTableView:e.disableTableView,disableListView:e.disableListView,disableCardView:e.disableCardView,viewType:w,setViewType:O,openColumnModal:u}),!e.disablePagination&&!e.autoHidePagination&&S&&m.jsx(k.ToolbarItem,{visibility:{default:"hidden","2xl":"visible"},style:{marginLeft:24,alignSelf:"center"},children:m.jsx(k.Pagination,{variant:k.PaginationVariant.top,isCompact:!0,itemCount:t,perPage:r,page:n,onSetPage:M,onPerPageSelect:A,perPageOptions:y,style:{marginTop:-8,marginBottom:-8}})})]})]})})}):m.jsx(x.Fragment,{})}function ibe(e){const{t}=Ge(),n=t("Something went wrong"),r=t("Please refresh the page by using the button below."),i=t("Refresh"),{titleProp:a,message:o}=e;return m.jsxs(k.EmptyState,{isFullHeight:!0,children:[m.jsx(k.EmptyStateHeader,{titleText:m.jsx(m.Fragment,{children:a||n}),icon:m.jsx(k.EmptyStateIcon,{icon:ve.ExclamationCircleIcon,color:"var(--pf-v5-global--danger-color--100)"}),headingLevel:"h2"}),m.jsx(k.EmptyStateBody,{children:o}),m.jsxs(k.EmptyStateFooter,{children:[m.jsx(k.EmptyStateBody,{children:r}),m.jsx(k.Button,{variant:"primary",onClick:()=>window.location.reload(),children:i})]})]})}function abe(e){const{title:t,description:n,icon:r,button:i,footNote:a,image:o,variant:s,style:l}=e;return m.jsxs(k.EmptyState,{variant:s||k.EmptyStateVariant.full,style:l,isFullHeight:!0,children:[r&&m.jsx(k.EmptyStateIcon,{icon:r}),m.jsx(k.EmptyStateHeader,{titleText:m.jsx(m.Fragment,{children:t}),headingLevel:"h4","data-cy":"empty-state-title"}),m.jsx(k.EmptyStateBody,{"data-cy":e.description,children:n}),m.jsxs(k.EmptyStateFooter,{children:[i&&m.jsx(k.EmptyStateActions,{children:i}),o&&m.jsxs(m.Fragment,{children:[" ",m.jsx("br",{})," ",m.jsx(k.EmptyStateBody,{children:o})]}),a&&m.jsx(k.EmptyStateBody,{children:a})]})]})}function obe(e){const{button:t,description:n,title:r,variant:i}=e;return m.jsx(abe,{icon:t?ve.PlusCircleIcon:ve.CubesIcon,title:r,description:n,button:t,variant:i})}const _6=x.createContext({dialogs:[],clearDialogs:()=>{},pushDialog:e=>{},popDialog:()=>{}});function w6(e){const[t,n]=x.useState([]),r=x.useCallback(()=>n([]),[n]),i=x.useCallback(s=>n(l=>[...l,s]),[n]),a=x.useCallback(()=>n(s=>s.slice(0,-1)),[n]),o=x.useMemo(()=>({dialogs:t,clearDialogs:r,pushDialog:i,popDialog:a}),[r,t,a,i]);return m.jsxs(_6.Provider,{value:o,children:[t.length>0&&t[t.length-1],e.children]})}function S6(){return x.useContext(_6)}function Vi(){const{dialogs:e,clearDialogs:t,pushDialog:n}=S6(),r=x.useMemo(()=>e.length>0?e[e.length-1]:void 0,[e]),i=x.useCallback(a=>{t(),a!==void 0&&n(a)},[t,n]);return x.useMemo(()=>[r,i],[r,i])}function sbe(e,t,n){const{selectedItems:r,selectItem:i,unselectItem:a,isSelected:o,selectItems:s,unselectAll:l,allSelected:c}=Fb(e,t),{sorted:u,sort:f,setSort:d}=Rb(e),{filtered:h,setFilterFn:p}=Wb(u,t),{searched:g,search:v,setSearch:y,setSearchFn:b}=lbe(h,t,n==null?void 0:n.search),{paged:_,page:S,setPage:w,perPage:O,setPerPage:E}=Fc(g),T=x.useCallback(()=>s(_),[_,s]),$=x.useCallback(()=>s(g),[g,s]);return x.useMemo(()=>({allSelected:c,filtered:h,isSelected:o,page:S,paged:_,perPage:O,search:v,searched:g,selectAll:$,selectItem:i,selectPage:T,selectedItems:r,setFilterFn:p,setPage:w,setPerPage:E,setSearch:y,setSearchFn:b,setSort:d,sort:f,sorted:u,unselectAll:l,unselectItem:a}),[c,h,o,S,_,O,v,g,$,i,T,r,p,w,E,y,b,d,f,u,l,a])}function Fb(e,t,n){const[r,i]=x.useState(()=>n?n.reduce((g,v)=>(g[t(v)]=v,g),{}):{});x.useEffect(()=>{i(g=>{let v=!1;return e.forEach(y=>{const b=t(y);g[b]&&g[b]!==y&&(v=!0,g[b]=y)}),v?{...g}:g})},[e,t]);const a=x.useCallback(g=>{i(v=>{const y=t(g);return v[y]!==g&&(v={...v},v[y]=g),v})},[t]),o=x.useCallback(g=>{i(v=>{const y=t(g);return v[y]&&(v={...v},delete v[y]),v})},[t]),s=x.useCallback(g=>{const v=t(g);return r[v]!==void 0},[t,r]),l=x.useCallback(g=>{i(v=>{v={...v};for(const y of g){const b=t(y);v[b]=y}return v})},[t]),c=x.useRef(e);x.useEffect(()=>{c.current=e},[e]);const u=x.useCallback(()=>l(c.current),[l]),f=x.useCallback(g=>{for(const v of g)o(v)},[o]),d=x.useCallback(()=>{i(g=>Object.keys(g).length>0?{}:g)},[]),h=x.useMemo(()=>Object.values(r),[r]),p=x.useMemo(()=>h.length===e.length,[e.length,h.length]);return x.useMemo(()=>({selectedItems:h,selectItem:a,unselectItem:o,isSelected:s,selectItems:l,selectAll:u,unselectAll:d,allSelected:p,keyFn:t,unselectItems:f}),[p,s,t,u,a,l,h,d,o,f])}function O6(e,t){const[n,r]=x.useState({});x.useEffect(()=>{r(h=>{let p=!1;const g=e?e.reduce((b,_)=>{const S=t(_);return b[S]=_,h[S]&&h[S]!==_&&(p=!0,h[S]=_),b},{}):{},v={};for(const b in h)g[b]||(v[b]=!0);const y=Object.keys(v);if(y.length){p=!0;for(const b of y)delete h[b]}return p?{...h}:h})},[e,t]);const i=x.useCallback(h=>{r(p=>{const g=t(h);return p[g]!==h&&(p={...p},p[g]=h),p})},[t]),a=x.useCallback(h=>{r(p=>{const g=t(h);return p[g]&&(p={...p},delete p[g]),p})},[t]),o=x.useCallback(h=>{for(const p of h)a(p)},[a]),s=x.useCallback(h=>{const p=t(h);return n[p]!==void 0},[t,n]),l=x.useCallback(h=>{r(p=>{p={...p};for(const g of h){const v=t(g);p[v]=g}return p})},[t]),c=x.useCallback(()=>{l(e??[])},[e,l]),u=x.useCallback(()=>{r(h=>Object.keys(h).length>0?{}:h)},[]),f=x.useMemo(()=>Object.values(n),[n]),d=x.useMemo(()=>f.length===(e==null?void 0:e.length),[e,f.length]);return x.useMemo(()=>({selectedItems:f,selectItem:i,unselectItem:a,isSelected:s,selectItems:l,selectAll:c,unselectAll:u,allSelected:d,keyFn:t,unselectItems:o}),[d,s,t,c,i,l,f,u,a,o])}function Rb(e){const[t,n]=x.useState(),{direction:r,sortFn:i}=t??{},a=x.useMemo(()=>e?i?r==="asc"?[...e.sort(i)]:[...e.sort(i).reverse()]:e:[],[r,e,i]);return x.useMemo(()=>({sorted:a,sort:t,setSort:n}),[t,a])}function Wb(e,t){const n=x.useRef({map:{}}),[r,i]=x.useState(),a=x.useCallback(c=>i(()=>c),[]),[o,s]=x.useState([]);x.useEffect(()=>{n.current.map={}},[r]);const l=x.useCallback(c=>{const u=t(c);let f=n.current.map[u];return f?f.item!==c&&(f.item=c,f.passes=r?r(c):!0):(f={item:c,passes:r?r(c):!0},n.current.map[u]=f),f.passes},[r,t]);return x.useEffect(()=>{s(r?e.filter(l):e)},[e,r,l]),x.useMemo(function(){return{filtered:o,setFilterFn:a}},[o,a])}function lbe(e,t,n){const r=x.useRef({map:{}}),[i,a]=x.useState(),o=x.useCallback(h=>a(()=>h),[]),[s,l]=x.useState([]),[c,u]=x.useState(n??""),f=x.useCallback(Lb(h=>u(h),200),[]);x.useEffect(()=>{r.current.map={}},[c,i]);const d=x.useCallback(h=>{const p=t(h);let g=r.current.map[p];return g?g.item!==h&&(g.item=h,g.score=i?i(h,c):0):(g={item:h,score:i?i(h,c):0},r.current.map[p]=g),g},[t,i,c]);return x.useEffect(()=>{l(i&&c?e.map(d).filter(h=>h.score<.5).sort((h,p)=>h.score-p.score).map(h=>h.item):e)},[c,e,i,d]),x.useMemo(function(){return{searched:s,search:c,setSearch:f,setSearchFn:o}},[s,c,f,o])}function Fc(e){const[t,n]=x.useState([]),[r,i]=x.useState(1),[a,o]=x.useState(10);return x.useEffect(()=>{n(s=>{const l=e.slice((r-1)*a,r*a);if(s.length!==l.length)return l;let c=0;for(const u of l)if(s[c++]!==u)return l;return s})},[r,a,e]),x.useEffect(()=>{r>Math.ceil(e.length/a)&&i(1)},[r,a,e.length]),x.useMemo(()=>({paged:t,page:r,setPage:i,perPage:a,setPerPage:o}),[r,t,a])}const Bb={button:"pf-v5-c-button",check:"pf-v5-c-check",checkInput:"pf-v5-c-check__input",dirRtl:"pf-v5-m-dir-rtl",modifiers:{hidden:"pf-m-hidden",hiddenOnSm:"pf-m-hidden-on-sm",visibleOnSm:"pf-m-visible-on-sm",hiddenOnMd:"pf-m-hidden-on-md",visibleOnMd:"pf-m-visible-on-md",hiddenOnLg:"pf-m-hidden-on-lg",visibleOnLg:"pf-m-visible-on-lg",hiddenOnXl:"pf-m-hidden-on-xl",visibleOnXl:"pf-m-visible-on-xl",hiddenOn_2xl:"pf-m-hidden-on-2xl",visibleOn_2xl:"pf-m-visible-on-2xl",fixed:"pf-m-fixed",stickyHeader:"pf-m-sticky-header",nestedColumnHeader:"pf-m-nested-column-header",borderRow:"pf-m-border-row",striped:"pf-m-striped",expandable:"pf-m-expandable",stripedEven:"pf-m-striped-even",ghostRow:"pf-m-ghost-row",center:"pf-m-center",help:"pf-m-help",favorite:"pf-m-favorite",borderRight:"pf-m-border-right",borderLeft:"pf-m-border-left",expanded:"pf-m-expanded",truncate:"pf-m-truncate",wrap:"pf-m-wrap",nowrap:"pf-m-nowrap",fitContent:"pf-m-fit-content",breakWord:"pf-m-break-word",noBorderRows:"pf-m-no-border-rows",clickable:"pf-m-clickable",selected:"pf-m-selected",firstCellOffsetReset:"pf-m-first-cell-offset-reset",dragOver:"pf-m-drag-over",standalone:"pf-m-standalone",favorited:"pf-m-favorited",noPadding:"pf-m-no-padding",compact:"pf-m-compact",width_10:"pf-m-width-10",width_15:"pf-m-width-15",width_20:"pf-m-width-20",width_25:"pf-m-width-25",width_30:"pf-m-width-30",width_35:"pf-m-width-35",width_40:"pf-m-width-40",width_45:"pf-m-width-45",width_50:"pf-m-width-50",width_60:"pf-m-width-60",width_70:"pf-m-width-70",width_80:"pf-m-width-80",width_90:"pf-m-width-90",width_100:"pf-m-width-100"},table:"pf-v5-c-table",tableAction:"pf-v5-c-table__action",tableButton:"pf-v5-c-table__button",tableButtonContent:"pf-v5-c-table__button-content",tableCaption:"pf-v5-c-table__caption",tableCheck:"pf-v5-c-table__check",tableColumnHelp:"pf-v5-c-table__column-help",tableColumnHelpAction:"pf-v5-c-table__column-help-action",tableCompoundExpansionToggle:"pf-v5-c-table__compound-expansion-toggle",tableControlRow:"pf-v5-c-table__control-row",tableDraggable:"pf-v5-c-table__draggable",tableExpandableRow:"pf-v5-c-table__expandable-row",tableExpandableRowContent:"pf-v5-c-table__expandable-row-content",tableFavorite:"pf-v5-c-table__favorite",tableIcon:"pf-v5-c-table__icon",tableIconInline:"pf-v5-c-table__icon-inline",tableInlineEditAction:"pf-v5-c-table__inline-edit-action",tableSort:"pf-v5-c-table__sort",tableSortIndicator:"pf-v5-c-table__sort-indicator",tableSubhead:"pf-v5-c-table__subhead",tableTbody:"pf-v5-c-table__tbody",tableTd:"pf-v5-c-table__td",tableText:"pf-v5-c-table__text",tableTh:"pf-v5-c-table__th",tableThead:"pf-v5-c-table__thead",tableToggle:"pf-v5-c-table__toggle",tableToggleIcon:"pf-v5-c-table__toggle-icon",tableTr:"pf-v5-c-table__tr",themeDark:"pf-v5-theme-dark"};function cbe(e){const{t}=Ge(),{columns:n,keyFn:r,items:i,setItems:a,isSelected:o,selectItem:s,unselectItem:l,allSelected:c,selectAll:u,unselectAll:f,hideColumnHeaders:d,isSelectableWithCheckbox:h}=e,[p,g]=x.useState(null),[v,y]=x.useState(null),[b,_]=x.useState(!1),S=x.useRef(null),w=D=>{if(S.current){const I=S.current.getBoundingClientRect();return D.clientX>I.x&&D.clientX<I.x+I.width&&D.clientY>I.y&&D.clientY<I.y+I.height}return!1},O=D=>{w(D)||E()},E=()=>{S.current&&Array.from(S.current.children).forEach(D=>{D.classList.remove(Bb.modifiers.ghostRow),D.setAttribute("aria-pressed","false")}),y(null),g(null),_(!1)},T=D=>{D.preventDefault();const I=D.target.closest("tr");if(!I||!(S.current&&S.current.contains(I))||I.id===v)return null;{const W=I.id,F=Array.from(S.current.children).findIndex(V=>V.id===W);if(F!==p&&v){const V=$([...i],v,F);a(V)}}return null},$=(D,I,W)=>{const F=D.findIndex(z=>r(z)===I);if(F===W)return D;const V=D.splice(F,1);return D.splice(W,0,V[0]),D},M=D=>{w(D)||g(null)},A=D=>{const I=D.target;I.classList.remove(Bb.modifiers.ghostRow),I.setAttribute("aria-pressed","false"),y(null),g(null),_(!1)},j=D=>{if(S.current){D.dataTransfer.effectAllowed="move";const I=D.currentTarget.id,W=Array.from(S.current.children).findIndex(F=>F.id===D.currentTarget.id);D.currentTarget.setAttribute("aria-pressed","true"),y(I),g(W)}},P=x.useCallback(D=>{const I=i.findIndex(F=>r(F)===r(D)),W=[...i];W[I]=D,a(W)},[i,a,r]);return m.jsxs(Ie.Table,{"aria-label":t("Table with draggable rows"),className:b?Bb.modifiers.dragOver:"",variant:"compact",gridBreakPoint:"",children:[!d&&m.jsx(Ie.Thead,{children:m.jsxs(Ie.Tr,{children:[m.jsx(Ie.Th,{}),h&&m.jsx(Ie.Th,{select:{onSelect:(D,I)=>{I?u():f()},isSelected:c}}),n.map((D,I)=>m.jsx(Ie.Th,{children:D.header},I))]})}),m.jsx(Ie.Tbody,{ref:S,onDragOver:T,onDragLeave:M,children:i.map((D,I)=>{const W=r(D);return m.jsxs(Ie.Tr,{id:W.toString(),draggable:!0,onDrop:O,onDragEnd:A,onDragStart:j,children:[m.jsx(Ie.Td,{draggableRow:{id:`draggable-row-${W.toString()}`}}),h&&m.jsx(Ie.Td,{select:{rowIndex:I,variant:"checkbox",onSelect:(F,V)=>{V?s(D):l(D)},isSelected:o(D)}}),n.map(F=>m.jsx(Ie.Td,{children:F.cell(D,P)},F.header))]},W)})})]})}function ube(e){const[t,n]=Vi(),[r]=x.useState(()=>e.keyFn),[i]=x.useState(()=>e.saveFn),[a]=x.useState(()=>e.loadFn),[o,s]=x.useState(()=>{try{const d=localStorage.getItem(e.id);if(typeof d=="string"){const h=JSON.parse(d);if(Array.isArray(h)&&h.every(p=>typeof p=="object")&&h.every(p=>"key"in p&&"enabled"in p))return h}}catch{}}),l=x.useMemo(()=>o?e.items.map(d=>{if(a){const h=o.find(p=>p.key===r(d));h&&h.state&&a(d,h.state)}return d}).sort((d,h)=>{const p=o.findIndex(v=>v.key===r(d)),g=o.findIndex(v=>v.key===r(h));return p===-1&&g===-1?0:p===-1?1:g===-1?-1:p-g}):e.items,[o,r,a,e.items]),c=x.useMemo(()=>o?l.filter(d=>{const h=o.find(p=>p.key===r(d));return h?h.enabled:!0}):l,[l,o,r]),u=x.useCallback((d,h)=>{const p=d.map(g=>({key:r(g),enabled:h.includes(g),state:i?i(g):void 0}));s(p),localStorage.setItem(e.id,JSON.stringify(p))},[r,e.id,i]);return{openManageItems:()=>n(m.jsx(fbe,{...e,keyFn:r,items:l,defaultSelectedItems:c,onApplyChanges:u})),managedItems:c}}function fbe(e){const{t}=Ge(),{title:n,description:r,columns:i,onApplyChanges:a}=e,[o]=x.useState(()=>e.keyFn),[s,l]=Vi(),c=()=>l(void 0),[u,f]=x.useState(()=>e.items),{selectedItems:d,isSelected:h,selectItem:p,unselectItem:g,allSelected:v,selectAll:y,unselectAll:b}=Fb(u,o,e.defaultSelectedItems),_=()=>{a(u,d),l(void 0)};return m.jsxs(k.Modal,{title:n,"aria-label":n,ouiaId:n,description:m.jsx("div",{style:{marginBottom:16},children:r}),variant:e.variant??k.ModalVariant.medium,isOpen:!0,onClose:c,actions:[m.jsx(k.Button,{variant:"primary",onClick:_,children:t`Apply`},"apply"),m.jsx(k.Button,{variant:"link",onClick:c,children:t`Cancel`},"cancel")],hasNoBodyWrapper:!0,children:[m.jsx(k.Divider,{}),m.jsx(k.ModalBoxBody,{style:{padding:0},children:m.jsx(cbe,{keyFn:o,items:u,setItems:f,columns:i,isSelected:h,selectItem:p,unselectItem:g,allSelected:v,selectAll:y,unselectAll:b,hideColumnHeaders:e.hideColumnHeaders,isSelectableWithCheckbox:e.hideSelection!==!0})}),m.jsx(k.Divider,{})]})}function dbe(e,t,n,r,i){const{t:a}=Ge(),o=x.useMemo(()=>{const f=[{header:a("Name"),cell:d=>d.header}];return n||f.push({header:a("Table"),cell:(d,h)=>m.jsx(zi,{value:d.table??"",onSelect:p=>{switch(p){case"":h({...d,table:void 0});break;case xa.description:case xa.expanded:case xa.hidden:h({...d,table:p});break}},placeholder:a("Column"),options:[{value:"",label:a("Column"),description:a("Show the column in the table.")},{value:xa.description,label:a("Description"),description:a("Show the column when the item is expanded as a full width description.")},{value:xa.expanded,label:a("Expanded"),description:a("Show the column when the item is expanded as a detail.")},{value:xa.hidden,label:a("Hidden"),description:a("Hide the column.")}]})}),r||f.push({header:a("List"),cell:(d,h)=>m.jsx(zi,{value:d.list??"",onSelect:p=>{switch(p){case"":h({...d,list:void 0});break;case"name":case"subtitle":case"description":case"primary":case"secondary":case"hidden":h({...d,list:p});break}},options:[{value:"name",label:a("Name"),description:a("Show the column as the name of the list item.")},{value:"subtitle",label:a("Subtitle"),description:a("Show the column as the subtitle under the name on the list.")},{value:"description",label:a("Description"),description:a("Show the column as the list item description.")},{value:"primary",label:a("Left side"),description:a("Show the column on the left side of the list.")},{value:"secondary",label:a("Right side"),description:a("Show the column on the right side of the list.")},{value:"hidden",label:a("Hidden"),description:a("Hide the column on the list.")}],placeholder:a("Left side")})}),i||f.push({header:a("Card"),cell:(d,h)=>m.jsx(zi,{value:d.card??"",onSelect:p=>{switch(p){case"":h({...d,card:void 0});break;case"name":case"subtitle":case"description":case"hidden":h({...d,card:p});break}},placeholder:a("Detail"),options:[{value:"name",label:a("Name"),description:a("Show the column as the name on the card.")},{value:"subtitle",label:a("Subtitle"),description:a("Show the column as the subtitle under the name on the card.")},{value:"description",label:a("Description"),description:a("Show the column as the card description.")},{value:"",label:a("Detail"),description:a("Show the column one of the details on the card.")},{value:"hidden",label:a("Hidden"),description:a("Hide the column on the card.")}]})}),f},[i,r,n,a]),s=x.useCallback((f,d)=>{typeof d=="object"&&d!==null&&("table"in d&&typeof d.table=="string"?f.table=d.table:f.table=void 0,"list"in d&&typeof d.list=="string"?f.list=d.list:f.list=void 0,"card"in d&&typeof d.card=="string"?f.card=d.card:f.card=void 0)},[]),l=x.useCallback(f=>{const{table:d,list:h,card:p}=f;return{table:d,list:h,card:p}},[]),{openManageItems:c,managedItems:u}=ube({id:e,title:a("Manage Columns"),description:a("Manage the order, placement, and format of columns."),items:t,keyFn:f=>f.id??f.header,columns:o,loadFn:s,saveFn:l,hideSelection:!0});return{openColumnManagement:c,managedColumns:u}}function hbe(){return m.jsx(Ie.Table,{gridBreakPoint:"",className:"page-table",children:m.jsx(Ie.Tbody,{children:new Array(10).fill(0).map((e,t)=>m.jsx(Ie.Tr,{children:m.jsx(Ie.Td,{children:m.jsx(k.Skeleton,{height:"27px"})})},t))})})}function pbe(e){const{setPage:t,setPerPage:n}=e,r=x.useCallback((o,s)=>t(s),[t]),i=x.useCallback((o,s)=>n(s),[n]),a=!on("md");return m.jsx(k.Pagination,{"data-cy":"pagination",variant:k.PaginationVariant.bottom,itemCount:e.itemCount,page:e.page,perPage:e.perPage,onSetPage:r,onPerPageSelect:i,perPageOptions:e.perPageOptions,style:{...e.style,boxShadow:"none",zIndex:400,paddingTop:a?4:6,paddingBottom:a?4:6},className:"border-top bg-lighten"})}function gbe(e){const t=e.size??350,n=x.useRef(null),[r,i]=x.useState("1fr"),a=x.useCallback(s=>{let l=Math.min(e.maxColumns??12,Math.max(Math.floor(s/t),1));l<1&&(l=1),i(()=>new Array(l).fill("1fr").join(" "))},[e.maxColumns,t]);return es(n,s=>a(s.contentRect.width)),x.useLayoutEffect(()=>{var s;a(((s=n.current)==null?void 0:s.clientWidth)??0)},[a]),m.jsx("div",{ref:n,style:{display:"grid",gridAutoRows:"1fr",gridTemplateColumns:r,gap:16},children:e.children})}const mbe=Ee.small`
|
456
|
+
`;function x6(e){const{itemCount:t,page:n,perPage:r,setPage:i,setPerPage:a,toolbarFilters:o,selectedItems:s,filterState:l,setFilterState:c,openColumnModal:u,sort:f,setSort:d,sortDirection:h,setSortDirection:p,sortOptions:g,clearAllFilters:v,perPageOptions:y}=e,b=x.useCallback(()=>{v?v():c&&c({})},[c,v]),_=on("md"),S=on("xxl"),{viewType:w,setViewType:O}=e;let{toolbarActions:E}=e;E=E??[];const[T,$]=x.useState(""),M=x.useCallback((W,F)=>i?i(F):null,[i]),A=x.useCallback((W,F)=>a?a(F):null,[a]),j=o!==void 0,P=E!==void 0&&E.length>0,D=e.showSelect===!0||s!==void 0&&E&&E.find(W=>"selection"in W&&W.selection===vt.Multiple);return D||j||P?t===void 0?m.jsx(k.Toolbar,{className:"page-table-toolbar border-bottom",style:{paddingBottom:_?void 0:8,paddingTop:_?void 0:8},children:m.jsx(b6,{children:m.jsx(k.ToolbarItem,{style:{width:"100%"},children:m.jsx(k.Skeleton,{height:"36px"})})})}):m.jsx(p6.Provider,{value:{activeGroup:T,setActiveGroup:$},children:m.jsx(k.Toolbar,{ouiaId:"page-toolbar",clearAllFilters:b,className:"page-table-toolbar border-bottom",style:{paddingBottom:_?void 0:8,paddingTop:_?void 0:8},inset:{default:"insetMd",sm:"insetMd",md:"insetMd",lg:"insetMd",xl:"insetLg","2xl":"insetLg"},children:m.jsxs(b6,{style:{paddingRight:S?12:4},children:[D&&m.jsx(k.ToolbarGroup,{children:m.jsx(k.ToolbarItem,{variant:"bulk-select",children:m.jsx(o6,{...e})})}),l&&c&&m.jsx(v6,{toolbarFilters:o,filterState:l,setFilterState:c,limitFiltersToOneOrOperation:e.limitFiltersToOneOrOperation}),e.toolbarContent,m.jsx(k.ToolbarGroup,{variant:"button-group",children:m.jsx(zo,{actions:E,selectedItems:s,wrapper:k.ToolbarItem})}),m.jsxs(rbe,{children:[m.jsx(Qye,{sort:f,setSort:d,sortDirection:h,setSortDirection:p,sortOptions:g}),w&&O&&m.jsx(nbe,{disableTableView:e.disableTableView,disableListView:e.disableListView,disableCardView:e.disableCardView,viewType:w,setViewType:O,openColumnModal:u}),!e.disablePagination&&!e.autoHidePagination&&S&&m.jsx(k.ToolbarItem,{visibility:{default:"hidden","2xl":"visible"},style:{marginLeft:24,alignSelf:"center"},children:m.jsx(k.Pagination,{variant:k.PaginationVariant.top,isCompact:!0,itemCount:t,perPage:r,page:n,onSetPage:M,onPerPageSelect:A,perPageOptions:y,style:{marginTop:-8,marginBottom:-8}})})]})]})})}):m.jsx(x.Fragment,{})}function ibe(e){const{t}=Ge(),n=t("Something went wrong"),r=t("Please refresh the page by using the button below."),i=t("Refresh"),{titleProp:a,message:o}=e;return m.jsxs(k.EmptyState,{isFullHeight:!0,children:[m.jsx(k.EmptyStateHeader,{titleText:m.jsx(m.Fragment,{children:a||n}),icon:m.jsx(k.EmptyStateIcon,{icon:ve.ExclamationCircleIcon,color:"var(--pf-v5-global--danger-color--100)"}),headingLevel:"h2"}),m.jsx(k.EmptyStateBody,{children:o}),m.jsxs(k.EmptyStateFooter,{children:[m.jsx(k.EmptyStateBody,{children:r}),m.jsx(k.Button,{variant:"primary",onClick:()=>window.location.reload(),children:i})]})]})}function abe(e){const{title:t,description:n,icon:r,button:i,footNote:a,image:o,variant:s,style:l}=e;return m.jsxs(k.EmptyState,{variant:s||k.EmptyStateVariant.full,style:l,isFullHeight:!0,children:[r&&m.jsx(k.EmptyStateIcon,{icon:r}),m.jsx(k.EmptyStateHeader,{titleText:m.jsx(m.Fragment,{children:t}),headingLevel:"h4","data-cy":"empty-state-title"}),m.jsx(k.EmptyStateBody,{"data-cy":e.description,children:n}),m.jsxs(k.EmptyStateFooter,{children:[i&&m.jsx(k.EmptyStateActions,{children:i}),o&&m.jsxs(m.Fragment,{children:[" ",m.jsx("br",{})," ",m.jsx(k.EmptyStateBody,{children:o})]}),a&&m.jsx(k.EmptyStateBody,{children:a})]})]})}function obe(e){const{button:t,description:n,title:r,variant:i}=e;return m.jsx(abe,{icon:t?ve.PlusCircleIcon:ve.CubesIcon,title:r,description:n,button:t,variant:i})}const _6=x.createContext({dialogs:[],clearDialogs:()=>{},pushDialog:e=>{},popDialog:()=>{}});function w6(e){const[t,n]=x.useState([]),r=x.useCallback(()=>n([]),[n]),i=x.useCallback(s=>n(l=>[...l,s]),[n]),a=x.useCallback(()=>n(s=>s.slice(0,-1)),[n]),o=x.useMemo(()=>({dialogs:t,clearDialogs:r,pushDialog:i,popDialog:a}),[r,t,a,i]);return m.jsxs(_6.Provider,{value:o,children:[t.length>0&&t[t.length-1],e.children]})}function S6(){return x.useContext(_6)}function Vi(){const{dialogs:e,clearDialogs:t,pushDialog:n}=S6(),r=x.useMemo(()=>e.length>0?e[e.length-1]:void 0,[e]),i=x.useCallback(a=>{t(),a!==void 0&&n(a)},[t,n]);return x.useMemo(()=>[r,i],[r,i])}function sbe(e,t,n){const{selectedItems:r,selectItem:i,unselectItem:a,isSelected:o,selectItems:s,unselectAll:l,allSelected:c}=Fb(e,t),{sorted:u,sort:f,setSort:d}=Rb(e),{filtered:h,setFilterFn:p}=Wb(u,t),{searched:g,search:v,setSearch:y,setSearchFn:b}=lbe(h,t,n==null?void 0:n.search),{paged:_,page:S,setPage:w,perPage:O,setPerPage:E}=Fc(g),T=x.useCallback(()=>s(_),[_,s]),$=x.useCallback(()=>s(g),[g,s]);return x.useMemo(()=>({allSelected:c,filtered:h,isSelected:o,page:S,paged:_,perPage:O,search:v,searched:g,selectAll:$,selectItem:i,selectPage:T,selectedItems:r,setFilterFn:p,setPage:w,setPerPage:E,setSearch:y,setSearchFn:b,setSort:d,sort:f,sorted:u,unselectAll:l,unselectItem:a}),[c,h,o,S,_,O,v,g,$,i,T,r,p,w,E,y,b,d,f,u,l,a])}function Fb(e,t,n){const[r,i]=x.useState(()=>n?n.reduce((g,v)=>(g[t(v)]=v,g),{}):{});x.useEffect(()=>{i(g=>{let v=!1;return e.forEach(y=>{const b=t(y);g[b]&&g[b]!==y&&(v=!0,g[b]=y)}),v?{...g}:g})},[e,t]);const a=x.useCallback(g=>{i(v=>{const y=t(g);return v[y]!==g&&(v={...v},v[y]=g),v})},[t]),o=x.useCallback(g=>{i(v=>{const y=t(g);return v[y]&&(v={...v},delete v[y]),v})},[t]),s=x.useCallback(g=>{const v=t(g);return r[v]!==void 0},[t,r]),l=x.useCallback(g=>{i(v=>{v={...v};for(const y of g){const b=t(y);v[b]=y}return v})},[t]),c=x.useRef(e);x.useEffect(()=>{c.current=e},[e]);const u=x.useCallback(()=>l(c.current),[l]),f=x.useCallback(g=>{for(const v of g)o(v)},[o]),d=x.useCallback(()=>{i(g=>Object.keys(g).length>0?{}:g)},[]),h=x.useMemo(()=>Object.values(r),[r]),p=x.useMemo(()=>h.length===e.length,[e.length,h.length]);return x.useMemo(()=>({selectedItems:h,selectItem:a,unselectItem:o,isSelected:s,selectItems:l,selectAll:u,unselectAll:d,allSelected:p,keyFn:t,unselectItems:f}),[p,s,t,u,a,l,h,d,o,f])}function O6(e,t){const[n,r]=x.useState({});x.useEffect(()=>{r(h=>{let p=!1;const g=e?e.reduce((b,_)=>{const S=t(_);return b[S]=_,h[S]&&h[S]!==_&&(p=!0,h[S]=_),b},{}):{},v={};for(const b in h)g[b]||(v[b]=!0);const y=Object.keys(v);if(y.length){p=!0;for(const b of y)delete h[b]}return p?{...h}:h})},[e,t]);const i=x.useCallback(h=>{r(p=>{const g=t(h);return p[g]!==h&&(p={...p},p[g]=h),p})},[t]),a=x.useCallback(h=>{r(p=>{const g=t(h);return p[g]&&(p={...p},delete p[g]),p})},[t]),o=x.useCallback(h=>{for(const p of h)a(p)},[a]),s=x.useCallback(h=>{const p=t(h);return n[p]!==void 0},[t,n]),l=x.useCallback(h=>{r(p=>{p={...p};for(const g of h){const v=t(g);p[v]=g}return p})},[t]),c=x.useCallback(()=>{l(e??[])},[e,l]),u=x.useCallback(()=>{r(h=>Object.keys(h).length>0?{}:h)},[]),f=x.useMemo(()=>Object.values(n),[n]),d=x.useMemo(()=>f.length===(e==null?void 0:e.length),[e,f.length]);return x.useMemo(()=>({selectedItems:f,selectItem:i,unselectItem:a,isSelected:s,selectItems:l,selectAll:c,unselectAll:u,allSelected:d,keyFn:t,unselectItems:o}),[d,s,t,c,i,l,f,u,a,o])}function Rb(e){const[t,n]=x.useState(),{direction:r,sortFn:i}=t??{},a=x.useMemo(()=>e?i?r==="asc"?[...e.sort(i)]:[...e.sort(i).reverse()]:e:[],[r,e,i]);return x.useMemo(()=>({sorted:a,sort:t,setSort:n}),[t,a])}function Wb(e,t){const n=x.useRef({map:{}}),[r,i]=x.useState(),a=x.useCallback(c=>i(()=>c),[]),[o,s]=x.useState([]);x.useEffect(()=>{n.current.map={}},[r]);const l=x.useCallback(c=>{const u=t(c);let f=n.current.map[u];return f?f.item!==c&&(f.item=c,f.passes=r?r(c):!0):(f={item:c,passes:r?r(c):!0},n.current.map[u]=f),f.passes},[r,t]);return x.useEffect(()=>{s(r?e.filter(l):e)},[e,r,l]),x.useMemo(function(){return{filtered:o,setFilterFn:a}},[o,a])}function lbe(e,t,n){const r=x.useRef({map:{}}),[i,a]=x.useState(),o=x.useCallback(h=>a(()=>h),[]),[s,l]=x.useState([]),[c,u]=x.useState(n??""),f=x.useCallback(Lb(h=>u(h),200),[]);x.useEffect(()=>{r.current.map={}},[c,i]);const d=x.useCallback(h=>{const p=t(h);let g=r.current.map[p];return g?g.item!==h&&(g.item=h,g.score=i?i(h,c):0):(g={item:h,score:i?i(h,c):0},r.current.map[p]=g),g},[t,i,c]);return x.useEffect(()=>{l(i&&c?e.map(d).filter(h=>h.score<.5).sort((h,p)=>h.score-p.score).map(h=>h.item):e)},[c,e,i,d]),x.useMemo(function(){return{searched:s,search:c,setSearch:f,setSearchFn:o}},[s,c,f,o])}function Fc(e){const[t,n]=x.useState([]),[r,i]=x.useState(1),[a,o]=x.useState(10);return x.useEffect(()=>{n(s=>{const l=e.slice((r-1)*a,r*a);if(s.length!==l.length)return l;let c=0;for(const u of l)if(s[c++]!==u)return l;return s})},[r,a,e]),x.useEffect(()=>{r>Math.ceil(e.length/a)&&i(1)},[r,a,e.length]),x.useMemo(()=>({paged:t,page:r,setPage:i,perPage:a,setPerPage:o}),[r,t,a])}const Bb={button:"pf-v5-c-button",check:"pf-v5-c-check",checkInput:"pf-v5-c-check__input",dirRtl:"pf-v5-m-dir-rtl",modifiers:{hidden:"pf-m-hidden",hiddenOnSm:"pf-m-hidden-on-sm",visibleOnSm:"pf-m-visible-on-sm",hiddenOnMd:"pf-m-hidden-on-md",visibleOnMd:"pf-m-visible-on-md",hiddenOnLg:"pf-m-hidden-on-lg",visibleOnLg:"pf-m-visible-on-lg",hiddenOnXl:"pf-m-hidden-on-xl",visibleOnXl:"pf-m-visible-on-xl",hiddenOn_2xl:"pf-m-hidden-on-2xl",visibleOn_2xl:"pf-m-visible-on-2xl",fixed:"pf-m-fixed",stickyHeader:"pf-m-sticky-header",nestedColumnHeader:"pf-m-nested-column-header",borderRow:"pf-m-border-row",striped:"pf-m-striped",expandable:"pf-m-expandable",stripedEven:"pf-m-striped-even",ghostRow:"pf-m-ghost-row",center:"pf-m-center",help:"pf-m-help",favorite:"pf-m-favorite",borderRight:"pf-m-border-right",borderLeft:"pf-m-border-left",expanded:"pf-m-expanded",truncate:"pf-m-truncate",wrap:"pf-m-wrap",nowrap:"pf-m-nowrap",fitContent:"pf-m-fit-content",breakWord:"pf-m-break-word",noBorderRows:"pf-m-no-border-rows",clickable:"pf-m-clickable",selected:"pf-m-selected",firstCellOffsetReset:"pf-m-first-cell-offset-reset",dragOver:"pf-m-drag-over",standalone:"pf-m-standalone",favorited:"pf-m-favorited",noPadding:"pf-m-no-padding",compact:"pf-m-compact",width_10:"pf-m-width-10",width_15:"pf-m-width-15",width_20:"pf-m-width-20",width_25:"pf-m-width-25",width_30:"pf-m-width-30",width_35:"pf-m-width-35",width_40:"pf-m-width-40",width_45:"pf-m-width-45",width_50:"pf-m-width-50",width_60:"pf-m-width-60",width_70:"pf-m-width-70",width_80:"pf-m-width-80",width_90:"pf-m-width-90",width_100:"pf-m-width-100"},table:"pf-v5-c-table",tableAction:"pf-v5-c-table__action",tableButton:"pf-v5-c-table__button",tableButtonContent:"pf-v5-c-table__button-content",tableCaption:"pf-v5-c-table__caption",tableCheck:"pf-v5-c-table__check",tableColumnHelp:"pf-v5-c-table__column-help",tableColumnHelpAction:"pf-v5-c-table__column-help-action",tableCompoundExpansionToggle:"pf-v5-c-table__compound-expansion-toggle",tableControlRow:"pf-v5-c-table__control-row",tableDraggable:"pf-v5-c-table__draggable",tableExpandableRow:"pf-v5-c-table__expandable-row",tableExpandableRowContent:"pf-v5-c-table__expandable-row-content",tableFavorite:"pf-v5-c-table__favorite",tableIcon:"pf-v5-c-table__icon",tableIconInline:"pf-v5-c-table__icon-inline",tableInlineEditAction:"pf-v5-c-table__inline-edit-action",tableSort:"pf-v5-c-table__sort",tableSortIndicator:"pf-v5-c-table__sort-indicator",tableSubhead:"pf-v5-c-table__subhead",tableTbody:"pf-v5-c-table__tbody",tableTd:"pf-v5-c-table__td",tableText:"pf-v5-c-table__text",tableTh:"pf-v5-c-table__th",tableThead:"pf-v5-c-table__thead",tableToggle:"pf-v5-c-table__toggle",tableToggleIcon:"pf-v5-c-table__toggle-icon",tableTr:"pf-v5-c-table__tr",themeDark:"pf-v5-theme-dark"};function cbe(e){const{t}=Ge(),{columns:n,keyFn:r,items:i,setItems:a,isSelected:o,selectItem:s,unselectItem:l,allSelected:c,selectAll:u,unselectAll:f,hideColumnHeaders:d,isSelectableWithCheckbox:h}=e,[p,g]=x.useState(null),[v,y]=x.useState(null),[b,_]=x.useState(!1),S=x.useRef(null),w=D=>{if(S.current){const I=S.current.getBoundingClientRect();return D.clientX>I.x&&D.clientX<I.x+I.width&&D.clientY>I.y&&D.clientY<I.y+I.height}return!1},O=D=>{w(D)||E()},E=()=>{S.current&&Array.from(S.current.children).forEach(D=>{D.classList.remove(Bb.modifiers.ghostRow),D.setAttribute("aria-pressed","false")}),y(null),g(null),_(!1)},T=D=>{D.preventDefault();const I=D.target.closest("tr");if(!I||!(S.current&&S.current.contains(I))||I.id===v)return null;{const W=I.id,F=Array.from(S.current.children).findIndex(V=>V.id===W);if(F!==p&&v){const V=$([...i],v,F);a(V)}}return null},$=(D,I,W)=>{const F=D.findIndex(z=>r(z)===I);if(F===W)return D;const V=D.splice(F,1);return D.splice(W,0,V[0]),D},M=D=>{w(D)||g(null)},A=D=>{const I=D.target;I.classList.remove(Bb.modifiers.ghostRow),I.setAttribute("aria-pressed","false"),y(null),g(null),_(!1)},j=D=>{if(S.current){D.dataTransfer.effectAllowed="move";const I=D.currentTarget.id,W=Array.from(S.current.children).findIndex(F=>F.id===D.currentTarget.id);D.currentTarget.setAttribute("aria-pressed","true"),y(I),g(W)}},P=x.useCallback(D=>{const I=i.findIndex(F=>r(F)===r(D)),W=[...i];W[I]=D,a(W)},[i,a,r]);return m.jsxs(Ie.Table,{"aria-label":t("Table with draggable rows"),className:b?Bb.modifiers.dragOver:"",variant:"compact",gridBreakPoint:"",children:[!d&&m.jsx(Ie.Thead,{children:m.jsxs(Ie.Tr,{children:[m.jsx(Ie.Th,{}),h&&m.jsx(Ie.Th,{select:{onSelect:(D,I)=>{I?u():f()},isSelected:c}}),n.map((D,I)=>m.jsx(Ie.Th,{children:D.header},I))]})}),m.jsx(Ie.Tbody,{ref:S,onDragOver:T,onDragLeave:M,children:i.map((D,I)=>{const W=r(D);return m.jsxs(Ie.Tr,{id:W.toString(),draggable:!0,onDrop:O,onDragEnd:A,onDragStart:j,children:[m.jsx(Ie.Td,{draggableRow:{id:`draggable-row-${W.toString()}`}}),h&&m.jsx(Ie.Td,{select:{rowIndex:I,variant:"checkbox",onSelect:(F,V)=>{V?s(D):l(D)},isSelected:o(D)}}),n.map(F=>m.jsx(Ie.Td,{children:F.cell(D,P)},F.header))]},W)})})]})}function ube(e){const[t,n]=Vi(),[r]=x.useState(()=>e.keyFn),[i]=x.useState(()=>e.saveFn),[a]=x.useState(()=>e.loadFn),[o,s]=x.useState(()=>{try{const d=localStorage.getItem(e.id);if(typeof d=="string"){const h=JSON.parse(d);if(Array.isArray(h)&&h.every(p=>typeof p=="object")&&h.every(p=>"key"in p&&"enabled"in p))return h}}catch{}}),l=x.useMemo(()=>o?e.items.map(d=>{if(a){const h=o.find(p=>p.key===r(d));h&&h.state&&a(d,h.state)}return d}).sort((d,h)=>{const p=o.findIndex(v=>v.key===r(d)),g=o.findIndex(v=>v.key===r(h));return p===-1&&g===-1?0:p===-1?1:g===-1?-1:p-g}):e.items,[o,r,a,e.items]),c=x.useMemo(()=>o?l.filter(d=>{const h=o.find(p=>p.key===r(d));return h?h.enabled:!0}):l,[l,o,r]),u=x.useCallback((d,h)=>{const p=d.map(g=>({key:r(g),enabled:h.includes(g),state:i?i(g):void 0}));s(p),localStorage.setItem(e.id,JSON.stringify(p)),e.onSubmit&&e.onSubmit(d)},[r,e,i]);return{openManageItems:()=>n(m.jsx(fbe,{...e,keyFn:r,items:l,defaultSelectedItems:c,onApplyChanges:u})),managedItems:c}}function fbe(e){const{t}=Ge(),{title:n,description:r,columns:i,onApplyChanges:a}=e,[o]=x.useState(()=>e.keyFn),[s,l]=Vi(),c=()=>l(void 0),[u,f]=x.useState(()=>e.items),{selectedItems:d,isSelected:h,selectItem:p,unselectItem:g,allSelected:v,selectAll:y,unselectAll:b}=Fb(u,o,e.defaultSelectedItems),_=()=>{a(u,d),l(void 0)};return m.jsxs(k.Modal,{title:n,"aria-label":n,ouiaId:n,description:m.jsx("div",{style:{marginBottom:16},children:r}),variant:e.variant??k.ModalVariant.medium,isOpen:!0,onClose:c,actions:[m.jsx(k.Button,{variant:"primary",onClick:_,children:t`Apply`},"apply"),m.jsx(k.Button,{variant:"link",onClick:c,children:t`Cancel`},"cancel")],hasNoBodyWrapper:!0,children:[m.jsx(k.Divider,{}),m.jsx(k.ModalBoxBody,{style:{padding:0},children:m.jsx(cbe,{keyFn:o,items:u,setItems:f,columns:i,isSelected:h,selectItem:p,unselectItem:g,allSelected:v,selectAll:y,unselectAll:b,hideColumnHeaders:e.hideColumnHeaders,isSelectableWithCheckbox:e.hideSelection!==!0})}),m.jsx(k.Divider,{})]})}function dbe(e,t,n,r,i){const{t:a}=Ge(),o=x.useMemo(()=>{const f=[{header:a("Name"),cell:d=>d.header}];return n||f.push({header:a("Table"),cell:(d,h)=>m.jsx(zi,{value:d.table??"",onSelect:p=>{switch(p){case"":h({...d,table:void 0});break;case xa.description:case xa.expanded:case xa.hidden:h({...d,table:p});break}},placeholder:a("Column"),options:[{value:"",label:a("Column"),description:a("Show the column in the table.")},{value:xa.description,label:a("Description"),description:a("Show the column when the item is expanded as a full width description.")},{value:xa.expanded,label:a("Expanded"),description:a("Show the column when the item is expanded as a detail.")},{value:xa.hidden,label:a("Hidden"),description:a("Hide the column.")}]})}),r||f.push({header:a("List"),cell:(d,h)=>m.jsx(zi,{value:d.list??"",onSelect:p=>{switch(p){case"":h({...d,list:void 0});break;case"name":case"subtitle":case"description":case"primary":case"secondary":case"hidden":h({...d,list:p});break}},options:[{value:"name",label:a("Name"),description:a("Show the column as the name of the list item.")},{value:"subtitle",label:a("Subtitle"),description:a("Show the column as the subtitle under the name on the list.")},{value:"description",label:a("Description"),description:a("Show the column as the list item description.")},{value:"primary",label:a("Left side"),description:a("Show the column on the left side of the list.")},{value:"secondary",label:a("Right side"),description:a("Show the column on the right side of the list.")},{value:"hidden",label:a("Hidden"),description:a("Hide the column on the list.")}],placeholder:a("Left side")})}),i||f.push({header:a("Card"),cell:(d,h)=>m.jsx(zi,{value:d.card??"",onSelect:p=>{switch(p){case"":h({...d,card:void 0});break;case"name":case"subtitle":case"description":case"hidden":h({...d,card:p});break}},placeholder:a("Detail"),options:[{value:"name",label:a("Name"),description:a("Show the column as the name on the card.")},{value:"subtitle",label:a("Subtitle"),description:a("Show the column as the subtitle under the name on the card.")},{value:"description",label:a("Description"),description:a("Show the column as the card description.")},{value:"",label:a("Detail"),description:a("Show the column one of the details on the card.")},{value:"hidden",label:a("Hidden"),description:a("Hide the column on the card.")}]})}),f},[i,r,n,a]),s=x.useCallback((f,d)=>{typeof d=="object"&&d!==null&&("table"in d&&typeof d.table=="string"?f.table=d.table:f.table=void 0,"list"in d&&typeof d.list=="string"?f.list=d.list:f.list=void 0,"card"in d&&typeof d.card=="string"?f.card=d.card:f.card=void 0)},[]),l=x.useCallback(f=>{const{table:d,list:h,card:p}=f;return{table:d,list:h,card:p}},[]),{openManageItems:c,managedItems:u}=ube({id:e,title:a("Manage Columns"),description:a("Manage the order, placement, and format of columns."),items:t,keyFn:f=>f.id??f.header,columns:o,loadFn:s,saveFn:l,hideSelection:!0});return{openColumnManagement:c,managedColumns:u}}function hbe(){return m.jsx(Ie.Table,{gridBreakPoint:"",className:"page-table",children:m.jsx(Ie.Tbody,{children:new Array(10).fill(0).map((e,t)=>m.jsx(Ie.Tr,{children:m.jsx(Ie.Td,{children:m.jsx(k.Skeleton,{height:"27px"})})},t))})})}function pbe(e){const{setPage:t,setPerPage:n}=e,r=x.useCallback((o,s)=>t(s),[t]),i=x.useCallback((o,s)=>n(s),[n]),a=!on("md");return m.jsx(k.Pagination,{"data-cy":"pagination",variant:k.PaginationVariant.bottom,itemCount:e.itemCount,page:e.page,perPage:e.perPage,onSetPage:r,onPerPageSelect:i,perPageOptions:e.perPageOptions,style:{...e.style,boxShadow:"none",zIndex:400,paddingTop:a?4:6,paddingBottom:a?4:6},className:"border-top bg-lighten"})}function gbe(e){const t=e.size??350,n=x.useRef(null),[r,i]=x.useState("1fr"),a=x.useCallback(s=>{let l=Math.min(e.maxColumns??12,Math.max(Math.floor(s/t),1));l<1&&(l=1),i(()=>new Array(l).fill("1fr").join(" "))},[e.maxColumns,t]);return es(n,s=>a(s.contentRect.width)),x.useLayoutEffect(()=>{var s;a(((s=n.current)==null?void 0:s.clientWidth)??0)},[a]),m.jsx("div",{ref:n,style:{display:"grid",gridAutoRows:"1fr",gridTemplateColumns:r,gap:16},children:e.children})}const mbe=Ee.small`
|
457
457
|
opacity: 0.7;
|
458
458
|
`,vbe=Ee.div`
|
459
459
|
display: flex;
|