vue-componentes/dist/eli-vue.es.js

2456 lines
77 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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