@ansible/ansible-ui-framework 2.4.2592 → 2.4.2594
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +2750 -2759
- package/index.umd.cjs +1 -1
- package/package.json +3 -2
- package/publish/index.d.ts +42 -42
package/index.umd.cjs
CHANGED
@@ -413,7 +413,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Mu]+=1);const Iu=Pe.button`
|
|
413
413
|
display: flex;
|
414
414
|
gap: 6px;
|
415
415
|
align-items: baseline;
|
416
|
-
`;function VO(e){const{item:t,itemToCardFn:n,isSelected:r,selectItem:i,unselectItem:o,itemActions:a,showSelect:s,defaultCardSubtitle:l}=e,c=v.useMemo(()=>n(t),[t,n]),u=!!(r!=null&&r(t)),d=v.useCallback(()=>{r!=null&&r(t)?o==null||o(t):i==null||i(t)},[r,t,i,o])
|
416
|
+
`;function VO(e){const{item:t,itemToCardFn:n,isSelected:r,selectItem:i,unselectItem:o,itemActions:a,showSelect:s,defaultCardSubtitle:l}=e,c=v.useMemo(()=>n(t),[t,n]),u=!!(r!=null&&r(t)),d=v.useCallback(()=>{r!=null&&r(t)?o==null||o(t):i==null||i(t)},[r,t,i,o]);return g.jsxs(O.Card,{id:`card-${c.id}`,ouiaId:c.id,isFlat:!0,isLarge:!0,isRounded:!0,isSelectable:s,isSelected:u,isClickable:s,style:{transition:"box-shadow 0.25s",cursor:"default",maxWidth:"100%"},children:[g.jsx(O.CardHeader,{selectableActions:s?{selectableActionId:`card-${c.id}-checkbox`,onChange:d}:void 0,style:{display:"flex",flexWrap:"nowrap",maxWidth:"100%"},children:g.jsxs(Pde,{children:[g.jsxs(Mde,{children:[c.iconAboveTitle?null:c.icon&&g.jsx(Il,{size:"xl",children:c.icon}),g.jsxs(Ide,{children:[c.iconAboveTitle?g.jsx(jde,{children:c.icon&&g.jsx(Il,{size:"xl",children:c.icon})}):null,g.jsx(O.CardTitle,{children:g.jsx(O.Truncate,{content:c.title})}),c.subtitle?g.jsx(O.Text,{component:"small",style:{opacity:.7},children:c.subtitle}):l&&g.jsx(O.Text,{component:"small",style:{opacity:.7},children:l})]})]}),c.badge&&c.badgeTooltip&&g.jsx(O.FlexItem,{children:g.jsx("div",{onClick:f=>f.stopPropagation(),children:g.jsx(O.Popover,{headerContent:c.badgeTooltipTitle,bodyContent:c.badgeTooltip,children:g.jsx(O.Label,{color:c.badgeColor,children:c.badge})})})}),c.badge&&!c.badgeTooltip&&g.jsx(O.FlexItem,{children:g.jsx(O.Label,{color:c.badgeColor,children:c.badge})})]})}),g.jsx("div",{style:{maxHeight:250,overflow:"hidden",display:"flex",paddingBottom:16,flexGrow:1},children:g.jsx(nr,{children:c.cardBody})}),(c.labels||a&&a.length)&&g.jsx(O.CardFooter,{children:g.jsxs($de,{children:[g.jsx(Lde,{children:c.labels&&g.jsx(O.LabelGroup,{numLabels:999,children:c.labels.map(f=>g.jsx(O.Label,{color:f.color,icon:f.icon,variant:f.variant,children:g.jsx(O.Truncate,{content:f.label,style:{minWidth:0}})},f.label))})}),a&&a.length&&g.jsx("div",{style:{marginRight:-16,alignSelf:"end",justifySelf:"flex-end",flexGrow:1},children:g.jsx(Kr,{actions:a,position:"right",selectedItem:t,iconOnly:!0})})]})}),c.alertTitle&&g.jsx(O.Alert,{title:c.alertTitle,isInline:!0,variant:c.alertVariant,children:c.alertContent})]},c.id??c.title)}function UO(e,t){const n=v.useMemo(()=>{let c,u,d;const f=[];let h;const m=[];for(const p of e)if(p.card!=="hidden")switch(p.type){case"description":d||(d=p);break;case"labels":h||(h=p);break;case"count":f.push(p);break;default:switch(p.card){case"name":c=p;break;case"subtitle":u=p;break;case"description":d=p;break;default:m.push(p);break}break}return{nameColumn:c,subtitleColumn:u,descriptionColumn:d,countColumns:f,cardColumns:m,labelColumn:h}},[e]),{nameColumn:r,subtitleColumn:i,descriptionColumn:o,countColumns:a,cardColumns:s,labelColumn:l}=n;return v.useMemo(()=>c=>{var h,m;let u=!!o;o!=null&&o.value&&!o.value(c)&&(u=!1);const d=s.filter(p=>!p.value||p.value(c)),f={id:t(c),icon:(h=r==null?void 0:r.icon)==null?void 0:h.call(r,c),title:g.jsx(on,{column:r,item:c}),subtitle:i&&(!i.value||i.value(c))&&g.jsx(on,{column:i,item:c}),cardBody:g.jsxs(O.DescriptionList,{isCompact:!0,style:{paddingLeft:32,paddingRight:32},children:[u&&o&&g.jsx(Fs,{children:o.type==="description"?g.jsx("div",{children:o.value(c)}):g.jsx(on,{column:o,item:c})},o.id??o.header),d.map(p=>g.jsx(Fs,{label:p.header,children:g.jsx(on,{column:p,item:c})},p.id??p.header)),a.length>0&&g.jsx(Fs,{children:g.jsx(RO,{children:a.map((p,y)=>g.jsxs(zO,{children:[g.jsx(on,{column:p,item:c}),g.jsx(BO,{children:p.header})]},y))})},"count-columns")]}),labels:l&&((m=l.value(c))==null?void 0:m.map(p=>({label:p})))};return!u&&d.length===0&&a.length===0&&(f.cardBody=g.jsx("div",{style:{flexGrow:1}})),f},[s,a,o,l,r,i,t])}function Ay(e){const{keyFn:t,pageItems:n,tableColumns:r,isSelected:i,selectItem:o,unselectItem:a,rowActions:s,showSelect:l,defaultSubtitle:c}=e,u=UO(r,t),d=v.useMemo(()=>g.jsx(Dde,{size:400,children:n==null?void 0:n.map(f=>g.jsx(VO,{item:f,itemToCardFn:u,isSelected:i,selectItem:o,unselectItem:a,itemActions:s,showSelect:l,defaultCardSubtitle:c},t(f)))}),[n,t,u,i,o,a,s,l,c]);return g.jsx(O.PageSection,{style:{flexGrow:1},children:d})}function HO(e){const{keyFn:t,pageItems:n,tableColumns:r,isSelected:i,selectItem:o,unselectItem:a,rowActions:s,defaultSubtitle:l,showSelect:c}=e,u=Fde(r,t,i,o,a,s,l,c);return g.jsx(O.DataList,{"aria-label":"TODO",style:{marginTop:-1,maxWidth:"100%",overflow:"hidden"},children:n==null?void 0:n.map(u)})}function Fde(e,t,n,r,i,o,a,s){const l=v.useMemo(()=>{let b,x,S;const C=[];let _;const w=[],k=[];for(const A of e)if(A.list!=="hidden")switch(A.type){case"description":S||(S=A);break;case"labels":_||(_=A);break;case"count":C.push(A);break;default:switch(A.list){case"name":b=A;break;case"subtitle":x=A;break;case"description":S=A;break;case"secondary":k.push(A);break;default:w.push(A);break}break}return{nameColumn:b,subtitleColumn:x,descriptionColumn:S,countColumns:C,primaryColumns:w,secondaryColumns:k,labelColumn:_}},[e]),c=v.useCallback(b=>{n!=null&&n(b)?i==null||i(b):r==null||r(b)},[n,r,i]),{nameColumn:u,subtitleColumn:d,descriptionColumn:f,countColumns:h,primaryColumns:m,secondaryColumns:p,labelColumn:y}=l;return v.useCallback(b=>{const x=t(b),S=n==null?void 0:n(b);return g.jsx(O.DataListItem,{"aria-labelledby":`data-list-${x}`,isExpanded:S,children:g.jsxs(O.DataListItemRow,{children:[s&&g.jsx(O.DataListCheck,{"aria-labelledby":`data-list-check-${x}`,name:`data-list-check-${x}`,isChecked:n==null?void 0:n(b),onClick:()=>c(b),"data-cy":"data-list-check"}),g.jsx(O.DataListItemCells,{dataListCells:[g.jsx(O.DataListCell,{width:5,children:g.jsx(O.Flex,{children:g.jsxs(O.Stack,{hasGutter:!0,children:[g.jsxs(O.Flex,{alignItems:{default:"alignItemsCenter"},children:[(u==null?void 0:u.icon)&&g.jsx(Il,{size:"xl",children:u==null?void 0:u.icon(b)}),g.jsxs(O.Stack,{children:[g.jsx(O.Title,{headingLevel:"h2",style:{marginTop:-4,fontWeight:"bold"},"data-cy":"data-list-name",children:g.jsx("span",{id:`data-list-${x}`,children:g.jsx(on,{column:u,item:b})})}),d?g.jsx(O.Text,{component:"small",style:{opacity:.7},children:g.jsx(on,{column:d,item:b})}):a&&g.jsx(O.Text,{component:"small",style:{opacity:.7},children:a})]})]}),(f||m.length>0||h.length>0||y)&&g.jsxs(O.DescriptionList,{isCompact:!0,children:[f&&(!f.value||f.value(b))&&g.jsx(O.DescriptionListGroup,{children:g.jsx(O.DescriptionListDescription,{children:g.jsx(on,{column:f,item:b})})},f.header),m.map(C=>C.value&&!C.value(b)?g.jsx(g.Fragment,{}):g.jsxs(O.DescriptionListGroup,{children:[g.jsx(O.DescriptionListTerm,{style:{whiteSpace:"nowrap",opacity:.6},children:C.header}),g.jsx(O.DescriptionListDescription,{children:g.jsx(on,{column:C,item:b})})]},C.header)),h.length>0&&g.jsx(O.DescriptionListGroup,{children:g.jsx(O.DescriptionListDescription,{children:g.jsx("div",{style:{display:"flex",gap:16,marginTop:8,flexWrap:"wrap"},children:h.map((C,_)=>g.jsxs("div",{style:{display:"flex",gap:6,alignItems:"baseline"},children:[g.jsx(on,{column:C,item:b}),g.jsx("small",{style:{opacity:.7},children:C.header})]},_))})})},"counts"),y&&g.jsxs(g.Fragment,{children:[g.jsx("div",{style:{flexGrow:1}}),g.jsx(O.DescriptionListGroup,{children:g.jsx(O.DescriptionListDescription,{children:g.jsx(on,{column:y,item:b})})},y.header)]})]})]})})},"primary"),p.length>0?g.jsx(O.DataListCell,{children:g.jsx(O.DescriptionList,{isCompact:!0,children:p.map(C=>C.value&&!C.value(b)?g.jsx(g.Fragment,{}):g.jsxs(O.DescriptionListGroup,{children:[g.jsx(O.DescriptionListTerm,{style:{whiteSpace:"nowrap",opacity:.6},children:C.header}),g.jsx(O.DescriptionListDescription,{children:g.jsx(on,{column:C,item:b})})]},C.header))})},"secondary"):null]}),o&&g.jsx(O.DataListAction,{"aria-labelledby":"check-action-item1 check-action-action1",id:"check-action-action1","aria-label":"Actions",isPlainButtonAction:!0,style:{whiteSpace:"nowrap"},"data-cy":"data-list-action",children:g.jsx(Kr,{actions:o,position:"right",selectedItem:b,iconOnly:!0,collapse:"always"})})]})},x)},[t,n,s,u,d,a,m,f,h,y,p,o,c])}const Nde=Pe.div`
|
417
417
|
flex: 1;
|
418
418
|
`;function jc(e){const{id:t,toolbarActions:n,filterState:r,error:i,itemCount:o}=e,{t:a}=$e(),s=e.showSelect||(n==null?void 0:n.find(b=>"selection"in b&&b.selection===Ye.Multiple))!==void 0,l=!e.disableTableView,c=!e.disableListView,[u,d]=v.useState(()=>{switch(e.id?localStorage.getItem(e.id+"-view"):void 0){case"table":return nt.Table;case"list":return nt.List;case"cards":return nt.Cards}return e.defaultTableView??(l?nt.Table:c?nt.List:nt.Cards)}),f=v.useCallback(b=>{d(b),e.id&&localStorage.setItem(e.id+"-view",b)},[e.id]),{openColumnManagement:h,managedColumns:m}=kde((t??"")+"-columns",e.tableColumns,u!==nt.Table,u!==nt.List,u!==nt.Cards),p=pde(e.tableColumns);if(i)return g.jsx(bde,{titleProp:e.errorStateTitle,message:i.message});if(o===0&&Object.keys(r??{}).length===0)return e.emptyState?e.emptyState:g.jsx(_de,{title:e.emptyStateTitle??a`No data`,description:e.emptyStateDescription,icon:e.emptyStateNoDataIcon,button:e.emptyStateButtonClick&&g.jsx(O.Button,{"data-cy":e.emptyStateButtonText?zde(e.emptyStateButtonText):"create-resource",variant:"primary",onClick:e.emptyStateButtonClick,icon:e.emptyStateButtonIcon?e.emptyStateButtonIcon:null,children:e.emptyStateButtonText})||e.emptyStateActions&&g.jsx(O.Flex,{justifyContent:{default:"justifyContentCenter"},children:g.jsx(Kr,{actions:e.emptyStateActions})})});let y=e.topContent;return y&&(y=g.jsx(O.PageSection,{variant:"light",padding:{default:"noPadding"},style:{borderBottom:"thin solid var(--pf-v5-global--BorderColor--100)"},children:e.topContent})),g.jsxs(g.Fragment,{children:[g.jsx($O,{...e,openColumnModal:e.id?h:void 0,showSelect:s,viewType:u,setViewType:f,sortOptions:p,limitFiltersToOneOrOperation:e.limitFiltersToOneOrOperation}),u===nt.Table&&g.jsx(g.Fragment,{children:e.scrollTopContent?g.jsxs(nr,{children:[y,!e.hideTable&&g.jsx(qO,{...e,tableColumns:m})]}):g.jsxs(g.Fragment,{children:[y,!e.hideTable&&g.jsx(qO,{...e,tableColumns:m})]})}),u===nt.List&&g.jsx(g.Fragment,{children:e.scrollTopContent?g.jsxs(nr,{children:[y,g.jsx(O.PageSection,{padding:{default:"noPadding"},children:!e.hideTable&&g.jsx(HO,{...e,showSelect:s,tableColumns:m})})]}):g.jsxs(g.Fragment,{children:[y,g.jsx(nr,{children:g.jsx(O.PageSection,{padding:{default:"noPadding"},children:!e.hideTable&&g.jsx(HO,{...e,showSelect:s,tableColumns:m})})})]})}),u===nt.Cards&&g.jsx(g.Fragment,{children:e.scrollTopContent?g.jsxs(nr,{children:[y,!e.hideTable&&g.jsx(Ay,{...e,showSelect:s,tableColumns:m})]}):g.jsxs(g.Fragment,{children:[y,g.jsx(nr,{children:!e.hideTable&&g.jsx(Ay,{...e,showSelect:s,tableColumns:m})})]})}),!e.disablePagination&&(!e.autoHidePagination||(e.itemCount??0)>e.perPage)&&g.jsx(Ade,{...e,topBorder:!e.autoHidePagination})]})}function qO(e){const{pageItems:t,selectItem:n,unselectItem:r,isSelected:i,isSelectMultiple:o,keyFn:a,rowActions:s,toolbarActions:l,itemCount:c,clearAllFilters:u,onSelect:d,unselectAll:f,maxSelections:h}=e,m=_y(e.tableColumns),p=pO(e.tableColumns),y=yO(e.tableColumns),b=v.useMemo(()=>{const T=[];if(p.length)for(const D of p)"value"in D?T.push(I=>{var W;const $=(W=D.value)==null?void 0:W.call(D,I);if($)return g.jsx("div",{children:$},D.id??D.header)}):T.push(I=>D.cell(I));return y.length&&T.push(D=>y.some($=>{var W;return((W=$.value)==null?void 0:W.call($,D))!==void 0})?g.jsx(cO,{disablePadding:!0,numberOfColumns:"multiple",labelOrientation:"vertical",isCompact:!0,disableScroll:!0,children:g.jsx(xO,{item:D,columns:y},a(D))}):null),e.expandedRow&&T.push(e.expandedRow),T.length===0?void 0:D=>T.map($=>$(D)).filter($=>$!=null).length===0?null:g.jsx(O.Stack,{hasGutter:!0,children:T.map($=>$(D))})},[p,y,a,e.expandedRow]),[x]=Mt(),S=e.showSelect||(l==null?void 0:l.find(T=>"selection"in T&&T.selection===Ye.Multiple))!==void 0,C=v.useRef(null),[_,w]=v.useState({left:0,right:0,top:0,bottom:0}),k=v.useCallback(T=>{T&&w({top:T.scrollTop,bottom:T.scrollHeight-T.clientHeight-T.scrollTop,left:T.scrollLeft,right:T.scrollWidth-T.clientWidth-T.scrollLeft})},[]),A=v.useCallback(T=>k(T.currentTarget),[k]);Ba(C,()=>k(C.current)),v.useEffect(()=>k(C.current),[k]);const j=Xo();let M;return e.itemCount===void 0||t===void 0?M=g.jsx(Tde,{}):M=g.jsxs(g.Fragment,{children:[g.jsxs(Fe.Table,{"aria-label":"Simple table",ouiaId:"simple-table",variant:e.compact||j.tableLayout==="compact"?"compact":void 0,borders:!e.borderless,gridBreakPoint:"",isStickyHeader:!0,className:"page-table",children:[g.jsx(Wde,{...e,showSelect:S,scrollLeft:_.left>0,scrollRight:_.right>1,tableColumns:m,onSelect:d,expandedRow:b}),g.jsx(Fe.Tbody,{children:t.map((T,P)=>g.jsx(Bde,{columns:m,item:T,isItemSelected:i==null?void 0:i(T),isSelectMultiple:o,selectItem:n,unselectItem:r,rowActions:s,rowIndex:P,showSelect:S,scrollLeft:_.left>0,scrollRight:_.right>1,unselectAll:f,onSelect:d,expandedRow:b,isLastRow:P===t.length-1,disableLastRowBorder:e.disableLastRowBorder,maxSelections:h,selectedItems:e.selectedItems,defaultExpandedRows:e.defaultExpandedRows},a?a(T):P))})]}),c===0&&g.jsxs(O.EmptyState,{isFullHeight:!0,children:[g.jsx(O.EmptyStateHeader,{titleText:g.jsx(g.Fragment,{children:x.noResultsFound}),icon:g.jsx(O.EmptyStateIcon,{icon:e.emptyStateIcon??ve.SearchIcon}),headingLevel:"h2"}),g.jsx(O.EmptyStateBody,{children:x.noResultsMatchCriteria}),g.jsx(O.EmptyStateFooter,{children:u&&g.jsx(O.EmptyStateActions,{children:g.jsx(O.Button,{variant:"primary",onClick:u,children:x.clearAllFilters})})})]})]}),e.scrollTopContent||(M=g.jsx(Nde,{className:"pf-v5-c-scroll-inner-wrapper",ref:C,onScroll:A,style:{backgroundColor:"var(--pf-v5-global--BackgroundColor--100)"},children:M})),M}function Wde(e){const{tableColumns:t,rowActions:n,sort:r,setSort:i,sortDirection:o,setSortDirection:a,showSelect:s,onSelect:l,expandedRow:c}=e,u=v.useCallback((d,f)=>{if(f.sort)return{onSort:(h,m,p)=>{f.sort&&(i==null||i(f.sort),a==null||a(p))},sortBy:{index:f.sort===r?d:void 0,direction:f.sort===r?o:void 0,defaultDirection:f.defaultSortDirection},columnIndex:d}},[i,a,r,o]);return g.jsx(Fe.Thead,{children:g.jsxs(Fe.Tr,{className:"bg-lighten",children:[c&&g.jsx(Fe.Th,{style:{padding:0},className:"bg-lighten"}),(s||l)&&g.jsx(Fe.Th,{isStickyColumn:!0,stickyMinWidth:"0px",hasRightBorder:e.scrollLeft,"data-cy":"selections-column-header",className:e.scrollLeft?"bg-lighten-2":"bg-lighten",children:" "}),t.map((d,f)=>g.jsx(Fe.Th,{sort:u(f,d),modifier:"nowrap",style:{minWidth:d.minWidth===0?"1%":d.minWidth!==void 0?d.minWidth:void 0,maxWidth:d.maxWidth!==void 0?d.maxWidth:void 0,width:d.fullWidth?"100%":void 0},"data-cy":Yr(d.header+"-column-header"),className:"bg-lighten",children:d.header},d.header)),n!==void 0&&g.jsx(Fe.Td,{isActionCell:!0,isStickyColumn:!0,stickyMinWidth:"0px",style:{right:0,padding:0,paddingRight:0,zIndex:302},className:e.scrollRight?"pf-m-border-left bg-lighten-2":"bg-lighten","data-cy":"action-column-header",children:" "})]})})}function Bde(e){const{columns:t,unselectAll:n,selectItem:r,unselectItem:i,isItemSelected:o,isSelectMultiple:a,item:s,rowActions:l,rowIndex:c,showSelect:u,onSelect:d,expandedRow:f,disableLastRowBorder:h,maxSelections:m,selectedItems:p}=e,y=f==null?void 0:f(s),[b,x]=v.useState(!!e.defaultExpandedRows&&!!y),S=Xo(),C=v.useCallback(_=>(p==null?void 0:p.length)===m?!(p!=null&&p.includes(_)):!1,[m,p]);return g.jsxs(g.Fragment,{children:[g.jsxs(Fe.Tr,{style:{boxShadow:"unset",borderBottom:b||e.isLastRow&&h?"unset":void 0,cursor:d?"pointer":"default"},"data-cy":"id"in s&&(typeof s.id=="string"||typeof s.id=="number")?`row-id-${s.id.toString()}`:`row-${c}`,className:o?"selected":void 0,onClick:()=>{d&&(a||n==null||n(),a&&o?i==null||i(s):r==null||r(s),d(s))},children:[f&&g.jsx(Fe.Td,{expand:y?{rowIndex:c,isExpanded:b,onToggle:()=>x(_=>!_)}:void 0,style:{paddingLeft:y?8:4},"data-cy":"expand-column-cell"}),u&&g.jsx(Fe.Th,{select:o!==void 0?{onSelect:(_,w)=>{w?r==null||r(s):i==null||i(s)},isSelected:o,isDisabled:m&&p?C(s):!1}:void 0,isStickyColumn:e.scrollLeft,stickyMinWidth:"0px",hasRightBorder:e.scrollLeft,"data-cy":"checkbox-column-cell",className:e.scrollLeft?"bg-lighten":void 0}),d&&g.jsx(Fe.Td,{select:{rowIndex:c,isSelected:o??!1,variant:a?"checkbox":"radio",isDisabled:m&&p?C(s):!1},isStickyColumn:e.scrollLeft,stickyMinWidth:"0px",hasRightBorder:e.scrollLeft,"data-cy":"checkbox-column-cell",className:e.scrollLeft?"bg-lighten":void 0}),g.jsx(Rde,{columns:t,item:s,rowActions:l,scrollLeft:e.scrollLeft,scrollRight:e.scrollRight})]}),f&&b&&y&&g.jsxs(Fe.Tr,{isExpanded:b,style:{boxShadow:"unset"},className:o?"selected":void 0,children:[g.jsx(Fe.Td,{}),u&&g.jsx(Fe.Th,{isStickyColumn:e.scrollLeft,stickyMinWidth:"0px",hasRightBorder:e.scrollLeft,className:e.scrollLeft?"bg-lighten":void 0}),d&&g.jsx(Fe.Td,{isStickyColumn:!0,stickyMinWidth:"0px",hasRightBorder:e.scrollLeft}),g.jsx(Fe.Td,{colSpan:t.length,style:{paddingBottom:S.tableLayout==="compact"?12:24,paddingTop:0},children:g.jsx(Fe.CollapseColumn,{children:y})}),l!==void 0&&l.length>0&&g.jsx(Fe.Td,{isActionCell:!0,isStickyColumn:e.scrollRight,stickyMinWidth:"0px",style:{right:0,padding:0,paddingRight:0},className:e.scrollRight?"pf-m-border-left bg-lighten":void 0,children:" "})]})]})}function Rde(e){const{columns:t,item:n,rowActions:r}=e,[i,o]=v.useState(!1);return g.jsxs(v.Fragment,{children:[t.map(a=>g.jsx(Fe.Td,{dataLabel:a.header,modifier:"nowrap",style:{width:a.minWidth===0?"0%":void 0},"data-cy":Yr(a.header+"-column-cell"),children:g.jsx(on,{item:n,column:a})},a.header)),r!==void 0&&r.length>0&&g.jsx(Fe.Td,{isActionCell:!0,isStickyColumn:e.scrollRight,stickyMinWidth:"0px",style:{right:0,padding:0,paddingRight:8,zIndex:i?400:void 0},"data-cy":"actions-column-cell",className:e.scrollRight?"pf-m-border-left bg-lighten":void 0,children:g.jsx(Kr,{actions:r,selectedItem:n,position:"right",iconOnly:!0,onOpen:o})})]})}function zde(e){return e.toLowerCase().split(" ").join("-")}function Vde(){const e=v.useRef(new AbortController);return v.useEffect(()=>{const t=e.current;return()=>t.abort()},[]),e.current}function GO(e){const{title:t,items:n,keyFn:r,actionColumns:i,actionFn:o,onComplete:a,onClose:s,processingText:l,isDanger:c,errorAdapter:u=Dc,description:d,statusParser:f}=e,{t:h}=$e(),[m]=Mt(),[p,y]=v.useState(!0),[b,x]=v.useState(!1),[S,C]=v.useState(0),[_,w]=v.useState(""),[k,A]=v.useState(),j=Vde(),[M,T]=Vi(),P=v.useCallback(()=>{x(!0),j.abort(),y(!1),A(W=>{const B={...W};for(const U of n){const V=r(U);B[V]===void 0&&(B[V]=h("Cancelled"))}return B})},[j,n,r,h]),D=v.useCallback(()=>{T(void 0),s==null||s(b?"canceled":_?"failures":"success",n.filter(W=>(k==null?void 0:k[r(W)])===null||(k==null?void 0:k[r(W)]).message),n.filter(W=>(k==null?void 0:k[r(W)])!==null&&typeof(k==null?void 0:k[r(W)])=="string"),n.filter(W=>(k==null?void 0:k[r(W)])===void 0))},[_,b,n,r,s,T,k]);v.useEffect(()=>{async function W(){const B=ide(5);let U=0;const V=[];await Promise.all(n.map(F=>B(async()=>{if(j.signal.aborted)return;const H=r(F);try{const X=await o(F,j.signal);if(!j.signal.aborted){let J;f&&(J=f(X)),A(Q=>({...Q??{},[H]:J!==void 0?J:null}))}V.push(F)}catch(X){const{genericErrors:J,fieldErrors:Q}=u(X),ee=[...J,...Q.filter(ie=>ie.message)];if(!j.signal.aborted){if(X instanceof Error){const ie=typeof ee[0].message=="string"&&ee.length===1?ee[0].message:h("Unknown error");A(ue=>({...ue??{},[H]:ie}))}else A(ie=>({...ie??{},[H]:h("Unknown error")}));w(m.errorText)}}finally{j.signal.aborted||C(++U)}}))),j.signal.aborted||y(!1),a==null||a(V)}W()},[j,o,n,r,a,m.errorText,h,u,f]);const I=Pc(n),$=ih(i);return g.jsxs(O.Modal,{titleIconVariant:c?"warning":void 0,title:t,ouiaId:t,"aria-label":t,description:d,variant:O.ModalVariant.medium,isOpen:!0,onClose:()=>{P(),D()},actions:p?[g.jsx(O.Button,{variant:"link",onClick:P,children:m.cancelText},"cancel")]:[g.jsx(O.Button,{variant:"secondary",onClick:D,children:m.closeText},"close")],hasNoBodyWrapper:!0,children:[g.jsx(O.ModalBoxBody,{style:{paddingBottom:0,paddingLeft:0,paddingRight:0},children:g.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:560,overflow:"hidden",borderTop:"thin solid var(--pf-v5-global--BorderColor--100)"},children:g.jsx(jc,{pageItems:[...I.paged],itemCount:n.length,tableColumns:[...$,{header:h("Status"),cell:W=>{const B=r(W),U=k==null?void 0:k[B];return U===void 0?g.jsxs("span",{style:{color:Pm},children:[g.jsx(ve.PendingIcon,{})," ",m.pendingText]}):U===null?g.jsxs("span",{style:{color:Am},children:[g.jsx(ve.CheckCircleIcon,{})," ",m.successText]}):U.message&&U.url?g.jsx("a",{href:U.url,children:U.message}):g.jsxs("span",{style:{color:Dm},children:[g.jsx(ve.ExclamationCircleIcon,{})," ",k==null?void 0:k[B]]})}}],keyFn:r,compact:!0,errorStateTitle:"",emptyStateTitle:h("No items"),autoHidePagination:!0,disableBodyPadding:!0,...I},"status")})}),g.jsx(O.ModalBoxBody,{style:{paddingTop:0},children:g.jsx(O.Progress,{"data-cy":"progress",value:S/n.length*100,title:j.signal.aborted?m.canceledText:_?m.errorText:p?l??m.processingText:m.successText,size:O.ProgressSize.lg,variant:_||b?O.ProgressVariant.danger:S===n.length?O.ProgressVariant.success:void 0})})]})}function YO(e=Dc,t){const[n,r]=Vi(),[i,o]=v.useState();return v.useEffect(()=>{if(i){const a=(s,l,c,u)=>{var d;o(void 0),(d=i.onClose)==null||d.call(i,s,l,c,u)};r(g.jsx(GO,{...i,errorAdapter:i.errorAdapter??e,statusParser:i.statusParser??t,onClose:a}))}else r(void 0)},[i,r,e,t]),o}function KO(e,t){if(e===void 0&&t===void 0)return 0;if(e===void 0)return 1;if(t===void 0)return-1;if(typeof e=="string"){if(typeof t=="string")return Mc(e,t);if(typeof t=="number")return Mc(e,t.toString())}else if(typeof e=="number"){if(typeof t=="number")return ZO(e,t);if(typeof t=="string")return Mc(e.toString(),t)}return 0}function Mc(e,t){return e===void 0&&t===void 0?0:e==null?1:t==null||e<t?-1:e>t?1:0}function ZO(e,t){return e===void 0&&t===void 0?0:e==null?1:t==null||e<t?-1:e>t?1:0}const Ude=Pe.div`
|
419
419
|
display: flex;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ansible/ansible-ui-framework",
|
3
3
|
"description": "A framework for building applications using PatternFly.",
|
4
|
-
"version": "2.4.
|
4
|
+
"version": "2.4.2594",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -20,7 +20,8 @@
|
|
20
20
|
"./style.css": {
|
21
21
|
"import": "./style.css",
|
22
22
|
"require": "./style.css"
|
23
|
-
}
|
23
|
+
},
|
24
|
+
"./assets/*": "./assets/*"
|
24
25
|
},
|
25
26
|
"keywords": [
|
26
27
|
"ansible",
|
package/publish/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
declare function g0e(e: any): any;
|
2
2
|
declare function WP(e: any): any;
|
3
3
|
declare function y1e(e: any): any;
|
4
|
-
declare function
|
4
|
+
declare function a1(e: any): any;
|
5
5
|
declare var oge: any;
|
6
6
|
declare var lge: any;
|
7
7
|
declare var age: any;
|
@@ -10,14 +10,14 @@ declare var cp: any;
|
|
10
10
|
declare var ao: any;
|
11
11
|
declare const i0e: any;
|
12
12
|
declare function v1e(e: any): any;
|
13
|
-
declare function
|
13
|
+
declare function Sbe(e: any): any;
|
14
14
|
declare function _be(e: any): any;
|
15
15
|
declare function b1e(e: any): any;
|
16
16
|
declare function dL(e: any): any;
|
17
17
|
declare function x1e(e: any): any;
|
18
18
|
declare function FP(e: any): any;
|
19
19
|
declare function $1e(e: any): any;
|
20
|
-
declare function
|
20
|
+
declare function ny(e: any): any;
|
21
21
|
declare var n$: any;
|
22
22
|
declare function fL(e: any): any;
|
23
23
|
declare function f1e(e: any): any;
|
@@ -26,7 +26,7 @@ declare var Oh: any;
|
|
26
26
|
declare var Qe: any;
|
27
27
|
declare var ct: any;
|
28
28
|
declare function la(e: any): any;
|
29
|
-
declare const
|
29
|
+
declare const dw: w.Context<{
|
30
30
|
addAlert: () => null;
|
31
31
|
removeAlert: () => null;
|
32
32
|
replaceAlert: () => null;
|
@@ -37,12 +37,12 @@ declare function q1e(e: any): any;
|
|
37
37
|
declare function p1e(e: any): any;
|
38
38
|
declare function ym(e: any): any;
|
39
39
|
declare function C1e(e: any): any;
|
40
|
-
declare function
|
41
|
-
declare function
|
42
|
-
declare const v6:
|
40
|
+
declare function py(e: any): any;
|
41
|
+
declare function S1e(e: any): any;
|
42
|
+
declare const v6: w.Context<{
|
43
43
|
columns: number;
|
44
44
|
}>;
|
45
|
-
declare function
|
45
|
+
declare function w1e(e: any): any;
|
46
46
|
declare function E1e(e: any): any;
|
47
47
|
declare function O1e(e: any): any;
|
48
48
|
declare function cc(e: any): any;
|
@@ -66,21 +66,21 @@ declare function QM(e: any): any;
|
|
66
66
|
declare function $be(e: any): any;
|
67
67
|
declare function V1e(e: any): any;
|
68
68
|
declare function Ibe(): any;
|
69
|
-
declare const BA:
|
69
|
+
declare const BA: w.Context<{
|
70
70
|
isOpen: boolean;
|
71
71
|
setState: () => {};
|
72
72
|
}>;
|
73
|
-
declare function
|
73
|
+
declare function wbe(e: any): any;
|
74
74
|
declare function Lbe(e: any): any;
|
75
|
-
declare function
|
75
|
+
declare function w0e(): any;
|
76
76
|
declare function M1e(): any;
|
77
77
|
declare function U1e(): any;
|
78
|
-
declare const al:
|
78
|
+
declare const al: w.Context<{}[]>;
|
79
79
|
declare function lL(e: any): any;
|
80
|
-
declare function
|
80
|
+
declare function T_(e: any): any;
|
81
81
|
declare function Cg(e: any): any;
|
82
82
|
declare function a0e(e: any): any;
|
83
|
-
declare function
|
83
|
+
declare function xC(e: any): any;
|
84
84
|
declare function K1e(e: any): any;
|
85
85
|
declare function H1e(): any;
|
86
86
|
declare function Ige(e: any): any;
|
@@ -88,7 +88,7 @@ declare function Age(e: any): any;
|
|
88
88
|
declare function Z1e(e: any): any;
|
89
89
|
declare const KM: any;
|
90
90
|
declare function Lr(e: any): any;
|
91
|
-
declare function
|
91
|
+
declare function S0e(e: any): any;
|
92
92
|
declare const Zge: any;
|
93
93
|
declare function ln(e: any): any;
|
94
94
|
declare function hL(e: any): any;
|
@@ -107,11 +107,11 @@ declare function m1e(e: any): {
|
|
107
107
|
declare function Nbe(e: any, t: any): any;
|
108
108
|
declare function Ms(e: any): "var(--pf-v5-global--success-color--100)" | "var(--pf-v5-global--danger-color--100)" | "var(--pf-v5-global--warning-color--100)" | "var(--pf-v5-global--info-color--100)" | "var(--pf-v5-global--disabled-color--100)" | undefined;
|
109
109
|
declare function Ti(e: any, t: any): any;
|
110
|
-
declare const
|
111
|
-
declare const
|
112
|
-
declare const
|
110
|
+
declare const iw: "var(--pf-v5-global--danger-color--100)";
|
111
|
+
declare const ow: "var(--pf-v5-global--disabled-color--100)";
|
112
|
+
declare const aw: "var(--pf-v5-global--info-color--100)";
|
113
113
|
declare const h1e: "var(--pf-v5-global--link--Color)";
|
114
|
-
declare const
|
114
|
+
declare const rw: "var(--pf-v5-global--success-color--100)";
|
115
115
|
declare const g1e: "var(--pf-v5-global--danger-color--100)";
|
116
116
|
declare const t$: "var(--pf-v5-global--warning-color--100)";
|
117
117
|
declare function G1e(e: any): any;
|
@@ -125,7 +125,7 @@ declare function m0e(e: ((e: any) => {
|
|
125
125
|
name: string;
|
126
126
|
message: string;
|
127
127
|
}[];
|
128
|
-
}) | undefined, t: any):
|
128
|
+
}) | undefined, t: any): w.Dispatch<w.SetStateAction<undefined>>;
|
129
129
|
declare function D1e(e: ((e: any) => {
|
130
130
|
genericErrors: {
|
131
131
|
message: string;
|
@@ -156,7 +156,7 @@ declare function P3(e: any, t: any, n?: boolean): {
|
|
156
156
|
form: undefined;
|
157
157
|
handleSubmit: any;
|
158
158
|
error: null;
|
159
|
-
setError:
|
159
|
+
setError: w.Dispatch<w.SetStateAction<null>>;
|
160
160
|
handleSubmitError: (c: any) => void;
|
161
161
|
setFieldError: any;
|
162
162
|
};
|
@@ -210,22 +210,22 @@ declare function X1e(e: any): {
|
|
210
210
|
keyFn: any;
|
211
211
|
unselectItems: (h: any) => void;
|
212
212
|
page: number;
|
213
|
-
setPage:
|
213
|
+
setPage: w.Dispatch<w.SetStateAction<number>>;
|
214
214
|
perPage: number;
|
215
|
-
setPerPage:
|
215
|
+
setPerPage: w.Dispatch<w.SetStateAction<number>>;
|
216
216
|
sort: any;
|
217
|
-
setSort:
|
217
|
+
setSort: w.Dispatch<any>;
|
218
218
|
sortDirection: any;
|
219
|
-
setSortDirection:
|
219
|
+
setSortDirection: w.Dispatch<any>;
|
220
220
|
filterState: any;
|
221
|
-
setFilterState:
|
221
|
+
setFilterState: w.Dispatch<any>;
|
222
222
|
clearAllFilters: () => void;
|
223
223
|
itemCount: number | undefined;
|
224
224
|
pageItems: never[] | undefined;
|
225
225
|
error: any;
|
226
226
|
};
|
227
227
|
declare function d1e(): string;
|
228
|
-
declare function
|
228
|
+
declare function iy(): {
|
229
229
|
addAlert: () => null;
|
230
230
|
removeAlert: () => null;
|
231
231
|
replaceAlert: () => null;
|
@@ -239,7 +239,7 @@ declare function Wge(): {
|
|
239
239
|
popDialog: () => void;
|
240
240
|
};
|
241
241
|
declare function Obe(): (i: any) => void;
|
242
|
-
declare function
|
242
|
+
declare function wb(): {
|
243
243
|
isOpen: boolean;
|
244
244
|
setState: () => {};
|
245
245
|
};
|
@@ -248,9 +248,9 @@ declare function ol(): {};
|
|
248
248
|
declare function xg(e: any): {
|
249
249
|
paged: never[];
|
250
250
|
page: number;
|
251
|
-
setPage:
|
251
|
+
setPage: w.Dispatch<w.SetStateAction<number>>;
|
252
252
|
perPage: number;
|
253
|
-
setPerPage:
|
253
|
+
setPerPage: w.Dispatch<w.SetStateAction<number>>;
|
254
254
|
};
|
255
255
|
declare function P1e(e: any): (p: any, y: any) => void;
|
256
256
|
declare function c3(e: any, t: any, n: any): {
|
@@ -280,7 +280,7 @@ declare function zge(e: any, t: any): {
|
|
280
280
|
declare function u3(e: any): {
|
281
281
|
sorted: any;
|
282
282
|
sort: undefined;
|
283
|
-
setSort:
|
283
|
+
setSort: w.Dispatch<w.SetStateAction<undefined>>;
|
284
284
|
};
|
285
285
|
declare function A1e(e: any, t: any, n: any): {
|
286
286
|
allSelected: boolean;
|
@@ -296,11 +296,11 @@ declare function A1e(e: any, t: any, n: any): {
|
|
296
296
|
selectPage: () => void;
|
297
297
|
selectedItems: any[];
|
298
298
|
setFilterFn: (c: any) => void;
|
299
|
-
setPage:
|
300
|
-
setPerPage:
|
299
|
+
setPage: w.Dispatch<w.SetStateAction<number>>;
|
300
|
+
setPerPage: w.Dispatch<w.SetStateAction<number>>;
|
301
301
|
setSearch: any;
|
302
302
|
setSearchFn: (h: any) => void;
|
303
|
-
setSort:
|
303
|
+
setSort: w.Dispatch<w.SetStateAction<undefined>>;
|
304
304
|
sort: undefined;
|
305
305
|
sorted: any;
|
306
306
|
unselectAll: () => void;
|
@@ -308,23 +308,23 @@ declare function A1e(e: any, t: any, n: any): {
|
|
308
308
|
};
|
309
309
|
declare function r1e(e: any): {
|
310
310
|
page: number;
|
311
|
-
setPage:
|
311
|
+
setPage: w.Dispatch<w.SetStateAction<number>>;
|
312
312
|
perPage: number;
|
313
|
-
setPerPage:
|
313
|
+
setPerPage: w.Dispatch<w.SetStateAction<number>>;
|
314
314
|
sort: any;
|
315
|
-
setSort:
|
315
|
+
setSort: w.Dispatch<any>;
|
316
316
|
sortDirection: any;
|
317
|
-
setSortDirection:
|
317
|
+
setSortDirection: w.Dispatch<any>;
|
318
318
|
filterState: any;
|
319
|
-
setFilterState:
|
319
|
+
setFilterState: w.Dispatch<any>;
|
320
320
|
clearAllFilters: () => void;
|
321
321
|
};
|
322
322
|
declare function uge(e: any): any;
|
323
323
|
declare function k1e(e: any, t: any): any;
|
324
324
|
declare function cge(e: any): any;
|
325
|
-
declare function
|
325
|
+
declare function ib(e: any): any;
|
326
326
|
declare function r3(e: any): any;
|
327
327
|
declare function RP(): string;
|
328
328
|
declare function ya(e: any, t: any): any;
|
329
|
-
import * as
|
330
|
-
export { g0e as BulkActionDialog, WP as BulkSelector, y1e as BytesCell,
|
329
|
+
import * as w from "react";
|
330
|
+
export { g0e as BulkActionDialog, WP as BulkSelector, y1e as BytesCell, a1 as Collapse, oge as ColumnCardOption, lge as ColumnDashboardOption, age as ColumnListOption, sge as ColumnModalOption, cp as ColumnPriority, ao as ColumnTableOption, i0e as ColumnsDiv, v1e as CopyCell, Sbe as DataEditorActions, _be as DataEditorButtons, b1e as DateCell, dL as DateTimeCell, x1e as ElapsedTimeCell, FP as FrameworkTranslationsProvider, $1e as GenericForm, ny as Help, n$ as LabelColorE, fL as LabelsCell, f1e as LoadingPage, j1e as MultiSelectDialog, Oh as PFColorE, Qe as PageActionSelection, ct as PageActionType, la as PageActions, dw as PageAlertToasterContext, P$ as PageAlertToasterProvider, q1e as PageApp, p1e as PageBody, ym as PageChartContainer, C1e as PageDashboard, py as PageDashboardCard, S1e as PageDashboardChart, v6 as PageDashboardContext, w1e as PageDashboardCount, E1e as PageDashboardDonutCard, O1e as PageDashboardGettingStarted, cc as PageDetail, r0e as PageDetailDiv, rge as PageDetails, mge as PageDetailsFromColumns, Rge as PageDialogProvider, Qhe as PageDonutChart, U0e as PageForm, z0e as PageFormCancelButton, I1e as PageFormCheckbox, F1e as PageFormDataEditor, H0e as PageFormGrid, N1e as PageFormSelect, j3 as PageFormSubmitButton, R1e as PageFormSwitch, W1e as PageFormTextArea, z1e as PageFormTextInput, B1e as PageFramework, QM as PageHeader, $be as PageLayout, V1e as PageMasthead, Ibe as PageMastheadToggle, BA as PageNavSideBarContext, wbe as PageNavSideBarProvider, Lbe as PageNavigation, w0e as PageNotFound, M1e as PageNotImplemented, U1e as PageNotificationsIcon, al as PageSettingsContext, lL as PageSettingsProvider, T_ as PageTab, Cg as PageTable, a0e as PageTableCard, xC as PageTableCards, K1e as PageTabs, H1e as PageThemeSwitcher, Ige as PageToolbar, Age as PageToolbarFilters, Z1e as PageWizard, KM as RunningIcon, Lr as Scrollable, S0e as SelectDialog, Zge as Small, ln as TableColumnCell, hL as TextCell, kge as ToolbarFilterType, Wbe as addNavigationItem, zbe as addNavigationItemAfter, Bbe as addNavigationItemBefore, y0e as compareNumbers, Id as compareStrings, p0e as compareUnknowns, m1e as errorToAlertProps, Nbe as findNavigationItemById, Ms as getPatternflyColor, Ti as objectToString, iw as pfDanger, ow as pfDisabled, aw as pfInfo, h1e as pfLink, rw as pfSuccess, g1e as pfUnreachable, t$ as pfWarning, G1e as removeLeadingSlash, Rbe as removeNavigationItemById, Dn as useBreakpoint, m0e as useBulkActionDialog, D1e as useBulkConfirmation, o0e as useColumnsToTableCardFn, gge as useColumnsWithoutExpandedRow, hge as useColumnsWithoutSort, T1e as useDashboardColumns, dge as useDescriptionColumns, fge as useExpandedColumns, d3 as useFiltered, P3 as useFormErrors, Yt as useFrameworkTranslations, Vbe as useGetPageUrl, X1e as useInMemoryView, d1e as useOrientation, iy as usePageAlertToaster, Ka as usePageDialog, Wge as usePageDialogs, Obe as usePageNavBarClick, wb as usePageNavSideBar, Y1e as usePageNavigate, ol as usePageSettings, xg as usePaged, P1e as useSelectDialog, c3 as useSelected, zge as useSelectedInMemory, u3 as useSorted, A1e as useTableItems, r1e as useView, uge as useVisibleCardColumns, k1e as useVisibleColumns, cge as useVisibleListColumns, ib as useVisibleModalColumns, r3 as useVisibleTableColumns, RP as useWindowSize, ya as valueToObject };
|