vue-componentes/dist/eli-vue.es.js
2026-01-27 15:51:54 -03:00

1896 lines
59 KiB
JavaScript

import { defineComponent as K, createBlock as R, openBlock as T, mergeProps as te, withCtx as U, renderSlot as re, computed as D, ref as E, createElementBlock as W, createCommentVNode as we, createSlots as je, createVNode as B, createTextVNode as de, toDisplayString as be, Fragment as he, renderList as Ve, resolveComponent as ce, createElementVNode as G, h, watch as le, withDirectives as ze, withKeys as He, vModelText as Ye, normalizeClass as Fe, onMounted as qe, onBeforeUnmount as We } from "vue";
import { VBtn as Re } from "vuetify/components/VBtn";
import { VBadge as Je } from "vuetify/components/VBadge";
import { VCheckbox as Ze } from "vuetify/components/VCheckbox";
import { VIcon as Xe } from "vuetify/components/VIcon";
import { VRadio as Ge } from "vuetify/components/VRadio";
import { VRadioGroup as Ke } from "vuetify/components/VRadioGroup";
import { VSelect as Qe } from "vuetify/components/VSelect";
import { VTextField as Ee } from "vuetify/components/VTextField";
import { VTextarea as xe } from "vuetify/components/VTextarea";
import { VCard as Pe, VCardTitle as Ae, VCardText as Te, VCardActions as Ie } from "vuetify/components/VCard";
import { VContainer as ea } from "vuetify/components/VGrid";
const aa = K({
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
}
}
}), Q = (e, a) => {
const s = e.__vccOpts || e;
for (const [f, v] of a)
s[f] = v;
return s;
};
function ta(e, a, s, f, v, y) {
return T(), R(Re, te({
color: e.color,
variant: e.variant,
size: e.size,
disabled: e.disabled,
loading: e.loading
}, e.$attrs, { class: "text-none pt-1" }), {
default: U(() => [
re(e.$slots, "default")
]),
_: 3
}, 16, ["color", "variant", "size", "disabled", "loading"]);
}
const Oe = /* @__PURE__ */ Q(aa, [["render", ta]]), Me = {
suave: "4px",
pill: "10px"
}, oa = K({
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
},
/** 🔥 NOVO: controla só o radius */
radius: {
type: String,
default: "suave"
}
},
setup(e) {
const a = D(() => e.radius in Me ? Me[e.radius] : e.radius), s = D(() => e.dot || e.badge !== void 0 ? e.visible : !1), f = D(() => ({
"--eli-badge-radius": a.value
}));
return { showBadge: s, badgeStyle: f };
}
});
function la(e, a, s, f, v, y) {
return e.showBadge ? (T(), R(Je, te({
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: U(() => [
re(e.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 16, ["color", "location", "offset-x", "offset-y", "dot", "content", "style"])) : re(e.$slots, "default", { key: 1 }, void 0, !0);
}
const ke = /* @__PURE__ */ Q(oa, [["render", la], ["__scopeId", "data-v-de2fbf2f"]]);
function ra(e) {
return e.replace(/\D+/g, "");
}
function na(e) {
const a = ra(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 ia(e) {
return e.replace(/\D+/g, "");
}
function sa(e) {
const a = ia(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 Se(e) {
return e.replace(/\D+/g, "");
}
function Ue(e) {
const a = e.replace(/[^\d,]/g, ""), s = a.split(",");
return s.length > 2 ? s[0] + "," + s.slice(1).join("") : a;
}
function ua(e) {
return Ue(e.replace(/%/g, ""));
}
function da(e) {
const a = Se(e);
return a ? (parseInt(a, 10) / 100).toFixed(2).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, ".") : "";
}
function ca(e) {
const a = Se(e).slice(0, 8);
return a.length <= 5 ? a : a.replace(/^(\d{5})(\d{1,3})$/, "$1-$2");
}
const fa = K({
name: "EliInput",
inheritAttrs: !1,
props: {
/**
* Aceita valor simples (text-like) ou lista de valores (checkbox/select multiple).
* O componente não converte tipos automaticamente: mantém o que receber.
*/
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 },
/**
* Para select/radio/checkbox.
* Aceita lista já normalizada ({ label, value }) ou valores primitivos.
*/
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: s }) {
const f = E(!1), v = E(!1), y = D({
get: () => e.modelValue,
set: (S) => {
a("update:modelValue", S), a("change", S);
}
}), i = D(
() => [
"text",
"password",
"email",
"search",
"url",
"telefone",
"cpfCnpj",
"numericoInteiro",
"numericoDecimal",
"numericoMoeda",
"porcentagem",
"cep"
].includes(e.type)
), c = D(
() => e.type === "password" ? v.value ? "text" : "password" : "text"
), V = D(() => {
if (e.type === "telefone") return "tel";
if (e.type === "porcentagem") return "decimal";
if (e.type.startsWith("numerico")) return "numeric";
}), o = D(
() => e.error ? "error" : f.value ? e.color : void 0
);
function _(S) {
const O = S.target;
let w = O.value;
switch (e.type) {
case "numericoInteiro":
w = Se(w);
break;
case "numericoDecimal":
w = Ue(w);
break;
case "numericoMoeda":
w = da(w);
break;
case "porcentagem":
w = ua(w);
break;
case "telefone":
w = sa(w);
break;
case "cpfCnpj":
w = na(w);
break;
case "cep":
w = ca(w);
break;
}
O.value = w, a("update:modelValue", w), a("change", w);
}
function C() {
v.value = !v.value;
}
const H = D(() => (e.options || []).map((S) => {
if (S && typeof S == "object" && "value" in S) {
const w = S.value;
return {
label: S.label ?? String(w),
value: w,
disabled: S.disabled
};
}
const O = S;
return { label: String(O), value: O };
}));
return {
attrs: s,
value: y,
isTextLike: i,
inputHtmlType: c,
inputMode: V,
internalColor: o,
showPassword: v,
togglePassword: C,
onInput: _,
onFocus: () => a("focus"),
onBlur: () => a("blur"),
computedItems: H
};
}
}), ma = { class: "eli-input" }, pa = {
key: 4,
class: "checkbox-group"
};
function va(e, a, s, f, v, y) {
return T(), W("div", ma, [
e.isTextLike ? (T(), R(Ee, te({
key: 0,
modelValue: e.value,
"onUpdate:modelValue": a[0] || (a[0] = (i) => e.value = i),
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
}), je({ _: 2 }, [
e.type === "password" && e.showPasswordToggle ? {
name: "append-inner",
fn: U(() => [
B(Xe, {
class: "cursor-pointer",
onClick: e.togglePassword
}, {
default: U(() => [
de(be(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(), R(xe, te({
key: 1,
modelValue: e.value,
"onUpdate:modelValue": a[1] || (a[1] = (i) => e.value = i),
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(), R(Qe, te({
key: 2,
modelValue: e.value,
"onUpdate:modelValue": a[2] || (a[2] = (i) => e.value = i),
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(), R(Ke, {
key: 3,
modelValue: e.value,
"onUpdate:modelValue": a[3] || (a[3] = (i) => e.value = i),
row: e.row
}, {
default: U(() => [
(T(!0), W(he, null, Ve(e.computedItems, (i) => (T(), R(Ge, {
key: String(i.value),
label: i.label,
value: i.value
}, null, 8, ["label", "value"]))), 128))
]),
_: 1
}, 8, ["modelValue", "row"])) : e.type === "checkbox" ? (T(), W("div", pa, [
(T(!0), W(he, null, Ve(e.computedItems, (i) => (T(), R(Ze, {
key: String(i.value),
modelValue: e.value,
"onUpdate:modelValue": a[4] || (a[4] = (c) => e.value = c),
label: i.label,
value: i.value,
density: e.density
}, null, 8, ["modelValue", "label", "value", "density"]))), 128))
])) : we("", !0)
]);
}
const Le = /* @__PURE__ */ Q(fa, [["render", va], ["__scopeId", "data-v-756cb549"]]), ba = K({
name: "EliOlaMundo",
components: {
EliBotao: Oe,
EliBadge: ke,
EliInput: Le
},
setup() {
const e = E(""), a = E([]), s = E(""), f = E(""), v = E(""), y = E(""), i = E(""), c = E(""), V = E(""), o = E(""), _ = E(""), C = E(null), H = E([]);
return {
nome: e,
email: c,
documento: _,
estado: a,
telefone: f,
mensagem: V,
senha: o,
cor: C,
habilidades: H,
idade: v,
altura: y,
cep: s,
valor: i
};
}
}), ha = { class: "grid-example" };
function ga(e, a, s, f, v, y) {
const i = ce("EliBadge"), c = ce("EliInput"), V = ce("EliBotao");
return T(), R(ea, null, {
default: U(() => [
B(Pe, {
class: "mx-auto",
max_width: "400"
}, {
default: U(() => [
B(Ae, null, {
default: U(() => [
B(i, {
badge: "Novo",
"offset-x": "-15",
location: "right center"
}, {
default: U(() => [...a[14] || (a[14] = [
de(" Olá Mundo! ", -1)
])]),
_: 1
})
]),
_: 1
}),
B(Te, null, {
default: U(() => [
a[15] || (a[15] = de(" Este é um componente de exemplo integrado com Vuetify. ", -1)),
G("div", ha, [
B(c, {
modelValue: e.nome,
"onUpdate:modelValue": a[0] || (a[0] = (o) => e.nome = o),
label: "Nome",
placeholder: "Digite o nome",
density: "compact"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.idade,
"onUpdate:modelValue": a[1] || (a[1] = (o) => e.idade = o),
type: "numericoInteiro",
label: "Idade",
density: "default"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.altura,
"onUpdate:modelValue": a[2] || (a[2] = (o) => e.altura = o),
type: "numericoDecimal",
label: "Altura",
density: "comfortable"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.valor,
"onUpdate:modelValue": a[3] || (a[3] = (o) => e.valor = o),
type: "numericoMoeda",
label: "Valor"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.telefone,
"onUpdate:modelValue": a[4] || (a[4] = (o) => e.telefone = o),
type: "telefone",
label: "Telefone"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.cep,
"onUpdate:modelValue": a[5] || (a[5] = (o) => e.cep = o),
type: "cep",
label: "CEP",
placeholder: "00000-000"
}, null, 8, ["modelValue"]),
B(c, {
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] = (o) => e.estado = o),
multiple: ""
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.documento,
"onUpdate:modelValue": a[7] || (a[7] = (o) => e.documento = o),
type: "cpfCnpj",
label: "CPF / CNPJ"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.email,
"onUpdate:modelValue": a[8] || (a[8] = (o) => e.email = o),
label: "Email",
placeholder: "email@exemplo.com"
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.senha,
"onUpdate:modelValue": a[9] || (a[9] = (o) => e.senha = o),
label: "Senha",
type: "password",
showPasswordToggle: !0,
placeholder: "Digite sua senha"
}, null, 8, ["modelValue"]),
B(c, {
type: "textarea",
modelValue: e.mensagem,
"onUpdate:modelValue": a[10] || (a[10] = (o) => e.mensagem = o),
label: "Mensagem",
rows: 5
}, null, 8, ["modelValue"]),
B(c, {
type: "radio",
modelValue: e.cor,
"onUpdate:modelValue": a[11] || (a[11] = (o) => e.cor = o),
label: "Cor favorita",
options: [
{ label: "Azul", value: "azul" },
{ label: "Verde", value: "verde" }
]
}, null, 8, ["modelValue"]),
B(c, {
type: "checkbox",
modelValue: e.habilidades,
"onUpdate:modelValue": a[12] || (a[12] = (o) => e.habilidades = o),
options: [
{ label: "Vue", value: "vue" },
{ label: "React", value: "react" }
]
}, null, 8, ["modelValue"]),
B(c, {
modelValue: e.nome,
"onUpdate:modelValue": a[13] || (a[13] = (o) => e.nome = o),
label: "Nome",
error: !0,
"error-messages": ["Obrigatório"]
}, null, 8, ["modelValue"])
])
]),
_: 1
}),
B(Ie, null, {
default: U(() => [
B(V, {
color: "primary",
variant: "elevated",
block: ""
}, {
default: U(() => [...a[16] || (a[16] = [
de(" Botão Vuetify ", -1)
])]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
});
}
const ya = /* @__PURE__ */ Q(ba, [["render", ga]]), $a = K({
name: "EliCartao",
components: { EliBadge: ke },
inheritAttrs: !1,
props: {
/** Título de fallback caso o slot `titulo` não seja usado. */
titulo: {
type: String,
default: ""
},
/**
* Status semântico do cartão.
* Usado para cor/label e para permitir filtros por status.
*/
status: {
type: String,
required: !0
},
/** Variante visual do v-card (Vuetify). */
variant: {
type: String,
default: "outlined"
}
},
emits: {
/** Emit opcional para padronizar clique no cartão. */
clicar: (e) => !0
},
setup(e, { emit: a }) {
const s = D(() => e.status), f = D(() => {
switch (e.status) {
case "novo":
return "primary";
case "rascunho":
return "secondary";
case "vendido":
return "success";
case "cancelado":
return "error";
}
}), v = D(() => `eli-cartao--${e.status}`);
function y() {
a("clicar", e.status);
}
return {
rotuloStatus: s,
corStatus: f,
classeStatus: v,
onClick: y
};
}
}), Va = { class: "eli-cartao__titulo-texto" }, wa = { class: "eli-cartao__status" };
function ka(e, a, s, f, v, y) {
const i = ce("EliBadge");
return T(), R(Pe, te({
class: ["eli-cartao", e.classeStatus],
variant: e.variant
}, e.$attrs), {
default: U(() => [
B(Ae, { class: "eli-cartao__titulo" }, {
default: U(() => [
G("div", Va, [
re(e.$slots, "titulo", {}, () => [
de(be(e.titulo), 1)
], !0)
]),
G("div", wa, [
B(i, {
badge: e.rotuloStatus,
radius: "pill",
color: e.corStatus
}, {
default: U(() => [...a[0] || (a[0] = [
G("span", null, null, -1)
])]),
_: 1
}, 8, ["badge", "color"])
])
]),
_: 3
}),
B(Te, { class: "eli-cartao__conteudo" }, {
default: U(() => [
re(e.$slots, "default", {}, void 0, !0)
]),
_: 3
}),
e.$slots.acoes ? (T(), R(Ie, {
key: 0,
class: "eli-cartao__acoes"
}, {
default: U(() => [
re(e.$slots, "acoes", {}, void 0, !0)
]),
_: 3
})) : we("", !0)
]),
_: 3
}, 16, ["variant", "class"]);
}
const Sa = /* @__PURE__ */ Q($a, [["render", ka], ["__scopeId", "data-v-6c492bd9"]]);
function Ma(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var ve = { exports: {} }, Ca = ve.exports, Ce;
function Da() {
return Ce || (Ce = 1, (function(e, a) {
(function(s, f) {
e.exports = f();
})(Ca, (function() {
var s = 1e3, f = 6e4, v = 36e5, y = "millisecond", i = "second", c = "minute", V = "hour", o = "day", _ = "week", C = "month", H = "quarter", S = "year", O = "date", w = "Invalid Date", J = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, Y = /\[([^\]]+)]|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, L = { 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(p) {
var n = ["th", "st", "nd", "rd"], t = p % 100;
return "[" + p + (n[(t - 20) % 10] || n[t] || n[0]) + "]";
} }, ne = function(p, n, t) {
var l = String(p);
return !l || l.length >= n ? p : "" + Array(n + 1 - l.length).join(t) + p;
}, ye = { s: ne, z: function(p) {
var n = -p.utcOffset(), t = Math.abs(n), l = Math.floor(t / 60), r = t % 60;
return (n <= 0 ? "+" : "-") + ne(l, 2, "0") + ":" + ne(r, 2, "0");
}, m: function p(n, t) {
if (n.date() < t.date()) return -p(t, n);
var l = 12 * (t.year() - n.year()) + (t.month() - n.month()), r = n.clone().add(l, C), u = t - r < 0, d = n.clone().add(l + (u ? -1 : 1), C);
return +(-(l + (t - r) / (u ? r - d : d - r)) || 0);
}, a: function(p) {
return p < 0 ? Math.ceil(p) || 0 : Math.floor(p);
}, p: function(p) {
return { M: C, y: S, w: _, d: o, D: O, h: V, m: c, s: i, ms: y, Q: H }[p] || String(p || "").toLowerCase().replace(/s$/, "");
}, u: function(p) {
return p === void 0;
} }, x = "en", Z = {};
Z[x] = L;
var ie = "$isDayjsObject", se = function(p) {
return p instanceof oe || !(!p || !p[ie]);
}, ee = function p(n, t, l) {
var r;
if (!n) return x;
if (typeof n == "string") {
var u = n.toLowerCase();
Z[u] && (r = u), t && (Z[u] = t, r = u);
var d = n.split("-");
if (!r && d.length > 1) return p(d[0]);
} else {
var g = n.name;
Z[g] = n, r = g;
}
return !l && r && (x = r), r || !l && x;
}, I = function(p, n) {
if (se(p)) return p.clone();
var t = typeof n == "object" ? n : {};
return t.date = p, t.args = arguments, new oe(t);
}, k = ye;
k.l = ee, k.i = se, k.w = function(p, n) {
return I(p, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
};
var oe = (function() {
function p(t) {
this.$L = ee(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[ie] = !0;
}
var n = p.prototype;
return n.parse = function(t) {
this.$d = (function(l) {
var r = l.date, u = l.utc;
if (r === null) return /* @__PURE__ */ new Date(NaN);
if (k.u(r)) return /* @__PURE__ */ new Date();
if (r instanceof Date) return new Date(r);
if (typeof r == "string" && !/Z$/i.test(r)) {
var d = r.match(J);
if (d) {
var g = d[2] - 1 || 0, b = (d[7] || "0").substring(0, 3);
return u ? new Date(Date.UTC(d[1], g, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, b)) : new Date(d[1], g, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, b);
}
}
return new Date(r);
})(t), this.init();
}, n.init = function() {
var t = this.$d;
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
}, n.$utils = function() {
return k;
}, n.isValid = function() {
return this.$d.toString() !== w;
}, n.isSame = function(t, l) {
var r = I(t);
return this.startOf(l) <= r && r <= this.endOf(l);
}, n.isAfter = function(t, l) {
return I(t) < this.startOf(l);
}, n.isBefore = function(t, l) {
return this.endOf(l) < I(t);
}, n.$g = function(t, l, r) {
return k.u(t) ? this[l] : this.set(r, t);
}, n.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, n.valueOf = function() {
return this.$d.getTime();
}, n.startOf = function(t, l) {
var r = this, u = !!k.u(l) || l, d = k.p(t), g = function(q, A) {
var j = k.w(r.$u ? Date.UTC(r.$y, A, q) : new Date(r.$y, A, q), r);
return u ? j : j.endOf(o);
}, b = function(q, A) {
return k.w(r.toDate()[q].apply(r.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(A)), r);
}, m = this.$W, $ = this.$M, M = this.$D, N = "set" + (this.$u ? "UTC" : "");
switch (d) {
case S:
return u ? g(1, 0) : g(31, 11);
case C:
return u ? g(1, $) : g(0, $ + 1);
case _:
var P = this.$locale().weekStart || 0, F = (m < P ? m + 7 : m) - P;
return g(u ? M - F : M + (6 - F), $);
case o:
case O:
return b(N + "Hours", 0);
case V:
return b(N + "Minutes", 1);
case c:
return b(N + "Seconds", 2);
case i:
return b(N + "Milliseconds", 3);
default:
return this.clone();
}
}, n.endOf = function(t) {
return this.startOf(t, !1);
}, n.$set = function(t, l) {
var r, u = k.p(t), d = "set" + (this.$u ? "UTC" : ""), g = (r = {}, r[o] = d + "Date", r[O] = d + "Date", r[C] = d + "Month", r[S] = d + "FullYear", r[V] = d + "Hours", r[c] = d + "Minutes", r[i] = d + "Seconds", r[y] = d + "Milliseconds", r)[u], b = u === o ? this.$D + (l - this.$W) : l;
if (u === C || u === S) {
var m = this.clone().set(O, 1);
m.$d[g](b), m.init(), this.$d = m.set(O, Math.min(this.$D, m.daysInMonth())).$d;
} else g && this.$d[g](b);
return this.init(), this;
}, n.set = function(t, l) {
return this.clone().$set(t, l);
}, n.get = function(t) {
return this[k.p(t)]();
}, n.add = function(t, l) {
var r, u = this;
t = Number(t);
var d = k.p(l), g = function($) {
var M = I(u);
return k.w(M.date(M.date() + Math.round($ * t)), u);
};
if (d === C) return this.set(C, this.$M + t);
if (d === S) return this.set(S, this.$y + t);
if (d === o) return g(1);
if (d === _) return g(7);
var b = (r = {}, r[c] = f, r[V] = v, r[i] = s, r)[d] || 1, m = this.$d.getTime() + t * b;
return k.w(m, this);
}, n.subtract = function(t, l) {
return this.add(-1 * t, l);
}, n.format = function(t) {
var l = this, r = this.$locale();
if (!this.isValid()) return r.invalidDate || w;
var u = t || "YYYY-MM-DDTHH:mm:ssZ", d = k.z(this), g = this.$H, b = this.$m, m = this.$M, $ = r.weekdays, M = r.months, N = r.meridiem, P = function(A, j, X, ae) {
return A && (A[j] || A(l, u)) || X[j].slice(0, ae);
}, F = function(A) {
return k.s(g % 12 || 12, A, "0");
}, q = N || function(A, j, X) {
var ae = A < 12 ? "AM" : "PM";
return X ? ae.toLowerCase() : ae;
};
return u.replace(Y, (function(A, j) {
return j || (function(X) {
switch (X) {
case "YY":
return String(l.$y).slice(-2);
case "YYYY":
return k.s(l.$y, 4, "0");
case "M":
return m + 1;
case "MM":
return k.s(m + 1, 2, "0");
case "MMM":
return P(r.monthsShort, m, M, 3);
case "MMMM":
return P(M, m);
case "D":
return l.$D;
case "DD":
return k.s(l.$D, 2, "0");
case "d":
return String(l.$W);
case "dd":
return P(r.weekdaysMin, l.$W, $, 2);
case "ddd":
return P(r.weekdaysShort, l.$W, $, 3);
case "dddd":
return $[l.$W];
case "H":
return String(g);
case "HH":
return k.s(g, 2, "0");
case "h":
return F(1);
case "hh":
return F(2);
case "a":
return q(g, b, !0);
case "A":
return q(g, b, !1);
case "m":
return String(b);
case "mm":
return k.s(b, 2, "0");
case "s":
return String(l.$s);
case "ss":
return k.s(l.$s, 2, "0");
case "SSS":
return k.s(l.$ms, 3, "0");
case "Z":
return d;
}
return null;
})(A) || d.replace(":", "");
}));
}, n.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, n.diff = function(t, l, r) {
var u, d = this, g = k.p(l), b = I(t), m = (b.utcOffset() - this.utcOffset()) * f, $ = this - b, M = function() {
return k.m(d, b);
};
switch (g) {
case S:
u = M() / 12;
break;
case C:
u = M();
break;
case H:
u = M() / 3;
break;
case _:
u = ($ - m) / 6048e5;
break;
case o:
u = ($ - m) / 864e5;
break;
case V:
u = $ / v;
break;
case c:
u = $ / f;
break;
case i:
u = $ / s;
break;
default:
u = $;
}
return r ? u : k.a(u);
}, n.daysInMonth = function() {
return this.endOf(C).$D;
}, n.$locale = function() {
return Z[this.$L];
}, n.locale = function(t, l) {
if (!t) return this.$L;
var r = this.clone(), u = ee(t, l, !0);
return u && (r.$L = u), r;
}, n.clone = function() {
return k.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();
}, p;
})(), fe = oe.prototype;
return I.prototype = fe, [["$ms", y], ["$s", i], ["$m", c], ["$H", V], ["$W", o], ["$M", C], ["$y", S], ["$D", O]].forEach((function(p) {
fe[p[1]] = function(n) {
return this.$g(n, p[0], p[1]);
};
})), I.extend = function(p, n) {
return p.$i || (p(n, oe, I), p.$i = !0), I;
}, I.locale = ee, I.isDayjs = se, I.unix = function(p) {
return I(1e3 * p);
}, I.en = Z[x], I.Ls = Z, I.p = {}, I;
}));
})(ve)), ve.exports;
}
var _a = Da();
const pe = /* @__PURE__ */ Ma(_a), Ba = K({
name: "EliDataHora",
inheritAttrs: !1,
props: {
/**
* Valor em ISO 8601:
* - com offset (ex.: `2026-01-09T13:15:00-03:00`)
* - ou UTC absoluto (ex.: `2026-01-09T16:15:00Z`)
*/
modelValue: {
type: String,
default: null
},
/**
* Define o tipo de entrada.
* - `dataHora`: usa `datetime-local`
* - `data`: usa `date`
*/
modo: {
type: String,
default: "dataHora"
},
/** Rótulo exibido no v-text-field (Vuetify). */
rotulo: {
type: String,
default: "Data e hora"
},
/** Placeholder do input. */
placeholder: {
type: String,
default: ""
},
/** Desabilita a interação. */
desabilitado: {
type: Boolean,
default: !1
},
/** Se true, mostra ícone para limpar o valor (Vuetify clearable). */
limpavel: {
type: Boolean,
default: !1
},
/** Estado de erro (visual). */
erro: {
type: Boolean,
default: !1
},
/** Mensagens de erro. */
mensagensErro: {
type: [String, Array],
default: () => []
},
/** Texto de apoio. */
dica: {
type: String,
default: ""
},
/** Mantém a dica sempre visível. */
dicaPersistente: {
type: Boolean,
default: !1
},
/** Densidade do campo (Vuetify). */
densidade: {
type: String,
default: "comfortable"
},
/** Variante do v-text-field (Vuetify). */
variante: {
type: String,
default: "outlined"
},
/**
* Valor mínimo permitido.
* ISO 8601 (offset ou `Z`).
*/
min: {
// ISO 8601 (offset ou Z)
type: String,
default: void 0
},
/**
* Valor máximo permitido.
* ISO 8601 (offset ou `Z`).
*/
max: {
// ISO 8601 (offset ou Z)
type: String,
default: void 0
}
},
emits: {
/** v-model padrão. */
"update:modelValue": (e) => !0,
/** Alias para consumidores que querem um evento semântico. */
alterar: (e) => !0,
foco: () => !0,
desfoco: () => !0
},
setup(e, { emit: a, attrs: s }) {
const f = D(
() => e.modo === "data" ? "date" : "datetime-local"
);
function v(o) {
return e.modo === "data" ? pe(o).format("YYYY-MM-DD") : pe(o).format("YYYY-MM-DDTHH:mm");
}
function y(o) {
return e.modo === "data" ? pe(`${o}T00:00`).format() : pe(o).format();
}
const i = D({
get: () => e.modelValue ? v(e.modelValue) : "",
set: (o) => {
const _ = o && o.length > 0 ? o : null;
if (!_) {
a("update:modelValue", null), a("alterar", null);
return;
}
const C = y(_);
a("update:modelValue", C), a("alterar", C);
}
}), c = D(() => {
if (e.min)
return v(e.min);
}), V = D(() => {
if (e.max)
return v(e.max);
});
return { attrs: s, valor: i, emit: a, minLocal: c, maxLocal: V, tipoInput: f };
}
}), Ea = { class: "eli-data-hora" };
function Pa(e, a, s, f, v, y) {
return T(), W("div", Ea, [
B(Ee, te({
modelValue: e.valor,
"onUpdate:modelValue": a[0] || (a[0] = (i) => e.valor = i),
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] = (i) => e.emit("foco")),
onBlur: a[2] || (a[2] = (i) => e.emit("desfoco"))
}), null, 16, ["modelValue", "type", "label", "placeholder", "disabled", "clearable", "error", "error-messages", "hint", "persistent-hint", "density", "variant", "min", "max"])
]);
}
const Aa = /* @__PURE__ */ Q(Ba, [["render", Pa], ["__scopeId", "data-v-71afabb6"]]);
/**
* @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 Ta = (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 De = (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 Ia = (...e) => e.filter((a, s, f) => !!a && a.trim() !== "" && f.indexOf(a) === s).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 _e = (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 Oa = (e) => e.replace(
/^([A-Z])|[\s-_]+(\w)/g,
(a, s, f) => f ? f.toUpperCase() : s.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 Ua = (e) => {
const a = Oa(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 ue = {
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 La = ({
name: e,
iconNode: a,
absoluteStrokeWidth: s,
"absolute-stroke-width": f,
strokeWidth: v,
"stroke-width": y,
size: i = ue.width,
color: c = ue.stroke,
...V
}, { slots: o }) => h(
"svg",
{
...ue,
...V,
width: i,
height: i,
stroke: c,
"stroke-width": De(s) || De(f) || s === !0 || f === !0 ? Number(v || y || ue["stroke-width"]) * 24 / Number(i) : v || y || ue["stroke-width"],
class: Ia(
"lucide",
V.class,
...e ? [`lucide-${_e(Ua(e))}-icon`, `lucide-${_e(e)}`] : ["lucide-icon"]
),
...!o.default && !Ta(V) && { "aria-hidden": "true" }
},
[...a.map((_) => h(..._)), ...o.default ? [o.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 ge = (e, a) => (s, { slots: f, attrs: v }) => h(
La,
{
...v,
...s,
iconNode: a,
name: e
},
f
);
/**
* @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 Na = ge("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 Be = ge("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 ja = ge("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 za = ge("search", [
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
]);
var Ne = ((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))(Ne || {});
const Ha = K({
name: "EliTabelaCaixaDeBusca",
components: { Search: za },
props: {
modelo: {
type: String,
required: !1,
default: ""
}
},
emits: {
buscar(e) {
return typeof e == "string";
}
},
setup(e, { emit: a }) {
const s = E(e.modelo ?? "");
le(
() => e.modelo,
(v) => {
v !== void 0 && v !== s.value && (s.value = v);
}
);
function f() {
a("buscar", s.value.trim());
}
return { texto: s, emitirBusca: f };
}
}), Ya = { class: "eli-tabela__busca" }, Fa = { class: "eli-tabela__busca-input-wrapper" };
function qa(e, a, s, f, v, y) {
const i = ce("Search");
return T(), W("div", Ya, [
G("div", Fa, [
ze(G("input", {
id: "eli-tabela-busca",
"onUpdate:modelValue": a[0] || (a[0] = (c) => e.texto = c),
type: "search",
class: "eli-tabela__busca-input",
placeholder: "Digite termos para filtrar",
onKeyup: a[1] || (a[1] = He((...c) => e.emitirBusca && e.emitirBusca(...c), ["enter"]))
}, null, 544), [
[Ye, e.texto]
]),
G("button", {
type: "button",
class: "eli-tabela__busca-botao",
"aria-label": "Buscar",
title: "Buscar",
onClick: a[2] || (a[2] = (...c) => e.emitirBusca && e.emitirBusca(...c))
}, [
B(i, {
class: "eli-tabela__busca-botao-icone",
size: 16,
"stroke-width": 2,
"aria-hidden": "true"
})
])
])
]);
}
const Wa = /* @__PURE__ */ Q(Ha, [["render", qa], ["__scopeId", "data-v-0fd1ad15"]]), Ra = K({
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 s = D(() => {
const o = e.maximoBotoes;
return typeof o == "number" && o >= 5 ? Math.floor(o) : 7;
}), f = D(() => {
const o = e.totalPaginas, _ = e.pagina, C = s.value, H = [], S = (L) => {
H.push({
label: String(L),
pagina: L,
ativo: L === _
});
}, O = () => {
H.push({ label: "…", ehEllipsis: !0 });
};
if (o <= C) {
for (let L = 1; L <= o; L += 1)
S(L);
return H;
}
const w = Math.max(3, C - 2);
let J = Math.max(2, _ - Math.floor(w / 2)), Y = J + w - 1;
Y >= o && (Y = o - 1, J = Y - w + 1), S(1), J > 2 && O();
for (let L = J; L <= Y; L += 1)
S(L);
return Y < o - 1 && O(), S(o), H;
});
function v(o) {
if (!o)
return;
const _ = Math.min(Math.max(1, o), e.totalPaginas);
_ !== e.pagina && a("alterar", _);
}
const y = D(() => e.pagina <= 1), i = D(() => e.pagina >= e.totalPaginas), c = D(() => e.pagina), V = D(() => e.totalPaginas);
return {
botoes: f,
irParaPagina: v,
anteriorDesabilitado: y,
proximaDesabilitada: i,
paginaAtual: c,
totalPaginasExibidas: V
};
}
}), Ja = {
key: 0,
class: "eli-tabela__paginacao",
role: "navigation",
"aria-label": "Paginação de resultados"
}, Za = ["disabled"], Xa = {
key: 0,
class: "eli-tabela__pagina-ellipsis",
"aria-hidden": "true"
}, Ga = ["disabled", "aria-current", "aria-label", "onClick"], Ka = ["disabled"];
function Qa(e, a, s, f, v, y) {
return e.totalPaginasExibidas > 1 ? (T(), W("nav", Ja, [
G("button", {
type: "button",
class: "eli-tabela__pagina-botao",
disabled: e.anteriorDesabilitado,
"aria-label": "Página anterior",
onClick: a[0] || (a[0] = (i) => e.irParaPagina(e.paginaAtual - 1))
}, " << ", 8, Za),
(T(!0), W(he, null, Ve(e.botoes, (i, c) => (T(), W(he, {
key: `${i.label}-${c}`
}, [
i.ehEllipsis ? (T(), W("span", Xa, be(i.label), 1)) : (T(), W("button", {
key: 1,
type: "button",
class: Fe(["eli-tabela__pagina-botao", i.ativo ? "eli-tabela__pagina-botao--ativo" : void 0]),
disabled: i.ativo,
"aria-current": i.ativo ? "page" : void 0,
"aria-label": `Ir para página ${i.label}`,
onClick: (V) => e.irParaPagina(i.pagina)
}, be(i.label), 11, Ga))
], 64))), 128)),
G("button", {
type: "button",
class: "eli-tabela__pagina-botao",
disabled: e.proximaDesabilitada,
"aria-label": "Próxima página",
onClick: a[1] || (a[1] = (i) => e.irParaPagina(e.paginaAtual + 1))
}, " >> ", 8, Ka)
])) : we("", !0);
}
const xa = /* @__PURE__ */ Q(Ra, [["render", Qa], ["__scopeId", "data-v-59d12455"]]), et = K({
name: "EliTabela",
inheritAttrs: !1,
props: {
tabela: {
// Observação: este componente é “generic-friendly”.
// Usamos `any` aqui para permitir passar `EliTabelaConsulta<T>` de qualquer T
// sem brigar com invariância do TS (por causa do callback `celula(linha: T)`).
type: Object,
required: !0
}
},
setup(e) {
const a = E(!1), s = E(null), f = E([]), v = E(0), y = E([]), i = E(null), c = /* @__PURE__ */ new Map(), V = E(""), o = E(1), _ = E(null), C = E("asc"), H = D(() => !!e.tabela.mostrarCaixaDeBusca), S = D(() => e.tabela.acoesTabela ?? []), O = D(() => S.value.length > 0), w = D(() => {
const t = e.tabela.registros_por_consulta;
return typeof t == "number" && t > 0 ? Math.floor(t) : 10;
}), J = D(() => {
const t = w.value;
if (!t || t <= 0)
return 1;
const l = v.value;
return l ? Math.max(1, Math.ceil(l / t)) : 1;
});
let Y = 0;
function L(t, l) {
l ? c.set(t, l) : c.delete(t);
}
function ne(t) {
return (l) => {
l instanceof HTMLElement ? L(t, l) : L(t, null);
};
}
function ye(t) {
t && (_.value === t ? (C.value = C.value === "asc" ? "desc" : "asc", n()) : (_.value = t, C.value = "asc", o.value !== 1 ? o.value = 1 : n()));
}
function x(t) {
V.value !== t && (V.value = t, o.value !== 1 ? o.value = 1 : n());
}
function Z(t) {
const l = Math.min(Math.max(1, t), J.value);
l !== o.value && (o.value = l);
}
function ie(t) {
if (i.value === null)
return;
const l = c.get(i.value);
l && l.contains(t.target) || (i.value = null);
}
function se(t) {
return t == null || t === !1 ? "" : t;
}
function ee(t) {
return t === "direita" ? "eli-tabela__celula--direita" : t === "centro" ? "eli-tabela__celula--centro" : "eli-tabela__celula--esquerda";
}
function I(t) {
if (t != null)
return typeof t == "number" ? `${t}px` : String(t);
}
function k(t, l) {
const r = se(t);
if (!!!l.truncar || typeof r != "string" && typeof r != "number")
return r;
const d = String(r);
return h(
"span",
{
class: "eli-tabela__celula-conteudo",
style: l.largura_maxima ? {
maxWidth: I(l.largura_maxima)
} : void 0,
title: d
},
d
);
}
function oe(t) {
return h(
"div",
{
class: "eli-tabela eli-tabela--erro",
role: "alert"
},
[
h("div", { class: "eli-tabela__erro-titulo" }, "Erro"),
h("div", { class: "eli-tabela__erro-mensagem" }, t)
]
);
}
function fe(t) {
return h(
"div",
{
class: "eli-tabela eli-tabela--vazio"
},
t ?? "Nenhum registro encontrado."
);
}
function p() {
return h(
"div",
{
class: "eli-tabela eli-tabela--carregando",
"aria-busy": "true"
},
"Carregando..."
);
}
async function n() {
var d, g;
const t = ++Y;
a.value = !0, s.value = null, y.value = [], i.value = null, c.clear();
const l = Math.max(1, w.value), u = {
offSet: (o.value - 1) * l,
limit: l
};
V.value && (u.texto_busca = V.value), _.value && (u.coluna_ordem = _.value, u.direcao_ordem = C.value);
try {
const b = e.tabela, m = await b.consulta(u);
if (t !== Y)
return;
if (m.cod !== Ne.sucesso) {
f.value = [], v.value = 0, s.value = m.mensagem;
return;
}
const $ = ((d = m.valor) == null ? void 0 : d.valores) ?? [], M = ((g = m.valor) == null ? void 0 : g.quantidade) ?? $.length;
f.value = $, v.value = M;
const N = Math.max(
1,
Math.ceil((M || 0) / l)
);
if (o.value > N) {
o.value = N;
return;
}
const P = b.acoesLinha ?? [];
if (!P.length) {
y.value = [];
return;
}
const F = $.map(
() => P.map((A) => A.exibir === void 0 ? !0 : typeof A.exibir == "boolean" ? A.exibir : !1)
);
y.value = F;
const q = await Promise.all(
$.map(
async (A) => Promise.all(
P.map(async (j) => {
if (j.exibir === void 0)
return !0;
if (typeof j.exibir == "boolean")
return j.exibir;
try {
const X = j.exibir(A);
return !!await Promise.resolve(X);
} catch {
return !1;
}
})
)
)
);
t === Y && (y.value = q);
} catch (b) {
if (t !== Y)
return;
f.value = [], v.value = 0, s.value = b instanceof Error ? b.message : "Erro ao carregar dados.";
} finally {
t === Y && (a.value = !1);
}
}
return qe(() => {
document.addEventListener("click", ie), n();
}), le(
() => e.tabela.mostrarCaixaDeBusca,
(t) => {
!t && V.value && (V.value = "", o.value !== 1 ? o.value = 1 : n());
}
), le(o, (t, l) => {
t !== l && n();
}), We(() => {
document.removeEventListener("click", ie), c.clear();
}), le(
() => e.tabela,
() => {
i.value = null, c.clear(), _.value = null, C.value = "asc", V.value = "", o.value !== 1 ? o.value = 1 : n();
}
), le(
() => e.tabela.registros_por_consulta,
() => {
o.value !== 1 ? o.value = 1 : n();
}
), le(f, () => {
i.value = null, c.clear();
}), () => {
const t = e.tabela;
if (a.value)
return p();
if (s.value)
return oe(s.value);
const l = t.colunas, r = t.acoesLinha ?? [], u = r.length > 0;
if (!f.value.length)
return fe(t.mensagemVazio);
const d = l.map((b) => {
const m = b.coluna_ordem !== void 0 ? b.coluna_ordem : void 0, $ = !!m, M = $ && _.value === m, N = $ ? M ? h(C.value === "asc" ? Be : Na, {
class: "eli-tabela__th-icone",
size: 16,
strokeWidth: 2,
"aria-hidden": "true"
}) : h(Be, {
class: "eli-tabela__th-icone eli-tabela__th-icone--oculto",
size: 16,
strokeWidth: 2,
"aria-hidden": "true"
}) : null, P = $ ? h(
"button",
{
type: "button",
class: [
"eli-tabela__th-botao",
M ? "eli-tabela__th-botao--ativo" : void 0
],
onClick: () => ye(m)
},
[
h("span", { class: "eli-tabela__th-texto" }, b.rotulo),
N
]
) : h("span", { class: "eli-tabela__th-label" }, b.rotulo);
return h(
"th",
{
class: [
"eli-tabela__th",
$ ? "eli-tabela__th--ordenavel" : void 0,
ee(b.alinhamento)
],
scope: "col"
},
P
);
});
u && d.push(
h(
"th",
{ class: "eli-tabela__th eli-tabela__th--acoes", scope: "col" },
"Ações"
)
);
const g = [];
if (H.value || O.value) {
const b = S.value.map(
(m, $) => h(
"button",
{
key: `${m.rotulo}-${$}`,
type: "button",
class: "eli-tabela__acoes-cabecalho-botao",
// Quando `cor` for informada, tratamos como cor de destaque do botão.
// Também ajustamos o texto/ícone para branco para manter contraste.
style: m.cor ? {
backgroundColor: m.cor,
color: "#fff"
} : void 0,
onClick: m.acao
},
[
m.icone ? h(m.icone, {
class: "eli-tabela__acoes-cabecalho-icone",
size: 16,
strokeWidth: 2
}) : null,
h("span", { class: "eli-tabela__acoes-cabecalho-rotulo" }, m.rotulo)
]
)
);
g.push(
h("div", { class: "eli-tabela__cabecalho" }, [
H.value ? h(Wa, {
modelo: V.value,
onBuscar: x
}) : null,
O.value ? h("div", { class: "eli-tabela__acoes-cabecalho" }, b) : null
])
);
}
return g.push(
h("table", { class: "eli-tabela__table" }, [
h(
"thead",
{ class: "eli-tabela__thead" },
h(
"tr",
{ class: "eli-tabela__tr eli-tabela__tr--header" },
d
)
),
h(
"tbody",
{ class: "eli-tabela__tbody" },
f.value.map((b, m) => {
const $ = l.map(
(M, N) => h(
"td",
{
class: [
"eli-tabela__td",
M.acao ? "eli-tabela__td--clicavel" : void 0,
ee(M.alinhamento)
],
key: `${m}-${N}`,
onClick: M.acao ? () => {
var P;
return (P = M.acao) == null ? void 0 : P.call(M);
} : void 0
},
k(M.celula(b), M)
)
);
if (u) {
const M = y.value[m] ?? [], N = r.map((z, me) => {
const $e = z.exibir === void 0 ? !0 : typeof z.exibir == "boolean" ? z.exibir : !1;
return {
acao: z,
indice: me,
visivel: M[me] ?? $e
};
}).filter((z) => z.visivel), P = N.length > 0;
!P && i.value === m && (i.value = null);
const F = i.value === m, q = `eli-tabela-acoes-toggle-${m}`, A = `eli-tabela-acoes-menu-${m}`, j = h(
"button",
{
id: q,
class: "eli-tabela__acoes-toggle",
type: "button",
disabled: !P,
onClick: (z) => {
z.stopPropagation(), P && (i.value = F ? null : m);
},
"aria-haspopup": "menu",
"aria-expanded": F ? "true" : "false",
"aria-controls": P ? A : void 0,
"aria-label": P ? "Ações da linha" : "Nenhuma ação disponível",
title: P ? "Ações" : "Nenhuma ação disponível"
},
[
h(ja, {
class: "eli-tabela__acoes-toggle-icone",
size: 18,
strokeWidth: 2
})
]
), X = F && P ? h(
"ul",
{
id: A,
class: "eli-tabela__acoes-menu",
role: "menu",
"aria-labelledby": q
},
N.map(
({ acao: z, indice: me }) => h(
"li",
{
key: `acao-${me}`,
class: "eli-tabela__acoes-item",
role: "none"
},
h(
"button",
{
type: "button",
class: "eli-tabela__acoes-item-botao",
style: {
color: z.cor
},
onClick: ($e) => {
$e.stopPropagation(), i.value = null, z.acao(b);
},
role: "menuitem",
"aria-label": z.rotulo,
title: z.rotulo
},
[
h(z.icone, {
class: "eli-tabela__acoes-item-icone",
size: 16,
strokeWidth: 2
}),
h(
"span",
{ class: "eli-tabela__acoes-item-texto" },
z.rotulo
)
]
)
)
)
) : null, ae = ["eli-tabela__acoes-container"];
F && ae.push("eli-tabela__acoes-container--aberto"), $.push(
h(
"td",
{
class: ["eli-tabela__td", "eli-tabela__td--acoes"],
key: `${m}-acoes`
},
h(
"div",
{
class: ae,
ref: ne(m)
},
[j, X]
)
)
);
}
return h(
"tr",
{
class: ["eli-tabela__tr", m % 2 === 1 ? "eli-tabela__tr--zebra" : void 0],
key: m
},
$
);
})
)
])
), J.value > 1 && v.value > 0 && g.push(
h(xa, {
pagina: o.value,
totalPaginas: J.value,
maximoBotoes: e.tabela.maximo_botoes_paginacao,
onAlterar: (b) => {
Z(b);
}
})
), h(
"div",
{
class: "eli-tabela"
},
g
);
};
}
});
function at(e, a, s, f, v, y) {
return T(), W("div");
}
const tt = /* @__PURE__ */ Q(et, [["render", at], ["__scopeId", "data-v-40942745"]]), vt = {
install(e) {
e.component("EliOlaMundo", ya), e.component("EliBotao", Oe), e.component("EliBadge", ke), e.component("EliInput", Le), e.component("EliCartao", Sa), e.component("EliDataHora", Aa), e.component("EliTabela", tt);
}
};
export {
ke as EliBadge,
Oe as EliBotao,
Sa as EliCartao,
Aa as EliDataHora,
Le as EliInput,
ya as EliOlaMundo,
tt as EliTabela,
vt as default
};