vue-componentes/dist/eli-vue.es.js
2026-01-27 17:11:13 -03:00

1960 lines
61 KiB
JavaScript

import { defineComponent as J, createBlock as W, openBlock as E, mergeProps as ee, withCtx as L, renderSlot as le, computed as V, ref as B, createElementBlock as R, createCommentVNode as Ve, createSlots as je, createVNode as D, createTextVNode as de, toDisplayString as ne, Fragment as be, renderList as $e, resolveComponent as ce, createElementVNode as K, h, watch as re, withDirectives as Le, withKeys as He, vModelText as Ye, normalizeClass as ze, resolveDynamicComponent as Fe, onMounted as qe, onBeforeUnmount as We } from "vue";
import { VBtn as Re } from "vuetify/components/VBtn";
import { VBadge as Je } from "vuetify/components/VBadge";
import { VCheckbox as Ze } from "vuetify/components/VCheckbox";
import { VIcon as Xe } from "vuetify/components/VIcon";
import { VRadio as Ge } from "vuetify/components/VRadio";
import { VRadioGroup as Ke } from "vuetify/components/VRadioGroup";
import { VSelect as Qe } from "vuetify/components/VSelect";
import { VTextField as Be } from "vuetify/components/VTextField";
import { VTextarea as xe } from "vuetify/components/VTextarea";
import { VCard as Ee, VCardTitle as Pe, VCardText as Te, VCardActions as Ae } from "vuetify/components/VCard";
import { VContainer as ea } from "vuetify/components/VGrid";
const aa = J({
name: "EliBotao",
inheritAttrs: !1,
props: {
color: {
type: String,
default: "primary"
},
variant: {
type: String,
default: "elevated"
},
size: {
type: String,
default: "default"
},
disabled: {
type: Boolean,
default: !1
},
loading: {
type: Boolean,
default: !1
}
}
}), Z = (e, a) => {
const s = e.__vccOpts || e;
for (const [d, p] of a)
s[d] = p;
return s;
};
function ta(e, a, s, d, p, y) {
return E(), W(Re, ee({
color: e.color,
variant: e.variant,
size: e.size,
disabled: e.disabled,
loading: e.loading
}, e.$attrs, { class: "text-none pt-1" }), {
default: L(() => [
le(e.$slots, "default")
]),
_: 3
}, 16, ["color", "variant", "size", "disabled", "loading"]);
}
const Oe = /* @__PURE__ */ Z(aa, [["render", ta]]), ke = {
suave: "4px",
pill: "10px"
}, oa = J({
name: "EliBadge",
inheritAttrs: !1,
props: {
color: {
type: String,
default: "primary"
},
location: {
type: String,
default: "top right"
},
offsetX: {
type: String,
default: "0"
},
offsetY: {
type: String,
default: "0"
},
dot: {
type: Boolean,
default: !1
},
visible: {
type: Boolean,
default: !0
},
badge: {
type: [String, Number],
default: void 0
},
/** 🔥 NOVO: controla só o radius */
radius: {
type: String,
default: "suave"
}
},
setup(e) {
const a = V(() => e.radius in ke ? ke[e.radius] : e.radius), s = V(() => e.dot || e.badge !== void 0 ? e.visible : !1), d = V(() => ({
"--eli-badge-radius": a.value
}));
return { showBadge: s, badgeStyle: d };
}
});
function ra(e, a, s, d, p, y) {
return e.showBadge ? (E(), W(Je, ee({
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
}), {
default: L(() => [
le(e.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 16, ["color", "location", "offset-x", "offset-y", "dot", "content", "style"])) : le(e.$slots, "default", { key: 1 }, void 0, !0);
}
const Se = /* @__PURE__ */ Z(oa, [["render", ra], ["__scopeId", "data-v-de2fbf2f"]]);
function la(e) {
return e.replace(/\D+/g, "");
}
function na(e) {
const a = la(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 ia(e) {
return e.replace(/\D+/g, "");
}
function sa(e) {
const a = ia(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 we(e) {
return e.replace(/\D+/g, "");
}
function Ie(e) {
const a = e.replace(/[^\d,]/g, ""), s = a.split(",");
return s.length > 2 ? s[0] + "," + s.slice(1).join("") : a;
}
function ua(e) {
return Ie(e.replace(/%/g, ""));
}
function da(e) {
const a = we(e);
return a ? (parseInt(a, 10) / 100).toFixed(2).replace(".", ",").replace(/\B(?=(\d{3})+(?!\d))/g, ".") : "";
}
function ca(e) {
const a = we(e).slice(0, 8);
return a.length <= 5 ? a : a.replace(/^(\d{5})(\d{1,3})$/, "$1-$2");
}
const fa = J({
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: s }) {
const d = B(!1), p = B(!1), y = V({
get: () => e.modelValue,
set: (M) => {
a("update:modelValue", M), a("change", M);
}
}), l = V(
() => [
"text",
"password",
"email",
"search",
"url",
"telefone",
"cpfCnpj",
"numericoInteiro",
"numericoDecimal",
"numericoMoeda",
"porcentagem",
"cep"
].includes(e.type)
), f = V(
() => e.type === "password" ? p.value ? "text" : "password" : "text"
), S = V(() => {
if (e.type === "telefone") return "tel";
if (e.type === "porcentagem") return "decimal";
if (e.type.startsWith("numerico")) return "numeric";
}), r = V(
() => e.error ? "error" : d.value ? e.color : void 0
);
function _(M) {
const N = M.target;
let w = N.value;
switch (e.type) {
case "numericoInteiro":
w = we(w);
break;
case "numericoDecimal":
w = Ie(w);
break;
case "numericoMoeda":
w = da(w);
break;
case "porcentagem":
w = ua(w);
break;
case "telefone":
w = sa(w);
break;
case "cpfCnpj":
w = na(w);
break;
case "cep":
w = ca(w);
break;
}
N.value = w, a("update:modelValue", w), a("change", w);
}
function C() {
p.value = !p.value;
}
const z = V(() => (e.options || []).map((M) => {
if (M && typeof M == "object" && "value" in M) {
const w = M.value;
return {
label: M.label ?? String(w),
value: w,
disabled: M.disabled
};
}
const N = M;
return { label: String(N), value: N };
}));
return {
attrs: s,
value: y,
isTextLike: l,
inputHtmlType: f,
inputMode: S,
internalColor: r,
showPassword: p,
togglePassword: C,
onInput: _,
onFocus: () => a("focus"),
onBlur: () => a("blur"),
computedItems: z
};
}
}), ma = { class: "eli-input" }, pa = {
key: 4,
class: "checkbox-group"
};
function va(e, a, s, d, p, y) {
return E(), R("div", ma, [
e.isTextLike ? (E(), W(Be, ee({
key: 0,
modelValue: e.value,
"onUpdate:modelValue": a[0] || (a[0] = (l) => e.value = l),
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: L(() => [
D(Xe, {
class: "cursor-pointer",
onClick: e.togglePassword
}, {
default: L(() => [
de(ne(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" ? (E(), W(xe, ee({
key: 1,
modelValue: e.value,
"onUpdate:modelValue": a[1] || (a[1] = (l) => e.value = l),
label: e.label,
rows: e.rows,
density: e.density,
variant: e.variant
}, e.attrs), null, 16, ["modelValue", "label", "rows", "density", "variant"])) : e.type === "select" ? (E(), W(Qe, ee({
key: 2,
modelValue: e.value,
"onUpdate:modelValue": a[2] || (a[2] = (l) => e.value = l),
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" ? (E(), W(Ke, {
key: 3,
modelValue: e.value,
"onUpdate:modelValue": a[3] || (a[3] = (l) => e.value = l),
row: e.row
}, {
default: L(() => [
(E(!0), R(be, null, $e(e.computedItems, (l) => (E(), W(Ge, {
key: String(l.value),
label: l.label,
value: l.value
}, null, 8, ["label", "value"]))), 128))
]),
_: 1
}, 8, ["modelValue", "row"])) : e.type === "checkbox" ? (E(), R("div", pa, [
(E(!0), R(be, null, $e(e.computedItems, (l) => (E(), W(Ze, {
key: String(l.value),
modelValue: e.value,
"onUpdate:modelValue": a[4] || (a[4] = (f) => e.value = f),
label: l.label,
value: l.value,
density: e.density
}, null, 8, ["modelValue", "label", "value", "density"]))), 128))
])) : Ve("", !0)
]);
}
const Ue = /* @__PURE__ */ Z(fa, [["render", va], ["__scopeId", "data-v-756cb549"]]), ba = J({
name: "EliOlaMundo",
components: {
EliBotao: Oe,
EliBadge: Se,
EliInput: Ue
},
setup() {
const e = B(""), a = B([]), s = B(""), d = B(""), p = B(""), y = B(""), l = B(""), f = B(""), S = B(""), r = B(""), _ = B(""), C = B(null), z = B([]);
return {
nome: e,
email: f,
documento: _,
estado: a,
telefone: d,
mensagem: S,
senha: r,
cor: C,
habilidades: z,
idade: p,
altura: y,
cep: s,
valor: l
};
}
}), ha = { class: "grid-example" };
function ga(e, a, s, d, p, y) {
const l = ce("EliBadge"), f = ce("EliInput"), S = ce("EliBotao");
return E(), W(ea, null, {
default: L(() => [
D(Ee, {
class: "mx-auto",
max_width: "400"
}, {
default: L(() => [
D(Pe, null, {
default: L(() => [
D(l, {
badge: "Novo",
"offset-x": "-15",
location: "right center"
}, {
default: L(() => [...a[14] || (a[14] = [
de(" Olá Mundo! ", -1)
])]),
_: 1
})
]),
_: 1
}),
D(Te, null, {
default: L(() => [
a[15] || (a[15] = de(" Este é um componente de exemplo integrado com Vuetify. ", -1)),
K("div", ha, [
D(f, {
modelValue: e.nome,
"onUpdate:modelValue": a[0] || (a[0] = (r) => e.nome = r),
label: "Nome",
placeholder: "Digite o nome",
density: "compact"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.idade,
"onUpdate:modelValue": a[1] || (a[1] = (r) => e.idade = r),
type: "numericoInteiro",
label: "Idade",
density: "default"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.altura,
"onUpdate:modelValue": a[2] || (a[2] = (r) => e.altura = r),
type: "numericoDecimal",
label: "Altura",
density: "comfortable"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.valor,
"onUpdate:modelValue": a[3] || (a[3] = (r) => e.valor = r),
type: "numericoMoeda",
label: "Valor"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.telefone,
"onUpdate:modelValue": a[4] || (a[4] = (r) => e.telefone = r),
type: "telefone",
label: "Telefone"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.cep,
"onUpdate:modelValue": a[5] || (a[5] = (r) => e.cep = r),
type: "cep",
label: "CEP",
placeholder: "00000-000"
}, null, 8, ["modelValue"]),
D(f, {
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"]),
D(f, {
modelValue: e.documento,
"onUpdate:modelValue": a[7] || (a[7] = (r) => e.documento = r),
type: "cpfCnpj",
label: "CPF / CNPJ"
}, null, 8, ["modelValue"]),
D(f, {
modelValue: e.email,
"onUpdate:modelValue": a[8] || (a[8] = (r) => e.email = r),
label: "Email",
placeholder: "email@exemplo.com"
}, null, 8, ["modelValue"]),
D(f, {
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"]),
D(f, {
type: "textarea",
modelValue: e.mensagem,
"onUpdate:modelValue": a[10] || (a[10] = (r) => e.mensagem = r),
label: "Mensagem",
rows: 5
}, null, 8, ["modelValue"]),
D(f, {
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"]),
D(f, {
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"]),
D(f, {
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
}),
D(Ae, null, {
default: L(() => [
D(S, {
color: "primary",
variant: "elevated",
block: ""
}, {
default: L(() => [...a[16] || (a[16] = [
de(" Botão Vuetify ", -1)
])]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
});
}
const ya = /* @__PURE__ */ Z(ba, [["render", ga]]), $a = J({
name: "EliCartao",
components: { EliBadge: Se },
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 s = V(() => e.status), d = V(() => {
switch (e.status) {
case "novo":
return "primary";
case "rascunho":
return "secondary";
case "vendido":
return "success";
case "cancelado":
return "error";
}
}), p = V(() => `eli-cartao--${e.status}`);
function y() {
a("clicar", e.status);
}
return {
rotuloStatus: s,
corStatus: d,
classeStatus: p,
onClick: y
};
}
}), Va = { class: "eli-cartao__titulo-texto" }, Sa = { class: "eli-cartao__status" };
function wa(e, a, s, d, p, y) {
const l = ce("EliBadge");
return E(), W(Ee, ee({
class: ["eli-cartao", e.classeStatus],
variant: e.variant
}, e.$attrs), {
default: L(() => [
D(Pe, { class: "eli-cartao__titulo" }, {
default: L(() => [
K("div", Va, [
le(e.$slots, "titulo", {}, () => [
de(ne(e.titulo), 1)
], !0)
]),
K("div", Sa, [
D(l, {
badge: e.rotuloStatus,
radius: "pill",
color: e.corStatus
}, {
default: L(() => [...a[0] || (a[0] = [
K("span", null, null, -1)
])]),
_: 1
}, 8, ["badge", "color"])
])
]),
_: 3
}),
D(Te, { class: "eli-cartao__conteudo" }, {
default: L(() => [
le(e.$slots, "default", {}, void 0, !0)
]),
_: 3
}),
e.$slots.acoes ? (E(), W(Ae, {
key: 0,
class: "eli-cartao__acoes"
}, {
default: L(() => [
le(e.$slots, "acoes", {}, void 0, !0)
]),
_: 3
})) : Ve("", !0)
]),
_: 3
}, 16, ["variant", "class"]);
}
const ka = /* @__PURE__ */ Z($a, [["render", wa], ["__scopeId", "data-v-6c492bd9"]]);
function Ma(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var ve = { exports: {} }, Ca = ve.exports, Me;
function _a() {
return Me || (Me = 1, (function(e, a) {
(function(s, d) {
e.exports = d();
})(Ca, (function() {
var s = 1e3, d = 6e4, p = 36e5, y = "millisecond", l = "second", f = "minute", S = "hour", r = "day", _ = "week", C = "month", z = "quarter", M = "year", N = "date", w = "Invalid Date", X = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, F = /\[([^\]]+)]|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, H = { 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(u) {
var t = ["th", "st", "nd", "rd"], o = u % 100;
return "[" + u + (t[(o - 20) % 10] || t[o] || t[0]) + "]";
} }, ie = function(u, t, o) {
var i = String(u);
return !i || i.length >= t ? u : "" + Array(t + 1 - i.length).join(o) + u;
}, ge = { s: ie, z: function(u) {
var t = -u.utcOffset(), o = Math.abs(t), i = Math.floor(o / 60), n = o % 60;
return (t <= 0 ? "+" : "-") + ie(i, 2, "0") + ":" + ie(n, 2, "0");
}, m: function u(t, o) {
if (t.date() < o.date()) return -u(o, t);
var i = 12 * (o.year() - t.year()) + (o.month() - t.month()), n = t.clone().add(i, C), v = o - n < 0, m = t.clone().add(i + (v ? -1 : 1), C);
return +(-(i + (o - n) / (v ? n - m : m - n)) || 0);
}, a: function(u) {
return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
}, p: function(u) {
return { M: C, y: M, w: _, d: r, D: N, h: S, m: f, s: l, ms: y, Q: z }[u] || String(u || "").toLowerCase().replace(/s$/, "");
}, u: function(u) {
return u === void 0;
} }, x = "en", G = {};
G[x] = H;
var se = "$isDayjsObject", ae = function(u) {
return u instanceof oe || !(!u || !u[se]);
}, te = function u(t, o, i) {
var n;
if (!t) return x;
if (typeof t == "string") {
var v = t.toLowerCase();
G[v] && (n = v), o && (G[v] = o, n = v);
var m = t.split("-");
if (!n && m.length > 1) return u(m[0]);
} else {
var b = t.name;
G[b] = t, n = b;
}
return !i && n && (x = n), n || !i && x;
}, O = function(u, t) {
if (ae(u)) return u.clone();
var o = typeof t == "object" ? t : {};
return o.date = u, o.args = arguments, new oe(o);
}, k = ge;
k.l = te, k.i = ae, k.w = function(u, t) {
return O(u, { locale: t.$L, utc: t.$u, x: t.$x, $offset: t.$offset });
};
var oe = (function() {
function u(o) {
this.$L = te(o.locale, null, !0), this.parse(o), this.$x = this.$x || o.x || {}, this[se] = !0;
}
var t = u.prototype;
return t.parse = function(o) {
this.$d = (function(i) {
var n = i.date, v = i.utc;
if (n === null) return /* @__PURE__ */ new Date(NaN);
if (k.u(n)) return /* @__PURE__ */ new Date();
if (n instanceof Date) return new Date(n);
if (typeof n == "string" && !/Z$/i.test(n)) {
var m = n.match(X);
if (m) {
var b = m[2] - 1 || 0, c = (m[7] || "0").substring(0, 3);
return v ? new Date(Date.UTC(m[1], b, m[3] || 1, m[4] || 0, m[5] || 0, m[6] || 0, c)) : new Date(m[1], b, m[3] || 1, m[4] || 0, m[5] || 0, m[6] || 0, c);
}
}
return new Date(n);
})(o), this.init();
}, t.init = function() {
var o = this.$d;
this.$y = o.getFullYear(), this.$M = o.getMonth(), this.$D = o.getDate(), this.$W = o.getDay(), this.$H = o.getHours(), this.$m = o.getMinutes(), this.$s = o.getSeconds(), this.$ms = o.getMilliseconds();
}, t.$utils = function() {
return k;
}, t.isValid = function() {
return this.$d.toString() !== w;
}, t.isSame = function(o, i) {
var n = O(o);
return this.startOf(i) <= n && n <= this.endOf(i);
}, t.isAfter = function(o, i) {
return O(o) < this.startOf(i);
}, t.isBefore = function(o, i) {
return this.endOf(i) < O(o);
}, t.$g = function(o, i, n) {
return k.u(o) ? this[i] : this.set(n, o);
}, t.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, t.valueOf = function() {
return this.$d.getTime();
}, t.startOf = function(o, i) {
var n = this, v = !!k.u(i) || i, m = k.p(o), b = function(U, T) {
var Y = k.w(n.$u ? Date.UTC(n.$y, T, U) : new Date(n.$y, T, U), n);
return v ? Y : Y.endOf(r);
}, c = function(U, T) {
return k.w(n.toDate()[U].apply(n.toDate("s"), (v ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(T)), n);
}, $ = this.$W, g = this.$M, A = this.$D, P = "set" + (this.$u ? "UTC" : "");
switch (m) {
case M:
return v ? b(1, 0) : b(31, 11);
case C:
return v ? b(1, g) : b(0, g + 1);
case _:
var j = this.$locale().weekStart || 0, q = ($ < j ? $ + 7 : $) - j;
return b(v ? A - q : A + (6 - q), g);
case r:
case N:
return c(P + "Hours", 0);
case S:
return c(P + "Minutes", 1);
case f:
return c(P + "Seconds", 2);
case l:
return c(P + "Milliseconds", 3);
default:
return this.clone();
}
}, t.endOf = function(o) {
return this.startOf(o, !1);
}, t.$set = function(o, i) {
var n, v = k.p(o), m = "set" + (this.$u ? "UTC" : ""), b = (n = {}, n[r] = m + "Date", n[N] = m + "Date", n[C] = m + "Month", n[M] = m + "FullYear", n[S] = m + "Hours", n[f] = m + "Minutes", n[l] = m + "Seconds", n[y] = m + "Milliseconds", n)[v], c = v === r ? this.$D + (i - this.$W) : i;
if (v === C || v === M) {
var $ = this.clone().set(N, 1);
$.$d[b](c), $.init(), this.$d = $.set(N, Math.min(this.$D, $.daysInMonth())).$d;
} else b && this.$d[b](c);
return this.init(), this;
}, t.set = function(o, i) {
return this.clone().$set(o, i);
}, t.get = function(o) {
return this[k.p(o)]();
}, t.add = function(o, i) {
var n, v = this;
o = Number(o);
var m = k.p(i), b = function(g) {
var A = O(v);
return k.w(A.date(A.date() + Math.round(g * o)), v);
};
if (m === C) return this.set(C, this.$M + o);
if (m === M) return this.set(M, this.$y + o);
if (m === r) return b(1);
if (m === _) return b(7);
var c = (n = {}, n[f] = d, n[S] = p, n[l] = s, n)[m] || 1, $ = this.$d.getTime() + o * c;
return k.w($, this);
}, t.subtract = function(o, i) {
return this.add(-1 * o, i);
}, t.format = function(o) {
var i = this, n = this.$locale();
if (!this.isValid()) return n.invalidDate || w;
var v = o || "YYYY-MM-DDTHH:mm:ssZ", m = k.z(this), b = this.$H, c = this.$m, $ = this.$M, g = n.weekdays, A = n.months, P = n.meridiem, j = function(T, Y, Q, I) {
return T && (T[Y] || T(i, v)) || Q[Y].slice(0, I);
}, q = function(T) {
return k.s(b % 12 || 12, T, "0");
}, U = P || function(T, Y, Q) {
var I = T < 12 ? "AM" : "PM";
return Q ? I.toLowerCase() : I;
};
return v.replace(F, (function(T, Y) {
return Y || (function(Q) {
switch (Q) {
case "YY":
return String(i.$y).slice(-2);
case "YYYY":
return k.s(i.$y, 4, "0");
case "M":
return $ + 1;
case "MM":
return k.s($ + 1, 2, "0");
case "MMM":
return j(n.monthsShort, $, A, 3);
case "MMMM":
return j(A, $);
case "D":
return i.$D;
case "DD":
return k.s(i.$D, 2, "0");
case "d":
return String(i.$W);
case "dd":
return j(n.weekdaysMin, i.$W, g, 2);
case "ddd":
return j(n.weekdaysShort, i.$W, g, 3);
case "dddd":
return g[i.$W];
case "H":
return String(b);
case "HH":
return k.s(b, 2, "0");
case "h":
return q(1);
case "hh":
return q(2);
case "a":
return U(b, c, !0);
case "A":
return U(b, c, !1);
case "m":
return String(c);
case "mm":
return k.s(c, 2, "0");
case "s":
return String(i.$s);
case "ss":
return k.s(i.$s, 2, "0");
case "SSS":
return k.s(i.$ms, 3, "0");
case "Z":
return m;
}
return null;
})(T) || m.replace(":", "");
}));
}, t.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, t.diff = function(o, i, n) {
var v, m = this, b = k.p(i), c = O(o), $ = (c.utcOffset() - this.utcOffset()) * d, g = this - c, A = function() {
return k.m(m, c);
};
switch (b) {
case M:
v = A() / 12;
break;
case C:
v = A();
break;
case z:
v = A() / 3;
break;
case _:
v = (g - $) / 6048e5;
break;
case r:
v = (g - $) / 864e5;
break;
case S:
v = g / p;
break;
case f:
v = g / d;
break;
case l:
v = g / s;
break;
default:
v = g;
}
return n ? v : k.a(v);
}, t.daysInMonth = function() {
return this.endOf(C).$D;
}, t.$locale = function() {
return G[this.$L];
}, t.locale = function(o, i) {
if (!o) return this.$L;
var n = this.clone(), v = te(o, i, !0);
return v && (n.$L = v), n;
}, t.clone = function() {
return k.w(this.$d, this);
}, t.toDate = function() {
return new Date(this.valueOf());
}, t.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, t.toISOString = function() {
return this.$d.toISOString();
}, t.toString = function() {
return this.$d.toUTCString();
}, u;
})(), fe = oe.prototype;
return O.prototype = fe, [["$ms", y], ["$s", l], ["$m", f], ["$H", S], ["$W", r], ["$M", C], ["$y", M], ["$D", N]].forEach((function(u) {
fe[u[1]] = function(t) {
return this.$g(t, u[0], u[1]);
};
})), O.extend = function(u, t) {
return u.$i || (u(t, oe, O), u.$i = !0), O;
}, O.locale = te, O.isDayjs = ae, O.unix = function(u) {
return O(1e3 * u);
}, O.en = G[x], O.Ls = G, O.p = {}, O;
}));
})(ve)), ve.exports;
}
var Da = _a();
const pe = /* @__PURE__ */ Ma(Da), Ba = J({
name: "EliDataHora",
inheritAttrs: !1,
props: {
/**
* Valor em ISO 8601:
* - com offset (ex.: `2026-01-09T13:15:00-03:00`)
* - ou UTC absoluto (ex.: `2026-01-09T16:15:00Z`)
*/
modelValue: {
type: String,
default: null
},
/**
* Define o tipo de entrada.
* - `dataHora`: usa `datetime-local`
* - `data`: usa `date`
*/
modo: {
type: String,
default: "dataHora"
},
/** Rótulo exibido no v-text-field (Vuetify). */
rotulo: {
type: String,
default: "Data e hora"
},
/** Placeholder do input. */
placeholder: {
type: String,
default: ""
},
/** Desabilita a interação. */
desabilitado: {
type: Boolean,
default: !1
},
/** Se true, mostra ícone para limpar o valor (Vuetify clearable). */
limpavel: {
type: Boolean,
default: !1
},
/** Estado de erro (visual). */
erro: {
type: Boolean,
default: !1
},
/** Mensagens de erro. */
mensagensErro: {
type: [String, Array],
default: () => []
},
/** Texto de apoio. */
dica: {
type: String,
default: ""
},
/** Mantém a dica sempre visível. */
dicaPersistente: {
type: Boolean,
default: !1
},
/** Densidade do campo (Vuetify). */
densidade: {
type: String,
default: "comfortable"
},
/** Variante do v-text-field (Vuetify). */
variante: {
type: String,
default: "outlined"
},
/**
* Valor mínimo permitido.
* ISO 8601 (offset ou `Z`).
*/
min: {
// ISO 8601 (offset ou Z)
type: String,
default: void 0
},
/**
* Valor máximo permitido.
* ISO 8601 (offset ou `Z`).
*/
max: {
// ISO 8601 (offset ou Z)
type: String,
default: void 0
}
},
emits: {
/** v-model padrão. */
"update:modelValue": (e) => !0,
/** Alias para consumidores que querem um evento semântico. */
alterar: (e) => !0,
foco: () => !0,
desfoco: () => !0
},
setup(e, { emit: a, attrs: s }) {
const d = V(
() => e.modo === "data" ? "date" : "datetime-local"
);
function p(r) {
return e.modo === "data" ? pe(r).format("YYYY-MM-DD") : pe(r).format("YYYY-MM-DDTHH:mm");
}
function y(r) {
return e.modo === "data" ? pe(`${r}T00:00`).format() : pe(r).format();
}
const l = V({
get: () => e.modelValue ? p(e.modelValue) : "",
set: (r) => {
const _ = r && r.length > 0 ? r : null;
if (!_) {
a("update:modelValue", null), a("alterar", null);
return;
}
const C = y(_);
a("update:modelValue", C), a("alterar", C);
}
}), f = V(() => {
if (e.min)
return p(e.min);
}), S = V(() => {
if (e.max)
return p(e.max);
});
return { attrs: s, valor: l, emit: a, minLocal: f, maxLocal: S, tipoInput: d };
}
}), Ea = { class: "eli-data-hora" };
function Pa(e, a, s, d, p, y) {
return E(), R("div", Ea, [
D(Be, ee({
modelValue: e.valor,
"onUpdate:modelValue": a[0] || (a[0] = (l) => e.valor = l),
type: e.tipoInput,
label: e.rotulo,
placeholder: e.placeholder,
disabled: e.desabilitado,
clearable: e.limpavel,
error: e.erro,
"error-messages": e.mensagensErro,
hint: e.dica,
"persistent-hint": e.dicaPersistente,
density: e.densidade,
variant: e.variante,
min: e.minLocal,
max: e.maxLocal
}, e.attrs, {
onFocus: a[1] || (a[1] = (l) => e.emit("foco")),
onBlur: a[2] || (a[2] = (l) => e.emit("desfoco"))
}), null, 16, ["modelValue", "type", "label", "placeholder", "disabled", "clearable", "error", "error-messages", "hint", "persistent-hint", "density", "variant", "min", "max"])
]);
}
const Ta = /* @__PURE__ */ Z(Ba, [["render", Pa], ["__scopeId", "data-v-71afabb6"]]);
/**
* @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 Aa = (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 Ce = (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 Oa = (...e) => e.filter((a, s, d) => !!a && a.trim() !== "" && d.indexOf(a) === s).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 _e = (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 Ia = (e) => e.replace(
/^([A-Z])|[\s-_]+(\w)/g,
(a, s, d) => d ? d.toUpperCase() : s.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 Ua = (e) => {
const a = Ia(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 ue = {
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 Na = ({
name: e,
iconNode: a,
absoluteStrokeWidth: s,
"absolute-stroke-width": d,
strokeWidth: p,
"stroke-width": y,
size: l = ue.width,
color: f = ue.stroke,
...S
}, { slots: r }) => h(
"svg",
{
...ue,
...S,
width: l,
height: l,
stroke: f,
"stroke-width": Ce(s) || Ce(d) || s === !0 || d === !0 ? Number(p || y || ue["stroke-width"]) * 24 / Number(l) : p || y || ue["stroke-width"],
class: Oa(
"lucide",
S.class,
...e ? [`lucide-${_e(Ua(e))}-icon`, `lucide-${_e(e)}`] : ["lucide-icon"]
),
...!r.default && !Aa(S) && { "aria-hidden": "true" }
},
[...a.map((_) => h(..._)), ...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 he = (e, a) => (s, { slots: d, attrs: p }) => h(
Na,
{
...p,
...s,
iconNode: a,
name: e
},
d
);
/**
* @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 = he("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 De = he("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 La = he("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 Ha = he("search", [
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
]);
var Ne = ((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))(Ne || {});
const Ya = J({
name: "EliTabelaCaixaDeBusca",
components: { Search: Ha },
props: {
modelo: {
type: String,
required: !1,
default: ""
}
},
emits: {
buscar(e) {
return typeof e == "string";
}
},
setup(e, { emit: a }) {
const s = B(e.modelo ?? "");
re(
() => e.modelo,
(p) => {
p !== void 0 && p !== s.value && (s.value = p);
}
);
function d() {
a("buscar", s.value.trim());
}
return { texto: s, emitirBusca: d };
}
}), za = { class: "eli-tabela__busca" }, Fa = { class: "eli-tabela__busca-input-wrapper" };
function qa(e, a, s, d, p, y) {
const l = ce("Search");
return E(), R("div", za, [
K("div", Fa, [
Le(K("input", {
id: "eli-tabela-busca",
"onUpdate:modelValue": a[0] || (a[0] = (f) => e.texto = f),
type: "search",
class: "eli-tabela__busca-input",
placeholder: "Digite termos para filtrar",
onKeyup: a[1] || (a[1] = He((...f) => e.emitirBusca && e.emitirBusca(...f), ["enter"]))
}, null, 544), [
[Ye, e.texto]
]),
K("button", {
type: "button",
class: "eli-tabela__busca-botao",
"aria-label": "Buscar",
title: "Buscar",
onClick: a[2] || (a[2] = (...f) => e.emitirBusca && e.emitirBusca(...f))
}, [
D(l, {
class: "eli-tabela__busca-botao-icone",
size: 16,
"stroke-width": 2,
"aria-hidden": "true"
})
])
])
]);
}
const Wa = /* @__PURE__ */ Z(Ya, [["render", qa], ["__scopeId", "data-v-0fd1ad15"]]), Ra = J({
name: "EliTabelaPaginacao",
props: {
pagina: {
type: Number,
required: !0
},
totalPaginas: {
type: Number,
required: !0
},
maximoBotoes: {
type: Number,
required: !1
}
},
emits: {
alterar(e) {
return Number.isFinite(e);
}
},
setup(e, { emit: a }) {
const s = V(() => {
const r = e.maximoBotoes;
return typeof r == "number" && r >= 5 ? Math.floor(r) : 7;
}), d = V(() => {
const r = e.totalPaginas, _ = e.pagina, C = s.value, z = [], M = (H) => {
z.push({
label: String(H),
pagina: H,
ativo: H === _
});
}, N = () => {
z.push({ label: "…", ehEllipsis: !0 });
};
if (r <= C) {
for (let H = 1; H <= r; H += 1)
M(H);
return z;
}
const w = Math.max(3, C - 2);
let X = Math.max(2, _ - Math.floor(w / 2)), F = X + w - 1;
F >= r && (F = r - 1, X = F - w + 1), M(1), X > 2 && N();
for (let H = X; H <= F; H += 1)
M(H);
return F < r - 1 && N(), M(r), z;
});
function p(r) {
if (!r)
return;
const _ = Math.min(Math.max(1, r), e.totalPaginas);
_ !== e.pagina && a("alterar", _);
}
const y = V(() => e.pagina <= 1), l = V(() => e.pagina >= e.totalPaginas), f = V(() => e.pagina), S = V(() => e.totalPaginas);
return {
botoes: d,
irParaPagina: p,
anteriorDesabilitado: y,
proximaDesabilitada: l,
paginaAtual: f,
totalPaginasExibidas: S
};
}
}), Ja = {
key: 0,
class: "eli-tabela__paginacao",
role: "navigation",
"aria-label": "Paginação de resultados"
}, Za = ["disabled"], Xa = {
key: 0,
class: "eli-tabela__pagina-ellipsis",
"aria-hidden": "true"
}, Ga = ["disabled", "aria-current", "aria-label", "onClick"], Ka = ["disabled"];
function Qa(e, a, s, d, p, y) {
return e.totalPaginasExibidas > 1 ? (E(), R("nav", Ja, [
K("button", {
type: "button",
class: "eli-tabela__pagina-botao",
disabled: e.anteriorDesabilitado,
"aria-label": "Página anterior",
onClick: a[0] || (a[0] = (l) => e.irParaPagina(e.paginaAtual - 1))
}, " << ", 8, Za),
(E(!0), R(be, null, $e(e.botoes, (l, f) => (E(), R(be, {
key: `${l.label}-${f}`
}, [
l.ehEllipsis ? (E(), R("span", Xa, ne(l.label), 1)) : (E(), R("button", {
key: 1,
type: "button",
class: ze(["eli-tabela__pagina-botao", l.ativo ? "eli-tabela__pagina-botao--ativo" : void 0]),
disabled: l.ativo,
"aria-current": l.ativo ? "page" : void 0,
"aria-label": `Ir para página ${l.label}`,
onClick: (S) => e.irParaPagina(l.pagina)
}, ne(l.label), 11, Ga))
], 64))), 128)),
K("button", {
type: "button",
class: "eli-tabela__pagina-botao",
disabled: e.proximaDesabilitada,
"aria-label": "Próxima página",
onClick: a[1] || (a[1] = (l) => e.irParaPagina(e.paginaAtual + 1))
}, " >> ", 8, Ka)
])) : Ve("", !0);
}
const xa = /* @__PURE__ */ Z(Ra, [["render", Qa], ["__scopeId", "data-v-59d12455"]]), et = J({
name: "EliTabelaCelulaTextoSimples",
components: {},
props: {
dados: {
type: Object
}
},
data() {
return {};
},
methods: {},
setup({ dados: e }) {
return { dados: e };
}
});
function at(e, a, s, d, p, y) {
var l;
return ne((l = e.dados) == null ? void 0 : l.texto);
}
const tt = /* @__PURE__ */ Z(et, [["render", at]]), ot = J({
name: "EliTabelaCelulaNumero",
components: {},
props: {
dados: {
type: Object
}
},
data() {
return {};
},
methods: {},
setup({ dados: e }) {
return { dados: e };
}
});
function rt(e, a, s, d, p, y) {
var l;
return ne(String((l = e.dados) == null ? void 0 : l.numero).replace(".", ","));
}
const lt = /* @__PURE__ */ Z(ot, [["render", rt]]), nt = {
textoSimples: tt,
numero: lt
}, it = J({
name: "EliTabelaCelula",
props: {
celula: {
// `ComponenteCelula` é uma tupla `readonly [tipo, dados]`.
type: Array,
required: !0
}
},
setup(e) {
const a = V(() => e.celula[0]), s = V(() => e.celula[1]), d = V(() => nt[a.value]), p = V(() => s.value);
return { Componente: d, dadosParaComponente: p };
}
});
function st(e, a, s, d, p, y) {
return E(), W(Fe(e.Componente), { dados: e.dadosParaComponente }, null, 8, ["dados"]);
}
const ut = /* @__PURE__ */ Z(it, [["render", st]]), dt = J({
name: "EliTabela",
inheritAttrs: !1,
props: {
tabela: {
// Observação: este componente é “generic-friendly”.
// Usamos `any` aqui para permitir passar `EliTabelaConsulta<T>` de qualquer T
// sem brigar com invariância do TS (por causa do callback `celula(linha: T)`).
type: Object,
required: !0
}
},
setup(e) {
const a = B(!1), s = B(null), d = B([]), p = B(0), y = B([]), l = B(null), f = /* @__PURE__ */ new Map(), S = B(""), r = B(1), _ = B(null), C = B("asc"), z = V(() => !!e.tabela.mostrarCaixaDeBusca), M = V(() => e.tabela.acoesTabela ?? []), N = V(() => M.value.length > 0), w = V(() => {
const t = e.tabela.registros_por_consulta;
return typeof t == "number" && t > 0 ? Math.floor(t) : 10;
}), X = V(() => {
const t = w.value;
if (!t || t <= 0)
return 1;
const o = p.value;
return o ? Math.max(1, Math.ceil(o / t)) : 1;
});
let F = 0;
function H(t, o) {
o ? f.set(t, o) : f.delete(t);
}
function ie(t) {
return (o) => {
o instanceof HTMLElement ? H(t, o) : H(t, null);
};
}
function ge(t) {
t && (_.value === t ? (C.value = C.value === "asc" ? "desc" : "asc", u()) : (_.value = t, C.value = "asc", r.value !== 1 ? r.value = 1 : u()));
}
function x(t) {
S.value !== t && (S.value = t, r.value !== 1 ? r.value = 1 : u());
}
function G(t) {
const o = Math.min(Math.max(1, t), X.value);
o !== r.value && (r.value = o);
}
function se(t) {
if (l.value === null)
return;
const o = f.get(l.value);
o && o.contains(t.target) || (l.value = null);
}
function ae(t) {
return t === "direita" ? "eli-tabela__celula--direita" : t === "centro" ? "eli-tabela__celula--centro" : "eli-tabela__celula--esquerda";
}
function te(t) {
if (t != null)
return typeof t == "number" ? `${t}px` : String(t);
}
function O(t) {
if (!Array.isArray(t))
return;
const o = t[0], i = t[1];
if (o === "textoSimples")
return typeof (i == null ? void 0 : i.texto) == "string" ? i.texto : void 0;
if (o === "numero")
return typeof (i == null ? void 0 : i.numero) == "number" ? String(i.numero) : void 0;
}
function k(t) {
return h(
"div",
{
class: "eli-tabela eli-tabela--erro",
role: "alert"
},
[
h("div", { class: "eli-tabela__erro-titulo" }, "Erro"),
h("div", { class: "eli-tabela__erro-mensagem" }, t)
]
);
}
function oe(t) {
return h(
"div",
{
class: "eli-tabela eli-tabela--vazio"
},
t ?? "Nenhum registro encontrado."
);
}
function fe() {
return h(
"div",
{
class: "eli-tabela eli-tabela--carregando",
"aria-busy": "true"
},
"Carregando..."
);
}
async function u() {
var v, m;
const t = ++F;
a.value = !0, s.value = null, y.value = [], l.value = null, f.clear();
const o = Math.max(1, w.value), n = {
offSet: (r.value - 1) * o,
limit: o
};
S.value && (n.texto_busca = S.value), _.value && (n.coluna_ordem = _.value, n.direcao_ordem = C.value);
try {
const b = e.tabela, c = await b.consulta(n);
if (t !== F)
return;
if (c.cod !== Ne.sucesso) {
d.value = [], p.value = 0, s.value = c.mensagem;
return;
}
const $ = ((v = c.valor) == null ? void 0 : v.valores) ?? [], g = ((m = c.valor) == null ? void 0 : m.quantidade) ?? $.length;
d.value = $, p.value = g;
const A = Math.max(
1,
Math.ceil((g || 0) / o)
);
if (r.value > A) {
r.value = A;
return;
}
const P = b.acoesLinha ?? [];
if (!P.length) {
y.value = [];
return;
}
const j = $.map(
() => P.map((U) => U.exibir === void 0 ? !0 : typeof U.exibir == "boolean" ? U.exibir : !1)
);
y.value = j;
const q = await Promise.all(
$.map(
async (U) => Promise.all(
P.map(async (T) => {
if (T.exibir === void 0)
return !0;
if (typeof T.exibir == "boolean")
return T.exibir;
try {
const Y = T.exibir(U);
return !!await Promise.resolve(Y);
} catch {
return !1;
}
})
)
)
);
t === F && (y.value = q);
} catch (b) {
if (t !== F)
return;
d.value = [], p.value = 0, s.value = b instanceof Error ? b.message : "Erro ao carregar dados.";
} finally {
t === F && (a.value = !1);
}
}
return qe(() => {
document.addEventListener("click", se), u();
}), re(
() => e.tabela.mostrarCaixaDeBusca,
(t) => {
!t && S.value && (S.value = "", r.value !== 1 ? r.value = 1 : u());
}
), re(r, (t, o) => {
t !== o && u();
}), We(() => {
document.removeEventListener("click", se), f.clear();
}), re(
() => e.tabela,
() => {
l.value = null, f.clear(), _.value = null, C.value = "asc", S.value = "", r.value !== 1 ? r.value = 1 : u();
}
), re(
() => e.tabela.registros_por_consulta,
() => {
r.value !== 1 ? r.value = 1 : u();
}
), re(d, () => {
l.value = null, f.clear();
}), () => {
const t = e.tabela;
if (a.value)
return fe();
if (s.value)
return k(s.value);
const o = t.colunas, i = t.acoesLinha ?? [], n = i.length > 0;
if (!d.value.length)
return oe(t.mensagemVazio);
const v = o.map((b) => {
const c = b.coluna_ordem !== void 0 ? b.coluna_ordem : void 0, $ = !!c, g = $ && _.value === c, A = $ ? g ? h(C.value === "asc" ? De : ja, {
class: "eli-tabela__th-icone",
size: 16,
strokeWidth: 2,
"aria-hidden": "true"
}) : h(De, {
class: "eli-tabela__th-icone eli-tabela__th-icone--oculto",
size: 16,
strokeWidth: 2,
"aria-hidden": "true"
}) : null, P = $ ? h(
"button",
{
type: "button",
class: [
"eli-tabela__th-botao",
g ? "eli-tabela__th-botao--ativo" : void 0
],
onClick: () => ge(c)
},
[
h("span", { class: "eli-tabela__th-texto" }, b.rotulo),
A
]
) : h("span", { class: "eli-tabela__th-label" }, b.rotulo);
return h(
"th",
{
class: [
"eli-tabela__th",
$ ? "eli-tabela__th--ordenavel" : void 0,
ae(b.alinhamento)
],
scope: "col"
},
P
);
});
n && v.push(
h(
"th",
{ class: "eli-tabela__th eli-tabela__th--acoes", scope: "col" },
"Ações"
)
);
const m = [];
if (z.value || N.value) {
const b = M.value.map(
(c, $) => h(
"button",
{
key: `${c.rotulo}-${$}`,
type: "button",
class: "eli-tabela__acoes-cabecalho-botao",
// Quando `cor` for informada, tratamos como cor de destaque do botão.
// Também ajustamos o texto/ícone para branco para manter contraste.
style: c.cor ? {
backgroundColor: c.cor,
color: "#fff"
} : void 0,
onClick: c.acao
},
[
c.icone ? h(c.icone, {
class: "eli-tabela__acoes-cabecalho-icone",
size: 16,
strokeWidth: 2
}) : null,
h("span", { class: "eli-tabela__acoes-cabecalho-rotulo" }, c.rotulo)
]
)
);
m.push(
h("div", { class: "eli-tabela__cabecalho" }, [
z.value ? h(Wa, {
modelo: S.value,
onBuscar: x
}) : null,
N.value ? h("div", { class: "eli-tabela__acoes-cabecalho" }, b) : null
])
);
}
return m.push(
h("table", { class: "eli-tabela__table" }, [
h(
"thead",
{ class: "eli-tabela__thead" },
h(
"tr",
{ class: "eli-tabela__tr eli-tabela__tr--header" },
v
)
),
h(
"tbody",
{ class: "eli-tabela__tbody" },
d.value.map((b, c) => {
const $ = o.map(
(g, A) => (() => {
const P = g.celula(b), j = !!g.truncar, q = j ? O(P) : void 0, U = h(ut, {
celula: P
}), T = j ? h(
"span",
{
class: "eli-tabela__celula-conteudo",
style: g.largura_maxima ? {
maxWidth: te(g.largura_maxima)
} : void 0,
title: q
},
U
) : U;
return h(
"td",
{
class: [
"eli-tabela__td",
g.acao ? "eli-tabela__td--clicavel" : void 0,
ae(g.alinhamento)
],
key: `${c}-${A}`,
onClick: g.acao ? () => {
var Y;
return (Y = g.acao) == null ? void 0 : Y.call(g);
} : void 0
},
T
);
})()
);
if (n) {
const g = y.value[c] ?? [], A = i.map((I, me) => {
const ye = I.exibir === void 0 ? !0 : typeof I.exibir == "boolean" ? I.exibir : !1;
return {
acao: I,
indice: me,
visivel: g[me] ?? ye
};
}).filter((I) => I.visivel), P = A.length > 0;
!P && l.value === c && (l.value = null);
const j = l.value === c, q = `eli-tabela-acoes-toggle-${c}`, U = `eli-tabela-acoes-menu-${c}`, T = h(
"button",
{
id: q,
class: "eli-tabela__acoes-toggle",
type: "button",
disabled: !P,
onClick: (I) => {
I.stopPropagation(), P && (l.value = j ? null : c);
},
"aria-haspopup": "menu",
"aria-expanded": j ? "true" : "false",
"aria-controls": P ? U : void 0,
"aria-label": P ? "Ações da linha" : "Nenhuma ação disponível",
title: P ? "Ações" : "Nenhuma ação disponível"
},
[
h(La, {
class: "eli-tabela__acoes-toggle-icone",
size: 18,
strokeWidth: 2
})
]
), Y = j && P ? h(
"ul",
{
id: U,
class: "eli-tabela__acoes-menu",
role: "menu",
"aria-labelledby": q
},
A.map(
({ acao: I, indice: me }) => h(
"li",
{
key: `acao-${me}`,
class: "eli-tabela__acoes-item",
role: "none"
},
h(
"button",
{
type: "button",
class: "eli-tabela__acoes-item-botao",
style: {
color: I.cor
},
onClick: (ye) => {
ye.stopPropagation(), l.value = null, I.acao(b);
},
role: "menuitem",
"aria-label": I.rotulo,
title: I.rotulo
},
[
h(I.icone, {
class: "eli-tabela__acoes-item-icone",
size: 16,
strokeWidth: 2
}),
h(
"span",
{ class: "eli-tabela__acoes-item-texto" },
I.rotulo
)
]
)
)
)
) : null, Q = ["eli-tabela__acoes-container"];
j && Q.push("eli-tabela__acoes-container--aberto"), $.push(
h(
"td",
{
class: ["eli-tabela__td", "eli-tabela__td--acoes"],
key: `${c}-acoes`
},
h(
"div",
{
class: Q,
ref: ie(c)
},
[T, Y]
)
)
);
}
return h(
"tr",
{
class: ["eli-tabela__tr", c % 2 === 1 ? "eli-tabela__tr--zebra" : void 0],
key: c
},
$
);
})
)
])
), X.value > 1 && p.value > 0 && m.push(
h(xa, {
pagina: r.value,
totalPaginas: X.value,
maximoBotoes: e.tabela.maximo_botoes_paginacao,
onAlterar: (b) => {
G(b);
}
})
), h(
"div",
{
class: "eli-tabela"
},
m
);
};
}
});
function ct(e, a, s, d, p, y) {
return E(), R("div");
}
const ft = /* @__PURE__ */ Z(dt, [["render", ct], ["__scopeId", "data-v-cfac9b47"]]), Mt = {
install(e) {
e.component("EliOlaMundo", ya), e.component("EliBotao", Oe), e.component("EliBadge", Se), e.component("EliInput", Ue), e.component("EliCartao", ka), e.component("EliDataHora", Ta), e.component("EliTabela", ft);
}
};
export {
Se as EliBadge,
Oe as EliBotao,
ka as EliCartao,
Ta as EliDataHora,
Ue as EliInput,
ya as EliOlaMundo,
ft as EliTabela,
Mt as default
};