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