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

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