@zydon/common-csr 2.0.87 → 2.0.89
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.
|
@@ -12,9 +12,12 @@ interface Item {
|
|
|
12
12
|
}
|
|
13
13
|
interface FilterRuleProps {
|
|
14
14
|
items: Item[];
|
|
15
|
+
initialValues?: {
|
|
16
|
+
[key: number]: string[];
|
|
17
|
+
};
|
|
15
18
|
onChange?(values: any): void;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
declare const FilterRule: ({ items, onChange }: FilterRuleProps) => react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare const FilterRule: ({ items, initialValues, onChange }: FilterRuleProps) => react_jsx_runtime.JSX.Element;
|
|
19
22
|
|
|
20
23
|
export { FilterRule as default };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useFormContext } from 'react-hook-form';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import _ from '@mui/material/Accordion';
|
|
4
|
+
import N from '@mui/material/AccordionDetails';
|
|
5
|
+
import $ from '@mui/material/AccordionSummary';
|
|
6
6
|
import k from '@mui/material/Button';
|
|
7
7
|
import L from '@mui/material/Checkbox';
|
|
8
8
|
import w from '@mui/material/FormControlLabel';
|
|
9
|
-
import
|
|
9
|
+
import j from '@mui/material/List';
|
|
10
10
|
import A from '@mui/material/ListItem';
|
|
11
11
|
import x from '@mui/material/Radio';
|
|
12
12
|
import T from '@mui/material/Stack';
|
|
13
13
|
import { styled, alpha } from '@mui/material/styles';
|
|
14
14
|
import p from '@mui/material/Typography';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
15
|
+
import G from '@zydon/common/components/EmptyView';
|
|
16
|
+
import U from '@zydon/common/components/Icon';
|
|
17
|
+
import W from '@zydon/common/components/Label';
|
|
18
|
+
import J from '@zydon/common/components/SearchInput';
|
|
19
|
+
import O from '@zydon/common/components/Scrollbar';
|
|
20
20
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
21
21
|
|
|
22
|
-
var C=styled(
|
|
22
|
+
var C=styled(O)(()=>({maxHeight:"260px"}));var K=({items:s,initialValues:z,onChange:b})=>{let{setValue:F,getValues:R}=useFormContext(),[a,E]=useState(-1),[d,y]=useState(""),V=Object.fromEntries(s.map((t,r)=>[r,[]])),[l,h]=useState(z||V),P=(t,r)=>{E(r?t:-1),r&&B();},B=()=>{y("");},g=(t,r,n,e)=>{let c=e==="unique"?[r]:[...l[a],r],i=n.target.checked?c:l[a].filter(m=>m!==r);h({...l,[a]:i}),f(t,i);},S=t=>{y(t);},D=()=>{let r=s[a].list.every(n=>l[a].includes(n.value))?[]:[...s[a].list.map(n=>n.value)];h({...l,[a]:r}),f(s[a].name,r);},I=()=>{h({...l,[a]:[]}),f(s[a].name,[]);},f=(t,r)=>{let n={},e=R("config"),c=s[a];if(c){let i=c.list.filter(m=>l[a].includes(m.value)).map(m=>m.value);n[c.name]={type:"FIELD",values:c.name===t?r:i},F("config",{...e,...n}),b&&b({...e,...n});}};return jsx(Fragment,{children:s.map(({type:t="multi",...r},n)=>jsxs(_,{expanded:a===n,onChange:(e,c)=>P(n,c),children:[jsx($,{expandIcon:jsx(U,{icon:"CHEVRON_UP"}),id:`${n}`,children:jsxs(T,{alignItems:"center",direction:"row",children:[jsx(p,{variant:"subtitle2",color:"grey.600",children:r.label}),jsxs(W,{variant:"soft",color:"primary",marginLeft:1,sx:e=>({backgroundColor:`${alpha(e.palette.grey[400],.2)}`,cursor:"pointer"}),children:[l[n].length," selecionados"]})]})}),jsxs(N,{children:[jsxs(T,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[jsx(J,{onSearch:S,onChange:e=>S(e.target.value),iconPosition:"start",size:"small",placeholder:"Buscar",value:d,fullWidth:!0}),t==="multi"?jsx(k,{onClick:D,size:"small",children:jsx(p,{variant:"overline",children:"TODOS"})}):jsx(k,{onClick:I,size:"small",color:"error",children:jsx(p,{variant:"overline",children:"LIMPAR"})})]}),jsx(C,{children:jsx(j,{children:a>-1&&(r.list.filter(e=>e.label?.toLowerCase().includes(d.toLowerCase())).map((e,c)=>jsx(A,{children:jsx(w,{control:t==="multi"?jsx(L,{size:"small",checked:l[a].includes(e.value),onChange:i=>g(r.name,e.value,i,t),name:e.label}):jsx(x,{size:"small",checked:l[a].includes(e.value),onChange:i=>g(r.name,e.value,i,t),name:e.label}),label:jsx(p,{variant:"caption",color:"grey.600",children:e.label})})},c)).length===0?jsx(G,{sx:{svg:{height:100}},text:"Nenhum registro para ser apresentado"}):r.list.filter(e=>e.label?.toLowerCase().includes(d.toLowerCase())).map((e,c)=>jsx(A,{children:jsx(w,{control:t==="multi"?jsx(L,{size:"small",checked:l[a].includes(e.value),onChange:i=>g(r.name,e.value,i,t),name:e.label}):jsx(x,{size:"small",checked:l[a].includes(e.value),onChange:i=>g(r.name,e.value,i,t),name:e.label}),label:jsx(p,{variant:"caption",color:"grey.600",children:e.label})})},c)))})})]})]},n))})},Se=K;
|
|
23
23
|
|
|
24
|
-
export {
|
|
24
|
+
export { Se as default };
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
@import"react-lazy-load-image-component/src/effects/blur.css";pre{:is(code[as="code"]){.hljs-comment{color:#999}.hljs-tag{color:#b4b7b4}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#ccc}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#f2777a}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#f99157}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#fc6}.hljs-strong{font-weight:700;color:#fc6}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#9c9}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#6cc}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#69c}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#c9c}.hljs-emphasis{color:#c9c;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#a3685a}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}}}.mnl__image__wrapper img{vertical-align:initial!important}
|
package/package.json
CHANGED