@zydon/common 2.2.39 → 2.2.40
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,17 @@
|
|
|
1
|
+
import { a } from './chunk-NF42ENKE.js';
|
|
2
|
+
import { b } from './chunk-ILHUUK4X.js';
|
|
3
|
+
import O, { forwardRef, useState, useMemo, useEffect } from 'react';
|
|
4
|
+
import fe, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
5
|
+
import be from '@mui/material/CircularProgress';
|
|
6
|
+
import ge from '@mui/material/TextField';
|
|
7
|
+
import { VariableSizeList } from 'react-window';
|
|
8
|
+
import W from '@mui/material/Typography';
|
|
9
|
+
import re from '@mui/material/Divider';
|
|
10
|
+
import L from '@mui/material/Stack';
|
|
11
|
+
import te from '@mui/material/Popper';
|
|
12
|
+
import { styled } from '@mui/material/styles';
|
|
13
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
var H=styled(te)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),D=styled(L)(({theme:e})=>({flex:1,width:"100%",[e.breakpoints.down("md")]:{flexDirection:"column",gap:0,width:"100%"},[e.breakpoints.up("sm")]:{width:"calc(100% - 75px)"},[e.breakpoints.up("md")]:{flexDirection:"row",gap:8}})),T=styled(L)(({theme:e})=>({flex:1,maxWidth:"100%",[e.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),R=styled(L)(({theme:e})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[e.breakpoints.down("sm")]:{display:"none"}}));var oe=({option:e})=>{let t=Object.keys(e).filter(l=>l.startsWith("field")).map((l,m)=>{let s=e[l];if(s&&typeof s=="object"){let p="label"in s?s.label:null,u="value"in s?s.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[p,": ",u]},`${l}:${m}`)}}),i=e.image?jsx("img",{alt:"Imagem",src:e.image}):jsx(a,{alt:e.label||e.value.toString(),name:e.label||e.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(L,{direction:"row",gap:2,margin:2,children:[jsx(R,{children:i}),jsxs(L,{flex:1,children:[jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,flex:1,children:[e.value," - ",e.label]}),t.length>0&&jsxs(D,{children:[jsxs(T,{children:[t[0]?t[0]:void 0,t[1]?t[1]:void 0]}),(t[2]||t[3])&&jsxs(T,{children:[t[2]?t[2]:void 0,t[3]?t[3]:void 0]})]})]})]}),jsx(re,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},x=oe;var N=8,se=e=>{let{data:t,index:i,style:l}=e,m=t[i],s={...l,top:l.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...m.props,noWrap:!0,style:s,children:jsx(x,{...m?.props?.children?.props})})},X=O.createContext({}),B=forwardRef((e,t)=>{let i=O.useContext(X);return jsx("div",{ref:t,...e,...i})});B.displayName="OuterElementType";var pe=e=>{let t=O.useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},me=forwardRef(function(t,i){let{children:l,"data-item-height":m,...s}=t,p=[];l.forEach(a=>{p.push(a),p.push(...a.children||[]);});let u=p.length,g=m>112?m:112,c=a=>Object.prototype.hasOwnProperty.call(a,"group")?48:g,S=()=>u>8?8*g:p.map(c).reduce((a,C)=>a+C,0),v=pe(u);return jsx("div",{ref:i,children:jsx(X.Provider,{value:s,children:jsx(VariableSizeList,{itemData:p,height:S()+2*N,width:"100%",ref:v,outerElementType:B,innerElementType:"ul",itemSize:a=>c(p[a]),overscanCount:5,itemCount:u,children:se})})})}),J=me;var j=forwardRef(({label:e,value:t,options:i=[],loading:l,noOptionsText:m="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:p,helperText:u,placeholder:g,onChange:c,groupBy:S,disabled:v,multiple:a,required:C,renderOption:G,tabIndex:U,onSearch:P,onInputChange:w,...V},_)=>{let[F,I]=useState(),q=b("down","md"),K=o=>o&&typeof o=="object"?o.value.toString():o.toString(),Q=useMemo(()=>a?(Array.isArray(t)?t:[]).reduce((r,A)=>{let E=i.find(Z=>Z.value.toString()===A.toString());return E?[...r,E]:[...r]},[]):i.find(n=>n.value.toString()===t?.toString())||null,[i,t,a]),Y=q&&i[0]?Object.keys(i[0]).length*24:void 0;return jsx(fe,{ref:_,value:F||Q,onInputChange:(o,n,r)=>{if(w&&w(o,n,r),r==="input"){P&&P(n),I(n);return}I(void 0);},options:i,loading:l,noOptionsText:m,loadingText:s,disabled:l||v,disableListWrap:!0,PopperComponent:H,ListboxProps:{"data-item-height":Y},ListboxComponent:G?void 0:J,filterOptions:(o,n)=>o.filter(r=>`${r.field1?.value} ${r.field1?.label} ${r.field2?.label} ${r.field2?.value} ${r.field3?.label} ${r.field3?.value} ${r.field4?.label} ${r.field4?.value} ${r.field5?.label} ${r.field5?.value} ${r.label}${r.value}`.toLocaleUpperCase().includes(n.inputValue.toLocaleUpperCase())),onChange:(o,n)=>{if(!n){c(a?[]:null);return}if(Array.isArray(n)){c(n.map(K));return}c(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:o,...n},r)=>jsx("li",{...n,style:{display:"block"},children:jsx(x,{option:r})},o),renderGroup:o=>o,groupBy:S,multiple:a,renderInput:o=>jsx(ge,{...o,placeholder:g,fullWidth:!0,error:!!p,helperText:u,label:e,required:C,InputProps:{...o.InputProps,endAdornment:jsxs(Fragment,{children:[l?jsx(be,{color:"primary",size:20}):null,o.InputProps.endAdornment]})},inputProps:{...o.inputProps,tabIndex:U}}),...V})});j.displayName="Autocomplete";var qe=j;
|
|
16
|
+
|
|
17
|
+
export { qe as a };
|
package/package.json
CHANGED
package/dist/chunk-DTHBD5B6.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-NF42ENKE.js';
|
|
2
|
-
import { b } from './chunk-ILHUUK4X.js';
|
|
3
|
-
import O, { forwardRef, useState, useMemo, useEffect } from 'react';
|
|
4
|
-
import fe, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
5
|
-
import be from '@mui/material/CircularProgress';
|
|
6
|
-
import ge from '@mui/material/TextField';
|
|
7
|
-
import { VariableSizeList } from 'react-window';
|
|
8
|
-
import W from '@mui/material/Typography';
|
|
9
|
-
import re from '@mui/material/Divider';
|
|
10
|
-
import L from '@mui/material/Stack';
|
|
11
|
-
import te from '@mui/material/Popper';
|
|
12
|
-
import { styled } from '@mui/material/styles';
|
|
13
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
var H=styled(te)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),D=styled(L)(({theme:e})=>({flex:1,width:"100%",[e.breakpoints.down("md")]:{flexDirection:"column",gap:0,width:"100%"},[e.breakpoints.up("sm")]:{width:"calc(100% - 75px)"},[e.breakpoints.up("md")]:{flexDirection:"row",gap:8}})),T=styled(L)(({theme:e})=>({flex:1,maxWidth:"100%",[e.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),R=styled(L)(({theme:e})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[e.breakpoints.down("sm")]:{display:"none"}}));var oe=({option:e})=>{let t=Object.keys(e).filter(l=>l.startsWith("field")).map((l,m)=>{let s=e[l];if(s&&typeof s=="object"){let p="label"in s?s.label:null,u="value"in s?s.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[p,": ",u]},`${l}:${m}`)}}),i=e.image?jsx("img",{alt:"Imagem",src:e.image}):jsx(a,{alt:e.label||e.value.toString(),name:e.label||e.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(L,{direction:"row",gap:2,margin:2,children:[jsx(R,{children:i}),jsxs(L,{children:[jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,flex:1,children:[e.value," - ",e.label]}),t.length>0&&jsxs(D,{children:[jsxs(T,{children:[t[0]?t[0]:void 0,t[1]?t[1]:void 0]}),(t[2]||t[3])&&jsxs(T,{children:[t[2]?t[2]:void 0,t[3]?t[3]:void 0]})]})]})]}),jsx(re,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},x=oe;var N=8,se=e=>{let{data:t,index:i,style:l}=e,m=t[i],s={...l,top:l.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...m.props,noWrap:!0,style:s,children:jsx(x,{...m?.props?.children?.props})})},X=O.createContext({}),B=forwardRef((e,t)=>{let i=O.useContext(X);return jsx("div",{ref:t,...e,...i})});B.displayName="OuterElementType";var pe=e=>{let t=O.useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},me=forwardRef(function(t,i){let{children:l,"data-item-height":m,...s}=t,p=[];l.forEach(a=>{p.push(a),p.push(...a.children||[]);});let u=p.length,g=m>112?m:112,c=a=>Object.prototype.hasOwnProperty.call(a,"group")?48:g,S=()=>u>8?8*g:p.map(c).reduce((a,C)=>a+C,0),v=pe(u);return jsx("div",{ref:i,children:jsx(X.Provider,{value:s,children:jsx(VariableSizeList,{itemData:p,height:S()+2*N,width:"100%",ref:v,outerElementType:B,innerElementType:"ul",itemSize:a=>c(p[a]),overscanCount:5,itemCount:u,children:se})})})}),J=me;var j=forwardRef(({label:e,value:t,options:i=[],loading:l,noOptionsText:m="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:p,helperText:u,placeholder:g,onChange:c,groupBy:S,disabled:v,multiple:a,required:C,renderOption:G,tabIndex:U,onSearch:P,onInputChange:w,...V},_)=>{let[F,I]=useState(),q=b("down","md"),K=o=>o&&typeof o=="object"?o.value.toString():o.toString(),Q=useMemo(()=>a?(Array.isArray(t)?t:[]).reduce((r,A)=>{let E=i.find(Z=>Z.value.toString()===A.toString());return E?[...r,E]:[...r]},[]):i.find(n=>n.value.toString()===t?.toString())||null,[i,t,a]),Y=q&&i[0]?Object.keys(i[0]).length*24:void 0;return jsx(fe,{ref:_,value:F||Q,onInputChange:(o,n,r)=>{if(w&&w(o,n,r),r==="input"){P&&P(n),I(n);return}I(void 0);},options:i,loading:l,noOptionsText:m,loadingText:s,disabled:l||v,disableListWrap:!0,PopperComponent:H,ListboxProps:{"data-item-height":Y},ListboxComponent:G?void 0:J,filterOptions:(o,n)=>o.filter(r=>`${r.field1?.value} ${r.field1?.label} ${r.field2?.label} ${r.field2?.value} ${r.field3?.label} ${r.field3?.value} ${r.field4?.label} ${r.field4?.value} ${r.field5?.label} ${r.field5?.value} ${r.label}${r.value}`.toLocaleUpperCase().includes(n.inputValue.toLocaleUpperCase())),onChange:(o,n)=>{if(!n){c(a?[]:null);return}if(Array.isArray(n)){c(n.map(K));return}c(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:o,...n},r)=>jsx("li",{...n,style:{display:"block"},children:jsx(x,{option:r})},o),renderGroup:o=>o,groupBy:S,multiple:a,renderInput:o=>jsx(ge,{...o,placeholder:g,fullWidth:!0,error:!!p,helperText:u,label:e,required:C,InputProps:{...o.InputProps,endAdornment:jsxs(Fragment,{children:[l?jsx(be,{color:"primary",size:20}):null,o.InputProps.endAdornment]})},inputProps:{...o.inputProps,tabIndex:U}}),...V})});j.displayName="Autocomplete";var qe=j;
|
|
16
|
-
|
|
17
|
-
export { qe as a };
|