vue-componentes/dist/eli-vue.es.js
2026-01-29 15:33:42 -03:00

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