jclib-ui 1.0.292 → 1.0.293

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.
@@ -458,7 +458,7 @@
458
458
  padding-top: 8px;
459
459
  }
460
460
  }
461
- `;function Ze(){return Qt.jsxs(Ke,{children:[Qt.jsx("div",{className:"alert alert-danger",children:"Falha na conexão!"}),Qt.jsxs("div",{children:["Possíveis causas:",Qt.jsx("ul",{children:navigator.onLine?Qt.jsxs(Qt.Fragment,{children:[Qt.jsx("li",{children:"Você está sem conexão com a internet;"}),Qt.jsx("li",{children:"O servidor pode estar passando por uma atualização. Por favor, tente novamente em alguns instantes."}),Qt.jsx("li",{children:"O servidor pode estar temporariamente indisponível."})]}):Qt.jsx("li",{children:"Você está sem conexão com a internet;"})}),Qt.jsxs("div",{children:["Se o erro persistir, por favor, entre em contato com nosso suporte técnico:",Qt.jsxs("ul",{children:[Qt.jsxs("li",{children:["Fone e WhatsApp:"," ",Qt.jsx($e,{className:"numeros",children:"(27) 9 9774-2904"})]}),Qt.jsxs("li",{children:["E-mail:"," ",Qt.jsx(Ye,{href:"suporte@jcinfoes.com.br?subject="+encodeURI("SIPAR - Sem conexão com o servidor!"),children:"suporte@jcinfoes.com.br"})]})]})]})]})]})}let Qe=null;async function Je(t,e,r){var n;if(!(null==e?void 0:e.refreshRoute))return!1;if(401!==(null==(n=null==t?void 0:t.response)?void 0:n.status))return!1;if(null==r?void 0:r._retry)return!1;if(function(t,e){const r=String((null==t?void 0:t.url)||"");return r===e.refreshRoute||r.endsWith(e.refreshRoute)}(r,e))return!1;Qe||(Qe=u.post(e.refreshRoute,null,{baseURL:e.baseURL,timeout:e.timeout,withCredentials:!0}).finally(()=>{Qe=null}));try{return await Qe,!0}catch{return!1}}const tr={isError:!1,message:null,loading:!1,headers:null,data:null,error:null,code:0,status:503,report:!1,onBefore:null};function er(t={}){const r=a.useHistory(),n=new AbortController,{globalApiConfig:o}=ee(),[i,s]=e.useState(tr);return"string"==typeof t&&(t={url:t}),[async function(e){var i,a,l,c;let h,f=(null==(i=o.auth)?void 0:i.username)?{username:o.auth.username,password:o.auth.password}:void 0;if(t.headers={...t.headers,...null==e?void 0:e.headers},o.getToken){let e=o.getToken();e&&(o.auth.prefix&&(e=`${o.auth.prefix} ${e}`),t.headers[o.auth.header]=e)}o.version&&(t.headers["x-ver"]=encodeURIComponent(o.version)),o.ident&&(t.headers["x-identify"]=encodeURIComponent(o.ident));let d={baseURL:o.baseURL,timeout:o.timeout,auth:f,withCredentials:o.withCredentials,validateStatus:t=>t>=200&&t<400,...t,...e,headers:t.headers};d.report&&(d={...d,responseType:"blob",timeout:0}),s({...tr,loading:!0}),d.onBefore&&d.onBefore(d);try{let t;try{t=await u({...d,signal:n.signal})}catch(g){if(!(await Je(g,o,d)))throw g;d._retry=!0,t=await u({...d,signal:n.signal})}o.afterRequest&&o.afterRequest(t),h={...tr,data:t.data,message:t.statusText,status:t.status,headers:t.headers}}catch(g){const{ERR_NETWORK:t,ECONNABORTED:e,ETIMEDOUT:n}=u.AxiosError;if([t,e,n].includes(null==g?void 0:g.code))h={...tr,isError:!0,status:400,message:Qt.jsx(Ze,{})};else if(g.response)switch(h={...tr,isError:!0,status:g.response.status,message:(null==(a=g.response.data)?void 0:a.error)||g.response.data,code:null==(l=g.response.data)?void 0:l.code},g.response.status){case 400:case 500:if("blob"==(null==d?void 0:d.responseType)){let t=await g.response.data.text();t=JSON.parse(t),h.message=t.error||"Ocorreu um erro ao consultar o servidor!"}break;case 401:h.message="Servidor requer autenticação!",(null==o?void 0:o.setToken)&&(null==o||o.setToken("")),r.push(o.loginRoute);break;case 404:h.message="Servidor não possui este recurso!";break;case 405:h.message=`Método [${(null==(c=d.method)?void 0:c.toUpperCase())||"GET"}] indisponível!`;break;case 429:h.message="Muitos acessos. Tente novamente mais tarde!"}else h={...tr,isError:!0,message:g.message}}const p=`timeout of ${o.timeout}ms exceeded`;return h.message!=p&&"Network Error"!=h.message||(h.message="Sem conexão com o servidor!"),h.isError?h.error=h.message:h.error=null,h={...h,loading:!1},s(h),(null==t?void 0:t.onTerminated)&&t.onTerminated(h),h},i,function(){n&&n.abort("Cancelado pelo usuário!")}]}let rr=null;function nr({url:t,file:n,fileTo:o,setLoading:i}){const[a,u]=e.useState(""),[l,c]=e.useState(!1),[h,f]=e.useState(0),[d,p]=e.useState(n),[g,m]=e.useState(""),[v,,y]=er({url:t,method:"post",data:{file:d},report:!0,onDownloadProgress:t=>{c(t.loaded>0),f(t.loaded/t.total*100)},onTerminated:t=>{if(204===t.status)return w(3);if(t.error)u(t.error),_();else{const[,n]=o.split(".");r.isDesktop()&&"pdf"==n.toLowerCase()?(e=t.data,m(URL.createObjectURL(e))):(s(t.data,function(){let t=o.split("."),e=`-${r.getDateTimeStr().replace(/\D/g,"")}-${r.getHash(o)}`;return t[0]+=e,t=t.join("."),t}()),p(""))}var e}});function _(){rr&&clearTimeout(rr)}function w(t){_(),rr=setTimeout(()=>v(),1e3*t)}return e.useEffect(()=>()=>_(),[]),e.useEffect(()=>()=>g&&URL.revokeObjectURL(g),[g]),e.useEffect(()=>{d?(i(!0),w(2)):i(!1)},[d]),Qt.jsxs(Qt.Fragment,{children:[Qt.jsxs("div",{className:"loading-report--area",children:[Qt.jsxs("div",{className:"loading-box",style:{display:g?"none":"block"},children:[Qt.jsx("button",{className:"btn-loading-close",title:"Cancelar",onClick:function(){l?y():u(""),i(!1)},children:Qt.jsx("i",{className:"fas fa-times"})}),Qt.jsxs("div",{className:"line",children:[l?Qt.jsx("i",{className:"fa-solid fa-file-arrow-down pulse"}):Qt.jsx("div",{className:"spinner"}),Qt.jsx("span",{children:l?"Baixando relatório...":"Gerando relatório..."})]}),Qt.jsx("div",{className:"pbar",children:Qt.jsx("div",{style:{width:`${h}%`}})})]}),g&&Qt.jsx(Xe,{fileTo:o,previewUrl:g,setVisible:()=>p(""),visible:!0})]}),a&&Qt.jsx(se,{onConfirm:()=>i(!1),children:a})]})}function or({search:t,setSearch:n,fnSearch:o,fnFilter:a,fnValidateFilter:s,placeHolder:u,...l}){const c=e.useRef();return Qt.jsxs("div",{className:"inp-pesq--input-area",children:[Qt.jsxs(i.InputGroup,{children:[Qt.jsx(i.Input,{innerRef:c,value:t,onChange:t=>n(t.target.value),placeholder:u,...l}),Qt.jsx(i.Button,{color:"outline-secondary",type:"button",onClick:()=>{n(""),r.isDesktop()&&(null==c?void 0:c.current)&&c.current.focus()},title:"Limpar campo de pesquisa",children:Qt.jsx(xe,{})}),Qt.jsx(i.Button,{color:"info",title:"Pesquisar",onClick:o,type:o?"button":"submit",children:Qt.jsx(Se,{})})]}),a&&Qt.jsxs(i.Button,{type:"button",color:"outline-filter",className:"position-relative ip--btn-filter",title:"Filtros avançados",onClick:a,children:[Qt.jsx("i",{className:"fas fa-filter"}),Qt.jsx("span",{className:"ip--btn-caption",children:" Filtros"}),s&&s()&&Qt.jsx("span",{className:"position-absolute top-0 start-100 translate-middle \r\n p-2 bg-danger border border-light rounded-circle",children:Qt.jsx("span",{className:"visually-hidden",children:"Filtro ativo"})})]})]})}const ir=o.div`
461
+ `;function Ze(){return Qt.jsxs(Ke,{children:[Qt.jsx("div",{className:"alert alert-danger",children:"Falha na conexão!"}),Qt.jsxs("div",{children:["Possíveis causas:",Qt.jsx("ul",{children:navigator.onLine?Qt.jsxs(Qt.Fragment,{children:[Qt.jsx("li",{children:"Você está sem conexão com a internet;"}),Qt.jsx("li",{children:"O servidor pode estar passando por uma atualização. Por favor, tente novamente em alguns instantes."}),Qt.jsx("li",{children:"O servidor pode estar temporariamente indisponível."})]}):Qt.jsx("li",{children:"Você está sem conexão com a internet;"})}),Qt.jsxs("div",{children:["Se o erro persistir, por favor, entre em contato com nosso suporte técnico:",Qt.jsxs("ul",{children:[Qt.jsxs("li",{children:["Fone e WhatsApp:"," ",Qt.jsx($e,{className:"numeros",children:"(27) 9 9774-2904"})]}),Qt.jsxs("li",{children:["E-mail:"," ",Qt.jsx(Ye,{href:"suporte@jcinfoes.com.br?subject="+encodeURI("SIPAR - Sem conexão com o servidor!"),children:"suporte@jcinfoes.com.br"})]})]})]})]})]})}let Qe=null;async function Je(t,e,r){var n;if(!(null==e?void 0:e.refreshRoute))return!1;if(401!==(null==(n=null==t?void 0:t.response)?void 0:n.status))return!1;if(null==r?void 0:r._retry)return!1;if(function(t,e){const r=String((null==t?void 0:t.url)||"");return r===e.refreshRoute||r.endsWith(e.refreshRoute)}(r,e))return!1;Qe||(Qe=u.post(e.refreshRoute,null,{baseURL:e.baseURL,timeout:e.timeout,withCredentials:!0}).finally(()=>{Qe=null}));try{return await Qe,!0}catch{return!1}}const tr={isError:!1,message:null,loading:!1,headers:null,data:null,error:null,code:0,status:503,report:!1,onBefore:null};function er(t={}){const r=a.useHistory(),n=new AbortController,{globalApiConfig:o}=ee(),[i,s]=e.useState(tr);return"string"==typeof t&&(t={url:t}),[async function(e){var i,a,l,c;let h,f=(null==(i=o.auth)?void 0:i.username)?{username:o.auth.username,password:o.auth.password}:void 0;if(t.headers={...t.headers,...null==e?void 0:e.headers},o.getToken){let e=o.getToken();e&&(o.auth.prefix&&(e=`${o.auth.prefix} ${e}`),t.headers[o.auth.header]=e)}o.version&&(t.headers["x-ver"]=encodeURIComponent(o.version)),o.ident&&(t.headers["x-identify"]=encodeURIComponent(o.ident));let d={baseURL:o.baseURL,timeout:o.timeout,auth:f,withCredentials:o.withCredentials,...t,...e,headers:t.headers};d.report&&(d={...d,responseType:"blob",timeout:0}),s({...tr,loading:!0}),d.onBefore&&d.onBefore(d);try{let t;try{t=await u({...d,signal:n.signal})}catch(g){if(!(await Je(g,o,d)))throw g;d._retry=!0,t=await u({...d,signal:n.signal})}o.afterRequest&&o.afterRequest(t),h={...tr,data:t.data,message:t.statusText,status:t.status,headers:t.headers}}catch(g){const{ERR_NETWORK:t,ECONNABORTED:e,ETIMEDOUT:n}=u.AxiosError;if([t,e,n].includes(null==g?void 0:g.code))h={...tr,isError:!0,status:400,message:Qt.jsx(Ze,{})};else if(g.response)switch(h={...tr,isError:!0,status:g.response.status,message:(null==(a=g.response.data)?void 0:a.error)||g.response.data,code:null==(l=g.response.data)?void 0:l.code},g.response.status){case 400:case 500:if("blob"==(null==d?void 0:d.responseType)){let t=await g.response.data.text();t=JSON.parse(t),h.message=t.error||"Ocorreu um erro ao consultar o servidor!"}break;case 401:h.message="Servidor requer autenticação!",(null==o?void 0:o.setToken)&&(null==o||o.setToken("")),r.push(o.loginRoute);break;case 404:h.message="Servidor não possui este recurso!";break;case 405:h.message=`Método [${(null==(c=d.method)?void 0:c.toUpperCase())||"GET"}] indisponível!`;break;case 429:h.message="Muitos acessos. Tente novamente mais tarde!"}else h={...tr,isError:!0,message:g.message}}const p=`timeout of ${o.timeout}ms exceeded`;return h.message!=p&&"Network Error"!=h.message||(h.message="Sem conexão com o servidor!"),h.isError?h.error=h.message:h.error=null,h={...h,loading:!1},s(h),(null==t?void 0:t.onTerminated)&&t.onTerminated(h),h},i,function(){n&&n.abort("Cancelado pelo usuário!")}]}let rr=null;function nr({url:t,file:n,fileTo:o,setLoading:i}){const[a,u]=e.useState(""),[l,c]=e.useState(!1),[h,f]=e.useState(0),[d,p]=e.useState(n),[g,m]=e.useState(""),[v,,y]=er({url:t,method:"post",data:{file:d},report:!0,onDownloadProgress:t=>{c(t.loaded>0),f(t.loaded/t.total*100)},onTerminated:t=>{if(204===t.status)return w(3);if(t.error)u(t.error),_();else{const[,n]=o.split(".");r.isDesktop()&&"pdf"==n.toLowerCase()?(e=t.data,m(URL.createObjectURL(e))):(s(t.data,function(){let t=o.split("."),e=`-${r.getDateTimeStr().replace(/\D/g,"")}-${r.getHash(o)}`;return t[0]+=e,t=t.join("."),t}()),p(""))}var e}});function _(){rr&&clearTimeout(rr)}function w(t){_(),rr=setTimeout(()=>v(),1e3*t)}return e.useEffect(()=>()=>_(),[]),e.useEffect(()=>()=>g&&URL.revokeObjectURL(g),[g]),e.useEffect(()=>{d?(i(!0),w(2)):i(!1)},[d]),Qt.jsxs(Qt.Fragment,{children:[Qt.jsxs("div",{className:"loading-report--area",children:[Qt.jsxs("div",{className:"loading-box",style:{display:g?"none":"block"},children:[Qt.jsx("button",{className:"btn-loading-close",title:"Cancelar",onClick:function(){l?y():u(""),i(!1)},children:Qt.jsx("i",{className:"fas fa-times"})}),Qt.jsxs("div",{className:"line",children:[l?Qt.jsx("i",{className:"fa-solid fa-file-arrow-down pulse"}):Qt.jsx("div",{className:"spinner"}),Qt.jsx("span",{children:l?"Baixando relatório...":"Gerando relatório..."})]}),Qt.jsx("div",{className:"pbar",children:Qt.jsx("div",{style:{width:`${h}%`}})})]}),g&&Qt.jsx(Xe,{fileTo:o,previewUrl:g,setVisible:()=>p(""),visible:!0})]}),a&&Qt.jsx(se,{onConfirm:()=>i(!1),children:a})]})}function or({search:t,setSearch:n,fnSearch:o,fnFilter:a,fnValidateFilter:s,placeHolder:u,...l}){const c=e.useRef();return Qt.jsxs("div",{className:"inp-pesq--input-area",children:[Qt.jsxs(i.InputGroup,{children:[Qt.jsx(i.Input,{innerRef:c,value:t,onChange:t=>n(t.target.value),placeholder:u,...l}),Qt.jsx(i.Button,{color:"outline-secondary",type:"button",onClick:()=>{n(""),r.isDesktop()&&(null==c?void 0:c.current)&&c.current.focus()},title:"Limpar campo de pesquisa",children:Qt.jsx(xe,{})}),Qt.jsx(i.Button,{color:"info",title:"Pesquisar",onClick:o,type:o?"button":"submit",children:Qt.jsx(Se,{})})]}),a&&Qt.jsxs(i.Button,{type:"button",color:"outline-filter",className:"position-relative ip--btn-filter",title:"Filtros avançados",onClick:a,children:[Qt.jsx("i",{className:"fas fa-filter"}),Qt.jsx("span",{className:"ip--btn-caption",children:" Filtros"}),s&&s()&&Qt.jsx("span",{className:"position-absolute top-0 start-100 translate-middle \r\n p-2 bg-danger border border-light rounded-circle",children:Qt.jsx("span",{className:"visually-hidden",children:"Filtro ativo"})})]})]})}const ir=o.div`
462
462
  position: fixed;
463
463
  inset: 0 0 0;
464
464
  background-color: var(--jc-overlay-bg);