vue-componentes/dist/eli-vue.es.js
2026-01-28 11:02:39 -03:00

2176 lines
68 KiB
JavaScript

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