vue-componentes/dist/eli-vue.es.js
2026-01-29 10:51:13 -03:00

2766 lines
89 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

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

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