@zydon/common-csr 2.0.60 → 2.0.61

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.
@@ -11,8 +11,9 @@ interface Item {
11
11
  }
12
12
  interface FilterRuleProps {
13
13
  items: Item[];
14
+ onChange?(values: any): void;
14
15
  }
15
16
 
16
- declare const FilterRule: ({ items }: FilterRuleProps) => react_jsx_runtime.JSX.Element;
17
+ declare const FilterRule: ({ items, onChange }: FilterRuleProps) => react_jsx_runtime.JSX.Element;
17
18
 
18
19
  export { FilterRule as default };
@@ -1,23 +1,23 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { useFormContext } from 'react-hook-form';
3
- import P from '@mui/material/Accordion';
4
- import B from '@mui/material/AccordionDetails';
5
- import H from '@mui/material/AccordionSummary';
6
- import _ from '@mui/material/Button';
7
- import C from '@mui/material/Checkbox';
8
- import L from '@mui/material/FormControlLabel';
9
- import M from '@mui/material/List';
10
- import k from '@mui/material/ListItem';
11
- import w from '@mui/material/Stack';
3
+ import B from '@mui/material/Accordion';
4
+ import H from '@mui/material/AccordionDetails';
5
+ import _ from '@mui/material/AccordionSummary';
6
+ import M from '@mui/material/Button';
7
+ import L 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 x from '@mui/material/Stack';
12
12
  import { styled, alpha } from '@mui/material/styles';
13
13
  import m from '@mui/material/Typography';
14
- import $ from '@zydon/common/components/EmptyView';
15
- import j from '@zydon/common/components/Icon';
16
- import G from '@zydon/common/components/Label';
17
- import U from '@zydon/common/components/SearchInput';
18
- import z from '@zydon/common/components/Scrollbar';
14
+ import j from '@zydon/common/components/EmptyView';
15
+ import G from '@zydon/common/components/Icon';
16
+ import U from '@zydon/common/components/Label';
17
+ import W from '@zydon/common/components/SearchInput';
18
+ import D from '@zydon/common/components/Scrollbar';
19
19
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
20
20
 
21
- 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;
21
+ var C=styled(D)(()=>({maxHeight:"260px"}));var q=({items:i,onChange:f})=>{let{setValue:d,getValues:A}=useFormContext(),[a,E]=useState(-1),[p,h]=useState(""),F=Object.fromEntries(i.map((t,o)=>[o,[]])),[c,y]=useState(F);useEffect(()=>()=>{d("config",{});},[]);let T=(t,o)=>{E(o?t:-1),o&&I();},I=()=>{h("");},S=(t,o,e)=>{let n=e.target.checked?[...c[a],o]:c[a].filter(l=>l!==o);y({...c,[a]:n}),v(t,n);},b=t=>{h(t);},V=()=>{let o=i[a].list.every(e=>c[a].includes(e.value))?[]:[...i[a].list.map(e=>e.value)];y({...c,[a]:o}),v(i[a].name,o);},v=(t,o)=>{let e={},n=A("config"),l=i[a];if(l){let R=l.list.filter(u=>c[a].includes(u.value)).map(u=>u.value);e[l.name]={type:"FIELD",values:l.name===t?o:R},d("config",{...n,...e}),f&&f({...n,...e});}};return jsx(Fragment,{children:i.map((t,o)=>jsxs(B,{expanded:a===o,onChange:(e,n)=>T(o,n),children:[jsx(_,{expandIcon:jsx(G,{icon:"CHEVRON_UP"}),id:`${o}`,children:jsxs(x,{alignItems:"center",direction:"row",children:[jsx(m,{variant:"subtitle2",color:"grey.600",children:t.label}),jsxs(U,{variant:"soft",color:"primary",marginLeft:1,sx:e=>({backgroundColor:`${alpha(e.palette.grey[400],.2)}`,cursor:"pointer"}),children:[c[o].length," selecionados"]})]})}),jsxs(H,{children:[jsxs(x,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(W,{onSearch:b,onChange:e=>b(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:p,fullWidth:!0}),jsx(M,{onClick:()=>V(),size:"small",children:jsx(m,{variant:"overline",children:"TODOS"})})]}),jsx(C,{children:jsx(N,{children:a>-1&&(t.list.filter(e=>e.label?.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(w,{children:jsx(k,{control:jsx(L,{size:"small",checked:c[a].includes(e.value),onChange:l=>S(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)).length===0?jsx(j,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):t.list.filter(e=>e.label?.toLowerCase().includes(p.toLowerCase())).map((e,n)=>jsx(w,{children:jsx(k,{control:jsx(L,{size:"small",checked:c[a].includes(e.value),onChange:l=>S(t.name,e.value,l),name:e.label}),label:jsx(m,{variant:"caption",color:"grey.600",children:e.label})})},n)))})})]})]},o))})},ye=q;
22
22
 
23
- export { he as default };
23
+ export { ye as default };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.60",
2
+ "version": "2.0.61",
3
3
  "name": "@zydon/common-csr",
4
4
  "description": "Zydon common resources for React projects (only Client-Side Rendering (CSR))",
5
5
  "license": "MIT",