vue-componentes/dist/eli-vue.es.js
2026-01-28 14:51:47 -03:00

2171 lines
67 KiB
JavaScript

import { defineComponent as N, createBlock as P, openBlock as p, 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 u = e.__vccOpts || e;
for (const [i, c] of a)
u[i] = c;
return u;
};
function ra(e, a, u, i, c, m) {
return p(), 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), u = A(() => e.dot || e.badge !== void 0 ? e.visible : !1), i = A(() => ({
"--eli-badge-radius": a.value
}));
return { showBadge: u, badgeStyle: i };
}
});
function la(e, a, u, i, c, m) {
return e.showBadge ? (p(), 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, ""), u = a.split(",");
return u.length > 2 ? u[0] + "," + u.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: u }) {
const i = w(!1), c = w(!1), m = A({
get: () => e.modelValue,
set: (y) => {
a("update:modelValue", y), a("change", y);
}
}), n = A(
() => [
"text",
"password",
"email",
"search",
"url",
"telefone",
"cpfCnpj",
"numericoInteiro",
"numericoDecimal",
"numericoMoeda",
"porcentagem",
"cep"
].includes(e.type)
), s = A(
() => e.type === "password" ? c.value ? "text" : "password" : "text"
), $ = A(() => {
if (e.type === "telefone") return "tel";
if (e.type === "porcentagem") return "decimal";
if (e.type.startsWith("numerico")) return "numeric";
}), r = A(
() => e.error ? "error" : i.value ? e.color : void 0
);
function h(y) {
const q = y.target;
let _ = q.value;
switch (e.type) {
case "numericoInteiro":
_ = Ve(_);
break;
case "numericoDecimal":
_ = Ne(_);
break;
case "numericoMoeda":
_ = ma(_);
break;
case "porcentagem":
_ = ca(_);
break;
case "telefone":
_ = da(_);
break;
case "cpfCnpj":
_ = sa(_);
break;
case "cep":
_ = pa(_);
break;
}
q.value = _, a("update:modelValue", _), a("change", _);
}
function g() {
c.value = !c.value;
}
const T = A(() => (e.options || []).map((y) => {
if (y && typeof y == "object" && "value" in y) {
const _ = y.value;
return {
label: y.label ?? String(_),
value: _,
disabled: y.disabled
};
}
const q = y;
return { label: String(q), value: q };
}));
return {
attrs: u,
value: m,
isTextLike: n,
inputHtmlType: s,
inputMode: $,
internalColor: r,
showPassword: c,
togglePassword: g,
onInput: h,
onFocus: () => a("focus"),
onBlur: () => a("blur"),
computedItems: T
};
}
}), ba = { class: "eli-input" }, va = {
key: 4,
class: "checkbox-group"
};
function ha(e, a, u, i, c, m) {
return p(), k("div", ba, [
e.isTextLike ? (p(), P(Pe, oe({
key: 0,
modelValue: e.value,
"onUpdate:modelValue": a[0] || (a[0] = (n) => e.value = n),
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" ? (p(), P(aa, oe({
key: 1,
modelValue: e.value,
"onUpdate:modelValue": a[1] || (a[1] = (n) => e.value = n),
label: e.label,
rows: e.rows,
density: e.density,
variant: e.variant
}, e.attrs), null, 16, ["modelValue", "label", "rows", "density", "variant"])) : e.type === "select" ? (p(), P(ea, oe({
key: 2,
modelValue: e.value,
"onUpdate:modelValue": a[2] || (a[2] = (n) => e.value = n),
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" ? (p(), P(xe, {
key: 3,
modelValue: e.value,
"onUpdate:modelValue": a[3] || (a[3] = (n) => e.value = n),
row: e.row
}, {
default: z(() => [
(p(!0), k(K, null, ee(e.computedItems, (n) => (p(), P(Qe, {
key: String(n.value),
label: n.label,
value: n.value
}, null, 8, ["label", "value"]))), 128))
]),
_: 1
}, 8, ["modelValue", "row"])) : e.type === "checkbox" ? (p(), k("div", va, [
(p(!0), k(K, null, ee(e.computedItems, (n) => (p(), P(Ge, {
key: String(n.value),
modelValue: e.value,
"onUpdate:modelValue": a[4] || (a[4] = (s) => e.value = s),
label: n.label,
value: n.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([]), u = w(""), i = w(""), c = w(""), m = w(""), n = w(""), s = w(""), $ = w(""), r = w(""), h = w(""), g = w(null), T = w([]);
return {
nome: e,
email: s,
documento: h,
estado: a,
telefone: i,
mensagem: $,
senha: r,
cor: g,
habilidades: T,
idade: c,
altura: m,
cep: u,
valor: n
};
}
}), ya = { class: "grid-example" };
function $a(e, a, u, i, c, m) {
const n = H("EliBadge"), s = H("EliInput"), $ = H("EliBotao");
return p(), P(ta, null, {
default: z(() => [
V(Te, {
class: "mx-auto",
max_width: "400"
}, {
default: z(() => [
V(Oe, null, {
default: z(() => [
V(n, {
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(s, {
modelValue: e.nome,
"onUpdate:modelValue": a[0] || (a[0] = (r) => e.nome = r),
label: "Nome",
placeholder: "Digite o nome",
density: "compact"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.idade,
"onUpdate:modelValue": a[1] || (a[1] = (r) => e.idade = r),
type: "numericoInteiro",
label: "Idade",
density: "default"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.altura,
"onUpdate:modelValue": a[2] || (a[2] = (r) => e.altura = r),
type: "numericoDecimal",
label: "Altura",
density: "comfortable"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.valor,
"onUpdate:modelValue": a[3] || (a[3] = (r) => e.valor = r),
type: "numericoMoeda",
label: "Valor"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.telefone,
"onUpdate:modelValue": a[4] || (a[4] = (r) => e.telefone = r),
type: "telefone",
label: "Telefone"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.cep,
"onUpdate:modelValue": a[5] || (a[5] = (r) => e.cep = r),
type: "cep",
label: "CEP",
placeholder: "00000-000"
}, null, 8, ["modelValue"]),
V(s, {
type: "select",
label: "Estado",
options: [
{ label: "São Paulo", value: "SP" },
{ label: "Rio de Janeiro", value: "RJ" }
],
modelValue: e.estado,
"onUpdate:modelValue": a[6] || (a[6] = (r) => e.estado = r),
multiple: ""
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.documento,
"onUpdate:modelValue": a[7] || (a[7] = (r) => e.documento = r),
type: "cpfCnpj",
label: "CPF / CNPJ"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.email,
"onUpdate:modelValue": a[8] || (a[8] = (r) => e.email = r),
label: "Email",
placeholder: "email@exemplo.com"
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.senha,
"onUpdate:modelValue": a[9] || (a[9] = (r) => e.senha = r),
label: "Senha",
type: "password",
showPasswordToggle: !0,
placeholder: "Digite sua senha"
}, null, 8, ["modelValue"]),
V(s, {
type: "textarea",
modelValue: e.mensagem,
"onUpdate:modelValue": a[10] || (a[10] = (r) => e.mensagem = r),
label: "Mensagem",
rows: 5
}, null, 8, ["modelValue"]),
V(s, {
type: "radio",
modelValue: e.cor,
"onUpdate:modelValue": a[11] || (a[11] = (r) => e.cor = r),
label: "Cor favorita",
options: [
{ label: "Azul", value: "azul" },
{ label: "Verde", value: "verde" }
]
}, null, 8, ["modelValue"]),
V(s, {
type: "checkbox",
modelValue: e.habilidades,
"onUpdate:modelValue": a[12] || (a[12] = (r) => e.habilidades = r),
options: [
{ label: "Vue", value: "vue" },
{ label: "React", value: "react" }
]
}, null, 8, ["modelValue"]),
V(s, {
modelValue: e.nome,
"onUpdate:modelValue": a[13] || (a[13] = (r) => e.nome = r),
label: "Nome",
error: !0,
"error-messages": ["Obrigatório"]
}, null, 8, ["modelValue"])
])
]),
_: 1
}),
V(Ie, null, {
default: z(() => [
V($, {
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 u = A(() => e.status), i = 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 m() {
a("clicar", e.status);
}
return {
rotuloStatus: u,
corStatus: i,
classeStatus: c,
onClick: m
};
}
}), Ca = { class: "eli-cartao__titulo-texto" }, Va = { class: "eli-cartao__status" };
function Ea(e, a, u, i, c, m) {
const n = H("EliBadge");
return p(), 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(n, {
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 ? (p(), 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 _a = /* @__PURE__ */ j(Aa, [["render", Ea], ["__scopeId", "data-v-6c492bd9"]]);
function Ma(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var he = { exports: {} }, wa = he.exports, _e;
function Sa() {
return _e || (_e = 1, (function(e, a) {
(function(u, i) {
e.exports = i();
})(wa, (function() {
var u = 1e3, i = 6e4, c = 36e5, m = "millisecond", n = "second", s = "minute", $ = "hour", r = "day", h = "week", g = "month", T = "quarter", y = "year", q = "date", _ = "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 t = ["th", "st", "nd", "rd"], o = f % 100;
return "[" + f + (t[(o - 20) % 10] || t[o] || t[0]) + "]";
} }, re = function(f, t, o) {
var d = String(f);
return !d || d.length >= t ? f : "" + Array(t + 1 - d.length).join(o) + f;
}, ke = { s: re, z: function(f) {
var t = -f.utcOffset(), o = Math.abs(t), d = Math.floor(o / 60), l = o % 60;
return (t <= 0 ? "+" : "-") + re(d, 2, "0") + ":" + re(l, 2, "0");
}, m: function f(t, o) {
if (t.date() < o.date()) return -f(o, t);
var d = 12 * (o.year() - t.year()) + (o.month() - t.month()), l = t.clone().add(d, g), v = o - l < 0, b = t.clone().add(d + (v ? -1 : 1), g);
return +(-(d + (o - 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: g, y, w: h, d: r, D: q, h: $, m: s, s: n, ms: m, 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(t, o, d) {
var l;
if (!t) return Z;
if (typeof t == "string") {
var v = t.toLowerCase();
X[v] && (l = v), o && (X[v] = o, l = v);
var b = t.split("-");
if (!l && b.length > 1) return f(b[0]);
} else {
var C = t.name;
X[C] = t, l = C;
}
return !d && l && (Z = l), l || !d && Z;
}, O = function(f, t) {
if (de(f)) return f.clone();
var o = typeof t == "object" ? t : {};
return o.date = f, o.args = arguments, new ae(o);
}, E = ke;
E.l = ne, E.i = de, E.w = function(f, t) {
return O(f, { locale: t.$L, utc: t.$u, x: t.$x, $offset: t.$offset });
};
var ae = (function() {
function f(o) {
this.$L = ne(o.locale, null, !0), this.parse(o), this.$x = this.$x || o.x || {}, this[ue] = !0;
}
var t = f.prototype;
return t.parse = function(o) {
this.$d = (function(d) {
var l = d.date, v = d.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, M = (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, M)) : new Date(b[1], C, b[3] || 1, b[4] || 0, b[5] || 0, b[6] || 0, M);
}
}
return new Date(l);
})(o), this.init();
}, t.init = function() {
var o = this.$d;
this.$y = o.getFullYear(), this.$M = o.getMonth(), this.$D = o.getDate(), this.$W = o.getDay(), this.$H = o.getHours(), this.$m = o.getMinutes(), this.$s = o.getSeconds(), this.$ms = o.getMilliseconds();
}, t.$utils = function() {
return E;
}, t.isValid = function() {
return this.$d.toString() !== _;
}, t.isSame = function(o, d) {
var l = O(o);
return this.startOf(d) <= l && l <= this.endOf(d);
}, t.isAfter = function(o, d) {
return O(o) < this.startOf(d);
}, t.isBefore = function(o, d) {
return this.endOf(d) < O(o);
}, t.$g = function(o, d, l) {
return E.u(o) ? this[d] : this.set(l, o);
}, t.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, t.valueOf = function() {
return this.$d.getTime();
}, t.startOf = function(o, d) {
var l = this, v = !!E.u(d) || d, b = E.p(o), 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(r);
}, M = 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 y:
return v ? C(1, 0) : C(31, 11);
case g:
return v ? C(1, D) : C(0, D + 1);
case h:
var W = this.$locale().weekStart || 0, te = (S < W ? S + 7 : S) - W;
return C(v ? U - te : U + (6 - te), D);
case r:
case q:
return M(F + "Hours", 0);
case $:
return M(F + "Minutes", 1);
case s:
return M(F + "Seconds", 2);
case n:
return M(F + "Milliseconds", 3);
default:
return this.clone();
}
}, t.endOf = function(o) {
return this.startOf(o, !1);
}, t.$set = function(o, d) {
var l, v = E.p(o), b = "set" + (this.$u ? "UTC" : ""), C = (l = {}, l[r] = b + "Date", l[q] = b + "Date", l[g] = b + "Month", l[y] = b + "FullYear", l[$] = b + "Hours", l[s] = b + "Minutes", l[n] = b + "Seconds", l[m] = b + "Milliseconds", l)[v], M = v === r ? this.$D + (d - this.$W) : d;
if (v === g || v === y) {
var S = this.clone().set(q, 1);
S.$d[C](M), S.init(), this.$d = S.set(q, Math.min(this.$D, S.daysInMonth())).$d;
} else C && this.$d[C](M);
return this.init(), this;
}, t.set = function(o, d) {
return this.clone().$set(o, d);
}, t.get = function(o) {
return this[E.p(o)]();
}, t.add = function(o, d) {
var l, v = this;
o = Number(o);
var b = E.p(d), C = function(D) {
var U = O(v);
return E.w(U.date(U.date() + Math.round(D * o)), v);
};
if (b === g) return this.set(g, this.$M + o);
if (b === y) return this.set(y, this.$y + o);
if (b === r) return C(1);
if (b === h) return C(7);
var M = (l = {}, l[s] = i, l[$] = c, l[n] = u, l)[b] || 1, S = this.$d.getTime() + o * M;
return E.w(S, this);
}, t.subtract = function(o, d) {
return this.add(-1 * o, d);
}, t.format = function(o) {
var d = this, l = this.$locale();
if (!this.isValid()) return l.invalidDate || _;
var v = o || "YYYY-MM-DDTHH:mm:ssZ", b = E.z(this), C = this.$H, M = 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(d, 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(d.$y).slice(-2);
case "YYYY":
return E.s(d.$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 d.$D;
case "DD":
return E.s(d.$D, 2, "0");
case "d":
return String(d.$W);
case "dd":
return W(l.weekdaysMin, d.$W, D, 2);
case "ddd":
return W(l.weekdaysShort, d.$W, D, 3);
case "dddd":
return D[d.$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, M, !0);
case "A":
return R(C, M, !1);
case "m":
return String(M);
case "mm":
return E.s(M, 2, "0");
case "s":
return String(d.$s);
case "ss":
return E.s(d.$s, 2, "0");
case "SSS":
return E.s(d.$ms, 3, "0");
case "Z":
return b;
}
return null;
})(I) || b.replace(":", "");
}));
}, t.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, t.diff = function(o, d, l) {
var v, b = this, C = E.p(d), M = O(o), S = (M.utcOffset() - this.utcOffset()) * i, D = this - M, U = function() {
return E.m(b, M);
};
switch (C) {
case y:
v = U() / 12;
break;
case g:
v = U();
break;
case T:
v = U() / 3;
break;
case h:
v = (D - S) / 6048e5;
break;
case r:
v = (D - S) / 864e5;
break;
case $:
v = D / c;
break;
case s:
v = D / i;
break;
case n:
v = D / u;
break;
default:
v = D;
}
return l ? v : E.a(v);
}, t.daysInMonth = function() {
return this.endOf(g).$D;
}, t.$locale = function() {
return X[this.$L];
}, t.locale = function(o, d) {
if (!o) return this.$L;
var l = this.clone(), v = ne(o, d, !0);
return v && (l.$L = v), l;
}, t.clone = function() {
return E.w(this.$d, this);
}, t.toDate = function() {
return new Date(this.valueOf());
}, t.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, t.toISOString = function() {
return this.$d.toISOString();
}, t.toString = function() {
return this.$d.toUTCString();
}, f;
})(), fe = ae.prototype;
return O.prototype = fe, [["$ms", m], ["$s", n], ["$m", s], ["$H", $], ["$W", r], ["$M", g], ["$y", y], ["$D", q]].forEach((function(f) {
fe[f[1]] = function(t) {
return this.$g(t, f[0], f[1]);
};
})), O.extend = function(f, t) {
return f.$i || (f(t, ae, O), f.$i = !0), O;
}, O.locale = ne, O.isDayjs = de, O.unix = function(f) {
return O(1e3 * f);
}, O.en = X[Z], O.Ls = X, O.p = {}, O;
}));
})(he)), he.exports;
}
var Ba = Sa();
const ve = /* @__PURE__ */ Ma(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: u }) {
const i = A(
() => e.modo === "data" ? "date" : "datetime-local"
);
function c(r) {
return e.modo === "data" ? ve(r).format("YYYY-MM-DD") : ve(r).format("YYYY-MM-DDTHH:mm");
}
function m(r) {
return e.modo === "data" ? ve(`${r}T00:00`).format() : ve(r).format();
}
const n = A({
get: () => e.modelValue ? c(e.modelValue) : "",
set: (r) => {
const h = r && r.length > 0 ? r : null;
if (!h) {
a("update:modelValue", null), a("alterar", null);
return;
}
const g = m(h);
a("update:modelValue", g), a("alterar", g);
}
}), s = A(() => {
if (e.min)
return c(e.min);
}), $ = A(() => {
if (e.max)
return c(e.max);
});
return { attrs: u, valor: n, emit: a, minLocal: s, maxLocal: $, tipoInput: i };
}
}), Pa = { class: "eli-data-hora" };
function Ta(e, a, u, i, c, m) {
return p(), k("div", Pa, [
V(Pe, oe({
modelValue: e.valor,
"onUpdate:modelValue": a[0] || (a[0] = (n) => e.valor = n),
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] = (n) => e.emit("foco")),
onBlur: a[2] || (a[2] = (n) => 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 Me = (e) => e === "";
/**
* @license lucide-vue-next v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Ia = (...e) => e.filter((a, u, i) => !!a && a.trim() !== "" && i.indexOf(a) === u).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, u, i) => i ? i.toUpperCase() : u.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: u,
"absolute-stroke-width": i,
strokeWidth: c,
"stroke-width": m,
size: n = me.width,
color: s = me.stroke,
...$
}, { slots: r }) => Ae(
"svg",
{
...me,
...$,
width: n,
height: n,
stroke: s,
"stroke-width": Me(u) || Me(i) || u === !0 || i === !0 ? Number(c || m || me["stroke-width"]) * 24 / Number(n) : c || m || me["stroke-width"],
class: Ia(
"lucide",
$.class,
...e ? [`lucide-${we(Na(e))}-icon`, `lucide-${we(e)}`] : ["lucide-icon"]
),
...!r.default && !qa($) && { "aria-hidden": "true" }
},
[...a.map((h) => Ae(...h)), ...r.default ? [r.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) => (u, { slots: i, attrs: c }) => Ae(
ja,
{
...c,
...u,
iconNode: a,
name: e
},
i
);
/**
* @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 u = w(e.modelo ?? "");
le(
() => e.modelo,
(c) => {
c !== void 0 && c !== u.value && (u.value = c);
}
);
function i() {
a("buscar", u.value.trim());
}
return { texto: u, emitirBusca: i };
}
}), Ya = { class: "eli-tabela__busca" }, Fa = { class: "eli-tabela__busca-input-wrapper" };
function Ra(e, a, u, i, c, m) {
const n = H("Search");
return p(), k("div", Ya, [
B("div", Fa, [
He(B("input", {
id: "eli-tabela-busca",
"onUpdate:modelValue": a[0] || (a[0] = (s) => e.texto = s),
type: "search",
class: "eli-tabela__busca-input",
placeholder: "Digite termos para filtrar",
onKeyup: a[1] || (a[1] = Ye((...s) => e.emitirBusca && e.emitirBusca(...s), ["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] = (...s) => e.emitirBusca && e.emitirBusca(...s))
}, [
V(n, {
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 u = A(() => e.acoesCabecalho.length > 0);
function i(c) {
a("buscar", c);
}
return { temAcoesCabecalho: u, emitBuscar: i };
}
}), 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, u, i, c, m) {
const n = H("EliTabelaCaixaDeBusca");
return p(), k("div", Za, [
e.exibirBusca ? (p(), P(n, {
key: 0,
modelo: e.valorBusca,
onBuscar: e.emitBuscar
}, null, 8, ["modelo", "onBuscar"])) : J("", !0),
e.temAcoesCabecalho ? (p(), k("div", Xa, [
(p(!0), k(K, null, ee(e.acoesCabecalho, (s, $) => (p(), k("button", {
key: `${s.rotulo}-${$}`,
type: "button",
class: "eli-tabela__acoes-cabecalho-botao",
style: ge(s.cor ? { backgroundColor: s.cor, color: "#fff" } : void 0),
onClick: s.acao
}, [
s.icone ? (p(), P(ye(s.icone), {
key: 0,
class: "eli-tabela__acoes-cabecalho-icone",
size: 16,
"stroke-width": 2
})) : J("", !0),
B("span", Ka, Y(s.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, u, i, c, m) {
return e.carregando ? (p(), k("div", at, " Carregando... ")) : e.erro ? (p(), k("div", tt, [
a[0] || (a[0] = B("div", { class: "eli-tabela__erro-titulo" }, "Erro", -1)),
B("div", ot, Y(e.erro), 1)
])) : (p(), 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, u, i, c, m) {
return e.isDev ? (p(), 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 u(m) {
return (m == null ? void 0 : m.coluna_ordem) !== void 0 && (m == null ? void 0 : m.coluna_ordem) !== null;
}
function i(m) {
return m === "direita" ? "eli-tabela__celula--direita" : m === "centro" ? "eli-tabela__celula--centro" : "eli-tabela__celula--esquerda";
}
function c(m) {
a("alternarOrdenacao", m);
}
return {
ArrowUp: Be,
ArrowDown: Se,
isOrdenavel: u,
obterClasseAlinhamento: i,
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, u, i, c, m) {
const n = H("ArrowUp");
return p(), k("thead", mt, [
B("tr", pt, [
(p(!0), k(K, null, ee(e.colunas, (s, $) => (p(), k("th", {
key: `th-${$}`,
class: se(["eli-tabela__th", [
e.isOrdenavel(s) ? "eli-tabela__th--ordenavel" : void 0,
e.obterClasseAlinhamento(s.alinhamento)
]]),
scope: "col"
}, [
e.isOrdenavel(s) ? (p(), k("button", {
key: 0,
type: "button",
class: se(["eli-tabela__th-botao", [
e.colunaOrdenacao === String(s.coluna_ordem) ? "eli-tabela__th-botao--ativo" : void 0
]]),
onClick: (r) => e.emitAlternarOrdenacao(String(s.coluna_ordem))
}, [
B("span", bt, Y(s.rotulo), 1),
e.colunaOrdenacao === String(s.coluna_ordem) ? (p(), P(ye(e.direcaoOrdenacao === "asc" ? e.ArrowUp : e.ArrowDown), {
key: 0,
class: "eli-tabela__th-icone",
size: 16,
"stroke-width": 2,
"aria-hidden": "true"
})) : (p(), P(n, {
key: 1,
class: "eli-tabela__th-icone eli-tabela__th-icone--oculto",
size: 16,
"stroke-width": 2,
"aria-hidden": "true"
}))
], 10, ft)) : (p(), k("span", vt, Y(s.rotulo), 1))
], 2))), 128)),
e.temAcoes ? (p(), 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, u, i, c, m) {
var n;
return Y((n = e.dados) == null ? void 0 : n.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, u, i, c, m) {
var n;
return Y(String((n = e.dados) == null ? void 0 : n.numero).replace(".", ","));
}
const Et = /* @__PURE__ */ j(Ct, [["render", Vt]]), _t = {
textoSimples: At,
numero: Et
}, Mt = N({
name: "EliTabelaCelula",
props: {
celula: {
// `ComponenteCelula` é uma tupla `readonly [tipo, dados]`.
type: Array,
required: !0
}
},
setup(e) {
const a = A(() => e.celula[0]), u = A(() => e.celula[1]), i = A(() => _t[a.value]), c = A(() => u.value);
return { Componente: i, dadosParaComponente: c };
}
});
function wt(e, a, u, i, c, m) {
return p(), P(ye(e.Componente), { dados: e.dadosParaComponente }, null, 8, ["dados"]);
}
const St = /* @__PURE__ */ j(Mt, [["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
},
toggleMenu: {
type: Function,
required: !0
}
},
setup() {
function e(i) {
return i === "direita" ? "eli-tabela__celula--direita" : i === "centro" ? "eli-tabela__celula--centro" : "eli-tabela__celula--esquerda";
}
function a(i) {
if (i != null)
return typeof i == "number" ? `${i}px` : String(i);
}
function u(i) {
if (!Array.isArray(i)) return;
const c = i[0], m = i[1];
if (c === "textoSimples")
return typeof (m == null ? void 0 : m.texto) == "string" ? m.texto : void 0;
if (c === "numero")
return typeof (m == null ? void 0 : m.numero) == "number" ? String(m.numero) : void 0;
}
return {
obterClasseAlinhamento: e,
obterMaxWidth: a,
obterTooltipCelula: u
};
}
}), Dt = { class: "eli-tabela__tbody" }, Pt = ["onClick"], Tt = ["title"], Ot = ["id", "disabled", "aria-expanded", "aria-controls", "aria-label", "title", "onClick"];
function qt(e, a, u, i, c, m) {
const n = H("EliTabelaCelula"), s = H("MoreVertical");
return p(), k("tbody", Dt, [
(p(!0), k(K, null, ee(e.linhas, ($, r) => (p(), k("tr", {
key: `tr-${r}`,
class: se(["eli-tabela__tr", [r % 2 === 1 ? "eli-tabela__tr--zebra" : void 0]])
}, [
(p(!0), k(K, null, ee(e.colunas, (h, g) => (p(), k("td", {
key: `td-${r}-${g}`,
class: se(["eli-tabela__td", [
h.acao ? "eli-tabela__td--clicavel" : void 0,
e.obterClasseAlinhamento(h.alinhamento)
]]),
onClick: (T) => h.acao ? () => {
var y;
return (y = h.acao) == null ? void 0 : y.call(h);
} : void 0
}, [
h.truncar ? (p(), k("span", {
key: 0,
class: "eli-tabela__celula-conteudo",
style: ge(h.largura_maxima ? { maxWidth: e.obterMaxWidth(h.largura_maxima) } : void 0),
title: e.obterTooltipCelula(h.celula($))
}, [
V(n, {
celula: h.celula($)
}, null, 8, ["celula"])
], 12, Tt)) : (p(), P(n, {
key: 1,
celula: h.celula($)
}, null, 8, ["celula"]))
], 10, Pt))), 128)),
e.temAcoes ? (p(), k("td", {
class: "eli-tabela__td eli-tabela__td--acoes",
key: `td-${r}-acoes`
}, [
B("div", {
class: se(["eli-tabela__acoes-container", [e.menuAberto === r ? "eli-tabela__acoes-container--aberto" : void 0]])
}, [
B("button", {
class: "eli-tabela__acoes-toggle",
type: "button",
id: `eli-tabela-acoes-toggle-${r}`,
disabled: !e.possuiAcoes(r),
"aria-haspopup": "menu",
"aria-expanded": e.menuAberto === r ? "true" : "false",
"aria-controls": e.possuiAcoes(r) ? `eli-tabela-acoes-menu-${r}` : void 0,
"aria-label": e.possuiAcoes(r) ? "Ações da linha" : "Nenhuma ação disponível",
title: e.possuiAcoes(r) ? "Ações" : "Nenhuma ação disponível",
onClick: De((h) => e.toggleMenu(r, h), ["stop"])
}, [
V(s, {
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: u }) {
const i = w(null);
u({ menuEl: i });
const c = A(() => e.acoes.length > 0);
function m(n) {
e.linha && a("executar", { acao: n.acao, linha: e.linha });
}
return { menuEl: i, possuiAcoes: c, emitExecutar: m };
}
}), Nt = ["id", "aria-labelledby"], jt = ["aria-label", "title", "onClick"], zt = { class: "eli-tabela__acoes-item-texto" };
function Lt(e, a, u, i, c, m) {
return p(), P(Re, { to: "body" }, [
e.menuAberto !== null && e.possuiAcoes ? (p(), 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
})
}, [
(p(!0), k(K, null, ee(e.acoes, (n) => (p(), k("li", {
key: `acao-${e.menuAberto}-${n.indice}`,
class: "eli-tabela__acoes-item",
role: "none"
}, [
B("button", {
type: "button",
class: "eli-tabela__acoes-item-botao",
style: ge({ color: n.acao.cor }),
role: "menuitem",
"aria-label": n.acao.rotulo,
title: n.acao.rotulo,
onClick: De((s) => e.emitExecutar(n), ["stop"])
}, [
(p(), P(ye(n.acao.icone), {
class: "eli-tabela__acoes-item-icone",
size: 16,
"stroke-width": 2
})),
B("span", zt, Y(n.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 u = A(() => {
const r = e.maximoBotoes;
return typeof r == "number" && r >= 5 ? Math.floor(r) : 7;
}), i = A(() => {
const r = e.totalPaginas, h = e.pagina, g = u.value, T = [], y = (L) => {
T.push({
label: String(L),
pagina: L,
ativo: L === h
});
}, q = () => {
T.push({ label: "…", ehEllipsis: !0 });
};
if (r <= g) {
for (let L = 1; L <= r; L += 1)
y(L);
return T;
}
const _ = Math.max(3, g - 2);
let Q = Math.max(2, h - Math.floor(_ / 2)), x = Q + _ - 1;
x >= r && (x = r - 1, Q = x - _ + 1), y(1), Q > 2 && q();
for (let L = Q; L <= x; L += 1)
y(L);
return x < r - 1 && q(), y(r), T;
});
function c(r) {
if (!r)
return;
const h = Math.min(Math.max(1, r), e.totalPaginas);
h !== e.pagina && a("alterar", h);
}
const m = A(() => e.pagina <= 1), n = A(() => e.pagina >= e.totalPaginas), s = A(() => e.pagina), $ = A(() => e.totalPaginas);
return {
botoes: i,
irParaPagina: c,
anteriorDesabilitado: m,
proximaDesabilitada: n,
paginaAtual: s,
totalPaginasExibidas: $
};
}
}), 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, u, i, c, m) {
return e.totalPaginasExibidas > 1 ? (p(), 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] = (n) => e.irParaPagina(e.paginaAtual - 1))
}, " << ", 8, Rt),
(p(!0), k(K, null, ee(e.botoes, (n, s) => (p(), k(K, {
key: `${n.label}-${s}`
}, [
n.ehEllipsis ? (p(), k("span", Wt, Y(n.label), 1)) : (p(), k("button", {
key: 1,
type: "button",
class: se(["eli-tabela__pagina-botao", n.ativo ? "eli-tabela__pagina-botao--ativo" : void 0]),
disabled: n.ativo,
"aria-current": n.ativo ? "page" : void 0,
"aria-label": `Ir para página ${n.label}`,
onClick: ($) => e.irParaPagina(n.pagina)
}, Y(n.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] = (n) => 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 u = w(!1), i = w(null), c = w([]), m = w(0), n = w([]), s = w(null), $ = w(null), r = w({ top: 0, left: 0 }), h = w(""), g = w(1), T = w(null), y = w("asc"), q = A(() => e.tabela), _ = A(() => !!e.tabela.mostrarCaixaDeBusca), Q = A(() => e.tabela.acoesTabela ?? []), x = A(() => Q.value.length > 0), L = A(() => {
const t = e.tabela.registros_por_consulta;
return typeof t == "number" && t > 0 ? Math.floor(t) : 10;
}), re = A(() => {
const t = L.value;
if (!t || t <= 0) return 1;
const o = m.value;
return o ? Math.max(1, Math.ceil(o / t)) : 1;
}), ke = A(() => (e.tabela.acoesLinha ?? []).length > 0);
let Z = 0;
function X(t) {
var M, S, D, U, F, W;
const o = t.getBoundingClientRect(), d = 8, l = ((D = (S = (M = $.value) == null ? void 0 : M.menuEl) == null ? void 0 : S.value) == null ? void 0 : D.offsetHeight) ?? 0, v = ((W = (F = (U = $.value) == null ? void 0 : U.menuEl) == null ? void 0 : F.value) == null ? void 0 : W.offsetWidth) ?? 180;
let b = o.bottom + d;
const C = o.right - v;
l && b + l > window.innerHeight - d && (b = o.top - d - l), r.value = {
top: Math.max(d, Math.round(b)),
left: Math.max(d, Math.round(C))
};
}
function ue(t) {
var d, l;
if (s.value === null) return;
const o = t.target;
(l = (d = $.value) == null ? void 0 : d.menuEl) != null && l.value && $.value.menuEl.value.contains(o) || (s.value = null);
}
function de(t) {
if (t) {
if (T.value === t) {
y.value = y.value === "asc" ? "desc" : "asc", f();
return;
}
T.value = t, y.value = "asc", g.value !== 1 ? g.value = 1 : f();
}
}
function ne(t) {
h.value !== t && (h.value = t, g.value !== 1 ? g.value = 1 : f());
}
function O(t) {
const o = Math.min(Math.max(1, t), re.value);
o !== g.value && (g.value = o);
}
function E(t) {
const o = e.tabela.acoesLinha ?? [], d = n.value[t] ?? [];
return o.map((l, v) => {
const b = l.exibir === void 0 ? !0 : typeof l.exibir == "boolean" ? l.exibir : !1;
return {
acao: l,
indice: v,
visivel: d[v] ?? b
};
}).filter((l) => l.visivel);
}
function ae(t) {
return E(t).length > 0;
}
function fe(t, o) {
if (!ae(t)) return;
if (s.value === t) {
s.value = null;
return;
}
s.value = t;
const d = (o == null ? void 0 : o.currentTarget) ?? null;
d && (X(d), requestAnimationFrame(() => X(d)));
}
async function f() {
var v, b;
const t = ++Z;
u.value = !0, i.value = null, n.value = [], s.value = null;
const o = Math.max(1, L.value), l = {
offSet: (g.value - 1) * o,
limit: o
};
h.value && (l.texto_busca = h.value), T.value && (l.coluna_ordem = T.value, l.direcao_ordem = y.value);
try {
const C = e.tabela, M = await C.consulta(l);
if (t !== Z) return;
if (M.cod !== ze.sucesso) {
c.value = [], m.value = 0, i.value = M.mensagem;
return;
}
const S = ((v = M.valor) == null ? void 0 : v.valores) ?? [], D = ((b = M.valor) == null ? void 0 : b.quantidade) ?? S.length;
c.value = S, m.value = D;
const U = Math.max(1, Math.ceil((D || 0) / o));
if (g.value > U) {
g.value = U;
return;
}
const F = C.acoesLinha ?? [];
if (!F.length) {
n.value = [];
return;
}
const W = S.map(
() => F.map((R) => R.exibir === void 0 ? !0 : typeof R.exibir == "boolean" ? R.exibir : !1)
);
n.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;
}
})
)
)
);
t === Z && (n.value = te);
} catch (C) {
if (t !== Z) return;
c.value = [], m.value = 0, i.value = C instanceof Error ? C.message : "Erro ao carregar dados.";
} finally {
t === Z && (u.value = !1);
}
}
return We(() => {
document.addEventListener("click", ue), f();
}), Je(() => {
document.removeEventListener("click", ue);
}), le(
() => e.tabela.mostrarCaixaDeBusca,
(t) => {
!t && h.value && (h.value = "", g.value !== 1 ? g.value = 1 : f());
}
), le(g, (t, o) => {
t !== o && f();
}), le(
() => e.tabela,
() => {
s.value = null, T.value = null, y.value = "asc", h.value = "", g.value !== 1 ? g.value = 1 : f();
}
), le(
() => e.tabela.registros_por_consulta,
() => {
g.value !== 1 ? g.value = 1 : f();
}
), le(c, () => {
s.value = null;
}), {
// state
isDev: !1,
tabela: q,
carregando: u,
erro: i,
linhas: c,
quantidade: m,
menuAberto: s,
valorBusca: h,
paginaAtual: g,
colunaOrdenacao: T,
direcaoOrdenacao: y,
totalPaginas: re,
// computed
exibirBusca: _,
acoesCabecalho: Q,
temAcoesCabecalho: x,
temAcoes: ke,
// actions
alternarOrdenacao: de,
atualizarBusca: ne,
irParaPagina: O,
acoesDisponiveisPorLinha: E,
possuiAcoes: ae,
toggleMenu: fe,
// popup
menuPopup: $,
menuPopupPos: r
};
}
}), Qt = { class: "eli-tabela" }, xt = { class: "eli-tabela__table" };
function eo(e, a, u, i, c, m) {
const n = H("EliTabelaDebug"), s = H("EliTabelaEstados"), $ = H("EliTabelaCabecalho"), r = H("EliTabelaHead"), h = H("EliTabelaBody"), g = H("EliTabelaMenuAcoes"), T = H("EliTabelaPaginacao");
return p(), k("div", Qt, [
V(n, {
isDev: e.isDev,
menuAberto: e.menuAberto,
menuPopupPos: e.menuPopupPos
}, null, 8, ["isDev", "menuAberto", "menuPopupPos"]),
e.carregando || e.erro || !e.linhas.length ? (p(), P(s, {
key: 0,
carregando: e.carregando,
erro: e.erro,
mensagemVazio: e.tabela.mensagemVazio
}, null, 8, ["carregando", "erro", "mensagemVazio"])) : (p(), k(K, { key: 1 }, [
e.exibirBusca || e.temAcoesCabecalho ? (p(), P($, {
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(r, {
colunas: e.tabela.colunas,
temAcoes: e.temAcoes,
colunaOrdenacao: e.colunaOrdenacao,
direcaoOrdenacao: e.direcaoOrdenacao,
onAlternarOrdenacao: e.alternarOrdenacao
}, null, 8, ["colunas", "temAcoes", "colunaOrdenacao", "direcaoOrdenacao", "onAlternarOrdenacao"]),
V(h, {
colunas: e.tabela.colunas,
linhas: e.linhas,
temAcoes: e.temAcoes,
menuAberto: e.menuAberto,
possuiAcoes: e.possuiAcoes,
toggleMenu: e.toggleMenu
}, null, 8, ["colunas", "linhas", "temAcoes", "menuAberto", "possuiAcoes", "toggleMenu"])
]),
V(g, {
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[0] || (a[0] = ({ acao: y, linha: q }) => {
e.menuAberto = null, y.acao(q);
})
}, null, 8, ["menuAberto", "posicao", "acoes", "linha"]),
e.totalPaginas > 1 && e.quantidade > 0 ? (p(), 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", _a), e.component("EliDataHora", Oa), e.component("EliTabela", ao);
}
};
export {
Ce as EliBadge,
Ue as EliBotao,
_a as EliCartao,
Oa as EliDataHora,
je as EliInput,
ka as EliOlaMundo,
ao as EliTabela,
bo as default
};