vue-componentes/dist/eli-vue.umd.js
2026-01-29 15:33:42 -03:00

76 lines
68 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(L,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vuetify/components/VBtn"),require("vuetify/components/VBadge"),require("vuetify/components/VTextField"),require("vuetify/components/VCard"),require("vuetify/components/VGrid")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/components/VBtn","vuetify/components/VBadge","vuetify/components/VTextField","vuetify/components/VCard","vuetify/components/VGrid"],t):(L=typeof globalThis<"u"?globalThis:L||self,t(L.eli_vue={},L.Vue,L.VBtn,L.VBadge,L.VTextField,L.VCard,L.VGrid))})(this,(function(L,t,Ge,Xe,_e,le,Ke){"use strict";const Qe=t.defineComponent({name:"EliBotao",inheritAttrs:!1,props:{color:{type:String,default:"primary"},variant:{type:String,default:"elevated"},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}}}),F=(e,a)=>{const n=e.__vccOpts||e;for(const[r,s]of a)n[r]=s;return n};function xe(e,a,n,r,s,h){return t.openBlock(),t.createBlock(Ge.VBtn,t.mergeProps({color:e.color,variant:e.variant,size:e.size,disabled:e.disabled,loading:e.loading},e.$attrs,{class:"eli-botao text-none pt-1"}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["color","variant","size","disabled","loading"])}const Be=F(Qe,[["render",xe]]),Ne={suave:"4px",pill:"10px"},et=t.defineComponent({name:"EliBadge",inheritAttrs:!1,props:{color:{type:String,default:"primary"},location:{type:String,default:"top right"},offsetX:{type:String,default:"0"},offsetY:{type:String,default:"0"},dot:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},badge:{type:[String,Number],default:void 0},radius:{type:String,default:"suave"}},setup(e){const a=t.computed(()=>e.radius in Ne?Ne[e.radius]:e.radius),n=t.computed(()=>e.dot||e.badge!==void 0?e.visible:!1),r=t.computed(()=>({"--eli-badge-radius":a.value}));return{showBadge:n,badgeStyle:r}}});function tt(e,a,n,r,s,h){return e.showBadge?(t.openBlock(),t.createBlock(Xe.VBadge,t.mergeProps({key:0,color:e.color},e.$attrs,{location:e.location,"offset-x":e.offsetX,"offset-y":e.offsetY,dot:e.dot,content:e.badge,style:e.badgeStyle,class:"eli-badge"}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,!0)]),_:3},16,["color","location","offset-x","offset-y","dot","content","style"])):t.renderSlot(e.$slots,"default",{key:1},void 0,!0)}const ge=F(et,[["render",tt],["__scopeId","data-v-371c8db4"]]);function at(e){return e.replace(/\D+/g,"")}function ot(e){const a=at(e);return a.length<=11?a.replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2").slice(0,14):a.replace(/^(\d{2})(\d)/,"$1.$2").replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3").replace(/\.(\d{3})(\d)/,".$1/$2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,18)}function nt(e){return e.replace(/\D+/g,"")}function rt(e){const a=nt(e);return a?a.length<=10?a.replace(/^(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,14):a.replace(/^(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").slice(0,15):""}function lt(e){return e.replace(/\D+/g,"")}function it(e){const a=lt(e);return a?a.replace(/^(\d{5})(\d)/,"$1-$2").slice(0,9):""}const st=t.defineComponent({name:"EliEntradaTexto",inheritAttrs:!1,props:{value:{type:[String,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const r=t.computed(()=>{var i;return((i=e.opcoes)==null?void 0:i.formato)??"texto"}),s=t.computed({get:()=>e.value,set:i=>{n("update:value",i),n("input",i),n("change",i)}}),h=t.computed(()=>r.value==="email"?"email":r.value==="url"?"url":"text"),o=t.computed(()=>{if(r.value==="telefone")return"tel";if(r.value==="cpfCnpj"||r.value==="cep")return"numeric"});function l(i){switch(r.value){case"telefone":return rt(i);case"cpfCnpj":return ot(i);case"cep":return it(i);default:return i}}function u(i){const f=i.target,y=l(f.value);f.value=y,s.value=y}return{attrs:a,emit:n,localValue:s,inputHtmlType:h,inputMode:o,onInput:u}}});function ct(e,a,n,r,s,h){var o,l,u,i;return t.openBlock(),t.createBlock(_e.VTextField,t.mergeProps({modelValue:e.localValue,"onUpdate:modelValue":a[0]||(a[0]=f=>e.localValue=f),type:e.inputHtmlType,inputmode:e.inputMode,label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(l=e.opcoes)==null?void 0:l.placeholder,counter:(u=e.opcoes)==null?void 0:u.limiteCaracteres,maxlength:(i=e.opcoes)==null?void 0:i.limiteCaracteres},e.attrs,{onFocus:a[1]||(a[1]=()=>e.emit("focus")),onBlur:a[2]||(a[2]=()=>e.emit("blur")),onInput:e.onInput}),null,16,["modelValue","type","inputmode","label","placeholder","counter","maxlength","onInput"])}const ye=F(st,[["render",ct]]),dt=t.defineComponent({name:"EliOlaMundo",components:{EliBotao:Be,EliBadge:ge,EliEntradaTexto:ye},setup(){const e=t.ref(""),a=t.ref(""),n=t.ref(""),r=t.ref(""),s=t.ref("");return{nome:e,email:r,documento:s,telefone:n,cep:a}}}),ut={class:"grid-example"};function mt(e,a,n,r,s,h){const o=t.resolveComponent("EliBadge"),l=t.resolveComponent("EliEntradaTexto"),u=t.resolveComponent("EliBotao");return t.openBlock(),t.createBlock(Ke.VContainer,null,{default:t.withCtx(()=>[t.createVNode(le.VCard,{class:"mx-auto",max_width:"400"},{default:t.withCtx(()=>[t.createVNode(le.VCardTitle,null,{default:t.withCtx(()=>[t.createVNode(o,{badge:"Novo","offset-x":"-15",location:"right center"},{default:t.withCtx(()=>[...a[5]||(a[5]=[t.createTextVNode(" Olá Mundo! ",-1)])]),_:1})]),_:1}),t.createVNode(le.VCardText,null,{default:t.withCtx(()=>[a[6]||(a[6]=t.createTextVNode(" Este é um componente de exemplo integrado com Vuetify. ",-1)),t.createElementVNode("div",ut,[t.createVNode(l,{value:e.nome,"onUpdate:value":a[0]||(a[0]=i=>e.nome=i),opcoes:{rotulo:"Nome",placeholder:"Digite o nome"},density:"compact"},null,8,["value"]),t.createVNode(l,{value:e.telefone,"onUpdate:value":a[1]||(a[1]=i=>e.telefone=i),opcoes:{rotulo:"Telefone",formato:"telefone"}},null,8,["value"]),t.createVNode(l,{value:e.cep,"onUpdate:value":a[2]||(a[2]=i=>e.cep=i),opcoes:{rotulo:"CEP",placeholder:"00000-000",formato:"cep"}},null,8,["value"]),t.createVNode(l,{value:e.documento,"onUpdate:value":a[3]||(a[3]=i=>e.documento=i),opcoes:{rotulo:"CPF / CNPJ",formato:"cpfCnpj"}},null,8,["value"]),t.createVNode(l,{value:e.email,"onUpdate:value":a[4]||(a[4]=i=>e.email=i),opcoes:{rotulo:"Email",placeholder:"email@exemplo.com",formato:"email"}},null,8,["value"])])]),_:1}),t.createVNode(le.VCardActions,null,{default:t.withCtx(()=>[t.createVNode(u,{color:"primary",variant:"elevated",block:""},{default:t.withCtx(()=>[...a[7]||(a[7]=[t.createTextVNode(" Botão Vuetify ",-1)])]),_:1})]),_:1})]),_:1})]),_:1})}const Ae=F(dt,[["render",mt]]),pt=t.defineComponent({name:"EliCartao",components:{EliBadge:ge},inheritAttrs:!1,props:{titulo:{type:String,default:""},status:{type:String,required:!0},variant:{type:String,default:"outlined"}},emits:{clicar:e=>!0},setup(e,{emit:a}){const n=t.computed(()=>e.status),r=t.computed(()=>{switch(e.status){case"novo":return"primary";case"rascunho":return"secondary";case"vendido":return"success";case"cancelado":return"error"}}),s=t.computed(()=>`eli-cartao--${e.status}`);function h(){a("clicar",e.status)}return{rotuloStatus:n,corStatus:r,classeStatus:s,onClick:h}}}),ft={class:"eli-cartao__titulo-texto"},bt={class:"eli-cartao__status"};function ht(e,a,n,r,s,h){const o=t.resolveComponent("EliBadge");return t.openBlock(),t.createBlock(le.VCard,t.mergeProps({class:["eli-cartao",e.classeStatus],variant:e.variant},e.$attrs),{default:t.withCtx(()=>[t.createVNode(le.VCardTitle,{class:"eli-cartao__titulo"},{default:t.withCtx(()=>[t.createElementVNode("div",ft,[t.renderSlot(e.$slots,"titulo",{},()=>[t.createTextVNode(t.toDisplayString(e.titulo),1)],!0)]),t.createElementVNode("div",bt,[t.createVNode(o,{badge:e.rotuloStatus,radius:"pill",color:e.corStatus},{default:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("span",null,null,-1)])]),_:1},8,["badge","color"])])]),_:3}),t.createVNode(le.VCardText,{class:"eli-cartao__conteudo"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,!0)]),_:3}),e.$slots.acoes?(t.openBlock(),t.createBlock(le.VCardActions,{key:0,class:"eli-cartao__acoes"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"acoes",{},void 0,!0)]),_:3})):t.createCommentVNode("",!0)]),_:3},16,["variant","class"])}const De=F(pt,[["render",ht],["__scopeId","data-v-6c492bd9"]]);var we=(e=>(e[e.sucesso=200]="sucesso",e[e.erroConhecido=400]="erroConhecido",e[e.erroPermissao=401]="erroPermissao",e[e.erroNaoEncontrado=404]="erroNaoEncontrado",e[e.erroDesconhecido=500]="erroDesconhecido",e[e.tempoEsgotado=504]="tempoEsgotado",e))(we||{});/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gt=e=>{for(const a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Me=e=>e==="";/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yt=(...e)=>e.filter((a,n,r)=>!!a&&a.trim()!==""&&r.indexOf(a)===n).join(" ").trim();/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Te=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $t=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Et=e=>{const a=$t(e);return a.charAt(0).toUpperCase()+a.slice(1)};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var fe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kt=({name:e,iconNode:a,absoluteStrokeWidth:n,"absolute-stroke-width":r,strokeWidth:s,"stroke-width":h,size:o=fe.width,color:l=fe.stroke,...u},{slots:i})=>t.h("svg",{...fe,...u,width:o,height:o,stroke:l,"stroke-width":Me(n)||Me(r)||n===!0||r===!0?Number(s||h||fe["stroke-width"])*24/Number(o):s||h||fe["stroke-width"],class:yt("lucide",u.class,...e?[`lucide-${Te(Et(e))}-icon`,`lucide-${Te(e)}`]:["lucide-icon"]),...!i.default&&!gt(u)&&{"aria-hidden":"true"}},[...a.map(f=>t.h(...f)),...i.default?[i.default()]:[]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const me=(e,a)=>(n,{slots:r,attrs:s})=>t.h(kt,{...s,...n,iconNode:a,name:e},r);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pe=me("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fe=me("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Oe=me("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ie=me("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _t=me("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bt=me("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Ct=t.defineComponent({name:"EliTabelaCaixaDeBusca",components:{Search:Bt},props:{modelo:{type:String,required:!1,default:""}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const n=t.ref(e.modelo??"");t.watch(()=>e.modelo,s=>{s!==void 0&&s!==n.value&&(n.value=s)});function r(){a("buscar",n.value.trim())}return{texto:n,emitirBusca:r}}}),vt={class:"eli-tabela__busca"},St={class:"eli-tabela__busca-input-wrapper"};function Vt(e,a,n,r,s,h){const o=t.resolveComponent("Search");return t.openBlock(),t.createElementBlock("div",vt,[t.createElementVNode("div",St,[t.withDirectives(t.createElementVNode("input",{id:"eli-tabela-busca","onUpdate:modelValue":a[0]||(a[0]=l=>e.texto=l),type:"search",class:"eli-tabela__busca-input",placeholder:"Digite termos para filtrar",onKeyup:a[1]||(a[1]=t.withKeys((...l)=>e.emitirBusca&&e.emitirBusca(...l),["enter"]))},null,544),[[t.vModelText,e.texto]]),t.createElementVNode("button",{type:"button",class:"eli-tabela__busca-botao","aria-label":"Buscar",title:"Buscar",onClick:a[2]||(a[2]=(...l)=>e.emitirBusca&&e.emitirBusca(...l))},[t.createVNode(o,{class:"eli-tabela__busca-botao-icone",size:16,"stroke-width":2,"aria-hidden":"true"})])])])}const Nt=F(Ct,[["render",Vt],["__scopeId","data-v-341415d1"]]),At=t.defineComponent({name:"EliTabelaCabecalho",components:{EliTabelaCaixaDeBusca:Nt},props:{exibirBusca:{type:Boolean,required:!0},exibirBotaoColunas:{type:Boolean,required:!1,default:!0},exibirBotaoFiltroAvancado:{type:Boolean,required:!1,default:!1},valorBusca:{type:String,required:!0},acoesCabecalho:{type:Array,required:!0}},emits:{buscar(e){return typeof e=="string"},colunas(){return!0},filtroAvancado(){return!0}},setup(e,{emit:a}){const n=t.computed(()=>e.acoesCabecalho.length>0);function r(o){a("buscar",o)}function s(){a("colunas")}function h(){a("filtroAvancado")}return{temAcoesCabecalho:n,emitBuscar:r,emitColunas:s,emitFiltroAvancado:h}}}),Dt={class:"eli-tabela__cabecalho"},wt={key:0,class:"eli-tabela__busca-grupo"},Mt={key:1,class:"eli-tabela__acoes-cabecalho"},Tt=["onClick"],Pt={class:"eli-tabela__acoes-cabecalho-rotulo"};function Ft(e,a,n,r,s,h){const o=t.resolveComponent("EliTabelaCaixaDeBusca");return t.openBlock(),t.createElementBlock("div",Dt,[e.exibirBusca?(t.openBlock(),t.createElementBlock("div",wt,[e.exibirBotaoColunas?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--colunas",onClick:a[0]||(a[0]=(...l)=>e.emitColunas&&e.emitColunas(...l))}," Colunas ")):t.createCommentVNode("",!0),e.exibirBotaoFiltroAvancado?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"eli-tabela__acoes-cabecalho-botao eli-tabela__acoes-cabecalho-botao--filtro",onClick:a[1]||(a[1]=(...l)=>e.emitFiltroAvancado&&e.emitFiltroAvancado(...l))}," Filtro ")):t.createCommentVNode("",!0),t.createVNode(o,{modelo:e.valorBusca,onBuscar:e.emitBuscar},null,8,["modelo","onBuscar"])])):t.createCommentVNode("",!0),e.temAcoesCabecalho?(t.openBlock(),t.createElementBlock("div",Mt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoesCabecalho,(l,u)=>(t.openBlock(),t.createElementBlock("button",{key:`${l.rotulo}-${u}`,type:"button",class:"eli-tabela__acoes-cabecalho-botao",style:t.normalizeStyle(l.cor?{backgroundColor:l.cor,color:"#fff"}:void 0),onClick:l.acao},[l.icone?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.icone),{key:0,class:"eli-tabela__acoes-cabecalho-icone",size:16,"stroke-width":2})):t.createCommentVNode("",!0),t.createElementVNode("span",Pt,t.toDisplayString(l.rotulo),1)],12,Tt))),128))])):t.createCommentVNode("",!0)])}const Ot=F(At,[["render",Ft],["__scopeId","data-v-17166105"]]),It=t.defineComponent({name:"EliTabelaEstados",props:{carregando:{type:Boolean,required:!0},erro:{type:String,required:!0},mensagemVazio:{type:String,required:!1,default:void 0}}}),qt={key:0,class:"eli-tabela eli-tabela--carregando","aria-busy":"true"},Lt={key:1,class:"eli-tabela eli-tabela--erro",role:"alert"},zt={class:"eli-tabela__erro-mensagem"},jt={key:2,class:"eli-tabela eli-tabela--vazio"};function Ht(e,a,n,r,s,h){return e.carregando?(t.openBlock(),t.createElementBlock("div",qt," Carregando... ")):e.erro?(t.openBlock(),t.createElementBlock("div",Lt,[a[0]||(a[0]=t.createElementVNode("div",{class:"eli-tabela__erro-titulo"},"Erro",-1)),t.createElementVNode("div",zt,t.toDisplayString(e.erro),1)])):(t.openBlock(),t.createElementBlock("div",jt,t.toDisplayString(e.mensagemVazio??"Nenhum registro encontrado."),1))}const Ut=F(It,[["render",Ht]]),Yt=t.defineComponent({name:"EliTabelaDebug",props:{isDev:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},menuPopupPos:{type:Object,required:!0}}}),Rt={key:0,style:{position:"fixed",left:"8px",bottom:"8px","z-index":"999999",background:"rgba(185,28,28,0.9)",color:"#fff",padding:"6px 10px","border-radius":"8px","font-size":"12px","max-width":"500px"}};function Jt(e,a,n,r,s,h){return e.isDev?(t.openBlock(),t.createElementBlock("div",Rt,[a[0]||(a[0]=t.createElementVNode("div",null,[t.createElementVNode("b",null,"EliTabela debug")],-1)),t.createElementVNode("div",null,"menuAberto: "+t.toDisplayString(e.menuAberto),1),t.createElementVNode("div",null,"menuPos: top="+t.toDisplayString(e.menuPopupPos.top)+", left="+t.toDisplayString(e.menuPopupPos.left),1)])):t.createCommentVNode("",!0)}const Wt=F(Yt,[["render",Jt]]),Zt=t.defineComponent({name:"EliTabelaHead",components:{ArrowUp:Fe,ArrowDown:Pe},props:{colunas:{type:Array,required:!0},temAcoes:{type:Boolean,required:!0},temColunasInvisiveis:{type:Boolean,required:!0},colunaOrdenacao:{type:String,required:!0},direcaoOrdenacao:{type:String,required:!0}},emits:{alternarOrdenacao(e){return typeof e=="string"&&e.length>0}},setup(e,{emit:a}){function n(s){return(s==null?void 0:s.coluna_ordem)!==void 0&&(s==null?void 0:s.coluna_ordem)!==null}function r(s){a("alternarOrdenacao",s)}return{ArrowUp:Fe,ArrowDown:Pe,isOrdenavel:n,emitAlternarOrdenacao:r}}}),Gt={class:"eli-tabela__thead"},Xt={class:"eli-tabela__tr eli-tabela__tr--header"},Kt={key:0,class:"eli-tabela__th eli-tabela__th--expander",scope:"col"},Qt=["onClick"],xt={class:"eli-tabela__th-texto"},ea={key:1,class:"eli-tabela__th-label"},ta={key:1,class:"eli-tabela__th eli-tabela__th--acoes",scope:"col"};function aa(e,a,n,r,s,h){const o=t.resolveComponent("ArrowUp");return t.openBlock(),t.createElementBlock("thead",Gt,[t.createElementVNode("tr",Xt,[e.temColunasInvisiveis?(t.openBlock(),t.createElementBlock("th",Kt)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(l,u)=>(t.openBlock(),t.createElementBlock("th",{key:`th-${u}`,class:t.normalizeClass(["eli-tabela__th",[e.isOrdenavel(l)?"eli-tabela__th--ordenavel":void 0]]),scope:"col"},[e.isOrdenavel(l)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["eli-tabela__th-botao",[e.colunaOrdenacao===String(l.coluna_ordem)?"eli-tabela__th-botao--ativo":void 0]]),onClick:i=>e.emitAlternarOrdenacao(String(l.coluna_ordem))},[t.createElementVNode("span",xt,t.toDisplayString(l.rotulo),1),e.colunaOrdenacao===String(l.coluna_ordem)?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.direcaoOrdenacao==="asc"?e.ArrowUp:e.ArrowDown),{key:0,class:"eli-tabela__th-icone",size:16,"stroke-width":2,"aria-hidden":"true"})):(t.openBlock(),t.createBlock(o,{key:1,class:"eli-tabela__th-icone eli-tabela__th-icone--oculto",size:16,"stroke-width":2,"aria-hidden":"true"}))],10,Qt)):(t.openBlock(),t.createElementBlock("span",ea,t.toDisplayString(l.rotulo),1))],2))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("th",ta," Ações ")):t.createCommentVNode("",!0)])])}const oa=F(Zt,[["render",aa]]),na=t.defineComponent({name:"EliTabelaCelulaTextoSimples",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}}),ra={key:1};function la(e,a,n,r,s,h){var o,l,u;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__celula-link",onClick:a[0]||(a[0]=t.withModifiers(i=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString((l=e.dados)==null?void 0:l.texto),1)):(t.openBlock(),t.createElementBlock("span",ra,t.toDisplayString((u=e.dados)==null?void 0:u.texto),1))}const ia=F(na,[["render",la],["__scopeId","data-v-7a629ffa"]]),sa=t.defineComponent({name:"EliTabelaCelulaTextoTruncado",props:{dados:{type:Object}},setup({dados:e}){return{dados:e}}}),ca=["title"],da=["title"];function ua(e,a,n,r,s,h){var o,l,u,i,f;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__texto-truncado eli-tabela__celula-link",title:(l=e.dados)==null?void 0:l.texto,onClick:a[0]||(a[0]=t.withModifiers(y=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString((u=e.dados)==null?void 0:u.texto),9,ca)):(t.openBlock(),t.createElementBlock("span",{key:1,class:"eli-tabela__texto-truncado",title:(i=e.dados)==null?void 0:i.texto},t.toDisplayString((f=e.dados)==null?void 0:f.texto),9,da))}const ma=F(sa,[["render",ua],["__scopeId","data-v-74854889"]]),pa=t.defineComponent({name:"EliTabelaCelulaNumero",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}}),fa={key:1};function ba(e,a,n,r,s,h){var o,l,u;return(o=e.dados)!=null&&o.acao?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"eli-tabela__celula-link",onClick:a[0]||(a[0]=t.withModifiers(i=>e.dados.acao(),["stop","prevent"]))},t.toDisplayString(String((l=e.dados)==null?void 0:l.numero).replace(".",",")),1)):(t.openBlock(),t.createElementBlock("span",fa,t.toDisplayString(String((u=e.dados)==null?void 0:u.numero).replace(".",",")),1))}const ha={textoSimples:ia,textoTruncado:ma,numero:F(pa,[["render",ba],["__scopeId","data-v-e7bac7ff"]])},ga=t.defineComponent({name:"EliTabelaCelula",props:{celula:{type:Array,required:!0}},setup(e){const a=t.computed(()=>e.celula[0]),n=t.computed(()=>e.celula[1]),r=t.computed(()=>ha[a.value]),s=t.computed(()=>n.value);return{Componente:r,dadosParaComponente:s}}});function ya(e,a,n,r,s,h){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Componente),{dados:e.dadosParaComponente},null,8,["dados"])}const qe=F(ga,[["render",ya]]),$a=t.defineComponent({name:"EliTabelaDetalhesLinha",components:{EliTabelaCelula:qe},props:{linha:{type:null,required:!0},colunasInvisiveis:{type:Array,required:!0}}}),Ea={class:"eli-tabela__detalhes"},ka={class:"eli-tabela__detalhe-rotulo"},_a={class:"eli-tabela__detalhe-valor"};function Ba(e,a,n,r,s,h){const o=t.resolveComponent("EliTabelaCelula");return t.openBlock(),t.createElementBlock("div",Ea,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunasInvisiveis,(l,u)=>(t.openBlock(),t.createElementBlock("div",{key:`det-${u}-${l.rotulo}`,class:"eli-tabela__detalhe"},[t.createElementVNode("div",ka,t.toDisplayString(l.rotulo),1),t.createElementVNode("div",_a,[t.createVNode(o,{celula:l.celula(e.linha)},null,8,["celula"])])]))),128))])}const Ca=F($a,[["render",Ba],["__scopeId","data-v-f1ee8d20"]]),va=t.defineComponent({name:"EliTabelaBody",components:{EliTabelaCelula:qe,EliTabelaDetalhesLinha:Ca,MoreVertical:_t,ChevronRight:Ie,ChevronDown:Oe},props:{colunas:{type:Array,required:!0},colunasInvisiveis:{type:Array,required:!0},temColunasInvisiveis:{type:Boolean,required:!0},linhasExpandidas:{type:Object,required:!0},linhas:{type:Array,required:!0},temAcoes:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},possuiAcoes:{type:Function,required:!0},toggleMenu:{type:Function,required:!0},alternarLinhaExpandida:{type:Function,required:!0}},setup(){return{ChevronRight:Ie,ChevronDown:Oe}}}),Sa={class:"eli-tabela__tbody"},Va=["aria-expanded","aria-label","title","onClick"],Na=["id","disabled","aria-expanded","aria-controls","aria-label","title","onClick"],Aa=["colspan"];function Da(e,a,n,r,s,h){const o=t.resolveComponent("EliTabelaCelula"),l=t.resolveComponent("MoreVertical"),u=t.resolveComponent("EliTabelaDetalhesLinha");return t.openBlock(),t.createElementBlock("tbody",Sa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(i,f)=>{var y,D,A,_,c,E;return t.openBlock(),t.createElementBlock(t.Fragment,{key:`grp-${f}`},[t.createElementVNode("tr",{class:t.normalizeClass(["eli-tabela__tr",[f%2===1?"eli-tabela__tr--zebra":void 0]])},[e.temColunasInvisiveis?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--expander",key:`td-${f}-exp`},[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["eli-tabela__expander-botao",[(y=e.linhasExpandidas)!=null&&y[f]?"eli-tabela__expander-botao--ativo":void 0]]),"aria-expanded":(D=e.linhasExpandidas)!=null&&D[f]?"true":"false","aria-label":(A=e.linhasExpandidas)!=null&&A[f]?"Ocultar colunas ocultas":"Mostrar colunas ocultas",title:(_=e.linhasExpandidas)!=null&&_[f]?"Ocultar detalhes":"Mostrar detalhes",onClick:t.withModifiers(g=>e.alternarLinhaExpandida(f),["stop"])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent((c=e.linhasExpandidas)!=null&&c[f]?e.ChevronDown:e.ChevronRight),{class:"eli-tabela__expander-icone",size:16,"stroke-width":2,"aria-hidden":"true"}))],10,Va)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(g,k)=>(t.openBlock(),t.createElementBlock("td",{key:`td-${f}-${k}`,class:"eli-tabela__td"},[t.createVNode(o,{celula:g.celula(i)},null,8,["celula"])]))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--acoes",key:`td-${f}-acoes`},[t.createElementVNode("div",{class:t.normalizeClass(["eli-tabela__acoes-container",[e.menuAberto===f?"eli-tabela__acoes-container--aberto":void 0]])},[t.createElementVNode("button",{class:"eli-tabela__acoes-toggle",type:"button",id:`eli-tabela-acoes-toggle-${f}`,disabled:!e.possuiAcoes(f),"aria-haspopup":"menu","aria-expanded":e.menuAberto===f?"true":"false","aria-controls":e.possuiAcoes(f)?`eli-tabela-acoes-menu-${f}`:void 0,"aria-label":e.possuiAcoes(f)?"Ações da linha":"Nenhuma ação disponível",title:e.possuiAcoes(f)?"Ações":"Nenhuma ação disponível",onClick:t.withModifiers(g=>e.toggleMenu(f,g),["stop"])},[t.createVNode(l,{class:"eli-tabela__acoes-toggle-icone",size:18,"stroke-width":2})],8,Na)],2)])):t.createCommentVNode("",!0)],2),e.temColunasInvisiveis&&((E=e.linhasExpandidas)!=null&&E[f])?(t.openBlock(),t.createElementBlock("tr",{key:0,class:t.normalizeClass(["eli-tabela__tr eli-tabela__tr--detalhes",[f%2===1?"eli-tabela__tr--zebra":void 0]])},[t.createElementVNode("td",{class:"eli-tabela__td eli-tabela__td--detalhes",colspan:(e.temColunasInvisiveis?1:0)+e.colunas.length+(e.temAcoes?1:0)},[t.createVNode(u,{linha:i,colunasInvisiveis:e.colunasInvisiveis},null,8,["linha","colunasInvisiveis"])],8,Aa)],2)):t.createCommentVNode("",!0)],64)}),128))])}const wa=F(va,[["render",Da]]),Ma=t.defineComponent({name:"EliTabelaMenuAcoes",props:{menuAberto:{type:Number,required:!0},posicao:{type:Object,required:!0},acoes:{type:Array,required:!0},linha:{type:null,required:!0}},emits:{executar(e){return e!==null&&typeof e=="object"}},setup(e,{emit:a,expose:n}){const r=t.ref(null);n({menuEl:r});const s=t.computed(()=>e.acoes.length>0);function h(o){e.linha&&a("executar",{acao:o.acao,linha:e.linha})}return{menuEl:r,possuiAcoes:s,emitExecutar:h}}}),Ta=["id","aria-labelledby"],Pa=["aria-label","title","onClick"],Fa={class:"eli-tabela__acoes-item-texto"};function Oa(e,a,n,r,s,h){return t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[e.menuAberto!==null&&e.possuiAcoes?(t.openBlock(),t.createElementBlock("ul",{key:0,id:`eli-tabela-acoes-menu-${e.menuAberto}`,ref:"menuEl",class:"eli-tabela__acoes-menu",role:"menu","aria-labelledby":`eli-tabela-acoes-toggle-${e.menuAberto}`,style:t.normalizeStyle({position:"fixed",top:`${e.posicao.top}px`,left:`${e.posicao.left}px`,zIndex:999999})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoes,o=>(t.openBlock(),t.createElementBlock("li",{key:`acao-${e.menuAberto}-${o.indice}`,class:"eli-tabela__acoes-item",role:"none"},[t.createElementVNode("button",{type:"button",class:"eli-tabela__acoes-item-botao",style:t.normalizeStyle({color:o.acao.cor}),role:"menuitem","aria-label":o.acao.rotulo,title:o.acao.rotulo,onClick:t.withModifiers(l=>e.emitExecutar(o),["stop"])},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.acao.icone),{class:"eli-tabela__acoes-item-icone",size:16,"stroke-width":2})),t.createElementVNode("span",Fa,t.toDisplayString(o.acao.rotulo),1)],12,Pa)]))),128))],12,Ta)):t.createCommentVNode("",!0)])}const Ia=F(Ma,[["render",Oa]]),qa=t.defineComponent({name:"EliTabelaPaginacao",props:{pagina:{type:Number,required:!0},totalPaginas:{type:Number,required:!0},maximoBotoes:{type:Number,required:!1}},emits:{alterar(e){return Number.isFinite(e)}},setup(e,{emit:a}){const n=t.computed(()=>{const i=e.maximoBotoes;return typeof i=="number"&&i>=5?Math.floor(i):7}),r=t.computed(()=>{const i=e.totalPaginas,f=e.pagina,y=n.value,D=[],A=k=>{D.push({label:String(k),pagina:k,ativo:k===f})},_=()=>{D.push({label:"…",ehEllipsis:!0})};if(i<=y){for(let k=1;k<=i;k+=1)A(k);return D}const c=Math.max(3,y-2);let E=Math.max(2,f-Math.floor(c/2)),g=E+c-1;g>=i&&(g=i-1,E=g-c+1),A(1),E>2&&_();for(let k=E;k<=g;k+=1)A(k);return g<i-1&&_(),A(i),D});function s(i){if(!i)return;const f=Math.min(Math.max(1,i),e.totalPaginas);f!==e.pagina&&a("alterar",f)}const h=t.computed(()=>e.pagina<=1),o=t.computed(()=>e.pagina>=e.totalPaginas),l=t.computed(()=>e.pagina),u=t.computed(()=>e.totalPaginas);return{botoes:r,irParaPagina:s,anteriorDesabilitado:h,proximaDesabilitada:o,paginaAtual:l,totalPaginasExibidas:u}}}),La={key:0,class:"eli-tabela__paginacao",role:"navigation","aria-label":"Paginação de resultados"},za=["disabled"],ja={key:0,class:"eli-tabela__pagina-ellipsis","aria-hidden":"true"},Ha=["disabled","aria-current","aria-label","onClick"],Ua=["disabled"];function Ya(e,a,n,r,s,h){return e.totalPaginasExibidas>1?(t.openBlock(),t.createElementBlock("nav",La,[t.createElementVNode("button",{type:"button",class:"eli-tabela__pagina-botao",disabled:e.anteriorDesabilitado,"aria-label":"Página anterior",onClick:a[0]||(a[0]=o=>e.irParaPagina(e.paginaAtual-1))}," << ",8,za),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.botoes,(o,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`${o.label}-${l}`},[o.ehEllipsis?(t.openBlock(),t.createElementBlock("span",ja,t.toDisplayString(o.label),1)):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["eli-tabela__pagina-botao",o.ativo?"eli-tabela__pagina-botao--ativo":void 0]),disabled:o.ativo,"aria-current":o.ativo?"page":void 0,"aria-label":`Ir para página ${o.label}`,onClick:u=>e.irParaPagina(o.pagina)},t.toDisplayString(o.label),11,Ha))],64))),128)),t.createElementVNode("button",{type:"button",class:"eli-tabela__pagina-botao",disabled:e.proximaDesabilitada,"aria-label":"Próxima página",onClick:a[1]||(a[1]=o=>e.irParaPagina(e.paginaAtual+1))}," >> ",8,Ua)])):t.createCommentVNode("",!0)}const Ra=F(qa,[["render",Ya],["__scopeId","data-v-5ca7a362"]]),Le="application/x-eli-tabela-coluna",Ja=t.defineComponent({name:"EliTabelaModalColunas",props:{aberto:{type:Boolean,required:!0},rotulosColunas:{type:Array,required:!0},configInicial:{type:Object,required:!0},colunas:{type:Array,required:!0}},emits:{fechar(){return!0},salvar(e){return!0}},setup(e,{emit:a}){const n=t.ref([]),r=t.ref([]);function s(){var Z,ee;const _=e.rotulosColunas,c=(((Z=e.configInicial.visiveis)==null?void 0:Z.length)??0)>0||(((ee=e.configInicial.invisiveis)==null?void 0:ee.length)??0)>0,E=new Set(e.colunas.filter(q=>q.visivel===!1).map(q=>q.rotulo)),g=c?new Set(e.configInicial.invisiveis??[]):E,k=_.filter(q=>!g.has(q)),H=e.configInicial.visiveis??[],ie=new Set(k),W=[];for(const q of H)ie.has(q)&&W.push(q);for(const q of k)W.includes(q)||W.push(q);n.value=W,r.value=_.filter(q=>g.has(q))}t.watch(()=>[e.aberto,e.rotulosColunas,e.configInicial,e.colunas],()=>{e.aberto&&s()},{deep:!0,immediate:!0});function h(){a("fechar")}function o(){a("salvar",{visiveis:[...n.value],invisiveis:[...r.value]})}function l(_,c){var E,g;try{(E=_.dataTransfer)==null||E.setData(Le,JSON.stringify(c)),(g=_.dataTransfer)==null||g.setData("text/plain",c.rotulo),_.dataTransfer.effectAllowed="move"}catch{}}function u(_){var c;try{const E=(c=_.dataTransfer)==null?void 0:c.getData(Le);if(!E)return null;const g=JSON.parse(E);return!g||typeof g.rotulo!="string"||g.origem!=="visiveis"&&g.origem!=="invisiveis"?null:g}catch{return null}}function i(_){const c=_.origem==="visiveis"?n.value:r.value,E=c.indexOf(_.rotulo);E>=0&&c.splice(E,1)}function f(_,c,E){const g=_==="visiveis"?n.value:r.value,k=g.indexOf(c);k>=0&&g.splice(k,1),E===null||E<0||E>g.length?g.push(c):g.splice(E,0,c)}function y(_,c,E,g){l(_,{rotulo:c,origem:E,index:g})}function D(_,c,E){const g=u(_);if(g)if(i(g),f(c,g.rotulo,E),c==="visiveis"){const k=r.value.indexOf(g.rotulo);k>=0&&r.value.splice(k,1)}else{const k=n.value.indexOf(g.rotulo);k>=0&&n.value.splice(k,1)}}function A(_,c,E){const g=u(_);if(g)if(i(g),f(c,g.rotulo,null),c==="visiveis"){const k=r.value.indexOf(g.rotulo);k>=0&&r.value.splice(k,1)}else{const k=n.value.indexOf(g.rotulo);k>=0&&n.value.splice(k,1)}}return{visiveisLocal:n,invisiveisLocal:r,emitFechar:h,emitSalvar:o,onDragStart:y,onDropItem:D,onDropLista:A}}}),Wa={class:"eli-tabela-modal-colunas__modal",role:"dialog","aria-modal":"true","aria-label":"Configurar colunas"},Za={class:"eli-tabela-modal-colunas__header"},Ga={class:"eli-tabela-modal-colunas__conteudo"},Xa={class:"eli-tabela-modal-colunas__coluna"},Ka=["onDragstart","onDrop"],Qa={class:"eli-tabela-modal-colunas__item-texto"},xa={class:"eli-tabela-modal-colunas__coluna"},eo=["onDragstart","onDrop"],to={class:"eli-tabela-modal-colunas__item-texto"},ao={class:"eli-tabela-modal-colunas__footer"};function oo(e,a,n,r,s,h){return e.aberto?(t.openBlock(),t.createElementBlock("div",{key:0,class:"eli-tabela-modal-colunas__overlay",role:"presentation",onClick:a[9]||(a[9]=t.withModifiers((...o)=>e.emitFechar&&e.emitFechar(...o),["self"]))},[t.createElementVNode("div",Wa,[t.createElementVNode("header",Za,[a[10]||(a[10]=t.createElementVNode("h3",{class:"eli-tabela-modal-colunas__titulo"},"Colunas",-1)),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__fechar","aria-label":"Fechar",onClick:a[0]||(a[0]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," × ")]),t.createElementVNode("div",Ga,[t.createElementVNode("div",Xa,[a[12]||(a[12]=t.createElementVNode("div",{class:"eli-tabela-modal-colunas__coluna-titulo"},"Visíveis",-1)),t.createElementVNode("div",{class:"eli-tabela-modal-colunas__lista",onDragover:a[2]||(a[2]=t.withModifiers(()=>{},["prevent"])),onDrop:a[3]||(a[3]=o=>e.onDropLista(o,"visiveis",null))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.visiveisLocal,(o,l)=>(t.openBlock(),t.createElementBlock("div",{key:`vis-${o}`,class:"eli-tabela-modal-colunas__item",draggable:"true",onDragstart:u=>e.onDragStart(u,o,"visiveis",l),onDragover:a[1]||(a[1]=t.withModifiers(()=>{},["prevent"])),onDrop:u=>e.onDropItem(u,"visiveis",l)},[a[11]||(a[11]=t.createElementVNode("span",{class:"eli-tabela-modal-colunas__item-handle","aria-hidden":"true"},"⋮⋮",-1)),t.createElementVNode("span",Qa,t.toDisplayString(o),1)],40,Ka))),128))],32)]),t.createElementVNode("div",xa,[a[14]||(a[14]=t.createElementVNode("div",{class:"eli-tabela-modal-colunas__coluna-titulo"},"Invisíveis",-1)),t.createElementVNode("div",{class:"eli-tabela-modal-colunas__lista",onDragover:a[5]||(a[5]=t.withModifiers(()=>{},["prevent"])),onDrop:a[6]||(a[6]=o=>e.onDropLista(o,"invisiveis",null))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.invisiveisLocal,(o,l)=>(t.openBlock(),t.createElementBlock("div",{key:`inv-${o}`,class:"eli-tabela-modal-colunas__item",draggable:"true",onDragstart:u=>e.onDragStart(u,o,"invisiveis",l),onDragover:a[4]||(a[4]=t.withModifiers(()=>{},["prevent"])),onDrop:u=>e.onDropItem(u,"invisiveis",l)},[a[13]||(a[13]=t.createElementVNode("span",{class:"eli-tabela-modal-colunas__item-handle","aria-hidden":"true"},"⋮⋮",-1)),t.createElementVNode("span",to,t.toDisplayString(o),1)],40,eo))),128))],32)])]),t.createElementVNode("footer",ao,[t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--sec",onClick:a[7]||(a[7]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," Cancelar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-colunas__botao eli-tabela-modal-colunas__botao--prim",onClick:a[8]||(a[8]=(...o)=>e.emitSalvar&&e.emitSalvar(...o))}," Salvar ")])])])):t.createCommentVNode("",!0)}const no=F(Ja,[["render",oo],["__scopeId","data-v-b8f693ef"]]);function ro(e){if(!Number.isFinite(e)||e<=0||e>=1)return 0;const a=e.toString();if(a.includes("e-")){const[,s]=a.split("e-"),h=Number(s);return Number.isFinite(h)?h:0}const n=a.indexOf(".");return n===-1?0:a.slice(n+1).replace(/0+$/,"").length}function lo(e){const a=(e??"").trim().replace(/,/g,".");if(!a)return null;const n=Number(a);return Number.isNaN(n)?null:n}function Ce(e,a){return e==null?"":a===null?String(e):Number(e).toFixed(Math.max(0,a)).replace(/\./g,",")}function ze(e){return(e??"").replace(/\D+/g,"")}function io(e){const a=(e??"").replace(/[^0-9.,]+/g,""),n=a.match(/[.,]/);if(!n)return a;const r=n[0],s=a.indexOf(r),h=a.slice(0,s).replace(/[.,]/g,""),o=a.slice(s+1).replace(/[.,]/g,"");return`${h.length?h:"0"}${r}${o}`}function so(e,a){if(a===null)return e;if(a<=0)return e.replace(/[.,]/g,"");const n=e.match(/[.,]/);if(!n)return e;const r=n[0],s=e.indexOf(r),h=e.slice(0,s),o=e.slice(s+1);return`${h}${r}${o.slice(0,a)}`}function co(e){const a=e.match(/^(\d+)[.,]$/);if(!a)return null;const n=Number(a[1]);return Number.isNaN(n)?null:n}const uo=t.defineComponent({name:"EliEntradaNumero",inheritAttrs:!1,props:{value:{type:[Number,null],default:void 0},opcoes:{type:Object,required:!0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,focus:()=>!0,blur:()=>!0},setup(e,{attrs:a,emit:n}){const r=t.computed(()=>{var f;const i=(f=e.opcoes)==null?void 0:f.precisao;return i==null?null:ro(i)}),s=t.computed(()=>r.value===0),h=t.computed(()=>{const i=r.value;return i!==null&&i>0}),o=t.ref(""),l=t.ref(void 0);t.watch(()=>e.value,i=>{i!==l.value&&(o.value=Ce(i,r.value),l.value=i)},{immediate:!0});function u(i){if(h.value){const A=r.value??0,_=ze(i),c=_?Number(_):0,E=Math.pow(10,A),g=_?c/E:null,k=g===null?null:g;l.value=k,n("update:value",k),n("input",k),n("change",k),o.value=Ce(k,A);return}const f=s.value?ze(i):io(i),y=s.value?f:so(f,r.value);let D=null;if(y){const _=(s.value?null:co(y))??lo(y);D=_===null?null:_}l.value=D,n("update:value",D),n("input",D),n("change",D),o.value=Ce(D,r.value)}return{attrs:a,emit:n,displayValue:o,isInteiro:s,onUpdateModelValue:u}}}),mo={class:"eli-entrada__prefixo"},po={class:"eli-entrada__sufixo"};function fo(e,a,n,r,s,h){var o,l,u,i;return t.openBlock(),t.createBlock(_e.VTextField,t.mergeProps({"model-value":e.displayValue,label:(o=e.opcoes)==null?void 0:o.rotulo,placeholder:(l=e.opcoes)==null?void 0:l.placeholder,type:e.isInteiro?"number":"text",inputmode:e.isInteiro?"numeric":"decimal",pattern:e.isInteiro?"[0-9]*":"[0-9.,]*"},e.attrs,{"onUpdate:modelValue":e.onUpdateModelValue,onFocus:a[0]||(a[0]=()=>e.emit("focus")),onBlur:a[1]||(a[1]=()=>e.emit("blur"))}),t.createSlots({_:2},[(u=e.opcoes)!=null&&u.prefixo?{name:"prepend-inner",fn:t.withCtx(()=>[t.createElementVNode("span",mo,t.toDisplayString(e.opcoes.prefixo),1)]),key:"0"}:void 0,(i=e.opcoes)!=null&&i.sufixo?{name:"append-inner",fn:t.withCtx(()=>[t.createElementVNode("span",po,t.toDisplayString(e.opcoes.sufixo),1)]),key:"1"}:void 0]),1040,["model-value","label","placeholder","type","inputmode","pattern","onUpdate:modelValue"])}const ve=F(uo,[["render",fo],["__scopeId","data-v-77cbf216"]]);function bo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $e={exports:{}},ho=$e.exports,je;function go(){return je||(je=1,(function(e,a){(function(n,r){e.exports=r()})(ho,(function(){var n=1e3,r=6e4,s=36e5,h="millisecond",o="second",l="minute",u="hour",i="day",f="week",y="month",D="quarter",A="year",_="date",c="Invalid Date",E=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,k={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(C){var b=["th","st","nd","rd"],d=C%100;return"["+C+(b[(d-20)%10]||b[d]||b[0])+"]"}},H=function(C,b,d){var $=String(C);return!$||$.length>=b?C:""+Array(b+1-$.length).join(d)+C},ie={s:H,z:function(C){var b=-C.utcOffset(),d=Math.abs(b),$=Math.floor(d/60),m=d%60;return(b<=0?"+":"-")+H($,2,"0")+":"+H(m,2,"0")},m:function C(b,d){if(b.date()<d.date())return-C(d,b);var $=12*(d.year()-b.year())+(d.month()-b.month()),m=b.clone().add($,y),S=d-m<0,v=b.clone().add($+(S?-1:1),y);return+(-($+(d-m)/(S?m-v:v-m))||0)},a:function(C){return C<0?Math.ceil(C)||0:Math.floor(C)},p:function(C){return{M:y,y:A,w:f,d:i,D:_,h:u,m:l,s:o,ms:h,Q:D}[C]||String(C||"").toLowerCase().replace(/s$/,"")},u:function(C){return C===void 0}},W="en",Z={};Z[W]=k;var ee="$isDayjsObject",q=function(C){return C instanceof ce||!(!C||!C[ee])},te=function C(b,d,$){var m;if(!b)return W;if(typeof b=="string"){var S=b.toLowerCase();Z[S]&&(m=S),d&&(Z[S]=d,m=S);var v=b.split("-");if(!m&&v.length>1)return C(v[0])}else{var T=b.name;Z[T]=b,m=T}return!$&&m&&(W=m),m||!$&&W},M=function(C,b){if(q(C))return C.clone();var d=typeof b=="object"?b:{};return d.date=C,d.args=arguments,new ce(d)},N=ie;N.l=te,N.i=q,N.w=function(C,b){return M(C,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var ce=(function(){function C(d){this.$L=te(d.locale,null,!0),this.parse(d),this.$x=this.$x||d.x||{},this[ee]=!0}var b=C.prototype;return b.parse=function(d){this.$d=(function($){var m=$.date,S=$.utc;if(m===null)return new Date(NaN);if(N.u(m))return new Date;if(m instanceof Date)return new Date(m);if(typeof m=="string"&&!/Z$/i.test(m)){var v=m.match(E);if(v){var T=v[2]-1||0,O=(v[7]||"0").substring(0,3);return S?new Date(Date.UTC(v[1],T,v[3]||1,v[4]||0,v[5]||0,v[6]||0,O)):new Date(v[1],T,v[3]||1,v[4]||0,v[5]||0,v[6]||0,O)}}return new Date(m)})(d),this.init()},b.init=function(){var d=this.$d;this.$y=d.getFullYear(),this.$M=d.getMonth(),this.$D=d.getDate(),this.$W=d.getDay(),this.$H=d.getHours(),this.$m=d.getMinutes(),this.$s=d.getSeconds(),this.$ms=d.getMilliseconds()},b.$utils=function(){return N},b.isValid=function(){return this.$d.toString()!==c},b.isSame=function(d,$){var m=M(d);return this.startOf($)<=m&&m<=this.endOf($)},b.isAfter=function(d,$){return M(d)<this.startOf($)},b.isBefore=function(d,$){return this.endOf($)<M(d)},b.$g=function(d,$,m){return N.u(d)?this[$]:this.set(m,d)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(d,$){var m=this,S=!!N.u($)||$,v=N.p(d),T=function(re,j){var Q=N.w(m.$u?Date.UTC(m.$y,j,re):new Date(m.$y,j,re),m);return S?Q:Q.endOf(i)},O=function(re,j){return N.w(m.toDate()[re].apply(m.toDate("s"),(S?[0,0,0,0]:[23,59,59,999]).slice(j)),m)},z=this.$W,U=this.$M,R=this.$D,oe="set"+(this.$u?"UTC":"");switch(v){case A:return S?T(1,0):T(31,11);case y:return S?T(1,U):T(0,U+1);case f:var ne=this.$locale().weekStart||0,de=(z<ne?z+7:z)-ne;return T(S?R-de:R+(6-de),U);case i:case _:return O(oe+"Hours",0);case u:return O(oe+"Minutes",1);case l:return O(oe+"Seconds",2);case o:return O(oe+"Milliseconds",3);default:return this.clone()}},b.endOf=function(d){return this.startOf(d,!1)},b.$set=function(d,$){var m,S=N.p(d),v="set"+(this.$u?"UTC":""),T=(m={},m[i]=v+"Date",m[_]=v+"Date",m[y]=v+"Month",m[A]=v+"FullYear",m[u]=v+"Hours",m[l]=v+"Minutes",m[o]=v+"Seconds",m[h]=v+"Milliseconds",m)[S],O=S===i?this.$D+($-this.$W):$;if(S===y||S===A){var z=this.clone().set(_,1);z.$d[T](O),z.init(),this.$d=z.set(_,Math.min(this.$D,z.daysInMonth())).$d}else T&&this.$d[T](O);return this.init(),this},b.set=function(d,$){return this.clone().$set(d,$)},b.get=function(d){return this[N.p(d)]()},b.add=function(d,$){var m,S=this;d=Number(d);var v=N.p($),T=function(U){var R=M(S);return N.w(R.date(R.date()+Math.round(U*d)),S)};if(v===y)return this.set(y,this.$M+d);if(v===A)return this.set(A,this.$y+d);if(v===i)return T(1);if(v===f)return T(7);var O=(m={},m[l]=r,m[u]=s,m[o]=n,m)[v]||1,z=this.$d.getTime()+d*O;return N.w(z,this)},b.subtract=function(d,$){return this.add(-1*d,$)},b.format=function(d){var $=this,m=this.$locale();if(!this.isValid())return m.invalidDate||c;var S=d||"YYYY-MM-DDTHH:mm:ssZ",v=N.z(this),T=this.$H,O=this.$m,z=this.$M,U=m.weekdays,R=m.months,oe=m.meridiem,ne=function(j,Q,se,pe){return j&&(j[Q]||j($,S))||se[Q].slice(0,pe)},de=function(j){return N.s(T%12||12,j,"0")},re=oe||function(j,Q,se){var pe=j<12?"AM":"PM";return se?pe.toLowerCase():pe};return S.replace(g,(function(j,Q){return Q||(function(se){switch(se){case"YY":return String($.$y).slice(-2);case"YYYY":return N.s($.$y,4,"0");case"M":return z+1;case"MM":return N.s(z+1,2,"0");case"MMM":return ne(m.monthsShort,z,R,3);case"MMMM":return ne(R,z);case"D":return $.$D;case"DD":return N.s($.$D,2,"0");case"d":return String($.$W);case"dd":return ne(m.weekdaysMin,$.$W,U,2);case"ddd":return ne(m.weekdaysShort,$.$W,U,3);case"dddd":return U[$.$W];case"H":return String(T);case"HH":return N.s(T,2,"0");case"h":return de(1);case"hh":return de(2);case"a":return re(T,O,!0);case"A":return re(T,O,!1);case"m":return String(O);case"mm":return N.s(O,2,"0");case"s":return String($.$s);case"ss":return N.s($.$s,2,"0");case"SSS":return N.s($.$ms,3,"0");case"Z":return v}return null})(j)||v.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(d,$,m){var S,v=this,T=N.p($),O=M(d),z=(O.utcOffset()-this.utcOffset())*r,U=this-O,R=function(){return N.m(v,O)};switch(T){case A:S=R()/12;break;case y:S=R();break;case D:S=R()/3;break;case f:S=(U-z)/6048e5;break;case i:S=(U-z)/864e5;break;case u:S=U/s;break;case l:S=U/r;break;case o:S=U/n;break;default:S=U}return m?S:N.a(S)},b.daysInMonth=function(){return this.endOf(y).$D},b.$locale=function(){return Z[this.$L]},b.locale=function(d,$){if(!d)return this.$L;var m=this.clone(),S=te(d,$,!0);return S&&(m.$L=S),m},b.clone=function(){return N.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},C})(),be=ce.prototype;return M.prototype=be,[["$ms",h],["$s",o],["$m",l],["$H",u],["$W",i],["$M",y],["$y",A],["$D",_]].forEach((function(C){be[C[1]]=function(b){return this.$g(b,C[0],C[1])}})),M.extend=function(C,b){return C.$i||(C(b,ce,M),C.$i=!0),M},M.locale=te,M.isDayjs=q,M.unix=function(C){return M(1e3*C)},M.en=Z[W],M.Ls=Z,M.p={},M}))})($e)),$e.exports}var yo=go();const Ee=bo(yo),$o=t.defineComponent({name:"EliEntradaDataHora",inheritAttrs:!1,props:{value:{type:String,default:void 0},opcoes:{type:Object,required:!1,default:void 0},modelValue:{type:String,default:null},modo:{type:String,default:void 0},rotulo:{type:String,default:void 0},placeholder:{type:String,default:void 0},desabilitado:{type:Boolean,default:void 0},limpavel:{type:Boolean,default:void 0},erro:{type:Boolean,default:void 0},mensagensErro:{type:[String,Array],default:void 0},dica:{type:String,default:void 0},dicaPersistente:{type:Boolean,default:void 0},densidade:{type:String,default:void 0},variante:{type:String,default:void 0},min:{type:String,default:void 0},max:{type:String,default:void 0}},emits:{"update:value":e=>!0,input:e=>!0,change:e=>!0,"update:modelValue":e=>!0,alterar:e=>!0,foco:()=>!0,desfoco:()=>!0,focus:()=>!0,blur:()=>!0},setup(e,{emit:a,attrs:n}){const r=t.computed(()=>e.opcoes?e.opcoes:{rotulo:e.rotulo??"Data e hora",placeholder:e.placeholder??"",modo:e.modo??"dataHora",limpavel:e.limpavel,erro:e.erro,mensagensErro:e.mensagensErro,dica:e.dica,dicaPersistente:e.dicaPersistente,densidade:e.densidade,variante:e.variante,min:e.min,max:e.max}),s=t.computed(()=>r.value.modo??"dataHora"),h=t.computed(()=>!!e.desabilitado),o=t.computed(()=>s.value==="data"?"date":"datetime-local");function l(c){return s.value==="data"?Ee(c).format("YYYY-MM-DD"):Ee(c).format("YYYY-MM-DDTHH:mm")}function u(c){return s.value==="data"?Ee(`${c}T00:00`).format():Ee(c).format()}const i=t.computed(()=>e.value!==void 0?e.value??null:e.modelValue),f=t.computed({get:()=>i.value?l(i.value):"",set:c=>{const E=c&&c.length>0?c:null;if(!E){a("update:value",null),a("input",null),a("change",null),a("update:modelValue",null),a("alterar",null);return}const g=u(E);a("update:value",g),a("input",g),a("change",g),a("update:modelValue",g),a("alterar",g)}}),y=t.computed(()=>{const c=r.value.min;if(c)return l(c)}),D=t.computed(()=>{const c=r.value.max;if(c)return l(c)});function A(){a("foco"),a("focus")}function _(){a("desfoco"),a("blur")}return{attrs:n,valor:f,tipoInput:o,minLocal:y,maxLocal:D,opcoesEfetivas:r,desabilitadoEfetivo:h,emitCompatFocus:A,emitCompatBlur:_}}}),Eo={class:"eli-data-hora"};function ko(e,a,n,r,s,h){return t.openBlock(),t.createElementBlock("div",Eo,[t.createVNode(_e.VTextField,t.mergeProps({modelValue:e.valor,"onUpdate:modelValue":a[0]||(a[0]=o=>e.valor=o),type:e.tipoInput,label:e.opcoesEfetivas.rotulo,placeholder:e.opcoesEfetivas.placeholder,disabled:e.desabilitadoEfetivo,clearable:!!e.opcoesEfetivas.limpavel,error:!!e.opcoesEfetivas.erro,"error-messages":e.opcoesEfetivas.mensagensErro,hint:e.opcoesEfetivas.dica,"persistent-hint":!!e.opcoesEfetivas.dicaPersistente,density:e.opcoesEfetivas.densidade??"comfortable",variant:e.opcoesEfetivas.variante??"outlined",min:e.minLocal,max:e.maxLocal},e.attrs,{onFocus:e.emitCompatFocus,onBlur:e.emitCompatBlur}),null,16,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","min","max","onFocus","onBlur"])])}const Se=F($o,[["render",ko],["__scopeId","data-v-1bfd1be8"]]);function _o(e){return e==="texto"||e==="numero"||e==="dataHora"}function Bo(e){var n,r;const a=(r=(n=e==null?void 0:e.entrada)==null?void 0:n[1])==null?void 0:r.rotulo;return String(a||((e==null?void 0:e.coluna)??"Filtro"))}const Co=t.defineComponent({name:"EliTabelaModalFiltroAvancado",props:{aberto:{type:Boolean,required:!0},filtrosBase:{type:Array,required:!0},modelo:{type:Array,required:!0}},emits:{fechar:()=>!0,limpar:()=>!0,salvar:e=>!0},setup(e,{emit:a}){const n=t.ref([]),r=t.ref(""),s=t.computed(()=>(e.filtrosBase??[]).map(c=>String(c.coluna))),h=t.computed(()=>{const c=new Set(n.value.map(E=>String(E.coluna)));return(e.filtrosBase??[]).filter(E=>!c.has(String(E.coluna)))});function o(c){const E=c==null?void 0:c[0];return E==="numero"?ve:E==="dataHora"?Se:ye}function l(c){return(c==null?void 0:c[1])??{rotulo:""}}function u(c){return(c==null?void 0:c[0])==="numero"?null:""}function i(){var g;const c=e.filtrosBase??[],E=Array.isArray(e.modelo)?e.modelo:[];n.value=E.map(k=>{const H=c.find(q=>String(q.coluna)===String(k.coluna))??c[0],ie=(H==null?void 0:H.entrada)??k.entrada,W=(H==null?void 0:H.coluna)??k.coluna,Z=String((H==null?void 0:H.operador)??"="),ee=k.valor??u(ie);return{coluna:W,operador:Z,entrada:ie,valor:ee}});for(const k of n.value)s.value.includes(String(k.coluna))&&(k.operador=String(((g=c.find(H=>String(H.coluna)===String(k.coluna)))==null?void 0:g.operador)??"="),k.entrada&&!_o(k.entrada[0])&&(k.entrada=["texto",{rotulo:"Valor"}]))}t.watch(()=>[e.aberto,e.filtrosBase,e.modelo],()=>{e.aberto&&i()},{deep:!0,immediate:!0});function f(){if(!r.value)return;const c=(e.filtrosBase??[]).find(E=>String(E.coluna)===String(r.value));c&&(n.value.some(E=>String(E.coluna)===String(c.coluna))||(n.value.push({coluna:c.coluna,entrada:c.entrada,operador:String(c.operador??"="),valor:u(c.entrada)}),r.value=""))}function y(c){n.value.splice(c,1)}function D(){a("fechar")}function A(){a("limpar")}function _(){a("salvar",n.value.map(c=>({coluna:c.coluna,valor:c.valor})))}return{linhas:n,opcoesParaAdicionar:h,colunaParaAdicionar:r,componenteEntrada:o,opcoesEntrada:l,adicionar:f,remover:y,emitFechar:D,emitSalvar:_,emitLimpar:A,rotuloDoFiltro:Bo}}}),vo={class:"eli-tabela-modal-filtro__modal",role:"dialog","aria-modal":"true","aria-label":"Filtro avançado"},So={class:"eli-tabela-modal-filtro__header"},Vo={class:"eli-tabela-modal-filtro__conteudo"},No={key:0,class:"eli-tabela-modal-filtro__vazio"},Ao={key:1,class:"eli-tabela-modal-filtro__lista"},Do={class:"eli-tabela-modal-filtro__entrada"},wo=["onClick"],Mo={class:"eli-tabela-modal-filtro__acoes"},To=["disabled"],Po=["value"],Fo=["disabled"],Oo={class:"eli-tabela-modal-filtro__footer"};function Io(e,a,n,r,s,h){return e.aberto?(t.openBlock(),t.createElementBlock("div",{key:0,class:"eli-tabela-modal-filtro__overlay",role:"presentation",onClick:a[6]||(a[6]=t.withModifiers((...o)=>e.emitFechar&&e.emitFechar(...o),["self"]))},[t.createElementVNode("div",vo,[t.createElementVNode("header",So,[a[7]||(a[7]=t.createElementVNode("h3",{class:"eli-tabela-modal-filtro__titulo"},"Filtro avançado",-1)),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__fechar","aria-label":"Fechar",onClick:a[0]||(a[0]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," × ")]),t.createElementVNode("div",Vo,[e.filtrosBase.length?(t.openBlock(),t.createElementBlock("div",Ao,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(o,l)=>(t.openBlock(),t.createElementBlock("div",{key:String(o.coluna),class:"eli-tabela-modal-filtro__linha"},[t.createElementVNode("div",Do,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.componenteEntrada(o.entrada)),{value:o.valor,"onUpdate:value":u=>o.valor=u,opcoes:e.opcoesEntrada(o.entrada),density:"compact"},null,40,["value","onUpdate:value","opcoes"]))]),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__remover",title:"Remover","aria-label":"Remover",onClick:u=>e.remover(l)}," × ",8,wo)]))),128))])):(t.openBlock(),t.createElementBlock("div",No," Nenhum filtro configurado na tabela. ")),t.createElementVNode("div",Mo,[t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":a[1]||(a[1]=o=>e.colunaParaAdicionar=o),class:"eli-tabela-modal-filtro__select",disabled:!e.opcoesParaAdicionar.length},[a[8]||(a[8]=t.createElementVNode("option",{disabled:"",value:""},"Selecione um filtro…",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.opcoesParaAdicionar,o=>(t.openBlock(),t.createElementBlock("option",{key:String(o.coluna),value:String(o.coluna)},t.toDisplayString(e.rotuloDoFiltro(o)),9,Po))),128))],8,To),[[t.vModelSelect,e.colunaParaAdicionar]]),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao",onClick:a[2]||(a[2]=(...o)=>e.adicionar&&e.adicionar(...o)),disabled:!e.colunaParaAdicionar}," Adicionar ",8,Fo)])]),t.createElementVNode("footer",Oo,[t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",onClick:a[3]||(a[3]=(...o)=>e.emitLimpar&&e.emitLimpar(...o))}," Limpar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--sec",onClick:a[4]||(a[4]=(...o)=>e.emitFechar&&e.emitFechar(...o))}," Cancelar "),t.createElementVNode("button",{type:"button",class:"eli-tabela-modal-filtro__botao eli-tabela-modal-filtro__botao--prim",onClick:a[5]||(a[5]=(...o)=>e.emitSalvar&&e.emitSalvar(...o))}," Aplicar ")])])])):t.createCommentVNode("",!0)}const qo=F(Co,[["render",Io],["__scopeId","data-v-ae32fe4c"]]),Lo="eli:tabela";function He(e){return`${Lo}:${e}:colunas`}function Ue(e){if(!e||typeof e!="object")return{visiveis:[],invisiveis:[]};const a=e,n=Array.isArray(a.visiveis)?a.visiveis.filter(s=>typeof s=="string"):[],r=Array.isArray(a.invisiveis)?a.invisiveis.filter(s=>typeof s=="string"):[];return{visiveis:n,invisiveis:r}}function Ye(e){try{const a=window.localStorage.getItem(He(e));return a?Ue(JSON.parse(a)):{visiveis:[],invisiveis:[]}}catch{return{visiveis:[],invisiveis:[]}}}function zo(e,a){try{window.localStorage.setItem(He(e),JSON.stringify(Ue(a)))}catch{}}function Ve(e){return`eli_tabela:${e}:filtro_avancado`}function Re(e){try{const a=localStorage.getItem(Ve(e));if(!a)return[];const n=JSON.parse(a);return Array.isArray(n)?n:[]}catch{return[]}}function jo(e,a){try{localStorage.setItem(Ve(e),JSON.stringify(a??[]))}catch{}}function Ho(e){try{localStorage.removeItem(Ve(e))}catch{}}const Uo=t.defineComponent({name:"EliTabela",inheritAttrs:!1,components:{EliTabelaCabecalho:Ot,EliTabelaEstados:Ut,EliTabelaDebug:Wt,EliTabelaHead:oa,EliTabelaBody:wa,EliTabelaMenuAcoes:Ia,EliTabelaPaginacao:Ra,EliTabelaModalColunas:no,EliTabelaModalFiltroAvancado:qo},props:{tabela:{type:Object,required:!0}},setup(e){const n=t.ref(!1),r=t.ref(null),s=t.ref([]),h=t.ref(0),o=t.ref([]),l=t.ref(null),u=t.ref(null),i=t.ref({top:0,left:0}),f=t.ref(""),y=t.ref(1),D=t.ref(null),A=t.ref("asc"),_=t.ref(!1),c=t.ref(Re(e.tabela.nome));function E(){_.value=!0}function g(){_.value=!1}function k(){c.value=[],Ho(e.tabela.nome),_.value=!1,y.value!==1&&(y.value=1)}function H(p){c.value=p??[],jo(e.tabela.nome,p??[]),_.value=!1,y.value!==1&&(y.value=1)}const ie=t.computed(()=>{const p=e.tabela.filtroAvancado??[];return(c.value??[]).filter(B=>B&&B.coluna!==void 0).map(B=>{const V=p.find(w=>String(w.coluna)===String(B.coluna));return V?{coluna:String(V.coluna),operador:V.operador,valor:B.valor}:null}).filter(Boolean)}),W=t.computed(()=>e.tabela),Z=t.computed(()=>!!e.tabela.mostrarCaixaDeBusca),ee=t.computed(()=>e.tabela.acoesTabela??[]),q=t.computed(()=>ee.value.length>0),te=t.ref(!1),M=t.ref(Ye(e.tabela.nome)),N=t.ref({}),ce=t.computed(()=>e.tabela.colunas.map(p=>p.rotulo)),be=t.computed(()=>{var X,K;const p=e.tabela.colunas,V=(((X=M.value.visiveis)==null?void 0:X.length)??0)>0||(((K=M.value.invisiveis)==null?void 0:K.length)??0)>0?M.value.invisiveis??[]:p.filter(P=>P.visivel===!1).map(P=>P.rotulo),w=new Set(V),Y=p.filter(P=>w.has(P.rotulo)),J=V,x=new Map;for(const P of Y)x.has(P.rotulo)||x.set(P.rotulo,P);const G=[];for(const P of J){const ae=x.get(P);ae&&G.push(ae)}for(const P of Y)G.includes(P)||G.push(P);return G}),C=t.computed(()=>be.value.length>0),b=t.computed(()=>{var P,ae;const p=e.tabela.colunas,B=ce.value,V=(((P=M.value.visiveis)==null?void 0:P.length)??0)>0||(((ae=M.value.invisiveis)==null?void 0:ae.length)??0)>0,w=V?M.value.invisiveis??[]:e.tabela.colunas.filter(I=>I.visivel===!1).map(I=>I.rotulo),Y=new Set(w),J=B.filter(I=>!Y.has(I)),x=new Set(J),G=V?M.value.visiveis??[]:[],X=[];for(const I of G)x.has(I)&&X.push(I);for(const I of J)X.includes(I)||X.push(I);const K=new Map;for(const I of p)K.has(I.rotulo)||K.set(I.rotulo,I);return X.map(I=>K.get(I)).filter(Boolean)});function d(){te.value=!0}function $(){te.value=!1}function m(p){M.value=p,zo(e.tabela.nome,p),te.value=!1,N.value={}}function S(p){const B=!!N.value[p];N.value={...N.value,[p]:!B}}const v=t.computed(()=>{const p=e.tabela.registros_por_consulta;return typeof p=="number"&&p>0?Math.floor(p):10});function T(p){const B=(f.value??"").trim().toLowerCase();return B?p.filter(V=>JSON.stringify(V).toLowerCase().includes(B)):p}function O(p,B,V){switch(p){case"=":return B==V;case"!=":return B!=V;case">":return Number(B)>Number(V);case">=":return Number(B)>=Number(V);case"<":return Number(B)<Number(V);case"<=":return Number(B)<=Number(V);case"like":{const w=String(B??"").toLowerCase(),Y=String(V??"").toLowerCase();return w.includes(Y)}case"in":return(Array.isArray(V)?V:String(V??"").split(",").map(Y=>Y.trim()).filter(Boolean)).includes(String(B));case"isNull":return B==null||B==="";default:return!0}}function z(p){const B=ie.value;return B.length?p.filter(V=>B.every(w=>{const Y=V==null?void 0:V[w.coluna];return O(String(w.operador),Y,w.valor)})):p}const U=t.computed(()=>{const p=s.value??[];return z(T(p))}),R=t.computed(()=>U.value.length),oe=t.computed(()=>{const p=v.value;if(!p||p<=0)return 1;const B=R.value;return B?Math.max(1,Math.ceil(B/p)):1}),ne=t.computed(()=>{const p=Math.max(1,v.value),B=(y.value-1)*p;return U.value.slice(B,B+p)}),de=t.computed(()=>(e.tabela.acoesLinha??[]).length>0),re=t.computed(()=>(e.tabela.filtroAvancado??[]).length>0);let j=0;function Q(p){var G,X,K,P,ae,I;const B=p.getBoundingClientRect(),V=8,w=((K=(X=(G=u.value)==null?void 0:G.menuEl)==null?void 0:X.value)==null?void 0:K.offsetHeight)??0,Y=((I=(ae=(P=u.value)==null?void 0:P.menuEl)==null?void 0:ae.value)==null?void 0:I.offsetWidth)??180;let J=B.bottom+V;const x=B.right-Y;w&&J+w>window.innerHeight-V&&(J=B.top-V-w),i.value={top:Math.max(V,Math.round(J)),left:Math.max(V,Math.round(x))}}function se(p){var V,w;if(l.value===null)return;const B=p.target;(w=(V=u.value)==null?void 0:V.menuEl)!=null&&w.value&&u.value.menuEl.value.contains(B)||(l.value=null)}function pe(p){if(p){if(D.value===p){A.value=A.value==="asc"?"desc":"asc",ue();return}D.value=p,A.value="asc",y.value!==1?y.value=1:ue()}}function Zo(p){f.value!==p&&(f.value=p,y.value!==1?y.value=1:ue())}function Go(p){const B=Math.min(Math.max(1,p),oe.value);B!==y.value&&(y.value=B)}function We(p){const B=e.tabela.acoesLinha??[],V=o.value[p]??[];return B.map((w,Y)=>{const J=w.exibir===void 0?!0:typeof w.exibir=="boolean"?w.exibir:!1;return{acao:w,indice:Y,visivel:V[Y]??J}}).filter(w=>w.visivel)}function Ze(p){return We(p).length>0}function Xo(p,B){if(!Ze(p))return;if(l.value===p){l.value=null;return}l.value=p;const V=(B==null?void 0:B.currentTarget)??null;V&&(Q(V),requestAnimationFrame(()=>Q(V)))}async function ue(){var Y;const p=++j;n.value=!0,r.value=null,o.value=[],l.value=null,N.value={};const B=Math.max(1,v.value),w={offSet:0,limit:999999};D.value&&(w.coluna_ordem=D.value,w.direcao_ordem=A.value);try{const J=e.tabela,x=await J.consulta(w);if(p!==j)return;if(x.cod!==we.sucesso){s.value=[],h.value=0,r.value=x.mensagem;return}const G=((Y=x.valor)==null?void 0:Y.valores)??[],X=G.length;s.value=G,h.value=X;const K=Math.max(1,Math.ceil((R.value||0)/B));if(y.value>K){y.value=K;return}const P=J.acoesLinha??[];if(!P.length){o.value=[];return}const ae=G.map(()=>P.map(he=>he.exibir===void 0?!0:typeof he.exibir=="boolean"?he.exibir:!1));o.value=ae;const I=await Promise.all(G.map(async he=>Promise.all(P.map(async ke=>{if(ke.exibir===void 0)return!0;if(typeof ke.exibir=="boolean")return ke.exibir;try{const Ko=ke.exibir(he);return!!await Promise.resolve(Ko)}catch{return!1}}))));p===j&&(o.value=I)}catch(J){if(p!==j)return;s.value=[],h.value=0,r.value=J instanceof Error?J.message:"Erro ao carregar dados."}finally{p===j&&(n.value=!1)}}return t.onMounted(()=>{document.addEventListener("click",se),ue()}),t.onBeforeUnmount(()=>{document.removeEventListener("click",se)}),t.watch(()=>e.tabela.mostrarCaixaDeBusca,p=>{!p&&f.value&&(f.value="",y.value!==1?y.value=1:ue())}),t.watch(y,(p,B)=>{}),t.watch(()=>e.tabela,()=>{l.value=null,D.value=null,A.value="asc",f.value="",te.value=!1,_.value=!1,M.value=Ye(e.tabela.nome),c.value=Re(e.tabela.nome),N.value={},y.value!==1?y.value=1:ue()}),t.watch(()=>e.tabela.registros_por_consulta,()=>{y.value!==1?y.value=1:ue()}),t.watch(s,()=>{l.value=null,N.value={}}),{isDev:!1,tabela:W,carregando:n,erro:r,linhas:s,linhasPaginadas:ne,quantidadeFiltrada:R,quantidade:h,menuAberto:l,valorBusca:f,paginaAtual:y,colunaOrdenacao:D,direcaoOrdenacao:A,totalPaginas:oe,exibirBusca:Z,exibirFiltroAvancado:re,acoesCabecalho:ee,temAcoesCabecalho:q,temAcoes:de,colunasEfetivas:b,rotulosColunas:ce,modalColunasAberto:te,configColunas:M,temColunasInvisiveis:C,colunasInvisiveisEfetivas:be,linhasExpandidas:N,abrirModalColunas:d,abrirModalFiltro:E,fecharModalColunas:$,salvarModalColunas:m,modalFiltroAberto:_,filtrosUi:c,salvarFiltrosAvancados:H,limparFiltrosAvancados:k,fecharModalFiltro:g,alternarLinhaExpandida:S,alternarOrdenacao:pe,atualizarBusca:Zo,irParaPagina:Go,acoesDisponiveisPorLinha:We,possuiAcoes:Ze,toggleMenu:Xo,menuPopup:u,menuPopupPos:i}}}),Yo={class:"eli-tabela"},Ro={class:"eli-tabela__table"};function Jo(e,a,n,r,s,h){const o=t.resolveComponent("EliTabelaDebug"),l=t.resolveComponent("EliTabelaEstados"),u=t.resolveComponent("EliTabelaCabecalho"),i=t.resolveComponent("EliTabelaModalColunas"),f=t.resolveComponent("EliTabelaModalFiltroAvancado"),y=t.resolveComponent("EliTabelaHead"),D=t.resolveComponent("EliTabelaBody"),A=t.resolveComponent("EliTabelaMenuAcoes"),_=t.resolveComponent("EliTabelaPaginacao");return t.openBlock(),t.createElementBlock("div",Yo,[t.createVNode(o,{isDev:e.isDev,menuAberto:e.menuAberto,menuPopupPos:e.menuPopupPos},null,8,["isDev","menuAberto","menuPopupPos"]),e.carregando||e.erro||!e.linhas.length?(t.openBlock(),t.createBlock(l,{key:0,carregando:e.carregando,erro:e.erro,mensagemVazio:e.tabela.mensagemVazio},null,8,["carregando","erro","mensagemVazio"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[e.exibirBusca||e.temAcoesCabecalho?(t.openBlock(),t.createBlock(u,{key:0,exibirBusca:e.exibirBusca,exibirBotaoFiltroAvancado:e.exibirFiltroAvancado,valorBusca:e.valorBusca,acoesCabecalho:e.acoesCabecalho,onBuscar:e.atualizarBusca,onColunas:e.abrirModalColunas,onFiltroAvancado:e.abrirModalFiltro},null,8,["exibirBusca","exibirBotaoFiltroAvancado","valorBusca","acoesCabecalho","onBuscar","onColunas","onFiltroAvancado"])):t.createCommentVNode("",!0),t.createVNode(i,{aberto:e.modalColunasAberto,rotulosColunas:e.rotulosColunas,configInicial:e.configColunas,colunas:e.tabela.colunas,onFechar:e.fecharModalColunas,onSalvar:e.salvarModalColunas},null,8,["aberto","rotulosColunas","configInicial","colunas","onFechar","onSalvar"]),t.createVNode(f,{aberto:e.modalFiltroAberto,filtrosBase:e.tabela.filtroAvancado??[],modelo:e.filtrosUi,onFechar:e.fecharModalFiltro,onLimpar:e.limparFiltrosAvancados,onSalvar:e.salvarFiltrosAvancados},null,8,["aberto","filtrosBase","modelo","onFechar","onLimpar","onSalvar"]),t.createElementVNode("table",Ro,[t.createVNode(y,{colunas:e.colunasEfetivas,temAcoes:e.temAcoes,temColunasInvisiveis:e.temColunasInvisiveis,colunaOrdenacao:e.colunaOrdenacao,direcaoOrdenacao:e.direcaoOrdenacao,onAlternarOrdenacao:e.alternarOrdenacao},null,8,["colunas","temAcoes","temColunasInvisiveis","colunaOrdenacao","direcaoOrdenacao","onAlternarOrdenacao"]),t.createVNode(D,{colunas:e.colunasEfetivas,colunasInvisiveis:e.colunasInvisiveisEfetivas,temColunasInvisiveis:e.temColunasInvisiveis,linhasExpandidas:e.linhasExpandidas,linhas:e.linhasPaginadas,temAcoes:e.temAcoes,menuAberto:e.menuAberto,possuiAcoes:e.possuiAcoes,toggleMenu:e.toggleMenu,alternarLinhaExpandida:e.alternarLinhaExpandida},null,8,["colunas","colunasInvisiveis","temColunasInvisiveis","linhasExpandidas","linhas","temAcoes","menuAberto","possuiAcoes","toggleMenu","alternarLinhaExpandida"])]),t.createVNode(A,{ref:"menuPopup",menuAberto:e.menuAberto,posicao:e.menuPopupPos,acoes:e.menuAberto===null?[]:e.acoesDisponiveisPorLinha(e.menuAberto),linha:e.menuAberto===null?null:e.linhasPaginadas[e.menuAberto],onExecutar:a[0]||(a[0]=({acao:c,linha:E})=>{e.menuAberto=null,c.acao(E)})},null,8,["menuAberto","posicao","acoes","linha"]),e.totalPaginas>1&&e.quantidadeFiltrada>0?(t.openBlock(),t.createBlock(_,{key:1,pagina:e.paginaAtual,totalPaginas:e.totalPaginas,maximoBotoes:e.tabela.maximo_botoes_paginacao,onAlterar:e.irParaPagina},null,8,["pagina","totalPaginas","maximoBotoes","onAlterar"])):t.createCommentVNode("",!0)],64))])}const Je=F(Uo,[["render",Jo]]),Wo={install(e){e.component("EliOlaMundo",Ae),e.component("EliBotao",Be),e.component("EliBadge",ge),e.component("EliCartao",De),e.component("EliTabela",Je),e.component("EliEntradaTexto",ye),e.component("EliEntradaNumero",ve),e.component("EliEntradaDataHora",Se)}};L.EliBadge=ge,L.EliBotao=Be,L.EliCartao=De,L.EliEntradaDataHora=Se,L.EliEntradaNumero=ve,L.EliEntradaTexto=ye,L.EliOlaMundo=Ae,L.EliTabela=Je,L.default=Wo,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));