AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.224.51.49


Current Path : /snap/lxd/29351/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/29351/share/lxd-ui/assets/SelectableMainTable-5a3f3fef.js

import{j as n,d as s,aa as R}from"./index-13b2882d.js";const A=({filteredNames:t,itemName:o,parentName:u,selectedNames:l,setSelectedNames:a,processingNames:b,rows:i,headers:x,...d})=>{const h=l.length===t.length&&l.length>0,m=l.length>0,p=()=>{a(t)},r=()=>{a(i.map(e=>e.name??""))},C=()=>{a([])},k=[{content:n.jsxs(n.Fragment,{children:[n.jsx(s.CheckboxInput,{label:n.jsx("div",{className:"u-off-screen",children:"Select all"}),labelClassName:"multiselect-checkbox",checked:h,indeterminate:m&&!h,onChange:m?C:r}),n.jsx(s.ContextualMenu,{className:"select-context-menu",position:"left",title:"Multiselect",toggleAppearance:"base",toggleClassName:"has-icon u-no-margin--bottom",toggleLabel:n.jsx(s.Icon,{name:"chevron-down"}),toggleProps:{"aria-label":"multiselect rows"},links:[{children:`Select all ${o}s on this page`,onClick:r},{children:`Select all ${u} ${o}s`,onClick:p}]})]}),className:"select select-header","aria-label":"select"},...x??[]],j=i.map(e=>{const c=l.includes(e.name??""),g=b.includes(e.name??""),S=()=>{const f=c?l.filter(M=>M!==e.name):[...l,e.name??""];a(f)};return e.columns=[{content:n.jsx(s.CheckboxInput,{label:n.jsxs("div",{className:"u-off-screen",children:["Select ",e.name??"row"]}),labelClassName:"u-no-margin--bottom",checked:c,onChange:S,disabled:g||!e.name}),role:"rowheader",className:"select"},...e.columns??[]],e.className=R(e.className,{"selected-row":c,"processing-row":g}),e.key=e.name,e});return n.jsx(s.MainTable,{expanding:!0,headers:k,rows:[...j],...d})};export{A as S};