@zydon/common-csr 2.0.14 → 2.0.15

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.
@@ -19,6 +19,6 @@ import U from '@zydon/common/components/SearchInput';
19
19
  import z from '@zydon/common/components/Scrollbar';
20
20
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
21
21
 
22
- var v=styled(z)(()=>({maxHeight:"260px"}));var W=({items:i})=>{let{setValue:f,getValues:x}=useFormContext(),[a,A]=useState(-1),[p,d]=useState(""),E=Object.fromEntries(i.map((t,o)=>[o,[]])),[c,h]=useState(E);useEffect(()=>()=>{f("config",{});},[]);let F=(t,o)=>{A(o?t:-1),o&&T();},T=()=>{d("");},y=(t,o,e)=>{let n=e.target.checked?[...c[a],o]:c[a].filter(l=>l!==o);h({...c,[a]:n}),b(t,n);},S=t=>{d(t);},I=()=>{let o=i[a].list.every(e=>c[a].includes(e.value))?[]:[...i[a].list.map(e=>e.value)];h({...c,[a]:o}),b(i[a].name,o);},b=(t,o)=>{let e={},n=x("config"),l=i[a];if(l){let V=l.list.filter(u=>c[a].includes(u.value)).map(u=>u.value);e[l.name]={type:"FIELD",values:l.name===t?o:V},f("config",{...n,...e});}};return jsx(Fragment,{children:i.map((t,o)=>jsxs(P,{expanded:a===o,onChange:(e,n)=>F(o,n),children:[jsx(H,{expandIcon:jsx(j,{icon:"CHEVRON_UP"}),id:`${o}`,children:jsxs(w,{alignItems:"center",direction:"row",children:[jsx(m,{variant:"subtitle2",color:"grey.600",children:t.label}),jsxs(G,{variant:"soft",color:"primary",marginLeft:1,sx:e=>({backgroundColor:`${alpha(e.palette.grey[400],.2)}`,cursor:"pointer"}),children:[c[o].length," selecionados"]})]})}),jsxs(B,{children:[jsxs(w,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(U,{onSearch:S,onChange:e=>S(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:p,fullWidth:!0}),jsx(_,{onClick:()=>I(),size:"small",children:jsx(m,{variant:"overline",children:"TODOS"})})]}),jsx(v,{children:jsx(M,{children:a>-1&&(t.list.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(k,{children:jsx(L,{control:jsx(C,{size:"small",checked:c[a].includes(e.value),onChange:l=>y(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)).length===0?jsx($,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):t.list.filter(e=>e.label.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(k,{children:jsx(L,{control:jsx(C,{size:"small",checked:c[a].includes(e.value),onChange:l=>y(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)))})})]})]},o))})},he=W;
22
+ var v=styled(z)(()=>({maxHeight:"260px"}));var W=({items:i})=>{let{setValue:f,getValues:x}=useFormContext(),[a,A]=useState(-1),[p,d]=useState(""),E=Object.fromEntries(i.map((t,o)=>[o,[]])),[c,h]=useState(E);useEffect(()=>()=>{f("config",{});},[]);let F=(t,o)=>{A(o?t:-1),o&&T();},T=()=>{d("");},y=(t,o,e)=>{let n=e.target.checked?[...c[a],o]:c[a].filter(l=>l!==o);h({...c,[a]:n}),b(t,n);},S=t=>{d(t);},I=()=>{let o=i[a].list.every(e=>c[a].includes(e.value))?[]:[...i[a].list.map(e=>e.value)];h({...c,[a]:o}),b(i[a].name,o);},b=(t,o)=>{let e={},n=x("config"),l=i[a];if(l){let V=l.list.filter(u=>c[a].includes(u.value)).map(u=>u.value);e[l.name]={type:"FIELD",values:l.name===t?o:V},f("config",{...n,...e});}};return jsx(Fragment,{children:i.map((t,o)=>jsxs(P,{expanded:a===o,onChange:(e,n)=>F(o,n),children:[jsx(H,{expandIcon:jsx(j,{icon:"CHEVRON_UP"}),id:`${o}`,children:jsxs(w,{alignItems:"center",direction:"row",children:[jsx(m,{variant:"subtitle2",color:"grey.600",children:t.label}),jsxs(G,{variant:"soft",color:"primary",marginLeft:1,sx:e=>({backgroundColor:`${alpha(e.palette.grey[400],.2)}`,cursor:"pointer"}),children:[c[o].length," selecionados"]})]})}),jsxs(B,{children:[jsxs(w,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(U,{onSearch:S,onChange:e=>S(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:p,fullWidth:!0}),jsx(_,{onClick:()=>I(),size:"small",children:jsx(m,{variant:"overline",children:"TODOS"})})]}),jsx(v,{children:jsx(M,{children:a>-1&&(t.list.filter(e=>e.label?.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(k,{children:jsx(L,{control:jsx(C,{size:"small",checked:c[a].includes(e.value),onChange:l=>y(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)).length===0?jsx($,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):t.list.filter(e=>e.label?.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(k,{children:jsx(L,{control:jsx(C,{size:"small",checked:c[a].includes(e.value),onChange:l=>y(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)))})})]})]},o))})},he=W;
23
23
 
24
24
  export { he as default };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.14",
2
+ "version": "2.0.15",
3
3
  "name": "@zydon/common-csr",
4
4
  "description": "Zydon common resources for React projects (only Client-Side Rendering (CSR))",
5
5
  "license": "MIT",