@zydon/common-csr 2.0.67 → 2.0.68
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.
|
@@ -3,22 +3,22 @@ import { useFormContext } from 'react-hook-form';
|
|
|
3
3
|
import P from '@mui/material/Accordion';
|
|
4
4
|
import B from '@mui/material/AccordionDetails';
|
|
5
5
|
import H from '@mui/material/AccordionSummary';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
6
|
+
import M from '@mui/material/Button';
|
|
7
|
+
import _ from '@mui/material/Checkbox';
|
|
8
|
+
import k from '@mui/material/FormControlLabel';
|
|
9
|
+
import N from '@mui/material/List';
|
|
10
|
+
import w from '@mui/material/ListItem';
|
|
11
|
+
import $ from '@mui/material/Radio';
|
|
12
|
+
import I from '@mui/material/Stack';
|
|
13
13
|
import { styled, alpha } from '@mui/material/styles';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import u from '@mui/material/Typography';
|
|
15
|
+
import q 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
|
-
import
|
|
19
|
+
import z from '@zydon/common/components/Scrollbar';
|
|
20
20
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
21
21
|
|
|
22
|
-
var L=styled(
|
|
22
|
+
var L=styled(z)(()=>({maxHeight:"260px"}));var J=({items:s,onChange:d})=>{let{setValue:h,getValues:x}=useFormContext(),[a,A]=useState(-1),[g,y]=useState(""),E=Object.fromEntries(s.map((n,o)=>[o,[]])),[c,S]=useState(E);useEffect(()=>()=>{h("config",{});},[]);let F=(n,o)=>{A(o?n:-1),o&&T();},T=()=>{y("");},b=(n,o,r,e)=>{let l=e==="unique"?[o]:[...c[a],o],i=r.target.checked?l:c[a].filter(m=>m!==o);S({...c,[a]:i}),C(n,i);},v=n=>{y(n);},R=()=>{let o=s[a].list.every(r=>c[a].includes(r.value))?[]:[...s[a].list.map(r=>r.value)];S({...c,[a]:o}),C(s[a].name,o);},C=(n,o)=>{let r={},e=x("config"),l=s[a];if(l){let i=l.list.filter(m=>c[a].includes(m.value)).map(m=>m.value);r[l.name]={type:"FIELD",values:l.name===n?o:i},h("config",{...e,...r}),d&&d({...e,...r});}};return jsx(Fragment,{children:s.map(({type:n="multi",...o},r)=>jsxs(P,{expanded:a===r,onChange:(e,l)=>F(r,l),children:[jsx(H,{expandIcon:jsx(G,{icon:"CHEVRON_UP"}),id:`${r}`,children:jsxs(I,{alignItems:"center",direction:"row",children:[jsx(u,{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[r].length," selecionados"]})]})}),jsxs(B,{children:[jsxs(I,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(W,{onSearch:v,onChange:e=>v(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:g,fullWidth:!0}),n==="multi"&&jsx(M,{onClick:()=>R(),size:"small",children:jsx(u,{variant:"overline",children:"TODOS"})})]}),jsx(L,{children:jsx(N,{children:a>-1&&(o.list.filter(e=>e.label?.toLowerCase().includes(g.toLowerCase())).map((e,l)=>jsx(w,{children:jsx(k,{control:jsx($,{size:"small",checked:c[a].includes(e.value),onChange:i=>b(o.name,e.value,i,n),name:e.label}),label:jsx(u,{variant:"caption",color:"grey.600",children:e.label})})},l)).length===0?jsx(q,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):o.list.filter(e=>e.label?.toLowerCase().includes(g.toLowerCase())).map((e,l)=>jsx(w,{children:jsx(k,{control:jsx(_,{size:"small",checked:c[a].includes(e.value),onChange:i=>b(o.name,e.value,i,n),name:e.label}),label:jsx(u,{variant:"caption",color:"grey.600",children:e.label})})},l)))})})]})]},r))})},be=J;
|
|
23
23
|
|
|
24
24
|
export { be as default };
|
package/package.json
CHANGED