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