@zydon/common-csr 2.0.82 → 2.0.83

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