66 lines
49 KiB
JavaScript
66 lines
49 KiB
JavaScript
(function(w,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vuetify/components/VBtn"),require("vuetify/components/VBadge"),require("vuetify/components/VCheckbox"),require("vuetify/components/VIcon"),require("vuetify/components/VRadio"),require("vuetify/components/VRadioGroup"),require("vuetify/components/VSelect"),require("vuetify/components/VTextField"),require("vuetify/components/VTextarea"),require("vuetify/components/VCard"),require("vuetify/components/VGrid")):typeof define=="function"&&define.amd?define(["exports","vue","vuetify/components/VBtn","vuetify/components/VBadge","vuetify/components/VCheckbox","vuetify/components/VIcon","vuetify/components/VRadio","vuetify/components/VRadioGroup","vuetify/components/VSelect","vuetify/components/VTextField","vuetify/components/VTextarea","vuetify/components/VCard","vuetify/components/VGrid"],t):(w=typeof globalThis<"u"?globalThis:w||self,t(w.eli_vue={},w.Vue,w.VBtn,w.VBadge,w.VCheckbox,w.VIcon,w.VRadio,w.VRadioGroup,w.VSelect,w.VTextField,w.VTextarea,w.VCard,w.VGrid))})(this,(function(w,t,Be,Ve,Ce,Ee,Se,we,Ae,se,Me,Y,_e){"use strict";const De=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}}}),N=(e,a)=>{const c=e.__vccOpts||e;for(const[u,m]of a)c[u]=m;return c};function Te(e,a,c,u,m,p){return t.openBlock(),t.createBlock(Be.VBtn,t.mergeProps({color:e.color,variant:e.variant,size:e.size,disabled:e.disabled,loading:e.loading},e.$attrs,{class:"text-none pt-1"}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["color","variant","size","disabled","loading"])}const ne=N(De,[["render",Te]]),ce={suave:"4px",pill:"10px"},Ne=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 ce?ce[e.radius]:e.radius),c=t.computed(()=>e.dot||e.badge!==void 0?e.visible:!1),u=t.computed(()=>({"--eli-badge-radius":a.value}));return{showBadge:c,badgeStyle:u}}});function Pe(e,a,c,u,m,p){return e.showBadge?(t.openBlock(),t.createBlock(Ve.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}),{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 Q=N(Ne,[["render",Pe],["__scopeId","data-v-de2fbf2f"]]);function Oe(e){return e.replace(/\D+/g,"")}function qe(e){const a=Oe(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 Ie(e){return e.replace(/\D+/g,"")}function ze(e){const a=Ie(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 re(e){return e.replace(/\D+/g,"")}function de(e){const a=e.replace(/[^\d,]/g,""),c=a.split(",");return c.length>2?c[0]+","+c.slice(1).join(""):a}function Le(e){return de(e.replace(/%/g,""))}function Ue(e){const a=re(e);return a?(parseInt(a,10)/100).toFixed(2).replace(".",",").replace(/\B(?=(\d{3})+(?!\d))/g,"."):""}function je(e){const a=re(e).slice(0,8);return a.length<=5?a:a.replace(/^(\d{5})(\d{1,3})$/,"$1-$2")}const Fe=t.defineComponent({name:"EliInput",inheritAttrs:!1,props:{modelValue:{type:[String,Number,Boolean,Array],default:""},type:{type:String,default:"text"},label:String,placeholder:String,disabled:Boolean,error:Boolean,errorMessages:{type:[String,Array],default:()=>[]},hint:String,persistentHint:Boolean,rows:{type:Number,default:4},options:{type:Array,default:()=>[]},clearable:Boolean,variant:{type:String,default:"outlined"},density:{type:String,default:"comfortable"},color:{type:String,default:"primary"},row:Boolean,showPasswordToggle:Boolean,multiple:Boolean,chips:Boolean},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:a,attrs:c}){const u=t.ref(!1),m=t.ref(!1),p=t.computed({get:()=>e.modelValue,set:k=>{a("update:modelValue",k),a("change",k)}}),o=t.computed(()=>["text","password","email","search","url","telefone","cpfCnpj","numericoInteiro","numericoDecimal","numericoMoeda","porcentagem","cep"].includes(e.type)),s=t.computed(()=>e.type==="password"?m.value?"text":"password":"text"),y=t.computed(()=>{if(e.type==="telefone")return"tel";if(e.type==="porcentagem")return"decimal";if(e.type.startsWith("numerico"))return"numeric"}),l=t.computed(()=>e.error?"error":u.value?e.color:void 0);function g(k){const _=k.target;let C=_.value;switch(e.type){case"numericoInteiro":C=re(C);break;case"numericoDecimal":C=de(C);break;case"numericoMoeda":C=Ue(C);break;case"porcentagem":C=Le(C);break;case"telefone":C=ze(C);break;case"cpfCnpj":C=qe(C);break;case"cep":C=je(C);break}_.value=C,a("update:modelValue",C),a("change",C)}function $(){m.value=!m.value}const M=t.computed(()=>(e.options||[]).map(k=>{if(k&&typeof k=="object"&&"value"in k){const C=k.value;return{label:k.label??String(C),value:C,disabled:k.disabled}}const _=k;return{label:String(_),value:_}}));return{attrs:c,value:p,isTextLike:o,inputHtmlType:s,inputMode:y,internalColor:l,showPassword:m,togglePassword:$,onInput:g,onFocus:()=>a("focus"),onBlur:()=>a("blur"),computedItems:M}}}),He={class:"eli-input"},Ye={key:4,class:"checkbox-group"};function Re(e,a,c,u,m,p){return t.openBlock(),t.createElementBlock("div",He,[e.isTextLike?(t.openBlock(),t.createBlock(se.VTextField,t.mergeProps({key:0,modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=o=>e.value=o),type:e.inputHtmlType,label:e.label,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable&&e.type!=="password",error:e.error,"error-messages":e.errorMessages,hint:e.hint,"persistent-hint":e.persistentHint,density:e.density,variant:e.variant,color:e.internalColor,inputmode:e.inputMode,suffix:e.type==="porcentagem"?"%":void 0},e.attrs,{onFocus:e.onFocus,onBlur:e.onBlur,onInput:e.onInput}),t.createSlots({_:2},[e.type==="password"&&e.showPasswordToggle?{name:"append-inner",fn:t.withCtx(()=>[t.createVNode(Ee.VIcon,{class:"cursor-pointer",onClick:e.togglePassword},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.showPassword?"mdi-eye-off":"mdi-eye"),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1040,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","color","inputmode","suffix","onFocus","onBlur","onInput"])):e.type==="textarea"?(t.openBlock(),t.createBlock(Me.VTextarea,t.mergeProps({key:1,modelValue:e.value,"onUpdate:modelValue":a[1]||(a[1]=o=>e.value=o),label:e.label,rows:e.rows,density:e.density,variant:e.variant},e.attrs),null,16,["modelValue","label","rows","density","variant"])):e.type==="select"?(t.openBlock(),t.createBlock(Ae.VSelect,t.mergeProps({key:2,modelValue:e.value,"onUpdate:modelValue":a[2]||(a[2]=o=>e.value=o),items:e.computedItems,label:e.label,placeholder:e.placeholder,multiple:e.multiple,chips:e.chips,clearable:e.clearable,disabled:e.disabled,density:e.density,variant:e.variant,"item-title":"label","item-value":"value",error:e.error,"error-messages":e.errorMessages},e.attrs,{onFocus:e.onFocus,onBlur:e.onBlur}),null,16,["modelValue","items","label","placeholder","multiple","chips","clearable","disabled","density","variant","error","error-messages","onFocus","onBlur"])):e.type==="radio"?(t.openBlock(),t.createBlock(we.VRadioGroup,{key:3,modelValue:e.value,"onUpdate:modelValue":a[3]||(a[3]=o=>e.value=o),row:e.row},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.computedItems,o=>(t.openBlock(),t.createBlock(Se.VRadio,{key:String(o.value),label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","row"])):e.type==="checkbox"?(t.openBlock(),t.createElementBlock("div",Ye,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.computedItems,o=>(t.openBlock(),t.createBlock(Ce.VCheckbox,{key:String(o.value),modelValue:e.value,"onUpdate:modelValue":a[4]||(a[4]=s=>e.value=s),label:o.label,value:o.value,density:e.density},null,8,["modelValue","label","value","density"]))),128))])):t.createCommentVNode("",!0)])}const le=N(Fe,[["render",Re],["__scopeId","data-v-756cb549"]]),We=t.defineComponent({name:"EliOlaMundo",components:{EliBotao:ne,EliBadge:Q,EliInput:le},setup(){const e=t.ref(""),a=t.ref([]),c=t.ref(""),u=t.ref(""),m=t.ref(""),p=t.ref(""),o=t.ref(""),s=t.ref(""),y=t.ref(""),l=t.ref(""),g=t.ref(""),$=t.ref(null),M=t.ref([]);return{nome:e,email:s,documento:g,estado:a,telefone:u,mensagem:y,senha:l,cor:$,habilidades:M,idade:m,altura:p,cep:c,valor:o}}}),ve={class:"grid-example"};function Ge(e,a,c,u,m,p){const o=t.resolveComponent("EliBadge"),s=t.resolveComponent("EliInput"),y=t.resolveComponent("EliBotao");return t.openBlock(),t.createBlock(_e.VContainer,null,{default:t.withCtx(()=>[t.createVNode(Y.VCard,{class:"mx-auto",max_width:"400"},{default:t.withCtx(()=>[t.createVNode(Y.VCardTitle,null,{default:t.withCtx(()=>[t.createVNode(o,{badge:"Novo","offset-x":"-15",location:"right center"},{default:t.withCtx(()=>[...a[14]||(a[14]=[t.createTextVNode(" Olá Mundo! ",-1)])]),_:1})]),_:1}),t.createVNode(Y.VCardText,null,{default:t.withCtx(()=>[a[15]||(a[15]=t.createTextVNode(" Este é um componente de exemplo integrado com Vuetify. ",-1)),t.createElementVNode("div",ve,[t.createVNode(s,{modelValue:e.nome,"onUpdate:modelValue":a[0]||(a[0]=l=>e.nome=l),label:"Nome",placeholder:"Digite o nome",density:"compact"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.idade,"onUpdate:modelValue":a[1]||(a[1]=l=>e.idade=l),type:"numericoInteiro",label:"Idade",density:"default"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.altura,"onUpdate:modelValue":a[2]||(a[2]=l=>e.altura=l),type:"numericoDecimal",label:"Altura",density:"comfortable"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.valor,"onUpdate:modelValue":a[3]||(a[3]=l=>e.valor=l),type:"numericoMoeda",label:"Valor"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.telefone,"onUpdate:modelValue":a[4]||(a[4]=l=>e.telefone=l),type:"telefone",label:"Telefone"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.cep,"onUpdate:modelValue":a[5]||(a[5]=l=>e.cep=l),type:"cep",label:"CEP",placeholder:"00000-000"},null,8,["modelValue"]),t.createVNode(s,{type:"select",label:"Estado",options:[{label:"São Paulo",value:"SP"},{label:"Rio de Janeiro",value:"RJ"}],modelValue:e.estado,"onUpdate:modelValue":a[6]||(a[6]=l=>e.estado=l),multiple:""},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.documento,"onUpdate:modelValue":a[7]||(a[7]=l=>e.documento=l),type:"cpfCnpj",label:"CPF / CNPJ"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.email,"onUpdate:modelValue":a[8]||(a[8]=l=>e.email=l),label:"Email",placeholder:"email@exemplo.com"},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.senha,"onUpdate:modelValue":a[9]||(a[9]=l=>e.senha=l),label:"Senha",type:"password",showPasswordToggle:!0,placeholder:"Digite sua senha"},null,8,["modelValue"]),t.createVNode(s,{type:"textarea",modelValue:e.mensagem,"onUpdate:modelValue":a[10]||(a[10]=l=>e.mensagem=l),label:"Mensagem",rows:5},null,8,["modelValue"]),t.createVNode(s,{type:"radio",modelValue:e.cor,"onUpdate:modelValue":a[11]||(a[11]=l=>e.cor=l),label:"Cor favorita",options:[{label:"Azul",value:"azul"},{label:"Verde",value:"verde"}]},null,8,["modelValue"]),t.createVNode(s,{type:"checkbox",modelValue:e.habilidades,"onUpdate:modelValue":a[12]||(a[12]=l=>e.habilidades=l),options:[{label:"Vue",value:"vue"},{label:"React",value:"react"}]},null,8,["modelValue"]),t.createVNode(s,{modelValue:e.nome,"onUpdate:modelValue":a[13]||(a[13]=l=>e.nome=l),label:"Nome",error:!0,"error-messages":["Obrigatório"]},null,8,["modelValue"])])]),_:1}),t.createVNode(Y.VCardActions,null,{default:t.withCtx(()=>[t.createVNode(y,{color:"primary",variant:"elevated",block:""},{default:t.withCtx(()=>[...a[16]||(a[16]=[t.createTextVNode(" Botão Vuetify ",-1)])]),_:1})]),_:1})]),_:1})]),_:1})}const ue=N(We,[["render",Ge]]),Je=t.defineComponent({name:"EliCartao",components:{EliBadge:Q},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 c=t.computed(()=>e.status),u=t.computed(()=>{switch(e.status){case"novo":return"primary";case"rascunho":return"secondary";case"vendido":return"success";case"cancelado":return"error"}}),m=t.computed(()=>`eli-cartao--${e.status}`);function p(){a("clicar",e.status)}return{rotuloStatus:c,corStatus:u,classeStatus:m,onClick:p}}}),Ze={class:"eli-cartao__titulo-texto"},Xe={class:"eli-cartao__status"};function Ke(e,a,c,u,m,p){const o=t.resolveComponent("EliBadge");return t.openBlock(),t.createBlock(Y.VCard,t.mergeProps({class:["eli-cartao",e.classeStatus],variant:e.variant},e.$attrs),{default:t.withCtx(()=>[t.createVNode(Y.VCardTitle,{class:"eli-cartao__titulo"},{default:t.withCtx(()=>[t.createElementVNode("div",Ze,[t.renderSlot(e.$slots,"titulo",{},()=>[t.createTextVNode(t.toDisplayString(e.titulo),1)],!0)]),t.createElementVNode("div",Xe,[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(Y.VCardText,{class:"eli-cartao__conteudo"},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default",{},void 0,!0)]),_:3}),e.$slots.acoes?(t.openBlock(),t.createBlock(Y.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 me=N(Je,[["render",Ke],["__scopeId","data-v-6c492bd9"]]);function Qe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var x={exports:{}},xe=x.exports,pe;function et(){return pe||(pe=1,(function(e,a){(function(c,u){e.exports=u()})(xe,(function(){var c=1e3,u=6e4,m=36e5,p="millisecond",o="second",s="minute",y="hour",l="day",g="week",$="month",M="quarter",k="year",_="date",C="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,H=/\[([^\]]+)]|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,O={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(f){var n=["th","st","nd","rd"],r=f%100;return"["+f+(n[(r-20)%10]||n[r]||n[0])+"]"}},v=function(f,n,r){var d=String(f);return!d||d.length>=n?f:""+Array(n+1-d.length).join(r)+f},ie={s:v,z:function(f){var n=-f.utcOffset(),r=Math.abs(n),d=Math.floor(r/60),i=r%60;return(n<=0?"+":"-")+v(d,2,"0")+":"+v(i,2,"0")},m:function f(n,r){if(n.date()<r.date())return-f(r,n);var d=12*(r.year()-n.year())+(r.month()-n.month()),i=n.clone().add(d,$),h=r-i<0,b=n.clone().add(d+(h?-1:1),$);return+(-(d+(r-i)/(h?i-b:b-i))||0)},a:function(f){return f<0?Math.ceil(f)||0:Math.floor(f)},p:function(f){return{M:$,y:k,w:g,d:l,D:_,h:y,m:s,s:o,ms:p,Q:M}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},L="en",U={};U[L]=O;var Z="$isDayjsObject",X=function(f){return f instanceof R||!(!f||!f[Z])},G=function f(n,r,d){var i;if(!n)return L;if(typeof n=="string"){var h=n.toLowerCase();U[h]&&(i=h),r&&(U[h]=r,i=h);var b=n.split("-");if(!i&&b.length>1)return f(b[0])}else{var B=n.name;U[B]=n,i=B}return!d&&i&&(L=i),i||!d&&L},D=function(f,n){if(X(f))return f.clone();var r=typeof n=="object"?n:{};return r.date=f,r.args=arguments,new R(r)},V=ie;V.l=G,V.i=X,V.w=function(f,n){return D(f,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var R=(function(){function f(r){this.$L=G(r.locale,null,!0),this.parse(r),this.$x=this.$x||r.x||{},this[Z]=!0}var n=f.prototype;return n.parse=function(r){this.$d=(function(d){var i=d.date,h=d.utc;if(i===null)return new Date(NaN);if(V.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var b=i.match(F);if(b){var B=b[2]-1||0,E=(b[7]||"0").substring(0,3);return h?new Date(Date.UTC(b[1],B,b[3]||1,b[4]||0,b[5]||0,b[6]||0,E)):new Date(b[1],B,b[3]||1,b[4]||0,b[5]||0,b[6]||0,E)}}return new Date(i)})(r),this.init()},n.init=function(){var r=this.$d;this.$y=r.getFullYear(),this.$M=r.getMonth(),this.$D=r.getDate(),this.$W=r.getDay(),this.$H=r.getHours(),this.$m=r.getMinutes(),this.$s=r.getSeconds(),this.$ms=r.getMilliseconds()},n.$utils=function(){return V},n.isValid=function(){return this.$d.toString()!==C},n.isSame=function(r,d){var i=D(r);return this.startOf(d)<=i&&i<=this.endOf(d)},n.isAfter=function(r,d){return D(r)<this.startOf(d)},n.isBefore=function(r,d){return this.endOf(d)<D(r)},n.$g=function(r,d,i){return V.u(r)?this[d]:this.set(i,r)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(r,d){var i=this,h=!!V.u(d)||d,b=V.p(r),B=function(I,T){var j=V.w(i.$u?Date.UTC(i.$y,T,I):new Date(i.$y,T,I),i);return h?j:j.endOf(l)},E=function(I,T){return V.w(i.toDate()[I].apply(i.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(T)),i)},S=this.$W,A=this.$M,P=this.$D,q="set"+(this.$u?"UTC":"");switch(b){case k:return h?B(1,0):B(31,11);case $:return h?B(1,A):B(0,A+1);case g:var z=this.$locale().weekStart||0,W=(S<z?S+7:S)-z;return B(h?P-W:P+(6-W),A);case l:case _:return E(q+"Hours",0);case y:return E(q+"Minutes",1);case s:return E(q+"Seconds",2);case o:return E(q+"Milliseconds",3);default:return this.clone()}},n.endOf=function(r){return this.startOf(r,!1)},n.$set=function(r,d){var i,h=V.p(r),b="set"+(this.$u?"UTC":""),B=(i={},i[l]=b+"Date",i[_]=b+"Date",i[$]=b+"Month",i[k]=b+"FullYear",i[y]=b+"Hours",i[s]=b+"Minutes",i[o]=b+"Seconds",i[p]=b+"Milliseconds",i)[h],E=h===l?this.$D+(d-this.$W):d;if(h===$||h===k){var S=this.clone().set(_,1);S.$d[B](E),S.init(),this.$d=S.set(_,Math.min(this.$D,S.daysInMonth())).$d}else B&&this.$d[B](E);return this.init(),this},n.set=function(r,d){return this.clone().$set(r,d)},n.get=function(r){return this[V.p(r)]()},n.add=function(r,d){var i,h=this;r=Number(r);var b=V.p(d),B=function(A){var P=D(h);return V.w(P.date(P.date()+Math.round(A*r)),h)};if(b===$)return this.set($,this.$M+r);if(b===k)return this.set(k,this.$y+r);if(b===l)return B(1);if(b===g)return B(7);var E=(i={},i[s]=u,i[y]=m,i[o]=c,i)[b]||1,S=this.$d.getTime()+r*E;return V.w(S,this)},n.subtract=function(r,d){return this.add(-1*r,d)},n.format=function(r){var d=this,i=this.$locale();if(!this.isValid())return i.invalidDate||C;var h=r||"YYYY-MM-DDTHH:mm:ssZ",b=V.z(this),B=this.$H,E=this.$m,S=this.$M,A=i.weekdays,P=i.months,q=i.meridiem,z=function(T,j,K,oe){return T&&(T[j]||T(d,h))||K[j].slice(0,oe)},W=function(T){return V.s(B%12||12,T,"0")},I=q||function(T,j,K){var oe=T<12?"AM":"PM";return K?oe.toLowerCase():oe};return h.replace(H,(function(T,j){return j||(function(K){switch(K){case"YY":return String(d.$y).slice(-2);case"YYYY":return V.s(d.$y,4,"0");case"M":return S+1;case"MM":return V.s(S+1,2,"0");case"MMM":return z(i.monthsShort,S,P,3);case"MMMM":return z(P,S);case"D":return d.$D;case"DD":return V.s(d.$D,2,"0");case"d":return String(d.$W);case"dd":return z(i.weekdaysMin,d.$W,A,2);case"ddd":return z(i.weekdaysShort,d.$W,A,3);case"dddd":return A[d.$W];case"H":return String(B);case"HH":return V.s(B,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return I(B,E,!0);case"A":return I(B,E,!1);case"m":return String(E);case"mm":return V.s(E,2,"0");case"s":return String(d.$s);case"ss":return V.s(d.$s,2,"0");case"SSS":return V.s(d.$ms,3,"0");case"Z":return b}return null})(T)||b.replace(":","")}))},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(r,d,i){var h,b=this,B=V.p(d),E=D(r),S=(E.utcOffset()-this.utcOffset())*u,A=this-E,P=function(){return V.m(b,E)};switch(B){case k:h=P()/12;break;case $:h=P();break;case M:h=P()/3;break;case g:h=(A-S)/6048e5;break;case l:h=(A-S)/864e5;break;case y:h=A/m;break;case s:h=A/u;break;case o:h=A/c;break;default:h=A}return i?h:V.a(h)},n.daysInMonth=function(){return this.endOf($).$D},n.$locale=function(){return U[this.$L]},n.locale=function(r,d){if(!r)return this.$L;var i=this.clone(),h=G(r,d,!0);return h&&(i.$L=h),i},n.clone=function(){return V.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},f})(),ae=R.prototype;return D.prototype=ae,[["$ms",p],["$s",o],["$m",s],["$H",y],["$W",l],["$M",$],["$y",k],["$D",_]].forEach((function(f){ae[f[1]]=function(n){return this.$g(n,f[0],f[1])}})),D.extend=function(f,n){return f.$i||(f(n,R,D),f.$i=!0),D},D.locale=G,D.isDayjs=X,D.unix=function(f){return D(1e3*f)},D.en=U[L],D.Ls=U,D.p={},D}))})(x)),x.exports}var tt=et();const ee=Qe(tt),at=t.defineComponent({name:"EliDataHora",inheritAttrs:!1,props:{modelValue:{type:String,default:null},modo:{type:String,default:"dataHora"},rotulo:{type:String,default:"Data e hora"},placeholder:{type:String,default:""},desabilitado:{type:Boolean,default:!1},limpavel:{type:Boolean,default:!1},erro:{type:Boolean,default:!1},mensagensErro:{type:[String,Array],default:()=>[]},dica:{type:String,default:""},dicaPersistente:{type:Boolean,default:!1},densidade:{type:String,default:"comfortable"},variante:{type:String,default:"outlined"},min:{type:String,default:void 0},max:{type:String,default:void 0}},emits:{"update:modelValue":e=>!0,alterar:e=>!0,foco:()=>!0,desfoco:()=>!0},setup(e,{emit:a,attrs:c}){const u=t.computed(()=>e.modo==="data"?"date":"datetime-local");function m(l){return e.modo==="data"?ee(l).format("YYYY-MM-DD"):ee(l).format("YYYY-MM-DDTHH:mm")}function p(l){return e.modo==="data"?ee(`${l}T00:00`).format():ee(l).format()}const o=t.computed({get:()=>e.modelValue?m(e.modelValue):"",set:l=>{const g=l&&l.length>0?l:null;if(!g){a("update:modelValue",null),a("alterar",null);return}const $=p(g);a("update:modelValue",$),a("alterar",$)}}),s=t.computed(()=>{if(e.min)return m(e.min)}),y=t.computed(()=>{if(e.max)return m(e.max)});return{attrs:c,valor:o,emit:a,minLocal:s,maxLocal:y,tipoInput:u}}}),ot={class:"eli-data-hora"};function nt(e,a,c,u,m,p){return t.openBlock(),t.createElementBlock("div",ot,[t.createVNode(se.VTextField,t.mergeProps({modelValue:e.valor,"onUpdate:modelValue":a[0]||(a[0]=o=>e.valor=o),type:e.tipoInput,label:e.rotulo,placeholder:e.placeholder,disabled:e.desabilitado,clearable:e.limpavel,error:e.erro,"error-messages":e.mensagensErro,hint:e.dica,"persistent-hint":e.dicaPersistente,density:e.densidade,variant:e.variante,min:e.minLocal,max:e.maxLocal},e.attrs,{onFocus:a[1]||(a[1]=o=>e.emit("foco")),onBlur:a[2]||(a[2]=o=>e.emit("desfoco"))}),null,16,["modelValue","type","label","placeholder","disabled","clearable","error","error-messages","hint","persistent-hint","density","variant","min","max"])])}const fe=N(at,[["render",nt],["__scopeId","data-v-71afabb6"]]);var be=(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))(be||{});/**
|
|
* @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 rt=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 he=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 lt=(...e)=>e.filter((a,c,u)=>!!a&&a.trim()!==""&&u.indexOf(a)===c).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 ye=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 it=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,u)=>u?u.toUpperCase():c.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 st=e=>{const a=it(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 J={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 ct=({name:e,iconNode:a,absoluteStrokeWidth:c,"absolute-stroke-width":u,strokeWidth:m,"stroke-width":p,size:o=J.width,color:s=J.stroke,...y},{slots:l})=>t.h("svg",{...J,...y,width:o,height:o,stroke:s,"stroke-width":he(c)||he(u)||c===!0||u===!0?Number(m||p||J["stroke-width"])*24/Number(o):m||p||J["stroke-width"],class:lt("lucide",y.class,...e?[`lucide-${ye(st(e))}-icon`,`lucide-${ye(e)}`]:["lucide-icon"]),...!l.default&&!rt(y)&&{"aria-hidden":"true"}},[...a.map(g=>t.h(...g)),...l.default?[l.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 te=(e,a)=>(c,{slots:u,attrs:m})=>t.h(ct,{...m,...c,iconNode:a,name:e},u);/**
|
|
* @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 ge=te("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 $e=te("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 dt=te("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 ut=te("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),mt=t.defineComponent({name:"EliTabelaCaixaDeBusca",components:{Search:ut},props:{modelo:{type:String,required:!1,default:""}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const c=t.ref(e.modelo??"");t.watch(()=>e.modelo,m=>{m!==void 0&&m!==c.value&&(c.value=m)});function u(){a("buscar",c.value.trim())}return{texto:c,emitirBusca:u}}}),pt={class:"eli-tabela__busca"},ft={class:"eli-tabela__busca-input-wrapper"};function bt(e,a,c,u,m,p){const o=t.resolveComponent("Search");return t.openBlock(),t.createElementBlock("div",pt,[t.createElementVNode("div",ft,[t.withDirectives(t.createElementVNode("input",{id:"eli-tabela-busca","onUpdate:modelValue":a[0]||(a[0]=s=>e.texto=s),type:"search",class:"eli-tabela__busca-input",placeholder:"Digite termos para filtrar",onKeyup:a[1]||(a[1]=t.withKeys((...s)=>e.emitirBusca&&e.emitirBusca(...s),["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]=(...s)=>e.emitirBusca&&e.emitirBusca(...s))},[t.createVNode(o,{class:"eli-tabela__busca-botao-icone",size:16,"stroke-width":2,"aria-hidden":"true"})])])])}const ht=N(mt,[["render",bt],["__scopeId","data-v-0fd1ad15"]]),yt=t.defineComponent({name:"EliTabelaCabecalho",components:{EliTabelaCaixaDeBusca:ht},props:{exibirBusca:{type:Boolean,required:!0},valorBusca:{type:String,required:!0},acoesCabecalho:{type:Array,required:!0}},emits:{buscar(e){return typeof e=="string"}},setup(e,{emit:a}){const c=t.computed(()=>e.acoesCabecalho.length>0);function u(m){a("buscar",m)}return{temAcoesCabecalho:c,emitBuscar:u}}}),gt={class:"eli-tabela__cabecalho"},$t={key:1,class:"eli-tabela__acoes-cabecalho"},kt=["onClick"],Bt={class:"eli-tabela__acoes-cabecalho-rotulo"};function Vt(e,a,c,u,m,p){const o=t.resolveComponent("EliTabelaCaixaDeBusca");return t.openBlock(),t.createElementBlock("div",gt,[e.exibirBusca?(t.openBlock(),t.createBlock(o,{key:0,modelo:e.valorBusca,onBuscar:e.emitBuscar},null,8,["modelo","onBuscar"])):t.createCommentVNode("",!0),e.temAcoesCabecalho?(t.openBlock(),t.createElementBlock("div",$t,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.acoesCabecalho,(s,y)=>(t.openBlock(),t.createElementBlock("button",{key:`${s.rotulo}-${y}`,type:"button",class:"eli-tabela__acoes-cabecalho-botao",style:t.normalizeStyle(s.cor?{backgroundColor:s.cor,color:"#fff"}:void 0),onClick:s.acao},[s.icone?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.icone),{key:0,class:"eli-tabela__acoes-cabecalho-icone",size:16,"stroke-width":2})):t.createCommentVNode("",!0),t.createElementVNode("span",Bt,t.toDisplayString(s.rotulo),1)],12,kt))),128))])):t.createCommentVNode("",!0)])}const Ct=N(yt,[["render",Vt]]),Et=t.defineComponent({name:"EliTabelaEstados",props:{carregando:{type:Boolean,required:!0},erro:{type:String,required:!0},mensagemVazio:{type:String,required:!1,default:void 0}}}),St={key:0,class:"eli-tabela eli-tabela--carregando","aria-busy":"true"},wt={key:1,class:"eli-tabela eli-tabela--erro",role:"alert"},At={class:"eli-tabela__erro-mensagem"},Mt={key:2,class:"eli-tabela eli-tabela--vazio"};function _t(e,a,c,u,m,p){return e.carregando?(t.openBlock(),t.createElementBlock("div",St," Carregando... ")):e.erro?(t.openBlock(),t.createElementBlock("div",wt,[a[0]||(a[0]=t.createElementVNode("div",{class:"eli-tabela__erro-titulo"},"Erro",-1)),t.createElementVNode("div",At,t.toDisplayString(e.erro),1)])):(t.openBlock(),t.createElementBlock("div",Mt,t.toDisplayString(e.mensagemVazio??"Nenhum registro encontrado."),1))}const Dt=N(Et,[["render",_t]]),Tt=t.defineComponent({name:"EliTabelaDebug",props:{isDev:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},menuPopupPos:{type:Object,required:!0}}}),Nt={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 Pt(e,a,c,u,m,p){return e.isDev?(t.openBlock(),t.createElementBlock("div",Nt,[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 Ot=N(Tt,[["render",Pt]]),qt=t.defineComponent({name:"EliTabelaHead",components:{ArrowUp:$e,ArrowDown:ge},props:{colunas:{type:Array,required:!0},temAcoes:{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 c(p){return(p==null?void 0:p.coluna_ordem)!==void 0&&(p==null?void 0:p.coluna_ordem)!==null}function u(p){return p==="direita"?"eli-tabela__celula--direita":p==="centro"?"eli-tabela__celula--centro":"eli-tabela__celula--esquerda"}function m(p){a("alternarOrdenacao",p)}return{ArrowUp:$e,ArrowDown:ge,isOrdenavel:c,obterClasseAlinhamento:u,emitAlternarOrdenacao:m}}}),It={class:"eli-tabela__thead"},zt={class:"eli-tabela__tr eli-tabela__tr--header"},Lt=["onClick"],Ut={class:"eli-tabela__th-texto"},jt={key:1,class:"eli-tabela__th-label"},Ft={key:0,class:"eli-tabela__th eli-tabela__th--acoes",scope:"col"};function Ht(e,a,c,u,m,p){const o=t.resolveComponent("ArrowUp");return t.openBlock(),t.createElementBlock("thead",It,[t.createElementVNode("tr",zt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(s,y)=>(t.openBlock(),t.createElementBlock("th",{key:`th-${y}`,class:t.normalizeClass(["eli-tabela__th",[e.isOrdenavel(s)?"eli-tabela__th--ordenavel":void 0,e.obterClasseAlinhamento(s.alinhamento)]]),scope:"col"},[e.isOrdenavel(s)?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["eli-tabela__th-botao",[e.colunaOrdenacao===String(s.coluna_ordem)?"eli-tabela__th-botao--ativo":void 0]]),onClick:l=>e.emitAlternarOrdenacao(String(s.coluna_ordem))},[t.createElementVNode("span",Ut,t.toDisplayString(s.rotulo),1),e.colunaOrdenacao===String(s.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,Lt)):(t.openBlock(),t.createElementBlock("span",jt,t.toDisplayString(s.rotulo),1))],2))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("th",Ft," Ações ")):t.createCommentVNode("",!0)])])}const Yt=N(qt,[["render",Ht]]),Rt=t.defineComponent({name:"EliTabelaCelulaTextoSimples",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}});function Wt(e,a,c,u,m,p){var o;return t.toDisplayString((o=e.dados)==null?void 0:o.texto)}const vt=N(Rt,[["render",Wt]]),Gt=t.defineComponent({name:"EliTabelaCelulaNumero",components:{},props:{dados:{type:Object}},data(){return{}},methods:{},setup({dados:e}){return{dados:e}}});function Jt(e,a,c,u,m,p){var o;return t.toDisplayString(String((o=e.dados)==null?void 0:o.numero).replace(".",","))}const Zt={textoSimples:vt,numero:N(Gt,[["render",Jt]])},Xt=t.defineComponent({name:"EliTabelaCelula",props:{celula:{type:Array,required:!0}},setup(e){const a=t.computed(()=>e.celula[0]),c=t.computed(()=>e.celula[1]),u=t.computed(()=>Zt[a.value]),m=t.computed(()=>c.value);return{Componente:u,dadosParaComponente:m}}});function Kt(e,a,c,u,m,p){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Componente),{dados:e.dadosParaComponente},null,8,["dados"])}const Qt=N(Xt,[["render",Kt]]),xt=t.defineComponent({name:"EliTabelaBody",components:{EliTabelaCelula:Qt,MoreVertical:dt},props:{colunas:{type:Array,required:!0},linhas:{type:Array,required:!0},temAcoes:{type:Boolean,required:!0},menuAberto:{type:Number,required:!0},possuiAcoes:{type:Function,required:!0}},emits:{toggleMenu(e){return e&&typeof e.indice=="number"}},setup(e,{emit:a}){function c(o){return o==="direita"?"eli-tabela__celula--direita":o==="centro"?"eli-tabela__celula--centro":"eli-tabela__celula--esquerda"}function u(o){if(o!=null)return typeof o=="number"?`${o}px`:String(o)}function m(o){if(!Array.isArray(o))return;const s=o[0],y=o[1];if(s==="textoSimples")return typeof(y==null?void 0:y.texto)=="string"?y.texto:void 0;if(s==="numero")return typeof(y==null?void 0:y.numero)=="number"?String(y.numero):void 0}function p(o,s){a("toggleMenu",{indice:o,evento:s})}return{obterClasseAlinhamento:c,obterMaxWidth:u,obterTooltipCelula:m,emitToggleMenu:p}}}),ea={class:"eli-tabela__tbody"},ta=["onClick"],aa=["title"],oa=["id","disabled","aria-expanded","aria-controls","aria-label","title","onClick"];function na(e,a,c,u,m,p){const o=t.resolveComponent("EliTabelaCelula"),s=t.resolveComponent("MoreVertical");return t.openBlock(),t.createElementBlock("tbody",ea,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.linhas,(y,l)=>(t.openBlock(),t.createElementBlock("tr",{key:`tr-${l}`,class:t.normalizeClass(["eli-tabela__tr",[l%2===1?"eli-tabela__tr--zebra":void 0]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.colunas,(g,$)=>(t.openBlock(),t.createElementBlock("td",{key:`td-${l}-${$}`,class:t.normalizeClass(["eli-tabela__td",[g.acao?"eli-tabela__td--clicavel":void 0,e.obterClasseAlinhamento(g.alinhamento)]]),onClick:M=>g.acao?()=>{var k;return(k=g.acao)==null?void 0:k.call(g)}:void 0},[g.truncar?(t.openBlock(),t.createElementBlock("span",{key:0,class:"eli-tabela__celula-conteudo",style:t.normalizeStyle(g.largura_maxima?{maxWidth:e.obterMaxWidth(g.largura_maxima)}:void 0),title:e.obterTooltipCelula(g.celula(y))},[t.createVNode(o,{celula:g.celula(y)},null,8,["celula"])],12,aa)):(t.openBlock(),t.createBlock(o,{key:1,celula:g.celula(y)},null,8,["celula"]))],10,ta))),128)),e.temAcoes?(t.openBlock(),t.createElementBlock("td",{class:"eli-tabela__td eli-tabela__td--acoes",key:`td-${l}-acoes`},[t.createElementVNode("div",{class:t.normalizeClass(["eli-tabela__acoes-container",[e.menuAberto===l?"eli-tabela__acoes-container--aberto":void 0]])},[t.createElementVNode("button",{class:"eli-tabela__acoes-toggle",type:"button",id:`eli-tabela-acoes-toggle-${l}`,disabled:!e.possuiAcoes(l),"aria-haspopup":"menu","aria-expanded":e.menuAberto===l?"true":"false","aria-controls":e.possuiAcoes(l)?`eli-tabela-acoes-menu-${l}`:void 0,"aria-label":e.possuiAcoes(l)?"Ações da linha":"Nenhuma ação disponível",title:e.possuiAcoes(l)?"Ações":"Nenhuma ação disponível",onClick:t.withModifiers(g=>e.emitToggleMenu(l,g),["stop"])},[t.createVNode(s,{class:"eli-tabela__acoes-toggle-icone",size:18,"stroke-width":2})],8,oa)],2)])):t.createCommentVNode("",!0)],2))),128))])}const ra=N(xt,[["render",na]]),la=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:c}){const u=t.ref(null);c({menuEl:u});const m=t.computed(()=>e.acoes.length>0);function p(o){e.linha&&a("executar",{acao:o.acao,linha:e.linha})}return{menuEl:u,possuiAcoes:m,emitExecutar:p}}}),ia=["id","aria-labelledby"],sa=["aria-label","title","onClick"],ca={class:"eli-tabela__acoes-item-texto"};function da(e,a,c,u,m,p){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(s=>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",ca,t.toDisplayString(o.acao.rotulo),1)],12,sa)]))),128))],12,ia)):t.createCommentVNode("",!0)])}const ua=N(la,[["render",da]]),ma=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 c=t.computed(()=>{const l=e.maximoBotoes;return typeof l=="number"&&l>=5?Math.floor(l):7}),u=t.computed(()=>{const l=e.totalPaginas,g=e.pagina,$=c.value,M=[],k=O=>{M.push({label:String(O),pagina:O,ativo:O===g})},_=()=>{M.push({label:"…",ehEllipsis:!0})};if(l<=$){for(let O=1;O<=l;O+=1)k(O);return M}const C=Math.max(3,$-2);let F=Math.max(2,g-Math.floor(C/2)),H=F+C-1;H>=l&&(H=l-1,F=H-C+1),k(1),F>2&&_();for(let O=F;O<=H;O+=1)k(O);return H<l-1&&_(),k(l),M});function m(l){if(!l)return;const g=Math.min(Math.max(1,l),e.totalPaginas);g!==e.pagina&&a("alterar",g)}const p=t.computed(()=>e.pagina<=1),o=t.computed(()=>e.pagina>=e.totalPaginas),s=t.computed(()=>e.pagina),y=t.computed(()=>e.totalPaginas);return{botoes:u,irParaPagina:m,anteriorDesabilitado:p,proximaDesabilitada:o,paginaAtual:s,totalPaginasExibidas:y}}}),pa={key:0,class:"eli-tabela__paginacao",role:"navigation","aria-label":"Paginação de resultados"},fa=["disabled"],ba={key:0,class:"eli-tabela__pagina-ellipsis","aria-hidden":"true"},ha=["disabled","aria-current","aria-label","onClick"],ya=["disabled"];function ga(e,a,c,u,m,p){return e.totalPaginasExibidas>1?(t.openBlock(),t.createElementBlock("nav",pa,[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,fa),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.botoes,(o,s)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`${o.label}-${s}`},[o.ehEllipsis?(t.openBlock(),t.createElementBlock("span",ba,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:y=>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,ya)])):t.createCommentVNode("",!0)}const $a=N(ma,[["render",ga],["__scopeId","data-v-59d12455"]]),ka=t.defineComponent({name:"EliTabela",inheritAttrs:!1,components:{EliTabelaCabecalho:Ct,EliTabelaEstados:Dt,EliTabelaDebug:Ot,EliTabelaHead:Yt,EliTabelaBody:ra,EliTabelaMenuAcoes:ua,EliTabelaPaginacao:$a},props:{tabela:{type:Object,required:!0}},setup(e){const c=t.ref(!1),u=t.ref(null),m=t.ref([]),p=t.ref(0),o=t.ref([]),s=t.ref(null),y=t.ref(null),l=t.ref({top:0,left:0}),g=t.ref(""),$=t.ref(1),M=t.ref(null),k=t.ref("asc"),_=t.computed(()=>e.tabela),C=t.computed(()=>!!e.tabela.mostrarCaixaDeBusca),F=t.computed(()=>e.tabela.acoesTabela??[]),H=t.computed(()=>F.value.length>0),O=t.computed(()=>{const n=e.tabela.registros_por_consulta;return typeof n=="number"&&n>0?Math.floor(n):10}),v=t.computed(()=>{const n=O.value;if(!n||n<=0)return 1;const r=p.value;return r?Math.max(1,Math.ceil(r/n)):1}),ie=t.computed(()=>(e.tabela.acoesLinha??[]).length>0);let L=0;function U(n){var E,S,A,P,q,z;const r=n.getBoundingClientRect(),d=8,i=((A=(S=(E=y.value)==null?void 0:E.menuEl)==null?void 0:S.value)==null?void 0:A.offsetHeight)??0,h=((z=(q=(P=y.value)==null?void 0:P.menuEl)==null?void 0:q.value)==null?void 0:z.offsetWidth)??180;let b=r.bottom+d;const B=r.right-h;i&&b+i>window.innerHeight-d&&(b=r.top-d-i),l.value={top:Math.max(d,Math.round(b)),left:Math.max(d,Math.round(B))}}function Z(n){var d,i;if(s.value===null)return;const r=n.target;(i=(d=y.value)==null?void 0:d.menuEl)!=null&&i.value&&y.value.menuEl.value.contains(r)||(s.value=null)}function X(n){if(n){if(M.value===n){k.value=k.value==="asc"?"desc":"asc",f();return}M.value=n,k.value="asc",$.value!==1?$.value=1:f()}}function G(n){g.value!==n&&(g.value=n,$.value!==1?$.value=1:f())}function D(n){const r=Math.min(Math.max(1,n),v.value);r!==$.value&&($.value=r)}function V(n){const r=e.tabela.acoesLinha??[],d=o.value[n]??[];return r.map((i,h)=>{const b=i.exibir===void 0?!0:typeof i.exibir=="boolean"?i.exibir:!1;return{acao:i,indice:h,visivel:d[h]??b}}).filter(i=>i.visivel)}function R(n){return V(n).length>0}function ae(n,r){if(!R(n))return;if(s.value===n){s.value=null;return}s.value=n;const d=(r==null?void 0:r.currentTarget)??null;d&&(U(d),requestAnimationFrame(()=>U(d)))}async function f(){var h,b;const n=++L;c.value=!0,u.value=null,o.value=[],s.value=null;const r=Math.max(1,O.value),i={offSet:($.value-1)*r,limit:r};g.value&&(i.texto_busca=g.value),M.value&&(i.coluna_ordem=M.value,i.direcao_ordem=k.value);try{const B=e.tabela,E=await B.consulta(i);if(n!==L)return;if(E.cod!==be.sucesso){m.value=[],p.value=0,u.value=E.mensagem;return}const S=((h=E.valor)==null?void 0:h.valores)??[],A=((b=E.valor)==null?void 0:b.quantidade)??S.length;m.value=S,p.value=A;const P=Math.max(1,Math.ceil((A||0)/r));if($.value>P){$.value=P;return}const q=B.acoesLinha??[];if(!q.length){o.value=[];return}const z=S.map(()=>q.map(I=>I.exibir===void 0?!0:typeof I.exibir=="boolean"?I.exibir:!1));o.value=z;const W=await Promise.all(S.map(async I=>Promise.all(q.map(async T=>{if(T.exibir===void 0)return!0;if(typeof T.exibir=="boolean")return T.exibir;try{const j=T.exibir(I);return!!await Promise.resolve(j)}catch{return!1}}))));n===L&&(o.value=W)}catch(B){if(n!==L)return;m.value=[],p.value=0,u.value=B instanceof Error?B.message:"Erro ao carregar dados."}finally{n===L&&(c.value=!1)}}return t.onMounted(()=>{document.addEventListener("click",Z),f()}),t.onBeforeUnmount(()=>{document.removeEventListener("click",Z)}),t.watch(()=>e.tabela.mostrarCaixaDeBusca,n=>{!n&&g.value&&(g.value="",$.value!==1?$.value=1:f())}),t.watch($,(n,r)=>{n!==r&&f()}),t.watch(()=>e.tabela,()=>{s.value=null,M.value=null,k.value="asc",g.value="",$.value!==1?$.value=1:f()}),t.watch(()=>e.tabela.registros_por_consulta,()=>{$.value!==1?$.value=1:f()}),t.watch(m,()=>{s.value=null}),{isDev:!1,tabela:_,carregando:c,erro:u,linhas:m,quantidade:p,menuAberto:s,valorBusca:g,paginaAtual:$,colunaOrdenacao:M,direcaoOrdenacao:k,totalPaginas:v,exibirBusca:C,acoesCabecalho:F,temAcoesCabecalho:H,temAcoes:ie,alternarOrdenacao:X,atualizarBusca:G,irParaPagina:D,acoesDisponiveisPorLinha:V,possuiAcoes:R,toggleMenu:ae,menuPopup:y,menuPopupPos:l}}}),Ba={class:"eli-tabela"},Va={class:"eli-tabela__table"};function Ca(e,a,c,u,m,p){const o=t.resolveComponent("EliTabelaDebug"),s=t.resolveComponent("EliTabelaEstados"),y=t.resolveComponent("EliTabelaCabecalho"),l=t.resolveComponent("EliTabelaHead"),g=t.resolveComponent("EliTabelaBody"),$=t.resolveComponent("EliTabelaMenuAcoes"),M=t.resolveComponent("EliTabelaPaginacao");return t.openBlock(),t.createElementBlock("div",Ba,[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(s,{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(y,{key:0,exibirBusca:e.exibirBusca,valorBusca:e.valorBusca,acoesCabecalho:e.acoesCabecalho,onBuscar:e.atualizarBusca},null,8,["exibirBusca","valorBusca","acoesCabecalho","onBuscar"])):t.createCommentVNode("",!0),t.createElementVNode("table",Va,[t.createVNode(l,{colunas:e.tabela.colunas,temAcoes:e.temAcoes,colunaOrdenacao:e.colunaOrdenacao,direcaoOrdenacao:e.direcaoOrdenacao,onAlternarOrdenacao:e.alternarOrdenacao},null,8,["colunas","temAcoes","colunaOrdenacao","direcaoOrdenacao","onAlternarOrdenacao"]),t.createVNode(g,{colunas:e.tabela.colunas,linhas:e.linhas,temAcoes:e.temAcoes,menuAberto:e.menuAberto,possuiAcoes:e.possuiAcoes,onToggleMenu:a[0]||(a[0]=({indice:k,evento:_})=>e.toggleMenu(k,_))},null,8,["colunas","linhas","temAcoes","menuAberto","possuiAcoes"])]),t.createVNode($,{ref:"menuPopup",menuAberto:e.menuAberto,posicao:e.menuPopupPos,acoes:e.menuAberto===null?[]:e.acoesDisponiveisPorLinha(e.menuAberto),linha:e.menuAberto===null?null:e.linhas[e.menuAberto],onExecutar:a[1]||(a[1]=({acao:k,linha:_})=>{e.menuAberto=null,k.acao(_)})},null,8,["menuAberto","posicao","acoes","linha"]),e.totalPaginas>1&&e.quantidade>0?(t.openBlock(),t.createBlock(M,{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 ke=N(ka,[["render",Ca]]),Ea={install(e){e.component("EliOlaMundo",ue),e.component("EliBotao",ne),e.component("EliBadge",Q),e.component("EliInput",le),e.component("EliCartao",me),e.component("EliDataHora",fe),e.component("EliTabela",ke)}};w.EliBadge=Q,w.EliBotao=ne,w.EliCartao=me,w.EliDataHora=fe,w.EliInput=le,w.EliOlaMundo=ue,w.EliTabela=ke,w.default=Ea,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|