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

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