vue-componentes/dist/eli-vue.es.js
2026-01-28 09:44:18 -03:00

1909 lines
62 KiB
JavaScript

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