@zydon/common-csr 2.0.13 → 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.
- package/dist/chunk-CGG4TIH7.mjs +13 -0
- package/dist/components/filters/FilterRule/index.mjs +1 -1
- package/dist/components/filters/ListingRules/index.mjs +1 -13
- package/dist/components/filters/ListingRulesModal/index.d.ts +20 -0
- package/dist/components/filters/ListingRulesModal/index.mjs +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useFormContext } from 'react-hook-form';
|
|
3
|
+
import v from '@mui/material/Stack';
|
|
4
|
+
import u from '@mui/material/Typography';
|
|
5
|
+
import h from '@zydon/common/form/Field';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import s from '@mui/material/ToggleButton';
|
|
8
|
+
import c from '@mui/material/ToggleButtonGroup';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var g=styled(s)(({theme:o})=>({width:"100%","&.Mui-selected":{backgroundColor:o.palette.primary.main,color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary.main}}})),m=styled(c)(()=>({display:"flex",justifyContent:"space-between"}));var S=({rules:o,setRuleType:a})=>{let[n,i]=useState(),{setValue:d}=useFormContext();return useEffect(()=>{if(o&&o.length>0&&(i(o[0].value),a))return a(o[0].value)},[]),useEffect(()=>()=>{d("config",{});},[]),jsxs(v,{gap:2,children:[jsx(h,{name:"name",label:"Nome da regra",required:!0,rules:{required:{value:!0,message:"Nome da regra \xE9 obrigat\xF3rio"}}}),jsx(u,{color:"grey.500",variant:"overline",children:"Selecione a regra"}),o&&jsx(m,{color:"primary",value:n,size:"small",exclusive:!0,onChange:(t,e)=>{if(e!==null&&(i(e),a))return a(e)},children:o.map((t,e)=>jsx(g,{value:t.value,size:"small",color:"primary",children:jsx(u,{variant:"body2",children:t.toggleTitle})},e))}),o&&o.map((t,e)=>t.value===n?jsx("div",{children:t.component},e):null)]})},N=S;
|
|
12
|
+
|
|
13
|
+
export { N as a };
|
|
@@ -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
|
|
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 };
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
+
export { a as default } from '../../../chunk-CGG4TIH7.mjs';
|
|
1
2
|
import '../../../chunk-6KMKD42J.mjs';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { useFormContext } from 'react-hook-form';
|
|
4
|
-
import v from '@mui/material/Stack';
|
|
5
|
-
import u from '@mui/material/Typography';
|
|
6
|
-
import h from '@zydon/common/form/Field';
|
|
7
|
-
import { styled } from '@mui/material/styles';
|
|
8
|
-
import s from '@mui/material/ToggleButton';
|
|
9
|
-
import c from '@mui/material/ToggleButtonGroup';
|
|
10
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
var g=styled(s)(({theme:o})=>({width:"100%","&.Mui-selected":{backgroundColor:o.palette.primary.main,color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary.main}}})),m=styled(c)(()=>({display:"flex",justifyContent:"space-between"}));var S=({rules:o,setRuleType:a})=>{let[n,i]=useState(),{setValue:d}=useFormContext();return useEffect(()=>{if(o&&o.length>0&&(i(o[0].value),a))return a(o[0].value)},[]),useEffect(()=>()=>{d("config",{});},[]),jsxs(v,{gap:2,children:[jsx(h,{name:"name",label:"Nome da regra",required:!0,rules:{required:{value:!0,message:"Nome da regra \xE9 obrigat\xF3rio"}}}),jsx(u,{color:"grey.500",variant:"overline",children:"Selecione a regra"}),o&&jsx(m,{color:"primary",value:n,size:"small",exclusive:!0,onChange:(t,e)=>{if(e!==null&&(i(e),a))return a(e)},children:o.map((t,e)=>jsx(g,{value:t.value,size:"small",color:"primary",children:jsx(u,{variant:"body2",children:t.toggleTitle})},e))}),o&&o.map((t,e)=>t.value===n?jsx("div",{children:t.component},e):null)]})},N=S;
|
|
13
|
-
|
|
14
|
-
export { N as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ListingRulesModalProps {
|
|
5
|
+
rules: {
|
|
6
|
+
value: string;
|
|
7
|
+
component: ReactNode;
|
|
8
|
+
toggleTitle: string;
|
|
9
|
+
}[];
|
|
10
|
+
open: boolean;
|
|
11
|
+
close: VoidFunction;
|
|
12
|
+
formId: string;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
disable: boolean;
|
|
15
|
+
confirm: VoidFunction;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const ListingRulesModal: ({ rules, open, close, formId, loading, disable, confirm, }: ListingRulesModalProps) => react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { ListingRulesModal as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a } from '../../../chunk-CGG4TIH7.mjs';
|
|
2
|
+
import '../../../chunk-6KMKD42J.mjs';
|
|
3
|
+
import m from '@mui/material/Button';
|
|
4
|
+
import u from '@zydon/common/components/ActionButton';
|
|
5
|
+
import p from '@zydon/common/components/Modal';
|
|
6
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var c=({rules:l,open:n,close:i,formId:a$1,loading:e,disable:d,confirm:s})=>jsx(Fragment,{children:jsx(p,{fullWidth:!0,maxWidth:"lg",open:n,onClose:()=>{i();},dialogTitle:"Nova regra de listagem",actions:jsxs(Fragment,{children:[jsx(m,{variant:"outlined",color:"inherit",onClick:()=>{i();},children:"Fechar"}),jsx(u,{form:a$1,loading:e,actionType:"CREATE",color:"primary",variant:"contained",disabled:d,onClick:s,children:"Salvar"})]}),children:jsx(a,{rules:l})})}),v=c;
|
|
9
|
+
|
|
10
|
+
export { v as default };
|
package/package.json
CHANGED