@zydon/common-csr 2.0.65 → 2.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,19 +6,19 @@ import H from '@mui/material/AccordionSummary';
|
|
|
6
6
|
import _ from '@mui/material/Button';
|
|
7
7
|
import w from '@mui/material/Checkbox';
|
|
8
8
|
import h from '@mui/material/FormControlLabel';
|
|
9
|
-
import
|
|
9
|
+
import q from '@mui/material/List';
|
|
10
10
|
import x from '@mui/material/ListItem';
|
|
11
|
-
import
|
|
11
|
+
import N from '@mui/material/Radio';
|
|
12
12
|
import A from '@mui/material/Stack';
|
|
13
13
|
import { styled, alpha } from '@mui/material/styles';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import p from '@mui/material/Typography';
|
|
15
|
+
import j from '@zydon/common/components/EmptyView';
|
|
16
16
|
import G from '@zydon/common/components/Icon';
|
|
17
17
|
import U from '@zydon/common/components/Label';
|
|
18
18
|
import W from '@zydon/common/components/SearchInput';
|
|
19
19
|
import I from '@zydon/common/components/Scrollbar';
|
|
20
20
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
21
21
|
|
|
22
|
-
var L=styled(I)(()=>({maxHeight:"260px"}));var J=({items:
|
|
22
|
+
var L=styled(I)(()=>({maxHeight:"260px"}));var J=({items:s,onChange:v})=>{let{setValue:y,getValues:T}=useFormContext(),[a,E]=useState(-1),[g,b]=useState(""),F=Object.fromEntries(s.map((t,o)=>[o,[]])),[c,S]=useState(F);useEffect(()=>()=>{y("config",{});},[]);let R=(t,o)=>{E(o?t:-1),o&&V();},V=()=>{b("");},d=(t,o,n,e)=>{let l=e==="unique"?[o]:[...c[a],o],m=n.target.checked?l:c[a].filter(u=>u!==o);S({...c,[a]:m}),k(t,m);},C=t=>{b(t);},z=()=>{let o=s[a].list.every(n=>c[a].includes(n.value))?[]:[...s[a].list.map(n=>n.value)];S({...c,[a]:o}),k(s[a].name,o);},k=(t,o)=>{let n={},e=T("config"),l=s[a];if(l){let m=l.list.filter(u=>c[a].includes(u.value)).map(u=>u.value);n[l.name]={type:"FIELD",values:l.name===t?o:m},y("config",{...e,...n}),v&&v({...e,...n});}};return jsx(Fragment,{children:s.map(({type:t="multi",...o},n)=>jsxs(P,{expanded:a===n,onChange:(e,l)=>R(n,l),children:[jsx(H,{expandIcon:jsx(G,{icon:"CHEVRON_UP"}),id:`${n}`,children:jsxs(A,{alignItems:"center",direction:"row",children:[jsx(p,{variant:"subtitle2",color:"grey.600",children:o.label}),jsxs(U,{variant:"soft",color:"primary",marginLeft:1,sx:e=>({backgroundColor:`${alpha(e.palette.grey[400],.2)}`,cursor:"pointer"}),children:[c[n].length," selecionados"]})]})}),jsxs(B,{children:[jsxs(A,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(W,{onSearch:C,onChange:e=>C(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:g,fullWidth:!0}),t==="multi"&&jsx(_,{onClick:()=>z(),size:"small",children:jsx(p,{variant:"overline",children:"TODOS"})})]}),jsx(L,{children:jsx(q,{children:a>-1&&(o.list.filter(e=>e.label?.toLowerCase().includes(g.toLowerCase())).map(e=>jsxs(x,{children:[t==="multi"&&jsx(h,{control:jsx(w,{size:"small",checked:c[a].includes(e.value),onChange:l=>d(o.name,e.value,l,t),name:e.label}),label:jsx(p,{variant:"caption",color:"grey.600",children:e.label})}),t==="unique"&&jsx(h,{checked:c[a].includes(e.value),control:jsx(N,{size:"small",onChange:l=>d(o.name,e.value,l,t)}),value:e.value,label:jsxs(p,{variant:"caption",color:"grey.600",children:["MuiRadio: ",e.label]})})]},t+e.value)).length===0?jsx(j,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):o.list.filter(e=>e.label?.toLowerCase().includes(g.toLowerCase())).map((e,l)=>jsx(x,{children:jsx(h,{control:jsx(w,{size:"small",checked:c[a].includes(e.value),onChange:m=>d(o.name,e.value,m,t),name:e.label}),label:jsx(p,{variant:"caption",color:"grey.600",children:e.label})})},l)))})})]})]},n))})},be=J;
|
|
23
23
|
|
|
24
24
|
export { be as default };
|
package/package.json
CHANGED