vue-componentes/dist/eli-vue.es.js
2026-01-29 19:07:57 -03:00

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